@askrjs/askr 0.3.1 → 0.4.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 +855 -0
- package/README.md +61 -29
- package/capabilities.json +19 -9
- package/dist/actions/index.js +56 -12
- package/dist/benchmark.js +10 -15
- package/dist/boot/index.d.ts +3 -2
- package/dist/boot/index.js +1 -1
- package/dist/boot-DaoTYoCw.js +3989 -0
- package/dist/browser-activity-CB8e-V4f.js +220 -0
- package/dist/components/index.d.ts +8 -1
- package/dist/components/index.js +1 -43
- package/dist/{aria-hKjThHcp.js → compose-ref-DWzdbxsD.js} +41 -4
- package/dist/control/index.d.ts +2 -0
- package/dist/control/index.js +1 -1
- package/dist/control-nfpT2fbK.js +209 -0
- package/dist/core.d.ts +5 -9
- package/dist/csp-nonce-DwGw1A6Q.js +35 -0
- package/dist/data/index.js +3 -3
- package/dist/{data-2edW0jhF.js → data-BCwClJiF.js} +283 -94
- package/dist/data-runtime-C1bFAlba.js +242 -0
- package/dist/{deferred-CbgNhf67.js → deferred-bEEHHvic.js} +42 -20
- package/dist/domains/actions.d.ts +8 -3
- package/dist/domains/component.d.ts +1 -107
- package/dist/domains/context.d.ts +0 -15
- package/dist/domains/control.d.ts +36 -249
- package/dist/domains/data.d.ts +31 -13
- package/dist/domains/diagnostics.d.ts +1 -2
- package/dist/domains/lifecycle.d.ts +2 -5
- package/dist/domains/refs.d.ts +0 -2
- package/dist/domains/routing.d.ts +43 -8
- package/dist/domains/scheduler.d.ts +1 -76
- package/dist/domains/server.d.ts +5 -2
- package/dist/domains/state.d.ts +2 -5
- package/dist/domains/telemetry.d.ts +0 -2
- package/dist/elements.d.ts +214 -51
- package/dist/error-boundary-Bpwofwps.js +293 -0
- package/dist/foundations/icon/index.d.ts +0 -58
- package/dist/foundations/icon/index.js +2 -2
- package/dist/foundations/index.js +2 -1
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +3 -3
- package/dist/foundations/state/index.js +5 -3
- package/dist/foundations/structures/index.js +2 -1
- package/dist/foundations/utilities/index.d.ts +2 -0
- package/dist/foundations/utilities/index.js +1 -2
- package/dist/fx/index.d.ts +31 -58
- package/dist/fx/index.js +313 -195
- package/dist/hooks-BimKStr4.js +202 -0
- package/dist/index.d.ts +11 -74
- package/dist/index.js +8 -447
- package/dist/instance-BAnfmXOR.js +988 -0
- package/dist/{interactions-CTeACdT_.js → interactions-D2BoREb-.js} +3 -2
- package/dist/jsx-dev-runtime.d.ts +41 -18
- package/dist/jsx-dev-runtime.js +1 -6
- package/dist/{jsx-runtime-CPJXAOBF.js → jsx-runtime-C4idqHY0.js} +18 -7
- package/dist/jsx-runtime.js +1 -1
- package/dist/jsx.d.ts +61 -37
- package/dist/{manifest-D1P3UNWV.js → manifest-CW9gyNBY.js} +3 -3
- package/dist/{navigate-prC5V8XV.js → navigate-CP_0Zy5U.js} +454 -87
- package/dist/navigation.d.ts +12 -3
- package/dist/peer-types.d.ts +8 -0
- package/dist/portal-DuOKfnLa.js +349 -0
- package/dist/promise-Dz8iIHAm.js +16 -0
- package/dist/query-registry-WMCN0BJL.js +320 -0
- package/dist/readable-DFWOsTac.js +21 -0
- package/dist/{render-context-B7ohlh6t.js → render-context-DGHnEveC.js} +27 -11
- package/dist/render-sync-IC5lMFpq.js +1240 -0
- package/dist/resolution-Cx82-xjW.js +1244 -0
- package/dist/resource-CLjB7RBQ.js +377 -0
- package/dist/resources/index.d.ts +21 -11
- package/dist/resources/index.js +45 -244
- package/dist/router/index.d.ts +14 -5
- package/dist/router/index.js +22 -53
- package/dist/scope-CwpVSHVf.js +55 -0
- package/dist/{shared-kU8yvryp.js → shared-O2ZnmYAf.js} +1 -7
- package/dist/{snapshot-source-An4iKajG.js → snapshot-Cjx4N988.js} +6 -1
- package/dist/ssg/index.d.ts +1 -2
- package/dist/ssg/index.js +5 -13
- package/dist/ssr/index.d.ts +26 -28
- package/dist/ssr/index.js +4 -4
- package/dist/{ssr-CiNm6Vzl.js → ssr-BJ8ug7zH.js} +133 -122
- package/dist/ssr-DoV-vJ-5.js +229 -0
- package/dist/state-DWO1KzkX.js +232 -0
- package/dist/structures-D4dDMqHX.js +231 -0
- package/dist/testing/index.d.ts +8 -4
- package/dist/testing/index.js +29 -34
- package/dist/url-CnbfpX0K.js +185 -0
- package/dist/utilities.d.ts +48 -2
- package/dist/verify-hydration-DpVaDnqz.js +152 -0
- package/package.json +19 -9
- package/dist/access-CEA2pOry.js +0 -1046
- package/dist/activity-oy2YFTFF.js +0 -201
- package/dist/boot-DLplW9h4.js +0 -1104
- package/dist/capabilities-Bbf0mlp9.js +0 -42
- package/dist/compose-ref-v0qGlHoN.js +0 -26
- package/dist/control-BR_mrX__.js +0 -173
- package/dist/control-C-ApnFs1.js +0 -20
- package/dist/csp-nonce-BfFWcd0w.js +0 -173
- package/dist/data-runtime-CxoY98lX.js +0 -149
- package/dist/default-portal-runtime-DvMvWJVp.js +0 -20
- package/dist/dom-renderer.d.ts +0 -77
- package/dist/domains/renderer.d.ts +0 -127
- package/dist/eager-control.d.ts +0 -8
- package/dist/effect-C3Zsc1k6.js +0 -292
- package/dist/for-state-BDykeOJL.js +0 -1753
- package/dist/instance-VAFYVJOa.js +0 -1027
- package/dist/notify-DxxuDPeY.js +0 -266
- package/dist/portal-w3oQ6oQU.js +0 -29
- package/dist/query-registry-LrYpQsDJ.js +0 -83
- package/dist/render-resolved-BC0W7_5b.js +0 -1123
- package/dist/renderer-CT0HeY58.js +0 -8623
- package/dist/resolution-3DskUkjG.js +0 -577
- package/dist/resource-18-sFRl9.js +0 -344
- package/dist/route-matching-CUzZ31gT.js +0 -551
- package/dist/router-internal-7nuNEHfG.js +0 -36
- package/dist/scope-Cq_iYbTR.js +0 -403
- package/dist/selector-BSPVkjKP.js +0 -311
- package/dist/ssr-EPjwJH5R.js +0 -29
- package/dist/state-BXJfudq1.js +0 -91
- package/dist/structures-CjEzfj4h.js +0 -654
- package/dist/timer-C7uqnJVt.js +0 -85
- package/dist/verify-hydration-ikaxotf7.js +0 -27
- package/dist/vnode-D24p6IW2.js +0 -7
|
@@ -1,201 +0,0 @@
|
|
|
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";
|
|
5
|
-
import { n as getActiveRenderContext } from "./render-context-B7ohlh6t.js";
|
|
6
|
-
import { n as syncRouteActivitySnapshot } from "./route-activity-CNJfpwx-.js";
|
|
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";
|
|
8
|
-
//#region src/common/app-render-runtime.ts
|
|
9
|
-
const stagedRouteLocations = /* @__PURE__ */ new WeakMap();
|
|
10
|
-
function createAppRenderRuntime(input = {}) {
|
|
11
|
-
return {
|
|
12
|
-
framework: Object.freeze({ ...input.framework }),
|
|
13
|
-
route: input.route,
|
|
14
|
-
hasRoute: input.hasRoute ?? false,
|
|
15
|
-
dataRuntime: input.dataRuntime,
|
|
16
|
-
routeRegistry: input.routeRegistry,
|
|
17
|
-
routeAuth: input.routeAuth
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function stageAppRenderRouteLocation(runtime, href) {
|
|
21
|
-
stagedRouteLocations.set(runtime, href);
|
|
22
|
-
}
|
|
23
|
-
function getStagedAppRenderRouteLocation(runtime) {
|
|
24
|
-
return runtime ? stagedRouteLocations.get(runtime) : void 0;
|
|
25
|
-
}
|
|
26
|
-
function clearStagedAppRenderRouteLocation(runtime) {
|
|
27
|
-
if (runtime) stagedRouteLocations.delete(runtime);
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/router/activity.ts
|
|
31
|
-
function routeSignature(route) {
|
|
32
|
-
return `${route.path}\u0000${JSON.stringify(route.query.toJSON())}\u0000${route.hash ?? ""}`;
|
|
33
|
-
}
|
|
34
|
-
let currentRouteSnapshot = buildRouteSnapshot("/", "", "");
|
|
35
|
-
const currentRouteSource = (() => currentRouteSnapshot);
|
|
36
|
-
currentRouteSource._readers = /* @__PURE__ */ new Map();
|
|
37
|
-
/** Register a callback to run whenever the active route changes, with optional cleanup. */
|
|
38
|
-
function onRouteChange(fn, options = {}) {
|
|
39
|
-
const instance = getCurrentComponentInstance();
|
|
40
|
-
if (!instance) return;
|
|
41
|
-
const route = currentRoute();
|
|
42
|
-
const index = claimHookIndex(instance, "route-change");
|
|
43
|
-
const slot = getComponentLifecycleSlot(instance, index, "route-change", () => ({
|
|
44
|
-
kind: "route-change",
|
|
45
|
-
previous: null,
|
|
46
|
-
pending: null,
|
|
47
|
-
cleanup: null,
|
|
48
|
-
cleanupRegistered: false,
|
|
49
|
-
callback: fn,
|
|
50
|
-
immediate: options.immediate === true
|
|
51
|
-
}), "onRouteChange");
|
|
52
|
-
slot.pending = route;
|
|
53
|
-
slot.callback = fn;
|
|
54
|
-
slot.immediate = options.immediate === true;
|
|
55
|
-
if (!slot.cleanupRegistered) {
|
|
56
|
-
ownComponentCleanup(instance, () => {
|
|
57
|
-
slot.cleanup?.();
|
|
58
|
-
slot.cleanup = null;
|
|
59
|
-
});
|
|
60
|
-
slot.cleanupRegistered = true;
|
|
61
|
-
}
|
|
62
|
-
if (!slot.previous) {
|
|
63
|
-
registerCommitOperation(() => {
|
|
64
|
-
const committed = slot.pending;
|
|
65
|
-
if (!committed) return;
|
|
66
|
-
if (slot.immediate) slot.cleanup = slot.callback(committed, null) ?? null;
|
|
67
|
-
slot.previous = committed;
|
|
68
|
-
});
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
if (routeSignature(slot.previous) === routeSignature(route)) return;
|
|
72
|
-
registerCommitOperation(() => {
|
|
73
|
-
const previous = slot.previous;
|
|
74
|
-
const committed = slot.pending;
|
|
75
|
-
if (!previous || !committed || routeSignature(previous) === routeSignature(committed)) return;
|
|
76
|
-
slot.cleanup?.();
|
|
77
|
-
slot.cleanup = slot.callback(committed, previous) ?? null;
|
|
78
|
-
slot.previous = committed;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
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
|
-
}
|
|
90
|
-
function logicalRoutePathname(pathname) {
|
|
91
|
-
const logical = removeRouteBasePath(pathname, getActiveRouteBasePath());
|
|
92
|
-
return logical === void 0 ? void 0 : parseLocation(logical).pathname;
|
|
93
|
-
}
|
|
94
|
-
function routePathname(pathname) {
|
|
95
|
-
const logical = logicalRoutePathname(pathname);
|
|
96
|
-
return logical === void 0 ? {
|
|
97
|
-
pathname: parseLocation(pathname).pathname,
|
|
98
|
-
withinBasePath: false
|
|
99
|
-
} : {
|
|
100
|
-
pathname: logical,
|
|
101
|
-
withinBasePath: true
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function setServerLocation(url) {
|
|
105
|
-
serverLocation = url;
|
|
106
|
-
if (url) {
|
|
107
|
-
const location = routePathname(parseLocation(url).pathname);
|
|
108
|
-
syncRouteActivitySnapshot(location.pathname, location.withinBasePath ? computeMatchesFromRoutes(location.pathname, getActiveRoutes()) : []);
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
syncRouteActivitySnapshot(currentRouteSnapshot.path, currentRouteSnapshot.matches);
|
|
112
|
-
}
|
|
113
|
-
function buildRouteSnapshot(pathname, search, hash) {
|
|
114
|
-
const location = routePathname(pathname);
|
|
115
|
-
pathname = location.pathname;
|
|
116
|
-
const query = makeQuery(search);
|
|
117
|
-
const matches = location.withinBasePath ? computeMatchesFromRoutes(pathname, getActiveRoutes()) : [];
|
|
118
|
-
const locationState = readLocationState();
|
|
119
|
-
return Object.freeze({
|
|
120
|
-
path: pathname,
|
|
121
|
-
params: deepFreeze({ ...matches[0]?.params }),
|
|
122
|
-
query,
|
|
123
|
-
hash: hash || null,
|
|
124
|
-
...locationState,
|
|
125
|
-
matches: Object.freeze(matches)
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function setCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
|
|
129
|
-
currentRouteSnapshot = buildRouteSnapshot(pathname, search, hash);
|
|
130
|
-
syncRouteActivitySnapshot(currentRouteSnapshot.path, activityMatches ?? currentRouteSnapshot.matches);
|
|
131
|
-
const instance = getCurrentComponentInstance();
|
|
132
|
-
notifyReadableSource(currentRouteSource, { skipInstance: instance });
|
|
133
|
-
}
|
|
134
|
-
function readCurrentRouteLocation() {
|
|
135
|
-
const renderContext = getActiveRenderContext();
|
|
136
|
-
if (renderContext?.url) {
|
|
137
|
-
const parsed = parseLocation(renderContext.url);
|
|
138
|
-
const location = routePathname(parsed.pathname);
|
|
139
|
-
return {
|
|
140
|
-
...parsed,
|
|
141
|
-
...location
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
const stagedRouteLocation = getStagedAppRenderRouteLocation(getCurrentAppRenderRuntime());
|
|
145
|
-
if (stagedRouteLocation) {
|
|
146
|
-
const parsed = parseLocation(stagedRouteLocation);
|
|
147
|
-
const location = routePathname(parsed.pathname);
|
|
148
|
-
return {
|
|
149
|
-
...parsed,
|
|
150
|
-
...location
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
if (typeof window !== "undefined" && window.location) return {
|
|
154
|
-
...routePathname(window.location.pathname || "/"),
|
|
155
|
-
search: window.location.search || "",
|
|
156
|
-
hash: window.location.hash || ""
|
|
157
|
-
};
|
|
158
|
-
if (serverLocation) {
|
|
159
|
-
const parsed = parseLocation(serverLocation);
|
|
160
|
-
const location = routePathname(parsed.pathname);
|
|
161
|
-
return {
|
|
162
|
-
...parsed,
|
|
163
|
-
...location
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
...routePathname(currentRouteSnapshot.path),
|
|
168
|
-
search: "",
|
|
169
|
-
hash: currentRouteSnapshot.hash ?? ""
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
function readCurrentRouteSnapshot() {
|
|
173
|
-
if (!getCurrentComponentInstance()) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
|
|
174
|
-
const { pathname, search, hash, withinBasePath } = readCurrentRouteLocation();
|
|
175
|
-
const query = makeQuery(search);
|
|
176
|
-
const matches = withinBasePath ? computeMatchesFromRoutes(pathname, getActiveRoutes()) : [];
|
|
177
|
-
const routeParams = (withinBasePath ? getActiveRenderContext()?.params : void 0) ?? matches[0]?.params ?? {};
|
|
178
|
-
const params = deepFreeze({ ...routeParams });
|
|
179
|
-
const locationState = readLocationState();
|
|
180
|
-
return Object.freeze({
|
|
181
|
-
path: pathname,
|
|
182
|
-
params,
|
|
183
|
-
query,
|
|
184
|
-
hash: hash || null,
|
|
185
|
-
...locationState,
|
|
186
|
-
matches: Object.freeze(matches)
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
/** Read the currently active route's {@link RouteSnapshot}; reactive during component render. */
|
|
190
|
-
function currentRoute() {
|
|
191
|
-
const instance = getCurrentComponentInstance();
|
|
192
|
-
if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
|
|
193
|
-
if (typeof window === "undefined" || isServerComponent(instance)) return readCurrentRouteSnapshot();
|
|
194
|
-
recordReadableRead(currentRouteSource);
|
|
195
|
-
return readCurrentRouteSnapshot();
|
|
196
|
-
}
|
|
197
|
-
function syncCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
|
|
198
|
-
setCurrentRouteSnapshot(pathname, search, hash, activityMatches);
|
|
199
|
-
}
|
|
200
|
-
//#endregion
|
|
201
|
-
export { clearStagedAppRenderRouteLocation as a, syncCurrentRouteSnapshot as i, onRouteChange as n, createAppRenderRuntime as o, setServerLocation as r, stageAppRenderRouteLocation as s, currentRoute as t };
|