jssm 5.123.0 → 5.124.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.
@@ -2319,6 +2319,24 @@ declare function image_for_state<T>(u_jssm: Machine<T>, state: string): string |
2319
2319
  * @internal
2320
2320
  */
2321
2321
  declare function style_for_state<T>(u_jssm: Machine<T>, state: string): string;
2322
+ /**
2323
+ * Options for the dot/SVG render entry points.
2324
+ *
2325
+ * - `hide_state_labels` (default `false`) — when `true`, the rendered dot
2326
+ * output omits the `label=` attribute on every state's node line.
2327
+ * Graphviz then draws the box without any text inside. Useful for
2328
+ * diagrams where shape, color, or layout alone carry the meaning
2329
+ * (icon-only diagrams, tutorial graphics, presentation slides).
2330
+ * - `footer` — verbatim dot source inserted just before the closing `}`
2331
+ * of the generated dot source (e.g. `labelloc="b"; label="caption";`).
2332
+ * - `engine` — graphviz layout engine for the SVG render path (e.g.
2333
+ * `dot`, `neato`, `circo`); honored by `fsl_to_svg_string`.
2334
+ */
2335
+ declare type VizRenderOpts = {
2336
+ hide_state_labels?: boolean;
2337
+ footer?: string;
2338
+ engine?: string;
2339
+ };
2322
2340
  /**
2323
2341
  * Render a {@link jssm.Machine} as a graphviz dot string.
2324
2342
  *
@@ -2334,18 +2352,18 @@ declare function style_for_state<T>(u_jssm: Machine<T>, state: string): string;
2334
2352
  * const dot = machine_to_dot(sm`a -> b;`);
2335
2353
  * // 'digraph G { ... }'
2336
2354
  *
2355
+ * // suppress state-name labels (boxes only, no text inside)
2356
+ * const dot2 = machine_to_dot(sm`a -> b;`, { hide_state_labels: true });
2357
+ *
2337
2358
  * const dot_with_footer = machine_to_dot(sm`a -> b;`, { footer: 'labelloc="b"; label="caption";' });
2338
2359
  * // 'digraph G { ... labelloc="b"; label="caption"; }'
2339
2360
  * ```
2340
2361
  *
2341
2362
  * @param u_jssm The machine to render.
2342
- * @param opts Optional rendering options.
2343
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}`.
2363
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2344
2364
  * @returns A complete graphviz dot source string.
2345
2365
  */
2346
- declare function machine_to_dot<T>(u_jssm: Machine<T>, opts?: {
2347
- footer?: string;
2348
- }): string;
2366
+ declare function machine_to_dot<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): string;
2349
2367
  /**
2350
2368
  * Render an FSL string directly to graphviz dot source.
2351
2369
  *
@@ -2353,18 +2371,18 @@ declare function machine_to_dot<T>(u_jssm: Machine<T>, opts?: {
2353
2371
  * import { fsl_to_dot } from 'jssm/viz';
2354
2372
  * const dot = fsl_to_dot('a -> b;');
2355
2373
  *
2374
+ * // suppress state-name labels
2375
+ * const dot2 = fsl_to_dot('a -> b;', { hide_state_labels: true });
2376
+ *
2356
2377
  * const dot_with_footer = fsl_to_dot('a -> b;', { footer: 'label="caption";' });
2357
2378
  * // 'digraph G { ... label="caption"; }'
2358
2379
  * ```
2359
2380
  *
2360
2381
  * @param fsl The FSL source.
2361
- * @param opts Optional rendering options.
2362
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}`.
2382
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2363
2383
  * @returns A complete graphviz dot source string.
2364
2384
  */
2365
- declare function fsl_to_dot(fsl: string, opts?: {
2366
- footer?: string;
2367
- }): string;
2385
+ declare function fsl_to_dot(fsl: string, opts?: VizRenderOpts): string;
2368
2386
  /**
2369
2387
  * Render a graphviz dot source string to SVG using `@viz-js/viz`. The
2370
2388
  * underlying viz instance is lazy-initialized on first call and cached for
@@ -2394,51 +2412,36 @@ declare function dot_to_svg(dot: string, options?: {
2394
2412
  * ```
2395
2413
  *
2396
2414
  * @param fsl The FSL source.
2397
- * @param opts Optional rendering options.
2398
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
2399
- * @param opts.engine Graphviz layout engine to use (e.g. `'dot'`, `'neato'`, `'circo'`).
2400
- * Unrecognized engine names cause `@viz-js/viz` to throw at render time.
2415
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2401
2416
  * @returns A promise resolving to an SVG XML string.
2402
2417
  */
2403
- declare function fsl_to_svg_string(fsl: string, opts?: {
2404
- footer?: string;
2405
- engine?: string;
2406
- }): Promise<string>;
2418
+ declare function fsl_to_svg_string(fsl: string, opts?: VizRenderOpts): Promise<string>;
2407
2419
  /**
2408
2420
  * Render a {@link jssm.Machine} to SVG.
2409
2421
  *
2410
2422
  * @param u_jssm The machine to render.
2411
- * @param opts Optional rendering options.
2412
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
2423
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2413
2424
  * @returns A promise resolving to an SVG XML string.
2414
2425
  */
