@llui/dom 0.2.1 → 0.3.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/index.d.ts CHANGED
@@ -4,7 +4,6 @@ export { createView, type View } from './view-helpers.js';
4
4
  export { combine, type SliceReducer, type SliceMap, type TopReducer } from './combine.js';
5
5
  export { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor, type MountOptions } from './mount.js';
6
6
  export type { BindingDescriptor } from './binding-descriptors.js';
7
- export { __registerScopeVariants } from './binding-descriptors.js';
8
7
  export { tagSend } from './binding-descriptors.js';
9
8
  export type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js';
10
9
  export type { CoverageSnapshot } from './tracking/coverage.js';
@@ -37,14 +36,12 @@ export { sample } from './primitives/sample.js';
37
36
  export { selector } from './primitives/selector.js';
38
37
  export { onMount } from './primitives/on-mount.js';
39
38
  export { track, LluiCompilerSkippedError, type TrackOptions } from './primitives/track.js';
40
- export { clientOnly, __clientOnlyStub, type ClientOnlyOptions } from './primitives/client-only.js';
39
+ export { clientOnly, type ClientOnlyOptions } from './primitives/client-only.js';
41
40
  export { errorBoundary } from './primitives/error-boundary.js';
42
41
  export { a, abbr, article, aside, b, blockquote, br, button, canvas, code, dd, details, dialog, div, dl, dt, em, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hr, i, iframe, img, input, label, legend, li, main, mark, nav, ol, optgroup, option, output, p, pre, progress, section, select, small, span, strong, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, tr, ul, video, } from './elements.js';
43
42
  export { svg, g, defs, symbol, use, circle, ellipse, line, path, polygon, polyline, rect, text as svgText, tspan, textPath, clipPath, linearGradient, radialGradient, stop, mask, pattern, marker, filter, feBlend, feColorMatrix, feComponentTransfer, feComposite, feConvolveMatrix, feDiffuseLighting, feDisplacementMap, feDropShadow, feFlood, feGaussianBlur, feImage, feMerge, feMergeNode, feMorphology, feOffset, feSpecularLighting, feTile, feTurbulence, fePointLight, feSpotLight, feDistantLight, feFuncR, feFuncG, feFuncB, feFuncA, image, foreignObject, animate, animateMotion, animateTransform, set, mpath, desc, title as svgTitle, metadata, } from './svg-elements.js';
44
43
  export { math, mi, mn, mo, ms, mtext, mrow, mfrac, msqrt, mroot, msup, msub, msubsup, munder, mover, munderover, mmultiscripts, mprescripts, mnone, mtable, mtr, mtd, mspace, mpadded, mphantom, menclose, merror, maction, semantics, annotation, annotationXml, } from './mathml-elements.js';
45
44
  export { applyField, type FieldMsg } from './form.js';
46
45
  export { elSplit } from './el-split.js';
