marko 6.0.0-next.3.56 → 6.0.0-next.3.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/debug/dom.js +17 -19
- package/dist/debug/dom.mjs +17 -19
- package/dist/dom/resolve-cursor-position.d.ts +1 -1
- package/dist/dom.js +17 -17
- package/dist/dom.mjs +17 -17
- package/dist/translator/index.js +13 -0
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
@@ -206,9 +206,14 @@ function handleDelegated(ev) {
|
|
206
206
|
}
|
207
207
|
|
208
208
|
// src/dom/resolve-cursor-position.ts
|
209
|
-
function resolveCursorPosition(
|
210
|
-
if (
|
211
|
-
|
209
|
+
function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
|
210
|
+
if (
|
211
|
+
// If initial position is null or false then
|
212
|
+
// either this node is not the active element
|
213
|
+
// or does not support selection ranges.
|
214
|
+
(initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || // short regex to match input types that delete backwards
|
215
|
+
/kw/.test(inputType2))
|
216
|
+
) {
|
212
217
|
const before = initialValue.slice(0, initialPosition);
|
213
218
|
const after = initialValue.slice(initialPosition);
|
214
219
|
if (updatedValue.startsWith(before)) {
|
@@ -643,22 +648,15 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
643
648
|
}
|
644
649
|
var inputType = "";
|
645
650
|
function setValueAndUpdateSelection(el, value2) {
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
el.value
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
inputType
|
656
|
-
);
|
657
|
-
if (~updatedPosition) {
|
658
|
-
el.setSelectionRange(updatedPosition, updatedPosition);
|
659
|
-
}
|
660
|
-
} else {
|
661
|
-
el.value = value2;
|
651
|
+
if (el.value !== value2) {
|
652
|
+
const updatedPosition = resolveCursorPosition(
|
653
|
+
inputType,
|
654
|
+
el.getRootNode().activeElement === el && el.selectionStart,
|
655
|
+
el.value,
|
656
|
+
el.value = value2
|
657
|
+
);
|
658
|
+
if (~updatedPosition) {
|
659
|
+
el.selectionStart = updatedPosition;
|
662
660
|
}
|
663
661
|
}
|
664
662
|
}
|
package/dist/debug/dom.mjs
CHANGED
@@ -121,9 +121,14 @@ function handleDelegated(ev) {
|
|
121
121
|
}
|
122
122
|
|
123
123
|
// src/dom/resolve-cursor-position.ts
|
124
|
-
function resolveCursorPosition(
|
125
|
-
if (
|
126
|
-
|
124
|
+
function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
|
125
|
+
if (
|
126
|
+
// If initial position is null or false then
|
127
|
+
// either this node is not the active element
|
128
|
+
// or does not support selection ranges.
|
129
|
+
(initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || // short regex to match input types that delete backwards
|
130
|
+
/kw/.test(inputType2))
|
131
|
+
) {
|
127
132
|
const before = initialValue.slice(0, initialPosition);
|
128
133
|
const after = initialValue.slice(initialPosition);
|
129
134
|
if (updatedValue.startsWith(before)) {
|
@@ -558,22 +563,15 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
558
563
|
}
|
559
564
|
var inputType = "";
|
560
565
|
function setValueAndUpdateSelection(el, value2) {
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
el.value
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
inputType
|
571
|
-
);
|
572
|
-
if (~updatedPosition) {
|
573
|
-
el.setSelectionRange(updatedPosition, updatedPosition);
|
574
|
-
}
|
575
|
-
} else {
|
576
|
-
el.value = value2;
|
566
|
+
if (el.value !== value2) {
|
567
|
+
const updatedPosition = resolveCursorPosition(
|
568
|
+
inputType,
|
569
|
+
el.getRootNode().activeElement === el && el.selectionStart,
|
570
|
+
el.value,
|
571
|
+
el.value = value2
|
572
|
+
);
|
573
|
+
if (~updatedPosition) {
|
574
|
+
el.selectionStart = updatedPosition;
|
577
575
|
}
|
578
576
|
}
|
579
577
|
}
|
@@ -1 +1 @@
|
|
1
|
-
export declare function resolveCursorPosition(
|
1
|
+
export declare function resolveCursorPosition(inputType: string, initialPosition: number | null | false, initialValue: string, updatedValue: string): number;
|
package/dist/dom.js
CHANGED
@@ -173,9 +173,14 @@ function handleDelegated(ev) {
|
|
173
173
|
}
|
174
174
|
|
175
175
|
// src/dom/resolve-cursor-position.ts
|
176
|
-
function resolveCursorPosition(
|
177
|
-
if (
|
178
|
-
|
176
|
+
function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
|
177
|
+
if (
|
178
|
+
// If initial position is null or false then
|
179
|
+
// either this node is not the active element
|
180
|
+
// or does not support selection ranges.
|
181
|
+
(initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || // short regex to match input types that delete backwards
|
182
|
+
/kw/.test(inputType2))
|
183
|
+
) {
|
179
184
|
let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
|
180
185
|
if (updatedValue.startsWith(before))
|
181
186
|
return initialPosition;
|
@@ -447,20 +452,15 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
447
452
|
}
|
448
453
|
var inputType = "";
|
449
454
|
function setValueAndUpdateSelection(el, value2) {
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
el.value
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
inputType
|
460
|
-
);
|
461
|
-
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
462
|
-
} else
|
463
|
-
el.value = value2;
|
455
|
+
if (el.value !== value2) {
|
456
|
+
let updatedPosition = resolveCursorPosition(
|
457
|
+
inputType,
|
458
|
+
el.getRootNode().activeElement === el && el.selectionStart,
|
459
|
+
el.value,
|
460
|
+
el.value = value2
|
461
|
+
);
|
462
|
+
~updatedPosition && (el.selectionStart = updatedPosition);
|
463
|
+
}
|
464
464
|
}
|
465
465
|
function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
|
466
466
|
scope[nodeAccessor + ";" /* ControlledHandler */] = checkedChange, checkedChange ? (scope[nodeAccessor + "=" /* ControlledType */] = type, scope[nodeAccessor].checked = checked) : (scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */, scope[nodeAccessor].defaultChecked = checked);
|
package/dist/dom.mjs
CHANGED
@@ -91,9 +91,14 @@ function handleDelegated(ev) {
|
|
91
91
|
}
|
92
92
|
|
93
93
|
// src/dom/resolve-cursor-position.ts
|
94
|
-
function resolveCursorPosition(
|
95
|
-
if (
|
96
|
-
|
94
|
+
function resolveCursorPosition(inputType2, initialPosition, initialValue, updatedValue) {
|
95
|
+
if (
|
96
|
+
// If initial position is null or false then
|
97
|
+
// either this node is not the active element
|
98
|
+
// or does not support selection ranges.
|
99
|
+
(initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || // short regex to match input types that delete backwards
|
100
|
+
/kw/.test(inputType2))
|
101
|
+
) {
|
97
102
|
let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
|
98
103
|
if (updatedValue.startsWith(before))
|
99
104
|
return initialPosition;
|
@@ -365,20 +370,15 @@ function controllable_detailsOrDialog_open_effect(scope, nodeAccessor) {
|
|
365
370
|
}
|
366
371
|
var inputType = "";
|
367
372
|
function setValueAndUpdateSelection(el, value2) {
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
el.value
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
inputType
|
378
|
-
);
|
379
|
-
~updatedPosition && el.setSelectionRange(updatedPosition, updatedPosition);
|
380
|
-
} else
|
381
|
-
el.value = value2;
|
373
|
+
if (el.value !== value2) {
|
374
|
+
let updatedPosition = resolveCursorPosition(
|
375
|
+
inputType,
|
376
|
+
el.getRootNode().activeElement === el && el.selectionStart,
|
377
|
+
el.value,
|
378
|
+
el.value = value2
|
379
|
+
);
|
380
|
+
~updatedPosition && (el.selectionStart = updatedPosition);
|
381
|
+
}
|
382
382
|
}
|
383
383
|
function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
|
384
384
|
scope[nodeAccessor + ";" /* ControlledHandler */] = checkedChange, checkedChange ? (scope[nodeAccessor + "=" /* ControlledType */] = type, scope[nodeAccessor].checked = checked) : (scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */, scope[nodeAccessor].defaultChecked = checked);
|
package/dist/translator/index.js
CHANGED
@@ -8494,6 +8494,7 @@ var kBinding = Symbol("placeholder node binding");
|
|
8494
8494
|
var kSiblingText = Symbol("placeholder has sibling text");
|
8495
8495
|
var placeholder_default = {
|
8496
8496
|
analyze(placeholder) {
|
8497
|
+
if (isNonHTMLPlaceholder(placeholder)) return;
|
8497
8498
|
const { node } = placeholder;
|
8498
8499
|
const { confident, computed } = evaluate(node.value);
|
8499
8500
|
if (!(confident && (node.escape || isVoid2(computed)))) {
|
@@ -8610,6 +8611,18 @@ function analyzeSiblingText(placeholder) {
|
|
8610
8611
|
}
|
8611
8612
|
return placeholderExtra[kSiblingText] = 0 /* None */;
|
8612
8613
|
}
|
8614
|
+
function isNonHTMLPlaceholder(placeholder) {
|
8615
|
+
const parentTag = placeholder.parentPath.isMarkoTagBody() && placeholder.parentPath.parentPath;
|
8616
|
+
if (parentTag && isCoreTag(parentTag)) {
|
8617
|
+
switch (parentTag.node.name.value) {
|
8618
|
+
case "html-comment":
|
8619
|
+
case "html-script":
|
8620
|
+
case "html-style":
|
8621
|
+
return true;
|
8622
|
+
}
|
8623
|
+
}
|
8624
|
+
return false;
|
8625
|
+
}
|
8613
8626
|
function isVoid2(value) {
|
8614
8627
|
return value == null || value === false;
|
8615
8628
|
}
|