2415
- declare function machine_to_svg_string<T>(u_jssm: Machine<T>, opts?: {
2416
- footer?: string;
2417
- }): Promise<string>;
2426
+ declare function machine_to_svg_string<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): Promise<string>;
2418
2427
  /**
2419
2428
  * Render an FSL string directly to a parsed `SVGSVGElement`.
2420
2429
  *
2421
2430
  * @param fsl The FSL source.
2422
- * @param opts Optional rendering options.
2423
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
2431
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2424
2432
  * @returns A promise resolving to a parsed `SVGSVGElement`.
2425
2433
  * @throws {JssmError} if no `DOMParser` is available (Node without `configure`).
2426
2434
  */
2427
- declare function fsl_to_svg_element(fsl: string, opts?: {
2428
- footer?: string;
2429
- }): Promise<SVGSVGElement>;
2435
+ declare function fsl_to_svg_element(fsl: string, opts?: VizRenderOpts): Promise<SVGSVGElement>;
2430
2436
  /**
2431
2437
  * Render a {@link jssm.Machine} to a parsed `SVGSVGElement`.
2432
2438
  *
2433
2439
  * @param u_jssm The machine to render.
2434
- * @param opts Optional rendering options.
2435
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
2440
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2436
2441
  * @returns A promise resolving to a parsed `SVGSVGElement`.
2437
2442
  * @throws {JssmError} if no `DOMParser` is available (Node without `configure`).
2438
2443
  */
2439
- declare function machine_to_svg_element<T>(u_jssm: Machine<T>, opts?: {
2440
- footer?: string;
2441
- }): Promise<SVGSVGElement>;
2444
+ declare function machine_to_svg_element<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): Promise<SVGSVGElement>;
2442
2445
  /**
2443
2446
  * Compatibility wrapper for {@link machine_to_dot}, retained from
2444
2447
  * jssm-viz. Will be removed in the next major.
@@ -2459,3 +2462,4 @@ declare const _test: {
2459
2462
  };
2460
2463
 
2461
2464
  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 };
2465
+ export type { VizRenderOpts };
package/jssm_viz.es6.d.ts CHANGED
@@ -2319,6 +2319,24 @@ declare function image_for_state<T>(u_jssm: Machine<T>, state: string): string |
2319
2319
  * @internal
2320
2320
  */
2321
2321
  declare function style_for_state<T>(u_jssm: Machine<T>, state: string): string;
2322
+ /**
2323
+ * Options for the dot/SVG render entry points.
2324
+ *
2325
+ * - `hide_state_labels` (default `false`) — when `true`, the rendered dot
2326
+ * output omits the `label=` attribute on every state's node line.
2327
+ * Graphviz then draws the box without any text inside. Useful for
2328
+ * diagrams where shape, color, or layout alone carry the meaning
2329
+ * (icon-only diagrams, tutorial graphics, presentation slides).
2330
+ * - `footer` — verbatim dot source inserted just before the closing `}`
2331
+ * of the generated dot source (e.g. `labelloc="b"; label="caption";`).
2332
+ * - `engine` — graphviz layout engine for the SVG render path (e.g.
2333
+ * `dot`, `neato`, `circo`); honored by `fsl_to_svg_string`.
2334
+ */
2335
+ declare type VizRenderOpts = {
2336
+ hide_state_labels?: boolean;
2337
+ footer?: string;
2338
+ engine?: string;
2339
+ };
2322
2340
  /**
2323
2341
  * Render a {@link jssm.Machine} as a graphviz dot string.
2324
2342
  *
@@ -2334,18 +2352,18 @@ declare function style_for_state<T>(u_jssm: Machine<T>, state: string): string;
2334
2352
  * const dot = machine_to_dot(sm`a -> b;`);
2335
2353
  * // 'digraph G { ... }'
2336
2354
  *
2355
+ * // suppress state-name labels (boxes only, no text inside)
2356
+ * const dot2 = machine_to_dot(sm`a -> b;`, { hide_state_labels: true });
2357
+ *
2337
2358
  * const dot_with_footer = machine_to_dot(sm`a -> b;`, { footer: 'labelloc="b"; label="caption";' });
2338
2359
  * // 'digraph G { ... labelloc="b"; label="caption"; }'
2339
2360
  * ```
2340
2361
  *
2341
2362
  * @param u_jssm The machine to render.
2342
- * @param opts Optional rendering options.
2343
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}`.
2363
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2344
2364
  * @returns A complete graphviz dot source string.
2345
2365
  */
