@marko/runtime-tags 6.3.8 → 6.3.9
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 +1 -1
- package/dist/debug/dom.mjs +1 -1
- package/dist/debug/html.js +5 -6
- package/dist/debug/html.mjs +5 -6
- package/dist/dom.js +1 -4
- package/dist/dom.mjs +1 -4
- package/dist/html.js +6 -9
- package/dist/html.mjs +6 -9
- package/dist/translator/index.js +23 -46
- package/dist/translator/util/optional.d.ts +0 -1
- package/dist/translator/visitors/program/html.d.ts +0 -1
- package/package.json +1 -1
package/dist/debug/dom.js
CHANGED
|
@@ -1272,7 +1272,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1272
1272
|
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1273
1273
|
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1274
1274
|
skip = /^value(?:Change)?$/;
|
|
1275
|
-
}
|
|
1275
|
+
}
|
|
1276
1276
|
break;
|
|
1277
1277
|
case "SELECT":
|
|
1278
1278
|
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
package/dist/debug/dom.mjs
CHANGED
|
@@ -1270,7 +1270,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
1270
1270
|
} else if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
|
1271
1271
|
_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange);
|
|
1272
1272
|
skip = /^value(?:Change)?$/;
|
|
1273
|
-
}
|
|
1273
|
+
}
|
|
1274
1274
|
break;
|
|
1275
1275
|
case "SELECT":
|
|
1276
1276
|
if ("value" in nextAttrs || "valueChange" in nextAttrs) {
|
package/dist/debug/html.js
CHANGED
|
@@ -251,7 +251,7 @@ function _escape_comment(val) {
|
|
|
251
251
|
//#region src/html/serializer.ts
|
|
252
252
|
const K_SCOPE_ID = Symbol("Scope ID");
|
|
253
253
|
const kTouchedIterator = Symbol.for("marko.touchedIterator");
|
|
254
|
-
const { hasOwnProperty
|
|
254
|
+
const { hasOwnProperty } = {};
|
|
255
255
|
const objectProto = Object.prototype;
|
|
256
256
|
const arrayProto = Array.prototype;
|
|
257
257
|
const Generator = (function* () {})().constructor;
|
|
@@ -1241,7 +1241,7 @@ function writeNullObject(state, val, ref) {
|
|
|
1241
1241
|
}
|
|
1242
1242
|
function writeObjectProps(state, val, ref) {
|
|
1243
1243
|
let sep = "";
|
|
1244
|
-
for (const key in val) if (hasOwnProperty
|
|
1244
|
+
for (const key in val) if (hasOwnProperty.call(val, key)) {
|
|
1245
1245
|
const escapedKey = toObjectKey(key);
|
|
1246
1246
|
state.buf.push(sep + escapedKey + ":");
|
|
1247
1247
|
if (writeProp(state, val[key], ref, escapedKey)) sep = ",";
|
|
@@ -1841,7 +1841,7 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1841
1841
|
}
|
|
1842
1842
|
const { state } = $chunk.boundary;
|
|
1843
1843
|
const resumeKeys = serializeMarker !== 0;
|
|
1844
|
-
const resumeMarker =
|
|
1844
|
+
const resumeMarker = resumeKeys && (!parentEndTag || serializeStateful !== 0);
|
|
1845
1845
|
let flushBranchIds = "";
|
|
1846
1846
|
let loopScopes;
|
|
1847
1847
|
iterate((itemKey, sameAsIndex, render) => {
|
|
@@ -2626,7 +2626,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2626
2626
|
} else if (data.valueChange) {
|
|
2627
2627
|
result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1);
|
|
2628
2628
|
skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
2629
|
-
}
|
|
2629
|
+
}
|
|
2630
2630
|
break;
|
|
2631
2631
|
case "select":
|
|
2632
2632
|
case "textarea":
|
|
@@ -3037,7 +3037,6 @@ function NOOP$1() {}
|
|
|
3037
3037
|
const kAssets = Symbol();
|
|
3038
3038
|
const kBlockIndex = Symbol();
|
|
3039
3039
|
const kDeferIndex = Symbol();
|
|
3040
|
-
const { hasOwnProperty } = {};
|
|
3041
3040
|
let assetFlush;
|
|
3042
3041
|
function withLoadAssets(renderer, assetId, triggers) {
|
|
3043
3042
|
return Object.assign((input) => {
|
|
@@ -3115,7 +3114,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
3115
3114
|
function toObjectExpression(options) {
|
|
3116
3115
|
let result = "{";
|
|
3117
3116
|
let sep = "";
|
|
3118
|
-
for (const key in options) if (
|
|
3117
|
+
for (const key in options) if (Object.hasOwn(options, key)) {
|
|
3119
3118
|
result += sep + toObjectKey(key) + ":" + JSON.stringify(options[key]);
|
|
3120
3119
|
sep = ",";
|
|
3121
3120
|
}
|
package/dist/debug/html.mjs
CHANGED
|
@@ -249,7 +249,7 @@ function _escape_comment(val) {
|
|
|
249
249
|
//#region src/html/serializer.ts
|
|
250
250
|
const K_SCOPE_ID = Symbol("Scope ID");
|
|
251
251
|
const kTouchedIterator = Symbol.for("marko.touchedIterator");
|
|
252
|
-
const { hasOwnProperty
|
|
252
|
+
const { hasOwnProperty } = {};
|
|
253
253
|
const objectProto = Object.prototype;
|
|
254
254
|
const arrayProto = Array.prototype;
|
|
255
255
|
const Generator = (function* () {})().constructor;
|
|
@@ -1239,7 +1239,7 @@ function writeNullObject(state, val, ref) {
|
|
|
1239
1239
|
}
|
|
1240
1240
|
function writeObjectProps(state, val, ref) {
|
|
1241
1241
|
let sep = "";
|
|
1242
|
-
for (const key in val) if (hasOwnProperty
|
|
1242
|
+
for (const key in val) if (hasOwnProperty.call(val, key)) {
|
|
1243
1243
|
const escapedKey = toObjectKey(key);
|
|
1244
1244
|
state.buf.push(sep + escapedKey + ":");
|
|
1245
1245
|
if (writeProp(state, val[key], ref, escapedKey)) sep = ",";
|
|
@@ -1839,7 +1839,7 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1839
1839
|
}
|
|
1840
1840
|
const { state } = $chunk.boundary;
|
|
1841
1841
|
const resumeKeys = serializeMarker !== 0;
|
|
1842
|
-
const resumeMarker =
|
|
1842
|
+
const resumeMarker = resumeKeys && (!parentEndTag || serializeStateful !== 0);
|
|
1843
1843
|
let flushBranchIds = "";
|
|
1844
1844
|
let loopScopes;
|
|
1845
1845
|
iterate((itemKey, sameAsIndex, render) => {
|
|
@@ -2624,7 +2624,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2624
2624
|
} else if (data.valueChange) {
|
|
2625
2625
|
result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1);
|
|
2626
2626
|
skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
2627
|
-
}
|
|
2627
|
+
}
|
|
2628
2628
|
break;
|
|
2629
2629
|
case "select":
|
|
2630
2630
|
case "textarea":
|
|
@@ -3035,7 +3035,6 @@ function NOOP$1() {}
|
|
|
3035
3035
|
const kAssets = Symbol();
|
|
3036
3036
|
const kBlockIndex = Symbol();
|
|
3037
3037
|
const kDeferIndex = Symbol();
|
|
3038
|
-
const { hasOwnProperty } = {};
|
|
3039
3038
|
let assetFlush;
|
|
3040
3039
|
function withLoadAssets(renderer, assetId, triggers) {
|
|
3041
3040
|
return Object.assign((input) => {
|
|
@@ -3113,7 +3112,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
3113
3112
|
function toObjectExpression(options) {
|
|
3114
3113
|
let result = "{";
|
|
3115
3114
|
let sep = "";
|
|
3116
|
-
for (const key in options) if (
|
|
3115
|
+
for (const key in options) if (Object.hasOwn(options, key)) {
|
|
3117
3116
|
result += sep + toObjectKey(key) + ":" + JSON.stringify(options[key]);
|
|
3118
3117
|
sep = ",";
|
|
3119
3118
|
}
|
package/dist/dom.js
CHANGED
|
@@ -830,10 +830,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
830
830
|
for (let name in events) events[name] = 0;
|
|
831
831
|
switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
|
|
832
832
|
case "INPUT":
|
|
833
|
-
|
|
834
|
-
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
835
|
-
else if ("value" in nextAttrs || "valueChange" in nextAttrs) _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/;
|
|
836
|
-
else break;
|
|
833
|
+
"checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), skip = /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/) : ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
837
834
|
break;
|
|
838
835
|
case "SELECT":
|
|
839
836
|
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
package/dist/dom.mjs
CHANGED
|
@@ -829,10 +829,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
|
|
|
829
829
|
for (let name in events) events[name] = 0;
|
|
830
830
|
switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
|
|
831
831
|
case "INPUT":
|
|
832
|
-
|
|
833
|
-
else if ("checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs) _attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/;
|
|
834
|
-
else if ("value" in nextAttrs || "valueChange" in nextAttrs) _attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/;
|
|
835
|
-
else break;
|
|
832
|
+
"checked" in nextAttrs || "checkedChange" in nextAttrs ? (_attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange), skip = /^checked(?:Value)?(?:Change)?$/) : "checkedValue" in nextAttrs || "checkedValueChange" in nextAttrs ? (_attr_input_checkedValue(scope, nodeAccessor, nextAttrs.checkedValue, nextAttrs.checkedValueChange, nextAttrs.value), skip = /^(?:value|checked(?:Value)?)(?:Change)?$/) : ("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_input_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
|
836
833
|
break;
|
|
837
834
|
case "SELECT":
|
|
838
835
|
("value" in nextAttrs || "valueChange" in nextAttrs) && (_attr_select_value(scope, nodeAccessor, nextAttrs.value, nextAttrs.valueChange), skip = /^value(?:Change)?$/);
|
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 = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty
|
|
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/style") : 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];
|
|
@@ -277,7 +277,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
277
277
|
let patched = patch(tag, scopeId, accessor);
|
|
278
278
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
279
279
|
};
|
|
280
|
-
})(_dynamic_tag), _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kBlockIndex = Symbol(), kDeferIndex = Symbol(),
|
|
280
|
+
})(_dynamic_tag), _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kBlockIndex = Symbol(), kDeferIndex = Symbol(), assetFlush, SET_SCOPE_REGISTER_ID = "$C_s", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
281
281
|
$global,
|
|
282
282
|
fork: _await,
|
|
283
283
|
write: _html,
|
|
@@ -862,7 +862,7 @@ function writeNullObject(state, val, ref) {
|
|
|
862
862
|
}
|
|
863
863
|
function writeObjectProps(state, val, ref) {
|
|
864
864
|
let sep = "";
|
|
865
|
-
for (let key in val) if (hasOwnProperty
|
|
865
|
+
for (let key in val) if (hasOwnProperty.call(val, key)) {
|
|
866
866
|
let escapedKey = toObjectKey(key);
|
|
867
867
|
state.buf.push(sep + escapedKey + ":"), writeProp(state, val[key], ref, escapedKey) ? sep = "," : state.buf.pop();
|
|
868
868
|
}
|
|
@@ -1246,7 +1246,7 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1246
1246
|
iterate(0), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, "");
|
|
1247
1247
|
return;
|
|
1248
1248
|
}
|
|
1249
|
-
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker =
|
|
1249
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = resumeKeys && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "", loopScopes;
|
|
1250
1250
|
iterate((itemKey, sameAsIndex, render) => {
|
|
1251
1251
|
let branchId = _peek_scope_id();
|
|
1252
1252
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
@@ -1724,10 +1724,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1724
1724
|
let result = "", skip = /[\s/>"'=]/, events;
|
|
1725
1725
|
switch (tagName) {
|
|
1726
1726
|
case "input":
|
|
1727
|
-
|
|
1728
|
-
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1729
|
-
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
1730
|
-
else break;
|
|
1727
|
+
data.checkedChange ? (result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/) : "checkedValue" in data || data.checkedValueChange ? (result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/) : data.valueChange && (result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1731
1728
|
break;
|
|
1732
1729
|
case "select":
|
|
1733
1730
|
case "textarea":
|
|
@@ -2032,7 +2029,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
2032
2029
|
}
|
|
2033
2030
|
function toObjectExpression(options) {
|
|
2034
2031
|
let result = "{", sep = "";
|
|
2035
|
-
for (let key in options)
|
|
2032
|
+
for (let key in options) Object.hasOwn(options, key) && (result += sep + toObjectKey(key) + ":" + JSON.stringify(options[key]), sep = ",");
|
|
2036
2033
|
return result + "}";
|
|
2037
2034
|
}
|
|
2038
2035
|
//#endregion
|
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 = /<\/style/gi, escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str, unsafeCommentReg = />/g, escapeCommentStr = (str) => unsafeCommentReg.test(str) ? str.replace(unsafeCommentReg, ">") : str, K_SCOPE_ID = Symbol("Scope ID"), kTouchedIterator = Symbol.for("marko.touchedIterator"), { hasOwnProperty
|
|
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/style") : 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];
|
|
@@ -277,7 +277,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
277
277
|
let patched = patch(tag, scopeId, accessor);
|
|
278
278
|
return patched !== tag && (patched.a = tag), originalDynamicTag(scopeId, accessor, patched, input, content, inputIsArgs, resume);
|
|
279
279
|
};
|
|
280
|
-
})(_dynamic_tag), _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kBlockIndex = Symbol(), kDeferIndex = Symbol(),
|
|
280
|
+
})(_dynamic_tag), _template = (templateId, renderer, page) => (renderer.render = render, renderer.i = !page, renderer._ = renderer, _content_resume(templateId, renderer)), kAssets = Symbol(), kBlockIndex = Symbol(), kDeferIndex = Symbol(), assetFlush, SET_SCOPE_REGISTER_ID = "$C_s", K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
|
|
281
281
|
$global,
|
|
282
282
|
fork: _await,
|
|
283
283
|
write: _html,
|
|
@@ -861,7 +861,7 @@ function writeNullObject(state, val, ref) {
|
|
|
861
861
|
}
|
|
862
862
|
function writeObjectProps(state, val, ref) {
|
|
863
863
|
let sep = "";
|
|
864
|
-
for (let key in val) if (hasOwnProperty
|
|
864
|
+
for (let key in val) if (hasOwnProperty.call(val, key)) {
|
|
865
865
|
let escapedKey = toObjectKey(key);
|
|
866
866
|
state.buf.push(sep + escapedKey + ":"), writeProp(state, val[key], ref, escapedKey) ? sep = "," : state.buf.pop();
|
|
867
867
|
}
|
|
@@ -1245,7 +1245,7 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
|
|
|
1245
1245
|
iterate(0), writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, "");
|
|
1246
1246
|
return;
|
|
1247
1247
|
}
|
|
1248
|
-
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker =
|
|
1248
|
+
let { state } = $chunk.boundary, resumeKeys = serializeMarker !== 0, resumeMarker = resumeKeys && (!parentEndTag || serializeStateful !== 0), flushBranchIds = "", loopScopes;
|
|
1249
1249
|
iterate((itemKey, sameAsIndex, render) => {
|
|
1250
1250
|
let branchId = _peek_scope_id();
|
|
1251
1251
|
resumeMarker && (singleNode ? flushBranchIds = " " + branchId + flushBranchIds : ($chunk.writeHTML(state.mark("[", flushBranchIds)), flushBranchIds = branchId + "")), withBranchId(branchId, () => {
|
|
@@ -1723,10 +1723,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1723
1723
|
let result = "", skip = /[\s/>"'=]/, events;
|
|
1724
1724
|
switch (tagName) {
|
|
1725
1725
|
case "input":
|
|
1726
|
-
|
|
1727
|
-
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1728
|
-
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
1729
|
-
else break;
|
|
1726
|
+
data.checkedChange ? (result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/) : "checkedValue" in data || data.checkedValueChange ? (result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1), skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/) : data.valueChange && (result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/);
|
|
1730
1727
|
break;
|
|
1731
1728
|
case "select":
|
|
1732
1729
|
case "textarea":
|
|
@@ -2031,7 +2028,7 @@ function writeTriggerScript(html, triggers) {
|
|
|
2031
2028
|
}
|
|
2032
2029
|
function toObjectExpression(options) {
|
|
2033
2030
|
let result = "{", sep = "";
|
|
2034
|
-
for (let key in options)
|
|
2031
|
+
for (let key in options) Object.hasOwn(options, key) && (result += sep + toObjectKey(key) + ":" + JSON.stringify(options[key]), sep = ",");
|
|
2035
2032
|
return result + "}";
|
|
2036
2033
|
}
|
|
2037
2034
|
//#endregion
|
package/dist/translator/index.js
CHANGED
|
@@ -300,7 +300,7 @@ const decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)
|
|
|
300
300
|
//#region src/html/serializer.ts
|
|
301
301
|
const K_SCOPE_ID = Symbol("Scope ID");
|
|
302
302
|
const kTouchedIterator = Symbol.for("marko.touchedIterator");
|
|
303
|
-
const { hasOwnProperty
|
|
303
|
+
const { hasOwnProperty } = {};
|
|
304
304
|
Array.prototype;
|
|
305
305
|
const Generator = (function* () {})().constructor;
|
|
306
306
|
const AsyncGenerator = (async function* () {})().constructor;
|
|
@@ -1408,15 +1408,15 @@ function finalizeParamSerializeReasonGroups(section) {
|
|
|
1408
1408
|
}
|
|
1409
1409
|
function ensureParamReasonGroup(section, reason) {
|
|
1410
1410
|
const { paramReasonGroups } = section;
|
|
1411
|
+
if (paramReasonGroups) {
|
|
1412
|
+
const found = findSorted(compareParamGroups, paramReasonGroups, { reason });
|
|
1413
|
+
if (found) return found;
|
|
1414
|
+
}
|
|
1411
1415
|
const group = {
|
|
1412
1416
|
id: Symbol(getDebugNames(reason)),
|
|
1413
1417
|
reason
|
|
1414
1418
|
};
|
|
1415
|
-
|
|
1416
|
-
const found = findSorted(compareParamGroups, paramReasonGroups, group);
|
|
1417
|
-
if (found) return found;
|
|
1418
|
-
section.paramReasonGroups = addSorted(compareParamGroups, paramReasonGroups, group);
|
|
1419
|
-
} else section.paramReasonGroups = [group];
|
|
1419
|
+
section.paramReasonGroups = paramReasonGroups ? addSorted(compareParamGroups, paramReasonGroups, group) : [group];
|
|
1420
1420
|
}
|
|
1421
1421
|
function getParamReasonGroupIndex(section, reason) {
|
|
1422
1422
|
const index = section.paramReasonGroups && findIndexSorted(compareParamGroups, section.paramReasonGroups, { reason });
|
|
@@ -1883,7 +1883,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1883
1883
|
} else if (data.valueChange) {
|
|
1884
1884
|
result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1);
|
|
1885
1885
|
skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
1886
|
-
}
|
|
1886
|
+
}
|
|
1887
1887
|
break;
|
|
1888
1888
|
case "select":
|
|
1889
1889
|
case "textarea":
|
|
@@ -2037,9 +2037,6 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2037
2037
|
};
|
|
2038
2038
|
})(_dynamic_tag);
|
|
2039
2039
|
//#endregion
|
|
2040
|
-
//#region src/html/assets.ts
|
|
2041
|
-
const { hasOwnProperty } = {};
|
|
2042
|
-
//#endregion
|
|
2043
2040
|
//#region src/translator/util/runtime.ts
|
|
2044
2041
|
const pureDOMFunctions = /* @__PURE__ */ new Set([
|
|
2045
2042
|
"_await_promise",
|
|
@@ -2807,14 +2804,7 @@ function simplifyFunction(fn) {
|
|
|
2807
2804
|
//#endregion
|
|
2808
2805
|
//#region src/translator/util/to-first-expression-or-block.ts
|
|
2809
2806
|
function toFirstExpressionOrBlock(stmts) {
|
|
2810
|
-
if (stmts.length === 1 && _marko_compiler.types.isExpressionStatement(stmts[0]))
|
|
2811
|
-
const { expression } = stmts[0];
|
|
2812
|
-
switch (expression.type) {
|
|
2813
|
-
case "ObjectExpression":
|
|
2814
|
-
case "AssignmentExpression": return toParenthesizedExpressionIfNeeded(expression);
|
|
2815
|
-
default: return expression;
|
|
2816
|
-
}
|
|
2817
|
-
}
|
|
2807
|
+
if (stmts.length === 1 && _marko_compiler.types.isExpressionStatement(stmts[0])) return toParenthesizedExpressionIfNeeded(stmts[0].expression);
|
|
2818
2808
|
return _marko_compiler.types.blockStatement(stmts);
|
|
2819
2809
|
}
|
|
2820
2810
|
function toParenthesizedExpressionIfNeeded(expr) {
|
|
@@ -3819,7 +3809,6 @@ var for_default = {
|
|
|
3819
3809
|
addSerializeExpr(tagSection, tagExtra, kStatefulReason$2);
|
|
3820
3810
|
if (paramsBinding) {
|
|
3821
3811
|
setBindingDownstream(paramsBinding, tagExtra);
|
|
3822
|
-
const byAttr = getKnownAttrValues(tag.node).by;
|
|
3823
3812
|
const keyBinding = getLoopKeyBinding(byAttr, paramsBinding, forType);
|
|
3824
3813
|
if (keyBinding) {
|
|
3825
3814
|
if (!byAttr) {
|
|
@@ -4188,11 +4177,9 @@ function translateAttrs(tag, propTree = true, skip, statements = [], contentKey
|
|
|
4188
4177
|
if (attrTagMeta.dynamic) i = addDynamicAttrTagStatements(attrTags, i, attrTagLookup, statements, propTree, contentKey);
|
|
4189
4178
|
else {
|
|
4190
4179
|
const translatedAttrTag = translateAttrs(child, getKnownFromPropTree(propTree, attrTagMeta.name), void 0, statements, contentKey);
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
else contentProperties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag", propsToExpression(translatedAttrTag.properties))));
|
|
4195
|
-
} else contentProperties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag", propsToExpression(translatedAttrTag.properties))));
|
|
4180
|
+
const prevProp = attrTagMeta.repeated ? findObjectProperty(attrTagMeta.name, contentProperties) : void 0;
|
|
4181
|
+
if (prevProp) prevProp.value = callRuntime("attrTags", prevProp.value, propsToExpression(translatedAttrTag.properties));
|
|
4182
|
+
else contentProperties.push(toObjectProperty(attrTagMeta.name, callRuntime("attrTag", propsToExpression(translatedAttrTag.properties))));
|
|
4196
4183
|
}
|
|
4197
4184
|
} else i = addDynamicAttrTagStatements(attrTags, i, attrTagLookup, statements, propTree, contentKey);
|
|
4198
4185
|
}
|
|
@@ -4396,7 +4383,7 @@ var native_tag_default = {
|
|
|
4396
4383
|
if (node.var || hasDynamicAttributes || hasEventHandlers || textPlaceholders || injectNonce || isDynamicControllable(relatedControllable)) {
|
|
4397
4384
|
const tagExtra = node.extra ??= {};
|
|
4398
4385
|
const tagSection = getOrCreateSection(tag);
|
|
4399
|
-
const nodeBinding = tagExtra[kNativeTagBinding] = createBinding("#" +
|
|
4386
|
+
const nodeBinding = tagExtra[kNativeTagBinding] = createBinding("#" + tagName, 0, tagSection, void 0, void 0, void 0, void 0, !!node.var);
|
|
4400
4387
|
if (hasEventHandlers) (0, _marko_compiler_babel_utils.getProgram)().node.extra.isInteractive = true;
|
|
4401
4388
|
if (spreadReferenceNodes) {
|
|
4402
4389
|
const isMergedSpread = !!relatedControllable;
|
|
@@ -4420,7 +4407,7 @@ var native_tag_default = {
|
|
|
4420
4407
|
}
|
|
4421
4408
|
}
|
|
4422
4409
|
}
|
|
4423
|
-
}
|
|
4410
|
+
}
|
|
4424
4411
|
if (relatedControllable) mergeReferences(tagSection, relatedControllable.attrs.find(Boolean).value, relatedControllable.attrs.map((it) => it?.value));
|
|
4425
4412
|
if (textPlaceholders) {
|
|
4426
4413
|
exprExtras = push(exprExtras, textPlaceholders.length === 1 ? textPlaceholders[0].extra ??= {} : mergeReferences(tagSection, textPlaceholders[0], textPlaceholders.slice(1)));
|
|
@@ -6845,7 +6832,7 @@ function finalizeReferences() {
|
|
|
6845
6832
|
forEachSection((section) => {
|
|
6846
6833
|
const { id, bindings } = section;
|
|
6847
6834
|
const isOwnedBinding = ({ section }) => section.id === id;
|
|
6848
|
-
|
|
6835
|
+
const intersections = (intersectionsBySection.get(section) || []).filter((intersection) => {
|
|
6849
6836
|
const collapseSource = getCollapsibleIntersectionSource(intersection, section);
|
|
6850
6837
|
if (collapseSource) collapsedIntersectionSource.set(intersection, collapseSource);
|
|
6851
6838
|
return !collapseSource;
|
|
@@ -6856,7 +6843,7 @@ function finalizeReferences() {
|
|
|
6856
6843
|
anchors.set(intersection, intersection[i]);
|
|
6857
6844
|
break;
|
|
6858
6845
|
}
|
|
6859
|
-
intersections
|
|
6846
|
+
intersections.sort((a, b) => {
|
|
6860
6847
|
const aAnchor = anchors.get(a);
|
|
6861
6848
|
const bAnchor = anchors.get(b);
|
|
6862
6849
|
return aAnchor ? bAnchor ? bindingUtil.compare(aAnchor, bAnchor) : -1 : bAnchor ? 1 : 0;
|
|
@@ -6896,10 +6883,10 @@ function finalizeReferences() {
|
|
|
6896
6883
|
}
|
|
6897
6884
|
function getMaxOwnSourceOffset(intersection, section) {
|
|
6898
6885
|
let scopeOffset;
|
|
6886
|
+
const trackScopeOffset = (source) => {
|
|
6887
|
+
if (source.scopeOffset && (!scopeOffset || scopeOffset.id < source.scopeOffset.id)) scopeOffset = source.scopeOffset;
|
|
6888
|
+
};
|
|
6899
6889
|
for (const binding of intersection) if (binding.section === section && binding.sources) {
|
|
6900
|
-
const trackScopeOffset = (source) => {
|
|
6901
|
-
if (source.scopeOffset && (!scopeOffset || scopeOffset.id < source.scopeOffset.id)) scopeOffset = source.scopeOffset;
|
|
6902
|
-
};
|
|
6903
6890
|
forEach(binding.sources.state, trackScopeOffset);
|
|
6904
6891
|
forEach(binding.sources.param, trackScopeOffset);
|
|
6905
6892
|
}
|
|
@@ -8201,7 +8188,6 @@ var script_default = {
|
|
|
8201
8188
|
const { value } = valueAttr;
|
|
8202
8189
|
const referencedBindings = value.extra?.referencedBindings;
|
|
8203
8190
|
if (isOutputDOM()) {
|
|
8204
|
-
const { value } = valueAttr;
|
|
8205
8191
|
const isFunction = _marko_compiler.types.isFunctionExpression(value) || _marko_compiler.types.isArrowFunctionExpression(value);
|
|
8206
8192
|
let inlineBody = null;
|
|
8207
8193
|
let referencesScope = false;
|
|
@@ -8308,7 +8294,7 @@ var show_default = {
|
|
|
8308
8294
|
return;
|
|
8309
8295
|
}
|
|
8310
8296
|
const display = tag.node.attributes[0].value;
|
|
8311
|
-
if (!_marko_compiler.types.isIdentifier(display)
|
|
8297
|
+
if (!_marko_compiler.types.isIdentifier(display)) {
|
|
8312
8298
|
const displayRef = generateUidIdentifier("show");
|
|
8313
8299
|
tag.insertBefore(_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(displayRef, display)]));
|
|
8314
8300
|
tagExtra[kDisplayRef] = displayRef;
|
|
@@ -8393,15 +8379,6 @@ function isSingleNodeBody(tag) {
|
|
|
8393
8379
|
}
|
|
8394
8380
|
return elements === 1;
|
|
8395
8381
|
}
|
|
8396
|
-
function isLiteral(expr) {
|
|
8397
|
-
switch (expr.type) {
|
|
8398
|
-
case "BooleanLiteral":
|
|
8399
|
-
case "NumericLiteral":
|
|
8400
|
-
case "StringLiteral":
|
|
8401
|
-
case "NullLiteral": return true;
|
|
8402
|
-
default: return false;
|
|
8403
|
-
}
|
|
8404
|
-
}
|
|
8405
8382
|
function assertValidShow(tag) {
|
|
8406
8383
|
(0, _marko_compiler_babel_utils.assertNoVar)(tag);
|
|
8407
8384
|
(0, _marko_compiler_babel_utils.assertNoArgs)(tag, "Write the condition as a value attribute instead: `<show=condition>`.");
|
|
@@ -8744,11 +8721,11 @@ var try_default = {
|
|
|
8744
8721
|
translate: translateByTarget({
|
|
8745
8722
|
html: {
|
|
8746
8723
|
enter(tag) {
|
|
8747
|
-
|
|
8724
|
+
const bodySection = getSectionForBody(tag.get("body"));
|
|
8725
|
+
if (!bodySection) {
|
|
8748
8726
|
tag.remove();
|
|
8749
8727
|
return;
|
|
8750
8728
|
}
|
|
8751
|
-
const bodySection = getSectionForBody(tag.get("body"));
|
|
8752
8729
|
if (tag.node.extra?.attributeTags?.["@placeholder"]) setTryHasPlaceholder(bodySection, true);
|
|
8753
8730
|
setSectionParentIsOwner(bodySection, true);
|
|
8754
8731
|
flushBefore(tag);
|
|
@@ -9525,10 +9502,10 @@ var dynamic_tag_default = {
|
|
|
9525
9502
|
if (classTagTemplate) {
|
|
9526
9503
|
const preserveBoundary = !tagsSerializeReason && (classHydration === "descendant" || classHydration === "self" && !!classFile?.metadata.marko.hasComponentBrowser);
|
|
9527
9504
|
if (isOutputHTML() ? serializeReason || classHydration : serializeReason) (0, _marko_compiler_babel_utils.getProgram)().node.body.push(isOutputHTML() ? _marko_compiler.types.markoScriptlet([_marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression((0, _marko_compiler_babel_utils.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"), [
|
|
9528
|
-
_marko_compiler.types.stringLiteral(
|
|
9505
|
+
_marko_compiler.types.stringLiteral(classFile.metadata.marko.id),
|
|
9529
9506
|
_marko_compiler.types.identifier(tagExpression.name),
|
|
9530
9507
|
...preserveBoundary ? [_marko_compiler.types.stringLiteral("preserve")] : []
|
|
9531
|
-
]))], true) : _marko_compiler.types.expressionStatement(callRuntime("_resume", _marko_compiler.types.stringLiteral(
|
|
9508
|
+
]))], true) : _marko_compiler.types.expressionStatement(callRuntime("_resume", _marko_compiler.types.stringLiteral(classFile.metadata.marko.id), _marko_compiler.types.identifier(tagExpression.name))));
|
|
9532
9509
|
} else (0, _marko_compiler_babel_utils.getProgram)().node.body.push(_marko_compiler.types.markoScriptlet([_marko_compiler.types.expressionStatement(_marko_compiler.types.assignmentExpression("??=", _marko_compiler.types.memberExpression(_marko_compiler.types.identifier(tagExpression.name), _marko_compiler.types.identifier("_")), _marko_compiler.types.identifier(tagExpression.name)))], true));
|
|
9533
9510
|
} else if (_marko_compiler.types.isStringLiteral(tagExpression)) tagExpression = (0, _marko_compiler_babel_utils.importDefault)(tag.hub.file, getTagRelativePath(tag), tagExpression.value);
|
|
9534
9511
|
const { properties, statements } = translateAttrs(tag, void 0, void 0, void 0, isClassAPI ? "renderBody" : "content");
|
|
@@ -25,7 +25,6 @@ export declare function find<T>(data: Opt<T>, cb: (item: T, index: number) => bo
|
|
|
25
25
|
export declare function some<T>(data: Opt<T>, cb: (item: T, index: number) => boolean): boolean;
|
|
26
26
|
export declare function toArray<T, R>(data: Opt<T>, cb: (item: T, index: number) => R): R[];
|
|
27
27
|
export declare function mapToString<T>(data: Opt<T>, sep: string, cb: (item: T, index: number) => string): string;
|
|
28
|
-
export declare function filterMap<T, R>(data: Opt<T>, cb: (item: T) => undefined | R): Opt<R>;
|
|
29
28
|
export declare function findSorted<T>(compare: Compare<T>, data: T[], item: T): T | undefined;
|
|
30
29
|
export declare function findIndexSorted<T>(compare: Compare<T>, data: T[], item: T): number;
|
|
31
30
|
export declare function addSorted<T, U extends T[]>(compare: Compare<T>, data: U, item: T): U;
|