marko 6.3.51 → 6.3.53

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 (73) hide show
  1. package/dist/debug/dom/catch.feat.js +1 -1
  2. package/dist/debug/dom/catch.feat.mjs +1 -1
  3. package/dist/debug/dom/controllable-input.feat.js +1 -1
  4. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  5. package/dist/debug/dom/controllable-open.feat.js +1 -1
  6. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  7. package/dist/debug/dom/controllable-select.feat.js +1 -1
  8. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  9. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  10. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  11. package/dist/debug/dom/controllable.feat.js +1 -1
  12. package/dist/debug/dom/controllable.feat.mjs +1 -1
  13. package/dist/debug/dom/dynamic-tag-script.feat.js +5 -0
  14. package/dist/debug/dom/dynamic-tag-script.feat.mjs +4 -0
  15. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -4
  16. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -4
  17. package/dist/debug/dom/placeholder.feat.js +2 -2
  18. package/dist/debug/dom/placeholder.feat.mjs +2 -2
  19. package/dist/debug/{dom-BAGeiafn.js → dom-CBLlE8L-.js} +46 -34
  20. package/dist/debug/{dom-C55iHvof.mjs → dom-DQCODUa1.mjs} +29 -23
  21. package/dist/debug/dom.js +11 -11
  22. package/dist/debug/dom.mjs +10 -10
  23. package/dist/debug/html.js +57 -41
  24. package/dist/debug/html.mjs +57 -41
  25. package/dist/dom/catch.feat.js +1 -1
  26. package/dist/dom/catch.feat.mjs +1 -1
  27. package/dist/dom/control-flow.d.ts +1 -3
  28. package/dist/dom/controllable-input.feat.js +1 -1
  29. package/dist/dom/controllable-input.feat.mjs +1 -1
  30. package/dist/dom/controllable-open.feat.js +1 -1
  31. package/dist/dom/controllable-open.feat.mjs +1 -1
  32. package/dist/dom/controllable-select.feat.js +1 -1
  33. package/dist/dom/controllable-select.feat.mjs +1 -1
  34. package/dist/dom/controllable-textarea.feat.js +1 -1
  35. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  36. package/dist/dom/controllable.feat.js +1 -1
  37. package/dist/dom/controllable.feat.mjs +1 -1
  38. package/dist/dom/dynamic-tag-script.feat.d.ts +1 -0
  39. package/dist/dom/dynamic-tag-script.feat.js +4 -0
  40. package/dist/dom/dynamic-tag-script.feat.mjs +4 -0
  41. package/dist/dom/dynamic-tag-var.feat.js +2 -2
  42. package/dist/dom/dynamic-tag-var.feat.mjs +3 -3
  43. package/dist/dom/placeholder.feat.js +2 -2
  44. package/dist/dom/placeholder.feat.mjs +2 -2
  45. package/dist/dom/resume.d.ts +2 -2
  46. package/dist/{dom-BNmfm4st.js → dom-vuB05Hnj.js} +37 -30
  47. package/dist/{dom-BsAS26Ze.mjs → dom-z4IMlmeO.mjs} +21 -19
  48. package/dist/dom.d.ts +2 -2
  49. package/dist/dom.js +15 -15
  50. package/dist/dom.mjs +10 -10
  51. package/dist/html/template.d.ts +3 -1
  52. package/dist/html/writer.d.ts +6 -1
  53. package/dist/html.js +41 -26
  54. package/dist/html.mjs +41 -26
  55. package/dist/translator/core/await.d.ts +0 -7
  56. package/dist/translator/core/try.d.ts +0 -7
  57. package/dist/translator/index.d.ts +1 -1
  58. package/dist/translator/index.js +830 -596
  59. package/dist/translator/util/binding-has-prop.d.ts +1 -1
  60. package/dist/translator/util/cyclic-memo.d.ts +4 -0
  61. package/dist/translator/util/evaluate.d.ts +2 -0
  62. package/dist/translator/util/optional.d.ts +21 -7
  63. package/dist/translator/util/references.d.ts +58 -23
  64. package/dist/translator/util/runtime.d.ts +3 -1
  65. package/dist/translator/util/sections.d.ts +8 -11
  66. package/dist/translator/util/serialize-guard.d.ts +4 -0
  67. package/dist/translator/util/serialize-reasons.d.ts +10 -11
  68. package/dist/translator/util/set-tag-sections-downstream.d.ts +3 -2
  69. package/dist/translator/util/tag-name-type.d.ts +8 -3
  70. package/dist/translator/visitors/tag/dynamic-tag.d.ts +0 -2
  71. package/index.d.ts +0 -5
  72. package/package.json +4 -4
  73. package/tags-html.d.ts +2 -0
