@xmachines/play-solid-router 1.0.0-beta.1 → 1.0.0-beta.10

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
@@ -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
 
@@ -142,35 +142,39 @@ class SolidRouterBridge {
142
142
 
143
143
  Bidirectional mapping between XMachines state IDs and SolidJS Router paths with pattern matching support.
144
144
 
145
- **Type Signature:**
145
+ `RouteMap` extends `BaseRouteMap` from `@xmachines/play-router`, inheriting bucket-indexed
146
+ bidirectional route matching. No routing logic lives in the adapter itself.
146
147
 
147
148
  ```typescript
148
149
  interface RouteMapping {
149
- stateId: string;
150
- path: string;
150
+ readonly stateId: string;
151
+ readonly path: string;
151
152
  }
152
153
 
153
- class RouteMap {
154
- constructor(mappings: RouteMapping[]);
155
- getPath(stateId: string, params?: Record<string, string>): string | undefined;
156
- getStateIdByPath(path: string): string | undefined;
157
- }
154
+ // RouteMap is a thin subclass of BaseRouteMap — no extra methods
155
+ class RouteMap extends BaseRouteMap {}
156
+
157
+ // Inherited API:
158
+ routeMap.getStateIdByPath(path: string): string | null
159
+ routeMap.getPathByStateId(stateId: string): string | null
158
160
  ```
159
161
 
162
+ `getStateIdByPath` and `getPathByStateId` both return `null` (not `undefined`) for misses.
163
+
160
164
  **Constructor Parameters:**
161
165
 
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'`)
166
+ - `mappings` - Array of `{ stateId, path }` entries:
167
+ - `stateId` State machine state ID (e.g., `'#profile'`)
168
+ - `path` SolidJS Router path pattern (e.g., `'/profile/:userId'`)
165
169
 
166
170
  **Methods:**
167
171
 
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)
172
+ - `getPathByStateId(stateId)` Find path pattern from state ID
173
+ - `getStateIdByPath(path)` Find state ID from path with pattern matching (supports `:param` and `:param?` syntax)
170
174
 
171
175
  **Pattern Matching:**
172
176
 
173
- Uses URLPattern API for robust dynamic route matching:
177
+ Uses bucket-indexed RegExp matching for dynamic routes:
174
178
 
175
179
  ```typescript
176
180
  const routeMap = new RouteMap([{ stateId: "#settings", path: "/settings/:section?" }]);
@@ -178,6 +182,7 @@ const routeMap = new RouteMap([{ stateId: "#settings", path: "/settings/:section
178
182
  routeMap.getStateIdByPath("/settings"); // '#settings'
179
183
  routeMap.getStateIdByPath("/settings/account"); // '#settings'
180
184
  routeMap.getStateIdByPath("/settings/privacy"); // '#settings'
185
+ routeMap.getStateIdByPath("/other"); // null
181
186
  ```
182
187
 
183
188
  ## Examples
