@marko/runtime-tags 6.0.101 → 6.0.102

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.
@@ -1,2 +1,3 @@
1
1
  export declare const DEFAULT_RUNTIME_ID = "M";
2
2
  export declare const DEFAULT_RENDER_ID = "_";
3
+ export declare const DYNAMIC_TAG_SCRIPT_REGISTER_ID: string;
package/dist/debug/dom.js CHANGED
@@ -79,6 +79,7 @@ __export(dom_exports, {
79
79
  _on: () => _on,
80
80
  _or: () => _or,
81
81
  _resume: () => _resume,
82
+ _resume_dynamic_tag: () => _resume_dynamic_tag,
82
83
  _return: () => _return,
83
84
  _return_change: () => _return_change,
84
85
  _script: () => _script,
@@ -237,6 +238,11 @@ function normalizeDynamicRenderer(value) {
237
238
  }
238
239
  }
239
240
 
241
+ // src/common/meta.ts
242
+ var DEFAULT_RUNTIME_ID = "M";
243
+ var DEFAULT_RENDER_ID = "_";
244
+ var DYNAMIC_TAG_SCRIPT_REGISTER_ID = true ? "_dynamicTagScript" : "d";
245
+
240
246
  // src/dom/event.ts
241
247
  var defaultDelegator = createDelegator();
242
248
  function _on(element, type, handler) {
@@ -305,10 +311,6 @@ function stripSpacesAndPunctuation(str) {
305
311
  return str.replace(/[^\p{L}\p{N}]/gu, "");
306
312
  }
307
313
 
308
- // src/common/meta.ts
309
- var DEFAULT_RUNTIME_ID = "M";
310
- var DEFAULT_RENDER_ID = "_";
311
-
312
314
  // src/dom/scope.ts
313
315
  var nextScopeId = 1e6;
314
316
  function createScope($global, closestBranch) {
@@ -1925,6 +1927,9 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
1925
1927
  true ? `#${normalizedRenderer}/0` : 0,
1926
1928
  (inputIsArgs ? args[0] : args) || {}
1927
1929
  );
1930
+ if (childScope["EventAttributes:" /* EventAttributes */ + (true ? `#${normalizedRenderer}/0` : 0)] || childScope["ControlledHandler:" /* ControlledHandler */ + (true ? `#${normalizedRenderer}/0` : 0)]) {
1931
+ queueEffect(childScope, dynamicTagScript);
1932
+ }
1928
1933
  } else {
1929
1934
  for (const accessor in normalizedRenderer.___localClosures) {
1930
1935
  normalizedRenderer.___localClosures[accessor](
@@ -1950,6 +1955,12 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
1950
1955
  }
1951
1956
  };
1952
1957
  };
1958
+ function _resume_dynamic_tag() {
1959
+ _resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
1960
+ }
1961
+ function dynamicTagScript(branch) {
1962
+ _attrs_script(branch, true ? `#${branch.___renderer}/0` : 0);
1963
+ }
1953
1964
  function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
1954
1965
  const referenceNode = scope[nodeAccessor];
1955
1966
  const prevBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor];
@@ -134,6 +134,11 @@ function normalizeDynamicRenderer(value) {
134
134
  }
135
135
  }
136
136
 
137
+ // src/common/meta.ts
138
+ var DEFAULT_RUNTIME_ID = "M";
139
+ var DEFAULT_RENDER_ID = "_";
140
+ var DYNAMIC_TAG_SCRIPT_REGISTER_ID = true ? "_dynamicTagScript" : "d";
141
+
137
142
  // src/dom/event.ts
138
143
  var defaultDelegator = createDelegator();
