marko 6.3.33 → 6.3.35

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 (69) hide show
  1. package/cheatsheet.md +37 -33
  2. package/dist/common/constants/accessor-prefix.d.ts +1 -0
  3. package/dist/common/constants/accessor-prefix.debug.d.ts +1 -0
  4. package/dist/common/errors.d.ts +2 -0
  5. package/dist/common/types.d.ts +10 -0
  6. package/dist/debug/dom/catch.feat.js +1 -1
  7. package/dist/debug/dom/catch.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-input.feat.js +1 -1
  9. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-open.feat.js +1 -1
  11. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-select.feat.js +1 -1
  13. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  15. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  16. package/dist/debug/dom/controllable.feat.js +1 -1
  17. package/dist/debug/dom/controllable.feat.mjs +1 -1
  18. package/dist/debug/{dom-BJ93mcSe.mjs → dom-B57LrRnX.mjs} +89 -46
  19. package/dist/debug/{dom-CiFITSPN.js → dom-Bt4OoZ-j.js} +89 -46
  20. package/dist/debug/dom.js +3 -1
  21. package/dist/debug/dom.mjs +3 -1
  22. package/dist/debug/html.js +205 -98
  23. package/dist/debug/html.mjs +205 -98
  24. package/dist/dom/catch.feat.js +1 -1
  25. package/dist/dom/catch.feat.mjs +1 -1
  26. package/dist/dom/control-flow.d.ts +4 -1
  27. package/dist/dom/controllable-input.feat.js +1 -1
  28. package/dist/dom/controllable-input.feat.mjs +1 -1
  29. package/dist/dom/controllable-open.feat.js +1 -1
  30. package/dist/dom/controllable-open.feat.mjs +1 -1
  31. package/dist/dom/controllable-select.feat.js +1 -1
  32. package/dist/dom/controllable-select.feat.mjs +1 -1
  33. package/dist/dom/controllable-textarea.feat.js +1 -1
  34. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  35. package/dist/dom/controllable.feat.js +1 -1
  36. package/dist/dom/controllable.feat.mjs +1 -1
  37. package/dist/dom/signals.d.ts +3 -3
  38. package/dist/{dom-Cj4HQ7T_.mjs → dom-BP2XSglG.mjs} +46 -33
  39. package/dist/{dom-CI-06TZb.js → dom-BeF9xIzO.js} +46 -33
  40. package/dist/dom.js +3 -1
  41. package/dist/dom.mjs +3 -1
  42. package/dist/html/compat.d.ts +4 -2
  43. package/dist/html/dynamic-tag.d.ts +1 -1
  44. package/dist/html/serializer.d.ts +9 -1
  45. package/dist/html/template.d.ts +1 -0
  46. package/dist/html/writer.d.ts +1 -0
  47. package/dist/html.js +88 -63
  48. package/dist/html.mjs +88 -63
  49. package/dist/translator/core/client.d.ts +1 -2
  50. package/dist/translator/core/server.d.ts +1 -2
  51. package/dist/translator/core/static.d.ts +1 -2
  52. package/dist/translator/index.js +514 -314
  53. package/dist/translator/util/constants/binding-type.d.ts +1 -0
  54. package/dist/translator/util/references.d.ts +8 -1
  55. package/dist/translator/util/serialize-reasons.d.ts +4 -4
  56. package/dist/translator/util/signals.d.ts +5 -0
  57. package/dist/translator/util/statement-tag.d.ts +2 -0
  58. package/dist/translator/util/translate-var.d.ts +1 -1
  59. package/dist/translator/visitors/export-declaration.d.ts +8 -0
  60. package/dist/translator/visitors/program/index.d.ts +0 -1
  61. package/package.json +5 -4
  62. package/tags/html-comment.d.marko +2 -0
  63. package/tags/html-script.d.marko +2 -0
  64. package/tags/html-style.d.marko +2 -0
  65. package/tags/let.d.marko +4 -5
  66. package/tags/show.d.marko +6 -0
  67. package/tags/try.d.marko +1 -1
  68. package/tags-html.d.ts +6 -1
  69. /package/dist/translator/util/{get-accessor-char.d.ts → get-accessor-enums.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js"), handlePendingTry = (fn, scope, branch) => {
1
+ let require_control_flow = require("../dom-BeF9xIzO.js"), handlePendingTry = (fn, scope, branch) => {
2
2
  for (; branch;) {
3
3
  if (branch.O?.i) return (branch.J ||= []).push(fn, scope);
4
4
  branch = branch.N;
@@ -4,7 +4,7 @@ let handlePendingTry = (fn, scope, branch) => {
4
4
  branch = branch.N;
5
5
  }
6
6
  };
7
- import { Jt as caughtError, Xt as placeholderShown, Yt as installCatch, h as renderCatch } from "../dom-Cj4HQ7T_.mjs";
7
+ import { Jt as caughtError, Xt as placeholderShown, Yt as installCatch, h as renderCatch } from "../dom-BP2XSglG.mjs";
8
8
  //#region src/dom/catch.feat.ts
9
9
  installCatch((runEffects) => (effects, checkPending = placeholderShown.has(effects)) => {
10
10
  if (checkPending || caughtError.has(effects)) {
@@ -11,12 +11,15 @@ export declare function _try(nodeAccessor: EncodedAccessor, template?: string |
11
11
  export declare function renderCatch(scope: Scope, error: unknown): void;
12
12
  export declare const _if: (nodeAccessor: EncodedAccessor, ...branchesArgs: (string | SetupFn | 0)[]) => (scope: Scope, newBranch: number) => void;
13
13
  export declare const _show: (nodeAccessor: EncodedAccessor, startNodeAccessor?: EncodedAccessor, endNodeAccessor?: EncodedAccessor) => (scope: Scope, display: unknown) => void;
14
+ export declare function rendererKey(renderer: Renderer | string | undefined): string | Renderer | undefined;
14
15
  export declare function patchDynamicTag(fn: <T extends typeof _dynamic_tag>(cond: T) => T): void;
15
16
  export declare let _dynamic_tag: (nodeAccessor: EncodedAccessor, getContent?: ((scope: Scope) => Renderer) | 0, getTagVar?: (() => Signal<unknown>) | 0, inputIsArgs?: 1) => Signal<Renderer | string | undefined>;
16
17
  export declare const _dynamic_tag_content: (nodeAccessor: EncodedAccessor) => Signal<Renderer | undefined>;
17
- export declare function _resume_dynamic_tag(): void;
18
+ export declare const _resume_dynamic_tag: () => typeof dynamicTagScript;
19
+ declare function dynamicTagScript(branch: Scope): void;
18
20
  export declare function setConditionalRenderer<T>(scope: Scope, nodeAccessor: Accessor, newRenderer: T, createBranch: ($global: Scope[typeof AccessorProp.Global], renderer: NonNullable<T>, parentScope: Scope, parentNode: ParentNode) => BranchScope): void;
19
21
  export declare const _for_of: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [all: unknown[], by?: ((item: unknown, index: number) => unknown) | undefined]) => void;
20
22
  export declare const _for_in: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [obj: {}, by?: ((key: string, v: unknown) => unknown) | undefined]) => void;
21
23
  export declare const _for_to: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [to: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
22
24
  export declare const _for_until: (nodeAccessor: EncodedAccessor, template?: string | 0, walks?: string | 0, setup?: SetupFn | 0, params?: Signal<unknown>) => (scope: Scope, value: [until: number, from: number, step: number, by?: ((v: number) => unknown) | undefined]) => void;
25
+ export {};
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  require_control_flow.R[0] = require_control_flow.w, require_control_flow.R[1] = require_control_flow.S, require_control_flow.R[2] = require_control_flow.k;
3
3
  //#endregion
@@ -1,3 +1,3 @@
1
- import { R as controllableScripts, S as _attr_input_checkedValue_script, k as _attr_input_value_script, w as _attr_input_checked_script } from "../dom-Cj4HQ7T_.mjs";
1
+ import { R as controllableScripts, S as _attr_input_checkedValue_script, k as _attr_input_value_script, w as _attr_input_checked_script } from "../dom-BP2XSglG.mjs";
2
2
  controllableScripts[0] = _attr_input_checked_script, controllableScripts[1] = _attr_input_checkedValue_script, controllableScripts[2] = _attr_input_value_script;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  require_control_flow.R[4] = require_control_flow.v;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { R as controllableScripts, v as _attr_details_or_dialog_open_script } from "../dom-Cj4HQ7T_.mjs";
1
+ import { R as controllableScripts, v as _attr_details_or_dialog_open_script } from "../dom-BP2XSglG.mjs";
2
2
  //#region src/dom/controllable-open.feat.ts
3
3
  controllableScripts[4] = _attr_details_or_dialog_open_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  require_control_flow.R[3] = require_control_flow.M;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { M as _attr_select_value_script, R as controllableScripts } from "../dom-Cj4HQ7T_.mjs";
1
+ import { M as _attr_select_value_script, R as controllableScripts } from "../dom-BP2XSglG.mjs";
2
2
  //#region src/dom/controllable-select.feat.ts
3
3
  controllableScripts[3] = _attr_select_value_script;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  require_control_flow.R[2] = require_control_flow.k;
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { R as controllableScripts, k as _attr_input_value_script } from "../dom-Cj4HQ7T_.mjs";
1
+ import { R as controllableScripts, k as _attr_input_value_script } from "../dom-BP2XSglG.mjs";
2
2
  //#region src/dom/controllable-textarea.feat.ts
3
3
  controllableScripts[2] = _attr_input_value_script;
4
4
  //#endregion
@@ -1,3 +1,3 @@
1
- let require_control_flow = require("../dom-CI-06TZb.js");
1
+ let require_control_flow = require("../dom-BeF9xIzO.js");
2
2
  require("./controllable-input.feat.js"), require("./controllable-open.feat.js"), require("./controllable-select.feat.js"), require_control_flow.L.INPUT = require_control_flow.N, require_control_flow.L.TEXTAREA = require_control_flow.I, require_control_flow.L.SELECT = require_control_flow.F, require_control_flow.L.DETAILS = require_control_flow.L.DIALOG = require_control_flow.P;
3
3
  //#endregion
@@ -1,4 +1,4 @@
1
- import { F as _controllable_select, I as _controllable_textarea, L as controllableRenders, N as _controllable_input, P as _controllable_open } from "../dom-Cj4HQ7T_.mjs";
1
+ import { F as _controllable_select, I as _controllable_textarea, L as controllableRenders, N as _controllable_input, P as _controllable_open } from "../dom-BP2XSglG.mjs";
2
2
  import "./controllable-input.feat.mjs";
3
3
  import "./controllable-open.feat.mjs";
4
4
  import "./controllable-select.feat.mjs";
@@ -1,4 +1,4 @@
1
- import { type Accessor, AccessorProp, type EncodedAccessor, type Scope } from "../common/types";
1
+ import { type Accessor, type EncodedAccessor, type Scope } from "../common/types";
2
2
  export type SignalFn = (scope: Scope) => void;
3
3
  export type Signal<T = unknown, U extends Scope = Scope> = (scope: U, value: T) => void;
4
4
  export declare function _let<T>(id: EncodedAccessor, fn?: SignalFn): (scope: Scope, value: T) => T;
@@ -24,10 +24,10 @@ export declare function _var(scope: Scope, childAccessor: EncodedAccessor, signa
24
24
  export declare const _return: (scope: Scope, value: unknown) => any;
25
25
  export declare function _return_change(scope: Scope, changeHandler?: ((value: unknown) => void) | null | false): void;
26
26
  export declare const _var_change: (scope: Scope, value: unknown, name?: string) => void;
27
- export declare function _id({ [AccessorProp.Global]: $global }: Scope): string;
27
+ export declare function _id(scope: Scope, accessor?: Accessor): string;
28
28
  export declare function _script(id: string, fn: (scope: Scope) => void): (scope: Scope) => void;
29
29
  export declare function _el_read<T>(value: T): T;
30
- type Hoistable<T> = () => T;
30
+ type Hoistable<T> = (...args: unknown[]) => T;
31
31
  type Hoisted<T> = Hoistable<T> & Iterable<T>;
32
32
  export declare function _hoist<T>(...path: Accessor[]): (scope: Scope) => Hoisted<T>;
33
33
  export declare function _hoist_resume<T>(id: string, ...path: Accessor[]): (scope: Scope) => Hoisted<T>;
@@ -8,7 +8,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
8
8
  for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
9
9
  }), runRender = (render) => {
10
10
  (!branchesEnabled || render.b.F?.H !== 0) && render.c(render.b, render.d);
11
- }, catchEnabled, delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
11
+ }, catchEnabled, delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
12
12
  scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
13
13
  }, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), currentNode, walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
14
14
  let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
@@ -26,7 +26,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
26
26
  if (currentNode.firstChild) return currentNode = currentNode.firstChild;
27
27
  for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
28
28
  walkNextSibling();
29
- }, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, registeredValues = {}, curRenders, embedRenders, readyIds, isResuming, cloneCache = {}, R = /[^\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
29
+ }, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, registeredValues = {}, curRenders, embedRenders, readyIds, isResuming, cloneCache = {}, R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
30
30
  nodeAccessor = decodeAccessor(nodeAccessor);