@@ -1,7 +1,9 @@
1
- import { RendererProp, type Template } from "../common/types";
1
+ import { type RenderedTemplate, RendererProp, type Template, type TemplateInput } from "../common/types";
2
+ import { State } from "./writer";
2
3
  export type ServerRenderer = ((...args: unknown[]) => unknown) & {
3
4
  [RendererProp.Id]?: string;
4
5
  [RendererProp.Owner]?: number;
5
6
  [RendererProp.Embed]?: boolean;
6
7
  };
7
8
  export declare const _template: (templateId: string, renderer: ServerRenderer, page?: 1) => Template;
9
+ export declare function startRender(template: Template & ServerRenderer, input: TemplateInput, StateClass: typeof State): RenderedTemplate;
@@ -67,7 +67,9 @@ export { writeScope as _scope };
67
67
  export declare function _existing_scope(scopeId: number): ScopeInternals;
68
68
  export declare function _scope_with_id(scopeId: number): ScopeInternals;
69
69
  export declare function _subscribe(subscribers: Set<ScopeInternals> | undefined, scope: ScopeInternals): ScopeInternals;
70
- export type SerializeReasonValue = undefined | number | Partial<Record<string, 0 | 1>>;
70
+ export type SerializeReasonValue = undefined | number | Partial<Record<string, number>>;
71
+ export declare const CLIENT_ALL = 715827882;
72
+ export declare function maskGroup(mask: SerializeReasonValue, group: number): number;
71
73
  export declare function _set_serialize_reason(reason: SerializeReasonValue): void;
72
74
  export declare function _scope_reason(): SerializeReasonValue;
73
75
  export declare function _serialize_if(condition: SerializeReasonValue, key: number): 1 | undefined;
@@ -114,6 +116,9 @@ export declare class State implements SerializeState {
114
116
  renderId: string;
115
117
  runtimeId: string;
116
118
  });
119
+ flushChunk(html: string, scripts: string, pending: number): string;
120
+ walkScript(): string;
121
+ resumeScript(resumes: string): string;
117
122
  get runtimePrefix(): string;
118
123
  get commentPrefix(): string;
119
124
  reorder(chunk: Chunk): void;
package/dist/html.js 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
- }, 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 = 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) => {
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) || {};
@@ -263,11 +263,11 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
263
263
  }
264
264
  let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
265
265
  needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
266
- })(), result = _el(branchId, "_e");
266
+ })(), result = _el(scopeId, "-" + accessor);
267
267
  } else {
268
268
  let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
269
269
  if (renderer) try {
270
- return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? 1 : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
270
+ return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
271
271
  ...inputOrArgs,
272
272
  content
273
273
  } : inputOrArgs);
@@ -357,7 +357,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
357
357
  let scopeId = _peek_scope_id();
358
358
  writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
359
359
  }
360
- _set_serialize_reason(+!!willRerender);
360
+ _set_serialize_reason(willRerender ? CLIENT_ALL : 0);
361
361
  try {
362
362
  renderer(normalizedInput);
363
363
  } finally {
@@ -496,6 +496,7 @@ var State$1 = class {
496
496
  flushId;
497
497
  pos;
498
498
  id;
499
+ path = null;
499
500
  constructor(parent, accessor, flushId, pos = null, id = null) {
500
501
  this.parent = parent, this.accessor = accessor, this.flushId = flushId, this.pos = pos, this.id = id;
501
502
  }
@@ -629,7 +630,7 @@ function writeProp(state, val, parent, accessor) {
629
630
  }
630
631
  function writeReferenceOr(state, write, val, parent, accessor) {
631
632
  let ref = state.refs.get(val);
632
- if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.pendingAssignments.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (state.buf.push(ensureId(state, ref)), !0) : !1;
633
+ if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.pendingAssignments.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (writeRef(state, ref), !0) : !1;
633
634
  let registered = REGISTRY.get(val);
634
635
  return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.flushId, state.buf.length)), ref.channel = state.channel, write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
635
636
  }
