@xmachines/play-router 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +270 -11
  2. package/dist/base-path.d.ts +209 -0
  3. package/dist/base-path.d.ts.map +1 -0
  4. package/dist/base-path.js +418 -0
  5. package/dist/base-path.js.map +1 -0
  6. package/dist/base-route-map.d.ts.map +1 -1
  7. package/dist/base-route-map.js +5 -0
  8. package/dist/base-route-map.js.map +1 -1
  9. package/dist/errors.d.ts +87 -4
  10. package/dist/errors.d.ts.map +1 -1
  11. package/dist/errors.js +97 -4
  12. package/dist/errors.js.map +1 -1
  13. package/dist/framework-params.d.ts +144 -0
  14. package/dist/framework-params.d.ts.map +1 -0
  15. package/dist/framework-params.js +291 -0
  16. package/dist/framework-params.js.map +1 -0
  17. package/dist/index.d.ts +7 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +13 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/provider-lifecycle.d.ts +179 -0
  22. package/dist/provider-lifecycle.d.ts.map +1 -0
  23. package/dist/provider-lifecycle.js +153 -0
  24. package/dist/provider-lifecycle.js.map +1 -0
  25. package/dist/query.d.ts +49 -0
  26. package/dist/query.d.ts.map +1 -1
  27. package/dist/query.js +59 -0
  28. package/dist/query.js.map +1 -1
  29. package/dist/router-bridge-base.d.ts +320 -14
  30. package/dist/router-bridge-base.d.ts.map +1 -1
  31. package/dist/router-bridge-base.js +919 -102
  32. package/dist/router-bridge-base.js.map +1 -1
  33. package/dist/types.d.ts +44 -0
  34. package/dist/types.d.ts.map +1 -1
  35. package/dist/url-pattern-utils.d.ts +0 -30
  36. package/dist/url-pattern-utils.d.ts.map +1 -1
  37. package/dist/url-pattern-utils.js +52 -1
  38. package/dist/url-pattern-utils.js.map +1 -1
  39. package/package.json +4 -4
