jssm 5.82.0 → 5.82.1

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/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- 1037 merges; 148 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
5
+ 1038 merges; 148 releases; Changlogging the last 10 commits; Full changelog at [CHANGELOG.long.md](CHANGELOG.long.md)
6
6
 
7
7
 
8
8
 
@@ -18,6 +18,21 @@ Published tags:
18
18
 
19
19
 
20
20
 
21
+  
22
+
23
+  
24
+
25
+ ## [Untagged] - 8/19/2022 11:04:20 PM
26
+
27
+ Commit [88d7309bfd2217fe9aeae3be681ae1f520542365](https://github.com/StoneCypher/jssm/commit/88d7309bfd2217fe9aeae3be681ae1f520542365)
28
+
29
+ Author: `John Haugeland <stonecypher@gmail.com>`
30
+
31
+ * Multiple themes, fixes StoneCypher/fsl#128
32
+
33
+
34
+
35
+
21
36
  &nbsp;
22
37
 
23
38
  &nbsp;
@@ -155,19 +170,4 @@ Author: `John Haugeland <stonecypher@gmail.com>`
155
170
  Merges [6cb2816, b59b5b5]
156
171
 
157
172
  * Merge pull request #527 from StoneCypher/AddInlineStylesToResolver
158
- * Adds inline styles to resolver, fixes StoneCypher/fsl#1160
159
-
160
-
161
-
162
-
163
- &nbsp;
164
-
165
- &nbsp;
166
-
167
- ## [Untagged] - 8/7/2022 11:52:57 PM
168
-
169
- Commit [b59b5b530de566d82b6fa707d66f9b5ceb2037e8](https://github.com/StoneCypher/jssm/commit/b59b5b530de566d82b6fa707d66f9b5ceb2037e8)
170
-
171
- Author: `John Haugeland <stonecypher@gmail.com>`
172
-
173
173
  * Adds inline styles to resolver, fixes StoneCypher/fsl#1160
package/README.md CHANGED
@@ -18,7 +18,7 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
18
18
 
19
19
 
20
20
 
21
- * Generated for version 5.82.0 at 8/19/2022, 11:01:13 PM
21
+ * Generated for version 5.82.1 at 8/20/2022, 11:14:58 AM
22
22
 
23
23
  -->
24
24
  # jssm
@@ -29,7 +29,7 @@ share online. Easy to embed.
29
29
 
30
30
  Readable, useful state machines as one-liner strings.
31
31
 
32
- ***4,837 tests*** run 5,728 times. 4,828 specs with 100.0% coverage, 9 fuzz tests with 5.4% coverage. With 2,511 lines, that's about 1.9 tests per line, or 2.3 generated tests per line.
32
+ ***4,840 tests*** run 5,731 times. 4,831 specs with 100.0% coverage, 9 fuzz tests with 5.4% coverage. With 2,612 lines, that's about 1.9 tests per line, or 2.2 generated tests per line.
33
33
 
34
34
  ***Meet your new state machine library.***
35
35
 
@@ -1,6 +1,6 @@
1
1
  declare type StateType = string;
2
2
  import { JssmGenericState, JssmGenericConfig, JssmStateConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
3
- JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmStateStyleKeyList, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
3
+ JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmStateStyleKeyList, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslDirections, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
4
4
  import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
5
5
  import * as constants from './jssm_constants';
6
6
  declare const shapes: string[], gviz_shapes: string[], named_colors: string[];
@@ -625,7 +625,9 @@ declare class Machine<mDT> {
625
625
  list_edges(): Array<JssmTransition<mDT>>;
626
626
  list_named_transitions(): Map<StateType, number>;
627
627
  list_actions(): Array<StateType>;
628
- themes(): FslTheme[];
628
+ all_themes(): FslTheme[];
629
+ get themes(): FslTheme[];
630
+ set themes(to: FslTheme | FslTheme[]);
629
631
  flow(): FslDirection;
630
632
  get_transition_by_state_names(from: StateType, to: StateType): number;
631
633
  lookup_transition_for(from: StateType, to: StateType): JssmTransition<mDT>;
@@ -1209,4 +1211,4 @@ declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResu
1209
1211
  declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean;
1210
1212
  declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefined, hook_args: HookContext<mDT>): HookComplexResult<mDT>;
1211
1213
  declare function deserialize<mDT>(machine_string: string, ser: JssmSerialization<mDT>): Machine<mDT>;
1212
- export { version, transfer_state_properties, Machine, deserialize, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind, seq, unique, find_repeated, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, constants, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step, state_style_condense };
1214
+ export { version, transfer_state_properties, Machine, deserialize, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind, seq, unique, find_repeated, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, constants, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step, state_style_condense, FslDirections };
package/dist/es6/jssm.js CHANGED
@@ -1,14 +1,17 @@
1
1
  // whargarbl lots of these return arrays could/should be sets
2
2
  import { reduce as reduce_to_639 } from 'reduce-to-639-1';
3
3
  import { circular_buffer } from 'circular_buffer_js';
4
+ import { FslDirections } from './jssm_types';
4
5
  import { base_theme } from './themes/jssm_base_stylesheet';
5
6
  import { default_theme } from './themes/jssm_theme_default';
6
7
  import { modern_theme } from './themes/jssm_theme_modern';
7
8
  import { ocean_theme } from './themes/jssm_theme_ocean';
9
+ import { plain_theme } from './themes/jssm_theme_plain';
8
10
  const theme_mapping = new Map();
9
11
  theme_mapping.set('default', default_theme);
10
12
  theme_mapping.set('modern', modern_theme);
11
13
  theme_mapping.set('ocean', ocean_theme);
14
+ theme_mapping.set('plain', plain_theme);
12
15
  import { seq, unique, find_repeated, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key, array_box_if_string, name_bind_prop_and_state, hook_name, named_hook_name } from './jssm_util';
13
16
  import * as constants from './jssm_constants';
14
17
  const { shapes, gviz_shapes, named_colors } = constants;
@@ -1387,9 +1390,20 @@ class Machine {
1387
1390
  list_actions() {
1388
1391
  return Array.from(this._actions.keys());
1389
1392
  }
1390
- themes() {
1393
+ all_themes() {
1394
+ return [...theme_mapping.keys()]; // constructor sets this to "default" otherwise
1395
+ }
1396
+ get themes() {
1391
1397
  return this._themes; // constructor sets this to "default" otherwise
1392
1398
  }
1399
+ set themes(to) {
1400
+ if (typeof to === 'string') {
1401
+ this._themes = [to];
1402
+ }
1403
+ else {
1404
+ this._themes = to;
1405
+ }
1406
+ }
1393
1407
  flow() {
1394
1408
  return this._flow;
1395
1409
  }
@@ -2713,4 +2727,6 @@ function deserialize(machine_string, ser) {
2713
2727
  }
2714
2728
  export { version, transfer_state_properties, Machine, deserialize, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind,
2715
2729
  // WHARGARBL TODO these should be exported to a utility library
2716
- seq, unique, find_repeated, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, constants, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step, state_style_condense };
2730
+ seq, unique, find_repeated, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, constants, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step, state_style_condense, FslDirections
2731
+ // FslThemes
2732
+ };
@@ -24,8 +24,10 @@ declare type JssmArrowKind = 'none' | 'legal' | 'main' | 'forced';
24
24
  declare type JssmLayout = 'dot' | 'circo' | 'twopi' | 'fdp';
25
25
  declare type JssmCorner = 'regular' | 'rounded' | 'lined';
26
26
  declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
27
- declare type FslDirection = 'up' | 'right' | 'down' | 'left';
28
- declare type FslTheme = 'default' | 'ocean' | 'modern' | 'none';
27
+ declare const FslDirections: readonly ["up", "right", "down", "left"];
28
+ declare type FslDirection = typeof FslDirections[number];
29
+ declare const FslThemes: readonly ["default", "ocean", "modern", "plain"];
30
+ declare type FslTheme = typeof FslThemes[number];
29
31
  declare type JssmSerialization<DataType> = {
30
32
  jssm_version: string;
31
33
  timestamp: number;
@@ -351,4 +353,4 @@ declare type JssmErrorExtendedInfo = {
351
353
  requested_state?: StateType | undefined;
352
354
  };
353
355
  declare type JssmHistory<mDT> = circular_buffer<[StateType, mDT]>;
354
- 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, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
356
+ 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, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirections, FslDirection, FslThemes, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
@@ -1 +1,3 @@
1
- export {};
1
+ const FslDirections = ['up', 'right', 'down', 'left'];
2
+ const FslThemes = ['default', 'ocean', 'modern', 'plain'];
3
+ export { FslDirections, FslThemes };
@@ -0,0 +1,11 @@
1
+ import { JssmStateConfig, JssmBaseTheme } from '../jssm_types';
2
+ declare const base_state_style: JssmStateConfig;
3
+ declare const base_active_state_style: JssmStateConfig;
4
+ declare const base_terminal_state_style: JssmStateConfig;
5
+ declare const base_active_terminal_state_style: JssmStateConfig;
6
+ declare const base_start_state_style: JssmStateConfig;
7
+ declare const base_active_start_state_style: JssmStateConfig;
8
+ declare const base_end_state_style: JssmStateConfig;
9
+ declare const base_active_end_state_style: JssmStateConfig;
10
+ declare const plain_theme: JssmBaseTheme;
11
+ export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, plain_theme, plain_theme as theme };
@@ -0,0 +1,69 @@
1
+ const base_state_style = {
2
+ textColor: 'black',
3
+ backgroundColor: 'transparent',
4
+ shape: 'plaintext'
5
+ };
6
+ const base_active_state_style = {
7
+ textColor: 'black',
8
+ backgroundColor: 'transparent',
9
+ shape: 'plaintext'
10
+ };
11
+ const base_hooked_state_style = {
12
+ textColor: 'black',
13
+ backgroundColor: 'transparent',
14
+ shape: 'plaintext'
15
+ };
16
+ const base_terminal_state_style = {
17
+ textColor: 'black',
18
+ backgroundColor: 'transparent',
19
+ shape: 'plaintext'
20
+ };
21
+ const base_active_terminal_state_style = {
22
+ textColor: 'black',
23
+ backgroundColor: 'transparent',
24
+ shape: 'plaintext'
25
+ };
26
+ const base_start_state_style = {
27
+ textColor: 'black',
28
+ backgroundColor: 'transparent',
29
+ shape: 'plaintext'
30
+ };
31
+ const base_active_start_state_style = {
32
+ textColor: 'black',
33
+ backgroundColor: 'transparent',
34
+ shape: 'plaintext'
35
+ };
36
+ const base_active_hooked_state_style = {
37
+ textColor: 'black',
38
+ backgroundColor: 'transparent',
39
+ shape: 'plaintext'
40
+ };
41
+ const base_end_state_style = {
42
+ textColor: 'black',
43
+ backgroundColor: 'transparent',
44
+ shape: 'plaintext'
45
+ };
46
+ const base_active_end_state_style = {
47
+ textColor: 'black',
48
+ backgroundColor: 'transparent',
49
+ shape: 'plaintext'
50
+ };
51
+ const plain_theme = {
52
+ state: base_state_style,
53
+ start: base_start_state_style,
54
+ end: base_end_state_style,
55
+ terminal: base_terminal_state_style,
56
+ hooked: base_hooked_state_style,
57
+ active: base_active_state_style,
58
+ active_start: base_active_start_state_style,
59
+ active_end: base_active_end_state_style,
60
+ active_terminal: base_active_terminal_state_style,
61
+ active_hooked: base_active_hooked_state_style,
62
+ legal: undefined,
63
+ main: undefined,
64
+ forced: undefined,
65
+ action: undefined,
66
+ graph: undefined,
67
+ title: undefined // TODO FIXME
68
+ };
69
+ export { base_state_style, base_active_state_style, base_terminal_state_style, base_active_terminal_state_style, base_start_state_style, base_active_start_state_style, base_end_state_style, base_active_end_state_style, plain_theme, plain_theme as theme };
@@ -1,2 +1,2 @@
1
- const version = "5.82.0";
1
+ const version = "5.82.1";
2
2
  export { version };