jssm 5.162.2 → 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 +2 -2
- 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 +2 -2
- package/dist/deno/jssm.d.ts +14 -13
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_compiler.d.ts +1 -1
- package/dist/deno/jssm_types.d.ts +17 -17
- package/dist/deno/jssm_viz.d.ts +1 -1
- package/dist/fence/fence.js +11 -11
- 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 +30 -29
- package/jssm.es6.d.ts +30 -29
- package/jssm.fence.d.ts +29 -28
- package/jssm_viz.es5.d.cts +30 -29
- package/jssm_viz.es6.d.ts +30 -29
- package/package.json +1 -1
package/jssm.es5.d.cts
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,7 +1178,7 @@ 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
1183
|
* @typeParam mDT The type of the machine data member.
|
|
1184
1184
|
* @typeParam Ev The event name.
|
|
@@ -1192,7 +1192,7 @@ type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev
|
|
|
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';
|
|
@@ -2582,7 +2582,7 @@ 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
|
*
|
|
@@ -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
|
|
@@ -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';
|
|
@@ -3367,9 +3367,9 @@ declare class Machine<mDT> {
|
|
|
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
|
|
@@ -3388,8 +3388,9 @@ declare class Machine<mDT> {
|
|
|
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
|
*
|
|
@@ -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
|
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,7 +1178,7 @@ 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
1183
|
* @typeParam mDT The type of the machine data member.
|
|
1184
1184
|
* @typeParam Ev The event name.
|
|
@@ -1192,7 +1192,7 @@ type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev
|
|
|
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';
|
|
@@ -2582,7 +2582,7 @@ 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
|
*
|
|
@@ -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
|
|
@@ -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';
|
|
@@ -3367,9 +3367,9 @@ declare class Machine<mDT> {
|
|
|
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
|
|
@@ -3388,8 +3388,9 @@ declare class Machine<mDT> {
|
|
|
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
|
*
|
|
@@ -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
|
package/jssm.fence.d.ts
CHANGED
|
@@ -185,7 +185,7 @@ type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "
|
|
|
185
185
|
/**
|
|
186
186
|
* Semantic category of an arrow's transition. `'legal'` is a normal
|
|
187
187
|
* transition, `'main'` is part of the machine's primary path, `'forced'`
|
|
188
|
-
* may only be taken via {@link Machine.force_transition}, and `'none'`
|
|
188
|
+
* may only be taken via {@link jssm!Machine.force_transition}, and `'none'`
|
|
189
189
|
* means no transition exists in that direction.
|
|
190
190
|
*/
|
|
191
191
|
type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
|
|
@@ -251,8 +251,8 @@ declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"
|
|
|
251
251
|
*/
|
|
252
252
|
type FslTheme = typeof FslThemes[number];
|
|
253
253
|
/**
|
|
254
|
-
* Persistable snapshot of a Machine produced by {@link Machine.serialize}
|
|
255
|
-
* and consumed by {@link deserialize}. Carries the current state, the
|
|
254
|
+
* Persistable snapshot of a Machine produced by {@link jssm!Machine.serialize}
|
|
255
|
+
* and consumed by {@link jssm!deserialize}. Carries the current state, the
|
|
256
256
|
* associated machine data, the recent history (subject to the configured
|
|
257
257
|
* capacity), and metadata to detect version-skew on rehydration.
|
|
258
258
|
*
|
|
@@ -409,7 +409,7 @@ type JssmGenericState = {
|
|
|
409
409
|
complete: boolean;
|
|
410
410
|
};
|
|
411
411
|
/**
|
|
412
|
-
* The full internal bookkeeping snapshot of a {@link Machine}, exposed for
|
|
412
|
+
* The full internal bookkeeping snapshot of a {@link jssm!Machine}, exposed for
|
|
413
413
|
* advanced introspection. Contains the current state, the state map, the
|
|
414
414
|
* edge map and reverse-action map, and the original edge list. The
|
|
415
415
|
* `internal_state_impl_version` field exists so that consumers can detect
|
|
@@ -462,7 +462,7 @@ type JssmStateDeclarationRule = {
|
|
|
462
462
|
/**
|
|
463
463
|
* The fully-condensed declaration for a single state, including its raw
|
|
464
464
|
* rule list (`declarations`) and the well-known styling fields jssm-viz
|
|
465
|
-
* understands. Returned by {@link Machine.state_declaration}.
|
|
465
|
+
* understands. Returned by {@link jssm!Machine.state_declaration}.
|
|
466
466
|
*/
|
|
467
467
|
type JssmStateDeclaration = {
|
|
468
468
|
declarations: Array<JssmStateDeclarationRule>;
|
|
@@ -655,7 +655,7 @@ type JssmBaseTheme = {
|
|
|
655
655
|
title: undefined;
|
|
656
656
|
};
|
|
657
657
|
/**
|
|
658
|
-
* Full configuration object accepted by the {@link Machine} constructor and
|
|
658
|
+
* Full configuration object accepted by the {@link jssm!Machine} constructor and
|
|
659
659
|
* by {@link from}. Carries the transition list and the optional knobs
|
|
660
660
|
* governing layout, theming, history, start/end states, property
|
|
661
661
|
* definitions, machine metadata (author, license, version, ...) and the
|
|
@@ -678,14 +678,14 @@ type JssmEditorConfig = {
|
|
|
678
678
|
};
|
|
679
679
|
/** Which stochastic view a run batch produces. */
|
|
680
680
|
type JssmStochasticMode = 'montecarlo' | 'steady_state';
|
|
681
|
-
/** Options for {@link Machine.stochastic_summary} / {@link Machine.stochastic_runs}. */
|
|
681
|
+
/** Options for {@link jssm!Machine.stochastic_summary} / {@link jssm!Machine.stochastic_runs}. */
|
|
682
682
|
type JssmStochasticOptions = {
|
|
683
683
|
mode?: JssmStochasticMode;
|
|
684
684
|
runs?: number;
|
|
685
685
|
max_steps?: number;
|
|
686
686
|
seed?: number;
|
|
687
687
|
};
|
|
688
|
-
/** One walk's result, yielded by {@link Machine.stochastic_runs}. */
|
|
688
|
+
/** One walk's result, yielded by {@link jssm!Machine.stochastic_runs}. */
|
|
689
689
|
type JssmStochasticRun = {
|
|
690
690
|
states: Array<string>;
|
|
691
691
|
edges: Array<string>;
|
|
@@ -717,7 +717,7 @@ type JssmGenericConfig<StateType, DataType> = {
|
|
|
717
717
|
history?: number;
|
|
718
718
|
/**
|
|
719
719
|
* Maximum depth of the boundary-hook action cascade before the machine
|
|
720
|
-
* throws a {@link JssmError} rather than risking a stack overflow or hang.
|
|
720
|
+
* throws a {@link jssm_error!JssmError} rather than risking a stack overflow or hang.
|
|
721
721
|
*
|
|
722
722
|
* Each time a boundary action fires a transition that itself crosses a
|
|
723
723
|
* boundary, the depth counter increments. A cascade exceeding this limit is
|
|
@@ -1014,7 +1014,7 @@ type HookRegistryEntry = {
|
|
|
1014
1014
|
target: HookTarget;
|
|
1015
1015
|
};
|
|
1016
1016
|
/**
|
|
1017
|
-
* Query for {@link Machine.has_hook} / {@link Machine.hooks_on}. A bare
|
|
1017
|
+
* Query for {@link jssm!Machine.has_hook} / {@link jssm!Machine.hooks_on}. A bare
|
|
1018
1018
|
* string is read as a state name; an `{ from, to, action? }` object is read
|
|
1019
1019
|
* as an edge (optionally a named edge); an `{ action }` object is read as a
|
|
1020
1020
|
* named action; a `{ group }` object is read as a named state group. This
|
|
@@ -1111,7 +1111,7 @@ type JssmHistory<mDT> = circular_buffer<[StateType$1, mDT]>;
|
|
|
1111
1111
|
*/
|
|
1112
1112
|
type JssmRng = () => number;
|
|
1113
1113
|
/**
|
|
1114
|
-
* All event names that {@link Machine.on} accepts. These are observation
|
|
1114
|
+
* All event names that {@link jssm!Machine.on} accepts. These are observation
|
|
1115
1115
|
* events fired by the machine in addition to (not in place of) the hook
|
|
1116
1116
|
* system. Hooks intercept; events observe.
|
|
1117
1117
|
*
|
|
@@ -1252,7 +1252,7 @@ type JssmHookLifecycleEventDetail<mDT> = {
|
|
|
1252
1252
|
};
|
|
1253
1253
|
/**
|
|
1254
1254
|
* Mapped type from {@link JssmEventName} to the corresponding detail
|
|
1255
|
-
* payload. Drives the discriminated-union typing of {@link Machine.on},
|
|
1255
|
+
* payload. Drives the discriminated-union typing of {@link jssm!Machine.on},
|
|
1256
1256
|
* so `e.action` and friends only exist where they're meaningful.
|
|
1257
1257
|
*/
|
|
1258
1258
|
type JssmEventDetailMap<mDT> = {
|
|
@@ -1271,7 +1271,7 @@ type JssmEventDetailMap<mDT> = {
|
|
|
1271
1271
|
'hook-removal': JssmHookLifecycleEventDetail<mDT>;
|
|
1272
1272
|
};
|
|
1273
1273
|
/**
|
|
1274
|
-
* Filter accepted by {@link Machine.on} / {@link Machine.once} for an
|
|
1274
|
+
* Filter accepted by {@link jssm!Machine.on} / {@link jssm!Machine.once} for an
|
|
1275
1275
|
* individual event name. Only events whose detail key matches every
|
|
1276
1276
|
* filter entry fire the handler. Events that don't list a filter key in
|
|
1277
1277
|
* v1 take no filter properties.
|
|
@@ -1299,7 +1299,7 @@ type JssmEventFilterMap<mDT> = {
|
|
|
1299
1299
|
'hook-removal': Record<string, never>;
|
|
1300
1300
|
};
|
|
1301
1301
|
/**
|
|
1302
|
-
* Per-event filter object (as passed to {@link Machine.on}). Use
|
|
1302
|
+
* Per-event filter object (as passed to {@link jssm!Machine.on}). Use
|
|
1303
1303
|
* `JssmEventDetailMap<mDT>[Ev]` to find the matching detail type.
|
|
1304
1304
|
* @typeParam mDT The type of the machine data member.
|
|
1305
1305
|
* @typeParam Ev The event name.
|
|
@@ -1313,7 +1313,7 @@ type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev
|
|
|
1313
1313
|
*/
|
|
1314
1314
|
type JssmEventHandler<mDT, Ev extends JssmEventName> = (detail: JssmEventDetailMap<mDT>[Ev]) => void;
|
|
1315
1315
|
/**
|
|
1316
|
-
* Function returned by {@link Machine.on} and {@link Machine.once} that
|
|
1316
|
+
* Function returned by {@link jssm!Machine.on} and {@link jssm!Machine.once} that
|
|
1317
1317
|
* removes the subscription. Calling it more than once is a no-op.
|
|
1318
1318
|
*/
|
|
1319
1319
|
type JssmUnsubscribe = () => void;
|
|
@@ -1885,7 +1885,7 @@ declare class Machine<mDT> {
|
|
|
1885
1885
|
* Serialize the current machine, including all defining state but not the
|
|
1886
1886
|
* machine string, to a structure. This means you will need the machine
|
|
1887
1887
|
* string to recreate (to not waste repeated space;) if you want the machine
|
|
1888
|
-
* string embedded, call
|
|
1888
|
+
* string embedded, call `serialize_with_string` instead.
|
|
1889
1889
|
*
|
|
1890
1890
|
* @typeParam mDT The type of the machine data member; usually omitted
|
|
1891
1891
|
*
|
|
@@ -2272,7 +2272,7 @@ declare class Machine<mDT> {
|
|
|
2272
2272
|
* List all entrances attached to the current state. Please note that the
|
|
2273
2273
|
* order of the list is not defined. This list includes both unforced and
|
|
2274
2274
|
* forced entrances; if this isn't desired, consider
|
|
2275
|
-
*
|
|
2275
|
+
* `list_unforced_entrances` or `list_forced_entrances` as
|
|
2276
2276
|
* appropriate.
|
|
2277
2277
|
*
|
|
2278
2278
|
* ```typescript
|
|
@@ -2294,8 +2294,8 @@ declare class Machine<mDT> {
|
|
|
2294
2294
|
*
|
|
2295
2295
|
* List all exits attached to the current state. Please note that the order
|
|
2296
2296
|
* of the list is not defined. This list includes both unforced and forced
|
|
2297
|
-
* exits; if this isn't desired, consider
|
|
2298
|
-
*
|
|
2297
|
+
* exits; if this isn't desired, consider `list_unforced_exits` or
|
|
2298
|
+
* `list_forced_exits` as appropriate.
|
|
2299
2299
|
*
|
|
2300
2300
|
* ```typescript
|
|
2301
2301
|
* import { sm } from 'jssm';
|
|
@@ -2670,9 +2670,9 @@ declare class Machine<mDT> {
|
|
|
2670
2670
|
*
|
|
2671
2671
|
* @typeParam Ev The event name (drives the detail type).
|
|
2672
2672
|
* @param name The event name to subscribe to.
|
|
2673
|
-
* @param
|
|
2674
|
-
*
|
|
2675
|
-
*
|
|
2673
|
+
* @param handler The handler invoked on each matching delivery. The
|
|
2674
|
+
* three-argument `(name, filter, handler)` form inserts a
|
|
2675
|
+
* filter object before the handler (see the example above).
|
|
2676
2676
|
* @returns A function that unsubscribes when called.
|
|
2677
2677
|
*
|
|
2678
2678
|
* @see Machine.off
|
|
@@ -2691,8 +2691,9 @@ declare class Machine<mDT> {
|
|
|
2691
2691
|
*
|
|
2692
2692
|
* @typeParam Ev The event name.
|
|
2693
2693
|
* @param name The event name.
|
|
2694
|
-
* @param
|
|
2695
|
-
*
|
|
2694
|
+
* @param handler The handler invoked on the first matching delivery. The
|
|
2695
|
+
* three-argument `(name, filter, handler)` form inserts a
|
|
2696
|
+
* filter object before the handler (same shapes as `on`).
|
|
2696
2697
|
* @returns A function that unsubscribes early if called before the
|
|
2697
2698
|
* handler has fired.
|
|
2698
2699
|
*
|
|
@@ -3649,7 +3650,7 @@ declare class Machine<mDT> {
|
|
|
3649
3650
|
* state's declaration into a fresh {@link JssmStateConfig} — the tier-5
|
|
3650
3651
|
* "`state foo : { … }`" contribution of the config cascade. A state with no
|
|
3651
3652
|
* declaration yields an all-`undefined` config (which contributes nothing
|
|
3652
|
-
* once folded with
|
|
3653
|
+
* once folded with `merge_state_config`).
|
|
3653
3654
|
*
|
|
3654
3655
|
* @param state The state whose per-state declared style is wanted.
|
|
3655
3656
|
*
|
|
@@ -3689,7 +3690,7 @@ declare class Machine<mDT> {
|
|
|
3689
3690
|
* overlay (tier 6) is NOT applied here; it is layered on top by
|
|
3690
3691
|
* {@link resolve_state_config} so it wins over per-state config.
|
|
3691
3692
|
*
|
|
3692
|
-
* Tiers, folded least-specific → most-specific with
|
|
3693
|
+
* Tiers, folded least-specific → most-specific with `merge_state_config`
|
|
3693
3694
|
* (later wins, never throwing on a cross-tier key collision):
|
|
3694
3695
|
*
|
|
3695
3696
|
* 1. theme defaults — `base_theme.state`, then each selected theme's
|
|
@@ -3721,7 +3722,7 @@ declare class Machine<mDT> {
|
|
|
3721
3722
|
* successor to the ad-hoc layer merge {@link style_for} used to perform.
|
|
3722
3723
|
*
|
|
3723
3724
|
* For any state OTHER than the current one, this returns the memoized static
|
|
3724
|
-
* resolution (tiers 1–5; see
|
|
3725
|
+
* resolution (tiers 1–5; see `_compose_state_config`) — theme →
|
|
3725
3726
|
* `default_state_config` → per-kind defaults → depth-ordered group metadata →
|
|
3726
3727
|
* per-state config. The cache is keyed by state and never invalidated, since
|
|
3727
3728
|
* those tiers do not depend on which state is current.
|
|
@@ -3731,7 +3732,7 @@ declare class Machine<mDT> {
|
|
|
3731
3732
|
* layers: the active-state THEME layers fold in just below the per-state
|
|
3732
3733
|
* config (tier 3-active), and the user `active_state : { … }` overlay folds
|
|
3733
3734
|
* in LAST (tier 6), on top of everything, so it wins over per-state config.
|
|
3734
|
-
* Every fold uses
|
|
3735
|
+
* Every fold uses `merge_state_config`, so a key set at a lower tier is
|
|
3735
3736
|
* overridden — never rejected — by a higher one.
|
|
3736
3737
|
*
|
|
3737
3738
|
* ```typescript
|