31
31
  let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
32
32
  for (; i < branchesArgs.length;) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
@@ -52,7 +52,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
52
52
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
53
53
  return (scope, newRenderer, getInput) => {
54
54
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
55
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.a || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value)), typeof normalizedRenderer == "string") {
55
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor] ? scope[childScopeAccessor].T = (value) => getTagVar()(scope, value) : getTagVar()(scope, void 0)), typeof normalizedRenderer == "string") {
56
56
  if (getContent) {
57
57
  let content = getContent(scope);
58
58
  setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
@@ -78,9 +78,9 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
78
78
  nodeAccessor = decodeAccessor(nodeAccessor);
79
79
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
80
80
  return (scope, renderer) => {
81
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.a || renderer) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
81
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
82
82
  };
83
- }), loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
83
+ }), _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume("d", dynamicTagScript)), loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
84
84
  nodeAccessor = decodeAccessor(nodeAccessor);
85
85
  let scopesAccessor = "A" + nodeAccessor, keyedScopesAccessor = "O" + nodeAccessor, renderer = _content("", template, walks, setup)();
86
86
  return (scope, value) => {
@@ -114,9 +114,15 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
114
114
  for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
115
115
  for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
116
116
  };
117
- }), _for_of = /*@__PURE__*/ loop(([all, by = bySecondArg], cb) => {
118
- typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
119
- }), _for_in = /*@__PURE__*/ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /*@__PURE__*/ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /*@__PURE__*/ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v])));
117
+ }), _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
118
+ by ||= bySecondArg, typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
119
+ }), _for_in = /*@__PURE__*/ loop(([obj, by], cb) => {
120
+ by ||= byFirstArg, forIn(obj, (key, value) => cb(by(key, value), [key, value]));
121
+ }), _for_to = /*@__PURE__*/ loop(([to, from, step, by], cb) => {
122
+ by ||= byFirstArg, forTo(to, from, step, (v) => cb(by(v), [v]));
123
+ }), _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
124
+ by ||= byFirstArg, forUntil(until, from, step, (v) => cb(by(v), [v]));
125
+ });
120
126
  //#region src/common/helpers.ts
