marko 6.0.0-next.3.37 → 6.0.0-next.3.39

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.d.ts CHANGED
@@ -2,12 +2,12 @@ export { attrTag, attrTags } from "./common/attr-tag";
2
2
  export { forIn, forOf, forTo } from "./common/for";
3
3
  export { getAbortSignal, resetAbortSignal } from "./dom/abort-signal";
4
4
  export { compat } from "./dom/compat";
5
- export { conditional, conditionalOnlyChild, loopIn, loopOf, loopTo, } from "./dom/control-flow";
5
+ export { conditional, dynamicTag, loopIn, loopOf, loopTo, } from "./dom/control-flow";
6
6
  export { controllable_detailsOrDialog_open, controllable_detailsOrDialog_open_effect, controllable_input_checked, controllable_input_checked_effect, controllable_input_checkedValue, controllable_input_checkedValue_effect, controllable_input_value, controllable_input_value_effect, controllable_select_value, controllable_select_value_effect, controllable_textarea_value, controllable_textarea_value_effect, } from "./dom/controllable";
7
7
  export { attr, attrs, attrsEvents, classAttr, data, html, lifecycle, partialAttrs, props, styleAttr, textContent, } from "./dom/dom";
8
8
  export { on } from "./dom/event";
9
9
  export { run } from "./dom/queue";
10
10
  export { createRenderer, createRendererWithOwner, dynamicTagAttrs, } from "./dom/renderer";
11
- export { init, nodeRef, register, registerBoundSignal, registerSubscriber, } from "./dom/resume";
12
- export { conditionalClosure, dynamicClosure, effect, inChild, intersection, intersections, loopClosure, nextTagId, setTagVar, setTagVarChange, state, tagVarSignal, tagVarSignalChange, value, } from "./dom/signals";
11
+ export { init, nodeRef, register, registerBoundSignal } from "./dom/resume";
12
+ export { conditionalClosure, dynamicClosure, effect, inChild, intersection, intersections, loopClosure, nextTagId, registerDynamicClosure, setTagVar, setTagVarChange, state, tagVarSignal, tagVarSignalChange, value, } from "./dom/signals";
13
13
  export { createTemplate } from "./dom/template";
