jssm 5.112.3 → 5.113.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +3 -3
  2. package/dist/deno/README.md +347 -0
  3. package/dist/deno/jssm.js +1 -0
  4. package/dist/{es6 → deno}/jssm_constants.d.ts +5 -0
  5. package/dist/{es6 → deno}/jssm_types.d.ts +298 -5
  6. package/dist/jssm.es5.cjs +1 -1
  7. package/dist/jssm.es5.iife.js +1 -1
  8. package/dist/jssm.es6.mjs +1 -1
  9. package/dist/jssm_viz.cjs +1 -1
  10. package/dist/jssm_viz.iife.cjs +1 -1
  11. package/dist/jssm_viz.mjs +1 -1
  12. package/jssm.es5.d.cts +241 -2
  13. package/jssm.es6.d.ts +241 -2
  14. package/jssm_viz.es5.d.cts +216 -2
  15. package/jssm_viz.es6.d.ts +216 -2
  16. package/package.json +18 -2
  17. package/.clocignore +0 -1
  18. package/.codeclimate.yml +0 -22
  19. package/.editorconfig +0 -12
  20. package/.eslintrc +0 -20
  21. package/.gitattributes +0 -17
  22. package/.log-progress.json +0 -9
  23. package/.nycrc +0 -6
  24. package/.travis.yml +0 -9
  25. package/CHANGELOG.md +0 -263
  26. package/CLAUDE.md +0 -11
  27. package/dist/es6/fsl_parser.js +0 -1
  28. package/dist/es6/jssm.js +0 -3320
  29. package/dist/es6/jssm_arrow.js +0 -211
  30. package/dist/es6/jssm_compiler.js +0 -380
  31. package/dist/es6/jssm_constants.js +0 -121
  32. package/dist/es6/jssm_error.js +0 -47
  33. package/dist/es6/jssm_theme.js +0 -24
  34. package/dist/es6/jssm_types.js +0 -3
  35. package/dist/es6/jssm_util.js +0 -337
  36. package/dist/es6/jssm_viz.js +0 -560
  37. package/dist/es6/jssm_viz_colors.js +0 -63
  38. package/dist/es6/themes/jssm_base_stylesheet.d.ts +0 -11
  39. package/dist/es6/themes/jssm_base_stylesheet.js +0 -58
  40. package/dist/es6/themes/jssm_theme_bold.d.ts +0 -11
  41. package/dist/es6/themes/jssm_theme_bold.js +0 -58
  42. package/dist/es6/themes/jssm_theme_default.d.ts +0 -11
  43. package/dist/es6/themes/jssm_theme_default.js +0 -58
  44. package/dist/es6/themes/jssm_theme_modern.d.ts +0 -11
  45. package/dist/es6/themes/jssm_theme_modern.js +0 -58
  46. package/dist/es6/themes/jssm_theme_ocean.d.ts +0 -11
  47. package/dist/es6/themes/jssm_theme_ocean.js +0 -56
  48. package/dist/es6/themes/jssm_theme_plain.d.ts +0 -11
  49. package/dist/es6/themes/jssm_theme_plain.js +0 -70
  50. package/dist/es6/version.js +0 -2
  51. package/dist/jssm.es5.nonmin.cjs +0 -24506
  52. package/dist/jssm.es6.nonmin.cjs +0 -24473
  53. package/dist/jssm_viz.es5.iife.nonmin.cjs +0 -24679
  54. package/dist/jssm_viz.es5.nonmin.cjs +0 -24674
  55. package/dist/jssm_viz.es6.nonmin.cjs +0 -24661
  56. package/jest-dragon.config.cjs +0 -36
  57. package/jest-spec.config.cjs +0 -36
  58. package/jest-stoch.config.cjs +0 -36
  59. package/jest-unicode.config.cjs +0 -36
  60. package/log-progress.data.json +0 -28
  61. package/rollup.config.deno.js +0 -44
  62. package/rollup.config.es5.js +0 -52
  63. package/rollup.config.es6.js +0 -55
  64. package/rollup.config.viz.es5.js +0 -46
  65. package/rollup.config.viz.es6.js +0 -46
  66. package/rollup.config.viz.iife.js +0 -36
  67. package/tutorial_learn_testing.md +0 -168
  68. package/typedoc-options.cjs +0 -69
  69. /package/dist/{es6 → deno}/fsl_parser.d.ts +0 -0
  70. /package/dist/{es6 → deno}/jssm.d.ts +0 -0
  71. /package/dist/{es6 → deno}/jssm_arrow.d.ts +0 -0
  72. /package/dist/{es6 → deno}/jssm_compiler.d.ts +0 -0
  73. /package/dist/{es6 → deno}/jssm_error.d.ts +0 -0
  74. /package/dist/{es6 → deno}/jssm_theme.d.ts +0 -0
  75. /package/dist/{es6 → deno}/jssm_util.d.ts +0 -0
  76. /package/dist/{es6 → deno}/jssm_viz.d.ts +0 -0
  77. /package/dist/{es6 → deno}/jssm_viz_colors.d.ts +0 -0
  78. /package/dist/{es6 → deno}/version.d.ts +0 -0
@@ -19,6 +19,11 @@ export declare const NegInfinity: number, PosInfinity: number, Epsilon: number,
19
19
  *
20
20
  */
21
21
  declare const gviz_shapes: string[];
22
+ /**
23
+ * Public alias for {@link gviz_shapes}. The list of node shapes supported
24
+ * by Graphviz that jssm-viz accepts in FSL `state ... : { shape: ... }`
25
+ * declarations.
26
+ */
22
27
  declare const shapes: string[];
23
28
  /*******
24
29
  *
@@ -1,34 +1,110 @@
1
1
  import { circular_buffer } from 'circular_buffer_js';
2
2
  declare type StateType = string;
3
+ /** Composite type indicating success as part of a result. */
3
4
  declare type JssmSuccess = {
4
5
  success: true;
5
- }; /** Composite type indicating success as part of a result */
6
+ };
7
+ /** Composite type indicating an error, and the reason for it, as part of a result. */
6
8
  declare type JssmFailure = {
7
9
  success: false;
8
10
  error: any;
9
- }; /** Composite type indicating an error, and why, as part of a result */
11
+ };
12
+ /** Composite type indicating that a result isn't finished yet. */
10
13
  declare type JssmIncomplete = {
11
14
  success: 'incomplete';
12
- }; /** Composite type indicating that a result isn't finished */
13
- declare type JssmResult = JssmSuccess | JssmFailure | JssmIncomplete; /** Composite type composing whether or not a result was successful */
15
+ };
16
+ /**
17
+ * Discriminated union representing the outcome of an operation: either
18
+ * success, failure (with an `error`), or incomplete. Used as the return
19
+ * shape for operations that may need to report partial progress.
20
+ */
21
+ declare type JssmResult = JssmSuccess | JssmFailure | JssmIncomplete;
22
+ /**
23
+ * A color value accepted by jssm-viz for state and arrow styling. Currently
24
+ * any string, validated downstream by Graphviz / the named-colors list.
25
+ * Intended to be narrowed to `#RRGGBB` / `#RRGGBBAA` and CSS named colors
26
+ * in a future release.
27
+ */
14
28
  declare type JssmColor = string;
29
+ /**
30
+ * Two-state policy flag: a feature is either `'required'` or `'disallowed'`.
31
+ * Used by machine configuration where the option must take a definite stance.
32
+ */
15
33
  declare type JssmPermitted = 'required' | 'disallowed';
34
+ /**
35
+ * Three-state policy flag: `'required'`, `'disallowed'`, or `'optional'`.
36
+ * Used by machine configuration where a default-permissive middle ground
37
+ * is meaningful (for example, the `actions` config key).
38
+ */
16
39
  declare type JssmPermittedOpt = 'required' | 'disallowed' | 'optional';
40
+ /**
41
+ * The set of ASCII arrow tokens recognized by the FSL grammar. Each arrow
42
+ * encodes a direction (one-way left/right, or two-way) and a "kind" for
43
+ * each direction (`-` legal, `=` main path, `~` forced-only). See the
44
+ * Language Reference docs for the full semantic table.
45
+ */
17
46
  declare type JssmArrow = '->' | '<-' | '<->' | '<=->' | '<~->' | '=>' | '<=' | '<=>' | '<-=>' | '<~=>' | '~>' | '<~' | '<~>' | '<-~>' | '<=~>';
18
47
  /**
19
48
  * A type teaching Typescript the various supported shapes for nodes, mostly inherited from GraphViz
20
49
  */
21
50
  declare type JssmShape = "box" | "polygon" | "ellipse" | "oval" | "circle" | "point" | "egg" | "triangle" | "plaintext" | "plain" | "diamond" | "trapezium" | "parallelogram" | "house" | "pentagon" | "hexagon" | "septagon" | "octagon" | "doublecircle" | "doubleoctagon" | "tripleoctagon" | "invtriangle" | "invtrapezium" | "invhouse" | "Mdiamond" | "Msquare" | "Mcircle" | "rect" | "rectangle" | "square" | "star" | "none" | "underline" | "cylinder" | "note" | "tab" | "folder" | "box3d" | "component" | "promoter" | "cds" | "terminator" | "utr" | "primersite" | "restrictionsite" | "fivepoverhang" | "threepoverhang" | "noverhang" | "assembly" | "signature" | "insulator" | "ribosite" | "rnastab" | "proteasesite" | "proteinstab" | "rpromoter" | "rarrow" | "larrow" | "lpromoter" | "record";
51
+ /**
52
+ * Direction polarity of an arrow: pointing only `'left'`, only `'right'`,
53
+ * or `'both'` (a bidirectional arrow).
54
+ */
22
55
  declare type JssmArrowDirection = 'left' | 'right' | 'both';
56
+ /**
57
+ * Semantic category of an arrow's transition. `'legal'` is a normal
58
+ * transition, `'main'` is part of the machine's primary path, `'forced'`
59
+ * may only be taken via {@link Machine.force_transition}, and `'none'`
60
+ * means no transition exists in that direction.
61
+ */
23
62
  declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
63
+ /**
64
+ * Graphviz layout engine selector. Controls how jssm-viz lays out the
65
+ * rendered diagram; `'dot'` is the default and most useful for state
66
+ * machines. See the Graphviz documentation for the differences.
67
+ */
24
68
  declare type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp' | 'neato';
25
69
  declare type JssmCorner = 'regular' | 'rounded' | 'lined';
26
70
  declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
71
+ /**
72
+ * Tristate flag for whether a property may be overridden at runtime.
73
+ * `true` permits overrides, `false` forbids them, and `undefined` defers
74
+ * the decision to the surrounding configuration's default.
75
+ */
27
76
  declare type JssmAllowsOverride = true | false | undefined;
77
+ /**
78
+ * Runtime-iterable list of valid `flow` directions for FSL diagrams.
79
+ * Use this when you need to enumerate directions; for the type itself
80
+ * see {@link FslDirection}.
81
+ */
28
82
  declare const FslDirections: readonly ["up", "right", "down", "left"];
83
+ /**
84
+ * String literal type of the four supported FSL flow directions. This is
85
+ * the type of the `flow` config key on a machine.
86
+ */
29
87
  declare type FslDirection = typeof FslDirections[number];
88
+ /**
89
+ * Runtime-iterable list of the built-in theme names that ship with jssm-viz.
90
+ * Use this when you need to enumerate themes; for the type itself see
91
+ * {@link FslTheme}.
92
+ */
30
93
  declare const FslThemes: readonly ["default", "ocean", "modern", "plain", "bold"];
94
+ /**
95
+ * String literal type of the built-in theme names. This is the element
96
+ * type of the `theme` config key (which accepts an array so that themes
97
+ * can be layered).
98
+ */
31
99
  declare type FslTheme = typeof FslThemes[number];
100
+ /**
101
+ * Persistable snapshot of a Machine produced by {@link Machine.serialize}
102
+ * and consumed by {@link deserialize}. Carries the current state, the
103
+ * associated machine data, the recent history (subject to the configured
104
+ * capacity), and metadata to detect version-skew on rehydration.
105
+ *
106
+ * @typeParam DataType - The type of the user-supplied data payload (`mDT`).
107
+ */
32
108
  declare type JssmSerialization<DataType> = {
33
109
  jssm_version: string;
34
110
  timestamp: number;
@@ -38,6 +114,11 @@ declare type JssmSerialization<DataType> = {
38
114
  history_capacity: number;
39
115
  data: DataType;
40
116
  };
117
+ /**
118
+ * Declaration of a named property that a machine's states may carry.
119
+ * Set `required: true` to force every state to define the property, or
120
+ * provide `default_value` to fall back when the state does not specify it.
121
+ */
41
122
  declare type JssmPropertyDefinition = {
42
123
  name: string;
43
124
  default_value?: any;
@@ -45,6 +126,17 @@ declare type JssmPropertyDefinition = {
45
126
  };
46
127
  declare type JssmTransitionPermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
47
128
  declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
129
+ /**
130
+ * A single directed transition (edge) within a state machine. Captures
131
+ * both the topology (`from` / `to`), the FSL semantics (`kind`,
132
+ * `forced_only`, `main_path`), and any optional metadata such as a
133
+ * per-edge `name`, an action label, a guard `check`, a transition
134
+ * `probability` for stochastic models, and an `after_time` for timed
135
+ * transitions.
136
+ *
137
+ * @typeParam StateType - The state-name type (usually `string`).
138
+ * @typeParam DataType - The machine's data payload type (`mDT`).
139
+ */
48
140
  declare type JssmTransition<StateType, DataType> = {
49
141
  from: StateType;
50
142
  to: StateType;
@@ -58,22 +150,48 @@ declare type JssmTransition<StateType, DataType> = {
58
150
  forced_only: boolean;
59
151
  main_path: boolean;
60
152
  };
153
+ /** A list of {@link JssmTransition}s — the edge set of a machine. */
61
154
  declare type JssmTransitions<StateType, DataType> = JssmTransition<StateType, DataType>[];
155
+ /**
156
+ * The set of states that can immediately precede or follow a given state.
157
+ * Returned by jssm helpers that report a state's connectivity in the graph.
158
+ */
62
159
  declare type JssmTransitionList = {
63
160
  entrances: Array<StateType>;
64
161
  exits: Array<StateType>;
65
162
  };
163
+ /**
164
+ * Internal marker used by the compiler to indicate a cycle declaration in
165
+ * the parse stream, rather than a literal state name. See
166
+ * {@link JssmTransitionRule}.
167
+ */
66
168
  declare type JssmTransitionCycle = {
67
169
  key: 'cycle';
68
170
  value: StateType;
69
171
  };
172
+ /**
173
+ * An entry produced while parsing a transition rule: either a literal
174
+ * state name (`StateType`) or a {@link JssmTransitionCycle} marker.
175
+ */
70
176
  declare type JssmTransitionRule = StateType | JssmTransitionCycle;
177
+ /**
178
+ * Topology record for one node in a compiled machine: its name, the set of
179
+ * states it can be reached from, the set of states it can transition to,
180
+ * and whether reaching it constitutes "completing" the machine.
181
+ */
71
182
  declare type JssmGenericState = {
72
183
  from: Array<StateType>;
73
184
  name: StateType;
74
185
  to: Array<StateType>;
75
186
  complete: boolean;
76
187
  };
188
+ /**
189
+ * The full internal bookkeeping snapshot of a {@link Machine}, exposed for
190
+ * advanced introspection. Contains the current state, the state map, the
191
+ * edge map and reverse-action map, and the original edge list. The
192
+ * `internal_state_impl_version` field exists so that consumers can detect
193
+ * shape changes if this representation evolves.
194
+ */
77
195
  declare type JssmMachineInternalState<DataType> = {
78
196
  internal_state_impl_version: 1;
79
197
  state: StateType;
@@ -86,6 +204,11 @@ declare type JssmMachineInternalState<DataType> = {
86
204
  };
87
205
  declare type JssmStatePermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
88
206
  declare type JssmStatePermitterMaybeArray<DataType> = JssmStatePermitter<DataType> | Array<JssmStatePermitter<DataType>>;
207
+ /**
208
+ * Minimal machine description used internally and accepted by some
209
+ * lower-level constructors. Most callers should use the richer
210
+ * {@link JssmGenericConfig} instead.
211
+ */
89
212
  declare type JssmGenericMachine<DataType> = {
90
213
  name?: string;
91
214
  state: StateType;
@@ -100,11 +223,21 @@ declare type JssmGenericMachine<DataType> = {
100
223
  allow_force?: boolean;
101
224
  keep_history?: boolean | number;
102
225
  };
226
+ /**
227
+ * A single key/value pair from an FSL `state X: { ... };` block, in the
228
+ * raw form produced by the parser before being condensed into a
229
+ * {@link JssmStateDeclaration}.
230
+ */
103
231
  declare type JssmStateDeclarationRule = {
104
232
  key: string;
105
233
  value: any;
106
234
  name?: string;
107
235
  };
236
+ /**
237
+ * The fully-condensed declaration for a single state, including its raw
238
+ * rule list (`declarations`) and the well-known styling fields jssm-viz
239
+ * understands. Returned by {@link Machine.state_declaration}.
240
+ */
108
241
  declare type JssmStateDeclaration = {
109
242
  declarations: Array<JssmStateDeclarationRule>;
110
243
  shape?: JssmShape;
@@ -122,6 +255,11 @@ declare type JssmStateDeclaration = {
122
255
  value: unknown;
123
256
  };
124
257
  };
258
+ /**
259
+ * A loosened version of {@link JssmStateDeclaration} where every field is
260
+ * optional. Used as the value type for theme entries and for default
261
+ * state configuration where most fields will be inherited or merged.
262
+ */
125
263
  declare type JssmStateConfig = Partial<JssmStateDeclaration>;
126
264
  declare type JssmStateStyleShape = {
127
265
  key: 'shape';
@@ -159,8 +297,29 @@ declare type JssmStateStyleImage = {
159
297
  key: 'image';
160
298
  value: string;
161
299
  };
300
+ /**
301
+ * Tagged union of all individual style key/value pairs that may appear in
302
+ * a state's style configuration. The `key` discriminator selects which
303
+ * member, and the `value` is typed accordingly.
304
+ */
162
305
  declare type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleStateLabel | JssmStateStyleBorderColor | JssmStateStyleImage;
306
+ /**
307
+ * An ordered list of {@link JssmStateStyleKey} entries. Used by the
308
+ * `default_*_state_config` machine config options to provide a fallback
309
+ * style stack.
310
+ */
163
311
  declare type JssmStateStyleKeyList = JssmStateStyleKey[];
312
+ /**
313
+ * Complete shape of a jssm-viz theme. A theme provides a style block for
314
+ * each kind of state (`state`, `hooked`, `start`, `end`, `terminal`) as
315
+ * well as a matching `active_*` variant used while that state is current.
316
+ *
317
+ * The `graph`, `legal`, `main`, `forced`, `action`, and `title` slots are
318
+ * reserved for future use and currently typed as `undefined`.
319
+ *
320
+ * Most user-defined themes should be typed as {@link JssmTheme} (the
321
+ * `Partial` of this) so that omitted fields fall back to the base theme.
322
+ */
164
323
  declare type JssmBaseTheme = {
165
324
  name: string;
166
325
  state: JssmStateConfig;
@@ -180,7 +339,25 @@ declare type JssmBaseTheme = {
180
339
  action: undefined;
181
340
  title: undefined;
182
341
  };
342
+ /**
343
+ * A user-supplied theme. Identical in shape to {@link JssmBaseTheme}, but
344
+ * every field is optional so themes can be layered: omitted slots fall
345
+ * through to the underlying base theme.
346
+ */
183
347
  declare type JssmTheme = Partial<JssmBaseTheme>;
348
+ /**
349
+ * Full configuration object accepted by the {@link Machine} constructor and
350
+ * by {@link from}. Carries the transition list and the optional knobs
351
+ * governing layout, theming, history, start/end states, property
352
+ * definitions, machine metadata (author, license, version, ...) and the
353
+ * runtime hook surfaces (`time_source`, `timeout_source`, ...).
354
+ *
355
+ * Most users never construct one of these directly — the `sm` tagged
356
+ * template literal and {@link from} produce one from FSL source.
357
+ *
358
+ * @typeParam StateType - The state-name type (usually `string`).
359
+ * @typeParam DataType - The user-supplied data payload type (`mDT`).
360
+ */
184
361
  declare type JssmGenericConfig<StateType, DataType> = {
185
362
  graph_layout?: JssmLayout;
186
363
  complete?: Array<StateType>;
@@ -233,10 +410,26 @@ declare type JssmGenericConfig<StateType, DataType> = {
233
410
  timeout_source?: (Function: any, number: any) => number;
234
411
  clear_timeout_source?: (number: any) => void;
235
412
  };
413
+ /**
414
+ * Internal compiler intermediate: a single aggregated rule produced while
415
+ * folding a parse tree into a machine configuration. Not intended for
416
+ * end-user code.
417
+ *
418
+ * @internal
419
+ */
236
420
  declare type JssmCompileRule<StateType> = {
237
421
  agg_as: string;
238
422
  val: any;
239
423
  };
424
+ /**
425
+ * Internal compiler intermediate: one link in a chained transition
426
+ * expression (an "s-expression" segment). Carries both directions of an
427
+ * arrow with optional per-direction action labels, probabilities, and
428
+ * after-times. The recursive `se` field allows the parser to chain
429
+ * arrows of the form `A -> B -> C`. Not intended for end-user code.
430
+ *
431
+ * @internal
432
+ */
240
433
  declare type JssmCompileSe<StateType, mDT> = {
241
434
  to: StateType;
242
435
  se?: JssmCompileSe<StateType, mDT>;
@@ -248,6 +441,15 @@ declare type JssmCompileSe<StateType, mDT> = {
248
441
  l_after?: number;
249
442
  r_after?: number;
250
443
  };
444
+ /**
445
+ * Internal compiler intermediate: the root of a chained transition
446
+ * expression, anchored at a `from` state. Also doubles as the carrier
447
+ * for non-transition rules (state declarations, property definitions,
448
+ * machine metadata) via its `key`/`value`/`name`/`state` fields. Not
449
+ * intended for end-user code.
450
+ *
451
+ * @internal
452
+ */
251
453
  declare type JssmCompileSeStart<StateType, DataType> = {
252
454
  from: StateType;
253
455
  se: JssmCompileSe<StateType, DataType>;
@@ -258,7 +460,19 @@ declare type JssmCompileSeStart<StateType, DataType> = {
258
460
  default_value?: any;
259
461
  required?: boolean;
260
462
  };
463
+ /**
464
+ * The output shape of the FSL parser: a flat array of
465
+ * {@link JssmCompileSeStart} entries, one per top-level rule in the
466
+ * source. Consumed by the compiler to build a machine configuration.
467
+ *
468
+ * @internal
469
+ */
261
470
  declare type JssmParseTree<StateType, mDT> = Array<JssmCompileSeStart<StateType, mDT>>;
471
+ /**
472
+ * Signature of an FSL parse function: takes a source string and returns a
473
+ * {@link JssmParseTree}. Used to type the parser export so consumers can
474
+ * swap in alternative parser implementations.
475
+ */
262
476
  declare type JssmParseFunctionType<StateType, mDT> = (string: any) => JssmParseTree<StateType, mDT>;
263
477
  declare type BasicHookDescription<mDT> = {
264
478
  kind: 'hook';
@@ -377,28 +591,107 @@ declare type PostEverythingHook<mDT> = {
377
591
  kind: 'post everything';
378
592
  handler: PostEverythingHookHandler<mDT>;
379
593
  };
594
+ /**
595
+ * Discriminated union of every kind of hook registration jssm understands,
596
+ * pre-transition and post-transition. The `kind` field selects the
597
+ * variant; remaining fields describe which transitions / states / actions
598
+ * the hook is bound to and supply the {@link HookHandler} or
599
+ * {@link PostHookHandler} to invoke.
600
+ *
601
+ * Pre-transition variants (`'hook'`, `'named'`, `'standard transition'`,
602
+ * `'main transition'`, `'forced transition'`, `'any transition'`,
603
+ * `'global action'`, `'any action'`, `'entry'`, `'exit'`, `'after'`)
604
+ * may return a falsy value to veto a transition. Post-transition
605
+ * variants (`'post *'`) cannot veto and are invoked only after a
606
+ * successful transition.
607
+ */
380
608
  declare type HookDescription<mDT> = BasicHookDescription<mDT> | HookDescriptionWithAction<mDT> | GlobalActionHook<mDT> | AnyActionHook<mDT> | StandardTransitionHook<mDT> | MainTransitionHook<mDT> | ForcedTransitionHook<mDT> | AnyTransitionHook<mDT> | EntryHook<mDT> | ExitHook<mDT> | AfterHook<mDT> | PostBasicHookDescription<mDT> | PostHookDescriptionWithAction<mDT> | PostGlobalActionHook<mDT> | PostAnyActionHook<mDT> | PostStandardTransitionHook<mDT> | PostMainTransitionHook<mDT> | PostForcedTransitionHook<mDT> | PostAnyTransitionHook<mDT> | PostEntryHook<mDT> | PostExitHook<mDT> | PreEverythingHook<mDT> | EverythingHook<mDT> | PrePostEverythingHook<mDT> | PostEverythingHook<mDT>;
609
+ /**
610
+ * Richer hook return value used when a hook needs to do more than just
611
+ * accept or veto a transition. `pass` is the required accept/veto flag
612
+ * (kept non-optional so that returning a stray object doesn't accidentally
613
+ * veto everything). The optional `state` overrides the destination state,
614
+ * `data` overrides the data observed by other hooks in the same chain,
615
+ * and `next_data` overrides the data committed after the transition.
616
+ */
381
617
  declare type HookComplexResult<mDT> = {
382
618
  pass: boolean;
383
619
  state?: StateType;
384
620
  data?: mDT;
385
621
  next_data?: mDT;
386
622
  };
387
- declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>; /** Documents whether a hook succeeded, either with a primitive or a reference to the hook complex object */
623
+ /**
624
+ * Return value from a {@link HookHandler}. May be a plain boolean to
625
+ * accept (`true`/`undefined`/`void`) or veto (`false`) the transition, or
626
+ * a {@link HookComplexResult} that additionally rewrites the next state
627
+ * and/or the next data payload.
628
+ */
629
+ declare type HookResult<mDT> = true | false | undefined | void | HookComplexResult<mDT>;
630
+ /**
631
+ * Context object passed to every {@link HookHandler}. `data` is the
632
+ * data payload as it stands before the transition, and `next_data` is
633
+ * the payload that will be committed if the transition is accepted —
634
+ * handlers may inspect or mutate the latter via a
635
+ * {@link HookComplexResult} return value.
636
+ */
388
637
  declare type HookContext<mDT> = {
389
638
  data: mDT;
390
639
  next_data: mDT;
391
640
  };
641
+ /**
642
+ * Context object passed to "everything" hooks ({@link EverythingHookHandler}
643
+ * and {@link PostEverythingHookHandler}). Extends the usual
644
+ * {@link HookContext} with `hook_name`, which identifies which specific
645
+ * hook fired so a single handler can route on it.
646
+ */
392
647
  declare type EverythingHookContext<mDT> = HookContext<mDT> & {
393
648
  hook_name: string;
394
649
  };
650
+ /**
651
+ * Signature of a pre-transition hook handler. Receives the current and
652
+ * proposed-next data payloads via a {@link HookContext} and returns a
653
+ * {@link HookResult}: a falsy result vetoes the transition, a truthy
654
+ * result allows it, and a {@link HookComplexResult} can additionally
655
+ * rewrite the next state or next data.
656
+ */
395
657
  declare type HookHandler<mDT> = (hook_context: HookContext<mDT>) => HookResult<mDT>;
658
+ /**
659
+ * Signature of a post-transition hook handler. Invoked after a successful
660
+ * transition has been committed; the return value is ignored (the
661
+ * transition cannot be undone).
662
+ */
396
663
  declare type PostHookHandler<mDT> = (hook_context: HookContext<mDT>) => void;
664
+ /**
665
+ * Signature of an "everything" pre-transition hook handler. Like
666
+ * {@link HookHandler} but receives an {@link EverythingHookContext} so the
667
+ * handler can dispatch on `hook_name`.
668
+ */
397
669
  declare type EverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => HookResult<mDT>;
670
+ /**
671
+ * Signature of an "everything" post-transition hook handler. Like
672
+ * {@link PostHookHandler} but receives an {@link EverythingHookContext}.
673
+ * The return value is ignored.
674
+ */
398
675
  declare type PostEverythingHookHandler<mDT> = (hook_context: EverythingHookContext<mDT>) => void;
676
+ /**
677
+ * Extra diagnostic information attached to a {@link JssmError} when it
678
+ * carries machine-relative context — most often the state name a caller
679
+ * asked about when the error was raised.
680
+ */
399
681
  declare type JssmErrorExtendedInfo = {
400
682
  requested_state?: StateType | undefined;
401
683
  };
684
+ /**
685
+ * Bounded history of recently-visited states paired with the data payload
686
+ * observed in each. Backed by `circular_buffer_js`, so the oldest entry
687
+ * is dropped silently once the configured capacity is exceeded.
688
+ */
402
689
  declare type JssmHistory<mDT> = circular_buffer<[StateType, mDT]>;
690
+ /**
691
+ * Pluggable random-number-generator function shape. Must return a value
692
+ * in `[0, 1)` exactly as `Math.random` does. Supplied via the
693
+ * `rng_seed`-aware machine configuration so that stochastic models can be
694
+ * made reproducible.
695
+ */
403
696
  declare type JssmRng = () => number;
404
697
  export { JssmColor, JssmShape, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmStateConfig, JssmStateStyleKey, JssmStateStyleKeyList, JssmBaseTheme, JssmTheme, JssmLayout, JssmHistory, JssmSerialization, JssmPropertyDefinition, JssmAllowsOverride, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirections, FslDirection, FslThemes, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult, EverythingHookContext, EverythingHookHandler, PostEverythingHookHandler, JssmRng };