jssm 5.162.7 → 5.162.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/README.md +7 -7
- package/custom-elements.json +47 -47
- package/dist/cdn/instance.js +5 -3
- package/dist/cdn/viz.js +1 -1
- package/dist/cli/fsl-export-system-prompt.cjs +27 -24
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/cli/lib.cjs +1 -1
- package/dist/cli/lib.mjs +1 -1
- package/dist/cm6/fsl_language.js +10 -14
- package/dist/deno/README.md +7 -7
- package/dist/deno/fence.d.ts +0 -1
- package/dist/deno/fsl_fence_highlight.d.ts +0 -4
- package/dist/deno/fsl_fence_render.d.ts +0 -8
- package/dist/deno/fsl_gif.d.ts +0 -8
- package/dist/deno/fsl_markdown_fence.d.ts +0 -5
- package/dist/deno/fsl_svg_patch.d.ts +0 -6
- package/dist/deno/fsl_walk.d.ts +0 -2
- package/dist/deno/jssm.d.ts +214 -503
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_compiler.d.ts +1 -1
- package/dist/deno/jssm_constants.d.ts +0 -3
- package/dist/deno/jssm_intern.d.ts +0 -15
- package/dist/deno/jssm_theme.d.ts +2 -2
- package/dist/deno/jssm_types.d.ts +13 -34
- package/dist/deno/jssm_util.d.ts +20 -6
- package/dist/deno/jssm_viz.d.ts +5 -51
- package/dist/es6/cm6/fsl_language.d.ts +0 -2
- package/dist/fence/fence.js +1651 -1833
- 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/dist/wc/docs.define.js +0 -5
- package/dist/wc/docs.js +79 -43
- package/dist/wc/editor.define.js +0 -5
- package/dist/wc/editor.js +1 -7
- package/dist/wc/instance.define.js +0 -6
- package/dist/wc/instance.js +93 -115
- package/dist/wc/viz.define.js +0 -6
- package/dist/wc/viz.js +22 -36
- package/dist/wc/widgets.define.js +0 -5
- package/dist/wc/widgets.js +117 -95
- package/jssm.cli.d.cts +0 -8
- package/jssm.cli.d.ts +0 -8
- package/jssm.es5.d.cts +449 -808
- package/jssm.es6.d.ts +449 -808
- package/jssm.fence.d.ts +213 -508
- package/jssm_viz.es5.d.cts +216 -529
- package/jssm_viz.es6.d.ts +216 -529
- package/package.json +16 -10
|
@@ -130,7 +130,7 @@ declare function makeTransition<StateType, mDT>(this_se: JssmCompileSe<StateType
|
|
|
130
130
|
* tracking on every AST node.
|
|
131
131
|
*
|
|
132
132
|
*/
|
|
133
|
-
declare function wrap_parse(input: string, options?:
|
|
133
|
+
declare function wrap_parse(input: string, options?: object): any;
|
|
134
134
|
/*********
|
|
135
135
|
*
|
|
136
136
|
* Builds the ordered {@link JssmGroupRegistry} from every `named_list` node
|
|
@@ -52,7 +52,6 @@ declare const named_colors: string[];
|
|
|
52
52
|
* Includes ASCII digits/letters and the symbols
|
|
53
53
|
* `.`, `+`, `_`, `^`, `(`, `)`, `*`, `&`, `$`, `#`, `@`, `!`, `?`, `,`,
|
|
54
54
|
* plus the high-Unicode range `U+0080`–`U+FFFF`.
|
|
55
|
-
*
|
|
56
55
|
* @example
|
|
57
56
|
* import { state_name_chars } from 'jssm';
|
|
58
57
|
* state_name_chars.some(r => 'A' >= r.from && 'A' <= r.to); // => true
|
|
@@ -68,7 +67,6 @@ declare const state_name_chars: ReadonlyArray<{
|
|
|
68
67
|
* Notably narrower than {@link state_name_chars}: omits `+`, `(`, `)`, `&`,
|
|
69
68
|
* `#`, `@`. Includes ASCII digits/letters, `.`, `_`, `!`, `$`, `^`, `*`,
|
|
70
69
|
* `?`, `,`, and the high-Unicode range `U+0080`–`U+FFFF`.
|
|
71
|
-
*
|
|
72
70
|
* @example
|
|
73
71
|
* import { state_name_first_chars } from 'jssm';
|
|
74
72
|
* state_name_first_chars.some(r => '+' >= r.from && '+' <= r.to); // => false
|
|
@@ -84,7 +82,6 @@ declare const state_name_first_chars: ReadonlyArray<{
|
|
|
84
82
|
* excluded since it terminates the label.
|
|
85
83
|
*
|
|
86
84
|
* Three ranges: `U+0020`–`U+0026`, `U+0028`–`U+005B`, `U+005D`–`U+FFFF`.
|
|
87
|
-
*
|
|
88
85
|
* @example
|
|
89
86
|
* import { action_label_chars } from 'jssm';
|
|
90
87
|
* action_label_chars.some(r => ' ' >= r.from && ' ' <= r.to); // => true
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* (integer hashing) instead of repeated string-keyed lookups. Internal
|
|
7
7
|
* machinery only — deliberately not re-exported from the `jssm` public
|
|
8
8
|
* surface, so the public API is unchanged.
|
|
9
|
-
*
|
|
10
9
|
* @internal
|
|
11
10
|
*/
|
|
12
11
|
/**
|
|
@@ -15,7 +14,6 @@
|
|
|
15
14
|
* no removal, matching machine semantics (states and actions are fixed
|
|
16
15
|
* after construction; late interning only happens for never-matching
|
|
17
16
|
* lookups such as hook registrations naming unknown states).
|
|
18
|
-
*
|
|
19
17
|
* @example
|
|
20
18
|
* const i = new Interner();
|
|
21
19
|
* i.intern('red'); // 0
|
|
@@ -23,7 +21,6 @@
|
|
|
23
21
|
* i.intern('red'); // 0 (idempotent)
|
|
24
22
|
* i.id_of('green'); // 1
|
|
25
23
|
* i.name_of(0); // 'red'
|
|
26
|
-
*
|
|
27
24
|
* @see pair_key
|
|
28
25
|
*/
|
|
29
26
|
declare class Interner {
|
|
@@ -33,10 +30,8 @@ declare class Interner {
|
|
|
33
30
|
/**
|
|
34
31
|
* Return the id for `name`, assigning the next dense id if the name has
|
|
35
32
|
* not been seen before.
|
|
36
|
-
*
|
|
37
33
|
* @param name - The string to intern.
|
|
38
34
|
* @returns The (possibly newly assigned) integer id.
|
|
39
|
-
*
|
|
40
35
|
* @example
|
|
41
36
|
* interner.intern('red'); // 0 on first call, 0 on every later call
|
|
42
37
|
*/
|
|
@@ -45,18 +40,14 @@ declare class Interner {
|
|
|
45
40
|
* Return the id for `name` without interning, or `undefined` when the
|
|
46
41
|
* name has never been interned. This is the hot-path probe for
|
|
47
42
|
* user-supplied names.
|
|
48
|
-
*
|
|
49
43
|
* @param name - The string to look up.
|
|
50
|
-
*
|
|
51
44
|
* @example
|
|
52
45
|
* interner.id_of('mauve'); // undefined — never interned
|
|
53
46
|
*/
|
|
54
47
|
id_of(name: string): number | undefined;
|
|
55
48
|
/**
|
|
56
49
|
* Return the name for `id`, or `undefined` for an id never assigned.
|
|
57
|
-
*
|
|
58
50
|
* @param id - The integer id to invert.
|
|
59
|
-
*
|
|
60
51
|
* @example
|
|
61
52
|
* interner.name_of(0); // 'red'
|
|
62
53
|
*/
|
|
@@ -78,15 +69,12 @@ declare class Interner {
|
|
|
78
69
|
* injective over the naturals, and a negative input can collide with a real
|
|
79
70
|
* stored key (e.g. szudzik(-1, 2) === szudzik(1, 1) === 3), which would make
|
|
80
71
|
* lookups from an unknown state falsely succeed.
|
|
81
|
-
*
|
|
82
72
|
* @param a - First non-negative integer (or NaN as a deliberate miss).
|
|
83
73
|
* @param b - Second non-negative integer (or NaN as a deliberate miss).
|
|
84
74
|
* @returns A number unique to the ordered pair `(a, b)` over the naturals.
|
|
85
|
-
*
|
|
86
75
|
* @example
|
|
87
76
|
* pair_key(2, 5); // 27
|
|
88
77
|
* pair_key(5, 2); // 32 — order-sensitive
|
|
89
|
-
*
|
|
90
78
|
* @see Interner
|
|
91
79
|
*/
|
|
92
80
|
declare function pair_key(a: number, b: number): number;
|
|
@@ -99,14 +87,11 @@ declare function pair_key(a: number, b: number): number;
|
|
|
99
87
|
*
|
|
100
88
|
* Behavior is only defined for keys `pair_key` actually emits; a NaN key (the
|
|
101
89
|
* unknown-name sentinel) yields `[NaN, NaN]`, never a spurious real pair.
|
|
102
|
-
*
|
|
103
90
|
* @param z - A key produced by `pair_key`.
|
|
104
91
|
* @returns The ordered pair `[a, b]` such that `pair_key(a, b) === z`.
|
|
105
|
-
*
|
|
106
92
|
* @example
|
|
107
93
|
* un_pair_key(27); // [2, 5]
|
|
108
94
|
* un_pair_key(32); // [5, 2] — order preserved
|
|
109
|
-
*
|
|
110
95
|
* @see pair_key
|
|
111
96
|
*/
|
|
112
97
|
declare function un_pair_key(z: number): [number, number];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FslTheme, JssmBaseTheme } from './jssm_types.js';
|
|
2
|
-
import { base_theme } from './themes/jssm_base_stylesheet.js';
|
|
3
2
|
/*******
|
|
4
3
|
*
|
|
5
4
|
* Registry mapping theme names to their stylesheet definitions. Each entry
|
|
@@ -12,4 +11,5 @@ import { base_theme } from './themes/jssm_base_stylesheet.js';
|
|
|
12
11
|
*
|
|
13
12
|
*/
|
|
14
13
|
declare const theme_mapping: Map<FslTheme, JssmBaseTheme>;
|
|
15
|
-
export { theme_mapping,
|
|
14
|
+
export { theme_mapping, };
|
|
15
|
+
export { base_theme } from './themes/jssm_base_stylesheet.js';
|
|
@@ -91,7 +91,6 @@ type JssmAllowIslands = true | false | 'with_start';
|
|
|
91
91
|
* - `{ height }` — height-only form (`default_size: height 600;`)
|
|
92
92
|
*
|
|
93
93
|
* This is a *hint*, not a hard constraint. Renderers may ignore it.
|
|
94
|
-
*
|
|
95
94
|
* @see Machine.default_size
|
|
96
95
|
*/
|
|
97
96
|
type JssmDefaultSize = {
|
|
@@ -126,8 +125,7 @@ type FslTheme = typeof FslThemes[number];
|
|
|
126
125
|
* and consumed by {@link jssm!deserialize}. Carries the current state, the
|
|
127
126
|
* associated machine data, the recent history (subject to the configured
|
|
128
127
|
* capacity), and metadata to detect version-skew on rehydration.
|
|
129
|
-
*
|
|
130
|
-
* @typeParam DataType - The type of the user-supplied data payload (`mDT`).
|
|
128
|
+
* @template DataType - The type of the user-supplied data payload (`mDT`).
|
|
131
129
|
*/
|
|
132
130
|
type JssmSerialization<DataType> = {
|
|
133
131
|
jssm_version: string;
|
|
@@ -150,7 +148,6 @@ type JssmSerialization<DataType> = {
|
|
|
150
148
|
* parse('&busy : [a b]; &busy -> idle;')[1].from;
|
|
151
149
|
* // { key: 'group_ref', name: 'busy' }
|
|
152
150
|
* ```
|
|
153
|
-
*
|
|
154
151
|
* @see JssmGroupMemberRef
|
|
155
152
|
* @see JssmGroupRegistry
|
|
156
153
|
*/
|
|
@@ -173,7 +170,6 @@ type JssmGroupRef = {
|
|
|
173
170
|
* // [ { kind: 'group', name: 'inner', mode: 'nest' },
|
|
174
171
|
* // { kind: 'state', name: 'x' } ]
|
|
175
172
|
* ```
|
|
176
|
-
*
|
|
177
173
|
* @see JssmGroupRef
|
|
178
174
|
* @see JssmGroupRegistry
|
|
179
175
|
*/
|
|
@@ -200,7 +196,6 @@ type JssmGroupMemberRef = {
|
|
|
200
196
|
* // registry.get('outer') === [ { kind:'group', name:'inner', mode:'nest' },
|
|
201
197
|
* // { kind:'state', name:'c' } ]
|
|
202
198
|
* ```
|
|
203
|
-
*
|
|
204
199
|
* @see JssmGroupMemberRef
|
|
205
200
|
*/
|
|
206
201
|
type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
|
|
@@ -219,7 +214,6 @@ type JssmGroupRegistry = Map<string, JssmGroupMemberRef[]>;
|
|
|
219
214
|
* // { key:'hook_decl', event:'enter',
|
|
220
215
|
* // subject:{ key:'group_ref', name:'busy' }, action:'log' }
|
|
221
216
|
* ```
|
|
222
|
-
*
|
|
223
217
|
* @see JssmGroupRef
|
|
224
218
|
* @see JssmGroupHooks
|
|
225
219
|
*/
|
|
@@ -235,7 +229,6 @@ type JssmHookDeclaration = {
|
|
|
235
229
|
* Each is optional so a subject may declare only one direction; the compiler
|
|
236
230
|
* merges an `enter` and an `exit` declaration for the same subject into one
|
|
237
231
|
* of these.
|
|
238
|
-
*
|
|
239
232
|
* @see JssmHookDeclaration
|
|
240
233
|
*/
|
|
241
234
|
type JssmBoundaryHooks = {
|
|
@@ -246,7 +239,6 @@ type JssmBoundaryHooks = {
|
|
|
246
239
|
* Maps each group name that has at least one boundary hook to its merged
|
|
247
240
|
* {@link JssmBoundaryHooks}. Carried on {@link JssmGenericConfig} for the
|
|
248
241
|
* runtime to consume; depth-aware firing is a later task.
|
|
249
|
-
*
|
|
250
242
|
* @see JssmHookDeclaration
|
|
251
243
|
*/
|
|
252
244
|
type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
|
|
@@ -254,7 +246,6 @@ type JssmGroupHooks = Map<string, JssmBoundaryHooks>;
|
|
|
254
246
|
* Maps each plain state name that has at least one boundary hook to its
|
|
255
247
|
* merged {@link JssmBoundaryHooks}. The state-subject analogue of
|
|
256
248
|
* {@link JssmGroupHooks}.
|
|
257
|
-
*
|
|
258
249
|
* @see JssmHookDeclaration
|
|
259
250
|
*/
|
|
260
251
|
type JssmStateHooks = Map<string, JssmBoundaryHooks>;
|
|
@@ -286,9 +277,8 @@ type JssmTransitionPermitterMaybeArray<DataType> = JssmTransitionPermitter<DataT
|
|
|
286
277
|
* per-edge `name`, an action label, a guard `check`, a transition
|
|
287
278
|
* `probability` for stochastic models, and an `after_time` for timed
|
|
288
279
|
* transitions.
|
|
289
|
-
*
|
|
290
|
-
* @
|
|
291
|
-
* @typeParam DataType - The machine's data payload type (`mDT`).
|
|
280
|
+
* @template StateType - The state-name type (usually `string`).
|
|
281
|
+
* @template DataType - The machine's data payload type (`mDT`).
|
|
292
282
|
*/
|
|
293
283
|
type JssmTransition<StateType, DataType> = {
|
|
294
284
|
from: StateType;
|
|
@@ -505,7 +495,6 @@ type JssmGraphDefaultEdgeColor = {
|
|
|
505
495
|
* reuses the per-state style items (so `color: red;` works inside a
|
|
506
496
|
* `transition:` block exactly as inside a `state:` block) plus the
|
|
507
497
|
* edge-scoped {@link JssmGraphDefaultEdgeColor} default.
|
|
508
|
-
*
|
|
509
498
|
* @see JssmTransitionConfig
|
|
510
499
|
*/
|
|
511
500
|
type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeColor;
|
|
@@ -520,7 +509,6 @@ type JssmTransitionStyleKey = JssmStateStyleKey | JssmGraphDefaultEdgeColor;
|
|
|
520
509
|
* const cfg = compile(parse('a -> b; transition: { color: red; };'));
|
|
521
510
|
* // cfg.default_transition_config === [ { key: 'color', value: '#ff0000ff' } ]
|
|
522
511
|
* ```
|
|
523
|
-
*
|
|
524
512
|
* @see JssmGraphConfig
|
|
525
513
|
*/
|
|
526
514
|
type JssmTransitionConfig = JssmTransitionStyleKey[];
|
|
@@ -531,7 +519,7 @@ type JssmTransitionConfig = JssmTransitionStyleKey[];
|
|
|
531
519
|
* default) into the consolidated `graph: {}` config. Each carries the
|
|
532
520
|
* legacy parse key so downstream consumers can disambiguate.
|
|
533
521
|
*/
|
|
534
|
-
type JssmGraphAliasKey = {
|
|
522
|
+
type JssmGraphAliasKey = JssmGraphDefaultEdgeColor | {
|
|
535
523
|
key: 'graph_layout';
|
|
536
524
|
value: JssmLayout;
|
|
537
525
|
} | {
|
|
@@ -546,13 +534,12 @@ type JssmGraphAliasKey = {
|
|
|
546
534
|
} | {
|
|
547
535
|
key: 'flow';
|
|
548
536
|
value: FslDirection;
|
|
549
|
-
}
|
|
537
|
+
};
|
|
550
538
|
/**
|
|
551
539
|
* A single item inside a `graph: {}` default-config block. For v1 this
|
|
552
540
|
* reuses the per-state style items plus the graph-scope alias items
|
|
553
541
|
* ({@link JssmGraphAliasKey}) folded in from the deprecated top-level
|
|
554
542
|
* graph keywords.
|
|
555
|
-
*
|
|
556
543
|
* @see JssmGraphConfig
|
|
557
544
|
*/
|
|
558
545
|
type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
|
|
@@ -569,7 +556,6 @@ type JssmGraphStyleKey = JssmStateStyleKey | JssmGraphAliasKey;
|
|
|
569
556
|
* // `background-color` item, so:
|
|
570
557
|
* // cfg.default_graph_config includes { key: 'background-color', value: '#ffffffff' }
|
|
571
558
|
* ```
|
|
572
|
-
*
|
|
573
559
|
* @see JssmTransitionConfig
|
|
574
560
|
*/
|
|
575
561
|
type JssmGraphConfig = JssmGraphStyleKey[];
|
|
@@ -618,9 +604,8 @@ type JssmTheme = Partial<JssmBaseTheme>;
|
|
|
618
604
|
*
|
|
619
605
|
* Most users never construct one of these directly — the `sm` tagged
|
|
620
606
|
* template literal and {@link from} produce one from FSL source.
|
|
621
|
-
*
|
|
622
|
-
* @
|
|
623
|
-
* @typeParam DataType - The user-supplied data payload type (`mDT`).
|
|
607
|
+
* @template StateType - The state-name type (usually `string`).
|
|
608
|
+
* @template DataType - The user-supplied data payload type (`mDT`).
|
|
624
609
|
*/
|
|
625
610
|
/**
|
|
626
611
|
* Editor/panel defaults an FSL machine declares in an `editor: {}` block
|
|
@@ -680,7 +665,6 @@ type JssmGenericConfig<StateType, DataType> = {
|
|
|
680
665
|
*
|
|
681
666
|
* Defaults to `100`. Raise it for legitimate pipelines that genuinely nest
|
|
682
667
|
* more than 100 transitions via boundary hooks.
|
|
683
|
-
*
|
|
684
668
|
* @see Machine._boundary_depth_limit
|
|
685
669
|
* @see Machine._fire_boundary_actions
|
|
686
670
|
*/
|
|
@@ -700,7 +684,7 @@ type JssmGenericConfig<StateType, DataType> = {
|
|
|
700
684
|
failed_outputs?: Array<StateType>;
|
|
701
685
|
initial_state?: StateType;
|
|
702
686
|
start_states_no_enforce?: boolean;
|
|
703
|
-
state_declaration?:
|
|
687
|
+
state_declaration?: object[];
|
|
704
688
|
property_definition?: JssmPropertyDefinition[];
|
|
705
689
|
state_property?: JssmPropertyDefinition[];
|
|
706
690
|
arrange_declaration?: Array<Array<StateType>>;
|
|
@@ -762,7 +746,6 @@ type JssmGenericConfig<StateType, DataType> = {
|
|
|
762
746
|
* Internal compiler intermediate: a single aggregated rule produced while
|
|
763
747
|
* folding a parse tree into a machine configuration. Not intended for
|
|
764
748
|
* end-user code.
|
|
765
|
-
*
|
|
766
749
|
* @internal
|
|
767
750
|
*/
|
|
768
751
|
type JssmCompileRule<StateType> = {
|
|
@@ -775,7 +758,6 @@ type JssmCompileRule<StateType> = {
|
|
|
775
758
|
* arrow with optional per-direction action labels, probabilities, and
|
|
776
759
|
* after-times. The recursive `se` field allows the parser to chain
|
|
777
760
|
* arrows of the form `A -> B -> C`. Not intended for end-user code.
|
|
778
|
-
*
|
|
779
761
|
* @internal
|
|
780
762
|
*/
|
|
781
763
|
type JssmCompileSe<StateType, mDT> = {
|
|
@@ -799,7 +781,6 @@ type JssmCompileSe<StateType, mDT> = {
|
|
|
799
781
|
* for non-transition rules (state declarations, property definitions,
|
|
800
782
|
* machine metadata) via its `key`/`value`/`name`/`state` fields. Not
|
|
801
783
|
* intended for end-user code.
|
|
802
|
-
*
|
|
803
784
|
* @internal
|
|
804
785
|
*/
|
|
805
786
|
type JssmCompileSeStart<StateType, DataType> = {
|
|
@@ -820,7 +801,6 @@ type JssmCompileSeStart<StateType, DataType> = {
|
|
|
820
801
|
* The output shape of the FSL parser: a flat array of
|
|
821
802
|
* {@link JssmCompileSeStart} entries, one per top-level rule in the
|
|
822
803
|
* source. Consumed by the compiler to build a machine configuration.
|
|
823
|
-
*
|
|
824
804
|
* @internal
|
|
825
805
|
*/
|
|
826
806
|
type JssmParseTree<StateType, mDT> = Array<JssmCompileSeStart<StateType, mDT>>;
|
|
@@ -1140,7 +1120,6 @@ type JssmRng = () => number;
|
|
|
1140
1120
|
* All event names that {@link jssm!Machine.on} accepts. These are observation
|
|
1141
1121
|
* events fired by the machine in addition to (not in place of) the hook
|
|
1142
1122
|
* system. Hooks intercept; events observe.
|
|
1143
|
-
*
|
|
1144
1123
|
* @see Machine.on
|
|
1145
1124
|
*/
|
|
1146
1125
|
type JssmEventName = 'transition' | 'rejection' | 'action' | 'entry' | 'exit' | 'terminal' | 'complete' | 'error' | 'data-change' | 'override' | 'timeout' | 'hook-registration' | 'hook-removal';
|
|
@@ -1234,7 +1213,7 @@ type JssmErrorEventDetail = {
|
|
|
1234
1213
|
error: unknown;
|
|
1235
1214
|
source_event: JssmEventName;
|
|
1236
1215
|
source_detail: unknown;
|
|
1237
|
-
handler:
|
|
1216
|
+
handler: JssmEventHandler<unknown, JssmEventName>;
|
|
1238
1217
|
};
|
|
1239
1218
|
/**
|
|
1240
1219
|
* Detail payload fired with a `data-change` event. Fires whenever the
|
|
@@ -1329,15 +1308,15 @@ type JssmEventFilterMap<mDT> = {
|
|
|
1329
1308
|
/**
|
|
1330
1309
|
* Per-event filter object (as passed to {@link jssm!Machine.on}). Use
|
|
1331
1310
|
* `JssmEventDetailMap<mDT>[Ev]` to find the matching detail type.
|
|
1332
|
-
* @
|
|
1333
|
-
* @
|
|
1311
|
+
* @template mDT The type of the machine data member.
|
|
1312
|
+
* @template Ev The event name.
|
|
1334
1313
|
*/
|
|
1335
1314
|
type JssmEventFilter<mDT, Ev extends JssmEventName> = JssmEventFilterMap<mDT>[Ev];
|
|
1336
1315
|
/**
|
|
1337
1316
|
* Per-event handler signature. Receives a detail object typed by event
|
|
1338
1317
|
* name, so `e.action` (etc.) only exist where they're meaningful.
|
|
1339
|
-
* @
|
|
1340
|
-
* @
|
|
1318
|
+
* @template mDT The type of the machine data member.
|
|
1319
|
+
* @template Ev The event name.
|
|
1341
1320
|
*/
|
|
1342
1321
|
type JssmEventHandler<mDT, Ev extends JssmEventName> = (detail: JssmEventDetailMap<mDT>[Ev]) => void;
|
|
1343
1322
|
/**
|
package/dist/deno/jssm_util.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JssmRng } from './jssm_types.js';
|
|
1
2
|
/*******
|
|
2
3
|
*
|
|
3
4
|
* Predicate for validating an array for uniqueness. Returns `true` when
|
|
@@ -62,7 +63,7 @@ declare const array_box_if_string: (n: any) => any;
|
|
|
62
63
|
* @throws {TypeError} If `options` is not a non-empty array of objects.
|
|
63
64
|
*
|
|
64
65
|
*/
|
|
65
|
-
declare const weighted_rand_select:
|
|
66
|
+
declare const weighted_rand_select: (options: Array<any>, probability_property: string, rng: JssmRng) => any;
|
|
66
67
|
/*******
|
|
67
68
|
*
|
|
68
69
|
* Returns, for a non-negative integer argument `n`, the series `[0 .. n]`.
|
|
@@ -76,6 +77,19 @@ declare const weighted_rand_select: Function;
|
|
|
76
77
|
*
|
|
77
78
|
*/
|
|
78
79
|
declare function seq(n: number): number[];
|
|
80
|
+
/*******
|
|
81
|
+
*
|
|
82
|
+
* Comparator reproducing `Array.prototype.sort`'s default ordering (compare
|
|
83
|
+
* as strings), so histogram key order stays byte-identical to the historic
|
|
84
|
+
* comparator-free sort — that ordering is observable to every iterating
|
|
85
|
+
* caller.
|
|
86
|
+
*
|
|
87
|
+
* ```typescript
|
|
88
|
+
* [10, 9, 1].sort(default_lexicographic); // [1, 10, 9], as with plain .sort()
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
declare const default_lexicographic: (a: any, b: any) => number;
|
|
79
93
|
/*******
|
|
80
94
|
*
|
|
81
95
|
* Returns the histograph of an array as a `Map`. Makes no attempt to cope
|
|
@@ -88,7 +102,7 @@ declare function seq(n: number): number[];
|
|
|
88
102
|
* ```
|
|
89
103
|
*
|
|
90
104
|
*/
|
|
91
|
-
declare const histograph:
|
|
105
|
+
declare const histograph: (ar: any[]) => Map<any, number>;
|
|
92
106
|
/*******
|
|
93
107
|
*
|
|
94
108
|
* Draws `n` weighted random samples from an array of objects. Each draw is
|
|
@@ -112,7 +126,7 @@ declare const histograph: Function;
|
|
|
112
126
|
* @returns An array of `n` independently selected items.
|
|
113
127
|
*
|
|
114
128
|
*/
|
|
115
|
-
declare const weighted_sample_select:
|
|
129
|
+
declare const weighted_sample_select: (n: number, options: Array<any>, probability_property: string, rng?: JssmRng) => Array<any>;
|
|
116
130
|
/*******
|
|
117
131
|
*
|
|
118
132
|
* Draws `n` weighted random samples, extracts a named key from each, and
|
|
@@ -140,7 +154,7 @@ declare const weighted_sample_select: Function;
|
|
|
140
154
|
* @returns A `Map` from extracted key values to their occurrence counts.
|
|
141
155
|
*
|
|
142
156
|
*/
|
|
143
|
-
declare const weighted_histo_key:
|
|
157
|
+
declare const weighted_histo_key: (n: number, opts: Array<any>, prob_prop: string, extract: string, rng?: JssmRng) => Map<any, number>;
|
|
144
158
|
/*******
|
|
145
159
|
*
|
|
146
160
|
* Internal method generating composite keys for the hook lookup map by
|
|
@@ -168,7 +182,7 @@ declare function name_bind_prop_and_state(prop: string, state: string): string;
|
|
|
168
182
|
* Replaces the Mulberry generator, which was found to have problems
|
|
169
183
|
*
|
|
170
184
|
*/
|
|
171
|
-
declare function gen_splitmix32(a?: number
|
|
185
|
+
declare function gen_splitmix32(a?: number): () => number;
|
|
172
186
|
/*******
|
|
173
187
|
*
|
|
174
188
|
* Reduces an array to its unique contents. Compares with `===` and makes no
|
|
@@ -220,4 +234,4 @@ declare function find_repeated<T>(arr: T[]): [T, number][];
|
|
|
220
234
|
*
|
|
221
235
|
*/
|
|
222
236
|
declare function sleep(ms: number): Promise<unknown>;
|
|
223
|
-
export { seq, unique, find_repeated, arr_uniq_p, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, name_bind_prop_and_state, gen_splitmix32, sleep };
|
|
237
|
+
export { seq, unique, find_repeated, arr_uniq_p, default_lexicographic, histograph, weighted_histo_key, weighted_rand_select, weighted_sample_select, array_box_if_string, name_bind_prop_and_state, gen_splitmix32, sleep };
|