jssm 5.159.1 → 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 +4 -4
- 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 +4 -4
- 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 +19 -6
package/jssm.es5.d.cts
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
1
|
import { circular_buffer } from 'circular_buffer_js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type StateType$1 = string;
|
|
4
4
|
/**
|
|
5
5
|
* A color value accepted by jssm-viz for state and arrow styling. Currently
|
|
6
6
|
* any string, validated downstream by Graphviz / the named-colors list.
|
|
7
7
|
* Intended to be narrowed to `#RRGGBB` / `#RRGGBBAA` and CSS named colors
|
|
8
8
|
* in a future release.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
type JssmColor = string;
|
|
11
11
|
/**
|
|
12
12
|
* Three-state policy flag: `'required'`, `'disallowed'`, or `'optional'`.
|
|
13
13
|
* Used by machine configuration where a default-permissive middle ground
|
|
14
14
|
* is meaningful (for example, the `actions` config key).
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
|
|
17
17
|
/**
|
|
18
18
|
* The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
|
|
19
19
|
* encodes a direction (one-way left/right, or two-way) and a "kind" for
|
|
20
20
|
* each direction (`-` legal, `=` main path, `~` forced-only). See the
|
|
21
21
|
* Language Reference docs for the full semantic table.
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
|
|
24
24
|
/**
|
|
25
25
|
* A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
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";
|
|
28
28
|
/**
|
|
29
29
|
* Direction polarity of an arrow: pointing only `'left'`, only `'right'`,
|
|
30
30
|
* or `'both'` (a bidirectional arrow).
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
type JssmArrowDirection = 'left' | 'right' | 'both';
|
|
33
33
|
/**
|
|
34
34
|
* Semantic category of an arrow's transition. `'legal'` is a normal
|
|
35
35
|
* transition, `'main'` is part of the machine's primary path, `'forced'`
|
|
36
36
|
* may only be taken via {@link Machine.force_transition}, and `'none'`
|
|
37
37
|
* means no transition exists in that direction.
|
|
38
38
|
*/
|
|
39
|
-
|
|
39
|
+
type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
40
40
|
/**
|
|
41
41
|
* Graphviz layout engine selector. Controls how jssm-viz lays out the
|
|
42
42
|
* rendered diagram; `'dot'` is the default and most useful for state
|
|
43
43
|
* machines. See the Graphviz documentation for the differences.
|
|
44
44
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp' | 'neato';
|
|
46
|
+
type JssmCorner = 'regular' | 'rounded' | 'lined';
|
|
47
|
+
type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
48
48
|
/**
|
|
49
49
|
* Tristate flag for whether a property may be overridden at runtime.
|
|
50
50
|
* `true` permits overrides, `false` forbids them, and `undefined` defers
|
|
51
51
|
* the decision to the surrounding configuration's default.
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
type JssmAllowsOverride = true | false | undefined;
|
|
54
54
|
/**
|
|
55
55
|
* Controls whether the state graph may contain disconnected components
|
|
56
56
|
* (islands). `true` permits islands (default), `false` requires a single
|
|
57
57
|
* connected component, and `'with_start'` permits islands only when every
|
|
58
58
|
* component contains at least one start state.
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
type JssmAllowIslands = true | false | 'with_start';
|
|
61
61
|
/**
|
|
62
62
|
* Structured render-size hint for a machine visualization, set by the FSL
|
|
63
63
|
* `default_size` directive. All three forms are optional in the sense that
|
|
@@ -71,7 +71,7 @@ declare type JssmAllowIslands = true | false | 'with_start';
|
|
|
71
71
|
*
|
|
72
72
|
* @see Machine.default_size
|
|
73
73
|
*/
|
|
74
|
-
|
|
74
|
+
type JssmDefaultSize = {
|
|
75
75
|
width?: number;
|
|
76
76
|
height?: number;
|
|
77
77
|
};
|
|
@@ -85,7 +85,7 @@ declare const FslDirections: readonly ["up", "right", "down", "left"];
|
|
|
85
85
|
* String literal type of the four supported FSL flow directions. This is
|
|
86
86
|
* the type of the `flow` config key on a machine.
|
|
87
87
|
*/
|
|
88
|
-
|
|
88
|
+
type FslDirection = typeof FslDirections[number];
|
|
89
89
|
/**
|
|
90
90
|
* Runtime-iterable list of the built-in theme names that ship with jssm-viz.
|
|
91
91
|
* Use this when you need to enumerate themes; for the type itself see
|
|
@@ -97,7 +97,7 @@ declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"
|
|
|
97
97
|
* type of the `theme` config key (which accepts an array so that themes
|
|
98
98
|
* can be layered).
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
type FslTheme = typeof FslThemes[number];
|
|
101
101
|
/**
|
|
102
102
|
* Persistable snapshot of a Machine produced by {@link Machine.serialize}
|
|
103
103
|
* and consumed by {@link deserialize}. Carries the current state, the
|
|
@@ -106,7 +106,7 @@ declare type FslTheme = typeof FslThemes[number];
|
|
|
106
106
|
*
|
|
107
107
|
* @typeParam DataType - The type of the user-supplied data payload (`mDT`).
|
|
108
108
|
*/
|
|
109
|
-
|
|
109
|
+
type JssmSerialization<DataType> = {
|
|
110
110
|
jssm_version: string;
|
|
111
111
|
timestamp: number;
|
|
112
112
|
comment?: string | undefined;
|
|
@@ -134,7 +134,7 @@ declare type JssmSerialization<DataType> = {
|
|
|
134
134
|
* @see JssmGroupRef
|
|
135
135
|
* @see JssmGroupRegistry
|
|
136
136
|
*/
|
|
137
|
-
|
|
137
|
+
type JssmGroupMemberRef = {
|
|
138
138
|
kind: 'state';
|
|
139
139
|
name: string;
|
|
140
140
|
} | {
|
|
@@ -160,7 +160,7 @@ declare type JssmGroupMemberRef = {
|
|
|
160
160
|
*
|
|
161
161
|
* @see JssmGroupMemberRef
|
|
162
162
|
*/
|
|
163
|
-
|
|
163
|
+
type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
|
|
164
164
|
/**
|
|
165
165
|
* The compiled boundary-hook surface for a single subject (a group or a
|
|
166
166
|
* state): the action to run on entry (`onEnter`) and/or on exit (`onExit`).
|
|
@@ -170,7 +170,7 @@ declare type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
|
|
|
170
170
|
*
|
|
171
171
|
* @see JssmHookDeclaration
|
|
172
172
|
*/
|
|
173
|
-
|
|
173
|
+
type JssmBoundaryHooks = {
|
|
174
174
|
onEnter?: string;
|
|
175
175
|
onExit?: string;
|
|
176
176
|
};
|
|
@@ -181,7 +181,7 @@ declare type JssmBoundaryHooks = {
|
|
|
181
181
|
*
|
|
182
182
|
* @see JssmHookDeclaration
|
|
183
183
|
*/
|
|
184
|
-
|
|
184
|
+
type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
|
|
185
185
|
/**
|
|
186
186
|
* Maps each plain state name that has at least one boundary hook to its
|
|
187
187
|
* merged {@link JssmBoundaryHooks}. The state-subject analogue of
|
|
@@ -189,7 +189,7 @@ declare type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
|
|
|
189
189
|
*
|
|
190
190
|
* @see JssmHookDeclaration
|
|
191
191
|
*/
|
|
192
|
-
|
|
192
|
+
type JssmStateHooks = Map<string, JssmBoundaryHooks>;
|
|
193
193
|
/**
|
|
194
194
|
* Declaration of a named property that a machine's states may carry.
|
|
195
195
|
* Set `required: true` to force every state to define the property, or
|
|
@@ -202,15 +202,15 @@ declare type JssmStateHooks = Map<string, JssmBoundaryHooks>;
|
|
|
202
202
|
* may carry only the serialized `name`, and global property definitions
|
|
203
203
|
* never set them.
|
|
204
204
|
*/
|
|
205
|
-
|
|
205
|
+
type JssmPropertyDefinition = {
|
|
206
206
|
name: string;
|
|
207
207
|
default_value?: any;
|
|
208
208
|
required?: boolean;
|
|
209
209
|
property?: string;
|
|
210
210
|
state?: string;
|
|
211
211
|
};
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
type JssmTransitionPermitter<DataType> = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean;
|
|
213
|
+
type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
|
|
214
214
|
/**
|
|
215
215
|
* A single directed transition (edge) within a state machine. Captures
|
|
216
216
|
* both the topology (`from` / `to`), the FSL semantics (`kind`,
|
|
@@ -222,7 +222,7 @@ declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitt
|
|
|
222
222
|
* @typeParam StateType - The state-name type (usually `string`).
|
|
223
223
|
* @typeParam DataType - The machine's data payload type (`mDT`).
|
|
224
224
|
*/
|
|
225
|
-
|
|
225
|
+
type JssmTransition<StateType, DataType> = {
|
|
226
226
|
from: StateType;
|
|
227
227
|
to: StateType;
|
|
228
228
|
after_time?: number;
|
|
@@ -236,12 +236,12 @@ declare type JssmTransition<StateType, DataType> = {
|
|
|
236
236
|
main_path: boolean;
|
|
237
237
|
};
|
|
238
238
|
/** A list of {@link JssmTransition}s — the edge set of a machine. */
|
|
239
|
-
|
|
239
|
+
type JssmTransitions<StateType, DataType> = JssmTransition<StateType, DataType>[];
|
|
240
240
|
/**
|
|
241
241
|
* The set of states that can immediately precede or follow a given state.
|
|
242
242
|
* Returned by jssm helpers that report a state's connectivity in the graph.
|
|
243
243
|
*/
|
|
244
|
-
|
|
244
|
+
type JssmTransitionList = {
|
|
245
245
|
entrances: Array<StateType$1>;
|
|
246
246
|
exits: Array<StateType$1>;
|
|
247
247
|
};
|
|
@@ -250,7 +250,7 @@ declare type JssmTransitionList = {
|
|
|
250
250
|
* states it can be reached from, the set of states it can transition to,
|
|
251
251
|
* and whether reaching it constitutes "completing" the machine.
|
|
252
252
|
*/
|
|
253
|
-
|
|
253
|
+
type JssmGenericState = {
|
|
254
254
|
from: Array<StateType$1>;
|
|
255
255
|
name: StateType$1;
|
|
256
256
|
to: Array<StateType$1>;
|
|
@@ -263,7 +263,7 @@ declare type JssmGenericState = {
|
|
|
263
263
|
* `internal_state_impl_version` field exists so that consumers can detect
|
|
264
264
|
* shape changes if this representation evolves.
|
|
265
265
|
*/
|
|
266
|
-
|
|
266
|
+
type JssmMachineInternalState<DataType> = {
|
|
267
267
|
internal_state_impl_version: 1;
|
|
268
268
|
state: StateType$1;
|
|
269
269
|
states: Map<StateType$1, JssmGenericState>;
|
|
@@ -273,8 +273,8 @@ declare type JssmMachineInternalState<DataType> = {
|
|
|
273
273
|
reverse_actions: Map<StateType$1, Map<StateType$1, number>>;
|
|
274
274
|
edges: Array<JssmTransition<StateType$1, DataType>>;
|
|
275
275
|
};
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
type JssmStatePermitter<DataType> = (OldState: StateType$1, NewState: StateType$1, OldData: DataType, NewData: DataType) => boolean;
|
|
277
|
+
type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataType> | Array<JssmStatePermitter<DataType>>;
|
|
278
278
|
/**
|
|
279
279
|
* A source span produced by the FSL parser when `parse(input, { locations:
|
|
280
280
|
* true })` is used. Mirrors PEG.js's native `location()` shape: byte
|
|
@@ -286,12 +286,12 @@ declare type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataTyp
|
|
|
286
286
|
* // end: { offset: 7, line: 1, column: 8 } }
|
|
287
287
|
* ```
|
|
288
288
|
*/
|
|
289
|
-
|
|
289
|
+
type FslSourcePoint = {
|
|
290
290
|
offset: number;
|
|
291
291
|
line: number;
|
|
292
292
|
column: number;
|
|
293
293
|
};
|
|
294
|
-
|
|
294
|
+
type FslSourceLocation = {
|
|
295
295
|
start: FslSourcePoint;
|
|
296
296
|
end: FslSourcePoint;
|
|
297
297
|
};
|
|
@@ -300,7 +300,7 @@ declare type FslSourceLocation = {
|
|
|
300
300
|
* raw form produced by the parser before being condensed into a
|
|
301
301
|
* {@link JssmStateDeclaration}.
|
|
302
302
|
*/
|
|
303
|
-
|
|
303
|
+
type JssmStateDeclarationRule = {
|
|
304
304
|
key: string;
|
|
305
305
|
value: any;
|
|
306
306
|
name?: string;
|
|
@@ -312,7 +312,7 @@ declare type JssmStateDeclarationRule = {
|
|
|
312
312
|
* rule list (`declarations`) and the well-known styling fields jssm-viz
|
|
313
313
|
* understands. Returned by {@link Machine.state_declaration}.
|
|
314
314
|
*/
|
|
315
|
-
|
|
315
|
+
type JssmStateDeclaration = {
|
|
316
316
|
declarations: Array<JssmStateDeclarationRule>;
|
|
317
317
|
shape?: JssmShape;
|
|
318
318
|
color?: JssmColor;
|
|
@@ -335,44 +335,44 @@ declare type JssmStateDeclaration = {
|
|
|
335
335
|
* optional. Used as the value type for theme entries and for default
|
|
336
336
|
* state configuration where most fields will be inherited or merged.
|
|
337
337
|
*/
|
|
338
|
-
|
|
339
|
-
|
|
338
|
+
type JssmStateConfig = Partial<JssmStateDeclaration>;
|
|
339
|
+
type JssmStateStyleShape = {
|
|
340
340
|
key: 'shape';
|
|
341
341
|
value: JssmShape;
|
|
342
342
|
};
|
|
343
|
-
|
|
343
|
+
type JssmStateStyleColor = {
|
|
344
344
|
key: 'color';
|
|
345
345
|
value: JssmColor;
|
|
346
346
|
};
|
|
347
|
-
|
|
347
|
+
type JssmStateStyleTextColor = {
|
|
348
348
|
key: 'text-color';
|
|
349
349
|
value: JssmColor;
|
|
350
350
|
};
|
|
351
|
-
|
|
351
|
+
type JssmStateStyleCorners = {
|
|
352
352
|
key: 'corners';
|
|
353
353
|
value: JssmCorner;
|
|
354
354
|
};
|
|
355
|
-
|
|
355
|
+
type JssmStateStyleLineStyle = {
|
|
356
356
|
key: 'line-style';
|
|
357
357
|
value: JssmLineStyle;
|
|
358
358
|
};
|
|
359
|
-
|
|
359
|
+
type JssmStateStyleStateLabel = {
|
|
360
360
|
key: 'state-label';
|
|
361
361
|
value: string;
|
|
362
362
|
};
|
|
363
|
-
|
|
363
|
+
type JssmStateStyleBackgroundColor = {
|
|
364
364
|
key: 'background-color';
|
|
365
365
|
value: JssmColor;
|
|
366
366
|
};
|
|
367
|
-
|
|
367
|
+
type JssmStateStyleBorderColor = {
|
|
368
368
|
key: 'border-color';
|
|
369
369
|
value: JssmColor;
|
|
370
370
|
};
|
|
371
|
-
|
|
371
|
+
type JssmStateStyleImage = {
|
|
372
372
|
key: 'image';
|
|
373
373
|
value: string;
|
|
374
374
|
};
|
|
375
|
-
|
|
375
|
+
type JssmStateStyleUrl = {
|
|
376
376
|
key: 'url';
|
|
377
377
|
value: string;
|
|
378
378
|
};
|
|
@@ -381,13 +381,13 @@ declare type JssmStateStyleUrl = {
|
|
|
381
381
|
* a state's style configuration. The `key` discriminator selects which
|
|
382
382
|
* member, and the `value` is typed accordingly.
|
|
383
383
|
*/
|
|
384
|
-
|
|
384
|
+
type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleStateLabel | JssmStateStyleBorderColor | JssmStateStyleImage | JssmStateStyleUrl;
|
|
385
385
|
/**
|
|
386
386
|
* An ordered list of {@link JssmStateStyleKey} entries. Used by the
|
|
387
387
|
* `default_*_state_config` machine config options to provide a fallback
|
|
388
388
|
* style stack.
|
|
389
389
|
*/
|
|
390
|
-
|
|
390
|
+
type JssmStateStyleKeyList = JssmStateStyleKey[];
|
|
391
391
|
/**
|
|
392
392
|
* The graph-wide default edge colour style item, produced by the
|
|
393
393
|
* `edge-color`/`edge_color` line inside a `transition: {}` (or `graph: {}`)
|
|
@@ -395,7 +395,7 @@ declare type JssmStateStyleKeyList = JssmStateStyleKey[];
|
|
|
395
395
|
* applies to edges rather than nodes, and because it carries the legacy
|
|
396
396
|
* `graph_default_edge_color` key the grammar emits.
|
|
397
397
|
*/
|
|
398
|
-
|
|
398
|
+
type JssmGraphDefaultEdgeColor = {
|
|
399
399
|
key: 'graph_default_edge_color';
|
|
400
400
|
value: JssmColor;
|
|
401
401
|
};
|
|
@@ -407,7 +407,7 @@ declare type JssmGraphDefaultEdgeColor = {
|
|
|
407
407
|
*
|
|
408
408
|
* @see JssmTransitionConfig
|
|
409
409
|
*/
|
|
410
|
-
|
|
410
|
+
type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeColor;
|
|
411
411
|
/**
|
|
412
412
|
* The compiled value of a `transition: {}` config block: an ordered list of
|
|
413
413
|
* edge-default style items. V1 mirrors the state-style shape used by
|
|
@@ -422,7 +422,7 @@ declare type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeCo
|
|
|
422
422
|
*
|
|
423
423
|
* @see JssmGraphConfig
|
|
424
424
|
*/
|
|
425
|
-
|
|
425
|
+
type JssmTransitionConfig = JssmTransitionStyleKey[];
|
|
426
426
|
/**
|
|
427
427
|
* Graph-scope default-config style items folded from the deprecated
|
|
428
428
|
* top-level graph keywords (`graph_layout`, `graph_bg_color`,
|
|
@@ -430,7 +430,7 @@ declare type JssmTransitionConfig = JssmTransitionStyleKey[];
|
|
|
430
430
|
* default) into the consolidated `graph: {}` config. Each carries the
|
|
431
431
|
* legacy parse key so downstream consumers can disambiguate.
|
|
432
432
|
*/
|
|
433
|
-
|
|
433
|
+
type JssmGraphAliasKey = {
|
|
434
434
|
key: 'graph_layout';
|
|
435
435
|
value: JssmLayout;
|
|
436
436
|
} | {
|
|
@@ -454,7 +454,7 @@ declare type JssmGraphAliasKey = {
|
|
|
454
454
|
*
|
|
455
455
|
* @see JssmGraphConfig
|
|
456
456
|
*/
|
|
457
|
-
|
|
457
|
+
type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
|
|
458
458
|
/**
|
|
459
459
|
* The compiled value of a `graph: {}` config block: an ordered list of
|
|
460
460
|
* graph-default style items. The compiler folds the deprecated top-level
|
|
@@ -471,7 +471,7 @@ declare type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
|
|
|
471
471
|
*
|
|
472
472
|
* @see JssmTransitionConfig
|
|
473
473
|
*/
|
|
474
|
-
|
|
474
|
+
type JssmGraphConfig = JssmGraphStyleKey[];
|
|
475
475
|
/**
|
|
476
476
|
* Complete shape of a jssm-viz theme. A theme provides a style block for
|
|
477
477
|
* each kind of state (`state`, `hooked`, `start`, `end`, `terminal`) as
|
|
@@ -483,7 +483,7 @@ declare type JssmGraphConfig = JssmGraphStyleKey[];
|
|
|
483
483
|
* Most user-defined themes should be typed as {@link JssmTheme} (the
|
|
484
484
|
* `Partial` of this) so that omitted fields fall back to the base theme.
|
|
485
485
|
*/
|
|
486
|
-
|
|
486
|
+
type JssmBaseTheme = {
|
|
487
487
|
name: string;
|
|
488
488
|
state: JssmStateConfig;
|
|
489
489
|
hooked: JssmStateConfig;
|
|
@@ -520,28 +520,28 @@ declare type JssmBaseTheme = {
|
|
|
520
520
|
* (fsl#1334), read by the all-widgets web control: a stochastic run-count
|
|
521
521
|
* and the panels the machine requests under `request` panel mode.
|
|
522
522
|
*/
|
|
523
|
-
|
|
523
|
+
type JssmEditorConfig = {
|
|
524
524
|
stochastic_run_count?: number;
|
|
525
525
|
panels?: Array<string>;
|
|
526
526
|
};
|
|
527
527
|
/** Which stochastic view a run batch produces. */
|
|
528
|
-
|
|
528
|
+
type JssmStochasticMode = 'montecarlo' | 'steady_state';
|
|
529
529
|
/** Options for {@link Machine.stochastic_summary} / {@link Machine.stochastic_runs}. */
|
|
530
|
-
|
|
530
|
+
type JssmStochasticOptions = {
|
|
531
531
|
mode?: JssmStochasticMode;
|
|
532
532
|
runs?: number;
|
|
533
533
|
max_steps?: number;
|
|
534
534
|
seed?: number;
|
|
535
535
|
};
|
|
536
536
|
/** One walk's result, yielded by {@link Machine.stochastic_runs}. */
|
|
537
|
-
|
|
537
|
+
type JssmStochasticRun = {
|
|
538
538
|
states: Array<string>;
|
|
539
539
|
edges: Array<string>;
|
|
540
540
|
length: number;
|
|
541
541
|
terminated: boolean;
|
|
542
542
|
};
|
|
543
543
|
/** Aggregate statistics over a stochastic run batch. */
|
|
544
|
-
|
|
544
|
+
type JssmStochasticSummary = {
|
|
545
545
|
mode: JssmStochasticMode;
|
|
546
546
|
runs: number;
|
|
547
547
|
seed: number;
|
|
@@ -552,7 +552,7 @@ declare type JssmStochasticSummary = {
|
|
|
552
552
|
terminal_reached?: number;
|
|
553
553
|
capped?: number;
|
|
554
554
|
};
|
|
555
|
-
|
|
555
|
+
type JssmGenericConfig<StateType, DataType> = {
|
|
556
556
|
graph_layout?: JssmLayout;
|
|
557
557
|
complete?: Array<StateType>;
|
|
558
558
|
transitions: JssmTransitions<StateType, DataType>;
|
|
@@ -660,7 +660,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
660
660
|
*
|
|
661
661
|
* @internal
|
|
662
662
|
*/
|
|
663
|
-
|
|
663
|
+
type JssmCompileSe<StateType, mDT> = {
|
|
664
664
|
to: StateType;
|
|
665
665
|
se?: JssmCompileSe<StateType, mDT>;
|
|
666
666
|
kind: JssmArrow;
|
|
@@ -684,7 +684,7 @@ declare type JssmCompileSe<StateType, mDT> = {
|
|
|
684
684
|
*
|
|
685
685
|
* @internal
|
|
686
686
|
*/
|
|
687
|
-
|
|
687
|
+
type JssmCompileSeStart<StateType, DataType> = {
|
|
688
688
|
from: StateType;
|
|
689
689
|
se: JssmCompileSe<StateType, DataType>;
|
|
690
690
|
key: string;
|
|
@@ -705,121 +705,121 @@ declare type JssmCompileSeStart<StateType, DataType> = {
|
|
|
705
705
|
*
|
|
706
706
|
* @internal
|
|
707
707
|
*/
|
|
708
|
-
|
|
709
|
-
|
|
708
|
+
type JssmParseTree<StateType, mDT> = Array<JssmCompileSeStart<StateType, mDT>>;
|
|
709
|
+
type BasicHookDescription<mDT> = {
|
|
710
710
|
kind: 'hook';
|
|
711
711
|
from: string;
|
|
712
712
|
to: string;
|
|
713
713
|
handler: HookHandler<mDT>;
|
|
714
714
|
};
|
|
715
|
-
|
|
715
|
+
type HookDescriptionWithAction<mDT> = {
|
|
716
716
|
kind: 'named';
|
|
717
717
|
from: string;
|
|
718
718
|
to: string;
|
|
719
719
|
action: string;
|
|
720
720
|
handler: HookHandler<mDT>;
|
|
721
721
|
};
|
|
722
|
-
|
|
722
|
+
type StandardTransitionHook<mDT> = {
|
|
723
723
|
kind: 'standard transition';
|
|
724
724
|
handler: HookHandler<mDT>;
|
|
725
725
|
};
|
|
726
|
-
|
|
726
|
+
type MainTransitionHook<mDT> = {
|
|
727
727
|
kind: 'main transition';
|
|
728
728
|
handler: HookHandler<mDT>;
|
|
729
729
|
};
|
|
730
|
-
|
|
730
|
+
type ForcedTransitionHook<mDT> = {
|
|
731
731
|
kind: 'forced transition';
|
|
732
732
|
handler: HookHandler<mDT>;
|
|
733
733
|
};
|
|
734
|
-
|
|
734
|
+
type AnyTransitionHook<mDT> = {
|
|
735
735
|
kind: 'any transition';
|
|
736
736
|
handler: HookHandler<mDT>;
|
|
737
737
|
};
|
|
738
|
-
|
|
738
|
+
type GlobalActionHook<mDT> = {
|
|
739
739
|
kind: 'global action';
|
|
740
740
|
action: string;
|
|
741
741
|
handler: HookHandler<mDT>;
|
|
742
742
|
};
|
|
743
|
-
|
|
743
|
+
type AnyActionHook<mDT> = {
|
|
744
744
|
kind: 'any action';
|
|
745
745
|
handler: HookHandler<mDT>;
|
|
746
746
|
};
|
|
747
|
-
|
|
747
|
+
type EntryHook<mDT> = {
|
|
748
748
|
kind: 'entry';
|
|
749
749
|
to: string;
|
|
750
750
|
handler: HookHandler<mDT>;
|
|
751
751
|
};
|
|
752
|
-
|
|
752
|
+
type ExitHook<mDT> = {
|
|
753
753
|
kind: 'exit';
|
|
754
754
|
from: string;
|
|
755
755
|
handler: HookHandler<mDT>;
|
|
756
756
|
};
|
|
757
|
-
|
|
757
|
+
type AfterHook<mDT> = {
|
|
758
758
|
kind: 'after';
|
|
759
759
|
from: string;
|
|
760
760
|
handler: HookHandler<mDT>;
|
|
761
761
|
};
|
|
762
|
-
|
|
762
|
+
type PostBasicHookDescription<mDT> = {
|
|
763
763
|
kind: 'post hook';
|
|
764
764
|
from: string;
|
|
765
765
|
to: string;
|
|
766
766
|
handler: PostHookHandler<mDT>;
|
|
767
767
|
};
|
|
768
|
-
|
|
768
|
+
type PostHookDescriptionWithAction<mDT> = {
|
|
769
769
|
kind: 'post named';
|
|
770
770
|
from: string;
|
|
771
771
|
to: string;
|
|
772
772
|
action: string;
|
|
773
773
|
handler: PostHookHandler<mDT>;
|
|
774
774
|
};
|
|
775
|
-
|
|
775
|
+
type PostStandardTransitionHook<mDT> = {
|
|
776
776
|
kind: 'post standard transition';
|
|
777
777
|
handler: PostHookHandler<mDT>;
|
|
778
778
|
};
|
|
779
|
-
|
|
779
|
+
type PostMainTransitionHook<mDT> = {
|
|
780
780
|
kind: 'post main transition';
|
|
781
781
|
handler: PostHookHandler<mDT>;
|
|
782
782
|
};
|
|
783
|
-
|
|
783
|
+
type PostForcedTransitionHook<mDT> = {
|
|
784
784
|
kind: 'post forced transition';
|
|
785
785
|
handler: PostHookHandler<mDT>;
|
|
786
786
|
};
|
|
787
|
-
|
|
787
|
+
type PostAnyTransitionHook<mDT> = {
|
|
788
788
|
kind: 'post any transition';
|
|
789
789
|
handler: PostHookHandler<mDT>;
|
|
790
790
|
};
|
|
791
|
-
|
|
791
|
+
type PostGlobalActionHook<mDT> = {
|
|
792
792
|
kind: 'post global action';
|
|
793
793
|
action: string;
|
|
794
794
|
handler: PostHookHandler<mDT>;
|
|
795
795
|
};
|
|
796
|
-
|
|
796
|
+
type PostAnyActionHook<mDT> = {
|
|
797
797
|
kind: 'post any action';
|
|
798
798
|
handler: PostHookHandler<mDT>;
|
|
799
799
|
};
|
|
800
|
-
|
|
800
|
+
type PostEntryHook<mDT> = {
|
|
801
801
|
kind: 'post entry';
|
|
802
802
|
to: string;
|
|
803
803
|
handler: PostHookHandler<mDT>;
|
|
804
804
|
};
|
|
805
|
-
|
|
805
|
+
type PostExitHook<mDT> = {
|
|
806
806
|
kind: 'post exit';
|
|
807
807
|
from: string;
|
|
808
808
|
handler: PostHookHandler<mDT>;
|
|
809
809
|
};
|
|
810
|
-
|
|
810
|
+
type PreEverythingHook<mDT> = {
|
|
811
811
|
kind: 'pre everything';
|
|
812
812
|
handler: EverythingHookHandler<mDT>;
|
|
813
813
|
};
|
|
814
|
-
|
|
814
|
+
type EverythingHook<mDT> = {
|
|
815
815
|
kind: 'everything';
|
|
816
816
|
handler: EverythingHookHandler<mDT>;
|
|
817
817
|
};
|
|
818
|
-
|
|
818
|
+
type PrePostEverythingHook<mDT> = {
|
|
819
819
|
kind: 'pre post everything';
|
|
820
820
|
handler: PostEverythingHookHandler<mDT>;
|
|
821
821
|
};
|
|
822
|
-
|
|
822
|
+
type PostEverythingHook<mDT> = {
|
|
823
823
|
kind: 'post everything';
|
|
824
824
|
handler: PostEverythingHookHandler<mDT>;
|
|
825
825
|
};
|
|
@@ -837,13 +837,13 @@ declare type PostEverythingHook<mDT> = {
|
|
|
837
837
|
* variants (`'post *'`) cannot veto and are invoked only after a
|
|
838
838
|
* successful transition.
|
|
839
839
|
*/
|
|
840
|
-
|
|
840
|
+
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>;
|
|
841
841
|
/**
|
|
842
842
|
* Whether an observational hook runs in the pre-transition phase (where it
|
|
843
843
|
* may veto/mutate the transition) or the post-transition phase (a pure
|
|
844
844
|
* observer that runs only after a successful transition commits).
|
|
845
845
|
*/
|
|
846
|
-
|
|
846
|
+
type HookPhase = 'pre' | 'post';
|
|
847
847
|
/**
|
|
848
848
|
* Normalized description of the target a registry entry is bound to. Exactly
|
|
849
849
|
* one scope variant applies; the present fields depend on the scope:
|
|
@@ -854,7 +854,7 @@ declare type HookPhase = 'pre' | 'post';
|
|
|
854
854
|
* - `'global'` carries no further keys (it matches everything),
|
|
855
855
|
* - `'group'` carries `group` (a named state group with a boundary hook).
|
|
856
856
|
*/
|
|
857
|
-
|
|
857
|
+
type HookTarget = {
|
|
858
858
|
scope: 'edge';
|
|
859
859
|
from: StateType$1;
|
|
860
860
|
to: StateType$1;
|
|
@@ -878,7 +878,7 @@ declare type HookTarget = {
|
|
|
878
878
|
* covers only the programmatically-registered observational hooks), so the
|
|
879
879
|
* registry widens its `kind` field with them.
|
|
880
880
|
*/
|
|
881
|
-
|
|
881
|
+
type HookBoundaryKind = 'group enter' | 'group exit' | 'state enter' | 'state exit';
|
|
882
882
|
/**
|
|
883
883
|
* One row of the generated uniform observational-hook registry. `kind` is
|
|
884
884
|
* either an original {@link HookDescription} discriminator (e.g. `'entry'`,
|
|
@@ -887,7 +887,7 @@ declare type HookBoundaryKind = 'group enter' | 'group exit' | 'state enter' | '
|
|
|
887
887
|
* normalized {@link HookTarget} it is bound to. The triple
|
|
888
888
|
* `(kind, target, phase)` is the registry key the spec calls for.
|
|
889
889
|
*/
|
|
890
|
-
|
|
890
|
+
type HookRegistryEntry = {
|
|
891
891
|
kind: HookDescription<unknown>['kind'] | HookBoundaryKind;
|
|
892
892
|
phase: HookPhase;
|
|
893
893
|
target: HookTarget;
|
|
@@ -900,7 +900,7 @@ declare type HookRegistryEntry = {
|
|
|
900
900
|
* mirrors the spec's `hooks_on(state)` / `hooks_on(from→to)` /
|
|
901
901
|
* `hooks_on(action)` / `hooks_on(&group)` set with one parameter shape.
|
|
902
902
|
*/
|
|
903
|
-
|
|
903
|
+
type HookQuery = StateType$1 | {
|
|
904
904
|
from: StateType$1;
|
|
905
905
|
to: StateType$1;
|
|
906
906
|
action?: string;
|
|
@@ -917,7 +917,7 @@ declare type HookQuery = StateType$1 | {
|
|
|
917
917
|
* `data` overrides the data observed by other hooks in the same chain,
|
|
918
918
|
* and `next_data` overrides the data committed after the transition.
|
|
919
919
|
*/
|
|
920
|
-
|
|
920
|
+
type HookComplexResult<mDT> = {
|
|
921
921
|
pass: boolean;
|
|
922
922
|
state?: StateType$1;
|
|
923
923
|
data?: mDT;
|
|
@@ -929,7 +929,7 @@ declare type HookComplexResult<mDT> = {
|
|
|
929
929
|
* a {@link HookComplexResult} that additionally rewrites the next state
|
|
930
930
|
* and/or the next data payload.
|
|
931
931
|
*/
|
|
932
|
-
|
|
932
|
+
type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
|
|
933
933
|
/**
|
|
934
934
|
* Context object passed to every {@link HookHandler}. `data` is the
|
|
935
935
|
* data payload as it stands before the transition, and `next_data` is
|
|
@@ -937,7 +937,7 @@ declare type HookResult<mDT> = true | false | undefined | void | HookComplexResu
|
|
|
937
937
|
* handlers may inspect or mutate the latter via a
|
|
938
938
|
* {@link HookComplexResult} return value.
|
|
939
939
|
*/
|
|
940
|
-
|
|
940
|
+
type HookContext<mDT> = {
|
|
941
941
|
data: mDT;
|
|
942
942
|
next_data: mDT;
|
|
943
943
|
};
|
|
@@ -947,7 +947,7 @@ declare type HookContext<mDT> = {
|
|
|
947
947
|
* {@link HookContext} with `hook_name`, which identifies which specific
|
|
948
948
|
* hook fired so a single handler can route on it.
|
|
949
949
|
*/
|
|
950
|
-
|
|
950
|
+
type EverythingHookContext<mDT> = HookContext<mDT> & {
|
|
951
951
|
hook_name: string;
|
|
952
952
|
};
|
|
953
953
|
/**
|
|
@@ -957,38 +957,38 @@ declare type EverythingHookContext<mDT> = HookContext<mDT> & {
|
|
|
957
957
|
* result allows it, and a {@link HookComplexResult} can additionally
|
|
958
958
|
* rewrite the next state or next data.
|
|
959
959
|
*/
|
|
960
|
-
|
|
960
|
+
type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
|
|
961
961
|
/**
|
|
962
962
|
* Signature of a post-transition hook handler. Invoked after a successful
|
|
963
963
|
* transition has been committed; the return value is ignored (the
|
|
964
964
|
* transition cannot be undone).
|
|
965
965
|
*/
|
|
966
|
-
|
|
966
|
+
type PostHookHandler<mDT> = (hook_context: HookContext<mDT>) => void;
|
|
967
967
|
/**
|
|
968
968
|
* Signature of an "everything" pre-transition hook handler. Like
|
|
969
969
|
* {@link HookHandler} but receives an {@link EverythingHookContext} so the
|
|
970
970
|
* handler can dispatch on `hook_name`.
|
|
971
971
|
*/
|
|
972
|
-
|
|
972
|
+
type EverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => HookResult<mDT>;
|
|
973
973
|
/**
|
|
974
974
|
* Signature of an "everything" post-transition hook handler. Like
|
|
975
975
|
* {@link PostHookHandler} but receives an {@link EverythingHookContext}.
|
|
976
976
|
* The return value is ignored.
|
|
977
977
|
*/
|
|
978
|
-
|
|
978
|
+
type PostEverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => void;
|
|
979
979
|
/**
|
|
980
980
|
* Bounded history of recently-visited states paired with the data payload
|
|
981
981
|
* observed in each. Backed by `circular_buffer_js`, so the oldest entry
|
|
982
982
|
* is dropped silently once the configured capacity is exceeded.
|
|
983
983
|
*/
|
|
984
|
-
|
|
984
|
+
type JssmHistory<mDT> = circular_buffer<[StateType$1, mDT]>;
|
|
985
985
|
/**
|
|
986
986
|
* Pluggable random-number-generator function shape. Must return a value
|
|
987
987
|
* in `[0, 1)` exactly as `Math.random` does. Supplied via the
|
|
988
988
|
* `rng_seed`-aware machine configuration so that stochastic models can be
|
|
989
989
|
* made reproducible.
|
|
990
990
|
*/
|
|
991
|
-
|
|
991
|
+
type JssmRng = () => number;
|
|
992
992
|
/**
|
|
993
993
|
* All event names that {@link Machine.on} accepts. These are observation
|
|
994
994
|
* events fired by the machine in addition to (not in place of) the hook
|
|
@@ -996,14 +996,14 @@ declare type JssmRng = () => number;
|
|
|
996
996
|
*
|
|
997
997
|
* @see Machine.on
|
|
998
998
|
*/
|
|
999
|
-
|
|
999
|
+
type JssmEventName = 'transition' | 'rejection' | 'action' | 'entry' | 'exit' | 'terminal' | 'complete' | 'error' | 'data-change' | 'override' | 'timeout' | 'hook-registration' | 'hook-removal';
|
|
1000
1000
|
/**
|
|
1001
1001
|
* Detail payload fired with a `transition` event. Carries the resolved
|
|
1002
1002
|
* source and target, the action name (if the transition was driven by an
|
|
1003
1003
|
* action), the data observed before and after the change, the edge kind,
|
|
1004
1004
|
* and whether the call was a forced transition.
|
|
1005
1005
|
*/
|
|
1006
|
-
|
|
1006
|
+
type JssmTransitionEventDetail<mDT> = {
|
|
1007
1007
|
from: StateType$1;
|
|
1008
1008
|
to: StateType$1;
|
|
1009
1009
|
action?: StateType$1;
|
|
@@ -1018,7 +1018,7 @@ declare type JssmTransitionEventDetail<mDT> = {
|
|
|
1018
1018
|
* and why. `reason` is `'invalid'` when no edge existed, `'hook'` when
|
|
1019
1019
|
* a hook handler vetoed; `hook_name` is set when `reason` is `'hook'`.
|
|
1020
1020
|
*/
|
|
1021
|
-
|
|
1021
|
+
type JssmRejectionEventDetail<mDT> = {
|
|
1022
1022
|
from: StateType$1;
|
|
1023
1023
|
to: StateType$1;
|
|
1024
1024
|
action?: StateType$1;
|
|
@@ -1032,7 +1032,7 @@ declare type JssmRejectionEventDetail<mDT> = {
|
|
|
1032
1032
|
* Detail payload fired with an `action` event. Fires when an action is
|
|
1033
1033
|
* attempted, before transition validation runs.
|
|
1034
1034
|
*/
|
|
1035
|
-
|
|
1035
|
+
type JssmActionEventDetail<mDT> = {
|
|
1036
1036
|
action: StateType$1;
|
|
1037
1037
|
from: StateType$1;
|
|
1038
1038
|
to?: StateType$1;
|
|
@@ -1044,7 +1044,7 @@ declare type JssmActionEventDetail<mDT> = {
|
|
|
1044
1044
|
* state. `from` is the predecessor state, if any. `action` is the
|
|
1045
1045
|
* action that drove the entry, if any.
|
|
1046
1046
|
*/
|
|
1047
|
-
|
|
1047
|
+
type JssmEntryEventDetail<mDT> = {
|
|
1048
1048
|
state: StateType$1;
|
|
1049
1049
|
from?: StateType$1;
|
|
1050
1050
|
action?: StateType$1;
|
|
@@ -1055,7 +1055,7 @@ declare type JssmEntryEventDetail<mDT> = {
|
|
|
1055
1055
|
* state. `to` is the next state, if any. `action` is the action that
|
|
1056
1056
|
* drove the exit, if any.
|
|
1057
1057
|
*/
|
|
1058
|
-
|
|
1058
|
+
type JssmExitEventDetail<mDT> = {
|
|
1059
1059
|
state: StateType$1;
|
|
1060
1060
|
to?: StateType$1;
|
|
1061
1061
|
action?: StateType$1;
|
|
@@ -1065,7 +1065,7 @@ declare type JssmExitEventDetail<mDT> = {
|
|
|
1065
1065
|
* Detail payload fired with a `terminal` event. Indicates that the
|
|
1066
1066
|
* machine has reached a state with no outgoing edges.
|
|
1067
1067
|
*/
|
|
1068
|
-
|
|
1068
|
+
type JssmTerminalEventDetail<mDT> = {
|
|
1069
1069
|
state: StateType$1;
|
|
1070
1070
|
data: mDT;
|
|
1071
1071
|
};
|
|
@@ -1073,7 +1073,7 @@ declare type JssmTerminalEventDetail<mDT> = {
|
|
|
1073
1073
|
* Detail payload fired with a `complete` event. Indicates that the
|
|
1074
1074
|
* machine has reached a FSL `complete` state.
|
|
1075
1075
|
*/
|
|
1076
|
-
|
|
1076
|
+
type JssmCompleteEventDetail<mDT> = {
|
|
1077
1077
|
state: StateType$1;
|
|
1078
1078
|
data: mDT;
|
|
1079
1079
|
};
|
|
@@ -1083,7 +1083,7 @@ declare type JssmCompleteEventDetail<mDT> = {
|
|
|
1083
1083
|
* identify the event whose handler threw, and `handler` is the offending
|
|
1084
1084
|
* function so consumers can correlate / blame.
|
|
1085
1085
|
*/
|
|
1086
|
-
|
|
1086
|
+
type JssmErrorEventDetail = {
|
|
1087
1087
|
error: unknown;
|
|
1088
1088
|
source_event: JssmEventName;
|
|
1089
1089
|
source_detail: unknown;
|
|
@@ -1094,7 +1094,7 @@ declare type JssmErrorEventDetail = {
|
|
|
1094
1094
|
* machine's data payload is replaced. `old_data` is the value before the
|
|
1095
1095
|
* change; `new_data` is the value after.
|
|
1096
1096
|
*/
|
|
1097
|
-
|
|
1097
|
+
type JssmDataChangeEventDetail<mDT> = {
|
|
1098
1098
|
from?: StateType$1;
|
|
1099
1099
|
to?: StateType$1;
|
|
1100
1100
|
action?: StateType$1;
|
|
@@ -1106,7 +1106,7 @@ declare type JssmDataChangeEventDetail<mDT> = {
|
|
|
1106
1106
|
* Detail payload fired with an `override` event. Distinguishes a forced
|
|
1107
1107
|
* state replacement from a normal transition.
|
|
1108
1108
|
*/
|
|
1109
|
-
|
|
1109
|
+
type JssmOverrideEventDetail<mDT> = {
|
|
1110
1110
|
from: StateType$1;
|
|
1111
1111
|
to: StateType$1;
|
|
1112
1112
|
old_data: mDT;
|
|
@@ -1116,7 +1116,7 @@ declare type JssmOverrideEventDetail<mDT> = {
|
|
|
1116
1116
|
* Detail payload fired with a `timeout` event. Fires when a configured
|
|
1117
1117
|
* `after` clause causes an automatic transition.
|
|
1118
1118
|
*/
|
|
1119
|
-
|
|
1119
|
+
type JssmTimeoutEventDetail = {
|
|
1120
1120
|
from: StateType$1;
|
|
1121
1121
|
to: StateType$1;
|
|
1122
1122
|
after_time: number;
|
|
@@ -1126,7 +1126,7 @@ declare type JssmTimeoutEventDetail = {
|
|
|
1126
1126
|
* Mirrors the {@link HookDescription} so inspector tools can mirror the
|
|
1127
1127
|
* current hook set.
|
|
1128
1128
|
*/
|
|
1129
|
-
|
|
1129
|
+
type JssmHookLifecycleEventDetail<mDT> = {
|
|
1130
1130
|
description: HookDescription<mDT>;
|
|
1131
1131
|
};
|
|
1132
1132
|
/**
|
|
@@ -1134,7 +1134,7 @@ declare type JssmHookLifecycleEventDetail<mDT> = {
|
|
|
1134
1134
|
* payload. Drives the discriminated-union typing of {@link Machine.on},
|
|
1135
1135
|
* so `e.action` and friends only exist where they're meaningful.
|
|
1136
1136
|
*/
|
|
1137
|
-
|
|
1137
|
+
type JssmEventDetailMap<mDT> = {
|
|
1138
1138
|
'transition': JssmTransitionEventDetail<mDT>;
|
|
1139
1139
|
'rejection': JssmRejectionEventDetail<mDT>;
|
|
1140
1140
|
'action': JssmActionEventDetail<mDT>;
|
|
@@ -1155,7 +1155,7 @@ declare type JssmEventDetailMap<mDT> = {
|
|
|
1155
1155
|
* filter entry fire the handler. Events that don't list a filter key in
|
|
1156
1156
|
* v1 take no filter properties.
|
|
1157
1157
|
*/
|
|
1158
|
-
|
|
1158
|
+
type JssmEventFilterMap<mDT> = {
|
|
1159
1159
|
'transition': {
|
|
1160
1160
|
from?: StateType$1;
|
|
1161
1161
|
to?: StateType$1;
|
|
@@ -1183,19 +1183,19 @@ declare type JssmEventFilterMap<mDT> = {
|
|
|
1183
1183
|
* @typeparam mDT The type of the machine data member.
|
|
1184
1184
|
* @typeparam Ev The event name.
|
|
1185
1185
|
*/
|
|
1186
|
-
|
|
1186
|
+
type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev];
|
|
1187
1187
|
/**
|
|
1188
1188
|
* Per-event handler signature. Receives a detail object typed by event
|
|
1189
1189
|
* name, so `e.action` (etc.) only exist where they're meaningful.
|
|
1190
1190
|
* @typeparam mDT The type of the machine data member.
|
|
1191
1191
|
* @typeparam Ev The event name.
|
|
1192
1192
|
*/
|
|
1193
|
-
|
|
1193
|
+
type JssmEventHandler<mDT, Ev extends JssmEventName> = (detail: JssmEventDetailMap<mDT>[Ev]) => void;
|
|
1194
1194
|
/**
|
|
1195
1195
|
* Function returned by {@link Machine.on} and {@link Machine.once} that
|
|
1196
1196
|
* removes the subscription. Calling it more than once is a no-op.
|
|
1197
1197
|
*/
|
|
1198
|
-
|
|
1198
|
+
type JssmUnsubscribe = () => void;
|
|
1199
1199
|
|
|
1200
1200
|
/*********
|
|
1201
1201
|
*
|
|
@@ -1842,7 +1842,7 @@ interface Range {
|
|
|
1842
1842
|
to: number;
|
|
1843
1843
|
}
|
|
1844
1844
|
/** Diagnostic severity, aligned with LSP severities. */
|
|
1845
|
-
|
|
1845
|
+
type DiagnosticSeverity = 'error' | 'warning' | 'info' | 'hint';
|
|
1846
1846
|
/** An editor-agnostic diagnostic (one parse/compile problem). */
|
|
1847
1847
|
interface Diagnostic {
|
|
1848
1848
|
range: Range;
|
|
@@ -1850,7 +1850,7 @@ interface Diagnostic {
|
|
|
1850
1850
|
message: string;
|
|
1851
1851
|
}
|
|
1852
1852
|
/** What a completion item suggests, so adapters can pick an icon. */
|
|
1853
|
-
|
|
1853
|
+
type CompletionKind = 'key' | 'value-color' | 'value-shape' | 'value-enum';
|
|
1854
1854
|
/** An editor-agnostic completion suggestion. */
|
|
1855
1855
|
interface CompletionItem {
|
|
1856
1856
|
label: string;
|
|
@@ -1858,7 +1858,7 @@ interface CompletionItem {
|
|
|
1858
1858
|
detail?: string;
|
|
1859
1859
|
}
|
|
1860
1860
|
/** Parser-derived semantic role of a source span. */
|
|
1861
|
-
|
|
1861
|
+
type SemanticSpanKind = 'color' | 'state' | 'enum';
|
|
1862
1862
|
/** An editor-agnostic semantic span (for decorations / semantic tokens). */
|
|
1863
1863
|
interface SemanticSpan extends Range {
|
|
1864
1864
|
kind: SemanticSpanKind;
|
|
@@ -1961,11 +1961,11 @@ declare const build_time: number;
|
|
|
1961
1961
|
* @see notes/superpowers/specs/2026-06-23-fsl-markdown-fence-convention-design.md
|
|
1962
1962
|
*/
|
|
1963
1963
|
/** A single renderable part of a fence block (stacks in listed order, first on top). */
|
|
1964
|
-
|
|
1964
|
+
type FencePart = 'image' | 'code' | 'dot' | 'editor' | 'actions' | 'info-panel' | 'toolbar' | 'title' | 'footer';
|
|
1965
1965
|
/** An image output format for the `image` part. */
|
|
1966
|
-
|
|
1966
|
+
type FenceImageFormat = 'svg' | 'png' | 'jpeg' | 'gif';
|
|
1967
1967
|
/** The unit of a {@link FenceDimension} (`%` is represented as `'percent'`). */
|
|
1968
|
-
|
|
1968
|
+
type FenceDimensionUnit = 'px' | 'percent';
|
|
1969
1969
|
/** A parsed `width=`/`height=` value with its unit. */
|
|
1970
1970
|
interface FenceDimension {
|
|
1971
1971
|
value: number;
|
|
@@ -2009,7 +2009,7 @@ declare function fsl_fence_lang(info: string): 'fsl' | 'jssm' | null;
|
|
|
2009
2009
|
*/
|
|
2010
2010
|
declare function parse_fence_info(info: string): FenceDescriptor;
|
|
2011
2011
|
|
|
2012
|
-
|
|
2012
|
+
type StateType = string;
|
|
2013
2013
|
|
|
2014
2014
|
declare const shapes: string[];
|
|
2015
2015
|
declare const gviz_shapes: string[];
|
|
@@ -2034,7 +2034,7 @@ declare const action_label_chars: readonly {
|
|
|
2034
2034
|
*
|
|
2035
2035
|
* @internal
|
|
2036
2036
|
*/
|
|
2037
|
-
|
|
2037
|
+
type JssmEventEntry<mDT, Ev extends JssmEventName> = {
|
|
2038
2038
|
handler: JssmEventHandler<mDT, Ev>;
|
|
2039
2039
|
filter?: JssmEventFilter<mDT, Ev>;
|
|
2040
2040
|
once: boolean;
|