@llui/dom 0.0.20 → 0.0.22
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/README.md +16 -14
- package/dist/addressed.d.ts +1 -1
- package/dist/addressed.d.ts.map +1 -1
- package/dist/addressed.js.map +1 -1
- package/dist/binding.d.ts +2 -2
- package/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +2 -2
- package/dist/binding.js.map +1 -1
- package/dist/devtools.d.ts +3 -3
- package/dist/devtools.d.ts.map +1 -1
- package/dist/devtools.js +14 -12
- package/dist/devtools.js.map +1 -1
- package/dist/el-split.js +3 -3
- package/dist/el-split.js.map +1 -1
- package/dist/el-template.js +3 -3
- package/dist/el-template.js.map +1 -1
- package/dist/elements.js +1 -1
- package/dist/elements.js.map +1 -1
- package/dist/hmr.d.ts +1 -1
- package/dist/hmr.d.ts.map +1 -1
- package/dist/hmr.js +6 -6
- package/dist/hmr.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/internal.js.map +1 -1
- package/dist/lifetime.d.ts +39 -0
- package/dist/lifetime.d.ts.map +1 -0
- package/dist/lifetime.js +250 -0
- package/dist/lifetime.js.map +1 -0
- package/dist/mathml-elements.js +1 -1
- package/dist/mathml-elements.js.map +1 -1
- package/dist/mount.d.ts +11 -9
- package/dist/mount.d.ts.map +1 -1
- package/dist/mount.js +15 -31
- package/dist/mount.js.map +1 -1
- package/dist/primitives/branch.d.ts +1 -1
- package/dist/primitives/branch.d.ts.map +1 -1
- package/dist/primitives/branch.js +30 -20
- package/dist/primitives/branch.js.map +1 -1
- package/dist/primitives/child.js +12 -12
- package/dist/primitives/child.js.map +1 -1
- package/dist/primitives/context.js +6 -6
- package/dist/primitives/context.js.map +1 -1
- package/dist/primitives/each.d.ts.map +1 -1
- package/dist/primitives/each.js +37 -32
- package/dist/primitives/each.js.map +1 -1
- package/dist/primitives/error-boundary.js +7 -7
- package/dist/primitives/error-boundary.js.map +1 -1
- package/dist/primitives/foreign.js +3 -3
- package/dist/primitives/foreign.js.map +1 -1
- package/dist/primitives/lazy.js +11 -11
- package/dist/primitives/lazy.js.map +1 -1
- package/dist/primitives/on-mount.js +2 -2
- package/dist/primitives/on-mount.js.map +1 -1
- package/dist/primitives/portal.js +4 -4
- package/dist/primitives/portal.js.map +1 -1
- package/dist/primitives/sample.d.ts +18 -0
- package/dist/primitives/sample.d.ts.map +1 -0
- package/dist/primitives/sample.js +22 -0
- package/dist/primitives/sample.js.map +1 -0
- package/dist/primitives/scope.d.ts +25 -0
- package/dist/primitives/scope.d.ts.map +1 -0
- package/dist/primitives/scope.js +36 -0
- package/dist/primitives/scope.js.map +1 -0
- package/dist/primitives/selector.js +4 -4
- package/dist/primitives/selector.js.map +1 -1
- package/dist/primitives/show.d.ts.map +1 -1
- package/dist/primitives/show.js +4 -1
- package/dist/primitives/show.js.map +1 -1
- package/dist/primitives/slice.d.ts.map +1 -1
- package/dist/primitives/slice.js +18 -2
- package/dist/primitives/slice.js.map +1 -1
- package/dist/primitives/text.js +3 -3
- package/dist/primitives/text.js.map +1 -1
- package/dist/primitives/virtual-each.d.ts.map +1 -1
- package/dist/primitives/virtual-each.js +9 -9
- package/dist/primitives/virtual-each.js.map +1 -1
- package/dist/render-context.d.ts +2 -2
- package/dist/render-context.d.ts.map +1 -1
- package/dist/render-context.js.map +1 -1
- package/dist/ssr.d.ts +4 -4
- package/dist/ssr.d.ts.map +1 -1
- package/dist/ssr.js +3 -3
- package/dist/ssr.js.map +1 -1
- package/dist/svg-elements.js +1 -1
- package/dist/svg-elements.js.map +1 -1
- package/dist/tracking/disposer-log.d.ts +4 -4
- package/dist/tracking/disposer-log.d.ts.map +1 -1
- package/dist/tracking/disposer-log.js.map +1 -1
- package/dist/types.d.ts +79 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/update-loop.d.ts +3 -3
- package/dist/update-loop.d.ts.map +1 -1
- package/dist/update-loop.js +12 -8
- package/dist/update-loop.js.map +1 -1
- package/dist/view-helpers.d.ts +10 -2
- package/dist/view-helpers.d.ts.map +1 -1
- package/dist/view-helpers.js +4 -0
- package/dist/view-helpers.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mathml-elements.js","sourceRoot":"","sources":["../src/mathml-elements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,MAAM,SAAS,GAAG,oCAAoC,CAAA;AAMtD,SAAS,mBAAmB,CAC1B,GAAW,EACX,eAAyC,EACzC,aAAwB;IAExB,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC,SAAS,EAAE,GAAG,CAAkB,CAAA;IACpE,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAA;IAE9B,MAAM,KAAK,GAA6B,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;QACpE,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,eAAe,CAAA;IACnB,MAAM,QAAQ,GAAyB,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC;QACnE,CAAC,CAAC,eAAe;QACjB,CAAC,CAAC,aAAa,CAAA;IAEjB,IAAI,KAAK,EAAE,CAAC;QACV,KAAK,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,IAAI,MAAM,KAAK,KAAK;gBAAE,SAAQ;YAE9B,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC5B,MAAM,SA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AC,MAAM,MAAM,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAa,CAAA;AAEtH,cAAc;AACd,kBAAkB;AAClB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,mBAAmB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAa,CAAA;AAExH,YAAY;AACZ,kBAAkB;AAClB,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,mBAAmB,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC,CAAa,CAAA;AAC5H,kBAAkB;AAClB,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,mBAAmB,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAa,CAAA;AAC9H,kBAAkB;AAClB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAa,CAAA;AACrI,oBAAoB","sourcesContent":["import type { BindingKind } from './types.js'\nimport { getRenderContext } from './render-context.js'\nimport { createBinding, applyBinding } from './binding.js'\nimport { FULL_MASK } from './update-loop.js'\n\nconst MATHML_NS = 'http://www.w3.org/1998/Math/MathML'\n\ntype ElementProps = Record<string, unknown>\ntype Child = Node | string | Node[]\ntype Children = Child[]\n\nfunction createMathmlElement(\n tag: string,\n propsOrChildren?: ElementProps | Children,\n maybeChildren?: Children,\n): MathMLElement {\n const el = document.createElementNS(MATHML_NS, tag) as MathMLElement\n const ctx = getRenderContext()\n\n const props: ElementProps | undefined = Array.isArray(propsOrChildren)\n ? undefined\n : propsOrChildren\n const children: Children | undefined = Array.isArray(propsOrChildren)\n ? propsOrChildren\n : maybeChildren\n\n if (props) {\n for (const [rawKey, value] of Object.entries(props)) {\n if (rawKey === 'key') continue\n\n if (/^on[A-Z]/.test(rawKey)) {\n const eventName = rawKey.slice(2).toLowerCase()\n el.addEventListener(eventName, value as EventListener)\n continue\n }\n\n if (typeof value === 'function') {\n const kind: BindingKind = rawKey === 'class' || rawKey === 'className' ? 'class' : 'attr'\n const key = kind === 'class' ? undefined : rawKey\n const accessor = value as (state: never) => unknown\n const perItem = value.length === 0\n\n const binding = createBinding(ctx.rootScope, {\n mask: FULL_MASK,\n accessor,\n kind,\n node: el,\n key,\n perItem,\n })\n\n const initialValue = perItem ? (value as () => unknown)() : accessor(ctx.state as never)\n binding.lastValue = initialValue\n applyBinding({ kind, node: el, key }, initialValue)\n continue\n }\n\n if (rawKey === 'class' || rawKey === 'className') {\n applyBinding({ kind: 'class', node: el, key: undefined }, value)\n } else {\n applyBinding({ kind: 'attr', node: el, key: rawKey }, value)\n }\n }\n }\n\n if (children) {\n for (const child of children) {\n if (typeof child === 'string') {\n el.appendChild(document.createTextNode(child))\n } else if (Array.isArray(child)) {\n for (const node of child) el.appendChild(node)\n } else {\n el.appendChild(child)\n }\n }\n }\n\n return el\n}\n\ntype MathElFn = {\n (): MathMLElement\n (props: ElementProps, children?: Children): MathMLElement\n (children: Children): MathMLElement\n}\n\ntype MathVoidElFn = {\n (): MathMLElement\n (props: ElementProps): MathMLElement\n}\n\n/* v8 ignore start — mechanical tag wrappers */\n// Top-level\n// prettier-ignore\nexport const math = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('math', p, c)) as MathElFn\n\n// Token elements\n// prettier-ignore\nexport const mi = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mi', p, c)) as MathElFn\n// prettier-ignore\nexport const mn = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mn', p, c)) as MathElFn\n// prettier-ignore\nexport const mo = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mo', p, c)) as MathElFn\n// prettier-ignore\nexport const ms = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('ms', p, c)) as MathElFn\n// prettier-ignore\nexport const mtext = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mtext', p, c)) as MathElFn\n\n// Layout\n// prettier-ignore\nexport const mrow = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mrow', p, c)) as MathElFn\n// prettier-ignore\nexport const mfrac = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mfrac', p, c)) as MathElFn\n// prettier-ignore\nexport const msqrt = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('msqrt', p, c)) as MathElFn\n// prettier-ignore\nexport const mroot = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mroot', p, c)) as MathElFn\n// prettier-ignore\nexport const msup = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('msup', p, c)) as MathElFn\n// prettier-ignore\nexport const msub = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('msub', p, c)) as MathElFn\n// prettier-ignore\nexport const msubsup = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('msubsup', p, c)) as MathElFn\n// prettier-ignore\nexport const munder = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('munder', p, c)) as MathElFn\n// prettier-ignore\nexport const mover = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mover', p, c)) as MathElFn\n// prettier-ignore\nexport const munderover = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('munderover', p, c)) as MathElFn\n// prettier-ignore\nexport const mmultiscripts = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mmultiscripts', p, c)) as MathElFn\n// prettier-ignore\nexport const mprescripts = ((p?: ElementProps) => createMathmlElement('mprescripts', p)) as MathVoidElFn\n// prettier-ignore\nexport const mnone = ((p?: ElementProps) => createMathmlElement('none', p)) as MathVoidElFn\n\n// Table\n// prettier-ignore\nexport const mtable = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mtable', p, c)) as MathElFn\n// prettier-ignore\nexport const mtr = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mtr', p, c)) as MathElFn\n// prettier-ignore\nexport const mtd = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mtd', p, c)) as MathElFn\n\n// Spacing / visual\n// prettier-ignore\nexport const mspace = ((p?: ElementProps) => createMathmlElement('mspace', p)) as MathVoidElFn\n// prettier-ignore\nexport const mpadded = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mpadded', p, c)) as MathElFn\n// prettier-ignore\nexport const mphantom = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mphantom', p, c)) as MathElFn\n// prettier-ignore\nexport const menclose = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('menclose', p, c)) as MathElFn\n// prettier-ignore\nexport const merror = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('merror', p, c)) as MathElFn\n\n// Interactive\n// prettier-ignore\nexport const maction = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('maction', p, c)) as MathElFn\n\n// Semantics\n// prettier-ignore\nexport const semantics = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('semantics', p, c)) as MathElFn\n// prettier-ignore\nexport const annotation = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('annotation', p, c)) as MathElFn\n// prettier-ignore\nexport const annotationXml = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('annotation-xml', p, c)) as MathElFn\n/* v8 ignore stop */\n"]}
|
|
1
|
+
{"version":3,"file":"mathml-elements.js","sourceRoot":"","sources":["../src/mathml-elements.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,MAAM,SAAS,GAAG,oCAAoC,CAAA;AAMtD,SAAS,mBAAmB,CAC1B,GAAW,EACX,eAAyC,EACzC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CAAC,EAAE,CAAC,CAAC,CAAa,CAAA;AAC9H,kBAAkB;AAClB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,CAA2B,EAAE,CAAY,EAAE,EAAE,CAAC,mBAAmB,CAAC,gBAAgB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAa,CAAA;AACrI,oBAAoB","sourcesContent":["import type { BindingKind } from './types.js'\nimport { getRenderContext } from './render-context.js'\nimport { createBinding, applyBinding } from './binding.js'\nimport { FULL_MASK } from './update-loop.js'\n\nconst MATHML_NS = 'http://www.w3.org/1998/Math/MathML'\n\ntype ElementProps = Record<string, unknown>\ntype Child = Node | string | Node[]\ntype Children = Child[]\n\nfunction createMathmlElement(\n tag: string,\n propsOrChildren?: ElementProps | Children,\n maybeChildren?: Children,\n): MathMLElement {\n const el = document.createElementNS(MATHML_NS, tag) as MathMLElement\n const ctx = getRenderContext()\n\n const props: ElementProps | undefined = Array.isArray(propsOrChildren)\n ? undefined\n : propsOrChildren\n const children: Children | undefined = Array.isArray(propsOrChildren)\n ? propsOrChildren\n : maybeChildren\n\n if (props) {\n for (const [rawKey, value] of Object.entries(props)) {\n if (rawKey === 'key') continue\n\n if (/^on[A-Z]/.test(rawKey)) {\n const eventName = rawKey.slice(2).toLowerCase()\n el.addEventListener(eventName, value as EventListener)\n continue\n }\n\n if (typeof value === 'function') {\n const kind: BindingKind = rawKey === 'class' || rawKey === 'className' ? 'class' : 'attr'\n const key = kind === 'class' ? undefined : rawKey\n const accessor = value as (state: never) => unknown\n const perItem = value.length === 0\n\n const binding = createBinding(ctx.rootLifetime, {\n mask: FULL_MASK,\n accessor,\n kind,\n node: el,\n key,\n perItem,\n })\n\n const initialValue = perItem ? (value as () => unknown)() : accessor(ctx.state as never)\n binding.lastValue = initialValue\n applyBinding({ kind, node: el, key }, initialValue)\n continue\n }\n\n if (rawKey === 'class' || rawKey === 'className') {\n applyBinding({ kind: 'class', node: el, key: undefined }, value)\n } else {\n applyBinding({ kind: 'attr', node: el, key: rawKey }, value)\n }\n }\n }\n\n if (children) {\n for (const child of children) {\n if (typeof child === 'string') {\n el.appendChild(document.createTextNode(child))\n } else if (Array.isArray(child)) {\n for (const node of child) el.appendChild(node)\n } else {\n el.appendChild(child)\n }\n }\n }\n\n return el\n}\n\ntype MathElFn = {\n (): MathMLElement\n (props: ElementProps, children?: Children): MathMLElement\n (children: Children): MathMLElement\n}\n\ntype MathVoidElFn = {\n (): MathMLElement\n (props: ElementProps): MathMLElement\n}\n\n/* v8 ignore start — mechanical tag wrappers */\n// Top-level\n// prettier-ignore\nexport const math = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('math', p, c)) as MathElFn\n\n// Token elements\n// prettier-ignore\nexport const mi = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mi', p, c)) as MathElFn\n// prettier-ignore\nexport const mn = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mn', p, c)) as MathElFn\n// prettier-ignore\nexport const mo = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mo', p, c)) as MathElFn\n// prettier-ignore\nexport const ms = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('ms', p, c)) as MathElFn\n// prettier-ignore\nexport const mtext = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mtext', p, c)) as MathElFn\n\n// Layout\n// prettier-ignore\nexport const mrow = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mrow', p, c)) as MathElFn\n// prettier-ignore\nexport const mfrac = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mfrac', p, c)) as MathElFn\n// prettier-ignore\nexport const msqrt = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('msqrt', p, c)) as MathElFn\n// prettier-ignore\nexport const mroot = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mroot', p, c)) as MathElFn\n// prettier-ignore\nexport const msup = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('msup', p, c)) as MathElFn\n// prettier-ignore\nexport const msub = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('msub', p, c)) as MathElFn\n// prettier-ignore\nexport const msubsup = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('msubsup', p, c)) as MathElFn\n// prettier-ignore\nexport const munder = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('munder', p, c)) as MathElFn\n// prettier-ignore\nexport const mover = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mover', p, c)) as MathElFn\n// prettier-ignore\nexport const munderover = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('munderover', p, c)) as MathElFn\n// prettier-ignore\nexport const mmultiscripts = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mmultiscripts', p, c)) as MathElFn\n// prettier-ignore\nexport const mprescripts = ((p?: ElementProps) => createMathmlElement('mprescripts', p)) as MathVoidElFn\n// prettier-ignore\nexport const mnone = ((p?: ElementProps) => createMathmlElement('none', p)) as MathVoidElFn\n\n// Table\n// prettier-ignore\nexport const mtable = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mtable', p, c)) as MathElFn\n// prettier-ignore\nexport const mtr = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mtr', p, c)) as MathElFn\n// prettier-ignore\nexport const mtd = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mtd', p, c)) as MathElFn\n\n// Spacing / visual\n// prettier-ignore\nexport const mspace = ((p?: ElementProps) => createMathmlElement('mspace', p)) as MathVoidElFn\n// prettier-ignore\nexport const mpadded = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mpadded', p, c)) as MathElFn\n// prettier-ignore\nexport const mphantom = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('mphantom', p, c)) as MathElFn\n// prettier-ignore\nexport const menclose = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('menclose', p, c)) as MathElFn\n// prettier-ignore\nexport const merror = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('merror', p, c)) as MathElFn\n\n// Interactive\n// prettier-ignore\nexport const maction = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('maction', p, c)) as MathElFn\n\n// Semantics\n// prettier-ignore\nexport const semantics = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('semantics', p, c)) as MathElFn\n// prettier-ignore\nexport const annotation = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('annotation', p, c)) as MathElFn\n// prettier-ignore\nexport const annotationXml = ((p?: ElementProps | Children, c?: Children) => createMathmlElement('annotation-xml', p, c)) as MathElFn\n/* v8 ignore stop */\n"]}
|
package/dist/mount.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentDef, AppHandle,
|
|
1
|
+
import type { ComponentDef, AppHandle, Lifetime } from './types.js';
|
|
2
2
|
declare global {
|
|
3
3
|
interface ImportMeta {
|
|
4
4
|
env?: {
|
|
@@ -9,20 +9,21 @@ declare global {
|
|
|
9
9
|
export interface MountOptions {
|
|
10
10
|
devTools?: boolean;
|
|
11
11
|
/**
|
|
12
|
-
* Parent scope for the mounted component's
|
|
13
|
-
* the
|
|
12
|
+
* Parent scope for the mounted component's rootLifetime. When provided,
|
|
13
|
+
* the rootLifetime is created as a child of this scope — context lookups
|
|
14
14
|
* from within the component walk up through the parent's scope tree,
|
|
15
15
|
* and disposing the parent scope cascades into this instance's scope.
|
|
16
16
|
* Used by `@llui/vike`'s persistent-layout machinery to mount a page
|
|
17
17
|
* as a true scope-tree child of its enclosing layout, so layout-
|
|
18
18
|
* provided contexts flow naturally into pages via `useContext`.
|
|
19
19
|
*
|
|
20
|
-
* When omitted (the default), the
|
|
20
|
+
* When omitted (the default), the rootLifetime is detached — same as
|
|
21
21
|
* every `mountApp` call before persistent layouts existed.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
parentLifetime?: Lifetime;
|
|
24
24
|
}
|
|
25
|
-
export declare function mountApp<S, M, E>(container: HTMLElement, def: ComponentDef<S, M, E>, data?:
|
|
25
|
+
export declare function mountApp<S, M, E>(container: HTMLElement, def: ComponentDef<S, M, E>, data?: undefined, options?: MountOptions): AppHandle;
|
|
26
|
+
export declare function mountApp<S, M, E, D>(container: HTMLElement, def: ComponentDef<S, M, E, D>, data: D, options?: MountOptions): AppHandle;
|
|
26
27
|
/**
|
|
27
28
|
* Mount a component relative to a comment anchor rather than inside a
|
|
28
29
|
* container element. Inserts a synthesized end sentinel (`<!-- llui-mount-end -->`)
|
|
@@ -39,7 +40,8 @@ export declare function mountApp<S, M, E>(container: HTMLElement, def: Component
|
|
|
39
40
|
* anchor and that sentinel is swept and the sentinel is reused. Dev mode
|
|
40
41
|
* warns in that case.
|
|
41
42
|
*/
|
|
42
|
-
export declare function mountAtAnchor<S, M, E>(anchor: Comment, def: ComponentDef<S, M, E>, data?:
|
|
43
|
+
export declare function mountAtAnchor<S, M, E>(anchor: Comment, def: ComponentDef<S, M, E>, data?: undefined, options?: MountOptions): AppHandle;
|
|
44
|
+
export declare function mountAtAnchor<S, M, E, D>(anchor: Comment, def: ComponentDef<S, M, E, D>, data: D, options?: MountOptions): AppHandle;
|
|
43
45
|
/**
|
|
44
46
|
* Hydrate a component relative to a comment anchor rather than inside a
|
|
45
47
|
* container element. Analogous to `hydrateApp` — uses `serverState` as
|
|
@@ -54,6 +56,6 @@ export declare function mountAtAnchor<S, M, E>(anchor: Comment, def: ComponentDe
|
|
|
54
56
|
* so inner-layer `hydrateAtAnchor` calls routinely find nothing to
|
|
55
57
|
* reuse, and that's normal.
|
|
56
58
|
*/
|
|
57
|
-
export declare function hydrateAtAnchor<S, M, E>(anchor: Comment, def: ComponentDef<S, M, E>, serverState: S, options?: MountOptions): AppHandle;
|
|
58
|
-
export declare function hydrateApp<S, M, E>(container: HTMLElement, def: ComponentDef<S, M, E>, serverState: S, options?: MountOptions): AppHandle;
|
|
59
|
+
export declare function hydrateAtAnchor<S, M, E, D = void>(anchor: Comment, def: ComponentDef<S, M, E, D>, serverState: S, options?: MountOptions): AppHandle;
|
|
60
|
+
export declare function hydrateApp<S, M, E, D = void>(container: HTMLElement, def: ComponentDef<S, M, E, D>, serverState: S, options?: MountOptions): AppHandle;
|
|
59
61
|
//# sourceMappingURL=mount.d.ts.map
|
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,
|
|
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;AA2CnE,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,UAAU;QAClB,GAAG,CAAC,EAAE;YAAE,GAAG,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KACxB;CACF;AAsBD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAA;CAC1B;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAC9B,SAAS,EAAE,WAAW,EACtB,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC1B,IAAI,CAAC,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CAAA;AACZ,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACjC,SAAS,EAAE,WAAW,EACtB,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7B,IAAI,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CAAA;AAsJZ;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACnC,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC1B,IAAI,CAAC,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CAAA;AACZ,wBAAgB,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACtC,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7B,IAAI,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CAAA;AAqGZ;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,EAC/C,MAAM,EAAE,OAAO,EACf,GAAG,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7B,WAAW,EAAE,CAAC,EACd,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CA+EX;AAYD,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,CAqEX"}
|
package/dist/mount.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponentInstance, flushInstance } from './update-loop.js';
|
|
2
|
-
import {
|
|
2
|
+
import { disposeLifetime } from './lifetime.js';
|
|
3
3
|
import { setRenderContext, clearRenderContext } from './render-context.js';
|
|
4
4
|
import { setFlatBindings } from './binding.js';
|
|
5
5
|
import { registerInstance, unregisterInstance } from './runtime.js';
|
|
@@ -53,15 +53,15 @@ export function _setDevToolsInstall(fn) {
|
|
|
53
53
|
export function mountApp(container, def, data, options) {
|
|
54
54
|
// HMR: if this component is already mounted (module re-execution
|
|
55
55
|
// during hot update), swap the definition instead of creating a new instance.
|
|
56
|
-
// HMR swap bypasses
|
|
56
|
+
// HMR swap bypasses parentLifetime — HMR re-mounts the outermost app handle,
|
|
57
57
|
// which in a layout setup means the layout re-mounts at the root and the
|
|
58
58
|
// rest of the chain is re-established via the normal mount path.
|
|
59
|
-
if (hmrModule && def.name && !options?.
|
|
59
|
+
if (hmrModule && def.name && !options?.parentLifetime) {
|
|
60
60
|
const swapped = hmrModule.replaceComponent(def.name, def);
|
|
61
61
|
if (swapped)
|
|
62
62
|
return swapped;
|
|
63
63
|
}
|
|
64
|
-
const inst = createComponentInstance(def, data, options?.
|
|
64
|
+
const inst = createComponentInstance(def, data, options?.parentLifetime ?? null);
|
|
65
65
|
// Dev-only: auto-install devtools if enabled via '@llui/dom/devtools' import
|
|
66
66
|
if (devToolsInstall)
|
|
67
67
|
devToolsInstall(inst);
|
|
@@ -124,8 +124,8 @@ export function mountApp(container, def, data, options) {
|
|
|
124
124
|
unregisterInstance(inst);
|
|
125
125
|
// Tag the root scope so the disposer log reports app-level
|
|
126
126
|
// teardown distinct from in-tree component-unmount events.
|
|
127
|
-
inst.
|
|
128
|
-
|
|
127
|
+
inst.rootLifetime.disposalCause = 'app-unmount';
|
|
128
|
+
disposeLifetime(inst.rootLifetime);
|
|
129
129
|
container.textContent = '';
|
|
130
130
|
},
|
|
131
131
|
flush() {
|
|
@@ -192,22 +192,6 @@ function findNonSerializable(v, path = 'state', depth = 0, seen = new WeakSet())
|
|
|
192
192
|
}
|
|
193
193
|
return null;
|
|
194
194
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Mount a component relative to a comment anchor rather than inside a
|
|
197
|
-
* container element. Inserts a synthesized end sentinel (`<!-- llui-mount-end -->`)
|
|
198
|
-
* immediately after the anchor and places the component's nodes between
|
|
199
|
-
* the pair. The anchor must already be attached to a live DOM tree.
|
|
200
|
-
*
|
|
201
|
-
* Unlike `mountApp`, the caller's anchor node is preserved across the
|
|
202
|
-
* handle's lifetime — only the content between the pair (and the end
|
|
203
|
-
* sentinel itself) is disposed. Used by `@llui/vike` persistent layouts
|
|
204
|
-
* to mount chain layers without a wrapper element.
|
|
205
|
-
*
|
|
206
|
-
* If a pre-existing `<!-- llui-mount-end -->` is found after the anchor
|
|
207
|
-
* (e.g. stale from an undisposed prior mount), the content between the
|
|
208
|
-
* anchor and that sentinel is swept and the sentinel is reused. Dev mode
|
|
209
|
-
* warns in that case.
|
|
210
|
-
*/
|
|
211
195
|
export function mountAtAnchor(anchor, def, data, options) {
|
|
212
196
|
if (anchor.parentNode === null) {
|
|
213
197
|
throw new Error(`[LLui] mountAtAnchor: anchor comment must be attached to a live DOM tree before mount`);
|
|
@@ -227,7 +211,7 @@ export function mountAtAnchor(anchor, def, data, options) {
|
|
|
227
211
|
endSentinel = document.createComment('llui-mount-end');
|
|
228
212
|
anchor.parentNode.insertBefore(endSentinel, anchor.nextSibling);
|
|
229
213
|
}
|
|
230
|
-
const inst = createComponentInstance(def, data, options?.
|
|
214
|
+
const inst = createComponentInstance(def, data, options?.parentLifetime ?? null);
|
|
231
215
|
if (devToolsInstall)
|
|
232
216
|
devToolsInstall(inst);
|
|
233
217
|
if (import.meta.env?.DEV) {
|
|
@@ -276,8 +260,8 @@ export function mountAtAnchor(anchor, def, data, options) {
|
|
|
276
260
|
hmrModule.unregisterForHmr(def.name, inst);
|
|
277
261
|
inst.abortController.abort();
|
|
278
262
|
unregisterInstance(inst);
|
|
279
|
-
inst.
|
|
280
|
-
|
|
263
|
+
inst.rootLifetime.disposalCause = 'app-unmount';
|
|
264
|
+
disposeLifetime(inst.rootLifetime);
|
|
281
265
|
_removeBetween(anchor, endSentinel);
|
|
282
266
|
endSentinel.parentNode?.removeChild(endSentinel);
|
|
283
267
|
},
|
|
@@ -327,7 +311,7 @@ export function hydrateAtAnchor(anchor, def, serverState, options) {
|
|
|
327
311
|
...def,
|
|
328
312
|
init: () => [serverState, originalEffects],
|
|
329
313
|
};
|
|
330
|
-
const inst = createComponentInstance(hydrateDef, undefined, options?.
|
|
314
|
+
const inst = createComponentInstance(hydrateDef, undefined, options?.parentLifetime ?? null);
|
|
331
315
|
if (devToolsInstall)
|
|
332
316
|
devToolsInstall(inst);
|
|
333
317
|
const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue();
|
|
@@ -367,8 +351,8 @@ export function hydrateAtAnchor(anchor, def, serverState, options) {
|
|
|
367
351
|
hmrModule.unregisterForHmr(def.name, inst);
|
|
368
352
|
inst.abortController.abort();
|
|
369
353
|
unregisterInstance(inst);
|
|
370
|
-
inst.
|
|
371
|
-
|
|
354
|
+
inst.rootLifetime.disposalCause = 'app-unmount';
|
|
355
|
+
disposeLifetime(inst.rootLifetime);
|
|
372
356
|
_removeBetween(anchor, endSentinel);
|
|
373
357
|
endSentinel.parentNode?.removeChild(endSentinel);
|
|
374
358
|
},
|
|
@@ -406,7 +390,7 @@ export function hydrateApp(container, def, serverState, options) {
|
|
|
406
390
|
...def,
|
|
407
391
|
init: () => [serverState, originalEffects],
|
|
408
392
|
};
|
|
409
|
-
const inst = createComponentInstance(hydrateDef, undefined, options?.
|
|
393
|
+
const inst = createComponentInstance(hydrateDef, undefined, options?.parentLifetime ?? null);
|
|
410
394
|
// Build the component DOM and swap atomically with server HTML.
|
|
411
395
|
// Server HTML remains visible until JS finishes — no flash.
|
|
412
396
|
// onMount callbacks are collected in a queue and flushed synchronously
|
|
@@ -441,8 +425,8 @@ export function hydrateApp(container, def, serverState, options) {
|
|
|
441
425
|
unregisterInstance(inst);
|
|
442
426
|
// Tag the root scope so the disposer log reports app-level
|
|
443
427
|
// teardown distinct from in-tree component-unmount events.
|
|
444
|
-
inst.
|
|
445
|
-
|
|
428
|
+
inst.rootLifetime.disposalCause = 'app-unmount';
|
|
429
|
+
disposeLifetime(inst.rootLifetime);
|
|
446
430
|
container.textContent = '';
|
|
447
431
|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AS,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC,CAAA;IAEnC,sEAAsE;IACtE,eAAe,CAAC,YAAY,CAAC,CAAA;IAE7B,kEAAkE;IAClE,qDAAqD;IACrD,sBAAsB,CAAC,IAAI,CAAC,CAAA;IAE5B,gBAAgB,CAAC,IAAI,CAAC,CAAA;IACtB,IAAI,QAAQ,GAAG,KAAK,CAAA;IAEpB,OAAO;QACL,OAAO;YACL,IAAI,QAAQ;gBAAE,OAAM;YACpB,QAAQ,GAAG,IAAI,CAAA;YACf,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAA;YAC5B,kBAAkB,CAAC,IAAI,CAAC,CAAA;YACxB,2DAA2D;YAC3D,2DAA2D;YAC3D,IAAI,CAAC,SAAS,CAAC,aAAa,GAAG,aAAa,CAAA;YAC5C,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAC5B,SAAS,CAAC,WAAW,GAAG,EAAE,CAAA;QAC5B,CAAC;QACD,KAAK;YACH,IAAI,QAAQ;gBAAE,OAAM;YACpB,aAAa,CAAC,IAAI,CAAC,CAAA;QACrB,CAAC;QACD,IAAI,CAAC,GAAY;YACf,IAAI,QAAQ;gBAAE,OACb;YAAC,IAAI,CAAC,IAA6B,CAAC,GAAG,CAAC,CAAA;QAC3C,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import type { ComponentDef, AppHandle, Scope } from './types.js'\nimport { createComponentInstance, flushInstance, type ComponentInstance } from './update-loop.js'\nimport { disposeScope } from './scope.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { registerInstance, unregisterInstance } from './runtime.js'\nimport { createView } from './view-helpers.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './primitives/on-mount.js'\n\n// ── Sentinel-region helpers (used by anchor-based mount primitives) ─────\n\n/**\n * Remove every sibling from `anchor.nextSibling` up to but not including\n * `stopBefore`. Used by anchor-based mount primitives and their HMR\n * swap path to clear the owned DOM region between the pair.\n */\nfunction _removeBetween(anchor: Comment, stopBefore: Comment): void {\n const parent = anchor.parentNode\n if (parent === null) return\n while (anchor.nextSibling !== null && anchor.nextSibling !== stopBefore) {\n parent.removeChild(anchor.nextSibling)\n }\n}\n\n/**\n * Walk forward from `anchor.nextSibling` looking for an existing\n * `<!-- llui-mount-end -->` sentinel. Used by mount/hydrate at anchor\n * to reuse a server-emitted (or stale) sentinel rather than synthesizing\n * a duplicate. Returns null if no matching comment is found before the\n * end of the parent's children.\n */\nfunction _findEndSentinel(anchor: Comment): Comment | null {\n let node: Node | null = anchor.nextSibling\n while (node !== null) {\n if (node.nodeType === 8 && (node as Comment).nodeValue === 'llui-mount-end') {\n return node as Comment\n }\n node = node.nextSibling\n }\n return null\n}\n\n// Vite injects import.meta.env.DEV — declare the shape for TypeScript\ndeclare global {\n interface ImportMeta {\n env?: { DEV?: boolean }\n }\n}\n\n// ── HMR (dev only) ──────────────────────────────────────────────\n// Set by enableHmr() from '@llui/dom/hmr' — never imported in production.\n\nlet hmrModule: typeof import('./hmr') | null = null\n\n/** @internal Called by enableHmr in the hmr module */\nexport function _setHmrModule(m: typeof import('./hmr')): void {\n hmrModule = m\n}\n\n// ── DevTools auto-install (dev only) ────────────────────────────\n// Set by enableDevTools() from '@llui/dom/devtools' — never imported in production.\n\nlet devToolsInstall: ((inst: object) => void) | null = null\n\n/** @internal Called by enableDevTools in the devtools module */\nexport function _setDevToolsInstall(fn: ((inst: object) => void) | null): void {\n devToolsInstall = fn\n}\n\nexport interface MountOptions {\n devTools?: boolean\n /**\n * Parent scope for the mounted component's rootScope. When provided,\n * the rootScope is created as a child of this scope — context lookups\n * from within the component walk up through the parent's scope tree,\n * and disposing the parent scope cascades into this instance's scope.\n * Used by `@llui/vike`'s persistent-layout machinery to mount a page\n * as a true scope-tree child of its enclosing layout, so layout-\n * provided contexts flow naturally into pages via `useContext`.\n *\n * When omitted (the default), the rootScope is detached — same as\n * every `mountApp` call before persistent layouts existed.\n */\n parentScope?: Scope\n}\n\nexport function mountApp<S, M, E>(\n container: HTMLElement,\n def: ComponentDef<S, M, E>,\n data?: unknown,\n options?: MountOptions,\n): AppHandle {\n // HMR: if this component is already mounted (module re-execution\n // during hot update), swap the definition instead of creating a new instance.\n // HMR swap bypasses parentScope — HMR re-mounts the outermost app handle,\n // which in a layout setup means the layout re-mounts at the root and the\n // rest of the chain is re-established via the normal mount path.\n if (hmrModule && def.name && !options?.parentScope) {\n const swapped = hmrModule.replaceComponent(def.name, def)\n if (swapped) return swapped\n }\n\n const inst = createComponentInstance(def, data, options?.parentScope ?? null)\n\n // Dev-only: auto-install devtools if enabled via '@llui/dom/devtools' import\n if (devToolsInstall) devToolsInstall(inst)\n\n // Dev-only: warn if initial state contains non-serializable values.\n // Silent bug-bomb: Date/Map/Set/class instances break SSR, hydration, replay tools.\n if (import.meta.env?.DEV) {\n const offender = findNonSerializable(inst.state)\n if (offender) {\n console.warn(\n `[LLui] <${def.name}> initial state contains a non-serializable value at \"${offender.path}\":`,\n offender.value,\n '\\nState must be plain JSON (no Date/Map/Set/class instances/functions).' +\n '\\nThis will break SSR hydration, state replay, and devtools snapshots.' +\n '\\nhint: Convert to a serializable representation (e.g., Date → ISO string, Map → Record).',\n )\n }\n }\n\n // Run view() within a render context so primitives can register bindings.\n // Also collect onMount callbacks in a queue we'll flush synchronously\n // after node insertion — prevents the race where a user event fires\n // between mount and the queueMicrotask callback running.\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = def.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Batch-insert via DocumentFragment — one layout-invalidating operation\n // instead of N individual appendChild calls on a live container element.\n if (nodes.length > 1) {\n const frag = document.createDocumentFragment()\n for (const node of nodes) frag.appendChild(node)\n container.appendChild(frag)\n } else if (nodes.length === 1) {\n container.appendChild(nodes[0]!)\n }\n\n // Flush onMount callbacks SYNCHRONOUSLY now that the DOM is in place.\n // Any listeners they attach are ready before this function returns,\n // so a synchronous dispatchEvent in the caller's next line fires\n // against a fully-wired tree.\n flushMountQueue(onMountQueue)\n\n registerInstance(inst)\n if (hmrModule && def.name) {\n hmrModule.registerForHmr(def.name, inst, container)\n }\n dispatchInitialEffects(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n if (hmrModule && def.name) hmrModule.unregisterForHmr(def.name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n // Tag the root scope so the disposer log reports app-level\n // teardown distinct from in-tree component-unmount events.\n inst.rootScope.disposalCause = 'app-unmount'\n disposeScope(inst.rootScope)\n container.textContent = ''\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n\n// Walks an object graph looking for non-JSON-serializable values. Returns the\n// first offender found (depth-first), or null if everything is fine. Stops at\n// depth 6 to bound runtime cost for large states.\nfunction findNonSerializable(\n v: unknown,\n path = 'state',\n depth = 0,\n seen = new WeakSet<object>(),\n): { path: string; value: unknown } | null {\n if (depth > 6) return null\n if (v === null || v === undefined) return null\n const t = typeof v\n if (t === 'string' || t === 'number' || t === 'boolean') return null\n if (t === 'function') return { path, value: v }\n if (t === 'symbol' || t === 'bigint') return { path, value: v }\n if (t !== 'object') return null\n const obj = v as object\n if (seen.has(obj)) return null\n seen.add(obj)\n if (obj instanceof Date) return { path: `${path} (Date)`, value: v }\n if (obj instanceof Map) return { path: `${path} (Map)`, value: v }\n if (obj instanceof Set) return { path: `${path} (Set)`, value: v }\n if (obj instanceof RegExp) return { path: `${path} (RegExp)`, value: v }\n if (obj instanceof Promise) return { path: `${path} (Promise)`, value: v }\n // Plain objects/arrays have Object.prototype / Array.prototype. Class instances\n // have a different prototype.\n const proto = Object.getPrototypeOf(obj)\n if (proto !== null && proto !== Object.prototype && proto !== Array.prototype) {\n return { path: `${path} (${proto?.constructor?.name ?? 'class instance'})`, value: v }\n }\n if (Array.isArray(v)) {\n for (let i = 0; i < v.length; i++) {\n const r = findNonSerializable(v[i], `${path}[${i}]`, depth + 1, seen)\n if (r) return r\n }\n return null\n }\n for (const k of Object.keys(obj)) {\n const r = findNonSerializable(\n (obj as Record<string, unknown>)[k],\n `${path}.${k}`,\n depth + 1,\n seen,\n )\n if (r) return r\n }\n return null\n}\n\n/**\n * Mount a component relative to a comment anchor rather than inside a\n * container element. Inserts a synthesized end sentinel (`<!-- llui-mount-end -->`)\n * immediately after the anchor and places the component's nodes between\n * the pair. The anchor must already be attached to a live DOM tree.\n *\n * Unlike `mountApp`, the caller's anchor node is preserved across the\n * handle's lifetime — only the content between the pair (and the end\n * sentinel itself) is disposed. Used by `@llui/vike` persistent layouts\n * to mount chain layers without a wrapper element.\n *\n * If a pre-existing `<!-- llui-mount-end -->` is found after the anchor\n * (e.g. stale from an undisposed prior mount), the content between the\n * anchor and that sentinel is swept and the sentinel is reused. Dev mode\n * warns in that case.\n */\nexport function mountAtAnchor<S, M, E>(\n anchor: Comment,\n def: ComponentDef<S, M, E>,\n data?: unknown,\n options?: MountOptions,\n): AppHandle {\n if (anchor.parentNode === null) {\n throw new Error(\n `[LLui] mountAtAnchor: anchor comment must be attached to a live DOM tree before mount`,\n )\n }\n\n // Locate or synthesize the end sentinel.\n const existingEnd = _findEndSentinel(anchor)\n let endSentinel: Comment\n if (existingEnd !== null) {\n if (import.meta.env?.DEV) {\n console.warn(\n `[LLui] mountAtAnchor: anchor has a pre-existing end sentinel. ` +\n `A prior mount was not disposed — sweeping stale siblings and reusing the sentinel.`,\n )\n }\n _removeBetween(anchor, existingEnd)\n endSentinel = existingEnd\n } else {\n endSentinel = document.createComment('llui-mount-end')\n anchor.parentNode.insertBefore(endSentinel, anchor.nextSibling)\n }\n\n const inst = createComponentInstance(def, data, options?.parentScope ?? null)\n\n if (devToolsInstall) devToolsInstall(inst)\n\n if (import.meta.env?.DEV) {\n const offender = findNonSerializable(inst.state)\n if (offender) {\n console.warn(\n `[LLui] <${def.name}> initial state contains a non-serializable value at \"${offender.path}\":`,\n offender.value,\n '\\nState must be plain JSON (no Date/Map/Set/class instances/functions).' +\n '\\nThis will break SSR hydration, state replay, and devtools snapshots.' +\n '\\nhint: Convert to a serializable representation (e.g., Date → ISO string, Map → Record).',\n )\n }\n }\n\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container: anchor.parentElement ?? undefined,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = def.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Batch-insert via DocumentFragment — one layout pass instead of N.\n if (nodes.length > 1) {\n const frag = document.createDocumentFragment()\n for (const node of nodes) frag.appendChild(node)\n anchor.parentNode.insertBefore(frag, endSentinel)\n } else if (nodes.length === 1) {\n anchor.parentNode.insertBefore(nodes[0]!, endSentinel)\n }\n\n flushMountQueue(onMountQueue)\n\n registerInstance(inst)\n if (hmrModule && def.name) {\n hmrModule.registerForAnchor(def.name, inst, anchor, endSentinel)\n }\n dispatchInitialEffects(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n if (hmrModule && def.name) hmrModule.unregisterForHmr(def.name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n inst.rootScope.disposalCause = 'app-unmount'\n disposeScope(inst.rootScope)\n _removeBetween(anchor, endSentinel)\n endSentinel.parentNode?.removeChild(endSentinel)\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n\n/**\n * Hydrate a component relative to a comment anchor rather than inside a\n * container element. Analogous to `hydrateApp` — uses `serverState` as\n * the initial state (not `init()`'s output) while preserving `init()`'s\n * effects for post-mount dispatch.\n *\n * The DOM-handling path is identical to `mountAtAnchor`: reuses a\n * pre-existing end sentinel when present, synthesizes one otherwise.\n * Atomic-swaps the owned region whether or not server content is there\n * to replace. No error for a missing end sentinel — the vike chain's\n * outer `hydrateApp`'s `replaceChildren` wipes inner layers' sentinels,\n * so inner-layer `hydrateAtAnchor` calls routinely find nothing to\n * reuse, and that's normal.\n */\nexport function hydrateAtAnchor<S, M, E>(\n anchor: Comment,\n def: ComponentDef<S, M, E>,\n serverState: S,\n options?: MountOptions,\n): AppHandle {\n if (anchor.parentNode === null) {\n throw new Error(\n `[LLui] hydrateAtAnchor: anchor comment must be attached to a live DOM tree before hydrate`,\n )\n }\n\n const existingEnd = _findEndSentinel(anchor)\n let endSentinel: Comment\n if (existingEnd !== null) {\n _removeBetween(anchor, existingEnd)\n endSentinel = existingEnd\n } else {\n endSentinel = document.createComment('llui-mount-end')\n anchor.parentNode.insertBefore(endSentinel, anchor.nextSibling)\n }\n\n // Run original init() to capture effects, then override state with server's.\n const [, originalEffects] = (def.init as (data: unknown) => [S, E[]])(undefined)\n const hydrateDef: ComponentDef<S, M, E> = {\n ...def,\n init: () => [serverState, originalEffects],\n }\n\n const inst = createComponentInstance(hydrateDef, undefined, options?.parentScope ?? null)\n\n if (devToolsInstall) devToolsInstall(inst)\n\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container: anchor.parentElement ?? undefined,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = hydrateDef.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n if (nodes.length > 1) {\n const frag = document.createDocumentFragment()\n for (const node of nodes) frag.appendChild(node)\n anchor.parentNode.insertBefore(frag, endSentinel)\n } else if (nodes.length === 1) {\n anchor.parentNode.insertBefore(nodes[0]!, endSentinel)\n }\n\n flushMountQueue(onMountQueue)\n\n registerInstance(inst)\n if (hmrModule && def.name) {\n hmrModule.registerForAnchor(def.name, inst, anchor, endSentinel)\n }\n dispatchInitialEffects(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n if (hmrModule && def.name) hmrModule.unregisterForHmr(def.name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n inst.rootScope.disposalCause = 'app-unmount'\n disposeScope(inst.rootScope)\n _removeBetween(anchor, endSentinel)\n endSentinel.parentNode?.removeChild(endSentinel)\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n\nfunction dispatchInitialEffects<S, M, E>(\n inst: ReturnType<typeof createComponentInstance<S, M, E>>,\n): void {\n if (inst.initialEffects.length === 0 || !inst.def.onEffect) return\n for (const effect of inst.initialEffects) {\n inst.def.onEffect({ effect, send: inst.send, signal: inst.signal })\n }\n inst.initialEffects = []\n}\n\nexport function hydrateApp<S, M, E>(\n container: HTMLElement,\n def: ComponentDef<S, M, E>,\n serverState: S,\n options?: MountOptions,\n): AppHandle {\n // Run the original init once to capture its effects. The state it\n // returns is discarded — we use `serverState` (what the server\n // rendered with) instead. The effects are preserved and dispatched\n // after the DOM is in place, so components that rely on \"load data\n // or wire subscriptions on mount\" behave consistently between fresh\n // mount and SSR+hydrate. If the original init has already-loaded\n // data for the hydration case, gate the effect emission inside init\n // itself (e.g. based on a `loaded` flag in state).\n const [, originalEffects] = (def.init as (data: unknown) => [S, E[]])(undefined)\n\n const hydrateDef: ComponentDef<S, M, E> = {\n ...def,\n init: () => [serverState, originalEffects],\n }\n\n const inst = createComponentInstance(hydrateDef, undefined, options?.parentScope ?? null)\n\n // Build the component DOM and swap atomically with server HTML.\n // Server HTML remains visible until JS finishes — no flash.\n // onMount callbacks are collected in a queue and flushed synchronously\n // after the swap, matching mountApp's ordering.\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = hydrateDef.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Atomic swap — replaces server HTML with client DOM in one operation\n container.replaceChildren(...nodes)\n\n // Flush onMount callbacks synchronously now that the DOM is in place.\n flushMountQueue(onMountQueue)\n\n // Fire the original init's effects post-swap, matching mountApp's\n // lifecycle. Previously these were silently dropped.\n dispatchInitialEffects(inst)\n\n registerInstance(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n inst.abortController.abort()\n unregisterInstance(inst)\n // Tag the root scope so the disposer log reports app-level\n // teardown distinct from in-tree component-unmount events.\n inst.rootScope.disposalCause = 'app-unmount'\n disposeScope(inst.rootScope)\n container.textContent = ''\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAA0B,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAEzF,2EAA2E;AAE3E;;;;GAIG;AACH,SAAS,cAAc,CAAC,MAAe,EAA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ACpB,aAAa,CAAC,IAAI,CAAC,CAAA;QACrB,CAAC;QACD,IAAI,CAAC,GAAY;YACf,IAAI,QAAQ;gBAAE,OACb;YAAC,IAAI,CAAC,IAA6B,CAAC,GAAG,CAAC,CAAA;QAC3C,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import type { ComponentDef, AppHandle, Lifetime } from './types.js'\nimport { createComponentInstance, flushInstance, type ComponentInstance } from './update-loop.js'\nimport { disposeLifetime } from './lifetime.js'\nimport { setRenderContext, clearRenderContext } from './render-context.js'\nimport { setFlatBindings } from './binding.js'\nimport { registerInstance, unregisterInstance } from './runtime.js'\nimport { createView } from './view-helpers.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './primitives/on-mount.js'\n\n// ── Sentinel-region helpers (used by anchor-based mount primitives) ─────\n\n/**\n * Remove every sibling from `anchor.nextSibling` up to but not including\n * `stopBefore`. Used by anchor-based mount primitives and their HMR\n * swap path to clear the owned DOM region between the pair.\n */\nfunction _removeBetween(anchor: Comment, stopBefore: Comment): void {\n const parent = anchor.parentNode\n if (parent === null) return\n while (anchor.nextSibling !== null && anchor.nextSibling !== stopBefore) {\n parent.removeChild(anchor.nextSibling)\n }\n}\n\n/**\n * Walk forward from `anchor.nextSibling` looking for an existing\n * `<!-- llui-mount-end -->` sentinel. Used by mount/hydrate at anchor\n * to reuse a server-emitted (or stale) sentinel rather than synthesizing\n * a duplicate. Returns null if no matching comment is found before the\n * end of the parent's children.\n */\nfunction _findEndSentinel(anchor: Comment): Comment | null {\n let node: Node | null = anchor.nextSibling\n while (node !== null) {\n if (node.nodeType === 8 && (node as Comment).nodeValue === 'llui-mount-end') {\n return node as Comment\n }\n node = node.nextSibling\n }\n return null\n}\n\n// Vite injects import.meta.env.DEV — declare the shape for TypeScript\ndeclare global {\n interface ImportMeta {\n env?: { DEV?: boolean }\n }\n}\n\n// ── HMR (dev only) ──────────────────────────────────────────────\n// Set by enableHmr() from '@llui/dom/hmr' — never imported in production.\n\nlet hmrModule: typeof import('./hmr') | null = null\n\n/** @internal Called by enableHmr in the hmr module */\nexport function _setHmrModule(m: typeof import('./hmr')): void {\n hmrModule = m\n}\n\n// ── DevTools auto-install (dev only) ────────────────────────────\n// Set by enableDevTools() from '@llui/dom/devtools' — never imported in production.\n\nlet devToolsInstall: ((inst: object) => void) | null = null\n\n/** @internal Called by enableDevTools in the devtools module */\nexport function _setDevToolsInstall(fn: ((inst: object) => void) | null): void {\n devToolsInstall = fn\n}\n\nexport interface MountOptions {\n devTools?: boolean\n /**\n * Parent scope for the mounted component's rootLifetime. When provided,\n * the rootLifetime is created as a child of this scope — context lookups\n * from within the component walk up through the parent's scope tree,\n * and disposing the parent scope cascades into this instance's scope.\n * Used by `@llui/vike`'s persistent-layout machinery to mount a page\n * as a true scope-tree child of its enclosing layout, so layout-\n * provided contexts flow naturally into pages via `useContext`.\n *\n * When omitted (the default), the rootLifetime is detached — same as\n * every `mountApp` call before persistent layouts existed.\n */\n parentLifetime?: Lifetime\n}\n\nexport function mountApp<S, M, E>(\n container: HTMLElement,\n def: ComponentDef<S, M, E>,\n data?: undefined,\n options?: MountOptions,\n): AppHandle\nexport function mountApp<S, M, E, D>(\n container: HTMLElement,\n def: ComponentDef<S, M, E, D>,\n data: D,\n options?: MountOptions,\n): AppHandle\nexport function mountApp<S, M, E, D>(\n container: HTMLElement,\n def: ComponentDef<S, M, E, D>,\n data?: D,\n options?: MountOptions,\n): AppHandle {\n // HMR: if this component is already mounted (module re-execution\n // during hot update), swap the definition instead of creating a new instance.\n // HMR swap bypasses parentLifetime — HMR re-mounts the outermost app handle,\n // which in a layout setup means the layout re-mounts at the root and the\n // rest of the chain is re-established via the normal mount path.\n if (hmrModule && def.name && !options?.parentLifetime) {\n const swapped = hmrModule.replaceComponent(def.name, def)\n if (swapped) return swapped\n }\n\n const inst = createComponentInstance(def, data, options?.parentLifetime ?? null)\n\n // Dev-only: auto-install devtools if enabled via '@llui/dom/devtools' import\n if (devToolsInstall) devToolsInstall(inst)\n\n // Dev-only: warn if initial state contains non-serializable values.\n // Silent bug-bomb: Date/Map/Set/class instances break SSR, hydration, replay tools.\n if (import.meta.env?.DEV) {\n const offender = findNonSerializable(inst.state)\n if (offender) {\n console.warn(\n `[LLui] <${def.name}> initial state contains a non-serializable value at \"${offender.path}\":`,\n offender.value,\n '\\nState must be plain JSON (no Date/Map/Set/class instances/functions).' +\n '\\nThis will break SSR hydration, state replay, and devtools snapshots.' +\n '\\nhint: Convert to a serializable representation (e.g., Date → ISO string, Map → Record).',\n )\n }\n }\n\n // Run view() within a render context so primitives can register bindings.\n // Also collect onMount callbacks in a queue we'll flush synchronously\n // after node insertion — prevents the race where a user event fires\n // between mount and the queueMicrotask callback running.\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = def.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Batch-insert via DocumentFragment — one layout-invalidating operation\n // instead of N individual appendChild calls on a live container element.\n if (nodes.length > 1) {\n const frag = document.createDocumentFragment()\n for (const node of nodes) frag.appendChild(node)\n container.appendChild(frag)\n } else if (nodes.length === 1) {\n container.appendChild(nodes[0]!)\n }\n\n // Flush onMount callbacks SYNCHRONOUSLY now that the DOM is in place.\n // Any listeners they attach are ready before this function returns,\n // so a synchronous dispatchEvent in the caller's next line fires\n // against a fully-wired tree.\n flushMountQueue(onMountQueue)\n\n registerInstance(inst)\n if (hmrModule && def.name) {\n hmrModule.registerForHmr(def.name, inst, container)\n }\n dispatchInitialEffects(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n if (hmrModule && def.name) hmrModule.unregisterForHmr(def.name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n // Tag the root scope so the disposer log reports app-level\n // teardown distinct from in-tree component-unmount events.\n inst.rootLifetime.disposalCause = 'app-unmount'\n disposeLifetime(inst.rootLifetime)\n container.textContent = ''\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n\n// Walks an object graph looking for non-JSON-serializable values. Returns the\n// first offender found (depth-first), or null if everything is fine. Stops at\n// depth 6 to bound runtime cost for large states.\nfunction findNonSerializable(\n v: unknown,\n path = 'state',\n depth = 0,\n seen = new WeakSet<object>(),\n): { path: string; value: unknown } | null {\n if (depth > 6) return null\n if (v === null || v === undefined) return null\n const t = typeof v\n if (t === 'string' || t === 'number' || t === 'boolean') return null\n if (t === 'function') return { path, value: v }\n if (t === 'symbol' || t === 'bigint') return { path, value: v }\n if (t !== 'object') return null\n const obj = v as object\n if (seen.has(obj)) return null\n seen.add(obj)\n if (obj instanceof Date) return { path: `${path} (Date)`, value: v }\n if (obj instanceof Map) return { path: `${path} (Map)`, value: v }\n if (obj instanceof Set) return { path: `${path} (Set)`, value: v }\n if (obj instanceof RegExp) return { path: `${path} (RegExp)`, value: v }\n if (obj instanceof Promise) return { path: `${path} (Promise)`, value: v }\n // Plain objects/arrays have Object.prototype / Array.prototype. Class instances\n // have a different prototype.\n const proto = Object.getPrototypeOf(obj)\n if (proto !== null && proto !== Object.prototype && proto !== Array.prototype) {\n return { path: `${path} (${proto?.constructor?.name ?? 'class instance'})`, value: v }\n }\n if (Array.isArray(v)) {\n for (let i = 0; i < v.length; i++) {\n const r = findNonSerializable(v[i], `${path}[${i}]`, depth + 1, seen)\n if (r) return r\n }\n return null\n }\n for (const k of Object.keys(obj)) {\n const r = findNonSerializable(\n (obj as Record<string, unknown>)[k],\n `${path}.${k}`,\n depth + 1,\n seen,\n )\n if (r) return r\n }\n return null\n}\n\n/**\n * Mount a component relative to a comment anchor rather than inside a\n * container element. Inserts a synthesized end sentinel (`<!-- llui-mount-end -->`)\n * immediately after the anchor and places the component's nodes between\n * the pair. The anchor must already be attached to a live DOM tree.\n *\n * Unlike `mountApp`, the caller's anchor node is preserved across the\n * handle's lifetime — only the content between the pair (and the end\n * sentinel itself) is disposed. Used by `@llui/vike` persistent layouts\n * to mount chain layers without a wrapper element.\n *\n * If a pre-existing `<!-- llui-mount-end -->` is found after the anchor\n * (e.g. stale from an undisposed prior mount), the content between the\n * anchor and that sentinel is swept and the sentinel is reused. Dev mode\n * warns in that case.\n */\nexport function mountAtAnchor<S, M, E>(\n anchor: Comment,\n def: ComponentDef<S, M, E>,\n data?: undefined,\n options?: MountOptions,\n): AppHandle\nexport function mountAtAnchor<S, M, E, D>(\n anchor: Comment,\n def: ComponentDef<S, M, E, D>,\n data: D,\n options?: MountOptions,\n): AppHandle\nexport function mountAtAnchor<S, M, E, D>(\n anchor: Comment,\n def: ComponentDef<S, M, E, D>,\n data?: D,\n options?: MountOptions,\n): AppHandle {\n if (anchor.parentNode === null) {\n throw new Error(\n `[LLui] mountAtAnchor: anchor comment must be attached to a live DOM tree before mount`,\n )\n }\n\n // Locate or synthesize the end sentinel.\n const existingEnd = _findEndSentinel(anchor)\n let endSentinel: Comment\n if (existingEnd !== null) {\n if (import.meta.env?.DEV) {\n console.warn(\n `[LLui] mountAtAnchor: anchor has a pre-existing end sentinel. ` +\n `A prior mount was not disposed — sweeping stale siblings and reusing the sentinel.`,\n )\n }\n _removeBetween(anchor, existingEnd)\n endSentinel = existingEnd\n } else {\n endSentinel = document.createComment('llui-mount-end')\n anchor.parentNode.insertBefore(endSentinel, anchor.nextSibling)\n }\n\n const inst = createComponentInstance(def, data, options?.parentLifetime ?? null)\n\n if (devToolsInstall) devToolsInstall(inst)\n\n if (import.meta.env?.DEV) {\n const offender = findNonSerializable(inst.state)\n if (offender) {\n console.warn(\n `[LLui] <${def.name}> initial state contains a non-serializable value at \"${offender.path}\":`,\n offender.value,\n '\\nState must be plain JSON (no Date/Map/Set/class instances/functions).' +\n '\\nThis will break SSR hydration, state replay, and devtools snapshots.' +\n '\\nhint: Convert to a serializable representation (e.g., Date → ISO string, Map → Record).',\n )\n }\n }\n\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container: anchor.parentElement ?? undefined,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = def.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Batch-insert via DocumentFragment — one layout pass instead of N.\n if (nodes.length > 1) {\n const frag = document.createDocumentFragment()\n for (const node of nodes) frag.appendChild(node)\n anchor.parentNode.insertBefore(frag, endSentinel)\n } else if (nodes.length === 1) {\n anchor.parentNode.insertBefore(nodes[0]!, endSentinel)\n }\n\n flushMountQueue(onMountQueue)\n\n registerInstance(inst)\n if (hmrModule && def.name) {\n hmrModule.registerForAnchor(def.name, inst, anchor, endSentinel)\n }\n dispatchInitialEffects(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n if (hmrModule && def.name) hmrModule.unregisterForHmr(def.name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n inst.rootLifetime.disposalCause = 'app-unmount'\n disposeLifetime(inst.rootLifetime)\n _removeBetween(anchor, endSentinel)\n endSentinel.parentNode?.removeChild(endSentinel)\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n\n/**\n * Hydrate a component relative to a comment anchor rather than inside a\n * container element. Analogous to `hydrateApp` — uses `serverState` as\n * the initial state (not `init()`'s output) while preserving `init()`'s\n * effects for post-mount dispatch.\n *\n * The DOM-handling path is identical to `mountAtAnchor`: reuses a\n * pre-existing end sentinel when present, synthesizes one otherwise.\n * Atomic-swaps the owned region whether or not server content is there\n * to replace. No error for a missing end sentinel — the vike chain's\n * outer `hydrateApp`'s `replaceChildren` wipes inner layers' sentinels,\n * so inner-layer `hydrateAtAnchor` calls routinely find nothing to\n * reuse, and that's normal.\n */\nexport function hydrateAtAnchor<S, M, E, D = void>(\n anchor: Comment,\n def: ComponentDef<S, M, E, D>,\n serverState: S,\n options?: MountOptions,\n): AppHandle {\n if (anchor.parentNode === null) {\n throw new Error(\n `[LLui] hydrateAtAnchor: anchor comment must be attached to a live DOM tree before hydrate`,\n )\n }\n\n const existingEnd = _findEndSentinel(anchor)\n let endSentinel: Comment\n if (existingEnd !== null) {\n _removeBetween(anchor, existingEnd)\n endSentinel = existingEnd\n } else {\n endSentinel = document.createComment('llui-mount-end')\n anchor.parentNode.insertBefore(endSentinel, anchor.nextSibling)\n }\n\n // Run original init() to capture effects, then override state with server's.\n const [, originalEffects] = (def.init as (data: unknown) => [S, E[]])(undefined)\n const hydrateDef: ComponentDef<S, M, E> = {\n ...def,\n init: () => [serverState, originalEffects],\n }\n\n const inst = createComponentInstance(hydrateDef, undefined, options?.parentLifetime ?? null)\n\n if (devToolsInstall) devToolsInstall(inst)\n\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container: anchor.parentElement ?? undefined,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = hydrateDef.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n if (nodes.length > 1) {\n const frag = document.createDocumentFragment()\n for (const node of nodes) frag.appendChild(node)\n anchor.parentNode.insertBefore(frag, endSentinel)\n } else if (nodes.length === 1) {\n anchor.parentNode.insertBefore(nodes[0]!, endSentinel)\n }\n\n flushMountQueue(onMountQueue)\n\n registerInstance(inst)\n if (hmrModule && def.name) {\n hmrModule.registerForAnchor(def.name, inst, anchor, endSentinel)\n }\n dispatchInitialEffects(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n if (hmrModule && def.name) hmrModule.unregisterForHmr(def.name, inst)\n inst.abortController.abort()\n unregisterInstance(inst)\n inst.rootLifetime.disposalCause = 'app-unmount'\n disposeLifetime(inst.rootLifetime)\n _removeBetween(anchor, endSentinel)\n endSentinel.parentNode?.removeChild(endSentinel)\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n\nfunction dispatchInitialEffects<S, M, E>(\n inst: ReturnType<typeof createComponentInstance<S, M, E>>,\n): void {\n if (inst.initialEffects.length === 0 || !inst.def.onEffect) return\n for (const effect of inst.initialEffects) {\n inst.def.onEffect({ effect, send: inst.send, signal: inst.signal })\n }\n inst.initialEffects = []\n}\n\nexport function hydrateApp<S, M, E, D = void>(\n container: HTMLElement,\n def: ComponentDef<S, M, E, D>,\n serverState: S,\n options?: MountOptions,\n): AppHandle {\n // Run the original init once to capture its effects. The state it\n // returns is discarded — we use `serverState` (what the server\n // rendered with) instead. The effects are preserved and dispatched\n // after the DOM is in place, so components that rely on \"load data\n // or wire subscriptions on mount\" behave consistently between fresh\n // mount and SSR+hydrate. If the original init has already-loaded\n // data for the hydration case, gate the effect emission inside init\n // itself (e.g. based on a `loaded` flag in state).\n const [, originalEffects] = (def.init as (data: unknown) => [S, E[]])(undefined)\n\n const hydrateDef: ComponentDef<S, M, E> = {\n ...def,\n init: () => [serverState, originalEffects],\n }\n\n const inst = createComponentInstance(hydrateDef, undefined, options?.parentLifetime ?? null)\n\n // Build the component DOM and swap atomically with server HTML.\n // Server HTML remains visible until JS finishes — no flash.\n // onMount callbacks are collected in a queue and flushed synchronously\n // after the swap, matching mountApp's ordering.\n const { queue: onMountQueue, prev: prevMountQueue } = pushMountQueue()\n setFlatBindings(inst.allBindings)\n setRenderContext({\n ...inst,\n container,\n send: inst.send as (msg: unknown) => void,\n instance: inst as ComponentInstance,\n })\n const nodes = hydrateDef.view(createView<S, M>(inst.send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(prevMountQueue)\n\n // Atomic swap — replaces server HTML with client DOM in one operation\n container.replaceChildren(...nodes)\n\n // Flush onMount callbacks synchronously now that the DOM is in place.\n flushMountQueue(onMountQueue)\n\n // Fire the original init's effects post-swap, matching mountApp's\n // lifecycle. Previously these were silently dropped.\n dispatchInitialEffects(inst)\n\n registerInstance(inst)\n let disposed = false\n\n return {\n dispose() {\n if (disposed) return\n disposed = true\n inst.abortController.abort()\n unregisterInstance(inst)\n // Tag the root scope so the disposer log reports app-level\n // teardown distinct from in-tree component-unmount events.\n inst.rootLifetime.disposalCause = 'app-unmount'\n disposeLifetime(inst.rootLifetime)\n container.textContent = ''\n },\n flush() {\n if (disposed) return\n flushInstance(inst)\n },\n send(msg: unknown) {\n if (disposed) return\n ;(inst.send as (m: unknown) => void)(msg)\n },\n }\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { BranchOptions } from '../types.js';
|
|
2
|
-
export declare function branch<S, M = unknown>(opts: BranchOptions<S, M>): Node[];
|
|
2
|
+
export declare function branch<S, M = unknown, K extends string = string>(opts: BranchOptions<S, M, K>): Node[];
|
|
3
3
|
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAY,MAAM,aAAa,CAAA;AAS1D,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,CA0IR"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { getRenderContext, setRenderContext, clearRenderContext } from '../render-context.js';
|
|
2
|
-
import {
|
|
2
|
+
import { createLifetime, disposeLifetime, addDisposer } from '../lifetime.js';
|
|
3
3
|
import { setFlatBindings } from '../binding.js';
|
|
4
4
|
import { createView } from '../view-helpers.js';
|
|
5
5
|
import { FULL_MASK } from '../update-loop.js';
|
|
6
6
|
import { pushMountQueue, popMountQueue, flushMountQueue } from './on-mount.js';
|
|
7
7
|
export function branch(opts) {
|
|
8
8
|
const ctx = getRenderContext('branch');
|
|
9
|
-
const
|
|
9
|
+
const parentLifetime = ctx.rootLifetime;
|
|
10
10
|
const blocks = ctx.structuralBlocks;
|
|
11
11
|
const send = ctx.send;
|
|
12
12
|
const anchor = document.createComment('branch');
|
|
13
13
|
let currentKey = opts.on(ctx.state);
|
|
14
|
-
let
|
|
14
|
+
let currentLifetime = null;
|
|
15
15
|
let currentNodes = [];
|
|
16
16
|
const block = {
|
|
17
17
|
mask: opts.__mask ?? FULL_MASK,
|
|
@@ -23,13 +23,13 @@ export function branch(opts) {
|
|
|
23
23
|
if (!parent)
|
|
24
24
|
return;
|
|
25
25
|
const leavingNodes = currentNodes;
|
|
26
|
-
const
|
|
26
|
+
const leavingLifetime = currentLifetime;
|
|
27
27
|
// Build new arm first (before removing old — for FLIP animations)
|
|
28
28
|
currentNodes = [];
|
|
29
|
-
|
|
29
|
+
currentLifetime = null;
|
|
30
30
|
currentKey = newKey;
|
|
31
31
|
const newCaseKey = String(newKey);
|
|
32
|
-
const newBuilder = opts.cases[newCaseKey];
|
|
32
|
+
const newBuilder = opts.cases?.[newCaseKey] ?? opts.default;
|
|
33
33
|
// Collect onMount callbacks from the new case into a local queue,
|
|
34
34
|
// then flush them SYNCHRONOUSLY after the new nodes are inserted.
|
|
35
35
|
// Without this, onMount inside a branch case would see stale DOM
|
|
@@ -39,10 +39,15 @@ export function branch(opts) {
|
|
|
39
39
|
if (newBuilder) {
|
|
40
40
|
const mq = pushMountQueue();
|
|
41
41
|
onMountQueue = mq.queue;
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
currentLifetime = createLifetime(parentLifetime);
|
|
43
|
+
currentLifetime._kind =
|
|
44
|
+
opts.__disposalCause === 'show-hide'
|
|
45
|
+
? 'show'
|
|
46
|
+
: opts.__disposalCause === 'scope-rebuild'
|
|
47
|
+
? 'scope'
|
|
48
|
+
: 'branch';
|
|
44
49
|
setFlatBindings(ctx.allBindings);
|
|
45
|
-
setRenderContext({ ...ctx,
|
|
50
|
+
setRenderContext({ ...ctx, rootLifetime: currentLifetime, state });
|
|
46
51
|
currentNodes = newBuilder(createView(send));
|
|
47
52
|
clearRenderContext();
|
|
48
53
|
setFlatBindings(null);
|
|
@@ -64,14 +69,14 @@ export function branch(opts) {
|
|
|
64
69
|
if (node.parentNode)
|
|
65
70
|
node.parentNode.removeChild(node);
|
|
66
71
|
}
|
|
67
|
-
if (
|
|
72
|
+
if (leavingLifetime) {
|
|
68
73
|
// Tag BEFORE dispose so the disposer log records the cause.
|
|
69
74
|
// `show()` passes `__disposalCause: 'show-hide'`; raw branch()
|
|
70
75
|
// defaults to `'branch-swap'`. Tag wins over any pre-existing
|
|
71
76
|
// value set by an inner primitive so the outermost cause is
|
|
72
77
|
// reported (matches how humans describe the event).
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
leavingLifetime.disposalCause = opts.__disposalCause ?? 'branch-swap';
|
|
79
|
+
disposeLifetime(leavingLifetime);
|
|
75
80
|
}
|
|
76
81
|
};
|
|
77
82
|
if (leavingNodes.length > 0 && opts.leave) {
|
|
@@ -97,15 +102,20 @@ export function branch(opts) {
|
|
|
97
102
|
// index — the splice only affects entries to the RIGHT of the parent.
|
|
98
103
|
blocks.push(block);
|
|
99
104
|
const caseKey = String(currentKey);
|
|
100
|
-
const builder = opts.cases[caseKey];
|
|
105
|
+
const builder = opts.cases?.[caseKey] ?? opts.default;
|
|
101
106
|
// Initial-mount onMount callbacks are handled by the outer mountApp
|
|
102
107
|
// queue — we're still inside the first view() call. branch doesn't
|
|
103
108
|
// insert into the DOM at this point (the anchor + initial children
|
|
104
109
|
// are returned to the parent), so we don't need to flush here.
|
|
105
110
|
if (builder) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
111
|
+
currentLifetime = createLifetime(parentLifetime);
|
|
112
|
+
currentLifetime._kind =
|
|
113
|
+
opts.__disposalCause === 'show-hide'
|
|
114
|
+
? 'show'
|
|
115
|
+
: opts.__disposalCause === 'scope-rebuild'
|
|
116
|
+
? 'scope'
|
|
117
|
+
: 'branch';
|
|
118
|
+
setRenderContext({ ...ctx, rootLifetime: currentLifetime });
|
|
109
119
|
currentNodes = builder(createView(send));
|
|
110
120
|
clearRenderContext();
|
|
111
121
|
setRenderContext(ctx);
|
|
@@ -114,13 +124,13 @@ export function branch(opts) {
|
|
|
114
124
|
opts.enter(currentNodes);
|
|
115
125
|
}
|
|
116
126
|
}
|
|
117
|
-
addDisposer(
|
|
127
|
+
addDisposer(parentLifetime, () => {
|
|
118
128
|
const idx = blocks.indexOf(block);
|
|
119
129
|
if (idx !== -1)
|
|
120
130
|
blocks.splice(idx, 1);
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
if (currentLifetime) {
|
|
132
|
+
disposeLifetime(currentLifetime);
|
|
133
|
+
currentLifetime = null;
|
|
124
134
|
}
|
|
125
135
|
});
|
|
126
136
|
return [anchor, ...currentNodes];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.js","sourceRoot":"","sources":["../../src/primitives/branch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC7F,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;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B,CAAC,EAAE,GAAG,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAA;QACrD,YAAY,GAAG,OAAO,CAAC,UAAU,CAAO,IAAI,CAAC,CAAC,CAAA;QAC9C,kBAAkB,EAAE,CAAA;QACpB,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAErB,8BAA8B;QAC9B,IAAI,IAAI,CAAC,KAAK,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE;QAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACjC,IAAI,GAAG,KAAK,CAAC,CAAC;YAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACrC,IAAI,YAAY,EAAE,CAAC;YACjB,YAAY,CAAC,YAAY,CAAC,CAAA;YAC1B,YAAY,GAAG,IAAI,CAAA;QACrB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,CAAA;AAClC,CAAC","sourcesContent":["import type { BranchOptions, Scope } from '../types.js'\nimport { getRenderContext, setRenderContext, clearRenderContext } from '../render-context.js'\nimport { createScope, disposeScope, addDisposer } from '../scope.js'\nimport { setFlatBindings } from '../binding.js'\nimport { createView } from '../view-helpers.js'\nimport { FULL_MASK } from '../update-loop.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './on-mount.js'\nimport type { StructuralBlock } from '../structural.js'\n\nexport function branch<S, M = unknown>(opts: BranchOptions<S, M>): Node[] {\n const ctx = getRenderContext('branch')\n const parentScope = ctx.rootScope\n const blocks = ctx.structuralBlocks\n const send = ctx.send as (msg: M) => void\n\n const anchor = document.createComment('branch')\n\n let currentKey = opts.on(ctx.state as S)\n let currentScope: Scope | null = null\n let currentNodes: Node[] = []\n\n const block: StructuralBlock = {\n mask: (opts as { __mask?: number }).__mask ?? FULL_MASK,\n reconcile(state: unknown) {\n const newKey = opts.on(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 leavingScope = currentScope\n\n // Build new arm first (before removing old — for FLIP animations)\n currentNodes = []\n currentScope = null\n currentKey = newKey\n\n const newCaseKey = String(newKey)\n const newBuilder = opts.cases[newCaseKey]\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 currentScope = createScope(parentScope)\n currentScope._kind = opts.__disposalCause === 'show-hide' ? 'show' : 'branch'\n setFlatBindings(ctx.allBindings)\n setRenderContext({ ...ctx, rootScope: currentScope, state })\n currentNodes = newBuilder(createView<S, M>(send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(mq.prev)\n\n const ref = anchor.nextSibling\n for (const node of currentNodes) {\n parent.insertBefore(node, ref)\n }\n }\n if (onMountQueue) flushMountQueue(onMountQueue)\n\n // Fire enter for new nodes\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n\n // Handle leave — may be deferred via Promise\n const removeOld = () => {\n for (const node of leavingNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (leavingScope) {\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 leavingScope.disposalCause = opts.__disposalCause ?? 'branch-swap'\n disposeScope(leavingScope)\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)\n const builder = opts.cases[caseKey]\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 currentScope = createScope(parentScope)\n currentScope._kind = opts.__disposalCause === 'show-hide' ? 'show' : 'branch'\n setRenderContext({ ...ctx, rootScope: currentScope })\n currentNodes = builder(createView<S, M>(send))\n clearRenderContext()\n setRenderContext(ctx)\n\n // Fire enter on initial mount\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n }\n\n addDisposer(parentScope, () => {\n const idx = blocks.indexOf(block)\n if (idx !== -1) blocks.splice(idx, 1)\n if (currentScope) {\n disposeScope(currentScope)\n currentScope = 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,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAC7F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C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AChD,eAAe,CAAC,KAAK;YACnB,IAAI,CAAC,eAAe,KAAK,WAAW;gBAClC,CAAC,CAAC,MAAM;gBACR,CAAC,CAAC,IAAI,CAAC,eAAe,KAAK,eAAe;oBACxC,CAAC,CAAC,OAAO;oBACT,CAAC,CAAC,QAAQ,CAAA;QAChB,gBAAgB,CAAC,EAAE,GAAG,GAAG,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC,CAAA;QAC3D,YAAY,GAAG,OAAO,CAAC,UAAU,CAAO,IAAI,CAAC,CAAC,CAAA;QAC9C,kBAAkB,EAAE,CAAA;QACpB,gBAAgB,CAAC,GAAG,CAAC,CAAA;QAErB,8BAA8B;QAC9B,IAAI,IAAI,CAAC,KAAK,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IAED,WAAW,CAAC,cAAc,EAAE,GAAG,EAAE;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACjC,IAAI,GAAG,KAAK,CAAC,CAAC;YAAE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QACrC,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 { getRenderContext, setRenderContext, clearRenderContext } from '../render-context.js'\nimport { createLifetime, disposeLifetime, addDisposer } from '../lifetime.js'\nimport { setFlatBindings } from '../binding.js'\nimport { createView } from '../view-helpers.js'\nimport { FULL_MASK } from '../update-loop.js'\nimport { pushMountQueue, popMountQueue, flushMountQueue } from './on-mount.js'\nimport type { StructuralBlock } from '../structural.js'\n\nexport function branch<S, M = unknown, K extends string = string>(\n opts: BranchOptions<S, M, K>,\n): Node[] {\n const ctx = getRenderContext('branch')\n const parentLifetime = ctx.rootLifetime\n const blocks = ctx.structuralBlocks\n const send = ctx.send as (msg: M) => void\n\n const anchor = document.createComment('branch')\n\n let currentKey = opts.on(ctx.state as S)\n let currentLifetime: Lifetime | null = null\n let currentNodes: Node[] = []\n\n const block: StructuralBlock = {\n mask: (opts as { __mask?: number }).__mask ?? FULL_MASK,\n reconcile(state: unknown) {\n const newKey = opts.on(state as S)\n if (Object.is(newKey, currentKey)) return\n\n const parent = anchor.parentNode\n if (!parent) return\n\n const leavingNodes = currentNodes\n const leavingLifetime = currentLifetime\n\n // Build new arm first (before removing old — for FLIP animations)\n currentNodes = []\n currentLifetime = null\n currentKey = newKey\n\n const newCaseKey = String(newKey) as K\n const newBuilder = opts.cases?.[newCaseKey] ?? opts.default\n // Collect onMount callbacks from the new case into a local queue,\n // then flush them SYNCHRONOUSLY after the new nodes are inserted.\n // Without this, onMount inside a branch case would see stale DOM\n // (nodes not yet attached) OR fall back to queueMicrotask and\n // race with synchronous event dispatches after the reconcile.\n let onMountQueue: Array<() => void> | null = null\n if (newBuilder) {\n const mq = pushMountQueue()\n onMountQueue = mq.queue\n currentLifetime = createLifetime(parentLifetime)\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n setFlatBindings(ctx.allBindings)\n setRenderContext({ ...ctx, rootLifetime: currentLifetime, state })\n currentNodes = newBuilder(createView<S, M>(send))\n clearRenderContext()\n setFlatBindings(null)\n popMountQueue(mq.prev)\n\n const ref = anchor.nextSibling\n for (const node of currentNodes) {\n parent.insertBefore(node, ref)\n }\n }\n if (onMountQueue) flushMountQueue(onMountQueue)\n\n // Fire enter for new nodes\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n\n // Handle leave — may be deferred via Promise\n const removeOld = () => {\n for (const node of leavingNodes) {\n if (node.parentNode) node.parentNode.removeChild(node)\n }\n if (leavingLifetime) {\n // Tag BEFORE dispose so the disposer log records the cause.\n // `show()` passes `__disposalCause: 'show-hide'`; raw branch()\n // defaults to `'branch-swap'`. Tag wins over any pre-existing\n // value set by an inner primitive so the outermost cause is\n // reported (matches how humans describe the event).\n leavingLifetime.disposalCause = opts.__disposalCause ?? 'branch-swap'\n disposeLifetime(leavingLifetime)\n }\n }\n\n if (leavingNodes.length > 0 && opts.leave) {\n const result = opts.leave(leavingNodes)\n if (result && typeof (result as Promise<void>).then === 'function') {\n ;(result as Promise<void>).then(removeOld)\n } else {\n removeOld()\n }\n } else {\n removeOld()\n }\n },\n }\n\n // Register the block BEFORE running the initial builder so that parent\n // blocks always precede their nested children in the flat blocks array.\n // This guarantees correct Phase 1 iteration order: parents reconcile\n // first, so a parent that unmounts its old arm can dispose nested child\n // blocks (splicing them out of this array) without corrupting the loop\n // index — the splice only affects entries to the RIGHT of the parent.\n blocks.push(block)\n\n const caseKey = String(currentKey) as K\n const builder = opts.cases?.[caseKey] ?? opts.default\n // Initial-mount onMount callbacks are handled by the outer mountApp\n // queue — we're still inside the first view() call. branch doesn't\n // insert into the DOM at this point (the anchor + initial children\n // are returned to the parent), so we don't need to flush here.\n if (builder) {\n currentLifetime = createLifetime(parentLifetime)\n currentLifetime._kind =\n opts.__disposalCause === 'show-hide'\n ? 'show'\n : opts.__disposalCause === 'scope-rebuild'\n ? 'scope'\n : 'branch'\n setRenderContext({ ...ctx, rootLifetime: currentLifetime })\n currentNodes = builder(createView<S, M>(send))\n clearRenderContext()\n setRenderContext(ctx)\n\n // Fire enter on initial mount\n if (opts.enter && currentNodes.length > 0) {\n opts.enter(currentNodes)\n }\n }\n\n addDisposer(parentLifetime, () => {\n const idx = blocks.indexOf(block)\n if (idx !== -1) blocks.splice(idx, 1)\n if (currentLifetime) {\n disposeLifetime(currentLifetime)\n currentLifetime = null\n }\n })\n\n return [anchor, ...currentNodes]\n}\n"]}
|