marko 6.1.18 → 6.1.21
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 +48 -43
- package/dist/debug/dom.mjs +48 -43
- package/dist/debug/html.js +37 -25
- package/dist/debug/html.mjs +37 -25
- package/dist/dom/event.d.ts +1 -1
- package/dist/dom.js +32 -33
- package/dist/dom.mjs +32 -33
- package/dist/html/attrs.d.ts +6 -6
- package/dist/html.js +29 -26
- package/dist/html.mjs +29 -26
- package/dist/translator/index.js +47 -38
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
- package/package.json +1 -1
package/dist/html.js
CHANGED
|
@@ -238,7 +238,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
238
238
|
[JSON, "JSON"],
|
|
239
239
|
[Math, "Math"],
|
|
240
240
|
[Reflect, "Reflect"]
|
|
241
|
-
]), $chunk, NOOP$2 = () => {}, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
241
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|</g, replaceUnsafeRegExpSourceChar = (match) => match === "<" || match === "\\<" ? "\\x3C" : match, $chunk, NOOP$2 = () => {}, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
242
242
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
243
243
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
244
244
|
}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/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) => {
|
|
@@ -247,10 +247,10 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
247
247
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
248
248
|
if (rendered = !0, _scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
249
249
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
250
|
-
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange));
|
|
250
|
+
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
251
251
|
else if (renderContent) {
|
|
252
252
|
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
253
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
253
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
254
254
|
}
|
|
255
255
|
_html(`</${renderer}>`);
|
|
256
256
|
}
|
|
@@ -691,7 +691,8 @@ function writeDate(state, val) {
|
|
|
691
691
|
return state.buf.push("new Date(" + +val + ")"), !0;
|
|
692
692
|
}
|
|
693
693
|
function writeRegExp(state, val) {
|
|
694
|
-
|
|
694
|
+
let { source } = val;
|
|
695
|
+
return state.buf.push("/" + (source.includes("<") ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags), !0;
|
|
695
696
|
}
|
|
696
697
|
function writePromise(state, val, ref) {
|
|
697
698
|
let { boundary, channel } = state;
|
|
@@ -760,7 +761,7 @@ function writeWeakMap(state) {
|
|
|
760
761
|
}
|
|
761
762
|
function writeError(state, val, ref) {
|
|
762
763
|
let result = "new " + val.constructor.name + "(" + quote(val.message + "", 0);
|
|
763
|
-
return val.cause ? (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})"))
|
|
764
|
+
return val.cause === void 0 ? state.buf.push(result + ")") : (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})")), !0;
|
|
764
765
|
}
|
|
765
766
|
function writeAggregateError(state, val, ref) {
|
|
766
767
|
return state.buf.push("new AggregateError("), writeProp(state, val.errors, ref, "errors"), val.message ? state.buf.push("," + quote(val.message + "", 0) + ")") : state.buf.push(")"), !0;
|
|
@@ -1611,24 +1612,24 @@ function _attr_style(value) {
|
|
|
1611
1612
|
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1612
1613
|
}
|
|
1613
1614
|
function _attr_option_value(value) {
|
|
1614
|
-
let valueAttr = _attr("value", value);
|
|
1615
|
-
return normalizedValueMatches(
|
|
1615
|
+
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
1616
|
+
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1616
1617
|
}
|
|
1617
|
-
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
|
1618
|
-
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange), content && withContext(kSelectedValue, value, content);
|
|
1618
|
+
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1619
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value, content);
|
|
1619
1620
|
}
|
|
1620
|
-
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1621
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _escape(value);
|
|
1621
|
+
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1622
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _escape(value);
|
|
1622
1623
|
}
|
|
1623
|
-
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1624
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _attr("value", value);
|
|
1624
|
+
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1625
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1625
1626
|
}
|
|
1626
|
-
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1627
|
-
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange), isNotVoid(checked) ? " checked" : "";
|
|
1627
|
+
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1628
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotVoid(checked) ? " checked" : "";
|
|
1628
1629
|
}
|
|
1629
|
-
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1630
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1630
1631
|
let valueAttr = _attr("value", value);
|
|
1631
|
-
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1632
|
+
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1632
1633
|
}
|
|
1633
1634
|
function getCheckedValueRef(checkedValue) {
|
|
1634
1635
|
if (Array.isArray(checkedValue)) {
|
|
@@ -1636,9 +1637,9 @@ function getCheckedValueRef(checkedValue) {
|
|
|
1636
1637
|
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1637
1638
|
}
|
|
1638
1639
|
}
|
|
1639
|
-
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1640
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1640
1641
|
let normalizedOpen = isNotVoid(open);
|
|
1641
|
-
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange), normalizedOpen ? " open" : "";
|
|
1642
|
+
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1642
1643
|
}
|
|
1643
1644
|
function _attr_nonce() {
|
|
1644
1645
|
return getChunk().boundary.state.nonceAttr;
|
|
@@ -1650,11 +1651,10 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1650
1651
|
let result = "", skip = /[\s/>"'=]/, events;
|
|
1651
1652
|
switch (tagName) {
|
|
1652
1653
|
case "input":
|
|
1653
|
-
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange)
|
|
1654
|
-
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value)
|
|
1655
|
-
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange)
|
|
1654
|
+
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/;
|
|
1655
|
+
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/>"'=]/;
|
|
1656
|
+
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
1656
1657
|
else break;
|
|
1657
|
-
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1658
1658
|
break;
|
|
1659
1659
|
case "select":
|
|
1660
1660
|
case "textarea":
|
|
@@ -1665,7 +1665,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1665
1665
|
break;
|
|
1666
1666
|
case "details":
|
|
1667
1667
|
case "dialog":
|
|
1668
|
-
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1668
|
+
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1669
1669
|
break;
|
|
1670
1670
|
}
|
|
1671
1671
|
for (let name in data) {
|
|
@@ -1698,11 +1698,14 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1698
1698
|
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1699
1699
|
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
1700
1700
|
}
|
|
1701
|
-
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1702
|
-
writeScope(scopeId, {
|
|
1701
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1702
|
+
writeScope(scopeId, serializeType ? {
|
|
1703
1703
|
["F" + nodeAccessor]: type,
|
|
1704
1704
|
["G" + nodeAccessor]: value,
|
|
1705
1705
|
["E" + nodeAccessor]: valueChange
|
|
1706
|
+
} : {
|
|
1707
|
+
["G" + nodeAccessor]: value,
|
|
1708
|
+
["E" + nodeAccessor]: valueChange
|
|
1706
1709
|
});
|
|
1707
1710
|
}
|
|
1708
1711
|
function stringAttr(name, value) {
|
package/dist/html.mjs
CHANGED
|
@@ -238,7 +238,7 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
238
238
|
[JSON, "JSON"],
|
|
239
239
|
[Math, "Math"],
|
|
240
240
|
[Reflect, "Reflect"]
|
|
241
|
-
]), $chunk, NOOP$2 = () => {}, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
241
|
+
]), unsafeRegExpSourceReg = /\\[\s\S]|</g, replaceUnsafeRegExpSourceChar = (match) => match === "<" || match === "\\<" ? "\\x3C" : match, $chunk, NOOP$2 = () => {}, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
|
|
242
242
|
let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
|
|
243
243
|
return state.needsMainRuntime = !0, Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
|
|
244
244
|
}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /'|&(?=#?\w+;)/g, doubleQuoteAttrReplacements = /"|&(?=#?\w+;)/g, needsQuotedAttr = /["'>\s]|&#?\w+;|\/$/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) => {
|
|
@@ -247,10 +247,10 @@ let empty = [], rest = Symbol(), toDelimitedString = function toDelimitedString(
|
|
|
247
247
|
let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
|
|
248
248
|
if (rendered = !0, _scope_id(), _html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`), !voidElementsReg.test(renderer)) {
|
|
249
249
|
let renderContent = content || normalizeDynamicRenderer(input.content);
|
|
250
|
-
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange));
|
|
250
|
+
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
251
251
|
else if (renderContent) {
|
|
252
252
|
if (typeof renderContent != "function") throw Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
253
|
-
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
253
|
+
renderer === "select" && ("value" in input || "valueChange" in input) ? _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1) : _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
254
254
|
}
|
|
255
255
|
_html(`</${renderer}>`);
|
|
256
256
|
}
|
|
@@ -690,7 +690,8 @@ function writeDate(state, val) {
|
|
|
690
690
|
return state.buf.push("new Date(" + +val + ")"), !0;
|
|
691
691
|
}
|
|
692
692
|
function writeRegExp(state, val) {
|
|
693
|
-
|
|
693
|
+
let { source } = val;
|
|
694
|
+
return state.buf.push("/" + (source.includes("<") ? source.replace(unsafeRegExpSourceReg, replaceUnsafeRegExpSourceChar) : source) + "/" + val.flags), !0;
|
|
694
695
|
}
|
|
695
696
|
function writePromise(state, val, ref) {
|
|
696
697
|
let { boundary, channel } = state;
|
|
@@ -759,7 +760,7 @@ function writeWeakMap(state) {
|
|
|
759
760
|
}
|
|
760
761
|
function writeError(state, val, ref) {
|
|
761
762
|
let result = "new " + val.constructor.name + "(" + quote(val.message + "", 0);
|
|
762
|
-
return val.cause ? (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})"))
|
|
763
|
+
return val.cause === void 0 ? state.buf.push(result + ")") : (state.buf.push(result + ",{cause:"), writeProp(state, val.cause, ref, "cause"), state.buf.push("})")), !0;
|
|
763
764
|
}
|
|
764
765
|
function writeAggregateError(state, val, ref) {
|
|
765
766
|
return state.buf.push("new AggregateError("), writeProp(state, val.errors, ref, "errors"), val.message ? state.buf.push("," + quote(val.message + "", 0) + ")") : state.buf.push(")"), !0;
|
|
@@ -1610,24 +1611,24 @@ function _attr_style(value) {
|
|
|
1610
1611
|
return stringAttr("style", toDelimitedString(value, ";", stringifyStyleObject));
|
|
1611
1612
|
}
|
|
1612
1613
|
function _attr_option_value(value) {
|
|
1613
|
-
let valueAttr = _attr("value", value);
|
|
1614
|
-
return normalizedValueMatches(
|
|
1614
|
+
let valueAttr = _attr("value", value), selectedValue = getContext(kSelectedValue);
|
|
1615
|
+
return selectedValue !== void 0 && normalizedValueMatches(selectedValue, value) ? valueAttr + " selected" : valueAttr;
|
|
1615
1616
|
}
|
|
1616
|
-
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
|
1617
|
-
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange), content && withContext(kSelectedValue, value, content);
|
|
1617
|
+
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
1618
|
+
valueChange && writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType), content && withContext(kSelectedValue, value, content);
|
|
1618
1619
|
}
|
|
1619
|
-
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1620
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _escape(value);
|
|
1620
|
+
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1621
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _escape(value);
|
|
1621
1622
|
}
|
|
1622
|
-
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
1623
|
-
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange), _attr("value", value);
|
|
1623
|
+
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1624
|
+
return valueChange && writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType), _attr("value", value);
|
|
1624
1625
|
}
|
|
1625
|
-
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
1626
|
-
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange), isNotVoid(checked) ? " checked" : "";
|
|
1626
|
+
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
1627
|
+
return checkedChange && writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType), isNotVoid(checked) ? " checked" : "";
|
|
1627
1628
|
}
|
|
1628
|
-
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
1629
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
1629
1630
|
let valueAttr = _attr("value", value);
|
|
1630
|
-
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1631
|
+
return checkedValueChange && writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType), normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
1631
1632
|
}
|
|
1632
1633
|
function getCheckedValueRef(checkedValue) {
|
|
1633
1634
|
if (Array.isArray(checkedValue)) {
|
|
@@ -1635,9 +1636,9 @@ function getCheckedValueRef(checkedValue) {
|
|
|
1635
1636
|
return ref || (ref = [], checkedValuesRefs.set(checkedValue, ref)), ref;
|
|
1636
1637
|
}
|
|
1637
1638
|
}
|
|
1638
|
-
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
1639
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
1639
1640
|
let normalizedOpen = isNotVoid(open);
|
|
1640
|
-
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange), normalizedOpen ? " open" : "";
|
|
1641
|
+
return openChange && writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType), normalizedOpen ? " open" : "";
|
|
1641
1642
|
}
|
|
1642
1643
|
function _attr_nonce() {
|
|
1643
1644
|
return getChunk().boundary.state.nonceAttr;
|
|
@@ -1649,11 +1650,10 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1649
1650
|
let result = "", skip = /[\s/>"'=]/, events;
|
|
1650
1651
|
switch (tagName) {
|
|
1651
1652
|
case "input":
|
|
1652
|
-
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange)
|
|
1653
|
-
else if ("checkedValue" in data || data.checkedValueChange) result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value)
|
|
1654
|
-
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange)
|
|
1653
|
+
if (data.checkedChange) result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1), skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/;
|
|
1654
|
+
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/>"'=]/;
|
|
1655
|
+
else if (data.valueChange) result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1), skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
1655
1656
|
else break;
|
|
1656
|
-
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
1657
1657
|
break;
|
|
1658
1658
|
case "select":
|
|
1659
1659
|
case "textarea":
|
|
@@ -1664,7 +1664,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
1664
1664
|
break;
|
|
1665
1665
|
case "details":
|
|
1666
1666
|
case "dialog":
|
|
1667
|
-
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1667
|
+
data.openChange && (result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1), skip = /^open(?:Change)?$|[\s/>"'=]/);
|
|
1668
1668
|
break;
|
|
1669
1669
|
}
|
|
1670
1670
|
for (let name in data) {
|
|
@@ -1697,11 +1697,14 @@ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
|
|
|
1697
1697
|
function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
|
|
1698
1698
|
_html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`), _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
|
|
1699
1699
|
}
|
|
1700
|
-
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
1701
|
-
writeScope(scopeId, {
|
|
1700
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
1701
|
+
writeScope(scopeId, serializeType ? {
|
|
1702
1702
|
["F" + nodeAccessor]: type,
|
|
1703
1703
|
["G" + nodeAccessor]: value,
|
|
1704
1704
|
["E" + nodeAccessor]: valueChange
|
|
1705
|
+
} : {
|
|
1706
|
+
["G" + nodeAccessor]: value,
|
|
1707
|
+
["E" + nodeAccessor]: valueChange
|
|
1705
1708
|
});
|
|
1706
1709
|
}
|
|
1707
1710
|
function stringAttr(name, value) {
|
package/dist/translator/index.js
CHANGED
|
@@ -25,7 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
let package_json = require("../../package.json");
|
|
26
26
|
let _marko_compiler = require("@marko/compiler");
|
|
27
27
|
let _marko_compiler_babel_utils = require("@marko/compiler/babel-utils");
|
|
28
|
-
let _marko_compiler_config = require("@marko/compiler/config");
|
|
29
28
|
let node_path = require("node:path");
|
|
30
29
|
node_path = __toESM(node_path);
|
|
31
30
|
let path = require("path");
|
|
@@ -1765,13 +1764,13 @@ function getBindingPropTree(binding) {
|
|
|
1765
1764
|
};
|
|
1766
1765
|
if (!binding.reads.size) {
|
|
1767
1766
|
if (!binding.aliases.size) {
|
|
1768
|
-
props.props =
|
|
1767
|
+
props.props = Object.create(null);
|
|
1769
1768
|
for (const [property, alias] of binding.propertyAliases) props.props[property] = getBindingPropTree(alias);
|
|
1770
1769
|
} else if (binding.aliases.size === 1) {
|
|
1771
1770
|
const [restAlias] = binding.aliases;
|
|
1772
1771
|
if (hasSupersetExcludeProperties(binding, restAlias.excludeProperties)) {
|
|
1773
1772
|
props.rest = getBindingPropTree(restAlias);
|
|
1774
|
-
props.props =
|
|
1773
|
+
props.props = Object.create(null);
|
|
1775
1774
|
if (restAlias.type === 2) restAlias.export ??= generateUid(restAlias.name);
|
|
1776
1775
|
forEach(restAlias.excludeProperties, (property) => {
|
|
1777
1776
|
const propAlias = binding.propertyAliases.get(property);
|
|
@@ -2013,29 +2012,30 @@ function _attr_style(value) {
|
|
|
2013
2012
|
}
|
|
2014
2013
|
function _attr_option_value(value) {
|
|
2015
2014
|
const valueAttr = _attr("value", value);
|
|
2016
|
-
|
|
2015
|
+
const selectedValue = getContext(kSelectedValue);
|
|
2016
|
+
if (selectedValue !== void 0 && normalizedValueMatches(selectedValue, value)) return valueAttr + " selected";
|
|
2017
2017
|
return valueAttr;
|
|
2018
2018
|
}
|
|
2019
2019
|
const kSelectedValue = Symbol("selectedValue");
|
|
2020
|
-
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
|
2021
|
-
if (valueChange) writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange);
|
|
2020
|
+
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content, serializeType) {
|
|
2021
|
+
if (valueChange) writeControlledScope(3, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
2022
2022
|
if (content) withContext(kSelectedValue, value, content);
|
|
2023
2023
|
}
|
|
2024
|
-
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2025
|
-
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange);
|
|
2024
|
+
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2025
|
+
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
2026
2026
|
return _escape(value);
|
|
2027
2027
|
}
|
|
2028
|
-
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2029
|
-
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange);
|
|
2028
|
+
function _attr_input_value(scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2029
|
+
if (valueChange) writeControlledScope(2, scopeId, nodeAccessor, void 0, valueChange, serializeType);
|
|
2030
2030
|
return _attr("value", value);
|
|
2031
2031
|
}
|
|
2032
|
-
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
2033
|
-
if (checkedChange) writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange);
|
|
2032
|
+
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange, serializeType) {
|
|
2033
|
+
if (checkedChange) writeControlledScope(0, scopeId, nodeAccessor, void 0, checkedChange, serializeType);
|
|
2034
2034
|
return isNotVoid(checked) ? " checked" : "";
|
|
2035
2035
|
}
|
|
2036
|
-
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
2036
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
2037
2037
|
const valueAttr = _attr("value", value);
|
|
2038
|
-
if (checkedValueChange) writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange);
|
|
2038
|
+
if (checkedValueChange) writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType);
|
|
2039
2039
|
return normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
2040
2040
|
}
|
|
2041
2041
|
const checkedValuesRefs = /* @__PURE__ */ new WeakMap();
|
|
@@ -2049,9 +2049,9 @@ function getCheckedValueRef(checkedValue) {
|
|
|
2049
2049
|
return ref;
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
|
-
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
2052
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
2053
2053
|
const normalizedOpen = isNotVoid(open);
|
|
2054
|
-
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange);
|
|
2054
|
+
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType);
|
|
2055
2055
|
return normalizedOpen ? " open" : "";
|
|
2056
2056
|
}
|
|
2057
2057
|
function _attr(name, value) {
|
|
@@ -2063,11 +2063,16 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2063
2063
|
let events;
|
|
2064
2064
|
switch (tagName) {
|
|
2065
2065
|
case "input":
|
|
2066
|
-
if (data.checkedChange)
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
else
|
|
2070
|
-
|
|
2066
|
+
if (data.checkedChange) {
|
|
2067
|
+
result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1);
|
|
2068
|
+
skip = /^checked(?:Value)?(?:Change)?$|[\s/>"'=]/;
|
|
2069
|
+
} else if ("checkedValue" in data || data.checkedValueChange) {
|
|
2070
|
+
result += _attr_input_checkedValue(scopeId, nodeAccessor, data.checkedValue, data.checkedValueChange, data.value, 1);
|
|
2071
|
+
skip = /^(?:value|checked(?:Value)?)(?:Change)?$|[\s/>"'=]/;
|
|
2072
|
+
} else if (data.valueChange) {
|
|
2073
|
+
result += _attr_input_value(scopeId, nodeAccessor, data.value, data.valueChange, 1);
|
|
2074
|
+
skip = /^value(?:Change)?$|[\s/>"'=]/;
|
|
2075
|
+
} else break;
|
|
2071
2076
|
break;
|
|
2072
2077
|
case "select":
|
|
2073
2078
|
case "textarea":
|
|
@@ -2082,7 +2087,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2082
2087
|
case "details":
|
|
2083
2088
|
case "dialog":
|
|
2084
2089
|
if (data.openChange) {
|
|
2085
|
-
result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange);
|
|
2090
|
+
result += _attr_details_or_dialog_open(scopeId, nodeAccessor, data.open, data.openChange, 1);
|
|
2086
2091
|
skip = /^open(?:Change)?$|[\s/>"'=]/;
|
|
2087
2092
|
}
|
|
2088
2093
|
break;
|
|
@@ -2109,11 +2114,14 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2109
2114
|
}
|
|
2110
2115
|
return result;
|
|
2111
2116
|
}
|
|
2112
|
-
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
2113
|
-
writeScope(scopeId, {
|
|
2117
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2118
|
+
writeScope(scopeId, serializeType ? {
|
|
2114
2119
|
["ControlledType:" + nodeAccessor]: type,
|
|
2115
2120
|
["ControlledValue:" + nodeAccessor]: value,
|
|
2116
2121
|
["ControlledHandler:" + nodeAccessor]: valueChange
|
|
2122
|
+
} : {
|
|
2123
|
+
["ControlledValue:" + nodeAccessor]: value,
|
|
2124
|
+
["ControlledHandler:" + nodeAccessor]: valueChange
|
|
2117
2125
|
});
|
|
2118
2126
|
}
|
|
2119
2127
|
function stringAttr(name, value) {
|
|
@@ -2175,10 +2183,10 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2175
2183
|
_html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`);
|
|
2176
2184
|
if (!voidElementsReg.test(renderer)) {
|
|
2177
2185
|
const renderContent = content || normalizeDynamicRenderer(input.content);
|
|
2178
|
-
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange));
|
|
2186
|
+
if (renderer === "textarea") _html(_attr_textarea_value(branchId, "a", input.value, input.valueChange, 1));
|
|
2179
2187
|
else if (renderContent) {
|
|
2180
2188
|
if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
2181
|
-
if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent);
|
|
2189
|
+
if (renderer === "select" && ("value" in input || "valueChange" in input)) _attr_select_value(branchId, "a", input.value, input.valueChange, renderContent, 1);
|
|
2182
2190
|
else _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
2183
2191
|
}
|
|
2184
2192
|
_html(`</${renderer}>`);
|
|
@@ -4070,8 +4078,7 @@ function analyzeAttributeTags(tag) {
|
|
|
4070
4078
|
}
|
|
4071
4079
|
let attrTagMeta = lookup[name];
|
|
4072
4080
|
if (!attrTagMeta) {
|
|
4073
|
-
attrTagMeta = lookup[name] = createAttrTagMeta(name, []);
|
|
4074
|
-
curGroup = attrTagMeta.group;
|
|
4081
|
+
attrTagMeta = lookup[name] = createAttrTagMeta(name, curGroup ||= []);
|
|
4075
4082
|
curGroup.push(name);
|
|
4076
4083
|
}
|
|
4077
4084
|
attrTagMeta.dynamic = true;
|
|
@@ -4418,7 +4425,8 @@ var native_tag_default = {
|
|
|
4418
4425
|
tag.insertBefore(_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(spreadIdentifier, spreadExpression)]));
|
|
4419
4426
|
htmlSelectArgs.set(tag.node, {
|
|
4420
4427
|
value: _marko_compiler.types.memberExpression(spreadIdentifier, _marko_compiler.types.identifier("value")),
|
|
4421
|
-
valueChange: _marko_compiler.types.memberExpression(spreadIdentifier, _marko_compiler.types.identifier("valueChange"))
|
|
4428
|
+
valueChange: _marko_compiler.types.memberExpression(spreadIdentifier, _marko_compiler.types.identifier("valueChange")),
|
|
4429
|
+
serializeType: _marko_compiler.types.numericLiteral(1)
|
|
4422
4430
|
});
|
|
4423
4431
|
spreadExpression = spreadIdentifier;
|
|
4424
4432
|
}
|
|
@@ -4435,7 +4443,7 @@ var native_tag_default = {
|
|
|
4435
4443
|
valueChange = _marko_compiler.types.memberExpression(spreadIdentifier, _marko_compiler.types.identifier("valueChange"));
|
|
4436
4444
|
spreadExpression = spreadIdentifier;
|
|
4437
4445
|
}
|
|
4438
|
-
if (valueChange) writeAtStartOfBody = callRuntime("_attr_textarea_value", getScopeIdIdentifier(tagSection), visitAccessor, value, valueChange);
|
|
4446
|
+
if (valueChange) writeAtStartOfBody = callRuntime("_attr_textarea_value", getScopeIdIdentifier(tagSection), visitAccessor, value, valueChange, staticControllable ? void 0 : _marko_compiler.types.numericLiteral(1));
|
|
4439
4447
|
else if (value) writeAtStartOfBody = callRuntime("_escape", value);
|
|
4440
4448
|
}
|
|
4441
4449
|
for (const attr of staticAttrs) {
|
|
@@ -4495,7 +4503,7 @@ var native_tag_default = {
|
|
|
4495
4503
|
if (selectArgs) {
|
|
4496
4504
|
if (!tagExtra[kSkipEndTag]) write`</${tagName}>`;
|
|
4497
4505
|
flushInto(tag);
|
|
4498
|
-
tag.insertBefore(_marko_compiler.types.expressionStatement(callRuntime("_attr_select_value", getScopeIdIdentifier(tagSection), nodeBinding && getScopeAccessorLiteral(nodeBinding), selectArgs.value, selectArgs.valueChange, _marko_compiler.types.arrowFunctionExpression([], _marko_compiler.types.blockStatement(tag.node.body.body)))));
|
|
4506
|
+
tag.insertBefore(_marko_compiler.types.expressionStatement(callRuntime("_attr_select_value", getScopeIdIdentifier(tagSection), nodeBinding && getScopeAccessorLiteral(nodeBinding), selectArgs.value, selectArgs.valueChange, _marko_compiler.types.arrowFunctionExpression([], _marko_compiler.types.blockStatement(tag.node.body.body)), selectArgs.serializeType)));
|
|
4499
4507
|
} else if (isTextOnly) {
|
|
4500
4508
|
for (const child of tag.node.body.body) if (_marko_compiler.types.isMarkoText(child)) write`${child.value}`;
|
|
4501
4509
|
else if (_marko_compiler.types.isMarkoPlaceholder(child)) write`${callRuntime(getTextOnlyEscapeHelper(tagName), child.value)}`;
|
|
@@ -6919,7 +6927,7 @@ function getReadReplacement(node, signal) {
|
|
|
6919
6927
|
else if (read.getter?.hoisted) replacement = _marko_compiler.types.callExpression(getBindingGetterIdentifier(readBinding, read.getter.hoisted), [getScopeExpression(extra.section, read.getter.hoisted)]);
|
|
6920
6928
|
else if (readBinding.type === 0) {
|
|
6921
6929
|
if (read.getter) replacement = _marko_compiler.types.callExpression(getBindingGetterIdentifier(readBinding, readBinding.section), [getScopeExpression(extra.section, readBinding.section)]);
|
|
6922
|
-
} else if (!
|
|
6930
|
+
} else if (!isOptimize() && read.ownVar) replacement = callRuntime("_assert_init", extra.section ? getScopeExpression(extra.section, readBinding.section) : scopeIdentifier, getScopeAccessorLiteral(readBinding));
|
|
6923
6931
|
else replacement = createScopeReadExpression(readBinding, extra.section);
|
|
6924
6932
|
else if (node.type !== "Identifier") replacement = _marko_compiler.types.identifier(readBinding.name);
|
|
6925
6933
|
else if (read.getter?.hoisted) replacement = getBindingGetterIdentifier(readBinding, read.getter.hoisted);
|
|
@@ -7982,9 +7990,9 @@ var style_default = {
|
|
|
7982
7990
|
(0, _marko_compiler_babel_utils.assertNoParams)(tag);
|
|
7983
7991
|
(0, _marko_compiler_babel_utils.assertNoAttributeTags)(tag);
|
|
7984
7992
|
const { node, hub: { file } } = tag;
|
|
7985
|
-
const
|
|
7993
|
+
const extClass = (STYLE_EXT_REG.exec(node.rawValue || "")?.[1]?.slice(1))?.replace(/\./g, " ");
|
|
7986
7994
|
for (const attr of node.attributes) {
|
|
7987
|
-
if (attr.start == null && attr.type === "MarkoAttribute" && attr.name === "class" && attr.value.type === "StringLiteral" && attr.value.value ===
|
|
7995
|
+
if (attr.start == null && attr.type === "MarkoAttribute" && attr.name === "class" && attr.value.type === "StringLiteral" && attr.value.value === extClass) continue;
|
|
7988
7996
|
throw tag.hub.buildError(attr.value, "The `style` does not support html attributes." + htmlStyleTagAlternateMsg);
|
|
7989
7997
|
}
|
|
7990
7998
|
for (const child of node.body.body) if (child.type !== "MarkoText") throw tag.hub.buildError(child, "The [`<style>` tag](https://markojs.com/docs/reference/core-tag#style) currently only supports static content." + htmlStyleTagAlternateMsg);
|
|
@@ -8481,7 +8489,7 @@ var referenced_identifier_default = {
|
|
|
8481
8489
|
abortIdsByExpression = /* @__PURE__ */ new Map();
|
|
8482
8490
|
abortIdsByExpressionForSection.set(section, abortIdsByExpression);
|
|
8483
8491
|
}
|
|
8484
|
-
if (
|
|
8492
|
+
if (exprId === void 0) {
|
|
8485
8493
|
exprId = abortIdsByExpression.size;
|
|
8486
8494
|
abortIdsByExpression.set(exprRoot, exprId);
|
|
8487
8495
|
addStatement("render", section, exprRoot.node.extra?.referencedBindings, _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(importRuntime("$signalReset"), [scopeIdentifier, _marko_compiler.types.numericLiteral(exprId)])), false);
|
|
@@ -8774,7 +8782,8 @@ var dynamic_tag_default = {
|
|
|
8774
8782
|
let tagExpression = node.name;
|
|
8775
8783
|
if (isClassAPI) {
|
|
8776
8784
|
const classTagTemplate = (0, _marko_compiler_babel_utils.getTagTemplate)(tag);
|
|
8777
|
-
const
|
|
8785
|
+
const classFile = classTagTemplate ? (0, _marko_compiler_babel_utils.loadFileForTag)(tag) : void 0;
|
|
8786
|
+
const classHydration = classFile?.metadata.marko.classHydration;
|
|
8778
8787
|
if (!isOutputHTML() && isOptimize() && classTagTemplate && !tagsSerializeReason && !classHydration) {
|
|
8779
8788
|
tag.remove();
|
|
8780
8789
|
return;
|
|
@@ -8782,8 +8791,8 @@ var dynamic_tag_default = {
|
|
|
8782
8791
|
((0, _marko_compiler_babel_utils.getProgram)().node.extra ??= {}).needsCompat = true;
|
|
8783
8792
|
if (_marko_compiler.types.isStringLiteral(tagExpression)) tagExpression = (0, _marko_compiler_babel_utils.importDefault)(tag.hub.file, getTagRelativePath(tag), tagExpression.value);
|
|
8784
8793
|
if (classTagTemplate) {
|
|
8785
|
-
const preserveBoundary = classHydration === "descendant" &&
|
|
8786
|
-
if (isOutputHTML() ? serializeReason ||
|
|
8794
|
+
const preserveBoundary = !tagsSerializeReason && (classHydration === "descendant" || classHydration === "self" && !!classFile?.metadata.marko.hasComponentBrowser);
|
|
8795
|
+
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"), [
|
|
8787
8796
|
_marko_compiler.types.stringLiteral((0, _marko_compiler_babel_utils.loadFileForTag)(tag).metadata.marko.id),
|
|
8788
8797
|
_marko_compiler.types.identifier(tagExpression.name),
|
|
8789
8798
|
...preserveBoundary ? [_marko_compiler.types.stringLiteral("preserve")] : []
|