@xmachines/play-solid 1.0.0 → 1.1.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,10 @@
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)
6
+ [![Version](https://img.shields.io/badge/version-1.1.0-blue)](https://www.npmjs.com/package/@xmachines/play-solid)
7
+
7
8
  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
9
 
9
10
  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"}
@@ -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"}
@@ -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"}
@@ -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"}
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xmachines/play-solid",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Solid renderer for XMachines Play architecture",
5
5
  "keywords": [
6
6
  "catalog",
@@ -23,9 +23,9 @@
23
23
  "LICENSE"
24
24
  ],
25
25
  "type": "module",
26
+ "sideEffects": false,
26
27
  "exports": {
27
28
  ".": {
28
- "source": "./src/index.ts",
29
29
  "types": "./dist/index.d.ts",
30
30
  "default": "./dist/index.js"
31
31
  }
@@ -40,32 +40,30 @@
40
40
  "format": "oxfmt .",
41
41
  "test": "vitest",
42
42
  "test:watch": "vitest",
43
- "test:ui": "vitest --ui",
44
- "prepublishOnly": "npm run build"
43
+ "test:ui": "vitest --ui"
45
44
  },
46
45
  "dependencies": {
47
- "@xmachines/play": "1.0.0",
48
- "@xmachines/play-actor": "1.0.0",
49
- "@xmachines/play-signals": "1.0.0"
46
+ "@xmachines/play": "1.1.0",
47
+ "@xmachines/play-actor": "1.1.0",
48
+ "@xmachines/play-signals": "1.1.0"
50
49
  },
51
50
  "devDependencies": {
52
51
  "@solidjs/testing-library": "^0.8.10",
53
52
  "@testing-library/jest-dom": "^6.9.1",
54
- "@types/node": "^26.1.1",
53
+ "@types/node": "^26.2.0",
55
54
  "@vitest/browser-playwright": "^4.1.10",
56
55
  "@xmachines/json-render-core": "^0.19.0-xm.2",
57
56
  "@xmachines/json-render-solid": "^0.19.0-xm.2",
58
57
  "@xmachines/json-render-xstate": "^0.19.0-xm.2",
59
- "@xmachines/shared": "1.0.0",
60
58
  "@xstate/store": "^3.17.0",
61
59
  "jsdom": "^29.1.0",
62
- "oxfmt": "^0.58.0",
63
- "oxlint": "^1.73.0",
60
+ "oxfmt": "^0.64.0",
61
+ "oxlint": "^1.79.0",
64
62
  "solid-js": "^1.9.12",
65
63
  "typescript": "^5.9.3 || ^6.0.3",
66
64
  "vite": "^8.0.10",
67
65
  "vite-plugin-solid": "^2.11.11",
68
- "vitest": "^4.1.10",
66
+ "vitest": "^4.1.11",
69
67
  "xstate": "^5.31.0",
70
68
  "zod": "^4.4.1"
71
69
  },
@@ -1,85 +0,0 @@
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");
14
- }
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
24
- };
25
- return t(_.Provider, {
26
- value: o,
27
- get children() {
28
- return e.children;
29
- }
30
- });
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;
36
- },
37
- has(e, t) {
38
- return t in r.actor;
39
- }
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);
49
- });
50
- l(() => t());
51
- }), t(e.Provider, {
52
- value: m,
53
- get children() {
54
- return t(i, {
55
- fallback: (e) => (r.onError?.(e), r.fallback ?? null),
56
- get children() {
57
- 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,
63
- get children() {
64
- return t(y, {
65
- get registryResult() {
66
- return _();
67
- },
68
- spec: e,
69
- store: i,
70
- get children() {
71
- return r.children;
72
- }
73
- });
74
- }
75
- });
76
- })();
77
- }
78
- });
79
- }
80
- });
81
- };
82
- //#endregion
83
- export { b as ActorProvider, v as usePlayView };
84
-
85
- //# sourceMappingURL=ActorProvider.js.map
@@ -1 +0,0 @@
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,19 +0,0 @@
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, {
8
- get spec() {
9
- return r.spec;
10
- },
11
- get registry() {
12
- return r.registry;
13
- }
14
- });
15
- };
16
- //#endregion
17
- export { r as PlayRenderer };
18
-
19
- //# sourceMappingURL=PlayRenderer.js.map
@@ -1 +0,0 @@
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,35 +0,0 @@
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({
8
- get registry() {
9
- return a.registry;
10
- },
11
- get handlers() {
12
- return a.handlers;
13
- },
14
- get store() {
15
- return a.store;
16
- }
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;
19
- } }));
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;
30
- } }));
31
- } }));
32
- //#endregion
33
- export { o as PlayUIProvider };
34
-
35
- //# sourceMappingURL=PlayUIProvider.js.map
@@ -1 +0,0 @@
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"}
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
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 };
package/dist/useActor.js DELETED
@@ -1,11 +0,0 @@
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");
7
- }
8
- //#endregion
9
- export { r as ActorContext, i as useActor };
10
-
11
- //# sourceMappingURL=useActor.js.map
@@ -1 +0,0 @@
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"}