@askrjs/askr 0.2.3 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/access-CEA2pOry.js +1046 -0
  3. package/dist/actions/index.d.ts +16 -2
  4. package/dist/actions/index.js +5 -5
  5. package/dist/{activity-ZxJXI9hF.js → activity-oy2YFTFF.js} +22 -16
  6. package/dist/benchmark.js +8 -9
  7. package/dist/boot/index.d.ts +21 -9
  8. package/dist/boot/index.js +1 -1
  9. package/dist/{boot-D4GaLA0d.js → boot-BMBMWUGI.js} +680 -440
  10. package/dist/capabilities-Bbf0mlp9.js +42 -0
  11. package/dist/components/index.d.ts +11 -8
  12. package/dist/components/index.js +1 -1
  13. package/dist/{compose-ref-Bfaf4kUC.js → compose-ref-v0qGlHoN.js} +7 -1
  14. package/dist/control/index.d.ts +20 -2
  15. package/dist/control/index.js +1 -1
  16. package/dist/{control-57x3wa4J.js → control-BR_mrX__.js} +4 -4
  17. package/dist/core.d.ts +163 -0
  18. package/dist/csp-nonce-BfFWcd0w.js +173 -0
  19. package/dist/data/index.d.ts +74 -2
  20. package/dist/data/index.js +3 -3
  21. package/dist/{data-B7XCDeC8.js → data-2edW0jhF.js} +133 -138
  22. package/dist/{data-runtime-7t_Y0iv3.js → data-runtime-CxoY98lX.js} +22 -15
  23. package/dist/{deferred-BELyvMsC.js → deferred-CbgNhf67.js} +5 -5
  24. package/dist/dom-renderer.d.ts +77 -0
  25. package/dist/domains/actions.d.ts +70 -0
  26. package/dist/domains/component.d.ts +119 -0
  27. package/dist/domains/context.d.ts +73 -0
  28. package/dist/domains/control.d.ts +328 -0
  29. package/dist/domains/data.d.ts +461 -0
  30. package/dist/domains/diagnostics.d.ts +21 -0
  31. package/dist/domains/lifecycle.d.ts +112 -0
  32. package/dist/domains/refs.d.ts +18 -0
  33. package/dist/domains/renderer.d.ts +127 -0
  34. package/dist/domains/routing.d.ts +501 -0
  35. package/dist/domains/scheduler.d.ts +79 -0
  36. package/dist/domains/server.d.ts +112 -0
  37. package/dist/domains/state.d.ts +129 -0
  38. package/dist/domains/telemetry.d.ts +29 -0
  39. package/dist/eager-control.d.ts +8 -0
  40. package/dist/{effect-4LwBwV58.js → effect-C3Zsc1k6.js} +14 -41
  41. package/dist/{types-DkVJhVs9.d.ts → elements.d.ts} +84 -42
  42. package/dist/{for-internal-DeoSg_AV.js → for-state-BDykeOJL.js} +623 -511
  43. package/dist/foundations/icon/index.d.ts +67 -16
  44. package/dist/foundations/icon/index.js +1 -1
  45. package/dist/foundations/index.d.ts +26 -3
  46. package/dist/foundations/index.js +1 -1
  47. package/dist/foundations/interactions/index.d.ts +73 -34
  48. package/dist/foundations/interactions/index.js +1 -1
  49. package/dist/foundations/state/index.d.ts +12 -5
  50. package/dist/foundations/state/index.js +1 -1
  51. package/dist/foundations/structures/index.d.ts +44 -3
  52. package/dist/foundations/structures/index.js +1 -1
  53. package/dist/foundations/utilities/index.d.ts +34 -3
  54. package/dist/foundations/utilities/index.js +1 -1
  55. package/dist/fx/index.d.ts +72 -25
  56. package/dist/fx/index.js +8 -8
  57. package/dist/index.d.ts +121 -4
  58. package/dist/index.js +316 -47
  59. package/dist/{component-internal-Dl02WQKS.js → instance-VAFYVJOa.js} +495 -283
  60. package/dist/{interactions-D102JxBR.js → interactions-CTeACdT_.js} +1 -1
  61. package/dist/jsx-dev-runtime.d.ts +51 -11
  62. package/dist/jsx-globals.d.ts +2 -0
  63. package/dist/jsx-runtime-CPJXAOBF.js +43 -0
  64. package/dist/jsx-runtime.d.ts +17 -3
  65. package/dist/jsx-runtime.js +2 -42
  66. package/dist/jsx.d.ts +108 -0
  67. package/dist/{manifest-D6rfj_jC.js → manifest-D1P3UNWV.js} +4 -9
  68. package/dist/{navigate-C46GtScG.js → navigate-prC5V8XV.js} +204 -476
  69. package/dist/{navigate-wel1e6cU.d.ts → navigation.d.ts} +10 -8
  70. package/dist/{readable-CEcteIDE.js → notify-DxxuDPeY.js} +96 -34
  71. package/dist/{query-registry-Bua3cDyb.js → query-registry-LrYpQsDJ.js} +1 -1
  72. package/dist/{compose-ref-DOJHoW5X.d.ts → refs.d.ts} +11 -7
  73. package/dist/{ssr-BaC5qHEw.js → render-resolved-BC0W7_5b.js} +165 -558
  74. package/dist/{renderer-BhXofszH.js → renderer-CT0HeY58.js} +6866 -5715
  75. package/dist/{resolution-t8J0yNaU.js → resolution-3DskUkjG.js} +189 -180
  76. package/dist/{resource-operation-B8q-QRUx.js → resource-18-sFRl9.js} +98 -58
  77. package/dist/resources/index.d.ts +64 -46
  78. package/dist/resources/index.js +215 -9
  79. package/dist/route-activity.d.ts +21 -0
  80. package/dist/{route-matching-Bo6UqG-5.js → route-matching-CUzZ31gT.js} +68 -82
  81. package/dist/router/index.d.ts +378 -79
  82. package/dist/router/index.js +9 -9
  83. package/dist/router-internal-7nuNEHfG.js +36 -0
  84. package/dist/scope-Cq_iYbTR.js +403 -0
  85. package/dist/{selector-C7rIpOnN.js → selector-BSPVkjKP.js} +41 -41
  86. package/dist/{shared-CGrx2AOL.js → shared-kU8yvryp.js} +3 -6
  87. package/dist/{snapshot-source-BB42xgwb.js → snapshot-source-An4iKajG.js} +1 -1
  88. package/dist/ssg/index.d.ts +51 -15
  89. package/dist/ssg/index.js +269 -209
  90. package/dist/ssr/index.d.ts +121 -68
  91. package/dist/ssr/index.js +2 -1
  92. package/dist/ssr-CiNm6Vzl.js +393 -0
  93. package/dist/{ssr-DSHd_Q9K.js → ssr-EPjwJH5R.js} +5 -1
  94. package/dist/{state-BzhOW2TX.js → state-BXJfudq1.js} +10 -15
  95. package/dist/{structures-BwfeO4Iz.js → structures-CjEzfj4h.js} +37 -57
  96. package/dist/{index-r5THqzPN.d.ts → structures.d.ts} +57 -36
  97. package/dist/testing/index.d.ts +125 -24
  98. package/dist/testing/index.js +26 -62
  99. package/dist/timer-C7uqnJVt.js +85 -0
  100. package/dist/{index-B1gu0_m0.d.ts → utilities.d.ts} +24 -13
  101. package/dist/{verify-hydration-_Q6avFp0.js → verify-hydration-ikaxotf7.js} +8 -5
  102. package/package.json +13 -15
  103. package/dist/access-Rr7CMa06.js +0 -507
  104. package/dist/activity-CAJ5eho-.d.ts +0 -14
  105. package/dist/benchmark.d.ts +0 -26
  106. package/dist/cleanup-DsrbV-rr.js +0 -535
  107. package/dist/component-cleanup-DjpwO9WX.js +0 -143
  108. package/dist/component-scope-4I3yEMkb.js +0 -195
  109. package/dist/control-DdFw-Caz.d.ts +0 -8
  110. package/dist/csp-nonce-C9OuML0U.js +0 -72
  111. package/dist/css-BuPaTOfe.js +0 -70
  112. package/dist/fastlane-Buz1Rvlr.js +0 -166
  113. package/dist/index-DSqXWc77.d.ts +0 -1402
  114. package/dist/jsx-runtime-BTzDdBJ_.d.ts +0 -2
  115. package/dist/jsx-runtime-Cdd6Gkb0.d.ts +0 -38
  116. package/dist/lifecycle-batch-Be-CLDjV.js +0 -253
  117. package/dist/lifecycle-operations-C5m03NQc.js +0 -195
