@xmachines/play-tanstack-solid-router 1.0.0-beta.8 → 1.0.0-beta.9
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 +12 -32
- package/dist/play-router-provider.d.ts +1 -1
- package/dist/play-router-provider.d.ts.map +1 -1
- package/dist/route-map.d.ts +22 -70
- package/dist/route-map.d.ts.map +1 -1
- package/dist/route-map.js +22 -102
- package/dist/route-map.js.map +1 -1
- package/dist/types.d.ts +15 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -31,12 +31,12 @@ Per [RFC Play v1](https://gitlab.com/xmachin-es/rfc/-/blob/main/src/play-v1.md),
|
|
|
31
31
|
## Installation
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
npm install @tanstack/solid-router@^1.
|
|
34
|
+
npm install @tanstack/solid-router@^1.108.0 solid-js@^1.8.0 @xmachines/play-tanstack-solid-router @xmachines/play-solid
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
**Peer dependencies:**
|
|
38
38
|
|
|
39
|
-
- `@tanstack/solid-router` ^1.
|
|
39
|
+
- `@tanstack/solid-router` ^1.108.0 - TanStack Solid Router library
|
|
40
40
|
- `solid-js` ^1.8.0 - SolidJS runtime
|
|
41
41
|
- `@xmachines/play-solid` - Solid renderer (`PlayRenderer`)
|
|
42
42
|
- `@xmachines/play-actor` - Actor base
|
|
@@ -47,10 +47,9 @@ npm install @tanstack/solid-router@^1.167.0 solid-js@^1.8.0 @xmachines/play-tans
|
|
|
47
47
|
|
|
48
48
|
```tsx
|
|
49
49
|
import { Router, createRouter } from "@tanstack/solid-router";
|
|
50
|
-
import { PlayTanStackRouterProvider } from "@xmachines/play-tanstack-solid-router";
|
|
50
|
+
import { PlayTanStackRouterProvider, createRouteMap } from "@xmachines/play-tanstack-solid-router";
|
|
51
51
|
import { PlayRenderer } from "@xmachines/play-solid";
|
|
52
52
|
import { definePlayer } from "@xmachines/play-xstate";
|
|
53
|
-
import { extractMachineRoutes } from "@xmachines/play-router";
|
|
54
53
|
import { routeTree as routerRouteTree } from "./routeTree.gen"; // from TanStack
|
|
55
54
|
|
|
56
55
|
function App() {
|
|
@@ -66,8 +65,7 @@ function App() {
|
|
|
66
65
|
const router = createRouter({ routeTree: routerRouteTree });
|
|
67
66
|
|
|
68
67
|
// 3. Create route mapping from machine routes
|
|
69
|
-
const
|
|
70
|
-
const routeMap = createRouteMapFromTree(machineRouteTree);
|
|
68
|
+
const routeMap = createRouteMap(authMachine);
|
|
71
69
|
|
|
72
70
|
return (
|
|
73
71
|
// 4. Wrap with provider to sync actor and router
|
|
@@ -146,24 +144,22 @@ interface PlayTanStackRouterProviderProps {
|
|
|
146
144
|
3. Renders the content returned by the `renderer` function
|
|
147
145
|
4. Calls `bridge.disconnect()` when the component unmounts via `onCleanup`
|
|
148
146
|
|
|
149
|
-
### `
|
|
147
|
+
### `createRouteMap()`
|
|
150
148
|
|
|
151
|
-
Helper to
|
|
149
|
+
Helper to build a `RouteMap` instance directly from an XState machine.
|
|
152
150
|
|
|
153
151
|
**Signature:**
|
|
154
152
|
|
|
155
153
|
```typescript
|
|
156
|
-
function
|
|
154
|
+
function createRouteMap(machine: AnyStateMachine): RouteMap;
|
|
157
155
|
```
|
|
158
156
|
|
|
159
157
|
**Usage:**
|
|
160
158
|
|
|
161
159
|
```typescript
|
|
162
|
-
import {
|
|
163
|
-
import { createRouteMapFromTree } from "@xmachines/play-tanstack-solid-router";
|
|
160
|
+
import { createRouteMap } from "@xmachines/play-tanstack-solid-router";
|
|
164
161
|
|
|
165
|
-
const
|
|
166
|
-
const routeMap = createRouteMapFromTree(routeTree);
|
|
162
|
+
const routeMap = createRouteMap(machine);
|
|
167
163
|
```
|
|
168
164
|
|
|
169
165
|
## Usage Patterns
|
|
@@ -244,27 +240,11 @@ Infrastructure reflects actor state. The router observes `actor.currentRoute` an
|
|
|
244
240
|
|
|
245
241
|
The bridge implements an explicit `dispose()`/`disconnect()` method. `PlayTanStackRouterProvider` wires this automatically to Solid's `onCleanup` hook to prevent memory leaks and duplicate bridge subscriptions in hot-reloading scenarios.
|
|
246
242
|
|
|
247
|
-
##
|
|
243
|
+
## URLPattern Support
|
|
248
244
|
|
|
249
|
-
This package uses the [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern) for robust route pattern matching
|
|
245
|
+
This package uses the [URLPattern API](https://developer.mozilla.org/en-US/docs/Web/API/URLPattern) for robust route pattern matching via `@xmachines/play-router`.
|
|
250
246
|
|
|
251
|
-
**
|
|
252
|
-
|
|
253
|
-
- Safari 17.4+
|
|
254
|
-
- Chrome 95+
|
|
255
|
-
- Firefox 106+
|
|
256
|
-
|
|
257
|
-
**Polyfill Required (Node.js/Tests/Old Browsers):**
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
npm install urlpattern-polyfill
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
```typescript
|
|
264
|
-
if (!globalThis.URLPattern) {
|
|
265
|
-
await import("urlpattern-polyfill");
|
|
266
|
-
}
|
|
267
|
-
```
|
|
247
|
+
URLPattern is available natively on Node.js 24+ and modern browsers (Chrome 95+, Firefox 117+, Safari 16.4+). On older environments, load a polyfill **before** importing this package — see [`@xmachines/play-router` installation](../play-router/README.md#installation) for details.
|
|
268
248
|
|
|
269
249
|
## Related Packages
|
|
270
250
|
|
|
@@ -11,5 +11,5 @@ export interface PlayRouterProviderProps {
|
|
|
11
11
|
routeMap: RouteMap;
|
|
12
12
|
renderer: (actor: RoutableActor, router: TanStackRouterInstance) => JSX.Element;
|
|
13
13
|
}
|
|
14
|
-
export declare function PlayRouterProvider(props: PlayRouterProviderProps):
|
|
14
|
+
export declare function PlayRouterProvider(props: PlayRouterProviderProps): any;
|
|
15
15
|
//# sourceMappingURL=play-router-provider.d.ts.map
|
|
@@ -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;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAExF,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,sBAAsB,KAAK,GAAG,CAAC,OAAO,CAAC;CAChF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,
|
|
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;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC/E,MAAM,MAAM,sBAAsB,GAAG,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAExF,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,sBAAsB,KAAK,GAAG,CAAC,OAAO,CAAC;CAChF;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,OAShE"}
|
package/dist/route-map.d.ts
CHANGED
|
@@ -1,75 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Bidirectional route mapper for TanStack Solid Router.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Extends {@link BaseRouteMap} from `@xmachines/play-router` — all matching logic
|
|
5
|
+
* lives there. This class exists to provide a TanStack Solid Router-specific type
|
|
6
|
+
* name 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-tanstack-solid-router";
|
|
17
|
+
*
|
|
18
|
+
* const routeMap = createRouteMap(machine);
|
|
19
|
+
*
|
|
20
|
+
* routeMap.getStateIdByPath("/profile/123"); // "#profile"
|
|
21
|
+
* routeMap.getPathByStateId("#settings"); // "/settings/:section?"
|
|
22
|
+
* ```
|
|
6
23
|
*/
|
|
7
|
-
import
|
|
8
|
-
export declare class RouteMap {
|
|
9
|
-
private stateToPath;
|
|
10
|
-
private pathToState;
|
|
11
|
-
/**
|
|
12
|
-
* Create a RouteMap with bidirectional mappings
|
|
13
|
-
*
|
|
14
|
-
* @param mappings - Array of state ID to path mappings
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const routeMap = new RouteMap([
|
|
19
|
-
* { stateId: '#home', path: '/' },
|
|
20
|
-
* { stateId: '#profile', path: '/profile/:userId' },
|
|
21
|
-
* { stateId: '#settings', path: '/settings/:section?' }
|
|
22
|
-
* ]);
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
constructor(mappings: RouteMapping[]);
|
|
26
|
-
/**
|
|
27
|
-
* Get path pattern for a state ID
|
|
28
|
-
*
|
|
29
|
-
* @param stateId - XMachines state ID (e.g., '#profile')
|
|
30
|
-
* @returns Path pattern or null if not found
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```typescript
|
|
34
|
-
* routeMap.getPathByStateId('#profile'); // '/profile/:userId'
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
getPathByStateId(stateId: string): string | null;
|
|
38
|
-
/**
|
|
39
|
-
* Get state ID for a path, with pattern matching support
|
|
40
|
-
*
|
|
41
|
-
* Performs exact match first, then fuzzy pattern matching for dynamic routes.
|
|
42
|
-
* Supports both required (:param) and optional (:param?) parameters.
|
|
43
|
-
*
|
|
44
|
-
* @param path - Actual URL path (e.g., '/profile/123')
|
|
45
|
-
* @returns State ID or null if no match found
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* routeMap.getStateIdByPath('/profile/123'); // '#profile'
|
|
50
|
-
* routeMap.getStateIdByPath('/settings'); // '#settings'
|
|
51
|
-
* routeMap.getStateIdByPath('/settings/account'); // '#settings'
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
getStateIdByPath(path: string): string | null;
|
|
55
|
-
/**
|
|
56
|
-
* Check if a path matches a pattern
|
|
57
|
-
*
|
|
58
|
-
* Supports:
|
|
59
|
-
* - Required parameters: :param
|
|
60
|
-
* - Optional parameters: :param?
|
|
61
|
-
*
|
|
62
|
-
* @param path - Actual URL path
|
|
63
|
-
* @param pattern - Route pattern with :param syntax
|
|
64
|
-
* @returns true if path matches pattern
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```typescript
|
|
68
|
-
* matchesPattern('/profile/123', '/profile/:userId'); // true
|
|
69
|
-
* matchesPattern('/settings', '/settings/:section?'); // true
|
|
70
|
-
* matchesPattern('/settings/account', '/settings/:section?'); // true
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
private matchesPattern;
|
|
24
|
+
import { BaseRouteMap } from "@xmachines/play-router";
|
|
25
|
+
export declare class RouteMap extends BaseRouteMap {
|
|
74
26
|
}
|
|
75
27
|
//# sourceMappingURL=route-map.d.ts.map
|
package/dist/route-map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-map.d.ts","sourceRoot":"","sources":["../src/route-map.ts"],"names":[],"mappings":"AAAA
|
|
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
CHANGED
|
@@ -1,107 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Bidirectional route mapper for TanStack Solid Router.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Extends {@link BaseRouteMap} from `@xmachines/play-router` — all matching logic
|
|
5
|
+
* lives there. This class exists to provide a TanStack Solid Router-specific type
|
|
6
|
+
* name 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-tanstack-solid-router";
|
|
17
|
+
*
|
|
18
|
+
* const routeMap = createRouteMap(machine);
|
|
19
|
+
*
|
|
20
|
+
* routeMap.getStateIdByPath("/profile/123"); // "#profile"
|
|
21
|
+
* routeMap.getPathByStateId("#settings"); // "/settings/:section?"
|
|
22
|
+
* ```
|
|
6
23
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
pathToState = new Map();
|
|
10
|
-
/**
|
|
11
|
-
* Create a RouteMap with bidirectional mappings
|
|
12
|
-
*
|
|
13
|
-
* @param mappings - Array of state ID to path mappings
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const routeMap = new RouteMap([
|
|
18
|
-
* { stateId: '#home', path: '/' },
|
|
19
|
-
* { stateId: '#profile', path: '/profile/:userId' },
|
|
20
|
-
* { stateId: '#settings', path: '/settings/:section?' }
|
|
21
|
-
* ]);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
constructor(mappings) {
|
|
25
|
-
mappings.forEach(({ stateId, path }) => {
|
|
26
|
-
this.stateToPath.set(stateId, path);
|
|
27
|
-
this.pathToState.set(path, stateId);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Get path pattern for a state ID
|
|
32
|
-
*
|
|
33
|
-
* @param stateId - XMachines state ID (e.g., '#profile')
|
|
34
|
-
* @returns Path pattern or null if not found
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```typescript
|
|
38
|
-
* routeMap.getPathByStateId('#profile'); // '/profile/:userId'
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
getPathByStateId(stateId) {
|
|
42
|
-
return this.stateToPath.get(stateId) ?? null;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Get state ID for a path, with pattern matching support
|
|
46
|
-
*
|
|
47
|
-
* Performs exact match first, then fuzzy pattern matching for dynamic routes.
|
|
48
|
-
* Supports both required (:param) and optional (:param?) parameters.
|
|
49
|
-
*
|
|
50
|
-
* @param path - Actual URL path (e.g., '/profile/123')
|
|
51
|
-
* @returns State ID or null if no match found
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* ```typescript
|
|
55
|
-
* routeMap.getStateIdByPath('/profile/123'); // '#profile'
|
|
56
|
-
* routeMap.getStateIdByPath('/settings'); // '#settings'
|
|
57
|
-
* routeMap.getStateIdByPath('/settings/account'); // '#settings'
|
|
58
|
-
* ```
|
|
59
|
-
*/
|
|
60
|
-
getStateIdByPath(path) {
|
|
61
|
-
// Strip query string and hash fragment for matching
|
|
62
|
-
const cleanPath = path.split("?")[0].split("#")[0];
|
|
63
|
-
// Direct lookup first (exact match)
|
|
64
|
-
if (this.pathToState.has(cleanPath)) {
|
|
65
|
-
return this.pathToState.get(cleanPath);
|
|
66
|
-
}
|
|
67
|
-
// Fuzzy match for dynamic routes
|
|
68
|
-
for (const [pattern, stateId] of this.pathToState) {
|
|
69
|
-
if (this.matchesPattern(cleanPath, pattern)) {
|
|
70
|
-
return stateId;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Check if a path matches a pattern
|
|
77
|
-
*
|
|
78
|
-
* Supports:
|
|
79
|
-
* - Required parameters: :param
|
|
80
|
-
* - Optional parameters: :param?
|
|
81
|
-
*
|
|
82
|
-
* @param path - Actual URL path
|
|
83
|
-
* @param pattern - Route pattern with :param syntax
|
|
84
|
-
* @returns true if path matches pattern
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* matchesPattern('/profile/123', '/profile/:userId'); // true
|
|
89
|
-
* matchesPattern('/settings', '/settings/:section?'); // true
|
|
90
|
-
* matchesPattern('/settings/account', '/settings/:section?'); // true
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
matchesPattern(path, pattern) {
|
|
94
|
-
// Convert route pattern to regex
|
|
95
|
-
// Process replacements in correct order: optional params first, then required
|
|
96
|
-
let regexPattern = pattern
|
|
97
|
-
// Replace /:param? with optional segment (matches both /value and nothing)
|
|
98
|
-
.replace(/\/:(\w+)\?/g, "(?:/([^/]+))?")
|
|
99
|
-
// Replace /:param with required segment
|
|
100
|
-
.replace(/\/:(\w+)/g, "/([^/]+)");
|
|
101
|
-
// Add anchors for exact match
|
|
102
|
-
regexPattern = "^" + regexPattern + "$";
|
|
103
|
-
const regex = new RegExp(regexPattern);
|
|
104
|
-
return regex.test(path);
|
|
105
|
-
}
|
|
24
|
+
import { BaseRouteMap } from "@xmachines/play-router";
|
|
25
|
+
export class RouteMap extends BaseRouteMap {
|
|
106
26
|
}
|
|
107
27
|
//# sourceMappingURL=route-map.js.map
|
package/dist/route-map.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-map.js","sourceRoot":"","sources":["../src/route-map.ts"],"names":[],"mappings":"AAAA
|
|
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"}
|
package/dist/types.d.ts
CHANGED
|
@@ -3,8 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export type { RouterBridge, PlayRouteEvent } from "@xmachines/play-router";
|
|
5
5
|
export type { AbstractActor } from "@xmachines/play-actor";
|
|
6
|
+
/**
|
|
7
|
+
* A single state ID ↔ path mapping entry for the TanStack Solid Router adapter.
|
|
8
|
+
*
|
|
9
|
+
* Structurally compatible with `BaseRouteMapping` from `@xmachines/play-router`.
|
|
10
|
+
* Fields are `readonly` — entries are immutable once passed to `RouteMap`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* const mapping: RouteMapping = { stateId: "#profile", path: "/profile/:userId" };
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
6
17
|
export interface RouteMapping {
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
/** XMachines state ID (e.g., `"#home"`, `"#profile"`) */
|
|
19
|
+
readonly stateId: string;
|
|
20
|
+
/** TanStack Router path pattern (e.g., `"/"`, `"/profile/:userId"`, `"/settings/:section?"`) */
|
|
21
|
+
readonly path: string;
|
|
9
22
|
}
|
|
10
23
|
//# 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;AAEH,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,MAAM,WAAW,YAAY;IAC5B,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC3E,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gGAAgG;IAChG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmachines/play-tanstack-solid-router",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.9",
|
|
4
4
|
"description": "TanStack Solid Router adapter for XMachines Universal Player Architecture",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "XMachines Contributors",
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
"prepublishOnly": "npm run build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@xmachines/play": "1.0.0-beta.
|
|
39
|
-
"@xmachines/play-actor": "1.0.0-beta.
|
|
40
|
-
"@xmachines/play-router": "1.0.0-beta.
|
|
41
|
-
"@xmachines/play-signals": "1.0.0-beta.
|
|
38
|
+
"@xmachines/play": "1.0.0-beta.9",
|
|
39
|
+
"@xmachines/play-actor": "1.0.0-beta.9",
|
|
40
|
+
"@xmachines/play-router": "1.0.0-beta.9",
|
|
41
|
+
"@xmachines/play-signals": "1.0.0-beta.9"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@solidjs/testing-library": "^0.8.10",
|
|
45
45
|
"@tanstack/solid-router": "^1.167.5",
|
|
46
|
-
"@xmachines/shared": "1.0.0-beta.
|
|
46
|
+
"@xmachines/shared": "1.0.0-beta.9",
|
|
47
47
|
"solid-js": "^1.9.11",
|
|
48
48
|
"vite-plugin-solid": "^2.11.11",
|
|
49
49
|
"vitest": "^4.1.0",
|
|
50
50
|
"xstate": "^5.28.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@tanstack/solid-router": "^1.
|
|
53
|
+
"@tanstack/solid-router": "^1.108.0",
|
|
54
54
|
"solid-js": "^1.8.0"
|
|
55
55
|
}
|
|
56
56
|
}
|