@llui/dom 0.1.0 → 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.
package/dist/compose.d.ts CHANGED
@@ -1,27 +1,33 @@
1
1
  /**
2
- * Type-level utilities + runtime helper for composing multiple child
3
- * component modules into a parent's State and Msg types.
2
+ * Type-level utilities + runtime helper for composing multiple sub-module
3
+ * reducers into a parent's State and Msg types.
4
4
  *
5
5
  * Eliminates the manual State/Msg union declarations for each embedded
6
- * sub-component. The developer declares the children map once, and
7
- * `ChildState` / `ChildMsg` derive the wrapper types.
6
+ * module. The developer declares the modules map once, and
7
+ * `ModulesState` / `ModulesMsg` derive the wrapper types.
8
8
  *
9
9
  * ```ts
10
- * import type { ChildState, ChildMsg } from '@llui/dom'
11
- * import { childHandlers } from '@llui/dom'
10
+ * import type { ModulesState, ModulesMsg } from '@llui/dom'
11
+ * import { composeModules } from '@llui/dom'
12
12
  * import { dialog } from '@llui/components/dialog'
13
13
  * import { sortable } from '@llui/components/sortable'
14
14
  *
15
- * const children = { dialog, sort: sortable } as const
15
+ * const modules = { dialog, sort: sortable } as const
16
16
  *
17
- * type State = ChildState<typeof children> & { items: string[] }
18
- * type Msg = ChildMsg<typeof children> | { type: 'addItem'; text: string }
17
+ * type State = ModulesState<typeof modules> & { items: string[] }
18
+ * type Msg = ModulesMsg<typeof modules> | { type: 'addItem'; text: string }
19
19
  *
20
20
  * const update = mergeHandlers<State, Msg, never>(
21
- * childHandlers(children),
21
+ * composeModules(modules),
22
22
  * appUpdate,
23
23
  * )
24
24
  * ```
25
+ *
26
+ * Pairs with `mergeHandlers` (this stack) when embedded modules emit
27
+ * bare messages — typically components from `@llui/components` or
28
+ * third-party packages whose `update` shape you don't control. When you
29
+ * own the slice's message shape, prefer `combine()` with slash-routing
30
+ * (`{type: 'slice/action'}`) instead.
25
31
  */
26
32
  /**
27
33
  * Extract the state type from a component module's update function.
@@ -37,29 +43,29 @@ export type ModuleMsg<T> = T extends {
37
43
  update: (state: infer _S, msg: infer M) => [infer _S2, infer _E];
38
44
  } ? M : never;
39
45
  /**
40
- * Given a record of component modules, derive the combined child state.
46
+ * Given a record of component modules, derive the combined sub-state.
41
47
  * Each key maps to its module's state type.
42
48
  *
43
49
  * ```ts
44
- * const children = { dialog, sort: sortable } as const
45
- * type CS = ChildState<typeof children>
50
+ * const modules = { dialog, sort: sortable } as const
51
+ * type S = ModulesState<typeof modules>
46
52
  * // → { dialog: DialogState; sort: SortableState }
47
53
  * ```
48
54
  */
