@nifrajs/web 2.1.0 → 2.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 (194) hide show
  1. package/README.md +3 -3
  2. package/dist/build-vite.d.ts +68 -0
  3. package/dist/build-vite.d.ts.map +1 -0
  4. package/dist/build-vite.js +433 -0
  5. package/dist/build-vite.js.map +1 -0
  6. package/dist/build.d.ts +174 -65
  7. package/dist/build.d.ts.map +1 -1
  8. package/dist/build.js +376 -135
  9. package/dist/build.js.map +1 -1
  10. package/dist/bun-dev-entry.d.ts +83 -0
  11. package/dist/bun-dev-entry.d.ts.map +1 -0
  12. package/dist/bun-dev-entry.js +136 -0
  13. package/dist/bun-dev-entry.js.map +1 -0
  14. package/dist/chunk-names.js +1 -1
  15. package/dist/client.d.ts +3 -9
  16. package/dist/client.d.ts.map +1 -1
  17. package/dist/client.js +209 -27
  18. package/dist/client.js.map +1 -1
  19. package/dist/conformance.d.ts +2 -2
  20. package/dist/conformance.js +3 -3
  21. package/dist/deferred.d.ts +11 -11
  22. package/dist/deferred.d.ts.map +1 -1
  23. package/dist/deferred.js +16 -16
  24. package/dist/dev-error.d.ts +2 -2
  25. package/dist/dev-error.js +3 -3
  26. package/dist/dev-port.d.ts +36 -0
  27. package/dist/dev-port.d.ts.map +1 -0
  28. package/dist/dev-port.js +48 -0
  29. package/dist/dev-port.js.map +1 -0
  30. package/dist/dev.d.ts +62 -5
  31. package/dist/dev.d.ts.map +1 -1
  32. package/dist/dev.js +419 -60
  33. package/dist/dev.js.map +1 -1
  34. package/dist/draft.d.ts +44 -7
  35. package/dist/draft.d.ts.map +1 -1
  36. package/dist/draft.js +92 -9
  37. package/dist/draft.js.map +1 -1
  38. package/dist/fn-state.d.ts +56 -0
  39. package/dist/fn-state.d.ts.map +1 -0
  40. package/dist/fn-state.js +77 -0
  41. package/dist/fn-state.js.map +1 -0
  42. package/dist/fn.d.ts +111 -0
  43. package/dist/fn.d.ts.map +1 -0
  44. package/dist/fn.js +125 -0
  45. package/dist/fn.js.map +1 -0
  46. package/dist/fonts-google.d.ts +9 -9
  47. package/dist/fonts-google.js +10 -10
  48. package/dist/fonts.d.ts +7 -7
  49. package/dist/fonts.js +1 -1
  50. package/dist/forms.d.ts +8 -8
  51. package/dist/fs.d.ts +15 -2
  52. package/dist/fs.d.ts.map +1 -1
  53. package/dist/fs.js +8 -2
  54. package/dist/fs.js.map +1 -1
  55. package/dist/index.d.ts +266 -74
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +869 -179
  58. package/dist/index.js.map +1 -1
  59. package/dist/internal/head-attributes.d.ts +15 -0
  60. package/dist/internal/head-attributes.d.ts.map +1 -0
  61. package/dist/internal/head-attributes.js +99 -0
  62. package/dist/internal/head-attributes.js.map +1 -0
  63. package/dist/internal/script-types.d.ts +14 -0
  64. package/dist/internal/script-types.d.ts.map +1 -0
  65. package/dist/internal/script-types.js +17 -0
  66. package/dist/internal/script-types.js.map +1 -0
  67. package/dist/internal/server-boundary.d.ts +60 -0
  68. package/dist/internal/server-boundary.d.ts.map +1 -0
  69. package/dist/internal/server-boundary.js +174 -0
  70. package/dist/internal/server-boundary.js.map +1 -0
  71. package/dist/internal/timing-safe-equal.d.ts +16 -0
  72. package/dist/internal/timing-safe-equal.d.ts.map +1 -0
  73. package/dist/internal/timing-safe-equal.js +26 -0
  74. package/dist/internal/timing-safe-equal.js.map +1 -0
  75. package/dist/internal/vite-import.d.ts +63 -0
  76. package/dist/internal/vite-import.d.ts.map +1 -0
  77. package/dist/internal/vite-import.js +94 -0
  78. package/dist/internal/vite-import.js.map +1 -0
  79. package/dist/islands.d.ts +5 -5
  80. package/dist/islands.js +5 -5
  81. package/dist/isr.d.ts +15 -15
  82. package/dist/isr.d.ts.map +1 -1
  83. package/dist/isr.js +8 -21
  84. package/dist/isr.js.map +1 -1
  85. package/dist/llms-txt.d.ts.map +1 -1
  86. package/dist/llms-txt.js +12 -6
  87. package/dist/llms-txt.js.map +1 -1
  88. package/dist/manifest.d.ts +121 -40
  89. package/dist/manifest.d.ts.map +1 -1
  90. package/dist/manifest.js +136 -26
  91. package/dist/manifest.js.map +1 -1
  92. package/dist/module-graph.d.ts +91 -0
  93. package/dist/module-graph.d.ts.map +1 -0
  94. package/dist/module-graph.js +92 -0
  95. package/dist/module-graph.js.map +1 -0
  96. package/dist/navigation.d.ts +120 -5
  97. package/dist/navigation.d.ts.map +1 -1
  98. package/dist/navigation.js +37 -5
  99. package/dist/navigation.js.map +1 -1
  100. package/dist/plugins/css-modules.d.ts +3 -3
  101. package/dist/plugins/css-modules.d.ts.map +1 -1
  102. package/dist/plugins/css-modules.js +0 -0
  103. package/dist/plugins/css-modules.js.map +1 -1
  104. package/dist/plugins/kit.d.ts +8 -8
  105. package/dist/plugins/kit.js +9 -9
  106. package/dist/plugins/scss.js +3 -3
  107. package/dist/plugins/vite-leak-guard.d.ts +45 -0
  108. package/dist/plugins/vite-leak-guard.d.ts.map +1 -0
  109. package/dist/plugins/vite-leak-guard.js +67 -0
  110. package/dist/plugins/vite-leak-guard.js.map +1 -0
  111. package/dist/plugins/vite-server-fn.d.ts +23 -0
  112. package/dist/plugins/vite-server-fn.d.ts.map +1 -0
  113. package/dist/plugins/vite-server-fn.js +51 -0
  114. package/dist/plugins/vite-server-fn.js.map +1 -0
  115. package/dist/plugins/vite-server-only.d.ts +49 -0
  116. package/dist/plugins/vite-server-only.d.ts.map +1 -0
  117. package/dist/plugins/vite-server-only.js +57 -0
  118. package/dist/plugins/vite-server-only.js.map +1 -0
  119. package/dist/prerender.d.ts +5 -5
  120. package/dist/prerender.js +7 -7
  121. package/dist/public-dir.d.ts +36 -0
  122. package/dist/public-dir.d.ts.map +1 -0
  123. package/dist/public-dir.js +89 -0
  124. package/dist/public-dir.js.map +1 -0
  125. package/dist/query.d.ts +10 -10
  126. package/dist/query.js +15 -15
  127. package/dist/route-manifest.d.ts +91 -0
  128. package/dist/route-manifest.d.ts.map +1 -0
  129. package/dist/route-manifest.js +128 -0
  130. package/dist/route-manifest.js.map +1 -0
  131. package/dist/router.d.ts +94 -22
  132. package/dist/router.d.ts.map +1 -1
  133. package/dist/router.js +170 -58
  134. package/dist/router.js.map +1 -1
  135. package/dist/search.d.ts +94 -0
  136. package/dist/search.d.ts.map +1 -0
  137. package/dist/search.js +232 -0
  138. package/dist/search.js.map +1 -0
  139. package/dist/server-only.d.ts +6 -6
  140. package/dist/server-only.js +7 -7
  141. package/dist/service-worker.d.ts +56 -0
  142. package/dist/service-worker.d.ts.map +1 -0
  143. package/dist/service-worker.js +127 -0
  144. package/dist/service-worker.js.map +1 -0
  145. package/dist/vite.d.ts +25 -17
  146. package/dist/vite.d.ts.map +1 -1
  147. package/dist/vite.js +75 -33
  148. package/dist/vite.js.map +1 -1
  149. package/package.json +48 -4
  150. package/server-manifest.d.ts +31 -0
  151. package/src/build-vite.ts +553 -0
  152. package/src/build.ts +563 -172
  153. package/src/bun-dev-entry.ts +184 -0
  154. package/src/chunk-names.ts +1 -1
  155. package/src/client.ts +221 -30
  156. package/src/conformance.ts +3 -3
  157. package/src/deferred.ts +17 -17
  158. package/src/dev-error.ts +3 -3
  159. package/src/dev-port.ts +63 -0
  160. package/src/dev.ts +468 -66
  161. package/src/draft.ts +124 -12
  162. package/src/fn-state.ts +107 -0
  163. package/src/fn.ts +199 -0
  164. package/src/fonts-google.ts +13 -13
  165. package/src/fonts.ts +7 -7
  166. package/src/forms.ts +8 -8
  167. package/src/fs.ts +24 -6
  168. package/src/index.ts +1174 -225
  169. package/src/internal/head-attributes.ts +109 -0
  170. package/src/internal/script-types.ts +18 -0
  171. package/src/internal/server-boundary.ts +187 -0
  172. package/src/internal/timing-safe-equal.ts +24 -0
  173. package/src/internal/vite-import.ts +92 -0
  174. package/src/islands.ts +7 -7
  175. package/src/isr.ts +18 -30
  176. package/src/llms-txt.ts +13 -5
  177. package/src/manifest.ts +264 -48
  178. package/src/module-graph.ts +146 -0
  179. package/src/navigation.ts +151 -5
  180. package/src/plugins/css-modules.ts +0 -0
  181. package/src/plugins/kit.ts +11 -11
  182. package/src/plugins/scss.ts +3 -3
  183. package/src/plugins/vite-leak-guard.ts +110 -0
  184. package/src/plugins/vite-server-fn.ts +67 -0
  185. package/src/plugins/vite-server-only.ts +75 -0
  186. package/src/prerender.ts +10 -10
  187. package/src/public-dir.ts +108 -0
  188. package/src/query.ts +22 -22
  189. package/src/route-manifest.ts +240 -0
  190. package/src/router.ts +288 -74
  191. package/src/search.ts +297 -0
  192. package/src/server-only.ts +7 -7
  193. package/src/service-worker.ts +165 -0
  194. package/src/vite.ts +103 -49
