@askrjs/askr 0.0.91 → 0.0.94
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 +3 -0
- package/dist/{access-Dpfoi4cA.js → access-d_DCdwqn.js} +8 -2
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +4 -3
- package/dist/{activity-dKH6nlpj.js → activity-BshyLB3_.js} +9 -5
- package/dist/{activity-CF2_JvJs.d.ts → activity-CJIQyo5X.d.ts} +5 -1
- package/dist/benchmark.d.ts +1 -1
- package/dist/benchmark.js +8 -8
- package/dist/boot/index.d.ts +12 -4
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D3zVVWuN.js → boot-BsMB_ySP.js} +34 -22
- package/dist/{cleanup-c837KVij.js → cleanup-DefafSjG.js} +8 -5
- package/dist/{component-cleanup-BUfUleGZ.js → component-cleanup-hrqSikl2.js} +3 -3
- package/dist/{component-internal-C4uwwUaK.js → component-internal-DOVVMjG7.js} +8 -6
- package/dist/{component-scope-DzJEbYGE.js → component-scope-4I3yEMkb.js} +13 -1
- package/dist/components/index.d.ts +7 -2
- package/dist/components/index.js +2 -2
- package/dist/{compose-ref-Cc_YkUpM.js → compose-ref-1Fhs7mbF.js} +13 -0
- package/dist/{compose-ref-Cizq72-x.d.ts → compose-ref-DOJHoW5X.d.ts} +3 -0
- package/dist/control/index.d.ts +1 -1
- package/dist/control/index.js +1 -1
- package/dist/{control-CsGs2bLS.d.ts → control-DdFw-Caz.d.ts} +1 -1
- package/dist/{control-CON10J1p.js → control-DqOzkgc7.js} +9 -5
- package/dist/{csp-nonce-DH0TrDij.js → csp-nonce-BBxq1zq4.js} +8 -1
- package/dist/data/index.d.ts +1 -2
- package/dist/data/index.js +3 -3
- package/dist/{data-Bh_3OETq.js → data-DYqokZzc.js} +23 -12
- package/dist/{data-runtime-wbooGyu7.js → data-runtime-JxoRgrrt.js} +3 -1
- package/dist/{deferred-D6nZaIPs.js → deferred-BS0Xpstg.js} +10 -5
- package/dist/{effect-lnxQIpJG.js → effect-BdvdgMvV.js} +73 -14
- package/dist/{fastlane-CrfB3QG0.js → fastlane-DGo7SxBQ.js} +23 -4
- package/dist/{for-internal-Bsm0B8GZ.js → for-internal-jrliHZmF.js} +6 -6
- package/dist/foundations/icon/index.d.ts +14 -3
- package/dist/foundations/icon/index.js +8 -0
- package/dist/foundations/index.d.ts +2 -2
- package/dist/foundations/index.js +1 -1
- package/dist/foundations/interactions/index.d.ts +18 -2
- package/dist/foundations/interactions/index.js +1 -1
- package/dist/foundations/state/index.d.ts +8 -1
- package/dist/foundations/state/index.js +7 -1
- package/dist/foundations/structures/index.d.ts +2 -2
- package/dist/foundations/structures/index.js +1 -1
- package/dist/foundations/utilities/index.d.ts +2 -2
- package/dist/foundations/utilities/index.js +1 -1
- package/dist/fx/index.d.ts +10 -1
- package/dist/fx/index.js +8 -2
- package/dist/{index-Cf2ANwPL.d.ts → index-C29SEGIv.d.ts} +30 -3
- package/dist/{index-BnU0NPwM.d.ts → index-CzH-0LcA.d.ts} +18 -0
- package/dist/index-KQ7Vl4-8.d.ts +1364 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.js +34 -18
- package/dist/{interactions-CWkNEq_C.js → interactions-B4XaFxt1.js} +6 -1
- package/dist/{jsx-C3IECePB.js → jsx-DRS-qjiN.js} +2 -0
- package/dist/jsx-dev-runtime.d.ts +2 -3
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime-BTzDdBJ_.d.ts +2 -0
- package/dist/{jsx-runtime-LHh5tcTe.d.ts → jsx-runtime-Cdd6Gkb0.d.ts} +4 -3
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +1 -1
- package/dist/{lifecycle-batch-Dfpid9-A.js → lifecycle-batch-BH0fax4F.js} +2 -2
- package/dist/{lifecycle-operations-CMK1AN2C.js → lifecycle-operations-Qxq6ABrC.js} +7 -2
- package/dist/{manifest-fBb2ynKL.js → manifest-D6rfj_jC.js} +5 -1
- package/dist/{navigate-BO7M2iUG.d.ts → navigate-BL_FIIJ6.d.ts} +6 -1
- package/dist/{navigate-CnQMXze1.js → navigate-CECCMPAr.js} +16 -11
- package/dist/{query-registry-B4LpVtlT.js → query-registry-CimB1YeW.js} +11 -1
- package/dist/{readable-B5NtV7V0.js → readable-BsdGWsDE.js} +9 -6
- package/dist/{renderer-y2DL627q.js → renderer-CLvq458M.js} +235 -189
- package/dist/{resolution-C9A31xQi.js → resolution-D8PgnTzh.js} +12 -6
- package/dist/{resource-operation-whZDJAYv.js → resource-operation-CLQXCn1p.js} +5 -5
- package/dist/resources/index.d.ts +15 -2
- package/dist/resources/index.js +7 -6
- package/dist/{route-matching-xlgdQXg_.js → route-matching-Bo6UqG-5.js} +13 -4
- package/dist/router/index.d.ts +46 -6
- package/dist/router/index.js +16 -9
- package/dist/{selector-BLNkRZ2i.js → selector-CyK-sDwB.js} +24 -6
- package/dist/ssg/index.d.ts +5 -2
- package/dist/ssg/index.js +6 -6
- package/dist/ssr/index.d.ts +16 -5
- package/dist/ssr/index.js +1 -1
- package/dist/{ssr-DNJUPmMq.js → ssr-8_vHDWqV.js} +20 -12
- package/dist/{state-DCjONcHK.js → state-DmkGM_LN.js} +5 -5
- package/dist/{structures-m-cphWI-.js → structures-umvVUD-M.js} +20 -6
- package/dist/testing/index.d.ts +31 -3
- package/dist/testing/index.js +24 -6
- package/dist/{jsx-BYXe_Nnk.d.ts → types-DkVJhVs9.d.ts} +20 -0
- package/dist/{verify-hydration-D8938Fw2.js → verify-hydration-jf8X2V3x.js} +1 -1
- package/package.json +1 -1
- package/dist/control-D-FIa-n-.d.ts +0 -451
- package/dist/index-BU17hud9.d.ts +0 -52
- package/dist/index-CPlPDbEY.d.ts +0 -64
- package/dist/index-Izwp_ESC.d.ts +0 -458
- package/dist/jsx-runtime-BqhMEuT4.d.ts +0 -2
- package/dist/scheduler-CmLO4Dfm.d.ts +0 -65
- package/dist/types-CsPtBGWb.d.ts +0 -16
- package/dist/types-iAmDSV6o.d.ts +0 -179
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as clearCurrentComponentScope, y as restoreCurrentComponentScope } from "./component-scope-
|
|
1
|
+
import { a as clearCurrentComponentScope, y as restoreCurrentComponentScope } from "./component-scope-4I3yEMkb.js";
|
|
2
2
|
//#region src/common/env.ts
|
|
3
3
|
function normalizeEnv(source) {
|
|
4
4
|
if (!source) return {};
|
|
@@ -432,6 +432,7 @@ function createMissingRendererHost() {
|
|
|
432
432
|
markReactivePropsDirtySource() {}
|
|
433
433
|
};
|
|
434
434
|
}
|
|
435
|
+
/** A scheduler + renderer host pairing; owns scheduling and renderer wiring for an app instance. */
|
|
435
436
|
var AskrRuntime = class {
|
|
436
437
|
constructor(options = {}) {
|
|
437
438
|
this.scheduler = options.scheduler ?? globalScheduler;
|
|
@@ -445,9 +446,11 @@ var AskrRuntime = class {
|
|
|
445
446
|
}
|
|
446
447
|
};
|
|
447
448
|
const defaultRuntime = new AskrRuntime({ scheduler: globalScheduler });
|
|
449
|
+
/** Create a new {@link AskrRuntime} instance with its own scheduler/renderer wiring. */
|
|
448
450
|
function createRuntime(options = {}) {
|
|
449
451
|
return new AskrRuntime(options);
|
|
450
452
|
}
|
|
453
|
+
/** Get the process-wide default {@link AskrRuntime}. */
|
|
451
454
|
function getDefaultRuntime() {
|
|
452
455
|
return defaultRuntime;
|
|
453
456
|
}
|
|
@@ -482,6 +485,9 @@ function runRuntimeHandlerScope(fn, flushMode = "defer") {
|
|
|
482
485
|
function runRuntimeWithSyncProgress(fn) {
|
|
483
486
|
return getRuntimeScheduler().runWithSyncProgress(fn);
|
|
484
487
|
}
|
|
488
|
+
function isRuntimeSchedulerExecuting() {
|
|
489
|
+
return getRuntimeScheduler().isExecuting();
|
|
490
|
+
}
|
|
485
491
|
function getRuntimeFlushVersion() {
|
|
486
492
|
return getRuntimeScheduler().getFlushVersion();
|
|
487
493
|
}
|
|
@@ -495,4 +501,4 @@ function markRuntimeReactivePropsDirtySource(source) {
|
|
|
495
501
|
getRuntimeRenderer().markReactivePropsDirtySource(source);
|
|
496
502
|
}
|
|
497
503
|
//#endregion
|
|
498
|
-
export {
|
|
504
|
+
export { isProductionEnvironment as S, addPerfDuration as _, getRuntimeFlushVersion as a, getRuntimeEnv as b, markRuntimeReactivePropsDirtySource as c, setRuntimeBulkCommitProbe as d, AskrRuntime as f, scheduleEventHandler as g, getDefaultRuntime as h, getDefaultRuntimeInstance as i, runRuntimeHandlerScope as l, createRuntime as m, enqueueRuntimeTask as n, getRuntimeRenderer as o, configureRuntimeRenderer as p, flushRuntimeScheduler as r, isRuntimeSchedulerExecuting as s, enqueueRuntimeLane as t, runRuntimeWithSyncProgress as u, incrementPerfMetric as v, isDevelopmentEnvironment as x, logger as y };
|
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-KQ7Vl4-8.js";
|
|
2
2
|
export { ActionDescriptor, ActionForm, ActionStatus, ActionValidationError, action, defineAction };
|
package/dist/actions/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as getCurrentAppRenderRuntime } from "../component-scope-
|
|
1
|
+
import { d as getCurrentAppRenderRuntime } from "../component-scope-4I3yEMkb.js";
|
|
2
2
|
import { r as getCurrentRenderData } from "../render-context-B7ohlh6t.js";
|
|
3
|
-
import { t as state } from "../state-
|
|
3
|
+
import { t as state } from "../state-DmkGM_LN.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-JxoRgrrt.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. */
|
|
@@ -15,6 +15,7 @@ function csrfToken() {
|
|
|
15
15
|
const value = getCurrentRenderData()?.framework.csrf ?? readActionFramework().csrf;
|
|
16
16
|
return typeof value === "string" ? value : void 0;
|
|
17
17
|
}
|
|
18
|
+
/** Declare a server action with a stable id, input schema, and query prefixes to invalidate on success. */
|
|
18
19
|
function defineAction(options) {
|
|
19
20
|
if (!options.id) throw new Error("defineAction requires a stable id.");
|
|
20
21
|
if (options.input.kind !== "object") throw new Error("defineAction input must be an object schema.");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance, i as claimHookIndex } from "./component-scope-
|
|
2
|
-
import { a as registerCommitOperation } from "./component-internal-
|
|
3
|
-
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-
|
|
1
|
+
import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance, i as claimHookIndex } from "./component-scope-4I3yEMkb.js";
|
|
2
|
+
import { a as registerCommitOperation } from "./component-internal-DOVVMjG7.js";
|
|
3
|
+
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-BsdGWsDE.js";
|
|
4
4
|
import { n as getActiveRenderContext } from "./render-context-B7ohlh6t.js";
|
|
5
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-
|
|
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-Bo6UqG-5.js";
|
|
7
7
|
//#region src/common/app-render-runtime.ts
|
|
8
8
|
const stagedRouteLocations = /* @__PURE__ */ new WeakMap();
|
|
9
9
|
function createAppRenderRuntime(input = {}) {
|
|
@@ -11,7 +11,9 @@ function createAppRenderRuntime(input = {}) {
|
|
|
11
11
|
framework: Object.freeze({ ...input.framework }),
|
|
12
12
|
route: input.route,
|
|
13
13
|
hasRoute: input.hasRoute ?? false,
|
|
14
|
-
dataRuntime: input.dataRuntime
|
|
14
|
+
dataRuntime: input.dataRuntime,
|
|
15
|
+
routeRegistry: input.routeRegistry,
|
|
16
|
+
routeAuth: input.routeAuth
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
19
|
function stageAppRenderRouteLocation(runtime, href) {
|
|
@@ -31,6 +33,7 @@ function routeSignature(route) {
|
|
|
31
33
|
let currentRouteSnapshot = buildRouteSnapshot("/", "", "");
|
|
32
34
|
const currentRouteSource = (() => currentRouteSnapshot);
|
|
33
35
|
currentRouteSource._readers = /* @__PURE__ */ new Map();
|
|
36
|
+
/** Register a callback to run whenever the active route changes, with optional cleanup. */
|
|
34
37
|
function onRouteChange(fn, options = {}) {
|
|
35
38
|
const instance = getCurrentComponentInstance();
|
|
36
39
|
if (!instance) return;
|
|
@@ -177,6 +180,7 @@ function readCurrentRouteSnapshot() {
|
|
|
177
180
|
matches: Object.freeze(matches)
|
|
178
181
|
});
|
|
179
182
|
}
|
|
183
|
+
/** Read the currently active route's {@link RouteSnapshot}; reactive during component render. */
|
|
180
184
|
function currentRoute() {
|
|
181
185
|
const instance = getCurrentComponentInstance();
|
|
182
186
|
if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as RouteParams, Lt as RouteSnapshot } from "./index-KQ7Vl4-8.js";
|
|
2
2
|
//#region src/router/activity.d.ts
|
|
3
|
+
/** Options for {@link onRouteChange}. */
|
|
3
4
|
interface RouteChangeOptions {
|
|
4
5
|
immediate?: boolean;
|
|
5
6
|
}
|
|
7
|
+
/** Optional cleanup returned by an {@link onRouteChange} callback, run before the next change. */
|
|
6
8
|
type RouteChangeCleanup = void | (() => void);
|
|
9
|
+
/** Register a callback to run whenever the active route changes, with optional cleanup. */
|
|
7
10
|
declare function onRouteChange(fn: (current: RouteSnapshot, previous: RouteSnapshot | null) => RouteChangeCleanup, options?: RouteChangeOptions): void;
|
|
11
|
+
/** Read the currently active route's {@link RouteSnapshot}; reactive during component render. */
|
|
8
12
|
declare function currentRoute<TParams extends RouteParams = RouteParams>(): RouteSnapshot<TParams>;
|
|
9
13
|
//#endregion
|
|
10
14
|
export { onRouteChange as i, RouteChangeOptions as n, currentRoute as r, RouteChangeCleanup as t };
|
package/dist/benchmark.d.ts
CHANGED
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-d_DCdwqn.js";
|
|
2
|
+
import { t as installRendererBridge } from "./renderer-CLvq458M.js";
|
|
3
|
+
import { t as state } from "./state-DmkGM_LN.js";
|
|
4
|
+
import { t as selector } from "./selector-CyK-sDwB.js";
|
|
5
|
+
import { i as For } from "./control-DqOzkgc7.js";
|
|
6
6
|
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
7
|
-
import { t as createIsland } from "./boot-
|
|
7
|
+
import { t as createIsland } from "./boot-BsMB_ySP.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.94",
|
|
67
|
+
buildLabel: "0.0.94-local"
|
|
68
68
|
};
|
|
69
69
|
function getBenchmarkMetadata() {
|
|
70
70
|
return { ...benchmarkMetadata };
|
package/dist/boot/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { W as RouteRegistry, w as RouteAuthOptions } from "../index-Izwp_ESC.js";
|
|
4
|
-
import { a as ScrollRestorationOptions } from "../navigate-BO7M2iUG.js";
|
|
1
|
+
import { At as RouteRegistry, nn as ComponentFunction, ut as RouteAuthOptions, zt as DataRuntime } from "../index-KQ7Vl4-8.js";
|
|
2
|
+
import { a as ScrollRestorationOptions } from "../navigate-BL_FIIJ6.js";
|
|
5
3
|
//#region src/boot/types.d.ts
|
|
4
|
+
/** Configuration for {@link createIsland}: mounts one component onto existing DOM. */
|
|
6
5
|
type IslandConfig = {
|
|
7
6
|
root: Element | string;
|
|
8
7
|
component: ComponentFunction;
|
|
@@ -10,6 +9,7 @@ type IslandConfig = {
|
|
|
10
9
|
cleanupStrict?: boolean;
|
|
11
10
|
routes?: never;
|
|
12
11
|
};
|
|
12
|
+
/** Configuration for {@link createIslands}: mounts several islands at once. */
|
|
13
13
|
type IslandsConfig = {
|
|
14
14
|
islands: IslandConfig[];
|
|
15
15
|
cspNonce?: string;
|
|
@@ -17,6 +17,7 @@ type IslandsConfig = {
|
|
|
17
17
|
type BootRouteSource = {
|
|
18
18
|
registry: RouteRegistry;
|
|
19
19
|
};
|
|
20
|
+
/** Configuration for {@link createSPA}. */
|
|
20
21
|
type SPAConfig = BootRouteSource & {
|
|
21
22
|
root: Element | string;
|
|
22
23
|
cspNonce?: string;
|
|
@@ -28,6 +29,7 @@ type SPAConfig = BootRouteSource & {
|
|
|
28
29
|
cleanupStrict?: boolean;
|
|
29
30
|
component?: never;
|
|
30
31
|
};
|
|
32
|
+
/** Configuration for {@link hydrateSPA}. */
|
|
31
33
|
type HydrateSPAConfig = BootRouteSource & {
|
|
32
34
|
root: Element | string;
|
|
33
35
|
cspNonce?: string;
|
|
@@ -46,7 +48,13 @@ type HydrateSPAConfig = BootRouteSource & {
|
|
|
46
48
|
};
|
|
47
49
|
//#endregion
|
|
48
50
|
//#region src/boot/root-lifecycle.d.ts
|
|
51
|
+
/**
|
|
52
|
+
* Tear down the app mounted at `root`: runs its cleanup callbacks, clears
|
|
53
|
+
* route state if it was the last routed root, and removes bookkeeping for
|
|
54
|
+
* the root element.
|
|
55
|
+
*/
|
|
49
56
|
declare function cleanupApp(root: Element | string): void;
|
|
57
|
+
/** Check whether an app instance is currently mounted at `root`. */
|
|
50
58
|
declare function hasApp(root: Element | string): boolean;
|
|
51
59
|
//#endregion
|
|
52
60
|
//#region src/boot/index.d.ts
|
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-BsMB_ySP.js";
|
|
2
2
|
export { cleanupApp, createIsland, createIslands, createSPA, hasApp, hydrateSPA };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-
|
|
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 { r as assertExecutionModel, t as _applyManifest } from "./manifest-
|
|
1
|
+
import { S as isProductionEnvironment, r as flushRuntimeScheduler, x as isDevelopmentEnvironment, y as logger } from "./access-d_DCdwqn.js";
|
|
2
|
+
import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
|
|
3
|
+
import { n as createComponentInstance, r as executeComponent } from "./component-internal-DOVVMjG7.js";
|
|
4
|
+
import { t as cleanupComponent } from "./component-cleanup-hrqSikl2.js";
|
|
5
|
+
import { p as isPromiseLike } from "./lifecycle-batch-BH0fax4F.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-CLvq458M.js";
|
|
7
|
+
import { _ as teardownNodeSubtree, d as removeAllListeners } from "./cleanup-DefafSjG.js";
|
|
8
|
+
import { r as assertExecutionModel, t as _applyManifest } from "./manifest-D6rfj_jC.js";
|
|
9
9
|
import { d as stopHydrationRenderPhase, l as startHydrationRenderPhase, y as pageRenderEnvelope } from "./render-context-B7ohlh6t.js";
|
|
10
|
-
import { r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-
|
|
11
|
-
import { i as getDefaultDataRuntime } from "./data-runtime-
|
|
12
|
-
import { a as hydrateDataRuntime } from "./query-registry-
|
|
13
|
-
import { I as lockRouteRegistration, P as hasRegisteredRoutes, _ as clearRouteState, m as _setActiveRouteAuthOptions } from "./route-matching-
|
|
14
|
-
import { a as resolveRouteRequest, i as hasRouteRenderData, m as reviveDeferredValue, n as getRouteRenderContext, r as getRouteRenderData } from "./resolution-
|
|
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-
|
|
10
|
+
import { r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-BBxq1zq4.js";
|
|
11
|
+
import { i as getDefaultDataRuntime } from "./data-runtime-JxoRgrrt.js";
|
|
12
|
+
import { a as hydrateDataRuntime } from "./query-registry-CimB1YeW.js";
|
|
13
|
+
import { I as lockRouteRegistration, P as hasRegisteredRoutes, _ as clearRouteState, m as _setActiveRouteAuthOptions } from "./route-matching-Bo6UqG-5.js";
|
|
14
|
+
import { a as resolveRouteRequest, i as hasRouteRenderData, m as reviveDeferredValue, n as getRouteRenderContext, r as getRouteRenderData } from "./resolution-D8PgnTzh.js";
|
|
15
|
+
import { o as createAppRenderRuntime, r as setServerLocation } from "./activity-BshyLB3_.js";
|
|
16
|
+
import { f as registerAppInstance, g as unregisterAppInstance, i as resolveRouteMeta, o as configureScrollRestoration, r as reconcileRouteMeta, t as initializeNavigation } from "./navigate-CECCMPAr.js";
|
|
17
17
|
import { n as disposeRegisteredDefaultPortalScope, r as getDefaultPortalHost } from "./default-portal-runtime-DvMvWJVp.js";
|
|
18
18
|
import "./ssr-DSHd_Q9K.js";
|
|
19
19
|
//#region src/boot/hydration.ts
|
|
@@ -358,6 +358,11 @@ async function registerAppNavigation(rootElement, path, source) {
|
|
|
358
358
|
registerAppInstance(instance, path, source);
|
|
359
359
|
initializeNavigation();
|
|
360
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Tear down the app mounted at `root`: runs its cleanup callbacks, clears
|
|
363
|
+
* route state if it was the last routed root, and removes bookkeeping for
|
|
364
|
+
* the root element.
|
|
365
|
+
*/
|
|
361
366
|
function cleanupApp(root) {
|
|
362
367
|
const rootElement = resolveRootElement(root);
|
|
363
368
|
if (!rootElement) return;
|
|
@@ -374,6 +379,7 @@ function cleanupApp(root) {
|
|
|
374
379
|
} catch {}
|
|
375
380
|
}
|
|
376
381
|
}
|
|
382
|
+
/** Check whether an app instance is currently mounted at `root`. */
|
|
377
383
|
function hasApp(root) {
|
|
378
384
|
const rootElement = resolveRootElement(root);
|
|
379
385
|
if (!rootElement) return false;
|
|
@@ -497,11 +503,15 @@ async function createSPA(config) {
|
|
|
497
503
|
if (isProductionEnvironment()) lockRouteRegistration();
|
|
498
504
|
const { path, href: currentUrl, resolved } = await resolveInitialRoute(routeAuth, { registry: config.registry });
|
|
499
505
|
setServerLocation(currentUrl);
|
|
500
|
-
const appRuntime = createAppRenderRuntime(
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
506
|
+
const appRuntime = createAppRenderRuntime({
|
|
507
|
+
...resolved?.kind === "render" && hasRouteRenderData(resolved) ? {
|
|
508
|
+
route: getRouteRenderData(resolved),
|
|
509
|
+
hasRoute: true
|
|
510
|
+
} : {},
|
|
511
|
+
dataRuntime: config.dataRuntime ?? getDefaultDataRuntime(),
|
|
512
|
+
routeRegistry: config.registry,
|
|
513
|
+
routeAuth
|
|
514
|
+
});
|
|
505
515
|
if (!resolved) {
|
|
506
516
|
mountOrUpdate(rootElement, () => ({
|
|
507
517
|
type: "div",
|
|
@@ -573,7 +583,9 @@ async function hydrateSPA(config) {
|
|
|
573
583
|
runtime: createAppRenderRuntime({
|
|
574
584
|
framework: hydrationRenderData?.framework,
|
|
575
585
|
route: hydrationRenderData?.route,
|
|
576
|
-
hasRoute: hydrationRenderData !== null
|
|
586
|
+
hasRoute: hydrationRenderData !== null,
|
|
587
|
+
routeRegistry: config.registry,
|
|
588
|
+
routeAuth
|
|
577
589
|
})
|
|
578
590
|
};
|
|
579
591
|
_setActiveRouteAuthOptions(routeAuth);
|
|
@@ -598,7 +610,7 @@ async function hydrateSPA(config) {
|
|
|
598
610
|
cspNonce: config.cspNonce
|
|
599
611
|
}));
|
|
600
612
|
if (shouldVerifyHydrationMarkup(config)) {
|
|
601
|
-
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-
|
|
613
|
+
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-jf8X2V3x.js");
|
|
602
614
|
if (!verifyHydrationSyncForUrl({
|
|
603
615
|
root: rootElement,
|
|
604
616
|
url: currentUrl,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./fastlane-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { l as runRuntimeHandlerScope, y as logger } from "./access-d_DCdwqn.js";
|
|
2
|
+
import "./fastlane-DGo7SxBQ.js";
|
|
3
|
+
import { T as withAppRenderRuntime, d as getCurrentAppRenderRuntime } from "./component-scope-4I3yEMkb.js";
|
|
4
|
+
import { t as cleanupComponent } from "./component-cleanup-hrqSikl2.js";
|
|
5
|
+
import { u as registerLifecycleTransaction } from "./lifecycle-batch-BH0fax4F.js";
|
|
5
6
|
//#region src/runtime/events.ts
|
|
6
7
|
/**
|
|
7
8
|
* Event delegation system for Askr
|
|
@@ -141,7 +142,7 @@ function attachDelegatedListener(container, element, eventName, handler, origina
|
|
|
141
142
|
if (eventName === "focus" || eventName === "blur" || eventName === "scroll") dispatchPath.reverse();
|
|
142
143
|
for (const { node, entry } of dispatchPath) {
|
|
143
144
|
try {
|
|
144
|
-
entry.handler(createDelegatedEventFacade(e, node));
|
|
145
|
+
withAppRenderRuntime(entry.appRuntime, () => entry.handler(createDelegatedEventFacade(e, node)));
|
|
145
146
|
} catch (error) {
|
|
146
147
|
logger.error("[Askr] Delegated event error:", error);
|
|
147
148
|
}
|
|
@@ -164,6 +165,7 @@ function attachDelegatedListener(container, element, eventName, handler, origina
|
|
|
164
165
|
setDelegatedHandlerForElement(element, {
|
|
165
166
|
handler,
|
|
166
167
|
original: originalHandler,
|
|
168
|
+
appRuntime: getCurrentAppRenderRuntime(),
|
|
167
169
|
container,
|
|
168
170
|
eventName,
|
|
169
171
|
options
|
|
@@ -212,6 +214,7 @@ function updateDelegatedListener(element, eventName, handler, originalHandler, o
|
|
|
212
214
|
}
|
|
213
215
|
existing.handler = handler;
|
|
214
216
|
existing.original = originalHandler;
|
|
217
|
+
existing.appRuntime = getCurrentAppRenderRuntime();
|
|
215
218
|
existing.options = options;
|
|
216
219
|
return true;
|
|
217
220
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as clearCurrentComponentScope, y as restoreCurrentComponentScope } from "./component-scope-
|
|
3
|
-
import { n as cleanupReadableSubscriptions, t as cleanupReadableSubscriptionSources } from "./readable-
|
|
1
|
+
import { S as isProductionEnvironment, x as isDevelopmentEnvironment, y as logger } from "./access-d_DCdwqn.js";
|
|
2
|
+
import { a as clearCurrentComponentScope, y as restoreCurrentComponentScope } from "./component-scope-4I3yEMkb.js";
|
|
3
|
+
import { n as cleanupReadableSubscriptions, t as cleanupReadableSubscriptionSources } from "./readable-BsdGWsDE.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 {
|
|
3
|
-
import {
|
|
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-
|
|
5
|
-
import { r as STATIC_CHILDREN, t as ELEMENT_TYPE } from "./jsx-
|
|
6
|
-
import { i as finalizeReadableSubscriptions } from "./readable-
|
|
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-
|
|
2
|
+
import { S as isProductionEnvironment, n as enqueueRuntimeTask, o as getRuntimeRenderer, x as isDevelopmentEnvironment, y as logger } from "./access-d_DCdwqn.js";
|
|
3
|
+
import { i as tryRuntimeFastLaneSync, n as isBulkCommitActive } from "./fastlane-DGo7SxBQ.js";
|
|
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-4I3yEMkb.js";
|
|
5
|
+
import { r as STATIC_CHILDREN, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
|
|
6
|
+
import { i as finalizeReadableSubscriptions } from "./readable-BsdGWsDE.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-BH0fax4F.js";
|
|
8
8
|
//#region src/runtime/context.ts
|
|
9
9
|
const TransparentContextScopeComponent = markTransparentComponentResult(ContextScopeComponent);
|
|
10
10
|
let nextScopeIdentityKey = 0;
|
|
@@ -211,6 +211,7 @@ function withAsyncResourceContext(frame, fn) {
|
|
|
211
211
|
currentAsyncResourceFrame = oldFrame;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
+
/** Create a new lexical {@link Scope} with `defaultValue`, readable via {@link readScope}. */
|
|
214
215
|
function defineScope(defaultValue) {
|
|
215
216
|
const key = Symbol("AskrContext");
|
|
216
217
|
const identityKey = nextScopeIdentityKey++;
|
|
@@ -241,6 +242,7 @@ function preserveStaticChildrenMarker(source, target) {
|
|
|
241
242
|
function isPresentRenderable(value) {
|
|
242
243
|
return value !== null && value !== void 0 && value !== false;
|
|
243
244
|
}
|
|
245
|
+
/** Read the current value of a {@link Scope} during component render or an async resource. */
|
|
244
246
|
function readScope(context) {
|
|
245
247
|
const frame = currentContextFrame || currentAsyncResourceFrame;
|
|
246
248
|
if (!frame) throw new Error("readScope() can only be called during component render or async resource execution. Ensure you are calling this from inside your component or resource function.");
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//#region src/runtime/component-scope.ts
|
|
2
2
|
let currentInstance = null;
|
|
3
3
|
let currentPortalScope = null;
|
|
4
|
+
let scopedAppRenderRuntime;
|
|
4
5
|
let stateIndex = 0;
|
|
5
6
|
let globalRenderCounter = 0;
|
|
6
7
|
let renderScopedDepth = 0;
|
|
@@ -48,6 +49,17 @@ function getCurrentAppRenderRuntime() {
|
|
|
48
49
|
if (instance._appRenderRuntime) return instance._appRenderRuntime;
|
|
49
50
|
instance = instance.parentInstance;
|
|
50
51
|
}
|
|
52
|
+
return scopedAppRenderRuntime;
|
|
53
|
+
}
|
|
54
|
+
/** @internal Preserve root ownership without exposing component hook scope. */
|
|
55
|
+
function withAppRenderRuntime(runtime, fn) {
|
|
56
|
+
const previous = scopedAppRenderRuntime;
|
|
57
|
+
scopedAppRenderRuntime = runtime;
|
|
58
|
+
try {
|
|
59
|
+
return fn();
|
|
60
|
+
} finally {
|
|
61
|
+
scopedAppRenderRuntime = previous;
|
|
62
|
+
}
|
|
51
63
|
}
|
|
52
64
|
function setCurrentComponentInstance(instance) {
|
|
53
65
|
currentInstance = instance;
|
|
@@ -180,4 +192,4 @@ function getCurrentStateIndex() {
|
|
|
180
192
|
return stateIndex;
|
|
181
193
|
}
|
|
182
194
|
//#endregion
|
|
183
|
-
export { restoreRenderScopedComponent as C, restoreInlineRenderTracking as S, getSignalForInstance as _, clearCurrentComponentScope as a, restoreDomCommitScope as b, enterDomCommitScope as c, getCurrentAppRenderRuntime as d, getCurrentComponentInstance as f, getSignal as g, getCurrentStateIndex as h, claimHookIndex as i, enterRenderScopedComponent as l, getCurrentPortalScope as m, captureInlineComponentScope as n, clearRenderTracking as o, getCurrentInstance as p, captureInlineRenderTracking as r, enterComponentExecutionScope as s, beginRenderTracking as t, exitComponentExecutionScope as u, resetRenderState as v, setCurrentComponentInstance as w, restoreInlineComponentScope as x, restoreCurrentComponentScope as y };
|
|
195
|
+
export { restoreRenderScopedComponent as C, restoreInlineRenderTracking as S, withAppRenderRuntime as T, getSignalForInstance as _, clearCurrentComponentScope as a, restoreDomCommitScope as b, enterDomCommitScope as c, getCurrentAppRenderRuntime as d, getCurrentComponentInstance as f, getSignal as g, getCurrentStateIndex as h, claimHookIndex as i, enterRenderScopedComponent as l, getCurrentPortalScope as m, captureInlineComponentScope as n, clearRenderTracking as o, getCurrentInstance as p, captureInlineRenderTracking as r, enterComponentExecutionScope as s, beginRenderTracking as t, exitComponentExecutionScope as u, resetRenderState as v, setCurrentComponentInstance as w, restoreInlineComponentScope as x, restoreCurrentComponentScope as y };
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as JSXElement, s as Props } from "../
|
|
1
|
+
import { in as VNode } from "../index-KQ7Vl4-8.js";
|
|
2
|
+
import { r as JSXElement, s as Props } from "../types-DkVJhVs9.js";
|
|
3
3
|
//#region src/common/error-boundary.d.ts
|
|
4
4
|
type ErrorBoundaryContent = VNode | readonly VNode[];
|
|
5
5
|
type ErrorBoundaryFallbackValue = ErrorBoundaryContent | Node;
|
|
6
|
+
/** Renders a fallback for the caught error; call `reset` to retry the children. */
|
|
6
7
|
type ErrorBoundaryFallbackRender = (error: unknown, reset: () => void) => ErrorBoundaryFallbackValue;
|
|
8
|
+
/** Props for {@link ErrorBoundary}. */
|
|
7
9
|
interface ErrorBoundaryProps extends Props {
|
|
8
10
|
children?: ErrorBoundaryContent;
|
|
11
|
+
/** Static fallback content, or a render function receiving the error and a reset callback. */
|
|
9
12
|
fallback?: ErrorBoundaryFallbackValue | ErrorBoundaryFallbackRender;
|
|
13
|
+
/** Called with the caught error when the boundary trips. */
|
|
10
14
|
onError?: (error: unknown) => void;
|
|
15
|
+
/** Changing this value resets the boundary, re-rendering the children. */
|
|
11
16
|
resetKey?: unknown;
|
|
12
17
|
}
|
|
13
18
|
//#endregion
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __ERROR_BOUNDARY__ } from "../vnode-D24p6IW2.js";
|
|
2
|
-
import { f as getCurrentComponentInstance } from "../component-scope-
|
|
3
|
-
import { t as ELEMENT_TYPE } from "../jsx-
|
|
2
|
+
import { f as getCurrentComponentInstance } from "../component-scope-4I3yEMkb.js";
|
|
3
|
+
import { t as ELEMENT_TYPE } from "../jsx-DRS-qjiN.js";
|
|
4
4
|
//#region src/components/error-boundary.tsx
|
|
5
5
|
function ensureBoundaryState(instance, resetKey) {
|
|
6
6
|
const boundaryState = instance.errorBoundaryState ?? (instance.errorBoundaryState = {
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
function isDefaultPrevented(value) {
|
|
3
3
|
return typeof value === "object" && value !== null && "defaultPrevented" in value && value.defaultPrevented === true;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Compose two optional event handlers into one, running `first` then
|
|
7
|
+
* `second` unless `first` marked the event as default-prevented.
|
|
8
|
+
*/
|
|
5
9
|
function composeHandlers(first, second, options) {
|
|
6
10
|
if (!first && !second) return noop;
|
|
7
11
|
if (!first) return second;
|
|
@@ -44,6 +48,10 @@ function noop() {}
|
|
|
44
48
|
function isEventHandlerKey(key) {
|
|
45
49
|
return key.startsWith("on");
|
|
46
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Merge `base` props over `injected` props: non-handler keys in `base` win,
|
|
53
|
+
* and matching event handlers are composed (`injected` runs first).
|
|
54
|
+
*/
|
|
47
55
|
function mergeProps(base, injected) {
|
|
48
56
|
const baseKeys = Object.keys(base);
|
|
49
57
|
if (baseKeys.length === 0) return injected;
|
|
@@ -64,17 +72,21 @@ function mergeProps(base, injected) {
|
|
|
64
72
|
/**
|
|
65
73
|
* Tiny aria helpers
|
|
66
74
|
*/
|
|
75
|
+
/** Build an `aria-disabled` prop object; omitted entirely when `disabled` is falsy. */
|
|
67
76
|
function ariaDisabled(disabled) {
|
|
68
77
|
return disabled ? { "aria-disabled": "true" } : {};
|
|
69
78
|
}
|
|
79
|
+
/** Build an `aria-expanded` prop object; omitted when `expanded` is `undefined`. */
|
|
70
80
|
function ariaExpanded(expanded) {
|
|
71
81
|
return expanded === void 0 ? {} : { "aria-expanded": String(expanded) };
|
|
72
82
|
}
|
|
83
|
+
/** Build an `aria-selected` prop object; omitted when `selected` is `undefined`. */
|
|
73
84
|
function ariaSelected(selected) {
|
|
74
85
|
return selected === void 0 ? {} : { "aria-selected": String(selected) };
|
|
75
86
|
}
|
|
76
87
|
//#endregion
|
|
77
88
|
//#region src/foundations/utilities/compose-ref.ts
|
|
89
|
+
/** Write `value` to a {@link Ref}, ignoring failures on readonly object refs. */
|
|
78
90
|
function setRef(ref, value) {
|
|
79
91
|
if (!ref) return;
|
|
80
92
|
if (typeof ref === "function") {
|
|
@@ -83,6 +95,7 @@ function setRef(ref, value) {
|
|
|
83
95
|
}
|
|
84
96
|
if (Object.isExtensible(ref)) ref.current = value;
|
|
85
97
|
}
|
|
98
|
+
/** Combine multiple refs into one callback ref that writes to all of them. */
|
|
86
99
|
function composeRefs(...refs) {
|
|
87
100
|
return (value) => {
|
|
88
101
|
for (const ref of refs) setRef(ref, value);
|
|
@@ -17,10 +17,13 @@
|
|
|
17
17
|
* composeRefs applies refs in array order (left to right).
|
|
18
18
|
* All refs are called even if one fails.
|
|
19
19
|
*/
|
|
20
|
+
/** A callback ref, an object ref, or a nullish value (no-op). */
|
|
20
21
|
type Ref<T> = ((value: T | null) => void) | {
|
|
21
22
|
current: T | null;
|
|
22
23
|
} | null | undefined;
|
|
24
|
+
/** Write `value` to a {@link Ref}, ignoring failures on readonly object refs. */
|
|
23
25
|
declare function setRef<T>(ref: Ref<T>, value: T | null): void;
|
|
26
|
+
/** Combine multiple refs into one callback ref that writes to all of them. */
|
|
24
27
|
declare function composeRefs<T>(...refs: Array<Ref<T>>): (value: T | null) => void;
|
|
25
28
|
//#endregion
|
|
26
29
|
export { composeRefs as n, setRef as r, Ref as t };
|
package/dist/control/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as Case, F as ShowProps, I as For, L as ForProps, M as Match, N as MatchProps, P as Show, j as CaseProps } from "../index-KQ7Vl4-8.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-DqOzkgc7.js";
|
|
2
2
|
export { Case, For, Match, Show };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as Props } from "./
|
|
1
|
+
import { s as Props } from "./types-DkVJhVs9.js";
|
|
2
2
|
//#region src/common/control.d.ts
|
|
3
3
|
declare const EAGER_CONTROL_PRIMITIVE: unique symbol;
|
|
4
4
|
type EagerControlPrimitive<P extends Props = Props> = ((props: P) => unknown) & {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as markEagerControlPrimitive, t as __CONTROL_BOUNDARY__ } from "./control-C-ApnFs1.js";
|
|
2
|
-
import {
|
|
3
|
-
import { n as Fragment } from "./jsx-
|
|
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-
|
|
2
|
+
import { x as isDevelopmentEnvironment } from "./access-d_DCdwqn.js";
|
|
3
|
+
import { n as Fragment } from "./jsx-DRS-qjiN.js";
|
|
4
|
+
import { m as createShowState, p as createCaseState, s as useForState } from "./for-internal-jrliHZmF.js";
|
|
5
|
+
import { t as createFineGrainedEffect } from "./effect-BdvdgMvV.js";
|
|
6
|
+
import { t as state } from "./state-DmkGM_LN.js";
|
|
7
7
|
//#region src/control/shared.ts
|
|
8
8
|
function normalizeBoundaryChild(value) {
|
|
9
9
|
if (Array.isArray(value)) {
|
|
@@ -77,6 +77,7 @@ function createForBoundary(props) {
|
|
|
77
77
|
function ForPrimitive(props) {
|
|
78
78
|
return createForBoundary(props);
|
|
79
79
|
}
|
|
80
|
+
/** Render a keyed or indexed list, reconciling items by key instead of position. */
|
|
80
81
|
const For = markEagerControlPrimitive(ForPrimitive);
|
|
81
82
|
//#endregion
|
|
82
83
|
//#region src/control/show.ts
|
|
@@ -103,6 +104,7 @@ function ShowPrimitive(props) {
|
|
|
103
104
|
_controlState: showState
|
|
104
105
|
};
|
|
105
106
|
}
|
|
107
|
+
/** Conditionally render children based on `when`, narrowing truthy values for the render function form. */
|
|
106
108
|
const Show = markEagerControlPrimitive(ShowPrimitive);
|
|
107
109
|
//#endregion
|
|
108
110
|
//#region src/control/case.ts
|
|
@@ -118,6 +120,7 @@ function flattenChildren(children) {
|
|
|
118
120
|
}
|
|
119
121
|
return result;
|
|
120
122
|
}
|
|
123
|
+
/** Declares one branch of a {@link Case}; only valid as its direct child. */
|
|
121
124
|
function Match(_props) {
|
|
122
125
|
if (isDevelopmentEnvironment()) throw new Error("[askr] <Match> may only be used as a direct child of <Case>.");
|
|
123
126
|
return null;
|
|
@@ -164,6 +167,7 @@ function CasePrimitive(props) {
|
|
|
164
167
|
_controlState: caseState
|
|
165
168
|
};
|
|
166
169
|
}
|
|
170
|
+
/** Render the first matching {@link Match} child (by `when`), or `fallback` if none match. */
|
|
167
171
|
const Case = markEagerControlPrimitive(CasePrimitive);
|
|
168
172
|
//#endregion
|
|
169
173
|
export { For as i, Match as n, Show as r, Case as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as readScope, d as defineScope } from "./component-internal-
|
|
1
|
+
import { _ as readScope, d as defineScope } from "./component-internal-DOVVMjG7.js";
|
|
2
2
|
//#region src/common/url.ts
|
|
3
3
|
const SAFE_URL_SCHEMES = /* @__PURE__ */ new Set([
|
|
4
4
|
"http",
|
|
@@ -35,7 +35,14 @@ function isUnsafeUrlAttribute(key, value) {
|
|
|
35
35
|
const ROUTE_ROOT_COMPONENT = Symbol.for("askr.route-root-component");
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/csp-nonce.ts
|
|
38
|
+
/** Lexical scope carrying the CSP nonce for the current render, if any. */
|
|
38
39
|
const CspNonceScope = defineScope(void 0);
|
|
40
|
+
/**
|
|
41
|
+
* Read the CSP nonce for the current render from {@link CspNonceScope}.
|
|
42
|
+
*
|
|
43
|
+
* @returns The active nonce, or `undefined` when called outside of a
|
|
44
|
+
* component render or when no nonce was configured.
|
|
45
|
+
*/
|
|
39
46
|
function cspNonce() {
|
|
40
47
|
try {
|
|
41
48
|
return readScope(CspNonceScope);
|