@xmachines/play-solid 2.0.0-alpha.1 → 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
@@ -1,9 +1,9 @@
1
- <!-- generated-by: gsd-doc-writer -->
2
-
3
1
  # @xmachines/play-solid
4
2
 
5
3
  > Solid renderer for XMachines Play architecture
6
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-2.0.0-blue)](https://www.npmjs.com/package/@xmachines/play-solid)
6
+
7
7
  SolidJS rendering layer that passively observes actor signals and renders UI components via `@xmachines/json-render-solid`. SolidJS reactivity is used solely to trigger re-renders — TC39 Signals are the source of truth.
8
8
 
9
9
  Part of the [xmachines-js monorepo](../../README.md).
@@ -0,0 +1,79 @@
1
+ /**
2
+ * ActorProvider — Smart SolidJS provider component for the XMachines Play actor lifecycle.
3
+ *
4
+ * Escape hatch primitive for library authors who need direct control. Most users should
5
+ * use PlayUIProvider (batteries-included composite) instead.
6
+ *
7
+ * This component:
8
+ * - Subscribes to actor.currentView signal via watchSignal (in component body per Phase 29)
9
+ * - Manages per-view StateStore lifecycle (controlled/uncontrolled)
10
+ * - Resolves action handlers via inner component pattern (inside StateProvider)
11
+ * - Injects onRenderError into registry if provided
12
+ * - Provides ActorContext (actor) and ViewContext (spec + handlers + registry) to children
13
+ * - Wraps render path in SolidJS ErrorBoundary
14
+ *
15
+ * Per D-11: The old `ActorProvider = ActorContext.Provider` alias is removed. This new smart
16
+ * component takes the name. Use `ActorContext.Provider` directly for escape-hatch access.
17
+ *
18
+ * @packageDocumentation
19
+ */
20
+ import type { Component, JSX } from "solid-js";
21
+ import type { DefineRegistryResult } from "@xmachines/json-render-solid";
22
+ import type { ComponentRegistry } from "@xmachines/json-render-solid";
23
+ import { type BaseActorProviderProps, type BaseViewContextValue } from "@xmachines/play-actor";
24
+ /**
25
+ * Value provided by ActorProvider's ViewContext.
26
+ * Access via usePlayView() inside the ActorProvider tree.
27
+ */
28
+ export interface ViewContextValue extends BaseViewContextValue<ComponentRegistry> {
29
+ }
30
+ /**
31
+ * Hook to access the current view context inside an ActorProvider tree.
32
+ *
33
+ * @throws {Error} If called outside an ActorProvider (or PlayUIProvider) tree
34
+ *
35
+ * @example
36
+ * ```tsx
37
+ * import { usePlayView } from "@xmachines/play-solid";
38
+ *
39
+ * const MyRenderer: Component = () => {
40
+ * const view = usePlayView();
41
+ * return <Renderer spec={view.spec} registry={view.registry} />;
42
+ * };
43
+ * ```
44
+ */
45
+ export declare function usePlayView(): ViewContextValue;
46
+ /**
47
+ * Props for ActorProvider — the escape hatch primitive.
48
+ *
49
+ * For batteries-included usage, prefer PlayUIProvider which wraps ActorProvider
50
+ * with JSONUIProvider and all required sub-providers.
51
+ */
52
+ export interface ActorProviderProps extends BaseActorProviderProps<DefineRegistryResult> {
53
+ /** Optional fallback element shown when currentView is null or ErrorBoundary catches */
54
+ fallback?: JSX.Element;
55
+ /** Optional callback invoked when SolidJS ErrorBoundary catches an error */
56
+ onError?: (error: unknown) => void;
57
+ /** Children — required; must include <PlayRenderer /> (or use PlayUIProvider shorthand) */
58
+ children: JSX.Element;
59
+ }
60
+ /**
61
+ * Smart ActorProvider component — owns actor bridging, signal subscription,
62
+ * StateStore lifecycle, handler resolution, and error boundary.
63
+ *
64
+ * Per D-11: Replaces the old raw alias `ActorProvider = ActorContext.Provider`.
65
+ * Consumers who previously used `<ActorProvider value={actor}>` should now use
66
+ * `<ActorContext.Provider value={actor}>` for raw provider access, or migrate to
67
+ * this smart component / PlayUIProvider.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * import { ActorProvider, PlayRenderer } from "@xmachines/play-solid";
72
+ *
73
+ * <ActorProvider actor={myActor} registryResult={registryResult}>
74
+ * <PlayRenderer />
75
+ * </ActorProvider>
76
+ * ```
77
+ */
78
+ export declare const ActorProvider: Component<ActorProviderProps>;
79
+ //# sourceMappingURL=ActorProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActorProvider.d.ts","sourceRoot":"","sources":["../src/ActorProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,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;AAKtE,OAAO,EAIN,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,MAAM,uBAAuB,CAAC;AAO/B;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;CAAG;AAIpF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,IAAI,gBAAgB,CAE9C;AAMD;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB,CAAC,oBAAoB,CAAC;IACvF,wFAAwF;IACxF,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAEvB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAEnC,2FAA2F;IAC3F,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;CACtB;AA2CD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,kBAAkB,CA+FvD,CAAC"}
@@ -1,74 +1,145 @@
1
- import { ActorContext as e } from "./useActor.js";
2
- import { createComponent as t } from "solid-js/web";
3
- import { StateProvider as n, useStateStore as r } from "@xmachines/json-render-solid";
4
- import { ErrorBoundary as i, createContext as a, createEffect as o, createMemo as s, createSignal as c, onCleanup as l, useContext as u } from "solid-js";
5
- import { createAtom as d } from "@xstate/store";
6
- import { xstateStoreStateStore as f } from "@xmachines/json-render-xstate";
7
- import { watchSignal as p } from "@xmachines/play-signals";
8
- import { assertNonNullable as m } from "@xmachines/play";
9
- import { attachRenderErrorHandler as h, toAtomState as g } from "@xmachines/play-actor";
10
- //#region src/ActorProvider.tsx
11
- var _ = a(null);
12
- function v() {
13
- return m(u(_), "ViewContext");
1
+ import { ActorContext } from "./useActor.js";
2
+ import { createComponent } from "solid-js/web";
3
+ import { StateProvider, useStateStore } from "@xmachines/json-render-solid";
4
+ import { ErrorBoundary, createContext, createEffect, createMemo, createSignal, onCleanup, useContext } from "solid-js";
5
+ import { createAtom } from "@xstate/store";
6
+ import { xstateStoreStateStore } from "@xmachines/json-render-xstate";
7
+ import { watchSignal } from "@xmachines/play-signals";
8
+ import { assertNonNullable } from "@xmachines/play";
9
+ import { attachRenderErrorHandler, createViewStoreLifecycle } from "@xmachines/play-actor";
10
+ //#region packages/play-solid/src/ActorProvider.tsx
11
+ /**
12
+ * ActorProvider — Smart SolidJS provider component for the XMachines Play actor lifecycle.
13
+ *
14
+ * Escape hatch primitive for library authors who need direct control. Most users should
15
+ * use PlayUIProvider (batteries-included composite) instead.
16
+ *
17
+ * This component:
18
+ * - Subscribes to actor.currentView signal via watchSignal (in component body per Phase 29)
19
+ * - Manages per-view StateStore lifecycle (controlled/uncontrolled)
20
+ * - Resolves action handlers via inner component pattern (inside StateProvider)
21
+ * - Injects onRenderError into registry if provided
22
+ * - Provides ActorContext (actor) and ViewContext (spec + handlers + registry) to children
23
+ * - Wraps render path in SolidJS ErrorBoundary
24
+ *
25
+ * Per D-11: The old `ActorProvider = ActorContext.Provider` alias is removed. This new smart
26
+ * component takes the name. Use `ActorContext.Provider` directly for escape-hatch access.
27
+ *
28
+ * @packageDocumentation
29
+ */
30
+ var ViewContext = createContext(null);
31
+ /**
32
+ * Hook to access the current view context inside an ActorProvider tree.
33
+ *
34
+ * @throws {Error} If called outside an ActorProvider (or PlayUIProvider) tree
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * import { usePlayView } from "@xmachines/play-solid";
39
+ *
40
+ * const MyRenderer: Component = () => {
41
+ * const view = usePlayView();
42
+ * return <Renderer spec={view.spec} registry={view.registry} />;
43
+ * };
44
+ * ```
45
+ */
46
+ function usePlayView() {
47
+ return assertNonNullable(useContext(ViewContext), "ViewContext");
14
48
  }
15
- var y = (e) => {
16
- let n = r(), i = (e) => {
17
- let t = n.getSnapshot();
18
- n.update(e(t));
19
- }, a = e.registryResult.handlers(() => i, () => n.getSnapshot()), o = {
20
- spec: e.spec,
21
- handlers: a,
22
- registry: e.registryResult.registry,
23
- store: e.store
49
+ /**
50
+ * Inner component that runs inside StateProvider so it can call useStateStore()
51
+ * to get live set/getSnapshot for handler resolution.
52
+ */
53
+ var ActorProviderInner = (innerProps) => {
54
+ const stateCtx = useStateStore();
55
+ const setStateAdapter = (updater) => {
56
+ const prev = stateCtx.getSnapshot();
57
+ stateCtx.update(updater(prev));
24
58
  };
25
- return t(_.Provider, {
26
- value: o,
59
+ const handlers = innerProps.registryResult.handlers(() => setStateAdapter, () => stateCtx.getSnapshot());
60
+ const viewValue = {
61
+ spec: innerProps.spec,
62
+ handlers,
63
+ registry: innerProps.registryResult.registry,
64
+ store: innerProps.store
65
+ };
66
+ return createComponent(ViewContext.Provider, {
67
+ value: viewValue,
27
68
  get children() {
28
- return e.children;
69
+ return innerProps.children;
29
70
  }
30
71
  });
31
- }, b = (r) => {
32
- let [a, u] = c(null), m = new Proxy({}, {
33
- get(e, t) {
34
- let n = r.actor, i = Reflect.get(n, t, n);
35
- return typeof i == "function" ? i.bind(n) : i;
72
+ };
73
+ /**
74
+ * Smart ActorProvider component — owns actor bridging, signal subscription,
75
+ * StateStore lifecycle, handler resolution, and error boundary.
76
+ *
77
+ * Per D-11: Replaces the old raw alias `ActorProvider = ActorContext.Provider`.
78
+ * Consumers who previously used `<ActorProvider value={actor}>` should now use
79
+ * `<ActorContext.Provider value={actor}>` for raw provider access, or migrate to
80
+ * this smart component / PlayUIProvider.
81
+ *
82
+ * @example
83
+ * ```tsx
84
+ * import { ActorProvider, PlayRenderer } from "@xmachines/play-solid";
85
+ *
86
+ * <ActorProvider actor={myActor} registryResult={registryResult}>
87
+ * <PlayRenderer />
88
+ * </ActorProvider>
89
+ * ```
90
+ */
91
+ var ActorProvider = (props) => {
92
+ const [view, setView] = createSignal(null);
93
+ const actorProxy = new Proxy({}, {
94
+ get(_target, prop) {
95
+ const current = props.actor;
96
+ const value = Reflect.get(current, prop, current);
97
+ return typeof value === "function" ? value.bind(current) : value;
36
98
  },
37
- has(e, t) {
38
- return t in r.actor;
99
+ has(_target, prop) {
100
+ return prop in props.actor;
39
101
  }
40
- }), _ = s(() => r.onRenderError ? {
41
- ...r.registryResult,
42
- registry: h(r.registryResult.registry, r.onRenderError)
43
- } : r.registryResult), v = null, b = null;
44
- return o(() => {
45
- let e = (e) => u(e);
46
- e(r.actor.currentView.get());
47
- let t = p(r.actor.currentView, (t) => {
48
- e(t);
102
+ });
103
+ const resolvedRegistryResult = createMemo(() => {
104
+ if (!props.onRenderError) return props.registryResult;
105
+ return {
106
+ ...props.registryResult,
107
+ registry: attachRenderErrorHandler(props.registryResult.registry, props.onRenderError)
108
+ };
109
+ });
110
+ const storeLifecycle = createViewStoreLifecycle((seed) => xstateStoreStateStore({ atom: createAtom(seed) }));
111
+ createEffect(() => {
112
+ const update = (nextView) => setView(nextView);
113
+ update(props.actor.currentView.get());
114
+ const unwatch = watchSignal(props.actor.currentView, (nextView) => {
115
+ update(nextView);
49
116
  });
50
- l(() => t());
51
- }), t(e.Provider, {
52
- value: m,
117
+ onCleanup(() => unwatch());
118
+ });
119
+ return createComponent(ActorContext.Provider, {
120
+ value: actorProxy,
53
121
  get children() {
54
- return t(i, {
55
- fallback: (e) => (r.onError?.(e), r.fallback ?? null),
122
+ return createComponent(ErrorBoundary, {
123
+ fallback: (err) => {
124
+ props.onError?.(err);
125
+ return props.fallback ?? null;
126
+ },
56
127
  get children() {
57
128
  return (() => {
58
- let e = a();
59
- if (!e) return r.fallback ?? null;
60
- let i;
61
- return r.store ? i = r.store : ((v === null || b !== e) && (v = f({ atom: d(g(e.state)) }), b = e), i = v), t(n, {
62
- store: i,
129
+ const currentView = view();
130
+ if (!currentView) return props.fallback ?? null;
131
+ const store = storeLifecycle.resolve(props.actor, currentView, props.store).guardedStore;
132
+ return createComponent(StateProvider, {
133
+ store,
63
134
  get children() {
64
- return t(y, {
135
+ return createComponent(ActorProviderInner, {
65
136
  get registryResult() {
66
- return _();
137
+ return resolvedRegistryResult();
67
138
  },
68
- spec: e,
69
- store: i,
139
+ spec: currentView,
140
+ store,
70
141
  get children() {
71
- return r.children;
142
+ return props.children;
72
143
  }
73
144
  });
74
145
  }
@@ -80,6 +151,6 @@ var y = (e) => {
80
151
  });
81
152
  };
82
153
  //#endregion
83
- export { b as ActorProvider, v as usePlayView };
154
+ export { ActorProvider, usePlayView };
84
155
 
85
156
  //# sourceMappingURL=ActorProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActorProvider.js","names":["createSignal","createEffect","createMemo","onCleanup","createContext","useContext","ErrorBoundary","Component","JSX","StateProvider","useStateStore","DefineRegistryResult","SetState","StateStore","ComponentRegistry","createAtom","xstateStoreStateStore","watchSignal","assertNonNullable","toAtomState","attachRenderErrorHandler","PlaySpec","BaseActorProviderProps","BaseViewContextValue","ActorContext","AnyPlayActor","ViewContextValue","ViewContext","usePlayView","ActorProviderProps","fallback","Element","onError","error","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","internalStore","lastView","nextView","currentView","unwatch","err","atom","state"],"sources":["../src/ActorProvider.tsx"],"sourcesContent":["/**\n * ActorProvider — Smart SolidJS provider component for the XMachines Play actor lifecycle.\n *\n * Escape hatch primitive for library authors who need direct control. Most users should\n * use PlayUIProvider (batteries-included composite) instead.\n *\n * This component:\n * - Subscribes to actor.currentView signal via watchSignal (in component body per Phase 29)\n * - Manages per-view StateStore lifecycle (controlled/uncontrolled)\n * - Resolves action handlers via inner component pattern (inside StateProvider)\n * - Injects onRenderError into registry if provided\n * - Provides ActorContext (actor) and ViewContext (spec + handlers + registry) to children\n * - Wraps render path in SolidJS ErrorBoundary\n *\n * Per D-11: The old `ActorProvider = ActorContext.Provider` alias is removed. This new smart\n * component takes the name. Use `ActorContext.Provider` directly for escape-hatch access.\n *\n * @packageDocumentation\n */\n\nimport {\n\tcreateSignal,\n\tcreateEffect,\n\tcreateMemo,\n\tonCleanup,\n\tcreateContext,\n\tuseContext,\n\tErrorBoundary,\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 } from \"@xstate/store\";\nimport { xstateStoreStateStore } from \"@xmachines/json-render-xstate\";\nimport { watchSignal } from \"@xmachines/play-signals\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport {\n\ttoAtomState,\n\tattachRenderErrorHandler,\n\ttype PlaySpec,\n\ttype BaseActorProviderProps,\n\ttype BaseViewContextValue,\n} from \"@xmachines/play-actor\";\nimport { ActorContext, type AnyPlayActor } from \"./useActor.js\";\n\n// ---------------------------------------------------------------------------\n// ViewContextValue — shape of the context value provided by ActorProvider\n// ---------------------------------------------------------------------------\n\n/**\n * Value provided by ActorProvider's ViewContext.\n * Access via usePlayView() inside the ActorProvider tree.\n */\nexport interface ViewContextValue extends BaseViewContextValue<ComponentRegistry> {}\n\nconst ViewContext = createContext<ViewContextValue | null>(null);\n\n/**\n * Hook to access the current view context inside an ActorProvider tree.\n *\n * @throws {Error} If called outside an ActorProvider (or 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 * Props for ActorProvider — the escape hatch primitive.\n *\n * For batteries-included usage, prefer PlayUIProvider which wraps ActorProvider\n * with JSONUIProvider and all required sub-providers.\n */\nexport interface ActorProviderProps extends BaseActorProviderProps<DefineRegistryResult> {\n\t/** Optional fallback element shown when currentView is null or ErrorBoundary catches */\n\tfallback?: JSX.Element;\n\n\t/** Optional callback invoked when SolidJS ErrorBoundary catches an error */\n\tonError?: (error: unknown) => void;\n\n\t/** Children — required; must include <PlayRenderer /> (or use PlayUIProvider shorthand) */\n\tchildren: JSX.Element;\n}\n\n// ---------------------------------------------------------------------------\n// ActorProviderInner — resolves handlers inside StateProvider tree\n// ---------------------------------------------------------------------------\n\n/**\n * Inner component that runs inside StateProvider so it can call useStateStore()\n * to get live set/getSnapshot for handler resolution.\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 SetState adapter bridging stateCtx.update/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\tconst viewValue: ViewContextValue = {\n\t\tspec: innerProps.spec,\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 smart component (per D-11 takes the ActorProvider name)\n// ---------------------------------------------------------------------------\n\n/**\n * Smart ActorProvider component — owns actor bridging, signal subscription,\n * StateStore lifecycle, handler resolution, and error boundary.\n *\n * Per D-11: Replaces the old raw alias `ActorProvider = ActorContext.Provider`.\n * Consumers who previously used `<ActorProvider value={actor}>` should now use\n * `<ActorContext.Provider value={actor}>` for raw provider access, or migrate to\n * this smart component / 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// SolidJS signal for current view (PlaySpec | null)\n\tconst [view, setView] = createSignal<PlaySpec | null>(null);\n\n\t// A stable Proxy is provided as the ActorContext value instead of the raw\n\t// actor: Solid's Context.Provider reads `value` once at creation, so passing\n\t// `props.actor` directly would snapshot the FIRST actor and useActor()\n\t// consumers would never see a prop swap. With the proxy, consumers keep the\n\t// reference obtained at creation time, yet every property access (send,\n\t// currentView, …) resolves against the latest actor. Reading `props.actor`\n\t// inside the traps is a reactive read, so consumers accessing properties in\n\t// tracking scopes (createEffect, createMemo, JSX) re-run on swap. Methods\n\t// are bound to the current actor so `this` (including private fields) works\n\t// exactly as with a direct call. Mirrors play-vue's ActorProvider proxy.\n\tconst actorProxy = new Proxy({} as AnyPlayActor, {\n\t\tget(_target, prop) {\n\t\t\tconst current = props.actor as AnyPlayActor;\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 as AnyPlayActor);\n\t\t},\n\t});\n\n\t// Inject onRenderError into registry if provided (non-enumerable override).\n\t// Memoized so that creating a new object on every reactive evaluation does not\n\t// cause unnecessary re-renders of child components that receive this as a prop.\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// Per-view internal store — recreated on each view transition (uncontrolled mode)\n\tlet internalStore: StateStore | null = null;\n\tlet lastView: PlaySpec | null = null;\n\n\t// Bridge TC39 Signal to SolidJS signal — seed AND watch atomically inside a single\n\t// createEffect to eliminate the race window between .get() and watcher registration.\n\t// If the TC39 signal changes between the initial .get() and first watcher notification,\n\t// the update function captures the latest value without missing it.\n\tcreateEffect(() => {\n\t\tconst update = (nextView: PlaySpec | null) => setView(nextView);\n\t\tupdate(props.actor.currentView.get() as PlaySpec | null);\n\t\tconst unwatch = watchSignal(props.actor.currentView, (nextView) => {\n\t\t\tupdate(nextView as PlaySpec | null);\n\t\t});\n\t\tonCleanup(() => unwatch());\n\t});\n\n\treturn (\n\t\t<ActorContext.Provider value={actorProxy}>\n\t\t\t<ErrorBoundary\n\t\t\t\tfallback={(err: unknown) => {\n\t\t\t\t\tprops.onError?.(err);\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\tconst currentView = view();\n\t\t\t\t\tif (!currentView) return props.fallback ?? null;\n\n\t\t\t\t\t// Resolve store: external (controlled) or internal per-view atom\n\t\t\t\t\tlet store: StateStore;\n\t\t\t\t\tif (props.store) {\n\t\t\t\t\t\tstore = props.store;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (internalStore === null || lastView !== currentView) {\n\t\t\t\t\t\t\t// Proto-safe guard: spec.state must be a plain object (T-37-05-02)\n\t\t\t\t\t\t\tinternalStore = xstateStoreStateStore({\n\t\t\t\t\t\t\t\tatom: createAtom(toAtomState(currentView.state)),\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tlastView = currentView;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstore = internalStore;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<StateProvider store={store}>\n\t\t\t\t\t\t\t<ActorProviderInner\n\t\t\t\t\t\t\t\tregistryResult={resolvedRegistryResult()}\n\t\t\t\t\t\t\t\tspec={currentView}\n\t\t\t\t\t\t\t\tstore={store}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t\t</ActorProviderInner>\n\t\t\t\t\t\t</StateProvider>\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":";;;;;;;;;;AAyDA,IAAM2B,IAAcvB,EAAuC,IAAI;AAiB/D,SAAgBwB,IAAgC;CAC/C,OAAOV,EAAkBb,EAAWsB,CAAW,GAAG,aAAa;AAChE;AA+BA,IAAMQ,KAKAI,MAAe;CACpB,IAAMC,IAAW9B,EAAc,GAGzB+B,KAA6BC,MAAY;EAC9C,IAAMC,IAAOH,EAASI,YAAY;EAClCJ,EAASK,OAAOH,EAAQC,CAAI,CAAC;CAC9B,GAEMG,IAAWP,EAAWH,eAAeU,eACpCL,SACAD,EAASI,YAAY,CAC5B,GAEMG,IAA8B;EACnCV,MAAME,EAAWF;EACjBS;EACAE,UAAUT,EAAWH,eAAeY;EACpCV,OAAOC,EAAWD;CACnB;CAEA,OAAAW,EAAQtB,EAAYuB,UAAQ;EAACC,OAAOJ;EAAS,IAAAb,WAAA;GAAA,OAAGK,EAAWL;EAAQ;CAAA,CAAA;AACpE,GAwBakB,KAAgDC,MAAU;CAEtE,IAAM,CAACC,GAAMC,KAAWvD,EAA8B,IAAI,GAYpDwD,IAAa,IAAIC,MAAM,CAAC,GAAmB;EAChDC,IAAIC,GAASC,GAAM;GAClB,IAAMC,IAAUR,EAAMS,OAChBX,IAAQY,QAAQL,IAAIG,GAASD,GAAMC,CAAO;GAChD,OAAO,OAAOV,KAAU,aAAaA,EAAMa,KAAKH,CAAO,IAAIV;EAC5D;EACAc,IAAIN,GAASC,GAAM;GAClB,OAAOA,KAASP,EAAMS;EACvB;CACD,CAAC,GAKKI,IAAyBhE,QACzBmD,EAAMc,gBACJ;EACN,GAAGd,EAAMjB;EACTY,UAAU5B,EAAyBiC,EAAMjB,eAAeY,UAAUK,EAAMc,aAAa;CACtF,IAJiCd,EAAMjB,cAKvC,GAGGgC,IAAmC,MACnCC,IAA4B;CAehC,OATApE,QAAmB;EAClB,IAAM4C,KAAUyB,MAA8Bf,EAAQe,CAAQ;EAC9DzB,EAAOQ,EAAMS,MAAMS,YAAYb,IAAI,CAAoB;EACvD,IAAMc,IAAUvD,EAAYoC,EAAMS,MAAMS,cAAcD,MAAa;GAClEzB,EAAOyB,CAA2B;EACnC,CAAC;EACDnE,QAAgBqE,EAAQ,CAAC;CAC1B,CAAC,GAEDvB,EACEzB,EAAa0B,UAAQ;EAACC,OAAOK;EAAU,IAAAtB,WAAA;GAAA,OAAAe,EACtC3C,GAAa;IACbwB,WAAW2C,OACVpB,EAAMrB,UAAUyC,CAAG,GACZpB,EAAMvB,YAAY;IACzB,IAAAI,WAAA;KAAA,cAEO;MACP,IAAMqC,IAAcjB,EAAK;MACzB,IAAI,CAACiB,GAAa,OAAOlB,EAAMvB,YAAY;MAG3C,IAAIQ;MAcJ,OAbIe,EAAMf,QACTA,IAAQe,EAAMf,UAEV8B,MAAkB,QAAQC,MAAaE,OAE1CH,IAAgBpD,EAAsB,EACrC0D,MAAM3D,EAAWI,EAAYoD,EAAYI,KAAK,CAAC,EAChD,CAAC,GACDN,IAAWE,IAEZjC,IAAQ8B,IAGTnB,EACExC,GAAa;OAAQ6B;OAAK,IAAAJ,WAAA;QAAA,OAAAe,EACzBd,GAAkB;SAAA,IAClBC,iBAAc;UAAA,OAAE8B,EAAuB;SAAC;SACxC7B,MAAMkC;SACCjC;SAAK,IAAAJ,WAAA;UAAA,OAEXmB,EAAMnB;SAAQ;QAAA,CAAA;OAAA;MAAA,CAAA;KAInB,EAAA,CAAG;IAAC;GAAA,CAAA;EAAA;CAAA,CAAA;AAIR"}
1
+ {"version":3,"file":"ActorProvider.js","names":["createSignal","createEffect","createMemo","onCleanup","createContext","useContext","ErrorBoundary","Component","JSX","StateProvider","useStateStore","DefineRegistryResult","SetState","StateStore","ComponentRegistry","createAtom","xstateStoreStateStore","watchSignal","assertNonNullable","attachRenderErrorHandler","createViewStoreLifecycle","PlaySpec","BaseActorProviderProps","BaseViewContextValue","ActorContext","AnyPlayActor","ViewContextValue","ViewContext","usePlayView","ActorProviderProps","fallback","Element","onError","error","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","err","resolve","guardedStore"],"sources":["../src/ActorProvider.tsx"],"sourcesContent":["/**\n * ActorProvider — Smart SolidJS provider component for the XMachines Play actor lifecycle.\n *\n * Escape hatch primitive for library authors who need direct control. Most users should\n * use PlayUIProvider (batteries-included composite) instead.\n *\n * This component:\n * - Subscribes to actor.currentView signal via watchSignal (in component body per Phase 29)\n * - Manages per-view StateStore lifecycle (controlled/uncontrolled)\n * - Resolves action handlers via inner component pattern (inside StateProvider)\n * - Injects onRenderError into registry if provided\n * - Provides ActorContext (actor) and ViewContext (spec + handlers + registry) to children\n * - Wraps render path in SolidJS ErrorBoundary\n *\n * Per D-11: The old `ActorProvider = ActorContext.Provider` alias is removed. This new smart\n * component takes the name. Use `ActorContext.Provider` directly for escape-hatch access.\n *\n * @packageDocumentation\n */\n\nimport {\n\tcreateSignal,\n\tcreateEffect,\n\tcreateMemo,\n\tonCleanup,\n\tcreateContext,\n\tuseContext,\n\tErrorBoundary,\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 } from \"@xstate/store\";\nimport { xstateStoreStateStore } from \"@xmachines/json-render-xstate\";\nimport { watchSignal } from \"@xmachines/play-signals\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport {\n\tattachRenderErrorHandler,\n\tcreateViewStoreLifecycle,\n\ttype PlaySpec,\n\ttype BaseActorProviderProps,\n\ttype BaseViewContextValue,\n} from \"@xmachines/play-actor\";\nimport { ActorContext, type AnyPlayActor } from \"./useActor.js\";\n\n// ---------------------------------------------------------------------------\n// ViewContextValue — shape of the context value provided by ActorProvider\n// ---------------------------------------------------------------------------\n\n/**\n * Value provided by ActorProvider's ViewContext.\n * Access via usePlayView() inside the ActorProvider tree.\n */\nexport interface ViewContextValue extends BaseViewContextValue<ComponentRegistry> {}\n\nconst ViewContext = createContext<ViewContextValue | null>(null);\n\n/**\n * Hook to access the current view context inside an ActorProvider tree.\n *\n * @throws {Error} If called outside an ActorProvider (or 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 * Props for ActorProvider — the escape hatch primitive.\n *\n * For batteries-included usage, prefer PlayUIProvider which wraps ActorProvider\n * with JSONUIProvider and all required sub-providers.\n */\nexport interface ActorProviderProps extends BaseActorProviderProps<DefineRegistryResult> {\n\t/** Optional fallback element shown when currentView is null or ErrorBoundary catches */\n\tfallback?: JSX.Element;\n\n\t/** Optional callback invoked when SolidJS ErrorBoundary catches an error */\n\tonError?: (error: unknown) => void;\n\n\t/** Children — required; must include <PlayRenderer /> (or use PlayUIProvider shorthand) */\n\tchildren: JSX.Element;\n}\n\n// ---------------------------------------------------------------------------\n// ActorProviderInner — resolves handlers inside StateProvider tree\n// ---------------------------------------------------------------------------\n\n/**\n * Inner component that runs inside StateProvider so it can call useStateStore()\n * to get live set/getSnapshot for handler resolution.\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 SetState adapter bridging stateCtx.update/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\tconst viewValue: ViewContextValue = {\n\t\tspec: innerProps.spec,\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 smart component (per D-11 takes the ActorProvider name)\n// ---------------------------------------------------------------------------\n\n/**\n * Smart ActorProvider component — owns actor bridging, signal subscription,\n * StateStore lifecycle, handler resolution, and error boundary.\n *\n * Per D-11: Replaces the old raw alias `ActorProvider = ActorContext.Provider`.\n * Consumers who previously used `<ActorProvider value={actor}>` should now use\n * `<ActorContext.Provider value={actor}>` for raw provider access, or migrate to\n * this smart component / 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// SolidJS signal for current view (PlaySpec | null)\n\tconst [view, setView] = createSignal<PlaySpec | null>(null);\n\n\t// A stable Proxy is provided as the ActorContext value instead of the raw\n\t// actor: Solid's Context.Provider reads `value` once at creation, so passing\n\t// `props.actor` directly would snapshot the FIRST actor and useActor()\n\t// consumers would never see a prop swap. With the proxy, consumers keep the\n\t// reference obtained at creation time, yet every property access (send,\n\t// currentView, …) resolves against the latest actor. Reading `props.actor`\n\t// inside the traps is a reactive read, so consumers accessing properties in\n\t// tracking scopes (createEffect, createMemo, JSX) re-run on swap. Methods\n\t// are bound to the current actor so `this` (including private fields) works\n\t// exactly as with a direct call. Mirrors play-vue's ActorProvider proxy.\n\tconst actorProxy = new Proxy({} as AnyPlayActor, {\n\t\tget(_target, prop) {\n\t\t\tconst current = props.actor as AnyPlayActor;\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 as AnyPlayActor);\n\t\t},\n\t});\n\n\t// Inject onRenderError into registry if provided (non-enumerable override).\n\t// Memoized so that creating a new object on every reactive evaluation does not\n\t// cause unnecessary re-renders of child components that receive this as a prop.\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// Store lifecycle (reseed on viewKey change, refresh /context in place\n\t// otherwise, actor-swap reset, guard identity cache) — the shared\n\t// coordinator from @xmachines/play-actor; only the reactivity wiring in the\n\t// tracked JSX scope below is Solid's.\n\tconst storeLifecycle = createViewStoreLifecycle((seed) =>\n\t\txstateStoreStateStore({ atom: createAtom(seed) }),\n\t);\n\n\t// Bridge TC39 Signal to SolidJS signal — seed AND watch atomically inside a single\n\t// createEffect to eliminate the race window between .get() and watcher registration.\n\t// If the TC39 signal changes between the initial .get() and first watcher notification,\n\t// the update function captures the latest value without missing it.\n\tcreateEffect(() => {\n\t\tconst update = (nextView: PlaySpec | null) => setView(nextView);\n\t\tupdate(props.actor.currentView.get() as PlaySpec | null);\n\t\tconst unwatch = watchSignal(props.actor.currentView, (nextView) => {\n\t\t\tupdate(nextView as PlaySpec | null);\n\t\t});\n\t\tonCleanup(() => unwatch());\n\t});\n\n\treturn (\n\t\t<ActorContext.Provider value={actorProxy}>\n\t\t\t<ErrorBoundary\n\t\t\t\tfallback={(err: unknown) => {\n\t\t\t\t\tprops.onError?.(err);\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\tconst currentView = view();\n\t\t\t\t\tif (!currentView) return props.fallback ?? null;\n\n\t\t\t\t\t// Resolve the store (external/controlled or internal\n\t\t\t\t\t// per-viewKey) via the shared lifecycle; children get the\n\t\t\t\t\t// guarded store — /context is read-only to the spec. Reading\n\t\t\t\t\t// props.actor and props.store HERE keeps both tracked in this\n\t\t\t\t\t// scope, so swaps re-run the resolution.\n\t\t\t\t\tconst store: StateStore = storeLifecycle.resolve(\n\t\t\t\t\t\tprops.actor,\n\t\t\t\t\t\tcurrentView,\n\t\t\t\t\t\tprops.store,\n\t\t\t\t\t).guardedStore;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<StateProvider store={store}>\n\t\t\t\t\t\t\t<ActorProviderInner\n\t\t\t\t\t\t\t\tregistryResult={resolvedRegistryResult()}\n\t\t\t\t\t\t\t\tspec={currentView}\n\t\t\t\t\t\t\t\tstore={store}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{props.children}\n\t\t\t\t\t\t\t</ActorProviderInner>\n\t\t\t\t\t\t</StateProvider>\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyDA,IAAM2B,cAAcvB,cAAuC,IAAI;;;;;;;;;;;;;;;;AAiB/D,SAAgBwB,cAAgC;CAC/C,OAAOV,kBAAkBb,WAAWsB,WAAW,GAAG,aAAa;AAChE;;;;;AA+BA,IAAMQ,sBAKAI,eAAe;CACpB,MAAMC,WAAW9B,cAAc;CAG/B,MAAM+B,mBAA6BC,YAAY;EAC9C,MAAMC,OAAOH,SAASI,YAAY;EAClCJ,SAASK,OAAOH,QAAQC,IAAI,CAAC;CAC9B;CAEA,MAAMG,WAAWP,WAAWH,eAAeU,eACpCL,uBACAD,SAASI,YAAY,CAC5B;CAEA,MAAMG,YAA8B;EACnCV,MAAME,WAAWF;EACjBS;EACAE,UAAUT,WAAWH,eAAeY;EACpCV,OAAOC,WAAWD;CACnB;CAEA,OAAAW,gBAAQtB,YAAYuB,UAAQ;EAACC,OAAOJ;EAAS,IAAAb,WAAA;GAAA,OAAGK,WAAWL;EAAQ;CAAA,CAAA;AACpE;;;;;;;;;;;;;;;;;;;AAwBA,IAAakB,iBAAgDC,UAAU;CAEtE,MAAM,CAACC,MAAMC,WAAWvD,aAA8B,IAAI;CAY1D,MAAMwD,aAAa,IAAIC,MAAM,CAAC,GAAmB;EAChDC,IAAIC,SAASC,MAAM;GAClB,MAAMC,UAAUR,MAAMS;GACtB,MAAMX,QAAQY,QAAQL,IAAIG,SAASD,MAAMC,OAAO;GAChD,OAAO,OAAOV,UAAU,aAAaA,MAAMa,KAAKH,OAAO,IAAIV;EAC5D;EACAc,IAAIN,SAASC,MAAM;GAClB,OAAOA,QAASP,MAAMS;EACvB;CACD,CAAC;CAKD,MAAMI,yBAAyBhE,iBAAiB;EAC/C,IAAI,CAACmD,MAAMc,eAAe,OAAOd,MAAMjB;EACvC,OAAO;GACN,GAAGiB,MAAMjB;GACTY,UAAU7B,yBAAyBkC,MAAMjB,eAAeY,UAAUK,MAAMc,aAAa;EACtF;CACD,CAAC;CAMD,MAAMC,iBAAiBhD,0BAA0BiD,SAChDrD,sBAAsB,EAAEsD,MAAMvD,WAAWsD,IAAI,EAAE,CAAC,CACjD;CAMApE,mBAAmB;EAClB,MAAM4C,UAAU0B,aAA8BhB,QAAQgB,QAAQ;EAC9D1B,OAAOQ,MAAMS,MAAMU,YAAYd,IAAI,CAAoB;EACvD,MAAMe,UAAUxD,YAAYoC,MAAMS,MAAMU,cAAcD,aAAa;GAClE1B,OAAO0B,QAA2B;EACnC,CAAC;EACDpE,gBAAgBsE,QAAQ,CAAC;CAC1B,CAAC;CAED,OAAAxB,gBACEzB,aAAa0B,UAAQ;EAACC,OAAOK;EAAU,IAAAtB,WAAA;GAAA,OAAAe,gBACtC3C,eAAa;IACbwB,WAAW4C,QAAiB;KAC3BrB,MAAMrB,UAAU0C,GAAG;KACnB,OAAOrB,MAAMvB,YAAY;IAC1B;IAAC,IAAAI,WAAA;KAAA,cAEO;MACP,MAAMsC,cAAclB,KAAK;MACzB,IAAI,CAACkB,aAAa,OAAOnB,MAAMvB,YAAY;MAO3C,MAAMQ,QAAoB8B,eAAeO,QACxCtB,MAAMS,OACNU,aACAnB,MAAMf,KACP,CAAC,CAACsC;MAEF,OAAA3B,gBACExC,eAAa;OAAQ6B;OAAK,IAAAJ,WAAA;QAAA,OAAAe,gBACzBd,oBAAkB;SAAA,IAClBC,iBAAc;UAAA,OAAE8B,uBAAuB;SAAC;SACxC7B,MAAMmC;SACClC;SAAK,IAAAJ,WAAA;UAAA,OAEXmB,MAAMnB;SAAQ;QAAA,CAAA;OAAA;MAAA,CAAA;KAInB,EAAA,CAAG;IAAC;GAAA,CAAA;EAAA;CAAA,CAAA;AAIR"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * PlayRenderer - Zero-prop leaf component for XMachines Play SolidJS architecture.
3
+ *
4
+ * Reads view context from the enclosing ActorProvider (or PlayUIProvider) via
5
+ * usePlayView() and renders the spec using @xmachines/json-render-solid's Renderer.
6
+ *
7
+ * Standard usage:
8
+ * ```tsx
9
+ * <PlayUIProvider actor={myActor} registryResult={registryResult}>
10
+ * <PlayRenderer />
11
+ * </PlayUIProvider>
12
+ * ```
13
+ *
14
+ * @packageDocumentation
15
+ */
16
+ import type { Component } from "solid-js";
17
+ /**
18
+ * Zero-prop leaf renderer. Must be placed inside an ActorProvider or PlayUIProvider tree.
19
+ *
20
+ * Reads ViewContextValue (spec, handlers, registry) from the enclosing provider
21
+ * via usePlayView() and renders the spec via @xmachines/json-render-solid's Renderer.
22
+ */
23
+ export declare const PlayRenderer: Component;
24
+ //# sourceMappingURL=PlayRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayRenderer.d.ts","sourceRoot":"","sources":["../src/PlayRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,SAG1B,CAAC"}
@@ -1,19 +1,25 @@
1
- import { usePlayView as e } from "./ActorProvider.js";
2
- import { createComponent as t } from "solid-js/web";
3
- import { Renderer as n } from "@xmachines/json-render-solid";
4
- //#region src/PlayRenderer.tsx
5
- var r = () => {
6
- let r = e();
7
- return t(n, {
1
+ import { usePlayView } from "./ActorProvider.js";
2
+ import { createComponent } from "solid-js/web";
3
+ import { Renderer } from "@xmachines/json-render-solid";
4
+ //#region packages/play-solid/src/PlayRenderer.tsx
5
+ /**
6
+ * Zero-prop leaf renderer. Must be placed inside an ActorProvider or PlayUIProvider tree.
7
+ *
8
+ * Reads ViewContextValue (spec, handlers, registry) from the enclosing provider
9
+ * via usePlayView() and renders the spec via @xmachines/json-render-solid's Renderer.
10
+ */
11
+ var PlayRenderer = () => {
12
+ const view = usePlayView();
13
+ return createComponent(Renderer, {
8
14
  get spec() {
9
- return r.spec;
15
+ return view.spec;
10
16
  },
11
17
  get registry() {
12
- return r.registry;
18
+ return view.registry;
13
19
  }
14
20
  });
15
21
  };
16
22
  //#endregion
17
- export { r as PlayRenderer };
23
+ export { PlayRenderer };
18
24
 
19
25
  //# sourceMappingURL=PlayRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayRenderer.js","names":["Component","Renderer","usePlayView","PlayRenderer","view","_$createComponent","spec","registry"],"sources":["../src/PlayRenderer.tsx"],"sourcesContent":["/**\n * PlayRenderer - Zero-prop leaf component for XMachines Play SolidJS architecture.\n *\n * Reads view context from the enclosing ActorProvider (or PlayUIProvider) via\n * usePlayView() and renders the spec using @xmachines/json-render-solid's Renderer.\n *\n * Standard usage:\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 * Zero-prop leaf renderer. Must be placed inside an ActorProvider or PlayUIProvider tree.\n *\n * Reads ViewContextValue (spec, handlers, registry) from the enclosing provider\n * via usePlayView() and renders the spec via @xmachines/json-render-solid's Renderer.\n */\nexport const PlayRenderer: Component = () => {\n\tconst view = usePlayView();\n\treturn <Renderer spec={view.spec} registry={view.registry} />;\n};\n"],"mappings":";;;;AA0BA,IAAaG,UAAgC;CAC5C,IAAMC,IAAOF,EAAY;CACzB,OAAAG,EAAQJ,GAAQ;EAAA,IAACK,OAAI;GAAA,OAAEF,EAAKE;EAAI;EAAA,IAAEC,WAAQ;GAAA,OAAEH,EAAKG;EAAQ;CAAA,CAAA;AAC1D"}
1
+ {"version":3,"file":"PlayRenderer.js","names":["Component","Renderer","usePlayView","PlayRenderer","view","_$createComponent","spec","registry"],"sources":["../src/PlayRenderer.tsx"],"sourcesContent":["/**\n * PlayRenderer - Zero-prop leaf component for XMachines Play SolidJS architecture.\n *\n * Reads view context from the enclosing ActorProvider (or PlayUIProvider) via\n * usePlayView() and renders the spec using @xmachines/json-render-solid's Renderer.\n *\n * Standard usage:\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 * Zero-prop leaf renderer. Must be placed inside an ActorProvider or PlayUIProvider tree.\n *\n * Reads ViewContextValue (spec, handlers, registry) from the enclosing provider\n * via usePlayView() and renders the spec via @xmachines/json-render-solid's Renderer.\n */\nexport const PlayRenderer: Component = () => {\n\tconst view = usePlayView();\n\treturn <Renderer spec={view.spec} registry={view.registry} />;\n};\n"],"mappings":";;;;;;;;;;AA0BA,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"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * PlayUIProvider — Batteries-included SolidJS provider for XMachines Play.
3
+ *
4
+ * Wraps ActorProvider + JSONUIProvider into a single composite provider.
5
+ * This is the recommended entry point for most users.
6
+ *
7
+ * Standard usage:
8
+ * ```tsx
9
+ * import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-solid";
10
+ *
11
+ * const registryResult = defineRegistry(myCatalog, { components, actions });
12
+ *
13
+ * <PlayUIProvider actor={myActor} registryResult={registryResult}>
14
+ * <PlayRenderer />
15
+ * </PlayUIProvider>
16
+ * ```
17
+ *
18
+ * For full control (library authors), use ActorProvider directly.
19
+ *
20
+ * @packageDocumentation
21
+ */
22
+ import type { Component } from "solid-js";
23
+ import { type JSONUIProviderProps } from "@xmachines/json-render-solid";
24
+ import { type ActorProviderProps } from "./ActorProvider.js";
25
+ type JSONUIForwardedProps = Pick<JSONUIProviderProps, "validationFunctions" | "navigate" | "functions">;
26
+ /**
27
+ * Props for PlayUIProvider — all ActorProvider props plus JSONUIProvider's forwarded props.
28
+ */
29
+ export interface PlayUIProviderProps extends ActorProviderProps, Partial<JSONUIForwardedProps> {
30
+ }
31
+ /**
32
+ * Batteries-included composite provider: ActorProvider + JSONUIProvider.
33
+ *
34
+ * Provides the full JSON render context stack:
35
+ * - ActorContext (actor instance via ActorProvider)
36
+ * - ViewContext (spec, handlers, registry via ActorProvider)
37
+ * - StateProvider + ActionProvider + VisibilityProvider + ValidationProvider (via JSONUIProvider)
38
+ * - ConfirmDialogManager (via JSONUIProvider)
39
+ *
40
+ * @example
41
+ * ```tsx
42
+ * <PlayUIProvider actor={myActor} registryResult={registryResult} navigate={navigate}>
43
+ * <PlayRenderer />
44
+ * </PlayUIProvider>
45
+ * ```
46
+ */
47
+ export declare const PlayUIProvider: Component<PlayUIProviderProps>;
48
+ export {};
49
+ //# sourceMappingURL=PlayUIProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayUIProvider.d.ts","sourceRoot":"","sources":["../src/PlayUIProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAO,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAkB,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAA8B,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGzF,KAAK,oBAAoB,GAAG,IAAI,CAC/B,mBAAmB,EACnB,qBAAqB,GAAG,UAAU,GAAG,WAAW,CAChD,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB,EAAE,OAAO,CAAC,oBAAoB,CAAC;CAAG;AA8BjG;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,mBAAmB,CAqBzD,CAAC"}
@@ -1,35 +1,61 @@
1
- import { ActorProvider as e, usePlayView as t } from "./ActorProvider.js";
2
- import { createComponent as n, mergeProps as r } from "solid-js/web";
3
- import { JSONUIProvider as i } from "@xmachines/json-render-solid";
4
- //#region src/PlayUIProvider.tsx
5
- var a = (e) => {
6
- let a = t();
7
- return n(i, r({
1
+ import { ActorProvider, usePlayView } from "./ActorProvider.js";
2
+ import { createComponent, mergeProps } from "solid-js/web";
3
+ import { JSONUIProvider } from "@xmachines/json-render-solid";
4
+ //#region packages/play-solid/src/PlayUIProvider.tsx
5
+ /**
6
+ * Inner bridge component — must be inside ActorProvider's tree so usePlayView() has
7
+ * access to the resolved ViewContextValue. Reads handlers and registry from the view
8
+ * context and passes them to JSONUIProvider.
9
+ *
10
+ * This bridge pattern mirrors the React implementation (JSONUIBridge in play-react).
11
+ */
12
+ var JSONUIBridge = (bridgeProps) => {
13
+ const view = usePlayView();
14
+ return createComponent(JSONUIProvider, mergeProps({
8
15
  get registry() {
9
- return a.registry;
16
+ return view.registry;
10
17
  },
11
18
  get handlers() {
12
- return a.handlers;
19
+ return view.handlers;
13
20
  },
14
21
  get store() {
15
- return a.store;
22
+ return view.store;
16
23
  }
17
- }, () => e.validationFunctions !== void 0 && { validationFunctions: e.validationFunctions }, () => e.navigate !== void 0 && { navigate: e.navigate }, () => e.functions !== void 0 && { functions: e.functions }, { get children() {
18
- return e.children;
24
+ }, () => bridgeProps.validationFunctions !== void 0 && { validationFunctions: bridgeProps.validationFunctions }, () => bridgeProps.navigate !== void 0 && { navigate: bridgeProps.navigate }, () => bridgeProps.functions !== void 0 && { functions: bridgeProps.functions }, { get children() {
25
+ return bridgeProps.children;
19
26
  } }));
20
- }, o = (t) => n(e, r({
21
- get actor() {
22
- return t.actor;
23
- },
24
- get registryResult() {
25
- return t.registryResult;
26
- }
27
- }, () => t.store !== void 0 && { store: t.store }, () => t.fallback !== void 0 && { fallback: t.fallback }, () => t.onError !== void 0 && { onError: t.onError }, () => t.onRenderError !== void 0 && { onRenderError: t.onRenderError }, { get children() {
28
- return n(a, r(() => t.validationFunctions !== void 0 && { validationFunctions: t.validationFunctions }, () => t.navigate !== void 0 && { navigate: t.navigate }, () => t.functions !== void 0 && { functions: t.functions }, { get children() {
29
- return t.children;
27
+ };
28
+ /**
29
+ * Batteries-included composite provider: ActorProvider + JSONUIProvider.
30
+ *
31
+ * Provides the full JSON render context stack:
32
+ * - ActorContext (actor instance via ActorProvider)
33
+ * - ViewContext (spec, handlers, registry via ActorProvider)
34
+ * - StateProvider + ActionProvider + VisibilityProvider + ValidationProvider (via JSONUIProvider)
35
+ * - ConfirmDialogManager (via JSONUIProvider)
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * <PlayUIProvider actor={myActor} registryResult={registryResult} navigate={navigate}>
40
+ * <PlayRenderer />
41
+ * </PlayUIProvider>
42
+ * ```
43
+ */
44
+ var PlayUIProvider = (props) => {
45
+ return createComponent(ActorProvider, mergeProps({
46
+ get actor() {
47
+ return props.actor;
48
+ },
49
+ get registryResult() {
50
+ return props.registryResult;
51
+ }
52
+ }, () => props.store !== void 0 && { store: props.store }, () => props.fallback !== void 0 && { fallback: props.fallback }, () => props.onError !== void 0 && { onError: props.onError }, () => props.onRenderError !== void 0 && { onRenderError: props.onRenderError }, { get children() {
53
+ return createComponent(JSONUIBridge, mergeProps(() => props.validationFunctions !== void 0 && { validationFunctions: props.validationFunctions }, () => props.navigate !== void 0 && { navigate: props.navigate }, () => props.functions !== void 0 && { functions: props.functions }, { get children() {
54
+ return props.children;
55
+ } }));
30
56
  } }));
31
- } }));
57
+ };
32
58
  //#endregion
33
- export { o as PlayUIProvider };
59
+ export { PlayUIProvider };
34
60
 
35
61
  //# sourceMappingURL=PlayUIProvider.js.map
@@ -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 — Batteries-included SolidJS provider for XMachines Play.\n *\n * Wraps ActorProvider + JSONUIProvider into a single composite provider.\n * This is the recommended entry point for most users.\n *\n * Standard usage:\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 full control (library authors), use ActorProvider 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// Pick only the forwarded props from JSONUIProviderProps (per D-16)\ntype JSONUIForwardedProps = Pick<\n\tJSONUIProviderProps,\n\t\"validationFunctions\" | \"navigate\" | \"functions\"\n>;\n\n/**\n * Props for PlayUIProvider — all ActorProvider props plus JSONUIProvider's forwarded props.\n */\nexport interface PlayUIProviderProps extends ActorProviderProps, Partial<JSONUIForwardedProps> {}\n\n/**\n * Inner bridge component — must be inside ActorProvider's tree so usePlayView() has\n * access to the resolved ViewContextValue. Reads handlers and registry from the view\n * context and passes them to JSONUIProvider.\n *\n * This bridge pattern mirrors the React implementation (JSONUIBridge in 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 * Batteries-included composite provider: ActorProvider + JSONUIProvider.\n *\n * Provides the full JSON render context stack:\n * - ActorContext (actor instance via ActorProvider)\n * - ViewContext (spec, handlers, registry via ActorProvider)\n * - StateProvider + ActionProvider + VisibilityProvider + ValidationProvider (via JSONUIProvider)\n * - ConfirmDialogManager (via 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":";;;;AA4CA,IAAMW,KACLG,MACI;CACJ,IAAMC,IAAOV,EAAY;CAEzB,OAAAW,EACEd,GAAce,EAAA;EAAA,IACdC,WAAQ;GAAA,OAAEH,EAAKG;EAAQ;EAAA,IACvBC,WAAQ;GAAA,OAAEJ,EAAKI;EAAQ;EAAA,IACvBC,QAAK;GAAA,OAAEL,EAAKK;EAAK;CAAA,SACZN,EAAYO,wBAAwBC,KAAAA,KAAa,EACrDD,qBAAqBP,EAAYO,oBAClC,SACKP,EAAYS,aAAaD,KAAAA,KAAa,EAAEC,UAAUT,EAAYS,SAAS,SACvET,EAAYU,cAAcF,KAAAA,KAAa,EAAEE,WAAWV,EAAYU,UAAU,GAAC,EAAA,IAAAZ,WAAA;EAAA,OAE/EE,EAAYF;CAAQ,EAAA,CAAA,CAAA;AAGxB,GAkBaa,KAAkDC,MAC9DV,EACEZ,GAAaa,EAAA;CAAA,IACbU,QAAK;EAAA,OAAED,EAAMC;CAAK;CAAA,IAClBC,iBAAc;EAAA,OAAEF,EAAME;CAAc;AAAA,SAC/BF,EAAMN,UAAUE,KAAAA,KAAa,EAAEF,OAAOM,EAAMN,MAAM,SAClDM,EAAMG,aAAaP,KAAAA,KAAa,EAAEO,UAAUH,EAAMG,SAAS,SAC3DH,EAAMI,YAAYR,KAAAA,KAAa,EAAEQ,SAASJ,EAAMI,QAAQ,SACxDJ,EAAMK,kBAAkBT,KAAAA,KAAa,EAAES,eAAeL,EAAMK,cAAc,GAAC,EAAA,IAAAnB,WAAA;CAAA,OAAAI,EAE/EL,GAAYM,QACPS,EAAML,wBAAwBC,KAAAA,KAAa,EAC/CD,qBAAqBK,EAAML,oBAC5B,SACKK,EAAMH,aAAaD,KAAAA,KAAa,EAAEC,UAAUG,EAAMH,SAAS,SAC3DG,EAAMF,cAAcF,KAAAA,KAAa,EAAEE,WAAWE,EAAMF,UAAU,GAAC,EAAA,IAAAZ,WAAA;EAAA,OAEnEc,EAAMd;CAAQ,EAAA,CAAA,CAAA;AAAA,EAAA,CAAA,CAAA"}
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 — Batteries-included SolidJS provider for XMachines Play.\n *\n * Wraps ActorProvider + JSONUIProvider into a single composite provider.\n * This is the recommended entry point for most users.\n *\n * Standard usage:\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 full control (library authors), use ActorProvider 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// Pick only the forwarded props from JSONUIProviderProps (per D-16)\ntype JSONUIForwardedProps = Pick<\n\tJSONUIProviderProps,\n\t\"validationFunctions\" | \"navigate\" | \"functions\"\n>;\n\n/**\n * Props for PlayUIProvider — all ActorProvider props plus JSONUIProvider's forwarded props.\n */\nexport interface PlayUIProviderProps extends ActorProviderProps, Partial<JSONUIForwardedProps> {}\n\n/**\n * Inner bridge component — must be inside ActorProvider's tree so usePlayView() has\n * access to the resolved ViewContextValue. Reads handlers and registry from the view\n * context and passes them to JSONUIProvider.\n *\n * This bridge pattern mirrors the React implementation (JSONUIBridge in 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 * Batteries-included composite provider: ActorProvider + JSONUIProvider.\n *\n * Provides the full JSON render context stack:\n * - ActorContext (actor instance via ActorProvider)\n * - ViewContext (spec, handlers, registry via ActorProvider)\n * - StateProvider + ActionProvider + VisibilityProvider + ValidationProvider (via JSONUIProvider)\n * - ConfirmDialogManager (via 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":";;;;;;;;;;;AA4CA,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"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @xmachines/play-solid - SolidJS renderer for XMachines Play architecture
3
+ *
4
+ * Provides a SolidJS rendering layer that passively observes actor signals and
5
+ * renders UI components via @xmachines/json-render-solid. SolidJS reactivity is only used
6
+ * to trigger re-renders — signals are the source of truth.
7
+ *
8
+ * Primary entry point:
9
+ * ```tsx
10
+ * import { PlayUIProvider, PlayRenderer, defineRegistry } from "@xmachines/play-solid";
11
+ * ```
12
+ *
13
+ * For escape-hatch provider composition:
14
+ * ```tsx
15
+ * import { ActorProvider, ActorContext, usePlayView } from "@xmachines/play-solid";
16
+ * ```
17
+ *
18
+ * @packageDocumentation
19
+ */
20
+ export { PlayRenderer } from "./PlayRenderer.js";
21
+ export { ActorProvider, usePlayView } from "./ActorProvider.js";
22
+ export { PlayUIProvider } from "./PlayUIProvider.js";
23
+ export { ActorContext, useActor } from "./useActor.js";
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
+ 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";
27
+ export type { ActorProviderProps, PlayUIProviderProps, ViewContextValue } from "./types.js";
28
+ export type { AnyPlayActor } from "./useActor.js";
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AAIrD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAMvD,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"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { ActorContext as e, useActor as t } from "./useActor.js";
2
- import { ActorProvider as n, usePlayView as r } from "./ActorProvider.js";
3
- import { PlayRenderer as i } from "./PlayRenderer.js";
4
- import { PlayUIProvider as a } from "./PlayUIProvider.js";
5
- import { ActionProvider as o, JSONUIProvider as s, Renderer as c, StateProvider as l, ValidationProvider as u, VisibilityProvider as d, defineRegistry as f, useAction as p, useActions as m, useBoundProp as h, useFieldValidation as g, useIsVisible as _, useOptionalValidation as v, useStateBinding as y, useStateStore as b, useStateValue as x, useVisibility as S } from "@xmachines/json-render-solid";
6
- export { o as ActionProvider, e as ActorContext, n as ActorProvider, s as JSONUIProvider, i as PlayRenderer, a as PlayUIProvider, c as Renderer, l as StateProvider, u as ValidationProvider, d as VisibilityProvider, f as defineRegistry, p as useAction, m as useActions, t as useActor, h as useBoundProp, g as useFieldValidation, _ as useIsVisible, v as useOptionalValidation, r as usePlayView, y as useStateBinding, b as useStateStore, x as useStateValue, S as useVisibility };
1
+ import { ActorContext, useActor } from "./useActor.js";
2
+ import { ActorProvider, usePlayView } from "./ActorProvider.js";
3
+ import { PlayRenderer } from "./PlayRenderer.js";
4
+ import { PlayUIProvider } from "./PlayUIProvider.js";
5
+ import { ActionProvider, JSONUIProvider, Renderer, StateProvider, ValidationProvider, VisibilityProvider, defineRegistry, useAction, useActions, useBoundProp, useFieldValidation, useIsVisible, useOptionalValidation, useStateBinding, useStateStore, useStateValue, useVisibility } from "@xmachines/json-render-solid";
6
+ export { ActionProvider, ActorContext, ActorProvider, JSONUIProvider, PlayRenderer, PlayUIProvider, Renderer, StateProvider, ValidationProvider, VisibilityProvider, defineRegistry, useAction, useActions, useActor, useBoundProp, useFieldValidation, useIsVisible, useOptionalValidation, usePlayView, useStateBinding, useStateStore, useStateValue, useVisibility };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * TypeScript type definitions for play-solid
3
+ *
4
+ * Re-exports the primary prop types from their respective source files.
5
+ * PlayRendererProps has been removed per D-06 (replaced by ActorProviderProps / PlayUIProviderProps).
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ export type { RenderErrorHandler } from "@xmachines/json-render-solid";
10
+ export type { ActorProviderProps, ViewContextValue } from "./ActorProvider.js";
11
+ export type { PlayUIProviderProps } from "./PlayUIProvider.js";
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * useActor — SolidJS hook for accessing the raw actor inside an ActorProvider tree.
3
+ *
4
+ * Components rendered inside ActorProvider (or PlayUIProvider) can call useActor()
5
+ * to get direct access to the actor instance without prop drilling.
6
+ *
7
+ * @throws {Error} If called outside an ActorProvider tree
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * import { useActor } from "@xmachines/play-solid";
12
+ *
13
+ * function MyComponent() {
14
+ * const actor = useActor();
15
+ * return <button onClick={() => actor.send({ type: "SUBMIT" })}>Submit</button>;
16
+ * }
17
+ * ```
18
+ *
19
+ * @packageDocumentation
20
+ */
21
+ import type { AbstractActor } from "@xmachines/play-actor";
22
+ import type { AnyActorLogic } from "xstate";
23
+ /** Bare actor type accepted by Solid context providers. For the full routing + view shape, use `PlayActor` from `@xmachines/play-router`. */
24
+ export type AnyPlayActor = AbstractActor<AnyActorLogic>;
25
+ /**
26
+ * SolidJS context for the actor — exported so consumers can use ActorContext.Provider
27
+ * directly as an escape hatch (per D-11). The smart ActorProvider component takes
28
+ * the name "ActorProvider" and is the recommended entry point.
29
+ */
30
+ export declare const ActorContext: import("solid-js").Context<AnyPlayActor | null>;
31
+ export declare function useActor(): AnyPlayActor;
32
+ //# sourceMappingURL=useActor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useActor.d.ts","sourceRoot":"","sources":["../src/useActor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,6IAA6I;AAC7I,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,YAAY,iDAA2C,CAAC;AAErE,wBAAgB,QAAQ,IAAI,YAAY,CAEvC"}
package/dist/useActor.js CHANGED
@@ -1,11 +1,36 @@
1
- import { createContext as e, useContext as t } from "solid-js";
2
- import { assertNonNullable as n } from "@xmachines/play";
3
- //#region src/useActor.ts
4
- var r = e(null);
5
- function i() {
6
- return n(t(r), "ActorContext");
1
+ import { createContext, useContext } from "solid-js";
2
+ import { assertNonNullable } from "@xmachines/play";
3
+ //#region packages/play-solid/src/useActor.ts
4
+ /**
5
+ * useActor — SolidJS hook for accessing the raw actor inside an ActorProvider tree.
6
+ *
7
+ * Components rendered inside ActorProvider (or PlayUIProvider) can call useActor()
8
+ * to get direct access to the actor instance without prop drilling.
9
+ *
10
+ * @throws {Error} If called outside an ActorProvider tree
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { useActor } from "@xmachines/play-solid";
15
+ *
16
+ * function MyComponent() {
17
+ * const actor = useActor();
18
+ * return <button onClick={() => actor.send({ type: "SUBMIT" })}>Submit</button>;
19
+ * }
20
+ * ```
21
+ *
22
+ * @packageDocumentation
23
+ */
24
+ /**
25
+ * SolidJS context for the actor — exported so consumers can use ActorContext.Provider
26
+ * directly as an escape hatch (per D-11). The smart ActorProvider component takes
27
+ * the name "ActorProvider" and is the recommended entry point.
28
+ */
29
+ var ActorContext = createContext(null);
30
+ function useActor() {
31
+ return assertNonNullable(useContext(ActorContext), "ActorContext");
7
32
  }
8
33
  //#endregion
9
- export { r as ActorContext, i as useActor };
34
+ export { ActorContext, useActor };
10
35
 
11
36
  //# sourceMappingURL=useActor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useActor.js","names":[],"sources":["../src/useActor.ts"],"sourcesContent":["/**\n * useActor — SolidJS hook for accessing the raw actor inside an ActorProvider tree.\n *\n * Components rendered inside ActorProvider (or PlayUIProvider) can call useActor()\n * to get direct access to the actor instance without prop drilling.\n *\n * @throws {Error} If called outside an ActorProvider tree\n *\n * @example\n * ```typescript\n * import { useActor } from \"@xmachines/play-solid\";\n *\n * function MyComponent() {\n * const actor = useActor();\n * return <button onClick={() => actor.send({ type: \"SUBMIT\" })}>Submit</button>;\n * }\n * ```\n *\n * @packageDocumentation\n */\n\nimport { createContext, useContext } from \"solid-js\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport type { AbstractActor } from \"@xmachines/play-actor\";\nimport type { AnyActorLogic } from \"xstate\";\n\n/** Bare actor type accepted by Solid context providers. For the full routing + view shape, use `PlayActor` from `@xmachines/play-router`. */\nexport type AnyPlayActor = AbstractActor<AnyActorLogic>;\n\n/**\n * SolidJS context for the actor — exported so consumers can use ActorContext.Provider\n * directly as an escape hatch (per D-11). The smart ActorProvider component takes\n * the name \"ActorProvider\" and is the recommended entry point.\n */\nexport const ActorContext = createContext<AnyPlayActor | null>(null);\n\nexport function useActor(): AnyPlayActor {\n\treturn assertNonNullable(useContext(ActorContext), \"ActorContext\");\n}\n"],"mappings":";;;AAkCA,IAAa,IAAe,EAAmC,IAAI;AAEnE,SAAgB,IAAyB;CACxC,OAAO,EAAkB,EAAW,CAAY,GAAG,cAAc;AAClE"}
1
+ {"version":3,"file":"useActor.js","names":[],"sources":["../src/useActor.ts"],"sourcesContent":["/**\n * useActor — SolidJS hook for accessing the raw actor inside an ActorProvider tree.\n *\n * Components rendered inside ActorProvider (or PlayUIProvider) can call useActor()\n * to get direct access to the actor instance without prop drilling.\n *\n * @throws {Error} If called outside an ActorProvider tree\n *\n * @example\n * ```typescript\n * import { useActor } from \"@xmachines/play-solid\";\n *\n * function MyComponent() {\n * const actor = useActor();\n * return <button onClick={() => actor.send({ type: \"SUBMIT\" })}>Submit</button>;\n * }\n * ```\n *\n * @packageDocumentation\n */\n\nimport { createContext, useContext } from \"solid-js\";\nimport { assertNonNullable } from \"@xmachines/play\";\nimport type { AbstractActor } from \"@xmachines/play-actor\";\nimport type { AnyActorLogic } from \"xstate\";\n\n/** Bare actor type accepted by Solid context providers. For the full routing + view shape, use `PlayActor` from `@xmachines/play-router`. */\nexport type AnyPlayActor = AbstractActor<AnyActorLogic>;\n\n/**\n * SolidJS context for the actor — exported so consumers can use ActorContext.Provider\n * directly as an escape hatch (per D-11). The smart ActorProvider component takes\n * the name \"ActorProvider\" and is the recommended entry point.\n */\nexport const ActorContext = createContext<AnyPlayActor | null>(null);\n\nexport function useActor(): AnyPlayActor {\n\treturn assertNonNullable(useContext(ActorContext), \"ActorContext\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,IAAa,eAAe,cAAmC,IAAI;AAEnE,SAAgB,WAAyB;CACxC,OAAO,kBAAkB,WAAW,YAAY,GAAG,cAAc;AAClE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-solid",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0",
4
4
  "description": "Solid renderer for XMachines Play architecture",
5
5
  "keywords": [
6
6
  "catalog",
@@ -14,7 +14,7 @@
14
14
  "author": "XMachines Contributors",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "git+ssh://git@gitlab.com/xmachin-es/xmachines-js.git",
17
+ "url": "git+https://gitlab.com/xmachin-es/xmachines-js.git",
18
18
  "directory": "packages/play-solid"
19
19
  },
20
20
  "files": [
@@ -23,12 +23,15 @@
23
23
  "LICENSE"
24
24
  ],
25
25
  "type": "module",
26
+ "sideEffects": false,
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
26
29
  "exports": {
27
30
  ".": {
28
- "source": "./src/index.ts",
29
31
  "types": "./dist/index.d.ts",
30
32
  "default": "./dist/index.js"
31
- }
33
+ },
34
+ "./package.json": "./package.json"
32
35
  },
33
36
  "publishConfig": {
34
37
  "access": "public"
@@ -40,42 +43,40 @@
40
43
  "format": "oxfmt .",
41
44
  "test": "vitest",
42
45
  "test:watch": "vitest",
43
- "test:ui": "vitest --ui",
44
- "prepublishOnly": "npm run build"
46
+ "test:ui": "vitest --ui"
45
47
  },
46
48
  "dependencies": {
47
- "@xmachines/play": "2.0.0-alpha.1",
48
- "@xmachines/play-actor": "2.0.0-alpha.1",
49
- "@xmachines/play-signals": "2.0.0-alpha.1"
49
+ "@xmachines/play": "2.0.0",
50
+ "@xmachines/play-actor": "2.0.0",
51
+ "@xmachines/play-signals": "2.0.0"
50
52
  },
51
53
  "devDependencies": {
52
54
  "@solidjs/testing-library": "^0.8.10",
53
55
  "@testing-library/jest-dom": "^6.9.1",
54
- "@types/node": "^26.1.1",
55
- "@vitest/browser-playwright": "^4.1.10",
56
- "@xmachines/json-render-core": "^0.19.0-xm.2",
57
- "@xmachines/json-render-solid": "^0.19.0-xm.2",
58
- "@xmachines/json-render-xstate": "^0.19.0-xm.2",
59
- "@xmachines/shared": "2.0.0-alpha.1",
56
+ "@types/node": "^26.2.0",
57
+ "@vitest/browser-playwright": "^4.1.11",
58
+ "@xmachines/json-render-core": "^0.20.0-xm.2",
59
+ "@xmachines/json-render-solid": "^0.20.0-xm.2",
60
+ "@xmachines/json-render-xstate": "^0.20.0-xm.2",
60
61
  "@xstate/store": "^3.17.0",
61
62
  "jsdom": "^29.1.0",
62
- "oxfmt": "^0.58.0",
63
- "oxlint": "^1.73.0",
63
+ "oxfmt": "^0.64.0",
64
+ "oxlint": "^1.79.0",
64
65
  "solid-js": "^1.9.12",
65
66
  "typescript": "^5.9.3 || ^6.0.3",
66
67
  "vite": "^8.0.10",
67
68
  "vite-plugin-solid": "^2.11.11",
68
- "vitest": "^4.1.10",
69
- "xstate": "^6.0.0-alpha.20",
69
+ "vitest": "^4.1.11",
70
+ "xstate": "^5.31.0",
70
71
  "zod": "^4.4.1"
71
72
  },
72
73
  "peerDependencies": {
73
- "@xmachines/json-render-core": "^0.19.0-xm.2",
74
- "@xmachines/json-render-solid": "^0.19.0-xm.2",
75
- "@xmachines/json-render-xstate": "^0.19.0-xm.2",
74
+ "@xmachines/json-render-core": "^0.20.0-xm.2",
75
+ "@xmachines/json-render-solid": "^0.20.0-xm.2",
76
+ "@xmachines/json-render-xstate": "^0.20.0-xm.2",
76
77
  "@xstate/store": "^3.17.0",
77
78
  "solid-js": "^1.8.0",
78
- "xstate": "^6.0.0-alpha.20"
79
+ "xstate": "^5.31.0"
79
80
  },
80
81
  "engines": {
81
82
  "node": ">=22.0.0"