marko 6.3.16 → 6.3.17
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/LICENSE +21 -0
- package/dist/common/accessor.d.ts +1 -0
- package/dist/common/accessor.debug.d.ts +1 -0
- package/dist/common/types.d.ts +0 -1
- package/dist/debug/dom.js +24 -16
- package/dist/debug/dom.mjs +24 -16
- package/dist/debug/html.js +25 -11
- package/dist/debug/html.mjs +25 -12
- package/dist/dom.js +14 -15
- package/dist/dom.mjs +14 -15
- package/dist/html/attrs.d.ts +1 -0
- package/dist/html.d.ts +1 -1
- package/dist/html.js +15 -6
- package/dist/html.mjs +15 -6
- package/dist/translator/index.js +48 -35
- package/dist/translator/util/body-to-text-literal.d.ts +2 -2
- package/dist/translator/util/to-first-expression-or-block.d.ts +1 -2
- package/dist/translator/util/walks.d.ts +1 -1
- package/dist/translator/util/writer.d.ts +1 -1
- package/package.json +11 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright 2024 eBay Inc. and contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/dist/common/types.d.ts
CHANGED
package/dist/debug/dom.js
CHANGED
|
@@ -991,9 +991,12 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
991
991
|
if (checkedValueChange) {
|
|
992
992
|
const controlledValueKey = "ControlledValue:" + nodeAccessor;
|
|
993
993
|
const oldValue = scope[controlledValueKey];
|
|
994
|
-
|
|
994
|
+
let newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
995
995
|
if (el.name && el.type[0] === "r") {
|
|
996
|
-
for (const radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) if (radio.form === el.form)
|
|
996
|
+
for (const radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) if (radio.form === el.form) {
|
|
997
|
+
if (newValue === void 0 && radio.defaultChecked) newValue = radio.value;
|
|
998
|
+
radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : controlledValueKey in scope ? oldValue === radio.value : radio.defaultChecked;
|
|
999
|
+
}
|
|
997
1000
|
} else el.checked = !el.checked;
|
|
998
1001
|
checkedValueChange(newValue);
|
|
999
1002
|
run();
|
|
@@ -1500,7 +1503,9 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1500
1503
|
}
|
|
1501
1504
|
}, (error) => {
|
|
1502
1505
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1503
|
-
|
|
1506
|
+
scope[promiseAccessor] = 0;
|
|
1507
|
+
if (tryPlaceholder && !awaitCounter.m) awaitCounter.c();
|
|
1508
|
+
else awaitCounter.i = 0;
|
|
1504
1509
|
queueAsyncRender(scope, renderCatch, error);
|
|
1505
1510
|
}
|
|
1506
1511
|
});
|
|
@@ -1733,12 +1738,17 @@ function loop(forEach) {
|
|
|
1733
1738
|
const parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.["#StartNode"].parentNode : referenceNode;
|
|
1734
1739
|
let oldScopesByKey;
|
|
1735
1740
|
let hasPotentialMoves;
|
|
1741
|
+
let start = 0;
|
|
1736
1742
|
var seenKeys = /* @__PURE__ */ new Set();
|
|
1737
1743
|
forEach(value, (key, args) => {
|
|
1738
1744
|
assertValidLoopKey(key, seenKeys);
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1745
|
+
const i = newScopes.length;
|
|
1746
|
+
const oldScope = oldScopes[i];
|
|
1747
|
+
let branch = oldLen && (oldScopesByKey || key !== (oldScope?.["#LoopKey"] ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope["#LoopIndex"] = j, map.set(scope["#LoopKey"] ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
1748
|
+
if (branch) {
|
|
1749
|
+
hasPotentialMoves = true;
|
|
1750
|
+
oldScopesByKey?.delete(key);
|
|
1751
|
+
} else branch = createAndSetupBranch(scope["$global"], renderer, scope, parentNode);
|
|
1742
1752
|
branch["#LoopKey"] = key;
|
|
1743
1753
|
newScopes.push(branch);
|
|
1744
1754
|
params?.(branch, args);
|
|
@@ -1748,7 +1758,6 @@ function loop(forEach) {
|
|
|
1748
1758
|
let afterReference = null;
|
|
1749
1759
|
let oldEnd = oldLen - 1;
|
|
1750
1760
|
let newEnd = newLen - 1;
|
|
1751
|
-
let start = 0;
|
|
1752
1761
|
if (hasSiblings) {
|
|
1753
1762
|
if (oldLen) {
|
|
1754
1763
|
afterReference = oldScopes[oldEnd]["#EndNode"].nextSibling;
|
|
@@ -1766,19 +1775,18 @@ function loop(forEach) {
|
|
|
1766
1775
|
for (const newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
|
|
1767
1776
|
return;
|
|
1768
1777
|
}
|
|
1769
|
-
|
|
1770
|
-
|
|
1778
|
+
if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
|
|
1779
|
+
else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
|
|
1771
1780
|
while (oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd]) {
|
|
1772
1781
|
oldEnd--;
|
|
1773
1782
|
newEnd--;
|
|
1774
1783
|
}
|
|
1775
1784
|
if (oldEnd + 1 < oldLen) afterReference = oldScopes[oldEnd + 1]["#StartNode"];
|
|
1776
|
-
if (start > oldEnd) {
|
|
1777
|
-
|
|
1785
|
+
if (start > oldEnd || start > newEnd) {
|
|
1786
|
+
for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
1778
1787
|
return;
|
|
1779
|
-
}
|
|
1788
|
+
}
|
|
1780
1789
|
const diffLen = newEnd - start + 1;
|
|
1781
|
-
const oldPos = /* @__PURE__ */ new Map();
|
|
1782
1790
|
const sources = new Array(diffLen);
|
|
1783
1791
|
const pred = new Array(diffLen);
|
|
1784
1792
|
const tails = [];
|
|
@@ -1786,8 +1794,7 @@ function loop(forEach) {
|
|
|
1786
1794
|
let lo;
|
|
1787
1795
|
let hi;
|
|
1788
1796
|
let mid;
|
|
1789
|
-
for (let i =
|
|
1790
|
-
for (let i = diffLen; i--;) sources[i] = oldPos.get(newScopes[start + i]) ?? -1;
|
|
1797
|
+
for (let i = diffLen; i--;) sources[i] = newScopes[start + i]["#LoopIndex"] ?? -1;
|
|
1791
1798
|
for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) {
|
|
1792
1799
|
if (~tail) pred[i] = tails[tail];
|
|
1793
1800
|
tails[++tail] = i;
|
|
@@ -2217,7 +2224,8 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
2217
2224
|
}
|
|
2218
2225
|
function loadFailed(scope, awaitCounter) {
|
|
2219
2226
|
return (error) => {
|
|
2220
|
-
if (awaitCounter) awaitCounter.i = 0;
|
|
2227
|
+
if (awaitCounter) if (awaitCounter.m) awaitCounter.i = 0;
|
|
2228
|
+
else awaitCounter.c();
|
|
2221
2229
|
queueAsyncRender(scope, renderCatch, error);
|
|
2222
2230
|
};
|
|
2223
2231
|
}
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -989,9 +989,12 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
989
989
|
if (checkedValueChange) {
|
|
990
990
|
const controlledValueKey = "ControlledValue:" + nodeAccessor;
|
|
991
991
|
const oldValue = scope[controlledValueKey];
|
|
992
|
-
|
|
992
|
+
let newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
993
993
|
if (el.name && el.type[0] === "r") {
|
|
994
|
-
for (const radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) if (radio.form === el.form)
|
|
994
|
+
for (const radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) if (radio.form === el.form) {
|
|
995
|
+
if (newValue === void 0 && radio.defaultChecked) newValue = radio.value;
|
|
996
|
+
radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : controlledValueKey in scope ? oldValue === radio.value : radio.defaultChecked;
|
|
997
|
+
}
|
|
995
998
|
} else el.checked = !el.checked;
|
|
996
999
|
checkedValueChange(newValue);
|
|
997
1000
|
run();
|
|
@@ -1498,7 +1501,9 @@ function _await_promise(nodeAccessor, params) {
|
|
|
1498
1501
|
}
|
|
1499
1502
|
}, (error) => {
|
|
1500
1503
|
if (thisPromise === scope[promiseAccessor]) {
|
|
1501
|
-
|
|
1504
|
+
scope[promiseAccessor] = 0;
|
|
1505
|
+
if (tryPlaceholder && !awaitCounter.m) awaitCounter.c();
|
|
1506
|
+
else awaitCounter.i = 0;
|
|
1502
1507
|
queueAsyncRender(scope, renderCatch, error);
|
|
1503
1508
|
}
|
|
1504
1509
|
});
|
|
@@ -1731,12 +1736,17 @@ function loop(forEach) {
|
|
|
1731
1736
|
const parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.["#StartNode"].parentNode : referenceNode;
|
|
1732
1737
|
let oldScopesByKey;
|
|
1733
1738
|
let hasPotentialMoves;
|
|
1739
|
+
let start = 0;
|
|
1734
1740
|
var seenKeys = /* @__PURE__ */ new Set();
|
|
1735
1741
|
forEach(value, (key, args) => {
|
|
1736
1742
|
assertValidLoopKey(key, seenKeys);
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1743
|
+
const i = newScopes.length;
|
|
1744
|
+
const oldScope = oldScopes[i];
|
|
1745
|
+
let branch = oldLen && (oldScopesByKey || key !== (oldScope?.["#LoopKey"] ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope["#LoopIndex"] = j, map.set(scope["#LoopKey"] ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
1746
|
+
if (branch) {
|
|
1747
|
+
hasPotentialMoves = true;
|
|
1748
|
+
oldScopesByKey?.delete(key);
|
|
1749
|
+
} else branch = createAndSetupBranch(scope["$global"], renderer, scope, parentNode);
|
|
1740
1750
|
branch["#LoopKey"] = key;
|
|
1741
1751
|
newScopes.push(branch);
|
|
1742
1752
|
params?.(branch, args);
|
|
@@ -1746,7 +1756,6 @@ function loop(forEach) {
|
|
|
1746
1756
|
let afterReference = null;
|
|
1747
1757
|
let oldEnd = oldLen - 1;
|
|
1748
1758
|
let newEnd = newLen - 1;
|
|
1749
|
-
let start = 0;
|
|
1750
1759
|
if (hasSiblings) {
|
|
1751
1760
|
if (oldLen) {
|
|
1752
1761
|
afterReference = oldScopes[oldEnd]["#EndNode"].nextSibling;
|
|
@@ -1764,19 +1773,18 @@ function loop(forEach) {
|
|
|
1764
1773
|
for (const newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
|
|
1765
1774
|
return;
|
|
1766
1775
|
}
|
|
1767
|
-
|
|
1768
|
-
|
|
1776
|
+
if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
|
|
1777
|
+
else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
|
|
1769
1778
|
while (oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd]) {
|
|
1770
1779
|
oldEnd--;
|
|
1771
1780
|
newEnd--;
|
|
1772
1781
|
}
|
|
1773
1782
|
if (oldEnd + 1 < oldLen) afterReference = oldScopes[oldEnd + 1]["#StartNode"];
|
|
1774
|
-
if (start > oldEnd) {
|
|
1775
|
-
|
|
1783
|
+
if (start > oldEnd || start > newEnd) {
|
|
1784
|
+
for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
1776
1785
|
return;
|
|
1777
|
-
}
|
|
1786
|
+
}
|
|
1778
1787
|
const diffLen = newEnd - start + 1;
|
|
1779
|
-
const oldPos = /* @__PURE__ */ new Map();
|
|
1780
1788
|
const sources = new Array(diffLen);
|
|
1781
1789
|
const pred = new Array(diffLen);
|
|
1782
1790
|
const tails = [];
|
|
@@ -1784,8 +1792,7 @@ function loop(forEach) {
|
|
|
1784
1792
|
let lo;
|
|
1785
1793
|
let hi;
|
|
1786
1794
|
let mid;
|
|
1787
|
-
for (let i =
|
|
1788
|
-
for (let i = diffLen; i--;) sources[i] = oldPos.get(newScopes[start + i]) ?? -1;
|
|
1795
|
+
for (let i = diffLen; i--;) sources[i] = newScopes[start + i]["#LoopIndex"] ?? -1;
|
|
1789
1796
|
for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) {
|
|
1790
1797
|
if (~tail) pred[i] = tails[tail];
|
|
1791
1798
|
tails[++tail] = i;
|
|
@@ -2215,7 +2222,8 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
2215
2222
|
}
|
|
2216
2223
|
function loadFailed(scope, awaitCounter) {
|
|
2217
2224
|
return (error) => {
|
|
2218
|
-
if (awaitCounter) awaitCounter.i = 0;
|
|
2225
|
+
if (awaitCounter) if (awaitCounter.m) awaitCounter.i = 0;
|
|
2226
|
+
else awaitCounter.c();
|
|
2219
2227
|
queueAsyncRender(scope, renderCatch, error);
|
|
2220
2228
|
};
|
|
2221
2229
|
}
|
package/dist/debug/html.js
CHANGED
|
@@ -239,8 +239,8 @@ function _escape_script(val) {
|
|
|
239
239
|
assertValidTextValue(val);
|
|
240
240
|
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
241
241
|
}
|
|
242
|
-
const unsafeStyleReg =
|
|
243
|
-
const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C
|
|
242
|
+
const unsafeStyleReg = /<(\/style)/gi;
|
|
243
|
+
const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str;
|
|
244
244
|
function _escape_style(val) {
|
|
245
245
|
assertValidTextValue(val);
|
|
246
246
|
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
@@ -906,11 +906,18 @@ function writeDate(state, val) {
|
|
|
906
906
|
state.buf.push("new Date(" + +val + ")");
|
|
907
907
|
return true;
|
|
908
908
|
}
|
|
909
|
-
const unsafeRegExpSourceReg = /\\[\s\S]
|
|
910
|
-
const
|
|
909
|
+
const unsafeRegExpSourceReg = /\\[\s\S]|[<\0\ud800-\udfff]/gu;
|
|
910
|
+
const unsafeRegExpSourceDetect = /[<\0\ud800-\udfff]/u;
|
|
911
|
+
const replaceUnsafeRegExpSourceChar = (match) => {
|
|
912
|
+
const ch = match.length === 3 ? "" : match[match.length - 1];
|
|
913
|
+
if (ch === "<") return "\\x3C";
|
|
914
|
+
if (ch === "\0") return "\\x00";
|
|
915
|
+
const code = ch.charCodeAt(0);
|
|
916
|
+
return code >= 55296 && code <= 57343 ? "\\u" + code.toString(16).padStart(4, "0") : match;
|
|
917
|
+
};
|
|
911
918
|
function writeRegExp(state, val) {
|
|
912
919
|
const { source } = val;
|
|
913
|
-
state.buf.push("/" + (
|
|
920
|
+
state.buf.push("/" + (unsafeRegExpSourceDetect.test(source) ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags);
|
|
914
921
|
return true;
|
|
915
922
|
}
|
|
916
923
|
function writePromise(state, val, ref) {
|
|
@@ -2582,15 +2589,21 @@ const kSelectedValue = Symbol("selectedValue");
|
|
|
2582
2589
|
const kSelectedValueMatched = Symbol("selectedValueMatched");
|
|
2583
2590
|
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
2584
2591
|
if (valueChange) writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
2585
|
-
if (content)
|
|
2586
|
-
const
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2592
|
+
if (content) {
|
|
2593
|
+
const selectedValue = value ?? "";
|
|
2594
|
+
if (valueChange) {
|
|
2595
|
+
const matched = { value: false };
|
|
2596
|
+
withContext(kSelectedValue, selectedValue, () => withContext(kSelectedValueMatched, matched, content));
|
|
2597
|
+
if (!matched.value && (Array.isArray(value) ? value.some((v) => normalizeStrAttrValue(v) !== "") : normalizeStrAttrValue(value) !== "")) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
|
|
2598
|
+
} else withContext(kSelectedValue, selectedValue, content);
|
|
2599
|
+
}
|
|
2590
2600
|
}
|
|
2591
2601
|
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2592
2602
|
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
2593
|
-
return
|
|
2603
|
+
return _textarea_value(value);
|
|
2604
|
+
}
|
|
2605
|
+
function _textarea_value(value) {
|
|
2606
|
+
return _escape(normalizeStrAttrValue(value));
|
|
2594
2607
|
}
|
|
2595
2608
|
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2596
2609
|
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
@@ -3344,6 +3357,7 @@ exports._show_start = _show_start;
|
|
|
3344
3357
|
exports._style_html = _style_html;
|
|
3345
3358
|
exports._subscribe = _subscribe;
|
|
3346
3359
|
exports._template = _template;
|
|
3360
|
+
exports._textarea_value = _textarea_value;
|
|
3347
3361
|
exports._to_text = _to_text;
|
|
3348
3362
|
exports._trailers = _trailers;
|
|
3349
3363
|
exports._try = _try;
|
package/dist/debug/html.mjs
CHANGED
|
@@ -237,8 +237,8 @@ function _escape_script(val) {
|
|
|
237
237
|
assertValidTextValue(val);
|
|
238
238
|
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
239
239
|
}
|
|
240
|
-
const unsafeStyleReg =
|
|
241
|
-
const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C
|
|
240
|
+
const unsafeStyleReg = /<(\/style)/gi;
|
|
241
|
+
const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str;
|
|
242
242
|
function _escape_style(val) {
|
|
243
243
|
assertValidTextValue(val);
|
|
244
244
|
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
@@ -904,11 +904,18 @@ function writeDate(state, val) {
|
|
|
904
904
|
state.buf.push("new Date(" + +val + ")");
|
|
905
905
|
return true;
|
|
906
906
|
}
|
|
907
|
-
const unsafeRegExpSourceReg = /\\[\s\S]
|
|
908
|
-
const
|
|
907
|
+
const unsafeRegExpSourceReg = /\\[\s\S]|[<\0\ud800-\udfff]/gu;
|
|
908
|
+
const unsafeRegExpSourceDetect = /[<\0\ud800-\udfff]/u;
|
|
909
|
+
const replaceUnsafeRegExpSourceChar = (match) => {
|
|
910
|
+
const ch = match.length === 3 ? "" : match[match.length - 1];
|
|
911
|
+
if (ch === "<") return "\\x3C";
|
|
912
|
+
if (ch === "\0") return "\\x00";
|
|
913
|
+
const code = ch.charCodeAt(0);
|
|
914
|
+
return code >= 55296 && code <= 57343 ? "\\u" + code.toString(16).padStart(4, "0") : match;
|
|
915
|
+
};
|
|
909
916
|
function writeRegExp(state, val) {
|
|
910
917
|
const { source } = val;
|
|
911
|
-
state.buf.push("/" + (
|
|
918
|
+
state.buf.push("/" + (unsafeRegExpSourceDetect.test(source) ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags);
|
|
912
919
|
return true;
|
|
913
920
|
}
|
|
914
921
|
function writePromise(state, val, ref) {
|
|
@@ -2580,15 +2587,21 @@ const kSelectedValue = Symbol("selectedValue");
|
|
|
2580
2587
|
const kSelectedValueMatched = Symbol("selectedValueMatched");
|
|
2581
2588
|
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
2582
2589
|
if (valueChange) writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
2583
|
-
if (content)
|
|
2584
|
-
const
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2590
|
+
if (content) {
|
|
2591
|
+
const selectedValue = value ?? "";
|
|
2592
|
+
if (valueChange) {
|
|
2593
|
+
const matched = { value: false };
|
|
2594
|
+
withContext(kSelectedValue, selectedValue, () => withContext(kSelectedValueMatched, matched, content));
|
|
2595
|
+
if (!matched.value && (Array.isArray(value) ? value.some((v) => normalizeStrAttrValue(v) !== "") : normalizeStrAttrValue(value) !== "")) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
|
|
2596
|
+
} else withContext(kSelectedValue, selectedValue, content);
|
|
2597
|
+
}
|
|
2588
2598
|
}
|
|
2589
2599
|
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2590
2600
|
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
2591
|
-
return
|
|
2601
|
+
return _textarea_value(value);
|
|
2602
|
+
}
|
|
2603
|
+
function _textarea_value(value) {
|
|
2604
|
+
return _escape(normalizeStrAttrValue(value));
|
|
2592
2605
|
}
|
|
2593
2606
|
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2594
2607
|
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
@@ -3270,4 +3283,4 @@ const compat = {
|
|
|
3270
3283
|
};
|
|
3271
3284
|
function NOOP() {}
|
|
3272
3285
|
//#endregion
|
|
3273
|
-
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
|
|
3286
|
+
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
|
package/dist/dom.js
CHANGED
|
@@ -620,7 +620,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
620
620
|
let checkedValueChange = scope["E" + nodeAccessor];
|
|
621
621
|
if (checkedValueChange) {
|
|
622
622
|
let controlledValueKey = "G" + nodeAccessor, oldValue = scope[controlledValueKey], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
623
|
-
if (el.name && el.type[0] === "r") for (let radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : controlledValueKey in scope ? oldValue === radio.value : radio.defaultChecked);
|
|
623
|
+
if (el.name && el.type[0] === "r") for (let radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) radio.form === el.form && (newValue === void 0 && radio.defaultChecked && (newValue = radio.value), radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : controlledValueKey in scope ? oldValue === radio.value : radio.defaultChecked);
|
|
624
624
|
else el.checked = !el.checked;
|
|
625
625
|
checkedValueChange(newValue), run();
|
|
626
626
|
}
|
|
@@ -977,7 +977,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
977
977
|
});
|
|
978
978
|
}
|
|
979
979
|
}, (error) => {
|
|
980
|
-
thisPromise === scope[promiseAccessor] && (
|
|
980
|
+
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, tryPlaceholder && !awaitCounter.m ? awaitCounter.c() : awaitCounter.i = 0, queueAsyncRender(scope, renderCatch, error));
|
|
981
981
|
});
|
|
982
982
|
};
|
|
983
983
|
}
|
|
@@ -1083,27 +1083,26 @@ function loop(forEach) {
|
|
|
1083
1083
|
return enableBranches(), (scope, value) => {
|
|
1084
1084
|
let referenceNode = scope[nodeAccessor], oldScopes = toArray(scope[scopesAccessor]), newScopes = scope[scopesAccessor] = [];
|
|
1085
1085
|
scope[keyedScopesAccessor] = null;
|
|
1086
|
-
let oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves;
|
|
1086
|
+
let oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves, start = 0;
|
|
1087
1087
|
forEach(value, (key, args) => {
|
|
1088
|
-
let branch = oldLen && (oldScopesByKey ||= oldScopes.reduce((map, scope,
|
|
1089
|
-
branch ? hasPotentialMoves = oldScopesByKey
|
|
1088
|
+
let i = newScopes.length, oldScope = oldScopes[i], branch = oldLen && (oldScopesByKey || key !== (oldScope?.M ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope.I = j, map.set(scope.M ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
1089
|
+
branch ? (hasPotentialMoves = !0, oldScopesByKey?.delete(key)) : branch = createAndSetupBranch(scope.$, renderer, scope, parentNode), branch.M = key, newScopes.push(branch), params?.(branch, args);
|
|
1090
1090
|
});
|
|
1091
|
-
let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1
|
|
1091
|
+
let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1;
|
|
1092
1092
|
if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
|
|
1093
1093
|
oldLen && (oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch), hasSiblings || (parentNode.textContent = ""));
|
|
1094
1094
|
for (let newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
|
|
1095
1095
|
return;
|
|
1096
1096
|
}
|
|
1097
|
-
|
|
1098
|
-
for (
|
|
1097
|
+
if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
|
|
1098
|
+
else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
|
|
1099
1099
|
for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd];) oldEnd--, newEnd--;
|
|
1100
|
-
if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd) {
|
|
1101
|
-
|
|
1100
|
+
if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd || start > newEnd) {
|
|
1101
|
+
for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
1102
1102
|
return;
|
|
1103
|
-
}
|
|
1104
|
-
let diffLen = newEnd - start + 1,
|
|
1105
|
-
for (let i =
|
|
1106
|
-
for (let i = diffLen; i--;) sources[i] = oldPos.get(newScopes[start + i]) ?? -1;
|
|
1103
|
+
}
|
|
1104
|
+
let diffLen = newEnd - start + 1, sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
|
|
1105
|
+
for (let i = diffLen; i--;) sources[i] = newScopes[start + i].I ?? -1;
|
|
1107
1106
|
for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
|
|
1108
1107
|
else {
|
|
1109
1108
|
for (lo = 0, hi = tail; lo < hi;) mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
|
|
@@ -1321,7 +1320,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
1321
1320
|
}
|
|
1322
1321
|
function loadFailed(scope, awaitCounter) {
|
|
1323
1322
|
return (error) => {
|
|
1324
|
-
awaitCounter && (awaitCounter.i = 0), queueAsyncRender(scope, renderCatch, error);
|
|
1323
|
+
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), queueAsyncRender(scope, renderCatch, error);
|
|
1325
1324
|
};
|
|
1326
1325
|
}
|
|
1327
1326
|
function _load_signal(load) {
|
package/dist/dom.mjs
CHANGED
|
@@ -619,7 +619,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
|
|
|
619
619
|
let checkedValueChange = scope["E" + nodeAccessor];
|
|
620
620
|
if (checkedValueChange) {
|
|
621
621
|
let controlledValueKey = "G" + nodeAccessor, oldValue = scope[controlledValueKey], newValue = Array.isArray(oldValue) ? updateList(oldValue, el.value, el.checked) : el.checked ? el.value : void 0;
|
|
622
|
-
if (el.name && el.type[0] === "r") for (let radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) radio.form === el.form && (radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : controlledValueKey in scope ? oldValue === radio.value : radio.defaultChecked);
|
|
622
|
+
if (el.name && el.type[0] === "r") for (let radio of document.querySelectorAll(`[type=radio][name=${CSS.escape(el.name)}]`)) radio.form === el.form && (newValue === void 0 && radio.defaultChecked && (newValue = radio.value), radio.checked = Array.isArray(oldValue) ? oldValue.includes(radio.value) : controlledValueKey in scope ? oldValue === radio.value : radio.defaultChecked);
|
|
623
623
|
else el.checked = !el.checked;
|
|
624
624
|
checkedValueChange(newValue), run();
|
|
625
625
|
}
|
|
@@ -976,7 +976,7 @@ function _await_promise(nodeAccessor, params) {
|
|
|
976
976
|
});
|
|
977
977
|
}
|
|
978
978
|
}, (error) => {
|
|
979
|
-
thisPromise === scope[promiseAccessor] && (
|
|
979
|
+
thisPromise === scope[promiseAccessor] && (scope[promiseAccessor] = 0, tryPlaceholder && !awaitCounter.m ? awaitCounter.c() : awaitCounter.i = 0, queueAsyncRender(scope, renderCatch, error));
|
|
980
980
|
});
|
|
981
981
|
};
|
|
982
982
|
}
|
|
@@ -1082,27 +1082,26 @@ function loop(forEach) {
|
|
|
1082
1082
|
return enableBranches(), (scope, value) => {
|
|
1083
1083
|
let referenceNode = scope[nodeAccessor], oldScopes = toArray(scope[scopesAccessor]), newScopes = scope[scopesAccessor] = [];
|
|
1084
1084
|
scope[keyedScopesAccessor] = null;
|
|
1085
|
-
let oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves;
|
|
1085
|
+
let oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves, start = 0;
|
|
1086
1086
|
forEach(value, (key, args) => {
|
|
1087
|
-
let branch = oldLen && (oldScopesByKey ||= oldScopes.reduce((map, scope,
|
|
1088
|
-
branch ? hasPotentialMoves = oldScopesByKey
|
|
1087
|
+
let i = newScopes.length, oldScope = oldScopes[i], branch = oldLen && (oldScopesByKey || key !== (oldScope?.M ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope.I = j, map.set(scope.M ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
|
|
1088
|
+
branch ? (hasPotentialMoves = !0, oldScopesByKey?.delete(key)) : branch = createAndSetupBranch(scope.$, renderer, scope, parentNode), branch.M = key, newScopes.push(branch), params?.(branch, args);
|
|
1089
1089
|
});
|
|
1090
|
-
let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1
|
|
1090
|
+
let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1;
|
|
1091
1091
|
if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
|
|
1092
1092
|
oldLen && (oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch), hasSiblings || (parentNode.textContent = ""));
|
|
1093
1093
|
for (let newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
|
|
1094
1094
|
return;
|
|
1095
1095
|
}
|
|
1096
|
-
|
|
1097
|
-
for (
|
|
1096
|
+
if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
|
|
1097
|
+
else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
|
|
1098
1098
|
for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd];) oldEnd--, newEnd--;
|
|
1099
|
-
if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd) {
|
|
1100
|
-
|
|
1099
|
+
if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd || start > newEnd) {
|
|
1100
|
+
for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
|
|
1101
1101
|
return;
|
|
1102
|
-
}
|
|
1103
|
-
let diffLen = newEnd - start + 1,
|
|
1104
|
-
for (let i =
|
|
1105
|
-
for (let i = diffLen; i--;) sources[i] = oldPos.get(newScopes[start + i]) ?? -1;
|
|
1102
|
+
}
|
|
1103
|
+
let diffLen = newEnd - start + 1, sources = Array(diffLen), pred = Array(diffLen), tails = [], tail = -1, lo, hi, mid;
|
|
1104
|
+
for (let i = diffLen; i--;) sources[i] = newScopes[start + i].I ?? -1;
|
|
1106
1105
|
for (let i = 0; i < diffLen; i++) if (~sources[i]) if (tail < 0 || sources[tails[tail]] < sources[i]) ~tail && (pred[i] = tails[tail]), tails[++tail] = i;
|
|
1107
1106
|
else {
|
|
1108
1107
|
for (lo = 0, hi = tail; lo < hi;) mid = (lo + hi) / 2 | 0, sources[tails[mid]] < sources[i] ? lo = mid + 1 : hi = mid;
|
|
@@ -1320,7 +1319,7 @@ function insertLoaded(renderer, branch, marker, awaitCounter) {
|
|
|
1320
1319
|
}
|
|
1321
1320
|
function loadFailed(scope, awaitCounter) {
|
|
1322
1321
|
return (error) => {
|
|
1323
|
-
awaitCounter && (awaitCounter.i = 0), queueAsyncRender(scope, renderCatch, error);
|
|
1322
|
+
awaitCounter && (awaitCounter.m ? awaitCounter.i = 0 : awaitCounter.c()), queueAsyncRender(scope, renderCatch, error);
|
|
1324
1323
|
};
|
|
1325
1324
|
}
|
|
1326
1325
|
function _load_signal(load) {
|
package/dist/html/attrs.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare function _attr_style(value: unknown): string;
|
|
|
4
4
|
export declare function _attr_option_value(value: unknown): string;
|
|
5
5
|
export declare function _attr_select_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown, content?: () => void, serializeType?: 1): void;
|
|
6
6
|
export declare function _attr_textarea_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown, serializeType?: 1): string;
|
|
7
|
+
export declare function _textarea_value(value: unknown): string;
|
|
7
8
|
export declare function _attr_input_value(scopeId: number, nodeAccessor: Accessor, value: unknown, valueChange: unknown, serializeType?: 1): string;
|
|
8
9
|
export declare function _attr_input_checked(scopeId: number, nodeAccessor: Accessor, checked: unknown, checkedChange: unknown, serializeType?: 1): "" | " checked";
|
|
9
10
|
export declare function _attr_input_checkedValue(scopeId: number, nodeAccessor: Accessor, checkedValue: unknown, checkedValueChange: unknown, value: unknown, serializeType?: 1): string;
|
package/dist/html.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { attrTag, attrTags } from "./common/attr-tag";
|
|
2
2
|
export { _assert_hoist, _el_read_error, _hoist_read_error, } from "./common/errors";
|
|
3
3
|
export { _flush_head, withLoadAssets, withPageAssets } from "./html/assets";
|
|
4
|
-
export { _attr, _attr_and, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _style_html, } from "./html/attrs";
|
|
4
|
+
export { _attr, _attr_and, _attr_class, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _style_html, _textarea_value, } from "./html/attrs";
|
|
5
5
|
export { compat } from "./html/compat";
|
|
6
6
|
export { _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _to_text, _unescaped, } from "./html/content";
|
|
7
7
|
export { _content, _content_resume, _dynamic_tag } from "./html/dynamic-tag";
|
package/dist/html.js
CHANGED
|
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
|
-
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg =
|
|
7
|
+
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
8
8
|
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
9
9
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
10
10
|
let symbol = Symbol[name];
|
|
@@ -238,7 +238,13 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
238
238
|
[JSON, "JSON"],
|
|
239
239
|
[Math, "Math"],
|
|
240
240
|
[Reflect, "Reflect"]
|
|
241
|
-
]), unsafeRegExpSourceReg = /\\[\s\S]
|
|
241
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|[<\0\ud800-\udfff]/gu, unsafeRegExpSourceDetect = /[<\0\ud800-\udfff]/u, replaceUnsafeRegExpSourceChar = (match) => {
|
|
242
|
+
let ch = match.length === 3 ? "" : match[match.length - 1];
|
|
243
|
+
if (ch === "<") return "\\x3C";
|
|
244
|
+
if (ch === "\0") return "\\x00";
|
|
245
|
+
let code = ch.charCodeAt(0);
|
|
246
|
+
return code >= 55296 && code <= 57343 ? "\\u" + code.toString(16).padStart(4, "0") : match;
|
|
247
|
+
}, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
242
248
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
243
249
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
244
250
|
}, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
@@ -707,7 +713,7 @@ function writeDate(state, val) {
|
|
|
707
713
|
}
|
|
708
714
|
function writeRegExp(state, val) {
|
|
709
715
|
let { source } = val;
|
|
710
|
-
return state.buf.push("/" + (
|
|
716
|
+
return state.buf.push("/" + (unsafeRegExpSourceDetect.test(source) ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags), !0;
|
|
711
717
|
}
|
|
712
718
|
function writePromise(state, val, ref) {
|
|
713
719
|
let { boundary, channel } = state;
|
|
@@ -1694,10 +1700,13 @@ function _attr_option_value(value) {
|
|
|
1694
1700
|
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1695
1701
|
}
|
|
1696
1702
|
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1697
|
-
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value, content);
|
|
1703
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value ?? "", content);
|
|
1698
1704
|
}
|
|
1699
1705
|
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1700
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType),
|
|
1706
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _textarea_value(value);
|
|
1707
|
+
}
|
|
1708
|
+
function _textarea_value(value) {
|
|
1709
|
+
return _escape(normalizeStrAttrValue(value));
|
|
1701
1710
|
}
|
|
1702
1711
|
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1703
1712
|
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
@@ -2063,4 +2072,4 @@ exports.$global = $global, exports._assert_hoist = _assert_hoist, exports._attr
|
|
|
2063
2072
|
get: function() {
|
|
2064
2073
|
return _dynamic_tag;
|
|
2065
2074
|
}
|
|
2066
|
-
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forInBy = forInBy, exports.forOf = forOf, exports.forOfBy = forOfBy, exports.forStepBy = forStepBy, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|
|
2075
|
+
}), exports._el = _el, exports._el_read_error = _el_read_error, exports._el_resume = _el_resume, exports._escape = _escape, exports._escape_comment = _escape_comment, exports._escape_script = _escape_script, exports._escape_style = _escape_style, exports._escape_style_value = _escape_style_value, exports._existing_scope = _existing_scope, exports._flush_head = _flush_head, exports._for_in = _for_in, exports._for_of = _for_of, exports._for_to = _for_to, exports._for_until = _for_until, exports._hoist = _hoist, exports._hoist_read_error = _hoist_read_error, exports._html = _html, exports._id = _id, exports._if = _if, exports._peek_scope_id = _peek_scope_id, exports._resume = _resume, exports._resume_branch = _resume_branch, exports._scope = writeScope, exports._scope_id = _scope_id, exports._scope_reason = _scope_reason, exports._scope_with_id = _scope_with_id, exports._script = _script, exports._sep = _sep, exports._serialize_guard = _serialize_guard, exports._serialize_if = _serialize_if, exports._set_serialize_reason = _set_serialize_reason, exports._show_end = _show_end, exports._show_start = _show_start, exports._style_html = _style_html, exports._subscribe = _subscribe, exports._template = _template, exports._textarea_value = _textarea_value, exports._to_text = _to_text, exports._trailers = _trailers, exports._try = _try, exports._unescaped = _unescaped, exports._var = _var, exports.attrTag = attrTag, exports.attrTags = attrTags, exports.compat = compat, exports.forIn = forIn, exports.forInBy = forInBy, exports.forOf = forOf, exports.forOfBy = forOfBy, exports.forStepBy = forStepBy, exports.forTo = forTo, exports.forUntil = forUntil, exports.withLoadAssets = withLoadAssets, exports.withPageAssets = withPageAssets;
|
package/dist/html.mjs
CHANGED
|
@@ -4,7 +4,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
4
4
|
else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
|
|
5
5
|
else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
|
|
6
6
|
return str;
|
|
7
|
-
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg =
|
|
7
|
+
}, unsafeXMLReg = /[<&]/g, replaceUnsafeXML = (c) => c === "&" ? "&" : "<", escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str, unsafeScriptReg = /<(\/?script|!--)/gi, escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C$1") : str, unsafeStyleReg = /<(\/style)/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty } = {}, objectProto = Object.prototype, arrayProto = Array.prototype, Generator = (function* () {})().constructor, AsyncGenerator = (async function* () {})().constructor, REGISTRY = /* @__PURE__ */ new WeakMap(), KNOWN_SYMBOLS = (() => {
|
|
8
8
|
let KNOWN_SYMBOLS = /* @__PURE__ */ new Map();
|
|
9
9
|
for (let name of Object.getOwnPropertyNames(Symbol)) {
|
|
10
10
|
let symbol = Symbol[name];
|
|
@@ -238,7 +238,13 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
238
238
|
[JSON, "JSON"],
|
|
239
239
|
[Math, "Math"],
|
|
240
240
|
[Reflect, "Reflect"]
|
|
241
|
-
]), unsafeRegExpSourceReg = /\\[\s\S]
|
|
241
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|[<\0\ud800-\udfff]/gu, unsafeRegExpSourceDetect = /[<\0\ud800-\udfff]/u, replaceUnsafeRegExpSourceChar = (match) => {
|
|
242
|
+
let ch = match.length === 3 ? "" : match[match.length - 1];
|
|
243
|
+
if (ch === "<") return "\\x3C";
|
|
244
|
+
if (ch === "\0") return "\\x00";
|
|
245
|
+
let code = ch.charCodeAt(0);
|
|
246
|
+
return code >= 55296 && code <= 57343 ? "\\u" + code.toString(16).padStart(4, "0") : match;
|
|
247
|
+
}, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
242
248
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
243
249
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
244
250
|
}, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /"|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/g, voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
|
|
@@ -706,7 +712,7 @@ function writeDate(state, val) {
|
|
|
706
712
|
}
|
|
707
713
|
function writeRegExp(state, val) {
|
|
708
714
|
let { source } = val;
|
|
709
|
-
return state.buf.push("/" + (
|
|
715
|
+
return state.buf.push("/" + (unsafeRegExpSourceDetect.test(source) ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags), !0;
|
|
710
716
|
}
|
|
711
717
|
function writePromise(state, val, ref) {
|
|
712
718
|
let { boundary, channel } = state;
|
|
@@ -1693,10 +1699,13 @@ function _attr_option_value(value) {
|
|
|
1693
1699
|
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1694
1700
|
}
|
|
1695
1701
|
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1696
|
-
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value, content);
|
|
1702
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value ?? "", content);
|
|
1697
1703
|
}
|
|
1698
1704
|
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1699
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType),
|
|
1705
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _textarea_value(value);
|
|
1706
|
+
}
|
|
1707
|
+
function _textarea_value(value) {
|
|
1708
|
+
return _escape(normalizeStrAttrValue(value));
|
|
1700
1709
|
}
|
|
1701
1710
|
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1702
1711
|
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
@@ -2058,4 +2067,4 @@ function toObjectExpression(options) {
|
|
|
2058
2067
|
//#region src/html/compat.ts
|
|
2059
2068
|
function NOOP() {}
|
|
2060
2069
|
//#endregion
|
|
2061
|
-
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
|
|
2070
|
+
export { $global, _assert_hoist, _attr, _attr_and, _attr_class, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_input_checked, _attr_input_checkedValue, _attr_input_value, _attr_nonce, _attr_nullish, _attr_option_value, _attr_or, _attr_select_value, _attr_style, _attr_textarea_value, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _await, _content, _content_resume, _dynamic_tag, _el, _el_read_error, _el_resume, _escape, _escape_comment, _escape_script, _escape_style, _escape_style_value, _existing_scope, _flush_head, _for_in, _for_of, _for_to, _for_until, _hoist, _hoist_read_error, _html, _id, _if, _peek_scope_id, _resume, _resume_branch, writeScope as _scope, _scope_id, _scope_reason, _scope_with_id, _script, _sep, _serialize_guard, _serialize_if, _set_serialize_reason, _show_end, _show_start, _style_html, _subscribe, _template, _textarea_value, _to_text, _trailers, _try, _unescaped, _var, attrTag, attrTags, compat, forIn, forInBy, forOf, forOfBy, forStepBy, forTo, forUntil, withLoadAssets, withPageAssets };
|
package/dist/translator/index.js
CHANGED
|
@@ -127,6 +127,7 @@ let AccessorProp$1 = /* @__PURE__ */ function(AccessorProp) {
|
|
|
127
127
|
AccessorProp["Id"] = "#Id";
|
|
128
128
|
AccessorProp["Load"] = "#Load";
|
|
129
129
|
AccessorProp["LoopKey"] = "#LoopKey";
|
|
130
|
+
AccessorProp["LoopIndex"] = "#LoopIndex";
|
|
130
131
|
AccessorProp["ParentBranch"] = "#ParentBranch";
|
|
131
132
|
AccessorProp["PendingEffects"] = "#PendingEffects";
|
|
132
133
|
AccessorProp["PendingRenders"] = "#PendingRenders";
|
|
@@ -878,6 +879,7 @@ let AccessorProp = /* @__PURE__ */ function(AccessorProp) {
|
|
|
878
879
|
AccessorProp["Id"] = "L";
|
|
879
880
|
AccessorProp["Load"] = "X";
|
|
880
881
|
AccessorProp["LoopKey"] = "M";
|
|
882
|
+
AccessorProp["LoopIndex"] = "I";
|
|
881
883
|
AccessorProp["ParentBranch"] = "N";
|
|
882
884
|
AccessorProp["PendingEffects"] = "J";
|
|
883
885
|
AccessorProp["PendingRenders"] = "W";
|
|
@@ -1741,8 +1743,8 @@ const escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeS
|
|
|
1741
1743
|
function _escape_script(val) {
|
|
1742
1744
|
return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
|
|
1743
1745
|
}
|
|
1744
|
-
const unsafeStyleReg =
|
|
1745
|
-
const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C
|
|
1746
|
+
const unsafeStyleReg = /<(\/style)/gi;
|
|
1747
|
+
const escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C$1") : str;
|
|
1746
1748
|
function _escape_style(val) {
|
|
1747
1749
|
return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
|
|
1748
1750
|
}
|
|
@@ -1838,11 +1840,14 @@ function _attr_option_value(value) {
|
|
|
1838
1840
|
const kSelectedValue = Symbol("selectedValue");
|
|
1839
1841
|
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1840
1842
|
if (valueChange) writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
1841
|
-
if (content) withContext(kSelectedValue, value, content);
|
|
1843
|
+
if (content) withContext(kSelectedValue, value ?? "", content);
|
|
1842
1844
|
}
|
|
1843
1845
|
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1844
1846
|
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
1845
|
-
return
|
|
1847
|
+
return _textarea_value(value);
|
|
1848
|
+
}
|
|
1849
|
+
function _textarea_value(value) {
|
|
1850
|
+
return _escape(normalizeStrAttrValue(value));
|
|
1846
1851
|
}
|
|
1847
1852
|
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1848
1853
|
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
@@ -2385,7 +2390,6 @@ const [getSteps] = createSectionState("steps", (section) => {
|
|
|
2385
2390
|
});
|
|
2386
2391
|
const walkCodeToName = {
|
|
2387
2392
|
[32]: "get",
|
|
2388
|
-
[36]: "inside",
|
|
2389
2393
|
[37]: "replace",
|
|
2390
2394
|
[38]: "endChild",
|
|
2391
2395
|
[47]: "beginChild",
|
|
@@ -2563,12 +2567,12 @@ function getSectionMetaIdentifiers(section) {
|
|
|
2563
2567
|
}
|
|
2564
2568
|
return meta;
|
|
2565
2569
|
}
|
|
2566
|
-
function markNode(path, nodeBinding, reason) {
|
|
2570
|
+
function markNode(path, nodeBinding, reason, deferred) {
|
|
2567
2571
|
if (nodeBinding.type !== 0) throw path.buildCodeFrameError("POTENTIAL MARKO BUG: Tried to mark a node that was not determined to need a mark during analyze.");
|
|
2568
2572
|
if (isOutputHTML()) {
|
|
2569
2573
|
if (reason) {
|
|
2570
2574
|
const section = getSection(path);
|
|
2571
|
-
writeTo(path)`${callRuntime("_el_resume", getScopeIdIdentifier(section), getScopeAccessorLiteral(nodeBinding), getSerializeGuard(section, reason, true))}`;
|
|
2575
|
+
writeTo(path, deferred)`${callRuntime("_el_resume", getScopeIdIdentifier(section), getScopeAccessorLiteral(nodeBinding), getSerializeGuard(section, reason, true))}`;
|
|
2572
2576
|
}
|
|
2573
2577
|
}
|
|
2574
2578
|
}
|
|
@@ -2810,16 +2814,9 @@ function simplifyFunction(fn) {
|
|
|
2810
2814
|
//#endregion
|
|
2811
2815
|
//#region src/translator/util/to-first-expression-or-block.ts
|
|
2812
2816
|
function toFirstExpressionOrBlock(stmts) {
|
|
2813
|
-
if (stmts.length === 1 && _marko_compiler.types.isExpressionStatement(stmts[0])) return
|
|
2817
|
+
if (stmts.length === 1 && _marko_compiler.types.isExpressionStatement(stmts[0])) return stmts[0].expression;
|
|
2814
2818
|
return _marko_compiler.types.blockStatement(stmts);
|
|
2815
2819
|
}
|
|
2816
|
-
function toParenthesizedExpressionIfNeeded(expr) {
|
|
2817
|
-
switch (expr.type) {
|
|
2818
|
-
case "ObjectExpression":
|
|
2819
|
-
case "AssignmentExpression": return _marko_compiler.types.parenthesizedExpression(expr);
|
|
2820
|
-
default: return expr;
|
|
2821
|
-
}
|
|
2822
|
-
}
|
|
2823
2820
|
//#endregion
|
|
2824
2821
|
//#region src/translator/util/signals.ts
|
|
2825
2822
|
const [getSignals] = createSectionState("signals", () => /* @__PURE__ */ new Map());
|
|
@@ -2925,7 +2922,7 @@ function getSignal(section, referencedBindings, name) {
|
|
|
2925
2922
|
const render = getSignalFn(signal);
|
|
2926
2923
|
const closureSignalBuilder = getClosureSignalBuilder(section);
|
|
2927
2924
|
if (closureSignalBuilder && !isDynamicClosure(section, closure)) return closureSignalBuilder(closure, render);
|
|
2928
|
-
return callRuntime("_closure_get", isOptimize() ? _marko_compiler.types.numericLiteral(getClosureAccessorId(closure)) : getScopeAccessorLiteral(closure, true), render, isImmediateOwner(section, closure) ? void 0 : _marko_compiler.types.arrowFunctionExpression([scopeIdentifier], getScopeExpression(section, closure.section)),
|
|
2925
|
+
return callRuntime("_closure_get", isOptimize() ? _marko_compiler.types.numericLiteral(getClosureAccessorId(closure)) : getScopeAccessorLiteral(closure, true), render, isImmediateOwner(section, closure) ? void 0 : _marko_compiler.types.arrowFunctionExpression([scopeIdentifier], getScopeExpression(section, closure.section)), underTryPlaceholder(section) ? _marko_compiler.types.stringLiteral(getResumeRegisterId(section, closure, "pending")) : void 0);
|
|
2929
2926
|
};
|
|
2930
2927
|
}
|
|
2931
2928
|
return signal;
|
|
@@ -3123,7 +3120,7 @@ function replaceNullishAndEmptyFunctionsWith0(args) {
|
|
|
3123
3120
|
args[i] = _marko_compiler.types.numericLiteral(0);
|
|
3124
3121
|
continue;
|
|
3125
3122
|
}
|
|
3126
|
-
if (body.length === 1 && _marko_compiler.types.isExpressionStatement(body[0])) arg.body =
|
|
3123
|
+
if (body.length === 1 && _marko_compiler.types.isExpressionStatement(body[0])) arg.body = body[0].expression;
|
|
3127
3124
|
}
|
|
3128
3125
|
if (finalLen === void 0) finalLen = i + 1;
|
|
3129
3126
|
}
|
|
@@ -3695,7 +3692,7 @@ function getRegisteredFnExpression(node) {
|
|
|
3695
3692
|
//#region src/translator/util/body-to-text-literal.ts
|
|
3696
3693
|
const kRawText = Symbol("raw text placeholder");
|
|
3697
3694
|
function bodyToTextLiteral(body) {
|
|
3698
|
-
return buildTextLiteral(body, toText,
|
|
3695
|
+
return buildTextLiteral(body, toText, true);
|
|
3699
3696
|
}
|
|
3700
3697
|
function bodyToRawTextLiteral(body) {
|
|
3701
3698
|
return buildTextLiteral(body, (value) => value, true);
|
|
@@ -3719,15 +3716,17 @@ function buildTextLiteral(body, coerce, bareSingle) {
|
|
|
3719
3716
|
const templateExpressions = [];
|
|
3720
3717
|
let currentQuasi = "";
|
|
3721
3718
|
let placeholderExtra;
|
|
3719
|
+
let singleValue;
|
|
3722
3720
|
for (const child of body.body) if (_marko_compiler.types.isMarkoText(child)) currentQuasi += child.value;
|
|
3723
3721
|
else if (_marko_compiler.types.isMarkoPlaceholder(child)) {
|
|
3724
3722
|
placeholderExtra ||= child.value.extra;
|
|
3725
3723
|
templateQuasis.push(templateElement(currentQuasi, false));
|
|
3726
3724
|
templateExpressions.push(coerce(child.value));
|
|
3725
|
+
singleValue = child.value;
|
|
3727
3726
|
currentQuasi = "";
|
|
3728
3727
|
}
|
|
3729
3728
|
if (templateExpressions.length) {
|
|
3730
|
-
if (bareSingle && templateExpressions.length === 1 && !currentQuasi && !templateQuasis[0].value.cooked) return
|
|
3729
|
+
if (bareSingle && templateExpressions.length === 1 && !currentQuasi && !templateQuasis[0].value.cooked && !_marko_compiler.types.isStringLiteral(singleValue)) return singleValue;
|
|
3731
3730
|
templateQuasis.push(templateElement(currentQuasi, true));
|
|
3732
3731
|
const literal = _marko_compiler.types.templateLiteral(templateQuasis, templateExpressions);
|
|
3733
3732
|
literal.extra = placeholderExtra;
|
|
@@ -4350,6 +4349,10 @@ var native_tag_default = {
|
|
|
4350
4349
|
let exprExtras;
|
|
4351
4350
|
for (let i = attributes.length; i--;) {
|
|
4352
4351
|
const attr = attributes[i];
|
|
4352
|
+
if (_marko_compiler.types.isMarkoAttribute(attr) && attr.name === "content" && tag.node.body.body.length) {
|
|
4353
|
+
dropNodes(attr.value);
|
|
4354
|
+
continue;
|
|
4355
|
+
}
|
|
4353
4356
|
const valueExtra = attr.value.extra ??= {};
|
|
4354
4357
|
if (_marko_compiler.types.isMarkoAttribute(attr)) {
|
|
4355
4358
|
if (seen[attr.name]) {
|
|
@@ -4489,7 +4492,7 @@ var native_tag_default = {
|
|
|
4489
4492
|
spreadExpression = spreadIdentifier;
|
|
4490
4493
|
}
|
|
4491
4494
|
if (valueChange) writeAtStartOfBody = callRuntime("_attr_textarea_value", getScopeIdIdentifier(tagSection), visitAccessor, value, valueChange, staticControllable ? void 0 : _marko_compiler.types.numericLiteral(1));
|
|
4492
|
-
else if (value) writeAtStartOfBody = callRuntime("
|
|
4495
|
+
else if (value) writeAtStartOfBody = callRuntime("_textarea_value", value);
|
|
4493
4496
|
}
|
|
4494
4497
|
for (const attr of staticAttrs) {
|
|
4495
4498
|
const { name, value } = attr;
|
|
@@ -4549,7 +4552,7 @@ var native_tag_default = {
|
|
|
4549
4552
|
const tagName = getCanonicalTagName(tag);
|
|
4550
4553
|
const tagSection = getSection(tag);
|
|
4551
4554
|
const markerSerializeReason = !tagExtra[kSkipEndTag] && nodeBinding && getSerializeReason(tagSection, nodeBinding);
|
|
4552
|
-
const write = writeTo(tag,
|
|
4555
|
+
const write = writeTo(tag, tagName === "html" || !markerSerializeReason && tagName === "body");
|
|
4553
4556
|
if (tagExtra[kTagContentAttr]) flushBefore(tag);
|
|
4554
4557
|
if (selectArgs) {
|
|
4555
4558
|
if (!tagExtra[kSkipEndTag]) write`</${tagName}>`;
|
|
@@ -4563,7 +4566,7 @@ var native_tag_default = {
|
|
|
4563
4566
|
if (tagName === "head" && getMarkoOpts().linkAssets) write`${callRuntime("_flush_head")}`;
|
|
4564
4567
|
write`</${tagName}>`;
|
|
4565
4568
|
}
|
|
4566
|
-
if (markerSerializeReason) markNode(tag, nodeBinding, markerSerializeReason);
|
|
4569
|
+
if (markerSerializeReason) markNode(tag, nodeBinding, markerSerializeReason, tagName === "html");
|
|
4567
4570
|
tag.remove();
|
|
4568
4571
|
}
|
|
4569
4572
|
},
|
|
@@ -5257,7 +5260,7 @@ function flattenTextOnlyConditional(rootTag) {
|
|
|
5257
5260
|
if (node.body.attributeTags || !body.length) return;
|
|
5258
5261
|
const [attr] = node.attributes;
|
|
5259
5262
|
if (isCoreTagName(tag, "else")) {
|
|
5260
|
-
if (node.attributes.length) return;
|
|
5263
|
+
if (node.attributes.length > 1 || attr && (!_marko_compiler.types.isMarkoAttribute(attr) || attr.name !== "if")) return;
|
|
5261
5264
|
} else if (node.attributes.length !== 1 || !_marko_compiler.types.isMarkoAttribute(attr) || !attr.default) return;
|
|
5262
5265
|
for (const child of body) if (_marko_compiler.types.isMarkoText(child)) {
|
|
5263
5266
|
if (_escape(child.value) !== child.value) return;
|
|
@@ -5274,7 +5277,8 @@ function flattenTextOnlyConditional(rootTag) {
|
|
|
5274
5277
|
const branchTag = branches[i];
|
|
5275
5278
|
const text = bodyToRawTextLiteral(branchTag.node.body);
|
|
5276
5279
|
rawText ||= _marko_compiler.types.isTemplateLiteral(text);
|
|
5277
|
-
|
|
5280
|
+
const [conditionAttr] = branchTag.node.attributes;
|
|
5281
|
+
expr = conditionAttr ? _marko_compiler.types.conditionalExpression(conditionAttr.value, text, expr) : text;
|
|
5278
5282
|
}
|
|
5279
5283
|
for (let i = branches.length; i-- > 1;) branches[i].remove();
|
|
5280
5284
|
const placeholder = _marko_compiler.types.markoPlaceholder(expr, true);
|
|
@@ -5499,7 +5503,7 @@ function getChangeHandler(tag, attr) {
|
|
|
5499
5503
|
if (!existingChangedAttr) {
|
|
5500
5504
|
const bindingIdentifierPath = binding.path.getOuterBindingIdentifierPaths()[binding.identifier.name];
|
|
5501
5505
|
let changeAttrExpr = bindingIdentifierPath ? bindingIdentifierPath.parentPath === binding.path ? buildChangeHandlerFunction(attr.value, modifier) : bindingIdentifierPath.parentPath.isObjectProperty() ? getChangeHandlerFromObjectPattern(bindingIdentifierPath.parentPath) : void 0 : void 0;
|
|
5502
|
-
if (!changeAttrExpr) throw tag.hub.buildError(attr.value, "Unable to bind to value.");
|
|
5506
|
+
if (!changeAttrExpr) throw tag.hub.buildError(attr.value, bindingIdentifierPath?.parentPath?.isArrayPattern() ? `Cannot two-way bind to \`${attr.value.name}\` because it comes from array destructuring, which has no change handler. Use object destructuring or pass an explicit \`${changeAttrName}\` attribute.` : "Unable to bind to value.");
|
|
5503
5507
|
if (modifier && _marko_compiler.types.isIdentifier(changeAttrExpr)) changeAttrExpr = _marko_compiler.types.logicalExpression("&&", changeAttrExpr, buildModifierForwarder(_marko_compiler.types.cloneNode(changeAttrExpr), modifier));
|
|
5504
5508
|
const changeHandlerAttr = _marko_compiler.types.markoAttribute(changeAttrName, changeAttrExpr);
|
|
5505
5509
|
BINDING_CHANGE_HANDLER.set(binding.identifier, changeHandlerAttr);
|
|
@@ -9492,6 +9496,14 @@ function optionalValueToNode(value) {
|
|
|
9492
9496
|
const kDOMBinding = Symbol("dynamic tag dom binding");
|
|
9493
9497
|
const kChildOffsetScopeBinding = Symbol("custom tag scope offset");
|
|
9494
9498
|
const importedDynamicTagResume = /* @__PURE__ */ new WeakSet();
|
|
9499
|
+
const [getCompatRegistrations] = createProgramState(() => /* @__PURE__ */ new Set());
|
|
9500
|
+
function pushCompatRegistration(key, statement) {
|
|
9501
|
+
const keys = getCompatRegistrations();
|
|
9502
|
+
if (!keys.has(key)) {
|
|
9503
|
+
keys.add(key);
|
|
9504
|
+
(0, _marko_compiler_babel_utils.getProgram)().node.body.push(statement);
|
|
9505
|
+
}
|
|
9506
|
+
}
|
|
9495
9507
|
var dynamic_tag_default = {
|
|
9496
9508
|
analyze: { enter(tag) {
|
|
9497
9509
|
(0, _marko_compiler_babel_utils.assertAttributesOrArgs)(tag);
|
|
@@ -9572,32 +9584,33 @@ var dynamic_tag_default = {
|
|
|
9572
9584
|
if (_marko_compiler.types.isStringLiteral(tagExpression)) tagExpression = (0, _marko_compiler_babel_utils.importDefault)(tag.hub.file, getTagRelativePath(tag), tagExpression.value);
|
|
9573
9585
|
if (classTagTemplate) {
|
|
9574
9586
|
const preserveBoundary = !tagsSerializeReason && (classHydration === "descendant" || classHydration === "self" && !!classFile?.metadata.marko.hasComponentBrowser);
|
|
9575
|
-
if (isOutputHTML() ? serializeReason || classHydration : serializeReason) (
|
|
9587
|
+
if (isOutputHTML() ? serializeReason || classHydration : serializeReason) pushCompatRegistration(classFile.metadata.marko.id, isOutputHTML() ? _marko_compiler.types.markoScriptlet([_marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression((0, _marko_compiler_babel_utils.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"), [
|
|
9576
9588
|
_marko_compiler.types.stringLiteral(classFile.metadata.marko.id),
|
|
9577
9589
|
_marko_compiler.types.identifier(tagExpression.name),
|
|
9578
9590
|
...preserveBoundary ? [_marko_compiler.types.stringLiteral("preserve")] : []
|
|
9579
9591
|
]))], true) : _marko_compiler.types.expressionStatement(callRuntime("_resume", _marko_compiler.types.stringLiteral(classFile.metadata.marko.id), _marko_compiler.types.identifier(tagExpression.name))));
|
|
9580
|
-
} else
|
|
9592
|
+
} else {
|
|
9593
|
+
const rendererName = tagExpression.name;
|
|
9594
|
+
pushCompatRegistration(rendererName, _marko_compiler.types.markoScriptlet([_marko_compiler.types.expressionStatement(_marko_compiler.types.assignmentExpression("??=", _marko_compiler.types.memberExpression(_marko_compiler.types.identifier(rendererName), _marko_compiler.types.identifier("_")), _marko_compiler.types.identifier(rendererName)))], true));
|
|
9595
|
+
}
|
|
9581
9596
|
} else if (_marko_compiler.types.isStringLiteral(tagExpression)) tagExpression = (0, _marko_compiler_babel_utils.importDefault)(tag.hub.file, getTagRelativePath(tag), tagExpression.value);
|
|
9582
9597
|
const { properties, statements } = translateAttrs(tag, void 0, void 0, void 0, isClassAPI ? "renderBody" : "content");
|
|
9583
9598
|
const args = [];
|
|
9599
|
+
const contentProp = getTranslatedBodyContentProperty(properties);
|
|
9584
9600
|
let hasTagArgs = false;
|
|
9585
9601
|
if (node.arguments) {
|
|
9586
9602
|
hasTagArgs = true;
|
|
9587
9603
|
args.push(...node.arguments);
|
|
9588
9604
|
if (properties.length) args.push(propsToExpression(properties));
|
|
9589
|
-
} else {
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
args.push(propsToExpression(properties), contentProp.value);
|
|
9594
|
-
} else args.push(propsToExpression(properties));
|
|
9595
|
-
}
|
|
9605
|
+
} else if (contentProp) {
|
|
9606
|
+
properties.splice(properties.indexOf(contentProp), 1);
|
|
9607
|
+
args.push(propsToExpression(properties), contentProp.value);
|
|
9608
|
+
} else args.push(propsToExpression(properties));
|
|
9596
9609
|
if (isOutputHTML()) {
|
|
9597
9610
|
flushInto(tag);
|
|
9598
9611
|
writeHTMLResumeStatements(tag.get("body"));
|
|
9599
9612
|
const serializeArg = getSerializeGuard(tagSection, serializeReason, true);
|
|
9600
|
-
const dynamicTagExpr = hasTagArgs ? callRuntime("_dynamic_tag", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(nodeBinding), tagExpression, _marko_compiler.types.arrayExpression(args), _marko_compiler.types.numericLiteral(0), _marko_compiler.types.numericLiteral(1), serializeArg) : callRuntime("_dynamic_tag", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(nodeBinding), tagExpression, args[0], args[1] || (serializeArg ? _marko_compiler.types.numericLiteral(0) : void 0), serializeArg ? _marko_compiler.types.numericLiteral(0) : void 0, serializeArg);
|
|
9613
|
+
const dynamicTagExpr = hasTagArgs ? callRuntime("_dynamic_tag", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(nodeBinding), tagExpression, _marko_compiler.types.arrayExpression(args), contentProp ? contentProp.value : _marko_compiler.types.numericLiteral(0), _marko_compiler.types.numericLiteral(1), serializeArg) : callRuntime("_dynamic_tag", getScopeIdIdentifier(tagSection), getScopeAccessorLiteral(nodeBinding), tagExpression, args[0], args[1] || (serializeArg ? _marko_compiler.types.numericLiteral(0) : void 0), serializeArg ? _marko_compiler.types.numericLiteral(0) : void 0, serializeArg);
|
|
9601
9614
|
if (node.var) {
|
|
9602
9615
|
const dynamicScopeIdentifier = generateUidIdentifier(tag.get("name").toString() + "_scope");
|
|
9603
9616
|
const mutatesTagVar = !!(tag.node.var.type === "Identifier" && tag.scope.getBinding(tag.node.var.name)?.constantViolations.length);
|
|
@@ -5,6 +5,6 @@ declare module "@marko/compiler/dist/types" {
|
|
|
5
5
|
[kRawText]?: true;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export declare function bodyToTextLiteral(body: t.MarkoTagBody): t.
|
|
9
|
-
export declare function bodyToRawTextLiteral(body: t.MarkoTagBody): t.
|
|
8
|
+
export declare function bodyToTextLiteral(body: t.MarkoTagBody): t.ArrayExpression | t.ArrowFunctionExpression | t.AssignmentExpression | t.AwaitExpression | t.BigIntLiteral | t.BinaryExpression | t.BindExpression | t.BooleanLiteral | t.CallExpression | t.ClassExpression | t.ConditionalExpression | t.DecimalLiteral | t.DoExpression | t.FunctionExpression | t.Identifier | t.Import | t.ImportExpression | t.JSXElement | t.JSXFragment | t.LogicalExpression | t.MemberExpression | t.MetaProperty | t.ModuleExpression | t.NewExpression | t.NullLiteral | t.NumericLiteral | t.ObjectExpression | t.OptionalCallExpression | t.OptionalMemberExpression | t.ParenthesizedExpression | t.PipelineBareFunction | t.PipelinePrimaryTopicReference | t.PipelineTopicExpression | t.RecordExpression | t.RegExpLiteral | t.SequenceExpression | t.StringLiteral | t.Super | t.TSAsExpression | t.TSInstantiationExpression | t.TSNonNullExpression | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TaggedTemplateExpression | t.TemplateLiteral | t.ThisExpression | t.TopicReference | t.TupleExpression | t.TypeCastExpression | t.UnaryExpression | t.UpdateExpression | t.YieldExpression | t.MarkoParseError;
|
|
9
|
+
export declare function bodyToRawTextLiteral(body: t.MarkoTagBody): t.ArrayExpression | t.ArrowFunctionExpression | t.AssignmentExpression | t.AwaitExpression | t.BigIntLiteral | t.BinaryExpression | t.BindExpression | t.BooleanLiteral | t.CallExpression | t.ClassExpression | t.ConditionalExpression | t.DecimalLiteral | t.DoExpression | t.FunctionExpression | t.Identifier | t.Import | t.ImportExpression | t.JSXElement | t.JSXFragment | t.LogicalExpression | t.MemberExpression | t.MetaProperty | t.ModuleExpression | t.NewExpression | t.NullLiteral | t.NumericLiteral | t.ObjectExpression | t.OptionalCallExpression | t.OptionalMemberExpression | t.ParenthesizedExpression | t.PipelineBareFunction | t.PipelinePrimaryTopicReference | t.PipelineTopicExpression | t.RecordExpression | t.RegExpLiteral | t.SequenceExpression | t.StringLiteral | t.Super | t.TSAsExpression | t.TSInstantiationExpression | t.TSNonNullExpression | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TaggedTemplateExpression | t.TemplateLiteral | t.ThisExpression | t.TopicReference | t.TupleExpression | t.TypeCastExpression | t.UnaryExpression | t.UpdateExpression | t.YieldExpression | t.MarkoParseError;
|
|
10
10
|
export declare function injectTextCoercion(expr: t.Expression): void;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { types as t } from "@marko/compiler";
|
|
2
|
-
export declare function toFirstExpressionOrBlock(stmts: t.Statement[]): t.
|
|
3
|
-
export declare function toParenthesizedExpressionIfNeeded(expr: t.Expression): t.ArrayExpression | t.ArrowFunctionExpression | t.AwaitExpression | t.BigIntLiteral | t.BinaryExpression | t.BindExpression | t.BooleanLiteral | t.CallExpression | t.ClassExpression | t.ConditionalExpression | t.DecimalLiteral | t.DoExpression | t.FunctionExpression | t.Identifier | t.Import | t.ImportExpression | t.JSXElement | t.JSXFragment | t.LogicalExpression | t.MemberExpression | t.MetaProperty | t.ModuleExpression | t.NewExpression | t.NullLiteral | t.NumericLiteral | t.OptionalCallExpression | t.OptionalMemberExpression | t.ParenthesizedExpression | t.PipelineBareFunction | t.PipelinePrimaryTopicReference | t.PipelineTopicExpression | t.RecordExpression | t.RegExpLiteral | t.SequenceExpression | t.StringLiteral | t.Super | t.TSAsExpression | t.TSInstantiationExpression | t.TSNonNullExpression | t.TSSatisfiesExpression | t.TSTypeAssertion | t.TaggedTemplateExpression | t.TemplateLiteral | t.ThisExpression | t.TopicReference | t.TupleExpression | t.TypeCastExpression | t.UnaryExpression | t.UpdateExpression | t.YieldExpression | t.MarkoParseError;
|
|
2
|
+
export declare function toFirstExpressionOrBlock(stmts: t.Statement[]): t.BlockStatement | t.Expression;
|
|
@@ -6,7 +6,7 @@ export declare enum Step {
|
|
|
6
6
|
Enter = 0,
|
|
7
7
|
Exit = 1
|
|
8
8
|
}
|
|
9
|
-
type VisitCodes = WalkCode.Get | WalkCode.
|
|
9
|
+
type VisitCodes = WalkCode.Get | WalkCode.Replace | WalkCode.DynamicTagWithVar;
|
|
10
10
|
export declare function enter(path: t.NodePath<any>): void;
|
|
11
11
|
export declare function exit(path: t.NodePath<any>): void;
|
|
12
12
|
export declare function enterShallow(path: t.NodePath<any>): void;
|
|
@@ -14,5 +14,5 @@ interface SectionMeta {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const getSectionMeta: (section: Section) => SectionMeta;
|
|
16
16
|
export declare function getSectionMetaIdentifiers(section: Section): SectionMeta;
|
|
17
|
-
export declare function markNode(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, nodeBinding: Binding, reason: undefined | false | SerializeReason): void;
|
|
17
|
+
export declare function markNode(path: t.NodePath<t.MarkoTag | t.MarkoPlaceholder>, nodeBinding: Binding, reason: undefined | false | SerializeReason, deferred?: boolean): void;
|
|
18
18
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.17",
|
|
4
4
|
"description": "Optimized runtime for Marko templates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -47,15 +47,16 @@
|
|
|
47
47
|
"!**/*.tsbuildinfo",
|
|
48
48
|
"cheatsheet.md"
|
|
49
49
|
],
|
|
50
|
-
"scripts": {
|
|
51
|
-
"build": "node -r ~ts ./scripts/bundle.mts"
|
|
52
|
-
},
|
|
53
50
|
"dependencies": {
|
|
54
|
-
"@marko/compiler": "^5.41.
|
|
51
|
+
"@marko/compiler": "^5.41.4",
|
|
55
52
|
"csstype": "^3.2.3",
|
|
56
53
|
"fastest-levenshtein": "^1.0.16",
|
|
57
54
|
"magic-string": "^0.30.21"
|
|
58
55
|
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@marko/runtime-tags": "npm:marko@6.3.17",
|
|
58
|
+
"marko": "5.39.26"
|
|
59
|
+
},
|
|
59
60
|
"engines": {
|
|
60
61
|
"node": ">=22"
|
|
61
62
|
},
|
|
@@ -69,5 +70,8 @@
|
|
|
69
70
|
"./debug/*": "./src/*.ts",
|
|
70
71
|
"./*": "./src/*.ts"
|
|
71
72
|
},
|
|
72
|
-
"private": false
|
|
73
|
-
|
|
73
|
+
"private": false,
|
|
74
|
+
"scripts": {
|
|
75
|
+
"build": "node -r ~ts ./scripts/bundle.mts"
|
|
76
|
+
}
|
|
77
|
+
}
|