@pithyjs/core 0.1.0-beta.14 → 0.1.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +10 -0
  2. package/dist/compile/bindSwitchCases.d.ts.map +1 -1
  3. package/dist/compile/bindSwitchCases.js +14 -7
  4. package/dist/compile/bindSwitchCases.js.map +1 -1
  5. package/dist/compile/binds/bindAfterComponents.d.ts +4 -0
  6. package/dist/compile/binds/bindAfterComponents.d.ts.map +1 -0
  7. package/dist/compile/binds/bindAfterComponents.js +26 -0
  8. package/dist/compile/binds/bindAfterComponents.js.map +1 -0
  9. package/dist/compile/binds/bindAfterProjection.d.ts.map +1 -1
  10. package/dist/compile/binds/bindAfterProjection.js +2 -21
  11. package/dist/compile/binds/bindAfterProjection.js.map +1 -1
  12. package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
  13. package/dist/compile/binds/bindComponentsTags.js +32 -10
  14. package/dist/compile/binds/bindComponentsTags.js.map +1 -1
  15. package/dist/compile/binds/bindErrorBoundary.d.ts +11 -1
  16. package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
  17. package/dist/compile/binds/bindErrorBoundary.js +44 -9
  18. package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
  19. package/dist/compile/compileNodes.d.ts.map +1 -1
  20. package/dist/compile/compileNodes.js +2 -0
  21. package/dist/compile/compileNodes.js.map +1 -1
  22. package/dist/compile/compileTemplate.d.ts.map +1 -1
  23. package/dist/compile/compileTemplate.js +2 -0
  24. package/dist/compile/compileTemplate.js.map +1 -1
  25. package/dist/compile/contentProjection.d.ts +3 -0
  26. package/dist/compile/contentProjection.d.ts.map +1 -1
  27. package/dist/compile/contentProjection.js +8 -0
  28. package/dist/compile/contentProjection.js.map +1 -1
  29. package/dist/compile/disposeOrder.d.ts +35 -0
  30. package/dist/compile/disposeOrder.d.ts.map +1 -0
  31. package/dist/compile/disposeOrder.js +81 -0
  32. package/dist/compile/disposeOrder.js.map +1 -0
  33. package/dist/compile/forLoops/bindForLoops.d.ts +1 -1
  34. package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -1
  35. package/dist/compile/forLoops/bindForLoops.js +10 -3
  36. package/dist/compile/forLoops/bindForLoops.js.map +1 -1
  37. package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
  38. package/dist/compile/forLoops/createLoopManager.js +19 -2
  39. package/dist/compile/forLoops/createLoopManager.js.map +1 -1
  40. package/dist/compile/handleConditionalChain.d.ts.map +1 -1
  41. package/dist/compile/handleConditionalChain.js +2 -3
  42. package/dist/compile/handleConditionalChain.js.map +1 -1
  43. package/dist/compile/renderBranch.d.ts +1 -1
  44. package/dist/compile/renderBranch.d.ts.map +1 -1
  45. package/dist/compile/renderBranch.js +5 -3
  46. package/dist/compile/renderBranch.js.map +1 -1
  47. package/dist/compile/renderChildren.d.ts.map +1 -1
  48. package/dist/compile/renderChildren.js +2 -1
  49. package/dist/compile/renderChildren.js.map +1 -1
  50. package/dist/runtime/applyBindings.d.ts.map +1 -1
  51. package/dist/runtime/applyBindings.js +2 -0
  52. package/dist/runtime/applyBindings.js.map +1 -1
  53. package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
  54. package/dist/runtime/bindings/applyComponent.js +10 -7
  55. package/dist/runtime/bindings/applyComponent.js.map +1 -1
  56. package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
  57. package/dist/runtime/bindings/applySimple.js +2 -2
  58. package/dist/runtime/bindings/applySimple.js.map +1 -1
  59. package/dist/runtime/bindings/applyStructural.d.ts.map +1 -1
  60. package/dist/runtime/bindings/applyStructural.js +11 -13
  61. package/dist/runtime/bindings/applyStructural.js.map +1 -1
  62. package/dist/runtime/bindings/helpers.d.ts +7 -0
  63. package/dist/runtime/bindings/helpers.d.ts.map +1 -1
  64. package/dist/runtime/bindings/helpers.js +33 -1
  65. package/dist/runtime/bindings/helpers.js.map +1 -1
  66. package/dist/runtime/html.d.ts.map +1 -1
  67. package/dist/runtime/html.js +2 -3
  68. package/dist/runtime/html.js.map +1 -1
  69. package/dist/types/globals.d.ts +2 -0
  70. package/dist/types/globals.d.ts.map +1 -1
  71. package/dist/types/globals.js.map +1 -1
  72. package/package.json +5 -5
@@ -1,5 +1,5 @@
1
1
  import { compileExpression } from '../../compile/compileExpression.js';
2
- import { boundaryForElement, runWithBoundary, withSlotBoundary, slotContentHidden, } from '../../compile/binds/bindErrorBoundary.js';
2
+ import { boundaryForElement, replaceHidden, runWithBoundary, withSlotBoundary, slotContentHidden, } from '../../compile/binds/bindErrorBoundary.js';
3
3
  import { linkOuterSlotMap, } from '../../compile/contentProjection.js';
4
4
  import { collectForwardedAttrs, applyForwardedAttrs, } from '../../compile/binds/forwardedAttrs.js';
5
5
  import { nativeTags } from '@pithyjs/compiler';
@@ -13,6 +13,7 @@ import { clearSSRRenderCrash, reportComponentFailure, } from '../../compile/ssrC
13
13
  import { isolateDestroyCallbacks } from '../onDestroy.js';
14
14
  import { parsePropNames } from '../../compile/binds/propNames.js';
15
15
  import { nodeExpando } from '../../compile/nodeExpando.js';
16
+ import { anchorDisposer, componentDisposer } from '../../compile/disposeOrder.js';
16
17
  /** Map kebab-case or lowered DOM attr name to expected camelCase prop name. */
