@xmachines/play-react 1.1.0 → 2.0.0

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
@@ -2,8 +2,7 @@
2
2
 
3
3
  React renderer for XMachines Play architecture with signal-driven rendering.
4
4
 
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
- [![Version](https://img.shields.io/badge/version-1.1.0-blue)](https://www.npmjs.com/package/@xmachines/play-react)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-2.0.0-blue)](https://www.npmjs.com/package/@xmachines/play-react)
7
6
 
8
7
  Part of the [xmachines-js monorepo](../../README.md).
9
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"ActorProvider.d.ts","sourceRoot":"","sources":["../src/ActorProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAA+D,MAAM,OAAO,CAAC;AAEpF,OAAO,KAAK,EACX,oBAAoB,EAEpB,iBAAiB,EACjB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAIN,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,MAAM,uBAAuB,CAAC;AAI/B;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB,CAAC,oBAAoB,CAAC;IACvF,sFAAsF;IACtF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,4FAA4F;IAC5F,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACxD,0DAA0D;IAC1D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAQpF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,IAAI,gBAAgB,CAE9C;AA0ED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqFtD,CAAC"}
1
+ {"version":3,"file":"ActorProvider.d.ts","sourceRoot":"","sources":["../src/ActorProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAON,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EACX,oBAAoB,EAEpB,iBAAiB,EACjB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAMN,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,MAAM,uBAAuB,CAAC;AAI/B;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB,CAAC,oBAAoB,CAAC;IACvF,sFAAsF;IACtF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,4FAA4F;IAC5F,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACxD,0DAA0D;IAC1D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAQpF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,IAAI,gBAAgB,CAE9C;AA0ED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgHtD,CAAC"}
@@ -10,14 +10,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
10
10
  *
11
11
  * @packageDocumentation
12
12
  */
13
- import React, { useState, useRef, useMemo, createContext, useContext } from "react";
13
+ import React, { useState, useRef, useMemo, useLayoutEffect, createContext, useContext, } from "react";
14
14
  import { StateProvider, useStateStore } from "@xmachines/json-render-react";
15
15
  import { createAtom } from "@xstate/store";
16
16
  import { xstateStoreStateStore } from "@xmachines/json-render-xstate";
17
17
  import { useSignalEffect } from "./useSignalEffect.js";
18
18
  import { PlayErrorBoundary } from "./PlayErrorBoundary.js";
19
19
  import { assertNonNullable } from "@xmachines/play";
20
- import { toAtomState, attachRenderErrorHandler, } from "@xmachines/play-actor";
20
+ import { attachRenderErrorHandler, createViewStoreLifecycle, refreshContextSubtree, } from "@xmachines/play-actor";
21
21
  import { ActorContext } from "./useActor.js";
22
22
  /**
23
23
  * Internal React context for ViewContextValue.
@@ -121,19 +121,49 @@ export const ActorProvider = ({ actor, registryResult, store: externalStore, fal
121
121
  // React state for triggering re-renders (NOT business logic state)
122
122
  // Signal is source of truth, useState is just React's render trigger
123
123
  const [view, setView] = useState(() => actor.currentView.get());
124
- // Internal store ref tracks the current per-view atom store.
125
- // Keyed to view identity: recreated whenever the view changes (new spec.state seed).
126
- // Ignored when externalStore is provided.
127
- const internalStoreRef = useRef(null);
128
- const lastViewRef = useRef(null);
124
+ // Store lifecycle (reseed on viewKey change, refresh /context in place
125
+ // otherwise, actor-swap reset, guard identity cache) the shared
126
+ // coordinator from @xmachines/play-actor; only the reactivity wiring
127
+ // (render path + effects below) is React's.
128
+ const storeLifecycleRef = useRef(null);
129
+ storeLifecycleRef.current ??= createViewStoreLifecycle(createViewStore);
130
+ const storeLifecycle = storeLifecycleRef.current;
131
+ // Latest external store for the signal effect below — the effect's deps are
132
+ // [actor], so it must not close over a possibly-stale prop.
133
+ const externalStoreRef = useRef(externalStore);
134
+ externalStoreRef.current = externalStore;
129
135
  // Subscribe to signal changes. The [actor] dep re-creates the watcher when
130
136
  // the actor prop swaps — without it the watcher keeps tracking the OLD
131
137
  // actor's currentView signal and the rendered view freezes on the old actor
132
138
  // while events flow to the new one.
139
+ //
140
+ // Store sync happens HERE, before setView triggers the re-render, so the
141
+ // store and the spec the children see are always a consistent pair — and so
142
+ // store subscribers are never notified during a render pass.
133
143
  useSignalEffect(() => {
134
144
  const currentView = actor.currentView.get();
145
+ if (currentView) {
146
+ // Controlled mode included: /context is machinery-owned in both
147
+ // modes, and refreshing the external store is allowed here (the
148
+ // effect runs post-commit, never during a render pass).
149
+ storeLifecycle.resolve(actor, currentView, externalStoreRef.current);
150
+ }
135
151
  setView(currentView);
136
152
  }, [actor]);
153
+ // Controlled mode: refresh the external store's /context BEFORE paint. The
154
+ // render path hands children the external store untouched (the machinery
155
+ // must not notify store subscribers mid-render), and the passive signal
156
+ // effect above runs after paint — this layout effect closes the first-paint
157
+ // gap. Keyed on the store identity too, so swapping the controlled store
158
+ // prop mid-session brings the NEW store in line immediately instead of
159
+ // waiting for the next view emission.
160
+ useLayoutEffect(() => {
161
+ if (!externalStore)
162
+ return;
163
+ const currentView = actor.currentView.get();
164
+ if (currentView)
165
+ refreshContextSubtree(externalStore, currentView);
166
+ }, [externalStore, actor]);
137
167
  // Inject onRenderError prop into registry (non-enumerable, overrides defineRegistry-level handler)
138
168
  // Centralised here per D-19 — one location for all framework renderers.
139
169
  // Memoized on its actual inputs: rebuilding the injected registry every render
@@ -147,32 +177,28 @@ export const ActorProvider = ({ actor, registryResult, store: externalStore, fal
147
177
  registry: attachRenderErrorHandler(registryResult.registry, onRenderError),
148
178
  };
149
179
  }, [registryResult, onRenderError]);
180
+ // Resolve the store for StateProvider on the render path too — it covers
181
+ // the first render (the useState initializer seeded `view` before any
182
+ // effect ran) and is a no-op afterwards: reseeding branches on viewKey, and
183
+ // the /context refresh compares before writing, so no subscriber is
184
+ // notified mid-render. The EXTERNAL store's refresh is deferred here for
185
+ // the same mid-render reason — the layout effect above handles it.
186
+ // Children get the guarded store: /context is read-only to the spec
187
+ // ($bindState, setState, chained set) — machine context changes only
188
+ // through events; the identity is cached per underlying store inside the
189
+ // coordinator, so consumers stay referentially stable.
190
+ const guardedStore = view
191
+ ? storeLifecycle.resolve(actor, view, externalStore, { refreshExternalStore: false })
192
+ .guardedStore
193
+ : null;
150
194
  // No view in current state — render fallback INSIDE ActorContext so a
151
195
  // fallback component can call useActor() (e.g. to send a retry event).
152
196
  // Parity with the error-boundary fallback below and with the Solid/Svelte/Vue
153
197
  // renderers, which all provide context to their null-view fallbacks.
154
198
  // ViewContext is intentionally NOT provided: there is no view spec to expose.
155
- if (!view) {
199
+ if (!view || !guardedStore) {
156
200
  return (_jsx(ActorContext.Provider, { value: actor, children: fallback }));
157
201
  }
158
- // Resolve the store to use for StateProvider:
159
- // - External (controlled): use as-is, caller manages lifecycle
160
- // - Internal: create a fresh atom when the view changes (new route/state)
161
- let store;
162
- if (externalStore) {
163
- store = externalStore;
164
- }
165
- else {
166
- // Recreate the internal store when the view identity changes
167
- // (view is a new object on every transition per deriveCurrentView)
168
- if (internalStoreRef.current === null || lastViewRef.current !== view) {
169
- // Proto-safe guard (T-37-03-01): prevents Date/Array/class-instance from being
170
- // passed to createAtom. Replaces the weak `?? {}` guard from old code_context.
171
- internalStoreRef.current = createViewStore(toAtomState(view.state));
172
- lastViewRef.current = view;
173
- }
174
- store = internalStoreRef.current;
175
- }
176
- return (_jsx(ActorContext.Provider, { value: actor, children: _jsx(PlayErrorBoundary, { fallback: fallback, ...(onError && { onError }), children: _jsx(StateProvider, { store: store, children: _jsx(ActorProviderInner, { registryResult: activeRegistryResult, spec: view, store: store, children: children }) }) }) }));
202
+ return (_jsx(ActorContext.Provider, { value: actor, children: _jsx(PlayErrorBoundary, { fallback: fallback, ...(onError && { onError }), children: _jsx(StateProvider, { store: guardedStore, children: _jsx(ActorProviderInner, { registryResult: activeRegistryResult, spec: view, store: guardedStore, children: children }) }) }) }));
177
203
  };
178
204
  //# sourceMappingURL=ActorProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActorProvider.js","sourceRoot":"","sources":["../src/ActorProvider.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,EAAE,Q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mEAAmE;IACnE,oEAAoE;IACpE,qEAAqE;IACrE,yEAAyE;IACzE,uDAAuD;IACvD,MAAM,YAAY,GAAsB,IAAI;QAC3C,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC;aAClF,YAAY;QACf,CAAC,CAAC,IAAI,CAAC;IAER,sEAAsE;IACtE,uEAAuE;IACvE,8EAA8E;IAC9E,qEAAqE;IACrE,8EAA8E;IAC9E,IAAI,CAAC,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;QAC5B,OAAO,CACN,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAqB,YAAG,QAAQ,GAAyB,CACvF,CAAC;IACH,CAAC;IAED,OAAO,CACN,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAqB,YAClD,KAAC,iBAAiB,IAAC,QAAQ,EAAE,QAAQ,KAAM,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC,YAClE,KAAC,aAAa,IAAC,KAAK,EAAE,YAAY,YACjC,KAAC,kBAAkB,IAClB,cAAc,EAAE,oBAAoB,EACpC,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,YAAY,YAElB,QAAQ,GACW,GACN,GACG,GACG,CACxB,CAAC;AACH,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ export { useSignalEffect } from "./useSignalEffect.js";
38
38
  export { PlayErrorBoundary } from "./PlayErrorBoundary.js";
39
39
  export { useActor } from "./useActor.js";
40
40
  export type { AnyPlayActor } from "./useActor.js";
41
- export { defineRegistry, useBoundProp, JSONUIProvider, StateProvider, ActionProvider, VisibilityProvider, ValidationProvider, Renderer, } from "@xmachines/json-render-react";
41
+ export { defineRegistry, useBoundProp, useFieldValidation, JSONUIProvider, StateProvider, ActionProvider, VisibilityProvider, ValidationProvider, Renderer, } from "@xmachines/json-render-react";
42
42
  export type { ComponentFn, ComponentContext, JSONUIProviderProps, StateProviderProps, ActionProviderProps, VisibilityProviderProps, ValidationProviderProps, RendererProps, } from "@xmachines/json-render-react";
43
43
  export type { ActorProviderProps as PlayRendererProps } from "./ActorProvider.js";
44
44
  export type { RenderErrorHandler } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,OAAO,EACN,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,GACR,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACX,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,GACb,MAAM,8BAA8B,CAAC;AAGtC,YAAY,EAAE,kBAAkB,IAAI,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClF,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CA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export { useSignalEffect } from "./useSignalEffect.js";
37
37
  export { PlayErrorBoundary } from "./PlayErrorBoundary.js";
38
38
  export { useActor } from "./useActor.js";
39
39
  // Re-exports from @xmachines/json-render-react (per D-14)
40
- export { defineRegistry, useBoundProp, JSONUIProvider, StateProvider, ActionProvider, VisibilityProvider, ValidationProvider, Renderer, } from "@xmachines/json-render-react";
40
+ export { defineRegistry, useBoundProp, useFieldValidation, JSONUIProvider, StateProvider, ActionProvider, VisibilityProvider, ValidationProvider, Renderer, } from "@xmachines/json-render-react";
41
41
  //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,eAAe;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,0DAA0D;AAC1D,OAAO,EACN,cAAc,EACd,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,GACR,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,eAAe;AACf,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,0DAA0D;AAC1D,OAAO,EACN,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,GACR,MAAM,8BAA8B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-react",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "React renderer for XMachines Play architecture with signal-driven rendering",
5
5
  "keywords": [
6
6
  "actor",
@@ -15,7 +15,7 @@
15
15
  "author": "XMachines Contributors",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+ssh://git@gitlab.com/xmachin-es/xmachines-js.git",
18
+ "url": "git+https://gitlab.com/xmachin-es/xmachines-js.git",
19
19
  "directory": "packages/play-react"
20
20
  },
21
21
  "files": [
@@ -25,17 +25,20 @@
25
25
  ],
26
26
  "type": "module",
27
27
  "sideEffects": false,
28
+ "main": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
28
30
  "exports": {
29
31
  ".": {
30
32
  "types": "./dist/index.d.ts",
31
- "import": "./dist/index.js"
32
- }
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./package.json": "./package.json"
33
36
  },
34
37
  "publishConfig": {
35
38
  "access": "public"
36
39
  },
37
40
  "scripts": {
38
- "build": "tsc --build",
41
+ "build": "vite build && tsc --build",
39
42
  "clean": "rm -rf dist *.tsbuildinfo coverage .vitest-attachments test/browser/__screenshots__ node_modules/.svelte2tsx-* node_modules/.vite*",
40
43
  "lint": "oxlint .",
41
44
  "format": "oxfmt .",
@@ -44,9 +47,9 @@
44
47
  "test:browser": "vitest --browser.enabled --browser.name=chromium test/browser"
45
48
  },
46
49
  "dependencies": {
47
- "@xmachines/play": "1.1.0",
48
- "@xmachines/play-actor": "1.1.0",
49
- "@xmachines/play-signals": "1.1.0"
50
+ "@xmachines/play": "2.0.0",
51
+ "@xmachines/play-actor": "2.0.0",
52
+ "@xmachines/play-signals": "2.0.0"
50
53
  },
51
54
  "devDependencies": {
52
55
  "@testing-library/jest-dom": "^6.9.1",
@@ -55,10 +58,10 @@
55
58
  "@types/react": "^19.2.14",
56
59
  "@types/react-dom": "^19.2.3",
57
60
  "@vitejs/plugin-react": "^6.0.1",
58
- "@vitest/browser-playwright": "^4.1.10",
59
- "@xmachines/json-render-core": "^0.19.0-xm.2",
60
- "@xmachines/json-render-react": "^0.19.0-xm.2",
61
- "@xmachines/json-render-xstate": "^0.19.0-xm.2",
61
+ "@vitest/browser-playwright": "^4.1.11",
62
+ "@xmachines/json-render-core": "^0.20.0-xm.2",
63
+ "@xmachines/json-render-react": "^0.20.0-xm.2",
64
+ "@xmachines/json-render-xstate": "^0.20.0-xm.2",
62
65
  "@xstate/store": "^3.17.0",
63
66
  "jsdom": "^29.1.0",
64
67
  "oxfmt": "^0.64.0",
@@ -66,14 +69,15 @@
66
69
  "react": "^19.2.5",
67
70
  "react-dom": "^19.2.5",
68
71
  "typescript": "^5.9.3 || ^6.0.3",
72
+ "vite": "^8.0.10",
69
73
  "vitest": "^4.1.11",
70
74
  "xstate": "^5.31.0",
71
75
  "zod": "^4.4.1"
72
76
  },
73
77
  "peerDependencies": {
74
- "@xmachines/json-render-core": "^0.19.0-xm.2",
75
- "@xmachines/json-render-react": "^0.19.0-xm.2",
76
- "@xmachines/json-render-xstate": "^0.19.0-xm.2",
78
+ "@xmachines/json-render-core": "^0.20.0-xm.2",
79
+ "@xmachines/json-render-react": "^0.20.0-xm.2",
80
+ "@xmachines/json-render-xstate": "^0.20.0-xm.2",
77
81
  "@xstate/store": "^3.17.0",
78
82
  "react": "^18.0.0 || ^19.0.0",
79
83
  "react-dom": "^18.0.0 || ^19.0.0",