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

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 (77) hide show
  1. package/README.md +4 -0
  2. package/dist/compile/binds/bindBoundAttributes.d.ts +4 -0
  3. package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -1
  4. package/dist/compile/binds/bindBoundAttributes.js +63 -3
  5. package/dist/compile/binds/bindBoundAttributes.js.map +1 -1
  6. package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
  7. package/dist/compile/binds/bindClassDirectives.js +3 -2
  8. package/dist/compile/binds/bindClassDirectives.js.map +1 -1
  9. package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
  10. package/dist/compile/binds/bindComponentsTags.js +15 -1
  11. package/dist/compile/binds/bindComponentsTags.js.map +1 -1
  12. package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -1
  13. package/dist/compile/binds/bindDefaultTwoWay.js +2 -1
  14. package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -1
  15. package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -1
  16. package/dist/compile/binds/bindDeferDirectives.js +17 -15
  17. package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
  18. package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
  19. package/dist/compile/binds/bindErrorBoundary.js +6 -4
  20. package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
  21. package/dist/compile/binds/bindEventHandlers.d.ts.map +1 -1
  22. package/dist/compile/binds/bindEventHandlers.js +2 -1
  23. package/dist/compile/binds/bindEventHandlers.js.map +1 -1
  24. package/dist/compile/binds/bindRefDirectives.d.ts.map +1 -1
  25. package/dist/compile/binds/bindRefDirectives.js +2 -1
  26. package/dist/compile/binds/bindRefDirectives.js.map +1 -1
  27. package/dist/compile/binds/bindStyleDirectives.d.ts.map +1 -1
  28. package/dist/compile/binds/bindStyleDirectives.js +2 -1
  29. package/dist/compile/binds/bindStyleDirectives.js.map +1 -1
  30. package/dist/compile/binds/bindTextInterpolations.d.ts +2 -1
  31. package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -1
  32. package/dist/compile/binds/bindTextInterpolations.js +25 -14
  33. package/dist/compile/binds/bindTextInterpolations.js.map +1 -1
  34. package/dist/compile/binds/declaredDirective.d.ts +12 -0
  35. package/dist/compile/binds/declaredDirective.d.ts.map +1 -0
  36. package/dist/compile/binds/declaredDirective.js +42 -0
  37. package/dist/compile/binds/declaredDirective.js.map +1 -0
  38. package/dist/compile/binds/forwardedAttrs.d.ts +4 -2
  39. package/dist/compile/binds/forwardedAttrs.d.ts.map +1 -1
  40. package/dist/compile/binds/forwardedAttrs.js +10 -2
  41. package/dist/compile/binds/forwardedAttrs.js.map +1 -1
  42. package/dist/compile/binds/staleRowProps.d.ts +9 -0
  43. package/dist/compile/binds/staleRowProps.d.ts.map +1 -0
  44. package/dist/compile/binds/staleRowProps.js +86 -0
  45. package/dist/compile/binds/staleRowProps.js.map +1 -0
  46. package/dist/compile/forLoops/loopSignals.d.ts.map +1 -1
  47. package/dist/compile/forLoops/loopSignals.js +15 -1
  48. package/dist/compile/forLoops/loopSignals.js.map +1 -1
  49. package/dist/compile/nodeExpando.d.ts +6 -0
  50. package/dist/compile/nodeExpando.d.ts.map +1 -1
  51. package/dist/compile/nodeExpando.js.map +1 -1
  52. package/dist/compile/pithyTreeToDom.js +1 -0
  53. package/dist/compile/pithyTreeToDom.js.map +1 -1
  54. package/dist/compile/renderChildren.d.ts.map +1 -1
  55. package/dist/compile/renderChildren.js +1 -1
  56. package/dist/compile/renderChildren.js.map +1 -1
  57. package/dist/runtime/applyBindings.d.ts.map +1 -1
  58. package/dist/runtime/applyBindings.js +3 -1
  59. package/dist/runtime/applyBindings.js.map +1 -1
  60. package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
  61. package/dist/runtime/bindings/applyComponent.js +9 -0
  62. package/dist/runtime/bindings/applyComponent.js.map +1 -1
  63. package/dist/runtime/bindings/applyDefer.d.ts.map +1 -1
  64. package/dist/runtime/bindings/applyDefer.js +10 -9
  65. package/dist/runtime/bindings/applyDefer.js.map +1 -1
  66. package/dist/runtime/bindings/applySimple.d.ts +2 -0
  67. package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
  68. package/dist/runtime/bindings/applySimple.js +48 -8
  69. package/dist/runtime/bindings/applySimple.js.map +1 -1
  70. package/dist/runtime/bindings/helpers.d.ts.map +1 -1
  71. package/dist/runtime/bindings/helpers.js +2 -0
  72. package/dist/runtime/bindings/helpers.js.map +1 -1
  73. package/dist/runtime/bindings/index.d.ts +1 -1
  74. package/dist/runtime/bindings/index.d.ts.map +1 -1
  75. package/dist/runtime/bindings/index.js +1 -1
  76. package/dist/runtime/bindings/index.js.map +1 -1
  77. package/package.json +2 -2
@@ -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,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,u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0E;IAC1E,oEAAoE;IACpE,uDAAuD;IACvD,IAAI,YAAY,EAAE,CAAC;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,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
+ {"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,q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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 { watchStaleRowProp } from '../../compile/binds/staleRowProps';\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 const staleWatchers: (() => void)[] = [];\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 if (import.meta.env?.DEV) {\n const value = props[propName];\n staleWatchers.push(() =>\n watchStaleRowProp(\n localCtx,\n d,\n d.tag,\n propName,\n expr,\n value,\n fn,\n disposers\n )\n );\n }\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 if (replaced) for (const watch of staleWatchers) watch();\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":"applyDefer.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyDefer.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AASzD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAkfN"}
1
+ {"version":3,"file":"applyDefer.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyDefer.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAUzD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAkfN"}
@@ -7,6 +7,7 @@ import { isLazyHandle } from '../lazy.js';
7
7
  import { observeVisibilityOnce, DEFAULT_VISIBILITY_MARGIN, } from '@pithyjs/shared';
8
8
  import { nearestCtx } from './helpers.js';
9
9
  import { loadWithTimeout, scheduleByPriority } from '../deferHelpers.js';
10
+ import { setStyleProp } from '../../compile/binds/bindBoundAttributes.js';
10
11
  // ─── Defer directive handler ──────────────────────────────────────────────────
