marko 6.4.9 → 6.4.10

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 (60) hide show
  1. package/cheatsheet.md +1 -1
  2. package/dist/debug/dom/catch.feat.js +2 -3
  3. package/dist/debug/dom/catch.feat.mjs +2 -3
  4. package/dist/debug/dom/controllable-input.feat.js +2 -3
  5. package/dist/debug/dom/controllable-input.feat.mjs +2 -3
  6. package/dist/debug/dom/controllable-open.feat.js +2 -3
  7. package/dist/debug/dom/controllable-open.feat.mjs +2 -3
  8. package/dist/debug/dom/controllable-select.feat.js +2 -3
  9. package/dist/debug/dom/controllable-select.feat.mjs +2 -3
  10. package/dist/debug/dom/controllable-textarea.feat.js +2 -3
  11. package/dist/debug/dom/controllable-textarea.feat.mjs +2 -3
  12. package/dist/debug/dom/controllable.feat.js +2 -3
  13. package/dist/debug/dom/controllable.feat.mjs +2 -3
  14. package/dist/debug/dom/dynamic-tag-script.feat.js +2 -3
  15. package/dist/debug/dom/dynamic-tag-script.feat.mjs +2 -3
  16. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  17. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  18. package/dist/debug/dom/lazy.feat.js +2 -3
  19. package/dist/debug/dom/lazy.feat.mjs +2 -3
  20. package/dist/debug/dom/placeholder.feat.js +2 -3
  21. package/dist/debug/dom/placeholder.feat.mjs +2 -3
  22. package/dist/debug/{dom-VKjkbuuo.mjs → dom-C1V5vpFs.mjs} +24 -48
  23. package/dist/debug/{dom-QkYva5Qx.js → dom-DNB5yq3U.js} +24 -48
  24. package/dist/debug/dom.js +6 -11
  25. package/dist/debug/dom.mjs +6 -11
  26. package/dist/debug/html.js +19 -38
  27. package/dist/debug/html.mjs +19 -38
  28. package/dist/dom/catch.feat.js +2 -3
  29. package/dist/dom/catch.feat.mjs +2 -3
  30. package/dist/dom/controllable-input.feat.js +1 -2
  31. package/dist/dom/controllable-input.feat.mjs +1 -2
  32. package/dist/dom/controllable-open.feat.js +2 -3
  33. package/dist/dom/controllable-open.feat.mjs +2 -3
  34. package/dist/dom/controllable-select.feat.js +2 -3
  35. package/dist/dom/controllable-select.feat.mjs +2 -3
  36. package/dist/dom/controllable-textarea.feat.js +2 -3
  37. package/dist/dom/controllable-textarea.feat.mjs +2 -3
  38. package/dist/dom/controllable.feat.js +1 -2
  39. package/dist/dom/controllable.feat.mjs +1 -2
  40. package/dist/dom/dynamic-tag-script.feat.js +2 -3
  41. package/dist/dom/dynamic-tag-script.feat.mjs +2 -3
  42. package/dist/dom/dynamic-tag-var.feat.js +1 -2
  43. package/dist/dom/dynamic-tag-var.feat.mjs +1 -2
  44. package/dist/dom/lazy.feat.js +2 -3
  45. package/dist/dom/lazy.feat.mjs +2 -3
  46. package/dist/dom/placeholder.feat.js +2 -3
  47. package/dist/dom/placeholder.feat.mjs +2 -3
  48. package/dist/{dom-IujlfJ6b.js → dom-C2-Flitp.js} +40 -60
  49. package/dist/{dom-DtKQb840.mjs → dom-DsHYWMCR.mjs} +40 -61
  50. package/dist/dom.js +6 -10
  51. package/dist/dom.mjs +6 -11
  52. package/dist/html.js +39 -59
  53. package/dist/html.mjs +39 -60
  54. package/dist/translator/index.js +222 -355
  55. package/dist/translator/util/assert.d.ts +9 -2
  56. package/dist/translator/util/known-tag.d.ts +3 -0
  57. package/dist/translator/util/sources.d.ts +1 -1
  58. package/dist/translator/util/tag-name-type.d.ts +3 -0
  59. package/package.json +6 -6
  60. package/tags/lifecycle.d.marko +2 -0
