@xmachines/docs 1.0.0-beta.26 → 1.0.0-beta.27
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/classes/PlayError.md +4 -4
- package/api/@xmachines/play/type-aliases/PlayEvent.md +2 -2
- package/api/@xmachines/play-actor/classes/AbstractActor.md +3 -3
- package/api/@xmachines/play-actor/functions/typedSpec.md +1 -1
- package/api/@xmachines/play-actor/interfaces/PlaySpec.md +2 -2
- package/api/@xmachines/play-actor/interfaces/Routable.md +3 -3
- package/api/@xmachines/play-actor/interfaces/ViewMetadata.md +3 -3
- package/api/@xmachines/play-actor/interfaces/Viewable.md +2 -2
- package/api/@xmachines/play-dom/README.md +24 -8
- package/api/@xmachines/play-dom/classes/PlayRenderer.md +4 -4
- package/api/@xmachines/play-dom/functions/connectRenderer.md +1 -1
- package/api/@xmachines/play-dom/functions/defineRegistry.md +61 -0
- package/api/@xmachines/play-dom/functions/renderSpec.md +29 -12
- package/api/@xmachines/play-dom/interfaces/ComponentContext.md +62 -0
- package/api/@xmachines/play-dom/interfaces/ConnectRendererOptions.md +9 -9
- package/api/@xmachines/play-dom/interfaces/DefineRegistryOptions.md +25 -0
- package/api/@xmachines/play-dom/interfaces/DefineRegistryResult.md +18 -0
- package/api/@xmachines/play-dom/interfaces/DomRenderContext.md +13 -10
- package/api/@xmachines/play-dom/interfaces/EventHandle.md +29 -0
- package/api/@xmachines/play-dom/interfaces/PlayDomOptions.md +5 -5
- package/api/@xmachines/play-dom/type-aliases/ComponentFn.md +53 -0
- package/api/@xmachines/play-dom/type-aliases/ComponentRegistry.md +21 -0
- package/api/@xmachines/play-dom/type-aliases/DomComponentRenderer.md +16 -3
- package/api/@xmachines/play-dom/type-aliases/DomRegistry.md +5 -2
- package/api/@xmachines/play-dom-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createBrowserHistory.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-dom-router/functions/createRouter.md +1 -1
- package/api/@xmachines/play-dom-router/interfaces/BrowserHistory.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/BrowserWindow.md +14 -14
- package/api/@xmachines/play-dom-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-dom-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-dom-router/interfaces/RouteMap.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapLike.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-dom-router/interfaces/VanillaRouter.md +4 -4
- package/api/@xmachines/play-dom-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-dom-router-demo/README.md +46 -51
- package/api/@xmachines/play-react/classes/PlayErrorBoundary.md +5 -5
- package/api/@xmachines/play-react/functions/useActor.md +1 -1
- package/api/@xmachines/play-react/functions/useSignalEffect.md +1 -1
- 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 +7 -7
- package/api/@xmachines/play-react/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-react/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-react-router/classes/ReactRouterBridge.md +23 -23
- package/api/@xmachines/play-react-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-react-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-react-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-react-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-react-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-react-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/classes/BaseRouteMap.md +4 -4
- package/api/@xmachines/play-router/classes/RouterBridgeBase.md +23 -23
- package/api/@xmachines/play-router/functions/buildPlayRouteEvent.md +1 -1
- package/api/@xmachines/play-router/functions/buildRouteTree.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMapFromMachine.md +1 -1
- package/api/@xmachines/play-router/functions/createRouteMapFromTree.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/extractQuery.md +1 -1
- package/api/@xmachines/play-router/functions/extractRouteParams.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/getTransitionReachableRoutes.md +1 -1
- package/api/@xmachines/play-router/functions/isRouteReachable.md +1 -1
- package/api/@xmachines/play-router/functions/machineToGraph.md +1 -1
- package/api/@xmachines/play-router/functions/routeExists.md +1 -1
- package/api/@xmachines/play-router/functions/sanitizePathname.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/BuildPlayRouteEventOptions.md +4 -4
- package/api/@xmachines/play-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-router/interfaces/MachineEdgeData.md +3 -3
- package/api/@xmachines/play-router/interfaces/MachineNodeData.md +5 -5
- 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/RouteMapping.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouteMatch.md +3 -3
- 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 +5 -5
- package/api/@xmachines/play-router/interfaces/RouteWatcherHandle.md +3 -3
- package/api/@xmachines/play-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-router/type-aliases/MachineGraph.md +1 -1
- package/api/@xmachines/play-router/type-aliases/RouteMetadata.md +1 -1
- package/api/@xmachines/play-signals/functions/watchSignal.md +1 -1
- 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/type-aliases/WatcherNotify.md +1 -1
- package/api/@xmachines/play-solid/functions/useActor.md +1 -1
- package/api/@xmachines/play-solid/interfaces/PlayRendererProps.md +7 -7
- package/api/@xmachines/play-solid/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-solid/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-solid-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-solid-router/classes/SolidRouterBridge.md +24 -24
- package/api/@xmachines/play-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-solid-router/interfaces/AbstractActor.md +3 -3
- package/api/@xmachines/play-solid-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-solid-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-solid-router/type-aliases/SolidRouterHooks.md +4 -4
- package/api/@xmachines/play-solid-router-demo/README.md +25 -28
- package/api/@xmachines/play-svelte/interfaces/PlayRendererProps.md +7 -7
- package/api/@xmachines/play-svelte-spa-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-svelte-spa-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-svelte-spa-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-svelte-spa-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/interfaces/WindowLike.md +3 -3
- package/api/@xmachines/play-svelte-spa-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-svelte-spa-router-demo/README.md +119 -12
- package/api/@xmachines/play-sveltekit-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-sveltekit-router/functions/connectRouter.md +1 -1
- package/api/@xmachines/play-sveltekit-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-sveltekit-router/interfaces/ConnectRouterOptions.md +4 -4
- package/api/@xmachines/play-sveltekit-router/interfaces/LocationLike.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-sveltekit-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-sveltekit-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-sveltekit-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-sveltekit-router-demo/README.md +120 -12
- package/api/@xmachines/play-tanstack-react-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-tanstack-react-router/classes/TanStackReactRouterBridge.md +23 -23
- package/api/@xmachines/play-tanstack-react-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/createRouteMapFromTree.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/functions/extractMachineRoutes.md +1 -1
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-tanstack-react-router/interfaces/PlayRouterProviderProps.md +5 -5
- 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/interfaces/RouterBridge.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 +17 -3
- package/api/@xmachines/play-tanstack-react-router-demo/README.md +23 -29
- package/api/@xmachines/play-tanstack-solid-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-tanstack-solid-router/classes/SolidRouterBridge.md +24 -24
- package/api/@xmachines/play-tanstack-solid-router/functions/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-tanstack-solid-router/interfaces/PlayRouterProviderProps.md +5 -5
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-tanstack-solid-router/type-aliases/RoutableActor.md +1 -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 +3 -3
- package/api/@xmachines/play-tanstack-solid-router-demo/README.md +25 -26
- package/api/@xmachines/play-vue/functions/defineRegistry.md +1 -1
- package/api/@xmachines/play-vue/functions/useActor.md +1 -1
- package/api/@xmachines/play-vue/interfaces/PlayRendererProps.md +5 -5
- package/api/@xmachines/play-vue/type-aliases/ComponentEntry.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/ComponentsMap.md +1 -1
- package/api/@xmachines/play-vue/type-aliases/DefineRegistryOptions.md +4 -3
- package/api/@xmachines/play-vue/type-aliases/PlayActor.md +1 -1
- package/api/@xmachines/play-vue/variables/PlayRenderer.md +1 -1
- package/api/@xmachines/play-vue-router/classes/RouteMap.md +4 -4
- package/api/@xmachines/play-vue-router/classes/VueBaseRouteMap.md +4 -4
- package/api/@xmachines/play-vue-router/classes/VueRouterBridge.md +24 -24
- package/api/@xmachines/play-vue-router/functions/createRouteMap.md +1 -1
- package/api/@xmachines/play-vue-router/interfaces/PlayRouteEvent.md +6 -6
- package/api/@xmachines/play-vue-router/interfaces/RouteMapping.md +3 -3
- package/api/@xmachines/play-vue-router/interfaces/RouterBridge.md +3 -3
- package/api/@xmachines/play-vue-router/type-aliases/RoutableActor.md +1 -1
- package/api/@xmachines/play-vue-router/variables/PlayRouterProvider.md +1 -1
- package/api/@xmachines/play-vue-router-demo/README.md +47 -40
- package/api/@xmachines/play-xstate/classes/PlayerActor.md +11 -11
- package/api/@xmachines/play-xstate/functions/buildRouteUrl.md +1 -1
- 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/contextFieldMatches.md +1 -1
- package/api/@xmachines/play-xstate/functions/definePlayer.md +1 -1
- 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/interfaces/PlayerConfig.md +3 -3
- package/api/@xmachines/play-xstate/interfaces/PlayerFactoryResumeOptions.md +2 -2
- package/api/@xmachines/play-xstate/interfaces/PlayerOptions.md +6 -6
- 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 +1 -1
- package/api/@xmachines/play-xstate/type-aliases/RouteMachineConfig.md +4 -4
- package/api/@xmachines/play-xstate/type-aliases/RouteStateNode.md +4 -4
- package/api/@xmachines/shared/functions/defineXmVitestConfig.md +3 -7
- package/api/@xmachines/shared/functions/xmAliases.md +1 -1
- package/examples/README.md +48 -35
- package/examples/basic-state-machine.md +75 -31
- package/examples/form-validation.md +199 -127
- package/examples/multi-router-integration.md +312 -230
- package/examples/routing-patterns.md +243 -189
- package/examples/traffic-light.md +114 -65
- package/guides/README.md +29 -15
- package/guides/getting-started.md +224 -144
- package/guides/installation.md +153 -213
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: PlayError
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play/src/errors.ts:63](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play/src/errors.ts:63](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play/src/errors.ts#L63)
|
|
6
6
|
|
|
7
7
|
Base class for all typed runtime errors thrown by `@xmachines/*` packages.
|
|
8
8
|
|
|
@@ -82,7 +82,7 @@ new PlayError(
|
|
|
82
82
|
options?): PlayError;
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
Defined in: [packages/play/src/errors.ts:82](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
85
|
+
Defined in: [packages/play/src/errors.ts:82](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play/src/errors.ts#L82)
|
|
86
86
|
|
|
87
87
|
#### Parameters
|
|
88
88
|
|
|
@@ -108,10 +108,10 @@ Error.constructor;
|
|
|
108
108
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
109
109
|
| ------------------------------------------------------- | ---------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
110
110
|
| <a id="property-cause"></a> `cause?` | `public` | `unknown` | - | `Error.cause` | - |
|
|
111
|
-
| <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable error identifier. Error codes follow the `PLAY_<PACKAGE>_<DESCRIPTION>` naming convention and are guaranteed stable across patch and minor releases within a major version. Never match on `.message` — always match on `.code` or the subclass. | - | [packages/play/src/errors.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
111
|
+
| <a id="property-code"></a> `code` | `readonly` | `string` | A stable, machine-readable error identifier. Error codes follow the `PLAY_<PACKAGE>_<DESCRIPTION>` naming convention and are guaranteed stable across patch and minor releases within a major version. Never match on `.message` — always match on `.code` or the subclass. | - | [packages/play/src/errors.ts:74](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play/src/errors.ts#L74) |
|
|
112
112
|
| <a id="property-message"></a> `message` | `public` | `string` | - | `Error.message` | - |
|
|
113
113
|
| <a id="property-name"></a> `name` | `public` | `string` | - | `Error.name` | - |
|
|
114
|
-
| <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or module that threw this error (e.g. `"RouterBridgeBase"`). | - | [packages/play/src/errors.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
114
|
+
| <a id="property-scope"></a> `scope` | `readonly` | `string` | The class or module that threw this error (e.g. `"RouterBridgeBase"`). | - | [packages/play/src/errors.ts:65](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play/src/errors.ts#L65) |
|
|
115
115
|
| <a id="property-stack"></a> `stack?` | `public` | `string` | - | `Error.stack` | - |
|
|
116
116
|
| <a id="property-stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | - |
|
|
117
117
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
type PlayEvent<TPayload> = object & TPayload;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play/src/types.ts:69](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play/src/types.ts:69](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play/src/types.ts#L69)
|
|
10
10
|
|
|
11
11
|
Generic event type for Play Architecture
|
|
12
12
|
|
|
@@ -34,7 +34,7 @@ Robot, and other state machine libraries.
|
|
|
34
34
|
|
|
35
35
|
| Name | Type | Defined in |
|
|
36
36
|
| ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
37
|
-
| `type` | `string` | [packages/play/src/types.ts:70](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
37
|
+
| `type` | `string` | [packages/play/src/types.ts:70](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play/src/types.ts#L70) |
|
|
38
38
|
|
|
39
39
|
## Type Parameters
|
|
40
40
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Abstract Class: AbstractActor\<TLogic, TEvent\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:141](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:141](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L141)
|
|
6
6
|
|
|
7
7
|
Abstract base class for Play Architecture actors.
|
|
8
8
|
|
|
@@ -67,7 +67,7 @@ Actor<TLogic>.constructor
|
|
|
67
67
|
| <a id="property-ref"></a> `ref` | `public` | [`ActorRef`](https://www.jsdocs.io/package/xstate#ActorRef)\<[`SnapshotFrom`](https://www.jsdocs.io/package/xstate#SnapshotFrom)\<`TLogic`\>, [`EventFromLogic`](https://www.jsdocs.io/package/xstate#EventFromLogic)\<`TLogic`\>, [`EmittedFrom`](https://www.jsdocs.io/package/xstate#EmittedFrom)\<`TLogic`\>\> | - | `Actor.ref` | - |
|
|
68
68
|
| <a id="property-sessionid"></a> `sessionId` | `public` | `string` | The globally unique process ID for this invocation. | `Actor.sessionId` | - |
|
|
69
69
|
| <a id="property-src"></a> `src` | `public` | \| `string` \| [`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic) | - | `Actor.src` | - |
|
|
70
|
-
| <a id="property-state"></a> `state` | `abstract` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<`unknown`\> | Reactive snapshot of current actor state. Infrastructure observes this signal to react to state changes without directly coupling to the actor's internal state machine implementation. | - | [packages/play-actor/src/abstract-actor.ts:151](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
70
|
+
| <a id="property-state"></a> `state` | `abstract` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<`unknown`\> | Reactive snapshot of current actor state. Infrastructure observes this signal to react to state changes without directly coupling to the actor's internal state machine implementation. | - | [packages/play-actor/src/abstract-actor.ts:151](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L151) |
|
|
71
71
|
| <a id="property-system"></a> `system` | `public` | [`AnyActorSystem`](https://www.jsdocs.io/package/xstate#AnyActorSystem) | The system to which this actor belongs. | `Actor.system` | - |
|
|
72
72
|
| <a id="property-systemid"></a> `systemId` | `public` | `string` \| `undefined` | - | `Actor.systemId` | - |
|
|
73
73
|
|
|
@@ -238,7 +238,7 @@ Actor.select;
|
|
|
238
238
|
abstract send(event): void;
|
|
239
239
|
```
|
|
240
240
|
|
|
241
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:158](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
241
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:158](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L158)
|
|
242
242
|
|
|
243
243
|
Send event to Actor.
|
|
244
244
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function typedSpec<TContext>(spec): PlaySpec;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:86](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:86](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L86)
|
|
10
10
|
|
|
11
11
|
Identity helper that constrains a `PlaySpec` object's `contextProps` to keys
|
|
12
12
|
of a specific machine context type, giving compile-time validation and IDE
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: PlaySpec
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L43)
|
|
6
6
|
|
|
7
7
|
XMachines extension of `@json-render/core` `Spec`.
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ entries against your machine's context type at compile time.
|
|
|
22
22
|
|
|
23
23
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
24
24
|
| -------------------------------------------------- | ---------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
-
| <a id="property-contextprops"></a> `contextProps?` | `readonly` | readonly `string`[] | Explicit allowlist of machine context field names to expose as prop slots. Each named field is merged into every spec element's `props` at view derivation time, filling any slot whose current value is `undefined`. Use `typedSpec<TContext>(...)` to constrain entries to `keyof TContext & string`. | - | [packages/play-actor/src/abstract-actor.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
25
|
+
| <a id="property-contextprops"></a> `contextProps?` | `readonly` | readonly `string`[] | Explicit allowlist of machine context field names to expose as prop slots. Each named field is merged into every spec element's `props` at view derivation time, filling any slot whose current value is `undefined`. Use `typedSpec<TContext>(...)` to constrain entries to `keyof TContext & string`. | - | [packages/play-actor/src/abstract-actor.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L51) |
|
|
26
26
|
| <a id="property-elements"></a> `elements` | `public` | `Record`\<`string`, `UIElement`\> | Flat map of elements by key | `Spec.elements` | - |
|
|
27
27
|
| <a id="property-root"></a> `root` | `public` | `string` | Root element key | `Spec.root` | - |
|
|
28
28
|
| <a id="property-state"></a> `state?` | `public` | `Record`\<`string`, `unknown`\> | Optional initial state to seed the state model. Components using statePath will read from / write to this state. | `Spec.state` | - |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: Routable
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:27](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:27](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L27)
|
|
6
6
|
|
|
7
7
|
Optional capability: Routing support
|
|
8
8
|
|
|
@@ -10,5 +10,5 @@ Optional capability: Routing support
|
|
|
10
10
|
|
|
11
11
|
| Property | Modifier | Type | Defined in |
|
|
12
12
|
| ------------------------------------------------- | ---------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
-
| <a id="property-currentroute"></a> `currentRoute` | `readonly` | [`Computed`](../../play-signals/namespaces/Signal/classes/Computed.md)\<`string` \| `null`\> | [packages/play-actor/src/abstract-actor.ts:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
14
|
-
| <a id="property-initialroute"></a> `initialRoute` | `readonly` | `string` \| `null` | [packages/play-actor/src/abstract-actor.ts:29](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
13
|
+
| <a id="property-currentroute"></a> `currentRoute` | `readonly` | [`Computed`](../../play-signals/namespaces/Signal/classes/Computed.md)\<`string` \| `null`\> | [packages/play-actor/src/abstract-actor.ts:28](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L28) |
|
|
14
|
+
| <a id="property-initialroute"></a> `initialRoute` | `readonly` | `string` \| `null` | [packages/play-actor/src/abstract-actor.ts:29](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L29) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: ViewMetadata
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:100](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:100](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L100)
|
|
6
6
|
|
|
7
7
|
View metadata for rendering.
|
|
8
8
|
|
|
@@ -13,5 +13,5 @@ Used by PlayRenderer to dynamically render UI based on actor state.
|
|
|
13
13
|
|
|
14
14
|
| Property | Type | Description | Defined in |
|
|
15
15
|
| ------------------------------------------- | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
-
| <a id="property-component"></a> `component` | `string` | Root element type name (for diagnostics and component resolution) | [packages/play-actor/src/abstract-actor.ts:102](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
17
|
-
| <a id="property-spec"></a> `spec` | [`PlaySpec`](PlaySpec.md) | XMachines view spec — extends `@json-render/core` Spec with `contextProps` for explicit context field exposure. Use `typedSpec<TContext>(...)` at the definition site to validate `contextProps` entries against the machine context type. | [packages/play-actor/src/abstract-actor.ts:110](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
16
|
+
| <a id="property-component"></a> `component` | `string` | Root element type name (for diagnostics and component resolution) | [packages/play-actor/src/abstract-actor.ts:102](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L102) |
|
|
17
|
+
| <a id="property-spec"></a> `spec` | [`PlaySpec`](PlaySpec.md) | XMachines view spec — extends `@json-render/core` Spec with `contextProps` for explicit context field exposure. Use `typedSpec<TContext>(...)` at the definition site to validate `contextProps` entries against the machine context type. | [packages/play-actor/src/abstract-actor.ts:110](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L110) |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: Viewable
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/play-actor/src/abstract-actor.ts:121](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
5
|
+
Defined in: [packages/play-actor/src/abstract-actor.ts:121](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L121)
|
|
6
6
|
|
|
7
7
|
Actor capability for exposing renderable view state.
|
|
8
8
|
|
|
@@ -15,4 +15,4 @@ framework adapter.
|
|
|
15
15
|
|
|
16
16
|
| Property | Modifier | Type | Description | Defined in |
|
|
17
17
|
| ----------------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
18
|
-
| <a id="property-currentview"></a> `currentView` | `readonly` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<[`ViewMetadata`](ViewMetadata.md) \| `null`\> | Current view signal. State signal containing view.component and view.spec from meta.view. Infrastructure renders view — Logic-Driven UI invariant. | [packages/play-actor/src/abstract-actor.ts:128](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
18
|
+
| <a id="property-currentview"></a> `currentView` | `readonly` | [`State`](../../play-signals/namespaces/Signal/classes/State.md)\<[`ViewMetadata`](ViewMetadata.md) \| `null`\> | Current view signal. State signal containing view.component and view.spec from meta.view. Infrastructure renders view — Logic-Driven UI invariant. | [packages/play-actor/src/abstract-actor.ts:128](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-actor/src/abstract-actor.ts#L128) |
|
|
@@ -2,18 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
# @xmachines/play-dom
|
|
4
4
|
|
|
5
|
-
@xmachines/play-dom
|
|
5
|
+
@xmachines/play-dom — Vanilla DOM renderer for XMachines Play architecture.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Public API split into two layers:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
Zero XMachines dependencies. Upstreamable to @json-render/dom.
|
|
11
|
-
- Outer layer (PlayRenderer): XMachines wrapper. Bridges actor.currentView
|
|
12
|
-
(TC39 Signal) to the inner DOM renderer using watchSignal.
|
|
9
|
+
**XMachines layer** (this package):
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
- `PlayRenderer` — connects actor.currentView signal → DOM renderer
|
|
12
|
+
- `connectRenderer()` — backward-compat functional API
|
|
13
|
+
- `ConnectRendererOptions`, `PlayDomOptions`
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
**json-render layer** (upstreamable to @json-render/dom):
|
|
16
|
+
|
|
17
|
+
- `defineRegistry` — build a catalog-typed DomRegistry
|
|
18
|
+
- `renderSpec` — pure Spec → DOM renderer (uses resolveElementProps from core)
|
|
19
|
+
- `ComponentFn` — catalog-typed component function type
|
|
20
|
+
- `ComponentContext` — catalog-typed render context (props, emit, on, children, bindings)
|
|
21
|
+
- `ComponentRegistry` — catalog-typed registry input type
|
|
22
|
+
- `DomComponentRenderer` — raw element-level renderer type
|
|
23
|
+
- `DomRegistry` — raw registry type
|
|
24
|
+
- `DomRenderContext` — raw render context
|
|
25
|
+
- `EventHandle` — event handle returned by on()
|
|
17
26
|
|
|
18
27
|
## Classes
|
|
19
28
|
|
|
@@ -21,16 +30,23 @@ No framework required. Pure DOM APIs only.
|
|
|
21
30
|
|
|
22
31
|
## Interfaces
|
|
23
32
|
|
|
33
|
+
- [ComponentContext](interfaces/ComponentContext.md)
|
|
24
34
|
- [ConnectRendererOptions](interfaces/ConnectRendererOptions.md)
|
|
35
|
+
- [DefineRegistryOptions](interfaces/DefineRegistryOptions.md)
|
|
36
|
+
- [DefineRegistryResult](interfaces/DefineRegistryResult.md)
|
|
25
37
|
- [DomRenderContext](interfaces/DomRenderContext.md)
|
|
38
|
+
- [EventHandle](interfaces/EventHandle.md)
|
|
26
39
|
- [PlayDomOptions](interfaces/PlayDomOptions.md)
|
|
27
40
|
|
|
28
41
|
## Type Aliases
|
|
29
42
|
|
|
43
|
+
- [ComponentFn](type-aliases/ComponentFn.md)
|
|
44
|
+
- [ComponentRegistry](type-aliases/ComponentRegistry.md)
|
|
30
45
|
- [DomComponentRenderer](type-aliases/DomComponentRenderer.md)
|
|
31
46
|
- [DomRegistry](type-aliases/DomRegistry.md)
|
|
32
47
|
|
|
33
48
|
## Functions
|
|
34
49
|
|
|
35
50
|
- [connectRenderer](functions/connectRenderer.md)
|
|
51
|
+
- [defineRegistry](functions/defineRegistry.md)
|
|
36
52
|
- [renderSpec](functions/renderSpec.md)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Class: PlayRenderer
|
|
4
4
|
|
|
5
|
-
Defined in: [PlayRenderer.ts:
|
|
5
|
+
Defined in: [PlayRenderer.ts:40](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/PlayRenderer.ts#L40)
|
|
6
6
|
|
|
7
7
|
PlayRenderer connects an actor's currentView signal to the DOM renderer.
|
|
8
8
|
|
|
@@ -34,7 +34,7 @@ new PlayRenderer(
|
|
|
34
34
|
options?): PlayRenderer;
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Defined in: [PlayRenderer.ts:
|
|
37
|
+
Defined in: [PlayRenderer.ts:52](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/PlayRenderer.ts#L52)
|
|
38
38
|
|
|
39
39
|
#### Parameters
|
|
40
40
|
|
|
@@ -57,7 +57,7 @@ Defined in: [PlayRenderer.ts:51](https://gitlab.com/xmachin-es/xmachines-js/-/bl
|
|
|
57
57
|
connect(): void;
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
Defined in: [PlayRenderer.ts:
|
|
60
|
+
Defined in: [PlayRenderer.ts:63](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/PlayRenderer.ts#L63)
|
|
61
61
|
|
|
62
62
|
Start watching actor.currentView and render to container.
|
|
63
63
|
Renders the initial view synchronously, then subscribes to signal changes.
|
|
@@ -74,7 +74,7 @@ Renders the initial view synchronously, then subscribes to signal changes.
|
|
|
74
74
|
disconnect(): void;
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
Defined in: [PlayRenderer.ts:
|
|
77
|
+
Defined in: [PlayRenderer.ts:71](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/PlayRenderer.ts#L71)
|
|
78
78
|
|
|
79
79
|
Stop watching and clear the container.
|
|
80
80
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
function connectRenderer(options): () => void;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [connect-renderer.ts:46](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.
|
|
9
|
+
Defined in: [connect-renderer.ts:46](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/connect-renderer.ts#L46)
|
|
10
10
|
|
|
11
11
|
Connect a signal-driven DOM renderer to an actor's currentView signal.
|
|
12
12
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-dom](../README.md) / defineRegistry
|
|
2
|
+
|
|
3
|
+
# Function: defineRegistry()
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
function defineRegistry<C>(_catalog, options): DefineRegistryResult;
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Defined in: [json-render/types.ts:351](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L351)
|
|
10
|
+
|
|
11
|
+
Build a `DomRegistry` from a catalog and component/action options.
|
|
12
|
+
|
|
13
|
+
Mirrors the `defineRegistry(catalog, options)` API from @json-render/react,
|
|
14
|
+
/solid, /svelte, /vue. The catalog parameter is used for TypeScript inference
|
|
15
|
+
only (the same as in the framework renderers — it is not used at runtime).
|
|
16
|
+
|
|
17
|
+
Each component in `options.components` is wrapped in a `DomComponentRenderer`
|
|
18
|
+
adapter that:
|
|
19
|
+
|
|
20
|
+
- Resolves props and two-way binding paths via `@json-render/core`
|
|
21
|
+
- Builds `emit(event)` and `on(event)` closures over the element's `on` map
|
|
22
|
+
- Renders child elements via `ctx.renderChildren`
|
|
23
|
+
- Passes the assembled `ComponentContext` to your `ComponentFn`
|
|
24
|
+
|
|
25
|
+
The `actions` map is passed through as `actorActions` so the caller does not
|
|
26
|
+
need to manage it separately.
|
|
27
|
+
|
|
28
|
+
## Type Parameters
|
|
29
|
+
|
|
30
|
+
| Type Parameter |
|
|
31
|
+
| ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
32
|
+
| `C` _extends_ `Catalog`\<`SchemaDefinition`\<`SchemaType`\<`string`, `unknown`\>, `SchemaType`\<`string`, `unknown`\>\>, `unknown`\> |
|
|
33
|
+
|
|
34
|
+
## Parameters
|
|
35
|
+
|
|
36
|
+
| Parameter | Type |
|
|
37
|
+
| ---------- | ------------------------------------------------------------------------ |
|
|
38
|
+
| `_catalog` | `C` |
|
|
39
|
+
| `options` | [`DefineRegistryOptions`](../interfaces/DefineRegistryOptions.md)\<`C`\> |
|
|
40
|
+
|
|
41
|
+
## Returns
|
|
42
|
+
|
|
43
|
+
[`DefineRegistryResult`](../interfaces/DefineRegistryResult.md)
|
|
44
|
+
|
|
45
|
+
## Example
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { defineRegistry } from "@xmachines/play-dom";
|
|
49
|
+
import { authCatalog } from "@xmachines/play-actor-shared";
|
|
50
|
+
import { Home, Login, Dashboard } from "./components/index.js";
|
|
51
|
+
|
|
52
|
+
const { registry, actorActions } = defineRegistry(authCatalog, {
|
|
53
|
+
components: { Home, Login, Dashboard, ... },
|
|
54
|
+
actions: {
|
|
55
|
+
login: "auth.login",
|
|
56
|
+
logout: "auth.logout",
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
connectRenderer({ actor, registry, container, actions: actorActions });
|
|
61
|
+
```
|
|
@@ -3,26 +3,43 @@
|
|
|
3
3
|
# Function: renderSpec()
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
|
-
function renderSpec(spec, store, registry, send,
|
|
6
|
+
function renderSpec(spec, store, registry, send, actorActions): Node | null;
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
Defined in: [
|
|
9
|
+
Defined in: [json-render/renderer.ts:54](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/renderer.ts#L54)
|
|
10
10
|
|
|
11
|
-
Render a Spec tree into DOM nodes using the provided DomRegistry
|
|
11
|
+
Render a Spec tree into DOM nodes using the provided `DomRegistry`.
|
|
12
|
+
|
|
13
|
+
Traverses the spec from `spec.root`, evaluates visibility, resolves all prop
|
|
14
|
+
expressions (including `$state`, `$bindState`, `$computed`, `$template`, etc.),
|
|
15
|
+
and calls the matching `DomComponentRenderer` for each visible element.
|
|
16
|
+
|
|
17
|
+
Event wiring and child rendering are handled inside the component wrapper
|
|
18
|
+
built by `defineRegistry` — this function only orchestrates the traversal.
|
|
12
19
|
|
|
13
20
|
## Parameters
|
|
14
21
|
|
|
15
|
-
| Parameter | Type
|
|
16
|
-
| -------------- |
|
|
17
|
-
| `spec` | `Spec`
|
|
18
|
-
| `store` | `StateStore`
|
|
19
|
-
| `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md)
|
|
20
|
-
| `send` | (`event`) => `void`
|
|
21
|
-
| `
|
|
22
|
-
| `actorActions` | `Record`\<`string`, `string`\> | Map of json-render action names → XState event types |
|
|
22
|
+
| Parameter | Type | Description |
|
|
23
|
+
| -------------- | ----------------------------------------------- | ---------------------------------------------------- |
|
|
24
|
+
| `spec` | `Spec` | The json-render `Spec` describing the UI tree. |
|
|
25
|
+
| `store` | `StateStore` | Live `StateStore` bound to `spec.state`. |
|
|
26
|
+
| `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md) | Map of element type names → `DomComponentRenderer`. |
|
|
27
|
+
| `send` | (`event`) => `void` | Dispatcher for interaction events (e.g. actor.send). |
|
|
28
|
+
| `actorActions` | `Record`\<`string`, `string`\> | Map of catalog action names → event type strings. |
|
|
23
29
|
|
|
24
30
|
## Returns
|
|
25
31
|
|
|
26
32
|
`Node` \| `null`
|
|
27
33
|
|
|
28
|
-
The root DOM
|
|
34
|
+
The root DOM `Node`, or `null` if the root is invisible
|
|
35
|
+
or has no registered renderer.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
const node = renderSpec(spec, store, registry, actor.send.bind(actor), {
|
|
41
|
+
login: "auth.login",
|
|
42
|
+
logout: "auth.logout",
|
|
43
|
+
});
|
|
44
|
+
if (node) container.appendChild(node);
|
|
45
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-dom](../README.md) / ComponentContext
|
|
2
|
+
|
|
3
|
+
# Interface: ComponentContext\<C, K\>
|
|
4
|
+
|
|
5
|
+
Defined in: [json-render/types.ts:152](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L152)
|
|
6
|
+
|
|
7
|
+
Catalog-typed context passed to each DOM component function.
|
|
8
|
+
|
|
9
|
+
Mirrors the `ComponentContext<C, K>` shape from @json-render/react, /solid,
|
|
10
|
+
/svelte, /vue with three DOM-specific adaptations:
|
|
11
|
+
|
|
12
|
+
- `children` is `Node[]` instead of a framework node/snippet/slot
|
|
13
|
+
- `bindings` is `Record<string, string> | undefined` (path strings for DOM
|
|
14
|
+
consumers that implement their own two-way binding, e.g. input value ↔ store)
|
|
15
|
+
- `ctx` (low-level `DomRenderContext`) is exposed for advanced use cases
|
|
16
|
+
(framework renderers do not expose this)
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
const Login: ComponentFn<AuthCatalog, "Login"> = ({ props, emit, on, bindings }) => {
|
|
22
|
+
const section = document.createElement("section");
|
|
23
|
+
|
|
24
|
+
const input = document.createElement("input");
|
|
25
|
+
input.value = props.username ?? "";
|
|
26
|
+
|
|
27
|
+
// Two-way binding: write back to state store when input changes
|
|
28
|
+
if (bindings?.username) {
|
|
29
|
+
input.addEventListener("input", () => {
|
|
30
|
+
// bindings.username contains the store path e.g. "/username"
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const btn = document.createElement("button");
|
|
35
|
+
const handle = on("submit");
|
|
36
|
+
btn.addEventListener("click", (e) => {
|
|
37
|
+
if (handle.shouldPreventDefault) e.preventDefault();
|
|
38
|
+
handle.emit();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
section.append(input, btn);
|
|
42
|
+
return section;
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Type Parameters
|
|
47
|
+
|
|
48
|
+
| Type Parameter |
|
|
49
|
+
| --------------------------------------------------- |
|
|
50
|
+
| `C` _extends_ `Catalog` |
|
|
51
|
+
| `K` _extends_ keyof `InferCatalogComponents`\<`C`\> |
|
|
52
|
+
|
|
53
|
+
## Properties
|
|
54
|
+
|
|
55
|
+
| Property | Type | Description | Defined in |
|
|
56
|
+
| ----------------------------------------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
57
|
+
| <a id="property-bindings"></a> `bindings` | `Record`\<`string`, `string`\> \| `undefined` | Two-way binding paths resolved from `$bindState` / `$bindItem` prop expressions. Keys match prop names that had `$bindState`/`$bindItem` expressions in the spec; values are the absolute state-store paths to write back to on user input. `undefined` when no bindings were found for this element. | [json-render/types.ts:168](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L168) |
|
|
58
|
+
| <a id="property-children"></a> `children` | `Node`[] | Rendered child nodes from the spec's `children` list. Append these into the returned element where children should appear. | [json-render/types.ts:159](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L159) |
|
|
59
|
+
| <a id="property-ctx"></a> `ctx` | [`DomRenderContext`](DomRenderContext.md) | Low-level render context. Exposes `send`, `store`, `actorActions`, and `renderChildren` for advanced use cases. Framework renderers do not expose this field — prefer `emit`/`on` for event dispatch and `children` for child rendering. | [json-render/types.ts:206](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L206) |
|
|
60
|
+
| <a id="property-emit"></a> `emit` | (`event`) => `void` | Dispatch a named event defined in the spec's `on` map. Resolves the catalog action binding, applies param expressions against the current state store, and calls `send()` with the mapped XState event type. **Example** `btn.addEventListener("click", () => emit("submit"));` | [json-render/types.ts:180](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L180) |
|
|
61
|
+
| <a id="property-on"></a> `on` | (`event`) => [`EventHandle`](EventHandle.md) | Get an `EventHandle` for a named event from the spec's `on` map. Use when you need `shouldPreventDefault` or want to check whether an `on` binding exists before attaching a listener. **Example** `const handle = on("submit"); if (handle.bound) { form.addEventListener("submit", (e) => { if (handle.shouldPreventDefault) e.preventDefault(); handle.emit(); }); }` | [json-render/types.ts:198](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L198) |
|
|
62
|
+
| <a id="property-props"></a> `props` | `InferComponentProps`\<`C`, `K`\> | Catalog-typed, store-resolved props for this component. | [json-render/types.ts:154](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L154) |
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: ConnectRendererOptions
|
|
4
4
|
|
|
5
|
-
Defined in: [types.ts:
|
|
5
|
+
Defined in: [xm-types.ts:35](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/xm-types.ts#L35)
|
|
6
6
|
|
|
7
7
|
Options for connectRenderer() — backward compat API.
|
|
8
8
|
|
|
9
9
|
## Properties
|
|
10
10
|
|
|
11
|
-
| Property | Type | Description | Defined in
|
|
12
|
-
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
-
| <a id="property-actions"></a> `actions?` | `Record`\<`string`, `string`\> | Map of json-render actionName → XState event type | [types.ts:
|
|
14
|
-
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](../../play-actor/interfaces/Viewable.md) | Actor instance with currentView signal (requires Viewable capability) | [types.ts:
|
|
15
|
-
| <a id="property-container"></a> `container` | `HTMLElement` | Container element to render into | [types.ts:
|
|
16
|
-
| <a id="property-fallback"></a> `fallback?` | `HTMLElement` \| `null` | Optional element shown when currentView is null (defaults to nothing — clears container) | [types.ts:
|
|
17
|
-
| <a id="property-registry"></a> `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md) | Registry of component renderers — replaces old `components` map | [types.ts:
|
|
18
|
-
| <a id="property-store"></a> `store?` | `StateStore` | Optional external StateStore (e.g. from `xstateStoreStateStore` in @json-render/xstate). When provided, PlayRenderer operates in controlled mode — spec.state is ignored. When omitted, a fresh @xstate/store atom is created internally per view transition. | [types.ts:
|
|
11
|
+
| Property | Type | Description | Defined in |
|
|
12
|
+
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
13
|
+
| <a id="property-actions"></a> `actions?` | `Record`\<`string`, `string`\> | Map of json-render actionName → XState event type | [xm-types.ts:49](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/xm-types.ts#L49) |
|
|
14
|
+
| <a id="property-actor"></a> `actor` | [`AbstractActor`](../../play-actor/classes/AbstractActor.md)\<[`AnyActorLogic`](https://www.jsdocs.io/package/xstate#AnyActorLogic), [`EventObject`](https://www.jsdocs.io/package/xstate#EventObject)\> & [`Viewable`](../../play-actor/interfaces/Viewable.md) | Actor instance with currentView signal (requires Viewable capability) | [xm-types.ts:37](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/xm-types.ts#L37) |
|
|
15
|
+
| <a id="property-container"></a> `container` | `HTMLElement` | Container element to render into | [xm-types.ts:43](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/xm-types.ts#L43) |
|
|
16
|
+
| <a id="property-fallback"></a> `fallback?` | `HTMLElement` \| `null` | Optional element shown when currentView is null (defaults to nothing — clears container) | [xm-types.ts:46](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/xm-types.ts#L46) |
|
|
17
|
+
| <a id="property-registry"></a> `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md) | Registry of component renderers — replaces old `components` map | [xm-types.ts:40](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/xm-types.ts#L40) |
|
|
18
|
+
| <a id="property-store"></a> `store?` | `StateStore` | Optional external StateStore (e.g. from `xstateStoreStateStore` in @json-render/xstate). When provided, PlayRenderer operates in controlled mode — spec.state is ignored. When omitted, a fresh @xstate/store atom is created internally per view transition. | [xm-types.ts:56](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/xm-types.ts#L56) |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-dom](../README.md) / DefineRegistryOptions
|
|
2
|
+
|
|
3
|
+
# Interface: DefineRegistryOptions\<C\>
|
|
4
|
+
|
|
5
|
+
Defined in: [json-render/types.ts:275](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L275)
|
|
6
|
+
|
|
7
|
+
Options for `defineRegistry`.
|
|
8
|
+
|
|
9
|
+
Mirrors `DefineRegistryOptions<C>` from @json-render/react, /solid, /svelte, /vue
|
|
10
|
+
with one intentional difference: `actions` is a `Record<string, string>` event-type
|
|
11
|
+
map rather than async handler functions, because the DOM renderer dispatches events
|
|
12
|
+
directly via `send()` to an XState actor instead of calling framework action handlers.
|
|
13
|
+
|
|
14
|
+
## Type Parameters
|
|
15
|
+
|
|
16
|
+
| Type Parameter |
|
|
17
|
+
| ----------------------- |
|
|
18
|
+
| `C` _extends_ `Catalog` |
|
|
19
|
+
|
|
20
|
+
## Properties
|
|
21
|
+
|
|
22
|
+
| Property | Type | Description | Defined in |
|
|
23
|
+
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
24
|
+
| <a id="property-actions"></a> `actions?` | `InferCatalogActions`\<`C`\> _extends_ `Record`\<`string`, `never`\> ? `Record`\<`string`, `string`\> : `Record`\<keyof `InferCatalogActions`\<`C`\>, `string`\> | Map of catalog action name → XState event type string. When a spec element fires `emit("login")`, the DOM renderer looks up `actions.login` (e.g. `"auth.login"`) and calls `send({ type: "auth.login", ...params })`. In the framework renderers this field holds async handler functions. In the DOM renderer it is a simpler string map because routing to the actor is handled by the XMachines play-dom layer rather than inside the json-render action system. | [json-render/types.ts:291](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L291) |
|
|
25
|
+
| <a id="property-components"></a> `components?` | [`ComponentRegistry`](../type-aliases/ComponentRegistry.md)\<`C`\> | Catalog-typed component implementations. Each key must match a component declared in the catalog. | [json-render/types.ts:280](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L280) |
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[Documentation](../../../README.md) / [@xmachines/play-dom](../README.md) / DefineRegistryResult
|
|
2
|
+
|
|
3
|
+
# Interface: DefineRegistryResult
|
|
4
|
+
|
|
5
|
+
Defined in: [json-render/types.ts:303](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L303)
|
|
6
|
+
|
|
7
|
+
Result returned by `defineRegistry`.
|
|
8
|
+
|
|
9
|
+
Mirrors the `{ registry }` field from @json-render/react, /solid, /svelte, /vue.
|
|
10
|
+
The DOM result also exposes `actorActions` — the resolved event-type map — so
|
|
11
|
+
callers can pass it directly to `connectRenderer` or `PlayRenderer`.
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
| Property | Type | Description | Defined in |
|
|
16
|
+
| ------------------------------------------------- | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| <a id="property-actoractions"></a> `actorActions` | `Record`\<`string`, `string`\> | Resolved map of catalog action name → XState event type string. Pass to `connectRenderer({ ..., actions: actorActions })` or `new PlayRenderer(container, actor, registry, { actions: actorActions })`. | [json-render/types.ts:314](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L314) |
|
|
18
|
+
| <a id="property-registry"></a> `registry` | [`DomRegistry`](../type-aliases/DomRegistry.md) | The built `DomRegistry`, ready to pass to `connectRenderer` or `PlayRenderer`. | [json-render/types.ts:307](https://gitlab.com/xmachin-es/xmachines-js/-/blob/v1.0.0-beta.27/packages/play-dom/src/json-render/types.ts#L307) |
|