17
18
  function normalizePropName(authored, expectedProps) {
18
19
  if (expectedProps.includes(authored))
@@ -58,7 +59,7 @@ function renderSlot(factory, ctx, disposers, anchor, host) {
58
59
  g.__pithyComponentContext = undefined;
59
60
  try {
60
61
  const { el, destroy } = withSlotBoundary(anchor, host, () => isolateDestroyCallbacks(() => factory(ctx)));
61
- disposers.push(destroy);
62
+ disposers.push(anchorDisposer(destroy, anchor ?? el.firstChild));
62
63
  // Bound already: a runtime-compiled child's binders must not bind it again.
63
64
  el.childNodes.forEach(node => (nodeExpando(node).__pithyComponentDom = true));
64
65
  return el;
@@ -186,6 +187,7 @@ export function applyComponent(d, el, ctx, disposers, pidMap, scope) {
186
187
  __slotMap: slotMap,
187
188
  __childAstNodes: undefined,
188
189
  __childFactory: childFactory,
190
+ __slotHost: el,
189
191
  };
190
192
  // Find nearest error boundary
191
193
  const boundaryEl = el.closest('[data-error]');
@@ -272,7 +274,9 @@ export function applyComponent(d, el, ctx, disposers, pidMap, scope) {
272
274
  : [renderedEl];
273
275
  let replaced = true;
274
276
  try {
275
- el.replaceWith(...nodes);
277
+ // A boundary that caught a crash in this render may have hidden `el`.
278
+ if (!replaceHidden(el, nodes))
279
+ el.replaceWith(...nodes);
276
280
  }
277
281
  catch (err) {
278
282
  // The raw <${d.tag}> is left exactly where a crash would have left it, so
@@ -311,10 +315,9 @@ export function applyComponent(d, el, ctx, disposers, pidMap, scope) {
311
315
  }
312
316
  pidMap.delete(d.pid);
313
317
  }
314
- if (disposeSetup)
315
- disposers.push(disposeSetup);
316
- if (typeof destroy === 'function')
317
- disposers.push(destroy);
318
+ const teardown = componentDisposer(destroy, disposeSetup, nodes[0] ?? (replaced ? null : el));
319
+ if (teardown)
320
+ disposers.push(teardown);
318
321
  return replaced ? nodes : undefined;
319
322
  }
320
323
  //# sourceMappingURL=applyComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"applyComponent.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,gBAAgB,GAEjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,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QACjB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;IAClC,CAAC;SAAM,CAAC;QACN,IACE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;YACpB,CAAC,cAAc;gBACb,cAAc,CAAC,MAAM,GAAG,CAAC;gBACzB,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAC/C,CAAC;YACD,OAAO,CAAC,IAAI,CACV,UAAU,CAAC,CAAC,GAAG,qGAAqG,CACrH,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,YAAY;QAAE,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC/C,IAAI,OAAO,OAAO,KAAK,UAAU;QAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC","sourcesContent":["import { compileExpression } from '../../compile/compileExpression';\nimport {\n boundaryForElement,\n runWithBoundary,\n withSlotBoundary,\n slotContentHidden,\n} from '../../compile/binds/bindErrorBoundary';\nimport {\n linkOuterSlotMap,\n type SlotMap,\n} from '../../compile/contentProjection';\nimport {\n collectForwardedAttrs,\n applyForwardedAttrs,\n} from '../../compile/binds/forwardedAttrs';\nimport { nativeTags } from '@pithyjs/compiler';\nimport { createRoot, untrack } from '@pithyjs/signals';\nimport type { CompDesc, BindingContext, ChildFactory } from './types';\nimport { nearestCtx } from './helpers';\nimport { trimBlankEdges } from '../../compile/trimBlankEdges';\nimport { pithyGlobals } from '../../types/globals';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport { isRenderableComponentEl } from '../../compile/componentResult';\nimport {\n clearSSRRenderCrash,\n reportComponentFailure,\n} from '../../compile/ssrCrashes';\nimport { isolateDestroyCallbacks } from '../onDestroy';\nimport { parsePropNames } from '../../compile/binds/propNames';\nimport { nodeExpando } from '../../compile/nodeExpando';\n\ninterface ComponentResult {\n /** Any DOM node — see the `Component` type for why this is not narrower. */\n el: Node;\n destroy?: () => void;\n}\ntype ComponentFn = (props: Record<string, unknown>) => ComponentResult;\n\n/** Map kebab-case or lowered DOM attr name to expected camelCase prop name. */\nfunction normalizePropName(authored: string, expectedProps: string[]): string {\n if (expectedProps.includes(authored)) return authored;\n const lower = authored.toLowerCase();\n const matches = expectedProps.filter(p => p.toLowerCase() === lower);\n return matches.length === 1 ? matches[0] : authored;\n}\n\n/** Cache for extractExpectedPropNames to avoid re-parsing the same function. */\nconst propNamesCache = new WeakMap<ComponentFn, string[]>();\n\n/**\n * Extract destructured prop names from component function signature.\n * NOTE: Uses fn.toString() which may return mangled names under aggressive\n * minification (Terser). In that case, prop name normalization becomes a\n * no-op and props are passed as-is (kebab/lowered). This is acceptable\n * because Vite's default esbuild minifier preserves parameter names.\n */\nfunction extractExpectedPropNames(fn: ComponentFn): string[] {\n const cached = propNamesCache.get(fn);\n if (cached) return cached;\n try {\n const parsed = parsePropNames(fn.toString());\n const names = parsed.fromParam ? parsed.names : [];\n // Detect likely minification: single-char names suggest mangled output\n if (\n import.meta.env?.DEV &&\n names.length > 0 &&\n names.every(n => n.length === 1)\n ) {\n console.warn(\n `[AOT] extractExpectedPropNames: detected single-char names (${names.join(',')}) — prop normalization may not work under minification`\n );\n }\n propNamesCache.set(fn, names);\n return names;\n } catch {\n return [];\n }\n}\n\n/** Runs a slot factory against the parent's context, owned by the mount's disposers. */\nfunction renderSlot(\n factory: ChildFactory,\n ctx: BindingContext,\n disposers: (() => void)[],\n anchor?: Node,\n host?: Element\n): DocumentFragment {\n const g = pithyGlobals();\n const rendering = g.__pithyComponentContext;\n // Otherwise mergeContexts would read the child's names into the slot's context.\n g.__pithyComponentContext = undefined;\n try {\n const { el, destroy } = withSlotBoundary(anchor, host, () =>\n isolateDestroyCallbacks(() => factory(ctx))\n );\n disposers.push(destroy);\n // Bound already: a runtime-compiled child's binders must not bind it again.\n el.childNodes.forEach(\n node => (nodeExpando(node).__pithyComponentDom = true)\n );\n return el;\n } finally {\n g.__pithyComponentContext = rendering;\n }\n}\n\n/**\n * Slot content serialized into the placeholder, from a descriptor without\n * `slots`. The nodes are moved, so each slot can be mounted only once.\n */\nfunction slotsFromChildren(\n el: Element,\n slotMap: SlotMap\n): DocumentFragment | undefined {\n const slotGroups = new Map<string, Node[]>();\n for (const child of Array.from(el.childNodes)) {\n const slotName =\n child.nodeType === Node.ELEMENT_NODE\n ? (child as Element).getAttribute('slot') || ''\n : '';\n const group = slotGroups.get(slotName);\n if (group) group.push(child);\n else slotGroups.set(slotName, [child]);\n }\n const defaultSlot = slotGroups.get('');\n if (defaultSlot) {\n const content = trimBlankEdges(defaultSlot, node =>\n node.nodeType === Node.TEXT_NODE ? node.textContent : null\n );\n if (content.length) slotGroups.set('', content);\n else slotGroups.delete('');\n }\n // `renderChildren()` and `<slot>` must share one fragment, or the later\n // consumer steals the nodes out of the first.\n let injection: DocumentFragment | undefined;\n for (const [slotName, nodes] of slotGroups) {\n if (slotName === '') {\n injection = document.createDocumentFragment();\n for (const node of nodes) injection.appendChild(node);\n const shared = injection;\n slotMap.set('', () => shared);\n continue;\n }\n slotMap.set(slotName, () => {\n const frag = document.createDocumentFragment();\n for (const node of nodes) frag.appendChild(node);\n return frag;\n });\n }\n return injection;\n}\n\nexport function applyComponent(\n d: CompDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[],\n pidMap: Map<string, Element>,\n scope?: BindingContext\n): Node[] | undefined {\n // Skip native HTML elements — prevents <div> matching a `div` in context.\n // Only apply when the authored tag is already lowercase; PascalCase tags like\n // <Button> are valid components even though \"button\" is a native tag.\n const tagLower = d.tag.toLowerCase();\n if (d.tag === tagLower && nativeTags.has(tagLower)) return;\n\n // Exact case first: the context holds the template's own locals alongside its\n // components, so a prop named `icon` sits next to the `Icon` component and\n // collides case-insensitively. The JIT path lowercases into a Map, where the\n // components — appended last — overwrite the locals; matching that ordering is\n // why `<Icon>` resolves in dev, and breaking on the first match is why it did\n // not in a build. Falling back last-wins keeps the two paths agreeing.\n let candidate: unknown = Object.prototype.hasOwnProperty.call(ctx, d.tag)\n ? ctx[d.tag]\n : undefined;\n if (candidate === undefined) {\n for (const key of Object.keys(ctx)) {\n if (key.toLowerCase() === tagLower) candidate = ctx[key];\n }\n }\n if (!candidate) return;\n\n // Support default exports\n if (\n candidate &&\n typeof candidate === 'object' &&\n 'default' in candidate &&\n typeof candidate.default === 'function'\n ) {\n candidate = candidate.default;\n }\n if (typeof candidate !== 'function') return;\n // Hidden like a sibling an activated boundary detached: never rendered.\n if (slotContentHidden(el)) return;\n\n const componentFn = candidate as ComponentFn;\n const localCtx = scope ?? nearestCtx(el, ctx);\n\n // Extract expected props for case-insensitive normalization\n const expectedProps = extractExpectedPropNames(componentFn);\n\n // Evaluate prop expressions with prop name normalization\n const props: Record<string, unknown> = {};\n for (const [rawName, expr] of Object.entries(d.props)) {\n const propName = normalizePropName(rawName, expectedProps);\n try {\n const fn = compileExpression(expr, localCtx);\n props[propName] = untrack(fn);\n } catch {\n // Leave undefined — child uses defaults\n }\n }\n\n const slotMap: SlotMap = new Map();\n linkOuterSlotMap(slotMap, localCtx);\n let injection: DocumentFragment | undefined;\n if (d.slots) {\n for (const [name, factory] of Object.entries(d.slots))\n slotMap.set(name, (ds = disposers, at) =>\n renderSlot(factory, localCtx, ds, at, el)\n );\n } else {\n injection = slotsFromChildren(el, slotMap);\n }\n\n let invoking = true;\n const childrenFactory = d.children;\n const childFactory: ChildFactory | undefined = childrenFactory\n ? (ctx, wrap) =>\n invoking\n ? childrenFactory(ctx, wrap)\n : isolateDestroyCallbacks(() => childrenFactory(ctx, wrap))\n : undefined;\n\n const componentContext = {\n ...localCtx,\n __slotMap: slotMap,\n __childAstNodes: undefined,\n __childFactory: childFactory,\n };\n\n // Find nearest error boundary\n const boundaryEl = el.closest('[data-error]') as Element | null;\n const boundary = boundaryForElement(boundaryEl);\n\n let out: ComponentResult | undefined;\n let disposeSetup: (() => void) | undefined;\n try {\n out = runWithBoundary(boundary, () => {\n const g = pithyGlobals();\n const originalContext = g.__pithyComponentContext;\n const wasRendering = g.__pithyRenderingComponent;\n const prevInjection = g.__pithyProjectedChildren;\n g.__pithyComponentContext = componentContext;\n g.__pithyRenderingComponent = true;\n g.__pithyProjectedChildren = injection;\n try {\n return createRoot(disposeRoot => {\n disposeSetup = disposeRoot;\n return componentFn(props);\n });\n } finally {\n g.__pithyComponentContext = originalContext;\n g.__pithyRenderingComponent = wasRendering;\n g.__pithyProjectedChildren = prevInjection;\n invoking = false;\n }\n });\n } catch (err) {\n if (boundary) {\n const error = err instanceof Error ? err : new Error(String(err));\n // See `setBoundaryError`: an already-active boundary with no free ancestor\n // drops the error rather than taking it, which is the normal case for a\n // component rendering inside that boundary's `@fallback`.\n reportComponentFailure(el, d.tag, error, boundary);\n return;\n }\n\n // No boundary in scope *yet*. Degrade in both modes — an AOT branch\n // factory renders detached, so `closest()` here cannot see a boundary the\n // element will sit under once the branch is inserted, and throwing would\n // only be swallowed by the structural handler's own catch\n // (`applyStructural.ts`) anyway.\n //\n // A static/server render records the crash instead: dropping the component\n // silently shipped HTML with <${d.tag}> left raw while `pithy-ssg` counted\n // the route as rendered and exited 0 (BUG-018). Anything still recorded\n // when the render finishes fails the route.\n //\n // Note this path cannot reach a boundary at all when the element is inside\n // a detached structural branch: `el.closest('[data-error]')` above found\n // nothing, and no later pass re-binds it, so the boundary never receives\n // the error even though the nodes are inserted underneath it. That is\n // BUG-023; recording is what stops it from shipping silently.\n reportComponentFailure(\n el,\n d.tag,\n err instanceof Error ? err : new Error(String(err)),\n null\n );\n\n console.error(`[AOT] Component <${d.tag}> crashed:`, err);\n return;\n }\n\n if (\n !out ||\n typeof out !== 'object' ||\n !('el' in out) ||\n !isRenderableComponentEl(out.el, el)\n ) {\n // Not a throw, but the same outcome: the raw <${d.tag}> is left in place\n // and the subtree never renders, which under SSR is content silently\n // missing from the emitted HTML. Recorded exactly like a crash (BUG-018).\n // Same funnel as a throw — see `bindComponentTags`. Recording without\n // offering it to the boundary left an AOT component under `@error-boundary`\n // failing its route with the boundary signal unset.\n reportComponentFailure(\n el,\n d.tag,\n new Error(\n `Invalid render result from <${d.tag}>; expected { el, destroy }`\n ),\n boundary\n );\n disposeSetup?.();\n return;\n }\n\n const { el: renderedEl, destroy } = out;\n\n // Capture rendered root element before fragment is consumed by replaceWith\n const forwardedClass = el.getAttribute('class');\n const forwardedAttrs = collectForwardedAttrs(el);\n const renderedRoot: HTMLElement | null =\n renderedEl instanceof DocumentFragment\n ? (renderedEl.firstElementChild as HTMLElement | null)\n : renderedEl instanceof HTMLElement\n ? renderedEl\n : null;\n\n const nodes =\n renderedEl instanceof DocumentFragment\n ? Array.from(renderedEl.childNodes)\n : [renderedEl];\n let replaced = true;\n try {\n el.replaceWith(...nodes);\n } catch (err) {\n // The raw <${d.tag}> is left exactly where a crash would have left it, so\n // this is the same content loss and is recorded the same way.\n replaced = false;\n reportComponentFailure(\n el,\n d.tag,\n err instanceof Error ? err : new Error(String(err)),\n boundary\n );\n console.error(`[AOT] Failed to replace <${d.tag}>:`, err);\n }\n\n // Retracted only here, and in the boundary catch above. This is the point at\n // which the component is known to have produced a usable node AND to have\n // reached the document.\n if (isSSRMode() && replaced) clearSSRRenderCrash(el);\n\n if (forwardedClass && renderedRoot) {\n for (const cls of forwardedClass.split(/\\s+/)) {\n if (cls) renderedRoot.classList.add(cls);\n }\n }\n\n if (forwardedAttrs.length > 0 && renderedRoot) {\n applyForwardedAttrs(renderedRoot, forwardedAttrs, d.tag);\n }\n\n // Re-target the component pid to the rendered root so subsequent binding\n // passes (event, bound, class, style) apply to the component's actual DOM\n // element. This matches the JIT path where data-on-* attributes are\n // forwarded from the placeholder to the rendered root.\n if (renderedRoot) {\n pidMap.set(d.pid, renderedRoot);\n } else {\n if (\n import.meta.env?.DEV &&\n (forwardedClass ||\n forwardedAttrs.length > 0 ||\n (d.props && Object.keys(d.props).length > 0))\n ) {\n console.warn(\n `[AOT] <${d.tag}> has forwarded attributes but returns a fragment with no single root element — forwarding skipped.`\n );\n }\n pidMap.delete(d.pid);\n }\n\n if (disposeSetup) disposers.push(disposeSetup);\n if (typeof destroy === 'function') disposers.push(destroy);\n return replaced ? nodes : undefined;\n}\n"]}
1
+ {"version":3,"file":"applyComponent.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,gBAAgB,GAEjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,M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b,cAAc,CAAC,MAAM,GAAG,CAAC;gBACzB,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAC/C,CAAC;YACD,OAAO,CAAC,IAAI,CACV,UAAU,CAAC,CAAC,GAAG,qGAAqG,CACrH,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAChC,OAAO,EACP,YAAY,EACZ,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CACnC,CAAC;IACF,IAAI,QAAQ;QAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC","sourcesContent":["import { compileExpression } from '../../compile/compileExpression';\nimport {\n boundaryForElement,\n replaceHidden,\n runWithBoundary,\n withSlotBoundary,\n slotContentHidden,\n} from '../../compile/binds/bindErrorBoundary';\nimport {\n linkOuterSlotMap,\n type SlotMap,\n} from '../../compile/contentProjection';\nimport {\n collectForwardedAttrs,\n applyForwardedAttrs,\n} from '../../compile/binds/forwardedAttrs';\nimport { nativeTags } from '@pithyjs/compiler';\nimport { createRoot, untrack } from '@pithyjs/signals';\nimport type { CompDesc, BindingContext, ChildFactory } from './types';\nimport { nearestCtx } from './helpers';\nimport { trimBlankEdges } from '../../compile/trimBlankEdges';\nimport { pithyGlobals } from '../../types/globals';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport { isRenderableComponentEl } from '../../compile/componentResult';\nimport {\n clearSSRRenderCrash,\n reportComponentFailure,\n} from '../../compile/ssrCrashes';\nimport { isolateDestroyCallbacks } from '../onDestroy';\nimport { parsePropNames } from '../../compile/binds/propNames';\nimport { nodeExpando } from '../../compile/nodeExpando';\nimport { anchorDisposer, componentDisposer } from '../../compile/disposeOrder';\n\ninterface ComponentResult {\n /** Any DOM node — see the `Component` type for why this is not narrower. */\n el: Node;\n destroy?: () => void;\n}\ntype ComponentFn = (props: Record<string, unknown>) => ComponentResult;\n\n/** Map kebab-case or lowered DOM attr name to expected camelCase prop name. */\nfunction normalizePropName(authored: string, expectedProps: string[]): string {\n if (expectedProps.includes(authored)) return authored;\n const lower = authored.toLowerCase();\n const matches = expectedProps.filter(p => p.toLowerCase() === lower);\n return matches.length === 1 ? matches[0] : authored;\n}\n\n/** Cache for extractExpectedPropNames to avoid re-parsing the same function. */\nconst propNamesCache = new WeakMap<ComponentFn, string[]>();\n\n/**\n * Extract destructured prop names from component function signature.\n * NOTE: Uses fn.toString() which may return mangled names under aggressive\n * minification (Terser). In that case, prop name normalization becomes a\n * no-op and props are passed as-is (kebab/lowered). This is acceptable\n * because Vite's default esbuild minifier preserves parameter names.\n */\nfunction extractExpectedPropNames(fn: ComponentFn): string[] {\n const cached = propNamesCache.get(fn);\n if (cached) return cached;\n try {\n const parsed = parsePropNames(fn.toString());\n const names = parsed.fromParam ? parsed.names : [];\n // Detect likely minification: single-char names suggest mangled output\n if (\n import.meta.env?.DEV &&\n names.length > 0 &&\n names.every(n => n.length === 1)\n ) {\n console.warn(\n `[AOT] extractExpectedPropNames: detected single-char names (${names.join(',')}) — prop normalization may not work under minification`\n );\n }\n propNamesCache.set(fn, names);\n return names;\n } catch {\n return [];\n }\n}\n\n/** Runs a slot factory against the parent's context, owned by the mount's disposers. */\nfunction renderSlot(\n factory: ChildFactory,\n ctx: BindingContext,\n disposers: (() => void)[],\n anchor?: Node,\n host?: Element\n): DocumentFragment {\n const g = pithyGlobals();\n const rendering = g.__pithyComponentContext;\n // Otherwise mergeContexts would read the child's names into the slot's context.\n g.__pithyComponentContext = undefined;\n try {\n const { el, destroy } = withSlotBoundary(anchor, host, () =>\n isolateDestroyCallbacks(() => factory(ctx))\n );\n disposers.push(anchorDisposer(destroy, anchor ?? el.firstChild));\n // Bound already: a runtime-compiled child's binders must not bind it again.\n el.childNodes.forEach(\n node => (nodeExpando(node).__pithyComponentDom = true)\n );\n return el;\n } finally {\n g.__pithyComponentContext = rendering;\n }\n}\n\n/**\n * Slot content serialized into the placeholder, from a descriptor without\n * `slots`. The nodes are moved, so each slot can be mounted only once.\n */\nfunction slotsFromChildren(\n el: Element,\n slotMap: SlotMap\n): DocumentFragment | undefined {\n const slotGroups = new Map<string, Node[]>();\n for (const child of Array.from(el.childNodes)) {\n const slotName =\n child.nodeType === Node.ELEMENT_NODE\n ? (child as Element).getAttribute('slot') || ''\n : '';\n const group = slotGroups.get(slotName);\n if (group) group.push(child);\n else slotGroups.set(slotName, [child]);\n }\n const defaultSlot = slotGroups.get('');\n if (defaultSlot) {\n const content = trimBlankEdges(defaultSlot, node =>\n node.nodeType === Node.TEXT_NODE ? node.textContent : null\n );\n if (content.length) slotGroups.set('', content);\n else slotGroups.delete('');\n }\n // `renderChildren()` and `<slot>` must share one fragment, or the later\n // consumer steals the nodes out of the first.\n let injection: DocumentFragment | undefined;\n for (const [slotName, nodes] of slotGroups) {\n if (slotName === '') {\n injection = document.createDocumentFragment();\n for (const node of nodes) injection.appendChild(node);\n const shared = injection;\n slotMap.set('', () => shared);\n continue;\n }\n slotMap.set(slotName, () => {\n const frag = document.createDocumentFragment();\n for (const node of nodes) frag.appendChild(node);\n return frag;\n });\n }\n return injection;\n}\n\nexport function applyComponent(\n d: CompDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[],\n pidMap: Map<string, Element>,\n scope?: BindingContext\n): Node[] | undefined {\n // Skip native HTML elements — prevents <div> matching a `div` in context.\n // Only apply when the authored tag is already lowercase; PascalCase tags like\n // <Button> are valid components even though \"button\" is a native tag.\n const tagLower = d.tag.toLowerCase();\n if (d.tag === tagLower && nativeTags.has(tagLower)) return;\n\n // Exact case first: the context holds the template's own locals alongside its\n // components, so a prop named `icon` sits next to the `Icon` component and\n // collides case-insensitively. The JIT path lowercases into a Map, where the\n // components — appended last — overwrite the locals; matching that ordering is\n // why `<Icon>` resolves in dev, and breaking on the first match is why it did\n // not in a build. Falling back last-wins keeps the two paths agreeing.\n let candidate: unknown = Object.prototype.hasOwnProperty.call(ctx, d.tag)\n ? ctx[d.tag]\n : undefined;\n if (candidate === undefined) {\n for (const key of Object.keys(ctx)) {\n if (key.toLowerCase() === tagLower) candidate = ctx[key];\n }\n }\n if (!candidate) return;\n\n // Support default exports\n if (\n candidate &&\n typeof candidate === 'object' &&\n 'default' in candidate &&\n typeof candidate.default === 'function'\n ) {\n candidate = candidate.default;\n }\n if (typeof candidate !== 'function') return;\n // Hidden like a sibling an activated boundary detached: never rendered.\n if (slotContentHidden(el)) return;\n\n const componentFn = candidate as ComponentFn;\n const localCtx = scope ?? nearestCtx(el, ctx);\n\n // Extract expected props for case-insensitive normalization\n const expectedProps = extractExpectedPropNames(componentFn);\n\n // Evaluate prop expressions with prop name normalization\n const props: Record<string, unknown> = {};\n for (const [rawName, expr] of Object.entries(d.props)) {\n const propName = normalizePropName(rawName, expectedProps);\n try {\n const fn = compileExpression(expr, localCtx);\n props[propName] = untrack(fn);\n } catch {\n // Leave undefined — child uses defaults\n }\n }\n\n const slotMap: SlotMap = new Map();\n linkOuterSlotMap(slotMap, localCtx);\n let injection: DocumentFragment | undefined;\n if (d.slots) {\n for (const [name, factory] of Object.entries(d.slots))\n slotMap.set(name, (ds = disposers, at) =>\n renderSlot(factory, localCtx, ds, at, el)\n );\n } else {\n injection = slotsFromChildren(el, slotMap);\n }\n\n let invoking = true;\n const childrenFactory = d.children;\n const childFactory: ChildFactory | undefined = childrenFactory\n ? (ctx, wrap) =>\n invoking\n ? childrenFactory(ctx, wrap)\n : isolateDestroyCallbacks(() => childrenFactory(ctx, wrap))\n : undefined;\n\n const componentContext = {\n ...localCtx,\n __slotMap: slotMap,\n __childAstNodes: undefined,\n __childFactory: childFactory,\n __slotHost: el,\n };\n\n // Find nearest error boundary\n const boundaryEl = el.closest('[data-error]') as Element | null;\n const boundary = boundaryForElement(boundaryEl);\n\n let out: ComponentResult | undefined;\n let disposeSetup: (() => void) | undefined;\n try {\n out = runWithBoundary(boundary, () => {\n const g = pithyGlobals();\n const originalContext = g.__pithyComponentContext;\n const wasRendering = g.__pithyRenderingComponent;\n const prevInjection = g.__pithyProjectedChildren;\n g.__pithyComponentContext = componentContext;\n g.__pithyRenderingComponent = true;\n g.__pithyProjectedChildren = injection;\n try {\n return createRoot(disposeRoot => {\n disposeSetup = disposeRoot;\n return componentFn(props);\n });\n } finally {\n g.__pithyComponentContext = originalContext;\n g.__pithyRenderingComponent = wasRendering;\n g.__pithyProjectedChildren = prevInjection;\n invoking = false;\n }\n });\n } catch (err) {\n if (boundary) {\n const error = err instanceof Error ? err : new Error(String(err));\n // See `setBoundaryError`: an already-active boundary with no free ancestor\n // drops the error rather than taking it, which is the normal case for a\n // component rendering inside that boundary's `@fallback`.\n reportComponentFailure(el, d.tag, error, boundary);\n return;\n }\n\n // No boundary in scope *yet*. Degrade in both modes — an AOT branch\n // factory renders detached, so `closest()` here cannot see a boundary the\n // element will sit under once the branch is inserted, and throwing would\n // only be swallowed by the structural handler's own catch\n // (`applyStructural.ts`) anyway.\n //\n // A static/server render records the crash instead: dropping the component\n // silently shipped HTML with <${d.tag}> left raw while `pithy-ssg` counted\n // the route as rendered and exited 0 (BUG-018). Anything still recorded\n // when the render finishes fails the route.\n //\n // Note this path cannot reach a boundary at all when the element is inside\n // a detached structural branch: `el.closest('[data-error]')` above found\n // nothing, and no later pass re-binds it, so the boundary never receives\n // the error even though the nodes are inserted underneath it. That is\n // BUG-023; recording is what stops it from shipping silently.\n reportComponentFailure(\n el,\n d.tag,\n err instanceof Error ? err : new Error(String(err)),\n null\n );\n\n console.error(`[AOT] Component <${d.tag}> crashed:`, err);\n return;\n }\n\n if (\n !out ||\n typeof out !== 'object' ||\n !('el' in out) ||\n !isRenderableComponentEl(out.el, el)\n ) {\n // Not a throw, but the same outcome: the raw <${d.tag}> is left in place\n // and the subtree never renders, which under SSR is content silently\n // missing from the emitted HTML. Recorded exactly like a crash (BUG-018).\n // Same funnel as a throw — see `bindComponentTags`. Recording without\n // offering it to the boundary left an AOT component under `@error-boundary`\n // failing its route with the boundary signal unset.\n reportComponentFailure(\n el,\n d.tag,\n new Error(\n `Invalid render result from <${d.tag}>; expected { el, destroy }`\n ),\n boundary\n );\n disposeSetup?.();\n return;\n }\n\n const { el: renderedEl, destroy } = out;\n\n // Capture rendered root element before fragment is consumed by replaceWith\n const forwardedClass = el.getAttribute('class');\n const forwardedAttrs = collectForwardedAttrs(el);\n const renderedRoot: HTMLElement | null =\n renderedEl instanceof DocumentFragment\n ? (renderedEl.firstElementChild as HTMLElement | null)\n : renderedEl instanceof HTMLElement\n ? renderedEl\n : null;\n\n const nodes =\n renderedEl instanceof DocumentFragment\n ? Array.from(renderedEl.childNodes)\n : [renderedEl];\n let replaced = true;\n try {\n // A boundary that caught a crash in this render may have hidden `el`.\n if (!replaceHidden(el, nodes)) el.replaceWith(...nodes);\n } catch (err) {\n // The raw <${d.tag}> is left exactly where a crash would have left it, so\n // this is the same content loss and is recorded the same way.\n replaced = false;\n reportComponentFailure(\n el,\n d.tag,\n err instanceof Error ? err : new Error(String(err)),\n boundary\n );\n console.error(`[AOT] Failed to replace <${d.tag}>:`, err);\n }\n\n // Retracted only here, and in the boundary catch above. This is the point at\n // which the component is known to have produced a usable node AND to have\n // reached the document.\n if (isSSRMode() && replaced) clearSSRRenderCrash(el);\n\n if (forwardedClass && renderedRoot) {\n for (const cls of forwardedClass.split(/\\s+/)) {\n if (cls) renderedRoot.classList.add(cls);\n }\n }\n\n if (forwardedAttrs.length > 0 && renderedRoot) {\n applyForwardedAttrs(renderedRoot, forwardedAttrs, d.tag);\n }\n\n // Re-target the component pid to the rendered root so subsequent binding\n // passes (event, bound, class, style) apply to the component's actual DOM\n // element. This matches the JIT path where data-on-* attributes are\n // forwarded from the placeholder to the rendered root.\n if (renderedRoot) {\n pidMap.set(d.pid, renderedRoot);\n } else {\n if (\n import.meta.env?.DEV &&\n (forwardedClass ||\n forwardedAttrs.length > 0 ||\n (d.props && Object.keys(d.props).length > 0))\n ) {\n console.warn(\n `[AOT] <${d.tag}> has forwarded attributes but returns a fragment with no single root element — forwarding skipped.`\n );\n }\n pidMap.delete(d.pid);\n }\n\n const teardown = componentDisposer(\n destroy,\n disposeSetup,\n nodes[0] ?? (replaced ? null : el)\n );\n if (teardown) disposers.push(teardown);\n return replaced ? nodes : undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"applySimple.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applySimple.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,cAAc,EACf,MAAM,SAAS,CAAC;AAKjB,wBAAgB,QAAQ,CACtB,CAAC,EAAE,OAAO,EACV,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAQN;AAED,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAYN;AAED,wBAAgB,eAAe,CAC7B,CAAC,EAAE,QAAQ,EACX,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAsEN;AAED,wBAAgB,SAAS,CACvB,CAAC,EAAE,QAAQ,EACX,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CA6BN;AA4BD,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,UAAU,EACb,EAAE,EAAE,OAAO,GAAG,gBAAgB,EAC9B,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CA8EN;AAeD,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAyDN;AAgBD,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAeN;AAED,wBAAgB,YAAY,CAC1B,CAAC,EAAE,WAAW,EACd,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAgBN;AAOD,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAmCN;AAED,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAyBN"}
1
+ {"version":3,"file":"applySimple.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applySimple.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,EAC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gB,YAAY,CAC1B,CAAC,EAAE,WAAW,EACd,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAgBN;AAOD,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAmCN;AAED,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAyBN"}
@@ -3,7 +3,7 @@ import { compileExpression } from '../../compile/compileExpression.js';
3
3
  import { rejectsScriptSink } from '../../compile/binds/bindBoundAttributes.js';
4
4
  import { toTextValue } from '../../compile/textValue.js';
5
5
  import { isSSRMode } from '../../compile/ssrMode.js';
6
- import { registerBoundary, boundaryForElement, setBoundaryError, } from '../../compile/binds/bindErrorBoundary.js';
6
+ import { registerBoundary, boundaryForElement, setBoundaryError, withSlotBoundary, } from '../../compile/binds/bindErrorBoundary.js';
7
7
  import { applyClassGroup } from '../../compile/binds/bindClassDirectives.js';
8
8
  import { mountProjection } from '../../compile/contentProjection.js';
9
9
  import { bindAfterProjection } from '../../compile/binds/bindAfterProjection.js';
@@ -64,7 +64,7 @@ export function applyProjection(d, commentMap, ctx, disposers) {
64
64
  const pageCtx = nodeExpando(content).__pithyCtx;
65
65
  // Runtime-built content: the page's own passes do not run on a remount.
66
66
  if (pageCtx)
67
- bindAfterProjection(content, pageCtx, slotDisposers ?? disposers);
67
+ withSlotBoundary(at, ctx.__slotHost, () => bindAfterProjection(content, pageCtx, slotDisposers ?? disposers));
68
68
  return content;
69
69
  });
70
70
  mountProjection(slotDefs, bound, disposers);
@@ -1 +1 @@
1
- {"version":3,"file":"applySimple.js","sour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CAAC;gBACP,YAAY;YACd,CAAC;QACH,CAAC,CAAC,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,+BAA+B;IACjC,CAAC;AACH,CAAC","sourcesContent":["import { effect, isSignal } from '@pithyjs/signals';\nimport { compileExpression } from '../../compile/compileExpression';\nimport { rejectsScriptSink } from '../../compile/binds/bindBoundAttributes';\nimport { toTextValue } from '../../compile/textValue';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport {\n registerBoundary,\n boundaryForElement,\n setBoundaryError,\n} from '../../compile/binds/bindErrorBoundary';\nimport { applyClassGroup } from '../../compile/binds/bindClassDirectives';\nimport { mountProjection, type SlotMap } from '../../compile/contentProjection';\nimport { bindAfterProjection } from '../../compile/binds/bindAfterProjection';\nimport { nodeExpando } from '../../compile/nodeExpando';\nimport type {\n RefDesc,\n ErrorDesc,\n ProjDesc,\n BindDesc,\n InterpDesc,\n EventDesc,\n ClassDesc,\n ClassesDesc,\n StyleDesc,\n BoundDesc,\n BindingContext,\n} from './types';\nimport { nearestCtx, compileWithEvent } from './helpers';\n\n// ─── Individual binding handlers ──────────────────────────────────────────────\n\nexport function applyRef(\n d: RefDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const ref = ctx[d.name] as\n | { set?: (value: Element | null) => void }\n | undefined;\n if (ref && typeof ref.set === 'function') {\n ref.set(el);\n disposers.push(() => ref.set!(null));\n }\n}\n\nexport function applyError(\n d: ErrorDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // Ensure data-error attribute is set from descriptor (source of truth)\n // so registerBoundary can find the signal name, even if AOT codegen\n // stops emitting the transitional data-error attribute in the future.\n if (d.expr && !el.getAttribute('data-error')) {\n el.setAttribute('data-error', d.expr);\n }\n\n // Register el itself as an error boundary. We use registerBoundary (not\n // bindErrorBoundary) because bindErrorBoundary uses querySelectorAll which\n // only searches children — it would miss el itself.\n registerBoundary(el, ctx, disposers);\n}\n\nexport function applyProjection(\n d: ProjDesc,\n commentMap: Map<string, Comment>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const anchor = commentMap.get(`slot:${d.name}`);\n if (!anchor) return;\n\n const fallback = d.fallback;\n const anchorExpando = anchor as Comment & {\n __slotName?: string;\n __fallbackFactory?: (\n factoryCtx?: BindingContext\n ) => HTMLElement | DocumentFragment | undefined;\n };\n\n // Set expando properties that extractSlotDefs expects\n anchorExpando.__slotName = d.name;\n if (fallback) {\n anchorExpando.__fallbackFactory = (factoryCtx?: BindingContext) => {\n const result = fallback(factoryCtx || ctx);\n if (result && typeof result.destroy === 'function') {\n disposers.push(result.destroy);\n }\n return result?.el;\n };\n }\n\n // Check for SlotMap in context\n const slotMap = ('__slotMap' in ctx ? ctx.__slotMap : undefined) as\n | SlotMap\n | undefined;\n if (slotMap) {\n const slotDefs = [\n {\n name: d.name,\n anchor,\n fallbackFactory: anchorExpando.__fallbackFactory,\n },\n ];\n const render = slotMap.get(d.name);\n const bound: SlotMap = new Map();\n if (render)\n bound.set(d.name, (slotDisposers, at) => {\n const content = render(slotDisposers, at);\n const pageCtx = nodeExpando(content).__pithyCtx;\n // Runtime-built content: the page's own passes do not run on a remount.\n if (pageCtx)\n bindAfterProjection(content, pageCtx, slotDisposers ?? disposers);\n return content;\n });\n mountProjection(slotDefs, bound, disposers);\n } else if (fallback) {\n // No projected content — mount fallback\n const fallbackResult = fallback(ctx);\n const parent = anchor.parentNode;\n if (parent && fallbackResult?.el) {\n // Capture nodes for cleanup (fragment empties itself on insert)\n const nodes =\n fallbackResult.el instanceof DocumentFragment\n ? Array.from(fallbackResult.el.childNodes)\n : [fallbackResult.el];\n // Insert directly — fragment preserves child order; single node is trivial\n parent.insertBefore(fallbackResult.el, anchor.nextSibling);\n if (typeof fallbackResult.destroy === 'function') {\n disposers.push(fallbackResult.destroy);\n }\n disposers.push(() => {\n for (const node of nodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n });\n }\n }\n}\n\nexport function applyBind(\n d: BindDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n if (!(el instanceof HTMLElement)) return;\n\n const sig = ctx[d.expr];\n if (!isSignal(sig) || typeof sig.set !== 'function') {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @bind] \"${d.expr}\" must refer to a writable signal`);\n }\n return;\n }\n const write = sig.set;\n\n const prop = inferBindableProperty(el);\n const target = el as HTMLElement & Record<string, unknown>;\n const stop = effect(() => {\n const value = sig();\n if (target[prop] !== value) target[prop] = value;\n });\n\n const event = prop === 'checked' ? 'change' : 'input';\n const handler = () => {\n write(extractBindableValue(el, prop));\n };\n el.addEventListener(event, handler);\n\n disposers.push(() => {\n el.removeEventListener(event, handler);\n stop();\n });\n}\n\nfunction inferBindableProperty(el: HTMLElement): string {\n const tag = el.tagName.toLowerCase();\n if (tag === 'input') {\n const type = (el as HTMLInputElement).type;\n if (type === 'checkbox' || type === 'radio') return 'checked';\n }\n return 'value';\n}\n\n/** Extract value from element with type coercion for number inputs. */\nfunction extractBindableValue(el: HTMLElement, prop: string): unknown {\n if (prop === 'checked') return (el as HTMLInputElement).checked;\n\n const tag = el.tagName.toLowerCase();\n if (tag === 'input') {\n const inputEl = el as HTMLInputElement;\n if (inputEl.type === 'number') {\n const numValue = Number(inputEl.value);\n return isNaN(numValue) ? inputEl.value : numValue;\n }\n return inputEl.value;\n }\n\n return (el as HTMLElement & Record<string, unknown>)[prop];\n}\n\nexport function applyInterpolation(\n d: InterpDesc,\n el: Element | DocumentFragment,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // Find text nodes within el that contain {{ }} markers\n const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);\n let textNode: Text | null;\n const targets: Text[] = [];\n\n const rootLevel = d.pid === '';\n while ((textNode = walker.nextNode() as Text | null)) {\n const val = textNode.nodeValue ?? '';\n if (!val.includes('{{')) continue;\n if (rootLevel && textNode.parentElement?.closest('[data-pid]')) continue;\n targets.push(textNode);\n break;\n }\n\n if (targets.length === 0 && import.meta.env?.DEV) {\n console.warn(\n `[AOT interp] No text node with {{ }} markers found ${rootLevel ? 'at the template root' : `in element pid=\"${d.pid}\"`}`\n );\n }\n\n // Process each target text node matching this interpolation descriptor\n for (const node of targets) {\n const localCtx = nearestCtx(node, ctx);\n const parent = node.parentNode;\n if (!parent) continue;\n\n const nextSibling = node.nextSibling;\n parent.removeChild(node);\n\n for (const part of d.parts) {\n if ('s' in part) {\n // Static text\n parent.insertBefore(document.createTextNode(part.s), nextSibling);\n } else {\n // Dynamic expression\n const expr = part.e;\n const startComment = document.createComment('t');\n const dynText = document.createTextNode('');\n const endComment = document.createComment('/t');\n\n parent.insertBefore(startComment, nextSibling);\n parent.insertBefore(dynText, nextSibling);\n parent.insertBefore(endComment, nextSibling);\n\n try {\n const compiledFn = compileExpression(expr, localCtx);\n\n if (isSSRMode()) {\n try {\n dynText.nodeValue = toTextValue(compiledFn());\n } catch {\n dynText.nodeValue = '';\n }\n } else {\n let lastValue: string | undefined;\n const stop = effect(() => {\n try {\n const next = toTextValue(compiledFn());\n if (next !== lastValue) {\n dynText.nodeValue = next;\n lastValue = next;\n }\n } catch {\n dynText.nodeValue = '';\n }\n });\n disposers.push(stop);\n }\n } catch {\n dynText.nodeValue = '';\n }\n }\n }\n\n // Only process the first matching text node per interpolation descriptor\n break;\n }\n}\n\n/** Per-element, per-event idempotency guard (mirrors JIT's BOUND_KEY symbol). */\nconst AOT_BOUND_KEY: unique symbol = Symbol('pithy:aot-bound');\n\nfunction getAotBoundSet(el: Element, eventName: string): Set<string> {\n const host = el as Element & {\n [AOT_BOUND_KEY]?: Record<string, Set<string>>;\n };\n const store =\n host[AOT_BOUND_KEY] ??\n (host[AOT_BOUND_KEY] = Object.create(null) as Record<string, Set<string>>);\n return (store[eventName] ??= new Set<string>());\n}\n\nexport function applyEvent(\n d: EventDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // Idempotency: skip if this exact event+expr combo was already bound\n const boundSet = getAotBoundSet(el, d.event);\n const boundKey = `${d.event}${d.mods ? '.' + d.mods.join('.') : ''}=${d.expr}`;\n if (boundSet.has(boundKey)) return;\n\n const localCtx = nearestCtx(el, ctx);\n const mods = parseMods(d.mods);\n const handlerExpr = d.expr;\n\n const isSimpleIdentifier = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(handlerExpr);\n const directFn =\n isSimpleIdentifier && typeof localCtx[handlerExpr] === 'function'\n ? (localCtx[handlerExpr] as EventListener)\n : null;\n const runWithEvt = directFn ? null : compileWithEvent(handlerExpr, localCtx);\n\n const listener: EventListener = (ev: Event) => {\n if (mods.self && ev.target !== el) return;\n if (mods.prevent) ev.preventDefault();\n if (mods.stop) ev.stopPropagation();\n\n try {\n if (directFn) {\n return directFn.call(localCtx, ev);\n } else if (runWithEvt) {\n const out = runWithEvt(ev, el);\n if (typeof out === 'function')\n return (out as (e: Event) => unknown).call(localCtx, ev);\n return out;\n }\n } catch (error) {\n const boundaryEl = el.closest('[data-error]') as Element | null;\n const boundary = boundaryForElement(boundaryEl);\n if (boundary) {\n setBoundaryError(\n boundary,\n error instanceof Error ? error : new Error(String(error))\n );\n } else {\n throw error;\n }\n }\n };\n\n const options: AddEventListenerOptions = {\n capture: !!mods.capture,\n passive: !!mods.passive,\n once: !!mods.once,\n };\n\n el.addEventListener(d.event, listener, options);\n boundSet.add(boundKey);\n disposers.push(() => {\n el.removeEventListener(d.event, listener, { capture: !!mods.capture });\n boundSet.delete(boundKey);\n });\n}\n\nfunction parseMods(mods?: string[]): {\n once?: boolean;\n prevent?: boolean;\n stop?: boolean;\n self?: boolean;\n capture?: boolean;\n passive?: boolean;\n} {\n if (!mods) return {};\n const m: Record<string, boolean> = {};\n for (const mod of mods) m[mod] = true;\n return m;\n}\n\nexport function applyClass(\n d: ClassDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const localCtx = nearestCtx(el, ctx);\n try {\n const evaluate = compileExpression(d.expr, localCtx);\n const stop = effect(() => {\n try {\n el.classList.toggle(d.name, !!evaluate());\n } catch {\n /* ignore */\n }\n });\n disposers.push(stop);\n } catch {\n /* ignore */\n }\n}\n\nexport function applyClasses(\n d: ClassesDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const localCtx = nearestCtx(el, ctx);\n try {\n const evaluate = compileExpression(d.expr, localCtx);\n const owned = new Set<string>();\n const stop = effect(() => {\n try {\n applyClassGroup(el, evaluate(), owned);\n } catch {\n /* ignore */\n }\n });\n disposers.push(stop);\n } catch {\n /* ignore */\n }\n}\n\n/** Convert camelCase to kebab-case for CSS property names. */\nfunction toKebabCase(prop: string): string {\n return prop.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);\n}\n\nexport function applyStyle(\n d: StyleDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // Not `instanceof HTMLElement`: SVG elements have inline styles too.\n const style = (el as Partial<ElementCSSInlineStyle>).style;\n if (!style) return;\n const localCtx = nearestCtx(el, ctx);\n // setProperty requires kebab-case; codegen may emit camelCase (e.g. fontSize)\n const cssProp = d.prop.includes('-') ? d.prop : toKebabCase(d.prop);\n try {\n const evaluate = compileExpression(d.expr, localCtx);\n const stop = effect(() => {\n try {\n const value = evaluate();\n if (value == null || value === false) {\n style.removeProperty(cssProp);\n return;\n }\n const text = String(value);\n const important = /\\s*!important\\s*$/i.exec(text);\n if (important) {\n style.setProperty(\n cssProp,\n text.slice(0, important.index),\n 'important'\n );\n } else {\n style.setProperty(cssProp, text);\n }\n } catch {\n /* ignore */\n }\n });\n disposers.push(stop);\n } catch {\n /* ignore */\n }\n}\n\nexport function applyBound(\n d: BoundDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const localCtx = nearestCtx(el, ctx);\n // Compile once outside effect via compileExpression (consistent with applyClass/applyStyle).\n try {\n const evaluate = compileExpression(d.expr, localCtx);\n\n const stop = effect(() => {\n try {\n const value = evaluate();\n if (typeof value === 'boolean') {\n if (value) el.setAttribute(d.attr, '');\n else el.removeAttribute(d.attr);\n } else {\n const text = String(value ?? '');\n if (rejectsScriptSink(el, d.attr, text)) el.removeAttribute(d.attr);\n else el.setAttribute(d.attr, text);\n }\n } catch {\n /* ignore */\n }\n });\n disposers.push(stop);\n } catch {\n /* ignore invalid expression */\n }\n}\n"]}
1
+ {"version":3,"file":"applySimple.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applySimple.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAgB,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAcxD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEzD,iFAAiF;AAEjF,MAAM,UAAU,QAAQ,CACtB,CAAU,EACV,EAAW,EACX,GAAmB,EACnB,SAAyB;IAEzB,MAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAET,CAAC;IACd,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;QACzC,GAAG,CAAC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C,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAClC,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;oBACjC,IAAI,iBAAiB,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC;wBAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;;wBAC/D,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,YAAY;YACd,CAAC;QACH,CAAC,CAAC,CAAC;QACH,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,+BAA+B;IACjC,CAAC;AACH,CAAC","sourcesContent":["import { effect, isSignal } from '@pithyjs/signals';\nimport { compileExpression } from '../../compile/compileExpression';\nimport { rejectsScriptSink } from '../../compile/binds/bindBoundAttributes';\nimport { toTextValue } from '../../compile/textValue';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport {\n registerBoundary,\n boundaryForElement,\n setBoundaryError,\n withSlotBoundary,\n} from '../../compile/binds/bindErrorBoundary';\nimport { applyClassGroup } from '../../compile/binds/bindClassDirectives';\nimport { mountProjection, type SlotMap } from '../../compile/contentProjection';\nimport { bindAfterProjection } from '../../compile/binds/bindAfterProjection';\nimport { nodeExpando } from '../../compile/nodeExpando';\nimport type {\n RefDesc,\n ErrorDesc,\n ProjDesc,\n BindDesc,\n InterpDesc,\n EventDesc,\n ClassDesc,\n ClassesDesc,\n StyleDesc,\n BoundDesc,\n BindingContext,\n} from './types';\nimport { nearestCtx, compileWithEvent } from './helpers';\n\n// ─── Individual binding handlers ──────────────────────────────────────────────\n\nexport function applyRef(\n d: RefDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const ref = ctx[d.name] as\n | { set?: (value: Element | null) => void }\n | undefined;\n if (ref && typeof ref.set === 'function') {\n ref.set(el);\n disposers.push(() => ref.set!(null));\n }\n}\n\nexport function applyError(\n d: ErrorDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // Ensure data-error attribute is set from descriptor (source of truth)\n // so registerBoundary can find the signal name, even if AOT codegen\n // stops emitting the transitional data-error attribute in the future.\n if (d.expr && !el.getAttribute('data-error')) {\n el.setAttribute('data-error', d.expr);\n }\n\n // Register el itself as an error boundary. We use registerBoundary (not\n // bindErrorBoundary) because bindErrorBoundary uses querySelectorAll which\n // only searches children — it would miss el itself.\n registerBoundary(el, ctx, disposers);\n}\n\nexport function applyProjection(\n d: ProjDesc,\n commentMap: Map<string, Comment>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const anchor = commentMap.get(`slot:${d.name}`);\n if (!anchor) return;\n\n const fallback = d.fallback;\n const anchorExpando = anchor as Comment & {\n __slotName?: string;\n __fallbackFactory?: (\n factoryCtx?: BindingContext\n ) => HTMLElement | DocumentFragment | undefined;\n };\n\n // Set expando properties that extractSlotDefs expects\n anchorExpando.__slotName = d.name;\n if (fallback) {\n anchorExpando.__fallbackFactory = (factoryCtx?: BindingContext) => {\n const result = fallback(factoryCtx || ctx);\n if (result && typeof result.destroy === 'function') {\n disposers.push(result.destroy);\n }\n return result?.el;\n };\n }\n\n // Check for SlotMap in context\n const slotMap = ('__slotMap' in ctx ? ctx.__slotMap : undefined) as\n | SlotMap\n | undefined;\n if (slotMap) {\n const slotDefs = [\n {\n name: d.name,\n anchor,\n fallbackFactory: anchorExpando.__fallbackFactory,\n },\n ];\n const render = slotMap.get(d.name);\n const bound: SlotMap = new Map();\n if (render)\n bound.set(d.name, (slotDisposers, at) => {\n const content = render(slotDisposers, at);\n const pageCtx = nodeExpando(content).__pithyCtx;\n // Runtime-built content: the page's own passes do not run on a remount.\n if (pageCtx)\n withSlotBoundary(at, ctx.__slotHost as Element | undefined, () =>\n bindAfterProjection(content, pageCtx, slotDisposers ?? disposers)\n );\n return content;\n });\n mountProjection(slotDefs, bound, disposers);\n } else if (fallback) {\n // No projected content — mount fallback\n const fallbackResult = fallback(ctx);\n const parent = anchor.parentNode;\n if (parent && fallbackResult?.el) {\n // Capture nodes for cleanup (fragment empties itself on insert)\n const nodes =\n fallbackResult.el instanceof DocumentFragment\n ? Array.from(fallbackResult.el.childNodes)\n : [fallbackResult.el];\n // Insert directly — fragment preserves child order; single node is trivial\n parent.insertBefore(fallbackResult.el, anchor.nextSibling);\n if (typeof fallbackResult.destroy === 'function') {\n disposers.push(fallbackResult.destroy);\n }\n disposers.push(() => {\n for (const node of nodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n });\n }\n }\n}\n\nexport function applyBind(\n d: BindDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n if (!(el instanceof HTMLElement)) return;\n\n const sig = ctx[d.expr];\n if (!isSignal(sig) || typeof sig.set !== 'function') {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @bind] \"${d.expr}\" must refer to a writable signal`);\n }\n return;\n }\n const write = sig.set;\n\n const prop = inferBindableProperty(el);\n const target = el as HTMLElement & Record<string, unknown>;\n const stop = effect(() => {\n const value = sig();\n if (target[prop] !== value) target[prop] = value;\n });\n\n const event = prop === 'checked' ? 'change' : 'input';\n const handler = () => {\n write(extractBindableValue(el, prop));\n };\n el.addEventListener(event, handler);\n\n disposers.push(() => {\n el.removeEventListener(event, handler);\n stop();\n });\n}\n\nfunction inferBindableProperty(el: HTMLElement): string {\n const tag = el.tagName.toLowerCase();\n if (tag === 'input') {\n const type = (el as HTMLInputElement).type;\n if (type === 'checkbox' || type === 'radio') return 'checked';\n }\n return 'value';\n}\n\n/** Extract value from element with type coercion for number inputs. */\nfunction extractBindableValue(el: HTMLElement, prop: string): unknown {\n if (prop === 'checked') return (el as HTMLInputElement).checked;\n\n const tag = el.tagName.toLowerCase();\n if (tag === 'input') {\n const inputEl = el as HTMLInputElement;\n if (inputEl.type === 'number') {\n const numValue = Number(inputEl.value);\n return isNaN(numValue) ? inputEl.value : numValue;\n }\n return inputEl.value;\n }\n\n return (el as HTMLElement & Record<string, unknown>)[prop];\n}\n\nexport function applyInterpolation(\n d: InterpDesc,\n el: Element | DocumentFragment,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // Find text nodes within el that contain {{ }} markers\n const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);\n let textNode: Text | null;\n const targets: Text[] = [];\n\n const rootLevel = d.pid === '';\n while ((textNode = walker.nextNode() as Text | null)) {\n const val = textNode.nodeValue ?? '';\n if (!val.includes('{{')) continue;\n if (rootLevel && textNode.parentElement?.closest('[data-pid]')) continue;\n targets.push(textNode);\n break;\n }\n\n if (targets.length === 0 && import.meta.env?.DEV) {\n console.warn(\n `[AOT interp] No text node with {{ }} markers found ${rootLevel ? 'at the template root' : `in element pid=\"${d.pid}\"`}`\n );\n }\n\n // Process each target text node matching this interpolation descriptor\n for (const node of targets) {\n const localCtx = nearestCtx(node, ctx);\n const parent = node.parentNode;\n if (!parent) continue;\n\n const nextSibling = node.nextSibling;\n parent.removeChild(node);\n\n for (const part of d.parts) {\n if ('s' in part) {\n // Static text\n parent.insertBefore(document.createTextNode(part.s), nextSibling);\n } else {\n // Dynamic expression\n const expr = part.e;\n const startComment = document.createComment('t');\n const dynText = document.createTextNode('');\n const endComment = document.createComment('/t');\n\n parent.insertBefore(startComment, nextSibling);\n parent.insertBefore(dynText, nextSibling);\n parent.insertBefore(endComment, nextSibling);\n\n try {\n const compiledFn = compileExpression(expr, localCtx);\n\n if (isSSRMode()) {\n try {\n dynText.nodeValue = toTextValue(compiledFn());\n } catch {\n dynText.nodeValue = '';\n }\n } else {\n let lastValue: string | undefined;\n const stop = effect(() => {\n try {\n const next = toTextValue(compiledFn());\n if (next !== lastValue) {\n dynText.nodeValue = next;\n lastValue = next;\n }\n } catch {\n dynText.nodeValue = '';\n }\n });\n disposers.push(stop);\n }\n } catch {\n dynText.nodeValue = '';\n }\n }\n }\n\n // Only process the first matching text node per interpolation descriptor\n break;\n }\n}\n\n/** Per-element, per-event idempotency guard (mirrors JIT's BOUND_KEY symbol). */\nconst AOT_BOUND_KEY: unique symbol = Symbol('pithy:aot-bound');\n\nfunction getAotBoundSet(el: Element, eventName: string): Set<string> {\n const host = el as Element & {\n [AOT_BOUND_KEY]?: Record<string, Set<string>>;\n };\n const store =\n host[AOT_BOUND_KEY] ??\n (host[AOT_BOUND_KEY] = Object.create(null) as Record<string, Set<string>>);\n return (store[eventName] ??= new Set<string>());\n}\n\nexport function applyEvent(\n d: EventDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // Idempotency: skip if this exact event+expr combo was already bound\n const boundSet = getAotBoundSet(el, d.event);\n const boundKey = `${d.event}${d.mods ? '.' + d.mods.join('.') : ''}=${d.expr}`;\n if (boundSet.has(boundKey)) return;\n\n const localCtx = nearestCtx(el, ctx);\n const mods = parseMods(d.mods);\n const handlerExpr = d.expr;\n\n const isSimpleIdentifier = /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(handlerExpr);\n const directFn =\n isSimpleIdentifier && typeof localCtx[handlerExpr] === 'function'\n ? (localCtx[handlerExpr] as EventListener)\n : null;\n const runWithEvt = directFn ? null : compileWithEvent(handlerExpr, localCtx);\n\n const listener: EventListener = (ev: Event) => {\n if (mods.self && ev.target !== el) return;\n if (mods.prevent) ev.preventDefault();\n if (mods.stop) ev.stopPropagation();\n\n try {\n if (directFn) {\n return directFn.call(localCtx, ev);\n } else if (runWithEvt) {\n const out = runWithEvt(ev, el);\n if (typeof out === 'function')\n return (out as (e: Event) => unknown).call(localCtx, ev);\n return out;\n }\n } catch (error) {\n const boundaryEl = el.closest('[data-error]') as Element | null;\n const boundary = boundaryForElement(boundaryEl);\n if (boundary) {\n setBoundaryError(\n boundary,\n error instanceof Error ? error : new Error(String(error))\n );\n } else {\n throw error;\n }\n }\n };\n\n const options: AddEventListenerOptions = {\n capture: !!mods.capture,\n passive: !!mods.passive,\n once: !!mods.once,\n };\n\n el.addEventListener(d.event, listener, options);\n boundSet.add(boundKey);\n disposers.push(() => {\n el.removeEventListener(d.event, listener, { capture: !!mods.capture });\n boundSet.delete(boundKey);\n });\n}\n\nfunction parseMods(mods?: string[]): {\n once?: boolean;\n prevent?: boolean;\n stop?: boolean;\n self?: boolean;\n capture?: boolean;\n passive?: boolean;\n} {\n if (!mods) return {};\n const m: Record<string, boolean> = {};\n for (const mod of mods) m[mod] = true;\n return m;\n}\n\nexport function applyClass(\n d: ClassDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const localCtx = nearestCtx(el, ctx);\n try {\n const evaluate = compileExpression(d.expr, localCtx);\n const stop = effect(() => {\n try {\n el.classList.toggle(d.name, !!evaluate());\n } catch {\n /* ignore */\n }\n });\n disposers.push(stop);\n } catch {\n /* ignore */\n }\n}\n\nexport function applyClasses(\n d: ClassesDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const localCtx = nearestCtx(el, ctx);\n try {\n const evaluate = compileExpression(d.expr, localCtx);\n const owned = new Set<string>();\n const stop = effect(() => {\n try {\n applyClassGroup(el, evaluate(), owned);\n } catch {\n /* ignore */\n }\n });\n disposers.push(stop);\n } catch {\n /* ignore */\n }\n}\n\n/** Convert camelCase to kebab-case for CSS property names. */\nfunction toKebabCase(prop: string): string {\n return prop.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`);\n}\n\nexport function applyStyle(\n d: StyleDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // Not `instanceof HTMLElement`: SVG elements have inline styles too.\n const style = (el as Partial<ElementCSSInlineStyle>).style;\n if (!style) return;\n const localCtx = nearestCtx(el, ctx);\n // setProperty requires kebab-case; codegen may emit camelCase (e.g. fontSize)\n const cssProp = d.prop.includes('-') ? d.prop : toKebabCase(d.prop);\n try {\n const evaluate = compileExpression(d.expr, localCtx);\n const stop = effect(() => {\n try {\n const value = evaluate();\n if (value == null || value === false) {\n style.removeProperty(cssProp);\n return;\n }\n const text = String(value);\n const important = /\\s*!important\\s*$/i.exec(text);\n if (important) {\n style.setProperty(\n cssProp,\n text.slice(0, important.index),\n 'important'\n );\n } else {\n style.setProperty(cssProp, text);\n }\n } catch {\n /* ignore */\n }\n });\n disposers.push(stop);\n } catch {\n /* ignore */\n }\n}\n\nexport function applyBound(\n d: BoundDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const localCtx = nearestCtx(el, ctx);\n // Compile once outside effect via compileExpression (consistent with applyClass/applyStyle).\n try {\n const evaluate = compileExpression(d.expr, localCtx);\n\n const stop = effect(() => {\n try {\n const value = evaluate();\n if (typeof value === 'boolean') {\n if (value) el.setAttribute(d.attr, '');\n else el.removeAttribute(d.attr);\n } else {\n const text = String(value ?? '');\n if (rejectsScriptSink(el, d.attr, text)) el.removeAttribute(d.attr);\n else el.setAttribute(d.attr, text);\n }\n } catch {\n /* ignore */\n }\n });\n disposers.push(stop);\n } catch {\n /* ignore invalid expression */\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"applyStructural.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyStructural.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI3E,wBAAgB,OAAO,CACrB,CAAC,EAAE,MAAM,EACT,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAwHN;AAED,wBAAgB,QAAQ,CACtB,CAAC,EAAE,OAAO,EACV,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAmEN;AAiBD,wBAAgB,WAAW,CACzB,CAAC,EAAE,UAAU,EACb,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAsHN"}
1
+ {"version":3,"file":"applyStructural.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyStructural.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI3E,wBAAgB,OAAO,CACrB,CAAC,EAAE,MAAM,EACT,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAuHN;AAED,wBAAgB,QAAQ,CACtB,CAAC,EAAE,OAAO,EACV,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAoEN;AAiBD,wBAAgB,WAAW,CACzB,CAAC,EAAE,UAAU,EACb,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAqHN"}
@@ -3,6 +3,7 @@ import { compileExpression } from '../../compile/compileExpression.js';
3
3
  import { isSSRMode } from '../../compile/ssrMode.js';
4
4
  import { createLoopManager } from '../../compile/forLoops/createLoopManager.js';
5
5
  import { compileTrackBy } from '../../compile/forLoops/loopHelpers.js';
6
+ import { anchorDisposer, blockDisposer } from '../../compile/disposeOrder.js';
6
7
  import { createLoopContext, createLoopSignals, } from '../../compile/forLoops/loopSignals.js';
7
8
  // ─── Structural directive handlers ────────────────────────────────────────────
8
9
  export function applyIf(d, commentMap, ctx, disposers) {
@@ -12,9 +13,9 @@ export function applyIf(d, commentMap, ctx, disposers) {
12
13
  let currentNodes = [];
13
14
  let currentDisposers = [];
14
15
  function clearCurrent() {
15
- for (const fn of currentDisposers) {
16
+ for (let i = currentDisposers.length - 1; i >= 0; i--) {
16
17
  try {
17
- fn();
18
+ currentDisposers[i]();
18
19
  }
19
20
  catch {
20
21
  /* ignore */
@@ -56,7 +57,7 @@ export function applyIf(d, commentMap, ctx, disposers) {
56
57
  parent.insertBefore(node, insertRef);
57
58
  }
58
59
  if (typeof result.destroy === 'function')
59
- disposers.push(result.destroy);
60
+ disposers.push(anchorDisposer(result.destroy, anchor));
60
61
  }
61
62
  }
62
63
  catch (err) {
@@ -115,8 +116,7 @@ export function applyIf(d, commentMap, ctx, disposers) {
115
116
  }
116
117
  }
117
118
  });
118
- disposers.push(clearCurrent);
119
- disposers.push(stopEffect);
119
+ disposers.push(blockDisposer(stopEffect, clearCurrent, anchor));
120
120
  }
121
121
  export function applyFor(d, commentMap, ctx, disposers) {
122
122
  const anchor = commentMap.get(`for:${d.pid}`);
@@ -140,7 +140,7 @@ export function applyFor(d, commentMap, ctx, disposers) {
140
140
  for (const node of nodes)
141
141
  parent.insertBefore(node, insertBefore);
142
142
  if (typeof result.destroy === 'function')
143
- disposers.push(result.destroy);
143
+ disposers.push(anchorDisposer(result.destroy, nodes[0] ?? anchor));
144
144
  }
145
145
  }
146
146
  catch (err) {
@@ -178,8 +178,7 @@ export function applyFor(d, commentMap, ctx, disposers) {
178
178
  loopManager.update([]);
179
179
  }
180
180
  });
181
- disposers.push(() => loopManager.destroyAll());
182
- disposers.push(stopEffect);
181
+ disposers.push(blockDisposer(stopEffect, () => loopManager.destroyAll(), anchor));
183
182
  }
184
183
  function buildItemContext(parentCtx, d, item, index, length) {
185
184
  return createLoopContext(parentCtx, createLoopSignals(item, index, length), d.item, d.index);
@@ -191,9 +190,9 @@ export function applySwitch(d, pidMap, ctx, disposers) {
191
190
  let currentNodes = [];
192
191
  let currentDisposers = [];
193
192
  function clearCurrent() {
194
- for (const fn of currentDisposers) {
193
+ for (let i = currentDisposers.length - 1; i >= 0; i--) {
195
194
  try {
196
- fn();
195
+ currentDisposers[i]();
197
196
  }
198
197
  catch {
199
198
  /* ignore */
@@ -235,7 +234,7 @@ export function applySwitch(d, pidMap, ctx, disposers) {
235
234
  for (const node of nodes)
236
235
  containerEl.appendChild(node);
237
236
  if (typeof result.destroy === 'function')
238
- disposers.push(result.destroy);
237
+ disposers.push(anchorDisposer(result.destroy, containerEl));
239
238
  }
240
239
  }
241
240
  catch (err) {
@@ -296,7 +295,6 @@ export function applySwitch(d, pidMap, ctx, disposers) {
296
295
  }
297
296
  }
298
297
  });
299
- disposers.push(clearCurrent);
300
- disposers.push(stopEffect);
298
+ disposers.push(blockDisposer(stopEffect, clearCurrent, containerEl));
301
299
  }
302
300
  //# sourceMappingURL=applyStructural.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"applyStructural.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyStructural.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAG5C,iFAAiF;AAEjF,MAAM,UAAU,OAAO,CACrB,CAAS,EACT,UAAgC,EAChC,GAAmB,EACnB,SAAyB;IAEzB,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CA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xC,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,EAAE;oBACtC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBACnC,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;gBACtB,CAAC,CAAC,CAAC;gBACH,IAAI,MAAM,EAAE,EAAE,EAAE,CAAC;oBACf,MAAM,KAAK,GACT,MAAM,CAAC,EAAE,YAAY,gBAAgB;wBACnC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC;wBAClC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBAClB,KAAK,MAAM,IAAI,IAAI,KAAK;wBAAE,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oBACxD,YAAY,GAAG,KAAK,CAAC;oBACrB,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU;wBACtC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;yBACnC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;wBAC3B,OAAO,CAAC,IAAI,CACV,kHAAkH,CACnH,CAAC;gBACN,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;oBACtB,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7B,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import { createRoot, effect } from '@pithyjs/signals';\nimport { compileExpression } from '../../compile/compileExpression';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport { createLoopManager } from '../../compile/forLoops/createLoopManager';\nimport { compileTrackBy } from '../../compile/forLoops/loopHelpers';\nimport {\n createLoopContext,\n createLoopSignals,\n} from '../../compile/forLoops/loopSignals';\nimport type { IfDesc, ForDesc, SwitchDesc, BindingContext } from './types';\n\n// ─── Structural directive handlers ────────────────────────────────────────────\n\nexport function applyIf(\n d: IfDesc,\n commentMap: Map<string, Comment>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const anchor = commentMap.get(`if:${d.pid}`);\n if (!anchor) return;\n\n let currentNodes: Node[] = [];\n let currentDisposers: (() => void)[] = [];\n\n function clearCurrent() {\n for (const fn of currentDisposers) {\n try {\n fn();\n } catch {\n /* ignore */\n }\n }\n currentDisposers = [];\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n currentNodes = [];\n }\n\n if (isSSRMode()) {\n // SSR: evaluate once synchronously\n let matchIndex = -1;\n for (let i = 0; i < d.branches.length; i++) {\n const b = d.branches[i];\n if (b.expr === undefined) {\n matchIndex = i;\n break;\n }\n const fn = compileExpression(b.expr, ctx, false);\n if (fn()) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex >= 0) {\n try {\n const result = d.branches[matchIndex].factory(ctx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n const parent = anchor.parentNode;\n if (parent) {\n const insertRef = anchor.nextSibling;\n for (const node of nodes) parent.insertBefore(node, insertRef);\n }\n if (typeof result.destroy === 'function')\n disposers.push(result.destroy);\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @if] Factory error:`, err);\n }\n }\n return;\n }\n\n // Pre-compile branch expressions once outside effect\n const branchEvaluators = d.branches.map(b =>\n b.expr !== undefined ? compileExpression(b.expr, ctx, false) : null\n );\n\n let previousMatchIndex = -1;\n\n const stopEffect = effect(() => {\n let matchIndex = -1;\n for (let i = 0; i < d.branches.length; i++) {\n if (branchEvaluators[i] === null) {\n matchIndex = i;\n break;\n }\n if (branchEvaluators[i]!()) {\n matchIndex = i;\n break;\n }\n }\n\n if (matchIndex === previousMatchIndex) return;\n previousMatchIndex = matchIndex;\n\n clearCurrent();\n\n if (matchIndex >= 0) {\n try {\n const { factory } = d.branches[matchIndex];\n const result = createRoot(disposeRoot => {\n currentDisposers.push(disposeRoot);\n return factory(ctx);\n });\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n const parent = anchor.parentNode;\n if (parent) {\n const insertRef = anchor.nextSibling;\n for (const node of nodes) parent.insertBefore(node, insertRef);\n }\n currentNodes = nodes;\n if (typeof result.destroy === 'function')\n currentDisposers.push(result.destroy);\n else if (import.meta.env?.DEV)\n console.warn(\n '[AOT @if] branch factory returned no destroy(); effects its nested directives create will outlive the branch'\n );\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @if] Factory error:`, err);\n }\n }\n });\n\n disposers.push(clearCurrent);\n disposers.push(stopEffect);\n}\n\nexport function applyFor(\n d: ForDesc,\n commentMap: Map<string, Comment>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const anchor = commentMap.get(`for:${d.pid}`);\n if (!anchor) return;\n\n if (isSSRMode()) {\n const collFn = compileExpression<unknown[]>(d.expr, ctx, []);\n const collection = collFn() ?? [];\n const parent = anchor.parentNode;\n if (!parent) return;\n\n const insertBefore: Node | null = anchor.nextSibling;\n for (let i = 0; i < collection.length; i++) {\n const itemCtx = buildItemContext(\n ctx,\n d,\n collection[i],\n i,\n collection.length\n );\n try {\n const result = d.factory(itemCtx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) parent.insertBefore(node, insertBefore);\n if (typeof result.destroy === 'function')\n disposers.push(result.destroy);\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @for] Factory error at index ${i}:`, err);\n }\n }\n return;\n }\n\n const collFn = compileExpression<unknown[]>(d.expr, ctx, []);\n const loopManager = createLoopManager({\n anchor,\n trackByFn: compileTrackBy(d.trackBy, d.item, d.index, ctx),\n parentCtx: ctx,\n itemVar: d.item,\n indexVar: d.index,\n itemFactory: itemCtx => {\n const result = d.factory(itemCtx);\n const el = document.createDocumentFragment();\n if (result?.el) el.append(result.el);\n return { el, destroy: result?.destroy ?? (() => {}) };\n },\n });\n\n const stopEffect = effect(() => {\n try {\n const collection = collFn();\n if (!Array.isArray(collection) && import.meta.env?.DEV)\n console.warn('[AOT @for] collection is not an array:', collection);\n loopManager.update(Array.isArray(collection) ? collection : []);\n } catch (err) {\n if (import.meta.env?.DEV) console.error('[AOT @for] update failed:', err);\n loopManager.update([]);\n }\n });\n\n disposers.push(() => loopManager.destroyAll());\n disposers.push(stopEffect);\n}\n\nfunction buildItemContext(\n parentCtx: BindingContext,\n d: ForDesc,\n item: unknown,\n index: number,\n length: number\n): BindingContext {\n return createLoopContext(\n parentCtx,\n createLoopSignals(item, index, length),\n d.item,\n d.index\n );\n}\n\nexport function applySwitch(\n d: SwitchDesc,\n pidMap: Map<string, Element>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const containerEl = pidMap.get(d.pid);\n if (!containerEl) return;\n\n let currentNodes: Node[] = [];\n let currentDisposers: (() => void)[] = [];\n\n function clearCurrent() {\n for (const fn of currentDisposers) {\n try {\n fn();\n } catch {\n /* ignore */\n }\n }\n currentDisposers = [];\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n currentNodes = [];\n }\n\n if (isSSRMode()) {\n const switchVal = compileExpression(d.expr, ctx)();\n let matchIndex = -1;\n let defaultIndex = -1;\n for (let i = 0; i < d.cases.length; i++) {\n const c = d.cases[i];\n if (c.val === undefined) {\n if (defaultIndex === -1) defaultIndex = i;\n continue;\n }\n const caseVal = compileExpression(c.val, ctx)();\n if (caseVal === switchVal) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex === -1) matchIndex = defaultIndex;\n if (matchIndex >= 0) {\n try {\n const result = d.cases[matchIndex].factory(ctx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) containerEl.appendChild(node);\n if (typeof result.destroy === 'function')\n disposers.push(result.destroy);\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @switch] Factory error:`, err);\n }\n }\n return;\n }\n\n // Pre-compile switch expression and case values once outside effect\n const switchEval = compileExpression(d.expr, ctx);\n const caseEvals = d.cases.map(c =>\n c.val !== undefined ? compileExpression(c.val, ctx) : null\n );\n\n let previousMatchIndex = -1;\n\n const stopEffect = effect(() => {\n const switchVal = switchEval();\n let matchIndex = -1;\n let defaultIndex = -1;\n for (let i = 0; i < d.cases.length; i++) {\n if (caseEvals[i] === null) {\n if (defaultIndex === -1) defaultIndex = i;\n continue;\n }\n if (caseEvals[i]!() === switchVal) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex === -1) matchIndex = defaultIndex;\n\n if (matchIndex === previousMatchIndex) return;\n previousMatchIndex = matchIndex;\n\n clearCurrent();\n\n if (matchIndex >= 0) {\n try {\n const { factory } = d.cases[matchIndex];\n const result = createRoot(disposeRoot => {\n currentDisposers.push(disposeRoot);\n return factory(ctx);\n });\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) containerEl.appendChild(node);\n currentNodes = nodes;\n if (typeof result.destroy === 'function')\n currentDisposers.push(result.destroy);\n else if (import.meta.env?.DEV)\n console.warn(\n '[AOT @switch] branch factory returned no destroy(); effects its nested directives create will outlive the branch'\n );\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @switch] Factory error:`, err);\n }\n }\n });\n\n disposers.push(clearCurrent);\n disposers.push(stopEffect);\n}\n"]}
1
+ {"version":3,"file":"applyStructural.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyStructural.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EA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;wBAAE,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;oBACxD,YAAY,GAAG,KAAK,CAAC;oBACrB,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,UAAU;wBACtC,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;yBACnC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;wBAC3B,OAAO,CAAC,IAAI,CACV,kHAAkH,CACnH,CAAC;gBACN,CAAC;YACH,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG;oBACtB,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;YACvD,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AACvE,CAAC","sourcesContent":["import { createRoot, effect } from '@pithyjs/signals';\nimport { compileExpression } from '../../compile/compileExpression';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport { createLoopManager } from '../../compile/forLoops/createLoopManager';\nimport { compileTrackBy } from '../../compile/forLoops/loopHelpers';\nimport { anchorDisposer, blockDisposer } from '../../compile/disposeOrder';\nimport {\n createLoopContext,\n createLoopSignals,\n} from '../../compile/forLoops/loopSignals';\nimport type { IfDesc, ForDesc, SwitchDesc, BindingContext } from './types';\n\n// ─── Structural directive handlers ────────────────────────────────────────────\n\nexport function applyIf(\n d: IfDesc,\n commentMap: Map<string, Comment>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const anchor = commentMap.get(`if:${d.pid}`);\n if (!anchor) return;\n\n let currentNodes: Node[] = [];\n let currentDisposers: (() => void)[] = [];\n\n function clearCurrent() {\n for (let i = currentDisposers.length - 1; i >= 0; i--) {\n try {\n currentDisposers[i]();\n } catch {\n /* ignore */\n }\n }\n currentDisposers = [];\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n currentNodes = [];\n }\n\n if (isSSRMode()) {\n // SSR: evaluate once synchronously\n let matchIndex = -1;\n for (let i = 0; i < d.branches.length; i++) {\n const b = d.branches[i];\n if (b.expr === undefined) {\n matchIndex = i;\n break;\n }\n const fn = compileExpression(b.expr, ctx, false);\n if (fn()) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex >= 0) {\n try {\n const result = d.branches[matchIndex].factory(ctx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n const parent = anchor.parentNode;\n if (parent) {\n const insertRef = anchor.nextSibling;\n for (const node of nodes) parent.insertBefore(node, insertRef);\n }\n if (typeof result.destroy === 'function')\n disposers.push(anchorDisposer(result.destroy, anchor));\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @if] Factory error:`, err);\n }\n }\n return;\n }\n\n // Pre-compile branch expressions once outside effect\n const branchEvaluators = d.branches.map(b =>\n b.expr !== undefined ? compileExpression(b.expr, ctx, false) : null\n );\n\n let previousMatchIndex = -1;\n\n const stopEffect = effect(() => {\n let matchIndex = -1;\n for (let i = 0; i < d.branches.length; i++) {\n if (branchEvaluators[i] === null) {\n matchIndex = i;\n break;\n }\n if (branchEvaluators[i]!()) {\n matchIndex = i;\n break;\n }\n }\n\n if (matchIndex === previousMatchIndex) return;\n previousMatchIndex = matchIndex;\n\n clearCurrent();\n\n if (matchIndex >= 0) {\n try {\n const { factory } = d.branches[matchIndex];\n const result = createRoot(disposeRoot => {\n currentDisposers.push(disposeRoot);\n return factory(ctx);\n });\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n const parent = anchor.parentNode;\n if (parent) {\n const insertRef = anchor.nextSibling;\n for (const node of nodes) parent.insertBefore(node, insertRef);\n }\n currentNodes = nodes;\n if (typeof result.destroy === 'function')\n currentDisposers.push(result.destroy);\n else if (import.meta.env?.DEV)\n console.warn(\n '[AOT @if] branch factory returned no destroy(); effects its nested directives create will outlive the branch'\n );\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @if] Factory error:`, err);\n }\n }\n });\n\n disposers.push(blockDisposer(stopEffect, clearCurrent, anchor));\n}\n\nexport function applyFor(\n d: ForDesc,\n commentMap: Map<string, Comment>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const anchor = commentMap.get(`for:${d.pid}`);\n if (!anchor) return;\n\n if (isSSRMode()) {\n const collFn = compileExpression<unknown[]>(d.expr, ctx, []);\n const collection = collFn() ?? [];\n const parent = anchor.parentNode;\n if (!parent) return;\n\n const insertBefore: Node | null = anchor.nextSibling;\n for (let i = 0; i < collection.length; i++) {\n const itemCtx = buildItemContext(\n ctx,\n d,\n collection[i],\n i,\n collection.length\n );\n try {\n const result = d.factory(itemCtx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) parent.insertBefore(node, insertBefore);\n if (typeof result.destroy === 'function')\n disposers.push(anchorDisposer(result.destroy, nodes[0] ?? anchor));\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @for] Factory error at index ${i}:`, err);\n }\n }\n return;\n }\n\n const collFn = compileExpression<unknown[]>(d.expr, ctx, []);\n const loopManager = createLoopManager({\n anchor,\n trackByFn: compileTrackBy(d.trackBy, d.item, d.index, ctx),\n parentCtx: ctx,\n itemVar: d.item,\n indexVar: d.index,\n itemFactory: itemCtx => {\n const result = d.factory(itemCtx);\n const el = document.createDocumentFragment();\n if (result?.el) el.append(result.el);\n return { el, destroy: result?.destroy ?? (() => {}) };\n },\n });\n\n const stopEffect = effect(() => {\n try {\n const collection = collFn();\n if (!Array.isArray(collection) && import.meta.env?.DEV)\n console.warn('[AOT @for] collection is not an array:', collection);\n loopManager.update(Array.isArray(collection) ? collection : []);\n } catch (err) {\n if (import.meta.env?.DEV) console.error('[AOT @for] update failed:', err);\n loopManager.update([]);\n }\n });\n\n disposers.push(\n blockDisposer(stopEffect, () => loopManager.destroyAll(), anchor)\n );\n}\n\nfunction buildItemContext(\n parentCtx: BindingContext,\n d: ForDesc,\n item: unknown,\n index: number,\n length: number\n): BindingContext {\n return createLoopContext(\n parentCtx,\n createLoopSignals(item, index, length),\n d.item,\n d.index\n );\n}\n\nexport function applySwitch(\n d: SwitchDesc,\n pidMap: Map<string, Element>,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n const containerEl = pidMap.get(d.pid);\n if (!containerEl) return;\n\n let currentNodes: Node[] = [];\n let currentDisposers: (() => void)[] = [];\n\n function clearCurrent() {\n for (let i = currentDisposers.length - 1; i >= 0; i--) {\n try {\n currentDisposers[i]();\n } catch {\n /* ignore */\n }\n }\n currentDisposers = [];\n for (const node of currentNodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n currentNodes = [];\n }\n\n if (isSSRMode()) {\n const switchVal = compileExpression(d.expr, ctx)();\n let matchIndex = -1;\n let defaultIndex = -1;\n for (let i = 0; i < d.cases.length; i++) {\n const c = d.cases[i];\n if (c.val === undefined) {\n if (defaultIndex === -1) defaultIndex = i;\n continue;\n }\n const caseVal = compileExpression(c.val, ctx)();\n if (caseVal === switchVal) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex === -1) matchIndex = defaultIndex;\n if (matchIndex >= 0) {\n try {\n const result = d.cases[matchIndex].factory(ctx);\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) containerEl.appendChild(node);\n if (typeof result.destroy === 'function')\n disposers.push(anchorDisposer(result.destroy, containerEl));\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @switch] Factory error:`, err);\n }\n }\n return;\n }\n\n // Pre-compile switch expression and case values once outside effect\n const switchEval = compileExpression(d.expr, ctx);\n const caseEvals = d.cases.map(c =>\n c.val !== undefined ? compileExpression(c.val, ctx) : null\n );\n\n let previousMatchIndex = -1;\n\n const stopEffect = effect(() => {\n const switchVal = switchEval();\n let matchIndex = -1;\n let defaultIndex = -1;\n for (let i = 0; i < d.cases.length; i++) {\n if (caseEvals[i] === null) {\n if (defaultIndex === -1) defaultIndex = i;\n continue;\n }\n if (caseEvals[i]!() === switchVal) {\n matchIndex = i;\n break;\n }\n }\n if (matchIndex === -1) matchIndex = defaultIndex;\n\n if (matchIndex === previousMatchIndex) return;\n previousMatchIndex = matchIndex;\n\n clearCurrent();\n\n if (matchIndex >= 0) {\n try {\n const { factory } = d.cases[matchIndex];\n const result = createRoot(disposeRoot => {\n currentDisposers.push(disposeRoot);\n return factory(ctx);\n });\n if (result?.el) {\n const nodes =\n result.el instanceof DocumentFragment\n ? Array.from(result.el.childNodes)\n : [result.el];\n for (const node of nodes) containerEl.appendChild(node);\n currentNodes = nodes;\n if (typeof result.destroy === 'function')\n currentDisposers.push(result.destroy);\n else if (import.meta.env?.DEV)\n console.warn(\n '[AOT @switch] branch factory returned no destroy(); effects its nested directives create will outlive the branch'\n );\n }\n } catch (err) {\n if (import.meta.env?.DEV)\n console.error(`[AOT @switch] Factory error:`, err);\n }\n }\n });\n\n disposers.push(blockDisposer(stopEffect, clearCurrent, containerEl));\n}\n"]}
@@ -37,6 +37,13 @@ export declare function buildCommentMap(fragment: DocumentFragment): Map<string,
37
37
  */
38
38
  /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"nearestCtx","stability":"internal","signature":"(el: Node, rootCtx: BindingContext) => BindingContext"} */
39
39
  export declare function nearestCtx(el: Node, rootCtx: BindingContext): BindingContext;
40
+ /**
41
+ * `{ ...a, ...b }` that copies a getter as a getter: a spread reads it once
42
+ * and stores the value, so the template would never see it change. Every
43
+ * read goes through the source, so `this` and a Proxy's `get` trap apply.
44
+ */
45
+ /** @codexApi {"parent":"pithy.runtime.binding-helpers","name":"spreadLive","stability":"internal","signature":"(...sources: (BindingContext | undefined)[]) => BindingContext"} */
46
+ export declare function spreadLive(...sources: (BindingContext | undefined)[]): BindingContext;
40
47
  /**
41
48
  * Merge parent component and async (SSR) contexts into the explicit context.
42
49
  * Single source of truth used by both `html.ts` and `applyBindings.ts`.
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C;;;;GAIG;AACH,0KAA0K;AAC1K,wBAAgB,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAS5E;AAED;;;;GAIG;AACH,8KAA8K;AAC9K,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gBAAgB,GACzB,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAatB;AAED;;;;;;GAMG;AACH,0KAA0K;AAC1K,wBAAgB,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,GAAG,cAAc,CAe5E;AAED;;;;;GAKG;AACH,mKAAmK;AACnK,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAyBrE;AAED;;;;;GAKG;AACH,qMAAqM;AACrM,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,cAAc,GAClB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,KAAK,OAAO,CAgBrC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C;;;;GAIG;AACH,0KAA0K;AAC1K,wBAAgB,WAAW,CAAC,QAAQ,EAA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