jssm 5.142.2 → 5.142.4
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/README.md +7 -7
- package/dist/cdn/instance.js +680 -226
- package/dist/cdn/viz.js +680 -226
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/deno/README.md +7 -7
- package/dist/deno/jssm.d.ts +30 -22
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_types.d.ts +27 -2
- package/dist/jssm.es5.cjs +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/dist/jssm.es6.mjs +1 -1
- package/dist/jssm_viz.cjs +1 -1
- package/dist/jssm_viz.iife.cjs +1 -1
- package/dist/jssm_viz.mjs +1 -1
- package/jssm.es5.d.cts +55 -22
- package/jssm.es6.d.ts +55 -22
- package/jssm_viz.es5.d.cts +55 -22
- package/jssm_viz.es6.d.ts +55 -22
- package/package.json +1 -1
package/jssm.es5.d.cts
CHANGED
|
@@ -51,6 +51,30 @@ declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
|
51
51
|
* the decision to the surrounding configuration's default.
|
|
52
52
|
*/
|
|
53
53
|
declare type JssmAllowsOverride = true | false | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Controls whether the state graph may contain disconnected components
|
|
56
|
+
* (islands). `true` permits islands (default), `false` requires a single
|
|
57
|
+
* connected component, and `'with_start'` permits islands only when every
|
|
58
|
+
* component contains at least one start state.
|
|
59
|
+
*/
|
|
60
|
+
declare type JssmAllowIslands = true | false | 'with_start';
|
|
61
|
+
/**
|
|
62
|
+
* Structured render-size hint for a machine visualization, set by the FSL
|
|
63
|
+
* `default_size` directive. All three forms are optional in the sense that
|
|
64
|
+
* only one or two fields will be present depending on the form used:
|
|
65
|
+
*
|
|
66
|
+
* - `{ width }` — single-number form (`default_size: 800;`)
|
|
67
|
+
* - `{ width, height }` — bounding-box form (`default_size: 800 600;`)
|
|
68
|
+
* - `{ height }` — height-only form (`default_size: height 600;`)
|
|
69
|
+
*
|
|
70
|
+
* This is a *hint*, not a hard constraint. Renderers may ignore it.
|
|
71
|
+
*
|
|
72
|
+
* @see Machine.default_size
|
|
73
|
+
*/
|
|
74
|
+
declare type JssmDefaultSize = {
|
|
75
|
+
width?: number;
|
|
76
|
+
height?: number;
|
|
77
|
+
};
|
|
54
78
|
/**
|
|
55
79
|
* Runtime-iterable list of valid `flow` directions for FSL diagrams.
|
|
56
80
|
* Use this when you need to enumerate directions; for the type itself
|
|
@@ -284,7 +308,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
284
308
|
history?: number;
|
|
285
309
|
min_exits?: number;
|
|
286
310
|
max_exits?: number;
|
|
287
|
-
allow_islands?:
|
|
311
|
+
allow_islands?: JssmAllowIslands;
|
|
288
312
|
allow_force?: false;
|
|
289
313
|
actions?: JssmPermittedOpt;
|
|
290
314
|
simplify_bidi?: boolean;
|
|
@@ -311,6 +335,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
311
335
|
machine_name?: string;
|
|
312
336
|
machine_version?: string;
|
|
313
337
|
npm_name?: string;
|
|
338
|
+
default_size?: JssmDefaultSize;
|
|
314
339
|
fsl_version?: string;
|
|
315
340
|
auto_api?: boolean | string;
|
|
316
341
|
instance_name?: string | undefined;
|
|
@@ -1390,26 +1415,6 @@ declare function transfer_state_properties(state_decl: JssmStateDeclaration): Js
|
|
|
1390
1415
|
*
|
|
1391
1416
|
*/
|
|
1392
1417
|
declare function state_style_condense(jssk: JssmStateStyleKeyList, machine?: any): JssmStateConfig;
|
|
1393
|
-
/*******
|
|
1394
|
-
*
|
|
1395
|
-
* Core finite state machine class. Holds the full graph of states and
|
|
1396
|
-
* transitions, the current state, hooks, data, properties, and all runtime
|
|
1397
|
-
* behavior. Typically created via the {@link sm} tagged template literal
|
|
1398
|
-
* rather than constructed directly.
|
|
1399
|
-
*
|
|
1400
|
-
* ```typescript
|
|
1401
|
-
* import { sm } from 'jssm';
|
|
1402
|
-
*
|
|
1403
|
-
* const light = sm`Red 'next' => Green 'next' => Yellow 'next' => Red;`;
|
|
1404
|
-
* light.state(); // 'Red'
|
|
1405
|
-
* light.action('next'); // true
|
|
1406
|
-
* light.state(); // 'Green'
|
|
1407
|
-
* ```
|
|
1408
|
-
*
|
|
1409
|
-
* @typeparam mDT The machine data type — the type of the value stored in
|
|
1410
|
-
* `.data()`. Defaults to `undefined` when no data is used.
|
|
1411
|
-
*
|
|
1412
|
-
*/
|
|
1413
1418
|
declare class Machine<mDT> {
|
|
1414
1419
|
_state: StateType;
|
|
1415
1420
|
_states: Map<StateType, JssmGenericState>;
|
|
@@ -1432,6 +1437,7 @@ declare class Machine<mDT> {
|
|
|
1432
1437
|
_machine_name?: string;
|
|
1433
1438
|
_machine_version?: string;
|
|
1434
1439
|
_npm_name?: string;
|
|
1440
|
+
_default_size?: JssmDefaultSize;
|
|
1435
1441
|
_fsl_version?: string;
|
|
1436
1442
|
_raw_state_declaration?: Array<Object>;
|
|
1437
1443
|
_state_declarations: Map<StateType, JssmStateDeclaration>;
|
|
@@ -1475,6 +1481,7 @@ declare class Machine<mDT> {
|
|
|
1475
1481
|
_has_post_transition_hooks: boolean;
|
|
1476
1482
|
_code_allows_override: JssmAllowsOverride;
|
|
1477
1483
|
_config_allows_override: JssmAllowsOverride;
|
|
1484
|
+
_allow_islands: JssmAllowIslands;
|
|
1478
1485
|
_post_hooks: Map<string, Map<string, HookHandler<mDT>>>;
|
|
1479
1486
|
_post_named_hooks: Map<string, Map<string, Map<string, HookHandler<mDT>>>>;
|
|
1480
1487
|
_post_entry_hooks: Map<string, HookHandler<mDT>>;
|
|
@@ -1514,7 +1521,7 @@ declare class Machine<mDT> {
|
|
|
1514
1521
|
_event_handlers: Map<JssmEventName, Set<JssmEventEntry<any, any>>>;
|
|
1515
1522
|
_event_listener_count: number;
|
|
1516
1523
|
_firing_error: boolean;
|
|
1517
|
-
constructor({ start_states, end_states, failed_outputs, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, 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, allows_override, config_allows_override, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig<StateType, mDT>);
|
|
1524
|
+
constructor({ start_states, end_states, failed_outputs, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, default_size, 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, allows_override, config_allows_override, allow_islands, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig<StateType, mDT>);
|
|
1518
1525
|
/********
|
|
1519
1526
|
*
|
|
1520
1527
|
* Internal method for fabricating states. Not meant for external use.
|
|
@@ -1907,6 +1914,21 @@ declare class Machine<mDT> {
|
|
|
1907
1914
|
* @see machine_name
|
|
1908
1915
|
*/
|
|
1909
1916
|
npm_name(): string;
|
|
1917
|
+
/** Get the render-size hint for the machine's visualization. Set via the
|
|
1918
|
+
* FSL `default_size` directive. Returns `undefined` when not present.
|
|
1919
|
+
*
|
|
1920
|
+
* The three FSL forms each produce a different subset of fields:
|
|
1921
|
+
*
|
|
1922
|
+
* - `default_size: 800;` → `{ width: 800 }`
|
|
1923
|
+
* - `default_size: 800 600;` → `{ width: 800, height: 600 }`
|
|
1924
|
+
* - `default_size: height 600;` → `{ height: 600 }`
|
|
1925
|
+
*
|
|
1926
|
+
* This is a hint, not a hard constraint. Renderers may ignore it.
|
|
1927
|
+
*
|
|
1928
|
+
* @returns The size-hint object, or `undefined` if not set.
|
|
1929
|
+
* @see npm_name
|
|
1930
|
+
*/
|
|
1931
|
+
default_size(): JssmDefaultSize | undefined;
|
|
1910
1932
|
/** Get the machine's version string. Set via the FSL `machine_version` directive.
|
|
1911
1933
|
* @returns The version string.
|
|
1912
1934
|
*/
|
|
@@ -2057,6 +2079,17 @@ declare class Machine<mDT> {
|
|
|
2057
2079
|
*
|
|
2058
2080
|
*/
|
|
2059
2081
|
get allows_override(): JssmAllowsOverride;
|
|
2082
|
+
/*********
|
|
2083
|
+
*
|
|
2084
|
+
* Return the effective island policy for this machine. `true` means
|
|
2085
|
+
* disconnected components are allowed (the default), `false` requires a
|
|
2086
|
+
* single connected component, and `'with_start'` allows islands only when
|
|
2087
|
+
* every component contains at least one start state.
|
|
2088
|
+
*
|
|
2089
|
+
* @returns The island policy stored in the machine.
|
|
2090
|
+
*
|
|
2091
|
+
*/
|
|
2092
|
+
get allow_islands(): JssmAllowIslands;
|
|
2060
2093
|
/** List all available theme names.
|
|
2061
2094
|
* @returns An array of theme name strings.
|
|
2062
2095
|
*/
|
package/jssm.es6.d.ts
CHANGED
|
@@ -51,6 +51,30 @@ declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
|
51
51
|
* the decision to the surrounding configuration's default.
|
|
52
52
|
*/
|
|
53
53
|
declare type JssmAllowsOverride = true | false | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Controls whether the state graph may contain disconnected components
|
|
56
|
+
* (islands). `true` permits islands (default), `false` requires a single
|
|
57
|
+
* connected component, and `'with_start'` permits islands only when every
|
|
58
|
+
* component contains at least one start state.
|
|
59
|
+
*/
|
|
60
|
+
declare type JssmAllowIslands = true | false | 'with_start';
|
|
61
|
+
/**
|
|
62
|
+
* Structured render-size hint for a machine visualization, set by the FSL
|
|
63
|
+
* `default_size` directive. All three forms are optional in the sense that
|
|
64
|
+
* only one or two fields will be present depending on the form used:
|
|
65
|
+
*
|
|
66
|
+
* - `{ width }` — single-number form (`default_size: 800;`)
|
|
67
|
+
* - `{ width, height }` — bounding-box form (`default_size: 800 600;`)
|
|
68
|
+
* - `{ height }` — height-only form (`default_size: height 600;`)
|
|
69
|
+
*
|
|
70
|
+
* This is a *hint*, not a hard constraint. Renderers may ignore it.
|
|
71
|
+
*
|
|
72
|
+
* @see Machine.default_size
|
|
73
|
+
*/
|
|
74
|
+
declare type JssmDefaultSize = {
|
|
75
|
+
width?: number;
|
|
76
|
+
height?: number;
|
|
77
|
+
};
|
|
54
78
|
/**
|
|
55
79
|
* Runtime-iterable list of valid `flow` directions for FSL diagrams.
|
|
56
80
|
* Use this when you need to enumerate directions; for the type itself
|
|
@@ -284,7 +308,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
284
308
|
history?: number;
|
|
285
309
|
min_exits?: number;
|
|
286
310
|
max_exits?: number;
|
|
287
|
-
allow_islands?:
|
|
311
|
+
allow_islands?: JssmAllowIslands;
|
|
288
312
|
allow_force?: false;
|
|
289
313
|
actions?: JssmPermittedOpt;
|
|
290
314
|
simplify_bidi?: boolean;
|
|
@@ -311,6 +335,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
311
335
|
machine_name?: string;
|
|
312
336
|
machine_version?: string;
|
|
313
337
|
npm_name?: string;
|
|
338
|
+
default_size?: JssmDefaultSize;
|
|
314
339
|
fsl_version?: string;
|
|
315
340
|
auto_api?: boolean | string;
|
|
316
341
|
instance_name?: string | undefined;
|
|
@@ -1390,26 +1415,6 @@ declare function transfer_state_properties(state_decl: JssmStateDeclaration): Js
|
|
|
1390
1415
|
*
|
|
1391
1416
|
*/
|
|
1392
1417
|
declare function state_style_condense(jssk: JssmStateStyleKeyList, machine?: any): JssmStateConfig;
|
|
1393
|
-
/*******
|
|
1394
|
-
*
|
|
1395
|
-
* Core finite state machine class. Holds the full graph of states and
|
|
1396
|
-
* transitions, the current state, hooks, data, properties, and all runtime
|
|
1397
|
-
* behavior. Typically created via the {@link sm} tagged template literal
|
|
1398
|
-
* rather than constructed directly.
|
|
1399
|
-
*
|
|
1400
|
-
* ```typescript
|
|
1401
|
-
* import { sm } from 'jssm';
|
|
1402
|
-
*
|
|
1403
|
-
* const light = sm`Red 'next' => Green 'next' => Yellow 'next' => Red;`;
|
|
1404
|
-
* light.state(); // 'Red'
|
|
1405
|
-
* light.action('next'); // true
|
|
1406
|
-
* light.state(); // 'Green'
|
|
1407
|
-
* ```
|
|
1408
|
-
*
|
|
1409
|
-
* @typeparam mDT The machine data type — the type of the value stored in
|
|
1410
|
-
* `.data()`. Defaults to `undefined` when no data is used.
|
|
1411
|
-
*
|
|
1412
|
-
*/
|
|
1413
1418
|
declare class Machine<mDT> {
|
|
1414
1419
|
_state: StateType;
|
|
1415
1420
|
_states: Map<StateType, JssmGenericState>;
|
|
@@ -1432,6 +1437,7 @@ declare class Machine<mDT> {
|
|
|
1432
1437
|
_machine_name?: string;
|
|
1433
1438
|
_machine_version?: string;
|
|
1434
1439
|
_npm_name?: string;
|
|
1440
|
+
_default_size?: JssmDefaultSize;
|
|
1435
1441
|
_fsl_version?: string;
|
|
1436
1442
|
_raw_state_declaration?: Array<Object>;
|
|
1437
1443
|
_state_declarations: Map<StateType, JssmStateDeclaration>;
|
|
@@ -1475,6 +1481,7 @@ declare class Machine<mDT> {
|
|
|
1475
1481
|
_has_post_transition_hooks: boolean;
|
|
1476
1482
|
_code_allows_override: JssmAllowsOverride;
|
|
1477
1483
|
_config_allows_override: JssmAllowsOverride;
|
|
1484
|
+
_allow_islands: JssmAllowIslands;
|
|
1478
1485
|
_post_hooks: Map<string, Map<string, HookHandler<mDT>>>;
|
|
1479
1486
|
_post_named_hooks: Map<string, Map<string, Map<string, HookHandler<mDT>>>>;
|
|
1480
1487
|
_post_entry_hooks: Map<string, HookHandler<mDT>>;
|
|
@@ -1514,7 +1521,7 @@ declare class Machine<mDT> {
|
|
|
1514
1521
|
_event_handlers: Map<JssmEventName, Set<JssmEventEntry<any, any>>>;
|
|
1515
1522
|
_event_listener_count: number;
|
|
1516
1523
|
_firing_error: boolean;
|
|
1517
|
-
constructor({ start_states, end_states, failed_outputs, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, 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, allows_override, config_allows_override, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig<StateType, mDT>);
|
|
1524
|
+
constructor({ start_states, end_states, failed_outputs, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, default_size, 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, allows_override, config_allows_override, allow_islands, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig<StateType, mDT>);
|
|
1518
1525
|
/********
|
|
1519
1526
|
*
|
|
1520
1527
|
* Internal method for fabricating states. Not meant for external use.
|
|
@@ -1907,6 +1914,21 @@ declare class Machine<mDT> {
|
|
|
1907
1914
|
* @see machine_name
|
|
1908
1915
|
*/
|
|
1909
1916
|
npm_name(): string;
|
|
1917
|
+
/** Get the render-size hint for the machine's visualization. Set via the
|
|
1918
|
+
* FSL `default_size` directive. Returns `undefined` when not present.
|
|
1919
|
+
*
|
|
1920
|
+
* The three FSL forms each produce a different subset of fields:
|
|
1921
|
+
*
|
|
1922
|
+
* - `default_size: 800;` → `{ width: 800 }`
|
|
1923
|
+
* - `default_size: 800 600;` → `{ width: 800, height: 600 }`
|
|
1924
|
+
* - `default_size: height 600;` → `{ height: 600 }`
|
|
1925
|
+
*
|
|
1926
|
+
* This is a hint, not a hard constraint. Renderers may ignore it.
|
|
1927
|
+
*
|
|
1928
|
+
* @returns The size-hint object, or `undefined` if not set.
|
|
1929
|
+
* @see npm_name
|
|
1930
|
+
*/
|
|
1931
|
+
default_size(): JssmDefaultSize | undefined;
|
|
1910
1932
|
/** Get the machine's version string. Set via the FSL `machine_version` directive.
|
|
1911
1933
|
* @returns The version string.
|
|
1912
1934
|
*/
|
|
@@ -2057,6 +2079,17 @@ declare class Machine<mDT> {
|
|
|
2057
2079
|
*
|
|
2058
2080
|
*/
|
|
2059
2081
|
get allows_override(): JssmAllowsOverride;
|
|
2082
|
+
/*********
|
|
2083
|
+
*
|
|
2084
|
+
* Return the effective island policy for this machine. `true` means
|
|
2085
|
+
* disconnected components are allowed (the default), `false` requires a
|
|
2086
|
+
* single connected component, and `'with_start'` allows islands only when
|
|
2087
|
+
* every component contains at least one start state.
|
|
2088
|
+
*
|
|
2089
|
+
* @returns The island policy stored in the machine.
|
|
2090
|
+
*
|
|
2091
|
+
*/
|
|
2092
|
+
get allow_islands(): JssmAllowIslands;
|
|
2060
2093
|
/** List all available theme names.
|
|
2061
2094
|
* @returns An array of theme name strings.
|
|
2062
2095
|
*/
|
package/jssm_viz.es5.d.cts
CHANGED
|
@@ -46,6 +46,30 @@ declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
|
46
46
|
* the decision to the surrounding configuration's default.
|
|
47
47
|
*/
|
|
48
48
|
declare type JssmAllowsOverride = true | false | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Controls whether the state graph may contain disconnected components
|
|
51
|
+
* (islands). `true` permits islands (default), `false` requires a single
|
|
52
|
+
* connected component, and `'with_start'` permits islands only when every
|
|
53
|
+
* component contains at least one start state.
|
|
54
|
+
*/
|
|
55
|
+
declare type JssmAllowIslands = true | false | 'with_start';
|
|
56
|
+
/**
|
|
57
|
+
* Structured render-size hint for a machine visualization, set by the FSL
|
|
58
|
+
* `default_size` directive. All three forms are optional in the sense that
|
|
59
|
+
* only one or two fields will be present depending on the form used:
|
|
60
|
+
*
|
|
61
|
+
* - `{ width }` — single-number form (`default_size: 800;`)
|
|
62
|
+
* - `{ width, height }` — bounding-box form (`default_size: 800 600;`)
|
|
63
|
+
* - `{ height }` — height-only form (`default_size: height 600;`)
|
|
64
|
+
*
|
|
65
|
+
* This is a *hint*, not a hard constraint. Renderers may ignore it.
|
|
66
|
+
*
|
|
67
|
+
* @see Machine.default_size
|
|
68
|
+
*/
|
|
69
|
+
declare type JssmDefaultSize = {
|
|
70
|
+
width?: number;
|
|
71
|
+
height?: number;
|
|
72
|
+
};
|
|
49
73
|
/**
|
|
50
74
|
* Runtime-iterable list of valid `flow` directions for FSL diagrams.
|
|
51
75
|
* Use this when you need to enumerate directions; for the type itself
|
|
@@ -279,7 +303,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
279
303
|
history?: number;
|
|
280
304
|
min_exits?: number;
|
|
281
305
|
max_exits?: number;
|
|
282
|
-
allow_islands?:
|
|
306
|
+
allow_islands?: JssmAllowIslands;
|
|
283
307
|
allow_force?: false;
|
|
284
308
|
actions?: JssmPermittedOpt;
|
|
285
309
|
simplify_bidi?: boolean;
|
|
@@ -306,6 +330,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
306
330
|
machine_name?: string;
|
|
307
331
|
machine_version?: string;
|
|
308
332
|
npm_name?: string;
|
|
333
|
+
default_size?: JssmDefaultSize;
|
|
309
334
|
fsl_version?: string;
|
|
310
335
|
auto_api?: boolean | string;
|
|
311
336
|
instance_name?: string | undefined;
|
|
@@ -788,26 +813,6 @@ declare type JssmEventEntry<mDT, Ev extends JssmEventName> = {
|
|
|
788
813
|
filter?: JssmEventFilter<mDT, Ev>;
|
|
789
814
|
once: boolean;
|
|
790
815
|
};
|
|
791
|
-
/*******
|
|
792
|
-
*
|
|
793
|
-
* Core finite state machine class. Holds the full graph of states and
|
|
794
|
-
* transitions, the current state, hooks, data, properties, and all runtime
|
|
795
|
-
* behavior. Typically created via the {@link sm} tagged template literal
|
|
796
|
-
* rather than constructed directly.
|
|
797
|
-
*
|
|
798
|
-
* ```typescript
|
|
799
|
-
* import { sm } from 'jssm';
|
|
800
|
-
*
|
|
801
|
-
* const light = sm`Red 'next' => Green 'next' => Yellow 'next' => Red;`;
|
|
802
|
-
* light.state(); // 'Red'
|
|
803
|
-
* light.action('next'); // true
|
|
804
|
-
* light.state(); // 'Green'
|
|
805
|
-
* ```
|
|
806
|
-
*
|
|
807
|
-
* @typeparam mDT The machine data type — the type of the value stored in
|
|
808
|
-
* `.data()`. Defaults to `undefined` when no data is used.
|
|
809
|
-
*
|
|
810
|
-
*/
|
|
811
816
|
declare class Machine<mDT> {
|
|
812
817
|
_state: StateType;
|
|
813
818
|
_states: Map<StateType, JssmGenericState>;
|
|
@@ -830,6 +835,7 @@ declare class Machine<mDT> {
|
|
|
830
835
|
_machine_name?: string;
|
|
831
836
|
_machine_version?: string;
|
|
832
837
|
_npm_name?: string;
|
|
838
|
+
_default_size?: JssmDefaultSize;
|
|
833
839
|
_fsl_version?: string;
|
|
834
840
|
_raw_state_declaration?: Array<Object>;
|
|
835
841
|
_state_declarations: Map<StateType, JssmStateDeclaration>;
|
|
@@ -873,6 +879,7 @@ declare class Machine<mDT> {
|
|
|
873
879
|
_has_post_transition_hooks: boolean;
|
|
874
880
|
_code_allows_override: JssmAllowsOverride;
|
|
875
881
|
_config_allows_override: JssmAllowsOverride;
|
|
882
|
+
_allow_islands: JssmAllowIslands;
|
|
876
883
|
_post_hooks: Map<string, Map<string, HookHandler<mDT>>>;
|
|
877
884
|
_post_named_hooks: Map<string, Map<string, Map<string, HookHandler<mDT>>>>;
|
|
878
885
|
_post_entry_hooks: Map<string, HookHandler<mDT>>;
|
|
@@ -912,7 +919,7 @@ declare class Machine<mDT> {
|
|
|
912
919
|
_event_handlers: Map<JssmEventName, Set<JssmEventEntry<any, any>>>;
|
|
913
920
|
_event_listener_count: number;
|
|
914
921
|
_firing_error: boolean;
|
|
915
|
-
constructor({ start_states, end_states, failed_outputs, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, 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, allows_override, config_allows_override, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig<StateType, mDT>);
|
|
922
|
+
constructor({ start_states, end_states, failed_outputs, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, default_size, 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, allows_override, config_allows_override, allow_islands, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig<StateType, mDT>);
|
|
916
923
|
/********
|
|
917
924
|
*
|
|
918
925
|
* Internal method for fabricating states. Not meant for external use.
|
|
@@ -1305,6 +1312,21 @@ declare class Machine<mDT> {
|
|
|
1305
1312
|
* @see machine_name
|
|
1306
1313
|
*/
|
|
1307
1314
|
npm_name(): string;
|
|
1315
|
+
/** Get the render-size hint for the machine's visualization. Set via the
|
|
1316
|
+
* FSL `default_size` directive. Returns `undefined` when not present.
|
|
1317
|
+
*
|
|
1318
|
+
* The three FSL forms each produce a different subset of fields:
|
|
1319
|
+
*
|
|
1320
|
+
* - `default_size: 800;` → `{ width: 800 }`
|
|
1321
|
+
* - `default_size: 800 600;` → `{ width: 800, height: 600 }`
|
|
1322
|
+
* - `default_size: height 600;` → `{ height: 600 }`
|
|
1323
|
+
*
|
|
1324
|
+
* This is a hint, not a hard constraint. Renderers may ignore it.
|
|
1325
|
+
*
|
|
1326
|
+
* @returns The size-hint object, or `undefined` if not set.
|
|
1327
|
+
* @see npm_name
|
|
1328
|
+
*/
|
|
1329
|
+
default_size(): JssmDefaultSize | undefined;
|
|
1308
1330
|
/** Get the machine's version string. Set via the FSL `machine_version` directive.
|
|
1309
1331
|
* @returns The version string.
|
|
1310
1332
|
*/
|
|
@@ -1455,6 +1477,17 @@ declare class Machine<mDT> {
|
|
|
1455
1477
|
*
|
|
1456
1478
|
*/
|
|
1457
1479
|
get allows_override(): JssmAllowsOverride;
|
|
1480
|
+
/*********
|
|
1481
|
+
*
|
|
1482
|
+
* Return the effective island policy for this machine. `true` means
|
|
1483
|
+
* disconnected components are allowed (the default), `false` requires a
|
|
1484
|
+
* single connected component, and `'with_start'` allows islands only when
|
|
1485
|
+
* every component contains at least one start state.
|
|
1486
|
+
*
|
|
1487
|
+
* @returns The island policy stored in the machine.
|
|
1488
|
+
*
|
|
1489
|
+
*/
|
|
1490
|
+
get allow_islands(): JssmAllowIslands;
|
|
1458
1491
|
/** List all available theme names.
|
|
1459
1492
|
* @returns An array of theme name strings.
|
|
1460
1493
|
*/
|
package/jssm_viz.es6.d.ts
CHANGED
|
@@ -46,6 +46,30 @@ declare type JssmLineStyle = 'solid' | 'dashed' | 'dotted';
|
|
|
46
46
|
* the decision to the surrounding configuration's default.
|
|
47
47
|
*/
|
|
48
48
|
declare type JssmAllowsOverride = true | false | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Controls whether the state graph may contain disconnected components
|
|
51
|
+
* (islands). `true` permits islands (default), `false` requires a single
|
|
52
|
+
* connected component, and `'with_start'` permits islands only when every
|
|
53
|
+
* component contains at least one start state.
|
|
54
|
+
*/
|
|
55
|
+
declare type JssmAllowIslands = true | false | 'with_start';
|
|
56
|
+
/**
|
|
57
|
+
* Structured render-size hint for a machine visualization, set by the FSL
|
|
58
|
+
* `default_size` directive. All three forms are optional in the sense that
|
|
59
|
+
* only one or two fields will be present depending on the form used:
|
|
60
|
+
*
|
|
61
|
+
* - `{ width }` — single-number form (`default_size: 800;`)
|
|
62
|
+
* - `{ width, height }` — bounding-box form (`default_size: 800 600;`)
|
|
63
|
+
* - `{ height }` — height-only form (`default_size: height 600;`)
|
|
64
|
+
*
|
|
65
|
+
* This is a *hint*, not a hard constraint. Renderers may ignore it.
|
|
66
|
+
*
|
|
67
|
+
* @see Machine.default_size
|
|
68
|
+
*/
|
|
69
|
+
declare type JssmDefaultSize = {
|
|
70
|
+
width?: number;
|
|
71
|
+
height?: number;
|
|
72
|
+
};
|
|
49
73
|
/**
|
|
50
74
|
* Runtime-iterable list of valid `flow` directions for FSL diagrams.
|
|
51
75
|
* Use this when you need to enumerate directions; for the type itself
|
|
@@ -279,7 +303,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
279
303
|
history?: number;
|
|
280
304
|
min_exits?: number;
|
|
281
305
|
max_exits?: number;
|
|
282
|
-
allow_islands?:
|
|
306
|
+
allow_islands?: JssmAllowIslands;
|
|
283
307
|
allow_force?: false;
|
|
284
308
|
actions?: JssmPermittedOpt;
|
|
285
309
|
simplify_bidi?: boolean;
|
|
@@ -306,6 +330,7 @@ declare type JssmGenericConfig<StateType, DataType> = {
|
|
|
306
330
|
machine_name?: string;
|
|
307
331
|
machine_version?: string;
|
|
308
332
|
npm_name?: string;
|
|
333
|
+
default_size?: JssmDefaultSize;
|
|
309
334
|
fsl_version?: string;
|
|
310
335
|
auto_api?: boolean | string;
|
|
311
336
|
instance_name?: string | undefined;
|
|
@@ -788,26 +813,6 @@ declare type JssmEventEntry<mDT, Ev extends JssmEventName> = {
|
|
|
788
813
|
filter?: JssmEventFilter<mDT, Ev>;
|
|
789
814
|
once: boolean;
|
|
790
815
|
};
|
|
791
|
-
/*******
|
|
792
|
-
*
|
|
793
|
-
* Core finite state machine class. Holds the full graph of states and
|
|
794
|
-
* transitions, the current state, hooks, data, properties, and all runtime
|
|
795
|
-
* behavior. Typically created via the {@link sm} tagged template literal
|
|
796
|
-
* rather than constructed directly.
|
|
797
|
-
*
|
|
798
|
-
* ```typescript
|
|
799
|
-
* import { sm } from 'jssm';
|
|
800
|
-
*
|
|
801
|
-
* const light = sm`Red 'next' => Green 'next' => Yellow 'next' => Red;`;
|
|
802
|
-
* light.state(); // 'Red'
|
|
803
|
-
* light.action('next'); // true
|
|
804
|
-
* light.state(); // 'Green'
|
|
805
|
-
* ```
|
|
806
|
-
*
|
|
807
|
-
* @typeparam mDT The machine data type — the type of the value stored in
|
|
808
|
-
* `.data()`. Defaults to `undefined` when no data is used.
|
|
809
|
-
*
|
|
810
|
-
*/
|
|
811
816
|
declare class Machine<mDT> {
|
|
812
817
|
_state: StateType;
|
|
813
818
|
_states: Map<StateType, JssmGenericState>;
|
|
@@ -830,6 +835,7 @@ declare class Machine<mDT> {
|
|
|
830
835
|
_machine_name?: string;
|
|
831
836
|
_machine_version?: string;
|
|
832
837
|
_npm_name?: string;
|
|
838
|
+
_default_size?: JssmDefaultSize;
|
|
833
839
|
_fsl_version?: string;
|
|
834
840
|
_raw_state_declaration?: Array<Object>;
|
|
835
841
|
_state_declarations: Map<StateType, JssmStateDeclaration>;
|
|
@@ -873,6 +879,7 @@ declare class Machine<mDT> {
|
|
|
873
879
|
_has_post_transition_hooks: boolean;
|
|
874
880
|
_code_allows_override: JssmAllowsOverride;
|
|
875
881
|
_config_allows_override: JssmAllowsOverride;
|
|
882
|
+
_allow_islands: JssmAllowIslands;
|
|
876
883
|
_post_hooks: Map<string, Map<string, HookHandler<mDT>>>;
|
|
877
884
|
_post_named_hooks: Map<string, Map<string, Map<string, HookHandler<mDT>>>>;
|
|
878
885
|
_post_entry_hooks: Map<string, HookHandler<mDT>>;
|
|
@@ -912,7 +919,7 @@ declare class Machine<mDT> {
|
|
|
912
919
|
_event_handlers: Map<JssmEventName, Set<JssmEventEntry<any, any>>>;
|
|
913
920
|
_event_listener_count: number;
|
|
914
921
|
_firing_error: boolean;
|
|
915
|
-
constructor({ start_states, end_states, failed_outputs, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, 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, allows_override, config_allows_override, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig<StateType, mDT>);
|
|
922
|
+
constructor({ start_states, end_states, failed_outputs, initial_state, start_states_no_enforce, complete, transitions, machine_author, machine_comment, machine_contributor, machine_definition, machine_language, machine_license, machine_name, machine_version, npm_name, default_size, 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, allows_override, config_allows_override, allow_islands, rng_seed, time_source, timeout_source, clear_timeout_source }: JssmGenericConfig<StateType, mDT>);
|
|
916
923
|
/********
|
|
917
924
|
*
|
|
918
925
|
* Internal method for fabricating states. Not meant for external use.
|
|
@@ -1305,6 +1312,21 @@ declare class Machine<mDT> {
|
|
|
1305
1312
|
* @see machine_name
|
|
1306
1313
|
*/
|
|
1307
1314
|
npm_name(): string;
|
|
1315
|
+
/** Get the render-size hint for the machine's visualization. Set via the
|
|
1316
|
+
* FSL `default_size` directive. Returns `undefined` when not present.
|
|
1317
|
+
*
|
|
1318
|
+
* The three FSL forms each produce a different subset of fields:
|
|
1319
|
+
*
|
|
1320
|
+
* - `default_size: 800;` → `{ width: 800 }`
|
|
1321
|
+
* - `default_size: 800 600;` → `{ width: 800, height: 600 }`
|
|
1322
|
+
* - `default_size: height 600;` → `{ height: 600 }`
|
|
1323
|
+
*
|
|
1324
|
+
* This is a hint, not a hard constraint. Renderers may ignore it.
|
|
1325
|
+
*
|
|
1326
|
+
* @returns The size-hint object, or `undefined` if not set.
|
|
1327
|
+
* @see npm_name
|
|
1328
|
+
*/
|
|
1329
|
+
default_size(): JssmDefaultSize | undefined;
|
|
1308
1330
|
/** Get the machine's version string. Set via the FSL `machine_version` directive.
|
|
1309
1331
|
* @returns The version string.
|
|
1310
1332
|
*/
|
|
@@ -1455,6 +1477,17 @@ declare class Machine<mDT> {
|
|
|
1455
1477
|
*
|
|
1456
1478
|
*/
|
|
1457
1479
|
get allows_override(): JssmAllowsOverride;
|
|
1480
|
+
/*********
|
|
1481
|
+
*
|
|
1482
|
+
* Return the effective island policy for this machine. `true` means
|
|
1483
|
+
* disconnected components are allowed (the default), `false` requires a
|
|
1484
|
+
* single connected component, and `'with_start'` allows islands only when
|
|
1485
|
+
* every component contains at least one start state.
|
|
1486
|
+
*
|
|
1487
|
+
* @returns The island policy stored in the machine.
|
|
1488
|
+
*
|
|
1489
|
+
*/
|
|
1490
|
+
get allow_islands(): JssmAllowIslands;
|
|
1458
1491
|
/** List all available theme names.
|
|
1459
1492
|
* @returns An array of theme name strings.
|
|
1460
1493
|
*/
|