@askrjs/askr 0.2.3 → 0.2.4

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.
Files changed (70) hide show
  1. package/dist/{access-Rr7CMa06.js → access-BucjYZcX.js} +4 -2
  2. package/dist/actions/index.d.ts +1 -1
  3. package/dist/actions/index.js +2 -2
  4. package/dist/{activity-CAJ5eho-.d.ts → activity-DooIuxQO.d.ts} +2 -2
  5. package/dist/{activity-ZxJXI9hF.js → activity-FirwPXA_.js} +14 -2
  6. package/dist/benchmark.d.ts +1 -1
  7. package/dist/benchmark.js +8 -8
  8. package/dist/boot/index.d.ts +4 -2
  9. package/dist/boot/index.js +1 -1
  10. package/dist/{boot-D4GaLA0d.js → boot-tWyF6121.js} +13 -12
  11. package/dist/{cleanup-DsrbV-rr.js → cleanup-TXSsApEl.js} +4 -4
  12. package/dist/{component-cleanup-DjpwO9WX.js → component-cleanup-jdbgjkT1.js} +2 -2
  13. package/dist/{component-internal-Dl02WQKS.js → component-internal-C4hKKQBF.js} +5 -5
  14. package/dist/components/index.d.ts +2 -2
  15. package/dist/control/index.d.ts +1 -1
  16. package/dist/control/index.js +1 -1
  17. package/dist/{control-57x3wa4J.js → control-C-wSaq9V.js} +4 -4
  18. package/dist/{control-DdFw-Caz.d.ts → control-Cxag1yqV.d.ts} +1 -1
  19. package/dist/{csp-nonce-C9OuML0U.js → csp-nonce-9NFUb7hJ.js} +1 -1
  20. package/dist/data/index.d.ts +1 -1
  21. package/dist/data/index.js +1 -1
  22. package/dist/{data-B7XCDeC8.js → data-ghKopAbp.js} +32 -23
  23. package/dist/{deferred-BELyvMsC.js → deferred-CxjWCkIn.js} +2 -2
  24. package/dist/{effect-4LwBwV58.js → effect-CNwstBBD.js} +2 -2
  25. package/dist/{fastlane-Buz1Rvlr.js → fastlane-BKZduiBQ.js} +2 -2
  26. package/dist/{for-internal-DeoSg_AV.js → for-internal-DyBHfKJA.js} +33 -25
  27. package/dist/foundations/icon/index.d.ts +1 -1
  28. package/dist/foundations/index.d.ts +2 -2
  29. package/dist/foundations/index.js +1 -1
  30. package/dist/foundations/state/index.d.ts +1 -1
  31. package/dist/foundations/state/index.js +1 -1
  32. package/dist/foundations/structures/index.d.ts +2 -2
  33. package/dist/foundations/structures/index.js +1 -1
  34. package/dist/fx/index.d.ts +1 -1
  35. package/dist/fx/index.js +1 -1
  36. package/dist/{index-r5THqzPN.d.ts → index-CTpMmzgN.d.ts} +2 -2
  37. package/dist/{index-DSqXWc77.d.ts → index-Dgjbo2gU.d.ts} +58 -4
  38. package/dist/index.d.ts +3 -3
  39. package/dist/index.js +9 -9
  40. package/dist/jsx-dev-runtime.d.ts +2 -2
  41. package/dist/jsx-runtime-Cg7GqY1S.d.ts +2 -0
  42. package/dist/{jsx-runtime-Cdd6Gkb0.d.ts → jsx-runtime-gVIaTPw0.d.ts} +2 -2
  43. package/dist/jsx-runtime.d.ts +2 -2
  44. package/dist/{lifecycle-batch-Be-CLDjV.js → lifecycle-batch-63aXFf2S.js} +2 -2
  45. package/dist/{lifecycle-operations-C5m03NQc.js → lifecycle-operations-Q0k3EFnG.js} +94 -2
  46. package/dist/{navigate-wel1e6cU.d.ts → navigate-F4sHgWbw.d.ts} +3 -1
  47. package/dist/{navigate-C46GtScG.js → navigate-ZZu1IV0B.js} +88 -13
  48. package/dist/{readable-CEcteIDE.js → readable-Di1fzSwm.js} +1 -1
  49. package/dist/{renderer-BhXofszH.js → renderer-Cl23O0hV.js} +148 -130
  50. package/dist/{resolution-t8J0yNaU.js → resolution-ClD-K7Lz.js} +3 -3
  51. package/dist/{resource-operation-B8q-QRUx.js → resource-operation-Vz1S5h2k.js} +4 -4
  52. package/dist/resources/index.d.ts +3 -37
  53. package/dist/resources/index.js +6 -6
  54. package/dist/router/index.d.ts +4 -4
  55. package/dist/router/index.js +5 -5
  56. package/dist/{selector-C7rIpOnN.js → selector-CsKuomw0.js} +17 -16
  57. package/dist/{shared-CGrx2AOL.js → shared-CYBH3F8I.js} +1 -1
  58. package/dist/ssg/index.d.ts +1 -1
  59. package/dist/ssg/index.js +4 -4
  60. package/dist/ssr/index.d.ts +2 -2
  61. package/dist/ssr/index.js +1 -1
  62. package/dist/{ssr-BaC5qHEw.js → ssr-Doog-AfJ.js} +7 -7
  63. package/dist/{state-BzhOW2TX.js → state-BGJgYSyQ.js} +3 -3
  64. package/dist/{structures-BwfeO4Iz.js → structures-DFyK5AdQ.js} +4 -4
  65. package/dist/testing/index.d.ts +3 -1
  66. package/dist/testing/index.js +6 -5
  67. package/dist/{types-DkVJhVs9.d.ts → types-DWVrKn9N.d.ts} +5 -0
  68. package/dist/{verify-hydration-_Q6avFp0.js → verify-hydration-BZPJ_kYa.js} +1 -1
  69. package/package.json +6 -6
  70. package/dist/jsx-runtime-BTzDdBJ_.d.ts +0 -2
