@xmachines/play-solid 6.1.0 → 7.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,7 +2,7 @@
2
2
 
3
3
  > Solid renderer for XMachines Play architecture
4
4
 
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-6.1.0-blue)](https://www.npmjs.com/package/@xmachines/play-solid)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Version](https://img.shields.io/badge/version-7.0.0-blue)](https://www.npmjs.com/package/@xmachines/play-solid)
6
6
 
7
7
  The SolidJS rendering layer observes the actor atoms and renders the UI components through `@xmachines/json-render-solid`. SolidJS reactivity only triggers the re-render. The atoms are the source of truth.
8
8
 
@@ -15,9 +15,11 @@ pnpm add @xmachines/play-solid
15
15
  **Peer dependencies.** Install them with the package:
16
16
 
17
17
  ```bash
18
- pnpm add solid-js @xmachines/core @xmachines/play @xmachines/play-atom @xstate/store @xmachines/json-render-solid @xmachines/json-render-core @xmachines/json-render-xstate
18
+ pnpm add solid-js @xmachines/core @xmachines/play @xmachines/play-atom @xstate/store @xmachines/json-render-solid@0.21.0-xm.6 @xmachines/json-render-core@0.21.0-xm.6 @xmachines/json-render-xstate@0.21.0-xm.6
19
19
  ```
20
20
 
21
+ The json-render packages are exact peers: install the version that this release names, `0.21.0-xm.6`.
22
+
21
23
  `@xstate/store` is the peer of [`@xmachines/play-atom`](../play-atom/README.md), and not of this
22
24
  package: this package reads the atom through [`@xmachines/play-atom`](../play-atom/README.md) and
23
25
  imports the engine in no source file. Install ONE copy of it.
@@ -29,13 +31,22 @@ import { PlayUIProvider, PlayRenderer, defineRegistry, schema } from "@xmachines
29
31
  import { definePlayer, compose, PlayerActor } from "@xmachines/play-xstate";
30
32
  import { withView } from "@xmachines/play-xstate/view";
31
33
  import { defineCatalog } from "@xmachines/json-render-core";
32
- import { myMachine } from "./machine.js"; // your xstate machine (states carry meta.view specs)
33
- // authCatalogDef is a plain object describing components/actions — in this repo it
34
- // comes from the workspace-only @xmachines/play-actor-shared demo package
35
- import { authCatalogDef } from "@xmachines/play-actor-shared";
34
+ import type { AnyStateMachine } from "xstate";
35
+ import { z } from "zod";
36
+
37
+ declare const myMachine: AnyStateMachine; // your xstate machine (states carry meta.view specs)
36
38
 
37
39
  // 1. Define a catalog
38
- const catalog = defineCatalog(schema, authCatalogDef);
40
+ const catalog = defineCatalog(schema, {
41
+ components: {
42
+ Home: { props: z.object({}) },
43
+ Login: { props: z.object({ username: z.string().optional() }) },
44
+ },
45
+ actions: {
46
+ login: { params: z.object({ username: z.string() }) },
47
+ logout: {},
48
+ },
49
+ });
39
50
 
40
51
  // 2. Create and start an actor — a renderer needs the view capability
41
52
  const createPlayer = definePlayer({ machine: myMachine, actor: compose(PlayerActor, withView) });
@@ -49,7 +60,9 @@ const registryResult = defineRegistry(catalog, {
49
60
  Login: (ctx) => <div>Login {ctx.props.username && <span>{ctx.props.username}</span>}</div>,
50
61
  },
51
62
  actions: {
52
- login: async (args) => actor.send({ type: "auth.login", username: args.username }),
63
+ login: async (args) => {
64
+ if (args) actor.send({ type: "auth.login", username: args.username });
65
+ },
53
66
  logout: async () => actor.send({ type: "auth.logout" }),
54
67
  },
55
68
  });
