foldkit-site 0.3.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -1
- package/dist/index.d.mts +54 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +48 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -91,7 +91,7 @@ without re-parsing anything.
|
|
|
91
91
|
**Nodes.** `Site.route(router, case, options?)` declares one location. Options
|
|
92
92
|
are `title` (a function of the route value), `section`, `landing` (the
|
|
93
93
|
section's nav address as this node's params), `shortcut` (the keys that go to
|
|
94
|
-
its landing, as Foldkit's key bindings name them: `'/'`, `['G', 'H']`), `history`, and `surface` (below). The node is frozen; keep the
|
|
94
|
+
its landing, as Foldkit's key bindings name them: `'/'`, `['G', 'H']`), `history`, `access` (who may be shown it: see Common workflows), and `surface` (below). The node is frozen; keep the
|
|
95
95
|
exported value and use it for targets and hrefs. To annotate in steps, or to
|
|
96
96
|
share an annotation bundle across nodes, build incrementally instead — the
|
|
97
97
|
options are sugar over this builder:
|
|
@@ -341,6 +341,32 @@ step — or hand both branches to `Site.routing` (with `pages` for the routed
|
|
|
341
341
|
placements) and keep only the guard in `update`. What each route *does* with
|
|
342
342
|
the change beyond informing its page is still the application's `update`.
|
|
343
343
|
|
|
344
|
+
**Who may be shown a page.** A route carries no authorization: the server
|
|
345
|
+
guards what a page reads, whatever the route says. What a route may decide is
|
|
346
|
+
presentation, sending a visitor to sign in rather than drawing an empty
|
|
347
|
+
page. `access` on a node says who may be shown it and the nodes below it,
|
|
348
|
+
from what the application knows of the reader (its `Me` row), and where
|
|
349
|
+
anyone else goes (from `access.test.ts`):
|
|
350
|
+
|
|
351
|
+
```ts
|
|
352
|
+
const Projects = Site.node(pipe(literal('projects'), mapTo(AppRoute.Projects)), AppRoute.Projects)
|
|
353
|
+
.access<Me>({ allow: me => me.signedIn, otherwise: toSignIn })
|
|
354
|
+
.node
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
`Site.accessOf(site, route, who)` decides it, root first: `Allowed`;
|
|
358
|
+
`Pending` while `who` is `Option.none()` (the reader's `Me` still loading),
|
|
359
|
+
for a loading state rather than a sign-in page flashed at someone signed in;
|
|
360
|
+
`Denied` with the URL to go to (`otherwise` gets the address asked for, so a
|
|
361
|
+
sign-in page can return to it). Read it with `Access.match`. The view draws
|
|
362
|
+
from it, `update` replaces the URL on `Denied` after a route change or when
|
|
363
|
+
`Me` arrives, and a server answers `Denied` with a 303 before rendering. An
|
|
364
|
+
`otherwise` whose target the same rule covers throws, at any address: a
|
|
365
|
+
sign-in page mounted under the rule it serves would otherwise send each
|
|
366
|
+
refused reader to a longer `returnTo` for ever. A rule given in a node's
|
|
367
|
+
options names the reader it reads (`allow: (me: Me) => …`); `accessOf`
|
|
368
|
+
cannot check that its `who` is that reader, so pass the one the rules read.
|
|
369
|
+
|
|
344
370
|
**Prefetch and SSR.** `Site.target` plus `Site.chainOf` say which Surfaces a
|
|
345
371
|
destination will activate; `Site.sourcesFor(site, owner, place, target.route)`
|
|
346
372
|
is those as Sources — `Data.satisfy` over them, with the route set to the
|
package/dist/index.d.mts
CHANGED
|
@@ -146,7 +146,37 @@ export interface SiteNode<Route extends {
|
|
|
146
146
|
* the nodes below it. Undeclared up the whole chain, a node is indexed.
|
|
147
147
|
*/
|
|
148
148
|
readonly indexed?: boolean | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Who may be shown this node and the nodes below it: see `Site.accessOf`.
|
|
151
|
+
* Held as `never` for its reader, so a rule given in the options must
|
|
152
|
+
* name the reader it reads (`allow: (me: Me) => …`).
|
|
153
|
+
*/
|
|
154
|
+
readonly access?: NodeAccess<never> | undefined;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Who may be shown a node, and where anyone else is sent. Presentation, not
|
|
158
|
+
* authorization: the server guards what the page reads whatever this says.
|
|
159
|
+
* `Who` is what the application knows of the reader (its `Me` row, say).
|
|
160
|
+
*/
|
|
161
|
+
export interface NodeAccess<Who> {
|
|
162
|
+
readonly allow: (who: Who) => boolean;
|
|
163
|
+
/** Where a reader `allow` refuses goes, given the address they asked for (a sign-in page returning to it). */
|
|
164
|
+
readonly otherwise: (requested: string) => SiteTarget<any>;
|
|
149
165
|
}
|
|
166
|
+
/**
|
|
167
|
+
* Whether the reader may be shown a route: `Allowed`; `Pending` while the
|
|
168
|
+
* application does not know who they are yet, to draw a loading state rather
|
|
169
|
+
* than flash the sign-in page at someone signed in; `Denied` with the address
|
|
170
|
+
* to send them to.
|
|
171
|
+
*/
|
|
172
|
+
export declare const Access: import("foldkit/schema").TaggedUnion<{
|
|
173
|
+
readonly Allowed: {};
|
|
174
|
+
readonly Pending: {};
|
|
175
|
+
readonly Denied: {
|
|
176
|
+
url: Schema.String;
|
|
177
|
+
};
|
|
178
|
+
}>;
|
|
179
|
+
export type Access = typeof Access.Type;
|
|
150
180
|
/** Carries the routes a mount or tree holds, in its type only: nothing sets it. */
|
|
151
181
|
declare const routes: unique symbol;
|
|
152
182
|
/** A node mounted with its children: structure, not state. `Route` is every route it holds. */
|
|
@@ -205,6 +235,8 @@ export interface NodeBuilder<Route extends {
|
|
|
205
235
|
meta<Model = any>(meta: NodeMeta<Route, Model>): NodeBuilder<Route>;
|
|
206
236
|
/** Whether search engines index this node and the nodes below it. */
|
|
207
237
|
indexed(indexed: boolean): NodeBuilder<Route>;
|
|
238
|
+
/** Who may be shown this node and the nodes below it, and where anyone else goes. */
|
|
239
|
+
access<Who>(access: NodeAccess<Who>): NodeBuilder<Route>;
|
|
208
240
|
/** The Surface this route activates. */
|
|
209
241
|
surface<SRoot, SModel, SMessage, SParams>(config: {
|
|
210
242
|
readonly surface: Surface<SRoot, SModel, SMessage, SParams>;
|
|
@@ -286,6 +318,7 @@ export declare const Site: {
|
|
|
286
318
|
readonly view?: NodeView | undefined;
|
|
287
319
|
readonly meta?: NodeMeta<Route> | undefined;
|
|
288
320
|
readonly indexed?: boolean | undefined;
|
|
321
|
+
readonly access?: NodeAccess<never> | undefined;
|
|
289
322
|
readonly surface?: {
|
|
290
323
|
readonly surface: Surface<SRoot, SModel, SMessage, SParams>;
|
|
291
324
|
readonly params: (route: Route) => SParams;
|
|
@@ -423,6 +456,27 @@ export declare const Site: {
|
|
|
423
456
|
indexedOf: (site: SiteTree, route: {
|
|
424
457
|
readonly _tag: string;
|
|
425
458
|
}) => boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Whether the reader may be shown a route: every `access` up its chain,
|
|
461
|
+
* root first, must allow `who`, and the first that refuses sends them to
|
|
462
|
+
* its `otherwise`, given the route's address. `who` is `Option.none()`
|
|
463
|
+
* while the application does not know yet (its `Me` loading): `Pending`
|
|
464
|
+
* wherever a rule would need it. A route no rule covers is `Allowed`.
|
|
465
|
+
*
|
|
466
|
+
* ```ts
|
|
467
|
+
* Access.match(Site.accessOf(AppSite, model.route, me), {
|
|
468
|
+
* Allowed: () => page,
|
|
469
|
+
* Pending: () => loading,
|
|
470
|
+
* Denied: ({ url }) => redirecting, // and `update` replaces the URL with `url`
|
|
471
|
+
* })
|
|
472
|
+
* ```
|
|
473
|
+
*
|
|
474
|
+
* A server answers `Denied` with a 303 to `url` before rendering. It is
|
|
475
|
+
* presentation: what the page reads is guarded on the server regardless.
|
|
476
|
+
*/
|
|
477
|
+
accessOf: <Route extends {
|
|
478
|
+
readonly _tag: string;
|
|
479
|
+
}, Who>(site: SiteTree<Route>, route: Route, who: Option.Option<Who>) => Access;
|
|
426
480
|
/**
|
|
427
481
|
* What a route says of itself in the head, for an SSR plan's `meta`:
|
|
428
482
|
*
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["SurfaceType","UrlValue"],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["SurfaceType","UrlValue"],"sources":["../src/index.ts"],"mappings":";;;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,SAAS,eAAe,OAAO,YAAY,qBAAqB,oBAEhF,mBAAiB,MAEX,SAAS,QAAM,QACb,OAAO,OACb,MACA,MACA,YACA,qBAEA,SACA,SACA,YACA,WACA,UACD;aAEU,MAAM,KAAK,QAAQ,aAAa,YAAY,cAAc;aAC1D,WAAW,OAAO,UAAU;MACnC,gBACF,MACA,QACA,aACA,4BAGA,WACA,QAAQ,QAAQ,YAEjB,SACD,QACA,aACA,UAAU,WACV,OACE,MACA,QACA,aACA,YACA,cACA,UAAU,WACV,SACA,YACA,WACA,SACA,OACA;aAA+B,YAAY;MAAuB"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect, Option, Predicate, Schema } from "effect";
|
|
2
2
|
import "foldkit-bundle";
|
|
3
3
|
import * as Command from "foldkit/command";
|
|
4
|
+
import { defineTaggedUnion } from "foldkit/schema";
|
|
4
5
|
import * as Navigation from "foldkit/navigation";
|
|
5
6
|
import { UrlRequest } from "foldkit/navigation";
|
|
6
7
|
import { oneOf, parseUrlWithFallback } from "foldkit/route";
|
|
@@ -30,6 +31,17 @@ import { Surface } from "foldkit-surface";
|
|
|
30
31
|
* hand-writing those two update branches.
|
|
31
32
|
*/
|
|
32
33
|
/**
|
|
34
|
+
* Whether the reader may be shown a route: `Allowed`; `Pending` while the
|
|
35
|
+
* application does not know who they are yet, to draw a loading state rather
|
|
36
|
+
* than flash the sign-in page at someone signed in; `Denied` with the address
|
|
37
|
+
* to send them to.
|
|
38
|
+
*/
|
|
39
|
+
const Access = defineTaggedUnion({
|
|
40
|
+
Allowed: {},
|
|
41
|
+
Pending: {},
|
|
42
|
+
Denied: { url: Schema.String }
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
33
45
|
* The tag a tagged constructor names, read the way `Surface.when` reads it
|
|
34
46
|
* off a route case. Anything else is a definition-time error, not a silent
|
|
35
47
|
* mismatch.
|
|
@@ -121,6 +133,7 @@ const Site = {
|
|
|
121
133
|
if (options?.view !== void 0) built = built.view(options.view);
|
|
122
134
|
if (options?.meta !== void 0) built = built.meta(options.meta);
|
|
123
135
|
if (options?.indexed !== void 0) built = built.indexed(options.indexed);
|
|
136
|
+
if (options?.access !== void 0) built = built.access(options.access);
|
|
124
137
|
if (options?.surface !== void 0) built = built.surface(options.surface);
|
|
125
138
|
return built.node;
|
|
126
139
|
},
|
|
@@ -183,6 +196,10 @@ const Site = {
|
|
|
183
196
|
...built,
|
|
184
197
|
indexed
|
|
185
198
|
})),
|
|
199
|
+
access: (access) => at(Object.freeze({
|
|
200
|
+
...built,
|
|
201
|
+
access
|
|
202
|
+
})),
|
|
186
203
|
surface: (config) => at(Object.freeze({
|
|
187
204
|
...built,
|
|
188
205
|
bound: config
|
|
@@ -351,6 +368,36 @@ const Site = {
|
|
|
351
368
|
return true;
|
|
352
369
|
},
|
|
353
370
|
/**
|
|
371
|
+
* Whether the reader may be shown a route: every `access` up its chain,
|
|
372
|
+
* root first, must allow `who`, and the first that refuses sends them to
|
|
373
|
+
* its `otherwise`, given the route's address. `who` is `Option.none()`
|
|
374
|
+
* while the application does not know yet (its `Me` loading): `Pending`
|
|
375
|
+
* wherever a rule would need it. A route no rule covers is `Allowed`.
|
|
376
|
+
*
|
|
377
|
+
* ```ts
|
|
378
|
+
* Access.match(Site.accessOf(AppSite, model.route, me), {
|
|
379
|
+
* Allowed: () => page,
|
|
380
|
+
* Pending: () => loading,
|
|
381
|
+
* Denied: ({ url }) => redirecting, // and `update` replaces the URL with `url`
|
|
382
|
+
* })
|
|
383
|
+
* ```
|
|
384
|
+
*
|
|
385
|
+
* A server answers `Denied` with a 303 to `url` before rendering. It is
|
|
386
|
+
* presentation: what the page reads is guarded on the server regardless.
|
|
387
|
+
*/
|
|
388
|
+
accessOf: (site, route, who) => {
|
|
389
|
+
for (const node of Site.chainOf(site, route)) {
|
|
390
|
+
const { access } = node;
|
|
391
|
+
if (access === void 0) continue;
|
|
392
|
+
if (Option.isNone(who)) return Access.Pending();
|
|
393
|
+
if (access.allow(who.value)) continue;
|
|
394
|
+
const target = access.otherwise(Site.hrefOf(site, route));
|
|
395
|
+
if (Site.chainOf(site, target.route).includes(node)) throw new Error(`foldkit-site: ${node.tag}'s access sends a refused reader to ${target.url}, which it also covers`);
|
|
396
|
+
return Access.Denied({ url: target.url });
|
|
397
|
+
}
|
|
398
|
+
return Access.Allowed();
|
|
399
|
+
},
|
|
400
|
+
/**
|
|
354
401
|
* What a route says of itself in the head, for an SSR plan's `meta`:
|
|
355
402
|
*
|
|
356
403
|
* ```ts
|
|
@@ -659,6 +706,6 @@ const Site = {
|
|
|
659
706
|
}
|
|
660
707
|
};
|
|
661
708
|
//#endregion
|
|
662
|
-
export { Site };
|
|
709
|
+
export { Access, Site };
|
|
663
710
|
|
|
664
711
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Url"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `foldkit-site` — the deployed route topology of a Foldkit application.\n *\n * A Site says where the application is: stable route nodes in a hierarchy,\n * each with its Foldkit Router, its metadata, and the Surfaces it activates.\n * Everything else — fetching, caching, rendering, navigation effects — stays\n * where it already is: the node compiles down to the primitives the runtime\n * already runs (`Route` biparsers, `Surface.when`, Bundle placements), so the\n * Site never becomes a second router, loader, or store.\n *\n * The rule, from the design:\n *\n * > Router says where the application is. Surface says what that state makes\n * > observable and capable. Remote says what server facts those observations\n * > require.\n *\n * Nothing here runs: nodes, mounts, trees, and targets are data. A `SiteTree`\n * is frozen at `Site.make`. `Site.routing` is the one runtime piece: the\n * link-click and URL-change lifecycle as a wiring, so applications stop\n * hand-writing those two update branches.\n */\nimport { Effect, Option, Predicate, Schema } from 'effect'\nimport {\n Bundle,\n Link,\n type AnyMessage,\n type Helper,\n type Placed,\n type PlacementConfig,\n type ResourceEntries,\n type SeedFor,\n} from 'foldkit-bundle'\nimport * as Command from 'foldkit/command'\nimport type { Html, HtmlBuilder } from 'foldkit/html'\nimport * as Navigation from 'foldkit/navigation'\nimport type { KeyBinding, KeySequence } from 'foldkit/dom'\nimport { UrlRequest } from 'foldkit/navigation'\nimport { oneOf, parseUrlWithFallback, type Router } from 'foldkit/route'\nimport type { Meta } from 'foldkit-ssr/client'\nimport * as Update from 'foldkit/update'\nimport * as Url from 'foldkit/url'\nimport type { Url as UrlValue } from 'foldkit/url'\nimport {\n Surface,\n type ActiveSurface,\n type Contract,\n type ModelPlace,\n type Surface as SurfaceType,\n type SurfaceSource,\n type Wiring,\n} from 'foldkit-surface'\n\n/** Whether moving to a target adds a history step (`push`) or replaces the current one. */\nexport type HistoryIntent = 'push' | 'replace'\n\n/**\n * A route-case constructor: the Schema for `Surface.when`, called to build\n * route values for targets. The `any` is deliberate and quarantined here:\n * every constructor of a `defineRouteUnion` case is callable with its fields,\n * and `Site.target` types the params from the route value instead.\n */\nexport interface RouteCase<Route extends { readonly _tag: string }> extends Schema.Schema<Route> {\n (params: any): Route\n}\n\n/**\n * A Surface a node activates, with the route's params made into its own: the\n * `Surface.when` a node lowers to, once the application says where its route\n * lives. The surface's own types are checked where the node is declared\n * (`Site.route` infers them); by the time sources resolve, only the owner\n * check can still fail, and it does, loudly.\n */\nexport interface BoundSurface {\n readonly surface: SurfaceType<any, any, any, any>\n readonly params: (route: any) => any\n}\n\n/**\n * A layout around everything under a node: it receives the composed child\n * explicitly — no Outlet, no context, no hidden route state. Ancestors with\n * layouts wrap the leaf's view root-first; ancestors without one pass\n * through. The `any` positions are deliberate and quarantined, as with\n * `BoundSurface`: annotate the function where it is declared and it checks\n * there.\n */\nexport interface NodeLayout {\n readonly render: (child: Html, model: any, h: any) => Html\n}\n\n/**\n * What a node draws for its own route: only the deepest node of the active\n * chain draws (its ancestors contribute layouts, never their views — a\n * person page shows no people list). Same `any` quarantine as `NodeLayout`.\n */\nexport interface NodeView {\n readonly render: (model: any, h: any) => Html\n}\n\n/**\n * What a node says of itself in the document's head, from its route value and\n * the Model (a post's excerpt is in the Model, not the route). The node keeps\n * it with the Model as `any`, quarantined as `NodeLayout`'s is: name the Model\n * where it is declared (`.meta<Model>(...)`) and it checks there.\n */\nexport type NodeMeta<Route, Model = any> = (page: {\n readonly route: Route\n readonly model: Model\n}) => Meta\n\n/**\n * The route's place in the Model, read and written. A field holding a tagged\n * union is a *union of* `FieldRef`s, one per case, which no single\n * `ModelRef<Root, Route>` accepts — so this is structural:\n *\n * ```ts\n * route: {\n * dependency: App.model.route.dependency,\n * get: (model) => model.route,\n * set: (model, route) => modifyFields(model, { route: () => route }),\n * },\n * ```\n */\nexport interface RouteField<Root, Route> {\n readonly dependency: readonly string[]\n readonly get: (root: Root) => Route\n readonly set: (root: Root, route: Route) => Root\n}\n\n/**\n * One routed page: its node, its Bundle placement, and how a route arrival\n * reaches the child. The placement drives both folds from one declaration —\n * `placed.update` for Messages, `placed.view` for drawing — and `inform`\n * tells the child when its route arrives, through its own Message. The\n * placement's full type rides along, so assemblies keep inferring services.\n */\nexport interface SitePage<Parent, ParentMessage, R, P> {\n readonly node: SiteNode<any>\n readonly placed: P\n /**\n * The child told of a route arrival: `None` for another node's route, for\n * a page with nothing to say, or when the child says nothing is needed.\n */\n readonly inform: (\n model: Parent,\n route: { readonly _tag: string },\n ) => Option.Option<Update.Return<Parent, ParentMessage, R>>\n}\n\n/**\n * One deployed location: its Router (which owns URL semantics), its route\n * case, and its metadata. A stable first-class value: mounting it in a tree\n * never mutates it, so the same node serves targets, hrefs, and inspection\n * wherever it is mounted.\n */\nexport interface SiteNode<Route extends { readonly _tag: string }> {\n readonly tag: string\n readonly router: Router<Route>\n readonly case: RouteCase<Route>\n /** The page's title for this route, once the route value is known. */\n readonly title?: ((route: Route) => string) | undefined\n /** The navigation section this route belongs to, for menus and breadcrumbs. */\n readonly section?: string | undefined\n /**\n * Where the section's nav item points: this node's params for its landing\n * address (a people list with no search, say). Nodes a section never lands\n * on — a person, a file — leave it absent; `Site.landing` reads the first\n * node of a section that declares one.\n */\n readonly landing?: Omit<Route, '_tag'> | undefined\n /**\n * The keys that go to this node's `landing`, as Foldkit's key bindings name\n * them: one press (`'/'`, `'Mod+K'`) or a sequence (`['G', 'H']`).\n * `Site.shortcuts` makes the bindings.\n */\n readonly shortcut?: KeySequence | undefined\n /**\n * Which history step a move within this node is: a string, or a function\n * for nodes where some param changes are entries of their own (another\n * person) and others are views of one entry (another search). A move to\n * another node — or from an unknown location — is always a step.\n */\n readonly history?: HistoryIntent | ((prev: Route, next: Route) => HistoryIntent) | undefined\n /** The Surface this route activates, if the node declares one. */\n readonly bound?: BoundSurface | undefined\n /** A layout wrapping everything under this node, if it declares one. */\n readonly layout?: NodeLayout | undefined\n /** What this node draws for its own route, if it draws anything. */\n readonly view?: NodeView | undefined\n /** What this node says of itself in the head; nodes below override it per field. */\n readonly meta?: NodeMeta<Route> | undefined\n /**\n * Whether search engines index this node and, unless they say otherwise,\n * the nodes below it. Undeclared up the whole chain, a node is indexed.\n */\n readonly indexed?: boolean | undefined\n}\n\n/** Carries the routes a mount or tree holds, in its type only: nothing sets it. */\ndeclare const routes: unique symbol\n\n/** A node mounted with its children: structure, not state. `Route` is every route it holds. */\nexport interface SiteMount<Route extends { readonly _tag: string } = any> {\n readonly node: SiteNode<any>\n readonly children: ReadonlyArray<SiteMount>\n readonly [routes]?: (route: Route) => void\n}\n\n/** The routes a bare node or a mount holds. */\nexport type RoutesOf<Mounted> =\n Mounted extends SiteNode<infer Route>\n ? Route\n : Mounted extends SiteMount<infer Route>\n ? Route\n : never\n\n/**\n * A node under construction, from `Site.node`: each method annotates and\n * returns the builder, so nodes compose in steps and annotation bundles are\n * ordinary values. Methods — not pipeable fragments — because each stage of\n * a pipe is a separate generic call and could not infer the route. Read\n * `.node` at any stage for the frozen node so far.\n */\nexport interface NodeBuilder<Route extends { readonly _tag: string }> {\n /** The node so far: frozen, usable for targets and hrefs at any stage. */\n readonly node: SiteNode<Route>\n /**\n * One named bundle through the builder, Effect-style: the bundle stays\n * generic over the builder it meets, so it instantiates to this node's\n * route with no annotation. Chain for more than one.\n *\n * ```ts\n * const inSection = <R extends { readonly _tag: string }>(b: NodeBuilder<R>) =>\n * b.section('People').shortcut(['G', 'P'])\n *\n * const Person = Site.node(personRouter, AppRoute.Person).pipe(inSection).node\n * ```\n *\n * Free `pipe(builder, bundle)` from `effect` composes the same way; this\n * method is the same spelling without the import.\n */\n pipe<A>(fn: (builder: NodeBuilder<Route>) => A): A\n /** The page's title for this route, once the route value is known. */\n title(title: (route: Route) => string): NodeBuilder<Route>\n /** The navigation section this route belongs to. */\n section(section: string): NodeBuilder<Route>\n /** Where the section's nav item points, as this node's params. */\n landing(landing: Omit<Route, '_tag'>): NodeBuilder<Route>\n /** The keys that go to this node's landing. */\n shortcut(shortcut: KeySequence): NodeBuilder<Route>\n /** Which history step a move within this node is. */\n history(\n history: HistoryIntent | ((prev: Route, next: Route) => HistoryIntent),\n ): NodeBuilder<Route>\n /** A layout wrapping everything under this node. */\n layout(layout: NodeLayout): NodeBuilder<Route>\n /** What this node draws for its own route. */\n view(view: NodeView): NodeBuilder<Route>\n /** What this node says of itself in the head, from its route and the Model. */\n meta<Model = any>(meta: NodeMeta<Route, Model>): NodeBuilder<Route>\n /** Whether search engines index this node and the nodes below it. */\n indexed(indexed: boolean): NodeBuilder<Route>\n /** The Surface this route activates. */\n surface<SRoot, SModel, SMessage, SParams>(config: {\n readonly surface: SurfaceType<SRoot, SModel, SMessage, SParams>\n readonly params: (route: Route) => SParams\n }): NodeBuilder<Route>\n}\n\n/**\n * The deployed topology: roots with everything mounted under them, frozen.\n * `Route` is the union of every node's route, so the tree parses an address\n * to it (`Site.parse`) and builds one back (`Site.hrefOf`).\n */\nexport interface SiteTree<Route extends { readonly _tag: string } = any> {\n readonly roots: ReadonlyArray<SiteMount>\n readonly [routes]?: (route: Route) => void\n}\n\n/** One address a node's `Site.paths` lists: the route's params, and when its content last changed. */\nexport interface SitePath<Route extends { readonly _tag: string }> {\n readonly params: Omit<Route, '_tag'>\n /** When what the page shows last changed, as ISO 8601 text, for a sitemap. */\n readonly modified?: string | undefined\n}\n\n/** A node's addresses, listed by an Effect the build runs: from `Site.paths`. */\nexport interface SitePaths<E, R> {\n readonly node: SiteNode<any>\n readonly list: Effect.Effect<ReadonlyArray<SitePath<any>>, E, R>\n}\n\n/** How a listing of `SitePaths` can fail: each one's error, and none for no paths. */\nexport type PathsError<Paths> = Paths extends SitePaths<infer E, any> ? E : never\n/** What a listing of `SitePaths` needs: each one's services, and none for no paths. */\nexport type PathsServices<Paths> = Paths extends SitePaths<any, infer R> ? R : never\n\n/** One address of the whole site, from `Site.targets`: a target, and when it last changed. */\nexport interface SiteListed<Route extends { readonly _tag: string }> extends SiteTarget<Route> {\n readonly modified?: string | undefined\n}\n\n/**\n * One typed destination: the node, the route value, and the URL, all from one\n * declaration. Links, prefetch, and route analysis share this instead of each\n * rebuilding it.\n */\nexport interface SiteTarget<Route extends { readonly _tag: string }> {\n readonly node: SiteNode<Route>\n readonly route: Route\n readonly url: string\n}\n\n/**\n * The tag a tagged constructor names, read the way `Surface.when` reads it\n * off a route case. Anything else is a definition-time error, not a silent\n * mismatch.\n */\nconst tagOfConstructor = (constructor: unknown, what: string): string => {\n const literal = (constructor as { fields?: { _tag?: { ast?: { literal?: unknown } } } }).fields\n ?._tag?.ast?.literal\n if (typeof literal !== 'string') throw new Error(`${what} must be a tagged constructor`)\n return literal\n}\n\ninterface SiteIndex {\n readonly parent: ReadonlyMap<SiteNode<any>, SiteNode<any> | undefined>\n readonly byTag: ReadonlyMap<string, SiteNode<any>>\n /** The route the first node in tree order reads at an address, or nothing. */\n readonly read: (url: UrlValue) => Option.Option<any>\n}\n\nconst indexes = new WeakMap<SiteTree, SiteIndex>()\n\n/** The parent and tag maps and the parser of a tree, computed once per tree value. */\nconst indexOf = (site: SiteTree): SiteIndex => {\n const known = indexes.get(site)\n if (known !== undefined) return known\n const parent = new Map<SiteNode<any>, SiteNode<any> | undefined>()\n const byTag = new Map<string, SiteNode<any>>()\n const visit = (mount: SiteMount, above: SiteNode<any> | undefined): void => {\n if (parent.has(mount.node))\n throw new Error(\n `Site.make: \"${mount.node.tag}\" is mounted twice; a node has one place in a tree`,\n )\n const knownTag = byTag.get(mount.node.tag)\n if (knownTag !== undefined && knownTag !== mount.node)\n throw new Error(\n `Site.make: two nodes share the tag \"${mount.node.tag}\"; one route case is one node`,\n )\n parent.set(mount.node, above)\n byTag.set(mount.node.tag, mount.node)\n for (const child of mount.children) visit(child, mount.node)\n }\n for (const root of site.roots) visit(root, undefined)\n // Foldkit's parser takes only a fallback, so no match falls back to `None`.\n const parser = parseUrlWithFallback<any, Option.Option<any>>(\n oneOf(...[...parent.keys()].map(node => node.router)),\n { make: () => Option.none() },\n )\n const read = (url: UrlValue): Option.Option<any> => {\n const parsed = parser(url)\n return Option.isOption(parsed) ? parsed : Option.some(parsed)\n }\n const index = { parent, byTag, read }\n indexes.set(site, index)\n return index\n}\n\n/** Whether a node's route has params beyond its tag, so its addresses must be listed. */\nconst takesParams = (node: SiteNode<any>): boolean =>\n Object.keys((node.case as { fields?: object }).fields ?? {}).some(field => field !== '_tag')\n\nconst asMount = (node: SiteNode<any> | SiteMount): SiteMount =>\n 'children' in node ? node : { node, children: [] }\n\n/** One surfaced node's `Surface.when` over the route place, or nothing surfaceless. */\nconst sourceOf = <Root>(\n node: SiteNode<any>,\n owner: object,\n place: ModelPlace<Root>,\n): [string, ActiveSurface<Root> & SurfaceSource<Root>] | undefined => {\n const bound = node.bound\n if (bound === undefined) return undefined\n if (bound.surface.owner !== owner)\n throw new Error(`Site: \"${bound.surface.name}\" belongs to another application than the site`)\n return [node.tag, Surface.when(bound.surface, place, node.case, bound.params)]\n}\n\n/** The fields a `Meta` gives, so one left `undefined` does not erase an ancestor's. */\nconst saidOf = (meta: Meta): Meta =>\n Object.fromEntries(Object.entries(meta).filter(([, value]) => value !== undefined))\n\nconst freezeMount = (mount: SiteMount): SiteMount =>\n Object.freeze({\n node: mount.node,\n children: Object.freeze(mount.children.map(freezeMount)),\n })\n\n/** A bare node: its tag from its route case, nothing annotated. */\nconst baseNode = <Route extends { readonly _tag: string }>(\n router: Router<Route>,\n routeCase: RouteCase<Route>,\n): SiteNode<Route> =>\n Object.freeze({\n tag: tagOfConstructor(routeCase, 'Site.route: expected a route case from defineRouteUnion'),\n router,\n case: routeCase,\n })\n\nexport const Site = {\n /**\n * One deployed location from its Foldkit Router and its route case:\n *\n * ```ts\n * const Person = Site.route(personRouter, AppRoute.Person, {\n * title: ({ personId }) => `Person ${personId} | Routing`,\n * section: 'People',\n * })\n * ```\n *\n * The router stays the whole URL story (parse and build); the case names\n * the tag and builds route values. Metadata is annotated once here, and\n * navigation, titles, and history derive from it. To share annotations\n * across nodes, or to build incrementally, use the `Site.node` builder\n * instead — these options are sugar over it.\n */\n route: <Route extends { readonly _tag: string }, SRoot, SModel, SMessage, SParams>(\n router: Router<Route>,\n routeCase: RouteCase<Route>,\n options?: {\n readonly title?: ((route: Route) => string) | undefined\n readonly section?: string | undefined\n readonly landing?: Omit<Route, '_tag'> | undefined\n readonly shortcut?: KeySequence | undefined\n readonly history?: HistoryIntent | ((prev: Route, next: Route) => HistoryIntent) | undefined\n readonly layout?: NodeLayout | undefined\n readonly view?: NodeView | undefined\n readonly meta?: NodeMeta<Route> | undefined\n readonly indexed?: boolean | undefined\n readonly surface?:\n | {\n readonly surface: SurfaceType<SRoot, SModel, SMessage, SParams>\n readonly params: (route: Route) => SParams\n }\n | undefined\n },\n ): SiteNode<Route> => {\n let built = Site.node(router, routeCase)\n if (options?.title !== undefined) built = built.title(options.title)\n if (options?.section !== undefined) built = built.section(options.section)\n if (options?.landing !== undefined) built = built.landing(options.landing)\n if (options?.shortcut !== undefined) built = built.shortcut(options.shortcut)\n if (options?.history !== undefined) built = built.history(options.history)\n if (options?.layout !== undefined) built = built.layout(options.layout)\n if (options?.view !== undefined) built = built.view(options.view)\n if (options?.meta !== undefined) built = built.meta(options.meta)\n if (options?.indexed !== undefined) built = built.indexed(options.indexed)\n if (options?.surface !== undefined)\n built = built.surface<SRoot, SModel, SMessage, SParams>(options.surface)\n return built.node\n },\n\n /**\n * One deployed location as an incremental builder, for nodes annotated in\n * steps or annotations shared across nodes:\n *\n * ```ts\n * const Person = Site.node(personRouter, AppRoute.Person)\n * .title(({ personId }) => `Person ${personId} | Routing`)\n * .section('People')\n * .node\n * ```\n *\n * Methods — not pipeable fragments — because a pipeable fragment cannot\n * infer the route: each stage is a separate generic call, so its type\n * parameter falls back to the constraint and a typed callback no longer\n * matches. A method already knows its node's route, so inline lambdas\n * infer with no annotation. Read `.node` at any stage: every step freezes,\n * so intermediates are usable nodes too (targets, hrefs), never drafts.\n * `Site.route`'s options are sugar over this builder — one implementation.\n */\n node: <Route extends { readonly _tag: string }>(\n router: Router<Route>,\n routeCase: RouteCase<Route>,\n ): NodeBuilder<Route> => {\n const at = (built: SiteNode<Route>): NodeBuilder<Route> => ({\n node: built,\n pipe: <A>(fn: (builder: NodeBuilder<Route>) => A): A => fn(at(built)),\n title: title => at(Object.freeze({ ...built, title })),\n section: section => at(Object.freeze({ ...built, section })),\n landing: landing => at(Object.freeze({ ...built, landing })),\n shortcut: shortcut => at(Object.freeze({ ...built, shortcut })),\n history: history => at(Object.freeze({ ...built, history })),\n layout: layout => at(Object.freeze({ ...built, layout })),\n view: view => at(Object.freeze({ ...built, view })),\n meta: meta => at(Object.freeze({ ...built, meta })),\n indexed: indexed => at(Object.freeze({ ...built, indexed })),\n surface: config => at(Object.freeze({ ...built, bound: config as BoundSurface })),\n })\n return at(baseNode(router, routeCase))\n },\n\n /**\n * A node with its children. Returns a mount; the node itself is untouched,\n * so it stays usable bare for targets and hrefs. Children may be bare\n * nodes (childless) or mounts.\n */\n mount: <\n Route extends { readonly _tag: string },\n const Children extends ReadonlyArray<SiteNode<any> | SiteMount> = [],\n >(\n node: SiteNode<Route>,\n children?: Children,\n ): SiteMount<Route | RoutesOf<Children[number]>> =>\n Object.freeze({ node, children: Object.freeze((children ?? []).map(asMount)) }),\n\n /**\n * The deployed topology from its roots: bare nodes or mounts, frozen.\n * Refuses two nodes sharing a tag and one node mounted twice, since both\n * would make chain inspection ambiguous.\n */\n make: <const Roots extends ReadonlyArray<SiteNode<any> | SiteMount>>(\n ...roots: Roots\n ): SiteTree<RoutesOf<Roots[number]>> => {\n const tree: SiteTree<RoutesOf<Roots[number]>> = Object.freeze({\n roots: Object.freeze(roots.map(asMount).map(freezeMount)),\n })\n // Fail at definition time, not at the first inspection.\n indexOf(tree)\n return tree\n },\n\n /**\n * One typed destination: the route value and the URL from the node's own\n * declaration, so a link can never point where the parser would not go.\n */\n target: <Route extends { readonly _tag: string }>(\n node: SiteNode<Route>,\n params: Omit<Route, '_tag'>,\n ): SiteTarget<Route> => ({\n node,\n route: node.case(params),\n url: node.router.build(params),\n }),\n\n /** The URL of a target, or of a node with params directly. */\n href: (<Route extends { readonly _tag: string }>(\n targetOrNode: SiteTarget<Route> | SiteNode<Route>,\n params?: Omit<Route, '_tag'>,\n ): string => {\n if ('url' in targetOrNode) return targetOrNode.url\n if (params === undefined)\n throw new Error(`Site.href: \"${targetOrNode.tag}\" needs params to build its URL`)\n return Site.target(targetOrNode, params).url\n }) as {\n <Route extends { readonly _tag: string }>(target: SiteTarget<Route>): string\n <Route extends { readonly _tag: string }>(\n node: SiteNode<Route>,\n params: Omit<Route, '_tag'>,\n ): string\n },\n\n /**\n * The tree's parser: an address to the route of the first node, in tree\n * order (depth-first, parents first), whose router takes all of it, or the\n * fallback. A router that takes any segment (`/:slug`) belongs after the\n * nodes whose literal it would take too. With `Site.hrefOf`, the tree is\n * the one declaration of both directions.\n */\n parse: <Route extends { readonly _tag: string }, Fallback>(\n site: SiteTree<Route>,\n fallback: { readonly make: (data: { readonly path: string }) => Fallback },\n ): ((url: UrlValue) => Route | Fallback) => {\n const { read } = indexOf(site)\n return (url): Route | Fallback =>\n Option.getOrElse(read(url), () => fallback.make({ path: url.pathname }))\n },\n\n /**\n * The route the tree reads at an address, as `Site.parse` does, or nothing\n * when no node takes it: an address the tree does not hold is another\n * document's, which a link reaches with a full load.\n */\n routeAt: <Route extends { readonly _tag: string }>(\n site: SiteTree<Route>,\n url: UrlValue,\n ): Option.Option<Route> => indexOf(site).read(url),\n\n /**\n * The address of a route the tree holds, built by its node's router, so it\n * parses back to the same route (`Site.parse`).\n */\n hrefOf: <Route extends { readonly _tag: string }>(\n site: SiteTree<Route>,\n route: Route,\n ): string => {\n const node = indexOf(site).byTag.get(route._tag)\n if (node === undefined) throw new Error(`Site.hrefOf: no node holds the tag \"${route._tag}\"`)\n const { _tag, ...params } = route\n return node.router.build(params)\n },\n\n /**\n * A node's addresses, from data: every published post is one. `list` is an\n * Effect the build runs, such as a Remote query read through\n * `Data.satisfy`, so it lists what a visitor may see.\n *\n * ```ts\n * const posts = Site.paths(PostNode, listPosts.pipe(\n * Effect.map(rows => rows.map(row => ({ params: { slug: row.slug }, modified: row.at }))),\n * ))\n * ```\n */\n paths: <Route extends { readonly _tag: string }, E, R>(\n node: SiteNode<Route>,\n list: Effect.Effect<ReadonlyArray<SitePath<Route>>, E, R>,\n ): SitePaths<E, R> => ({ node, list }),\n\n /**\n * Every address of the site, in tree order: one for each node whose route\n * has no params, and what `paths` lists for each node whose route has\n * them. What a build renders, a sitemap lists (with `Site.indexedOf`), and\n * a prefetch warms. A node with params and no `paths` is refused, as are\n * `paths` for a node the tree does not hold or twice for one node, so no\n * page is left out unsaid; `Site.paths(node, Effect.succeed([]))` lists none.\n */\n targets: <const Paths extends ReadonlyArray<SitePaths<any, any>>>(\n site: SiteTree,\n paths: Paths,\n ): Effect.Effect<\n ReadonlyArray<SiteListed<any>>,\n PathsError<Paths[number]>,\n PathsServices<Paths[number]>\n > => {\n const nodes = Site.nodesOf(site)\n const listed = new Map<SiteNode<any>, SitePaths<any, any>>()\n for (const each of paths) {\n if (!nodes.includes(each.node))\n throw new Error(`Site.targets: \"${each.node.tag}\" has paths but is not in the tree`)\n if (listed.has(each.node)) throw new Error(`Site.targets: \"${each.node.tag}\" has paths twice`)\n listed.set(each.node, each)\n }\n const unlisted = nodes.filter(node => takesParams(node) && !listed.has(node))\n if (unlisted.length > 0)\n throw new Error(\n `Site.targets: ${unlisted.map(node => `\"${node.tag}\"`).join(', ')} take params and have no paths`,\n )\n return Effect.map(\n Effect.forEach(\n nodes,\n node => {\n const source = listed.get(node)\n if (source === undefined) return Effect.succeed([Site.target(node, {})])\n return Effect.map(source.list, found =>\n found.map(({ params, modified }) => ({\n ...Site.target(node, params),\n ...(modified === undefined ? {} : { modified }),\n })),\n )\n },\n { concurrency: 'unbounded' },\n ),\n perNode => perNode.flat(),\n )\n },\n\n /** Every node in the tree, depth-first, parents before children. */\n nodesOf: (site: SiteTree): ReadonlyArray<SiteNode<any>> => {\n const out: Array<SiteNode<any>> = []\n const visit = (mount: SiteMount): void => {\n out.push(mount.node)\n for (const child of mount.children) visit(child)\n }\n for (const root of site.roots) visit(root)\n return out\n },\n\n /** The node a route value is on, or nothing for a tag the tree does not hold. */\n nodeOf: (site: SiteTree, route: { readonly _tag: string }): SiteNode<any> | undefined =>\n indexOf(site).byTag.get(route._tag),\n\n /** The chain a route value is on, root first; none for an unknown tag. */\n chainOf: (site: SiteTree, route: { readonly _tag: string }): ReadonlyArray<SiteNode<any>> => {\n const { parent, byTag } = indexOf(site)\n const node = byTag.get(route._tag)\n if (node === undefined) return []\n const chain: Array<SiteNode<any>> = [node]\n let above = parent.get(node)\n while (above !== undefined) {\n chain.unshift(above)\n above = parent.get(above)\n }\n return chain\n },\n\n /** The node above this one in the tree, or nothing at a root. */\n parentOf: (site: SiteTree, node: SiteNode<any>): SiteNode<any> | undefined =>\n indexOf(site).parent.get(node),\n\n /** Every node above this one, root first. */\n ancestorsOf: (site: SiteTree, node: SiteNode<any>): ReadonlyArray<SiteNode<any>> => {\n const { parent } = indexOf(site)\n const out: Array<SiteNode<any>> = []\n let above = parent.get(node)\n while (above !== undefined) {\n out.unshift(above)\n above = parent.get(above)\n }\n return out\n },\n\n /** How deep the node sits: a root is 0, its children 1. */\n depthOf: (site: SiteTree, node: SiteNode<any>): number => Site.ancestorsOf(site, node).length,\n\n /** The title the tree annotates for a route value, or nothing. */\n titleOf: (site: SiteTree, route: { readonly _tag: string }): string | undefined => {\n const node = indexOf(site).byTag.get(route._tag)\n return node?.title?.(route)\n },\n\n /**\n * Whether search engines index a route: the nearest declaration up its\n * chain, so a `noindex` studio covers every node below it. A route the tree\n * does not hold is indexed, as a page with no declaration is.\n */\n indexedOf: (site: SiteTree, route: { readonly _tag: string }): boolean => {\n const chain = Site.chainOf(site, route)\n for (let at = chain.length - 1; at >= 0; at--) {\n const indexed = chain[at]!.indexed\n if (indexed !== undefined) return indexed\n }\n return true\n },\n\n /**\n * What a route says of itself in the head, for an SSR plan's `meta`:\n *\n * ```ts\n * SSR.plan(App, { id: 'site', state, meta: model => Site.metaOf(AppSite, model.route, model) })\n * ```\n *\n * Each node of the chain's `meta`, root first, with a deeper node's field\n * replacing its ancestor's and a field it leaves out keeping the ancestor's.\n * The preview title falls back to the route's `title`. An unindexed route\n * (`Site.indexedOf`) is `noindex` whatever its `meta` says.\n */\n metaOf: <Root>(site: SiteTree, route: { readonly _tag: string }, model: Root): Meta => {\n let meta: Meta = {}\n for (const node of Site.chainOf(site, route))\n if (node.meta !== undefined) meta = { ...meta, ...saidOf(node.meta({ route, model })) }\n const title = meta.title ?? Site.titleOf(site, route)\n return {\n ...meta,\n ...(title === undefined ? {} : { title }),\n ...(Site.indexedOf(site, route) ? {} : { robots: 'noindex' }),\n }\n },\n\n /** The navigation section the tree annotates for a route value, or nothing. */\n sectionOf: (site: SiteTree, route: { readonly _tag: string }): string | undefined =>\n indexOf(site).byTag.get(route._tag)?.section,\n\n /**\n * Where a section's nav item points: the first node of the section with a\n * landing, as a target. Nothing when no node of the section declares one —\n * every section shown needs a landing, so navigation asserts it.\n */\n landing: (site: SiteTree, section: string): SiteTarget<any> | undefined => {\n for (const candidate of Site.nodesOf(site)) {\n if (candidate.section !== section) continue\n const landing = candidate.landing\n if (landing === undefined) continue\n return Site.target(candidate, landing)\n }\n return undefined\n },\n\n /**\n * The tree's shortcuts as key bindings, each sending the Message\n * `toMessage` makes of its node's landing:\n *\n * ```ts\n * Dom.streamFromKeyBindings({\n * bindings: Site.shortcuts(AppSite, target => Message.PressedShortcut({ url: target.url })),\n * })\n * ```\n *\n * A shortcut on a node with no `landing` goes nowhere, and one used twice\n * goes to two places; both are refused.\n */\n shortcuts: <Message>(\n site: SiteTree,\n toMessage: (target: SiteTarget<any>) => Message,\n ): ReadonlyArray<KeyBinding<Message>> => {\n const taken = new Map<string, string>()\n return Site.nodesOf(site).flatMap((node): ReadonlyArray<KeyBinding<Message>> => {\n const keys = node.shortcut\n if (keys === undefined) return []\n if (node.landing === undefined)\n throw new Error(`Site.shortcuts: \"${node.tag}\" has a shortcut and no landing to go to`)\n const named = typeof keys === 'string' ? keys : keys.join(' ')\n const other = taken.get(named)\n if (other !== undefined)\n throw new Error(`Site.shortcuts: \"${named}\" goes to both \"${other}\" and \"${node.tag}\"`)\n taken.set(named, node.tag)\n const message = toMessage(Site.target(node, node.landing))\n const mapEvent = () => message\n // The binding's two shapes are told apart by `keys`, so each is made whole.\n return [typeof keys === 'string' ? { keys, mapEvent } : { keys, mapEvent }]\n })\n },\n\n /**\n * Which history step a move is: to another node, a step; within a node, its\n * declaration (a string, or a function for nodes where some param changes\n * are entries of their own); with no previous target — the current location\n * is unknown to the site — a step too, so Back can still return to it.\n */\n historyOf: (prev: SiteTarget<any> | undefined, next: SiteTarget<any>): HistoryIntent => {\n if (prev === undefined || prev.node !== next.node) return 'push'\n const rule = next.node.history ?? 'replace'\n return typeof rule === 'function' ? rule(prev.route, next.route) : rule\n },\n\n /**\n * What the route draws: the deepest node's view, wrapped by every\n * ancestor's layout root-first. Ancestors contribute layouts only — never\n * their views. Pure function composition over ordinary Foldkit rendering;\n * unknown tags and viewless leaves fail loudly, since rendering one would\n * guess.\n */\n view: <Root, Message>(\n site: SiteTree,\n route: { readonly _tag: string },\n model: Root,\n h: HtmlBuilder<Message>,\n ): Html => {\n const chain = Site.chainOf(site, route)\n if (chain.length === 0) throw new Error(`Site.view: no node holds the tag \"${route._tag}\"`)\n // A lookup, so the non-null assertion is the documented one.\n const leaf = chain[chain.length - 1]!\n if (leaf.view === undefined)\n throw new Error(`Site.view: \"${leaf.tag}\" draws nothing; give the leaf a view`)\n let child = leaf.view.render(model, h)\n for (let at = chain.length - 2; at >= 0; at--) {\n const layout = chain[at]!.layout\n if (layout !== undefined) child = layout.render(child, model, h)\n }\n return child\n },\n\n /**\n * What the tree's surfaced nodes activate, keyed by tag, for `Data.wiring`,\n * `Data.subscriptions`, `Data.satisfy`, or an SSR plan's `surfaces`: each\n * node's `Surface.when` over the application's route place. A surface from\n * another application is refused here, not at its reads.\n */\n sources: <Root>(\n site: SiteTree,\n owner: object,\n place: ModelPlace<Root>,\n ): Record<string, ActiveSurface<Root> & SurfaceSource<Root>> => {\n const out: Record<string, ActiveSurface<Root> & SurfaceSource<Root>> = {}\n for (const node of Site.nodesOf(site)) {\n const entry = sourceOf(node, owner, place)\n if (entry !== undefined) out[entry[0]] = entry[1]\n }\n return out\n },\n\n /**\n * The route-level Sources for one destination: the same entries as\n * `Site.sources`, but only the target's chain. Prefetch, SSR, and DevTools\n * read what a route will activate without building its Model first; the\n * preparation itself stays caller-composed (`Data.satisfy` over these, with\n * the route set to the target's). A tag the tree does not hold resolves to\n * no Sources, the way an inactive Surface resolves to nothing.\n *\n * ```ts\n * const active = Site.sourcesFor(AppSite, App.owner, App.model.route, target.route)\n * const prepared = yield* Data.satisfy({ ...model, route: target.route }, active)\n * ```\n *\n * There is deliberately no `SitePlan` object: the chain is already\n * `Site.chainOf`, and the head is `Site.metaOf`.\n */\n sourcesFor: <Root>(\n site: SiteTree,\n owner: object,\n place: ModelPlace<Root>,\n route: { readonly _tag: string },\n ): Record<string, ActiveSurface<Root> & SurfaceSource<Root>> => {\n const out: Record<string, ActiveSurface<Root> & SurfaceSource<Root>> = {}\n for (const node of Site.chainOf(site, route)) {\n const entry = sourceOf(node, owner, place)\n if (entry !== undefined) out[entry[0]] = entry[1]\n }\n return out\n },\n\n /**\n * The application's link-click and URL-change lifecycle as one wiring, so\n * `update` stops hand-writing those two branches. A click on a link the\n * tree holds navigates (pushing or replacing per `Site.historyOf`); on any\n * other, on this origin or not, it loads, since another document serves\n * it (`Site.routeAt`); a URL change sets the route field — or touches\n * nothing when the address parses to the route already shown, so an echo\n * of our own write never re-renders or clears pending state. The\n * application's own update answers nothing for either message; `reduces`\n * names them for its guard, the way `Remote.reduces` does.\n *\n * ```ts\n * const Routing = Site.routing<Model, Message, AppRoute>({\n * site: AppSite,\n * owner: App.owner,\n * route: {\n * dependency: App.model.route.dependency,\n * get: (model) => model.route,\n * set: (model, route) => modifyFields(model, { route: () => route }),\n * },\n * parse: urlToAppRoute,\n * tags: { clicked: 'ClickedLink', changed: 'ChangedUrl' },\n * completed: Message.CompletedNavigation,\n * })\n * const assembly = Bundle.assemble([Routing, ...pages])\n * const update = assembly.update((model, message) =>\n * Routing.reduces(message) ? { model } : updateOwn(model, message),\n * )\n * ```\n *\n * One routing per application: it claims the click tag and shares the\n * change tag with URL mirrors, which read their slices first. With `pages`,\n * a route change sets the field and then informs each page whose route\n * arrived, through the page's own `changed` Message.\n */\n routing: <\n Root,\n Message extends { readonly _tag: string },\n Route extends { readonly _tag: string },\n R = never,\n >(config: {\n readonly site: SiteTree\n /**\n * The application's identity token, for the Module contract. Raw Foldkit\n * applications have none; omit it and the contract claims no owner.\n */\n readonly owner?: object | undefined\n /** The route field, read and written (a `RouteField`, struct). */\n readonly route: RouteField<Root, Route>\n /** The application's URL parser, with its NotFound fallback. */\n readonly parse: (url: UrlValue) => Route\n /** The application's own link-click and URL-change tags. */\n readonly tags: { readonly clicked: string; readonly changed: string }\n /** One completion for the navigation commands to dispatch. */\n readonly completed: Schema.Schema<Message> & (() => Message)\n /**\n * Routed pages, informed when their route arrives. With service-needing\n * pages, name the services fourth:\n * `Site.routing<Model, Message, AppRoute, RemoteClient>`.\n */\n readonly pages?: ReadonlyArray<SitePage<Root, Message, R, any>> | undefined\n /**\n * What the application does once a new route is set and its pages are\n * told: moving focus to what it drew, say. An echo of the shown address\n * arrives nowhere, so it runs nothing.\n */\n readonly arrived?: ((model: Root, route: Route) => Update.Return<Root, Message, R>) | undefined\n }): Wiring<Root, Message, R> & {\n /** Whether the routing owns a message: its click or its URL change. */\n readonly reduces: (message: Message) => boolean\n } => {\n const completedTag = tagOfConstructor(\n config.completed,\n 'Site.routing: completed must be a message constructor',\n )\n const Navigate = Command.define('Site.Navigate', {\n args: { url: Schema.String, history: Schema.Literals(['push', 'replace']) },\n messages: [config.completed],\n execute: ({ url, history }) =>\n (history === 'push' ? Navigation.pushUrl(url) : Navigation.replaceUrl(url)).pipe(\n Effect.as(config.completed()),\n ),\n })\n const { arrived } = config\n const Load = Command.define('Site.Load', {\n args: { href: Schema.String },\n messages: [config.completed],\n execute: ({ href }) => Navigation.load(href).pipe(Effect.as(config.completed())),\n })\n // Route values are plain data from the same constructors, so equal\n // addresses compare equal. Checked before every write, so an echo of our\n // own navigation touches nothing: same Model back, no re-render.\n const sameRoute = (a: Route, b: Route): boolean => JSON.stringify(a) === JSON.stringify(b)\n const setRoute = (model: Root, next: Route): Root => {\n const current = config.route.get(model)\n return sameRoute(current, next) ? model : config.route.set(model, next)\n }\n const currentTarget = (model: Root): SiteTarget<Route> | undefined => {\n const current = config.route.get(model)\n const node = Site.nodeOf(config.site, current) as SiteNode<Route> | undefined\n if (node === undefined) return undefined\n // The tag rides along for matching only; params are everything else.\n const { _tag, ...params } = current\n return Site.target(node, params)\n }\n const reduces = (message: Message): boolean =>\n // tag-check: open — the tags are the application's own variants, named in config\n message._tag === config.tags.clicked || message._tag === config.tags.changed\n const wiring: Wiring<Root, Message, R> = {\n key: 'site',\n handles: [config.tags.clicked, config.tags.changed],\n shared: [config.tags.changed],\n route: (model, message) => {\n // tag-check: open — same ownership as reduces\n if (message._tag === config.tags.clicked) {\n const request = (message as unknown as { readonly request: UrlRequest }).request\n return Option.some(\n UrlRequest.match(request, {\n Internal: ({ url }) =>\n Option.match(Site.routeAt(config.site, url), {\n // No node takes it, so another document serves it.\n onNone: () => ({ model, commands: [Load({ href: Url.toString(url) })] }),\n onSome: next => {\n // A lookup: the route came from one of the tree's nodes.\n const node = Site.nodeOf(config.site, next)!\n const history = Site.historyOf(currentTarget(model), {\n node,\n route: next,\n url: Url.toString(url),\n })\n return {\n model,\n commands: [Navigate({ url: Url.toString(url), history })],\n }\n },\n }),\n External: ({ href }) => ({ model, commands: [Load({ href })] }),\n }),\n )\n }\n // tag-check: open — same ownership as reduces\n if (message._tag === config.tags.changed) {\n const url = (message as unknown as { readonly url: UrlValue }).url\n const next = config.parse(url)\n // An echo of the shown address touches nothing: same Model back,\n // and no page is informed of a route it already has.\n if (sameRoute(config.route.get(model), next)) return Option.some({ model })\n const steps: Array<Update.Step<Root, Message, R>> = [\n model => ({ model: setRoute(model, next) }),\n ...(config.pages ?? []).map(\n page => (model: Root) =>\n Option.getOrElse(page.inform(model, next), () => ({ model })),\n ),\n ...(arrived === undefined ? [] : [(model: Root) => arrived(model, next)]),\n ]\n return Option.some(Update.combine(model, steps))\n }\n return Option.none()\n },\n onUrl: (model, url) => setRoute(model, config.parse(url)),\n contract: {\n kind: 'site',\n name: 'site',\n owner: config.owner,\n owns: [],\n observes: [config.route.dependency],\n messages: [completedTag],\n metadata: [],\n } satisfies Contract,\n }\n return { ...wiring, reduces }\n },\n\n /**\n * One routed page stated once: its link (where its Model lives and how its\n * Messages wrap), what starts it, and what its route arrival tells it. The\n * link carries the field and the wrapper together; `placed.update` folds\n * the child's Messages and `placed.view` draws it, and `Site.routing`\n * informs it through `changed` when its route arrives.\n *\n * ```ts\n * const PeoplePage = Site.placement(People, PeopleBundle, {\n * link: Link.field<Model>()('peoplePage', Link.wrapper(Message.GotPeopleMessage)),\n * args: parent => ({\n * searchText: parent.route._tag === 'People' ? parent.route.searchText : Option.none(),\n * }),\n * changed: route => People.Message.ChangedRoute({ route }),\n * })\n * const assembly = Bundle.assemble([PeoplePage.placed, Routing])\n * ```\n *\n * `changed` receives the node's own case value and returns the child's\n * Message, or nothing when the arrival needs no answer. Without it the\n * page is never informed. Bundles with OutMessages, and children that are\n * not Bundles, stay on `Bundle.at` and `Link.child` directly.\n */\n placement: <\n Route extends { readonly _tag: string },\n Parent,\n LinkMessage extends AnyMessage,\n ChildModel,\n ChildMessage extends AnyMessage,\n Field extends string,\n Name extends string,\n Args,\n BundleR = never,\n BundleS = never,\n ViewInputs = void,\n Resources extends ResourceEntries<ChildModel, ChildMessage> = never,\n Helpers extends Readonly<Record<string, Helper<ChildModel, ChildMessage, never, BundleR>>> =\n never,\n ObserverR = never,\n >(\n node: SiteNode<Route>,\n bundle: Bundle.Bundle<\n Name,\n Args,\n ChildModel,\n ChildMessage,\n never,\n BundleR,\n BundleS,\n ViewInputs,\n Resources,\n Helpers\n >,\n config: {\n readonly link: Link<Parent, LinkMessage, ChildModel, ChildMessage, Field>\n readonly changed?: (route: Route) => ChildMessage | undefined\n } & PlacementConfig<\n Args,\n Parent,\n LinkMessage,\n ChildMessage,\n never,\n never,\n ObserverR,\n SeedFor<Parent, Field>\n >,\n ): SitePage<\n Parent,\n LinkMessage,\n BundleR | ObserverR,\n Placed<\n Name,\n Parent,\n LinkMessage,\n ChildModel,\n ChildMessage,\n BundleR | ObserverR,\n BundleS,\n ViewInputs,\n Resources,\n Helpers,\n Field,\n LinkMessage extends { readonly _tag: infer Tag extends string } ? Tag : string\n >\n > => {\n const { link, changed } = config\n // `link` and `changed` are this helper's own: `Bundle.at` reads its\n // known keys, and a non-literal tolerates the extra properties.\n const placed = bundle.at(link, config)\n return {\n node,\n placed,\n inform: (model, route) => {\n if (!Predicate.isTagged(route, node.tag) || changed === undefined) return Option.none()\n // Guarded by the tag the node was built from, which `Site.make`\n // keeps unique: this is the node's own case value.\n const child = changed(route as Route)\n if (child === undefined) return Option.none()\n return placed.update(model, link.toParentMessage(child))\n },\n }\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6TA,MAAM,oBAAoB,aAAsB,SAAyB;CACvE,MAAM,UAAW,YAAwE,QACrF,MAAM,KAAK;CACf,IAAI,OAAO,YAAY,UAAU,MAAM,IAAI,MAAM,GAAG,KAAK,8BAA8B;CACvF,OAAO;AACT;AASA,MAAM,0BAAU,IAAI,QAA6B;;AAGjD,MAAM,WAAW,SAA8B;CAC7C,MAAM,QAAQ,QAAQ,IAAI,IAAI;CAC9B,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,yBAAS,IAAI,IAA8C;CACjE,MAAM,wBAAQ,IAAI,IAA2B;CAC7C,MAAM,SAAS,OAAkB,UAA2C;EAC1E,IAAI,OAAO,IAAI,MAAM,IAAI,GACvB,MAAM,IAAI,MACR,eAAe,MAAM,KAAK,IAAI,mDAChC;EACF,MAAM,WAAW,MAAM,IAAI,MAAM,KAAK,GAAG;EACzC,IAAI,aAAa,KAAA,KAAa,aAAa,MAAM,MAC/C,MAAM,IAAI,MACR,uCAAuC,MAAM,KAAK,IAAI,8BACxD;EACF,OAAO,IAAI,MAAM,MAAM,KAAK;EAC5B,MAAM,IAAI,MAAM,KAAK,KAAK,MAAM,IAAI;EACpC,KAAK,MAAM,SAAS,MAAM,UAAU,MAAM,OAAO,MAAM,IAAI;CAC7D;CACA,KAAK,MAAM,QAAQ,KAAK,OAAO,MAAM,MAAM,KAAA,CAAS;CAEpD,MAAM,SAAS,qBACb,MAAM,GAAG,CAAC,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,KAAI,SAAQ,KAAK,MAAM,CAAC,GACpD,EAAE,YAAY,OAAO,KAAK,EAAE,CAC9B;CACA,MAAM,QAAQ,QAAsC;EAClD,MAAM,SAAS,OAAO,GAAG;EACzB,OAAO,OAAO,SAAS,MAAM,IAAI,SAAS,OAAO,KAA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,KAAK,EAAE,MAAM,CAAC;KAC1E,MAAM,QAA8C;OAClD,WAAU,EAAE,OAAO,SAAS,OAAO,IAAI,EAAE;MACzC,IAAI,OAAO,SAAS,CAAC,EAAA,CAAG,KACtB,UAAS,UACP,OAAO,UAAU,KAAK,OAAO,OAAO,IAAI,UAAU,EAAE,MAAM,EAAE,CAChE;MACA,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,UAAgB,QAAQ,OAAO,IAAI,CAAC;KACzE;KACA,OAAO,OAAO,KAAK,OAAO,QAAQ,OAAO,KAAK,CAAC;IACjD;IACA,OAAO,OAAO,KAAK;GACrB;GACA,QAAQ,OAAO,QAAQ,SAAS,OAAO,OAAO,MAAM,GAAG,CAAC;GACxD,UAAU;IACR,MAAM;IACN,MAAM;IACN,OAAO,OAAO;IACd,MAAM,CAAC;IACP,UAAU,CAAC,OAAO,MAAM,UAAU;IAClC,UAAU,CAAC,YAAY;IACvB,UAAU,CAAC;GACb;GAEkB;EAAQ;CAC9B;;;;;;;;;;;;;;;;;;;;;;;;CAyBA,YAiBE,MACA,QAYA,WA+BG;EACH,MAAM,EAAE,MAAM,YAAY;EAG1B,MAAM,SAAS,OAAO,GAAG,MAAM,MAAM;EACrC,OAAO;GACL;GACA;GACA,SAAS,OAAO,UAAU;IACxB,IAAI,CAAC,UAAU,SAAS,OAAO,KAAK,GAAG,KAAK,YAAY,KAAA,GAAW,OAAO,OAAO,KAAK;IAGtF,MAAM,QAAQ,QAAQ,KAAc;IACpC,IAAI,UAAU,KAAA,GAAW,OAAO,OAAO,KAAK;IAC5C,OAAO,OAAO,OAAO,OAAO,KAAK,gBAAgB,KAAK,CAAC;GACzD;EACF;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Url"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * `foldkit-site` — the deployed route topology of a Foldkit application.\n *\n * A Site says where the application is: stable route nodes in a hierarchy,\n * each with its Foldkit Router, its metadata, and the Surfaces it activates.\n * Everything else — fetching, caching, rendering, navigation effects — stays\n * where it already is: the node compiles down to the primitives the runtime\n * already runs (`Route` biparsers, `Surface.when`, Bundle placements), so the\n * Site never becomes a second router, loader, or store.\n *\n * The rule, from the design:\n *\n * > Router says where the application is. Surface says what that state makes\n * > observable and capable. Remote says what server facts those observations\n * > require.\n *\n * Nothing here runs: nodes, mounts, trees, and targets are data. A `SiteTree`\n * is frozen at `Site.make`. `Site.routing` is the one runtime piece: the\n * link-click and URL-change lifecycle as a wiring, so applications stop\n * hand-writing those two update branches.\n */\nimport { Effect, Option, Predicate, Schema } from 'effect'\nimport {\n Bundle,\n Link,\n type AnyMessage,\n type Helper,\n type Placed,\n type PlacementConfig,\n type ResourceEntries,\n type SeedFor,\n} from 'foldkit-bundle'\nimport * as Command from 'foldkit/command'\nimport { defineTaggedUnion } from 'foldkit/schema'\nimport type { Html, HtmlBuilder } from 'foldkit/html'\nimport * as Navigation from 'foldkit/navigation'\nimport type { KeyBinding, KeySequence } from 'foldkit/dom'\nimport { UrlRequest } from 'foldkit/navigation'\nimport { oneOf, parseUrlWithFallback, type Router } from 'foldkit/route'\nimport type { Meta } from 'foldkit-ssr/client'\nimport * as Update from 'foldkit/update'\nimport * as Url from 'foldkit/url'\nimport type { Url as UrlValue } from 'foldkit/url'\nimport {\n Surface,\n type ActiveSurface,\n type Contract,\n type ModelPlace,\n type Surface as SurfaceType,\n type SurfaceSource,\n type Wiring,\n} from 'foldkit-surface'\n\n/** Whether moving to a target adds a history step (`push`) or replaces the current one. */\nexport type HistoryIntent = 'push' | 'replace'\n\n/**\n * A route-case constructor: the Schema for `Surface.when`, called to build\n * route values for targets. The `any` is deliberate and quarantined here:\n * every constructor of a `defineRouteUnion` case is callable with its fields,\n * and `Site.target` types the params from the route value instead.\n */\nexport interface RouteCase<Route extends { readonly _tag: string }> extends Schema.Schema<Route> {\n (params: any): Route\n}\n\n/**\n * A Surface a node activates, with the route's params made into its own: the\n * `Surface.when` a node lowers to, once the application says where its route\n * lives. The surface's own types are checked where the node is declared\n * (`Site.route` infers them); by the time sources resolve, only the owner\n * check can still fail, and it does, loudly.\n */\nexport interface BoundSurface {\n readonly surface: SurfaceType<any, any, any, any>\n readonly params: (route: any) => any\n}\n\n/**\n * A layout around everything under a node: it receives the composed child\n * explicitly — no Outlet, no context, no hidden route state. Ancestors with\n * layouts wrap the leaf's view root-first; ancestors without one pass\n * through. The `any` positions are deliberate and quarantined, as with\n * `BoundSurface`: annotate the function where it is declared and it checks\n * there.\n */\nexport interface NodeLayout {\n readonly render: (child: Html, model: any, h: any) => Html\n}\n\n/**\n * What a node draws for its own route: only the deepest node of the active\n * chain draws (its ancestors contribute layouts, never their views — a\n * person page shows no people list). Same `any` quarantine as `NodeLayout`.\n */\nexport interface NodeView {\n readonly render: (model: any, h: any) => Html\n}\n\n/**\n * What a node says of itself in the document's head, from its route value and\n * the Model (a post's excerpt is in the Model, not the route). The node keeps\n * it with the Model as `any`, quarantined as `NodeLayout`'s is: name the Model\n * where it is declared (`.meta<Model>(...)`) and it checks there.\n */\nexport type NodeMeta<Route, Model = any> = (page: {\n readonly route: Route\n readonly model: Model\n}) => Meta\n\n/**\n * The route's place in the Model, read and written. A field holding a tagged\n * union is a *union of* `FieldRef`s, one per case, which no single\n * `ModelRef<Root, Route>` accepts — so this is structural:\n *\n * ```ts\n * route: {\n * dependency: App.model.route.dependency,\n * get: (model) => model.route,\n * set: (model, route) => modifyFields(model, { route: () => route }),\n * },\n * ```\n */\nexport interface RouteField<Root, Route> {\n readonly dependency: readonly string[]\n readonly get: (root: Root) => Route\n readonly set: (root: Root, route: Route) => Root\n}\n\n/**\n * One routed page: its node, its Bundle placement, and how a route arrival\n * reaches the child. The placement drives both folds from one declaration —\n * `placed.update` for Messages, `placed.view` for drawing — and `inform`\n * tells the child when its route arrives, through its own Message. The\n * placement's full type rides along, so assemblies keep inferring services.\n */\nexport interface SitePage<Parent, ParentMessage, R, P> {\n readonly node: SiteNode<any>\n readonly placed: P\n /**\n * The child told of a route arrival: `None` for another node's route, for\n * a page with nothing to say, or when the child says nothing is needed.\n */\n readonly inform: (\n model: Parent,\n route: { readonly _tag: string },\n ) => Option.Option<Update.Return<Parent, ParentMessage, R>>\n}\n\n/**\n * One deployed location: its Router (which owns URL semantics), its route\n * case, and its metadata. A stable first-class value: mounting it in a tree\n * never mutates it, so the same node serves targets, hrefs, and inspection\n * wherever it is mounted.\n */\nexport interface SiteNode<Route extends { readonly _tag: string }> {\n readonly tag: string\n readonly router: Router<Route>\n readonly case: RouteCase<Route>\n /** The page's title for this route, once the route value is known. */\n readonly title?: ((route: Route) => string) | undefined\n /** The navigation section this route belongs to, for menus and breadcrumbs. */\n readonly section?: string | undefined\n /**\n * Where the section's nav item points: this node's params for its landing\n * address (a people list with no search, say). Nodes a section never lands\n * on — a person, a file — leave it absent; `Site.landing` reads the first\n * node of a section that declares one.\n */\n readonly landing?: Omit<Route, '_tag'> | undefined\n /**\n * The keys that go to this node's `landing`, as Foldkit's key bindings name\n * them: one press (`'/'`, `'Mod+K'`) or a sequence (`['G', 'H']`).\n * `Site.shortcuts` makes the bindings.\n */\n readonly shortcut?: KeySequence | undefined\n /**\n * Which history step a move within this node is: a string, or a function\n * for nodes where some param changes are entries of their own (another\n * person) and others are views of one entry (another search). A move to\n * another node — or from an unknown location — is always a step.\n */\n readonly history?: HistoryIntent | ((prev: Route, next: Route) => HistoryIntent) | undefined\n /** The Surface this route activates, if the node declares one. */\n readonly bound?: BoundSurface | undefined\n /** A layout wrapping everything under this node, if it declares one. */\n readonly layout?: NodeLayout | undefined\n /** What this node draws for its own route, if it draws anything. */\n readonly view?: NodeView | undefined\n /** What this node says of itself in the head; nodes below override it per field. */\n readonly meta?: NodeMeta<Route> | undefined\n /**\n * Whether search engines index this node and, unless they say otherwise,\n * the nodes below it. Undeclared up the whole chain, a node is indexed.\n */\n readonly indexed?: boolean | undefined\n /**\n * Who may be shown this node and the nodes below it: see `Site.accessOf`.\n * Held as `never` for its reader, so a rule given in the options must\n * name the reader it reads (`allow: (me: Me) => …`).\n */\n readonly access?: NodeAccess<never> | undefined\n}\n\n/**\n * Who may be shown a node, and where anyone else is sent. Presentation, not\n * authorization: the server guards what the page reads whatever this says.\n * `Who` is what the application knows of the reader (its `Me` row, say).\n */\nexport interface NodeAccess<Who> {\n readonly allow: (who: Who) => boolean\n /** Where a reader `allow` refuses goes, given the address they asked for (a sign-in page returning to it). */\n readonly otherwise: (requested: string) => SiteTarget<any>\n}\n\n/**\n * Whether the reader may be shown a route: `Allowed`; `Pending` while the\n * application does not know who they are yet, to draw a loading state rather\n * than flash the sign-in page at someone signed in; `Denied` with the address\n * to send them to.\n */\nexport const Access = defineTaggedUnion({\n Allowed: {},\n Pending: {},\n Denied: { url: Schema.String },\n})\nexport type Access = typeof Access.Type\n\n/** Carries the routes a mount or tree holds, in its type only: nothing sets it. */\ndeclare const routes: unique symbol\n\n/** A node mounted with its children: structure, not state. `Route` is every route it holds. */\nexport interface SiteMount<Route extends { readonly _tag: string } = any> {\n readonly node: SiteNode<any>\n readonly children: ReadonlyArray<SiteMount>\n readonly [routes]?: (route: Route) => void\n}\n\n/** The routes a bare node or a mount holds. */\nexport type RoutesOf<Mounted> =\n Mounted extends SiteNode<infer Route>\n ? Route\n : Mounted extends SiteMount<infer Route>\n ? Route\n : never\n\n/**\n * A node under construction, from `Site.node`: each method annotates and\n * returns the builder, so nodes compose in steps and annotation bundles are\n * ordinary values. Methods — not pipeable fragments — because each stage of\n * a pipe is a separate generic call and could not infer the route. Read\n * `.node` at any stage for the frozen node so far.\n */\nexport interface NodeBuilder<Route extends { readonly _tag: string }> {\n /** The node so far: frozen, usable for targets and hrefs at any stage. */\n readonly node: SiteNode<Route>\n /**\n * One named bundle through the builder, Effect-style: the bundle stays\n * generic over the builder it meets, so it instantiates to this node's\n * route with no annotation. Chain for more than one.\n *\n * ```ts\n * const inSection = <R extends { readonly _tag: string }>(b: NodeBuilder<R>) =>\n * b.section('People').shortcut(['G', 'P'])\n *\n * const Person = Site.node(personRouter, AppRoute.Person).pipe(inSection).node\n * ```\n *\n * Free `pipe(builder, bundle)` from `effect` composes the same way; this\n * method is the same spelling without the import.\n */\n pipe<A>(fn: (builder: NodeBuilder<Route>) => A): A\n /** The page's title for this route, once the route value is known. */\n title(title: (route: Route) => string): NodeBuilder<Route>\n /** The navigation section this route belongs to. */\n section(section: string): NodeBuilder<Route>\n /** Where the section's nav item points, as this node's params. */\n landing(landing: Omit<Route, '_tag'>): NodeBuilder<Route>\n /** The keys that go to this node's landing. */\n shortcut(shortcut: KeySequence): NodeBuilder<Route>\n /** Which history step a move within this node is. */\n history(\n history: HistoryIntent | ((prev: Route, next: Route) => HistoryIntent),\n ): NodeBuilder<Route>\n /** A layout wrapping everything under this node. */\n layout(layout: NodeLayout): NodeBuilder<Route>\n /** What this node draws for its own route. */\n view(view: NodeView): NodeBuilder<Route>\n /** What this node says of itself in the head, from its route and the Model. */\n meta<Model = any>(meta: NodeMeta<Route, Model>): NodeBuilder<Route>\n /** Whether search engines index this node and the nodes below it. */\n indexed(indexed: boolean): NodeBuilder<Route>\n /** Who may be shown this node and the nodes below it, and where anyone else goes. */\n access<Who>(access: NodeAccess<Who>): NodeBuilder<Route>\n /** The Surface this route activates. */\n surface<SRoot, SModel, SMessage, SParams>(config: {\n readonly surface: SurfaceType<SRoot, SModel, SMessage, SParams>\n readonly params: (route: Route) => SParams\n }): NodeBuilder<Route>\n}\n\n/**\n * The deployed topology: roots with everything mounted under them, frozen.\n * `Route` is the union of every node's route, so the tree parses an address\n * to it (`Site.parse`) and builds one back (`Site.hrefOf`).\n */\nexport interface SiteTree<Route extends { readonly _tag: string } = any> {\n readonly roots: ReadonlyArray<SiteMount>\n readonly [routes]?: (route: Route) => void\n}\n\n/** One address a node's `Site.paths` lists: the route's params, and when its content last changed. */\nexport interface SitePath<Route extends { readonly _tag: string }> {\n readonly params: Omit<Route, '_tag'>\n /** When what the page shows last changed, as ISO 8601 text, for a sitemap. */\n readonly modified?: string | undefined\n}\n\n/** A node's addresses, listed by an Effect the build runs: from `Site.paths`. */\nexport interface SitePaths<E, R> {\n readonly node: SiteNode<any>\n readonly list: Effect.Effect<ReadonlyArray<SitePath<any>>, E, R>\n}\n\n/** How a listing of `SitePaths` can fail: each one's error, and none for no paths. */\nexport type PathsError<Paths> = Paths extends SitePaths<infer E, any> ? E : never\n/** What a listing of `SitePaths` needs: each one's services, and none for no paths. */\nexport type PathsServices<Paths> = Paths extends SitePaths<any, infer R> ? R : never\n\n/** One address of the whole site, from `Site.targets`: a target, and when it last changed. */\nexport interface SiteListed<Route extends { readonly _tag: string }> extends SiteTarget<Route> {\n readonly modified?: string | undefined\n}\n\n/**\n * One typed destination: the node, the route value, and the URL, all from one\n * declaration. Links, prefetch, and route analysis share this instead of each\n * rebuilding it.\n */\nexport interface SiteTarget<Route extends { readonly _tag: string }> {\n readonly node: SiteNode<Route>\n readonly route: Route\n readonly url: string\n}\n\n/**\n * The tag a tagged constructor names, read the way `Surface.when` reads it\n * off a route case. Anything else is a definition-time error, not a silent\n * mismatch.\n */\nconst tagOfConstructor = (constructor: unknown, what: string): string => {\n const literal = (constructor as { fields?: { _tag?: { ast?: { literal?: unknown } } } }).fields\n ?._tag?.ast?.literal\n if (typeof literal !== 'string') throw new Error(`${what} must be a tagged constructor`)\n return literal\n}\n\ninterface SiteIndex {\n readonly parent: ReadonlyMap<SiteNode<any>, SiteNode<any> | undefined>\n readonly byTag: ReadonlyMap<string, SiteNode<any>>\n /** The route the first node in tree order reads at an address, or nothing. */\n readonly read: (url: UrlValue) => Option.Option<any>\n}\n\nconst indexes = new WeakMap<SiteTree, SiteIndex>()\n\n/** The parent and tag maps and the parser of a tree, computed once per tree value. */\nconst indexOf = (site: SiteTree): SiteIndex => {\n const known = indexes.get(site)\n if (known !== undefined) return known\n const parent = new Map<SiteNode<any>, SiteNode<any> | undefined>()\n const byTag = new Map<string, SiteNode<any>>()\n const visit = (mount: SiteMount, above: SiteNode<any> | undefined): void => {\n if (parent.has(mount.node))\n throw new Error(\n `Site.make: \"${mount.node.tag}\" is mounted twice; a node has one place in a tree`,\n )\n const knownTag = byTag.get(mount.node.tag)\n if (knownTag !== undefined && knownTag !== mount.node)\n throw new Error(\n `Site.make: two nodes share the tag \"${mount.node.tag}\"; one route case is one node`,\n )\n parent.set(mount.node, above)\n byTag.set(mount.node.tag, mount.node)\n for (const child of mount.children) visit(child, mount.node)\n }\n for (const root of site.roots) visit(root, undefined)\n // Foldkit's parser takes only a fallback, so no match falls back to `None`.\n const parser = parseUrlWithFallback<any, Option.Option<any>>(\n oneOf(...[...parent.keys()].map(node => node.router)),\n { make: () => Option.none() },\n )\n const read = (url: UrlValue): Option.Option<any> => {\n const parsed = parser(url)\n return Option.isOption(parsed) ? parsed : Option.some(parsed)\n }\n const index = { parent, byTag, read }\n indexes.set(site, index)\n return index\n}\n\n/** Whether a node's route has params beyond its tag, so its addresses must be listed. */\nconst takesParams = (node: SiteNode<any>): boolean =>\n Object.keys((node.case as { fields?: object }).fields ?? {}).some(field => field !== '_tag')\n\nconst asMount = (node: SiteNode<any> | SiteMount): SiteMount =>\n 'children' in node ? node : { node, children: [] }\n\n/** One surfaced node's `Surface.when` over the route place, or nothing surfaceless. */\nconst sourceOf = <Root>(\n node: SiteNode<any>,\n owner: object,\n place: ModelPlace<Root>,\n): [string, ActiveSurface<Root> & SurfaceSource<Root>] | undefined => {\n const bound = node.bound\n if (bound === undefined) return undefined\n if (bound.surface.owner !== owner)\n throw new Error(`Site: \"${bound.surface.name}\" belongs to another application than the site`)\n return [node.tag, Surface.when(bound.surface, place, node.case, bound.params)]\n}\n\n/** The fields a `Meta` gives, so one left `undefined` does not erase an ancestor's. */\nconst saidOf = (meta: Meta): Meta =>\n Object.fromEntries(Object.entries(meta).filter(([, value]) => value !== undefined))\n\nconst freezeMount = (mount: SiteMount): SiteMount =>\n Object.freeze({\n node: mount.node,\n children: Object.freeze(mount.children.map(freezeMount)),\n })\n\n/** A bare node: its tag from its route case, nothing annotated. */\nconst baseNode = <Route extends { readonly _tag: string }>(\n router: Router<Route>,\n routeCase: RouteCase<Route>,\n): SiteNode<Route> =>\n Object.freeze({\n tag: tagOfConstructor(routeCase, 'Site.route: expected a route case from defineRouteUnion'),\n router,\n case: routeCase,\n })\n\nexport const Site = {\n /**\n * One deployed location from its Foldkit Router and its route case:\n *\n * ```ts\n * const Person = Site.route(personRouter, AppRoute.Person, {\n * title: ({ personId }) => `Person ${personId} | Routing`,\n * section: 'People',\n * })\n * ```\n *\n * The router stays the whole URL story (parse and build); the case names\n * the tag and builds route values. Metadata is annotated once here, and\n * navigation, titles, and history derive from it. To share annotations\n * across nodes, or to build incrementally, use the `Site.node` builder\n * instead — these options are sugar over it.\n */\n route: <Route extends { readonly _tag: string }, SRoot, SModel, SMessage, SParams>(\n router: Router<Route>,\n routeCase: RouteCase<Route>,\n options?: {\n readonly title?: ((route: Route) => string) | undefined\n readonly section?: string | undefined\n readonly landing?: Omit<Route, '_tag'> | undefined\n readonly shortcut?: KeySequence | undefined\n readonly history?: HistoryIntent | ((prev: Route, next: Route) => HistoryIntent) | undefined\n readonly layout?: NodeLayout | undefined\n readonly view?: NodeView | undefined\n readonly meta?: NodeMeta<Route> | undefined\n readonly indexed?: boolean | undefined\n readonly access?: NodeAccess<never> | undefined\n readonly surface?:\n | {\n readonly surface: SurfaceType<SRoot, SModel, SMessage, SParams>\n readonly params: (route: Route) => SParams\n }\n | undefined\n },\n ): SiteNode<Route> => {\n let built = Site.node(router, routeCase)\n if (options?.title !== undefined) built = built.title(options.title)\n if (options?.section !== undefined) built = built.section(options.section)\n if (options?.landing !== undefined) built = built.landing(options.landing)\n if (options?.shortcut !== undefined) built = built.shortcut(options.shortcut)\n if (options?.history !== undefined) built = built.history(options.history)\n if (options?.layout !== undefined) built = built.layout(options.layout)\n if (options?.view !== undefined) built = built.view(options.view)\n if (options?.meta !== undefined) built = built.meta(options.meta)\n if (options?.indexed !== undefined) built = built.indexed(options.indexed)\n if (options?.access !== undefined) built = built.access(options.access)\n if (options?.surface !== undefined)\n built = built.surface<SRoot, SModel, SMessage, SParams>(options.surface)\n return built.node\n },\n\n /**\n * One deployed location as an incremental builder, for nodes annotated in\n * steps or annotations shared across nodes:\n *\n * ```ts\n * const Person = Site.node(personRouter, AppRoute.Person)\n * .title(({ personId }) => `Person ${personId} | Routing`)\n * .section('People')\n * .node\n * ```\n *\n * Methods — not pipeable fragments — because a pipeable fragment cannot\n * infer the route: each stage is a separate generic call, so its type\n * parameter falls back to the constraint and a typed callback no longer\n * matches. A method already knows its node's route, so inline lambdas\n * infer with no annotation. Read `.node` at any stage: every step freezes,\n * so intermediates are usable nodes too (targets, hrefs), never drafts.\n * `Site.route`'s options are sugar over this builder — one implementation.\n */\n node: <Route extends { readonly _tag: string }>(\n router: Router<Route>,\n routeCase: RouteCase<Route>,\n ): NodeBuilder<Route> => {\n const at = (built: SiteNode<Route>): NodeBuilder<Route> => ({\n node: built,\n pipe: <A>(fn: (builder: NodeBuilder<Route>) => A): A => fn(at(built)),\n title: title => at(Object.freeze({ ...built, title })),\n section: section => at(Object.freeze({ ...built, section })),\n landing: landing => at(Object.freeze({ ...built, landing })),\n shortcut: shortcut => at(Object.freeze({ ...built, shortcut })),\n history: history => at(Object.freeze({ ...built, history })),\n layout: layout => at(Object.freeze({ ...built, layout })),\n view: view => at(Object.freeze({ ...built, view })),\n meta: meta => at(Object.freeze({ ...built, meta })),\n indexed: indexed => at(Object.freeze({ ...built, indexed })),\n access: access => at(Object.freeze({ ...built, access })),\n surface: config => at(Object.freeze({ ...built, bound: config as BoundSurface })),\n })\n return at(baseNode(router, routeCase))\n },\n\n /**\n * A node with its children. Returns a mount; the node itself is untouched,\n * so it stays usable bare for targets and hrefs. Children may be bare\n * nodes (childless) or mounts.\n */\n mount: <\n Route extends { readonly _tag: string },\n const Children extends ReadonlyArray<SiteNode<any> | SiteMount> = [],\n >(\n node: SiteNode<Route>,\n children?: Children,\n ): SiteMount<Route | RoutesOf<Children[number]>> =>\n Object.freeze({ node, children: Object.freeze((children ?? []).map(asMount)) }),\n\n /**\n * The deployed topology from its roots: bare nodes or mounts, frozen.\n * Refuses two nodes sharing a tag and one node mounted twice, since both\n * would make chain inspection ambiguous.\n */\n make: <const Roots extends ReadonlyArray<SiteNode<any> | SiteMount>>(\n ...roots: Roots\n ): SiteTree<RoutesOf<Roots[number]>> => {\n const tree: SiteTree<RoutesOf<Roots[number]>> = Object.freeze({\n roots: Object.freeze(roots.map(asMount).map(freezeMount)),\n })\n // Fail at definition time, not at the first inspection.\n indexOf(tree)\n return tree\n },\n\n /**\n * One typed destination: the route value and the URL from the node's own\n * declaration, so a link can never point where the parser would not go.\n */\n target: <Route extends { readonly _tag: string }>(\n node: SiteNode<Route>,\n params: Omit<Route, '_tag'>,\n ): SiteTarget<Route> => ({\n node,\n route: node.case(params),\n url: node.router.build(params),\n }),\n\n /** The URL of a target, or of a node with params directly. */\n href: (<Route extends { readonly _tag: string }>(\n targetOrNode: SiteTarget<Route> | SiteNode<Route>,\n params?: Omit<Route, '_tag'>,\n ): string => {\n if ('url' in targetOrNode) return targetOrNode.url\n if (params === undefined)\n throw new Error(`Site.href: \"${targetOrNode.tag}\" needs params to build its URL`)\n return Site.target(targetOrNode, params).url\n }) as {\n <Route extends { readonly _tag: string }>(target: SiteTarget<Route>): string\n <Route extends { readonly _tag: string }>(\n node: SiteNode<Route>,\n params: Omit<Route, '_tag'>,\n ): string\n },\n\n /**\n * The tree's parser: an address to the route of the first node, in tree\n * order (depth-first, parents first), whose router takes all of it, or the\n * fallback. A router that takes any segment (`/:slug`) belongs after the\n * nodes whose literal it would take too. With `Site.hrefOf`, the tree is\n * the one declaration of both directions.\n */\n parse: <Route extends { readonly _tag: string }, Fallback>(\n site: SiteTree<Route>,\n fallback: { readonly make: (data: { readonly path: string }) => Fallback },\n ): ((url: UrlValue) => Route | Fallback) => {\n const { read } = indexOf(site)\n return (url): Route | Fallback =>\n Option.getOrElse(read(url), () => fallback.make({ path: url.pathname }))\n },\n\n /**\n * The route the tree reads at an address, as `Site.parse` does, or nothing\n * when no node takes it: an address the tree does not hold is another\n * document's, which a link reaches with a full load.\n */\n routeAt: <Route extends { readonly _tag: string }>(\n site: SiteTree<Route>,\n url: UrlValue,\n ): Option.Option<Route> => indexOf(site).read(url),\n\n /**\n * The address of a route the tree holds, built by its node's router, so it\n * parses back to the same route (`Site.parse`).\n */\n hrefOf: <Route extends { readonly _tag: string }>(\n site: SiteTree<Route>,\n route: Route,\n ): string => {\n const node = indexOf(site).byTag.get(route._tag)\n if (node === undefined) throw new Error(`Site.hrefOf: no node holds the tag \"${route._tag}\"`)\n const { _tag, ...params } = route\n return node.router.build(params)\n },\n\n /**\n * A node's addresses, from data: every published post is one. `list` is an\n * Effect the build runs, such as a Remote query read through\n * `Data.satisfy`, so it lists what a visitor may see.\n *\n * ```ts\n * const posts = Site.paths(PostNode, listPosts.pipe(\n * Effect.map(rows => rows.map(row => ({ params: { slug: row.slug }, modified: row.at }))),\n * ))\n * ```\n */\n paths: <Route extends { readonly _tag: string }, E, R>(\n node: SiteNode<Route>,\n list: Effect.Effect<ReadonlyArray<SitePath<Route>>, E, R>,\n ): SitePaths<E, R> => ({ node, list }),\n\n /**\n * Every address of the site, in tree order: one for each node whose route\n * has no params, and what `paths` lists for each node whose route has\n * them. What a build renders, a sitemap lists (with `Site.indexedOf`), and\n * a prefetch warms. A node with params and no `paths` is refused, as are\n * `paths` for a node the tree does not hold or twice for one node, so no\n * page is left out unsaid; `Site.paths(node, Effect.succeed([]))` lists none.\n */\n targets: <const Paths extends ReadonlyArray<SitePaths<any, any>>>(\n site: SiteTree,\n paths: Paths,\n ): Effect.Effect<\n ReadonlyArray<SiteListed<any>>,\n PathsError<Paths[number]>,\n PathsServices<Paths[number]>\n > => {\n const nodes = Site.nodesOf(site)\n const listed = new Map<SiteNode<any>, SitePaths<any, any>>()\n for (const each of paths) {\n if (!nodes.includes(each.node))\n throw new Error(`Site.targets: \"${each.node.tag}\" has paths but is not in the tree`)\n if (listed.has(each.node)) throw new Error(`Site.targets: \"${each.node.tag}\" has paths twice`)\n listed.set(each.node, each)\n }\n const unlisted = nodes.filter(node => takesParams(node) && !listed.has(node))\n if (unlisted.length > 0)\n throw new Error(\n `Site.targets: ${unlisted.map(node => `\"${node.tag}\"`).join(', ')} take params and have no paths`,\n )\n return Effect.map(\n Effect.forEach(\n nodes,\n node => {\n const source = listed.get(node)\n if (source === undefined) return Effect.succeed([Site.target(node, {})])\n return Effect.map(source.list, found =>\n found.map(({ params, modified }) => ({\n ...Site.target(node, params),\n ...(modified === undefined ? {} : { modified }),\n })),\n )\n },\n { concurrency: 'unbounded' },\n ),\n perNode => perNode.flat(),\n )\n },\n\n /** Every node in the tree, depth-first, parents before children. */\n nodesOf: (site: SiteTree): ReadonlyArray<SiteNode<any>> => {\n const out: Array<SiteNode<any>> = []\n const visit = (mount: SiteMount): void => {\n out.push(mount.node)\n for (const child of mount.children) visit(child)\n }\n for (const root of site.roots) visit(root)\n return out\n },\n\n /** The node a route value is on, or nothing for a tag the tree does not hold. */\n nodeOf: (site: SiteTree, route: { readonly _tag: string }): SiteNode<any> | undefined =>\n indexOf(site).byTag.get(route._tag),\n\n /** The chain a route value is on, root first; none for an unknown tag. */\n chainOf: (site: SiteTree, route: { readonly _tag: string }): ReadonlyArray<SiteNode<any>> => {\n const { parent, byTag } = indexOf(site)\n const node = byTag.get(route._tag)\n if (node === undefined) return []\n const chain: Array<SiteNode<any>> = [node]\n let above = parent.get(node)\n while (above !== undefined) {\n chain.unshift(above)\n above = parent.get(above)\n }\n return chain\n },\n\n /** The node above this one in the tree, or nothing at a root. */\n parentOf: (site: SiteTree, node: SiteNode<any>): SiteNode<any> | undefined =>\n indexOf(site).parent.get(node),\n\n /** Every node above this one, root first. */\n ancestorsOf: (site: SiteTree, node: SiteNode<any>): ReadonlyArray<SiteNode<any>> => {\n const { parent } = indexOf(site)\n const out: Array<SiteNode<any>> = []\n let above = parent.get(node)\n while (above !== undefined) {\n out.unshift(above)\n above = parent.get(above)\n }\n return out\n },\n\n /** How deep the node sits: a root is 0, its children 1. */\n depthOf: (site: SiteTree, node: SiteNode<any>): number => Site.ancestorsOf(site, node).length,\n\n /** The title the tree annotates for a route value, or nothing. */\n titleOf: (site: SiteTree, route: { readonly _tag: string }): string | undefined => {\n const node = indexOf(site).byTag.get(route._tag)\n return node?.title?.(route)\n },\n\n /**\n * Whether search engines index a route: the nearest declaration up its\n * chain, so a `noindex` studio covers every node below it. A route the tree\n * does not hold is indexed, as a page with no declaration is.\n */\n indexedOf: (site: SiteTree, route: { readonly _tag: string }): boolean => {\n const chain = Site.chainOf(site, route)\n for (let at = chain.length - 1; at >= 0; at--) {\n const indexed = chain[at]!.indexed\n if (indexed !== undefined) return indexed\n }\n return true\n },\n\n /**\n * Whether the reader may be shown a route: every `access` up its chain,\n * root first, must allow `who`, and the first that refuses sends them to\n * its `otherwise`, given the route's address. `who` is `Option.none()`\n * while the application does not know yet (its `Me` loading): `Pending`\n * wherever a rule would need it. A route no rule covers is `Allowed`.\n *\n * ```ts\n * Access.match(Site.accessOf(AppSite, model.route, me), {\n * Allowed: () => page,\n * Pending: () => loading,\n * Denied: ({ url }) => redirecting, // and `update` replaces the URL with `url`\n * })\n * ```\n *\n * A server answers `Denied` with a 303 to `url` before rendering. It is\n * presentation: what the page reads is guarded on the server regardless.\n */\n accessOf: <Route extends { readonly _tag: string }, Who>(\n site: SiteTree<Route>,\n route: Route,\n who: Option.Option<Who>,\n ): Access => {\n for (const node of Site.chainOf(site, route)) {\n const { access } = node\n if (access === undefined) continue\n if (Option.isNone(who)) return Access.Pending()\n // The tree holds its rules' readers as `never`: `who` is the reader they read.\n if ((access as NodeAccess<Who>).allow(who.value)) continue\n const target = access.otherwise(Site.hrefOf(site, route))\n // A target this same rule covers refuses the reader again, for ever.\n if (Site.chainOf(site, target.route).includes(node))\n throw new Error(\n `foldkit-site: ${node.tag}'s access sends a refused reader to ${target.url}, which it also covers`,\n )\n return Access.Denied({ url: target.url })\n }\n return Access.Allowed()\n },\n\n /**\n * What a route says of itself in the head, for an SSR plan's `meta`:\n *\n * ```ts\n * SSR.plan(App, { id: 'site', state, meta: model => Site.metaOf(AppSite, model.route, model) })\n * ```\n *\n * Each node of the chain's `meta`, root first, with a deeper node's field\n * replacing its ancestor's and a field it leaves out keeping the ancestor's.\n * The preview title falls back to the route's `title`. An unindexed route\n * (`Site.indexedOf`) is `noindex` whatever its `meta` says.\n */\n metaOf: <Root>(site: SiteTree, route: { readonly _tag: string }, model: Root): Meta => {\n let meta: Meta = {}\n for (const node of Site.chainOf(site, route))\n if (node.meta !== undefined) meta = { ...meta, ...saidOf(node.meta({ route, model })) }\n const title = meta.title ?? Site.titleOf(site, route)\n return {\n ...meta,\n ...(title === undefined ? {} : { title }),\n ...(Site.indexedOf(site, route) ? {} : { robots: 'noindex' }),\n }\n },\n\n /** The navigation section the tree annotates for a route value, or nothing. */\n sectionOf: (site: SiteTree, route: { readonly _tag: string }): string | undefined =>\n indexOf(site).byTag.get(route._tag)?.section,\n\n /**\n * Where a section's nav item points: the first node of the section with a\n * landing, as a target. Nothing when no node of the section declares one —\n * every section shown needs a landing, so navigation asserts it.\n */\n landing: (site: SiteTree, section: string): SiteTarget<any> | undefined => {\n for (const candidate of Site.nodesOf(site)) {\n if (candidate.section !== section) continue\n const landing = candidate.landing\n if (landing === undefined) continue\n return Site.target(candidate, landing)\n }\n return undefined\n },\n\n /**\n * The tree's shortcuts as key bindings, each sending the Message\n * `toMessage` makes of its node's landing:\n *\n * ```ts\n * Dom.streamFromKeyBindings({\n * bindings: Site.shortcuts(AppSite, target => Message.PressedShortcut({ url: target.url })),\n * })\n * ```\n *\n * A shortcut on a node with no `landing` goes nowhere, and one used twice\n * goes to two places; both are refused.\n */\n shortcuts: <Message>(\n site: SiteTree,\n toMessage: (target: SiteTarget<any>) => Message,\n ): ReadonlyArray<KeyBinding<Message>> => {\n const taken = new Map<string, string>()\n return Site.nodesOf(site).flatMap((node): ReadonlyArray<KeyBinding<Message>> => {\n const keys = node.shortcut\n if (keys === undefined) return []\n if (node.landing === undefined)\n throw new Error(`Site.shortcuts: \"${node.tag}\" has a shortcut and no landing to go to`)\n const named = typeof keys === 'string' ? keys : keys.join(' ')\n const other = taken.get(named)\n if (other !== undefined)\n throw new Error(`Site.shortcuts: \"${named}\" goes to both \"${other}\" and \"${node.tag}\"`)\n taken.set(named, node.tag)\n const message = toMessage(Site.target(node, node.landing))\n const mapEvent = () => message\n // The binding's two shapes are told apart by `keys`, so each is made whole.\n return [typeof keys === 'string' ? { keys, mapEvent } : { keys, mapEvent }]\n })\n },\n\n /**\n * Which history step a move is: to another node, a step; within a node, its\n * declaration (a string, or a function for nodes where some param changes\n * are entries of their own); with no previous target — the current location\n * is unknown to the site — a step too, so Back can still return to it.\n */\n historyOf: (prev: SiteTarget<any> | undefined, next: SiteTarget<any>): HistoryIntent => {\n if (prev === undefined || prev.node !== next.node) return 'push'\n const rule = next.node.history ?? 'replace'\n return typeof rule === 'function' ? rule(prev.route, next.route) : rule\n },\n\n /**\n * What the route draws: the deepest node's view, wrapped by every\n * ancestor's layout root-first. Ancestors contribute layouts only — never\n * their views. Pure function composition over ordinary Foldkit rendering;\n * unknown tags and viewless leaves fail loudly, since rendering one would\n * guess.\n */\n view: <Root, Message>(\n site: SiteTree,\n route: { readonly _tag: string },\n model: Root,\n h: HtmlBuilder<Message>,\n ): Html => {\n const chain = Site.chainOf(site, route)\n if (chain.length === 0) throw new Error(`Site.view: no node holds the tag \"${route._tag}\"`)\n // A lookup, so the non-null assertion is the documented one.\n const leaf = chain[chain.length - 1]!\n if (leaf.view === undefined)\n throw new Error(`Site.view: \"${leaf.tag}\" draws nothing; give the leaf a view`)\n let child = leaf.view.render(model, h)\n for (let at = chain.length - 2; at >= 0; at--) {\n const layout = chain[at]!.layout\n if (layout !== undefined) child = layout.render(child, model, h)\n }\n return child\n },\n\n /**\n * What the tree's surfaced nodes activate, keyed by tag, for `Data.wiring`,\n * `Data.subscriptions`, `Data.satisfy`, or an SSR plan's `surfaces`: each\n * node's `Surface.when` over the application's route place. A surface from\n * another application is refused here, not at its reads.\n */\n sources: <Root>(\n site: SiteTree,\n owner: object,\n place: ModelPlace<Root>,\n ): Record<string, ActiveSurface<Root> & SurfaceSource<Root>> => {\n const out: Record<string, ActiveSurface<Root> & SurfaceSource<Root>> = {}\n for (const node of Site.nodesOf(site)) {\n const entry = sourceOf(node, owner, place)\n if (entry !== undefined) out[entry[0]] = entry[1]\n }\n return out\n },\n\n /**\n * The route-level Sources for one destination: the same entries as\n * `Site.sources`, but only the target's chain. Prefetch, SSR, and DevTools\n * read what a route will activate without building its Model first; the\n * preparation itself stays caller-composed (`Data.satisfy` over these, with\n * the route set to the target's). A tag the tree does not hold resolves to\n * no Sources, the way an inactive Surface resolves to nothing.\n *\n * ```ts\n * const active = Site.sourcesFor(AppSite, App.owner, App.model.route, target.route)\n * const prepared = yield* Data.satisfy({ ...model, route: target.route }, active)\n * ```\n *\n * There is deliberately no `SitePlan` object: the chain is already\n * `Site.chainOf`, and the head is `Site.metaOf`.\n */\n sourcesFor: <Root>(\n site: SiteTree,\n owner: object,\n place: ModelPlace<Root>,\n route: { readonly _tag: string },\n ): Record<string, ActiveSurface<Root> & SurfaceSource<Root>> => {\n const out: Record<string, ActiveSurface<Root> & SurfaceSource<Root>> = {}\n for (const node of Site.chainOf(site, route)) {\n const entry = sourceOf(node, owner, place)\n if (entry !== undefined) out[entry[0]] = entry[1]\n }\n return out\n },\n\n /**\n * The application's link-click and URL-change lifecycle as one wiring, so\n * `update` stops hand-writing those two branches. A click on a link the\n * tree holds navigates (pushing or replacing per `Site.historyOf`); on any\n * other, on this origin or not, it loads, since another document serves\n * it (`Site.routeAt`); a URL change sets the route field — or touches\n * nothing when the address parses to the route already shown, so an echo\n * of our own write never re-renders or clears pending state. The\n * application's own update answers nothing for either message; `reduces`\n * names them for its guard, the way `Remote.reduces` does.\n *\n * ```ts\n * const Routing = Site.routing<Model, Message, AppRoute>({\n * site: AppSite,\n * owner: App.owner,\n * route: {\n * dependency: App.model.route.dependency,\n * get: (model) => model.route,\n * set: (model, route) => modifyFields(model, { route: () => route }),\n * },\n * parse: urlToAppRoute,\n * tags: { clicked: 'ClickedLink', changed: 'ChangedUrl' },\n * completed: Message.CompletedNavigation,\n * })\n * const assembly = Bundle.assemble([Routing, ...pages])\n * const update = assembly.update((model, message) =>\n * Routing.reduces(message) ? { model } : updateOwn(model, message),\n * )\n * ```\n *\n * One routing per application: it claims the click tag and shares the\n * change tag with URL mirrors, which read their slices first. With `pages`,\n * a route change sets the field and then informs each page whose route\n * arrived, through the page's own `changed` Message.\n */\n routing: <\n Root,\n Message extends { readonly _tag: string },\n Route extends { readonly _tag: string },\n R = never,\n >(config: {\n readonly site: SiteTree\n /**\n * The application's identity token, for the Module contract. Raw Foldkit\n * applications have none; omit it and the contract claims no owner.\n */\n readonly owner?: object | undefined\n /** The route field, read and written (a `RouteField`, struct). */\n readonly route: RouteField<Root, Route>\n /** The application's URL parser, with its NotFound fallback. */\n readonly parse: (url: UrlValue) => Route\n /** The application's own link-click and URL-change tags. */\n readonly tags: { readonly clicked: string; readonly changed: string }\n /** One completion for the navigation commands to dispatch. */\n readonly completed: Schema.Schema<Message> & (() => Message)\n /**\n * Routed pages, informed when their route arrives. With service-needing\n * pages, name the services fourth:\n * `Site.routing<Model, Message, AppRoute, RemoteClient>`.\n */\n readonly pages?: ReadonlyArray<SitePage<Root, Message, R, any>> | undefined\n /**\n * What the application does once a new route is set and its pages are\n * told: moving focus to what it drew, say. An echo of the shown address\n * arrives nowhere, so it runs nothing.\n */\n readonly arrived?: ((model: Root, route: Route) => Update.Return<Root, Message, R>) | undefined\n }): Wiring<Root, Message, R> & {\n /** Whether the routing owns a message: its click or its URL change. */\n readonly reduces: (message: Message) => boolean\n } => {\n const completedTag = tagOfConstructor(\n config.completed,\n 'Site.routing: completed must be a message constructor',\n )\n const Navigate = Command.define('Site.Navigate', {\n args: { url: Schema.String, history: Schema.Literals(['push', 'replace']) },\n messages: [config.completed],\n execute: ({ url, history }) =>\n (history === 'push' ? Navigation.pushUrl(url) : Navigation.replaceUrl(url)).pipe(\n Effect.as(config.completed()),\n ),\n })\n const { arrived } = config\n const Load = Command.define('Site.Load', {\n args: { href: Schema.String },\n messages: [config.completed],\n execute: ({ href }) => Navigation.load(href).pipe(Effect.as(config.completed())),\n })\n // Route values are plain data from the same constructors, so equal\n // addresses compare equal. Checked before every write, so an echo of our\n // own navigation touches nothing: same Model back, no re-render.\n const sameRoute = (a: Route, b: Route): boolean => JSON.stringify(a) === JSON.stringify(b)\n const setRoute = (model: Root, next: Route): Root => {\n const current = config.route.get(model)\n return sameRoute(current, next) ? model : config.route.set(model, next)\n }\n const currentTarget = (model: Root): SiteTarget<Route> | undefined => {\n const current = config.route.get(model)\n const node = Site.nodeOf(config.site, current) as SiteNode<Route> | undefined\n if (node === undefined) return undefined\n // The tag rides along for matching only; params are everything else.\n const { _tag, ...params } = current\n return Site.target(node, params)\n }\n const reduces = (message: Message): boolean =>\n // tag-check: open — the tags are the application's own variants, named in config\n message._tag === config.tags.clicked || message._tag === config.tags.changed\n const wiring: Wiring<Root, Message, R> = {\n key: 'site',\n handles: [config.tags.clicked, config.tags.changed],\n shared: [config.tags.changed],\n route: (model, message) => {\n // tag-check: open — same ownership as reduces\n if (message._tag === config.tags.clicked) {\n const request = (message as unknown as { readonly request: UrlRequest }).request\n return Option.some(\n UrlRequest.match(request, {\n Internal: ({ url }) =>\n Option.match(Site.routeAt(config.site, url), {\n // No node takes it, so another document serves it.\n onNone: () => ({ model, commands: [Load({ href: Url.toString(url) })] }),\n onSome: next => {\n // A lookup: the route came from one of the tree's nodes.\n const node = Site.nodeOf(config.site, next)!\n const history = Site.historyOf(currentTarget(model), {\n node,\n route: next,\n url: Url.toString(url),\n })\n return {\n model,\n commands: [Navigate({ url: Url.toString(url), history })],\n }\n },\n }),\n External: ({ href }) => ({ model, commands: [Load({ href })] }),\n }),\n )\n }\n // tag-check: open — same ownership as reduces\n if (message._tag === config.tags.changed) {\n const url = (message as unknown as { readonly url: UrlValue }).url\n const next = config.parse(url)\n // An echo of the shown address touches nothing: same Model back,\n // and no page is informed of a route it already has.\n if (sameRoute(config.route.get(model), next)) return Option.some({ model })\n const steps: Array<Update.Step<Root, Message, R>> = [\n model => ({ model: setRoute(model, next) }),\n ...(config.pages ?? []).map(\n page => (model: Root) =>\n Option.getOrElse(page.inform(model, next), () => ({ model })),\n ),\n ...(arrived === undefined ? [] : [(model: Root) => arrived(model, next)]),\n ]\n return Option.some(Update.combine(model, steps))\n }\n return Option.none()\n },\n onUrl: (model, url) => setRoute(model, config.parse(url)),\n contract: {\n kind: 'site',\n name: 'site',\n owner: config.owner,\n owns: [],\n observes: [config.route.dependency],\n messages: [completedTag],\n metadata: [],\n } satisfies Contract,\n }\n return { ...wiring, reduces }\n },\n\n /**\n * One routed page stated once: its link (where its Model lives and how its\n * Messages wrap), what starts it, and what its route arrival tells it. The\n * link carries the field and the wrapper together; `placed.update` folds\n * the child's Messages and `placed.view` draws it, and `Site.routing`\n * informs it through `changed` when its route arrives.\n *\n * ```ts\n * const PeoplePage = Site.placement(People, PeopleBundle, {\n * link: Link.field<Model>()('peoplePage', Link.wrapper(Message.GotPeopleMessage)),\n * args: parent => ({\n * searchText: parent.route._tag === 'People' ? parent.route.searchText : Option.none(),\n * }),\n * changed: route => People.Message.ChangedRoute({ route }),\n * })\n * const assembly = Bundle.assemble([PeoplePage.placed, Routing])\n * ```\n *\n * `changed` receives the node's own case value and returns the child's\n * Message, or nothing when the arrival needs no answer. Without it the\n * page is never informed. Bundles with OutMessages, and children that are\n * not Bundles, stay on `Bundle.at` and `Link.child` directly.\n */\n placement: <\n Route extends { readonly _tag: string },\n Parent,\n LinkMessage extends AnyMessage,\n ChildModel,\n ChildMessage extends AnyMessage,\n Field extends string,\n Name extends string,\n Args,\n BundleR = never,\n BundleS = never,\n ViewInputs = void,\n Resources extends ResourceEntries<ChildModel, ChildMessage> = never,\n Helpers extends Readonly<Record<string, Helper<ChildModel, ChildMessage, never, BundleR>>> =\n never,\n ObserverR = never,\n >(\n node: SiteNode<Route>,\n bundle: Bundle.Bundle<\n Name,\n Args,\n ChildModel,\n ChildMessage,\n never,\n BundleR,\n BundleS,\n ViewInputs,\n Resources,\n Helpers\n >,\n config: {\n readonly link: Link<Parent, LinkMessage, ChildModel, ChildMessage, Field>\n readonly changed?: (route: Route) => ChildMessage | undefined\n } & PlacementConfig<\n Args,\n Parent,\n LinkMessage,\n ChildMessage,\n never,\n never,\n ObserverR,\n SeedFor<Parent, Field>\n >,\n ): SitePage<\n Parent,\n LinkMessage,\n BundleR | ObserverR,\n Placed<\n Name,\n Parent,\n LinkMessage,\n ChildModel,\n ChildMessage,\n BundleR | ObserverR,\n BundleS,\n ViewInputs,\n Resources,\n Helpers,\n Field,\n LinkMessage extends { readonly _tag: infer Tag extends string } ? Tag : string\n >\n > => {\n const { link, changed } = config\n // `link` and `changed` are this helper's own: `Bundle.at` reads its\n // known keys, and a non-literal tolerates the extra properties.\n const placed = bundle.at(link, config)\n return {\n node,\n placed,\n inform: (model, route) => {\n if (!Predicate.isTagged(route, node.tag) || changed === undefined) return Option.none()\n // Guarded by the tag the node was built from, which `Site.make`\n // keeps unique: this is the node's own case value.\n const child = changed(route as Route)\n if (child === undefined) return Option.none()\n return placed.update(model, link.toParentMessage(child))\n },\n }\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6NA,MAAa,SAAS,kBAAkB;CACtC,SAAS,CAAC;CACV,SAAS,CAAC;CACV,QAAQ,EAAE,KAAK,OAAO,OAAO;AAC/B,CAAC;;;;;;AA6HD,MAAM,oBAAoB,aAAsB,SAAyB;CACvE,MAAM,UAAW,YAAwE,QACrF,MAAM,KAAK;CACf,IAAI,OAAO,YAAY,UAAU,MAAM,IAAI,MAAM,GAAG,KAAK,8BAA8B;CACvF,OAAO;AACT;AASA,MAAM,0BAAU,IAAI,QAA6B;;AAG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,KAAA,GAAW,OAAO,OAAO,KAAK;IAGtF,MAAM,QAAQ,QAAQ,KAAc;IACpC,IAAI,UAAU,KAAA,GAAW,OAAO,OAAO,KAAK;IAC5C,OAAO,OAAO,OAAO,OAAO,KAAK,gBAAgB,KAAK,CAAC;GACzD;EACF;CACF;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit-site",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "The deployed route topology of a Foldkit application: stable route nodes, their hierarchy, typed targets, and per-node metadata, compiled to the Foldkit Router, Surface, and Bundle primitives the runtime already runs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"foldkit",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"foldkit-bundle": "0.8.0",
|
|
42
|
-
"foldkit-
|
|
43
|
-
"foldkit-
|
|
42
|
+
"foldkit-surface": "0.10.0",
|
|
43
|
+
"foldkit-ssr": "0.7.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"effect": "^4.0.0",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"tsdown": "^0.23.1",
|
|
53
53
|
"typescript": "7.0.2",
|
|
54
54
|
"foldkit-bundle": "0.8.0",
|
|
55
|
-
"foldkit-remote": "0.
|
|
55
|
+
"foldkit-remote": "0.18.0",
|
|
56
56
|
"foldkit-entity": "0.10.0",
|
|
57
57
|
"foldkit-surface": "0.10.0",
|
|
58
|
-
"foldkit-ssr": "0.
|
|
58
|
+
"foldkit-ssr": "0.7.1"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"build": "tsdown",
|