121
127
  function _call(fn, v) {
122
128
  return fn(v), v;
@@ -277,11 +283,11 @@ function push(opt, item) {
277
283
  //#endregion
278
284
  //#region src/dom/event.ts
279
285
  function _on(element, type, handler) {
280
- element["$" + type] === void 0 && delegate(type, handleDelegated), element["$" + type] = handler || null;
286
+ element[1 + type] === void 0 && delegate(type, handleDelegated), element[1 + type] = handler || null;
281
287
  }
282
288
  function handleDelegated(ev) {
283
289
  let target = !rendering && ev.target;
284
- for (; target;) target["$" + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
290
+ for (; target;) target[1 + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
285
291
  }
286
292
  //#endregion
287
293
  //#region src/dom/parse-html.ts
@@ -454,11 +460,15 @@ function _var(scope, childAccessor, signal) {
454
460
  scope[decodeAccessor(childAccessor)].T = (value) => signal(scope, value);
455
461
  }
456
462
  function _return_change(scope, changeHandler) {
457
- changeHandler && (scope.U = changeHandler);
463
+ scope.U = changeHandler || void 0;
458
464
  }
459
- function _id({ $: $global }) {
460
- let id = tagIdsByGlobal.get($global) || 0;
461
- return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
465
+ function _id(scope, accessor) {
466
+ let id = accessor !== void 0 && scope[accessor];
467
+ if (!id) {
468
+ let $global = scope.$, n = tagIdsByGlobal.get($global) || 0;
469
+ tagIdsByGlobal.set($global, n + 1), id = "c" + $global.runtimeId + $global.renderId + n.toString(36), accessor !== void 0 && (scope[accessor] = id);
470
+ }
471
+ return id;
462
472
  }
463
473
  function _script(id, fn) {
464
474
  return _resume(id, fn), (scope) => {
@@ -468,17 +478,17 @@ function _script(id, fn) {
468
478
  function _el_read(value) {
469
479
  return value;
470
480
  }
471
- function* traverse(scope, path, i = path.length - 1) {
472
- if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, i);
481
+ function* traverse(scope, path, args, i = path.length - 1) {
482
+ if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, args, i);
473
483
  else {
474
484
  let item = scope[path[i]];
475
- i ? yield* traverse(item, path, i - 1) : yield typeof item == "function" ? item() : item;
485
+ i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
476
486
  }
477
487
  }
478
488
  function _hoist(...path) {
479
489
  return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
480
- let fn = () => traverse(scope, path).next().value;
481
- return fn[Symbol.iterator] = () => traverse(scope, path), fn;
490
+ let fn = (...args) => traverse(scope, path, args).next().value;
491
+ return fn[Symbol.iterator] = () => traverse(scope, path, []), fn;
482
492
  };
483
493
  }
484
494
  function _hoist_resume(id, ...path) {
@@ -619,7 +629,7 @@ function setupBranch(renderer, branch) {
619
629
  function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
620
630
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
621
631
  let clone = template ? (branch, ns) => {
622
- ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(template, ns))(branch, walks);
632
+ ((cloneCache[ns] ||= {})[1 + template] ||= createCloneableHTML(template, ns))(branch, walks);
623
633
  } : (branch) => {
624
634
  walk(branch.S = branch.K = new Text(), walks, branch);
625
635
  };
@@ -718,7 +728,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
718
728
  let el = scope[nodeAccessor], partial = {};
719
729
  for (let i = el.attributes.length; i--;) {
720
730
  let { name } = el.attributes.item(i);
721
- !skip[name] && !(nextAttrs && name in nextAttrs) && el.removeAttribute(name);
731
+ !skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs))) && el.removeAttribute(name);
722
732
  }
723
733
  for (let name in nextAttrs) {
724
734
  let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
@@ -750,7 +760,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
750
760
  }
751
761
  function _attr_content(scope, nodeAccessor, value) {
752
762
  let content = normalizeClientRender(value);
753
- scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = content?.a) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
763
+ scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
754
764
  for (let accessor in content?.g) content.g[accessor](scope["A" + nodeAccessor], content.h[accessor]);
755
765
  }
756
766
  function _attrs_script(scope, nodeAccessor) {
@@ -801,9 +811,9 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
801
811
  let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
802
812
  if (updatedValue.startsWith(before)) return initialPosition;
803
813
  if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
804
- let count = before.replace(R, "").length, pos = 0;
805
- for (; count && updatedValue[pos];) updatedValue[pos++].replace(R, "") && count--;
806
- return pos;
814
+ let count = before.match(R)?.length;
815
+ for (; count && R.test(updatedValue);) count--;
816
+ return count ? updatedValue.length : R.lastIndex;
807
817
  }
808
818
  return -1;
809
819
  }
@@ -868,7 +878,7 @@ function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
868
878
  }
869
879
  function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
870
880
  let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
871
- scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, normalizedValue);
881
+ scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, value);
872
882
  }