@@ -71,9 +84,14 @@ function App() {
71
84
  `PlayUIProvider` is the standard entry point. It wraps `ActorProvider` and `JSONUIProvider` into one composite provider. `PlayRenderer` is a leaf component without props. It reads the view context and renders the current spec.
72
85
 
73
86
  ```tsx
74
- import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-solid";
87
+ import { PlayUIProvider, PlayRenderer, type PlayUIProviderProps } from "@xmachines/play-solid";
75
88
 
76
89
  // actor, registryResult from the Quick Start above
90
+ declare const actor: PlayUIProviderProps["actor"];
91
+ declare const registryResult: PlayUIProviderProps["registryResult"];
92
+ declare const navigateFn: (path: string) => void; // your navigation callback
93
+ declare const valFns: NonNullable<PlayUIProviderProps["validationFunctions"]>; // your form validation helpers
94
+
77
95
  <PlayUIProvider
78
96
  actor={actor}
79
97
  registryResult={registryResult}
@@ -91,9 +109,12 @@ import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-so
91
109
  For library authors who need direct control over provider composition:
92
110
 
93
111
  ```tsx
94
- import { ActorProvider, PlayRenderer } from "@xmachines/play-solid";
112
+ import { ActorProvider, PlayRenderer, type ActorProviderProps } from "@xmachines/play-solid";
95
113
 
96
114
  // actor, registryResult from the Quick Start above
115
+ declare const actor: ActorProviderProps["actor"];
116
+ declare const registryResult: ActorProviderProps["registryResult"];
117
+
97
118
  <ActorProvider actor={actor} registryResult={registryResult}>
98
119
  <PlayRenderer />
99
120
  </ActorProvider>;
@@ -132,7 +153,7 @@ const MyRenderer = () => {
132
153
  > instead of building the tree again — which is what keeps the focus and the caret of an
133
154
  > input alive while a stream writes into the view.
134
155
  >
135
- > ```tsx
156
+ > ```tsx fragment
136
157
  > // ✅ The Renderer reads `view.spec` inside its own tracking scope, so it follows.
137
158
  > const view = usePlayView();
138
159
  > return <Renderer spec={view.spec} registry={view.registry} />;
@@ -83,9 +83,13 @@ export interface ActorProviderProps extends BaseActorProviderProps<DefineRegistr
83
83
  * children. The provider clears the error on the next view emission (when
84
84
  * `currentView` changes), so a view transition retries the render.
85
85
  *
86
- * Element-level catalog component throws are caught upstream by the per-element
87
- * boundary of @json-render, and reported through `onRenderError`. This boundary is
88
- * the outer net for everything else.
86
+ * The per-element boundary of `json-render` catches a throw of a catalog component
87
+ * below the root, and it reports it through `onRenderError` alone. A failure of the
88
+ * ROOT — its component, a prop, or its `visible` condition — leaves no view, and
89
+ * json-render gives it to no boundary of the host. The provider contains it as a
90
+ * failure of the view all the same: it shows the fallback, and it calls this handler
91
+ * one time. `onRenderError` also receives it, with `info.kind` `"root"`. This boundary
92
+ * is the outer net for everything else.
89
93
  *
90
94
  * The second parameter is the RESET, for a retry that the host starts — a "Retry"
91
95
  * button of its own. It clears the caught error and renders again, and it resolves the
@@ -123,10 +127,24 @@ export interface ActorProviderProps extends BaseActorProviderProps<DefineRegistr
123
127
  *
124
128
  * @example
125
129
  * ```tsx
126
- * import { ActorProvider, PlayRenderer } from "@xmachines/play-solid";
130
+ * import { ActorProvider, PlayRenderer, usePlayView } from "@xmachines/play-solid";
131
+ * import { JSONUIProvider } from "@xmachines/json-render-solid";
132
+ *
133
+ * // PlayRenderer needs the providers of json-render around it. PlayUIProvider adds them.
134
+ * // A custom composition hands JSONUIProvider the store of the view context.
135
+ * const MyProviders = (props: { children: JSX.Element }) => {
136
+ * const view = usePlayView();
137
+ * return (
138
+ * <JSONUIProvider registry={view.registry} handlers={view.handlers} store={view.store}>
139
+ * {props.children}
140
+ * </JSONUIProvider>
141
+ * );
142
+ * };
127
143
  *
128
144
  * <ActorProvider actor={myActor} registryResult={registryResult}>
129
- * <PlayRenderer />
145
+ * <MyProviders>
146
+ * <PlayRenderer />
147
+ * </MyProviders>
130
148
  * </ActorProvider>
131
149
  * ```
132
150
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ActorProvider.d.ts","sourceRoot":"","sources":["../src/ActorProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAaH,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,KAAK,EAAE,oBAAoB,EAAY,MAAM,8BAA8B,CAAC;AAEnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAItE,OAAO,EAMN,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,MAAM,sBAAsB,CAAC;AAO9B;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAIpF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,W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O,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAEtD;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;CACtB;AA2CD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,kBAAkB,CA4NvD,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { ActorContext } from "./useActor.js";
2
2
  import { createComponent } from "solid-js/web";
3
3
  import { StateProvider, useStateStore } from "@xmachines/json-render-solid";
4
- import { ErrorBoundary, Show, createContext, createEffect, createMemo, createSignal, onCleanup, untrack, useContext } from "solid-js";
5
- import { createAtom, watchAtom } from "@xmachines/play-atom";
4
+ import { ErrorBoundary, Show, createContext, createEffect, createMemo, createSignal, onCleanup, onMount, untrack, useContext } from "solid-js";
5
+ import { createAtom } from "@xmachines/play-atom";
6
6
  import { xstateStoreStateStore } from "@xmachines/json-render-xstate";
7
7
  import { assertNonNullable } from "@xmachines/play";
8
- import { attachRenderErrorHandler, createReportGuard, createViewStoreLifecycle, sameViewInputs } from "@xmachines/play-view";
8
+ import { bindStoreHandlers, createActorProxy, createRenderErrorBinding, createReportGuard, createViewSession } from "@xmachines/play-view";
9
9
  //#region packages/play-solid/src/ActorProvider.tsx
10
10
  /**
11
11
  * ActorProvider — the SolidJS provider component of the XMachines Play actor lifecycle.
@@ -65,15 +65,11 @@ function usePlayView() {
65
65
  */
66
66
  var ActorProviderInner = (innerProps) => {
67
67
  const stateCtx = useStateStore();
68
- const setStateAdapter = (updater) => {
69
- const prev = stateCtx.getSnapshot();
70
- stateCtx.update(updater(prev));
71
- };
72
68
  const viewValue = {
73
69
  get spec() {
74
70
  return innerProps.spec;
75
71
  },
76
- handlers: innerProps.registryResult.handlers(() => setStateAdapter, () => stateCtx.getSnapshot()),
72
+ handlers: bindStoreHandlers(innerProps.registryResult, () => stateCtx),
77
73
  registry: innerProps.registryResult.registry,
78
74
  store: innerProps.store
79
75
  };
@@ -96,40 +92,43 @@ var ActorProviderInner = (innerProps) => {
96
92
  *
97
93
  * @example
98
94
  * ```tsx
99
- * import { ActorProvider, PlayRenderer } from "@xmachines/play-solid";
95
+ * import { ActorProvider, PlayRenderer, usePlayView } from "@xmachines/play-solid";
96
+ * import { JSONUIProvider } from "@xmachines/json-render-solid";
97
+ *
98
+ * // PlayRenderer needs the providers of json-render around it. PlayUIProvider adds them.
99
+ * // A custom composition hands JSONUIProvider the store of the view context.
100
+ * const MyProviders = (props: { children: JSX.Element }) => {
101
+ * const view = usePlayView();
102
+ * return (
103
+ * <JSONUIProvider registry={view.registry} handlers={view.handlers} store={view.store}>
104
+ * {props.children}
105
+ * </JSONUIProvider>
106
+ * );
107
+ * };
100
108
  *
101
109
  * <ActorProvider actor={myActor} registryResult={registryResult}>
102
- * <PlayRenderer />
110
+ * <MyProviders>
111
+ * <PlayRenderer />
112
+ * </MyProviders>
103
113
  * </ActorProvider>
104
114
  * ```
105
115
  */
106
116
  var ActorProvider = (props) => {
107
- const [view, setView] = createSignal(null);
108
- const actorProxy = new Proxy({}, {
109
- get(_target, prop) {
110
- const current = props.actor;
111
- const value = Reflect.get(current, prop, current);
112
- return typeof value === "function" ? value.bind(current) : value;
113
- },
114
- has(_target, prop) {
115
- return prop in props.actor;
116
- }
117
+ const actorProxy = createActorProxy(() => props.actor);
118
+ const bindRenderError = createRenderErrorBinding();
119
+ const resolvedRegistryResult = createMemo(() => bindRenderError(props.registryResult, props.onRenderError, (error) => session.failView(error)));
120
+ const session = createViewSession(untrack(() => props.actor), untrack(() => props.store), { createStore: (seed) => xstateStoreStateStore({ atom: createAtom(seed) }) });
121
+ const [snapshot, setSnapshot] = createSignal(session.getSnapshot());
122
+ onMount(() => {
123
+ const release = session.subscribe(() => setSnapshot(session.getSnapshot()));
124
+ setSnapshot(session.getSnapshot());
125
+ onCleanup(release);
117
126
  });
118
- const resolvedRegistryResult = createMemo(() => {
119
- if (!props.onRenderError) return props.registryResult;
120
- return {
121
- ...props.registryResult,
122
- registry: attachRenderErrorHandler(props.registryResult.registry, props.onRenderError)
123
- };
124
- });
125
- const storeLifecycle = createViewStoreLifecycle((seed) => xstateStoreStateStore({ atom: createAtom(seed) }));
127
+ onCleanup(() => session.dispose());
126
128
  createEffect(() => {
127
- const update = (nextView) => setView(nextView);
128
- update(props.actor.currentView.get());
129
- const unwatch = watchAtom(props.actor.currentView, (nextView) => {
130
- update(nextView);
131
- });
132
- onCleanup(() => unwatch());
129
+ const nextActor = props.actor;
130
+ const nextStore = props.store;
131
+ untrack(() => session.setInputs(nextActor, nextStore));
133
132
  });
134
133
  let resetBoundary;
135
134
  const guard = createReportGuard({
@@ -139,31 +138,12 @@ var ActorProvider = (props) => {
139
138
  onCleanup(() => {
140
139
  guard.dispose();
141
140
  });
142
- let lastView;
143
- let lastActor;
144
- let lastStore;
145
- let seeded = false;
141
+ let lastSnapshot;
146
142
  createEffect(() => {
147
- const nextView = view();
148
- const nextActor = props.actor;
149
- const nextStore = props.store;
150
- const changed = !seeded || !sameViewInputs({
151
- actor: lastActor,
152
- view: lastView,
153
- store: lastStore
154
- }, {
155
- actor: nextActor,
156
- view: nextView,
157
- store: nextStore
158
- });
159
- lastView = nextView;
160
- lastActor = nextActor;
161
- lastStore = nextStore;
162
- if (!seeded) {
163
- seeded = true;
164
- return;
165
- }
166
- if (!changed) return;
143
+ const next = snapshot();
144
+ const previous = lastSnapshot;
145
+ lastSnapshot = next;
146
+ if (previous === void 0 || next === previous) return;
167
147
  const reset = resetBoundary;
168
148
  resetBoundary = void 0;
169
149
  reset?.();
@@ -177,6 +157,7 @@ var ActorProvider = (props) => {
177
157
  const hostRetry = () => {
178
158
  if (guard.blocked()) return;
179
159
  resetBoundary = void 0;
160
+ session.retry();
180
161
  reset();
181
162
  };
182
163
  const handler = props.onError;
@@ -186,12 +167,12 @@ var ActorProvider = (props) => {
186
167
  get children() {
187
168
  return (() => {
188
169
  const resolution = createMemo(() => {
189
- const currentView = view();
190
- if (!currentView) return null;
191
- const { guardedStore } = storeLifecycle.resolve(props.actor, currentView, props.store);
170
+ const current = snapshot();
171
+ if (current.failure) throw current.failure.error;
172
+ if (!current.view || !current.store) return null;
192
173
  return {
193
- view: currentView,
194
- store: guardedStore
174
+ view: current.view,
175
+ store: current.store
195
176
  };
196
177
  });
197
178
  const subtreeStore = createMemo(() => resolution()?.store ?? null);
@@ -1 +1 @@
1
- {"version":3,"file":"ActorProvider.js","names":["createSignal","createEffect","createMemo","onCleanup","createContext","useContext","untrack","ErrorBoundary","Show","Component","JSX","StateProvider","useStateStore","DefineRegistryResult","SetState","StateStore","ComponentRegistry","createAtom","watchAtom","xstateStoreStateStore","assertNonNullable","attachRenderErrorHandler","createReportGuard","createViewStoreLifecycle","sameViewInputs","PlaySpec","BaseActorProviderProps","BaseViewContextValue","ActorContext","AnyPlayActor","ViewContextValue","ViewContext","usePlayView","ActorProviderProps","fallback","Element","onError","error","reset","children","ActorProviderInner","registryResult","spec","store","innerProps","stateCtx","setStateAdapter","updater","prev","getSnapshot","update","handlers","viewValue","registry","_$createComponent","Provider","value","ActorProvider","props","view","setView","actorProxy","Proxy","get","_target","prop","current","actor","Reflect","bind","has","resolvedRegistryResult","onRenderError","storeLifecycle","seed","atom","nextView","currentView","unwatch","resetBoundary","guard","noHandler","handlerThrew","dispose","lastView","lastActor","lastStore","seeded","nextActor","nextStore","changed","undefined","err","hostRetry","blocked","handler","report","resolution","guardedStore","resolve","subtreeStore","when","keyed","currentSpec"],"sources":["../src/ActorProvider.tsx"],"sourcesContent":["/**\n * ActorProvider — the SolidJS provider component of the XMachines Play actor lifecycle.\n *\n * This is the low-level provider, for the author of a library who needs the control.\n * Most users take PlayUIProvider, the composite provider, instead.\n *\n * This component:\n * - subscribes to the actor.currentView atom with watchAtom, in the body of the component (Phase 29)\n * - manages the StateStore lifecycle of each view, controlled and uncontrolled\n * - resolves each action handler with the inner component pattern, inside StateProvider\n * - puts onRenderError into the registry, when the caller gives one\n * - gives ActorContext (the actor) and ViewContext (the spec, the handlers, and the registry) to the children\n * - wraps the render path in a SolidJS ErrorBoundary\n *\n * D-11: the old alias `ActorProvider = ActorContext.Provider` is gone. This component\n * has the name now. Use `ActorContext.Provider` directly for the raw access.\n *\n * @packageDocumentation\n */\n\nimport {\n\tcreateSignal,\n\tcreateEffect,\n\tcreateMemo,\n\tonCleanup,\n\tcreateContext,\n\tuseContext,\n\tuntrack,\n\tErrorBoundary,\n\tShow,\n} from \"solid-js\";\nimport type { Component, JSX } from \"solid-js\";\nimport { StateProvider, useStateStore } from \"@xmachines/json-render-solid\";\nimport type { DefineRegistryResult, SetState } from \"@xmachines/json-render-solid\";\nimport type { StateStore } from \"@xmachines/json-render-core\";\nimport type { ComponentRegistry } from \"@xmachines/json-render-solid\";\nimport { createAtom, watchAtom } from \"@xmachines/play-atom\";\nimport { xstateStoreStateStore } from \"@xmachines/json-render-xstate\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport {\n\tattachRenderErrorHandler,\n\tcreateReportGuard,\n\tcreateViewStoreLifecycle,\n\tsameViewInputs,\n\ttype PlaySpec,\n\ttype BaseActorProviderProps,\n\ttype BaseViewContextValue,\n} from \"@xmachines/play-view\";\nimport { ActorContext, type AnyPlayActor } from \"./useActor.js\";\n\n// ---------------------------------------------------------------------------\n// ViewContextValue — the shape of the context value that ActorProvider gives\n// ---------------------------------------------------------------------------\n\n/**\n * The value that the ViewContext of ActorProvider provides.\n * usePlayView() gives it inside the ActorProvider tree.\n *\n * **`spec` is a live GETTER, and not a copied value.** The provider keeps the subtree\n * across an emission that holds the viewKey, so a read of `spec` inside a tracking\n * scope gives the newest spec and the Renderer reconciles in place. A read outside a\n * tracking scope gives a snapshot that goes old: `const { spec } = usePlayView()` and\n * `{ ...usePlayView() }` both freeze on the spec of that moment. Read `view.spec` at\n * the place of the use instead. The other three fields are copied values, and the\n * provider builds the subtree again when one of them changes.\n */\nexport interface ViewContextValue extends BaseViewContextValue<ComponentRegistry> {}\n\nconst ViewContext = createContext<ViewContextValue | null>(null);\n\n/**\n * The hook that gives the current view context inside an ActorProvider tree.\n *\n * **Read a field where you use it, and destructure it not.** `spec` is a GETTER: the\n * provider keeps the subtree across an emission that holds the viewKey, and it publishes\n * the new spec through that getter. `const { spec } = usePlayView()` therefore freezes at\n * the first read, and the screen stops following the actor — with no error and no\n * warning.\n *\n * The context holds `spec`, `handlers`, `registry` and `store`, and no other field. The\n * three beside `spec` are copied values, and the provider builds the subtree again when\n * one of them changes — see {@link ViewContextValue}.\n *\n * This changed in 2.3.0. Before it, every emission built the subtree again, so a value\n * that a component read one time was fresh because the component itself was new.\n *\n * @throws {Error} When the caller is outside an ActorProvider tree or a PlayUIProvider tree\n *\n * @example\n * ```tsx\n * import { usePlayView } from \"@xmachines/play-solid\";\n *\n * const MyRenderer: Component = () => {\n * const view = usePlayView();\n * return <Renderer spec={view.spec} registry={view.registry} />;\n * };\n * ```\n */\nexport function usePlayView(): ViewContextValue {\n\treturn assertNonNullable(useContext(ViewContext), \"ViewContext\");\n}\n\n// ---------------------------------------------------------------------------\n// ActorProviderProps\n// ---------------------------------------------------------------------------\n\n/**\n * The props of ActorProvider, the low-level provider.\n *\n * For the standard use, prefer PlayUIProvider. That component wraps ActorProvider\n * with JSONUIProvider and with every necessary sub-provider.\n */\nexport interface ActorProviderProps extends BaseActorProviderProps<DefineRegistryResult> {\n\t/**\n\t * The optional fallback element. The provider shows it when currentView is null, and when the ErrorBoundary catches an error\n\t */\n\tfallback?: JSX.Element;\n\n\t/**\n\t * The optional callback. The provider calls it when the SolidJS ErrorBoundary\n\t * catches an error.\n\t *\n\t * While the error is active, the provider renders the `fallback` instead of its\n\t * children. The provider clears the error on the next view emission (when\n\t * `currentView` changes), so a view transition retries the render.\n\t *\n\t * Element-level catalog component throws are caught upstream by the per-element\n\t * boundary of @json-render, and reported through `onRenderError`. This boundary is\n\t * the outer net for everything else.\n\t *\n\t * The second parameter is the RESET, for a retry that the host starts — a \"Retry\"\n\t * button of its own. It clears the caught error and renders again, and it resolves the\n\t * view that the actor holds at the MOMENT OF THE CALL, so a host that keeps the\n\t * callback cannot rewind the screen to the view that failed. A reset that the host\n\t * calls from inside this handler starts no second retry, because no input changed\n\t * between the two attempts, and a reset after the provider is disposed does nothing.\n\t * The five renderers hold the same three rules.\n\t *\n\t * **A handler that THROWS reaches no caller.** The provider contains that throw, and\n\t * it writes the throw to `console.error`. The fallback of this boundary is the RETURN\n\t * of the callback that reports, so a throw that left this handler would take the\n\t * fallback off the screen AND let the error escape the boundary.\n\t *\n\t * Report a failure from this handler. To ESCALATE one, raise it from a task of your\n\t * own — `rethrowLater(error)` of `@xmachines/core/utils` — which reaches the global handler of\n\t * the page and leaves the containment whole. The host installs `@xmachines/core` itself.\n\t * The five renderers hold this one rule.\n\t */\n\tonError?: (error: unknown, reset: () => void) => void;\n\n\t/**\n\t * The children. They are necessary, and they must hold a <PlayRenderer />. You can also use the PlayUIProvider short form\n\t */\n\tchildren: JSX.Element;\n}\n\n// ---------------------------------------------------------------------------\n// ActorProviderInner — it resolves the handlers inside the StateProvider tree\n// ---------------------------------------------------------------------------\n\n/**\n * The inner component runs inside StateProvider. It can therefore call\n * useStateStore() to get the live set function and the live getSnapshot function, for\n * the resolution of the handlers.\n */\nconst ActorProviderInner: Component<{\n\tregistryResult: DefineRegistryResult;\n\tspec: PlaySpec;\n\tstore: StateStore;\n\tchildren: JSX.Element;\n}> = (innerProps) => {\n\tconst stateCtx = useStateStore();\n\n\t// Build the SetState adapter. It joins stateCtx.update and stateCtx.getSnapshot\n\tconst setStateAdapter: SetState = (updater) => {\n\t\tconst prev = stateCtx.getSnapshot();\n\t\tstateCtx.update(updater(prev));\n\t};\n\n\tconst handlers = innerProps.registryResult.handlers(\n\t\t() => setStateAdapter,\n\t\t() => stateCtx.getSnapshot(),\n\t);\n\n\t// `spec` is a GETTER, and not a copied value. PlayRenderer reads it inside the\n\t// Renderer, which is a tracking scope. An emission that keeps the viewKey therefore\n\t// reaches the Renderer, and the Renderer reconciles the tree in place. A copied\n\t// value freezes at the first render, and the provider then needs a remount of the\n\t// subtree to show a new spec — which destroys the DOM, the focus, and the\n\t// uncommitted input of the user.\n\tconst viewValue: ViewContextValue = {\n\t\tget spec() {\n\t\t\treturn innerProps.spec;\n\t\t},\n\t\thandlers,\n\t\tregistry: innerProps.registryResult.registry,\n\t\tstore: innerProps.store,\n\t};\n\n\treturn <ViewContext.Provider value={viewValue}>{innerProps.children}</ViewContext.Provider>;\n};\n\n// ---------------------------------------------------------------------------\n// ActorProvider — the component. D-11 gives it the ActorProvider name\n// ---------------------------------------------------------------------------\n\n/**\n * The ActorProvider component. It owns the actor bridge, the atom subscription, the\n * StateStore lifecycle, the resolution of the handlers, and the error boundary.\n *\n * D-11: this component replaces the old raw alias\n * `ActorProvider = ActorContext.Provider`. A consumer with an\n * `<ActorProvider value={actor}>` element takes\n * `<ActorContext.Provider value={actor}>` now, for the raw access to the provider.\n * That consumer can also move to this component, or to PlayUIProvider.\n *\n * @example\n * ```tsx\n * import { ActorProvider, PlayRenderer } from \"@xmachines/play-solid\";\n *\n * <ActorProvider actor={myActor} registryResult={registryResult}>\n * <PlayRenderer />\n * </ActorProvider>\n * ```\n */\nexport const ActorProvider: Component<ActorProviderProps> = (props) => {\n\t// The SolidJS signal of the current view (PlaySpec | null)\n\tconst [view, setView] = createSignal<PlaySpec | null>(null);\n\n\t// The code gives a stable Proxy as the value of ActorContext, and not the raw actor.\n\t// The Context.Provider of Solid reads `value` one time, at its creation. Therefore\n\t// `props.actor` gives the FIRST actor only, and a useActor() consumer sees a change of\n\t// the prop never. With the proxy, each consumer keeps the reference of the creation,\n\t// and every property access (send, currentView, and the others) resolves against the\n\t// newest actor. A read of `props.actor` inside a trap is a reactive read. Therefore a\n\t// consumer that reads a property in a tracking scope, such as createEffect,\n\t// createMemo, or the JSX, runs again after a change of the actor. Each method binds to\n\t// the current actor. Therefore `this`, and also each private field, works exactly as\n\t// in a direct call. The ActorProvider proxy of play-vue does the same.\n\tconst actorProxy = new Proxy({} as AnyPlayActor, {\n\t\tget(_target, prop) {\n\t\t\tconst current = props.actor;\n\t\t\tconst value = Reflect.get(current, prop, current) as unknown;\n\t\t\treturn typeof value === \"function\" ? value.bind(current) : value;\n\t\t},\n\t\thas(_target, prop) {\n\t\t\treturn prop in props.actor;\n\t\t},\n\t});\n\n\t// Put onRenderError into the registry, when the caller gives one. The property is\n\t// not enumerable, and it replaces the handler below it.\n\t// The code keeps the result, because a new object on each reactive evaluation renders\n\t// each child component that receives it as a prop again, for nothing.\n\tconst resolvedRegistryResult = createMemo(() => {\n\t\tif (!props.onRenderError) return props.registryResult;\n\t\treturn {\n\t\t\t...props.registryResult,\n\t\t\tregistry: attachRenderErrorHandler(props.registryResult.registry, props.onRenderError),\n\t\t};\n\t});\n\n\t// The store lifecycle: it seeds the store again on a change of the viewKey, it\n\t// refreshes /context in place in every other case, it resets the store on a change of\n\t// the actor, and it guards the identity cache. The shared coordinator comes from\n\t// @xmachines/play-actor. Only the wiring of the reactivity in the tracked JSX scope\n\t// below belongs to Solid.\n\tconst storeLifecycle = createViewStoreLifecycle((seed) =>\n\t\txstateStoreStateStore({ atom: createAtom(seed) }),\n\t);\n\n\t// Connect the atom to the SolidJS signal. The code seeds the value AND starts\n\t// the watch in one createEffect, at the same moment. Therefore no race window is\n\t// between the .get() call and the registration of the watcher. The atom can\n\t// change between the first .get() call and the first notification of the watcher, and\n\t// the update function then holds the newest value.\n\tcreateEffect(() => {\n\t\t// `update` reads `setView` of the COMPONENT scope, which `createSignal` gives this\n\t\t// component and no other one, so a hoist to the module scope carries it nowhere.\n\t\t// The rule weighs the immediate parent alone: it reads the callback of\n\t\t// `createEffect`, it finds no capture there, and it asks for a move that the\n\t\t// closure refuses. oxlint 1.85.0 started to report it, and 1.83.0 reported it never.\n\t\t// oxlint-disable-next-line unicorn/consistent-function-scoping\n\t\tconst update = (nextView: PlaySpec | null) => setView(nextView);\n\t\tupdate(props.actor.currentView.get() as PlaySpec | null);\n\t\tconst unwatch = watchAtom(props.actor.currentView, (nextView) => {\n\t\t\tupdate(nextView as PlaySpec | null);\n\t\t});\n\t\tonCleanup(() => unwatch());\n\t});\n\n\t// RESET RULE: the boundary clears a caught error on the next view emission, so a\n\t// view transition retries the render. Without the rule the fallback stays for the\n\t// complete life of the provider: the user sends a recovery event, the actor moves to\n\t// a healthy view, and the screen keeps the fallback. play-react and play-svelte keep\n\t// the same rule.\n\tlet resetBoundary: (() => void) | undefined;\n\t// The report guard, from @xmachines/play-actor: it blocks a reset that the host calls\n\t// from INSIDE the report, and every reset once the owner is disposed — the host can\n\t// keep the callback, and a \"Retry\" button of a toast outlives the route that opened\n\t// it. The five renderers share the one implementation.\n\t//\n\t// It CONTAINS a handler of the host that throws. The fallback of this boundary is the\n\t// RETURN of the callback that reports, so a throw that leaves the report skips that\n\t// return: the screen keeps no fallback AND the error escapes the boundary, which is\n\t// both outcomes that the boundary exists to prevent. play-vue holds the same rule.\n\tconst guard = createReportGuard({\n\t\tnoHandler:\n\t\t\t\"[@xmachines/play-solid] ActorProvider contained an error of a descendant. \" +\n\t\t\t\"Give an onError prop to receive it.\",\n\t\thandlerThrew:\n\t\t\t\"[@xmachines/play-solid] the onError handler of the host threw. \" +\n\t\t\t\"ActorProvider contained the failure of the view all the same.\",\n\t});\n\tonCleanup(() => {\n\t\tguard.dispose();\n\t});\n\t// This renderer needs the report-once latch of play-vue and play-svelte NOT, and it\n\t// carries none. Solid calls a two-argument ErrorBoundary fallback inside `untrack`\n\t// (`untrack(() => f(e, () => setErrored()))` of solid-js), so the reads in that\n\t// fallback track nothing and it can run again on its own never: one caught error is\n\t// one call. The double report that this renderer had came from the effect below, which\n\t// ran on any prop of the host and retried a view that still fails.\n\t// The actor and the store BESIDE the view. A render fails on any of the three, so a\n\t// reset that watches the view alone leaves the fallback on the screen when the caller\n\t// repairs a controlled store, or swaps the actor, without a new emission. play-react\n\t// and play-svelte hold the same three.\n\t//\n\t// The effect COMPARES the three, and it trusts the notification not. A read of\n\t// `props.actor` or `props.store` goes through the spread of PlayUIProvider, and a read\n\t// of one key there subscribes to the props object of the parent — so ANY prop of the\n\t// host runs this effect again. Measured: a host that swaps its `fallback` element reset\n\t// the boundary, which retried the render of a view that still fails and reported the\n\t// same failure a second time. `on(..., { defer: true })` cannot hold that line, because\n\t// it re-runs on the notification and never asks whether a value moved.\n\tlet lastView: PlaySpec | null | undefined;\n\tlet lastActor: ActorProviderProps[\"actor\"] | undefined;\n\tlet lastStore: StateStore | undefined;\n\tlet seeded = false;\n\tcreateEffect(() => {\n\t\tconst nextView = view();\n\t\tconst nextActor = props.actor;\n\t\tconst nextStore = props.store;\n\t\t// The comparison of the three inputs, from @xmachines/play-actor. play-react and\n\t\t// play-svelte read the same function, so the rule of a NEW attempt stands one time.\n\t\tconst changed =\n\t\t\t!seeded ||\n\t\t\t!sameViewInputs(\n\t\t\t\t{ actor: lastActor, view: lastView, store: lastStore },\n\t\t\t\t{ actor: nextActor, view: nextView, store: nextStore },\n\t\t\t);\n\t\tlastView = nextView;\n\t\tlastActor = nextActor;\n\t\tlastStore = nextStore;\n\t\tif (!seeded) {\n\t\t\t// The first run seeds the record, and it resets nothing: there is no error yet.\n\t\t\tseeded = true;\n\t\t\treturn;\n\t\t}\n\t\tif (!changed) return;\n\t\tconst reset = resetBoundary;\n\t\tresetBoundary = undefined;\n\t\treset?.();\n\t});\n\n\treturn (\n\t\t<ActorContext.Provider value={actorProxy}>\n\t\t\t<ErrorBoundary\n\t\t\t\tfallback={(err: unknown, reset: () => void) => {\n\t\t\t\t\tresetBoundary = reset;\n\t\t\t\t\t// The reset of the boundary, wrapped for the HOST. Solid builds the\n\t\t\t\t\t// children again, so the retry resolves the view that the actor holds at\n\t\t\t\t\t// the moment of the call — a retry cannot rewind the screen to the view\n\t\t\t\t\t// that failed. The two guards are the ones that the five renderers hold:\n\t\t\t\t\t// a reset after the owner is disposed does nothing, and a reset that the\n\t\t\t\t\t// host calls from INSIDE this report does nothing, because no input\n\t\t\t\t\t// changed between the two attempts and Solid would rebuild on the same\n\t\t\t\t\t// stack until it ends.\n\t\t\t\t\tconst hostRetry = (): void => {\n\t\t\t\t\t\tif (guard.blocked()) return;\n\t\t\t\t\t\tresetBoundary = undefined;\n\t\t\t\t\t\treset();\n\t\t\t\t\t};\n\t\t\t\t\t// The boundary CONTAINS the error, and a boundary that throws it again\n\t\t\t\t\t// would take the application down — which is the failure that the\n\t\t\t\t\t// boundary exists to prevent. Report it instead. Without `onError` the\n\t\t\t\t\t// error reaches no handler and no console, because the ErrorBoundary of\n\t\t\t\t\t// Solid logs nothing itself, so write it to `console.error`. play-vue,\n\t\t\t\t\t// play-dom, and the inner renderer of @json-render each do the same.\n\t\t\t\t\t// A silent crash is the one result that no caller can debug.\n\t\t\t\t\tconst handler = props.onError;\n\t\t\t\t\tguard.report(err, handler ? () => handler(err, hostRetry) : undefined);\n\t\t\t\t\treturn props.fallback ?? null;\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{(() => {\n\t\t\t\t\t// The two memos below belong to the OWNER of the ErrorBoundary, because\n\t\t\t\t\t// the boundary evaluates its children in its own owner. A memo of the\n\t\t\t\t\t// component scope above stays outside the boundary, and a throw of\n\t\t\t\t\t// `spec.state` then escapes to the application. This function reads no\n\t\t\t\t\t// signal. Therefore it runs exactly one time.\n\n\t\t\t\t\t// The resolution of one emission. It runs for EVERY emission, because\n\t\t\t\t\t// the lifecycle must refresh /context in place, and it must seed the\n\t\t\t\t\t// store again on a new viewKey. The code reads props.actor and\n\t\t\t\t\t// props.store here. Both are therefore tracked, and a change of one of\n\t\t\t\t\t// them runs the resolution again.\n\t\t\t\t\tconst resolution = createMemo(() => {\n\t\t\t\t\t\tconst currentView = view();\n\t\t\t\t\t\tif (!currentView) return null;\n\t\t\t\t\t\tconst { guardedStore } = storeLifecycle.resolve(\n\t\t\t\t\t\t\tprops.actor,\n\t\t\t\t\t\t\tcurrentView,\n\t\t\t\t\t\t\tprops.store,\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn { view: currentView, store: guardedStore };\n\t\t\t\t\t});\n\n\t\t\t\t\t// The key of the SUBTREE REMOUNT. The lifecycle keeps one guard for each\n\t\t\t\t\t// store below it. The identity of the guard therefore changes only after\n\t\t\t\t\t// a new seed of the store, and never after a refresh of /context in\n\t\t\t\t\t// place. `<Show keyed>` builds the subtree again only on a change of this\n\t\t\t\t\t// value. Without this rule, each emission of a stream removes the DOM,\n\t\t\t\t\t// and the user loses the focus, the caret, and the input that the form\n\t\t\t\t\t// holds. play-vue keeps the same rule with its storeKey.\n\t\t\t\t\tconst subtreeStore = createMemo(() => resolution()?.store ?? null);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Show when={subtreeStore()} keyed fallback={props.fallback ?? null}>\n\t\t\t\t\t\t\t{(store: StateStore) => {\n\t\t\t\t\t\t\t\t// The spec that belongs to this seed. `untrack` keeps the read\n\t\t\t\t\t\t\t\t// out of the scope of the branch, so a later emission does not\n\t\t\t\t\t\t\t\t// build the branch again.\n\t\t\t\t\t\t\t\tconst seed = untrack(resolution);\n\t\t\t\t\t\t\t\tif (!seed) return null;\n\n\t\t\t\t\t\t\t\tconst currentSpec = (): PlaySpec => resolution()?.view ?? seed.view;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<StateProvider store={store}>\n\t\t\t\t\t\t\t\t\t\t{/* A swap of the registry, or of onRenderError, builds\n\t\t\t\t\t\t\t\t\t\t the tree again: ActorProviderInner resolves the\n\t\t\t\t\t\t\t\t\t\t handlers one time, at its own build. The memo keeps\n\t\t\t\t\t\t\t\t\t\t one identity for each pair. Therefore an emission\n\t\t\t\t\t\t\t\t\t\t alone never reaches this key. */}\n\t\t\t\t\t\t\t\t\t\t<Show when={resolvedRegistryResult()} keyed>\n\t\t\t\t\t\t\t\t\t\t\t{(registryResult: DefineRegistryResult) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<ActorProviderInner\n\t\t\t\t\t\t\t\t\t\t\t\t\tregistryResult={registryResult}\n\t\t\t\t\t\t\t\t\t\t\t\t\tspec={currentSpec()}\n\t\t\t\t\t\t\t\t\t\t\t\t\tstore={store}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t\t\t\t\t\t\t</ActorProviderInner>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</Show>\n\t\t\t\t\t\t\t\t\t</StateProvider>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</Show>\n\t\t\t\t\t);\n\t\t\t\t})()}\n\t\t\t</ErrorBoundary>\n\t\t</ActorContext.Provider>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoEA,IAAM+B,cAAc3B,cAAuC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8B/D,SAAgB4B,cAAgC;CAC/C,OAAOZ,kBAAkBf,WAAW0B,WAAW,GAAG,aAAa;AAChE;;;;;;AAiEA,IAAMS,sBAKAI,eAAe;CACpB,MAAMC,WAAWjC,cAAc;CAG/B,MAAMkC,mBAA6BC,YAAY;EAC9C,MAAMC,OAAOH,SAASI,YAAY;EAClCJ,SAASK,OAAOH,QAAQC,IAAI,CAAC;CAC9B;CAaA,MAAMI,YAA8B;EACnC,IAAIV,OAAO;GACV,OAAOE,WAAWF;EACnB;EACAS,UAfgBP,WAAWH,eAAeU,eACpCL,uBACAD,SAASI,YAAY,CAa3BE;EACAE,UAAUT,WAAWH,eAAeY;EACpCV,OAAOC,WAAWD;CACnB;CAEA,OAAAW,gBAAQvB,YAAYwB,UAAQ;EAACC,OAAOJ;EAAS,IAAAb,WAAA;GAAA,OAAGK,WAAWL;EAAQ;CAAA,CAAA;AACpE;;;;;;;;;;;;;;;;;;;;AAyBA,IAAakB,iBAAgDC,UAAU;CAEtE,MAAM,C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,IAAI,CAACvB,MAAM,OAAO;QAElB,MAAM6B,oBAA8BN,WAAW,CAAC,EAAEtC,QAAQe,KAAKf;QAE/D,OAAAL,gBACE3C,eAAa;SAAQgC;SAAK,IAAAJ,WAAA;UAAA,OAAAe,gBAMzB9C,MAAI;WAAA,IAAC6F,OAAI;YAAA,OAAE9B,uBAAuB;WAAC;WAAE+B,OAAK;WAAA/D,WACxCE,mBAAoCa,gBACpCd,oBAAkB;YACFC;YAAc,IAC9BC,OAAI;aAAA,OAAE6D,YAAY;YAAC;YACZ5D;YAAK,IAAAJ,WAAA;aAAA,OAEXmB,MAAMnB;YAAQ;WAAA,CAAA;UAEhB,CAAA;SAAA;QAAA,CAAA;OAIL;MAAC,CAAA;KAGJ,EAAA,CAAG;IAAC;GAAA,CAAA;EAAA;CAAA,CAAA;AAIR"}
1
+ {"version":3,"file":"ActorProvider.js","names":["createSignal","createEffect","createMemo","onCleanup","onMount","createContext","useContext","untrack","ErrorBoundary","Show","Component","JSX","StateProvider","useStateStore","DefineRegistryResult","StateStore","ComponentRegistry","createAtom","xstateStoreStateStore","assertNonNullable","bindStoreHandlers","createActorProxy","createRenderErrorBinding","createReportGuard","createViewSession","PlaySpec","ViewSessionSnapshot","BaseActorProviderProps","BaseViewContextValue","ActorContext","AnyPlayActor","ViewContextValue","ViewContext","usePlayView","ActorProviderProps","fallback","Element","onError","error","reset","children","ActorProviderInner","registryResult","spec","store","innerProps","stateCtx","handlers","viewValue","registry","_$createComponent","Provider","value","ActorProvider","props","actorProxy","actor","bindRenderError","resolvedRegistryResult","onRenderError","session","failView","createStore","seed","atom","snapshot","setSnapshot","getSnapshot","release","subscribe","dispose","nextActor","nextStore","setInputs","resetBoundary","guard","noHandler","handlerThrew","lastSnapshot","next","previous","undefined","err","hostRetry","blocked","retry","handler","report","resolution","current","failure","view","subtreeStore","when","keyed","currentSpec","_$createComponent"],"sources":["../src/ActorProvider.tsx"],"sourcesContent":["/**\n * ActorProvider — the SolidJS provider component of the XMachines Play actor lifecycle.\n *\n * This is the low-level provider, for the author of a library who needs the control.\n * Most users take PlayUIProvider, the composite provider, instead.\n *\n * This component:\n * - subscribes to the actor.currentView atom with watchAtom, in the body of the component (Phase 29)\n * - manages the StateStore lifecycle of each view, controlled and uncontrolled\n * - resolves each action handler with the inner component pattern, inside StateProvider\n * - puts onRenderError into the registry, when the caller gives one\n * - gives ActorContext (the actor) and ViewContext (the spec, the handlers, and the registry) to the children\n * - wraps the render path in a SolidJS ErrorBoundary\n *\n * D-11: the old alias `ActorProvider = ActorContext.Provider` is gone. This component\n * has the name now. Use `ActorContext.Provider` directly for the raw access.\n *\n * @packageDocumentation\n */\n\nimport {\n\tcreateSignal,\n\tcreateEffect,\n\tcreateMemo,\n\tonCleanup,\n\tonMount,\n\tcreateContext,\n\tuseContext,\n\tuntrack,\n\tErrorBoundary,\n\tShow,\n} from \"solid-js\";\nimport type { Component, JSX } from \"solid-js\";\nimport { StateProvider, useStateStore } from \"@xmachines/json-render-solid\";\nimport type { DefineRegistryResult } from \"@xmachines/json-render-solid\";\nimport type { StateStore } from \"@xmachines/json-render-core\";\nimport type { ComponentRegistry } from \"@xmachines/json-render-solid\";\nimport { createAtom } from \"@xmachines/play-atom\";\nimport { xstateStoreStateStore } from \"@xmachines/json-render-xstate\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport {\n\tbindStoreHandlers,\n\tcreateActorProxy,\n\tcreateRenderErrorBinding,\n\tcreateReportGuard,\n\tcreateViewSession,\n\ttype PlaySpec,\n\ttype ViewSessionSnapshot,\n\ttype BaseActorProviderProps,\n\ttype BaseViewContextValue,\n} from \"@xmachines/play-view\";\nimport { ActorContext, type AnyPlayActor } from \"./useActor.js\";\n\n// ---------------------------------------------------------------------------\n// ViewContextValue — the shape of the context value that ActorProvider gives\n// ---------------------------------------------------------------------------\n\n/**\n * The value that the ViewContext of ActorProvider provides.\n * usePlayView() gives it inside the ActorProvider tree.\n *\n * **`spec` is a live GETTER, and not a copied value.** The provider keeps the subtree\n * across an emission that holds the viewKey, so a read of `spec` inside a tracking\n * scope gives the newest spec and the Renderer reconciles in place. A read outside a\n * tracking scope gives a snapshot that goes old: `const { spec } = usePlayView()` and\n * `{ ...usePlayView() }` both freeze on the spec of that moment. Read `view.spec` at\n * the place of the use instead. The other three fields are copied values, and the\n * provider builds the subtree again when one of them changes.\n */\nexport interface ViewContextValue extends BaseViewContextValue<ComponentRegistry> {}\n\nconst ViewContext = createContext<ViewContextValue | null>(null);\n\n/**\n * The hook that gives the current view context inside an ActorProvider tree.\n *\n * **Read a field where you use it, and destructure it not.** `spec` is a GETTER: the\n * provider keeps the subtree across an emission that holds the viewKey, and it publishes\n * the new spec through that getter. `const { spec } = usePlayView()` therefore freezes at\n * the first read, and the screen stops following the actor — with no error and no\n * warning.\n *\n * The context holds `spec`, `handlers`, `registry` and `store`, and no other field. The\n * three beside `spec` are copied values, and the provider builds the subtree again when\n * one of them changes — see {@link ViewContextValue}.\n *\n * This changed in 2.3.0. Before it, every emission built the subtree again, so a value\n * that a component read one time was fresh because the component itself was new.\n *\n * @throws {Error} When the caller is outside an ActorProvider tree or a PlayUIProvider tree\n *\n * @example\n * ```tsx\n * import { usePlayView } from \"@xmachines/play-solid\";\n *\n * const MyRenderer: Component = () => {\n * const view = usePlayView();\n * return <Renderer spec={view.spec} registry={view.registry} />;\n * };\n * ```\n */\nexport function usePlayView(): ViewContextValue {\n\treturn assertNonNullable(useContext(ViewContext), \"ViewContext\");\n}\n\n// ---------------------------------------------------------------------------\n// ActorProviderProps\n// ---------------------------------------------------------------------------\n\n/**\n * The props of ActorProvider, the low-level provider.\n *\n * For the standard use, prefer PlayUIProvider. That component wraps ActorProvider\n * with JSONUIProvider and with every necessary sub-provider.\n */\nexport interface ActorProviderProps extends BaseActorProviderProps<DefineRegistryResult> {\n\t/**\n\t * The optional fallback element. The provider shows it when currentView is null, and when the ErrorBoundary catches an error\n\t */\n\tfallback?: JSX.Element;\n\n\t/**\n\t * The optional callback. The provider calls it when the SolidJS ErrorBoundary\n\t * catches an error.\n\t *\n\t * While the error is active, the provider renders the `fallback` instead of its\n\t * children. The provider clears the error on the next view emission (when\n\t * `currentView` changes), so a view transition retries the render.\n\t *\n\t * The per-element boundary of `json-render` catches a throw of a catalog component\n\t * below the root, and it reports it through `onRenderError` alone. A failure of the\n\t * ROOT — its component, a prop, or its `visible` condition — leaves no view, and\n\t * json-render gives it to no boundary of the host. The provider contains it as a\n\t * failure of the view all the same: it shows the fallback, and it calls this handler\n\t * one time. `onRenderError` also receives it, with `info.kind` `\"root\"`. This boundary\n\t * is the outer net for everything else.\n\t *\n\t * The second parameter is the RESET, for a retry that the host starts — a \"Retry\"\n\t * button of its own. It clears the caught error and renders again, and it resolves the\n\t * view that the actor holds at the MOMENT OF THE CALL, so a host that keeps the\n\t * callback cannot rewind the screen to the view that failed. A reset that the host\n\t * calls from inside this handler starts no second retry, because no input changed\n\t * between the two attempts, and a reset after the provider is disposed does nothing.\n\t * The five renderers hold the same three rules.\n\t *\n\t * **A handler that THROWS reaches no caller.** The provider contains that throw, and\n\t * it writes the throw to `console.error`. The fallback of this boundary is the RETURN\n\t * of the callback that reports, so a throw that left this handler would take the\n\t * fallback off the screen AND let the error escape the boundary.\n\t *\n\t * Report a failure from this handler. To ESCALATE one, raise it from a task of your\n\t * own — `rethrowLater(error)` of `@xmachines/core/utils` — which reaches the global handler of\n\t * the page and leaves the containment whole. The host installs `@xmachines/core` itself.\n\t * The five renderers hold this one rule.\n\t */\n\tonError?: (error: unknown, reset: () => void) => void;\n\n\t/**\n\t * The children. They are necessary, and they must hold a <PlayRenderer />. You can also use the PlayUIProvider short form\n\t */\n\tchildren: JSX.Element;\n}\n\n// ---------------------------------------------------------------------------\n// ActorProviderInner — it resolves the handlers inside the StateProvider tree\n// ---------------------------------------------------------------------------\n\n/**\n * The inner component runs inside StateProvider. It can therefore call\n * useStateStore() to get the live set function and the live getSnapshot function, for\n * the resolution of the handlers.\n */\nconst ActorProviderInner: Component<{\n\tregistryResult: DefineRegistryResult;\n\tspec: PlaySpec;\n\tstore: StateStore;\n\tchildren: JSX.Element;\n}> = (innerProps) => {\n\tconst stateCtx = useStateStore();\n\n\tconst handlers = bindStoreHandlers(innerProps.registryResult, () => stateCtx);\n\n\t// `spec` is a GETTER, and not a copied value. PlayRenderer reads it inside the\n\t// Renderer, which is a tracking scope. An emission that keeps the viewKey therefore\n\t// reaches the Renderer, and the Renderer reconciles the tree in place. A copied\n\t// value freezes at the first render, and the provider then needs a remount of the\n\t// subtree to show a new spec — which destroys the DOM, the focus, and the\n\t// uncommitted input of the user.\n\tconst viewValue: ViewContextValue = {\n\t\tget spec() {\n\t\t\treturn innerProps.spec;\n\t\t},\n\t\thandlers,\n\t\tregistry: innerProps.registryResult.registry,\n\t\tstore: innerProps.store,\n\t};\n\n\treturn <ViewContext.Provider value={viewValue}>{innerProps.children}</ViewContext.Provider>;\n};\n\n// ---------------------------------------------------------------------------\n// ActorProvider — the component. D-11 gives it the ActorProvider name\n// ---------------------------------------------------------------------------\n\n/**\n * The ActorProvider component. It owns the actor bridge, the atom subscription, the\n * StateStore lifecycle, the resolution of the handlers, and the error boundary.\n *\n * D-11: this component replaces the old raw alias\n * `ActorProvider = ActorContext.Provider`. A consumer with an\n * `<ActorProvider value={actor}>` element takes\n * `<ActorContext.Provider value={actor}>` now, for the raw access to the provider.\n * That consumer can also move to this component, or to PlayUIProvider.\n *\n * @example\n * ```tsx\n * import { ActorProvider, PlayRenderer, usePlayView } from \"@xmachines/play-solid\";\n * import { JSONUIProvider } from \"@xmachines/json-render-solid\";\n *\n * // PlayRenderer needs the providers of json-render around it. PlayUIProvider adds them.\n * // A custom composition hands JSONUIProvider the store of the view context.\n * const MyProviders = (props: { children: JSX.Element }) => {\n * const view = usePlayView();\n * return (\n * <JSONUIProvider registry={view.registry} handlers={view.handlers} store={view.store}>\n * {props.children}\n * </JSONUIProvider>\n * );\n * };\n *\n * <ActorProvider actor={myActor} registryResult={registryResult}>\n * <MyProviders>\n * <PlayRenderer />\n * </MyProviders>\n * </ActorProvider>\n * ```\n */\nexport const ActorProvider: Component<ActorProviderProps> = (props) => {\n\t// The SolidJS signal of the current view (PlaySpec | null)\n\n\t// The code gives a stable Proxy as the value of ActorContext, and not the raw actor.\n\t// The Context.Provider of Solid reads `value` one time, at its creation. Therefore\n\t// `props.actor` gives the FIRST actor only, and a useActor() consumer sees a change of\n\t// the prop never. With the proxy, each consumer keeps the reference of the creation,\n\t// and every property access (send, currentView, and the others) resolves against the\n\t// newest actor. A read of `props.actor` inside a trap is a reactive read. Therefore a\n\t// consumer that reads a property in a tracking scope, such as createEffect,\n\t// createMemo, or the JSX, runs again after a change of the actor. Each method binds to\n\t// the current actor. Therefore `this`, and also each private field, works exactly as\n\t// in a direct call. createActorProxy of play-view builds the proxy for play-vue and\n\t// play-svelte too.\n\tconst actorProxy = createActorProxy<AnyPlayActor>(() => props.actor);\n\n\t// Put the handler of the provider into the registry. The property is not enumerable,\n\t// and it replaces the handler below it. It gives each report to the onRenderError prop,\n\t// and it gives a failure of the ROOT to the session: json-render reports such a failure\n\t// to no ErrorBoundary of the host, so the session records it in a new snapshot, and the\n\t// resolution memo below throws it inside the ErrorBoundary, which shows the fallback and\n\t// calls onError.\n\t// The binding keeps one copy for each registry, and the copy calls the newest handler.\n\t// The memo can run again on a notification alone — a spread of the props of the host\n\t// subscribes it to every prop — and it then returns the SAME copy. The keyed Show below\n\t// therefore builds the tree again only for a new registry.\n\tconst bindRenderError = createRenderErrorBinding<DefineRegistryResult>();\n\tconst resolvedRegistryResult = createMemo(() =>\n\t\tbindRenderError(props.registryResult, props.onRenderError, (error) =>\n\t\t\tsession.failView(error),\n\t\t),\n\t);\n\n\t// The view session, from @xmachines/play-view. It resolves the store of the view when\n\t// the actor emits, when the host hands over a new actor or store, and for a retry —\n\t// never in a render — and it seeds, refreshes and drops the store by the rules of the\n\t// lifecycle. The five renderers share it, and only the wiring below belongs to Solid.\n\t//\n\t// The session gives this renderer no report of its own: a failed resolution throws in\n\t// a memo inside the ErrorBoundary below, and the fallback of the boundary reports it.\n\tconst session = createViewSession(\n\t\tuntrack(() => props.actor),\n\t\tuntrack(() => props.store),\n\t\t{ createStore: (seed) => xstateStoreStateStore({ atom: createAtom(seed) }) },\n\t);\n\t// The signal of the snapshot. A new resolution makes a new object, and the signal\n\t// compares by identity, so it notifies for a new attempt alone.\n\tconst [snapshot, setSnapshot] = createSignal<ViewSessionSnapshot>(session.getSnapshot());\n\n\t// The connection resolves again, and it writes /context into a controlled store, so it\n\t// waits for the mount: a component function runs inside the render of its parent.\n\tonMount(() => {\n\t\tconst release = session.subscribe(() => setSnapshot(session.getSnapshot()));\n\t\tsetSnapshot(session.getSnapshot());\n\t\tonCleanup(release);\n\t});\n\tonCleanup(() => session.dispose());\n\n\t// Hand a new actor or a new controlled store to the session. A read of `props.actor`\n\t// or `props.store` goes through the spread of PlayUIProvider, and a read of one key\n\t// there subscribes to the props object of the parent, so ANY prop of the host runs this\n\t// effect again. setInputs compares both inputs, and a run that moved neither does\n\t// nothing.\n\tcreateEffect(() => {\n\t\tconst nextActor = props.actor;\n\t\tconst nextStore = props.store;\n\t\tuntrack(() => session.setInputs(nextActor, nextStore));\n\t});\n\n\t// RESET RULE: the boundary clears a caught error on the next view emission, so a\n\t// view transition retries the render. Without the rule the fallback stays for the\n\t// complete life of the provider: the user sends a recovery event, the actor moves to\n\t// a healthy view, and the screen keeps the fallback. play-react and play-svelte keep\n\t// the same rule.\n\tlet resetBoundary: (() => void) | undefined;\n\t// The report guard, from @xmachines/play-view: it blocks a reset that the host calls\n\t// from INSIDE the report, and every reset once the owner is disposed — the host can\n\t// keep the callback, and a \"Retry\" button of a toast outlives the route that opened\n\t// it. The five renderers share the one implementation.\n\t//\n\t// It CONTAINS a handler of the host that throws. The fallback of this boundary is the\n\t// RETURN of the callback that reports, so a throw that leaves the report skips that\n\t// return: the screen keeps no fallback AND the error escapes the boundary, which is\n\t// both outcomes that the boundary exists to prevent. play-vue holds the same rule.\n\tconst guard = createReportGuard({\n\t\tnoHandler:\n\t\t\t\"[@xmachines/play-solid] ActorProvider contained an error of a descendant. \" +\n\t\t\t\"Give an onError prop to receive it.\",\n\t\thandlerThrew:\n\t\t\t\"[@xmachines/play-solid] the onError handler of the host threw. \" +\n\t\t\t\"ActorProvider contained the failure of the view all the same.\",\n\t});\n\tonCleanup(() => {\n\t\tguard.dispose();\n\t});\n\t// This renderer needs no latch that reports a failure one time, and it carries none.\n\t// Solid calls a two-argument ErrorBoundary fallback inside `untrack`\n\t// (`untrack(() => f(e, () => setErrored()))` of solid-js), so the reads in that\n\t// fallback track nothing and it can run again on its own never: one caught error is\n\t// one call. The double report that this renderer had came from the effect below, which\n\t// ran on any prop of the host and retried a view that still fails.\n\t// The SNAPSHOT, and not the view alone. The session makes a new one for each new\n\t// attempt: a new view, a new actor, or a new controlled store. A render fails on any of\n\t// the three, so a reset that watches the view alone leaves the fallback on the screen\n\t// when the caller repairs a controlled store, or swaps the actor, without a new\n\t// emission.\n\t//\n\t// The effect COMPARES the snapshot, and it trusts the notification not: an\n\t// `on(..., { defer: true })` re-runs on a notification and never asks whether a value\n\t// moved.\n\tlet lastSnapshot: ViewSessionSnapshot | undefined;\n\tcreateEffect(() => {\n\t\tconst next = snapshot();\n\t\tconst previous = lastSnapshot;\n\t\tlastSnapshot = next;\n\t\t// The first run seeds the record, and it resets nothing: there is no error yet.\n\t\tif (previous === undefined || next === previous) return;\n\t\tconst reset = resetBoundary;\n\t\tresetBoundary = undefined;\n\t\treset?.();\n\t});\n\n\treturn (\n\t\t<ActorContext.Provider value={actorProxy}>\n\t\t\t<ErrorBoundary\n\t\t\t\tfallback={(err: unknown, reset: () => void) => {\n\t\t\t\t\tresetBoundary = reset;\n\t\t\t\t\t// The reset of the boundary, wrapped for the HOST. Solid builds the\n\t\t\t\t\t// children again, so the retry resolves the view that the actor holds at\n\t\t\t\t\t// the moment of the call — a retry cannot rewind the screen to the view\n\t\t\t\t\t// that failed. The two guards are the ones that the five renderers hold:\n\t\t\t\t\t// a reset after the owner is disposed does nothing, and a reset that the\n\t\t\t\t\t// host calls from INSIDE this report does nothing, because no input\n\t\t\t\t\t// changed between the two attempts and Solid would rebuild on the same\n\t\t\t\t\t// stack until it ends.\n\t\t\t\t\tconst hostRetry = (): void => {\n\t\t\t\t\t\tif (guard.blocked()) return;\n\t\t\t\t\t\tresetBoundary = undefined;\n\t\t\t\t\t\t// The session resolves the view that the actor holds NOW, so a failed\n\t\t\t\t\t\t// resolution gets a new attempt, and the reset renders it.\n\t\t\t\t\t\tsession.retry();\n\t\t\t\t\t\treset();\n\t\t\t\t\t};\n\t\t\t\t\t// The boundary CONTAINS the error, and a boundary that throws it again\n\t\t\t\t\t// would take the application down — which is the failure that the\n\t\t\t\t\t// boundary exists to prevent. Report it instead. Without `onError` the\n\t\t\t\t\t// error reaches no handler and no console, because the ErrorBoundary of\n\t\t\t\t\t// Solid logs nothing itself, so write it to `console.error`. play-vue,\n\t\t\t\t\t// play-dom, and the inner renderer of @json-render each do the same.\n\t\t\t\t\t// A silent crash is the one result that no caller can debug.\n\t\t\t\t\tconst handler = props.onError;\n\t\t\t\t\tguard.report(err, handler ? () => handler(err, hostRetry) : undefined);\n\t\t\t\t\treturn props.fallback ?? null;\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{(() => {\n\t\t\t\t\t// The two memos below belong to the OWNER of the ErrorBoundary, because\n\t\t\t\t\t// the boundary evaluates its children in its own owner. A memo of the\n\t\t\t\t\t// component scope above stays outside the boundary, and a throw of\n\t\t\t\t\t// `spec.state` then escapes to the application. This function reads no\n\t\t\t\t\t// signal. Therefore it runs exactly one time.\n\n\t\t\t\t\t// The snapshot of the session, inside the boundary. A failed resolution\n\t\t\t\t\t// THROWS here, where the ErrorBoundary catches it and its fallback\n\t\t\t\t\t// reports it. A gap gives null.\n\t\t\t\t\tconst resolution = createMemo(() => {\n\t\t\t\t\t\tconst current = snapshot();\n\t\t\t\t\t\tif (current.failure) throw current.failure.error;\n\t\t\t\t\t\tif (!current.view || !current.store) return null;\n\t\t\t\t\t\treturn { view: current.view, store: current.store };\n\t\t\t\t\t});\n\n\t\t\t\t\t// The key of the SUBTREE REMOUNT. The lifecycle keeps one guard for each\n\t\t\t\t\t// store below it. The identity of the guard therefore changes with the\n\t\t\t\t\t// generation of the store, and never for a refresh of /context in\n\t\t\t\t\t// place. `<Show keyed>` builds the subtree again only on a change of this\n\t\t\t\t\t// value. Without this rule, each emission of a stream removes the DOM,\n\t\t\t\t\t// and the user loses the focus, the caret, and the input that the form\n\t\t\t\t\t// holds. play-vue keys its subtree on the same generation.\n\t\t\t\t\tconst subtreeStore = createMemo(() => resolution()?.store ?? null);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Show when={subtreeStore()} keyed fallback={props.fallback ?? null}>\n\t\t\t\t\t\t\t{(store: StateStore) => {\n\t\t\t\t\t\t\t\t// The spec that belongs to this seed. `untrack` keeps the read\n\t\t\t\t\t\t\t\t// out of the scope of the branch, so a later emission does not\n\t\t\t\t\t\t\t\t// build the branch again.\n\t\t\t\t\t\t\t\tconst seed = untrack(resolution);\n\t\t\t\t\t\t\t\tif (!seed) return null;\n\n\t\t\t\t\t\t\t\tconst currentSpec = (): PlaySpec => resolution()?.view ?? seed.view;\n\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<StateProvider store={store}>\n\t\t\t\t\t\t\t\t\t\t{/* A swap of the registry builds the tree again:\n\t\t\t\t\t\t\t\t\t\t ActorProviderInner resolves the handlers one time,\n\t\t\t\t\t\t\t\t\t\t at its own build. The binding keeps one copy for\n\t\t\t\t\t\t\t\t\t\t each registry, and the copy calls the newest\n\t\t\t\t\t\t\t\t\t\t onRenderError. Therefore a swap of that prop, or an\n\t\t\t\t\t\t\t\t\t\t emission alone, never reaches this key. */}\n\t\t\t\t\t\t\t\t\t\t<Show when={resolvedRegistryResult()} keyed>\n\t\t\t\t\t\t\t\t\t\t\t{(registryResult: DefineRegistryResult) => (\n\t\t\t\t\t\t\t\t\t\t\t\t<ActorProviderInner\n\t\t\t\t\t\t\t\t\t\t\t\t\tregistryResult={registryResult}\n\t\t\t\t\t\t\t\t\t\t\t\t\tspec={currentSpec()}\n\t\t\t\t\t\t\t\t\t\t\t\t\tstore={store}\n\t\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t\t\t\t\t\t\t</ActorProviderInner>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t</Show>\n\t\t\t\t\t\t\t\t\t</StateProvider>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t</Show>\n\t\t\t\t\t);\n\t\t\t\t})()}\n\t\t\t</ErrorBoundary>\n\t\t</ActorContext.Provider>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,IAAMgC,cAAc3B,cAAuC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8B/D,SAAgB4B,cAAgC;CAC/C,OAAOd,kBAAkBb,WAAW0B,WAAW,GAAG,aAAa;AAChE;;;;;;AAqEA,IAAMS,sBAKAI,eAAe;CACpB,MAAMC,WAAWjC,cAAc;CAU/B,MAAMmC,YAA8B;EACnC,IAAIL,OAAO;GACV,OAAOE,WAAWF;EACnB;EACAI,UAZgB3B,kBAAkByB,WAAWH,sBAAsBI,QAYnEC;EACAE,UAAUJ,WAAWH,eAAeO;EACpCL,OAAOC,WAAWD;CACnB;CAEA,OAAAM,gBAAQlB,YAAYmB,UAAQ;EAACC,OAAOJ;EAAS,IAAAR,WAAA;GAAA,OAAGK,WAAWL;EAAQ;CAAA,CAAA;AACpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAaa,iBAAgDC,UAAU;CActE,MAAMC,aAAalC,uBAAqCiC,MAAME,KAAK;CAYnE,MAAMC,kBAAkBnC,yBAA+C;CACvE,M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,EAAA,CAAG;IAAC;GAAA,CAAA;EAAA;CAAA,CAAA;AAIR"}
@@ -1 +1 @@
1
- {"version":3,"file":"PlayRenderer.js","names":["Component","Renderer","usePlayView","PlayRenderer","view","_$createComponent","spec","registry"],"sources":["../src/PlayRenderer.tsx"],"sourcesContent":["/**\n * PlayRenderer - the leaf component without props of the XMachines Play SolidJS architecture.\n *\n * It reads the view context of the ActorProvider around it, or of the\n * PlayUIProvider, with usePlayView(). It then renders the spec with the Renderer of\n * @xmachines/json-render-solid.\n *\n * The standard use:\n * ```tsx\n * <PlayUIProvider actor={myActor} registryResult={registryResult}>\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * @packageDocumentation\n */\n\nimport type { Component } from \"solid-js\";\nimport { Renderer } from \"@xmachines/json-render-solid\";\nimport { usePlayView } from \"./ActorProvider.js\";\n\n/**\n * The leaf renderer without props. Put it inside an ActorProvider tree or a\n * PlayUIProvider tree.\n *\n * It reads the ViewContextValue (the spec, the handlers, and the registry) of the\n * provider around it, with usePlayView(). It then renders the spec with the Renderer\n * of @xmachines/json-render-solid.\n */\nexport const PlayRenderer: Component = () => {\n\tconst view = usePlayView();\n\treturn <Renderer spec={view.spec} registry={view.registry} />;\n};\n"],"mappings":";;;;;;;;;;;;AA6BA,IAAaG,qBAAgC;CAC5C,MAAMC,OAAOF,YAAY;CACzB,OAAAG,gBAAQJ,UAAQ;EAAA,IAACK,OAAI;GAAA,OAAEF,KAAKE;EAAI;EAAA,IAAEC,WAAQ;GAAA,OAAEH,KAAKG;EAAQ;CAAA,CAAA;AAC1D"}
1
+ {"version":3,"file":"PlayRenderer.js","names":["Component","Renderer","usePlayView","PlayRenderer","view","_$createComponent","spec","registry","_$createComponent"],"sources":["../src/PlayRenderer.tsx"],"sourcesContent":["/**\n * PlayRenderer - the leaf component without props of the XMachines Play SolidJS architecture.\n *\n * It reads the view context of the ActorProvider around it, or of the\n * PlayUIProvider, with usePlayView(). It then renders the spec with the Renderer of\n * @xmachines/json-render-solid.\n *\n * The standard use:\n * ```tsx\n * <PlayUIProvider actor={myActor} registryResult={registryResult}>\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * @packageDocumentation\n */\n\nimport type { Component } from \"solid-js\";\nimport { Renderer } from \"@xmachines/json-render-solid\";\nimport { usePlayView } from \"./ActorProvider.js\";\n\n/**\n * The leaf renderer without props. Put it inside an ActorProvider tree or a\n * PlayUIProvider tree.\n *\n * It reads the ViewContextValue (the spec, the handlers, and the registry) of the\n * provider around it, with usePlayView(). It then renders the spec with the Renderer\n * of @xmachines/json-render-solid.\n */\nexport const PlayRenderer: Component = () => {\n\tconst view = usePlayView();\n\treturn <Renderer spec={view.spec} registry={view.registry} />;\n};\n"],"mappings":";;;;;;;;;;;;AA6BA,IAAaG,qBAAgC;CAC5C,MAAMC,OAAOF,YAAY;CACzB,OAAAG,gBAAQJ,UAAQ;EAAA,IAACK,OAAI;GAAA,OAAEF,KAAKE;EAAI;EAAA,IAAEC,WAAQ;GAAA,OAAEH,KAAKG;EAAQ;CAAA,CAAA;AAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"PlayUIProvider.js","names":["Component","JSX","JSONUIProvider","JSONUIProviderProps","ActorProvider","usePlayView","ActorProviderProps","JSONUIForwardedProps","Pick","PlayUIProviderProps","Partial","JSONUIBridge","children","Element","bridgeProps","view","_$createComponent","_$mergeProps","registry","handlers","store","validationFunctions","undefined","navigate","functions","PlayUIProvider","props","actor","registryResult","fallback","onError","onRenderError"],"sources":["../src/PlayUIProvider.tsx"],"sourcesContent":["/**\n * PlayUIProvider — the composite SolidJS provider of XMachines Play.\n *\n * It wraps ActorProvider and JSONUIProvider into one composite provider.\n * This is the recommended entry point for most users.\n *\n * The standard use:\n * ```tsx\n * import { PlayUIProvider, PlayRenderer, defineRegistry } from \"@xmachines/play-solid\";\n *\n * const registryResult = defineRegistry(myCatalog, { components, actions });\n *\n * <PlayUIProvider actor={myActor} registryResult={registryResult}>\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * For the complete control, which the author of a library needs, use ActorProvider\n * directly.\n *\n * @packageDocumentation\n */\n\nimport type { Component, JSX } from \"solid-js\";\nimport { JSONUIProvider, type JSONUIProviderProps } from \"@xmachines/json-render-solid\";\nimport { ActorProvider, usePlayView, type ActorProviderProps } from \"./ActorProvider.js\";\n\n// Take only the forwarded props of JSONUIProviderProps (D-16)\ntype JSONUIForwardedProps = Pick<\n\tJSONUIProviderProps,\n\t\"validationFunctions\" | \"navigate\" | \"functions\"\n>;\n\n/**\n * The props of PlayUIProvider — every ActorProvider prop, and also the props that it forwards to JSONUIProvider.\n */\nexport interface PlayUIProviderProps extends ActorProviderProps, Partial<JSONUIForwardedProps> {}\n\n/**\n * The inner bridge component. Put it inside the tree of ActorProvider, so that\n * usePlayView() can read the resolved ViewContextValue. It reads the handlers and the\n * registry of the view context, and it gives them to JSONUIProvider.\n *\n * The React implementation uses the same bridge pattern, in JSONUIBridge of\n * play-react.\n */\nconst JSONUIBridge: Component<Partial<JSONUIForwardedProps> & { children: JSX.Element }> = (\n\tbridgeProps,\n) => {\n\tconst view = usePlayView();\n\n\treturn (\n\t\t<JSONUIProvider\n\t\t\tregistry={view.registry}\n\t\t\thandlers={view.handlers}\n\t\t\tstore={view.store}\n\t\t\t{...(bridgeProps.validationFunctions !== undefined && {\n\t\t\t\tvalidationFunctions: bridgeProps.validationFunctions,\n\t\t\t})}\n\t\t\t{...(bridgeProps.navigate !== undefined && { navigate: bridgeProps.navigate })}\n\t\t\t{...(bridgeProps.functions !== undefined && { functions: bridgeProps.functions })}\n\t\t>\n\t\t\t{bridgeProps.children}\n\t\t</JSONUIProvider>\n\t);\n};\n\n/**\n * The composite provider: ActorProvider and JSONUIProvider.\n *\n * It gives you the complete stack of the JSON render context:\n * - ActorContext, which holds the actor instance, through ActorProvider\n * - ViewContext, which holds the spec, the handlers, and the registry, through ActorProvider\n * - StateProvider, ActionProvider, VisibilityProvider, and ValidationProvider, through JSONUIProvider\n * - ConfirmDialogManager, through JSONUIProvider\n *\n * @example\n * ```tsx\n * <PlayUIProvider actor={myActor} registryResult={registryResult} navigate={navigate}>\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n */\nexport const PlayUIProvider: Component<PlayUIProviderProps> = (props) => {\n\treturn (\n\t\t<ActorProvider\n\t\t\tactor={props.actor}\n\t\t\tregistryResult={props.registryResult}\n\t\t\t{...(props.store !== undefined && { store: props.store })}\n\t\t\t{...(props.fallback !== undefined && { fallback: props.fallback })}\n\t\t\t{...(props.onError !== undefined && { onError: props.onError })}\n\t\t\t{...(props.onRenderError !== undefined && { onRenderError: props.onRenderError })}\n\t\t>\n\t\t\t<JSONUIBridge\n\t\t\t\t{...(props.validationFunctions !== undefined && {\n\t\t\t\t\tvalidationFunctions: props.validationFunctions,\n\t\t\t\t})}\n\t\t\t\t{...(props.navigate !== undefined && { navigate: props.navigate })}\n\t\t\t\t{...(props.functions !== undefined && { functions: props.functions })}\n\t\t\t>\n\t\t\t\t{props.children}\n\t\t\t</JSONUIBridge>\n\t\t</ActorProvider>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;AA8CA,IAAMW,gBACLG,gBACI;CACJ,MAAMC,OAAOV,YAAY;CAEzB,OAAAW,gBACEd,gBAAce,WAAA;EAAA,IACdC,WAAQ;GAAA,OAAEH,KAAKG;EAAQ;EAAA,IACvBC,WAAQ;GAAA,OAAEJ,KAAKI;EAAQ;EAAA,IACvBC,QAAK;GAAA,OAAEL,KAAKK;EAAK;CAAA,SACZN,YAAYO,wBAAwBC,KAAAA,KAAa,EACrDD,qBAAqBP,YAAYO,oBAClC,SACKP,YAAYS,aAAaD,KAAAA,KAAa,EAAEC,UAAUT,YAAYS,SAAS,SACvET,YAAYU,cAAcF,KAAAA,KAAa,EAAEE,WAAWV,YAAYU,UAAU,GAAC,EAAA,IAAAZ,WAAA;EAAA,OAE/EE,YAAYF;CAAQ,EAAA,CAAA,CAAA;AAGxB;;;;;;;;;;;;;;;;;AAkBA,IAAaa,kBAAkDC,UAAU;CACxE,OAAAV,gBACEZ,eAAaa,WAAA;EAAA,IACbU,QAAK;GAAA,OAAED,MAAMC;EAAK;EAAA,IAClBC,iBAAc;GAAA,OAAEF,MAAME;EAAc;CAAA,SAC/BF,MAAMN,UAAUE,KAAAA,KAAa,EAAEF,OAAOM,MAAMN,MAAM,SAClDM,MAAMG,aAAaP,KAAAA,KAAa,EAAEO,UAAUH,MAAMG,SAAS,SAC3DH,MAAMI,YAAYR,KAAAA,KAAa,EAAEQ,SAASJ,MAAMI,QAAQ,SACxDJ,MAAMK,kBAAkBT,KAAAA,KAAa,EAAES,eAAeL,MAAMK,cAAc,GAAC,EAAA,IAAAnB,WAAA;EAAA,OAAAI,gBAE/EL,cAAYM,iBACPS,MAAML,wBAAwBC,KAAAA,KAAa,EAC/CD,qBAAqBK,MAAML,oBAC5B,SACKK,MAAMH,aAAaD,KAAAA,KAAa,EAAEC,UAAUG,MAAMH,SAAS,SAC3DG,MAAMF,cAAcF,KAAAA,KAAa,EAAEE,WAAWE,MAAMF,UAAU,GAAC,EAAA,IAAAZ,WAAA;GAAA,OAEnEc,MAAMd;EAAQ,EAAA,CAAA,CAAA;CAAA,EAAA,CAAA,CAAA;AAInB"}
1
+ {"version":3,"file":"PlayUIProvider.js","names":["Component","JSX","JSONUIProvider","JSONUIProviderProps","ActorProvider","usePlayView","ActorProviderProps","JSONUIForwardedProps","Pick","PlayUIProviderProps","Partial","JSONUIBridge","children","Element","bridgeProps","view","_$createComponent","_$mergeProps","registry","handlers","store","validationFunctions","undefined","navigate","functions","PlayUIProvider","props","actor","registryResult","fallback","onError","onRenderError","_$createComponent","_$mergeProps"],"sources":["../src/PlayUIProvider.tsx"],"sourcesContent":["/**\n * PlayUIProvider — the composite SolidJS provider of XMachines Play.\n *\n * It wraps ActorProvider and JSONUIProvider into one composite provider.\n * This is the recommended entry point for most users.\n *\n * The standard use:\n * ```tsx\n * import { PlayUIProvider, PlayRenderer, defineRegistry } from \"@xmachines/play-solid\";\n *\n * const registryResult = defineRegistry(myCatalog, { components, actions });\n *\n * <PlayUIProvider actor={myActor} registryResult={registryResult}>\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n *\n * For the complete control, which the author of a library needs, use ActorProvider\n * directly.\n *\n * @packageDocumentation\n */\n\nimport type { Component, JSX } from \"solid-js\";\nimport { JSONUIProvider, type JSONUIProviderProps } from \"@xmachines/json-render-solid\";\nimport { ActorProvider, usePlayView, type ActorProviderProps } from \"./ActorProvider.js\";\n\n// Take only the forwarded props of JSONUIProviderProps (D-16)\ntype JSONUIForwardedProps = Pick<\n\tJSONUIProviderProps,\n\t\"validationFunctions\" | \"navigate\" | \"functions\"\n>;\n\n/**\n * The props of PlayUIProvider — every ActorProvider prop, and also the props that it forwards to JSONUIProvider.\n */\nexport interface PlayUIProviderProps extends ActorProviderProps, Partial<JSONUIForwardedProps> {}\n\n/**\n * The inner bridge component. Put it inside the tree of ActorProvider, so that\n * usePlayView() can read the resolved ViewContextValue. It reads the handlers and the\n * registry of the view context, and it gives them to JSONUIProvider.\n *\n * The React implementation uses the same bridge pattern, in JSONUIBridge of\n * play-react.\n */\nconst JSONUIBridge: Component<Partial<JSONUIForwardedProps> & { children: JSX.Element }> = (\n\tbridgeProps,\n) => {\n\tconst view = usePlayView();\n\n\treturn (\n\t\t<JSONUIProvider\n\t\t\tregistry={view.registry}\n\t\t\thandlers={view.handlers}\n\t\t\tstore={view.store}\n\t\t\t{...(bridgeProps.validationFunctions !== undefined && {\n\t\t\t\tvalidationFunctions: bridgeProps.validationFunctions,\n\t\t\t})}\n\t\t\t{...(bridgeProps.navigate !== undefined && { navigate: bridgeProps.navigate })}\n\t\t\t{...(bridgeProps.functions !== undefined && { functions: bridgeProps.functions })}\n\t\t>\n\t\t\t{bridgeProps.children}\n\t\t</JSONUIProvider>\n\t);\n};\n\n/**\n * The composite provider: ActorProvider and JSONUIProvider.\n *\n * It gives you the complete stack of the JSON render context:\n * - ActorContext, which holds the actor instance, through ActorProvider\n * - ViewContext, which holds the spec, the handlers, and the registry, through ActorProvider\n * - StateProvider, ActionProvider, VisibilityProvider, and ValidationProvider, through JSONUIProvider\n * - ConfirmDialogManager, through JSONUIProvider\n *\n * @example\n * ```tsx\n * <PlayUIProvider actor={myActor} registryResult={registryResult} navigate={navigate}>\n * <PlayRenderer />\n * </PlayUIProvider>\n * ```\n */\nexport const PlayUIProvider: Component<PlayUIProviderProps> = (props) => {\n\treturn (\n\t\t<ActorProvider\n\t\t\tactor={props.actor}\n\t\t\tregistryResult={props.registryResult}\n\t\t\t{...(props.store !== undefined && { store: props.store })}\n\t\t\t{...(props.fallback !== undefined && { fallback: props.fallback })}\n\t\t\t{...(props.onError !== undefined && { onError: props.onError })}\n\t\t\t{...(props.onRenderError !== undefined && { onRenderError: props.onRenderError })}\n\t\t>\n\t\t\t<JSONUIBridge\n\t\t\t\t{...(props.validationFunctions !== undefined && {\n\t\t\t\t\tvalidationFunctions: props.validationFunctions,\n\t\t\t\t})}\n\t\t\t\t{...(props.navigate !== undefined && { navigate: props.navigate })}\n\t\t\t\t{...(props.functions !== undefined && { functions: props.functions })}\n\t\t\t>\n\t\t\t\t{props.children}\n\t\t\t</JSONUIBridge>\n\t\t</ActorProvider>\n\t);\n};\n"],"mappings":";;;;;;;;;;;;AA8CA,IAAMW,gBACLG,gBACI;CACJ,MAAMC,OAAOV,YAAY;CAEzB,OAAAW,gBACEd,gBAAce,WAAA;EAAA,IACdC,WAAQ;GAAA,OAAEH,KAAKG;EAAQ;EAAA,IACvBC,WAAQ;GAAA,OAAEJ,KAAKI;EAAQ;EAAA,IACvBC,QAAK;GAAA,OAAEL,KAAKK;EAAK;CAAA,SACZN,YAAYO,wBAAwBC,KAAAA,KAAa,EACrDD,qBAAqBP,YAAYO,oBAClC,SACKP,YAAYS,aAAaD,KAAAA,KAAa,EAAEC,UAAUT,YAAYS,SAAS,SACvET,YAAYU,cAAcF,KAAAA,KAAa,EAAEE,WAAWV,YAAYU,UAAU,GAAC,EAAA,IAAAZ,WAAA;EAAA,OAE/EE,YAAYF;CAAQ,EAAA,CAAA,CAAA;AAGxB;;;;;;;;;;;;;;;;;AAkBA,IAAaa,kBAAkDC,UAAU;CACxE,OAAAV,gBACEZ,eAAaa,WAAA;EAAA,IACbU,QAAK;GAAA,OAAED,MAAMC;EAAK;EAAA,IAClBC,iBAAc;GAAA,OAAEF,MAAME;EAAc;CAAA,SAC/BF,MAAMN,UAAUE,KAAAA,KAAa,EAAEF,OAAOM,MAAMN,MAAM,SAClDM,MAAMG,aAAaP,KAAAA,KAAa,EAAEO,UAAUH,MAAMG,SAAS,SAC3DH,MAAMI,YAAYR,KAAAA,KAAa,EAAEQ,SAASJ,MAAMI,QAAQ,SACxDJ,MAAMK,kBAAkBT,KAAAA,KAAa,EAAES,eAAeL,MAAMK,cAAc,GAAC,EAAA,IAAAnB,WAAA;EAAA,OAAAI,gBAE/EL,cAAYM,iBACPS,MAAML,wBAAwBC,KAAAA,KAAa,EAC/CD,qBAAqBK,MAAML,oBAC5B,SACKK,MAAMH,aAAaD,KAAAA,KAAa,EAAEC,UAAUG,MAAMH,SAAS,SAC3DG,MAAMF,cAAcF,KAAAA,KAAa,EAAEE,WAAWE,MAAMF,UAAU,GAAC,EAAA,IAAAZ,WAAA;GAAA,OAEnEc,MAAMd;EAAQ,EAAA,CAAA,CAAA;CAAA,EAAA,CAAA,CAAA;AAInB"}
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ export { PlayUIProvider } from "./PlayUIProvider.js";
23
23
  export { ActorContext, useActor } from "./useActor.js";
24
24
  export { JSONUIProvider, StateProvider, ActionProvider, VisibilityProvider, ValidationProvider, Renderer, defineRegistry, useBoundProp, useStateBinding, useStateValue, useStateStore, useActions, useAction, useIsVisible, useFieldValidation, useOptionalValidation, useVisibility, } from "@xmachines/json-render-solid";
25
25
  export type { JSONUIProviderProps, StateProviderProps, ActionProviderProps, VisibilityProviderProps, ValidationProviderProps, RendererProps, ComponentFn, ComponentContext, ComponentRegistry, DefineRegistryResult, SetState, } from "@xmachines/json-render-solid";
26
- export type { RenderErrorHandler } from "@xmachines/json-render-solid";
26
+ export type { RenderErrorHandler, OnRenderError, RenderErrorInfo, RenderErrorKind, } from "@xmachines/json-render-solid";
27
27
  export type { ActorProviderProps, PlayUIProviderProps, ViewContextValue } from "./types.js";
28
28
  export type { AnyPlayActor } from "./useActor.js";
29
29
  export { schema } from "@xmachines/json-render-solid";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOvD,OAAO,EAEN,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAElB,QAAQ,EAER,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,UAAU,EACV,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,GACb,MAAM,8BAA8B,CAAC;AAGtC,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,QAAQ,GACR,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGvE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5F,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAQlD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAOvD,OAAO,EAEN,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAElB,QAAQ,EAER,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,UAAU,EACV,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,GACb,MAAM,8BAA8B,CAAC;AAGtC,YAAY,EACX,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACpB,QAAQ,GACR,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACX,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,eAAe,GACf,MAAM,8BAA8B,CAAC;AAGtC,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5F,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAQlD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC"}
package/dist/types.d.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @packageDocumentation
8
8
  */
9
- export type { RenderErrorHandler } from "@xmachines/json-render-solid";
9
+ export type { RenderErrorHandler, OnRenderError, RenderErrorInfo, RenderErrorKind, } from "@xmachines/json-render-solid";
10
10
  export type { ActorProviderProps, ViewContextValue } from "./ActorProvider.js";
11
11
  export type { PlayUIProviderProps } from "./PlayUIProvider.js";
12
12
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACX,kBAAkB,EAClB,aAAa,EACb,eAAe,EACf,eAAe,GACf,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-solid",
3
- "version": "6.1.0",
3
+ "version": "7.0.0",
4
4
  "description": "Solid renderer for XMachines Play architecture",
5
5
  "keywords": [
6
6
  "atoms",
@@ -48,37 +48,37 @@
48
48
  "test:ui": "vitest --ui"
49
49
  },
50
50
  "dependencies": {
51
- "@xmachines/play-actor": "6.1.0",
52
- "@xmachines/play-view": "6.1.0"
51
+ "@xmachines/play-actor": "7.0.0",
52
+ "@xmachines/play-view": "7.0.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@solidjs/testing-library": "^0.8.10",
56
56
  "@testing-library/jest-dom": "^7.0.1",
57
- "@types/node": "^26.6.2",
58
- "@vitest/browser-playwright": "^5.0.1",
59
- "@xmachines/json-render-core": "^0.21.0-xm.2",
60
- "@xmachines/json-render-solid": "^0.21.0-xm.2",
61
- "@xmachines/json-render-xstate": "^0.21.0-xm.2",
62
- "@xmachines/play": "6.1.0",
63
- "@xmachines/play-atom": "6.1.0",
64
- "jsdom": "^30.0.1",
65
- "oxfmt": "^0.70.0",
66
- "oxlint": "^1.85.0",
57
+ "@types/node": "^26.6.4",
58
+ "@vitest/browser-playwright": "^5.0.3",
59
+ "@xmachines/json-render-core": "0.21.0-xm.6",
60
+ "@xmachines/json-render-solid": "0.21.0-xm.6",
61
+ "@xmachines/json-render-xstate": "0.21.0-xm.6",
62
+ "@xmachines/play": "7.0.0",
63
+ "@xmachines/play-atom": "7.0.0",
64
+ "jsdom": "^30.1.2",
65
+ "oxfmt": "^0.71.0",
66
+ "oxlint": "^1.86.0",
67
67
  "solid-js": "^1.9.15",
68
68
  "typescript": "^5.9.3 || ^6.0.3",
69
- "vite": "^8.3.0",
69
+ "vite": "^8.3.2",
70
70
  "vite-plugin-solid": "^2.11.14",
71
- "vitest": "^5.0.1",
71
+ "vitest": "^5.0.3",
72
72
  "xstate": "^5.33.0",
73
73
  "zod": "^4.6.5"
74
74
  },
75
75
  "peerDependencies": {
76
- "@xmachines/json-render-core": "^0.21.0-xm.2",
77
- "@xmachines/json-render-solid": "^0.21.0-xm.2",
78
- "@xmachines/json-render-xstate": "^0.21.0-xm.2",
79
- "@xmachines/play": "6.1.0",
80
- "@xmachines/play-atom": "6.1.0",
81
- "solid-js": "^1.8.0"
76
+ "@xmachines/json-render-core": "0.21.0-xm.6",
77
+ "@xmachines/json-render-solid": "0.21.0-xm.6",
78
+ "@xmachines/json-render-xstate": "0.21.0-xm.6",
79
+ "@xmachines/play": "7.0.0",
80
+ "@xmachines/play-atom": "7.0.0",
81
+ "solid-js": "^1.9.8"
82
82
  },
83
83
  "engines": {
84
84
  "node": ">=24.0.0"