139
144
  function _on(element, type, handler) {
@@ -202,10 +207,6 @@ function stripSpacesAndPunctuation(str) {
202
207
  return str.replace(/[^\p{L}\p{N}]/gu, "");
203
208
  }
204
209
 
205
- // src/common/meta.ts
206
- var DEFAULT_RUNTIME_ID = "M";
207
- var DEFAULT_RENDER_ID = "_";
208
-
209
210
  // src/dom/scope.ts
210
211
  var nextScopeId = 1e6;
211
212
  function createScope($global, closestBranch) {
@@ -1822,6 +1823,9 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
1822
1823
  true ? `#${normalizedRenderer}/0` : 0,
1823
1824
  (inputIsArgs ? args[0] : args) || {}
1824
1825
  );
1826
+ if (childScope["EventAttributes:" /* EventAttributes */ + (true ? `#${normalizedRenderer}/0` : 0)] || childScope["ControlledHandler:" /* ControlledHandler */ + (true ? `#${normalizedRenderer}/0` : 0)]) {
1827
+ queueEffect(childScope, dynamicTagScript);
1828
+ }
1825
1829
  } else {
1826
1830
  for (const accessor in normalizedRenderer.___localClosures) {
1827
1831
  normalizedRenderer.___localClosures[accessor](
@@ -1847,6 +1851,12 @@ var _dynamic_tag = function dynamicTag(nodeAccessor, getContent, getTagVar, inpu
1847
1851
  }
1848
1852
  };
1849
1853
  };
1854
+ function _resume_dynamic_tag() {
1855
+ _resume(DYNAMIC_TAG_SCRIPT_REGISTER_ID, dynamicTagScript);
1856
+ }
1857
+ function dynamicTagScript(branch) {
1858
+ _attrs_script(branch, true ? `#${branch.___renderer}/0` : 0);
1859
+ }
1850
1860
  function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
1851
1861
  const referenceNode = scope[nodeAccessor];
1852
1862
  const prevBranch = scope["ConditionalScope:" /* ConditionalScope */ + nodeAccessor];
@@ -2393,6 +2403,7 @@ export {
2393
2403
  _on,
2394
2404
  _or,
2395
2405
  _resume,
2406
+ _resume_dynamic_tag,
2396
2407
  _return,
2397
2408
  _return_change,
2398
2409
  _script,
@@ -3003,6 +3003,7 @@ var RENDER_BODY_ID = prefix + (true ? "renderBody" : "b");
3003
3003
  // src/common/meta.ts
3004
3004
  var DEFAULT_RUNTIME_ID = "M";
3005
3005
  var DEFAULT_RENDER_ID = "_";
3006
+ var DYNAMIC_TAG_SCRIPT_REGISTER_ID = true ? "_dynamicTagScript" : "d";
3006
3007
 
3007
3008
  // src/html/dynamic-tag.ts
3008
3009
  var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
@@ -3073,6 +3074,11 @@ var _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
3073
3074
  `Body content is not supported for the \`<${renderer}>\` tag.`
3074
3075
  );
3075
3076
  }