47
- export { __bindUncertain } from './binding.js';
48
- export { elTemplate, __cloneStaticTemplate } from './el-template.js';
49
- export { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js';
46
+ export { elTemplate } from './el-template.js';
50
47
  //# sourceMappingURL=index.d.ts.map
@@ -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,GACf,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,E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,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAE,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAIrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA"}
package/dist/index.js CHANGED
@@ -9,7 +9,9 @@ export { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor } from './mount.js
9
9
  // pattern. User code never imports this directly — the vite-plugin's
10
10
  // connect-pattern matcher inserts the import + call sites
11
11
  // automatically alongside the existing event-handler tagger.
12
- export { __registerScopeVariants } from './binding-descriptors.js';
12
+ // `__registerScopeVariants` itself moved to `@llui/dom/internal` so the
13
+ // vite-plugin's post-bundle rename pass can't rewrite it inside a
14
+ // module-external import specifier — see internal.ts header.
13
15
  // Library helper for `*.connect` implementations — tags returned
14
16
  // event handlers with the variants they dispatch, so the runtime
15
17
  // binding-descriptor registry surfaces them to the agent layer's
@@ -40,7 +42,7 @@ export { sample } from './primitives/sample.js';
40
42
  export { selector } from './primitives/selector.js';
41
43
  export { onMount } from './primitives/on-mount.js';
42
44
  export { track, LluiCompilerSkippedError } from './primitives/track.js';
43
- export { clientOnly, __clientOnlyStub } from './primitives/client-only.js';
45
+ export { clientOnly } from './primitives/client-only.js';
44
46
  export { errorBoundary } from './primitives/error-boundary.js';
45
47
  // ── Element Helpers ───────────────────────────────────────────────
46
48
  export { a, abbr, article, aside, b, blockquote, br, button, canvas, code, dd, details, dialog, div, dl, dt, em, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hr, i, iframe, img, input, label, legend, li, main, mark, nav, ol, optgroup, option, output, p, pre, progress, section, select, small, span, strong, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, tr, ul, video, } from './elements.js';
@@ -52,7 +54,13 @@ export { math, mi, mn, mo, ms, mtext, mrow, mfrac, msqrt, mroot, msup, msub, msu
52
54
  export { applyField } from './form.js';
53
55
  // ── Compiler Target ───────────────────────────────────────────────
54
56
  export { elSplit } from './el-split.js';
55
- export { __bindUncertain } from './binding.js';
56
- export { elTemplate, __cloneStaticTemplate } from './el-template.js';
57
- export { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js';
57
+ export { elTemplate } from './el-template.js';
58
+ // Compiler-emitted runtime helpers (`__bindUncertain`,
59
+ // `__cloneStaticTemplate`, `__runPhase2`, `__handleMsg`,
60
+ // `__registerScopeVariants`, `__clientOnlyStub`) moved to
61
+ // `@llui/dom/internal`. The compiler now emits
62
+ // `import { … } from '@llui/dom/internal'` for those, so the
63
+ // vite-plugin's post-bundle property-rename pass never rewrites a
64
+ // name inside a module-external `@llui/dom` import specifier. See
65
+ // internal.ts for the rationale and issue-#5-follow-up notes.
58
66
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
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,0BAA0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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 { track, LluiCompilerSkippedError, type TrackOptions } from './primitives/track.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 { __bindUncertain } from './binding.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,EAA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AA;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,MAAM,kBAAkB,CAAA;AAE7C,uDAAuD;AACvD,yDAAyD;AACzD,0DAA0D;AAC1D,+CAA+C;AAC/C,6DAA6D;AAC7D,kEAAkE;AAClE,kEAAkE;AAClE,8DAA8D","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.\n// `__registerScopeVariants` itself moved to `@llui/dom/internal` so the\n// vite-plugin's post-bundle rename pass can't rewrite it inside a\n// module-external import specifier — see internal.ts header.\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 { track, LluiCompilerSkippedError, type TrackOptions } from './primitives/track.js'\nexport { clientOnly, 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 } from './el-template.js'\n\n// Compiler-emitted runtime helpers (`__bindUncertain`,\n// `__cloneStaticTemplate`, `__runPhase2`, `__handleMsg`,\n// `__registerScopeVariants`, `__clientOnlyStub`) moved to\n// `@llui/dom/internal`. The compiler now emits\n// `import { … } from '@llui/dom/internal'` for those, so the\n// vite-plugin's post-bundle property-rename pass never rewrites a\n// name inside a module-external `@llui/dom` import specifier. See\n// internal.ts for the rationale and issue-#5-follow-up notes.\n"]}
@@ -1,23 +1,39 @@
1
1
  /**
2
- * Internal primitives surface — exported for framework-adapter packages
3
- * (`@llui/vike`, `@llui/router`, `@llui/transitions`) that need to build
4
- * their own structural primitives on top of LLui's scope + render-context
5
- * machinery.
2
+ * Internal surface — exported for two consumer categories:
3
+ *
4
+ * 1. **Framework-adapter packages** (`@llui/vike`, `@llui/router`,
5
+ * `@llui/transitions`) that build their own structural primitives
6
+ * on top of LLui's scope + render-context machinery.
7
+ * 2. **Compiler-emitted runtime helpers** that the LLui compiler
8
+ * synthesizes imports for: `__bindUncertain`, `__cloneStaticTemplate`,
9
+ * `__runPhase2`, `__handleMsg`, `__registerScopeVariants`,
10
+ * `__clientOnlyStub`. These are never written by hand — the compiler's
11
+ * `cleanupImports` pass inserts the import declaration into the
12
+ * transformed module.
6
13
  *
7
14
  * **Not part of the public API.** App authors should not import from
8
15
  * `@llui/dom/internal`. The shapes here are free to change without a
9
16
  * major version bump — the stability contract applies only to the public
10
- * barrel at `@llui/dom`. Reach for this subpath when you're writing a
11
- * primitive like `pageSlot()` (from `@llui/vike`) that has to participate
12
- * in the scope tree, not when you're writing application views.
17
+ * barrel at `@llui/dom`.
13
18
  *
14
- * Added in 0.0.16 to support `@llui/vike`'s persistent-layout feature.
15
- * Any future adapter-level primitive that needs render-context / scope
16
- * access should re-export from this file rather than duplicating the
17
- * low-level glue.
19
+ * Why these helpers live on a subpath instead of the root barrel: when a
20
+ * downstream Vite SSR build externalizes `@llui/dom`, the chunk retains
21
+ * `import { __cloneStaticTemplate } from "@llui/dom"` and the vite-plugin's
22
+ * post-bundle property-rename pass rewrites the identifier. The renamed
23
+ * name (`$a` / `$b` / …) doesn't exist on the package's public export
24
+ * surface, and rolldown fails with `MISSING_EXPORT`. Hosting the helpers
25
+ * at `@llui/dom/internal` keeps the rename pass's regex (which only
26
+ * matches `__`-prefixed identifiers) from rewriting any name that
27
+ * appears in a public-surface import position. See issue #5 follow-up
28
+ * (compiler emit hygiene, 0.3.x dom / 0.4.x compiler).
18
29
  */
19
30
  export { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js';
20
31
  export type { RenderContext } from './render-context.js';
21
32
  export { createLifetime, disposeLifetime, addDisposer } from './lifetime.js';
22
33
  export { defineTestComponentInternal as defineTestComponent, stampTestVersion, type DefineTestComponentInput, } from './internal/test-component-builder.js';
34
+ export { __bindUncertain } from './binding.js';
35
+ export { __cloneStaticTemplate } from './el-template.js';
36
+ export { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js';
37
+ export { __registerScopeVariants } from './binding-descriptors.js';
38
+ export { __clientOnlyStub } from './primitives/client-only.js';
23
39
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC5F,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,EACL,2BAA2B,IAAI,mBAAmB,EAClD,gBAAgB,EAChB,KAAK,wBAAwB,GAC9B,MAAM,sCAAsC,CAAA"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC5F,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,EACL,2BAA2B,IAAI,mBAAmB,EAClD,gBAAgB,EAChB,KAAK,wBAAwB,GAC9B,MAAM,sCAAsC,CAAA;AAK7C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA"}
package/dist/internal.js CHANGED
@@ -1,22 +1,41 @@
1
1
  /**
2
- * Internal primitives surface — exported for framework-adapter packages
3
- * (`@llui/vike`, `@llui/router`, `@llui/transitions`) that need to build
4
- * their own structural primitives on top of LLui's scope + render-context
5
- * machinery.
2
+ * Internal surface — exported for two consumer categories:
3
+ *
4
+ * 1. **Framework-adapter packages** (`@llui/vike`, `@llui/router`,
5
+ * `@llui/transitions`) that build their own structural primitives
6
+ * on top of LLui's scope + render-context machinery.
7
+ * 2. **Compiler-emitted runtime helpers** that the LLui compiler
8
+ * synthesizes imports for: `__bindUncertain`, `__cloneStaticTemplate`,
9
+ * `__runPhase2`, `__handleMsg`, `__registerScopeVariants`,
10
+ * `__clientOnlyStub`. These are never written by hand — the compiler's
11
+ * `cleanupImports` pass inserts the import declaration into the
12
+ * transformed module.
6
13
  *
7
14
  * **Not part of the public API.** App authors should not import from
8
15
  * `@llui/dom/internal`. The shapes here are free to change without a
9
16
  * major version bump — the stability contract applies only to the public
10
- * barrel at `@llui/dom`. Reach for this subpath when you're writing a
11
- * primitive like `pageSlot()` (from `@llui/vike`) that has to participate
12
- * in the scope tree, not when you're writing application views.
17
+ * barrel at `@llui/dom`.
13
18
  *
14
- * Added in 0.0.16 to support `@llui/vike`'s persistent-layout feature.
15
- * Any future adapter-level primitive that needs render-context / scope
16
- * access should re-export from this file rather than duplicating the
17
- * low-level glue.
19
+ * Why these helpers live on a subpath instead of the root barrel: when a
20
+ * downstream Vite SSR build externalizes `@llui/dom`, the chunk retains
21
+ * `import { __cloneStaticTemplate } from "@llui/dom"` and the vite-plugin's
22
+ * post-bundle property-rename pass rewrites the identifier. The renamed
23
+ * name (`$a` / `$b` / …) doesn't exist on the package's public export
24
+ * surface, and rolldown fails with `MISSING_EXPORT`. Hosting the helpers
25
+ * at `@llui/dom/internal` keeps the rename pass's regex (which only
26
+ * matches `__`-prefixed identifiers) from rewriting any name that
27
+ * appears in a public-surface import position. See issue #5 follow-up
28
+ * (compiler emit hygiene, 0.3.x dom / 0.4.x compiler).
18
29
  */
19
30
  export { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js';
20
31
  export { createLifetime, disposeLifetime, addDisposer } from './lifetime.js';
21
32
  export { defineTestComponentInternal as defineTestComponent, stampTestVersion, } from './internal/test-component-builder.js';
33
+ // Compiler-emitted runtime helpers. The compiler's `cleanupImports`
34
+ // pass inserts an `import { … } from '@llui/dom/internal'` declaration
35
+ // referencing whichever of these are used in the transformed file.
36
+ export { __bindUncertain } from './binding.js';
37
+ export { __cloneStaticTemplate } from './el-template.js';
38
+ export { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js';
39
+ export { __registerScopeVariants } from './binding-descriptors.js';
40
+ export { __clientOnlyStub } from './primitives/client-only.js';
22
41
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE5F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,EACL,2BAA2B,IAAI,mBAAmB,EAClD,gBAAgB,GAEjB,MAAM,sCAAsC,CAAA","sourcesContent":["/**\n * Internal primitives surface — exported for framework-adapter packages\n * (`@llui/vike`, `@llui/router`, `@llui/transitions`) that need to build\n * their own structural primitives on top of LLui's scope + render-context\n * machinery.\n *\n * **Not part of the public API.** App authors should not import from\n * `@llui/dom/internal`. The shapes here are free to change without a\n * major version bump — the stability contract applies only to the public\n * barrel at `@llui/dom`. Reach for this subpath when you're writing a\n * primitive like `pageSlot()` (from `@llui/vike`) that has to participate\n * in the scope tree, not when you're writing application views.\n *\n * Added in 0.0.16 to support `@llui/vike`'s persistent-layout feature.\n * Any future adapter-level primitive that needs render-context / scope\n * access should re-export from this file rather than duplicating the\n * low-level glue.\n */\n\nexport { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js'\nexport type { RenderContext } from './render-context.js'\nexport { createLifetime, disposeLifetime, addDisposer } from './lifetime.js'\nexport {\n defineTestComponentInternal as defineTestComponent,\n stampTestVersion,\n type DefineTestComponentInput,\n} from './internal/test-component-builder.js'\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAE5F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,EACL,2BAA2B,IAAI,mBAAmB,EAClD,gBAAgB,GAEjB,MAAM,sCAAsC,CAAA;AAE7C,oEAAoE;AACpE,uEAAuE;AACvE,mEAAmE;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACvF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA","sourcesContent":["/**\n * Internal surface — exported for two consumer categories:\n *\n * 1. **Framework-adapter packages** (`@llui/vike`, `@llui/router`,\n * `@llui/transitions`) that build their own structural primitives\n * on top of LLui's scope + render-context machinery.\n * 2. **Compiler-emitted runtime helpers** that the LLui compiler\n * synthesizes imports for: `__bindUncertain`, `__cloneStaticTemplate`,\n * `__runPhase2`, `__handleMsg`, `__registerScopeVariants`,\n * `__clientOnlyStub`. These are never written by hand — the compiler's\n * `cleanupImports` pass inserts the import declaration into the\n * transformed module.\n *\n * **Not part of the public API.** App authors should not import from\n * `@llui/dom/internal`. The shapes here are free to change without a\n * major version bump — the stability contract applies only to the public\n * barrel at `@llui/dom`.\n *\n * Why these helpers live on a subpath instead of the root barrel: when a\n * downstream Vite SSR build externalizes `@llui/dom`, the chunk retains\n * `import { __cloneStaticTemplate } from \"@llui/dom\"` and the vite-plugin's\n * post-bundle property-rename pass rewrites the identifier. The renamed\n * name (`$a` / `$b` / …) doesn't exist on the package's public export\n * surface, and rolldown fails with `MISSING_EXPORT`. Hosting the helpers\n * at `@llui/dom/internal` keeps the rename pass's regex (which only\n * matches `__`-prefixed identifiers) from rewriting any name that\n * appears in a public-surface import position. See issue #5 follow-up\n * (compiler emit hygiene, 0.3.x dom / 0.4.x compiler).\n */\n\nexport { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js'\nexport type { RenderContext } from './render-context.js'\nexport { createLifetime, disposeLifetime, addDisposer } from './lifetime.js'\nexport {\n defineTestComponentInternal as defineTestComponent,\n stampTestVersion,\n type DefineTestComponentInput,\n} from './internal/test-component-builder.js'\n\n// Compiler-emitted runtime helpers. The compiler's `cleanupImports`\n// pass inserts an `import { … } from '@llui/dom/internal'` declaration\n// referencing whichever of these are used in the transformed file.\nexport { __bindUncertain } from './binding.js'\nexport { __cloneStaticTemplate } from './el-template.js'\nexport { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js'\nexport { __registerScopeVariants } from './binding-descriptors.js'\nexport { __clientOnlyStub } from './primitives/client-only.js'\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAA;AA6B1D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAC9D,IAAI,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC3B,IAAI,EAAE,CA6KR"}
1
+ {"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAA;AA4B1D,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAC9D,IAAI,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC3B,IAAI,EAAE,CA6KR"}
@@ -3,10 +3,9 @@ import { createLifetime, disposeLifetime, addDisposer } from '../lifetime.js';
3
3
  import { setFlatBindings } from '../binding.js';
4
4
  import { getInstanceViewBag } from '../render-context.js';
5
5
  // v0.4 Tier 1.2 + cache follow-up: pulls a cached View bag from the
6
- // owning instance (constructed once via `def.__view(send)`). The
7
- // createView fallback below is dead-code-eliminated in production
8
- // builds Vite folds `import.meta.env.MODE` to a constant inside
9
- // getInstanceViewBag.
6
+ // owning instance (constructed once via `def.__view(send)`). Falls
7
+ // back to `createView(send)` when no `__view` was emitted — see
8
+ // getInstanceViewBag for the mode-agnostic fallback (issue #5).
10
9
  function getOwnerBag(ctx, send) {
11
10
  return getInstanceViewBag(ctx.instance, send);
12
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAGzD,oEAAoE;AACpE,iEAAiE;AACjE,kEAAkE;AAClE,kEAAkE;AAClE,sBAAsB;AACtB,SAAS,WAAW,CAClB,GAAiD,EACjD,IAAmC;IAEnC,OAAO,kBAAkB,CAAO,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAe,CAAA;AACnE,CAAC;AACD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG9E,MAAM,UAAU,MAAM,CACpB,IAA4B;IAE5B,MAAM,GAAG,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACtC,MAAM,cAAc,GAAG,GAAG,CAAC,YAAY,CAAA;IACvC,MAAM,MAAM,GAAG,GAAG,CAAC,gBAAgB,CAAA;IACnC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAwB,CAAA;IAEzC,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IAE9C,2EAA2E;IAC3E,yEAAyE;I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C,CAAA;QACxD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU;YAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QAC5D,IAAI,eAAe,EAAE,CAAC;YACpB,eAAe,CAAC,eAAe,CAAC,CAAA;YAChC,eAAe,GAAG,IAAI,CAAA;QACxB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import type { BranchOptions, Lifetime } from '../types.js'\nimport {\n getRenderContext,\n setRenderContext,\n clearRenderContext,\n enterAccessor,\n exitAccessor,\n} from '../render-context.js'\nimport { createLifetime, disposeLifetime, addDisposer } from '../lifetime.js'\nimport { setFlatBindings } from '../binding.js'\nimport type { View } from '../view-helpers.js'\nimport { getInstanceViewBag } from '../render-context.js'\nimport type { ComponentInstance } from '../update-loop.js'\n\n// v0.4 Tier 1.2 + cache follow-up: pulls a cached View bag from the\n// owning instance (constructed once via `def.__view(send)`). The\n// createView fallback below is dead-code-eliminated in production\n// builds — Vite folds `import.meta.env.MODE` to a constant inside\n// getInstanceViewBag.\nfunction getOwnerBag<S, M>(\n ctx: { instance?: ComponentInstance | undefined },\n send: import('../types.js').Send<M>,\n): View<S, M> {\n return getInstanceViewBag<S, M>(ctx.instance, send) as View<S, M>\n}\nimport { FULL_MASK } from '../update-loop.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './on-mount.js'\nimport type { StructuralBlock } from '../structural.js'\n\nexport function branch<S, M = unknown, K extends string = string>(\n opts: BranchOptions<S, M, K>,\n): Node[] {\n const ctx = getRenderContext('branch')\n const parentLifetime = ctx.rootLifetime\n const blocks = ctx.structuralBlocks\n const send = ctx.send as (msg: M) => void\n\n const anchor = ctx.dom.createComment('branch')\n\n // `on` accessor wrapped so sample()/h.sample() called from inside throws a\n // targeted error. Both initial and reconcile paths route through callOn.\n // `Discriminant<S, K>` is `((s: S) => K) | (() => K)` — passing `state`\n // works for either arm at runtime (zero-arg ignores the extra), but a\n // typed wrapper forces a union-call inference TypeScript can't unify.\n // The runtime cast keeps the wrapper transparent.\n const callOn = (state: S) => {\n enterAccessor('branch().on')\n try {\n return (opts.on as (s: S) => K)(state)\n } finally {\n exitAccessor()\n }\n }\n\n let currentKey = callOn(ctx.state as S)\n let currentLifetime: Lifetime | null = null\n let currentNodes: Node[] = []\n\n const block: StructuralBlock = {\n mask: (opts as { __mask?: number }).__mask ?? FULL_MASK,\n maskHi: (opts as { __maskHi?: number }).__maskHi ?? 0,\n reconcile(state: unknown) {\n const newKey = callOn(state as S)\n if (Object.is(newKey, currentKey)) return\n\n const parent = anchor.parentNode\n if (!parent) return\n\n const leavingNodes = currentNodes\n const leavingLifetime = currentLifetime\n\n // Build new arm first (before removing old — for FLIP animations)\n currentNodes = []\n currentLifetime = null\n currentKey = newKey\n\n const newCaseKey = String(newKey) as K\n const newBuilder = opts.cases?.[newCaseKey] ?? opts.default\n // Collect onMount callbacks from the new case into a local queue,\n // then flush them SYNCHRONOUSLY after the new nodes are inserted.\n // Without this, onMount inside a branch case would see stale DOM\n // (nodes not yet attached) OR fall back to queueMicrotask and\n // race with synchronous event dispatches after the reconcile.\n let onMountQueue: Array<() => void> | null = null\n if (newBuilder) {\n const mq = pushMountQueue()\n onMountQueue = mq.queue\n currentLifetime = createLifetime(parentLifetime)\n if (import.meta.env?.DEV) {\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n }\n setFlatBindings(ctx.allBindings)\n setRenderContext({ ...ctx, rootLifetime: currentLifetime, state })\n currentNodes = newBuilder(getOwnerBag<S, M>(ctx, send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(mq.prev)\n\n const ref = anchor.nextSibling\n for (const node of currentNodes) {\n parent.insertBefore(node, ref)\n }\n }\n if (onMountQueue) flushMountQueue(onMountQueue)\n\n // Fire enter for new nodes\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n\n // Handle leave — may be deferred via Promise\n const removeOld = () => {\n for (const node of leavingNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (leavingLifetime) {\n // Tag BEFORE dispose so the disposer log records the cause.\n // `show()` passes `__disposalCause: 'show-hide'`; raw branch()\n // defaults to `'branch-swap'`. Tag wins over any pre-existing\n // value set by an inner primitive so the outermost cause is\n // reported (matches how humans describe the event).\n if (import.meta.env?.DEV)\n leavingLifetime.disposalCause = opts.__disposalCause ?? 'branch-swap'\n disposeLifetime(leavingLifetime)\n }\n }\n\n if (leavingNodes.length > 0 && opts.leave) {\n const result = opts.leave(leavingNodes)\n if (result && typeof (result as Promise<void>).then === 'function') {\n ;(result as Promise<void>).then(removeOld)\n } else {\n removeOld()\n }\n } else {\n removeOld()\n }\n },\n }\n\n // Register the block BEFORE running the initial builder so that parent\n // blocks always precede their nested children in the flat blocks array.\n // This guarantees correct Phase 1 iteration order: parents reconcile\n // first, so a parent that unmounts its old arm can dispose nested child\n // blocks (splicing them out of this array) without corrupting the loop\n // index — the splice only affects entries to the RIGHT of the parent.\n blocks.push(block)\n\n const caseKey = String(currentKey) as K\n const builder = opts.cases?.[caseKey] ?? opts.default\n // Initial-mount onMount callbacks are handled by the outer mountApp\n // queue — we're still inside the first view() call. branch doesn't\n // insert into the DOM at this point (the anchor + initial children\n // are returned to the parent), so we don't need to flush here.\n if (builder) {\n currentLifetime = createLifetime(parentLifetime)\n if (import.meta.env?.DEV) {\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n }\n setRenderContext({ ...ctx, rootLifetime: currentLifetime })\n currentNodes = builder(getOwnerBag<S, M>(ctx, send))\n clearRenderContext()\n setRenderContext(ctx)\n\n // Fire enter on initial mount\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n }\n\n addDisposer(parentLifetime, () => {\n const idx = blocks.indexOf(block)\n if (idx !== -1) blocks.splice(idx, 1)\n // Remove arm DOM nodes + the anchor. The parent's own cleanup\n // (e.g. an outer branch's removeOld) only walks what its initial\n // render captured — nodes that THIS branch inserted into the\n // shared parent AFTER the outer's snapshot (including every\n // arm swap since initial mount) aren't in that list. Walking\n // `currentNodes` here and guarding with `parentNode` closes the\n // leak: if the parent DOM is already cascade-removed by an\n // ancestor, `node.parentNode` is null and the removeChild\n // no-ops. If the parent is still live (spread-into-arm case),\n // the removal is what cleans up the orphans.\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (anchor.parentNode) anchor.parentNode.removeChild(anchor)\n if (currentLifetime) {\n disposeLifetime(currentLifetime)\n currentLifetime = null\n }\n })\n\n return [anchor, ...currentNodes]\n}\n"]}
1
+ {"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,YAAY,GACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAGzD,oEAAoE;AACpE,mEAAmE;AACnE,gEAAgE;AAChE,gEAAgE;AAChE,SAAS,WAAW,CAClB,GAAiD,EACjD,IAAmC;IAEnC,OAAO,kBAAkB,CAAO,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAe,CAAA;AACnE,CAAC;AACD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG9E,MAAM,UAAU,MAAM,CACpB,IAA4B;IAE5B,MAAM,GAA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CAAC,CAAC,CAAA;QACrC,8DAA8D;QAC9D,iEAAiE;QACjE,6DAA6D;QAC7D,4DAA4D;QAC5D,6DAA6D;QAC7D,gEAAgE;QAChE,2DAA2D;QAC3D,0DAA0D;QAC1D,8DAA8D;QAC9D,6CAA6C;QAC7C,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;YAChC,IAAI,IAAI,CAAC,UAAU;gBAAE,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;QACxD,CAAC;QACD,IAAI,MAAM,CAAC,UAAU;YAAE,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QAC5D,IAAI,eAAe,EAAE,CAAC;YACpB,eAAe,CAAC,eAAe,CAAC,CAAA;YAChC,eAAe,GAAG,IAAI,CAAA;QACxB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import type { BranchOptions, Lifetime } from '../types.js'\nimport {\n getRenderContext,\n setRenderContext,\n clearRenderContext,\n enterAccessor,\n exitAccessor,\n} from '../render-context.js'\nimport { createLifetime, disposeLifetime, addDisposer } from '../lifetime.js'\nimport { setFlatBindings } from '../binding.js'\nimport type { View } from '../view-helpers.js'\nimport { getInstanceViewBag } from '../render-context.js'\nimport type { ComponentInstance } from '../update-loop.js'\n\n// v0.4 Tier 1.2 + cache follow-up: pulls a cached View bag from the\n// owning instance (constructed once via `def.__view(send)`). Falls\n// back to `createView(send)` when no `__view` was emitted — see\n// getInstanceViewBag for the mode-agnostic fallback (issue #5).\nfunction getOwnerBag<S, M>(\n ctx: { instance?: ComponentInstance | undefined },\n send: import('../types.js').Send<M>,\n): View<S, M> {\n return getInstanceViewBag<S, M>(ctx.instance, send) as View<S, M>\n}\nimport { FULL_MASK } from '../update-loop.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './on-mount.js'\nimport type { StructuralBlock } from '../structural.js'\n\nexport function branch<S, M = unknown, K extends string = string>(\n opts: BranchOptions<S, M, K>,\n): Node[] {\n const ctx = getRenderContext('branch')\n const parentLifetime = ctx.rootLifetime\n const blocks = ctx.structuralBlocks\n const send = ctx.send as (msg: M) => void\n\n const anchor = ctx.dom.createComment('branch')\n\n // `on` accessor wrapped so sample()/h.sample() called from inside throws a\n // targeted error. Both initial and reconcile paths route through callOn.\n // `Discriminant<S, K>` is `((s: S) => K) | (() => K)` — passing `state`\n // works for either arm at runtime (zero-arg ignores the extra), but a\n // typed wrapper forces a union-call inference TypeScript can't unify.\n // The runtime cast keeps the wrapper transparent.\n const callOn = (state: S) => {\n enterAccessor('branch().on')\n try {\n return (opts.on as (s: S) => K)(state)\n } finally {\n exitAccessor()\n }\n }\n\n let currentKey = callOn(ctx.state as S)\n let currentLifetime: Lifetime | null = null\n let currentNodes: Node[] = []\n\n const block: StructuralBlock = {\n mask: (opts as { __mask?: number }).__mask ?? FULL_MASK,\n maskHi: (opts as { __maskHi?: number }).__maskHi ?? 0,\n reconcile(state: unknown) {\n const newKey = callOn(state as S)\n if (Object.is(newKey, currentKey)) return\n\n const parent = anchor.parentNode\n if (!parent) return\n\n const leavingNodes = currentNodes\n const leavingLifetime = currentLifetime\n\n // Build new arm first (before removing old — for FLIP animations)\n currentNodes = []\n currentLifetime = null\n currentKey = newKey\n\n const newCaseKey = String(newKey) as K\n const newBuilder = opts.cases?.[newCaseKey] ?? opts.default\n // Collect onMount callbacks from the new case into a local queue,\n // then flush them SYNCHRONOUSLY after the new nodes are inserted.\n // Without this, onMount inside a branch case would see stale DOM\n // (nodes not yet attached) OR fall back to queueMicrotask and\n // race with synchronous event dispatches after the reconcile.\n let onMountQueue: Array<() => void> | null = null\n if (newBuilder) {\n const mq = pushMountQueue()\n onMountQueue = mq.queue\n currentLifetime = createLifetime(parentLifetime)\n if (import.meta.env?.DEV) {\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n }\n setFlatBindings(ctx.allBindings)\n setRenderContext({ ...ctx, rootLifetime: currentLifetime, state })\n currentNodes = newBuilder(getOwnerBag<S, M>(ctx, send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(mq.prev)\n\n const ref = anchor.nextSibling\n for (const node of currentNodes) {\n parent.insertBefore(node, ref)\n }\n }\n if (onMountQueue) flushMountQueue(onMountQueue)\n\n // Fire enter for new nodes\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n\n // Handle leave — may be deferred via Promise\n const removeOld = () => {\n for (const node of leavingNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (leavingLifetime) {\n // Tag BEFORE dispose so the disposer log records the cause.\n // `show()` passes `__disposalCause: 'show-hide'`; raw branch()\n // defaults to `'branch-swap'`. Tag wins over any pre-existing\n // value set by an inner primitive so the outermost cause is\n // reported (matches how humans describe the event).\n if (import.meta.env?.DEV)\n leavingLifetime.disposalCause = opts.__disposalCause ?? 'branch-swap'\n disposeLifetime(leavingLifetime)\n }\n }\n\n if (leavingNodes.length > 0 && opts.leave) {\n const result = opts.leave(leavingNodes)\n if (result && typeof (result as Promise<void>).then === 'function') {\n ;(result as Promise<void>).then(removeOld)\n } else {\n removeOld()\n }\n } else {\n removeOld()\n }\n },\n }\n\n // Register the block BEFORE running the initial builder so that parent\n // blocks always precede their nested children in the flat blocks array.\n // This guarantees correct Phase 1 iteration order: parents reconcile\n // first, so a parent that unmounts its old arm can dispose nested child\n // blocks (splicing them out of this array) without corrupting the loop\n // index — the splice only affects entries to the RIGHT of the parent.\n blocks.push(block)\n\n const caseKey = String(currentKey) as K\n const builder = opts.cases?.[caseKey] ?? opts.default\n // Initial-mount onMount callbacks are handled by the outer mountApp\n // queue — we're still inside the first view() call. branch doesn't\n // insert into the DOM at this point (the anchor + initial children\n // are returned to the parent), so we don't need to flush here.\n if (builder) {\n currentLifetime = createLifetime(parentLifetime)\n if (import.meta.env?.DEV) {\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n }\n setRenderContext({ ...ctx, rootLifetime: currentLifetime })\n currentNodes = builder(getOwnerBag<S, M>(ctx, send))\n clearRenderContext()\n setRenderContext(ctx)\n\n // Fire enter on initial mount\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n }\n\n addDisposer(parentLifetime, () => {\n const idx = blocks.indexOf(block)\n if (idx !== -1) blocks.splice(idx, 1)\n // Remove arm DOM nodes + the anchor. The parent's own cleanup\n // (e.g. an outer branch's removeOld) only walks what its initial\n // render captured — nodes that THIS branch inserted into the\n // shared parent AFTER the outer's snapshot (including every\n // arm swap since initial mount) aren't in that list. Walking\n // `currentNodes` here and guarding with `parentNode` closes the\n // leak: if the parent DOM is already cascade-removed by an\n // ancestor, `node.parentNode` is null and the removeChild\n // no-ops. If the parent is still live (spread-into-arm case),\n // the removal is what cleans up the orphans.\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (anchor.parentNode) anchor.parentNode.removeChild(anchor)\n if (currentLifetime) {\n disposeLifetime(currentLifetime)\n currentLifetime = null\n }\n })\n\n return [anchor, ...currentNodes]\n}\n"]}
@@ -42,10 +42,15 @@ export declare function currentAccessor(): string | null;
42
42
  * Cache key is the instance: `send` is identity-stable per instance,
43
43
  * so the bag's bound `send` is correct for every call site that
44
44
  * receives it. The cache invalidates implicitly on instance disposal.
45
- * In test mode (no compiler-emitted `__view`) we fall through to
46
- * `createView` per call tests don't measure perf, and the
47
- * createView reference is gone from production via the Vite-time MODE
48
- * fold (see mount.ts buildViewBag for the same pattern).
45
+ * When no `__view` factory is present (hand-rolled ComponentDef in
46
+ * tests, or some other unusual path), fall through to `createView` so
47
+ * the bag is complete. The compiler emits `__view` for every
48
+ * `component({...})` call including identifier-param view functions
49
+ * (`view: (h) => ...`) where it emits a factory that itself calls
50
+ * `createView`. So this fallback is genuinely "shouldn't happen" in
51
+ * compiled code, but staying safe is cheap and the alternative
52
+ * (a `{ send }`-only bag in prod) is a guaranteed crash for any
53
+ * helper that reads `h.show`, `h.each`, etc.
49
54
  */
50
55
  export declare function getInstanceViewBag<S, M>(inst: ComponentInstance | undefined, send: Send<M>): unknown;
51
56
  export declare function getRenderContext(primitiveName?: string): RenderContext;
@@ -1 +1 @@
1
- {"version":3,"file":"render-context.d.ts","sourceRoot":"","sources":["../src/render-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,GAAG,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,OAAO,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KACvC;CACF;AAED,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,QAAQ,CAAA;IACtB,KAAK,EAAE,OAAO,CAAA;IACd,WAAW,EAAE,OAAO,EAAE,CAAA;IACtB,gBAAgB,EAAE,eAAe,EAAE,CAAA;IACnC,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAC7B;;;;;;OAMG;IACH,GAAG,EAAE,MAAM,CAAA;CAMZ;AAID,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAEzD;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAaD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEj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I,IAAI,CAEzC;AAaD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,wBAAgB,eAAe,IAAI,MAAM,GAAG,IAAI,CAG/C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EACrC,IAAI,EAAE,iBAAiB,GAAG,SAAS,EACnC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GACZ,OAAO,CAOT;AAED,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,aAAa,CAgDtE"}
@@ -37,33 +37,23 @@ export function currentAccessor() {
37
37
  * Cache key is the instance: `send` is identity-stable per instance,
38
38
  * so the bag's bound `send` is correct for every call site that
39
39
  * receives it. The cache invalidates implicitly on instance disposal.
40
- * In test mode (no compiler-emitted `__view`) we fall through to
41
- * `createView` per call tests don't measure perf, and the
42
- * createView reference is gone from production via the Vite-time MODE
43
- * fold (see mount.ts buildViewBag for the same pattern).
40
+ * When no `__view` factory is present (hand-rolled ComponentDef in
41
+ * tests, or some other unusual path), fall through to `createView` so
42
+ * the bag is complete. The compiler emits `__view` for every
43
+ * `component({...})` call including identifier-param view functions
44
+ * (`view: (h) => ...`) where it emits a factory that itself calls
45
+ * `createView`. So this fallback is genuinely "shouldn't happen" in
46
+ * compiled code, but staying safe is cheap and the alternative
47
+ * (a `{ send }`-only bag in prod) is a guaranteed crash for any
48
+ * helper that reads `h.show`, `h.each`, etc.
44
49
  */
45
50
  export function getInstanceViewBag(inst, send) {
46
- // No instance → only happens in test-mode fixtures that mount through
47
- // a stub render context. The createView reference below is dead in
48
- // production builds (Vite folds the MODE check to a constant).
49
- if (!inst) {
50
- if (import.meta.env?.MODE !== 'production')
51
- return createView(send);
52
- return { send };
53
- }
51
+ if (!inst)
52
+ return createView(send);
54
53
  if (inst._viewBag !== undefined)
55
54
  return inst._viewBag;
56
55
  const factory = inst.def.__view;
57
- let bag;
58
- if (factory) {
59
- bag = factory(send);
60
- }
61
- else if (import.meta.env?.MODE !== 'production') {
62
- bag = createView(send);
63
- }
64
- else {
65
- bag = { send };
66
- }
56
+ const bag = factory ? factory(send) : createView(send);
67
57
  inst._viewBag = bag;
68
58
  return bag;
69
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"render-context.js","sourceRoot":"","sources":["../src/render-context.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AA8B9C,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;AACF,4EAA4E;AAC5E,4EAA4E;AAC5E,yEAAyE;AACzE,6BAA6B;AAC7B,MAAM,aAAa,GAAa,EAAE,CAAA;AAElC,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC3B,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,aAAa,CAAC,GAAG,EAAE,CAAA;AACrB,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,aAAa,CAAC,MAAM,CAAA;IAChC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,GAAG,GAAG,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACjD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAmC,EACnC,IAAa;IAEb,sEAAsE;IACtE,mEAAmE;IACnE,+DAA+D;IAC/D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,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;oBACvD,oDAAoD;oBACpD,MAAM;gBACR,CAAC,CAAC,EAAE,CAAA;YACR,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,4DAA4D;gBACxE,0DAA0D;gBAC1D,sEAAsE;gBACtE,yEAAyE;gBACzE,0EAA0E;gBAC1E,0EAA0E;gBAC1E,gCAAgC;gBAChC,yEAAyE;gBACzE,wEAAwE;gBACxE,mEAAmE;gBACnE,8DAA8D;gBAC9D,yEAAyE;gBACzE,0EAA0E;gBAC1E,0EAA0E;gBAC1E,cAAc;gBACd,cAAc,CACjB,CAAA;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,kCAAkC,CAAC,CAAA;IACnE,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC","sourcesContent":["import type { Lifetime, Binding, Send } from './types.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport type { DomEnv } from './dom-env.js'\nimport { createView } from './view-helpers.js'\n\ndeclare global {\n interface ImportMeta {\n env?: { DEV?: boolean; MODE?: string }\n }\n}\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\n/**\n * Return the view bag for `inst`, caching it on the instance so the\n * per-row allocation that each.render / branch arms / lazy fallback /\n * client-only render / hmr replay / ssr render used to incur on every\n * call collapses to a single object literal per instance. Hot path on\n * jfb's Select benchmark — `pnpm bench` measured +31% without this\n * cache (each row's mount called `def.__view(send)` afresh).\n *\n * Cache key is the instance: `send` is identity-stable per instance,\n * so the bag's bound `send` is correct for every call site that\n * receives it. The cache invalidates implicitly on instance disposal.\n * In test mode (no compiler-emitted `__view`) we fall through to\n * `createView` per call tests don't measure perf, and the\n * createView reference is gone from production via the Vite-time MODE\n * fold (see mount.ts buildViewBag for the same pattern).\n */\nexport function getInstanceViewBag<S, M>(\n inst: ComponentInstance | undefined,\n send: Send<M>,\n): unknown {\n // No instance only happens in test-mode fixtures that mount through\n // a stub render context. The createView reference below is dead in\n // production builds (Vite folds the MODE check to a constant).\n if (!inst) {\n if (import.meta.env?.MODE !== 'production') return createView<S, M>(send)\n return { send }\n }\n if (inst._viewBag !== undefined) return inst._viewBag\n const factory = (inst.def as unknown as { __view?: (s: Send<M>) => unknown }).__view\n let bag: unknown\n if (factory) {\n bag = factory(send)\n } else if (import.meta.env?.MODE !== 'production') {\n bag = createView<S, M>(send)\n } else {\n bag = { send }\n }\n inst._viewBag = bag\n return bag\n}\n\nexport function getRenderContext(primitiveName?: string): RenderContext {\n if (!currentContext) {\n const name = primitiveName ? `${primitiveName}()` : 'primitives'\n // Long-form guidance is dev-only — these are programming errors\n // (calling a primitive outside a view callback or inside an\n // accessor). Production apps that hit this still throw a brief\n // identifying error; the diagnostic prose adds ~600 source bytes\n // / ~250 bytes gz that the bundler keeps only when DEV is true.\n if (import.meta.env?.DEV) {\n // `sample()` is specifically the one users reach for from adapter\n // send wrappers / event handlers / async callbacks expecting it\n // to be \"imperative and safe.\" It isn't — point at the sanctioned\n // escape hatch (`AppHandle.getState()`) so the caller doesn't\n // 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 throw new Error(`[LLui] ${name} called outside a render context`)\n }\n return currentContext\n}\n"]}
1
+ {"version":3,"file":"render-context.js","sourceRoot":"","sources":["../src/render-context.ts"],"names":[],"mappings":"AAIA,O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B,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,aAAsB;IACrD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC,YAAY,CAAA;QAChE,gEAAgE;QAChE,4DAA4D;QAC5D,+DAA+D;QAC/D,iEAAiE;QACjE,gEAAgE;QAChE,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;YACzB,kEAAkE;YAClE,gEAAgE;YAChE,kEAAkE;YAClE,8DAA8D;YAC9D,eAAe;YACf,MAAM,cAAc,GAClB,aAAa,KAAK,QAAQ;gBACxB,CAAC,CAAC,iEAAiE;oBACjE,iEAAiE;oBACjE,qEAAqE;oBACrE,YAAY;oBACZ,wCAAwC;oBACxC,0CAA0C;oBAC1C,uDAAuD;oBACvD,oDAAoD;oBACpD,MAAM;gBACR,CAAC,CAAC,EAAE,CAAA;YACR,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,4DAA4D;gBACxE,0DAA0D;gBAC1D,sEAAsE;gBACtE,yEAAyE;gBACzE,0EAA0E;gBAC1E,0EAA0E;gBAC1E,gCAAgC;gBAChC,yEAAyE;gBACzE,wEAAwE;gBACxE,mEAAmE;gBACnE,8DAA8D;gBAC9D,yEAAyE;gBACzE,0EAA0E;gBAC1E,0EAA0E;gBAC1E,cAAc;gBACd,cAAc,CACjB,CAAA;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,kCAAkC,CAAC,CAAA;IACnE,CAAC;IACD,OAAO,cAAc,CAAA;AACvB,CAAC","sourcesContent":["import type { Lifetime, Binding, Send } from './types.js'\nimport type { StructuralBlock } from './structural.js'\nimport type { ComponentInstance } from './update-loop.js'\nimport type { DomEnv } from './dom-env.js'\nimport { createView } from './view-helpers.js'\n\ndeclare global {\n interface ImportMeta {\n env?: { DEV?: boolean; MODE?: string }\n }\n}\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\n/**\n * Return the view bag for `inst`, caching it on the instance so the\n * per-row allocation that each.render / branch arms / lazy fallback /\n * client-only render / hmr replay / ssr render used to incur on every\n * call collapses to a single object literal per instance. Hot path on\n * jfb's Select benchmark — `pnpm bench` measured +31% without this\n * cache (each row's mount called `def.__view(send)` afresh).\n *\n * Cache key is the instance: `send` is identity-stable per instance,\n * so the bag's bound `send` is correct for every call site that\n * receives it. The cache invalidates implicitly on instance disposal.\n * When no `__view` factory is present (hand-rolled ComponentDef in\n * tests, or some other unusual path), fall through to `createView` so\n * the bag is complete. The compiler emits `__view` for every\n * `component({...})` call — including identifier-param view functions\n * (`view: (h) => ...`) where it emits a factory that itself calls\n * `createView`. So this fallback is genuinely \"shouldn't happen\" in\n * compiled code, but staying safe is cheap and the alternative\n * (a `{ send }`-only bag in prod) is a guaranteed crash for any\n * helper that reads `h.show`, `h.each`, etc.\n */\nexport function getInstanceViewBag<S, M>(\n inst: ComponentInstance | undefined,\n send: Send<M>,\n): unknown {\n if (!inst) return createView<S, M>(send)\n if (inst._viewBag !== undefined) return inst._viewBag\n const factory = (inst.def as unknown as { __view?: (s: Send<M>) => unknown }).__view\n const bag = factory ? factory(send) : createView<S, M>(send)\n inst._viewBag = bag\n return bag\n}\n\nexport function getRenderContext(primitiveName?: string): RenderContext {\n if (!currentContext) {\n const name = primitiveName ? `${primitiveName}()` : 'primitives'\n // Long-form guidance is dev-only — these are programming errors\n // (calling a primitive outside a view callback or inside an\n // accessor). Production apps that hit this still throw a brief\n // identifying error; the diagnostic prose adds ~600 source bytes\n // / ~250 bytes gz that the bundler keeps only when DEV is true.\n if (import.meta.env?.DEV) {\n // `sample()` is specifically the one users reach for from adapter\n // send wrappers / event handlers / async callbacks expecting it\n // to be \"imperative and safe.\" It isn't — point at the sanctioned\n // escape hatch (`AppHandle.getState()`) so the caller doesn't\n // 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 throw new Error(`[LLui] ${name} called outside a render context`)\n }\n return currentContext\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"update-loop.d.ts","sourceRoot":"","sources":["../src/update-loop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAItD,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,cAAc,CAAA;AAoBtD,eAAO,MAAM,SAAS,QAAiB,CAAA;AAgBvC,eAAO,MAAM,4BAA4B,UAAU,CAAA;AA+FnD,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IACtE,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC1B,KAAK,EAAE,CAAC,CAAA;IACR,cAAc,EAAE,CAAC,EAAE,CAAA;IACnB,YAAY,EAAE,QAAQ,CAAA;IACtB,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,OAAO,EAAE,CAAA;IACtB,gBAAgB,EAAE,eAAe,EAAE,CAAA;IACnC,KAAK,EAAE,CAA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,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KAAK,IAAI,GAC/F,IAAI,CAiEN"}
@@ -358,19 +358,21 @@ function processMessages(inst) {
358
358
  let combinedDirtyHi = 0;
359
359
  const allEffects = [];
360
360
  const defUpdate = inst.def.update;
361
- // v0.4 size-cut (Tier 3.4): every compiled component carries `__prefixes`,
362
- // so the production path skips the FULL_MASK fallback for components
363
- // missing the table. The fallback is gated by `import.meta.env.MODE`
364
- // Vite dead-code-eliminates it from production builds. Tests
365
- // (vitest, MODE='test') construct ComponentDef literals by hand without
366
- // a prefix table and rely on the FULL_MASK behaviour to fire all
367
- // bindings on every update.
361
+ // Most compiled components carry `__prefixes` the compiler emits it
362
+ // whenever `fieldBits` is non-empty. Cases that legitimately don't get
363
+ // one: hand-rolled `ComponentDef` literals in tests, a `view: () => …`
364
+ // with zero reactive accessors, or a component whose `update` is a
365
+ // no-op. Fall back to FULL_MASK so every binding re-evaluates — correct
366
+ // but unoptimized. The fallback used to be DEV-only (Tier 3.4 size cut),
367
+ // but that produced a hard runtime crash for any prod component that
368
+ // happened to skip the emit, so the gate is gone. The branch costs
369
+ // ~30 bytes gz vs. an unbounded blast radius.
368
370
  const prefixes = inst.def.__prefixes;
369
371
  for (let qi = 0; qi < queue.length; qi++) {
370
372
  const msg = queue[qi];
371
373
  const [newState, effects] = defUpdate(state, msg);
372
374
  let dirty;
373
- if (import.meta.env?.MODE !== 'production' && prefixes === undefined) {
375
+ if (prefixes === undefined) {
374
376
  dirty = FULL_MASK;
375
377
  }
376
378
  else {
@@ -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;Q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,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// ── Compiler/runtime version gate (v2b §5) ──────────────────────────\n//\n// `__compilerVersion` is the field every compiled `ComponentDef` carries\n// at v2b+ runtime. `createInstance` consults it to detect components\n// that bypassed the compiler (hand-rolled defs, builds that skipped the\n// plugin) and either falls back to `genericUpdate` (with a one-time\n// warn per def.name) or rejects an incompatible compiled bundle.\n//\n// The minimum compatible compiler version: at v2b ship this is 0.3.0.\n// A def's `__compilerVersion >= RUNTIME_MIN_COMPILER_VERSION` is accepted;\n// older versions throw in dev and warn in prod.\n//\n// The sentinel `'__test__'` is reserved for test fixtures built via\n// `defineTestComponent()` — see v2b §6.3.\nexport const RUNTIME_MIN_COMPILER_VERSION = '0.3.0'\n\nconst _uncompiledWarned = new Set<string>()\n\nfunction warnUncompiledOnce(defName: string): void {\n if (_uncompiledWarned.has(defName)) return\n _uncompiledWarned.add(defName)\n if (import.meta.env?.DEV) {\n console.warn(\n `[llui] Component \"${defName}\" has no \\`__compilerVersion\\` — falling back to ` +\n `\\`genericUpdate\\` (FULL_MASK on every update; no bitmask gating). Either the ` +\n `file was authored as a raw \\`ComponentDef\\` literal (use \\`defineTestComponent()\\` ` +\n `in tests, or compile via @llui/vite-plugin in app code), or the build pipeline ` +\n `skipped the LLui transform. See docs/proposals/v2-compiler/v2b.md §5.`,\n )\n }\n}\n\nfunction compareVersions(a: string, b: string): number {\n const pa = a.split('.').map((p) => parseInt(p, 10) || 0)\n const pb = b.split('.').map((p) => parseInt(p, 10) || 0)\n const n = Math.max(pa.length, pb.length)\n for (let i = 0; i < n; i++) {\n const av = pa[i] ?? 0\n const bv = pb[i] ?? 0\n if (av !== bv) return av - bv\n }\n return 0\n}\n\nfunction assertCompilerCompatibility(defName: string, version: string | undefined): void {\n if (version === undefined) {\n warnUncompiledOnce(defName)\n return\n }\n if (version === '__test__') return // defineTestComponent sentinel\n // Strip pre-release tags (e.g. '0.3.0-alpha.0' → '0.3.0') so alpha builds\n // are accepted alongside the stable minimum. Conservative pre-release\n // policy: an alpha satisfies any equal-or-lower stable minimum.\n const stable = version.split('-', 1)[0]!\n if (compareVersions(stable, RUNTIME_MIN_COMPILER_VERSION) < 0) {\n const msg =\n `[llui] Component \"${defName}\" was compiled by @llui/compiler v${version}, ` +\n `but this runtime requires ≥ v${RUNTIME_MIN_COMPILER_VERSION}. Upgrade the compiler ` +\n `(\\`pnpm up @llui/vite-plugin\\`) and rebuild. See v2-compiler/v2b.md §5.`\n if (import.meta.env?.DEV) {\n throw new Error(msg)\n }\n console.warn(msg)\n }\n}\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 /**\n * @internal v0.4 Tier 1.2 follow-up — memoised view bag. Constructed\n * lazily by `getInstanceViewBag` (render-context.ts) on first access\n * via `def.__view(send)`, then reused across every primitive that\n * passes the bag to a user callback (each.render, branch arms, lazy\n * fallback, client-only render, hmr replay, ssr render). Caching here\n * avoids the per-row allocation that `pnpm bench` flagged as a +31%\n * cost on jfb's Select benchmark — `send` is identity-stable per\n * instance, so a single cached bag is correct for all sites.\n */\n _viewBag?: unknown\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 // v0.4 size-cut (Tier 7): the `__dirty` rejection and the compiler-\n // version compatibility check are dev-aids — they catch authoring\n // mistakes that the build pipeline already prevents in well-configured\n // projects. Gating them behind `import.meta.env?.DEV` lets Vite fold\n // the calls away from production bundles. The functions themselves\n // (`compareVersions`, `assertCompilerCompatibility`, `warnUncompiledOnce`)\n // are reachable only through this site, so they tree-shake along with it.\n if (import.meta.env?.DEV) {\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 assertCompilerCompatibility(def.name, (def as { __compilerVersion?: string }).__compilerVersion)\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 if (import.meta.env?.DEV) 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 //\n // Tier 5 (drop __handlers) was attempted in the v0.4 size-cut work and\n // REVERTED — see benchmarks/bundle-baseline.json#/abandoned. The bytes\n // win (~1.4 kB) cost 23-89% perf on the jfb keyed-each operations that\n // dispatched here (swap, remove, update-10th, select). __handlers stays.\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 // v0.4 size-cut (Tier 3.4): every compiled component carries `__prefixes`,\n // so the production path skips the FULL_MASK fallback for components\n // missing the table. The fallback is gated by `import.meta.env.MODE`\n // — Vite dead-code-eliminates it from production builds. Tests\n // (vitest, MODE='test') construct ComponentDef literals by hand without\n // a prefix table and rely on the FULL_MASK behaviour to fire all\n // bindings on every update.\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 (import.meta.env?.MODE !== 'production' && prefixes === undefined) {\n dirty = FULL_MASK\n } else {\n dirty = computeDirtyFromPrefixes(prefixes!, state, newState)\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 // v0.4 size-cut (Tier 2.4): the compiler-emitted __update fast path was\n // removed. Empirical perf was ~3% on the 200-binding sparse-update\n // microbench — the bytes win outweighs the throughput loss. Every\n // component now goes through genericUpdate.\n genericUpdate(inst, state, combinedDirty, combinedDirtyHi, bindings, bindingsBeforePhase1)\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 — the `import.meta.env?.DEV` gate is also what lets\n // the bundler tree-shake `enhanceBindingError` out of production\n // bundles (otherwise its accessor-source / node-descriptor / hint\n // helpers stay reachable through this one call site). Either way\n // the report flows through `_onBindingError` when wired (agent\n // setups), else falls back to console.error so operators see the\n // cause.\n const wrapped =\n import.meta.env?.DEV && 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. Gated by\n // `import.meta.env?.DEV` so the bundler tree-shakes\n // `dispatchEffectDev` (and its mock-matching, timeline-push, and\n // `newEffectId` dependencies) out of production builds. The\n // historical `inst._effectTimeline !== undefined` runtime guard was\n // correct but not bundler-visible.\n if (import.meta.env?.DEV && inst._effectTimeline !== undefined && dispatchEffectDev(inst, effect))\n 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-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,uEAAuE;AACvE,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,wEAAwE;AACxE,oEAAoE;AACpE,iEAAiE;AACjE,EAAE;AACF,sEAAsE;AACtE,2EAA2E;AAC3E,gDAAgD;AAChD,EAAE;AACF,oEAAoE;AACpE,0CAA0C;AAC1C,MAAM,CAAC,MAAM,4BAA4B,GAAG,OAAO,CAAA;AAEnD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAA;AAE3C,SAAS,kBAAkB,CAAC,OAAe;IACzC,IAAI,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC;QAAE,OAA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AAC,GAAY,CAAC,CAAC,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// ── Compiler/runtime version gate (v2b §5) ──────────────────────────\n//\n// `__compilerVersion` is the field every compiled `ComponentDef` carries\n// at v2b+ runtime. `createInstance` consults it to detect components\n// that bypassed the compiler (hand-rolled defs, builds that skipped the\n// plugin) and either falls back to `genericUpdate` (with a one-time\n// warn per def.name) or rejects an incompatible compiled bundle.\n//\n// The minimum compatible compiler version: at v2b ship this is 0.3.0.\n// A def's `__compilerVersion >= RUNTIME_MIN_COMPILER_VERSION` is accepted;\n// older versions throw in dev and warn in prod.\n//\n// The sentinel `'__test__'` is reserved for test fixtures built via\n// `defineTestComponent()` — see v2b §6.3.\nexport const RUNTIME_MIN_COMPILER_VERSION = '0.3.0'\n\nconst _uncompiledWarned = new Set<string>()\n\nfunction warnUncompiledOnce(defName: string): void {\n if (_uncompiledWarned.has(defName)) return\n _uncompiledWarned.add(defName)\n if (import.meta.env?.DEV) {\n console.warn(\n `[llui] Component \"${defName}\" has no \\`__compilerVersion\\` — falling back to ` +\n `\\`genericUpdate\\` (FULL_MASK on every update; no bitmask gating). Either the ` +\n `file was authored as a raw \\`ComponentDef\\` literal (use \\`defineTestComponent()\\` ` +\n `in tests, or compile via @llui/vite-plugin in app code), or the build pipeline ` +\n `skipped the LLui transform. See docs/proposals/v2-compiler/v2b.md §5.`,\n )\n }\n}\n\nfunction compareVersions(a: string, b: string): number {\n const pa = a.split('.').map((p) => parseInt(p, 10) || 0)\n const pb = b.split('.').map((p) => parseInt(p, 10) || 0)\n const n = Math.max(pa.length, pb.length)\n for (let i = 0; i < n; i++) {\n const av = pa[i] ?? 0\n const bv = pb[i] ?? 0\n if (av !== bv) return av - bv\n }\n return 0\n}\n\nfunction assertCompilerCompatibility(defName: string, version: string | undefined): void {\n if (version === undefined) {\n warnUncompiledOnce(defName)\n return\n }\n if (version === '__test__') return // defineTestComponent sentinel\n // Strip pre-release tags (e.g. '0.3.0-alpha.0' → '0.3.0') so alpha builds\n // are accepted alongside the stable minimum. Conservative pre-release\n // policy: an alpha satisfies any equal-or-lower stable minimum.\n const stable = version.split('-', 1)[0]!\n if (compareVersions(stable, RUNTIME_MIN_COMPILER_VERSION) < 0) {\n const msg =\n `[llui] Component \"${defName}\" was compiled by @llui/compiler v${version}, ` +\n `but this runtime requires ≥ v${RUNTIME_MIN_COMPILER_VERSION}. Upgrade the compiler ` +\n `(\\`pnpm up @llui/vite-plugin\\`) and rebuild. See v2-compiler/v2b.md §5.`\n if (import.meta.env?.DEV) {\n throw new Error(msg)\n }\n console.warn(msg)\n }\n}\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 /**\n * @internal v0.4 Tier 1.2 follow-up — memoised view bag. Constructed\n * lazily by `getInstanceViewBag` (render-context.ts) on first access\n * via `def.__view(send)`, then reused across every primitive that\n * passes the bag to a user callback (each.render, branch arms, lazy\n * fallback, client-only render, hmr replay, ssr render). Caching here\n * avoids the per-row allocation that `pnpm bench` flagged as a +31%\n * cost on jfb's Select benchmark — `send` is identity-stable per\n * instance, so a single cached bag is correct for all sites.\n */\n _viewBag?: unknown\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 // v0.4 size-cut (Tier 7): the `__dirty` rejection and the compiler-\n // version compatibility check are dev-aids — they catch authoring\n // mistakes that the build pipeline already prevents in well-configured\n // projects. Gating them behind `import.meta.env?.DEV` lets Vite fold\n // the calls away from production bundles. The functions themselves\n // (`compareVersions`, `assertCompilerCompatibility`, `warnUncompiledOnce`)\n // are reachable only through this site, so they tree-shake along with it.\n if (import.meta.env?.DEV) {\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 assertCompilerCompatibility(def.name, (def as { __compilerVersion?: string }).__compilerVersion)\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 if (import.meta.env?.DEV) 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 //\n // Tier 5 (drop __handlers) was attempted in the v0.4 size-cut work and\n // REVERTED — see benchmarks/bundle-baseline.json#/abandoned. The bytes\n // win (~1.4 kB) cost 23-89% perf on the jfb keyed-each operations that\n // dispatched here (swap, remove, update-10th, select). __handlers stays.\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 // Most compiled components carry `__prefixes` — the compiler emits it\n // whenever `fieldBits` is non-empty. Cases that legitimately don't get\n // one: hand-rolled `ComponentDef` literals in tests, a `view: () => …`\n // with zero reactive accessors, or a component whose `update` is a\n // no-op. Fall back to FULL_MASK so every binding re-evaluates — correct\n // but unoptimized. The fallback used to be DEV-only (Tier 3.4 size cut),\n // but that produced a hard runtime crash for any prod component that\n // happened to skip the emit, so the gate is gone. The branch costs\n // ~30 bytes gz vs. an unbounded blast radius.\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 = FULL_MASK\n } else {\n dirty = computeDirtyFromPrefixes(prefixes, state, newState)\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 // v0.4 size-cut (Tier 2.4): the compiler-emitted __update fast path was\n // removed. Empirical perf was ~3% on the 200-binding sparse-update\n // microbench — the bytes win outweighs the throughput loss. Every\n // component now goes through genericUpdate.\n genericUpdate(inst, state, combinedDirty, combinedDirtyHi, bindings, bindingsBeforePhase1)\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 — the `import.meta.env?.DEV` gate is also what lets\n // the bundler tree-shake `enhanceBindingError` out of production\n // bundles (otherwise its accessor-source / node-descriptor / hint\n // helpers stay reachable through this one call site). Either way\n // the report flows through `_onBindingError` when wired (agent\n // setups), else falls back to console.error so operators see the\n // cause.\n const wrapped =\n import.meta.env?.DEV && 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. Gated by\n // `import.meta.env?.DEV` so the bundler tree-shakes\n // `dispatchEffectDev` (and its mock-matching, timeline-push, and\n // `newEffectId` dependencies) out of production builds. The\n // historical `inst._effectTimeline !== undefined` runtime guard was\n // correct but not bundler-visible.\n if (import.meta.env?.DEV && inst._effectTimeline !== undefined && dispatchEffectDev(inst, effect))\n 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.2.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {