@marko/runtime-tags 6.3.10 → 6.3.11

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 CHANGED
@@ -45,8 +45,7 @@ const knownWrongAttrs = {
45
45
  "v-text": "${text}"
46
46
  };
47
47
  function getWrongAttrSuggestion(name) {
48
- const exact = knownWrongAttrs[name];
49
- if (exact) return exact;
48
+ if (Object.hasOwn(knownWrongAttrs, name)) return knownWrongAttrs[name];
50
49
  const colon = name.indexOf(":");
51
50
  if (colon > 0) {
52
51
  const rest = name.slice(colon + 1);
@@ -799,7 +798,10 @@ function init(runtimeId = "M") {
799
798
  branch["#StartNode"] = startVisit;
800
799
  branch["#EndNode"] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
801
800
  }
802
- while (i && orphanBranches[--i]["#Id"] > branchId) setParentBranch(orphanBranches.pop(), branch);
801
+ while (i && orphanBranches[i - 1]["#Id"] > branchId) {
802
+ i--;
803
+ setParentBranch(orphanBranches.pop(), branch);
804
+ }
803
805
  while (j && deferredOwners[--j]["#Id"] > branchId) {
804
806
  const owner = deferredOwners.pop();
805
807
  if (owner["#ClosestBranch"] !== owner) owner["#ClosestBranch"] = branch;
@@ -1261,7 +1263,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
1261
1263
  for (const name in events) events[name] = 0;
1262
1264
  scope["ControlledType:" + nodeAccessor] = 5;
1263
1265
  scope["ControlledHandler:" + nodeAccessor] = 0;
1264
- switch (el.tagName) {
1266
+ switch (nextAttrs && el.tagName) {
1265
1267
  case "INPUT":
1266
1268
  if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
1267
1269
  _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
@@ -43,8 +43,7 @@ const knownWrongAttrs = {
43
43
  "v-text": "${text}"
44
44
  };
45
45
  function getWrongAttrSuggestion(name) {
46
- const exact = knownWrongAttrs[name];
47
- if (exact) return exact;
46
+ if (Object.hasOwn(knownWrongAttrs, name)) return knownWrongAttrs[name];
48
47
  const colon = name.indexOf(":");
49
48
  if (colon > 0) {
50
49
  const rest = name.slice(colon + 1);
@@ -797,7 +796,10 @@ function init(runtimeId = "M") {
797
796
  branch["#StartNode"] = startVisit;
798
797
  branch["#EndNode"] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
799
798
  }
800
- while (i && orphanBranches[--i]["#Id"] > branchId) setParentBranch(orphanBranches.pop(), branch);
799
+ while (i && orphanBranches[i - 1]["#Id"] > branchId) {
800
+ i--;
801
+ setParentBranch(orphanBranches.pop(), branch);
802
+ }
801
803
  while (j && deferredOwners[--j]["#Id"] > branchId) {
802
804
  const owner = deferredOwners.pop();
803
805
  if (owner["#ClosestBranch"] !== owner) owner["#ClosestBranch"] = branch;
@@ -1259,7 +1261,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs) {
1259
1261
  for (const name in events) events[name] = 0;
1260
1262
  scope["ControlledType:" + nodeAccessor] = 5;
1261
1263
  scope["ControlledHandler:" + nodeAccessor] = 0;
1262
- switch (el.tagName) {
1264
+ switch (nextAttrs && el.tagName) {
1263
1265
  case "INPUT":
1264
1266
  if ("checked" in nextAttrs || "checkedChange" in nextAttrs) {
1265
1267
  _attr_input_checked(scope, nodeAccessor, nextAttrs.checked, nextAttrs.checkedChange);
@@ -45,8 +45,7 @@ const knownWrongAttrs = {
45
45
  "v-text": "${text}"
46
46
  };
47
47
  function getWrongAttrSuggestion(name) {
48
- const exact = knownWrongAttrs[name];
49
- if (exact) return exact;
48
+ if (Object.hasOwn(knownWrongAttrs, name)) return knownWrongAttrs[name];
50
49
  const colon = name.indexOf(":");
51
50
  if (colon > 0) {
52
51
  const rest = name.slice(colon + 1);
@@ -2614,7 +2613,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2614
2613
  let result = "";
2615
2614
  let skip = /[\s/>"'=]/;
2616
2615
  let events;
2617
- switch (tagName) {
2616
+ switch (data && tagName) {
2618
2617
  case "input":
2619
2618
  assertExclusiveAttrs(data);
2620
2619
  if (data.checkedChange) {
@@ -3005,7 +3004,9 @@ var ServerRendered = class {
3005
3004
  boundary.onNext = NOOP$1;
3006
3005
  onAbort(boundary.signal.reason);
3007
3006
  } else if (write || status === 0) {
3008
- const html = (head = head.consume()).flushHTML();
3007
+ head = head.consume();
3008
+ if (boundary.signal.aborted) return;
3009
+ const html = head.flushHTML();
3009
3010
  if (html) onWrite(html);
3010
3011
  if (status === 0) {
3011
3012
  if (!tick) offTick(onNext);
@@ -43,8 +43,7 @@ const knownWrongAttrs = {
43
43
  "v-text": "${text}"
44
44
  };
45
45
  function getWrongAttrSuggestion(name) {
46
- const exact = knownWrongAttrs[name];
47
- if (exact) return exact;
46
+ if (Object.hasOwn(knownWrongAttrs, name)) return knownWrongAttrs[name];
48
47
  const colon = name.indexOf(":");
49
48
  if (colon > 0) {
50
49
  const rest = name.slice(colon + 1);
@@ -2612,7 +2611,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2612
2611
  let result = "";
2613
2612
  let skip = /[\s/>"'=]/;
2614
2613
  let events;
2615
- switch (tagName) {
2614
+ switch (data && tagName) {
2616
2615
  case "input":
2617
2616
  assertExclusiveAttrs(data);
2618
2617
  if (data.checkedChange) {
@@ -3003,7 +3002,9 @@ var ServerRendered = class {
3003
3002
  boundary.onNext = NOOP$1;
3004
3003
  onAbort(boundary.signal.reason);
3005
3004
  } else if (write || status === 0) {
3006
- const html = (head = head.consume()).flushHTML();
3005
+ head = head.consume();
3006
+ if (boundary.signal.aborted) return;
3007
+ const html = head.flushHTML();
3007
3008
  if (html) onWrite(html);
3008
3009
  if (status === 0) {
3009
3010
  if (!tick) offTick(onNext);
package/dist/dom.js CHANGED
@@ -508,7 +508,7 @@ function init(runtimeId = "M") {
508
508
  for (; startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling););
509
509
  branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "'" && (branch.a = startVisit);
510
510
  } else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
511
- for (; i && orphanBranches[--i].L > branchId;) setParentBranch(orphanBranches.pop(), branch);
511
+ for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
512
512
  for (; j && deferredOwners[--j].L > branchId;) {
513
513
  let owner = deferredOwners.pop();
514
514
  owner.F !== owner && (owner.F = branch);
@@ -828,7 +828,7 @@ function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
828
828
  function attrsInternal(scope, nodeAccessor, nextAttrs) {
829
829
  let el = scope[nodeAccessor], events = scope["I" + nodeAccessor], skip;
830
830
  for (let name in events) events[name] = 0;
831
- switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
831
+ switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, nextAttrs && el.tagName) {
832
832
  case "INPUT":
833
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)?$/);
834
834
  break;
package/dist/dom.mjs CHANGED
@@ -507,7 +507,7 @@ function init(runtimeId = "M") {
507
507
  for (; startVisit.previousSibling && ~visits.indexOf(startVisit = startVisit.previousSibling););
508
508
  branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "'" && (branch.a = startVisit);
509
509
  } else curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
510
- for (; i && orphanBranches[--i].L > branchId;) setParentBranch(orphanBranches.pop(), branch);
510
+ for (; i && orphanBranches[i - 1].L > branchId;) i--, setParentBranch(orphanBranches.pop(), branch);
511
511
  for (; j && deferredOwners[--j].L > branchId;) {
512
512
  let owner = deferredOwners.pop();
513
513
  owner.F !== owner && (owner.F = branch);
@@ -827,7 +827,7 @@ function _attrs_partial_content(scope, nodeAccessor, nextAttrs, skip) {
827
827
  function attrsInternal(scope, nodeAccessor, nextAttrs) {
828
828
  let el = scope[nodeAccessor], events = scope["I" + nodeAccessor], skip;
829
829
  for (let name in events) events[name] = 0;
830
- switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, el.tagName) {
830
+ switch (scope["F" + nodeAccessor] = 5, scope["E" + nodeAccessor] = 0, nextAttrs && el.tagName) {
831
831
  case "INPUT":
832
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)?$/);
833
833
  break;
package/dist/html.js CHANGED
@@ -1722,7 +1722,7 @@ function _attr_nullish(name, value, attr) {
1722
1722
  }
1723
1723
  function _attrs(data, nodeAccessor, scopeId, tagName) {
1724
1724
  let result = "", skip = /[\s/>"'=]/, events;
1725
- switch (tagName) {
1725
+ switch (data && tagName) {
1726
1726
  case "input":
1727
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/>"'=]/);
1728
1728
  break;
@@ -1960,7 +1960,8 @@ var ServerRendered = class {
1960
1960
  let status = boundary.flush();
1961
1961
  if (status === 2) tick || offTick(onNext), boundary.onNext = NOOP$1, onAbort(boundary.signal.reason);
1962
1962
  else if (write || status === 0) {
1963
- let html = (head = head.consume()).flushHTML();
1963
+ if (head = head.consume(), boundary.signal.aborted) return;
1964
+ let html = head.flushHTML();
1964
1965
  html && onWrite(html), status === 0 ? (tick || offTick(onNext), onClose()) : tick = !0;
1965
1966
  } else tick && (tick = !1, queueTick(onNext));
1966
1967
  };
package/dist/html.mjs CHANGED
@@ -1721,7 +1721,7 @@ function _attr_nullish(name, value, attr) {
1721
1721
  }
1722
1722
  function _attrs(data, nodeAccessor, scopeId, tagName) {
1723
1723
  let result = "", skip = /[\s/>"'=]/, events;
1724
- switch (tagName) {
1724
+ switch (data && tagName) {
1725
1725
  case "input":
1726
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/>"'=]/);
1727
1727
  break;
@@ -1959,7 +1959,8 @@ var ServerRendered = class {
1959
1959
  let status = boundary.flush();
1960
1960
  if (status === 2) tick || offTick(onNext), boundary.onNext = NOOP$1, onAbort(boundary.signal.reason);
1961
1961
  else if (write || status === 0) {
1962
- let html = (head = head.consume()).flushHTML();
1962
+ if (head = head.consume(), boundary.signal.aborted) return;
1963
+ let html = head.flushHTML();
1963
1964
  html && onWrite(html), status === 0 ? (tick || offTick(onNext), onClose()) : tick = !0;
1964
1965
  } else tick && (tick = !1, queueTick(onNext));
1965
1966
  };
@@ -233,8 +233,7 @@ const knownWrongAttrs = {
233
233
  "v-text": "${text}"
234
234
  };
235
235
  function getWrongAttrSuggestion(name) {
236
- const exact = knownWrongAttrs[name];
237
- if (exact) return exact;
236
+ if (Object.hasOwn(knownWrongAttrs, name)) return knownWrongAttrs[name];
238
237
  const colon = name.indexOf(":");
239
238
  if (colon > 0) {
240
239
  const rest = name.slice(colon + 1);
@@ -1156,8 +1155,8 @@ function analyzeExpressionTagName(name, extra) {
1156
1155
  pending.push(path.get("consequent"));
1157
1156
  if (path.node.alternate) pending.push(path.get("alternate"));
1158
1157
  } else if (path.isLogicalExpression()) {
1159
- if (path.node.operator === "||") pending.push(path.get("left"));
1160
- else nullable = true;
1158
+ if (path.node.operator === "&&") nullable = true;
1159
+ else pending.push(path.get("left"));
1161
1160
  pending.push(path.get("right"));
1162
1161
  } else if (path.isAssignmentExpression()) pending.push(path.get("right"));
1163
1162
  else if (path.isBinaryExpression()) type = path.node.operator !== "+" || type === void 0 || type === 0 ? 0 : 2;
@@ -1403,8 +1402,11 @@ function getCommonSection(section, other) {
1403
1402
  throw new Error("No common section");
1404
1403
  }
1405
1404
  function finalizeParamSerializeReasonGroups(section) {
1406
- if (isReasonDynamic(section.serializeReason)) for (const [paramSection, params] of groupParamsBySection(section.serializeReason.param)) ensureParamReasonGroup(paramSection, params);
1407
- for (const reason of section.serializeReasons.values()) if (isReasonDynamic(reason)) for (const [paramSection, params] of groupParamsBySection(reason.param)) ensureParamReasonGroup(paramSection, params);
1405
+ ensureReasonGroups(section.serializeReason);
1406
+ for (const reason of section.serializeReasons.values()) ensureReasonGroups(reason);
1407
+ }
1408
+ function ensureReasonGroups(reason) {
1409
+ if (isReasonDynamic(reason)) for (const [paramSection, params] of groupParamsBySection(reason.param)) ensureParamReasonGroup(paramSection, params);
1408
1410
  }
1409
1411
  function ensureParamReasonGroup(section, reason) {
1410
1412
  const { paramReasonGroups } = section;
@@ -1872,7 +1874,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
1872
1874
  let result = "";
1873
1875
  let skip = /[\s/>"'=]/;
1874
1876
  let events;
1875
- switch (tagName) {
1877
+ switch (data && tagName) {
1876
1878
  case "input":
1877
1879
  if (data.checkedChange) {
1878
1880
  result += _attr_input_checked(scopeId, nodeAccessor, data.checked, data.checkedChange, 1);
@@ -4329,7 +4331,7 @@ var native_tag_default = {
4329
4331
  }
4330
4332
  if (tagName === "option") assertOptionInSelectWithValue(tag);
4331
4333
  const isTextOnly = isTextOnlyNativeTag(tag);
4332
- const seen = {};
4334
+ const seen = Object.create(null);
4333
4335
  const { attributes } = tag.node;
4334
4336
  let injectNonce = isInjectNonceTag(tagName);
4335
4337
  let hasDynamicAttributes = false;
@@ -4713,7 +4715,7 @@ function getRelatedControllable(tagName, attrs) {
4713
4715
  }
4714
4716
  }
4715
4717
  function getUsedAttrs(tagName, tag) {
4716
- const seen = {};
4718
+ const seen = Object.create(null);
4717
4719
  const { attributes } = tag;
4718
4720
  const maybeStaticAttrs = /* @__PURE__ */ new Set();
4719
4721
  const skipProps = /* @__PURE__ */ new Set();
@@ -8193,12 +8195,14 @@ var script_default = {
8193
8195
  let referencesScope = false;
8194
8196
  if (isFunction) if (value.async || value.generator) referencesScope = traverseContains(value, isScopeIdentifier);
8195
8197
  else if (_marko_compiler.types.isBlockStatement(value.body)) {
8196
- let hasDeclaration = false;
8197
- for (const child of value.body.body) if (_marko_compiler.types.isDeclaration(child)) {
8198
- hasDeclaration = true;
8199
- break;
8198
+ if (!traverseContains(value.body, isReturnStatement)) {
8199
+ let hasDeclaration = false;
8200
+ for (const child of value.body.body) if (_marko_compiler.types.isDeclaration(child)) {
8201
+ hasDeclaration = true;
8202
+ break;
8203
+ }
8204
+ inlineBody = hasDeclaration ? value.body : value.body.body;
8200
8205
  }
8201
- inlineBody = hasDeclaration ? value.body : value.body.body;
8202
8206
  } else inlineBody = _marko_compiler.types.expressionStatement(value.body);
8203
8207
  addStatement("effect", section, referencedBindings, inlineBody || _marko_compiler.types.expressionStatement(_marko_compiler.types.callExpression(value, referencesScope ? [scopeIdentifier] : [])));
8204
8208
  } else addHTMLEffectCall(section, referencedBindings);
@@ -8227,6 +8231,18 @@ function isAwaitExpression(node) {
8227
8231
  default: return false;
8228
8232
  }
8229
8233
  }
8234
+ function isReturnStatement(node) {
8235
+ switch (node.type) {
8236
+ case "FunctionDeclaration":
8237
+ case "FunctionExpression":
8238
+ case "ArrowFunctionExpression":
8239
+ case "ClassMethod":
8240
+ case "ObjectMethod":
8241
+ case "ClassPrivateMethod": return skip;
8242
+ case "ReturnStatement": return true;
8243
+ default: return false;
8244
+ }
8245
+ }
8230
8246
  //#endregion
8231
8247
  //#region src/translator/core/server.ts
8232
8248
  var server_default = {
@@ -9817,6 +9833,7 @@ function getFeatureTypeFromCoreTagName(tagName) {
9817
9833
  case "lifecycle":
9818
9834
  case "log":
9819
9835
  case "return":
9836
+ case "show":
9820
9837
  case "try": return "tags";
9821
9838
  default: return;
9822
9839
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "6.3.10",
3
+ "version": "6.3.11",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",