3077
+ const childScope = getScopeById(branchId);
3078
+ if (childScope && (childScope["EventAttributes:" /* EventAttributes */ + (true ? `#${renderer}/0` : 0)] || childScope["ControlledHandler:" /* ControlledHandler */ + (true ? `#${renderer}/0` : 0)])) {
3079
+ childScope.___renderer = renderer;
3080
+ _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
3081
+ }
3076
3082
  if (shouldResume) {
3077
3083
  _html(
3078
3084
  state.mark(
@@ -2911,6 +2911,7 @@ var RENDER_BODY_ID = prefix + (true ? "renderBody" : "b");
2911
2911
  // src/common/meta.ts
2912
2912
  var DEFAULT_RUNTIME_ID = "M";
2913
2913
  var DEFAULT_RENDER_ID = "_";
2914
+ var DYNAMIC_TAG_SCRIPT_REGISTER_ID = true ? "_dynamicTagScript" : "d";
2914
2915
 
2915
2916
  // src/html/dynamic-tag.ts
2916
2917
  var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
@@ -2981,6 +2982,11 @@ var _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
2981
2982
  `Body content is not supported for the \`<${renderer}>\` tag.`
2982
2983
  );
2983
2984
  }
2985
+ const childScope = getScopeById(branchId);
2986
+ if (childScope && (childScope["EventAttributes:" /* EventAttributes */ + (true ? `#${renderer}/0` : 0)] || childScope["ControlledHandler:" /* ControlledHandler */ + (true ? `#${renderer}/0` : 0)])) {
2987
+ childScope.___renderer = renderer;
2988
+ _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
2989
+ }
2984
2990
  if (shouldResume) {
2985
2991
  _html(
2986
2992
  state.mark(
@@ -10,6 +10,7 @@ export declare function renderCatch(scope: Scope, error: unknown): void;
10
10
  export declare function _if(nodeAccessor: Accessor, ...branches: Renderer[]): (scope: Scope, newBranch: number) => void;
11
11
  export declare function patchDynamicTag(fn: <T extends typeof _dynamic_tag>(cond: T) => T): void;
12
12
  export declare let _dynamic_tag: (nodeAccessor: Accessor, getContent?: ((scope: Scope) => Renderer) | 0, getTagVar?: (() => Signal<unknown>) | 0, inputIsArgs?: 1) => Signal<Renderer | string | undefined>;
13
+ export declare function _resume_dynamic_tag(): void;
13
14
  export declare function setConditionalRenderer<T>(scope: Scope, nodeAccessor: Accessor, newRenderer: T, createBranch: ($global: Scope["$global"], renderer: NonNullable<T>, parentScope: Scope, parentNode: ParentNode) => BranchScope): void;
14
15
  export declare function _for_of(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, value: [all: unknown[], by?: ((item: unknown, index: number) => unknown) | undefined]) => void;
15
16
  export declare function _for_in(nodeAccessor: Accessor, renderer: Renderer): (scope: Scope, value: [obj: {}, by?: ((key: string, v: unknown) => unknown) | undefined]) => void;
package/dist/dom.d.ts CHANGED
@@ -4,7 +4,7 @@ export { forIn, forOf, forTo, forUntil } from "./common/for";
4
4
  export { _call } from "./common/helpers";
5
5
  export { $signal, $signalReset } from "./dom/abort-signal";
6
6
  export { compat } from "./dom/compat";
7
- export { _await, _dynamic_tag, _for_in, _for_of, _for_to, _for_until, _if, _try, } from "./dom/control-flow";
7
+ export { _await, _dynamic_tag, _for_in, _for_of, _for_to, _for_until, _if, _resume_dynamic_tag, _try, } from "./dom/control-flow";
8
8
  export { _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checked_script, _attr_input_checkedValue, _attr_input_checkedValue_script, _attr_input_value, _attr_input_value_script, _attr_select_value, _attr_select_value_script, _attr_textarea_value, _attr_textarea_value_script, } from "./dom/controllable";
9
9
  export { _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_content, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _html, _lifecycle, _text, _text_content, } from "./dom/dom";
10
10
  export { _on } from "./dom/event";
package/dist/dom.js CHANGED
@@ -76,6 +76,7 @@ __export(dom_exports, {
76
76
  _on: () => _on,
77
77
  _or: () => _or,
78
78
  _resume: () => _resume,
79
+ _resume_dynamic_tag: () => _resume_dynamic_tag,
79
80
  _return: () => _return,
80
81
  _return_change: () => _return_change,
81
82
  _script: () => _script,
@@ -1238,7 +1239,7 @@ var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1238
1239
  childScope,
1239
1240
  0,
1240
1241
  (inputIsArgs ? args[0] : args) || {}
1241
- );
1242
+ ), (childScope["i" /* EventAttributes */ + 0] || childScope["e" /* ControlledHandler */ + 0]) && queueEffect(childScope, dynamicTagScript);
1242
1243
  else {
1243
1244
  for (let accessor in normalizedRenderer.F)
1244
1245
  normalizedRenderer.F[accessor](
@@ -1262,6 +1263,12 @@ var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1262
1263
  }
1263
1264
  };
1264
1265
  };
1266
+ function _resume_dynamic_tag() {
1267
+ _resume("d", dynamicTagScript);
1268
+ }
1269
+ function dynamicTagScript(branch) {
1270
+ _attrs_script(branch, 0);
1271
+ }
1265
1272
  function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
1266
1273
  let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.h || referenceNode).parentNode : referenceNode, newBranch = scope["d" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope.$global, newRenderer, scope, parentNode);
1267
1274
  referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.h) : parentNode.insertBefore(referenceNode, prevBranch.h), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
package/dist/dom.mjs CHANGED
@@ -1138,7 +1138,7 @@ var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1138
1138
  childScope,
1139
1139
  0,
1140
1140
  (inputIsArgs ? args[0] : args) || {}
1141
- );
1141
+ ), (childScope["i" /* EventAttributes */ + 0] || childScope["e" /* ControlledHandler */ + 0]) && queueEffect(childScope, dynamicTagScript);
1142
1142
  else {
1143
1143
  for (let accessor in normalizedRenderer.F)
1144
1144
  normalizedRenderer.F[accessor](
@@ -1162,6 +1162,12 @@ var _dynamic_tag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1162
1162
  }
1163
1163
  };
