jssm 5.162.1 → 5.162.3
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 +1 -1
- package/dist/cdn/viz.js +1 -1
- 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/jssm.d.ts +60 -59
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_compiler.d.ts +5 -5
- package/dist/deno/jssm_types.d.ts +21 -21
- package/dist/deno/jssm_viz.d.ts +1 -1
- package/dist/fence/fence.js +58 -58
- 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/jssm.es5.d.cts +82 -81
- package/jssm.es6.d.ts +82 -81
- package/jssm.fence.d.ts +72 -71
- package/jssm_viz.es5.d.cts +73 -72
- package/jssm_viz.es6.d.ts +73 -72
- package/package.json +1 -1
package/jssm.es6.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ 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
|
-
* may only be taken via {@link Machine.force_transition}, and `'none'`
|
|
36
|
+
* may only be taken via {@link jssm!Machine.force_transition}, and `'none'`
|
|
37
37
|
* means no transition exists in that direction.
|
|
38
38
|
*/
|
|
39
39
|
type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
@@ -99,8 +99,8 @@ declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"
|
|
|
99
99
|
*/
|
|
100
100
|
type FslTheme = typeof FslThemes[number];
|
|
101
101
|
/**
|
|
102
|
-
* Persistable snapshot of a Machine produced by {@link Machine.serialize}
|
|
103
|
-
* and consumed by {@link deserialize}. Carries the current state, the
|
|
102
|
+
* Persistable snapshot of a Machine produced by {@link jssm!Machine.serialize}
|
|
103
|
+
* and consumed by {@link jssm!deserialize}. Carries the current state, the
|
|
104
104
|
* associated machine data, the recent history (subject to the configured
|
|
105
105
|
* capacity), and metadata to detect version-skew on rehydration.
|
|
106
106
|
*
|
|
@@ -257,7 +257,7 @@ type JssmGenericState = {
|
|
|
257
257
|
complete: boolean;
|
|
258
258
|
};
|
|
259
259
|
/**
|
|
260
|
-
* The full internal bookkeeping snapshot of a {@link Machine}, exposed for
|
|
260
|
+
* The full internal bookkeeping snapshot of a {@link jssm!Machine}, exposed for
|
|
261
261
|
* advanced introspection. Contains the current state, the state map, the
|
|
262
262
|
* edge map and reverse-action map, and the original edge list. The
|
|
263
263
|
* `internal_state_impl_version` field exists so that consumers can detect
|
|
@@ -310,7 +310,7 @@ type JssmStateDeclarationRule = {
|
|
|
310
310
|
/**
|
|
311
311
|
* The fully-condensed declaration for a single state, including its raw
|
|
312
312
|
* rule list (`declarations`) and the well-known styling fields jssm-viz
|
|
313
|
-
* understands. Returned by {@link Machine.state_declaration}.
|
|
313
|
+
* understands. Returned by {@link jssm!Machine.state_declaration}.
|
|
314
314
|
*/
|
|
315
315
|
type JssmStateDeclaration = {
|
|
316
316
|
declarations: Array<JssmStateDeclarationRule>;
|
|
@@ -503,7 +503,7 @@ type JssmBaseTheme = {
|
|
|
503
503
|
title: undefined;
|
|
504
504
|
};
|
|
505
505
|
/**
|
|
506
|
-
* Full configuration object accepted by the {@link Machine} constructor and
|
|
506
|
+
* Full configuration object accepted by the {@link jssm!Machine} constructor and
|
|
507
507
|
* by {@link from}. Carries the transition list and the optional knobs
|
|
508
508
|
* governing layout, theming, history, start/end states, property
|
|
509
509
|
* definitions, machine metadata (author, license, version, ...) and the
|
|
@@ -526,14 +526,14 @@ type JssmEditorConfig = {
|
|
|
526
526
|
};
|
|
527
527
|
/** Which stochastic view a run batch produces. */
|
|
528
528
|
type JssmStochasticMode = 'montecarlo' | 'steady_state';
|
|
529
|
-
/** Options for {@link Machine.stochastic_summary} / {@link Machine.stochastic_runs}. */
|
|
529
|
+
/** Options for {@link jssm!Machine.stochastic_summary} / {@link jssm!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
|
-
/** One walk's result, yielded by {@link Machine.stochastic_runs}. */
|
|
536
|
+
/** One walk's result, yielded by {@link jssm!Machine.stochastic_runs}. */
|
|
537
537
|
type JssmStochasticRun = {
|
|
538
538
|
states: Array<string>;
|
|
539
539
|
edges: Array<string>;
|
|
@@ -565,7 +565,7 @@ type JssmGenericConfig<StateType, DataType> = {
|
|
|
565
565
|
history?: number;
|
|
566
566
|
/**
|
|
567
567
|
* Maximum depth of the boundary-hook action cascade before the machine
|
|
568
|
-
* throws a {@link JssmError} rather than risking a stack overflow or hang.
|
|
568
|
+
* throws a {@link jssm_error!JssmError} rather than risking a stack overflow or hang.
|
|
569
569
|
*
|
|
570
570
|
* Each time a boundary action fires a transition that itself crosses a
|
|
571
571
|
* boundary, the depth counter increments. A cascade exceeding this limit is
|
|
@@ -893,7 +893,7 @@ type HookRegistryEntry = {
|
|
|
893
893
|
target: HookTarget;
|
|
894
894
|
};
|
|
895
895
|
/**
|
|
896
|
-
* Query for {@link Machine.has_hook} / {@link Machine.hooks_on}. A bare
|
|
896
|
+
* Query for {@link jssm!Machine.has_hook} / {@link jssm!Machine.hooks_on}. A bare
|
|
897
897
|
* string is read as a state name; an `{ from, to, action? }` object is read
|
|
898
898
|
* as an edge (optionally a named edge); an `{ action }` object is read as a
|
|
899
899
|
* named action; a `{ group }` object is read as a named state group. This
|
|
@@ -990,7 +990,7 @@ type JssmHistory<mDT> = circular_buffer<[StateType$1, mDT]>;
|
|
|
990
990
|
*/
|
|
991
991
|
type JssmRng = () => number;
|
|
992
992
|
/**
|
|
993
|
-
* All event names that {@link Machine.on} accepts. These are observation
|
|
993
|
+
* All event names that {@link jssm!Machine.on} accepts. These are observation
|
|
994
994
|
* events fired by the machine in addition to (not in place of) the hook
|
|
995
995
|
* system. Hooks intercept; events observe.
|
|
996
996
|
*
|
|
@@ -1131,7 +1131,7 @@ type JssmHookLifecycleEventDetail<mDT> = {
|
|
|
1131
1131
|
};
|
|
1132
1132
|
/**
|
|
1133
1133
|
* Mapped type from {@link JssmEventName} to the corresponding detail
|
|
1134
|
-
* payload. Drives the discriminated-union typing of {@link Machine.on},
|
|
1134
|
+
* payload. Drives the discriminated-union typing of {@link jssm!Machine.on},
|
|
1135
1135
|
* so `e.action` and friends only exist where they're meaningful.
|
|
1136
1136
|
*/
|
|
1137
1137
|
type JssmEventDetailMap<mDT> = {
|
|
@@ -1150,7 +1150,7 @@ type JssmEventDetailMap<mDT> = {
|
|
|
1150
1150
|
'hook-removal': JssmHookLifecycleEventDetail<mDT>;
|
|
1151
1151
|
};
|
|
1152
1152
|
/**
|
|
1153
|
-
* Filter accepted by {@link Machine.on} / {@link Machine.once} for an
|
|
1153
|
+
* Filter accepted by {@link jssm!Machine.on} / {@link jssm!Machine.once} for an
|
|
1154
1154
|
* individual event name. Only events whose detail key matches every
|
|
1155
1155
|
* filter entry fire the handler. Events that don't list a filter key in
|
|
1156
1156
|
* v1 take no filter properties.
|
|
@@ -1178,21 +1178,21 @@ type JssmEventFilterMap<mDT> = {
|
|
|
1178
1178
|
'hook-removal': Record<string, never>;
|
|
1179
1179
|
};
|
|
1180
1180
|
/**
|
|
1181
|
-
* Per-event filter object (as passed to {@link Machine.on}). Use
|
|
1181
|
+
* Per-event filter object (as passed to {@link jssm!Machine.on}). Use
|
|
1182
1182
|
* `JssmEventDetailMap<mDT>[Ev]` to find the matching detail type.
|
|
1183
|
-
* @
|
|
1184
|
-
* @
|
|
1183
|
+
* @typeParam mDT The type of the machine data member.
|
|
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
|
-
* @
|
|
1191
|
-
* @
|
|
1190
|
+
* @typeParam mDT The type of the machine data member.
|
|
1191
|
+
* @typeParam Ev The event name.
|
|
1192
1192
|
*/
|
|
1193
1193
|
type JssmEventHandler<mDT, Ev extends JssmEventName> = (detail: JssmEventDetailMap<mDT>[Ev]) => void;
|
|
1194
1194
|
/**
|
|
1195
|
-
* Function returned by {@link Machine.on} and {@link Machine.once} that
|
|
1195
|
+
* Function returned by {@link jssm!Machine.on} and {@link jssm!Machine.once} that
|
|
1196
1196
|
* removes the subscription. Calling it more than once is a no-op.
|
|
1197
1197
|
*/
|
|
1198
1198
|
type JssmUnsubscribe = () => void;
|
|
@@ -1342,7 +1342,7 @@ declare function wrap_parse(input: string, options?: Object): any;
|
|
|
1342
1342
|
* Compile a machine's JSON intermediate representation to a config object. If
|
|
1343
1343
|
* you're using this (probably don't,) you're probably also using
|
|
1344
1344
|
* {@link parse} to get the IR, and the object constructor
|
|
1345
|
-
* {@link Machine.
|
|
1345
|
+
* {@link Machine.constructor} to turn the config object into a workable machine.
|
|
1346
1346
|
*
|
|
1347
1347
|
* ```typescript
|
|
1348
1348
|
* import { parse, compile, Machine } from 'jssm';
|
|
@@ -1408,7 +1408,7 @@ declare function wrap_parse(input: string, options?: Object): any;
|
|
|
1408
1408
|
* const toggle = jssm.from('up <=> down;');
|
|
1409
1409
|
* ```
|
|
1410
1410
|
*
|
|
1411
|
-
* @
|
|
1411
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
1412
1412
|
*
|
|
1413
1413
|
* @param tree The parse tree to be boiled down into a machine config. If the
|
|
1414
1414
|
* tree was produced with `parse(input, { locations: true })`, any
|
|
@@ -1429,7 +1429,7 @@ declare function compile<StateType, mDT>(tree: JssmParseTree<StateType, mDT>): J
|
|
|
1429
1429
|
* Not generally meant for external use. Please see {@link compile} or
|
|
1430
1430
|
* {@link sm}.
|
|
1431
1431
|
*
|
|
1432
|
-
* @
|
|
1432
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
1433
1433
|
*
|
|
1434
1434
|
* @param plan The FSL code to be evaluated and built into a machine config
|
|
1435
1435
|
*
|
|
@@ -2246,7 +2246,7 @@ declare class Machine<mDT> {
|
|
|
2246
2246
|
* console.log( lswitch.state() ); // 'off'
|
|
2247
2247
|
* ```
|
|
2248
2248
|
*
|
|
2249
|
-
* @
|
|
2249
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2250
2250
|
*
|
|
2251
2251
|
* @returns The current state name.
|
|
2252
2252
|
*
|
|
@@ -2266,7 +2266,7 @@ declare class Machine<mDT> {
|
|
|
2266
2266
|
*
|
|
2267
2267
|
* See also {@link display_text}.
|
|
2268
2268
|
*
|
|
2269
|
-
* @
|
|
2269
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2270
2270
|
*
|
|
2271
2271
|
* @param state The state to get the label for.
|
|
2272
2272
|
*
|
|
@@ -2293,7 +2293,7 @@ declare class Machine<mDT> {
|
|
|
2293
2293
|
* console.log( lswitch.display_text('b') ); // 'b'
|
|
2294
2294
|
* ```
|
|
2295
2295
|
*
|
|
2296
|
-
* @
|
|
2296
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2297
2297
|
*
|
|
2298
2298
|
* @param state The state to get display text for.
|
|
2299
2299
|
*
|
|
@@ -2312,7 +2312,7 @@ declare class Machine<mDT> {
|
|
|
2312
2312
|
* console.log( lswitch.data() ); // 1
|
|
2313
2313
|
* ```
|
|
2314
2314
|
*
|
|
2315
|
-
* @
|
|
2315
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2316
2316
|
*
|
|
2317
2317
|
* @returns A deep clone of the machine's current data value.
|
|
2318
2318
|
*
|
|
@@ -2476,7 +2476,7 @@ declare class Machine<mDT> {
|
|
|
2476
2476
|
* console.log( final_test.is_start_state('b') ); // true
|
|
2477
2477
|
* ```
|
|
2478
2478
|
*
|
|
2479
|
-
* @
|
|
2479
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2480
2480
|
*
|
|
2481
2481
|
* @param whichState The name of the state to check
|
|
2482
2482
|
*
|
|
@@ -2501,7 +2501,7 @@ declare class Machine<mDT> {
|
|
|
2501
2501
|
* console.log( final_test.is_start_state('b') ); // true
|
|
2502
2502
|
* ```
|
|
2503
2503
|
*
|
|
2504
|
-
* @
|
|
2504
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2505
2505
|
*
|
|
2506
2506
|
* @param whichState The name of the state to check
|
|
2507
2507
|
*
|
|
@@ -2554,7 +2554,7 @@ declare class Machine<mDT> {
|
|
|
2554
2554
|
* console.log( final_test.state_is_final('second') ); // true
|
|
2555
2555
|
* ```
|
|
2556
2556
|
*
|
|
2557
|
-
* @
|
|
2557
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2558
2558
|
*
|
|
2559
2559
|
* @param whichState The name of the state to check for finality
|
|
2560
2560
|
*
|
|
@@ -2582,9 +2582,9 @@ declare class Machine<mDT> {
|
|
|
2582
2582
|
* Serialize the current machine, including all defining state but not the
|
|
2583
2583
|
* machine string, to a structure. This means you will need the machine
|
|
2584
2584
|
* string to recreate (to not waste repeated space;) if you want the machine
|
|
2585
|
-
* string embedded, call
|
|
2585
|
+
* string embedded, call `serialize_with_string` instead.
|
|
2586
2586
|
*
|
|
2587
|
-
* @
|
|
2587
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2588
2588
|
*
|
|
2589
2589
|
* @param comment An optional comment string to embed in the serialized
|
|
2590
2590
|
* output for identification or debugging.
|
|
@@ -2744,7 +2744,7 @@ declare class Machine<mDT> {
|
|
|
2744
2744
|
* console.log( lswitch.states() ); // ['on', 'off']
|
|
2745
2745
|
* ```
|
|
2746
2746
|
*
|
|
2747
|
-
* @
|
|
2747
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2748
2748
|
*
|
|
2749
2749
|
* @returns An array of all state names in the machine.
|
|
2750
2750
|
*
|
|
@@ -2769,7 +2769,7 @@ declare class Machine<mDT> {
|
|
|
2769
2769
|
* console.log( lswitch.has_state('dance') ); // false
|
|
2770
2770
|
* ```
|
|
2771
2771
|
*
|
|
2772
|
-
* @
|
|
2772
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2773
2773
|
*
|
|
2774
2774
|
* @param whichState The state to be checked for existence.
|
|
2775
2775
|
*
|
|
@@ -2807,7 +2807,7 @@ declare class Machine<mDT> {
|
|
|
2807
2807
|
* ]
|
|
2808
2808
|
* ```
|
|
2809
2809
|
*
|
|
2810
|
-
* @
|
|
2810
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2811
2811
|
*
|
|
2812
2812
|
* @returns An array of all {@link JssmTransition} edge objects.
|
|
2813
2813
|
*
|
|
@@ -2958,7 +2958,7 @@ declare class Machine<mDT> {
|
|
|
2958
2958
|
* light.list_transitions(); // { entrances: [ 'yellow', 'off' ], exits: [ 'green', 'off' ] }
|
|
2959
2959
|
* ```
|
|
2960
2960
|
*
|
|
2961
|
-
* @
|
|
2961
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2962
2962
|
*
|
|
2963
2963
|
* @param whichState The state whose transitions to have listed
|
|
2964
2964
|
*
|
|
@@ -2969,7 +2969,7 @@ declare class Machine<mDT> {
|
|
|
2969
2969
|
* List all entrances attached to the current state. Please note that the
|
|
2970
2970
|
* order of the list is not defined. This list includes both unforced and
|
|
2971
2971
|
* forced entrances; if this isn't desired, consider
|
|
2972
|
-
*
|
|
2972
|
+
* `list_unforced_entrances` or `list_forced_entrances` as
|
|
2973
2973
|
* appropriate.
|
|
2974
2974
|
*
|
|
2975
2975
|
* ```typescript
|
|
@@ -2981,7 +2981,7 @@ declare class Machine<mDT> {
|
|
|
2981
2981
|
* light.list_entrances(); // [ 'yellow', 'off' ]
|
|
2982
2982
|
* ```
|
|
2983
2983
|
*
|
|
2984
|
-
* @
|
|
2984
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
2985
2985
|
*
|
|
2986
2986
|
* @param whichState The state whose entrances to have listed
|
|
2987
2987
|
*
|
|
@@ -2991,8 +2991,8 @@ declare class Machine<mDT> {
|
|
|
2991
2991
|
*
|
|
2992
2992
|
* List all exits attached to the current state. Please note that the order
|
|
2993
2993
|
* of the list is not defined. This list includes both unforced and forced
|
|
2994
|
-
* exits; if this isn't desired, consider
|
|
2995
|
-
*
|
|
2994
|
+
* exits; if this isn't desired, consider `list_unforced_exits` or
|
|
2995
|
+
* `list_forced_exits` as appropriate.
|
|
2996
2996
|
*
|
|
2997
2997
|
* ```typescript
|
|
2998
2998
|
* import { sm } from 'jssm';
|
|
@@ -3003,7 +3003,7 @@ declare class Machine<mDT> {
|
|
|
3003
3003
|
* light.list_exits(); // [ 'green', 'off' ]
|
|
3004
3004
|
* ```
|
|
3005
3005
|
*
|
|
3006
|
-
* @
|
|
3006
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3007
3007
|
*
|
|
3008
3008
|
* @param whichState The state whose exits to have listed
|
|
3009
3009
|
*
|
|
@@ -3141,7 +3141,7 @@ declare class Machine<mDT> {
|
|
|
3141
3141
|
* console.log( machine.actions() ); // logs ['next', 'shutdown']
|
|
3142
3142
|
* ```
|
|
3143
3143
|
*
|
|
3144
|
-
* @
|
|
3144
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3145
3145
|
*
|
|
3146
3146
|
* @param whichState The state whose actions to list. Defaults to the
|
|
3147
3147
|
* current state.
|
|
@@ -3167,7 +3167,7 @@ declare class Machine<mDT> {
|
|
|
3167
3167
|
* console.log( machine.list_states_having_action('start') ); // ['off']
|
|
3168
3168
|
* ```
|
|
3169
3169
|
*
|
|
3170
|
-
* @
|
|
3170
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3171
3171
|
*
|
|
3172
3172
|
* @param whichState The action to be checked for associated states
|
|
3173
3173
|
*
|
|
@@ -3240,7 +3240,7 @@ declare class Machine<mDT> {
|
|
|
3240
3240
|
* m.isIn('nonesuch'); // false — undeclared group has no members
|
|
3241
3241
|
* ```
|
|
3242
3242
|
*
|
|
3243
|
-
* @
|
|
3243
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3244
3244
|
*
|
|
3245
3245
|
* @param groupName The group to test the current state against.
|
|
3246
3246
|
*
|
|
@@ -3268,7 +3268,7 @@ declare class Machine<mDT> {
|
|
|
3268
3268
|
* m.groupsOf('z'); // Set {} — not in any group
|
|
3269
3269
|
* ```
|
|
3270
3270
|
*
|
|
3271
|
-
* @
|
|
3271
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3272
3272
|
*
|
|
3273
3273
|
* @param state The state whose containing groups are wanted.
|
|
3274
3274
|
*
|
|
@@ -3294,7 +3294,7 @@ declare class Machine<mDT> {
|
|
|
3294
3294
|
* m.groups(); // [ 'first', 'second' ]
|
|
3295
3295
|
* ```
|
|
3296
3296
|
*
|
|
3297
|
-
* @
|
|
3297
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3298
3298
|
*
|
|
3299
3299
|
* @returns The declared group names, in declaration order.
|
|
3300
3300
|
*
|
|
@@ -3317,7 +3317,7 @@ declare class Machine<mDT> {
|
|
|
3317
3317
|
* m.statesIn('inner'); // [ 'a', 'b' ]
|
|
3318
3318
|
* ```
|
|
3319
3319
|
*
|
|
3320
|
-
* @
|
|
3320
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3321
3321
|
*
|
|
3322
3322
|
* @param groupName The group whose transitive member states are wanted.
|
|
3323
3323
|
*
|
|
@@ -3365,11 +3365,11 @@ declare class Machine<mDT> {
|
|
|
3365
3365
|
* off(); // unsubscribe
|
|
3366
3366
|
* ```
|
|
3367
3367
|
*
|
|
3368
|
-
* @
|
|
3368
|
+
* @typeParam Ev The event name (drives the detail type).
|
|
3369
3369
|
* @param name The event name to subscribe to.
|
|
3370
|
-
* @param
|
|
3371
|
-
*
|
|
3372
|
-
*
|
|
3370
|
+
* @param handler The handler invoked on each matching delivery. The
|
|
3371
|
+
* three-argument `(name, filter, handler)` form inserts a
|
|
3372
|
+
* filter object before the handler (see the example above).
|
|
3373
3373
|
* @returns A function that unsubscribes when called.
|
|
3374
3374
|
*
|
|
3375
3375
|
* @see Machine.off
|
|
@@ -3386,10 +3386,11 @@ declare class Machine<mDT> {
|
|
|
3386
3386
|
* m.once('terminal', e => console.log(`done at ${e.state}`));
|
|
3387
3387
|
* ```
|
|
3388
3388
|
*
|
|
3389
|
-
* @
|
|
3389
|
+
* @typeParam Ev The event name.
|
|
3390
3390
|
* @param name The event name.
|
|
3391
|
-
* @param
|
|
3392
|
-
*
|
|
3391
|
+
* @param handler The handler invoked on the first matching delivery. The
|
|
3392
|
+
* three-argument `(name, filter, handler)` form inserts a
|
|
3393
|
+
* filter object before the handler (same shapes as `on`).
|
|
3393
3394
|
* @returns A function that unsubscribes early if called before the
|
|
3394
3395
|
* handler has fired.
|
|
3395
3396
|
*
|
|
@@ -3890,7 +3891,7 @@ declare class Machine<mDT> {
|
|
|
3890
3891
|
* - When multiple edges exist between two states with different `kind`
|
|
3891
3892
|
* values, only the first edge's kind is used to pick the edge-type hook.
|
|
3892
3893
|
*
|
|
3893
|
-
* @
|
|
3894
|
+
* @typeParam mDT The type of the machine data member; usually omitted.
|
|
3894
3895
|
*
|
|
3895
3896
|
* @param newStateOrAction The target state name (for a plain or forced
|
|
3896
3897
|
* transition) or the action name (when `wasAction` is true).
|
|
@@ -3942,7 +3943,7 @@ declare class Machine<mDT> {
|
|
|
3942
3943
|
*
|
|
3943
3944
|
* Notice that the machine's current state, `e`, is not in the returned list.
|
|
3944
3945
|
*
|
|
3945
|
-
* @
|
|
3946
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3946
3947
|
*
|
|
3947
3948
|
*/
|
|
3948
3949
|
get history(): [string, mDT][];
|
|
@@ -3975,7 +3976,7 @@ declare class Machine<mDT> {
|
|
|
3975
3976
|
*
|
|
3976
3977
|
* Notice that the machine's current state, `e`, is in the returned list.
|
|
3977
3978
|
*
|
|
3978
|
-
* @
|
|
3979
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3979
3980
|
*
|
|
3980
3981
|
*/
|
|
3981
3982
|
get history_inclusive(): [string, mDT][];
|
|
@@ -3994,7 +3995,7 @@ declare class Machine<mDT> {
|
|
|
3994
3995
|
* foo.history_length; // 5
|
|
3995
3996
|
* ```
|
|
3996
3997
|
*
|
|
3997
|
-
* @
|
|
3998
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
3998
3999
|
*
|
|
3999
4000
|
*/
|
|
4000
4001
|
get history_length(): number;
|
|
@@ -4011,7 +4012,7 @@ declare class Machine<mDT> {
|
|
|
4011
4012
|
* light.state(); // 'green'
|
|
4012
4013
|
* ```
|
|
4013
4014
|
*
|
|
4014
|
-
* @
|
|
4015
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4015
4016
|
*
|
|
4016
4017
|
* @param actionName The action to engage
|
|
4017
4018
|
*
|
|
@@ -4038,7 +4039,7 @@ declare class Machine<mDT> {
|
|
|
4038
4039
|
* // { shape: 'circle' }
|
|
4039
4040
|
* ```
|
|
4040
4041
|
*
|
|
4041
|
-
* @
|
|
4042
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4042
4043
|
*
|
|
4043
4044
|
* @returns The {@link JssmStateConfig} for standard states.
|
|
4044
4045
|
*
|
|
@@ -4064,7 +4065,7 @@ declare class Machine<mDT> {
|
|
|
4064
4065
|
* // { shape: 'circle' }
|
|
4065
4066
|
* ```
|
|
4066
4067
|
*
|
|
4067
|
-
* @
|
|
4068
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4068
4069
|
*
|
|
4069
4070
|
* @returns The {@link JssmStateConfig} for hooked states.
|
|
4070
4071
|
*
|
|
@@ -4089,7 +4090,7 @@ declare class Machine<mDT> {
|
|
|
4089
4090
|
* // { shape: 'circle' }
|
|
4090
4091
|
* ```
|
|
4091
4092
|
*
|
|
4092
|
-
* @
|
|
4093
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4093
4094
|
*
|
|
4094
4095
|
* @returns The {@link JssmStateConfig} for start states.
|
|
4095
4096
|
*
|
|
@@ -4119,7 +4120,7 @@ declare class Machine<mDT> {
|
|
|
4119
4120
|
* // { shape: 'circle' }
|
|
4120
4121
|
* ```
|
|
4121
4122
|
*
|
|
4122
|
-
* @
|
|
4123
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4123
4124
|
*
|
|
4124
4125
|
* @returns The {@link JssmStateConfig} for end states.
|
|
4125
4126
|
*
|
|
@@ -4144,7 +4145,7 @@ declare class Machine<mDT> {
|
|
|
4144
4145
|
* // { shape: 'circle' }
|
|
4145
4146
|
* ```
|
|
4146
4147
|
*
|
|
4147
|
-
* @
|
|
4148
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4148
4149
|
*
|
|
4149
4150
|
* @returns The {@link JssmStateConfig} for terminal states.
|
|
4150
4151
|
*
|
|
@@ -4166,7 +4167,7 @@ declare class Machine<mDT> {
|
|
|
4166
4167
|
* // { shape: 'circle' }
|
|
4167
4168
|
* ```
|
|
4168
4169
|
*
|
|
4169
|
-
* @
|
|
4170
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4170
4171
|
*
|
|
4171
4172
|
* @returns The {@link JssmStateConfig} for the active state.
|
|
4172
4173
|
*
|
|
@@ -4346,7 +4347,7 @@ declare class Machine<mDT> {
|
|
|
4346
4347
|
* state's declaration into a fresh {@link JssmStateConfig} — the tier-5
|
|
4347
4348
|
* "`state foo : { … }`" contribution of the config cascade. A state with no
|
|
4348
4349
|
* declaration yields an all-`undefined` config (which contributes nothing
|
|
4349
|
-
* once folded with
|
|
4350
|
+
* once folded with `merge_state_config`).
|
|
4350
4351
|
*
|
|
4351
4352
|
* @param state The state whose per-state declared style is wanted.
|
|
4352
4353
|
*
|
|
@@ -4386,7 +4387,7 @@ declare class Machine<mDT> {
|
|
|
4386
4387
|
* overlay (tier 6) is NOT applied here; it is layered on top by
|
|
4387
4388
|
* {@link resolve_state_config} so it wins over per-state config.
|
|
4388
4389
|
*
|
|
4389
|
-
* Tiers, folded least-specific → most-specific with
|
|
4390
|
+
* Tiers, folded least-specific → most-specific with `merge_state_config`
|
|
4390
4391
|
* (later wins, never throwing on a cross-tier key collision):
|
|
4391
4392
|
*
|
|
4392
4393
|
* 1. theme defaults — `base_theme.state`, then each selected theme's
|
|
@@ -4418,7 +4419,7 @@ declare class Machine<mDT> {
|
|
|
4418
4419
|
* successor to the ad-hoc layer merge {@link style_for} used to perform.
|
|
4419
4420
|
*
|
|
4420
4421
|
* For any state OTHER than the current one, this returns the memoized static
|
|
4421
|
-
* resolution (tiers 1–5; see
|
|
4422
|
+
* resolution (tiers 1–5; see `_compose_state_config`) — theme →
|
|
4422
4423
|
* `default_state_config` → per-kind defaults → depth-ordered group metadata →
|
|
4423
4424
|
* per-state config. The cache is keyed by state and never invalidated, since
|
|
4424
4425
|
* those tiers do not depend on which state is current.
|
|
@@ -4428,7 +4429,7 @@ declare class Machine<mDT> {
|
|
|
4428
4429
|
* layers: the active-state THEME layers fold in just below the per-state
|
|
4429
4430
|
* config (tier 3-active), and the user `active_state : { … }` overlay folds
|
|
4430
4431
|
* in LAST (tier 6), on top of everything, so it wins over per-state config.
|
|
4431
|
-
* Every fold uses
|
|
4432
|
+
* Every fold uses `merge_state_config`, so a key set at a lower tier is
|
|
4432
4433
|
* overridden — never rejected — by a higher one.
|
|
4433
4434
|
*
|
|
4434
4435
|
* ```typescript
|
|
@@ -4438,7 +4439,7 @@ declare class Machine<mDT> {
|
|
|
4438
4439
|
* m.resolve_state_config('working').color; // '#ffa500ff' — from group &busy
|
|
4439
4440
|
* ```
|
|
4440
4441
|
*
|
|
4441
|
-
* @
|
|
4442
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4442
4443
|
*
|
|
4443
4444
|
* @param state The state to compute the composite config for.
|
|
4444
4445
|
*
|
|
@@ -4461,7 +4462,7 @@ declare class Machine<mDT> {
|
|
|
4461
4462
|
* winning over outer), then the per-state config, and finally — for the
|
|
4462
4463
|
* current state only — the active overlay. Last wins at every tier.
|
|
4463
4464
|
*
|
|
4464
|
-
* @
|
|
4465
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4465
4466
|
*
|
|
4466
4467
|
* @param state The state to compute the composite style for.
|
|
4467
4468
|
*
|
|
@@ -4495,7 +4496,7 @@ declare class Machine<mDT> {
|
|
|
4495
4496
|
* light.state(); // 'yellow'
|
|
4496
4497
|
* ```
|
|
4497
4498
|
*
|
|
4498
|
-
* @
|
|
4499
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4499
4500
|
*
|
|
4500
4501
|
* @param actionName The action to engage
|
|
4501
4502
|
*
|
|
@@ -4528,7 +4529,7 @@ declare class Machine<mDT> {
|
|
|
4528
4529
|
* light.state(); // 'green'
|
|
4529
4530
|
* ```
|
|
4530
4531
|
*
|
|
4531
|
-
* @
|
|
4532
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4532
4533
|
*
|
|
4533
4534
|
* @param newState The state to switch to
|
|
4534
4535
|
*
|
|
@@ -4550,7 +4551,7 @@ declare class Machine<mDT> {
|
|
|
4550
4551
|
* light.state(); // 'green'
|
|
4551
4552
|
* ```
|
|
4552
4553
|
*
|
|
4553
|
-
* @
|
|
4554
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4554
4555
|
*
|
|
4555
4556
|
* @param newState The state to switch to
|
|
4556
4557
|
*
|
|
@@ -4575,7 +4576,7 @@ declare class Machine<mDT> {
|
|
|
4575
4576
|
* light.state(); // 'off'
|
|
4576
4577
|
* ```
|
|
4577
4578
|
*
|
|
4578
|
-
* @
|
|
4579
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4579
4580
|
*
|
|
4580
4581
|
* @param newState The state to switch to
|
|
4581
4582
|
*
|
|
@@ -4679,7 +4680,7 @@ declare class Machine<mDT> {
|
|
|
4679
4680
|
* const lswitch = jssm.from('on <=> off;');
|
|
4680
4681
|
* ```
|
|
4681
4682
|
*
|
|
4682
|
-
* @
|
|
4683
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4683
4684
|
*
|
|
4684
4685
|
* @param template_strings The assembled code
|
|
4685
4686
|
*
|
|
@@ -4702,7 +4703,7 @@ declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: a
|
|
|
4702
4703
|
* const lswitch = jssm.from('on <=> off;');
|
|
4703
4704
|
* ```
|
|
4704
4705
|
*
|
|
4705
|
-
* @
|
|
4706
|
+
* @typeParam mDT The type of the machine data member; usually omitted
|
|
4706
4707
|
*
|
|
4707
4708
|
* @param MachineAsString The FSL code to evaluate
|
|
4708
4709
|
*
|
|
@@ -4728,7 +4729,7 @@ declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Par
|
|
|
4728
4729
|
* is_hook_complex_result({ other: 'thing' }); // false
|
|
4729
4730
|
* ```
|
|
4730
4731
|
*
|
|
4731
|
-
* @
|
|
4732
|
+
* @typeParam mDT The type of the machine data member; usually omitted.
|
|
4732
4733
|
*
|
|
4733
4734
|
* @param hr The value to test.
|
|
4734
4735
|
*
|
|
@@ -4757,7 +4758,7 @@ declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResu
|
|
|
4757
4758
|
* is_hook_rejection({ pass: false }); // true (reject)
|
|
4758
4759
|
* ```
|
|
4759
4760
|
*
|
|
4760
|
-
* @
|
|
4761
|
+
* @typeParam mDT The type of the machine data member; usually omitted.
|
|
4761
4762
|
*
|
|
4762
4763
|
* @param hr A hook result of any legal shape.
|
|
4763
4764
|
*
|
|
@@ -4787,7 +4788,7 @@ declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean;
|
|
|
4787
4788
|
*
|
|
4788
4789
|
* Anything else is a programmer error and throws.
|
|
4789
4790
|
*
|
|
4790
|
-
* @
|
|
4791
|
+
* @typeParam mDT The type of the machine data member; usually omitted.
|
|
4791
4792
|
*
|
|
4792
4793
|
* @param maybe_hook The hook handler to call, or `undefined` for the
|
|
4793
4794
|
* "no hook installed" case.
|
|
@@ -4824,7 +4825,7 @@ declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefine
|
|
|
4824
4825
|
* - `false` or `null` → `{ pass: false }`
|
|
4825
4826
|
* - a complex result → returned as-is
|
|
4826
4827
|
*
|
|
4827
|
-
* @
|
|
4828
|
+
* @typeParam mDT The type of the machine data member; usually omitted.
|
|
4828
4829
|
*
|
|
4829
4830
|
* @param maybe_hook The everything-hook handler, or `undefined` when none
|
|
4830
4831
|
* is installed.
|
|
@@ -4889,7 +4890,7 @@ declare function compareVersions(v1: string, v2: string): number;
|
|
|
4889
4890
|
* state, data, and history. For security and compatibility reasons, it will
|
|
4890
4891
|
* refuse to deserialize data from future versions of the library.
|
|
4891
4892
|
*
|
|
4892
|
-
* @
|
|
4893
|
+
* @typeParam mDT - The type of the machine data member
|
|
4893
4894
|
*
|
|
4894
4895
|
* @param {string} machine_string - The FSL string defining the machine structure
|
|
4895
4896
|
* @param {JssmSerialization<mDT>} ser - The serialization object to restore from
|