marko 6.1.17 → 6.1.20
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 +38 -39
- package/dist/debug/dom.mjs +38 -39
- package/dist/debug/html.js +37 -25
- package/dist/debug/html.mjs +37 -25
- package/dist/dom/compat.d.ts +1 -0
- package/dist/dom/event.d.ts +1 -1
- package/dist/dom.js +21 -30
- package/dist/dom.mjs +21 -30
- 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 +66 -43
- package/dist/translator/visitors/tag/dynamic-tag.d.ts +10 -0
- package/package.json +1 -1
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");
|
|
@@ -1348,7 +1347,6 @@ function analyzeTagNameType(tag, allowDynamic) {
|
|
|
1348
1347
|
extra.tagNameType = 2;
|
|
1349
1348
|
extra.tagNameDynamic = true;
|
|
1350
1349
|
extra.featureType = "class";
|
|
1351
|
-
((0, _marko_compiler_babel_utils.getProgram)().node.extra ??= {}).needsCompat = true;
|
|
1352
1350
|
} else if (!childFile) {
|
|
1353
1351
|
extra.tagNameType = 2;
|
|
1354
1352
|
extra.tagNameDynamic = true;
|
|
@@ -1766,13 +1764,13 @@ function getBindingPropTree(binding) {
|
|
|
1766
1764
|
};
|
|
1767
1765
|
if (!binding.reads.size) {
|
|
1768
1766
|
if (!binding.aliases.size) {
|
|
1769
|
-
props.props =
|
|
1767
|
+
props.props = Object.create(null);
|
|
1770
1768
|
for (const [property, alias] of binding.propertyAliases) props.props[property] = getBindingPropTree(alias);
|
|
1771
1769
|
} else if (binding.aliases.size === 1) {
|
|
1772
1770
|
const [restAlias] = binding.aliases;
|
|
1773
1771
|
if (hasSupersetExcludeProperties(binding, restAlias.excludeProperties)) {
|
|
1774
1772
|
props.rest = getBindingPropTree(restAlias);
|
|
1775
|
-
props.props =
|
|
1773
|
+
props.props = Object.create(null);
|
|
1776
1774
|
if (restAlias.type === 2) restAlias.export ??= generateUid(restAlias.name);
|
|
1777
1775
|
forEach(restAlias.excludeProperties, (property) => {
|
|
1778
1776
|
const propAlias = binding.propertyAliases.get(property);
|
|
@@ -2014,29 +2012,30 @@ function _attr_style(value) {
|
|
|
2014
2012
|
}
|
|
2015
2013
|
function _attr_option_value(value) {
|
|
2016
2014
|
const valueAttr = _attr("value", value);
|
|
2017
|
-
|
|
2015
|
+
const selectedValue = getContext(kSelectedValue);
|
|
2016
|
+
if (selectedValue !== void 0 && normalizedValueMatches(selectedValue, value)) return valueAttr + " selected";
|
|
2018
2017
|
return valueAttr;
|
|
2019
2018
|
}
|
|
2020
2019
|
const kSelectedValue = Symbol("selectedValue");
|
|
2021
|
-
function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
|
|
2022
|
-
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);
|
|
2023
2022
|
if (content) withContext(kSelectedValue, value, content);
|
|
2024
2023
|
}
|
|
2025
|
-
function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2026
|
-
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);
|
|
2027
2026
|
return _escape(value);
|
|
2028
2027
|
}
|
|
2029
|
-
function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
|
|
2030
|
-
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);
|
|
2031
2030
|
return _attr("value", value);
|
|
2032
2031
|
}
|
|
2033
|
-
function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
|
|
2034
|
-
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);
|
|
2035
2034
|
return isNotVoid(checked) ? " checked" : "";
|
|
2036
2035
|
}
|
|
2037
|
-
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
|
|
2036
|
+
function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value, serializeType) {
|
|
2038
2037
|
const valueAttr = _attr("value", value);
|
|
2039
|
-
if (checkedValueChange) writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange);
|
|
2038
|
+
if (checkedValueChange) writeControlledScope(1, scopeId, nodeAccessor, getCheckedValueRef(checkedValue), checkedValueChange, serializeType);
|
|
2040
2039
|
return normalizedValueMatches(checkedValue, value) ? valueAttr + " checked" : valueAttr;
|
|
2041
2040
|
}
|
|
2042
2041
|
const checkedValuesRefs = /* @__PURE__ */ new WeakMap();
|
|
@@ -2050,9 +2049,9 @@ function getCheckedValueRef(checkedValue) {
|
|
|
2050
2049
|
return ref;
|
|
2051
2050
|
}
|
|
2052
2051
|
}
|
|
2053
|
-
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
|
|
2052
|
+
function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange, serializeType) {
|
|
2054
2053
|
const normalizedOpen = isNotVoid(open);
|
|
2055
|
-
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange);
|
|
2054
|
+
if (openChange) writeControlledScope(4, scopeId, nodeAccessor, normalizedOpen || void 0, openChange, serializeType);
|
|
2056
2055
|
return normalizedOpen ? " open" : "";
|
|
2057
2056
|
}
|
|
2058
2057
|
function _attr(name, value) {
|
|
@@ -2064,11 +2063,16 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2064
2063
|
let events;
|
|
2065
2064
|
switch (tagName) {
|
|
2066
2065
|
case "input":
|
|
2067
|
-
if (data.checkedChange)
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
else
|
|
2071
|
-
|
|
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;
|
|
2072
2076
|
break;
|
|
2073
2077
|
case "select":
|
|
2074
2078
|
case "textarea":
|
|
@@ -2083,7 +2087,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2083
2087
|
case "details":
|
|
2084
2088
|
case "dialog":
|
|
2085
2089
|
if (data.openChange) {
|
|
2086
|
-
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);
|
|
2087
2091
|
skip = /^open(?:Change)?$|[\s/>"'=]/;
|
|
2088
2092
|
}
|
|
2089
2093
|
break;
|
|
@@ -2110,11 +2114,14 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
|
|
|
2110
2114
|
}
|
|
2111
2115
|
return result;
|
|
2112
2116
|
}
|
|
2113
|
-
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
|
|
2114
|
-
writeScope(scopeId, {
|
|
2117
|
+
function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
|
|
2118
|
+
writeScope(scopeId, serializeType ? {
|
|
2115
2119
|
["ControlledType:" + nodeAccessor]: type,
|
|
2116
2120
|
["ControlledValue:" + nodeAccessor]: value,
|
|
2117
2121
|
["ControlledHandler:" + nodeAccessor]: valueChange
|
|
2122
|
+
} : {
|
|
2123
|
+
["ControlledValue:" + nodeAccessor]: value,
|
|
2124
|
+
["ControlledHandler:" + nodeAccessor]: valueChange
|
|
2118
2125
|
});
|
|
2119
2126
|
}
|
|
2120
2127
|
function stringAttr(name, value) {
|
|
@@ -2176,10 +2183,10 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
|
|
|
2176
2183
|
_html(`<${renderer}${_attrs(input, "a", branchId, renderer)}>`);
|
|
2177
2184
|
if (!voidElementsReg.test(renderer)) {
|
|
2178
2185
|
const renderContent = content || normalizeDynamicRenderer(input.content);
|
|
2179
|
-
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));
|
|
2180
2187
|
else if (renderContent) {
|
|
2181
2188
|
if (typeof renderContent !== "function") throw new Error(`Body content is not supported for the \`<${renderer}>\` tag.`);
|
|
2182
|
-
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);
|
|
2183
2190
|
else _dynamic_tag(branchId, "a", renderContent, void 0, 0, void 0, serializeReason);
|
|
2184
2191
|
}
|
|
2185
2192
|
_html(`</${renderer}>`);
|
|
@@ -4071,8 +4078,7 @@ function analyzeAttributeTags(tag) {
|
|
|
4071
4078
|
}
|
|
4072
4079
|
let attrTagMeta = lookup[name];
|
|
4073
4080
|
if (!attrTagMeta) {
|
|
4074
|
-
attrTagMeta = lookup[name] = createAttrTagMeta(name, []);
|
|
4075
|
-
curGroup = attrTagMeta.group;
|
|
4081
|
+
attrTagMeta = lookup[name] = createAttrTagMeta(name, curGroup ||= []);
|
|
4076
4082
|
curGroup.push(name);
|
|
4077
4083
|
}
|
|
4078
4084
|
attrTagMeta.dynamic = true;
|
|
@@ -4419,7 +4425,8 @@ var native_tag_default = {
|
|
|
4419
4425
|
tag.insertBefore(_marko_compiler.types.variableDeclaration("const", [_marko_compiler.types.variableDeclarator(spreadIdentifier, spreadExpression)]));
|
|
4420
4426
|
htmlSelectArgs.set(tag.node, {
|
|
4421
4427
|
value: _marko_compiler.types.memberExpression(spreadIdentifier, _marko_compiler.types.identifier("value")),
|
|
4422
|
-
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)
|
|
4423
4430
|
});
|
|
4424
4431
|
spreadExpression = spreadIdentifier;
|
|
4425
4432
|
}
|
|
@@ -4436,7 +4443,7 @@ var native_tag_default = {
|
|
|
4436
4443
|
valueChange = _marko_compiler.types.memberExpression(spreadIdentifier, _marko_compiler.types.identifier("valueChange"));
|
|
4437
4444
|
spreadExpression = spreadIdentifier;
|
|
4438
4445
|
}
|
|
4439
|
-
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));
|
|
4440
4447
|
else if (value) writeAtStartOfBody = callRuntime("_escape", value);
|
|
4441
4448
|
}
|
|
4442
4449
|
for (const attr of staticAttrs) {
|
|
@@ -4496,7 +4503,7 @@ var native_tag_default = {
|
|
|
4496
4503
|
if (selectArgs) {
|
|
4497
4504
|
if (!tagExtra[kSkipEndTag]) write`</${tagName}>`;
|
|
4498
4505
|
flushInto(tag);
|
|
4499
|
-
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)));
|
|
4500
4507
|
} else if (isTextOnly) {
|
|
4501
4508
|
for (const child of tag.node.body.body) if (_marko_compiler.types.isMarkoText(child)) write`${child.value}`;
|
|
4502
4509
|
else if (_marko_compiler.types.isMarkoPlaceholder(child)) write`${callRuntime(getTextOnlyEscapeHelper(tagName), child.value)}`;
|
|
@@ -6920,7 +6927,7 @@ function getReadReplacement(node, signal) {
|
|
|
6920
6927
|
else if (read.getter?.hoisted) replacement = _marko_compiler.types.callExpression(getBindingGetterIdentifier(readBinding, read.getter.hoisted), [getScopeExpression(extra.section, read.getter.hoisted)]);
|
|
6921
6928
|
else if (readBinding.type === 0) {
|
|
6922
6929
|
if (read.getter) replacement = _marko_compiler.types.callExpression(getBindingGetterIdentifier(readBinding, readBinding.section), [getScopeExpression(extra.section, readBinding.section)]);
|
|
6923
|
-
} else if (!
|
|
6930
|
+
} else if (!isOptimize() && read.ownVar) replacement = callRuntime("_assert_init", extra.section ? getScopeExpression(extra.section, readBinding.section) : scopeIdentifier, getScopeAccessorLiteral(readBinding));
|
|
6924
6931
|
else replacement = createScopeReadExpression(readBinding, extra.section);
|
|
6925
6932
|
else if (node.type !== "Identifier") replacement = _marko_compiler.types.identifier(readBinding.name);
|
|
6926
6933
|
else if (read.getter?.hoisted) replacement = getBindingGetterIdentifier(readBinding, read.getter.hoisted);
|
|
@@ -7983,9 +7990,9 @@ var style_default = {
|
|
|
7983
7990
|
(0, _marko_compiler_babel_utils.assertNoParams)(tag);
|
|
7984
7991
|
(0, _marko_compiler_babel_utils.assertNoAttributeTags)(tag);
|
|
7985
7992
|
const { node, hub: { file } } = tag;
|
|
7986
|
-
const
|
|
7993
|
+
const extClass = (STYLE_EXT_REG.exec(node.rawValue || "")?.[1]?.slice(1))?.replace(/\./g, " ");
|
|
7987
7994
|
for (const attr of node.attributes) {
|
|
7988
|
-
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;
|
|
7989
7996
|
throw tag.hub.buildError(attr.value, "The `style` does not support html attributes." + htmlStyleTagAlternateMsg);
|
|
7990
7997
|
}
|
|
7991
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);
|
|
@@ -8482,7 +8489,7 @@ var referenced_identifier_default = {
|
|
|
8482
8489
|
abortIdsByExpression = /* @__PURE__ */ new Map();
|
|
8483
8490
|
abortIdsByExpressionForSection.set(section, abortIdsByExpression);
|
|
8484
8491
|
}
|
|
8485
|
-
if (
|
|
8492
|
+
if (exprId === void 0) {
|
|
8486
8493
|
exprId = abortIdsByExpression.size;
|
|
8487
8494
|
abortIdsByExpression.set(exprRoot, exprId);
|
|
8488
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);
|
|
@@ -8770,12 +8777,28 @@ var dynamic_tag_default = {
|
|
|
8770
8777
|
const tagExtra = node.extra;
|
|
8771
8778
|
const nodeBinding = tagExtra[kDOMBinding];
|
|
8772
8779
|
const isClassAPI = tagExtra.featureType === "class";
|
|
8780
|
+
const tagsSerializeReason = getSerializeReason(tagSection, nodeBinding);
|
|
8781
|
+
const serializeReason = tagsSerializeReason;
|
|
8773
8782
|
let tagExpression = node.name;
|
|
8774
|
-
if (
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8783
|
+
if (isClassAPI) {
|
|
8784
|
+
const classTagTemplate = (0, _marko_compiler_babel_utils.getTagTemplate)(tag);
|
|
8785
|
+
const classFile = classTagTemplate ? (0, _marko_compiler_babel_utils.loadFileForTag)(tag) : void 0;
|
|
8786
|
+
const classHydration = classFile?.metadata.marko.classHydration;
|
|
8787
|
+
if (!isOutputHTML() && isOptimize() && classTagTemplate && !tagsSerializeReason && !classHydration) {
|
|
8788
|
+
tag.remove();
|
|
8789
|
+
return;
|
|
8790
|
+
}
|
|
8791
|
+
((0, _marko_compiler_babel_utils.getProgram)().node.extra ??= {}).needsCompat = true;
|
|
8792
|
+
if (_marko_compiler.types.isStringLiteral(tagExpression)) tagExpression = (0, _marko_compiler_babel_utils.importDefault)(tag.hub.file, getTagRelativePath(tag), tagExpression.value);
|
|
8793
|
+
if (classTagTemplate) {
|
|
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"), [
|
|
8796
|
+
_marko_compiler.types.stringLiteral((0, _marko_compiler_babel_utils.loadFileForTag)(tag).metadata.marko.id),
|
|
8797
|
+
_marko_compiler.types.identifier(tagExpression.name),
|
|
8798
|
+
...preserveBoundary ? [_marko_compiler.types.stringLiteral("preserve")] : []
|
|
8799
|
+
]))], true) : _marko_compiler.types.expressionStatement(callRuntime("_resume", _marko_compiler.types.stringLiteral((0, _marko_compiler_babel_utils.loadFileForTag)(tag).metadata.marko.id), _marko_compiler.types.identifier(tagExpression.name))));
|
|
8800
|
+
} 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));
|
|
8801
|
+
} else if (_marko_compiler.types.isStringLiteral(tagExpression)) tagExpression = (0, _marko_compiler_babel_utils.importDefault)(tag.hub.file, getTagRelativePath(tag), tagExpression.value);
|
|
8779
8802
|
const { properties, statements } = translateAttrs(tag, void 0, void 0, void 0, isClassAPI ? "renderBody" : "content");
|
|
8780
8803
|
const args = [];
|
|
8781
8804
|
let hasTagArgs = false;
|
|
@@ -8793,7 +8816,7 @@ var dynamic_tag_default = {
|
|
|
8793
8816
|
if (isOutputHTML()) {
|
|
8794
8817
|
flushInto(tag);
|
|
8795
8818
|
writeHTMLResumeStatements(tag.get("body"));
|
|
8796
|
-
const serializeArg = getSerializeGuard(tagSection,
|
|
8819
|
+
const serializeArg = getSerializeGuard(tagSection, serializeReason, true);
|
|
8797
8820
|
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);
|
|
8798
8821
|
if (node.var) {
|
|
8799
8822
|
const dynamicScopeIdentifier = generateUidIdentifier(tag.get("name").toString() + "_scope");
|
|
@@ -8826,7 +8849,7 @@ var dynamic_tag_default = {
|
|
|
8826
8849
|
const argsOrInput = hasTagArgs ? _marko_compiler.types.arrayExpression(args) : args[0];
|
|
8827
8850
|
if (!_marko_compiler.types.isObjectExpression(argsOrInput) || argsOrInput.properties.length) signal.extraArgs = [_marko_compiler.types.arrowFunctionExpression([], statements.length ? _marko_compiler.types.blockStatement(statements.concat(_marko_compiler.types.returnStatement(argsOrInput))) : argsOrInput)];
|
|
8828
8851
|
}
|
|
8829
|
-
enableDynamicTagResume(tag);
|
|
8852
|
+
if (!isClassAPI) enableDynamicTagResume(tag);
|
|
8830
8853
|
addValue(section, tagExtra.referencedBindings, signal, tagExpression);
|
|
8831
8854
|
tag.remove();
|
|
8832
8855
|
}
|
|
@@ -3,6 +3,16 @@ import { type Binding } from "../../util/references";
|
|
|
3
3
|
import { type Section } from "../../util/sections";
|
|
4
4
|
declare const kDOMBinding: unique symbol;
|
|
5
5
|
declare const kChildOffsetScopeBinding: unique symbol;
|
|
6
|
+
declare enum ClassHydration {
|
|
7
|
+
Self = "self",
|
|
8
|
+
Descendant = "descendant"
|
|
9
|
+
}
|
|
10
|
+
declare module "@marko/compiler" {
|
|
11
|
+
interface MarkoMeta {
|
|
12
|
+
classHydration?: ClassHydration;
|
|
13
|
+
hasComponentBrowser?: boolean;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
6
16
|
declare module "@marko/compiler/dist/types" {
|
|
7
17
|
interface MarkoTagExtra {
|
|
8
18
|
[kDOMBinding]?: Binding;
|