11
12
  /** Unique ID counter for defer elements (AOT path). */
12
13
  let aotDeferIdCounter = 0;
@@ -138,7 +139,7 @@ export function applyDefer(d, element, ctx, disposers) {
138
139
  errorEl = slotError;
139
140
  errorEl.removeAttribute('slot');
140
141
  errorEl.setAttribute('data-defer-error', deferId);
141
- errorEl.style.display = 'none';
142
+ setStyleProp(errorEl, 'display', 'none');
142
143
  }
143
144
  // ─── Insert placeholder into DOM ────────────────────────────────
144
145
  const parent = element.parentNode;
@@ -147,7 +148,7 @@ export function applyDefer(d, element, ctx, disposers) {
147
148
  if (placeholderEl) {
148
149
  // For @defer="when", placeholder starts hidden (only shows during loading)
149
150
  if (trigger === 'when' && placeholderEl instanceof HTMLElement) {
150
- placeholderEl.style.display = 'none';
151
+ setStyleProp(placeholderEl, 'display', 'none');
151
152
  }
152
153
  parent.insertBefore(placeholderEl, element);
153
154
  }
@@ -155,7 +156,7 @@ export function applyDefer(d, element, ctx, disposers) {
155
156
  parent.insertBefore(errorEl, element);
156
157
  }
157
158
  // Hide the original element
158
- element.style.display = 'none';
159
+ setStyleProp(element, 'display', 'none');
159
160
  // ─── Mount lifecycle state ────────────────────────────────────────
160
161
  let mountedDestroy = null;
161
162
  let disposeMountedSetup = null;
@@ -205,7 +206,7 @@ export function applyDefer(d, element, ctx, disposers) {
205
206
  insertedNodes = [];
206
207
  isMounted = false;
207
208
  if (placeholderEl && placeholderEl instanceof HTMLElement) {
208
- placeholderEl.style.display = 'none';
209
+ setStyleProp(placeholderEl, 'display', 'none');
209
210
  }
210
211
  element.setAttribute('data-defer-state', 'pending');
211
212
  }
@@ -225,14 +226,14 @@ export function applyDefer(d, element, ctx, disposers) {
225
226
  setBoundaryError(boundary, error);
226
227
  }
227
228
  else if (errorEl) {
228
- errorEl.style.display = '';
229
+ setStyleProp(errorEl, 'display', null);
229
230
  }
230
231
  element.dispatchEvent(new CustomEvent('error', {
231
232
  detail: {
232
233
  error,
233
234
  retry: () => {
234
235
  if (errorEl)
235
- errorEl.style.display = 'none';
236
+ setStyleProp(errorEl, 'display', 'none');
236
237
  void mountComponent();
237
238
  },
238
239
  },
@@ -251,7 +252,7 @@ export function applyDefer(d, element, ctx, disposers) {
251
252
  element.setAttribute('data-defer-state', 'loading');
252
253
  // Show placeholder during loading
253
254
  if (placeholderEl && placeholderEl instanceof HTMLElement) {
254
- placeholderEl.style.display = '';
255
+ setStyleProp(placeholderEl, 'display', null);
255
256
  }
256
257
  try {
257
258
  const effectiveTimeout = typeof timeout === 'number' && Number.isFinite(timeout) && timeout > 0
@@ -390,7 +391,7 @@ export function applyDefer(d, element, ctx, disposers) {
390
391
  !isMounting &&
391
392
  elementState === 'error') {
392
393
  if (errorEl)
393
- errorEl.style.display = 'none';
394
+ setStyleProp(errorEl, 'display', 'none');
394
395
  mountComponent();
395
396
  }
396
397
  });
@@ -438,7 +439,7 @@ export function applyDefer(d, element, ctx, disposers) {
438
439
  unmountComponent();
439
440
  }
440
441
  if (errorEl)
441
- errorEl.style.display = 'none';
442
+ setStyleProp(errorEl, 'display', 'none');
442
443
  }
443
444
  });
444
445
  disposers.push(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"applyDefer.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyDefer.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,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,oBAAoB,GAGrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAmB,MAAM,SAAS,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,iFAAiF;AAEjF,uDAAuD;AACvD,IAAI,iBAAiB,GAA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ClB,aAAa,EAAE,CAAC;YAChB,IAAI,UAAU,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;gBACxC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAChD,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,sDAAsD;QACtD,MAAM,eAAe,GAAG,iBAAiB,CAAU,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAE5E,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,EAAE;YAC7B,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC;YAErC,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc,EAAE,CAAC;oBACjD,YAAY,EAAE,CAAC;gBACjB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,kBAAkB,EAAE,CAAC;gBACrB,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;oBAC5B,gBAAgB,EAAE,CAAC;gBACrB,CAAC;gBACD,IAAI,OAAO;oBAAE,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YAC9C,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;YAClB,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import { createRoot, effect } from '@pithyjs/signals';\nimport { compileExpression } from '../../compile/compileExpression';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport {\n boundaryForElement,\n setBoundaryError,\n} from '../../compile/binds/bindErrorBoundary';\nimport {\n DEFAULT_LAZY_TIMEOUT,\n type LoadingPriority,\n type DeferTrigger,\n} from '@pithyjs/compiler';\nimport { isLazyHandle, type LazyHandle } from '../lazy';\nimport {\n observeVisibilityOnce,\n DEFAULT_VISIBILITY_MARGIN,\n} from '@pithyjs/shared';\nimport type { DeferDesc, BindingContext } from './types';\nimport { nearestCtx } from './helpers';\nimport { loadWithTimeout, scheduleByPriority } from '../deferHelpers';\n\n// ─── Defer directive handler ──────────────────────────────────────────────────\n\n/** Unique ID counter for defer elements (AOT path). */\nlet aotDeferIdCounter = 0;\n\n/**\n * Apply @defer directive from a binding descriptor.\n *\n * Mirrors the JIT `bindDeferDirectives.ts` logic, adapted for descriptor-driven\n * input. Handles visible/when triggers, priority scheduling, timeout, mount\n * generation guards, placeholder/error slot management, error boundary\n * integration, external retry, and full cleanup.\n */\nexport function applyDefer(\n d: DeferDesc,\n element: HTMLElement,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // SSR: skip observers, effects, and timers — defer has no server-side representation\n if (isSSRMode()) return;\n\n const trigger = d.trigger as DeferTrigger | undefined;\n const loadExpr = d.load;\n if (!trigger) {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @defer] Missing trigger for pid=\"${d.pid}\"`);\n }\n return;\n }\n\n // Validate trigger configuration before any DOM mutations\n if (trigger !== 'visible' && trigger !== 'when') {\n if (import.meta.env?.DEV) {\n console.warn(\n `[AOT @defer] Invalid @defer trigger \"${String(trigger)}\" for pid=\"${d.pid}\" (supported: \"visible\", \"when\")`\n );\n }\n return;\n }\n if (trigger === 'when' && !d.when) {\n if (import.meta.env?.DEV) {\n console.warn(\n `[AOT @defer] @defer=\"when\" requires a @when expression for pid=\"${d.pid}\"`\n );\n }\n return;\n }\n\n if (!loadExpr) {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @defer] Missing @load for pid=\"${d.pid}\"`);\n }\n return;\n }\n\n // Resolve local context (supports @defer inside @for and other subtrees)\n const localCtx = nearestCtx(element, ctx);\n\n // Resolve lazy handle from context\n let lazyHandle: LazyHandle<unknown>;\n try {\n const lazyHandleGetter = compileExpression<LazyHandle<unknown>>(\n loadExpr,\n localCtx,\n undefined\n );\n const resolved = lazyHandleGetter();\n if (!isLazyHandle(resolved)) {\n if (import.meta.env?.DEV) {\n console.warn(\n `[AOT @defer] @load=\"${loadExpr}\" did not resolve to a LazyHandle`\n );\n }\n return;\n }\n lazyHandle = resolved;\n } catch {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @defer] Failed to resolve @load=\"${loadExpr}\"`);\n }\n return;\n }\n\n const priority = d.priority as LoadingPriority | undefined;\n const timeout = d.timeout;\n\n // Resolve or generate stable defer ID (preserve existing SSR marker when present)\n const existingDeferId = element.getAttribute('data-defer-id');\n const deferId = existingDeferId ?? `defer-${++aotDeferIdCounter}`;\n\n // Set initial state\n if (!existingDeferId) element.setAttribute('data-defer-id', deferId);\n element.setAttribute('data-defer-state', 'pending');\n\n // ─── Extract placeholder and error slots from element children ────\n let placeholderEl: HTMLElement | Text | null = null;\n let placeholderDestroy: (() => void) | null = null;\n\n // Try slot=\"placeholder\" children first\n const slotPlaceholder = element.querySelector('[slot=\"placeholder\"]');\n if (slotPlaceholder) {\n placeholderEl = slotPlaceholder as HTMLElement;\n placeholderEl.removeAttribute('slot');\n placeholderEl.setAttribute('data-defer-placeholder', deferId);\n } else if (d.placeholder !== undefined) {\n // Descriptor placeholder field — string literal or component reference\n const pExpr = d.placeholder;\n if (\n (pExpr.startsWith(\"'\") && pExpr.endsWith(\"'\")) ||\n (pExpr.startsWith('\"') && pExpr.endsWith('\"'))\n ) {\n const text = pExpr.slice(1, -1);\n // Wrap in <span> so placeholder can be hidden/shown via style.display\n const span = document.createElement('span');\n span.setAttribute('data-defer-placeholder', deferId);\n span.textContent = text;\n placeholderEl = span;\n } else {\n try {\n const placeholderGetter = compileExpression<unknown>(\n pExpr,\n localCtx,\n null\n );\n const placeholder = placeholderGetter();\n if (typeof placeholder === 'function') {\n const result = (placeholder as () => unknown)();\n if (result && typeof result === 'object' && 'el' in result) {\n const { el: compEl, destroy } = result as {\n el: HTMLElement | DocumentFragment;\n destroy?: () => void;\n };\n if (compEl instanceof DocumentFragment) {\n const wrapper = document.createElement('span');\n wrapper.setAttribute('data-defer-placeholder', deferId);\n while (compEl.firstChild) wrapper.appendChild(compEl.firstChild);\n placeholderEl = wrapper;\n } else {\n placeholderEl = compEl as HTMLElement;\n }\n if (typeof destroy === 'function') placeholderDestroy = destroy;\n }\n }\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @defer] Error rendering placeholder:`, err);\n }\n }\n }\n }\n\n // Extract slot=\"error\" element\n const slotError = element.querySelector('[slot=\"error\"]');\n let errorEl: HTMLElement | null = null;\n if (slotError) {\n errorEl = slotError as HTMLElement;\n errorEl.removeAttribute('slot');\n errorEl.setAttribute('data-defer-error', deferId);\n errorEl.style.display = 'none';\n }\n\n // ─── Insert placeholder into DOM ────────────────────────────────\n const parent = element.parentNode;\n if (!parent) return;\n\n if (placeholderEl) {\n // For @defer=\"when\", placeholder starts hidden (only shows during loading)\n if (trigger === 'when' && placeholderEl instanceof HTMLElement) {\n placeholderEl.style.display = 'none';\n }\n parent.insertBefore(placeholderEl, element);\n }\n\n if (errorEl) {\n parent.insertBefore(errorEl, element);\n }\n\n // Hide the original element\n element.style.display = 'none';\n\n // ─── Mount lifecycle state ────────────────────────────────────────\n let mountedDestroy: (() => void) | null = null;\n let disposeMountedSetup: (() => void) | null = null;\n let isMounted = false;\n let isMounting = false;\n let mountGeneration = 0;\n let insertedNodes: Node[] = [];\n\n /**\n * Run and clear the mounted instance's teardown. Claimed before DOM\n * insertion, so a throw between the two still reaches it.\n */\n function releaseMountedComponent(): void {\n if (!mountedDestroy && !disposeMountedSetup) return;\n const destroyMounted = mountedDestroy;\n const disposeSetup = disposeMountedSetup;\n mountedDestroy = null;\n disposeMountedSetup = null;\n try {\n destroyMounted?.();\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn('[AOT @defer] Error in component destroy():', err);\n }\n } finally {\n try {\n disposeSetup?.();\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn('[AOT @defer] Error in setup cleanup:', err);\n }\n }\n }\n }\n\n /** Remove mounted component nodes from DOM. */\n function unmountComponent(): void {\n mountGeneration++;\n isMounting = false;\n\n releaseMountedComponent();\n\n for (const node of insertedNodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n insertedNodes = [];\n isMounted = false;\n\n if (placeholderEl && placeholderEl instanceof HTMLElement) {\n placeholderEl.style.display = 'none';\n }\n\n element.setAttribute('data-defer-state', 'pending');\n }\n\n /** Surface a mount error: update state, clean up placeholder, propagate to boundary/slot, dispatch event. */\n function handleMountError(error: Error): void {\n element.setAttribute('data-defer-state', 'error');\n\n if (placeholderEl && placeholderEl.parentNode) {\n placeholderEl.parentNode.removeChild(placeholderEl);\n placeholderEl = null;\n }\n if (placeholderDestroy) {\n placeholderDestroy();\n placeholderDestroy = null;\n }\n\n const boundary = boundaryForElement(element);\n if (boundary) {\n setBoundaryError(boundary, error);\n } else if (errorEl) {\n errorEl.style.display = '';\n }\n\n element.dispatchEvent(\n new CustomEvent('error', {\n detail: {\n error,\n retry: () => {\n if (errorEl) errorEl.style.display = 'none';\n void mountComponent();\n },\n },\n bubbles: true,\n })\n );\n\n if (import.meta.env?.DEV) {\n console.error(`[AOT @defer] Failed to load lazy component:`, error);\n }\n }\n\n /** Mount the lazy component with timeout support. */\n async function mountComponent(): Promise<void> {\n if (isMounted || isMounting) return;\n\n isMounting = true;\n const thisGeneration = mountGeneration;\n\n element.setAttribute('data-defer-state', 'loading');\n\n // Show placeholder during loading\n if (placeholderEl && placeholderEl instanceof HTMLElement) {\n placeholderEl.style.display = '';\n }\n\n try {\n const effectiveTimeout =\n typeof timeout === 'number' && Number.isFinite(timeout) && timeout > 0\n ? timeout\n : DEFAULT_LAZY_TIMEOUT;\n const module = await loadWithTimeout(lazyHandle, effectiveTimeout);\n\n // Generation check — abort if unmounted during async gap\n if (thisGeneration !== mountGeneration) {\n isMounting = false;\n return;\n }\n\n // Fresh parent lookup after async gap\n const freshParent = element.parentNode;\n if (!freshParent) {\n isMounting = false;\n return;\n }\n\n // Extract component from module (default export or module itself)\n const Component = (module as { default?: unknown }).default || module;\n\n if (typeof Component === 'function') {\n let disposeSetup: (() => void) | undefined;\n const result = createRoot(disposeRoot => {\n disposeSetup = disposeRoot;\n return (Component as () => unknown)();\n });\n\n if (result && typeof result === 'object' && 'el' in result) {\n const { el: renderedEl, destroy } = result as {\n el: HTMLElement | DocumentFragment;\n destroy?: () => void;\n };\n\n mountedDestroy = destroy ?? null;\n disposeMountedSetup = disposeSetup ?? null;\n\n // Insert component content before original element\n if (renderedEl instanceof DocumentFragment) {\n const nodes = Array.from(renderedEl.childNodes);\n insertedNodes = nodes;\n freshParent.insertBefore(renderedEl, element);\n } else {\n insertedNodes = [renderedEl];\n freshParent.insertBefore(renderedEl, element);\n }\n\n isMounted = true;\n isMounting = false;\n\n // Mark loaded only after successful mount\n element.setAttribute('data-defer-state', 'loaded');\n\n // Remove placeholder and clean up its component (if any)\n if (placeholderEl && placeholderEl.parentNode) {\n placeholderEl.parentNode.removeChild(placeholderEl);\n placeholderEl = null;\n }\n if (placeholderDestroy) {\n placeholderDestroy();\n placeholderDestroy = null;\n }\n\n // Remove error element (no longer needed)\n if (errorEl && errorEl.parentNode) {\n errorEl.parentNode.removeChild(errorEl);\n errorEl = null;\n }\n\n // Dispatch loaded event\n element.dispatchEvent(\n new CustomEvent('loaded', {\n detail: { ttiMs: Date.now(), chunkId: lazyHandle.key },\n bubbles: true,\n })\n );\n } else {\n disposeSetup?.();\n isMounting = false;\n handleMountError(\n new Error('[AOT @defer] Component did not return { el }.')\n );\n }\n } else {\n isMounting = false;\n handleMountError(\n new Error('[AOT @defer] Module did not export a component function.')\n );\n }\n } catch (err) {\n isMounting = false;\n if (!isMounted) releaseMountedComponent();\n\n // Generation check — abort if unmounted during async gap\n if (thisGeneration !== mountGeneration) return;\n\n handleMountError(err instanceof Error ? err : new Error(String(err)));\n }\n }\n\n // ─── Scheduling and cancellation ──────────────────────────────────\n let idleCallbackId: number | undefined;\n let mountScheduled = false;\n\n /** Trigger mount with priority scheduling. */\n function triggerMount(): void {\n mountScheduled = true;\n const expectedGen = mountGeneration;\n const result = scheduleByPriority(() => {\n mountScheduled = false;\n if (expectedGen !== mountGeneration) return;\n mountComponent();\n }, priority);\n\n if (typeof result === 'number') {\n idleCallbackId = result;\n }\n }\n\n /** Cancel any pending scheduled mount. */\n function cancelPendingMount(): void {\n if (mountScheduled) {\n mountScheduled = false;\n mountGeneration++;\n if (\n idleCallbackId !== undefined &&\n typeof cancelIdleCallback !== 'undefined'\n ) {\n cancelIdleCallback(idleCallbackId);\n idleCallbackId = undefined;\n }\n }\n }\n\n /** Full cleanup. */\n function cleanup(): void {\n cancelPendingMount();\n mountGeneration++;\n\n if (\n idleCallbackId !== undefined &&\n typeof cancelIdleCallback !== 'undefined'\n ) {\n cancelIdleCallback(idleCallbackId);\n idleCallbackId = undefined;\n }\n\n unmountComponent();\n if (placeholderDestroy) {\n placeholderDestroy();\n placeholderDestroy = null;\n }\n lazyHandle.cancel();\n }\n\n // ─── External retry: watch lazyHandle.state ───────────────────────\n const stopStateEffect = effect(() => {\n const handleState = lazyHandle.state();\n const elementState = element.getAttribute('data-defer-state');\n\n if (\n handleState === 'loaded' &&\n !isMounted &&\n !isMounting &&\n elementState === 'error'\n ) {\n if (errorEl) errorEl.style.display = 'none';\n mountComponent();\n }\n });\n\n disposers.push(stopStateEffect);\n\n // ─── Trigger setup ────────────────────────────────────────────────\n if (trigger === 'visible') {\n // Visibility trigger: IntersectionObserver on placeholder or sentinel\n let observeTarget: Element;\n let sentinelEl: HTMLElement | null = null;\n\n if (placeholderEl && placeholderEl instanceof HTMLElement) {\n observeTarget = placeholderEl;\n } else {\n sentinelEl = document.createElement('span');\n sentinelEl.style.display = 'inline-block';\n sentinelEl.style.width = '1px';\n sentinelEl.style.height = '1px';\n parent.insertBefore(sentinelEl, element);\n observeTarget = sentinelEl;\n }\n\n const stopObserving = observeVisibilityOnce(observeTarget, triggerMount, {\n rootMargin: DEFAULT_VISIBILITY_MARGIN,\n });\n\n disposers.push(() => {\n stopObserving();\n if (sentinelEl && sentinelEl.parentNode) {\n sentinelEl.parentNode.removeChild(sentinelEl);\n }\n cleanup();\n });\n } else if (trigger === 'when' && d.when) {\n // Boolean trigger: reactive effect watching condition\n const conditionGetter = compileExpression<boolean>(d.when, localCtx, false);\n\n const stopEffect = effect(() => {\n const shouldShow = conditionGetter();\n\n if (shouldShow) {\n if (!isMounted && !isMounting && !mountScheduled) {\n triggerMount();\n }\n } else {\n cancelPendingMount();\n if (isMounted || isMounting) {\n unmountComponent();\n }\n if (errorEl) errorEl.style.display = 'none';\n }\n });\n\n disposers.push(() => {\n stopEffect();\n cleanup();\n });\n }\n}\n"]}
