@askrjs/askr 0.0.92 → 0.0.95
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 +5 -0
- package/README.md +3 -1
- package/dist/{access-DSkccuEI.js → access-d_DCdwqn.js} +3 -0
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +3 -2
- package/dist/{activity-DxUcygE5.d.ts → activity-D_5x2HXQ.d.ts} +5 -1
- package/dist/{activity-DodHdC0L.js → activity-d4t3CdzK.js} +4 -2
- package/dist/benchmark.d.ts +1 -1
- package/dist/benchmark.js +8 -8
- package/dist/boot/index.d.ts +12 -3
- package/dist/boot/index.js +1 -1
- package/dist/{boot-D71bjP4r.js → boot-C1wT3Vfs.js} +23 -15
- package/dist/{cleanup-DAAhJjx5.js → cleanup-D7uN-Z1s.js} +4 -4
- package/dist/{component-cleanup-CJCfu5ed.js → component-cleanup-DYG80yhG.js} +4 -2
- package/dist/{component-internal-DlAkCgBE.js → component-internal-D0yE2Ch3.js} +79 -13
- package/dist/components/index.d.ts +11 -3
- package/dist/components/index.js +5 -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-Dv540XtV.js → control-C0klPV7Q.js} +9 -5
- package/dist/{control-CdzY49Q2.d.ts → control-DdFw-Caz.d.ts} +1 -1
- package/dist/{csp-nonce-ByMbWv8s.js → csp-nonce-BVybpV1v.js} +8 -1
- package/dist/data/index.d.ts +1 -1
- package/dist/data/index.js +3 -3
- package/dist/{data-DcikEH9N.js → data-Bm8L6JOm.js} +15 -4
- package/dist/{data-runtime-oIdQWnPW.js → data-runtime-JxoRgrrt.js} +2 -0
- package/dist/{deferred-B6CafO5u.js → deferred-p8hyanxJ.js} +8 -3
- package/dist/{effect-BdZcHblj.js → effect-BdvdgMvV.js} +2 -2
- package/dist/{fastlane-B2s24fWt.js → fastlane-DGo7SxBQ.js} +3 -3
- package/dist/{for-internal-T1C7jd7x.js → for-internal-DkBwTG4S.js} +5 -5
- package/dist/foundations/icon/index.d.ts +14 -2
- 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 +7 -1
- package/dist/{index-DA3g8lm8.d.ts → index-CTIBOqUB.d.ts} +418 -5
- package/dist/{index-BnU0NPwM.d.ts → index-CzH-0LcA.d.ts} +18 -0
- package/dist/{index-oswRaMn6.d.ts → index-S2IqSJib.d.ts} +30 -2
- package/dist/index.d.ts +3 -4
- package/dist/index.js +13 -12
- 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 -2
- package/dist/jsx-dev-runtime.js +1 -1
- package/dist/jsx-runtime-BTzDdBJ_.d.ts +2 -0
- package/dist/{jsx-runtime-Cfb2umb4.d.ts → jsx-runtime-Cdd6Gkb0.d.ts} +4 -2
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/jsx-runtime.js +1 -1
- package/dist/{lifecycle-batch-Cyfd07rf.js → lifecycle-batch-BH0fax4F.js} +2 -2
- package/dist/{lifecycle-operations-CQ8fsc94.js → lifecycle-operations-CBzG5PyB.js} +6 -1
- package/dist/{manifest-Dv0bO6kg.js → manifest-D6rfj_jC.js} +4 -0
- package/dist/{navigate-BbWj-QU-.js → navigate-DChM5m8m.js} +13 -10
- package/dist/{navigate-CZHPEUC4.d.ts → navigate-eGm4omPj.d.ts} +6 -1
- package/dist/{query-registry-qm13pEdK.js → query-registry-CimB1YeW.js} +11 -1
- package/dist/{readable-B99wh5Z_.js → readable-BsdGWsDE.js} +1 -1
- package/dist/{renderer-C6jz9nIN.js → renderer-tXX_xj86.js} +10 -37
- package/dist/{resolution-B21kmOkp.js → resolution-BQyo7qNn.js} +11 -5
- package/dist/{resource-operation-CaAttQqz.js → resource-operation-B62UQKHV.js} +4 -4
- package/dist/resources/index.d.ts +15 -2
- package/dist/resources/index.js +6 -5
- package/dist/router/index.d.ts +46 -4
- package/dist/router/index.js +15 -8
- package/dist/{selector-BLWwI55m.js → selector-CyK-sDwB.js} +4 -3
- package/dist/ssg/index.d.ts +5 -1
- package/dist/ssg/index.js +5 -5
- package/dist/ssr/index.d.ts +16 -3
- package/dist/ssr/index.js +1 -1
- package/dist/{ssr-CaZfvQWn.js → ssr-DYcK20IX.js} +18 -10
- package/dist/{state-XPZYUzHL.js → state-DmkGM_LN.js} +3 -3
- package/dist/{structures-DKjkAmM5.js → structures-CPycoyZj.js} +63 -14
- package/dist/testing/index.d.ts +31 -2
- package/dist/testing/index.js +23 -5
- package/dist/{types-BA9FJtfR.d.ts → types-DkVJhVs9.d.ts} +4 -0
- package/dist/{verify-hydration-CcF-HJil.js → verify-hydration-m-wVbYOD.js} +1 -1
- package/package.json +1 -1
- package/dist/index-2bk8nldG.d.ts +0 -241
- package/dist/jsx-runtime-C_0v1pMN.d.ts +0 -2
- package/dist/scheduler-CmLO4Dfm.d.ts +0 -65
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- fix(runtime): reject recursive `derive()` and `selector()` reads before a
|
|
6
|
+
memoized value can bypass the self-evaluation guard.
|
|
7
|
+
- fix(runtime): route scheduled descendant and portal materialization failures
|
|
8
|
+
to the nearest live `ErrorBoundary` while preserving unbounded propagation.
|
|
9
|
+
|
|
5
10
|
## 0.0.85
|
|
6
11
|
|
|
7
12
|
- breaking(runtime): require Node.js 24.15 or newer.
|
package/README.md
CHANGED
|
@@ -92,7 +92,9 @@ Query and mutation helpers live in `@askrjs/askr/data`.
|
|
|
92
92
|
|
|
93
93
|
`ErrorBoundary` is the opt-in boundary primitive for render-time failures. It
|
|
94
94
|
renders a visible fallback in development, still logs the underlying error, and
|
|
95
|
-
can reset when your app state changes.
|
|
95
|
+
can reset when your app state changes. The boundary protects both initial mount
|
|
96
|
+
and scheduled post-mount updates. Portal content follows its logical writer
|
|
97
|
+
boundary and can also recover through a boundary around its host.
|
|
96
98
|
|
|
97
99
|
```ts
|
|
98
100
|
import { ErrorBoundary } from '@askrjs/askr/components';
|
|
@@ -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
|
}
|
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-CTIBOqUB.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-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,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as RouteParams, Lt as RouteSnapshot } from "./index-CTIBOqUB.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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as getCurrentAppRenderRuntime, f as getCurrentComponentInstance, i as claimHookIndex } from "./component-scope-4I3yEMkb.js";
|
|
2
|
-
import { a as registerCommitOperation } from "./component-internal-
|
|
3
|
-
import { l as notifyReadableReaders, o as markReactivePropsDirtySource, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-
|
|
2
|
+
import { a as registerCommitOperation } from "./component-internal-D0yE2Ch3.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
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";
|
|
@@ -33,6 +33,7 @@ function routeSignature(route) {
|
|
|
33
33
|
let currentRouteSnapshot = buildRouteSnapshot("/", "", "");
|
|
34
34
|
const currentRouteSource = (() => currentRouteSnapshot);
|
|
35
35
|
currentRouteSource._readers = /* @__PURE__ */ new Map();
|
|
36
|
+
/** Register a callback to run whenever the active route changes, with optional cleanup. */
|
|
36
37
|
function onRouteChange(fn, options = {}) {
|
|
37
38
|
const instance = getCurrentComponentInstance();
|
|
38
39
|
if (!instance) return;
|
|
@@ -179,6 +180,7 @@ function readCurrentRouteSnapshot() {
|
|
|
179
180
|
matches: Object.freeze(matches)
|
|
180
181
|
});
|
|
181
182
|
}
|
|
183
|
+
/** Read the currently active route's {@link RouteSnapshot}; reactive during component render. */
|
|
182
184
|
function currentRoute() {
|
|
183
185
|
const instance = getCurrentComponentInstance();
|
|
184
186
|
if (!instance) throw new Error("currentRoute() can only be called during component render execution. Call currentRoute() from inside your component function.");
|
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
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { i as For } from "./control-
|
|
1
|
+
import { r as flushRuntimeScheduler } from "./access-d_DCdwqn.js";
|
|
2
|
+
import { t as state } from "./state-DmkGM_LN.js";
|
|
3
|
+
import { t as selector } from "./selector-CyK-sDwB.js";
|
|
4
|
+
import { t as installRendererBridge } from "./renderer-tXX_xj86.js";
|
|
5
|
+
import { i as For } from "./control-C0klPV7Q.js";
|
|
6
6
|
import { jsx, jsxs } from "./jsx-runtime.js";
|
|
7
|
-
import { t as createIsland } from "./boot-
|
|
7
|
+
import { t as createIsland } from "./boot-C1wT3Vfs.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.95",
|
|
67
|
+
buildLabel: "0.0.95-local"
|
|
68
68
|
};
|
|
69
69
|
function getBenchmarkMetadata() {
|
|
70
70
|
return { ...benchmarkMetadata };
|
package/dist/boot/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as ScrollRestorationOptions } from "../navigate-CZHPEUC4.js";
|
|
1
|
+
import { At as RouteRegistry, nn as ComponentFunction, ut as RouteAuthOptions, zt as DataRuntime } from "../index-CTIBOqUB.js";
|
|
2
|
+
import { a as ScrollRestorationOptions } from "../navigate-eGm4omPj.js";
|
|
4
3
|
//#region src/boot/types.d.ts
|
|
4
|
+
/** Configuration for {@link createIsland}: mounts one component onto existing DOM. */
|
|
5
5
|
type IslandConfig = {
|
|
6
6
|
root: Element | string;
|
|
7
7
|
component: ComponentFunction;
|
|
@@ -9,6 +9,7 @@ type IslandConfig = {
|
|
|
9
9
|
cleanupStrict?: boolean;
|
|
10
10
|
routes?: never;
|
|
11
11
|
};
|
|
12
|
+
/** Configuration for {@link createIslands}: mounts several islands at once. */
|
|
12
13
|
type IslandsConfig = {
|
|
13
14
|
islands: IslandConfig[];
|
|
14
15
|
cspNonce?: string;
|
|
@@ -16,6 +17,7 @@ type IslandsConfig = {
|
|
|
16
17
|
type BootRouteSource = {
|
|
17
18
|
registry: RouteRegistry;
|
|
18
19
|
};
|
|
20
|
+
/** Configuration for {@link createSPA}. */
|
|
19
21
|
type SPAConfig = BootRouteSource & {
|
|
20
22
|
root: Element | string;
|
|
21
23
|
cspNonce?: string;
|
|
@@ -27,6 +29,7 @@ type SPAConfig = BootRouteSource & {
|
|
|
27
29
|
cleanupStrict?: boolean;
|
|
28
30
|
component?: never;
|
|
29
31
|
};
|
|
32
|
+
/** Configuration for {@link hydrateSPA}. */
|
|
30
33
|
type HydrateSPAConfig = BootRouteSource & {
|
|
31
34
|
root: Element | string;
|
|
32
35
|
cspNonce?: string;
|
|
@@ -45,7 +48,13 @@ type HydrateSPAConfig = BootRouteSource & {
|
|
|
45
48
|
};
|
|
46
49
|
//#endregion
|
|
47
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
|
+
*/
|
|
48
56
|
declare function cleanupApp(root: Element | string): void;
|
|
57
|
+
/** Check whether an app instance is currently mounted at `root`. */
|
|
49
58
|
declare function hasApp(root: Element | string): boolean;
|
|
50
59
|
//#endregion
|
|
51
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-C1wT3Vfs.js";
|
|
2
2
|
export { cleanupApp, createIsland, createIslands, createSPA, hasApp, hydrateSPA };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { S as isProductionEnvironment, r as flushRuntimeScheduler, x as isDevelopmentEnvironment, y as logger } from "./access-
|
|
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 {
|
|
7
|
-
import {
|
|
8
|
-
import { r as assertExecutionModel, t as _applyManifest } from "./manifest-Dv0bO6kg.js";
|
|
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-D0yE2Ch3.js";
|
|
4
|
+
import { t as cleanupComponent } from "./component-cleanup-DYG80yhG.js";
|
|
5
|
+
import { p as isPromiseLike } from "./lifecycle-batch-BH0fax4F.js";
|
|
6
|
+
import { _ as teardownNodeSubtree, d as removeAllListeners } from "./cleanup-D7uN-Z1s.js";
|
|
7
|
+
import { r as assertExecutionModel, t as _applyManifest } from "./manifest-D6rfj_jC.js";
|
|
9
8
|
import { d as stopHydrationRenderPhase, l as startHydrationRenderPhase, y as pageRenderEnvelope } from "./render-context-B7ohlh6t.js";
|
|
10
|
-
import { r as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
9
|
+
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-tXX_xj86.js";
|
|
10
|
+
import { r as validateCspNonce, t as CspNonceScope } from "./csp-nonce-BVybpV1v.js";
|
|
11
|
+
import { i as getDefaultDataRuntime } from "./data-runtime-JxoRgrrt.js";
|
|
12
|
+
import { a as hydrateDataRuntime } from "./query-registry-CimB1YeW.js";
|
|
13
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-
|
|
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-
|
|
14
|
+
import { a as resolveRouteRequest, i as hasRouteRenderData, m as reviveDeferredValue, n as getRouteRenderContext, r as getRouteRenderData } from "./resolution-BQyo7qNn.js";
|
|
15
|
+
import { o as createAppRenderRuntime, r as setServerLocation } from "./activity-d4t3CdzK.js";
|
|
16
|
+
import { f as registerAppInstance, g as unregisterAppInstance, i as resolveRouteMeta, o as configureScrollRestoration, r as reconcileRouteMeta, t as initializeNavigation } from "./navigate-DChM5m8m.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
|
|
@@ -323,6 +323,8 @@ function mountOrUpdate(rootElement, componentFn, options) {
|
|
|
323
323
|
instance._lastReadSources = void 0;
|
|
324
324
|
instance._placeholder = void 0;
|
|
325
325
|
instance.errorBoundaryState = void 0;
|
|
326
|
+
instance._portalErrorParent = void 0;
|
|
327
|
+
instance._portalErrorParentGeneration = void 0;
|
|
326
328
|
instance.devWarningsEmitted = void 0;
|
|
327
329
|
}
|
|
328
330
|
if (options && typeof options.cleanupStrict === "boolean") instance.cleanupStrict = options.cleanupStrict;
|
|
@@ -358,6 +360,11 @@ async function registerAppNavigation(rootElement, path, source) {
|
|
|
358
360
|
registerAppInstance(instance, path, source);
|
|
359
361
|
initializeNavigation();
|
|
360
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Tear down the app mounted at `root`: runs its cleanup callbacks, clears
|
|
365
|
+
* route state if it was the last routed root, and removes bookkeeping for
|
|
366
|
+
* the root element.
|
|
367
|
+
*/
|
|
361
368
|
function cleanupApp(root) {
|
|
362
369
|
const rootElement = resolveRootElement(root);
|
|
363
370
|
if (!rootElement) return;
|
|
@@ -374,6 +381,7 @@ function cleanupApp(root) {
|
|
|
374
381
|
} catch {}
|
|
375
382
|
}
|
|
376
383
|
}
|
|
384
|
+
/** Check whether an app instance is currently mounted at `root`. */
|
|
377
385
|
function hasApp(root) {
|
|
378
386
|
const rootElement = resolveRootElement(root);
|
|
379
387
|
if (!rootElement) return false;
|
|
@@ -604,7 +612,7 @@ async function hydrateSPA(config) {
|
|
|
604
612
|
cspNonce: config.cspNonce
|
|
605
613
|
}));
|
|
606
614
|
if (shouldVerifyHydrationMarkup(config)) {
|
|
607
|
-
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-
|
|
615
|
+
const { verifyHydrationSyncForUrl } = await import("./verify-hydration-m-wVbYOD.js");
|
|
608
616
|
if (!verifyHydrationSyncForUrl({
|
|
609
617
|
root: rootElement,
|
|
610
618
|
url: currentUrl,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { l as runRuntimeHandlerScope, y as logger } from "./access-
|
|
2
|
-
import "./fastlane-
|
|
1
|
+
import { l as runRuntimeHandlerScope, y as logger } from "./access-d_DCdwqn.js";
|
|
2
|
+
import "./fastlane-DGo7SxBQ.js";
|
|
3
3
|
import { T as withAppRenderRuntime, d as getCurrentAppRenderRuntime } from "./component-scope-4I3yEMkb.js";
|
|
4
|
-
import { t as cleanupComponent } from "./component-cleanup-
|
|
5
|
-
import { u as registerLifecycleTransaction } from "./lifecycle-batch-
|
|
4
|
+
import { t as cleanupComponent } from "./component-cleanup-DYG80yhG.js";
|
|
5
|
+
import { u as registerLifecycleTransaction } from "./lifecycle-batch-BH0fax4F.js";
|
|
6
6
|
//#region src/runtime/events.ts
|
|
7
7
|
/**
|
|
8
8
|
* Event delegation system for Askr
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as isProductionEnvironment, x as isDevelopmentEnvironment, y as logger } from "./access-
|
|
1
|
+
import { S as isProductionEnvironment, x as isDevelopmentEnvironment, y as logger } from "./access-d_DCdwqn.js";
|
|
2
2
|
import { a as clearCurrentComponentScope, y as restoreCurrentComponentScope } from "./component-scope-4I3yEMkb.js";
|
|
3
|
-
import { n as cleanupReadableSubscriptions, t as cleanupReadableSubscriptionSources } from "./readable-
|
|
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
|
|
@@ -124,6 +124,8 @@ function cleanupComponent(instance) {
|
|
|
124
124
|
instance.lifecycleSlots = void 0;
|
|
125
125
|
instance.hasPendingUpdate = false;
|
|
126
126
|
instance.notifyUpdate = null;
|
|
127
|
+
instance._portalErrorParent = void 0;
|
|
128
|
+
instance._portalErrorParentGeneration = void 0;
|
|
127
129
|
instance._placeholder = void 0;
|
|
128
130
|
instance.mounted = false;
|
|
129
131
|
if (cleanupErrors && cleanupErrors.length > 0) throw new AggregateError(cleanupErrors, `Cleanup failed for component ${instance.id}`);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as markTransparentComponentResult, i as markEagerControlPrimitive } from "./control-C-ApnFs1.js";
|
|
2
|
-
import { S as isProductionEnvironment, n as enqueueRuntimeTask, o as getRuntimeRenderer, x as isDevelopmentEnvironment, y as logger } from "./access-
|
|
3
|
-
import { i as tryRuntimeFastLaneSync, n as isBulkCommitActive } from "./fastlane-
|
|
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
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-
|
|
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-
|
|
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.");
|
|
@@ -364,6 +366,57 @@ function commitRenderedComponent$1(instance) {
|
|
|
364
366
|
if (instance.mounted && (instance.commitOperations?.length ?? 0) > 0) commitLifecycleForInstance(instance, false);
|
|
365
367
|
}
|
|
366
368
|
//#endregion
|
|
369
|
+
//#region src/runtime/error-boundary.ts
|
|
370
|
+
function createBoundaryReset(instance) {
|
|
371
|
+
return () => {
|
|
372
|
+
const boundaryState = instance.errorBoundaryState;
|
|
373
|
+
if (!boundaryState) return;
|
|
374
|
+
boundaryState.error = null;
|
|
375
|
+
boundaryState.notified = false;
|
|
376
|
+
queueMicrotask(() => {
|
|
377
|
+
instance._enqueueRun?.();
|
|
378
|
+
});
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function reportBoundaryError(instance, error, onError) {
|
|
382
|
+
const boundaryState = instance.errorBoundaryState;
|
|
383
|
+
if (boundaryState && Object.is(boundaryState.error, error) && boundaryState.notified) return;
|
|
384
|
+
if (boundaryState) {
|
|
385
|
+
boundaryState.error = error;
|
|
386
|
+
boundaryState.notified = true;
|
|
387
|
+
}
|
|
388
|
+
try {
|
|
389
|
+
onError?.(error);
|
|
390
|
+
} catch (hookError) {
|
|
391
|
+
logger.error("[Askr] ErrorBoundary onError handler threw:", hookError);
|
|
392
|
+
}
|
|
393
|
+
logger.error("[Askr] ErrorBoundary caught render error:", error);
|
|
394
|
+
}
|
|
395
|
+
function getLivePortalErrorParent(instance) {
|
|
396
|
+
const parent = instance._portalErrorParent;
|
|
397
|
+
if (!parent || parent._ownershipGeneration !== instance._portalErrorParentGeneration || parent.notifyUpdate === null) return null;
|
|
398
|
+
return parent;
|
|
399
|
+
}
|
|
400
|
+
function findLiveErrorBoundary(failedInstance) {
|
|
401
|
+
const visited = /* @__PURE__ */ new Set([failedInstance]);
|
|
402
|
+
const visit = (instance) => {
|
|
403
|
+
if (!instance || visited.has(instance)) return null;
|
|
404
|
+
visited.add(instance);
|
|
405
|
+
if (instance.errorBoundaryState && instance.notifyUpdate !== null) return instance;
|
|
406
|
+
return visit(getLivePortalErrorParent(instance)) ?? visit(instance.parentInstance);
|
|
407
|
+
};
|
|
408
|
+
return visit(getLivePortalErrorParent(failedInstance)) ?? visit(failedInstance.parentInstance);
|
|
409
|
+
}
|
|
410
|
+
/** Route a scheduled component failure to its nearest live render boundary. */
|
|
411
|
+
function routeComponentErrorToBoundary(failedInstance, error) {
|
|
412
|
+
const boundary = findLiveErrorBoundary(failedInstance);
|
|
413
|
+
if (!boundary) return false;
|
|
414
|
+
const onError = boundary.props.onError;
|
|
415
|
+
reportBoundaryError(boundary, error, typeof onError === "function" ? onError : void 0);
|
|
416
|
+
boundary._enqueueRun?.();
|
|
417
|
+
return true;
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
367
420
|
//#region src/runtime/component-commit.ts
|
|
368
421
|
function runScheduledComponent(instance, host) {
|
|
369
422
|
const ownershipGeneration = instance._ownershipGeneration;
|
|
@@ -375,21 +428,32 @@ function runScheduledComponent(instance, host) {
|
|
|
375
428
|
result = host.execute(instance);
|
|
376
429
|
} catch (err) {
|
|
377
430
|
discardCommitOperations(instance);
|
|
431
|
+
if (routeComponentErrorToBoundary(instance, err)) return;
|
|
378
432
|
throw err;
|
|
379
433
|
}
|
|
380
|
-
if (isPromiseLike(result))
|
|
434
|
+
if (isPromiseLike(result)) {
|
|
435
|
+
const error = /* @__PURE__ */ new Error("Async components are not supported. Components must be synchronous.");
|
|
436
|
+
discardCommitOperations(instance);
|
|
437
|
+
if (routeComponentErrorToBoundary(instance, error)) return;
|
|
438
|
+
throw error;
|
|
439
|
+
}
|
|
381
440
|
try {
|
|
382
441
|
if (tryRuntimeFastLaneSync(instance, result)) return;
|
|
383
442
|
} catch (err) {
|
|
443
|
+
if (routeComponentErrorToBoundary(instance, err)) return;
|
|
384
444
|
if (isDevelopmentEnvironment()) throw err;
|
|
385
445
|
}
|
|
386
446
|
enqueueRuntimeTask(() => {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
447
|
+
try {
|
|
448
|
+
if (instance._ownershipGeneration !== ownershipGeneration || instance.evaluationGeneration !== evaluationGeneration) return;
|
|
449
|
+
if (!instance.target && instance._placeholder) {
|
|
450
|
+
commitPlaceholderReplacement(instance, result, host);
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
if (instance.target) commitToTarget(instance, result, host);
|
|
454
|
+
} catch (err) {
|
|
455
|
+
if (!routeComponentErrorToBoundary(instance, err)) throw err;
|
|
391
456
|
}
|
|
392
|
-
if (instance.target) commitToTarget(instance, result, host);
|
|
393
457
|
});
|
|
394
458
|
}
|
|
395
459
|
function commitPlaceholderReplacement(instance, result, host) {
|
|
@@ -602,7 +666,9 @@ function createComponentInstance(id, fn, props, target) {
|
|
|
602
666
|
_pendingReadSources: void 0,
|
|
603
667
|
_pendingReadSourceVersions: void 0,
|
|
604
668
|
_lastReadSources: void 0,
|
|
605
|
-
devWarningsEmitted: void 0
|
|
669
|
+
devWarningsEmitted: void 0,
|
|
670
|
+
_portalErrorParent: void 0,
|
|
671
|
+
_portalErrorParentGeneration: void 0
|
|
606
672
|
};
|
|
607
673
|
instance._enqueueRun = enqueueComponentRun;
|
|
608
674
|
return instance;
|
|
@@ -737,4 +803,4 @@ function warnInstanceOnce(instance, key, message) {
|
|
|
737
803
|
logger.warn(message);
|
|
738
804
|
}
|
|
739
805
|
//#endregion
|
|
740
|
-
export {
|
|
806
|
+
export { withContext as S, haveEquivalentContextFrames as _, registerCommitOperation as a, rebaseVNodeTreeWithContextFrame as b, createBoundaryReset as c, configureRenderDiagnostics as d, callWithContext as f, getVNodeContextFrame as g, getExecutionContextFrame as h, mountInstanceInline as i, reportBoundaryError as l, getCurrentContextFrame as m, createComponentInstance as n, renderComponentInline as o, defineScope as p, executeComponent as r, renderScopedComponent as s, captureInlineRenderSnapshot as t, registerCommitOperationForInstance as u, markVNodeTreeWithContextFrame as v, withAsyncResourceContext as x, readScope as y };
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as JSXElement, s as Props } from "../types-
|
|
1
|
+
import { in as VNode } from "../index-CTIBOqUB.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
|
|
14
19
|
//#region src/components/error-boundary.d.ts
|
|
15
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Creates a boundary for descendant mount and post-mount render/commit errors,
|
|
22
|
+
* including content materialized through a portal host.
|
|
23
|
+
*/
|
|
16
24
|
declare function ErrorBoundary(props: ErrorBoundaryProps): JSXElement;
|
|
17
25
|
//#endregion
|
|
18
26
|
export { ErrorBoundary, type ErrorBoundaryFallbackRender, type ErrorBoundaryProps };
|
package/dist/components/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __ERROR_BOUNDARY__ } from "../vnode-D24p6IW2.js";
|
|
2
2
|
import { f as getCurrentComponentInstance } from "../component-scope-4I3yEMkb.js";
|
|
3
|
-
import { t as ELEMENT_TYPE } from "../jsx-
|
|
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 = {
|
|
@@ -30,7 +30,10 @@ function createBoundaryVNode(instance, props) {
|
|
|
30
30
|
__instance: instance
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Creates a boundary for descendant mount and post-mount render/commit errors,
|
|
35
|
+
* including content materialized through a portal host.
|
|
36
|
+
*/
|
|
34
37
|
function ErrorBoundary(props) {
|
|
35
38
|
const instance = getCurrentComponentInstance();
|
|
36
39
|
if (!instance) throw new Error("[Askr] ErrorBoundary() can only be used during component render execution.");
|
|
@@ -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-CTIBOqUB.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-C0klPV7Q.js";
|
|
2
2
|
export { Case, For, Match, Show };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as markEagerControlPrimitive, t as __CONTROL_BOUNDARY__ } from "./control-C-ApnFs1.js";
|
|
2
|
-
import { x as isDevelopmentEnvironment } from "./access-
|
|
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-DkBwTG4S.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 };
|