@pithyjs/core 0.1.0-beta.0 → 0.1.0-beta.10
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 +37 -6
- package/dist/a11y/focus-trap.d.ts.map +1 -1
- package/dist/a11y/focus-trap.js +2 -0
- package/dist/a11y/focus-trap.js.map +1 -1
- package/dist/a11y/index.d.ts +4 -4
- package/dist/a11y/index.js +4 -4
- package/dist/a11y/index.js.map +1 -1
- package/dist/a11y/keyboard-utils.js.map +1 -1
- package/dist/a11y/roving-tabindex.js.map +1 -1
- package/dist/a11y/skip-link.js.map +1 -1
- package/dist/compile/bindSwitchCases.d.ts +8 -3
- package/dist/compile/bindSwitchCases.d.ts.map +1 -1
- package/dist/compile/bindSwitchCases.js +113 -177
- package/dist/compile/bindSwitchCases.js.map +1 -1
- package/dist/compile/binds/bindBoundAttributes.d.ts +1 -0
- package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -1
- package/dist/compile/binds/bindBoundAttributes.js +24 -2
- package/dist/compile/binds/bindBoundAttributes.js.map +1 -1
- package/dist/compile/binds/bindClassDirectives.d.ts +3 -0
- package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindClassDirectives.js +59 -21
- package/dist/compile/binds/bindClassDirectives.js.map +1 -1
- package/dist/compile/binds/bindComponentsTags.d.ts +2 -0
- package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
- package/dist/compile/binds/bindComponentsTags.js +171 -74
- package/dist/compile/binds/bindComponentsTags.js.map +1 -1
- package/dist/compile/binds/bindConditionals.d.ts +2 -2
- package/dist/compile/binds/bindConditionals.d.ts.map +1 -1
- package/dist/compile/binds/bindConditionals.js +22 -5
- package/dist/compile/binds/bindConditionals.js.map +1 -1
- package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -1
- package/dist/compile/binds/bindDefaultTwoWay.js +2 -1
- package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -1
- package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindDeferDirectives.js +45 -15
- package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.d.ts +13 -2
- package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.js +25 -10
- package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
- package/dist/compile/binds/bindEventHandlers.js +2 -2
- package/dist/compile/binds/bindEventHandlers.js.map +1 -1
- package/dist/compile/binds/bindRefDirectives.js.map +1 -1
- package/dist/compile/binds/bindStyleDirectives.d.ts +17 -0
- package/dist/compile/binds/bindStyleDirectives.d.ts.map +1 -0
- package/dist/compile/binds/bindStyleDirectives.js +47 -0
- package/dist/compile/binds/bindStyleDirectives.js.map +1 -0
- package/dist/compile/binds/bindTextInterpolations.d.ts +2 -1
- package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -1
- package/dist/compile/binds/bindTextInterpolations.js +55 -17
- package/dist/compile/binds/bindTextInterpolations.js.map +1 -1
- package/dist/compile/binds/directiveRegistry.js.map +1 -1
- package/dist/compile/binds/forwardedAttrs.d.ts +22 -0
- package/dist/compile/binds/forwardedAttrs.d.ts.map +1 -0
- package/dist/compile/binds/forwardedAttrs.js +66 -0
- package/dist/compile/binds/forwardedAttrs.js.map +1 -0
- package/dist/compile/binds/propNames.d.ts +14 -0
- package/dist/compile/binds/propNames.d.ts.map +1 -0
- package/dist/compile/binds/propNames.js +116 -0
- package/dist/compile/binds/propNames.js.map +1 -0
- package/dist/compile/compileExpression.js.map +1 -1
- package/dist/compile/compileNodes.d.ts.map +1 -1
- package/dist/compile/compileNodes.js +6 -3
- package/dist/compile/compileNodes.js.map +1 -1
- package/dist/compile/compileTemplate.d.ts +3 -4
- package/dist/compile/compileTemplate.d.ts.map +1 -1
- package/dist/compile/compileTemplate.js +28 -31
- package/dist/compile/compileTemplate.js.map +1 -1
- package/dist/compile/componentResult.d.ts +100 -0
- package/dist/compile/componentResult.d.ts.map +1 -0
- package/dist/compile/componentResult.js +138 -0
- package/dist/compile/componentResult.js.map +1 -0
- package/dist/compile/contentProjection.d.ts +1 -1
- package/dist/compile/contentProjection.d.ts.map +1 -1
- package/dist/compile/contentProjection.js +32 -15
- package/dist/compile/contentProjection.js.map +1 -1
- package/dist/compile/forLoops/bindForLoops.d.ts +2 -2
- package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -1
- package/dist/compile/forLoops/bindForLoops.js +9 -22
- package/dist/compile/forLoops/bindForLoops.js.map +1 -1
- package/dist/compile/forLoops/createLoopManager.d.ts +6 -3
- package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
- package/dist/compile/forLoops/createLoopManager.js +144 -114
- package/dist/compile/forLoops/createLoopManager.js.map +1 -1
- package/dist/compile/forLoops/index.d.ts +5 -5
- package/dist/compile/forLoops/index.js +5 -5
- package/dist/compile/forLoops/index.js.map +1 -1
- package/dist/compile/forLoops/loopHelpers.d.ts +6 -0
- package/dist/compile/forLoops/loopHelpers.d.ts.map +1 -1
- package/dist/compile/forLoops/loopHelpers.js +17 -0
- package/dist/compile/forLoops/loopHelpers.js.map +1 -1
- package/dist/compile/forLoops/loopSignals.js +2 -2
- package/dist/compile/forLoops/loopSignals.js.map +1 -1
- package/dist/compile/forLoops/loopTraversal.js +2 -2
- package/dist/compile/forLoops/loopTraversal.js.map +1 -1
- package/dist/compile/handleConditionalChain.d.ts +2 -2
- package/dist/compile/handleConditionalChain.d.ts.map +1 -1
- package/dist/compile/handleConditionalChain.js +21 -83
- package/dist/compile/handleConditionalChain.js.map +1 -1
- package/dist/compile/index.d.ts +17 -14
- package/dist/compile/index.d.ts.map +1 -1
- package/dist/compile/index.js +28 -12
- package/dist/compile/index.js.map +1 -1
- package/dist/compile/injectScopedStyle.js.map +1 -1
- package/dist/compile/nodeExpando.d.ts +6 -0
- package/dist/compile/nodeExpando.d.ts.map +1 -1
- package/dist/compile/nodeExpando.js.map +1 -1
- package/dist/compile/parseHtml.d.ts.map +1 -1
- package/dist/compile/parseHtml.js +2 -2
- package/dist/compile/parseHtml.js.map +1 -1
- package/dist/compile/pithyTreeToDom.js +1 -1
- package/dist/compile/pithyTreeToDom.js.map +1 -1
- package/dist/compile/renderBranch.d.ts +13 -0
- package/dist/compile/renderBranch.d.ts.map +1 -0
- package/dist/compile/renderBranch.js +65 -0
- package/dist/compile/renderBranch.js.map +1 -0
- package/dist/compile/renderChildren.d.ts +17 -0
- package/dist/compile/renderChildren.d.ts.map +1 -1
- package/dist/compile/renderChildren.js +22 -3
- package/dist/compile/renderChildren.js.map +1 -1
- package/dist/compile/ssrCrashes.d.ts +116 -0
- package/dist/compile/ssrCrashes.d.ts.map +1 -0
- package/dist/compile/ssrCrashes.js +173 -0
- package/dist/compile/ssrCrashes.js.map +1 -0
- package/dist/compile/ssrMode.js +1 -1
- package/dist/compile/ssrMode.js.map +1 -1
- package/dist/compile/textValue.js.map +1 -1
- package/dist/compile/trimBlankEdges.d.ts +2 -0
- package/dist/compile/trimBlankEdges.d.ts.map +1 -0
- package/dist/compile/trimBlankEdges.js +15 -0
- package/dist/compile/trimBlankEdges.js.map +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.ts +2 -2
- package/dist/interfaces/index.js +2 -2
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/ref-signal.interface.js.map +1 -1
- package/dist/interfaces/ref.interface.js.map +1 -1
- package/dist/runtime/applyBindings.d.ts +5 -5
- package/dist/runtime/applyBindings.d.ts.map +1 -1
- package/dist/runtime/applyBindings.js +97 -21
- package/dist/runtime/applyBindings.js.map +1 -1
- package/dist/runtime/bindings/applyComponent.d.ts +2 -2
- package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
- package/dist/runtime/bindings/applyComponent.js +137 -39
- package/dist/runtime/bindings/applyComponent.js.map +1 -1
- package/dist/runtime/bindings/applyDefer.d.ts +1 -1
- package/dist/runtime/bindings/applyDefer.d.ts.map +1 -1
- package/dist/runtime/bindings/applyDefer.js +46 -18
- package/dist/runtime/bindings/applyDefer.js.map +1 -1
- package/dist/runtime/bindings/applySimple.d.ts +2 -1
- package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
- package/dist/runtime/bindings/applySimple.js +70 -14
- package/dist/runtime/bindings/applySimple.js.map +1 -1
- package/dist/runtime/bindings/applyStructural.d.ts +1 -1
- package/dist/runtime/bindings/applyStructural.d.ts.map +1 -1
- package/dist/runtime/bindings/applyStructural.js +58 -68
- package/dist/runtime/bindings/applyStructural.js.map +1 -1
- package/dist/runtime/bindings/helpers.d.ts +1 -1
- package/dist/runtime/bindings/helpers.js +1 -1
- package/dist/runtime/bindings/helpers.js.map +1 -1
- package/dist/runtime/bindings/index.d.ts +6 -6
- package/dist/runtime/bindings/index.d.ts.map +1 -1
- package/dist/runtime/bindings/index.js +5 -5
- package/dist/runtime/bindings/index.js.map +1 -1
- package/dist/runtime/bindings/types.d.ts +12 -1
- package/dist/runtime/bindings/types.d.ts.map +1 -1
- package/dist/runtime/bindings/types.js.map +1 -1
- package/dist/runtime/bootstrap.d.ts +1 -1
- package/dist/runtime/bootstrap.js +1 -1
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/createContextProxy.js.map +1 -1
- package/dist/runtime/deferHelpers.d.ts +1 -1
- package/dist/runtime/deferHelpers.js.map +1 -1
- package/dist/runtime/html.d.ts.map +1 -1
- package/dist/runtime/html.js +6 -5
- package/dist/runtime/html.js.map +1 -1
- package/dist/runtime/index.d.ts +6 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +7 -5
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/lazy.js +1 -1
- package/dist/runtime/lazy.js.map +1 -1
- package/dist/runtime/module-cache.js.map +1 -1
- package/dist/runtime/onDestroy.d.ts +7 -0
- package/dist/runtime/onDestroy.d.ts.map +1 -1
- package/dist/runtime/onDestroy.js +16 -1
- package/dist/runtime/onDestroy.js.map +1 -1
- package/dist/runtime/parseIdentifiersFromTemplate.js +1 -1
- package/dist/runtime/parseIdentifiersFromTemplate.js.map +1 -1
- package/dist/runtime/resource/createAction.d.ts +44 -0
- package/dist/runtime/resource/createAction.d.ts.map +1 -0
- package/dist/runtime/resource/createAction.js +102 -0
- package/dist/runtime/resource/createAction.js.map +1 -0
- package/dist/runtime/resource/createResource.d.ts +56 -0
- package/dist/runtime/resource/createResource.d.ts.map +1 -0
- package/dist/runtime/resource/createResource.js +102 -0
- package/dist/runtime/resource/createResource.js.map +1 -0
- package/dist/runtime/resource/engine.d.ts +136 -0
- package/dist/runtime/resource/engine.d.ts.map +1 -0
- package/dist/runtime/resource/engine.js +363 -0
- package/dist/runtime/resource/engine.js.map +1 -0
- package/dist/runtime/resource/index.d.ts +19 -0
- package/dist/runtime/resource/index.d.ts.map +1 -0
- package/dist/runtime/resource/index.js +18 -0
- package/dist/runtime/resource/index.js.map +1 -0
- package/dist/runtime/resource/types.d.ts +240 -0
- package/dist/runtime/resource/types.d.ts.map +1 -0
- package/dist/runtime/resource/types.js +9 -0
- package/dist/runtime/resource/types.js.map +1 -0
- package/dist/types/globals.d.ts +10 -1
- package/dist/types/globals.d.ts.map +1 -1
- package/dist/types/globals.js.map +1 -1
- package/dist/types/index.d.ts +15 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/index.d.ts +2 -2
- package/dist/utilities/index.js +2 -2
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/ref-signal.utility.d.ts +1 -1
- package/dist/utilities/ref-signal.utility.js.map +1 -1
- package/dist/utilities/ref.untility.d.ts +1 -1
- package/dist/utilities/ref.untility.js.map +1 -1
- package/package.json +14 -9
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
"category": "runtime"
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
|
-
import { drainDestroyCallbacks } from './onDestroy';
|
|
9
|
-
import {
|
|
8
|
+
import { drainDestroyCallbacks } from './onDestroy.js';
|
|
9
|
+
import { clearSSRRenderCrash } from '../compile/ssrCrashes.js';
|
|
10
|
+
import { nodeExpando } from '../compile/nodeExpando.js';
|
|
11
|
+
import { buildPidMap, buildCommentMap, mergeContexts, nearestCtx, applyRef, applyError, applyProjection, applyComponent, applyBind, applyInterpolation, applyEvent, applyClass, applyClasses, applyStyle, applyBound, applyIf, applyFor, applySwitch, applyDefer, } from './bindings/index.js';
|
|
10
12
|
// ─── Main entry point ─────────────────────────────────────────────────────────
|
|
11
13
|
/**
|
|
12
14
|
* Applies pre-extracted binding descriptors to an AOT-generated DOM fragment.
|
|
@@ -19,7 +21,7 @@ import { buildPidMap, buildCommentMap, mergeContexts, applyRef, applyError, appl
|
|
|
19
21
|
* **Binding order** mirrors (but is not identical to) bindTemplateDirectives:
|
|
20
22
|
* 1. Structural: switch → if → for
|
|
21
23
|
* 2. Non-structural: ref → error → projection → component → bind →
|
|
22
|
-
* interpolation → event → class → style → bound attr → defer
|
|
24
|
+
* interpolation → event → class → classes → style → bound attr → defer
|
|
23
25
|
*
|
|
24
26
|
* Differences from JIT bindTemplateDirectives:
|
|
25
27
|
* - AOT has an explicit `style` phase (JIT folds inline styles into bound attrs)
|
|
@@ -29,12 +31,14 @@ import { buildPidMap, buildCommentMap, mergeContexts, applyRef, applyError, appl
|
|
|
29
31
|
* @param bindings - Array of binding descriptors from codegen
|
|
30
32
|
* @param context - Reactive context object with signals, methods, components
|
|
31
33
|
*/
|
|
32
|
-
/** @codexApi {"parent":"pithy.runtime.apply-bindings","name":"__applyBindings","stability":"experimental","signature":"(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown
|
|
33
|
-
export function __applyBindings(fragment, bindings, context) {
|
|
34
|
+
/** @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 }"} */
|
|
35
|
+
export function __applyBindings(fragment, bindings, context, ownsDestroyCallbacks = true) {
|
|
34
36
|
// Drain onDestroy() callbacks BEFORE processing bindings — child components
|
|
35
37
|
// instantiated during binding will drain their own callbacks independently.
|
|
36
|
-
const destroyCallbacks = drainDestroyCallbacks();
|
|
38
|
+
const destroyCallbacks = ownsDestroyCallbacks ? drainDestroyCallbacks() : [];
|
|
37
39
|
const disposers = [];
|
|
40
|
+
if (bindings.length === 0)
|
|
41
|
+
return bindingsResult(fragment, disposers, destroyCallbacks);
|
|
38
42
|
// Merge parent component + async (SSR) contexts — AOT factories bypass html()
|
|
39
43
|
const ctx = mergeContexts(context);
|
|
40
44
|
// Build lookup maps
|
|
@@ -61,7 +65,7 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
61
65
|
}
|
|
62
66
|
// ─── Phase 2: Non-structural bindings ────────────────────────────────
|
|
63
67
|
// Order matches bindTemplateDirectives: ref → error → proj → comp →
|
|
64
|
-
// bind → interp → event → class → style → bound → defer
|
|
68
|
+
// bind → interp → event → class → classes → style → bound → defer
|
|
65
69
|
for (const d of (byType.get('ref') ?? [])) {
|
|
66
70
|
const el = pidMap.get(d.pid);
|
|
67
71
|
if (el)
|
|
@@ -75,10 +79,83 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
75
79
|
for (const d of (byType.get('proj') ?? [])) {
|
|
76
80
|
applyProjection(d, commentMap, ctx, disposers);
|
|
77
81
|
}
|
|
78
|
-
|
|
82
|
+
// A placeholder in another component's slot content is moved into that
|
|
83
|
+
// component. A runtime-compiled one renders it from its own binder when it
|
|
84
|
+
// mounts the slot; the hook keeps it on this binder, in the context it was
|
|
85
|
+
// written in. An AOT-compiled one mounting its slot late does not call the
|
|
86
|
+
// hook yet (BUG-117).
|
|
87
|
+
const comps = (byType.get('comp') ?? []);
|
|
88
|
+
const mounted = new Set();
|
|
89
|
+
const binds = new Map();
|
|
90
|
+
const live = new Map();
|
|
91
|
+
for (const d of comps) {
|
|
79
92
|
const el = pidMap.get(d.pid);
|
|
80
|
-
if (el)
|
|
93
|
+
if (!el)
|
|
94
|
+
continue;
|
|
95
|
+
const scope = nearestCtx(el, ctx);
|
|
96
|
+
binds.set(d.pid, []);
|
|
97
|
+
// A placeholder that failed stays put, and every enclosing slot's pass
|
|
98
|
+
// finds it again; a re-mount moves it first.
|
|
99
|
+
let failedIn = null;
|
|
100
|
+
nodeExpando(el).__pithyAotMount = slotDisposers => {
|
|
101
|
+
mounted.add(d);
|
|
102
|
+
if (failedIn && el.parentNode === failedIn)
|
|
103
|
+
return [];
|
|
104
|
+
const nodes = applyComponent(d, el, ctx, slotDisposers, pidMap, scope);
|
|
105
|
+
failedIn = nodes ? null : el.parentNode;
|
|
106
|
+
// On failure `pidMap` still holds the previous root.
|
|
107
|
+
const root = nodes && pidMap.get(d.pid);
|
|
108
|
+
if (!nodes || !root)
|
|
109
|
+
return nodes ?? [];
|
|
110
|
+
const mount = { root, ds: slotDisposers };
|
|
111
|
+
live.set(d.pid, mount);
|
|
112
|
+
// A slot closed before a later binding is queued must not receive it.
|
|
113
|
+
slotDisposers.push(() => {
|
|
114
|
+
if (live.get(d.pid) === mount)
|
|
115
|
+
live.delete(d.pid);
|
|
116
|
+
});
|
|
117
|
+
for (const bind of binds.get(d.pid) ?? [])
|
|
118
|
+
bind(root, slotDisposers);
|
|
119
|
+
return nodes;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const forwarded = (pid, bind) => {
|
|
123
|
+
const stored = binds.get(pid);
|
|
124
|
+
const mount = live.get(pid);
|
|
125
|
+
stored?.push(bind);
|
|
126
|
+
if (mount)
|
|
127
|
+
bind(mount.root, mount.ds);
|
|
128
|
+
else if (!stored) {
|
|
129
|
+
const el = pidMap.get(pid);
|
|
130
|
+
if (el)
|
|
131
|
+
bind(el, disposers);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
for (const d of comps) {
|
|
135
|
+
if (mounted.has(d))
|
|
136
|
+
continue;
|
|
137
|
+
const el = pidMap.get(d.pid);
|
|
138
|
+
// `pidMap` is built once, up front. An activated `@error-boundary`
|
|
139
|
+
// detaches its normal children, so a later sibling's placeholder can
|
|
140
|
+
// still be in the map while no longer being in the tree. Rendering it is
|
|
141
|
+
// pointless — and because it can no longer resolve the boundary that
|
|
142
|
+
// already handled the failure, recording its crash would fail a route
|
|
143
|
+
// whose fallback rendered perfectly well. Mirrors the `scope.contains(el)`
|
|
144
|
+
// guard in `bindComponentTags`.
|
|
145
|
+
//
|
|
146
|
+
// This does not affect a structural branch factory binding a detached
|
|
147
|
+
// subtree: that calls `applyBindings` with the branch's OWN fragment as
|
|
148
|
+
// `fragment`, so its placeholders are inside it and still bind.
|
|
149
|
+
if (el && fragment.contains(el)) {
|
|
81
150
|
applyComponent(d, el, ctx, disposers, pidMap);
|
|
151
|
+
binds.delete(d.pid);
|
|
152
|
+
}
|
|
153
|
+
else if (el) {
|
|
154
|
+
// Left the tree, so it contributes nothing to the output — and any crash
|
|
155
|
+
// recorded for it on an earlier detached pass is stale. Same reasoning
|
|
156
|
+
// as the `scope.contains(el)` skip in `bindComponentTags`.
|
|
157
|
+
clearSSRRenderCrash(el);
|
|
158
|
+
}
|
|
82
159
|
}
|
|
83
160
|
for (const d of (byType.get('bind') ?? [])) {
|
|
84
161
|
const el = pidMap.get(d.pid);
|
|
@@ -92,24 +169,19 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
92
169
|
applyInterpolation(d, el, ctx, disposers);
|
|
93
170
|
}
|
|
94
171
|
for (const d of (byType.get('event') ?? [])) {
|
|
95
|
-
|
|
96
|
-
if (el)
|
|
97
|
-
applyEvent(d, el, ctx, disposers);
|
|
172
|
+
forwarded(d.pid, (el, ds) => applyEvent(d, el, ctx, ds));
|
|
98
173
|
}
|
|
99
174
|
for (const d of (byType.get('class') ?? [])) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
175
|
+
forwarded(d.pid, (el, ds) => applyClass(d, el, ctx, ds));
|
|
176
|
+
}
|
|
177
|
+
for (const d of (byType.get('classes') ?? [])) {
|
|
178
|
+
forwarded(d.pid, (el, ds) => applyClasses(d, el, ctx, ds));
|
|
103
179
|
}
|
|
104
180
|
for (const d of (byType.get('style') ?? [])) {
|
|
105
|
-
|
|
106
|
-
if (el)
|
|
107
|
-
applyStyle(d, el, ctx, disposers);
|
|
181
|
+
forwarded(d.pid, (el, ds) => applyStyle(d, el, ctx, ds));
|
|
108
182
|
}
|
|
109
183
|
for (const d of (byType.get('bound') ?? [])) {
|
|
110
|
-
|
|
111
|
-
if (el)
|
|
112
|
-
applyBound(d, el, ctx, disposers);
|
|
184
|
+
forwarded(d.pid, (el, ds) => applyBound(d, el, ctx, ds));
|
|
113
185
|
}
|
|
114
186
|
for (const d of (byType.get('defer') ?? [])) {
|
|
115
187
|
const el = pidMap.get(d.pid);
|
|
@@ -137,6 +209,9 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
137
209
|
}
|
|
138
210
|
throw err;
|
|
139
211
|
}
|
|
212
|
+
return bindingsResult(fragment, disposers, destroyCallbacks);
|
|
213
|
+
}
|
|
214
|
+
function bindingsResult(fragment, disposers, destroyCallbacks) {
|
|
140
215
|
return {
|
|
141
216
|
el: fragment,
|
|
142
217
|
destroy() {
|
|
@@ -159,6 +234,7 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
159
234
|
/* ignore disposal errors */
|
|
160
235
|
}
|
|
161
236
|
}
|
|
237
|
+
destroyCallbacks.length = 0;
|
|
162
238
|
},
|
|
163
239
|
};
|
|
164
240
|
}
|
|
@@ -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,eAAe,EACf,aAAa,EACb,Q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CAAC;YAAC,MAAM,CAAC;gBACP,YAAY;YACd,CAAC;QACH,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;IAED,OAAO,cAAc,CAAC,QAAQ,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAC/D,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 { clearSSRRenderCrash } from '../compile/ssrCrashes';\nimport { nodeExpando } from '../compile/nodeExpando';\nimport {\n buildPidMap,\n buildCommentMap,\n mergeContexts,\n nearestCtx,\n applyRef,\n applyError,\n applyProjection,\n applyComponent,\n applyBind,\n applyInterpolation,\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 → defer\n *\n * Differences from JIT bindTemplateDirectives:\n * - AOT has an explicit `style` phase (JIT folds inline styles into bound attrs)\n * - AOT omits the `custom-directive` step (router directives handled at build time)\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 // 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 if (bindings.length === 0)\n return bindingsResult(fragment, disposers, destroyCallbacks);\n\n // Merge parent component + async (SSR) contexts — AOT factories bypass html()\n const ctx = mergeContexts(context);\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 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 in another component's slot content is moved into that\n // component. A runtime-compiled one renders it from its own binder when it\n // mounts the slot; the hook keeps it on this binder, in the context it was\n // written in. An AOT-compiled one mounting its slot late does not call the\n // hook yet (BUG-117).\n const comps = (byType.get('comp') ?? []) as CompDesc[];\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 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 // A placeholder that failed stays put, and every enclosing slot's pass\n // finds it again; a re-mount moves it first.\n let failedIn: ParentNode | null = null;\n nodeExpando(el).__pithyAotMount = slotDisposers => {\n mounted.add(d);\n if (failedIn && el.parentNode === failedIn) return [];\n const nodes = applyComponent(d, el, ctx, slotDisposers, pidMap, scope);\n failedIn = 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 applyComponent(d, el, ctx, disposers, pidMap);\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 clearSSRRenderCrash(el);\n }\n }\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 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 } catch (err) {\n // Clean up any disposers already registered during partial binding\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 throw err;\n }\n\n return bindingsResult(fragment, disposers, destroyCallbacks);\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,3 +1,3 @@
|
|
|
1
|
-
import type { CompDesc, BindingContext } from './types';
|
|
2
|
-
export declare function applyComponent(d: CompDesc, el: Element, ctx: BindingContext, disposers: (() => void)[], pidMap: Map<string, Element
|
|
1
|
+
import type { CompDesc, BindingContext } from './types.js';
|
|
2
|
+
export declare function applyComponent(d: CompDesc, el: Element, ctx: BindingContext, disposers: (() => void)[], pidMap: Map<string, Element>, scope?: BindingContext): Node[] | undefined;
|
|
3
3
|
//# sourceMappingURL=applyComponent.d.ts.map
|
|
@@ -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":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAgB,MAAM,SAAS,CAAC;AA6DtE,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,GACrB,IAAI,EAAE,GAAG,SAAS,CA+QpB"}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
import { compileExpression } from '../../compile/compileExpression';
|
|
2
|
-
import { boundaryForElement,
|
|
1
|
+
import { compileExpression } from '../../compile/compileExpression.js';
|
|
2
|
+
import { boundaryForElement, runWithBoundary, } from '../../compile/binds/bindErrorBoundary.js';
|
|
3
|
+
import { collectForwardedAttrs, applyForwardedAttrs, } from '../../compile/binds/forwardedAttrs.js';
|
|
3
4
|
import { nativeTags } from '@pithyjs/compiler';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
5
|
+
import { createRoot, untrack } from '@pithyjs/signals';
|
|
6
|
+
import { nearestCtx } from './helpers.js';
|
|
7
|
+
import { trimBlankEdges } from '../../compile/trimBlankEdges.js';
|
|
8
|
+
import { pithyGlobals } from '../../types/globals.js';
|
|
9
|
+
import { isSSRMode } from '../../compile/ssrMode.js';
|
|
10
|
+
import { isRenderableComponentEl } from '../../compile/componentResult.js';
|
|
11
|
+
import { clearSSRRenderCrash, reportComponentFailure, } from '../../compile/ssrCrashes.js';
|
|
12
|
+
import { isolateDestroyCallbacks } from '../onDestroy.js';
|
|
13
|
+
import { parsePropNames } from '../../compile/binds/propNames.js';
|
|
6
14
|
/** Map kebab-case or lowered DOM attr name to expected camelCase prop name. */
|
|
7
15
|
function normalizePropName(authored, expectedProps) {
|
|
8
|
-
if (expectedProps.
|
|
16
|
+
if (expectedProps.includes(authored))
|
|
9
17
|
return authored;
|
|
10
|
-
const
|
|
11
|
-
|
|
18
|
+
const lower = authored.toLowerCase();
|
|
19
|
+
const matches = expectedProps.filter(p => p.toLowerCase() === lower);
|
|
20
|
+
return matches.length === 1 ? matches[0] : authored;
|
|
12
21
|
}
|
|
13
22
|
/** Cache for extractExpectedPropNames to avoid re-parsing the same function. */
|
|
14
23
|
const propNamesCache = new WeakMap();
|
|
@@ -24,18 +33,8 @@ function extractExpectedPropNames(fn) {
|
|
|
24
33
|
if (cached)
|
|
25
34
|
return cached;
|
|
26
35
|
try {
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
if (!m) {
|
|
30
|
-
propNamesCache.set(fn, []);
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
const names = m[1]
|
|
34
|
-
.split(',')
|
|
35
|
-
.map(s => s.trim())
|
|
36
|
-
.filter(Boolean)
|
|
37
|
-
.filter(s => !s.startsWith('...'))
|
|
38
|
-
.map(s => s.split(/[:=]/)[0].trim());
|
|
36
|
+
const parsed = parsePropNames(fn.toString());
|
|
37
|
+
const names = parsed.fromParam ? parsed.names : [];
|
|
39
38
|
// Detect likely minification: single-char names suggest mangled output
|
|
40
39
|
if (import.meta.env?.DEV &&
|
|
41
40
|
names.length > 0 &&
|
|
@@ -49,19 +48,26 @@ function extractExpectedPropNames(fn) {
|
|
|
49
48
|
return [];
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
|
-
export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
51
|
+
export function applyComponent(d, el, ctx, disposers, pidMap, scope) {
|
|
53
52
|
// Skip native HTML elements — prevents <div> matching a `div` in context.
|
|
54
53
|
// Only apply when the authored tag is already lowercase; PascalCase tags like
|
|
55
54
|
// <Button> are valid components even though "button" is a native tag.
|
|
56
55
|
const tagLower = d.tag.toLowerCase();
|
|
57
56
|
if (d.tag === tagLower && nativeTags.has(tagLower))
|
|
58
57
|
return;
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
// Exact case first: the context holds the template's own locals alongside its
|
|
59
|
+
// components, so a prop named `icon` sits next to the `Icon` component and
|
|
60
|
+
// collides case-insensitively. The JIT path lowercases into a Map, where the
|
|
61
|
+
// components — appended last — overwrite the locals; matching that ordering is
|
|
62
|
+
// why `<Icon>` resolves in dev, and breaking on the first match is why it did
|
|
63
|
+
// not in a build. Falling back last-wins keeps the two paths agreeing.
|
|
64
|
+
let candidate = Object.prototype.hasOwnProperty.call(ctx, d.tag)
|
|
65
|
+
? ctx[d.tag]
|
|
66
|
+
: undefined;
|
|
67
|
+
if (candidate === undefined) {
|
|
68
|
+
for (const key of Object.keys(ctx)) {
|
|
69
|
+
if (key.toLowerCase() === tagLower)
|
|
70
|
+
candidate = ctx[key];
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
if (!candidate)
|
|
@@ -76,7 +82,7 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
|
76
82
|
if (typeof candidate !== 'function')
|
|
77
83
|
return;
|
|
78
84
|
const componentFn = candidate;
|
|
79
|
-
const localCtx = nearestCtx(el, ctx);
|
|
85
|
+
const localCtx = scope ?? nearestCtx(el, ctx);
|
|
80
86
|
// Extract expected props for case-insensitive normalization
|
|
81
87
|
const expectedProps = extractExpectedPropNames(componentFn);
|
|
82
88
|
// Evaluate prop expressions with prop name normalization
|
|
@@ -85,7 +91,7 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
|
85
91
|
const propName = normalizePropName(rawName, expectedProps);
|
|
86
92
|
try {
|
|
87
93
|
const fn = compileExpression(expr, localCtx);
|
|
88
|
-
props[propName] = fn
|
|
94
|
+
props[propName] = untrack(fn);
|
|
89
95
|
}
|
|
90
96
|
catch {
|
|
91
97
|
// Leave undefined — child uses defaults
|
|
@@ -105,7 +111,29 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
|
105
111
|
slotGroups.set(slotName, []);
|
|
106
112
|
slotGroups.get(slotName).push(child);
|
|
107
113
|
}
|
|
114
|
+
const defaultSlot = slotGroups.get('');
|
|
115
|
+
if (defaultSlot) {
|
|
116
|
+
const content = trimBlankEdges(defaultSlot, node => node.nodeType === Node.TEXT_NODE ? node.textContent : null);
|
|
117
|
+
if (content.length)
|
|
118
|
+
slotGroups.set('', content);
|
|
119
|
+
else
|
|
120
|
+
slotGroups.delete('');
|
|
121
|
+
}
|
|
122
|
+
// AOT has no runtime AST, so default-slot content reaches the component two
|
|
123
|
+
// ways: `renderChildren()` reads the injection fragment off the global, and
|
|
124
|
+
// `<slot>` reads it through the slot map. Both must reference the SAME
|
|
125
|
+
// fragment — a DOM node lives in one place, so two fragments would let the
|
|
126
|
+
// later consumer steal the nodes out of the first.
|
|
127
|
+
let injection;
|
|
108
128
|
for (const [slotName, nodes] of slotGroups) {
|
|
129
|
+
if (slotName === '') {
|
|
130
|
+
injection = document.createDocumentFragment();
|
|
131
|
+
for (const node of nodes)
|
|
132
|
+
injection.appendChild(node);
|
|
133
|
+
const shared = injection;
|
|
134
|
+
slotMap.set('', () => shared);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
109
137
|
slotMap.set(slotName, () => {
|
|
110
138
|
const frag = document.createDocumentFragment();
|
|
111
139
|
for (const node of nodes) {
|
|
@@ -114,62 +142,127 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
|
114
142
|
return frag;
|
|
115
143
|
});
|
|
116
144
|
}
|
|
117
|
-
|
|
145
|
+
let invoking = true;
|
|
146
|
+
const childrenFactory = d.children;
|
|
147
|
+
const childFactory = childrenFactory
|
|
148
|
+
? (ctx, wrap) => invoking
|
|
149
|
+
? childrenFactory(ctx, wrap)
|
|
150
|
+
: isolateDestroyCallbacks(() => childrenFactory(ctx, wrap))
|
|
151
|
+
: undefined;
|
|
152
|
+
const componentContext = {
|
|
153
|
+
...localCtx,
|
|
154
|
+
__slotMap: slotMap,
|
|
155
|
+
__childAstNodes: undefined,
|
|
156
|
+
__childFactory: childFactory,
|
|
157
|
+
};
|
|
118
158
|
// Find nearest error boundary
|
|
119
159
|
const boundaryEl = el.closest('[data-error]');
|
|
120
160
|
const boundary = boundaryForElement(boundaryEl);
|
|
121
161
|
let out;
|
|
162
|
+
let disposeSetup;
|
|
122
163
|
try {
|
|
123
164
|
out = runWithBoundary(boundary, () => {
|
|
124
165
|
const g = pithyGlobals();
|
|
125
166
|
const originalContext = g.__pithyComponentContext;
|
|
126
167
|
const wasRendering = g.__pithyRenderingComponent;
|
|
168
|
+
const prevInjection = g.__pithyProjectedChildren;
|
|
127
169
|
g.__pithyComponentContext = componentContext;
|
|
128
170
|
g.__pithyRenderingComponent = true;
|
|
171
|
+
g.__pithyProjectedChildren = injection;
|
|
129
172
|
try {
|
|
130
|
-
return
|
|
173
|
+
return createRoot(disposeRoot => {
|
|
174
|
+
disposeSetup = disposeRoot;
|
|
175
|
+
return componentFn(props);
|
|
176
|
+
});
|
|
131
177
|
}
|
|
132
178
|
finally {
|
|
133
179
|
g.__pithyComponentContext = originalContext;
|
|
134
180
|
g.__pithyRenderingComponent = wasRendering;
|
|
181
|
+
g.__pithyProjectedChildren = prevInjection;
|
|
182
|
+
invoking = false;
|
|
135
183
|
}
|
|
136
184
|
});
|
|
137
185
|
}
|
|
138
186
|
catch (err) {
|
|
139
187
|
if (boundary) {
|
|
140
|
-
|
|
188
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
189
|
+
// See `setBoundaryError`: an already-active boundary with no free ancestor
|
|
190
|
+
// drops the error rather than taking it, which is the normal case for a
|
|
191
|
+
// component rendering inside that boundary's `@fallback`.
|
|
192
|
+
reportComponentFailure(el, d.tag, error, boundary);
|
|
141
193
|
return;
|
|
142
194
|
}
|
|
195
|
+
// No boundary in scope *yet*. Degrade in both modes — an AOT branch
|
|
196
|
+
// factory renders detached, so `closest()` here cannot see a boundary the
|
|
197
|
+
// element will sit under once the branch is inserted, and throwing would
|
|
198
|
+
// only be swallowed by the structural handler's own catch
|
|
199
|
+
// (`applyStructural.ts`) anyway.
|
|
200
|
+
//
|
|
201
|
+
// A static/server render records the crash instead: dropping the component
|
|
202
|
+
// silently shipped HTML with <${d.tag}> left raw while `pithy-ssg` counted
|
|
203
|
+
// the route as rendered and exited 0 (BUG-018). Anything still recorded
|
|
204
|
+
// when the render finishes fails the route.
|
|
205
|
+
//
|
|
206
|
+
// Note this path cannot reach a boundary at all when the element is inside
|
|
207
|
+
// a detached structural branch: `el.closest('[data-error]')` above found
|
|
208
|
+
// nothing, and no later pass re-binds it, so the boundary never receives
|
|
209
|
+
// the error even though the nodes are inserted underneath it. That is
|
|
210
|
+
// BUG-023; recording is what stops it from shipping silently.
|
|
211
|
+
reportComponentFailure(el, d.tag, err instanceof Error ? err : new Error(String(err)), null);
|
|
143
212
|
console.error(`[AOT] Component <${d.tag}> crashed:`, err);
|
|
144
213
|
return;
|
|
145
214
|
}
|
|
146
|
-
if (!out ||
|
|
215
|
+
if (!out ||
|
|
216
|
+
typeof out !== 'object' ||
|
|
217
|
+
!('el' in out) ||
|
|
218
|
+
!isRenderableComponentEl(out.el, el)) {
|
|
219
|
+
// Not a throw, but the same outcome: the raw <${d.tag}> is left in place
|
|
220
|
+
// and the subtree never renders, which under SSR is content silently
|
|
221
|
+
// missing from the emitted HTML. Recorded exactly like a crash (BUG-018).
|
|
222
|
+
// Same funnel as a throw — see `bindComponentTags`. Recording without
|
|
223
|
+
// offering it to the boundary left an AOT component under `@error-boundary`
|
|
224
|
+
// failing its route with the boundary signal unset.
|
|
225
|
+
reportComponentFailure(el, d.tag, new Error(`Invalid render result from <${d.tag}>; expected { el, destroy }`), boundary);
|
|
226
|
+
disposeSetup?.();
|
|
147
227
|
return;
|
|
228
|
+
}
|
|
148
229
|
const { el: renderedEl, destroy } = out;
|
|
149
230
|
// Capture rendered root element before fragment is consumed by replaceWith
|
|
150
231
|
const forwardedClass = el.getAttribute('class');
|
|
232
|
+
const forwardedAttrs = collectForwardedAttrs(el);
|
|
151
233
|
const renderedRoot = renderedEl instanceof DocumentFragment
|
|
152
234
|
? renderedEl.firstElementChild
|
|
153
235
|
: renderedEl instanceof HTMLElement
|
|
154
236
|
? renderedEl
|
|
155
237
|
: null;
|
|
238
|
+
const nodes = renderedEl instanceof DocumentFragment
|
|
239
|
+
? Array.from(renderedEl.childNodes)
|
|
240
|
+
: [renderedEl];
|
|
241
|
+
let replaced = true;
|
|
156
242
|
try {
|
|
157
|
-
|
|
158
|
-
el.replaceWith(...Array.from(renderedEl.childNodes));
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
el.replaceWith(renderedEl);
|
|
162
|
-
}
|
|
243
|
+
el.replaceWith(...nodes);
|
|
163
244
|
}
|
|
164
245
|
catch (err) {
|
|
246
|
+
// The raw <${d.tag}> is left exactly where a crash would have left it, so
|
|
247
|
+
// this is the same content loss and is recorded the same way.
|
|
248
|
+
replaced = false;
|
|
249
|
+
reportComponentFailure(el, d.tag, err instanceof Error ? err : new Error(String(err)), boundary);
|
|
165
250
|
console.error(`[AOT] Failed to replace <${d.tag}>:`, err);
|
|
166
251
|
}
|
|
252
|
+
// Retracted only here, and in the boundary catch above. This is the point at
|
|
253
|
+
// which the component is known to have produced a usable node AND to have
|
|
254
|
+
// reached the document.
|
|
255
|
+
if (isSSRMode() && replaced)
|
|
256
|
+
clearSSRRenderCrash(el);
|
|
167
257
|
if (forwardedClass && renderedRoot) {
|
|
168
258
|
for (const cls of forwardedClass.split(/\s+/)) {
|
|
169
259
|
if (cls)
|
|
170
260
|
renderedRoot.classList.add(cls);
|
|
171
261
|
}
|
|
172
262
|
}
|
|
263
|
+
if (forwardedAttrs.length > 0 && renderedRoot) {
|
|
264
|
+
applyForwardedAttrs(renderedRoot, forwardedAttrs, d.tag);
|
|
265
|
+
}
|
|
173
266
|
// Re-target the component pid to the rendered root so subsequent binding
|
|
174
267
|
// passes (event, bound, class, style) apply to the component's actual DOM
|
|
175
268
|
// element. This matches the JIT path where data-on-* attributes are
|
|
@@ -179,12 +272,17 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
|
179
272
|
}
|
|
180
273
|
else {
|
|
181
274
|
if (import.meta.env?.DEV &&
|
|
182
|
-
(forwardedClass ||
|
|
275
|
+
(forwardedClass ||
|
|
276
|
+
forwardedAttrs.length > 0 ||
|
|
277
|
+
(d.props && Object.keys(d.props).length > 0))) {
|
|
183
278
|
console.warn(`[AOT] <${d.tag}> has forwarded attributes but returns a fragment with no single root element — forwarding skipped.`);
|
|
184
279
|
}
|
|
185
280
|
pidMap.delete(d.pid);
|
|
186
281
|
}
|
|
282
|
+
if (disposeSetup)
|
|
283
|
+
disposers.push(disposeSetup);
|
|
187
284
|
if (typeof destroy === 'function')
|
|
188
285
|
disposers.push(destroy);
|
|
286
|
+
return replaced ? nodes : undefined;
|
|
189
287
|
}
|
|
190
288
|
//# sourceMappingURL=applyComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyComponent.js","sourceRoot":"","sources":["../../../src/runtime/bindings/applyComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,GAChB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQnD,+EAA+E;AAC/E,SAAS,iBAAiB,CAAC,QAAgB,EAAE,aAAuB;IAClE,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAClE,OAAO,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,QAAQ,CAAC;AACrD,CAAC;AAED,gFAAgF;AAChF,MAAM,cAAc,GAAG,IAAI,OAAO,EAAyB,CAAC;AAE5D;;;;;;GAMG;AACH,SAAS,wBAAwB,CAAC,EAAe;IAC/C,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACtC,IAAI,MAAM;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AAU;QAAE,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3D,OAAO,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC","sourcesContent":["import { compileExpression } from '../../compile/compileExpression';\nimport {\n boundaryForElement,\n runWithBoundary,\n} from '../../compile/binds/bindErrorBoundary';\nimport type { SlotMap } from '../../compile/contentProjection';\nimport {\n collectForwardedAttrs,\n applyForwardedAttrs,\n} from '../../compile/binds/forwardedAttrs';\nimport { nativeTags } from '@pithyjs/compiler';\nimport { createRoot, untrack } from '@pithyjs/signals';\nimport type { CompDesc, BindingContext, ChildFactory } from './types';\nimport { nearestCtx } from './helpers';\nimport { trimBlankEdges } from '../../compile/trimBlankEdges';\nimport { pithyGlobals } from '../../types/globals';\nimport { isSSRMode } from '../../compile/ssrMode';\nimport { isRenderableComponentEl } from '../../compile/componentResult';\nimport {\n clearSSRRenderCrash,\n reportComponentFailure,\n} from '../../compile/ssrCrashes';\nimport { isolateDestroyCallbacks } from '../onDestroy';\nimport { parsePropNames } from '../../compile/binds/propNames';\n\ninterface ComponentResult {\n /** Any DOM node — see the `Component` type for why this is not narrower. */\n el: Node;\n destroy?: () => void;\n}\ntype ComponentFn = (props: Record<string, unknown>) => ComponentResult;\n\n/** Map kebab-case or lowered DOM attr name to expected camelCase prop name. */\nfunction normalizePropName(authored: string, expectedProps: string[]): string {\n if (expectedProps.includes(authored)) return authored;\n const lower = authored.toLowerCase();\n const matches = expectedProps.filter(p => p.toLowerCase() === lower);\n return matches.length === 1 ? matches[0] : authored;\n}\n\n/** Cache for extractExpectedPropNames to avoid re-parsing the same function. */\nconst propNamesCache = new WeakMap<ComponentFn, string[]>();\n\n/**\n * Extract destructured prop names from component function signature.\n * NOTE: Uses fn.toString() which may return mangled names under aggressive\n * minification (Terser). In that case, prop name normalization becomes a\n * no-op and props are passed as-is (kebab/lowered). This is acceptable\n * because Vite's default esbuild minifier preserves parameter names.\n */\nfunction extractExpectedPropNames(fn: ComponentFn): string[] {\n const cached = propNamesCache.get(fn);\n if (cached) return cached;\n try {\n const parsed = parsePropNames(fn.toString());\n const names = parsed.fromParam ? parsed.names : [];\n // Detect likely minification: single-char names suggest mangled output\n if (\n import.meta.env?.DEV &&\n names.length > 0 &&\n names.every(n => n.length === 1)\n ) {\n console.warn(\n `[AOT] extractExpectedPropNames: detected single-char names (${names.join(',')}) — prop normalization may not work under minification`\n );\n }\n propNamesCache.set(fn, names);\n return names;\n } catch {\n return [];\n }\n}\n\nexport function applyComponent(\n d: CompDesc,\n el: Element,\n ctx: BindingContext,\n disposers: (() => void)[],\n pidMap: Map<string, Element>,\n scope?: BindingContext\n): Node[] | undefined {\n // Skip native HTML elements — prevents <div> matching a `div` in context.\n // Only apply when the authored tag is already lowercase; PascalCase tags like\n // <Button> are valid components even though \"button\" is a native tag.\n const tagLower = d.tag.toLowerCase();\n if (d.tag === tagLower && nativeTags.has(tagLower)) return;\n\n // Exact case first: the context holds the template's own locals alongside its\n // components, so a prop named `icon` sits next to the `Icon` component and\n // collides case-insensitively. The JIT path lowercases into a Map, where the\n // components — appended last — overwrite the locals; matching that ordering is\n // why `<Icon>` resolves in dev, and breaking on the first match is why it did\n // not in a build. Falling back last-wins keeps the two paths agreeing.\n let candidate: unknown = Object.prototype.hasOwnProperty.call(ctx, d.tag)\n ? ctx[d.tag]\n : undefined;\n if (candidate === undefined) {\n for (const key of Object.keys(ctx)) {\n if (key.toLowerCase() === tagLower) candidate = ctx[key];\n }\n }\n if (!candidate) return;\n\n // Support default exports\n if (\n candidate &&\n typeof candidate === 'object' &&\n 'default' in candidate &&\n typeof candidate.default === 'function'\n ) {\n candidate = candidate.default;\n }\n if (typeof candidate !== 'function') return;\n\n const componentFn = candidate as ComponentFn;\n const localCtx = scope ?? nearestCtx(el, ctx);\n\n // Extract expected props for case-insensitive normalization\n const expectedProps = extractExpectedPropNames(componentFn);\n\n // Evaluate prop expressions with prop name normalization\n const props: Record<string, unknown> = {};\n for (const [rawName, expr] of Object.entries(d.props)) {\n const propName = normalizePropName(rawName, expectedProps);\n try {\n const fn = compileExpression(expr, localCtx);\n props[propName] = untrack(fn);\n } catch {\n // Leave undefined — child uses defaults\n }\n }\n\n // Collect slot content from el's children — move original nodes instead\n // of cloning to preserve any expandos (__pithyCtx) and event listeners.\n // The placeholder el is about to be replaced, so its children are orphaned anyway.\n const slotMap: SlotMap = new Map();\n const children = Array.from(el.childNodes);\n const slotGroups = new Map<string, Node[]>();\n for (const child of children) {\n const slotName =\n child.nodeType === Node.ELEMENT_NODE\n ? (child as Element).getAttribute('slot') || ''\n : '';\n if (!slotGroups.has(slotName)) slotGroups.set(slotName, []);\n slotGroups.get(slotName)!.push(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 // AOT has no runtime AST, so default-slot content reaches the component two\n // ways: `renderChildren()` reads the injection fragment off the global, and\n // `<slot>` reads it through the slot map. Both must reference the SAME\n // fragment — a DOM node lives in one place, so two fragments would let the\n // later consumer steal 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) {\n frag.appendChild(node);\n }\n return frag;\n });\n }\n\n let invoking = true;\n const childrenFactory = d.children;\n const childFactory: ChildFactory | undefined = childrenFactory\n ? (ctx, wrap) =>\n invoking\n ? childrenFactory(ctx, wrap)\n : isolateDestroyCallbacks(() => childrenFactory(ctx, wrap))\n : undefined;\n\n const componentContext = {\n ...localCtx,\n __slotMap: slotMap,\n __childAstNodes: undefined,\n __childFactory: childFactory,\n };\n\n // Find nearest error boundary\n const boundaryEl = el.closest('[data-error]') as Element | null;\n const boundary = boundaryForElement(boundaryEl);\n\n let out: ComponentResult | undefined;\n let disposeSetup: (() => void) | undefined;\n try {\n out = runWithBoundary(boundary, () => {\n const g = pithyGlobals();\n const originalContext = g.__pithyComponentContext;\n const wasRendering = g.__pithyRenderingComponent;\n const prevInjection = g.__pithyProjectedChildren;\n g.__pithyComponentContext = componentContext;\n g.__pithyRenderingComponent = true;\n g.__pithyProjectedChildren = injection;\n try {\n return createRoot(disposeRoot => {\n disposeSetup = disposeRoot;\n return componentFn(props);\n });\n } finally {\n g.__pithyComponentContext = originalContext;\n g.__pithyRenderingComponent = wasRendering;\n g.__pithyProjectedChildren = prevInjection;\n invoking = false;\n }\n });\n } catch (err) {\n if (boundary) {\n const error = err instanceof Error ? err : new Error(String(err));\n // See `setBoundaryError`: an already-active boundary with no free ancestor\n // drops the error rather than taking it, which is the normal case for a\n // component rendering inside that boundary's `@fallback`.\n reportComponentFailure(el, d.tag, error, boundary);\n return;\n }\n\n // No boundary in scope *yet*. Degrade in both modes — an AOT branch\n // factory renders detached, so `closest()` here cannot see a boundary the\n // element will sit under once the branch is inserted, and throwing would\n // only be swallowed by the structural handler's own catch\n // (`applyStructural.ts`) anyway.\n //\n // A static/server render records the crash instead: dropping the component\n // silently shipped HTML with <${d.tag}> left raw while `pithy-ssg` counted\n // the route as rendered and exited 0 (BUG-018). Anything still recorded\n // when the render finishes fails the route.\n //\n // Note this path cannot reach a boundary at all when the element is inside\n // a detached structural branch: `el.closest('[data-error]')` above found\n // nothing, and no later pass re-binds it, so the boundary never receives\n // the error even though the nodes are inserted underneath it. That is\n // BUG-023; recording is what stops it from shipping silently.\n reportComponentFailure(\n el,\n d.tag,\n err instanceof Error ? err : new Error(String(err)),\n null\n );\n\n console.error(`[AOT] Component <${d.tag}> crashed:`, err);\n return;\n }\n\n if (\n !out ||\n typeof out !== 'object' ||\n !('el' in out) ||\n !isRenderableComponentEl(out.el, el)\n ) {\n // Not a throw, but the same outcome: the raw <${d.tag}> is left in place\n // and the subtree never renders, which under SSR is content silently\n // missing from the emitted HTML. Recorded exactly like a crash (BUG-018).\n // Same funnel as a throw — see `bindComponentTags`. Recording without\n // offering it to the boundary left an AOT component under `@error-boundary`\n // failing its route with the boundary signal unset.\n reportComponentFailure(\n el,\n d.tag,\n new Error(\n `Invalid render result from <${d.tag}>; expected { el, destroy }`\n ),\n boundary\n );\n disposeSetup?.();\n return;\n }\n\n const { el: renderedEl, destroy } = out;\n\n // Capture rendered root element before fragment is consumed by replaceWith\n const forwardedClass = el.getAttribute('class');\n const forwardedAttrs = collectForwardedAttrs(el);\n const renderedRoot: HTMLElement | null =\n renderedEl instanceof DocumentFragment\n ? (renderedEl.firstElementChild as HTMLElement | null)\n : renderedEl instanceof HTMLElement\n ? renderedEl\n : null;\n\n const nodes =\n renderedEl instanceof DocumentFragment\n ? Array.from(renderedEl.childNodes)\n : [renderedEl];\n let replaced = true;\n try {\n el.replaceWith(...nodes);\n } catch (err) {\n // The raw <${d.tag}> is left exactly where a crash would have left it, so\n // this is the same content loss and is recorded the same way.\n replaced = false;\n reportComponentFailure(\n el,\n d.tag,\n err instanceof Error ? err : new Error(String(err)),\n boundary\n );\n console.error(`[AOT] Failed to replace <${d.tag}>:`, err);\n }\n\n // Retracted only here, and in the boundary catch above. This is the point at\n // which the component is known to have produced a usable node AND to have\n // reached the document.\n if (isSSRMode() && replaced) clearSSRRenderCrash(el);\n\n if (forwardedClass && renderedRoot) {\n for (const cls of forwardedClass.split(/\\s+/)) {\n if (cls) renderedRoot.classList.add(cls);\n }\n }\n\n if (forwardedAttrs.length > 0 && renderedRoot) {\n applyForwardedAttrs(renderedRoot, forwardedAttrs, d.tag);\n }\n\n // Re-target the component pid to the rendered root so subsequent binding\n // passes (event, bound, class, style) apply to the component's actual DOM\n // element. This matches the JIT path where data-on-* attributes are\n // forwarded from the placeholder to the rendered root.\n if (renderedRoot) {\n pidMap.set(d.pid, renderedRoot);\n } else {\n if (\n import.meta.env?.DEV &&\n (forwardedClass ||\n forwardedAttrs.length > 0 ||\n (d.props && Object.keys(d.props).length > 0))\n ) {\n console.warn(\n `[AOT] <${d.tag}> has forwarded attributes but returns a fragment with no single root element — forwarding skipped.`\n );\n }\n pidMap.delete(d.pid);\n }\n\n if (disposeSetup) disposers.push(disposeSetup);\n if (typeof destroy === 'function') disposers.push(destroy);\n return replaced ? nodes : undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyDefer.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyDefer.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AASzD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,
|
|
1
|
+
{"version":3,"file":"applyDefer.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindings/applyDefer.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AASzD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,SAAS,EACZ,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAkfN"}
|