@@ -1,3 +1,3 @@
1
- import { r as JSXElement } from "../../types-DkVJhVs9.js";
2
- import { _ as isElement, a as Collection, c as DefaultPortal, d as definePortal, f as Presence, g as cloneElement, h as SlotProps, i as createLayer, l as Portal, m as Slot, n as LayerManager, o as CollectionItem, p as PresenceProps, r as LayerOptions, s as createCollection, t as Layer, u as PortalProps, v as LayoutComponent, y as layout } from "../../index-r5THqzPN.js";
1
+ import { r as JSXElement } from "../../types-DWVrKn9N.js";
2
+ import { _ as isElement, a as Collection, c as DefaultPortal, d as definePortal, f as Presence, g as cloneElement, h as SlotProps, i as createLayer, l as Portal, m as Slot, n as LayerManager, o as CollectionItem, p as PresenceProps, r as LayerOptions, s as createCollection, t as Layer, u as PortalProps, v as LayoutComponent, y as layout } from "../../index-CTpMmzgN.js";
3
3
  export { type Collection, type CollectionItem, DefaultPortal, type JSXElement, type Layer, type LayerManager, type LayerOptions, type LayoutComponent, Portal, type PortalProps, Presence, type PresenceProps, Slot, type SlotProps, cloneElement, createCollection, createLayer, definePortal, isElement, layout };
@@ -1,2 +1,2 @@
1
- import { a as definePortal, c as layout, i as Portal, l as cloneElement, n as createCollection, o as Presence, r as DefaultPortal, s as Slot, t as createLayer, u as isElement } from "../../structures-BwfeO4Iz.js";
1
+ import { a as definePortal, c as layout, i as Portal, l as cloneElement, n as createCollection, o as Presence, r as DefaultPortal, s as Slot, t as createLayer, u as isElement } from "../../structures-DFyK5AdQ.js";
2
2
  export { DefaultPortal, Portal, Presence, Slot, cloneElement, createCollection, createLayer, definePortal, isElement, layout };
@@ -1,4 +1,4 @@
1
- import { Z as scheduleEventHandler } from "../index-DSqXWc77.js";
1
+ import { ft as scheduleEventHandler } from "../index-Dgjbo2gU.js";
2
2
  //#region src/fx/timing.d.ts
3
3
  /**
4
4
  * Timing utilities — pure helpers for common async patterns
package/dist/fx/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { g as scheduleEventHandler, n as enqueueRuntimeTask, y as logger } from "../access-Rr7CMa06.js";
1
+ import { g as scheduleEventHandler, n as enqueueRuntimeTask, y as logger } from "../access-BucjYZcX.js";
2
2
  import { f as getCurrentComponentInstance } from "../component-scope-4I3yEMkb.js";
3
3
  //#region src/fx/timing.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { cn as RenderableChild } from "./index-DSqXWc77.js";
2
- import { r as JSXElement } from "./types-DkVJhVs9.js";
1
+ import { Cn as RenderableChild } from "./index-Dgjbo2gU.js";
2
+ import { r as JSXElement } from "./types-DWVrKn9N.js";
3
3
  //#region src/foundations/structures/layout.d.ts
4
4
  /**
5
5
  * Layout helper.
@@ -1,5 +1,5 @@
1
- import { i as JSXElementType, r as JSXElement, s as Props } from "./types-DkVJhVs9.js";
2
- import "./jsx-runtime-BTzDdBJ_.js";
1
+ import { i as JSXElementType, r as JSXElement, s as Props } from "./types-DWVrKn9N.js";
2
+ import "./jsx-runtime-Cg7GqY1S.js";
3
3
  import { AuthContext, AuthRequirement } from "@askrjs/auth";
4
4
  import { InferSchema, ObjectSchema } from "@askrjs/schema";
5
5
  //#region src/runtime/state.d.ts
@@ -682,11 +682,15 @@ interface RouteQuery {
682
682
  toJSON(): Record<string, string | string[]>;
683
683
  }
684
684
  /** Full description of the currently active route, returned by {@link currentRoute}. */
