marko 6.4.9 → 6.4.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/cheatsheet.md +1 -1
  2. package/dist/common/accessor.d.ts +0 -3
  3. package/dist/common/accessor.debug.d.ts +0 -3
  4. package/dist/common/helpers.d.ts +1 -1
  5. package/dist/common/types.d.ts +4 -3
  6. package/dist/debug/dom/catch.feat.js +2 -3
  7. package/dist/debug/dom/catch.feat.mjs +2 -3
  8. package/dist/debug/dom/controllable-input.feat.js +2 -3
  9. package/dist/debug/dom/controllable-input.feat.mjs +2 -3
  10. package/dist/debug/dom/controllable-open.feat.js +2 -3
  11. package/dist/debug/dom/controllable-open.feat.mjs +2 -3
  12. package/dist/debug/dom/controllable-select.feat.js +2 -3
  13. package/dist/debug/dom/controllable-select.feat.mjs +2 -3
  14. package/dist/debug/dom/controllable-textarea.feat.js +2 -3
  15. package/dist/debug/dom/controllable-textarea.feat.mjs +2 -3
  16. package/dist/debug/dom/controllable.feat.js +2 -3
  17. package/dist/debug/dom/controllable.feat.mjs +2 -3
  18. package/dist/debug/dom/dynamic-tag-script.feat.js +2 -3
  19. package/dist/debug/dom/dynamic-tag-script.feat.mjs +2 -3
  20. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  21. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  22. package/dist/debug/dom/lazy.feat.js +2 -3
  23. package/dist/debug/dom/lazy.feat.mjs +2 -3
  24. package/dist/debug/dom/placeholder.feat.js +2 -3
  25. package/dist/debug/dom/placeholder.feat.mjs +2 -3
  26. package/dist/debug/{dom-VKjkbuuo.mjs → dom-DjUZd-9y.mjs} +221 -261
  27. package/dist/debug/{dom-QkYva5Qx.js → dom-mQ5mPBTF.js} +226 -260
  28. package/dist/debug/dom.js +10 -18
  29. package/dist/debug/dom.mjs +10 -19
  30. package/dist/debug/html.js +87 -125
  31. package/dist/debug/html.mjs +87 -125
  32. package/dist/dom/abort-signal.d.ts +1 -1
  33. package/dist/dom/catch.feat.js +4 -5
  34. package/dist/dom/catch.feat.mjs +2 -3
  35. package/dist/dom/control-flow.d.ts +4 -4
  36. package/dist/dom/controllable-input.feat.js +1 -2
  37. package/dist/dom/controllable-input.feat.mjs +1 -2
  38. package/dist/dom/controllable-open.feat.js +2 -3
  39. package/dist/dom/controllable-open.feat.mjs +2 -3
  40. package/dist/dom/controllable-select.feat.js +2 -3
  41. package/dist/dom/controllable-select.feat.mjs +2 -3
  42. package/dist/dom/controllable-textarea.feat.js +2 -3
  43. package/dist/dom/controllable-textarea.feat.mjs +2 -3
  44. package/dist/dom/controllable.feat.js +1 -2
  45. package/dist/dom/controllable.feat.mjs +1 -2
  46. package/dist/dom/dynamic-tag-script.feat.js +3 -4
  47. package/dist/dom/dynamic-tag-script.feat.mjs +2 -3
  48. package/dist/dom/dynamic-tag-var.feat.js +3 -4
  49. package/dist/dom/dynamic-tag-var.feat.mjs +1 -2
  50. package/dist/dom/lazy.feat.js +2 -3
  51. package/dist/dom/lazy.feat.mjs +2 -3
  52. package/dist/dom/load.d.ts +3 -4
  53. package/dist/dom/placeholder.feat.js +2 -3
  54. package/dist/dom/placeholder.feat.mjs +2 -3
  55. package/dist/dom/queue.d.ts +1 -2
  56. package/dist/dom/signals.d.ts +5 -7
  57. package/dist/{dom-IujlfJ6b.js → dom-B8j2453O.js} +158 -190
  58. package/dist/{dom-DtKQb840.mjs → dom-HEWdZCCb.mjs} +134 -172
  59. package/dist/dom.d.ts +1 -1
  60. package/dist/dom.js +22 -30
  61. package/dist/dom.mjs +10 -19
  62. package/dist/html/assets.d.ts +3 -4
  63. package/dist/html/for.d.ts +0 -1
  64. package/dist/html/writer.d.ts +2 -2
  65. package/dist/html.d.ts +1 -1
  66. package/dist/html.js +99 -131
  67. package/dist/html.mjs +99 -132
  68. package/dist/translator/index.d.ts +0 -1
  69. package/dist/translator/index.js +4771 -4760
  70. package/dist/translator/interop/out-global.d.ts +5 -0
  71. package/dist/translator/util/assert.d.ts +13 -2
  72. package/dist/translator/util/entry-builder.d.ts +1 -1
  73. package/dist/translator/util/finalize-references.d.ts +2 -1
  74. package/dist/translator/util/for-selector.d.ts +1 -1
  75. package/dist/translator/util/known-tag.d.ts +10 -1
  76. package/dist/translator/util/references.d.ts +11 -5
  77. package/dist/translator/util/runtime.d.ts +1 -0
  78. package/dist/translator/util/sections.d.ts +6 -1
  79. package/dist/translator/util/signals.d.ts +2 -1
  80. package/dist/translator/util/sources.d.ts +1 -1
  81. package/dist/translator/util/style-interpolation.d.ts +1 -1
  82. package/dist/translator/util/tag-name-type.d.ts +4 -0
  83. package/dist/translator/util/visitors.d.ts +1 -1
  84. package/dist/translator/util/write-guard.d.ts +2 -0
  85. package/dist/translator/visitors/program/index.d.ts +0 -4
  86. package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
  87. package/package.json +6 -6
  88. package/tags/lifecycle.d.marko +2 -0
  89. package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
  90. package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
@@ -1,12 +1,4 @@
1
- let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
2
- let str = "", sep = "", part;
3
- if (val) {
4
- if (typeof val != "object") str += val;
5
- else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
6
- else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
7
- }
8
- return str;
9
- }, decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), branchesEnabled, dynamicHtmlEnabled, rendering, runId = 2, pendingEffects = [], pendingRenders = [], queuePendingRender = (render) => {
1
+ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "\\3B " : "\\\\", decodeAccessor = (num) => (num + (num < 26 ? 10 : num < 962 ? 334 : 11998)).toString(36), branchesEnabled, dynamicHtmlEnabled, rendering, runId = 2, pendingEffects = [], pendingRenders = [], queuePendingRender = (render) => {
10
2
  let i = pendingRenders.push(render) - 1;
11
3
  for (; i;) {
12
4
  let parentIndex = i - 1 >> 1, parent = pendingRenders[parentIndex];
@@ -14,29 +6,11 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
14
6
  pendingRenders[i] = parent, i = parentIndex;
15
7
  }
16
8
  pendingRenders[i] = render;
17
- }, runEffects = ((effects) => {
9
+ }, runEffects = (effects) => {
18
10
  for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
19
- }), runRender = (render) => {
20
- (!branchesEnabled || render.b.F?.H !== 0) && render.c(render.b, render.d);
21
- }, catchEnabled, abortsEnabled, subscriptionsEnabled, delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
22
- scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
23
- }, isScheduled, channel, _return = (scope, value) => scope.T ? scope.T(value) : scope.RV = value, _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), currentNode, walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
24
- let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
25
- for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) scope[decodeAccessor(currentScopeIndex++)] = currentNode;
26
- else if (value === 37 || value === 49) currentNode.replaceWith(currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
27
- else if (value === 38) return currentWalkIndex;
28
- else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
29
- else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;) if (currentNode.firstChild) currentNode = currentNode.firstChild;
30
- else {
31
- for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
32
- walkNextSibling();
33
- }
34
- else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walkNextSibling();
35
- else if (value < 117) {
36
- for (value = 10 * currentMultiplier + value - 107; value--;) currentNode = currentNode.parentNode || currentNode;
37
- walkNextSibling();
38
- } else storedMultiplier = currentMultiplier * 10 + value - 117;
39
- }, walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, cloneCache = {}, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
11
+ }, runRender = (render) => {
12
+ branchesEnabled && render.b.F?.H === 0 || render.c(render.b, render.d);
13
+ }, catchEnabled, abortsEnabled, subscriptionsEnabled, delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, isScheduled, channel, _return = (scope, value) => scope.T ? scope.T(value) : scope.RV = value, _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), currentNode, walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode, _resumed = {}, curRenders, embedRenders, readyIds, lazyEnabled, isResuming, _html = /*@__PURE__*/ withDynamicHtml(function(scope, value, accessor) {
40
14
  let prevValue = scope["R" + accessor];
41
15
  if (prevValue !== (scope["R" + accessor] = _to_text(value))) {
42
16
  let firstChild = scope[accessor], parentNode = firstChild.parentNode, lastChild = scope["H" + accessor] || firstChild, newContent = parseHTML(scope["R" + accessor], parentNode.namespaceURI);
@@ -59,7 +33,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
59
33
  nodeAccessor = decodeAccessor(nodeAccessor), startNodeAccessor !== void 0 && (startNodeAccessor = decodeAccessor(startNodeAccessor));
60
34
  let rangeAccessor = "A" + nodeAccessor;
61
35
  return (scope, display) => {
62
- let referenceNode = scope[nodeAccessor], onlyChild = referenceNode.nodeType === 1, parentNode = onlyChild ? referenceNode : referenceNode.parentNode, range = scope[rangeAccessor];
36
+ let referenceNode = scope[nodeAccessor], onlyChild = referenceNode.nodeType < 3, parentNode = onlyChild ? referenceNode : referenceNode.parentNode, range = scope[rangeAccessor];
63
37
  range || (range = scope[rangeAccessor] = {}, range.S = onlyChild ? parentNode.insertBefore(new Text(), parentNode.firstChild) : startNodeAccessor ? scope[startNodeAccessor] : referenceNode.previousSibling);
64
38
  let startNode = range.S;
65
39
  range.L && startNode.tagName === "T" ? display && startNode.replaceWith(range.S = new Text(), ...startNode.childNodes) : display ? startNode.parentNode !== parentNode && parentNode.insertBefore(startNode.parentNode, onlyChild ? null : referenceNode) : startNode.parentNode === parentNode && (range.K = onlyChild ? parentNode.lastChild : referenceNode.previousSibling, detachBranch(range));
@@ -112,22 +86,19 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
112
86
  let oldLen = oldScopes.length, parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.S.parentNode : referenceNode, oldScopesByKey, hasPotentialMoves, start = 0;
113
87
  forEach(value, (key, args) => {
114
88
  let i = newScopes.length, oldScope = oldScopes[i], branch = oldLen && (oldScopesByKey || key !== (oldScope?.M ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope.I = j, map.set(scope.M ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
115
- branch ? (hasPotentialMoves = !0, oldScopesByKey?.delete(key), branch.M = key) : ((branch = createBranch(scope.$, renderer, scope, parentNode)).M = key, setupBranch(renderer, branch)), newScopes.push(branch), params?.(branch, args);
89
+ branch ? (hasPotentialMoves = 1, oldScopesByKey?.delete(key), branch.M = key) : ((branch = createBranch(scope.$, renderer, scope, parentNode)).M = key, setupBranch(renderer, branch)), newScopes.push(branch), params?.(branch, args);
116
90
  }), scope[scopesAccessor] = newScopes;
117
91
  let newLen = newScopes.length, hasSiblings = referenceNode !== parentNode, afterReference = null, oldEnd = oldLen - 1, newEnd = newLen - 1;
118
92
  if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
119
93
  oldLen && (oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch), hasSiblings || (parentNode.textContent = ""));
120
94
  for (let newScope of newScopes) insertBranchBefore(newScope, parentNode, afterReference);
121
- return;
122
- }
123
- if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
124
- else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
125
- for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd];) oldEnd--, newEnd--;
126
- if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd || start > newEnd) {
127
- for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
128
- return;
95
+ } else {
96
+ if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
97
+ else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
98
+ for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd];) oldEnd--, newEnd--;
99
+ if (oldEnd + 1 < oldLen && (afterReference = oldScopes[oldEnd + 1].S), start > oldEnd || start > newEnd) for (let i = start; i <= newEnd; i++) insertBranchBefore(newScopes[i], parentNode, afterReference);
100
+ else reorder(newScopes, start, newEnd, parentNode, afterReference);
129
101
  }
130
- reorder(newScopes, start, newEnd, parentNode, afterReference);
131
102
  };
132
103
  }), _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
133
104
  by ||= bySecondArg, typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
@@ -138,7 +109,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
138
109
  }, reorderKeyed), _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
139
110
  by ||= byFirstArg, forUntil(until, from, step, (v) => cb(by(v), [v]));
140
111
  }, reorderKeyed), _for_of_unkeyed = /*@__PURE__*/ loop(([all], cb) => forOf(all, (item, i) => cb(i, [item, i]))), _for_to_unkeyed = /*@__PURE__*/ loop(([to, from, step], cb) => forTo(to, from, step, (v) => cb(v, [v]))), _for_until_unkeyed = /*@__PURE__*/ loop(([until, from, step], cb) => forUntil(until, from, step, (v) => cb(v, [v])));
141
- //#region src/common/helpers.ts
112
+ // src/common/helpers.ts
142
113
  function _call(fn, v) {
143
114
  return fn(v), v;
144
115
  }
@@ -156,6 +127,15 @@ function escapeStyleValue(str) {
156
127
  for (let c of result) c === "(" ? closers = ")" + closers : c === "[" ? closers = "]" + closers : c === closers[0] && (closers = closers.slice(1));
157
128
  return result + closers;
158
129
  }
130
+ function toDelimitedString(val, delimiter, stringify) {
131
+ let str = "", sep = "", part;
132
+ if (val) {
133
+ if (typeof val != "object") str += val;
134
+ else if (Array.isArray(val)) for (let v of val) part = toDelimitedString(v, delimiter, stringify), part && (str += sep + part, sep = delimiter);
135
+ else for (let name in val) part = stringify(name, val[name]), part && (str += sep + part, sep = delimiter);
136
+ }
137
+ return str;
138
+ }
159
139
  function isEventHandler(name) {
160
140
  return /^on[A-Z-]/.test(name);
161
141
  }
