@pithyjs/core 0.1.0-beta.23 → 0.1.0-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
- package/dist/compile/binds/bindComponentsTags.js +21 -10
- package/dist/compile/binds/bindComponentsTags.js.map +1 -1
- package/dist/compile/binds/bindDeferDirectives.d.ts +3 -3
- package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindDeferDirectives.js +7 -5
- package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.d.ts +6 -2
- package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.js +86 -20
- package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
- package/dist/compile/contentProjection.d.ts +14 -2
- package/dist/compile/contentProjection.d.ts.map +1 -1
- package/dist/compile/contentProjection.js +42 -4
- package/dist/compile/contentProjection.js.map +1 -1
- package/dist/compile/nodeExpando.d.ts +1 -0
- package/dist/compile/nodeExpando.d.ts.map +1 -1
- package/dist/compile/nodeExpando.js.map +1 -1
- package/dist/compile/ssrCrashes.d.ts.map +1 -1
- package/dist/compile/ssrCrashes.js +76 -20
- package/dist/compile/ssrCrashes.js.map +1 -1
- package/dist/runtime/applyBindings.d.ts +6 -0
- package/dist/runtime/applyBindings.d.ts.map +1 -1
- package/dist/runtime/applyBindings.js +6 -0
- package/dist/runtime/applyBindings.js.map +1 -1
- package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
- package/dist/runtime/bindings/applyComponent.js +3 -1
- package/dist/runtime/bindings/applyComponent.js.map +1 -1
- package/dist/runtime/bindings/applyDefer.js +2 -2
- package/dist/runtime/bindings/applyDefer.js.map +1 -1
- package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
- package/dist/runtime/bindings/applySimple.js +10 -4
- package/dist/runtime/bindings/applySimple.js.map +1 -1
- package/dist/runtime/bindings/helpers.d.ts.map +1 -1
- package/dist/runtime/bindings/helpers.js +2 -1
- package/dist/runtime/bindings/helpers.js.map +1 -1
- package/dist/runtime/bindings/types.d.ts +2 -0
- package/dist/runtime/bindings/types.d.ts.map +1 -1
- package/dist/runtime/bindings/types.js.map +1 -1
- package/dist/types/globals.d.ts +1 -0
- package/dist/types/globals.d.ts.map +1 -1
- package/dist/types/globals.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyBindings.js","sourceRoot":"","sources":["../../src/runtime/applyBindings.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,UAAU,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EACX,UAAU,GAiBX,MAAM,YAAY,CAAC;AAsBpB,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,8RAA8R;AAC9R,MAAM,UAAU,eAAe,CAC7B,QAA0B,EAC1B,QAAgB,EAChB,OAAgC,EAChC,oBAAoB,GAAG,IAAI;IAE3B,OAAO,YAAY,CAAC,GAAG,EAAE,CACvB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAA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AC;QACtD,IAAI,CAAC;YACH,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CACrB,QAA0B,EAC1B,SAAyB,EACzB,gBAAgC;IAEhC,OAAO;QACL,EAAE,EAAE,QAAQ;QACZ,OAAO;YACL,mEAAmE;YACnE,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,IAAI,CAAC;oBACH,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjB,CAAC;gBAAC,MAAM,CAAC;oBACP,4BAA4B;gBAC9B,CAAC;YACH,CAAC;YACD,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;YACrB,8DAA8D;YAC9D,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtD,IAAI,CAAC;oBACH,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxB,CAAC;gBAAC,MAAM,CAAC;oBACP,4BAA4B;gBAC9B,CAAC;YACH,CAAC;YACD,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.apply-bindings\",\n \"title\": \"AOT Binding Applicator\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { drainDestroyCallbacks } from './onDestroy';\nimport {\n forgetCrash,\n resolveAttributedCrashes,\n withinRender,\n} from '../compile/ssrCrashes';\nimport { nodeExpando } from '../compile/nodeExpando';\nimport { orderByDocument } from '../compile/disposeOrder';\nimport { executeCustomDirectiveBinders } from '../compile/binds/directiveRegistry';\nimport {\n buildPidMap,\n buildCommentMap,\n mergeContexts,\n nearestCtx,\n applyRef,\n applyError,\n markBoundary,\n applyProjection,\n applyComponent,\n applyBind,\n applyInterpolation,\n markSkeletonText,\n applyEvent,\n applyClass,\n applyClasses,\n applyStyle,\n applyBound,\n applyIf,\n applyFor,\n applySwitch,\n applyDefer,\n type Desc,\n type EventDesc,\n type InterpDesc,\n type ClassDesc,\n type ClassesDesc,\n type StyleDesc,\n type BoundDesc,\n type RefDesc,\n type BindDesc,\n type CompDesc,\n type DeferDesc,\n type ErrorDesc,\n type ProjDesc,\n type IfDesc,\n type ForDesc,\n type SwitchDesc,\n} from './bindings';\n\n// Re-export types for external consumers\nexport type {\n Desc,\n EventDesc,\n InterpDesc,\n ClassDesc,\n ClassesDesc,\n StyleDesc,\n BoundDesc,\n RefDesc,\n BindDesc,\n CompDesc,\n DeferDesc,\n ErrorDesc,\n ProjDesc,\n IfDesc,\n ForDesc,\n SwitchDesc,\n};\n\n// ─── Main entry point ─────────────────────────────────────────────────────────\n\n/**\n * Applies pre-extracted binding descriptors to an AOT-generated DOM fragment.\n *\n * This is the Phase 5 runtime binder — the counterpart to the build-time\n * codegen (Phases 1-4). It processes descriptor arrays emitted by\n * generateDomFactory + generateBindings and wires reactive effects,\n * event handlers, component mounts, and structural directive logic.\n *\n * **Binding order** mirrors (but is not identical to) bindTemplateDirectives:\n * 1. Structural: switch → if → for\n * 2. Non-structural: ref → error → projection → component → bind →\n * interpolation → event → class → classes → style → bound attr →\n * custom directives → defer\n *\n * Differences from JIT bindTemplateDirectives:\n * - AOT has an explicit `style` phase (JIT folds inline styles into bound attrs)\n *\n * Custom directives (registered via `registerDirectiveBinder`, e.g. the\n * router's `@routerLink`) run even when `bindings` is empty: codegen emits no\n * descriptor for them, only the `data-*` marker attribute.\n *\n * @param fragment - DOM fragment created by the AOT factory function\n * @param bindings - Array of binding descriptors from codegen\n * @param context - Reactive context object with signals, methods, components\n */\n/** @codexApi {\"parent\":\"pithy.runtime.apply-bindings\",\"name\":\"__applyBindings\",\"stability\":\"experimental\",\"signature\":\"(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown>, ownsDestroyCallbacks?: boolean) => { el: DocumentFragment; destroy: () => void }\"} */\nexport function __applyBindings(\n fragment: DocumentFragment,\n bindings: Desc[],\n context: Record<string, unknown>,\n ownsDestroyCallbacks = true\n): { el: DocumentFragment; destroy: () => void } {\n return withinRender(() =>\n applyBindings(fragment, bindings, context, ownsDestroyCallbacks)\n );\n}\n\nfunction applyBindings(\n fragment: DocumentFragment,\n bindings: Desc[],\n context: Record<string, unknown>,\n ownsDestroyCallbacks: boolean\n): { el: DocumentFragment; destroy: () => void } {\n // Drain onDestroy() callbacks BEFORE processing bindings — child components\n // instantiated during binding will drain their own callbacks independently.\n const destroyCallbacks = ownsDestroyCallbacks ? drainDestroyCallbacks() : [];\n\n const disposers: (() => void)[] = [];\n\n // Merge parent component + async (SSR) contexts — AOT factories bypass html().\n // Before the empty-bindings branch: custom binders must see the same context\n // whether or not the template also carries an ordinary descriptor.\n const ctx = mergeContexts(context);\n\n if (bindings.length === 0) {\n try {\n executeCustomDirectiveBinders(fragment, ctx, disposers);\n } catch (err) {\n unwind(disposers, destroyCallbacks);\n throw err;\n }\n return bindingsResult(fragment, disposers, destroyCallbacks);\n }\n\n if (bindings.some(d => d.t === 'interp')) markSkeletonText(fragment);\n\n // Build lookup maps\n const pidMap = buildPidMap(fragment);\n const commentMap = buildCommentMap(fragment);\n\n // Group descriptors by type for ordered processing\n const byType = new Map<string, Desc[]>();\n for (const d of bindings as Desc[]) {\n const list = byType.get(d.t) ?? [];\n list.push(d);\n byType.set(d.t, list);\n }\n\n try {\n // ─── Phase 1: Structural directives (shape-changing) ─────────────────\n // Order: switch → if → for (matches bindStructuralDirectives)\n\n // Marked, not registered: a branch built below must `closest()` its boundary.\n for (const d of (byType.get('error') ?? []) as ErrorDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) markBoundary(d, el);\n }\n\n for (const d of (byType.get('switch') ?? []) as SwitchDesc[]) {\n applySwitch(d, pidMap, ctx, disposers);\n }\n for (const d of (byType.get('if') ?? []) as IfDesc[]) {\n applyIf(d, commentMap, ctx, disposers);\n }\n for (const d of (byType.get('for') ?? []) as ForDesc[]) {\n applyFor(d, commentMap, ctx, disposers);\n }\n\n // ─── Phase 2: Non-structural bindings ────────────────────────────────\n // Order matches bindTemplateDirectives: ref → error → proj → comp →\n // bind → interp → event → class → classes → style → bound → defer\n\n for (const d of (byType.get('ref') ?? []) as RefDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) applyRef(d, el, ctx, disposers);\n }\n\n for (const d of (byType.get('error') ?? []) as ErrorDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) applyError(d, el, ctx, disposers);\n }\n\n for (const d of (byType.get('proj') ?? []) as ProjDesc[]) {\n applyProjection(d, commentMap, ctx, disposers);\n }\n\n // A placeholder that reaches a runtime-compiled component's binder (slot\n // content serialized into a descriptor without `slots`, or a failed\n // render left in place) is rendered through this hook, in the context it\n // was written in.\n const comps = (byType.get('comp') ?? []) as CompDesc[];\n const boundOn = (pid: string) =>\n import.meta.env?.DEV\n ? ((byType.get('bound') ?? []) as BoundDesc[])\n .filter(b => b.pid === pid)\n .map(b => b.attr)\n : [];\n const mounted = new Set<CompDesc>();\n // A hooked tag's forwarded bindings live on its latest root, owned by the\n // disposers of whoever rendered it, and are replayed on every mount.\n type Bind = (el: Element, ds: (() => void)[]) => void;\n const binds = new Map<string, Bind[]>();\n const live = new Map<string, { root: Element; ds: (() => void)[] }>();\n // A placeholder that failed stays put, and every enclosing slot's pass\n // finds it again; a re-mount moves it first. One this pass already\n // rendered is never retried (`true`).\n const failedIn = new Map<CompDesc, ParentNode | null | true>();\n for (const d of comps) {\n const el = pidMap.get(d.pid);\n if (!el) continue;\n const scope = nearestCtx(el, ctx);\n binds.set(d.pid, []);\n nodeExpando(el).__pithyAotMount = slotDisposers => {\n mounted.add(d);\n const failed = failedIn.get(d);\n if (failed === true || (failed && el.parentNode === failed)) return [];\n const nodes = applyComponent(\n d,\n el,\n ctx,\n slotDisposers,\n pidMap,\n scope,\n boundOn(d.pid)\n );\n failedIn.set(d, nodes ? null : el.parentNode);\n // On failure `pidMap` still holds the previous root.\n const root = nodes && pidMap.get(d.pid);\n if (!nodes || !root) return nodes ?? [];\n const mount = { root, ds: slotDisposers };\n live.set(d.pid, mount);\n // A slot closed before a later binding is queued must not receive it.\n slotDisposers.push(() => {\n if (live.get(d.pid) === mount) live.delete(d.pid);\n });\n for (const bind of binds.get(d.pid) ?? []) bind(root, slotDisposers);\n return nodes;\n };\n }\n const forwarded = (pid: string, bind: Bind) => {\n const stored = binds.get(pid);\n const mount = live.get(pid);\n stored?.push(bind);\n if (mount) bind(mount.root, mount.ds);\n else if (!stored) {\n const el = pidMap.get(pid);\n if (el) bind(el, disposers);\n }\n };\n\n for (const d of comps) {\n if (mounted.has(d)) continue;\n const el = pidMap.get(d.pid);\n // `pidMap` is built once, up front. An activated `@error-boundary`\n // detaches its normal children, so a later sibling's placeholder can\n // still be in the map while no longer being in the tree. Rendering it is\n // pointless — and because it can no longer resolve the boundary that\n // already handled the failure, recording its crash would fail a route\n // whose fallback rendered perfectly well. Mirrors the `scope.contains(el)`\n // guard in `bindComponentTags`.\n //\n // This does not affect a structural branch factory binding a detached\n // subtree: that calls `applyBindings` with the branch's OWN fragment as\n // `fragment`, so its placeholders are inside it and still bind.\n if (el && fragment.contains(el)) {\n if (\n !applyComponent(\n d,\n el,\n ctx,\n disposers,\n pidMap,\n undefined,\n boundOn(d.pid)\n )\n )\n failedIn.set(d, true);\n binds.delete(d.pid);\n } else if (el) {\n // Left the tree, so it contributes nothing to the output — and any crash\n // recorded for it on an earlier detached pass is stale. Same reasoning\n // as the `scope.contains(el)` skip in `bindComponentTags`.\n forgetCrash(el);\n }\n }\n\n resolveAttributedCrashes('render', fragment);\n\n for (const d of (byType.get('bind') ?? []) as BindDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) applyBind(d, el, ctx, disposers);\n }\n\n for (const d of (byType.get('interp') ?? []) as InterpDesc[]) {\n // pid === '' means root-level text node (no parent element with data-pid)\n const el = d.pid === '' ? fragment : pidMap.get(d.pid);\n if (el) applyInterpolation(d, el, ctx, disposers);\n }\n\n for (const d of (byType.get('event') ?? []) as EventDesc[]) {\n forwarded(d.pid, (el, ds) => applyEvent(d, el, ctx, ds));\n }\n\n for (const d of (byType.get('class') ?? []) as ClassDesc[]) {\n forwarded(d.pid, (el, ds) => applyClass(d, el, ctx, ds));\n }\n\n for (const d of (byType.get('classes') ?? []) as ClassesDesc[]) {\n forwarded(d.pid, (el, ds) => applyClasses(d, el, ctx, ds));\n }\n\n for (const d of (byType.get('style') ?? []) as StyleDesc[]) {\n forwarded(d.pid, (el, ds) => applyStyle(d, el, ctx, ds));\n }\n\n for (const d of (byType.get('bound') ?? []) as BoundDesc[]) {\n forwarded(d.pid, (el, ds) => applyBound(d, el, ctx, ds));\n }\n\n executeCustomDirectiveBinders(fragment, ctx, disposers);\n\n for (const d of (byType.get('defer') ?? []) as DeferDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) applyDefer(d, el as HTMLElement, ctx, disposers);\n }\n orderByDocument(disposers);\n } catch (err) {\n unwind(disposers, destroyCallbacks);\n throw err;\n }\n\n return bindingsResult(fragment, disposers, destroyCallbacks);\n}\n\n/** Runs everything registered so far after a partial bind fails. */\nfunction unwind(\n disposers: (() => void)[],\n destroyCallbacks: (() => void)[]\n): void {\n for (let i = disposers.length - 1; i >= 0; i--) {\n try {\n disposers[i]();\n } catch {\n /* ignore */\n }\n }\n for (let i = destroyCallbacks.length - 1; i >= 0; i--) {\n try {\n destroyCallbacks[i]();\n } catch {\n /* ignore */\n }\n }\n}\n\nfunction bindingsResult(\n fragment: DocumentFragment,\n disposers: (() => void)[],\n destroyCallbacks: (() => void)[]\n): { el: DocumentFragment; destroy: () => void } {\n return {\n el: fragment,\n destroy() {\n // Reverse order: child disposers (pushed later) run before parents\n for (let i = disposers.length - 1; i >= 0; i--) {\n try {\n disposers[i]();\n } catch {\n /* ignore disposal errors */\n }\n }\n disposers.length = 0;\n // onDestroy callbacks in LIFO order, after template disposers\n for (let i = destroyCallbacks.length - 1; i >= 0; i--) {\n try {\n destroyCallbacks[i]();\n } catch {\n /* ignore disposal errors */\n }\n }\n destroyCallbacks.length = 0;\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"applyBindings.js","sourceRoot":"","sources":["../../src/runtime/applyBindings.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,UAAU,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EACX,UAAU,GAiBX,MAAM,YAAY,CAAC;AAsBpB,iFAAiF;AAEjF;;;GAGG;AACH,uHAAuH;AACvH,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,8RAA8R;AAC9R,MAAM,UAAU,eAAe,CAC7B,QAA0B,EAC1B,QAAgB,EAChB,OAAgC,EAChC,oBAAoB,GAAG,IAAI;IAE3B,OAAO,YAAY,CAAC,GAAG,EAAE,CACvB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,CAAC,CACjE,CAAC;AAC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AC,CAAC,EAAE,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CACrB,QAA0B,EAC1B,SAAyB,EACzB,gBAAgC;IAEhC,OAAO;QACL,EAAE,EAAE,QAAQ;QACZ,OAAO;YACL,mEAAmE;YACnE,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,IAAI,CAAC;oBACH,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjB,CAAC;gBAAC,MAAM,CAAC;oBACP,4BAA4B;gBAC9B,CAAC;YACH,CAAC;YACD,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;YACrB,8DAA8D;YAC9D,KAAK,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtD,IAAI,CAAC;oBACH,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxB,CAAC;gBAAC,MAAM,CAAC;oBACP,4BAA4B;gBAC9B,CAAC;YACH,CAAC;YACD,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.apply-bindings\",\n \"title\": \"AOT Binding Applicator\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { drainDestroyCallbacks } from './onDestroy';\nimport {\n forgetCrash,\n resolveAttributedCrashes,\n withinRender,\n} from '../compile/ssrCrashes';\nimport { nodeExpando } from '../compile/nodeExpando';\nimport { orderByDocument } from '../compile/disposeOrder';\nimport { executeCustomDirectiveBinders } from '../compile/binds/directiveRegistry';\nimport {\n buildPidMap,\n buildCommentMap,\n mergeContexts,\n nearestCtx,\n applyRef,\n applyError,\n markBoundary,\n applyProjection,\n applyComponent,\n applyBind,\n applyInterpolation,\n markSkeletonText,\n applyEvent,\n applyClass,\n applyClasses,\n applyStyle,\n applyBound,\n applyIf,\n applyFor,\n applySwitch,\n applyDefer,\n type Desc,\n type EventDesc,\n type InterpDesc,\n type ClassDesc,\n type ClassesDesc,\n type StyleDesc,\n type BoundDesc,\n type RefDesc,\n type BindDesc,\n type CompDesc,\n type DeferDesc,\n type ErrorDesc,\n type ProjDesc,\n type IfDesc,\n type ForDesc,\n type SwitchDesc,\n} from './bindings';\n\n// Re-export types for external consumers\nexport type {\n Desc,\n EventDesc,\n InterpDesc,\n ClassDesc,\n ClassesDesc,\n StyleDesc,\n BoundDesc,\n RefDesc,\n BindDesc,\n CompDesc,\n DeferDesc,\n ErrorDesc,\n ProjDesc,\n IfDesc,\n ForDesc,\n SwitchDesc,\n};\n\n// ─── Main entry point ─────────────────────────────────────────────────────────\n\n/**\n * Marks a later `<slot>` of a name (`dup`). Generated code imports it, so a\n * core older than the plugin fails to link instead of misplacing fallbacks.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.apply-bindings\",\"name\":\"__slotDup\",\"stability\":\"internal\",\"signature\":\"true\"} */\nexport const __slotDup = true;\n\n/**\n * Applies pre-extracted binding descriptors to an AOT-generated DOM fragment.\n *\n * This is the Phase 5 runtime binder — the counterpart to the build-time\n * codegen (Phases 1-4). It processes descriptor arrays emitted by\n * generateDomFactory + generateBindings and wires reactive effects,\n * event handlers, component mounts, and structural directive logic.\n *\n * **Binding order** mirrors (but is not identical to) bindTemplateDirectives:\n * 1. Structural: switch → if → for\n * 2. Non-structural: ref → error → projection → component → bind →\n * interpolation → event → class → classes → style → bound attr →\n * custom directives → defer\n *\n * Differences from JIT bindTemplateDirectives:\n * - AOT has an explicit `style` phase (JIT folds inline styles into bound attrs)\n *\n * Custom directives (registered via `registerDirectiveBinder`, e.g. the\n * router's `@routerLink`) run even when `bindings` is empty: codegen emits no\n * descriptor for them, only the `data-*` marker attribute.\n *\n * @param fragment - DOM fragment created by the AOT factory function\n * @param bindings - Array of binding descriptors from codegen\n * @param context - Reactive context object with signals, methods, components\n */\n/** @codexApi {\"parent\":\"pithy.runtime.apply-bindings\",\"name\":\"__applyBindings\",\"stability\":\"experimental\",\"signature\":\"(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown>, ownsDestroyCallbacks?: boolean) => { el: DocumentFragment; destroy: () => void }\"} */\nexport function __applyBindings(\n fragment: DocumentFragment,\n bindings: Desc[],\n context: Record<string, unknown>,\n ownsDestroyCallbacks = true\n): { el: DocumentFragment; destroy: () => void } {\n return withinRender(() =>\n applyBindings(fragment, bindings, context, ownsDestroyCallbacks)\n );\n}\n\nfunction applyBindings(\n fragment: DocumentFragment,\n bindings: Desc[],\n context: Record<string, unknown>,\n ownsDestroyCallbacks: boolean\n): { el: DocumentFragment; destroy: () => void } {\n // Drain onDestroy() callbacks BEFORE processing bindings — child components\n // instantiated during binding will drain their own callbacks independently.\n const destroyCallbacks = ownsDestroyCallbacks ? drainDestroyCallbacks() : [];\n\n const disposers: (() => void)[] = [];\n\n // Merge parent component + async (SSR) contexts — AOT factories bypass html().\n // Before the empty-bindings branch: custom binders must see the same context\n // whether or not the template also carries an ordinary descriptor.\n const ctx = mergeContexts(context);\n\n if (bindings.length === 0) {\n try {\n executeCustomDirectiveBinders(fragment, ctx, disposers);\n } catch (err) {\n unwind(disposers, destroyCallbacks);\n throw err;\n }\n return bindingsResult(fragment, disposers, destroyCallbacks);\n }\n\n if (bindings.some(d => d.t === 'interp')) markSkeletonText(fragment);\n\n // Build lookup maps\n const pidMap = buildPidMap(fragment);\n const commentMap = buildCommentMap(fragment);\n\n // Group descriptors by type for ordered processing\n const byType = new Map<string, Desc[]>();\n for (const d of bindings as Desc[]) {\n const list = byType.get(d.t) ?? [];\n list.push(d);\n byType.set(d.t, list);\n }\n\n try {\n // ─── Phase 1: Structural directives (shape-changing) ─────────────────\n // Order: switch → if → for (matches bindStructuralDirectives)\n\n // Marked, not registered: a branch built below must `closest()` its boundary.\n for (const d of (byType.get('error') ?? []) as ErrorDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) markBoundary(d, el);\n }\n\n for (const d of (byType.get('switch') ?? []) as SwitchDesc[]) {\n applySwitch(d, pidMap, ctx, disposers);\n }\n for (const d of (byType.get('if') ?? []) as IfDesc[]) {\n applyIf(d, commentMap, ctx, disposers);\n }\n for (const d of (byType.get('for') ?? []) as ForDesc[]) {\n applyFor(d, commentMap, ctx, disposers);\n }\n\n // ─── Phase 2: Non-structural bindings ────────────────────────────────\n // Order matches bindTemplateDirectives: ref → error → proj → comp →\n // bind → interp → event → class → classes → style → bound → defer\n\n for (const d of (byType.get('ref') ?? []) as RefDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) applyRef(d, el, ctx, disposers);\n }\n\n for (const d of (byType.get('error') ?? []) as ErrorDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) applyError(d, el, ctx, disposers);\n }\n\n for (const d of (byType.get('proj') ?? []) as ProjDesc[]) {\n applyProjection(d, commentMap, ctx, disposers);\n }\n\n // A placeholder that reaches a runtime-compiled component's binder (slot\n // content serialized into a descriptor without `slots`, or a failed\n // render left in place) is rendered through this hook, in the context it\n // was written in.\n const comps = (byType.get('comp') ?? []) as CompDesc[];\n const boundOn = (pid: string) =>\n import.meta.env?.DEV\n ? ((byType.get('bound') ?? []) as BoundDesc[])\n .filter(b => b.pid === pid)\n .map(b => b.attr)\n : [];\n const mounted = new Set<CompDesc>();\n // A hooked tag's forwarded bindings live on its latest root, owned by the\n // disposers of whoever rendered it, and are replayed on every mount.\n type Bind = (el: Element, ds: (() => void)[]) => void;\n const binds = new Map<string, Bind[]>();\n const live = new Map<string, { root: Element; ds: (() => void)[] }>();\n // A placeholder that failed stays put, and every enclosing slot's pass\n // finds it again; a re-mount moves it first. One this pass already\n // rendered is never retried (`true`).\n const failedIn = new Map<CompDesc, ParentNode | null | true>();\n for (const d of comps) {\n const el = pidMap.get(d.pid);\n if (!el) continue;\n const scope = nearestCtx(el, ctx);\n binds.set(d.pid, []);\n nodeExpando(el).__pithyAotMount = slotDisposers => {\n mounted.add(d);\n const failed = failedIn.get(d);\n if (failed === true || (failed && el.parentNode === failed)) return [];\n const nodes = applyComponent(\n d,\n el,\n ctx,\n slotDisposers,\n pidMap,\n scope,\n boundOn(d.pid)\n );\n failedIn.set(d, nodes ? null : el.parentNode);\n // On failure `pidMap` still holds the previous root.\n const root = nodes && pidMap.get(d.pid);\n if (!nodes || !root) return nodes ?? [];\n const mount = { root, ds: slotDisposers };\n live.set(d.pid, mount);\n // A slot closed before a later binding is queued must not receive it.\n slotDisposers.push(() => {\n if (live.get(d.pid) === mount) live.delete(d.pid);\n });\n for (const bind of binds.get(d.pid) ?? []) bind(root, slotDisposers);\n return nodes;\n };\n }\n const forwarded = (pid: string, bind: Bind) => {\n const stored = binds.get(pid);\n const mount = live.get(pid);\n stored?.push(bind);\n if (mount) bind(mount.root, mount.ds);\n else if (!stored) {\n const el = pidMap.get(pid);\n if (el) bind(el, disposers);\n }\n };\n\n for (const d of comps) {\n if (mounted.has(d)) continue;\n const el = pidMap.get(d.pid);\n // `pidMap` is built once, up front. An activated `@error-boundary`\n // detaches its normal children, so a later sibling's placeholder can\n // still be in the map while no longer being in the tree. Rendering it is\n // pointless — and because it can no longer resolve the boundary that\n // already handled the failure, recording its crash would fail a route\n // whose fallback rendered perfectly well. Mirrors the `scope.contains(el)`\n // guard in `bindComponentTags`.\n //\n // This does not affect a structural branch factory binding a detached\n // subtree: that calls `applyBindings` with the branch's OWN fragment as\n // `fragment`, so its placeholders are inside it and still bind.\n if (el && fragment.contains(el)) {\n if (\n !applyComponent(\n d,\n el,\n ctx,\n disposers,\n pidMap,\n undefined,\n boundOn(d.pid)\n )\n )\n failedIn.set(d, true);\n binds.delete(d.pid);\n } else if (el) {\n // Left the tree, so it contributes nothing to the output — and any crash\n // recorded for it on an earlier detached pass is stale. Same reasoning\n // as the `scope.contains(el)` skip in `bindComponentTags`.\n forgetCrash(el);\n }\n }\n\n resolveAttributedCrashes('render', fragment);\n\n for (const d of (byType.get('bind') ?? []) as BindDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) applyBind(d, el, ctx, disposers);\n }\n\n for (const d of (byType.get('interp') ?? []) as InterpDesc[]) {\n // pid === '' means root-level text node (no parent element with data-pid)\n const el = d.pid === '' ? fragment : pidMap.get(d.pid);\n if (el) applyInterpolation(d, el, ctx, disposers);\n }\n\n for (const d of (byType.get('event') ?? []) as EventDesc[]) {\n forwarded(d.pid, (el, ds) => applyEvent(d, el, ctx, ds));\n }\n\n for (const d of (byType.get('class') ?? []) as ClassDesc[]) {\n forwarded(d.pid, (el, ds) => applyClass(d, el, ctx, ds));\n }\n\n for (const d of (byType.get('classes') ?? []) as ClassesDesc[]) {\n forwarded(d.pid, (el, ds) => applyClasses(d, el, ctx, ds));\n }\n\n for (const d of (byType.get('style') ?? []) as StyleDesc[]) {\n forwarded(d.pid, (el, ds) => applyStyle(d, el, ctx, ds));\n }\n\n for (const d of (byType.get('bound') ?? []) as BoundDesc[]) {\n forwarded(d.pid, (el, ds) => applyBound(d, el, ctx, ds));\n }\n\n executeCustomDirectiveBinders(fragment, ctx, disposers);\n\n for (const d of (byType.get('defer') ?? []) as DeferDesc[]) {\n const el = pidMap.get(d.pid);\n if (el) applyDefer(d, el as HTMLElement, ctx, disposers);\n }\n orderByDocument(disposers);\n } catch (err) {\n unwind(disposers, destroyCallbacks);\n throw err;\n }\n\n return bindingsResult(fragment, disposers, destroyCallbacks);\n}\n\n/** Runs everything registered so far after a partial bind fails. */\nfunction unwind(\n disposers: (() => void)[],\n destroyCallbacks: (() => void)[]\n): void {\n for (let i = disposers.length - 1; i >= 0; i--) {\n try {\n disposers[i]();\n } catch {\n /* ignore */\n }\n }\n for (let i = destroyCallbacks.length - 1; i >= 0; i--) {\n try {\n destroyCallbacks[i]();\n } catch {\n /* ignore */\n }\n }\n}\n\nfunction bindingsResult(\n fragment: DocumentFragment,\n disposers: (() => void)[],\n destroyCallbacks: (() => void)[]\n): { el: DocumentFragment; destroy: () => void } {\n return {\n el: fragment,\n destroy() {\n // Reverse order: child disposers (pushed later) run before parents\n for (let i = disposers.length - 1; i >= 0; i--) {\n try {\n disposers[i]();\n } catch {\n /* ignore disposal errors */\n }\n }\n disposers.length = 0;\n // onDestroy callbacks in LIFO order, after template disposers\n for (let i = destroyCallbacks.length - 1; i >= 0; i--) {\n try {\n destroyCallbacks[i]();\n } catch {\n /* ignore disposal errors */\n }\n }\n destroyCallbacks.length = 0;\n },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyComponent.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"applyComponent.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyComponent.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAgB,MAAM,SAAS,CAAC;AAmJtE,wBAAgB,cAAc,CAC5B,CAAC,EAAE,QAAQ,EACX,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,EACzB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,KAAK,CAAC,EAAE,cAAc;AACtB,+CAA+C;AAC/C,KAAK,GAAE,MAAM,EAAO,GACnB,IAAI,EAAE,GAAG,SAAS,CAkQpB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { compileExpression } from '../../compile/compileExpression.js';
|
|
2
2
|
import { boundaryForElement, replaceHidden, runWithBoundary, withSlotBoundary, slotContentHidden, } from '../../compile/binds/bindErrorBoundary.js';
|
|
3
|
-
import { linkOuterSlotMap, } from '../../compile/contentProjection.js';
|
|
3
|
+
import { linkOuterSlotMap, nameSlotMap, } from '../../compile/contentProjection.js';
|
|
4
4
|
import { collectForwardedAttrs, applyForwardedAttrs, } from '../../compile/binds/forwardedAttrs.js';
|
|
5
5
|
import { nativeTags } from '@pithyjs/compiler';
|
|
6
6
|
import { createRoot, untrack } from '@pithyjs/signals';
|
|
@@ -184,6 +184,8 @@ bound = []) {
|
|
|
184
184
|
warnBoundProps(names.names, bound, d.tag);
|
|
185
185
|
}
|
|
186
186
|
const slotMap = new Map();
|
|
187
|
+
if (import.meta.env?.DEV)
|
|
188
|
+
nameSlotMap(slotMap, d.tag, componentFn);
|
|
187
189
|
linkOuterSlotMap(slotMap, localCtx);
|
|
188
190
|
let injection;
|
|
189
191
|
if (d.slots) {
|
|
@@ -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,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AACl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AAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAChC,iBAAiB,CACf,YAAY,EACZ,QAAQ,EACR,IAAI,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAC9C,CAAC;IACJ,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,QAAQ;QAAE,KAAK,MAAM,KAAK,IAAI,aAAa;YAAE,KAAK,EAAE,CAAC;IAEzD,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 resolveBeforeFallback,\n} from '../../compile/ssrCrashes';\nimport { isolateDestroyCallbacks } from '../onDestroy';\nimport { readPropNames } from '../../compile/binds/propNames';\nimport {\n warnBoundProps,\n warnUnexpectedProps,\n} from '../../compile/binds/propWarnings';\nimport { watchStaleRowProp } from '../../compile/binds/staleRowProps';\nimport { markForwardTarget, nodeExpando } from '../../compile/nodeExpando';\nimport { anchorDisposer, componentDisposer } from '../../compile/disposeOrder';\nimport {\n invalidRenderError,\n invalidRenderMessage,\n propEvalMessage,\n} from '../../compile/evalDiagnostics';\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 = readPropNames(fn);\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 /** The `[attr]` names on the tag; DEV only. */\n bound: string[] = []\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 resolveBeforeFallback(el);\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 (err) {\n if (import.meta.env?.DEV)\n console.warn(propEvalMessage(propName, expr), err);\n // Leave undefined — child uses defaults\n }\n }\n\n if (import.meta.env?.DEV) {\n const names = readPropNames(componentFn);\n warnUnexpectedProps(names, props, d.tag);\n warnBoundProps(names.names, bound, d.tag);\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 reachable through the DOM. A branch, slot or component\n // built detached knows the one it will sit under (`deferCrash`).\n // Otherwise degrade in both modes — throwing would only be swallowed by\n // the structural handler's own catch (`applyStructural.ts`).\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 const error = err instanceof Error ? err : new Error(String(err));\n const message = `[AOT] Component <${d.tag}> crashed:`;\n if (!reportComponentFailure(el, d.tag, error, null, { message }))\n console.error(message, 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(el, d.tag, invalidRenderError(d.tag), boundary);\n if (import.meta.env?.DEV) console.warn(invalidRenderMessage(d.tag));\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: Element | null =\n renderedEl instanceof DocumentFragment\n ? renderedEl.firstElementChild\n : renderedEl instanceof Element\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 const error = err instanceof Error ? err : new Error(String(err));\n reportComponentFailure(el, d.tag, error, boundary);\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 markForwardTarget(\n renderedRoot,\n localCtx,\n new Set(forwardedAttrs.map(([name]) => name))\n );\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
|
+
{"version":3,"file":"appl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,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,QAAQ;QAAE,KAAK,MAAM,KAAK,IAAI,aAAa;YAAE,KAAK,EAAE,CAAC;IAEzD,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 nameSlotMap,\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 resolveBeforeFallback,\n} from '../../compile/ssrCrashes';\nimport { isolateDestroyCallbacks } from '../onDestroy';\nimport { readPropNames } from '../../compile/binds/propNames';\nimport {\n warnBoundProps,\n warnUnexpectedProps,\n} from '../../compile/binds/propWarnings';\nimport { watchStaleRowProp } from '../../compile/binds/staleRowProps';\nimport { markForwardTarget, nodeExpando } from '../../compile/nodeExpando';\nimport { anchorDisposer, componentDisposer } from '../../compile/disposeOrder';\nimport {\n invalidRenderError,\n invalidRenderMessage,\n propEvalMessage,\n} from '../../compile/evalDiagnostics';\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 = readPropNames(fn);\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 /** The `[attr]` names on the tag; DEV only. */\n bound: string[] = []\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 resolveBeforeFallback(el);\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 (err) {\n if (import.meta.env?.DEV)\n console.warn(propEvalMessage(propName, expr), err);\n // Leave undefined — child uses defaults\n }\n }\n\n if (import.meta.env?.DEV) {\n const names = readPropNames(componentFn);\n warnUnexpectedProps(names, props, d.tag);\n warnBoundProps(names.names, bound, d.tag);\n }\n\n const slotMap: SlotMap = new Map();\n if (import.meta.env?.DEV) nameSlotMap(slotMap, d.tag, componentFn);\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 reachable through the DOM. A branch, slot or component\n // built detached knows the one it will sit under (`deferCrash`).\n // Otherwise degrade in both modes — throwing would only be swallowed by\n // the structural handler's own catch (`applyStructural.ts`).\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 const error = err instanceof Error ? err : new Error(String(err));\n const message = `[AOT] Component <${d.tag}> crashed:`;\n if (!reportComponentFailure(el, d.tag, error, null, { message }))\n console.error(message, 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(el, d.tag, invalidRenderError(d.tag), boundary);\n if (import.meta.env?.DEV) console.warn(invalidRenderMessage(d.tag));\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: Element | null =\n renderedEl instanceof DocumentFragment\n ? renderedEl.firstElementChild\n : renderedEl instanceof Element\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 const error = err instanceof Error ? err : new Error(String(err));\n reportComponentFailure(el, d.tag, error, boundary);\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 markForwardTarget(\n renderedRoot,\n localCtx,\n new Set(forwardedAttrs.map(([name]) => name))\n );\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,7 +1,7 @@
|
|
|
1
1
|
import { createRoot, effect } from '@pithyjs/signals';
|
|
2
2
|
import { compileExpression } from '../../compile/compileExpression.js';
|
|
3
3
|
import { isSSRMode } from '../../compile/ssrMode.js';
|
|
4
|
-
import {
|
|
4
|
+
import { boundaryTaking, setBoundaryError, } from '../../compile/binds/bindErrorBoundary.js';
|
|
5
5
|
import { DEFAULT_LAZY_TIMEOUT, } from '@pithyjs/compiler';
|
|
6
6
|
import { isLazyHandle } from '../lazy.js';
|
|
7
7
|
import { observeVisibilityOnce, DEFAULT_VISIBILITY_MARGIN, } from '@pithyjs/shared';
|
|
@@ -221,7 +221,7 @@ export function applyDefer(d, element, ctx, disposers) {
|
|
|
221
221
|
placeholderDestroy();
|
|
222
222
|
placeholderDestroy = null;
|
|
223
223
|
}
|
|
224
|
-
const boundary =
|
|
224
|
+
const boundary = boundaryTaking(element);
|
|
225
225
|
if (boundary) {
|
|
226
226
|
setBoundaryError(boundary, error);
|
|
227
227
|
}
|
|
@@ -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;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAEvE,iFAAiF;AAEjF,uDAAuD;AACvD,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAE1B;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CACxB,CAAY,EACZ,OAAoB,EACpB,GAAmB,EACnB,SAAyB;IAEzB,qFAAqF;IACrF,IAAI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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"]}
|
|
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,cAAc,EACd,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,CA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SAAS,CAAC,IAAI,CAAC,GAAG,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 boundaryTaking,\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 = boundaryTaking(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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applySimple.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applySimple.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"applySimple.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applySimple.ts"],"names":[],"mappings":"AA4BA,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;;;;GAIG;AACH,yJAAyJ;AACzJ,wBAAgB,YAAY,CAAC,CAA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ACnB,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,CAoCN;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,CAmBN"}
|
|
@@ -6,7 +6,7 @@ import { classesEvalMessage, textEvalMessage, } from '../../compile/evalDiagnost
|
|
|
6
6
|
import { isSSRMode } from '../../compile/ssrMode.js';
|
|
7
7
|
import { registerBoundary, boundaryForElement, setBoundaryError, withSlotBoundary, } from '../../compile/binds/bindErrorBoundary.js';
|
|
8
8
|
import { applyClassGroup } from '../../compile/binds/bindClassDirectives.js';
|
|
9
|
-
import { mountProjection } from '../../compile/contentProjection.js';
|
|
9
|
+
import { mountProjection, warnDuplicateSlot, } from '../../compile/contentProjection.js';
|
|
10
10
|
import { bindAfterProjection } from '../../compile/binds/bindAfterProjection.js';
|
|
11
11
|
import { forwardEventKey, nodeExpando } from '../../compile/nodeExpando.js';
|
|
12
12
|
import { nearestCtx, compileWithEvent } from './helpers.js';
|
|
@@ -35,10 +35,13 @@ export function applyError(d, el, ctx, disposers) {
|
|
|
35
35
|
// only searches children — it would miss el itself.
|
|
36
36
|
registerBoundary(el, ctx, disposers);
|
|
37
37
|
}
|
|
38
|
+
/** Each slot anchor takes one descriptor, so none mounts at another's place. */
|
|
39
|
+
const claimedAnchors = new WeakSet();
|
|
38
40
|
export function applyProjection(d, commentMap, ctx, disposers) {
|
|
39
|
-
const anchor = commentMap.get(`slot:${d.name}`);
|
|
40
|
-
if (!anchor)
|
|
41
|
+
const anchor = commentMap.get(d.dup ? `slot-dup:${d.pid}` : `slot:${d.name}`);
|
|
42
|
+
if (!anchor || claimedAnchors.has(anchor))
|
|
41
43
|
return;
|
|
44
|
+
claimedAnchors.add(anchor);
|
|
42
45
|
const fallback = d.fallback;
|
|
43
46
|
const anchorExpando = anchor;
|
|
44
47
|
// Set expando properties that extractSlotDefs expects
|
|
@@ -54,6 +57,8 @@ export function applyProjection(d, commentMap, ctx, disposers) {
|
|
|
54
57
|
}
|
|
55
58
|
// Check for SlotMap in context
|
|
56
59
|
const slotMap = ('__slotMap' in ctx ? ctx.__slotMap : undefined);
|
|
60
|
+
if (d.dup && import.meta.env?.DEV)
|
|
61
|
+
warnDuplicateSlot(slotMap, d.name, commentMap);
|
|
57
62
|
if (slotMap) {
|
|
58
63
|
const slotDefs = [
|
|
59
64
|
{
|
|
@@ -62,7 +67,8 @@ export function applyProjection(d, commentMap, ctx, disposers) {
|
|
|
62
67
|
fallbackFactory: anchorExpando.__fallbackFactory,
|
|
63
68
|
},
|
|
64
69
|
];
|
|
65
|
-
|
|
70
|
+
// A later slot of a name mounts only its fallback, still through the boundary.
|
|
71
|
+
const render = d.dup ? undefined : slotMap.get(d.name);
|
|
66
72
|
const bound = new Map();
|
|
67
73
|
if (render)
|
|
68
74
|
bound.set(d.name, (slotDisposers, at) => {
|