@xmachines/play-solid-router 1.0.0-beta.2 → 1.0.0-beta.20

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 CHANGED
@@ -8,7 +8,7 @@ SolidJS Router adapter using `RouterBridgeBase` for consistent actor↔router sy
8
8
 
9
9
  `@xmachines/play-solid-router` provides seamless integration between SolidJS Router and XMachines state machines. Built on Solid's reactive primitives, it enables zero-adaptation signals synchronization.
10
10
 
11
- Per [RFC Play v1](https://gitlab.com/xmachin-es/rfc/-/blob/main/src/play-v1.md), this package implements:
11
+ Per [Play RFC](../docs/rfc/play.md), this package implements:
12
12
 
13
13
  - **Actor Authority (INV-01):** State machine controls navigation, router reflects decisions
14
14
  - **Passive Infrastructure (INV-04):** Router observes `actor.currentRoute` signal
@@ -36,12 +36,12 @@ npm install @solidjs/router@^0.13.0 solid-js@^1.8.0 @xmachines/play-solid-router
36
36
 
37
37
  **Peer dependencies:**
38
38
 
39
- - `@solidjs/router` ^0.13.0 - SolidJS Router library
40
- - `solid-js` ^1.8.0 - SolidJS runtime
41
- - `@xmachines/play-solid` - Solid renderer (`PlayRenderer`)
42
- - `@xmachines/play-actor` - Actor base
43
- - `@xmachines/play-router` - Route extraction
44
- - `@xmachines/play-signals` - TC39 Signals polyfill
39
+ - `@solidjs/router` ^0.13.0 SolidJS Router library
40
+ - `solid-js` ^1.8.0 SolidJS runtime
41
+ - `@xmachines/play-solid` Solid renderer (`PlayRenderer`)
42
+ - `@xmachines/play-actor` Actor base
43
+ - `@xmachines/play-router` Route extraction
44
+ - `@xmachines/play-signals` TC39 Signals primitives
45
45
 
46
46
  ## Quick Start
47
47
 
@@ -130,6 +130,8 @@ class SolidRouterBridge {
130
130
  - `disconnect()` - Stop synchronization and cleanup bridge resources.
131
131
  - `dispose()` - Alias of `disconnect()`.
132
132
 
133
+ `connect()` creates a Solid-owned router watcher, and `disconnect()`/`dispose()` tears it down immediately. Do not rely on owner unmount alone if you need the bridge to stop processing router updates earlier.
134
+
133
135
  **Internal Behavior:**
134
136
 
135
137
  - Uses `RouterBridgeBase` TC39 watcher lifecycle for actor→router synchronization
@@ -142,35 +144,39 @@ class SolidRouterBridge {
142
144
 
143
145
  Bidirectional mapping between XMachines state IDs and SolidJS Router paths with pattern matching support.
144
146
 
145
- **Type Signature:**
147
+ `RouteMap` extends `BaseRouteMap` from `@xmachines/play-router`, inheriting bucket-indexed
148
+ bidirectional route matching. No routing logic lives in the adapter itself.
146
149
 
147
150
  ```typescript
148
151
  interface RouteMapping {
149
- stateId: string;
150
- path: string;
152
+ readonly stateId: string;
153
+ readonly path: string;
151
154
  }
152
155
 
153
- class RouteMap {
154
- constructor(mappings: RouteMapping[]);
155
- getPath(stateId: string, params?: Record<string, string>): string | undefined;
156
- getStateIdByPath(path: string): string | undefined;
157
- }
156
+ // RouteMap is a thin subclass of BaseRouteMap — no extra methods
157
+ class RouteMap extends BaseRouteMap {}
158
+
159
+ // Inherited API:
160
+ routeMap.getStateIdByPath(path: string): string | null
161
+ routeMap.getPathByStateId(stateId: string): string | null
158
162
  ```
159
163
 
164
+ `getStateIdByPath` and `getPathByStateId` both return `null` (not `undefined`) for misses.
165
+
160
166
  **Constructor Parameters:**
161
167
 
162
- - `mappings` - Array of mapping objects with:
163
- - `stateId` - State machine state ID (e.g., `'#profile'`)
164
- - `path` - SolidJS Router path pattern (e.g., `'/profile/:userId'`)
168
+ - `mappings` - Array of `{ stateId, path }` entries:
169
+ - `stateId` State machine state ID (e.g., `'#profile'`)
170
+ - `path` SolidJS Router path pattern (e.g., `'/profile/:userId'`)
165
171
 
166
172
  **Methods:**
167
173
 
168
- - `getPath(stateId, params?)` - Find path from state ID, optionally substitute params
169
- - `getStateIdByPath(path)` - Find state ID from path with pattern matching (supports `:param` and `:param?` syntax)
174
+ - `getPathByStateId(stateId)` Find path pattern from state ID
175
+ - `getStateIdByPath(path)` Find state ID from path with pattern matching (supports `:param` and `:param?` syntax)
170
176
 
171
177
  **Pattern Matching:**
172
178
 
173
- Uses URLPattern API for robust dynamic route matching:
179
+ Uses bucket-indexed RegExp matching for dynamic routes:
174
180
 
175
181
  ```typescript
176
182
  const routeMap = new RouteMap([{ stateId: "#settings", path: "/settings/:section?" }]);
@@ -178,6 +184,7 @@ const routeMap = new RouteMap([{ stateId: "#settings", path: "/settings/:section
178
184
  routeMap.getStateIdByPath("/settings"); // '#settings'
179
185
  routeMap.getStateIdByPath("/settings/account"); // '#settings'
180
186
  routeMap.getStateIdByPath("/settings/privacy"); // '#settings'
187
+ routeMap.getStateIdByPath("/other"); // null
181
188
  ```
182
189
 
183
190
  ## Examples
@@ -186,8 +193,20 @@ routeMap.getStateIdByPath("/settings/privacy"); // '#settings'
186
193
 
187
194
  ```typescript
188
195
  import { Router, Route } from '@solidjs/router';
189
- import { createSignal } from 'solid-js';
190
- import { defineCatalog } from '@xmachines/play-catalog';
196
+ import { defineCatalog } from "@json-render/core";
197
+ import { schema } from "@json-render/react/schema";
198
+ import { defineRegistry } from "@xmachines/play-solid";
199
+ import { z } from "zod";
200
+
201
+ // Catalog and registry
202
+ const appCatalog = defineCatalog(schema, {
203
+ components: {
204
+ Home: { props: z.object({}) },
205
+ About: { props: z.object({}) },
206
+ Contact: { props: z.object({}) },
207
+ },
208
+ });
209
+ const registry = defineRegistry(appCatalog, { components: { Home, About, Contact } });
191
210
 
192
211
  // State machine with 3 states
193
212
  const appMachine = setup({
@@ -210,12 +229,6 @@ const appMachine = setup({
210
229
  }
211
230
  });
212
231
 
213
- const catalog = defineCatalog({
214
- Home,
215
- About,
216
- Contact,
217
- });
218
-
219
232
  // Component setup
220
233
  function App() {
221
234
  const navigate = useNavigate();
@@ -224,7 +237,7 @@ function App() {
224
237
 
225
238
  const routeMap = createRouteMap(appMachine);
226
239
 
227
- const createPlayer = definePlayer({ machine: appMachine, catalog });
240
+ const createPlayer = definePlayer({ machine: appMachine, catalog: appCatalog });
228
241
  const actor = createPlayer();
229
242
  actor.start();
230
243
  const bridge = new SolidRouterBridge(navigate, location, params, actor, routeMap);
@@ -246,7 +259,18 @@ function App() {
246
259
  ```typescript
247
260
  // State machine with parameter routes
248
261
  import { formatPlayRouteTransitions } from "@xmachines/play-xstate";
249
- import { defineCatalog } from "@xmachines/play-catalog";
262
+ import { defineCatalog } from "@json-render/core";
263
+ import { schema } from "@json-render/react/schema";
264
+ import { defineRegistry } from "@xmachines/play-solid";
265
+ import { z } from "zod";
266
+
267
+ const appCatalog = defineCatalog(schema, {
268
+ components: {
269
+ Profile: { props: z.object({ userId: z.string() }) },
270
+ Settings: { props: z.object({ section: z.string().optional() }) },
271
+ },
272
+ });
273
+ const registry = defineRegistry(appCatalog, { components: { Profile, Settings } });
250
274
 
251
275
  const machineConfig = {
252
276
  id: 'app',
@@ -274,11 +298,6 @@ const appMachine = setup({
274
298
  }
275
299
  }).createMachine(formatPlayRouteTransitions(machineConfig));
276
300
 
277
- const catalog = defineCatalog({
278
- Profile,
279
- Settings,
280
- });
281
-
282
301
  // Router with dynamic routes
283
302
  function App() {
284
303
  const navigate = useNavigate();
@@ -287,7 +306,7 @@ function App() {
287
306
 
288
307
  const routeMap = createRouteMap(appMachine);
289
308
 
290
- const createPlayer = definePlayer({ machine: appMachine, catalog });
309
+ const createPlayer = definePlayer({ machine: appMachine, catalog: appCatalog });
291
310
  const actor = createPlayer();
292
311
  actor.start();
293
312
  const bridge = new SolidRouterBridge(navigate, location, params, actor, routeMap);
@@ -328,7 +347,17 @@ function ProfileButton(props: { userId: string }) {
328
347
  ```typescript
329
348
  // State machine with query param handling
330
349
  import { formatPlayRouteTransitions } from "@xmachines/play-xstate";
331
- import { defineCatalog } from "@xmachines/play-catalog";
350
+ import { defineCatalog } from "@json-render/core";
351
+ import { schema } from "@json-render/react/schema";
352
+ import { defineRegistry } from "@xmachines/play-solid";
353
+ import { z } from "zod";
354
+
355
+ const searchCatalog = defineCatalog(schema, {
356
+ components: {
357
+ Search: { props: z.object({ query: z.string().optional() }) },
358
+ },
359
+ });
360
+ const registry = defineRegistry(searchCatalog, { components: { Search } });
332
361
 
333
362
  const machineConfig = {
334
363
  context: { query: '', filters: {} },
@@ -349,11 +378,7 @@ const searchMachine = setup({
349
378
  }
350
379
  }).createMachine(formatPlayRouteTransitions(machineConfig));
351
380
 
352
- const catalog = defineCatalog({
353
- Search,
354
- });
355
-
356
- const player = definePlayer({ machine: searchMachine, catalog });
381
+ const player = definePlayer({ machine: searchMachine, catalog: searchCatalog });
357
382
 
358
383
  // Component sends query params
359
384
  function SearchBar(props) {
@@ -387,7 +412,19 @@ function SearchBar(props) {
387
412
 
388
413
  ```typescript
389
414
  // State machine with auth guards
390
- import { defineCatalog } from "@xmachines/play-catalog";
415
+ import { defineCatalog } from "@json-render/core";
416
+ import { schema } from "@json-render/react/schema";
417
+ import { defineRegistry } from "@xmachines/play-solid";
418
+ import { z } from "zod";
419
+
420
+ const authCatalog = defineCatalog(schema, {
421
+ components: {
422
+ Home: { props: z.object({}) },
423
+ Login: { props: z.object({ title: z.string() }) },
424
+ Dashboard: { props: z.object({ username: z.string() }) },
425
+ },
426
+ });
427
+ const registry = defineRegistry(authCatalog, { components: { Home, Login, Dashboard } });
391
428
 
392
429
  const authMachine = setup({
393
430
  types: {
@@ -420,13 +457,7 @@ const authMachine = setup({
420
457
  },
421
458
  });
422
459
 
423
- const catalog = defineCatalog({
424
- Home,
425
- Login,
426
- Dashboard,
427
- });
428
-
429
- const player = definePlayer({ machine: authMachine, catalog });
460
+ const player = definePlayer({ machine: authMachine, catalog: authCatalog });
430
461
  ```
431
462
 
432
463
  **Guard behavior:**
@@ -479,7 +510,7 @@ function App() {
479
510
  2. `actor.currentRoute` signal updates
480
511
  3. `createEffect(on(...))` fires with new route value
481
512
  4. Bridge extracts state ID from signal
482
- 5. Bridge looks up path via `routeMap.getPath(stateId, params)`
513
+ 5. Bridge looks up path via `routeMap.getPathByStateId(stateId)`
483
514
  6. Bridge calls `navigate(path)`
484
515
  7. SolidJS Router updates URL and renders component
485
516
 
@@ -603,15 +634,11 @@ function App() {
603
634
 
604
635
  ### Pattern Matching for Dynamic Routes
605
636
 
606
- **URLPattern API integration:**
637
+ **Bucket-indexed matching via `BaseRouteMap`:**
607
638
 
608
- ```typescript
609
- private matchesPattern(path: string, pattern: string): boolean {
610
- // Use URLPattern for robust matching
611
- const urlPattern = new URLPattern({ pathname: pattern });
612
- return urlPattern.test({ pathname: path });
613
- }
614
- ```
639
+ Routes are grouped by their first path segment into buckets. On each lookup only the
640
+ relevant bucket (plus the wildcard `*` bucket for `:param`-first routes) is scanned —
641
+ typically far fewer than all registered routes.
615
642
 
616
643
  **Supported syntax:**
617
644
 
@@ -634,4 +661,7 @@ routeMap.getStateIdByPath("/settings/privacy"); // '#settings'
634
661
 
635
662
  ## License
636
663
 
637
- MIT
664
+ Copyright (c) 2016 [Mikael Karon](mailto:mikael@karon.se). All rights reserved.
665
+
666
+ This work is licensed under the terms of the MIT license.
667
+ For a copy, see <https://opensource.org/licenses/MIT>.
@@ -2,6 +2,7 @@ import { type JSX } from "solid-js";
2
2
  import type { AbstractActor, Routable, Viewable } from "@xmachines/play-actor";
3
3
  import type { AnyActorLogic } from "xstate";
4
4
  import type { RouteMap } from "./route-map.js";
5
+ /** Minimum actor shape accepted by PlayRouterProvider. */
5
6
  export type RoutableActor = AbstractActor<AnyActorLogic> & Routable & Viewable;
6
7
  export type SolidRouterHooks = {
7
8
  navigate: ((path: string) => void) | ((path: string, ...args: unknown[]) => unknown);
@@ -11,11 +12,12 @@ export type SolidRouterHooks = {
11
12
  };
12
13
  params: Record<string, string | undefined>;
13
14
  };
14
- export interface PlayRouterProviderProps {
15
- actor: RoutableActor;
15
+ export interface PlayRouterProviderProps<TActor extends RoutableActor = RoutableActor> {
16
+ actor: TActor;
16
17
  routeMap: RouteMap;
17
18
  router: SolidRouterHooks;
18
- renderer: (actor: RoutableActor, router: SolidRouterHooks) => JSX.Element;
19
+ /** Renderer callback receives the same concrete actor type that was passed in. */
20
+ renderer: (actor: TActor, router: SolidRouterHooks) => JSX.Element;
19
21
  }
20
- export declare function PlayRouterProvider(props: PlayRouterProviderProps): any;
22
+ export declare function PlayRouterProvider<TActor extends RoutableActor>(props: PlayRouterProviderProps<TActor>): any;
21
23
  //# 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;AAE5C,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,gBAAgB,GAAG;IAC9B,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;IACrF,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;CAC3C,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,gBAAgB,KAAK,GAAG,CAAC,OAAO,CAAC;CAC1E;AAED,wBAAgB,kBAAkB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-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;AAG/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAiB7D,MAAM,UAAU,kBAAkB,CAAC,KAA8B;IAChE,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"}
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;AAG/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAoB7D,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"}
@@ -1,75 +1,27 @@
1
1
  /**
2
- * RouteMap for bidirectional state ID ↔ path mapping
2
+ * Bidirectional route mapper for SolidJS Router.
3
3
  *
4
- * Provides efficient lookup between XMachines state IDs and SolidJS Router paths.
5
- * Supports pattern matching for dynamic routes with parameters.
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
+ * ```
6
23
  */
7
- import type { RouteMapping } from "./types.js";
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 undefined if not found
31
- *
32
- * @example
33
- * ```typescript
34
- * routeMap.getPath('#profile'); // '/profile/:userId'
35
- * ```
36
- */
37
- getPath(stateId: string): string | undefined;
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 undefined 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 | undefined;
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
@@ -1 +1 @@
1
- {"version":3,"file":"route-map.d.ts","sourceRoot":"","sources":["../src/route-map.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,qBAAa,QAAQ;IACpB,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,WAAW,CAA6B;IAEhD;;;;;;;;;;;;;OAaG;gBACS,QAAQ,EAAE,YAAY,EAAE;IAOpC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI5C;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAmBlD;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,cAAc;CAetB"}
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
- * RouteMap for bidirectional state ID ↔ path mapping
2
+ * Bidirectional route mapper for SolidJS Router.
3
3
  *
4
- * Provides efficient lookup between XMachines state IDs and SolidJS Router paths.
5
- * Supports pattern matching for dynamic routes with parameters.
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
+ * ```
6
23
  */
7
- export class RouteMap {
8
- stateToPath = new Map();
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 undefined if not found
35
- *
36
- * @example
37
- * ```typescript
38
- * routeMap.getPath('#profile'); // '/profile/:userId'
39
- * ```
40
- */
41
- getPath(stateId) {
42
- return this.stateToPath.get(stateId);
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 undefined 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 undefined;
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
@@ -1 +1 @@
1
- {"version":3,"file":"route-map.js","sourceRoot":"","sources":["../src/route-map.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,OAAO,QAAQ;IACZ,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD;;;;;;;;;;;;;OAaG;IACH,YAAY,QAAwB;QACnC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;YACtC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACpC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACH,OAAO,CAAC,OAAe;QACtB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,gBAAgB,CAAC,IAAY;QAC5B,oDAAoD;QACpD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAEnD,oCAAoC;QACpC,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACrC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;QAED,iCAAiC;QACjC,KAAK,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnD,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC7C,OAAO,OAAO,CAAC;YAChB,CAAC;QACF,CAAC;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACK,cAAc,CAAC,IAAY,EAAE,OAAe;QACnD,iCAAiC;QACjC,8EAA8E;QAC9E,IAAI,YAAY,GAAG,OAAO;YACzB,2EAA2E;aAC1E,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC;YACxC,wCAAwC;aACvC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QAEnC,8BAA8B;QAC9B,YAAY,GAAG,GAAG,GAAG,YAAY,GAAG,GAAG,CAAC;QAExC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;QACvC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;CACD"}
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"}
@@ -44,6 +44,7 @@ import type { RouteMap } from "./route-map.js";
44
44
  export declare class SolidRouterBridge extends RouterBridgeBase {
45
45
  private readonly solidNavigate;
46
46
  private readonly location;
47
+ private disposeRouterWatcher;
47
48
  /**
48
49
  * Create a SolidJS Router bridge
49
50
  *
@@ -55,7 +56,7 @@ export declare class SolidRouterBridge extends RouterBridgeBase {
55
56
  * @param actor - XMachines actor instance
56
57
  * @param routeMap - Bidirectional state ID ↔ path mapping
57
58
  */
58
- constructor(solidNavigate: ((path: string) => void) | ((path: string, ...args: unknown[]) => unknown), location: {
59
+ constructor(solidNavigate: (path: string, ...args: unknown[]) => unknown, location: {
59
60
  pathname: string;
60
61
  search: string;
61
62
  }, _params: Record<string, string | undefined>, actor: AbstractActor<AnyActorLogic> & Routable, routeMap: RouteMap);
@@ -63,6 +64,10 @@ export declare class SolidRouterBridge extends RouterBridgeBase {
63
64
  * Navigate SolidJS Router to the given path.
64
65
  */
65
66
  protected navigateRouter(path: string): void;
67
+ /**
68
+ * Get the current router pathname for initial URL -> actor sync on connect.
69
+ */
70
+ protected getInitialRouterPath(): string | null;
66
71
  /**
67
72
  * Subscribe to SolidJS Router location changes using createEffect.
68
73
  *
@@ -74,7 +79,6 @@ export declare class SolidRouterBridge extends RouterBridgeBase {
74
79
  * Stop watching SolidJS Router changes.
75
80
  *
76
81
  * Solid auto-cleans createEffect subscriptions when component unmounts.
77
- * This sets the processing flag to prevent pending operations.
78
82
  */
79
83
  protected unwatchRouterChanges(): void;
80
84
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"solid-router-bridge.d.ts","sourceRoot":"","sources":["../src/solid-router-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,gBAAgB;IAarD,OAAO,CAAC,QAAQ,CAAC,aAAa;I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IAEzD;;;;;;;;;;OAUG;gBAEe,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,EAC5D,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAC/D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC3C,KAAK,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,QAAQ,EAC9C,QAAQ,EAAE,QAAQ;IAQnB;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI5C;;OAEG;cACgB,oBAAoB,IAAI,MAAM,GAAG,IAAI;IAIxD;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,IAAI,IAAI;IAepC;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,IAAI,IAAI;IAKtC;;;;;;;OAOG;IACH,OAAO,IAAI,IAAI;CAGf"}
@@ -30,7 +30,7 @@
30
30
  * }
31
31
  * ```
32
32
  */
33
- import { createEffect, on } from "solid-js";
33
+ import { createEffect, createRoot, on } from "solid-js";
34
34
  import { RouterBridgeBase } from "@xmachines/play-router";
35
35
  /**
36
36
  * SolidJS Router integration bridge extending RouterBridgeBase
@@ -42,6 +42,7 @@ import { RouterBridgeBase } from "@xmachines/play-router";
42
42
  export class SolidRouterBridge extends RouterBridgeBase {
43
43
  solidNavigate;
44
44
  location;
45
+ disposeRouterWatcher = null;
45
46
  /**
46
47
  * Create a SolidJS Router bridge
47
48
  *
@@ -56,7 +57,7 @@ export class SolidRouterBridge extends RouterBridgeBase {
56
57
  constructor(solidNavigate, location, _params, actor, routeMap) {
57
58
  super(actor, {
58
59
  getStateIdByPath: (path) => routeMap.getStateIdByPath(path),
59
- getPathByStateId: (id) => routeMap.getPath(id),
60
+ getPathByStateId: (id) => routeMap.getPathByStateId(id),
60
61
  });
61
62
  this.solidNavigate = solidNavigate;
62
63
  this.location = location;
@@ -67,6 +68,12 @@ export class SolidRouterBridge extends RouterBridgeBase {
67
68
  navigateRouter(path) {
68
69
  this.solidNavigate(path);
69
70
  }
71
+ /**
72
+ * Get the current router pathname for initial URL -> actor sync on connect.
73
+ */
74
+ getInitialRouterPath() {
75
+ return this.location.pathname ?? null;
76
+ }
70
77
  /**
71
78
  * Subscribe to SolidJS Router location changes using createEffect.
72
79
  *
@@ -74,23 +81,22 @@ export class SolidRouterBridge extends RouterBridgeBase {
74
81
  * Solid auto-cleans createEffect subscriptions on component unmount.
75
82
  */
76
83
  watchRouterChanges() {
77
- // MUST be called inside Solid reactive owner (component or createRoot)
78
- // createEffect in watchRouterChanges() relies on Solid's reactive system
79
- createEffect(on(() => this.location.pathname, (pathname) => {
80
- const search = this.location.search ?? "";
81
- this.syncActorFromRouter(pathname, search);
82
- }));
84
+ this.disposeRouterWatcher = createRoot((dispose) => {
85
+ createEffect(on(() => this.location.pathname, (pathname) => {
86
+ const search = this.location.search ?? "";
87
+ this.syncActorFromRouter(pathname, search);
88
+ }));
89
+ return dispose;
90
+ });
83
91
  }
84
92
  /**
85
93
  * Stop watching SolidJS Router changes.
86
94
  *
87
95
  * Solid auto-cleans createEffect subscriptions when component unmounts.
88
- * This sets the processing flag to prevent pending operations.
89
96
  */
90
97
  unwatchRouterChanges() {
91
- // Solid auto-cleans createEffect on component unmount
92
- // Set flag to prevent any pending operations
93
- this.isProcessingNavigation = true;
98
+ this.disposeRouterWatcher?.();
99
+ this.disposeRouterWatcher = null;
94
100
  }
95
101
  /**
96
102
  * Dispose the bridge (alias for disconnect).
@@ -1 +1 @@
1
- {"version":3,"file":"solid-router-bridge.js","sourceRoot":"","sources":["../src/solid-router-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,gB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AC5C,CAAC,CACD,CACD,CAAC;YACF,OAAO,OAAO,CAAC;QAChB,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-solid-router",
3
- "version": "1.0.0-beta.2",
3
+ "version": "1.0.0-beta.20",
4
4
  "description": "SolidJS Router adapter for XMachines Universal Player Architecture",
5
5
  "license": "MIT",
6
6
  "author": "XMachines Contributors",
@@ -19,34 +19,40 @@
19
19
  "types": "./dist/index.d.ts",
20
20
  "exports": {
21
21
  ".": {
22
+ "source": "./src/index.ts",
22
23
  "types": "./dist/index.d.ts",
23
24
  "default": "./dist/index.js"
24
25
  }
25
26
  },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
26
30
  "scripts": {
27
31
  "build": "tsc --build",
28
- "test": "vitest run",
32
+ "test": "vitest",
29
33
  "test:watch": "vitest",
30
- "typecheck": "tsc --noEmit",
31
- "clean": "rm -rf dist *.tsbuildinfo",
34
+ "clean": "rm -rf dist *.tsbuildinfo coverage",
32
35
  "prepublishOnly": "npm run build"
33
36
  },
34
37
  "dependencies": {
35
- "@xmachines/play": "1.0.0-beta.2",
36
- "@xmachines/play-actor": "1.0.0-beta.2",
37
- "@xmachines/play-router": "1.0.0-beta.2",
38
- "@xmachines/play-signals": "1.0.0-beta.2"
38
+ "@xmachines/play": "1.0.0-beta.20",
39
+ "@xmachines/play-actor": "1.0.0-beta.20",
40
+ "@xmachines/play-router": "1.0.0-beta.20",
41
+ "@xmachines/play-signals": "1.0.0-beta.20"
39
42
  },
40
43
  "devDependencies": {
41
- "@solidjs/router": "^0.15.4",
42
- "@solidjs/testing-library": "^0.8.0",
43
- "solid-js": "^1.8.0"
44
+ "@solidjs/router": "^0.16.1",
45
+ "@solidjs/testing-library": "^0.8.10",
46
+ "@xmachines/play-xstate": "1.0.0-beta.20",
47
+ "@xmachines/shared": "1.0.0-beta.20",
48
+ "jsdom": "^29.0.1",
49
+ "solid-js": "^1.9.12",
50
+ "vite-plugin-solid": "^2.11.11",
51
+ "vitest": "^4.1.2",
52
+ "xstate": "^5.30.0"
44
53
  },
45
54
  "peerDependencies": {
46
- "@solidjs/router": "^0.15.4",
55
+ "@solidjs/router": "^0.16.1",
47
56
  "solid-js": "^1.8.0"
48
- },
49
- "publishConfig": {
50
- "access": "public"
51
57
  }
52
58
  }