@xmachines/play-solid-router 1.0.0-beta.17 → 1.0.0-beta.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +54 -30
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -193,8 +193,20 @@ routeMap.getStateIdByPath("/other"); // null
193
193
 
194
194
  ```typescript
195
195
  import { Router, Route } from '@solidjs/router';
196
- import { createSignal } from 'solid-js';
197
- 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 } });
198
210
 
199
211
  // State machine with 3 states
200
212
  const appMachine = setup({
@@ -217,12 +229,6 @@ const appMachine = setup({
217
229
  }
218
230
  });
219
231
 
220
- const catalog = defineCatalog({
221
- Home,
222
- About,
223
- Contact,
224
- });
225
-
226
232
  // Component setup
227
233
  function App() {
228
234
  const navigate = useNavigate();
@@ -231,7 +237,7 @@ function App() {
231
237
 
232
238
  const routeMap = createRouteMap(appMachine);
233
239
 
234
- const createPlayer = definePlayer({ machine: appMachine, catalog });
240
+ const createPlayer = definePlayer({ machine: appMachine, catalog: appCatalog });
235
241
  const actor = createPlayer();
236
242
  actor.start();
237
243
  const bridge = new SolidRouterBridge(navigate, location, params, actor, routeMap);
@@ -253,7 +259,18 @@ function App() {
253
259
  ```typescript
254
260
  // State machine with parameter routes
255
261
  import { formatPlayRouteTransitions } from "@xmachines/play-xstate";
256
- 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 } });
257
274
 
258
275
  const machineConfig = {
259
276
  id: 'app',
@@ -281,11 +298,6 @@ const appMachine = setup({
281
298
  }
282
299
  }).createMachine(formatPlayRouteTransitions(machineConfig));
283
300
 
284
- const catalog = defineCatalog({
285
- Profile,
286
- Settings,
287
- });
288
-
289
301
  // Router with dynamic routes
290
302
  function App() {
291
303
  const navigate = useNavigate();
@@ -294,7 +306,7 @@ function App() {
294
306
 
295
307
  const routeMap = createRouteMap(appMachine);
296
308
 
297
- const createPlayer = definePlayer({ machine: appMachine, catalog });
309
+ const createPlayer = definePlayer({ machine: appMachine, catalog: appCatalog });
298
310
  const actor = createPlayer();
299
311
  actor.start();
300
312
  const bridge = new SolidRouterBridge(navigate, location, params, actor, routeMap);
@@ -335,7 +347,17 @@ function ProfileButton(props: { userId: string }) {
335
347
  ```typescript
336
348
  // State machine with query param handling
337
349
  import { formatPlayRouteTransitions } from "@xmachines/play-xstate";
338
- 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 } });
339
361
 
340
362
  const machineConfig = {
341
363
  context: { query: '', filters: {} },
@@ -356,11 +378,7 @@ const searchMachine = setup({
356
378
  }
357
379
  }).createMachine(formatPlayRouteTransitions(machineConfig));
358
380
 
359
- const catalog = defineCatalog({
360
- Search,
361
- });
362
-
363
- const player = definePlayer({ machine: searchMachine, catalog });
381
+ const player = definePlayer({ machine: searchMachine, catalog: searchCatalog });
364
382
 
365
383
  // Component sends query params
366
384
  function SearchBar(props) {
@@ -394,7 +412,19 @@ function SearchBar(props) {
394
412
 
395
413
  ```typescript
396
414
  // State machine with auth guards
397
- 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 } });
398
428
 
399
429
  const authMachine = setup({
400
430
  types: {
@@ -427,13 +457,7 @@ const authMachine = setup({
427
457
  },
428
458
  });
429
459
 
430
- const catalog = defineCatalog({
431
- Home,
432
- Login,
433
- Dashboard,
434
- });
435
-
436
- const player = definePlayer({ machine: authMachine, catalog });
460
+ const player = definePlayer({ machine: authMachine, catalog: authCatalog });
437
461
  ```
438
462
 
439
463
  **Guard behavior:**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-solid-router",
3
- "version": "1.0.0-beta.17",
3
+ "version": "1.0.0-beta.18",
4
4
  "description": "SolidJS Router adapter for XMachines Universal Player Architecture",
5
5
  "license": "MIT",
6
6
  "author": "XMachines Contributors",
@@ -36,16 +36,16 @@
36
36
  "prepublishOnly": "npm run build"
37
37
  },
38
38
  "dependencies": {
39
- "@xmachines/play": "1.0.0-beta.17",
40
- "@xmachines/play-actor": "1.0.0-beta.17",
41
- "@xmachines/play-router": "1.0.0-beta.17",
42
- "@xmachines/play-signals": "1.0.0-beta.17"
39
+ "@xmachines/play": "1.0.0-beta.18",
40
+ "@xmachines/play-actor": "1.0.0-beta.18",
41
+ "@xmachines/play-router": "1.0.0-beta.18",
42
+ "@xmachines/play-signals": "1.0.0-beta.18"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@solidjs/router": "^0.16.1",
46
46
  "@solidjs/testing-library": "^0.8.10",
47
- "@xmachines/play-xstate": "1.0.0-beta.17",
48
- "@xmachines/shared": "1.0.0-beta.17",
47
+ "@xmachines/play-xstate": "1.0.0-beta.18",
48
+ "@xmachines/shared": "1.0.0-beta.18",
49
49
  "jsdom": "^29.0.1",
50
50
  "solid-js": "^1.9.12",
51
51
  "vite-plugin-solid": "^2.11.11",