@marko/runtime-tags 0.3.50 → 0.3.51

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/debug/dom.js CHANGED
@@ -1406,21 +1406,6 @@ function getDebugKey(index, node) {
1406
1406
  }
1407
1407
 
1408
1408
  // src/dom/renderer.ts
1409
- function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
1410
- const branch = createBranch(
1411
- $global,
1412
- tagNameOrRenderer,
1413
- parentScope,
1414
- parentNode
1415
- );
1416
- if (typeof tagNameOrRenderer === "string") {
1417
- branch[true ? `#${tagNameOrRenderer}/0` : 0] = branch.___startNode = branch.___endNode = document.createElementNS(
1418
- tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
1419
- tagNameOrRenderer
1420
- );
1421
- }
1422
- return branch;
1423
- }
1424
1409
  function createBranch($global, renderer, parentScope, parentNode) {
1425
1410
  const branch = createScope($global);
1426
1411
  const parentBranch = parentScope?.___closestBranch;
@@ -1433,7 +1418,7 @@ function createBranch($global, renderer, parentScope, parentNode) {
1433
1418
  if (true) {
1434
1419
  branch.___renderer = renderer;
1435
1420
  }
1436
- renderer.___init?.(
1421
+ renderer.___clone?.(
1437
1422
  branch,
1438
1423
  parentNode.namespaceURI
1439
1424
  );
@@ -1442,24 +1427,23 @@ function createBranch($global, renderer, parentScope, parentNode) {
1442
1427
  function createContent(id, template, walks, setup, getArgs, dynamicScopesAccessor) {
1443
1428
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
1444
1429
  let args;
1445
- const init2 = template ? (branch, ns) => {
1430
+ const clone = template ? (branch, ns) => {
1446
1431
  ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
1447
1432
  template,
1448
1433
  ns
1449
1434
  ))(branch, walks);
1450
- setup && queueRender(branch, setup, -1);
1451
1435
  } : (branch) => {
1452
1436
  walk(
1453
1437
  branch.___startNode = branch.___endNode = new Text(),
1454
1438
  walks,
1455
1439
  branch
1456
1440
  );
1457
- setup && queueRender(branch, setup, -1);
1458
1441
  };
1459
1442
  return (owner) => {
1460
1443
  return {
1461
1444
  ___id: id,
1462
- ___init: init2,
1445
+ ___clone: clone,
1446
+ ___setup: setup,
1463
1447
  ___owner: owner,
1464
1448
  ___accessor: dynamicScopesAccessor,
1465
1449
  get ___args() {
@@ -1733,7 +1717,7 @@ function conditional(nodeAccessor, ...branches) {
1733
1717
  scope,
1734
1718
  nodeAccessor,
1735
1719
  branches[scope[branchAccessor] = newBranch],
1736
- createBranch
1720
+ createAndSetupBranch
1737
1721
  );
1738
1722
  }
1739
1723
  };
@@ -1763,7 +1747,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
1763
1747
  scope[childScopeAccessor],
1764
1748
  true ? `#${normalizedRenderer}/0` : 0,
1765
1749
  content,
1766
- createBranch
1750
+ createAndSetupBranch
1767
1751
  );
1768
1752
  if (content.___accessor) {
1769
1753
  subscribeToScopeSet(
@@ -1876,7 +1860,7 @@ function loop(nodeAccessor, renderer, forEach) {
1876
1860
  const newMap = scope[nodeAccessor + "(" /* LoopScopeMap */] = /* @__PURE__ */ new Map();
1877
1861
  const newArray = scope[nodeAccessor + "!" /* LoopScopeArray */] = [];
1878
1862
  forEach(value2, (key, args) => {
1879
- const branch = oldMap?.get(key) || createBranch(scope.$global, renderer, scope, parentNode);
1863
+ const branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
1880
1864
  params?.(branch, args);
1881
1865
  newMap.set(key, branch);
1882
1866
  newArray.push(branch);
@@ -1896,6 +1880,28 @@ function loop(nodeAccessor, renderer, forEach) {
1896
1880
  reconcile(parentNode, oldArray, newArray, afterReference);
1897
1881
  };
1898
1882
  }
1883
+ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1884
+ const branch = createBranch($global, renderer, parentScope, parentNode);
1885
+ renderer.___setup && queueRender(branch, renderer.___setup, -1);
1886
+ return branch;
1887
+ }
1888
+ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
1889
+ const branch = createBranch(
1890
+ $global,
1891
+ tagNameOrRenderer,
1892
+ parentScope,
1893
+ parentNode
1894
+ );
1895
+ if (typeof tagNameOrRenderer === "string") {
1896
+ branch[true ? `#${tagNameOrRenderer}/0` : 0] = branch.___startNode = branch.___endNode = document.createElementNS(
1897
+ tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
1898
+ tagNameOrRenderer
1899
+ );
1900
+ } else if (tagNameOrRenderer.___setup) {
1901
+ queueRender(branch, tagNameOrRenderer.___setup, -1);
1902
+ }
1903
+ return branch;
1904
+ }
1899
1905
  function bySecondArg(_item, index) {
1900
1906
  return index;
1901
1907
  }
@@ -1918,7 +1924,7 @@ var compat = {
1918
1924
  register(RENDERER_REGISTER_ID, fn);
1919
1925
  },
1920
1926
  isRenderer(renderer) {
1921
- return renderer.___init;
1927
+ return renderer.___clone;
1922
1928
  },
1923
1929
  getStartNode(branch) {
1924
1930
  return branch.___startNode;
@@ -1949,7 +1955,7 @@ var compat = {
1949
1955
  },
1950
1956
  createRenderer(args, clone) {
1951
1957
  const renderer = createRenderer(0, 0, 0, () => args);
1952
- renderer.___init = (branch) => {
1958
+ renderer.___clone = (branch) => {
1953
1959
  const cloned = clone();
1954
1960
  branch.___startNode = cloned.startNode;
1955
1961
  branch.___endNode = cloned.endNode;
@@ -1982,6 +1988,7 @@ var compat = {
1982
1988
  renderer.___owner,
1983
1989
  document.body
1984
1990
  );
1991
+ renderer.___setup && renderer.___setup(branch);
1985
1992
  } else {
1986
1993
  existing = true;
1987
1994
  }
@@ -2054,7 +2061,8 @@ function mount(input = {}, reference, position) {
2054
2061
  void 0,
2055
2062
  parentNode
2056
2063
  );
2057
- args?.(branch, input);
2064
+ this.___setup && this.___setup(branch);
2065
+ args && args(branch, input);
2058
2066
  });
2059
2067
  insertChildNodes(
2060
2068
  parentNode,
@@ -1321,21 +1321,6 @@ function getDebugKey(index, node) {
1321
1321
  }
1322
1322
 
1323
1323
  // src/dom/renderer.ts
1324
- function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
1325
- const branch = createBranch(
1326
- $global,
1327
- tagNameOrRenderer,
1328
- parentScope,
1329
- parentNode
1330
- );
1331
- if (typeof tagNameOrRenderer === "string") {
1332
- branch[true ? `#${tagNameOrRenderer}/0` : 0] = branch.___startNode = branch.___endNode = document.createElementNS(
1333
- tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
1334
- tagNameOrRenderer
1335
- );
1336
- }
1337
- return branch;
1338
- }
1339
1324
  function createBranch($global, renderer, parentScope, parentNode) {
1340
1325
  const branch = createScope($global);
1341
1326
  const parentBranch = parentScope?.___closestBranch;
@@ -1348,7 +1333,7 @@ function createBranch($global, renderer, parentScope, parentNode) {
1348
1333
  if (true) {
1349
1334
  branch.___renderer = renderer;
1350
1335
  }
1351
- renderer.___init?.(
1336
+ renderer.___clone?.(
1352
1337
  branch,
1353
1338
  parentNode.namespaceURI
1354
1339
  );
@@ -1357,24 +1342,23 @@ function createBranch($global, renderer, parentScope, parentNode) {
1357
1342
  function createContent(id, template, walks, setup, getArgs, dynamicScopesAccessor) {
1358
1343
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
1359
1344
  let args;
1360
- const init2 = template ? (branch, ns) => {
1345
+ const clone = template ? (branch, ns) => {
1361
1346
  ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
1362
1347
  template,
1363
1348
  ns
1364
1349
  ))(branch, walks);
1365
- setup && queueRender(branch, setup, -1);
1366
1350
  } : (branch) => {
1367
1351
  walk(
1368
1352
  branch.___startNode = branch.___endNode = new Text(),
1369
1353
  walks,
1370
1354
  branch
1371
1355
  );
1372
- setup && queueRender(branch, setup, -1);
1373
1356
  };
1374
1357
  return (owner) => {
1375
1358
  return {
1376
1359
  ___id: id,
1377
- ___init: init2,
1360
+ ___clone: clone,
1361
+ ___setup: setup,
1378
1362
  ___owner: owner,
1379
1363
  ___accessor: dynamicScopesAccessor,
1380
1364
  get ___args() {
@@ -1648,7 +1632,7 @@ function conditional(nodeAccessor, ...branches) {
1648
1632
  scope,
1649
1633
  nodeAccessor,
1650
1634
  branches[scope[branchAccessor] = newBranch],
1651
- createBranch
1635
+ createAndSetupBranch
1652
1636
  );
1653
1637
  }
1654
1638
  };
@@ -1678,7 +1662,7 @@ var dynamicTag = function dynamicTag2(nodeAccessor, getContent, getTagVar, input
1678
1662
  scope[childScopeAccessor],
1679
1663
  true ? `#${normalizedRenderer}/0` : 0,
1680
1664
  content,
1681
- createBranch
1665
+ createAndSetupBranch
1682
1666
  );
1683
1667
  if (content.___accessor) {
1684
1668
  subscribeToScopeSet(
@@ -1791,7 +1775,7 @@ function loop(nodeAccessor, renderer, forEach) {
1791
1775
  const newMap = scope[nodeAccessor + "(" /* LoopScopeMap */] = /* @__PURE__ */ new Map();
1792
1776
  const newArray = scope[nodeAccessor + "!" /* LoopScopeArray */] = [];
1793
1777
  forEach(value2, (key, args) => {
1794
- const branch = oldMap?.get(key) || createBranch(scope.$global, renderer, scope, parentNode);
1778
+ const branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
1795
1779
  params?.(branch, args);
1796
1780
  newMap.set(key, branch);
1797
1781
  newArray.push(branch);
@@ -1811,6 +1795,28 @@ function loop(nodeAccessor, renderer, forEach) {
1811
1795
  reconcile(parentNode, oldArray, newArray, afterReference);
1812
1796
  };
1813
1797
  }
1798
+ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1799
+ const branch = createBranch($global, renderer, parentScope, parentNode);
1800
+ renderer.___setup && queueRender(branch, renderer.___setup, -1);
1801
+ return branch;
1802
+ }
1803
+ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
1804
+ const branch = createBranch(
1805
+ $global,
1806
+ tagNameOrRenderer,
1807
+ parentScope,
1808
+ parentNode
1809
+ );
1810
+ if (typeof tagNameOrRenderer === "string") {
1811
+ branch[true ? `#${tagNameOrRenderer}/0` : 0] = branch.___startNode = branch.___endNode = document.createElementNS(
1812
+ tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
1813
+ tagNameOrRenderer
1814
+ );
1815
+ } else if (tagNameOrRenderer.___setup) {
1816
+ queueRender(branch, tagNameOrRenderer.___setup, -1);
1817
+ }
1818
+ return branch;
1819
+ }
1814
1820
  function bySecondArg(_item, index) {
1815
1821
  return index;
1816
1822
  }
@@ -1833,7 +1839,7 @@ var compat = {
1833
1839
  register(RENDERER_REGISTER_ID, fn);
1834
1840
  },
1835
1841
  isRenderer(renderer) {
1836
- return renderer.___init;
1842
+ return renderer.___clone;
1837
1843
  },
1838
1844
  getStartNode(branch) {
1839
1845
  return branch.___startNode;
@@ -1864,7 +1870,7 @@ var compat = {
1864
1870
  },
1865
1871
  createRenderer(args, clone) {
1866
1872
  const renderer = createRenderer(0, 0, 0, () => args);
1867
- renderer.___init = (branch) => {
1873
+ renderer.___clone = (branch) => {
1868
1874
  const cloned = clone();
1869
1875
  branch.___startNode = cloned.startNode;
1870
1876
  branch.___endNode = cloned.endNode;
@@ -1897,6 +1903,7 @@ var compat = {
1897
1903
  renderer.___owner,
1898
1904
  document.body
1899
1905
  );
1906
+ renderer.___setup && renderer.___setup(branch);
1900
1907
  } else {
1901
1908
  existing = true;
1902
1909
  }
@@ -1969,7 +1976,8 @@ function mount(input = {}, reference, position) {
1969
1976
  void 0,
1970
1977
  parentNode
1971
1978
  );
1972
- args?.(branch, input);
1979
+ this.___setup && this.___setup(branch);
1980
+ args && args(branch, input);
1973
1981
  });
1974
1982
  insertChildNodes(
1975
1983
  parentNode,
@@ -2,13 +2,13 @@ import { type Accessor, type BranchScope, type Scope } from "../common/types";
2
2
  import type { Signal } from "./signals";
3
3
  export type Renderer = {
4
4
  ___id: string;
5
- ___init: (branch: BranchScope, ns: string) => void;
5
+ ___setup: undefined | 0 | ((branch: BranchScope) => void);
6
+ ___clone: (branch: BranchScope, ns: string) => void;
6
7
  ___args: Signal<unknown> | undefined;
7
8
  ___owner: Scope | undefined;
8
9
  ___accessor: Accessor | undefined;
9
10
  };
10
11
  type SetupFn = (scope: Scope) => void;
11
- export declare function createBranchWithTagNameOrRenderer($global: Scope["$global"], tagNameOrRenderer: Renderer | string, parentScope: Scope, parentNode: ParentNode): BranchScope;
12
12
  export declare function createBranch($global: Scope["$global"], renderer: Renderer | string, parentScope: Scope | undefined, parentNode: ParentNode): BranchScope;
13
13
  export declare function createContent(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, getArgs?: (() => Signal<unknown>) | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
14
14
  export declare function registerContent(id: string, template: string | 0, walks?: string | 0, setup?: SetupFn | 0, getArgs?: (() => Signal<unknown>) | 0, dynamicScopesAccessor?: Accessor): (owner?: Scope) => Renderer;
package/dist/dom.js CHANGED
@@ -199,19 +199,19 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
199
199
 
200
200
  // src/dom/resume.ts
201
201
  var registeredValues = {}, Render = class {
202
- p = [];
203
- q = {};
204
- B = {
202
+ q = [];
203
+ s = {};
204
+ C = {
205
205
  _: registeredValues
206
206
  };
207
207
  constructor(renders, runtimeId, renderId) {
208
- this.C = renders, this.D = runtimeId, this.s = renderId, this.t = renders[renderId], this.u();
208
+ this.D = renders, this.E = runtimeId, this.t = renderId, this.u = renders[renderId], this.x();
209
209
  }
210
210
  w() {
211
- this.t.w(), this.u();
211
+ this.u.w(), this.x();
212
212
  }
213
- u() {
214
- let data2 = this.t, serializeContext = this.B, scopeLookup = this.q, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
213
+ x() {
214
+ let data2 = this.u, serializeContext = this.C, scopeLookup = this.s, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
215
215
  if (visits.length) {
216
216
  let commentPrefixLen = data2.i.length, closestBranchMarkers = /* @__PURE__ */ new Map(), visitNodes = new Set(visits), lastEndNode;
217
217
  data2.v = [];
@@ -227,22 +227,22 @@ var registeredValues = {}, Render = class {
227
227
  let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = commentText.slice(
228
228
  commentPrefixLen + 1,
229
229
  dataIndex ? dataIndex - 1 : commentText.length
230
- ), scope = scopeLookup[scopeId] ||= { d: +scopeId }, data3 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
230
+ ), scope = scopeLookup[scopeId] ||= { e: +scopeId }, data3 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
231
231
  if (token === "*" /* Node */) {
232
232
  let node = scope[data3] = visit.previousSibling;
233
233
  scope[data3 + ">" /* Getter */] = () => node;
234
234
  } else if (token === "$" /* ClosestBranch */)
235
235
  closestBranchMarkers.set(scopeId, visit);
236
236
  else if (token === "[" /* BranchStart */)
237
- this.f && (dataIndex && branchEnd(this.f, visit, visit), this.p.push(this.f)), this.f = scopeId, scope.a = visit;
237
+ this.g && (dataIndex && branchEnd(this.g, visit, visit), this.q.push(this.g)), this.g = scopeId, scope.a = visit;
238
238
  else if (token === "]" /* BranchEnd */) {
239
239
  scope[data3] = visit;
240
240
  let curParent = visit.parentNode, startNode = branchEnd(
241
- this.f,
241
+ this.g,
242
242
  visit,
243
243
  visit
244
244
  ).a;
245
- curParent !== startNode.parentNode && curParent.prepend(startNode), this.f = this.p.pop();
245
+ curParent !== startNode.parentNode && curParent.prepend(startNode), this.g = this.q.pop();
246
246
  } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
247
247
  let next = data3.indexOf(" "), curNode = visit;
248
248
  for (scope[~next ? data3.slice(0, next) : data3] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
@@ -263,21 +263,21 @@ var registeredValues = {}, Render = class {
263
263
  let resumeData = resumes[i++];
264
264
  if (typeof resumeData == "function") {
265
265
  let scopes = resumeData(serializeContext), { $global } = scopeLookup;
266
- $global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.D, $global.renderId = this.s, $global.g = 1e6);
266
+ $global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.E, $global.renderId = this.t, $global.h = 1e6);
267
267
  for (let scopeId in scopes)
268
268
  if (scopeId !== "$") {
269
269
  let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
270
- scope.$global = $global, scope.d = +scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
270
+ scope.$global = $global, scope.e = +scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
271
271
  scope,
272
272
  prevScope
273
273
  ));
274
274
  let parentBranchId = parentBranchIds.get(scopeId);
275
275
  if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
276
276
  let branch = scope, parentBranch = branch.c;
277
- scope.c = branch, parentBranch && (branch.x = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch));
277
+ scope.c = branch, parentBranch && (branch.y = parentBranch, (parentBranch.o ||= /* @__PURE__ */ new Set()).add(branch));
278
278
  }
279
279
  }
280
- } else i === len || typeof resumes[i] != "string" ? delete this.C[this.s] : registeredValues[resumes[i++]](
280
+ } else i === len || typeof resumes[i] != "string" ? delete this.D[this.t] : registeredValues[resumes[i++]](
281
281
  scopeLookup[resumeData],
282
282
  scopeLookup[resumeData]
283
283
  );
@@ -713,28 +713,28 @@ function toInsertNode(startNode, endNode) {
713
713
  var pendingScopes = [];
714
714
  function createScope($global, closestBranch) {
715
715
  let scope = {
716
- d: $global.g++,
717
- h: 1,
716
+ e: $global.h++,
717
+ j: 1,
718
718
  c: closestBranch,
719
719
  $global
720
720
  };
721
721
  return pendingScopes.push(scope), scope;
722
722
  }
723
723
  function skipScope(scope) {
724
- return scope.$global.g++;
724
+ return scope.$global.h++;
725
725
  }
726
726
  function finishPendingScopes() {
727
727
  for (let scope of pendingScopes)
728
- scope.h = 0;
728
+ scope.j = 0;
729
729
  pendingScopes = [];
730
730
  }
731
731
  function destroyBranch(branch) {
732
- branch.x?.n?.delete(branch), destroyNestedBranches(branch);
732
+ branch.y?.o?.delete(branch), destroyNestedBranches(branch);
733
733
  }
734
734
  function destroyNestedBranches(branch) {
735
- branch.y = 1, branch.n?.forEach(destroyNestedBranches), branch.E?.forEach((scope) => {
736
- for (let id in scope.k)
737
- scope.k[id]?.abort();
735
+ branch.z = 1, branch.o?.forEach(destroyNestedBranches), branch.F?.forEach((scope) => {
736
+ for (let id in scope.l)
737
+ scope.l[id]?.abort();
738
738
  });
739
739
  }
740
740
  function removeAndDestroyBranch(branch) {
@@ -751,20 +751,20 @@ function insertBranchBefore(branch, parentNode, nextSibling) {
751
751
 
752
752
  // src/dom/queue.ts
753
753
  var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendingEffects = [], rendering = !1, scopeKeyOffset = 1e3;
754
- function queueRender(scope, signal, signalKey, value2, scopeKey = scope.d) {
754
+ function queueRender(scope, signal, signalKey, value2, scopeKey = scope.e) {
755
755
  let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
756
756
  if (existingRender)
757
- existingRender.z = value2;
757
+ existingRender.A = value2;
758
758
  else {
759
759
  let render = {
760
- j: key,
761
- A: scope,
762
- F: signal,
763
- z: value2
760
+ k: key,
761
+ B: scope,
762
+ G: signal,
763
+ A: value2
764
764
  }, i = pendingRenders.push(render) - 1;
765
765
  for (; i; ) {
766
766
  let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
767
- if (key - parent.j >= 0) break;
767
+ if (key - parent.k >= 0) break;
768
768
  pendingRenders[i] = parent, i = parentIndex;
769
769
  }
770
770
  signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
@@ -803,27 +803,27 @@ function runRenders() {
803
803
  for (; pendingRenders.length; ) {
804
804
  let render = pendingRenders[0], item = pendingRenders.pop();
805
805
  if (render !== item) {
806
- let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).j;
806
+ let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).k;
807
807
  for (; i < mid; ) {
808
808
  let bestChild = (i << 1) + 1, right = bestChild + 1;
809
- if (right < pendingRenders.length && pendingRenders[right].j - pendingRenders[bestChild].j < 0 && (bestChild = right), pendingRenders[bestChild].j - key >= 0)
809
+ if (right < pendingRenders.length && pendingRenders[right].k - pendingRenders[bestChild].k < 0 && (bestChild = right), pendingRenders[bestChild].k - key >= 0)
810
810
  break;
811
811
  pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
812
812
  }
813
813
  pendingRenders[i] = item;
814
814
  }
815
- render.A.c?.y || render.F(render.A, render.z);
815
+ render.B.c?.z || render.G(render.B, render.A);
816
816
  }
817
817
  finishPendingScopes();
818
818
  }
819
819
 
820
820
  // src/dom/abort-signal.ts
821
821
  function resetAbortSignal(scope, id) {
822
- let ctrl = scope.k?.[id];
823
- ctrl && (queueEffect(ctrl, abort), scope.k[id] = void 0);
822
+ let ctrl = scope.l?.[id];
823
+ ctrl && (queueEffect(ctrl, abort), scope.l[id] = void 0);
824
824
  }
825
825
  function getAbortSignal(scope, id) {
826
- return scope.c && (scope.c.E ||= /* @__PURE__ */ new Set()).add(scope), ((scope.k ||= {})[id] ||= new AbortController()).signal;
826
+ return scope.c && (scope.c.F ||= /* @__PURE__ */ new Set()).add(scope), ((scope.l ||= {})[id] ||= new AbortController()).signal;
827
827
  }
828
828
  function abort(ctrl) {
829
829
  ctrl.abort();
@@ -947,45 +947,34 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
947
947
  }
948
948
 
949
949
  // src/dom/renderer.ts
950
- function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
951
- let branch = createBranch(
952
- $global,
953
- tagNameOrRenderer,
954
- parentScope,
955
- parentNode
956
- );
957
- return typeof tagNameOrRenderer == "string" && (branch[0] = branch.a = branch.b = document.createElementNS(
958
- tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
959
- tagNameOrRenderer
960
- )), branch;
961
- }
962
950
  function createBranch($global, renderer, parentScope, parentNode) {
963
951
  let branch = createScope($global), parentBranch = parentScope?.c;
964
- return branch._ = renderer.l || parentScope, branch.c = branch, parentBranch && (branch.x = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch)), renderer.o?.(
952
+ return branch._ = renderer.m || parentScope, branch.c = branch, parentBranch && (branch.y = parentBranch, (parentBranch.o ||= /* @__PURE__ */ new Set()).add(branch)), renderer.p?.(
965
953
  branch,
966
954
  parentNode.namespaceURI
967
955
  ), branch;
968
956
  }
969
957
  function createContent(id, template, walks, setup, getArgs, dynamicScopesAccessor) {
970
958
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
971
- let args, init2 = template ? (branch, ns) => {
959
+ let args, clone = template ? (branch, ns) => {
972
960
  ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
973
961
  template,
974
962
  ns
975
- ))(branch, walks), setup && queueRender(branch, setup, -1);
963
+ ))(branch, walks);
976
964
  } : (branch) => {
977
965
  walk(
978
966
  branch.a = branch.b = new Text(),
979
967
  walks,
980
968
  branch
981
- ), setup && queueRender(branch, setup, -1);
969
+ );
982
970
  };
983
971
  return (owner) => ({
984
- d: id,
985
- o: init2,
986
- l: owner,
987
- m: dynamicScopesAccessor,
988
- get e() {
972
+ e: id,
973
+ p: clone,
974
+ d: setup,
975
+ m: owner,
976
+ n: dynamicScopesAccessor,
977
+ get f() {
989
978
  return args ||= getArgs ? getArgs() : void 0;
990
979
  }
991
980
  });
@@ -1052,9 +1041,9 @@ function value(valueAccessor, fn = () => {
1052
1041
  };
1053
1042
  }
1054
1043
  var accessorId = 0;
1055
- function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "d") {
1044
+ function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "e") {
1056
1045
  return (scope) => {
1057
- scope.h ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
1046
+ scope.j ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
1058
1047
  };
1059
1048
  }
1060
1049
  function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
@@ -1064,11 +1053,11 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
1064
1053
  ownerScope,
1065
1054
  () => {
1066
1055
  for (let scope of scopes)
1067
- !scope.h && !scope.y && childSignal(scope);
1056
+ !scope.j && !scope.z && childSignal(scope);
1068
1057
  },
1069
1058
  -1,
1070
1059
  0,
1071
- firstScope.d
1060
+ firstScope.e
1072
1061
  );
1073
1062
  };
1074
1063
  return ownerSignal._ = childSignal, ownerSignal;
@@ -1076,7 +1065,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
1076
1065
  function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
1077
1066
  let childSignal = closure(valueAccessor, fn), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
1078
1067
  let ifScope = scope[scopeAccessor];
1079
- ifScope && !ifScope.h && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
1068
+ ifScope && !ifScope.j && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
1080
1069
  };
1081
1070
  return ownerSignal._ = childSignal, ownerSignal;
1082
1071
  }
@@ -1092,8 +1081,8 @@ function dynamicClosure(valueAccessor, fn, getOwnerScope) {
1092
1081
  let subscribers = ownerScope[subscribersAccessor];
1093
1082
  if (subscribers)
1094
1083
  for (let subscriber of subscribers)
1095
- subscriber.h || queueRender(subscriber, childSignal, -1);
1096
- }, subscribe = ownerSignal.G = (scope) => subscribeToScopeSet(
1084
+ subscriber.j || queueRender(subscriber, childSignal, -1);
1085
+ }, subscribe = ownerSignal.H = (scope) => subscribeToScopeSet(
1097
1086
  getOwnerScope ? getOwnerScope(scope) : scope._,
1098
1087
  subscribersAccessor,
1099
1088
  scope
@@ -1104,7 +1093,7 @@ function dynamicClosure(valueAccessor, fn, getOwnerScope) {
1104
1093
  }
1105
1094
  function registerDynamicClosure(registryId, valueAccessor, fn, getOwnerScope) {
1106
1095
  let signal = dynamicClosure(valueAccessor, fn, getOwnerScope);
1107
- return register(registryId, signal.G), signal;
1096
+ return register(registryId, signal.H), signal;
1108
1097
  }
1109
1098
  function closure(valueAccessor, fn, getOwnerScope) {
1110
1099
  return (scope) => {
@@ -1150,7 +1139,7 @@ function conditional(nodeAccessor, ...branches) {
1150
1139
  scope,
1151
1140
  nodeAccessor,
1152
1141
  branches[scope[branchAccessor] = newBranch],
1153
- createBranch
1142
+ createAndSetupBranch
1154
1143
  );
1155
1144
  };
1156
1145
  }
@@ -1161,7 +1150,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1161
1150
  let childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */, rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1162
1151
  return (scope, newRenderer, getInput) => {
1163
1152
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
1164
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.d || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
1153
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.e || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
1165
1154
  if (setConditionalRenderer(
1166
1155
  scope,
1167
1156
  nodeAccessor,
@@ -1174,16 +1163,16 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1174
1163
  scope[childScopeAccessor],
1175
1164
  0,
1176
1165
  content,
1177
- createBranch
1178
- ), content.m && subscribeToScopeSet(
1179
- content.l,
1166
+ createAndSetupBranch
1167
+ ), content.n && subscribeToScopeSet(
1180
1168
  content.m,
1169
+ content.n,
1181
1170
  scope[childScopeAccessor][0 + "!" /* ConditionalScope */]
1182
1171
  );
1183
1172
  }
1184
- } else normalizedRenderer?.m && subscribeToScopeSet(
1185
- normalizedRenderer.l,
1173
+ } else normalizedRenderer?.n && subscribeToScopeSet(
1186
1174
  normalizedRenderer.m,
1175
+ normalizedRenderer.n,
1187
1176
  scope[childScopeAccessor]
1188
1177
  );
1189
1178
  if (normalizedRenderer) {
@@ -1194,9 +1183,9 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1194
1183
  0,
1195
1184
  (inputIsArgs ? args[0] : args) || {}
1196
1185
  );
1197
- else if (normalizedRenderer.e)
1186
+ else if (normalizedRenderer.f)
1198
1187
  if (inputIsArgs)
1199
- normalizedRenderer.e(
1188
+ normalizedRenderer.f(
1200
1189
  scope[childScopeAccessor],
1201
1190
  normalizedRenderer._ ? args[0] : args
1202
1191
  );
@@ -1205,7 +1194,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1205
1194
  ...args,
1206
1195
  content: getContent(scope)
1207
1196
  } : args || {};
1208
- normalizedRenderer.e(
1197
+ normalizedRenderer.f(
1209
1198
  scope[childScopeAccessor],
1210
1199
  normalizedRenderer._ ? inputWithContent : [inputWithContent]
1211
1200
  );
@@ -1244,19 +1233,35 @@ function loopTo(nodeAccessor, renderer) {
1244
1233
  );
1245
1234
  }
1246
1235
  function loop(nodeAccessor, renderer, forEach) {
1247
- let params = renderer.e;
1236
+ let params = renderer.f;
1248
1237
  return (scope, value2) => {
1249
1238
  let referenceNode = scope[nodeAccessor], oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */], oldArray = oldMap ? scope[nodeAccessor + "!" /* LoopScopeArray */] || [
1250
1239
  ...oldMap.values()
1251
1240
  ] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].a.parentNode : referenceNode, newMap = scope[nodeAccessor + "(" /* LoopScopeMap */] = /* @__PURE__ */ new Map(), newArray = scope[nodeAccessor + "!" /* LoopScopeArray */] = [];
1252
1241
  forEach(value2, (key, args) => {
1253
- let branch = oldMap?.get(key) || createBranch(scope.$global, renderer, scope, parentNode);
1242
+ let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
1254
1243
  params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
1255
1244
  });
1256
1245
  let afterReference = null;
1257
1246
  referenceNode !== parentNode && (oldArray.length ? (afterReference = oldArray[oldArray.length - 1].b.nextSibling, newArray.length || parentNode.insertBefore(referenceNode, afterReference)) : newArray.length && (afterReference = referenceNode.nextSibling, referenceNode.remove())), reconcile(parentNode, oldArray, newArray, afterReference);
1258
1247
  };
1259
1248
  }
1249
+ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1250
+ let branch = createBranch($global, renderer, parentScope, parentNode);
1251
+ return renderer.d && queueRender(branch, renderer.d, -1), branch;
1252
+ }
1253
+ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
1254
+ let branch = createBranch(
1255
+ $global,
1256
+ tagNameOrRenderer,
1257
+ parentScope,
1258
+ parentNode
1259
+ );
1260
+ return typeof tagNameOrRenderer == "string" ? branch[0] = branch.a = branch.b = document.createElementNS(
1261
+ tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
1262
+ tagNameOrRenderer
1263
+ ) : tagNameOrRenderer.d && queueRender(branch, tagNameOrRenderer.d, -1), branch;
1264
+ }
1260
1265
  function bySecondArg(_item, index) {
1261
1266
  return index;
1262
1267
  }
@@ -1277,7 +1282,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1277
1282
  register(RENDERER_REGISTER_ID, fn);
1278
1283
  },
1279
1284
  isRenderer(renderer) {
1280
- return renderer.o;
1285
+ return renderer.p;
1281
1286
  },
1282
1287
  getStartNode(branch) {
1283
1288
  return branch.a;
@@ -1297,12 +1302,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1297
1302
  }) {
1298
1303
  return Array.isArray(value2) && typeof value2[0] == "string" ? getRegisteredWithScope(
1299
1304
  value2[0],
1300
- value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.q[value2[1]]
1305
+ value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.s[value2[1]]
1301
1306
  ) : value2;
1302
1307
  },
1303
1308
  createRenderer(args, clone) {
1304
1309
  let renderer = createRenderer(0, 0, 0, () => args);
1305
- return renderer.o = (branch) => {
1310
+ return renderer.p = (branch) => {
1306
1311
  let cloned = clone();
1307
1312
  branch.a = cloned.startNode, branch.b = cloned.endNode;
1308
1313
  }, renderer;
@@ -1317,12 +1322,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1317
1322
  normalizedInput[key === "renderBody" ? "content" : key] = input[key];
1318
1323
  }
1319
1324
  if (component.effects = prepareEffects(() => {
1320
- branch ? existing = !0 : (out.global.g ||= 0, branch = component.scope = createBranch(
1325
+ branch ? existing = !0 : (out.global.h ||= 0, branch = component.scope = createBranch(
1321
1326
  out.global,
1322
1327
  renderer,
1323
- renderer.l,
1328
+ renderer.m,
1324
1329
  document.body
1325
- )), renderer.e?.(branch, renderer._ ? args[0] : args);
1330
+ ), renderer.d && renderer.d(branch)), renderer.f?.(branch, renderer._ ? args[0] : args);
1326
1331
  }), !existing)
1327
1332
  return toInsertNode(branch.a, branch.b);
1328
1333
  }
@@ -1342,12 +1347,12 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
1342
1347
  function mount(input = {}, reference, position) {
1343
1348
  let branch, parentNode = reference, nextSibling = null, { $global } = input;
1344
1349
  switch ($global ? ({ $global, ...input } = input, $global = {
1345
- g: 0,
1350
+ h: 0,
1346
1351
  runtimeId: DEFAULT_RUNTIME_ID,
1347
1352
  renderId: DEFAULT_RENDER_ID,
1348
1353
  ...$global
1349
1354
  }) : $global = {
1350
- g: 0,
1355
+ h: 0,
1351
1356
  runtimeId: DEFAULT_RUNTIME_ID,
1352
1357
  renderId: DEFAULT_RENDER_ID
1353
1358
  }, position) {
@@ -1361,13 +1366,13 @@ function mount(input = {}, reference, position) {
1361
1366
  parentNode = reference.parentNode, nextSibling = reference.nextSibling;
1362
1367
  break;
1363
1368
  }
1364
- let args = this.e, effects = prepareEffects(() => {
1369
+ let args = this.f, effects = prepareEffects(() => {
1365
1370
  branch = createBranch(
1366
1371
  $global,
1367
1372
  this,
1368
1373
  void 0,
1369
1374
  parentNode
1370
- ), args?.(branch, input);
1375
+ ), this.d && this.d(branch), args && args(branch, input);
1371
1376
  });
1372
1377
  return insertChildNodes(
1373
1378
  parentNode,
package/dist/dom.mjs CHANGED
@@ -117,19 +117,19 @@ var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
117
117
 
118
118
  // src/dom/resume.ts
119
119
  var registeredValues = {}, Render = class {
120
- p = [];
121
- q = {};
122
- B = {
120
+ q = [];
121
+ s = {};
122
+ C = {
123
123
  _: registeredValues
124
124
  };
125
125
  constructor(renders, runtimeId, renderId) {
126
- this.C = renders, this.D = runtimeId, this.s = renderId, this.t = renders[renderId], this.u();
126
+ this.D = renders, this.E = runtimeId, this.t = renderId, this.u = renders[renderId], this.x();
127
127
  }
128
128
  w() {
129
- this.t.w(), this.u();
129
+ this.u.w(), this.x();
130
130
  }
131
- u() {
132
- let data2 = this.t, serializeContext = this.B, scopeLookup = this.q, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
131
+ x() {
132
+ let data2 = this.u, serializeContext = this.C, scopeLookup = this.s, visits = data2.v, branchIds = /* @__PURE__ */ new Set(), parentBranchIds = /* @__PURE__ */ new Map();
133
133
  if (visits.length) {
134
134
  let commentPrefixLen = data2.i.length, closestBranchMarkers = /* @__PURE__ */ new Map(), visitNodes = new Set(visits), lastEndNode;
135
135
  data2.v = [];
@@ -145,22 +145,22 @@ var registeredValues = {}, Render = class {
145
145
  let commentText = visit.data, dataIndex = commentText.indexOf(" ") + 1, scopeId = commentText.slice(
146
146
  commentPrefixLen + 1,
147
147
  dataIndex ? dataIndex - 1 : commentText.length
148
- ), scope = scopeLookup[scopeId] ||= { d: +scopeId }, data3 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
148
+ ), scope = scopeLookup[scopeId] ||= { e: +scopeId }, data3 = dataIndex ? commentText.slice(dataIndex) : "", token = commentText[commentPrefixLen];
149
149
  if (token === "*" /* Node */) {
150
150
  let node = scope[data3] = visit.previousSibling;
151
151
  scope[data3 + ">" /* Getter */] = () => node;
152
152
  } else if (token === "$" /* ClosestBranch */)
153
153
  closestBranchMarkers.set(scopeId, visit);
154
154
  else if (token === "[" /* BranchStart */)
155
- this.f && (dataIndex && branchEnd(this.f, visit, visit), this.p.push(this.f)), this.f = scopeId, scope.a = visit;
155
+ this.g && (dataIndex && branchEnd(this.g, visit, visit), this.q.push(this.g)), this.g = scopeId, scope.a = visit;
156
156
  else if (token === "]" /* BranchEnd */) {
157
157
  scope[data3] = visit;
158
158
  let curParent = visit.parentNode, startNode = branchEnd(
159
- this.f,
159
+ this.g,
160
160
  visit,
161
161
  visit
162
162
  ).a;
163
- curParent !== startNode.parentNode && curParent.prepend(startNode), this.f = this.p.pop();
163
+ curParent !== startNode.parentNode && curParent.prepend(startNode), this.g = this.q.pop();
164
164
  } else if (token === "|" /* BranchSingleNode */ || token === "=" /* BranchSingleNodeOnlyChildInParent */) {
165
165
  let next = data3.indexOf(" "), curNode = visit;
166
166
  for (scope[~next ? data3.slice(0, next) : data3] = token === "=" /* BranchSingleNodeOnlyChildInParent */ ? visit.parentNode : visit; ~next; ) {
@@ -181,21 +181,21 @@ var registeredValues = {}, Render = class {
181
181
  let resumeData = resumes[i++];
182
182
  if (typeof resumeData == "function") {
183
183
  let scopes = resumeData(serializeContext), { $global } = scopeLookup;
184
- $global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.D, $global.renderId = this.s, $global.g = 1e6);
184
+ $global || (scopeLookup.$global = $global = scopes.$ || {}, $global.runtimeId = this.E, $global.renderId = this.t, $global.h = 1e6);
185
185
  for (let scopeId in scopes)
186
186
  if (scopeId !== "$") {
187
187
  let scope = scopes[scopeId], prevScope = scopeLookup[scopeId];
188
- scope.$global = $global, scope.d = +scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
188
+ scope.$global = $global, scope.e = +scopeId, prevScope !== scope && (scopeLookup[scopeId] = Object.assign(
189
189
  scope,
190
190
  prevScope
191
191
  ));
192
192
  let parentBranchId = parentBranchIds.get(scopeId);
193
193
  if (parentBranchId && (scope.c = scopes[parentBranchId]), branchIds.has(scopeId)) {
194
194
  let branch = scope, parentBranch = branch.c;
195
- scope.c = branch, parentBranch && (branch.x = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch));
195
+ scope.c = branch, parentBranch && (branch.y = parentBranch, (parentBranch.o ||= /* @__PURE__ */ new Set()).add(branch));
196
196
  }
197
197
  }
198
- } else i === len || typeof resumes[i] != "string" ? delete this.C[this.s] : registeredValues[resumes[i++]](
198
+ } else i === len || typeof resumes[i] != "string" ? delete this.D[this.t] : registeredValues[resumes[i++]](
199
199
  scopeLookup[resumeData],
200
200
  scopeLookup[resumeData]
201
201
  );
@@ -631,28 +631,28 @@ function toInsertNode(startNode, endNode) {
631
631
  var pendingScopes = [];
632
632
  function createScope($global, closestBranch) {
633
633
  let scope = {
634
- d: $global.g++,
635
- h: 1,
634
+ e: $global.h++,
635
+ j: 1,
636
636
  c: closestBranch,
637
637
  $global
638
638
  };
639
639
  return pendingScopes.push(scope), scope;
640
640
  }
641
641
  function skipScope(scope) {
642
- return scope.$global.g++;
642
+ return scope.$global.h++;
643
643
  }
644
644
  function finishPendingScopes() {
645
645
  for (let scope of pendingScopes)
646
- scope.h = 0;
646
+ scope.j = 0;
647
647
  pendingScopes = [];
648
648
  }
649
649
  function destroyBranch(branch) {
650
- branch.x?.n?.delete(branch), destroyNestedBranches(branch);
650
+ branch.y?.o?.delete(branch), destroyNestedBranches(branch);
651
651
  }
652
652
  function destroyNestedBranches(branch) {
653
- branch.y = 1, branch.n?.forEach(destroyNestedBranches), branch.E?.forEach((scope) => {
654
- for (let id in scope.k)
655
- scope.k[id]?.abort();
653
+ branch.z = 1, branch.o?.forEach(destroyNestedBranches), branch.F?.forEach((scope) => {
654
+ for (let id in scope.l)
655
+ scope.l[id]?.abort();
656
656
  });
657
657
  }
658
658
  function removeAndDestroyBranch(branch) {
@@ -669,20 +669,20 @@ function insertBranchBefore(branch, parentNode, nextSibling) {
669
669
 
670
670
  // src/dom/queue.ts
671
671
  var pendingRenders = [], pendingRendersLookup = /* @__PURE__ */ new Map(), pendingEffects = [], rendering = !1, scopeKeyOffset = 1e3;
672
- function queueRender(scope, signal, signalKey, value2, scopeKey = scope.d) {
672
+ function queueRender(scope, signal, signalKey, value2, scopeKey = scope.e) {
673
673
  let key = scopeKey * scopeKeyOffset + signalKey, existingRender = signalKey >= 0 && pendingRendersLookup.get(key);
674
674
  if (existingRender)
675
- existingRender.z = value2;
675
+ existingRender.A = value2;
676
676
  else {
677
677
  let render = {
678
- j: key,
679
- A: scope,
680
- F: signal,
681
- z: value2
678
+ k: key,
679
+ B: scope,
680
+ G: signal,
681
+ A: value2
682
682
  }, i = pendingRenders.push(render) - 1;
683
683
  for (; i; ) {
684
684
  let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
685
- if (key - parent.j >= 0) break;
685
+ if (key - parent.k >= 0) break;
686
686
  pendingRenders[i] = parent, i = parentIndex;
687
687
  }
688
688
  signalKey >= 0 && pendingRendersLookup.set(key, render), pendingRenders[i] = render;
@@ -721,27 +721,27 @@ function runRenders() {
721
721
  for (; pendingRenders.length; ) {
722
722
  let render = pendingRenders[0], item = pendingRenders.pop();
723
723
  if (render !== item) {
724
- let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).j;
724
+ let i = 0, mid = pendingRenders.length >> 1, key = (pendingRenders[0] = item).k;
725
725
  for (; i < mid; ) {
726
726
  let bestChild = (i << 1) + 1, right = bestChild + 1;
727
- if (right < pendingRenders.length && pendingRenders[right].j - pendingRenders[bestChild].j < 0 && (bestChild = right), pendingRenders[bestChild].j - key >= 0)
727
+ if (right < pendingRenders.length && pendingRenders[right].k - pendingRenders[bestChild].k < 0 && (bestChild = right), pendingRenders[bestChild].k - key >= 0)
728
728
  break;
729
729
  pendingRenders[i] = pendingRenders[bestChild], i = bestChild;
730
730
  }
731
731
  pendingRenders[i] = item;
732
732
  }
733
- render.A.c?.y || render.F(render.A, render.z);
733
+ render.B.c?.z || render.G(render.B, render.A);
734
734
  }
735
735
  finishPendingScopes();
736
736
  }
737
737
 
738
738
  // src/dom/abort-signal.ts
739
739
  function resetAbortSignal(scope, id) {
740
- let ctrl = scope.k?.[id];
741
- ctrl && (queueEffect(ctrl, abort), scope.k[id] = void 0);
740
+ let ctrl = scope.l?.[id];
741
+ ctrl && (queueEffect(ctrl, abort), scope.l[id] = void 0);
742
742
  }
743
743
  function getAbortSignal(scope, id) {
744
- return scope.c && (scope.c.E ||= /* @__PURE__ */ new Set()).add(scope), ((scope.k ||= {})[id] ||= new AbortController()).signal;
744
+ return scope.c && (scope.c.F ||= /* @__PURE__ */ new Set()).add(scope), ((scope.l ||= {})[id] ||= new AbortController()).signal;
745
745
  }
746
746
  function abort(ctrl) {
747
747
  ctrl.abort();
@@ -865,45 +865,34 @@ function walkInternal(currentWalkIndex, walkCodes, scope) {
865
865
  }
866
866
 
867
867
  // src/dom/renderer.ts
868
- function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
869
- let branch = createBranch(
870
- $global,
871
- tagNameOrRenderer,
872
- parentScope,
873
- parentNode
874
- );
875
- return typeof tagNameOrRenderer == "string" && (branch[0] = branch.a = branch.b = document.createElementNS(
876
- tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
877
- tagNameOrRenderer
878
- )), branch;
879
- }
880
868
  function createBranch($global, renderer, parentScope, parentNode) {
881
869
  let branch = createScope($global), parentBranch = parentScope?.c;
882
- return branch._ = renderer.l || parentScope, branch.c = branch, parentBranch && (branch.x = parentBranch, (parentBranch.n ||= /* @__PURE__ */ new Set()).add(branch)), renderer.o?.(
870
+ return branch._ = renderer.m || parentScope, branch.c = branch, parentBranch && (branch.y = parentBranch, (parentBranch.o ||= /* @__PURE__ */ new Set()).add(branch)), renderer.p?.(
883
871
  branch,
884
872
  parentNode.namespaceURI
885
873
  ), branch;
886
874
  }
887
875
  function createContent(id, template, walks, setup, getArgs, dynamicScopesAccessor) {
888
876
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
889
- let args, init2 = template ? (branch, ns) => {
877
+ let args, clone = template ? (branch, ns) => {
890
878
  ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(
891
879
  template,
892
880
  ns
893
- ))(branch, walks), setup && queueRender(branch, setup, -1);
881
+ ))(branch, walks);
894
882
  } : (branch) => {
895
883
  walk(
896
884
  branch.a = branch.b = new Text(),
897
885
  walks,
898
886
  branch
899
- ), setup && queueRender(branch, setup, -1);
887
+ );
900
888
  };
901
889
  return (owner) => ({
902
- d: id,
903
- o: init2,
904
- l: owner,
905
- m: dynamicScopesAccessor,
906
- get e() {
890
+ e: id,
891
+ p: clone,
892
+ d: setup,
893
+ m: owner,
894
+ n: dynamicScopesAccessor,
895
+ get f() {
907
896
  return args ||= getArgs ? getArgs() : void 0;
908
897
  }
909
898
  });
@@ -970,9 +959,9 @@ function value(valueAccessor, fn = () => {
970
959
  };
971
960
  }
972
961
  var accessorId = 0;
973
- function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "d") {
962
+ function intersection(id, fn, defaultPending = 1, scopeIdAccessor = /* @__KEY__ */ "e") {
974
963
  return (scope) => {
975
- scope.h ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
964
+ scope.j ? scope[id] === void 0 ? scope[id] = defaultPending : --scope[id] || fn(scope) : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
976
965
  };
977
966
  }
978
967
  function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
@@ -982,11 +971,11 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
982
971
  ownerScope,
983
972
  () => {
984
973
  for (let scope of scopes)
985
- !scope.h && !scope.y && childSignal(scope);
974
+ !scope.j && !scope.z && childSignal(scope);
986
975
  },
987
976
  -1,
988
977
  0,
989
- firstScope.d
978
+ firstScope.e
990
979
  );
991
980
  };
992
981
  return ownerSignal._ = childSignal, ownerSignal;
@@ -994,7 +983,7 @@ function loopClosure(valueAccessor, ownerLoopNodeAccessor, fn) {
994
983
  function conditionalClosure(valueAccessor, ownerConditionalNodeAccessor, branch, fn) {
995
984
  let childSignal = closure(valueAccessor, fn), scopeAccessor = ownerConditionalNodeAccessor + "!" /* ConditionalScope */, branchAccessor = ownerConditionalNodeAccessor + "(" /* ConditionalRenderer */, ownerSignal = (scope) => {
996
985
  let ifScope = scope[scopeAccessor];
997
- ifScope && !ifScope.h && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
986
+ ifScope && !ifScope.j && scope[branchAccessor] === branch && queueRender(ifScope, childSignal, -1);
998
987
  };
999
988
  return ownerSignal._ = childSignal, ownerSignal;
1000
989
  }
@@ -1010,8 +999,8 @@ function dynamicClosure(valueAccessor, fn, getOwnerScope) {
1010
999
  let subscribers = ownerScope[subscribersAccessor];
1011
1000
  if (subscribers)
1012
1001
  for (let subscriber of subscribers)
1013
- subscriber.h || queueRender(subscriber, childSignal, -1);
1014
- }, subscribe = ownerSignal.G = (scope) => subscribeToScopeSet(
1002
+ subscriber.j || queueRender(subscriber, childSignal, -1);
1003
+ }, subscribe = ownerSignal.H = (scope) => subscribeToScopeSet(
1015
1004
  getOwnerScope ? getOwnerScope(scope) : scope._,
1016
1005
  subscribersAccessor,
1017
1006
  scope
@@ -1022,7 +1011,7 @@ function dynamicClosure(valueAccessor, fn, getOwnerScope) {
1022
1011
  }
1023
1012
  function registerDynamicClosure(registryId, valueAccessor, fn, getOwnerScope) {
1024
1013
  let signal = dynamicClosure(valueAccessor, fn, getOwnerScope);
1025
- return register(registryId, signal.G), signal;
1014
+ return register(registryId, signal.H), signal;
1026
1015
  }
1027
1016
  function closure(valueAccessor, fn, getOwnerScope) {
1028
1017
  return (scope) => {
@@ -1068,7 +1057,7 @@ function conditional(nodeAccessor, ...branches) {
1068
1057
  scope,
1069
1058
  nodeAccessor,
1070
1059
  branches[scope[branchAccessor] = newBranch],
1071
- createBranch
1060
+ createAndSetupBranch
1072
1061
  );
1073
1062
  };
1074
1063
  }
@@ -1079,7 +1068,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1079
1068
  let childScopeAccessor = nodeAccessor + "!" /* ConditionalScope */, rendererAccessor = nodeAccessor + "(" /* ConditionalRenderer */;
1080
1069
  return (scope, newRenderer, getInput) => {
1081
1070
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
1082
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.d || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
1071
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.e || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor]))
1083
1072
  if (setConditionalRenderer(
1084
1073
  scope,
1085
1074
  nodeAccessor,
@@ -1092,16 +1081,16 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1092
1081
  scope[childScopeAccessor],
1093
1082
  0,
1094
1083
  content,
1095
- createBranch
1096
- ), content.m && subscribeToScopeSet(
1097
- content.l,
1084
+ createAndSetupBranch
1085
+ ), content.n && subscribeToScopeSet(
1098
1086
  content.m,
1087
+ content.n,
1099
1088
  scope[childScopeAccessor][0 + "!" /* ConditionalScope */]
1100
1089
  );
1101
1090
  }
1102
- } else normalizedRenderer?.m && subscribeToScopeSet(
1103
- normalizedRenderer.l,
1091
+ } else normalizedRenderer?.n && subscribeToScopeSet(
1104
1092
  normalizedRenderer.m,
1093
+ normalizedRenderer.n,
1105
1094
  scope[childScopeAccessor]
1106
1095
  );
1107
1096
  if (normalizedRenderer) {
@@ -1112,9 +1101,9 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1112
1101
  0,
1113
1102
  (inputIsArgs ? args[0] : args) || {}
1114
1103
  );
1115
- else if (normalizedRenderer.e)
1104
+ else if (normalizedRenderer.f)
1116
1105
  if (inputIsArgs)
1117
- normalizedRenderer.e(
1106
+ normalizedRenderer.f(
1118
1107
  scope[childScopeAccessor],
1119
1108
  normalizedRenderer._ ? args[0] : args
1120
1109
  );
@@ -1123,7 +1112,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1123
1112
  ...args,
1124
1113
  content: getContent(scope)
1125
1114
  } : args || {};
1126
- normalizedRenderer.e(
1115
+ normalizedRenderer.f(
1127
1116
  scope[childScopeAccessor],
1128
1117
  normalizedRenderer._ ? inputWithContent : [inputWithContent]
1129
1118
  );
@@ -1162,19 +1151,35 @@ function loopTo(nodeAccessor, renderer) {
1162
1151
  );
1163
1152
  }
1164
1153
  function loop(nodeAccessor, renderer, forEach) {
1165
- let params = renderer.e;
1154
+ let params = renderer.f;
1166
1155
  return (scope, value2) => {
1167
1156
  let referenceNode = scope[nodeAccessor], oldMap = scope[nodeAccessor + "(" /* LoopScopeMap */], oldArray = oldMap ? scope[nodeAccessor + "!" /* LoopScopeArray */] || [
1168
1157
  ...oldMap.values()
1169
1158
  ] : [], parentNode = referenceNode.nodeType > 1 /* Element */ ? referenceNode.parentNode || oldArray[0].a.parentNode : referenceNode, newMap = scope[nodeAccessor + "(" /* LoopScopeMap */] = /* @__PURE__ */ new Map(), newArray = scope[nodeAccessor + "!" /* LoopScopeArray */] = [];
1170
1159
  forEach(value2, (key, args) => {
1171
- let branch = oldMap?.get(key) || createBranch(scope.$global, renderer, scope, parentNode);
1160
+ let branch = oldMap?.get(key) || createAndSetupBranch(scope.$global, renderer, scope, parentNode);
1172
1161
  params?.(branch, args), newMap.set(key, branch), newArray.push(branch);
1173
1162
  });
1174
1163
  let afterReference = null;
1175
1164
  referenceNode !== parentNode && (oldArray.length ? (afterReference = oldArray[oldArray.length - 1].b.nextSibling, newArray.length || parentNode.insertBefore(referenceNode, afterReference)) : newArray.length && (afterReference = referenceNode.nextSibling, referenceNode.remove())), reconcile(parentNode, oldArray, newArray, afterReference);
1176
1165
  };
1177
1166
  }
1167
+ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1168
+ let branch = createBranch($global, renderer, parentScope, parentNode);
1169
+ return renderer.d && queueRender(branch, renderer.d, -1), branch;
1170
+ }
1171
+ function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
1172
+ let branch = createBranch(
1173
+ $global,
1174
+ tagNameOrRenderer,
1175
+ parentScope,
1176
+ parentNode
1177
+ );
1178
+ return typeof tagNameOrRenderer == "string" ? branch[0] = branch.a = branch.b = document.createElementNS(
1179
+ tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI,
1180
+ tagNameOrRenderer
1181
+ ) : tagNameOrRenderer.d && queueRender(branch, tagNameOrRenderer.d, -1), branch;
1182
+ }
1178
1183
  function bySecondArg(_item, index) {
1179
1184
  return index;
1180
1185
  }
@@ -1195,7 +1200,7 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1195
1200
  register(RENDERER_REGISTER_ID, fn);
1196
1201
  },
1197
1202
  isRenderer(renderer) {
1198
- return renderer.o;
1203
+ return renderer.p;
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]?.q[value2[1]]
1223
+ value2.length === 2 && window[runtimeId]?.[componentIdPrefix === "s" ? "_" : componentIdPrefix]?.s[value2[1]]
1219
1224
  ) : value2;
1220
1225
  },
1221
1226
  createRenderer(args, clone) {
1222
1227
  let renderer = createRenderer(0, 0, 0, () => args);
1223
- return renderer.o = (branch) => {
1228
+ return renderer.p = (branch) => {
1224
1229
  let cloned = clone();
1225
1230
  branch.a = cloned.startNode, branch.b = cloned.endNode;
1226
1231
  }, renderer;
@@ -1235,12 +1240,12 @@ var classIdToBranch = /* @__PURE__ */ new Map(), compat = {
1235
1240
  normalizedInput[key === "renderBody" ? "content" : key] = input[key];
1236
1241
  }
1237
1242
  if (component.effects = prepareEffects(() => {
1238
- branch ? existing = !0 : (out.global.g ||= 0, branch = component.scope = createBranch(
1243
+ branch ? existing = !0 : (out.global.h ||= 0, branch = component.scope = createBranch(
1239
1244
  out.global,
1240
1245
  renderer,
1241
- renderer.l,
1246
+ renderer.m,
1242
1247
  document.body
1243
- )), renderer.e?.(branch, renderer._ ? args[0] : args);
1248
+ ), renderer.d && renderer.d(branch)), renderer.f?.(branch, renderer._ ? args[0] : args);
1244
1249
  }), !existing)
1245
1250
  return toInsertNode(branch.a, branch.b);
1246
1251
  }
@@ -1260,12 +1265,12 @@ var createTemplate = (id, template, walks, setup, inputSignal) => {
1260
1265
  function mount(input = {}, reference, position) {
1261
1266
  let branch, parentNode = reference, nextSibling = null, { $global } = input;
1262
1267
  switch ($global ? ({ $global, ...input } = input, $global = {
1263
- g: 0,
1268
+ h: 0,
1264
1269
  runtimeId: DEFAULT_RUNTIME_ID,
1265
1270
  renderId: DEFAULT_RENDER_ID,
1266
1271
  ...$global
1267
1272
  }) : $global = {
1268
- g: 0,
1273
+ h: 0,
1269
1274
  runtimeId: DEFAULT_RUNTIME_ID,
1270
1275
  renderId: DEFAULT_RENDER_ID
1271
1276
  }, position) {
@@ -1279,13 +1284,13 @@ function mount(input = {}, reference, position) {
1279
1284
  parentNode = reference.parentNode, nextSibling = reference.nextSibling;
1280
1285
  break;
1281
1286
  }
1282
- let args = this.e, effects = prepareEffects(() => {
1287
+ let args = this.f, effects = prepareEffects(() => {
1283
1288
  branch = createBranch(
1284
1289
  $global,
1285
1290
  this,
1286
1291
  void 0,
1287
1292
  parentNode
1288
- ), args?.(branch, input);
1293
+ ), this.d && this.d(branch), args && args(branch, input);
1289
1294
  });
1290
1295
  return insertChildNodes(
1291
1296
  parentNode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "0.3.50",
3
+ "version": "0.3.51",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",