873
883
  function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
874
884
  _attr(scope[nodeAccessor], "value", value);
@@ -1027,9 +1037,9 @@ function _await_promise(nodeAccessor, params) {
1027
1037
  detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
1028
1038
  }
1029
1039
  } else dismissPlaceholder(tryBranch);
1030
- })), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
1040
+ })), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : scheduleAwaitFrame(awaitCounter, scope, () => {
1031
1041
  awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
1032
- }, -1)))));
1042
+ }));
1033
1043
  let thisPromise = scope[promiseAccessor] = promise.then((data) => {
1034
1044
  if (thisPromise === scope[promiseAccessor]) {
1035
1045
  let referenceNode = scope[nodeAccessor];
@@ -1072,9 +1082,12 @@ function _await_content(nodeAccessor, template, walks, setup) {
1072
1082
  function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
1073
1083
  if (!tryBranch) return;
1074
1084
  let awaitCounter = tryBranch.O;
1075
- return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
1085
+ return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), scheduleAwaitFrame(awaitCounter, tryBranch, () => {
1076
1086
  insertBranchBefore(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q, tryBranch._, tryBranch.S.parentNode), tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
1077
- }, -1)))), awaitCounter;
1087
+ }), awaitCounter;
1088
+ }
1089
+ function scheduleAwaitFrame(awaitCounter, scope, render) {
1090
+ awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
1078
1091
  }
1079
1092
  function createAwaitCounter(tryBranch, done) {
1080
1093
  let awaitCounter = tryBranch.O = {
@@ -1110,12 +1123,12 @@ function renderCatch(scope, error) {
1110
1123
  placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(owner, tryWithCatch.C, tryWithCatch.E, createAndSetupBranch), tryWithCatch.E?.d?.(owner["A" + tryWithCatch.C], [error]);
1111
1124
  } else throw error;
1112
1125
  }
1126
+ function rendererKey(renderer) {
1127
+ return renderer?.e ? renderer.a + " " + renderer.e.L : renderer?.a || renderer;
1128
+ }
1113
1129
  function patchDynamicTag(fn) {
1114
1130
  _dynamic_tag = fn(_dynamic_tag);
1115
1131
  }
1116
- function _resume_dynamic_tag() {
1117
- _resume("d", dynamicTagScript);
1118
- }
1119
1132
  function dynamicTagScript(branch) {
1120
1133
  _attrs_script(branch, "a");
1121
1134
  }
@@ -8,7 +8,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
8
8
  for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
9
9
  }), runRender = (render) => {
10
10
  (!branchesEnabled || render.b.F?.H !== 0) && render.c(render.b, render.d);
11
- }, catchEnabled, delegate = (type, handler) => handler[type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
11
+ }, catchEnabled, delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, !0), 1), parsers = {}, nextScopeId = 1e6, collectingScopes, destroyNestedScopes = function destroyNestedScopes(scope) {
12
12
  scope.H = 0, scope.D?.forEach(destroyNestedScopes), scope.B?.forEach(cleanupScope);
13
13
  }, isScheduled, channel, _return = (scope, value) => scope.T?.(value), _var_change = (scope, value) => scope.U?.(value), tagIdsByGlobal = /* @__PURE__ */ new WeakMap(), currentNode, walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