@@ -181,13 +161,11 @@ function withBranches(runtime) {
181
161
  function withDynamicHtml(runtime) {
182
162
  return dynamicHtmlEnabled = 1, runtime;
183
163
  }
184
- //#endregion
185
- //#region src/common/errors.ts
164
+ // src/common/errors.ts
186
165
  function _assert_class_toggles(classes, toggles) {}
187
166
  function _hoist_read_error() {}
188
167
  function _assert_hoist(value) {}
189
- //#endregion
190
- //#region src/common/for.ts
168
+ // src/common/for.ts
191
169
  function forIn(obj, cb) {
192
170
  for (let key in obj) cb(key, obj[key]);
193
171
  }
@@ -205,8 +183,7 @@ function forUntil(until, from, step, cb) {
205
183
  let start = from || 0, delta = step || 1;
206
184
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
207
185
  }
208
- //#endregion
209
- //#region src/dom/queue.ts
186
+ // src/dom/queue.ts
210
187
  function queueRender(scope, signal, signalKey, value, scopeKey = scope.L) {
211
188
  let render;
212
189
  if (signalKey >= 0 && (render = scope[signalKey])) {
@@ -289,8 +266,7 @@ function runRenders(renders = pendingRenders) {
289
266
  runRender(render);
290
267
  }
291
268
  }
292
- //#endregion
293
- //#region src/dom/abort-signal.ts
269
+ // src/dom/abort-signal.ts
294
270
  function $signalReset(scope, id) {
295
271
  let ctrl = scope.A?.[id];
296
272
  ctrl && (scope.A[id] = void 0, rendering ? queueEffect(ctrl, abort) : abort(ctrl));
@@ -299,7 +275,7 @@ function $signal(scope, id) {
299
275
  return abortsEnabled = 1, trackCleanup(scope), ((scope.A ||= {})[id] ||= new AbortController()).signal;
300
276
  }
301
277
  /** Runs `abort` as a destroyed scope's `$signal` would fire, without creating one. */
302
- function trackAbort(scope, id, abort) {
278
+ function onAbort(scope, id, abort) {
303
279
  abortsEnabled = 1, trackCleanup(scope), (scope.A ||= {})[id] = { abort };
304
280
  }
305
281
  /** Enrols `scope` with its branch so destroying the branch cleans it up. */
@@ -310,8 +286,7 @@ function trackCleanup(scope, subscribers) {
310
286
  function abort(ctrl) {
311
287
  ctrl.abort();
312
288
  }
313
- //#endregion
314
- //#region src/common/opt.ts
289
+ // src/common/opt.ts
315
290
  function toArray(opt) {
316
291
  return opt ? Array.isArray(opt) ? opt : [opt] : [];
317
292
  }
@@ -324,8 +299,7 @@ function forEach(opt, cb) {
324
299
  function push(opt, item) {
325
300
  return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
326
301
  }
327
- //#endregion
328
- //#region src/dom/event.ts
302
+ // src/dom/event.ts
329
303
  function _on(element, type, handler) {
330
304
  delegate(type, handleDelegated), element[1 + type] = handler || null;
331
305
  }
@@ -333,14 +307,12 @@ function handleDelegated(ev) {
333
307
  let target = !rendering && ev.target;
334
308
  for (; target;) target[1 + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
335
309
  }
336
- //#endregion
337
- //#region src/dom/parse-html.ts
310
+ // src/dom/parse-html.ts
338
311
  function parseHTML(html, ns) {
339
312
  let parser = parsers[ns] ||= document.createElementNS(ns, "template");
340
313
  return parser.innerHTML = html, parser.content || parser;
341
314
  }
342
- //#endregion
343
- //#region src/dom/scope.ts
315
+ // src/dom/scope.ts
344
316
  function createScope($global, closestBranch) {
345
317
  let scope = {
346
318
  L: nextScopeId++,
@@ -369,11 +341,14 @@ function skipScope() {
369
341
  return nextScopeId++;
370
342
  }
371
343
  function destroyBranch(branch) {
372
- branch.N?.D?.delete(branch), destroyNestedScopes(branch);
344
+ branch.N?.D.delete(branch), destroyNestedScopes(branch);
373
345
  }
374
346
  function destroyScope(scope) {
375
347
  scope.H && (destroyNestedScopes(scope), cleanupScope(scope));
376
348
  }
349
+ function destroyNestedScopes(scope) {
350
+ scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
351
+ }
377
352
  function cleanupScope(scope) {
378
353
  if (subscriptionsEnabled && scope.Z?.forEach(unsubscribe, scope), abortsEnabled) for (let id in scope.A) $signalReset(scope, id);
379
354
  }
@@ -390,8 +365,7 @@ function detachBranch(branch) {
390
365
  let fragment = new DocumentFragment();
391
366
  fragment.namespaceURI = branch.S.parentNode.namespaceURI, insertChildNodes(fragment, null, branch.S, branch.K);
392
367
  }
393
- //#endregion
394
- //#region src/dom/schedule.ts
368
+ // src/dom/schedule.ts
395
369
  function schedule() {
396
370
  isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
397
371
  }
@@ -403,8 +377,7 @@ function triggerMacroTask() {
403
377
  isScheduled = 0, run();
404
378
  }), channel.port2.postMessage(0);
405
379
  }
406
- //#endregion
407
- //#region src/dom/signals.ts
380
+ // src/dom/signals.ts
408
381
  function _let(id, fn) {
409
382
  let valueAccessor = decodeAccessor(id);
410
383
  return (scope, value) => (rendering ? scope.H === runId && (scope[valueAccessor] = value, fn?.(scope)) : (scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn) && (schedule(), queueRender(scope, fn, id)), value);
@@ -415,37 +388,31 @@ function _let_change(id, fn) {
415
388
  }
416
389
  function _const(valueAccessor, fn) {
417
390
  return valueAccessor = decodeAccessor(valueAccessor), ((scope, value) => {
418
- (scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn?.(scope));
391
+ scope[valueAccessor] === value && valueAccessor in scope || (scope[valueAccessor] = value, fn?.(scope));
419
392
  });
420
393
  }
421
- function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
422
- return scopeIdAccessor !== "L" && (scopeIdAccessor = decodeAccessor(scopeIdAccessor)), (scope) => {
394
+ function _or(id, fn, defaultPending = 1, scopeIdAccessor) {
395
+ return scopeIdAccessor = scopeIdAccessor ? decodeAccessor(scopeIdAccessor) : "L", (scope) => {
423
396
  scope.H === runId ? ~id in scope ? --scope[~id] || fn(scope) : scope[~id] = defaultPending : queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
424
397
  };
425
398
  }
426
- function _for_closure(ownerLoopNodeAccessor, fn) {
427
- ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor);
428
- let scopeAccessor = "A" + ownerLoopNodeAccessor, ownerSignal = (ownerScope) => {
429
- let scopes = toArray(ownerScope[scopeAccessor]);
430
- queueRender(ownerScope, (_) => {
431
- for (let scope of scopes) scope.H > 0 && scope.H < runId && fn(scope);
432
- }, -1);
433
- };
399
+ function _for_closure(ownerLoopNodeAccessor, fn, id, scopeIdAccessor) {
400
+ ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor), scopeIdAccessor = scopeIdAccessor ? decodeAccessor(scopeIdAccessor) : "L";
401
+ let scopeAccessor = "A" + ownerLoopNodeAccessor, render = (ownerScope) => {
402
+ for (let scope of toArray(ownerScope[scopeAccessor])) scope.H < runId && fn(scope);
403
+ }, ownerSignal = (ownerScope) => queueRender(ownerScope, render, id, 0, ownerScope[scopeIdAccessor]);
434
404
  return ownerSignal._ = (scope) => queueRender(scope, fn, -1), ownerSignal;
435
405
  }
436
- function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
406
+ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn, getValueScope) {
437
407
  ownerLoopNodeAccessor = decodeAccessor(ownerLoopNodeAccessor), ownerValueAccessor = decodeAccessor(ownerValueAccessor);
438
- let scopeAccessor = "A" + ownerLoopNodeAccessor, mapAccessor = "O" + ownerLoopNodeAccessor, prevKeyProp = `_${ownerValueAccessor}`, ownerSignal = (ownerScope) => {
408
+ let scopeAccessor = "A" + ownerLoopNodeAccessor, mapAccessor = "O" + ownerLoopNodeAccessor, prevKey = Symbol(), ownerSignal = (ownerScope) => {
439
409
  if (ownerScope.H < runId) {
440
- let nextKey = ownerScope[ownerValueAccessor];
441
- queueRender(ownerScope, (_) => {
442
- let map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
443
- if (map && prevKeyProp in map) {
444
- let prevScope = map.get(map[prevKeyProp]), nextScope = map.get(nextKey);
445
- prevScope !== nextScope && (runLiveBranch(prevScope, fn), runLiveBranch(nextScope, fn));
446
- } else for (let scope of toArray(ownerScope[scopeAccessor])) runLiveBranch(scope, fn);
447
- map && (map[prevKeyProp] = nextKey);
448
- }, -1);
410
+ let nextKey = (getValueScope ? getValueScope(ownerScope) : ownerScope)[ownerValueAccessor], map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
411
+ if (map && prevKey in ownerScope) {
412
+ let prevScope = map.get(ownerScope[prevKey]), nextScope = map.get(nextKey);
413
+ prevScope !== nextScope && (queueLiveBranch(prevScope, fn), queueLiveBranch(nextScope, fn));
414
+ } else for (let scope of toArray(ownerScope[scopeAccessor])) queueLiveBranch(scope, fn);
415
+ ownerScope[prevKey] = nextKey;
449
416
  }
450
417
  };
451
418
  return ownerSignal._ = (scope) => queueRender(scope, fn, -1), ownerSignal;
@@ -459,8 +426,8 @@ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
459
426
  }
460
427
  return map;
461
428
  }
462
- function runLiveBranch(scope, fn) {
463
- scope && scope.H > 0 && scope.H < runId && fn(scope);
429
+ function queueLiveBranch(scope, fn) {
430
+ scope?.H < runId && queueRender(scope, fn, -1);
464
431
  }
465
432
  function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
466
433
  ownerConditionalNodeAccessor = decodeAccessor(ownerConditionalNodeAccessor);
@@ -508,9 +475,7 @@ function _id(scope, accessor) {
508
475
  return id;
509
476
  }
510
477
  function _script(id, fn) {
511
- return _resumed[id] = fn, (scope) => {
512
- queueEffect(scope, fn);
513
- };
478
+ return _resumed[id] = fn, (scope) => queueEffect(scope, fn);
514
479
  }
515
480
  function _global_read($global, key) {
516
481
  return $global[key];
@@ -536,14 +501,29 @@ function _hoist(...path) {
536
501
  function _hoist_resume(id, ...path) {
537
502
  return _resumed[id] = _hoist(...path);
538
503
  }
539
- //#endregion
540
- //#region src/dom/walker.ts
504
+ // src/dom/walker.ts
541
505
  /** Cloned templates are small, where a TreeWalker's per-step cost dominates. */
542
506
  function walk(startNode, walkCodes, branch) {
543
507
  currentNode = startNode, walkInternal(0, walkCodes, branch);
544
508
  }
545
- //#endregion
546
- //#region src/dom/resume.ts
509
+ function walkInternal(currentWalkIndex, walkCodes, scope) {
510
+ let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
511
+ for (; currentWalkIndex < walkCodes.length;) if (value = walkCodes.charCodeAt(currentWalkIndex++), currentMultiplier = storedMultiplier, storedMultiplier = 0, value === 32) scope[decodeAccessor(currentScopeIndex++)] = currentNode;
512
+ else if (value === 37 || value === 49) currentNode.replaceWith(currentNode = scope[decodeAccessor(currentScopeIndex++)] = new Text()), value === 49 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
513
+ else if (value === 38) return currentWalkIndex;
514
+ else if (value === 47 || value === 48) currentWalkIndex = walkInternal(currentWalkIndex, walkCodes, scope[decodeAccessor(currentScopeIndex++)] = createScope(scope.$, scope.F)), value === 48 && (scope[decodeAccessor(currentScopeIndex++)] = skipScope());
515
+ else if (value < 92) for (value = 25 * currentMultiplier + value - 67; value--;) if (currentNode.firstChild) currentNode = currentNode.firstChild;
516
+ else {
517
+ for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
518
+ walkNextSibling();
519
+ }
520
+ else if (value < 107) for (value = 10 * currentMultiplier + value - 97; value--;) walkNextSibling();
521
+ else if (value < 117) {
522
+ for (value = 10 * currentMultiplier + value - 107; value--;) currentNode = currentNode.parentNode || currentNode;
523
+ walkNextSibling();
524
+ } else storedMultiplier = currentMultiplier * 10 + value - 117;
525
+ }
526
+ // src/dom/resume.ts
547
527
  function ready(readyId) {
548
528
  (readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
549
529
  for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
@@ -565,23 +545,21 @@ function initEmbedded(readyId, runtimeId) {
565
545
  }
566
546
  function init(runtimeId = "M") {
567
547
  if (curRenders) return;
568
- let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => {
569
- defineRuntime({ value: curRenders = ((renderId) => {
570
- let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = (_) => scopeLookup[0] ||= {
571
- runtimeId,
572
- renderId
573
- }, initScope = (scope) => (scope.H ??= 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
574
- let scopeId = partials[0];
575
- for (let i = 1; i < partials.length; i++) {
576
- let partial = partials[i];
577
- typeof partial == "number" ? scopeId += partial : (scopeId ? initScope(Object.assign(scopeLookup[scopeId] ||= (partial.L = scopeId, partial), partial)) : Object.assign(initGlobal(), partial), scopeId++);
578
- }
579
- }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope.F === scope ? scope !== branch && setParentBranch(scope, branch) : scope.F = branch) => (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
580
- if (visitType === "*") {
581
- for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
582
- (reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
583
- return;
584
- }
548
+ let renders = self[runtimeId], defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc), initRuntime = (renders) => defineRuntime({ value: curRenders = ((renderId) => {
549
+ let render = curRenders[renderId] = renders[renderId] || renders(renderId), walk = render.w, scopeLookup = {}, pending = [], getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { L: +id }) : initGlobal()), initGlobal = (_) => scopeLookup[0] ||= {
550
+ runtimeId,
551
+ renderId
552
+ }, initScope = (scope) => (scope.H ??= 1, scope.$ = initGlobal(), branchesEnabled && scope.G && (scope.F = getScope(scope.G)), scope), applyScopes = (partials) => {
553
+ let scopeId = partials[0];
554
+ for (let i = 1; i < partials.length; i++) {
555
+ let partial = partials[i];
556
+ typeof partial == "number" ? scopeId += partial : (scopeId ? initScope(Object.assign(scopeLookup[scopeId] ||= (partial.L = scopeId, partial), partial)) : Object.assign(initGlobal(), partial), scopeId++);
557
+ }
558
+ }, serializeContext = ((data, registryId) => typeof data == "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data)), createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope.F === scope ? scope !== branch && setParentBranch(scope, branch) : scope.F = branch) => (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
559
+ if (visitType === "*") {
560
+ for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
561
+ (reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
562
+ } else {
585
563
  for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
586
564
  if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
587
565
  for (; startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1;);
@@ -595,37 +573,37 @@ function init(runtimeId = "M") {
595
573
  singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
596
574
  }
597
575
  visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
598
- }, nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
599
- let i = 0;
600
- for (; i < resumes.length; i++) {
601
- let serialized = resumes[i];
602
- if (typeof serialized == "string") for (lastTokenIndex = 0, visitText = serialized; nextToken();) /\D/.test(lastToken) ? lastEffect = _resumed[lastToken] : effects.push(lastEffect, getScope(lastToken));
603
- else if (Array.isArray(serialized)) {
604
- if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
605
- } else if (readyIds && typeof serialized == "number") break;
606
- else {
607
- let scopes = serialized(serializeContext);
608
- Array.isArray(scopes) && applyScopes(scopes);
609
- }
576
+ }
577
+ }, nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
578
+ let i = 0;
579
+ for (; i < resumes.length; i++) {
580
+ let serialized = resumes[i];
581
+ if (typeof serialized == "string") for (lastTokenIndex = 0, visitText = serialized; nextToken();) /\D/.test(lastToken) ? lastEffect = _resumed[lastToken] : effects.push(lastEffect, getScope(lastToken));
582
+ else if (Array.isArray(serialized)) {
583
+ if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
584
+ } else if (readyIds && typeof serialized == "number") break;
585
+ else {
586
+ let scopes = serialized(serializeContext);
587
+ Array.isArray(scopes) && applyScopes(scopes);
610
588
  }
611
- return resumes.splice(0, i), i;
612
- }, lastEffect, visits, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, visitBranches, htmlStart, embedAnchor;
613
- return serializeContext._ = _resumed, render.m = (effects) => {
614
- if (processResumes(render.r, effects), readyIds && render.b) for (let progress = 1; progress;) {
615
- progress = 0;
616
- for (let readyId of readyIds) {
617
- let resumes = render.b[readyId];
618
- resumes && processResumes(resumes, effects) && (progress = 1);
619
- }
589
+ }
590
+ return resumes.splice(0, i), i;
591
+ }, lastEffect, visits, visit, visitText, visitType, visitScope, lastToken, lastTokenIndex, visitBranches, htmlStart, embedAnchor;
592
+ return serializeContext._ = _resumed, render.m = (effects) => {
593
+ if (processResumes(render.r, effects), readyIds && render.b) for (let progress = 1; progress;) {
594
+ progress = 0;
595
+ for (let readyId of readyIds) {
596
+ let resumes = render.b[readyId];
597
+ resumes && processResumes(resumes, effects) && (progress = 1);
620
598
  }
621
- let retained = 0;
622
- for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : (visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)), embedRenders && !embedAnchor && visit.parentNode && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
623
- return branchesEnabled && visitBranches && (visitType = "*", lastToken = "", visitBranches()), visits.length = retained, effects;
624
- }, render.w = (_) => {
625
- walk(), runResumeEffects(render);
626
- }, render;
627
- }) });
628
- };
599
+ }
600
+ let retained = 0;
601
+ for (visit of visits = render.v) lastTokenIndex = render.i.length, visitText = visit.data, visitType = visitText[lastTokenIndex++], visitScope = getScope(nextToken()), dynamicHtmlEnabled && visitType > "%" && visitType <= "'" ? visitType === "&" ? htmlStart = visit : (visitScope[nextToken()] = htmlStart, visitScope["H" + lastToken] = visit, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)) : branchesEnabled && visitType > "'" ? (visitBranches ||= createVisitBranches())() : lazyEnabled && render.b && visitType > "%" ? visits[retained++] = visit : (visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling, (branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope && pending.push(visitScope)), embedRenders && !embedAnchor && visit.parentNode && embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
602
+ return branchesEnabled && visitBranches && (visitType = "*", lastToken = "", visitBranches()), visits.length = retained, effects;
603
+ }, render.w = (_) => {
604
+ walk(), runResumeEffects(render);
605
+ }, render;
606
+ }) });
629
607
  if (renders) {
630
608
  initRuntime(renders);
631
609
  for (let renderId in renders) runResumeEffects(curRenders(renderId));
@@ -653,11 +631,10 @@ function _el(id, accessor) {
653
631
  function _dynamic_tag_var_resume(accessor) {
654
632
  accessor = decodeAccessor(accessor), _resumed["-" + accessor] = (scope) => (_) => {
655
633
  let node = scope[accessor];
656
- return node.nodeType === 8 ? node.previousSibling : node;
634
+ return node.nodeType > 1 ? node.previousSibling : node;
657
635
  };
658
636
  }
659
- //#endregion
660
- //#region src/dom/renderer.ts
637
+ // src/dom/renderer.ts
661
638
  function createBranch($global, renderer, parentScope, parentNode) {
662
639
  let branch = createScope($global);
663
640
  return branch._ = renderer.e || parentScope, setParentBranch(branch, parentScope?.F), renderer.b?.(branch, parentNode.namespaceURI), branch;
@@ -676,11 +653,7 @@ function _return_setup(setup) {
676
653
  }
677
654
  function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
678
655
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
679
- let clone = template ? (branch, ns) => {
680
- ((cloneCache[ns] ||= {})[1 + template] ||= createCloneableHTML(template, ns))(branch, walks);
681
- } : (branch) => {
682
- walk(branch.S = branch.K = new Text(), walks, branch);
683
- };
656
+ let cloneables = {}, clone = template ? (branch, ns) => (cloneables[ns] ||= createCloneableHTML(template, walks, ns))(branch) : (branch) => walk(branch.S = branch.K = new Text(), walks, branch);
684
657
  return _resumed[id] = (owner) => ({
685
658
  a: id,
686
659
  b: clone,
@@ -712,17 +685,14 @@ function _content_closures(renderer, closureFns) {
712
685
  }, instance;
713
686
  };
714
687
  }
715
- function createCloneableHTML(html, ns) {
688
+ function createCloneableHTML(html, walks, ns) {
716
689
  let { firstChild, lastChild } = parseHTML(html, ns), parent = new DocumentFragment();
717
- return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
718
- walk(branch.S = branch.K = firstChild.cloneNode(!0), walks, branch);
719
- } : (branch, walks) => {
690
+ return insertChildNodes(parent, null, firstChild, lastChild), firstChild === lastChild && firstChild.nodeType < 8 ? (branch) => walk(branch.S = branch.K = firstChild.cloneNode(!0), walks, branch) : (branch) => {
720
691
  let clone = parent.cloneNode(!0);
721
692
  clone.namespaceURI = ns, walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
722
693
  };
723
694
  }
724
- //#endregion
725
- //#region src/dom/dom.ts
695
+ // src/dom/dom.ts
726
696
  function _to_text(value) {
727
697
  return value || value === 0 ? value + "" : "";
728
698
  }
@@ -822,24 +792,20 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
822
792
  }
823
793
  }
824
794
  function _attr_content(scope, nodeAccessor, value) {
825
- let content = normalizeClientRender(value);
826
- scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setBranch(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor])), content?.g?.(scope["A" + nodeAccessor]);
795
+ let renderer = normalizeDynamicRenderer(value), content;
796
+ renderer && renderer.a && (content = renderer), scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setBranch(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor])), content?.g?.(scope["A" + nodeAccessor]);
827
797
  }
828
798
  function _attrs_script(scope, nodeAccessor) {
829
799
  let el = scope[nodeAccessor], events = scope["I" + nodeAccessor];
830
800
  controllableScripts[scope["F" + nodeAccessor]]?.(scope, nodeAccessor);
831
801
  for (let name in events) _on(el, name, events[name]);
832
802
  }
833
- function normalizeClientRender(value) {
834
- let renderer = normalizeDynamicRenderer(value);
835
- if (renderer && renderer.a) return renderer;
836
- }
837
803
  function normalizeAttrValue(value) {
838
804
  if (isNotNullishOrFalse(value)) return value === !0 ? "" : value + "";
839
805
  }
840
806
  function _lifecycle(scope, thisObj, index = 0) {
841
807
  let accessor = "K" + index, instance = scope[accessor];
842
- instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), trackAbort(scope, accessor, (_) => thisObj.onDestroy?.()));
808
+ instance ? (Object.assign(instance, thisObj), instance.onUpdate?.()) : (scope[accessor] = thisObj, Object.assign(thisObj, thisObj.onMount?.()), onAbort(scope, accessor, (_) => thisObj.onDestroy?.()));
843
809
  }
844
810
  function removeChildNodes(startNode, endNode) {
845
811
  for (endNode = endNode.nextSibling; startNode !== endNode;) {
@@ -853,8 +819,7 @@ function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
853
819
  parentNode.insertBefore(startNode, referenceNode), startNode = next;
854
820
  }
855
821
  }
856
- //#endregion
857
- //#region src/dom/resolve-cursor-position.ts
822
+ // src/dom/resolve-cursor-position.ts
858
823
  function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
859
824
  if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
860
825
  let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
@@ -866,8 +831,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
866
831
  }
867
832
  return -1;
868
833
  }
869
- //#endregion
870
- //#region src/dom/controllable.ts
834
+ // src/dom/controllable.ts
871
835
  function _attr_input_checked_default(scope, nodeAccessor, checked) {
872
836
  let el = scope[nodeAccessor], normalizedChecked = isNotNullishOrFalse(checked);
873
837
  if (el.defaultChecked !== normalizedChecked) {
@@ -1058,8 +1022,7 @@ function _controllable_select(scope, nodeAccessor, nextAttrs) {
1058
1022
  function _controllable_open(scope, nodeAccessor, nextAttrs) {
1059
1023
  if ("open" in nextAttrs || "openChange" in nextAttrs) return _attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), /^open(?:Change)?$/;
1060
1024
  }
1061
- //#endregion
1062
- //#region src/dom/control-flow.ts
1025
+ // src/dom/control-flow.ts
1063
1026
  function _await_promise(nodeAccessor, params) {
1064
1027
  nodeAccessor = decodeAccessor(nodeAccessor);
1065
1028
  let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor, tryAccessor = "Q" + nodeAccessor, resolveAwait = (scope, referenceNode, value) => {
@@ -1078,7 +1041,7 @@ function _await_promise(nodeAccessor, params) {
1078
1041
  }
1079
1042
  if (!isPromise(promise)) return scope[tryAccessor] ? awaitPromise(scope, Promise.resolve(promise)) : resolveAwait(scope, scope[nodeAccessor], promise);
1080
1043
  let awaitCounter = tryBranch.O;
1081
- scope[tryAccessor] || (scope[tryAccessor] = tryBranch, trackAbort(scope, promiseAccessor, (_) => {
1044
+ scope[tryAccessor] || (scope[tryAccessor] = tryBranch, onAbort(scope, promiseAccessor, (_) => {
1082
1045
  scope[promiseAccessor] = 0, scope[tryAccessor] && queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
1083
1046
  }), awaitBranch && (awaitBranch.W ||= []), tryBranch === awaitBranch ? (awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, (_) => {
1084
1047
  if (tryBranch === scope[branchAccessor]) {
@@ -1224,5 +1187,4 @@ function bySecondArg(_item, index) {
1224
1187
  function byFirstArg(name) {
1225
1188
  return name;
1226
1189
  }
1227
- //#endregion
1228
- export { _attr_style_items as $, _on as $t, _attr_input_value as A, _closure_get as At, _controllable_select as B, _let as Bt, _attr_details_or_dialog_open_script as C, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, readyFailed as Dt, _attr_input_checkedValue_default as E, ready as Et, _attr_select_value as F, _global_read as Ft, _attr_class as G, _script as Gt, controllableScripts as H, _or as Ht, _attr_select_value_default as I, _hoist as It, _attr_class_names as J, _assert_init as Jt, _attr_class_item as K, _var as Kt, _attr_select_value_script as L, _hoist_resume as Lt, _attr_input_value_default as M, _el_read as Mt, _attr_input_value_dynamic_default as N, _for_closure as Nt, _attr_input_checked_default as O, withLazy as Ot, _attr_input_value_script as P, _for_selector as Pt, _attr_style_item as Q, syncGen as Qt, _controllable_input as R, _id as Rt, _attr_details_or_dialog_open_default as S, _var_resume as St, _attr_input_checkedValue as T, initEmbedded as Tt, controllableSpreadHelpers as U, _return as Ut, _controllable_textarea as V, _let_change as Vt, _attr as W, _return_change as Wt, _attr_nonce as X, insertBranchBefore as Xt, _attr_content as Y, destroyBranch as Yt, _attr_style as Z, removeAndDestroyBranch as Zt, patchDynamicTag as _, _assert_class_toggles as _n, createBranch as _t, _for_in as a, prepareEffects as an, _html as at, startAwait as b, _call as bn, _el as bt, _for_to as c, queueRender as cn, _style_shell as ct, _for_until_unkeyed as d, runEffects as dn, _to_text as dt, $signal as en, _attrs as et, _if as f, runId as fn, _content as ft, installDynamicTagVar as g, forUntil as gn, createAndSetupBranch as gt, dynamicTagScript as h, forTo as hn, _return_setup as ht, _dynamic_tag_content as i, installCatch as in, _attrs_script as it, _attr_input_value_attribute_default as j, _const as jt, _attr_input_checked_script as k, _closure as kt, _for_to_unkeyed as l, rendering as ln, _text as lt, _try as m, forOf as mn, _content_resume as mt, _await_promise as n, createBranchRenders as nn, _attrs_partial as nt, _for_of as o, queueAsyncRender as on, _lifecycle as ot, _show as p, forIn as pn, _content_closures as pt, _attr_class_items as q, _var_change as qt, _dynamic_tag as r, installBranchRenders as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, queueEffect as sn, _style_rule_item as st, _await_content as t, $signalReset as tn, _attrs_content as tt, _for_until as u, run as un, _text_content as ut, renderCatch as v, _assert_hoist as vn, setupBranch as vt, _attr_input_checked as w, init as wt, _attr_details_or_dialog_open as x, withBranches as xn, _resumed as xt, runPendingEffects as y, _hoist_read_error as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, _if_closure as zt };
1190
+ export { _attr_style_items as $, _on as $t, _attr_input_value as A, _closure_get as At, _controllable_select as B, _let as Bt, _attr_details_or_dialog_open_script as C, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, readyFailed as Dt, _attr_input_checkedValue_default as E, ready as Et, _attr_select_value as F, _global_read as Ft, _attr_class as G, _script as Gt, controllableScripts as H, _or as Ht, _attr_select_value_default as I, _hoist as It, _attr_class_names as J, _assert_init as Jt, _attr_class_item as K, _var as Kt, _attr_select_value_script as L, _hoist_resume as Lt, _attr_input_value_default as M, _el_read as Mt, _attr_input_value_dynamic_default as N, _for_closure as Nt, _attr_input_checked_default as O, withLazy as Ot, _attr_input_value_script as P, _for_selector as Pt, _attr_style_item as Q, syncGen as Qt, _controllable_input as R, _id as Rt, _attr_details_or_dialog_open_default as S, withBranches as Sn, _var_resume as St, _attr_input_checkedValue as T, initEmbedded as Tt, controllableSpreadHelpers as U, _return as Ut, _controllable_textarea as V, _let_change as Vt, _attr as W, _return_change as Wt, _attr_nonce as X, insertBranchBefore as Xt, _attr_content as Y, destroyBranch as Yt, _attr_style as Z, removeAndDestroyBranch as Zt, patchDynamicTag as _, forUntil as _n, createBranch as _t, _for_in as a, installCatch as an, _html as at, startAwait as b, _hoist_read_error as bn, _el as bt, _for_to as c, queueEffect as cn, _style_shell as ct, _for_until_unkeyed as d, run as dn, _to_text as dt, $signal as en, _attrs as et, _if as f, runEffects as fn, _content as ft, installDynamicTagVar as g, forTo as gn, createAndSetupBranch as gt, dynamicTagScript as h, forOf as hn, _return_setup as ht, _dynamic_tag_content as i, installBranchRenders as in, _attrs_script as it, _attr_input_value_attribute_default as j, _const as jt, _attr_input_checked_script as k, _closure as kt, _for_to_unkeyed as l, queueRender as ln, _text as lt, _try as m, forIn as mn, _content_resume as mt, _await_promise as n, onAbort as nn, _attrs_partial as nt, _for_of as o, prepareEffects as on, _lifecycle as ot, _show as p, runId as pn, _content_closures as pt, _attr_class_items as q, _var_change as qt, _dynamic_tag as r, createBranchRenders as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, queueAsyncRender as sn, _style_rule_item as st, _await_content as t, $signalReset as tn, _attrs_content as tt, _for_until as u, rendering as un, _text_content as ut, renderCatch as v, _assert_class_toggles as vn, setupBranch as vt, _attr_input_checked as w, init as wt, _attr_details_or_dialog_open as x, _call as xn, _resumed as xt, runPendingEffects as y, _assert_hoist as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, _if_closure as zt };
package/dist/dom.d.ts CHANGED
@@ -2,7 +2,7 @@ export { attrTag, attrTags } from "./common/attr-tag";
2
2
  export { _assert_class_toggles, _assert_hoist, _hoist_read_error, } from "./common/errors";
3
3
  export { forIn, forOf, forTo, forUntil } from "./common/for";
4
4
  export { _call } from "./common/helpers";
5
- export { $signal, $signalReset } from "./dom/abort-signal";
5
+ export { $signal, $signalReset, onAbort } from "./dom/abort-signal";
6
6
  export { compat } from "./dom/compat";
7
7
  export { _await_content, _await_promise, _dynamic_tag, _dynamic_tag_content, _for_in, _for_of, _for_of_unkeyed, _for_to, _for_to_unkeyed, _for_until, _for_until_unkeyed, _if, _show, _try, } from "./dom/control-flow";
8
8
  export { _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checked_default, _attr_input_checked_script, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_input_value as _attr_textarea_value, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_script as _attr_textarea_value_script, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, } from "./dom/controllable";