@pithyjs/core 0.1.0-beta.2 → 0.1.0-beta.21
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 +46 -8
- package/dist/a11y/focus-trap.d.ts +11 -3
- package/dist/a11y/focus-trap.d.ts.map +1 -1
- package/dist/a11y/focus-trap.js +55 -10
- 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 +137 -183
- package/dist/compile/bindSwitchCases.js.map +1 -1
- package/dist/compile/binds/bindAfterComponents.d.ts +4 -0
- package/dist/compile/binds/bindAfterComponents.d.ts.map +1 -0
- package/dist/compile/binds/bindAfterComponents.js +26 -0
- package/dist/compile/binds/bindAfterComponents.js.map +1 -0
- package/dist/compile/binds/bindAfterProjection.d.ts +7 -0
- package/dist/compile/binds/bindAfterProjection.d.ts.map +1 -0
- package/dist/compile/binds/bindAfterProjection.js +15 -0
- package/dist/compile/binds/bindAfterProjection.js.map +1 -0
- package/dist/compile/binds/bindBoundAttributes.d.ts +8 -0
- package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -1
- package/dist/compile/binds/bindBoundAttributes.js +227 -21
- package/dist/compile/binds/bindBoundAttributes.js.map +1 -1
- package/dist/compile/binds/bindClassDirectives.d.ts +3 -2
- package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindClassDirectives.js +58 -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 +186 -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 +21 -19
- package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.d.ts +61 -0
- package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.js +272 -16
- package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
- package/dist/compile/binds/bindEventHandlers.d.ts.map +1 -1
- package/dist/compile/binds/bindEventHandlers.js +15 -5
- package/dist/compile/binds/bindEventHandlers.js.map +1 -1
- package/dist/compile/binds/bindRefDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindRefDirectives.js +2 -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 +48 -0
- package/dist/compile/binds/bindStyleDirectives.js.map +1 -0
- package/dist/compile/binds/bindTextInterpolations.d.ts +4 -2
- package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -1
- package/dist/compile/binds/bindTextInterpolations.js +87 -35
- package/dist/compile/binds/bindTextInterpolations.js.map +1 -1
- package/dist/compile/binds/declaredDirective.d.ts +12 -0
- package/dist/compile/binds/declaredDirective.d.ts.map +1 -0
- package/dist/compile/binds/declaredDirective.js +42 -0
- package/dist/compile/binds/declaredDirective.js.map +1 -0
- package/dist/compile/binds/directiveRegistry.js.map +1 -1
- package/dist/compile/binds/forwardedAttrs.d.ts +4 -2
- package/dist/compile/binds/forwardedAttrs.d.ts.map +1 -1
- package/dist/compile/binds/forwardedAttrs.js +10 -2
- package/dist/compile/binds/forwardedAttrs.js.map +1 -1
- 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/binds/staleRowProps.d.ts +9 -0
- package/dist/compile/binds/staleRowProps.d.ts.map +1 -0
- package/dist/compile/binds/staleRowProps.js +86 -0
- package/dist/compile/binds/staleRowProps.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 +16 -7
- 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 +36 -54
- package/dist/compile/compileTemplate.js.map +1 -1
- package/dist/compile/componentResult.js.map +1 -1
- package/dist/compile/contentProjection.d.ts +15 -3
- package/dist/compile/contentProjection.d.ts.map +1 -1
- package/dist/compile/contentProjection.js +90 -9
- package/dist/compile/contentProjection.js.map +1 -1
- package/dist/compile/disposeOrder.d.ts +35 -0
- package/dist/compile/disposeOrder.d.ts.map +1 -0
- package/dist/compile/disposeOrder.js +81 -0
- package/dist/compile/disposeOrder.js.map +1 -0
- package/dist/compile/evalDiagnostics.d.ts +7 -0
- package/dist/compile/evalDiagnostics.d.ts.map +1 -0
- package/dist/compile/evalDiagnostics.js +8 -0
- package/dist/compile/evalDiagnostics.js.map +1 -0
- package/dist/compile/forLoops/bindForLoops.d.ts +3 -3
- package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -1
- package/dist/compile/forLoops/bindForLoops.js +18 -13
- package/dist/compile/forLoops/bindForLoops.js.map +1 -1
- package/dist/compile/forLoops/createLoopManager.d.ts +3 -3
- package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
- package/dist/compile/forLoops/createLoopManager.js +44 -26
- 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.js.map +1 -1
- package/dist/compile/forLoops/loopSignals.d.ts.map +1 -1
- package/dist/compile/forLoops/loopSignals.js +15 -1
- 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 +23 -89
- package/dist/compile/handleConditionalChain.js.map +1 -1
- package/dist/compile/index.d.ts +17 -17
- package/dist/compile/index.js +14 -14
- package/dist/compile/index.js.map +1 -1
- package/dist/compile/injectScopedStyle.js.map +1 -1
- package/dist/compile/nodeExpando.d.ts +28 -0
- package/dist/compile/nodeExpando.d.ts.map +1 -1
- package/dist/compile/nodeExpando.js +12 -0
- package/dist/compile/nodeExpando.js.map +1 -1
- package/dist/compile/parseHtml.js +12 -6
- package/dist/compile/parseHtml.js.map +1 -1
- package/dist/compile/pithyTreeToDom.d.ts.map +1 -1
- package/dist/compile/pithyTreeToDom.js +17 -12
- 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 +72 -0
- package/dist/compile/renderBranch.js.map +1 -0
- package/dist/compile/renderChildren.d.ts +12 -2
- package/dist/compile/renderChildren.d.ts.map +1 -1
- package/dist/compile/renderChildren.js +33 -4
- package/dist/compile/renderChildren.js.map +1 -1
- package/dist/compile/ssrCrashes.d.ts +65 -37
- package/dist/compile/ssrCrashes.d.ts.map +1 -1
- package/dist/compile/ssrCrashes.js +344 -39
- package/dist/compile/ssrCrashes.js.map +1 -1
- 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 +9 -5
- package/dist/runtime/applyBindings.d.ts.map +1 -1
- package/dist/runtime/applyBindings.js +130 -43
- 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 +143 -87
- 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 +16 -15
- package/dist/runtime/bindings/applyDefer.js.map +1 -1
- package/dist/runtime/bindings/applySimple.d.ts +10 -1
- package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
- package/dist/runtime/bindings/applySimple.js +117 -46
- 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 +140 -124
- package/dist/runtime/bindings/applyStructural.js.map +1 -1
- package/dist/runtime/bindings/helpers.d.ts +8 -1
- package/dist/runtime/bindings/helpers.d.ts.map +1 -1
- package/dist/runtime/bindings/helpers.js +36 -2
- 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 +2 -0
- 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.js +7 -7
- package/dist/runtime/html.js.map +1 -1
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.js +6 -6
- 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 +1 -1
- package/dist/runtime/resource/createAction.js +1 -1
- package/dist/runtime/resource/createAction.js.map +1 -1
- package/dist/runtime/resource/createResource.d.ts +1 -1
- package/dist/runtime/resource/createResource.d.ts.map +1 -1
- package/dist/runtime/resource/createResource.js +3 -4
- package/dist/runtime/resource/createResource.js.map +1 -1
- package/dist/runtime/resource/engine.d.ts +1 -1
- package/dist/runtime/resource/engine.js.map +1 -1
- package/dist/runtime/resource/index.d.ts +3 -3
- package/dist/runtime/resource/index.js +2 -2
- package/dist/runtime/resource/index.js.map +1 -1
- package/dist/runtime/resource/types.js.map +1 -1
- package/dist/types/globals.d.ts +10 -2
- package/dist/types/globals.d.ts.map +1 -1
- package/dist/types/globals.js.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 +11 -6
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"category": "runtime"
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
|
-
import { type Desc, type EventDesc, type InterpDesc, type ClassDesc, type ClassesDesc, type StyleDesc, type BoundDesc, type RefDesc, type BindDesc, type CompDesc, type DeferDesc, type ErrorDesc, type ProjDesc, type IfDesc, type ForDesc, type SwitchDesc } from './bindings';
|
|
8
|
+
import { type Desc, type EventDesc, type InterpDesc, type ClassDesc, type ClassesDesc, type StyleDesc, type BoundDesc, type RefDesc, type BindDesc, type CompDesc, type DeferDesc, type ErrorDesc, type ProjDesc, type IfDesc, type ForDesc, type SwitchDesc } from './bindings/index.js';
|
|
9
9
|
export type { Desc, EventDesc, InterpDesc, ClassDesc, ClassesDesc, StyleDesc, BoundDesc, RefDesc, BindDesc, CompDesc, DeferDesc, ErrorDesc, ProjDesc, IfDesc, ForDesc, SwitchDesc, };
|
|
10
10
|
/**
|
|
11
11
|
* Applies pre-extracted binding descriptors to an AOT-generated DOM fragment.
|
|
@@ -18,18 +18,22 @@ export type { Desc, EventDesc, InterpDesc, ClassDesc, ClassesDesc, StyleDesc, Bo
|
|
|
18
18
|
* **Binding order** mirrors (but is not identical to) bindTemplateDirectives:
|
|
19
19
|
* 1. Structural: switch → if → for
|
|
20
20
|
* 2. Non-structural: ref → error → projection → component → bind →
|
|
21
|
-
* interpolation → event → class → classes → style → bound attr →
|
|
21
|
+
* interpolation → event → class → classes → style → bound attr →
|
|
22
|
+
* custom directives → defer
|
|
22
23
|
*
|
|
23
24
|
* Differences from JIT bindTemplateDirectives:
|
|
24
25
|
* - AOT has an explicit `style` phase (JIT folds inline styles into bound attrs)
|
|
25
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* Custom directives (registered via `registerDirectiveBinder`, e.g. the
|
|
28
|
+
* router's `@routerLink`) run even when `bindings` is empty: codegen emits no
|
|
29
|
+
* descriptor for them, only the `data-*` marker attribute.
|
|
26
30
|
*
|
|
27
31
|
* @param fragment - DOM fragment created by the AOT factory function
|
|
28
32
|
* @param bindings - Array of binding descriptors from codegen
|
|
29
33
|
* @param context - Reactive context object with signals, methods, components
|
|
30
34
|
*/
|
|
31
|
-
/** @codexApi {"parent":"pithy.runtime.apply-bindings","name":"__applyBindings","stability":"experimental","signature":"(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown
|
|
32
|
-
export declare function __applyBindings(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown
|
|
35
|
+
/** @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 }"} */
|
|
36
|
+
export declare function __applyBindings(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown>, ownsDestroyCallbacks?: boolean): {
|
|
33
37
|
el: DocumentFragment;
|
|
34
38
|
destroy: () => void;
|
|
35
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyBindings.d.ts","sourceRoot":"","sources":["../../src/runtime/applyBindings.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;
|
|
1
|
+
{"version":3,"file":"applyBindings.d.ts","sourceRoot":"","sources":["../../src/runtime/applyBindings.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAWF,OAAO,EAsBL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,UAAU,EAChB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,GACX,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,8RAA8R;AAC9R,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,IAAI,EAAE,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,oBAAoB,UAAO,GAC1B;IAAE,EAAE,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAI/C"}
|
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
"category": "runtime"
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
|
-
import { drainDestroyCallbacks } from './onDestroy';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { drainDestroyCallbacks } from './onDestroy.js';
|
|
9
|
+
import { forgetCrash, resolveAttributedCrashes, withinRender, } from '../compile/ssrCrashes.js';
|
|
10
|
+
import { nodeExpando } from '../compile/nodeExpando.js';
|
|
11
|
+
import { orderByDocument } from '../compile/disposeOrder.js';
|
|
12
|
+
import { executeCustomDirectiveBinders } from '../compile/binds/directiveRegistry.js';
|
|
13
|
+
import { buildPidMap, buildCommentMap, mergeContexts, nearestCtx, applyRef, applyError, markBoundary, applyProjection, applyComponent, applyBind, applyInterpolation, markSkeletonText, applyEvent, applyClass, applyClasses, applyStyle, applyBound, applyIf, applyFor, applySwitch, applyDefer, } from './bindings/index.js';
|
|
11
14
|
// ─── Main entry point ─────────────────────────────────────────────────────────
|
|
12
15
|
/**
|
|
13
16
|
* Applies pre-extracted binding descriptors to an AOT-generated DOM fragment.
|
|
@@ -20,24 +23,45 @@ import { buildPidMap, buildCommentMap, mergeContexts, applyRef, applyError, appl
|
|
|
20
23
|
* **Binding order** mirrors (but is not identical to) bindTemplateDirectives:
|
|
21
24
|
* 1. Structural: switch → if → for
|
|
22
25
|
* 2. Non-structural: ref → error → projection → component → bind →
|
|
23
|
-
* interpolation → event → class → classes → style → bound attr →
|
|
26
|
+
* interpolation → event → class → classes → style → bound attr →
|
|
27
|
+
* custom directives → defer
|
|
24
28
|
*
|
|
25
29
|
* Differences from JIT bindTemplateDirectives:
|
|
26
30
|
* - AOT has an explicit `style` phase (JIT folds inline styles into bound attrs)
|
|
27
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* Custom directives (registered via `registerDirectiveBinder`, e.g. the
|
|
33
|
+
* router's `@routerLink`) run even when `bindings` is empty: codegen emits no
|
|
34
|
+
* descriptor for them, only the `data-*` marker attribute.
|
|
28
35
|
*
|
|
29
36
|
* @param fragment - DOM fragment created by the AOT factory function
|
|
30
37
|
* @param bindings - Array of binding descriptors from codegen
|
|
31
38
|
* @param context - Reactive context object with signals, methods, components
|
|
32
39
|
*/
|
|
33
|
-
/** @codexApi {"parent":"pithy.runtime.apply-bindings","name":"__applyBindings","stability":"experimental","signature":"(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown
|
|
34
|
-
export function __applyBindings(fragment, bindings, context) {
|
|
40
|
+
/** @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 }"} */
|
|
41
|
+
export function __applyBindings(fragment, bindings, context, ownsDestroyCallbacks = true) {
|
|
42
|
+
return withinRender(() => applyBindings(fragment, bindings, context, ownsDestroyCallbacks));
|
|
43
|
+
}
|
|
44
|
+
function applyBindings(fragment, bindings, context, ownsDestroyCallbacks) {
|
|
35
45
|
// Drain onDestroy() callbacks BEFORE processing bindings — child components
|
|
36
46
|
// instantiated during binding will drain their own callbacks independently.
|
|
37
|
-
const destroyCallbacks = drainDestroyCallbacks();
|
|
47
|
+
const destroyCallbacks = ownsDestroyCallbacks ? drainDestroyCallbacks() : [];
|
|
38
48
|
const disposers = [];
|
|
39
|
-
// Merge parent component + async (SSR) contexts — AOT factories bypass html()
|
|
49
|
+
// Merge parent component + async (SSR) contexts — AOT factories bypass html().
|
|
50
|
+
// Before the empty-bindings branch: custom binders must see the same context
|
|
51
|
+
// whether or not the template also carries an ordinary descriptor.
|
|
40
52
|
const ctx = mergeContexts(context);
|
|
53
|
+
if (bindings.length === 0) {
|
|
54
|
+
try {
|
|
55
|
+
executeCustomDirectiveBinders(fragment, ctx, disposers);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
unwind(disposers, destroyCallbacks);
|
|
59
|
+
throw err;
|
|
60
|
+
}
|
|
61
|
+
return bindingsResult(fragment, disposers, destroyCallbacks);
|
|
62
|
+
}
|
|
63
|
+
if (bindings.some(d => d.t === 'interp'))
|
|
64
|
+
markSkeletonText(fragment);
|
|
41
65
|
// Build lookup maps
|
|
42
66
|
const pidMap = buildPidMap(fragment);
|
|
43
67
|
const commentMap = buildCommentMap(fragment);
|
|
@@ -51,6 +75,12 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
51
75
|
try {
|
|
52
76
|
// ─── Phase 1: Structural directives (shape-changing) ─────────────────
|
|
53
77
|
// Order: switch → if → for (matches bindStructuralDirectives)
|
|
78
|
+
// Marked, not registered: a branch built below must `closest()` its boundary.
|
|
79
|
+
for (const d of (byType.get('error') ?? [])) {
|
|
80
|
+
const el = pidMap.get(d.pid);
|
|
81
|
+
if (el)
|
|
82
|
+
markBoundary(d, el);
|
|
83
|
+
}
|
|
54
84
|
for (const d of (byType.get('switch') ?? [])) {
|
|
55
85
|
applySwitch(d, pidMap, ctx, disposers);
|
|
56
86
|
}
|
|
@@ -76,7 +106,62 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
76
106
|
for (const d of (byType.get('proj') ?? [])) {
|
|
77
107
|
applyProjection(d, commentMap, ctx, disposers);
|
|
78
108
|
}
|
|
79
|
-
|
|
109
|
+
// A placeholder that reaches a runtime-compiled component's binder (slot
|
|
110
|
+
// content serialized into a descriptor without `slots`, or a failed
|
|
111
|
+
// render left in place) is rendered through this hook, in the context it
|
|
112
|
+
// was written in.
|
|
113
|
+
const comps = (byType.get('comp') ?? []);
|
|
114
|
+
const mounted = new Set();
|
|
115
|
+
const binds = new Map();
|
|
116
|
+
const live = new Map();
|
|
117
|
+
// A placeholder that failed stays put, and every enclosing slot's pass
|
|
118
|
+
// finds it again; a re-mount moves it first. One this pass already
|
|
119
|
+
// rendered is never retried (`true`).
|
|
120
|
+
const failedIn = new Map();
|
|
121
|
+
for (const d of comps) {
|
|
122
|
+
const el = pidMap.get(d.pid);
|
|
123
|
+
if (!el)
|
|
124
|
+
continue;
|
|
125
|
+
const scope = nearestCtx(el, ctx);
|
|
126
|
+
binds.set(d.pid, []);
|
|
127
|
+
nodeExpando(el).__pithyAotMount = slotDisposers => {
|
|
128
|
+
mounted.add(d);
|
|
129
|
+
const failed = failedIn.get(d);
|
|
130
|
+
if (failed === true || (failed && el.parentNode === failed))
|
|
131
|
+
return [];
|
|
132
|
+
const nodes = applyComponent(d, el, ctx, slotDisposers, pidMap, scope);
|
|
133
|
+
failedIn.set(d, nodes ? null : el.parentNode);
|
|
134
|
+
// On failure `pidMap` still holds the previous root.
|
|
135
|
+
const root = nodes && pidMap.get(d.pid);
|
|
136
|
+
if (!nodes || !root)
|
|
137
|
+
return nodes ?? [];
|
|
138
|
+
const mount = { root, ds: slotDisposers };
|
|
139
|
+
live.set(d.pid, mount);
|
|
140
|
+
// A slot closed before a later binding is queued must not receive it.
|
|
141
|
+
slotDisposers.push(() => {
|
|
142
|
+
if (live.get(d.pid) === mount)
|
|
143
|
+
live.delete(d.pid);
|
|
144
|
+
});
|
|
145
|
+
for (const bind of binds.get(d.pid) ?? [])
|
|
146
|
+
bind(root, slotDisposers);
|
|
147
|
+
return nodes;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
const forwarded = (pid, bind) => {
|
|
151
|
+
const stored = binds.get(pid);
|
|
152
|
+
const mount = live.get(pid);
|
|
153
|
+
stored?.push(bind);
|
|
154
|
+
if (mount)
|
|
155
|
+
bind(mount.root, mount.ds);
|
|
156
|
+
else if (!stored) {
|
|
157
|
+
const el = pidMap.get(pid);
|
|
158
|
+
if (el)
|
|
159
|
+
bind(el, disposers);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
for (const d of comps) {
|
|
163
|
+
if (mounted.has(d))
|
|
164
|
+
continue;
|
|
80
165
|
const el = pidMap.get(d.pid);
|
|
81
166
|
// `pidMap` is built once, up front. An activated `@error-boundary`
|
|
82
167
|
// detaches its normal children, so a later sibling's placeholder can
|
|
@@ -90,15 +175,18 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
90
175
|
// subtree: that calls `applyBindings` with the branch's OWN fragment as
|
|
91
176
|
// `fragment`, so its placeholders are inside it and still bind.
|
|
92
177
|
if (el && fragment.contains(el)) {
|
|
93
|
-
applyComponent(d, el, ctx, disposers, pidMap)
|
|
178
|
+
if (!applyComponent(d, el, ctx, disposers, pidMap))
|
|
179
|
+
failedIn.set(d, true);
|
|
180
|
+
binds.delete(d.pid);
|
|
94
181
|
}
|
|
95
182
|
else if (el) {
|
|
96
183
|
// Left the tree, so it contributes nothing to the output — and any crash
|
|
97
184
|
// recorded for it on an earlier detached pass is stale. Same reasoning
|
|
98
185
|
// as the `scope.contains(el)` skip in `bindComponentTags`.
|
|
99
|
-
|
|
186
|
+
forgetCrash(el);
|
|
100
187
|
}
|
|
101
188
|
}
|
|
189
|
+
resolveAttributedCrashes('render', fragment);
|
|
102
190
|
for (const d of (byType.get('bind') ?? [])) {
|
|
103
191
|
const el = pidMap.get(d.pid);
|
|
104
192
|
if (el)
|
|
@@ -111,56 +199,54 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
111
199
|
applyInterpolation(d, el, ctx, disposers);
|
|
112
200
|
}
|
|
113
201
|
for (const d of (byType.get('event') ?? [])) {
|
|
114
|
-
|
|
115
|
-
if (el)
|
|
116
|
-
applyEvent(d, el, ctx, disposers);
|
|
202
|
+
forwarded(d.pid, (el, ds) => applyEvent(d, el, ctx, ds));
|
|
117
203
|
}
|
|
118
204
|
for (const d of (byType.get('class') ?? [])) {
|
|
119
|
-
|
|
120
|
-
if (el)
|
|
121
|
-
applyClass(d, el, ctx, disposers);
|
|
205
|
+
forwarded(d.pid, (el, ds) => applyClass(d, el, ctx, ds));
|
|
122
206
|
}
|
|
123
207
|
for (const d of (byType.get('classes') ?? [])) {
|
|
124
|
-
|
|
125
|
-
if (el)
|
|
126
|
-
applyClasses(d, el, ctx, disposers);
|
|
208
|
+
forwarded(d.pid, (el, ds) => applyClasses(d, el, ctx, ds));
|
|
127
209
|
}
|
|
128
210
|
for (const d of (byType.get('style') ?? [])) {
|
|
129
|
-
|
|
130
|
-
if (el)
|
|
131
|
-
applyStyle(d, el, ctx, disposers);
|
|
211
|
+
forwarded(d.pid, (el, ds) => applyStyle(d, el, ctx, ds));
|
|
132
212
|
}
|
|
133
213
|
for (const d of (byType.get('bound') ?? [])) {
|
|
134
|
-
|
|
135
|
-
if (el)
|
|
136
|
-
applyBound(d, el, ctx, disposers);
|
|
214
|
+
forwarded(d.pid, (el, ds) => applyBound(d, el, ctx, ds));
|
|
137
215
|
}
|
|
216
|
+
executeCustomDirectiveBinders(fragment, ctx, disposers);
|
|
138
217
|
for (const d of (byType.get('defer') ?? [])) {
|
|
139
218
|
const el = pidMap.get(d.pid);
|
|
140
219
|
if (el)
|
|
141
220
|
applyDefer(d, el, ctx, disposers);
|
|
142
221
|
}
|
|
222
|
+
orderByDocument(disposers);
|
|
143
223
|
}
|
|
144
224
|
catch (err) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
225
|
+
unwind(disposers, destroyCallbacks);
|
|
226
|
+
throw err;
|
|
227
|
+
}
|
|
228
|
+
return bindingsResult(fragment, disposers, destroyCallbacks);
|
|
229
|
+
}
|
|
230
|
+
/** Runs everything registered so far after a partial bind fails. */
|
|
231
|
+
function unwind(disposers, destroyCallbacks) {
|
|
232
|
+
for (let i = disposers.length - 1; i >= 0; i--) {
|
|
233
|
+
try {
|
|
234
|
+
disposers[i]();
|
|
153
235
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
destroyCallbacks[i]();
|
|
157
|
-
}
|
|
158
|
-
catch {
|
|
159
|
-
/* ignore */
|
|
160
|
-
}
|
|
236
|
+
catch {
|
|
237
|
+
/* ignore */
|
|
161
238
|
}
|
|
162
|
-
throw err;
|
|
163
239
|
}
|
|
240
|
+
for (let i = destroyCallbacks.length - 1; i >= 0; i--) {
|
|
241
|
+
try {
|
|
242
|
+
destroyCallbacks[i]();
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
/* ignore */
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
function bindingsResult(fragment, disposers, destroyCallbacks) {
|
|
164
250
|
return {
|
|
165
251
|
el: fragment,
|
|
166
252
|
destroy() {
|
|
@@ -183,6 +269,7 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
183
269
|
/* ignore disposal errors */
|
|
184
270
|
}
|
|
185
271
|
}
|
|
272
|
+
destroyCallbacks.length = 0;
|
|
186
273
|
},
|
|
187
274
|
};
|
|
188
275
|
}
|
|
@@ -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,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACL,WAAW,EACX,eAAe,EACf,aAAa,EACb,QAAQ,EACR,UAAU,EACV,eAAe,EACf,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,WAAW,EACX,UAAU,GAiBX,MAAM,YAAY,CAAC;AAsBpB,iFAAiF;AAEjF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,8PAA8P;AAC9P,MAAM,UAAU,eAAe,CAC7B,QAA0B,EAC1B,QAAgB,EAChB,OAAgC;IAEhC,4EAA4E;IAC5E,4EAA4E;IAC5E,MAAM,gBAAgB,GAAG,qBAAqB,EAAE,CAAC;IAEjD,MAAM,SAAS,GAAmB,EAAE,CAAC;IAErC,8EAA8E;IAC9E,MAAM,GAAG,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEnC,oBAAoB;IACpB,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAE7C,mDAAmD;IACnD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,CAAC,IAAI,QAAkB,EAAE,CAAC;QACnC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACb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,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;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 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(d, el, ctx, slotDisposers, pidMap, scope);\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 (!applyComponent(d, el, ctx, disposers, pidMap))\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,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":"AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAgB,MAAM,SAAS,CAAC;AA+ItE,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,CA2PpB"}
|