14
14
  let value, currentMultiplier, storedMultiplier = 0, currentScopeIndex = 0;
@@ -26,7 +26,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
26
26
  if (currentNode.firstChild) return currentNode = currentNode.firstChild;
27
27
  for (; !currentNode.nextSibling && currentNode.parentNode;) currentNode = currentNode.parentNode;
28
28
  walkNextSibling();
29
- }, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, registeredValues = {}, curRenders, embedRenders, readyIds, isResuming, cloneCache = {}, R = /[^\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
29
+ }, walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode, registeredValues = {}, curRenders, embedRenders, readyIds, isResuming, cloneCache = {}, R = /[\p{L}\p{N}]/gu, inputType = "", controllableScripts = {}, controllableRenders = {}, _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
30
30
  nodeAccessor = decodeAccessor(nodeAccessor);
31
31
  let branchAccessor = "D" + nodeAccessor, branches = [], i = 0;
32
32
  for (; i < branchesArgs.length;) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
@@ -52,7 +52,7 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
52
52
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
53
53
  return (scope, newRenderer, getInput) => {
54
54
  let normalizedRenderer = normalizeDynamicRenderer(newRenderer);
55
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = normalizedRenderer?.a || normalizedRenderer) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor].T = (value) => getTagVar()(scope, value)), typeof normalizedRenderer == "string") {
55
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) if (setConditionalRenderer(scope, nodeAccessor, normalizedRenderer || (getContent ? getContent(scope) : void 0), createBranchWithTagNameOrRenderer), getTagVar && (scope[childScopeAccessor] ? scope[childScopeAccessor].T = (value) => getTagVar()(scope, value) : getTagVar()(scope, void 0)), typeof normalizedRenderer == "string") {
56
56
  if (getContent) {
57
57
  let content = getContent(scope);
58
58
  setConditionalRenderer(scope[childScopeAccessor], "a", content, createAndSetupBranch), content.f && subscribeToScopeSet(content.e, content.f, scope[childScopeAccessor].Aa);
@@ -78,9 +78,9 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
78
78
  nodeAccessor = decodeAccessor(nodeAccessor);
79
79
  let childScopeAccessor = "A" + nodeAccessor, rendererAccessor = "D" + nodeAccessor;
80
80
  return (scope, renderer) => {
81
- if (scope[rendererAccessor] !== (scope[rendererAccessor] = renderer?.a || renderer) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
81
+ if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer)) && (setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch), renderer?.f && subscribeToScopeSet(renderer.e, renderer.f, scope[childScopeAccessor])), renderer) for (let accessor in renderer.g) renderer.g[accessor](scope[childScopeAccessor], renderer.h[accessor]);
82
82
  };
83
- }), loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
83
+ }), _resume_dynamic_tag = /*@__PURE__*/ withBranches(() => _resume("d", dynamicTagScript)), loop = /*@__PURE__*/ withBranches((forEach) => (nodeAccessor, template, walks, setup, params) => {
84
84
  nodeAccessor = decodeAccessor(nodeAccessor);
85
85
  let scopesAccessor = "A" + nodeAccessor, keyedScopesAccessor = "O" + nodeAccessor, renderer = _content("", template, walks, setup)();
86
86
  return (scope, value) => {
@@ -114,9 +114,15 @@ let unsafeStyleAttrReg = /[\\;]/g, replaceUnsafeStyleAttr = (c) => c === ";" ? "
114
114
  for (hi = tails[tail], lo = tail + 1; lo-- > 0;) tails[lo] = hi, hi = pred[hi];
115
115
  for (let i = diffLen; i--;) ~tail && i === tails[tail] ? tail-- : insertBranchBefore(newScopes[start + i], parentNode, afterReference), afterReference = newScopes[start + i].S;
116
116
  };
117
- }), _for_of = /*@__PURE__*/ loop(([all, by = bySecondArg], cb) => {
118
- typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
119
- }), _for_in = /*@__PURE__*/ loop(([obj, by = byFirstArg], cb) => forIn(obj, (key, value) => cb(by(key, value), [key, value]))), _for_to = /*@__PURE__*/ loop(([to, from, step, by = byFirstArg], cb) => forTo(to, from, step, (v) => cb(by(v), [v]))), _for_until = /*@__PURE__*/ loop(([until, from, step, by = byFirstArg], cb) => forUntil(until, from, step, (v) => cb(by(v), [v])));
117
+ }), _for_of = /*@__PURE__*/ loop(([all, by], cb) => {
118
+ by ||= bySecondArg, typeof by == "string" ? forOf(all, (item, i) => cb(item[by], [item, i])) : forOf(all, (item, i) => cb(by(item, i), [item, i]));
119
+ }), _for_in = /*@__PURE__*/ loop(([obj, by], cb) => {
120
+ by ||= byFirstArg, forIn(obj, (key, value) => cb(by(key, value), [key, value]));
121
+ }), _for_to = /*@__PURE__*/ loop(([to, from, step, by], cb) => {
122
+ by ||= byFirstArg, forTo(to, from, step, (v) => cb(by(v), [v]));
123
+ }), _for_until = /*@__PURE__*/ loop(([until, from, step, by], cb) => {
124
+ by ||= byFirstArg, forUntil(until, from, step, (v) => cb(by(v), [v]));
125
+ });
120
126
  //#region src/common/helpers.ts