package/dist/dom.js CHANGED
@@ -26,7 +26,6 @@ __export(dom_exports, {
26
26
  compat: () => compat,
27
27
  conditional: () => conditional,
28
28
  conditionalClosure: () => conditionalClosure,
29
- conditionalOnlyChild: () => conditionalOnlyChild,
30
29
  controllable_detailsOrDialog_open: () => controllable_detailsOrDialog_open,
31
30
  controllable_detailsOrDialog_open_effect: () => controllable_detailsOrDialog_open_effect,
32
31
  controllable_input_checked: () => controllable_input_checked,
@@ -44,6 +43,7 @@ __export(dom_exports, {
44
43
  createTemplate: () => createTemplate,
45
44
  data: () => data,
46
45
  dynamicClosure: () => dynamicClosure,
46
+ dynamicTag: () => dynamicTag,
47
47
  dynamicTagAttrs: () => dynamicTagAttrs,
48
48
  effect: () => effect,
49
49
  forIn: () => forIn,
@@ -67,7 +67,7 @@ __export(dom_exports, {
67
67
  props: () => props,
68
68
  register: () => register,
69
69
  registerBoundSignal: () => registerBoundSignal,
70
- registerSubscriber: () => registerSubscriber,
70
+ registerDynamicClosure: () => registerDynamicClosure,
71
71
  resetAbortSignal: () => resetAbortSignal,
72
72
  run: () => run,
73
73
  setTagVar: () => setTagVar,
@@ -111,23 +111,6 @@ function forTo(to, from, step, cb) {
111
111
  cb(start + i * delta);
112
112
  }
113
113
 
114
- // src/dom/schedule.ts
115
- var port2 = /* @__PURE__ */ (() => {
116
- let { port1, port2: port22 } = new MessageChannel();
117
- return port1.onmessage = () => {
118
- isScheduled = !1, run();
119
- }, port22;
120
- })(), isScheduled;
121
- function schedule() {
122
- isScheduled || (isScheduled = !0, queueMicrotask(flushAndWaitFrame));
123
- }
124
- function flushAndWaitFrame() {
125
- run(), requestAnimationFrame(triggerMacroTask);
126
- }
127
- function triggerMacroTask() {
128
- port2.postMessage(0);
129
- }
130
-
131
114
  // src/common/helpers.ts
132
115
  function classValue(value2) {
133
116
  return toDelimitedString(value2, " ", stringifyClassObject);
@@ -224,19 +207,19 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
224
207
 
225
208
  // src/dom/resume.ts
226
209
  var registeredValues = {}, Render = class {
227
- n = [];
228
- o = {};
229
- A = {
210
+ l = [];
211
+ m = {};
212
+ C = {
230
213
  _: registeredValues
231
214
  };
232
215
  constructor(renders, runtimeId, renderId) {
233
- this.B = renders, this.C = runtimeId, this.p = renderId, this.q = renders[renderId], this.s();
216
+ this.D = renders, this.E = runtimeId, this.n = renderId, this.o = renders[renderId], this.p();
234
217
  }
235
218
  w() {
236
- this.q.w(), this.s();
219
+ this.o.w(), this.p();
237
220
  }
238
- s() {
239
- let data2 = this.q, serializeContext = this.A, scopeLookup = this.o, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
221
+ p() {
222
+ let data2 = this.o, serializeContext = this.C, scopeLookup = this.m, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
240
223
  if (visits.length) {
241
224
  let commentPrefixLen = data2.i.length, closestBranchMarkers = /* @__PURE__ */ new Map(), visitNodes = new Set(visits), lastEndNode;
242
225
  data2.v = [];
@@ -258,7 +241,7 @@ var registeredValues = {}, Render = class {
258
241
  else if (token === "$" /* ClosestBranch */)
259
242
  closestBranchMarkers.set(scopeId, visit);
260
243
  else if (token === "[" /* BranchStart */)
261
- this.e && (dataIndex && branchEnd(this.e, visit, visit), this.n.push(this.e)), this.e = scopeId, scope.a = visit;
244
+ this.e && (dataIndex && branchEnd(this.e, visit, visit), this.l.push(this.e)), this.e = scopeId, scope.a = visit;
262
245
  else if (token === "]" /* BranchEnd */) {
263
246
  scope[data3] = visit;
264
247
  let curParent = visit.parentNode, startNode = branchEnd(
@@ -266,7 +249,7 @@ var registeredValues = {}, Render = class {
266
249
  visit,
267
250
  visit
268
251
  ).a;
269
- curParent !== startNode.parentNode && curParent.prepend(startNode), this.e = this.n.pop();
252
+ curParent !== startNode.parentNode && curParent.prepend(startNode), this.e = this.l.pop();
270
253
  } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
271
254
  let next = data3.indexOf(" "), curNode = visit;
272
255
  for (scope[~next ? data3.slice(0, next) : data3] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
@@ -287,7 +270,7 @@ var registeredValues = {}, Render = class {
287
270
  let resumeData = resumes[i++];
288
271
  if (typeof resumeData == "function") {
289
272
  let scopes = resumeData(serializeContext), { $global } = scopeLookup;
290
- $global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.C, $global.renderId = this.p);
273
+ $global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.E, $global.renderId = this.n);
291
274
  for (let scopeId in scopes)
292
275
  if (scopeId !== "$") {
293
276
  let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
@@ -298,10 +281,10 @@ var registeredValues = {}, Render = class {
298
281
  let parentBranchId = parentBranchIds.get(scopeId);
299
282
  if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
300
283
  let branch = scope, parentBranch = branch.c;
301
- branch.f = +scopeId, scope.c = branch, parentBranch && (branch.t = parentBranch, (parentBranch.k ||= /* @__PURE__ */ new Set()).add(branch));
284
+ branch.f = +scopeId, scope.c = branch, parentBranch && (branch.q = parentBranch, (parentBranch.j ||= /* @__PURE__ */ new Set()).add(branch));
302
285
  }
303
286
  }
304
- } else i === len || typeof resumes[i] != "string" ? delete this.B[this.p] : registeredValues[resumes[i++]](
287
+ } else i === len || typeof resumes[i] != "string" ? delete this.D[this.n] : registeredValues[resumes[i++]](
305
288
  scopeLookup[resumeData],
306
289
  scopeLookup[resumeData]
307
290
  );
@@ -338,9 +321,6 @@ function init(runtimeId = DEFAULT_RUNTIME_ID) {
338
321
  });
339
322
  }
340
323
  }
341
- function registerSubscriber(id, signal) {
342
- return register(id, signal.D), signal;
343
- }
344
324
  function nodeRef(id, key) {
345
325
  return register(id, (scope) => () => scope[key]);
346
326
  }
@@ -723,9 +703,10 @@ function toInsertNode(startNode, endNode) {
723
703
 
724
704
  // src/dom/scope.ts
725
705
  var pendingScopes = [];
726
- function createScope($global) {
706
+ function createScope($global, closestBranch) {
727
707
  let scope = {
728
708
  g: 1,
709
+ c: closestBranch,
729
710
  $global
730
711
  };
731
712
  return pendingScopes.push(scope), scope;
@@ -740,10 +721,10 @@ function getEmptyBranch(marker) {
740
721
  return emptyBranch.a = emptyBranch.b = marker, emptyBranch;
741
722
  }
742
723
  function destroyBranch(branch) {
743
- branch.t?.k?.delete(branch), destroyNestedBranches(branch);
724
+ branch.q?.j?.delete(branch), destroyNestedBranches(branch);
744
725
  }
745
726
  function destroyNestedBranches(branch) {
746
- branch.E = 1, branch.k?.forEach(destroyNestedBranches), branch.F?.forEach((scope) => {
727
+ branch.F = 1, branch.j?.forEach(destroyNestedBranches), branch.G?.forEach((scope) => {
747
728
  for (let id in scope.h)
748
729
  scope.h[id]?.abort();
749
730
  });
@@ -845,9 +826,9 @@ function trimWalkString(walkString) {
845
826
  return walkString.slice(0, end + 1);
846
827
  }
847
828
  function walk(startNode, walkCodes, branch) {
848
- walker.currentNode = startNode, walkInternal(walkCodes, branch, 0), walker.currentNode = document;
829
+ walker.currentNode = startNode, walkInternal(0, walkCodes, branch), walker.currentNode = document;
849
830
  }
850
- function walkInternal(walkCodes, scope, currentWalkIndex) {
831
+ function walkInternal(currentWalkIndex, walkCodes, scope) {
851
832
  let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
852
833
  for (; value2 = walkCodes.charCodeAt(currentWalkIndex++); )
853
834
  if (currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 >= 117 /* Multiplier */)
@@ -862,10 +843,13 @@ function walkInternal(walkCodes, scope, currentWalkIndex) {
862
843
  else if (value2 >= 67 /* Next */)
863
844
  for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
864
845
  walker.nextNode();
865
- else if (value2 === 47 /* BeginChild */) {
866
- let childScope = scope[currentScopeIndex++] = createScope(scope.$global);
867
- childScope.c = scope.c, currentWalkIndex = walkInternal(walkCodes, childScope, currentWalkIndex);
868
- } else {
846
+ else if (value2 === 47 /* BeginChild */)
847
+ currentWalkIndex = walkInternal(
848
+ currentWalkIndex,
849
+ walkCodes,
850
+ scope[currentScopeIndex++] = createScope(scope.$global, scope.c)
851
+ );
852
+ else {
869
853
  if (value2 === 38 /* EndChild */)
870
854
  return currentWalkIndex;
871
855
  if (value2 === 32 /* Get */)
@@ -882,7 +866,7 @@ function walkInternal(walkCodes, scope, currentWalkIndex) {
882
866
  function createBranchScopeWithRenderer(renderer, $global, parentScope, parentNode) {
883
867
  let branch = createBranch(
884
868
  $global,
885
- renderer.u || parentScope,
869
+ renderer.s || parentScope,
886
870
  parentScope
887
871
  );
888
872
  return initBranch(renderer, branch, parentNode), branch;
@@ -903,11 +887,11 @@ function createBranchScopeWithTagNameOrRenderer(tagNameOrRenderer, $global, pare
903
887
  }
904
888
  function createBranch($global, ownerScope, parentScope) {
905
889
  let branch = createScope($global), parentBranch = parentScope.c;
906
- 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;
890
+ return branch._ = ownerScope, branch.c = branch, parentBranch ? (branch.f = parentBranch.f + 1, branch.q = parentBranch, (parentBranch.j ||= /* @__PURE__ */ new Set()).add(branch)) : branch.f = 1, branch;
907
891
  }
908
892
  function initBranch(renderer, branch, parentNode) {
909
- let clone = renderer.l(parentNode.namespaceURI), cloneParent = clone.parentNode;
910
- walk(cloneParent?.firstChild || clone, renderer.G, branch), branch.a = cloneParent?.firstChild || clone, branch.b = cloneParent?.lastChild || clone, renderer.x && queueRender(branch, renderer.x);
893
+ let clone = renderer.k(parentNode.namespaceURI), cloneParent = clone.parentNode;
894
+ cloneParent ? (walk(cloneParent.firstChild, renderer.t, branch), branch.a = cloneParent.firstChild, branch.b = cloneParent.lastChild) : (walk(clone, renderer.t, branch), branch.a = branch.b = clone), renderer.u && queueRender(branch, renderer.u);
911
895
  }
912
896
  function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
913
897
  return (scope, attrsOrOp) => {
@@ -919,7 +903,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
919
903
  return renderer.d?.(childScope, attrsOrOp);
920
904
  let content = getContent?.(scope);
921
905
  if (typeof renderer == "string")
922
- setConditionalRendererOnlyChild(childScope, 0, content), attrs(childScope, 0, attrsOrOp());
906
+ setConditionalRendererOnlyChild(
907
+ childScope,
908
+ 0,
909
+ content,
910
+ createBranchScopeWithTagNameOrRenderer
911
+ ), attrs(childScope, 0, attrsOrOp());
923
912
  else if (renderer.d) {
924
913
  let attributes = attrsOrOp();
925
914
  renderer.d(
@@ -937,12 +926,12 @@ function dynamicTagAttrs(nodeAccessor, getContent, inputIsArgs) {
937
926
  function createRendererWithOwner(template, rawWalks, setup, getArgs) {
938
927
  let args, id = {}, walks = rawWalks ? /* @__PURE__ */ trimWalkString(rawWalks) : " ";
939
928
  return (owner) => ({
940
- j: id,
929
+ x: id,
941
930
  y: template,
942
- G: walks,
943
- x: setup,
944
- l: _clone,
945
- u: owner,
931
+ t: walks,
932
+ u: setup,
933
+ k: _clone,
934
+ s: owner,
946
935
  get d() {
947
936
  return args ||= getArgs?.();
948
937
  }
@@ -964,57 +953,52 @@ function createCloneableHTML(html2, ns) {
964
953
  }
965
954
 
966
955
  // src/dom/control-flow.ts
967
- function patchConditionals(fn) {
968
- conditional = fn(conditional), conditionalOnlyChild = fn(conditionalOnlyChild);
956
+ function conditional(nodeAccessor, ...branches) {
957
+ let branchAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
958
+ return (scope, newBranchIndexOrOp) => {
959
+ newBranchIndexOrOp !== scope[branchAccessor] && newBranchIndexOrOp !== DIRTY && newBranchIndexOrOp !== MARK && newBranchIndexOrOp !== CLEAN && (scope[nodeAccessor].nodeType > 1 /* Element */ ? setConditionalRenderer : setConditionalRendererOnlyChild)(
960
+ scope,
961
+ nodeAccessor,
962
+ branches[scope[branchAccessor] = newBranchIndexOrOp],
963
+ createBranchScopeWithRenderer
964
+ );
965
+ };
969
966
  }
970
- var conditional = function(nodeAccessor, fn, getIntersection) {
967
+ function patchDynamicTag(fn) {
968
+ dynamicTag = fn(dynamicTag);
969
+ }
970
+ var dynamicTag = function(nodeAccessor, fn, getIntersection) {
971
971
  let rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
972
972
  return (scope, newRendererOrOp) => {
973
973
  if (newRendererOrOp === DIRTY) return;
974
974
  let currentRenderer = scope[rendererAccessor], op = newRendererOrOp;
975
975
  if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
976
976
  let normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
977
- isDifferentRenderer(normalizedRenderer, currentRenderer) ? (scope[rendererAccessor] = normalizedRenderer, setConditionalRenderer(scope, nodeAccessor, normalizedRenderer), fn && fn(scope), op = DIRTY) : op = CLEAN;
977
+ isDifferentRenderer(normalizedRenderer, currentRenderer) ? (scope[rendererAccessor] = normalizedRenderer, setConditionalRenderer(
978
+ scope,
979
+ nodeAccessor,
980
+ normalizedRenderer,
981
+ createBranchScopeWithTagNameOrRenderer
982
+ ), fn && fn(scope), op = DIRTY) : op = CLEAN;
978
983
  }
979
984
  intersection2?.(scope, op);
980
985
  };
981
986
  };
982
- function setConditionalRenderer(scope, nodeAccessor, newRenderer) {
983
- let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] || getEmptyBranch(scope[nodeAccessor]), newBranch = newRenderer ? createBranchScopeWithTagNameOrRenderer(
987
+ function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch2) {
988
+ let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */] || getEmptyBranch(scope[nodeAccessor]), newBranch = newRenderer ? createBranch2(
984
989
  newRenderer,
985
990
  scope.$global,
986
991
  scope,
987
992
  prevBranch.b.parentNode
988
993
  ) : getEmptyBranch(scope[nodeAccessor]);
989
- insertBranchBefore(
994
+ prevBranch !== newBranch && (insertBranchBefore(
990
995
  newBranch,
991
996
  prevBranch.b.parentNode,
992
997
  prevBranch.b.nextSibling
993
- ), removeAndDestroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch;
998
+ ), removeAndDestroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newRenderer && newBranch);
994
999
  }
995
- var conditionalOnlyChild = function(nodeAccessor, fn, getIntersection) {
996
- let rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
997
- return (scope, newRendererOrOp) => {
998
- if (newRendererOrOp === DIRTY) return;
999
- let currentRenderer = scope[rendererAccessor], op = newRendererOrOp;
1000
- if (newRendererOrOp !== MARK && newRendererOrOp !== CLEAN) {
1001
- let normalizedRenderer = normalizeDynamicRenderer(newRendererOrOp);
1002
- isDifferentRenderer(normalizedRenderer, currentRenderer) ? (currentRenderer = scope[rendererAccessor] = normalizedRenderer, setConditionalRendererOnlyChild(
1003
- scope,
1004
- nodeAccessor,
1005
- normalizedRenderer
1006
- ), fn && fn(scope), op = DIRTY) : op = CLEAN;
1007
- }
1008
- intersection2?.(scope, op);
1009
- };
1010
- };
1011
- function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer) {
1012
- let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */], referenceNode = scope[nodeAccessor], newBranch = newRenderer && createBranchScopeWithTagNameOrRenderer(
1013
- newRenderer,
1014
- scope.$global,
1015
- scope,
1016
- referenceNode
1017
- );
1000
+ function setConditionalRendererOnlyChild(scope, nodeAccessor, newRenderer, createBranch2) {
1001
+ let prevBranch = scope[nodeAccessor + "!" /* ConditionalScope */], referenceNode = scope[nodeAccessor], newBranch = newRenderer && createBranch2(newRenderer, scope.$global, scope, referenceNode);
1018
1002
  referenceNode.textContent = "", newBranch && insertBranchBefore(newBranch, referenceNode, null), prevBranch && destroyBranch(prevBranch), scope[nodeAccessor + "!" /* ConditionalScope */] = newBranch;
1019
1003
  }
1020
1004
  var emptyMarkerMap = /* @__PURE__ */ new Map([
@@ -1078,7 +1062,24 @@ function byFirstArg(name) {
1078
1062
  return name;
1079
1063
  }
1080
1064
  function isDifferentRenderer(a, b) {
1081
- return a !== b && (a?.j || 0) !== b?.j;
1065
+ return a !== b && (a?.x || 0) !== b?.x;
1066
+ }
1067
+
1068
+ // src/dom/schedule.ts
1069
+ var port2 = /* @__PURE__ */ (() => {
1070
+ let { port1, port2: port22 } = new MessageChannel();
1071
+ return port1.onmessage = () => {
1072
+ isScheduled = !1, run();
1073
+ }, port22;
1074
+ })(), isScheduled;
1075
+ function schedule() {
1076
+ isScheduled || (isScheduled = !0, queueMicrotask(flushAndWaitFrame));
1077
+ }
1078
+ function flushAndWaitFrame() {
1079
+ run(), requestAnimationFrame(triggerMacroTask);
1080
+ }
1081
+ function triggerMacroTask() {
1082
+ port2.postMessage(0);
1082
1083
  }
1083
1084
 
1084
1085
  // src/dom/signals.ts
@@ -1088,63 +1089,81 @@ function state(valueAccessor, fn, getIntersection) {
1088
1089
  return (scope, valueOrOp, valueChange) => (rendering ? valueSignal(
1089
1090
  scope,
1090
1091
  valueOrOp === MARK || valueOrOp === CLEAN || valueOrOp === DIRTY || (scope[valueChangeAccessor] = valueChange) || scope[markAccessor] === void 0 ? valueOrOp : CLEAN
1091
- ) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : queueSource(scope, valueSignal, valueOrOp), valueOrOp);
1092
+ ) : scope[valueChangeAccessor] ? scope[valueChangeAccessor](valueOrOp) : (schedule(), queueSource(scope, valueSignal, valueOrOp)), valueOrOp);
1092
1093
  }
1093
1094
  function value(valueAccessor, fn, getIntersection) {
1094
- let markAccessor = valueAccessor + "#" /* Mark */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1095
+ let markAccessor = valueAccessor + "#" /* Mark */, intersection2;
1095
1096
  return (scope, valueOrOp) => {
1096
1097
  if (valueOrOp === MARK)
1097
- (scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && intersection2?.(scope, MARK);
1098
+ (scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK);
1098
1099
  else if (valueOrOp !== DIRTY) {
1099
1100
  let existing = scope[markAccessor] !== void 0;
1100
- (scope[markAccessor] ||= 1) === 1 && (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp ? intersection2?.(scope, CLEAN) : (scope[valueAccessor] = valueOrOp, fn && fn(scope, valueOrOp), intersection2?.(scope, DIRTY))), scope[markAccessor]--;
1101
+ (scope[markAccessor] ||= 1) === 1 && (valueOrOp === CLEAN || existing && scope[valueAccessor] === valueOrOp ? getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN) : (scope[valueAccessor] = valueOrOp, fn && fn(scope, valueOrOp), getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY))), scope[markAccessor]--;
1101
1102
  }
1102
1103
  };
1103
1104
  }
1104
1105
  var accessorId = 0;
1105
1106
  function intersection(count, fn, getIntersection) {
1106
- let dirtyAccessor = "?" /* Dynamic */ + accessorId++, markAccessor = dirtyAccessor + "#" /* Mark */, intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1107
+ let dirtyAccessor = "?" /* Dynamic */ + accessorId++, markAccessor = dirtyAccessor + "#" /* Mark */, intersection2;
1107
1108
  return (scope, op) => {
1108
- op === MARK ? (scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && intersection2?.(scope, MARK) : scope[markAccessor] === void 0 ? (scope[markAccessor] = count - 1, scope[dirtyAccessor] = !0) : --scope[markAccessor] === 0 ? op === DIRTY || scope[dirtyAccessor] ? (scope[dirtyAccessor] = !1, fn(scope, 0), intersection2?.(scope, DIRTY)) : intersection2?.(scope, CLEAN) : scope[dirtyAccessor] ||= op === DIRTY;
1109
- };
1110
- }
1111
- function closure(fn, getIntersection) {
1112
- let intersection2 = getIntersection && ((scope, op) => (intersection2 = getIntersection())(scope, op));
1113
- return (scope, valueOrOp) => {
1114
- valueOrOp === MARK ? intersection2?.(scope, MARK) : (fn && fn(scope, valueOrOp), intersection2?.(scope, DIRTY));
1109
+ op === MARK ? (scope[markAccessor] = (scope[markAccessor] ?? 0) + 1) === 1 && getIntersection && (intersection2 ||= getIntersection())(scope, MARK) : scope[markAccessor] === void 0 ? (scope[markAccessor] = count - 1, scope[dirtyAccessor] = !0) : --scope[markAccessor] === 0 ? op === DIRTY || scope[dirtyAccessor] ? (scope[dirtyAccessor] = !1, fn(scope), getIntersection && (intersection2 ||= getIntersection())(scope, DIRTY)) : getIntersection && (intersection2 ||= getIntersection())(scope, CLEAN) : scope[dirtyAccessor] ||= op === DIRTY;
1115
1110
  };
1116
1111
  }
1117
- function loopClosure(ownerLoopNodeAccessor, fn, getIntersection) {
1118
- let signal = closure(fn, getIntersection), loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */, loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */, helperSignal = (ownerScope, value2) => {
1112
+ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn, getIntersection) {
1113
+ let childSignal = closure(valueAccessor, fn, getIntersection), loopScopeAccessor = ownerLoopNodeAccessor + "!" /* LoopScopeArray */, loopScopeMapAccessor = ownerLoopNodeAccessor + "(" /* LoopScopeMap */, ownerSignal = (ownerScope) => {
1119
1114
  let loopScopes = ownerScope[loopScopeAccessor] ?? ownerScope[loopScopeMapAccessor]?.values() ?? [];
1120
1115
  if (loopScopes !== emptyMarkerArray)
1121
1116
  for (let scope of loopScopes)
1122
- scope.g || queueSource(scope, signal, value2);
1117
+ scope.g || queueSource(scope, childSignal);
1123
1118
  };
1124
- return helperSignal._ = signal, helperSignal;
1119
+ return ownerSignal._ = childSignal, ownerSignal;
1125
1120
  }
1126
- function conditionalClosure(ownerConditionalNodeAccessor, getRenderer, fn, getIntersection) {
1127
- let signal = closure(fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, rendererAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, helperSignal = (scope, value2) => {
1128
- let conditionalScope = scope[scopeAccessor];
1129
- conditionalScope && !conditionalScope.g && scope[rendererAccessor]?.j === getRenderer().j && queueSource(conditionalScope, signal, value2);
1121
+ function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn, getIntersection) {
1122
+ let childSignal = closure(valueAccessor, fn, getIntersection), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
1123
+ let ifScope = scope[scopeAccessor];
1124
+ ifScope && !ifScope.g && scope[branchAccessor] === branch && queueSource(ifScope, childSignal);
1130
1125
  };
1131
- return helperSignal._ = signal, helperSignal;
1132
- }
1133
- var defaultGetOwnerScope = (scope) => scope._;
1134
- function dynamicClosure(fn, getOwnerScope = defaultGetOwnerScope, getIntersection) {
1135
- let ownerSubscribersAccessor = "?" /* Dynamic */ + accessorId++, _signal = closure(fn, getIntersection), helperSignal = (ownerScope, value2) => {
1136
- let subscribers = ownerScope[ownerSubscribersAccessor];
1126
+ return ownerSignal._ = childSignal, ownerSignal;
1127
+ }
1128
+ function dynamicClosure(valueAccessor, fn, getIntersection, getOwnerScope) {
1129
+ let subscribersAccessor = "?" /* Dynamic */ + accessorId++, childSignal = closure(
1130
+ valueAccessor,
1131
+ fn,
1132
+ getIntersection,
1133
+ getOwnerScope
1134
+ ), ownerSignal = (ownerScope) => {
1135
+ let subscribers = ownerScope[subscribersAccessor];
1137
1136
  if (subscribers)
1138
1137
  for (let subscriber of subscribers)
1139
- subscriber.g || queueSource(subscriber, _signal, value2);
1140
- }, setupSignal = (scope, value2) => {
1141
- _signal(scope, value2), subscribe(scope);
1138
+ subscriber.g || queueSource(subscriber, childSignal);
1142
1139
  }, subscribe = (scope) => {
1143
- (getOwnerScope(scope)[ownerSubscribersAccessor] ||= /* @__PURE__ */ new Set()).add(scope), getAbortSignal(scope, -1).addEventListener("abort", () => {
1144
- getOwnerScope(scope)[ownerSubscribersAccessor].delete(scope);
1145
- });
1140
+ let owner = getOwnerScope ? getOwnerScope(scope) : scope._, subscribers = owner[subscribersAccessor] ||= /* @__PURE__ */ new Set();
1141
+ subscribers.has(scope) || (subscribers.add(scope), getAbortSignal(scope, -1).addEventListener(
1142
+ "abort",
1143
+ () => owner[subscribersAccessor].delete(scope)
1144
+ ));
1145
+ };
1146
+ return ownerSignal.H = subscribe, ownerSignal._ = (scope) => {
1147
+ childSignal(scope), subscribe(scope);
1148
+ }, ownerSignal;
1149
+ }
1150
+ function registerDynamicClosure(id, valueAccessor, fn, getIntersection, getOwnerScope) {
1151
+ let signal = dynamicClosure(
1152
+ valueAccessor,
1153
+ fn,
1154
+ getIntersection,
1155
+ getOwnerScope
1156
+ );
1157
+ return register(id, signal.H), signal;
1158
+ }
1159
+ function closure(valueAccessor, fn, getIntersection, getOwnerScope) {
1160
+ let intersection2;
1161
+ return (scope, op) => {
1162
+ op || fn && fn(
1163
+ scope,
1164
+ (getOwnerScope ? getOwnerScope(scope) : scope._)[valueAccessor]
1165
+ ), getIntersection && (intersection2 ||= getIntersection())(scope, op ? MARK : DIRTY);
1146
1166
  };
1147
- return helperSignal._ = setupSignal, helperSignal.D = subscribe, helperSignal;
1148
1167
  }
1149
1168
  function setTagVar(scope, childAccessor, tagVarSignal2) {
1150
1169
  scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
@@ -1179,16 +1198,16 @@ function effect(id, fn) {
1179
1198
  // src/dom/queue.ts
1180
1199
  var pendingRenders = [], pendingEffects = [], rendering = !1;
1181
1200
  function queueSource(scope, signal, value2) {
1182
- schedule();
1183
1201
  let prevRendering = rendering;
1184
- return rendering = !0, signal(scope, MARK), rendering = prevRendering, queueRender(scope, signal, value2), value2;
1202
+ rendering = !0, signal(scope, MARK), rendering = prevRendering, queueRender(scope, signal, value2);
1185
1203
  }
1186
1204
  function queueRender(scope, signal, value2) {
1187
1205
  let i = pendingRenders.length, render = {
1188
- m: scope,
1189
- H: signal,
1190
- I: value2,
1191
- z: i
1206
+ z: scope,
1207
+ I: signal,
1208
+ J: value2,
1209
+ A: scope.c?.f || 0,
1210
+ B: i
1192
1211
  };
1193
1212
  for (pendingRenders.push(render); i; ) {
1194
1213
  let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
@@ -1219,7 +1238,7 @@ function prepareEffects(fn) {
1219
1238
  }
1220
1239
  return preparedEffects;
1221
1240
  }
1222
- function runEffects(effects = pendingEffects) {
1241
+ function runEffects(effects) {
1223
1242
  for (let i = 0; i < effects.length; i += 2 /* Total */) {
1224
1243
  let scope = effects[i], fn = effects[i + 1];
1225
1244
  fn(scope, scope);
@@ -1241,15 +1260,12 @@ function runRenders() {
1241
1260
  }
1242
1261
  pendingRenders[i] = item;
1243
1262
  }
1244
- render.m.c?.E || render.H(render.m, render.I);
1263
+ render.z.c?.F || render.I(render.z, render.J);
1245
1264
  }
1246
1265
  finishPendingScopes();
1247
1266
  }
1248
1267
  function comparePendingRenders(a, b) {
1249
- return getBranchDepth(a) - getBranchDepth(b) || a.z - b.z;
1250
- }
1251
- function getBranchDepth(render) {
1252
- return render.m.c?.f || 0;
1268
+ return a.A - b.A || a.B - b.B;
1253
1269
  }
1254
1270
 
1255
1271
  // src/dom/abort-signal.ts
@@ -1258,7 +1274,7 @@ function resetAbortSignal(scope, id) {
1258
1274
  ctrl && (queueEffect(ctrl, abort), scope.h[id] = void 0);
1259
1275
  }
1260
1276
  function getAbortSignal(scope, id) {
1261
- return scope.c && (scope.c.F ||= /* @__PURE__ */ new Set()).add(scope), ((scope.h ||= {})[id] ||= new AbortController()).signal;
1277
+ return scope.c && (scope.c.G ||= /* @__PURE__ */ new Set()).add(scope), ((scope.h ||= {})[id] ||= new AbortController()).signal;
1262
1278
  }
1263
1279
  function abort(ctrl) {
1264
1280
  ctrl.abort();
@@ -1269,7 +1285,7 @@ var prefix = "$C_", RENDERER_REGISTER_ID = prefix + "r", SET_SCOPE_REGISTER_ID =
1269
1285
 
1270
1286
  // src/dom/compat.ts
1271
1287
  var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1272
- patchConditionals,
1288
+ patchConditionals: patchDynamicTag,
1273
1289
  queueEffect,
1274
1290
  init(warp10Noop) {
1275
1291
  register(SET_SCOPE_REGISTER_ID, (branch) => {
@@ -1283,7 +1299,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1283
1299
  return value2 === MARK || value2 === CLEAN || value2 === DIRTY;
1284
1300
  },
1285
1301
  isRenderer(renderer) {
1286
- return renderer.l;
1302
+ return renderer.k;
1287
1303
  },
1288
1304
  getStartNode(branch) {
1289
1305
  return branch.a;
@@ -1303,12 +1319,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1303
1319
  }) {
1304
1320
  return Array.isArray(value2) && typeof value2[0] == "string" ? getRegisteredWithScope(
1305
1321
  value2[0],
1306
- value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.o[value2[1]]
1322
+ value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.m[value2[1]]
1307
1323
  ) : value2;
1308
1324
  },
1309
1325
  createRenderer(setup, clone, args) {
1310
1326
  let renderer = createRenderer("", 0, setup, args && (() => args));
1311
- return renderer.l = clone, renderer;
1327
+ return renderer.k = clone, renderer;
1312
1328
  },
1313
1329
  render(out, component, renderer, args) {
1314
1330
  let branch = component.scope;
@@ -1320,7 +1336,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1320
1336
  normalizedInput[key === "renderBody" ? "content" : key] = input[key];
1321
1337
  }
1322
1338
  if (component.effects = prepareEffects(() => {
1323
- branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.u, initBranch(renderer, branch, document.body)), applyArgs(branch, args);
1339
+ branch ? (applyArgs(branch, MARK), existing = !0) : (branch = component.scope = createScope(out.global), branch._ = renderer.s, initBranch(renderer, branch, document.body)), applyArgs(branch, args);
1324
1340
  }), !existing)
1325
1341
  return toInsertNode(branch.a, branch.b);
1326
1342
  }
@@ -1362,14 +1378,14 @@ function mount(input = {}, reference, position) {
1362
1378
  branch.a,
1363
1379
  branch.b
1364
1380
  ), runEffects(effects), {
1365
- update: (newInput) => {
1381
+ update(newInput) {
1366
1382
  args && runEffects(
1367
1383
  prepareEffects(() => {
1368
1384
  args(branch, MARK), args(branch, [newInput]);
1369
1385
  })
1370
1386
  );
1371
1387
  },
1372
- destroy: () => {
1388
+ destroy() {
1373
1389
  removeAndDestroyBranch(branch);
1374
1390
  }
1375
1391
  };