marko 6.3.53 → 6.3.55

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.
Files changed (79) hide show
  1. package/cheatsheet.md +1 -0
  2. package/dist/common/constants/renderer-prop.d.ts +0 -1
  3. package/dist/common/constants/renderer-prop.debug.d.ts +0 -1
  4. package/dist/common/helpers.d.ts +1 -0
  5. package/dist/debug/dom/catch.feat.js +1 -1
  6. package/dist/debug/dom/catch.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-input.feat.js +1 -1
  8. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-open.feat.js +1 -1
  10. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable-select.feat.js +1 -1
  12. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable.feat.js +1 -1
  16. package/dist/debug/dom/controllable.feat.mjs +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  18. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  19. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  20. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  21. package/dist/debug/dom/placeholder.feat.js +1 -1
  22. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  23. package/dist/debug/{dom-CBLlE8L-.js → dom-CI0Vojyk.js} +119 -78
  24. package/dist/debug/{dom-DQCODUa1.mjs → dom-tl43c2wO.mjs} +102 -79
  25. package/dist/debug/dom.js +9 -7
  26. package/dist/debug/dom.mjs +7 -8
  27. package/dist/debug/html.js +51 -25
  28. package/dist/debug/html.mjs +51 -25
  29. package/dist/dom/catch.feat.js +4 -4
  30. package/dist/dom/catch.feat.mjs +1 -1
  31. package/dist/dom/control-flow.d.ts +4 -1
  32. package/dist/dom/controllable-input.feat.js +2 -2
  33. package/dist/dom/controllable-input.feat.mjs +1 -1
  34. package/dist/dom/controllable-open.feat.js +2 -2
  35. package/dist/dom/controllable-open.feat.mjs +1 -1
  36. package/dist/dom/controllable-select.feat.js +2 -2
  37. package/dist/dom/controllable-select.feat.mjs +1 -1
  38. package/dist/dom/controllable-textarea.feat.js +2 -2
  39. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  40. package/dist/dom/controllable.feat.js +2 -2
  41. package/dist/dom/controllable.feat.mjs +1 -1
  42. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  43. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  44. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  45. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  46. package/dist/dom/load.d.ts +2 -2
  47. package/dist/dom/placeholder.feat.js +3 -3
  48. package/dist/dom/placeholder.feat.mjs +1 -1
  49. package/dist/dom/renderer.d.ts +2 -3
  50. package/dist/dom/signals.d.ts +1 -1
  51. package/dist/{dom-z4IMlmeO.mjs → dom-4udEPZaj.mjs} +71 -58
  52. package/dist/{dom-vuB05Hnj.js → dom-C1mr-TA7.js} +199 -176
  53. package/dist/dom.d.ts +1 -1
  54. package/dist/dom.js +40 -42
  55. package/dist/dom.mjs +6 -8
  56. package/dist/html/dynamic-tag.d.ts +2 -1
  57. package/dist/html/serializer.d.ts +3 -2
  58. package/dist/html/writer.d.ts +6 -5
  59. package/dist/html.js +34 -19
  60. package/dist/html.mjs +34 -19
  61. package/dist/translator/index.js +2890 -2688
  62. package/dist/translator/util/binding-has-prop.d.ts +1 -0
  63. package/dist/translator/util/branch-tag.d.ts +6 -1
  64. package/dist/translator/util/optional.d.ts +2 -0
  65. package/dist/translator/util/references.d.ts +20 -9
  66. package/dist/translator/util/runtime.d.ts +1 -0
  67. package/dist/translator/util/sections.d.ts +11 -6
  68. package/dist/translator/util/serialize-guard.d.ts +1 -1
  69. package/dist/translator/util/serialize-reasons.d.ts +3 -0
  70. package/dist/translator/util/set-tag-sections-downstream.d.ts +1 -1
  71. package/dist/translator/util/signals.d.ts +4 -1
  72. package/dist/translator/util/structure.d.ts +1 -1
  73. package/dist/translator/util/tag-name-type.d.ts +1 -1
  74. package/dist/translator/visitors/function.d.ts +1 -0
  75. package/dist/translator/visitors/import-declaration.d.ts +1 -0
  76. package/dist/translator/visitors/tag/custom-tag.d.ts +5 -0
  77. package/package.json +4 -4
  78. package/tags/try.d.marko +2 -0
  79. package/tags-html.d.ts +6 -0