121
127
  function _call(fn, v) {
122
128
  return fn(v), v;
@@ -277,11 +283,11 @@ function push(opt, item) {
277
283
  //#endregion
278
284
  //#region src/dom/event.ts
279
285
  function _on(element, type, handler) {
280
- element["$" + type] === void 0 && delegate(type, handleDelegated), element["$" + type] = handler || null;
286
+ element[1 + type] === void 0 && delegate(type, handleDelegated), element[1 + type] = handler || null;
281
287
  }
282
288
  function handleDelegated(ev) {
283
289
  let target = !rendering && ev.target;
284
- for (; target;) target["$" + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
290
+ for (; target;) target[1 + ev.type]?.(ev, target), target = ev.bubbles && !ev.cancelBubble && target.parentNode;
285
291
  }
286
292
  //#endregion
287
293
  //#region src/dom/parse-html.ts
@@ -454,11 +460,15 @@ function _var(scope, childAccessor, signal) {
454
460
  scope[decodeAccessor(childAccessor)].T = (value) => signal(scope, value);
455
461
  }
456
462
  function _return_change(scope, changeHandler) {
457
- changeHandler && (scope.U = changeHandler);
463
+ scope.U = changeHandler || void 0;
458
464
  }
459
- function _id({ $: $global }) {
460
- let id = tagIdsByGlobal.get($global) || 0;
461
- return tagIdsByGlobal.set($global, id + 1), "c" + $global.runtimeId + $global.renderId + id.toString(36);
465
+ function _id(scope, accessor) {
466
+ let id = accessor !== void 0 && scope[accessor];
467
+ if (!id) {
468
+ let $global = scope.$, n = tagIdsByGlobal.get($global) || 0;
469
+ tagIdsByGlobal.set($global, n + 1), id = "c" + $global.runtimeId + $global.renderId + n.toString(36), accessor !== void 0 && (scope[accessor] = id);
470
+ }
471
+ return id;
462
472
  }
463
473
  function _script(id, fn) {
464
474
  return _resume(id, fn), (scope) => {
@@ -468,17 +478,17 @@ function _script(id, fn) {
468
478
  function _el_read(value) {
469
479
  return value;
470
480
  }
471
- function* traverse(scope, path, i = path.length - 1) {
472
- if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, i);
481
+ function* traverse(scope, path, args, i = path.length - 1) {
482
+ if (scope) if (Symbol.iterator in scope) for (let childScope of scope.values()) yield* traverse(childScope, path, args, i);
473
483
  else {
474
484
  let item = scope[path[i]];
475
- i ? yield* traverse(item, path, i - 1) : yield typeof item == "function" ? item() : item;
485
+ i ? yield* traverse(item, path, args, i - 1) : yield typeof item == "function" ? item(...args) : item;
476
486
  }
477
487
  }
478
488
  function _hoist(...path) {
479
489
  return path = path.map((p) => typeof p == "string" ? p : decodeAccessor(p)), (scope) => {
480
- let fn = () => traverse(scope, path).next().value;
481
- return fn[Symbol.iterator] = () => traverse(scope, path), fn;
490
+ let fn = (...args) => traverse(scope, path, args).next().value;
491
+ return fn[Symbol.iterator] = () => traverse(scope, path, []), fn;
482
492
  };
483
493
  }
484
494
  function _hoist_resume(id, ...path) {
@@ -619,7 +629,7 @@ function setupBranch(renderer, branch) {
619
629
  function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
620
630
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "", setup = setup ? setup._ || setup : void 0, params ||= void 0;
621
631
  let clone = template ? (branch, ns) => {
622
- ((cloneCache[ns] ||= {})[template] ||= createCloneableHTML(template, ns))(branch, walks);
632
+ ((cloneCache[ns] ||= {})[1 + template] ||= createCloneableHTML(template, ns))(branch, walks);
623
633
  } : (branch) => {
624
634
  walk(branch.S = branch.K = new Text(), walks, branch);
625
635
  };
@@ -718,7 +728,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
718
728
  let el = scope[nodeAccessor], partial = {};
719
729
  for (let i = el.attributes.length; i--;) {
720
730
  let { name } = el.attributes.item(i);
721
- !skip[name] && !(nextAttrs && name in nextAttrs) && el.removeAttribute(name);
731
+ !skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs))) && el.removeAttribute(name);
722
732
  }
723
733
  for (let name in nextAttrs) {
724
734
  let key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
@@ -750,7 +760,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
750
760
  }
751
761
  function _attr_content(scope, nodeAccessor, value) {
752
762
  let content = normalizeClientRender(value);
753
- scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = content?.a) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
763
+ scope["D" + nodeAccessor] !== (scope["D" + nodeAccessor] = rendererKey(content)) && (setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch), content?.f && subscribeToScopeSet(content.e, content.f, scope["A" + nodeAccessor]));
754
764
  for (let accessor in content?.g) content.g[accessor](scope["A" + nodeAccessor], content.h[accessor]);
755
765
  }
756
766
  function _attrs_script(scope, nodeAccessor) {
@@ -801,9 +811,9 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
801
811
  let before = initialValue.slice(0, initialPosition), after = initialValue.slice(initialPosition);
802
812
  if (updatedValue.startsWith(before)) return initialPosition;
803
813
  if (updatedValue.endsWith(after)) return updatedValue.length - after.length;
804
- let count = before.replace(R, "").length, pos = 0;
805
- for (; count && updatedValue[pos];) updatedValue[pos++].replace(R, "") && count--;
806
- return pos;
814
+ let count = before.match(R)?.length;
815
+ for (; count && R.test(updatedValue);) count--;
816
+ return count ? updatedValue.length : R.lastIndex;
807
817
  }
808
818
  return -1;
809
819
  }
@@ -868,7 +878,7 @@ function _attr_input_value_dynamic_default(scope, nodeAccessor, value) {
868
878
  }
869
879
  function _attr_input_value(scope, nodeAccessor, value, valueChange, setDefault = _attr_input_value_default) {
870
880
  let el = scope[nodeAccessor], normalizedValue = normalizeAttrValue(value) || "";
871
- scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, normalizedValue);
881
+ scope["E" + nodeAccessor] = valueChange, scope["G" + nodeAccessor] = normalizedValue, scope["F" + nodeAccessor] = valueChange ? 2 : 5, valueChange && scope.H < runId ? setInputValue(el, normalizedValue) : setDefault(scope, nodeAccessor, value);
872
882
  }
873
883
  function _attr_input_value_attribute_default(scope, nodeAccessor, value) {
874
884
  _attr(scope[nodeAccessor], "value", value);
@@ -1027,9 +1037,9 @@ function _await_promise(nodeAccessor, params) {
1027
1037
  detachedParent === anchor.parentNode ? anchor.remove() : anchor.replaceWith(detachedParent);
1028
1038
  }
1029
1039
  } else dismissPlaceholder(tryBranch);
1030
- })), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, () => {
1040
+ })), scope[promiseAccessor] || (awaitBranch && (awaitBranch.W ||= []), tryPlaceholder ? awaitCounter = addAwaitCounter(scope, tryPlaceholder) : scheduleAwaitFrame(awaitCounter, scope, () => {
1031
1041
  awaitBranch.V || (awaitBranch.S.parentNode.insertBefore(scope[nodeAccessor], awaitBranch.S), tempDetachBranch(tryBranch));
1032
- }, -1)))));
1042
+ }));
1033
1043
  let thisPromise = scope[promiseAccessor] = promise.then((data) => {
1034
1044
  if (thisPromise === scope[promiseAccessor]) {
1035
1045
  let referenceNode = scope[nodeAccessor];
@@ -1072,9 +1082,12 @@ function _await_content(nodeAccessor, template, walks, setup) {
1072
1082
  function addAwaitCounter(scope, tryBranch = findBranchWithKey(scope, "Q")) {
1073
1083
  if (!tryBranch) return;
1074
1084
  let awaitCounter = tryBranch.O;
1075
- return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(tryBranch, () => {
1085
+ return awaitCounter?.i || (awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch))), placeholderShown.add(pendingEffects), scheduleAwaitFrame(awaitCounter, tryBranch, () => {
1076
1086
  insertBranchBefore(tryBranch.P = createAndSetupBranch(tryBranch.$, tryBranch.Q, tryBranch._, tryBranch.S.parentNode), tryBranch.S.parentNode, tryBranch.S), tempDetachBranch(tryBranch);
1077
- }, -1)))), awaitCounter;
1087
+ }), awaitCounter;
1088
+ }
1089
+ function scheduleAwaitFrame(awaitCounter, scope, render) {
1090
+ awaitCounter.i++ || requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
1078
1091
  }
