foldkit 0.129.0 → 0.131.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/THIRD-PARTY-NOTICES.md +30 -0
- package/dist/brand/brand.d.ts +25 -0
- package/dist/brand/brand.d.ts.map +1 -0
- package/dist/brand/brand.js +50 -0
- package/dist/brand/index.d.ts +2 -0
- package/dist/brand/index.d.ts.map +1 -0
- package/dist/brand/index.js +1 -0
- package/dist/brand/public.d.ts +2 -0
- package/dist/brand/public.d.ts.map +1 -0
- package/dist/brand/public.js +1 -0
- package/dist/canvas/view.d.ts.map +1 -1
- package/dist/canvas/view.js +1 -1
- package/dist/command/interruptible/interruptible.d.ts +40 -0
- package/dist/command/interruptible/interruptible.d.ts.map +1 -1
- package/dist/command/interruptible/interruptible.js +19 -0
- package/dist/command/interruptible/public.d.ts +1 -1
- package/dist/command/interruptible/public.d.ts.map +1 -1
- package/dist/devTools/protocol.d.ts +1 -1
- package/dist/devTools/protocol.d.ts.map +1 -1
- package/dist/devTools/protocol.js +1 -1
- package/dist/devTools/store.js +2 -2
- package/dist/devTools/webSocketBridge.d.ts +1 -1
- package/dist/devTools/webSocketBridge.js +1 -1
- package/dist/experimental/machine/machine.d.ts +50 -22
- package/dist/experimental/machine/machine.d.ts.map +1 -1
- package/dist/experimental/machine/machine.js +29 -1
- package/dist/html/index.d.ts +18 -18
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +530 -460
- package/dist/html/lazy.d.ts +1 -1
- package/dist/html/lazy.d.ts.map +1 -1
- package/dist/html/lazy.js +11 -2
- package/dist/propsModule.d.ts +1 -1
- package/dist/propsModule.d.ts.map +1 -1
- package/dist/propsModule.js +6 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +468 -278
- package/dist/snabbdom/attributes.d.ts +4 -0
- package/dist/snabbdom/attributes.d.ts.map +1 -0
- package/dist/snabbdom/attributes.js +63 -0
- package/dist/snabbdom/class.d.ts +4 -0
- package/dist/snabbdom/class.d.ts.map +1 -0
- package/dist/snabbdom/class.js +31 -0
- package/dist/snabbdom/dataset.d.ts +4 -0
- package/dist/snabbdom/dataset.d.ts.map +1 -0
- package/dist/snabbdom/dataset.js +42 -0
- package/dist/snabbdom/eventlisteners.d.ts +11 -0
- package/dist/snabbdom/eventlisteners.d.ts.map +1 -0
- package/dist/snabbdom/eventlisteners.js +85 -0
- package/dist/snabbdom/h.d.ts +11 -0
- package/dist/snabbdom/h.d.ts.map +1 -0
- package/dist/snabbdom/h.js +61 -0
- package/dist/snabbdom/hooks.d.ts +24 -0
- package/dist/snabbdom/hooks.d.ts.map +1 -0
- package/dist/snabbdom/hooks.js +1 -0
- package/dist/snabbdom/htmldomapi.d.ts +34 -0
- package/dist/snabbdom/htmldomapi.d.ts.map +1 -0
- package/dist/snabbdom/htmldomapi.js +111 -0
- package/dist/snabbdom/index.d.ts +15 -0
- package/dist/snabbdom/index.d.ts.map +1 -0
- package/dist/snabbdom/index.js +9 -0
- package/dist/snabbdom/init.d.ts +14 -0
- package/dist/snabbdom/init.d.ts.map +1 -0
- package/dist/snabbdom/init.js +486 -0
- package/dist/snabbdom/is.d.ts +3 -0
- package/dist/snabbdom/is.d.ts.map +1 -0
- package/dist/snabbdom/is.js +7 -0
- package/dist/snabbdom/module.d.ts +11 -0
- package/dist/snabbdom/module.d.ts.map +1 -0
- package/dist/snabbdom/module.js +1 -0
- package/dist/snabbdom/props.d.ts +2 -0
- package/dist/snabbdom/props.d.ts.map +1 -0
- package/dist/snabbdom/props.js +1 -0
- package/dist/snabbdom/style.d.ts +9 -0
- package/dist/snabbdom/style.d.ts.map +1 -0
- package/dist/snabbdom/style.js +123 -0
- package/dist/snabbdom/tovnode.d.ts +4 -0
- package/dist/snabbdom/tovnode.d.ts.map +1 -0
- package/dist/snabbdom/tovnode.js +69 -0
- package/dist/snabbdom/vnode.d.ts +46 -0
- package/dist/snabbdom/vnode.d.ts.map +1 -0
- package/dist/snabbdom/vnode.js +13 -0
- package/dist/test/scene.d.ts +8 -1
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/story.d.ts +8 -1
- package/dist/test/story.d.ts.map +1 -1
- package/dist/vdom.d.ts +2 -2
- package/dist/vdom.d.ts.map +1 -1
- package/dist/vdom.js +1 -1
- package/package.json +7 -5
- package/dist/runtime/messagePriority.d.ts +0 -17
- package/dist/runtime/messagePriority.d.ts.map +0 -1
- package/dist/runtime/messagePriority.js +0 -33
- package/dist/runtime/renderLoop.d.ts +0 -27
- package/dist/runtime/renderLoop.d.ts.map +0 -1
- package/dist/runtime/renderLoop.js +0 -25
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
This package includes a vendored fork of snabbdom v3.6.3
|
|
4
|
+
(https://github.com/snabbdom/snabbdom), compiled into the published dist
|
|
5
|
+
output from `src/snabbdom/`. The fork and its changes are documented in
|
|
6
|
+
`src/snabbdom/README.md` in the repository. The original license follows.
|
|
7
|
+
|
|
8
|
+
## snabbdom
|
|
9
|
+
|
|
10
|
+
The MIT License (MIT)
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2015 Simon Friis Vindum
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stamps a framework-managed identity onto a view result.
|
|
3
|
+
*
|
|
4
|
+
* Identity is the differ's second axis, independent of user-facing keys: it
|
|
5
|
+
* answers "which view arm produced this node" rather than "which sibling is
|
|
6
|
+
* this". Identity never enters the keyed index; it joins the differ's
|
|
7
|
+
* compatibility check exactly where the selector is consulted, so an identity
|
|
8
|
+
* mismatch replaces the node instead of patching it, and switching between
|
|
9
|
+
* conditional view arms tears down the old subtree even when both arms render
|
|
10
|
+
* the same tag.
|
|
11
|
+
*
|
|
12
|
+
* Stamping is set-if-absent and mutates the vnode in place: a vnode that
|
|
13
|
+
* already carries an identity (including a memoized vnode returned from a
|
|
14
|
+
* cache) is left untouched, so branding is idempotent and never breaks
|
|
15
|
+
* reference equality that the renderer relies on. Vnodes are stamped directly;
|
|
16
|
+
* for an array result each vnode element is stamped with the same identity.
|
|
17
|
+
* Any other value passes through unchanged.
|
|
18
|
+
*
|
|
19
|
+
* `@foldkit/vite-plugin` injects a call to this around every function return
|
|
20
|
+
* in application modules at build time, so identity attaches at view-function
|
|
21
|
+
* boundaries regardless of the branching syntax that selected the function.
|
|
22
|
+
* Application code does not call it by hand.
|
|
23
|
+
*/
|
|
24
|
+
export declare const brandViewResult: <A>(result: A, identity: string) => A;
|
|
25
|
+
//# sourceMappingURL=brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../src/brand/brand.ts"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,UAAU,MAAM,KAAG,CAWhE,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const isVNode = (value) => typeof value === 'object' &&
|
|
2
|
+
value !== null &&
|
|
3
|
+
'sel' in value &&
|
|
4
|
+
typeof value.sel === 'string' &&
|
|
5
|
+
'data' in value &&
|
|
6
|
+
'children' in value &&
|
|
7
|
+
'text' in value &&
|
|
8
|
+
'elm' in value &&
|
|
9
|
+
'key' in value;
|
|
10
|
+
const stampIdentity = (target, identity) => {
|
|
11
|
+
if (target.identity === undefined) {
|
|
12
|
+
target.identity = identity;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Stamps a framework-managed identity onto a view result.
|
|
17
|
+
*
|
|
18
|
+
* Identity is the differ's second axis, independent of user-facing keys: it
|
|
19
|
+
* answers "which view arm produced this node" rather than "which sibling is
|
|
20
|
+
* this". Identity never enters the keyed index; it joins the differ's
|
|
21
|
+
* compatibility check exactly where the selector is consulted, so an identity
|
|
22
|
+
* mismatch replaces the node instead of patching it, and switching between
|
|
23
|
+
* conditional view arms tears down the old subtree even when both arms render
|
|
24
|
+
* the same tag.
|
|
25
|
+
*
|
|
26
|
+
* Stamping is set-if-absent and mutates the vnode in place: a vnode that
|
|
27
|
+
* already carries an identity (including a memoized vnode returned from a
|
|
28
|
+
* cache) is left untouched, so branding is idempotent and never breaks
|
|
29
|
+
* reference equality that the renderer relies on. Vnodes are stamped directly;
|
|
30
|
+
* for an array result each vnode element is stamped with the same identity.
|
|
31
|
+
* Any other value passes through unchanged.
|
|
32
|
+
*
|
|
33
|
+
* `@foldkit/vite-plugin` injects a call to this around every function return
|
|
34
|
+
* in application modules at build time, so identity attaches at view-function
|
|
35
|
+
* boundaries regardless of the branching syntax that selected the function.
|
|
36
|
+
* Application code does not call it by hand.
|
|
37
|
+
*/
|
|
38
|
+
export const brandViewResult = (result, identity) => {
|
|
39
|
+
if (isVNode(result)) {
|
|
40
|
+
stampIdentity(result, identity);
|
|
41
|
+
}
|
|
42
|
+
else if (Array.isArray(result)) {
|
|
43
|
+
for (const element of result) {
|
|
44
|
+
if (isVNode(element)) {
|
|
45
|
+
stampIdentity(element, identity);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return result;
|
|
50
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/brand/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './brand.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/brand/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { brandViewResult } from './index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/canvas/view.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/canvas/view.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,IAAI,EAAqB,MAAM,kBAAkB,CAAA;AAI/D,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,IAAI,QAAQ,CAAC;IACzC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,aAAa,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,SAAS,CAAA;IACvD,aAAa,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,SAAS,CAAA;IACvD,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,GAAG,SAAS,CAAA;CACtD,CAAC,CAAA;AA8BF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GAAI,OAAO,EAAE,QAAQ,UAAU,CAAC,OAAO,CAAC,KAAG,IAwE3D,CAAA"}
|
package/dist/canvas/view.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Array, Predicate, Record, String, pipe } from 'effect';
|
|
2
|
-
import { h } from 'snabbdom';
|
|
3
2
|
import { __requireDispatch } from '../html/index.js';
|
|
3
|
+
import { h } from '../snabbdom/index.js';
|
|
4
4
|
import { paintScene } from './paint.js';
|
|
5
5
|
/**
|
|
6
6
|
* Per-element 2D context cache. Keyed by the live `<canvas>` element so the
|
|
@@ -105,6 +105,23 @@ export interface DefinitionWithArgs<Name extends string, Fields extends Schema.S
|
|
|
105
105
|
effect: Eff;
|
|
106
106
|
}>;
|
|
107
107
|
}
|
|
108
|
+
/** An interruptible Command definition with declared args but no `toKey`, so
|
|
109
|
+
* its key is the Command name, exactly like the no-args form. Call as
|
|
110
|
+
* `Definition(args)` to produce a Command instance; use `Definition.Interrupt`
|
|
111
|
+
* to build the Command that stops it. Reach for this when a Command takes args
|
|
112
|
+
* yet at most one invocation is meaningfully in flight, so its invocations need
|
|
113
|
+
* nothing to distinguish them. */
|
|
114
|
+
export interface DefinitionWithArgsNameKeyed<Name extends string, Fields extends Schema.Struct.Fields, Eff extends Effect.Effect<any, any, any>> {
|
|
115
|
+
readonly [CommandDefinitionTypeId]: CommandDefinitionTypeId;
|
|
116
|
+
readonly name: Name;
|
|
117
|
+
readonly Interrupt: InterruptDefinitionNoArgs<Name>;
|
|
118
|
+
(args: Schema.Schema.Type<Schema.Struct<Fields>>): Readonly<{
|
|
119
|
+
name: Name;
|
|
120
|
+
args: Schema.Schema.Type<Schema.Struct<Fields>>;
|
|
121
|
+
key: string;
|
|
122
|
+
effect: Eff;
|
|
123
|
+
}>;
|
|
124
|
+
}
|
|
108
125
|
/**
|
|
109
126
|
* Defines an interruptible Command. Like `Command.define`, but every
|
|
110
127
|
* invocation registers under a key in the runtime's interrupt registry for
|
|
@@ -120,6 +137,13 @@ export interface DefinitionWithArgs<Name extends string, Fields extends Schema.S
|
|
|
120
137
|
* from a generated value: the update function is pure, and any invocation you
|
|
121
138
|
* can meaningfully target is already distinguished by data in the Model.
|
|
122
139
|
*
|
|
140
|
+
* `toKey` is optional on the with-args form. Omit it when at most one
|
|
141
|
+
* invocation is meaningfully in flight (a single-instance submit flow), and the
|
|
142
|
+
* key is the Command name, exactly like the no-args form, with `Interrupt`
|
|
143
|
+
* taking only `toMessage`. Provide it, deriving the key from the owning Model
|
|
144
|
+
* identity, when invocations run concurrently and must be interrupted
|
|
145
|
+
* independently.
|
|
146
|
+
*
|
|
123
147
|
* Semantics:
|
|
124
148
|
*
|
|
125
149
|
* - A key is an address, not a lock. Any number of invocations may run under
|
|
@@ -171,7 +195,23 @@ export interface DefinitionWithArgs<Name extends string, Fields extends Schema.S
|
|
|
171
195
|
* CompletedCancelUploadFile({ uploadId: 1, outcome }),
|
|
172
196
|
* )
|
|
173
197
|
* ```
|
|
198
|
+
*
|
|
199
|
+
* @example With args, keyed by name (one invocation in flight)
|
|
200
|
+
* ```ts
|
|
201
|
+
* const SaveDraft = Command.Interruptible.define(
|
|
202
|
+
* 'SaveDraft',
|
|
203
|
+
* { draftId: S.String, body: S.String },
|
|
204
|
+
* SucceededSaveDraft,
|
|
205
|
+
* FailedSaveDraft,
|
|
206
|
+
* )(({ draftId, body }) =>
|
|
207
|
+
* Effect.gen(function* () { ... }),
|
|
208
|
+
* )
|
|
209
|
+
* // Call sites:
|
|
210
|
+
* SaveDraft({ draftId: 'abc', body })
|
|
211
|
+
* SaveDraft.Interrupt(outcome => CompletedCancelSaveDraft({ outcome }))
|
|
212
|
+
* ```
|
|
174
213
|
*/
|
|
175
214
|
export declare function define<const Name extends string, Results extends ReadonlyArray<Schema.Top>>(name: Name, ...results: Results): <Eff extends Effect.Effect<Schema.Schema.Type<Results[number]>, any, any>>(effect: Eff) => DefinitionNoArgs<Name, Eff>;
|
|
176
215
|
export declare function define<const Name extends string, Fields extends Schema.Struct.Fields, KeyArgs extends Partial<Schema.Schema.Type<Schema.Struct<Fields>>>, Results extends ReadonlyArray<Schema.Top>>(name: Name, args: Fields, toKey: (keyArgs: KeyArgs) => string, ...results: Results): <Eff extends Effect.Effect<Schema.Schema.Type<Results[number]>, any, any>>(effectBuilder: (args: Schema.Schema.Type<Schema.Struct<Fields>>) => Eff) => DefinitionWithArgs<Name, Fields, KeyArgs, Eff>;
|
|
216
|
+
export declare function define<const Name extends string, Fields extends Schema.Struct.Fields, Results extends ReadonlyArray<Schema.Top>>(name: Name, args: Fields, ...results: Results): <Eff extends Effect.Effect<Schema.Schema.Type<Results[number]>, any, any>>(effectBuilder: (args: Schema.Schema.Type<Schema.Struct<Fields>>) => Eff) => DefinitionWithArgsNameKeyed<Name, Fields, Eff>;
|
|
177
217
|
//# sourceMappingURL=interruptible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interruptible.d.ts","sourceRoot":"","sources":["../../../src/command/interruptible/interruptible.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EACP,MAAM,EACN,KAAK,EAGL,MAAM,EACP,MAAM,QAAQ,CAAA;AAGf,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AAErD;;gBAEgB;AAChB,eAAO,MAAM,WAAW,yEAAoB,CAAA;AAE5C;;gBAEgB;AAChB,MAAM,MAAM,W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AAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,GAAG,KACpE,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA"}
|
|
@@ -131,6 +131,25 @@ export function define(name, ...rest) {
|
|
|
131
131
|
return definition;
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
+
const isToKeyFunction = Predicate.isFunction(maybeToKey) && !Schema.isSchema(maybeToKey);
|
|
135
|
+
if (!isToKeyFunction) {
|
|
136
|
+
const key = name;
|
|
137
|
+
return (effectBuilder) => {
|
|
138
|
+
const definition = (args) => ({
|
|
139
|
+
name,
|
|
140
|
+
args,
|
|
141
|
+
key,
|
|
142
|
+
effect: registerKeyWhileRunning(key, effectBuilder(args)),
|
|
143
|
+
messageMappers: [],
|
|
144
|
+
});
|
|
145
|
+
brandAsDefinition(definition, name);
|
|
146
|
+
Object.defineProperty(definition, 'Interrupt', {
|
|
147
|
+
value: makeInterruptDefinitionNoArgs(name, key),
|
|
148
|
+
});
|
|
149
|
+
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
150
|
+
return definition;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
134
153
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|
|
135
154
|
const toKey = maybeToKey;
|
|
136
155
|
const toFullKey = (keyArgs) => `${name}:${toKey(keyArgs)}`;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { DefinitionNoArgs, DefinitionWithArgs, InterruptDefinitionNoArgs, InterruptDefinitionWithArgs, } from './index.js';
|
|
1
|
+
export type { DefinitionNoArgs, DefinitionWithArgs, DefinitionWithArgsNameKeyed, InterruptDefinitionNoArgs, InterruptDefinitionWithArgs, } from './index.js';
|
|
2
2
|
export { define, Interrupted, NotFound, Outcome } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/command/interruptible/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/command/interruptible/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,2BAA2B,EAC3B,yBAAyB,EACzB,2BAA2B,GAC5B,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -265,7 +265,7 @@ export declare const ResponseReplayed: import("../schema/index.js").CallableTagg
|
|
|
265
265
|
}>;
|
|
266
266
|
/** Response confirming the runtime resumed normal execution. */
|
|
267
267
|
export declare const ResponseResumed: import("../schema/index.js").CallableTaggedStruct<"ResponseResumed", {}>;
|
|
268
|
-
/** Response confirming a Message was dispatched. The `acceptedAtIndex` is the absolute history index where the entry is predicted to land. Computed from the runtime's history length at dispatch time. The
|
|
268
|
+
/** Response confirming a Message was dispatched. The `acceptedAtIndex` is the absolute history index where the entry is predicted to land. Computed from the runtime's history length at dispatch time. The runtime processes Messages in arrival order and the bridge is the only external dispatch source, so this index is reliable for correlation. */
|
|
269
269
|
export declare const ResponseDispatched: import("../schema/index.js").CallableTaggedStruct<"ResponseDispatched", {
|
|
270
270
|
acceptedAtIndex: S.Number;
|
|
271
271
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/devTools/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAM5C,0NAA0N;AAC1N,eA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U,CAAC,IAAI,CAAA"}
|
|
@@ -165,7 +165,7 @@ export const ResponseReplayed = ts('ResponseReplayed', {
|
|
|
165
165
|
});
|
|
166
166
|
/** Response confirming the runtime resumed normal execution. */
|
|
167
167
|
export const ResponseResumed = ts('ResponseResumed');
|
|
168
|
-
/** Response confirming a Message was dispatched. The `acceptedAtIndex` is the absolute history index where the entry is predicted to land. Computed from the runtime's history length at dispatch time. The
|
|
168
|
+
/** Response confirming a Message was dispatched. The `acceptedAtIndex` is the absolute history index where the entry is predicted to land. Computed from the runtime's history length at dispatch time. The runtime processes Messages in arrival order and the bridge is the only external dispatch source, so this index is reliable for correlation. */
|
|
169
169
|
export const ResponseDispatched = ts('ResponseDispatched', {
|
|
170
170
|
acceptedAtIndex: S.Number,
|
|
171
171
|
});
|
package/dist/devTools/store.js
CHANGED
|
@@ -160,8 +160,8 @@ export const createDevToolsStore = (bridge, options = {}) => Effect.gen(function
|
|
|
160
160
|
});
|
|
161
161
|
/** Attaches Mount lifecycle events from the most recent render to the
|
|
162
162
|
* history entry that triggered the render. Mount events fire during
|
|
163
|
-
* snabbdom's `patch
|
|
164
|
-
*
|
|
163
|
+
* snabbdom's `patch`, but render frames are scheduled through
|
|
164
|
+
* `requestAnimationFrame`, so a render may fire after the
|
|
165
165
|
* Message that dirtied it has already been recorded. The runtime drains
|
|
166
166
|
* its mount buffer after each render and calls this to associate the
|
|
167
167
|
* events with the correct entry. When called before any Message has been
|
|
@@ -11,7 +11,7 @@ type Hot = NonNullable<ImportMeta['hot']>;
|
|
|
11
11
|
* `EventDisconnected` on tab close or HMR module dispose so the relay can
|
|
12
12
|
* remove this runtime from its connected set.
|
|
13
13
|
*
|
|
14
|
-
* `dispatch`
|
|
14
|
+
* `dispatch` delivers a Message to the runtime; the bridge
|
|
15
15
|
* uses it to fulfill `RequestDispatchMessage` after decoding the payload
|
|
16
16
|
* against a JSON-canonical derivation of `maybeMessageSchema` (via
|
|
17
17
|
* `Schema.toCodecJson`). The derivation reconstructs runtime values like
|
|
@@ -29,7 +29,7 @@ const tryDeriveJsonSchemaDocument = (schema) => {
|
|
|
29
29
|
* `EventDisconnected` on tab close or HMR module dispose so the relay can
|
|
30
30
|
* remove this runtime from its connected set.
|
|
31
31
|
*
|
|
32
|
-
* `dispatch`
|
|
32
|
+
* `dispatch` delivers a Message to the runtime; the bridge
|
|
33
33
|
* uses it to fulfill `RequestDispatchMessage` after decoding the payload
|
|
34
34
|
* against a JSON-canonical derivation of `maybeMessageSchema` (via
|
|
35
35
|
* `Schema.toCodecJson`). The derivation reconstructs runtime values like
|
|
@@ -35,26 +35,26 @@ export type EdgeInput<SourceState extends Tagged, TriggerMessage extends Tagged,
|
|
|
35
35
|
*
|
|
36
36
|
* Construct with {@link to}.
|
|
37
37
|
*/
|
|
38
|
-
export type Edge<State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, GuardValue = void> = Readonly<{
|
|
38
|
+
export type Edge<State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, GuardValue = void, R = never> = Readonly<{
|
|
39
39
|
_tag: 'Edge';
|
|
40
40
|
target: TagOf<State>;
|
|
41
41
|
build: (input: EdgeInput<SourceState, TriggerMessage, unknown>) => State;
|
|
42
|
-
maybeCommands: Option.Option<(input: EdgeInput<SourceState, TriggerMessage, unknown>) => ReadonlyArray<Command<Message>>>;
|
|
42
|
+
maybeCommands: Option.Option<(input: EdgeInput<SourceState, TriggerMessage, unknown>) => ReadonlyArray<Command<Message, never, R>>>;
|
|
43
43
|
readonly [EdgeGuardValueTypeId]?: GuardValue;
|
|
44
44
|
}>;
|
|
45
45
|
/** A guarded Edge that fires only when its guard passes. Construct with {@link when}. */
|
|
46
|
-
export type When<State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, GuardValue = unknown> = Readonly<{
|
|
46
|
+
export type When<State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, GuardValue = unknown, R = never> = Readonly<{
|
|
47
47
|
_tag: 'When';
|
|
48
48
|
guard: (state: SourceState, message: TriggerMessage) => Option.Option<unknown>;
|
|
49
|
-
edge: Edge<State, Message, SourceState, TriggerMessage, GuardValue>;
|
|
49
|
+
edge: Edge<State, Message, SourceState, TriggerMessage, GuardValue, R>;
|
|
50
50
|
}>;
|
|
51
51
|
/** The unconditional fallback Edge at the end of a guard list. Construct with {@link otherwise}. */
|
|
52
|
-
export type Otherwise<State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message> = Readonly<{
|
|
52
|
+
export type Otherwise<State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, R = never> = Readonly<{
|
|
53
53
|
_tag: 'Otherwise';
|
|
54
|
-
edge: Edge<State, Message, SourceState, TriggerMessage>;
|
|
54
|
+
edge: Edge<State, Message, SourceState, TriggerMessage, void, R>;
|
|
55
55
|
}>;
|
|
56
56
|
/** One entry in an ordered guard list: a {@link When} or the {@link Otherwise} fallback. */
|
|
57
|
-
export type GuardedEdge<State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message> = When<State, Message, SourceState, TriggerMessage, unknown> | Otherwise<State, Message, SourceState, TriggerMessage>;
|
|
57
|
+
export type GuardedEdge<State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, R = never> = When<State, Message, SourceState, TriggerMessage, unknown, R> | Otherwise<State, Message, SourceState, TriggerMessage, R>;
|
|
58
58
|
type OptionValue<MaybeValue> = MaybeValue extends Option.Option<infer Value> ? Value : never;
|
|
59
59
|
type GuardValueOf<GuardResult> = [GuardResult] extends [boolean] ? void : OptionValue<GuardResult>;
|
|
60
60
|
/**
|
|
@@ -64,10 +64,10 @@ type GuardValueOf<GuardResult> = [GuardResult] extends [boolean] ? void : Option
|
|
|
64
64
|
* ignored: {@link Machine.step} reports them as `Ignored` rather than
|
|
65
65
|
* transitioning.
|
|
66
66
|
*/
|
|
67
|
-
export type TransitionTable<State extends Tagged, Message extends Tagged> = Readonly<{
|
|
67
|
+
export type TransitionTable<State extends Tagged, Message extends Tagged, R = never> = Readonly<{
|
|
68
68
|
[SourceTag in TagOf<State>]?: Readonly<{
|
|
69
69
|
on: Readonly<{
|
|
70
|
-
[MessageTag in TagOf<Message>]?: Edge<State, Message, Variant<State, SourceTag>, Variant<Message, MessageTag
|
|
70
|
+
[MessageTag in TagOf<Message>]?: Edge<State, Message, Variant<State, SourceTag>, Variant<Message, MessageTag>, void, R> | ReadonlyArray<GuardedEdge<State, Message, Variant<State, SourceTag>, Variant<Message, MessageTag>, R>>;
|
|
71
71
|
}>;
|
|
72
72
|
}>;
|
|
73
73
|
}>;
|
|
@@ -78,10 +78,13 @@ export type TransitionTable<State extends Tagged, Message extends Tagged> = Read
|
|
|
78
78
|
* must return the target variant. Optional `commands` attach transition-time
|
|
79
79
|
* effects.
|
|
80
80
|
*
|
|
81
|
+
* The `commands` callback may return Commands whose Effects need services. The
|
|
82
|
+
* requirements they carry flow into the Machine's `R` through {@link define}.
|
|
83
|
+
*
|
|
81
84
|
* Only meaningful inside a {@link TransitionTable}: the source and trigger
|
|
82
85
|
* types flow in from the table position contextually.
|
|
83
86
|
*/
|
|
84
|
-
export declare const to: <State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, const TargetTag extends TagOf<State
|
|
87
|
+
export declare const to: <State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, const TargetTag extends TagOf<State>, R = never>(target: TargetTag, build: (input: NoInfer<EdgeInput<SourceState, TriggerMessage>>) => NoInfer<Variant<State, TargetTag>>, commands?: (input: NoInfer<EdgeInput<SourceState, TriggerMessage>>) => ReadonlyArray<Command<NoInfer<Message>, never, R>>) => Edge<State, Message, SourceState, TriggerMessage, void, R>;
|
|
85
88
|
/**
|
|
86
89
|
* Guards an Edge. Guard lists run in order, and the first guard that passes
|
|
87
90
|
* fires its Edge. A guard either resolves the state and Message to an
|
|
@@ -93,17 +96,21 @@ export declare const to: <State extends Tagged, Message extends Tagged, SourceSt
|
|
|
93
96
|
* The state and Message parameters are `NoInfer` so they resolve from the
|
|
94
97
|
* guard list's table position alone.
|
|
95
98
|
*/
|
|
96
|
-
export declare const when: <State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, GuardResult extends Option.Option<unknown> | boolean, const TargetTag extends TagOf<State
|
|
97
|
-
/**
|
|
98
|
-
|
|
99
|
+
export declare const when: <State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, GuardResult extends Option.Option<unknown> | boolean, const TargetTag extends TagOf<State>, R = never>(guard: (state: NoInfer<SourceState>, message: NoInfer<TriggerMessage>) => GuardResult, target: TargetTag, build: (input: NoInfer<EdgeInput<SourceState, TriggerMessage, GuardValueOf<GuardResult>>>) => NoInfer<Variant<State, TargetTag>>, commands?: (input: NoInfer<EdgeInput<SourceState, TriggerMessage, GuardValueOf<GuardResult>>>) => ReadonlyArray<Command<NoInfer<Message>, never, R>>) => When<State, Message, SourceState, TriggerMessage, GuardValueOf<GuardResult>, R>;
|
|
100
|
+
/**
|
|
101
|
+
* The unconditional fallback at the end of a guard list. Its edge may carry
|
|
102
|
+
* Commands whose Effects need services, threading their requirements into the
|
|
103
|
+
* Machine's `R` the same way {@link to} and {@link when} do.
|
|
104
|
+
*/
|
|
105
|
+
export declare const otherwise: <State extends Tagged, Message extends Tagged, SourceState extends State, TriggerMessage extends Message, R = never>(edge: Edge<State, Message, SourceState, TriggerMessage, void, R>) => Otherwise<State, Message, SourceState, TriggerMessage, R>;
|
|
99
106
|
/** A step that matched an Edge: the next state plus any transition-time Commands. */
|
|
100
|
-
export type Transitioned<State extends Tagged, Message extends Tagged> = Readonly<{
|
|
107
|
+
export type Transitioned<State extends Tagged, Message extends Tagged, R = never> = Readonly<{
|
|
101
108
|
_tag: 'Transitioned';
|
|
102
109
|
from: TagOf<State>;
|
|
103
110
|
target: TagOf<State>;
|
|
104
111
|
messageTag: TagOf<Message>;
|
|
105
112
|
state: State;
|
|
106
|
-
commands: ReadonlyArray<Command<Message>>;
|
|
113
|
+
commands: ReadonlyArray<Command<Message, never, R>>;
|
|
107
114
|
}>;
|
|
108
115
|
/** A step that matched no Edge: the state is unchanged and the Message is observable as ignored. */
|
|
109
116
|
export type Ignored<State extends Tagged, Message extends Tagged> = Readonly<{
|
|
@@ -113,7 +120,7 @@ export type Ignored<State extends Tagged, Message extends Tagged> = Readonly<{
|
|
|
113
120
|
state: State;
|
|
114
121
|
}>;
|
|
115
122
|
/** The observable outcome of one step: `Transitioned` or `Ignored`. */
|
|
116
|
-
export type TransitionResult<State extends Tagged, Message extends Tagged> = Transitioned<State, Message> | Ignored<State, Message>;
|
|
123
|
+
export type TransitionResult<State extends Tagged, Message extends Tagged, R = never> = Transitioned<State, Message, R> | Ignored<State, Message>;
|
|
117
124
|
/** Which guard construct an Edge sits under, with its position in the guard list. */
|
|
118
125
|
export type EdgeGuard = Readonly<{
|
|
119
126
|
_tag: 'Unguarded';
|
|
@@ -139,12 +146,12 @@ export type DeadTransition<State extends Tagged, Message extends Tagged> = Reado
|
|
|
139
146
|
reason: DeadTransitionReason;
|
|
140
147
|
}>;
|
|
141
148
|
/** A compiled state Machine: a pure transition function plus static analysis over the Edge set. */
|
|
142
|
-
export type Machine<State extends Tagged, Message extends Tagged> = Readonly<{
|
|
149
|
+
export type Machine<State extends Tagged, Message extends Tagged, R = never> = Readonly<{
|
|
143
150
|
initial: State;
|
|
144
151
|
stateTags: ReadonlyArray<TagOf<State>>;
|
|
145
152
|
edges: ReadonlyArray<EdgeSummary<State, Message>>;
|
|
146
|
-
transition: (state: State, message: Message) => [State, ReadonlyArray<Command<Message>>];
|
|
147
|
-
step: (state: State, message: Message) => TransitionResult<State, Message>;
|
|
153
|
+
transition: (state: State, message: Message) => [State, ReadonlyArray<Command<Message, never, R>>];
|
|
154
|
+
step: (state: State, message: Message) => TransitionResult<State, Message, R>;
|
|
148
155
|
reachableFrom: (tag: TagOf<State>) => ReadonlySet<TagOf<State>>;
|
|
149
156
|
unreachableStates: () => ReadonlyArray<TagOf<State>>;
|
|
150
157
|
deadTransitions: () => ReadonlyArray<DeadTransition<State, Message>>;
|
|
@@ -165,9 +172,9 @@ export type MachineSchemas<State extends Tagged, Message extends Tagged> = Reado
|
|
|
165
172
|
}>;
|
|
166
173
|
}>;
|
|
167
174
|
/** The Machine definition: the initial state and the transition table. */
|
|
168
|
-
export type MachineDefinition<State extends Tagged, Message extends Tagged> = Readonly<{
|
|
175
|
+
export type MachineDefinition<State extends Tagged, Message extends Tagged, R = never> = Readonly<{
|
|
169
176
|
initial: State;
|
|
170
|
-
states: TransitionTable<State, Message>;
|
|
177
|
+
states: TransitionTable<State, Message, R>;
|
|
171
178
|
}>;
|
|
172
179
|
/**
|
|
173
180
|
* Compiles a declarative transition table into a {@link Machine}.
|
|
@@ -188,7 +195,28 @@ export type MachineDefinition<State extends Tagged, Message extends Tagged> = Re
|
|
|
188
195
|
* Because every Edge names a literal target tag, the Edge set is plain data:
|
|
189
196
|
* `reachableFrom`, `unreachableStates`, `deadTransitions`, and `toMermaid`
|
|
190
197
|
* all read it directly.
|
|
198
|
+
*
|
|
199
|
+
* The Machine's requirements `R` are the services its edge Commands need, and
|
|
200
|
+
* flow into `transition` and `step`. `R` defaults to `never`. When every edge
|
|
201
|
+
* Command shares one service, `R` is inferred from the table. When edges need
|
|
202
|
+
* distinct services `R` cannot be inferred to their union, so supply it on the
|
|
203
|
+
* second call: `define(schemas)<UploadsClient | SaveClient>({ ... })`.
|
|
204
|
+
*
|
|
205
|
+
* @example An edge Command that needs a service
|
|
206
|
+
* ```ts
|
|
207
|
+
* const machine = define({ state: DialogState, message: DialogMessage })({
|
|
208
|
+
* initial: Idle(),
|
|
209
|
+
* states: {
|
|
210
|
+
* Idle: {
|
|
211
|
+
* on: {
|
|
212
|
+
* ClickedSubmit: to('Uploading', () => Uploading(), () => [Presign()]),
|
|
213
|
+
* },
|
|
214
|
+
* },
|
|
215
|
+
* },
|
|
216
|
+
* })
|
|
217
|
+
* // machine.transition(...) returns Commands typed with UploadsClient in R.
|
|
218
|
+
* ```
|
|
191
219
|
*/
|
|
192
|
-
export declare const define: <State extends Tagged, Message extends Tagged>(schemas: MachineSchemas<State, Message>) => (definition: MachineDefinition<State, Message>) => Machine<State, Message>;
|
|
220
|
+
export declare const define: <State extends Tagged, Message extends Tagged>(schemas: MachineSchemas<State, Message>) => <R = never>(definition: MachineDefinition<State, Message, R>) => Machine<State, Message, R>;
|
|
193
221
|
export {};
|
|
194
222
|
//# sourceMappingURL=machine.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/experimental/machine/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EAGN,MAAM,EAEP,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAIrD,8FAA8F;AAC9F,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAA;AAE/C,sDAAsD;AACtD,MAAM,MAAM,KAAK,CAAC,KAAK,SAAS,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAA;AAEvD,mEAAmE;AACnE,MAAM,MAAM,OAAO,CAAC,KAAK,SAAS,MAAM,EAAE,GAAG,SAAS,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,CAC3E,KAAK,EACL,QAAQ,CAAC;IAAE,IAAI,EAAE,GAAG,CAAA;CAAE,CAAC,CACxB,CAAA;AAID,OAAO,CAAC,MAAM,oBAAoB,EAAE,OAAO,MAAM,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,CACnB,WAAW,SAAS,MAAM,EAC1B,cAAc,SAAS,MAAM,EAC7B,UAAU,GAAG,IAAI,IACf,QAAQ,CAAC;IACX,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;IACvB,UAAU,EAAE,UAAU,CAAA;CACvB,CAAC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AE,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC,CAAA;IAC/D,OAAO,EAAE,MAAM,CAAC,GAAG,GAAG,QAAQ,CAAC;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAA;CAClD,CAAC,CAAA;AAEF,0EAA0E;AAC1E,MAAM,MAAM,iBAAiB,CAC3B,KAAK,SAAS,MAAM,EACpB,OAAO,SAAS,MAAM,EACtB,CAAC,GAAG,KAAK,IACP,QAAQ,CAAC;IACX,OAAO,EAAE,KAAK,CAAA;IACd,MAAM,EAAE,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,CAAA;CAC3C,CAAC,CAAA;AAkEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,MAAM,GAChB,KAAK,SAAS,MAAM,EAAE,OAAO,SAAS,MAAM,EAC3C,SAAS,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,MAExC,CAAC,GAAG,KAAK,EACR,YAAY,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,KAC/C,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,CAAC,CAmT3B,CAAA"}
|
|
@@ -20,6 +20,9 @@ const makeEdge = (target, build, commands) => {
|
|
|
20
20
|
* must return the target variant. Optional `commands` attach transition-time
|
|
21
21
|
* effects.
|
|
22
22
|
*
|
|
23
|
+
* The `commands` callback may return Commands whose Effects need services. The
|
|
24
|
+
* requirements they carry flow into the Machine's `R` through {@link define}.
|
|
25
|
+
*
|
|
23
26
|
* Only meaningful inside a {@link TransitionTable}: the source and trigger
|
|
24
27
|
* types flow in from the table position contextually.
|
|
25
28
|
*/
|
|
@@ -48,7 +51,11 @@ export const when = (guard, target, build, commands) => ({
|
|
|
48
51
|
},
|
|
49
52
|
edge: makeEdge(target, build, commands),
|
|
50
53
|
});
|
|
51
|
-
/**
|
|
54
|
+
/**
|
|
55
|
+
* The unconditional fallback at the end of a guard list. Its edge may carry
|
|
56
|
+
* Commands whose Effects need services, threading their requirements into the
|
|
57
|
+
* Machine's `R` the same way {@link to} and {@link when} do.
|
|
58
|
+
*/
|
|
52
59
|
export const otherwise = (edge) => ({
|
|
53
60
|
_tag: 'Otherwise',
|
|
54
61
|
edge,
|
|
@@ -86,6 +93,27 @@ const extractMemberTag = (member) => pipe(Option.some(member), Option.filter(Pre
|
|
|
86
93
|
* Because every Edge names a literal target tag, the Edge set is plain data:
|
|
87
94
|
* `reachableFrom`, `unreachableStates`, `deadTransitions`, and `toMermaid`
|
|
88
95
|
* all read it directly.
|
|
96
|
+
*
|
|
97
|
+
* The Machine's requirements `R` are the services its edge Commands need, and
|
|
98
|
+
* flow into `transition` and `step`. `R` defaults to `never`. When every edge
|
|
99
|
+
* Command shares one service, `R` is inferred from the table. When edges need
|
|
100
|
+
* distinct services `R` cannot be inferred to their union, so supply it on the
|
|
101
|
+
* second call: `define(schemas)<UploadsClient | SaveClient>({ ... })`.
|
|
102
|
+
*
|
|
103
|
+
* @example An edge Command that needs a service
|
|
104
|
+
* ```ts
|
|
105
|
+
* const machine = define({ state: DialogState, message: DialogMessage })({
|
|
106
|
+
* initial: Idle(),
|
|
107
|
+
* states: {
|
|
108
|
+
* Idle: {
|
|
109
|
+
* on: {
|
|
110
|
+
* ClickedSubmit: to('Uploading', () => Uploading(), () => [Presign()]),
|
|
111
|
+
* },
|
|
112
|
+
* },
|
|
113
|
+
* },
|
|
114
|
+
* })
|
|
115
|
+
* // machine.transition(...) returns Commands typed with UploadsClient in R.
|
|
116
|
+
* ```
|
|
89
117
|
*/
|
|
90
118
|
export const define = (schemas) => (definition) => {
|
|
91
119
|
/* eslint-disable-next-line @typescript-eslint/consistent-type-assertions */
|