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.
Files changed (53) hide show
  1. package/README.md +7 -7
  2. package/custom-elements.json +47 -47
  3. package/dist/cdn/instance.js +5 -3
  4. package/dist/cdn/viz.js +1 -1
  5. package/dist/cli/fsl-export-system-prompt.cjs +27 -24
  6. package/dist/cli/fsl-render.cjs +1 -1
  7. package/dist/cli/fsl.cjs +1 -1
  8. package/dist/cli/lib.cjs +1 -1
  9. package/dist/cli/lib.mjs +1 -1
  10. package/dist/cm6/fsl_language.js +10 -14
  11. package/dist/deno/README.md +7 -7
  12. package/dist/deno/fence.d.ts +0 -1
  13. package/dist/deno/fsl_fence_highlight.d.ts +0 -4
  14. package/dist/deno/fsl_fence_render.d.ts +0 -8
  15. package/dist/deno/fsl_gif.d.ts +0 -8
  16. package/dist/deno/fsl_markdown_fence.d.ts +0 -5
  17. package/dist/deno/fsl_svg_patch.d.ts +0 -6
  18. package/dist/deno/fsl_walk.d.ts +0 -2
  19. package/dist/deno/jssm.d.ts +214 -503
  20. package/dist/deno/jssm.js +1 -1
  21. package/dist/deno/jssm_compiler.d.ts +1 -1
  22. package/dist/deno/jssm_constants.d.ts +0 -3
  23. package/dist/deno/jssm_intern.d.ts +0 -15
  24. package/dist/deno/jssm_theme.d.ts +2 -2
  25. package/dist/deno/jssm_types.d.ts +13 -34
  26. package/dist/deno/jssm_util.d.ts +20 -6
  27. package/dist/deno/jssm_viz.d.ts +5 -51
  28. package/dist/es6/cm6/fsl_language.d.ts +0 -2
  29. package/dist/fence/fence.js +1651 -1833
  30. package/dist/jssm.es5.cjs +1 -1
  31. package/dist/jssm.es5.iife.js +1 -1
  32. package/dist/jssm.es6.mjs +1 -1
  33. package/dist/jssm_viz.cjs +1 -1
  34. package/dist/jssm_viz.iife.cjs +1 -1
  35. package/dist/jssm_viz.mjs +1 -1
  36. package/dist/wc/docs.define.js +0 -5
  37. package/dist/wc/docs.js +79 -43
  38. package/dist/wc/editor.define.js +0 -5
  39. package/dist/wc/editor.js +1 -7
  40. package/dist/wc/instance.define.js +0 -6
  41. package/dist/wc/instance.js +93 -115
  42. package/dist/wc/viz.define.js +0 -6
  43. package/dist/wc/viz.js +22 -36
  44. package/dist/wc/widgets.define.js +0 -5
  45. package/dist/wc/widgets.js +117 -95
  46. package/jssm.cli.d.cts +0 -8
  47. package/jssm.cli.d.ts +0 -8
  48. package/jssm.es5.d.cts +449 -808
  49. package/jssm.es6.d.ts +449 -808
  50. package/jssm.fence.d.ts +213 -508
  51. package/jssm_viz.es5.d.cts +216 -529
  52. package/jssm_viz.es6.d.ts +216 -529
  53. package/package.json +16 -10