package/dist/router.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { StandardSchemaV1 } from "@nifrajs/core/server";
1
2
  /**
2
3
  * Request header that asks a nifra route's GET to return just the loader data as JSON (instead of
3
4
  * the full HTML document). Set by client-side navigation; read by `createWebApp`'s GET handler.
@@ -6,28 +7,82 @@ export declare const DATA_HEADER = "x-nifra-data";
6
7
  /**
7
8
  * Global the server injects (`createWebApp({ prerenderedPaths })`) listing the SSG-prerendered paths.
8
9
  * The client's default data fetch reads it: a soft-nav INTO a prerendered route fetches its static
9
- * `<path>/_data.json` (a CDN file — no worker round-trip) instead of the dynamic header-GET.
10
+ * `<path>/_data.json` (a CDN file - no worker round-trip) instead of the dynamic header-GET.
10
11
  */
11
12
  export declare const PRERENDERED_GLOBAL = "__NIFRA_PRERENDERED__";
12
13
  /**
13
14
  * Response header a data-mode action POST uses to convey a redirect (`redirect(...)`) to the
14
- * client — fetch would otherwise silently follow a 3xx to its HTML, losing the target. The
15
+ * client - fetch would otherwise silently follow a 3xx to its HTML, losing the target. The
15
16
  * client reads this and performs a client-side navigation instead.
16
17
  */