1079
1092
  function createAwaitCounter(tryBranch, done) {
1080
1093
  let awaitCounter = tryBranch.O = {
@@ -1110,12 +1123,12 @@ function renderCatch(scope, error) {
1110
1123
  placeholderBranch && (tryWithCatch.O && (tryWithCatch.O.i = 0), owner["A" + tryWithCatch.C] = placeholderBranch, destroyBranch(tryWithCatch)), caughtError.add(pendingEffects), setConditionalRenderer(owner, tryWithCatch.C, tryWithCatch.E, createAndSetupBranch), tryWithCatch.E?.d?.(owner["A" + tryWithCatch.C], [error]);
1111
1124
  } else throw error;
1112
1125
  }
1126
+ function rendererKey(renderer) {
1127
+ return renderer?.e ? renderer.a + " " + renderer.e.L : renderer?.a || renderer;
1128
+ }
1113
1129
  function patchDynamicTag(fn) {
1114
1130
  _dynamic_tag = fn(_dynamic_tag);
1115
1131
  }
1116
- function _resume_dynamic_tag() {
1117
- _resume("d", dynamicTagScript);
1118
- }
1119
1132
  function dynamicTagScript(branch) {
1120
1133
  _attrs_script(branch, "a");
1121
1134
  }
package/dist/dom.js CHANGED
@@ -1,4 +1,5 @@
1
- let require_control_flow = require("./dom-CI-06TZb.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
1
+ let require_control_flow = require("./dom-BeF9xIzO.js"), empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
+ require_control_flow.vt($global.runtimeId);
2
3
  let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
3
4
  return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
4
5
  }, compat = {
@@ -50,6 +51,7 @@ let require_control_flow = require("./dom-CI-06TZb.js"), empty = [], rest = Symb
50
51
  }, renderer;
51
52
  },
52
53
  render(out, component, renderer, args) {
54
+ require_control_flow.vt(out.global.runtimeId);
53
55
  let branch = component.scope, created = 0;
54
56
  if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), args[0] && typeof args[0] == "object" && "renderBody" in args[0]) {
55
57
  let input = args[0], normalizedInput = args[0] = {};
package/dist/dom.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), classEventResolver, scopesByRender = /* @__PURE__ */ new WeakMap(), getRenderScopes = ($global) => {
2
+ init($global.runtimeId);
2
3
  let render = self[$global.runtimeId]?.[$global.renderId], scopes = render && scopesByRender.get(render);
3
4
  return render && !scopes && scopesByRender.set(render, scopes = {}), scopes;
4
5
  }, compat = {
@@ -50,6 +51,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
50
51
  }, renderer;
51
52
  },
