marko 6.0.15 → 6.0.17

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.js CHANGED
@@ -60,6 +60,7 @@ __export(dom_exports, {
60
60
  init: () => init,
61
61
  intersection: () => intersection,
62
62
  lifecycle: () => lifecycle,
63
+ localClosures: () => localClosures,
63
64
  loopClosure: () => loopClosure,
64
65
  loopIn: () => loopIn,
65
66
  loopOf: () => loopOf,
@@ -821,124 +822,6 @@ function longestIncreasingSubsequence(a) {
821
822
  return result;
822
823
  }
823
824
 
824
- // src/dom/walker.ts
825
- var walker = /* @__PURE__ */ document.createTreeWalker(document);
826
- function walk(startNode, walkCodes, branch) {
827
- walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
828
- }
829
- function walkInternal(currentWalkIndex, walkCodes, scope) {
830
- let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
831
- for (; currentWalkIndex < walkCodes.length; )
832
- if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */) {
833
- let node = walker.currentNode;
834
- scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
835
- } else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */)
836
- walker.currentNode.replaceWith(
837
- walker.currentNode = scope[currentScopeIndex++] = new Text()
838
- ), value2 === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
839
- else {
840
- if (value2 === 38 /* EndChild */)
841
- return currentWalkIndex;
842
- if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */)
843
- currentWalkIndex = walkInternal(
844
- currentWalkIndex,
845
- walkCodes,
846
- scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
847
- ), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
848
- else if (value2 < 92)
849
- for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
850
- walker.nextNode();
851
- else if (value2 < 107)
852
- for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
853
- walker.nextSibling();
854
- else if (value2 < 117) {
855
- for (value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */; value2--; )
856
- walker.parentNode();
857
- walker.nextSibling();
858
- } else
859
- storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
860
- }
861
- }
862
-
863
- // src/dom/renderer.ts
864
- function createBranch($global, renderer, parentScope, parentNode) {
865
- let branch = createScope($global), parentBranch = parentScope?.k;
866
- return branch._ = renderer.y || parentScope, branch.k = branch, parentBranch && (branch.u = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch)), renderer.C?.(
867
- branch,
868
- parentNode.namespaceURI
869
- ), branch;
870
- }
871
- function createAndSetupBranch($global, renderer, parentScope, parentNode) {
872
- return setupBranch(
873
- renderer,
874
- createBranch($global, renderer, parentScope, parentNode)
875
- );
876
- }
877
- function setupBranch(renderer, branch) {
878
- return (renderer.D || renderer.E) && queueRender(
879
- branch,
880
- (branch2) => {
881
- renderer.D?.(branch2), renderer.E?.(branch2);
882
- },
883
- -1
884
- ), branch;
885
- }
886
- function createContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
887
- walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup ||= void 0, params ||= void 0, closures = closures ? closures._ || closures : void 0;
888
- let clone = template ? (branch, ns) => {
889
- ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
890
- template,
891
- ns
892
- ))(branch, walks);
893
- } : (branch) => {
894
- walk(
895
- branch.h = branch.j = new Text(),
896
- walks,
897
- branch
898
- );
899
- };
900
- return (owner) => ({
901
- m: id,
902
- C: clone,
903
- y: owner,
904
- D: setup,
905
- l: params,
906
- E: closures,
907
- z: dynamicScopesAccessor
908
- });
909
- }
910
- function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
911
- return register(
912
- id,
913
- createContent(
914
- id,
915
- template,
916
- walks,
917
- setup,
918
- params,
919
- closures,
920
- dynamicScopesAccessor
921
- )
922
- );
923
- }
924
- function createRenderer(template, walks, setup, params, closures) {
925
- return createContent("", template, walks, setup, params, closures)();
926
- }
927
- var cloneCache = {};
928
- function createCloneableHTML(html2, ns) {
929
- let { firstChild, lastChild } = parseHTML(html2, ns), parent = document.createElementNS(ns, "t");
930
- return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
931
- walk(
932
- branch.h = branch.j = firstChild.cloneNode(!0),
933
- walks,
934
- branch
935
- );
936
- } : (branch, walks) => {
937
- let clone = parent.cloneNode(!0);
938
- walk(clone.firstChild, walks, branch), branch.h = clone.firstChild, branch.j = clone.lastChild;
939
- };
940
- }
941
-
942
825
  // src/dom/schedule.ts
