jssm 5.80.1 → 5.82.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.
- package/CHANGELOG.md +38 -45
- package/README.md +2 -2
- package/dist/es6/jssm-dot.js +1 -1
- package/dist/es6/jssm.d.ts +34 -18
- package/dist/es6/jssm.js +121 -55
- package/dist/es6/jssm_types.d.ts +27 -3
- package/dist/es6/{jssm_base_stylesheet.d.ts → themes/jssm_base_stylesheet.d.ts} +3 -2
- package/dist/es6/{jssm_base_stylesheet.js → themes/jssm_base_stylesheet.js} +25 -1
- package/dist/es6/themes/jssm_theme_default.d.ts +11 -0
- package/dist/es6/themes/jssm_theme_default.js +57 -0
- package/dist/es6/themes/jssm_theme_modern.d.ts +11 -0
- package/dist/es6/themes/jssm_theme_modern.js +57 -0
- package/{jssm_base_stylesheet.d.ts → dist/es6/themes/jssm_theme_ocean.d.ts} +3 -2
- package/dist/es6/themes/jssm_theme_ocean.js +55 -0
- package/dist/es6/version.js +1 -1
- package/dist/jssm.es5.cjs.js +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/jssm.d.ts +34 -18
- package/jssm_types.d.ts +27 -3
- package/package.json +1 -1
package/jssm.d.ts
CHANGED
|
@@ -94,7 +94,7 @@ declare function arrow_right_kind(arrow: JssmArrow): JssmArrowKind;
|
|
|
94
94
|
* ```typescript
|
|
95
95
|
* import { sm } from 'jssm';
|
|
96
96
|
*
|
|
97
|
-
* const
|
|
97
|
+
* const lswitch = sm`on <=> off;`;
|
|
98
98
|
* ```
|
|
99
99
|
*
|
|
100
100
|
* Method {@link from}:
|
|
@@ -149,7 +149,7 @@ declare function wrap_parse(input: string, options?: Object): any;
|
|
|
149
149
|
* ```typescript
|
|
150
150
|
* import { sm } from 'jssm';
|
|
151
151
|
*
|
|
152
|
-
* const
|
|
152
|
+
* const lswitch = sm`on <=> off;`;
|
|
153
153
|
* ```
|
|
154
154
|
*
|
|
155
155
|
* Method {@link from}:
|
|
@@ -218,7 +218,7 @@ declare class Machine<mDT> {
|
|
|
218
218
|
_arrange_declaration: Array<Array<StateType>>;
|
|
219
219
|
_arrange_start_declaration: Array<Array<StateType>>;
|
|
220
220
|
_arrange_end_declaration: Array<Array<StateType>>;
|
|
221
|
-
|
|
221
|
+
_themes: FslTheme[];
|
|
222
222
|
_flow: FslDirection;
|
|
223
223
|
_has_hooks: boolean;
|
|
224
224
|
_has_basic_hooks: boolean;
|
|
@@ -266,6 +266,7 @@ declare class Machine<mDT> {
|
|
|
266
266
|
_terminal_state_style: JssmStateConfig;
|
|
267
267
|
_start_state_style: JssmStateConfig;
|
|
268
268
|
_end_state_style: JssmStateConfig;
|
|
269
|
+
_state_labels: Map<string, string>;
|
|
269
270
|
constructor({ start_states, end_states, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, state_declaration, property_definition, state_property, fsl_version, dot_preamble, arrange_declaration, arrange_start_declaration, arrange_end_declaration, theme, flow, graph_layout, instance_name, history, data, default_state_config, default_active_state_config, default_hooked_state_config, default_terminal_state_config, default_start_state_config, default_end_state_config }: JssmGenericConfig<mDT>);
|
|
270
271
|
/********
|
|
271
272
|
*
|
|
@@ -282,17 +283,32 @@ declare class Machine<mDT> {
|
|
|
282
283
|
* ```typescript
|
|
283
284
|
* import * as jssm from 'jssm';
|
|
284
285
|
*
|
|
285
|
-
* const
|
|
286
|
-
* console.log(
|
|
286
|
+
* const lswitch = jssm.from('on <=> off;');
|
|
287
|
+
* console.log( lswitch.state() ); // 'on'
|
|
287
288
|
*
|
|
288
|
-
*
|
|
289
|
-
* console.log(
|
|
289
|
+
* lswitch.transition('off');
|
|
290
|
+
* console.log( lswitch.state() ); // 'off'
|
|
290
291
|
* ```
|
|
291
292
|
*
|
|
292
293
|
* @typeparam mDT The type of the machine data member; usually omitted
|
|
293
294
|
*
|
|
294
295
|
*/
|
|
295
296
|
state(): StateType;
|
|
297
|
+
/*********
|
|
298
|
+
*
|
|
299
|
+
* Get the label for a given state, if any; return `undefined` otherwise.
|
|
300
|
+
*
|
|
301
|
+
* ```typescript
|
|
302
|
+
* import * as jssm from 'jssm';
|
|
303
|
+
*
|
|
304
|
+
* const lswitch = jssm.from('a -> b; state a: { label: "Foo!"; };');
|
|
305
|
+
* console.log( lswitch.label_for('a') ); // 'Foo!'
|
|
306
|
+
* ```
|
|
307
|
+
*
|
|
308
|
+
* @typeparam mDT The type of the machine data member; usually omitted
|
|
309
|
+
*
|
|
310
|
+
*/
|
|
311
|
+
label_for(state: StateType): string;
|
|
296
312
|
/*********
|
|
297
313
|
*
|
|
298
314
|
* Get the current data of a machine.
|
|
@@ -300,8 +316,8 @@ declare class Machine<mDT> {
|
|
|
300
316
|
* ```typescript
|
|
301
317
|
* import * as jssm from 'jssm';
|
|
302
318
|
*
|
|
303
|
-
* const
|
|
304
|
-
* console.log(
|
|
319
|
+
* const lswitch = jssm.from('on <=> off;', {data: 1});
|
|
320
|
+
* console.log( lswitch.data() ); // 1
|
|
305
321
|
* ```
|
|
306
322
|
*
|
|
307
323
|
* @typeparam mDT The type of the machine data member; usually omitted
|
|
@@ -545,8 +561,8 @@ declare class Machine<mDT> {
|
|
|
545
561
|
* ```typescript
|
|
546
562
|
* import * as jssm from 'jssm';
|
|
547
563
|
*
|
|
548
|
-
* const
|
|
549
|
-
* console.log(
|
|
564
|
+
* const lswitch = jssm.from('on <=> off;');
|
|
565
|
+
* console.log( lswitch.states() ); // ['on', 'off']
|
|
550
566
|
* ```
|
|
551
567
|
*
|
|
552
568
|
* @typeparam mDT The type of the machine data member; usually omitted
|
|
@@ -561,10 +577,10 @@ declare class Machine<mDT> {
|
|
|
561
577
|
* ```typescript
|
|
562
578
|
* import * as jssm from 'jssm';
|
|
563
579
|
*
|
|
564
|
-
* const
|
|
580
|
+
* const lswitch = jssm.from('on <=> off;');
|
|
565
581
|
*
|
|
566
|
-
* console.log(
|
|
567
|
-
* console.log(
|
|
582
|
+
* console.log( lswitch.has_state('off') ); // true
|
|
583
|
+
* console.log( lswitch.has_state('dance') ); // false
|
|
568
584
|
* ```
|
|
569
585
|
*
|
|
570
586
|
* @typeparam mDT The type of the machine data member; usually omitted
|
|
@@ -609,7 +625,7 @@ declare class Machine<mDT> {
|
|
|
609
625
|
list_edges(): Array<JssmTransition<mDT>>;
|
|
610
626
|
list_named_transitions(): Map<StateType, number>;
|
|
611
627
|
list_actions(): Array<StateType>;
|
|
612
|
-
|
|
628
|
+
themes(): FslTheme[];
|
|
613
629
|
flow(): FslDirection;
|
|
614
630
|
get_transition_by_state_names(from: StateType, to: StateType): number;
|
|
615
631
|
lookup_transition_for(from: StateType, to: StateType): JssmTransition<mDT>;
|
|
@@ -1054,7 +1070,7 @@ declare class Machine<mDT> {
|
|
|
1054
1070
|
* ```
|
|
1055
1071
|
*
|
|
1056
1072
|
* @typeparam mDT The type of the machine data member; usually omitted
|
|
1057
|
-
|
|
1073
|
+
*
|
|
1058
1074
|
* @param actionName The action to engage
|
|
1059
1075
|
*
|
|
1060
1076
|
* @param newData The data change to insert during the action
|
|
@@ -1155,7 +1171,7 @@ declare class Machine<mDT> {
|
|
|
1155
1171
|
* ```typescript
|
|
1156
1172
|
* import * as jssm from 'jssm';
|
|
1157
1173
|
*
|
|
1158
|
-
* const
|
|
1174
|
+
* const lswitch = jssm.from('on <=> off;');
|
|
1159
1175
|
* ```
|
|
1160
1176
|
*
|
|
1161
1177
|
* @typeparam mDT The type of the machine data member; usually omitted
|
|
@@ -1178,7 +1194,7 @@ declare function sm<mDT>(template_strings: TemplateStringsArray, ...remainder: a
|
|
|
1178
1194
|
* ```typescript
|
|
1179
1195
|
* import * as jssm from 'jssm';
|
|
1180
1196
|
*
|
|
1181
|
-
* const
|
|
1197
|
+
* const lswitch = jssm.from('on <=> off;');
|
|
1182
1198
|
* ```
|
|
1183
1199
|
*
|
|
1184
1200
|
* @typeparam mDT The type of the machine data member; usually omitted
|
package/jssm_types.d.ts
CHANGED
|
@@ -106,6 +106,7 @@ declare type JssmStateDeclaration = {
|
|
|
106
106
|
color?: JssmColor;
|
|
107
107
|
corners?: JssmCorner;
|
|
108
108
|
lineStyle?: JssmLineStyle;
|
|
109
|
+
stateLabel?: string;
|
|
109
110
|
textColor?: JssmColor;
|
|
110
111
|
backgroundColor?: JssmColor;
|
|
111
112
|
borderColor?: JssmColor;
|
|
@@ -136,6 +137,10 @@ declare type JssmStateStyleLineStyle = {
|
|
|
136
137
|
key: 'line-style';
|
|
137
138
|
value: JssmLineStyle;
|
|
138
139
|
};
|
|
140
|
+
declare type JssmStateStyleStateLabel = {
|
|
141
|
+
key: 'state-label';
|
|
142
|
+
value: string;
|
|
143
|
+
};
|
|
139
144
|
declare type JssmStateStyleBackgroundColor = {
|
|
140
145
|
key: 'background-color';
|
|
141
146
|
value: JssmColor;
|
|
@@ -144,13 +149,32 @@ declare type JssmStateStyleBorderColor = {
|
|
|
144
149
|
key: 'border-color';
|
|
145
150
|
value: JssmColor;
|
|
146
151
|
};
|
|
147
|
-
declare type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleBorderColor;
|
|
152
|
+
declare type JssmStateStyleKey = JssmStateStyleShape | JssmStateStyleColor | JssmStateStyleTextColor | JssmStateStyleCorners | JssmStateStyleLineStyle | JssmStateStyleBackgroundColor | JssmStateStyleStateLabel | JssmStateStyleBorderColor;
|
|
148
153
|
declare type JssmStateStyleKeyList = JssmStateStyleKey[];
|
|
154
|
+
declare type JssmBaseTheme = {
|
|
155
|
+
state: JssmStateConfig;
|
|
156
|
+
hooked: JssmStateConfig;
|
|
157
|
+
start: JssmStateConfig;
|
|
158
|
+
end: JssmStateConfig;
|
|
159
|
+
terminal: JssmStateConfig;
|
|
160
|
+
active: JssmStateConfig;
|
|
161
|
+
active_hooked: JssmStateConfig;
|
|
162
|
+
active_start: JssmStateConfig;
|
|
163
|
+
active_end: JssmStateConfig;
|
|
164
|
+
active_terminal: JssmStateConfig;
|
|
165
|
+
graph: undefined;
|
|
166
|
+
legal: undefined;
|
|
167
|
+
main: undefined;
|
|
168
|
+
forced: undefined;
|
|
169
|
+
action: undefined;
|
|
170
|
+
title: undefined;
|
|
171
|
+
};
|
|
172
|
+
declare type JssmTheme = Partial<JssmBaseTheme>;
|
|
149
173
|
declare type JssmGenericConfig<DataType> = {
|
|
150
174
|
graph_layout?: JssmLayout;
|
|
151
175
|
complete?: Array<StateType>;
|
|
152
176
|
transitions: JssmTransitions<DataType>;
|
|
153
|
-
theme?: FslTheme;
|
|
177
|
+
theme?: FslTheme[];
|
|
154
178
|
flow?: FslDirection;
|
|
155
179
|
name?: string;
|
|
156
180
|
data?: DataType;
|
|
@@ -327,4 +351,4 @@ declare type JssmErrorExtendedInfo = {
|
|
|
327
351
|
requested_state?: StateType | undefined;
|
|
328
352
|
};
|
|
329
353
|
declare type JssmHistory<mDT> = circular_buffer<[StateType, mDT]>;
|
|
330
|
-
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, JssmLayout, JssmHistory, JssmSerialization, JssmPropertyDefinition, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
|
|
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 };
|