@@ -655,7 +656,7 @@ function writeString(state, val, parent, accessor) {
655
656
  if (val.length > 12) {
656
657
  let ref = state.strs.get(val);
657
658
  if (ref) {
658
- if (trackChannel(state, ref)) return state.buf.push(ensureId(state, ref)), !0;
659
+ if (trackChannel(state, ref)) return writeRef(state, ref), !0;
659
660
  } else {
660
661
  let ref = new Reference(parent, accessor, state.flushId, state.buf.length);
661
662
  ref.channel = state.channel, state.strs.set(val, ref);
@@ -1134,6 +1135,9 @@ function quote(str, startPos) {
1134
1135
  }
1135
1136
  return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
1136
1137
  }
1138
+ function writeRef(state, ref) {
1139
+ ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId, ref.channel = state.channel, state.buf.push(ref.path)) : state.buf.push(ensureId(state, ref));
1140
+ }
1137
1141
  function ensureId(state, ref) {
1138
1142
  return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : assignId(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
1139
1143
  }
@@ -1143,23 +1147,18 @@ function accessId(state, ref) {
1143
1147
  }
1144
1148
  function assignId(state, ref) {
1145
1149
  let { pos } = ref;
1146
- if (ref.id = nextRefAccess(state), pos !== null && ref.flushId === state.flushId) return pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id;
1147
- ref.channel = state.channel;
1150
+ return ref.id = nextRefAccess(state), pos !== null && ref.flushId === state.flushId ? (pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id) : (ref.channel = state.channel, ref.id + "=" + (ref.path || accessPath(state, ref)));
1151
+ }
1152
+ function accessPath(state, ref) {
1148
1153
  let cur = ref, accessPrevValue = "";
1149
1154
  do {
1150
1155
  accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
1151
1156
  let parent = cur.parent;
1152
- if (parent.id && (trackChannel(state, parent) || !parent.parent)) {
1153
- accessPrevValue = parent.id + accessPrevValue;
1154
- break;
1155
- }
1156
- if (parent.flushId === state.flushId || parent.scopeId !== void 0) {
1157
- accessPrevValue = accessId(state, parent) + accessPrevValue;
1158
- break;
1159
- }
1157
+ if (parent.id && (trackChannel(state, parent) || !parent.parent)) return parent.id + accessPrevValue;
1158
+ if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
1160
1159
  cur = parent;
1161
1160
  } while (cur);
1162
- return ref.id + "=" + accessPrevValue;
1161
+ return accessPrevValue;
1163
1162
  }
1164
1163
  function assignmentsToString(assignments, value) {
1165
1164
  return assignments.length > 100 ? "($=>(" + assignments.join("=$,") + "=$))(" + value + ")" : assignments.join("=") + "=" + value;
@@ -1479,6 +1478,9 @@ function _subscribe(subscribers, scope) {
1479
1478
  }
1480
1479
  return scope;
1481
1480
  }
1481
+ function maskGroup(mask, group) {
1482
+ return mask === 715827882 ? 1 : typeof mask == "number" ? mask >>> 1 + 2 * group & 3 : mask[group] ?? 0;
1483
+ }
1482
1484
  function _set_serialize_reason(reason) {
1483
1485
  $chunk.boundary.state.serializeReason = reason;
1484
1486
  }
@@ -1487,7 +1489,7 @@ function _scope_reason() {
1487
1489
  return $chunk.boundary.state.serializeReason = void 0, reason;
1488
1490
  }
1489
1491
  function _serialize_if(condition, key) {
1490
- return condition && (condition === 1 || (typeof condition == "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
1492
+ return condition && maskGroup(condition, key) ? 1 : void 0;
1491
1493
  }
1492
1494
  function _serialize_guard(condition, key) {
1493
1495
  return _serialize_if(condition, key) || 0;
@@ -1606,6 +1608,16 @@ var State = class {
1606
1608
  constructor($global) {
1607
1609
  this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
1608
1610
  }
1611
+ flushChunk(html, scripts, pending) {
1612
+ let { $global, nonceAttr } = this, { __flush__ } = $global;
1613
+ return scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), pending ? html : html + this.trailerHTML;
1614
+ }
1615
+ walkScript() {
1616
+ return this.runtimePrefix + ".w()";
1617
+ }
1618
+ resumeScript(resumes) {
1619
+ return this.hasWrittenResume ? this.runtimePrefix + ".r.push(" + resumes + ")" : (this.hasWrittenResume = !0, this.runtimePrefix + ".r=[" + resumes + "]");
1620
+ }
1609
1621
  get runtimePrefix() {
1610
1622
  let { $global } = this;
1611
1623
  return $global.runtimeId + "." + $global.renderId;
@@ -1685,7 +1697,7 @@ var State = class {
1685
1697
  this.scripts = concatScripts(this.scripts, script);
1686
1698
  }
1687
1699
  append(chunk) {
1688
- this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
1700
+ this.html += chunk.html, this.needsWalk ||= chunk.needsWalk, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
1689
1701
  }
1690
1702
  takeDeferredReady() {
1691
1703
  let { deferredReady } = this;
@@ -1784,13 +1796,13 @@ var State = class {
1784
1796
  }
1785
1797
  state.writeReorders = carried;
1786
1798
  }
1787
- return flushSerializer(boundary, state), state.resumes ? state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]")) : needsResumeArray && !state.hasWrittenResume && (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[]")), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
1799
+ return flushSerializer(boundary, state), (state.resumes || needsResumeArray && !state.hasWrittenResume) && (scripts = concatScripts(scripts, state.resumeScript(state.resumes))), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, state.walkScript())), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
1788
1800
  }