@@ -0,0 +1,179 @@
1
+ /**
2
+ * The framework-free half of a `PlayRouterProvider`.
3
+ *
4
+ * A provider of a framework is two things: the lifecycle of a bridge, and about fifteen
5
+ * lines that bind that lifecycle to the effects of the framework. The lifecycle carries
6
+ * every decision — when the bridge is built, in which order it connects and
7
+ * disconnects, when a mount moves rather than rebuilds, and how a bridge that never
8
+ * heard of `basePath` is detected — and none of those decisions is framework-specific.
9
+ * They therefore live here, in a module that imports no framework, and each adapter
10
+ * keeps only its own effects.
11
+ *
12
+ * Four adapters used to hold a copy of the whole provider: React Router beside TanStack
13
+ * React, Solid Router beside TanStack Solid. Neither member of a pair could import the
14
+ * other, because each declares its own router as a `peerDependency`. This module is the
15
+ * home they all already depend on, and it stays framework-agnostic, so a consumer of
16
+ * `@xmachines/play-router` gains no framework dependency of any kind.
17
+ *
18
+ * @see [Multi-router integration](../../docs/examples/multi-router-integration.md)
19
+ */
20
+ import { type BasePathOptions } from "./base-path.js";
21
+ import type { MountableRouterBridge, PlayActor, RouterBridge } from "./types.js";
22
+ import type { RouteMap } from "./base-route-map.js";
23
+ /**
24
+ * The props that every `PlayRouterProvider` of a framework shares.
25
+ *
26
+ * `TNode` is what the framework renders: `ReactNode` for React, `JSX.Element` for
27
+ * Solid. It is the ONLY thing in these props that a framework decides, which is why
28
+ * they live here and not in an adapter.
29
+ *
30
+ * An adapter re-exports a two-parameter alias of this type, with `TRouter` bound to
31
+ * the type of its router instance and `TNode` bound to its own node type.
32
+ */
33
+ export interface PlayRouterProviderBaseProps<TRouter, TActor extends PlayActor, TNode> {
34
+ /**
35
+ * The actor to keep in step with the router. It must be a stable reference: give
36
+ * the same actor instance on every render. An actor in the JSX, or a new actor on
37
+ * each render, makes the bridge disconnect and connect again each time.
38
+ */
39
+ actor: TActor;
40
+ /** The router instance that the bridge keeps in step with the actor. It must be a stable reference. */
41
+ router: TRouter;
42
+ /**
43
+ * The route map of both directions, for the lookup between a state ID and a URL path.
44
+ *
45
+ * **It must be a stable reference.** The provider builds the bridge again on each
46
+ * change of the identity of `routeMap`. A value in the JSX, for example
47
+ * `createRouteMapFromTree(routeTree)`, makes a new object on every render, and the
48
+ * bridge therefore connects again on every render. Hold the value with `useMemo`:
49
+ *
50
+ * ```tsx
51
+ * const routeMap = useMemo(() => createRouteMapFromTree(routeTree), [routeTree]);
52
+ * ```
53
+ */
54
+ routeMap: RouteMap;
55
+ /**
56
+ * Mounts the routes of the machine under a URL prefix that the host owns, so that
57
+ * the routes of the host and the routes of the machine share one router.
58
+ *
59
+ * `actor`, `router`, and `routeMap` each need a stable reference. This prop needs
60
+ * none, and it rebuilds the bridge never: a change moves the live bridge with
61
+ * `setBasePath()`, so a host route that renders again with a new prefix keeps the
62
+ * actor, the route map, and its cache.
63
+ *
64
+ * The prefix says WHERE an actor is mounted, and never WHICH actor is mounted. An
65
+ * actor never changes identity, so a prefix segment that IDENTIFIES the actor gives
66
+ * a different `actor` prop instead, and THAT rebuilds the bridge — which is correct,
67
+ * because one actor takes one bridge.
68
+ *
69
+ * A location outside the prefix belongs completely to the host: the bridge sends no
70
+ * event there, and it corrects no URL there.
71
+ *
72
+ * Every `:param` needs a value. An unresolved one throws a
73
+ * `MissingBasePathParamError` out of the mount effect, because the bridge writes no
74
+ * URL without it. Render this component only after the host holds the value, which
75
+ * a route loader or a `useParams()` call does already.
76
+ */
77
+ basePath?: string;
78
+ /**
79
+ * The values of the `:param` segments of
80
+ * {@link PlayRouterProviderBaseProps.basePath}, for example `{ machineId }` for
81
+ * `basePath="/:machineId/play"`.
82
+ *
83
+ * An inline object literal is correct here: the provider compares this prop by
84
+ * value, and a move to the same prefix does nothing.
85
+ */
86
+ basePathParams?: Record<string, string | number>;
87
+ /** The renderer callback receives the same concrete actor type as the prop. */
88
+ renderer: (actor: TActor, router: TRouter) => TNode;
89
+ }
90
+ /**
91
+ * The constructor shape that a bridge class must satisfy for a provider factory: `(router, actor, routeMap, options?) → RouterBridge`.
92
+ *
93
+ * The return type is `RouterBridge`, the published contract of a bridge, so a
94
+ * consumer bridge of its own keeps compiling. Every bridge on `RouterBridgeBase` also
95
+ * satisfies `MountableRouterBridge`, and the provider finds that mount API at run
96
+ * time: a bridge without it ignores `basePath`, exactly as it did before the option
97
+ * existed.
98
+ */
99
+ export type PlayRouterBridgeConstructor<TRouter> = new (router: TRouter, actor: PlayActor, routeMap: RouteMap, options?: BasePathOptions) => RouterBridge;
100
+ /**
101
+ * Tells you whether a bridge can move its mount.
102
+ *
103
+ * {@link PlayRouterBridgeConstructor} asks for a `RouterBridge`, the published
104
+ * contract, so a consumer bridge that never heard of `basePath` still compiles. Such a
105
+ * bridge ignores the prefix, exactly as it did before the option existed, so the probe
106
+ * runs at run time rather than in the type system.
107
+ */
108
+ export declare function isMountableBridge(bridge: RouterBridge | null | undefined): bridge is MountableRouterBridge;
109
+ /**
110
+ * A key that changes when the MOUNT changes, and never when its identity changes.
111
+ *
112
+ * The comparison is BY VALUE, because `basePathParams` is normally an inline object
113
+ * literal: its identity changes on every render while the prefix does not, and a
114
+ * provider that watched the identity would move the mount on each render.
115
+ *
116
+ * @returns A string to compare, or to give to the dependency list of an effect.
117
+ */
118
+ export declare function mountKey(basePath?: BasePathOptions["basePath"], basePathParams?: BasePathOptions["basePathParams"]): string;
119
+ /** What {@link openProviderBridge} needs to build and connect a bridge. */
120
+ export interface OpenProviderBridgeArgs<TRouter, TActor extends PlayActor> extends BasePathOptions {
121
+ router: TRouter;
122
+ actor: TActor;
123
+ routeMap: RouteMap;
124
+ }
125
+ /**
126
+ * Builds a bridge, connects it, and hands back the way to close it.
127
+ *
128
+ * The order is the contract: the constructor applies the mount, `connect()` runs the
129
+ * first synchronization against it, and `close()` disconnects exactly the bridge that
130
+ * this call opened. A provider that closed "the current bridge" instead would
131
+ * disconnect a later one when two mounts overlap.
132
+ *
133
+ * @returns The bridge, and a `close` that disconnects it one time.
134
+ */
135
+ export declare function openProviderBridge<TRouter, TActor extends PlayActor>(BridgeCtor: PlayRouterBridgeConstructor<TRouter>, { router, actor, routeMap, basePath, basePathParams }: OpenProviderBridgeArgs<TRouter, TActor>): {
136
+ bridge: RouterBridge;
137
+ close: () => void;
138
+ };
139
+ /**
140
+ * Moves the mount of a live bridge, and rebuilds nothing.
141
+ *
142
+ * The call is safe directly after the open: it resolves to the prefix that the
143
+ * constructor applied already, and `setBasePath` then returns at once. A `null` bridge,
144
+ * and a bridge with no mount API, are both no-ops.
145
+ */
146
+ export declare function repointProviderBridge(bridge: RouterBridge | null | undefined, basePath?: BasePathOptions["basePath"], basePathParams?: BasePathOptions["basePathParams"]): void;
147
+ /**
148
+ * What `connectRouter` of an adapter returns.
149
+ *
150
+ * The value is CALLABLE, so `const disconnect = connectRouter(…); disconnect();` keeps
151
+ * working exactly as it did. It also carries the mount API, because a host that gives a
152
+ * `basePath` needs the two things {@link MountableRouterBridge} promises: the resolved
153
+ * mount to read back, and a way to move it. The bridge itself lives inside
154
+ * `connectRouter`, so without this handle a host had to rebuild the actor and the bridge
155
+ * to move a mount — which throws away the LRU cache of the route map, the very thing
156
+ * `setBasePath` exists to keep.
157
+ *
158
+ * `basePath` and `basePathParams` are GETTERS on the live bridge, so they cannot go
159
+ * stale.
160
+ */
161
+ export interface RouterConnection {
162
+ /** Stops the synchronization. The same call as {@link RouterConnection.disconnect}. */
163
+ (): void;
164
+ /** Stops the synchronization. */
165
+ disconnect(): void;
166
+ /** The resolved prefix of the mount, or `""` when the machine owns the whole router. */
167
+ readonly basePath: string;
168
+ /** The values of the `:param` segments of the mount. They travel in no event. */
169
+ readonly basePathParams: Readonly<Record<string, string>>;
170
+ /** Moves the mount of the live bridge, with no teardown. */
171
+ setBasePath(basePath?: BasePathOptions["basePath"], basePathParams?: BasePathOptions["basePathParams"]): void;
172
+ }
173
+ /**
174
+ * Wraps a live bridge in the {@link RouterConnection} that `connectRouter` returns.
175
+ *
176
+ * @param bridge - The bridge that `connectRouter` built and connected.
177
+ */
178
+ export declare function createRouterConnection(bridge: MountableRouterBridge): RouterConnection;
179
+ //# sourceMappingURL=provider-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider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;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,qBAAqB,GAAG,gBAAgB,CAiBtF"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * The framework-free half of a `PlayRouterProvider`.
3
+ *
4
+ * A provider of a framework is two things: the lifecycle of a bridge, and about fifteen
5
+ * lines that bind that lifecycle to the effects of the framework. The lifecycle carries
6
+ * every decision — when the bridge is built, in which order it connects and
7
+ * disconnects, when a mount moves rather than rebuilds, and how a bridge that never
8
+ * heard of `basePath` is detected — and none of those decisions is framework-specific.
9
+ * They therefore live here, in a module that imports no framework, and each adapter
10
+ * keeps only its own effects.
11
+ *
12
+ * Four adapters used to hold a copy of the whole provider: React Router beside TanStack
13
+ * React, Solid Router beside TanStack Solid. Neither member of a pair could import the
14
+ * other, because each declares its own router as a `peerDependency`. This module is the
15
+ * home they all already depend on, and it stays framework-agnostic, so a consumer of
16
+ * `@xmachines/play-router` gains no framework dependency of any kind.
17
+ *
18
+ * @see [Multi-router integration](../../docs/examples/multi-router-integration.md)
19
+ */
20
+ import { normalizeBasePath } from "./base-path.js";
21
+ /**
22
+ * Tells you whether a bridge can move its mount.
23
+ *
24
+ * {@link PlayRouterBridgeConstructor} asks for a `RouterBridge`, the published
25
+ * contract, so a consumer bridge that never heard of `basePath` still compiles. Such a
26
+ * bridge ignores the prefix, exactly as it did before the option existed, so the probe
27
+ * runs at run time rather than in the type system.
28
+ */
29
+ export function isMountableBridge(bridge) {
30
+ // `!= null`, and not `!== null`: a binding that has not opened its bridge yet holds
31
+ // `undefined` as readily as `null`, and a strict test then read the property of it and
32
+ // threw a TypeError out of an effect.
33
+ return bridge != null && typeof bridge.setBasePath === "function";
34
+ }
35
+ /**
36
+ * A key that changes when the MOUNT changes, and never when its identity changes.
37
+ *
38
+ * The comparison is BY VALUE, because `basePathParams` is normally an inline object
39
+ * literal: its identity changes on every render while the prefix does not, and a
40
+ * provider that watched the identity would move the mount on each render.
41
+ *
42
+ * @returns A string to compare, or to give to the dependency list of an effect.
43
+ */
44
+ export function mountKey(basePath, basePathParams) {
45
+ // The entries are SORTED before they are joined, because `JSON.stringify` follows the
46
+ // order of the properties: a params object that a host rebuilds in another order —
47
+ // `{ ...defaults, machineId }`, or one derived from a Map — gave a different key for
48
+ // the same mount, and every render then re-resolved the prefix.
49
+ //
50
+ // Each name, each value AND the prefix are escaped, because a raw join ALIASES. With
51
+ // "=" and "&" as literal separators, `{ a: "1&b=2" }` and `{ a: "1", b: "2" }` gave
52
+ // one key for two different mounts: the provider then saw no change, never
53
+ // re-pointed, and the bridge kept writing and stripping the old prefix — so every
54
+ // location read as foreign and the machine went silent.
55
+ // An absent value counts as an absent ENTRY, exactly as `resolveBasePath` reads it: a
56
+ // host that spreads an optional value — `{ ...defaults, region }` with no region —
57
+ // hands over `{ region: undefined }`, and `String(undefined)` put the text
58
+ // "undefined" in the key. That key differed from the key of the same mount without
59
+ // the entry, so every render re-pointed a bridge that had not moved.
60
+ const entries = Object.entries(basePathParams ?? {})
61
+ .filter(([, value]) => value !== undefined && value !== null)
62
+ .map(([name, value]) => `${encodeURIComponent(name)}=${encodeURIComponent(String(value))}`)
63
+ .toSorted();
64
+ return `${encodeURIComponent(basePath ?? "")}|${entries.join("&")}`;
65
+ }
66
+ /**
67
+ * Builds a bridge, connects it, and hands back the way to close it.
68
+ *
69
+ * The order is the contract: the constructor applies the mount, `connect()` runs the
70
+ * first synchronization against it, and `close()` disconnects exactly the bridge that
71
+ * this call opened. A provider that closed "the current bridge" instead would
72
+ * disconnect a later one when two mounts overlap.
73
+ *
74
+ * @returns The bridge, and a `close` that disconnects it one time.
75
+ */
76
+ export function openProviderBridge(BridgeCtor, { router, actor, routeMap, basePath, basePathParams }) {
77
+ const bridge = new BridgeCtor(router, actor, routeMap, { basePath, basePathParams });
78
+ // A bridge on the three-argument signature drops the options object, and
79
+ // `PlayRouterBridgeConstructor` accepts one: it asks for the published `RouterBridge`,
80
+ // so a consumer bridge that never heard of `basePath` still compiles. Such a bridge
81
+ // then claims the WHOLE router, and its correction of an unknown path drags the user
82
+ // off every page the host owns — which is the opposite of what a prefix was asked
83
+ // for. Say so, once, rather than let it fail silently.
84
+ // `normalizeBasePath` decides what "no prefix" means, and no list of literals here
85
+ // does: an absent value, `""`, `"/"`, and `"//"` all normalize to `""` — see
86
+ // `BasePathOptions.basePath`. A hand-written list warned that a prefix was ignored for
87
+ // a caller that asked for no prefix at all, and it had to be kept in step with that
88
+ // function by hand.
89
+ //
90
+ // The probe of the bridge runs FIRST, so the normalization reaches a mountable bridge
91
+ // never: the constructor of such a bridge has refused an invalid prefix already, and a
92
+ // second refusal here would replace its error with an identical one from another
93
+ // stack. For a bridge with no mount the normalization can still throw, and a prefix
94
+ // that it refuses is a prefix all the same — the warning is the answer, not the throw.
95
+ if (!isMountableBridge(bridge) && hasPrefix(basePath)) {
96
+ console.warn(`[@xmachines/play-router] The provider received basePath "${basePath}", and ${BridgeCtor.name || "the bridge"} takes no mount: it has no setBasePath(), so the prefix is ignored and the bridge claims the whole router. Extend RouterBridgeBase, or drop the basePath prop.`);
97
+ }
98
+ void bridge.connect();
99
+ return {
100
+ bridge,
101
+ close: () => {
102
+ void bridge.disconnect();
103
+ },
104
+ };
105
+ }
106
+ /**
107
+ * Tells you whether a `basePath` option asks for a prefix at all.
108
+ *
109
+ * An absent value, `""`, `"/"`, and `"//"` all mean "no prefix", and
110
+ * {@link normalizeBasePath} is the one place that says so. A prefix that the function
111
+ * REFUSES is still a prefix that the caller asked for, so the refusal counts as `true`
112
+ * here: the caller learns that its bridge ignores the option, which is the message that
113
+ * this test exists to raise.
114
+ */
115
+ function hasPrefix(basePath) {
116
+ try {
117
+ return normalizeBasePath(basePath) !== "";
118
+ }
119
+ catch {
120
+ return true;
121
+ }
122
+ }
123
+ /**
124
+ * Moves the mount of a live bridge, and rebuilds nothing.
125
+ *
126
+ * The call is safe directly after the open: it resolves to the prefix that the
127
+ * constructor applied already, and `setBasePath` then returns at once. A `null` bridge,
128
+ * and a bridge with no mount API, are both no-ops.
129
+ */
130
+ export function repointProviderBridge(bridge, basePath, basePathParams) {
131
+ if (isMountableBridge(bridge))
132
+ bridge.setBasePath(basePath, basePathParams);
133
+ }
134
+ /**
135
+ * Wraps a live bridge in the {@link RouterConnection} that `connectRouter` returns.
136
+ *
137
+ * @param bridge - The bridge that `connectRouter` built and connected.
138
+ */
139
+ export function createRouterConnection(bridge) {
140
+ const disconnect = () => {
141
+ bridge.disconnect();
142
+ };
143
+ return Object.defineProperties(disconnect, {
144
+ disconnect: { value: disconnect, enumerable: true },
145
+ basePath: { get: () => bridge.basePath, enumerable: true },
146
+ basePathParams: { get: () => bridge.basePathParams, enumerable: true },
147
+ setBasePath: {
148
+ value: (basePath, basePathParams) => bridge.setBasePath(basePath, basePathParams),
149
+ enumerable: true,
150
+ },
151
+ });
152
+ }
153
+ //# sourceMappingURL=provider-lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-lifecycle.js","sourceRoot":"","sources":["../src/provider-lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAC;AAwFzE;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAChC,MAAuC;IAEvC,oFAAoF;IACpF,uFAAuF;IACvF,sCAAsC;IACtC,OAAO,MAAM,IAAI,IAAI,IAAI,OAAQ,MAAgC,CAAC,WAAW,KAAK,UAAU,CAAC;AAC9F,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CACvB,QAAsC,EACtC,cAAkD;IAElD,sFAAsF;IACtF,mFAAmF;IACnF,qFAAqF;IACrF,gEAAgE;IAChE,EAAE;IACF,qFAAqF;IACrF,oFAAoF;IACpF,2EAA2E;IAC3E,kFAAkF;IAClF,wDAAwD;IACxD,sFAAsF;IACtF,mFAAmF;IACnF,2EAA2E;IAC3E,mFAAmF;IACnF,qEAAqE;IACrE,MAAM,OAAO,GAAG,MAA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} from "@statelyai/graph";
2
2
  import type { RouteTree, RouteNode, MachineNodeData, MachineEdgeData } from "./types.js";