@@ -1,14 +1,73 @@
1
- import { $ as AccessAllowDecision, At as RouteRefSearch, Ct as RouteOptions, Dt as RouteQuery, Et as RoutePolicy, Ft as RouteRequestResult, It as RouteSearch, Lt as RouteSearchValue, Mt as RouteRegistryOptions, Nt as RouteRenderResult, Ot as RouteRecord, Pt as RouteRequestOptions, Rt as RouteSnapshot, St as RouteMode, Tt as RoutePathParams, _t as RouteHandler, at as GroupHelperOptions, bt as RouteMeta, cn as RenderableChild, ct as PageScopeRecord, dt as RouteAuthOptions, et as AccessDecision, ft as RouteAuthResolver, gt as RouteDestination, ht as RouteDefinition, it as AccessRedirectStatus, jt as RouteRegistry, kt as RouteRef, lt as ParsedSegment, mt as RouteContext, nt as AccessDenyStatus, ot as LayoutScopeRecord, pt as RouteComponent, rt as AccessRedirectDecision, st as PageHelperOptions, tt as AccessDenyDecision, ut as Route, vt as RouteManifest, wt as RouteParams, xt as RouteMetaSource, yt as RouteMatch } from "../index-DSqXWc77.js";
2
- import { r as JSXElement, s as Props } from "../types-DkVJhVs9.js";
3
- import { a as ScrollRestorationOptions, i as NavigationScrollBehavior, n as NavigateOptions, r as HistoryScrollBehavior, t as navigate } from "../navigate-wel1e6cU.js";
4
- import { i as onRouteChange, n as RouteChangeOptions, r as currentRoute, t as RouteChangeCleanup } from "../activity-CAJ5eho-.js";
5
- import { AuthContext, AuthContext as AuthContext$1, AuthRequirement, AuthRequirement as AuthRequirement$1 } from "@askrjs/auth";
6
- import { ObjectSchema } from "@askrjs/schema";
7
- //#region src/router/route-query.d.ts
1
+ import {
2
+ RouteSnapshot,
3
+ RouteDefinition,
4
+ RoutePathParams,
5
+ RenderableChild,
6
+ PageScopeRecord,
7
+ RouteAuthResolver,
8
+ RouteAuthOptions,
9
+ RouteMeta,
10
+ RouteRefSearch,
11
+ RouteQuery,
12
+ RouteMetaSource,
13
+ RouteRenderResult,
14
+ RouteRegistry,
15
+ RouteMode,
16
+ RouteHandler,
17
+ RouteManifest,
18
+ RouteComponent,
19
+ RouteMatch,
20
+ RouteSearchValue,
21
+ RouteOptions,
22
+ PageHelperOptions,
23
+ Route,
24
+ RouteRecord,
25
+ RoutePolicy,
26
+ RouteRef,
27
+ RouteRequestResult,
28
+ RouteRequestOptions,
29
+ RouteSearch,
30
+ AccessDenyStatus,
31
+ GroupHelperOptions,
32
+ AccessDenyDecision,
33
+ AccessDecision,
34
+ RouteDestination,
35
+ RouteContext,
36
+ AccessAllowDecision,
37
+ RouteRegistryOptions,
38
+ AccessRedirectDecision,
39
+ ParsedSegment,
40
+ LayoutScopeRecord,
41
+ AccessRedirectStatus,
42
+ RouteParams,
43
+ } from '../core.js';
44
+ import { JSXElement, Props } from '../elements.js';
45
+ import {
46
+ ScrollRestorationOptions,
47
+ NavigationScrollBehavior,
48
+ NavigateOptions,
49
+ HistoryScrollBehavior,
50
+ navigate,
51
+ } from '../navigation.js';
52
+ import {
53
+ onRouteChange,
54
+ RouteChangeOptions,
55
+ currentRoute,
56
+ RouteChangeCleanup,
57
+ } from '../route-activity.js';
58
+ import {
59
+ AuthContext,
60
+ AuthContext as AuthContext$1,
61
+ AuthRequirement,
62
+ AuthRequirement as AuthRequirement$1,
63
+ } from '@askrjs/auth';
64
+ import { ObjectSchema } from '@askrjs/schema';
8
65
  /** A single query-string value accepted by {@link updateRouteQuery}. */
9
66
  type RouteQueryParamValue = string | number | boolean | null | undefined;
10
67
  /** A query-string value, or an array of them for a repeated param. */
11
- type RouteQueryParamInput = RouteQueryParamValue | readonly RouteQueryParamValue[];
68
+ type RouteQueryParamInput =
69
+ | RouteQueryParamValue
70
+ | readonly RouteQueryParamValue[];
12
71
  /** A map of query param updates for {@link updateRouteQuery}; `null`/`undefined` removes the key. */
13
72
  type RouteQueryUpdates = Record<string, RouteQueryParamInput>;
14
73
  /** A function that mutates a `URLSearchParams` directly, for {@link updateRouteQuery}. */
@@ -22,78 +81,191 @@ type UpdateRouteQueryOptions = {
22
81
  history?: 'push' | 'replace';
23
82
  replace?: boolean;
24
83
  };
25
- declare function updateRouteQuery(updates: RouteQueryUpdates | RouteQueryUpdater, options?: UpdateRouteQueryOptions): void;
26
- //#endregion
27
- //#region src/router/internal-types.d.ts
84
+ declare function updateRouteQuery(
85
+ updates: RouteQueryUpdates | RouteQueryUpdater,
86
+ options?: UpdateRouteQueryOptions
87
+ ): void;
28
88
  type AnyRouteComponent = (...args: any[]) => RenderableChild;
29
- //#endregion
30
- //#region src/router/authoring.d.ts
31
- type RouteComponentParam<TComponent extends AnyRouteComponent> = Parameters<TComponent> extends [] ? unknown : Parameters<TComponent>[0];
32
- type CompatibleAbsoluteRouteComponent<Path extends string, TComponent extends AnyRouteComponent> = Parameters<TComponent> extends [] ? TComponent : RoutePathParams<Path> extends RouteComponentParam<TComponent> ? TComponent : never;
33
- type CompatibleRelativeRouteComponent<Path extends string, TComponent extends AnyRouteComponent> = Parameters<TComponent> extends [] ? TComponent : RouteComponentParam<TComponent> extends Record<keyof RoutePathParams<Path>, string> ? TComponent : never;
34
- type CompatibleRouteComponent<Path extends string, TComponent extends AnyRouteComponent> = Path extends `/${string}` ? CompatibleAbsoluteRouteComponent<Path, TComponent> : CompatibleRelativeRouteComponent<Path, TComponent>;
35
- type RouteOptionsForComponent<Path extends string, TComponent extends AnyRouteComponent, TSearchSchema extends ObjectSchema<RouteSearch> | undefined = ObjectSchema<RouteSearch> | undefined, TLoaderData = unknown, TDehydratedData = TLoaderData> = Parameters<TComponent> extends [] ? RouteOptions<RoutePathParams<Path>, TSearchSchema, TLoaderData, TDehydratedData> : RouteComponentParam<TComponent> extends RouteParams ? RouteOptions<RouteComponentParam<TComponent>, TSearchSchema, TLoaderData, TDehydratedData> : RouteOptions<RoutePathParams<Path>, TSearchSchema, TLoaderData, TDehydratedData>;
89
+ type RouteComponentParam<TComponent extends AnyRouteComponent> =
90
+ Parameters<TComponent> extends [] ? unknown : Parameters<TComponent>[0];
91
+ type CompatibleAbsoluteRouteComponent<
92
+ Path extends string,
93
+ TComponent extends AnyRouteComponent,
94
+ > =
95
+ Parameters<TComponent> extends []
96
+ ? TComponent
97
+ : RoutePathParams<Path> extends RouteComponentParam<TComponent>
98
+ ? TComponent
99
+ : never;
100
+ type CompatibleRelativeRouteComponent<
101
+ Path extends string,
102
+ TComponent extends AnyRouteComponent,
103
+ > =
104
+ Parameters<TComponent> extends []
105
+ ? TComponent
106
+ : RouteComponentParam<TComponent> extends Record<
107
+ keyof RoutePathParams<Path>,
108
+ string
109
+ >
110
+ ? TComponent
111
+ : never;
112
+ type CompatibleRouteComponent<
113
+ Path extends string,
114
+ TComponent extends AnyRouteComponent,
115
+ > = Path extends `/${string}`
116
+ ? CompatibleAbsoluteRouteComponent<Path, TComponent>
117
+ : CompatibleRelativeRouteComponent<Path, TComponent>;
118
+ type RouteOptionsForComponent<
119
+ Path extends string,
120
+ TComponent extends AnyRouteComponent,
121
+ TSearchSchema extends ObjectSchema<RouteSearch> | undefined =
122
+ | ObjectSchema<RouteSearch>
123
+ | undefined,
124
+ TLoaderData = unknown,
125
+ TDehydratedData = TLoaderData,
126
+ > =
127
+ Parameters<TComponent> extends []
128
+ ? RouteOptions<
129
+ RoutePathParams<Path>,
130
+ TSearchSchema,
131
+ TLoaderData,
132
+ TDehydratedData
133
+ >
134
+ : RouteComponentParam<TComponent> extends RouteParams
135
+ ? RouteOptions<
136
+ RouteComponentParam<TComponent>,
137
+ TSearchSchema,
138
+ TLoaderData,
139
+ TDehydratedData
140
+ >
141
+ : RouteOptions<
142
+ RoutePathParams<Path>,
143
+ TSearchSchema,
144
+ TLoaderData,
145
+ TDehydratedData
146
+ >;
36
147
  /** Declare a group of routes sharing `options` (auth, policies, layout, meta). */
