@llui/dom 0.0.40 → 0.2.0

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 (68) hide show
  1. package/README.md +22 -21
  2. package/dist/binding.d.ts +5 -0
  3. package/dist/binding.d.ts.map +1 -1
  4. package/dist/binding.js +1 -0
  5. package/dist/binding.js.map +1 -1
  6. package/dist/combine.d.ts +67 -0
  7. package/dist/combine.d.ts.map +1 -0
  8. package/dist/combine.js +76 -0
  9. package/dist/combine.js.map +1 -0
  10. package/dist/compose.d.ts +27 -21
  11. package/dist/compose.d.ts.map +1 -1
  12. package/dist/compose.js +19 -13
  13. package/dist/compose.js.map +1 -1
  14. package/dist/devtools.d.ts.map +1 -1
  15. package/dist/devtools.js +15 -5
  16. package/dist/devtools.js.map +1 -1
  17. package/dist/el-split.d.ts +1 -1
  18. package/dist/el-split.d.ts.map +1 -1
  19. package/dist/el-split.js +20 -2
  20. package/dist/el-split.js.map +1 -1
  21. package/dist/el-template.d.ts +8 -2
  22. package/dist/el-template.d.ts.map +1 -1
  23. package/dist/el-template.js +2 -1
  24. package/dist/el-template.js.map +1 -1
  25. package/dist/escape-hatch.d.ts +47 -0
  26. package/dist/escape-hatch.d.ts.map +1 -0
  27. package/dist/escape-hatch.js +63 -0
  28. package/dist/escape-hatch.js.map +1 -0
  29. package/dist/hmr.d.ts +2 -1
  30. package/dist/hmr.d.ts.map +1 -1
  31. package/dist/hmr.js +3 -2
  32. package/dist/hmr.js.map +1 -1
  33. package/dist/index.d.ts +3 -4
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +2 -3
  36. package/dist/index.js.map +1 -1
  37. package/dist/primitives/branch.d.ts.map +1 -1
  38. package/dist/primitives/branch.js +1 -0
  39. package/dist/primitives/branch.js.map +1 -1
  40. package/dist/primitives/each.d.ts.map +1 -1
  41. package/dist/primitives/each.js +1 -0
  42. package/dist/primitives/each.js.map +1 -1
  43. package/dist/primitives/memo.d.ts +2 -2
  44. package/dist/primitives/memo.d.ts.map +1 -1
  45. package/dist/primitives/memo.js +13 -5
  46. package/dist/primitives/memo.js.map +1 -1
  47. package/dist/primitives/sample.d.ts +2 -2
  48. package/dist/primitives/sample.js +2 -2
  49. package/dist/primitives/sample.js.map +1 -1
  50. package/dist/primitives/unsafe-html.d.ts.map +1 -1
  51. package/dist/primitives/unsafe-html.js +1 -0
  52. package/dist/primitives/unsafe-html.js.map +1 -1
  53. package/dist/primitives/virtual-each.d.ts.map +1 -1
  54. package/dist/primitives/virtual-each.js +7 -4
  55. package/dist/primitives/virtual-each.js.map +1 -1
  56. package/dist/render-context.js +1 -1
  57. package/dist/render-context.js.map +1 -1
  58. package/dist/structural.d.ts +8 -4
  59. package/dist/structural.d.ts.map +1 -1
  60. package/dist/structural.js.map +1 -1
  61. package/dist/types.d.ts +27 -23
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/types.js.map +1 -1
  64. package/dist/update-loop.d.ts +14 -6
  65. package/dist/update-loop.d.ts.map +1 -1
  66. package/dist/update-loop.js +130 -34
  67. package/dist/update-loop.js.map +1 -1
  68. package/package.json +5 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape-hatch.d.ts","sourceRoot":"","sources":["../src/escape-hatch.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AAKxD,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,IAAI,CAAE,SAAQ,YAAY;IAC3D;;;;;;;;;;;;;;;;OAgBG;IACH,MAAM,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,IAAI,CAAC,EAAE,CAAC,CAAA;CACT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,aAAa,GAAG;IAAE,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAAE,GAAG,IAAI,EAAE,CAAA;AAC7F,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAC/B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG;IACvB,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC7B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAA;CACvC,GACA,IAAI,EAAE,CAAA"}