@@ -17,7 +17,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
17
17
  }, runEffects = ((effects) => {
18
18
  for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
19
19
  }), runRender = (render) => {
20
- (!branchesEnabled || render.b.F?.H !== 0) && render.c(render.b, render.d);
20
+ branchesEnabled && render.b.F?.H === 0 || render.c(render.b, render.d);
21
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
22
  scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
23
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) {
@@ -118,16 +118,13 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
118
118
  if (hasSiblings && (oldLen ? (afterReference = oldScopes[oldEnd].K.nextSibling, newLen || parentNode.insertBefore(referenceNode, afterReference)) : newLen && (afterReference = referenceNode.nextSibling, referenceNode.remove())), !hasPotentialMoves) {
119
119
  oldLen && (oldScopes.forEach(hasSiblings ? removeAndDestroyBranch : destroyBranch), hasSiblings || (parentNode.textContent = ""));
120
120
  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;
121
+ } else {
122
+ if (oldScopesByKey) oldScopesByKey.forEach(removeAndDestroyBranch);
123
+ else for (let i = newLen; i < oldLen; i++) removeAndDestroyBranch(oldScopes[i]);
124
+ for (; oldEnd >= start && newEnd >= start && oldScopes[oldEnd] === newScopes[newEnd];) oldEnd--, newEnd--;
125
+ 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);
126
+ else reorder(newScopes, start, newEnd, parentNode, afterReference);
129
127
  }
130
- reorder(newScopes, start, newEnd, parentNode, afterReference);
131
128
  };
132
129
  }), _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
133
130
  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 +135,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
138
135
  }, reorderKeyed), _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
139
136
  by ||= byFirstArg, forUntil(until, from, step, (v) => cb(by(v), [v]));
140
137
  }, 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
138
+ // src/common/helpers.ts
142
139
  function _call(fn, v) {
143
140
  return fn(v), v;
144
141
  }
@@ -181,13 +178,11 @@ function withBranches(runtime) {
181
178
  function withDynamicHtml(runtime) {
182
179
  return dynamicHtmlEnabled = 1, runtime;
183
180
  }
184
- //#endregion
185
- //#region src/common/errors.ts
181
+ // src/common/errors.ts
186
182
  function _assert_class_toggles(classes, toggles) {}
187
183
  function _hoist_read_error() {}
188
184
  function _assert_hoist(value) {}
189
- //#endregion
190
- //#region src/common/for.ts
185
+ // src/common/for.ts
191
186
  function forIn(obj, cb) {
192
187
  for (let key in obj) cb(key, obj[key]);
193
188
  }
@@ -205,8 +200,7 @@ function forUntil(until, from, step, cb) {
205
200
  let start = from || 0, delta = step || 1;
206
201
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
207
202
  }
208
- //#endregion
209
- //#region src/dom/queue.ts
203
+ // src/dom/queue.ts
210
204
  function queueRender(scope, signal, signalKey, value, scopeKey = scope.L) {
211
205
  let render;
212
206
  if (signalKey >= 0 && (render = scope[signalKey])) {
@@ -289,8 +283,7 @@ function runRenders(renders = pendingRenders) {
289
283
  runRender(render);
290
284
  }
291
285
  }
292
- //#endregion
293
- //#region src/dom/abort-signal.ts
286
+ // src/dom/abort-signal.ts
294
287
  function $signalReset(scope, id) {
295
288
  let ctrl = scope.A?.[id];
296
289
  ctrl && (scope.A[id] = void 0, rendering ? queueEffect(ctrl, abort) : abort(ctrl));
@@ -310,8 +303,7 @@ function trackCleanup(scope, subscribers) {
310
303
  function abort(ctrl) {
311
304
  ctrl.abort();
312
305
  }
313
- //#endregion
314
- //#region src/common/opt.ts
306
+ // src/common/opt.ts
315
307
  function toArray(opt) {
316
308
  return opt ? Array.isArray(opt) ? opt : [opt] : [];
317
309
  }
@@ -324,8 +316,7 @@ function forEach(opt, cb) {
324
316
  function push(opt, item) {
325
317
  return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
326
318
  }
327
- //#endregion
328
- //#region src/dom/event.ts
319
+ // src/dom/event.ts
329
320
  function _on(element, type, handler) {
330
321
  delegate(type, handleDelegated), element[1 + type] = handler || null;
331
322
  }
@@ -333,14 +324,12 @@ function handleDelegated(ev) {
333
324
  let target = !rendering && ev.target;
334
325
  for (; target;) target[1 + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
335
326
  }
336
- //#endregion
337
- //#region src/dom/parse-html.ts
327
+ // src/dom/parse-html.ts
338
328
  function parseHTML(html, ns) {
339
329
  let parser = parsers[ns] ||= document.createElementNS(ns, "template");
340
330
  return parser.innerHTML = html, parser.content || parser;
341
331
  }
342
- //#endregion
343
- //#region src/dom/scope.ts
332
+ // src/dom/scope.ts
344
333
  function createScope($global, closestBranch) {
345
334
  let scope = {
346
335
  L: nextScopeId++,
@@ -390,8 +379,7 @@ function detachBranch(branch) {
390
379
  let fragment = new DocumentFragment();
391
380
  fragment.namespaceURI = branch.S.parentNode.namespaceURI, insertChildNodes(fragment, null, branch.S, branch.K);
392
381
  }
393
- //#endregion
394
- //#region src/dom/schedule.ts
382
+ // src/dom/schedule.ts
395
383
  function schedule() {
396
384
  isScheduled || (isScheduled = 1, queueMicrotask(flushAndWaitFrame));
397
385
  }
@@ -403,8 +391,7 @@ function triggerMacroTask() {
403
391
  isScheduled = 0, run();
404
392
  }), channel.port2.postMessage(0);
405
393
  }
406
- //#endregion
407
- //#region src/dom/signals.ts
394
+ // src/dom/signals.ts
408
395
  function _let(id, fn) {
409
396
  let valueAccessor = decodeAccessor(id);
410
397
  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,7 +402,7 @@ function _let_change(id, fn) {
415
402
  }
416
403
  function _const(valueAccessor, fn) {
417
404
  return valueAccessor = decodeAccessor(valueAccessor), ((scope, value) => {
418
- (scope[valueAccessor] !== value || !(valueAccessor in scope)) && (scope[valueAccessor] = value, fn?.(scope));
405
+ scope[valueAccessor] === value && valueAccessor in scope || (scope[valueAccessor] = value, fn?.(scope));
419
406
  });
420
407
  }
421
408
  function _or(id, fn, defaultPending = 1, scopeIdAccessor = "L") {
@@ -536,14 +523,12 @@ function _hoist(...path) {
536
523
  function _hoist_resume(id, ...path) {
537
524
  return _resumed[id] = _hoist(...path);
538
525
  }
539
- //#endregion
540
- //#region src/dom/walker.ts
526
+ // src/dom/walker.ts
541
527
  /** Cloned templates are small, where a TreeWalker's per-step cost dominates. */
542
528
  function walk(startNode, walkCodes, branch) {
543
529
  currentNode = startNode, walkInternal(0, walkCodes, branch);
544
530
  }
545
- //#endregion
546
- //#region src/dom/resume.ts
531
+ // src/dom/resume.ts
547
532
  function ready(readyId) {
548
533
  (readyIds ||= /* @__PURE__ */ new Set()).add(readyId);
549
534
  for (let renderId in curRenders) runResumeEffects(curRenders[renderId]);
@@ -580,21 +565,21 @@ function init(runtimeId = "M") {
580
565
  if (visitType === "*") {
581
566
  for (; reorderBranch && pending.length >= reorderDepth;) adopt(pending.pop(), reorderBranch);
582
567
  (reorderBranch = +lastToken && visitScope) && (reorderDepth = pending.push(reorderBranch));
583
- return;
584
- }
585
- for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
586
- if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
587
- for (; startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1;);
588
- branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
589
- } else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
590
- for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
591
- nextToken();
592
- }
593
- if (endedBranches) {
594
- for (let ended of endedBranches) pending.push(ended);
595
- singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
568
+ } else {
569
+ for (visitType !== "[" && (visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit, accessor = "A" + (nodeAccessor = lastToken), singleNode = visitType !== "]" && visitType !== ")", nextToken()); branchId = +lastToken;) {
570
+ if ((endedBranches ||= []).push(branch = getScope(branchId)), setParentBranch(branch, branch.F), (branch.O = render.p?.[branchId]) && (branch.O.m = render.m), singleNode) {
571
+ for (; startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1;);
572
+ branch._ ??= visitScope, branch.K = branch.S = startVisit, visitType === "(" && (branch.a = startVisit);
573
+ } else branch.C = nodeAccessor, curBranchScopes = push(curBranchScopes, branch), accessor && (visitScope[accessor] = curBranchScopes, forEach(curBranchScopes, (scope) => scope._ ??= visitScope), curBranchScopes = branchScopesStack.pop()), startVisit = branchStarts.pop(), parent !== startVisit.parentNode && parent.prepend(startVisit), branch.S = startVisit, branch.K = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
574
+ for (; pending.at(-1)?.L >= branchId;) adopt(pending.pop(), branch);
575
+ nextToken();
576
+ }
577
+ if (endedBranches) {
578
+ for (let ended of endedBranches) pending.push(ended);
579
+ singleNode && (visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0]);
580
+ }
581
+ visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
596
582
  }
597
- visitType === "[" ? (endedBranches || (branchScopesStack.push(curBranchScopes), curBranchScopes = void 0), branchStarts.push(visit)) : pending.push(visitScope);
598
583
  }, nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1), processResumes = (resumes = [], effects) => {
599
584
  let i = 0;
600
585
  for (; i < resumes.length; i++) {
@@ -656,8 +641,7 @@ function _dynamic_tag_var_resume(accessor) {
656
641
  return node.nodeType === 8 ? node.previousSibling : node;
657
642
  };
658
643
  }
659
- //#endregion
660
- //#region src/dom/renderer.ts
644
+ // src/dom/renderer.ts
661
645
  function createBranch($global, renderer, parentScope, parentNode) {
662
646
  let branch = createScope($global);
663
647
  return branch._ = renderer.e || parentScope, setParentBranch(branch, parentScope?.F), renderer.b?.(branch, parentNode.namespaceURI), branch;
@@ -721,8 +705,7 @@ function createCloneableHTML(html, ns) {
721
705
  clone.namespaceURI = ns, walk(clone.firstChild, walks, branch), branch.S = clone.firstChild, branch.K = clone.lastChild;
722
706
  };
723
707
  }
724
- //#endregion
725
- //#region src/dom/dom.ts
708
+ // src/dom/dom.ts
726
709
  function _to_text(value) {
727
710
  return value || value === 0 ? value + "" : "";
728
711
  }
@@ -853,8 +836,7 @@ function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
853
836
  parentNode.insertBefore(startNode, referenceNode), startNode = next;
854
837
  }
855
838
  }
856
- //#endregion
857
- //#region src/dom/resolve-cursor-position.ts
839
+ // src/dom/resolve-cursor-position.ts
858
840
  function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
859
841
  if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
860
842
  let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
@@ -866,8 +848,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
866
848
  }
867
849
  return -1;
868
850
  }
869
- //#endregion
870
- //#region src/dom/controllable.ts
851
+ // src/dom/controllable.ts
871
852
  function _attr_input_checked_default(scope, nodeAccessor, checked) {
872
853
  let el = scope[nodeAccessor], normalizedChecked = isNotNullishOrFalse(checked);
873
854
  if (el.defaultChecked !== normalizedChecked) {
@@ -1058,8 +1039,7 @@ function _controllable_select(scope, nodeAccessor, nextAttrs) {
1058
1039
  function _controllable_open(scope, nodeAccessor, nextAttrs) {
1059
1040
  if ("open" in nextAttrs || "openChange" in nextAttrs) return _attr_details_or_dialog_open(scope, nodeAccessor, nextAttrs.open, nextAttrs.openChange), /^open(?:Change)?$/;
1060
1041
  }
1061
- //#endregion
1062
- //#region src/dom/control-flow.ts
1042
+ // src/dom/control-flow.ts
1063
1043
  function _await_promise(nodeAccessor, params) {
1064
1044
  nodeAccessor = decodeAccessor(nodeAccessor);
1065
1045
  let promiseAccessor = "L" + nodeAccessor, branchAccessor = "A" + nodeAccessor, tryAccessor = "Q" + nodeAccessor, resolveAwait = (scope, referenceNode, value) => {
@@ -1224,5 +1204,4 @@ function bySecondArg(_item, index) {
1224
1204
  function byFirstArg(name) {
1225
1205
  return name;
1226
1206
  }
1227
- //#endregion
1228
1207
  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 };
package/dist/dom.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- let require_control_flow = require("./dom-IujlfJ6b.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
+ let require_control_flow = require("./dom-C2-Flitp.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
3
3
  require_control_flow.wt($global.runtimeId);
4
4
  let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
5
5
  return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
@@ -71,7 +71,7 @@ let require_control_flow = require("./dom-IujlfJ6b.js"), empty = [], rest = Symb
71
71
  return renderer.mount = mount, renderer._ = renderer, require_control_flow.xt[id] = renderer;
72
72
  }, noop = (_) => 0;
73
73
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
74
- //#region src/common/attr-tag.ts
74
+ // src/common/attr-tag.ts
75
75
  function attrTag(attrs) {
76
76
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
77
77
  }
@@ -81,12 +81,9 @@ function attrTags(first, attrs) {
81
81
  function* attrTagIterator() {
82
82
  yield this, yield* this[rest];
83
83
  }
84
- //#endregion
85
- //#region src/common/compat-meta.ts
86
- //#endregion
87
- //#region src/dom/compat.ts
88
- //#endregion
89
- //#region src/dom/template.ts
84
+ // src/common/compat-meta.ts
85
+ // src/dom/compat.ts
86
+ // src/dom/template.ts
90
87
  function mount(input = {}, reference, position) {
91
88
  let branch, parentNode = reference, nextSibling = null, { $global } = input;
92
89
  switch ($global ? ({$global, ...input} = input, $global = {
@@ -127,8 +124,7 @@ function mount(input = {}, reference, position) {
127
124
  }
128
125
  };
129
126
  }
130
- //#endregion
131
- //#region src/dom/load.ts
127
+ // src/dom/load.ts
132
128
  function _load_template(id, load) {
133
129
  let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
134
130
  let awaitCounter = require_control_flow.b(branch);
package/dist/dom.mjs CHANGED
@@ -69,8 +69,8 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
69
69
  let renderer = _content(id, template, walks, setup, inputSignal)();
70
70
  return renderer.mount = mount, renderer._ = renderer, _resumed[id] = renderer;
71
71
  }, noop = (_) => 0;
72
- import { $ as _attr_style_items, $t as _on, A as _attr_input_value, At as _closure_get, B as _controllable_select, Bt as _let, C as _attr_details_or_dialog_open_script, Ct as getRegisteredWithScope, D as _attr_input_checkedValue_script, Dt as readyFailed, E as _attr_input_checkedValue_default, Et as ready, F as _attr_select_value, Ft as _global_read, G as _attr_class, Gt as _script, Ht as _or, I as _attr_select_value_default, It as _hoist, J as _attr_class_names, Jt as _assert_init, K as _attr_class_item, Kt as _var, L as _attr_select_value_script, Lt as _hoist_resume, M as _attr_input_value_default, Mt as _el_read, N as _attr_input_value_dynamic_default, Nt as _for_closure, O as _attr_input_checked_default, P as _attr_input_value_script, Pt as _for_selector, Q as _attr_style_item, Qt as syncGen, R as _controllable_input, Rt as _id, S as _attr_details_or_dialog_open_default, St as _var_resume, T as _attr_input_checkedValue, Tt as initEmbedded, Ut as _return, V as _controllable_textarea, Vt as _let_change, W as _attr, Wt as _return_change, X as _attr_nonce, Xt as insertBranchBefore, Y as _attr_content, Yt as destroyBranch, Z as _attr_style, Zt as removeAndDestroyBranch, _ as patchDynamicTag, _n as _assert_class_toggles, _t as createBranch, a as _for_in, an as prepareEffects, at as _html, b as startAwait, bn as _call, bt as _el, c as _for_to, cn as queueRender, ct as _style_shell, d as _for_until_unkeyed, dn as runEffects, dt as _to_text, en as $signal, et as _attrs, f as _if, fn as runId, ft as _content, gn as forUntil, gt as createAndSetupBranch, hn as forTo, ht as _return_setup, i as _dynamic_tag_content, it as _attrs_script, j as _attr_input_value_attribute_default, jt as _const, k as _attr_input_checked_script, kt as _closure, l as _for_to_unkeyed, ln as rendering, lt as _text, m as _try, mn as forOf, mt as _content_resume, n as _await_promise, nt as _attrs_partial, o as _for_of, on as queueAsyncRender, ot as _lifecycle, p as _show, pn as forIn, pt as _content_closures, q as _attr_class_items, qt as _var_change, r as _dynamic_tag, rt as _attrs_partial_content, s as _for_of_unkeyed, sn as queueEffect, st as _style_rule_item, t as _await_content, tn as $signalReset, tt as _attrs_content, u as _for_until, un as run, ut as _text_content, v as renderCatch, vn as _assert_hoist, vt as setupBranch, w as _attr_input_checked, wt as init, x as _attr_details_or_dialog_open, xt as _resumed, yn as _hoist_read_error, yt as _dynamic_tag_var_resume, z as _controllable_open, zt as _if_closure } from "./dom-DtKQb840.mjs";
73
- //#region src/common/attr-tag.ts
72
+ import { $ as _attr_style_items, $t as _on, A as _attr_input_value, At as _closure_get, B as _controllable_select, Bt as _let, C as _attr_details_or_dialog_open_script, Ct as getRegisteredWithScope, D as _attr_input_checkedValue_script, Dt as readyFailed, E as _attr_input_checkedValue_default, Et as ready, F as _attr_select_value, Ft as _global_read, G as _attr_class, Gt as _script, Ht as _or, I as _attr_select_value_default, It as _hoist, J as _attr_class_names, Jt as _assert_init, K as _attr_class_item, Kt as _var, L as _attr_select_value_script, Lt as _hoist_resume, M as _attr_input_value_default, Mt as _el_read, N as _attr_input_value_dynamic_default, Nt as _for_closure, O as _attr_input_checked_default, P as _attr_input_value_script, Pt as _for_selector, Q as _attr_style_item, Qt as syncGen, R as _controllable_input, Rt as _id, S as _attr_details_or_dialog_open_default, St as _var_resume, T as _attr_input_checkedValue, Tt as initEmbedded, Ut as _return, V as _controllable_textarea, Vt as _let_change, W as _attr, Wt as _return_change, X as _attr_nonce, Xt as insertBranchBefore, Y as _attr_content, Yt as destroyBranch, Z as _attr_style, Zt as removeAndDestroyBranch, _ as patchDynamicTag, _n as _assert_class_toggles, _t as createBranch, a as _for_in, an as prepareEffects, at as _html, b as startAwait, bn as _call, bt as _el, c as _for_to, cn as queueRender, ct as _style_shell, d as _for_until_unkeyed, dn as runEffects, dt as _to_text, en as $signal, et as _attrs, f as _if, fn as runId, ft as _content, gn as forUntil, gt as createAndSetupBranch, hn as forTo, ht as _return_setup, i as _dynamic_tag_content, it as _attrs_script, j as _attr_input_value_attribute_default, jt as _const, k as _attr_input_checked_script, kt as _closure, l as _for_to_unkeyed, ln as rendering, lt as _text, m as _try, mn as forOf, mt as _content_resume, n as _await_promise, nt as _attrs_partial, o as _for_of, on as queueAsyncRender, ot as _lifecycle, p as _show, pn as forIn, pt as _content_closures, q as _attr_class_items, qt as _var_change, r as _dynamic_tag, rt as _attrs_partial_content, s as _for_of_unkeyed, sn as queueEffect, st as _style_rule_item, t as _await_content, tn as $signalReset, tt as _attrs_content, u as _for_until, un as run, ut as _text_content, v as renderCatch, vn as _assert_hoist, vt as setupBranch, w as _attr_input_checked, wt as init, x as _attr_details_or_dialog_open, xt as _resumed, yn as _hoist_read_error, yt as _dynamic_tag_var_resume, z as _controllable_open, zt as _if_closure } from "./dom-DsHYWMCR.mjs";
73
+ // src/common/attr-tag.ts
74
74
  function attrTag(attrs) {
75
75
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
76
76
  }
@@ -80,12 +80,9 @@ function attrTags(first, attrs) {
80
80
  function* attrTagIterator() {
81
81
  yield this, yield* this[rest];
82
82
  }
83
- //#endregion
84
- //#region src/common/compat-meta.ts
85
- //#endregion
86
- //#region src/dom/compat.ts
87
- //#endregion
88
- //#region src/dom/template.ts
83
+ // src/common/compat-meta.ts
84
+ // src/dom/compat.ts
85
+ // src/dom/template.ts
89
86
  function mount(input = {}, reference, position) {
90
87
  let branch, parentNode = reference, nextSibling = null, { $global } = input;
91
88
  switch ($global ? ({$global, ...input} = input, $global = {
@@ -126,8 +123,7 @@ function mount(input = {}, reference, position) {
126
123
  }
127
124
  };
128
125
  }
129
- //#endregion
130
- //#region src/dom/load.ts
126
+ // src/dom/load.ts
131
127
  function _load_template(id, load) {
132
128
  let pending, lazyTemplate = _template(id, 0, 0, (branch) => {
133
129
  let awaitCounter = startAwait(branch);
@@ -197,5 +193,4 @@ function _load_race_trigger(...triggers) {
197
193
  function getSelectorOrResolve(selector, resolve) {
198
194
  return document.querySelector(selector) || resolve();
199
195
  }
200
- //#endregion
201
196
  export { $signal, $signalReset, _assert_class_toggles, _assert_hoist, _assert_init, _attr, _attr_class, _attr_class_item, _attr_class_items, _attr_class_names, _attr_content, _attr_details_or_dialog_open as _attr_details_open, _attr_details_or_dialog_open as _attr_dialog_open, _attr_details_or_dialog_open_default as _attr_details_open_default, _attr_details_or_dialog_open_default as _attr_dialog_open_default, _attr_details_or_dialog_open_script as _attr_details_open_script, _attr_details_or_dialog_open_script as _attr_dialog_open_script, _attr_input_checked, _attr_input_checkedValue, _attr_input_checkedValue_default, _attr_input_checkedValue_script, _attr_input_checked_default, _attr_input_checked_script, _attr_input_value, _attr_input_value as _attr_textarea_value, _attr_input_value_attribute_default, _attr_input_value_default, _attr_input_value_default as _attr_textarea_value_default, _attr_input_value_dynamic_default, _attr_input_value_script, _attr_input_value_script as _attr_textarea_value_script, _attr_nonce, _attr_select_value, _attr_select_value_default, _attr_select_value_script, _attr_style, _attr_style_item, _attr_style_items, _attrs, _attrs_content, _attrs_partial, _attrs_partial_content, _attrs_script, _await_content, _await_promise, _call, _closure, _closure_get, _const, _content, _content_closures, _content_resume, _controllable_input, _controllable_open, _controllable_select, _controllable_textarea, _dynamic_tag, _dynamic_tag_content, _dynamic_tag_var_resume, _el, _el_read, _for_closure, _for_in, _for_of, _for_of_unkeyed, _for_selector, _for_to, _for_to_unkeyed, _for_until, _for_until_unkeyed, _global_read, _hoist, _hoist_read_error, _hoist_resume, _html, _id, _if, _if_closure, _let, _let_change, _lifecycle, _load_event_trigger, _load_idle_trigger, _load_media_trigger, _load_race_trigger, _load_setup, _load_signal, _load_template, _load_visible_trigger, _on, _or, _resumed, _return, _return_change, _return_setup, _script, _show, _style_rule_item, _style_shell, _template, _text, _text_content, _to_text, _try, _var, _var_change, _var_resume, attrTag, attrTags, compat, forIn, forOf, forTo, forUntil, init, initEmbedded, ready, readyFailed, run };
package/dist/html.js CHANGED
@@ -427,7 +427,7 @@ let empty = [], rest = Symbol(), unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeSty
427
427
  }
428
428
  }, pendingClassFunctions = /* @__PURE__ */ new WeakMap();
429
429
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
430
- //#region src/common/attr-tag.ts
430
+ // src/common/attr-tag.ts
431
431
  function attrTag(attrs) {
432
432
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;
433
433
  }
@@ -437,8 +437,7 @@ function attrTags(first, attrs) {
437
437
  function* attrTagIterator() {
438
438
  yield this, yield* this[rest];
439
439
  }
440
- //#endregion
441
- //#region src/common/helpers.ts
440
+ // src/common/helpers.ts
442
441
  function stringifyClassEntry(name, value) {
443
442
  return value ? name : "";
444
443
  }
@@ -479,15 +478,13 @@ function normalizeDynamicRenderer(value) {
479
478
  if ("a" in normalized) return normalized;
480
479
  }
481
480
  }
482
- //#endregion
483
- //#region src/common/errors.ts
481
+ // src/common/errors.ts
484
482
  function _assert_class_toggles(classes, toggles) {}
485
483
  function _el_read_error() {}
486
484
  function _hoist_read_error() {}
487
485
  function _signal_read_error() {}
488
486
  function _assert_hoist(value) {}
489
- //#endregion
490
- //#region src/common/opt.ts
487
+ // src/common/opt.ts
491
488
  function reduce(opt, cb, acc) {
492
489
  if (opt) {
493
490
  if (Array.isArray(opt)) for (let item of opt) acc = cb(acc, item);
@@ -1280,8 +1277,7 @@ function patchIteratorNext(proto) {
1280
1277
  return this[kTouchedIterator] = 1, next.call(this, value);
1281
1278
  }, proto.next[kTouchedIterator] = !0;
1282
1279
  }
1283
- //#endregion
1284
- //#region src/html/attrs.ts
1280
+ // src/html/attrs.ts
1285
1281
  function _attr_class(value) {
1286
1282
  return stringAttr("class", toDelimitedString(value, " ", stringifyClassEntry));
1287
1283
  }
@@ -1437,10 +1433,8 @@ function normalizedValueMatches(a, b) {
1437
1433
  function normalizeStrAttrValue(value) {
1438
1434
  return isNotNullishOrFalse(value) && value !== !0 ? value + "" : "";
1439
1435
  }
1440
- //#endregion
1441
- //#region src/html/inlined-runtimes.ts
1442
- //#endregion
1443
- //#region src/html/writer.ts
1436
+ // src/html/inlined-runtimes.ts
1437
+ // src/html/writer.ts
1444
1438
  function getChunk() {
1445
1439
  return $chunk;
1446
1440
  }
@@ -2080,8 +2074,7 @@ function flushTickQueue() {
2080
2074
  });
2081
2075
  }
2082
2076
  }
2083
- //#endregion
2084
- //#region src/html/content.ts
2077
+ // src/html/content.ts
2085
2078
  function _to_text(val) {
2086
2079
  return val || val === 0 ? val + "" : "";
2087
2080
  }
@@ -2106,16 +2099,14 @@ function escapeCommentStr(str) {
2106
2099
  function _escape_comment(val) {
2107
2100
  return val ? escapeCommentStr(val + "") : val === 0 ? "0" : "";
2108
2101
  }
2109
- //#endregion
2110
- //#region src/html/dynamic-tag.ts
2102
+ // src/html/dynamic-tag.ts
2111
2103
  function _content(id, fn, scopeId) {
2112
2104
  return fn.a = id, fn.e = scopeId, fn;
2113
2105
  }
2114
2106
  function _content_resume(id, fn, scopeId, locals) {
2115
2107
  return _resume(_content(id, fn, scopeId), id, scopeId, locals);
2116
2108
  }
2117
- //#endregion
2118
- //#region src/html/template.ts
2109
+ // src/html/template.ts
2119
2110
  function render(input = {}) {
2120
2111
  return startRender(this, input, State);
2121
2112
  }
@@ -2261,30 +2252,29 @@ var ServerRendered = class {
2261
2252
  return;
2262
2253
  }
2263
2254
  let { boundary } = head, onNext = boundary.onNext = (write) => {
2264
- if (flushing) {
2265
- again = !0;
2266
- return;
2267
- }
2268
- flushing = !0;
2269
- do {
2270
- again = !1;
2271
- let status = boundary.flush();
2272
- if (status === 2) {
2273
- tick || offTick(onNext), settle(boundary), onAbort(boundary.reason);
2274
- return;
2275
- }
2276
- if (write || status === 0) {
2277
- if (head = head.consume(boundary), boundary.aborted) continue;
2278
- let html = head.flushHTML(boundary);
2279
- if (boundary.aborted) continue;
2280
- if (html && onWrite(html), !boundary.count) {
2281
- tick || offTick(onNext), settle(boundary), onClose();
2255
+ if (flushing) again = !0;
2256
+ else {
2257
+ flushing = !0;
2258
+ do {
2259
+ again = !1;
2260
+ let status = boundary.flush();
2261
+ if (status === 2) {
2262
+ tick || offTick(onNext), settle(boundary), onAbort(boundary.reason);
2282
2263
  return;
2283
2264
  }
2284
- write && (tick = !0);
2285
- } else tick && (tick = !1, queueTick(onNext));
2286
- } while (again);
2287
- flushing = !1;
2265
+ if (write || status === 0) {
2266
+ if (head = head.consume(boundary), boundary.aborted) continue;
2267
+ let html = head.flushHTML(boundary);
2268
+ if (boundary.aborted) continue;
2269
+ if (html && onWrite(html), !boundary.count) {
2270
+ tick || offTick(onNext), settle(boundary), onClose();
2271
+ return;
2272
+ }
2273
+ write && (tick = !0);
2274
+ } else tick && (tick = !1, queueTick(onNext));
2275
+ } while (again);
2276
+ flushing = !1;
2277
+ }
2288
2278
  };
2289
2279
  return onNext(), boundary;
2290
2280
  }
@@ -2300,8 +2290,7 @@ function settle(boundary) {
2300
2290
  boundary.onNext = NOOP$1, boundary.state.$global.signal?.removeEventListener("abort", boundary);
2301
2291
  }
2302
2292
  function NOOP$1() {}
2303
- //#endregion
2304
- //#region src/html/assets.ts
2293
+ // src/html/assets.ts
2305
2294
  function withLoadAssets(template, id, flush, assetId, triggers) {
2306
2295
  let renderer = (input) => (writeLoadAsset(assetId, flush, triggers), writeWaitReady(assetId, template(), input));
2307
2296
  return _template(id, renderer), renderer;
@@ -2382,10 +2371,8 @@ function toObjectExpression(options) {
2382
2371
  for (let key in options) Object.hasOwn(options, key) && (result += sep + toObjectKey(key) + ":" + JSON.stringify(options[key]), sep = ",");
2383
2372
  return result + "}";
2384
2373
  }
2385
- //#endregion
2386
- //#region src/common/compat-meta.ts
2387
- //#endregion
2388
- //#region src/common/for.ts
2374
+ // src/common/compat-meta.ts
2375
+ // src/common/for.ts
2389
2376
  function forIn(obj, cb) {
2390
2377
  for (let key in obj) cb(key, obj[key]);
2391
2378
  }
@@ -2403,8 +2390,7 @@ function forUntil(until, from, step, cb) {
2403
2390
  let start = from || 0, delta = step || 1;
2404
2391
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
2405
2392
  }
2406
- //#endregion
2407
- //#region src/html/for.ts
2393
+ // src/html/for.ts
2408
2394
  function forOfBy(by, item, index) {
2409
2395
  return by ? typeof by == "string" ? item[by] : by(item, index) : index;
2410
2396
  }
@@ -2414,8 +2400,7 @@ function forInBy(by, name, value) {
2414
2400
  function forStepBy(by, index) {
2415
2401
  return by ? by(index) : index;
2416
2402
  }
2417
- //#endregion
2418
- //#region src/html/control-flow.ts
2403
+ // src/html/control-flow.ts
2419
2404
  function _show_start(display, markerGuard, branchExprGuard, parentEndTag) {
2420
2405
  display ? resumesMarker(markerGuard, branchExprGuard, parentEndTag) && $chunk.writeHTML($chunk.boundary.state.mark("[", "")) : $chunk.writeHTML("<t hidden>");
2421
2406
  }
@@ -2527,17 +2512,13 @@ function _try(scopeId, accessor, content, placeholderContent, catchContent, plac
2527
2512
  }
2528
2513
  function tryPlaceholder(content, placeholder, branchId, scopeId, placeholderBranchId) {
2529
2514
  let chunk = $chunk, { boundary } = chunk, body = chunk.fork(boundary, null);
2530
- if (body === body.render(content)) {
2531
- chunk.append(body);
2532
- return;
2533
- }
2534
- chunk.next = chunk.forkRest(boundary), captureContext(chunk), chunk.placeholder = {
2515
+ body === body.render(content) ? chunk.append(body) : (chunk.next = chunk.forkRest(boundary), captureContext(chunk), chunk.placeholder = {
2535
2516
  body,
2536
2517
  render: placeholder,
2537
2518
  branchId,
2538
2519
  scopeId,
2539
2520
  placeholderBranchId
2540
- };
2521
+ });
2541
2522
  }
2542
2523
  function tryBoundary(content, catchContent, branchId, renderers) {
2543
2524
  let chunk = $chunk, { boundary } = chunk, { state } = boundary, bodyBoundary = new Boundary(state, void 0, boundary);
@@ -2590,8 +2571,7 @@ function writeTryRenderers(branchId, catchContent, placeholderContent) {
2590
2571
  Q: placeholderContent
2591
2572
  });
2592
2573
  }
2593
- //#endregion
2594
- //#region src/html/compat.ts
2574
+ // src/html/compat.ts
2595
2575
  function drainClassFunctions($global, writeScope) {
2596
2576
  let pending = pendingClassFunctions.get($global), scopeByHost = {};
2597
2577
  for (let [id, fn, hostId] of pending) register(id, fn, scopeByHost[hostId] ||= writeScope(hostId));