2346
- declare function machine_to_dot<T>(u_jssm: Machine<T>, opts?: {
2347
- footer?: string;
2348
- }): string;
2366
+ declare function machine_to_dot<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): string;
2349
2367
  /**
2350
2368
  * Render an FSL string directly to graphviz dot source.
2351
2369
  *
@@ -2353,18 +2371,18 @@ declare function machine_to_dot<T>(u_jssm: Machine<T>, opts?: {
2353
2371
  * import { fsl_to_dot } from 'jssm/viz';
2354
2372
  * const dot = fsl_to_dot('a -> b;');
2355
2373
  *
2374
+ * // suppress state-name labels
2375
+ * const dot2 = fsl_to_dot('a -> b;', { hide_state_labels: true });
2376
+ *
2356
2377
  * const dot_with_footer = fsl_to_dot('a -> b;', { footer: 'label="caption";' });
2357
2378
  * // 'digraph G { ... label="caption"; }'
2358
2379
  * ```
2359
2380
  *
2360
2381
  * @param fsl The FSL source.
2361
- * @param opts Optional rendering options.
2362
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}`.
2382
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2363
2383
  * @returns A complete graphviz dot source string.
2364
2384
  */
2365
- declare function fsl_to_dot(fsl: string, opts?: {
2366
- footer?: string;
2367
- }): string;
2385
+ declare function fsl_to_dot(fsl: string, opts?: VizRenderOpts): string;
2368
2386
  /**
2369
2387
  * Render a graphviz dot source string to SVG using `@viz-js/viz`. The
2370
2388
  * underlying viz instance is lazy-initialized on first call and cached for
@@ -2394,51 +2412,36 @@ declare function dot_to_svg(dot: string, options?: {
2394
2412
  * ```
2395
2413
  *
2396
2414
  * @param fsl The FSL source.
2397
- * @param opts Optional rendering options.
2398
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
2399
- * @param opts.engine Graphviz layout engine to use (e.g. `'dot'`, `'neato'`, `'circo'`).
2400
- * Unrecognized engine names cause `@viz-js/viz` to throw at render time.
2415
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2401
2416
  * @returns A promise resolving to an SVG XML string.
2402
2417
  */
2403
- declare function fsl_to_svg_string(fsl: string, opts?: {
2404
- footer?: string;
2405
- engine?: string;
2406
- }): Promise<string>;
2418
+ declare function fsl_to_svg_string(fsl: string, opts?: VizRenderOpts): Promise<string>;
2407
2419
  /**
2408
2420
  * Render a {@link jssm.Machine} to SVG.
2409
2421
  *
2410
2422
  * @param u_jssm The machine to render.
2411
- * @param opts Optional rendering options.
2412
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
2423
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2413
2424
  * @returns A promise resolving to an SVG XML string.
2414
2425
  */
2415
- declare function machine_to_svg_string<T>(u_jssm: Machine<T>, opts?: {
2416
- footer?: string;
2417
- }): Promise<string>;
2426
+ declare function machine_to_svg_string<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): Promise<string>;
2418
2427
  /**
2419
2428
  * Render an FSL string directly to a parsed `SVGSVGElement`.
2420
2429
  *
2421
2430
  * @param fsl The FSL source.
2422
- * @param opts Optional rendering options.
2423
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
2431
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2424
2432
  * @returns A promise resolving to a parsed `SVGSVGElement`.
2425
2433
  * @throws {JssmError} if no `DOMParser` is available (Node without `configure`).
2426
2434
  */
2427
- declare function fsl_to_svg_element(fsl: string, opts?: {
2428
- footer?: string;
2429
- }): Promise<SVGSVGElement>;
2435
+ declare function fsl_to_svg_element(fsl: string, opts?: VizRenderOpts): Promise<SVGSVGElement>;
2430
2436
  /**
2431
2437
  * Render a {@link jssm.Machine} to a parsed `SVGSVGElement`.
2432
2438
  *
2433
2439
  * @param u_jssm The machine to render.
2434
- * @param opts Optional rendering options.
2435
- * @param opts.footer Optional verbatim dot source inserted just before the closing `}` of the intermediate dot source.
2440
+ * @param opts Optional render flags. See {@link VizRenderOpts}.
2436
2441
  * @returns A promise resolving to a parsed `SVGSVGElement`.
2437
2442
  * @throws {JssmError} if no `DOMParser` is available (Node without `configure`).
2438
2443
  */
2439
- declare function machine_to_svg_element<T>(u_jssm: Machine<T>, opts?: {
2440
- footer?: string;
2441
- }): Promise<SVGSVGElement>;
2444
+ declare function machine_to_svg_element<T>(u_jssm: Machine<T>, opts?: VizRenderOpts): Promise<SVGSVGElement>;
2442
2445
  /**
2443
2446
  * Compatibility wrapper for {@link machine_to_dot}, retained from
2444
2447
  * jssm-viz. Will be removed in the next major.
@@ -2459,3 +2462,4 @@ declare const _test: {
2459
2462
  };
2460
2463
 
2461
2464
  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 };
2465
+ export type { VizRenderOpts };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jssm",
3
- "version": "5.123.0",
3
+ "version": "5.124.0",
4
4
  "engines": {
5
5
  "node": ">=10.0.0"
6
6
  },