@@ -0,0 +1,63 @@
1
+ // `subApp` — the legitimate state-isolation escape hatch.
2
+ //
3
+ // Mounts a fully isolated app-in-app at a point in the parent's view.
4
+ // The sub-app has its OWN state, OWN reducer, OWN scope tree, OWN effect
5
+ // pipeline, OWN AppHandle. The parent and sub-app communicate ONLY via
6
+ // the parent passing init data into the sub-app at mount time; afterward,
7
+ // the sub-app is a black box.
8
+ //
9
+ // **Use `subApp` only when you genuinely need a second app.** Examples:
10
+ // - A third-party UI widget with its own non-TEA lifecycle (Monaco,
11
+ // ProseMirror) wrapped in a TEA-style adapter that owns its
12
+ // foreign-DOM state.
13
+ // - An isolated 60fps drag layer that should not pump every drag
14
+ // message through the host's reducer.
15
+ // - A deferred chunk loaded for a sub-feature that wants its own
16
+ // state lifecycle, independent of any host-side compaction.
17
+ //
18
+ // For decomposition / organization, **write a view function**. A view
19
+ // function shares the host's state and routes messages through the
20
+ // host's reducer — that's the whole point of the unified composition
21
+ // model. Reaching for `subApp` to break up a big component is the
22
+ // anti-pattern; see `docs/proposals/unified-composition-model.md` for
23
+ // the long-form rationale.
24
+ //
25
+ // The `reason: string` argument is mandatory and shows up in devtools
26
+ // + MCP introspection so reviewers can audit whether the boundary is
27
+ // load-bearing. Treat it like a `eslint-disable` comment: an explicit
28
+ // note that you've considered the alternatives and chosen the boundary
29
+ // deliberately. ESLint rule `llui/subapp-requires-reason` enforces
30
+ // non-empty values.
31
+ import { mountApp } from './mount.js';
32
+ import { getRenderContext } from './render-context.js';
33
+ import { addDisposer } from './lifetime.js';
34
+ import { onMount } from './primitives/on-mount.js';
35
+ export function subApp(opts) {
36
+ if (typeof opts.reason !== 'string' || opts.reason.trim() === '') {
37
+ throw new Error(`[LLui] subApp() requires a non-empty 'reason' string explaining why a state-isolation ` +
38
+ `boundary is necessary here rather than a view function. See ` +
39
+ `docs/proposals/unified-composition-model.md.`);
40
+ }
41
+ const ctx = getRenderContext('subApp');
42
+ const parentScope = ctx.rootLifetime;
43
+ const wrapper = ctx.dom.createElement('div');
44
+ wrapper.setAttribute('data-llui-sub-app', '');
45
+ // Mark with the reason so devtools / MCP / agent tools can surface it.
46
+ wrapper.setAttribute('data-llui-sub-app-reason', opts.reason);
47
+ // Mount the sub-app on the synchronous onMount cycle once the wrapper
48
+ // is in the DOM. mountApp requires its container to be live.
49
+ onMount(() => {
50
+ const handle = mountApp(wrapper, opts.def, opts.data, {
51
+ env: opts.env,
52
+ devTools: opts.devTools,
53
+ runInitEffectsOnHydrate: opts.runInitEffectsOnHydrate,
54
+ });
55
+ // Surface the handle to the caller if they asked.
56
+ if (opts.onHandle)
57
+ opts.onHandle(handle);
58
+ // Tie the sub-app's lifecycle to the parent scope.
59
+ addDisposer(parentScope, () => handle.dispose());
60
+ });
61
+ return [wrapper];
62
+ }
63
+ //# sourceMappingURL=escape-hatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape-hatch.js","sourceRoot":"","sources":["../src/escape-hatch.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,sEAAsE;AACtE,yEAAyE;AACzE,uEAAuE;AACvE,0EAA0E;AAC1E,8BAA8B;AAC9B,EAAE;AACF,wEAAwE;AACxE,sEAAsE;AACtE,gEAAgE;AAChE,yBAAyB;AACzB,mEAAmE;AACnE,0CAA0C;AAC1C,mEAAmE;AACnE,gEAAgE;AAChE,EAAE;AACF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BAAuB;SACtD,CAAC,CAAA;QACF,kDAAkD;QAClD,IAAI,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;QACxC,mDAAmD;QACnD,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,OAAO,CAAC,CAAA;AAClB,CAAC","sourcesContent":["// `subApp` — the legitimate state-isolation escape hatch.\n//\n// Mounts a fully isolated app-in-app at a point in the parent's view.\n// The sub-app has its OWN state, OWN reducer, OWN scope tree, OWN effect\n// pipeline, OWN AppHandle. The parent and sub-app communicate ONLY via\n// the parent passing init data into the sub-app at mount time; afterward,\n// the sub-app is a black box.\n//\n// **Use `subApp` only when you genuinely need a second app.** Examples:\n// - A third-party UI widget with its own non-TEA lifecycle (Monaco,\n// ProseMirror) wrapped in a TEA-style adapter that owns its\n// foreign-DOM state.\n// - An isolated 60fps drag layer that should not pump every drag\n// message through the host's reducer.\n// - A deferred chunk loaded for a sub-feature that wants its own\n// state lifecycle, independent of any host-side compaction.\n//\n// For decomposition / organization, **write a view function**. A view\n// function shares the host's state and routes messages through the\n// host's reducer — that's the whole point of the unified composition\n// model. Reaching for `subApp` to break up a big component is the\n// anti-pattern; see `docs/proposals/unified-composition-model.md` for\n// the long-form rationale.\n//\n// The `reason: string` argument is mandatory and shows up in devtools\n// + MCP introspection so reviewers can audit whether the boundary is\n// load-bearing. Treat it like a `eslint-disable` comment: an explicit\n// note that you've considered the alternatives and chosen the boundary\n// deliberately. ESLint rule `llui/subapp-requires-reason` enforces\n// non-empty values.\n\nimport type { ComponentDef, AppHandle } from './types.js'\nimport { mountApp, type MountOptions } from './mount.js'\nimport { getRenderContext } from './render-context.js'\nimport { addDisposer } from './lifetime.js'\nimport { onMount } from './primitives/on-mount.js'\n\nexport interface SubAppOptions<D = void> extends MountOptions {\n /**\n * Why a `subApp` boundary is needed here rather than a view function.\n * Required, non-empty. Shown in devtools / MCP / agent introspection\n * so a reviewer can audit isolation boundaries the way they'd audit\n * `eslint-disable` comments. ESLint rule `llui/subapp-requires-reason`\n * enforces that this is a non-empty string literal.\n *\n * Examples of good reasons:\n * - \"Monaco editor owns its own DOM + selection lifecycle\"\n * - \"60fps drag layer — pumping every drag through the host reducer\n * is too expensive\"\n * - \"Lazy-loaded admin tools chunk; state is sealed off from main app\"\n *\n * \"code organization\", \"to break up this component\", \"I felt like it\"\n * are all wrong answers — they signal the call should be a view\n * function instead.\n */\n reason: string\n /** Init data threaded into the sub-app's `def.init(data)`. */\n data?: D\n}\n\n/**\n * Mount a fully isolated app-in-app at the current view position.\n *\n * The sub-app's lifecycle is tied to the parent scope: when the parent\n * scope disposes (component unmount, branch arm replaced, `each` row\n * removed, ...), the sub-app's handle is `dispose()`'d automatically.\n *\n * Returns the node array to splice into the parent's view. Internally\n * synthesizes a wrapper container; the sub-app mounts inside it on the\n * synchronous `onMount` cycle after the parent's DOM is in place.\n *\n * For host code that needs the `AppHandle` (to drive the sub-app from\n * outside — typically a foreign integration), pass `onHandle` in the\n * options; it receives the handle once mount completes.\n */\nexport function subApp<S, M, E>(opts: SubAppOptions & { def: ComponentDef<S, M, E> }): Node[]\nexport function subApp<S, M, E, D>(\n opts: SubAppOptions<D> & {\n def: ComponentDef<S, M, E, D>\n onHandle?: (handle: AppHandle) => void\n },\n): Node[]\nexport function subApp<S, M, E, D>(\n opts: SubAppOptions<D> & {\n def: ComponentDef<S, M, E, D>\n onHandle?: (handle: AppHandle) => void\n },\n): Node[] {\n if (typeof opts.reason !== 'string' || opts.reason.trim() === '') {\n throw new Error(\n `[LLui] subApp() requires a non-empty 'reason' string explaining why a state-isolation ` +\n `boundary is necessary here rather than a view function. See ` +\n `docs/proposals/unified-composition-model.md.`,\n )\n }\n\n const ctx = getRenderContext('subApp')\n const parentScope = ctx.rootLifetime\n const wrapper = ctx.dom.createElement('div') as HTMLElement\n wrapper.setAttribute('data-llui-sub-app', '')\n // Mark with the reason so devtools / MCP / agent tools can surface it.\n wrapper.setAttribute('data-llui-sub-app-reason', opts.reason)\n\n // Mount the sub-app on the synchronous onMount cycle once the wrapper\n // is in the DOM. mountApp requires its container to be live.\n onMount(() => {\n const handle = mountApp(wrapper, opts.def, opts.data as never, {\n env: opts.env,\n devTools: opts.devTools,\n runInitEffectsOnHydrate: opts.runInitEffectsOnHydrate,\n })\n // Surface the handle to the caller if they asked.\n if (opts.onHandle) opts.onHandle(handle)\n // Tie the sub-app's lifecycle to the parent scope.\n addDisposer(parentScope, () => handle.dispose())\n })\n\n return [wrapper]\n}\n"]}
package/dist/hmr.d.ts CHANGED
@@ -10,7 +10,8 @@ export declare function unregisterForHmr(name: string, inst: object): void;
10
10
  /**
11
11
  * Hot-swap a component definition on all live instances.
12
12
  *
13
- * Preserves the current state. Replaces update, view, onEffect, and __dirty.
13
+ * Preserves the current state. Replaces update, view, onEffect, __update,
14
+ * __handlers, and __prefixes (compiler-emitted reactivity table).
14
15
  * Disposes the old scope tree (removing old DOM and bindings),
15
16
  * re-runs view(currentState, send) to rebuild fresh DOM.
16
17
  *
package/dist/hmr.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hmr.d.ts","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAWzD;;;GAGG;AACH,wBAAgB,SAAS,IAAI,IAAI,CAUhC;AAmBD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,GAAG,IAAI,CAIvF;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,EACf,WAAW,EAAE,OAAO,GACnB,IAAI,CAIN;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,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,OAAO,GACnB,IAAI,CAIN;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAMjE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAChD,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC/B,SAAS,GAAG,IAAI,CAYlB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAC5D,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAChC,SAAS,EAAE,WAAW,GACrB,SAAS,GAAG,IAAI,CAWlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EACzD,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAChC,MAAM,EAAE,OAAO,GACd,SAAS,GAAG,IAAI,CAUlB"}
package/dist/hmr.js CHANGED
@@ -45,7 +45,8 @@ export function unregisterForHmr(name, inst) {
45
45
  /**
46
46
  * Hot-swap a component definition on all live instances.
47
47
  *
48
- * Preserves the current state. Replaces update, view, onEffect, and __dirty.
48
+ * Preserves the current state. Replaces update, view, onEffect, __update,
49
+ * __handlers, and __prefixes (compiler-emitted reactivity table).
49
50
  * Disposes the old scope tree (removing old DOM and bindings),
50
51
  * re-runs view(currentState, send) to rebuild fresh DOM.
51
52
  *
@@ -123,9 +124,9 @@ function swapEntry(entry, name, newDef) {
123
124
  update: newDef.update,
124
125
  view: newDef.view,
125
126
  onEffect: newDef.onEffect,
126
- __dirty: newDef.__dirty,
127
127
  __update: newDef.__update,
128
128
  __handlers: newDef.__handlers,
129
+ __prefixes: newDef.__prefixes,
129
130
  };
130
131
  // Snapshot focus + selection + scroll BEFORE disposal — once the
131
132
  // root lifetime tears down its DOM, the activeElement and any
package/dist/hmr.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hmr.js","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,aAAa,CAAC;QACZ,SAAS;QACT,cAAc;QACd,iBAAiB;QACjB,gBAAgB;QAChB,gBAAgB;QAChB,4BAA4B;QAC5B,yBAAyB;KAC1B,CAAC,CAAA;AACJ,CAAC;AAiBD,MAAM,WAAW,GAAG,IAAI,GAAG,EAAsB,CAAA;AAEjD,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,IAAY,EAAE,SAAsB;IAC/E,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAA;IAC3C,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,IAAyB,EAAE,SAAS,EAAE,CAA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A;AACvB,CAAC;AAED;;;;GAIG;AACH,SAAS,MAAM,CAAC,IAAgB,EAAE,EAAiB,EAAE,IAAc;IACjE,IAAI,EAAE,EAAE,CAAC;QACP,MAAM,GAAG,GAAI,IAAgB,CAAC,aAAa,IAAI,UAAU,CAAC,QAAQ,CAAA;QAClE,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,IAAI,GAAG,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;YACnC,IAAI,IAAI,IAAK,IAA0B,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAA;QACrE,CAAC;IACH,CAAC;IACD,IAAI,GAAG,GAAS,IAAY,CAAA;IAC5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,KAAK,GAAG,GAAG,CAAC,UAAU,CAAA;QAC1B,IAAI,CAAC,GAAG,CAAC,CAAA;QACT,OAAO,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;YACxB,KAAK,GAAG,KAAK,CAAC,WAAW,CAAA;YACzB,CAAC,EAAE,CAAA;QACL,CAAC;QACD,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QACvB,GAAG,GAAG,KAAK,CAAA;IACb,CAAC;IACD,OAAO,GAAG,YAAY,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;AAC5C,CAAC","sourcesContent":["import type { ComponentDef, AppHandle } from './types.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport { flushInstance } from './update-loop.js'\nimport { createLifetime, disposeLifetime } from './lifetime.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { getBindingDescriptors } from './binding-descriptors.js'\nimport { unregisterInstance } from './runtime.js'\nimport { _setHmrModule } from './mount.js'\nimport { createView } from './view-helpers.js'\n\n/**\n * Enable HMR state preservation. Called by compiler-generated dev code.\n * Importing this module registers it with mountApp for hot-swapping.\n */\nexport function enableHmr(): void {\n _setHmrModule({\n enableHmr,\n registerForHmr,\n registerForAnchor,\n unregisterForHmr,\n replaceComponent,\n replaceComponentForContainer,\n replaceComponentForAnchor,\n })\n}\n\n// ── HMR Registry ─────────────────────────────────────────────────\n\ntype HmrEntry =\n | {\n kind: 'container'\n inst: ComponentInstance\n container: HTMLElement\n }\n | {\n kind: 'anchor'\n inst: ComponentInstance\n anchor: Comment\n endSentinel: Comment\n }\n\nconst hmrRegistry = new Map<string, HmrEntry[]>()\n\nexport function registerForHmr(name: string, inst: object, container: HTMLElement): void {\n const entries = hmrRegistry.get(name) ?? []\n entries.push({ kind: 'container', inst: inst as ComponentInstance, container })\n hmrRegistry.set(name, entries)\n}\n\nexport function registerForAnchor(\n name: string,\n inst: object,\n anchor: Comment,\n endSentinel: Comment,\n): void {\n const entries = hmrRegistry.get(name) ?? []\n entries.push({ kind: 'anchor', inst: inst as ComponentInstance, anchor, endSentinel })\n hmrRegistry.set(name, entries)\n}\n\nexport function unregisterForHmr(name: string, inst: object): void {\n const entries = hmrRegistry.get(name)\n if (!entries) return\n const idx = entries.findIndex((e) => e.inst === inst)\n if (idx !== -1) entries.splice(idx, 1)\n if (entries.length === 0) hmrRegistry.delete(name)\n}\n\n/**\n * Hot-swap a component definition on all live instances.\n *\n * Preserves the current state. Replaces update, view, onEffect, and __dirty.\n * Disposes the old scope tree (removing old DOM and bindings),\n * re-runs view(currentState, send) to rebuild fresh DOM.\n *\n * Returns an AppHandle for the first instance (for mountApp compatibility),\n * or null if no instances are registered (first mount).\n */\nexport function replaceComponent<S, M, E, D = void>(\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n\n let handle: AppHandle | null = null\n for (const entry of entries) {\n const h = swapEntry<S, M, E, D>(entry, name, newDef)\n if (!handle) handle = h\n }\n\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n return handle\n}\n\n/**\n * Container-scoped hot-swap. Used by `mountApp` / `hydrateApp`'s HMR\n * fast path: when the same `def.name` is mounted into multiple distinct\n * containers (e.g. a page's onMount iterating placeholders and mounting\n * an inline widget into each), a re-entry of the mount/hydrate path for\n * a fresh container must NOT swap any of the existing entries — those\n * are independent mounts, not module re-execution targeting the same\n * root. Only swap when the existing entry's container is the very same\n * node we're being asked to mount into.\n *\n * Returns the swapped handle when a matching container entry exists,\n * `null` otherwise so the caller can fall through to a fresh mount.\n */\nexport function replaceComponentForContainer<S, M, E, D = void>(\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n container: HTMLElement,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n const matching = entries.find(\n (e): e is Extract<HmrEntry, { kind: 'container' }> =>\n e.kind === 'container' && e.container === container,\n )\n if (!matching) return null\n const handle = swapEntry<S, M, E, D>(matching, name, newDef)\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n return handle\n}\n\n/**\n * Anchor-scoped hot-swap. The anchor-rooted analog of\n * `replaceComponentForContainer` — used by `mountAtAnchor` /\n * `hydrateAtAnchor`'s HMR fast path. A second call to the anchor-rooted\n * mount entry on the same anchor (typical of HMR module re-execution\n * for a vike persistent layout layer) hot-swaps in place rather than\n * leaving the prior instance orphaned with a stale end sentinel.\n *\n * Matches on anchor identity (not name alone): independent mounts of\n * the same-named component at different anchors must not collide with\n * each other.\n *\n * Returns the swapped handle when a matching anchor entry exists,\n * `null` otherwise so the caller can fall through to fresh mount /\n * hydrate.\n */\nexport function replaceComponentForAnchor<S, M, E, D = void>(\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n anchor: Comment,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n const matching = entries.find(\n (e): e is Extract<HmrEntry, { kind: 'anchor' }> => e.kind === 'anchor' && e.anchor === anchor,\n )\n if (!matching) return null\n const handle = swapEntry<S, M, E, D>(matching, name, newDef)\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n return handle\n}\n\nfunction swapEntry<S, M, E, D = void>(\n entry: HmrEntry,\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n): AppHandle {\n const typedInst = entry.inst as ComponentInstance<S, M, E>\n\n typedInst.def = {\n ...typedInst.def,\n update: newDef.update,\n view: newDef.view,\n onEffect: newDef.onEffect,\n __dirty: newDef.__dirty,\n __update: newDef.__update,\n __handlers: newDef.__handlers,\n }\n\n // Snapshot focus + selection + scroll BEFORE disposal — once the\n // root lifetime tears down its DOM, the activeElement and any\n // scrollable subtree are detached and can't be queried. We\n // restore best-effort after the new view renders. The cost of\n // skipping this step is the every-edit experience: the user\n // types in an input, saves, the input rebuilds and loses focus\n // and cursor position. That kills incremental editing flow.\n const ownerRoot: ParentNode | null =\n entry.kind === 'container' ? entry.container : (entry.anchor.parentElement ?? null)\n const focusSnapshot = ownerRoot ? captureFocus(ownerRoot) : null\n const scrollSnapshot = ownerRoot ? captureScroll(ownerRoot) : null\n\n disposeLifetime(typedInst.rootLifetime)\n\n // Clear the owned region per-kind.\n if (entry.kind === 'container') {\n entry.container.textContent = ''\n } else {\n // anchor kind — wipe siblings between anchor and endSentinel, keep the\n // anchor AND the end sentinel (they bracket the fresh render).\n let sib = entry.anchor.nextSibling\n while (sib !== null && sib !== entry.endSentinel) {\n const next = sib.nextSibling\n sib.parentNode!.removeChild(sib)\n sib = next\n }\n }\n\n typedInst.rootLifetime = createLifetime(null)\n typedInst.rootLifetime._kind = 'root'\n typedInst.allBindings = []\n typedInst.structuralBlocks = []\n\n setFlatBindings(typedInst.allBindings)\n setRenderContext({\n rootLifetime: typedInst.rootLifetime,\n state: typedInst.state,\n allBindings: typedInst.allBindings,\n structuralBlocks: typedInst.structuralBlocks,\n dom: typedInst.dom,\n container:\n entry.kind === 'container' ? entry.container : (entry.anchor.parentElement ?? undefined),\n send: typedInst.send as (msg: unknown) => void,\n instance: typedInst as ComponentInstance,\n })\n const nodes = typedInst.def.view(createView<S, M>(typedInst.send))\n clearRenderContext()\n setFlatBindings(null)\n\n if (entry.kind === 'container') {\n for (const node of nodes) {\n entry.container.appendChild(node)\n }\n } else {\n for (const node of nodes) {\n entry.anchor.parentNode!.insertBefore(node, entry.endSentinel)\n }\n }\n\n // Restore focus, selection, and scroll positions in the freshly\n // rendered DOM. Best-effort: when the new view's DOM has diverged\n // structurally (different IDs, different element ordering, the\n // input that was focused no longer exists), the restorers no-op\n // silently. This is the right tradeoff — failing loudly on\n // structural divergence would just mean every meaningful view\n // edit prints an error.\n if (ownerRoot) {\n if (focusSnapshot) restoreFocus(ownerRoot, focusSnapshot)\n if (scrollSnapshot) restoreScroll(ownerRoot, scrollSnapshot)\n }\n\n return makeReplacementHandle(name, entry, typedInst)\n}\n\nfunction makeReplacementHandle<S, M, E>(\n name: string,\n entry: HmrEntry,\n typedInst: ComponentInstance<S, M, E>,\n): AppHandle {\n const listeners = new Set<(s: unknown) => void>()\n typedInst._onCommit = (state: unknown) => {\n for (const l of Array.from(listeners)) {\n try {\n l(state)\n } catch (err) {\n console.error('[llui] listener threw:', err)\n }\n }\n }\n let disposed = false\n return {\n dispose() {\n if (disposed) return\n disposed = true\n listeners.clear()\n typedInst._onCommit = undefined\n unregisterForHmr(name, entry.inst)\n entry.inst.abortController.abort()\n unregisterInstance(entry.inst)\n disposeLifetime(typedInst.rootLifetime)\n if (entry.kind === 'container') {\n entry.container.textContent = ''\n } else {\n let sib = entry.anchor.nextSibling\n while (sib !== null && sib !== entry.endSentinel) {\n const next = sib.nextSibling\n sib.parentNode!.removeChild(sib)\n sib = next\n }\n entry.endSentinel.parentNode?.removeChild(entry.endSentinel)\n }\n },\n flush() {\n flushInstance(entry.inst)\n },\n send(msg: unknown) {\n ;(typedInst.send as (m: unknown) => void)(msg)\n },\n getState() {\n return typedInst.state\n },\n subscribe(listener: (state: unknown) => void) {\n if (disposed) return () => {}\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n getBindingDescriptors() {\n if (disposed) return []\n return getBindingDescriptors(typedInst as ComponentInstance)\n },\n swapUpdate(newUpdate, newOnEffect) {\n if (disposed) return\n flushInstance(entry.inst)\n ;(typedInst.def as { update: typeof newUpdate }).update = newUpdate\n if (newOnEffect !== undefined) {\n ;(typedInst.def as { onEffect?: typeof newOnEffect }).onEffect = newOnEffect\n }\n },\n runReducer(msg) {\n if (disposed) return null\n const [state, effects] = (\n typedInst.def.update as (s: unknown, m: unknown) => [unknown, unknown[]]\n )(typedInst.state, msg)\n return { state, effects: effects as unknown[] }\n },\n setOnBindingError(hook) {\n if (disposed) return\n typedInst._onBindingError = hook ?? undefined\n },\n }\n}\n\n// ── Focus / selection / scroll preservation across HMR ──────────\n\n/**\n * What we record before disposing the root DOM. The locator is a\n * structural pointer: prefer `id` (resilient to view restructuring),\n * fall back to a child-index path through the rendered subtree. If\n * the new DOM doesn't match either, the restore call no-ops.\n */\ntype FocusSnapshot = {\n /** The element's `id` if it had one, else `null`. */\n id: string | null\n /** Sibling-index path from `ownerRoot` down to the focused element. */\n path: number[]\n /** Selection range if the focused element is a text input/textarea. */\n selection: { start: number; end: number; direction: 'forward' | 'backward' | 'none' } | null\n}\n\ntype ScrollSnapshot = Array<{\n id: string | null\n path: number[]\n scrollTop: number\n scrollLeft: number\n}>\n\nfunction captureFocus(root: ParentNode): FocusSnapshot | null {\n const doc = (root as Element).ownerDocument ?? globalThis.document\n if (!doc) return null\n const active = doc.activeElement\n if (!active || active === doc.body) return null\n // Only capture focus for elements inside our owned subtree —\n // anything outside is not ours to restore.\n if (!(root as ParentNode & Node).contains(active)) return null\n\n const path = pathFromAncestor(root as Node, active)\n if (path === null) return null\n\n let selection: FocusSnapshot['selection'] = null\n if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) {\n // Some input types (number, email, etc.) reject selectionStart access.\n // Wrapper try/catch keeps the snapshot resilient to those cases.\n try {\n if (active.selectionStart !== null && active.selectionEnd !== null) {\n selection = {\n start: active.selectionStart,\n end: active.selectionEnd,\n direction: (active.selectionDirection ?? 'none') as 'forward' | 'backward' | 'none',\n }\n }\n } catch {\n selection = null\n }\n }\n\n return {\n id: active.id || null,\n path,\n selection,\n }\n}\n\nfunction restoreFocus(root: ParentNode, snap: FocusSnapshot): void {\n const target = locate(root, snap.id, snap.path)\n if (!target || !(target instanceof HTMLElement)) return\n try {\n target.focus({ preventScroll: true })\n } catch {\n return\n }\n if (\n snap.selection &&\n (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)\n ) {\n try {\n target.setSelectionRange(snap.selection.start, snap.selection.end, snap.selection.direction)\n } catch {\n // Some input types throw on setSelectionRange; ignore.\n }\n }\n}\n\nfunction captureScroll(root: ParentNode): ScrollSnapshot {\n // Walk the subtree and snapshot every element with non-zero\n // scroll. Most subtrees have at most a handful, so the per-edit\n // cost is small. Capturing all-zeroes wastes the restore work for\n // no benefit; the filter keeps things tight.\n const out: ScrollSnapshot = []\n const walk = (node: Node): void => {\n if (node instanceof HTMLElement) {\n if (node.scrollTop !== 0 || node.scrollLeft !== 0) {\n const path = pathFromAncestor(root as Node, node)\n if (path !== null) {\n out.push({\n id: node.id || null,\n path,\n scrollTop: node.scrollTop,\n scrollLeft: node.scrollLeft,\n })\n }\n }\n }\n for (let c = node.firstChild; c !== null; c = c.nextSibling) {\n walk(c)\n }\n }\n walk(root as Node)\n return out\n}\n\nfunction restoreScroll(root: ParentNode, snap: ScrollSnapshot): void {\n for (const s of snap) {\n const target = locate(root, s.id, s.path)\n if (!target || !(target instanceof HTMLElement)) continue\n target.scrollTop = s.scrollTop\n target.scrollLeft = s.scrollLeft\n }\n}\n\n/**\n * Compute the child-index path from `ancestor` down to `target`, or\n * `null` if `target` isn't in the subtree. The path is what gets\n * walked on restore — no document-wide selectors, no string-encoded\n * selectors that can break on punctuation in IDs.\n */\nfunction pathFromAncestor(ancestor: Node, target: Node): number[] | null {\n const path: number[] = []\n let cur: Node | null = target\n while (cur !== null && cur !== ancestor) {\n const parent: Node | null = cur.parentNode\n if (parent === null) return null\n let idx = 0\n let sib: Node | null = parent.firstChild\n while (sib !== null && sib !== cur) {\n idx++\n sib = sib.nextSibling\n }\n if (sib === null) return null\n path.push(idx)\n cur = parent\n }\n if (cur !== ancestor) return null\n return path.reverse()\n}\n\n/**\n * Restore lookup: try `id` first (cheap and resilient to structural\n * change), then walk the captured child-index path. Returns `null`\n * if neither lookup succeeds — the restore caller silently no-ops.\n */\nfunction locate(root: ParentNode, id: string | null, path: number[]): Element | null {\n if (id) {\n const doc = (root as Element).ownerDocument ?? globalThis.document\n if (doc) {\n const byId = doc.getElementById(id)\n if (byId && (root as ParentNode & Node).contains(byId)) return byId\n }\n }\n let cur: Node = root as Node\n for (const idx of path) {\n let child = cur.firstChild\n let i = 0\n while (child && i < idx) {\n child = child.nextSibling\n i++\n }\n if (!child) return null\n cur = child\n }\n return cur instanceof Element ? cur : null\n}\n"]}
1
+ {"version":3,"file":"hmr.js","sourceRoot":"","sources":["../src/hmr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C;;;GAGG;AACH,MAAM,UAAU,SAAS;IACvB,aAAa,CAAC;QACZ,SAAS;QACT,cAAc;QACd,iBAAiB;QACjB,gBAAgB;QAChB,gBAAgB;QAChB,4BAA4B;QAC5B,yBAAyB;KAC1B,CAAC,CAAA;AACJ,CAAC;AAiBD,MAAM,WAAW,GAAG,IAAI,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,CAAC,WAAW,CAAA;QACvB,CAAC;QACD,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,IAAI,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACd,GAAG,GAAG,MAAM,CAAA;IACd,CAAC;IACD,IAAI,GAAG,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAA;IACjC,OAAO,IAAI,CAAC,OAAO,EAAE,CAAA;AACvB,CAAC;AAED;;;;GAIG;AACH,SAAS,MAAM,CAAC,IAAgB,EAAE,EAAiB,EAAE,IAAc;IACjE,IAAI,EAAE,EAAE,CAAC;QACP,MAAM,GAAG,GAAI,IAAgB,CAAC,aAAa,IAAI,UAAU,CAAC,QAAQ,CAAA;QAClE,IAAI,GAAG,EAAE,CAAC;YACR,MAAM,IAAI,GAAG,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC,CAAA;YACnC,IAAI,IAAI,IAAK,IAA0B,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAA;QACrE,CAAC;IACH,CAAC;IACD,IAAI,GAAG,GAAS,IAAY,CAAA;IAC5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,KAAK,GAAG,GAAG,CAAC,UAAU,CAAA;QAC1B,IAAI,CAAC,GAAG,CAAC,CAAA;QACT,OAAO,KAAK,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;YACxB,KAAK,GAAG,KAAK,CAAC,WAAW,CAAA;YACzB,CAAC,EAAE,CAAA;QACL,CAAC;QACD,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAA;QACvB,GAAG,GAAG,KAAK,CAAA;IACb,CAAC;IACD,OAAO,GAAG,YAAY,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;AAC5C,CAAC","sourcesContent":["import type { ComponentDef, AppHandle } from './types.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport { flushInstance } from './update-loop.js'\nimport { createLifetime, disposeLifetime } from './lifetime.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { getBindingDescriptors } from './binding-descriptors.js'\nimport { unregisterInstance } from './runtime.js'\nimport { _setHmrModule } from './mount.js'\nimport { createView } from './view-helpers.js'\n\n/**\n * Enable HMR state preservation. Called by compiler-generated dev code.\n * Importing this module registers it with mountApp for hot-swapping.\n */\nexport function enableHmr(): void {\n _setHmrModule({\n enableHmr,\n registerForHmr,\n registerForAnchor,\n unregisterForHmr,\n replaceComponent,\n replaceComponentForContainer,\n replaceComponentForAnchor,\n })\n}\n\n// ── HMR Registry ─────────────────────────────────────────────────\n\ntype HmrEntry =\n | {\n kind: 'container'\n inst: ComponentInstance\n container: HTMLElement\n }\n | {\n kind: 'anchor'\n inst: ComponentInstance\n anchor: Comment\n endSentinel: Comment\n }\n\nconst hmrRegistry = new Map<string, HmrEntry[]>()\n\nexport function registerForHmr(name: string, inst: object, container: HTMLElement): void {\n const entries = hmrRegistry.get(name) ?? []\n entries.push({ kind: 'container', inst: inst as ComponentInstance, container })\n hmrRegistry.set(name, entries)\n}\n\nexport function registerForAnchor(\n name: string,\n inst: object,\n anchor: Comment,\n endSentinel: Comment,\n): void {\n const entries = hmrRegistry.get(name) ?? []\n entries.push({ kind: 'anchor', inst: inst as ComponentInstance, anchor, endSentinel })\n hmrRegistry.set(name, entries)\n}\n\nexport function unregisterForHmr(name: string, inst: object): void {\n const entries = hmrRegistry.get(name)\n if (!entries) return\n const idx = entries.findIndex((e) => e.inst === inst)\n if (idx !== -1) entries.splice(idx, 1)\n if (entries.length === 0) hmrRegistry.delete(name)\n}\n\n/**\n * Hot-swap a component definition on all live instances.\n *\n * Preserves the current state. Replaces update, view, onEffect, __update,\n * __handlers, and __prefixes (compiler-emitted reactivity table).\n * Disposes the old scope tree (removing old DOM and bindings),\n * re-runs view(currentState, send) to rebuild fresh DOM.\n *\n * Returns an AppHandle for the first instance (for mountApp compatibility),\n * or null if no instances are registered (first mount).\n */\nexport function replaceComponent<S, M, E, D = void>(\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n\n let handle: AppHandle | null = null\n for (const entry of entries) {\n const h = swapEntry<S, M, E, D>(entry, name, newDef)\n if (!handle) handle = h\n }\n\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n return handle\n}\n\n/**\n * Container-scoped hot-swap. Used by `mountApp` / `hydrateApp`'s HMR\n * fast path: when the same `def.name` is mounted into multiple distinct\n * containers (e.g. a page's onMount iterating placeholders and mounting\n * an inline widget into each), a re-entry of the mount/hydrate path for\n * a fresh container must NOT swap any of the existing entries — those\n * are independent mounts, not module re-execution targeting the same\n * root. Only swap when the existing entry's container is the very same\n * node we're being asked to mount into.\n *\n * Returns the swapped handle when a matching container entry exists,\n * `null` otherwise so the caller can fall through to a fresh mount.\n */\nexport function replaceComponentForContainer<S, M, E, D = void>(\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n container: HTMLElement,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n const matching = entries.find(\n (e): e is Extract<HmrEntry, { kind: 'container' }> =>\n e.kind === 'container' && e.container === container,\n )\n if (!matching) return null\n const handle = swapEntry<S, M, E, D>(matching, name, newDef)\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n return handle\n}\n\n/**\n * Anchor-scoped hot-swap. The anchor-rooted analog of\n * `replaceComponentForContainer` — used by `mountAtAnchor` /\n * `hydrateAtAnchor`'s HMR fast path. A second call to the anchor-rooted\n * mount entry on the same anchor (typical of HMR module re-execution\n * for a vike persistent layout layer) hot-swaps in place rather than\n * leaving the prior instance orphaned with a stale end sentinel.\n *\n * Matches on anchor identity (not name alone): independent mounts of\n * the same-named component at different anchors must not collide with\n * each other.\n *\n * Returns the swapped handle when a matching anchor entry exists,\n * `null` otherwise so the caller can fall through to fresh mount /\n * hydrate.\n */\nexport function replaceComponentForAnchor<S, M, E, D = void>(\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n anchor: Comment,\n): AppHandle | null {\n const entries = hmrRegistry.get(name)\n if (!entries || entries.length === 0) return null\n const matching = entries.find(\n (e): e is Extract<HmrEntry, { kind: 'anchor' }> => e.kind === 'anchor' && e.anchor === anchor,\n )\n if (!matching) return null\n const handle = swapEntry<S, M, E, D>(matching, name, newDef)\n console.log(`[LLui HMR] ${name} updated — state preserved`)\n return handle\n}\n\nfunction swapEntry<S, M, E, D = void>(\n entry: HmrEntry,\n name: string,\n newDef: ComponentDef<S, M, E, D>,\n): AppHandle {\n const typedInst = entry.inst as ComponentInstance<S, M, E>\n\n typedInst.def = {\n ...typedInst.def,\n update: newDef.update,\n view: newDef.view,\n onEffect: newDef.onEffect,\n __update: newDef.__update,\n __handlers: newDef.__handlers,\n __prefixes: newDef.__prefixes,\n }\n\n // Snapshot focus + selection + scroll BEFORE disposal — once the\n // root lifetime tears down its DOM, the activeElement and any\n // scrollable subtree are detached and can't be queried. We\n // restore best-effort after the new view renders. The cost of\n // skipping this step is the every-edit experience: the user\n // types in an input, saves, the input rebuilds and loses focus\n // and cursor position. That kills incremental editing flow.\n const ownerRoot: ParentNode | null =\n entry.kind === 'container' ? entry.container : (entry.anchor.parentElement ?? null)\n const focusSnapshot = ownerRoot ? captureFocus(ownerRoot) : null\n const scrollSnapshot = ownerRoot ? captureScroll(ownerRoot) : null\n\n disposeLifetime(typedInst.rootLifetime)\n\n // Clear the owned region per-kind.\n if (entry.kind === 'container') {\n entry.container.textContent = ''\n } else {\n // anchor kind — wipe siblings between anchor and endSentinel, keep the\n // anchor AND the end sentinel (they bracket the fresh render).\n let sib = entry.anchor.nextSibling\n while (sib !== null && sib !== entry.endSentinel) {\n const next = sib.nextSibling\n sib.parentNode!.removeChild(sib)\n sib = next\n }\n }\n\n typedInst.rootLifetime = createLifetime(null)\n typedInst.rootLifetime._kind = 'root'\n typedInst.allBindings = []\n typedInst.structuralBlocks = []\n\n setFlatBindings(typedInst.allBindings)\n setRenderContext({\n rootLifetime: typedInst.rootLifetime,\n state: typedInst.state,\n allBindings: typedInst.allBindings,\n structuralBlocks: typedInst.structuralBlocks,\n dom: typedInst.dom,\n container:\n entry.kind === 'container' ? entry.container : (entry.anchor.parentElement ?? undefined),\n send: typedInst.send as (msg: unknown) => void,\n instance: typedInst as ComponentInstance,\n })\n const nodes = typedInst.def.view(createView<S, M>(typedInst.send))\n clearRenderContext()\n setFlatBindings(null)\n\n if (entry.kind === 'container') {\n for (const node of nodes) {\n entry.container.appendChild(node)\n }\n } else {\n for (const node of nodes) {\n entry.anchor.parentNode!.insertBefore(node, entry.endSentinel)\n }\n }\n\n // Restore focus, selection, and scroll positions in the freshly\n // rendered DOM. Best-effort: when the new view's DOM has diverged\n // structurally (different IDs, different element ordering, the\n // input that was focused no longer exists), the restorers no-op\n // silently. This is the right tradeoff — failing loudly on\n // structural divergence would just mean every meaningful view\n // edit prints an error.\n if (ownerRoot) {\n if (focusSnapshot) restoreFocus(ownerRoot, focusSnapshot)\n if (scrollSnapshot) restoreScroll(ownerRoot, scrollSnapshot)\n }\n\n return makeReplacementHandle(name, entry, typedInst)\n}\n\nfunction makeReplacementHandle<S, M, E>(\n name: string,\n entry: HmrEntry,\n typedInst: ComponentInstance<S, M, E>,\n): AppHandle {\n const listeners = new Set<(s: unknown) => void>()\n typedInst._onCommit = (state: unknown) => {\n for (const l of Array.from(listeners)) {\n try {\n l(state)\n } catch (err) {\n console.error('[llui] listener threw:', err)\n }\n }\n }\n let disposed = false\n return {\n dispose() {\n if (disposed) return\n disposed = true\n listeners.clear()\n typedInst._onCommit = undefined\n unregisterForHmr(name, entry.inst)\n entry.inst.abortController.abort()\n unregisterInstance(entry.inst)\n disposeLifetime(typedInst.rootLifetime)\n if (entry.kind === 'container') {\n entry.container.textContent = ''\n } else {\n let sib = entry.anchor.nextSibling\n while (sib !== null && sib !== entry.endSentinel) {\n const next = sib.nextSibling\n sib.parentNode!.removeChild(sib)\n sib = next\n }\n entry.endSentinel.parentNode?.removeChild(entry.endSentinel)\n }\n },\n flush() {\n flushInstance(entry.inst)\n },\n send(msg: unknown) {\n ;(typedInst.send as (m: unknown) => void)(msg)\n },\n getState() {\n return typedInst.state\n },\n subscribe(listener: (state: unknown) => void) {\n if (disposed) return () => {}\n listeners.add(listener)\n return () => listeners.delete(listener)\n },\n getBindingDescriptors() {\n if (disposed) return []\n return getBindingDescriptors(typedInst as ComponentInstance)\n },\n swapUpdate(newUpdate, newOnEffect) {\n if (disposed) return\n flushInstance(entry.inst)\n ;(typedInst.def as { update: typeof newUpdate }).update = newUpdate\n if (newOnEffect !== undefined) {\n ;(typedInst.def as { onEffect?: typeof newOnEffect }).onEffect = newOnEffect\n }\n },\n runReducer(msg) {\n if (disposed) return null\n const [state, effects] = (\n typedInst.def.update as (s: unknown, m: unknown) => [unknown, unknown[]]\n )(typedInst.state, msg)\n return { state, effects: effects as unknown[] }\n },\n setOnBindingError(hook) {\n if (disposed) return\n typedInst._onBindingError = hook ?? undefined\n },\n }\n}\n\n// ── Focus / selection / scroll preservation across HMR ──────────\n\n/**\n * What we record before disposing the root DOM. The locator is a\n * structural pointer: prefer `id` (resilient to view restructuring),\n * fall back to a child-index path through the rendered subtree. If\n * the new DOM doesn't match either, the restore call no-ops.\n */\ntype FocusSnapshot = {\n /** The element's `id` if it had one, else `null`. */\n id: string | null\n /** Sibling-index path from `ownerRoot` down to the focused element. */\n path: number[]\n /** Selection range if the focused element is a text input/textarea. */\n selection: { start: number; end: number; direction: 'forward' | 'backward' | 'none' } | null\n}\n\ntype ScrollSnapshot = Array<{\n id: string | null\n path: number[]\n scrollTop: number\n scrollLeft: number\n}>\n\nfunction captureFocus(root: ParentNode): FocusSnapshot | null {\n const doc = (root as Element).ownerDocument ?? globalThis.document\n if (!doc) return null\n const active = doc.activeElement\n if (!active || active === doc.body) return null\n // Only capture focus for elements inside our owned subtree —\n // anything outside is not ours to restore.\n if (!(root as ParentNode & Node).contains(active)) return null\n\n const path = pathFromAncestor(root as Node, active)\n if (path === null) return null\n\n let selection: FocusSnapshot['selection'] = null\n if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement) {\n // Some input types (number, email, etc.) reject selectionStart access.\n // Wrapper try/catch keeps the snapshot resilient to those cases.\n try {\n if (active.selectionStart !== null && active.selectionEnd !== null) {\n selection = {\n start: active.selectionStart,\n end: active.selectionEnd,\n direction: (active.selectionDirection ?? 'none') as 'forward' | 'backward' | 'none',\n }\n }\n } catch {\n selection = null\n }\n }\n\n return {\n id: active.id || null,\n path,\n selection,\n }\n}\n\nfunction restoreFocus(root: ParentNode, snap: FocusSnapshot): void {\n const target = locate(root, snap.id, snap.path)\n if (!target || !(target instanceof HTMLElement)) return\n try {\n target.focus({ preventScroll: true })\n } catch {\n return\n }\n if (\n snap.selection &&\n (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement)\n ) {\n try {\n target.setSelectionRange(snap.selection.start, snap.selection.end, snap.selection.direction)\n } catch {\n // Some input types throw on setSelectionRange; ignore.\n }\n }\n}\n\nfunction captureScroll(root: ParentNode): ScrollSnapshot {\n // Walk the subtree and snapshot every element with non-zero\n // scroll. Most subtrees have at most a handful, so the per-edit\n // cost is small. Capturing all-zeroes wastes the restore work for\n // no benefit; the filter keeps things tight.\n const out: ScrollSnapshot = []\n const walk = (node: Node): void => {\n if (node instanceof HTMLElement) {\n if (node.scrollTop !== 0 || node.scrollLeft !== 0) {\n const path = pathFromAncestor(root as Node, node)\n if (path !== null) {\n out.push({\n id: node.id || null,\n path,\n scrollTop: node.scrollTop,\n scrollLeft: node.scrollLeft,\n })\n }\n }\n }\n for (let c = node.firstChild; c !== null; c = c.nextSibling) {\n walk(c)\n }\n }\n walk(root as Node)\n return out\n}\n\nfunction restoreScroll(root: ParentNode, snap: ScrollSnapshot): void {\n for (const s of snap) {\n const target = locate(root, s.id, s.path)\n if (!target || !(target instanceof HTMLElement)) continue\n target.scrollTop = s.scrollTop\n target.scrollLeft = s.scrollLeft\n }\n}\n\n/**\n * Compute the child-index path from `ancestor` down to `target`, or\n * `null` if `target` isn't in the subtree. The path is what gets\n * walked on restore — no document-wide selectors, no string-encoded\n * selectors that can break on punctuation in IDs.\n */\nfunction pathFromAncestor(ancestor: Node, target: Node): number[] | null {\n const path: number[] = []\n let cur: Node | null = target\n while (cur !== null && cur !== ancestor) {\n const parent: Node | null = cur.parentNode\n if (parent === null) return null\n let idx = 0\n let sib: Node | null = parent.firstChild\n while (sib !== null && sib !== cur) {\n idx++\n sib = sib.nextSibling\n }\n if (sib === null) return null\n path.push(idx)\n cur = parent\n }\n if (cur !== ancestor) return null\n return path.reverse()\n}\n\n/**\n * Restore lookup: try `id` first (cheap and resilient to structural\n * change), then walk the captured child-index path. Returns `null`\n * if neither lookup succeeds — the restore caller silently no-ops.\n */\nfunction locate(root: ParentNode, id: string | null, path: number[]): Element | null {\n if (id) {\n const doc = (root as Element).ownerDocument ?? globalThis.document\n if (doc) {\n const byId = doc.getElementById(id)\n if (byId && (root as ParentNode & Node).contains(byId)) return byId\n }\n }\n let cur: Node = root as Node\n for (const idx of path) {\n let child = cur.firstChild\n let i = 0\n while (child && i < idx) {\n child = child.nextSibling\n i++\n }\n if (!child) return null\n cur = child\n }\n return cur instanceof Element ? cur : null\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export type { ComponentDef, Send, Props, AppHandle, Lifetime, Binding, BindingKind, TransitionOptions, BranchOptions, ShowOptions, EachOptions, ItemAccessor, PortalOptions, ForeignOptions, ChildOptions, } from './types.js';
1
+ export type { ComponentDef, Send, Props, AppHandle, Lifetime, Binding, BindingKind, TransitionOptions, BranchOptions, ShowOptions, EachOptions, ItemAccessor, PortalOptions, ForeignOptions, } from './types.js';
2
2
  export { component } from './component.js';
3
3
  export { createView, type View } from './view-helpers.js';
4
+ export { combine, type SliceReducer, type SliceMap, type TopReducer } from './combine.js';
4
5
  export { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor, type MountOptions } from './mount.js';
5
6
  export type { BindingDescriptor } from './binding-descriptors.js';
6
7
  export { __registerScopeVariants } from './binding-descriptors.js';
@@ -12,13 +13,12 @@ export type { DisposerEvent } from './tracking/disposer-log.js';
12
13
  export type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js';
13
14
  export type { LifetimeNode } from './types.js';
14
15
  export { flush } from './runtime.js';
15
- export { addressOf } from './addressed.js';
16
16
  export { renderToString, renderNodes, serializeNodes } from './ssr.js';
17
17
  export { browserEnv, type DomEnv } from './dom-env.js';
18
18
  export { mergeHandlers } from './merge-handlers.js';
19
19
  export { createContext, provide, provideValue, useContext, useContextValue, type Context, } from './primitives/context.js';
20
20
  export { sliceHandler } from './slice-handler.js';
21
- export { childHandlers, type ChildState, type ChildMsg, type ModuleState, type ModuleMsg, } from './compose.js';
21
+ export { composeModules, type ModulesState, type ModulesMsg, type ModuleState, type ModuleMsg, } from './compose.js';
22
22
  export { text } from './primitives/text.js';
23
23
  export { unsafeHtml } from './primitives/unsafe-html.js';
24
24
  export { branch } from './primitives/branch.js';
@@ -30,7 +30,6 @@ export type { ScopeOptions } from './types.js';
30
30
  export { slice } from './primitives/slice.js';
31
31
  export { portal } from './primitives/portal.js';
32
32
  export { foreign } from './primitives/foreign.js';
33
- export { child } from './primitives/child.js';
34
33
  export { lazy, type LazyOptions } from './primitives/lazy.js';
35
34
  export type { LazyDef, AnyComponentDef } from './types.js';
36
35
  export { memo } from './primitives/memo.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAA;AAInB,O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,EACZ,WAAW,EACX,cAAc,EACd,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,EACL,aAAa,EACb,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,IAAI,QAAQ,EACjB,QAAQ,GACT,MAAM,mBAAmB,CAAA;AAI1B,OAAO,EACL,IAAI,EACJ,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAIrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,YAAY,EACZ,IAAI,EACJ,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAA;AAInB,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,EAA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ACb,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,IAAI,QAAQ,EACjB,QAAQ,GACT,MAAM,mBAAmB,CAAA;AAI1B,OAAO,EACL,IAAI,EACJ,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAIrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // ── Component ─────────────────────────────────────────────────────
3
3
  export { component } from './component.js';
4
4
  export { createView } from './view-helpers.js';
5
+ export { combine } from './combine.js';
5
6
  // ── Mount ─────────────────────────────────────────────────────────
6
7
  export { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor } from './mount.js';
7
8
  // Compiler-emitted runtime helper for the `*.connect(get, sendFn, …)`
@@ -16,13 +17,12 @@ export { __registerScopeVariants } from './binding-descriptors.js';
16
17
  export { tagSend } from './binding-descriptors.js';
17
18
  // ── Runtime ───────────────────────────────────────────────────────
18
19
  export { flush } from './runtime.js';
19
- export { addressOf } from './addressed.js';
20
20
  export { renderToString, renderNodes, serializeNodes } from './ssr.js';
21
21
  export { browserEnv } from './dom-env.js';
22
22
  export { mergeHandlers } from './merge-handlers.js';
23
23
  export { createContext, provide, provideValue, useContext, useContextValue, } from './primitives/context.js';
24
24
  export { sliceHandler } from './slice-handler.js';
25
- export { childHandlers, } from './compose.js';
25
+ export { composeModules, } from './compose.js';
26
26
  // ── View Primitives ───────────────────────────────────────────────
27
27
  export { text } from './primitives/text.js';
28
28
  export { unsafeHtml } from './primitives/unsafe-html.js';
@@ -34,7 +34,6 @@ export { scope } from './primitives/scope.js';
34
34
  export { slice } from './primitives/slice.js';
35
35
  export { portal } from './primitives/portal.js';
36
36
  export { foreign } from './primitives/foreign.js';
37
- export { child } from './primitives/child.js';
38
37
  export { lazy } from './primitives/lazy.js';
39
38
  export { memo } from './primitives/memo.js';
40
39
  export { sample } from './primitives/sample.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAoBrE,qEAAqE;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAA;AAEzD,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAA;AAEpG,sEAAsE;AACtE,qEAAqE;AACrE,0DAA0D;AAC1D,6DAA6D;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,iEAAiE;AACjE,iEAAiE;AACjE,iEAAiE;AACjE,8DAA8D;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAUlD,qEAAqE;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,WAAW,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EACZ,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,EACL,aAAa,EACb,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,IAAI,QAAQ,EACjB,QAAQ,GACT,MAAM,mBAAmB,CAAA;AAE1B,oEAAoE;AAEpE,OAAO,EACL,IAAI,EACJ,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,qEAAqE;AAErE,OAAO,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAA;AAErD,qEAAqE;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["// ── Types ─────────────────────────────────────────────────────────\n\nexport type {\n ComponentDef,\n Send,\n Props,\n AppHandle,\n Lifetime,\n Binding,\n BindingKind,\n TransitionOptions,\n BranchOptions,\n ShowOptions,\n EachOptions,\n ItemAccessor,\n PortalOptions,\n ForeignOptions,\n ChildOptions,\n} from './types.js'\n\n// ── Component ─────────────────────────────────────────────────────\n\nexport { component } from './component.js'\nexport { createView, type View } from './view-helpers.js'\n\n// ── Mount ─────────────────────────────────────────────────────────\n\nexport { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor, type MountOptions } from './mount.js'\nexport type { BindingDescriptor } from './binding-descriptors.js'\n// Compiler-emitted runtime helper for the `*.connect(get, sendFn, …)`\n// pattern. User code never imports this directly — the vite-plugin's\n// connect-pattern matcher inserts the import + call sites\n// automatically alongside the existing event-handler tagger.\nexport { __registerScopeVariants } from './binding-descriptors.js'\n// Library helper for `*.connect` implementations — tags returned\n// event handlers with the variants they dispatch, so the runtime\n// binding-descriptor registry surfaces them to the agent layer's\n// `list_actions`. Library authors call this once per onClick.\nexport { tagSend } from './binding-descriptors.js'\n// installDevTools is NOT re-exported here to keep it out of production bundles.\n// Import directly: import { installDevTools } from '@llui/dom/devtools'\nexport type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js'\nexport type { CoverageSnapshot } from './tracking/coverage.js'\nexport type { EachDiff } from './tracking/each-diff.js'\nexport type { DisposerEvent } from './tracking/disposer-log.js'\nexport type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js'\nexport type { LifetimeNode } from './types.js'\n\n// ── Runtime ───────────────────────────────────────────────────────\n\nexport { flush } from './runtime.js'\nexport { addressOf } from './addressed.js'\nexport { renderToString, renderNodes, serializeNodes } from './ssr.js'\nexport { browserEnv, type DomEnv } from './dom-env.js'\nexport { mergeHandlers } from './merge-handlers.js'\nexport {\n createContext,\n provide,\n provideValue,\n useContext,\n useContextValue,\n type Context,\n} from './primitives/context.js'\nexport { sliceHandler } from './slice-handler.js'\nexport {\n childHandlers,\n type ChildState,\n type ChildMsg,\n type ModuleState,\n type ModuleMsg,\n} from './compose.js'\n\n// ── View Primitives ───────────────────────────────────────────────\n\nexport { text } from './primitives/text.js'\nexport { unsafeHtml } from './primitives/unsafe-html.js'\nexport { branch } from './primitives/branch.js'\nexport { each } from './primitives/each.js'\nexport { virtualEach, type VirtualEachOptions } from './primitives/virtual-each.js'\nexport { show } from './primitives/show.js'\nexport { scope } from './primitives/scope.js'\nexport type { ScopeOptions } from './types.js'\nexport { slice } from './primitives/slice.js'\nexport { portal } from './primitives/portal.js'\nexport { foreign } from './primitives/foreign.js'\nexport { child } from './primitives/child.js'\nexport { lazy, type LazyOptions } from './primitives/lazy.js'\nexport type { LazyDef, AnyComponentDef } from './types.js'\nexport { memo } from './primitives/memo.js'\nexport { sample } from './primitives/sample.js'\nexport { selector } from './primitives/selector.js'\nexport { onMount } from './primitives/on-mount.js'\nexport { clientOnly, __clientOnlyStub, type ClientOnlyOptions } from './primitives/client-only.js'\nexport { errorBoundary } from './primitives/error-boundary.js'\n\n// ── Element Helpers ───────────────────────────────────────────────\n\nexport {\n a,\n abbr,\n article,\n aside,\n b,\n blockquote,\n br,\n button,\n canvas,\n code,\n dd,\n details,\n dialog,\n div,\n dl,\n dt,\n em,\n fieldset,\n figcaption,\n figure,\n footer,\n form,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n header,\n hr,\n i,\n iframe,\n img,\n input,\n label,\n legend,\n li,\n main,\n mark,\n nav,\n ol,\n optgroup,\n option,\n output,\n p,\n pre,\n progress,\n section,\n select,\n small,\n span,\n strong,\n sub,\n summary,\n sup,\n table,\n tbody,\n td,\n textarea,\n tfoot,\n th,\n thead,\n time,\n tr,\n ul,\n video,\n} from './elements.js'\n\n// ── SVG Elements ─────────────────────────────────────────────────\n\nexport {\n svg,\n g,\n defs,\n symbol,\n use,\n circle,\n ellipse,\n line,\n path,\n polygon,\n polyline,\n rect,\n text as svgText,\n tspan,\n textPath,\n clipPath,\n linearGradient,\n radialGradient,\n stop,\n mask,\n pattern,\n marker,\n filter,\n feBlend,\n feColorMatrix,\n feComponentTransfer,\n feComposite,\n feConvolveMatrix,\n feDiffuseLighting,\n feDisplacementMap,\n feDropShadow,\n feFlood,\n feGaussianBlur,\n feImage,\n feMerge,\n feMergeNode,\n feMorphology,\n feOffset,\n feSpecularLighting,\n feTile,\n feTurbulence,\n fePointLight,\n feSpotLight,\n feDistantLight,\n feFuncR,\n feFuncG,\n feFuncB,\n feFuncA,\n image,\n foreignObject,\n animate,\n animateMotion,\n animateTransform,\n set,\n mpath,\n desc,\n title as svgTitle,\n metadata,\n} from './svg-elements.js'\n\n// ── MathML Elements ──────────────────────────────────────────────\n\nexport {\n math,\n mi,\n mn,\n mo,\n ms,\n mtext,\n mrow,\n mfrac,\n msqrt,\n mroot,\n msup,\n msub,\n msubsup,\n munder,\n mover,\n munderover,\n mmultiscripts,\n mprescripts,\n mnone,\n mtable,\n mtr,\n mtd,\n mspace,\n mpadded,\n mphantom,\n menclose,\n merror,\n maction,\n semantics,\n annotation,\n annotationXml,\n} from './mathml-elements.js'\n\n// ── Form Utilities ────────────────────────────────────────────────\n\nexport { applyField, type FieldMsg } from './form.js'\n\n// ── Compiler Target ───────────────────────────────────────────────\n\nexport { elSplit } from './el-split.js'\nexport { elTemplate, __cloneStaticTemplate } from './el-template.js'\nexport { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAmBrE,qEAAqE;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAqD,MAAM,cAAc,CAAA;AAEzF,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAA;AAEpG,sEAAsE;AACtE,qEAAqE;AACrE,0DAA0D;AAC1D,6DAA6D;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,iEAAiE;AACjE,iEAAiE;AACjE,iEAAiE;AACjE,8DAA8D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EACN,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,cAAc,EACd,OAAO,EACP,OAAO,EACP,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,EACL,aAAa,EACb,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,IAAI,QAAQ,EACjB,QAAQ,GACT,MAAM,mBAAmB,CAAA;AAE1B,oEAAoE;AAEpE,OAAO,EACL,IAAI,EACJ,EAAE,EACF,EAAE,EACF,EAAE,EACF,EAAE,EACF,KAAK,EACL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,qEAAqE;AAErE,OAAO,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAA;AAErD,qEAAqE;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["// ── Types ─────────────────────────────────────────────────────────\n\nexport type {\n ComponentDef,\n Send,\n Props,\n AppHandle,\n Lifetime,\n Binding,\n BindingKind,\n TransitionOptions,\n BranchOptions,\n ShowOptions,\n EachOptions,\n ItemAccessor,\n PortalOptions,\n ForeignOptions,\n} from './types.js'\n\n// ── Component ─────────────────────────────────────────────────────\n\nexport { component } from './component.js'\nexport { createView, type View } from './view-helpers.js'\nexport { combine, type SliceReducer, type SliceMap, type TopReducer } from './combine.js'\n\n// ── Mount ─────────────────────────────────────────────────────────\n\nexport { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor, type MountOptions } from './mount.js'\nexport type { BindingDescriptor } from './binding-descriptors.js'\n// Compiler-emitted runtime helper for the `*.connect(get, sendFn, …)`\n// pattern. User code never imports this directly — the vite-plugin's\n// connect-pattern matcher inserts the import + call sites\n// automatically alongside the existing event-handler tagger.\nexport { __registerScopeVariants } from './binding-descriptors.js'\n// Library helper for `*.connect` implementations — tags returned\n// event handlers with the variants they dispatch, so the runtime\n// binding-descriptor registry surfaces them to the agent layer's\n// `list_actions`. Library authors call this once per onClick.\nexport { tagSend } from './binding-descriptors.js'\n// installDevTools is NOT re-exported here to keep it out of production bundles.\n// Import directly: import { installDevTools } from '@llui/dom/devtools'\nexport type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js'\nexport type { CoverageSnapshot } from './tracking/coverage.js'\nexport type { EachDiff } from './tracking/each-diff.js'\nexport type { DisposerEvent } from './tracking/disposer-log.js'\nexport type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js'\nexport type { LifetimeNode } from './types.js'\n\n// ── Runtime ───────────────────────────────────────────────────────\n\nexport { flush } from './runtime.js'\nexport { renderToString, renderNodes, serializeNodes } from './ssr.js'\nexport { browserEnv, type DomEnv } from './dom-env.js'\nexport { mergeHandlers } from './merge-handlers.js'\nexport {\n createContext,\n provide,\n provideValue,\n useContext,\n useContextValue,\n type Context,\n} from './primitives/context.js'\nexport { sliceHandler } from './slice-handler.js'\nexport {\n composeModules,\n type ModulesState,\n type ModulesMsg,\n type ModuleState,\n type ModuleMsg,\n} from './compose.js'\n\n// ── View Primitives ───────────────────────────────────────────────\n\nexport { text } from './primitives/text.js'\nexport { unsafeHtml } from './primitives/unsafe-html.js'\nexport { branch } from './primitives/branch.js'\nexport { each } from './primitives/each.js'\nexport { virtualEach, type VirtualEachOptions } from './primitives/virtual-each.js'\nexport { show } from './primitives/show.js'\nexport { scope } from './primitives/scope.js'\nexport type { ScopeOptions } from './types.js'\nexport { slice } from './primitives/slice.js'\nexport { portal } from './primitives/portal.js'\nexport { foreign } from './primitives/foreign.js'\nexport { lazy, type LazyOptions } from './primitives/lazy.js'\nexport type { LazyDef, AnyComponentDef } from './types.js'\nexport { memo } from './primitives/memo.js'\nexport { sample } from './primitives/sample.js'\nexport { selector } from './primitives/selector.js'\nexport { onMount } from './primitives/on-mount.js'\nexport { clientOnly, __clientOnlyStub, type ClientOnlyOptions } from './primitives/client-only.js'\nexport { errorBoundary } from './primitives/error-boundary.js'\n\n// ── Element Helpers ───────────────────────────────────────────────\n\nexport {\n a,\n abbr,\n article,\n aside,\n b,\n blockquote,\n br,\n button,\n canvas,\n code,\n dd,\n details,\n dialog,\n div,\n dl,\n dt,\n em,\n fieldset,\n figcaption,\n figure,\n footer,\n form,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n header,\n hr,\n i,\n iframe,\n img,\n input,\n label,\n legend,\n li,\n main,\n mark,\n nav,\n ol,\n optgroup,\n option,\n output,\n p,\n pre,\n progress,\n section,\n select,\n small,\n span,\n strong,\n sub,\n summary,\n sup,\n table,\n tbody,\n td,\n textarea,\n tfoot,\n th,\n thead,\n time,\n tr,\n ul,\n video,\n} from './elements.js'\n\n// ── SVG Elements ─────────────────────────────────────────────────\n\nexport {\n svg,\n g,\n defs,\n symbol,\n use,\n circle,\n ellipse,\n line,\n path,\n polygon,\n polyline,\n rect,\n text as svgText,\n tspan,\n textPath,\n clipPath,\n linearGradient,\n radialGradient,\n stop,\n mask,\n pattern,\n marker,\n filter,\n feBlend,\n feColorMatrix,\n feComponentTransfer,\n feComposite,\n feConvolveMatrix,\n feDiffuseLighting,\n feDisplacementMap,\n feDropShadow,\n feFlood,\n feGaussianBlur,\n feImage,\n feMerge,\n feMergeNode,\n feMorphology,\n feOffset,\n feSpecularLighting,\n feTile,\n feTurbulence,\n fePointLight,\n feSpotLight,\n feDistantLight,\n feFuncR,\n feFuncG,\n feFuncB,\n feFuncA,\n image,\n foreignObject,\n animate,\n animateMotion,\n animateTransform,\n set,\n mpath,\n desc,\n title as svgTitle,\n metadata,\n} from './svg-elements.js'\n\n// ── MathML Elements ──────────────────────────────────────────────\n\nexport {\n math,\n mi,\n mn,\n mo,\n ms,\n mtext,\n mrow,\n mfrac,\n msqrt,\n mroot,\n msup,\n msub,\n msubsup,\n munder,\n mover,\n munderover,\n mmultiscripts,\n mprescripts,\n mnone,\n mtable,\n mtr,\n mtd,\n mspace,\n mpadded,\n mphantom,\n menclose,\n merror,\n maction,\n semantics,\n annotation,\n annotationXml,\n} from './mathml-elements.js'\n\n// ── Form Utilities ────────────────────────────────────────────────\n\nexport { applyField, type FieldMsg } from './form.js'\n\n// ── Compiler Target ───────────────────────────────────────────────\n\nexport { elSplit } from './el-split.js'\nexport { elTemplate, __cloneStaticTemplate } from './el-template.js'\nexport { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAA;AAe1D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAC9D,IAAI,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC3B,IAAI,EAAE,CAuKR"}
1
+ {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAA;AAe1D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAC9D,IAAI,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC3B,IAAI,EAAE,CAwKR"}
@@ -30,6 +30,7 @@ export function branch(opts) {
30
30
  let currentNodes = [];
31
31
  const block = {
32
32
  mask: opts.__mask ?? FULL_MASK,
33
+ maskHi: opts.__maskHi ?? 0,
33
34
  reconcile(state) {
34
35
  const newKey = callOn(state);
35
36
  if (Object.is(newKey, currentKey))
@@ -1 +1 @@
1
- {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG9E,MAAM,UAAU,MAAM,CACpB,IAA4B;IAE5B,MAAM,GAAG,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACtC,MAAM,cAAc,GAAG,GAAG,CAAC,YAAY,CAAA;IACvC,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAA;IACnC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAwB,CAAA;IAEzC,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IAE9C,2E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M,EAAE,GAAG,YAAY,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import type { BranchOptions, Lifetime } from '../types.js'\nimport {\n getRenderContext,\n setRenderContext,\n clearRenderContext,\n enterAccessor,\n exitAccessor,\n} from '../render-context.js'\nimport { createLifetime, disposeLifetime, addDisposer } from '../lifetime.js'\nimport { setFlatBindings } from '../binding.js'\nimport { createView } from '../view-helpers.js'\nimport { FULL_MASK } from '../update-loop.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './on-mount.js'\nimport type { StructuralBlock } from '../structural.js'\n\nexport function branch<S, M = unknown, K extends string = string>(\n opts: BranchOptions<S, M, K>,\n): Node[] {\n const ctx = getRenderContext('branch')\n const parentLifetime = ctx.rootLifetime\n const blocks = ctx.structuralBlocks\n const send = ctx.send as (msg: M) => void\n\n const anchor = ctx.dom.createComment('branch')\n\n // `on` accessor wrapped so sample()/h.sample() called from inside throws a\n // targeted error. Both initial and reconcile paths route through callOn.\n // `Discriminant<S, K>` is `((s: S) => K) | (() => K)` — passing `state`\n // works for either arm at runtime (zero-arg ignores the extra), but a\n // typed wrapper forces a union-call inference TypeScript can't unify.\n // The runtime cast keeps the wrapper transparent.\n const callOn = (state: S) => {\n enterAccessor('branch().on')\n try {\n return (opts.on as (s: S) => K)(state)\n } finally {\n exitAccessor()\n }\n }\n\n let currentKey = callOn(ctx.state as S)\n let currentLifetime: Lifetime | null = null\n let currentNodes: Node[] = []\n\n const block: StructuralBlock = {\n mask: (opts as { __mask?: number }).__mask ?? FULL_MASK,\n reconcile(state: unknown) {\n const newKey = callOn(state as S)\n if (Object.is(newKey, currentKey)) return\n\n const parent = anchor.parentNode\n if (!parent) return\n\n const leavingNodes = currentNodes\n const leavingLifetime = currentLifetime\n\n // Build new arm first (before removing old — for FLIP animations)\n currentNodes = []\n currentLifetime = null\n currentKey = newKey\n\n const newCaseKey = String(newKey) as K\n const newBuilder = opts.cases?.[newCaseKey] ?? opts.default\n // Collect onMount callbacks from the new case into a local queue,\n // then flush them SYNCHRONOUSLY after the new nodes are inserted.\n // Without this, onMount inside a branch case would see stale DOM\n // (nodes not yet attached) OR fall back to queueMicrotask and\n // race with synchronous event dispatches after the reconcile.\n let onMountQueue: Array<() => void> | null = null\n if (newBuilder) {\n const mq = pushMountQueue()\n onMountQueue = mq.queue\n currentLifetime = createLifetime(parentLifetime)\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n setFlatBindings(ctx.allBindings)\n setRenderContext({ ...ctx, rootLifetime: currentLifetime, state })\n currentNodes = newBuilder(createView<S, M>(send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(mq.prev)\n\n const ref = anchor.nextSibling\n for (const node of currentNodes) {\n parent.insertBefore(node, ref)\n }\n }\n if (onMountQueue) flushMountQueue(onMountQueue)\n\n // Fire enter for new nodes\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n\n // Handle leave — may be deferred via Promise\n const removeOld = () => {\n for (const node of leavingNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (leavingLifetime) {\n // Tag BEFORE dispose so the disposer log records the cause.\n // `show()` passes `__disposalCause: 'show-hide'`; raw branch()\n // defaults to `'branch-swap'`. Tag wins over any pre-existing\n // value set by an inner primitive so the outermost cause is\n // reported (matches how humans describe the event).\n leavingLifetime.disposalCause = opts.__disposalCause ?? 'branch-swap'\n disposeLifetime(leavingLifetime)\n }\n }\n\n if (leavingNodes.length > 0 && opts.leave) {\n const result = opts.leave(leavingNodes)\n if (result && typeof (result as Promise<void>).then === 'function') {\n ;(result as Promise<void>).then(removeOld)\n } else {\n removeOld()\n }\n } else {\n removeOld()\n }\n },\n }\n\n // Register the block BEFORE running the initial builder so that parent\n // blocks always precede their nested children in the flat blocks array.\n // This guarantees correct Phase 1 iteration order: parents reconcile\n // first, so a parent that unmounts its old arm can dispose nested child\n // blocks (splicing them out of this array) without corrupting the loop\n // index — the splice only affects entries to the RIGHT of the parent.\n blocks.push(block)\n\n const caseKey = String(currentKey) as K\n const builder = opts.cases?.[caseKey] ?? opts.default\n // Initial-mount onMount callbacks are handled by the outer mountApp\n // queue — we're still inside the first view() call. branch doesn't\n // insert into the DOM at this point (the anchor + initial children\n // are returned to the parent), so we don't need to flush here.\n if (builder) {\n currentLifetime = createLifetime(parentLifetime)\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n setRenderContext({ ...ctx, rootLifetime: currentLifetime })\n currentNodes = builder(createView<S, M>(send))\n clearRenderContext()\n setRenderContext(ctx)\n\n // Fire enter on initial mount\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n }\n\n addDisposer(parentLifetime, () => {\n const idx = blocks.indexOf(block)\n if (idx !== -1) blocks.splice(idx, 1)\n // Remove arm DOM nodes + the anchor. The parent's own cleanup\n // (e.g. an outer branch's removeOld) only walks what its initial\n // render captured — nodes that THIS branch inserted into the\n // shared parent AFTER the outer's snapshot (including every\n // arm swap since initial mount) aren't in that list. Walking\n // `currentNodes` here and guarding with `parentNode` closes the\n // leak: if the parent DOM is already cascade-removed by an\n // ancestor, `node.parentNode` is null and the removeChild\n // no-ops. If the parent is still live (spread-into-arm case),\n // the removal is what cleans up the orphans.\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (anchor.parentNode) anchor.parentNode.removeChild(anchor)\n if (currentLifetime) {\n disposeLifetime(currentLifetime)\n currentLifetime = null\n }\n })\n\n return [anchor, ...currentNodes]\n}\n"]}
1
+ {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,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CAAA;QACjC,IAAI,GAAG,KAAK,CAAC,CAAC;YAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACrC,8DAA8D;QAC9D,iEAAiE;QACjE,6DAA6D;QAC7D,4DAA4D;QAC5D,6DAA6D;QAC7D,gEAAgE;QAChE,2DAA2D;QAC3D,0DAA0D;QAC1D,8DAA8D;QAC9D,6CAA6C;QAC7C,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;YAChC,IAAI,IAAI,CAAC,UAAU;gBAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;QACxD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU;YAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QAC5D,IAAI,eAAe,EAAE,CAAC;YACpB,eAAe,CAAC,eAAe,CAAC,CAAA;YAChC,eAAe,GAAG,IAAI,CAAA;QACxB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import type { BranchOptions, Lifetime } from '../types.js'\nimport {\n getRenderContext,\n setRenderContext,\n clearRenderContext,\n enterAccessor,\n exitAccessor,\n} from '../render-context.js'\nimport { createLifetime, disposeLifetime, addDisposer } from '../lifetime.js'\nimport { setFlatBindings } from '../binding.js'\nimport { createView } from '../view-helpers.js'\nimport { FULL_MASK } from '../update-loop.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './on-mount.js'\nimport type { StructuralBlock } from '../structural.js'\n\nexport function branch<S, M = unknown, K extends string = string>(\n opts: BranchOptions<S, M, K>,\n): Node[] {\n const ctx = getRenderContext('branch')\n const parentLifetime = ctx.rootLifetime\n const blocks = ctx.structuralBlocks\n const send = ctx.send as (msg: M) => void\n\n const anchor = ctx.dom.createComment('branch')\n\n // `on` accessor wrapped so sample()/h.sample() called from inside throws a\n // targeted error. Both initial and reconcile paths route through callOn.\n // `Discriminant<S, K>` is `((s: S) => K) | (() => K)` — passing `state`\n // works for either arm at runtime (zero-arg ignores the extra), but a\n // typed wrapper forces a union-call inference TypeScript can't unify.\n // The runtime cast keeps the wrapper transparent.\n const callOn = (state: S) => {\n enterAccessor('branch().on')\n try {\n return (opts.on as (s: S) => K)(state)\n } finally {\n exitAccessor()\n }\n }\n\n let currentKey = callOn(ctx.state as S)\n let currentLifetime: Lifetime | null = null\n let currentNodes: Node[] = []\n\n const block: StructuralBlock = {\n mask: (opts as { __mask?: number }).__mask ?? FULL_MASK,\n maskHi: (opts as { __maskHi?: number }).__maskHi ?? 0,\n reconcile(state: unknown) {\n const newKey = callOn(state as S)\n if (Object.is(newKey, currentKey)) return\n\n const parent = anchor.parentNode\n if (!parent) return\n\n const leavingNodes = currentNodes\n const leavingLifetime = currentLifetime\n\n // Build new arm first (before removing old — for FLIP animations)\n currentNodes = []\n currentLifetime = null\n currentKey = newKey\n\n const newCaseKey = String(newKey) as K\n const newBuilder = opts.cases?.[newCaseKey] ?? opts.default\n // Collect onMount callbacks from the new case into a local queue,\n // then flush them SYNCHRONOUSLY after the new nodes are inserted.\n // Without this, onMount inside a branch case would see stale DOM\n // (nodes not yet attached) OR fall back to queueMicrotask and\n // race with synchronous event dispatches after the reconcile.\n let onMountQueue: Array<() => void> | null = null\n if (newBuilder) {\n const mq = pushMountQueue()\n onMountQueue = mq.queue\n currentLifetime = createLifetime(parentLifetime)\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n setFlatBindings(ctx.allBindings)\n setRenderContext({ ...ctx, rootLifetime: currentLifetime, state })\n currentNodes = newBuilder(createView<S, M>(send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(mq.prev)\n\n const ref = anchor.nextSibling\n for (const node of currentNodes) {\n parent.insertBefore(node, ref)\n }\n }\n if (onMountQueue) flushMountQueue(onMountQueue)\n\n // Fire enter for new nodes\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n\n // Handle leave — may be deferred via Promise\n const removeOld = () => {\n for (const node of leavingNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (leavingLifetime) {\n // Tag BEFORE dispose so the disposer log records the cause.\n // `show()` passes `__disposalCause: 'show-hide'`; raw branch()\n // defaults to `'branch-swap'`. Tag wins over any pre-existing\n // value set by an inner primitive so the outermost cause is\n // reported (matches how humans describe the event).\n leavingLifetime.disposalCause = opts.__disposalCause ?? 'branch-swap'\n disposeLifetime(leavingLifetime)\n }\n }\n\n if (leavingNodes.length > 0 && opts.leave) {\n const result = opts.leave(leavingNodes)\n if (result && typeof (result as Promise<void>).then === 'function') {\n ;(result as Promise<void>).then(removeOld)\n } else {\n removeOld()\n }\n } else {\n removeOld()\n }\n },\n }\n\n // Register the block BEFORE running the initial builder so that parent\n // blocks always precede their nested children in the flat blocks array.\n // This guarantees correct Phase 1 iteration order: parents reconcile\n // first, so a parent that unmounts its old arm can dispose nested child\n // blocks (splicing them out of this array) without corrupting the loop\n // index — the splice only affects entries to the RIGHT of the parent.\n blocks.push(block)\n\n const caseKey = String(currentKey) as K\n const builder = opts.cases?.[caseKey] ?? opts.default\n // Initial-mount onMount callbacks are handled by the outer mountApp\n // queue — we're still inside the first view() call. branch doesn't\n // insert into the DOM at this point (the anchor + initial children\n // are returned to the parent), so we don't need to flush here.\n if (builder) {\n currentLifetime = createLifetime(parentLifetime)\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n setRenderContext({ ...ctx, rootLifetime: currentLifetime })\n currentNodes = builder(createView<S, M>(send))\n clearRenderContext()\n setRenderContext(ctx)\n\n // Fire enter on initial mount\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n }\n\n addDisposer(parentLifetime, () => {\n const idx = blocks.indexOf(block)\n if (idx !== -1) blocks.splice(idx, 1)\n // Remove arm DOM nodes + the anchor. The parent's own cleanup\n // (e.g. an outer branch's removeOld) only walks what its initial\n // render captured — nodes that THIS branch inserted into the\n // shared parent AFTER the outer's snapshot (including every\n // arm swap since initial mount) aren't in that list. Walking\n // `currentNodes` here and guarding with `parentNode` closes the\n // leak: if the parent DOM is already cascade-removed by an\n // ancestor, `node.parentNode` is null and the removeChild\n // no-ops. If the parent is still live (spread-into-arm case),\n // the removal is what cleans up the orphans.\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (anchor.parentNode) anchor.parentNode.removeChild(anchor)\n if (currentLifetime) {\n disposeLifetime(currentLifetime)\n currentLifetime = null\n }\n })\n\n return [anchor, ...currentNodes]\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"each.d.ts","sourceRoot":"","sources":["../../src/primitives/each.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAA;AA0BtE,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAEpD;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,GAAG,IAAI,CAEzE;AAwDD,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,CA4S1E"}
1
+ {"version":3,"file":"each.d.ts","sourceRoot":"","sources":["../../src/primitives/each.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAA0B,MAAM,aAAa,CAAA;AA0BtE,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,IAAI,CAEpD;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,GAAG,IAAI,CAEzE;AAwDD,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,CA6S1E"}
@@ -135,6 +135,7 @@ export function each(opts) {
135
135
  };
136
136
  const block = {
137
137
  mask: opts.__mask ?? FULL_MASK,
138
+ maskHi: opts.__maskHi ?? 0,
138
139
  reconcile(state) {
139
140
  const parent = anchor.parentNode;
140
141
  if (!parent)