@pithyjs/core 0.1.0-beta.5 → 0.1.0-beta.9
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 +3 -1
- 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/compile/bindSwitchCases.d.ts.map +1 -1
- package/dist/compile/bindSwitchCases.js +23 -64
- 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 +1 -0
- package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindClassDirectives.js +22 -8
- 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 +74 -46
- package/dist/compile/binds/bindComponentsTags.js.map +1 -1
- package/dist/compile/binds/bindConditionals.d.ts.map +1 -1
- package/dist/compile/binds/bindConditionals.js +15 -2
- package/dist/compile/binds/bindConditionals.js.map +1 -1
- package/dist/compile/binds/bindDeferDirectives.js +4 -4
- package/dist/compile/binds/bindEventHandlers.js +2 -2
- package/dist/compile/binds/bindStyleDirectives.d.ts +2 -0
- package/dist/compile/binds/bindStyleDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindStyleDirectives.js +11 -5
- package/dist/compile/binds/bindStyleDirectives.js.map +1 -1
- 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 +54 -16
- package/dist/compile/binds/bindTextInterpolations.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/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.map +1 -1
- package/dist/compile/compileTemplate.js +17 -16
- package/dist/compile/compileTemplate.js.map +1 -1
- package/dist/compile/contentProjection.d.ts.map +1 -1
- package/dist/compile/contentProjection.js +15 -5
- package/dist/compile/contentProjection.js.map +1 -1
- package/dist/compile/forLoops/bindForLoops.js +6 -6
- package/dist/compile/forLoops/createLoopManager.d.ts +2 -2
- package/dist/compile/forLoops/createLoopManager.js +10 -10
- package/dist/compile/forLoops/index.d.ts +5 -5
- package/dist/compile/forLoops/index.js +5 -5
- package/dist/compile/handleConditionalChain.d.ts.map +1 -1
- package/dist/compile/handleConditionalChain.js +21 -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/nodeExpando.d.ts +2 -0
- package/dist/compile/nodeExpando.d.ts.map +1 -1
- package/dist/compile/nodeExpando.js.map +1 -1
- package/dist/compile/parseHtml.js +1 -1
- package/dist/compile/pithyTreeToDom.js +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 +2 -2
- package/dist/compile/renderChildren.js +2 -2
- package/dist/compile/ssrCrashes.d.ts +1 -1
- package/dist/compile/ssrCrashes.js +3 -3
- package/dist/compile/ssrMode.js +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/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/interfaces/index.d.ts +2 -2
- package/dist/interfaces/index.js +2 -2
- package/dist/runtime/applyBindings.d.ts +3 -3
- package/dist/runtime/applyBindings.d.ts.map +1 -1
- package/dist/runtime/applyBindings.js +12 -6
- package/dist/runtime/applyBindings.js.map +1 -1
- package/dist/runtime/bindings/applyComponent.d.ts +1 -1
- package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
- package/dist/runtime/bindings/applyComponent.js +34 -24
- package/dist/runtime/bindings/applyComponent.js.map +1 -1
- package/dist/runtime/bindings/applyDefer.d.ts +1 -1
- package/dist/runtime/bindings/applyDefer.js +6 -6
- package/dist/runtime/bindings/applySimple.d.ts +1 -1
- package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
- package/dist/runtime/bindings/applySimple.js +28 -10
- package/dist/runtime/bindings/applySimple.js.map +1 -1
- package/dist/runtime/bindings/applyStructural.d.ts +1 -1
- package/dist/runtime/bindings/applyStructural.js +5 -5
- package/dist/runtime/bindings/helpers.d.ts +1 -1
- package/dist/runtime/bindings/helpers.js +1 -1
- package/dist/runtime/bindings/index.d.ts +6 -6
- package/dist/runtime/bindings/index.js +5 -5
- package/dist/runtime/bootstrap.d.ts +1 -1
- package/dist/runtime/bootstrap.js +1 -1
- package/dist/runtime/deferHelpers.d.ts +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 -6
- package/dist/runtime/index.js +6 -6
- package/dist/runtime/lazy.js +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/resource/createAction.d.ts +1 -1
- package/dist/runtime/resource/createAction.js +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/index.d.ts +3 -3
- package/dist/runtime/resource/index.js +2 -2
- package/dist/types/globals.d.ts +2 -2
- package/dist/utilities/index.d.ts +2 -2
- package/dist/utilities/index.js +2 -2
- package/dist/utilities/ref-signal.utility.d.ts +1 -1
- package/dist/utilities/ref.untility.d.ts +1 -1
- package/package.json +11 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleConditionalChain.js","sourceRoot":"","sources":["../../src/compile/handleConditionalChain.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"handleConditionalChain.js","sourceRoot":"","sources":["../../src/compile/handleConditionalChain.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAe,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;GAGG;AACH,4RAA4R;AAC5R,MAAM,UAAU,sBAAsB,CACpC,QAAuB,EACvB,QAAqB,EACrB,GAA4B,EAC5B,mBAAgC,IAAI,GAAG,EAAE,EACzC,YAA4B,EAAE;IAE9B,oDAAoD;IACpD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3D,+EAA+E;IAC/E,MAAM,WAAW,G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CAAC;YAEvC,4CAA4C;YAC5C,IAAI,UAAU,KAAK,kBAAkB,EAAE,CAAC;gBACtC,OAAO;YACT,CAAC;YAED,kCAAkC;YAClC,kBAAkB,GAAG,UAAU,CAAC;YAEhC,gEAAgE;YAChE,kBAAkB,EAAE,CAAC;YACrB,OAAO,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;YAE1C,4DAA4D;YAC5D,8DAA8D;YAC9D,iEAAiE;YACjE,mFAAmF;QACrF,CAAC,CAAC,CAAC;QAEH,8DAA8D;QAC9D,yEAAyE;QACzE,gEAAgE;QAChE,SAAS,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACnC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
package/dist/compile/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export { compileTemplate } from './compileTemplate';
|
|
2
|
-
export { compileNodes } from './compileNodes';
|
|
3
|
-
export { renderChildren, captureChildren, readChildPayload, type ChildPayload, } from './renderChildren';
|
|
4
|
-
export { injectScopedStyle } from './injectScopedStyle';
|
|
5
|
-
export { bindTextInterpolations } from './binds/bindTextInterpolations';
|
|
6
|
-
export { bindEventHandlers } from './binds/bindEventHandlers';
|
|
7
|
-
export { bindClassDirectives } from './binds/bindClassDirectives';
|
|
8
|
-
export { bindComponentTags } from './binds/bindComponentsTags';
|
|
9
|
-
export { bindForLoops, createLoopManager, type ChildFactory, type LoopManager, } from './forLoops';
|
|
10
|
-
export { bindTemplateDirectives } from './compileTemplate';
|
|
11
|
-
export type { SlotMap } from './contentProjection';
|
|
12
|
-
export { isSSRMode } from './ssrMode';
|
|
13
|
-
export { registerDirectiveBinder, unregisterDirectiveBinder, executeCustomDirectiveBinders, type DirectiveBinder, } from './binds/directiveRegistry';
|
|
14
|
-
export { boundaryForElement, setBoundaryError, clearBoundaryError, registerBoundary, } from './binds/bindErrorBoundary';
|
|
15
|
-
export type { BoundaryInfo } from './binds/bindErrorBoundary';
|
|
16
|
-
export { collectUnhandledSSRRenderCrashes, resetSSRRenderCrashes, } from './ssrCrashes';
|
|
17
|
-
export type { SSRRenderCrash } from './ssrCrashes';
|
|
1
|
+
export { compileTemplate } from './compileTemplate.js';
|
|
2
|
+
export { compileNodes } from './compileNodes.js';
|
|
3
|
+
export { renderChildren, captureChildren, readChildPayload, type ChildPayload, } from './renderChildren.js';
|
|
4
|
+
export { injectScopedStyle } from './injectScopedStyle.js';
|
|
5
|
+
export { bindTextInterpolations } from './binds/bindTextInterpolations.js';
|
|
6
|
+
export { bindEventHandlers } from './binds/bindEventHandlers.js';
|
|
7
|
+
export { bindClassDirectives } from './binds/bindClassDirectives.js';
|
|
8
|
+
export { bindComponentTags } from './binds/bindComponentsTags.js';
|
|
9
|
+
export { bindForLoops, createLoopManager, type ChildFactory, type LoopManager, } from './forLoops/index.js';
|
|
10
|
+
export { bindTemplateDirectives } from './compileTemplate.js';
|
|
11
|
+
export type { SlotMap } from './contentProjection.js';
|
|
12
|
+
export { isSSRMode } from './ssrMode.js';
|
|
13
|
+
export { registerDirectiveBinder, unregisterDirectiveBinder, executeCustomDirectiveBinders, type DirectiveBinder, } from './binds/directiveRegistry.js';
|
|
14
|
+
export { boundaryForElement, setBoundaryError, clearBoundaryError, registerBoundary, } from './binds/bindErrorBoundary.js';
|
|
15
|
+
export type { BoundaryInfo } from './binds/bindErrorBoundary.js';
|
|
16
|
+
export { collectUnhandledSSRRenderCrashes, resetSSRRenderCrashes, } from './ssrCrashes.js';
|
|
17
|
+
export type { SSRRenderCrash } from './ssrCrashes.js';
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/compile/index.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
export { compileTemplate } from './compileTemplate';
|
|
2
|
-
export { compileNodes } from './compileNodes';
|
|
3
|
-
export { renderChildren, captureChildren, readChildPayload, } from './renderChildren';
|
|
1
|
+
export { compileTemplate } from './compileTemplate.js';
|
|
2
|
+
export { compileNodes } from './compileNodes.js';
|
|
3
|
+
export { renderChildren, captureChildren, readChildPayload, } from './renderChildren.js';
|
|
4
4
|
// parseHtml is NOT re-exported from this barrel to prevent parse5 from
|
|
5
5
|
// being pulled into production bundles. Use the dedicated subpath export:
|
|
6
6
|
// import { loadJITCompiler } from '@pithyjs/core/compile/parseHtml'
|
|
7
|
-
export { injectScopedStyle } from './injectScopedStyle';
|
|
7
|
+
export { injectScopedStyle } from './injectScopedStyle.js';
|
|
8
8
|
// Only export these if useful for advanced users / SSR:
|
|
9
|
-
export { bindTextInterpolations } from './binds/bindTextInterpolations';
|
|
10
|
-
export { bindEventHandlers } from './binds/bindEventHandlers';
|
|
11
|
-
export { bindClassDirectives } from './binds/bindClassDirectives';
|
|
12
|
-
export { bindComponentTags } from './binds/bindComponentsTags';
|
|
13
|
-
export { bindForLoops, createLoopManager, } from './forLoops';
|
|
14
|
-
export { bindTemplateDirectives } from './compileTemplate';
|
|
9
|
+
export { bindTextInterpolations } from './binds/bindTextInterpolations.js';
|
|
10
|
+
export { bindEventHandlers } from './binds/bindEventHandlers.js';
|
|
11
|
+
export { bindClassDirectives } from './binds/bindClassDirectives.js';
|
|
12
|
+
export { bindComponentTags } from './binds/bindComponentsTags.js';
|
|
13
|
+
export { bindForLoops, createLoopManager, } from './forLoops/index.js';
|
|
14
|
+
export { bindTemplateDirectives } from './compileTemplate.js';
|
|
15
15
|
// The explicit static-render signal. `@pithyjs/ssr`'s setupEnvironment() copies
|
|
16
16
|
// a happy-dom window onto globalThis — IntersectionObserver, requestAnimationFrame
|
|
17
17
|
// and matchMedia included — so no `typeof` feature check can distinguish a server
|
|
18
18
|
// render from a browser. Packages that must branch on it (e.g. @pithyjs/ui-kit's
|
|
19
19
|
// section entrance animations, BUG-010) read this rather than hand-rolling their
|
|
20
20
|
// own derivation of the underlying `__PITHY_SSR__` global.
|
|
21
|
-
export { isSSRMode } from './ssrMode';
|
|
21
|
+
export { isSSRMode } from './ssrMode.js';
|
|
22
22
|
// Custom directive registry - allows external packages (router, etc.) to register binders
|
|
23
|
-
export { registerDirectiveBinder, unregisterDirectiveBinder, executeCustomDirectiveBinders, } from './binds/directiveRegistry';
|
|
23
|
+
export { registerDirectiveBinder, unregisterDirectiveBinder, executeCustomDirectiveBinders, } from './binds/directiveRegistry.js';
|
|
24
24
|
// Error boundary functions for router integration:
|
|
25
|
-
export { boundaryForElement, setBoundaryError, clearBoundaryError, registerBoundary, } from './binds/bindErrorBoundary';
|
|
25
|
+
export { boundaryForElement, setBoundaryError, clearBoundaryError, registerBoundary, } from './binds/bindErrorBoundary.js';
|
|
26
26
|
// Unhandled component crashes recorded during a server render. Consumed by
|
|
27
27
|
// @pithyjs/ssr's renderToString so a crash fails its route (BUG-018).
|
|
28
28
|
//
|
|
@@ -31,5 +31,5 @@ export { boundaryForElement, setBoundaryError, clearBoundaryError, registerBound
|
|
|
31
31
|
// binders inside this package, so they are annotated `internal` rather than
|
|
32
32
|
// exported here — advertising them as stable in the generated API table while
|
|
33
33
|
// leaving them unimportable is worse than either alternative.
|
|
34
|
-
export { collectUnhandledSSRRenderCrashes, resetSSRRenderCrashes, } from './ssrCrashes';
|
|
34
|
+
export { collectUnhandledSSRRenderCrashes, resetSSRRenderCrashes, } from './ssrCrashes.js';
|
|
35
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -7,7 +7,9 @@ export interface NodeExpando {
|
|
|
7
7
|
__fallbackFactory?: () => DocumentFragment;
|
|
8
8
|
__nested?: boolean;
|
|
9
9
|
__pithySkipText?: boolean;
|
|
10
|
+
__pithyComponentDom?: boolean;
|
|
10
11
|
__styleProps?: string[];
|
|
12
|
+
__classToggles?: string[];
|
|
11
13
|
}
|
|
12
14
|
export declare function nodeExpando<T extends Node>(node: T): T & NodeExpando;
|
|
13
15
|
//# sourceMappingURL=nodeExpando.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeExpando.d.ts","sourceRoot":"","sources":["../../src/compile/nodeExpando.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,gBAAgB,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"nodeExpando.d.ts","sourceRoot":"","sources":["../../src/compile/nodeExpando.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,gBAAgB,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,WAAW,CAEpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeExpando.js","sourceRoot":"","sources":["../../src/compile/nodeExpando.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nodeExpando.js","sourceRoot":"","sources":["../../src/compile/nodeExpando.ts"],"names":[],"mappings":"AAeA,MAAM,UAAU,WAAW,CAAiB,IAAO;IACjD,OAAO,IAAuB,CAAC;AACjC,CAAC"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
8
|
import { parse5ToPithyTree, escapeComponentTags, extractOriginalTagNames, extractOriginalAttributeNames, } from '@pithyjs/compiler';
|
|
9
|
-
import { pithyTreeToDom } from './pithyTreeToDom';
|
|
9
|
+
import { pithyTreeToDom } from './pithyTreeToDom.js';
|
|
10
10
|
let _parseFragment = null;
|
|
11
11
|
let _loadPromise = null;
|
|
12
12
|
/**
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
8
|
import { SVG_TAGS, SVG_NS, forEachDirectiveAttr, } from '@pithyjs/compiler';
|
|
9
|
-
import { nodeExpando } from './nodeExpando';
|
|
9
|
+
import { nodeExpando } from './nodeExpando.js';
|
|
10
10
|
/**
|
|
11
11
|
* Converts a list of PithyNodes into a DocumentFragment of real DOM nodes.
|
|
12
12
|
* Component tags (isComponent: true) are rendered as placeholder elements.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PithyNode } from '@pithyjs/compiler';
|
|
2
|
+
export interface Branch {
|
|
3
|
+
nodes: Node[];
|
|
4
|
+
disposers: (() => void)[];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Builds the DOM for one `@if` or `@case` branch from its AST, binds it, and
|
|
8
|
+
* inserts it after `anchor`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function renderBranch(ast: PithyNode, ctx: Record<string, unknown>, anchor: Node): Branch;
|
|
11
|
+
/** Disposes a branch's effects, then removes its nodes. */
|
|
12
|
+
export declare function clearBranch(branch: Branch): void;
|
|
13
|
+
//# sourceMappingURL=renderBranch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderBranch.d.ts","sourceRoot":"","sources":["../../src/compile/renderBranch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAUnD,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,SAAS,EACd,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,MAAM,EAAE,IAAI,GACX,MAAM,CAoCR;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAahD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createRoot } from '@pithyjs/signals';
|
|
2
|
+
import { bindConditionals } from './binds/bindConditionals.js';
|
|
3
|
+
import { flashUpdate } from './binds/bindTextInterpolations.js';
|
|
4
|
+
import { bindSwitchBlock, bindSwitchCases } from './bindSwitchCases.js';
|
|
5
|
+
import { bindTemplateDirectives } from './compileTemplate.js';
|
|
6
|
+
import { bindForLoops } from './forLoops/bindForLoops.js';
|
|
7
|
+
import { pithyTreeToDom } from './pithyTreeToDom.js';
|
|
8
|
+
import { isSSRMode } from './ssrMode.js';
|
|
9
|
+
/**
|
|
10
|
+
* Builds the DOM for one `@if` or `@case` branch from its AST, binds it, and
|
|
11
|
+
* inserts it after `anchor`.
|
|
12
|
+
*/
|
|
13
|
+
export function renderBranch(ast, ctx, anchor) {
|
|
14
|
+
const branch = { nodes: [], disposers: [] };
|
|
15
|
+
const rebuilt = pithyTreeToDom([ast], ctx).firstChild;
|
|
16
|
+
if (!rebuilt || !anchor.parentNode)
|
|
17
|
+
return branch;
|
|
18
|
+
// A component tag is replaced by what it renders while binding, so the
|
|
19
|
+
// fragment, not `rebuilt`, holds the nodes to insert and later remove.
|
|
20
|
+
const fragment = document.createDocumentFragment();
|
|
21
|
+
fragment.appendChild(rebuilt);
|
|
22
|
+
const children = ast.isComponent ? [] : ast.children || [];
|
|
23
|
+
const { disposers } = branch;
|
|
24
|
+
createRoot(disposeRoot => {
|
|
25
|
+
disposers.push(disposeRoot);
|
|
26
|
+
const processed = new Set();
|
|
27
|
+
if (ast.directives?.switch !== undefined && !ast.isComponent) {
|
|
28
|
+
bindSwitchBlock(ast, rebuilt, ctx, processed, disposers);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
bindSwitchCases(children, rebuilt, ctx, processed, disposers);
|
|
32
|
+
}
|
|
33
|
+
bindConditionals(children, rebuilt, ctx, processed, disposers);
|
|
34
|
+
bindForLoops(children, rebuilt, ctx, disposers, processed);
|
|
35
|
+
bindTemplateDirectives(fragment, ctx, disposers);
|
|
36
|
+
});
|
|
37
|
+
branch.nodes = Array.from(fragment.childNodes);
|
|
38
|
+
anchor.parentNode.insertBefore(fragment, anchor.nextSibling);
|
|
39
|
+
if (!isSSRMode()) {
|
|
40
|
+
queueMicrotask(() => {
|
|
41
|
+
for (const node of branch.nodes) {
|
|
42
|
+
if (node.nodeType === Node.ELEMENT_NODE)
|
|
43
|
+
flashUpdate(node);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return branch;
|
|
48
|
+
}
|
|
49
|
+
/** Disposes a branch's effects, then removes its nodes. */
|
|
50
|
+
export function clearBranch(branch) {
|
|
51
|
+
for (const dispose of branch.disposers) {
|
|
52
|
+
try {
|
|
53
|
+
dispose();
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
/* ignore */
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
branch.disposers = [];
|
|
60
|
+
for (const node of branch.nodes) {
|
|
61
|
+
node.parentNode?.removeChild(node);
|
|
62
|
+
}
|
|
63
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C,MAAc;IACxC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACvC,IAAI,CAAC;YACH,OAAO,EAAE,CAAC;QACZ,CAAC;QAAC,MAAM,CAAC;YACP,YAAY;QACd,CAAC;IACH,CAAC;IACD,MAAM,CAAC,SAAS,GAAG,EAAE,CAAC;IACtB,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PithyNode } from '@pithyjs/compiler';
|
|
2
|
-
import { type PithyComponentContext } from '../types/globals';
|
|
3
|
-
import type { ChildFactory } from '../runtime/bindings/types';
|
|
2
|
+
import { type PithyComponentContext } from '../types/globals.js';
|
|
3
|
+
import type { ChildFactory } from '../runtime/bindings/types.js';
|
|
4
4
|
/**
|
|
5
5
|
* If the registry renderer has set `globalThis.__pithyProjectedChildren` (a
|
|
6
6
|
* `DocumentFragment` of already-rendered slot children), returns and clears it —
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { compileNodes } from './compileNodes';
|
|
2
|
-
import { pithyGlobals } from '../types/globals';
|
|
1
|
+
import { compileNodes } from './compileNodes.js';
|
|
2
|
+
import { pithyGlobals } from '../types/globals.js';
|
|
3
3
|
/**
|
|
4
4
|
* If the registry renderer has set `globalThis.__pithyProjectedChildren` (a
|
|
5
5
|
* `DocumentFragment` of already-rendered slot children), returns and clears it —
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
"risk": "high"
|
|
7
7
|
}
|
|
8
8
|
*/
|
|
9
|
-
import { pithyGlobals } from '../types/globals';
|
|
10
|
-
import { isSSRMode } from './ssrMode';
|
|
11
|
-
import { setBoundaryError } from './binds/bindErrorBoundary';
|
|
9
|
+
import { pithyGlobals } from '../types/globals.js';
|
|
10
|
+
import { isSSRMode } from './ssrMode.js';
|
|
11
|
+
import { setBoundaryError } from './binds/bindErrorBoundary.js';
|
|
12
12
|
/**
|
|
13
13
|
* Crashes recorded during the current server render, keyed by the placeholder
|
|
14
14
|
* element so a later binding pass over the same element can retract its own
|
package/dist/compile/ssrMode.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trimBlankEdges.d.ts","sourceRoot":"","sources":["../../src/compile/trimBlankEdges.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,CAAC,EAC9B,KAAK,EAAE,CAAC,EAAE,EACV,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,GACjC,CAAC,EAAE,CAUL"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const ASCII_WHITESPACE = /^[ \t\n\f\r]*$/;
|
|
2
|
+
export function trimBlankEdges(nodes, textOf) {
|
|
3
|
+
const blank = (node) => {
|
|
4
|
+
const text = textOf(node);
|
|
5
|
+
return text !== null && ASCII_WHITESPACE.test(text);
|
|
6
|
+
};
|
|
7
|
+
let start = 0;
|
|
8
|
+
let end = nodes.length;
|
|
9
|
+
while (start < end && blank(nodes[start]))
|
|
10
|
+
start++;
|
|
11
|
+
while (end > start && blank(nodes[end - 1]))
|
|
12
|
+
end--;
|
|
13
|
+
return nodes.slice(start, end);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=trimBlankEdges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trimBlankEdges.js","sourceRoot":"","sources":["../../src/compile/trimBlankEdges.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C,MAAM,UAAU,cAAc,CAC5B,KAAU,EACV,MAAkC;IAElC,MAAM,KAAK,GAAG,CAAC,IAAO,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1B,OAAO,IAAI,KAAK,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC;IACF,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IACvB,OAAO,KAAK,GAAG,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAAE,KAAK,EAAE,CAAC;IACnD,OAAO,GAAG,GAAG,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAAE,GAAG,EAAE,CAAC;IACnD,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './compile';
|
|
3
|
-
export * from './runtime';
|
|
4
|
-
export * from './utilities';
|
|
5
|
-
export * from './interfaces';
|
|
6
|
-
export * from './a11y';
|
|
1
|
+
export * from './types/index.js';
|
|
2
|
+
export * from './compile/index.js';
|
|
3
|
+
export * from './runtime/index.js';
|
|
4
|
+
export * from './utilities/index.js';
|
|
5
|
+
export * from './interfaces/index.js';
|
|
6
|
+
export * from './a11y/index.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './compile';
|
|
3
|
-
export * from './runtime';
|
|
4
|
-
export * from './utilities';
|
|
5
|
-
export * from './interfaces';
|
|
6
|
-
export * from './a11y';
|
|
1
|
+
export * from './types/index.js';
|
|
2
|
+
export * from './compile/index.js';
|
|
3
|
+
export * from './runtime/index.js';
|
|
4
|
+
export * from './utilities/index.js';
|
|
5
|
+
export * from './interfaces/index.js';
|
|
6
|
+
export * from './a11y/index.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './ref.interface';
|
|
2
|
-
export * from './ref-signal.interface';
|
|
1
|
+
export * from './ref.interface.js';
|
|
2
|
+
export * from './ref-signal.interface.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/interfaces/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './ref.interface';
|
|
2
|
-
export * from './ref-signal.interface';
|
|
1
|
+
export * from './ref.interface.js';
|
|
2
|
+
export * from './ref-signal.interface.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -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.
|
|
@@ -28,8 +28,8 @@ export type { Desc, EventDesc, InterpDesc, ClassDesc, ClassesDesc, StyleDesc, Bo
|
|
|
28
28
|
* @param bindings - Array of binding descriptors from codegen
|
|
29
29
|
* @param context - Reactive context object with signals, methods, components
|
|
30
30
|
*/
|
|
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
|
|
31
|
+
/** @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 }"} */
|
|
32
|
+
export declare function __applyBindings(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown>, ownsDestroyCallbacks?: boolean): {
|
|
33
33
|
el: DocumentFragment;
|
|
34
34
|
destroy: () => void;
|
|
35
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyBindings.d.ts","sourceRoot":"","sources":["../../src/runtime/applyBindings.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAIF,OAAO,EAmBL,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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,
|
|
1
|
+
{"version":3,"file":"applyBindings.d.ts","sourceRoot":"","sources":["../../src/runtime/applyBindings.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAIF,OAAO,EAmBL,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;;;;;;;;;;;;;;;;;;;;GAoBG;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,CA2I/C"}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
"category": "runtime"
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
|
-
import { drainDestroyCallbacks } from './onDestroy';
|
|
9
|
-
import { clearSSRRenderCrash } from '../compile/ssrCrashes';
|
|
10
|
-
import { buildPidMap, buildCommentMap, mergeContexts, applyRef, applyError, applyProjection, applyComponent, applyBind, applyInterpolation, applyEvent, applyClass, applyClasses, applyStyle, applyBound, applyIf, applyFor, applySwitch, applyDefer, } from './bindings';
|
|
8
|
+
import { drainDestroyCallbacks } from './onDestroy.js';
|
|
9
|
+
import { clearSSRRenderCrash } from '../compile/ssrCrashes.js';
|
|
10
|
+
import { buildPidMap, buildCommentMap, mergeContexts, applyRef, applyError, applyProjection, applyComponent, applyBind, applyInterpolation, applyEvent, applyClass, applyClasses, applyStyle, applyBound, applyIf, applyFor, applySwitch, applyDefer, } from './bindings/index.js';
|
|
11
11
|
// ─── Main entry point ─────────────────────────────────────────────────────────
|
|
12
12
|
/**
|
|
13
13
|
* Applies pre-extracted binding descriptors to an AOT-generated DOM fragment.
|
|
@@ -30,12 +30,14 @@ import { buildPidMap, buildCommentMap, mergeContexts, applyRef, applyError, appl
|
|
|
30
30
|
* @param bindings - Array of binding descriptors from codegen
|
|
31
31
|
* @param context - Reactive context object with signals, methods, components
|
|
32
32
|
*/
|
|
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) {
|
|
33
|
+
/** @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 }"} */
|
|
34
|
+
export function __applyBindings(fragment, bindings, context, ownsDestroyCallbacks = true) {
|
|
35
35
|
// Drain onDestroy() callbacks BEFORE processing bindings — child components
|
|
36
36
|
// instantiated during binding will drain their own callbacks independently.
|
|
37
|
-
const destroyCallbacks = drainDestroyCallbacks();
|
|
37
|
+
const destroyCallbacks = ownsDestroyCallbacks ? drainDestroyCallbacks() : [];
|
|
38
38
|
const disposers = [];
|
|
39
|
+
if (bindings.length === 0)
|
|
40
|
+
return bindingsResult(fragment, disposers, destroyCallbacks);
|
|
39
41
|
// Merge parent component + async (SSR) contexts — AOT factories bypass html()
|
|
40
42
|
const ctx = mergeContexts(context);
|
|
41
43
|
// Build lookup maps
|
|
@@ -161,6 +163,9 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
161
163
|
}
|
|
162
164
|
throw err;
|
|
163
165
|
}
|
|
166
|
+
return bindingsResult(fragment, disposers, destroyCallbacks);
|
|
167
|
+
}
|
|
168
|
+
function bindingsResult(fragment, disposers, destroyCallbacks) {
|
|
164
169
|
return {
|
|
165
170
|
el: fragment,
|
|
166
171
|
destroy() {
|
|
@@ -183,6 +188,7 @@ export function __applyBindings(fragment, bindings, context) {
|
|
|
183
188
|
/* ignore disposal errors */
|
|
184
189
|
}
|
|
185
190
|
}
|
|
191
|
+
destroyCallbacks.length = 0;
|
|
186
192
|
},
|
|
187
193
|
};
|
|
188
194
|
}
|
|
@@ -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,
|
|
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,E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BAAgB,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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { CompDesc, BindingContext } from './types';
|
|
1
|
+
import type { CompDesc, BindingContext } from './types.js';
|
|
2
2
|
export declare function applyComponent(d: CompDesc, el: Element, ctx: BindingContext, disposers: (() => void)[], pidMap: Map<string, Element>): void;
|
|
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":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,
|
|
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,GAC3B,IAAI,CA8QN"}
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { compileExpression } from '../../compile/compileExpression';
|
|
2
|
-
import { boundaryForElement, runWithBoundary, } from '../../compile/binds/bindErrorBoundary';
|
|
3
|
-
import { collectForwardedAttrs, applyForwardedAttrs, } from '../../compile/binds/forwardedAttrs';
|
|
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';
|
|
4
4
|
import { nativeTags } from '@pithyjs/compiler';
|
|
5
5
|
import { createRoot, untrack } from '@pithyjs/signals';
|
|
6
|
-
import { nearestCtx } from './helpers';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
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';
|
|
11
14
|
/** Map kebab-case or lowered DOM attr name to expected camelCase prop name. */
|
|
12
15
|
function normalizePropName(authored, expectedProps) {
|
|
13
|
-
if (expectedProps.
|
|
16
|
+
if (expectedProps.includes(authored))
|
|
14
17
|
return authored;
|
|
15
|
-
const
|
|
16
|
-
|
|
18
|
+
const lower = authored.toLowerCase();
|
|
19
|
+
const matches = expectedProps.filter(p => p.toLowerCase() === lower);
|
|
20
|
+
return matches.length === 1 ? matches[0] : authored;
|
|
17
21
|
}
|
|
18
22
|
/** Cache for extractExpectedPropNames to avoid re-parsing the same function. */
|
|
19
23
|
const propNamesCache = new WeakMap();
|
|
@@ -29,18 +33,8 @@ function extractExpectedPropNames(fn) {
|
|
|
29
33
|
if (cached)
|
|
30
34
|
return cached;
|
|
31
35
|
try {
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
if (!m) {
|
|
35
|
-
propNamesCache.set(fn, []);
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
const names = m[1]
|
|
39
|
-
.split(',')
|
|
40
|
-
.map(s => s.trim())
|
|
41
|
-
.filter(Boolean)
|
|
42
|
-
.filter(s => !s.startsWith('...'))
|
|
43
|
-
.map(s => s.split(/[:=]/)[0].trim());
|
|
36
|
+
const parsed = parsePropNames(fn.toString());
|
|
37
|
+
const names = parsed.fromParam ? parsed.names : [];
|
|
44
38
|
// Detect likely minification: single-char names suggest mangled output
|
|
45
39
|
if (import.meta.env?.DEV &&
|
|
46
40
|
names.length > 0 &&
|
|
@@ -117,6 +111,14 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
|
117
111
|
slotGroups.set(slotName, []);
|
|
118
112
|
slotGroups.get(slotName).push(child);
|
|
119
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
|
+
}
|
|
120
122
|
// AOT has no runtime AST, so default-slot content reaches the component two
|
|
121
123
|
// ways: `renderChildren()` reads the injection fragment off the global, and
|
|
122
124
|
// `<slot>` reads it through the slot map. Both must reference the SAME
|
|
@@ -140,11 +142,18 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
|
140
142
|
return frag;
|
|
141
143
|
});
|
|
142
144
|
}
|
|
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;
|
|
143
152
|
const componentContext = {
|
|
144
153
|
...localCtx,
|
|
145
154
|
__slotMap: slotMap,
|
|
146
155
|
__childAstNodes: undefined,
|
|
147
|
-
__childFactory:
|
|
156
|
+
__childFactory: childFactory,
|
|
148
157
|
};
|
|
149
158
|
// Find nearest error boundary
|
|
150
159
|
const boundaryEl = el.closest('[data-error]');
|
|
@@ -170,6 +179,7 @@ export function applyComponent(d, el, ctx, disposers, pidMap) {
|
|
|
170
179
|
g.__pithyComponentContext = originalContext;
|
|
171
180
|
g.__pithyRenderingComponent = wasRendering;
|
|
172
181
|
g.__pithyProjectedChildren = prevInjection;
|
|
182
|
+
invoking = false;
|
|
173
183
|
}
|
|
174
184
|
});
|
|
175
185
|
}
|