37
148
  declare function group(options: GroupHelperOptions, fn: RouteDefinition): void;
38
149
  /**
39
150
  * Declare a route page at `path`, nesting a sub-scope for `index`/`page`/`fallback`
40
151
  * declarations and options like `preload`/`meta`/`auth`.
41
152
  */
42
- declare function page<const TPath extends string>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, fn: RouteDefinition): void;
43
- declare function page<const TPath extends string, TComponent extends AnyRouteComponent>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, fn: RouteDefinition): void;
44
- declare function page<const TPath extends string>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, options: PageHelperOptions, fn: RouteDefinition): void;
45
- declare function page<const TPath extends string, TComponent extends AnyRouteComponent>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, options: PageHelperOptions, fn: RouteDefinition): void;
153
+ declare function page<const TPath extends string>(
154
+ path: TPath,
155
+ Component: RouteComponent<RoutePathParams<TPath>>,
156
+ fn: RouteDefinition
157
+ ): void;
158
+ declare function page<
159
+ const TPath extends string,
160
+ TComponent extends AnyRouteComponent,
161
+ >(
162
+ path: TPath,
163
+ Component: CompatibleRouteComponent<TPath, TComponent>,
164
+ fn: RouteDefinition
165
+ ): void;
166
+ declare function page<const TPath extends string>(
167
+ path: TPath,
168
+ Component: RouteComponent<RoutePathParams<TPath>>,
169
+ options: PageHelperOptions,
170
+ fn: RouteDefinition
171
+ ): void;
172
+ declare function page<
173
+ const TPath extends string,
174
+ TComponent extends AnyRouteComponent,
175
+ >(
176
+ path: TPath,
177
+ Component: CompatibleRouteComponent<TPath, TComponent>,
178
+ options: PageHelperOptions,
179
+ fn: RouteDefinition
180
+ ): void;
46
181
  /** Declare the index route for the enclosing `page()` scope. */
47
182
  declare function index(Component: RouteComponent, options?: RouteOptions): void;
48
183
  /** Declare the catch-all `/*` fallback route for the enclosing scope. */
49
184
  declare function fallback(Component: RouteComponent): void;
50
185
  /** Declare a route at `path` rendering `Component`, returning a typed {@link RouteRef} for building destinations. */
51
- declare function route<const TPath extends string, const TSearchSchema extends ObjectSchema<RouteSearch> | undefined = undefined, TLoaderData = unknown, TDehydratedData = TLoaderData>(path: TPath, Component: RouteComponent<RoutePathParams<TPath>>, options?: RouteOptions<RoutePathParams<TPath>, TSearchSchema, TLoaderData, TDehydratedData>): RouteRef<RoutePathParams<TPath>, RouteRefSearch<TSearchSchema>>;
52
- declare function route<const TPath extends string, TComponent extends AnyRouteComponent, const TSearchSchema extends ObjectSchema<RouteSearch> | undefined = undefined, TLoaderData = unknown, TDehydratedData = TLoaderData>(path: TPath, Component: CompatibleRouteComponent<TPath, TComponent>, options?: RouteOptionsForComponent<TPath, TComponent, TSearchSchema, TLoaderData, TDehydratedData>): RouteRef<RoutePathParams<TPath>, RouteRefSearch<TSearchSchema>>;
53
- //#endregion
54
- //#region src/router/auth.d.ts
186
+ declare function route<
187
+ const TPath extends string,
188
+ const TSearchSchema extends ObjectSchema<RouteSearch> | undefined = undefined,
189
+ TLoaderData = unknown,
190
+ TDehydratedData = TLoaderData,
191
+ >(
192
+ path: TPath,
193
+ Component: RouteComponent<RoutePathParams<TPath>>,
194
+ options?: RouteOptions<
195
+ RoutePathParams<TPath>,
196
+ TSearchSchema,
197
+ TLoaderData,
198
+ TDehydratedData
199
+ >
200
+ ): RouteRef<RoutePathParams<TPath>, RouteRefSearch<TSearchSchema>>;
201
+ declare function route<
202
+ const TPath extends string,
203
+ TComponent extends AnyRouteComponent,
204
+ const TSearchSchema extends ObjectSchema<RouteSearch> | undefined = undefined,
205
+ TLoaderData = unknown,
206
+ TDehydratedData = TLoaderData,
207
+ >(
208
+ path: TPath,
209
+ Component: CompatibleRouteComponent<TPath, TComponent>,
210
+ options?: RouteOptionsForComponent<
211
+ TPath,
212
+ TComponent,
213
+ TSearchSchema,
214
+ TLoaderData,
215
+ TDehydratedData
216
+ >
217
+ ): RouteRef<RoutePathParams<TPath>, RouteRefSearch<TSearchSchema>>;
55
218
  /** Return the identity resolved for the route currently being rendered. */
56
219
  declare function currentAuth(): AuthContext$1;
57
- //#endregion
58
- //#region src/router/resolution.d.ts
59
220
  /** Resolve `target` against a route registry, applying auth/policies to produce a render/redirect/deny result. */
60
- declare function resolveRouteRequest(target: string, options: RouteRequestOptions): RouteRequestResult | Promise<RouteRequestResult>;
61
- //#endregion
62
- //#region src/router/manifest.d.ts
221
+ declare function resolveRouteRequest(
222
+ target: string,
223
+ options: RouteRequestOptions
224
+ ): RouteRequestResult | Promise<RouteRequestResult>;
63
225
  /**
64
226
  * Run `definition` to declare routes (via `route`/`page`/`group`/`fallback`)
65
227
  * and build a {@link RouteRegistry} to pass to `createSPA`/`hydrateSPA`.
66
228
  */
67
- declare function createRouteRegistry(definition: RouteDefinition, options?: RouteRegistryOptions): RouteRegistry;
68
- //#endregion
69
- //#region src/router/lazy.d.ts
229
+ declare function createRouteRegistry(
230
+ definition: RouteDefinition,
231
+ options?: RouteRegistryOptions
232
+ ): RouteRegistry;
70
233
  /** A route component loaded on demand via {@link lazy}, with an explicit `preload()`. */
71
234
  type LazyRouteComponent<TComponent extends AnyRouteComponent> = TComponent & {
72
235
  preload(): Promise<void>;
73
236
  };
74
237
  /** A route data loader loaded on demand via {@link lazyRouteData}, with an explicit `preload()`. */
75
- type LazyRouteDataLoader<TModule, TData = TModule> = ((context: RouteContext & {
76
- request?: Request;
77
- }) => Promise<TData>) & {
238
+ type LazyRouteDataLoader<TModule, TData = TModule> = ((
239
+ context: RouteContext & {
240
+ request?: Request;
241
+ }
242
+ ) => Promise<TData>) & {
78
243
  preload(): Promise<void>;
79
244
  };
80
245
  /** Wrap a dynamic-import factory as a {@link LazyRouteComponent}, loaded on first use. */
81
- declare function lazy<TComponent extends AnyRouteComponent>(factory: () => Promise<{
82
- default: TComponent;
83
- } | TComponent>): LazyRouteComponent<TComponent>;
246
+ declare function lazy<TComponent extends AnyRouteComponent>(
247
+ factory: () => Promise<
248
+ | {
249
+ default: TComponent;
250
+ }
251
+ | TComponent
252
+ >
253
+ ): LazyRouteComponent<TComponent>;
84
254
  /**
85
255
  * Create a cached route loader backed by a dynamic import. The module is only
86
256
  * requested when the owning route matches, unless preload() is called.
87
257
  */
88
- declare function lazyRouteData<TModule, TData = TModule>(factory: () => PromiseLike<TModule>, select?: (module: TModule, context: RouteContext & {
89
- request?: Request;
90
- }) => TData | PromiseLike<TData>): LazyRouteDataLoader<TModule, TData>;
91
- //#endregion
92
- //#region src/router/rendering.d.ts
258
+ declare function lazyRouteData<TModule, TData = TModule>(
259
+ factory: () => PromiseLike<TModule>,
260
+ select?: (
261
+ module: TModule,
262
+ context: RouteContext & {
263
+ request?: Request;
264
+ }
265
+ ) => TData | PromiseLike<TData>
266
+ ): LazyRouteDataLoader<TModule, TData>;
93
267
  /** Renders the nested route content for the enclosing layout or page scope. */
94
268
  declare function Outlet(): JSXElement;
95
- //#endregion
96
- //#region src/router/route-data-loader.d.ts
97
269
  /** Which environment a route's data loader ran (or failed) in. */
98
270
  type RouteDataLoadPhase = 'client' | 'server' | 'ssg';
99
271
  /** Thrown when a route's `loader` rejects; wraps the original `cause`. */
@@ -103,15 +275,16 @@ declare class RouteDataLoadError extends Error {
103
275
  readonly cause: unknown;
104
276
  constructor(route: string, phase: RouteDataLoadPhase, cause: unknown);
105
277
  }
106
- //#endregion
107
- //#region src/router/policy.d.ts
108
278
  /** Policy decision: allow the route to render. */
109
279
  declare function allow(): AccessAllowDecision;
110
280
  /** Policy decision: redirect the visitor to `to`. */
111
- declare function redirect(to: string, init?: {
112
- status?: AccessRedirectStatus;
113
- replace?: boolean;
114
- }): AccessRedirectDecision;
281
+ declare function redirect(
282
+ to: string,
283
+ init?: {
284
+ status?: AccessRedirectStatus;
285
+ replace?: boolean;
286
+ }
287
+ ): AccessRedirectDecision;
115
288
  /** Policy decision: deny the request with the given HTTP status. */
116
289
  declare function deny(status: AccessDenyStatus): AccessDenyDecision;
117
290
  /** Policy decision: deny with 401 Unauthorized. */
@@ -120,20 +293,27 @@ declare function unauthorized(): AccessDenyDecision;
120
293
  declare function forbidden(): AccessDenyDecision;
121
294
  /** Policy decision: deny with 404 Not Found. */
122
295
  declare function notFound(): AccessDenyDecision;
123
- //#endregion
124
- //#region src/router/destination.d.ts
125
296
  /** Build a {@link RouteDestination} (with a computed `href`) for a {@link RouteRef} and params/search. */
126
- declare function to$1<TParams extends RouteParams, TSearch extends RouteSearch = RouteSearch>(route: RouteRef<TParams, TSearch>, params: TParams, search?: TSearch): RouteDestination;
127
- //#endregion
128
- //#region src/router/metadata.d.ts
297
+ declare function to$1<
298
+ TParams extends RouteParams,
299
+ TSearch extends RouteSearch = RouteSearch,
300
+ >(
301
+ route: RouteRef<TParams, TSearch>,
302
+ params: TParams,
303
+ search?: TSearch
304
+ ): RouteDestination;
129
305
  /** Resolve a route's merged {@link RouteMeta} by running its metadata chain against `context`. */
130
- declare function resolveRouteMeta(record: RouteRecord, context: RouteContext): Promise<Readonly<RouteMeta>>;
306
+ declare function resolveRouteMeta(
307
+ record: RouteRecord,
308
+ context: RouteContext
309
+ ): Promise<Readonly<RouteMeta>>;
131
310
  /** Replace only Askr-owned head nodes after a successful client navigation. */
132
- declare function reconcileRouteMeta(meta: Readonly<RouteMeta>, target?: Document): void;
311
+ declare function reconcileRouteMeta(
312
+ meta: Readonly<RouteMeta>,
313
+ target?: Document
314
+ ): void;
133
315
  /** Render a {@link RouteMeta} to the `<title>`/`<meta>`/`<link>`/JSON-LD markup for the document `<head>`. */
134
316
  declare function serializeRouteMeta(meta: RouteMeta): string;
135
- //#endregion
136
- //#region src/common/deferred-value.d.ts
137
317
  declare const DEFERRED_VALUE: unique symbol;
138
318
  /** Lifecycle state of a {@link Deferred} value. */
139
319
  type DeferredState = 'pending' | 'fulfilled' | 'rejected';
@@ -149,8 +329,6 @@ interface Deferred<T> {
149
329
  declare function defer<T>(promise: PromiseLike<T>): Deferred<T>;
150
330
  /** Check whether `value` is a {@link Deferred} produced by {@link defer}. */
151
331
  declare function isDeferred<T = unknown>(value: unknown): value is Deferred<T>;
152
- //#endregion
153
- //#region src/router/deferred.d.ts
154
332
  /** Props for {@link Resolve}. */
155
333
  interface ResolveProps<T> {
156
334
  value: Deferred<T>;
@@ -159,14 +337,24 @@ interface ResolveProps<T> {
159
337
  children: (value: T) => RenderableChild;
160
338
  }
161
339
  /** Recursively await any {@link Deferred} values nested within `input`, returning it once fully resolved. */
162
- declare function resolveDeferredValues<T>(input: T, signal?: AbortSignal): Promise<T>;
340
+ declare function resolveDeferredValues<T>(
341
+ input: T,
342
+ signal?: AbortSignal
343
+ ): Promise<T>;
163
344
  /** Read the current route's server loader data during render or hydration. */
164
345
  declare function routeData<T>(): T;
165
346
  /** Render a {@link Deferred} value's fulfilled state, a pending placeholder, or a rejected fallback. */
166
347
  declare function Resolve<T>(props: ResolveProps<T>): JSXElement;
167
- //#endregion
168
- //#region src/components/link.d.ts
169
- type LinkBaseProps = Omit<Props, 'children' | 'href' | 'class' | 'rel' | 'target' | 'aria-current' | 'aria-label'> & {
348
+ type LinkBaseProps = Omit<
349
+ Props,
350
+ | 'children'
351
+ | 'href'
352
+ | 'class'
353
+ | 'rel'
354
+ | 'target'
355
+ | 'aria-current'
356
+ | 'aria-label'
357
+ > & {
170
358
  class?: string;
171
359
  children?: RenderableChild;
172
360
  /**
@@ -183,7 +371,14 @@ type LinkBaseProps = Omit<Props, 'children' | 'href' | 'class' | 'rel' | 'target
183
371
  * Optional aria-current attribute for indicating current page/location.
184
372
  * Use "page" for the current page in navigation.
185
373
  */
186
- 'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false';
374
+ 'aria-current'?:
375
+ | 'page'
376
+ | 'step'
377
+ | 'location'
378
+ | 'date'
379
+ | 'time'
380
+ | 'true'
381
+ | 'false';
187
382
  /**
188
383
  * Optional aria-label for accessibility when link text isn't descriptive enough.
189
384
  */
@@ -192,13 +387,17 @@ type LinkBaseProps = Omit<Props, 'children' | 'href' | 'class' | 'rel' | 'target
192
387
  onClick?: (event: MouseEvent) => void;
193
388
  };
194
389
  /** Props for {@link Link}: either a raw `href` or a typed route `to` destination. */
195
- type LinkProps = LinkBaseProps & ({
196
- href: string;
197
- to?: never;
198
- } | {
199
- href?: never;
200
- to: RouteDestination;
201
- });
390
+ type LinkProps = LinkBaseProps &
391
+ (
392
+ | {
393
+ href: string;
394
+ to?: never;
395
+ }
396
+ | {
397
+ href?: never;
398
+ to: RouteDestination;
399
+ }
400
+ );
202
401
  /**
203
402
  * Link component that prevents default navigation and uses navigate()
204
403
  * Provides declarative way to navigate between routes
@@ -228,6 +427,106 @@ type LinkProps = LinkBaseProps & ({
228
427
  * - Keyboard handling automatic
229
428
  * - Composable via mergeProps
230
429
  */
231
- declare function Link({ href: suppliedHref, to, class: className, children, rel, target, 'aria-current': ariaCurrent, 'aria-label': ariaLabel, onPress, onClick, ...rest }: LinkProps): JSXElement;
232
- //#endregion
233
- export { type AccessDecision, type AccessDenyDecision, type AccessRedirectDecision, type AuthContext, type AuthRequirement, type Deferred, type DeferredState, type GroupHelperOptions, type HistoryScrollBehavior, type LayoutScopeRecord, type LazyRouteComponent, type LazyRouteDataLoader, Link, type LinkProps, type NavigateOptions, type NavigationScrollBehavior, Outlet, type PageHelperOptions, type PageScopeRecord, type ParsedSegment, Resolve, type ResolveProps, type Route, type RouteAuthOptions, type RouteAuthResolver, type RouteChangeCleanup, type RouteChangeOptions, type RouteComponent, type RouteContext, RouteDataLoadError, type RouteDataLoadPhase, type RouteDefinition, type RouteDestination, type RouteHandler, type RouteManifest, type RouteMatch, type RouteMeta, type RouteMetaSource, type RouteMode, type RouteOptions, type RouteParams, type RoutePathParams, type RoutePolicy, type RouteQuery, type RouteQueryParamInput, type RouteQueryParamValue, type RouteQueryUpdater, type RouteQueryUpdates, type RouteRecord, type RouteRef, type RouteRegistry, type RouteRegistryOptions, type RouteRenderResult, type RouteRequestOptions, type RouteRequestResult, type RouteSearch, type RouteSearchValue, type RouteSnapshot, type ScrollRestorationOptions, type UpdateRouteQueryOptions, allow, createRouteRegistry, currentAuth, currentRoute, defer, deny, fallback, forbidden, group, index, isDeferred, lazy, lazyRouteData, navigate, notFound, onRouteChange, page, reconcileRouteMeta, redirect, resolveDeferredValues, resolveRouteMeta, resolveRouteRequest, route, routeData, serializeRouteMeta, to$1 as to, unauthorized, updateRouteQuery };
430
+ declare function Link({
431
+ href: suppliedHref,
432
+ to,
433
+ class: className,
434
+ children,
435
+ rel,
436
+ target,
437
+ 'aria-current': ariaCurrent,
438
+ 'aria-label': ariaLabel,
439
+ onPress,
440
+ onClick,
441
+ ...rest
442
+ }: LinkProps): JSXElement;
443
+ export {
444
+ type AccessDecision,
445
+ type AccessDenyDecision,
446
+ type AccessRedirectDecision,
447
+ type AuthContext,
448
+ type AuthRequirement,
449
+ type Deferred,
450
+ type DeferredState,
451
+ type GroupHelperOptions,
452
+ type HistoryScrollBehavior,
453
+ type LayoutScopeRecord,
454
+ type LazyRouteComponent,
455
+ type LazyRouteDataLoader,
456
+ Link,
457
+ type LinkProps,
458
+ type NavigateOptions,
459
+ type NavigationScrollBehavior,
460
+ Outlet,
461
+ type PageHelperOptions,
462
+ type PageScopeRecord,
463
+ type ParsedSegment,
464
+ Resolve,
465
+ type ResolveProps,
466
+ type Route,
467
+ type RouteAuthOptions,
468
+ type RouteAuthResolver,
469
+ type RouteChangeCleanup,
470
+ type RouteChangeOptions,
471
+ type RouteComponent,
472
+ type RouteContext,
473
+ RouteDataLoadError,
474
+ type RouteDataLoadPhase,
475
+ type RouteDefinition,
476
+ type RouteDestination,
477
+ type RouteHandler,
478
+ type RouteManifest,
479
+ type RouteMatch,
480
+ type RouteMeta,
481
+ type RouteMetaSource,
482
+ type RouteMode,
483
+ type RouteOptions,
484
+ type RouteParams,
485
+ type RoutePathParams,
486
+ type RoutePolicy,
487
+ type RouteQuery,
488
+ type RouteQueryParamInput,
489
+ type RouteQueryParamValue,
490
+ type RouteQueryUpdater,
491
+ type RouteQueryUpdates,
492
+ type RouteRecord,
493
+ type RouteRef,
494
+ type RouteRegistry,
495
+ type RouteRegistryOptions,
496
+ type RouteRenderResult,
497
+ type RouteRequestOptions,
498
+ type RouteRequestResult,
499
+ type RouteSearch,
500
+ type RouteSearchValue,
501
+ type RouteSnapshot,
502
+ type ScrollRestorationOptions,
503
+ type UpdateRouteQueryOptions,
504
+ allow,
505
+ createRouteRegistry,
506
+ currentAuth,
507
+ currentRoute,
508
+ defer,
509
+ deny,
510
+ fallback,
511
+ forbidden,
512
+ group,
513
+ index,
514
+ isDeferred,
515
+ lazy,
516
+ lazyRouteData,
517
+ navigate,
518
+ notFound,
519
+ onRouteChange,
520
+ page,
521
+ reconcileRouteMeta,
522
+ redirect,
523
+ resolveDeferredValues,
524
+ resolveRouteMeta,
525
+ resolveRouteRequest,
526
+ route,
527
+ routeData,
528
+ serializeRouteMeta,
529
+ to$1 as to,
530
+ unauthorized,
531
+ updateRouteQuery,
532
+ };
@@ -1,13 +1,13 @@
1
- import { n as createRouteRegistry } from "../manifest-D6rfj_jC.js";
2
- import { a as isSafeHref } from "../csp-nonce-C9OuML0U.js";
3
- import { jsx } from "../jsx-runtime.js";
4
- import { o as addRouteBasePath, y as getActiveRouteBasePath } from "../route-matching-Bo6UqG-5.js";
5
- import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-BELyvMsC.js";
6
- import { S as RouteDataLoadError, a as resolveRouteRequest, b as lazy, f as defer, g as Outlet, h as currentAuth, p as isDeferred, x as lazyRouteData } from "../resolution-t8J0yNaU.js";
7
- import { n as onRouteChange, t as currentRoute } from "../activity-ZxJXI9hF.js";
8
- import { a as serializeRouteMeta, c as getCurrentHref, d as parseTargetUrl, h as syncRegisteredRouteSnapshot, i as resolveRouteMeta, l as getRegisteredAppsSnapshot, m as syncAppRegistrationLocation, n as navigate, p as setCurrentRouteLocation, r as reconcileRouteMeta, s as saveScrollPosition, u as getWindowHref } from "../navigate-C46GtScG.js";
1
+ import { n as createRouteRegistry } from "../manifest-D1P3UNWV.js";
2
+ import { n as isSafeHref } from "../router-internal-7nuNEHfG.js";
3
+ import { t as jsx } from "../jsx-runtime-CPJXAOBF.js";
4
+ import { a as serializeRouteMeta, c as getCurrentHref, d as parseTargetUrl, h as syncRegisteredRouteSnapshot, i as resolveRouteMeta, l as getRegisteredAppsSnapshot, m as syncAppRegistrationLocation, n as navigate, p as setCurrentRouteLocation, r as reconcileRouteMeta, s as saveScrollPosition, u as getWindowHref } from "../navigate-prC5V8XV.js";
5
+ import { n as onRouteChange, t as currentRoute } from "../activity-oy2YFTFF.js";
6
+ import { S as isDeferred, a as resolveRouteRequest, c as Outlet, f as lazy, m as RouteDataLoadError, p as lazyRouteData, s as currentAuth, x as defer } from "../resolution-3DskUkjG.js";
7
+ import { b as getActiveRouteBasePath, o as addRouteBasePath } from "../route-matching-CUzZ31gT.js";
8
+ import { a as group, c as route, i as fallback, n as resolveDeferredValues, o as index, r as routeData, s as page, t as Resolve } from "../deferred-CbgNhf67.js";
9
9
  import { i as mergeProps } from "../aria-hKjThHcp.js";
10
- import { t as applyInteractionPolicy } from "../interactions-D102JxBR.js";
10
+ import { t as applyInteractionPolicy } from "../interactions-CTeACdT_.js";
11
11
  //#region src/router/route-query.ts
12
12
  function getRouteQueryHistoryMode(options) {
13
13
  if (options.history) return options.history;
@@ -0,0 +1,36 @@
1
+ //#region src/common/url.ts
2
+ const SAFE_URL_SCHEMES = /* @__PURE__ */ new Set([
3
+ "http",
4
+ "https",
5
+ "mailto",
6
+ "sms",
7
+ "tel"
8
+ ]);
9
+ const URL_SCHEME_RE = /^([a-z][a-z0-9+.-]*):/i;
10
+ function isSafeHref(value) {
11
+ const compact = value.trim().replace(/[\u0000-\u0020\u007f-\u009f]/g, "");
12
+ const scheme = URL_SCHEME_RE.exec(compact)?.[1]?.toLowerCase();
13
+ return scheme === void 0 || SAFE_URL_SCHEMES.has(scheme);
14
+ }
15
+ /**
16
+ * Attribute names (lowercased) that can carry a browser-navigable/executable
17
+ * URL and must be checked against isSafeHref. Shared between the client
18
+ * renderer (renderer/attributes.ts) and SSR (ssr/attrs.ts) so their unsafe-
19
+ * URL handling can't drift. Deliberately excludes `src`: it covers a much
20
+ * wider range of legitimate non-navigable values (data: image URIs, blob:
21
+ * URLs, etc.) where the same scheme allowlist would be overly aggressive.
22
+ */
23
+ const UNSAFE_URL_SCHEME_ATTRIBUTES = /* @__PURE__ */ new Set([
24
+ "href",
25
+ "formaction",
26
+ "action",
27
+ "xlink:href"
28
+ ]);
29
+ function isUnsafeUrlAttribute(key, value) {
30
+ return UNSAFE_URL_SCHEME_ATTRIBUTES.has(key.toLowerCase()) && !isSafeHref(String(value));
31
+ }
32
+ //#endregion
33
+ //#region src/common/router-internal.ts
34
+ const ROUTE_ROOT_COMPONENT = Symbol.for("askr.route-root-component");
35
+ //#endregion
36
+ export { isSafeHref as n, isUnsafeUrlAttribute as r, ROUTE_ROOT_COMPONENT as t };