17
18
  export declare const REDIRECT_HEADER = "x-nifra-redirect";
18
19
  /**
19
20
  * Response header an action sets (via the `revalidate(paths, data)` helper) to tell the client which
20
- * routes the mutation changed — a comma-separated list of paths. After the submit, the client marks
21
+ * routes the mutation changed - a comma-separated list of paths. After the submit, the client marks
21
22
  * those cached routes stale (refetching any that are mounted) so a mutation can refresh views beyond
22
23
  * the active one. The client validates each path against the manifest matcher before acting on it.
23
24
  */
24
25
  export declare const REVALIDATE_HEADER = "x-nifra-revalidate";
26
+ /**
27
+ * Response header carrying a **terminal status** a loader signalled with `notFound()` / `gone()` /
28
+ * `statusPage(n)` during a client-side navigation's data fetch.
29
+ *
30
+ * A soft-nav fetches data, not a document, so the server cannot answer by rendering the `_404` page -
31
+ * it has only JSON to return. Without this channel the two halves disagree: a crawler doing a hard
32
+ * navigation gets a correct 404 page while a user who clicked a link gets an error or a blank screen.
33
+ * The client reads it and renders the same boundary the server would have.
34
+ *
35
+ * Carried in a header rather than the body so it survives the NDJSON deferred-data path unchanged,
36
+ * exactly like {@link REDIRECT_HEADER}.
37
+ */
38
+ export declare const STATUS_HEADER = "x-nifra-status";
39
+ /**
40
+ * Layout indices a client navigation is asking the server NOT to re-run, comma separated.
41
+ *
42
+ * The client owns the decision because it holds both the old and new match plus each layout's scoped
43
+ * params. The server treats it as a hint and refuses to skip a `gate` regardless - a guard that runs
44
+ * only when the client says so is not a guard.
45
+ */
46
+ export declare const RETAIN_HEADER = "x-nifra-retain";
47
+ /**
48
+ * The path a client navigation is coming FROM, sent on the data-mode GET.
49
+ *
50
+ * Lets the SERVER decide which layout loaders to skip: it already knows each layout's scoped params
51
+ * (derived at build time), so given both paths it can tell whether a layout's own prefix changed.
52
+ * Doing it server-side means the client never needs the scope table, and the decision lives next to
53
+ * the data it is about.
54
+ *
55
+ * Sent only when the client actually holds layout data to retain, so a request without it is simply
56
+ * the full-chain case.
57
+ */
58
+ export declare const NAV_FROM_HEADER = "x-nifra-from";
59
+ /**
60
+ * The data-mode payload once a chain can carry layout data.
61
+ *
62
+ * Versioned because a prerendered `_data.json` is a static file on a CDN and outlives the deploy that
63
+ * wrote it: a browser running new client code can be handed an envelope written by the previous
64
+ * build. The reader therefore accepts BOTH the bare pre-envelope value and this shape, and decides by
65
+ * structure rather than by assuming the deploy was atomic.
66
+ */
67
+ export interface RouteDataEnvelope {
68
+ readonly v: 1;
69
+ readonly data: unknown;
70
+ readonly layoutData?: readonly unknown[];
71
+ /** Indices whose loader was SKIPPED because the layout's own params did not change. The client
72
+ * keeps its existing value at each of these, so an unchanged layout is neither refetched nor lost. */
73
+ readonly retained?: readonly number[];
74
+ /** Terminal status signalled by a loader. Added by the browser transport after reading
75
+ * `X-Nifra-Status`; old servers and static data files simply omit it. */
76
+ readonly status?: number;
77
+ }
78
+ /** Recognise the envelope without mistaking a plain loader object that happens to have a `data` key. */
79
+ export declare function isRouteDataEnvelope(value: unknown): value is RouteDataEnvelope;
25
80
  /** A URL matched against the manifest patterns: which route + its extracted params. */