943
826
  var isScheduled, channel;
944
827
  function schedule() {
@@ -1009,7 +892,7 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
1009
892
  ));
1010
893
  }
1011
894
  function dynamicClosure(...closureSignals) {
1012
- let [{ F: ___scopeInstancesAccessor, G: ___signalIndexAccessor }] = closureSignals;
895
+ let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
1013
896
  for (let i = closureSignals.length; i--; )
1014
897
  closureSignals[i].L = i;
1015
898
  return (scope) => {
@@ -1024,13 +907,13 @@ function dynamicClosure(...closureSignals) {
1024
907
  }
1025
908
  function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
1026
909
  let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
1027
- scope[closureSignal.G] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
910
+ scope[closureSignal.F] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
1028
911
  getOwnerScope ? getOwnerScope(scope) : scope._,
1029
- closureSignal.F,
912
+ closureSignal.E,
1030
913
  scope
1031
914
  );
1032
915
  };
1033
- return closureSignal.F = "a" /* ClosureScopes */ + valueAccessor, closureSignal.G = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
916
+ return closureSignal.E = "a" /* ClosureScopes */ + valueAccessor, closureSignal.F = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
1034
917
  }
1035
918
  function closure(valueAccessor, fn, getOwnerScope) {
1036
919
  return (scope) => {
@@ -1071,6 +954,118 @@ function hoist(...path) {
1071
954
  };
1072
955
  }
1073
956
 
957
+ // src/dom/walker.ts
958
+ var walker = /* @__PURE__ */ document.createTreeWalker(document);
959
+ function walk(startNode, walkCodes, branch) {
960
+ walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
961
+ }
962
+ function walkInternal(currentWalkIndex, walkCodes, scope) {
963
+ let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
964
+ for (; currentWalkIndex < walkCodes.length; )
965
+ if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */) {
966
+ let node = walker.currentNode;
967
+ scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
968
+ } else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */)
969
+ walker.currentNode.replaceWith(
970
+ walker.currentNode = scope[currentScopeIndex++] = new Text()
971
+ ), value2 === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
972
+ else {
973
+ if (value2 === 38 /* EndChild */)
974
+ return currentWalkIndex;
975
+ if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */)
976
+ currentWalkIndex = walkInternal(
977
+ currentWalkIndex,
978
+ walkCodes,
979
+ scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
980
+ ), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
981
+ else if (value2 < 92)
982
+ for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
983
+ walker.nextNode();
984
+ else if (value2 < 107)
985
+ for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
986
+ walker.nextSibling();
987
+ else if (value2 < 117) {
988
+ for (value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */; value2--; )
989
+ walker.parentNode();
990
+ walker.nextSibling();
991
+ } else
992
+ storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
993
+ }
994
+ }
995
+
996
+ // src/dom/renderer.ts
997
+ function createBranch($global, renderer, parentScope, parentNode) {
998
+ let branch = createScope($global), parentBranch = parentScope?.k;
999
+ return branch._ = renderer.y || parentScope, branch.k = branch, parentBranch && (branch.u = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch)), renderer.C?.(
1000
+ branch,
1001
+ parentNode.namespaceURI
1002
+ ), branch;
1003
+ }
1004
+ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1005
+ return setupBranch(
1006
+ renderer,
1007
+ createBranch($global, renderer, parentScope, parentNode)
1008
+ );
1009
+ }
1010
+ function setupBranch(renderer, branch) {
1011
+ return renderer.D && queueRender(branch, renderer.D, -1), branch;
1012
+ }
1013
+ function createContent(id, template, walks, setup, params, dynamicScopesAccessor) {
1014
+ walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
1015
+ let clone = template ? (branch, ns) => {
1016
+ ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
1017
+ template,
1018
+ ns
1019
+ ))(branch, walks);
1020
+ } : (branch) => {
1021
+ walk(
1022
+ branch.h = branch.j = new Text(),
1023
+ walks,
1024
+ branch
1025
+ );
1026
+ };
1027
+ return (owner) => ({
1028
+ m: id,
1029
+ C: clone,
1030
+ y: owner,
1031
+ D: setup,
1032
+ l: params,
1033
+ z: dynamicScopesAccessor
1034
+ });
1035
+ }
1036
+ function registerContent(id, template, walks, setup, params, dynamicScopesAccessor) {
1037
+ return register(
1038
+ id,
1039
+ createContent(id, template, walks, setup, params, dynamicScopesAccessor)
1040
+ );
1041
+ }
1042
+ function localClosures(renderer, closureFns) {
1043
+ let closureSignals = {};
1044
+ for (let key in closureFns)
1045
+ closureSignals[key] = value(key, closureFns[key]);
1046
+ return (owner, closureValues) => {
1047
+ let instance = renderer(owner);
1048
+ return instance.G = closureSignals, instance.M = closureValues, instance;
1049
+ };
1050
+ }
1051
+ function createRenderer(template, walks, setup, params) {
1052
+ return createContent("", template, walks, setup, params)();
1053
+ }
1054
+ var cloneCache = {};
1055
+ function createCloneableHTML(html2, ns) {
1056
+ let { firstChild, lastChild } = parseHTML(html2, ns), parent = document.createElementNS(ns, "t");
1057
+ return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
1058
+ walk(
1059
+ branch.h = branch.j = firstChild.cloneNode(!0),
1060
+ walks,
1061
+ branch
1062
+ );
1063
+ } : (branch, walks) => {
1064
+ let clone = parent.cloneNode(!0);
1065
+ walk(clone.firstChild, walks, branch), branch.h = clone.firstChild, branch.j = clone.lastChild;
1066
+ };
1067
+ }
1068
+
1074
1069
  // src/dom/control-flow.ts