1789
1801
  flushHTML() {
1790
1802
  let { boundary } = this, { state } = boundary;
1791
1803
  this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
1792
- let { scripts } = this, { $global, nonceAttr } = state, { __flush__ } = $global, { html } = this;
1793
- return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), boundary.count || (html += state.trailerHTML), html;
1804
+ let { html, scripts } = this;
1805
+ return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
1794
1806
  }
1795
1807
  };
1796
1808
  function flushSerializer(boundary, serializeState) {
@@ -2044,17 +2056,20 @@ function _content_resume(id, fn, scopeId) {
2044
2056
  //#endregion
2045
2057
  //#region src/html/template.ts
2046
2058
  function render(input = {}) {
2059
+ return startRender(this, input, State);
2060
+ }
2061
+ function startRender(template, input, StateClass) {
2047
2062
  let { $global } = input;
2048
2063
  $global ? ({$global, ...input} = input, $global = {
2049
2064
  runtimeId: "M",
2050
- renderId: getDefaultRenderId(this),
2065
+ renderId: getDefaultRenderId(template),
2051
2066
  ...$global
2052
2067
  }) : $global = {
2053
2068
  runtimeId: "M",
2054
- renderId: getDefaultRenderId(this)
2069
+ renderId: getDefaultRenderId(template)
2055
2070
  };
2056
- let state = new State($global), head = new Chunk(new Boundary(state, $global.signal), null, null, state);
2057
- return this.i ? head.render(() => writeWaitReady(this.a, this, input)) : head.render(this, input), new ServerRendered(head);
2071
+ let state = new StateClass($global), head = new Chunk(new Boundary(state, $global.signal), null, null, state);
2072
+ return template.i ? head.render(() => writeWaitReady(template.a, template, input)) : head.render(template, input), new ServerRendered(head);
2058
2073
  }
2059
2074
  function getDefaultRenderId(template) {
2060
2075
  if (template.i) {
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
- }, 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 = 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) => {
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) || {};
@@ -263,11 +263,11 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
263
263
  }
264
264
  let childScope = getScopeById(branchId), needsScript = childScope && (childScope.Ia || childScope.Ea);
265
265
  needsScript && _script(branchId, "_d"), (shouldResume || needsScript) && _html(state.mark("(", scopeId + " " + accessor + " " + branchId));
266
- })(), result = _el(branchId, "_e");
266
+ })(), result = _el(scopeId, "-" + accessor);
267
267
  } else {
268
268
  let chunk = getChunk(), beforeBranch = shouldResume ? deferBranchStart(chunk) : void 0, render = () => {
269
269
  if (renderer) try {
270
- return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? 1 : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
270
+ return _set_serialize_reason(shouldResume && inputOrArgs !== void 0 ? CLIENT_ALL : 0), inputIsArgs ? renderer(...inputOrArgs) : renderer(content ? {
271
271
  ...inputOrArgs,
272
272
  content
273
273
  } : inputOrArgs);
@@ -357,7 +357,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
357
357
  let scopeId = _peek_scope_id();
358
358
  writeScope(scopeId, { m5c: component.id }), _script(scopeId, SET_SCOPE_REGISTER_ID);
359
359
  }
360
- _set_serialize_reason(+!!willRerender);
360
+ _set_serialize_reason(willRerender ? CLIENT_ALL : 0);
361
361
  try {
362
362
  renderer(normalizedInput);
363
363
  } finally {
@@ -495,6 +495,7 @@ var State$1 = class {
495
495
  flushId;
496
496
  pos;
497
497
  id;
498
+ path = null;
498
499
  constructor(parent, accessor, flushId, pos = null, id = null) {
499
500
  this.parent = parent, this.accessor = accessor, this.flushId = flushId, this.pos = pos, this.id = id;
500
501
  }
@@ -628,7 +629,7 @@ function writeProp(state, val, parent, accessor) {
628
629
  }
629
630
  function writeReferenceOr(state, write, val, parent, accessor) {
630
631
  let ref = state.refs.get(val);
631
- if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.pendingAssignments.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (state.buf.push(ensureId(state, ref)), !0) : !1;
632
+ if (ref) return trackChannel(state, ref) ? parent && isCircular(parent, ref) ? (ensureId(state, ref), state.pendingAssignments.add(ref), addAssignment(ref, accessId(state, parent) + toAccess(accessor)), !1) : (writeRef(state, ref), !0) : !1;
632
633
  let registered = REGISTRY.get(val);
633
634
  return registered ? writeRegistered(state, val, parent, accessor, registered) : (state.refs.set(val, ref = new Reference(parent, accessor, state.flushId, state.buf.length)), ref.channel = state.channel, write(state, val, ref) ? !0 : (state.refs.delete(val), !1));
634
635
  }
@@ -654,7 +655,7 @@ function writeString(state, val, parent, accessor) {
654
655
  if (val.length > 12) {
655
656
  let ref = state.strs.get(val);
656
657
  if (ref) {
657
- if (trackChannel(state, ref)) return state.buf.push(ensureId(state, ref)), !0;
658
+ if (trackChannel(state, ref)) return writeRef(state, ref), !0;
658
659
  } else {
659
660
  let ref = new Reference(parent, accessor, state.flushId, state.buf.length);
660
661
  ref.channel = state.channel, state.strs.set(val, ref);
@@ -1133,6 +1134,9 @@ function quote(str, startPos) {
1133
1134
  }
1134
1135
  return "\"" + (lastPos === startPos ? str : result + str.slice(lastPos)) + "\"";
1135
1136
  }
1137
+ function writeRef(state, ref) {
1138
+ ref.id === null && ref.scopeId === void 0 && ref.path === null && (ref.pos === null || ref.flushId !== state.flushId) ? (ref.path = accessPath(state, ref), ref.pos = state.buf.length, ref.flushId = state.flushId, ref.channel = state.channel, state.buf.push(ref.path)) : state.buf.push(ensureId(state, ref));
1139
+ }
1136
1140
  function ensureId(state, ref) {
1137
1141
  return ref.scopeId === void 0 ? ref.id ? (trackChannel(state, ref), ref.id) : assignId(state, ref) : (trackChannel(state, ref), "_(" + ref.scopeId + ")");
1138
1142
  }
@@ -1142,23 +1146,18 @@ function accessId(state, ref) {
1142
1146
  }
1143
1147
  function assignId(state, ref) {
1144
1148
  let { pos } = ref;
1145
- if (ref.id = nextRefAccess(state), pos !== null && ref.flushId === state.flushId) return pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id;
1146
- ref.channel = state.channel;
1149
+ return ref.id = nextRefAccess(state), pos !== null && ref.flushId === state.flushId ? (pos === 0 ? state.buf[0] = ref.id + "=" + state.buf[0] : state.buf[pos - 1] += ref.id + "=", ref.id) : (ref.channel = state.channel, ref.id + "=" + (ref.path || accessPath(state, ref)));
1150
+ }
1151
+ function accessPath(state, ref) {
1147
1152
  let cur = ref, accessPrevValue = "";
1148
1153
  do {
1149
1154
  accessPrevValue = toAccess(cur.accessor) + accessPrevValue;
1150
1155
  let parent = cur.parent;
1151
- if (parent.id && (trackChannel(state, parent) || !parent.parent)) {
1152
- accessPrevValue = parent.id + accessPrevValue;
1153
- break;
1154
- }
1155
- if (parent.flushId === state.flushId || parent.scopeId !== void 0) {
1156
- accessPrevValue = accessId(state, parent) + accessPrevValue;
1157
- break;
1158
- }
1156
+ if (parent.id && (trackChannel(state, parent) || !parent.parent)) return parent.id + accessPrevValue;
1157
+ if (parent.flushId === state.flushId || parent.scopeId !== void 0) return accessId(state, parent) + accessPrevValue;
1159
1158
  cur = parent;
1160
1159
  } while (cur);
1161
- return ref.id + "=" + accessPrevValue;
1160
+ return accessPrevValue;
1162
1161
  }
1163
1162
  function assignmentsToString(assignments, value) {
1164
1163
  return assignments.length > 100 ? "($=>(" + assignments.join("=$,") + "=$))(" + value + ")" : assignments.join("=") + "=" + value;
@@ -1478,6 +1477,9 @@ function _subscribe(subscribers, scope) {
1478
1477
  }
1479
1478
  return scope;
1480
1479
  }
1480
+ function maskGroup(mask, group) {
1481
+ return mask === 715827882 ? 1 : typeof mask == "number" ? mask >>> 1 + 2 * group & 3 : mask[group] ?? 0;
1482
+ }
1481
1483
  function _set_serialize_reason(reason) {
1482
1484
  $chunk.boundary.state.serializeReason = reason;
1483
1485
  }
@@ -1486,7 +1488,7 @@ function _scope_reason() {
1486
1488
  return $chunk.boundary.state.serializeReason = void 0, reason;
1487
1489
  }
1488
1490
  function _serialize_if(condition, key) {
1489
- return condition && (condition === 1 || (typeof condition == "number" ? condition >>> key + 1 & 1 : condition[key])) ? 1 : void 0;
1491
+ return condition && maskGroup(condition, key) ? 1 : void 0;
1490
1492
  }
1491
1493
  function _serialize_guard(condition, key) {
1492
1494
  return _serialize_if(condition, key) || 0;
@@ -1605,6 +1607,16 @@ var State = class {
1605
1607
  constructor($global) {
1606
1608
  this.$global = $global, $global.cspNonce && (this.nonceAttr = " nonce" + attrAssignment($global.cspNonce));
1607
1609
  }
1610
+ flushChunk(html, scripts, pending) {
1611
+ let { $global, nonceAttr } = this, { __flush__ } = $global;
1612
+ return scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), pending ? html : html + this.trailerHTML;
1613
+ }
1614
+ walkScript() {
1615
+ return this.runtimePrefix + ".w()";
1616
+ }
1617
+ resumeScript(resumes) {
1618
+ return this.hasWrittenResume ? this.runtimePrefix + ".r.push(" + resumes + ")" : (this.hasWrittenResume = !0, this.runtimePrefix + ".r=[" + resumes + "]");
1619
+ }
1608
1620
  get runtimePrefix() {
1609
1621
  let { $global } = this;
1610
1622
  return $global.runtimeId + "." + $global.renderId;
@@ -1684,7 +1696,7 @@ var State = class {
1684
1696
  this.scripts = concatScripts(this.scripts, script);
1685
1697
  }
1686
1698
  append(chunk) {
1687
- this.html += chunk.html, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
1699
+ this.html += chunk.html, this.needsWalk ||= chunk.needsWalk, this.effects = concatEffects(this.effects, chunk.effects), this.scripts = concatScripts(this.scripts, chunk.scripts), this.lastEffect = chunk.lastEffect || this.lastEffect, this.deferredReady = concat(this.deferredReady, chunk.takeDeferredReady());
1688
1700
  }
1689
1701
  takeDeferredReady() {
1690
1702
  let { deferredReady } = this;
@@ -1783,13 +1795,13 @@ var State = class {
1783
1795
  }
1784
1796
  state.writeReorders = carried;
1785
1797
  }
1786
- return flushSerializer(boundary, state), state.resumes ? state.hasWrittenResume ? scripts = concatScripts(scripts, runtimePrefix + ".r.push(" + state.resumes + ")") : (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[" + state.resumes + "]")) : needsResumeArray && !state.hasWrittenResume && (state.hasWrittenResume = !0, scripts = concatScripts(scripts, runtimePrefix + ".r=[]")), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
1798
+ return flushSerializer(boundary, state), (state.resumes || needsResumeArray && !state.hasWrittenResume) && (scripts = concatScripts(scripts, state.resumeScript(state.resumes))), scripts = concatScripts(scripts, reordered), needsWalk && (scripts = concatScripts(scripts, state.walkScript())), this.html = html, this.scripts = scripts, this.async || (this.effects = this.lastEffect = ""), state.resumes = "", this;
1787
1799
  }
1788
1800
  flushHTML() {
1789
1801
  let { boundary } = this, { state } = boundary;
1790
1802
  this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
1791
- let { scripts } = this, { $global, nonceAttr } = state, { __flush__ } = $global, { html } = this;
1792
- return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "<\/script>"), __flush__ && ($global.__flush__ = void 0, html = __flush__($global, html)), boundary.count || (html += state.trailerHTML), html;
1803
+ let { html, scripts } = this;
1804
+ return this.html = this.scripts = "", state.flushChunk(html, scripts, boundary.count);
1793
1805
  }
1794
1806
  };
1795
1807
  function flushSerializer(boundary, serializeState) {
@@ -2043,17 +2055,20 @@ function _content_resume(id, fn, scopeId) {
2043
2055
  //#endregion
2044
2056
  //#region src/html/template.ts
2045
2057
  function render(input = {}) {
2058
+ return startRender(this, input, State);
2059
+ }
2060
+ function startRender(template, input, StateClass) {
2046
2061
  let { $global } = input;
2047
2062
  $global ? ({$global, ...input} = input, $global = {
2048
2063
  runtimeId: "M",
2049
- renderId: getDefaultRenderId(this),
2064
+ renderId: getDefaultRenderId(template),
2050
2065
  ...$global
2051
2066
  }) : $global = {
2052
2067
  runtimeId: "M",
2053
- renderId: getDefaultRenderId(this)
2068
+ renderId: getDefaultRenderId(template)
2054
2069
  };
2055
- let state = new State($global), head = new Chunk(new Boundary(state, $global.signal), null, null, state);
2056
- return this.i ? head.render(() => writeWaitReady(this.a, this, input)) : head.render(this, input), new ServerRendered(head);
2070
+ let state = new StateClass($global), head = new Chunk(new Boundary(state, $global.signal), null, null, state);
2071
+ return template.i ? head.render(() => writeWaitReady(template.a, template, input)) : head.render(template, input), new ServerRendered(head);
2057
2072
  }
2058
2073
  function getDefaultRenderId(template) {
2059
2074
  if (template.i) {
@@ -1,10 +1,3 @@
1
1
  import { type Tag } from "@marko/compiler/babel-utils";
2
- import { type Binding } from "../util/references";
3
- declare const kDOMBinding: unique symbol;
4
- declare module "@marko/compiler/dist/types" {
5
- interface MarkoTagExtra {
6
- [kDOMBinding]?: Binding;
7
- }
8
- }
9
2
  declare const _default: Tag;
10
3
  export default _default;
@@ -1,10 +1,3 @@
1
1
  import { type Tag } from "@marko/compiler/babel-utils";
2
- import { type Binding } from "../util/references";
3
- declare const kDOMBinding: unique symbol;
4
- declare module "@marko/compiler/dist/types" {
5
- interface MarkoTagExtra {
6
- [kDOMBinding]?: Binding;
7
- }
8
- }
9
2
  declare const _default: Tag;
10
3
  export default _default;
@@ -129,7 +129,7 @@ declare module "@marko/compiler/dist/types" {
129
129
  }
130
130
  interface ArrowFunctionExpressionExtra {
131
131
  }
132
- interface MarkoTagExtra {
132
+ interface MarkoTagExtra extends NodeExtra {
133
133
  }
134
134
  interface MarkoTagBodyExtra {
135
135
  }