26
81
  export interface RouteMatch {
27
82
  readonly routeId: string;
28
83
  readonly params: Record<string, string>;
29
84
  }
30
- /** An in-flight client submit — the action it targets + the `FormData` being sent. Set while the
85
+ /** An in-flight client submit - the action it targets + the `FormData` being sent. Set while the
31
86
  * submit is pending, cleared when it settles. A component reads `submission.formData` to render an
32
87
  * **optimistic** view (the expected result) before the server responds. */
33
88
  export interface Submission {
@@ -41,6 +96,9 @@ export interface RouterState {
41
96
  /** The current URL path (used to revalidate the active loader after an action). */
42
97
  readonly path: string;
43
98
  readonly data: unknown;
99
+ /** Per-layout loader data, aligned with the matched chain's leading layout prefix. Absent when no
100
+ * layout in that chain has a loader. */
101
+ readonly layoutData?: readonly unknown[] | undefined;
44
102
  /** An action's data return after a client-side submit (cleared on navigation). */
45
103
  readonly actionData?: unknown;
46
104
  /** True while a navigation or submit is in flight (drives loading UI). */
@@ -48,10 +106,10 @@ export interface RouterState {
48
106
  /** The path a navigation is transitioning TO while `pending` (cleared when it settles). Lets a
49
107
  * `NavLink` know whether its own `to` is the one loading; `undefined` when idle. */
50
108
  readonly pendingPath?: string | undefined;
51
- /** The in-flight submit (set during a `submit`, cleared when it settles) — for optimistic UI. */
109
+ /** The in-flight submit (set during a `submit`, cleared when it settles) - for optimistic UI. */
52
110
  readonly submission?: Submission;
53
111
  }
54
- /** A route id paired with its nifra pattern (e.g. `":id"` segments) — the matcher input. */
112
+ /** A route id paired with its nifra pattern (e.g. `":id"` segments) - the matcher input. */
55
113
  export interface RoutePattern {
56
114
  readonly routeId: string;
57
115
  readonly pattern: string;
@@ -64,14 +122,17 @@ export interface RoutePattern {
64
122
  export declare function createMatcher(patterns: readonly RoutePattern[]): (path: string) => RouteMatch | null;
65
123
  /** How a router fetches a route's loader data on navigation. `signal` aborts a superseded fetch
66
124
  * (and its deferred stream). */
67
- export type FetchRouteData = (path: string, match: RouteMatch, signal?: AbortSignal) => Promise<unknown>;
125
+ export type FetchRouteData = (path: string, match: RouteMatch, signal?: AbortSignal, navigation?: {
126
+ readonly from: string;
127
+ readonly retain: readonly number[];
128
+ }) => Promise<unknown>;
68
129
  /** Per-submit options. `revalidate: false` opts out of the post-action loader re-fetch. */
69
130
  export interface SubmitOptions {
70
131
  /** Re-run the active route's loader after the action settles (default `true`). Set `false` to
71
132
  * keep the current `data` and rely on the action's `actionData` alone. */
72
133
  readonly revalidate?: boolean;
73
134
  }
74
- /** A fetcher's observable state — independent of the main router. `pending` covers its in-flight
135
+ /** A fetcher's observable state - independent of the main router. `pending` covers its in-flight
75
136
  * load/submit; `data` is its last `load()` result; `actionData` its last `submit()` result;
76
137
  * `submission` the in-flight submit (for optimistic UI). Client-only (never SSR'd). */
77
138
  export interface FetcherState {
@@ -82,7 +143,7 @@ export interface FetcherState {
82
143
  }
83
144
  /**
84
145
  * An independent load/submit state machine, retrieved by `router.fetcher(key)`. Runs **concurrently**
85
- * with the main router and with other fetchers — each is single-flight against *itself* (its own
146
+ * with the main router and with other fetchers - each is single-flight against *itself* (its own
86
147
  * monotonic token), so N row-level mutations / side-channel loads can be in flight at once without
87
148
  * disturbing the active view. Loads/submits write the shared cache and honor `X-Nifra-Revalidate`.
88
149
  */
@@ -96,7 +157,7 @@ export interface Fetcher {
96
157
  load: (path: string) => Promise<void>;
97
158
  /** Submit an action into this fetcher's own state; honors `X-Nifra-Revalidate` by refreshing the
98
159
  * active route + any mounted fetcher showing a changed path. Rejects on failure (caller falls back).
99
- * (No `revalidate` opt-out — a fetcher has no active loader of its own to skip.) */
160
+ * (No `revalidate` opt-out - a fetcher has no active loader of its own to skip.) */
100
161
  submit: (action: string, body: NonNullable<RequestInit["body"]>) => Promise<void>;
101
162
  }
102
163
  /** The agnostic router store consumed by per-adapter Router bindings. */
@@ -111,7 +172,7 @@ export interface ClientRouter {
111
172
  * Submit an action (POST `body` to `action` in data mode): a redirect becomes a client
112
173
  * navigation; otherwise the data return is published as `actionData` and the active route's
113
174
  * loader is revalidated so the mutation is reflected. Pass `{ revalidate: false }` to SKIP that
114
- * revalidation — keep the current `data` and just publish the action's `actionData` (useful when
175
+ * revalidation - keep the current `data` and just publish the action's `actionData` (useful when
115
176
  * the action already returned everything that changed, saving the extra round-trip). A redirect
116
177
  * always loads its target regardless. Rejects on failure (caller falls back).
117
178
  */
@@ -119,28 +180,28 @@ export interface ClientRouter {
119
180
  /**
120
181
  * Mark cached route data stale and refresh the active view. With `paths`, target exactly those
121
182
  * (e.g. the routes a mutation changed); without, invalidate the whole cache. The active route
122
- * refreshes immediately — refetched + republished — whenever it's in scope (an explicit list that
183
+ * refreshes immediately - refetched + republished - whenever it's in scope (an explicit list that
123
184
  * includes it, or an invalidate-all); other stale entries refetch lazily when next read (a
124
185
  * fetcher, or the next navigation/access). Rejects if the active refetch fails (like `navigate`).
125
186
  * The keyed substrate for targeted revalidation (the `X-Nifra-Revalidate` header) and fetchers.
126
187
  */
127
188
  invalidate: (paths?: readonly string[]) => Promise<void>;
128
189
  /**
129
- * Warm a path's chunk + loader data into a bounded one-shot cache without publishing state —
190
+ * Warm a path's chunk + loader data into a bounded one-shot cache without publishing state -
130
191
  * a later `navigate` to it transitions with no network round-trip. Best-effort: failures and
131
192
  * unmatched paths are no-ops. Wired to link hover/focus by `installHistory`.
132
193
  */
133
194
  prefetch: (path: string) => Promise<void>;
134
195
  /**
135
- * Get (lazily creating) the stable {@link Fetcher} for `key` — an independent, concurrent
196
+ * Get (lazily creating) the stable {@link Fetcher} for `key` - an independent, concurrent
136
197
  * load/submit state machine for row-level mutations or side-channel loads that must not disturb
137
198
  * the active view. The same `key` always returns the same fetcher (so a binding can subscribe to a
138
199
  * stable store). Keys are app-chosen and typically stable (e.g. a row id).
139
200
  */
140
201
  fetcher: (key: string) => Fetcher;
141
- /** All live fetchers — for a global busy view (e.g. a `useFetchers` binding). */
202
+ /** All live fetchers - for a global busy view (e.g. a `useFetchers` binding). */
142
203
  fetchers: () => readonly Fetcher[];
143
- /** Subscribe to any-fetcher-changed (a transition on any fetcher, or a new one created) — backs a
204
+ /** Subscribe to any-fetcher-changed (a transition on any fetcher, or a new one created) - backs a
144
205
  * `useFetchers` binding; returns an unsubscribe fn. */
145
206
  subscribeFetchers: (listener: () => void) => () => void;
146
207
  /** Match a path against the manifest patterns (exposed for history/link wiring). */
@@ -154,19 +215,30 @@ export interface ClientRouterOptions {
154
215
  /** Ensure a route's code chunk is loaded before rendering (code-splitting). Awaited in parallel
155
216
  * with the loader data, so `pending` covers both. Omit when the bundle isn't split. */
156
217
  readonly loadModule?: (routeId: string) => Promise<void>;
218
+ /** Terminal status → client route id. Generated entries populate this from `_404` and
219
+ * `_<status>` files so soft navigation renders the same boundary as a hard request. */
220
+ readonly statusRoutes?: Readonly<Record<number, string>>;
221
+ /** routeId → the route's client-only search keys (its `searchClientKeys` export). When a soft
222
+ * navigation stays on the same route + pathname and changes ONLY these keys, `navigate` publishes the
223
+ * new URL WITHOUT re-running the loader (re-render, not revalidate). Populated lazily by the generated
224
+ * entry's `loadModule` (so a route's keys are present once it has been visited, which is exactly when a
225
+ * same-route nav can consult them). Omit ⇒ every search change revalidates (the safe default). */
226
+ readonly searchClientKeys?: Readonly<Record<string, readonly string[]>>;
157
227
  }
158
228
  /** Options for a per-adapter `mountRouter` (the Router binding that hydrates + re-renders). */
159
229
  export interface MountRouterOptions {
160
230
  readonly router: ClientRouter;
161
231
  /** routeId → layout chain (outermost layout → page); built by `generateClientEntry`. */
162
232
  readonly routes: Record<string, readonly unknown[]>;
163
- /** Hydration container (opaque — the adapter casts it to its DOM element type). */
233
+ /** routeId → the route's search-schema CHAIN (its layout chain's `searchSchema` exports, outermost
234
+ * first, then the page's; each entry `undefined` when that module declares none); built by
235
+ * `generateClientEntry`. The mount derives each route's typed `search` from this chain plus the URL via
236
+ * `searchOfChain` (layout keys merged with page keys, page-wins), matching the server's
237
+ * `ctx.search`/`RenderProps.search`. Omitted by callers with no typed search (tests, a hand-built mount)
238
+ * ⇒ every route sees the raw parsed query. */
239
+ readonly searchSchemas?: Readonly<Record<string, readonly (StandardSchemaV1 | undefined)[]>>;
240
+ /** Hydration container (opaque - the adapter casts it to its DOM element type). */
164
241
  readonly container: unknown;
165
242
  }
166
- /**
167
- * Create the agnostic router store. `navigate` is guarded by a monotonic token so that when
168
- * navigations overlap, only the latest result is applied (rapid clicks don't flash stale data).
169
- * A failed fetch clears `pending` and rethrows so the caller can fall back to a full-page load.
170
- */
171
243
  export declare function createClientRouter(options: ClientRouterOptions): ClientRouter;
172
244
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,eAAO,MAAM,WAAW,iBAAiB,CAAA;AAEzC;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,0BAA0B,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,eAAe,qBAAqB,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,uBAAuB,CAAA;AAErD,uFAAuF;AACvF,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACxC;AAED;;2EAE2E;AAC3E,MAAM,WAAW,UAAU;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