3
+ import type { RouteMapping } from "./base-route-map.js";
4
+ import { type BasePathOptions } from "./base-path.js";
3
5
  /**
4
6
  * Returns every route of a navigation from the given state
5
7
  *
@@ -99,4 +101,51 @@ export declare const getTransitionReachableRoutes: (graph: Graph<MachineNodeData
99
101
  * ```
100
102
  */
101
103
  export declare const isRouteReachable: (graph: Graph<MachineNodeData, MachineEdgeData>, fromStateId: string, toStateId: string) => boolean;
104
+ /**
105
+ * Returns the `{ stateId, path }` entries that a host router needs, so that it can
106
+ * register the routes of a machine under a base path, and remove them again later.
107
+ *
108
+ * This function makes the routes dynamic. `getStateIdByPath` and `getPathByStateId`
109
+ * answer the question "what is this URL?" at the moment of a navigation, but a host
110
+ * that declares real route objects — a route tree of TanStack, a `RouteObject[]`, an
111
+ * `addRoute` call of vue-router — needs the LIST in advance, and it needs that list
112
+ * with the prefix of the mount. A registration of these paths, and a removal of them
113
+ * when the machine unloads, keeps the route table of the host in step with the mount.
114
+ *
115
+ * `basePathParams` decides the form of each path, and both forms are useful:
116
+ * - **Given** → a concrete path (`/abc123/play/profile/:userId`), for a route that
117
+ * the host adds at run time, after a loader resolved the mount.
118
+ * - **Absent** → the pattern stays (`/:machineId/play/profile/:userId`), for a static
119
+ * route declaration of the host.
120
+ *
121
+ * The function ALWAYS keeps each `:param` segment that the machine declares itself:
122
+ * those are the params that the route of the host must match.
123
+ *
124
+ * @param tree - The route tree of extractMachineRoutes()
125
+ * @param options - The optional `{ basePath, basePathParams }`, the same option as the bridge takes.
126
+ * Each `stateId` comes from the route tree, so it carries NO `#` prefix. A host that
127
+ * keys its route table on the target of a `play.route` event adds the `#` itself,
128
+ * because the event always carries the prefixed form.
129
+ *
130
+ * @returns One entry for each state with a route, in the order of the route tree.
131
+ * @throws {InvalidBasePathError} For a base path that resolves to one concrete path never.
132
+ * @throws {MissingBasePathParamError} When `basePathParams` is present and it omits a `:param`.
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const tree = extractMachineRoutes(machine);
137
+ *
138
+ * // Concrete, for a route that the host adds after a loader resolved the mount
139
+ * getRouteMappings(tree, { basePath: "/:machineId/play", basePathParams: { machineId: "abc123" } });
140
+ * // [
141
+ * // { stateId: "app.home", path: "/abc123/play" },
142
+ * // { stateId: "app.profile", path: "/abc123/play/profile/:userId" },
143
+ * // ]
144
+ *
145
+ * // The pattern, for a static route declaration of the host
146
+ * getRouteMappings(tree, { basePath: "/:machineId/play" });
147
+ * // [{ stateId: "app.home", path: "/:machineId/play" }, ...]
148
+ * ```
149
+ */
150
+ export declare const getRouteMappings: (tree: RouteTree, options?: BasePathOptions) => RouteMapping[];
102
151
  //# sourceMappingURL=query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAa,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAqBzF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,SAAS,EAAE,SAAS,MAAM,KAAG,SAAS,EA0B9E,CAAC;AAkBF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,SAAS,KAAG,SAAS,EAW5D,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,SAAS,EAAE,MAAM,MAAM,KAAG,OAE3D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,4BAA4B,GACxC,OAAO,KAAK,CAAC,eAAe,EAAE,eAAe,CAAC,EAC9C,SAAS,MAAM,KACb,MAAM,EAER,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,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,EAazF,CAAC"}
