@llui/dom 0.1.0 → 0.2.1
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/binding-registry.d.ts +10 -0
- package/dist/binding-registry.d.ts.map +1 -0
- package/dist/binding-registry.js +96 -0
- package/dist/binding-registry.js.map +1 -0
- package/dist/binding.d.ts +22 -0
- package/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +56 -5
- package/dist/binding.js.map +1 -1
- package/dist/build-flags.d.ts +25 -0
- package/dist/build-flags.d.ts.map +1 -0
- package/dist/build-flags.js +18 -0
- package/dist/build-flags.js.map +1 -0
- package/dist/compose.d.ts +27 -21
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +19 -13
- package/dist/compose.js.map +1 -1
- package/dist/el-split.d.ts.map +1 -1
- package/dist/el-split.js +8 -4
- package/dist/el-split.js.map +1 -1
- package/dist/el-template.d.ts.map +1 -1
- package/dist/el-template.js +15 -18
- package/dist/el-template.js.map +1 -1
- package/dist/elements.d.ts.map +1 -1
- package/dist/elements.js +12 -4
- package/dist/elements.js.map +1 -1
- package/dist/hmr.js +9 -4
- package/dist/hmr.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/test-component-builder.d.ts +21 -0
- package/dist/internal/test-component-builder.d.ts.map +1 -0
- package/dist/internal/test-component-builder.js +65 -0
- package/dist/internal/test-component-builder.js.map +1 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.js.map +1 -1
- package/dist/lifetime.d.ts.map +1 -1
- package/dist/lifetime.js +16 -3
- package/dist/lifetime.js.map +1 -1
- package/dist/mount.d.ts +1 -0
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +32 -22
- package/dist/mount.js.map +1 -1
- package/dist/primitives/branch.d.ts.map +1 -1
- package/dist/primitives/branch.js +29 -16
- package/dist/primitives/branch.js.map +1 -1
- package/dist/primitives/client-only.d.ts +1 -1
- package/dist/primitives/client-only.d.ts.map +1 -1
- package/dist/primitives/client-only.js +3 -3
- package/dist/primitives/client-only.js.map +1 -1
- package/dist/primitives/context.d.ts.map +1 -1
- package/dist/primitives/context.js +6 -3
- package/dist/primitives/context.js.map +1 -1
- package/dist/primitives/each.d.ts.map +1 -1
- package/dist/primitives/each.js +121 -74
- package/dist/primitives/each.js.map +1 -1
- package/dist/primitives/foreign.js +2 -1
- package/dist/primitives/foreign.js.map +1 -1
- package/dist/primitives/lazy.d.ts +1 -1
- package/dist/primitives/lazy.d.ts.map +1 -1
- package/dist/primitives/lazy.js +11 -5
- package/dist/primitives/lazy.js.map +1 -1
- package/dist/primitives/portal.js +2 -1
- package/dist/primitives/portal.js.map +1 -1
- package/dist/primitives/sample.d.ts +2 -2
- package/dist/primitives/sample.d.ts.map +1 -1
- package/dist/primitives/sample.js +24 -18
- package/dist/primitives/sample.js.map +1 -1
- package/dist/primitives/track.d.ts +54 -0
- package/dist/primitives/track.d.ts.map +1 -0
- package/dist/primitives/track.js +54 -0
- package/dist/primitives/track.js.map +1 -0
- package/dist/primitives/virtual-each.js +4 -2
- package/dist/primitives/virtual-each.js.map +1 -1
- package/dist/render-context.d.ts +27 -1
- package/dist/render-context.d.ts.map +1 -1
- package/dist/render-context.js +82 -33
- package/dist/render-context.js.map +1 -1
- package/dist/ssr.d.ts.map +1 -1
- package/dist/ssr.js +5 -3
- package/dist/ssr.js.map +1 -1
- package/dist/types.d.ts +8 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update-loop.d.ts +1 -0
- package/dist/update-loop.d.ts.map +1 -1
- package/dist/update-loop.js +115 -50
- package/dist/update-loop.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,qEAAqE;AAErE,OAAO,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAA;AAErD,qEAAqE;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["// ── Types ─────────────────────────────────────────────────────────\n\nexport type {\n ComponentDef,\n Send,\n Props,\n AppHandle,\n Lifetime,\n Binding,\n BindingKind,\n TransitionOptions,\n BranchOptions,\n ShowOptions,\n EachOptions,\n ItemAccessor,\n PortalOptions,\n ForeignOptions,\n ChildOptions,\n} from './types.js'\n\n// ── Component ─────────────────────────────────────────────────────\n\nexport { component } from './component.js'\nexport { createView, type View } from './view-helpers.js'\nexport { combine, type SliceReducer, type SliceMap, type TopReducer } from './combine.js'\n\n// ── Mount ─────────────────────────────────────────────────────────\n\nexport { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor, type MountOptions } from './mount.js'\nexport type { BindingDescriptor } from './binding-descriptors.js'\n// Compiler-emitted runtime helper for the `*.connect(get, sendFn, …)`\n// pattern. User code never imports this directly — the vite-plugin's\n// connect-pattern matcher inserts the import + call sites\n// automatically alongside the existing event-handler tagger.\nexport { __registerScopeVariants } from './binding-descriptors.js'\n// Library helper for `*.connect` implementations — tags returned\n// event handlers with the variants they dispatch, so the runtime\n// binding-descriptor registry surfaces them to the agent layer's\n// `list_actions`. Library authors call this once per onClick.\nexport { tagSend } from './binding-descriptors.js'\n// installDevTools is NOT re-exported here to keep it out of production bundles.\n// Import directly: import { installDevTools } from '@llui/dom/devtools'\nexport type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js'\nexport type { CoverageSnapshot } from './tracking/coverage.js'\nexport type { EachDiff } from './tracking/each-diff.js'\nexport type { DisposerEvent } from './tracking/disposer-log.js'\nexport type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js'\nexport type { LifetimeNode } from './types.js'\n\n// ── Runtime ───────────────────────────────────────────────────────\n\nexport { flush } from './runtime.js'\nexport { renderToString, renderNodes, serializeNodes } from './ssr.js'\nexport { browserEnv, type DomEnv } from './dom-env.js'\nexport { mergeHandlers } from './merge-handlers.js'\nexport {\n createContext,\n provide,\n provideValue,\n useContext,\n useContextValue,\n type Context,\n} from './primitives/context.js'\nexport { sliceHandler } from './slice-handler.js'\nexport {\n childHandlers,\n type ChildState,\n type ChildMsg,\n type ModuleState,\n type ModuleMsg,\n} from './compose.js'\n\n// ── View Primitives ───────────────────────────────────────────────\n\nexport { text } from './primitives/text.js'\nexport { unsafeHtml } from './primitives/unsafe-html.js'\nexport { branch } from './primitives/branch.js'\nexport { each } from './primitives/each.js'\nexport { virtualEach, type VirtualEachOptions } from './primitives/virtual-each.js'\nexport { show } from './primitives/show.js'\nexport { scope } from './primitives/scope.js'\nexport type { ScopeOptions } from './types.js'\nexport { slice } from './primitives/slice.js'\nexport { portal } from './primitives/portal.js'\nexport { foreign } from './primitives/foreign.js'\nexport { lazy, type LazyOptions } from './primitives/lazy.js'\nexport type { LazyDef, AnyComponentDef } from './types.js'\nexport { memo } from './primitives/memo.js'\nexport { sample } from './primitives/sample.js'\nexport { selector } from './primitives/selector.js'\nexport { onMount } from './primitives/on-mount.js'\nexport { clientOnly, __clientOnlyStub, type ClientOnlyOptions } from './primitives/client-only.js'\nexport { errorBoundary } from './primitives/error-boundary.js'\n\n// ── Element Helpers ───────────────────────────────────────────────\n\nexport {\n a,\n abbr,\n article,\n aside,\n b,\n blockquote,\n br,\n button,\n canvas,\n code,\n dd,\n details,\n dialog,\n div,\n dl,\n dt,\n em,\n fieldset,\n figcaption,\n figure,\n footer,\n form,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n header,\n hr,\n i,\n iframe,\n img,\n input,\n label,\n legend,\n li,\n main,\n mark,\n nav,\n ol,\n optgroup,\n option,\n output,\n p,\n pre,\n progress,\n section,\n select,\n small,\n span,\n strong,\n sub,\n summary,\n sup,\n table,\n tbody,\n td,\n textarea,\n tfoot,\n th,\n thead,\n time,\n tr,\n ul,\n video,\n} from './elements.js'\n\n// ── SVG Elements ─────────────────────────────────────────────────\n\nexport {\n svg,\n g,\n defs,\n symbol,\n use,\n circle,\n ellipse,\n line,\n path,\n polygon,\n polyline,\n rect,\n text as svgText,\n tspan,\n textPath,\n clipPath,\n linearGradient,\n radialGradient,\n stop,\n mask,\n pattern,\n marker,\n filter,\n feBlend,\n feColorMatrix,\n feComponentTransfer,\n feComposite,\n feConvolveMatrix,\n feDiffuseLighting,\n feDisplacementMap,\n feDropShadow,\n feFlood,\n feGaussianBlur,\n feImage,\n feMerge,\n feMergeNode,\n feMorphology,\n feOffset,\n feSpecularLighting,\n feTile,\n feTurbulence,\n fePointLight,\n feSpotLight,\n feDistantLight,\n feFuncR,\n feFuncG,\n feFuncB,\n feFuncA,\n image,\n foreignObject,\n animate,\n animateMotion,\n animateTransform,\n set,\n mpath,\n desc,\n title as svgTitle,\n metadata,\n} from './svg-elements.js'\n\n// ── MathML Elements ──────────────────────────────────────────────\n\nexport {\n math,\n mi,\n mn,\n mo,\n ms,\n mtext,\n mrow,\n mfrac,\n msqrt,\n mroot,\n msup,\n msub,\n msubsup,\n munder,\n mover,\n munderover,\n mmultiscripts,\n mprescripts,\n mnone,\n mtable,\n mtr,\n mtd,\n mspace,\n mpadded,\n mphantom,\n menclose,\n merror,\n maction,\n semantics,\n annotation,\n annotationXml,\n} from './mathml-elements.js'\n\n// ── Form Utilities ────────────────────────────────────────────────\n\nexport { applyField, type FieldMsg } from './form.js'\n\n// ── Compiler Target ───────────────────────────────────────────────\n\nexport { elSplit } from './el-split.js'\nexport { elTemplate, __cloneStaticTemplate } from './el-template.js'\nexport { _runPhase2 as __runPhase2, _handleMsg as __handleMsg } from './update-loop.js'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AAmBrE,qEAAqE;AAErE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAa,MAAM,mBAAmB,CAAA;AACzD,OAAO,EAAE,OAAO,EAAqD,MAAM,cAAc,CAAA;AAEzF,qEAAqE;AAErE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAA;AAEpG,sEAAsE;AACtE,qEAAqE;AACrE,0DAA0D;AAC1D,6DAA6D;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,iEAAiE;AACjE,iEAAiE;AACjE,iEAAiE;AACjE,8DAA8D;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAUlD,qEAAqE;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACtE,OAAO,EAAE,UAAU,EAAe,MAAM,cAAc,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EACL,aAAa,EACb,OAAO,EACP,YAAY,EACZ,UAAU,EACV,eAAe,GAEhB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EACL,cAAc,GAKf,MAAM,cAAc,CAAA;AAErB,qEAAqE;AAErE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;A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,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,MAAM,EACN,GAAG,EACH,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EACV,aAAa,GACd,MAAM,sBAAsB,CAAA;AAE7B,qEAAqE;AAErE,OAAO,EAAE,UAAU,EAAiB,MAAM,WAAW,CAAA;AAErD,qEAAqE;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,UAAU,IAAI,WAAW,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAA","sourcesContent":["// ── Types ─────────────────────────────────────────────────────────\n\nexport type {\n ComponentDef,\n Send,\n Props,\n AppHandle,\n Lifetime,\n Binding,\n BindingKind,\n TransitionOptions,\n BranchOptions,\n ShowOptions,\n EachOptions,\n ItemAccessor,\n PortalOptions,\n ForeignOptions,\n} from './types.js'\n\n// ── Component ─────────────────────────────────────────────────────\n\nexport { component } from './component.js'\nexport { createView, type View } from './view-helpers.js'\nexport { combine, type SliceReducer, type SliceMap, type TopReducer } from './combine.js'\n\n// ── Mount ─────────────────────────────────────────────────────────\n\nexport { mountApp, hydrateApp, mountAtAnchor, hydrateAtAnchor, type MountOptions } from './mount.js'\nexport type { BindingDescriptor } from './binding-descriptors.js'\n// Compiler-emitted runtime helper for the `*.connect(get, sendFn, …)`\n// pattern. User code never imports this directly — the vite-plugin's\n// connect-pattern matcher inserts the import + call sites\n// automatically alongside the existing event-handler tagger.\nexport { __registerScopeVariants } from './binding-descriptors.js'\n// Library helper for `*.connect` implementations — tags returned\n// event handlers with the variants they dispatch, so the runtime\n// binding-descriptor registry surfaces them to the agent layer's\n// `list_actions`. Library authors call this once per onClick.\nexport { tagSend } from './binding-descriptors.js'\n// installDevTools is NOT re-exported here to keep it out of production bundles.\n// Import directly: import { installDevTools } from '@llui/dom/devtools'\nexport type { LluiDebugAPI, ElementReport, MessageRecord, StateDiff } from './devtools.js'\nexport type { CoverageSnapshot } from './tracking/coverage.js'\nexport type { EachDiff } from './tracking/each-diff.js'\nexport type { DisposerEvent } from './tracking/disposer-log.js'\nexport type { PendingEffect, EffectTimelineEntry, EffectMatch } from './tracking/effect-timeline.js'\nexport type { LifetimeNode } from './types.js'\n\n// ── Runtime ───────────────────────────────────────────────────────\n\nexport { flush } from './runtime.js'\nexport { renderToString, renderNodes, serializeNodes } from './ssr.js'\nexport { browserEnv, type DomEnv } from './dom-env.js'\nexport { mergeHandlers } from './merge-handlers.js'\nexport {\n createContext,\n provide,\n provideValue,\n useContext,\n useContextValue,\n type Context,\n} from './primitives/context.js'\nexport { sliceHandler } from './slice-handler.js'\nexport {\n composeModules,\n type ModulesState,\n type ModulesMsg,\n type ModuleState,\n type ModuleMsg,\n} from './compose.js'\n\n// ── View Primitives ───────────────────────────────────────────────\n\nexport { text } from './primitives/text.js'\nexport { unsafeHtml } from './primitives/unsafe-html.js'\nexport { branch } from './primitives/branch.js'\nexport { each } from './primitives/each.js'\nexport { virtualEach, type VirtualEachOptions } from './primitives/virtual-each.js'\nexport { show } from './primitives/show.js'\nexport { scope } from './primitives/scope.js'\nexport type { ScopeOptions } from './types.js'\nexport { slice } from './primitives/slice.js'\nexport { portal } from './primitives/portal.js'\nexport { foreign } from './primitives/foreign.js'\nexport { lazy, type LazyOptions } from './primitives/lazy.js'\nexport type { LazyDef, AnyComponentDef } from './types.js'\nexport { memo } from './primitives/memo.js'\nexport { sample } from './primitives/sample.js'\nexport { selector } from './primitives/selector.js'\nexport { onMount } from './primitives/on-mount.js'\nexport { 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"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentDef } from '../types.js';
|
|
2
|
+
export interface DefineTestComponentInput<S, M, E = never, D = void> {
|
|
3
|
+
name: string;
|
|
4
|
+
init: (data: D) => [S, E[]];
|
|
5
|
+
update: (state: S, msg: M) => [S, E[]];
|
|
6
|
+
view: ComponentDef<S, M, E, D>['view'];
|
|
7
|
+
onEffect?: ComponentDef<S, M, E, D>['onEffect'];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Build a `ComponentDef` opted into the optimized runtime path. Carries
|
|
11
|
+
* the `'__test__'` sentinel `__compilerVersion` so `createInstance` skips
|
|
12
|
+
* the version gate. Bare-minimum — no `__update`, no `__handlers`, no
|
|
13
|
+
* `__prefixes` — meaning the runtime correctly routes to `genericUpdate`
|
|
14
|
+
* with FULL_MASK on every update.
|
|
15
|
+
*
|
|
16
|
+
* Tests that want to exercise the compiler's fast path explicitly should
|
|
17
|
+
* still construct raw `ComponentDef`s with the synthesized fields (and
|
|
18
|
+
* the v2c compiler-tests harness will cover those scenarios end-to-end).
|
|
19
|
+
*/
|
|
20
|
+
export declare function defineTestComponentInternal<S, M, E = never, D = void>(input: DefineTestComponentInput<S, M, E, D>): ComponentDef<S, M, E, D>;
|
|
21
|
+
//# sourceMappingURL=test-component-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-component-builder.d.ts","sourceRoot":"","sources":["../../src/internal/test-component-builder.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,WAAW,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,IAAI;IACjE,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAC3B,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACtC,IAAI,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IACtC,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;CAChD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,IAAI,EACnE,KAAK,EAAE,wBAAwB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC1C,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAU1B"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Internal — `defineTestComponent` builder shared by @llui/dom's own tests
|
|
2
|
+
// and `@llui/test`. v2b §6.3.
|
|
3
|
+
//
|
|
4
|
+
// At v2b ship, the runtime's `createInstance` rejects components without
|
|
5
|
+
// `__compilerVersion`. Tests that mount raw `ComponentDef` literals would
|
|
6
|
+
// flood the warn channel and break warn-count assertions. This builder
|
|
7
|
+
// produces a `ComponentDef` carrying the `'__test__'` sentinel version
|
|
8
|
+
// plus an identity `__prefixes` table — enough for the runtime to treat
|
|
9
|
+
// it as compiled.
|
|
10
|
+
//
|
|
11
|
+
// Why "shared private internal":
|
|
12
|
+
// - `@llui/dom`'s own test/ suite needs this; the test/ folder can't
|
|
13
|
+
// import from `@llui/test` (which depends on @llui/dom).
|
|
14
|
+
// - `@llui/test`'s consumers need the same builder to opt into the
|
|
15
|
+
// optimized path.
|
|
16
|
+
// The single source of truth lives here; both packages re-export
|
|
17
|
+
// through their own helper modules so consumers never reach into
|
|
18
|
+
// @llui/dom's internal/ namespace directly.
|
|
19
|
+
//
|
|
20
|
+
// Tree-shaking: the file is reachable only from test/ folders, which
|
|
21
|
+
// production bundles don't include. A `sideEffects: false` package +
|
|
22
|
+
// the import-graph-rooted-in-test-helpers shape guarantees zero bytes
|
|
23
|
+
// in `dist/`. See packages/dom/package.json `sideEffects` and the
|
|
24
|
+
// bundle-size fixture in v2b §6 (deferred to a follow-up).
|
|
25
|
+
/**
|
|
26
|
+
* Build a `ComponentDef` opted into the optimized runtime path. Carries
|
|
27
|
+
* the `'__test__'` sentinel `__compilerVersion` so `createInstance` skips
|
|
28
|
+
* the version gate. Bare-minimum — no `__update`, no `__handlers`, no
|
|
29
|
+
* `__prefixes` — meaning the runtime correctly routes to `genericUpdate`
|
|
30
|
+
* with FULL_MASK on every update.
|
|
31
|
+
*
|
|
32
|
+
* Tests that want to exercise the compiler's fast path explicitly should
|
|
33
|
+
* still construct raw `ComponentDef`s with the synthesized fields (and
|
|
34
|
+
* the v2c compiler-tests harness will cover those scenarios end-to-end).
|
|
35
|
+
*/
|
|
36
|
+
export function defineTestComponentInternal(input) {
|
|
37
|
+
const out = {
|
|
38
|
+
name: input.name,
|
|
39
|
+
init: input.init,
|
|
40
|
+
update: input.update,
|
|
41
|
+
view: input.view,
|
|
42
|
+
__compilerVersion: '__test__',
|
|
43
|
+
};
|
|
44
|
+
if (input.onEffect)
|
|
45
|
+
out.onEffect = input.onEffect;
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Idempotently stamp a `ComponentDef` with the `'__test__'`
|
|
50
|
+
* `__compilerVersion` sentinel. Used by test-harness adapters
|
|
51
|
+
* (`@llui/test`'s `testView`) that accept a `ComponentDef` from caller
|
|
52
|
+
* code: if the caller already used `defineTestComponent` (or supplied
|
|
53
|
+
* a real compiled def), the existing version is preserved; otherwise
|
|
54
|
+
* the sentinel silences `warnUncompiledOnce`.
|
|
55
|
+
*
|
|
56
|
+
* Lives inside @llui/dom because `__compilerVersion` is `@internal`
|
|
57
|
+
* and stripped from the dist `.d.ts`; external code can't address the
|
|
58
|
+
* field by name. v2b §6.
|
|
59
|
+
*/
|
|
60
|
+
export function stampTestVersion(def) {
|
|
61
|
+
if (def.__compilerVersion)
|
|
62
|
+
return def;
|
|
63
|
+
return { ...def, __compilerVersion: '__test__' };
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=test-component-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-component-builder.js","sourceRoot":"","sources":["../../src/internal/test-component-builder.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8BAA8B;AAC9B,EAAE;AACF,yEAAyE;AACzE,0EAA0E;AAC1E,uEAAuE;AACvE,uEAAuE;AACvE,wEAAwE;AACxE,kBAAkB;AAClB,EAAE;AACF,iCAAiC;AACjC,uEAAuE;AACvE,6DAA6D;AAC7D,qEAAqE;AACrE,sBAAsB;AACtB,iEAAiE;AACjE,iEAAiE;AACjE,4CAA4C;AAC5C,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,sEAAsE;AACtE,kEAAkE;AAClE,2DAA2D;AAY3D;;;;;;;;;;GAUG;AACH,MAAM,UAAU,2BAA2B,CACzC,KAA2C;IAE3C,MAAM,GAAG,GAA6B;QACpC,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,iBAAiB,EAAE,UAAU;KAC9B,CAAA;IACD,IAAI,KAAK,CAAC,QAAQ;QAAE,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;IACjD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAC9B,GAA6B;IAE7B,IAAI,GAAG,CAAC,iBAAiB;QAAE,OAAO,GAAG,CAAA;IACrC,OAAO,EAAE,GAAG,GAAG,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAA;AAClD,CAAC","sourcesContent":["// Internal — `defineTestComponent` builder shared by @llui/dom's own tests\n// and `@llui/test`. v2b §6.3.\n//\n// At v2b ship, the runtime's `createInstance` rejects components without\n// `__compilerVersion`. Tests that mount raw `ComponentDef` literals would\n// flood the warn channel and break warn-count assertions. This builder\n// produces a `ComponentDef` carrying the `'__test__'` sentinel version\n// plus an identity `__prefixes` table — enough for the runtime to treat\n// it as compiled.\n//\n// Why \"shared private internal\":\n// - `@llui/dom`'s own test/ suite needs this; the test/ folder can't\n// import from `@llui/test` (which depends on @llui/dom).\n// - `@llui/test`'s consumers need the same builder to opt into the\n// optimized path.\n// The single source of truth lives here; both packages re-export\n// through their own helper modules so consumers never reach into\n// @llui/dom's internal/ namespace directly.\n//\n// Tree-shaking: the file is reachable only from test/ folders, which\n// production bundles don't include. A `sideEffects: false` package +\n// the import-graph-rooted-in-test-helpers shape guarantees zero bytes\n// in `dist/`. See packages/dom/package.json `sideEffects` and the\n// bundle-size fixture in v2b §6 (deferred to a follow-up).\n\nimport type { ComponentDef } from '../types.js'\n\nexport interface DefineTestComponentInput<S, M, E = never, D = void> {\n name: string\n init: (data: D) => [S, E[]]\n update: (state: S, msg: M) => [S, E[]]\n view: ComponentDef<S, M, E, D>['view']\n onEffect?: ComponentDef<S, M, E, D>['onEffect']\n}\n\n/**\n * Build a `ComponentDef` opted into the optimized runtime path. Carries\n * the `'__test__'` sentinel `__compilerVersion` so `createInstance` skips\n * the version gate. Bare-minimum — no `__update`, no `__handlers`, no\n * `__prefixes` — meaning the runtime correctly routes to `genericUpdate`\n * with FULL_MASK on every update.\n *\n * Tests that want to exercise the compiler's fast path explicitly should\n * still construct raw `ComponentDef`s with the synthesized fields (and\n * the v2c compiler-tests harness will cover those scenarios end-to-end).\n */\nexport function defineTestComponentInternal<S, M, E = never, D = void>(\n input: DefineTestComponentInput<S, M, E, D>,\n): ComponentDef<S, M, E, D> {\n const out: ComponentDef<S, M, E, D> = {\n name: input.name,\n init: input.init,\n update: input.update,\n view: input.view,\n __compilerVersion: '__test__',\n }\n if (input.onEffect) out.onEffect = input.onEffect\n return out\n}\n\n/**\n * Idempotently stamp a `ComponentDef` with the `'__test__'`\n * `__compilerVersion` sentinel. Used by test-harness adapters\n * (`@llui/test`'s `testView`) that accept a `ComponentDef` from caller\n * code: if the caller already used `defineTestComponent` (or supplied\n * a real compiled def), the existing version is preserved; otherwise\n * the sentinel silences `warnUncompiledOnce`.\n *\n * Lives inside @llui/dom because `__compilerVersion` is `@internal`\n * and stripped from the dist `.d.ts`; external code can't address the\n * field by name. v2b §6.\n */\nexport function stampTestVersion<S, M, E, D>(\n def: ComponentDef<S, M, E, D>,\n): ComponentDef<S, M, E, D> {\n if (def.__compilerVersion) return def\n return { ...def, __compilerVersion: '__test__' }\n}\n"]}
|
package/dist/internal.d.ts
CHANGED
|
@@ -19,4 +19,5 @@
|
|
|
19
19
|
export { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js';
|
|
20
20
|
export type { RenderContext } from './render-context.js';
|
|
21
21
|
export { createLifetime, disposeLifetime, addDisposer } from './lifetime.js';
|
|
22
|
+
export { defineTestComponentInternal as defineTestComponent, stampTestVersion, type DefineTestComponentInput, } from './internal/test-component-builder.js';
|
|
22
23
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -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"}
|
|
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"}
|
package/dist/internal.js
CHANGED
|
@@ -18,4 +18,5 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export { getRenderContext, setRenderContext, clearRenderContext } from './render-context.js';
|
|
20
20
|
export { createLifetime, disposeLifetime, addDisposer } from './lifetime.js';
|
|
21
|
+
export { defineTestComponentInternal as defineTestComponent, stampTestVersion, } from './internal/test-component-builder.js';
|
|
21
22
|
//# sourceMappingURL=internal.js.map
|
package/dist/internal.js.map
CHANGED
|
@@ -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","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'\n"]}
|
|
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"]}
|
package/dist/lifetime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifetime.d.ts","sourceRoot":"","sources":["../src/lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AA8CnD,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,CA8BhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,iBAAiB,UAAQ,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"lifetime.d.ts","sourceRoot":"","sources":["../src/lifetime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AA8CnD,wBAAgB,cAAc,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,QAAQ,CA8BhE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,iBAAiB,UAAQ,GAAG,IAAI,CA4EhF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAO7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CA6C7D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAIlE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAGzE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,QAAQ,EACf,GAAG,EAAE,MAAM,CAAC,EACZ,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GACxB,CAAC,CASH;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAGvE"}
|
package/dist/lifetime.js
CHANGED
|
@@ -83,7 +83,13 @@ export function disposeLifetime(scope, skipParentRemoval = false) {
|
|
|
83
83
|
// is meant to capture every scope the app destroys, not only ones
|
|
84
84
|
// that had attached work. Outer flag check keeps production (no
|
|
85
85
|
// devtools ever installed) at true zero cost — no parent-chain walk.
|
|
86
|
-
|
|
86
|
+
// Dev-only — wrapped in `import.meta.env?.DEV` so the bundler dead-
|
|
87
|
+
// codes the whole block (including `findInstance` and the parent-
|
|
88
|
+
// chain walk) in production. `anyDisposerLogInstalled` is a static
|
|
89
|
+
// module-level flag never set to true in non-dev runs, so the
|
|
90
|
+
// dropped branch was already unreachable; this guard makes the
|
|
91
|
+
// unreachability bundler-visible.
|
|
92
|
+
if (import.meta.env?.DEV && anyDisposerLogInstalled) {
|
|
87
93
|
const inst = findInstance(scope);
|
|
88
94
|
if (inst?._disposerLog !== undefined) {
|
|
89
95
|
inst._disposerLog.push({
|
|
@@ -113,7 +119,8 @@ export function disposeLifetime(scope, skipParentRemoval = false) {
|
|
|
113
119
|
// Dev-only: emit disposer events into the owning instance's log.
|
|
114
120
|
// Outer flag check keeps production (no devtools ever installed) at
|
|
115
121
|
// true zero cost — skips the O(depth) parent-chain walk entirely.
|
|
116
|
-
|
|
122
|
+
// Dev-only — see disposeLifetime for rationale.
|
|
123
|
+
if (import.meta.env?.DEV && anyDisposerLogInstalled) {
|
|
117
124
|
const inst = findInstance(scope);
|
|
118
125
|
if (inst?._disposerLog !== undefined) {
|
|
119
126
|
inst._disposerLog.push({
|
|
@@ -175,7 +182,13 @@ export function disposeLifetimesBulk(scopes) {
|
|
|
175
182
|
for (let d = 0; d < disposers.length; d++)
|
|
176
183
|
disposers[d]();
|
|
177
184
|
// Dev-only: emit disposer events — same guard as disposeLifetime.
|
|
178
|
-
|
|
185
|
+
// Dev-only — wrapped in `import.meta.env?.DEV` so the bundler dead-
|
|
186
|
+
// codes the whole block (including `findInstance` and the parent-
|
|
187
|
+
// chain walk) in production. `anyDisposerLogInstalled` is a static
|
|
188
|
+
// module-level flag never set to true in non-dev runs, so the
|
|
189
|
+
// dropped branch was already unreachable; this guard makes the
|
|
190
|
+
// unreachability bundler-visible.
|
|
191
|
+
if (import.meta.env?.DEV && anyDisposerLogInstalled) {
|
|
179
192
|
const inst = findInstance(scope);
|
|
180
193
|
if (inst?._disposerLog !== undefined) {
|
|
181
194
|
inst._disposerLog.push({
|
package/dist/lifetime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifetime.js","sourceRoot":"","sources":["../src/lifetime.ts"],"names":[],"mappings":"AAGA,IAAI,MAAM,GAAG,CAAC,CAAA;AAEd;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAAe;IACnC,IAAI,CAAC,GAAoB,KAAK,CAAA;IAC9B,OAAO,CAAC,EAAE,CAAC;QACT,IAAI,CAAC,CAAC,QAAQ;YAAE,OAAO,CAAC,CAAC,QAAQ,CAAA;QACjC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IACd,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,+DAA+D;AAC/D,MAAM,eAAe,GAAe,EAAE,CAAA;AACtC,MAAM,eAAe,GAAsB,EAAE,CAAA;AAC7C,MAAM,cAAc,GAAc,EAAE,CAAA;AACpC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E,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AAClC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAe,EACf,GAAY,EACZ,KAAyB;IAEzB,IAAI,IAAI,GAAM,GAAG,EAAE,CAAA;IACnB,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,GAAG,GAAG,EAAE,CAAA;QACf,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,KAAK,IAAI,CAAC;YAAE,OAAM;QACpD,IAAI,GAAG,CAAC,CAAA;QACR,KAAK,CAAC,CAAC,CAAC,CAAA;IACV,CAAC,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAe,EAAE,QAAoB;IAC/D,IAAI,KAAK,CAAC,SAAS,KAAK,eAAe;QAAE,KAAK,CAAC,SAAS,GAAG,EAAE,CAAA;IAC7D,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAe;IACvC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAChD,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { Lifetime, Binding } from './types.js'\nimport type { ComponentInstance } from './update-loop.js'\n\nlet nextId = 1\n\n/**\n * Walk up the scope chain to find the owning ComponentInstance. The\n * instance is stamped onto the rootLifetime by `installDevTools`, so this\n * returns null in production (no devtools) or for scopes that haven't\n * yet been parented to a tracked root (e.g., during initial creation).\n */\nfunction findInstance(scope: Lifetime): ComponentInstance | null {\n let s: Lifetime | null = scope\n while (s) {\n if (s.instance) return s.instance\n s = s.parent\n }\n return null\n}\n\n// Shared empty arrays — avoid allocating per scope when unused\nconst EMPTY_LIFETIMES: Lifetime[] = []\nconst EMPTY_DISPOSERS: Array<() => void> = []\nconst EMPTY_BINDINGS: Binding[] = []\nconst EMPTY_UPDATERS: Array<() => void> = []\n\n// Lifetime pool — reuse disposed scope objects to reduce GC pressure.\n// Capped to avoid memory leaks in apps that create/destroy thousands of rows.\nconst SCOPE_POOL: Lifetime[] = []\nconst SCOPE_POOL_MAX = 2048\n\n// Dev-mode flag. Flipped to true by installDevTools() once any component\n// instance has a disposer log. In production this stays false forever,\n// and disposeLifetime skips findInstance entirely — zero cost.\nlet anyDisposerLogInstalled = false\n\n/** @internal — called by devtools.ts::installDevTools */\nexport function _markDisposerLogInstalled(): void {\n anyDisposerLogInstalled = true\n}\n\n/** @internal Drain the scope pool — for testing only */\nexport function _drainScopePool(): void {\n SCOPE_POOL.length = 0\n}\n\nexport function createLifetime(parent: Lifetime | null): Lifetime {\n let scope: Lifetime\n if (SCOPE_POOL.length > 0) {\n scope = SCOPE_POOL.pop()!\n scope.id = nextId++\n scope.parent = parent\n // Arrays already reset to empties by dispose. Reset dev-only hints\n // so recycled scopes don't carry stale tagging/back-refs. Cheap\n // (two undefined writes) and keeps production-identical behavior\n // when these fields are never set.\n scope.disposalCause = undefined\n scope.instance = undefined\n scope._kind = undefined\n } else {\n scope = {\n id: nextId++,\n parent,\n children: EMPTY_LIFETIMES,\n disposers: EMPTY_DISPOSERS,\n bindings: EMPTY_BINDINGS,\n itemUpdaters: EMPTY_UPDATERS,\n }\n }\n\n if (parent) {\n if (parent.children === EMPTY_LIFETIMES) parent.children = []\n parent.children.push(scope)\n }\n\n return scope\n}\n\n/**\n * Dispose a scope and all its children. By default, detaches the scope\n * from its parent's `children` array via `indexOf + splice` — O(N) per\n * call, which becomes O(N²) when disposing many sibling scopes in bulk\n * (e.g. `each` clearing 1000 rows).\n *\n * Pass `skipParentRemoval = true` when the caller will batch-remove\n * children afterwards (see `removeOrphanedFromParent`). The scope's\n * `parent` pointer is still set to `null` so the caller can identify\n * orphaned entries.\n */\nexport function disposeLifetime(scope: Lifetime, skipParentRemoval = false): void {\n if (scope.disposers.length === 0 && scope.children.length === 0 && scope.bindings.length === 0) {\n // Dev-only: still emit a DisposerEvent for empty scopes — the log\n // is meant to capture every scope the app destroys, not only ones\n // that had attached work. Outer flag check keeps production (no\n // devtools ever installed) at true zero cost — no parent-chain walk.\n if (anyDisposerLogInstalled) {\n const inst = findInstance(scope)\n if (inst?._disposerLog !== undefined) {\n inst._disposerLog.push({\n scopeId: String(scope.id),\n cause: scope.disposalCause ?? 'component-unmount',\n timestamp: Date.now(),\n })\n }\n }\n if (!skipParentRemoval) removeFromParent(scope)\n scope.parent = null\n // Don't pool empty scopes from the early-return path — they may be\n // disposed idempotently (twice), which would create pool duplicates\n return\n }\n\n // When skipParentRemoval is true, children don't mutate during disposal —\n // iterate directly without allocating a copy. Otherwise, clone to avoid\n // mutation during iteration.\n const children = skipParentRemoval ? scope.children : scope.children.slice()\n for (const child of children) {\n disposeLifetime(child, skipParentRemoval)\n }\n\n for (const disposer of scope.disposers) {\n disposer()\n }\n\n // Dev-only: emit disposer events into the owning instance's log.\n // Outer flag check keeps production (no devtools ever installed) at\n // true zero cost — skips the O(depth) parent-chain walk entirely.\n if (anyDisposerLogInstalled) {\n const inst = findInstance(scope)\n if (inst?._disposerLog !== undefined) {\n inst._disposerLog.push({\n scopeId: String(scope.id),\n cause: scope.disposalCause ?? 'component-unmount',\n timestamp: Date.now(),\n })\n }\n }\n\n // Mark bindings as dead and break closure/DOM retention\n for (const binding of scope.bindings) {\n binding.dead = true\n binding.accessor = null!\n binding.node = null!\n binding.lastValue = undefined\n }\n\n // Reset to shared empties — don't just truncate, so pooled scopes\n // don't hold allocated-but-empty arrays\n scope.disposers = EMPTY_DISPOSERS\n scope.bindings = EMPTY_BINDINGS\n scope.children = EMPTY_LIFETIMES\n scope.itemUpdaters = EMPTY_UPDATERS\n\n if (!skipParentRemoval) removeFromParent(scope)\n scope.parent = null\n\n // Return to pool for reuse\n if (SCOPE_POOL.length < SCOPE_POOL_MAX) SCOPE_POOL.push(scope)\n}\n\n/**\n * Batch-remove children with `parent === null` from `parent.children`.\n * Called after a bulk `disposeLifetime(child, true)` pass to collapse the\n * individual O(N) splice operations into one O(N) scan.\n */\nexport function removeOrphanedChildren(parent: Lifetime): void {\n const children = parent.children\n let w = 0\n for (let r = 0; r < children.length; r++) {\n if (children[r]!.parent !== null) children[w++] = children[r]!\n }\n children.length = w\n}\n\n/**\n * Bulk dispose an array of sibling scopes — avoids per-scope function call\n * overhead. Used by each() clear path where 1000+ scopes are disposed at once.\n * Caller must call removeOrphanedChildren(parent) afterwards.\n */\nexport function disposeLifetimesBulk(scopes: Lifetime[]): void {\n for (let i = 0; i < scopes.length; i++) {\n const scope = scopes[i]!\n // Recursively dispose children\n const children = scope.children\n if (children.length > 0) {\n disposeLifetimesBulk(children)\n }\n // Run disposers\n const disposers = scope.disposers\n for (let d = 0; d < disposers.length; d++) disposers[d]!()\n // Dev-only: emit disposer events — same guard as disposeLifetime.\n if (anyDisposerLogInstalled) {\n const inst = findInstance(scope)\n if (inst?._disposerLog !== undefined) {\n inst._disposerLog.push({\n scopeId: String(scope.id),\n cause: scope.disposalCause ?? 'component-unmount',\n timestamp: Date.now(),\n })\n }\n }\n // Mark bindings dead\n const bindings = scope.bindings\n for (let b = 0; b < bindings.length; b++) {\n const binding = bindings[b]!\n binding.dead = true\n binding.accessor = null!\n binding.node = null!\n binding.lastValue = undefined\n }\n // Reset to shared empties + detach from parent + return to pool\n scope.disposers = EMPTY_DISPOSERS\n scope.bindings = EMPTY_BINDINGS\n scope.children = EMPTY_LIFETIMES\n scope.itemUpdaters = EMPTY_UPDATERS\n scope.parent = null\n if (SCOPE_POOL.length < SCOPE_POOL_MAX) SCOPE_POOL.push(scope)\n }\n}\n\nexport function addBinding(scope: Lifetime, binding: Binding): void {\n binding.ownerLifetime = scope\n if (scope.bindings === EMPTY_BINDINGS) scope.bindings = []\n scope.bindings.push(binding)\n}\n\nexport function addItemUpdater(scope: Lifetime, updater: () => void): void {\n if (scope.itemUpdaters === EMPTY_UPDATERS) scope.itemUpdaters = []\n scope.itemUpdaters.push(updater)\n}\n\n/**\n * Register a per-item updater that compares the new value against the last\n * value before applying. Shared by `text()`, `elSplit()`, and `elTemplate()`\n * so the equality-check logic lives in one place.\n *\n * @param apply - DOM write: receives the new value when it differs\n * @returns the initial value (caller should apply it to the DOM)\n */\nexport function addCheckedItemUpdater<V>(\n scope: Lifetime,\n get: () => V,\n apply: (value: V) => void,\n): V {\n let last: V = get()\n addItemUpdater(scope, () => {\n const v = get()\n if (v === last || (v !== v && last !== last)) return\n last = v\n apply(v)\n })\n return last\n}\n\nexport function addDisposer(scope: Lifetime, disposer: () => void): void {\n if (scope.disposers === EMPTY_DISPOSERS) scope.disposers = []\n scope.disposers.push(disposer)\n}\n\nfunction removeFromParent(scope: Lifetime): void {\n if (scope.parent) {\n const idx = scope.parent.children.indexOf(scope)\n if (idx !== -1) {\n scope.parent.children.splice(idx, 1)\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"lifetime.js","sourceRoot":"","sources":["../src/lifetime.ts"],"names":[],"mappings":"AAGA,IAAI,MAAM,GAAG,CAAC,CAAA;AAEd;;;;;GAKG;AACH,SAAS,YAAY,CAAC,KAAe;IACnC,IAAI,CAAC,GAAoB,KAAK,CAAA;IAC9B,OAAO,CAAC,EAAE,CAAC;QACT,IAAI,CAAC,CAAC,QAAQ;YAAE,OAAO,CAAC,CAAC,QAAQ,CAAA;QACjC,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;IACd,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,+DAA+D;AAC/D,MAAM,eAAe,GAAe,EAAE,CAAA;AACtC,M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,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAChD,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { Lifetime, Binding } from './types.js'\nimport type { ComponentInstance } from './update-loop.js'\n\nlet nextId = 1\n\n/**\n * Walk up the scope chain to find the owning ComponentInstance. The\n * instance is stamped onto the rootLifetime by `installDevTools`, so this\n * returns null in production (no devtools) or for scopes that haven't\n * yet been parented to a tracked root (e.g., during initial creation).\n */\nfunction findInstance(scope: Lifetime): ComponentInstance | null {\n let s: Lifetime | null = scope\n while (s) {\n if (s.instance) return s.instance\n s = s.parent\n }\n return null\n}\n\n// Shared empty arrays — avoid allocating per scope when unused\nconst EMPTY_LIFETIMES: Lifetime[] = []\nconst EMPTY_DISPOSERS: Array<() => void> = []\nconst EMPTY_BINDINGS: Binding[] = []\nconst EMPTY_UPDATERS: Array<() => void> = []\n\n// Lifetime pool — reuse disposed scope objects to reduce GC pressure.\n// Capped to avoid memory leaks in apps that create/destroy thousands of rows.\nconst SCOPE_POOL: Lifetime[] = []\nconst SCOPE_POOL_MAX = 2048\n\n// Dev-mode flag. Flipped to true by installDevTools() once any component\n// instance has a disposer log. In production this stays false forever,\n// and disposeLifetime skips findInstance entirely — zero cost.\nlet anyDisposerLogInstalled = false\n\n/** @internal — called by devtools.ts::installDevTools */\nexport function _markDisposerLogInstalled(): void {\n anyDisposerLogInstalled = true\n}\n\n/** @internal Drain the scope pool — for testing only */\nexport function _drainScopePool(): void {\n SCOPE_POOL.length = 0\n}\n\nexport function createLifetime(parent: Lifetime | null): Lifetime {\n let scope: Lifetime\n if (SCOPE_POOL.length > 0) {\n scope = SCOPE_POOL.pop()!\n scope.id = nextId++\n scope.parent = parent\n // Arrays already reset to empties by dispose. Reset dev-only hints\n // so recycled scopes don't carry stale tagging/back-refs. Cheap\n // (two undefined writes) and keeps production-identical behavior\n // when these fields are never set.\n scope.disposalCause = undefined\n scope.instance = undefined\n scope._kind = undefined\n } else {\n scope = {\n id: nextId++,\n parent,\n children: EMPTY_LIFETIMES,\n disposers: EMPTY_DISPOSERS,\n bindings: EMPTY_BINDINGS,\n itemUpdaters: EMPTY_UPDATERS,\n }\n }\n\n if (parent) {\n if (parent.children === EMPTY_LIFETIMES) parent.children = []\n parent.children.push(scope)\n }\n\n return scope\n}\n\n/**\n * Dispose a scope and all its children. By default, detaches the scope\n * from its parent's `children` array via `indexOf + splice` — O(N) per\n * call, which becomes O(N²) when disposing many sibling scopes in bulk\n * (e.g. `each` clearing 1000 rows).\n *\n * Pass `skipParentRemoval = true` when the caller will batch-remove\n * children afterwards (see `removeOrphanedFromParent`). The scope's\n * `parent` pointer is still set to `null` so the caller can identify\n * orphaned entries.\n */\nexport function disposeLifetime(scope: Lifetime, skipParentRemoval = false): void {\n if (scope.disposers.length === 0 && scope.children.length === 0 && scope.bindings.length === 0) {\n // Dev-only: still emit a DisposerEvent for empty scopes — the log\n // is meant to capture every scope the app destroys, not only ones\n // that had attached work. Outer flag check keeps production (no\n // devtools ever installed) at true zero cost — no parent-chain walk.\n // Dev-only — wrapped in `import.meta.env?.DEV` so the bundler dead-\n // codes the whole block (including `findInstance` and the parent-\n // chain walk) in production. `anyDisposerLogInstalled` is a static\n // module-level flag never set to true in non-dev runs, so the\n // dropped branch was already unreachable; this guard makes the\n // unreachability bundler-visible.\n if (import.meta.env?.DEV && anyDisposerLogInstalled) {\n const inst = findInstance(scope)\n if (inst?._disposerLog !== undefined) {\n inst._disposerLog.push({\n scopeId: String(scope.id),\n cause: scope.disposalCause ?? 'component-unmount',\n timestamp: Date.now(),\n })\n }\n }\n if (!skipParentRemoval) removeFromParent(scope)\n scope.parent = null\n // Don't pool empty scopes from the early-return path — they may be\n // disposed idempotently (twice), which would create pool duplicates\n return\n }\n\n // When skipParentRemoval is true, children don't mutate during disposal —\n // iterate directly without allocating a copy. Otherwise, clone to avoid\n // mutation during iteration.\n const children = skipParentRemoval ? scope.children : scope.children.slice()\n for (const child of children) {\n disposeLifetime(child, skipParentRemoval)\n }\n\n for (const disposer of scope.disposers) {\n disposer()\n }\n\n // Dev-only: emit disposer events into the owning instance's log.\n // Outer flag check keeps production (no devtools ever installed) at\n // true zero cost — skips the O(depth) parent-chain walk entirely.\n // Dev-only — see disposeLifetime for rationale.\n if (import.meta.env?.DEV && anyDisposerLogInstalled) {\n const inst = findInstance(scope)\n if (inst?._disposerLog !== undefined) {\n inst._disposerLog.push({\n scopeId: String(scope.id),\n cause: scope.disposalCause ?? 'component-unmount',\n timestamp: Date.now(),\n })\n }\n }\n\n // Mark bindings as dead and break closure/DOM retention\n for (const binding of scope.bindings) {\n binding.dead = true\n binding.accessor = null!\n binding.node = null!\n binding.lastValue = undefined\n }\n\n // Reset to shared empties — don't just truncate, so pooled scopes\n // don't hold allocated-but-empty arrays\n scope.disposers = EMPTY_DISPOSERS\n scope.bindings = EMPTY_BINDINGS\n scope.children = EMPTY_LIFETIMES\n scope.itemUpdaters = EMPTY_UPDATERS\n\n if (!skipParentRemoval) removeFromParent(scope)\n scope.parent = null\n\n // Return to pool for reuse\n if (SCOPE_POOL.length < SCOPE_POOL_MAX) SCOPE_POOL.push(scope)\n}\n\n/**\n * Batch-remove children with `parent === null` from `parent.children`.\n * Called after a bulk `disposeLifetime(child, true)` pass to collapse the\n * individual O(N) splice operations into one O(N) scan.\n */\nexport function removeOrphanedChildren(parent: Lifetime): void {\n const children = parent.children\n let w = 0\n for (let r = 0; r < children.length; r++) {\n if (children[r]!.parent !== null) children[w++] = children[r]!\n }\n children.length = w\n}\n\n/**\n * Bulk dispose an array of sibling scopes — avoids per-scope function call\n * overhead. Used by each() clear path where 1000+ scopes are disposed at once.\n * Caller must call removeOrphanedChildren(parent) afterwards.\n */\nexport function disposeLifetimesBulk(scopes: Lifetime[]): void {\n for (let i = 0; i < scopes.length; i++) {\n const scope = scopes[i]!\n // Recursively dispose children\n const children = scope.children\n if (children.length > 0) {\n disposeLifetimesBulk(children)\n }\n // Run disposers\n const disposers = scope.disposers\n for (let d = 0; d < disposers.length; d++) disposers[d]!()\n // Dev-only: emit disposer events — same guard as disposeLifetime.\n // Dev-only — wrapped in `import.meta.env?.DEV` so the bundler dead-\n // codes the whole block (including `findInstance` and the parent-\n // chain walk) in production. `anyDisposerLogInstalled` is a static\n // module-level flag never set to true in non-dev runs, so the\n // dropped branch was already unreachable; this guard makes the\n // unreachability bundler-visible.\n if (import.meta.env?.DEV && anyDisposerLogInstalled) {\n const inst = findInstance(scope)\n if (inst?._disposerLog !== undefined) {\n inst._disposerLog.push({\n scopeId: String(scope.id),\n cause: scope.disposalCause ?? 'component-unmount',\n timestamp: Date.now(),\n })\n }\n }\n // Mark bindings dead\n const bindings = scope.bindings\n for (let b = 0; b < bindings.length; b++) {\n const binding = bindings[b]!\n binding.dead = true\n binding.accessor = null!\n binding.node = null!\n binding.lastValue = undefined\n }\n // Reset to shared empties + detach from parent + return to pool\n scope.disposers = EMPTY_DISPOSERS\n scope.bindings = EMPTY_BINDINGS\n scope.children = EMPTY_LIFETIMES\n scope.itemUpdaters = EMPTY_UPDATERS\n scope.parent = null\n if (SCOPE_POOL.length < SCOPE_POOL_MAX) SCOPE_POOL.push(scope)\n }\n}\n\nexport function addBinding(scope: Lifetime, binding: Binding): void {\n binding.ownerLifetime = scope\n if (scope.bindings === EMPTY_BINDINGS) scope.bindings = []\n scope.bindings.push(binding)\n}\n\nexport function addItemUpdater(scope: Lifetime, updater: () => void): void {\n if (scope.itemUpdaters === EMPTY_UPDATERS) scope.itemUpdaters = []\n scope.itemUpdaters.push(updater)\n}\n\n/**\n * Register a per-item updater that compares the new value against the last\n * value before applying. Shared by `text()`, `elSplit()`, and `elTemplate()`\n * so the equality-check logic lives in one place.\n *\n * @param apply - DOM write: receives the new value when it differs\n * @returns the initial value (caller should apply it to the DOM)\n */\nexport function addCheckedItemUpdater<V>(\n scope: Lifetime,\n get: () => V,\n apply: (value: V) => void,\n): V {\n let last: V = get()\n addItemUpdater(scope, () => {\n const v = get()\n if (v === last || (v !== v && last !== last)) return\n last = v\n apply(v)\n })\n return last\n}\n\nexport function addDisposer(scope: Lifetime, disposer: () => void): void {\n if (scope.disposers === EMPTY_DISPOSERS) scope.disposers = []\n scope.disposers.push(disposer)\n}\n\nfunction removeFromParent(scope: Lifetime): void {\n if (scope.parent) {\n const idx = scope.parent.children.indexOf(scope)\n if (idx !== -1) {\n scope.parent.children.splice(idx, 1)\n }\n }\n}\n"]}
|
package/dist/mount.d.ts
CHANGED
package/dist/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,KAAK,MAAM,EAAc,MAAM,cAAc,CAAA;AA6CtD,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;AAoCD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAA;IACzB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;;;;;;;;;;;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AAC,EAC7B,WAAW,EAAE,CAAC,EACd,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CAoFX;AAmKD,wBAAgB,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAC1C,SAAS,EAAE,WAAW,EACtB,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7B,WAAW,EAAE,CAAC,EACd,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CA6FX"}
|
package/dist/mount.js
CHANGED
|
@@ -5,7 +5,7 @@ import { setRenderContext, clearRenderContext } from './render-context.js';
|
|
|
5
5
|
import { setFlatBindings } from './binding.js';
|
|
6
6
|
import { getBindingDescriptors } from './binding-descriptors.js';
|
|
7
7
|
import { registerInstance, unregisterInstance } from './runtime.js';
|
|
8
|
-
import {
|
|
8
|
+
import { getInstanceViewBag } from './render-context.js';
|
|
9
9
|
import { pushMountQueue, popMountQueue, flushMountQueue } from './primitives/on-mount.js';
|
|
10
10
|
// ── Sentinel-region helpers (used by anchor-based mount primitives) ─────
|
|
11
11
|
/**
|
|
@@ -78,14 +78,14 @@ export function mountApp(container, def, data, options) {
|
|
|
78
78
|
// handle, which in a layout setup means the layout re-mounts at the
|
|
79
79
|
// root and the rest of the chain is re-established via the normal
|
|
80
80
|
// mount path.
|
|
81
|
-
if (hmrModule && def.name && !options?.parentLifetime) {
|
|
81
|
+
if (import.meta.env?.DEV && hmrModule && def.name && !options?.parentLifetime) {
|
|
82
82
|
const swapped = hmrModule.replaceComponentForContainer(def.name, def, container);
|
|
83
83
|
if (swapped)
|
|
84
84
|
return swapped;
|
|
85
85
|
}
|
|
86
86
|
const inst = createComponentInstance(def, data, options?.parentLifetime ?? null, options?.env);
|
|
87
87
|
// Dev-only: auto-install devtools if enabled via '@llui/dom/devtools' import
|
|
88
|
-
if (devToolsInstall)
|
|
88
|
+
if (import.meta.env?.DEV && devToolsInstall)
|
|
89
89
|
devToolsInstall(inst);
|
|
90
90
|
// Dev-only: warn if initial state contains non-serializable values.
|
|
91
91
|
// Silent bug-bomb: Date/Map/Set/class instances break SSR, hydration, replay tools.
|
|
@@ -109,7 +109,7 @@ export function mountApp(container, def, data, options) {
|
|
|
109
109
|
send: inst.send,
|
|
110
110
|
instance: inst,
|
|
111
111
|
});
|
|
112
|
-
const nodes = def.view(
|
|
112
|
+
const nodes = def.view(getInstanceViewBag(inst, inst.send));
|
|
113
113
|
clearRenderContext();
|
|
114
114
|
setFlatBindings(null);
|
|
115
115
|
popMountQueue(prevMountQueue);
|
|
@@ -130,7 +130,7 @@ export function mountApp(container, def, data, options) {
|
|
|
130
130
|
// against a fully-wired tree.
|
|
131
131
|
flushMountQueue(onMountQueue);
|
|
132
132
|
registerInstance(inst);
|
|
133
|
-
if (hmrModule && def.name) {
|
|
133
|
+
if (import.meta.env?.DEV && hmrModule && def.name) {
|
|
134
134
|
hmrModule.registerForHmr(def.name, inst, container);
|
|
135
135
|
}
|
|
136
136
|
dispatchInitialEffects(inst);
|
|
@@ -202,7 +202,7 @@ export function mountAtAnchor(anchor, def, data, options) {
|
|
|
202
202
|
// Without this, the existing end sentinel below would be reused but
|
|
203
203
|
// the prior instance would be fully orphaned (lifetime not disposed,
|
|
204
204
|
// HMR entry not unregistered, activeInstances entry not removed).
|
|
205
|
-
if (hmrModule && def.name && !options?.parentLifetime) {
|
|
205
|
+
if (import.meta.env?.DEV && hmrModule && def.name && !options?.parentLifetime) {
|
|
206
206
|
const swapped = hmrModule.replaceComponentForAnchor(def.name, def, anchor);
|
|
207
207
|
if (swapped)
|
|
208
208
|
return swapped;
|
|
@@ -227,7 +227,7 @@ export function mountAtAnchor(anchor, def, data, options) {
|
|
|
227
227
|
anchor.parentNode.insertBefore(endSentinel, anchor.nextSibling);
|
|
228
228
|
}
|
|
229
229
|
const inst = createComponentInstance(def, data, options?.parentLifetime ?? null, options?.env);
|
|
230
|
-
if (devToolsInstall)
|
|
230
|
+
if (import.meta.env?.DEV && devToolsInstall)
|
|
231
231
|
devToolsInstall(inst);
|
|
232
232
|
if (import.meta.env?.DEV) {
|
|
233
233
|
const offender = findNonSerializable(inst.state);
|
|
@@ -245,7 +245,7 @@ export function mountAtAnchor(anchor, def, data, options) {
|
|
|
245
245
|
send: inst.send,
|
|
246
246
|
instance: inst,
|
|
247
247
|
});
|
|
248
|
-
const nodes = def.view(
|
|
248
|
+
const nodes = def.view(getInstanceViewBag(inst, inst.send));
|
|
249
249
|
clearRenderContext();
|
|
250
250
|
setFlatBindings(null);
|
|
251
251
|
popMountQueue(prevMountQueue);
|
|
@@ -261,7 +261,7 @@ export function mountAtAnchor(anchor, def, data, options) {
|
|
|
261
261
|
}
|
|
262
262
|
flushMountQueue(onMountQueue);
|
|
263
263
|
registerInstance(inst);
|
|
264
|
-
if (hmrModule && def.name) {
|
|
264
|
+
if (import.meta.env?.DEV && hmrModule && def.name) {
|
|
265
265
|
hmrModule.registerForAnchor(def.name, inst, anchor, endSentinel);
|
|
266
266
|
}
|
|
267
267
|
dispatchInitialEffects(inst);
|
|
@@ -292,7 +292,7 @@ export function hydrateAtAnchor(anchor, def, serverState, options) {
|
|
|
292
292
|
// (typical of HMR module re-execution) hot-swaps in place. Matches
|
|
293
293
|
// mountAtAnchor's behavior. Without this, the second call leaks the
|
|
294
294
|
// first instance and stacks a second HMR entry under the same name.
|
|
295
|
-
if (hmrModule && def.name && !options?.parentLifetime) {
|
|
295
|
+
if (import.meta.env?.DEV && hmrModule && def.name && !options?.parentLifetime) {
|
|
296
296
|
const swapped = hmrModule.replaceComponentForAnchor(def.name, def, anchor);
|
|
297
297
|
if (swapped)
|
|
298
298
|
return swapped;
|
|
@@ -314,7 +314,7 @@ export function hydrateAtAnchor(anchor, def, serverState, options) {
|
|
|
314
314
|
init: () => [serverState, originalEffects],
|
|
315
315
|
};
|
|
316
316
|
const inst = createComponentInstance(hydrateDef, undefined, options?.parentLifetime ?? null, options?.env);
|
|
317
|
-
if (devToolsInstall)
|
|
317
|
+
if (import.meta.env?.DEV && devToolsInstall)
|
|
318
318
|
devToolsInstall(inst);
|
|
319
319
|
const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue();
|
|
320
320
|
setFlatBindings(inst.allBindings);
|
|
@@ -324,7 +324,7 @@ export function hydrateAtAnchor(anchor, def, serverState, options) {
|
|
|
324
324
|
send: inst.send,
|
|
325
325
|
instance: inst,
|
|
326
326
|
});
|
|
327
|
-
const nodes = hydrateDef.view(
|
|
327
|
+
const nodes = hydrateDef.view(getInstanceViewBag(inst, inst.send));
|
|
328
328
|
clearRenderContext();
|
|
329
329
|
setFlatBindings(null);
|
|
330
330
|
popMountQueue(prevMountQueue);
|
|
@@ -339,7 +339,7 @@ export function hydrateAtAnchor(anchor, def, serverState, options) {
|
|
|
339
339
|
}
|
|
340
340
|
flushMountQueue(onMountQueue);
|
|
341
341
|
registerInstance(inst);
|
|
342
|
-
if (hmrModule && def.name) {
|
|
342
|
+
if (import.meta.env?.DEV && hmrModule && def.name) {
|
|
343
343
|
hmrModule.registerForAnchor(def.name, inst, anchor, endSentinel);
|
|
344
344
|
}
|
|
345
345
|
// Hydration: skip init's effects by default. The SSR pass already ran
|
|
@@ -426,13 +426,14 @@ function buildAppHandle(inst, hmrName, domCleanup) {
|
|
|
426
426
|
disposed = true;
|
|
427
427
|
listeners.clear();
|
|
428
428
|
inst._onCommit = undefined;
|
|
429
|
-
if (hmrModule && hmrName)
|
|
429
|
+
if (import.meta.env?.DEV && hmrModule && hmrName)
|
|
430
430
|
hmrModule.unregisterForHmr(hmrName, inst);
|
|
431
431
|
inst.abortController.abort();
|
|
432
432
|
unregisterInstance(inst);
|
|
433
433
|
// Tag the root scope so the disposer log reports app-level
|
|
434
434
|
// teardown distinct from in-tree component-unmount events.
|
|
435
|
-
|
|
435
|
+
if (import.meta.env?.DEV)
|
|
436
|
+
inst.rootLifetime.disposalCause = 'app-unmount';
|
|
436
437
|
disposeLifetime(inst.rootLifetime);
|
|
437
438
|
domCleanup();
|
|
438
439
|
},
|
|
@@ -448,9 +449,12 @@ function buildAppHandle(inst, hmrName, domCleanup) {
|
|
|
448
449
|
},
|
|
449
450
|
getState() {
|
|
450
451
|
if (disposed) {
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
452
|
+
if (import.meta.env?.DEV) {
|
|
453
|
+
throw new Error('[LLui] AppHandle.getState() called after dispose — handle is dead. ' +
|
|
454
|
+
'Detach your event listener / cancel your timer when the handle ' +
|
|
455
|
+
'is disposed to avoid stale reads.');
|
|
456
|
+
}
|
|
457
|
+
throw new Error('[LLui] AppHandle.getState() after dispose');
|
|
454
458
|
}
|
|
455
459
|
return inst.state;
|
|
456
460
|
},
|
|
@@ -461,6 +465,12 @@ function buildAppHandle(inst, hmrName, domCleanup) {
|
|
|
461
465
|
return () => listeners.delete(listener);
|
|
462
466
|
},
|
|
463
467
|
getBindingDescriptors() {
|
|
468
|
+
// Agent-only — returns an empty array when the build-time flag is
|
|
469
|
+
// off so callers get a consistent shape. The body's `getBindingDescriptors`
|
|
470
|
+
// import becomes dead-code-eliminable along with the rest of
|
|
471
|
+
// `binding-descriptors.ts`.
|
|
472
|
+
if (typeof __LLUI_AGENT__ === 'undefined' || !__LLUI_AGENT__)
|
|
473
|
+
return [];
|
|
464
474
|
if (disposed)
|
|
465
475
|
return [];
|
|
466
476
|
return getBindingDescriptors(inst);
|
|
@@ -507,7 +517,7 @@ export function hydrateApp(container, def, serverState, options) {
|
|
|
507
517
|
// semantics as mountApp's fast path: the live instance keeps its
|
|
508
518
|
// current state and the new def's `serverState` argument is
|
|
509
519
|
// intentionally ignored on the swap (HMR preserves user state).
|
|
510
|
-
if (hmrModule && def.name && !options?.parentLifetime) {
|
|
520
|
+
if (import.meta.env?.DEV && hmrModule && def.name && !options?.parentLifetime) {
|
|
511
521
|
const swapped = hmrModule.replaceComponentForContainer(def.name, def, container);
|
|
512
522
|
if (swapped)
|
|
513
523
|
return swapped;
|
|
@@ -533,7 +543,7 @@ export function hydrateApp(container, def, serverState, options) {
|
|
|
533
543
|
// `window.__lluiDebug`, and is invisible to MCP / agent client /
|
|
534
544
|
// devtools console — so a vike SSR app's outermost layout silently
|
|
535
545
|
// drops out of every observability surface.
|
|
536
|
-
if (devToolsInstall)
|
|
546
|
+
if (import.meta.env?.DEV && devToolsInstall)
|
|
537
547
|
devToolsInstall(inst);
|
|
538
548
|
// Build the component DOM and swap atomically with server HTML.
|
|
539
549
|
// Server HTML remains visible until JS finishes — no flash.
|
|
@@ -547,7 +557,7 @@ export function hydrateApp(container, def, serverState, options) {
|
|
|
547
557
|
send: inst.send,
|
|
548
558
|
instance: inst,
|
|
549
559
|
});
|
|
550
|
-
const nodes = hydrateDef.view(
|
|
560
|
+
const nodes = hydrateDef.view(getInstanceViewBag(inst, inst.send));
|
|
551
561
|
clearRenderContext();
|
|
552
562
|
setFlatBindings(null);
|
|
553
563
|
popMountQueue(prevMountQueue);
|
|
@@ -572,7 +582,7 @@ export function hydrateApp(container, def, serverState, options) {
|
|
|
572
582
|
// hydrateAtAnchor. Without it, replaceComponent(name, newDef)
|
|
573
583
|
// silently no-ops on the hydrated layout layer because the HMR
|
|
574
584
|
// registry has no entry for it.
|
|
575
|
-
if (hmrModule && hydrateDef.name) {
|
|
585
|
+
if (import.meta.env?.DEV && hmrModule && hydrateDef.name) {
|
|
576
586
|
hmrModule.registerForHmr(hydrateDef.name, inst, container);
|
|
577
587
|
}
|
|
578
588
|
return buildAppHandle(inst, hydrateDef.name ?? null, () => {
|