1075
1070
  function awaitTag(nodeAccessor, renderer) {
1076
1071
  let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
@@ -1212,26 +1207,33 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1212
1207
  scope[childScopeAccessor]
1213
1208
  );
1214
1209
  if (normalizedRenderer) {
1215
- let args = getInput?.();
1210
+ let childScope = scope[childScopeAccessor], args = getInput?.();
1216
1211
  if (typeof normalizedRenderer == "string")
1217
1212
  attrs(
1218
- scope[childScopeAccessor],
1213
+ childScope,
1219
1214
  0,
1220
1215
  (inputIsArgs ? args[0] : args) || {}
1221
1216
  );
1222
- else if (normalizedRenderer.l)
1223
- if (inputIsArgs)
1224
- normalizedRenderer.l(
1225
- scope[childScopeAccessor],
1226
- normalizedRenderer._ ? args[0] : args
1227
- );
1228
- else {
1229
- let inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
1230
- normalizedRenderer.l(
1231
- scope[childScopeAccessor],
1232
- normalizedRenderer._ ? inputWithContent : [inputWithContent]
1217
+ else {
1218
+ for (let accessor in normalizedRenderer.G)
1219
+ normalizedRenderer.G[accessor](
1220
+ childScope,
1221
+ normalizedRenderer.M[accessor]
1233
1222
  );
1234
- }
1223
+ if (normalizedRenderer.l)
1224
+ if (inputIsArgs)
1225
+ normalizedRenderer.l(
1226
+ childScope,
1227
+ normalizedRenderer._ ? args[0] : args
1228
+ );
1229
+ else {
1230
+ let inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
1231
+ normalizedRenderer.l(
1232
+ childScope,
1233
+ normalizedRenderer._ ? inputWithContent : [inputWithContent]
1234
+ );
1235
+ }
1236
+ }
1235
1237
  }
1236
1238
  };
1237
1239
  };
@@ -1308,7 +1310,7 @@ function queueRender(scope, signal, signalKey, value2, scopeKey = scope.m) {
1308
1310
  let render = {
1309
1311
  t: key,
1310
1312
  o: scope,
1311
- M: signal,
1313
+ N: signal,
1312
1314
  I: value2
1313
1315
  }, i = pendingRenders.push(render) - 1;
1314
1316
  for (; i; ) {
@@ -1367,7 +1369,7 @@ function runRenders() {
1367
1369
  scope.q = 0;
1368
1370
  pendingScopes = [];
1369
1371
  }
1370
- var runRender = (render) => render.M(render.o, render.I), enableCatch = () => {
1372
+ var runRender = (render) => render.N(render.o, render.I), enableCatch = () => {
1371
1373
  enableCatch = () => {
1372
1374
  }, enableBranches();
1373
1375
  let handlePendingTry = (fn, scope, branch) => {
package/dist/dom.mjs CHANGED
@@ -732,124 +732,6 @@ function longestIncreasingSubsequence(a) {
732
732
  return result;
733
733
  }
734
734
 
735
- // src/dom/walker.ts
736
- var walker = /* @__PURE__ */ document.createTreeWalker(document);
737
- function walk(startNode, walkCodes, branch) {
738
- walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
739
- }
740
- function walkInternal(currentWalkIndex, walkCodes, scope) {
741
- let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
742
- for (; currentWalkIndex < walkCodes.length; )
743
- if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */) {
744
- let node = walker.currentNode;
745
- scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
746
- } else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */)
747
- walker.currentNode.replaceWith(
748
- walker.currentNode = scope[currentScopeIndex++] = new Text()
749
- ), value2 === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
750
- else {
751
- if (value2 === 38 /* EndChild */)
752
- return currentWalkIndex;
753
- if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */)
754
- currentWalkIndex = walkInternal(
755
- currentWalkIndex,
756
- walkCodes,
757
- scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
758
- ), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
759
- else if (value2 < 92)
760
- for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
761
- walker.nextNode();
762
- else if (value2 < 107)
763
- for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
764
- walker.nextSibling();
765
- else if (value2 < 117) {
766
- for (value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */; value2--; )
767
- walker.parentNode();
768
- walker.nextSibling();
769
- } else
770
- storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
771
- }
772
- }
773
-
774
- // src/dom/renderer.ts
775
- function createBranch($global, renderer, parentScope, parentNode) {
776
- let branch = createScope($global), parentBranch = parentScope?.k;
777
- return branch._ = renderer.y || parentScope, branch.k = branch, parentBranch && (branch.u = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch)), renderer.C?.(
778
- branch,
779
- parentNode.namespaceURI
780
- ), branch;
781
- }
782
- function createAndSetupBranch($global, renderer, parentScope, parentNode) {
783
- return setupBranch(
784
- renderer,
785
- createBranch($global, renderer, parentScope, parentNode)
786
- );
787
- }
788
- function setupBranch(renderer, branch) {
789
- return (renderer.D || renderer.E) && queueRender(
790
- branch,
791
- (branch2) => {
792
- renderer.D?.(branch2), renderer.E?.(branch2);
793
- },
794
- -1
795
- ), branch;
796
- }
797
- function createContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
798
- walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup ||= void 0, params ||= void 0, closures = closures ? closures._ || closures : void 0;
799
- let clone = template ? (branch, ns) => {
800
- ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
801
- template,
802
- ns
803
- ))(branch, walks);
804
- } : (branch) => {
805
- walk(
806
- branch.h = branch.j = new Text(),
807
- walks,
808
- branch
809
- );
810
- };
811
- return (owner) => ({
812
- m: id,
813
- C: clone,
814
- y: owner,
815
- D: setup,
816
- l: params,
817
- E: closures,
818
- z: dynamicScopesAccessor
819
- });
820
- }
821
- function registerContent(id, template, walks, setup, params, closures, dynamicScopesAccessor) {
822
- return register(
823
- id,
824
- createContent(
825
- id,
826
- template,
827
- walks,
828
- setup,
829
- params,
830
- closures,
831
- dynamicScopesAccessor
832
- )
833
- );
834
- }
835
- function createRenderer(template, walks, setup, params, closures) {
836
- return createContent("", template, walks, setup, params, closures)();
837
- }
838
- var cloneCache = {};
839
- function createCloneableHTML(html2, ns) {
840
- let { firstChild, lastChild } = parseHTML(html2, ns), parent = document.createElementNS(ns, "t");
841
- return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
842
- walk(
843
- branch.h = branch.j = firstChild.cloneNode(!0),
844
- walks,
845
- branch
846
- );
847
- } : (branch, walks) => {
848
- let clone = parent.cloneNode(!0);
849
- walk(clone.firstChild, walks, branch), branch.h = clone.firstChild, branch.j = clone.lastChild;
850
- };
851
- }
852
-
853
735
  // src/dom/schedule.ts
854
736
  var isScheduled, channel;
855
737
  function schedule() {
@@ -920,7 +802,7 @@ function subscribeToScopeSet(ownerScope, accessor, scope) {
920
802
  ));
921
803
  }
922
804
  function dynamicClosure(...closureSignals) {
923
- let [{ F: ___scopeInstancesAccessor, G: ___signalIndexAccessor }] = closureSignals;
805
+ let [{ E: ___scopeInstancesAccessor, F: ___signalIndexAccessor }] = closureSignals;
924
806
  for (let i = closureSignals.length; i--; )
925
807
  closureSignals[i].L = i;
926
808
  return (scope) => {
@@ -935,13 +817,13 @@ function dynamicClosure(...closureSignals) {
935
817
  }
936
818
  function dynamicClosureRead(valueAccessor, fn, getOwnerScope) {
937
819
  let childSignal = closure(valueAccessor, fn, getOwnerScope), closureSignal = (scope) => {
938
- scope[closureSignal.G] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
820
+ scope[closureSignal.F] = closureSignal.L, childSignal(scope), subscribeToScopeSet(
939
821
  getOwnerScope ? getOwnerScope(scope) : scope._,
940
- closureSignal.F,
822
+ closureSignal.E,
941
823
  scope
942
824
  );
943
825
  };
944
- return closureSignal.F = "a" /* ClosureScopes */ + valueAccessor, closureSignal.G = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
826
+ return closureSignal.E = "a" /* ClosureScopes */ + valueAccessor, closureSignal.F = "b" /* ClosureSignalIndex */ + valueAccessor, closureSignal;
945
827
  }
946
828
  function closure(valueAccessor, fn, getOwnerScope) {
947
829
  return (scope) => {
@@ -982,6 +864,118 @@ function hoist(...path) {
982
864
  };
983
865
  }
984
866
 
867
+ // src/dom/walker.ts
868
+ var walker = /* @__PURE__ */ document.createTreeWalker(document);
869
+ function walk(startNode, walkCodes, branch) {
870
+ walker.currentNode = startNode, walkInternal(0, walkCodes, branch);
871
+ }
872
+ function walkInternal(currentWalkIndex, walkCodes, scope) {
873
+ let value2, storedMultiplier = 0, currentMultiplier = 0, currentScopeIndex = 0;
874
+ for (; currentWalkIndex < walkCodes.length; )
875
+ if (value2 = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value2 === 32 /* Get */) {
876
+ let node = walker.currentNode;
877
+ scope[currentScopeIndex] = node, scope["j" /* Getter */ + currentScopeIndex++] = () => node;
878
+ } else if (value2 === 37 /* Replace */ || value2 === 49 /* DynamicTagWithVar */)
879
+ walker.currentNode.replaceWith(
880
+ walker.currentNode = scope[currentScopeIndex++] = new Text()
881
+ ), value2 === 49 /* DynamicTagWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
882
+ else {
883
+ if (value2 === 38 /* EndChild */)
884
+ return currentWalkIndex;
885
+ if (value2 === 47 /* BeginChild */ || value2 === 48 /* BeginChildWithVar */)
886
+ currentWalkIndex = walkInternal(
887
+ currentWalkIndex,
888
+ walkCodes,
889
+ scope[currentScopeIndex++] = createScope(scope.$global, scope.k)
890
+ ), value2 === 48 /* BeginChildWithVar */ && (scope[currentScopeIndex++] = skipScope(scope));
891
+ else if (value2 < 92)
892
+ for (value2 = 20 /* Next */ * currentMultiplier + value2 - 67 /* Next */; value2--; )
893
+ walker.nextNode();
894
+ else if (value2 < 107)
895
+ for (value2 = 10 /* Over */ * currentMultiplier + value2 - 97 /* Over */; value2--; )
896
+ walker.nextSibling();
897
+ else if (value2 < 117) {
898
+ for (value2 = 10 /* Out */ * currentMultiplier + value2 - 107 /* Out */; value2--; )
899
+ walker.parentNode();
900
+ walker.nextSibling();
901
+ } else
902
+ storedMultiplier = currentMultiplier * 10 /* Multiplier */ + value2 - 117 /* Multiplier */;
903
+ }
904
+ }
905
+
906
+ // src/dom/renderer.ts
907
+ function createBranch($global, renderer, parentScope, parentNode) {
908
+ let branch = createScope($global), parentBranch = parentScope?.k;
909
+ return branch._ = renderer.y || parentScope, branch.k = branch, parentBranch && (branch.u = parentBranch, (parentBranch.A ||= /* @__PURE__ */ new Set()).add(branch)), renderer.C?.(
910
+ branch,
911
+ parentNode.namespaceURI
912
+ ), branch;
913
+ }
914
+ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
915
+ return setupBranch(
916
+ renderer,
917
+ createBranch($global, renderer, parentScope, parentNode)
918
+ );
919
+ }
920
+ function setupBranch(renderer, branch) {
921
+ return renderer.D && queueRender(branch, renderer.D, -1), branch;
922
+ }
923
+ function createContent(id, template, walks, setup, params, dynamicScopesAccessor) {
924
+ walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
925
+ let clone = template ? (branch, ns) => {
926
+ ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
927
+ template,
928
+ ns
929
+ ))(branch, walks);
930
+ } : (branch) => {
931
+ walk(
932
+ branch.h = branch.j = new Text(),
933
+ walks,
934
+ branch
935
+ );
936
+ };
937
+ return (owner) => ({
938
+ m: id,
939
+ C: clone,
940
+ y: owner,
941
+ D: setup,
942
+ l: params,
943
+ z: dynamicScopesAccessor
944
+ });
945
+ }
946
+ function registerContent(id, template, walks, setup, params, dynamicScopesAccessor) {
947
+ return register(
948
+ id,
949
+ createContent(id, template, walks, setup, params, dynamicScopesAccessor)
950
+ );
951
+ }
952
+ function localClosures(renderer, closureFns) {
953
+ let closureSignals = {};
954
+ for (let key in closureFns)
955
+ closureSignals[key] = value(key, closureFns[key]);
956
+ return (owner, closureValues) => {
957
+ let instance = renderer(owner);
958
+ return instance.G = closureSignals, instance.M = closureValues, instance;
959
+ };
960
+ }
961
+ function createRenderer(template, walks, setup, params) {
962
+ return createContent("", template, walks, setup, params)();
963
+ }
964
+ var cloneCache = {};
965
+ function createCloneableHTML(html2, ns) {
966
+ let { firstChild, lastChild } = parseHTML(html2, ns), parent = document.createElementNS(ns, "t");
967
+ return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 /* Comment */ ? (branch, walks) => {
968
+ walk(
969
+ branch.h = branch.j = firstChild.cloneNode(!0),
970
+ walks,
971
+ branch
972
+ );
973
+ } : (branch, walks) => {
974
+ let clone = parent.cloneNode(!0);
975
+ walk(clone.firstChild, walks, branch), branch.h = clone.firstChild, branch.j = clone.lastChild;
976
+ };
977
+ }
978
+
985
979
  // src/dom/control-flow.ts
986
980
  function awaitTag(nodeAccessor, renderer) {
987
981
  let promiseAccessor = "n" /* Promise */ + nodeAccessor, branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
@@ -1123,26 +1117,33 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1123
1117
  scope[childScopeAccessor]
1124
1118
  );
1125
1119
  if (normalizedRenderer) {
1126
- let args = getInput?.();
1120
+ let childScope = scope[childScopeAccessor], args = getInput?.();
1127
1121
  if (typeof normalizedRenderer == "string")
1128
1122
  attrs(
1129
- scope[childScopeAccessor],
1123
+ childScope,
1130
1124
  0,
1131
1125
  (inputIsArgs ? args[0] : args) || {}
1132
1126
  );
1133
- else if (normalizedRenderer.l)
1134
- if (inputIsArgs)
1135
- normalizedRenderer.l(
1136
- scope[childScopeAccessor],
1137
- normalizedRenderer._ ? args[0] : args
1138
- );
1139
- else {
1140
- let inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
1141
- normalizedRenderer.l(
1142
- scope[childScopeAccessor],
1143
- normalizedRenderer._ ? inputWithContent : [inputWithContent]
1127
+ else {
1128
+ for (let accessor in normalizedRenderer.G)
1129
+ normalizedRenderer.G[accessor](
1130
+ childScope,
1131
+ normalizedRenderer.M[accessor]
1144
1132
  );
1145
- }
1133
+ if (normalizedRenderer.l)
1134
+ if (inputIsArgs)
1135
+ normalizedRenderer.l(
1136
+ childScope,
1137
+ normalizedRenderer._ ? args[0] : args
1138
+ );
1139
+ else {
1140
+ let inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
1141
+ normalizedRenderer.l(
1142
+ childScope,
1143
+ normalizedRenderer._ ? inputWithContent : [inputWithContent]
1144
+ );
1145
+ }
1146
+ }
1146
1147
  }
1147
1148
  };
1148
1149
  };
@@ -1219,7 +1220,7 @@ function queueRender(scope, signal, signalKey, value2, scopeKey = scope.m) {
1219
1220
  let render = {
1220
1221
  t: key,
1221
1222
  o: scope,
1222
- M: signal,
1223
+ N: signal,
1223
1224
  I: value2
1224
1225
  }, i = pendingRenders.push(render) - 1;
1225
1226
  for (; i; ) {
@@ -1278,7 +1279,7 @@ function runRenders() {
1278
1279
  scope.q = 0;
1279
1280
  pendingScopes = [];
1280
1281
  }
1281
- var runRender = (render) => render.M(render.o, render.I), enableCatch = () => {
1282
+ var runRender = (render) => render.N(render.o, render.I), enableCatch = () => {
1282
1283
  enableCatch = () => {
1283
1284
  }, enableBranches();
1284
1285
  let handlePendingTry = (fn, scope, branch) => {
@@ -1486,6 +1487,7 @@ export {
1486
1487
  init,
1487
1488
  intersection,
1488
1489
  lifecycle,
1490
+ localClosures,
1489
1491
  loopClosure,
1490
1492
  loopIn,
1491
1493
  loopOf,