1164
1164
  };
1165
+ function _resume_dynamic_tag() {
1166
+ _resume("d", dynamicTagScript);
1167
+ }
1168
+ function dynamicTagScript(branch) {
1169
+ _attrs_script(branch, 0);
1170
+ }
1165
1171
  function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
1166
1172
  let referenceNode = scope[nodeAccessor], prevBranch = scope["d" /* ConditionalScope */ + nodeAccessor], parentNode = referenceNode.nodeType > 1 /* Element */ ? (prevBranch?.h || referenceNode).parentNode : referenceNode, newBranch = scope["d" /* ConditionalScope */ + nodeAccessor] = newRenderer && createBranch2(scope.$global, newRenderer, scope, parentNode);
1167
1173
  referenceNode === parentNode ? (prevBranch && (destroyBranch(prevBranch), referenceNode.textContent = ""), newBranch && insertBranchBefore(newBranch, parentNode, null)) : prevBranch ? (newBranch ? insertBranchBefore(newBranch, parentNode, prevBranch.h) : parentNode.insertBefore(referenceNode, prevBranch.h), removeAndDestroyBranch(prevBranch)) : newBranch && (insertBranchBefore(newBranch, parentNode, referenceNode), referenceNode.remove());
@@ -1523,6 +1529,7 @@ export {
1523
1529
  _on,
1524
1530
  _or,
1525
1531
  _resume,
1532
+ _resume_dynamic_tag,
1526
1533
  _return,
1527
1534
  _return_change,
1528
1535
  _script,
package/dist/html.js CHANGED
@@ -1981,7 +1981,8 @@ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|p
1981
1981
  }
1982
1982
  _html(`</${renderer}>`);
1983
1983
  }
