@askrjs/askr 0.2.3 → 0.3.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/CHANGELOG.md +11 -0
- package/dist/access-CEA2pOry.js +1046 -0
- package/dist/actions/index.d.ts +16 -2
- package/dist/actions/index.js +5 -5
- package/dist/{activity-ZxJXI9hF.js → activity-oy2YFTFF.js} +22 -16
- package/dist/benchmark.js +8 -9
- package/dist/boot/index.d.ts +21 -9
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D4GaLA0d.js → boot-BMBMWUGI.js} +680 -440
- package/dist/capabilities-Bbf0mlp9.js +42 -0
- package/dist/components/index.d.ts +11 -8
- package/dist/components/index.js +1 -1
- package/dist/{compose-ref-Bfaf4kUC.js → compose-ref-v0qGlHoN.js} +7 -1
- package/dist/control/index.d.ts +20 -2
- package/dist/control/index.js +1 -1
- package/dist/{control-57x3wa4J.js → control-BR_mrX__.js} +4 -4
- package/dist/core.d.ts +163 -0
- package/dist/csp-nonce-BfFWcd0w.js +173 -0
- package/dist/data/index.d.ts +74 -2
- package/dist/data/index.js +3 -3
- package/dist/{data-B7XCDeC8.js → data-2edW0jhF.js} +133 -138
- package/dist/{data-runtime-7t_Y0iv3.js → data-runtime-CxoY98lX.js} +22 -15
- package/dist/{deferred-BELyvMsC.js → deferred-CbgNhf67.js} +5 -5
- package/dist/dom-renderer.d.ts +77 -0
- package/dist/domains/actions.d.ts +70 -0
- package/dist/domains/component.d.ts +119 -0
- package/dist/domains/context.d.ts +73 -0
- package/dist/domains/control.d.ts +328 -0
- package/dist/domains/data.d.ts +461 -0
- package/dist/domains/diagnostics.d.ts +21 -0
- package/dist/domains/lifecycle.d.ts +112 -0
- package/dist/domains/refs.d.ts +18 -0
- package/dist/domains/renderer.d.ts +127 -0
- package/dist/domains/routing.d.ts +501 -0
- package/dist/domains/scheduler.d.ts +79 -0
- package/dist/domains/server.d.ts +112 -0
- package/dist/domains/state.d.ts +129 -0
- package/dist/domains/telemetry.d.ts +29 -0
- package/dist/eager-control.d.ts +8 -0
- package/dist/{effect-4LwBwV58.js → effect-C3Zsc1k6.js} +14 -41
- package/dist/{types-DkVJhVs9.d.ts → elements.d.ts} +84 -42
- package/dist/{for-internal-DeoSg_AV.js → for-state-BDykeOJL.js} +623 -511
- package/dist/foundations/icon/index.d.ts +67 -16
- package/dist/foundations/icon/index.js +1 -1
- package/dist/foundations/index.d.ts +26 -3
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/interactions/index.d.ts +73 -34
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +12 -5
- package/dist/foundations/state/index.js +1 -1
- package/dist/foundations/structures/index.d.ts +44 -3
- package/dist/foundations/structures/index.js +1 -1
- package/dist/foundations/utilities/index.d.ts +34 -3
- package/dist/foundations/utilities/index.js +1 -1
- package/dist/fx/index.d.ts +72 -25
- package/dist/fx/index.js +8 -8
- package/dist/index.d.ts +121 -4
- package/dist/index.js +316 -47
- package/dist/{component-internal-Dl02WQKS.js → instance-VAFYVJOa.js} +495 -283
- package/dist/{interactions-D102JxBR.js → interactions-CTeACdT_.js} +1 -1
- package/dist/jsx-dev-runtime.d.ts +51 -11
- package/dist/jsx-globals.d.ts +2 -0
- package/dist/jsx-runtime-CPJXAOBF.js +43 -0
- package/dist/jsx-runtime.d.ts +17 -3
- package/dist/jsx-runtime.js +2 -42
- package/dist/jsx.d.ts +108 -0
- package/dist/{manifest-D6rfj_jC.js → manifest-D1P3UNWV.js} +4 -9
- package/dist/{navigate-C46GtScG.js → navigate-prC5V8XV.js} +204 -476
- package/dist/{navigate-wel1e6cU.d.ts → navigation.d.ts} +10 -8
- package/dist/{readable-CEcteIDE.js → notify-DxxuDPeY.js} +96 -34
- package/dist/{query-registry-Bua3cDyb.js → query-registry-LrYpQsDJ.js} +1 -1
- package/dist/{compose-ref-DOJHoW5X.d.ts → refs.d.ts} +11 -7
- package/dist/{ssr-BaC5qHEw.js → render-resolved-BC0W7_5b.js} +165 -558
- package/dist/{renderer-BhXofszH.js → renderer-CT0HeY58.js} +6866 -5715
- package/dist/{resolution-t8J0yNaU.js → resolution-3DskUkjG.js} +189 -180
- package/dist/{resource-operation-B8q-QRUx.js → resource-18-sFRl9.js} +98 -58
- package/dist/resources/index.d.ts +64 -46
- package/dist/resources/index.js +215 -9
- package/dist/route-activity.d.ts +21 -0
- package/dist/{route-matching-Bo6UqG-5.js → route-matching-CUzZ31gT.js} +68 -82
- package/dist/router/index.d.ts +378 -79
- package/dist/router/index.js +9 -9
- package/dist/router-internal-7nuNEHfG.js +36 -0
- package/dist/scope-Cq_iYbTR.js +403 -0
- package/dist/{selector-C7rIpOnN.js → selector-BSPVkjKP.js} +41 -41
- package/dist/{shared-CGrx2AOL.js → shared-kU8yvryp.js} +3 -6
- package/dist/{snapshot-source-BB42xgwb.js → snapshot-source-An4iKajG.js} +1 -1
- package/dist/ssg/index.d.ts +51 -15
- package/dist/ssg/index.js +269 -209
- package/dist/ssr/index.d.ts +121 -68
- package/dist/ssr/index.js +2 -1
- package/dist/ssr-CiNm6Vzl.js +393 -0
- package/dist/{ssr-DSHd_Q9K.js → ssr-EPjwJH5R.js} +5 -1
- package/dist/{state-BzhOW2TX.js → state-BXJfudq1.js} +10 -15
- package/dist/{structures-BwfeO4Iz.js → structures-CjEzfj4h.js} +37 -57
- package/dist/{index-r5THqzPN.d.ts → structures.d.ts} +57 -36
- package/dist/testing/index.d.ts +125 -24
- package/dist/testing/index.js +26 -62
- package/dist/timer-C7uqnJVt.js +85 -0
- package/dist/{index-B1gu0_m0.d.ts → utilities.d.ts} +24 -13
- package/dist/{verify-hydration-_Q6avFp0.js → verify-hydration-ikaxotf7.js} +8 -5
- package/package.json +13 -15
- package/dist/access-Rr7CMa06.js +0 -507
- package/dist/activity-CAJ5eho-.d.ts +0 -14
- package/dist/benchmark.d.ts +0 -26
- package/dist/cleanup-DsrbV-rr.js +0 -535
- package/dist/component-cleanup-DjpwO9WX.js +0 -143
- package/dist/component-scope-4I3yEMkb.js +0 -195
- package/dist/control-DdFw-Caz.d.ts +0 -8
- package/dist/csp-nonce-C9OuML0U.js +0 -72
- package/dist/css-BuPaTOfe.js +0 -70
- package/dist/fastlane-Buz1Rvlr.js +0 -166
- package/dist/index-DSqXWc77.d.ts +0 -1402
- package/dist/jsx-runtime-BTzDdBJ_.d.ts +0 -2
- package/dist/jsx-runtime-Cdd6Gkb0.d.ts +0 -38
- package/dist/lifecycle-batch-Be-CLDjV.js +0 -253
- package/dist/lifecycle-operations-C5m03NQc.js +0 -195
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
action,
|
|
3
|
+
ActionValidationError,
|
|
4
|
+
ActionForm,
|
|
5
|
+
defineAction,
|
|
6
|
+
ActionStatus,
|
|
7
|
+
ActionDescriptor,
|
|
8
|
+
} from '../core.js';
|
|
9
|
+
export {
|
|
10
|
+
ActionDescriptor,
|
|
11
|
+
ActionForm,
|
|
12
|
+
ActionStatus,
|
|
13
|
+
ActionValidationError,
|
|
14
|
+
action,
|
|
15
|
+
defineAction,
|
|
16
|
+
};
|
package/dist/actions/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as getCurrentAppRenderRuntime } from "../
|
|
1
|
+
import { d as getCurrentAppRenderRuntime } from "../scope-Cq_iYbTR.js";
|
|
2
2
|
import { r as getCurrentRenderData } from "../render-context-B7ohlh6t.js";
|
|
3
|
-
import { t as state } from "../state-
|
|
4
|
-
import {
|
|
5
|
-
import { c as resolveDataRuntimeState, s as invalidateQueriesForRuntime } from "../data-runtime-
|
|
6
|
-
import { r as isCurrentAsyncGeneration } from "../shared-
|
|
3
|
+
import { t as state } from "../state-BXJfudq1.js";
|
|
4
|
+
import { r as jsxs, t as jsx } from "../jsx-runtime-CPJXAOBF.js";
|
|
5
|
+
import { c as resolveDataRuntimeState, s as invalidateQueriesForRuntime } from "../data-runtime-CxoY98lX.js";
|
|
6
|
+
import { r as isCurrentAsyncGeneration } from "../shared-kU8yvryp.js";
|
|
7
7
|
//#region src/actions/runtime.ts
|
|
8
8
|
const emptyFramework = Object.freeze({});
|
|
9
9
|
/** @internal Read Askr-owned state from the current application root. */
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { a as registerCommitOperation } from "./instance-VAFYVJOa.js";
|
|
2
|
+
import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance, i as claimHookIndex } from "./scope-Cq_iYbTR.js";
|
|
3
|
+
import { a as ownComponentCleanup, i as isServerComponent, n as getComponentLifecycleSlot } from "./capabilities-Bbf0mlp9.js";
|
|
4
|
+
import { t as notifyReadableSource, v as recordReadableRead } from "./notify-DxxuDPeY.js";
|
|
4
5
|
import { n as getActiveRenderContext } from "./render-context-B7ohlh6t.js";
|
|
5
6
|
import { n as syncRouteActivitySnapshot } from "./route-activity-CNJfpwx-.js";
|
|
6
|
-
import { b as
|
|
7
|
+
import { b as getActiveRouteBasePath, c as removeRouteBasePath, d as deepFreeze, f as makeQuery, n as computeMatchesFromRoutes, p as parseLocation, x as getActiveRoutes } from "./route-matching-CUzZ31gT.js";
|
|
7
8
|
//#region src/common/app-render-runtime.ts
|
|
8
9
|
const stagedRouteLocations = /* @__PURE__ */ new WeakMap();
|
|
9
10
|
function createAppRenderRuntime(input = {}) {
|
|
@@ -39,10 +40,7 @@ function onRouteChange(fn, options = {}) {
|
|
|
39
40
|
if (!instance) return;
|
|
40
41
|
const route = currentRoute();
|
|
41
42
|
const index = claimHookIndex(instance, "route-change");
|
|
42
|
-
const
|
|
43
|
-
const existing = slots[index];
|
|
44
|
-
if (existing && existing.kind !== "route-change") throw new Error(`onRouteChange() lifecycle order violation: slot ${index} already belongs to ${existing.kind}(). Keep lifecycle primitives in a stable top-level order.`);
|
|
45
|
-
const slot = existing ?? {
|
|
43
|
+
const slot = getComponentLifecycleSlot(instance, index, "route-change", () => ({
|
|
46
44
|
kind: "route-change",
|
|
47
45
|
previous: null,
|
|
48
46
|
pending: null,
|
|
@@ -50,14 +48,12 @@ function onRouteChange(fn, options = {}) {
|
|
|
50
48
|
cleanupRegistered: false,
|
|
51
49
|
callback: fn,
|
|
52
50
|
immediate: options.immediate === true
|
|
53
|
-
};
|
|
54
|
-
slots[index] = slot;
|
|
51
|
+
}), "onRouteChange");
|
|
55
52
|
slot.pending = route;
|
|
56
53
|
slot.callback = fn;
|
|
57
54
|
slot.immediate = options.immediate === true;
|
|
58
55
|
if (!slot.cleanupRegistered) {
|
|
59
|
-
instance
|
|
60
|
-
instance.cleanupFns.push(() => {
|
|
56
|
+
ownComponentCleanup(instance, () => {
|
|
61
57
|
slot.cleanup?.();
|
|
62
58
|
slot.cleanup = null;
|
|
63
59
|
});
|
|
@@ -83,6 +79,14 @@ function onRouteChange(fn, options = {}) {
|
|
|
83
79
|
});
|
|
84
80
|
}
|
|
85
81
|
let serverLocation = null;
|
|
82
|
+
function readLocationState() {
|
|
83
|
+
const historyState = typeof window !== "undefined" && window.history?.state ? window.history.state : null;
|
|
84
|
+
const hasState = historyState?.askrHasState === true;
|
|
85
|
+
return {
|
|
86
|
+
hasState,
|
|
87
|
+
state: hasState ? historyState.askrState : void 0
|
|
88
|
+
};
|
|
89
|
+
}
|
|
86
90
|
function logicalRoutePathname(pathname) {
|
|
87
91
|
const logical = removeRouteBasePath(pathname, getActiveRouteBasePath());
|
|
88
92
|
return logical === void 0 ? void 0 : parseLocation(logical).pathname;
|
|
@@ -111,11 +115,13 @@ function buildRouteSnapshot(pathname, search, hash) {
|
|
|
111
115
|
pathname = location.pathname;
|
|
112
116
|
const query = makeQuery(search);
|
|
113
117
|
const matches = location.withinBasePath ? computeMatchesFromRoutes(pathname, getActiveRoutes()) : [];
|
|
118
|
+
const locationState = readLocationState();
|
|
114
119
|
return Object.freeze({
|
|
115
120
|
path: pathname,
|
|
116
121
|
params: deepFreeze({ ...matches[0]?.params }),
|
|
117
122
|
query,
|
|
118
123
|
hash: hash || null,
|
|
124
|
+
...locationState,
|
|
119
125
|
matches: Object.freeze(matches)
|
|
120
126
|
});
|
|
121
127
|
}
|
|
@@ -123,9 +129,7 @@ function setCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
|
|
|
123
129
|
currentRouteSnapshot = buildRouteSnapshot(pathname, search, hash);
|
|
124
130
|
syncRouteActivitySnapshot(currentRouteSnapshot.path, activityMatches ?? currentRouteSnapshot.matches);
|
|
125
131
|
const instance = getCurrentComponentInstance();
|
|
126
|
-
|
|
127
|
-
markReactivePropsDirtySource(currentRouteSource);
|
|
128
|
-
notifyReadableReaders(currentRouteSource, instance);
|
|
132
|
+
notifyReadableSource(currentRouteSource, { skipInstance: instance });
|
|
129
133
|
}
|
|
130
134
|
function readCurrentRouteLocation() {
|
|
131
135
|
const renderContext = getActiveRenderContext();
|
|
@@ -172,11 +176,13 @@ function readCurrentRouteSnapshot() {
|
|
|
172
176
|
const matches = withinBasePath ? computeMatchesFromRoutes(pathname, getActiveRoutes()) : [];
|
|
173
177
|
const routeParams = (withinBasePath ? getActiveRenderContext()?.params : void 0) ?? matches[0]?.params ?? {};
|
|
174
178
|
const params = deepFreeze({ ...routeParams });
|
|
179
|
+
const locationState = readLocationState();
|
|
175
180
|
return Object.freeze({
|
|
176
181
|
path: pathname,
|
|
177
182
|
params,
|
|
178
183
|
query,
|
|
179
184
|
hash: hash || null,
|
|
185
|
+
...locationState,
|
|
180
186
|
matches: Object.freeze(matches)
|
|
181
187
|
});
|
|
182
188
|
}
|
|
@@ -184,7 +190,7 @@ function readCurrentRouteSnapshot() {
|
|
|
184
190
|
function currentRoute() {
|
|
185
191
|
const instance = getCurrentComponentInstance();
|
|
186
192
|
if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
|
|
187
|
-
if (typeof window === "undefined" || instance
|
|
193
|
+
if (typeof window === "undefined" || isServerComponent(instance)) return readCurrentRouteSnapshot();
|
|
188
194
|
recordReadableRead(currentRouteSource);
|
|
189
195
|
return readCurrentRouteSnapshot();
|
|
190
196
|
}
|
package/dist/benchmark.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { r as flushRuntimeScheduler } from "./access-
|
|
2
|
-
import { t as state } from "./state-
|
|
3
|
-
import { t as selector } from "./selector-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { t as createIsland } from "./boot-D4GaLA0d.js";
|
|
1
|
+
import { r as flushRuntimeScheduler } from "./access-CEA2pOry.js";
|
|
2
|
+
import { t as state } from "./state-BXJfudq1.js";
|
|
3
|
+
import { t as selector } from "./selector-BSPVkjKP.js";
|
|
4
|
+
import { i as For } from "./control-BR_mrX__.js";
|
|
5
|
+
import { r as jsxs, t as jsx } from "./jsx-runtime-CPJXAOBF.js";
|
|
6
|
+
import { r as createIsland, s as installRendererBridge } from "./boot-BMBMWUGI.js";
|
|
8
7
|
//#region src/bench/components/benchmark-row.tsx
|
|
9
8
|
function BenchmarkRow({ item, isSelected, onSelect, onRemove }) {
|
|
10
9
|
return /* @__PURE__ */ jsxs("tr", {
|
|
@@ -63,8 +62,8 @@ function BenchmarkTable({ rows, isSelected, onSelect, onRemove }) {
|
|
|
63
62
|
installRendererBridge();
|
|
64
63
|
const benchmarkMetadata = {
|
|
65
64
|
packageName: "@askrjs/askr",
|
|
66
|
-
packageVersion: "0.
|
|
67
|
-
buildLabel: "0.
|
|
65
|
+
packageVersion: "0.3.0",
|
|
66
|
+
buildLabel: "0.3.0-local"
|
|
68
67
|
};
|
|
69
68
|
function getBenchmarkMetadata() {
|
|
70
69
|
return { ...benchmarkMetadata };
|
package/dist/boot/index.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
RouteAuthOptions,
|
|
3
|
+
RouteRegistry,
|
|
4
|
+
ComponentFunction,
|
|
5
|
+
DataRuntime,
|
|
6
|
+
} from '../core.js';
|
|
7
|
+
import { ScrollRestorationOptions } from '../navigation.js';
|
|
4
8
|
/** Configuration for {@link createIsland}: mounts one component onto existing DOM. */
|
|
5
9
|
type IslandConfig = {
|
|
6
10
|
root: Element | string;
|
|
7
11
|
component: ComponentFunction;
|
|
8
12
|
cspNonce?: string;
|
|
13
|
+
/** Optional data runtime owned by this island's render and event lifecycle. */
|
|
14
|
+
dataRuntime?: DataRuntime;
|
|
9
15
|
cleanupStrict?: boolean;
|
|
10
16
|
routes?: never;
|
|
11
17
|
};
|
|
@@ -46,8 +52,6 @@ type HydrateSPAConfig = BootRouteSource & {
|
|
|
46
52
|
skipSelectors?: string[];
|
|
47
53
|
};
|
|
48
54
|
};
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/boot/root-lifecycle.d.ts
|
|
51
55
|
/**
|
|
52
56
|
* Tear down the app mounted at `root`: runs its cleanup callbacks, clears
|
|
53
57
|
* route state if it was the last routed root, and removes bookkeeping for
|
|
@@ -56,8 +60,6 @@ type HydrateSPAConfig = BootRouteSource & {
|
|
|
56
60
|
declare function cleanupApp(root: Element | string): void;
|
|
57
61
|
/** Check whether an app instance is currently mounted at `root`. */
|
|
58
62
|
declare function hasApp(root: Element | string): boolean;
|
|
59
|
-
//#endregion
|
|
60
|
-
//#region src/boot/index.d.ts
|
|
61
63
|
/**
|
|
62
64
|
* createIsland: Enhances existing DOM (no router, mounts once)
|
|
63
65
|
*/
|
|
@@ -81,5 +83,15 @@ declare function createSPA(config: SPAConfig): Promise<void>;
|
|
|
81
83
|
* hydrateSPA: Hydrate server-rendered HTML with an explicit route registry.
|
|
82
84
|
*/
|
|
83
85
|
declare function hydrateSPA(config: HydrateSPAConfig): Promise<void>;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
export {
|
|
87
|
+
type HydrateSPAConfig,
|
|
88
|
+
type IslandConfig,
|
|
89
|
+
type IslandsConfig,
|
|
90
|
+
type SPAConfig,
|
|
91
|
+
cleanupApp,
|
|
92
|
+
createIsland,
|
|
93
|
+
createIslands,
|
|
94
|
+
createSPA,
|
|
95
|
+
hasApp,
|
|
96
|
+
hydrateSPA,
|
|
97
|
+
};
|
package/dist/boot/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as cleanupApp, i as
|
|
1
|
+
import { a as cleanupApp, i as createIslands, n as createSPA, o as hasApp, r as createIsland, t as hydrateSPA } from "../boot-BMBMWUGI.js";
|
|
2
2
|
export { cleanupApp, createIsland, createIslands, createSPA, hasApp, hydrateSPA };
|