jssm 5.124.0 → 5.125.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 +6 -6
- package/dist/cdn/viz.js +186 -91
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/deno/README.md +6 -6
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_viz.d.ts +78 -6
- 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_viz.es5.d.cts +78 -6
- package/jssm_viz.es6.d.ts +78 -6
- package/package.json +1 -1
package/dist/deno/jssm_viz.d.ts
CHANGED
|
@@ -33,15 +33,85 @@ declare function configure(opts: {
|
|
|
33
33
|
*/
|
|
34
34
|
declare function vc(col: string): string;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* Convert a state name into a URL-friendly slug suitable for use as the
|
|
37
|
+
* body of a dot/SVG node identifier. The transformation is:
|
|
38
|
+
*
|
|
39
|
+
* 1. Lowercase
|
|
40
|
+
* 2. Any run of characters outside `[a-z0-9]` (after lowercasing) becomes
|
|
41
|
+
* a single `-`
|
|
42
|
+
* 3. Leading and trailing `-` are trimmed
|
|
43
|
+
*
|
|
44
|
+
* If the result is empty (e.g. for a state named `"!!!"`), the empty
|
|
45
|
+
* string is returned — callers are expected to fall back to an indexed
|
|
46
|
+
* placeholder like `node-N`. See {@link slug_states} for the collision-
|
|
47
|
+
* resolving wrapper that consumes this helper.
|
|
48
|
+
*
|
|
49
|
+
* ```typescript
|
|
50
|
+
* slug_for('Green Light'); // 'green-light'
|
|
51
|
+
* slug_for('!!!'); // ''
|
|
52
|
+
* slug_for(' Foo Bar '); // 'foo-bar'
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param state The state name to slugify.
|
|
56
|
+
* @returns The lowercase hyphen-separated slug, or empty string if none of
|
|
57
|
+
* the characters were retainable.
|
|
58
|
+
*
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
declare function slug_for(state: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* Build a `Map<state, slug>` assigning every state in `states` a unique,
|
|
64
|
+
* deterministic, URL-safe slug used as its dot/SVG node identifier.
|
|
65
|
+
*
|
|
66
|
+
* Algorithm:
|
|
67
|
+
*
|
|
68
|
+
* 1. Slug each state via {@link slug_for}. States whose slug comes out
|
|
69
|
+
* empty fall back to `node-N`, where `N` is the state's declaration
|
|
70
|
+
* index (1-based, to match user-visible numbering).
|
|
71
|
+
* 2. Walk the state list in declaration order, tracking how many times
|
|
72
|
+
* each base slug has already been used. The first occurrence keeps
|
|
73
|
+
* the base slug; subsequent collisions get `-2`, `-3`, … suffixes.
|
|
74
|
+
* If the proposed suffixed slug itself collides with a base slug
|
|
75
|
+
* used later, the counter advances until a free slot is found.
|
|
76
|
+
*
|
|
77
|
+
* This yields a deterministic mapping given the state-declaration order,
|
|
78
|
+
* so output is stable across runs.
|
|
79
|
+
*
|
|
80
|
+
* ```typescript
|
|
81
|
+
* slug_states(['Red Light', 'red-light']);
|
|
82
|
+
* // Map { 'Red Light' => 'red-light', 'red-light' => 'red-light-2' }
|
|
83
|
+
*
|
|
84
|
+
* slug_states(['!!!', '???']);
|
|
85
|
+
* // Map { '!!!' => 'node-1', '???' => 'node-2' }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @param states States in declaration order.
|
|
89
|
+
* @returns A `Map` from each state name to its unique slug.
|
|
90
|
+
*
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
declare function slug_states(states: string[]): Map<string, string>;
|
|
94
|
+
/**
|
|
95
|
+
* Build a graphviz-safe node identifier for a state. Accepts either a
|
|
96
|
+
* `string[]` (legacy test-only path; returns an index-based `n0`/`n1`
|
|
97
|
+
* identifier via `indexOf`), or a precomputed `Map<state, slug>` produced
|
|
98
|
+
* by {@link slug_states} (used by all rendering hot paths).
|
|
99
|
+
*
|
|
100
|
+
* When a slug map is supplied, the identifier is the slug wrapped in
|
|
101
|
+
* double quotes — dot allows quoted identifiers, and the slug alphabet
|
|
102
|
+
* (lowercase alphanumerics + `-`) requires quoting because bare dot IDs
|
|
103
|
+
* may not contain `-`. Graphviz round-trips the quoted form through to
|
|
104
|
+
* the SVG `<title>` element and uses the slug as a stable basis for the
|
|
105
|
+
* generated SVG element `id` attribute.
|
|
106
|
+
*
|
|
107
|
+
* ```typescript
|
|
108
|
+
* node_of('Red Light', new Map([['Red Light', 'red-light']]));
|
|
109
|
+
* // '"red-light"'
|
|
110
|
+
* ```
|
|
41
111
|
*
|
|
42
112
|
* @internal
|
|
43
113
|
*/
|
|
44
|
-
declare function node_of(state: string, state_index: string[] | Map<string, number>): string;
|
|
114
|
+
declare function node_of(state: string, state_index: string[] | Map<string, number> | Map<string, string>): string;
|
|
45
115
|
/**
|
|
46
116
|
* Convert an 8-channel hex color (`#RRGGBBAA`) to a 6-channel hex color
|
|
47
117
|
* (`#RRGGBB`), discarding the alpha channel. Throws if the input is not
|
|
@@ -223,6 +293,8 @@ export declare const _test: {
|
|
|
223
293
|
u_color8to6: typeof u_color8to6;
|
|
224
294
|
vc: typeof vc;
|
|
225
295
|
node_of: typeof node_of;
|
|
296
|
+
slug_for: typeof slug_for;
|
|
297
|
+
slug_states: typeof slug_states;
|
|
226
298
|
shape_for_state: typeof shape_for_state;
|
|
227
299
|
image_for_state: typeof image_for_state;
|
|
228
300
|
style_for_state: typeof style_for_state;
|