marko 6.0.0-next.3.36 → 6.0.0-next.3.38

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/dom.mjs CHANGED
@@ -95,13 +95,13 @@ function normalizeDynamicRenderer(value2) {
95
95
  var elementHandlersByEvent = /* @__PURE__ */ new Map(), defaultDelegator = createDelegator();
96
96
  function on(element, type, handler) {
97
97
  let handlersByElement = elementHandlersByEvent.get(type);
98
- handlersByElement || elementHandlersByEvent.set(type, handlersByElement = /* @__PURE__ */ new WeakMap()), handlersByElement.has(element) || defaultDelegator(element, type, handleDelegated), handlersByElement.set(element, handler || void 0);
98
+ handlersByElement || elementHandlersByEvent.set(type, handlersByElement = /* @__PURE__ */ new WeakMap()), handlersByElement.has(element) || defaultDelegator(element, type, handleDelegated), handlersByElement.set(element, handler || null);
99
99
  }
100
100
  function createDelegator() {
101
- let delegatedEventsByRoot = /* @__PURE__ */ new WeakMap();
101
+ let kEvents = Symbol();
102
102
  return function(node, type, handler) {
103
- let root = node.getRootNode(), delegatedEvents = delegatedEventsByRoot.get(root);
104
- delegatedEvents || delegatedEventsByRoot.set(root, delegatedEvents = /* @__PURE__ */ new Set()), delegatedEvents.has(type) || (delegatedEvents.add(type), root.addEventListener(type, handler, !0));
103
+ let root = node.getRootNode();
104
+ (root[kEvents] ||= {})[type] ||= (root.addEventListener(type, handler, !0), 1);
105
105
  };
106
106
  }
107
107
  function handleDelegated(ev) {
@@ -141,19 +141,19 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
141
141
 
142
142
  // src/dom/resume.ts
143
143
  var registeredValues = {}, Render = class {
144
- n = [];
145
- o = {};
144
+ m = [];
145
+ n = {};
146
146
  A = {
147
147
  _: registeredValues
148
148
  };
149
149
  constructor(renders, runtimeId, renderId) {
150
- this.B = renders, this.C = runtimeId, this.p = renderId, this.q = renders[renderId], this.s();
150
+ this.B = renders, this.C = runtimeId, this.o = renderId, this.p = renders[renderId], this.q();
151
151
  }
152
152
  w() {
153
- this.q.w(), this.s();
153
+ this.p.w(), this.q();
154
154
  }
155
- s() {
156
- let data2 = this.q, serializeContext = this.A, scopeLookup = this.o, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
155
+ q() {
156
+ let data2 = this.p, serializeContext = this.A, scopeLookup = this.n, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
157
157
  if (visits.length) {
158
158
  let commentPrefixLen = data2.i.length, closestBranchMarkers = /* @__PURE__ */ new Map(), visitNodes = new Set(visits), lastEndNode;
159
159
  data2.v = [];
@@ -175,7 +175,7 @@ var registeredValues = {}, Render = class {
175
175
  else if (token === "$" /* ClosestBranch */)
176
176
  closestBranchMarkers.set(scopeId, visit);
177
177
  else if (token === "[" /* BranchStart */)
178
- this.e && (dataIndex && branchEnd(this.e, visit, visit), this.n.push(this.e)), this.e = scopeId, scope.a = visit;
178
+ this.e && (dataIndex && branchEnd(this.e, visit, visit), this.m.push(this.e)), this.e = scopeId, scope.a = visit;
179
179
  else if (token === "]" /* BranchEnd */) {
180
180
  scope[data3] = visit;
181
181
  let curParent = visit.parentNode, startNode = branchEnd(
@@ -183,10 +183,10 @@ var registeredValues = {}, Render = class {
183
183
  visit,
184
184
  visit
185
185
  ).a;
186
- curParent !== startNode.parentNode && curParent.prepend(startNode), this.e = this.n.pop();
187
- } else if (token === "|" /* BranchSingleNode */) {
188
- let next = data3.indexOf(" "), curNode = scope[~next ? data3.slice(0, next) : data3] = visit;
189
- for (; ~next; ) {
186
+ curParent !== startNode.parentNode && curParent.prepend(startNode), this.e = this.m.pop();
187
+ } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
188
+ let next = data3.indexOf(" "), curNode = visit;
189
+ for (scope[~next ? data3.slice(0, next) : data3] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
190
190
  let start = next + 1;
191
191
  next = data3.indexOf(" ", start);
192
192
  let childScopeId = data3.slice(start, ~next ? next : data3.length);
@@ -204,7 +204,7 @@ var registeredValues = {}, Render = class {
204
204
  let resumeData = resumes[i++];
205
205
  if (typeof resumeData == "function") {
206
206
  let scopes = resumeData(serializeContext), { $global } = scopeLookup;
207
- $global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.C, $global.renderId = this.p);
207
+ $global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.C, $global.renderId = this.o);
208
208
  for (let scopeId in scopes)
209
209
  if (scopeId !== "$") {
210
210
  let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
@@ -215,10 +215,10 @@ var registeredValues = {}, Render = class {
215
215
  let parentBranchId = parentBranchIds.get(scopeId);
216
216
  if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
217
217
  let branch = scope, parentBranch = branch.c;
218
- branch.f = +scopeId, scope.c = branch, parentBranch && (branch.t = parentBranch, (parentBranch.k ||= /* @__PURE__ */ new Set()).add(branch));
218
+ branch.f = +scopeId, scope.c = branch, parentBranch && (branch.s = parentBranch, (parentBranch.j ||= /* @__PURE__ */ new Set()).add(branch));
219
219
  }
220
220
  }
221
- } else i === len || typeof resumes[i] != "string" ? delete this.B[this.p] : registeredValues[resumes[i++]](
221
+ } else i === len || typeof resumes[i] != "string" ? delete this.B[this.o] : registeredValues[resumes[i++]](
222
222
  scopeLookup[resumeData],
223
223
  scopeLookup[resumeData]
224
224
  );
@@ -325,8 +325,7 @@ function controllable_select_value(scope, nodeAccessor, value2, valueChange) {
325
325
  );
326
326
  }
327
327
  function controllable_select_value_effect(scope, nodeAccessor) {
328
- let el = scope[nodeAccessor];
329
- syncControllable(el, "input", hasSelectChanged, () => {
328
+ let el = scope[nodeAccessor], onChange = () => {
330
329
  let valueChange = scope[nodeAccessor + ";" /* ControlledHandler */];
331
330
  valueChange && (scope[nodeAccessor + "=" /* ControlledType */] = 6 /* Pending */, valueChange(
332
331
  Array.isArray(scope[nodeAccessor + ":" /* ControlledValue */]) ? Array.from(el.selectedOptions, toValueProp) : el.value
@@ -335,7 +334,14 @@ function controllable_select_value_effect(scope, nodeAccessor) {
335
334
  scope[nodeAccessor + ":" /* ControlledValue */],
336
335
  valueChange
337
336
  ));
338
- });
337
+ };
338
+ controllableHandlers.has(el) || new MutationObserver(() => {
339
+ let value2 = scope[nodeAccessor + ":" /* ControlledValue */];
340
+ (Array.isArray(value2) ? value2.length !== el.selectedOptions.length || value2.some((value3, i) => value3 != el.selectedOptions[i].value) : el.value != value2) && onChange();
341
+ }).observe(el, {
342
+ childList: !0,
343
+ subtree: !0
344
+ }), syncControllable(el, "input", hasSelectChanged, onChange);
339
345
  }
340
346
  function setSelectOptions(el, value2, valueChange) {
341
347
  if (Array.isArray(value2))
@@ -387,17 +393,17 @@ function setValueAndUpdateSelection(el, value2) {
387
393
  function setCheckboxValue(scope, nodeAccessor, type, checked, checkedChange) {
388
394
  scope[nodeAccessor + ";" /* ControlledHandler */] = checkedChange, checkedChange ? (scope[nodeAccessor + "=" /* ControlledType */] = type, scope[nodeAccessor].checked = checked) : (scope[nodeAccessor + "=" /* ControlledType */] = 5 /* None */, scope[nodeAccessor].defaultChecked = checked);
389
395
  }
390
- var delegateFormControl = createDelegator(), formChangeHandlers = /* @__PURE__ */ new WeakMap();
396
+ var controllableDelegate = createDelegator(), controllableHandlers = /* @__PURE__ */ new WeakMap();
391
397
  function syncControllable(el, event, hasChanged, onChange) {
392
- formChangeHandlers.set(el, onChange), delegateFormControl(el, event, onFormChange), el.form && delegateFormControl(el.form, "reset", onFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange);
398
+ controllableHandlers.has(el) || (controllableDelegate(el, event, handleChange), el.form && controllableDelegate(el.form, "reset", handleFormReset), isResuming && hasChanged(el) && queueMicrotask(onChange)), controllableHandlers.set(el, onChange);
393
399
  }
394
- function onFormChange(ev) {
395
- formChangeHandlers.get(ev.target)?.(ev);
400
+ function handleChange(ev) {
401
+ controllableHandlers.get(ev.target)?.(ev);
396
402
  }
397
- function onFormReset(ev) {
403
+ function handleFormReset(ev) {
398
404
  let handlers = [];
399
405
  for (let el of ev.target.elements) {
400
- let handler = formChangeHandlers.get(el);
406
+ let handler = controllableHandlers.get(el);
401
407
  handler && hasFormElementChanged(el) && handlers.push(handler);
402
408
  }
403
409
  requestAnimationFrame(() => {
@@ -651,10 +657,10 @@ function getEmptyBranch(marker) {
651
657
  return emptyBranch.a = emptyBranch.b = marker, emptyBranch;
652
658
  }
653
659
  function destroyBranch(branch) {
654
- branch.t?.k?.delete(branch), destroyNestedBranches(branch);
660
+ branch.s?.j?.delete(branch), destroyNestedBranches(branch);
655
661
  }
656
662
  function destroyNestedBranches(branch) {
657
- branch.E = 1, branch.k?.forEach(destroyNestedBranches), branch.F?.forEach((scope) => {
663
+ branch.E = 1, branch.j?.forEach(destroyNestedBranches), branch.F?.forEach((scope) => {
658
664
  for (let id in scope.h)
659
665
  scope.h[id]?.abort();
660
666
  });
@@ -793,7 +799,7 @@ function walkInternal(walkCodes, scope, currentWalkIndex) {
793
799
  function createBranchScopeWithRenderer(renderer, $global, parentScope, parentNode) {
794
800
  let branch = createBranch(
795
801
  $global,
796
- renderer.u || parentScope,
802
+ renderer.t || parentScope,
797
803
  parentScope
798
804
  );
799
805
  return initBranch(renderer, branch, parentNode), branch;
@@ -814,11 +820,11 @@ function createBranchScopeWithTagNameOrRenderer(tagNameOrRenderer, $global, pare
814
820
  }
815
821
  function createBranch($global, ownerScope, parentScope) {
816
822
  let branch = createScope($global), parentBranch = parentScope.c;
817
- return branch._ = ownerScope, branch.c = branch, parentBranch ? (branch.f = parentBranch.f + 1, branch.t = parentBranch, (parentBranch.k ||= /* @__PURE__ */ new Set()).add(branch)) : branch.f = 1, branch;
823
+ return branch._ = ownerScope, branch.c = branch, parentBranch ? (branch.f = parentBranch.f + 1, branch.s = parentBranch, (parentBranch.j ||= /* @__PURE__ */ new Set()).add(branch)) : branch.f = 1, branch;
818
824
  }
819
825
  function initBranch(renderer, branch, parentNode) {
820
- let clone = renderer.l(parentNode.namespaceURI), cloneParent = clone.parentNode;
821
- walk(cloneParent?.firstChild || clone, renderer.G, branch), branch.a = cloneParent?.firstChild || clone, branch.b = cloneParent?.lastChild || clone, renderer.x && queueRender(branch, renderer.x);
826
+ let clone = renderer.k(parentNode.namespaceURI), cloneParent = clone.parentNode;
827
+ walk(cloneParent?.firstChild || clone, renderer.G, branch), branch.a = cloneParent?.firstChild || clone, branch.b = cloneParent?.lastChild || clone, renderer.u && queueRender(branch, renderer.u);
822
828
  }
823
829
  function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
824
830
  return (scope, attrsOrOp) => {
@@ -830,7 +836,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
830
836
  return renderer.d?.(childScope, attrsOrOp);
831
837
  let content = getContent?.(scope);
832
838
  if (typeof renderer == "string")
833
- setConditionalRendererOnlyChild(childScope, 0, content), attrs(childScope, 0, attrsOrOp());
839
+ setConditionalRendererOnlyChild(
840
+ childScope,
841
+ 0,
842
+ content,
843
+ createBranchScopeWithTagNameOrRenderer
844
+ ), attrs(childScope, 0, attrsOrOp());
834
845
  else if (renderer.d) {
835
846
  let attributes = attrsOrOp();
836
847
  renderer.d(
@@ -848,13 +859,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
848
859
  function createRendererWithOwner(template, rawWalks, setup, getArgs) {
849
860
  let args, id = {}, walks = rawWalks ? /* @__PURE__ */ trimWalkString(rawWalks) : " ";
850
861
  return (owner) => ({
851
- j: id,
862
+ x: id,
852
863
  y: template,
853
864
  G: walks,
854
- x: setup,
855
- l: _clone,
856
- u: owner,
857
- J: void 0,
865
+ u: setup,
866
+ k: _clone,
867
+ t: owner,
858
868
  get d() {
859
869
  return args ||= getArgs?.();
860
870
  }
@@ -876,63 +886,58 @@ function createCloneableHTML(html2, ns) {
876
886
  }
877
887
 
878
888
  // src/dom/control-flow.ts
879
- function patchConditionals(fn) {
880
- conditional = fn(conditional), conditionalOnlyChild = fn(conditionalOnlyChild);
889
+ function conditional(nodeAccessor, ...branches) {
890
+ let branchAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
891
+ return (scope, newBranchIndexOrOp) => {
892
+ newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN && (scope[nodeAccessor].nodeType > 1 /* Element */ ? setConditionalRenderer : setConditionalRendererOnlyChild)(
893
+ scope,
894
+ nodeAccessor,
895
+ branches[scope[branchAccessor] = newBranchIndexOrOp],
896
+ createBranchScopeWithRenderer
897
+ );
898
+ };
899
+ }
900
+ function patchDynamicTag(fn) {
901
+ dynamicTag = fn(dynamicTag);
881
902
  }
882
- var conditional = function(nodeAccessor, fn, getIntersection) {
903
+ var dynamicTag = function(nodeAccessor, fn, getIntersection) {
883
904
  let rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
884
905
  return (scope, newRendererOrOp) => {
885
906
  if (newRendererOrOp === DIRTY) return;
886
907
  let currentRenderer = scope[rendererAccessor], op = newRendererOrOp;
887
908
  if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
888
909
  let normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
889
- isDifferentRenderer(normalizedRenderer, currentRenderer) ? (scope[rendererAccessor] = normalizedRenderer, setConditionalRenderer(scope, nodeAccessor, normalizedRenderer), fn && fn(scope), op = DIRTY) : op = CLEAN;
910
+ isDifferentRenderer(normalizedRenderer, currentRenderer) ? (scope[rendererAccessor] = normalizedRenderer, setConditionalRenderer(
911
+ scope,
912
+ nodeAccessor,
913
+ normalizedRenderer,
914
+ createBranchScopeWithTagNameOrRenderer
915
+ ), fn && fn(scope), op = DIRTY) : op = CLEAN;
890
916
  }
891
917
  intersection2?.(scope, op);
892
918
  };
893
919
  };
894
- function setConditionalRenderer(scope, nodeAccessor, newRenderer) {
895
- let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] || getEmptyBranch(scope[nodeAccessor]), newBranch = newRenderer ? createBranchScopeWithTagNameOrRenderer(
920
+ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
921
+ let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] || getEmptyBranch(scope[nodeAccessor]), newBranch = newRenderer ? createBranch2(
896
922
  newRenderer,
897
923
  scope.$global,
898
924
  scope,
899
925
  prevBranch.b.parentNode
900
926
  ) : getEmptyBranch(scope[nodeAccessor]);
901
- insertBranchBefore(
927
+ prevBranch !== newBranch && (insertBranchBefore(
902
928
  newBranch,
903
929
  prevBranch.b.parentNode,
904
930
  prevBranch.b.nextSibling
905
- ), removeAndDestroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch;
931
+ ), removeAndDestroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch);
906
932
  }
907
- var conditionalOnlyChild = function(nodeAccessor, fn, getIntersection) {
908
- let rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
909
- return (scope, newRendererOrOp) => {
910
- if (newRendererOrOp === DIRTY) return;
911
- let currentRenderer = scope[rendererAccessor], op = newRendererOrOp;
912
- if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
913
- let normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
914
- isDifferentRenderer(normalizedRenderer, currentRenderer) ? (currentRenderer = scope[rendererAccessor] = normalizedRenderer, setConditionalRendererOnlyChild(
915
- scope,
916
- nodeAccessor,
917
- normalizedRenderer
918
- ), fn && fn(scope), op = DIRTY) : op = CLEAN;
919
- }
920
- intersection2?.(scope, op);
921
- };
922
- };
923
- function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
924
- let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */], referenceNode = scope[nodeAccessor], newBranch = newRenderer ? createBranchScopeWithTagNameOrRenderer(
925
- newRenderer,
926
- scope.$global,
927
- scope,
928
- referenceNode
929
- ) : void 0;
933
+ function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer, createBranch2) {
934
+ let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */], referenceNode = scope[nodeAccessor], newBranch = newRenderer && createBranch2(newRenderer, scope.$global, scope, referenceNode);
930
935
  referenceNode.textContent = "", newBranch && insertBranchBefore(newBranch, referenceNode, null), prevBranch && destroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newBranch;
931
936
  }
932
937
  var emptyMarkerMap = /* @__PURE__ */ new Map([
933
- [Symbol(), getEmptyBranch(void 0)]
938
+ [Symbol(), /* @__PURE__ */ getEmptyBranch(0)]
934
939
  ]), emptyMarkerArray = [
935
- /* @__PURE__ */ getEmptyBranch(void 0)
940
+ /* @__PURE__ */ getEmptyBranch(0)
936
941
  ], emptyMap = /* @__PURE__ */ new Map(), emptyArray = [];
937
942
  function loopOf(nodeAccessor, renderer) {
938
943
  return loop(
@@ -990,7 +995,7 @@ function byFirstArg(name) {
990
995
  return name;
991
996
  }
992
997
  function isDifferentRenderer(a, b) {
993
- return a !== b && (a?.j || 0) !== b?.j;
998
+ return a !== b && (a?.x || 0) !== b?.x;
994
999
  }
995
1000
 
996
1001
  // src/dom/signals.ts
@@ -1035,10 +1040,10 @@ function loopClosure(ownerLoopNodeAccessor, fn, getIntersection) {
1035
1040
  };
1036
1041
  return helperSignal._ = signal, helperSignal;
1037
1042
  }
1038
- function conditionalClosure(ownerConditionalNodeAccessor, getRenderer, fn, getIntersection) {
1039
- let signal = closure(fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, rendererAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, helperSignal = (scope, value2) => {
1040
- let conditionalScope = scope[scopeAccessor];
1041
- conditionalScope && !conditionalScope.g && scope[rendererAccessor]?.j === getRenderer().j && queueSource(conditionalScope, signal, value2);
1043
+ function conditionalClosure(ownerConditionalNodeAccessor, branch, fn, getIntersection) {
1044
+ let signal = closure(fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, helperSignal = (scope, value2) => {
1045
+ let ifScope = scope[scopeAccessor];
1046
+ ifScope && !ifScope.g && scope[branchAccessor] === branch && queueSource(ifScope, signal, value2);
1042
1047
  };
1043
1048
  return helperSignal._ = signal, helperSignal;
1044
1049
  }
@@ -1097,7 +1102,7 @@ function queueSource(scope, signal, value2) {
1097
1102
  }
1098
1103
  function queueRender(scope, signal, value2) {
1099
1104
  let i = pendingRenders.length, render = {
1100
- m: scope,
1105
+ l: scope,
1101
1106
  H: signal,
1102
1107
  I: value2,
1103
1108
  z: i
@@ -1153,7 +1158,7 @@ function runRenders() {
1153
1158
  }
1154
1159
  pendingRenders[i] = item;
1155
1160
  }
1156
- render.m.c?.E || render.H(render.m, render.I);
1161
+ render.l.c?.E || render.H(render.l, render.I);
1157
1162
  }
1158
1163
  finishPendingScopes();
1159
1164
  }
@@ -1161,7 +1166,7 @@ function comparePendingRenders(a, b) {
1161
1166
  return getBranchDepth(a) - getBranchDepth(b) || a.z - b.z;
1162
1167
  }
1163
1168
  function getBranchDepth(render) {
1164
- return render.m.c?.f || 0;
1169
+ return render.l.c?.f || 0;
1165
1170
  }
1166
1171
 
1167
1172
  // src/dom/abort-signal.ts
@@ -1181,7 +1186,7 @@ var prefix = "$C_", RENDERER_REGISTER_ID = prefix + "r", SET_SCOPE_REGISTER_ID =
1181
1186
 
1182
1187
  // src/dom/compat.ts
1183
1188
  var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1184
- patchConditionals,
1189
+ patchConditionals: patchDynamicTag,
1185
1190
  queueEffect,
1186
1191
  init(warp10Noop) {
1187
1192
  register(SET_SCOPE_REGISTER_ID, (branch) => {
@@ -1195,7 +1200,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1195
1200
  return value2 === MARK || value2 === CLEAN || value2 === DIRTY;
1196
1201
  },
1197
1202
  isRenderer(renderer) {
1198
- return renderer.l !== void 0;
1203
+ return renderer.k;
1199
1204
  },
1200
1205
  getStartNode(branch) {
1201
1206
  return branch.a;
@@ -1215,12 +1220,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1215
1220
  }) {
1216
1221
  return Array.isArray(value2) && typeof value2[0] == "string" ? getRegisteredWithScope(
1217
1222
  value2[0],
1218
- value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.o[value2[1]]
1223
+ value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.n[value2[1]]
1219
1224
  ) : value2;
1220
1225
  },
1221
1226
  createRenderer(setup, clone, args) {
1222
- let renderer = createRenderer("", void 0, setup, args && (() => args));
1223
- return renderer.l = clone, renderer;
1227
+ let renderer = createRenderer("", 0, setup, args && (() => args));
1228
+ return renderer.k = clone, renderer;
1224
1229
  },
1225
1230
  render(out, component, renderer, args) {
1226
1231
  let branch = component.scope;
@@ -1232,7 +1237,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1232
1237
  normalizedInput[key === "renderBody" ? "content" : key] = input[key];
1233
1238
  }
1234
1239
  if (component.effects = prepareEffects(() => {
1235
- branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.u, initBranch(renderer, branch, document.body)), applyArgs(branch, args);
1240
+ branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.t, initBranch(renderer, branch, document.body)), applyArgs(branch, args);
1236
1241
  }), !existing)
1237
1242
  return toInsertNode(branch.a, branch.b);
1238
1243
  }
@@ -1296,7 +1301,6 @@ export {
1296
1301
  compat,
1297
1302
  conditional,
1298
1303
  conditionalClosure,
1299
- conditionalOnlyChild,
1300
1304
  controllable_detailsOrDialog_open,
1301
1305
  controllable_detailsOrDialog_open_effect,
1302
1306
  controllable_input_checked,
@@ -1314,6 +1318,7 @@ export {
1314
1318
  createTemplate,
1315
1319
  data,
1316
1320
  dynamicClosure,
1321
+ dynamicTag,
1317
1322
  dynamicTagAttrs,
1318
1323
  effect,
1319
1324
  forIn,
@@ -27,13 +27,13 @@ export declare function markResumeNode(scopeId: number, accessor: Accessor): str
27
27
  export declare function nodeRef(scopeId: number, id?: string): () => void;
28
28
  export declare function resumeClosestBranch(scopeId: number): void;
29
29
  export declare function resumeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, scopeId: number, accessor: Accessor): void;
30
- export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, scopeId: number, accessor: Accessor): void;
30
+ export declare function resumeSingleNodeForOf(list: Falsy | Iterable<unknown>, cb: (item: unknown, index: number) => void, scopeId: number, accessor: Accessor, onlyChildInParent?: 1): void;
31
31
  export declare function resumeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, scopeId: number, accessor: Accessor): void;
32
- export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, scopeId: number, accessor: Accessor): void;
32
+ export declare function resumeSingleNodeForIn(obj: Falsy | {}, cb: (key: string, value: unknown) => void, scopeId: number, accessor: Accessor, onlyChild?: 1): void;
33
33
  export declare function resumeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, scopeId: number, accessor: Accessor): void;
34
- export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, scopeId: number, accessor: Accessor): void;
34
+ export declare function resumeSingleNodeForTo(to: number, from: number | Falsy, step: number | Falsy, cb: (index: number) => void, scopeId: number, accessor: Accessor, onlyChild?: 1): void;
35
35
  export declare function resumeConditional(cb: () => void | number, scopeId: number, accessor: Accessor): void;
36
- export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor): void;
36
+ export declare function resumeSingleNodeConditional(cb: () => void | number, scopeId: number, accessor: Accessor, onlyChild?: 1): void;
37
37
  export declare function writeScope(scopeId: number, partialScope: PartialScope): ScopeInternals;
38
38
  export declare function writeExistingScope(scope: ScopeInternals): ScopeInternals;
39
39
  export declare function ensureScopeWithId(scopeId: number): PartialScope;
package/dist/html.js CHANGED
@@ -1066,14 +1066,14 @@ function resumeForOf(list, cb, scopeId, accessor) {
1066
1066
  )
1067
1067
  );
1068
1068
  }
1069
- function resumeSingleNodeForOf(list, cb, scopeId, accessor) {
1069
+ function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
1070
1070
  let branchIds = "";
1071
1071
  forOf(list, (item, index) => {
1072
1072
  let branchId = peekNextScopeId();
1073
1073
  branchIds = " " + branchId + branchIds, withContext(branchIdKey, branchId, () => cb(item, index));
1074
1074
  }), $chunk.writeHTML(
1075
1075
  $chunk.boundary.state.mark(
1076
- "|" /* BranchSingleNode */,
1076
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1077
1077
  scopeId + " " + accessor + branchIds
1078
1078
  )
1079
1079
  );
@@ -1092,14 +1092,14 @@ function resumeForIn(obj, cb, scopeId, accessor) {
1092
1092
  )
1093
1093
  );
1094
1094
  }
1095
- function resumeSingleNodeForIn(obj, cb, scopeId, accessor) {
1095
+ function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
1096
1096
  let branchIds = "";
1097
1097
  forIn(obj, (key, value) => {
1098
1098
  let branchId = peekNextScopeId();
1099
1099
  branchIds = " " + branchId + branchIds, withContext(branchIdKey, branchId, () => cb(key, value));
1100
1100
  }), $chunk.writeHTML(
1101
1101
  $chunk.boundary.state.mark(
1102
- "|" /* BranchSingleNode */,
1102
+ onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1103
1103
  scopeId + " " + accessor + branchIds
1104
1104
  )
1105
1105
  );
@@ -1118,14 +1118,14 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
1118
1118
  )
1119
1119
  );
1120
1120
  }
1121
- function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor) {
1121
+ function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild) {
1122
1122
  let branchIds = "";
1123
1123
  forTo(to, from, step, (index) => {
1124
1124
  let branchId = peekNextScopeId();
1125
1125
  branchIds = " " + branchId + branchIds, withContext(branchIdKey, branchId, () => cb(index));
1126
1126
  }), $chunk.writeHTML(
1127
1127
  $chunk.boundary.state.mark(
1128
- "|" /* BranchSingleNode */,
1128
+ onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1129
1129
  scopeId + " " + accessor + branchIds
1130
1130
  )
1131
1131
  );
@@ -1141,13 +1141,13 @@ function resumeConditional(cb, scopeId, accessor) {
1141
1141
  )
1142
1142
  );
1143
1143
  }
1144
- function resumeSingleNodeConditional(cb, scopeId, accessor) {
1144
+ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
1145
1145
  let branchId = peekNextScopeId();
1146
1146
  withContext(branchIdKey, branchId, cb);
1147
1147
  let rendered = peekNextScopeId() !== branchId;
1148
1148
  rendered ? writeScope(branchId, {}) : nextScopeId(), $chunk.writeHTML(
1149
1149
  $chunk.boundary.state.mark(
1150
- "|" /* BranchSingleNode */,
1150
+ onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1151
1151
  scopeId + " " + accessor + (rendered ? " " + branchId : "")
1152
1152
  )
1153
1153
  );
package/dist/html.mjs CHANGED
@@ -987,14 +987,14 @@ function resumeForOf(list, cb, scopeId, accessor) {
987
987
  )
988
988
  );
989
989
  }
990
- function resumeSingleNodeForOf(list, cb, scopeId, accessor) {
990
+ function resumeSingleNodeForOf(list, cb, scopeId, accessor, onlyChildInParent) {
991
991
  let branchIds = "";
992
992
  forOf(list, (item, index) => {
993
993
  let branchId = peekNextScopeId();
994
994
  branchIds = " " + branchId + branchIds, withContext(branchIdKey, branchId, () => cb(item, index));
995
995
  }), $chunk.writeHTML(
996
996
  $chunk.boundary.state.mark(
997
- "|" /* BranchSingleNode */,
997
+ onlyChildInParent ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
998
998
  scopeId + " " + accessor + branchIds
999
999
  )
1000
1000
  );
@@ -1013,14 +1013,14 @@ function resumeForIn(obj, cb, scopeId, accessor) {
1013
1013
  )
1014
1014
  );
1015
1015
  }
1016
- function resumeSingleNodeForIn(obj, cb, scopeId, accessor) {
1016
+ function resumeSingleNodeForIn(obj, cb, scopeId, accessor, onlyChild) {
1017
1017
  let branchIds = "";
1018
1018
  forIn(obj, (key, value) => {
1019
1019
  let branchId = peekNextScopeId();
1020
1020
  branchIds = " " + branchId + branchIds, withContext(branchIdKey, branchId, () => cb(key, value));
1021
1021
  }), $chunk.writeHTML(
1022
1022
  $chunk.boundary.state.mark(
1023
- "|" /* BranchSingleNode */,
1023
+ onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1024
1024
  scopeId + " " + accessor + branchIds
1025
1025
  )
1026
1026
  );
@@ -1039,14 +1039,14 @@ function resumeForTo(to, from, step, cb, scopeId, accessor) {
1039
1039
  )
1040
1040
  );
1041
1041
  }
1042
- function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor) {
1042
+ function resumeSingleNodeForTo(to, from, step, cb, scopeId, accessor, onlyChild) {
1043
1043
  let branchIds = "";
1044
1044
  forTo(to, from, step, (index) => {
1045
1045
  let branchId = peekNextScopeId();
1046
1046
  branchIds = " " + branchId + branchIds, withContext(branchIdKey, branchId, () => cb(index));
1047
1047
  }), $chunk.writeHTML(
1048
1048
  $chunk.boundary.state.mark(
1049
- "|" /* BranchSingleNode */,
1049
+ onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1050
1050
  scopeId + " " + accessor + branchIds
1051
1051
  )
1052
1052
  );
@@ -1062,13 +1062,13 @@ function resumeConditional(cb, scopeId, accessor) {
1062
1062
  )
1063
1063
  );
1064
1064
  }
1065
- function resumeSingleNodeConditional(cb, scopeId, accessor) {
1065
+ function resumeSingleNodeConditional(cb, scopeId, accessor, onlyChild) {
1066
1066
  let branchId = peekNextScopeId();
1067
1067
  withContext(branchIdKey, branchId, cb);
1068
1068
  let rendered = peekNextScopeId() !== branchId;
1069
1069
  rendered ? writeScope(branchId, {}) : nextScopeId(), $chunk.writeHTML(
1070
1070
  $chunk.boundary.state.mark(
1071
- "|" /* BranchSingleNode */,
1071
+ onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1072
1072
  scopeId + " " + accessor + (rendered ? " " + branchId : "")
1073
1073
  )
1074
1074
  );
@@ -1,14 +1,5 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type Binding } from "../util/references";
3
2
  type ForType = "in" | "of" | "to";
4
- declare const kForMarkerBinding: unique symbol;
5
- declare const kOnlyChildInParent: unique symbol;
6
- declare module "@marko/compiler/dist/types" {
7
- interface NodeExtra {
8
- [kForMarkerBinding]?: Binding;
9
- [kOnlyChildInParent]?: boolean;
10
- }
11
- }
12
3
  declare const _default: {
13
4
  analyze(tag: t.NodePath<t.MarkoTag>): void;
14
5
  translate: {
@@ -1,11 +1,4 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import { type Binding } from "../util/references";
3
- declare const kBinding: unique symbol;
4
- declare module "@marko/compiler/dist/types" {
5
- interface MarkoTagExtra {
6
- [kBinding]?: Binding;
7
- }
8
- }
9
2
  export declare const IfTag: {
10
3
  analyze(tag: t.NodePath<t.MarkoTag>): void;
11
4
  translate: {
@@ -50,4 +43,3 @@ export declare const ElseTag: {
50
43
  controlFlow: true;
51
44
  };
52
45
  };
53
- export {};