@rotorsoft/act 0.10.0 → 0.11.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 +27 -3
- package/dist/.tsbuildinfo +1 -1
- package/dist/@types/act-builder.d.ts +1 -1
- package/dist/@types/state-builder.d.ts +12 -9
- package/dist/@types/state-builder.d.ts.map +1 -1
- package/dist/@types/utils.d.ts +2 -2
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1562,7 +1562,11 @@ function act(states = /* @__PURE__ */ new Map(), registry = {
|
|
|
1562
1562
|
}
|
|
1563
1563
|
|
|
1564
1564
|
// src/state-builder.ts
|
|
1565
|
-
function state(
|
|
1565
|
+
function state(entry) {
|
|
1566
|
+
const keys = Object.keys(entry);
|
|
1567
|
+
if (keys.length !== 1) throw new Error("state() requires exactly one key");
|
|
1568
|
+
const name = keys[0];
|
|
1569
|
+
const stateSchema = entry[name];
|
|
1566
1570
|
return {
|
|
1567
1571
|
init(init) {
|
|
1568
1572
|
return {
|
|
@@ -1572,7 +1576,7 @@ function state(name, state2) {
|
|
|
1572
1576
|
return action_builder({
|
|
1573
1577
|
events,
|
|
1574
1578
|
actions: {},
|
|
1575
|
-
state:
|
|
1579
|
+
state: stateSchema,
|
|
1576
1580
|
name,
|
|
1577
1581
|
init,
|
|
1578
1582
|
patch: patch2,
|