jssm 5.159.2 → 5.160.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 +3 -3
- package/dist/cdn/instance.js +2 -2
- package/dist/cdn/viz.js +2 -2
- package/dist/cli/fsl-export-system-prompt.cjs +1 -1
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/cli/lib.cjs +1 -1
- package/dist/cli/lib.mjs +1 -1
- package/dist/deno/README.md +3 -3
- package/dist/deno/fsl_fence_render.d.ts +0 -10
- package/dist/deno/fsl_markdown_fence.d.ts +3 -3
- package/dist/deno/jssm.d.ts +2 -2
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_types.d.ts +138 -138
- package/dist/deno/jssm_viz.d.ts +3 -3
- package/dist/fence/fence.js +31906 -31893
- package/dist/jssm.es5.cjs +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/dist/jssm.es6.mjs +1 -1
- package/dist/jssm_viz.cjs +1 -1
- package/dist/jssm_viz.iife.cjs +1 -1
- package/dist/jssm_viz.mjs +1 -1
- package/dist/wc/instance.js +5 -0
- package/dist/wc/widgets.js +3 -0
- package/jssm.cli.d.cts +4 -4
- package/jssm.cli.d.ts +4 -4
- package/jssm.es5.d.cts +131 -131
- package/jssm.es6.d.ts +131 -131
- package/jssm.fence.d.ts +122 -132
- package/jssm_viz.es5.d.cts +125 -125
- package/jssm_viz.es6.d.ts +125 -125
- package/package.json +5 -5
package/jssm.fence.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import { circular_buffer } from 'circular_buffer_js';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* The descriptor interpreter for the FSL Markdown fence convention: turns a
|
|
5
|
-
* parsed {@link FenceDescriptor} plus FSL source into static HTML, and walks
|
|
6
|
-
* a whole Markdown document replacing every `fsl`/`jssm` fence in place.
|
|
7
|
-
* This is the integration point for the five pieces built ahead of it — the
|
|
8
|
-
* fence-info parser, the viz pipeline, the rasterizer, the SVG fill
|
|
9
|
-
* extractor, and the editor-parity highlighter.
|
|
10
|
-
*
|
|
11
|
-
* @see notes/superpowers/specs/2026-06-23-fsl-markdown-fence-convention-design.md
|
|
12
|
-
*/
|
|
13
3
|
/** Options shared by the static fence renderers. */
|
|
14
4
|
interface FenceRenderOptions {
|
|
15
5
|
/** Inline state colors in code spans (default true). @see highlight_fsl_html */
|
|
@@ -167,59 +157,59 @@ interface GifOptions {
|
|
|
167
157
|
*/
|
|
168
158
|
declare function encode_gif(frames: GifFrame[], opts?: GifOptions): Uint8Array;
|
|
169
159
|
|
|
170
|
-
|
|
160
|
+
type StateType$1 = string;
|
|
171
161
|
/**
|
|
172
162
|
* A color value accepted by jssm-viz for state and arrow styling. Currently
|
|
173
163
|
* any string, validated downstream by Graphviz / the named-colors list.
|
|
174
164
|
* Intended to be narrowed to `#RRGGBB` / `#RRGGBBAA` and CSS named colors
|
|
175
165
|
* in a future release.
|
|
176
166
|
*/
|
|
177
|
-
|
|
167
|
+
type JssmColor = string;
|
|
178
168
|
/**
|
|
179
169
|
* Three-state policy flag: `'required'`, `'disallowed'`, or `'optional'`.
|
|
180
170
|
* Used by machine configuration where a default-permissive middle ground
|
|
181
171
|
* is meaningful (for example, the `actions` config key).
|
|
182
172
|
*/
|
|
183
|
-
|
|
173
|
+
type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
|
|
184
174
|
/**
|
|
185
175
|
* The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
|
|
186
176
|
* encodes a direction (one-way left/right, or two-way) and a "kind" for
|
|
187
177
|
* each direction (`-` legal, `=` main path, `~` forced-only). See the
|
|
188
178
|
* Language Reference docs for the full semantic table.
|
|
189
179
|
*/
|
|
190
|
-
|
|
180
|
+
type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
|
|
191
181
|
/**
|
|
192
182
|
* A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
|
|
193
183
|
*/
|
|
194
|
-
|
|
184
|
+
type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle" | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon" | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon" | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect" | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab" | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite" | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly" | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab" | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record";
|
|
195
185
|
/**
|
|
196
186
|
* Semantic category of an arrow's transition. `'legal'` is a normal
|
|
197
187
|
* transition, `'main'` is part of the machine's primary path, `'forced'`
|
|
198
188
|
* may only be taken via {@link Machine.force_transition}, and `'none'`
|
|
199
189
|
* means no transition exists in that direction.
|
|
200
190
|
*/
|
|
201
|
-
|
|
191
|
+
type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
202
192
|
/**
|
|
203
193
|
* Graphviz layout engine selector. Controls how jssm-viz lays out the
|
|
204
194
|
* rendered diagram; `'dot'` is the default and most useful for state
|
|
205
195
|
* machines. See the Graphviz documentation for the differences.
|
|
206
196
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
197
|
+
type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp' | 'neato';
|
|
198
|
+
type JssmCorner = 'regular' | 'rounded' | 'lined';
|
|
199
|
+
type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
210
200
|
/**
|
|
211
201
|
* Tristate flag for whether a property may be overridden at runtime.
|
|
212
202
|
* `true` permits overrides, `false` forbids them, and `undefined` defers
|
|
213
203
|
* the decision to the surrounding configuration's default.
|
|
214
204
|
*/
|
|
215
|
-
|
|
205
|
+
type JssmAllowsOverride = true | false | undefined;
|
|
216
206
|
/**
|
|
217
207
|
* Controls whether the state graph may contain disconnected components
|
|
218
208
|
* (islands). `true` permits islands (default), `false` requires a single
|
|
219
209
|
* connected component, and `'with_start'` permits islands only when every
|
|
220
210
|
* component contains at least one start state.
|
|
221
211
|
*/
|
|
222
|
-
|
|
212
|
+
type JssmAllowIslands = true | false | 'with_start';
|
|
223
213
|
/**
|
|
224
214
|
* Structured render-size hint for a machine visualization, set by the FSL
|
|
225
215
|
* `default_size` directive. All three forms are optional in the sense that
|
|
@@ -233,7 +223,7 @@ declare type JssmAllowIslands = true | false | 'with_start';
|
|
|
233
223
|
*
|
|
234
224
|
* @see Machine.default_size
|
|
235
225
|
*/
|
|
236
|
-
|
|
226
|
+
type JssmDefaultSize = {
|
|
237
227
|
width?: number;
|
|
238
228
|
height?: number;
|
|
239
229
|
};
|
|
@@ -247,7 +237,7 @@ declare const FslDirections: readonly ["up", "right", "down", "left"];
|
|
|
247
237
|
* String literal type of the four supported FSL flow directions. This is
|
|
248
238
|
* the type of the `flow` config key on a machine.
|
|
249
239
|
*/
|
|
250
|
-
|
|
240
|
+
type FslDirection = typeof FslDirections[number];
|
|
251
241
|
/**
|
|
252
242
|
* Runtime-iterable list of the built-in theme names that ship with jssm-viz.
|
|
253
243
|
* Use this when you need to enumerate themes; for the type itself see
|
|
@@ -259,7 +249,7 @@ declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"
|
|
|
259
249
|
* type of the `theme` config key (which accepts an array so that themes
|
|
260
250
|
* can be layered).
|
|
261
251
|
*/
|
|
262
|
-
|
|
252
|
+
type FslTheme = typeof FslThemes[number];
|
|
263
253
|
/**
|
|
264
254
|
* Persistable snapshot of a Machine produced by {@link Machine.serialize}
|
|
265
255
|
* and consumed by {@link deserialize}. Carries the current state, the
|
|
@@ -268,7 +258,7 @@ declare type FslTheme = typeof FslThemes[number];
|
|
|
268
258
|
*
|
|
269
259
|
* @typeParam DataType - The type of the user-supplied data payload (`mDT`).
|
|
270
260
|
*/
|
|
271
|
-
|
|
261
|
+
type JssmSerialization<DataType> = {
|
|
272
262
|
jssm_version: string;
|
|
273
263
|
timestamp: number;
|
|
274
264
|
comment?: string | undefined;
|
|
@@ -296,7 +286,7 @@ declare type JssmSerialization<DataType> = {
|
|
|
296
286
|
* @see JssmGroupRef
|
|
297
287
|
* @see JssmGroupRegistry
|
|
298
288
|
*/
|
|
299
|
-
|
|
289
|
+
type JssmGroupMemberRef = {
|
|
300
290
|
kind: 'state';
|
|
301
291
|
name: string;
|
|
302
292
|
} | {
|
|
@@ -322,7 +312,7 @@ declare type JssmGroupMemberRef = {
|
|
|
322
312
|
*
|
|
323
313
|
* @see JssmGroupMemberRef
|
|
324
314
|
*/
|
|
325
|
-
|
|
315
|
+
type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
|
|
326
316
|
/**
|
|
327
317
|
* The compiled boundary-hook surface for a single subject (a group or a
|
|
328
318
|
* state): the action to run on entry (`onEnter`) and/or on exit (`onExit`).
|
|
@@ -332,7 +322,7 @@ declare type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
|
|
|
332
322
|
*
|
|
333
323
|
* @see JssmHookDeclaration
|
|
334
324
|
*/
|
|
335
|
-
|
|
325
|
+
type JssmBoundaryHooks = {
|
|
336
326
|
onEnter?: string;
|
|
337
327
|
onExit?: string;
|
|
338
328
|
};
|
|
@@ -343,7 +333,7 @@ declare type JssmBoundaryHooks = {
|
|
|
343
333
|
*
|
|
344
334
|
* @see JssmHookDeclaration
|
|
345
335
|
*/
|
|
346
|
-
|
|
336
|
+
type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
|
|
347
337
|
/**
|
|
348
338
|
* Maps each plain state name that has at least one boundary hook to its
|
|
349
339
|
* merged {@link JssmBoundaryHooks}. The state-subject analogue of
|
|
@@ -351,7 +341,7 @@ declare type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
|
|
|
351
341
|
*
|
|
352
342
|
* @see JssmHookDeclaration
|
|
353
343
|
*/
|
|
354
|
-
|
|
344
|
+
type JssmStateHooks = Map<string, JssmBoundaryHooks>;
|
|
355
345
|
/**
|
|
356
346
|
* Declaration of a named property that a machine's states may carry.
|
|
357
347
|
* Set `required: true` to force every state to define the property, or
|
|
@@ -364,15 +354,15 @@ declare type JssmStateHooks = Map<string, JssmBoundaryHooks>;
|
|
|
364
354
|
* may carry only the serialized `name`, and global property definitions
|
|
365
355
|
* never set them.
|
|
366
356
|
*/
|
|
367
|
-
|
|
357
|
+
type JssmPropertyDefinition = {
|
|
368
358
|
name: string;
|
|
369
359
|
default_value?: any;
|
|
370
360
|
required?: boolean;
|
|
371
361
|
property?: string;
|
|
372
362
|
state?: string;
|
|
373
363
|
};
|
|
374
|
-
|
|
375
|
-
|
|
364
|
+
type JssmTransitionPermitter<DataType> = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean;
|
|
365
|
+
type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
|
|
376
366
|
/**
|
|
377
367
|
* A single directed transition (edge) within a state machine. Captures
|
|
378
368
|
* both the topology (`from` / `to`), the FSL semantics (`kind`,
|
|
@@ -384,7 +374,7 @@ declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitt
|
|
|
384
374
|
* @typeParam StateType - The state-name type (usually `string`).
|
|
385
375
|
* @typeParam DataType - The machine's data payload type (`mDT`).
|
|
386
376
|
*/
|
|
387
|
-
|
|
377
|
+
type JssmTransition<StateType, DataType> = {
|
|
388
378
|
from: StateType;
|
|
389
379
|
to: StateType;
|
|
390
380
|
after_time?: number;
|
|
@@ -398,12 +388,12 @@ declare type JssmTransition<StateType, DataType> = {
|
|
|
398
388
|
main_path: boolean;
|
|
399
389
|
};
|
|
400
390
|
/** A list of {@link JssmTransition}s — the edge set of a machine. */
|
|
401
|
-
|
|
391
|
+
type JssmTransitions<StateType, DataType> = JssmTransition<StateType, DataType>[];
|
|
402
392
|
/**
|
|
403
393
|
* The set of states that can immediately precede or follow a given state.
|
|
404
394
|
* Returned by jssm helpers that report a state's connectivity in the graph.
|
|
405
395
|
*/
|
|
406
|
-
|
|
396
|
+
type JssmTransitionList = {
|
|
407
397
|
entrances: Array<StateType$1>;
|
|
408
398
|
exits: Array<StateType$1>;
|
|
409
399
|
};
|
|
@@ -412,7 +402,7 @@ declare type JssmTransitionList = {
|
|
|
412
402
|
* states it can be reached from, the set of states it can transition to,
|
|
413
403
|
* and whether reaching it constitutes "completing" the machine.
|
|
414
404
|
*/
|
|
415
|
-
|
|
405
|
+
type JssmGenericState = {
|
|
416
406
|
from: Array<StateType$1>;
|
|
417
407
|
name: StateType$1;
|
|
418
408
|
to: Array<StateType$1>;
|
|
@@ -425,7 +415,7 @@ declare type JssmGenericState = {
|
|
|
425
415
|
* `internal_state_impl_version` field exists so that consumers can detect
|
|
426
416
|
* shape changes if this representation evolves.
|
|
427
417
|
*/
|
|
428
|
-
|
|
418
|
+
type JssmMachineInternalState<DataType> = {
|
|
429
419
|
internal_state_impl_version: 1;
|
|
430
420
|
state: StateType$1;
|
|
431
421
|
states: Map<StateType$1, JssmGenericState>;
|
|
@@ -435,8 +425,8 @@ declare type JssmMachineInternalState<DataType> = {
|
|
|
435
425
|
reverse_actions: Map<StateType$1, Map<StateType$1, number>>;
|
|
436
426
|
edges: Array<JssmTransition<StateType$1, DataType>>;
|
|
437
427
|
};
|
|
438
|
-
|
|
439
|
-
|
|
428
|
+
type JssmStatePermitter<DataType> = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean;
|
|
429
|
+
type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataType> | Array<JssmStatePermitter<DataType>>;
|
|
440
430
|
/**
|
|
441
431
|
* A source span produced by the FSL parser when `parse(input, { locations:
|
|
442
432
|
* true })` is used. Mirrors PEG.js's native `location()` shape: byte
|
|
@@ -448,12 +438,12 @@ declare type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataTyp
|
|
|
448
438
|
* // end: { offset: 7, line: 1, column: 8 } }
|
|
449
439
|
* ```
|
|
450
440
|
*/
|
|
451
|
-
|
|
441
|
+
type FslSourcePoint = {
|
|
452
442
|
offset: number;
|
|
453
443
|
line: number;
|
|
454
444
|
column: number;
|
|
455
445
|
};
|
|
456
|
-
|
|
446
|
+
type FslSourceLocation = {
|
|
457
447
|
start: FslSourcePoint;
|
|
458
448
|
end: FslSourcePoint;
|
|
459
449
|
};
|
|
@@ -462,7 +452,7 @@ declare type FslSourceLocation = {
|
|
|
462
452
|
* raw form produced by the parser before being condensed into a
|
|
463
453
|
* {@link JssmStateDeclaration}.
|
|
464
454
|
*/
|
|
465
|
-
|
|
455
|
+
type JssmStateDeclarationRule = {
|
|
466
456
|
key: string;
|
|
467
457
|
value: any;
|
|
468
458
|
name?: string;
|
|
@@ -474,7 +464,7 @@ declare type JssmStateDeclarationRule = {
|
|
|
474
464
|
* rule list (`declarations`) and the well-known styling fields jssm-viz
|
|
475
465
|
* understands. Returned by {@link Machine.state_declaration}.
|
|
476
466
|
*/
|
|
477
|
-
|
|
467
|
+
type JssmStateDeclaration = {
|
|
478
468
|
declarations: Array<JssmStateDeclarationRule>;
|
|
479
469
|
shape?: JssmShape;
|
|
480
470
|
color?: JssmColor;
|
|
@@ -497,44 +487,44 @@ declare type JssmStateDeclaration = {
|
|
|
497
487
|
* optional. Used as the value type for theme entries and for default
|
|
498
488
|
* state configuration where most fields will be inherited or merged.
|
|
499
489
|
*/
|
|
500
|
-
|
|
501
|
-
|
|
490
|
+
type JssmStateConfig = Partial<JssmStateDeclaration>;
|
|
491
|
+
type JssmStateStyleShape = {
|
|
502
492
|
key: 'shape';
|
|
503
493
|
value: JssmShape;
|
|
504
494
|
};
|
|
505
|
-
|
|
495
|
+
type JssmStateStyleColor = {
|
|
506
496
|
key: 'color';
|
|
507
497
|
value: JssmColor;
|
|
508
498
|
};
|
|
509
|
-
|
|
499
|
+
type JssmStateStyleTextColor = {
|
|
510
500
|
key: 'text-color';
|
|
511
501
|
value: JssmColor;
|
|
512
502
|
};
|
|
513
|
-
|
|
503
|
+
type JssmStateStyleCorners = {
|
|
514
504
|
key: 'corners';
|
|
515
505
|
value: JssmCorner;
|
|
516
506
|
};
|
|
517
|
-
|
|
507
|
+
type JssmStateStyleLineStyle = {
|
|
518
508
|
key: 'line-style';
|
|
519
509
|
value: JssmLineStyle;
|
|
520
510
|
};
|
|
521
|
-
|
|
511
|
+
type JssmStateStyleStateLabel = {
|
|
522
512
|
key: 'state-label';
|
|
523
513
|
value: string;
|
|
524
514
|
};
|
|
525
|
-
|
|
515
|
+
type JssmStateStyleBackgroundColor = {
|
|
526
516
|
key: 'background-color';
|
|
527
517
|
value: JssmColor;
|
|
528
518
|
};
|
|
529
|
-
|
|
519
|
+
type JssmStateStyleBorderColor = {
|
|
530
520
|
key: 'border-color';
|
|
531
521
|
value: JssmColor;
|
|
532
522
|
};
|
|
533
|
-
|
|
523
|
+
type JssmStateStyleImage = {
|
|
534
524
|
key: 'image';
|
|
535
525
|
value: string;
|
|
536
526
|
};
|
|
537
|
-
|
|
527
|
+
type JssmStateStyleUrl = {
|
|
538
528
|
key: 'url';
|
|
539
529
|
value: string;
|
|
540
530
|
};
|
|
@@ -543,13 +533,13 @@ declare type JssmStateStyleUrl = {
|
|
|
543
533
|
* a state's style configuration. The `key` discriminator selects which
|
|
544
534
|
* member, and the `value` is typed accordingly.
|
|
545
535
|
*/
|
|
546
|
-
|
|
536
|
+
type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleStateLabel | JssmStateStyleBorderColor | JssmStateStyleImage | JssmStateStyleUrl;
|
|
547
537
|
/**
|
|
548
538
|
* An ordered list of {@link JssmStateStyleKey} entries. Used by the
|
|
549
539
|
* `default_*_state_config` machine config options to provide a fallback
|
|
550
540
|
* style stack.
|
|
551
541
|
*/
|
|
552
|
-
|
|
542
|
+
type JssmStateStyleKeyList = JssmStateStyleKey[];
|
|
553
543
|
/**
|
|
554
544
|
* The graph-wide default edge colour style item, produced by the
|
|
555
545
|
* `edge-color`/`edge_color` line inside a `transition: {}` (or `graph: {}`)
|
|
@@ -557,7 +547,7 @@ declare type JssmStateStyleKeyList = JssmStateStyleKey[];
|
|
|
557
547
|
* applies to edges rather than nodes, and because it carries the legacy
|
|
558
548
|
* `graph_default_edge_color` key the grammar emits.
|
|
559
549
|
*/
|
|
560
|
-
|
|
550
|
+
type JssmGraphDefaultEdgeColor = {
|
|
561
551
|
key: 'graph_default_edge_color';
|
|
562
552
|
value: JssmColor;
|
|
563
553
|
};
|
|
@@ -569,7 +559,7 @@ declare type JssmGraphDefaultEdgeColor = {
|
|
|
569
559
|
*
|
|
570
560
|
* @see JssmTransitionConfig
|
|
571
561
|
*/
|
|
572
|
-
|
|
562
|
+
type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeColor;
|
|
573
563
|
/**
|
|
574
564
|
* The compiled value of a `transition: {}` config block: an ordered list of
|
|
575
565
|
* edge-default style items. V1 mirrors the state-style shape used by
|
|
@@ -584,7 +574,7 @@ declare type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeCo
|
|
|
584
574
|
*
|
|
585
575
|
* @see JssmGraphConfig
|
|
586
576
|
*/
|
|
587
|
-
|
|
577
|
+
type JssmTransitionConfig = JssmTransitionStyleKey[];
|
|
588
578
|
/**
|
|
589
579
|
* Graph-scope default-config style items folded from the deprecated
|
|
590
580
|
* top-level graph keywords (`graph_layout`, `graph_bg_color`,
|
|
@@ -592,7 +582,7 @@ declare type JssmTransitionConfig = JssmTransitionStyleKey[];
|
|
|
592
582
|
* default) into the consolidated `graph: {}` config. Each carries the
|
|
593
583
|
* legacy parse key so downstream consumers can disambiguate.
|
|
594
584
|
*/
|
|
595
|
-
|
|
585
|
+
type JssmGraphAliasKey = {
|
|
596
586
|
key: 'graph_layout';
|
|
597
587
|
value: JssmLayout;
|
|
598
588
|
} | {
|
|
@@ -616,7 +606,7 @@ declare type JssmGraphAliasKey = {
|
|
|
616
606
|
*
|
|
617
607
|
* @see JssmGraphConfig
|
|
618
608
|
*/
|
|
619
|
-
|
|
609
|
+
type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
|
|
620
610
|
/**
|
|
621
611
|
* The compiled value of a `graph: {}` config block: an ordered list of
|
|
622
612
|
* graph-default style items. The compiler folds the deprecated top-level
|
|
@@ -633,7 +623,7 @@ declare type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
|
|
|
633
623
|
*
|
|
634
624
|
* @see JssmTransitionConfig
|
|
635
625
|
*/
|
|
636
|
-
|
|
626
|
+
type JssmGraphConfig = JssmGraphStyleKey[];
|
|
637
627
|
/**
|
|
638
628
|
* Complete shape of a jssm-viz theme. A theme provides a style block for
|
|
639
629
|
* each kind of state (`state`, `hooked`, `start`, `end`, `terminal`) as
|
|
@@ -645,7 +635,7 @@ declare type JssmGraphConfig = JssmGraphStyleKey[];
|
|
|
645
635
|
* Most user-defined themes should be typed as {@link JssmTheme} (the
|
|
646
636
|
* `Partial` of this) so that omitted fields fall back to the base theme.
|
|
647
637
|
*/
|
|
648
|
-
|
|
638
|
+
type JssmBaseTheme = {
|
|
649
639
|
name: string;
|
|
650
640
|
state: JssmStateConfig;
|
|
651
641
|
hooked: JssmStateConfig;
|
|
@@ -682,28 +672,28 @@ declare type JssmBaseTheme = {
|
|
|
682
672
|
* (fsl#1334), read by the all-widgets web control: a stochastic run-count
|
|
683
673
|
* and the panels the machine requests under `request` panel mode.
|
|
684
674
|
*/
|
|
685
|
-
|
|
675
|
+
type JssmEditorConfig = {
|
|
686
676
|
stochastic_run_count?: number;
|
|
687
677
|
panels?: Array<string>;
|
|
688
678
|
};
|
|
689
679
|
/** Which stochastic view a run batch produces. */
|
|
690
|
-
|
|
680
|
+
type JssmStochasticMode = 'montecarlo' | 'steady_state';
|
|
691
681
|
/** Options for {@link Machine.stochastic_summary} / {@link Machine.stochastic_runs}. */
|
|
692
|
-
|
|
682
|
+
type JssmStochasticOptions = {
|
|
693
683
|
mode?: JssmStochasticMode;
|
|
694
684
|
runs?: number;
|
|
695
685
|
max_steps?: number;
|
|
696
686
|
seed?: number;
|
|
697
687
|
};
|
|
698
688
|
/** One walk's result, yielded by {@link Machine.stochastic_runs}. */
|
|
699
|
-
|
|
689
|
+
type JssmStochasticRun = {
|
|
700
690
|
states: Array<string>;
|
|
701
691
|
edges: Array<string>;
|
|
702
692
|
length: number;
|
|
703
693
|
terminated: boolean;
|
|
704
694
|
};
|
|
705
695
|
/** Aggregate statistics over a stochastic run batch. */
|
|
706
|
-
|
|
696
|
+
type JssmStochasticSummary = {
|
|
707
697
|
mode: JssmStochasticMode;
|
|
708
698
|
runs: number;
|
|
709
699
|
seed: number;
|
|
@@ -714,7 +704,7 @@ declare type JssmStochasticSummary = {
|
|
|
714
704
|
terminal_reached?: number;
|
|
715
705
|
capped?: number;
|
|
716
706
|
};
|
|
717
|
-
|
|
707
|
+
type JssmGenericConfig<StateType, DataType> = {
|
|
718
708
|
graph_layout?: JssmLayout;
|
|
719
709
|
complete?: Array<StateType>;
|
|
720
710
|
transitions: JssmTransitions<StateType, DataType>;
|
|
@@ -822,7 +812,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
822
812
|
*
|
|
823
813
|
* @internal
|
|
824
814
|
*/
|
|
825
|
-
|
|
815
|
+
type JssmCompileSe<StateType, mDT> = {
|
|
826
816
|
to: StateType;
|
|
827
817
|
se?: JssmCompileSe<StateType, mDT>;
|
|
828
818
|
kind: JssmArrow;
|
|
@@ -837,120 +827,120 @@ declare type JssmCompileSe<StateType, mDT> = {
|
|
|
837
827
|
l_action_loc?: FslSourceLocation;
|
|
838
828
|
r_action_loc?: FslSourceLocation;
|
|
839
829
|
};
|
|
840
|
-
|
|
830
|
+
type BasicHookDescription<mDT> = {
|
|
841
831
|
kind: 'hook';
|
|
842
832
|
from: string;
|
|
843
833
|
to: string;
|
|
844
834
|
handler: HookHandler<mDT>;
|
|
845
835
|
};
|
|
846
|
-
|
|
836
|
+
type HookDescriptionWithAction<mDT> = {
|
|
847
837
|
kind: 'named';
|
|
848
838
|
from: string;
|
|
849
839
|
to: string;
|
|
850
840
|
action: string;
|
|
851
841
|
handler: HookHandler<mDT>;
|
|
852
842
|
};
|
|
853
|
-
|
|
843
|
+
type StandardTransitionHook<mDT> = {
|
|
854
844
|
kind: 'standard transition';
|
|
855
845
|
handler: HookHandler<mDT>;
|
|
856
846
|
};
|
|
857
|
-
|
|
847
|
+
type MainTransitionHook<mDT> = {
|
|
858
848
|
kind: 'main transition';
|
|
859
849
|
handler: HookHandler<mDT>;
|
|
860
850
|
};
|
|
861
|
-
|
|
851
|
+
type ForcedTransitionHook<mDT> = {
|
|
862
852
|
kind: 'forced transition';
|
|
863
853
|
handler: HookHandler<mDT>;
|
|
864
854
|
};
|
|
865
|
-
|
|
855
|
+
type AnyTransitionHook<mDT> = {
|
|
866
856
|
kind: 'any transition';
|
|
867
857
|
handler: HookHandler<mDT>;
|
|
868
858
|
};
|
|
869
|
-
|
|
859
|
+
type GlobalActionHook<mDT> = {
|
|
870
860
|
kind: 'global action';
|
|
871
861
|
action: string;
|
|
872
862
|
handler: HookHandler<mDT>;
|
|
873
863
|
};
|
|
874
|
-
|
|
864
|
+
type AnyActionHook<mDT> = {
|
|
875
865
|
kind: 'any action';
|
|
876
866
|
handler: HookHandler<mDT>;
|
|
877
867
|
};
|
|
878
|
-
|
|
868
|
+
type EntryHook<mDT> = {
|
|
879
869
|
kind: 'entry';
|
|
880
870
|
to: string;
|
|
881
871
|
handler: HookHandler<mDT>;
|
|
882
872
|
};
|
|
883
|
-
|
|
873
|
+
type ExitHook<mDT> = {
|
|
884
874
|
kind: 'exit';
|
|
885
875
|
from: string;
|
|
886
876
|
handler: HookHandler<mDT>;
|
|
887
877
|
};
|
|
888
|
-
|
|
878
|
+
type AfterHook<mDT> = {
|
|
889
879
|
kind: 'after';
|
|
890
880
|
from: string;
|
|
891
881
|
handler: HookHandler<mDT>;
|
|
892
882
|
};
|
|
893
|
-
|
|
883
|
+
type PostBasicHookDescription<mDT> = {
|
|
894
884
|
kind: 'post hook';
|
|
895
885
|
from: string;
|
|
896
886
|
to: string;
|
|
897
887
|
handler: PostHookHandler<mDT>;
|
|
898
888
|
};
|
|
899
|
-
|
|
889
|
+
type PostHookDescriptionWithAction<mDT> = {
|
|
900
890
|
kind: 'post named';
|
|
901
891
|
from: string;
|
|
902
892
|
to: string;
|
|
903
893
|
action: string;
|
|
904
894
|
handler: PostHookHandler<mDT>;
|
|
905
895
|
};
|
|
906
|
-
|
|
896
|
+
type PostStandardTransitionHook<mDT> = {
|
|
907
897
|
kind: 'post standard transition';
|
|
908
898
|
handler: PostHookHandler<mDT>;
|
|
909
899
|
};
|
|
910
|
-
|
|
900
|
+
type PostMainTransitionHook<mDT> = {
|
|
911
901
|
kind: 'post main transition';
|
|
912
902
|
handler: PostHookHandler<mDT>;
|
|
913
903
|
};
|
|
914
|
-
|
|
904
|
+
type PostForcedTransitionHook<mDT> = {
|
|
915
905
|
kind: 'post forced transition';
|
|
916
906
|
handler: PostHookHandler<mDT>;
|
|
917
907
|
};
|
|
918
|
-
|
|
908
|
+
type PostAnyTransitionHook<mDT> = {
|
|
919
909
|
kind: 'post any transition';
|
|
920
910
|
handler: PostHookHandler<mDT>;
|
|
921
911
|
};
|
|
922
|
-
|
|
912
|
+
type PostGlobalActionHook<mDT> = {
|
|
923
913
|
kind: 'post global action';
|
|
924
914
|
action: string;
|
|
925
915
|
handler: PostHookHandler<mDT>;
|
|
926
916
|
};
|
|
927
|
-
|
|
917
|
+
type PostAnyActionHook<mDT> = {
|
|
928
918
|
kind: 'post any action';
|
|
929
919
|
handler: PostHookHandler<mDT>;
|
|
930
920
|
};
|
|
931
|
-
|
|
921
|
+
type PostEntryHook<mDT> = {
|
|
932
922
|
kind: 'post entry';
|
|
933
923
|
to: string;
|
|
934
924
|
handler: PostHookHandler<mDT>;
|
|
935
925
|
};
|
|
936
|
-
|
|
926
|
+
type PostExitHook<mDT> = {
|
|
937
927
|
kind: 'post exit';
|
|
938
928
|
from: string;
|
|
939
929
|
handler: PostHookHandler<mDT>;
|
|
940
930
|
};
|
|
941
|
-
|
|
931
|
+
type PreEverythingHook<mDT> = {
|
|
942
932
|
kind: 'pre everything';
|
|
943
933
|
handler: EverythingHookHandler<mDT>;
|
|
944
934
|
};
|
|
945
|
-
|
|
935
|
+
type EverythingHook<mDT> = {
|
|
946
936
|
kind: 'everything';
|
|
947
937
|
handler: EverythingHookHandler<mDT>;
|
|
948
938
|
};
|
|
949
|
-
|
|
939
|
+
type PrePostEverythingHook<mDT> = {
|
|
950
940
|
kind: 'pre post everything';
|
|
951
941
|
handler: PostEverythingHookHandler<mDT>;
|
|
952
942
|
};
|
|
953
|
-
|
|
943
|
+
type PostEverythingHook<mDT> = {
|
|
954
944
|
kind: 'post everything';
|
|
955
945
|
handler: PostEverythingHookHandler<mDT>;
|
|
956
946
|
};
|
|
@@ -968,13 +958,13 @@ declare type PostEverythingHook<mDT> = {
|
|
|
968
958
|
* variants (`'post *'`) cannot veto and are invoked only after a
|
|
969
959
|
* successful transition.
|
|
970
960
|
*/
|
|
971
|
-
|
|
961
|
+
type HookDescription<mDT> = BasicHookDescription<mDT> | HookDescriptionWithAction<mDT> | GlobalActionHook<mDT> | AnyActionHook<mDT> | StandardTransitionHook<mDT> | MainTransitionHook<mDT> | ForcedTransitionHook<mDT> | AnyTransitionHook<mDT> | EntryHook<mDT> | ExitHook<mDT> | AfterHook<mDT> | PostBasicHookDescription<mDT> | PostHookDescriptionWithAction<mDT> | PostGlobalActionHook<mDT> | PostAnyActionHook<mDT> | PostStandardTransitionHook<mDT> | PostMainTransitionHook<mDT> | PostForcedTransitionHook<mDT> | PostAnyTransitionHook<mDT> | PostEntryHook<mDT> | PostExitHook<mDT> | PreEverythingHook<mDT> | EverythingHook<mDT> | PrePostEverythingHook<mDT> | PostEverythingHook<mDT>;
|
|
972
962
|
/**
|
|
973
963
|
* Whether an observational hook runs in the pre-transition phase (where it
|
|
974
964
|
* may veto/mutate the transition) or the post-transition phase (a pure
|
|
975
965
|
* observer that runs only after a successful transition commits).
|
|
976
966
|
*/
|
|
977
|
-
|
|
967
|
+
type HookPhase = 'pre' | 'post';
|
|
978
968
|
/**
|
|
979
969
|
* Normalized description of the target a registry entry is bound to. Exactly
|
|
980
970
|
* one scope variant applies; the present fields depend on the scope:
|
|
@@ -985,7 +975,7 @@ declare type HookPhase = 'pre' | 'post';
|
|
|
985
975
|
* - `'global'` carries no further keys (it matches everything),
|
|
986
976
|
* - `'group'` carries `group` (a named state group with a boundary hook).
|
|
987
977
|
*/
|
|
988
|
-
|
|
978
|
+
type HookTarget = {
|
|
989
979
|
scope: 'edge';
|
|
990
980
|
from: StateType$1;
|
|
991
981
|
to: StateType$1;
|
|
@@ -1009,7 +999,7 @@ declare type HookTarget = {
|
|
|
1009
999
|
* covers only the programmatically-registered observational hooks), so the
|
|
1010
1000
|
* registry widens its `kind` field with them.
|
|
1011
1001
|
*/
|
|
1012
|
-
|
|
1002
|
+
type HookBoundaryKind = 'group enter' | 'group exit' | 'state enter' | 'state exit';
|
|
1013
1003
|
/**
|
|
1014
1004
|
* One row of the generated uniform observational-hook registry. `kind` is
|
|
1015
1005
|
* either an original {@link HookDescription} discriminator (e.g. `'entry'`,
|
|
@@ -1018,7 +1008,7 @@ declare type HookBoundaryKind = 'group enter' | 'group exit' | 'state enter' | '
|
|
|
1018
1008
|
* normalized {@link HookTarget} it is bound to. The triple
|
|
1019
1009
|
* `(kind, target, phase)` is the registry key the spec calls for.
|
|
1020
1010
|
*/
|
|
1021
|
-
|
|
1011
|
+
type HookRegistryEntry = {
|
|
1022
1012
|
kind: HookDescription<unknown>['kind'] | HookBoundaryKind;
|
|
1023
1013
|
phase: HookPhase;
|
|
1024
1014
|
target: HookTarget;
|
|
@@ -1031,7 +1021,7 @@ declare type HookRegistryEntry = {
|
|
|
1031
1021
|
* mirrors the spec's `hooks_on(state)` / `hooks_on(from→to)` /
|
|
1032
1022
|
* `hooks_on(action)` / `hooks_on(&group)` set with one parameter shape.
|
|
1033
1023
|
*/
|
|
1034
|
-
|
|
1024
|
+
type HookQuery = StateType$1 | {
|
|
1035
1025
|
from: StateType$1;
|
|
1036
1026
|
to: StateType$1;
|
|
1037
1027
|
action?: string;
|
|
@@ -1048,7 +1038,7 @@ declare type HookQuery = StateType$1 | {
|
|
|
1048
1038
|
* `data` overrides the data observed by other hooks in the same chain,
|
|
1049
1039
|
* and `next_data` overrides the data committed after the transition.
|
|
1050
1040
|
*/
|
|
1051
|
-
|
|
1041
|
+
type HookComplexResult<mDT> = {
|
|
1052
1042
|
pass: boolean;
|
|
1053
1043
|
state?: StateType$1;
|
|
1054
1044
|
data?: mDT;
|
|
@@ -1060,7 +1050,7 @@ declare type HookComplexResult<mDT> = {
|
|
|
1060
1050
|
* a {@link HookComplexResult} that additionally rewrites the next state
|
|
1061
1051
|
* and/or the next data payload.
|
|
1062
1052
|
*/
|
|
1063
|
-
|
|
1053
|
+
type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
|
|
1064
1054
|
/**
|
|
1065
1055
|
* Context object passed to every {@link HookHandler}. `data` is the
|
|
1066
1056
|
* data payload as it stands before the transition, and `next_data` is
|
|
@@ -1068,7 +1058,7 @@ declare type HookResult<mDT> = true | false | undefined | void | HookComplexResu
|
|
|
1068
1058
|
* handlers may inspect or mutate the latter via a
|
|
1069
1059
|
* {@link HookComplexResult} return value.
|
|
1070
1060
|
*/
|
|
1071
|
-
|
|
1061
|
+
type HookContext<mDT> = {
|
|
1072
1062
|
data: mDT;
|
|
1073
1063
|
next_data: mDT;
|
|
1074
1064
|
};
|
|
@@ -1078,7 +1068,7 @@ declare type HookContext<mDT> = {
|
|
|
1078
1068
|
* {@link HookContext} with `hook_name`, which identifies which specific
|
|
1079
1069
|
* hook fired so a single handler can route on it.
|
|
1080
1070
|
*/
|
|
1081
|
-
|
|
1071
|
+
type EverythingHookContext<mDT> = HookContext<mDT> & {
|
|
1082
1072
|
hook_name: string;
|
|
1083
1073
|
};
|
|
1084
1074
|
/**
|
|
@@ -1088,38 +1078,38 @@ declare type EverythingHookContext<mDT> = HookContext<mDT> & {
|
|
|
1088
1078
|
* result allows it, and a {@link HookComplexResult} can additionally
|
|
1089
1079
|
* rewrite the next state or next data.
|
|
1090
1080
|
*/
|
|
1091
|
-
|
|
1081
|
+
type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
|
|
1092
1082
|
/**
|
|
1093
1083
|
* Signature of a post-transition hook handler. Invoked after a successful
|
|
1094
1084
|
* transition has been committed; the return value is ignored (the
|
|
1095
1085
|
* transition cannot be undone).
|
|
1096
1086
|
*/
|
|
1097
|
-
|
|
1087
|
+
type PostHookHandler<mDT> = (hook_context: HookContext<mDT>) => void;
|
|
1098
1088
|
/**
|
|
1099
1089
|
* Signature of an "everything" pre-transition hook handler. Like
|
|
1100
1090
|
* {@link HookHandler} but receives an {@link EverythingHookContext} so the
|
|
1101
1091
|
* handler can dispatch on `hook_name`.
|
|
1102
1092
|
*/
|
|
1103
|
-
|
|
1093
|
+
type EverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => HookResult<mDT>;
|
|
1104
1094
|
/**
|
|
1105
1095
|
* Signature of an "everything" post-transition hook handler. Like
|
|
1106
1096
|
* {@link PostHookHandler} but receives an {@link EverythingHookContext}.
|
|
1107
1097
|
* The return value is ignored.
|
|
1108
1098
|
*/
|
|
1109
|
-
|
|
1099
|
+
type PostEverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => void;
|
|
1110
1100
|
/**
|
|
1111
1101
|
* Bounded history of recently-visited states paired with the data payload
|
|
1112
1102
|
* observed in each. Backed by `circular_buffer_js`, so the oldest entry
|
|
1113
1103
|
* is dropped silently once the configured capacity is exceeded.
|
|
1114
1104
|
*/
|
|
1115
|
-
|
|
1105
|
+
type JssmHistory<mDT> = circular_buffer<[StateType$1, mDT]>;
|
|
1116
1106
|
/**
|
|
1117
1107
|
* Pluggable random-number-generator function shape. Must return a value
|
|
1118
1108
|
* in `[0, 1)` exactly as `Math.random` does. Supplied via the
|
|
1119
1109
|
* `rng_seed`-aware machine configuration so that stochastic models can be
|
|
1120
1110
|
* made reproducible.
|
|
1121
1111
|
*/
|
|
1122
|
-
|
|
1112
|
+
type JssmRng = () => number;
|
|
1123
1113
|
/**
|
|
1124
1114
|
* All event names that {@link Machine.on} accepts. These are observation
|
|
1125
1115
|
* events fired by the machine in addition to (not in place of) the hook
|
|
@@ -1127,14 +1117,14 @@ declare type JssmRng = () => number;
|
|
|
1127
1117
|
*
|
|
1128
1118
|
* @see Machine.on
|
|
1129
1119
|
*/
|
|
1130
|
-
|
|
1120
|
+
type JssmEventName = 'transition' | 'rejection' | 'action' | 'entry' | 'exit' | 'terminal' | 'complete' | 'error' | 'data-change' | 'override' | 'timeout' | 'hook-registration' | 'hook-removal';
|
|
1131
1121
|
/**
|
|
1132
1122
|
* Detail payload fired with a `transition` event. Carries the resolved
|
|
1133
1123
|
* source and target, the action name (if the transition was driven by an
|
|
1134
1124
|
* action), the data observed before and after the change, the edge kind,
|
|
1135
1125
|
* and whether the call was a forced transition.
|
|
1136
1126
|
*/
|
|
1137
|
-
|
|
1127
|
+
type JssmTransitionEventDetail<mDT> = {
|
|
1138
1128
|
from: StateType$1;
|
|
1139
1129
|
to: StateType$1;
|
|
1140
1130
|
action?: StateType$1;
|
|
@@ -1149,7 +1139,7 @@ declare type JssmTransitionEventDetail<mDT> = {
|
|
|
1149
1139
|
* and why. `reason` is `'invalid'` when no edge existed, `'hook'` when
|
|
1150
1140
|
* a hook handler vetoed; `hook_name` is set when `reason` is `'hook'`.
|
|
1151
1141
|
*/
|
|
1152
|
-
|
|
1142
|
+
type JssmRejectionEventDetail<mDT> = {
|
|
1153
1143
|
from: StateType$1;
|
|
1154
1144
|
to: StateType$1;
|
|
1155
1145
|
action?: StateType$1;
|
|
@@ -1163,7 +1153,7 @@ declare type JssmRejectionEventDetail<mDT> = {
|
|
|
1163
1153
|
* Detail payload fired with an `action` event. Fires when an action is
|
|
1164
1154
|
* attempted, before transition validation runs.
|
|
1165
1155
|
*/
|
|
1166
|
-
|
|
1156
|
+
type JssmActionEventDetail<mDT> = {
|
|
1167
1157
|
action: StateType$1;
|
|
1168
1158
|
from: StateType$1;
|
|
1169
1159
|
to?: StateType$1;
|
|
@@ -1175,7 +1165,7 @@ declare type JssmActionEventDetail<mDT> = {
|
|
|
1175
1165
|
* state. `from` is the predecessor state, if any. `action` is the
|
|
1176
1166
|
* action that drove the entry, if any.
|
|
1177
1167
|
*/
|
|
1178
|
-
|
|
1168
|
+
type JssmEntryEventDetail<mDT> = {
|
|
1179
1169
|
state: StateType$1;
|
|
1180
1170
|
from?: StateType$1;
|
|
1181
1171
|
action?: StateType$1;
|
|
@@ -1186,7 +1176,7 @@ declare type JssmEntryEventDetail<mDT> = {
|
|
|
1186
1176
|
* state. `to` is the next state, if any. `action` is the action that
|
|
1187
1177
|
* drove the exit, if any.
|
|
1188
1178
|
*/
|
|
1189
|
-
|
|
1179
|
+
type JssmExitEventDetail<mDT> = {
|
|
1190
1180
|
state: StateType$1;
|
|
1191
1181
|
to?: StateType$1;
|
|
1192
1182
|
action?: StateType$1;
|
|
@@ -1196,7 +1186,7 @@ declare type JssmExitEventDetail<mDT> = {
|
|
|
1196
1186
|
* Detail payload fired with a `terminal` event. Indicates that the
|
|
1197
1187
|
* machine has reached a state with no outgoing edges.
|
|
1198
1188
|
*/
|
|
1199
|
-
|
|
1189
|
+
type JssmTerminalEventDetail<mDT> = {
|
|
1200
1190
|
state: StateType$1;
|
|
1201
1191
|
data: mDT;
|
|
1202
1192
|
};
|
|
@@ -1204,7 +1194,7 @@ declare type JssmTerminalEventDetail<mDT> = {
|
|
|
1204
1194
|
* Detail payload fired with a `complete` event. Indicates that the
|
|
1205
1195
|
* machine has reached a FSL `complete` state.
|
|
1206
1196
|
*/
|
|
1207
|
-
|
|
1197
|
+
type JssmCompleteEventDetail<mDT> = {
|
|
1208
1198
|
state: StateType$1;
|
|
1209
1199
|
data: mDT;
|
|
1210
1200
|
};
|
|
@@ -1214,7 +1204,7 @@ declare type JssmCompleteEventDetail<mDT> = {
|
|
|
1214
1204
|
* identify the event whose handler threw, and `handler` is the offending
|
|
1215
1205
|
* function so consumers can correlate / blame.
|
|
1216
1206
|
*/
|
|
1217
|
-
|
|
1207
|
+
type JssmErrorEventDetail = {
|
|
1218
1208
|
error: unknown;
|
|
1219
1209
|
source_event: JssmEventName;
|
|
1220
1210
|
source_detail: unknown;
|
|
@@ -1225,7 +1215,7 @@ declare type JssmErrorEventDetail = {
|
|
|
1225
1215
|
* machine's data payload is replaced. `old_data` is the value before the
|
|
1226
1216
|
* change; `new_data` is the value after.
|
|
1227
1217
|
*/
|
|
1228
|
-
|
|
1218
|
+
type JssmDataChangeEventDetail<mDT> = {
|
|
1229
1219
|
from?: StateType$1;
|
|
1230
1220
|
to?: StateType$1;
|
|
1231
1221
|
action?: StateType$1;
|
|
@@ -1237,7 +1227,7 @@ declare type JssmDataChangeEventDetail<mDT> = {
|
|
|
1237
1227
|
* Detail payload fired with an `override` event. Distinguishes a forced
|
|
1238
1228
|
* state replacement from a normal transition.
|
|
1239
1229
|
*/
|
|
1240
|
-
|
|
1230
|
+
type JssmOverrideEventDetail<mDT> = {
|
|
1241
1231
|
from: StateType$1;
|
|
1242
1232
|
to: StateType$1;
|
|
1243
1233
|
old_data: mDT;
|
|
@@ -1247,7 +1237,7 @@ declare type JssmOverrideEventDetail<mDT> = {
|
|
|
1247
1237
|
* Detail payload fired with a `timeout` event. Fires when a configured
|
|
1248
1238
|
* `after` clause causes an automatic transition.
|
|
1249
1239
|
*/
|
|
1250
|
-
|
|
1240
|
+
type JssmTimeoutEventDetail = {
|
|
1251
1241
|
from: StateType$1;
|
|
1252
1242
|
to: StateType$1;
|
|
1253
1243
|
after_time: number;
|
|
@@ -1257,7 +1247,7 @@ declare type JssmTimeoutEventDetail = {
|
|
|
1257
1247
|
* Mirrors the {@link HookDescription} so inspector tools can mirror the
|
|
1258
1248
|
* current hook set.
|
|
1259
1249
|
*/
|
|
1260
|
-
|
|
1250
|
+
type JssmHookLifecycleEventDetail<mDT> = {
|
|
1261
1251
|
description: HookDescription<mDT>;
|
|
1262
1252
|
};
|
|
1263
1253
|
/**
|
|
@@ -1265,7 +1255,7 @@ declare type JssmHookLifecycleEventDetail<mDT> = {
|
|
|
1265
1255
|
* payload. Drives the discriminated-union typing of {@link Machine.on},
|
|
1266
1256
|
* so `e.action` and friends only exist where they're meaningful.
|
|
1267
1257
|
*/
|
|
1268
|
-
|
|
1258
|
+
type JssmEventDetailMap<mDT> = {
|
|
1269
1259
|
'transition': JssmTransitionEventDetail<mDT>;
|
|
1270
1260
|
'rejection': JssmRejectionEventDetail<mDT>;
|
|
1271
1261
|
'action': JssmActionEventDetail<mDT>;
|
|
@@ -1286,7 +1276,7 @@ declare type JssmEventDetailMap<mDT> = {
|
|
|
1286
1276
|
* filter entry fire the handler. Events that don't list a filter key in
|
|
1287
1277
|
* v1 take no filter properties.
|
|
1288
1278
|
*/
|
|
1289
|
-
|
|
1279
|
+
type JssmEventFilterMap<mDT> = {
|
|
1290
1280
|
'transition': {
|
|
1291
1281
|
from?: StateType$1;
|
|
1292
1282
|
to?: StateType$1;
|
|
@@ -1314,19 +1304,19 @@ declare type JssmEventFilterMap<mDT> = {
|
|
|
1314
1304
|
* @typeparam mDT The type of the machine data member.
|
|
1315
1305
|
* @typeparam Ev The event name.
|
|
1316
1306
|
*/
|
|
1317
|
-
|
|
1307
|
+
type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev];
|
|
1318
1308
|
/**
|
|
1319
1309
|
* Per-event handler signature. Receives a detail object typed by event
|
|
1320
1310
|
* name, so `e.action` (etc.) only exist where they're meaningful.
|
|
1321
1311
|
* @typeparam mDT The type of the machine data member.
|
|
1322
1312
|
* @typeparam Ev The event name.
|
|
1323
1313
|
*/
|
|
1324
|
-
|
|
1314
|
+
type JssmEventHandler<mDT, Ev extends JssmEventName> = (detail: JssmEventDetailMap<mDT>[Ev]) => void;
|
|
1325
1315
|
/**
|
|
1326
1316
|
* Function returned by {@link Machine.on} and {@link Machine.once} that
|
|
1327
1317
|
* removes the subscription. Calling it more than once is a no-op.
|
|
1328
1318
|
*/
|
|
1329
|
-
|
|
1319
|
+
type JssmUnsubscribe = () => void;
|
|
1330
1320
|
|
|
1331
1321
|
/**
|
|
1332
1322
|
* String interning support for the jssm machine internals.
|
|
@@ -1395,7 +1385,7 @@ declare class Interner {
|
|
|
1395
1385
|
get size(): number;
|
|
1396
1386
|
}
|
|
1397
1387
|
|
|
1398
|
-
|
|
1388
|
+
type StateType = string;
|
|
1399
1389
|
|
|
1400
1390
|
/**
|
|
1401
1391
|
* Internal record holding a single registered event subscription: the
|
|
@@ -1404,7 +1394,7 @@ declare type StateType = string;
|
|
|
1404
1394
|
*
|
|
1405
1395
|
* @internal
|
|
1406
1396
|
*/
|
|
1407
|
-
|
|
1397
|
+
type JssmEventEntry<mDT, Ev extends JssmEventName> = {
|
|
1408
1398
|
handler: JssmEventHandler<mDT, Ev>;
|
|
1409
1399
|
filter?: JssmEventFilter<mDT, Ev>;
|
|
1410
1400
|
once: boolean;
|