package/dist/html.mjs CHANGED
@@ -247,7 +247,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
247
247
  }, unsafeQuoteReg = /["\\<\n\r\u2028\u2029\0\ud800-\udfff]/u, $chunk, kPendingContexts = Symbol("Pending Contexts"), kBranchId = Symbol("Branch Id"), kIsAsync = Symbol("Is Async"), writeScope = (scopeId, partialScope) => {
248
248
  let { state } = $chunk.boundary, target = $chunk.serializeState, scope = scopeWithId(state, scopeId), pending = target.writeScopes[scopeId];
249
249
  return state.needsMainRuntime = !0, countResumeWrite($chunk.boundary), Object.assign(scope, partialScope), pending && pending !== partialScope ? Object.assign(pending, partialScope) : target.writeScopes[scopeId] = partialScope, target.flushScopes = !0, scope;
250
- }, CLIENT_ALL = 715827882, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/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) => {
250
+ }, CLIENT_ALL = 715827883, NOOP$2 = () => {}, tick = globalThis.setImmediate || globalThis.setTimeout || globalThis.queueMicrotask || ((cb) => Promise.resolve().then(cb)), tickQueue, kSelectedValue = Symbol("selectedValue"), checkedValuesRefs = /* @__PURE__ */ new WeakMap(), singleQuoteAttrReplacements = /['\r]|&(?=[#a-zA-Z])/g, doubleQuoteAttrReplacements = /["\r]|&(?=[#a-zA-Z])/g, needsQuotedAttr = /["'>\s]|&[#a-zA-Z]|\/$/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) => {
251
251
  let shouldResume = serializeReason !== 0, renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = _peek_scope_id(), rendered, result;
252
252
  if (typeof renderer == "string") {
253
253
  let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
@@ -428,6 +428,10 @@ function isEventHandler(name) {
428
428
  function getEventHandlerName(name) {
429
429
  return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
430
430
  }
431
+ function hasKeys(obj) {
432
+ for (let _ in obj) return !0;
433
+ return !1;
434
+ }
431
435
  function isVoid(value) {
432
436
  return value == null || value === !1;
433
437
  }
@@ -530,10 +534,11 @@ var State$1 = class {
530
534
  });
531
535
  }
532
536
  };
