jssm 5.162.6 → 5.162.8

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.
Files changed (53) hide show
  1. package/README.md +7 -7
  2. package/custom-elements.json +47 -47
  3. package/dist/cdn/instance.js +5 -3
  4. package/dist/cdn/viz.js +1 -1
  5. package/dist/cli/fsl-export-system-prompt.cjs +27 -24
  6. package/dist/cli/fsl-render.cjs +1 -1
  7. package/dist/cli/fsl.cjs +1 -1
  8. package/dist/cli/lib.cjs +1 -1
  9. package/dist/cli/lib.mjs +1 -1
  10. package/dist/cm6/fsl_language.js +10 -14
  11. package/dist/deno/README.md +7 -7
  12. package/dist/deno/fence.d.ts +0 -1
  13. package/dist/deno/fsl_fence_highlight.d.ts +0 -4
  14. package/dist/deno/fsl_fence_render.d.ts +0 -8
  15. package/dist/deno/fsl_gif.d.ts +0 -8
  16. package/dist/deno/fsl_markdown_fence.d.ts +0 -5
  17. package/dist/deno/fsl_svg_patch.d.ts +0 -6
  18. package/dist/deno/fsl_walk.d.ts +0 -2
  19. package/dist/deno/jssm.d.ts +214 -503
  20. package/dist/deno/jssm.js +1 -1
  21. package/dist/deno/jssm_compiler.d.ts +1 -1
  22. package/dist/deno/jssm_constants.d.ts +0 -3
  23. package/dist/deno/jssm_intern.d.ts +0 -15
  24. package/dist/deno/jssm_theme.d.ts +2 -2
  25. package/dist/deno/jssm_types.d.ts +13 -34
  26. package/dist/deno/jssm_util.d.ts +20 -6
  27. package/dist/deno/jssm_viz.d.ts +5 -51
  28. package/dist/es6/cm6/fsl_language.d.ts +0 -2
  29. package/dist/fence/fence.js +1664 -1830
  30. package/dist/jssm.es5.cjs +1 -1
  31. package/dist/jssm.es5.iife.js +1 -1
  32. package/dist/jssm.es6.mjs +1 -1
  33. package/dist/jssm_viz.cjs +1 -1
  34. package/dist/jssm_viz.iife.cjs +1 -1
  35. package/dist/jssm_viz.mjs +1 -1
  36. package/dist/wc/docs.define.js +0 -5
  37. package/dist/wc/docs.js +79 -43
  38. package/dist/wc/editor.define.js +0 -5
  39. package/dist/wc/editor.js +1 -7
  40. package/dist/wc/instance.define.js +0 -6
  41. package/dist/wc/instance.js +93 -115
  42. package/dist/wc/viz.define.js +0 -6
  43. package/dist/wc/viz.js +22 -36
  44. package/dist/wc/widgets.define.js +0 -5
  45. package/dist/wc/widgets.js +117 -95
  46. package/jssm.cli.d.cts +0 -8
  47. package/jssm.cli.d.ts +0 -8
  48. package/jssm.es5.d.cts +449 -808
  49. package/jssm.es6.d.ts +449 -808
  50. package/jssm.fence.d.ts +213 -508
  51. package/jssm_viz.es5.d.cts +216 -529
  52. package/jssm_viz.es6.d.ts +216 -529
  53. package/package.json +16 -10
package/jssm_viz.es6.d.ts CHANGED
@@ -63,7 +63,6 @@ type JssmAllowIslands = true | false | 'with_start';
63
63
  * - `{ height }` — height-only form (`default_size: height 600;`)
64
64
  *
65
65
  * This is a *hint*, not a hard constraint. Renderers may ignore it.
66
- *
67
66
  * @see Machine.default_size
68
67
  */
69
68
  type JssmDefaultSize = {
@@ -98,8 +97,7 @@ type FslTheme = typeof FslThemes[number];
98
97
  * and consumed by {@link jssm!deserialize}. Carries the current state, the
99
98
  * associated machine data, the recent history (subject to the configured
100
99
  * capacity), and metadata to detect version-skew on rehydration.
101
- *
102
- * @typeParam DataType - The type of the user-supplied data payload (`mDT`).
100
+ * @template DataType - The type of the user-supplied data payload (`mDT`).
103
101
  */
104
102
  type JssmSerialization<DataType> = {
105
103
  jssm_version: string;
@@ -125,7 +123,6 @@ type JssmSerialization<DataType> = {
125
123
  * // [ { kind: 'group', name: 'inner', mode: 'nest' },
126
124
  * // { kind: 'state', name: 'x' } ]
127
125
  * ```
128
- *
129
126
  * @see JssmGroupRef
130
127
  * @see JssmGroupRegistry
131
128
  */
@@ -152,7 +149,6 @@ type JssmGroupMemberRef = {
152
149
  * // registry.get('outer') === [ { kind:'group', name:'inner', mode:'nest' },
153
150
  * // { kind:'state', name:'c' } ]
154
151
  * ```
155
- *
156
152
  * @see JssmGroupMemberRef
157
153
  */
158
154
  type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
@@ -162,7 +158,6 @@ type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
162
158
  * Each is optional so a subject may declare only one direction; the compiler
163
159
  * merges an `enter` and an `exit` declaration for the same subject into one
164
160
  * of these.
165
- *
166
161
  * @see JssmHookDeclaration
167
162
  */
168
163
  type JssmBoundaryHooks = {
@@ -173,7 +168,6 @@ type JssmBoundaryHooks = {
173
168
  * Maps each group name that has at least one boundary hook to its merged
174
169
  * {@link JssmBoundaryHooks}. Carried on {@link JssmGenericConfig} for the
175
170
  * runtime to consume; depth-aware firing is a later task.
176
- *
177
171
  * @see JssmHookDeclaration
178
172
  */
179
173
  type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
@@ -181,7 +175,6 @@ type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
181
175
  * Maps each plain state name that has at least one boundary hook to its
182
176
  * merged {@link JssmBoundaryHooks}. The state-subject analogue of
183
177
  * {@link JssmGroupHooks}.
184
- *
185
178
  * @see JssmHookDeclaration
186
179
  */
187
180
  type JssmStateHooks = Map<string, JssmBoundaryHooks>;
@@ -213,9 +206,8 @@ type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataT
213
206
  * per-edge `name`, an action label, a guard `check`, a transition
214
207
  * `probability` for stochastic models, and an `after_time` for timed
215
208
  * transitions.
216
- *
217
- * @typeParam StateType - The state-name type (usually `string`).
218
- * @typeParam DataType - The machine's data payload type (`mDT`).
209
+ * @template StateType - The state-name type (usually `string`).
210
+ * @template DataType - The machine's data payload type (`mDT`).
219
211
  */
220
212
  type JssmTransition<StateType, DataType> = {
221
213
  from: StateType;
@@ -399,7 +391,6 @@ type JssmGraphDefaultEdgeColor = {
399
391
  * reuses the per-state style items (so `color: red;` works inside a
400
392
  * `transition:` block exactly as inside a `state:` block) plus the
401
393
  * edge-scoped {@link JssmGraphDefaultEdgeColor} default.
402
- *
403
394
  * @see JssmTransitionConfig
404
395
  */
405
396
  type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeColor;
@@ -414,7 +405,6 @@ type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeColor;
414
405
  * const cfg = compile(parse('a -> b; transition: { color: red; };'));
415
406
  * // cfg.default_transition_config === [ { key: 'color', value: '#ff0000ff' } ]
416
407
  * ```
417
- *
418
408
  * @see JssmGraphConfig
419
409
  */
420
410
  type JssmTransitionConfig = JssmTransitionStyleKey[];
@@ -425,7 +415,7 @@ type JssmTransitionConfig = JssmTransitionStyleKey[];
425
415
  * default) into the consolidated `graph: {}` config. Each carries the
426
416
  * legacy parse key so downstream consumers can disambiguate.
427
417
  */
428
- type JssmGraphAliasKey = {
418
+ type JssmGraphAliasKey = JssmGraphDefaultEdgeColor | {
429
419
  key: 'graph_layout';
430
420
  value: JssmLayout;
431
421
  } | {
@@ -440,13 +430,12 @@ type JssmGraphAliasKey = {
440
430
  } | {
441
431
  key: 'flow';
442
432
  value: FslDirection;
443
- } | JssmGraphDefaultEdgeColor;
433
+ };
444
434
  /**
445
435
  * A single item inside a `graph: {}` default-config block. For v1 this
446
436
  * reuses the per-state style items plus the graph-scope alias items
447
437
  * ({@link JssmGraphAliasKey}) folded in from the deprecated top-level
448
438
  * graph keywords.
449
- *
450
439
  * @see JssmGraphConfig
451
440
  */
452
441
  type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
@@ -463,40 +452,9 @@ type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
463
452
  * // `background-color` item, so:
464
453
  * // cfg.default_graph_config includes { key: 'background-color', value: '#ffffffff' }
465
454
  * ```
466
- *
467
455
  * @see JssmTransitionConfig
468
456
  */
469
457
  type JssmGraphConfig = JssmGraphStyleKey[];
470
- /**
471
- * Complete shape of a jssm-viz theme. A theme provides a style block for
472
- * each kind of state (`state`, `hooked`, `start`, `end`, `terminal`) as
473
- * well as a matching `active_*` variant used while that state is current.
474
- *
475
- * The `graph`, `legal`, `main`, `forced`, `action`, and `title` slots are
476
- * reserved for future use and currently typed as `undefined`.
477
- *
478
- * Most user-defined themes should be typed as {@link JssmTheme} (the
479
- * `Partial` of this) so that omitted fields fall back to the base theme.
480
- */
481
- type JssmBaseTheme = {
482
- name: string;
483
- state: JssmStateConfig;
484
- hooked: JssmStateConfig;
485
- start: JssmStateConfig;
486
- end: JssmStateConfig;
487
- terminal: JssmStateConfig;
488
- active: JssmStateConfig;
489
- active_hooked: JssmStateConfig;
490
- active_start: JssmStateConfig;
491
- active_end: JssmStateConfig;
492
- active_terminal: JssmStateConfig;
493
- graph: undefined;
494
- legal: undefined;
495
- main: undefined;
496
- forced: undefined;
497
- action: undefined;
498
- title: undefined;
499
- };
500
458
  /**
501
459
  * Full configuration object accepted by the {@link jssm!Machine} constructor and
502
460
  * by {@link from}. Carries the transition list and the optional knobs
@@ -506,9 +464,8 @@ type JssmBaseTheme = {
506
464
  *
507
465
  * Most users never construct one of these directly — the `sm` tagged
508
466
  * template literal and {@link from} produce one from FSL source.
509
- *
510
- * @typeParam StateType - The state-name type (usually `string`).
511
- * @typeParam DataType - The user-supplied data payload type (`mDT`).
467
+ * @template StateType - The state-name type (usually `string`).
468
+ * @template DataType - The user-supplied data payload type (`mDT`).
512
469
  */
513
470
  /**
514
471
  * Editor/panel defaults an FSL machine declares in an `editor: {}` block
@@ -568,7 +525,6 @@ type JssmGenericConfig<StateType, DataType> = {
568
525
  *
569
526
  * Defaults to `100`. Raise it for legitimate pipelines that genuinely nest
570
527
  * more than 100 transitions via boundary hooks.
571
- *
572
528
  * @see Machine._boundary_depth_limit
573
529
  * @see Machine._fire_boundary_actions
574
530
  */
@@ -588,7 +544,7 @@ type JssmGenericConfig<StateType, DataType> = {
588
544
  failed_outputs?: Array<StateType>;
589
545
  initial_state?: StateType;
590
546
  start_states_no_enforce?: boolean;
591
- state_declaration?: Object[];
547
+ state_declaration?: object[];
592
548
  property_definition?: JssmPropertyDefinition[];
593
549
  state_property?: JssmPropertyDefinition[];
594
550
  arrange_declaration?: Array<Array<StateType>>;
@@ -652,7 +608,6 @@ type JssmGenericConfig<StateType, DataType> = {
652
608
  * arrow with optional per-direction action labels, probabilities, and
653
609
  * after-times. The recursive `se` field allows the parser to chain
654
610
  * arrows of the form `A -> B -> C`. Not intended for end-user code.
655
- *
656
611
  * @internal
657
612
  */
658
613
  type JssmCompileSe<StateType, mDT> = {
@@ -961,7 +916,6 @@ type JssmRng = () => number;
961
916
  * All event names that {@link jssm!Machine.on} accepts. These are observation
962
917
  * events fired by the machine in addition to (not in place of) the hook
963
918
  * system. Hooks intercept; events observe.
964
- *
965
919
  * @see Machine.on
966
920
  */
967
921
  type JssmEventName = 'transition' | 'rejection' | 'action' | 'entry' | 'exit' | 'terminal' | 'complete' | 'error' | 'data-change' | 'override' | 'timeout' | 'hook-registration' | 'hook-removal';
@@ -1055,7 +1009,7 @@ type JssmErrorEventDetail = {
1055
1009
  error: unknown;
1056
1010
  source_event: JssmEventName;
1057
1011
  source_detail: unknown;
1058
- handler: Function;
1012
+ handler: JssmEventHandler<unknown, JssmEventName>;
1059
1013
  };
1060
1014
  /**
1061
1015
  * Detail payload fired with a `data-change` event. Fires whenever the
@@ -1150,15 +1104,15 @@ type JssmEventFilterMap<mDT> = {
1150
1104
  /**
1151
1105
  * Per-event filter object (as passed to {@link jssm!Machine.on}). Use
1152
1106
  * `JssmEventDetailMap<mDT>[Ev]` to find the matching detail type.
1153
- * @typeParam mDT The type of the machine data member.
1154
- * @typeParam Ev The event name.
1107
+ * @template mDT The type of the machine data member.
1108
+ * @template Ev The event name.
1155
1109
  */
1156
1110
  type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev];
1157
1111
  /**
1158
1112
  * Per-event handler signature. Receives a detail object typed by event
1159
1113
  * name, so `e.action` (etc.) only exist where they're meaningful.
1160
- * @typeParam mDT The type of the machine data member.
1161
- * @typeParam Ev The event name.
1114
+ * @template mDT The type of the machine data member.
1115
+ * @template Ev The event name.
1162
1116
  */
1163
1117
  type JssmEventHandler<mDT, Ev extends JssmEventName> = (detail: JssmEventDetailMap<mDT>[Ev]) => void;
1164
1118
  /**
@@ -1175,7 +1129,6 @@ type JssmUnsubscribe = () => void;
1175
1129
  * (integer hashing) instead of repeated string-keyed lookups. Internal
1176
1130
  * machinery only — deliberately not re-exported from the `jssm` public
1177
1131
  * surface, so the public API is unchanged.
1178
- *
1179
1132
  * @internal
1180
1133
  */
1181
1134
  /**
@@ -1184,7 +1137,6 @@ type JssmUnsubscribe = () => void;
1184
1137
  * no removal, matching machine semantics (states and actions are fixed
1185
1138
  * after construction; late interning only happens for never-matching
1186
1139
  * lookups such as hook registrations naming unknown states).
1187
- *
1188
1140
  * @example
1189
1141
  * const i = new Interner();
1190
1142
  * i.intern('red'); // 0
@@ -1192,7 +1144,6 @@ type JssmUnsubscribe = () => void;
1192
1144
  * i.intern('red'); // 0 (idempotent)
1193
1145
  * i.id_of('green'); // 1
1194
1146
  * i.name_of(0); // 'red'
1195
- *
1196
1147
  * @see pair_key
1197
1148
  */
1198
1149
  declare class Interner {
@@ -1202,10 +1153,8 @@ declare class Interner {
1202
1153
  /**
1203
1154
  * Return the id for `name`, assigning the next dense id if the name has
1204
1155
  * not been seen before.
1205
- *
1206
1156
  * @param name - The string to intern.
1207
1157
  * @returns The (possibly newly assigned) integer id.
1208
- *
1209
1158
  * @example
1210
1159
  * interner.intern('red'); // 0 on first call, 0 on every later call
1211
1160
  */
@@ -1214,18 +1163,14 @@ declare class Interner {
1214
1163
  * Return the id for `name` without interning, or `undefined` when the
1215
1164
  * name has never been interned. This is the hot-path probe for
1216
1165
  * user-supplied names.
1217
- *
1218
1166
  * @param name - The string to look up.
1219
- *
1220
1167
  * @example
1221
1168
  * interner.id_of('mauve'); // undefined — never interned
1222
1169
  */
1223
1170
  id_of(name: string): number | undefined;
1224
1171
  /**
1225
1172
  * Return the name for `id`, or `undefined` for an id never assigned.
1226
- *
1227
1173
  * @param id - The integer id to invert.
1228
- *
1229
1174
  * @example
1230
1175
  * interner.name_of(0); // 'red'
1231
1176
  */
@@ -1254,7 +1199,6 @@ type StateType = string;
1254
1199
  * Internal record holding a single registered event subscription: the
1255
1200
  * handler, its optional filter, and a flag for `once` semantics. Not
1256
1201
  * exported.
1257
- *
1258
1202
  * @internal
1259
1203
  */
1260
1204
  type JssmEventEntry<mDT, Ev extends JssmEventName> = {
@@ -1263,15 +1207,8 @@ type JssmEventEntry<mDT, Ev extends JssmEventName> = {
1263
1207
  once: boolean;
1264
1208
  };
1265
1209
  declare class Machine<mDT> {
1210
+ #private;
1266
1211
  _state: StateType;
1267
- _states: Map<StateType, JssmGenericState>;
1268
- _edges: Array<JssmTransition<StateType, mDT>>;
1269
- _edge_map: Map<StateType, Map<StateType, number>>;
1270
- _outbound_edge_ids: Map<StateType, Array<number>>;
1271
- _named_transitions: Map<StateType, number>;
1272
- _actions: Map<StateType, Map<StateType, number>>;
1273
- _reverse_actions: Map<StateType, Map<StateType, number>>;
1274
- _reverse_action_targets: Map<StateType, Map<StateType, number>>;
1275
1212
  _state_interner: Interner;
1276
1213
  _action_interner: Interner;
1277
1214
  _state_id: number;
@@ -1292,7 +1229,7 @@ declare class Machine<mDT> {
1292
1229
  _npm_name?: string;
1293
1230
  _default_size?: JssmDefaultSize;
1294
1231
  _fsl_version?: string;
1295
- _raw_state_declaration?: Array<Object>;
1232
+ _raw_state_declaration?: Array<object>;
1296
1233
  _state_declarations: Map<StateType, JssmStateDeclaration>;
1297
1234
  _data?: mDT;
1298
1235
  _instance_name: string;
@@ -1380,8 +1317,8 @@ declare class Machine<mDT> {
1380
1317
  _create_started: number;
1381
1318
  _created: number;
1382
1319
  _after_mapping: Map<string, [string, number]>;
1383
- _timeout_source: (Function: any, number: any) => number;
1384
- _clear_timeout_source: (h: any) => void;
1320
+ _timeout_source: (f: () => void, a: number) => number;
1321
+ _clear_timeout_source: (h: number) => void;
1385
1322
  _timeout_handle: number | undefined;
1386
1323
  _timeout_target: string | undefined;
1387
1324
  _timeout_target_time: number | undefined;
@@ -1534,9 +1471,7 @@ declare class Machine<mDT> {
1534
1471
  * const m = jssm.from('on <=> off;', { data: { a: { b: 1 } } });
1535
1472
  * m._data_ref().a.b; // 1, zero-copy
1536
1473
  * ```
1537
- *
1538
1474
  * @returns The live data value; treat as read-only.
1539
- *
1540
1475
  * @see Machine.data
1541
1476
  * @internal
1542
1477
  */
@@ -1794,18 +1729,21 @@ declare class Machine<mDT> {
1794
1729
  * current state, data, and timestamp.
1795
1730
  *
1796
1731
  */
1797
- serialize(comment?: string | undefined): JssmSerialization<mDT>;
1798
- /** Get the graph layout direction (e.g. `'LR'`, `'TB'`). Set via the
1732
+ serialize(comment?: string): JssmSerialization<mDT>;
1733
+ /**
1734
+ * Get the graph layout direction (e.g. `'LR'`, `'TB'`). Set via the
1799
1735
  * FSL `graph_layout` directive.
1800
1736
  * @returns The layout string, or the default if not set.
1801
1737
  */
1802
1738
  graph_layout(): string;
1803
- /** Get the Graphviz DOT preamble string, injected before the graph body
1739
+ /**
1740
+ * Get the Graphviz DOT preamble string, injected before the graph body
1804
1741
  * during visualization. Set via the FSL `dot_preamble` directive.
1805
1742
  * @returns The preamble string.
1806
1743
  */
1807
1744
  dot_preamble(): string;
1808
- /** Get the consolidated `transition: {}` default-config block: the ordered,
1745
+ /**
1746
+ * Get the consolidated `transition: {}` default-config block: the ordered,
1809
1747
  * de-duplicated `{ key, value }[]` list of edge-default style items compiled
1810
1748
  * from a `transition: {}` block (e.g. `transition: { color: blue; }`). The
1811
1749
  * viz layer projects this onto a Graphviz `edge [ … ]` default statement so
@@ -1816,13 +1754,13 @@ declare class Machine<mDT> {
1816
1754
  * sm`a -> b; transition: { color: blue; };`.default_transition_config();
1817
1755
  * // [ { key: 'color', value: '#0000ffff' } ]
1818
1756
  * ```
1819
- *
1820
1757
  * @returns The transition-config item list, or `undefined` if the machine
1821
1758
  * declared no `transition: {}` block.
1822
1759
  * @see default_graph_config
1823
1760
  */
1824
1761
  default_transition_config(): JssmTransitionConfig | undefined;
1825
- /** Get the consolidated `graph: {}` default-config block: the ordered,
1762
+ /**
1763
+ * Get the consolidated `graph: {}` default-config block: the ordered,
1826
1764
  * de-duplicated `{ key, value }[]` list of graph-scope style items. The
1827
1765
  * compiler folds the deprecated top-level graph keywords
1828
1766
  * (`graph_bg_color` → `background-color`, plus `graph_layout`, `theme`,
@@ -1836,29 +1774,33 @@ declare class Machine<mDT> {
1836
1774
  * sm`a -> b; graph: { background-color: #ffffff; };`.default_graph_config();
1837
1775
  * // [ { key: 'background-color', value: '#ffffffff' } ]
1838
1776
  * ```
1839
- *
1840
1777
  * @returns The graph-config item list, or `undefined` if the machine has no
1841
1778
  * graph config (no `graph: {}` block and no deprecated graph keyword).
1842
1779
  * @see default_transition_config
1843
1780
  */
1844
1781
  default_graph_config(): JssmGraphConfig | undefined;
1845
- /** Get the machine's author list. Set via the FSL `machine_author` directive.
1782
+ /**
1783
+ * Get the machine's author list. Set via the FSL `machine_author` directive.
1846
1784
  * @returns An array of author name strings.
1847
1785
  */
1848
1786
  machine_author(): Array<string>;
1849
- /** Get the machine's comment string. Set via the FSL `machine_comment` directive.
1787
+ /**
1788
+ * Get the machine's comment string. Set via the FSL `machine_comment` directive.
1850
1789
  * @returns The comment string.
1851
1790
  */
1852
1791
  machine_comment(): string;
1853
- /** Get the machine's contributor list. Set via the FSL `machine_contributor` directive.
1792
+ /**
1793
+ * Get the machine's contributor list. Set via the FSL `machine_contributor` directive.
1854
1794
  * @returns An array of contributor name strings.
1855
1795
  */
1856
1796
  machine_contributor(): Array<string>;
1857
- /** Get the machine's definition string. Set via the FSL `machine_definition` directive.
1797
+ /**
1798
+ * Get the machine's definition string. Set via the FSL `machine_definition` directive.
1858
1799
  * @returns The definition string.
1859
1800
  */
1860
1801
  machine_definition(): string;
1861
- /** Get the machine's natural language as an ISO 639-1 code. Set via the FSL
1802
+ /**
1803
+ * Get the machine's natural language as an ISO 639-1 code. Set via the FSL
1862
1804
  * `machine_language` directive, which accepts a language name or code, or a
1863
1805
  * BCP-47 tag whose region subtag is dropped (`en-us` -> `en`). Unrecognized
1864
1806
  * values resolve to `undefined`.
@@ -1866,32 +1808,35 @@ declare class Machine<mDT> {
1866
1808
  * supplied value did not resolve to a known language.
1867
1809
  */
1868
1810
  machine_language(): string;
1869
- /** Get the machine's license string. Set via the FSL `machine_license` directive.
1811
+ /**
1812
+ * Get the machine's license string. Set via the FSL `machine_license` directive.
1870
1813
  * @returns The license string.
1871
1814
  */
1872
1815
  machine_license(): string;
1873
- /** Get the machine's name. Set via the FSL `machine_name` directive.
1816
+ /**
1817
+ * Get the machine's name. Set via the FSL `machine_name` directive.
1874
1818
  * @returns The machine name string.
1875
1819
  */
1876
1820
  machine_name(): string;
1877
- /** The editor/panel defaults declared in the FSL `editor: {}` block, or
1821
+ /**
1822
+ * The editor/panel defaults declared in the FSL `editor: {}` block, or
1878
1823
  * `undefined` when none was given. Read by the all-widgets web control
1879
1824
  * (fsl#1334) — `panels` drives `request` panel mode.
1880
- *
1881
1825
  * @returns `{ stochastic_run_count?, panels? }`, or `undefined`.
1882
- *
1883
1826
  * @example
1884
1827
  * const m = sm`editor: { panels: [history]; }; a -> b;`;
1885
1828
  * m.editor_config(); // => { panels: ['history'] }
1886
1829
  */
1887
1830
  editor_config(): JssmEditorConfig | undefined;
1888
- /** Get the npm package name associated with the machine. Set via the FSL `npm_name` directive.
1831
+ /**
1832
+ * Get the npm package name associated with the machine. Set via the FSL `npm_name` directive.
1889
1833
  * Returns `undefined` when not present.
1890
1834
  * @returns The npm package name string, or `undefined`.
1891
1835
  * @see machine_name
1892
1836
  */
1893
1837
  npm_name(): string;
1894
- /** Get the render-size hint for the machine's visualization. Set via the
1838
+ /**
1839
+ * Get the render-size hint for the machine's visualization. Set via the
1895
1840
  * FSL `default_size` directive. Returns `undefined` when not present.
1896
1841
  *
1897
1842
  * The three FSL forms each produce a different subset of fields:
@@ -1901,33 +1846,38 @@ declare class Machine<mDT> {
1901
1846
  * - `default_size: height 600;` → `{ height: 600 }`
1902
1847
  *
1903
1848
  * This is a hint, not a hard constraint. Renderers may ignore it.
1904
- *
1905
1849
  * @returns The size-hint object, or `undefined` if not set.
1906
1850
  * @see npm_name
1907
1851
  */
1908
1852
  default_size(): JssmDefaultSize | undefined;
1909
- /** Get the machine's version string. Set via the FSL `machine_version` directive.
1853
+ /**
1854
+ * Get the machine's version string. Set via the FSL `machine_version` directive.
1910
1855
  * @returns The version string.
1911
1856
  */
1912
1857
  machine_version(): string;
1913
- /** Get the raw state declaration objects as parsed from the FSL source.
1858
+ /**
1859
+ * Get the raw state declaration objects as parsed from the FSL source.
1914
1860
  * @returns An array of raw state declaration objects.
1915
1861
  */
1916
- raw_state_declarations(): Array<Object>;
1917
- /** Get the processed state declaration for a specific state.
1862
+ raw_state_declarations(): Array<object>;
1863
+ /**
1864
+ * Get the processed state declaration for a specific state.
1918
1865
  * @param which - The state to look up.
1919
1866
  * @returns The {@link JssmStateDeclaration} for the given state.
1920
1867
  */
1921
1868
  state_declaration(which: StateType): JssmStateDeclaration;
1922
- /** Get all processed state declarations as a Map.
1869
+ /**
1870
+ * Get all processed state declarations as a Map.
1923
1871
  * @returns A `Map` from state name to {@link JssmStateDeclaration}.
1924
1872
  */
1925
1873
  state_declarations(): Map<StateType, JssmStateDeclaration>;
1926
- /** Get the FSL language version this machine was compiled under.
1874
+ /**
1875
+ * Get the FSL language version this machine was compiled under.
1927
1876
  * @returns The FSL version string.
1928
1877
  */
1929
1878
  fsl_version(): string;
1930
- /** Get the complete internal state of the machine as a serializable
1879
+ /**
1880
+ * Get the complete internal state of the machine as a serializable
1931
1881
  * structure. Includes actions, edges, edge map, named transitions,
1932
1882
  * reverse actions, current state, and states map.
1933
1883
  * @returns A {@link JssmMachineInternalState} snapshot.
@@ -1951,7 +1901,8 @@ declare class Machine<mDT> {
1951
1901
  *
1952
1902
  */
1953
1903
  states(): Array<StateType>;
1954
- /** Get the internal state descriptor for a given state name.
1904
+ /**
1905
+ * Get the internal state descriptor for a given state name.
1955
1906
  * @param whichState - The state to look up.
1956
1907
  * @returns The {@link JssmGenericState} descriptor.
1957
1908
  * @throws {JssmError} If the state does not exist.
@@ -2014,19 +1965,23 @@ declare class Machine<mDT> {
2014
1965
  *
2015
1966
  */
2016
1967
  list_edges(): Array<JssmTransition<StateType, mDT>>;
2017
- /** Get the map of named transitions (transitions with explicit names).
1968
+ /**
1969
+ * Get the map of named transitions (transitions with explicit names).
2018
1970
  * @returns A `Map` from transition name to edge index.
2019
1971
  */
2020
1972
  list_named_transitions(): Map<StateType, number>;
2021
- /** List all distinct action names defined anywhere in the machine.
1973
+ /**
1974
+ * List all distinct action names defined anywhere in the machine.
2022
1975
  * @returns An array of action name strings.
2023
1976
  */
2024
1977
  list_actions(): Array<StateType>;
2025
- /** Whether any actions are defined on this machine.
1978
+ /**
1979
+ * Whether any actions are defined on this machine.
2026
1980
  * @returns `true` if the machine has at least one action.
2027
1981
  */
2028
1982
  get uses_actions(): boolean;
2029
- /** Whether any forced (`~>`) transitions exist in this machine.
1983
+ /**
1984
+ * Whether any forced (`~>`) transitions exist in this machine.
2030
1985
  * @returns `true` if at least one forced transition is defined.
2031
1986
  */
2032
1987
  get uses_forced_transitions(): boolean;
@@ -2067,16 +2022,16 @@ declare class Machine<mDT> {
2067
2022
  *
2068
2023
  */
2069
2024
  get allow_islands(): JssmAllowIslands;
2070
- /** List all available theme names.
2025
+ /**
2026
+ * List all available theme names.
2071
2027
  * @returns An array of theme name strings.
2072
2028
  */
2073
2029
  all_themes(): FslTheme[];
2074
- /** List the character ranges accepted by the FSL grammar in any but the
2030
+ /**
2031
+ * List the character ranges accepted by the FSL grammar in any but the
2075
2032
  * first position of a state name (atom). Each entry is an inclusive
2076
2033
  * `{from, to}` range of single Unicode characters.
2077
- *
2078
2034
  * @returns An array of `{from, to}` inclusive character ranges.
2079
- *
2080
2035
  * @example
2081
2036
  * import { sm } from 'jssm';
2082
2037
  * const m = sm`a -> b;`;
@@ -2086,12 +2041,11 @@ declare class Machine<mDT> {
2086
2041
  from: string;
2087
2042
  to: string;
2088
2043
  }>;
2089
- /** List the character ranges accepted by the FSL grammar in the first
2044
+ /**
2045
+ * List the character ranges accepted by the FSL grammar in the first
2090
2046
  * position of a state name (atom). Narrower than
2091
2047
  * {@link all_state_name_chars}: notably omits `+`, `(`, `)`, `&`, `#`, `@`.
2092
- *
2093
2048
  * @returns An array of `{from, to}` inclusive character ranges.
2094
- *
2095
2049
  * @example
2096
2050
  * import { sm } from 'jssm';
2097
2051
  * const m = sm`a -> b;`;
@@ -2101,12 +2055,11 @@ declare class Machine<mDT> {
2101
2055
  from: string;
2102
2056
  to: string;
2103
2057
  }>;
2104
- /** List the character ranges accepted inside a single-quoted FSL action
2058
+ /**
2059
+ * List the character ranges accepted inside a single-quoted FSL action
2105
2060
  * label without escaping. Space is allowed; the apostrophe `'` is
2106
2061
  * explicitly excluded since it terminates the label.
2107
- *
2108
2062
  * @returns An array of `{from, to}` inclusive character ranges.
2109
- *
2110
2063
  * @example
2111
2064
  * import { sm } from 'jssm';
2112
2065
  * const m = sm`a -> b;`;
@@ -2117,28 +2070,33 @@ declare class Machine<mDT> {
2117
2070
  from: string;
2118
2071
  to: string;
2119
2072
  }>;
2120
- /** Get the active theme(s) for this machine. Always stored as an array
2073
+ /**
2074
+ * Get the active theme(s) for this machine. Always stored as an array
2121
2075
  * internally; the union return type exists for setter compatibility.
2122
2076
  * @returns The current theme or array of themes.
2123
2077
  */
2124
2078
  get themes(): FslTheme | FslTheme[];
2125
- /** Set the active theme(s). Accepts a single theme name or an array.
2079
+ /**
2080
+ * Set the active theme(s). Accepts a single theme name or an array.
2126
2081
  * @param to - A theme name or array of theme names to apply.
2127
2082
  */
2128
2083
  set themes(to: FslTheme | FslTheme[]);
2129
- /** Get the flow direction for graph layout (e.g. `'right'`, `'down'`).
2084
+ /**
2085
+ * Get the flow direction for graph layout (e.g. `'right'`, `'down'`).
2130
2086
  * Set via the FSL `flow` directive.
2131
2087
  * @returns The current flow direction.
2132
2088
  */
2133
2089
  flow(): FslDirection;
2134
- /** Look up a transition's edge index by source and target state names.
2090
+ /**
2091
+ * Look up a transition's edge index by source and target state names.
2135
2092
  * @param from - Source state name.
2136
2093
  * @param to - Target state name.
2137
2094
  * @returns The edge index in the edges array, or `undefined` if no
2138
2095
  * such transition exists.
2139
2096
  */
2140
2097
  get_transition_by_state_names(from: StateType, to: StateType): number;
2141
- /** Look up the full transition object for a given source→target pair.
2098
+ /**
2099
+ * Look up the full transition object for a given source→target pair.
2142
2100
  * @param from - Source state name.
2143
2101
  * @param to - Target state name.
2144
2102
  * @returns The {@link JssmTransition} object, or `undefined` if none exists.
@@ -2210,7 +2168,8 @@ declare class Machine<mDT> {
2210
2168
  *
2211
2169
  */
2212
2170
  list_exits(whichState?: StateType): Array<StateType>;
2213
- /** Get the transitions available from a state for use by the probabilistic
2171
+ /**
2172
+ * Get the transitions available from a state for use by the probabilistic
2214
2173
  * walk system.
2215
2174
  *
2216
2175
  * If any exit declares a `probability`, only those probability-bearing
@@ -2223,37 +2182,39 @@ declare class Machine<mDT> {
2223
2182
  * Fixes StoneCypher/fsl#1325, in which the function previously returned
2224
2183
  * every exit unconditionally — including forced-only exits and exits
2225
2184
  * with no `probability`, which distorted the weighted distribution.
2226
- *
2227
2185
  * @param whichState - The state to inspect.
2228
2186
  * @returns An array of {@link JssmTransition} edges exiting the state,
2229
2187
  * filtered as described above. May be empty.
2230
2188
  * @throws {JssmError} If the state does not exist.
2231
2189
  */
2232
2190
  probable_exits_for(whichState: StateType): Array<JssmTransition<StateType, mDT>>;
2233
- /** Take a single random transition from the current state, weighted by
2191
+ /**
2192
+ * Take a single random transition from the current state, weighted by
2234
2193
  * edge probabilities.
2235
2194
  * @returns `true` if a transition was taken, `false` otherwise.
2236
2195
  */
2237
2196
  probabilistic_transition(): boolean;
2238
- /** Take `n` consecutive probabilistic transitions and return the sequence
2197
+ /**
2198
+ * Take `n` consecutive probabilistic transitions and return the sequence
2239
2199
  * of states visited (before each transition).
2240
2200
  * @param n - Number of steps to walk.
2241
2201
  * @returns An array of state names visited during the walk.
2242
2202
  */
2243
2203
  probabilistic_walk(n: number): Array<StateType>;
2244
- /** Take `n` probabilistic steps and return a histograph of how many times
2204
+ /**
2205
+ * Take `n` probabilistic steps and return a histograph of how many times
2245
2206
  * each state was visited.
2246
2207
  * @param n - Number of steps to walk.
2247
2208
  * @returns A `Map` from state name to visit count.
2248
2209
  */
2249
2210
  probabilistic_histo_walk(n: number): Map<StateType, number>;
2250
- /** One non-destructive weighted-random walk over the graph from `start`.
2211
+ /**
2212
+ * One non-destructive weighted-random walk over the graph from `start`.
2251
2213
  *
2252
2214
  * Reads the graph and advances the PRNG only — it never calls
2253
2215
  * {@link Machine.transition}, so it fires no hooks, mutates no machine
2254
2216
  * state, and touches no `data`. A state with no probabilistic exits
2255
2217
  * (a terminal, or a forced-only `~>` state) ends the walk.
2256
- *
2257
2218
  * @param start - State to begin the walk from.
2258
2219
  * @param max_steps - Maximum transitions before the walk is step-capped.
2259
2220
  * @param exit_memo - Per-run-set cache of {@link Machine.probable_exits_for}
@@ -2266,7 +2227,8 @@ declare class Machine<mDT> {
2266
2227
  * @returns The {@link JssmStochasticRun} for this walk.
2267
2228
  */
2268
2229
  private _stochastic_one_walk;
2269
- /** Lazily yield one {@link JssmStochasticRun} at a time.
2230
+ /**
2231
+ * Lazily yield one {@link JssmStochasticRun} at a time.
2270
2232
  *
2271
2233
  * In `montecarlo` mode (default) yields `runs` independent walks from the
2272
2234
  * current state, each ending at a terminal or after `max_steps`. In
@@ -2277,16 +2239,16 @@ declare class Machine<mDT> {
2277
2239
  * Passing `seed` reseeds the machine for reproducible runs. Unlike
2278
2240
  * {@link Machine.stochastic_summary}, the generator does NOT restore the
2279
2241
  * prior seed afterward — a direct caller's machine is left reseeded.
2280
- *
2281
2242
  * @param opts - {@link JssmStochasticOptions}.
2243
+ * @yields One {@link JssmStochasticRun} per completed walk.
2282
2244
  * @returns A generator of per-run results.
2283
- *
2284
2245
  * @example
2285
2246
  * const m = sm`a 'go' -> b 'go' -> c;`;
2286
2247
  * [...m.stochastic_runs({ runs: 2, seed: 1 })].length; // => 2
2287
2248
  */
2288
2249
  stochastic_runs(opts?: JssmStochasticOptions): Generator<JssmStochasticRun>;
2289
- /** Run many weighted-random walks and return aggregate statistics.
2250
+ /**
2251
+ * Run many weighted-random walks and return aggregate statistics.
2290
2252
  *
2291
2253
  * Honors `%` transition probabilities (via the existing probabilistic
2292
2254
  * machinery). Non-destructive: the machine's current state and
@@ -2297,16 +2259,13 @@ declare class Machine<mDT> {
2297
2259
  *
2298
2260
  * Timing (`after`) decorations and data-guard conditions are not modeled
2299
2261
  * by this sampler; it walks the probabilistic graph topology.
2300
- *
2301
2262
  * @param opts - {@link JssmStochasticOptions}. `runs` defaults to the
2302
2263
  * machine's declared `editor: { stochastic_run_count }` (fsl#1334) when
2303
2264
  * present, otherwise {@link STOCHASTIC_DEFAULT_RUNS}.
2304
2265
  * @returns A {@link JssmStochasticSummary}.
2305
- *
2306
2266
  * @see Machine.stochastic_runs
2307
2267
  * @see Machine.probabilistic_walk
2308
2268
  * @see Machine.editor_config
2309
- *
2310
2269
  * @example
2311
2270
  * const m = sm`a 'go' -> b 'go' -> c;`;
2312
2271
  * const s = m.stochastic_summary({ runs: 100, seed: 1 });
@@ -2374,17 +2333,16 @@ declare class Machine<mDT> {
2374
2333
  *
2375
2334
  */
2376
2335
  list_states_having_action(whichState: StateType): Array<StateType>;
2377
- /** List all action names available as exits from a given state.
2336
+ /**
2337
+ * List all action names available as exits from a given state.
2378
2338
  *
2379
2339
  * Returns the empty array (does not throw) when `whichState` exists but has
2380
2340
  * no action-named exits — including terminal states, states whose only
2381
2341
  * exits are plain `->` transitions, and states in machines that use no
2382
2342
  * actions at all. Only nonexistent states cause a throw.
2383
- *
2384
2343
  * @param whichState - The state to inspect. Defaults to the current state.
2385
2344
  * @returns An array of action name strings, possibly empty.
2386
2345
  * @throws {JssmError} If the state does not exist.
2387
- *
2388
2346
  * @example
2389
2347
  * const m = sm`a 'go' -> b; b -> c;`;
2390
2348
  * m.list_exit_actions('a'); // => ['go']
@@ -2393,33 +2351,39 @@ declare class Machine<mDT> {
2393
2351
  * expect(() => m.list_exit_actions('z')).toThrow();
2394
2352
  */
2395
2353
  list_exit_actions(whichState?: StateType): Array<StateType>;
2396
- /** List all action exits from a state with their probabilities.
2354
+ /**
2355
+ * List all action exits from a state with their probabilities.
2397
2356
  * @param whichState - The state to inspect. Defaults to the current state.
2398
2357
  * @returns An array of `{ action, probability }` objects.
2399
2358
  * @throws {JssmError} If the state does not exist.
2400
2359
  */
2401
2360
  probable_action_exits(whichState?: StateType): Array<any>;
2402
- /** Check whether a state has no incoming transitions (unreachable after start).
2361
+ /**
2362
+ * Check whether a state has no incoming transitions (unreachable after start).
2403
2363
  * @param whichState - The state to check.
2404
2364
  * @returns `true` if the state has zero entrances.
2405
2365
  * @throws {JssmError} If the state does not exist.
2406
2366
  */
2407
2367
  is_unenterable(whichState: StateType): boolean;
2408
- /** Check whether any state in the machine is unenterable.
2368
+ /**
2369
+ * Check whether any state in the machine is unenterable.
2409
2370
  * @returns `true` if at least one state has no incoming transitions.
2410
2371
  */
2411
2372
  has_unenterables(): boolean;
2412
- /** Check whether the current state is terminal (has no exits).
2373
+ /**
2374
+ * Check whether the current state is terminal (has no exits).
2413
2375
  * @returns `true` if the current state has zero exits.
2414
2376
  */
2415
2377
  is_terminal(): boolean;
2416
- /** Check whether a specific state is terminal (has no exits).
2378
+ /**
2379
+ * Check whether a specific state is terminal (has no exits).
2417
2380
  * @param whichState - The state to check.
2418
2381
  * @returns `true` if the state has zero exits.
2419
2382
  * @throws {JssmError} If the state does not exist.
2420
2383
  */
2421
2384
  state_is_terminal(whichState: StateType): boolean;
2422
- /** Check whether any state in the machine is terminal.
2385
+ /**
2386
+ * Check whether any state in the machine is terminal.
2423
2387
  * @returns `true` if at least one state has no exits.
2424
2388
  */
2425
2389
  has_terminals(): boolean;
@@ -2531,17 +2495,20 @@ declare class Machine<mDT> {
2531
2495
  *
2532
2496
  */
2533
2497
  statesIn(groupName: string): Array<StateType>;
2534
- /** Check whether the current state is complete (every exit has an action).
2498
+ /**
2499
+ * Check whether the current state is complete (every exit has an action).
2535
2500
  * @returns `true` if the current state is complete.
2536
2501
  */
2537
2502
  is_complete(): boolean;
2538
- /** Check whether a specific state is complete (every exit has an action).
2503
+ /**
2504
+ * Check whether a specific state is complete (every exit has an action).
2539
2505
  * @param whichState - The state to check.
2540
2506
  * @returns `true` if the state is complete.
2541
2507
  * @throws {JssmError} If the state does not exist.
2542
2508
  */
2543
2509
  state_is_complete(whichState: StateType): boolean;
2544
- /** Check whether any state in the machine is complete.
2510
+ /**
2511
+ * Check whether any state in the machine is complete.
2545
2512
  * @returns `true` if at least one state is complete.
2546
2513
  */
2547
2514
  has_completes(): boolean;
@@ -2565,14 +2532,12 @@ declare class Machine<mDT> {
2565
2532
  * const off = m.on('transition', () => {});
2566
2533
  * off(); // unsubscribe
2567
2534
  * ```
2568
- *
2569
- * @typeParam Ev The event name (drives the detail type).
2535
+ * @template Ev The event name (drives the detail type).
2570
2536
  * @param name The event name to subscribe to.
2571
2537
  * @param handler The handler invoked on each matching delivery. The
2572
2538
  * three-argument `(name, filter, handler)` form inserts a
2573
2539
  * filter object before the handler (see the example above).
2574
2540
  * @returns A function that unsubscribes when called.
2575
- *
2576
2541
  * @see Machine.off
2577
2542
  * @see Machine.once
2578
2543
  */
@@ -2586,15 +2551,13 @@ declare class Machine<mDT> {
2586
2551
  * ```typescript
2587
2552
  * m.once('terminal', e => console.log(`done at ${e.state}`));
2588
2553
  * ```
2589
- *
2590
- * @typeParam Ev The event name.
2554
+ * @template Ev The event name.
2591
2555
  * @param name The event name.
2592
2556
  * @param handler The handler invoked on the first matching delivery. The
2593
2557
  * three-argument `(name, filter, handler)` form inserts a
2594
2558
  * filter object before the handler (same shapes as `on`).
2595
2559
  * @returns A function that unsubscribes early if called before the
2596
2560
  * handler has fired.
2597
- *
2598
2561
  * @see Machine.on
2599
2562
  * @see Machine.off
2600
2563
  */
@@ -2612,112 +2575,11 @@ declare class Machine<mDT> {
2612
2575
  * m.off('transition', fn); // true
2613
2576
  * m.off('transition', fn); // false
2614
2577
  * ```
2615
- *
2616
2578
  * @param name The event name.
2617
2579
  * @param handler The handler reference to remove.
2618
2580
  * @returns `true` if removed, `false` if no match was registered.
2619
2581
  */
2620
2582
  off<Ev extends JssmEventName>(name: Ev, handler: JssmEventHandler<mDT, Ev>): boolean;
2621
- /**
2622
- * Remove one event-subscription entry from its set and keep
2623
- * {@link Machine._event_listener_count} in sync. The count is decremented
2624
- * only when the entry was actually present, so calling a stale unsubscribe
2625
- * closure (or removing an already-fired `once` entry) is idempotent and
2626
- * cannot drive the count negative.
2627
- *
2628
- * @param set The per-event-name subscription set.
2629
- * @param entry The entry to remove.
2630
- * @internal
2631
- */
2632
- _unsubscribe_entry(set: Set<JssmEventEntry<any, any>>, entry: JssmEventEntry<any, any>): void;
2633
- /**
2634
- * Shared registration core used by {@link Machine.on} and
2635
- * {@link Machine.once}. Normalizes the optional filter argument and
2636
- * installs the entry into the per-event subscription set.
2637
- *
2638
- * @internal
2639
- */
2640
- _subscribe<Ev extends JssmEventName>(name: Ev, filterOrFn: JssmEventFilter<mDT, Ev> | JssmEventHandler<mDT, Ev>, maybeFn: JssmEventHandler<mDT, Ev> | undefined, once: boolean): JssmUnsubscribe;
2641
- /**
2642
- * Invoke a single event-handler entry, respecting its filter, once-removal
2643
- * semantics, and the error re-fire / recursion-guard logic. Extracted so
2644
- * {@link _fire} can share identical behavior between the size-1 fast-path
2645
- * and the general snapshotted loop.
2646
- *
2647
- * @param entry - The subscriber descriptor to invoke.
2648
- * @param set - The live Set that owns `entry`; needed for once-removal.
2649
- * @param name - The event name being dispatched (used in error re-fires).
2650
- * @param detail - The event payload forwarded to the handler.
2651
- *
2652
- * @internal
2653
- */
2654
- _fire_one<Ev extends JssmEventName>(entry: JssmEventEntry<mDT, Ev>, set: Set<JssmEventEntry<any, any>>, name: Ev, detail: JssmEventDetailMap<mDT>[Ev]): void;
2655
- /**
2656
- * Dispatch an event to every registered subscriber in registration
2657
- * order. Filters are checked first; non-matching handlers are skipped
2658
- * without invoking the handler. Exceptions thrown by a handler are
2659
- * caught and re-emitted as an `error` event so subsequent handlers
2660
- * still run.
2661
- *
2662
- * Re-entry into the `error` event itself is guarded — if an `error`
2663
- * handler throws, the new exception is swallowed rather than rebroadcast
2664
- * to avoid an infinite loop.
2665
- *
2666
- * When exactly one subscriber is registered the common case avoids the
2667
- * `Array.from(set)` snapshot allocation by capturing the lone entry into a
2668
- * local first — equivalent to a 1-element snapshot but allocation-free.
2669
- * The general path still snapshots for re-entrancy safety.
2670
- *
2671
- * @internal
2672
- */
2673
- /**
2674
- * Whether at least one live subscriber is registered for `name`. Used by
2675
- * the transition-commit observation block to skip building a detail
2676
- * literal that {@link Machine._fire} would immediately discard — a panel
2677
- * listening only to `'transition'` (fsl-bind, fsl-viz, fsl-info-panel)
2678
- * previously paid for the exit/entry/data-change detail allocations on
2679
- * every transition. Read at fire time, so a listener installed by a
2680
- * pre-hook is still seen (#671).
2681
- *
2682
- * @param name The event name to probe.
2683
- * @returns `true` when a subsequent `_fire(name, ...)` would reach at
2684
- * least one handler.
2685
- *
2686
- * ```typescript
2687
- * machine.on('transition', () => {});
2688
- * machine._has_subscribers('transition'); // true
2689
- * machine._has_subscribers('exit'); // false
2690
- * ```
2691
- *
2692
- * @see Machine._fire
2693
- * @internal
2694
- */
2695
- _has_subscribers(name: JssmEventName): boolean;
2696
- _fire<Ev extends JssmEventName>(name: Ev, detail: JssmEventDetailMap<mDT>[Ev]): void;
2697
- /** Low-level hook registration. Installs a handler described by a
2698
- * {@link HookDescription} into the appropriate internal map. Prefer the
2699
- * convenience wrappers ({@link hook}, {@link hook_entry}, etc.) over
2700
- * calling this directly.
2701
- * @param HookDesc - A hook descriptor specifying kind, states, and handler.
2702
- */
2703
- /**
2704
- * Validate a {@link HookDescription} before registration. Every hook needs
2705
- * a `handler` function, and each kind's identifying spatial fields
2706
- * (`from`/`to`/`action`) must be exactly those `set_hook` reads for that
2707
- * kind — present when required, absent otherwise. This turns a mis-shaped
2708
- * descriptor into a thrown error instead of a silently dead hook keyed on
2709
- * `undefined` (e.g. an `exit` hook handed `to` instead of `from`, #734).
2710
- *
2711
- * @param HookDesc - The descriptor about to be registered.
2712
- * @throws JssmError if the kind is unknown, the handler is not a function, a
2713
- * required field is missing, or an inapplicable field is present.
2714
- *
2715
- * @example
2716
- * const m = sm`a -> b;`;
2717
- * // an exit hook is keyed by `from`, so supplying `to` is rejected:
2718
- * expect(() => m.set_hook({ kind: 'exit', to: 'a', handler: () => true })).toThrow();
2719
- */
2720
- _validate_hook_description(HookDesc: HookDescription<mDT>): void;
2721
2583
  set_hook(HookDesc: HookDescription<mDT>): void;
2722
2584
  /**
2723
2585
  * Remove a previously-registered hook described by a
@@ -2736,12 +2598,12 @@ declare class Machine<mDT> {
2736
2598
  * m.set_hook({ kind: 'hook', from: 'a', to: 'b', handler: fn });
2737
2599
  * m.remove_hook({ kind: 'hook', from: 'a', to: 'b', handler: fn });
2738
2600
  * ```
2739
- *
2740
2601
  * @param HookDesc - A hook descriptor identifying the hook to remove.
2741
2602
  * @returns `true` if a hook was removed, `false` otherwise.
2742
2603
  */
2743
2604
  remove_hook(HookDesc: HookDescription<mDT>): boolean;
2744
- /** Register a pre-transition hook on a specific edge. Fires before
2605
+ /**
2606
+ * Register a pre-transition hook on a specific edge. Fires before
2745
2607
  * transitioning from `from` to `to`. If the handler returns `false`, the
2746
2608
  * transition is blocked.
2747
2609
  *
@@ -2749,14 +2611,14 @@ declare class Machine<mDT> {
2749
2611
  * const m = sm`a -> b -> c;`;
2750
2612
  * m.hook('a', 'b', () => console.log('a->b'));
2751
2613
  * ```
2752
- *
2753
2614
  * @param from - Source state name.
2754
2615
  * @param to - Target state name.
2755
2616
  * @param handler - Callback invoked before the transition.
2756
2617
  * @returns `this` for chaining.
2757
2618
  */
2758
2619
  hook(from: string, to: string, handler: HookHandler<mDT>): Machine<mDT>;
2759
- /** Register a pre-transition hook on a specific action-labeled edge.
2620
+ /**
2621
+ * Register a pre-transition hook on a specific action-labeled edge.
2760
2622
  * @param from - Source state name.
2761
2623
  * @param to - Target state name.
2762
2624
  * @param action - The action label that triggers this hook.
@@ -2764,50 +2626,59 @@ declare class Machine<mDT> {
2764
2626
  * @returns `this` for chaining.
2765
2627
  */
2766
2628
  hook_action(from: string, to: string, action: string, handler: HookHandler<mDT>): Machine<mDT>;
2767
- /** Register a pre-transition hook on any edge triggered by a specific action.
2629
+ /**
2630
+ * Register a pre-transition hook on any edge triggered by a specific action.
2768
2631
  * @param action - The action name to hook.
2769
2632
  * @param handler - Callback invoked before any transition with this action.
2770
2633
  * @returns `this` for chaining.
2771
2634
  */
2772
2635
  hook_global_action(action: string, handler: HookHandler<mDT>): Machine<mDT>;
2773
- /** Register a pre-transition hook on any action-driven transition.
2636
+ /**
2637
+ * Register a pre-transition hook on any action-driven transition.
2774
2638
  * @param handler - Callback invoked before any action transition.
2775
2639
  * @returns `this` for chaining.
2776
2640
  */
2777
2641
  hook_any_action(handler: HookHandler<mDT>): Machine<mDT>;
2778
- /** Register a pre-transition hook on any standard (`->`) transition.
2642
+ /**
2643
+ * Register a pre-transition hook on any standard (`->`) transition.
2779
2644
  * @param handler - Callback invoked before any legal transition.
2780
2645
  * @returns `this` for chaining.
2781
2646
  */
2782
2647
  hook_standard_transition(handler: HookHandler<mDT>): Machine<mDT>;
2783
- /** Register a pre-transition hook on any main-path (`=>`) transition.
2648
+ /**
2649
+ * Register a pre-transition hook on any main-path (`=>`) transition.
2784
2650
  * @param handler - Callback invoked before any main transition.
2785
2651
  * @returns `this` for chaining.
2786
2652
  */
2787
2653
  hook_main_transition(handler: HookHandler<mDT>): Machine<mDT>;
2788
- /** Register a pre-transition hook on any forced (`~>`) transition.
2654
+ /**
2655
+ * Register a pre-transition hook on any forced (`~>`) transition.
2789
2656
  * @param handler - Callback invoked before any forced transition.
2790
2657
  * @returns `this` for chaining.
2791
2658
  */
2792
2659
  hook_forced_transition(handler: HookHandler<mDT>): Machine<mDT>;
2793
- /** Register a pre-transition hook on any transition regardless of kind.
2660
+ /**
2661
+ * Register a pre-transition hook on any transition regardless of kind.
2794
2662
  * @param handler - Callback invoked before every transition.
2795
2663
  * @returns `this` for chaining.
2796
2664
  */
2797
2665
  hook_any_transition(handler: HookHandler<mDT>): Machine<mDT>;
2798
- /** Register a hook that fires when entering a specific state.
2666
+ /**
2667
+ * Register a hook that fires when entering a specific state.
2799
2668
  * @param to - The state being entered.
2800
2669
  * @param handler - Callback invoked on entry.
2801
2670
  * @returns `this` for chaining.
2802
2671
  */
2803
2672
  hook_entry(to: string, handler: HookHandler<mDT>): Machine<mDT>;
2804
- /** Register a hook that fires when leaving a specific state.
2673
+ /**
2674
+ * Register a hook that fires when leaving a specific state.
2805
2675
  * @param from - The state being exited.
2806
2676
  * @param handler - Callback invoked on exit.
2807
2677
  * @returns `this` for chaining.
2808
2678
  */
2809
2679
  hook_exit(from: string, handler: HookHandler<mDT>): Machine<mDT>;
2810
- /** Register a hook that fires when a state's `after` timer elapses — the
2680
+ /**
2681
+ * Register a hook that fires when a state's `after` timer elapses — the
2811
2682
  * delay-over companion to `a after 5s -> b;` style time transitions. It
2812
2683
  * does NOT fire when the state is entered or left by ordinary dispatch;
2813
2684
  * use {@link hook_entry} / {@link hook_exit} for those. (Versions through
@@ -2818,7 +2689,6 @@ declare class Machine<mDT> {
2818
2689
  * timed transition is taken; informational — its outcome
2819
2690
  * cannot reject the transition.
2820
2691
  * @returns `this` for chaining.
2821
- *
2822
2692
  * @example
2823
2693
  * const m = sm`a after 1000 -> b; a -> c; c -> a;`;
2824
2694
  * let calls = 0;
@@ -2828,13 +2698,13 @@ declare class Machine<mDT> {
2828
2698
  * // ordinary dispatch never fires it; only the timer elapsing does:
2829
2699
  * calls; // => 0
2830
2700
  * m.clear_state_timeout();
2831
- *
2832
2701
  * @see hook_entry
2833
2702
  * @see hook_exit
2834
2703
  * @see set_state_timeout
2835
2704
  */
2836
2705
  hook_after(from: string, handler: HookHandler<mDT>): Machine<mDT>;
2837
- /** Register a hook that fires when ANY state's `after` timer elapses — the
2706
+ /**
2707
+ * Register a hook that fires when ANY state's `after` timer elapses — the
2838
2708
  * whole-machine companion to {@link hook_after}, mirroring how
2839
2709
  * {@link hook_any_transition} companions {@link hook}. When the elapsing
2840
2710
  * state also has a specific {@link hook_after}, the specific hook fires
@@ -2845,7 +2715,6 @@ declare class Machine<mDT> {
2845
2715
  * @param handler - Callback invoked whenever any `after` timer fires, just
2846
2716
  * before the timed transition is taken.
2847
2717
  * @returns `this` for chaining.
2848
- *
2849
2718
  * @example
2850
2719
  * const m = sm`a after 1000 -> b; a -> c; c -> a;`;
2851
2720
  * let calls = 0;
@@ -2855,13 +2724,13 @@ declare class Machine<mDT> {
2855
2724
  * // ordinary dispatch never fires it; only a timer elapsing does:
2856
2725
  * calls; // => 0
2857
2726
  * m.clear_state_timeout();
2858
- *
2859
2727
  * @see hook_after
2860
2728
  * @see hook_any_transition
2861
2729
  * @see set_state_timeout
2862
2730
  */
2863
2731
  hook_after_any(handler: HookHandler<mDT>): Machine<mDT>;
2864
- /** Post-transition hook on a specific edge. Fires after the transition
2732
+ /**
2733
+ * Post-transition hook on a specific edge. Fires after the transition
2865
2734
  * from `from` to `to` has completed. Cannot block the transition.
2866
2735
  * @param from - Source state name.
2867
2736
  * @param to - Target state name.
@@ -2869,7 +2738,8 @@ declare class Machine<mDT> {
2869
2738
  * @returns `this` for chaining.
2870
2739
  */
2871
2740
  post_hook(from: string, to: string, handler: HookHandler<mDT>): Machine<mDT>;
2872
- /** Post-transition hook on a specific action-labeled edge.
2741
+ /**
2742
+ * Post-transition hook on a specific action-labeled edge.
2873
2743
  * @param from - Source state name.
2874
2744
  * @param to - Target state name.
2875
2745
  * @param action - The action label.
@@ -2877,50 +2747,59 @@ declare class Machine<mDT> {
2877
2747
  * @returns `this` for chaining.
2878
2748
  */
2879
2749
  post_hook_action(from: string, to: string, action: string, handler: HookHandler<mDT>): Machine<mDT>;
2880
- /** Post-transition hook on any edge triggered by a specific action.
2750
+ /**
2751
+ * Post-transition hook on any edge triggered by a specific action.
2881
2752
  * @param action - The action name.
2882
2753
  * @param handler - Callback invoked after any transition with this action.
2883
2754
  * @returns `this` for chaining.
2884
2755
  */
2885
2756
  post_hook_global_action(action: string, handler: HookHandler<mDT>): Machine<mDT>;
2886
- /** Post-transition hook on any action-driven transition.
2757
+ /**
2758
+ * Post-transition hook on any action-driven transition.
2887
2759
  * @param handler - Callback invoked after any action transition.
2888
2760
  * @returns `this` for chaining.
2889
2761
  */
2890
2762
  post_hook_any_action(handler: HookHandler<mDT>): Machine<mDT>;
2891
- /** Post-transition hook on any standard (`->`) transition.
2763
+ /**
2764
+ * Post-transition hook on any standard (`->`) transition.
2892
2765
  * @param handler - Callback invoked after any legal transition.
2893
2766
  * @returns `this` for chaining.
2894
2767
  */
2895
2768
  post_hook_standard_transition(handler: HookHandler<mDT>): Machine<mDT>;
2896
- /** Post-transition hook on any main-path (`=>`) transition.
2769
+ /**
2770
+ * Post-transition hook on any main-path (`=>`) transition.
2897
2771
  * @param handler - Callback invoked after any main transition.
2898
2772
  * @returns `this` for chaining.
2899
2773
  */
2900
2774
  post_hook_main_transition(handler: HookHandler<mDT>): Machine<mDT>;
2901
- /** Post-transition hook on any forced (`~>`) transition.
2775
+ /**
2776
+ * Post-transition hook on any forced (`~>`) transition.
2902
2777
  * @param handler - Callback invoked after any forced transition.
2903
2778
  * @returns `this` for chaining.
2904
2779
  */
2905
2780
  post_hook_forced_transition(handler: HookHandler<mDT>): Machine<mDT>;
2906
- /** Post-transition hook on any transition regardless of kind.
2781
+ /**
2782
+ * Post-transition hook on any transition regardless of kind.
2907
2783
  * @param handler - Callback invoked after every transition.
2908
2784
  * @returns `this` for chaining.
2909
2785
  */
2910
2786
  post_hook_any_transition(handler: HookHandler<mDT>): Machine<mDT>;
2911
- /** Post-transition hook that fires after entering a specific state.
2787
+ /**
2788
+ * Post-transition hook that fires after entering a specific state.
2912
2789
  * @param to - The state that was entered.
2913
2790
  * @param handler - Callback invoked after entry.
2914
2791
  * @returns `this` for chaining.
2915
2792
  */
2916
2793
  post_hook_entry(to: string, handler: HookHandler<mDT>): Machine<mDT>;
2917
- /** Post-transition hook that fires after leaving a specific state.
2794
+ /**
2795
+ * Post-transition hook that fires after leaving a specific state.
2918
2796
  * @param from - The state that was exited.
2919
2797
  * @param handler - Callback invoked after exit.
2920
2798
  * @returns `this` for chaining.
2921
2799
  */
2922
2800
  post_hook_exit(from: string, handler: HookHandler<mDT>): Machine<mDT>;
2923
- /** Register a pre-transition hook that fires **before** all other pre-hooks
2801
+ /**
2802
+ * Register a pre-transition hook that fires **before** all other pre-hooks
2924
2803
  * on every transition. If the handler returns `false`, the transition is
2925
2804
  * blocked. The handler receives an {@link EverythingHookContext} whose
2926
2805
  * `hook_name` is `'pre everything'`.
@@ -2932,12 +2811,12 @@ declare class Machine<mDT> {
2932
2811
  * return true;
2933
2812
  * });
2934
2813
  * ```
2935
- *
2936
2814
  * @param handler - Callback invoked before all other pre-hooks.
2937
2815
  * @returns `this` for chaining.
2938
2816
  */
2939
2817
  hook_pre_everything(handler: EverythingHookHandler<mDT>): Machine<mDT>;
2940
- /** Register a pre-transition hook that fires **after** all other pre-hooks
2818
+ /**
2819
+ * Register a pre-transition hook that fires **after** all other pre-hooks
2941
2820
  * on every transition. If the handler returns `false`, the transition is
2942
2821
  * blocked. The handler receives an {@link EverythingHookContext} whose
2943
2822
  * `hook_name` is `'everything'`.
@@ -2949,12 +2828,12 @@ declare class Machine<mDT> {
2949
2828
  * return true;
2950
2829
  * });
2951
2830
  * ```
2952
- *
2953
2831
  * @param handler - Callback invoked after all other pre-hooks.
2954
2832
  * @returns `this` for chaining.
2955
2833
  */
2956
2834
  hook_everything(handler: EverythingHookHandler<mDT>): Machine<mDT>;
2957
- /** Register a post-transition hook that fires **after** all other
2835
+ /**
2836
+ * Register a post-transition hook that fires **after** all other
2958
2837
  * post-hooks on every transition. Cannot block the transition. The
2959
2838
  * handler receives an {@link EverythingHookContext} whose `hook_name` is
2960
2839
  * `'post everything'`.
@@ -2965,12 +2844,12 @@ declare class Machine<mDT> {
2965
2844
  * console.log(`${hook_name} fired`);
2966
2845
  * });
2967
2846
  * ```
2968
- *
2969
2847
  * @param handler - Callback invoked after all other post-hooks.
2970
2848
  * @returns `this` for chaining.
2971
2849
  */
2972
2850
  hook_post_everything(handler: PostEverythingHookHandler<mDT>): Machine<mDT>;
2973
- /** Register a post-transition hook that fires **before** all other
2851
+ /**
2852
+ * Register a post-transition hook that fires **before** all other
2974
2853
  * post-hooks on every transition. Cannot block the transition. The
2975
2854
  * handler receives an {@link EverythingHookContext} whose `hook_name` is
2976
2855
  * `'pre post everything'`.
@@ -2981,22 +2860,24 @@ declare class Machine<mDT> {
2981
2860
  * console.log(`${hook_name} fired`);
2982
2861
  * });
2983
2862
  * ```
2984
- *
2985
2863
  * @param handler - Callback invoked before all other post-hooks.
2986
2864
  * @returns `this` for chaining.
2987
2865
  */
2988
2866
  hook_pre_post_everything(handler: PostEverythingHookHandler<mDT>): Machine<mDT>;
2989
- /** Get the current RNG seed used for probabilistic transitions.
2867
+ /**
2868
+ * Get the current RNG seed used for probabilistic transitions.
2990
2869
  * @returns The numeric seed value.
2991
2870
  */
2992
2871
  get rng_seed(): number;
2993
- /** Set the RNG seed. Pass `undefined` to reseed from the current time.
2872
+ /**
2873
+ * Set the RNG seed. Pass `undefined` to reseed from the current time.
2994
2874
  * Resets the internal PRNG so subsequent probabilistic operations use the
2995
2875
  * new seed.
2996
2876
  * @param to - The seed value, or `undefined` for time-based seeding.
2997
2877
  */
2998
2878
  set rng_seed(to: number | undefined);
2999
- /** Get all edges between two states (there can be multiple with
2879
+ /**
2880
+ * Get all edges between two states (there can be multiple with
3000
2881
  * different actions).
3001
2882
  * @param from - Source state name.
3002
2883
  * @param to - Target state name.
@@ -3038,82 +2919,7 @@ declare class Machine<mDT> {
3038
2919
  * @see set_data
3039
2920
  *
3040
2921
  */
3041
- override(newState: StateType, newData?: mDT | undefined): void;
3042
- /*********
3043
- *
3044
- * Fire a `'rejection'` event caused by a hook vetoing a pending transition.
3045
- * Extracted from the per-call closures inside {@link transition_impl} so
3046
- * that it is allocated once at class-definition time rather than on every
3047
- * hooked transition.
3048
- *
3049
- * @param hook_name Name of the hook that rejected (e.g. `'exit'`).
3050
- * @param fromState State the machine was in when the transition was
3051
- * attempted; used as the `from` field of the rejection event.
3052
- * @param newState State that would have been entered had the hook
3053
- * passed; used as the `to` field of the rejection event.
3054
- * @param fromAction Action name when the transition was initiated by an
3055
- * action call; `undefined` for plain state transitions.
3056
- * @param oldData Machine data at the moment the transition was
3057
- * attempted, before any hook mutations.
3058
- * @param newData The `next_data` value passed to the transition call.
3059
- * @param wasForced Whether the transition was attempted via
3060
- * `force_transition`.
3061
- *
3062
- * @see transition_impl
3063
- * @see _fire
3064
- *
3065
- * @internal
3066
- *
3067
- */
3068
- _fire_hook_rejection(hook_name: string, fromState: StateType, newState: StateType, fromAction: StateType | undefined, oldData: mDT, newData: mDT | undefined, wasForced: boolean): void;
3069
- /*********
3070
- *
3071
- * Fire the FSL boundary-hook actions for a single, already-committed state
3072
- * change. In FSL, `do` is a synonym for `action`, so `on enter &g do 'X';`
3073
- * means "when the machine crosses INTO group `g`, dispatch machine action
3074
- * `X`" — and likewise `on exit` / plain-state subjects. This is the runtime
3075
- * that fires those parked hooks.
3076
- *
3077
- * Crossing semantics (statechart convention — exits before enters):
3078
- *
3079
- * 1. `prev_groups` / `next_groups` are the deep (transitive) group sets of
3080
- * the old and new states, from `_state_to_groups`.
3081
- * 2. **Exits** fire first: every group in `prev_groups \ next_groups` with an
3082
- * `onExit`, plus the plain `prev_state`'s `onExit` (when the state name
3083
- * actually changed).
3084
- * 3. **Enters** fire next: every group in `next_groups \ prev_groups` with an
3085
- * `onEnter`, plus the plain `next_state`'s `onEnter` (when the state name
3086
- * changed).
3087
- * 4. A group present in BOTH sets is a transition *within* that group and
3088
- * fires neither of its boundary hooks. `prev_state === next_state` fires
3089
- * nothing at all.
3090
- * 5. "Fire its action" is `this.action(label)`. If that action is not valid
3091
- * from the current state, `action` is a safe no-op (returns `false`) — an
3092
- * inapplicable boundary action never throws.
3093
- * 6. Multi-membership and nesting both fan out naturally: a state in groups
3094
- * A and B fires both; crossing an inner and an outer boundary fires both
3095
- * levels.
3096
- *
3097
- * Because firing an action can drive a further transition (which crosses
3098
- * more boundaries, which fires more actions), this is a bounded
3099
- * run-to-completion: `_boundary_depth` tracks the live cascade depth and a
3100
- * cascade deeper than `_boundary_depth_limit` throws a {@link JssmError}
3101
- * rather than overflowing the stack or hanging. The limit defaults to 100
3102
- * and is configurable via the `boundary_depth_limit` constructor option.
3103
- *
3104
- * @param prev_state The state the machine was in before this commit.
3105
- * @param next_state The state the machine is in now (already committed).
3106
- *
3107
- * @throws {JssmError} If cascaded boundary firing exceeds `_boundary_depth_limit`
3108
- * (a probable infinite loop).
3109
- *
3110
- * @see action
3111
- * @see transition_impl
3112
- *
3113
- * @internal
3114
- *
3115
- */
3116
- _fire_boundary_actions(prev_state: StateType, next_state: StateType): void;
2922
+ override(newState: StateType, newData?: mDT): void;
3117
2923
  /*********
3118
2924
  *
3119
2925
  * Shared transition core used by {@link transition}, {@link force_transition},
@@ -3165,7 +2971,8 @@ declare class Machine<mDT> {
3165
2971
  *
3166
2972
  */
3167
2973
  transition_impl(newStateOrAction: StateType, newData: mDT | undefined, wasForced: boolean, wasAction: boolean, dataProvided?: boolean): boolean;
3168
- /** If the current state has an `after` timeout configured, schedule it.
2974
+ /**
2975
+ * If the current state has an `after` timeout configured, schedule it.
3169
2976
  * Called internally after each transition.
3170
2977
  */
3171
2978
  auto_set_state_timeout(): void;
@@ -3576,94 +3383,6 @@ declare class Machine<mDT> {
3576
3383
  *
3577
3384
  */
3578
3385
  state_has_hooks(state: StateType): boolean;
3579
- /********
3580
- *
3581
- * Returns the list of resolved theme implementations for this machine, in
3582
- * the order they should layer (outer/base-most first). Each declared theme
3583
- * name is mapped through {@link theme_mapping}; unknown names are skipped.
3584
- *
3585
- * The list is reversed relative to declaration order to match the historical
3586
- * layering of {@link style_for}: a later-declared theme layers under an
3587
- * earlier-declared one.
3588
- *
3589
- * @returns The resolved {@link JssmBaseTheme} stack, base-most first.
3590
- *
3591
- * @internal
3592
- *
3593
- */
3594
- _resolved_themes(): JssmBaseTheme[];
3595
- /********
3596
- *
3597
- * Reads the condensed per-state style fields (`color`, `shape`, …) out of a
3598
- * state's declaration into a fresh {@link JssmStateConfig} — the tier-5
3599
- * "`state foo : { … }`" contribution of the config cascade. A state with no
3600
- * declaration yields an all-`undefined` config (which contributes nothing
3601
- * once folded with `merge_state_config`).
3602
- *
3603
- * @param state The state whose per-state declared style is wanted.
3604
- *
3605
- * @returns The per-state style config (fields may be `undefined`).
3606
- *
3607
- * @internal
3608
- *
3609
- */
3610
- _individual_state_config(state: StateType): JssmStateConfig;
3611
- /********
3612
- *
3613
- * Orders the groups a state belongs to by nesting depth for the config
3614
- * cascade — outermost first, innermost last — so that, folded in order,
3615
- * the innermost (nearest / smallest {@link membership_distance}) group's
3616
- * metadata wins. Equal-distance groups are ordered by group declaration
3617
- * order, so a later-declared group of the same depth wins the tie.
3618
- *
3619
- * Concretely: groups are sorted by descending membership distance (largest
3620
- * distance applied first / wins least), and for equal distances by
3621
- * ascending declaration index (later index applied last / wins most).
3622
- *
3623
- * @param state The state whose containing groups are being ordered.
3624
- *
3625
- * @returns The containing group names, ordered for outer→inner folding
3626
- * (the last entry wins).
3627
- *
3628
- * @internal
3629
- *
3630
- */
3631
- _groups_by_depth(state: StateType): string[];
3632
- /********
3633
- *
3634
- * Folds the static tiers 1–5 of the unified config cascade for a state, plus
3635
- * — when `active` is set — the active-state THEME layers, which historically
3636
- * sit just below the per-state config so that a `state foo : { … }` block
3637
- * still overrides a theme's `active` styling. The user `active_state : { … }`
3638
- * overlay (tier 6) is NOT applied here; it is layered on top by
3639
- * {@link resolve_state_config} so it wins over per-state config.
3640
- *
3641
- * Tiers, folded least-specific → most-specific with `merge_state_config`
3642
- * (later wins, never throwing on a cross-tier key collision):
3643
- *
3644
- * 1. theme defaults — `base_theme.state`, then each selected theme's
3645
- * `.state` block.
3646
- * 2. `default_state_config` (the implicit `state : { … }` root over every
3647
- * state).
3648
- * 3. static per-kind defaults selected by structural kind — terminal,
3649
- * then start, then end — each contributing its `base_theme.<kind>`,
3650
- * selected themes' `.<kind>`, and the machine's `default_<kind>_state_config`.
3651
- * When `active`, the active-state theme layers (`base_theme.active` and
3652
- * each selected theme's `.active`) are folded here too.
3653
- * 4. group metadata, depth-ordered outer→inner (see {@link _groups_by_depth}),
3654
- * each group's RAW `{ declarations }` already condensed at construction.
3655
- * 5. the per-state `state foo : { … }` config.
3656
- *
3657
- * @param state The state to resolve config for.
3658
- * @param active Whether to include the active-state theme layers (true only
3659
- * for the machine's currently-occupied state).
3660
- *
3661
- * @returns The composited tiers-1–5 {@link JssmStateConfig} for the state.
3662
- *
3663
- * @internal
3664
- *
3665
- */
3666
- _compose_state_config(state: StateType, active: boolean): JssmStateConfig;
3667
3386
  /********
3668
3387
  *
3669
3388
  * Resolves the full unified style/config cascade for a state — the runtime
@@ -3838,76 +3557,90 @@ declare class Machine<mDT> {
3838
3557
  *
3839
3558
  */
3840
3559
  force_transition(newState: StateType, newData?: mDT): boolean;
3841
- /** Get the edge index for an action from the current state.
3560
+ /**
3561
+ * Get the edge index for an action from the current state.
3842
3562
  * Interned dispatch: resolves via the numeric (action, from) index —
3843
3563
  * unknown action names miss without throwing.
3844
3564
  * @param action - The action name.
3845
3565
  * @returns The edge index, or `undefined` if the action is not available.
3846
3566
  */
3847
3567
  current_action_for(action: StateType): number;
3848
- /** Get the full transition object for an action from the current state.
3568
+ /**
3569
+ * Get the full transition object for an action from the current state.
3849
3570
  * @param action - The action name.
3850
3571
  * @returns The {@link JssmTransition} object.
3851
3572
  * @throws {JssmError} If the action is not available from the current state.
3852
3573
  */
3853
3574
  current_action_edge_for(action: StateType): JssmTransition<StateType, mDT>;
3854
- /** Check whether an action is available from the current state.
3575
+ /**
3576
+ * Check whether an action is available from the current state.
3855
3577
  * @param action - The action name to check.
3856
3578
  * @param _newData - Reserved for future data validation.
3857
3579
  * @returns `true` if the action can be taken.
3858
3580
  */
3859
3581
  valid_action(action: StateType, _newData?: mDT): boolean;
3860
- /** Check whether a transition to a given state is legal (non-forced) from
3582
+ /**
3583
+ * Check whether a transition to a given state is legal (non-forced) from
3861
3584
  * the current state.
3862
3585
  * @param newState - The target state.
3863
3586
  * @param _newData - Reserved for future data validation.
3864
3587
  * @returns `true` if the transition is legal.
3865
3588
  */
3866
3589
  valid_transition(newState: StateType, _newData?: mDT): boolean;
3867
- /** Check whether a forced transition to a given state exists from the
3590
+ /**
3591
+ * Check whether a forced transition to a given state exists from the
3868
3592
  * current state.
3869
3593
  * @param newState - The target state.
3870
3594
  * @param _newData - Reserved for future data validation.
3871
3595
  * @returns `true` if a forced (or any) transition exists.
3872
3596
  */
3873
3597
  valid_force_transition(newState: StateType, _newData?: mDT): boolean;
3874
- /** Get the instance name of this machine, if one was assigned at creation.
3598
+ /**
3599
+ * Get the instance name of this machine, if one was assigned at creation.
3875
3600
  * @returns The instance name string, or `undefined`.
3876
3601
  */
3877
3602
  instance_name(): string | undefined;
3878
- /** Get the creation date of this machine as a `Date` object.
3603
+ /**
3604
+ * Get the creation date of this machine as a `Date` object.
3879
3605
  * @returns A `Date` representing when the machine was created.
3880
3606
  */
3881
3607
  get creation_date(): Date;
3882
- /** Get the creation timestamp (milliseconds since epoch).
3608
+ /**
3609
+ * Get the creation timestamp (milliseconds since epoch).
3883
3610
  * @returns The timestamp as a number.
3884
3611
  */
3885
3612
  get creation_timestamp(): number;
3886
- /** Get the timestamp when construction began (before parsing).
3613
+ /**
3614
+ * Get the timestamp when construction began (before parsing).
3887
3615
  * @returns The start-of-construction timestamp as a number.
3888
3616
  */
3889
3617
  get create_start_time(): number;
3890
- /** Schedule an automatic transition to `next_state` after `after_time`
3618
+ /**
3619
+ * Schedule an automatic transition to `next_state` after `after_time`
3891
3620
  * milliseconds. Only one timeout may be active at a time.
3892
3621
  * @param next_state - The state to transition to when the timer fires.
3893
3622
  * @param after_time - Delay in milliseconds.
3894
3623
  * @throws {JssmError} If a timeout is already pending.
3895
3624
  */
3896
3625
  set_state_timeout(next_state: StateType, after_time: number): void;
3897
- /** Cancel any pending state timeout. Safe to call when no timeout is active.
3626
+ /**
3627
+ Cancel any pending state timeout. Safe to call when no timeout is active.
3898
3628
  */
3899
3629
  clear_state_timeout(): void;
3900
- /** Get the configured `after` timeout for a given state, if any.
3630
+ /**
3631
+ * Get the configured `after` timeout for a given state, if any.
3901
3632
  * @param which_state - The state to look up.
3902
3633
  * @returns A `[targetState, delayMs]` tuple, or `undefined` if no timeout
3903
3634
  * is configured for that state.
3904
3635
  */
3905
3636
  state_timeout_for(which_state: StateType): [StateType, number] | undefined;
3906
- /** Get the configured `after` timeout for the current state, if any.
3637
+ /**
3638
+ * Get the configured `after` timeout for the current state, if any.
3907
3639
  * @returns A `[targetState, delayMs]` tuple, or `undefined`.
3908
3640
  */
3909
3641
  current_state_timeout(): [StateType, number] | undefined;
3910
- /** Convenience method to create a new machine from a tagged template literal.
3642
+ /**
3643
+ * Convenience method to create a new machine from a tagged template literal.
3911
3644
  * Equivalent to calling the top-level `sm` function.
3912
3645
  * @param template_strings - The template string array.
3913
3646
  * @param remainder - Interpolated values.
@@ -3946,11 +3679,9 @@ type RenderGroups = 'cluster' | 'chips' | 'off';
3946
3679
  * configure({ DOMParser: new JSDOM().window.DOMParser });
3947
3680
  * const el = await fsl_to_svg_element('a -> b;');
3948
3681
  * ```
3949
- *
3950
3682
  * @param opts Configuration overrides.
3951
3683
  * @param opts.DOMParser Constructor compatible with the WHATWG `DOMParser`
3952
3684
  * interface. Used as a fallback when `globalThis.DOMParser` is undefined.
3953
- *
3954
3685
  * @throws {JssmError} if `DOMParser` is provided and is not a constructor.
3955
3686
  */
3956
3687
  declare function configure(opts: {
@@ -3959,7 +3690,6 @@ declare function configure(opts: {
3959
3690
  /**
3960
3691
  * Look up a color from the default viz palette by key, returning empty
3961
3692
  * string if the key is unknown (so it disappears in feature concatenation).
3962
- *
3963
3693
  * @internal
3964
3694
  */
3965
3695
  declare function vc(col: string): string;
@@ -3973,10 +3703,8 @@ declare function vc(col: string): string;
3973
3703
  * doublequote('a"b'); // 'a\\"b'
3974
3704
  * doublequote('safe'); // 'safe'
3975
3705
  * ```
3976
- *
3977
3706
  * @param txt Any string that will be placed inside `"…"` in a DOT attribute.
3978
3707
  * @returns The string with every `"` replaced by `\"`.
3979
- *
3980
3708
  * @internal
3981
3709
  */
3982
3710
  declare function doublequote(txt: string): string;
@@ -3991,10 +3719,8 @@ declare function doublequote(txt: string): string;
3991
3719
  * undoublequote('a\\"b'); // 'a"b'
3992
3720
  * undoublequote('safe'); // 'safe'
3993
3721
  * ```
3994
- *
3995
3722
  * @param txt A DOT-escaped attribute string (as produced by `doublequote`).
3996
3723
  * @returns The string with every `\"` collapsed back to `"`.
3997
- *
3998
3724
  * @internal
3999
3725
  */
4000
3726
  declare function undoublequote(txt: string): string;
@@ -4017,11 +3743,9 @@ declare function undoublequote(txt: string): string;
4017
3743
  * slug_for('!!!'); // ''
4018
3744
  * slug_for(' Foo Bar '); // 'foo-bar'
4019
3745
  * ```
4020
- *
4021
3746
  * @param state The state name to slugify.
4022
3747
  * @returns The lowercase hyphen-separated slug, or empty string if none of
4023
3748
  * the characters were retainable.
4024
- *
4025
3749
  * @internal
4026
3750
  */
4027
3751
  declare function slug_for(state: string): string;
@@ -4050,10 +3774,8 @@ declare function slug_for(state: string): string;
4050
3774
  * slug_states(['!!!', '???']);
4051
3775
  * // Map { '!!!' => 'node-1', '???' => 'node-2' }
4052
3776
  * ```
4053
- *
4054
3777
  * @param states States in declaration order.
4055
3778
  * @returns A `Map` from each state name to its unique slug.
4056
- *
4057
3779
  * @internal
4058
3780
  */
4059
3781
  declare function slug_states(states: string[]): Map<string, string>;
@@ -4074,7 +3796,6 @@ declare function slug_states(states: string[]): Map<string, string>;
4074
3796
  * node_of('Red Light', new Map([['Red Light', 'red-light']]));
4075
3797
  * // '"red-light"'
4076
3798
  * ```
4077
- *
4078
3799
  * @internal
4079
3800
  */
4080
3801
  declare function node_of(state: string, state_index: string[] | Map<string, number> | Map<string, string>): string;
@@ -4084,13 +3805,11 @@ declare function node_of(state: string, state_index: string[] | Map<string, numb
4084
3805
  * a 9-character `#`-prefixed string.
4085
3806
  *
4086
3807
  * Graphviz dot does not support alpha; this is a lossy projection.
4087
- *
4088
3808
  * @internal
4089
3809
  */
4090
3810
  declare function color8to6(color8: string): string;
4091
3811
  /**
4092
3812
  * Variant of {@link color8to6} that passes `undefined` through.
4093
- *
4094
3813
  * @internal
4095
3814
  */
4096
3815
  declare function u_color8to6(color8?: string): string | undefined;
@@ -4099,7 +3818,6 @@ declare function u_color8to6(color8?: string): string | undefined;
4099
3818
  * so theme-supplied shapes are honoured along with per-state declarations.
4100
3819
  * Returns `undefined` if neither a theme nor a state declaration supplies a
4101
3820
  * shape.
4102
- *
4103
3821
  * @internal
4104
3822
  */
4105
3823
  declare function shape_for_state<T>(u_jssm: Machine<T>, state: string): string | undefined;
@@ -4108,7 +3826,6 @@ declare function shape_for_state<T>(u_jssm: Machine<T>, state: string): string |
4108
3826
  * so theme-supplied images are honoured along with per-state declarations.
4109
3827
  * Returns `undefined` if neither a theme nor a state declaration supplies an
4110
3828
  * image.
4111
- *
4112
3829
  * @internal
4113
3830
  */
4114
3831
  declare function image_for_state<T>(u_jssm: Machine<T>, state: string): string | undefined;
@@ -4117,13 +3834,12 @@ declare function image_for_state<T>(u_jssm: Machine<T>, state: string): string |
4117
3834
  * style via {@link jssm.Machine.style_for}, then delegating to
4118
3835
  * {@link compose_style_string}. Theme-supplied `corners` and `lineStyle`
4119
3836
  * are honoured along with per-state declarations.
4120
- *
4121
3837
  * @internal
4122
3838
  */
4123
3839
  declare function style_for_state<T>(u_jssm: Machine<T>, state: string): string;
4124
3840
  /**
4125
3841
  * Map a single `transition: {}` config item (`{ key, value }`) to a Graphviz
4126
- * *edge*-scope attribute `name="value"` pair, or `undefined` when the key has
3842
+ * edge*-scope attribute `name="value"` pair, or `undefined` when the key has
4127
3843
  * no edge-meaningful projection. Mirrors the per-node mapping in
4128
3844
  * {@link state_node_line}, but targets the attribute names Graphviz uses on
4129
3845
  * edges:
@@ -4136,7 +3852,6 @@ declare function style_for_state<T>(u_jssm: Machine<T>, state: string): string;
4136
3852
  * Node-only keys (`background-color`, `shape`, `corners`, `image`, `url`,
4137
3853
  * `state-label`, `border-color`) have no edge meaning and yield `undefined`,
4138
3854
  * so they are dropped from the `edge [ … ]` default statement.
4139
- *
4140
3855
  * @internal
4141
3856
  */
4142
3857
  declare function edge_attr_for(key: string, value: string): string | undefined;
@@ -4153,13 +3868,12 @@ declare function edge_attr_for(key: string, value: string): string | undefined;
4153
3868
  * edge_defaults_body([{ key: 'color', value: '#0000ffff' }]);
4154
3869
  * // 'color="#0000ffff"'
4155
3870
  * ```
4156
- *
4157
3871
  * @internal
4158
3872
  */
4159
3873
  declare function edge_defaults_body(config: JssmTransitionConfig | undefined): string;
4160
3874
  /**
4161
3875
  * Map a single `graph: {}` config item (`{ key, value }`) to a Graphviz
4162
- * *graph*-scope attribute `name="value"` pair, or `undefined` when the key is
3876
+ * graph*-scope attribute `name="value"` pair, or `undefined` when the key is
4163
3877
  * either not graph-meaningful or already handled by another machine path
4164
3878
  * (`graph_layout` → SVG engine, `flow` → `rankdir`, `theme` → style cascade,
4165
3879
  * `dot_preamble` → preamble). `background-color` is handled separately — it
@@ -4168,7 +3882,6 @@ declare function edge_defaults_body(config: JssmTransitionConfig | undefined): s
4168
3882
  *
4169
3883
  * - `color` → graph `color` (cluster/graph border).
4170
3884
  * - `text-color` → graph `fontcolor`.
4171
- *
4172
3885
  * @internal
4173
3886
  */
4174
3887
  declare function graph_attr_for(key: string, value: string): string | undefined;
@@ -4183,7 +3896,6 @@ declare function graph_attr_for(key: string, value: string): string | undefined;
4183
3896
  * This is the single reconciliation point for the graph background: the value
4184
3897
  * it returns flows into {@link dot_template}'s one `bgcolor="…"` slot, so the
4185
3898
  * `graph: {}` value wins over the legacy alias and is never emitted twice.
4186
- *
4187
3899
  * @internal
4188
3900
  */
4189
3901
  declare function graph_bg_color_from_config(config: JssmGraphConfig | undefined, fallback: string): string;
@@ -4193,7 +3905,6 @@ declare function graph_bg_color_from_config(config: JssmGraphConfig | undefined,
4193
3905
  * one Graphviz graph attribute statement per key (e.g. `color="…";`). Returns
4194
3906
  * the empty string when nothing applies, so machines without graph-scope color
4195
3907
  * attributes are byte-identical to before.
4196
- *
4197
3908
  * @internal
4198
3909
  */
4199
3910
  declare function graph_attrs_body(config: JssmGraphConfig | undefined): string;
@@ -4216,7 +3927,6 @@ declare function graph_attrs_body(config: JssmGraphConfig | undefined): string;
4216
3927
  * or only terminal — a long-standing bug. The fix is to check the two
4217
3928
  * underlying predicates directly so the three named buckets reflect
4218
3929
  * three meaningfully distinct conditions.
4219
- *
4220
3930
  * @internal
4221
3931
  */
4222
3932
  type StateKind = 'final' | 'complete' | 'terminal' | 'base';
@@ -4235,12 +3945,10 @@ type StateKind = 'final' | 'complete' | 'terminal' | 'base';
4235
3945
  * cluster_id_for('Active Players', 0); // 'cluster_active_players_0'
4236
3946
  * cluster_id_for('!!!', 3); // 'cluster_g3'
4237
3947
  * ```
4238
- *
4239
3948
  * @param group The FSL group name.
4240
3949
  * @param index The group's stable declaration-order index (0-based); included
4241
3950
  * in the emitted id to prevent slug collisions.
4242
3951
  * @returns A valid Graphviz subgraph identifier starting with `cluster_`.
4243
- *
4244
3952
  * @internal
4245
3953
  */
4246
3954
  declare function cluster_id_for(group: string, index: number): string;
@@ -4255,7 +3963,6 @@ declare function cluster_id_for(group: string, index: number): string;
4255
3963
  * label_with_chips('Foo', []); // 'Foo'
4256
3964
  * label_with_chips('Foo', ['a', 'b']); // 'Foo [a] [b]'
4257
3965
  * ```
4258
- *
4259
3966
  * @internal
4260
3967
  */
4261
3968
  declare function label_with_chips(label: string, chips: string[]): string;
@@ -4272,7 +3979,6 @@ declare function label_with_chips(label: string, chips: string[]): string;
4272
3979
  * // for `&inner:[a]; &outer:[&inner b];`
4273
3980
  * // group_parent_map(reg, ['inner','outer']) === Map { 'inner' => 'outer' }
4274
3981
  * ```
4275
- *
4276
3982
  * @internal
4277
3983
  */
4278
3984
  declare function group_parent_map(registry: Map<string, JssmGroupMemberRef[]>, order: string[]): Map<string, string>;
@@ -4281,7 +3987,6 @@ declare function group_parent_map(registry: Map<string, JssmGroupMemberRef[]>, o
4281
3987
  * ancestor set *including the group itself*. Used both to nest clusters and
4282
3988
  * to decide which of a state's memberships its primary cluster already
4283
3989
  * represents (so the rest become chips).
4284
- *
4285
3990
  * @internal
4286
3991
  */
4287
3992
  declare function group_ancestry(group: string, parents: Map<string, string>): Set<string>;
@@ -4291,7 +3996,6 @@ declare function group_ancestry(group: string, parents: Map<string, string>): Se
4291
3996
  * declaration order — the same precedence the config cascade uses, so a
4292
3997
  * state's cluster placement agrees with the group whose style won. Returns
4293
3998
  * `undefined` for a state in no group.
4294
- *
4295
3999
  * @internal
4296
4000
  */
4297
4001
  declare function primary_group_for<T>(u_jssm: Machine<T>, state: string, order: string[]): string | undefined;
@@ -4301,11 +4005,9 @@ declare function primary_group_for<T>(u_jssm: Machine<T>, state: string, order:
4301
4005
  * ungrouped state) plus the *chip* groups — memberships the primary cluster's
4302
4006
  * ancestry does not already represent, i.e. genuine overlap that nesting
4303
4007
  * cannot show.
4304
- *
4305
4008
  * @returns `{ placement, chips }` where `placement` maps state → primary
4306
4009
  * group, and `chips` maps state → the overflow group names (declaration
4307
4010
  * order).
4308
- *
4309
4011
  * @internal
4310
4012
  */
4311
4013
  declare function plan_cluster_groups<T>(u_jssm: Machine<T>, l_states: string[], order: string[], parents: Map<string, string>): {
@@ -4328,10 +4030,8 @@ declare function plan_cluster_groups<T>(u_jssm: Machine<T>, l_states: string[],
4328
4030
  * // for `&inner:[a]; &outer:[&inner b]; a -> b;` the result contains
4329
4031
  * // subgraph cluster_outer { label="outer"; … subgraph cluster_inner { … } }
4330
4032
  * ```
4331
- *
4332
4033
  * @returns `{ clusters, ungrouped_nodes }` — the cluster DOT block and the
4333
4034
  * node statements for states in no group.
4334
- *
4335
4035
  * @internal
4336
4036
  */
4337
4037
  declare function groups_to_subgraph_string<T>(u_jssm: Machine<T>, l_states: string[], state_index: Map<string, string>, state_kinds: Map<string, StateKind>, hide_state_labels: boolean): {
@@ -4348,7 +4048,6 @@ declare function groups_to_subgraph_string<T>(u_jssm: Machine<T>, l_states: stri
4348
4048
  * // for `&inner:[a]; &outer:[&inner b]; a -> b;`
4349
4049
  * // chips_for_all_groups(m, ['a','b']) === Map { 'a' => ['inner','outer'], 'b' => ['outer'] }
4350
4050
  * ```
4351
- *
4352
4051
  * @internal
4353
4052
  */
4354
4053
  declare function chips_for_all_groups<T>(u_jssm: Machine<T>, l_states: string[]): Map<string, string[]>;
@@ -4388,7 +4087,6 @@ type VizRenderOpts = {
4388
4087
  *
4389
4088
  * A machine that declares no groups produces the same flat node list in every
4390
4089
  * mode, so `'cluster'`/`'chips'` are no-ops there.
4391
- *
4392
4090
  * @internal
4393
4091
  */
4394
4092
  declare function node_block_for<T>(u_jssm: Machine<T>, l_states: string[], state_index: Map<string, string>, state_kinds: Map<string, StateKind>, hide_labels: boolean, mode: RenderGroups): string;
@@ -4399,7 +4097,6 @@ declare function node_block_for<T>(u_jssm: Machine<T>, l_states: string[], state
4399
4097
  * {@link plan_cluster_groups} (with identical inputs) for `'cluster'` — so a
4400
4098
  * reconstructed label can never disagree with the one graphviz was handed.
4401
4099
  * `'off'`, and any machine that declares no groups, yields an empty map.
4402
- *
4403
4100
  * @internal
4404
4101
  */
4405
4102
  declare function chips_for_render_mode<T>(u_jssm: Machine<T>, l_states: string[], mode: RenderGroups): Map<string, string[]>;
@@ -4418,7 +4115,6 @@ declare function chips_for_render_mode<T>(u_jssm: Machine<T>, l_states: string[]
4418
4115
  * alike. It is built by running the node builder's own
4419
4116
  * `label_with_chips(doublequote(display_text), chips)` and inverting the one
4420
4117
  * escaping step, so it follows any change to the label format for free.
4421
- *
4422
4118
  * @param u_jssm The machine being rendered.
4423
4119
  * @param opts Render flags; only `render_groups` affects the label text
4424
4120
  * (default `'cluster'`, matching `fsl_to_svg_string`).
@@ -4432,7 +4128,6 @@ declare function chips_for_render_mode<T>(u_jssm: Machine<T>, l_states: string[]
4432
4128
  * state_svg_label_texts(sm`&g1 : [a b]; &g2 : [a]; a -> b;`).get('a'); // 'a [g1]'
4433
4129
  * state_svg_label_texts(sm`a -> b;`).get('a'); // 'a'
4434
4130
  * ```
4435
- *
4436
4131
  * @see extract_state_fills
4437
4132
  */
4438
4133
  declare function state_svg_label_texts<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): Map<string, string>;
@@ -4464,7 +4159,6 @@ declare function state_svg_label_texts<T>(u_jssm: Machine<T>, opts?: VizRenderOp
4464
4159
  * // or as label chips, with no cluster boxes
4465
4160
  * const chipped = machine_to_dot(sm`&g : [a b]; a -> b;`, { render_groups: 'chips' });
4466
4161
  * ```
4467
- *
4468
4162
  * @param u_jssm The machine to render.
4469
4163
  * @param opts Optional render flags. See {@link VizRenderOpts}.
4470
4164
  * @returns A complete graphviz dot source string.
@@ -4483,7 +4177,6 @@ declare function machine_to_dot<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): st
4483
4177
  * const dot_with_footer = fsl_to_dot('a -> b;', { footer: 'label="caption";' });
4484
4178
  * // 'digraph G { ... label="caption"; }'
4485
4179
  * ```
4486
- *
4487
4180
  * @param fsl The FSL source.
4488
4181
  * @param opts Optional render flags. See {@link VizRenderOpts}.
4489
4182
  * @returns A complete graphviz dot source string.
@@ -4498,7 +4191,6 @@ declare function fsl_to_dot(fsl: string, opts?: VizRenderOpts): string;
4498
4191
  * const svg = await dot_to_svg('digraph G { a -> b }');
4499
4192
  * const svg_neato = await dot_to_svg('digraph G { a -> b }', { engine: 'neato' });
4500
4193
  * ```
4501
- *
4502
4194
  * @param dot Graphviz dot source.
4503
4195
  * @param options Optional renderer overrides.
4504
4196
  * @param options.engine Graphviz layout engine to use (e.g. `'dot'`,
@@ -4516,7 +4208,6 @@ declare function dot_to_svg(dot: string, options?: {
4516
4208
  * const svg = await fsl_to_svg_string('a -> b;');
4517
4209
  * const svg_neato = await fsl_to_svg_string('a -> b;', { engine: 'neato' });
4518
4210
  * ```
4519
- *
4520
4211
  * @param fsl The FSL source.
4521
4212
  * @param opts Optional render flags. See {@link VizRenderOpts}.
4522
4213
  * @returns A promise resolving to an SVG XML string.
@@ -4524,7 +4215,6 @@ declare function dot_to_svg(dot: string, options?: {
4524
4215
  declare function fsl_to_svg_string(fsl: string, opts?: VizRenderOpts): Promise<string>;
4525
4216
  /**
4526
4217
  * Render a {@link jssm.Machine} to SVG.
4527
- *
4528
4218
  * @param u_jssm The machine to render.
4529
4219
  * @param opts Optional render flags. See {@link VizRenderOpts}.
4530
4220
  * @returns A promise resolving to an SVG XML string.
@@ -4532,7 +4222,6 @@ declare function fsl_to_svg_string(fsl: string, opts?: VizRenderOpts): Promise<s
4532
4222
  declare function machine_to_svg_string<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): Promise<string>;
4533
4223
  /**
4534
4224
  * Render an FSL string directly to a parsed `SVGSVGElement`.
4535
- *
4536
4225
  * @param fsl The FSL source.
4537
4226
  * @param opts Optional render flags. See {@link VizRenderOpts}.
4538
4227
  * @returns A promise resolving to a parsed `SVGSVGElement`.
@@ -4541,7 +4230,6 @@ declare function machine_to_svg_string<T>(u_jssm: Machine<T>, opts?: VizRenderOp
4541
4230
  declare function fsl_to_svg_element(fsl: string, opts?: VizRenderOpts): Promise<SVGSVGElement>;
4542
4231
  /**
4543
4232
  * Render a {@link jssm.Machine} to a parsed `SVGSVGElement`.
4544
- *
4545
4233
  * @param u_jssm The machine to render.
4546
4234
  * @param opts Optional render flags. See {@link VizRenderOpts}.
4547
4235
  * @returns A promise resolving to a parsed `SVGSVGElement`.
@@ -4551,12 +4239,11 @@ declare function machine_to_svg_element<T>(u_jssm: Machine<T>, opts?: VizRenderO
4551
4239
  /**
4552
4240
  * Compatibility wrapper for {@link machine_to_dot}, retained from
4553
4241
  * jssm-viz. Will be removed in the next major.
4554
- *
4555
4242
  * @deprecated Use {@link machine_to_dot} instead.
4556
4243
  */
4557
4244
  declare function dot<T>(machine: Machine<T>): string;
4558
4245
 
4559
- /** @internal — test-only access to private helpers. */
4246
+ /** @internal */
4560
4247
  declare const _test: {
4561
4248
  doublequote: typeof doublequote;
4562
4249
  color8to6: typeof color8to6;