jssm 5.77.1 → 5.78.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 +47 -42
- package/README.md +2 -2
- package/dist/es6/jssm.d.ts +14 -5
- package/dist/es6/jssm.js +28 -3
- package/dist/es6/jssm_types.d.ts +12 -1
- 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 +14 -5
- package/jssm_types.d.ts +12 -1
- package/package.json +1 -1
package/jssm.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
declare type StateType = string;
|
|
2
|
-
import { circular_buffer } from 'circular_buffer_js';
|
|
3
2
|
import { JssmGenericState, JssmGenericConfig, JssmTransition, JssmTransitionList, // JssmTransitionRule,
|
|
4
|
-
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
|
|
3
|
+
JssmMachineInternalState, JssmParseTree, JssmStateDeclaration, JssmArrow, JssmArrowDirection, JssmArrowKind, JssmLayout, JssmHistory, JssmSerialization, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult } from './jssm_types';
|
|
5
4
|
import { seq, weighted_rand_select, weighted_sample_select, histograph, weighted_histo_key } from './jssm_util';
|
|
6
5
|
import { shapes, gviz_shapes, named_colors } from './jssm_constants';
|
|
7
6
|
import { version } from './version';
|
|
@@ -251,7 +250,7 @@ declare class Machine<mDT> {
|
|
|
251
250
|
_post_main_transition_hook: HookHandler<mDT> | undefined;
|
|
252
251
|
_post_forced_transition_hook: HookHandler<mDT> | undefined;
|
|
253
252
|
_post_any_transition_hook: HookHandler<mDT> | undefined;
|
|
254
|
-
_history:
|
|
253
|
+
_history: JssmHistory<mDT>;
|
|
255
254
|
_history_length: number;
|
|
256
255
|
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, history, data }: JssmGenericConfig<mDT>);
|
|
257
256
|
/********
|
|
@@ -330,10 +329,19 @@ declare class Machine<mDT> {
|
|
|
330
329
|
* console.log( final_test.is_final() ); // true
|
|
331
330
|
* ```
|
|
332
331
|
*
|
|
332
|
+
*/
|
|
333
|
+
is_final(): boolean;
|
|
334
|
+
/********
|
|
335
|
+
*
|
|
336
|
+
* Serialize the current machine, including all defining state but not the
|
|
337
|
+
* machine string, to a structure. This means you will need the machine
|
|
338
|
+
* string to recreate (to not waste repeated space;) if you want the machine
|
|
339
|
+
* string embedded, call {@link serialize_with_string} instead.
|
|
340
|
+
*
|
|
333
341
|
* @typeparam mDT The type of the machine data member; usually omitted
|
|
334
342
|
*
|
|
335
343
|
*/
|
|
336
|
-
|
|
344
|
+
serialize(comment?: string | undefined): JssmSerialization<mDT>;
|
|
337
345
|
graph_layout(): string;
|
|
338
346
|
dot_preamble(): string;
|
|
339
347
|
machine_author(): Array<string>;
|
|
@@ -824,4 +832,5 @@ declare function from<mDT>(MachineAsString: string, ExtraConstructorFields?: Par
|
|
|
824
832
|
declare function is_hook_complex_result<mDT>(hr: unknown): hr is HookComplexResult<mDT>;
|
|
825
833
|
declare function is_hook_rejection<mDT>(hr: HookResult<mDT>): boolean;
|
|
826
834
|
declare function abstract_hook_step<mDT>(maybe_hook: HookHandler<mDT> | undefined, hook_args: HookContext<mDT>): HookComplexResult<mDT>;
|
|
827
|
-
|
|
835
|
+
declare function deserialize<mDT>(machine_string: string, ser: JssmSerialization<mDT>): Machine<mDT>;
|
|
836
|
+
export { version, transfer_state_properties, Machine, deserialize, make, wrap_parse as parse, compile, sm, from, arrow_direction, arrow_left_kind, arrow_right_kind, seq, weighted_rand_select, histograph, weighted_sample_select, weighted_histo_key, shapes, gviz_shapes, named_colors, is_hook_rejection, is_hook_complex_result, abstract_hook_step };
|
package/jssm_types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { circular_buffer } from 'circular_buffer_js';
|
|
1
2
|
declare type StateType = string;
|
|
2
3
|
declare type JssmSuccess = {
|
|
3
4
|
success: true;
|
|
@@ -25,6 +26,15 @@ declare type JssmCorner = 'regular' | 'rounded' | 'lined';
|
|
|
25
26
|
declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
26
27
|
declare type FslDirection = 'up' | 'right' | 'down' | 'left';
|
|
27
28
|
declare type FslTheme = 'default' | 'ocean' | 'modern' | 'none';
|
|
29
|
+
declare type JssmSerialization<DataType> = {
|
|
30
|
+
jssm_version: string;
|
|
31
|
+
timestamp: number;
|
|
32
|
+
comment?: string | undefined;
|
|
33
|
+
state: StateType;
|
|
34
|
+
history: [string, DataType][];
|
|
35
|
+
history_capacity: number;
|
|
36
|
+
data: DataType;
|
|
37
|
+
};
|
|
28
38
|
declare type JssmTransitionPermitter<DataType> = (OldState: StateType, NewState: StateType, OldData: DataType, NewData: DataType) => boolean;
|
|
29
39
|
declare type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataType> | Array<JssmTransitionPermitter<DataType>>;
|
|
30
40
|
declare type JssmTransition<DataType> = {
|
|
@@ -264,4 +274,5 @@ declare type PostHookHandler<mDT> = (hook_context: HookContext<mDT>) => void;
|
|
|
264
274
|
declare type JssmErrorExtendedInfo = {
|
|
265
275
|
requested_state?: StateType | undefined;
|
|
266
276
|
};
|
|
267
|
-
|
|
277
|
+
declare type JssmHistory<mDT> = circular_buffer<[StateType, mDT]>;
|
|
278
|
+
export { JssmColor, JssmShape, JssmTransition, JssmTransitions, JssmTransitionList, JssmTransitionRule, JssmArrow, JssmArrowKind, JssmArrowDirection, JssmGenericConfig, JssmGenericState, JssmGenericMachine, JssmParseTree, JssmCompileSe, JssmCompileSeStart, JssmCompileRule, JssmPermitted, JssmPermittedOpt, JssmResult, JssmStateDeclaration, JssmStateDeclarationRule, JssmLayout, JssmHistory, JssmSerialization, JssmParseFunctionType, JssmMachineInternalState, JssmErrorExtendedInfo, FslDirection, FslTheme, HookDescription, HookHandler, HookContext, HookResult, HookComplexResult };
|