@@ -9,11 +9,9 @@ export { FslViz } from './viz.js';
9
9
  /**
10
10
  * Returns true when `tag_name` is exactly `fsl-<suffix>` or `jssm-<suffix>`
11
11
  * (case-insensitive).
12
- *
13
12
  * @param tag_name - The element tag name to test (e.g. `"FSL-VIZ"`, `"jssm-viz"`).
14
13
  * @param suffix - The suffix to match after the prefix (e.g. `"viz"`).
15
14
  * @returns `true` when `tag_name` is `fsl-<suffix>` or `jssm-<suffix>`.
16
- *
17
15
  * @example
18
16
  * wc_suffix_matches('FSL-VIZ', 'viz'); // true
19
17
  * wc_suffix_matches('jssm-viz', 'viz'); // true
@@ -27,18 +25,15 @@ export { FslViz } from './viz.js';
27
25
  * callers pass the canonical class and a thin subclass for the synonym.
28
26
  * The function is idempotent: if either tag is already registered it skips
29
27
  * that `define` call rather than throwing.
30
- *
31
28
  * @param canonical_tag - The primary tag name (e.g. `"fsl-instance"`).
32
29
  * @param synonym_tag - The alias tag name (e.g. `"jssm-instance"`).
33
30
  * @param CanonicalClass - Constructor to register under `canonical_tag`.
34
31
  * @param SynonymClass - Constructor to register under `synonym_tag`
35
32
  * (must be a distinct class from `CanonicalClass`).
36
- *
37
33
  * @example
38
34
  * class FslInstance extends HTMLElement {}
39
35
  * class JssmInstance extends FslInstance {}
40
36
  * define_with_synonym('fsl-instance', 'jssm-instance', FslInstance, JssmInstance);
41
- *
42
37
  * @see closest_wc
43
38
  */
44
39
  function define_with_synonym(canonical_tag, synonym_tag, CanonicalClass, SynonymClass) {
@@ -50,7 +45,6 @@ function define_with_synonym(canonical_tag, synonym_tag, CanonicalClass, Synonym
50
45
 
51
46
  /**
52
47
  * Thin subclass so `<jssm-viz>` registers under a distinct constructor.
53
- *
54
48
  * @deprecated The `jssm-*` tag and the `JssmViz` class alias are deprecated
55
49
  * since v5 in favor of the canonical `<fsl-viz>` / {@link FslViz}, for
56
50
  * fsl.tools brand alignment. They remain functional but are slated for
package/dist/wc/viz.js CHANGED
@@ -11,11 +11,9 @@ import { machine_to_svg_string, fsl_to_svg_string } from 'jssm/viz';
11
11
  /**
12
12
  * Returns true when `tag_name` is exactly `fsl-<suffix>` or `jssm-<suffix>`
13
13
  * (case-insensitive).
14
- *
15
14
  * @param tag_name - The element tag name to test (e.g. `"FSL-VIZ"`, `"jssm-viz"`).
16
15
  * @param suffix - The suffix to match after the prefix (e.g. `"viz"`).
17
16
  * @returns `true` when `tag_name` is `fsl-<suffix>` or `jssm-<suffix>`.
18
- *
19
17
  * @example
20
18
  * wc_suffix_matches('FSL-VIZ', 'viz'); // true
21
19
  * wc_suffix_matches('jssm-viz', 'viz'); // true
@@ -25,15 +23,12 @@ import { machine_to_svg_string, fsl_to_svg_string } from 'jssm/viz';
25
23
  /**
26
24
  * Returns the nearest ancestor of `el` (or `el` itself) whose tag is
27
25
  * `fsl-<suffix>` or `jssm-<suffix>`, or `null` if none exists.
28
- *
29
26
  * @param el - The element to start the search from.
30
27
  * @param suffix - The suffix to match (e.g. `"instance"`).
31
28
  * @returns The closest matching ancestor element, or `null`.
32
- *
33
29
  * @example
34
30
  * // <fsl-instance><div id="k"></div></fsl-instance>
35
31
  * closest_wc(document.getElementById('k'), 'instance'); // <fsl-instance>
36
- *
37
32
  * @see wc_suffix_matches
38
33
  */
39
34
  function closest_wc(el, suffix) {
@@ -50,10 +45,8 @@ function closest_wc(el, suffix) {
50
45
  *
51
46
  * Each edge's label text is hoisted out of its edge group to the very top.
52
47
  * Markup that isn't graphviz output (no `g.graph`) is returned untouched.
53
- *
54
48
  * @param svg - SVG markup from the viz pipeline (`machine_to_svg_string`, etc.).
55
49
  * @returns The reordered SVG markup; identical input for non-graphviz SVG.
56
- *
57
50
  * @example
58
51
  * // <g class="graph"><polygon/>…<g class="node"/><g class="edge"><path/><text/></g></g>
59
52
  * // becomes: <g class="graph"><polygon/><g class="edge"><path/></g><g class="node"/><text/></g>
@@ -70,23 +63,23 @@ function reorder_svg_layers(svg) {
70
63
  // Hoist every edge's label out of its group so it lands on the top layer.
71
64
  const labels = [];
72
65
  for (const edge of edges) {
73
- for (const text of [...edge.querySelectorAll(':scope > text')]) {
66
+ for (const text of edge.querySelectorAll(':scope > text')) {
74
67
  labels.push(text);
75
68
  }
76
69
  }
77
70
  // appendChild moves a node to the end (top of the stack), so appending in
78
71
  // back-to-front order yields: background, edges, nodes, labels.
79
72
  if (background !== null) {
80
- graph.appendChild(background);
73
+ graph.append(background);
81
74
  }
82
75
  for (const edge of edges) {
83
- graph.appendChild(edge);
76
+ graph.append(edge);
84
77
  }
85
78
  for (const node of nodes) {
86
- graph.appendChild(node);
79
+ graph.append(node);
87
80
  }
88
81
  for (const label of labels) {
89
- graph.appendChild(label);
82
+ graph.append(label);
90
83
  }
91
84
  return new XMLSerializer().serializeToString(doc);
92
85
  }
@@ -112,7 +105,6 @@ var __decorate = (undefined && undefined.__decorate) || function (decorators, ta
112
105
  * normalize_viz_error('bare string failure');
113
106
  * // => { message: 'bare string failure', location: undefined }
114
107
  * ```
115
- *
116
108
  * @param e The thrown value to normalize.
117
109
  * @returns A `{ message, location }` object suitable for use as the
118
110
  * `detail` of a `viz-error` `CustomEvent`.
@@ -123,9 +115,11 @@ function normalize_viz_error(e) {
123
115
  const raw_message = rec.message;
124
116
  const message = (typeof raw_message === 'string' && raw_message.length > 0)
125
117
  ? raw_message
118
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string -- intentional last-resort coercion: Error/JssmError throws stringify meaningfully, and '[object Object]' is the accepted fallback for exotic message-less objects
126
119
  : String(e);
127
120
  return { message, location: rec.location };
128
121
  }
122
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string -- unreachable for objects: the typeof-object branch above returns, so `e` is a primitive (or function) here and String() is meaningful
129
123
  return { message: String(e), location: undefined };
130
124
  }
131
125
  /**
@@ -141,7 +135,6 @@ function normalize_viz_error(e) {
141
135
  * bind to the parent's machine and re-render on every `transition`
142
136
  * event. The element's own `fsl` attribute is ignored in this mode;
143
137
  * supplying it emits a `console.warn` for developer feedback.
144
- *
145
138
  * @element fsl-viz
146
139
  * @cssproperty [--jssm-viz-min-height=100px] - Minimum height of the rendered SVG container.
147
140
  * @fires {CustomEvent<{ message: string; location?: unknown }>} viz-error - Fires when the FSL source fails to parse or render.
@@ -179,7 +172,6 @@ class FslViz extends LitElement {
179
172
  * `engine` change — but only in standalone mode. In nested mode the
180
173
  * `fsl` attribute is ignored; renders are driven by the parent machine's
181
174
  * transition events instead.
182
- *
183
175
  * @param changed - Map of changed reactive properties supplied by Lit.
184
176
  */
185
177
  willUpdate(changed) {
@@ -188,12 +180,12 @@ class FslViz extends LitElement {
188
180
  // parent's transition events. `engine` changes still re-render
189
181
  // because they apply to whichever source is in use.
190
182
  if (changed.has('engine')) {
191
- this._rerenderFromHostMachine();
183
+ void this._rerenderFromHostMachine();
192
184
  }
193
185
  return;
194
186
  }
195
187
  if (changed.has('fsl') || changed.has('engine')) {
196
- this._renderSvg();
188
+ void this._renderSvg();
197
189
  }
198
190
  }
199
191
  /**
@@ -216,7 +208,6 @@ class FslViz extends LitElement {
216
208
  // attribute is almost certainly a bug. Warn but proceed — the parent
217
209
  // owns the machine.
218
210
  if (typeof this.fsl === 'string' && this.fsl.trim().length > 0) {
219
- // eslint-disable-next-line no-console
220
211
  console.warn('<fsl-viz>: `fsl` ignored when nested inside <fsl-instance>; parent owns the machine');
221
212
  }
222
213
  this._parent_host = host;
@@ -232,14 +223,14 @@ class FslViz extends LitElement {
232
223
  }
233
224
  let sub;
234
225
  try {
235
- sub = host.machine.on('transition', () => { this._rerenderFromHostMachine(); });
226
+ sub = host.machine.on('transition', () => { void this._rerenderFromHostMachine(); });
236
227
  }
237
- catch (e) {
228
+ catch (error) {
238
229
  // The parent existed but its machine wasn't ready / threw. Emit
239
230
  // a viz-error so the consumer learns about it instead of silently
240
231
  // showing nothing.
241
232
  this.dispatchEvent(new CustomEvent('viz-error', {
242
- detail: normalize_viz_error(e),
233
+ detail: normalize_viz_error(error),
243
234
  bubbles: true,
244
235
  composed: true,
245
236
  }));
@@ -250,13 +241,14 @@ class FslViz extends LitElement {
250
241
  // rebuild): the old subscription is on a dead machine object.
251
242
  const on_rebuild = () => {
252
243
  sub();
253
- sub = host.machine.on('transition', () => { this._rerenderFromHostMachine(); });
244
+ sub = host.machine.on('transition', () => { void this._rerenderFromHostMachine(); });
254
245
  this._parent_sub = sub;
255
- this._rerenderFromHostMachine();
246
+ void this._rerenderFromHostMachine();
256
247
  };
257
248
  host.addEventListener('fsl-machine-rebuilt', on_rebuild);
258
249
  this._host_unbind = () => { host.removeEventListener('fsl-machine-rebuilt', on_rebuild); };
259
- this._rerenderFromHostMachine();
250
+ void this._rerenderFromHostMachine();
251
+ return;
260
252
  });
261
253
  }
262
254
  /**
@@ -282,7 +274,6 @@ class FslViz extends LitElement {
282
274
  * {@link machine_to_svg_string} pipeline and commits the result to
283
275
  * `_svg`. On failure emits a `viz-error` `CustomEvent` and clears the
284
276
  * SVG.
285
- *
286
277
  * @returns A promise that resolves once the render attempt has finished.
287
278
  */
288
279
  async _rerenderFromHostMachine() {
@@ -298,10 +289,10 @@ class FslViz extends LitElement {
298
289
  this._svg = reorder_svg_layers(result);
299
290
  }
300
291
  }
301
- catch (e) {
292
+ catch (error) {
302
293
  this._svg = '';
303
294
  this.dispatchEvent(new CustomEvent('viz-error', {
304
- detail: normalize_viz_error(e),
295
+ detail: normalize_viz_error(error),
305
296
  bubbles: true,
306
297
  composed: true,
307
298
  }));
@@ -312,7 +303,6 @@ class FslViz extends LitElement {
312
303
  * `fsl_to_svg_string` pipeline. Updates `_svg` on success; emits a
313
304
  * `viz-error` `CustomEvent` on failure. Guards against stale results
314
305
  * when `fsl` changes mid-flight.
315
- *
316
306
  * @returns A promise that resolves once the render attempt has finished.
317
307
  */
318
308
  async _renderSvg() {
@@ -328,10 +318,10 @@ class FslViz extends LitElement {
328
318
  this._svg = reorder_svg_layers(result);
329
319
  }
330
320
  }
331
- catch (e) {
321
+ catch (error) {
332
322
  this._svg = '';
333
323
  this.dispatchEvent(new CustomEvent('viz-error', {
334
- detail: normalize_viz_error(e),
324
+ detail: normalize_viz_error(error),
335
325
  bubbles: true,
336
326
  composed: true,
337
327
  }));
@@ -345,7 +335,6 @@ class FslViz extends LitElement {
345
335
  * sanitized SVG. `unsafeHTML` is required because Lit's template-literal
346
336
  * interpolation otherwise escapes the markup as text. The directive name
347
337
  * makes the trust boundary explicit at the call site.
348
- *
349
338
  * @returns A Lit `TemplateResult` wrapping the SVG in a `.container` div.
350
339
  */
351
340
  render() {
@@ -366,7 +355,6 @@ class FslViz extends LitElement {
366
355
  * viz.highlightTrace(['a', 'b']);
367
356
  * viz.clearHighlights(); // back to the default rendering
368
357
  * ```
369
- *
370
358
  * @see highlightTrace
371
359
  */
372
360
  clearHighlights() {
@@ -378,7 +366,7 @@ class FslViz extends LitElement {
378
366
  return;
379
367
  }
380
368
  // Remove the inline styles that override the SVG presentation attributes.
381
- const elements = container.querySelectorAll('.node, .edge, .node *, .edge *');
369
+ const elements = container.querySelectorAll(':scope .node, :scope .edge, :scope .node *, :scope .edge *');
382
370
  elements.forEach(el => {
383
371
  el.style.removeProperty('fill');
384
372
  el.style.removeProperty('stroke');
@@ -399,13 +387,11 @@ class FslViz extends LitElement {
399
387
  * // Highlight a -> b -> c in green, without dimming the rest:
400
388
  * viz.highlightTrace(['a', 'b', 'c'], { color: '#2e7d32', fadeOthers: false });
401
389
  * ```
402
- *
403
390
  * @param trace Ordered state names describing the path (e.g.
404
391
  * `['A', 'B', 'C']`). Consecutive pairs select the edges
405
392
  * `A->B` and `B->C`. An empty array is a no-op.
406
393
  * @param options Highlight styling; see {@link HighlightOptions}. Defaults
407
394
  * to crimson with off-trace fading enabled.
408
- *
409
395
  * @see clearHighlights
410
396
  * @see HighlightOptions
411
397
  */
@@ -419,7 +405,7 @@ class FslViz extends LitElement {
419
405
  }
420
406
  this.clearHighlights();
421
407
  const color = options.color || '#b71c1c'; // default: a distinct crimson
422
- const fadeOthers = options.fadeOthers !== false; // default: true
408
+ const fadeOthers = options.fadeOthers !== false; // default: true — undefined must fade
423
409
  const targetNodes = new Set();
424
410
  const targetEdges = new Set();
425
411
  for (let i = 0; i < trace.length; i++) {
@@ -9,11 +9,9 @@ export * from './widgets.js';
9
9
  /**
10
10
  * Returns true when `tag_name` is exactly `fsl-<suffix>` or `jssm-<suffix>`
11
11
  * (case-insensitive).
12
- *
13
12
  * @param tag_name - The element tag name to test (e.g. `"FSL-VIZ"`, `"jssm-viz"`).
14
13
  * @param suffix - The suffix to match after the prefix (e.g. `"viz"`).
15
14
  * @returns `true` when `tag_name` is `fsl-<suffix>` or `jssm-<suffix>`.
16
- *
17
15
  * @example
18
16
  * wc_suffix_matches('FSL-VIZ', 'viz'); // true
19
17
  * wc_suffix_matches('jssm-viz', 'viz'); // true
@@ -33,14 +31,11 @@ export * from './widgets.js';
33
31
  * dual-named components.
34
32
  *
35
33
  * Idempotent: skips the `define` call when the tag is already registered.
36
- *
37
34
  * @param canonical_tag - The `fsl-*` tag name (e.g. `"fsl-info-panel"`).
38
35
  * @param CanonicalClass - Constructor to register under `canonical_tag`.
39
- *
40
36
  * @example
41
37
  * class FslInfoPanel extends HTMLElement {}
42
38
  * define_canonical('fsl-info-panel', FslInfoPanel);
43
- *
44
39
  * @see define_with_synonym
45
40
  */
46
41
  function define_canonical(canonical_tag, CanonicalClass) {