@askrjs/askr 0.0.84 → 0.0.86
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/dist/{access-ePqdQqkV.js → access-Dpfoi4cA.js} +7 -1
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +3 -3
- package/dist/{activity-pySy9t7Y.d.ts → activity-B1I5HJQI.d.ts} +1 -1
- package/dist/{activity-CZiPgZy0.js → activity-BvgvaMZA.js} +53 -16
- package/dist/benchmark.js +8 -8
- package/dist/boot/index.d.ts +3 -3
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D28lesMw.js → boot-CViTpUiB.js} +22 -20
- package/dist/{cleanup-ARiXproi.js → cleanup-c837KVij.js} +16 -6
- package/dist/{component-cleanup-Bug5tSiG.js → component-cleanup-BUfUleGZ.js} +2 -2
- package/dist/{component-internal-Bw4Mf9fd.js → component-internal-DcrLymUJ.js} +5 -5
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/control/index.d.ts +1 -1
- package/dist/control/index.js +1 -1
- package/dist/{control-Y8F73Uln.d.ts → control-DhUZU4_V.d.ts} +2 -1
- package/dist/{control-nrS65oG3.js → control-oLADku43.js} +4 -4
- package/dist/{csp-nonce-ZTlD_EnK.js → csp-nonce-Bc52OIVc.js} +19 -2
- package/dist/data/index.js +3 -3
- package/dist/{data-BRS5woEh.js → data-DGrD3-qA.js} +5 -5
- package/dist/{data-runtime-D68YOo9L.js → data-runtime-Ck3tJDDQ.js} +1 -1
- package/dist/default-portal-runtime-DvMvWJVp.js +20 -0
- package/dist/{authoring-DQPG0VAm.js → deferred-nleQtdfY.js} +85 -5
- package/dist/{effect-B487asyz.js → effect-lnxQIpJG.js} +2 -2
- package/dist/{fastlane-BOr4lSLl.js → fastlane-CrfB3QG0.js} +2 -2
- package/dist/{for-internal-DjpV8ioj.js → for-internal-B_mnQhan.js} +18 -6
- package/dist/foundations/index.d.ts +1 -1
- package/dist/foundations/index.js +1 -2
- package/dist/foundations/state/index.d.ts +1 -1
- package/dist/foundations/state/index.js +1 -1
- package/dist/foundations/structures/index.d.ts +2 -2
- package/dist/foundations/structures/index.js +2 -3
- package/dist/fx/index.js +1 -1
- package/dist/{index-BApH3laU.d.ts → index-DflhL1h8.d.ts} +20 -16
- package/dist/{index-_UN08Pg1.d.ts → index-pIgGaXvS.d.ts} +19 -3
- package/dist/{index-DUXXZ31H.d.ts → index-r-nt13FE.d.ts} +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -12
- package/dist/{lifecycle-batch-CFI4NKpJ.js → lifecycle-batch-Dfpid9-A.js} +39 -20
- package/dist/{lifecycle-operations-KYOIcM5R.js → lifecycle-operations-BrYrBsXY.js} +1 -1
- package/dist/manifest-D1P9uTlz.js +53 -0
- package/dist/{navigate-Dr3cjOSz.js → navigate-BwAPbpCb.js} +17 -16
- package/dist/{navigate-CgVIrrSs.d.ts → navigate-NyIjQUwI.d.ts} +1 -1
- package/dist/{query-registry-BL6rjGsO.js → query-registry-CPW_6nwF.js} +1 -1
- package/dist/{readable-_GQGe_St.js → readable-B5NtV7V0.js} +1 -1
- package/dist/render-context-D0Hoj9dW.js +161 -0
- package/dist/{renderer-B9j5IV1q.js → renderer-D9DL9R2D.js} +58 -17
- package/dist/{deferred-oqtAJ4iH.js → resolution-YHwi4Bav.js} +234 -222
- package/dist/resource-operation-ys6eDoRJ.js +304 -0
- package/dist/resources/index.d.ts +2 -2
- package/dist/resources/index.js +5 -5
- package/dist/{route-matching-IfQZmqkN.js → route-matching-DqULzZtC.js} +46 -277
- package/dist/router/index.d.ts +12 -10
- package/dist/router/index.js +10 -7
- package/dist/{selector-DJ1-N1K-.js → selector-Ck_Pp9av.js} +2 -2
- package/dist/ssg/index.d.ts +9 -3
- package/dist/ssg/index.js +31 -15
- package/dist/ssr/index.d.ts +7 -3
- package/dist/ssr/index.js +2 -2
- package/dist/{ssr-CtC4lChT.js → ssr-B98593qJ.js} +53 -27
- package/dist/ssr-DSHd_Q9K.js +25 -0
- package/dist/{state-BzIMC6-i.js → state-DCjONcHK.js} +4 -3
- package/dist/{portal-pHBoqwYd.js → structures-DsOm-clq.js} +236 -7
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +4 -4
- package/dist/{verify-hydration-BguOSco9.js → verify-hydration-ww1dgwea.js} +5 -4
- package/package.json +2 -2
- package/dist/render-context-D-DFk2WN.js +0 -73
- package/dist/ssr-CbQO5xd3.js +0 -12
- package/dist/structures-D3vO-WMN.js +0 -221
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as clearCurrentComponentScope, y as restoreCurrentComponentScope } from "./component-scope-DzJEbYGE.js";
|
|
1
2
|
//#region src/common/env.ts
|
|
2
3
|
function normalizeEnv(source) {
|
|
3
4
|
if (!source) return {};
|
|
@@ -471,7 +472,12 @@ function enqueueRuntimeLane(lane, task) {
|
|
|
471
472
|
getRuntimeScheduler().enqueueInLane(lane, task);
|
|
472
473
|
}
|
|
473
474
|
function runRuntimeHandlerScope(fn, flushMode = "defer") {
|
|
474
|
-
|
|
475
|
+
const savedScope = clearCurrentComponentScope();
|
|
476
|
+
try {
|
|
477
|
+
return getRuntimeScheduler().runInHandlerScope(fn, flushMode);
|
|
478
|
+
} finally {
|
|
479
|
+
restoreCurrentComponentScope(savedScope);
|
|
480
|
+
}
|
|
475
481
|
}
|
|
476
482
|
function runRuntimeWithSyncProgress(fn) {
|
|
477
483
|
return getRuntimeScheduler().runWithSyncProgress(fn);
|
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as action, i as ActionValidationError, n as ActionForm, o as defineAction, r as ActionStatus, t as ActionDescriptor } from "../index-
|
|
1
|
+
import { a as action, i as ActionValidationError, n as ActionForm, o as defineAction, r as ActionStatus, t as ActionDescriptor } from "../index-pIgGaXvS.js";
|
|
2
2
|
export { ActionDescriptor, ActionForm, ActionStatus, ActionValidationError, action, defineAction };
|
package/dist/actions/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { d as getCurrentAppRenderRuntime } from "../component-scope-DzJEbYGE.js";
|
|
2
|
-
import { r as getCurrentRenderData } from "../render-context-
|
|
3
|
-
import { t as state } from "../state-
|
|
2
|
+
import { r as getCurrentRenderData } from "../render-context-D0Hoj9dW.js";
|
|
3
|
+
import { t as state } from "../state-DCjONcHK.js";
|
|
4
4
|
import { jsx, jsxs } from "../jsx-runtime.js";
|
|
5
|
-
import { c as resolveDataRuntimeState, s as invalidateQueriesForRuntime } from "../data-runtime-
|
|
5
|
+
import { c as resolveDataRuntimeState, s as invalidateQueriesForRuntime } from "../data-runtime-Ck3tJDDQ.js";
|
|
6
6
|
//#region src/actions/runtime.ts
|
|
7
7
|
const emptyFramework = Object.freeze({});
|
|
8
8
|
/** @internal Read Askr-owned state from the current application root. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as registerCommitOperation } from "./component-internal-Bw4Mf9fd.js";
|
|
2
|
-
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-_GQGe_St.js";
|
|
3
1
|
import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance, i as claimHookIndex } from "./component-scope-DzJEbYGE.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { a as registerCommitOperation } from "./component-internal-DcrLymUJ.js";
|
|
3
|
+
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-B5NtV7V0.js";
|
|
4
|
+
import { n as getActiveRenderContext } from "./render-context-D0Hoj9dW.js";
|
|
6
5
|
import { n as syncRouteActivitySnapshot } from "./route-activity-CNJfpwx-.js";
|
|
6
|
+
import { b as getActiveRoutes, c as removeRouteBasePath, d as deepFreeze, f as makeQuery, n as computeMatchesFromRoutes, p as parseLocation, y as getActiveRouteBasePath } from "./route-matching-DqULzZtC.js";
|
|
7
7
|
//#region src/common/app-render-runtime.ts
|
|
8
8
|
const stagedRouteLocations = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
function createAppRenderRuntime(input = {}) {
|
|
@@ -79,18 +79,34 @@ function onRouteChange(fn, options = {}) {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
let serverLocation = null;
|
|
82
|
+
function logicalRoutePathname(pathname) {
|
|
83
|
+
const logical = removeRouteBasePath(pathname, getActiveRouteBasePath());
|
|
84
|
+
return logical === void 0 ? void 0 : parseLocation(logical).pathname;
|
|
85
|
+
}
|
|
86
|
+
function routePathname(pathname) {
|
|
87
|
+
const logical = logicalRoutePathname(pathname);
|
|
88
|
+
return logical === void 0 ? {
|
|
89
|
+
pathname: parseLocation(pathname).pathname,
|
|
90
|
+
withinBasePath: false
|
|
91
|
+
} : {
|
|
92
|
+
pathname: logical,
|
|
93
|
+
withinBasePath: true
|
|
94
|
+
};
|
|
95
|
+
}
|
|
82
96
|
function setServerLocation(url) {
|
|
83
97
|
serverLocation = url;
|
|
84
98
|
if (url) {
|
|
85
|
-
const
|
|
86
|
-
syncRouteActivitySnapshot(
|
|
99
|
+
const location = routePathname(parseLocation(url).pathname);
|
|
100
|
+
syncRouteActivitySnapshot(location.pathname, location.withinBasePath ? computeMatchesFromRoutes(location.pathname, getActiveRoutes()) : []);
|
|
87
101
|
return;
|
|
88
102
|
}
|
|
89
103
|
syncRouteActivitySnapshot(currentRouteSnapshot.path, currentRouteSnapshot.matches);
|
|
90
104
|
}
|
|
91
105
|
function buildRouteSnapshot(pathname, search, hash) {
|
|
106
|
+
const location = routePathname(pathname);
|
|
107
|
+
pathname = location.pathname;
|
|
92
108
|
const query = makeQuery(search);
|
|
93
|
-
const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
|
|
109
|
+
const matches = location.withinBasePath ? computeMatchesFromRoutes(pathname, getActiveRoutes()) : [];
|
|
94
110
|
return Object.freeze({
|
|
95
111
|
path: pathname,
|
|
96
112
|
params: deepFreeze({ ...matches[0]?.params }),
|
|
@@ -101,7 +117,7 @@ function buildRouteSnapshot(pathname, search, hash) {
|
|
|
101
117
|
}
|
|
102
118
|
function setCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
|
|
103
119
|
currentRouteSnapshot = buildRouteSnapshot(pathname, search, hash);
|
|
104
|
-
syncRouteActivitySnapshot(
|
|
120
|
+
syncRouteActivitySnapshot(currentRouteSnapshot.path, activityMatches ?? currentRouteSnapshot.matches);
|
|
105
121
|
const instance = getCurrentComponentInstance();
|
|
106
122
|
markReadableDerivedSubscribersDirty(currentRouteSource);
|
|
107
123
|
markReactivePropsDirtySource(currentRouteSource);
|
|
@@ -109,27 +125,48 @@ function setCurrentRouteSnapshot(pathname, search, hash, activityMatches) {
|
|
|
109
125
|
}
|
|
110
126
|
function readCurrentRouteLocation() {
|
|
111
127
|
const renderContext = getActiveRenderContext();
|
|
112
|
-
if (renderContext?.url)
|
|
128
|
+
if (renderContext?.url) {
|
|
129
|
+
const parsed = parseLocation(renderContext.url);
|
|
130
|
+
const location = routePathname(parsed.pathname);
|
|
131
|
+
return {
|
|
132
|
+
...parsed,
|
|
133
|
+
...location
|
|
134
|
+
};
|
|
135
|
+
}
|
|
113
136
|
const stagedRouteLocation = getStagedAppRenderRouteLocation(getCurrentAppRenderRuntime());
|
|
114
|
-
if (stagedRouteLocation)
|
|
137
|
+
if (stagedRouteLocation) {
|
|
138
|
+
const parsed = parseLocation(stagedRouteLocation);
|
|
139
|
+
const location = routePathname(parsed.pathname);
|
|
140
|
+
return {
|
|
141
|
+
...parsed,
|
|
142
|
+
...location
|
|
143
|
+
};
|
|
144
|
+
}
|
|
115
145
|
if (typeof window !== "undefined" && window.location) return {
|
|
116
|
-
|
|
146
|
+
...routePathname(window.location.pathname || "/"),
|
|
117
147
|
search: window.location.search || "",
|
|
118
148
|
hash: window.location.hash || ""
|
|
119
149
|
};
|
|
120
|
-
if (serverLocation)
|
|
150
|
+
if (serverLocation) {
|
|
151
|
+
const parsed = parseLocation(serverLocation);
|
|
152
|
+
const location = routePathname(parsed.pathname);
|
|
153
|
+
return {
|
|
154
|
+
...parsed,
|
|
155
|
+
...location
|
|
156
|
+
};
|
|
157
|
+
}
|
|
121
158
|
return {
|
|
122
|
-
|
|
159
|
+
...routePathname(currentRouteSnapshot.path),
|
|
123
160
|
search: "",
|
|
124
161
|
hash: currentRouteSnapshot.hash ?? ""
|
|
125
162
|
};
|
|
126
163
|
}
|
|
127
164
|
function readCurrentRouteSnapshot() {
|
|
128
165
|
if (!getCurrentComponentInstance()) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
|
|
129
|
-
const { pathname, search, hash } = readCurrentRouteLocation();
|
|
166
|
+
const { pathname, search, hash, withinBasePath } = readCurrentRouteLocation();
|
|
130
167
|
const query = makeQuery(search);
|
|
131
|
-
const matches = computeMatchesFromRoutes(pathname, getActiveRoutes());
|
|
132
|
-
const params = deepFreeze({ ...getActiveRenderContext()?.params ?? matches[0]?.params ?? {} });
|
|
168
|
+
const matches = withinBasePath ? computeMatchesFromRoutes(pathname, getActiveRoutes()) : [];
|
|
169
|
+
const params = deepFreeze({ ...(withinBasePath ? getActiveRenderContext()?.params : void 0) ?? matches[0]?.params ?? {} });
|
|
133
170
|
return Object.freeze({
|
|
134
171
|
path: pathname,
|
|
135
172
|
params,
|
package/dist/benchmark.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { r as flushRuntimeScheduler } from "./access-
|
|
2
|
-
import { t as installRendererBridge } from "./renderer-
|
|
3
|
-
import { t as state } from "./state-
|
|
4
|
-
import { t as selector } from "./selector-
|
|
5
|
-
import { i as For } from "./control-
|
|
1
|
+
import { r as flushRuntimeScheduler } from "./access-Dpfoi4cA.js";
|
|
2
|
+
import { t as installRendererBridge } from "./renderer-D9DL9R2D.js";
|
|
3
|
+
import { t as state } from "./state-DCjONcHK.js";
|
|
4
|
+
import { t as selector } from "./selector-Ck_Pp9av.js";
|
|
5
|
+
import { i as For } from "./control-oLADku43.js";
|
|
6
6
|
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
7
|
-
import { t as createIsland } from "./boot-
|
|
7
|
+
import { t as createIsland } from "./boot-CViTpUiB.js";
|
|
8
8
|
//#region src/bench/components/benchmark-row.tsx
|
|
9
9
|
function BenchmarkRow({ item, isSelected, onSelect, onRemove }) {
|
|
10
10
|
return /* @__PURE__ */ jsxs("tr", {
|
|
@@ -63,8 +63,8 @@ function BenchmarkTable({ rows, isSelected, onSelect, onRemove }) {
|
|
|
63
63
|
installRendererBridge();
|
|
64
64
|
const benchmarkMetadata = {
|
|
65
65
|
packageName: "@askrjs/askr",
|
|
66
|
-
packageVersion: "0.0.
|
|
67
|
-
buildLabel: "0.0.
|
|
66
|
+
packageVersion: "0.0.86",
|
|
67
|
+
buildLabel: "0.0.86-local"
|
|
68
68
|
};
|
|
69
69
|
function getBenchmarkMetadata() {
|
|
70
70
|
return { ...benchmarkMetadata };
|
package/dist/boot/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { l as ComponentFunction } from "../control-
|
|
2
|
-
import { W as RouteRegistry, w as RouteAuthOptions } from "../index-
|
|
1
|
+
import { l as ComponentFunction } from "../control-DhUZU4_V.js";
|
|
2
|
+
import { W as RouteRegistry, w as RouteAuthOptions } from "../index-pIgGaXvS.js";
|
|
3
3
|
import { v as DataRuntime } from "../index-5S-fi2xy.js";
|
|
4
|
-
import { a as ScrollRestorationOptions } from "../navigate-
|
|
4
|
+
import { a as ScrollRestorationOptions } from "../navigate-NyIjQUwI.js";
|
|
5
5
|
//#region src/boot/types.d.ts
|
|
6
6
|
type IslandConfig = {
|
|
7
7
|
root: Element | string;
|
package/dist/boot/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as cleanupApp, i as hydrateSPA, n as createIslands, o as hasApp, r as createSPA, t as createIsland } from "../boot-
|
|
1
|
+
import { a as cleanupApp, i as hydrateSPA, n as createIslands, o as hasApp, r as createSPA, t as createIsland } from "../boot-CViTpUiB.js";
|
|
2
2
|
export { cleanupApp, createIsland, createIslands, createSPA, hasApp, hydrateSPA };
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { b as isDevelopmentEnvironment, r as flushRuntimeScheduler, v as logger, x as isProductionEnvironment } from "./access-
|
|
1
|
+
import { b as isDevelopmentEnvironment, r as flushRuntimeScheduler, v as logger, x as isProductionEnvironment } from "./access-Dpfoi4cA.js";
|
|
2
2
|
import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-C3IECePB.js";
|
|
3
|
-
import { n as createComponentInstance, r as executeComponent } from "./component-internal-
|
|
4
|
-
import { t as cleanupComponent } from "./component-cleanup-
|
|
5
|
-
import { p as isPromiseLike } from "./lifecycle-batch-
|
|
6
|
-
import { a as setStaticChildSlotsCacheEnabled, c as endHydrationDirectListenerMode, d as discardHydrationListenerTransaction, i as registerDeferredHydrationBoundary, l as beginHydrationListenerTransaction, n as activateHydrationBoundary$1, o as withIntrinsicHydrationAdoption, r as clearDeferredHydrationBoundaries, s as beginHydrationDirectListenerMode, t as installRendererBridge, u as commitHydrationListenerTransaction } from "./renderer-
|
|
7
|
-
import { _ as teardownNodeSubtree, d as removeAllListeners } from "./cleanup-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { a as
|
|
15
|
-
import { o as createAppRenderRuntime, r as setServerLocation } from "./activity-
|
|
16
|
-
import { f as registerAppInstance, g as unregisterAppInstance, i as resolveRouteMeta, o as configureScrollRestoration, r as reconcileRouteMeta, t as initializeNavigation } from "./navigate-
|
|
17
|
-
import "./
|
|
3
|
+
import { n as createComponentInstance, r as executeComponent } from "./component-internal-DcrLymUJ.js";
|
|
4
|
+
import { t as cleanupComponent } from "./component-cleanup-BUfUleGZ.js";
|
|
5
|
+
import { p as isPromiseLike } from "./lifecycle-batch-Dfpid9-A.js";
|
|
6
|
+
import { a as setStaticChildSlotsCacheEnabled, c as endHydrationDirectListenerMode, d as discardHydrationListenerTransaction, i as registerDeferredHydrationBoundary, l as beginHydrationListenerTransaction, n as activateHydrationBoundary$1, o as withIntrinsicHydrationAdoption, r as clearDeferredHydrationBoundaries, s as beginHydrationDirectListenerMode, t as installRendererBridge, u as commitHydrationListenerTransaction } from "./renderer-D9DL9R2D.js";
|
|
7
|
+
import { _ as teardownNodeSubtree, d as removeAllListeners } from "./cleanup-c837KVij.js";
|
|
8
|
+
import { r as assertExecutionModel, t as _applyManifest } from "./manifest-D1P9uTlz.js";
|
|
9
|
+
import { d as stopHydrationRenderPhase, l as startHydrationRenderPhase, v as pageRenderEnvelope } from "./render-context-D0Hoj9dW.js";
|
|
10
|
+
import { r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-Bc52OIVc.js";
|
|
11
|
+
import { i as getDefaultDataRuntime } from "./data-runtime-Ck3tJDDQ.js";
|
|
12
|
+
import { a as hydrateDataRuntime } from "./query-registry-CPW_6nwF.js";
|
|
13
|
+
import { I as lockRouteRegistration, P as hasRegisteredRoutes, _ as clearRouteState, m as _setActiveRouteAuthOptions } from "./route-matching-DqULzZtC.js";
|
|
14
|
+
import { a as resolveRouteRequest, i as hasRouteRenderData, m as reviveDeferredValue, n as getRouteRenderContext, r as getRouteRenderData } from "./resolution-YHwi4Bav.js";
|
|
15
|
+
import { o as createAppRenderRuntime, r as setServerLocation } from "./activity-BvgvaMZA.js";
|
|
16
|
+
import { f as registerAppInstance, g as unregisterAppInstance, i as resolveRouteMeta, o as configureScrollRestoration, r as reconcileRouteMeta, t as initializeNavigation } from "./navigate-BwAPbpCb.js";
|
|
17
|
+
import { n as disposeRegisteredDefaultPortalScope, r as getDefaultPortalHost } from "./default-portal-runtime-DvMvWJVp.js";
|
|
18
|
+
import "./ssr-DSHd_Q9K.js";
|
|
18
19
|
//#region src/boot/hydration.ts
|
|
19
20
|
const DEFERRED_PAYLOAD = "__askr_deferred__";
|
|
20
21
|
function applyDeferredStreamPatches(rootElement) {
|
|
@@ -268,7 +269,7 @@ function mountOrUpdate(rootElement, componentFn, options) {
|
|
|
268
269
|
if (isPromiseLike(out)) throw new Error("Async components are not supported. Components must return synchronously.");
|
|
269
270
|
const portalVNode = {
|
|
270
271
|
$$typeof: ELEMENT_TYPE,
|
|
271
|
-
type:
|
|
272
|
+
type: getDefaultPortalHost(),
|
|
272
273
|
props: { __askrAutoDefaultPortal: true },
|
|
273
274
|
key: "__default_portal"
|
|
274
275
|
};
|
|
@@ -337,7 +338,7 @@ function mountOrUpdate(rootElement, componentFn, options) {
|
|
|
337
338
|
}
|
|
338
339
|
attachCleanupForRoot(rootElement, instance);
|
|
339
340
|
registerRootCleanupCallback(rootElement, () => {
|
|
340
|
-
|
|
341
|
+
disposeRegisteredDefaultPortalScope(instance.portalScope ?? instance);
|
|
341
342
|
});
|
|
342
343
|
executeComponent(instance);
|
|
343
344
|
flushRuntimeScheduler();
|
|
@@ -493,7 +494,8 @@ async function createSPA(config) {
|
|
|
493
494
|
};
|
|
494
495
|
_setActiveRouteAuthOptions(routeAuth);
|
|
495
496
|
if (isProductionEnvironment()) lockRouteRegistration();
|
|
496
|
-
const { path, resolved } = await resolveInitialRoute(routeAuth, { registry: config.registry });
|
|
497
|
+
const { path, href: currentUrl, resolved } = await resolveInitialRoute(routeAuth, { registry: config.registry });
|
|
498
|
+
setServerLocation(currentUrl);
|
|
497
499
|
const appRuntime = createAppRenderRuntime(resolved?.kind === "render" && hasRouteRenderData(resolved) ? {
|
|
498
500
|
route: getRouteRenderData(resolved),
|
|
499
501
|
hasRoute: true
|
|
@@ -585,7 +587,7 @@ async function hydrateSPA(config) {
|
|
|
585
587
|
cspNonce: config.cspNonce
|
|
586
588
|
}));
|
|
587
589
|
if (shouldVerifyHydrationMarkup(config)) {
|
|
588
|
-
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-
|
|
590
|
+
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-ww1dgwea.js");
|
|
589
591
|
if (!verifyHydrationSyncForUrl({
|
|
590
592
|
root: rootElement,
|
|
591
593
|
url: currentUrl,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as runRuntimeHandlerScope, v as logger } from "./access-
|
|
2
|
-
import "./fastlane-
|
|
3
|
-
import { t as cleanupComponent } from "./component-cleanup-
|
|
4
|
-
import { u as registerLifecycleTransaction } from "./lifecycle-batch-
|
|
1
|
+
import { c as runRuntimeHandlerScope, v as logger } from "./access-Dpfoi4cA.js";
|
|
2
|
+
import "./fastlane-CrfB3QG0.js";
|
|
3
|
+
import { t as cleanupComponent } from "./component-cleanup-BUfUleGZ.js";
|
|
4
|
+
import { u as registerLifecycleTransaction } from "./lifecycle-batch-Dfpid9-A.js";
|
|
5
5
|
//#region src/runtime/events.ts
|
|
6
6
|
/**
|
|
7
7
|
* Event delegation system for Askr
|
|
@@ -74,13 +74,23 @@ const containerDelegatedListeners = /* @__PURE__ */ new Map();
|
|
|
74
74
|
function isEventDelegationEnabled() {
|
|
75
75
|
return eventDelegationEnabled;
|
|
76
76
|
}
|
|
77
|
+
function usesDelegatedCapture(eventName) {
|
|
78
|
+
return eventName === "focus" || eventName === "blur" || eventName === "scroll";
|
|
79
|
+
}
|
|
80
|
+
function removeContainerDelegatedListener(container, eventName, handler) {
|
|
81
|
+
if (usesDelegatedCapture(eventName)) {
|
|
82
|
+
container.removeEventListener(eventName, handler, true);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
container.removeEventListener(eventName, handler);
|
|
86
|
+
}
|
|
77
87
|
function decrementContainerListenerUsage(entry) {
|
|
78
88
|
const listeners = containerDelegatedListeners.get(entry.container);
|
|
79
89
|
const listener = listeners?.get(entry.eventName);
|
|
80
90
|
if (!listener) return;
|
|
81
91
|
listener.usage -= 1;
|
|
82
92
|
if (listener.usage > 0) return;
|
|
83
|
-
entry.container
|
|
93
|
+
removeContainerDelegatedListener(entry.container, entry.eventName, listener.handler);
|
|
84
94
|
listeners?.delete(entry.eventName);
|
|
85
95
|
if (listeners?.size === 0) containerDelegatedListeners.delete(entry.container);
|
|
86
96
|
}
|
|
@@ -140,7 +150,7 @@ function attachDelegatedListener(container, element, eventName, handler, origina
|
|
|
140
150
|
}, "sync");
|
|
141
151
|
};
|
|
142
152
|
const passiveOptions = getPassiveOptions(eventName);
|
|
143
|
-
const listenerOptions = eventName
|
|
153
|
+
const listenerOptions = usesDelegatedCapture(eventName) ? {
|
|
144
154
|
...passiveOptions ?? options,
|
|
145
155
|
capture: true
|
|
146
156
|
} : passiveOptions ?? options;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { b as isDevelopmentEnvironment, v as logger, x as isProductionEnvironment } from "./access-
|
|
2
|
-
import { n as cleanupReadableSubscriptions, t as cleanupReadableSubscriptionSources } from "./readable-_GQGe_St.js";
|
|
1
|
+
import { b as isDevelopmentEnvironment, v as logger, x as isProductionEnvironment } from "./access-Dpfoi4cA.js";
|
|
3
2
|
import { a as clearCurrentComponentScope, y as restoreCurrentComponentScope } from "./component-scope-DzJEbYGE.js";
|
|
3
|
+
import { n as cleanupReadableSubscriptions, t as cleanupReadableSubscriptionSources } from "./readable-B5NtV7V0.js";
|
|
4
4
|
//#region src/runtime/state-diagnostics.ts
|
|
5
5
|
/**
|
|
6
6
|
* Report state cells that were never read during a component's completed
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as markTransparentComponentResult, i as markEagerControlPrimitive } from "./control-C-ApnFs1.js";
|
|
2
|
-
import { b as isDevelopmentEnvironment, n as enqueueRuntimeTask, o as getRuntimeRenderer, v as logger, x as isProductionEnvironment } from "./access-
|
|
3
|
-
import { r as tryRuntimeFastLaneSync, t as isBulkCommitActive } from "./fastlane-
|
|
4
|
-
import { r as STATIC_CHILDREN, t as ELEMENT_TYPE } from "./jsx-C3IECePB.js";
|
|
5
|
-
import { i as finalizeReadableSubscriptions } from "./readable-_GQGe_St.js";
|
|
2
|
+
import { b as isDevelopmentEnvironment, n as enqueueRuntimeTask, o as getRuntimeRenderer, v as logger, x as isProductionEnvironment } from "./access-Dpfoi4cA.js";
|
|
3
|
+
import { r as tryRuntimeFastLaneSync, t as isBulkCommitActive } from "./fastlane-CrfB3QG0.js";
|
|
6
4
|
import { C as restoreRenderScopedComponent, S as restoreInlineRenderTracking, _ as getSignalForInstance, b as restoreDomCommitScope, c as enterDomCommitScope, f as getCurrentComponentInstance, l as enterRenderScopedComponent, m as getCurrentPortalScope, n as captureInlineComponentScope, o as clearRenderTracking, p as getCurrentInstance, r as captureInlineRenderTracking, s as enterComponentExecutionScope, t as beginRenderTracking, u as exitComponentExecutionScope, v as resetRenderState, x as restoreInlineComponentScope } from "./component-scope-DzJEbYGE.js";
|
|
7
|
-
import {
|
|
5
|
+
import { r as STATIC_CHILDREN, t as ELEMENT_TYPE } from "./jsx-C3IECePB.js";
|
|
6
|
+
import { i as finalizeReadableSubscriptions } from "./readable-B5NtV7V0.js";
|
|
7
|
+
import { a as enqueueLifecycleCommitForInstance, d as discardCommitOperations, f as executeCommittedLifecycleOperations, n as captureInlineRenderSnapshot$1, o as finalizeInlineReadSubscriptions, p as isPromiseLike, r as discardLifecycleCommitBatch, s as flushLifecycleCommitBatch, t as beginLifecycleCommitBatch } from "./lifecycle-batch-Dfpid9-A.js";
|
|
8
8
|
//#region src/runtime/context.ts
|
|
9
9
|
const TransparentContextScopeComponent = markTransparentComponentResult(ContextScopeComponent);
|
|
10
10
|
let nextScopeIdentityKey = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as VNode } from "../control-
|
|
1
|
+
import { d as VNode } from "../control-DhUZU4_V.js";
|
|
2
2
|
import { r as JSXElement, s as Props } from "../jsx-Dvr2SGRG.js";
|
|
3
3
|
//#region src/common/error-boundary.d.ts
|
|
4
4
|
type ErrorBoundaryContent = VNode | readonly VNode[];
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __ERROR_BOUNDARY__ } from "../vnode-D24p6IW2.js";
|
|
2
|
-
import { t as ELEMENT_TYPE } from "../jsx-C3IECePB.js";
|
|
3
2
|
import { f as getCurrentComponentInstance } from "../component-scope-DzJEbYGE.js";
|
|
3
|
+
import { t as ELEMENT_TYPE } from "../jsx-C3IECePB.js";
|
|
4
4
|
//#region src/components/error-boundary.tsx
|
|
5
5
|
function ensureBoundaryState(instance, resetKey) {
|
|
6
6
|
const boundaryState = instance.errorBoundaryState ?? (instance.errorBoundaryState = {
|
package/dist/control/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Show, c as ForProps, i as MatchProps, n as CaseProps, o as ShowProps, r as Match, s as For, t as Case } from "../index-
|
|
1
|
+
import { a as Show, c as ForProps, i as MatchProps, n as CaseProps, o as ShowProps, r as Match, s as For, t as Case } from "../index-r-nt13FE.js";
|
|
2
2
|
export { Case, type CaseProps, For, type ForProps, Match, type MatchProps, Show, type ShowProps };
|
package/dist/control/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as For, n as Match, r as Show, t as Case } from "../control-
|
|
1
|
+
import { i as For, n as Match, r as Show, t as Case } from "../control-oLADku43.js";
|
|
2
2
|
export { Case, For, Match, Show };
|
|
@@ -82,6 +82,7 @@ interface DocumentRenderArgs {
|
|
|
82
82
|
context: DocumentRenderContext;
|
|
83
83
|
}
|
|
84
84
|
type DocumentRenderer = (args: DocumentRenderArgs) => string;
|
|
85
|
+
type SSRStyleRegistrationValidation = 'warn' | 'error' | 'off';
|
|
85
86
|
/** Full context for sink-based streaming SSR */
|
|
86
87
|
type SSRContext = {
|
|
87
88
|
url: string;
|
|
@@ -445,4 +446,4 @@ interface ControlTransaction {
|
|
|
445
446
|
registered: boolean;
|
|
446
447
|
}
|
|
447
448
|
//#endregion
|
|
448
|
-
export {
|
|
449
|
+
export { SSRStyleRegistrationValidation as _, ComponentInstance as a, StateTuple as b, readScope as c, VNode as d, DocumentRenderArgs as f, SSRStyleRegistration as g, SSRData as h, ReadableSource as i, ComponentFunction as l, DocumentRenderer as m, ChildScope as n, Scope as o, DocumentRenderContext as p, DOMRange as r, defineScope as s, ForEachSource as t, RenderableChild as u, State as v, state as x, StateSetter as y };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as markEagerControlPrimitive, t as __CONTROL_BOUNDARY__ } from "./control-C-ApnFs1.js";
|
|
2
|
-
import { b as isDevelopmentEnvironment } from "./access-
|
|
2
|
+
import { b as isDevelopmentEnvironment } from "./access-Dpfoi4cA.js";
|
|
3
3
|
import { n as Fragment } from "./jsx-C3IECePB.js";
|
|
4
|
-
import { m as createShowState, p as createCaseState, s as useForState } from "./for-internal-
|
|
5
|
-
import { t as createFineGrainedEffect } from "./effect-
|
|
6
|
-
import { t as state } from "./state-
|
|
4
|
+
import { m as createShowState, p as createCaseState, s as useForState } from "./for-internal-B_mnQhan.js";
|
|
5
|
+
import { t as createFineGrainedEffect } from "./effect-lnxQIpJG.js";
|
|
6
|
+
import { t as state } from "./state-DCjONcHK.js";
|
|
7
7
|
//#region src/control/shared.ts
|
|
8
8
|
function normalizeBoundaryChild(value) {
|
|
9
9
|
if (Array.isArray(value)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as readScope, u as defineScope } from "./component-internal-
|
|
1
|
+
import { g as readScope, u as defineScope } from "./component-internal-DcrLymUJ.js";
|
|
2
2
|
//#region src/common/url.ts
|
|
3
3
|
const SAFE_URL_SCHEMES = /* @__PURE__ */ new Set([
|
|
4
4
|
"http",
|
|
@@ -13,6 +13,23 @@ function isSafeHref(value) {
|
|
|
13
13
|
const scheme = URL_SCHEME_RE.exec(compact)?.[1]?.toLowerCase();
|
|
14
14
|
return scheme === void 0 || SAFE_URL_SCHEMES.has(scheme);
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Attribute names (lowercased) that can carry a browser-navigable/executable
|
|
18
|
+
* URL and must be checked against isSafeHref. Shared between the client
|
|
19
|
+
* renderer (renderer/attributes.ts) and SSR (ssr/attrs.ts) so their unsafe-
|
|
20
|
+
* URL handling can't drift. Deliberately excludes `src`: it covers a much
|
|
21
|
+
* wider range of legitimate non-navigable values (data: image URIs, blob:
|
|
22
|
+
* URLs, etc.) where the same scheme allowlist would be overly aggressive.
|
|
23
|
+
*/
|
|
24
|
+
const UNSAFE_URL_SCHEME_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
25
|
+
"href",
|
|
26
|
+
"formaction",
|
|
27
|
+
"action",
|
|
28
|
+
"xlink:href"
|
|
29
|
+
]);
|
|
30
|
+
function isUnsafeUrlAttribute(key, value) {
|
|
31
|
+
return UNSAFE_URL_SCHEME_ATTRIBUTES.has(key.toLowerCase()) && !isSafeHref(String(value));
|
|
32
|
+
}
|
|
16
33
|
//#endregion
|
|
17
34
|
//#region src/common/router-internal.ts
|
|
18
35
|
const ROUTE_ROOT_COMPONENT = Symbol.for("askr.route-root-component");
|
|
@@ -45,4 +62,4 @@ function validateCspNonce(value) {
|
|
|
45
62
|
return value;
|
|
46
63
|
}
|
|
47
64
|
//#endregion
|
|
48
|
-
export { isSafeHref as a, ROUTE_ROOT_COMPONENT as i, cspNonce as n, validateCspNonce as r, CspNonceScope as t };
|
|
65
|
+
export { isSafeHref as a, ROUTE_ROOT_COMPONENT as i, cspNonce as n, isUnsafeUrlAttribute as o, validateCspNonce as r, CspNonceScope as t };
|
package/dist/data/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getDefaultDataRuntime, t as createDataRuntime } from "../data-runtime-
|
|
2
|
-
import { a as queryScope, i as invalidateOnInterval, n as createMutation, r as invalidate, t as createQuery } from "../data-
|
|
3
|
-
import { a as hydrateDataRuntime, i as dehydrateDataRuntime, n as defineQuery, o as prefetchQuery, r as defineServerQueries, s as serveQuery, t as createQueryPrefetchContext } from "../query-registry-
|
|
1
|
+
import { i as getDefaultDataRuntime, t as createDataRuntime } from "../data-runtime-Ck3tJDDQ.js";
|
|
2
|
+
import { a as queryScope, i as invalidateOnInterval, n as createMutation, r as invalidate, t as createQuery } from "../data-DGrD3-qA.js";
|
|
3
|
+
import { a as hydrateDataRuntime, i as dehydrateDataRuntime, n as defineQuery, o as prefetchQuery, r as defineServerQueries, s as serveQuery, t as createQueryPrefetchContext } from "../query-registry-CPW_6nwF.js";
|
|
4
4
|
export { createDataRuntime, createMutation, createQuery, createQueryPrefetchContext, defineQuery, defineServerQueries, dehydrateDataRuntime, getDefaultDataRuntime, hydrateDataRuntime, invalidate, invalidateOnInterval, prefetchQuery, queryScope, serveQuery };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as enqueueRuntimeTask, v as logger } from "./access-
|
|
2
|
-
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-_GQGe_St.js";
|
|
1
|
+
import { n as enqueueRuntimeTask, v as logger } from "./access-Dpfoi4cA.js";
|
|
3
2
|
import { f as getCurrentComponentInstance, i as claimHookIndex } from "./component-scope-DzJEbYGE.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-B5NtV7V0.js";
|
|
4
|
+
import { n as getActiveRenderContext } from "./render-context-D0Hoj9dW.js";
|
|
5
|
+
import { i as routeActive, n as documentVisible, o as timer, s as windowFocused } from "./lifecycle-operations-BrYrBsXY.js";
|
|
6
|
+
import { a as getMutationSlotStore, c as resolveDataRuntimeState, i as getDefaultDataRuntime, n as ensureMutationCleanup, o as getQuerySlotStore, r as ensureQueryCleanup, s as invalidateQueriesForRuntime } from "./data-runtime-Ck3tJDDQ.js";
|
|
7
7
|
//#region src/data/query-key.ts
|
|
8
8
|
function serializeQueryKeyNumber(part) {
|
|
9
9
|
if (Number.isNaN(part)) return "NaN";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getActiveRenderContext } from "./render-context-
|
|
1
|
+
import { n as getActiveRenderContext } from "./render-context-D0Hoj9dW.js";
|
|
2
2
|
//#region src/data/invalidation-listeners.ts
|
|
3
3
|
const invalidationListeners = /* @__PURE__ */ new Set();
|
|
4
4
|
function addInvalidationListener(listener) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/common/default-portal-runtime.ts
|
|
2
|
+
let defaultPortalRuntime = null;
|
|
3
|
+
function InactiveDefaultPortalHost() {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
/** Register the optional portal capability when its public module is loaded. */
|
|
7
|
+
function registerDefaultPortalRuntime(runtime) {
|
|
8
|
+
defaultPortalRuntime = runtime;
|
|
9
|
+
}
|
|
10
|
+
function getDefaultPortalHost() {
|
|
11
|
+
return defaultPortalRuntime?.host ?? InactiveDefaultPortalHost;
|
|
12
|
+
}
|
|
13
|
+
function clearRegisteredDefaultPortalForInstance(instance) {
|
|
14
|
+
defaultPortalRuntime?.clearForInstance(instance);
|
|
15
|
+
}
|
|
16
|
+
function disposeRegisteredDefaultPortalScope(scope) {
|
|
17
|
+
defaultPortalRuntime?.disposeScope(scope);
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { registerDefaultPortalRuntime as i, disposeRegisteredDefaultPortalScope as n, getDefaultPortalHost as r, clearRegisteredDefaultPortalForInstance as t };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { f as getCurrentComponentInstance } from "./component-scope-DzJEbYGE.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance } from "./component-scope-DzJEbYGE.js";
|
|
2
|
+
import { i as getExecutionModel } from "./manifest-D1P9uTlz.js";
|
|
3
|
+
import { n as getActiveRenderContext, r as getCurrentRenderData } from "./render-context-D0Hoj9dW.js";
|
|
4
|
+
import { t as resource } from "./resource-operation-ys6eDoRJ.js";
|
|
5
|
+
import { A as getDefaultRouteBasePath, C as getCurrentInheritedPolicies, D as getCurrentPathPrefix, E as getCurrentPageScope, F as insertRecordSorted, H as computeRank, L as pushRegistrationScope, N as hasActivePageScope, O as getCurrentScopeKind, S as getCurrentInheritedMeta, T as getCurrentPageChain, U as normalizeRouteSegmentName, W as parseSegments, g as assertRouteRegistrationUnlocked, h as addRouteToStores, w as getCurrentLayoutChain, x as getCurrentInheritedAuthRequirements } from "./route-matching-DqULzZtC.js";
|
|
6
|
+
import { _ as createRouteHandler, d as DEFERRED_BOUNDARY, p as isDeferred, s as guardHydratedRouteData } from "./resolution-YHwi4Bav.js";
|
|
4
7
|
import { allOf } from "@askrjs/auth";
|
|
5
8
|
//#region src/router/access.ts
|
|
6
9
|
function compileNodePolicies(node) {
|
|
@@ -92,11 +95,13 @@ function pushPageScope(path, Component, options, fn) {
|
|
|
92
95
|
function normalizeRouteOptions(options) {
|
|
93
96
|
if (!options) return;
|
|
94
97
|
const loader = options.loader;
|
|
98
|
+
const dehydrate = options.dehydrate;
|
|
95
99
|
const preload = options.preload;
|
|
96
100
|
const policies = compileNodePolicies(options);
|
|
97
|
-
if (!loader && !preload && !options.entries && policies.length === 0 && !options.title && !options.namespace && !options.search && !options.meta && !options.actions && options.auth === void 0) return;
|
|
101
|
+
if (!loader && !dehydrate && !preload && !options.entries && policies.length === 0 && !options.title && !options.namespace && !options.search && !options.meta && !options.actions && options.auth === void 0) return;
|
|
98
102
|
return {
|
|
99
103
|
...loader ? { loader } : {},
|
|
104
|
+
...dehydrate ? { dehydrate } : {},
|
|
100
105
|
...preload ? { preload } : {},
|
|
101
106
|
...options.entries ? { entries: options.entries } : {},
|
|
102
107
|
...options.auth !== void 0 ? { auth: options.auth } : {},
|
|
@@ -193,8 +198,83 @@ function route(path, Component, options) {
|
|
|
193
198
|
registerRouteAtResolvedPath(resolveRouteRegistrationPath(path), Component, options);
|
|
194
199
|
return Object.freeze({
|
|
195
200
|
path: resolveRouteRegistrationPath(path),
|
|
201
|
+
...getDefaultRouteBasePath() ? { basePath: getDefaultRouteBasePath() } : {},
|
|
196
202
|
...options?.search ? { searchSchema: options.search } : {}
|
|
197
203
|
});
|
|
198
204
|
}
|
|
199
205
|
//#endregion
|
|
200
|
-
|
|
206
|
+
//#region src/router/deferred.tsx
|
|
207
|
+
function abortError() {
|
|
208
|
+
const error = /* @__PURE__ */ new Error("Deferred route data was aborted.");
|
|
209
|
+
error.name = "AbortError";
|
|
210
|
+
return error;
|
|
211
|
+
}
|
|
212
|
+
function awaitWithSignal(promise, signal) {
|
|
213
|
+
if (!signal) return promise;
|
|
214
|
+
if (signal.aborted) return Promise.reject(abortError());
|
|
215
|
+
return new Promise((resolve, reject) => {
|
|
216
|
+
const abort = () => reject(abortError());
|
|
217
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
218
|
+
promise.then((value) => {
|
|
219
|
+
signal.removeEventListener("abort", abort);
|
|
220
|
+
resolve(value);
|
|
221
|
+
}, (error) => {
|
|
222
|
+
signal.removeEventListener("abort", abort);
|
|
223
|
+
reject(error);
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
async function resolveDeferredValues(input, signal) {
|
|
228
|
+
const seen = /* @__PURE__ */ new Set();
|
|
229
|
+
const visit = async (value) => {
|
|
230
|
+
if (!value || typeof value !== "object") return;
|
|
231
|
+
if (isDeferred(value)) {
|
|
232
|
+
const resolved = await awaitWithSignal(value.promise, signal);
|
|
233
|
+
await visit(resolved);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (seen.has(value)) return;
|
|
237
|
+
seen.add(value);
|
|
238
|
+
const children = Array.isArray(value) ? value : Object.values(value);
|
|
239
|
+
await Promise.all(children.map(visit));
|
|
240
|
+
};
|
|
241
|
+
await visit(input);
|
|
242
|
+
return input;
|
|
243
|
+
}
|
|
244
|
+
function routeData() {
|
|
245
|
+
const envelope = getCurrentRenderData();
|
|
246
|
+
if (envelope) return guardHydratedRouteData(envelope.route, envelope.framework);
|
|
247
|
+
const runtime = getCurrentAppRenderRuntime();
|
|
248
|
+
if (!runtime?.hasRoute) throw new Error("routeData() can only be read while rendering a route with loader data.");
|
|
249
|
+
return guardHydratedRouteData(runtime.route, runtime.framework);
|
|
250
|
+
}
|
|
251
|
+
function rejectedChild(props, error) {
|
|
252
|
+
return typeof props.rejected === "function" ? props.rejected(error) : props.rejected ?? null;
|
|
253
|
+
}
|
|
254
|
+
function Resolve(props) {
|
|
255
|
+
if (props.value.state === "fulfilled") return props.children(props.value.value);
|
|
256
|
+
if (props.value.state === "rejected") return rejectedChild(props, props.value.error);
|
|
257
|
+
const renderContext = getActiveRenderContext();
|
|
258
|
+
if (renderContext) {
|
|
259
|
+
const id = `d:${renderContext.deferredBoundaries.length}`;
|
|
260
|
+
renderContext.deferredBoundaries.push({
|
|
261
|
+
id,
|
|
262
|
+
promise: props.value.promise,
|
|
263
|
+
fulfilled: (value) => props.children(value),
|
|
264
|
+
rejected: (error) => rejectedChild(props, error)
|
|
265
|
+
});
|
|
266
|
+
return {
|
|
267
|
+
type: DEFERRED_BOUNDARY,
|
|
268
|
+
props: {
|
|
269
|
+
id,
|
|
270
|
+
pending: props.pending ?? null
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
const result = resource(() => props.value.promise, [props.value]);
|
|
275
|
+
if (result.error) return rejectedChild(props, result.error);
|
|
276
|
+
if (result.pending || result.value === null) return props.pending ?? null;
|
|
277
|
+
return props.children(result.value);
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
export { group as a, route as c, fallback as i, resolveDeferredValues as n, index as o, routeData as r, page as s, Resolve as t };
|