@xmachines/play-dom 1.0.0-beta.27 → 1.0.0-beta.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @xmachines/play-dom
|
|
2
|
+
|
|
3
|
+
**Vanilla DOM renderer for XMachines**
|
|
4
|
+
|
|
5
|
+
`connectRenderer` — a framework-free `PlayRenderer` equivalent that wires an XState v5 actor's `currentView` TC39 Signal to pure DOM rendering via a catalog-typed `DomRegistry`.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @xmachines/play-dom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Key Exports
|
|
14
|
+
|
|
15
|
+
- `connectRenderer({ actor, registry, container })` — connect actor view signal to DOM
|
|
16
|
+
- `defineRegistry(catalog, { components, actions })` — build a catalog-typed `DomRegistry`
|
|
17
|
+
- `PlayRenderer` — class-based renderer (connect/disconnect lifecycle)
|
|
18
|
+
- `ComponentFn<C, K>` — catalog-typed DOM component function type
|
|
19
|
+
- `ComponentContext<C, K>` — context passed to each `ComponentFn` (props, emit, on, children, bindings)
|
|
20
|
+
- `renderSpec(spec, store, registry, send, actorActions)` — pure Spec → DOM renderer
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { definePlayer } from "@xmachines/play-xstate";
|
|
26
|
+
import { connectRenderer, defineRegistry } from "@xmachines/play-dom";
|
|
27
|
+
import { authMachine, authCatalog, type AuthCatalog } from "@xmachines/play-actor-shared";
|
|
28
|
+
import type { ComponentFn } from "@xmachines/play-dom";
|
|
29
|
+
|
|
30
|
+
const Home: ComponentFn<AuthCatalog, "Home"> = ({ props }) => {
|
|
31
|
+
const el = document.createElement("section");
|
|
32
|
+
el.textContent = props.title;
|
|
33
|
+
return el;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const { registry } = defineRegistry(authCatalog, {
|
|
37
|
+
components: { Home /* ... */ },
|
|
38
|
+
actions: { login: "auth.login", logout: "auth.logout" },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const createPlayer = definePlayer({ machine: authMachine });
|
|
42
|
+
const actor = createPlayer();
|
|
43
|
+
actor.start();
|
|
44
|
+
|
|
45
|
+
const container = document.getElementById("app")!;
|
|
46
|
+
const disconnect = connectRenderer({ actor, registry, container });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Learn More
|
|
50
|
+
|
|
51
|
+
- [DOM Router adapter `@xmachines/play-dom-router`](../play-dom-router/README.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmachines/play-dom",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.28",
|
|
4
4
|
"description": "Vanilla DOM renderer for XMachines Play architecture with signal-driven rendering",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"actor",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"prepublishOnly": "npm run build"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@xmachines/play": "1.0.0-beta.
|
|
47
|
-
"@xmachines/play-actor": "1.0.0-beta.
|
|
48
|
-
"@xmachines/play-signals": "1.0.0-beta.
|
|
46
|
+
"@xmachines/play": "1.0.0-beta.28",
|
|
47
|
+
"@xmachines/play-actor": "1.0.0-beta.28",
|
|
48
|
+
"@xmachines/play-signals": "1.0.0-beta.28"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@json-render/core": "^0.16.0",
|
|
52
52
|
"@json-render/xstate": "^0.16.0",
|
|
53
53
|
"@types/node": "^25.5.0",
|
|
54
|
-
"@xmachines/shared": "1.0.0-beta.
|
|
54
|
+
"@xmachines/shared": "1.0.0-beta.28",
|
|
55
55
|
"@xstate/store": ">=3.17.0",
|
|
56
56
|
"oxfmt": "^0.43.0",
|
|
57
57
|
"oxlint": "^1.57.0",
|