@askrjs/askr 0.0.21 → 0.0.25
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 +201 -201
- package/README.md +160 -46
- package/dist/_virtual/___vite-browser-external.js +1 -0
- package/dist/_virtual/__vite-browser-external.js +1 -0
- package/dist/_virtual/_commonjsHelpers.js +1 -0
- package/dist/_virtual/main.js +1 -0
- package/dist/_virtual/preload-helper.js +1 -0
- package/dist/{benchmark.d.ts → bench/benchmark-entry.d.ts} +3 -3
- package/dist/bench/benchmark-entry.d.ts.map +1 -0
- package/dist/benchmark.js +1 -1
- package/dist/boot/index.d.ts +70 -0
- package/dist/boot/index.d.ts.map +1 -0
- package/dist/boot/index.js +2 -0
- package/dist/common/component.d.ts +16 -0
- package/dist/common/component.d.ts.map +1 -0
- package/dist/common/errors.d.ts +53 -0
- package/dist/common/errors.d.ts.map +1 -0
- package/dist/common/index.d.ts +14 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/jsx.d.ts +17 -0
- package/dist/common/jsx.d.ts.map +1 -0
- package/dist/common/jsx.js +1 -0
- package/dist/{jsx-CPjsGyEg.d.ts → common/props.d.ts} +6 -18
- package/dist/common/props.d.ts.map +1 -0
- package/dist/{router-DaGtH1Sq.d.ts → common/router.d.ts} +10 -7
- package/dist/common/router.d.ts.map +1 -0
- package/dist/common/ssr-errors.d.ts +8 -0
- package/dist/common/ssr-errors.d.ts.map +1 -0
- package/dist/common/ssr-errors.js +1 -0
- package/dist/common/ssr.d.ts +17 -0
- package/dist/common/ssr.d.ts.map +1 -0
- package/dist/common/vnode.d.ts +17 -0
- package/dist/common/vnode.d.ts.map +1 -0
- package/dist/common/vnode.js +1 -0
- package/dist/components/link.d.ts +56 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +1 -0
- package/dist/dev/invariant.d.ts +83 -0
- package/dist/dev/invariant.d.ts.map +1 -0
- package/dist/dev/invariant.js +2 -0
- package/dist/dev/logger.d.ts +13 -0
- package/dist/dev/logger.d.ts.map +1 -0
- package/dist/dev/logger.js +1 -0
- package/dist/dev/vite-plugin-askr.d.ts +18 -0
- package/dist/dev/vite-plugin-askr.d.ts.map +1 -0
- package/dist/dev/warnings.d.ts +5 -0
- package/dist/dev/warnings.d.ts.map +1 -0
- package/dist/for/for.d.ts +16 -0
- package/dist/for/for.d.ts.map +1 -0
- package/dist/for/for.js +1 -0
- package/dist/for/index.d.ts +2 -63
- package/dist/for/index.d.ts.map +1 -0
- package/dist/for/index.js +1 -1
- package/dist/foundations/core.d.ts +23 -0
- package/dist/foundations/core.d.ts.map +1 -0
- package/dist/foundations/core.js +1 -0
- package/dist/foundations/index.d.ts +3 -669
- package/dist/foundations/index.d.ts.map +1 -0
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/interactions/dismissable.d.ts +58 -0
- package/dist/foundations/interactions/dismissable.d.ts.map +1 -0
- package/dist/foundations/interactions/dismissable.js +1 -0
- package/dist/foundations/interactions/focusable.d.ts +16 -0
- package/dist/foundations/interactions/focusable.d.ts.map +1 -0
- package/dist/foundations/interactions/focusable.js +1 -0
- package/dist/foundations/interactions/hoverable.d.ts +19 -0
- package/dist/foundations/interactions/hoverable.d.ts.map +1 -0
- package/dist/foundations/interactions/hoverable.js +1 -0
- package/dist/foundations/interactions/index.d.ts +5 -0
- package/dist/foundations/interactions/index.d.ts.map +1 -0
- package/dist/foundations/interactions/interaction-policy.d.ts +96 -0
- package/dist/foundations/interactions/interaction-policy.d.ts.map +1 -0
- package/dist/foundations/interactions/interaction-policy.js +1 -0
- package/dist/foundations/interactions/pressable.d.ts +54 -0
- package/dist/foundations/interactions/pressable.d.ts.map +1 -0
- package/dist/foundations/interactions/pressable.js +1 -0
- package/dist/foundations/interactions/roving-focus.d.ts +117 -0
- package/dist/foundations/interactions/roving-focus.d.ts.map +1 -0
- package/dist/foundations/interactions/roving-focus.js +1 -0
- package/dist/foundations/state/controllable.d.ts +53 -0
- package/dist/foundations/state/controllable.d.ts.map +1 -0
- package/dist/foundations/state/controllable.js +1 -0
- package/dist/foundations/state/index.d.ts +2 -0
- package/dist/foundations/state/index.d.ts.map +1 -0
- package/dist/foundations/structures/collection.d.ts +67 -0
- package/dist/foundations/structures/collection.d.ts.map +1 -0
- package/dist/foundations/structures/collection.js +1 -0
- package/dist/foundations/structures/index.d.ts +5 -0
- package/dist/foundations/structures/index.d.ts.map +1 -0
- package/dist/foundations/structures/layer.d.ts +102 -0
- package/dist/foundations/structures/layer.d.ts.map +1 -0
- package/dist/foundations/structures/layer.js +1 -0
- package/dist/{layout-BINPv-nz.d.ts → foundations/structures/layout.d.ts} +3 -4
- package/dist/foundations/structures/layout.d.ts.map +1 -0
- package/dist/foundations/structures/layout.js +1 -0
- package/dist/foundations/structures/portal.d.ts +33 -0
- package/dist/foundations/structures/portal.d.ts.map +1 -0
- package/dist/foundations/structures/portal.js +1 -0
- package/dist/foundations/structures/presence.d.ts +30 -0
- package/dist/foundations/structures/presence.d.ts.map +1 -0
- package/dist/foundations/structures/presence.js +1 -0
- package/dist/foundations/structures/slot.d.ts +31 -0
- package/dist/foundations/structures/slot.d.ts.map +1 -0
- package/dist/foundations/structures/slot.js +1 -0
- package/dist/foundations/structures.d.ts +14 -0
- package/dist/foundations/structures.d.ts.map +1 -0
- package/dist/foundations/structures.js +1 -0
- package/dist/foundations/utilities/aria.d.ts +13 -0
- package/dist/foundations/utilities/aria.d.ts.map +1 -0
- package/dist/foundations/utilities/aria.js +1 -0
- package/dist/foundations/utilities/compose-handlers.d.ts +34 -0
- package/dist/foundations/utilities/compose-handlers.d.ts.map +1 -0
- package/dist/foundations/utilities/compose-handlers.js +1 -0
- package/dist/foundations/utilities/compose-ref.d.ts +24 -0
- package/dist/foundations/utilities/compose-ref.d.ts.map +1 -0
- package/dist/foundations/utilities/compose-ref.js +1 -0
- package/dist/foundations/utilities/event-types.d.ts +17 -0
- package/dist/foundations/utilities/event-types.d.ts.map +1 -0
- package/dist/foundations/utilities/index.d.ts +7 -0
- package/dist/foundations/utilities/index.d.ts.map +1 -0
- package/dist/foundations/utilities/merge-props.d.ts +2 -0
- package/dist/foundations/utilities/merge-props.d.ts.map +1 -0
- package/dist/foundations/utilities/merge-props.js +1 -0
- package/dist/foundations/utilities/use-id.d.ts +29 -0
- package/dist/foundations/utilities/use-id.d.ts.map +1 -0
- package/dist/foundations/utilities/use-id.js +1 -0
- package/dist/fx/fx.d.ts +30 -0
- package/dist/fx/fx.d.ts.map +1 -0
- package/dist/fx/fx.js +1 -0
- package/dist/fx/index.d.ts +5 -184
- package/dist/fx/index.d.ts.map +1 -0
- package/dist/fx/index.js +1 -1
- package/dist/fx/noop.d.ts +12 -0
- package/dist/fx/noop.d.ts.map +1 -0
- package/dist/fx/noop.js +1 -0
- package/dist/fx/timing.d.ts +155 -0
- package/dist/fx/timing.d.ts.map +1 -0
- package/dist/fx/timing.js +1 -0
- package/dist/index.d.ts +18 -37
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/jsx/index.d.ts +4 -0
- package/dist/jsx/index.d.ts.map +1 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/jsx-dev-runtime.d.ts +4 -0
- package/dist/jsx/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx/jsx-runtime.d.ts +10 -0
- package/dist/jsx/jsx-runtime.d.ts.map +1 -0
- package/dist/{types-BTT0Fc9S.d.ts → jsx/types.d.ts} +6 -3
- package/dist/jsx/types.d.ts.map +1 -0
- package/dist/jsx/types.js +1 -0
- package/dist/jsx/utils.d.ts +4 -0
- package/dist/jsx/utils.d.ts.map +1 -0
- package/dist/jsx/utils.js +1 -0
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime.js +1 -1
- package/dist/node_modules/esbuild/lib/main.js +65 -0
- package/dist/renderer/cleanup.d.ts +25 -0
- package/dist/renderer/cleanup.d.ts.map +1 -0
- package/dist/renderer/cleanup.js +1 -0
- package/dist/renderer/dom.d.ts +44 -0
- package/dist/renderer/dom.d.ts.map +1 -0
- package/dist/renderer/dom.js +1 -0
- package/dist/renderer/evaluate.d.ts +4 -0
- package/dist/renderer/evaluate.d.ts.map +1 -0
- package/dist/renderer/evaluate.js +1 -0
- package/dist/renderer/fastpath.d.ts +7 -0
- package/dist/renderer/fastpath.d.ts.map +1 -0
- package/dist/renderer/fastpath.js +1 -0
- package/dist/renderer/index.d.ts +6 -0
- package/dist/renderer/index.d.ts.map +1 -0
- package/dist/renderer/index.js +1 -0
- package/dist/renderer/keyed.d.ts +23 -0
- package/dist/renderer/keyed.d.ts.map +1 -0
- package/dist/renderer/keyed.js +1 -0
- package/dist/renderer/reconcile.d.ts +88 -0
- package/dist/renderer/reconcile.d.ts.map +1 -0
- package/dist/renderer/reconcile.js +1 -0
- package/dist/renderer/types.d.ts +3 -0
- package/dist/renderer/types.d.ts.map +1 -0
- package/dist/renderer/types.js +1 -0
- package/dist/renderer/utils.d.ts +63 -0
- package/dist/renderer/utils.d.ts.map +1 -0
- package/dist/renderer/utils.js +1 -0
- package/dist/resources/index.d.ts +7 -22
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +1 -1
- package/dist/router/index.d.ts +8 -87
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +1 -1
- package/dist/router/match.d.ts +22 -0
- package/dist/router/match.d.ts.map +1 -0
- package/dist/router/match.js +1 -0
- package/dist/router/navigate.d.ts +20 -0
- package/dist/router/navigate.d.ts.map +1 -0
- package/dist/router/navigate.js +1 -0
- package/dist/router/route.d.ts +52 -0
- package/dist/router/route.d.ts.map +1 -0
- package/dist/router/route.js +1 -0
- package/dist/runtime/component.d.ts +123 -0
- package/dist/runtime/component.d.ts.map +1 -0
- package/dist/runtime/component.js +1 -0
- package/dist/runtime/context.d.ts +80 -0
- package/dist/runtime/context.d.ts.map +1 -0
- package/dist/runtime/context.js +1 -0
- package/dist/runtime/derive.d.ts +7 -0
- package/dist/runtime/derive.d.ts.map +1 -0
- package/dist/runtime/derive.js +1 -0
- package/dist/runtime/dev-namespace.d.ts +31 -0
- package/dist/runtime/dev-namespace.d.ts.map +1 -0
- package/dist/runtime/dev-namespace.js +1 -0
- package/dist/runtime/events.d.ts +52 -0
- package/dist/runtime/events.d.ts.map +1 -0
- package/dist/runtime/events.js +1 -0
- package/dist/runtime/execution-model.d.ts +4 -0
- package/dist/runtime/execution-model.d.ts.map +1 -0
- package/dist/runtime/execution-model.js +1 -0
- package/dist/runtime/fastlane.d.ts +27 -0
- package/dist/runtime/fastlane.d.ts.map +1 -0
- package/dist/runtime/fastlane.js +1 -0
- package/dist/runtime/for.d.ts +52 -0
- package/dist/runtime/for.d.ts.map +1 -0
- package/dist/runtime/for.js +1 -0
- package/dist/runtime/hydration.d.ts +25 -0
- package/dist/runtime/hydration.d.ts.map +1 -0
- package/dist/runtime/operations.d.ts +39 -0
- package/dist/runtime/operations.d.ts.map +1 -0
- package/dist/runtime/operations.js +1 -0
- package/dist/runtime/resource-cell.d.ts +35 -0
- package/dist/runtime/resource-cell.d.ts.map +1 -0
- package/dist/runtime/resource-cell.js +1 -0
- package/dist/runtime/scheduler.d.ts +48 -0
- package/dist/runtime/scheduler.d.ts.map +1 -0
- package/dist/runtime/scheduler.js +1 -0
- package/dist/runtime/snapshot.d.ts +25 -0
- package/dist/runtime/snapshot.d.ts.map +1 -0
- package/dist/runtime/ssr-bridge.d.ts +10 -0
- package/dist/runtime/ssr-bridge.d.ts.map +1 -0
- package/dist/runtime/ssr-bridge.js +1 -0
- package/dist/runtime/state.d.ts +56 -0
- package/dist/runtime/state.d.ts.map +1 -0
- package/dist/runtime/state.js +1 -0
- package/dist/ssr/attrs.d.ts +26 -0
- package/dist/ssr/attrs.d.ts.map +1 -0
- package/dist/ssr/attrs.js +1 -0
- package/dist/ssr/context.d.ts +47 -0
- package/dist/ssr/context.d.ts.map +1 -0
- package/dist/ssr/context.js +1 -0
- package/dist/ssr/create-ssr.d.ts +19 -0
- package/dist/ssr/create-ssr.d.ts.map +1 -0
- package/dist/ssr/errors.d.ts +6 -0
- package/dist/ssr/errors.d.ts.map +1 -0
- package/dist/ssr/errors.js +1 -0
- package/dist/ssr/escape.d.ts +38 -0
- package/dist/ssr/escape.d.ts.map +1 -0
- package/dist/ssr/escape.js +1 -0
- package/dist/ssr/index.d.ts +18 -94
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/ssr/index.js +1 -1
- package/dist/ssr/render-keys.d.ts +39 -0
- package/dist/ssr/render-keys.d.ts.map +1 -0
- package/dist/ssr/render-keys.js +1 -0
- package/dist/ssr/sink.d.ts +23 -0
- package/dist/ssr/sink.d.ts.map +1 -0
- package/dist/ssr/sink.js +1 -0
- package/dist/ssr/stream-render.d.ts +7 -0
- package/dist/ssr/stream-render.d.ts.map +1 -0
- package/dist/ssr/stream-render.js +1 -0
- package/dist/ssr/types.d.ts +21 -0
- package/dist/ssr/types.d.ts.map +1 -0
- package/dist/vite/index.js +3 -1
- package/package.json +11 -10
- package/dist/chunk-37RC6ZT3.js +0 -1
- package/dist/chunk-3L6PFAJ3.js +0 -1
- package/dist/chunk-47D5SNYH.js +0 -1
- package/dist/chunk-4RTKQ7SC.js +0 -1
- package/dist/chunk-5PLQPS3O.js +0 -1
- package/dist/chunk-62D2TNHX.js +0 -1
- package/dist/chunk-BP2CKUO6.js +0 -1
- package/dist/chunk-D2JSJKCW.js +0 -1
- package/dist/chunk-EQ5S5GU4.js +0 -1
- package/dist/chunk-HGMOQ3I7.js +0 -1
- package/dist/chunk-HZKAD5DE.js +0 -1
- package/dist/chunk-ILZCMHZM.js +0 -2
- package/dist/chunk-NL44ANML.js +0 -2
- package/dist/chunk-YRY4OLQF.js +0 -1
- package/dist/component-AJMg1Gmv.d.ts +0 -177
- package/dist/jsx-dev-runtime.d.ts +0 -7
- package/dist/jsx-runtime.d.ts +0 -14
- package/dist/logger-NGZDJLVS.js +0 -1
- package/dist/main-EPE35NMW.js +0 -65
- package/dist/navigate-4VAVLF3A.js +0 -1
- package/dist/route-IVG3V65Y.js +0 -1
- package/dist/vite/index.d.ts +0 -17
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const p="modulepreload",y=function(a){return"/"+a},m={},P=function(v,i,u){let f=Promise.resolve();if(i&&i.length>0){let E=function(e){return Promise.all(e.map(o=>Promise.resolve(o).then(s=>({status:"fulfilled",value:s}),s=>({status:"rejected",reason:s}))))};const r=document.getElementsByTagName("link"),t=document.querySelector("meta[property=csp-nonce]"),h=t?.nonce||t?.getAttribute("nonce");f=E(i.map(e=>{if(e=y(e,u),e in m)return;m[e]=!0;const o=e.endsWith(".css"),s=o?'[rel="stylesheet"]':"";if(u)for(let c=r.length-1;c>=0;c--){const l=r[c];if(l.href===e&&(!o||l.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${e}"]${s}`))return;const n=document.createElement("link");if(n.rel=o?"stylesheet":p,o||(n.as="script"),n.crossOrigin="",n.href=e,h&&n.setAttribute("nonce",h),document.head.appendChild(n),o)return new Promise((c,l)=>{n.addEventListener("load",c),n.addEventListener("error",()=>l(new Error(`Unable to preload CSS for ${e}`)))})}))}function d(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return f.then(r=>{for(const t of r||[])t.status==="rejected"&&d(t.reason);return v().catch(d)})};export{P as __vitePreload};
|
|
@@ -2,7 +2,7 @@ type RowData = {
|
|
|
2
2
|
id: number;
|
|
3
3
|
label: string;
|
|
4
4
|
};
|
|
5
|
-
declare function mountBenchmark(root: Element, initialRows?: RowData[]): {
|
|
5
|
+
export declare function mountBenchmark(root: Element, initialRows?: RowData[]): {
|
|
6
6
|
setRows(rows: RowData[]): void;
|
|
7
7
|
setSelected(id: number | null): void;
|
|
8
8
|
cleanup(): void;
|
|
@@ -10,5 +10,5 @@ declare function mountBenchmark(root: Element, initialRows?: RowData[]): {
|
|
|
10
10
|
declare const _default: {
|
|
11
11
|
mountBenchmark: typeof mountBenchmark;
|
|
12
12
|
};
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=benchmark-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"benchmark-entry.d.ts","sourceRoot":"","sources":["../../src/bench/benchmark-entry.tsx"],"names":[],"mappings":"AAKA,KAAK,OAAO,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO,EAAE;kBAoEnD,OAAO,EAAE;oBAMP,MAAM,GAAG,IAAI;;EAQhC;;;;AAED,wBAAkC"}
|
package/dist/benchmark.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import"./index.js";import"./for/index.js";import{globalScheduler as n}from"./runtime/scheduler.js";import{state as s}from"./runtime/state.js";import{For as a}from"./for/for.js";import{createIsland as i}from"./boot/index.js";function h(c,o){const l=Array.isArray(o)?o:[];let t,p;return i({root:c,component:()=>{t=s([]),p=s(null);const r=e=>p.set(e);return{type:"div",props:{},children:[{type:"table",props:{},children:[{type:"tbody",props:{},children:[a(()=>t(),e=>e.id,e=>({type:"tr",props:{class:()=>p()===e.id?"danger":""},children:[{type:"td",props:{},children:[String(e.id)]},{type:"td",props:{},children:[{type:"a",props:{onClick:d=>{d.preventDefault(),r(e.id)}},children:[e.label]}]}]}))]}]}]}}}),l.length>0&&t&&t.set(l),{setRows(r){t.set(r),n.flush()},setSelected(r){p.set(r),n.flush()},cleanup(){}}}const A={mountBenchmark:h};export{A as default,h as mountBenchmark};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App bootstrap and mount
|
|
3
|
+
*/
|
|
4
|
+
import { type ComponentFunction } from '../runtime/component';
|
|
5
|
+
export interface AppConfig {
|
|
6
|
+
root: Element | string;
|
|
7
|
+
component: ComponentFunction;
|
|
8
|
+
cleanupStrict?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Explicitly teardown an app mounted on `root` if present. This is the
|
|
12
|
+
* recommended API for deterministic cleanup rather than relying on overriding
|
|
13
|
+
* `innerHTML` setter behavior.
|
|
14
|
+
*/
|
|
15
|
+
export declare function teardownApp(_root: Element | string): void;
|
|
16
|
+
import type { Route } from '../common/router';
|
|
17
|
+
export type IslandConfig = {
|
|
18
|
+
root: Element | string;
|
|
19
|
+
component: ComponentFunction;
|
|
20
|
+
cleanupStrict?: boolean;
|
|
21
|
+
routes?: never;
|
|
22
|
+
};
|
|
23
|
+
export type IslandsConfig = {
|
|
24
|
+
islands: IslandConfig[];
|
|
25
|
+
};
|
|
26
|
+
export type SPAConfig = {
|
|
27
|
+
root: Element | string;
|
|
28
|
+
routes: Route[];
|
|
29
|
+
cleanupStrict?: boolean;
|
|
30
|
+
component?: never;
|
|
31
|
+
};
|
|
32
|
+
export type HydrateSPAConfig = {
|
|
33
|
+
root: Element | string;
|
|
34
|
+
routes: Route[];
|
|
35
|
+
cleanupStrict?: boolean;
|
|
36
|
+
hydrate?: {
|
|
37
|
+
deferUntilIdle?: boolean;
|
|
38
|
+
deferBelowFold?: boolean;
|
|
39
|
+
foldThreshold?: number;
|
|
40
|
+
skipSelectors?: string[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* createIsland: Enhances existing DOM (no router, mounts once)
|
|
45
|
+
*/
|
|
46
|
+
export declare function createIsland(config: IslandConfig): void;
|
|
47
|
+
/**
|
|
48
|
+
* createIslands: Enhances one or more existing DOM roots (no router).
|
|
49
|
+
* The only public islands constructor.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createIslands(config: IslandsConfig): void;
|
|
52
|
+
/**
|
|
53
|
+
* createSPA: Initializes router and mounts the app with provided route table
|
|
54
|
+
*/
|
|
55
|
+
export declare function createSPA(config: SPAConfig): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* hydrateSPA: Hydrate server-rendered HTML with explicit routes
|
|
58
|
+
*/
|
|
59
|
+
export declare function hydrateSPA(config: HydrateSPAConfig): Promise<void>;
|
|
60
|
+
export declare function hydrate(_config: AppConfig): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Cleanup an app mounted on a root element (element or id).
|
|
63
|
+
* Safe to call multiple times — no-op when nothing is mounted.
|
|
64
|
+
*/
|
|
65
|
+
export declare function cleanupApp(root: Element | string): void;
|
|
66
|
+
/**
|
|
67
|
+
* Check whether an app is mounted on the given root
|
|
68
|
+
*/
|
|
69
|
+
export declare function hasApp(root: Element | string): boolean;
|
|
70
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/boot/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIL,KAAK,iBAAiB,EAEvB,MAAM,sBAAsB,CAAC;AAuB9B,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,SAAS,EAAE,iBAAiB,CAAC;IAE7B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAmHD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,QAIlD;AAkFD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG9C,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,SAAS,EAAE,iBAAiB,CAAC;IAE7B,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,KAAK,EAAE,CAAC;IAEhB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,KAAK,EAAE,CAAC;IAEhB,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAuCvD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAWzD;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAwEhE;AAoED;;GAEG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsGxE;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAYvD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAMtD"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["router/route.js","router/match.js","runtime/component.js","runtime/scheduler.js","dev/invariant.js","dev/logger.js","runtime/context.js","common/jsx.js","runtime/dev-namespace.js","runtime/fastlane.js","renderer/keyed.js","renderer/utils.js","renderer/index.js","renderer/types.js","common/vnode.js","renderer/cleanup.js","runtime/events.js","renderer/dom.js","jsx-runtime.js","jsx/types.js","runtime/for.js","renderer/reconcile.js","renderer/fastpath.js","renderer/evaluate.js","runtime/execution-model.js","router/navigate.js","ssr/index.js","jsx/index.js","jsx/utils.js","foundations/structures/portal.js","ssr/context.js","ssr/errors.js","common/ssr-errors.js","runtime/ssr-bridge.js","ssr/render-keys.js","ssr/escape.js","ssr/attrs.js","ssr/sink.js","ssr/stream-render.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{__vitePreload as w}from"../_virtual/preload-helper.js";import{cleanupComponent as S,createComponentInstance as k,mountComponent as C}from"../runtime/component.js";import{globalScheduler as H}from"../runtime/scheduler.js";import{assertExecutionModel as _}from"../runtime/execution-model.js";import"../jsx/index.js";import{DefaultPortal as M}from"../foundations/structures/portal.js";import"../renderer/index.js";import{removeAllListeners as v}from"../renderer/cleanup.js";import{ELEMENT_TYPE as T,Fragment as N}from"../common/jsx.js";const j=Symbol.for("__ASKR_HAS_ROUTES__");let q=0;const h=new WeakMap,I=Symbol.for("__tempoCleanup__");function B(e,t){e[I]=()=>{const r=[];try{v(e)}catch(a){r.push(a)}try{const a=e.querySelectorAll("*");for(const o of Array.from(a))try{const n=o.__ASKR_INSTANCE;if(n){try{S(n)}catch(i){r.push(i)}try{delete o.__ASKR_INSTANCE}catch(i){r.push(i)}}}catch(n){r.push(n)}}catch(a){r.push(a)}try{S(t)}catch(a){r.push(a)}if(r.length>0&&t.cleanupStrict)throw new AggregateError(r,"cleanup failed for app root")};try{const r=Object.getOwnPropertyDescriptor(e,"innerHTML")||Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"innerHTML")||Object.getOwnPropertyDescriptor(Element.prototype,"innerHTML");r&&(r.get||r.set)&&Object.defineProperty(e,"innerHTML",{get:r.get?function(){return r.get.call(this)}:void 0,set:function(a){if(a===""&&h.get(this)===t){try{v(e)}catch(o){if(t.cleanupStrict)throw o}try{S(t)}catch(o){if(t.cleanupStrict)throw o}}if(r.set)return r.set.call(this,a)},configurable:!0})}catch{}}function Q(e){throw new Error("The `teardownApp` alias has been removed. Use `cleanupApp(root)` instead.")}function y(e,t,r){const a=(i,c)=>{const s=t(i,c),l={$$typeof:T,type:M,props:{},key:"__default_portal"};return{$$typeof:T,type:N,props:{children:s==null?[l]:[s,l]}}};Object.defineProperty(a,"name",{value:t.name||"Component"});const o=e[I];o&&o();let n=h.get(e);if(n){v(e);try{S(n)}catch{}n.fn=a,n.evaluationGeneration++,n.mounted=!1,n.expectedStateIndices=[],n.firstRenderComplete=!1,n.isRoot=!0,r&&typeof r.cleanupStrict=="boolean"&&(n.cleanupStrict=r.cleanupStrict)}else{const i=String(++q);n=k(i,a,{},e),h.set(e,n),n.isRoot=!0,r&&typeof r.cleanupStrict=="boolean"&&(n.cleanupStrict=r.cleanupStrict)}B(e,n),C(n),H.flush()}function D(e){if(_("islands"),!e||typeof e!="object")throw new Error("createIsland requires a config object");if(typeof e.component!="function")throw new Error("createIsland: component must be a function");const t=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!t)throw new Error(`Root element not found: ${e.root}`);if("routes"in e)throw new Error("createIsland does not accept routes; use createSPA for routed apps");try{if(globalThis[j])throw new Error("Routes are not supported with islands. Use createSPA (client) or createSSR (server) instead.")}catch{}y(t,e.component,{cleanupStrict:e.cleanupStrict})}function X(e){if(_("islands"),!e||typeof e!="object")throw new Error("createIslands requires a config object");if(!Array.isArray(e.islands)||e.islands.length===0)throw new Error("createIslands requires a non-empty islands array");for(const t of e.islands)D(t)}async function Z(e){if(_("spa"),!e||typeof e!="object")throw new Error("createSPA requires a config object");if(!Array.isArray(e.routes)||e.routes.length===0)throw new Error("createSPA requires a route table. If you are enhancing existing HTML, use createIsland instead.");const t=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!t)throw new Error(`Root element not found: ${e.root}`);const{clearRoutes:r,route:a,lockRouteRegistration:o,resolveRoute:n}=await w(async()=>{const{clearRoutes:u,route:f,lockRouteRegistration:g,resolveRoute:p}=await import("../router/route.js");return{clearRoutes:u,route:f,lockRouteRegistration:g,resolveRoute:p}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]));r();for(const u of e.routes)a(u.path,u.handler,u.namespace);o();const i=typeof window<"u"?window.location.pathname:"/",c=n(i);if(!c){y(t,()=>({type:"div",children:[]}),{cleanupStrict:!1});const{registerAppInstance:u,initializeNavigation:f}=await w(async()=>{const{registerAppInstance:p,initializeNavigation:A}=await import("../router/navigate.js");return{registerAppInstance:p,initializeNavigation:A}},__vite__mapDeps([25,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])),g=h.get(t);if(!g)throw new Error("Internal error: app instance missing");u(g,i),f();return}y(t,c.handler,{cleanupStrict:!1});const{registerAppInstance:s,initializeNavigation:l}=await w(async()=>{const{registerAppInstance:u,initializeNavigation:f}=await import("../router/navigate.js");return{registerAppInstance:u,initializeNavigation:f}},__vite__mapDeps([25,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])),m=h.get(t);if(!m)throw new Error("Internal error: app instance missing");s(m,i),l()}function x(e,t){for(const r of t)e.querySelectorAll(r).forEach(o=>o.setAttribute("data-skip-hydrate","true"))}async function z(e,t,r){const{renderToStringSync:a}=await w(async()=>{const{renderToStringSync:o}=await import("../ssr/index.js");return{renderToStringSync:o}},__vite__mapDeps([26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,27,28,29,30,31,32,33,34,35,36,37,38]));if(r.deferUntilIdle&&(typeof requestIdleCallback<"u"?await new Promise(o=>{requestIdleCallback(()=>o(void 0),{timeout:2e3})}):await new Promise(o=>setTimeout(o,0))),r.deferBelowFold){const o=r.foldThreshold??window.innerHeight,n=Array.from(e.querySelectorAll("*")).filter(c=>c.getBoundingClientRect().top>=o);for(const c of n)c.setAttribute("data-skip-hydrate","true");const i=()=>{const c=n.filter(s=>s.getBoundingClientRect().top<o);for(const s of c)s.removeAttribute("data-skip-hydrate");c.length===n.length&&window.removeEventListener("scroll",i)};window.addEventListener("scroll",i,{passive:!0})}y(e,t.handler,{cleanupStrict:!1})}async function ee(e){if(_("spa"),!e||typeof e!="object")throw new Error("hydrateSPA requires a config object");if(!Array.isArray(e.routes)||e.routes.length===0)throw new Error("hydrateSPA requires a route table. If you are enhancing existing HTML, use createIsland instead.");const t=typeof e.root=="string"?document.getElementById(e.root):e.root;if(!t)throw new Error(`Root element not found: ${e.root}`);const r=t.innerHTML,{clearRoutes:a,route:o,setServerLocation:n,lockRouteRegistration:i,resolveRoute:c}=await w(async()=>{const{clearRoutes:d,route:E,setServerLocation:b,lockRouteRegistration:P,resolveRoute:O}=await import("../router/route.js");return{clearRoutes:d,route:E,setServerLocation:b,lockRouteRegistration:P,resolveRoute:O}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]));a();for(const d of e.routes)o(d.path,d.handler,d.namespace);const s=typeof window<"u"?window.location.pathname:"/";n(s),i();const l=c(s);if(!l)throw new Error(`hydrateSPA: no route found for current path (${s}).`);const{renderToStringSync:m}=await w(async()=>{const{renderToStringSync:d}=await import("../ssr/index.js");return{renderToStringSync:d}},__vite__mapDeps([26,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,27,28,29,30,31,32,33,34,35,36,37,38])),u=m(()=>l.handler(l.params)??{type:"div",children:[]}),f=document.createElement("div");f.innerHTML=r;const g=document.createElement("div");if(g.innerHTML=u,!f.isEqualNode(g))throw new Error("[Askr] Hydration mismatch detected. Server HTML does not match expected server-render output.");const p=e.hydrate;if(p){if(p.deferUntilIdle||p.deferBelowFold){await z(t,{handler:l.handler,params:l.params},p);return}p.skipSelectors?.length&&x(t,p.skipSelectors)}y(t,l.handler,{cleanupStrict:!1});const{registerAppInstance:A,initializeNavigation:L}=await w(async()=>{const{registerAppInstance:d,initializeNavigation:E}=await import("../router/navigate.js");return{registerAppInstance:d,initializeNavigation:E}},__vite__mapDeps([25,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24])),R=h.get(t);if(!R)throw new Error("Internal error: app instance missing");A(R,s),L()}async function te(e){throw new Error("The legacy `hydrate` API is removed. Use `hydrateSPA({ root, routes })` for SSR hydration with an explicit route table.")}function re(e){const t=typeof e=="string"?document.getElementById(e):e;if(!t)return;const r=t[I];typeof r=="function"&&r(),h.delete(t)}function ne(e){const t=typeof e=="string"?document.getElementById(e):e;return t?h.has(t):!1}export{re as cleanupApp,D as createIsland,X as createIslands,Z as createSPA,ne as hasApp,te as hydrate,ee as hydrateSPA,Q as teardownApp};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common call contracts: Component signatures
|
|
3
|
+
*/
|
|
4
|
+
import type { Props } from './props';
|
|
5
|
+
import type { JSXElement } from './jsx';
|
|
6
|
+
export type ComponentContext = {
|
|
7
|
+
signal: AbortSignal;
|
|
8
|
+
};
|
|
9
|
+
import { type VNode } from './vnode';
|
|
10
|
+
export type ComponentVNode = {
|
|
11
|
+
type: string;
|
|
12
|
+
props?: Props;
|
|
13
|
+
children?: (string | ComponentVNode | null | undefined | false)[];
|
|
14
|
+
};
|
|
15
|
+
export type ComponentFunction = (props: Props, context?: ComponentContext) => JSXElement | VNode;
|
|
16
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/common/component.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAKrC,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,CAAC,EAAE,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,KACvB,UAAU,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error handling utilities
|
|
3
|
+
* No framework magic — just JavaScript patterns
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Safe wrapper for async functions
|
|
7
|
+
* Returns result or error value without throwing
|
|
8
|
+
*
|
|
9
|
+
* Useful for: async operations where you want to handle errors inline
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const { data, error } = await handle(fetchUser(id));
|
|
14
|
+
* if (error) return renderError(error);
|
|
15
|
+
* return renderData(data);
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function handle<T>(promise: Promise<T>): Promise<{
|
|
19
|
+
data: T | null;
|
|
20
|
+
error: Error | null;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Catch errors in async operations and render fallback
|
|
24
|
+
* Returns fallback value if error occurs
|
|
25
|
+
*
|
|
26
|
+
* Useful for: graceful degradation
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const data = await catchError(
|
|
31
|
+
* fetchData(),
|
|
32
|
+
* { type: 'div', children: ['Failed to load'] }
|
|
33
|
+
* );
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function catchError<T>(promise: Promise<T>, fallback: T): Promise<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Try/catch helper with typed error handling
|
|
39
|
+
* Useful for: logging and recovery strategies
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const result = await tryWithLogging(
|
|
44
|
+
* () => fetch(url),
|
|
45
|
+
* { message: 'Failed to fetch', retryable: true }
|
|
46
|
+
* );
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function tryWithLogging<T>(fn: () => Promise<T>, errorInfo?: {
|
|
50
|
+
message?: string;
|
|
51
|
+
retryable?: boolean;
|
|
52
|
+
}): Promise<T | null>;
|
|
53
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/common/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;;;;;;;GAYG;AACH,wBAAsB,MAAM,CAAC,CAAC,EAC5B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAClB,OAAO,CAAC;IAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAA;CAAE,CAAC,CAOlD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAChC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,QAAQ,EAAE,CAAC,GACV,OAAO,CAAC,CAAC,CAAC,CAMZ;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,SAAS,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,GACpD,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAQnB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal shared call contracts.
|
|
3
|
+
*
|
|
4
|
+
* Not part of the public root API; used to decouple internal modules.
|
|
5
|
+
*/
|
|
6
|
+
export type { Props, ComponentNode } from './props';
|
|
7
|
+
export { ELEMENT_TYPE, Fragment } from './jsx';
|
|
8
|
+
export type { JSXElement } from './jsx';
|
|
9
|
+
export type { VNode, DOMElement } from './vnode';
|
|
10
|
+
export { _isDOMElement } from './vnode';
|
|
11
|
+
export type { ComponentFunction, ComponentContext } from './component';
|
|
12
|
+
export type { Route, RouteHandler, ResolvedRoute, RouteMatch, RouteQuery, RouteSnapshot, } from './router';
|
|
13
|
+
export type { SSRData, SSRContext, RenderContext } from './ssr';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/C,YAAY,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACvE,YAAY,EACV,KAAK,EACL,YAAY,EACZ,aAAa,EACb,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common call contracts: JSX element shape
|
|
3
|
+
*/
|
|
4
|
+
import type { Props } from './props';
|
|
5
|
+
export declare const ELEMENT_TYPE: unique symbol;
|
|
6
|
+
export declare const Fragment: unique symbol;
|
|
7
|
+
export interface JSXElement {
|
|
8
|
+
/** Internal element marker */
|
|
9
|
+
$$typeof: symbol;
|
|
10
|
+
/** Element type: string, component, Fragment, etc */
|
|
11
|
+
type: string | ((props: Props) => unknown) | symbol;
|
|
12
|
+
/** Props bag */
|
|
13
|
+
props: Props;
|
|
14
|
+
/** Optional key (normalized by runtime) */
|
|
15
|
+
key?: string | number | null;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=jsx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../../src/common/jsx.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,YAAY,eAA6B,CAAC;AACvD,eAAO,MAAM,QAAQ,eAA8B,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IAEjB,qDAAqD;IACrD,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,MAAM,CAAC;IAEpD,gBAAgB;IAChB,KAAK,EAAE,KAAK,CAAC;IAEb,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=Symbol.for("askr.element"),r=Symbol.for("askr.fragment");export{o as ELEMENT_TYPE,r as Fragment};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Props accepted by components and elements.
|
|
8
8
|
* Intentionally permissive but provides a single named type.
|
|
9
9
|
*/
|
|
10
|
-
interface Props {
|
|
10
|
+
export interface Props {
|
|
11
11
|
/** Optional key for keyed lists (string | number | symbol for internal frames) */
|
|
12
12
|
key?: string | number | symbol;
|
|
13
13
|
/** Optional children slot */
|
|
@@ -15,21 +15,9 @@ interface Props {
|
|
|
15
15
|
/** Allow additional arbitrary attributes (e.g., class, id, data-*) */
|
|
16
16
|
[attr: string]: unknown;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
declare const Fragment: unique symbol;
|
|
24
|
-
interface JSXElement {
|
|
25
|
-
/** Internal element marker */
|
|
26
|
-
$$typeof: symbol;
|
|
27
|
-
/** Element type: string, component, Fragment, etc */
|
|
28
|
-
type: string | ((props: Props) => unknown) | symbol;
|
|
29
|
-
/** Props bag */
|
|
30
|
-
props: Props;
|
|
31
|
-
/** Optional key (normalized by runtime) */
|
|
32
|
-
key?: string | number | null;
|
|
18
|
+
export interface ComponentNode {
|
|
19
|
+
type: 'component' | 'element' | 'text';
|
|
20
|
+
value?: unknown;
|
|
21
|
+
children?: ComponentNode[];
|
|
33
22
|
}
|
|
34
|
-
|
|
35
|
-
export { Fragment as F, type JSXElement as J, type Props as P };
|
|
23
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/common/props.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,WAAW,KAAK;IACpB,kFAAkF;IAClF,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAC/B,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sEAAsE;IACtE,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAC;CAC5B"}
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Common call contracts: Router types
|
|
3
3
|
*/
|
|
4
|
-
interface RouteHandler {
|
|
4
|
+
export interface RouteHandler {
|
|
5
5
|
(params: Record<string, string>, context?: {
|
|
6
6
|
signal: AbortSignal;
|
|
7
7
|
}): unknown;
|
|
8
8
|
}
|
|
9
|
-
interface Route {
|
|
9
|
+
export interface Route {
|
|
10
10
|
path: string;
|
|
11
11
|
handler: RouteHandler;
|
|
12
12
|
namespace?: string;
|
|
13
13
|
}
|
|
14
|
-
interface
|
|
14
|
+
export interface ResolvedRoute {
|
|
15
|
+
handler: RouteHandler;
|
|
16
|
+
params: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
export interface RouteMatch {
|
|
15
19
|
path: string;
|
|
16
20
|
params: Readonly<Record<string, string>>;
|
|
17
21
|
name?: string;
|
|
18
22
|
namespace?: string;
|
|
19
23
|
}
|
|
20
|
-
interface RouteQuery {
|
|
24
|
+
export interface RouteQuery {
|
|
21
25
|
get(key: string): string | null;
|
|
22
26
|
getAll(key: string): string[];
|
|
23
27
|
has(key: string): boolean;
|
|
24
28
|
toJSON(): Record<string, string | string[]>;
|
|
25
29
|
}
|
|
26
|
-
interface RouteSnapshot {
|
|
30
|
+
export interface RouteSnapshot {
|
|
27
31
|
path: string;
|
|
28
32
|
params: Readonly<Record<string, string>>;
|
|
29
33
|
query: Readonly<RouteQuery>;
|
|
@@ -32,5 +36,4 @@ interface RouteSnapshot {
|
|
|
32
36
|
namespace?: string;
|
|
33
37
|
matches: readonly RouteMatch[];
|
|
34
38
|
}
|
|
35
|
-
|
|
36
|
-
export type { Route as R, RouteSnapshot as a, RouteHandler as b, RouteMatch as c, RouteQuery as d };
|
|
39
|
+
//# sourceMappingURL=router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/common/router.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,GAAG,OAAO,CAAC;CAC9E;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACzC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAEpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-errors.d.ts","sourceRoot":"","sources":["../../src/common/ssr-errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,sBAAsB;gBAEjC,OAAO,SAAkI;CAM5I"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class e extends Error{constructor(t="Server-side rendering requires all data to be available synchronously. This component attempted to use async data during SSR."){super(t),this.code="SSR_DATA_MISSING",this.name="SSRDataMissingError",Object.setPrototypeOf(this,e.prototype)}}export{e as SSRDataMissingError};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common call contracts: SSR types
|
|
3
|
+
*/
|
|
4
|
+
export type SSRData = Record<string, unknown>;
|
|
5
|
+
/** Full context for sink-based streaming SSR */
|
|
6
|
+
export type SSRContext = {
|
|
7
|
+
url: string;
|
|
8
|
+
seed: number;
|
|
9
|
+
data?: SSRData;
|
|
10
|
+
params?: Record<string, string>;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
};
|
|
13
|
+
/** Lightweight context for synchronous render passes */
|
|
14
|
+
export type RenderContext = {
|
|
15
|
+
seed: number;
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=ssr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../../src/common/ssr.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,gDAAgD;AAChD,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,wDAAwD;AACxD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common call contracts: VNode / virtual DOM shapes
|
|
3
|
+
*/
|
|
4
|
+
import type { Props } from './props';
|
|
5
|
+
import type { ForState } from '../runtime/for';
|
|
6
|
+
export interface DOMElement {
|
|
7
|
+
type: string | ((props: Props) => any) | symbol;
|
|
8
|
+
props?: Props;
|
|
9
|
+
children?: VNode[];
|
|
10
|
+
key?: string | number | null;
|
|
11
|
+
[Symbol.iterator]?: never;
|
|
12
|
+
_forState?: ForState<unknown>;
|
|
13
|
+
}
|
|
14
|
+
export declare const __FOR_BOUNDARY__: unique symbol;
|
|
15
|
+
export type VNode = DOMElement | string | number | boolean | null | undefined;
|
|
16
|
+
export declare function _isDOMElement(node: unknown): node is DOMElement;
|
|
17
|
+
//# sourceMappingURL=vnode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vnode.d.ts","sourceRoot":"","sources":["../../src/common/vnode.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,UAAU;IAKzB,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC;IAChD,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7B,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,CAAC;IAC1B,SAAS,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;CAC/B;AAGD,eAAO,MAAM,gBAAgB,eAA6B,CAAC;AAG3D,MAAM,MAAM,KAAK,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAE9E,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,UAAU,CAE/D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const t=Symbol("__FOR_BOUNDARY__");function e(_){return typeof _=="object"&&_!==null&&"type"in _}export{t as __FOR_BOUNDARY__,e as _isDOMElement};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Link component for client-side navigation
|
|
3
|
+
*/
|
|
4
|
+
export interface LinkProps {
|
|
5
|
+
href: string;
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: unknown;
|
|
8
|
+
/**
|
|
9
|
+
* Optional rel attribute for link relationships.
|
|
10
|
+
* Common values: "noopener", "noreferrer", "nofollow"
|
|
11
|
+
*/
|
|
12
|
+
rel?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional target attribute.
|
|
15
|
+
* Use "_blank" for new tab/window.
|
|
16
|
+
*/
|
|
17
|
+
target?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional aria-current attribute for indicating current page/location.
|
|
20
|
+
* Use "page" for the current page in navigation.
|
|
21
|
+
*/
|
|
22
|
+
'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
|
|
23
|
+
/**
|
|
24
|
+
* Optional aria-label for accessibility when link text isn't descriptive enough.
|
|
25
|
+
*/
|
|
26
|
+
'aria-label'?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Link component that prevents default navigation and uses navigate()
|
|
30
|
+
* Provides declarative way to navigate between routes
|
|
31
|
+
*
|
|
32
|
+
* Accessibility features:
|
|
33
|
+
* - Proper semantic <a> element (not a button)
|
|
34
|
+
* - Supports aria-current for indicating active page
|
|
35
|
+
* - Supports aria-label for descriptive labels
|
|
36
|
+
* - Keyboard accessible (Enter key handled by native <a> element)
|
|
37
|
+
*
|
|
38
|
+
* Respects native browser behaviors:
|
|
39
|
+
* - Middle-click (opens in new tab)
|
|
40
|
+
* - Ctrl/Cmd+click (opens in new tab)
|
|
41
|
+
* - Shift+click (opens in new window)
|
|
42
|
+
* - Alt+click (downloads link)
|
|
43
|
+
* - Right-click context menu
|
|
44
|
+
*
|
|
45
|
+
* Best practices:
|
|
46
|
+
* - Use target="_blank" with rel="noopener noreferrer" for external links
|
|
47
|
+
* - Use aria-current="page" for the current page in navigation
|
|
48
|
+
* - Provide descriptive link text or aria-label
|
|
49
|
+
*
|
|
50
|
+
* Uses applyInteractionPolicy to enforce pit-of-success principles:
|
|
51
|
+
* - Interaction behavior centralized in foundations
|
|
52
|
+
* - Keyboard handling automatic
|
|
53
|
+
* - Composable via mergeProps
|
|
54
|
+
*/
|
|
55
|
+
export declare function Link({ href, class: className, children, rel, target, 'aria-current': ariaCurrent, 'aria-label': ariaLabel, }: LinkProps): JSX.Element;
|
|
56
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/components/link.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAOH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EACX,MAAM,GACN,MAAM,GACN,UAAU,GACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,CAAC;IACZ;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,KAAK,EAAE,SAAS,EAChB,QAAQ,EACR,GAAG,EACH,MAAM,EACN,cAAc,EAAE,WAAW,EAC3B,YAAY,EAAE,SAAS,GACxB,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CA0CzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{navigate as u}from"../router/navigate.js";import{applyInteractionPolicy as m}from"../foundations/interactions/interaction-policy.js";import{mergeProps as f}from"../foundations/utilities/merge-props.js";import{jsx as p}from"../jsx-runtime.js";function d({href:r,class:a,children:n,rel:i,target:e,"aria-current":o,"aria-label":s}){const l=m({isNative:!0,disabled:!1,onPress:c=>{const t=c;(t.button??0)!==0||t.ctrlKey||t.metaKey||t.shiftKey||t.altKey||e||(t.preventDefault(),u(r))}});return p("a",f(l,{href:r,class:a,rel:i,target:e,"aria-current":o,"aria-label":s,children:n}))}export{d as Link};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invariant assertion utilities for correctness checking
|
|
3
|
+
* Production-safe: invariants are enforced at build-time or with minimal overhead
|
|
4
|
+
*
|
|
5
|
+
* Core principle: fail fast when invariants are violated
|
|
6
|
+
* All functions throw descriptive errors for debugging
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Assert a condition; throw with context if false
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare function invariant(condition: boolean, message: string, context?: Record<string, unknown>): asserts condition;
|
|
13
|
+
/**
|
|
14
|
+
* Assert object property exists and has correct type
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare function assertProperty<T extends object, K extends keyof T>(obj: T, prop: K, expectedType?: string): asserts obj is T & Required<Pick<T, K>>;
|
|
18
|
+
/**
|
|
19
|
+
* Assert a reference is not null/undefined
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function assertDefined<T>(value: T | null | undefined, message: string): asserts value is T;
|
|
23
|
+
/**
|
|
24
|
+
* Assert a task runs exactly once atomically
|
|
25
|
+
* Useful for verifying lifecycle events fire precisely when expected
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare class Once {
|
|
29
|
+
private called;
|
|
30
|
+
private calledAt;
|
|
31
|
+
readonly name: string;
|
|
32
|
+
constructor(name: string);
|
|
33
|
+
check(): boolean;
|
|
34
|
+
mark(): void;
|
|
35
|
+
reset(): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Assert a value falls in an enumerated set
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
export declare function assertEnum<T extends readonly unknown[]>(value: unknown, allowedValues: T, fieldName: string): asserts value is T[number];
|
|
42
|
+
/**
|
|
43
|
+
* Assert execution context (scheduler, component, etc)
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
export declare function assertContext(actual: unknown, expected: unknown, contextName: string): asserts actual is typeof expected;
|
|
47
|
+
/**
|
|
48
|
+
* Assert scheduling precondition (not reentering, not during render, etc)
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function assertSchedulingPrecondition(condition: boolean, violationMessage: string): asserts condition;
|
|
52
|
+
/**
|
|
53
|
+
* Assert state precondition
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export declare function assertStatePrecondition(condition: boolean, violationMessage: string): asserts condition;
|
|
57
|
+
/**
|
|
58
|
+
* Verify AbortController lifecycle
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
export declare function assertAbortControllerState(signal: AbortSignal, expectedAborted: boolean, context: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Guard: throw if callback is null when it shouldn't be
|
|
64
|
+
* Used for notifyUpdate, event handlers, etc.
|
|
65
|
+
* @internal
|
|
66
|
+
*/
|
|
67
|
+
export declare function assertCallbackAvailable<T extends (...args: unknown[]) => unknown>(callback: T | null | undefined, callbackName: string): asserts callback is T;
|
|
68
|
+
/**
|
|
69
|
+
* Verify evaluation generation prevents stale evaluations
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
export declare function assertEvaluationGeneration(current: number, latest: number, context: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Verify mounted flag state
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export declare function assertMountedState(mounted: boolean, expectedMounted: boolean, context: string): void;
|
|
78
|
+
/**
|
|
79
|
+
* Verify no null target when rendering
|
|
80
|
+
* @internal
|
|
81
|
+
*/
|
|
82
|
+
export declare function assertRenderTarget(target: Element | null, context: string): asserts target is Element;
|
|
83
|
+
//# sourceMappingURL=invariant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invariant.d.ts","sourceRoot":"","sources":["../../src/dev/invariant.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;GAGG;AACH,wBAAgB,SAAS,CACvB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,SAAS,CAKnB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAChE,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,CAAC,EACP,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAazC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAC3B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,KAAK,IAAI,CAAC,CAEpB;AAED;;;;GAIG;AACH,qBAAa,IAAI;IACf,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAuB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM;IAIxB,KAAK,IAAI,OAAO;IAIhB,IAAI,IAAI,IAAI;IAUZ,KAAK,IAAI,IAAI;CAId;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EACrD,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,CAAC,EAChB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,MAAM,CAAC,CAM5B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,IAAI,OAAO,QAAQ,CAMnC;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,OAAO,EAClB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,SAAS,CAEnB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,OAAO,EAClB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,SAAS,CAEnB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,WAAW,EACnB,eAAe,EAAE,OAAO,EACxB,OAAO,EAAE,MAAM,GACd,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EACzC,QAAQ,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,IAAI,CAAC,CAM7E;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,IAAI,CAMN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,eAAe,EAAE,OAAO,EACxB,OAAO,EAAE,MAAM,GACd,IAAI,CAMN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,OAAO,GAAG,IAAI,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,IAAI,OAAO,CAI3B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(t,n,i){if(!t){const s=i?`
|
|
2
|
+
`+JSON.stringify(i,null,2):"";throw new Error(`[Askr Invariant] ${n}${s}`)}}function a(t,n,i){if(e(n in t,`Object missing required property '${String(n)}'`,{object:t}),i){const s=typeof t[n];e(s===i,`Property '${String(n)}' has type '${s}', expected '${i}'`,{value:t[n],expectedType:i})}}function r(t,n){e(t!=null,n,{value:t})}class o{constructor(n){this.called=!1,this.calledAt=null,this.name=n}check(){return this.called}mark(){e(!this.called,`${this.name} called multiple times (previously at ${this.calledAt}ms)`,{now:Date.now()}),this.called=!0,this.calledAt=Date.now()}reset(){this.called=!1,this.calledAt=null}}function l(t,n,i){e(n.includes(t),`${i} must be one of [${n.join(", ")}], got ${JSON.stringify(t)}`,{value:t,allowed:n})}function c(t,n,i){e(t===n,`Invalid ${i} context. Expected ${n}, got ${t}`,{expected:n,actual:t})}function u(t,n){e(t,`[Scheduler Precondition] ${n}`)}function $(t,n){e(t,`[State Precondition] ${n}`)}function d(t,n,i){e(t.aborted===n,`AbortSignal ${n?"should be":"should not be"} aborted in ${i}`,{actual:t.aborted,expected:n})}function f(t,n){e(t!=null,`${n} callback is required but not available`,{callback:t})}function h(t,n,i){e(t===n,`Stale evaluation generation in ${i}: current ${t}, latest ${n}`,{current:t,latest:n})}function S(t,n,i){e(t===n,`Invalid mounted state in ${i}: expected ${n}, got ${t}`,{mounted:t,expected:n})}function g(t,n){e(t!==null,`Cannot render in ${n}: target is null`,{target:t})}export{o as Once,d as assertAbortControllerState,f as assertCallbackAvailable,c as assertContext,r as assertDefined,l as assertEnum,h as assertEvaluationGeneration,S as assertMountedState,a as assertProperty,g as assertRenderTarget,u as assertSchedulingPrecondition,$ as assertStatePrecondition,e as invariant};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized logger interface
|
|
3
|
+
* - Keeps production builds silent for debug/warn/info messages
|
|
4
|
+
* - Ensures consistent behavior across the codebase
|
|
5
|
+
* - Protects against missing `console` in some environments
|
|
6
|
+
*/
|
|
7
|
+
export declare const logger: {
|
|
8
|
+
debug: (...args: unknown[]) => void;
|
|
9
|
+
info: (...args: unknown[]) => void;
|
|
10
|
+
warn: (...args: unknown[]) => void;
|
|
11
|
+
error: (...args: unknown[]) => void;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/dev/logger.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,eAAO,MAAM,MAAM;qBACA,OAAO,EAAE;oBAKV,OAAO,EAAE;oBAKT,OAAO,EAAE;qBAKR,OAAO,EAAE;CAG3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(n,t){const r=typeof console<"u"?console:void 0;if(!r)return;const e=r[n];if(typeof e=="function")try{e.apply(console,t)}catch{}}const f={debug:(...n)=>{},info:(...n)=>{},warn:(...n)=>{},error:(...n)=>{o("error",n)}};export{f as logger};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vite plugin for Askr
|
|
3
|
+
*
|
|
4
|
+
* Provides sensible defaults so Vite "just works" with Askr without extra config:
|
|
5
|
+
* - Configures esbuild JSX injection and `optimizeDeps.include` so the runtime is available
|
|
6
|
+
* - Optional SSR template precompilation for improved server rendering performance
|
|
7
|
+
*/
|
|
8
|
+
import type { Plugin } from 'vite';
|
|
9
|
+
export interface AskrVitePluginOptions {
|
|
10
|
+
/** Enable the built-in JSX transform that rewrites JSX to Askr's automatic runtime. */
|
|
11
|
+
transformJsx?: boolean;
|
|
12
|
+
/** Enable SSR template precompilation for improved server rendering performance. */
|
|
13
|
+
ssrPrecompile?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function askrVitePlugin(opts?: AskrVitePluginOptions): Plugin;
|
|
16
|
+
export declare const askr: typeof askrVitePlugin;
|
|
17
|
+
export default askrVitePlugin;
|
|
18
|
+
//# sourceMappingURL=vite-plugin-askr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-askr.d.ts","sourceRoot":"","sources":["../../src/dev/vite-plugin-askr.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,MAAM,WAAW,qBAAqB;IACpC,uFAAuF;IACvF,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oFAAoF;IACpF,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AA6CD,wBAAgB,cAAc,CAAC,IAAI,GAAE,qBAA0B,GAAG,MAAM,CAsFvE;AAGD,eAAO,MAAM,IAAI,uBAAiB,CAAC;AAEnC,eAAe,cAAc,CAAC"}
|