@xmachines/play-solid-router 1.0.0-beta.25 → 1.0.0-beta.27
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/LICENSE +21 -0
- package/README.md +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/play-router-provider.d.ts +21 -7
- package/dist/play-router-provider.d.ts.map +1 -1
- package/dist/play-router-provider.jsx.map +1 -1
- package/dist/solid-router-bridge.d.ts +53 -11
- package/dist/solid-router-bridge.d.ts.map +1 -1
- package/dist/solid-router-bridge.js +60 -7
- package/dist/solid-router-bridge.js.map +1 -1
- package/dist/types.d.ts +0 -15
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/dist/create-route-map.d.ts +0 -25
- package/dist/create-route-map.d.ts.map +0 -1
- package/dist/create-route-map.js +0 -36
- package/dist/create-route-map.js.map +0 -1
- package/dist/route-map.d.ts +0 -27
- package/dist/route-map.d.ts.map +0 -1
- package/dist/route-map.js +0 -27
- package/dist/route-map.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mikael Karon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ class SolidRouterBridge {
|
|
|
126
126
|
|
|
127
127
|
**Methods:**
|
|
128
128
|
|
|
129
|
-
- `connect()` - Start bidirectional synchronization.
|
|
129
|
+
- `connect()` - Start bidirectional synchronization. Both `location.pathname` and `location.search` are forwarded to the actor on first connect, so users arriving on `/profile?tab=posts` have `query: { tab: "posts" }` in the initial `play.route` event.
|
|
130
130
|
- `disconnect()` - Stop synchronization and cleanup bridge resources.
|
|
131
131
|
- `dispose()` - Alias of `disconnect()`.
|
|
132
132
|
|
|
@@ -137,7 +137,7 @@ class SolidRouterBridge {
|
|
|
137
137
|
- Uses `RouterBridgeBase` TC39 watcher lifecycle for actor→router synchronization
|
|
138
138
|
- Updates SolidJS Router via `navigate(path)` when actor state changes
|
|
139
139
|
- Uses `createEffect(on(...))` to watch `location.pathname` signal
|
|
140
|
-
- Sends `play.route` events to actor when user navigates
|
|
140
|
+
- Sends `play.route` events to actor when user navigates, using Solid's pre-parsed `useParams()` for path parameter extraction (no URLPattern polyfill required)
|
|
141
141
|
- Prevents circular updates with path tracking and processing flags
|
|
142
142
|
|
|
143
143
|
### `RouteMap`
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export { SolidRouterBridge } from "./solid-router-bridge.js";
|
|
7
7
|
export { PlayRouterProvider } from "./play-router-provider.js";
|
|
8
8
|
export type { PlayRouterProviderProps, RoutableActor, SolidRouterHooks, } from "./play-router-provider.js";
|
|
9
|
-
export { RouteMap } from "
|
|
10
|
-
export {
|
|
11
|
-
export type {
|
|
9
|
+
export { BaseRouteMap as RouteMap, createRouteMapFromMachine as createRouteMap, type RouteMapping, } from "@xmachines/play-router";
|
|
10
|
+
export type { PlayRouteEvent, RouterBridge } from "./types.js";
|
|
11
|
+
export type { AbstractActor } from "@xmachines/play-actor";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EACX,uBAAuB,EACvB,aAAa,EACb,gBAAgB,GAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EACX,uBAAuB,EACvB,aAAa,EACb,gBAAgB,GAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,YAAY,IAAI,QAAQ,EACxB,yBAAyB,IAAI,cAAc,EAC3C,KAAK,YAAY,GACjB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { SolidRouterBridge } from "./solid-router-bridge.js";
|
|
7
7
|
export { PlayRouterProvider } from "./play-router-provider.js";
|
|
8
|
-
export { RouteMap } from "
|
|
9
|
-
export { createRouteMap } from "./create-route-map.js";
|
|
8
|
+
export { BaseRouteMap as RouteMap, createRouteMapFromMachine as createRouteMap, } from "@xmachines/play-router";
|
|
10
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAM/D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAM/D,OAAO,EACN,YAAY,IAAI,QAAQ,EACxB,yBAAyB,IAAI,cAAc,GAE3C,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import { type JSX } from "solid-js";
|
|
2
|
+
import type { Navigator, Location, Params } from "@solidjs/router";
|
|
2
3
|
import type { AbstractActor, Routable, Viewable } from "@xmachines/play-actor";
|
|
3
4
|
import type { AnyActorLogic } from "xstate";
|
|
4
|
-
import type { RouteMap } from "
|
|
5
|
+
import type { BaseRouteMap as RouteMap } from "@xmachines/play-router";
|
|
5
6
|
/** Minimum actor shape accepted by PlayRouterProvider. */
|
|
6
7
|
export type RoutableActor = AbstractActor<AnyActorLogic> & Routable & Viewable;
|
|
8
|
+
/**
|
|
9
|
+
* The three Solid Router hook results that `PlayRouterProvider` and `SolidRouterBridge`
|
|
10
|
+
* require. Pass these directly from your component's hook calls:
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const navigate = useNavigate(); // → SolidRouterHooks.navigate
|
|
14
|
+
* const location = useLocation(); // → SolidRouterHooks.location
|
|
15
|
+
* const params = useParams(); // → SolidRouterHooks.params
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* - `navigate` — used to push URL changes when the actor's `currentRoute` changes.
|
|
19
|
+
* - `location` — `pathname` and `search` are read at `connect()` time for deep-link sync.
|
|
20
|
+
* Subsequent pathname changes drive router→actor sync via `createEffect`.
|
|
21
|
+
* - `params` — Solid's pre-parsed path parameters for the current route segment. Used
|
|
22
|
+
* directly in `extractParams()` to avoid re-parsing with URLPattern.
|
|
23
|
+
*/
|
|
7
24
|
export type SolidRouterHooks = {
|
|
8
|
-
navigate:
|
|
9
|
-
location:
|
|
10
|
-
|
|
11
|
-
search: string;
|
|
12
|
-
};
|
|
13
|
-
params: Record<string, string | undefined>;
|
|
25
|
+
navigate: Navigator;
|
|
26
|
+
location: Location;
|
|
27
|
+
params: Params;
|
|
14
28
|
};
|
|
15
29
|
export interface PlayRouterProviderProps<TActor extends RoutableActor = RoutableActor> {
|
|
16
30
|
actor: TActor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play-router-provider.d.ts","sourceRoot":"","sources":["../src/play-router-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"play-router-provider.d.ts","sourceRoot":"","sources":["../src/play-router-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,KAAK,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvE,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE/E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,uBAAuB,CAAC,MAAM,SAAS,aAAa,GAAG,aAAa;IACpF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,gBAAgB,CAAC;IACzB,kFAAkF;IAClF,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,KAAK,GAAG,CAAC,OAAO,CAAC;CACnE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,aAAa,EAC9D,KAAK,EAAE,uBAAuB,CAAC,MAAM,CAAC,OAgBtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"play-router-provider.jsx","sourceRoot":"","sources":["../src/play-router-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"play-router-provider.jsx","sourceRoot":"","sources":["../src/play-router-provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,UAAU,CAAC;AAI/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAoC7D,MAAM,UAAU,kBAAkB,CACjC,KAAsC;IAEtC,MAAM,MAAM,GAAG,IAAI,iBAAiB,CACnC,KAAK,CAAC,MAAM,CAAC,QAAQ,EACrB,KAAK,CAAC,MAAM,CAAC,QAAQ,EACrB,KAAK,CAAC,MAAM,CAAC,MAAM,EACnB,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,QAAQ,CACd,CAAC;IACF,MAAM,CAAC,OAAO,EAAE,CAAC;IAEjB,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,CAAC,UAAU,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC;AACzD,CAAC"}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* Uses Solid's native reactive primitives (createEffect) for router→actor direction.
|
|
6
6
|
*
|
|
7
7
|
* **IMPORTANT:** `connect()` MUST be called inside a Solid reactive owner (component
|
|
8
|
-
* or createRoot). The createEffect() in watchRouterChanges()
|
|
9
|
-
*
|
|
8
|
+
* or createRoot). The `createEffect()` in `watchRouterChanges()` runs inside
|
|
9
|
+
* `createRoot()`, which deliberately isolates it from any parent owner — automatic
|
|
10
|
+
* cleanup on component unmount does NOT happen. You MUST call `disconnect()` (or
|
|
11
|
+
* `dispose()`) explicitly, typically in `onCleanup()`.
|
|
10
12
|
*
|
|
11
13
|
* @example
|
|
12
14
|
* ```tsx
|
|
@@ -30,21 +32,32 @@
|
|
|
30
32
|
* }
|
|
31
33
|
* ```
|
|
32
34
|
*/
|
|
35
|
+
import type { Navigator, Params } from "@solidjs/router";
|
|
33
36
|
import { RouterBridgeBase } from "@xmachines/play-router";
|
|
37
|
+
import type { LocationLike } from "@xmachines/play-router";
|
|
34
38
|
import type { AbstractActor, Routable } from "@xmachines/play-actor";
|
|
35
39
|
import type { AnyActorLogic } from "xstate";
|
|
36
|
-
import type { RouteMap } from "
|
|
40
|
+
import type { BaseRouteMap as RouteMap } from "@xmachines/play-router";
|
|
37
41
|
/**
|
|
38
42
|
* SolidJS Router integration bridge extending RouterBridgeBase
|
|
39
43
|
*
|
|
40
44
|
* Implements RouterBridge protocol for SolidJS Router using Solid's reactive
|
|
41
45
|
* primitives. The actor→router direction uses TC39 Signal watcher (from base class).
|
|
42
46
|
* The router→actor direction uses Solid's createEffect for native reactivity.
|
|
47
|
+
*
|
|
48
|
+
* Path parameters are extracted from Solid's `useParams()` reactive proxy rather than
|
|
49
|
+
* re-parsing the URL with URLPattern. This means parameterized routes work without the
|
|
50
|
+
* URLPattern polyfill — Solid's router has already extracted the values.
|
|
43
51
|
*/
|
|
44
52
|
export declare class SolidRouterBridge extends RouterBridgeBase {
|
|
45
53
|
private readonly solidNavigate;
|
|
46
54
|
private readonly location;
|
|
47
55
|
private disposeRouterWatcher;
|
|
56
|
+
/**
|
|
57
|
+
* Live reactive params object from Solid's `useParams()`.
|
|
58
|
+
* Read inside the createEffect callback so it always reflects the current route.
|
|
59
|
+
*/
|
|
60
|
+
private readonly solidParams;
|
|
48
61
|
/**
|
|
49
62
|
* Create a SolidJS Router bridge
|
|
50
63
|
*
|
|
@@ -52,14 +65,28 @@ export declare class SolidRouterBridge extends RouterBridgeBase {
|
|
|
52
65
|
*
|
|
53
66
|
* @param solidNavigate - Result of useNavigate() hook
|
|
54
67
|
* @param location - Result of useLocation() hook
|
|
55
|
-
* @param
|
|
68
|
+
* @param params - Result of useParams() hook — used directly for path parameter extraction,
|
|
69
|
+
* avoiding the URLPattern polyfill requirement for parameterized routes
|
|
56
70
|
* @param actor - XMachines actor instance
|
|
57
71
|
* @param routeMap - Bidirectional state ID ↔ path mapping
|
|
58
72
|
*/
|
|
59
|
-
constructor(solidNavigate:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
constructor(solidNavigate: Navigator, location: LocationLike, params: Params, actor: AbstractActor<AnyActorLogic> & Routable, routeMap: RouteMap);
|
|
74
|
+
/**
|
|
75
|
+
* Extract path parameters using Solid's pre-parsed `useParams()` values.
|
|
76
|
+
*
|
|
77
|
+
* Solid's router has already extracted all named parameters for the matched route
|
|
78
|
+
* segment. Reading `this.solidParams` inside the createEffect callback that drives
|
|
79
|
+
* `syncActorFromRouter` is safe — the reactive proxy always reflects the current
|
|
80
|
+
* route at the time the effect runs.
|
|
81
|
+
*
|
|
82
|
+
* Falls back to URLPattern-based extraction (base class) only when Solid provided
|
|
83
|
+
* no params for this route (i.e. the route has no `:param` segments).
|
|
84
|
+
*
|
|
85
|
+
* @param pathname - The actual URL path (unused — params already extracted by Solid)
|
|
86
|
+
* @param stateId - The matched state ID (unused — params already extracted by Solid)
|
|
87
|
+
* @returns Normalized path parameters with undefined/empty values filtered out
|
|
88
|
+
*/
|
|
89
|
+
protected extractParams(pathname: string, stateId: string): Record<string, string>;
|
|
63
90
|
/**
|
|
64
91
|
* Navigate SolidJS Router to the given path.
|
|
65
92
|
*/
|
|
@@ -68,17 +95,32 @@ export declare class SolidRouterBridge extends RouterBridgeBase {
|
|
|
68
95
|
* Get the current router pathname for initial URL -> actor sync on connect.
|
|
69
96
|
*/
|
|
70
97
|
protected getInitialRouterPath(): string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Return the initial URL search string for query-param forwarding on `connect()`.
|
|
100
|
+
*
|
|
101
|
+
* Reads `this.location.search` from Solid's `useLocation()` reactive object —
|
|
102
|
+
* the same source used by `getInitialRouterPath()`. An empty string (no query
|
|
103
|
+
* params) returns `undefined` so `syncActorFromRouter` produces `query: {}`.
|
|
104
|
+
*/
|
|
105
|
+
protected getInitialRouterSearch(): string | undefined;
|
|
71
106
|
/**
|
|
72
107
|
* Subscribe to SolidJS Router location changes using createEffect.
|
|
73
108
|
*
|
|
74
|
-
* MUST be called inside a Solid reactive owner (component
|
|
75
|
-
*
|
|
109
|
+
* MUST be called inside a Solid reactive owner (component or createRoot).
|
|
110
|
+
*
|
|
111
|
+
* The effect runs inside `createRoot()` to give it a stable owner independent
|
|
112
|
+
* of the calling component's lifecycle — this prevents the effect from being
|
|
113
|
+
* disposed if the component re-renders while the bridge should stay active.
|
|
114
|
+
* The trade-off is that component unmount does NOT automatically clean up the
|
|
115
|
+
* effect; `disconnect()` (or `dispose()`) MUST be called explicitly to avoid a leak.
|
|
76
116
|
*/
|
|
77
117
|
protected watchRouterChanges(): void;
|
|
78
118
|
/**
|
|
79
119
|
* Stop watching SolidJS Router changes.
|
|
80
120
|
*
|
|
81
|
-
*
|
|
121
|
+
* Calls the `dispose` function returned by `createRoot()` in `watchRouterChanges()`,
|
|
122
|
+
* tearing down the reactive effect and freeing the isolated owner. This is the only
|
|
123
|
+
* cleanup path — component unmount does NOT trigger this automatically.
|
|
82
124
|
*/
|
|
83
125
|
protected unwatchRouterChanges(): void;
|
|
84
126
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solid-router-bridge.d.ts","sourceRoot":"","sources":["../src/solid-router-bridge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"solid-router-bridge.d.ts","sourceRoot":"","sources":["../src/solid-router-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvE;;;;;;;;;;GAUG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IAsBrD,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAtB1B,OAAO,CAAC,oBAAoB,CAA6B;IAEzD;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IAErC;;;;;;;;;;;OAWG;gBAEe,aAAa,EAAE,SAAS,EACxB,QAAQ,EAAE,YAAY,EACvC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,QAAQ,EAC9C,QAAQ,EAAE,QAAQ;IASnB;;;;;;;;;;;;;;OAcG;cACgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAY3F;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI5C;;OAEG;cACgB,oBAAoB,IAAI,MAAM,GAAG,IAAI;IAIxD;;;;;;OAMG;cACgB,sBAAsB,IAAI,MAAM,GAAG,SAAS;IAI/D;;;;;;;;;;OAUG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAepC;;;;;;OAMG;IACH,SAAS,CAAC,oBAAoB,IAAI,IAAI;IAKtC;;;;;;;OAOG;IACH,OAAO,IAAI,IAAI;CAGf"}
|
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
* Uses Solid's native reactive primitives (createEffect) for router→actor direction.
|
|
6
6
|
*
|
|
7
7
|
* **IMPORTANT:** `connect()` MUST be called inside a Solid reactive owner (component
|
|
8
|
-
* or createRoot). The createEffect() in watchRouterChanges()
|
|
9
|
-
*
|
|
8
|
+
* or createRoot). The `createEffect()` in `watchRouterChanges()` runs inside
|
|
9
|
+
* `createRoot()`, which deliberately isolates it from any parent owner — automatic
|
|
10
|
+
* cleanup on component unmount does NOT happen. You MUST call `disconnect()` (or
|
|
11
|
+
* `dispose()`) explicitly, typically in `onCleanup()`.
|
|
10
12
|
*
|
|
11
13
|
* @example
|
|
12
14
|
* ```tsx
|
|
@@ -38,11 +40,20 @@ import { RouterBridgeBase } from "@xmachines/play-router";
|
|
|
38
40
|
* Implements RouterBridge protocol for SolidJS Router using Solid's reactive
|
|
39
41
|
* primitives. The actor→router direction uses TC39 Signal watcher (from base class).
|
|
40
42
|
* The router→actor direction uses Solid's createEffect for native reactivity.
|
|
43
|
+
*
|
|
44
|
+
* Path parameters are extracted from Solid's `useParams()` reactive proxy rather than
|
|
45
|
+
* re-parsing the URL with URLPattern. This means parameterized routes work without the
|
|
46
|
+
* URLPattern polyfill — Solid's router has already extracted the values.
|
|
41
47
|
*/
|
|
42
48
|
export class SolidRouterBridge extends RouterBridgeBase {
|
|
43
49
|
solidNavigate;
|
|
44
50
|
location;
|
|
45
51
|
disposeRouterWatcher = null;
|
|
52
|
+
/**
|
|
53
|
+
* Live reactive params object from Solid's `useParams()`.
|
|
54
|
+
* Read inside the createEffect callback so it always reflects the current route.
|
|
55
|
+
*/
|
|
56
|
+
solidParams;
|
|
46
57
|
/**
|
|
47
58
|
* Create a SolidJS Router bridge
|
|
48
59
|
*
|
|
@@ -50,17 +61,42 @@ export class SolidRouterBridge extends RouterBridgeBase {
|
|
|
50
61
|
*
|
|
51
62
|
* @param solidNavigate - Result of useNavigate() hook
|
|
52
63
|
* @param location - Result of useLocation() hook
|
|
53
|
-
* @param
|
|
64
|
+
* @param params - Result of useParams() hook — used directly for path parameter extraction,
|
|
65
|
+
* avoiding the URLPattern polyfill requirement for parameterized routes
|
|
54
66
|
* @param actor - XMachines actor instance
|
|
55
67
|
* @param routeMap - Bidirectional state ID ↔ path mapping
|
|
56
68
|
*/
|
|
57
|
-
constructor(solidNavigate, location,
|
|
69
|
+
constructor(solidNavigate, location, params, actor, routeMap) {
|
|
58
70
|
super(actor, {
|
|
59
71
|
getStateIdByPath: (path) => routeMap.getStateIdByPath(path),
|
|
60
72
|
getPathByStateId: (id) => routeMap.getPathByStateId(id),
|
|
61
73
|
});
|
|
62
74
|
this.solidNavigate = solidNavigate;
|
|
63
75
|
this.location = location;
|
|
76
|
+
this.solidParams = params;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Extract path parameters using Solid's pre-parsed `useParams()` values.
|
|
80
|
+
*
|
|
81
|
+
* Solid's router has already extracted all named parameters for the matched route
|
|
82
|
+
* segment. Reading `this.solidParams` inside the createEffect callback that drives
|
|
83
|
+
* `syncActorFromRouter` is safe — the reactive proxy always reflects the current
|
|
84
|
+
* route at the time the effect runs.
|
|
85
|
+
*
|
|
86
|
+
* Falls back to URLPattern-based extraction (base class) only when Solid provided
|
|
87
|
+
* no params for this route (i.e. the route has no `:param` segments).
|
|
88
|
+
*
|
|
89
|
+
* @param pathname - The actual URL path (unused — params already extracted by Solid)
|
|
90
|
+
* @param stateId - The matched state ID (unused — params already extracted by Solid)
|
|
91
|
+
* @returns Normalized path parameters with undefined/empty values filtered out
|
|
92
|
+
*/
|
|
93
|
+
extractParams(pathname, stateId) {
|
|
94
|
+
const entries = Object.entries(this.solidParams).filter((entry) => entry[1] !== undefined && entry[1] !== null && entry[1] !== "");
|
|
95
|
+
if (entries.length > 0) {
|
|
96
|
+
return Object.fromEntries(entries);
|
|
97
|
+
}
|
|
98
|
+
// No params from Solid — fall back to URLPattern for routes with no segments
|
|
99
|
+
return super.extractParams(pathname, stateId);
|
|
64
100
|
}
|
|
65
101
|
/**
|
|
66
102
|
* Navigate SolidJS Router to the given path.
|
|
@@ -74,11 +110,26 @@ export class SolidRouterBridge extends RouterBridgeBase {
|
|
|
74
110
|
getInitialRouterPath() {
|
|
75
111
|
return this.location.pathname ?? null;
|
|
76
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Return the initial URL search string for query-param forwarding on `connect()`.
|
|
115
|
+
*
|
|
116
|
+
* Reads `this.location.search` from Solid's `useLocation()` reactive object —
|
|
117
|
+
* the same source used by `getInitialRouterPath()`. An empty string (no query
|
|
118
|
+
* params) returns `undefined` so `syncActorFromRouter` produces `query: {}`.
|
|
119
|
+
*/
|
|
120
|
+
getInitialRouterSearch() {
|
|
121
|
+
return this.location.search || undefined;
|
|
122
|
+
}
|
|
77
123
|
/**
|
|
78
124
|
* Subscribe to SolidJS Router location changes using createEffect.
|
|
79
125
|
*
|
|
80
|
-
* MUST be called inside a Solid reactive owner (component
|
|
81
|
-
*
|
|
126
|
+
* MUST be called inside a Solid reactive owner (component or createRoot).
|
|
127
|
+
*
|
|
128
|
+
* The effect runs inside `createRoot()` to give it a stable owner independent
|
|
129
|
+
* of the calling component's lifecycle — this prevents the effect from being
|
|
130
|
+
* disposed if the component re-renders while the bridge should stay active.
|
|
131
|
+
* The trade-off is that component unmount does NOT automatically clean up the
|
|
132
|
+
* effect; `disconnect()` (or `dispose()`) MUST be called explicitly to avoid a leak.
|
|
82
133
|
*/
|
|
83
134
|
watchRouterChanges() {
|
|
84
135
|
this.disposeRouterWatcher = createRoot((dispose) => {
|
|
@@ -92,7 +143,9 @@ export class SolidRouterBridge extends RouterBridgeBase {
|
|
|
92
143
|
/**
|
|
93
144
|
* Stop watching SolidJS Router changes.
|
|
94
145
|
*
|
|
95
|
-
*
|
|
146
|
+
* Calls the `dispose` function returned by `createRoot()` in `watchRouterChanges()`,
|
|
147
|
+
* tearing down the reactive effect and freeing the isolated owner. This is the only
|
|
148
|
+
* cleanup path — component unmount does NOT trigger this automatically.
|
|
96
149
|
*/
|
|
97
150
|
unwatchRouterChanges() {
|
|
98
151
|
this.disposeRouterWatcher?.();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solid-router-bridge.js","sourceRoot":"","sources":["../src/solid-router-bridge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"solid-router-bridge.js","sourceRoot":"","sources":["../src/solid-router-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAM1D;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iBAAkB,SAAQ,gBAAgB;IAsBpC;IACA;IAtBV,oBAAoB,GAAwB,IAAI,CAAC;IAEzD;;;OAGG;IACc,WAAW,CAAS;IAErC;;;;;;;;;;;OAWG;IACH,YACkB,aAAwB,EACxB,QAAsB,EACvC,MAAc,EACd,KAA8C,EAC9C,QAAkB;QAElB,KAAK,CAAC,KAAK,EAAE;YACZ,gBAAgB,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC;YACnE,gBAAgB,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;SAC/D,CAAC,CAAC;QATc,kBAAa,GAAb,aAAa,CAAW;QACxB,aAAQ,GAAR,QAAQ,CAAc;QASvC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACgB,aAAa,CAAC,QAAgB,EAAE,OAAe;QACjE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,CACtD,CAAC,KAAK,EAA6B,EAAE,CACpC,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAC/D,CAAC;QACF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QACD,6EAA6E;QAC7E,OAAO,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,IAAY;QACpC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACgB,oBAAoB;QACtC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,IAAI,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACgB,sBAAsB;QACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,SAAS,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;OAUG;IACO,kBAAkB;QAC3B,IAAI,CAAC,oBAAoB,GAAG,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE;YAClD,YAAY,CACX,EAAE,CACD,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAC5B,CAAC,QAAgB,EAAE,EAAE;gBACpB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;gBAC1C,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC5C,CAAC,CACD,CACD,CAAC;YACF,OAAO,OAAO,CAAC;QAChB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACO,oBAAoB;QAC7B,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC;QAC9B,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAClC,CAAC;IAED;;;;;;;OAOG;IACH,OAAO;QACN,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;CACD"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type definitions for @xmachines/play-solid-router
|
|
3
3
|
*/
|
|
4
|
-
/**
|
|
5
|
-
* Mapping between state ID and URL path for SolidJS Router
|
|
6
|
-
*/
|
|
7
|
-
export interface RouteMapping {
|
|
8
|
-
/**
|
|
9
|
-
* XMachines state ID with # prefix
|
|
10
|
-
* @example '#home', '#profile'
|
|
11
|
-
*/
|
|
12
|
-
readonly stateId: string;
|
|
13
|
-
/**
|
|
14
|
-
* SolidJS Router path pattern
|
|
15
|
-
* @example '/', '/profile/:userId', '/settings/:section?'
|
|
16
|
-
*/
|
|
17
|
-
readonly path: string;
|
|
18
|
-
}
|
|
19
4
|
export type { PlayRouteEvent, RouterBridge } from "@xmachines/play-router";
|
|
20
5
|
export type { AbstractActor } from "@xmachines/play-actor";
|
|
21
6
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmachines/play-solid-router",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.27",
|
|
4
4
|
"description": "SolidJS Router adapter for XMachines Universal Player Architecture",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "XMachines Contributors",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"prepublishOnly": "npm run build"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@xmachines/play": "1.0.0-beta.
|
|
41
|
-
"@xmachines/play-actor": "1.0.0-beta.
|
|
42
|
-
"@xmachines/play-router": "1.0.0-beta.
|
|
43
|
-
"@xmachines/play-signals": "1.0.0-beta.
|
|
40
|
+
"@xmachines/play": "1.0.0-beta.27",
|
|
41
|
+
"@xmachines/play-actor": "1.0.0-beta.27",
|
|
42
|
+
"@xmachines/play-router": "1.0.0-beta.27",
|
|
43
|
+
"@xmachines/play-signals": "1.0.0-beta.27"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@solidjs/router": "^0.16.1",
|
|
47
47
|
"@solidjs/testing-library": "^0.8.10",
|
|
48
|
-
"@xmachines/play-xstate": "1.0.0-beta.
|
|
49
|
-
"@xmachines/shared": "1.0.0-beta.
|
|
48
|
+
"@xmachines/play-xstate": "1.0.0-beta.27",
|
|
49
|
+
"@xmachines/shared": "1.0.0-beta.27",
|
|
50
50
|
"jsdom": "^29.0.1",
|
|
51
51
|
"oxfmt": "^0.43.0",
|
|
52
52
|
"oxlint": "^1.57.0",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create RouteMap helper for SolidJS Router adapter
|
|
3
|
-
*
|
|
4
|
-
* Simplifies demo code by hiding route extraction complexity.
|
|
5
|
-
* Internally calls extractMachineRoutes() and getRoutableRoutes(),
|
|
6
|
-
* then constructs RouteMap with proper state ID ↔ path mappings.
|
|
7
|
-
*/
|
|
8
|
-
import type { AnyStateMachine } from "xstate";
|
|
9
|
-
import { RouteMap } from "./route-map.js";
|
|
10
|
-
/**
|
|
11
|
-
* Create a RouteMap from an XState machine
|
|
12
|
-
*
|
|
13
|
-
* @param machine - XState machine with route: {} config on states
|
|
14
|
-
* @returns RouteMap for bidirectional state ID ↔ path resolution
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { createRouteMap } from '@xmachines/play-solid-router';
|
|
19
|
-
* import { authMachine } from './machine.js';
|
|
20
|
-
*
|
|
21
|
-
* const routeMap = createRouteMap(authMachine);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function createRouteMap(machine: AnyStateMachine): RouteMap;
|
|
25
|
-
//# sourceMappingURL=create-route-map.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-route-map.d.ts","sourceRoot":"","sources":["../src/create-route-map.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,QAAQ,CAcjE"}
|
package/dist/create-route-map.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create RouteMap helper for SolidJS Router adapter
|
|
3
|
-
*
|
|
4
|
-
* Simplifies demo code by hiding route extraction complexity.
|
|
5
|
-
* Internally calls extractMachineRoutes() and getRoutableRoutes(),
|
|
6
|
-
* then constructs RouteMap with proper state ID ↔ path mappings.
|
|
7
|
-
*/
|
|
8
|
-
import { extractMachineRoutes, getRoutableRoutes } from "@xmachines/play-router";
|
|
9
|
-
import { RouteMap } from "./route-map.js";
|
|
10
|
-
/**
|
|
11
|
-
* Create a RouteMap from an XState machine
|
|
12
|
-
*
|
|
13
|
-
* @param machine - XState machine with route: {} config on states
|
|
14
|
-
* @returns RouteMap for bidirectional state ID ↔ path resolution
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* import { createRouteMap } from '@xmachines/play-solid-router';
|
|
19
|
-
* import { authMachine } from './machine.js';
|
|
20
|
-
*
|
|
21
|
-
* const routeMap = createRouteMap(authMachine);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export function createRouteMap(machine) {
|
|
25
|
-
// Extract route tree from machine
|
|
26
|
-
const routeTree = extractMachineRoutes(machine);
|
|
27
|
-
// Get only routable nodes (states with route: {} config)
|
|
28
|
-
const routes = getRoutableRoutes(routeTree);
|
|
29
|
-
// Map to RouteMapping format expected by RouteMap constructor
|
|
30
|
-
const mappings = routes.map((node) => ({
|
|
31
|
-
stateId: node.stateId,
|
|
32
|
-
path: node.fullPath,
|
|
33
|
-
}));
|
|
34
|
-
return new RouteMap(mappings);
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=create-route-map.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-route-map.js","sourceRoot":"","sources":["../src/create-route-map.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,cAAc,CAAC,OAAwB;IACtD,kCAAkC;IAClC,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAEhD,yDAAyD;IACzD,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAE5C,8DAA8D;IAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,IAAI,EAAE,IAAI,CAAC,QAAQ;KACnB,CAAC,CAAC,CAAC;IAEJ,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC"}
|
package/dist/route-map.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bidirectional route mapper for SolidJS Router.
|
|
3
|
-
*
|
|
4
|
-
* Extends {@link BaseRouteMap} from `@xmachines/play-router` — all matching logic
|
|
5
|
-
* lives there. This class exists to provide a SolidJS Router-specific type name
|
|
6
|
-
* and to allow future adapter-specific extensions without breaking the shared base.
|
|
7
|
-
*
|
|
8
|
-
* **Inherited API:**
|
|
9
|
-
* - `getStateIdByPath(path): string | null` — path → state ID
|
|
10
|
-
* - `getPathByStateId(stateId): string | null` — state ID → path pattern
|
|
11
|
-
*
|
|
12
|
-
* @extends BaseRouteMap
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import { createRouteMap } from "@xmachines/play-solid-router";
|
|
17
|
-
*
|
|
18
|
-
* const routeMap = createRouteMap(machine);
|
|
19
|
-
*
|
|
20
|
-
* routeMap.getStateIdByPath("/profile/123"); // "profile"
|
|
21
|
-
* routeMap.getPathByStateId("#settings"); // "/settings/:section?"
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
import { BaseRouteMap } from "@xmachines/play-router";
|
|
25
|
-
export declare class RouteMap extends BaseRouteMap {
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=route-map.d.ts.map
|
package/dist/route-map.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route-map.d.ts","sourceRoot":"","sources":["../src/route-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,qBAAa,QAAS,SAAQ,YAAY;CAAG"}
|
package/dist/route-map.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bidirectional route mapper for SolidJS Router.
|
|
3
|
-
*
|
|
4
|
-
* Extends {@link BaseRouteMap} from `@xmachines/play-router` — all matching logic
|
|
5
|
-
* lives there. This class exists to provide a SolidJS Router-specific type name
|
|
6
|
-
* and to allow future adapter-specific extensions without breaking the shared base.
|
|
7
|
-
*
|
|
8
|
-
* **Inherited API:**
|
|
9
|
-
* - `getStateIdByPath(path): string | null` — path → state ID
|
|
10
|
-
* - `getPathByStateId(stateId): string | null` — state ID → path pattern
|
|
11
|
-
*
|
|
12
|
-
* @extends BaseRouteMap
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* import { createRouteMap } from "@xmachines/play-solid-router";
|
|
17
|
-
*
|
|
18
|
-
* const routeMap = createRouteMap(machine);
|
|
19
|
-
*
|
|
20
|
-
* routeMap.getStateIdByPath("/profile/123"); // "profile"
|
|
21
|
-
* routeMap.getPathByStateId("#settings"); // "/settings/:section?"
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
import { BaseRouteMap } from "@xmachines/play-router";
|
|
25
|
-
export class RouteMap extends BaseRouteMap {
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=route-map.js.map
|
package/dist/route-map.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route-map.js","sourceRoot":"","sources":["../src/route-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,MAAM,OAAO,QAAS,SAAQ,YAAY;CAAG"}
|