marko 6.0.0-next.3.55 → 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 +28 -2
- 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
@@ -1172,7 +1172,7 @@ function startSection(path5) {
|
|
1172
1172
|
function getOrCreateSection(path5) {
|
1173
1173
|
let cur = path5;
|
1174
1174
|
while (true) {
|
1175
|
-
if (cur.type === "Program" || cur.type === "MarkoTagBody" && !cur.node.attributeTags &&
|
1175
|
+
if (cur.type === "Program" || cur.type === "MarkoTagBody" && !cur.node.attributeTags && !isNativeNode(cur.parentPath)) {
|
1176
1176
|
return startSection(cur);
|
1177
1177
|
}
|
1178
1178
|
cur = cur.parentPath;
|
@@ -1331,6 +1331,19 @@ function getCommonSection(section, other) {
|
|
1331
1331
|
}
|
1332
1332
|
throw new Error("No common section");
|
1333
1333
|
}
|
1334
|
+
function isNativeNode(tag) {
|
1335
|
+
if (isCoreTag(tag)) {
|
1336
|
+
switch (tag.node.name.value) {
|
1337
|
+
case "html-comment":
|
1338
|
+
case "html-script":
|
1339
|
+
case "html-style":
|
1340
|
+
return true;
|
1341
|
+
default:
|
1342
|
+
return false;
|
1343
|
+
}
|
1344
|
+
}
|
1345
|
+
return analyzeTagNameType(tag) === 0 /* NativeTag */;
|
1346
|
+
}
|
1334
1347
|
|
1335
1348
|
// src/translator/visitors/program/dom.ts
|
1336
1349
|
var import_compiler18 = require("@marko/compiler");
|
@@ -7779,7 +7792,7 @@ var let_default = {
|
|
7779
7792
|
return import_compiler41.types.callExpression(signal.identifier, [scope, value]);
|
7780
7793
|
};
|
7781
7794
|
} else {
|
7782
|
-
translateVar(tag, valueAttr.value);
|
7795
|
+
translateVar(tag, valueAttr.value, "let");
|
7783
7796
|
if (valueChangeAttr) {
|
7784
7797
|
setSerializedProperty(
|
7785
7798
|
section,
|
@@ -8481,6 +8494,7 @@ var kBinding = Symbol("placeholder node binding");
|
|
8481
8494
|
var kSiblingText = Symbol("placeholder has sibling text");
|
8482
8495
|
var placeholder_default = {
|
8483
8496
|
analyze(placeholder) {
|
8497
|
+
if (isNonHTMLPlaceholder(placeholder)) return;
|
8484
8498
|
const { node } = placeholder;
|
8485
8499
|
const { confident, computed } = evaluate(node.value);
|
8486
8500
|
if (!(confident && (node.escape || isVoid2(computed)))) {
|
@@ -8597,6 +8611,18 @@ function analyzeSiblingText(placeholder) {
|
|
8597
8611
|
}
|
8598
8612
|
return placeholderExtra[kSiblingText] = 0 /* None */;
|
8599
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
|
+
}
|
8600
8626
|
function isVoid2(value) {
|
8601
8627
|
return value == null || value === false;
|
8602
8628
|
}
|