@pithyjs/core 0.1.0-beta.0
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/LICENSE +21 -0
- package/README.md +513 -0
- package/dist/a11y/focus-trap.d.ts +109 -0
- package/dist/a11y/focus-trap.d.ts.map +1 -0
- package/dist/a11y/focus-trap.js +246 -0
- package/dist/a11y/focus-trap.js.map +1 -0
- package/dist/a11y/index.d.ts +12 -0
- package/dist/a11y/index.d.ts.map +1 -0
- package/dist/a11y/index.js +16 -0
- package/dist/a11y/index.js.map +1 -0
- package/dist/a11y/keyboard-utils.d.ts +165 -0
- package/dist/a11y/keyboard-utils.d.ts.map +1 -0
- package/dist/a11y/keyboard-utils.js +321 -0
- package/dist/a11y/keyboard-utils.js.map +1 -0
- package/dist/a11y/roving-tabindex.d.ts +118 -0
- package/dist/a11y/roving-tabindex.d.ts.map +1 -0
- package/dist/a11y/roving-tabindex.js +249 -0
- package/dist/a11y/roving-tabindex.js.map +1 -0
- package/dist/a11y/skip-link.d.ts +55 -0
- package/dist/a11y/skip-link.d.ts.map +1 -0
- package/dist/a11y/skip-link.js +164 -0
- package/dist/a11y/skip-link.js.map +1 -0
- package/dist/compile/bindSwitchCases.d.ts +16 -0
- package/dist/compile/bindSwitchCases.d.ts.map +1 -0
- package/dist/compile/bindSwitchCases.js +323 -0
- package/dist/compile/bindSwitchCases.js.map +1 -0
- package/dist/compile/binds/bindBoundAttributes.d.ts +14 -0
- package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -0
- package/dist/compile/binds/bindBoundAttributes.js +57 -0
- package/dist/compile/binds/bindBoundAttributes.js.map +1 -0
- package/dist/compile/binds/bindClassDirectives.d.ts +20 -0
- package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -0
- package/dist/compile/binds/bindClassDirectives.js +94 -0
- package/dist/compile/binds/bindClassDirectives.js.map +1 -0
- package/dist/compile/binds/bindComponentsTags.d.ts +17 -0
- package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -0
- package/dist/compile/binds/bindComponentsTags.js +355 -0
- package/dist/compile/binds/bindComponentsTags.js.map +1 -0
- package/dist/compile/binds/bindConditionals.d.ts +16 -0
- package/dist/compile/binds/bindConditionals.d.ts.map +1 -0
- package/dist/compile/binds/bindConditionals.js +102 -0
- package/dist/compile/binds/bindConditionals.js.map +1 -0
- package/dist/compile/binds/bindDefaultTwoWay.d.ts +35 -0
- package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -0
- package/dist/compile/binds/bindDefaultTwoWay.js +128 -0
- package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -0
- package/dist/compile/binds/bindDeferDirectives.d.ts +21 -0
- package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -0
- package/dist/compile/binds/bindDeferDirectives.js +465 -0
- package/dist/compile/binds/bindDeferDirectives.js.map +1 -0
- package/dist/compile/binds/bindErrorBoundary.d.ts +71 -0
- package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -0
- package/dist/compile/binds/bindErrorBoundary.js +389 -0
- package/dist/compile/binds/bindErrorBoundary.js.map +1 -0
- package/dist/compile/binds/bindEventHandlers.d.ts +17 -0
- package/dist/compile/binds/bindEventHandlers.d.ts.map +1 -0
- package/dist/compile/binds/bindEventHandlers.js +174 -0
- package/dist/compile/binds/bindEventHandlers.js.map +1 -0
- package/dist/compile/binds/bindRefDirectives.d.ts +14 -0
- package/dist/compile/binds/bindRefDirectives.d.ts.map +1 -0
- package/dist/compile/binds/bindRefDirectives.js +35 -0
- package/dist/compile/binds/bindRefDirectives.js.map +1 -0
- package/dist/compile/binds/bindTextInterpolations.d.ts +16 -0
- package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -0
- package/dist/compile/binds/bindTextInterpolations.js +408 -0
- package/dist/compile/binds/bindTextInterpolations.js.map +1 -0
- package/dist/compile/binds/directiveRegistry.d.ts +46 -0
- package/dist/compile/binds/directiveRegistry.d.ts.map +1 -0
- package/dist/compile/binds/directiveRegistry.js +50 -0
- package/dist/compile/binds/directiveRegistry.js.map +1 -0
- package/dist/compile/compileExpression.d.ts +10 -0
- package/dist/compile/compileExpression.d.ts.map +1 -0
- package/dist/compile/compileExpression.js +26 -0
- package/dist/compile/compileExpression.js.map +1 -0
- package/dist/compile/compileNodes.d.ts +32 -0
- package/dist/compile/compileNodes.d.ts.map +1 -0
- package/dist/compile/compileNodes.js +104 -0
- package/dist/compile/compileNodes.js.map +1 -0
- package/dist/compile/compileTemplate.d.ts +64 -0
- package/dist/compile/compileTemplate.d.ts.map +1 -0
- package/dist/compile/compileTemplate.js +157 -0
- package/dist/compile/compileTemplate.js.map +1 -0
- package/dist/compile/contentProjection.d.ts +29 -0
- package/dist/compile/contentProjection.d.ts.map +1 -0
- package/dist/compile/contentProjection.js +210 -0
- package/dist/compile/contentProjection.js.map +1 -0
- package/dist/compile/forLoops/bindForLoops.d.ts +21 -0
- package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -0
- package/dist/compile/forLoops/bindForLoops.js +151 -0
- package/dist/compile/forLoops/bindForLoops.js.map +1 -0
- package/dist/compile/forLoops/createLoopManager.d.ts +51 -0
- package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -0
- package/dist/compile/forLoops/createLoopManager.js +429 -0
- package/dist/compile/forLoops/createLoopManager.js.map +1 -0
- package/dist/compile/forLoops/index.d.ts +6 -0
- package/dist/compile/forLoops/index.d.ts.map +1 -0
- package/dist/compile/forLoops/index.js +8 -0
- package/dist/compile/forLoops/index.js.map +1 -0
- package/dist/compile/forLoops/loopHelpers.d.ts +33 -0
- package/dist/compile/forLoops/loopHelpers.d.ts.map +1 -0
- package/dist/compile/forLoops/loopHelpers.js +69 -0
- package/dist/compile/forLoops/loopHelpers.js.map +1 -0
- package/dist/compile/forLoops/loopSignals.d.ts +36 -0
- package/dist/compile/forLoops/loopSignals.d.ts.map +1 -0
- package/dist/compile/forLoops/loopSignals.js +64 -0
- package/dist/compile/forLoops/loopSignals.js.map +1 -0
- package/dist/compile/forLoops/loopTraversal.d.ts +18 -0
- package/dist/compile/forLoops/loopTraversal.d.ts.map +1 -0
- package/dist/compile/forLoops/loopTraversal.js +38 -0
- package/dist/compile/forLoops/loopTraversal.js.map +1 -0
- package/dist/compile/handleConditionalChain.d.ts +15 -0
- package/dist/compile/handleConditionalChain.d.ts.map +1 -0
- package/dist/compile/handleConditionalChain.js +181 -0
- package/dist/compile/handleConditionalChain.js.map +1 -0
- package/dist/compile/index.d.ts +15 -0
- package/dist/compile/index.d.ts.map +1 -0
- package/dist/compile/index.js +19 -0
- package/dist/compile/index.js.map +1 -0
- package/dist/compile/injectScopedStyle.d.ts +16 -0
- package/dist/compile/injectScopedStyle.d.ts.map +1 -0
- package/dist/compile/injectScopedStyle.js +50 -0
- package/dist/compile/injectScopedStyle.js.map +1 -0
- package/dist/compile/nodeExpando.d.ts +12 -0
- package/dist/compile/nodeExpando.d.ts.map +1 -0
- package/dist/compile/nodeExpando.js +4 -0
- package/dist/compile/nodeExpando.js.map +1 -0
- package/dist/compile/parseHtml.d.ts +70 -0
- package/dist/compile/parseHtml.d.ts.map +1 -0
- package/dist/compile/parseHtml.js +164 -0
- package/dist/compile/parseHtml.js.map +1 -0
- package/dist/compile/pithyTreeToDom.d.ts +16 -0
- package/dist/compile/pithyTreeToDom.d.ts.map +1 -0
- package/dist/compile/pithyTreeToDom.js +118 -0
- package/dist/compile/pithyTreeToDom.js.map +1 -0
- package/dist/compile/renderChildren.d.ts +50 -0
- package/dist/compile/renderChildren.d.ts.map +1 -0
- package/dist/compile/renderChildren.js +76 -0
- package/dist/compile/renderChildren.js.map +1 -0
- package/dist/compile/ssrMode.d.ts +17 -0
- package/dist/compile/ssrMode.d.ts.map +1 -0
- package/dist/compile/ssrMode.js +20 -0
- package/dist/compile/ssrMode.js.map +1 -0
- package/dist/compile/textValue.d.ts +28 -0
- package/dist/compile/textValue.d.ts.map +1 -0
- package/dist/compile/textValue.js +30 -0
- package/dist/compile/textValue.js.map +1 -0
- package/dist/config/index.d.ts +37 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +16 -0
- package/dist/config/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +3 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/ref-signal.interface.d.ts +6 -0
- package/dist/interfaces/ref-signal.interface.d.ts.map +1 -0
- package/dist/interfaces/ref-signal.interface.js +2 -0
- package/dist/interfaces/ref-signal.interface.js.map +1 -0
- package/dist/interfaces/ref.interface.d.ts +5 -0
- package/dist/interfaces/ref.interface.d.ts.map +1 -0
- package/dist/interfaces/ref.interface.js +2 -0
- package/dist/interfaces/ref.interface.js.map +1 -0
- package/dist/runtime/applyBindings.d.ts +36 -0
- package/dist/runtime/applyBindings.d.ts.map +1 -0
- package/dist/runtime/applyBindings.js +165 -0
- package/dist/runtime/applyBindings.js.map +1 -0
- package/dist/runtime/bindings/applyComponent.d.ts +3 -0
- package/dist/runtime/bindings/applyComponent.d.ts.map +1 -0
- package/dist/runtime/bindings/applyComponent.js +190 -0
- package/dist/runtime/bindings/applyComponent.js.map +1 -0
- package/dist/runtime/bindings/applyDefer.d.ts +11 -0
- package/dist/runtime/bindings/applyDefer.d.ts.map +1 -0
- package/dist/runtime/bindings/applyDefer.js +422 -0
- package/dist/runtime/bindings/applyDefer.js.map +1 -0
- package/dist/runtime/bindings/applySimple.d.ts +11 -0
- package/dist/runtime/bindings/applySimple.d.ts.map +1 -0
- package/dist/runtime/bindings/applySimple.js +346 -0
- package/dist/runtime/bindings/applySimple.js.map +1 -0
- package/dist/runtime/bindings/applyStructural.d.ts +5 -0
- package/dist/runtime/bindings/applyStructural.d.ts.map +1 -0
- package/dist/runtime/bindings/applyStructural.js +312 -0
- package/dist/runtime/bindings/applyStructural.js.map +1 -0
- package/dist/runtime/bindings/helpers.d.ts +56 -0
- package/dist/runtime/bindings/helpers.d.ts.map +1 -0
- package/dist/runtime/bindings/helpers.js +121 -0
- package/dist/runtime/bindings/helpers.js.map +1 -0
- package/dist/runtime/bindings/index.d.ts +7 -0
- package/dist/runtime/bindings/index.d.ts.map +1 -0
- package/dist/runtime/bindings/index.js +6 -0
- package/dist/runtime/bindings/index.js.map +1 -0
- package/dist/runtime/bindings/types.d.ts +105 -0
- package/dist/runtime/bindings/types.d.ts.map +1 -0
- package/dist/runtime/bindings/types.js +5 -0
- package/dist/runtime/bindings/types.js.map +1 -0
- package/dist/runtime/bootstrap.d.ts +59 -0
- package/dist/runtime/bootstrap.d.ts.map +1 -0
- package/dist/runtime/bootstrap.js +82 -0
- package/dist/runtime/bootstrap.js.map +1 -0
- package/dist/runtime/createContextProxy.d.ts +10 -0
- package/dist/runtime/createContextProxy.d.ts.map +1 -0
- package/dist/runtime/createContextProxy.js +45 -0
- package/dist/runtime/createContextProxy.js.map +1 -0
- package/dist/runtime/deferHelpers.d.ts +49 -0
- package/dist/runtime/deferHelpers.d.ts.map +1 -0
- package/dist/runtime/deferHelpers.js +65 -0
- package/dist/runtime/deferHelpers.js.map +1 -0
- package/dist/runtime/html.d.ts +23 -0
- package/dist/runtime/html.d.ts.map +1 -0
- package/dist/runtime/html.js +97 -0
- package/dist/runtime/html.js.map +1 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +21 -0
- package/dist/runtime/index.js.map +1 -0
- package/dist/runtime/lazy.d.ts +144 -0
- package/dist/runtime/lazy.d.ts.map +1 -0
- package/dist/runtime/lazy.js +295 -0
- package/dist/runtime/lazy.js.map +1 -0
- package/dist/runtime/module-cache.d.ts +78 -0
- package/dist/runtime/module-cache.d.ts.map +1 -0
- package/dist/runtime/module-cache.js +109 -0
- package/dist/runtime/module-cache.js.map +1 -0
- package/dist/runtime/onDestroy.d.ts +29 -0
- package/dist/runtime/onDestroy.d.ts.map +1 -0
- package/dist/runtime/onDestroy.js +66 -0
- package/dist/runtime/onDestroy.js.map +1 -0
- package/dist/runtime/parseIdentifiersFromTemplate.d.ts +17 -0
- package/dist/runtime/parseIdentifiersFromTemplate.d.ts.map +1 -0
- package/dist/runtime/parseIdentifiersFromTemplate.js +68 -0
- package/dist/runtime/parseIdentifiersFromTemplate.js.map +1 -0
- package/dist/types/globals.d.ts +18 -0
- package/dist/types/globals.d.ts.map +1 -0
- package/dist/types/globals.js +4 -0
- package/dist/types/globals.js.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utilities/index.d.ts +3 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +3 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/ref-signal.utility.d.ts +32 -0
- package/dist/utilities/ref-signal.utility.d.ts.map +1 -0
- package/dist/utilities/ref-signal.utility.js +46 -0
- package/dist/utilities/ref-signal.utility.js.map +1 -0
- package/dist/utilities/ref.untility.d.ts +37 -0
- package/dist/utilities/ref.untility.d.ts.map +1 -0
- package/dist/utilities/ref.untility.js +47 -0
- package/dist/utilities/ref.untility.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.runtime.defer-helpers",
|
|
4
|
+
"title": "Shared Defer Loading Helpers",
|
|
5
|
+
"category": "runtime"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Load a lazy handle with timeout support.
|
|
10
|
+
* Rejects with a timeout error if loading exceeds the given duration.
|
|
11
|
+
*
|
|
12
|
+
* @param handle - The lazy handle to load
|
|
13
|
+
* @param timeoutMs - Maximum time in milliseconds before timeout
|
|
14
|
+
* @returns Promise resolving to the loaded module
|
|
15
|
+
*/
|
|
16
|
+
/** @codexApi {"parent":"pithy.runtime.defer-helpers","name":"loadWithTimeout","stability":"internal","signature":"<T>(handle: LazyHandle<T>, timeoutMs: number) => Promise<T>"} */
|
|
17
|
+
export async function loadWithTimeout(handle, timeoutMs) {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const timeoutId = setTimeout(() => {
|
|
20
|
+
handle.cancel();
|
|
21
|
+
reject(new Error(`Lazy load timed out after ${timeoutMs}ms`));
|
|
22
|
+
}, timeoutMs);
|
|
23
|
+
handle
|
|
24
|
+
.load()
|
|
25
|
+
.then(result => {
|
|
26
|
+
clearTimeout(timeoutId);
|
|
27
|
+
resolve(result);
|
|
28
|
+
})
|
|
29
|
+
.catch(err => {
|
|
30
|
+
clearTimeout(timeoutId);
|
|
31
|
+
reject(err);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Schedule a callback based on loading priority.
|
|
37
|
+
*
|
|
38
|
+
* - `"high"`: Execute synchronously (immediate)
|
|
39
|
+
* - `"low"`: `requestIdleCallback` (fires when browser is idle)
|
|
40
|
+
* - default (`undefined`): `queueMicrotask` (reliable, async enough for DOM settling)
|
|
41
|
+
*
|
|
42
|
+
* Deferring by default is critical: `bindDeferDirectives` runs BEFORE
|
|
43
|
+
* `bindComponentTags.replaceWith()` moves the element into the real DOM.
|
|
44
|
+
* Synchronous mount would capture a stale `parentNode` (the compilation fragment).
|
|
45
|
+
*
|
|
46
|
+
* NOTE: `requestIdleCallback` without a timeout can be starved indefinitely when
|
|
47
|
+
* the page is busy (HMR, long-running tasks). Default priority uses
|
|
48
|
+
* `queueMicrotask` which reliably fires after the current synchronous execution.
|
|
49
|
+
*
|
|
50
|
+
* @param callback - Function to execute
|
|
51
|
+
* @param priority - Loading priority level
|
|
52
|
+
* @returns Idle callback ID (if `"low"` priority), or `undefined`
|
|
53
|
+
*/
|
|
54
|
+
/** @codexApi {"parent":"pithy.runtime.defer-helpers","name":"scheduleByPriority","stability":"internal","signature":"(callback: () => void, priority: LoadingPriority | undefined) => number | void"} */
|
|
55
|
+
export function scheduleByPriority(callback, priority) {
|
|
56
|
+
if (priority === 'high') {
|
|
57
|
+
callback();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (priority === 'low' && typeof requestIdleCallback !== 'undefined') {
|
|
61
|
+
return requestIdleCallback(callback);
|
|
62
|
+
}
|
|
63
|
+
queueMicrotask(callback);
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=deferHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deferHelpers.js","sourceRoot":"","sources":["../../src/runtime/deferHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAcF;;;;;;;GAOG;AACH,mLAAmL;AACnL,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,SAAiB;IAEjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE;YAChC,MAAM,CAAC,MAAM,EAAE,CAAC;YAChB,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,SAAS,IAAI,CAAC,CAAC,CAAC;QAChE,CAAC,EAAE,SAAS,CAAC,CAAC;QAEd,MAAM;aACH,IAAI,EAAE;aACN,IAAI,CAAC,MAAM,CAAC,EAAE;YACb,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,CAAC,EAAE;YACX,YAAY,CAAC,SAAS,CAAC,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,yMAAyM;AACzM,MAAM,UAAU,kBAAkB,CAChC,QAAoB,EACpB,QAAqC;IAErC,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,QAAQ,EAAE,CAAC;QACX,OAAO;IACT,CAAC;IACD,IAAI,QAAQ,KAAK,KAAK,IAAI,OAAO,mBAAmB,KAAK,WAAW,EAAE,CAAC;QACrE,OAAO,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,CAAC;IACD,cAAc,CAAC,QAAQ,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.runtime.html",
|
|
4
|
+
"title": "HTML Template Helper",
|
|
5
|
+
"category": "runtime"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Tagged template function for creating reactive DOM from HTML strings.
|
|
10
|
+
* Parses the template, binds reactive directives, and returns a live DOM fragment.
|
|
11
|
+
* Requires `loadJITCompiler()` to be called first (to load parse5 dynamically).
|
|
12
|
+
*
|
|
13
|
+
* @param template - Template literal or raw HTML string
|
|
14
|
+
* @param contextOrCss - Reactive context object or CSS string
|
|
15
|
+
* @param cssIfContextPassed - CSS string when context is the second argument
|
|
16
|
+
* @returns Object with `el` (live DOM) and `destroy` (cleanup function)
|
|
17
|
+
*/
|
|
18
|
+
/** @codexApi {"parent":"pithy.runtime.html","name":"html","stability":"stable","signature":"(template: TemplateStringsArray | string, contextOrCss?: Record<string, unknown> | string, cssIfContextPassed?: string) => { el: HTMLElement | DocumentFragment; destroy: () => void }"} */
|
|
19
|
+
export declare function html(template: TemplateStringsArray | string, contextOrCss?: Record<string, unknown> | string, cssIfContextPassed?: string): {
|
|
20
|
+
el: HTMLElement | DocumentFragment;
|
|
21
|
+
destroy: () => void;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=html.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/runtime/html.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAQF;;;;;;;;;GASG;AACH,wRAAwR;AACxR,wBAAgB,IAAI,CAClB,QAAQ,EAAE,oBAAoB,GAAG,MAAM,EACvC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAC/C,kBAAkB,CAAC,EAAE,MAAM,GAC1B;IAAE,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAwF7D"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.runtime.html",
|
|
4
|
+
"title": "HTML Template Helper",
|
|
5
|
+
"category": "runtime"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
import { compileTemplate } from '../compile/compileTemplate';
|
|
9
|
+
import { createContextProxy } from './createContextProxy';
|
|
10
|
+
import { parseIdentifiersFromTemplate } from './parseIdentifiersFromTemplate';
|
|
11
|
+
import { mergeContexts } from './bindings/helpers';
|
|
12
|
+
import { drainDestroyCallbacks } from './onDestroy';
|
|
13
|
+
/**
|
|
14
|
+
* Tagged template function for creating reactive DOM from HTML strings.
|
|
15
|
+
* Parses the template, binds reactive directives, and returns a live DOM fragment.
|
|
16
|
+
* Requires `loadJITCompiler()` to be called first (to load parse5 dynamically).
|
|
17
|
+
*
|
|
18
|
+
* @param template - Template literal or raw HTML string
|
|
19
|
+
* @param contextOrCss - Reactive context object or CSS string
|
|
20
|
+
* @param cssIfContextPassed - CSS string when context is the second argument
|
|
21
|
+
* @returns Object with `el` (live DOM) and `destroy` (cleanup function)
|
|
22
|
+
*/
|
|
23
|
+
/** @codexApi {"parent":"pithy.runtime.html","name":"html","stability":"stable","signature":"(template: TemplateStringsArray | string, contextOrCss?: Record<string, unknown> | string, cssIfContextPassed?: string) => { el: HTMLElement | DocumentFragment; destroy: () => void }"} */
|
|
24
|
+
export function html(template, contextOrCss, cssIfContextPassed) {
|
|
25
|
+
// Drain onDestroy() callbacks BEFORE compileTemplate — child components
|
|
26
|
+
// instantiated during compilation will drain their own callbacks independently.
|
|
27
|
+
const destroyCallbacks = drainDestroyCallbacks();
|
|
28
|
+
const rawHtml = typeof template === 'string' ? template : String.raw(template);
|
|
29
|
+
let context = {};
|
|
30
|
+
let css;
|
|
31
|
+
if (typeof contextOrCss === 'object') {
|
|
32
|
+
context = contextOrCss;
|
|
33
|
+
css = cssIfContextPassed;
|
|
34
|
+
}
|
|
35
|
+
else if (typeof contextOrCss === 'string') {
|
|
36
|
+
css = contextOrCss;
|
|
37
|
+
}
|
|
38
|
+
// Merge with component context if available (for content projection and
|
|
39
|
+
// nested component resolution). Uses the shared mergeContexts helper
|
|
40
|
+
// (single source of truth with applyBindings.ts).
|
|
41
|
+
context = mergeContexts(context);
|
|
42
|
+
// Dev fallback
|
|
43
|
+
if (import.meta.env?.DEV && Object.keys(context).length === 0) {
|
|
44
|
+
const identifiers = parseIdentifiersFromTemplate(rawHtml);
|
|
45
|
+
identifiers.forEach(name => {
|
|
46
|
+
context[name] = undefined;
|
|
47
|
+
console.warn(`[PithyJS html()] Dev fallback: '${name}' will be undefined unless injected by plugin.`);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// Extract imported identifiers from context if provided by Babel plugin
|
|
51
|
+
const importedIdentifiers = context.__importedIdentifiers;
|
|
52
|
+
// Remove the special property from context before creating proxy
|
|
53
|
+
const cleanContext = { ...context };
|
|
54
|
+
delete cleanContext.__importedIdentifiers;
|
|
55
|
+
const proxiedContext = createContextProxy([cleanContext]);
|
|
56
|
+
let result;
|
|
57
|
+
try {
|
|
58
|
+
result = compileTemplate(rawHtml, proxiedContext, css, undefined, importedIdentifiers);
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
// Run drained callbacks LIFO before rethrowing so partially-initialized
|
|
62
|
+
// resources (effects, event listeners) are still cleaned up.
|
|
63
|
+
for (let i = destroyCallbacks.length - 1; i >= 0; i--) {
|
|
64
|
+
try {
|
|
65
|
+
destroyCallbacks[i]();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
/* ignore */
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
throw err;
|
|
72
|
+
}
|
|
73
|
+
// Zero-overhead fast path when no onDestroy was called
|
|
74
|
+
if (destroyCallbacks.length === 0)
|
|
75
|
+
return result;
|
|
76
|
+
return {
|
|
77
|
+
el: result.el,
|
|
78
|
+
destroy() {
|
|
79
|
+
try {
|
|
80
|
+
result.destroy();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
/* ignore disposal errors */
|
|
84
|
+
}
|
|
85
|
+
// LIFO order — last-registered runs first
|
|
86
|
+
for (let i = destroyCallbacks.length - 1; i >= 0; i--) {
|
|
87
|
+
try {
|
|
88
|
+
destroyCallbacks[i]();
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
/* ignore disposal errors */
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=html.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/runtime/html.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { html } from './html';
|
|
2
|
+
export { onDestroy } from './onDestroy';
|
|
3
|
+
export { loadModule, getModuleRecord, invalidateModule, getResolvedModuleKeys, clearModuleCache, type ModuleRecord, } from './module-cache';
|
|
4
|
+
export { lazy, isLazyHandle, preloadLazy, type LazyState, type LazyOptions, type LazyHandle, } from './lazy';
|
|
5
|
+
export { DEFAULT_VISIBILITY_MARGIN, observeVisibilityOnce, } from '@pithyjs/shared';
|
|
6
|
+
export { bootstrap, type BootstrapOptions } from './bootstrap';
|
|
7
|
+
export { defineConfig, type PithyConfig } from '@pithyjs/shared';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAaxC,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,UAAU,GAChB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,SAAS,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export { html } from './html';
|
|
2
|
+
export { onDestroy } from './onDestroy';
|
|
3
|
+
// JIT compiler loading is NOT re-exported from this barrel to prevent
|
|
4
|
+
// parse5 from being pulled into production bundles via the barrel chain.
|
|
5
|
+
// Use the dedicated subpath export:
|
|
6
|
+
// import { loadJITCompiler } from '@pithyjs/core/compile/parseHtml'
|
|
7
|
+
// NOTE: __applyBindings is NOT re-exported here — it's an internal API
|
|
8
|
+
// consumed by AOT-generated code via direct subpath import:
|
|
9
|
+
// import { __applyBindings } from '@pithyjs/core/runtime/applyBindings'
|
|
10
|
+
// Fully implemented in Phase 5 (Runtime Binder) — see applyBindings.ts.
|
|
11
|
+
// Module cache (shared across router, prefetch, lazy components)
|
|
12
|
+
export { loadModule, getModuleRecord, invalidateModule, getResolvedModuleKeys, clearModuleCache, } from './module-cache';
|
|
13
|
+
// Lazy loading
|
|
14
|
+
export { lazy, isLazyHandle, preloadLazy, } from './lazy';
|
|
15
|
+
// Visibility trigger (IntersectionObserver pool) - from @pithyjs/shared
|
|
16
|
+
export { DEFAULT_VISIBILITY_MARGIN, observeVisibilityOnce, } from '@pithyjs/shared';
|
|
17
|
+
// App bootstrap (fresh mount, no hydration)
|
|
18
|
+
export { bootstrap } from './bootstrap';
|
|
19
|
+
// App configuration (re-export from @pithyjs/shared for convenience)
|
|
20
|
+
export { defineConfig } from '@pithyjs/shared';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,sEAAsE;AACtE,yEAAyE;AACzE,oCAAoC;AACpC,sEAAsE;AAEtE,uEAAuE;AACvE,4DAA4D;AAC5D,0EAA0E;AAC1E,wEAAwE;AAExE,iEAAiE;AACjE,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,GAEjB,MAAM,gBAAgB,CAAC;AAExB,eAAe;AACf,OAAO,EACL,IAAI,EACJ,YAAY,EACZ,WAAW,GAIZ,MAAM,QAAQ,CAAC;AAEhB,wEAAwE;AACxE,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,4CAA4C;AAC5C,OAAO,EAAE,SAAS,EAAyB,MAAM,aAAa,CAAC;AAE/D,qEAAqE;AACrE,OAAO,EAAE,YAAY,EAAoB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.core.lazy",
|
|
4
|
+
"title": "Lazy Loading Runtime Helper",
|
|
5
|
+
"category": "runtime"
|
|
6
|
+
}
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Lazy Loading Runtime
|
|
10
|
+
*
|
|
11
|
+
* Provides the `lazy()` function for component-level lazy loading.
|
|
12
|
+
* Components wrapped with lazy() are only loaded when triggered by @defer directive.
|
|
13
|
+
*
|
|
14
|
+
* @module runtime/lazy
|
|
15
|
+
*/
|
|
16
|
+
import { type Signal } from '@pithyjs/signals';
|
|
17
|
+
import { type LoadingPriority } from '@pithyjs/compiler';
|
|
18
|
+
/** @codexApi {"parent":"pithy.core.lazy","name":"LazyState","stability":"stable","signature":"type LazyState = 'idle' | 'loading' | 'loaded' | 'error'"} */
|
|
19
|
+
/** Possible states for a lazy component */
|
|
20
|
+
export type LazyState = 'idle' | 'loading' | 'loaded' | 'error';
|
|
21
|
+
/** @codexApi {"parent":"pithy.core.lazy","name":"LazyOptions","stability":"stable","signature":"interface LazyOptions"} */
|
|
22
|
+
/** Options for configuring lazy loading behavior */
|
|
23
|
+
export interface LazyOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Custom key for this lazy component in the module cache.
|
|
26
|
+
* Should start with 'lazy-' to match Vite chunk naming convention.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // Use with Vite magic comment for chunk naming
|
|
31
|
+
* const UserCard = lazy(
|
|
32
|
+
* () => import(/* webpackChunkName: "lazy-UserCard" *\/ './UserCard.pithy'),
|
|
33
|
+
* { key: 'lazy-UserCard' }
|
|
34
|
+
* );
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
key?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Callback invoked when loading fails.
|
|
40
|
+
* Called with the error that occurred.
|
|
41
|
+
*/
|
|
42
|
+
onError?: (error: unknown) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Timeout in milliseconds before loading is considered failed.
|
|
45
|
+
* @default DEFAULT_LAZY_TIMEOUT (30 seconds)
|
|
46
|
+
*/
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Loading priority hint.
|
|
50
|
+
* 'high' modules are loaded before 'low' priority modules.
|
|
51
|
+
* @default 'low'
|
|
52
|
+
*/
|
|
53
|
+
priority?: LoadingPriority;
|
|
54
|
+
}
|
|
55
|
+
/** @codexApi {"parent":"pithy.core.lazy","name":"LazyHandle","stability":"stable","signature":"interface LazyHandle<T>"} */
|
|
56
|
+
/** Handle returned by lazy() for controlling lazy component loading */
|
|
57
|
+
export interface LazyHandle<T> {
|
|
58
|
+
/**
|
|
59
|
+
* Unique key for this lazy component in the module cache.
|
|
60
|
+
* Format: 'component:{path}'
|
|
61
|
+
*/
|
|
62
|
+
readonly key: string;
|
|
63
|
+
/**
|
|
64
|
+
* Trigger the load (idempotent, returns cached promise).
|
|
65
|
+
* Multiple calls return the same promise.
|
|
66
|
+
*/
|
|
67
|
+
load: () => Promise<T>;
|
|
68
|
+
/**
|
|
69
|
+
* Current loading state as a reactive signal.
|
|
70
|
+
* Subscribe to this for reactive UI updates.
|
|
71
|
+
*/
|
|
72
|
+
state: Signal<LazyState>;
|
|
73
|
+
/**
|
|
74
|
+
* Resolved module value (undefined until loaded).
|
|
75
|
+
*/
|
|
76
|
+
module: T | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* Error if load failed (undefined otherwise).
|
|
79
|
+
*/
|
|
80
|
+
error: Error | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Cancel an in-flight load.
|
|
83
|
+
* Has no effect if already loaded or idle.
|
|
84
|
+
*/
|
|
85
|
+
cancel: () => void;
|
|
86
|
+
/**
|
|
87
|
+
* Retry loading after an error.
|
|
88
|
+
* Clears the error state and attempts to load again.
|
|
89
|
+
*/
|
|
90
|
+
retry: () => Promise<T>;
|
|
91
|
+
/**
|
|
92
|
+
* Loading priority for this component.
|
|
93
|
+
*/
|
|
94
|
+
readonly priority: LoadingPriority;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Wrap a dynamic import for lazy loading.
|
|
98
|
+
*
|
|
99
|
+
* Creates a lazy handle that can be used with the @defer directive
|
|
100
|
+
* to load components on-demand.
|
|
101
|
+
*
|
|
102
|
+
* @param loader - Function returning a dynamic import promise
|
|
103
|
+
* @param options - Configuration options
|
|
104
|
+
* @returns LazyHandle for controlling the lazy component
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* // Basic usage
|
|
109
|
+
* const UserCard = lazy(() => import('./UserCard.pithy'));
|
|
110
|
+
*
|
|
111
|
+
* // With options
|
|
112
|
+
* const HeavyChart = lazy(() => import('./HeavyChart.pithy'), {
|
|
113
|
+
* timeoutMs: 10000,
|
|
114
|
+
* onError: (err) => console.error('Failed to load chart', err),
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* In template with the `@defer` directive:
|
|
119
|
+
*
|
|
120
|
+
* ```html
|
|
121
|
+
* <div @defer="visible" @load="UserCard" @placeholder="Skeleton"></div>
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
/** @codexApi {"parent":"pithy.core.lazy","name":"lazy","stability":"stable","signature":"<T>(loader: () => Promise<T>, options?: LazyOptions) => LazyHandle<T>"} */
|
|
125
|
+
export declare function lazy<T = unknown>(loader: () => Promise<T>, options?: LazyOptions): LazyHandle<T>;
|
|
126
|
+
/**
|
|
127
|
+
* Check if a value is a LazyHandle.
|
|
128
|
+
* Uses Symbol-based branding for reliable type checking.
|
|
129
|
+
*
|
|
130
|
+
* @param value - Value to check
|
|
131
|
+
* @returns True if value is a LazyHandle
|
|
132
|
+
*/
|
|
133
|
+
/** @codexApi {"parent":"pithy.core.lazy","name":"isLazyHandle","stability":"stable","signature":"(value: unknown) => value is LazyHandle<unknown>"} */
|
|
134
|
+
export declare function isLazyHandle(value: unknown): value is LazyHandle<unknown>;
|
|
135
|
+
/**
|
|
136
|
+
* Preload a lazy component without mounting it.
|
|
137
|
+
* Useful for prefetching on hover or when idle.
|
|
138
|
+
*
|
|
139
|
+
* @param handle - LazyHandle to preload
|
|
140
|
+
* @returns Promise that resolves when loaded
|
|
141
|
+
*/
|
|
142
|
+
/** @codexApi {"parent":"pithy.core.lazy","name":"preloadLazy","stability":"stable","signature":"<T>(handle: LazyHandle<T>) => Promise<T>"} */
|
|
143
|
+
export declare function preloadLazy<T>(handle: LazyHandle<T>): Promise<T>;
|
|
144
|
+
//# sourceMappingURL=lazy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy.d.ts","sourceRoot":"","sources":["../../src/runtime/lazy.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;GAOG;AAEH,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAM/E,4JAA4J;AAC5J,2CAA2C;AAC3C,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEhE,2HAA2H;AAC3H,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAEnC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B;AAED,4HAA4H;AAC5H,uEAAuE;AACvE,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAEvB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IAEzB;;OAEG;IACH,MAAM,EAAE,CAAC,GAAG,SAAS,CAAC;IAEtB;;OAEG;IACH,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IAEzB;;;OAGG;IACH,MAAM,EAAE,MAAM,IAAI,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;CACpC;AAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,oKAAoK;AACpK,wBAAgB,IAAI,CAAC,CAAC,GAAG,OAAO,EAC9B,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,GAAE,WAAgB,GACxB,UAAU,CAAC,CAAC,CAAC,CA0Qf;AAED;;;;;;GAMG;AACH,uJAAuJ;AACvJ,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAAC,OAAO,CAAC,CAMzE;AAED;;;;;;GAMG;AACH,8IAA8I;AAC9I,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEhE"}
|