@xmachines/docs 1.0.0-beta.15 → 1.0.0-beta.17
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/api/@xmachines/play/README.md +56 -17
- package/api/@xmachines/play/classes/PlayError.md +240 -0
- package/api/@xmachines/play/type-aliases/PlayEvent.md +4 -4
- package/api/@xmachines/play-actor/README.md +32 -31
- package/api/@xmachines/play-actor/classes/AbstractActor.md +65 -53
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +37 -0
- package/api/@xmachines/play-actor/interfaces/Routable.md +5 -4
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +6 -6
- package/api/@xmachines/play-actor/interfaces/Viewable.md +8 -8
- package/api/@xmachines/play-dom/README.md +36 -0
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +83 -0
- package/api/@xmachines/play-dom/functions/connectRenderer.md +51 -0
- package/api/@xmachines/play-dom/functions/renderSpec.md +28 -0
- package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +18 -0
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +18 -0
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +14 -0
- package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +23 -0
- package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +11 -0
- package/api/@xmachines/play-react/README.md +226 -305
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +12 -38
- package/api/@xmachines/play-react/functions/defineRegistry.md +47 -0
- package/api/@xmachines/play-react/functions/useActor.md +13 -0
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- package/api/@xmachines/play-react/functions/useStateBinding.md +32 -0
- package/api/@xmachines/play-react/interfaces/ComponentContext.md +35 -0
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryProps.md +4 -4
- package/api/@xmachines/play-react/interfaces/PlayErrorBoundaryState.md +3 -3
- package/api/@xmachines/play-react/interfaces/PlayRendererProps.md +15 -7
- package/api/@xmachines/play-react/type-aliases/ComponentFn.md +34 -0
- package/api/@xmachines/play-react/type-aliases/PlayActor.md +9 -0
- package/api/@xmachines/play-react/variables/PlayRenderer.md +18 -30
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +32 -32
- package/api/@xmachines/play-react-router/classes/RouteMap.md +5 -5
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +11 -5
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +14 -8
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-router/README.md +51 -0
- package/api/@xmachines/play-router/classes/BaseRouteMap.md +6 -6
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +44 -40
- package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
- package/api/@xmachines/play-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-router/functions/crawlMachine.md +1 -1
- package/api/@xmachines/play-router/functions/createBrowserHistory.md +4 -1
- package/api/@xmachines/play-router/functions/createRouteMap.md +3 -3
- package/api/@xmachines/play-router/functions/createRouter.md +1 -1
- package/api/@xmachines/play-router/functions/detectDuplicateRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/extractRoute.md +1 -1
- package/api/@xmachines/play-router/functions/findRouteById.md +1 -1
- package/api/@xmachines/play-router/functions/findRouteByPath.md +1 -1
- package/api/@xmachines/play-router/functions/getNavigableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/getRoutableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +1 -1
- package/api/@xmachines/play-router/functions/validateRouteFormat.md +1 -1
- package/api/@xmachines/play-router/functions/validateStateExists.md +1 -1
- package/api/@xmachines/play-router/interfaces/BaseRouteMapping.md +3 -3
- package/api/@xmachines/play-router/interfaces/BrowserHistory.md +19 -15
- package/api/@xmachines/play-router/interfaces/BrowserWindow.md +14 -14
- package/api/@xmachines/play-router/interfaces/ConnectRouterOptions.md +6 -6
- package/api/@xmachines/play-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-router/interfaces/RouteInfo.md +8 -8
- package/api/@xmachines/play-router/interfaces/RouteMap.md +4 -4
- package/api/@xmachines/play-router/interfaces/RouteNode.md +10 -10
- package/api/@xmachines/play-router/interfaces/RouteObject.md +2 -2
- package/api/@xmachines/play-router/interfaces/RouteTree.md +4 -4
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +55 -0
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/interfaces/StateVisit.md +4 -4
- package/api/@xmachines/play-router/interfaces/VanillaRouter.md +4 -4
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-signals/README.md +22 -10
- package/api/@xmachines/play-signals/functions/watchSignal.md +35 -0
- package/api/@xmachines/play-signals/interfaces/ComputedOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalComputed.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalOptions.md +2 -2
- package/api/@xmachines/play-signals/interfaces/SignalState.md +3 -3
- package/api/@xmachines/play-signals/interfaces/SignalWatcher.md +4 -4
- package/api/@xmachines/play-signals/namespaces/Signal/classes/Computed.md +3 -9
- package/api/@xmachines/play-signals/namespaces/Signal/classes/State.md +3 -11
- package/api/@xmachines/play-signals/namespaces/Signal/interfaces/Options.md +5 -7
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/classes/Watcher.md +3 -13
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/currentComputed.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSinks.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/hasSources.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSinks.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/introspectSources.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/functions/untrack.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/unwatched.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/namespaces/subtle/variables/watched.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isComputed.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isState.md +0 -2
- package/api/@xmachines/play-signals/namespaces/Signal/variables/isWatcher.md +0 -2
- package/api/@xmachines/play-signals/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/README.md +193 -219
- package/api/@xmachines/play-solid/functions/defineRegistry.md +47 -0
- package/api/@xmachines/play-solid/functions/useActor.md +13 -0
- package/api/@xmachines/play-solid/functions/useStateBinding.md +23 -0
- package/api/@xmachines/play-solid/interfaces/ComponentContext.md +35 -0
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +15 -7
- package/api/@xmachines/play-solid/type-aliases/ComponentFn.md +34 -0
- package/api/@xmachines/play-solid/type-aliases/PlayActor.md +9 -0
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +15 -43
- package/api/@xmachines/play-solid-router/README.md +2 -0
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +6 -6
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +37 -37
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +11 -5
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +65 -51
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +14 -8
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +3 -1
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
- package/api/@xmachines/play-tanstack-react-router/README.md +1 -5
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +5 -5
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +45 -33
- package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +11 -5
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +2 -2
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/extractParams.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/extractQueryParams.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +14 -8
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/interfaces/RouteNavigateEvent.md +3 -3
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/type-aliases/TanStackRouterLike.md +24 -4
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +6 -6
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +33 -33
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +11 -5
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +14 -8
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +3 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterInstance.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/TanStackRouterLike.md +4 -4
- package/api/@xmachines/play-vue/README.md +216 -209
- package/api/@xmachines/play-vue/functions/defineRegistry.md +32 -0
- package/api/@xmachines/play-vue/functions/useActor.md +13 -0
- package/api/@xmachines/play-vue/functions/useStateBinding.md +30 -0
- package/api/@xmachines/play-vue/interfaces/ComponentContext.md +35 -0
- package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +14 -6
- package/api/@xmachines/play-vue/type-aliases/ComponentFn.md +33 -0
- package/api/@xmachines/play-vue/type-aliases/PlayActor.md +9 -0
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue-router/README.md +21 -0
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +7 -7
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +7 -7
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +46 -49
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +4 -4
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +3 -1
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +7 -1
- package/api/@xmachines/play-xstate/README.md +250 -107
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +77 -55
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +24 -18
- package/api/@xmachines/play-xstate/functions/composeGuards.md +1 -1
- package/api/@xmachines/play-xstate/functions/composeGuardsOr.md +1 -1
- package/api/@xmachines/play-xstate/functions/definePlayer.md +12 -61
- package/api/@xmachines/play-xstate/functions/deriveRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/eventMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/formatPlayRouteTransitions.md +1 -1
- package/api/@xmachines/play-xstate/functions/hasContext.md +1 -1
- package/api/@xmachines/play-xstate/functions/isAbsoluteRoute.md +1 -1
- package/api/@xmachines/play-xstate/functions/negateGuard.md +1 -1
- package/api/@xmachines/play-xstate/functions/stateMatches.md +1 -1
- package/api/@xmachines/play-xstate/interfaces/PlayerConfig.md +9 -13
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +22 -0
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +8 -9
- package/api/@xmachines/play-xstate/interfaces/RouteContext.md +5 -5
- package/api/@xmachines/play-xstate/type-aliases/ComposedGuard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/Guard.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/GuardArray.md +1 -1
- package/api/@xmachines/play-xstate/type-aliases/PlayerFactory.md +6 -5
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +14 -4
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +19 -4
- package/api/@xmachines/shared/functions/defineXmVitestConfig.md +2 -2
- package/api/@xmachines/shared/functions/xmAliases.md +1 -1
- package/api/README.md +1 -1
- package/api/llms.txt +11 -5
- package/examples/README.md +20 -6
- package/examples/multi-router-integration.md +33 -24
- package/examples/routing-patterns.md +2 -3
- package/package.json +3 -3
- package/api/@xmachines/play-catalog/README.md +0 -331
- package/api/@xmachines/play-catalog/functions/defineCatalog.md +0 -98
- package/api/@xmachines/play-catalog/functions/defineComponents.md +0 -134
- package/api/@xmachines/play-catalog/type-aliases/Catalog.md +0 -48
- package/api/@xmachines/play-catalog/type-aliases/ComponentsFor.md +0 -20
- package/api/@xmachines/play-catalog/type-aliases/InferComponentProps.md +0 -65
- package/api/@xmachines/play-catalog/type-aliases/NoExtraKeys.md +0 -17
- package/api/@xmachines/play-xstate/functions/mergeViewProps.md +0 -26
- package/api/@xmachines/play-xstate/functions/validateComponentBinding.md +0 -39
- package/api/@xmachines/play-xstate/functions/validateViewProps.md +0 -80
- package/api/@xmachines/play-xstate/interfaces/CatalogEntry.md +0 -16
- package/api/@xmachines/play-xstate/type-aliases/Catalog.md +0 -21
- package/api/@xmachines/play-xstate/type-aliases/ValidationResult.md +0 -17
- package/api/@xmachines/play-xstate/type-aliases/ViewMergeContext.md +0 -35
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: PlayErrorBoundary
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
5
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:50](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L50)
|
|
6
6
|
|
|
7
7
|
React class component error boundary for catching catalog component render errors.
|
|
8
8
|
|
|
@@ -32,7 +32,7 @@ Per CONS-14: Class component pattern works with all React versions (18 and 19).
|
|
|
32
32
|
new PlayErrorBoundary(props): PlayErrorBoundary;
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
35
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:54](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L54)
|
|
36
36
|
|
|
37
37
|
#### Parameters
|
|
38
38
|
|
|
@@ -55,13 +55,13 @@ React.Component<
|
|
|
55
55
|
|
|
56
56
|
## Properties
|
|
57
57
|
|
|
58
|
-
| Property | Modifier | Type | Description | Inherited from | Defined in
|
|
59
|
-
| ------------------------------------------------ | ---------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------- |
|
|
60
|
-
| <a id="property-context"></a> `context` | `public` | `unknown` | If using React Context, re-declare this in your class to be the `React.ContextType` of your `static contextType`. Should be used with type annotation or static contextType. **Example** `static contextType = MyContext // For TS pre-3.7: context!: React.ContextType<typeof MyContext> // For TS 3.7 and above: declare context: React.ContextType<typeof MyContext>` **See** [React Docs](https://react.dev/reference/react/Component#context) | `React.Component.context` |
|
|
61
|
-
| <a id="property-props"></a> `props` | `readonly` | `Readonly`\<`P`\> | - | `React.Component.props` |
|
|
62
|
-
| <a id="property-state"></a> `state` | `public` | `Readonly`\<`S`\> | - | `React.Component.state` |
|
|
63
|
-
| <a id="property-contexttype"></a> `contextType?` | `static` | `Context`\<`any`\> | If set, `this.context` will be set at runtime to the current value of the given Context. **Example** `type MyContext = number const Ctx = React.createContext<MyContext>(0) class Foo extends React.Component { static contextType = Ctx context!: React.ContextType<typeof Ctx> render () { return <>My context's value: {this.context}</>; } }` **See** [https://react.dev/reference/react/Component#static-contexttype](https://react.dev/reference/react/Component#static-contexttype) | `React.Component.contextType` |
|
|
64
|
-
| <a id="property-proptypes"></a> ~~`propTypes?`~~ | `static` | `any` | Ignored by React. **Deprecated** Only kept in types for backwards compatibility. Will be removed in a future major release. | `React.Component.propTypes` |
|
|
58
|
+
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
59
|
+
| ------------------------------------------------ | ---------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------- | ---------- |
|
|
60
|
+
| <a id="property-context"></a> `context` | `public` | `unknown` | If using React Context, re-declare this in your class to be the `React.ContextType` of your `static contextType`. Should be used with type annotation or static contextType. **Example** `static contextType = MyContext // For TS pre-3.7: context!: React.ContextType<typeof MyContext> // For TS 3.7 and above: declare context: React.ContextType<typeof MyContext>` **See** [React Docs](https://react.dev/reference/react/Component#context) | `React.Component.context` | - |
|
|
61
|
+
| <a id="property-props"></a> `props` | `readonly` | `Readonly`\<`P`\> | - | `React.Component.props` | - |
|
|
62
|
+
| <a id="property-state"></a> `state` | `public` | `Readonly`\<`S`\> | - | `React.Component.state` | - |
|
|
63
|
+
| <a id="property-contexttype"></a> `contextType?` | `static` | `Context`\<`any`\> | If set, `this.context` will be set at runtime to the current value of the given Context. **Example** `type MyContext = number const Ctx = React.createContext<MyContext>(0) class Foo extends React.Component { static contextType = Ctx context!: React.ContextType<typeof Ctx> render () { return <>My context's value: {this.context}</>; } }` **See** [https://react.dev/reference/react/Component#static-contexttype](https://react.dev/reference/react/Component#static-contexttype) | `React.Component.contextType` | - |
|
|
64
|
+
| <a id="property-proptypes"></a> ~~`propTypes?`~~ | `static` | `any` | Ignored by React. **Deprecated** Only kept in types for backwards compatibility. Will be removed in a future major release. | `React.Component.propTypes` | - |
|
|
65
65
|
|
|
66
66
|
## Methods
|
|
67
67
|
|
|
@@ -71,7 +71,7 @@ React.Component<
|
|
|
71
71
|
componentDidCatch(error, info): void;
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
74
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:63](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L63)
|
|
75
75
|
|
|
76
76
|
Catches exceptions generated in descendant components. Unhandled exceptions will cause
|
|
77
77
|
the entire component tree to unmount.
|
|
@@ -101,8 +101,6 @@ React.Component.componentDidCatch;
|
|
|
101
101
|
optional componentDidMount(): void;
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
Defined in: node_modules/@types/react/index.d.ts:1198
|
|
105
|
-
|
|
106
104
|
Called immediately after a component is mounted. Setting state here will trigger re-rendering.
|
|
107
105
|
|
|
108
106
|
#### Returns
|
|
@@ -126,8 +124,6 @@ optional componentDidUpdate(
|
|
|
126
124
|
snapshot?): void;
|
|
127
125
|
```
|
|
128
126
|
|
|
129
|
-
Defined in: node_modules/@types/react/index.d.ts:1261
|
|
130
|
-
|
|
131
127
|
Called immediately after updating occurs. Not called for the initial render.
|
|
132
128
|
|
|
133
129
|
The snapshot is only present if [getSnapshotBeforeUpdate](#getsnapshotbeforeupdate) is present and returns non-null.
|
|
@@ -158,8 +154,6 @@ React.Component.componentDidUpdate;
|
|
|
158
154
|
optional componentWillMount(): void;
|
|
159
155
|
```
|
|
160
156
|
|
|
161
|
-
Defined in: node_modules/@types/react/index.d.ts:1277
|
|
162
|
-
|
|
163
157
|
Called immediately before mounting occurs, and before [Component.render](https://www.jsdocs.io/package/@types/react#Component.render).
|
|
164
158
|
Avoid introducing any side-effects or subscriptions in this method.
|
|
165
159
|
|
|
@@ -194,8 +188,6 @@ React.Component.componentWillMount;
|
|
|
194
188
|
optional componentWillReceiveProps(nextProps, nextContext): void;
|
|
195
189
|
```
|
|
196
190
|
|
|
197
|
-
Defined in: node_modules/@types/react/index.d.ts:1308
|
|
198
|
-
|
|
199
191
|
Called when the component may be receiving new props.
|
|
200
192
|
React may call this even if props have not changed, so be sure to compare new and existing
|
|
201
193
|
props if you only want to handle changes.
|
|
@@ -240,8 +232,6 @@ React.Component.componentWillReceiveProps;
|
|
|
240
232
|
optional componentWillUnmount(): void;
|
|
241
233
|
```
|
|
242
234
|
|
|
243
|
-
Defined in: node_modules/@types/react/index.d.ts:1214
|
|
244
|
-
|
|
245
235
|
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
|
|
246
236
|
cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
|
|
247
237
|
|
|
@@ -266,8 +256,6 @@ optional componentWillUpdate(
|
|
|
266
256
|
nextContext): void;
|
|
267
257
|
```
|
|
268
258
|
|
|
269
|
-
Defined in: node_modules/@types/react/index.d.ts:1340
|
|
270
|
-
|
|
271
259
|
Called immediately before rendering when new props or state is received. Not called for the initial render.
|
|
272
260
|
|
|
273
261
|
Note: You cannot call [Component.setState](#setstate) here.
|
|
@@ -311,8 +299,6 @@ React.Component.componentWillUpdate;
|
|
|
311
299
|
forceUpdate(callback?): void;
|
|
312
300
|
```
|
|
313
301
|
|
|
314
|
-
Defined in: node_modules/@types/react/index.d.ts:976
|
|
315
|
-
|
|
316
302
|
#### Parameters
|
|
317
303
|
|
|
318
304
|
| Parameter | Type |
|
|
@@ -337,8 +323,6 @@ React.Component.forceUpdate;
|
|
|
337
323
|
optional getSnapshotBeforeUpdate(prevProps, prevState): any;
|
|
338
324
|
```
|
|
339
325
|
|
|
340
|
-
Defined in: node_modules/@types/react/index.d.ts:1255
|
|
341
|
-
|
|
342
326
|
Runs before React applies the result of [render](https://www.jsdocs.io/package/@types/react#Component.render) to the document, and
|
|
343
327
|
returns an object to be given to [componentDidUpdate](#componentdidupdate). Useful for saving
|
|
344
328
|
things such as scroll position before [render](https://www.jsdocs.io/package/@types/react#Component.render) causes changes to it.
|
|
@@ -371,7 +355,7 @@ React.Component.getSnapshotBeforeUpdate;
|
|
|
371
355
|
render(): ReactNode;
|
|
372
356
|
```
|
|
373
357
|
|
|
374
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
358
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:70](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L70)
|
|
375
359
|
|
|
376
360
|
#### Returns
|
|
377
361
|
|
|
@@ -391,8 +375,6 @@ React.Component.render;
|
|
|
391
375
|
setState<K>(state, callback?): void;
|
|
392
376
|
```
|
|
393
377
|
|
|
394
|
-
Defined in: node_modules/@types/react/index.d.ts:971
|
|
395
|
-
|
|
396
378
|
#### Type Parameters
|
|
397
379
|
|
|
398
380
|
| Type Parameter |
|
|
@@ -427,8 +409,6 @@ optional shouldComponentUpdate(
|
|
|
427
409
|
nextContext): boolean;
|
|
428
410
|
```
|
|
429
411
|
|
|
430
|
-
Defined in: node_modules/@types/react/index.d.ts:1209
|
|
431
|
-
|
|
432
412
|
Called to determine whether the change in props and state should trigger a re-render.
|
|
433
413
|
|
|
434
414
|
`Component` always returns true.
|
|
@@ -464,8 +444,6 @@ React.Component.shouldComponentUpdate;
|
|
|
464
444
|
optional UNSAFE_componentWillMount(): void;
|
|
465
445
|
```
|
|
466
446
|
|
|
467
|
-
Defined in: node_modules/@types/react/index.d.ts:1292
|
|
468
|
-
|
|
469
447
|
Called immediately before mounting occurs, and before [Component.render](https://www.jsdocs.io/package/@types/react#Component.render).
|
|
470
448
|
Avoid introducing any side-effects or subscriptions in this method.
|
|
471
449
|
|
|
@@ -502,8 +480,6 @@ React.Component.UNSAFE_componentWillMount;
|
|
|
502
480
|
optional UNSAFE_componentWillReceiveProps(nextProps, nextContext): void;
|
|
503
481
|
```
|
|
504
482
|
|
|
505
|
-
Defined in: node_modules/@types/react/index.d.ts:1326
|
|
506
|
-
|
|
507
483
|
Called when the component may be receiving new props.
|
|
508
484
|
React may call this even if props have not changed, so be sure to compare new and existing
|
|
509
485
|
props if you only want to handle changes.
|
|
@@ -553,8 +529,6 @@ optional UNSAFE_componentWillUpdate(
|
|
|
553
529
|
nextContext): void;
|
|
554
530
|
```
|
|
555
531
|
|
|
556
|
-
Defined in: node_modules/@types/react/index.d.ts:1356
|
|
557
|
-
|
|
558
532
|
Called immediately before rendering when new props or state is received. Not called for the initial render.
|
|
559
533
|
|
|
560
534
|
Note: You cannot call [Component.setState](#setstate) here.
|
|
@@ -600,7 +574,7 @@ React.Component.UNSAFE_componentWillUpdate;
|
|
|
600
574
|
static getDerivedStateFromError(error): PlayErrorBoundaryState;
|
|
601
575
|
```
|
|
602
576
|
|
|
603
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
577
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:59](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L59)
|
|
604
578
|
|
|
605
579
|
#### Parameters
|
|
606
580
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-react](../README.md) / defineRegistry
|
|
2
|
+
|
|
3
|
+
# Function: defineRegistry()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function defineRegistry<C>(_catalog, options): DefineRegistryResult;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Create a registry from a catalog with components and/or actions.
|
|
10
|
+
|
|
11
|
+
When the catalog declares actions, the `actions` field is required.
|
|
12
|
+
|
|
13
|
+
## Type Parameters
|
|
14
|
+
|
|
15
|
+
| Type Parameter |
|
|
16
|
+
| ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
17
|
+
| `C` _extends_ `Catalog`\<`SchemaDefinition`\<`SchemaType`\<`string`, `unknown`\>, `SchemaType`\<`string`, `unknown`\>\>, `unknown`\> |
|
|
18
|
+
|
|
19
|
+
## Parameters
|
|
20
|
+
|
|
21
|
+
| Parameter | Type |
|
|
22
|
+
| ---------- | ------------------------------ |
|
|
23
|
+
| `_catalog` | `C` |
|
|
24
|
+
| `options` | `DefineRegistryOptions`\<`C`\> |
|
|
25
|
+
|
|
26
|
+
## Returns
|
|
27
|
+
|
|
28
|
+
`DefineRegistryResult`
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
// Components only (catalog has no actions)
|
|
34
|
+
const { registry } = defineRegistry(catalog, {
|
|
35
|
+
components: {
|
|
36
|
+
Card: ({ props, children }) => (
|
|
37
|
+
<div className="card">{props.title}{children}</div>
|
|
38
|
+
),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Both (catalog declares actions)
|
|
43
|
+
const { registry, handlers, executeAction } = defineRegistry(catalog, {
|
|
44
|
+
components: { ... },
|
|
45
|
+
actions: { ... },
|
|
46
|
+
});
|
|
47
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-react](../README.md) / useActor
|
|
2
|
+
|
|
3
|
+
# Function: useActor()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function useActor(): PlayActor;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-react/src/useActor.ts:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/useActor.ts#L30)
|
|
10
|
+
|
|
11
|
+
## Returns
|
|
12
|
+
|
|
13
|
+
[`PlayActor`](../type-aliases/PlayActor.md)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function useSignalEffect(callback): void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-react/src/useSignalEffect.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-react/src/useSignalEffect.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/useSignalEffect.ts#L65)
|
|
10
10
|
|
|
11
11
|
React hook that subscribes to signal changes and runs effect callback
|
|
12
12
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-react](../README.md) / useStateBinding
|
|
2
|
+
|
|
3
|
+
# ~~Function: useStateBinding()~~
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function useStateBinding<T>(path): [T | undefined, (value) => void];
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Hook to get and set a value from the state model (like useState).
|
|
10
|
+
|
|
11
|
+
## Type Parameters
|
|
12
|
+
|
|
13
|
+
| Type Parameter |
|
|
14
|
+
| -------------- |
|
|
15
|
+
| `T` |
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| --------- | -------- |
|
|
21
|
+
| `path` | `string` |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
\[`T` \| `undefined`, (`value`) => `void`\]
|
|
26
|
+
|
|
27
|
+
## Deprecated
|
|
28
|
+
|
|
29
|
+
Use useBoundProp with `$bindState` expressions instead.
|
|
30
|
+
`useStateBinding` takes a raw state path string, while `useBoundProp` works
|
|
31
|
+
with the renderer's `bindings` map and supports both `$bindState` and
|
|
32
|
+
`$bindItem` expressions.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-react](../README.md) / ComponentContext
|
|
2
|
+
|
|
3
|
+
# Interface: ComponentContext\<C, K\>
|
|
4
|
+
|
|
5
|
+
Context passed to component render functions
|
|
6
|
+
|
|
7
|
+
## Example
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
const Button: ComponentFn<typeof catalog, 'Button'> = (ctx) => {
|
|
11
|
+
return <button onClick={() => ctx.emit("press")}>{ctx.props.label}</button>
|
|
12
|
+
}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Extends
|
|
16
|
+
|
|
17
|
+
- `BaseComponentProps`\<`InferComponentProps`\<`C`, `K`\>\>
|
|
18
|
+
|
|
19
|
+
## Type Parameters
|
|
20
|
+
|
|
21
|
+
| Type Parameter |
|
|
22
|
+
| --------------------------------------------------- |
|
|
23
|
+
| `C` _extends_ `Catalog` |
|
|
24
|
+
| `K` _extends_ keyof `InferCatalogComponents`\<`C`\> |
|
|
25
|
+
|
|
26
|
+
## Properties
|
|
27
|
+
|
|
28
|
+
| Property | Type | Description | Inherited from | Defined in |
|
|
29
|
+
| ------------------------------------------ | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ---------- |
|
|
30
|
+
| <a id="property-bindings"></a> `bindings?` | `Record`\<`string`, `string`\> | Two-way binding paths resolved from `$bindState` / `$bindItem` expressions. Maps prop name → absolute state path for write-back. | `BaseComponentProps.bindings` | - |
|
|
31
|
+
| <a id="property-children"></a> `children?` | `ReactNode` | - | `BaseComponentProps.children` | - |
|
|
32
|
+
| <a id="property-emit"></a> `emit` | (`event`) => `void` | Simple event emitter (shorthand). Fires the event and returns void. | `BaseComponentProps.emit` | - |
|
|
33
|
+
| <a id="property-loading"></a> `loading?` | `boolean` | - | `BaseComponentProps.loading` | - |
|
|
34
|
+
| <a id="property-on"></a> `on` | (`event`) => `EventHandle` | Get an event handle with metadata. Use when you need shouldPreventDefault or bound checks. | `BaseComponentProps.on` | - |
|
|
35
|
+
| <a id="property-props"></a> `props` | `InferComponentProps` | - | `BaseComponentProps.props` | - |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: PlayErrorBoundaryProps
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
5
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:15](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L15)
|
|
6
6
|
|
|
7
7
|
Props for PlayErrorBoundary
|
|
8
8
|
|
|
@@ -10,6 +10,6 @@ Props for PlayErrorBoundary
|
|
|
10
10
|
|
|
11
11
|
| Property | Type | Description | Defined in |
|
|
12
12
|
| ------------------------------------------ | --------------------------- | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
-
| <a id="property-children"></a> `children` | `ReactNode` | Child components to render | [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
14
|
-
| <a id="property-fallback"></a> `fallback?` | `ReactNode` | Fallback UI to render when a child component throws. Defaults to null. | [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
15
|
-
| <a id="property-onerror"></a> `onError?` | (`error`, `info`) => `void` | Optional error handler callback — forwards errors to observability tools (Sentry, etc.) | [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
13
|
+
| <a id="property-children"></a> `children` | `ReactNode` | Child components to render | [packages/play-react/src/PlayErrorBoundary.tsx:19](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L19) |
|
|
14
|
+
| <a id="property-fallback"></a> `fallback?` | `ReactNode` | Fallback UI to render when a child component throws. Defaults to null. | [packages/play-react/src/PlayErrorBoundary.tsx:17](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L17) |
|
|
15
|
+
| <a id="property-onerror"></a> `onError?` | (`error`, `info`) => `void` | Optional error handler callback — forwards errors to observability tools (Sentry, etc.) | [packages/play-react/src/PlayErrorBoundary.tsx:21](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L21) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: PlayErrorBoundaryState
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
5
|
+
Defined in: [packages/play-react/src/PlayErrorBoundary.tsx:29](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L29)
|
|
6
6
|
|
|
7
7
|
Internal state shape for PlayErrorBoundary
|
|
8
8
|
|
|
@@ -10,5 +10,5 @@ Internal state shape for PlayErrorBoundary
|
|
|
10
10
|
|
|
11
11
|
| Property | Type | Defined in |
|
|
12
12
|
| ----------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
-
| <a id="property-error"></a> `error` | `Error` \| `null` | [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
14
|
-
| <a id="property-haserror"></a> `hasError` | `boolean` | [packages/play-react/src/PlayErrorBoundary.tsx:
|
|
13
|
+
| <a id="property-error"></a> `error` | `Error` \| `null` | [packages/play-react/src/PlayErrorBoundary.tsx:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L31) |
|
|
14
|
+
| <a id="property-haserror"></a> `hasError` | `boolean` | [packages/play-react/src/PlayErrorBoundary.tsx:30](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayErrorBoundary.tsx#L30) |
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
[Documentation](../../../README.md) / [@xmachines/play-react](../README.md) / PlayRendererProps
|
|
2
2
|
|
|
3
|
-
# Interface: PlayRendererProps
|
|
3
|
+
# Interface: PlayRendererProps\<TLogic\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-react/src/types.ts:
|
|
5
|
+
Defined in: [packages/play-react/src/types.ts:31](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/types.ts#L31)
|
|
6
6
|
|
|
7
7
|
Props for PlayRenderer component
|
|
8
8
|
|
|
9
|
+
## Type Parameters
|
|
10
|
+
|
|
11
|
+
| Type Parameter | Default type | Description |
|
|
12
|
+
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| `TLogic` _extends_ [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | The XState actor logic type. Defaults to `AnyActorLogic` for non-generic usage. When a specific machine type is provided, the `actions` values are constrained to the event type strings that the machine actually accepts. |
|
|
14
|
+
|
|
9
15
|
## Properties
|
|
10
16
|
|
|
11
|
-
| Property
|
|
12
|
-
|
|
|
13
|
-
| <a id="property-
|
|
14
|
-
| <a id="property-
|
|
15
|
-
| <a id="property-fallback"></a> `fallback?`
|
|
17
|
+
| Property | Type | Description | Defined in |
|
|
18
|
+
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
19
|
+
| <a id="property-actions"></a> `actions?` | `object` | Maps json-render action names to XState event type strings. Values are constrained to `EventFromLogic<TLogic>["type"]` — passing a non-existent event type string is a compile error when TLogic is specified. | [packages/play-react/src/types.ts:56](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/types.ts#L56) |
|
|
20
|
+
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<`TLogic`, [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](../../play-actor/interfaces/Viewable.md) | Actor instance with currentView signal (requires Viewable capability) | [packages/play-react/src/types.ts:33](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/types.ts#L33) |
|
|
21
|
+
| <a id="property-fallback"></a> `fallback?` | `ReactNode` | Optional component shown when currentView is null | [packages/play-react/src/types.ts:49](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/types.ts#L49) |
|
|
22
|
+
| <a id="property-registry"></a> `registry` | `ComponentRegistry` | ComponentRegistry from defineRegistry() in @json-render/react | [packages/play-react/src/types.ts:36](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/types.ts#L36) |
|
|
23
|
+
| <a id="property-store"></a> `store?` | `StateStore` | Optional external StateStore (e.g. from @json-render/xstate). When provided, PlayRenderer operates in controlled mode — spec.state is ignored and the store is the single source of truth for UI state. When omitted, a fresh @xstate/store atom is created internally per view transition, seeded from spec.state. | [packages/play-react/src/types.ts:46](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/types.ts#L46) |
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-react](../README.md) / ComponentFn
|
|
2
|
+
|
|
3
|
+
# Type Alias: ComponentFn\<C, K\>
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type ComponentFn<C, K> = (ctx) => ReactNode;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Component render function type for React
|
|
10
|
+
|
|
11
|
+
## Type Parameters
|
|
12
|
+
|
|
13
|
+
| Type Parameter |
|
|
14
|
+
| --------------------------------------------------- |
|
|
15
|
+
| `C` _extends_ `Catalog` |
|
|
16
|
+
| `K` _extends_ keyof `InferCatalogComponents`\<`C`\> |
|
|
17
|
+
|
|
18
|
+
## Parameters
|
|
19
|
+
|
|
20
|
+
| Parameter | Type |
|
|
21
|
+
| --------- | ------------------------------------------------------------------- |
|
|
22
|
+
| `ctx` | [`ComponentContext`](../interfaces/ComponentContext.md)\<`C`, `K`\> |
|
|
23
|
+
|
|
24
|
+
## Returns
|
|
25
|
+
|
|
26
|
+
`ReactNode`
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
const Button: ComponentFn<typeof catalog, 'Button'> = ({ props, emit }) => (
|
|
32
|
+
<button onClick={() => emit("press")}>{props.label}</button>
|
|
33
|
+
);
|
|
34
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-react](../README.md) / PlayActor
|
|
2
|
+
|
|
3
|
+
# Type Alias: PlayActor
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
type PlayActor = AbstractActor<AnyActorLogic>;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [packages/play-react/src/useActor.ts:26](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/useActor.ts#L26)
|
|
@@ -6,16 +6,20 @@
|
|
|
6
6
|
const PlayRenderer: React.FC<PlayRendererProps>;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-react/src/PlayRenderer.tsx:
|
|
9
|
+
Defined in: [packages/play-react/src/PlayRenderer.tsx:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.17/packages/play-react/src/PlayRenderer.tsx#L65)
|
|
10
10
|
|
|
11
11
|
Main renderer component that subscribes to actor signals and renders UI
|
|
12
|
+
via @json-render/react Renderer.
|
|
12
13
|
|
|
13
|
-
Architecture
|
|
14
|
+
Architecture:
|
|
14
15
|
|
|
15
16
|
- Subscribes to actor.currentView signal via useSignalEffect
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
17
|
+
- Renders view.spec via StateProvider → ActionProvider → VisibilityProvider → Renderer
|
|
18
|
+
- Routes action names to actor.send() via the `actions` prop mapping
|
|
19
|
+
- State store: uses external `store` prop if provided (controlled mode); otherwise
|
|
20
|
+
creates a fresh @xstate/store atom per view transition seeded from spec.state.
|
|
21
|
+
The atom resets automatically when the actor transitions to a new view, mirroring
|
|
22
|
+
the actor's currentView lifecycle.
|
|
19
23
|
|
|
20
24
|
Invariant: Actor Authority - Actor decides all state transitions via guards.
|
|
21
25
|
Invariant: Passive Infrastructure - Component observes signals and sends events.
|
|
@@ -25,20 +29,18 @@ Invariant: Signal-Only Reactivity - Business logic state lives in actor signals.
|
|
|
25
29
|
|
|
26
30
|
```typescript
|
|
27
31
|
import { PlayRenderer } from "@xmachines/play-react";
|
|
28
|
-
import {
|
|
32
|
+
import { defineRegistry } from "@json-render/react";
|
|
29
33
|
|
|
30
|
-
const
|
|
31
|
-
actor.start();
|
|
34
|
+
const { registry } = defineRegistry(catalog, { components: { ... } });
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
LoginForm: ({ error, send }) => <form onSubmit={(e) => {
|
|
36
|
-
e.preventDefault();
|
|
37
|
-
send({ type: "intent", name: "login.submit", payload: {...} });
|
|
38
|
-
}}>...</form>
|
|
39
|
-
};
|
|
36
|
+
// Uncontrolled — fresh atom created per view, seeded from spec.state:
|
|
37
|
+
<PlayRenderer actor={actor} registry={registry} actions={{ login: "auth.login" }} />
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
// Controlled — caller provides and owns the store:
|
|
40
|
+
import { createAtom } from "@xstate/store";
|
|
41
|
+
import { xstateStoreStateStore } from "@json-render/xstate";
|
|
42
|
+
const store = xstateStoreStateStore({ atom: createAtom({ username: "" }) });
|
|
43
|
+
<PlayRenderer actor={actor} registry={registry} store={store} actions={{ login: "auth.login" }} />
|
|
42
44
|
```
|
|
43
45
|
|
|
44
46
|
## Param
|
|
@@ -48,17 +50,3 @@ Component props
|
|
|
48
50
|
## Returns
|
|
49
51
|
|
|
50
52
|
React element rendering current view from actor
|
|
51
|
-
|
|
52
|
-
## Remarks
|
|
53
|
-
|
|
54
|
-
**Component lookup:** Dynamically looks up component from `components` map
|
|
55
|
-
using `view.component` string from actor.currentView signal.
|
|
56
|
-
|
|
57
|
-
**Event forwarding:** Injects `send` function as prop to components. Components
|
|
58
|
-
call `send(event)` to forward intents to actor. Actor guards decide validity.
|
|
59
|
-
|
|
60
|
-
**Error handling:** If component not found in catalog, logs error and shows
|
|
61
|
-
fallback. This indicates missing component registration, not runtime error.
|
|
62
|
-
|
|
63
|
-
**CRITICAL:** Never call actor.send() during render - only in event handlers.
|
|
64
|
-
Calling send during render causes infinite render loops.
|