package/dist/query.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { getSuccessors, hasNode, hasPath } from "@statelyai/graph";
2
+ import { joinBasePath, normalizeBasePath, resolveBasePath, } from "./base-path.js";
2
3
  /**
3
4
  * Returns the successor nodes of a state that have a route: the states of a direct
4
5
  * transition edge that hold a `meta.route` field.
@@ -166,4 +167,62 @@ export const isRouteReachable = (graph, fromStateId, toStateId) => {
166
167
  ? hasPath(graph, fromStateId, toStateId)
167
168
  : false;
168
169
  };
170
+ /**
171
+ * Returns the `{ stateId, path }` entries that a host router needs, so that it can
172
+ * register the routes of a machine under a base path, and remove them again later.
173
+ *
174
+ * This function makes the routes dynamic. `getStateIdByPath` and `getPathByStateId`
175
+ * answer the question "what is this URL?" at the moment of a navigation, but a host
176
+ * that declares real route objects — a route tree of TanStack, a `RouteObject[]`, an
177
+ * `addRoute` call of vue-router — needs the LIST in advance, and it needs that list
178
+ * with the prefix of the mount. A registration of these paths, and a removal of them
179
+ * when the machine unloads, keeps the route table of the host in step with the mount.
180
+ *
181
+ * `basePathParams` decides the form of each path, and both forms are useful:
182
+ * - **Given** → a concrete path (`/abc123/play/profile/:userId`), for a route that
183
+ * the host adds at run time, after a loader resolved the mount.
184
+ * - **Absent** → the pattern stays (`/:machineId/play/profile/:userId`), for a static
185
+ * route declaration of the host.
186
+ *
187
+ * The function ALWAYS keeps each `:param` segment that the machine declares itself:
188
+ * those are the params that the route of the host must match.
189
+ *
190
+ * @param tree - The route tree of extractMachineRoutes()
191
+ * @param options - The optional `{ basePath, basePathParams }`, the same option as the bridge takes.
192
+ * Each `stateId` comes from the route tree, so it carries NO `#` prefix. A host that
193
+ * keys its route table on the target of a `play.route` event adds the `#` itself,
194
+ * because the event always carries the prefixed form.
195
+ *
196
+ * @returns One entry for each state with a route, in the order of the route tree.
197
+ * @throws {InvalidBasePathError} For a base path that resolves to one concrete path never.
198
+ * @throws {MissingBasePathParamError} When `basePathParams` is present and it omits a `:param`.
199
+ *
200
+ * @example
201
+ * ```typescript
202
+ * const tree = extractMachineRoutes(machine);
203
+ *
204
+ * // Concrete, for a route that the host adds after a loader resolved the mount
205
+ * getRouteMappings(tree, { basePath: "/:machineId/play", basePathParams: { machineId: "abc123" } });
206
+ * // [
207
+ * // { stateId: "app.home", path: "/abc123/play" },
208
+ * // { stateId: "app.profile", path: "/abc123/play/profile/:userId" },
209
+ * // ]
210
+ *
211
+ * // The pattern, for a static route declaration of the host
212
+ * getRouteMappings(tree, { basePath: "/:machineId/play" });
213
+ * // [{ stateId: "app.home", path: "/:machineId/play" }, ...]
214
+ * ```
215
+ */
216
+ export const getRouteMappings = (tree, options) => {
217
+ // With the params, resolve the prefix to a concrete path. Without them, keep the
218
+ // pattern, so that a host declares its routes statically and substitutes each param
219
+ // itself.
220
+ const basePath = options?.basePathParams === undefined
221
+ ? normalizeBasePath(options?.basePath)
222
+ : resolveBasePath(options.basePath, options.basePathParams).path;
223
+ return getRoutableRoutes(tree).map((node) => ({
224
+ stateId: node.stateId,
225
+ path: joinBasePath(basePath, node.fullPath),
226
+ }));
227
+ };
169
228
  //# sourceMappingURL=query.js.map
package/dist/query.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"query.js","sourceRoot":"","sources":["../src/query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGnE;;;;;;;GAOG;AACH,MAAM,qBAAqB,GAAG,CAC7B,KAA8C,EAC9C,OAAe,EACgB,EAAE;AACjC,kFAAkF;AAClF,kFAAkF;AAClF,4EAA4E;AAC5E,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;IACtB,CAAC,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IACzE,CAAC,CAAC,EAAE,CAAC;AAEP;;;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