533
- function register(id, val, scope) {
537
+ function register(id, val, scope, locals) {
534
538
  return REGISTRY.set(val, {
535
539
  id,
536
540
  scope,
541
+ locals,
537
542
  access: "_._" + toAccess(toObjectKey(id))
538
543
  }), val;
539
544
  }
@@ -641,13 +646,22 @@ function newScopeReference(state, val, scopeId) {
641
646
  let ref = new Reference(null, null, state.flushId);
642
647
  return ref.scopeId = scopeId, ref.channel = state.channel, state.refs.set(val, ref), ref;
643
648
  }
649
+ function quoteRegisterId(id) {
650
+ return "\"" + id + "\"";
651
+ }
644
652
  function writeRegistered(state, val, parent, accessor, registered) {
645
653
  let { scope } = registered;
646
654
  if (scope) {
647
655
  let ref = new Reference(parent, accessor, state.flushId, state.buf.length);
648
656
  ref.channel = state.channel, state.refs.set(val, ref);
649
657
  let scopeId = scope[K_SCOPE_ID];
650
- trackScope(state, scope, scopeId), state.buf.push("_(" + scopeId + "," + quote(registered.id, 0) + ")");
658
+ trackScope(state, scope, scopeId);
659
+ let locals = registered.locals?.(state.boundary.state.scope);
660
+ if (locals) {
661
+ state.buf.push(registered.access + "(_(" + scopeId + ")");
662
+ for (let local of locals) state.buf.push(","), local ? writePlainObject(state, local, new Reference(ref, null, state.flushId, state.buf.length)) : state.buf.push("0");
663
+ } else state.buf.push("_(" + scopeId + "," + quoteRegisterId(registered.id));
664
+ state.buf.push(")");
651
665
  } else state.buf.push(registered.access);
652
666
  return !0;
653
667
  }
@@ -1331,8 +1345,8 @@ function _script(scopeId, registryId, serializeMarker) {
1331
1345
  function _trailers(html) {
1332
1346
  $chunk.boundary.state.trailerHTML += html;
1333
1347
  }
1334
- function _resume(val, id, scopeId) {
1335
- return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
1348
+ function _resume(val, id, scopeId, locals) {
1349
+ return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId), locals);
1336
1350
  }
1337
1351
  function _resume_locals(val, id, locals, ownerScopeId) {
1338
1352
  return ownerScopeId !== void 0 && (locals._ = _scope_with_id(ownerScopeId)), register(id, val, writeScope(_scope_id(), locals));
@@ -1470,15 +1484,15 @@ function scopeWithId(state, scopeId) {
1470
1484
  let { scopes } = state, scope = scopes.get(scopeId);
1471
1485
  return scope || scopes.set(scopeId, scope = { [K_SCOPE_ID]: scopeId }), scope;
1472
1486
  }
1473
- function _subscribe(subscribers, scope) {
1487
+ function _subscribe(subscribers, scope, resumeId, serializeMarker) {
1474
1488
  if (subscribers) {
1475
1489
  let { serializer } = $chunk.boundary.state;
1476
- !$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
1490
+ !$chunk.serializeState.readyId && !serializer.written(subscribers) ? subscribers.add(scope) : resumeId ? _script(scope[K_SCOPE_ID], resumeId, serializeMarker) : serializer.writeCall(scope, subscribers, "add", $chunk.serializeState);
1477
1491
  }
1478
1492
  return scope;
1479
1493
  }
1480
1494
  function maskGroup(mask, group) {
1481
- return mask === 715827882 ? 1 : typeof mask == "number" ? mask >>> 1 + 2 * group & 3 : mask[group] ?? 0;
1495
+ return mask === 715827883 ? 1 : typeof mask == "number" ? group < 15 ? mask >>> 1 + 2 * group & 3 : 0 : mask[group] ?? 0;
1482
1496
  }
1483
1497
  function _set_serialize_reason(reason) {
1484
1498
  $chunk.boundary.state.serializeReason = reason;
@@ -1599,6 +1613,7 @@ var State = class {
1599
1613
  serializer = new Serializer();
1600
1614
  writeReorders = null;
1601
1615
  scopes = /* @__PURE__ */ new Map();
1616
+ scope = (scopeId) => scopeWithId(this, scopeId);
1602
1617
  flushScopes = !1;
1603
1618
  writeScopes = {};
1604
1619
  readyIds = null;
@@ -1737,15 +1752,15 @@ var State = class {
1737
1752
  $chunk = prev;
1738
1753
  }
1739
1754
  }
1740
- flushReadyScripts(reservations) {
1755
+ flushReadyScripts(reservations, holdEffects) {
1741
1756
  let { boundary, serializeState } = this, { readyId } = serializeState, scripts = "";
1742
1757
  if (forEach(this.takeDeferredReady(), (chunk) => {
1743
- scripts = concatScripts(scripts, chunk.flushReadyScripts(reservations));
1758
+ scripts = concatScripts(scripts, chunk.flushReadyScripts(reservations, holdEffects)), (chunk.effects || chunk.deferredReady) && (this.deferredReady = push(this.deferredReady, chunk));
1744
1759
  }), readyId && !this.async) {
1745
1760
  let { state } = boundary;
1746
1761
  flushSerializer(boundary, serializeState);
1747
- let deps = state.serializer.takeChannelDeps(), { effects } = this, { resumes } = serializeState, chunkScripts = this.scripts;
1748
- if (serializeState.resumes = "", this.effects = this.scripts = "", this.lastEffect = "", resumes || effects) {
1762
+ let deps = state.serializer.takeChannelDeps(), effects = holdEffects ? "" : this.effects, { resumes } = serializeState, chunkScripts = this.scripts;
1763
+ if (serializeState.resumes = this.scripts = "", effects && (this.effects = this.lastEffect = ""), resumes || effects) {
1749
1764
  state.needsMainRuntime = !0;
1750
1765
  let batch = concatSequence(depsMarker(deps), concatSequence(resumes, effects && `"${effects}"`));
1751
1766
  if (reservations) {
@@ -1760,7 +1775,7 @@ var State = class {
1760
1775
  flushScript() {
1761
1776
  let { boundary } = this, { state } = boundary, { $global, runtimePrefix } = state, needsWalk = state.walkOnNextFlush;
1762
1777
  needsWalk && (state.walkOnNextFlush = !1);
1763
- let readyResumeScripts = this.flushReadyScripts();
1778
+ let readyResumeScripts = this.flushReadyScripts(void 0, this.async);
1764
1779
  for (let channel; channel = state.serializer.pendingReadyChannel();) {
1765
1780
  let resumes = state.serializer.stringifyScopes([], boundary, channel), deps = state.serializer.takeChannelDeps();
1766
1781
  state.needsMainRuntime = !0, readyResumeScripts = concatScripts(readyResumeScripts, state.writeReady(channel.readyId, concatSequence(depsMarker(deps), resumes)));
@@ -1785,11 +1800,11 @@ var State = class {
1785
1800
  let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
1786
1801
  for (reorderedChunk.reorderId = null;;) {
1787
1802
  cur.flushPlaceholder(), cur.deferOwnReady();
1788
- let { next } = cur, readyResumeScripts = cur.flushReadyScripts(readyReservations);
1789
- if (cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts)), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), state.reorder(cur), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next) cur = next;
1803
+ let { next } = cur, readyResumeScripts = cur.flushReadyScripts(readyReservations, this.async);
1804
+ if (this.deferredReady = concat(this.deferredReady, cur.takeDeferredReady()), cur.consumed = !0, reorderHTML += cur.html, reorderEffects = concatEffects(reorderEffects, cur.effects), reorderScripts = concatScripts(reorderScripts, concatScripts(readyResumeScripts, cur.scripts)), cur.async && (reorderHTML += state.mark("#", cur.reorderId = state.nextReorderId()), state.reorder(cur), cur.html = cur.effects = cur.scripts = cur.lastEffect = "", cur.next = null), next) cur = next;
1790
1805
  else break;
1791
1806
  }
1792
- reorderEffects && (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")"));
1807
+ reorderEffects && (this.async ? (this.effects = concatEffects(this.effects, reorderEffects), this.lastEffect = "") : (needsResumeArray = !0, reorderScripts = concatScripts(reorderScripts, "_.push(\"" + reorderEffects + "\")")));
1793
1808
  for (let reservation of readyReservations) reordered = concatScripts(reordered, reservation);
1794
1809
  reordered = concatScripts(reordered, reorderScripts && runtimePrefix + ".j" + toAccess(reorderId) + "=_=>{" + reorderScripts + "}"), html += "<t hidden " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
1795
1810
  }
@@ -1823,7 +1838,7 @@ function flushSerializer(boundary, serializeState) {
1823
1838
  }
1824
1839
  for (let key in writeScopes) {
1825
1840
  let scopeId = +key, props = writeScopes[scopeId];
1826
- Object.getOwnPropertyNames(props).length && flushes.push([
1841
+ hasKeys(props) && flushes.push([
1827
1842
  scopeId,
1828
1843
  state.scopes.get(scopeId),
1829
1844
  props
@@ -2049,8 +2064,8 @@ function normalizeStrAttrValue(value) {
2049
2064
  function _content(id, fn, scopeId) {
2050
2065
  return fn.a = id, fn.e = scopeId, fn;
2051
2066
  }
2052
- function _content_resume(id, fn, scopeId) {
2053
- return _resume(_content(id, fn, scopeId), id, scopeId);
2067
+ function _content_resume(id, fn, scopeId, locals) {
2068
+ return _resume(_content(id, fn, scopeId), id, scopeId, locals);
2054
2069
  }
2055
2070
  //#endregion
2056
2071
  //#region src/html/template.ts