1984
- shouldResume && _html(
1984
+ let childScope = getScopeById(branchId);
1985
+ childScope && (childScope["i" /* EventAttributes */ + 0] || childScope["e" /* ControlledHandler */ + 0]) && (childScope.i = renderer, _script(branchId, "d")), shouldResume && _html(
1985
1986
  state.mark(
1986
1987
  "'" /* BranchEndNativeTag */,
1987
1988
  scopeId + " " + accessor + " " + branchId
package/dist/html.mjs CHANGED
@@ -1892,7 +1892,8 @@ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|p
1892
1892
  }
1893
1893
  _html(`</${renderer}>`);
1894
1894
  }
1895
- shouldResume && _html(
1895
+ let childScope = getScopeById(branchId);
1896
+ childScope && (childScope["i" /* EventAttributes */ + 0] || childScope["e" /* ControlledHandler */ + 0]) && (childScope.i = renderer, _script(branchId, "d")), shouldResume && _html(
1896
1897
  state.mark(
1897
1898
  "'" /* BranchEndNativeTag */,
1898
1899
  scopeId + " " + accessor + " " + branchId
@@ -1514,38 +1514,37 @@ function createSectionState(key, init) {
1514
1514
  var import_compiler6 = require("@marko/compiler");
1515
1515
  var import_babel_utils9 = require("@marko/compiler/babel-utils");
1516
1516
  var MARKO_FILE_REG = /^<.*>$|\.marko$/;
1517
- function analyzeTagNameType(tag) {
1517
+ function analyzeTagNameType(tag, allowDynamic) {
1518
1518
  const extra = tag.node.extra ??= {};
1519
1519
  if (extra.tagNameType === void 0) {
1520
1520
  const name2 = tag.get("name");
1521
1521
  if (name2.isStringLiteral()) {
1522
1522
  extra.tagNameType = name2.node.value[0] === "@" ? 3 /* AttributeTag */ : (0, import_babel_utils9.isNativeTag)(tag) ? 0 /* NativeTag */ : 1 /* CustomTag */;
1523
- extra.tagNameNullable = extra.tagNameNullable = false;
1524
- } else if (name2.isIdentifier()) {
1525
- analyzeExpressionTagName(name2, extra);
1526
- if (extra.tagNameType === 0 /* NativeTag */) {
1527
- extra.tagNameType = 2 /* DynamicTag */;
1528
- }
1523
+ extra.tagNameNullable = extra.tagNameDynamic = false;
1529
1524
  } else if (name2.isTemplateLiteral() && !name2.node.expressions.length) {
1530
1525
  extra.tagNameType = 0 /* NativeTag */;
1526
+ extra.tagNameNullable = extra.tagNameDynamic = false;
1527
+ } else if (name2.isIdentifier()) {
1528
+ analyzeExpressionTagName(name2, extra);
1529
+ extra.tagNameDynamic = !extra.tagNameImported;
1531
1530
  } else {
1532
- extra.tagNameType = 2 /* DynamicTag */;
1533
- }
1534
- if (extra.tagNameType === void 0) {
1535
- extra.tagNameType = 2 /* DynamicTag */;
1531
+ analyzeExpressionTagName(name2, extra);
1532
+ extra.tagNameDynamic = true;
1536
1533
  }
1537
- if (extra.tagNameType === 1 /* CustomTag */ && !isCoreTag(tag)) {
1534
+ if (!extra.tagNameDynamic && extra.tagNameType === 1 /* CustomTag */ && !isCoreTag(tag)) {
1538
1535
  const childFile = (0, import_babel_utils9.loadFileForTag)(tag);
1539
1536
  if (!childFile) {
1540
1537
  extra.tagNameType = 2 /* DynamicTag */;
1538
+ extra.tagNameDynamic = true;
1541
1539
  } else if (childFile.ast.program.extra.featureType === "class") {
1542
1540
  extra.tagNameType = 2 /* DynamicTag */;
1541
+ extra.tagNameDynamic = true;
1543
1542
  extra.featureType = "class";
1544
1543
  ((0, import_babel_utils9.getProgram)().node.extra ??= {}).needsCompat = true;
1545
1544
  }
1546
1545
  }
1547
1546
  }
1548
- return extra.tagNameType;
1547
+ return !allowDynamic && extra.tagNameDynamic ? 2 /* DynamicTag */ : extra.tagNameType;
1549
1548
  }
1550
1549
  function analyzeExpressionTagName(name2, extra) {
1551
1550
  const pending = [name2];
@@ -1569,9 +1568,9 @@ function analyzeExpressionTagName(name2, extra) {
1569
1568
  } else if (path5.isAssignmentExpression()) {
1570
1569
  pending.push(path5.get("right"));
1571
1570
  } else if (path5.isBinaryExpression()) {
1572
- type = path5.node.operator !== "+" || type !== void 0 ? 2 /* DynamicTag */ : 0 /* NativeTag */;
1571
+ type = path5.node.operator !== "+" || type === void 0 || type === 0 /* NativeTag */ ? 0 /* NativeTag */ : 2 /* DynamicTag */;
1573
1572
  } else if (path5.isStringLiteral() || path5.isTemplateLiteral()) {
1574
- type = type !== void 0 ? 2 /* DynamicTag */ : 0 /* NativeTag */;
1573
+ type = type === void 0 || type === 0 /* NativeTag */ ? 0 /* NativeTag */ : 2 /* DynamicTag */;
1575
1574
  } else if (path5.isNullLiteral()) {
1576
1575
  nullable = true;
1577
1576
  } else if (path5.isIdentifier()) {
@@ -1588,12 +1587,14 @@ function analyzeExpressionTagName(name2, extra) {
1588
1587
  const decl = binding.path.parent;
1589
1588
  if (MARKO_FILE_REG.test(decl.source.value) && decl.specifiers.some((it) => import_compiler6.types.isImportDefaultSpecifier(it))) {
1590
1589
  const resolvedImport = (0, import_babel_utils9.resolveTagImport)(name2, decl.source.value) || decl.source.value;
1591
- if (type === 0 /* NativeTag */ || tagNameImported && tagNameImported !== resolvedImport) {
1592
- type = 2 /* DynamicTag */;
1593
- tagNameImported = void 0;
1594
- } else {
1590
+ if (type === void 0) {
1595
1591
  type = 1 /* CustomTag */;
1596
1592
  tagNameImported = resolvedImport;
1593
+ } else if (type === 0 /* NativeTag */) {
1594
+ type = 2 /* DynamicTag */;
1595
+ tagNameImported = void 0;
1596
+ } else if (tagNameImported !== resolvedImport) {
1597
+ tagNameImported = void 0;
1597
1598
  }
1598
1599
  } else {
1599
1600
  type = 2 /* DynamicTag */;
@@ -1620,9 +1621,8 @@ function analyzeExpressionTagName(name2, extra) {
1620
1621
  type = 2 /* DynamicTag */;
1621
1622
  }
1622
1623
  }
1623
- extra.tagNameType = type;
1624
+ extra.tagNameType = type ?? 2 /* DynamicTag */;
1624
1625
  extra.tagNameNullable = nullable;
1625
- extra.tagNameDynamic = true;
1626
1626
  if (type === 1 /* CustomTag */ && tagNameImported) {
1627
1627
  extra.tagNameImported = tagNameImported;
1628
1628
  }
@@ -5267,10 +5267,10 @@ function translateVar(tag, initialValue, kind = "const") {
5267
5267
  }
5268
5268
  forEachIdentifierPath(tag.get("var"), (id) => {
5269
5269
  const binding = id.node.extra?.binding;
5270
- if (!binding || !binding.upstreamAlias || !binding.assignmentSections || id.node === tagVar) {
5270
+ if (!binding || !binding.upstreamAlias || !binding.assignmentSections || binding.property === void 0 || id.node === tagVar) {
5271
5271
  return;
5272
5272
  }
5273
- const changeName = binding.name + "Change";
5273
+ const changeName = binding.property + "Change";
5274
5274
  const changeBinding = binding.upstreamAlias.propertyAliases.get(changeName);
5275
5275
  if (changeBinding && changeName !== changeBinding.name) {
5276
5276
  getDestructurePattern(id)?.pushContainer(
@@ -10694,7 +10694,7 @@ function assertValidCondition(tag) {
10694
10694
  function assertHasPrecedingCondition(tag) {
10695
10695
  let prev = tag.getPrevSibling();
10696
10696
  while (prev.node && prev.isMarkoComment()) prev = prev.getPrevSibling();
10697
- if (!isConditionTag(prev) || getTagName(prev) !== "else" && !prev.node.attributes.length) {
10697
+ if (!isConditionTag(prev) || getTagName(prev) === "else" && !prev.node.attributes.length) {
10698
10698
  throw tag.buildCodeFrameError(
10699
10699
  `The [\`<${getTagName(tag)}>\` tag](https://markojs.com/docs/reference/core-tag#if--else) must have a preceding \`<if=cond>\` or \`<else if=cond>\`.`
10700
10700
  );
@@ -10734,7 +10734,7 @@ function assertOptionalIfAttribute(tag) {
10734
10734
  const { node } = tag;
10735
10735
  const [ifAttr] = node.attributes;
10736
10736
  if (node.attributes.length > 1 || ifAttr && ifAttr.name !== "if") {
10737
- const start = node.attributes[1].loc?.start;
10737
+ const start = node.attributes[0].loc?.start;
10738
10738
  const end = node.attributes[node.attributes.length - 1].loc?.end;
10739
10739
  const msg = `The [\`${getTagName(tag)}\` tag](https://markojs.com/docs/reference/core-tag#if--else) only supports an \`if=\` attribute.`;
10740
10740
  if (start == null || end == null) {
@@ -12188,6 +12188,7 @@ var import_compiler63 = require("@marko/compiler");
12188
12188
  var import_babel_utils51 = require("@marko/compiler/babel-utils");
12189
12189
  var kDOMBinding3 = Symbol("dynamic tag dom binding");
12190
12190
  var kChildOffsetScopeBinding2 = Symbol("custom tag scope offset");
12191
+ var importedDynamicTagResume = /* @__PURE__ */ new WeakSet();
12191
12192
  var dynamic_tag_default = {
12192
12193
  analyze: {
12193
12194
  enter(tag) {
@@ -12478,12 +12479,27 @@ var dynamic_tag_default = {
12478
12479
  ];
12479
12480
  }
12480
12481
  }
12482
+ enableDynamicTagResume(tag);
12481
12483
  addValue(section, tagExtra.referencedBindings, signal, tagExpression);
12482
12484
  tag.remove();
12483
12485
  }
12484
12486
  }
12485
12487
  }
12486
12488
  };
12489
+ function enableDynamicTagResume(tag) {
12490
+ const program = (0, import_babel_utils51.getProgram)().node;
12491
+ if (!importedDynamicTagResume.has(program) && analyzeTagNameType(tag, true) !== 1 /* CustomTag */) {
12492
+ for (const attr of tag.node.attributes) {
12493
+ if (attr.type === "MarkoSpreadAttribute" || attr.type === "MarkoAttribute" && isEventOrChangeHandler(attr.name)) {
12494
+ importedDynamicTagResume.add(program);
12495
+ program.body.push(
12496
+ import_compiler63.types.expressionStatement(callRuntime("_resume_dynamic_tag"))
12497
+ );
12498
+ return;
12499
+ }
12500
+ }
12501
+ }
12502
+ }
12487
12503
 
12488
12504
  // src/translator/visitors/tag/index.ts
12489
12505
  var tag_default = {
@@ -12549,7 +12565,8 @@ var tag_default = {
12549
12565
  }
12550
12566
  }
12551
12567
  }
12552
- if (extra.tagNameDynamic && extra.tagNameNullable && !tag.get("name").isIdentifier() && isOutputHTML()) {
12568
+ const type = analyzeTagNameType(tag);
12569
+ if (extra.tagNameDynamic && extra.tagNameNullable && type === 0 /* NativeTag */ && !tag.get("name").isIdentifier() && isOutputHTML()) {
12553
12570
  const tagNameId = generateUidIdentifier("tagName");
12554
12571
  const [tagNameVarPath] = tag.insertBefore(
12555
12572
  import_compiler64.types.variableDeclaration("const", [
@@ -12559,7 +12576,7 @@ var tag_default = {
12559
12576
  tagNameVarPath.skip();
12560
12577
  tag.set("name", tagNameId);
12561
12578
  }
12562
- switch (extra.tagNameType) {
12579
+ switch (type) {
12563
12580
  case 0 /* NativeTag */:
12564
12581
  native_tag_default.translate.enter(tag);
12565
12582
  break;
@@ -12580,7 +12597,7 @@ var tag_default = {
12580
12597
  exit(translator.hook, tag);
12581
12598
  return;
12582
12599
  }
12583
- switch (tag.node.extra.tagNameType) {
12600
+ switch (analyzeTagNameType(tag)) {
12584
12601
  case 0 /* NativeTag */:
12585
12602
  native_tag_default.translate.exit(tag);
12586
12603
  break;
@@ -13,4 +13,4 @@ export declare enum TagNameType {
13
13
  DynamicTag = 2,
14
14
  AttributeTag = 3
15
15
  }
16
- export default function analyzeTagNameType(tag: t.NodePath<t.MarkoTag>): TagNameType;
16
+ export default function analyzeTagNameType(tag: t.NodePath<t.MarkoTag>, allowDynamic?: boolean): TagNameType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "6.0.101",
3
+ "version": "6.0.102",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",