@@ -479,7 +484,7 @@ function App() {
479
484
  2. `actor.currentRoute` signal updates
480
485
  3. `createEffect(on(...))` fires with new route value
481
486
  4. Bridge extracts state ID from signal
482
- 5. Bridge looks up path via `routeMap.getPath(stateId, params)`
487
+ 5. Bridge looks up path via `routeMap.getPathByStateId(stateId)`
483
488
  6. Bridge calls `navigate(path)`
484
489
  7. SolidJS Router updates URL and renders component
485
490
 
@@ -603,15 +608,11 @@ function App() {
603
608
 
604
609
  ### Pattern Matching for Dynamic Routes
605
610
 
606
- **URLPattern API integration:**
611
+ **Bucket-indexed matching via `BaseRouteMap`:**
607
612
 
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
- ```
613
+ Routes are grouped by their first path segment into buckets. On each lookup only the
614
+ relevant bucket (plus the wildcard `*` bucket for `:param`-first routes) is scanned —
615
+ typically far fewer than all registered routes.
615
616
 
616
617
  **Supported syntax:**
617
618
 
@@ -634,4 +635,7 @@ routeMap.getStateIdByPath("/settings/privacy"); // '#settings'
634
635
 
635
636
  ## License
636
637
 
637
- MIT
638
+ Copyright (c) 2016 [Mikael Karon](mailto:mikael@karon.se). All rights reserved.
639
+
640
+ This work is licensed under the terms of the MIT license.
641
+ For a copy, see <https://opensource.org/licenses/MIT>.
@@ -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;Y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C,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"}
@@ -55,7 +55,7 @@ export declare class SolidRouterBridge extends RouterBridgeBase {
55
55
  * @param actor - XMachines actor instance
56
56
  * @param routeMap - Bidirectional state ID ↔ path mapping
57
57
  */
58
- constructor(solidNavigate: ((path: string) => void) | ((path: string, ...args: unknown[]) => unknown), location: {
58
+ constructor(solidNavigate: (path: string, ...args: unknown[]) => unknown, location: {
59
59
  pathname: string;
60
60
  search: string;
61
61
  }, _params: Record<string, string | undefined>, actor: AbstractActor<AnyActorLogic> & Routable, routeMap: RouteMap);
@@ -63,6 +63,10 @@ export declare class SolidRouterBridge extends RouterBridgeBase {
63
63
  * Navigate SolidJS Router to the given path.
64
64
  */
65
65
  protected navigateRouter(path: string): void;
66
+ /**
67
+ * Get the current router pathname for initial URL -> actor sync on connect.
68
+ */
69
+ protected getInitialRouterPath(): string | null;
66
70
  /**
67
71
  * Subscribe to SolidJS Router location changes using createEffect.
68
72
  *
@@ -74,7 +78,6 @@ export declare class SolidRouterBridge extends RouterBridgeBase {
74
78
  * Stop watching SolidJS Router changes.
75
79
  *
76
80
  * Solid auto-cleans createEffect subscriptions when component unmounts.
77
- * This sets the processing flag to prevent pending operations.
78
81
  */
79
82
  protected unwatchRouterChanges(): void;
80
83
  /**
@@ -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;AAC1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AAO,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;IAC9B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAb1B;;;;;;;;;;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;IAcpC;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,IAAI,IAAI;IAItC;;;;;;;OAOG;IACH,OAAO,IAAI,IAAI;CAGf"}
@@ -56,7 +56,7 @@ export class SolidRouterBridge extends RouterBridgeBase {
56
56
  constructor(solidNavigate, location, _params, actor, routeMap) {
57
57
  super(actor, {
58
58
  getStateIdByPath: (path) => routeMap.getStateIdByPath(path),
59
- getPathByStateId: (id) => routeMap.getPath(id),
59
+ getPathByStateId: (id) => routeMap.getPathByStateId(id),
60
60
  });
61
61
  this.solidNavigate = solidNavigate;
62
62
  this.location = location;
@@ -67,6 +67,12 @@ export class SolidRouterBridge extends RouterBridgeBase {
67
67
  navigateRouter(path) {
68
68
  this.solidNavigate(path);
69
69
  }
70
+ /**
71
+ * Get the current router pathname for initial URL -> actor sync on connect.
72
+ */
73
+ getInitialRouterPath() {
74
+ return this.location.pathname ?? null;
75
+ }
70
76
  /**
71
77
  * Subscribe to SolidJS Router location changes using createEffect.
72
78
  *
@@ -85,12 +91,9 @@ export class SolidRouterBridge extends RouterBridgeBase {
85
91
  * Stop watching SolidJS Router changes.
86
92
  *
87
93
  * Solid auto-cleans createEffect subscriptions when component unmounts.
88
- * This sets the processing flag to prevent pending operations.
89
94
  */
90
95
  unwatchRouterChanges() {
91
- // Solid auto-cleans createEffect on component unmount
92
- // Set flag to prevent any pending operations
93
- this.isProcessingNavigation = true;
96
+ // Solid auto-cleans createEffect on component unmount.
94
97
  }
95
98
  /**
96
99
  * 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,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAK1D;;;;;;GAMG;AACH,MAAM,OAAO,iBAAkB,SAAQ,gBAAgB;IAapC;IAGA;IAflB;;;;;;;;;;OAUG;IACH,YACkB,aAEiC,EACjC,QAA8C,EAC/D,OAA2C,EAC3C,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,OAAO,CAAC,EAAE,CAAC;SACtD,CAAC,CAAC;QAXc,kBAAa,GAAb,aAAa,CAEoB;QACjC,aAAQ,GAAR,QAAQ,CAAsC;IAShE,CAAC;IAED;;OAEG;IACO,c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AC,EAAE,CAAC;SAC/D,CAAC,CAAC;QATc,kBAAa,GAAb,aAAa,CAA+C;QAC5D,aAAQ,GAAR,QAAQ,CAAsC;IAShE,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;;;;;OAKG;IACO,kBAAkB;QAC3B,uEAAuE;QACvE,yEAAyE;QACzE,YAAY,CACX,EAAE,CACD,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAC5B,CAAC,QAAgB,EAAE,EAAE;YACpB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC;YAC1C,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC5C,CAAC,CACD,CACD,CAAC;IACH,CAAC;IAED;;;;OAIG;IACO,oBAAoB;QAC7B,uDAAuD;IACxD,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.1",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "SolidJS Router adapter for XMachines Universal Player Architecture",
5
5
  "license": "MIT",
6
6
  "author": "XMachines Contributors",
@@ -11,7 +11,8 @@
11
11
  },
12
12
  "files": [
13
13
  "dist",
14
- "README.md"
14
+ "README.md",
15
+ "LICENSE"
15
16
  ],
16
17
  "type": "module",
17
18
  "main": "./dist/index.js",
@@ -22,30 +23,35 @@
22
23
  "default": "./dist/index.js"
23
24
  }
24
25
  },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
25
29
  "scripts": {
26
30
  "build": "tsc --build",
27
- "test": "vitest run",
31
+ "test": "vitest",
28
32
  "test:watch": "vitest",
29
33
  "typecheck": "tsc --noEmit",
30
- "clean": "rm -rf dist *.tsbuildinfo",
34
+ "clean": "rm -rf dist *.tsbuildinfo node_modules/.vite node_modules/.vite-temp",
31
35
  "prepublishOnly": "npm run build"
32
36
  },
33
37
  "dependencies": {
34
- "@xmachines/play": "1.0.0-beta.1",
35
- "@xmachines/play-actor": "1.0.0-beta.1",
36
- "@xmachines/play-router": "1.0.0-beta.1",
37
- "@xmachines/play-signals": "1.0.0-beta.1"
38
+ "@xmachines/play": "1.0.0-beta.10",
39
+ "@xmachines/play-actor": "1.0.0-beta.10",
40
+ "@xmachines/play-router": "1.0.0-beta.10",
41
+ "@xmachines/play-signals": "1.0.0-beta.10"
38
42
  },
39
43
  "devDependencies": {
40
- "@solidjs/router": "^0.15.4",
41
- "@solidjs/testing-library": "^0.8.0",
42
- "solid-js": "^1.8.0"
44
+ "@solidjs/router": "^0.13.0",
45
+ "@solidjs/testing-library": "^0.8.10",
46
+ "@xmachines/shared": "1.0.0-beta.10",
47
+ "jsdom": "^29.0.1",
48
+ "solid-js": "^1.9.11",
49
+ "vite-plugin-solid": "^2.11.11",
50
+ "vitest": "^4.1.0",
51
+ "xstate": "^5.28.0"
43
52
  },
44
53
  "peerDependencies": {
45
- "@solidjs/router": "^0.15.4",
54
+ "@solidjs/router": "^0.13.0",
46
55
  "solid-js": "^1.8.0"
47
- },
48
- "publishConfig": {
49
- "access": "public"
50
56
  }
51
57
  }