1
+ {"version":3,"file":"applyDefer.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyDefer.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,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,oBAAoB,GAGrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAmB,MAAM,SAAS,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,iFAAiF;AAEjF,uDAAuD;AACvD,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAE1B;;;;;;;GAOG;AACH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EAAE;YAClB,aAAa,EAAE,CAAC;YAChB,IAAI,UAAU,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;gBACxC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;YAChD,CAAC;YACD,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,sDAAsD;QACtD,MAAM,eAAe,GAAG,iBAAiB,CAAU,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QAE5E,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,EAAE;YAC7B,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC;YAErC,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,CAAC,SAAS,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc,EAAE,CAAC;oBACjD,YAAY,EAAE,CAAC;gBACjB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,kBAAkB,EAAE,CAAC;gBACrB,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;oBAC5B,gBAAgB,EAAE,CAAC;gBACrB,CAAC;gBACD,IAAI,OAAO;oBAAE,YAAY,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;YACxD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;YAClB,UAAU,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import { createRoot, effect } from '@pithyjs/signals';\nimport { compileExpression } from '../../compile/compileExpression';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport {\n boundaryForElement,\n setBoundaryError,\n} from '../../compile/binds/bindErrorBoundary';\nimport {\n DEFAULT_LAZY_TIMEOUT,\n type LoadingPriority,\n type DeferTrigger,\n} from '@pithyjs/compiler';\nimport { isLazyHandle, type LazyHandle } from '../lazy';\nimport {\n observeVisibilityOnce,\n DEFAULT_VISIBILITY_MARGIN,\n} from '@pithyjs/shared';\nimport type { DeferDesc, BindingContext } from './types';\nimport { nearestCtx } from './helpers';\nimport { loadWithTimeout, scheduleByPriority } from '../deferHelpers';\nimport { setStyleProp } from '../../compile/binds/bindBoundAttributes';\n\n// ─── Defer directive handler ──────────────────────────────────────────────────\n\n/** Unique ID counter for defer elements (AOT path). */\nlet aotDeferIdCounter = 0;\n\n/**\n * Apply @defer directive from a binding descriptor.\n *\n * Mirrors the JIT `bindDeferDirectives.ts` logic, adapted for descriptor-driven\n * input. Handles visible/when triggers, priority scheduling, timeout, mount\n * generation guards, placeholder/error slot management, error boundary\n * integration, external retry, and full cleanup.\n */\nexport function applyDefer(\n d: DeferDesc,\n element: HTMLElement,\n ctx: BindingContext,\n disposers: (() => void)[]\n): void {\n // SSR: skip observers, effects, and timers — defer has no server-side representation\n if (isSSRMode()) return;\n\n const trigger = d.trigger as DeferTrigger | undefined;\n const loadExpr = d.load;\n if (!trigger) {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @defer] Missing trigger for pid=\"${d.pid}\"`);\n }\n return;\n }\n\n // Validate trigger configuration before any DOM mutations\n if (trigger !== 'visible' && trigger !== 'when') {\n if (import.meta.env?.DEV) {\n console.warn(\n `[AOT @defer] Invalid @defer trigger \"${String(trigger)}\" for pid=\"${d.pid}\" (supported: \"visible\", \"when\")`\n );\n }\n return;\n }\n if (trigger === 'when' && !d.when) {\n if (import.meta.env?.DEV) {\n console.warn(\n `[AOT @defer] @defer=\"when\" requires a @when expression for pid=\"${d.pid}\"`\n );\n }\n return;\n }\n\n if (!loadExpr) {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @defer] Missing @load for pid=\"${d.pid}\"`);\n }\n return;\n }\n\n // Resolve local context (supports @defer inside @for and other subtrees)\n const localCtx = nearestCtx(element, ctx);\n\n // Resolve lazy handle from context\n let lazyHandle: LazyHandle<unknown>;\n try {\n const lazyHandleGetter = compileExpression<LazyHandle<unknown>>(\n loadExpr,\n localCtx,\n undefined\n );\n const resolved = lazyHandleGetter();\n if (!isLazyHandle(resolved)) {\n if (import.meta.env?.DEV) {\n console.warn(\n `[AOT @defer] @load=\"${loadExpr}\" did not resolve to a LazyHandle`\n );\n }\n return;\n }\n lazyHandle = resolved;\n } catch {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @defer] Failed to resolve @load=\"${loadExpr}\"`);\n }\n return;\n }\n\n const priority = d.priority as LoadingPriority | undefined;\n const timeout = d.timeout;\n\n // Resolve or generate stable defer ID (preserve existing SSR marker when present)\n const existingDeferId = element.getAttribute('data-defer-id');\n const deferId = existingDeferId ?? `defer-${++aotDeferIdCounter}`;\n\n // Set initial state\n if (!existingDeferId) element.setAttribute('data-defer-id', deferId);\n element.setAttribute('data-defer-state', 'pending');\n\n // ─── Extract placeholder and error slots from element children ────\n let placeholderEl: HTMLElement | Text | null = null;\n let placeholderDestroy: (() => void) | null = null;\n\n // Try slot=\"placeholder\" children first\n const slotPlaceholder = element.querySelector('[slot=\"placeholder\"]');\n if (slotPlaceholder) {\n placeholderEl = slotPlaceholder as HTMLElement;\n placeholderEl.removeAttribute('slot');\n placeholderEl.setAttribute('data-defer-placeholder', deferId);\n } else if (d.placeholder !== undefined) {\n // Descriptor placeholder field — string literal or component reference\n const pExpr = d.placeholder;\n if (\n (pExpr.startsWith(\"'\") && pExpr.endsWith(\"'\")) ||\n (pExpr.startsWith('\"') && pExpr.endsWith('\"'))\n ) {\n const text = pExpr.slice(1, -1);\n // Wrap in <span> so placeholder can be hidden/shown via style.display\n const span = document.createElement('span');\n span.setAttribute('data-defer-placeholder', deferId);\n span.textContent = text;\n placeholderEl = span;\n } else {\n try {\n const placeholderGetter = compileExpression<unknown>(\n pExpr,\n localCtx,\n null\n );\n const placeholder = placeholderGetter();\n if (typeof placeholder === 'function') {\n const result = (placeholder as () => unknown)();\n if (result && typeof result === 'object' && 'el' in result) {\n const { el: compEl, destroy } = result as {\n el: HTMLElement | DocumentFragment;\n destroy?: () => void;\n };\n if (compEl instanceof DocumentFragment) {\n const wrapper = document.createElement('span');\n wrapper.setAttribute('data-defer-placeholder', deferId);\n while (compEl.firstChild) wrapper.appendChild(compEl.firstChild);\n placeholderEl = wrapper;\n } else {\n placeholderEl = compEl as HTMLElement;\n }\n if (typeof destroy === 'function') placeholderDestroy = destroy;\n }\n }\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn(`[AOT @defer] Error rendering placeholder:`, err);\n }\n }\n }\n }\n\n // Extract slot=\"error\" element\n const slotError = element.querySelector('[slot=\"error\"]');\n let errorEl: HTMLElement | null = null;\n if (slotError) {\n errorEl = slotError as HTMLElement;\n errorEl.removeAttribute('slot');\n errorEl.setAttribute('data-defer-error', deferId);\n setStyleProp(errorEl, 'display', 'none');\n }\n\n // ─── Insert placeholder into DOM ────────────────────────────────\n const parent = element.parentNode;\n if (!parent) return;\n\n if (placeholderEl) {\n // For @defer=\"when\", placeholder starts hidden (only shows during loading)\n if (trigger === 'when' && placeholderEl instanceof HTMLElement) {\n setStyleProp(placeholderEl, 'display', 'none');\n }\n parent.insertBefore(placeholderEl, element);\n }\n\n if (errorEl) {\n parent.insertBefore(errorEl, element);\n }\n\n // Hide the original element\n setStyleProp(element, 'display', 'none');\n\n // ─── Mount lifecycle state ────────────────────────────────────────\n let mountedDestroy: (() => void) | null = null;\n let disposeMountedSetup: (() => void) | null = null;\n let isMounted = false;\n let isMounting = false;\n let mountGeneration = 0;\n let insertedNodes: Node[] = [];\n\n /**\n * Run and clear the mounted instance's teardown. Claimed before DOM\n * insertion, so a throw between the two still reaches it.\n */\n function releaseMountedComponent(): void {\n if (!mountedDestroy && !disposeMountedSetup) return;\n const destroyMounted = mountedDestroy;\n const disposeSetup = disposeMountedSetup;\n mountedDestroy = null;\n disposeMountedSetup = null;\n try {\n destroyMounted?.();\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn('[AOT @defer] Error in component destroy():', err);\n }\n } finally {\n try {\n disposeSetup?.();\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn('[AOT @defer] Error in setup cleanup:', err);\n }\n }\n }\n }\n\n /** Remove mounted component nodes from DOM. */\n function unmountComponent(): void {\n mountGeneration++;\n isMounting = false;\n\n releaseMountedComponent();\n\n for (const node of insertedNodes) {\n if (node.parentNode) node.parentNode.removeChild(node);\n }\n insertedNodes = [];\n isMounted = false;\n\n if (placeholderEl && placeholderEl instanceof HTMLElement) {\n setStyleProp(placeholderEl, 'display', 'none');\n }\n\n element.setAttribute('data-defer-state', 'pending');\n }\n\n /** Surface a mount error: update state, clean up placeholder, propagate to boundary/slot, dispatch event. */\n function handleMountError(error: Error): void {\n element.setAttribute('data-defer-state', 'error');\n\n if (placeholderEl && placeholderEl.parentNode) {\n placeholderEl.parentNode.removeChild(placeholderEl);\n placeholderEl = null;\n }\n if (placeholderDestroy) {\n placeholderDestroy();\n placeholderDestroy = null;\n }\n\n const boundary = boundaryForElement(element);\n if (boundary) {\n setBoundaryError(boundary, error);\n } else if (errorEl) {\n setStyleProp(errorEl, 'display', null);\n }\n\n element.dispatchEvent(\n new CustomEvent('error', {\n detail: {\n error,\n retry: () => {\n if (errorEl) setStyleProp(errorEl, 'display', 'none');\n void mountComponent();\n },\n },\n bubbles: true,\n })\n );\n\n if (import.meta.env?.DEV) {\n console.error(`[AOT @defer] Failed to load lazy component:`, error);\n }\n }\n\n /** Mount the lazy component with timeout support. */\n async function mountComponent(): Promise<void> {\n if (isMounted || isMounting) return;\n\n isMounting = true;\n const thisGeneration = mountGeneration;\n\n element.setAttribute('data-defer-state', 'loading');\n\n // Show placeholder during loading\n if (placeholderEl && placeholderEl instanceof HTMLElement) {\n setStyleProp(placeholderEl, 'display', null);\n }\n\n try {\n const effectiveTimeout =\n typeof timeout === 'number' && Number.isFinite(timeout) && timeout > 0\n ? timeout\n : DEFAULT_LAZY_TIMEOUT;\n const module = await loadWithTimeout(lazyHandle, effectiveTimeout);\n\n // Generation check — abort if unmounted during async gap\n if (thisGeneration !== mountGeneration) {\n isMounting = false;\n return;\n }\n\n // Fresh parent lookup after async gap\n const freshParent = element.parentNode;\n if (!freshParent) {\n isMounting = false;\n return;\n }\n\n // Extract component from module (default export or module itself)\n const Component = (module as { default?: unknown }).default || module;\n\n if (typeof Component === 'function') {\n let disposeSetup: (() => void) | undefined;\n const result = createRoot(disposeRoot => {\n disposeSetup = disposeRoot;\n return (Component as () => unknown)();\n });\n\n if (result && typeof result === 'object' && 'el' in result) {\n const { el: renderedEl, destroy } = result as {\n el: HTMLElement | DocumentFragment;\n destroy?: () => void;\n };\n\n mountedDestroy = destroy ?? null;\n disposeMountedSetup = disposeSetup ?? null;\n\n // Insert component content before original element\n if (renderedEl instanceof DocumentFragment) {\n const nodes = Array.from(renderedEl.childNodes);\n insertedNodes = nodes;\n freshParent.insertBefore(renderedEl, element);\n } else {\n insertedNodes = [renderedEl];\n freshParent.insertBefore(renderedEl, element);\n }\n\n isMounted = true;\n isMounting = false;\n\n // Mark loaded only after successful mount\n element.setAttribute('data-defer-state', 'loaded');\n\n // Remove placeholder and clean up its component (if any)\n if (placeholderEl && placeholderEl.parentNode) {\n placeholderEl.parentNode.removeChild(placeholderEl);\n placeholderEl = null;\n }\n if (placeholderDestroy) {\n placeholderDestroy();\n placeholderDestroy = null;\n }\n\n // Remove error element (no longer needed)\n if (errorEl && errorEl.parentNode) {\n errorEl.parentNode.removeChild(errorEl);\n errorEl = null;\n }\n\n // Dispatch loaded event\n element.dispatchEvent(\n new CustomEvent('loaded', {\n detail: { ttiMs: Date.now(), chunkId: lazyHandle.key },\n bubbles: true,\n })\n );\n } else {\n disposeSetup?.();\n isMounting = false;\n handleMountError(\n new Error('[AOT @defer] Component did not return { el }.')\n );\n }\n } else {\n isMounting = false;\n handleMountError(\n new Error('[AOT @defer] Module did not export a component function.')\n );\n }\n } catch (err) {\n isMounting = false;\n if (!isMounted) releaseMountedComponent();\n\n // Generation check — abort if unmounted during async gap\n if (thisGeneration !== mountGeneration) return;\n\n handleMountError(err instanceof Error ? err : new Error(String(err)));\n }\n }\n\n // ─── Scheduling and cancellation ──────────────────────────────────\n let idleCallbackId: number | undefined;\n let mountScheduled = false;\n\n /** Trigger mount with priority scheduling. */\n function triggerMount(): void {\n mountScheduled = true;\n const expectedGen = mountGeneration;\n const result = scheduleByPriority(() => {\n mountScheduled = false;\n if (expectedGen !== mountGeneration) return;\n mountComponent();\n }, priority);\n\n if (typeof result === 'number') {\n idleCallbackId = result;\n }\n }\n\n /** Cancel any pending scheduled mount. */\n function cancelPendingMount(): void {\n if (mountScheduled) {\n mountScheduled = false;\n mountGeneration++;\n if (\n idleCallbackId !== undefined &&\n typeof cancelIdleCallback !== 'undefined'\n ) {\n cancelIdleCallback(idleCallbackId);\n idleCallbackId = undefined;\n }\n }\n }\n\n /** Full cleanup. */\n function cleanup(): void {\n cancelPendingMount();\n mountGeneration++;\n\n if (\n idleCallbackId !== undefined &&\n typeof cancelIdleCallback !== 'undefined'\n ) {\n cancelIdleCallback(idleCallbackId);\n idleCallbackId = undefined;\n }\n\n unmountComponent();\n if (placeholderDestroy) {\n placeholderDestroy();\n placeholderDestroy = null;\n }\n lazyHandle.cancel();\n }\n\n // ─── External retry: watch lazyHandle.state ───────────────────────\n const stopStateEffect = effect(() => {\n const handleState = lazyHandle.state();\n const elementState = element.getAttribute('data-defer-state');\n\n if (\n handleState === 'loaded' &&\n !isMounted &&\n !isMounting &&\n elementState === 'error'\n ) {\n if (errorEl) setStyleProp(errorEl, 'display', 'none');\n mountComponent();\n }\n });\n\n disposers.push(stopStateEffect);\n\n // ─── Trigger setup ────────────────────────────────────────────────\n if (trigger === 'visible') {\n // Visibility trigger: IntersectionObserver on placeholder or sentinel\n let observeTarget: Element;\n let sentinelEl: HTMLElement | null = null;\n\n if (placeholderEl && placeholderEl instanceof HTMLElement) {\n observeTarget = placeholderEl;\n } else {\n sentinelEl = document.createElement('span');\n sentinelEl.style.display = 'inline-block';\n sentinelEl.style.width = '1px';\n sentinelEl.style.height = '1px';\n parent.insertBefore(sentinelEl, element);\n observeTarget = sentinelEl;\n }\n\n const stopObserving = observeVisibilityOnce(observeTarget, triggerMount, {\n rootMargin: DEFAULT_VISIBILITY_MARGIN,\n });\n\n disposers.push(() => {\n stopObserving();\n if (sentinelEl && sentinelEl.parentNode) {\n sentinelEl.parentNode.removeChild(sentinelEl);\n }\n cleanup();\n });\n } else if (trigger === 'when' && d.when) {\n // Boolean trigger: reactive effect watching condition\n const conditionGetter = compileExpression<boolean>(d.when, localCtx, false);\n\n const stopEffect = effect(() => {\n const shouldShow = conditionGetter();\n\n if (shouldShow) {\n if (!isMounted && !isMounting && !mountScheduled) {\n triggerMount();\n }\n } else {\n cancelPendingMount();\n if (isMounted || isMounting) {\n unmountComponent();\n }\n if (errorEl) setStyleProp(errorEl, 'display', 'none');\n }\n });\n\n disposers.push(() => {\n stopEffect();\n cleanup();\n });\n }\n}\n"]}
@@ -3,6 +3,8 @@ export declare function applyRef(d: RefDesc, el: Element, ctx: BindingContext, d
3
3
  export declare function applyError(d: ErrorDesc, el: Element, ctx: BindingContext, disposers: (() => void)[]): void;
4
4
  export declare function applyProjection(d: ProjDesc, commentMap: Map<string, Comment>, ctx: BindingContext, disposers: (() => void)[]): void;
5
5
  export declare function applyBind(d: BindDesc, el: Element, ctx: BindingContext, disposers: (() => void)[]): void;
6
+ /** Record the skeleton's own `{{ }}` text, before components or bindings add any. */
7
+ export declare function markSkeletonText(fragment: DocumentFragment): void;
6
8
  export declare function applyInterpolation(d: InterpDesc, el: Element | DocumentFragment, ctx: BindingContext, disposers: (() => void)[]): void;
7
9
  export declare function applyEvent(d: EventDesc, el: Element, ctx: BindingContext, disposers: (() => void)[]): void;
8
10
  export declare function applyClass(d: ClassDesc, el: Element, ctx: BindingContext, disposers: (() => void)[]): void;
@@ -1 +1 @@
1
- {"version":3,"file":"applySimple.d.ts","sourceRoot":"","sources":["../../../src/runtime/bind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S,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":"AAmBA,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,MA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,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CA8BN"}
@@ -1,6 +1,6 @@
1
1
  import { effect, isSignal } from '@pithyjs/signals';
2
2
  import { compileExpression } from '../../compile/compileExpression.js';
3
- import { rejectsScriptSink } from '../../compile/binds/bindBoundAttributes.js';
3
+ import { rejectsScriptSink, setStyleProp, styleWriter, } from '../../compile/binds/bindBoundAttributes.js';
4
4
  import { toTextValue } from '../../compile/textValue.js';
5
5
  import { isSSRMode } from '../../compile/ssrMode.js';
6
6
  import { registerBoundary, boundaryForElement, setBoundaryError, withSlotBoundary, } from '../../compile/binds/bindErrorBoundary.js';
@@ -144,6 +144,41 @@ function extractBindableValue(el, prop) {
144
144
  }
145
145
  return el[prop];
146
146
  }
147
+ /**
148
+ * Matches the skeleton's text exactly: the descriptor's own text and expressions.
149
+ * A value can hold `{{` too, and text already bound can equal a later marker.
150
+ */
151
+ function holdsInterpolation(node, parts) {
152
+ if (!skeletonText.has(node))
153
+ return false;
154
+ const text = node.nodeValue ?? '';
155
+ let at = 0;
156
+ for (const part of parts) {
157
+ if ('s' in part) {
158
+ if (!text.startsWith(part.s, at))
159
+ return false;
160
+ at += part.s.length;
161
+ continue;
162
+ }
163
+ if (!text.startsWith('{{', at))
164
+ return false;
165
+ const end = text.indexOf('}}', at);
166
+ if (end === -1 || text.slice(at + 2, end).trim() !== part.e)
167
+ return false;
168
+ at = end + 2;
169
+ }
170
+ return at === text.length;
171
+ }
172
+ const skeletonText = new WeakSet();
173
+ /** Record the skeleton's own `{{ }}` text, before components or bindings add any. */
174
+ export function markSkeletonText(fragment) {
175
+ const walker = document.createTreeWalker(fragment, NodeFilter.SHOW_TEXT);
176
+ let node;
177
+ while ((node = walker.nextNode())) {
178
+ if (node.nodeValue?.includes('{{'))
179
+ skeletonText.add(node);
180
+ }
181
+ }
147
182
  export function applyInterpolation(d, el, ctx, disposers) {
148
183
  // Find text nodes within el that contain {{ }} markers
149
184
  const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);
@@ -151,8 +186,7 @@ export function applyInterpolation(d, el, ctx, disposers) {
151
186
  const targets = [];
152
187
  const rootLevel = d.pid === '';
153
188
  while ((textNode = walker.nextNode())) {
154
- const val = textNode.nodeValue ?? '';
155
- if (!val.includes('{{'))
189
+ if (!holdsInterpolation(textNode, d.parts))
156
190
  continue;
157
191
  if (rootLevel && textNode.parentElement?.closest('[data-pid]'))
158
192
  continue;
@@ -346,16 +380,16 @@ export function applyStyle(d, el, ctx, disposers) {
346
380
  try {
347
381
  const value = evaluate();
348
382
  if (value == null || value === false) {
349
- style.removeProperty(cssProp);
383
+ setStyleProp(el, cssProp, null);
350
384
  return;
351
385
  }
352
386
  const text = String(value);
353
387
  const important = /\s*!important\s*$/i.exec(text);
354
388
  if (important) {
355
- style.setProperty(cssProp, text.slice(0, important.index), 'important');
389
+ setStyleProp(el, cssProp, text.slice(0, important.index), 'important');
356
390
  }
357
391
  else {
358
- style.setProperty(cssProp, text);
392
+ setStyleProp(el, cssProp, text);
359
393
  }
360
394
  }
361
395
  catch {
@@ -373,10 +407,14 @@ export function applyBound(d, el, ctx, disposers) {
373
407
  // Compile once outside effect via compileExpression (consistent with applyClass/applyStyle).
374
408
  try {
375
409
  const evaluate = compileExpression(d.expr, localCtx);
410
+ const writeStyle = d.attr === 'style' ? styleWriter(el) : null;
376
411
  const stop = effect(() => {
377
412
  try {
378
413
  const value = evaluate();
379
- if (typeof value === 'boolean') {
414
+ if (writeStyle && typeof value === 'boolean') {
415
+ writeStyle('');
416
+ }
417
+ else if (typeof value === 'boolean') {
380
418
  if (value)
381
419
  el.setAttribute(d.attr, '');
382
420
  else
@@ -384,7 +422,9 @@ export function applyBound(d, el, ctx, disposers) {
384
422
  }
385
423
  else {
386
424
  const text = String(value ?? '');
387
- if (rejectsScriptSink(el, d.attr, text))
425
+ if (writeStyle)
426
+ writeStyle(text);
427
+ else if (rejectsScriptSink(el, d.attr, text))
388
428
  el.removeAttribute(d.attr);
389
429
  else
390
430
  el.setAttribute(d.attr, text);