jssm 5.113.0 → 5.119.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/README.md +31 -7
- package/custom-elements.json +138 -0
- package/dist/cdn/viz.js +24901 -0
- package/dist/deno/README.md +31 -7
- package/dist/deno/jssm.d.ts +70 -5
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_constants.d.ts +58 -1
- package/dist/deno/jssm_viz.d.ts +57 -7
- package/dist/deno/version.d.ts +13 -1
- 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/viz.define.js +6 -0
- package/dist/wc/viz.js +135 -0
- package/jssm.es5.d.cts +143 -4
- package/jssm.es6.d.ts +143 -4
- package/jssm_viz.es5.d.cts +127 -10
- package/jssm_viz.es6.d.ts +127 -10
- package/package.json +36 -6
|
@@ -34,4 +34,61 @@ declare const shapes: string[];
|
|
|
34
34
|
*
|
|
35
35
|
*/
|
|
36
36
|
declare const named_colors: string[];
|
|
37
|
-
|
|
37
|
+
/*******
|
|
38
|
+
*
|
|
39
|
+
* Character ranges accepted by the FSL grammar for identifier and label
|
|
40
|
+
* tokens. Each entry is an inclusive `{from, to}` range of single Unicode
|
|
41
|
+
* characters. Single-character entries (e.g. `.`) appear with `from === to`.
|
|
42
|
+
*
|
|
43
|
+
* These are intended for tooling, validators, and editors that need to know
|
|
44
|
+
* which characters are legal in a given FSL token position without re-parsing
|
|
45
|
+
* the PEG grammar.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Inclusive character ranges accepted by `AtomLetter` — i.e., the characters
|
|
50
|
+
* legal in any but the first position of an FSL state name (atom).
|
|
51
|
+
*
|
|
52
|
+
* Includes ASCII digits/letters and the symbols
|
|
53
|
+
* `.`, `+`, `_`, `^`, `(`, `)`, `*`, `&`, `$`, `#`, `@`, `!`, `?`, `,`,
|
|
54
|
+
* plus the high-Unicode range `U+0080`–`U+FFFF`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* state_name_chars.some(r => 'A' >= r.from && 'A' <= r.to); // true
|
|
58
|
+
*/
|
|
59
|
+
declare const state_name_chars: ReadonlyArray<{
|
|
60
|
+
from: string;
|
|
61
|
+
to: string;
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Inclusive character ranges accepted by `AtomFirstLetter` — i.e., the
|
|
65
|
+
* characters legal in the first position of an FSL state name (atom).
|
|
66
|
+
*
|
|
67
|
+
* Notably narrower than {@link state_name_chars}: omits `+`, `(`, `)`, `&`,
|
|
68
|
+
* `#`, `@`. Includes ASCII digits/letters, `.`, `_`, `!`, `$`, `^`, `*`,
|
|
69
|
+
* `?`, `,`, and the high-Unicode range `U+0080`–`U+FFFF`.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* state_name_first_chars.some(r => '+' >= r.from && '+' <= r.to); // false
|
|
73
|
+
*/
|
|
74
|
+
declare const state_name_first_chars: ReadonlyArray<{
|
|
75
|
+
from: string;
|
|
76
|
+
to: string;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Inclusive character ranges accepted by `ActionLabelUnescaped` — i.e., the
|
|
80
|
+
* characters legal inside a single-quoted action label without escaping.
|
|
81
|
+
* Space (`U+0020`) is included; the apostrophe `'` (`U+0027`) is explicitly
|
|
82
|
+
* excluded since it terminates the label.
|
|
83
|
+
*
|
|
84
|
+
* Three ranges: `U+0020`–`U+0026`, `U+0028`–`U+005B`, `U+005D`–`U+FFFF`.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* action_label_chars.some(r => ' ' >= r.from && ' ' <= r.to); // true
|
|
88
|
+
* action_label_chars.some(r => "'" >= r.from && "'" <= r.to); // false
|
|
89
|
+
*/
|
|
90
|
+
declare const action_label_chars: ReadonlyArray<{
|
|
91
|
+
from: string;
|
|
92
|
+
to: string;
|
|
93
|
+
}>;
|
|
94
|
+
export { gviz_shapes, shapes, named_colors, state_name_chars, state_name_first_chars, action_label_chars, };
|
package/dist/deno/jssm_viz.d.ts
CHANGED
|
@@ -88,30 +88,49 @@ declare function style_for_state<T>(u_jssm: jssm.Machine<T>, state: string): str
|
|
|
88
88
|
/**
|
|
89
89
|
* Render a {@link jssm.Machine} as a graphviz dot string.
|
|
90
90
|
*
|
|
91
|
+
* An optional `footer` may be supplied via `opts.footer`; it is emitted
|
|
92
|
+
* verbatim just before the closing `}` of the dot source, after all
|
|
93
|
+
* arrange declarations. This is a function-argument-only feature for
|
|
94
|
+
* the moment — a machine-attribute equivalent is planned as a follow-up.
|
|
95
|
+
*
|
|
91
96
|
* ```typescript
|
|
92
97
|
* import { sm } from 'jssm';
|
|
93
98
|
* import { machine_to_dot } from 'jssm/viz';
|
|
94
99
|
*
|
|
95
100
|
* const dot = machine_to_dot(sm`a -> b;`);
|
|
96
101
|
* // 'digraph G { ... }'
|
|
102
|
+
*
|
|
103
|
+
* const dot_with_footer = machine_to_dot(sm`a -> b;`, { footer: 'labelloc="b"; label="caption";' });
|
|
104
|
+
* // 'digraph G { ... labelloc="b"; label="caption"; }'
|
|
97
105
|
* ```
|
|
98
106
|
*
|
|
99
107
|
* @param u_jssm The machine to render.
|
|
108
|
+
* @param opts Optional rendering options.
|
|
109
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}`.
|
|
100
110
|
* @returns A complete graphviz dot source string.
|
|
101
111
|
*/
|
|
102
|
-
declare function machine_to_dot<T>(u_jssm: jssm.Machine<T
|
|
112
|
+
declare function machine_to_dot<T>(u_jssm: jssm.Machine<T>, opts?: {
|
|
113
|
+
footer?: string;
|
|
114
|
+
}): string;
|
|
103
115
|
/**
|
|
104
116
|
* Render an FSL string directly to graphviz dot source.
|
|
105
117
|
*
|
|
106
118
|
* ```typescript
|
|
107
119
|
* import { fsl_to_dot } from 'jssm/viz';
|
|
108
120
|
* const dot = fsl_to_dot('a -> b;');
|
|
121
|
+
*
|
|
122
|
+
* const dot_with_footer = fsl_to_dot('a -> b;', { footer: 'label="caption";' });
|
|
123
|
+
* // 'digraph G { ... label="caption"; }'
|
|
109
124
|
* ```
|
|
110
125
|
*
|
|
111
126
|
* @param fsl The FSL source.
|
|
127
|
+
* @param opts Optional rendering options.
|
|
128
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}`.
|
|
112
129
|
* @returns A complete graphviz dot source string.
|
|
113
130
|
*/
|
|
114
|
-
declare function fsl_to_dot(fsl: string
|
|
131
|
+
declare function fsl_to_dot(fsl: string, opts?: {
|
|
132
|
+
footer?: string;
|
|
133
|
+
}): string;
|
|
115
134
|
/**
|
|
116
135
|
* Render a graphviz dot source string to SVG using `@viz-js/viz`. The
|
|
117
136
|
* underlying viz instance is lazy-initialized on first call and cached for
|
|
@@ -119,42 +138,73 @@ declare function fsl_to_dot(fsl: string): string;
|
|
|
119
138
|
*
|
|
120
139
|
* ```typescript
|
|
121
140
|
* const svg = await dot_to_svg('digraph G { a -> b }');
|
|
141
|
+
* const svg_neato = await dot_to_svg('digraph G { a -> b }', { engine: 'neato' });
|
|
122
142
|
* ```
|
|
123
143
|
*
|
|
124
144
|
* @param dot Graphviz dot source.
|
|
145
|
+
* @param options Optional renderer overrides.
|
|
146
|
+
* @param options.engine Graphviz layout engine to use (e.g. `'dot'`,
|
|
147
|
+
* `'neato'`, `'circo'`). Unrecognized engine names cause `@viz-js/viz`
|
|
148
|
+
* to throw at render time.
|
|
125
149
|
* @returns A promise resolving to an SVG XML string.
|
|
126
150
|
*/
|
|
127
|
-
declare function dot_to_svg(dot: string
|
|
151
|
+
declare function dot_to_svg(dot: string, options?: {
|
|
152
|
+
engine?: string;
|
|
153
|
+
}): Promise<string>;
|
|
128
154
|
/**
|
|
129
155
|
* Render an FSL string directly to SVG.
|
|
130
156
|
*
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const svg = await fsl_to_svg_string('a -> b;');
|
|
159
|
+
* const svg_neato = await fsl_to_svg_string('a -> b;', { engine: 'neato' });
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
131
162
|
* @param fsl The FSL source.
|
|
163
|
+
* @param opts Optional rendering options.
|
|
164
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
|
|
165
|
+
* @param opts.engine Graphviz layout engine to use (e.g. `'dot'`, `'neato'`, `'circo'`).
|
|
166
|
+
* Unrecognized engine names cause `@viz-js/viz` to throw at render time.
|
|
132
167
|
* @returns A promise resolving to an SVG XML string.
|
|
133
168
|
*/
|
|
134
|
-
declare function fsl_to_svg_string(fsl: string
|
|
169
|
+
declare function fsl_to_svg_string(fsl: string, opts?: {
|
|
170
|
+
footer?: string;
|
|
171
|
+
engine?: string;
|
|
172
|
+
}): Promise<string>;
|
|
135
173
|
/**
|
|
136
174
|
* Render a {@link jssm.Machine} to SVG.
|
|
137
175
|
*
|
|
138
176
|
* @param u_jssm The machine to render.
|
|
177
|
+
* @param opts Optional rendering options.
|
|
178
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
|
|
139
179
|
* @returns A promise resolving to an SVG XML string.
|
|
140
180
|
*/
|
|
141
|
-
declare function machine_to_svg_string<T>(u_jssm: jssm.Machine<T
|
|
181
|
+
declare function machine_to_svg_string<T>(u_jssm: jssm.Machine<T>, opts?: {
|
|
182
|
+
footer?: string;
|
|
183
|
+
}): Promise<string>;
|
|
142
184
|
/**
|
|
143
185
|
* Render an FSL string directly to a parsed `SVGSVGElement`.
|
|
144
186
|
*
|
|
145
187
|
* @param fsl The FSL source.
|
|
188
|
+
* @param opts Optional rendering options.
|
|
189
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
|
|
146
190
|
* @returns A promise resolving to a parsed `SVGSVGElement`.
|
|
147
191
|
* @throws {JssmError} if no `DOMParser` is available (Node without `configure`).
|
|
148
192
|
*/
|
|
149
|
-
declare function fsl_to_svg_element(fsl: string
|
|
193
|
+
declare function fsl_to_svg_element(fsl: string, opts?: {
|
|
194
|
+
footer?: string;
|
|
195
|
+
}): Promise<SVGSVGElement>;
|
|
150
196
|
/**
|
|
151
197
|
* Render a {@link jssm.Machine} to a parsed `SVGSVGElement`.
|
|
152
198
|
*
|
|
153
199
|
* @param u_jssm The machine to render.
|
|
200
|
+
* @param opts Optional rendering options.
|
|
201
|
+
* @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
|
|
154
202
|
* @returns A promise resolving to a parsed `SVGSVGElement`.
|
|
155
203
|
* @throws {JssmError} if no `DOMParser` is available (Node without `configure`).
|
|
156
204
|
*/
|
|
157
|
-
declare function machine_to_svg_element<T>(u_jssm: jssm.Machine<T
|
|
205
|
+
declare function machine_to_svg_element<T>(u_jssm: jssm.Machine<T>, opts?: {
|
|
206
|
+
footer?: string;
|
|
207
|
+
}): Promise<SVGSVGElement>;
|
|
158
208
|
/**
|
|
159
209
|
* Compatibility wrapper for {@link machine_to_dot}, retained from
|
|
160
210
|
* jssm-viz. Will be removed in the next major.
|
package/dist/deno/version.d.ts
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The published semantic version of the jssm package this build was cut from.
|
|
3
|
+
* Mirrored from `package.json` by `src/buildjs/makever.cjs` at build time.
|
|
4
|
+
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
5
|
+
* snapshots so that deserializers can detect version-skew.
|
|
6
|
+
*/
|
|
7
|
+
declare const version: string;
|
|
8
|
+
/**
|
|
9
|
+
* The Unix epoch timestamp (in milliseconds) at which this build was produced,
|
|
10
|
+
* written by `src/buildjs/makever.cjs`. Useful for distinguishing builds
|
|
11
|
+
* with the same `version` string during development, and for diagnostic logs.
|
|
12
|
+
*/
|
|
13
|
+
declare const build_time: number;
|
|
2
14
|
export { version, build_time };
|