52
53
  render(out, component, renderer, args) {
54
+ init(out.global.runtimeId);
53
55
  let branch = component.scope, created = 0;
54
56
  if (!branch && (branch = classIdToBranch.get(component.id)) && (component.scope = branch, classIdToBranch.delete(component.id)), args[0] && typeof args[0] == "object" && "renderBody" in args[0]) {
55
57
  let input = args[0], normalizedInput = args[0] = {};
@@ -63,7 +65,7 @@ let empty = [], rest = Symbol(), classIdToBranch = /* @__PURE__ */ new Map(), cl
63
65
  let renderer = _content(id, template, walks, setup, inputSignal)();
64
66
  return renderer.mount = mount, renderer._ = renderer, _resume(id, renderer);
65
67
  };
66
- import { $ as _html, $t as queueEffect, A as _attr_select_value, At as _id, B as _attr_class, Bt as _assert_init, C as _attr_input_checked_default, Ct as _closure_get, D as _attr_input_value_default, Dt as _for_selector, E as _attr_input_value_attribute_default, Et as _for_closure, F as _controllable_select, Ft as _return, G as _attr_style, Gt as _on, H as _attr_class_items, Ht as insertBranchBefore, I as _controllable_textarea, It as _return_change, J as _attrs, K as _attr_style_item, Kt as $signal, Lt as _script, M as _attr_select_value_script, Mt as _let, N as _controllable_input, Nt as _let_change, O as _attr_input_value_dynamic_default, Ot as _hoist, P as _controllable_open, Pt as _or, Q as _attrs_script, Qt as queueAsyncRender, Rt as _var, S as _attr_input_checkedValue_script, St as _closure, T as _attr_input_value, Tt as _el_read, U as _attr_content, Ut as removeAndDestroyBranch, V as _attr_class_item, Vt as destroyBranch, W as _attr_nonce, Wt as syncGen, X as _attrs_partial, Y as _attrs_content, Z as _attrs_partial_content, Zt as prepareEffects, _ as _attr_details_or_dialog_open_default, _t as getRegisteredWithScope, a as _for_in, an as forTo, at as _to_text, b as _attr_input_checkedValue, bt as ready, c as _for_until, cn as _call, ct as _content, d as _show, dt as createAndSetupBranch, en as run, et as _lifecycle, f as _try, ft as createBranch, g as _attr_details_or_dialog_open, gt as _var_resume, h as renderCatch, ht as _resume, i as _dynamic_tag_content, in as forOf, it as _text_content, j as _attr_select_value_default, jt as _if_closure, k as _attr_input_value_script, kt as _hoist_resume, l as _if, ln as decodeAccessor, lt as _content_closures, m as patchDynamicTag, mt as _el, n as _await_promise, nn as runId, nt as _style_shell, o as _for_of, on as forUntil, ot as insertChildNodes, p as addAwaitCounter, pt as setupBranch, q as _attr_style_items, qt as $signalReset, r as _dynamic_tag, rn as forIn, rt as _text, s as _for_to, sn as _assert_hoist, st as toInsertNode, t as _await_content, tn as runEffects, tt as _style_rule_item, u as _resume_dynamic_tag, ut as _content_resume, v as _attr_details_or_dialog_open_script, vt as init, w as _attr_input_checked_script, wt as _const, x as _attr_input_checkedValue_default, xt as _child_setup, y as _attr_input_checked, yt as initEmbedded, z as _attr, zt as _var_change } from "./dom-Cj4HQ7T_.mjs";
68
+ import { $ as _html, $t as queueEffect, A as _attr_select_value, At as _id, B as _attr_class, Bt as _assert_init, C as _attr_input_checked_default, Ct as _closure_get, D as _attr_input_value_default, Dt as _for_selector, E as _attr_input_value_attribute_default, Et as _for_closure, F as _controllable_select, Ft as _return, G as _attr_style, Gt as _on, H as _attr_class_items, Ht as insertBranchBefore, I as _controllable_textarea, It as _return_change, J as _attrs, K as _attr_style_item, Kt as $signal, Lt as _script, M as _attr_select_value_script, Mt as _let, N as _controllable_input, Nt as _let_change, O as _attr_input_value_dynamic_default, Ot as _hoist, P as _controllable_open, Pt as _or, Q as _attrs_script, Qt as queueAsyncRender, Rt as _var, S as _attr_input_checkedValue_script, St as _closure, T as _attr_input_value, Tt as _el_read, U as _attr_content, Ut as removeAndDestroyBranch, V as _attr_class_item, Vt as destroyBranch, W as _attr_nonce, Wt as syncGen, X as _attrs_partial, Y as _attrs_content, Z as _attrs_partial_content, Zt as prepareEffects, _ as _attr_details_or_dialog_open_default, _t as getRegisteredWithScope, a as _for_in, an as forTo, at as _to_text, b as _attr_input_checkedValue, bt as ready, c as _for_until, cn as _call, ct as _content, d as _show, dt as createAndSetupBranch, en as run, et as _lifecycle, f as _try, ft as createBranch, g as _attr_details_or_dialog_open, gt as _var_resume, h as renderCatch, ht as _resume, i as _dynamic_tag_content, in as forOf, it as _text_content, j as _attr_select_value_default, jt as _if_closure, k as _attr_input_value_script, kt as _hoist_resume, l as _if, ln as decodeAccessor, lt as _content_closures, m as patchDynamicTag, mt as _el, n as _await_promise, nn as runId, nt as _style_shell, o as _for_of, on as forUntil, ot as insertChildNodes, p as addAwaitCounter, pt as setupBranch, q as _attr_style_items, qt as $signalReset, r as _dynamic_tag, rn as forIn, rt as _text, s as _for_to, sn as _assert_hoist, st as toInsertNode, t as _await_content, tn as runEffects, tt as _style_rule_item, u as _resume_dynamic_tag, ut as _content_resume, v as _attr_details_or_dialog_open_script, vt as init, w as _attr_input_checked_script, wt as _const, x as _attr_input_checkedValue_default, xt as _child_setup, y as _attr_input_checked, yt as initEmbedded, z as _attr, zt as _var_change } from "./dom-BP2XSglG.mjs";
67
69
  //#region src/common/attr-tag.ts
68
70
  function attrTag(attrs) {
69
71
  return attrs[Symbol.iterator] = attrTagIterator, attrs[rest] = empty, attrs;