jssm 5.158.2 → 5.159.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/README.md +7 -7
- package/dist/cdn/instance.js +1 -1
- package/dist/cdn/viz.js +1 -1
- package/dist/cli/fsl-export-system-prompt.cjs +1 -1
- 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/deno/README.md +7 -7
- package/dist/deno/fsl_gif.d.ts +3 -2
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_viz.d.ts +65 -1
- package/dist/fence/fence.js +424 -155
- 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.cli.d.cts +15 -3
- package/jssm.cli.d.ts +15 -3
- package/jssm.es5.d.cts +11 -1
- package/jssm.es6.d.ts +11 -1
- package/jssm.fence.d.ts +3 -2
- package/jssm_viz.es5.d.cts +65 -1
- package/jssm_viz.es6.d.ts +65 -1
- package/package.json +1 -1
package/jssm.cli.d.cts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The render targets supported in v1, in canonical order (the CLI `--target`
|
|
3
|
+
* enum and `--help` list order). This tuple is the single runtime source of
|
|
4
|
+
* truth: both the {@link RenderTarget} type and the `fsl-render` CLI's
|
|
5
|
+
* `--target` enum derive from it, so a new target is declared in exactly one
|
|
6
|
+
* place. Future targets (mermaid, plantuml, scxml, ascii, fsl) land here in
|
|
7
|
+
* v0.2+.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* RENDER_TARGETS.includes('gif' as RenderTarget); // true
|
|
11
|
+
*/
|
|
12
|
+
declare const RENDER_TARGETS: readonly ["svg", "dot", "png", "jpeg", "html", "gif"];
|
|
13
|
+
/**
|
|
14
|
+
* A render target the CLI and library can produce. Derived from
|
|
15
|
+
* {@link RENDER_TARGETS} so the type can never drift from the runtime enum.
|
|
4
16
|
*/
|
|
5
|
-
declare type RenderTarget =
|
|
17
|
+
declare type RenderTarget = typeof RENDER_TARGETS[number];
|
|
6
18
|
/**
|
|
7
19
|
* Options accepted by `render()` and `renderSet()`.
|
|
8
20
|
*
|
package/jssm.cli.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* The render targets supported in v1, in canonical order (the CLI `--target`
|
|
3
|
+
* enum and `--help` list order). This tuple is the single runtime source of
|
|
4
|
+
* truth: both the {@link RenderTarget} type and the `fsl-render` CLI's
|
|
5
|
+
* `--target` enum derive from it, so a new target is declared in exactly one
|
|
6
|
+
* place. Future targets (mermaid, plantuml, scxml, ascii, fsl) land here in
|
|
7
|
+
* v0.2+.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* RENDER_TARGETS.includes('gif' as RenderTarget); // true
|
|
11
|
+
*/
|
|
12
|
+
declare const RENDER_TARGETS: readonly ["svg", "dot", "png", "jpeg", "html", "gif"];
|
|
13
|
+
/**
|
|
14
|
+
* A render target the CLI and library can produce. Derived from
|
|
15
|
+
* {@link RENDER_TARGETS} so the type can never drift from the runtime enum.
|
|
4
16
|
*/
|
|
5
|
-
declare type RenderTarget =
|
|
17
|
+
declare type RenderTarget = typeof RENDER_TARGETS[number];
|
|
6
18
|
/**
|
|
7
19
|
* Options accepted by `render()` and `renderSet()`.
|
|
8
20
|
*
|
package/jssm.es5.d.cts
CHANGED
|
@@ -1920,11 +1920,21 @@ declare function fslCompletions(text: string, offset: number): CompletionItem[];
|
|
|
1920
1920
|
*/
|
|
1921
1921
|
|
|
1922
1922
|
/**
|
|
1923
|
-
* Collect color / state / shape-enum semantic spans from `text`.
|
|
1923
|
+
* Collect color / state / shape-enum semantic spans from `text`. State spans
|
|
1924
|
+
* cover transition endpoints, state-declaration subjects, group-list members
|
|
1925
|
+
* (`&G : [a b c];` — but not the group's own name, nor `&`/`...&` nested
|
|
1926
|
+
* group references), and plain-label hook subjects (`on enter x do 'act';` —
|
|
1927
|
+
* but not `&group` subjects). Every state span's `value` is the parser's
|
|
1928
|
+
* resolved name (unquoted, unescaped), while `from`/`to` cover the source
|
|
1929
|
+
* spelling including any quotes.
|
|
1924
1930
|
*
|
|
1925
1931
|
* @example
|
|
1926
1932
|
* fslSemanticSpans('state s : { color: crimson; };')
|
|
1927
1933
|
* .find(s => s.kind === 'color')?.value; // => '#dc143cff'
|
|
1934
|
+
*
|
|
1935
|
+
* @example
|
|
1936
|
+
* fslSemanticSpans('&G : [a b];\na -> b;')
|
|
1937
|
+
* .filter(s => s.kind === 'state').length; // => 4 (two members + two endpoints)
|
|
1928
1938
|
*/
|
|
1929
1939
|
declare function fslSemanticSpans(text: string): SemanticSpan[];
|
|
1930
1940
|
|
package/jssm.es6.d.ts
CHANGED
|
@@ -1920,11 +1920,21 @@ declare function fslCompletions(text: string, offset: number): CompletionItem[];
|
|
|
1920
1920
|
*/
|
|
1921
1921
|
|
|
1922
1922
|
/**
|
|
1923
|
-
* Collect color / state / shape-enum semantic spans from `text`.
|
|
1923
|
+
* Collect color / state / shape-enum semantic spans from `text`. State spans
|
|
1924
|
+
* cover transition endpoints, state-declaration subjects, group-list members
|
|
1925
|
+
* (`&G : [a b c];` — but not the group's own name, nor `&`/`...&` nested
|
|
1926
|
+
* group references), and plain-label hook subjects (`on enter x do 'act';` —
|
|
1927
|
+
* but not `&group` subjects). Every state span's `value` is the parser's
|
|
1928
|
+
* resolved name (unquoted, unescaped), while `from`/`to` cover the source
|
|
1929
|
+
* spelling including any quotes.
|
|
1924
1930
|
*
|
|
1925
1931
|
* @example
|
|
1926
1932
|
* fslSemanticSpans('state s : { color: crimson; };')
|
|
1927
1933
|
* .find(s => s.kind === 'color')?.value; // => '#dc143cff'
|
|
1934
|
+
*
|
|
1935
|
+
* @example
|
|
1936
|
+
* fslSemanticSpans('&G : [a b];\na -> b;')
|
|
1937
|
+
* .filter(s => s.kind === 'state').length; // => 4 (two members + two endpoints)
|
|
1928
1938
|
*/
|
|
1929
1939
|
declare function fslSemanticSpans(text: string): SemanticSpan[];
|
|
1930
1940
|
|
package/jssm.fence.d.ts
CHANGED
|
@@ -156,8 +156,9 @@ interface GifOptions {
|
|
|
156
156
|
* @param frames - At least one frame; all with identical width/height and
|
|
157
157
|
* `rgba.length === 4 · width · height`.
|
|
158
158
|
*
|
|
159
|
-
* @throws {JssmError} on zero frames,
|
|
160
|
-
* buffer whose length contradicts its
|
|
159
|
+
* @throws {JssmError} on zero frames, a zero-width or zero-height frame,
|
|
160
|
+
* mismatched dimensions, or an rgba buffer whose length contradicts its
|
|
161
|
+
* stated dimensions.
|
|
161
162
|
*
|
|
162
163
|
* @example
|
|
163
164
|
* const red = { rgba: new Uint8Array([255,0,0,255]), width: 1, height: 1 };
|
package/jssm_viz.es5.d.cts
CHANGED
|
@@ -3888,6 +3888,24 @@ declare function vc(col: string): string;
|
|
|
3888
3888
|
* @internal
|
|
3889
3889
|
*/
|
|
3890
3890
|
declare function doublequote(txt: string): string;
|
|
3891
|
+
/**
|
|
3892
|
+
* Reverse {@link doublequote}: turn DOT's `\"` escape back into the literal
|
|
3893
|
+
* `"` that graphviz renders into SVG `<text>` content. Used by
|
|
3894
|
+
* {@link state_svg_label_texts} to reconstruct a node's on-screen label from
|
|
3895
|
+
* the DOT label it was handed, so the fence renderer keys against exactly what
|
|
3896
|
+
* was drawn.
|
|
3897
|
+
*
|
|
3898
|
+
* ```typescript
|
|
3899
|
+
* undoublequote('a\\"b'); // 'a"b'
|
|
3900
|
+
* undoublequote('safe'); // 'safe'
|
|
3901
|
+
* ```
|
|
3902
|
+
*
|
|
3903
|
+
* @param txt A DOT-escaped attribute string (as produced by `doublequote`).
|
|
3904
|
+
* @returns The string with every `\"` collapsed back to `"`.
|
|
3905
|
+
*
|
|
3906
|
+
* @internal
|
|
3907
|
+
*/
|
|
3908
|
+
declare function undoublequote(txt: string): string;
|
|
3891
3909
|
/**
|
|
3892
3910
|
* Convert a state name into a URL-friendly slug suitable for use as the
|
|
3893
3911
|
* body of a dot/SVG node identifier. The transformation is:
|
|
@@ -4282,6 +4300,50 @@ declare type VizRenderOpts = {
|
|
|
4282
4300
|
* @internal
|
|
4283
4301
|
*/
|
|
4284
4302
|
declare function node_block_for<T>(u_jssm: Machine<T>, l_states: string[], state_index: Map<string, string>, state_kinds: Map<string, StateKind>, hide_labels: boolean, mode: RenderGroups): string;
|
|
4303
|
+
/**
|
|
4304
|
+
* The per-state group-chip map that {@link node_block_for} appends to labels
|
|
4305
|
+
* in a given render mode. Mirrors that function's mode dispatch and calls the
|
|
4306
|
+
* very same chip sources — {@link chips_for_all_groups} for `'chips'`,
|
|
4307
|
+
* {@link plan_cluster_groups} (with identical inputs) for `'cluster'` — so a
|
|
4308
|
+
* reconstructed label can never disagree with the one graphviz was handed.
|
|
4309
|
+
* `'off'`, and any machine that declares no groups, yields an empty map.
|
|
4310
|
+
*
|
|
4311
|
+
* @internal
|
|
4312
|
+
*/
|
|
4313
|
+
declare function chips_for_render_mode<T>(u_jssm: Machine<T>, l_states: string[], mode: RenderGroups): Map<string, string[]>;
|
|
4314
|
+
/**
|
|
4315
|
+
* The exact text graphviz places in each state's SVG `<text>` element(s) when
|
|
4316
|
+
* a machine is rendered via {@link machine_to_dot} / {@link fsl_to_svg_string}:
|
|
4317
|
+
* the state's display text plus any group chips the node builder appends, with
|
|
4318
|
+
* DOT's `\"` escaping undone (SVG carries the literal character). A label that
|
|
4319
|
+
* wraps across lines becomes several `<text>` elements; this returns the lines
|
|
4320
|
+
* joined by `\n`, exactly how {@link extract_state_fills} reads them back — so
|
|
4321
|
+
* the derived key and the extracted key meet at the same string.
|
|
4322
|
+
*
|
|
4323
|
+
* This is the single source of truth the static fence renderer keys its
|
|
4324
|
+
* highlight and recolor lookups against, so those lookups can never drift from
|
|
4325
|
+
* what was actually drawn — plain labels, group chips, and multi-line wraps
|
|
4326
|
+
* alike. It is built by running the node builder's own
|
|
4327
|
+
* `label_with_chips(doublequote(display_text), chips)` and inverting the one
|
|
4328
|
+
* escaping step, so it follows any change to the label format for free.
|
|
4329
|
+
*
|
|
4330
|
+
* @param u_jssm The machine being rendered.
|
|
4331
|
+
* @param opts Render flags; only `render_groups` affects the label text
|
|
4332
|
+
* (default `'cluster'`, matching `fsl_to_svg_string`).
|
|
4333
|
+
* @returns A map from each state name to its rendered SVG label text.
|
|
4334
|
+
*
|
|
4335
|
+
* ```typescript
|
|
4336
|
+
* import { sm } from 'jssm';
|
|
4337
|
+
* import { state_svg_label_texts } from 'jssm/viz';
|
|
4338
|
+
*
|
|
4339
|
+
* // a state in two groups renders a chip suffix in its node label
|
|
4340
|
+
* state_svg_label_texts(sm`&g1 : [a b]; &g2 : [a]; a -> b;`).get('a'); // 'a [g1]'
|
|
4341
|
+
* state_svg_label_texts(sm`a -> b;`).get('a'); // 'a'
|
|
4342
|
+
* ```
|
|
4343
|
+
*
|
|
4344
|
+
* @see extract_state_fills
|
|
4345
|
+
*/
|
|
4346
|
+
declare function state_svg_label_texts<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): Map<string, string>;
|
|
4285
4347
|
/**
|
|
4286
4348
|
* Render a {@link jssm.Machine} as a graphviz dot string.
|
|
4287
4349
|
*
|
|
@@ -4416,6 +4478,7 @@ declare const _test: {
|
|
|
4416
4478
|
style_for_state: typeof style_for_state;
|
|
4417
4479
|
cluster_id_for: typeof cluster_id_for;
|
|
4418
4480
|
label_with_chips: typeof label_with_chips;
|
|
4481
|
+
undoublequote: typeof undoublequote;
|
|
4419
4482
|
group_parent_map: typeof group_parent_map;
|
|
4420
4483
|
group_ancestry: typeof group_ancestry;
|
|
4421
4484
|
primary_group_for: typeof primary_group_for;
|
|
@@ -4423,6 +4486,7 @@ declare const _test: {
|
|
|
4423
4486
|
groups_to_subgraph_string: typeof groups_to_subgraph_string;
|
|
4424
4487
|
chips_for_all_groups: typeof chips_for_all_groups;
|
|
4425
4488
|
node_block_for: typeof node_block_for;
|
|
4489
|
+
chips_for_render_mode: typeof chips_for_render_mode;
|
|
4426
4490
|
edge_attr_for: typeof edge_attr_for;
|
|
4427
4491
|
edge_defaults_body: typeof edge_defaults_body;
|
|
4428
4492
|
graph_attr_for: typeof graph_attr_for;
|
|
@@ -4430,5 +4494,5 @@ declare const _test: {
|
|
|
4430
4494
|
graph_bg_color_from_config: typeof graph_bg_color_from_config;
|
|
4431
4495
|
};
|
|
4432
4496
|
|
|
4433
|
-
export { _test, build_time, configure, dot, dot_to_svg, fsl_to_dot, fsl_to_svg_element, fsl_to_svg_string, machine_to_dot, machine_to_svg_element, machine_to_svg_string, version };
|
|
4497
|
+
export { _test, build_time, configure, dot, dot_to_svg, fsl_to_dot, fsl_to_svg_element, fsl_to_svg_string, machine_to_dot, machine_to_svg_element, machine_to_svg_string, state_svg_label_texts, version };
|
|
4434
4498
|
export type { RenderGroups, VizRenderOpts };
|
package/jssm_viz.es6.d.ts
CHANGED
|
@@ -3888,6 +3888,24 @@ declare function vc(col: string): string;
|
|
|
3888
3888
|
* @internal
|
|
3889
3889
|
*/
|
|
3890
3890
|
declare function doublequote(txt: string): string;
|
|
3891
|
+
/**
|
|
3892
|
+
* Reverse {@link doublequote}: turn DOT's `\"` escape back into the literal
|
|
3893
|
+
* `"` that graphviz renders into SVG `<text>` content. Used by
|
|
3894
|
+
* {@link state_svg_label_texts} to reconstruct a node's on-screen label from
|
|
3895
|
+
* the DOT label it was handed, so the fence renderer keys against exactly what
|
|
3896
|
+
* was drawn.
|
|
3897
|
+
*
|
|
3898
|
+
* ```typescript
|
|
3899
|
+
* undoublequote('a\\"b'); // 'a"b'
|
|
3900
|
+
* undoublequote('safe'); // 'safe'
|
|
3901
|
+
* ```
|
|
3902
|
+
*
|
|
3903
|
+
* @param txt A DOT-escaped attribute string (as produced by `doublequote`).
|
|
3904
|
+
* @returns The string with every `\"` collapsed back to `"`.
|
|
3905
|
+
*
|
|
3906
|
+
* @internal
|
|
3907
|
+
*/
|
|
3908
|
+
declare function undoublequote(txt: string): string;
|
|
3891
3909
|
/**
|
|
3892
3910
|
* Convert a state name into a URL-friendly slug suitable for use as the
|
|
3893
3911
|
* body of a dot/SVG node identifier. The transformation is:
|
|
@@ -4282,6 +4300,50 @@ declare type VizRenderOpts = {
|
|
|
4282
4300
|
* @internal
|
|
4283
4301
|
*/
|
|
4284
4302
|
declare function node_block_for<T>(u_jssm: Machine<T>, l_states: string[], state_index: Map<string, string>, state_kinds: Map<string, StateKind>, hide_labels: boolean, mode: RenderGroups): string;
|
|
4303
|
+
/**
|
|
4304
|
+
* The per-state group-chip map that {@link node_block_for} appends to labels
|
|
4305
|
+
* in a given render mode. Mirrors that function's mode dispatch and calls the
|
|
4306
|
+
* very same chip sources — {@link chips_for_all_groups} for `'chips'`,
|
|
4307
|
+
* {@link plan_cluster_groups} (with identical inputs) for `'cluster'` — so a
|
|
4308
|
+
* reconstructed label can never disagree with the one graphviz was handed.
|
|
4309
|
+
* `'off'`, and any machine that declares no groups, yields an empty map.
|
|
4310
|
+
*
|
|
4311
|
+
* @internal
|
|
4312
|
+
*/
|
|
4313
|
+
declare function chips_for_render_mode<T>(u_jssm: Machine<T>, l_states: string[], mode: RenderGroups): Map<string, string[]>;
|
|
4314
|
+
/**
|
|
4315
|
+
* The exact text graphviz places in each state's SVG `<text>` element(s) when
|
|
4316
|
+
* a machine is rendered via {@link machine_to_dot} / {@link fsl_to_svg_string}:
|
|
4317
|
+
* the state's display text plus any group chips the node builder appends, with
|
|
4318
|
+
* DOT's `\"` escaping undone (SVG carries the literal character). A label that
|
|
4319
|
+
* wraps across lines becomes several `<text>` elements; this returns the lines
|
|
4320
|
+
* joined by `\n`, exactly how {@link extract_state_fills} reads them back — so
|
|
4321
|
+
* the derived key and the extracted key meet at the same string.
|
|
4322
|
+
*
|
|
4323
|
+
* This is the single source of truth the static fence renderer keys its
|
|
4324
|
+
* highlight and recolor lookups against, so those lookups can never drift from
|
|
4325
|
+
* what was actually drawn — plain labels, group chips, and multi-line wraps
|
|
4326
|
+
* alike. It is built by running the node builder's own
|
|
4327
|
+
* `label_with_chips(doublequote(display_text), chips)` and inverting the one
|
|
4328
|
+
* escaping step, so it follows any change to the label format for free.
|
|
4329
|
+
*
|
|
4330
|
+
* @param u_jssm The machine being rendered.
|
|
4331
|
+
* @param opts Render flags; only `render_groups` affects the label text
|
|
4332
|
+
* (default `'cluster'`, matching `fsl_to_svg_string`).
|
|
4333
|
+
* @returns A map from each state name to its rendered SVG label text.
|
|
4334
|
+
*
|
|
4335
|
+
* ```typescript
|
|
4336
|
+
* import { sm } from 'jssm';
|
|
4337
|
+
* import { state_svg_label_texts } from 'jssm/viz';
|
|
4338
|
+
*
|
|
4339
|
+
* // a state in two groups renders a chip suffix in its node label
|
|
4340
|
+
* state_svg_label_texts(sm`&g1 : [a b]; &g2 : [a]; a -> b;`).get('a'); // 'a [g1]'
|
|
4341
|
+
* state_svg_label_texts(sm`a -> b;`).get('a'); // 'a'
|
|
4342
|
+
* ```
|
|
4343
|
+
*
|
|
4344
|
+
* @see extract_state_fills
|
|
4345
|
+
*/
|
|
4346
|
+
declare function state_svg_label_texts<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): Map<string, string>;
|
|
4285
4347
|
/**
|
|
4286
4348
|
* Render a {@link jssm.Machine} as a graphviz dot string.
|
|
4287
4349
|
*
|
|
@@ -4416,6 +4478,7 @@ declare const _test: {
|
|
|
4416
4478
|
style_for_state: typeof style_for_state;
|
|
4417
4479
|
cluster_id_for: typeof cluster_id_for;
|
|
4418
4480
|
label_with_chips: typeof label_with_chips;
|
|
4481
|
+
undoublequote: typeof undoublequote;
|
|
4419
4482
|
group_parent_map: typeof group_parent_map;
|
|
4420
4483
|
group_ancestry: typeof group_ancestry;
|
|
4421
4484
|
primary_group_for: typeof primary_group_for;
|
|
@@ -4423,6 +4486,7 @@ declare const _test: {
|
|
|
4423
4486
|
groups_to_subgraph_string: typeof groups_to_subgraph_string;
|
|
4424
4487
|
chips_for_all_groups: typeof chips_for_all_groups;
|
|
4425
4488
|
node_block_for: typeof node_block_for;
|
|
4489
|
+
chips_for_render_mode: typeof chips_for_render_mode;
|
|
4426
4490
|
edge_attr_for: typeof edge_attr_for;
|
|
4427
4491
|
edge_defaults_body: typeof edge_defaults_body;
|
|
4428
4492
|
graph_attr_for: typeof graph_attr_for;
|
|
@@ -4430,5 +4494,5 @@ declare const _test: {
|
|
|
4430
4494
|
graph_bg_color_from_config: typeof graph_bg_color_from_config;
|
|
4431
4495
|
};
|
|
4432
4496
|
|
|
4433
|
-
export { _test, build_time, configure, dot, dot_to_svg, fsl_to_dot, fsl_to_svg_element, fsl_to_svg_string, machine_to_dot, machine_to_svg_element, machine_to_svg_string, version };
|
|
4497
|
+
export { _test, build_time, configure, dot, dot_to_svg, fsl_to_dot, fsl_to_svg_element, fsl_to_svg_string, machine_to_dot, machine_to_svg_element, machine_to_svg_string, state_svg_label_texts, version };
|
|
4434
4498
|
export type { RenderGroups, VizRenderOpts };
|