49
- export type ChildState<T extends Record<string, unknown>> = {
55
+ export type ModulesState<T extends Record<string, unknown>> = {
50
56
  [K in keyof T]: ModuleState<T[K]>;
51
57
  };
52
58
  /**
53
- * Given a record of component modules, derive the combined child message
59
+ * Given a record of component modules, derive the combined message
54
60
  * union. Each module's messages are wrapped in `{ type: key; msg: SubMsg }`.
55
61
  *
56
62
  * ```ts
57
- * const children = { dialog, sort: sortable } as const
58
- * type CM = ChildMsg<typeof children>
63
+ * const modules = { dialog, sort: sortable } as const
64
+ * type M = ModulesMsg<typeof modules>
59
65
  * // → { type: 'dialog'; msg: DialogMsg } | { type: 'sort'; msg: SortableMsg }
60
66
  * ```
61
67
  */
62
- export type ChildMsg<T extends Record<string, unknown>> = {
68
+ export type ModulesMsg<T extends Record<string, unknown>> = {
63
69
  [K in keyof T]: {
64
70
  type: K;
65
71
  msg: ModuleMsg<T[K]>;
@@ -67,12 +73,12 @@ export type ChildMsg<T extends Record<string, unknown>> = {
67
73
  }[keyof T];
68
74
  /**
69
75
  * Create a merged handler from a map of component modules. Each module's
70
- * update is wired via `sliceHandler(key, module.update)` convention:
71
- * state[key] holds the sub-state, messages match `{ type: key; msg: SubMsg }`.
76
+ * update is wired via the convention: state[key] holds the sub-state,
77
+ * messages match `{ type: key; msg: SubMsg }`.
72
78
  *
73
79
  * Returns a handler compatible with `mergeHandlers`.
74
80
  */
75
- export declare function childHandlers<S, M, E>(modules: Record<string, {
81
+ export declare function composeModules<S, M, E>(modules: Record<string, {
76
82
  update: (state: never, msg: never) => [unknown, unknown[]];
77
83
  }>): (state: S, msg: M) => [S, E[]] | null;
78
84
  //# sourceMappingURL=compose.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS;IACrC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;CACjE,GACG,CAAC,GACD,KAAK,CAAA;AAET;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS;IACnC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;CACjE,GACG,CAAC,GACD,KAAK,CAAA;AAET;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACzD,CAAC,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACvD,CAAC,IAAI,MAAM,CAAC,GAAG;QAAE,IAAI,EAAE,CAAC,CAAC;QAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE;CAClD,CAAC,MAAM,CAAC,CAAC,CAAA;AAEV;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,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I,EAAE,CAAC,CAAC;QAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE;CAClD,CAAC,MAAM,CAAC,CAAC,CAAA;AAEV;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;CAAE,CAAC,GACtF,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,CAWvC"}
package/dist/compose.js CHANGED
@@ -1,36 +1,42 @@
1
1
  /**
2
- * Type-level utilities + runtime helper for composing multiple child
3
- * component modules into a parent's State and Msg types.
2
+ * Type-level utilities + runtime helper for composing multiple sub-module
3
+ * reducers into a parent's State and Msg types.
4
4
  *
5
5
  * Eliminates the manual State/Msg union declarations for each embedded
6
- * sub-component. The developer declares the children map once, and
7
- * `ChildState` / `ChildMsg` derive the wrapper types.
6
+ * module. The developer declares the modules map once, and
7
+ * `ModulesState` / `ModulesMsg` derive the wrapper types.
8
8
  *
9
9
  * ```ts
10
- * import type { ChildState, ChildMsg } from '@llui/dom'
11
- * import { childHandlers } from '@llui/dom'
10
+ * import type { ModulesState, ModulesMsg } from '@llui/dom'
11
+ * import { composeModules } from '@llui/dom'
12
12
  * import { dialog } from '@llui/components/dialog'
13
13
  * import { sortable } from '@llui/components/sortable'
14
14
  *
15
- * const children = { dialog, sort: sortable } as const
15
+ * const modules = { dialog, sort: sortable } as const
16
16
  *
17
- * type State = ChildState<typeof children> & { items: string[] }
18
- * type Msg = ChildMsg<typeof children> | { type: 'addItem'; text: string }
17
+ * type State = ModulesState<typeof modules> & { items: string[] }
18
+ * type Msg = ModulesMsg<typeof modules> | { type: 'addItem'; text: string }
19
19
  *
20
20
  * const update = mergeHandlers<State, Msg, never>(
21
- * childHandlers(children),
21
+ * composeModules(modules),
22
22
  * appUpdate,
23
23
  * )
24
24
  * ```
25
+ *
26
+ * Pairs with `mergeHandlers` (this stack) when embedded modules emit
27
+ * bare messages — typically components from `@llui/components` or
28
+ * third-party packages whose `update` shape you don't control. When you
29
+ * own the slice's message shape, prefer `combine()` with slash-routing
30
+ * (`{type: 'slice/action'}`) instead.
25
31
  */
26
32
  /**
27
33
  * Create a merged handler from a map of component modules. Each module's
28
- * update is wired via `sliceHandler(key, module.update)` convention:
29
- * state[key] holds the sub-state, messages match `{ type: key; msg: SubMsg }`.
34
+ * update is wired via the convention: state[key] holds the sub-state,
35
+ * messages match `{ type: key; msg: SubMsg }`.
30
36
  *
31
37
  * Returns a handler compatible with `mergeHandlers`.
32
38
  */
33
- export function childHandlers(modules) {
39
+ export function composeModules(modules) {
34
40
  const keys = Object.keys(modules);
35
41
  return (state, msg) => {
36
42
  const m = msg;
@@ -1 +1 @@
1
- {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAiDH;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAuF;IAEvF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACpB,MAAM,CAAC,GAAG,GAAsC,CAAA;QAChD,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;QACzC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QACvC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAE,CAAA;QAC5B,MAAM,KAAK,GAAI,KAAiC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QACxD,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAc,EAAE,CAAC,CAAC,GAAY,CAAC,CAAA;QACvE,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAO,EAAE,OAAc,CAAC,CAAA;IACjE,CAAC,CAAA;AACH,CAAC","sourcesContent":["/**\n * Type-level utilities + runtime helper for composing multiple child\n * component modules into a parent's State and Msg types.\n *\n * Eliminates the manual State/Msg union declarations for each embedded\n * sub-component. The developer declares the children map once, and\n * `ChildState` / `ChildMsg` derive the wrapper types.\n *\n * ```ts\n * import type { ChildState, ChildMsg } from '@llui/dom'\n * import { childHandlers } from '@llui/dom'\n * import { dialog } from '@llui/components/dialog'\n * import { sortable } from '@llui/components/sortable'\n *\n * const children = { dialog, sort: sortable } as const\n *\n * type State = ChildState<typeof children> & { items: string[] }\n * type Msg = ChildMsg<typeof children> | { type: 'addItem'; text: string }\n *\n * const update = mergeHandlers<State, Msg, never>(\n * childHandlers(children),\n * appUpdate,\n * )\n * ```\n */\n\n/**\n * Extract the state type from a component module's update function.\n * Works with both property and method syntax.\n */\nexport type ModuleState<T> = T extends {\n update: (state: infer S, msg: infer _M) => [infer _S2, infer _E]\n}\n ? S\n : never\n\n/**\n * Extract the message type from a component module's update function.\n */\nexport type ModuleMsg<T> = T extends {\n update: (state: infer _S, msg: infer M) => [infer _S2, infer _E]\n}\n ? M\n : never\n\n/**\n * Given a record of component modules, derive the combined child state.\n * Each key maps to its module's state type.\n *\n * ```ts\n * const children = { dialog, sort: sortable } as const\n * type CS = ChildState<typeof children>\n * // → { dialog: DialogState; sort: SortableState }\n * ```\n */\nexport type ChildState<T extends Record<string, unknown>> = {\n [K in keyof T]: ModuleState<T[K]>\n}\n\n/**\n * Given a record of component modules, derive the combined child message\n * union. Each module's messages are wrapped in `{ type: key; msg: SubMsg }`.\n *\n * ```ts\n * const children = { dialog, sort: sortable } as const\n * type CM = ChildMsg<typeof children>\n * // → { type: 'dialog'; msg: DialogMsg } | { type: 'sort'; msg: SortableMsg }\n * ```\n */\nexport type ChildMsg<T extends Record<string, unknown>> = {\n [K in keyof T]: { type: K; msg: ModuleMsg<T[K]> }\n}[keyof T]\n\n/**\n * Create a merged handler from a map of component modules. Each module's\n * update is wired via `sliceHandler(key, module.update)` convention:\n * state[key] holds the sub-state, messages match `{ type: key; msg: SubMsg }`.\n *\n * Returns a handler compatible with `mergeHandlers`.\n */\nexport function childHandlers<S, M, E>(\n modules: Record<string, { update: (state: never, msg: never) => [unknown, unknown[]] }>,\n): (state: S, msg: M) => [S, E[]] | null {\n const keys = Object.keys(modules)\n return (state, msg) => {\n const m = msg as { type: string; msg?: unknown }\n if (!m.type || !('msg' in m)) return null\n if (!keys.includes(m.type)) return null\n const mod = modules[m.type]!\n const slice = (state as Record<string, unknown>)[m.type]\n const [nextSlice, effects] = mod.update(slice as never, m.msg as never)\n return [{ ...state, [m.type]: nextSlice } as S, effects as E[]]\n }\n}\n"]}
1
+ {"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAiDH;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAuF;IAEvF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QACpB,MAAM,CAAC,GAAG,GAAsC,CAAA;QAChD,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;QACzC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAA;QACvC,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAE,CAAA;QAC5B,MAAM,KAAK,GAAI,KAAiC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QACxD,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,KAAc,EAAE,CAAC,CAAC,GAAY,CAAC,CAAA;QACvE,OAAO,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,SAAS,EAAO,EAAE,OAAc,CAAC,CAAA;IACjE,CAAC,CAAA;AACH,CAAC","sourcesContent":["/**\n * Type-level utilities + runtime helper for composing multiple sub-module\n * reducers into a parent's State and Msg types.\n *\n * Eliminates the manual State/Msg union declarations for each embedded\n * module. The developer declares the modules map once, and\n * `ModulesState` / `ModulesMsg` derive the wrapper types.\n *\n * ```ts\n * import type { ModulesState, ModulesMsg } from '@llui/dom'\n * import { composeModules } from '@llui/dom'\n * import { dialog } from '@llui/components/dialog'\n * import { sortable } from '@llui/components/sortable'\n *\n * const modules = { dialog, sort: sortable } as const\n *\n * type State = ModulesState<typeof modules> & { items: string[] }\n * type Msg = ModulesMsg<typeof modules> | { type: 'addItem'; text: string }\n *\n * const update = mergeHandlers<State, Msg, never>(\n * composeModules(modules),\n * appUpdate,\n * )\n * ```\n *\n * Pairs with `mergeHandlers` (this stack) when embedded modules emit\n * bare messages — typically components from `@llui/components` or\n * third-party packages whose `update` shape you don't control. When you\n * own the slice's message shape, prefer `combine()` with slash-routing\n * (`{type: 'slice/action'}`) instead.\n */\n\n/**\n * Extract the state type from a component module's update function.\n * Works with both property and method syntax.\n */\nexport type ModuleState<T> = T extends {\n update: (state: infer S, msg: infer _M) => [infer _S2, infer _E]\n}\n ? S\n : never\n\n/**\n * Extract the message type from a component module's update function.\n */\nexport type ModuleMsg<T> = T extends {\n update: (state: infer _S, msg: infer M) => [infer _S2, infer _E]\n}\n ? M\n : never\n\n/**\n * Given a record of component modules, derive the combined sub-state.\n * Each key maps to its module's state type.\n *\n * ```ts\n * const modules = { dialog, sort: sortable } as const\n * type S = ModulesState<typeof modules>\n * // → { dialog: DialogState; sort: SortableState }\n * ```\n */\nexport type ModulesState<T extends Record<string, unknown>> = {\n [K in keyof T]: ModuleState<T[K]>\n}\n\n/**\n * Given a record of component modules, derive the combined message\n * union. Each module's messages are wrapped in `{ type: key; msg: SubMsg }`.\n *\n * ```ts\n * const modules = { dialog, sort: sortable } as const\n * type M = ModulesMsg<typeof modules>\n * // → { type: 'dialog'; msg: DialogMsg } | { type: 'sort'; msg: SortableMsg }\n * ```\n */\nexport type ModulesMsg<T extends Record<string, unknown>> = {\n [K in keyof T]: { type: K; msg: ModuleMsg<T[K]> }\n}[keyof T]\n\n/**\n * Create a merged handler from a map of component modules. Each module's\n * update is wired via the convention: state[key] holds the sub-state,\n * messages match `{ type: key; msg: SubMsg }`.\n *\n * Returns a handler compatible with `mergeHandlers`.\n */\nexport function composeModules<S, M, E>(\n modules: Record<string, { update: (state: never, msg: never) => [unknown, unknown[]] }>,\n): (state: S, msg: M) => [S, E[]] | null {\n const keys = Object.keys(modules)\n return (state, msg) => {\n const m = msg as { type: string; msg?: unknown }\n if (!m.type || !('msg' in m)) return null\n if (!keys.includes(m.type)) return null\n const mod = modules[m.type]!\n const slice = (state as Record<string, unknown>)[m.type]\n const [nextSlice, effects] = mod.update(slice as never, m.msg as never)\n return [{ ...state, [m.type]: nextSlice } as S, effects as E[]]\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
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
4
  export { combine, type SliceReducer, type SliceMap, type TopReducer } from './combine.js';
@@ -18,7 +18,7 @@ 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';
@@ -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,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAA;AAIzF,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAA;AACpG,YAAY,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAKjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAKlE,OAAO,EAAE,OAAO,EAAE,MAAM,0BA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,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
@@ -22,7 +22,7 @@ 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';
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;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;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AA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AgB,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 ChildOptions,\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 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 { 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,iE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I,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,MAAM,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"]}
@@ -13,8 +13,8 @@
13
13
  * rows" recipe in the cookbook.
14
14
  *
15
15
  * **Don't use inside an accessor** (`each().key`, `each().items`,
16
- * `branch().on`, `show().when`, `scope().on`, `child().props`,
17
- * `foreign().props`, or a binding accessor like `text(s => …)`).
16
+ * `branch().on`, `show().when`, `scope().on`, `foreign().props`, or a
17
+ * binding accessor like `text(s => …)`).
18
18
  * Accessors must be pure functions of their parameter — the compiler's
19
19
  * mask analysis only sees reads of the parameter, so a `sample()` read
20
20
  * is invisible. The result is a hidden dependency that breaks
@@ -14,8 +14,8 @@ import { getRenderContext, currentAccessor } from '../render-context.js';
14
14
  * rows" recipe in the cookbook.
15
15
  *
16
16
  * **Don't use inside an accessor** (`each().key`, `each().items`,
17
- * `branch().on`, `show().when`, `scope().on`, `child().props`,
18
- * `foreign().props`, or a binding accessor like `text(s => …)`).
17
+ * `branch().on`, `show().when`, `scope().on`, `foreign().props`, or a
18
+ * binding accessor like `text(s => …)`).
19
19
  * Accessors must be pure functions of their parameter — the compiler's
20
20
  * mask analysis only sees reads of the parameter, so a `sample()` read
21
21
  * is invisible. The result is a hidden dependency that breaks
@@ -1 +1 @@
1
- {"version":3,"file":"sample.js","sourceRoot":"","sources":["../../src/primitives/sample.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,MAAM,UAAU,MAAM,CAAO,QAAqB;IAChD,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAA;IAClC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,kDAAkD,QAAQ,IAAI;YAC5D,uEAAuE;YACvE,yEAAyE;YACzE,yCAAyC;YACzC,uEAAuE;YACvE,mEAAmE;YACnE,gBAAgB;YAChB,YAAY;YACZ,6BAA6B;YAC7B,0DAA0D;YAC1D,QAAQ;YACR,gBAAgB;YAChB,YAAY;YACZ,+DAA+D;YAC/D,8CAA8C;YAC9C,MAAM,CACT,CAAA;IACH,CAAC;IACD,MAAM,GAAG,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACtC,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAU,CAAC,CAAA;AACjC,CAAC","sourcesContent":["import { getRenderContext, currentAccessor } from '../render-context.js'\n\n/**\n * Read current state inside a render context and return the result of\n * `selector(state)`. No binding is created, no mask is assigned — this\n * is a one-shot imperative read at view-construction time.\n *\n * **Don't use for variable-length lists.** Wrapping a list-render in\n * `sample` looks idiomatic but silently breaks reactivity: the\n * `.map(...)` runs once at construction, captures the row objects in\n * closure, and never re-runs when state updates in place. The cells\n * inside the captured rows show stale data; only a full structural\n * rebuild (e.g. a parent `branch` swapping arms) will refresh them.\n * Use `each` + `ItemAccessor` instead — see the \"List of editable\n * rows\" recipe in the cookbook.\n *\n * **Don't use inside an accessor** (`each().key`, `each().items`,\n * `branch().on`, `show().when`, `scope().on`, `child().props`,\n * `foreign().props`, or a binding accessor like `text(s => …)`).\n * Accessors must be pure functions of their parameter — the compiler's\n * mask analysis only sees reads of the parameter, so a `sample()` read\n * is invisible. The result is a hidden dependency that breaks\n * reconciliation: structural blocks gate out updates that should fire,\n * binding accessors miss state changes, and `key` callbacks create\n * keys that don't track outer state correctly.\n *\n * To depend on outer state inside an accessor, **lift it into the\n * accessor's parameter**. For `each().key` reading a sibling field\n * `rev`:\n *\n * ```ts\n * // ❌ wrong — sample() in key is invisible to mask gating\n * each({\n * items: (s) => s.items,\n * key: (it) => `${it.id}|${sample(s => s.rev)}`,\n * render: …,\n * })\n *\n * // ✅ right — bake outer state into items, key is pure of T\n * each({\n * items: (s) => s.items.map((it) => ({ it, rev: s.rev })),\n * key: (r) => `${r.it.id}|${r.rev}`,\n * render: …,\n * })\n * ```\n *\n * **Use for** passing a state snapshot to an imperative renderer\n * (foreign libraries, third-party canvas/svg builders), reading a\n * value to compute a static piece of structure that doesn't need to\n * react, or any case where a reactive binding would be semantically\n * wrong (e.g. capturing a value at *this exact moment* for a\n * one-shot side effect).\n *\n * Also exposed as `h.sample` on the View bag for destructure-from-`h`\n * ergonomics. The top-level import form works everywhere a render\n * context is live — including `each.render`, whose bag intentionally\n * does not carry View methods.\n *\n * Throws if called outside a render context, or from inside an\n * accessor.\n */\nexport function sample<S, R>(selector: (s: S) => R): R {\n const accessor = currentAccessor()\n if (accessor !== null) {\n throw new Error(\n `[LLui] sample() must not be called from inside ${accessor}. ` +\n `Accessors must be pure functions of their parameter — sample() reads ` +\n `state outside the parameter, which is invisible to the compiler's mask ` +\n `analysis and breaks reconciliation.\\n\\n` +\n `To depend on outer state, lift it into the accessor's parameter. For ` +\n `each().key reading a sibling field, bake it into the items map:\\n` +\n ` // ❌ wrong\\n` +\n ` each({\\n` +\n ` items: (s) => s.rows,\\n` +\n ` key: (it) => \\`\\${it.id}|\\${sample(s => s.rev)}\\`,\\n` +\n ` })\\n` +\n ` // ✅ right\\n` +\n ` each({\\n` +\n ` items: (s) => s.rows.map((it) => ({ it, rev: s.rev })),\\n` +\n ` key: (r) => \\`\\${r.it.id}|\\${r.rev}\\`,\\n` +\n ` })`,\n )\n }\n const ctx = getRenderContext('sample')\n return selector(ctx.state as S)\n}\n"]}
1
+ {"version":3,"file":"sample.js","sourceRoot":"","sources":["../../src/primitives/sample.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,MAAM,UAAU,MAAM,CAAO,QAAqB;IAChD,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAA;IAClC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,kDAAkD,QAAQ,IAAI;YAC5D,uEAAuE;YACvE,yEAAyE;YACzE,yCAAyC;YACzC,uEAAuE;YACvE,mEAAmE;YACnE,gBAAgB;YAChB,YAAY;YACZ,6BAA6B;YAC7B,0DAA0D;YAC1D,QAAQ;YACR,gBAAgB;YAChB,YAAY;YACZ,+DAA+D;YAC/D,8CAA8C;YAC9C,MAAM,CACT,CAAA;IACH,CAAC;IACD,MAAM,GAAG,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACtC,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAU,CAAC,CAAA;AACjC,CAAC","sourcesContent":["import { getRenderContext, currentAccessor } from '../render-context.js'\n\n/**\n * Read current state inside a render context and return the result of\n * `selector(state)`. No binding is created, no mask is assigned — this\n * is a one-shot imperative read at view-construction time.\n *\n * **Don't use for variable-length lists.** Wrapping a list-render in\n * `sample` looks idiomatic but silently breaks reactivity: the\n * `.map(...)` runs once at construction, captures the row objects in\n * closure, and never re-runs when state updates in place. The cells\n * inside the captured rows show stale data; only a full structural\n * rebuild (e.g. a parent `branch` swapping arms) will refresh them.\n * Use `each` + `ItemAccessor` instead — see the \"List of editable\n * rows\" recipe in the cookbook.\n *\n * **Don't use inside an accessor** (`each().key`, `each().items`,\n * `branch().on`, `show().when`, `scope().on`, `foreign().props`, or a\n * binding accessor like `text(s => …)`).\n * Accessors must be pure functions of their parameter — the compiler's\n * mask analysis only sees reads of the parameter, so a `sample()` read\n * is invisible. The result is a hidden dependency that breaks\n * reconciliation: structural blocks gate out updates that should fire,\n * binding accessors miss state changes, and `key` callbacks create\n * keys that don't track outer state correctly.\n *\n * To depend on outer state inside an accessor, **lift it into the\n * accessor's parameter**. For `each().key` reading a sibling field\n * `rev`:\n *\n * ```ts\n * // ❌ wrong — sample() in key is invisible to mask gating\n * each({\n * items: (s) => s.items,\n * key: (it) => `${it.id}|${sample(s => s.rev)}`,\n * render: …,\n * })\n *\n * // ✅ right — bake outer state into items, key is pure of T\n * each({\n * items: (s) => s.items.map((it) => ({ it, rev: s.rev })),\n * key: (r) => `${r.it.id}|${r.rev}`,\n * render: …,\n * })\n * ```\n *\n * **Use for** passing a state snapshot to an imperative renderer\n * (foreign libraries, third-party canvas/svg builders), reading a\n * value to compute a static piece of structure that doesn't need to\n * react, or any case where a reactive binding would be semantically\n * wrong (e.g. capturing a value at *this exact moment* for a\n * one-shot side effect).\n *\n * Also exposed as `h.sample` on the View bag for destructure-from-`h`\n * ergonomics. The top-level import form works everywhere a render\n * context is live — including `each.render`, whose bag intentionally\n * does not carry View methods.\n *\n * Throws if called outside a render context, or from inside an\n * accessor.\n */\nexport function sample<S, R>(selector: (s: S) => R): R {\n const accessor = currentAccessor()\n if (accessor !== null) {\n throw new Error(\n `[LLui] sample() must not be called from inside ${accessor}. ` +\n `Accessors must be pure functions of their parameter — sample() reads ` +\n `state outside the parameter, which is invisible to the compiler's mask ` +\n `analysis and breaks reconciliation.\\n\\n` +\n `To depend on outer state, lift it into the accessor's parameter. For ` +\n `each().key reading a sibling field, bake it into the items map:\\n` +\n ` // ❌ wrong\\n` +\n ` each({\\n` +\n ` items: (s) => s.rows,\\n` +\n ` key: (it) => \\`\\${it.id}|\\${sample(s => s.rev)}\\`,\\n` +\n ` })\\n` +\n ` // ✅ right\\n` +\n ` each({\\n` +\n ` items: (s) => s.rows.map((it) => ({ it, rev: s.rev })),\\n` +\n ` key: (r) => \\`\\${r.it.id}|\\${r.rev}\\`,\\n` +\n ` })`,\n )\n }\n const ctx = getRenderContext('sample')\n return selector(ctx.state as S)\n}\n"]}
@@ -55,7 +55,7 @@ export function getRenderContext(primitiveName) {
55
55
  ` 3. Calling a primitive from a setTimeout / Promise / event handler — ` +
56
56
  `the render context only persists during the synchronous view() call.\n` +
57
57
  ` 4. Calling a primitive from a structural accessor (each().key, ` +
58
- `each().items, branch().on, show().when, child().props, …) or a ` +
58
+ `each().items, branch().on, show().when, scope().on, …) or a ` +
59
59
  `binding accessor (text(s => …), el({attr: s => …})) during reconcile — ` +
60
60
  `accessors run during the update phase with no render context. They must ` +
61
61
  `be pure functions of their parameter; reads outside the parameter break ` +
@@ -1 +1 @@
1
- {"version":3,"file":"render-context.js","sourceRoot":"","sources":["../src/render-context.ts"],"names":[],"mappings":"AA2BA,IAAI,cAAc,GAAyB,IAAI,CAAA;AAE/C,MAAM,UAAU,gBAAgB,CAAC,GAAkB;IACjD,cAAc,GAAG,GAAG,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,cAAc,GAAG,IAAI,CAAA;AACvB,CAAC;AAED,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,yDAAyD;AACzD,EAAE;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ACD,OAAO,cAAc,CAAA;AACvB,CAAC","sourcesContent":["import type { Lifetime, Binding } from './types.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport type { DomEnv } from './dom-env.js'\n\nexport interface RenderContext {\n rootLifetime: Lifetime\n state: unknown\n allBindings: Binding[]\n structuralBlocks: StructuralBlock[]\n container?: Element\n send?: (msg: unknown) => void\n /**\n * The DOM implementation backing this render pass. Seeded by\n * `mountApp` / `hydrateApp` / `renderToString` and threaded through\n * every nested primitive via context spread. Primitives construct\n * DOM through `ctx.dom.createElement(...)` etc. instead of reaching\n * for `globalThis.document`.\n */\n dom: DomEnv\n /** @internal dev-only — the owning ComponentInstance. Set by mount /\n * hydrate / child to let primitives (currently `each`) emit tracker\n * data to `inst._eachDiffLog`. Nested contexts pass through via\n * spread (e.g. `{ ...ctx, rootLifetime }`). Undefined outside dev. */\n instance?: ComponentInstance\n}\n\nlet currentContext: RenderContext | null = null\n\nexport function setRenderContext(ctx: RenderContext): void {\n currentContext = ctx\n}\n\nexport function clearRenderContext(): void {\n currentContext = null\n}\n\n// Accessor stack — tracks which structural-primitive or binding accessor is\n// currently executing. `sample()` reads the top of this stack to detect calls\n// from inside an accessor (forbidden — accessors must be pure functions of\n// their parameter, since their reads drive mask gating).\n//\n// Implemented as an array (rather than a counter) so the targeted error can\n// name the innermost accessor: \"inside each().key\" rather than just \"inside\n// an accessor\". Nested primitives push/pop in LIFO order; the top is the\n// site that called sample().\nconst accessorStack: string[] = []\n\nexport function enterAccessor(label: string): void {\n accessorStack.push(label)\n}\n\nexport function exitAccessor(): void {\n accessorStack.pop()\n}\n\nexport function currentAccessor(): string | null {\n const len = accessorStack.length\n return len > 0 ? accessorStack[len - 1]! : null\n}\n\nexport function getRenderContext(primitiveName?: string): RenderContext {\n if (!currentContext) {\n const name = primitiveName ? `${primitiveName}()` : 'primitives'\n // `sample()` is specifically the one users reach for from adapter\n // send wrappers / event handlers / async callbacks expecting it to\n // be \"imperative and safe.\" It isn't — it's a view-primitive that\n // reads the render-time state snapshot, and the context is cleared\n // as soon as view() returns. Point at the sanctioned escape hatch\n // in the thrown message so the caller doesn't have to dig.\n const sampleGuidance =\n primitiveName === 'sample'\n ? '\\n\\nFor the \"read state inside a callback / handler\" case: use ' +\n 'AppHandle.getState() instead. It is safe to call from anywhere ' +\n '(event handlers, adapter send wrappers, async callbacks, timers).\\n' +\n 'Example:\\n' +\n ' const handle = mountApp(root, App)\\n' +\n \" el.addEventListener('click', () => {\\n\" +\n ' const { count } = handle.getState() as AppState\\n' +\n \" if (count > 0) handle.send({ type: 'tick' })\\n\" +\n ' })'\n : ''\n throw new Error(\n `[LLui] ${name} can only be called inside a component's view() function. ` +\n `It was called outside a render context. Common causes:\\n` +\n ` 1. Calling a primitive at module scope instead of inside view().\\n` +\n ` 2. Calling an overlay helper (dialog.overlay, popover.overlay, …) at ` +\n `module scope — these internally use show()/branch() and must be invoked ` +\n `from inside the component's view callback so their result can be spread ` +\n `into the returned node tree.\\n` +\n ` 3. Calling a primitive from a setTimeout / Promise / event handler — ` +\n `the render context only persists during the synchronous view() call.\\n` +\n ` 4. Calling a primitive from a structural accessor (each().key, ` +\n `each().items, branch().on, show().when, child().props, …) or a ` +\n `binding accessor (text(s => …), el({attr: s => …})) during reconcile — ` +\n `accessors run during the update phase with no render context. They must ` +\n `be pure functions of their parameter; reads outside the parameter break ` +\n `mask gating.` +\n sampleGuidance,\n )\n }\n return currentContext\n}\n"]}
1
+ {"version":3,"file":"render-context.js","sourceRoot":"","sources":["../src/render-context.ts"],"names":[],"mappings":"AA2BA,IAAI,cAAc,GAAyB,IAAI,CAAA;AAE/C,MAAM,UAAU,gBAAgB,CAAC,GAAkB;IACjD,cAAc,GAAG,GAAG,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,cAAc,GAAG,IAAI,CAAA;AACvB,CAAC;AAED,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAC3E,yDAAyD;A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IACH,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC","sourcesContent":["import type { Lifetime, Binding } from './types.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport type { DomEnv } from './dom-env.js'\n\nexport interface RenderContext {\n rootLifetime: Lifetime\n state: unknown\n allBindings: Binding[]\n structuralBlocks: StructuralBlock[]\n container?: Element\n send?: (msg: unknown) => void\n /**\n * The DOM implementation backing this render pass. Seeded by\n * `mountApp` / `hydrateApp` / `renderToString` and threaded through\n * every nested primitive via context spread. Primitives construct\n * DOM through `ctx.dom.createElement(...)` etc. instead of reaching\n * for `globalThis.document`.\n */\n dom: DomEnv\n /** @internal dev-only — the owning ComponentInstance. Set by mount /\n * hydrate / child to let primitives (currently `each`) emit tracker\n * data to `inst._eachDiffLog`. Nested contexts pass through via\n * spread (e.g. `{ ...ctx, rootLifetime }`). Undefined outside dev. */\n instance?: ComponentInstance\n}\n\nlet currentContext: RenderContext | null = null\n\nexport function setRenderContext(ctx: RenderContext): void {\n currentContext = ctx\n}\n\nexport function clearRenderContext(): void {\n currentContext = null\n}\n\n// Accessor stack — tracks which structural-primitive or binding accessor is\n// currently executing. `sample()` reads the top of this stack to detect calls\n// from inside an accessor (forbidden — accessors must be pure functions of\n// their parameter, since their reads drive mask gating).\n//\n// Implemented as an array (rather than a counter) so the targeted error can\n// name the innermost accessor: \"inside each().key\" rather than just \"inside\n// an accessor\". Nested primitives push/pop in LIFO order; the top is the\n// site that called sample().\nconst accessorStack: string[] = []\n\nexport function enterAccessor(label: string): void {\n accessorStack.push(label)\n}\n\nexport function exitAccessor(): void {\n accessorStack.pop()\n}\n\nexport function currentAccessor(): string | null {\n const len = accessorStack.length\n return len > 0 ? accessorStack[len - 1]! : null\n}\n\nexport function getRenderContext(primitiveName?: string): RenderContext {\n if (!currentContext) {\n const name = primitiveName ? `${primitiveName}()` : 'primitives'\n // `sample()` is specifically the one users reach for from adapter\n // send wrappers / event handlers / async callbacks expecting it to\n // be \"imperative and safe.\" It isn't — it's a view-primitive that\n // reads the render-time state snapshot, and the context is cleared\n // as soon as view() returns. Point at the sanctioned escape hatch\n // in the thrown message so the caller doesn't have to dig.\n const sampleGuidance =\n primitiveName === 'sample'\n ? '\\n\\nFor the \"read state inside a callback / handler\" case: use ' +\n 'AppHandle.getState() instead. It is safe to call from anywhere ' +\n '(event handlers, adapter send wrappers, async callbacks, timers).\\n' +\n 'Example:\\n' +\n ' const handle = mountApp(root, App)\\n' +\n \" el.addEventListener('click', () => {\\n\" +\n ' const { count } = handle.getState() as AppState\\n' +\n \" if (count > 0) handle.send({ type: 'tick' })\\n\" +\n ' })'\n : ''\n throw new Error(\n `[LLui] ${name} can only be called inside a component's view() function. ` +\n `It was called outside a render context. Common causes:\\n` +\n ` 1. Calling a primitive at module scope instead of inside view().\\n` +\n ` 2. Calling an overlay helper (dialog.overlay, popover.overlay, …) at ` +\n `module scope — these internally use show()/branch() and must be invoked ` +\n `from inside the component's view callback so their result can be spread ` +\n `into the returned node tree.\\n` +\n ` 3. Calling a primitive from a setTimeout / Promise / event handler — ` +\n `the render context only persists during the synchronous view() call.\\n` +\n ` 4. Calling a primitive from a structural accessor (each().key, ` +\n `each().items, branch().on, show().when, scope().on, …) or a ` +\n `binding accessor (text(s => …), el({attr: s => …})) during reconcile — ` +\n `accessors run during the update phase with no render context. They must ` +\n `be pure functions of their parameter; reads outside the parameter break ` +\n `mask gating.` +\n sampleGuidance,\n )\n }\n return currentContext\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -33,15 +33,16 @@ export type Send<M> = (msg: M) => void;
33
33
  * Used by every API that accepts an opaque component definition at a
34
34
  * module boundary:
35
35
  *
36
- * - `child({ def })`
36
+ * - `subApp({ def })`
37
37
  * - `lazy({ loader })` — returns `LazyDef<D>` so the loader's `D` survives
38
38
  * - `createOnRenderClient({ Layout })` (from `@llui/vike`)
39
39
  * - `createOnRenderHtml({ Layout })` (from `@llui/vike`)
40
40
  *
41
- * The `D` parameter is `unknown` here — `child()` doesn't pass init
42
- * data through, and `Layout` callers pass route-supplied data whose
43
- * shape is unknown at the type-erased boundary. Use `LazyDef<D>` when
44
- * you need to preserve the init data shape (the lazy loader case).
41
+ * The `D` parameter is `unknown` here — the boundary doesn't carry init
42
+ * data through (`subApp` passes its own `data` separately, and `Layout`
43
+ * callers pass route-supplied data whose shape is unknown at the
44
+ * type-erased boundary). Use `LazyDef<D>` when you need to preserve the
45
+ * init data shape (the lazy loader case).
45
46
  */
46
47
  export interface AnyComponentDef {
47
48
  name: string;
@@ -500,11 +501,5 @@ export interface ForeignOptions<S, M, T extends Record<string, unknown>, Instanc
500
501
  attrs?: Record<string, string>;
501
502
  };
502
503
  }
503
- export interface ChildOptions<S, ChildM> {
504
- def: AnyComponentDef;
505
- key: string | number;
506
- props: (s: S) => Record<string, unknown>;
507
- onMsg?: (msg: ChildM) => unknown | null;
508
- }
509
504
  export {};
510
505
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAK7C,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,IAAI;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACtC,IAAI,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAAE,CAAA;IAC/B,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE;QAAE,MAAM,EAAE,CAAC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;;;;;;;;;;;;;OAaG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE;QAAE,SAAS,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;KAAE,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;IACvF,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IAClB,IAAI,EACA,CAAC,CAAC,GAAG,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,CAAC,GAAG,SAAS,CAAA;KAAE,KAAK,IAAI,CAAC,GACtE;SACG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE;YAAE,QAAQ,EAAE,QAAQ,CAAC;YAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;SAAE,KAAK,IAAI;KAC5F,CAAA;IACL,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAA;IACrC,SAAS,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAA;CAC7D"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,qEAAqE","sourcesContent":["// ── Component Definition ──────────────────────────────────────────\n\nimport type { View } from './view-helpers.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport type { DisposerEvent } from './tracking/disposer-log.js'\n\nexport interface ComponentDef<S, M, E = never, D = void> {\n name: string\n init: (data: D) => [S, E[]]\n update: (state: S, msg: M) => [S, E[]]\n view: (h: View<S, M>) => Node[]\n onEffect?: (ctx: { effect: E; send: Send<M>; signal: AbortSignal }) => void\n\n /**\n * @internal Compiler-injected — **path-keyed reactivity** prefix table.\n *\n * Each entry is a stable closure `(s: S) => unknown` that the compiler\n * hoists at module scope, one per distinct *minimal reference-stable\n * prefix* read across this component's accessors. The position of\n * each entry in this array IS its bit position: positions 0..30 map\n * to the low-word `mask`, positions 31..61 map to the high-word\n * `maskHi`. The runtime computes `combinedDirty` (and\n * `combinedDirtyHi` for >31-prefix components) by reference-comparing\n * `prefix(prev)` vs `prefix(next)` for each entry.\n *\n * Hand-authoring this is supported but unusual — `@llui/vite-plugin`\n * emits it automatically from accessor analysis. The previous\n * `__dirty` bitmask emission was removed; user-supplied `__dirty`\n * functions throw at mount.\n */\n __prefixes?: ReadonlyArray<(state: S) => unknown>\n /** @internal Compiler-injected */\n __renderToString?: (state: S) => string\n /** @internal Compiler-injected */\n __msgSchema?: object\n /** @internal Compiler-injected; keyed by Msg discriminant → annotations. See agent spec §5.1. */\n __msgAnnotations?: Record<\n string,\n {\n intent: string | null\n alwaysAffordable: boolean\n requiresConfirm: boolean\n humanOnly: boolean\n }\n >\n /** @internal Compiler-emitted; one entry per send() call site in view(). See agent spec §5.2. */\n __bindingDescriptors?: Array<{ variant: string }>\n /** @internal Compiler-injected; 32-char hex SHA-256 of schemas + annotations. See agent spec §12.3. */\n __schemaHash?: string\n /** @internal Compiler-injected — maps top-level state field → dirty-mask bit(s) */\n __maskLegend?: Record<string, number>\n /** @internal Compiler-injected — source-file location of the component() call */\n __componentMeta?: { file: string; line: number }\n /** @internal Compiler-injected — shape of the State type (for introspection) */\n __stateSchema?: object\n /** @internal Compiler-injected — Effect union schema (for introspection) */\n __effectSchema?: object\n /**\n * @internal Compiler-injected — replaces generic Phase 1 + Phase 2 loop.\n *\n * The trailing `dirtyHi` is the high-word dirty mask used by\n * 32..61-prefix components. Appended (not inserted) so old compiled\n * bundles emitted with a 5-param signature remain callable — the\n * runtime always passes 6 args; old bundles ignore the extra one\n * and ≤31-prefix components have `dirtyHi === 0` anyway.\n */\n __update?: (\n state: S,\n dirty: number,\n bindings: Binding[],\n blocks: StructuralBlock[],\n bindingsBeforePhase1: number,\n dirtyHi?: number,\n ) => void\n /** @internal Compiler-injected — per-message-type specialized handlers.\n * Bypass the entire processMessages pipeline for single-message updates. */\n __handlers?: Record<string, (inst: object, msg: unknown) => [S, E[]]>\n}\n\nexport type Send<M> = (msg: M) => void\n\n/**\n * Type-erased component definition for use at module boundaries where\n * the consumer's `S`, `M`, `E` are internal and invisible to the caller.\n *\n * Why this exists: `ComponentDef<S, M, E, D>` uses property syntax for\n * its callable fields (`init: (data: D) => ...`), and TypeScript\n * checks property syntax with strict (contravariant) variance. That's\n * the right call for user-facing type safety when authoring a\n * component (a narrower `Msg` type can't accidentally satisfy the\n * `update`'s param), but it means `ComponentDef<MyState, MyMsg, MyEffect, MyData>`\n * is NOT structurally assignable to `ComponentDef<unknown, unknown, unknown, unknown>`\n * — the `init: (data: MyData) => ...` field is contravariant in `MyData`,\n * so widening to `unknown` is rejected.\n *\n * `AnyComponentDef` (and `LazyDef<D>` below) declare the same fields\n * using **method syntax** (`init(data: D): ...`), which TypeScript\n * checks bivariantly. Concrete `ComponentDef<S, M, E, D>` assigns into\n * these structurally without any `widenDef` helper at the callsite.\n *\n * Used by every API that accepts an opaque component definition at a\n * module boundary:\n *\n * - `child({ def })`\n * - `lazy({ loader })` — returns `LazyDef<D>` so the loader's `D` survives\n * - `createOnRenderClient({ Layout })` (from `@llui/vike`)\n * - `createOnRenderHtml({ Layout })` (from `@llui/vike`)\n *\n * The `D` parameter is `unknown` here — `child()` doesn't pass init\n * data through, and `Layout` callers pass route-supplied data whose\n * shape is unknown at the type-erased boundary. Use `LazyDef<D>` when\n * you need to preserve the init data shape (the lazy loader case).\n */\nexport interface AnyComponentDef {\n name: string\n init(data: unknown): [unknown, unknown[]]\n update(state: unknown, msg: unknown): [unknown, unknown[]]\n view(h: unknown): Node[]\n onEffect?: unknown\n __dirty?: unknown\n __prefixes?: unknown\n __renderToString?: unknown\n __msgSchema?: unknown\n __msgAnnotations?: unknown\n __bindingDescriptors?: unknown\n __schemaHash?: unknown\n __maskLegend?: unknown\n __componentMeta?: unknown\n __stateSchema?: unknown\n __effectSchema?: unknown\n __update?: unknown\n __handlers?: unknown\n}\n\n/**\n * Type-erased component definition for use at module boundaries where the\n * loaded component's S, M, E are internal and invisible to the caller.\n * Only `D` (init data) survives because the caller provides it.\n *\n * `ComponentDef<S, M, E, D>` is structurally assignable to `LazyDef<D>`\n * for any S, M, E — `view: (h: unknown) => Node[]` accepts any View via\n * contravariance, and all other fields widen to `unknown` return types.\n *\n * Used by `lazy()` as the loader's return type. Use `AnyComponentDef`\n * (above) when D is also opaque — most other adapter-layer APIs.\n */\nexport interface LazyDef<D = void> {\n name: string\n // Method syntax — TypeScript checks methods bivariantly, so\n // ComponentDef<S, M, E, D>'s concrete (state: S, msg: M) => ...\n // assigns here even though S/M ≠ unknown. Property syntax would\n // be contravariant and reject the assignment.\n init(data: D): [unknown, unknown[]]\n update(state: unknown, msg: unknown): [unknown, unknown[]]\n view(h: unknown): Node[]\n onEffect?: unknown\n __dirty?: unknown\n __prefixes?: unknown\n __renderToString?: unknown\n __msgSchema?: unknown\n __msgAnnotations?: unknown\n __bindingDescriptors?: unknown\n __schemaHash?: unknown\n __maskLegend?: unknown\n __componentMeta?: unknown\n __stateSchema?: unknown\n __effectSchema?: unknown\n __update?: unknown\n __handlers?: unknown\n}\n\n/**\n * Maps a value shape to a reactive-props shape: every field becomes an accessor\n * `(s: S) => V`. Use for Level-1 view function signatures.\n *\n * ```ts\n * type ToolbarData = { tools: Tool[]; theme: 'light' | 'dark' }\n *\n * export function toolbar<S>(props: Props<ToolbarData, S>, send: Send<Msg>) {\n * return [div({ class: props.theme }, [each({ items: props.tools, ... })])]\n * }\n *\n * // Caller — TypeScript enforces per-field accessors; passing a raw value errors:\n * toolbar({ tools: (s: State) => s.tools, theme: (s) => s.theme }, send)\n * ```\n */\nexport type Props<T, S> = {\n [K in keyof T]: (s: S) => T[K]\n}\n\n// ── App Handle ────────────────────────────────────────────────────\n\nexport interface AppHandle {\n dispose(): void\n flush(): void\n /**\n * Dispatch a message into the mounted instance from outside its\n * normal view-bound `send` channel. Useful for adapter layers that\n * need to push updates into a long-lived instance — e.g.\n * `@llui/vike`'s persistent-layout chain pushes layout-data updates\n * into surviving layer instances on client navigation through the\n * user-supplied `onLayerDataChange` callback, which then calls\n * `handle.send(msg)` with the layout's chosen state-update message.\n *\n * Messages are queued through the same path as `view`-side `send`\n * calls — they batch into the next microtask and process via the\n * normal update loop. Calling `send` after `dispose` is a no-op.\n */\n send(msg: unknown): void\n /**\n * Read the current state snapshot. Safe to call from anywhere —\n * event handlers, async callbacks, adapter `send` wrappers, or any\n * imperative context where the render context is not live.\n *\n * Unlike `sample()` (a view primitive that requires an active\n * render context and throws outside of `view()`), `getState` is\n * the sanctioned escape hatch for \"I need to know the current\n * state to decide what to dispatch.\" Typical shape:\n *\n * ```ts\n * const handle = mountApp(root, MyApp)\n * container.addEventListener('drop', () => {\n * const { mode } = handle.getState() as AppState\n * if (mode === 'drag') handle.send({ type: 'commit' })\n * })\n * ```\n *\n * Throws after `dispose()` — stale reads are silent bugs; a thrown\n * error pinpoints the callsite that forgot to detach.\n *\n * The return type is `unknown` because `AppHandle` is state-type\n * erased at this boundary; cast to your app's state type at the\n * call site.\n */\n getState(): unknown\n /**\n * Register a listener called synchronously after every update cycle\n * completes. The listener receives the new state. Returns an\n * unsubscribe function. Safe after dispose (no-op; returns a no-op\n * unsubscribe). See agent spec §10.5 (state-update frames).\n */\n subscribe(listener: (state: unknown) => void): () => void\n /**\n * Snapshot the Msg variants currently dispatchable from rendered UI.\n * Each entry corresponds to one or more event-handler bindings the\n * compiler tagged with literal `send({type: '<variant>'})` calls;\n * the registry tracks live mounts via lifetime refcounts so the\n * snapshot reflects what the user can click *right now*, not the\n * static catalogue of every variant the app could ever accept.\n *\n * Used by `@llui/agent` to populate `list_actions`. Apps that don't\n * use the LLui compiler tagger pass (or whose views contain no\n * literal sends) get an empty array — agents fall back to the Msg\n * schema for affordance discovery.\n */\n getBindingDescriptors(): Array<{ variant: string }>\n /**\n * Hot-swap the component's `update` function (and optionally\n * `onEffect`) without rebuilding the DOM. Pending messages are\n * drained against the OLD `update` first so a half-applied\n * transition can't leave the state ill-formed; subsequent\n * dispatches go through the new function.\n *\n * This is the lightweight HMR escape hatch for cases where the\n * full `replaceComponent` flow (in `@llui/dom/hmr`) is overkill —\n * pure `update.ts` edits don't change the view, so disposing the\n * root lifetime and re-running the view just to install a new\n * function is wasteful and loses focus / scroll / transient DOM\n * state. Wire it via `import.meta.hot`:\n *\n * ```ts\n * // main.ts\n * const handle = mountApp(root, App)\n * if (import.meta.hot) {\n * import.meta.hot.accept('./app/update', (mod) => {\n * if (mod) handle.swapUpdate(mod.update)\n * })\n * }\n * ```\n *\n * Caveats:\n * - Doesn't compensate for State shape changes — if the new\n * `update` reads a field the old state doesn't have, you'll\n * see runtime errors. Hard-reload after structural state\n * changes.\n * - Doesn't swap `view` or compiler-emitted `__update`/`__dirty`\n * — for those, prefer the auto-injected component-level HMR\n * accept callback (which routes through `replaceComponent`).\n */\n swapUpdate(\n newUpdate: (state: unknown, msg: unknown) => [unknown, unknown[]],\n newOnEffect?: unknown,\n ): void\n /**\n * Run the reducer in isolation against the current state. Returns\n * `[newState, effects]` — the reducer's literal output without any\n * commit, flush, or effect-handler invocation. Used by the agent's\n * `would_dispatch` tool to predict what a candidate dispatch would\n * do before committing to it.\n *\n * Pure-reducer assumption: TEA mandates `update` be pure. LLui's\n * runtime treats it that way too (no speculative re-runs for any\n * other reason). Apps whose reducers branch on `Date.now()` or\n * read `localStorage` will see prediction drift from real dispatch\n * by exactly that amount of impurity — surface as documented at\n * the agent's call site, not silently corrected here.\n *\n * **No effects fire.** Effect descriptors are returned for the\n * agent to inspect; `onEffect` is not called. This is the entire\n * point of the API.\n */\n runReducer(msg: unknown): { state: unknown; effects: unknown[] } | null\n /**\n * Install a hook called whenever a binding's accessor throws during\n * the update cycle. The runtime catches the throw, leaves the\n * binding's `lastValue` unchanged (DOM stays at its previous value\n * rather than blanking), continues with sibling bindings, and\n * notifies this hook with `{kind, key?, message, stack?}`.\n *\n * Used by `@llui/agent` to fold binding-evaluation throws into the\n * dispatch envelope's `drain.errors` — so an LLM dispatching a Msg\n * that breaks scoring doesn't get HTTP 500 + a frozen UI; instead\n * the dispatch reports as `{status: 'dispatched', drain: {errors:\n * [...]}}` with the rest of the page rendering normally.\n *\n * Pass `null` to remove the hook. Without a hook, throws fall back\n * to `console.error` (dev mode) or `console.warn` (prod) so they\n * aren't silently swallowed.\n */\n setOnBindingError(\n hook: ((info: { kind: string; key?: string; message: string; stack?: string }) => void) | null,\n ): void\n}\n\n// ── Lifetime ─────────────────────────────────────────────────────────\n\nexport interface Lifetime {\n id: number\n parent: Lifetime | null\n children: Lifetime[]\n disposers: Array<() => void>\n bindings: Binding[]\n /** Per-item updaters — called directly by each() when item changes, bypassing Phase 2 */\n itemUpdaters: Array<() => void>\n /**\n * @internal dev-only back-reference to the owning ComponentInstance.\n * Populated on the root scope by `installDevTools` so `disposeLifetime`\n * can walk up the scope chain and emit DisposerEvents into the\n * instance's `_disposerLog`. Undefined in production.\n */\n instance?: ComponentInstance\n /**\n * @internal dev-only cause hint. Structural primitives (branch, each,\n * child, mountApp teardown) set this field immediately before calling\n * `disposeLifetime`; the dispose path reads it once to stamp the emitted\n * DisposerEvent. Left undefined, `disposeLifetime` falls back to\n * `'component-unmount'`. Undefined in production.\n */\n disposalCause?: DisposerEvent['cause']\n /** @internal dev-only — populated by structural primitives for scope-tree classification */\n _kind?: 'root' | 'show' | 'each' | 'branch' | 'scope' | 'child' | 'portal' | 'foreign'\n}\n\nexport interface LifetimeNode {\n scopeId: string\n kind: 'root' | 'show' | 'each' | 'branch' | 'scope' | 'child' | 'portal' | 'foreign'\n active: boolean\n children: LifetimeNode[]\n}\n\n// ── Binding ───────────────────────────────────────────────────────\n\n/**\n * Binding output kinds.\n *\n * `'text' | 'prop' | 'attr' | 'class' | 'style'` write their accessor's\n * return value to the DOM. `'effect'` is a side-effect-only watcher:\n * the accessor is invoked every Phase 2 tick its mask is hit, but its\n * return value is discarded and `applyBinding` is a no-op. Reserved\n * for primitives that need to fire a side-effect on each binding\n * evaluation without writing to the DOM.\n */\nexport type BindingKind = 'text' | 'prop' | 'attr' | 'class' | 'style' | 'effect'\n\nexport interface Binding {\n /**\n * Bits 0..30 of the binding's dirty mask. For components with ≤31\n * reactive prefixes this is the entire mask; for components with\n * 32..61 prefixes, the bits beyond 30 live in {@link maskHi}.\n */\n mask: number\n /**\n * Bits 31..61 of the binding's dirty mask, encoded with `1 <<\n * (pos - 31)`. Zero for ≤31-path components — the runtime gates\n * still AND against it, but `0 & dirtyHi` is always 0 so the gate\n * collapses to the single-word check. Compiler-emitted only when\n * the component actually reads paths past bit 30.\n */\n maskHi: number\n accessor: (state: unknown) => unknown\n lastValue: unknown\n kind: BindingKind\n node: Node\n key?: string\n ownerLifetime: Lifetime\n perItem: boolean\n dead: boolean\n}\n\n// ── Structural Primitives ─────────────────────────────────────────\n\nexport interface TransitionOptions {\n enter?: (nodes: Node[]) => void | Promise<void>\n leave?: (nodes: Node[]) => void | Promise<void>\n onTransition?: (ctx: { entering: Node[]; leaving: Node[]; parent: Node }) => void | Promise<void>\n}\n\ninterface BranchOptionsBase extends TransitionOptions {\n /**\n * @internal Set by `show()` / `scope()` sugar when delegating to\n * `branch()`, so the dev-only disposer log can report `'show-hide'` /\n * `'scope-rebuild'` instead of the default `'branch-swap'` for the\n * leaving arm. User code should not set this directly.\n */\n __disposalCause?: DisposerEvent['cause']\n /** @internal Compiler-injected mask of paths read by `on`. */\n __mask?: number\n}\n\n/**\n * Discriminant accessor — reads a string-keyed value either from the\n * current state (`(s) => …`) or from a closed-over item accessor /\n * memo (`() => item.kind()`). Both forms re-evaluate on every commit.\n * The zero-arg form is the canonical shape for branching on per-row\n * fields inside an `each.render` callback.\n */\ntype Discriminant<S, K extends string> = ((s: S) => K) | (() => K)\n\n/**\n * All cases covered by `cases` — no default allowed (would be dead code).\n */\ntype BranchOptionsExhaustive<S, M, K extends string> = BranchOptionsBase & {\n on: Discriminant<S, K>\n cases: { [P in K]: (h: View<S, M>) => Node[] }\n default?: never\n}\n\n/**\n * `cases` may cover some but not all keys; `default` handles the rest.\n */\ntype BranchOptionsNonExhaustive<S, M, K extends string> = BranchOptionsBase & {\n on: Discriminant<S, K>\n cases?: { [P in K]?: (h: View<S, M>) => Node[] }\n default: (h: View<S, M>) => Node[]\n}\n\n/**\n * `on` returns a wide `string` — exhaustiveness cannot be verified at\n * compile time (the key domain is infinite). Lenient: `default` is\n * optional so existing call sites that predate exhaustiveness typing\n * continue to compile. Authors who want the gate opt in by narrowing\n * `on`'s return type to a literal union.\n */\ntype BranchOptionsWide<S, M> = BranchOptionsBase & {\n on: Discriminant<S, string>\n cases?: Record<string, (h: View<S, M>) => Node[]>\n default?: (h: View<S, M>) => Node[]\n}\n\n/**\n * Options for `branch()`.\n *\n * When `on` returns a literal string union (e.g. `'idle' | 'loading'\n * | 'done'`), TypeScript enforces exhaustiveness: either every union\n * member has a case (and `default` is disallowed as unreachable), or\n * `default` is required to cover the remainder. When `on` returns a\n * wide `string`, `default` stays optional — exhaustiveness isn't\n * meaningful for an unbounded domain.\n *\n * `cases` is optional when `default` is present; `branch({ on, default })`\n * is the canonical dynamic-rebuild shape — `scope()` sugar wraps\n * exactly this form.\n */\nexport type BranchOptions<S, M = unknown, K extends string = string> = string extends K\n ? BranchOptionsWide<S, M>\n : BranchOptionsExhaustive<S, M, K> | BranchOptionsNonExhaustive<S, M, K>\n\nexport interface ShowOptions<S, M = unknown> extends TransitionOptions {\n /**\n * Predicate evaluated on every commit. `(s) => …` reads from\n * component state; `() => …` (zero-arg) reads from a closed-over\n * source — typically `item.field()` inside an `each.render`\n * callback. Both forms are reactive: the predicate runs against\n * each new state and the rendered subtree mounts/unmounts on the\n * boolean transition.\n */\n when: ((s: S) => boolean) | (() => boolean)\n render: (h: View<S, M>) => Node[]\n fallback?: (h: View<S, M>) => Node[]\n}\n\n/**\n * Options for `scope()` — rebuilds a subtree when `on(state)` changes.\n *\n * Sugar over `branch({ on, cases: {}, default: render, __disposalCause: 'scope-rebuild' })`.\n * Use when the key is dynamic (e.g. an epoch counter bumped from the\n * outside) and you want a fresh arm — fresh lifetime, fresh bindings —\n * each time it changes. Combine with `sample()` inside `render` for a\n * one-shot current-state read.\n */\nexport interface ScopeOptions<S, M = unknown> extends TransitionOptions {\n /**\n * Key accessor evaluated on every commit. `(s) => …` reads from\n * component state; `() => …` (zero-arg) reads from a closed-over\n * source. The render callback rebuilds whenever the returned key\n * changes — fresh lifetime, fresh bindings.\n */\n on: ((s: S) => string) | (() => string)\n render: (h: View<S, M>) => Node[]\n /** @internal Compiler-injected mask of paths read by `on`. */\n __mask?: number\n}\n\n/**\n * Options for `each()`. The inherited `enter` / `leave` callbacks fire **per item**:\n * `enter(nodes)` runs after an item's DOM is inserted (including initial mount);\n * `leave(nodes)` runs before an item's DOM is removed and may return a Promise\n * to hold the DOM until the animation resolves. Setting `leave` disables the\n * bulk-clear / full-replace fast paths.\n */\n/**\n * Per-item accessor. Two access forms:\n * - `item.field` — shorthand, returns accessor for `item.current[field]`\n * - `item(t => t.expr)` — computed expressions\n *\n * In both cases the returned value is a `() => V` accessor.\n * Invoke it (`item.field()`) to read the current value imperatively.\n */\nexport type ItemAccessor<T> = {\n <R>(selector: (t: T) => R): () => R\n} & {\n [K in keyof T]-?: () => T[K]\n} & {\n /**\n * Read the whole current item. Needed when T is a primitive (where the\n * field-map branch collapses to method names like `toString`) or when\n * you want to sample the entire record rather than a single field.\n *\n * Shadows any literal `current` field on T — if T has such a field,\n * use `item(r => r.current)` to disambiguate.\n */\n current(): T\n}\n\nexport interface EachOptions<S, T, M = unknown> extends TransitionOptions {\n items: (s: S) => T[]\n key: (item: T) => string | number\n render: (opts: {\n send: Send<M>\n item: ItemAccessor<T>\n /**\n * Plain (non-Proxy) accessor factory. Compiler-output path; avoid in user code\n * (use `item.field` / `item(fn)` — more ergonomic and bypasses Proxy when compiled).\n */\n acc: <R>(selector: (t: T) => R) => () => R\n index: () => number\n /**\n * The component's View bag (`h.text`, `h.show`, `h.branch`,\n * `h.scope`, `h.sample`, …). Each-render callers used to reach\n * for the top-level imports; the bag form is symmetric with how\n * `branch.cases[k]`, `show.render`, and `scope.render` receive it.\n * Both still work — destructure whichever is more convenient.\n */\n h: View<S, M>\n /** @internal Compiler-injected — entry reference for row factory */\n entry?: Record<string, unknown>\n }) => Node[]\n}\n\nexport interface PortalOptions {\n target: HTMLElement | string\n render: () => Node[]\n}\n\nexport interface ForeignOptions<S, M, T extends Record<string, unknown>, Instance> {\n /**\n * Construct the imperative instance. Can be async — return a\n * `Promise<Instance>` to defer construction until e.g. a dynamic\n * `import()` resolves. While the promise is pending:\n *\n * - The container element is in the DOM immediately (so layout\n * doesn't shift when the instance arrives).\n * - `sync` is NOT called. State changes are tracked by the\n * primitive and the latest props are applied as the initial\n * sync right after the promise resolves.\n * - If the owning scope disposes before the promise resolves,\n * `destroy(instance)` runs on resolution — no matter how long\n * the promise takes.\n */\n mount: (ctx: { container: HTMLElement; send: Send<M> }) => Instance | Promise<Instance>\n props: (s: S) => T\n sync:\n | ((ctx: { instance: Instance; props: T; prev: T | undefined }) => void)\n | {\n [K in keyof T]?: (ctx: { instance: Instance; value: T[K]; prev: T[K] | undefined }) => void\n }\n destroy: (instance: Instance) => void\n container?: { tag?: string; attrs?: Record<string, string> }\n}\n\nexport interface ChildOptions<S, ChildM> {\n // Type-erased via AnyComponentDef so callers can pass any concrete\n // ComponentDef<S, M, E, D> without a widening helper. The runtime\n // narrows the message shape via the user-supplied `onMsg` callback,\n // which keeps `ChildM` typed at this boundary even though the def\n // itself is opaque.\n def: AnyComponentDef\n key: string | number\n props: (s: S) => Record<string, unknown>\n onMsg?: (msg: ChildM) => unknown | null\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,qEAAqE","sourcesContent":["// ── Component Definition ──────────────────────────────────────────\n\nimport type { View } from './view-helpers.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport type { DisposerEvent } from './tracking/disposer-log.js'\n\nexport interface ComponentDef<S, M, E = never, D = void> {\n name: string\n init: (data: D) => [S, E[]]\n update: (state: S, msg: M) => [S, E[]]\n view: (h: View<S, M>) => Node[]\n onEffect?: (ctx: { effect: E; send: Send<M>; signal: AbortSignal }) => void\n\n /**\n * @internal Compiler-injected — **path-keyed reactivity** prefix table.\n *\n * Each entry is a stable closure `(s: S) => unknown` that the compiler\n * hoists at module scope, one per distinct *minimal reference-stable\n * prefix* read across this component's accessors. The position of\n * each entry in this array IS its bit position: positions 0..30 map\n * to the low-word `mask`, positions 31..61 map to the high-word\n * `maskHi`. The runtime computes `combinedDirty` (and\n * `combinedDirtyHi` for >31-prefix components) by reference-comparing\n * `prefix(prev)` vs `prefix(next)` for each entry.\n *\n * Hand-authoring this is supported but unusual — `@llui/vite-plugin`\n * emits it automatically from accessor analysis. The previous\n * `__dirty` bitmask emission was removed; user-supplied `__dirty`\n * functions throw at mount.\n */\n __prefixes?: ReadonlyArray<(state: S) => unknown>\n /** @internal Compiler-injected */\n __renderToString?: (state: S) => string\n /** @internal Compiler-injected */\n __msgSchema?: object\n /** @internal Compiler-injected; keyed by Msg discriminant → annotations. See agent spec §5.1. */\n __msgAnnotations?: Record<\n string,\n {\n intent: string | null\n alwaysAffordable: boolean\n requiresConfirm: boolean\n humanOnly: boolean\n }\n >\n /** @internal Compiler-emitted; one entry per send() call site in view(). See agent spec §5.2. */\n __bindingDescriptors?: Array<{ variant: string }>\n /** @internal Compiler-injected; 32-char hex SHA-256 of schemas + annotations. See agent spec §12.3. */\n __schemaHash?: string\n /** @internal Compiler-injected — maps top-level state field → dirty-mask bit(s) */\n __maskLegend?: Record<string, number>\n /** @internal Compiler-injected — source-file location of the component() call */\n __componentMeta?: { file: string; line: number }\n /** @internal Compiler-injected — shape of the State type (for introspection) */\n __stateSchema?: object\n /** @internal Compiler-injected — Effect union schema (for introspection) */\n __effectSchema?: object\n /**\n * @internal Compiler-injected — replaces generic Phase 1 + Phase 2 loop.\n *\n * The trailing `dirtyHi` is the high-word dirty mask used by\n * 32..61-prefix components. Appended (not inserted) so old compiled\n * bundles emitted with a 5-param signature remain callable — the\n * runtime always passes 6 args; old bundles ignore the extra one\n * and ≤31-prefix components have `dirtyHi === 0` anyway.\n */\n __update?: (\n state: S,\n dirty: number,\n bindings: Binding[],\n blocks: StructuralBlock[],\n bindingsBeforePhase1: number,\n dirtyHi?: number,\n ) => void\n /** @internal Compiler-injected — per-message-type specialized handlers.\n * Bypass the entire processMessages pipeline for single-message updates. */\n __handlers?: Record<string, (inst: object, msg: unknown) => [S, E[]]>\n}\n\nexport type Send<M> = (msg: M) => void\n\n/**\n * Type-erased component definition for use at module boundaries where\n * the consumer's `S`, `M`, `E` are internal and invisible to the caller.\n *\n * Why this exists: `ComponentDef<S, M, E, D>` uses property syntax for\n * its callable fields (`init: (data: D) => ...`), and TypeScript\n * checks property syntax with strict (contravariant) variance. That's\n * the right call for user-facing type safety when authoring a\n * component (a narrower `Msg` type can't accidentally satisfy the\n * `update`'s param), but it means `ComponentDef<MyState, MyMsg, MyEffect, MyData>`\n * is NOT structurally assignable to `ComponentDef<unknown, unknown, unknown, unknown>`\n * — the `init: (data: MyData) => ...` field is contravariant in `MyData`,\n * so widening to `unknown` is rejected.\n *\n * `AnyComponentDef` (and `LazyDef<D>` below) declare the same fields\n * using **method syntax** (`init(data: D): ...`), which TypeScript\n * checks bivariantly. Concrete `ComponentDef<S, M, E, D>` assigns into\n * these structurally without any `widenDef` helper at the callsite.\n *\n * Used by every API that accepts an opaque component definition at a\n * module boundary:\n *\n * - `subApp({ def })`\n * - `lazy({ loader })` — returns `LazyDef<D>` so the loader's `D` survives\n * - `createOnRenderClient({ Layout })` (from `@llui/vike`)\n * - `createOnRenderHtml({ Layout })` (from `@llui/vike`)\n *\n * The `D` parameter is `unknown` here — the boundary doesn't carry init\n * data through (`subApp` passes its own `data` separately, and `Layout`\n * callers pass route-supplied data whose shape is unknown at the\n * type-erased boundary). Use `LazyDef<D>` when you need to preserve the\n * init data shape (the lazy loader case).\n */\nexport interface AnyComponentDef {\n name: string\n init(data: unknown): [unknown, unknown[]]\n update(state: unknown, msg: unknown): [unknown, unknown[]]\n view(h: unknown): Node[]\n onEffect?: unknown\n __dirty?: unknown\n __prefixes?: unknown\n __renderToString?: unknown\n __msgSchema?: unknown\n __msgAnnotations?: unknown\n __bindingDescriptors?: unknown\n __schemaHash?: unknown\n __maskLegend?: unknown\n __componentMeta?: unknown\n __stateSchema?: unknown\n __effectSchema?: unknown\n __update?: unknown\n __handlers?: unknown\n}\n\n/**\n * Type-erased component definition for use at module boundaries where the\n * loaded component's S, M, E are internal and invisible to the caller.\n * Only `D` (init data) survives because the caller provides it.\n *\n * `ComponentDef<S, M, E, D>` is structurally assignable to `LazyDef<D>`\n * for any S, M, E — `view: (h: unknown) => Node[]` accepts any View via\n * contravariance, and all other fields widen to `unknown` return types.\n *\n * Used by `lazy()` as the loader's return type. Use `AnyComponentDef`\n * (above) when D is also opaque — most other adapter-layer APIs.\n */\nexport interface LazyDef<D = void> {\n name: string\n // Method syntax — TypeScript checks methods bivariantly, so\n // ComponentDef<S, M, E, D>'s concrete (state: S, msg: M) => ...\n // assigns here even though S/M ≠ unknown. Property syntax would\n // be contravariant and reject the assignment.\n init(data: D): [unknown, unknown[]]\n update(state: unknown, msg: unknown): [unknown, unknown[]]\n view(h: unknown): Node[]\n onEffect?: unknown\n __dirty?: unknown\n __prefixes?: unknown\n __renderToString?: unknown\n __msgSchema?: unknown\n __msgAnnotations?: unknown\n __bindingDescriptors?: unknown\n __schemaHash?: unknown\n __maskLegend?: unknown\n __componentMeta?: unknown\n __stateSchema?: unknown\n __effectSchema?: unknown\n __update?: unknown\n __handlers?: unknown\n}\n\n/**\n * Maps a value shape to a reactive-props shape: every field becomes an accessor\n * `(s: S) => V`. Use for Level-1 view function signatures.\n *\n * ```ts\n * type ToolbarData = { tools: Tool[]; theme: 'light' | 'dark' }\n *\n * export function toolbar<S>(props: Props<ToolbarData, S>, send: Send<Msg>) {\n * return [div({ class: props.theme }, [each({ items: props.tools, ... })])]\n * }\n *\n * // Caller — TypeScript enforces per-field accessors; passing a raw value errors:\n * toolbar({ tools: (s: State) => s.tools, theme: (s) => s.theme }, send)\n * ```\n */\nexport type Props<T, S> = {\n [K in keyof T]: (s: S) => T[K]\n}\n\n// ── App Handle ────────────────────────────────────────────────────\n\nexport interface AppHandle {\n dispose(): void\n flush(): void\n /**\n * Dispatch a message into the mounted instance from outside its\n * normal view-bound `send` channel. Useful for adapter layers that\n * need to push updates into a long-lived instance — e.g.\n * `@llui/vike`'s persistent-layout chain pushes layout-data updates\n * into surviving layer instances on client navigation through the\n * user-supplied `onLayerDataChange` callback, which then calls\n * `handle.send(msg)` with the layout's chosen state-update message.\n *\n * Messages are queued through the same path as `view`-side `send`\n * calls — they batch into the next microtask and process via the\n * normal update loop. Calling `send` after `dispose` is a no-op.\n */\n send(msg: unknown): void\n /**\n * Read the current state snapshot. Safe to call from anywhere —\n * event handlers, async callbacks, adapter `send` wrappers, or any\n * imperative context where the render context is not live.\n *\n * Unlike `sample()` (a view primitive that requires an active\n * render context and throws outside of `view()`), `getState` is\n * the sanctioned escape hatch for \"I need to know the current\n * state to decide what to dispatch.\" Typical shape:\n *\n * ```ts\n * const handle = mountApp(root, MyApp)\n * container.addEventListener('drop', () => {\n * const { mode } = handle.getState() as AppState\n * if (mode === 'drag') handle.send({ type: 'commit' })\n * })\n * ```\n *\n * Throws after `dispose()` — stale reads are silent bugs; a thrown\n * error pinpoints the callsite that forgot to detach.\n *\n * The return type is `unknown` because `AppHandle` is state-type\n * erased at this boundary; cast to your app's state type at the\n * call site.\n */\n getState(): unknown\n /**\n * Register a listener called synchronously after every update cycle\n * completes. The listener receives the new state. Returns an\n * unsubscribe function. Safe after dispose (no-op; returns a no-op\n * unsubscribe). See agent spec §10.5 (state-update frames).\n */\n subscribe(listener: (state: unknown) => void): () => void\n /**\n * Snapshot the Msg variants currently dispatchable from rendered UI.\n * Each entry corresponds to one or more event-handler bindings the\n * compiler tagged with literal `send({type: '<variant>'})` calls;\n * the registry tracks live mounts via lifetime refcounts so the\n * snapshot reflects what the user can click *right now*, not the\n * static catalogue of every variant the app could ever accept.\n *\n * Used by `@llui/agent` to populate `list_actions`. Apps that don't\n * use the LLui compiler tagger pass (or whose views contain no\n * literal sends) get an empty array — agents fall back to the Msg\n * schema for affordance discovery.\n */\n getBindingDescriptors(): Array<{ variant: string }>\n /**\n * Hot-swap the component's `update` function (and optionally\n * `onEffect`) without rebuilding the DOM. Pending messages are\n * drained against the OLD `update` first so a half-applied\n * transition can't leave the state ill-formed; subsequent\n * dispatches go through the new function.\n *\n * This is the lightweight HMR escape hatch for cases where the\n * full `replaceComponent` flow (in `@llui/dom/hmr`) is overkill —\n * pure `update.ts` edits don't change the view, so disposing the\n * root lifetime and re-running the view just to install a new\n * function is wasteful and loses focus / scroll / transient DOM\n * state. Wire it via `import.meta.hot`:\n *\n * ```ts\n * // main.ts\n * const handle = mountApp(root, App)\n * if (import.meta.hot) {\n * import.meta.hot.accept('./app/update', (mod) => {\n * if (mod) handle.swapUpdate(mod.update)\n * })\n * }\n * ```\n *\n * Caveats:\n * - Doesn't compensate for State shape changes — if the new\n * `update` reads a field the old state doesn't have, you'll\n * see runtime errors. Hard-reload after structural state\n * changes.\n * - Doesn't swap `view` or compiler-emitted `__update`/`__dirty`\n * — for those, prefer the auto-injected component-level HMR\n * accept callback (which routes through `replaceComponent`).\n */\n swapUpdate(\n newUpdate: (state: unknown, msg: unknown) => [unknown, unknown[]],\n newOnEffect?: unknown,\n ): void\n /**\n * Run the reducer in isolation against the current state. Returns\n * `[newState, effects]` — the reducer's literal output without any\n * commit, flush, or effect-handler invocation. Used by the agent's\n * `would_dispatch` tool to predict what a candidate dispatch would\n * do before committing to it.\n *\n * Pure-reducer assumption: TEA mandates `update` be pure. LLui's\n * runtime treats it that way too (no speculative re-runs for any\n * other reason). Apps whose reducers branch on `Date.now()` or\n * read `localStorage` will see prediction drift from real dispatch\n * by exactly that amount of impurity — surface as documented at\n * the agent's call site, not silently corrected here.\n *\n * **No effects fire.** Effect descriptors are returned for the\n * agent to inspect; `onEffect` is not called. This is the entire\n * point of the API.\n */\n runReducer(msg: unknown): { state: unknown; effects: unknown[] } | null\n /**\n * Install a hook called whenever a binding's accessor throws during\n * the update cycle. The runtime catches the throw, leaves the\n * binding's `lastValue` unchanged (DOM stays at its previous value\n * rather than blanking), continues with sibling bindings, and\n * notifies this hook with `{kind, key?, message, stack?}`.\n *\n * Used by `@llui/agent` to fold binding-evaluation throws into the\n * dispatch envelope's `drain.errors` — so an LLM dispatching a Msg\n * that breaks scoring doesn't get HTTP 500 + a frozen UI; instead\n * the dispatch reports as `{status: 'dispatched', drain: {errors:\n * [...]}}` with the rest of the page rendering normally.\n *\n * Pass `null` to remove the hook. Without a hook, throws fall back\n * to `console.error` (dev mode) or `console.warn` (prod) so they\n * aren't silently swallowed.\n */\n setOnBindingError(\n hook: ((info: { kind: string; key?: string; message: string; stack?: string }) => void) | null,\n ): void\n}\n\n// ── Lifetime ─────────────────────────────────────────────────────────\n\nexport interface Lifetime {\n id: number\n parent: Lifetime | null\n children: Lifetime[]\n disposers: Array<() => void>\n bindings: Binding[]\n /** Per-item updaters — called directly by each() when item changes, bypassing Phase 2 */\n itemUpdaters: Array<() => void>\n /**\n * @internal dev-only back-reference to the owning ComponentInstance.\n * Populated on the root scope by `installDevTools` so `disposeLifetime`\n * can walk up the scope chain and emit DisposerEvents into the\n * instance's `_disposerLog`. Undefined in production.\n */\n instance?: ComponentInstance\n /**\n * @internal dev-only cause hint. Structural primitives (branch, each,\n * child, mountApp teardown) set this field immediately before calling\n * `disposeLifetime`; the dispose path reads it once to stamp the emitted\n * DisposerEvent. Left undefined, `disposeLifetime` falls back to\n * `'component-unmount'`. Undefined in production.\n */\n disposalCause?: DisposerEvent['cause']\n /** @internal dev-only — populated by structural primitives for scope-tree classification */\n _kind?: 'root' | 'show' | 'each' | 'branch' | 'scope' | 'child' | 'portal' | 'foreign'\n}\n\nexport interface LifetimeNode {\n scopeId: string\n kind: 'root' | 'show' | 'each' | 'branch' | 'scope' | 'child' | 'portal' | 'foreign'\n active: boolean\n children: LifetimeNode[]\n}\n\n// ── Binding ───────────────────────────────────────────────────────\n\n/**\n * Binding output kinds.\n *\n * `'text' | 'prop' | 'attr' | 'class' | 'style'` write their accessor's\n * return value to the DOM. `'effect'` is a side-effect-only watcher:\n * the accessor is invoked every Phase 2 tick its mask is hit, but its\n * return value is discarded and `applyBinding` is a no-op. Reserved\n * for primitives that need to fire a side-effect on each binding\n * evaluation without writing to the DOM.\n */\nexport type BindingKind = 'text' | 'prop' | 'attr' | 'class' | 'style' | 'effect'\n\nexport interface Binding {\n /**\n * Bits 0..30 of the binding's dirty mask. For components with ≤31\n * reactive prefixes this is the entire mask; for components with\n * 32..61 prefixes, the bits beyond 30 live in {@link maskHi}.\n */\n mask: number\n /**\n * Bits 31..61 of the binding's dirty mask, encoded with `1 <<\n * (pos - 31)`. Zero for ≤31-path components — the runtime gates\n * still AND against it, but `0 & dirtyHi` is always 0 so the gate\n * collapses to the single-word check. Compiler-emitted only when\n * the component actually reads paths past bit 30.\n */\n maskHi: number\n accessor: (state: unknown) => unknown\n lastValue: unknown\n kind: BindingKind\n node: Node\n key?: string\n ownerLifetime: Lifetime\n perItem: boolean\n dead: boolean\n}\n\n// ── Structural Primitives ─────────────────────────────────────────\n\nexport interface TransitionOptions {\n enter?: (nodes: Node[]) => void | Promise<void>\n leave?: (nodes: Node[]) => void | Promise<void>\n onTransition?: (ctx: { entering: Node[]; leaving: Node[]; parent: Node }) => void | Promise<void>\n}\n\ninterface BranchOptionsBase extends TransitionOptions {\n /**\n * @internal Set by `show()` / `scope()` sugar when delegating to\n * `branch()`, so the dev-only disposer log can report `'show-hide'` /\n * `'scope-rebuild'` instead of the default `'branch-swap'` for the\n * leaving arm. User code should not set this directly.\n */\n __disposalCause?: DisposerEvent['cause']\n /** @internal Compiler-injected mask of paths read by `on`. */\n __mask?: number\n}\n\n/**\n * Discriminant accessor — reads a string-keyed value either from the\n * current state (`(s) => …`) or from a closed-over item accessor /\n * memo (`() => item.kind()`). Both forms re-evaluate on every commit.\n * The zero-arg form is the canonical shape for branching on per-row\n * fields inside an `each.render` callback.\n */\ntype Discriminant<S, K extends string> = ((s: S) => K) | (() => K)\n\n/**\n * All cases covered by `cases` — no default allowed (would be dead code).\n */\ntype BranchOptionsExhaustive<S, M, K extends string> = BranchOptionsBase & {\n on: Discriminant<S, K>\n cases: { [P in K]: (h: View<S, M>) => Node[] }\n default?: never\n}\n\n/**\n * `cases` may cover some but not all keys; `default` handles the rest.\n */\ntype BranchOptionsNonExhaustive<S, M, K extends string> = BranchOptionsBase & {\n on: Discriminant<S, K>\n cases?: { [P in K]?: (h: View<S, M>) => Node[] }\n default: (h: View<S, M>) => Node[]\n}\n\n/**\n * `on` returns a wide `string` — exhaustiveness cannot be verified at\n * compile time (the key domain is infinite). Lenient: `default` is\n * optional so existing call sites that predate exhaustiveness typing\n * continue to compile. Authors who want the gate opt in by narrowing\n * `on`'s return type to a literal union.\n */\ntype BranchOptionsWide<S, M> = BranchOptionsBase & {\n on: Discriminant<S, string>\n cases?: Record<string, (h: View<S, M>) => Node[]>\n default?: (h: View<S, M>) => Node[]\n}\n\n/**\n * Options for `branch()`.\n *\n * When `on` returns a literal string union (e.g. `'idle' | 'loading'\n * | 'done'`), TypeScript enforces exhaustiveness: either every union\n * member has a case (and `default` is disallowed as unreachable), or\n * `default` is required to cover the remainder. When `on` returns a\n * wide `string`, `default` stays optional — exhaustiveness isn't\n * meaningful for an unbounded domain.\n *\n * `cases` is optional when `default` is present; `branch({ on, default })`\n * is the canonical dynamic-rebuild shape — `scope()` sugar wraps\n * exactly this form.\n */\nexport type BranchOptions<S, M = unknown, K extends string = string> = string extends K\n ? BranchOptionsWide<S, M>\n : BranchOptionsExhaustive<S, M, K> | BranchOptionsNonExhaustive<S, M, K>\n\nexport interface ShowOptions<S, M = unknown> extends TransitionOptions {\n /**\n * Predicate evaluated on every commit. `(s) => …` reads from\n * component state; `() => …` (zero-arg) reads from a closed-over\n * source — typically `item.field()` inside an `each.render`\n * callback. Both forms are reactive: the predicate runs against\n * each new state and the rendered subtree mounts/unmounts on the\n * boolean transition.\n */\n when: ((s: S) => boolean) | (() => boolean)\n render: (h: View<S, M>) => Node[]\n fallback?: (h: View<S, M>) => Node[]\n}\n\n/**\n * Options for `scope()` — rebuilds a subtree when `on(state)` changes.\n *\n * Sugar over `branch({ on, cases: {}, default: render, __disposalCause: 'scope-rebuild' })`.\n * Use when the key is dynamic (e.g. an epoch counter bumped from the\n * outside) and you want a fresh arm — fresh lifetime, fresh bindings —\n * each time it changes. Combine with `sample()` inside `render` for a\n * one-shot current-state read.\n */\nexport interface ScopeOptions<S, M = unknown> extends TransitionOptions {\n /**\n * Key accessor evaluated on every commit. `(s) => …` reads from\n * component state; `() => …` (zero-arg) reads from a closed-over\n * source. The render callback rebuilds whenever the returned key\n * changes — fresh lifetime, fresh bindings.\n */\n on: ((s: S) => string) | (() => string)\n render: (h: View<S, M>) => Node[]\n /** @internal Compiler-injected mask of paths read by `on`. */\n __mask?: number\n}\n\n/**\n * Options for `each()`. The inherited `enter` / `leave` callbacks fire **per item**:\n * `enter(nodes)` runs after an item's DOM is inserted (including initial mount);\n * `leave(nodes)` runs before an item's DOM is removed and may return a Promise\n * to hold the DOM until the animation resolves. Setting `leave` disables the\n * bulk-clear / full-replace fast paths.\n */\n/**\n * Per-item accessor. Two access forms:\n * - `item.field` — shorthand, returns accessor for `item.current[field]`\n * - `item(t => t.expr)` — computed expressions\n *\n * In both cases the returned value is a `() => V` accessor.\n * Invoke it (`item.field()`) to read the current value imperatively.\n */\nexport type ItemAccessor<T> = {\n <R>(selector: (t: T) => R): () => R\n} & {\n [K in keyof T]-?: () => T[K]\n} & {\n /**\n * Read the whole current item. Needed when T is a primitive (where the\n * field-map branch collapses to method names like `toString`) or when\n * you want to sample the entire record rather than a single field.\n *\n * Shadows any literal `current` field on T — if T has such a field,\n * use `item(r => r.current)` to disambiguate.\n */\n current(): T\n}\n\nexport interface EachOptions<S, T, M = unknown> extends TransitionOptions {\n items: (s: S) => T[]\n key: (item: T) => string | number\n render: (opts: {\n send: Send<M>\n item: ItemAccessor<T>\n /**\n * Plain (non-Proxy) accessor factory. Compiler-output path; avoid in user code\n * (use `item.field` / `item(fn)` — more ergonomic and bypasses Proxy when compiled).\n */\n acc: <R>(selector: (t: T) => R) => () => R\n index: () => number\n /**\n * The component's View bag (`h.text`, `h.show`, `h.branch`,\n * `h.scope`, `h.sample`, …). Each-render callers used to reach\n * for the top-level imports; the bag form is symmetric with how\n * `branch.cases[k]`, `show.render`, and `scope.render` receive it.\n * Both still work — destructure whichever is more convenient.\n */\n h: View<S, M>\n /** @internal Compiler-injected — entry reference for row factory */\n entry?: Record<string, unknown>\n }) => Node[]\n}\n\nexport interface PortalOptions {\n target: HTMLElement | string\n render: () => Node[]\n}\n\nexport interface ForeignOptions<S, M, T extends Record<string, unknown>, Instance> {\n /**\n * Construct the imperative instance. Can be async — return a\n * `Promise<Instance>` to defer construction until e.g. a dynamic\n * `import()` resolves. While the promise is pending:\n *\n * - The container element is in the DOM immediately (so layout\n * doesn't shift when the instance arrives).\n * - `sync` is NOT called. State changes are tracked by the\n * primitive and the latest props are applied as the initial\n * sync right after the promise resolves.\n * - If the owning scope disposes before the promise resolves,\n * `destroy(instance)` runs on resolution — no matter how long\n * the promise takes.\n */\n mount: (ctx: { container: HTMLElement; send: Send<M> }) => Instance | Promise<Instance>\n props: (s: S) => T\n sync:\n | ((ctx: { instance: Instance; props: T; prev: T | undefined }) => void)\n | {\n [K in keyof T]?: (ctx: { instance: Instance; value: T[K]; prev: T[K] | undefined }) => void\n }\n destroy: (instance: Instance) => void\n container?: { tag?: string; attrs?: Record<string, string> }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"update-loop.js","sourceRoot":"","sources":["../src/update-loop.ts"],"names":[],"mappings":"AAKA,OAAO,EAAe,UAAU,EAAE,MAAM,cAAc,CAAA;AAEtD,oEAAoE;AACpE,sEAAsE;AACtE,mEAAmE;AACnE,IAAI,YAAY,GAAkB,IAAI,CAAA;AACtC,SAAS,kBAAkB;IACzB,IAAI,YAAY,KAAK,IAAI;QAAE,YAAY,GAAG,UAAU,EAAE,CAAA;IACtD,OAAO,YAAY,CAAA;AACrB,CAAC;AAMD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEjE,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,GAAG,CAAC,CAAA;AAEvC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAoD,EACpD,IAAa,EACb,IAAa;IAEb,IAAI,QAAQ,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;QAC1B,IAAI,KAAK,GAAG,CAAC,CAAA;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,IAAI,QAAQ,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC;gBAAE,KAAK,IAAI,CAAC,IAAI,CAAC,CAAA;QAChE,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IACD,kEAA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C,CAAA;QACvD,CAAC;QACD,QAAQ,CAAC,IAAI,CAAC;YACZ,QAAQ,EAAE,EAAE;YACZ,IAAI;YACJ,KAAK,EAAE,iBAAiB;YACxB,SAAS,EAAE,YAAY;YACvB,UAAU,EAAE,CAAC;SACd,CAAC,CAAA;QACF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAA;IACnF,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IACzF,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,WAAW;IAClB,MAAM,SAAS,GAAI,UAAyD,CAAC,MAAM,CAAA;IACnF,IAAI,SAAS,EAAE,UAAU;QAAE,OAAO,SAAS,CAAC,UAAU,EAAE,CAAA;IACxD,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAA;AACvE,CAAC","sourcesContent":["import type { ComponentDef, Lifetime, Binding } from './types.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { RingBuffer, EachDiff } from './tracking/each-diff.js'\nimport type { DisposerEvent } from './tracking/disposer-log.js'\nimport type { CoverageTracker } from './tracking/coverage.js'\nimport { type DomEnv, browserEnv } from './dom-env.js'\n\n// Single lazily-constructed browser env shared by every client-side\n// component instance. Falls through to globalThis at call time — safe\n// to construct on a server process (the lookups never fire there).\nlet _fallbackEnv: DomEnv | null = null\nfunction fallbackBrowserEnv(): DomEnv {\n if (_fallbackEnv === null) _fallbackEnv = browserEnv()\n return _fallbackEnv\n}\nimport type {\n EffectTimelineEntry,\n PendingEffectsList,\n MockRegistry,\n} from './tracking/effect-timeline.js'\nimport { createLifetime } from './lifetime.js'\nimport { applyBinding } from './binding.js'\nimport { setCurrentDirtyMask } from './primitives/memo.js'\nimport { enterAccessor, exitAccessor } from './render-context.js'\n\nexport const FULL_MASK = 0xffffffff | 0\n\n/**\n * Path-keyed dirty mask computation. Walks the prefix table; each entry\n * whose `prefix(prev) !== prefix(next)` contributes its bit to the dirty\n * mask. Bit position = table position (single-word, ≤31 entries) — for\n * overflow (>31 entries), bits 31..61 land in the high half of a\n * `[number, number]` pair, matching `__dirty`'s overflow shape.\n *\n * The runtime is correct under structural-sharing reducers (immutable\n * splice): a sub-tree that wasn't touched stays reference-equal across\n * `prev`/`next`, so every accessor reading into that sub-tree skips.\n *\n * @internal\n */\nexport function computeDirtyFromPrefixes(\n prefixes: ReadonlyArray<(state: unknown) => unknown>,\n prev: unknown,\n next: unknown,\n): number | [number, number] {\n if (prefixes.length <= 31) {\n let dirty = 0\n for (let i = 0; i < prefixes.length; i++) {\n if (prefixes[i]!(prev) !== prefixes[i]!(next)) dirty |= 1 << i\n }\n return dirty\n }\n // Overflow: two words, 31 bits each (avoid sign bit for ergonomic\n // bitwise ops). Bit i % 31 of word ⌊i / 31⌋.\n let lo = 0\n let hi = 0\n const len = prefixes.length\n for (let i = 0; i < len && i < 31; i++) {\n if (prefixes[i]!(prev) !== prefixes[i]!(next)) lo |= 1 << i\n }\n for (let i = 31; i < len && i < 62; i++) {\n if (prefixes[i]!(prev) !== prefixes[i]!(next)) hi |= 1 << (i - 31)\n }\n // Anything past 62 forces FULL_MASK in the high word — the unified\n // model's compiler-emitted prefix counts shouldn't hit this in\n // realistic apps, but degrade gracefully if they do.\n if (len > 62) hi = FULL_MASK\n return [lo, hi]\n}\n\nexport interface ComponentInstance<S = unknown, M = unknown, E = unknown> {\n def: ComponentDef<S, M, E>\n state: S\n initialEffects: E[]\n rootLifetime: Lifetime\n dom: DomEnv\n allBindings: Binding[]\n structuralBlocks: StructuralBlock[]\n queue: M[]\n microtaskScheduled: boolean\n lastDirtyMask: number\n lastEffects: E[]\n send: (msg: M) => void\n signal: AbortSignal\n abortController: AbortController\n /** @internal dev-only — populated when `installDevTools` ran. Ring-buffered\n * per-each-site reconciliation diffs for MCP introspection tools. */\n _eachDiffLog?: RingBuffer<EachDiff>\n /** @internal dev-only — monotonically incremented by the devtools-intercepted\n * `update` before each history push. Read by `each.ts` to stamp diffs with\n * the `updateIndex` of the message that caused the reconciliation. */\n _updateCounter?: number\n /** @internal dev-only — populated when `installDevTools` ran. Ring-buffered\n * log of `disposeLifetime` firings (scope id + cause). Consumed by the\n * `llui_disposer_log` MCP tool to diagnose leaks on structural transitions. */\n _disposerLog?: RingBuffer<DisposerEvent>\n /** @internal dev-only — populated when `installDevTools` ran. Per-variant\n * Msg counter keyed by discriminant. Consumed by the `llui_coverage` MCP\n * tool to surface Msg variants that have never fired this session. */\n _coverage?: CoverageTracker\n /** @internal dev-only — populated when `installDevTools` ran. Ring-buffered\n * effect dispatch phase log (dispatched → resolved/cancelled) for USER\n * effects emitted from `update()`. Consumed by the `llui_effect_timeline`\n * MCP tool. Built-in plumbing effects (`delay`, `log`, addressed) are NOT\n * recorded here by design — they short-circuit in `dispatchEffect` before\n * `dispatchEffectDev` runs. They're runtime plumbing, not user intent,\n * and surface via other channels (message queue for `delay`, browser\n * console for `log`, addressed-target routing for addressed effects). */\n _effectTimeline?: RingBuffer<EffectTimelineEntry>\n /** @internal dev-only — populated when `installDevTools` ran. List of\n * currently-pending effects addressable by id, consumed by the\n * `llui_pending_effects` MCP tool. */\n _pendingEffects?: PendingEffectsList\n /** @internal dev-only — populated when `installDevTools` ran. Mock\n * registry consulted by the effect-dispatch wrapper to short-circuit\n * matching effects. Consumed by the `llui_mock_effect` MCP tool. */\n _effectMocks?: MockRegistry\n /**\n * @internal — set by mountApp/mountAtAnchor/hydrateApp/hydrateAtAnchor\n * to fire AppHandle.subscribe listeners after every update cycle.\n * Undefined until the first subscriber registers.\n */\n _onCommit?: (state: unknown) => void\n /**\n * @internal — optional hook invoked when a binding's accessor throws\n * during Phase 2. The runtime catches the throw, leaves the binding's\n * `lastValue` unchanged (so the rendered DOM stays at its previous\n * value rather than going blank), and notifies this hook. The agent\n * factory wires it to drain.errors so the LLM sees that some bindings\n * failed; non-agent hosts can leave it undefined for the default\n * console-warn behavior.\n *\n * Why catch + continue instead of letting the throw propagate?\n * One bad binding shouldn't abort the entire update loop — sibling\n * bindings on the same commit are independent and have no business\n * going stale because a different binding crashed. The user-visible\n * effect: when one cell's accessor throws (e.g. scoring fails on a\n * malformed criterion), every other cell still renders correctly;\n * only the broken binding shows its previous value.\n */\n _onBindingError?: (info: { kind: string; key?: string; message: string; stack?: string }) => void\n /**\n * @internal — live registry of currently-mounted Msg variants\n * dispatchable from rendered UI. Lazily allocated when the first\n * compiler-tagged event handler binds. Read by the agent layer (via\n * `AppHandle.getBindingDescriptors()`) to surface live affordances\n * to the LLM. See `binding-descriptors.ts` for the registration\n * protocol and `@llui/vite-plugin`'s tagger pass for the tag emission.\n */\n _bindingDescriptors?: import('./binding-descriptors.js').BindingDescriptorRegistry\n}\n\nexport function createComponentInstance<S, M, E, D = void>(\n def: ComponentDef<S, M, E, D>,\n data?: D,\n parentLifetime: Lifetime | null = null,\n dom?: DomEnv,\n): ComponentInstance<S, M, E> {\n // Hand-authored `__dirty` is no longer supported — the path-keyed\n // `__prefixes` emission supersedes it (62-prefix capacity, precise\n // per-prefix gating). Compiler-emitted `__dirty` was removed in\n // 2026-05 alongside this throw; any `__dirty` field at runtime must\n // be user code, and silently ignoring it would hide a stale pattern.\n // Migrate by deleting the `__dirty` field — the compiler emits\n // `__prefixes` automatically from accessor analysis, and uncompiled\n // components correctly fall back to FULL_MASK.\n if ((def as { __dirty?: unknown }).__dirty !== undefined) {\n throw new Error(\n `[llui] Component \"${def.name}\" defines \\`__dirty\\` directly. ` +\n `This field is no longer accepted — the compiler emits \\`__prefixes\\` ` +\n `(path-keyed reactivity) automatically. Remove \\`__dirty\\` from the ` +\n `ComponentDef; either the compiler will regenerate the correct ` +\n `prefix table, or uncompiled components will fall back to FULL_MASK. ` +\n `See docs/proposals/unified-composition-model.md.`,\n )\n }\n const [initialState, initialEffects] = def.init(data as D)\n\n const controller = new AbortController()\n\n const inst: ComponentInstance<S, M, E> = {\n // `def` carries an arbitrary `D` for typed init data, but after init\n // has run the runtime never touches `def.init` again — update/view/\n // onEffect and HMR replacement don't depend on D. Cast to the\n // D=void instance storage shape here.\n def: def as ComponentDef<S, M, E>,\n state: initialState,\n initialEffects,\n // Caller-supplied DOM env. `mountApp` defaults this to `browserEnv()`;\n // `renderToString` passes the user's jsdom/linkedom env. Never null —\n // every primitive reads from inst.dom.\n dom: dom ?? fallbackBrowserEnv(),\n // When `parentLifetime` is provided the instance's rootLifetime becomes a\n // child of that scope. This is how persistent layouts wire pages\n // into the layout's scope tree: the page's rootLifetime is parented at\n // the layout's pageSlot() point so `useContext` lookups flow layout\n // → page, and scope disposal cascades correctly. Mount paths that\n // don't pass parentLifetime get the classic detached root.\n rootLifetime: createLifetime(parentLifetime),\n allBindings: [],\n structuralBlocks: [],\n queue: [],\n microtaskScheduled: false,\n lastDirtyMask: 0,\n lastEffects: [],\n signal: controller.signal,\n abortController: controller,\n\n send(msg: M) {\n inst.queue.push(msg)\n if (!inst.microtaskScheduled) {\n inst.microtaskScheduled = true\n queueMicrotask(() => {\n inst.microtaskScheduled = false\n processMessages(inst)\n })\n }\n },\n }\n\n inst.rootLifetime._kind = 'root'\n\n return inst\n}\n\nexport function flushInstance<S, M, E>(inst: ComponentInstance<S, M, E>): void {\n if (inst.queue.length === 0) return\n inst.microtaskScheduled = false\n processMessages(inst)\n}\n\n/**\n * Dev-only: overwrite instance state and re-run both phases with FULL_MASK\n * so every binding re-evaluates. Bypasses update() — use for devtools\n * snapshot/restore, not in app code.\n */\nexport function _forceState<S, M, E>(inst: ComponentInstance<S, M, E>, newState: S): void {\n inst.state = newState\n inst.lastDirtyMask = FULL_MASK\n\n const bindings = inst.allBindings\n const bindingsBeforePhase1 = bindings.length\n\n setCurrentDirtyMask(FULL_MASK)\n\n const snapshot = inst.structuralBlocks.slice()\n for (const block of snapshot) {\n try {\n block.reconcile(newState, FULL_MASK, FULL_MASK)\n } catch (e) {\n reportReconcileError(inst, e)\n }\n }\n\n let phase2Len = bindingsBeforePhase1\n if (bindings.length > bindingsBeforePhase1 || (phase2Len > 0 && bindings[0]!.dead)) {\n let w = 0\n for (let r = 0; r < bindings.length; r++) {\n if (!bindings[r]!.dead) bindings[w++] = bindings[r]!\n }\n bindings.length = w\n phase2Len = Math.min(w, bindingsBeforePhase1)\n }\n\n const state = inst.state\n enterAccessor('a binding accessor')\n try {\n for (let i = 0, len = phase2Len; i < len; i++) {\n const binding = bindings[i]!\n if (binding.dead) continue\n if (binding.kind === 'effect') {\n try {\n binding.accessor(state)\n } catch (e) {\n reportBindingError(inst, binding, e)\n }\n continue\n }\n let newValue: unknown\n try {\n newValue = binding.accessor(state)\n } catch (e) {\n // Accessor threw — leave the binding's `lastValue` unchanged so\n // the rendered DOM stays at its previous value rather than going\n // blank. Sibling bindings on the same commit continue to\n // evaluate. The error surfaces via the optional hook (or\n // console.warn as a fallback) so it isn't silently swallowed.\n reportBindingError(inst, binding, e)\n continue\n }\n if (Object.is(newValue, binding.lastValue)) continue\n binding.lastValue = newValue\n try {\n applyBinding(binding, newValue)\n } catch (e) {\n // applyBinding writes the value to the DOM (textContent,\n // setAttribute, etc.). Throws here are usually environmental\n // (a node was removed mid-flight by a sibling binding). Same\n // contract: report and continue.\n reportBindingError(inst, binding, e)\n }\n }\n } finally {\n exitAccessor()\n }\n}\n\nfunction reportBindingError<S, M, E>(\n inst: ComponentInstance<S, M, E>,\n binding: Binding,\n e: unknown,\n): void {\n const err = e instanceof Error ? e : new Error(String(e))\n const stack = err.stack ? err.stack.split('\\n').slice(0, 8).join('\\n') : undefined\n const info =\n stack !== undefined\n ? {\n kind: String(binding.kind),\n key: binding.key,\n message: `${err.name}: ${err.message}`,\n stack,\n }\n : { kind: String(binding.kind), key: binding.key, message: `${err.name}: ${err.message}` }\n if (inst._onBindingError !== undefined) {\n try {\n inst._onBindingError(info)\n } catch {\n // The hook itself threw — nothing to do; we're in a recovery\n // path already. Fall through to the console fallback.\n }\n } else if (typeof console !== 'undefined' && typeof console.warn === 'function') {\n console.warn(\n `[llui] binding accessor threw (kind=${info.kind}${info.key ? `, key=${info.key}` : ''}): ${info.message}`,\n )\n }\n}\n\n/**\n * Phase 1 (structural reconcile) parallel of `reportBindingError`. A\n * `block.reconcile` throw — most often a misuse like `sample()` inside an\n * `each().key` accessor — would otherwise escape the update loop, kill the\n * remaining structural blocks AND the entire Phase 2 binding pass on this\n * commit, and (in real apps) surface as an unhandled microtask rejection\n * the developer never sees. Routing it through the same `_onBindingError`\n * channel that Phase 2 uses gives parity: the error is named, surfaced\n * once, and the rest of the update continues.\n *\n * Note: a partial DOM mutation on the failing block is NOT rolled back.\n * The block's reconcile is responsible for keeping the DOM in a consistent\n * state on its own happy path; if it throws mid-mutation, the visible\n * result may be an inconsistent block, but sibling blocks and bindings\n * still update correctly.\n */\nfunction reportReconcileError<S, M, E>(inst: ComponentInstance<S, M, E>, e: unknown): void {\n const err = e instanceof Error ? e : new Error(String(e))\n const stack = err.stack ? err.stack.split('\\n').slice(0, 8).join('\\n') : undefined\n const info =\n stack !== undefined\n ? { kind: 'reconcile', message: `${err.name}: ${err.message}`, stack }\n : { kind: 'reconcile', message: `${err.name}: ${err.message}` }\n if (inst._onBindingError !== undefined) {\n try {\n inst._onBindingError(info)\n } catch {\n // hook itself threw; fall through to console\n }\n } else if (typeof console !== 'undefined' && typeof console.error === 'function') {\n // Reconcile errors are programmer errors (almost always: sample-in-\n // accessor or a thrown structural primitive). Surface as `error` not\n // `warn` so they're not lost in noisy dev consoles.\n console.error(`[llui] structural reconcile threw: ${info.message}`)\n }\n}\n\nfunction processMessages<S, M, E>(inst: ComponentInstance<S, M, E>): void {\n const queue = inst.queue\n\n // Single-message fast path: dispatch directly to per-message-type handler\n // if available. Skips dirty computation, Phase 1/2 entirely.\n if (queue.length === 1 && inst.def.__handlers) {\n const msg = queue[0]!\n const handler = inst.def.__handlers[(msg as Record<string, unknown>).type as string] as\n | ((inst: ComponentInstance, msg: unknown) => [S, E[]])\n | undefined\n if (handler) {\n queue.length = 0\n const [newState, effects] = handler(inst as ComponentInstance, msg)\n inst.state = newState\n inst._onCommit?.(newState as unknown)\n if (import.meta.env?.DEV) {\n inst.lastDirtyMask = FULL_MASK\n inst.lastEffects = effects\n }\n for (let i = 0; i < effects.length; i++) {\n dispatchEffect(inst, effects[i]!)\n }\n return\n }\n }\n\n // Generic pipeline — drain queue, accumulate dirty bits (two words:\n // bits 0..30 in `combinedDirty`, bits 31..61 in `combinedDirtyHi`).\n let state = inst.state\n let combinedDirty = 0\n let combinedDirtyHi = 0\n const allEffects: E[] = []\n\n const defUpdate = inst.def.update\n // Path-keyed reactivity: when the compiler emits `__prefixes`, dirty\n // bits correspond to entries in the prefix table (one bit per minimal\n // reference-stable prefix read across the component's accessors). The\n // runtime computes the dirty mask by reference-comparing `prefix(prev)\n // !== prefix(next)` for each table entry — precise per-prefix and\n // supports two-word emission for up to 62 prefixes. Components compiled\n // without `__llui/vite-plugin` (or with no reactive accessors) have no\n // `__prefixes` table; they fall back to `FULL_MASK` and pay the cost\n // of re-evaluating every binding every cycle. User-authored `__dirty`\n // is no longer accepted — see types.ts for the rationale.\n const prefixes = inst.def.__prefixes as ReadonlyArray<(s: unknown) => unknown> | undefined\n for (let qi = 0; qi < queue.length; qi++) {\n const msg = queue[qi]!\n const [newState, effects] = defUpdate(state, msg)\n let dirty: number | [number, number]\n if (prefixes !== undefined) {\n dirty = computeDirtyFromPrefixes(prefixes, state, newState)\n } else {\n dirty = FULL_MASK\n }\n if (typeof dirty === 'number') {\n combinedDirty |= dirty\n } else {\n combinedDirty |= dirty[0]\n combinedDirtyHi |= dirty[1]\n }\n state = newState\n // Avoid spread — allocates an iterator per call. For typical effect\n // arrays (0-2 elements) this is a minor saving; for bursts it matters.\n for (let ei = 0; ei < effects.length; ei++) allEffects.push(effects[ei]!)\n }\n queue.length = 0\n\n inst.state = state\n inst._onCommit?.(state as unknown)\n // Dev-only bookkeeping — tests read lastDirtyMask/lastEffects, prod\n // doesn't. Gating here keeps two writes out of the prod hot path.\n if (import.meta.env?.DEV) {\n inst.lastDirtyMask = combinedDirty\n inst.lastEffects = allEffects\n }\n\n // Snapshot binding count before Phase 1 — bindings added during\n // Phase 1 already have correct initial values and skip Phase 2.\n const bindings = inst.allBindings\n const bindingsBeforePhase1 = bindings.length\n\n // Set current dirty mask BEFORE Phase 1 so memo() accessors used in\n // structural primitives (e.g. each.items) can use the bitmask fast path.\n setCurrentDirtyMask(combinedDirty, combinedDirtyHi)\n\n if (inst.def.__update) {\n // Compiler-generated fast path — replaces generic Phase 1 + Phase 2.\n // `combinedDirtyHi` is passed as the trailing positional arg so\n // stale 5-param compiled bundles continue to gate correctly: they\n // ignore the extra arg, and for ≤31-prefix components `dirtyHi`\n // is always 0 anyway. Fresh compiled bundles use the 6th param\n // for precise two-word Phase 1 gating on 32..61-prefix components.\n inst.def.__update(\n state,\n combinedDirty,\n bindings,\n inst.structuralBlocks,\n bindingsBeforePhase1,\n combinedDirtyHi,\n )\n } else {\n // Generic Phase 1 + Phase 2 fallback (uncompiled components)\n genericUpdate(inst, state, combinedDirty, combinedDirtyHi, bindings, bindingsBeforePhase1)\n }\n\n // Dispatch effects after DOM updates\n for (let i = 0; i < allEffects.length; i++) {\n dispatchEffect(inst, allEffects[i]!)\n }\n}\n\nfunction genericUpdate<S, M, E>(\n inst: ComponentInstance<S, M, E>,\n state: S,\n combinedDirty: number,\n combinedDirtyHi: number,\n bindings: Binding[],\n bindingsBeforePhase1: number,\n): void {\n // Phase 1 — structural reconciliation. Structural primitives register\n // their blocks BEFORE running builders, so parents precede their nested\n // children in this array. That ordering matters: a parent's reconcile\n // may dispose the old arm, whose disposers splice nested child blocks\n // out of this shared array. Because children are always to the right\n // of their parent, the splice shifts entries left — which is safe for\n // a forward iterator that re-reads length each step.\n const blocks = inst.structuralBlocks\n for (let bi = 0; bi < blocks.length; bi++) {\n const block = blocks[bi]\n if (!block) continue\n // Two-word gate: skip when neither low nor high masks intersect.\n // `block.maskHi` is 0 for ≤31-prefix blocks, so `0 & dirtyHi === 0`\n // collapses the gate to the single-word check at runtime.\n if (!((block.mask & combinedDirty) | (block.maskHi & combinedDirtyHi))) continue\n try {\n block.reconcile(state, combinedDirty, combinedDirtyHi)\n } catch (e) {\n reportReconcileError(inst, e)\n }\n }\n\n // Phase 2 — compact + update bindings\n _runPhase2(\n state,\n combinedDirty,\n combinedDirtyHi,\n bindings,\n bindingsBeforePhase1,\n inst.def.name,\n inst._onBindingError,\n )\n}\n\n/**\n * Run a handler for a single message: call update(), reconcile blocks\n * with the given method, run Phase 2. Used by compiler-generated __handlers\n * to avoid duplicating boilerplate per message type.\n *\n * @param method 0=reconcile, 1=reconcileItems, 2=reconcileClear, 3=reconcileRemove, -1=skip blocks\n * @public — used by compiler-generated `__handlers`\n *\n * Backward-compat: pre-multi-word compiled bundles call this with 4\n * args (no `dirtyHi`). The default `dirtyHi = 0` keeps those calls\n * correct for ≤31-prefix components — the high gate always evaluates\n * to 0 so the runtime falls back to the single-word check. Components\n * with >31 prefixes need a fresh compile to start passing `dirtyHi`.\n */\nexport function _handleMsg(\n inst: ComponentInstance,\n msg: unknown,\n dirty: number,\n method: number,\n dirtyHi: number = 0,\n): [unknown, unknown[]] {\n const [s, e] = (inst.def.update as (s: unknown, m: unknown) => [unknown, unknown[]])(\n inst.state,\n msg,\n )\n inst.state = s\n inst._onCommit?.(s)\n\n // memo()-wrapped accessors (auto-generated by the compiler for\n // multi-field structural accessors like each.items / branch.on /\n // show.when) gate on `currentDirtyMask`. The generic pipeline sets\n // it before Phase 1; the single-message fast path must as well, or\n // memo short-circuits with the stale value left over from the\n // previous cycle and structural blocks reconcile against a frozen\n // input.\n setCurrentDirtyMask(dirty, dirtyHi)\n\n if (method >= 0) {\n const bl = inst.structuralBlocks\n for (let i = 0; i < bl.length; i++) {\n const block = bl[i]\n if (!block) continue\n if (!((block.mask & dirty) | (block.maskHi & dirtyHi))) continue\n try {\n // Specialized methods (`reconcileItems`, `reconcileClear`,\n // `reconcileRemove`, `reconcileChanged`) only exist on `each`\n // blocks. Non-each blocks (`show`, `branch`, `scope`) leave\n // them undefined. The compiler-side fix in `detectArrayOp`\n // already restricts these methods to single-field cases, but\n // a show()/branch() block whose mask intersects the cleared\n // field would still be silently skipped without this fallback.\n // When the specialized method is missing, run the general\n // `reconcile` path so the block's `when`/`on` accessor still\n // re-evaluates. each blocks always have the specialized\n // methods, so they keep their fast path.\n switch (method) {\n case 0:\n block.reconcile(s, dirty, dirtyHi)\n break\n case 1:\n if (block.reconcileItems) block.reconcileItems(s)\n else block.reconcile(s, dirty, dirtyHi)\n break\n case 2:\n if (block.reconcileClear) block.reconcileClear()\n else block.reconcile(s, dirty, dirtyHi)\n break\n case 3:\n if (block.reconcileRemove) block.reconcileRemove(s)\n else block.reconcile(s, dirty, dirtyHi)\n break\n default:\n // method >= 10: reconcileChanged with stride = method - 10\n if (method >= 10) {\n if (block.reconcileChanged) block.reconcileChanged(s, method - 10)\n else block.reconcile(s, dirty, dirtyHi)\n }\n break\n }\n } catch (err) {\n reportReconcileError(inst, err)\n // continue to next block — see reportReconcileError docstring\n }\n }\n }\n\n const b = inst.allBindings\n _runPhase2(s, dirty, dirtyHi, b, b.length, inst.def.name, inst._onBindingError)\n return [s, e]\n}\n\n/**\n * Phase 2: compact dead bindings + update live bindings.\n * Shared between genericUpdate and compiler-generated __update.\n * @public — used by compiler-generated `__update` functions\n *\n * `dirtyHi` defaults to 0 for backward-compat with pre-multi-word\n * compiled bundles that pass only the single-word `dirty`. Bindings\n * read paths 0..30 in `binding.mask` and paths 31..61 in\n * `binding.maskHi`; the gate ORs both AND results so the high word is\n * a no-op for ≤31-prefix components.\n */\nexport function _runPhase2(\n state: unknown,\n dirty: number,\n dirtyHi: number,\n bindings: Binding[],\n bindingsBeforePhase1: number,\n componentName?: string,\n // Optional `_onBindingError` hook. Type is duplicated here rather\n // than referenced as `ComponentInstance['_onBindingError']` because\n // the underlying field is `@internal` — stripped from the generated\n // `.d.ts` — and a public-export signature can't depend on a stripped\n // type without breaking dependent packages' typecheck.\n onBindingError?: (info: { kind: string; key?: string; message: string; stack?: string }) => void,\n): void {\n let phase2Len = bindingsBeforePhase1\n if (bindings.length > bindingsBeforePhase1 || (phase2Len > 0 && bindings[0]!.dead)) {\n let w = 0\n for (let r = 0; r < bindings.length; r++) {\n if (!bindings[r]!.dead) bindings[w++] = bindings[r]!\n }\n bindings.length = w\n phase2Len = Math.min(w, bindingsBeforePhase1)\n }\n\n if (dirty !== 0 || dirtyHi !== 0) {\n // Always catch+continue: a single accessor throw shouldn't abort\n // the rest of the bindings on the same commit. The user-visible\n // effect: a broken cell shows its previous value; sibling cells\n // stay current. In dev mode, the wrapped error (with component\n // name, kind, node descriptor, accessor source) is forwarded via\n // the `_onBindingError` hook (agent integration) or to\n // `console.error` (dev harness without an agent). The prior\n // behavior of rethrowing from `flush()` made one bad binding\n // visually break the entire view — the worst-case UX.\n const isDev = import.meta.env?.DEV && componentName\n // Single accessor label for the entire Phase 2 loop. The binding kind is\n // already part of the error message that handleBindingThrow surfaces; the\n // accessor label here serves the more specific purpose of catching\n // sample() calls reaching for a render context that isn't set during\n // the update phase. A `binding accessor` label is generic enough to apply\n // to text/attr/class/effect bindings without per-kind branching.\n enterAccessor('a binding accessor')\n try {\n for (let i = 0, len = phase2Len; i < len; i++) {\n const binding = bindings[i]!\n if (binding.dead) continue\n // Two-word gate. `maskHi` is 0 for ≤31-prefix bindings; the\n // `0 & dirtyHi === 0` branch collapses to a no-op under V8's\n // inline cache.\n if (!((binding.mask & dirty) | (binding.maskHi & dirtyHi))) continue\n if (binding.kind === 'effect') {\n try {\n binding.accessor(state)\n } catch (e) {\n handleBindingThrow(onBindingError, binding, e, isDev ? componentName : null)\n }\n continue\n }\n let newValue: unknown\n try {\n newValue = binding.accessor(state)\n } catch (e) {\n handleBindingThrow(onBindingError, binding, e, isDev ? componentName : null)\n continue\n }\n const last = binding.lastValue\n if (newValue === last || (newValue !== newValue && last !== last)) continue\n binding.lastValue = newValue\n try {\n applyBinding(binding, newValue)\n } catch (e) {\n handleBindingThrow(onBindingError, binding, e, isDev ? componentName : null)\n }\n }\n } finally {\n exitAccessor()\n }\n }\n}\n\nfunction handleBindingThrow(\n onBindingError: ComponentInstance['_onBindingError'] | undefined,\n binding: Binding,\n e: unknown,\n componentName: string | null,\n): void {\n // Dev mode: build the rich wrapped error (with accessor source,\n // node descriptor, undefined-hint detection). Prod skips the\n // bookkeeping. Either way the report flows through `_onBindingError`\n // when wired (agent setups), else falls back to console.error so\n // operators see the cause.\n const wrapped =\n componentName !== null && e instanceof Error\n ? enhanceBindingError(e, binding, componentName)\n : null\n const err = wrapped ?? (e instanceof Error ? e : new Error(String(e)))\n const stack = err.stack ? err.stack.split('\\n').slice(0, 8).join('\\n') : undefined\n const info =\n stack !== undefined\n ? { kind: String(binding.kind), key: binding.key, message: err.message, stack }\n : { kind: String(binding.kind), key: binding.key, message: err.message }\n\n if (onBindingError !== undefined) {\n try {\n onBindingError(info)\n } catch {\n // hook itself threw; fall through to console\n }\n } else if (typeof console !== 'undefined') {\n // Dev mode shows the wrapped (richer) message. Prod shows a brief\n // line — operators still see something but without the full source\n // hint that's only useful at development time.\n if (componentName !== null) {\n console.error(err)\n } else if (typeof console.warn === 'function') {\n console.warn(\n `[llui] binding accessor threw (kind=${info.kind}${info.key ? `, key=${info.key}` : ''}): ${info.message}`,\n )\n }\n }\n}\n\nfunction enhanceBindingError(err: unknown, binding: Binding, componentName: string): Error {\n // For text bindings, binding.node is the Text node — use its parent element.\n const node = binding.node\n const target = node.nodeType === 1 ? (node as Element) : (node.parentElement ?? null)\n let nodeDesc = '?'\n if (target) {\n const id = target.id ? `#${target.id}` : ''\n const cls =\n target.className && typeof target.className === 'string'\n ? `.${target.className.split(' ').filter(Boolean).slice(0, 2).join('.')}`\n : ''\n nodeDesc = `<${target.tagName.toLowerCase()}${id}${cls}>`\n if (node.nodeType === 3) nodeDesc += ' text-child'\n else if (node.nodeType === 8) nodeDesc += ' comment-child'\n }\n const keyPart = binding.key ? ` .${binding.key}` : ''\n const errMsg = err instanceof Error ? err.message : String(err)\n\n // Build accessor source hint if available\n let accessorHint = ''\n try {\n const src = binding.accessor.toString().slice(0, 80)\n accessorHint = `\\n accessor: ${src}${binding.accessor.toString().length > 80 ? '...' : ''}`\n } catch {\n // toString() may throw on revoked proxies, etc.\n }\n\n // Detect common undefined/null access pattern and add a helpful hint\n let undefinedHint = ''\n if (err instanceof TypeError && /Cannot read propert(ies|y).*of (undefined|null)/.test(errMsg)) {\n undefinedHint =\n '\\n hint: Check that your accessor handles undefined state fields (e.g., use optional chaining: s.user?.name)'\n }\n\n const wrapped = new Error(\n `[LLui] ${binding.kind}${keyPart} binding on ${nodeDesc} — accessor threw in <${componentName}>\\n` +\n ` ↳ ${errMsg}` +\n undefinedHint +\n accessorHint,\n err instanceof Error ? { cause: err } : undefined,\n )\n wrapped.stack = (err instanceof Error && err.stack) || wrapped.stack\n return wrapped\n}\n\nfunction dispatchEffect<S, M, E>(inst: ComponentInstance<S, M, E>, effect: E): void {\n const eff = effect as Record<string, unknown>\n\n // Built-in: delay\n if (eff.type === 'delay') {\n const ms = eff.ms as number\n const onDone = eff.onDone as M\n setTimeout(() => inst.send(onDone), ms)\n return\n }\n\n // Built-in: log\n if (eff.type === 'log') {\n console.log(eff.message)\n return\n }\n\n // Dev-only: record on the timeline / consult the mock registry.\n // Short-circuits real dispatch when a mock matches. Zero cost in\n // production — the guard on `_effectTimeline` is undefined unless\n // `installDevTools` populated the trackers.\n if (inst._effectTimeline !== undefined && dispatchEffectDev(inst, effect)) return\n\n // User onEffect handler\n if (inst.def.onEffect) {\n inst.def.onEffect({ effect, send: inst.send, signal: inst.signal })\n }\n}\n\n/**\n * Dev-only effect dispatch wrapper. Records the `dispatched` phase and,\n * when a mock matches, auto-delivers the mocked response through the\n * effect's own `onSuccess` callback on a microtask (same timing contract\n * as a real async resolve). Non-matched effects are tracked as pending\n * so `llui_pending_effects` / `llui_resolve_effect` can observe them.\n *\n * @returns `true` when a mock matched (caller should skip the real\n * dispatch) or `false` to proceed with the user-provided onEffect.\n */\nfunction dispatchEffectDev<S, M, E>(inst: ComponentInstance<S, M, E>, effect: E): boolean {\n const timeline = inst._effectTimeline\n if (timeline === undefined) return false\n\n const eff = effect as Record<string, unknown>\n const id = newEffectId()\n const type = typeof eff.type === 'string' ? eff.type : '<unknown>'\n const dispatchedAt = Date.now()\n\n const mock = inst._effectMocks?.match(effect)\n if (mock) {\n timeline.push({ effectId: id, type, phase: 'dispatched', timestamp: dispatchedAt })\n // Auto-deliver the mocked response via the effect's onSuccess callback (if any).\n // This mirrors what the real dispatch would do, so the component receives a Msg\n // from the mocked effect without any network/IO happening.\n const payload = effect as Record<string, unknown>\n if (typeof payload.onSuccess === 'function') {\n const msg = (payload.onSuccess as (d: unknown) => unknown)(mock.response)\n // Schedule delivery as a microtask so it runs after the current update\n // cycle completes (same timing contract as a real async effect resolve).\n Promise.resolve().then(() => inst.send(msg as never))\n }\n timeline.push({\n effectId: id,\n type,\n phase: 'resolved-mocked',\n timestamp: dispatchedAt,\n durationMs: 0,\n })\n return true\n }\n\n timeline.push({ effectId: id, type, phase: 'dispatched', timestamp: dispatchedAt })\n inst._pendingEffects?.push({ id, type, dispatchedAt, status: 'queued', payload: effect })\n return false\n}\n\nfunction newEffectId(): string {\n const cryptoObj = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto\n if (cryptoObj?.randomUUID) return cryptoObj.randomUUID()\n return `eff-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`\n}\n"]}
1
+ {"version":3,"file":"update-loop.js","sourceRoot":"","sources":["../src/update-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,CAAA;IACb,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAA;IACnF,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;IACzF,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,WAAW;IAClB,MAAM,SAAS,GAAI,UAAyD,CAAC,MAAM,CAAA;IACnF,IAAI,SAAS,EAAE,UAAU;QAAE,OAAO,SAAS,CAAC,UAAU,EAAE,CAAA;IACxD,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAA;AACvE,CAAC","sourcesContent":["import type { ComponentDef, Lifetime, Binding } from './types.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { RingBuffer, EachDiff } from './tracking/each-diff.js'\nimport type { DisposerEvent } from './tracking/disposer-log.js'\nimport type { CoverageTracker } from './tracking/coverage.js'\nimport { type DomEnv, browserEnv } from './dom-env.js'\n\n// Single lazily-constructed browser env shared by every client-side\n// component instance. Falls through to globalThis at call time — safe\n// to construct on a server process (the lookups never fire there).\nlet _fallbackEnv: DomEnv | null = null\nfunction fallbackBrowserEnv(): DomEnv {\n if (_fallbackEnv === null) _fallbackEnv = browserEnv()\n return _fallbackEnv\n}\nimport type {\n EffectTimelineEntry,\n PendingEffectsList,\n MockRegistry,\n} from './tracking/effect-timeline.js'\nimport { createLifetime } from './lifetime.js'\nimport { applyBinding } from './binding.js'\nimport { setCurrentDirtyMask } from './primitives/memo.js'\nimport { enterAccessor, exitAccessor } from './render-context.js'\n\nexport const FULL_MASK = 0xffffffff | 0\n\n/**\n * Path-keyed dirty mask computation. Walks the prefix table; each entry\n * whose `prefix(prev) !== prefix(next)` contributes its bit to the dirty\n * mask. Bit position = table position (single-word, ≤31 entries) — for\n * overflow (>31 entries), bits 31..61 land in the high half of a\n * `[number, number]` pair, matching `__dirty`'s overflow shape.\n *\n * The runtime is correct under structural-sharing reducers (immutable\n * splice): a sub-tree that wasn't touched stays reference-equal across\n * `prev`/`next`, so every accessor reading into that sub-tree skips.\n *\n * @internal\n */\nexport function computeDirtyFromPrefixes(\n prefixes: ReadonlyArray<(state: unknown) => unknown>,\n prev: unknown,\n next: unknown,\n): number | [number, number] {\n if (prefixes.length <= 31) {\n let dirty = 0\n for (let i = 0; i < prefixes.length; i++) {\n if (prefixes[i]!(prev) !== prefixes[i]!(next)) dirty |= 1 << i\n }\n return dirty\n }\n // Overflow: two words, 31 bits each (avoid sign bit for ergonomic\n // bitwise ops). Bit i % 31 of word ⌊i / 31⌋.\n let lo = 0\n let hi = 0\n const len = prefixes.length\n for (let i = 0; i < len && i < 31; i++) {\n if (prefixes[i]!(prev) !== prefixes[i]!(next)) lo |= 1 << i\n }\n for (let i = 31; i < len && i < 62; i++) {\n if (prefixes[i]!(prev) !== prefixes[i]!(next)) hi |= 1 << (i - 31)\n }\n // Anything past 62 forces FULL_MASK in the high word — the unified\n // model's compiler-emitted prefix counts shouldn't hit this in\n // realistic apps, but degrade gracefully if they do.\n if (len > 62) hi = FULL_MASK\n return [lo, hi]\n}\n\nexport interface ComponentInstance<S = unknown, M = unknown, E = unknown> {\n def: ComponentDef<S, M, E>\n state: S\n initialEffects: E[]\n rootLifetime: Lifetime\n dom: DomEnv\n allBindings: Binding[]\n structuralBlocks: StructuralBlock[]\n queue: M[]\n microtaskScheduled: boolean\n lastDirtyMask: number\n lastEffects: E[]\n send: (msg: M) => void\n signal: AbortSignal\n abortController: AbortController\n /** @internal dev-only — populated when `installDevTools` ran. Ring-buffered\n * per-each-site reconciliation diffs for MCP introspection tools. */\n _eachDiffLog?: RingBuffer<EachDiff>\n /** @internal dev-only — monotonically incremented by the devtools-intercepted\n * `update` before each history push. Read by `each.ts` to stamp diffs with\n * the `updateIndex` of the message that caused the reconciliation. */\n _updateCounter?: number\n /** @internal dev-only — populated when `installDevTools` ran. Ring-buffered\n * log of `disposeLifetime` firings (scope id + cause). Consumed by the\n * `llui_disposer_log` MCP tool to diagnose leaks on structural transitions. */\n _disposerLog?: RingBuffer<DisposerEvent>\n /** @internal dev-only — populated when `installDevTools` ran. Per-variant\n * Msg counter keyed by discriminant. Consumed by the `llui_coverage` MCP\n * tool to surface Msg variants that have never fired this session. */\n _coverage?: CoverageTracker\n /** @internal dev-only — populated when `installDevTools` ran. Ring-buffered\n * effect dispatch phase log (dispatched → resolved/cancelled) for USER\n * effects emitted from `update()`. Consumed by the `llui_effect_timeline`\n * MCP tool. Built-in plumbing effects (`delay`, `log`) are NOT recorded\n * here by design — they short-circuit in `dispatchEffect` before\n * `dispatchEffectDev` runs. They're runtime plumbing, not user intent,\n * and surface via other channels (message queue for `delay`, browser\n * console for `log`). */\n _effectTimeline?: RingBuffer<EffectTimelineEntry>\n /** @internal dev-only — populated when `installDevTools` ran. List of\n * currently-pending effects addressable by id, consumed by the\n * `llui_pending_effects` MCP tool. */\n _pendingEffects?: PendingEffectsList\n /** @internal dev-only — populated when `installDevTools` ran. Mock\n * registry consulted by the effect-dispatch wrapper to short-circuit\n * matching effects. Consumed by the `llui_mock_effect` MCP tool. */\n _effectMocks?: MockRegistry\n /**\n * @internal — set by mountApp/mountAtAnchor/hydrateApp/hydrateAtAnchor\n * to fire AppHandle.subscribe listeners after every update cycle.\n * Undefined until the first subscriber registers.\n */\n _onCommit?: (state: unknown) => void\n /**\n * @internal — optional hook invoked when a binding's accessor throws\n * during Phase 2. The runtime catches the throw, leaves the binding's\n * `lastValue` unchanged (so the rendered DOM stays at its previous\n * value rather than going blank), and notifies this hook. The agent\n * factory wires it to drain.errors so the LLM sees that some bindings\n * failed; non-agent hosts can leave it undefined for the default\n * console-warn behavior.\n *\n * Why catch + continue instead of letting the throw propagate?\n * One bad binding shouldn't abort the entire update loop — sibling\n * bindings on the same commit are independent and have no business\n * going stale because a different binding crashed. The user-visible\n * effect: when one cell's accessor throws (e.g. scoring fails on a\n * malformed criterion), every other cell still renders correctly;\n * only the broken binding shows its previous value.\n */\n _onBindingError?: (info: { kind: string; key?: string; message: string; stack?: string }) => void\n /**\n * @internal — live registry of currently-mounted Msg variants\n * dispatchable from rendered UI. Lazily allocated when the first\n * compiler-tagged event handler binds. Read by the agent layer (via\n * `AppHandle.getBindingDescriptors()`) to surface live affordances\n * to the LLM. See `binding-descriptors.ts` for the registration\n * protocol and `@llui/vite-plugin`'s tagger pass for the tag emission.\n */\n _bindingDescriptors?: import('./binding-descriptors.js').BindingDescriptorRegistry\n}\n\nexport function createComponentInstance<S, M, E, D = void>(\n def: ComponentDef<S, M, E, D>,\n data?: D,\n parentLifetime: Lifetime | null = null,\n dom?: DomEnv,\n): ComponentInstance<S, M, E> {\n // Hand-authored `__dirty` is no longer supported — the path-keyed\n // `__prefixes` emission supersedes it (62-prefix capacity, precise\n // per-prefix gating). Compiler-emitted `__dirty` was removed in\n // 2026-05 alongside this throw; any `__dirty` field at runtime must\n // be user code, and silently ignoring it would hide a stale pattern.\n // Migrate by deleting the `__dirty` field — the compiler emits\n // `__prefixes` automatically from accessor analysis, and uncompiled\n // components correctly fall back to FULL_MASK.\n if ((def as { __dirty?: unknown }).__dirty !== undefined) {\n throw new Error(\n `[llui] Component \"${def.name}\" defines \\`__dirty\\` directly. ` +\n `This field is no longer accepted — the compiler emits \\`__prefixes\\` ` +\n `(path-keyed reactivity) automatically. Remove \\`__dirty\\` from the ` +\n `ComponentDef; either the compiler will regenerate the correct ` +\n `prefix table, or uncompiled components will fall back to FULL_MASK. ` +\n `See docs/proposals/unified-composition-model.md.`,\n )\n }\n const [initialState, initialEffects] = def.init(data as D)\n\n const controller = new AbortController()\n\n const inst: ComponentInstance<S, M, E> = {\n // `def` carries an arbitrary `D` for typed init data, but after init\n // has run the runtime never touches `def.init` again — update/view/\n // onEffect and HMR replacement don't depend on D. Cast to the\n // D=void instance storage shape here.\n def: def as ComponentDef<S, M, E>,\n state: initialState,\n initialEffects,\n // Caller-supplied DOM env. `mountApp` defaults this to `browserEnv()`;\n // `renderToString` passes the user's jsdom/linkedom env. Never null —\n // every primitive reads from inst.dom.\n dom: dom ?? fallbackBrowserEnv(),\n // When `parentLifetime` is provided the instance's rootLifetime becomes a\n // child of that scope. This is how persistent layouts wire pages\n // into the layout's scope tree: the page's rootLifetime is parented at\n // the layout's pageSlot() point so `useContext` lookups flow layout\n // → page, and scope disposal cascades correctly. Mount paths that\n // don't pass parentLifetime get the classic detached root.\n rootLifetime: createLifetime(parentLifetime),\n allBindings: [],\n structuralBlocks: [],\n queue: [],\n microtaskScheduled: false,\n lastDirtyMask: 0,\n lastEffects: [],\n signal: controller.signal,\n abortController: controller,\n\n send(msg: M) {\n inst.queue.push(msg)\n if (!inst.microtaskScheduled) {\n inst.microtaskScheduled = true\n queueMicrotask(() => {\n inst.microtaskScheduled = false\n processMessages(inst)\n })\n }\n },\n }\n\n inst.rootLifetime._kind = 'root'\n\n return inst\n}\n\nexport function flushInstance<S, M, E>(inst: ComponentInstance<S, M, E>): void {\n if (inst.queue.length === 0) return\n inst.microtaskScheduled = false\n processMessages(inst)\n}\n\n/**\n * Dev-only: overwrite instance state and re-run both phases with FULL_MASK\n * so every binding re-evaluates. Bypasses update() — use for devtools\n * snapshot/restore, not in app code.\n */\nexport function _forceState<S, M, E>(inst: ComponentInstance<S, M, E>, newState: S): void {\n inst.state = newState\n inst.lastDirtyMask = FULL_MASK\n\n const bindings = inst.allBindings\n const bindingsBeforePhase1 = bindings.length\n\n setCurrentDirtyMask(FULL_MASK)\n\n const snapshot = inst.structuralBlocks.slice()\n for (const block of snapshot) {\n try {\n block.reconcile(newState, FULL_MASK, FULL_MASK)\n } catch (e) {\n reportReconcileError(inst, e)\n }\n }\n\n let phase2Len = bindingsBeforePhase1\n if (bindings.length > bindingsBeforePhase1 || (phase2Len > 0 && bindings[0]!.dead)) {\n let w = 0\n for (let r = 0; r < bindings.length; r++) {\n if (!bindings[r]!.dead) bindings[w++] = bindings[r]!\n }\n bindings.length = w\n phase2Len = Math.min(w, bindingsBeforePhase1)\n }\n\n const state = inst.state\n enterAccessor('a binding accessor')\n try {\n for (let i = 0, len = phase2Len; i < len; i++) {\n const binding = bindings[i]!\n if (binding.dead) continue\n if (binding.kind === 'effect') {\n try {\n binding.accessor(state)\n } catch (e) {\n reportBindingError(inst, binding, e)\n }\n continue\n }\n let newValue: unknown\n try {\n newValue = binding.accessor(state)\n } catch (e) {\n // Accessor threw — leave the binding's `lastValue` unchanged so\n // the rendered DOM stays at its previous value rather than going\n // blank. Sibling bindings on the same commit continue to\n // evaluate. The error surfaces via the optional hook (or\n // console.warn as a fallback) so it isn't silently swallowed.\n reportBindingError(inst, binding, e)\n continue\n }\n if (Object.is(newValue, binding.lastValue)) continue\n binding.lastValue = newValue\n try {\n applyBinding(binding, newValue)\n } catch (e) {\n // applyBinding writes the value to the DOM (textContent,\n // setAttribute, etc.). Throws here are usually environmental\n // (a node was removed mid-flight by a sibling binding). Same\n // contract: report and continue.\n reportBindingError(inst, binding, e)\n }\n }\n } finally {\n exitAccessor()\n }\n}\n\nfunction reportBindingError<S, M, E>(\n inst: ComponentInstance<S, M, E>,\n binding: Binding,\n e: unknown,\n): void {\n const err = e instanceof Error ? e : new Error(String(e))\n const stack = err.stack ? err.stack.split('\\n').slice(0, 8).join('\\n') : undefined\n const info =\n stack !== undefined\n ? {\n kind: String(binding.kind),\n key: binding.key,\n message: `${err.name}: ${err.message}`,\n stack,\n }\n : { kind: String(binding.kind), key: binding.key, message: `${err.name}: ${err.message}` }\n if (inst._onBindingError !== undefined) {\n try {\n inst._onBindingError(info)\n } catch {\n // The hook itself threw — nothing to do; we're in a recovery\n // path already. Fall through to the console fallback.\n }\n } else if (typeof console !== 'undefined' && typeof console.warn === 'function') {\n console.warn(\n `[llui] binding accessor threw (kind=${info.kind}${info.key ? `, key=${info.key}` : ''}): ${info.message}`,\n )\n }\n}\n\n/**\n * Phase 1 (structural reconcile) parallel of `reportBindingError`. A\n * `block.reconcile` throw — most often a misuse like `sample()` inside an\n * `each().key` accessor — would otherwise escape the update loop, kill the\n * remaining structural blocks AND the entire Phase 2 binding pass on this\n * commit, and (in real apps) surface as an unhandled microtask rejection\n * the developer never sees. Routing it through the same `_onBindingError`\n * channel that Phase 2 uses gives parity: the error is named, surfaced\n * once, and the rest of the update continues.\n *\n * Note: a partial DOM mutation on the failing block is NOT rolled back.\n * The block's reconcile is responsible for keeping the DOM in a consistent\n * state on its own happy path; if it throws mid-mutation, the visible\n * result may be an inconsistent block, but sibling blocks and bindings\n * still update correctly.\n */\nfunction reportReconcileError<S, M, E>(inst: ComponentInstance<S, M, E>, e: unknown): void {\n const err = e instanceof Error ? e : new Error(String(e))\n const stack = err.stack ? err.stack.split('\\n').slice(0, 8).join('\\n') : undefined\n const info =\n stack !== undefined\n ? { kind: 'reconcile', message: `${err.name}: ${err.message}`, stack }\n : { kind: 'reconcile', message: `${err.name}: ${err.message}` }\n if (inst._onBindingError !== undefined) {\n try {\n inst._onBindingError(info)\n } catch {\n // hook itself threw; fall through to console\n }\n } else if (typeof console !== 'undefined' && typeof console.error === 'function') {\n // Reconcile errors are programmer errors (almost always: sample-in-\n // accessor or a thrown structural primitive). Surface as `error` not\n // `warn` so they're not lost in noisy dev consoles.\n console.error(`[llui] structural reconcile threw: ${info.message}`)\n }\n}\n\nfunction processMessages<S, M, E>(inst: ComponentInstance<S, M, E>): void {\n const queue = inst.queue\n\n // Single-message fast path: dispatch directly to per-message-type handler\n // if available. Skips dirty computation, Phase 1/2 entirely.\n if (queue.length === 1 && inst.def.__handlers) {\n const msg = queue[0]!\n const handler = inst.def.__handlers[(msg as Record<string, unknown>).type as string] as\n | ((inst: ComponentInstance, msg: unknown) => [S, E[]])\n | undefined\n if (handler) {\n queue.length = 0\n const [newState, effects] = handler(inst as ComponentInstance, msg)\n inst.state = newState\n inst._onCommit?.(newState as unknown)\n if (import.meta.env?.DEV) {\n inst.lastDirtyMask = FULL_MASK\n inst.lastEffects = effects\n }\n for (let i = 0; i < effects.length; i++) {\n dispatchEffect(inst, effects[i]!)\n }\n return\n }\n }\n\n // Generic pipeline — drain queue, accumulate dirty bits (two words:\n // bits 0..30 in `combinedDirty`, bits 31..61 in `combinedDirtyHi`).\n let state = inst.state\n let combinedDirty = 0\n let combinedDirtyHi = 0\n const allEffects: E[] = []\n\n const defUpdate = inst.def.update\n // Path-keyed reactivity: when the compiler emits `__prefixes`, dirty\n // bits correspond to entries in the prefix table (one bit per minimal\n // reference-stable prefix read across the component's accessors). The\n // runtime computes the dirty mask by reference-comparing `prefix(prev)\n // !== prefix(next)` for each table entry — precise per-prefix and\n // supports two-word emission for up to 62 prefixes. Components compiled\n // without `__llui/vite-plugin` (or with no reactive accessors) have no\n // `__prefixes` table; they fall back to `FULL_MASK` and pay the cost\n // of re-evaluating every binding every cycle. User-authored `__dirty`\n // is no longer accepted — see types.ts for the rationale.\n const prefixes = inst.def.__prefixes as ReadonlyArray<(s: unknown) => unknown> | undefined\n for (let qi = 0; qi < queue.length; qi++) {\n const msg = queue[qi]!\n const [newState, effects] = defUpdate(state, msg)\n let dirty: number | [number, number]\n if (prefixes !== undefined) {\n dirty = computeDirtyFromPrefixes(prefixes, state, newState)\n } else {\n dirty = FULL_MASK\n }\n if (typeof dirty === 'number') {\n combinedDirty |= dirty\n } else {\n combinedDirty |= dirty[0]\n combinedDirtyHi |= dirty[1]\n }\n state = newState\n // Avoid spread — allocates an iterator per call. For typical effect\n // arrays (0-2 elements) this is a minor saving; for bursts it matters.\n for (let ei = 0; ei < effects.length; ei++) allEffects.push(effects[ei]!)\n }\n queue.length = 0\n\n inst.state = state\n inst._onCommit?.(state as unknown)\n // Dev-only bookkeeping — tests read lastDirtyMask/lastEffects, prod\n // doesn't. Gating here keeps two writes out of the prod hot path.\n if (import.meta.env?.DEV) {\n inst.lastDirtyMask = combinedDirty\n inst.lastEffects = allEffects\n }\n\n // Snapshot binding count before Phase 1 — bindings added during\n // Phase 1 already have correct initial values and skip Phase 2.\n const bindings = inst.allBindings\n const bindingsBeforePhase1 = bindings.length\n\n // Set current dirty mask BEFORE Phase 1 so memo() accessors used in\n // structural primitives (e.g. each.items) can use the bitmask fast path.\n setCurrentDirtyMask(combinedDirty, combinedDirtyHi)\n\n if (inst.def.__update) {\n // Compiler-generated fast path — replaces generic Phase 1 + Phase 2.\n // `combinedDirtyHi` is passed as the trailing positional arg so\n // stale 5-param compiled bundles continue to gate correctly: they\n // ignore the extra arg, and for ≤31-prefix components `dirtyHi`\n // is always 0 anyway. Fresh compiled bundles use the 6th param\n // for precise two-word Phase 1 gating on 32..61-prefix components.\n inst.def.__update(\n state,\n combinedDirty,\n bindings,\n inst.structuralBlocks,\n bindingsBeforePhase1,\n combinedDirtyHi,\n )\n } else {\n // Generic Phase 1 + Phase 2 fallback (uncompiled components)\n genericUpdate(inst, state, combinedDirty, combinedDirtyHi, bindings, bindingsBeforePhase1)\n }\n\n // Dispatch effects after DOM updates\n for (let i = 0; i < allEffects.length; i++) {\n dispatchEffect(inst, allEffects[i]!)\n }\n}\n\nfunction genericUpdate<S, M, E>(\n inst: ComponentInstance<S, M, E>,\n state: S,\n combinedDirty: number,\n combinedDirtyHi: number,\n bindings: Binding[],\n bindingsBeforePhase1: number,\n): void {\n // Phase 1 — structural reconciliation. Structural primitives register\n // their blocks BEFORE running builders, so parents precede their nested\n // children in this array. That ordering matters: a parent's reconcile\n // may dispose the old arm, whose disposers splice nested child blocks\n // out of this shared array. Because children are always to the right\n // of their parent, the splice shifts entries left — which is safe for\n // a forward iterator that re-reads length each step.\n const blocks = inst.structuralBlocks\n for (let bi = 0; bi < blocks.length; bi++) {\n const block = blocks[bi]\n if (!block) continue\n // Two-word gate: skip when neither low nor high masks intersect.\n // `block.maskHi` is 0 for ≤31-prefix blocks, so `0 & dirtyHi === 0`\n // collapses the gate to the single-word check at runtime.\n if (!((block.mask & combinedDirty) | (block.maskHi & combinedDirtyHi))) continue\n try {\n block.reconcile(state, combinedDirty, combinedDirtyHi)\n } catch (e) {\n reportReconcileError(inst, e)\n }\n }\n\n // Phase 2 — compact + update bindings\n _runPhase2(\n state,\n combinedDirty,\n combinedDirtyHi,\n bindings,\n bindingsBeforePhase1,\n inst.def.name,\n inst._onBindingError,\n )\n}\n\n/**\n * Run a handler for a single message: call update(), reconcile blocks\n * with the given method, run Phase 2. Used by compiler-generated __handlers\n * to avoid duplicating boilerplate per message type.\n *\n * @param method 0=reconcile, 1=reconcileItems, 2=reconcileClear, 3=reconcileRemove, -1=skip blocks\n * @public — used by compiler-generated `__handlers`\n *\n * Backward-compat: pre-multi-word compiled bundles call this with 4\n * args (no `dirtyHi`). The default `dirtyHi = 0` keeps those calls\n * correct for ≤31-prefix components — the high gate always evaluates\n * to 0 so the runtime falls back to the single-word check. Components\n * with >31 prefixes need a fresh compile to start passing `dirtyHi`.\n */\nexport function _handleMsg(\n inst: ComponentInstance,\n msg: unknown,\n dirty: number,\n method: number,\n dirtyHi: number = 0,\n): [unknown, unknown[]] {\n const [s, e] = (inst.def.update as (s: unknown, m: unknown) => [unknown, unknown[]])(\n inst.state,\n msg,\n )\n inst.state = s\n inst._onCommit?.(s)\n\n // memo()-wrapped accessors (auto-generated by the compiler for\n // multi-field structural accessors like each.items / branch.on /\n // show.when) gate on `currentDirtyMask`. The generic pipeline sets\n // it before Phase 1; the single-message fast path must as well, or\n // memo short-circuits with the stale value left over from the\n // previous cycle and structural blocks reconcile against a frozen\n // input.\n setCurrentDirtyMask(dirty, dirtyHi)\n\n if (method >= 0) {\n const bl = inst.structuralBlocks\n for (let i = 0; i < bl.length; i++) {\n const block = bl[i]\n if (!block) continue\n if (!((block.mask & dirty) | (block.maskHi & dirtyHi))) continue\n try {\n // Specialized methods (`reconcileItems`, `reconcileClear`,\n // `reconcileRemove`, `reconcileChanged`) only exist on `each`\n // blocks. Non-each blocks (`show`, `branch`, `scope`) leave\n // them undefined. The compiler-side fix in `detectArrayOp`\n // already restricts these methods to single-field cases, but\n // a show()/branch() block whose mask intersects the cleared\n // field would still be silently skipped without this fallback.\n // When the specialized method is missing, run the general\n // `reconcile` path so the block's `when`/`on` accessor still\n // re-evaluates. each blocks always have the specialized\n // methods, so they keep their fast path.\n switch (method) {\n case 0:\n block.reconcile(s, dirty, dirtyHi)\n break\n case 1:\n if (block.reconcileItems) block.reconcileItems(s)\n else block.reconcile(s, dirty, dirtyHi)\n break\n case 2:\n if (block.reconcileClear) block.reconcileClear()\n else block.reconcile(s, dirty, dirtyHi)\n break\n case 3:\n if (block.reconcileRemove) block.reconcileRemove(s)\n else block.reconcile(s, dirty, dirtyHi)\n break\n default:\n // method >= 10: reconcileChanged with stride = method - 10\n if (method >= 10) {\n if (block.reconcileChanged) block.reconcileChanged(s, method - 10)\n else block.reconcile(s, dirty, dirtyHi)\n }\n break\n }\n } catch (err) {\n reportReconcileError(inst, err)\n // continue to next block — see reportReconcileError docstring\n }\n }\n }\n\n const b = inst.allBindings\n _runPhase2(s, dirty, dirtyHi, b, b.length, inst.def.name, inst._onBindingError)\n return [s, e]\n}\n\n/**\n * Phase 2: compact dead bindings + update live bindings.\n * Shared between genericUpdate and compiler-generated __update.\n * @public — used by compiler-generated `__update` functions\n *\n * `dirtyHi` defaults to 0 for backward-compat with pre-multi-word\n * compiled bundles that pass only the single-word `dirty`. Bindings\n * read paths 0..30 in `binding.mask` and paths 31..61 in\n * `binding.maskHi`; the gate ORs both AND results so the high word is\n * a no-op for ≤31-prefix components.\n */\nexport function _runPhase2(\n state: unknown,\n dirty: number,\n dirtyHi: number,\n bindings: Binding[],\n bindingsBeforePhase1: number,\n componentName?: string,\n // Optional `_onBindingError` hook. Type is duplicated here rather\n // than referenced as `ComponentInstance['_onBindingError']` because\n // the underlying field is `@internal` — stripped from the generated\n // `.d.ts` — and a public-export signature can't depend on a stripped\n // type without breaking dependent packages' typecheck.\n onBindingError?: (info: { kind: string; key?: string; message: string; stack?: string }) => void,\n): void {\n let phase2Len = bindingsBeforePhase1\n if (bindings.length > bindingsBeforePhase1 || (phase2Len > 0 && bindings[0]!.dead)) {\n let w = 0\n for (let r = 0; r < bindings.length; r++) {\n if (!bindings[r]!.dead) bindings[w++] = bindings[r]!\n }\n bindings.length = w\n phase2Len = Math.min(w, bindingsBeforePhase1)\n }\n\n if (dirty !== 0 || dirtyHi !== 0) {\n // Always catch+continue: a single accessor throw shouldn't abort\n // the rest of the bindings on the same commit. The user-visible\n // effect: a broken cell shows its previous value; sibling cells\n // stay current. In dev mode, the wrapped error (with component\n // name, kind, node descriptor, accessor source) is forwarded via\n // the `_onBindingError` hook (agent integration) or to\n // `console.error` (dev harness without an agent). The prior\n // behavior of rethrowing from `flush()` made one bad binding\n // visually break the entire view — the worst-case UX.\n const isDev = import.meta.env?.DEV && componentName\n // Single accessor label for the entire Phase 2 loop. The binding kind is\n // already part of the error message that handleBindingThrow surfaces; the\n // accessor label here serves the more specific purpose of catching\n // sample() calls reaching for a render context that isn't set during\n // the update phase. A `binding accessor` label is generic enough to apply\n // to text/attr/class/effect bindings without per-kind branching.\n enterAccessor('a binding accessor')\n try {\n for (let i = 0, len = phase2Len; i < len; i++) {\n const binding = bindings[i]!\n if (binding.dead) continue\n // Two-word gate. `maskHi` is 0 for ≤31-prefix bindings; the\n // `0 & dirtyHi === 0` branch collapses to a no-op under V8's\n // inline cache.\n if (!((binding.mask & dirty) | (binding.maskHi & dirtyHi))) continue\n if (binding.kind === 'effect') {\n try {\n binding.accessor(state)\n } catch (e) {\n handleBindingThrow(onBindingError, binding, e, isDev ? componentName : null)\n }\n continue\n }\n let newValue: unknown\n try {\n newValue = binding.accessor(state)\n } catch (e) {\n handleBindingThrow(onBindingError, binding, e, isDev ? componentName : null)\n continue\n }\n const last = binding.lastValue\n if (newValue === last || (newValue !== newValue && last !== last)) continue\n binding.lastValue = newValue\n try {\n applyBinding(binding, newValue)\n } catch (e) {\n handleBindingThrow(onBindingError, binding, e, isDev ? componentName : null)\n }\n }\n } finally {\n exitAccessor()\n }\n }\n}\n\nfunction handleBindingThrow(\n onBindingError: ComponentInstance['_onBindingError'] | undefined,\n binding: Binding,\n e: unknown,\n componentName: string | null,\n): void {\n // Dev mode: build the rich wrapped error (with accessor source,\n // node descriptor, undefined-hint detection). Prod skips the\n // bookkeeping. Either way the report flows through `_onBindingError`\n // when wired (agent setups), else falls back to console.error so\n // operators see the cause.\n const wrapped =\n componentName !== null && e instanceof Error\n ? enhanceBindingError(e, binding, componentName)\n : null\n const err = wrapped ?? (e instanceof Error ? e : new Error(String(e)))\n const stack = err.stack ? err.stack.split('\\n').slice(0, 8).join('\\n') : undefined\n const info =\n stack !== undefined\n ? { kind: String(binding.kind), key: binding.key, message: err.message, stack }\n : { kind: String(binding.kind), key: binding.key, message: err.message }\n\n if (onBindingError !== undefined) {\n try {\n onBindingError(info)\n } catch {\n // hook itself threw; fall through to console\n }\n } else if (typeof console !== 'undefined') {\n // Dev mode shows the wrapped (richer) message. Prod shows a brief\n // line — operators still see something but without the full source\n // hint that's only useful at development time.\n if (componentName !== null) {\n console.error(err)\n } else if (typeof console.warn === 'function') {\n console.warn(\n `[llui] binding accessor threw (kind=${info.kind}${info.key ? `, key=${info.key}` : ''}): ${info.message}`,\n )\n }\n }\n}\n\nfunction enhanceBindingError(err: unknown, binding: Binding, componentName: string): Error {\n // For text bindings, binding.node is the Text node — use its parent element.\n const node = binding.node\n const target = node.nodeType === 1 ? (node as Element) : (node.parentElement ?? null)\n let nodeDesc = '?'\n if (target) {\n const id = target.id ? `#${target.id}` : ''\n const cls =\n target.className && typeof target.className === 'string'\n ? `.${target.className.split(' ').filter(Boolean).slice(0, 2).join('.')}`\n : ''\n nodeDesc = `<${target.tagName.toLowerCase()}${id}${cls}>`\n if (node.nodeType === 3) nodeDesc += ' text-child'\n else if (node.nodeType === 8) nodeDesc += ' comment-child'\n }\n const keyPart = binding.key ? ` .${binding.key}` : ''\n const errMsg = err instanceof Error ? err.message : String(err)\n\n // Build accessor source hint if available\n let accessorHint = ''\n try {\n const src = binding.accessor.toString().slice(0, 80)\n accessorHint = `\\n accessor: ${src}${binding.accessor.toString().length > 80 ? '...' : ''}`\n } catch {\n // toString() may throw on revoked proxies, etc.\n }\n\n // Detect common undefined/null access pattern and add a helpful hint\n let undefinedHint = ''\n if (err instanceof TypeError && /Cannot read propert(ies|y).*of (undefined|null)/.test(errMsg)) {\n undefinedHint =\n '\\n hint: Check that your accessor handles undefined state fields (e.g., use optional chaining: s.user?.name)'\n }\n\n const wrapped = new Error(\n `[LLui] ${binding.kind}${keyPart} binding on ${nodeDesc} — accessor threw in <${componentName}>\\n` +\n ` ↳ ${errMsg}` +\n undefinedHint +\n accessorHint,\n err instanceof Error ? { cause: err } : undefined,\n )\n wrapped.stack = (err instanceof Error && err.stack) || wrapped.stack\n return wrapped\n}\n\nfunction dispatchEffect<S, M, E>(inst: ComponentInstance<S, M, E>, effect: E): void {\n const eff = effect as Record<string, unknown>\n\n // Built-in: delay\n if (eff.type === 'delay') {\n const ms = eff.ms as number\n const onDone = eff.onDone as M\n setTimeout(() => inst.send(onDone), ms)\n return\n }\n\n // Built-in: log\n if (eff.type === 'log') {\n console.log(eff.message)\n return\n }\n\n // Dev-only: record on the timeline / consult the mock registry.\n // Short-circuits real dispatch when a mock matches. Zero cost in\n // production — the guard on `_effectTimeline` is undefined unless\n // `installDevTools` populated the trackers.\n if (inst._effectTimeline !== undefined && dispatchEffectDev(inst, effect)) return\n\n // User onEffect handler\n if (inst.def.onEffect) {\n inst.def.onEffect({ effect, send: inst.send, signal: inst.signal })\n }\n}\n\n/**\n * Dev-only effect dispatch wrapper. Records the `dispatched` phase and,\n * when a mock matches, auto-delivers the mocked response through the\n * effect's own `onSuccess` callback on a microtask (same timing contract\n * as a real async resolve). Non-matched effects are tracked as pending\n * so `llui_pending_effects` / `llui_resolve_effect` can observe them.\n *\n * @returns `true` when a mock matched (caller should skip the real\n * dispatch) or `false` to proceed with the user-provided onEffect.\n */\nfunction dispatchEffectDev<S, M, E>(inst: ComponentInstance<S, M, E>, effect: E): boolean {\n const timeline = inst._effectTimeline\n if (timeline === undefined) return false\n\n const eff = effect as Record<string, unknown>\n const id = newEffectId()\n const type = typeof eff.type === 'string' ? eff.type : '<unknown>'\n const dispatchedAt = Date.now()\n\n const mock = inst._effectMocks?.match(effect)\n if (mock) {\n timeline.push({ effectId: id, type, phase: 'dispatched', timestamp: dispatchedAt })\n // Auto-deliver the mocked response via the effect's onSuccess callback (if any).\n // This mirrors what the real dispatch would do, so the component receives a Msg\n // from the mocked effect without any network/IO happening.\n const payload = effect as Record<string, unknown>\n if (typeof payload.onSuccess === 'function') {\n const msg = (payload.onSuccess as (d: unknown) => unknown)(mock.response)\n // Schedule delivery as a microtask so it runs after the current update\n // cycle completes (same timing contract as a real async effect resolve).\n Promise.resolve().then(() => inst.send(msg as never))\n }\n timeline.push({\n effectId: id,\n type,\n phase: 'resolved-mocked',\n timestamp: dispatchedAt,\n durationMs: 0,\n })\n return true\n }\n\n timeline.push({ effectId: id, type, phase: 'dispatched', timestamp: dispatchedAt })\n inst._pendingEffects?.push({ id, type, dispatchedAt, status: 'queued', payload: effect })\n return false\n}\n\nfunction newEffectId(): string {\n const cryptoObj = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto\n if (cryptoObj?.randomUUID) return cryptoObj.randomUUID()\n return `eff-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llui/dom",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {