jssm 5.65.4 → 5.65.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.
package/jssm.d.ts CHANGED
@@ -214,6 +214,21 @@ declare class Machine<mDT> {
214
214
  _any_transition_hook: HookHandler | undefined;
215
215
  constructor({ start_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name }: JssmGenericConfig<mDT>);
216
216
  _new_state(state_config: JssmGenericState): StateType;
217
+ /*********
218
+ *
219
+ * Get the current state of a machine.
220
+ *
221
+ * ```typescript
222
+ * import * as jssm from './jssm';
223
+ *
224
+ * const switch = jssm.from('on <=> off;');
225
+ * console.log( switch.state() ); // 'on'
226
+ *
227
+ * switch.transition('off');
228
+ * console.log( switch.state() ); // 'off'
229
+ * ```
230
+ *
231
+ */
217
232
  state(): StateType;
218
233
  state_is_final(whichState: StateType): boolean;
219
234
  is_final(): boolean;
@@ -232,8 +247,35 @@ declare class Machine<mDT> {
232
247
  state_declarations(): Map<StateType, JssmStateDeclaration>;
233
248
  fsl_version(): string;
234
249
  machine_state(): JssmMachineInternalState<mDT>;
250
+ /*********
251
+ *
252
+ * List all the states known by the machine. Please note that the order of
253
+ * these states is not guaranteed.
254
+ *
255
+ * ```typescript
256
+ * import * as jssm from './jssm';
257
+ *
258
+ * const switch = jssm.from('on <=> off;');
259
+ * console.log( switch.states() ); // ['on', 'off']
260
+ * ```
261
+ *
262
+ */
235
263
  states(): Array<StateType>;
236
264
  state_for(whichState: StateType): JssmGenericState;
265
+ /*********
266
+ *
267
+ * Check whether the machine knows a given state.
268
+ *
269
+ * ```typescript
270
+ * import * as jssm from './jssm';
271
+ *
272
+ * const switch = jssm.from('on <=> off;');
273
+
274
+ * console.log( switch.has_state('off') ); // true
275
+ * console.log( switch.has_state('dance') ); // false
276
+ * ```
277
+ *
278
+ */
237
279
  has_state(whichState: StateType): boolean;
238
280
  list_edges(): Array<JssmTransition<mDT>>;
239
281
  list_named_transitions(): Map<StateType, number>;
package/jssm_util.d.ts CHANGED
@@ -1,10 +1,52 @@
1
+ /*******
2
+ *
3
+ * Predicate for validating an array for uniqueness. Not generally meant for
4
+ * external use.
5
+ *
6
+ */
1
7
  declare function arr_uniq_p<T>(el: T, i: number, source: T[]): boolean;
2
8
  declare const array_box_if_string: (n: any) => any;
3
9
  declare const weighted_rand_select: Function;
4
- declare const seq: Function;
10
+ /*******
11
+ *
12
+ * Returns, for a non-negative integer argument `n`, the series `[0 .. n]`.
13
+ *
14
+ * ```typescript
15
+ * import { seq } from './jssm';
16
+ *
17
+ * seq(5); // [0, 1, 2, 3, 4]
18
+ * seq(0); // []
19
+ * ```
20
+ *
21
+ */
22
+ declare function seq(n: number): number[];
23
+ /*******
24
+ *
25
+ * Returns the histograph of an array as a `Map`. Makes no attempt to cope
26
+ * with deep equality; will fail for complex contents, as such.
27
+ *
28
+ * ```typescript
29
+ * import { histograph } from './jssm';
30
+ *
31
+ * histograph( [0, 0, 1, 1, 2, 2, 1] ); // Map()
32
+ * ```
33
+ *
34
+ */
5
35
  declare const histograph: Function;
6
36
  declare const weighted_sample_select: Function;
7
37
  declare const weighted_histo_key: Function;
38
+ /*******
39
+ *
40
+ * Internal method generating names for edges for the hook lookup map. Not
41
+ * meant for external use.
42
+ *
43
+ */
8
44
  declare const hook_name: (from: string, to: string) => string;
45
+ /*******
46
+ *
47
+ * Internal method generating names for actions for the hook lookup map. Not
48
+ * meant for external use.
49
+ *
50
+ */
9
51
  declare const named_hook_name: (from: string, to: string, action: string) => string;
10
52
  export { seq, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, hook_name, named_hook_name };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jssm",
3
- "version": "5.65.4",
3
+ "version": "5.65.8",
4
4
  "engines": {
5
5
  "node": ">=10.0.0"
6
6
  },
@@ -52,7 +52,7 @@
52
52
  "min_iife": "mv dist/jssm.es5.iife.js dist/jssm.es5.iife.nonmin.js && terser dist/jssm.es5.iife.nonmin.js > dist/jssm.es5.iife.js",
53
53
  "min_cjs": "mv dist/jssm.es5.cjs.js dist/jssm.es5.cjs.nonmin.js && terser dist/jssm.es5.cjs.nonmin.js > dist/jssm.es5.cjs.js",
54
54
  "site": "cp src/site/* docs/",
55
- "docs": "typedoc src/ts/jssm.ts --out docs/docs",
55
+ "docs": "typedoc src/ts/jssm.ts --out docs/docs --customCss ./src/site/typedoc-addon.css",
56
56
  "changelog": "rm -f CHANGELOG.md && changelog-maker -a > CHANGELOG.md"
57
57
  },
58
58
  "repository": {