685
- interface RouteSnapshot<TParams extends RouteParams = RouteParams> {
685
+ interface RouteSnapshot<TParams extends RouteParams = RouteParams, TState = unknown> {
686
686
  path: string;
687
687
  params: Readonly<TParams>;
688
688
  query: Readonly<RouteQuery>;
689
689
  hash: string | null;
690
+ /** Whether the current browser history entry was given explicit location state. */
691
+ hasState: boolean;
692
+ /** Entry-local state supplied to navigate(); absent during SSR and when no state was supplied. */
693
+ state: TState | undefined;
690
694
  name?: string;
691
695
  namespace?: string;
692
696
  matches: readonly RouteMatch<TParams>[];
@@ -1147,6 +1151,56 @@ type SnapshotSource<T> = {
1147
1151
  declare function derive<TOut>(fn: () => TOut): Derived<TOut>;
1148
1152
  declare function derive<TIn, TOut>(source: SnapshotSource<TIn> | TIn | (() => TIn), map: (value: TIn) => TOut): Derived<TOut | null>;
1149
1153
  //#endregion
1154
+ //#region src/runtime/lifecycle-operations.d.ts
1155
+ /** A gating condition for lifecycle primitives like {@link timer}; `true` means active. */
1156
+ type ActivityPredicate = () => boolean;
1157
+ /** Options for {@link timer}. */
1158
+ interface TimerOptions {
1159
+ when?: ActivityPredicate | readonly ActivityPredicate[];
1160
+ }
1161
+ /** {@link ActivityPredicate} that is true while the current route matches `pathOrPaths`. */
1162
+ declare function routeActive(pathOrPaths: string | readonly string[]): ActivityPredicate;
1163
+ /** {@link ActivityPredicate} that is true while the document is visible. */
1164
+ declare function documentVisible(): ActivityPredicate;
1165
+ /** {@link ActivityPredicate} that is true while the window has focus. */
1166
+ declare function windowFocused(): ActivityPredicate;
1167
+ /** An event target, or a function resolving one, accepted by {@link on}. */
1168
+ type ListenerTarget = EventTarget | (() => EventTarget | null | undefined);
1169
+ type ListenerOptions = boolean | AddEventListenerOptions | undefined;
1170
+ /** Attach an owned event listener to `target` for the current component's lifetime. */
1171
+ declare function on(target: ListenerTarget, event: string, handler: EventListener, options?: ListenerOptions): void;
1172
+ /** Run `fn` on an owned interval for the current component's lifetime, optionally gated by `options.when`. */
1173
+ declare function timer(intervalMs: number, fn: () => void, options?: TimerOptions): void;
1174
+ /** Runs an owned task after commit. */
1175
+ declare function task(fn: () => void | (() => void) | PromiseLike<void | (() => void)>): void;
1176
+ /** A callable reactive source accepted by {@link watch}. */
1177
+ type WatchSource<T> = ReadableSource<T>;
1178
+ /** Values inferred from an ordered tuple of {@link WatchSource} accessors. */
1179
+ type WatchValues<TSources extends readonly WatchSource<unknown>[]> = { -readonly [TIndex in keyof TSources]: ReturnType<TSources[TIndex]>; };
1180
+ /** Post-commit generation details supplied to a {@link watch} callback. */
1181
+ interface WatchContext<TValue> {
1182
+ readonly initial: boolean;
1183
+ readonly previous: TValue | undefined;
1184
+ readonly signal: AbortSignal;
1185
+ }
1186
+ /** Owned side-effect callback invoked by {@link watch}. */
1187
+ type WatchCallback<TValue> = (value: TValue, context: WatchContext<TValue>) => void | (() => void) | PromiseLike<void>;
1188
+ /** Observe one readable source after commit and whenever its value changes. */
1189
+ declare function watch<TValue>(source: WatchSource<TValue>, callback: WatchCallback<TValue>): void;
1190
+ /** Observe an ordered tuple of readable sources after commit and whenever an entry changes. */
1191
+ declare function watch<const TSources extends readonly WatchSource<unknown>[]>(sources: TSources, callback: WatchCallback<WatchValues<TSources>>): void;
1192
+ /**
1193
+ * Capture the result of a synchronous expression at call time and return a
1194
+ * thunk that returns the captured value later. This is a low-level helper for
1195
+ * cases where async continuations need to observe a snapshot of values at the
1196
+ * moment scheduling occurred.
1197
+ *
1198
+ * Usage (public API):
1199
+ * const snapshot = capture(() => someState());
1200
+ * Promise.resolve().then(() => { use(snapshot()); });
1201
+ */
1202
+ declare function capture<T>(fn: () => T): () => T;
1203
+ //#endregion
1150
1204
  //#region src/runtime/render-diagnostics.d.ts
1151
1205
  interface RenderDiagnosticsOptions {
1152
1206
  /** Emit one warning per component instance when a render exceeds the threshold. */
@@ -1399,4 +1453,4 @@ declare function action<TInput extends Record<string, unknown>, TResult = unknow
1399
1453
  submit(input: TInput): Promise<TResult>;
1400
1454
  };
1401
1455
  //#endregion
1402
- export { AccessAllowDecision as $, QueryKeyPart as $t, cspNonce as A, RouteRefSearch as At, selector as B, DataRuntime as Bt, createMutation as C, RouteOptions as Ct, SSRPortalState as D, RouteQuery as Dt, DeferredBoundaryRegistration as E, RoutePolicy as Et, Show as F, RouteRequestResult as Ft, AskrRuntime as G, MutationOptions as Gt, configureRenderDiagnostics as H, InvalidateOnIntervalOptions as Ht, ShowProps as I, RouteSearch as It, RuntimeRendererHost as J, QueryCollectionEntry as Jt, AskrRuntimeOptions as K, Query as Kt, For as L, RouteSearchValue as Lt, CaseProps as M, RouteRegistryOptions as Mt, Match as N, RouteRenderResult as Nt, registerSSRStyle as O, RouteRecord as Ot, MatchProps as P, RouteRequestOptions as Pt, getSignal as Q, QueryDefinition as Qt, ForProps as R, RouteSnapshot as Rt, createQuery as S, RouteMode as St, createRef as T, RoutePathParams as Tt, Derived as U, InvalidateOptions as Ut, RenderDiagnosticsOptions as V, DataRuntimeOptions as Vt, derive as W, Mutation as Wt, getDefaultRuntime as X, QueryCollectionOptions as Xt, createRuntime as Y, QueryCollectionKey as Yt, scheduleEventHandler as Z, QueryConsistency as Zt, invalidate as _, StateSetter as _n, RouteHandler as _t, action as a, defineScope as an, GroupHelperOptions as at, createDataRuntime as b, RouteMeta as bt, ServerQueryRegistry as c, RenderableChild as cn, PageScopeRecord as ct, defineServerQueries as d, DocumentRenderContext as dn, RouteAuthOptions as dt, QueryPrefetchContext as en, AccessDecision as et, dehydrateDataRuntime as f, DocumentRenderer as fn, RouteAuthResolver as ft, createQueryCollection as g, State as gn, RouteDestination as gt, serveQuery as h, SSRStyleRegistrationValidation as hn, RouteDefinition as ht, ActionValidationError as i, Scope as in, AccessRedirectStatus as it, Case as j, RouteRegistry as jt, CspNonceScope as k, RouteRef as kt, createQueryPrefetchContext as l, VNode as ln, ParsedSegment as lt, prefetchQuery as m, SSRStyleRegistration as mn, RouteContext as mt, ActionForm as n, QueryStaleReason as nn, AccessDenyStatus as nt, defineAction as o, readScope as on, LayoutScopeRecord as ot, hydrateDataRuntime as p, SSRData as pn, RouteComponent as pt, RuntimeKeyedReorderDecision as q, QueryCollection as qt, ActionStatus as r, ServerQueryHandler as rn, AccessRedirectDecision as rt, ServerQueryEntry as s, ComponentFunction as sn, PageHelperOptions as st, ActionDescriptor as t, QueryScope as tn, AccessDenyDecision as tt, defineQuery as u, DocumentRenderArgs as un, Route as ut, invalidateOnInterval as v, StateTuple as vn, RouteManifest as vt, Ref as w, RouteParams as wt, getDefaultDataRuntime as x, RouteMetaSource as xt, queryScope as y, state as yn, RouteMatch as yt, Selector as z, CoreTelemetry as zt };
1456
+ export { routeActive as $, RouteSnapshot as $t, cspNonce as A, SSRStyleRegistrationValidation as An, RouteDefinition as At, selector as B, RoutePathParams as Bt, createMutation as C, RenderableChild as Cn, PageScopeRecord as Ct, SSRPortalState as D, DocumentRenderer as Dn, RouteAuthResolver as Dt, DeferredBoundaryRegistration as E, DocumentRenderContext as En, RouteAuthOptions as Et, Show as F, RouteMeta as Ft, TimerOptions as G, RouteRefSearch as Gt, configureRenderDiagnostics as H, RouteQuery as Ht, ShowProps as I, RouteMetaSource as It, WatchSource as J, RouteRenderResult as Jt, WatchCallback as K, RouteRegistry as Kt, For as L, RouteMode as Lt, CaseProps as M, StateSetter as Mn, RouteHandler as Mt, Match as N, StateTuple as Nn, RouteManifest as Nt, registerSSRStyle as O, SSRData as On, RouteComponent as Ot, MatchProps as P, state as Pn, RouteMatch as Pt, on as Q, RouteSearchValue as Qt, ForProps as R, RouteOptions as Rt, createQuery as S, ComponentFunction as Sn, PageHelperOptions as St, createRef as T, DocumentRenderArgs as Tn, Route as Tt, ActivityPredicate as U, RouteRecord as Ut, RenderDiagnosticsOptions as V, RoutePolicy as Vt, ListenerTarget as W, RouteRef as Wt, capture as X, RouteRequestResult as Xt, WatchValues as Y, RouteRequestOptions as Yt, documentVisible as Z, RouteSearch as Zt, invalidate as _, QueryStaleReason as _n, AccessDenyStatus as _t, action as a, Mutation as an, derive as at, createDataRuntime as b, defineScope as bn, GroupHelperOptions as bt, ServerQueryRegistry as c, QueryCollection as cn, RuntimeKeyedReorderDecision as ct, defineServerQueries as d, QueryCollectionOptions as dn, getDefaultRuntime as dt, CoreTelemetry as en, task as et, dehydrateDataRuntime as f, QueryConsistency as fn, scheduleEventHandler as ft, createQueryCollection as g, QueryScope as gn, AccessDenyDecision as gt, serveQuery as h, QueryPrefetchContext as hn, AccessDecision as ht, ActionValidationError as i, InvalidateOptions as in, Derived as it, Case as j, State as jn, RouteDestination as jt, CspNonceScope as k, SSRStyleRegistration as kn, RouteContext as kt, createQueryPrefetchContext as l, QueryCollectionEntry as ln, RuntimeRendererHost as lt, prefetchQuery as m, QueryKeyPart as mn, AccessAllowDecision as mt, ActionForm as n, DataRuntimeOptions as nn, watch as nt, defineAction as o, MutationOptions as on, AskrRuntime as ot, hydrateDataRuntime as p, QueryDefinition as pn, getSignal as pt, WatchContext as q, RouteRegistryOptions as qt, ActionStatus as r, InvalidateOnIntervalOptions as rn, windowFocused as rt, ServerQueryEntry as s, Query as sn, AskrRuntimeOptions as st, ActionDescriptor as t, DataRuntime as tn, timer as tt, defineQuery as u, QueryCollectionKey as un, createRuntime as ut, invalidateOnInterval as v, ServerQueryHandler as vn, AccessRedirectDecision as vt, Ref as w, VNode as wn, ParsedSegment as wt, getDefaultDataRuntime as x, readScope as xn, LayoutScopeRecord as xt, queryScope as y, Scope as yn, AccessRedirectStatus as yt, Selector as z, RouteParams as zt };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as cspNonce, B as selector, Bt as DataRuntime, F as Show, G as AskrRuntime, H as configureRenderDiagnostics, I as ShowProps, J as RuntimeRendererHost, Jt as QueryCollectionEntry, K as AskrRuntimeOptions, L as For, M as CaseProps, N as Match, O as registerSSRStyle, P as MatchProps, Q as getSignal, Qt as QueryDefinition, R as ForProps, S as createQuery, T as createRef, U as Derived, V as RenderDiagnosticsOptions, W as derive, X as getDefaultRuntime, Xt as QueryCollectionOptions, Y as createRuntime, Yt as QueryCollectionKey, _n as StateSetter, an as defineScope, d as defineServerQueries, en as QueryPrefetchContext, f as dehydrateDataRuntime, g as createQueryCollection, gn as State, h as serveQuery, in as Scope, j as Case, k as CspNonceScope, m as prefetchQuery, on as readScope, p as hydrateDataRuntime, q as RuntimeKeyedReorderDecision, qt as QueryCollection, rn as ServerQueryHandler, u as defineQuery, vn as StateTuple, w as Ref, yn as state, z as Selector } from "./index-DSqXWc77.js";
2
- import { s as Props, t as Fragment } from "./types-DkVJhVs9.js";
3
- import { i as jsxs, n as jsx } from "./jsx-runtime-Cdd6Gkb0.js";
1
+ import { A as cspNonce, B as selector, F as Show, H as configureRenderDiagnostics, I as ShowProps, L as For, M as CaseProps, Mn as StateSetter, N as Match, Nn as StateTuple, O as registerSSRStyle, P as MatchProps, Pn as state, R as ForProps, S as createQuery, T as createRef, V as RenderDiagnosticsOptions, at as derive, bn as defineScope, cn as QueryCollection, ct as RuntimeKeyedReorderDecision, d as defineServerQueries, dn as QueryCollectionOptions, dt as getDefaultRuntime, f as dehydrateDataRuntime, g as createQueryCollection, h as serveQuery, hn as QueryPrefetchContext, it as Derived, j as Case, jn as State, k as CspNonceScope, ln as QueryCollectionEntry, lt as RuntimeRendererHost, m as prefetchQuery, ot as AskrRuntime, p as hydrateDataRuntime, pn as QueryDefinition, pt as getSignal, st as AskrRuntimeOptions, tn as DataRuntime, u as defineQuery, un as QueryCollectionKey, ut as createRuntime, vn as ServerQueryHandler, w as Ref, xn as readScope, yn as Scope, z as Selector } from "./index-Dgjbo2gU.js";
2
+ import { s as Props, t as Fragment } from "./types-DWVrKn9N.js";
3
+ import { i as jsxs, n as jsx } from "./jsx-runtime-gVIaTPw0.js";
4
4
  export { AskrRuntime, type AskrRuntimeOptions, Case, type CaseProps, CspNonceScope, type DataRuntime, type Derived, For, type ForProps, Fragment, Match, type MatchProps, type Props, type QueryCollection, type QueryCollectionEntry, type QueryCollectionKey, type QueryCollectionOptions, type QueryDefinition, type QueryPrefetchContext, type Ref, type RenderDiagnosticsOptions, type RuntimeKeyedReorderDecision, type RuntimeRendererHost, type Scope, type Selector, type ServerQueryHandler, Show, type ShowProps, type State, type StateSetter, type StateTuple, configureRenderDiagnostics, createQuery, createQueryCollection, createRef, createRuntime, cspNonce, defineQuery, defineScope, defineServerQueries, dehydrateDataRuntime, derive, getDefaultRuntime, getSignal, hydrateDataRuntime, jsx, jsxs, prefetchQuery, readScope, registerSSRStyle, selector, serveQuery, state };
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import { a as getRuntimeFlushVersion, f as AskrRuntime, h as getDefaultRuntime, m as createRuntime, t as enqueueRuntimeLane } from "./access-Rr7CMa06.js";
1
+ import { a as getRuntimeFlushVersion, f as AskrRuntime, h as getDefaultRuntime, m as createRuntime, t as enqueueRuntimeLane } from "./access-BucjYZcX.js";
2
2
  import { g as getSignal, i as claimHookIndex, p as getCurrentInstance } from "./component-scope-4I3yEMkb.js";
3
3
  import { n as Fragment } from "./jsx-DRS-qjiN.js";
4
- import { d as configureRenderDiagnostics, p as defineScope, y as readScope } from "./component-internal-Dl02WQKS.js";
5
- import { f as syncDerivedDependencySubscriptions, l as notifyReadableReaders, o as markReactivePropsDirtySource, p as withDerivedReadTracking, r as clearDerivedDependencySubscriptions, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-CEcteIDE.js";
4
+ import { b as readScope, f as configureRenderDiagnostics, m as defineScope } from "./component-internal-C4hKKQBF.js";
5
+ import { f as syncDerivedDependencySubscriptions, l as notifyReadableReaders, o as markReactivePropsDirtySource, p as withDerivedReadTracking, r as clearDerivedDependencySubscriptions, s as markReadableDerivedSubscribersDirty, u as recordReadableRead } from "./readable-Di1fzSwm.js";
6
6
  import { n as isSnapshotSource } from "./snapshot-source-BB42xgwb.js";
7
7
  import { c as registerSSRStyle } from "./render-context-B7ohlh6t.js";
8
- import { t as state } from "./state-BzhOW2TX.js";
9
- import { t as selector } from "./selector-C7rIpOnN.js";
10
- import { t as installRendererBridge } from "./renderer-BhXofszH.js";
11
- import { n as cspNonce, t as CspNonceScope } from "./csp-nonce-C9OuML0U.js";
12
- import { i as For, n as Match, r as Show, t as Case } from "./control-57x3wa4J.js";
8
+ import { t as state } from "./state-BGJgYSyQ.js";
9
+ import { t as selector } from "./selector-CsKuomw0.js";
10
+ import { t as installRendererBridge } from "./renderer-Cl23O0hV.js";
11
+ import { n as cspNonce, t as CspNonceScope } from "./csp-nonce-9NFUb7hJ.js";
12
+ import { i as For, n as Match, r as Show, t as Case } from "./control-C-wSaq9V.js";
13
13
  import { jsx, jsxs } from "./jsx-runtime.js";
14
- import { n as createQuery, t as createQueryCollection } from "./data-B7XCDeC8.js";
14
+ import { n as createQuery, t as createQueryCollection } from "./data-ghKopAbp.js";
15
15
  import { a as hydrateDataRuntime, i as dehydrateDataRuntime, n as defineQuery, o as prefetchQuery, r as defineServerQueries, s as serveQuery } from "./query-registry-Bua3cDyb.js";
16
16
  //#region src/runtime/derive.ts
17
17
  const deriveCells = /* @__PURE__ */ new WeakMap();
@@ -1,5 +1,5 @@
1
- import { a as IntrinsicFallbackProps, i as JSXElementType, n as JSXComponent, o as KnownIntrinsicElementProps, r as JSXElement, s as Props, t as Fragment } from "./types-DkVJhVs9.js";
2
- import { t as EagerControlPrimitive } from "./control-DdFw-Caz.js";
1
+ import { a as IntrinsicFallbackProps, i as JSXElementType, n as JSXComponent, o as KnownIntrinsicElementProps, r as JSXElement, s as Props, t as Fragment } from "./types-DWVrKn9N.js";
2
+ import { t as EagerControlPrimitive } from "./control-Cxag1yqV.js";
3
3
  //#region src/jsx/jsx-dev-runtime.d.ts
4
4
  declare namespace JSX {
5
5
  type ElementType = string | symbol | ((props: never) => unknown);
@@ -0,0 +1,2 @@
1
+ import "./types-DWVrKn9N.js";
2
+ import "./jsx-runtime-gVIaTPw0.js";
@@ -1,5 +1,5 @@
1
- import { a as IntrinsicFallbackProps, o as KnownIntrinsicElementProps, r as JSXElement, s as Props } from "./types-DkVJhVs9.js";
2
- import { t as EagerControlPrimitive } from "./control-DdFw-Caz.js";
1
+ import { a as IntrinsicFallbackProps, o as KnownIntrinsicElementProps, r as JSXElement, s as Props } from "./types-DWVrKn9N.js";
2
+ import { t as EagerControlPrimitive } from "./control-Cxag1yqV.js";
3
3
  //#region src/jsx/jsx-runtime.d.ts
4
4
  declare namespace JSX {
5
5
  type ElementType = string | symbol | ((props: never) => unknown);
@@ -1,3 +1,3 @@
1
- import { i as JSXElementType, n as JSXComponent, r as JSXElement, t as Fragment } from "./types-DkVJhVs9.js";
2
- import { i as jsxs, n as jsx, r as jsxDEV, t as JSX } from "./jsx-runtime-Cdd6Gkb0.js";
1
+ import { i as JSXElementType, n as JSXComponent, r as JSXElement, t as Fragment } from "./types-DWVrKn9N.js";
2
+ import { i as jsxs, n as jsx, r as jsxDEV, t as JSX } from "./jsx-runtime-gVIaTPw0.js";
3
3
  export { Fragment, JSX, type JSXComponent, type JSXElement, type JSXElementType, jsx, jsxDEV, jsxs };
@@ -1,5 +1,5 @@
1
- import { y as logger } from "./access-Rr7CMa06.js";
2
- import { a as finalizeReadableSubscriptionsFromSnapshot } from "./readable-CEcteIDE.js";
1
+ import { y as logger } from "./access-BucjYZcX.js";
2
+ import { a as finalizeReadableSubscriptionsFromSnapshot } from "./readable-Di1fzSwm.js";
3
3
  //#region src/common/promise.ts
4
4
  function isPromiseLike(value) {
5
5
  return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
@@ -1,5 +1,6 @@
1
1
  import { f as getCurrentComponentInstance, i as claimHookIndex } from "./component-scope-4I3yEMkb.js";
2
- import { a as registerCommitOperation } from "./component-internal-Dl02WQKS.js";
2
+ import { a as registerCommitOperation, u as routeComponentErrorToBoundary } from "./component-internal-C4hKKQBF.js";
3
+ import { t as createFineGrainedEffect } from "./effect-CNwstBBD.js";
3
4
  import { t as isRouteActivityActive } from "./route-activity-CNJfpwx-.js";
4
5
  //#region src/runtime/lifecycle-operations.ts
5
6
  function normalizePredicates(predicates) {
@@ -177,6 +178,97 @@ function task(fn) {
177
178
  });
178
179
  }
179
180
  }
181
+ function watchValuesEqual(previous, next) {
182
+ if (previous.length !== next.length) return false;
183
+ for (let index = 0; index < previous.length; index += 1) if (!Object.is(previous[index], next[index])) return false;
184
+ return true;
185
+ }
186
+ function stopWatchGeneration(slot) {
187
+ const controller = slot.controller;
188
+ slot.controller = null;
189
+ if (controller && !controller.signal.aborted) controller.abort();
190
+ const cleanup = slot.cleanup;
191
+ slot.cleanup = null;
192
+ cleanup?.();
193
+ }
194
+ function stopWatchSlot(slot) {
195
+ stopWatchGeneration(slot);
196
+ slot.effect?.cleanup();
197
+ slot.effect = null;
198
+ }
199
+ function reportWatchError(instance, error) {
200
+ if (!routeComponentErrorToBoundary(instance, error)) throw error;
201
+ }
202
+ function commitWatchSlot(instance, slot) {
203
+ slot.callback = slot.pendingCallback;
204
+ slot.sources = slot.pendingSources;
205
+ const compute = () => {
206
+ const values = slot.sources.map((source) => source());
207
+ return values.length === 1 ? values[0] : values;
208
+ };
209
+ const observe = (value, previous) => {
210
+ stopWatchGeneration(slot);
211
+ const controller = new AbortController();
212
+ slot.controller = controller;
213
+ const initial = !slot.hasObserved;
214
+ slot.hasObserved = true;
215
+ let result;
216
+ try {
217
+ result = slot.callback(value, {
218
+ initial,
219
+ previous,
220
+ signal: controller.signal
221
+ });
222
+ } catch (error) {
223
+ reportWatchError(instance, error);
224
+ return;
225
+ }
226
+ if (typeof result === "function") {
227
+ slot.cleanup = result;
228
+ return;
229
+ }
230
+ if (result && typeof result.then === "function") Promise.resolve(result).catch((error) => {
231
+ if (!controller.signal.aborted) reportWatchError(instance, error);
232
+ });
233
+ };
234
+ if (!slot.effect) slot.effect = createFineGrainedEffect({
235
+ lane: "post",
236
+ compute,
237
+ commit: observe,
238
+ equals: (previous, next) => Array.isArray(previous) && Array.isArray(next) ? watchValuesEqual(previous, next) : Object.is(previous, next),
239
+ onError: (error) => reportWatchError(instance, error)
240
+ });
241
+ else slot.effect.updateCompute(compute);
242
+ if (!slot.cleanupRegistered) {
243
+ slot.cleanupRegistered = true;
244
+ (instance.cleanupFns ??= []).push(() => {
245
+ stopWatchSlot(slot);
246
+ slot.cleanupRegistered = false;
247
+ });
248
+ }
249
+ }
250
+ function watch(sourceOrSources, callback) {
251
+ const instance = getCurrentComponentInstance();
252
+ if (!instance) return;
253
+ const index = claimHookIndex(instance, "watch");
254
+ const sources = Array.isArray(sourceOrSources) ? sourceOrSources : [sourceOrSources];
255
+ const slot = getLifecycleSlot(instance, index, "watch", () => ({
256
+ kind: "watch",
257
+ sources,
258
+ pendingSources: sources,
259
+ callback,
260
+ pendingCallback: callback,
261
+ effect: null,
262
+ controller: null,
263
+ cleanup: null,
264
+ cleanupRegistered: false,
265
+ hasObserved: false
266
+ }));
267
+ slot.pendingSources = sources;
268
+ slot.pendingCallback = callback;
269
+ if (instance.ssr) return;
270
+ registerCommitOperation(() => commitWatchSlot(instance, slot));
271
+ }
180
272
  /**
181
273
  * Capture the result of a synchronous expression at call time and return a
182
274
  * thunk that returns the captured value later. This is a low-level helper for
@@ -192,4 +284,4 @@ function capture(fn) {
192
284
  return () => value;
193
285
  }
194
286
  //#endregion
195
- export { task as a, routeActive as i, documentVisible as n, timer as o, on as r, windowFocused as s, capture as t };
287
+ export { task as a, windowFocused as c, routeActive as i, documentVisible as n, timer as o, on as r, watch as s, capture as t };
@@ -1,4 +1,4 @@
1
- import "./index-DSqXWc77.js";
1
+ import "./index-Dgjbo2gU.js";
2
2
  //#region src/router/navigation-scroll.d.ts
3
3
  /** Scroll behavior for programmatic navigations (`navigate()`). */
4
4
  type NavigationScrollBehavior = 'top' | 'preserve';
@@ -16,6 +16,8 @@ type NavigateOptions = {
16
16
  history?: 'push' | 'replace';
17
17
  replace?: boolean;
18
18
  scroll?: NavigationScrollBehavior;
19
+ /** Entry-local browser history state. It is not serialized into the URL or sent to the server. */
20
+ state?: unknown;
19
21
  };
20
22
  //#endregion
21
23
  //#region src/router/navigate.d.ts
@@ -1,14 +1,14 @@
1
- import { S as isProductionEnvironment, r as flushRuntimeScheduler, x as isDevelopmentEnvironment, y as logger } from "./access-Rr7CMa06.js";
1
+ import { S as isProductionEnvironment, r as flushRuntimeScheduler, s as isRuntimeSchedulerExecuting, x as isDevelopmentEnvironment, y as logger } from "./access-BucjYZcX.js";
2
2
  import { n as Fragment, t as ELEMENT_TYPE } from "./jsx-DRS-qjiN.js";
3
- import { r as executeComponent } from "./component-internal-Dl02WQKS.js";
4
- import { t as cleanupReadableSubscriptionSources } from "./readable-CEcteIDE.js";
5
- import { n as cleanupComponentGeneration, t as cleanupComponent } from "./component-cleanup-DjpwO9WX.js";
6
- import { i as drainLifecycleCommitErrors, p as isPromiseLike, r as discardLifecycleCommitBatch, s as flushLifecycleCommitBatch, t as beginLifecycleCommitBatch } from "./lifecycle-batch-Be-CLDjV.js";
7
- import { _ as teardownNodeSubtree } from "./cleanup-DsrbV-rr.js";
8
- import { t as CspNonceScope } from "./csp-nonce-C9OuML0U.js";
3
+ import { r as executeComponent } from "./component-internal-C4hKKQBF.js";
4
+ import { t as cleanupReadableSubscriptionSources } from "./readable-Di1fzSwm.js";
5
+ import { n as cleanupComponentGeneration, t as cleanupComponent } from "./component-cleanup-jdbgjkT1.js";
6
+ import { i as drainLifecycleCommitErrors, p as isPromiseLike, r as discardLifecycleCommitBatch, s as flushLifecycleCommitBatch, t as beginLifecycleCommitBatch } from "./lifecycle-batch-63aXFf2S.js";
7
+ import { _ as teardownNodeSubtree } from "./cleanup-TXSsApEl.js";
8
+ import { t as CspNonceScope } from "./csp-nonce-9NFUb7hJ.js";
9
9
  import { I as lockRouteRegistration, o as addRouteBasePath, r as computeRouteActivityMatches, y as getActiveRouteBasePath } from "./route-matching-Bo6UqG-5.js";
10
- import { a as resolveRouteRequest, i as hasRouteRenderData, n as getRouteRenderContext, r as getRouteRenderData, u as withoutRouteHydrationMetadata } from "./resolution-t8J0yNaU.js";
11
- import { a as clearStagedAppRenderRouteLocation, i as syncCurrentRouteSnapshot, o as createAppRenderRuntime, s as stageAppRenderRouteLocation } from "./activity-ZxJXI9hF.js";
10
+ import { a as resolveRouteRequest, i as hasRouteRenderData, n as getRouteRenderContext, r as getRouteRenderData, u as withoutRouteHydrationMetadata } from "./resolution-ClD-K7Lz.js";
11
+ import { a as clearStagedAppRenderRouteLocation, i as syncCurrentRouteSnapshot, o as createAppRenderRuntime, s as stageAppRenderRouteLocation } from "./activity-FirwPXA_.js";
12
12
  import { r as getDefaultPortalHost, t as clearRegisteredDefaultPortalForInstance } from "./default-portal-runtime-DvMvWJVp.js";
13
13
  //#region src/router/navigation-registry.ts
14
14
  let currentInstance = null;
@@ -112,6 +112,58 @@ const DEFAULT_SCROLL_RESTORATION = {
112
112
  };
113
113
  let scrollRestorationOptions = { ...DEFAULT_SCROLL_RESTORATION };
114
114
  const scrollPositions = /* @__PURE__ */ new Map();
115
+ let capturedActivationFocus;
116
+ let pendingNavigationFocus;
117
+ let focusAtHistoryNavigationStart = null;
118
+ function readFocusDescriptor() {
119
+ if (typeof document === "undefined" || !(document.activeElement instanceof HTMLElement)) return;
120
+ const active = document.activeElement;
121
+ for (const attribute of [
122
+ "data-askr-focus-key",
123
+ "id",
124
+ "name",
125
+ "aria-label"
126
+ ]) {
127
+ const value = active.getAttribute(attribute);
128
+ if (value) return {
129
+ attribute,
130
+ value
131
+ };
132
+ }
133
+ if ("labels" in active) {
134
+ const label = Array.from(active.labels ?? []).map((element) => element.textContent?.trim()).find(Boolean);
135
+ if (label) return {
136
+ attribute: "label",
137
+ value: label
138
+ };
139
+ }
140
+ }
141
+ function clearCapturedNavigationFocus() {
142
+ capturedActivationFocus = void 0;
143
+ }
144
+ function isPrimaryPointerActivation(event) {
145
+ if (event instanceof MouseEvent && (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)) return false;
146
+ return true;
147
+ }
148
+ /** Stage entry-owned focus for the duration of one primary pointer activation. */
149
+ function captureNavigationFocus(event) {
150
+ clearCapturedNavigationFocus();
151
+ if (!isPrimaryPointerActivation(event)) return;
152
+ capturedActivationFocus = readFocusDescriptor();
153
+ }
154
+ /** Release pointer activation state after its click has finished dispatching. */
155
+ function releaseNavigationFocusCapture() {
156
+ clearCapturedNavigationFocus();
157
+ }
158
+ /** Preserve the active control before route content can be replaced. */
159
+ function prepareNavigationFocus() {
160
+ pendingNavigationFocus = capturedActivationFocus ?? readFocusDescriptor();
161
+ clearCapturedNavigationFocus();
162
+ }
163
+ /** Mark the active element so restoration can avoid overwriting focus moved during route commit. */
164
+ function beginHistoryFocusRestoration() {
165
+ focusAtHistoryNavigationStart = typeof document === "undefined" ? null : document.activeElement;
166
+ }
115
167
  function getWindowHref() {
116
168
  if (typeof window === "undefined") return "/";
117
169
  return `${window.location.pathname}${window.location.search}${window.location.hash}`;
@@ -146,8 +198,10 @@ function writeHistoryScrollPosition(href, position) {
146
198
  window.history.replaceState({
147
199
  ...state,
148
200
  path: href,
149
- scroll: position
201
+ scroll: position,
202
+ focus: pendingNavigationFocus ?? readFocusDescriptor()
150
203
  }, "", href);
204
+ pendingNavigationFocus = void 0;
151
205
  }
152
206
  function saveScrollPosition(href) {
153
207
  if (!scrollRestorationOptions.enabled || typeof window === "undefined") return;
@@ -194,6 +248,12 @@ function applyHistoryScroll(href, state) {
194
248
  x: 0,
195
249
  y: 0
196
250
  });
251
+ const focus = state && typeof state === "object" && state.focus && typeof state.focus === "object" ? state.focus : void 0;
252
+ if (focus && (focus.attribute === "data-askr-focus-key" || focus.attribute === "id" || focus.attribute === "name" || focus.attribute === "aria-label" || focus.attribute === "label") && typeof focus.value === "string" && typeof document !== "undefined" && (document.activeElement === document.body || document.activeElement === document.documentElement || document.activeElement === focusAtHistoryNavigationStart)) {
253
+ const target = focus.attribute === "label" ? Array.from(document.querySelectorAll("input,select,textarea,button")).find((element) => "labels" in element && Array.from(element.labels ?? []).some((label) => label.textContent?.trim() === focus.value)) : Array.from(document.querySelectorAll(`[${focus.attribute}]`)).find((element) => element.getAttribute(focus.attribute) === focus.value);
254
+ if (target?.isConnected && !target.hasAttribute("disabled") && target.getAttribute("aria-hidden") !== "true" && target.getClientRects().length > 0) target.focus({ preventScroll: true });
255
+ }
256
+ focusAtHistoryNavigationStart = null;
197
257
  }
198
258
  function configureScrollRestoration(options) {
199
259
  scrollRestorationOptions = normalizeScrollRestorationOptions(options);
@@ -865,7 +925,11 @@ function applyNavigationTargets(requestId, path, options, redirectState, pathnam
865
925
  if (isStaleRouteRequest(requestId)) return;
866
926
  saveScrollPosition(previousHref);
867
927
  const historyMethod = getNavigationHistoryMode(options) === "replace" ? "replaceState" : "pushState";
868
- window.history[historyMethod]({ path: href }, "", href);
928
+ window.history[historyMethod]({
929
+ path: href,
930
+ askrHasState: Object.prototype.hasOwnProperty.call(options, "state"),
931
+ askrState: options.state
932
+ }, "", href);
869
933
  setCurrentRouteLocation(pathname, href);
870
934
  clearStagedRouteLocations(matchedTargets);
871
935
  syncRegisteredRouteSnapshot();
@@ -998,12 +1062,20 @@ configureNavigationRegistryHost({ cancelRouteRequests });
998
1062
  /** Navigate the client-side router to `path` using the History API. */
999
1063
  function navigate(path, options = {}) {
1000
1064
  if (typeof window === "undefined") return;
1065
+ prepareNavigationFocus();
1001
1066
  const targetPath = addRouteBasePath(path, getActiveRouteBasePath());
1002
1067
  const initialTarget = parseTargetUrl(targetPath);
1003
- navigateWithRedirectState(targetPath, options, {
1068
+ const redirectState = {
1004
1069
  redirects: 0,
1005
1070
  visited: /* @__PURE__ */ new Set([`${initialTarget.pathname}${initialTarget.search}${initialTarget.hash}`])
1006
- });
1071
+ };
1072
+ if (isRuntimeSchedulerExecuting()) {
1073
+ queueMicrotask(() => {
1074
+ navigateWithRedirectState(targetPath, options, redirectState);
1075
+ });
1076
+ return;
1077
+ }
1078
+ navigateWithRedirectState(targetPath, options, redirectState);
1007
1079
  }
1008
1080
  function navigateWithRedirectState(path, options, redirectState) {
1009
1081
  if (typeof window === "undefined") return;
@@ -1028,6 +1100,7 @@ function navigateWithRedirectState(path, options, redirectState) {
1028
1100
  applyNavigationTargets(request.id, path, options, redirectState, pathname, href, resolvedTargets, navigateWithRedirectState);
1029
1101
  }
1030
1102
  function handlePopState(event) {
1103
+ beginHistoryFocusRestoration();
1031
1104
  const request = beginRouteRequest();
1032
1105
  const previousHref = getCurrentHref();
1033
1106
  const pathname = window.location.pathname;
@@ -1055,6 +1128,8 @@ function initializeNavigation() {
1055
1128
  if (typeof window === "undefined" || navigationInitialized) return;
1056
1129
  navigationInitialized = true;
1057
1130
  window.addEventListener("popstate", handlePopState);
1131
+ document.addEventListener("pointerdown", captureNavigationFocus, true);
1132
+ document.addEventListener("click", releaseNavigationFocusCapture);
1058
1133
  }
1059
1134
  //#endregion
1060
1135
  export { serializeRouteMeta as a, getCurrentHref as c, parseTargetUrl as d, registerAppInstance as f, unregisterAppInstance as g, syncRegisteredRouteSnapshot as h, resolveRouteMeta as i, getRegisteredAppsSnapshot as l, syncAppRegistrationLocation as m, navigate as n, configureScrollRestoration as o, setCurrentRouteLocation as p, reconcileRouteMeta as r, saveScrollPosition as s, initializeNavigation as t, getWindowHref$1 as u };
@@ -1,4 +1,4 @@
1
- import { c as markRuntimeReactivePropsDirtySource, n as enqueueRuntimeTask, s as isRuntimeSchedulerExecuting } from "./access-Rr7CMa06.js";
1
+ import { c as markRuntimeReactivePropsDirtySource, n as enqueueRuntimeTask, s as isRuntimeSchedulerExecuting } from "./access-BucjYZcX.js";
2
2
  import { p as getCurrentInstance } from "./component-scope-4I3yEMkb.js";
3
3
  //#region src/runtime/readable.ts
4
4
  const DEVELOPMENT_BUILD_ENABLED = false;