@xmachines/play-actor 6.0.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/index.js +0 -22
- package/package.json +8 -8
- package/dist/index.js.map +0 -1
- package/dist/play-actor.js +0 -28
- package/dist/play-actor.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The actor contract of the XMachines Play Architecture. It names no state machine library.
|
|
4
4
|
|
|
5
|
-
[](https://opensource.org/licenses/MIT) [](https://opensource.org/licenses/MIT) [](https://www.npmjs.com/package/@xmachines/play-actor)
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -78,6 +78,13 @@ const value: string = actor.state.get().value;
|
|
|
78
78
|
A plain object satisfies the contract as well. Nothing here asks for a class.
|
|
79
79
|
|
|
80
80
|
```ts
|
|
81
|
+
import type { PlayActor } from "@xmachines/play-actor";
|
|
82
|
+
import { createAtom } from "@xmachines/play-atom";
|
|
83
|
+
|
|
84
|
+
type Snapshot = { readonly value: string };
|
|
85
|
+
type AuthEvent =
|
|
86
|
+
{ readonly type: "auth.login"; readonly username: string } | { readonly type: "auth.logout" };
|
|
87
|
+
|
|
81
88
|
const actor: PlayActor<Snapshot, AuthEvent> = {
|
|
82
89
|
state: createAtom<Snapshot>({ value: "guest" }),
|
|
83
90
|
send: () => {},
|
|
@@ -98,6 +105,7 @@ actor class of its own engine, and the contract stays out of the inheritance.
|
|
|
98
105
|
```ts
|
|
99
106
|
import type { PlayActor } from "@xmachines/play-actor";
|
|
100
107
|
import type { Routable } from "@xmachines/play-router";
|
|
108
|
+
import { createAtom } from "@xmachines/play-atom";
|
|
101
109
|
import { Actor, type AnyActorLogic } from "xstate";
|
|
102
110
|
|
|
103
111
|
class MyRoutableActor
|
package/dist/index.js
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @xmachines/play-actor - the actor contract of the Play Architecture
|
|
3
|
-
*
|
|
4
|
-
* The contract is minimal, and it names no engine: `state` and `send`. A state machine
|
|
5
|
-
* library is the concern of an adapter, and `@xmachines/play-xstate` is the adapter of
|
|
6
|
-
* XState v5.
|
|
7
|
-
*
|
|
8
|
-
* A capability is optional, and each one lives with the package that holds its shared
|
|
9
|
-
* machinery:
|
|
10
|
-
* - `Routable`, for an actor with a routing support, is in `@xmachines/play-router`, with
|
|
11
|
-
* the bridge that reads it
|
|
12
|
-
* - `Viewable`, for an actor with a view rendering, is in `@xmachines/play-view`, with the
|
|
13
|
-
* view store lifecycle, the context projection and the provider guards
|
|
14
|
-
*
|
|
15
|
-
* A consumer that needs one capability installs one package, and a consumer that needs
|
|
16
|
-
* neither installs neither. Neither capability implies the other.
|
|
17
|
-
*
|
|
18
|
-
* @packageDocumentation
|
|
19
|
-
* @see [Play RFC](../../docs/rfc/play.md)
|
|
20
|
-
*/
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmachines/play-actor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The actor contract of the Play Architecture: state and send. It names no state machine library",
|
|
6
6
|
"keywords": [
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@testing-library/jest-dom": "^7.0.1",
|
|
52
|
-
"@types/node": "^26.6.
|
|
53
|
-
"@xmachines/play-atom": "
|
|
54
|
-
"oxfmt": "^0.
|
|
55
|
-
"oxlint": "^1.
|
|
56
|
-
"vite": "^8.3.
|
|
57
|
-
"vitest": "^5.0.
|
|
52
|
+
"@types/node": "^26.6.4",
|
|
53
|
+
"@xmachines/play-atom": "7.0.0",
|
|
54
|
+
"oxfmt": "^0.71.0",
|
|
55
|
+
"oxlint": "^1.86.0",
|
|
56
|
+
"vite": "^8.3.2",
|
|
57
|
+
"vitest": "^5.0.3",
|
|
58
58
|
"xstate": "^5.33.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
|
-
"@xmachines/play-atom": "
|
|
61
|
+
"@xmachines/play-atom": "7.0.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=24.0.0"
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
|
package/dist/play-actor.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The actor contract of the Play Architecture.
|
|
3
|
-
*
|
|
4
|
-
* An actor of XMachines holds exactly two things, and this file names both:
|
|
5
|
-
*
|
|
6
|
-
* - `state`: the reactive snapshot, as an atom
|
|
7
|
-
* - `send`: the typed event dispatch
|
|
8
|
-
*
|
|
9
|
-
* It names NO engine. A state machine library is the concern of an adapter, and
|
|
10
|
-
* `@xmachines/play-xstate` is the adapter of XState v5.
|
|
11
|
-
*
|
|
12
|
-
* The contract was an abstract CLASS that extended `Actor` of `xstate`, and the class
|
|
13
|
-
* carried no implementation at all: both members were abstract, and `instanceof` of it
|
|
14
|
-
* appeared nowhere. Its whole effect was to force the inheritance of XState on every
|
|
15
|
-
* consumer of the contract, including `@xmachines/play-view` and
|
|
16
|
-
* `@xmachines/play-router`, which read `currentView`, `currentRoute` and `send`, and no
|
|
17
|
-
* other member.
|
|
18
|
-
*
|
|
19
|
-
* A capability is optional, and each one lives with the package that holds its shared
|
|
20
|
-
* machinery: `Routable` is in `@xmachines/play-router`, beside the bridge that reads it,
|
|
21
|
-
* and `Viewable` is in `@xmachines/play-view`, beside the view store lifecycle. Neither
|
|
22
|
-
* one names an engine, and neither one implies the other.
|
|
23
|
-
*
|
|
24
|
-
* @packageDocumentation
|
|
25
|
-
* @see [Play RFC](../../docs/rfc/play.md)
|
|
26
|
-
*/
|
|
27
|
-
export {};
|
|
28
|
-
//# sourceMappingURL=play-actor.js.map
|
package/dist/play-actor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"play-actor.js","sourceRoot":"","sources":["../src/play-actor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG"}
|