jssm 5.118.0 → 5.120.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 +90 -7
- package/custom-elements.json +138 -0
- package/dist/cdn/viz.js +24901 -0
- package/dist/cli/fsl-render.cjs +9 -0
- package/dist/cli/fsl.cjs +8 -0
- package/dist/deno/README.md +90 -7
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_viz.d.ts +16 -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_viz.es5.d.cts +16 -1
- package/jssm_viz.es6.d.ts +16 -1
- package/package.json +57 -6
package/README.md
CHANGED
|
@@ -18,10 +18,10 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
* Generated for version 5.
|
|
21
|
+
* Generated for version 5.119.0 at 5/13/2026, 4:32:50 PM
|
|
22
22
|
|
|
23
23
|
-->
|
|
24
|
-
# jssm 5.
|
|
24
|
+
# jssm 5.119.0
|
|
25
25
|
|
|
26
26
|
[**Try the live editor**](https://stonecypher.github.io/jssm-viz-demo/graph_explorer.html) ·
|
|
27
27
|
[Documentation](https://stonecypher.github.io/jssm/docs/) ·
|
|
@@ -120,6 +120,89 @@ usage patterns.
|
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
|
|
123
|
+
<br/>
|
|
124
|
+
|
|
125
|
+
## Command-line interface
|
|
126
|
+
|
|
127
|
+
`jssm` ships a CLI for rendering FSL machines to images and other formats.
|
|
128
|
+
|
|
129
|
+
### Installation
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
npm install -g jssm
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
This installs three binaries: `fsl` (the dispatcher), `jssm` (alias for `fsl`), and `fsl-render` (the render plugin).
|
|
136
|
+
|
|
137
|
+
### Render
|
|
138
|
+
|
|
139
|
+
Render a single machine to SVG (default):
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
fsl render machine.fsl
|
|
143
|
+
# → machine.svg next to input
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Specify a format:
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
fsl render machine.fsl --target=png --width=800
|
|
150
|
+
fsl render machine.fsl --target=dot --stdout > machine.dot
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Render multiple machines:
|
|
154
|
+
|
|
155
|
+
```sh
|
|
156
|
+
fsl render *.fsl --target=svg --out-dir=./diagrams
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Pipe FSL via stdin:
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
cat machine.fsl | fsl render --target=dot | dot -Tpng > out.png
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Plugin architecture
|
|
166
|
+
|
|
167
|
+
Every `fsl-<name>` executable on PATH is dispatched when you run `fsl <name>`. Third-party plugins follow the same contract as first-party `fsl-render`. See `notes/superpowers/specs/2026-05-12-fsl-cli-design.md` for the contract.
|
|
168
|
+
|
|
169
|
+
### Library API
|
|
170
|
+
|
|
171
|
+
The same render functions are available programmatically:
|
|
172
|
+
|
|
173
|
+
```js
|
|
174
|
+
import { render, renderSet } from 'jssm/cli';
|
|
175
|
+
|
|
176
|
+
const result = await render(fslText, { target: 'svg' });
|
|
177
|
+
if (result.kind === 'text') console.log(result.content);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
<br/>
|
|
183
|
+
|
|
184
|
+
## Web Components
|
|
185
|
+
|
|
186
|
+
`jssm` ships Lit-based web components for use in plain HTML or as a base for framework wrappers.
|
|
187
|
+
|
|
188
|
+
CDN one-liner (with an import map for `@viz-js/viz`):
|
|
189
|
+
|
|
190
|
+
```html
|
|
191
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/jssm/dist/cdn/viz.js"></script>
|
|
192
|
+
<jssm-viz fsl="Off -> On -> Off;"></jssm-viz>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
npm one-liner:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import 'jssm/wc/viz/define';
|
|
199
|
+
// then use <jssm-viz fsl="..."> anywhere
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Full documentation: [src/doc_md/WebComponents.md](src/doc_md/WebComponents.md).
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
123
206
|
<br/>
|
|
124
207
|
|
|
125
208
|
## 60-second tour
|
|
@@ -198,7 +281,7 @@ That decision shows up everywhere downstream:
|
|
|
198
281
|
or run `npm run benny` against your own machine.
|
|
199
282
|
|
|
200
283
|
- **More thoroughly tested than any other JavaScript state-machine
|
|
201
|
-
library.** 5,
|
|
284
|
+
library.** 5,809 tests at 100.0% line coverage
|
|
202
285
|
([report](https://coveralls.io/github/StoneCypher/jssm)), plus
|
|
203
286
|
fuzz testing via `fast-check`, with parser test data across ten natural
|
|
204
287
|
languages and Emoji.
|
|
@@ -331,11 +414,11 @@ If your contribution is missing here, please open an issue.
|
|
|
331
414
|
|
|
332
415
|
<br/>
|
|
333
416
|
|
|
334
|
-
***5,
|
|
417
|
+
***5,809 tests***, run 56,596 times.
|
|
335
418
|
|
|
336
|
-
- 5,
|
|
337
|
-
-
|
|
338
|
-
- 3,
|
|
419
|
+
- 5,296 specs with 100.0% coverage
|
|
420
|
+
- 513 fuzz tests with 59.2% coverage
|
|
421
|
+
- 3,593 TypeScript lines - 1.6 tests per line, 15.8 generated tests per line
|
|
339
422
|
|
|
340
423
|
[](https://github.com/StoneCypher/jssm/actions)
|
|
341
424
|
[](https://www.npmjs.com/package/jssm)
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/ts/wc/jssm_viz_wc.ts",
|
|
8
|
+
"declarations": [
|
|
9
|
+
{
|
|
10
|
+
"kind": "function",
|
|
11
|
+
"name": "normalize_viz_error",
|
|
12
|
+
"return": {
|
|
13
|
+
"type": {
|
|
14
|
+
"text": ""
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"name": "e",
|
|
20
|
+
"type": {
|
|
21
|
+
"text": "unknown"
|
|
22
|
+
},
|
|
23
|
+
"description": "The thrown value to normalize."
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"description": "Normalize an arbitrary thrown value into a JssmVizErrorDetail.\r\nAccepts anything (Error instances, JssmErrors with `.location`, plain\r\nstrings, etc.) and always produces a string `message`.\r\n\r\n```typescript\r\nnormalize_viz_error(new Error('boom'));\r\n// => { message: 'boom', location: undefined }\r\n\r\nnormalize_viz_error({ message: 'parse failed', location: { line: 1 } });\r\n// => { message: 'parse failed', location: { line: 1 } }\r\n\r\nnormalize_viz_error('bare string failure');\r\n// => { message: 'bare string failure', location: undefined }\r\n```"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"kind": "class",
|
|
30
|
+
"description": "Web component that renders a jssm machine as inline SVG.",
|
|
31
|
+
"name": "JssmViz",
|
|
32
|
+
"cssProperties": [
|
|
33
|
+
{
|
|
34
|
+
"description": "Minimum height of the rendered SVG container.",
|
|
35
|
+
"name": "--jssm-viz-min-height",
|
|
36
|
+
"default": "100px"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"members": [
|
|
40
|
+
{
|
|
41
|
+
"kind": "field",
|
|
42
|
+
"name": "fsl",
|
|
43
|
+
"type": {
|
|
44
|
+
"text": "string"
|
|
45
|
+
},
|
|
46
|
+
"default": "''",
|
|
47
|
+
"description": "FSL source to render.",
|
|
48
|
+
"attribute": "fsl"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"kind": "field",
|
|
52
|
+
"name": "engine",
|
|
53
|
+
"type": {
|
|
54
|
+
"text": "string | undefined"
|
|
55
|
+
},
|
|
56
|
+
"default": "undefined",
|
|
57
|
+
"description": "Optional Graphviz layout engine override (e.g. 'dot', 'neato').",
|
|
58
|
+
"attribute": "engine"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"kind": "field",
|
|
62
|
+
"name": "_svg",
|
|
63
|
+
"type": {
|
|
64
|
+
"text": "string"
|
|
65
|
+
},
|
|
66
|
+
"privacy": "private",
|
|
67
|
+
"default": "''"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"kind": "method",
|
|
71
|
+
"name": "_renderSvg",
|
|
72
|
+
"privacy": "private",
|
|
73
|
+
"return": {
|
|
74
|
+
"type": {
|
|
75
|
+
"text": ""
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"description": "Render the current `fsl` source to an SVG string via the headless\r\n`fsl_to_svg_string` pipeline. Updates `_svg` on success; emits a\r\n`viz-error` `CustomEvent` on failure. Guards against stale results\r\nwhen `fsl` changes mid-flight."
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"events": [
|
|
82
|
+
{
|
|
83
|
+
"name": "viz-error",
|
|
84
|
+
"type": {
|
|
85
|
+
"text": "CustomEvent<{ message: string; location?: unknown }>"
|
|
86
|
+
},
|
|
87
|
+
"description": "Fires when the FSL source fails to parse or render."
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"attributes": [
|
|
91
|
+
{
|
|
92
|
+
"name": "fsl",
|
|
93
|
+
"type": {
|
|
94
|
+
"text": "string"
|
|
95
|
+
},
|
|
96
|
+
"default": "''",
|
|
97
|
+
"description": "FSL source to render.",
|
|
98
|
+
"fieldName": "fsl"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "engine",
|
|
102
|
+
"type": {
|
|
103
|
+
"text": "string | undefined"
|
|
104
|
+
},
|
|
105
|
+
"default": "undefined",
|
|
106
|
+
"description": "Optional Graphviz layout engine override (e.g. 'dot', 'neato').",
|
|
107
|
+
"fieldName": "engine"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"superclass": {
|
|
111
|
+
"name": "LitElement",
|
|
112
|
+
"package": "lit"
|
|
113
|
+
},
|
|
114
|
+
"tagName": "jssm-viz",
|
|
115
|
+
"customElement": true
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"exports": [
|
|
119
|
+
{
|
|
120
|
+
"kind": "js",
|
|
121
|
+
"name": "normalize_viz_error",
|
|
122
|
+
"declaration": {
|
|
123
|
+
"name": "normalize_viz_error",
|
|
124
|
+
"module": "src/ts/wc/jssm_viz_wc.ts"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"kind": "js",
|
|
129
|
+
"name": "JssmViz",
|
|
130
|
+
"declaration": {
|
|
131
|
+
"name": "JssmViz",
|
|
132
|
+
"module": "src/ts/wc/jssm_viz_wc.ts"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|