@re-cinq/floor-graph 0.0.0-stage → 0.6.1
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/LICENSE +201 -0
- package/README.md +18 -2
- package/dist/ArrowMarkerDefs.d.ts +3 -0
- package/dist/ArrowMarkerDefs.js +16 -0
- package/dist/ControlIcon.d.ts +3 -0
- package/dist/ControlIcon.js +5 -0
- package/dist/DanglingStub.d.ts +7 -0
- package/dist/DanglingStub.js +10 -0
- package/dist/ExitDot.d.ts +8 -0
- package/dist/ExitDot.js +7 -0
- package/dist/GraphEdge.d.ts +27 -0
- package/dist/GraphEdge.js +32 -0
- package/dist/GraphNode.d.ts +43 -0
- package/dist/GraphNode.js +138 -0
- package/dist/GraphSvg.d.ts +50 -0
- package/dist/GraphSvg.js +77 -0
- package/dist/GraphViewport.d.ts +16 -0
- package/dist/GraphViewport.js +27 -0
- package/dist/NodeBadges.d.ts +8 -0
- package/dist/NodeBadges.js +19 -0
- package/dist/NodeBox.d.ts +8 -0
- package/dist/NodeBox.js +8 -0
- package/dist/NodeTitle.d.ts +8 -0
- package/dist/NodeTitle.js +7 -0
- package/dist/NodeTooltip.d.ts +9 -0
- package/dist/NodeTooltip.js +30 -0
- package/dist/RunGraphLegend.d.ts +4 -0
- package/dist/RunGraphLegend.js +20 -0
- package/dist/RunGraphView.d.ts +27 -0
- package/dist/RunGraphView.js +151 -0
- package/dist/ToggleButton.d.ts +8 -0
- package/dist/ToggleButton.js +6 -0
- package/dist/TypeGlyph.d.ts +9 -0
- package/dist/TypeGlyph.js +23 -0
- package/dist/ViewportControls.d.ts +13 -0
- package/dist/ViewportControls.js +11 -0
- package/dist/assembly-line-definition.d.ts +35 -0
- package/dist/assembly-line-definition.js +2 -0
- package/dist/elk-graph.d.ts +16 -0
- package/dist/elk-graph.js +131 -0
- package/dist/elk-layout.d.ts +46 -0
- package/dist/elk-layout.js +67 -0
- package/dist/graph-markers.d.ts +2 -0
- package/dist/graph-markers.js +10 -0
- package/dist/graph-view-model.d.ts +33 -0
- package/dist/graph-view-model.js +55 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +6 -0
- package/dist/layout-geometry.d.ts +16 -0
- package/dist/layout-geometry.js +56 -0
- package/dist/metro/declared-ids.d.ts +3 -0
- package/dist/metro/declared-ids.js +5 -0
- package/dist/metro/edge-key.d.ts +3 -0
- package/dist/metro/edge-key.js +5 -0
- package/dist/metro/layout-diff.d.ts +12 -0
- package/dist/metro/layout-diff.js +32 -0
- package/dist/metro/main-path.d.ts +8 -0
- package/dist/metro/main-path.js +26 -0
- package/dist/metro/neighbourhood.d.ts +7 -0
- package/dist/metro/neighbourhood.js +28 -0
- package/dist/metro/node-edges.d.ts +5 -0
- package/dist/metro/node-edges.js +9 -0
- package/dist/metro/pass-through.d.ts +3 -0
- package/dist/metro/pass-through.js +16 -0
- package/dist/metro/reachability.d.ts +8 -0
- package/dist/metro/reachability.js +31 -0
- package/dist/metro/removed-stations.d.ts +13 -0
- package/dist/metro/removed-stations.js +11 -0
- package/dist/metro/station-visits.d.ts +7 -0
- package/dist/metro/station-visits.js +13 -0
- package/dist/metro/step-along.d.ts +8 -0
- package/dist/metro/step-along.js +28 -0
- package/dist/metro/taken-count.d.ts +6 -0
- package/dist/metro/taken-count.js +11 -0
- package/dist/metro/taken-lines.d.ts +12 -0
- package/dist/metro/taken-lines.js +20 -0
- package/dist/metro/visited-part.d.ts +4 -0
- package/dist/metro/visited-part.js +24 -0
- package/dist/node-aria-label.d.ts +9 -0
- package/dist/node-aria-label.js +11 -0
- package/dist/node-badges.d.ts +8 -0
- package/dist/node-badges.js +20 -0
- package/dist/node-tooltip.d.ts +12 -0
- package/dist/node-tooltip.js +34 -0
- package/dist/node-type-family.d.ts +6 -0
- package/dist/node-type-family.js +18 -0
- package/dist/run-graph-drawing.d.ts +14 -0
- package/dist/run-graph-drawing.js +22 -0
- package/dist/run-graph-geometry.d.ts +18 -0
- package/dist/run-graph-geometry.js +38 -0
- package/dist/run-graph-tone-classes.d.ts +5 -0
- package/dist/run-graph-tone-classes.js +34 -0
- package/dist/run-graph.module.css +470 -0
- package/dist/run-graph.test-helpers.d.ts +4 -0
- package/dist/run-graph.test-helpers.js +11 -0
- package/dist/station-subtitle.d.ts +2 -0
- package/dist/station-subtitle.js +6 -0
- package/dist/use-element-size.d.ts +6 -0
- package/dist/use-element-size.js +17 -0
- package/dist/use-elk-layout.d.ts +5 -0
- package/dist/use-elk-layout.js +19 -0
- package/dist/use-keyboard-cursor.d.ts +10 -0
- package/dist/use-keyboard-cursor.js +39 -0
- package/dist/use-layout-changes.d.ts +11 -0
- package/dist/use-layout-changes.js +45 -0
- package/dist/use-measured-box.d.ts +3 -0
- package/dist/use-measured-box.js +13 -0
- package/dist/use-node-size.d.ts +7 -0
- package/dist/use-node-size.js +17 -0
- package/dist/use-node-tooltip.d.ts +20 -0
- package/dist/use-node-tooltip.js +74 -0
- package/dist/use-pointer-drag.d.ts +7 -0
- package/dist/use-pointer-drag.js +23 -0
- package/dist/use-redrawn.d.ts +4 -0
- package/dist/use-redrawn.js +8 -0
- package/dist/use-revealed.d.ts +4 -0
- package/dist/use-revealed.js +11 -0
- package/dist/use-run-overlay.d.ts +7 -0
- package/dist/use-run-overlay.js +11 -0
- package/dist/use-toggle.d.ts +4 -0
- package/dist/use-toggle.js +7 -0
- package/dist/use-wheel-navigation.d.ts +3 -0
- package/dist/use-wheel-navigation.js +19 -0
- package/dist/viewport-input.d.ts +16 -0
- package/dist/viewport-input.js +19 -0
- package/dist/viewport-state.d.ts +46 -0
- package/dist/viewport-state.js +48 -0
- package/dist/viewport.d.ts +27 -0
- package/dist/viewport.js +66 -0
- package/dist/viewport.module.css +67 -0
- package/package.json +69 -4
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
.panel,
|
|
2
|
+
.canvas {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
flex: 1;
|
|
6
|
+
min-height: 0;
|
|
7
|
+
}
|
|
8
|
+
.heading {
|
|
9
|
+
font-size: var(--fs-md);
|
|
10
|
+
font-weight: var(--fw-semibold);
|
|
11
|
+
letter-spacing: -0.01em;
|
|
12
|
+
margin-bottom: var(--space-3);
|
|
13
|
+
}
|
|
14
|
+
.svg {
|
|
15
|
+
display: block;
|
|
16
|
+
overflow: visible;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Step type (run-viz FR4.1h): a colour per family from the categorical palette, never a status colour. */
|
|
20
|
+
.familyAgent {
|
|
21
|
+
--family: var(--chart-spec);
|
|
22
|
+
}
|
|
23
|
+
.familyService {
|
|
24
|
+
--family: var(--chart-section);
|
|
25
|
+
}
|
|
26
|
+
.familyPerson {
|
|
27
|
+
--family: var(--chart-feature);
|
|
28
|
+
}
|
|
29
|
+
.familyMarker {
|
|
30
|
+
--family: var(--chart-neutral);
|
|
31
|
+
}
|
|
32
|
+
.legendBox {
|
|
33
|
+
fill: color-mix(in srgb, var(--family) 12%, var(--bg-surface));
|
|
34
|
+
stroke: var(--family);
|
|
35
|
+
stroke-width: 1.5;
|
|
36
|
+
}
|
|
37
|
+
.typeGlyph {
|
|
38
|
+
fill: var(--family);
|
|
39
|
+
}
|
|
40
|
+
.stopCircle {
|
|
41
|
+
fill: color-mix(in srgb, var(--family) 12%, var(--bg-surface));
|
|
42
|
+
stroke: var(--family);
|
|
43
|
+
stroke-width: 1.5;
|
|
44
|
+
}
|
|
45
|
+
.stopTitle {
|
|
46
|
+
fill: var(--text);
|
|
47
|
+
font-size: var(--fs-xs);
|
|
48
|
+
font-weight: var(--fw-bold);
|
|
49
|
+
}
|
|
50
|
+
.legend {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-wrap: wrap;
|
|
53
|
+
gap: var(--space-2) var(--space-5);
|
|
54
|
+
margin: var(--space-3) 0 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
list-style: none;
|
|
57
|
+
color: var(--text-muted);
|
|
58
|
+
font-size: var(--fs-xs);
|
|
59
|
+
}
|
|
60
|
+
.legendItem {
|
|
61
|
+
display: inline-flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
gap: var(--space-2);
|
|
64
|
+
}
|
|
65
|
+
.legendSwatch {
|
|
66
|
+
flex: none;
|
|
67
|
+
}
|
|
68
|
+
.empty {
|
|
69
|
+
color: var(--text-muted);
|
|
70
|
+
font-size: var(--fs-sm);
|
|
71
|
+
margin-bottom: var(--space-6);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.edge {
|
|
75
|
+
fill: none;
|
|
76
|
+
stroke: var(--border);
|
|
77
|
+
stroke-width: 2;
|
|
78
|
+
stroke-linecap: round;
|
|
79
|
+
stroke-linejoin: round;
|
|
80
|
+
transition:
|
|
81
|
+
stroke-width var(--transition),
|
|
82
|
+
opacity var(--transition);
|
|
83
|
+
}
|
|
84
|
+
.edgeHit {
|
|
85
|
+
fill: none;
|
|
86
|
+
stroke: transparent;
|
|
87
|
+
stroke-width: 12;
|
|
88
|
+
pointer-events: stroke;
|
|
89
|
+
}
|
|
90
|
+
.back,
|
|
91
|
+
.self {
|
|
92
|
+
stroke-dasharray: 5 4;
|
|
93
|
+
}
|
|
94
|
+
.arrowHead {
|
|
95
|
+
fill: context-stroke;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Edge condition as color: the branch's meaning is legible without reading a
|
|
99
|
+
label. */
|
|
100
|
+
.toneOk {
|
|
101
|
+
stroke: var(--success);
|
|
102
|
+
}
|
|
103
|
+
.toneWarn {
|
|
104
|
+
stroke: var(--warning);
|
|
105
|
+
}
|
|
106
|
+
.toneErr {
|
|
107
|
+
stroke: var(--danger);
|
|
108
|
+
}
|
|
109
|
+
.toneNeutral {
|
|
110
|
+
stroke: var(--border);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* The connector a run took: stronger, in the success colour. */
|
|
114
|
+
.edge.taken {
|
|
115
|
+
stroke: var(--success);
|
|
116
|
+
stroke-width: 4;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Hover an edge to bring it forward: thicken it and lift any dimming. */
|
|
120
|
+
.edge:hover {
|
|
121
|
+
stroke-width: 3;
|
|
122
|
+
}
|
|
123
|
+
.edge.dim:hover {
|
|
124
|
+
opacity: 1;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* The selected line draws thicker, its label bold. */
|
|
128
|
+
[data-selected="true"] .edge,
|
|
129
|
+
[data-chosen="true"] .edge {
|
|
130
|
+
stroke-width: 3.5;
|
|
131
|
+
}
|
|
132
|
+
text[data-selected="true"] {
|
|
133
|
+
font-weight: var(--fw-bold, 700);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* The selected node's outgoing hops are bold and solid, the other hops fade back, so where the node leads reads at a glance. Nothing selected → neither. */
|
|
137
|
+
.outgoing {
|
|
138
|
+
stroke-width: 3.5;
|
|
139
|
+
stroke-dasharray: none;
|
|
140
|
+
}
|
|
141
|
+
.dim {
|
|
142
|
+
opacity: 0.4;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.node {
|
|
146
|
+
cursor: default;
|
|
147
|
+
}
|
|
148
|
+
.node[tabindex] {
|
|
149
|
+
cursor: pointer;
|
|
150
|
+
}
|
|
151
|
+
.node:focus-visible {
|
|
152
|
+
outline: none;
|
|
153
|
+
}
|
|
154
|
+
/* Keyboard focus thickens the border and darkens the box like selection does: the lightest family colour (marker grey) only clears 3:1 against the surface once darkened (WCAG 1.4.11). */
|
|
155
|
+
.node:focus-visible .box {
|
|
156
|
+
stroke-width: 3;
|
|
157
|
+
filter: brightness(0.8);
|
|
158
|
+
}
|
|
159
|
+
/* A box wears its step type's colour (run-viz FR4.1h): the border in the family colour, the fill a light wash of it. Status is the glyph and the verdict text inside. */
|
|
160
|
+
.box {
|
|
161
|
+
fill: color-mix(in srgb, var(--family, var(--border)) 12%, var(--bg-surface));
|
|
162
|
+
stroke: var(--family, var(--border));
|
|
163
|
+
stroke-width: 1.5;
|
|
164
|
+
filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
|
|
165
|
+
transition:
|
|
166
|
+
stroke var(--transition),
|
|
167
|
+
fill var(--transition);
|
|
168
|
+
}
|
|
169
|
+
.node[tabindex]:hover .box {
|
|
170
|
+
stroke-width: 2.5;
|
|
171
|
+
}
|
|
172
|
+
/* The node the inspector shows: its own colours, darker, and a border 2.5px heavier, so the graph and the panel beside it agree at a glance without the box changing what it says about its type. Brightness darkens the agent gradient as well as a flat colour. */
|
|
173
|
+
.boxUnreachable {
|
|
174
|
+
stroke-dasharray: 5 3;
|
|
175
|
+
}
|
|
176
|
+
.selected .box {
|
|
177
|
+
stroke-width: 4;
|
|
178
|
+
filter: brightness(0.8) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
|
|
179
|
+
}
|
|
180
|
+
.node[data-open="true"] .box {
|
|
181
|
+
stroke-dasharray: 6 4;
|
|
182
|
+
animation: openPulse 1.6s ease-in-out infinite;
|
|
183
|
+
}
|
|
184
|
+
@keyframes openPulse {
|
|
185
|
+
50% {
|
|
186
|
+
opacity: 0.55;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
@media (prefers-reduced-motion: reduce) {
|
|
190
|
+
.node[data-open="true"] .box {
|
|
191
|
+
animation: none;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
.nodeId {
|
|
195
|
+
fill: var(--text);
|
|
196
|
+
font-size: var(--fs-sm);
|
|
197
|
+
font-weight: var(--fw-bold);
|
|
198
|
+
letter-spacing: -0.01em;
|
|
199
|
+
}
|
|
200
|
+
.nodeUnreachable {
|
|
201
|
+
fill: var(--warning);
|
|
202
|
+
font-size: var(--fs-2xs);
|
|
203
|
+
}
|
|
204
|
+
.nodeKind {
|
|
205
|
+
fill: var(--text-muted);
|
|
206
|
+
font-size: var(--fs-2xs);
|
|
207
|
+
font-weight: var(--fw-semibold);
|
|
208
|
+
}
|
|
209
|
+
.outOk {
|
|
210
|
+
fill: var(--success);
|
|
211
|
+
}
|
|
212
|
+
.outWarn {
|
|
213
|
+
fill: var(--warning);
|
|
214
|
+
}
|
|
215
|
+
.outErr {
|
|
216
|
+
fill: var(--danger);
|
|
217
|
+
}
|
|
218
|
+
.outNeutral {
|
|
219
|
+
fill: var(--text-muted);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/* An AI step's border is a gradient through the palette (run-viz FR4.1h); the gradient lives in the graph's <defs>, ArrowMarkerDefs.tsx. */
|
|
223
|
+
.agentStopStart {
|
|
224
|
+
stop-color: var(--chart-spec);
|
|
225
|
+
}
|
|
226
|
+
.agentStopMiddle {
|
|
227
|
+
stop-color: var(--chart-feature);
|
|
228
|
+
}
|
|
229
|
+
.agentStopEnd {
|
|
230
|
+
stop-color: var(--chart-section);
|
|
231
|
+
}
|
|
232
|
+
.familyAgent .box {
|
|
233
|
+
stroke: url(#rgv-agent-border);
|
|
234
|
+
stroke-width: 2;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* A node's tooltip (run-viz FR4.1h): fixed to the viewport, centred on the node, above it unless the node sits near the top. */
|
|
238
|
+
.tooltip {
|
|
239
|
+
position: fixed;
|
|
240
|
+
z-index: var(--z-popover);
|
|
241
|
+
max-width: 320px;
|
|
242
|
+
padding: var(--space-3) var(--space-4);
|
|
243
|
+
border: 1px solid var(--border);
|
|
244
|
+
border-top: 3px solid var(--family, var(--border));
|
|
245
|
+
border-radius: var(--radius);
|
|
246
|
+
background: var(--bg-elevated);
|
|
247
|
+
box-shadow: var(--shadow-lg);
|
|
248
|
+
color: var(--text);
|
|
249
|
+
pointer-events: none;
|
|
250
|
+
transform: translateX(-50%);
|
|
251
|
+
}
|
|
252
|
+
.tooltip[data-placement="above"] {
|
|
253
|
+
transform: translate(-50%, -100%);
|
|
254
|
+
}
|
|
255
|
+
.tooltipTitle {
|
|
256
|
+
display: inline;
|
|
257
|
+
font-size: var(--fs-sm);
|
|
258
|
+
}
|
|
259
|
+
.tooltipKind {
|
|
260
|
+
margin-left: var(--space-2);
|
|
261
|
+
color: var(--family, var(--text-muted));
|
|
262
|
+
font-size: var(--fs-xs);
|
|
263
|
+
font-weight: var(--fw-semibold);
|
|
264
|
+
text-transform: uppercase;
|
|
265
|
+
letter-spacing: 0.03em;
|
|
266
|
+
}
|
|
267
|
+
.tooltipText {
|
|
268
|
+
margin: var(--space-2) 0 0;
|
|
269
|
+
color: var(--text-muted);
|
|
270
|
+
font-size: var(--fs-sm);
|
|
271
|
+
line-height: var(--lh-base);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/* Lore: the stations as rounded cards on the surface, the heading in the display weight. */
|
|
275
|
+
:global([data-theme-family="lore"]) .heading {
|
|
276
|
+
color: var(--heading-color);
|
|
277
|
+
font-size: var(--fs-lg);
|
|
278
|
+
font-weight: var(--fw-medium);
|
|
279
|
+
}
|
|
280
|
+
:global([data-theme-family="lore"]) .box {
|
|
281
|
+
rx: var(--radius);
|
|
282
|
+
fill: color-mix(in srgb, var(--family, var(--border)) 6%, var(--bg-surface));
|
|
283
|
+
filter: none;
|
|
284
|
+
}
|
|
285
|
+
:global([data-theme-family="lore"]) .selected .box {
|
|
286
|
+
filter: drop-shadow(0 0 var(--space-3) var(--focus-ring));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/* The outcome beside a hop that branches or loops; the halo keeps it legible over the lines it crosses. */
|
|
290
|
+
.edgeLabel {
|
|
291
|
+
font-size: var(--fs-2xs);
|
|
292
|
+
font-weight: var(--fw-semibold);
|
|
293
|
+
paint-order: stroke;
|
|
294
|
+
stroke: var(--bg);
|
|
295
|
+
stroke-width: 4px;
|
|
296
|
+
stroke-linejoin: round;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* How many times the run took a line, beside its label. */
|
|
300
|
+
.takenCount {
|
|
301
|
+
font-size: var(--fs-2xs);
|
|
302
|
+
font-weight: var(--fw-bold, 700);
|
|
303
|
+
paint-order: stroke;
|
|
304
|
+
stroke: var(--bg);
|
|
305
|
+
stroke-width: 4px;
|
|
306
|
+
stroke-linejoin: round;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/* A tag on a node's top edge: a word in a pill, its colour a second signal. */
|
|
310
|
+
.badge rect {
|
|
311
|
+
fill: var(--bg-surface);
|
|
312
|
+
stroke: var(--border-hover);
|
|
313
|
+
stroke-width: 1;
|
|
314
|
+
}
|
|
315
|
+
.badge text {
|
|
316
|
+
fill: var(--text);
|
|
317
|
+
font-size: var(--fs-2xs);
|
|
318
|
+
font-weight: var(--fw-semibold);
|
|
319
|
+
letter-spacing: 0.03em;
|
|
320
|
+
}
|
|
321
|
+
.badge-entry rect,
|
|
322
|
+
.badge-exit rect {
|
|
323
|
+
fill: var(--pill-bg);
|
|
324
|
+
stroke: var(--pill-fg);
|
|
325
|
+
}
|
|
326
|
+
.badge-entry text,
|
|
327
|
+
.badge-exit text {
|
|
328
|
+
fill: var(--pill-fg);
|
|
329
|
+
}
|
|
330
|
+
.badge-fail rect {
|
|
331
|
+
fill: var(--danger-bg);
|
|
332
|
+
stroke: var(--danger);
|
|
333
|
+
}
|
|
334
|
+
.badge-fail text {
|
|
335
|
+
fill: var(--danger);
|
|
336
|
+
}
|
|
337
|
+
.badge-fanout rect {
|
|
338
|
+
fill: var(--info-bg);
|
|
339
|
+
stroke: var(--info);
|
|
340
|
+
}
|
|
341
|
+
.badge-fanout text {
|
|
342
|
+
fill: var(--info);
|
|
343
|
+
}
|
|
344
|
+
.badge-event rect {
|
|
345
|
+
fill: var(--wait-bg);
|
|
346
|
+
stroke: var(--wait);
|
|
347
|
+
}
|
|
348
|
+
.badge-event text {
|
|
349
|
+
fill: var(--wait);
|
|
350
|
+
}
|
|
351
|
+
.badge-problem rect {
|
|
352
|
+
fill: var(--danger);
|
|
353
|
+
stroke: var(--danger);
|
|
354
|
+
}
|
|
355
|
+
.badge-problem text {
|
|
356
|
+
fill: var(--text-on-accent);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.exitRing {
|
|
360
|
+
fill: none;
|
|
361
|
+
stroke: var(--text);
|
|
362
|
+
stroke-width: 1.5;
|
|
363
|
+
}
|
|
364
|
+
.exitCore {
|
|
365
|
+
fill: var(--text);
|
|
366
|
+
}
|
|
367
|
+
.terminalRing {
|
|
368
|
+
fill: none;
|
|
369
|
+
stroke: var(--text);
|
|
370
|
+
stroke-width: 2;
|
|
371
|
+
}
|
|
372
|
+
.terminalCore {
|
|
373
|
+
fill: var(--text);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/* A port sits on the node's border in its line's colour; an in-port is grey. */
|
|
377
|
+
.portOk {
|
|
378
|
+
fill: var(--success);
|
|
379
|
+
}
|
|
380
|
+
.portWarn {
|
|
381
|
+
fill: var(--warning);
|
|
382
|
+
}
|
|
383
|
+
.portErr {
|
|
384
|
+
fill: var(--danger);
|
|
385
|
+
}
|
|
386
|
+
.portNeutral,
|
|
387
|
+
.portIn {
|
|
388
|
+
fill: var(--text-muted);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
[data-dim="true"] {
|
|
392
|
+
opacity: 0.15;
|
|
393
|
+
transition: opacity 150ms;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
[data-off-path="true"] {
|
|
397
|
+
opacity: 0.25;
|
|
398
|
+
transition: opacity 150ms;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.stubBar {
|
|
402
|
+
stroke: var(--warning);
|
|
403
|
+
stroke-width: 2;
|
|
404
|
+
}
|
|
405
|
+
.stubText {
|
|
406
|
+
fill: var(--warning);
|
|
407
|
+
font-size: 11px;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
@keyframes changeFlash {
|
|
411
|
+
0%,
|
|
412
|
+
100% {
|
|
413
|
+
opacity: 1;
|
|
414
|
+
}
|
|
415
|
+
30% {
|
|
416
|
+
opacity: 0.45;
|
|
417
|
+
filter: drop-shadow(0 0 6px var(--accent));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
@keyframes changeFade {
|
|
421
|
+
to {
|
|
422
|
+
opacity: 0;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
[data-change="added"] {
|
|
426
|
+
animation: changeFlash 1.2s ease-out;
|
|
427
|
+
}
|
|
428
|
+
[data-change="moved"] {
|
|
429
|
+
transition: transform 400ms ease;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
[data-change="removed"] {
|
|
433
|
+
animation: changeFade 300ms ease-out forwards;
|
|
434
|
+
pointer-events: none;
|
|
435
|
+
}
|
|
436
|
+
.edge {
|
|
437
|
+
transition: d 400ms;
|
|
438
|
+
}
|
|
439
|
+
@media (prefers-reduced-motion: reduce) {
|
|
440
|
+
[data-change="added"],
|
|
441
|
+
[data-change="removed"] {
|
|
442
|
+
animation: none;
|
|
443
|
+
}
|
|
444
|
+
[data-change="moved"] {
|
|
445
|
+
transition: none;
|
|
446
|
+
}
|
|
447
|
+
.edge {
|
|
448
|
+
transition: none;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
[data-taken="false"] {
|
|
453
|
+
opacity: 0.3;
|
|
454
|
+
transition: opacity 150ms;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
[data-visited="false"] {
|
|
458
|
+
opacity: 0.4;
|
|
459
|
+
transition: opacity 150ms;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
[data-outcome="success"] .box {
|
|
463
|
+
stroke: var(--success);
|
|
464
|
+
stroke-width: 2.5;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
[data-outcome="failed"] .box {
|
|
468
|
+
stroke: var(--danger);
|
|
469
|
+
stroke-width: 2.5;
|
|
470
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function renderGraph(ui: React.ReactElement): Promise<import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>>;
|
|
2
|
+
export declare const nodeEl: (container: HTMLElement, id: string) => HTMLElement;
|
|
3
|
+
export declare const edgeEl: (container: HTMLElement, key: string) => HTMLElement;
|
|
4
|
+
export declare const labelOf: (container: HTMLElement, key: string) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { render, waitFor } from "@testing-library/react";
|
|
2
|
+
import { expect } from "vitest";
|
|
3
|
+
export async function renderGraph(ui) {
|
|
4
|
+
const rendered = render(ui);
|
|
5
|
+
await waitFor(() => expect(rendered.container.querySelector("[data-node]")).not.toBeNull());
|
|
6
|
+
return rendered;
|
|
7
|
+
}
|
|
8
|
+
export const nodeEl = (container, id) => container.querySelector(`[data-node="${id}"]`);
|
|
9
|
+
export const edgeEl = (container, key) => container.querySelector(`[data-edge="${key}"]`);
|
|
10
|
+
export const labelOf = (container, key) => container.querySelector(`[data-edge-label="${key}"]`)?.textContent ?? "";
|
|
11
|
+
//# sourceMappingURL=run-graph.test-helpers.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function subtitleOf(kind, status) {
|
|
2
|
+
const visitCount = status && status.count > 1 ? ` · ${status.count} visits` : "";
|
|
3
|
+
const openMark = status?.open ? " · open" : "";
|
|
4
|
+
return `${kind}${visitCount}${openMark}`;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=station-subtitle.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The rendered size of one element, followed as it resizes: the viewport fits the drawing to it, and the graph picks its wrap from it (run-viz FR4.1a). Null until measured — on the server and in a browser without ResizeObserver — which the graph reads as "one row".
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
|
+
export function useElementSize() {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
const [size, setSize] = useState(null);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const element = ref.current;
|
|
8
|
+
if (!element || typeof ResizeObserver === "undefined") {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const observer = new ResizeObserver(([entry]) => setSize({ width: entry.contentRect.width, height: entry.contentRect.height }));
|
|
12
|
+
observer.observe(element);
|
|
13
|
+
return () => observer.disconnect();
|
|
14
|
+
}, []);
|
|
15
|
+
return [ref, size];
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use-element-size.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AssemblyLineDefinition } from "./assembly-line-definition";
|
|
2
|
+
import type { ElkGraphOptions, NodeSize } from "./elk-graph";
|
|
3
|
+
import { layoutWithElk, type ElkLayout } from "./elk-layout";
|
|
4
|
+
/** Lays out the definition with ELK, ignoring results from replaced or unmounted effects. */
|
|
5
|
+
export declare function useElkLayout(definition: AssemblyLineDefinition, size?: NodeSize, layout?: typeof layoutWithElk, options?: ElkGraphOptions): ElkLayout | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// The ELK layout of one assembly line: null until ELK resolves it.
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { layoutWithElk } from "./elk-layout";
|
|
4
|
+
/** Lays out the definition with ELK, ignoring results from replaced or unmounted effects. */
|
|
5
|
+
export function useElkLayout(definition, size, layout = layoutWithElk, options) {
|
|
6
|
+
const [laidOut, setLaidOut] = useState(null);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
let isStale = false;
|
|
9
|
+
void layout(definition, size, options).then((result) => {
|
|
10
|
+
if (!isStale)
|
|
11
|
+
setLaidOut(result);
|
|
12
|
+
});
|
|
13
|
+
return () => {
|
|
14
|
+
isStale = true;
|
|
15
|
+
};
|
|
16
|
+
}, [definition, size, layout, options]);
|
|
17
|
+
return laidOut;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=use-elk-layout.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type KeyboardEvent } from "react";
|
|
2
|
+
import type { AssemblyLineDefinition } from "./assembly-line-definition";
|
|
3
|
+
export interface KeyboardCursor {
|
|
4
|
+
/** The key of the line the cursor is on, or null before any station is focused. */
|
|
5
|
+
chosenKey: string | null;
|
|
6
|
+
onFocusNode: (nodeId: string) => void;
|
|
7
|
+
onKeyDown: (event: KeyboardEvent<SVGGElement>) => void;
|
|
8
|
+
}
|
|
9
|
+
/** A cursor on the stations and their out-lines: focus puts it on a station's first line, ArrowDown and ArrowUp cycle that station's lines. */
|
|
10
|
+
export declare function useKeyboardCursor(definition: AssemblyLineDefinition): KeyboardCursor;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { edgeKeyOf } from "./metro/edge-key";
|
|
3
|
+
import { outgoingEdgesOf } from "./metro/node-edges";
|
|
4
|
+
import { stepAlong } from "./metro/step-along";
|
|
5
|
+
const DIRECTION_BY_KEY = {
|
|
6
|
+
ArrowDown: "down",
|
|
7
|
+
ArrowUp: "up",
|
|
8
|
+
ArrowRight: "right",
|
|
9
|
+
ArrowLeft: "left",
|
|
10
|
+
};
|
|
11
|
+
/** A cursor on the stations and their out-lines: focus puts it on a station's first line, ArrowDown and ArrowUp cycle that station's lines. */
|
|
12
|
+
export function useKeyboardCursor(definition) {
|
|
13
|
+
const [cursor, setCursor] = useState(null);
|
|
14
|
+
return {
|
|
15
|
+
chosenKey: cursor && chosenKeyOf(definition, cursor),
|
|
16
|
+
onFocusNode: (nodeId) => setCursor((current) => (current?.nodeId === nodeId ? current : { nodeId, lineIndex: 0 })),
|
|
17
|
+
onKeyDown: (event) => {
|
|
18
|
+
const direction = DIRECTION_BY_KEY[event.key];
|
|
19
|
+
if (!direction)
|
|
20
|
+
return;
|
|
21
|
+
event.preventDefault();
|
|
22
|
+
if (!cursor)
|
|
23
|
+
return;
|
|
24
|
+
const next = stepAlong(definition, cursor, direction);
|
|
25
|
+
setCursor(next);
|
|
26
|
+
if (next.nodeId !== cursor.nodeId)
|
|
27
|
+
focusStation(event.currentTarget, next.nodeId);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function focusStation(fromStation, nodeId) {
|
|
32
|
+
const stations = Array.from(fromStation.ownerSVGElement?.querySelectorAll("[data-node]") ?? []);
|
|
33
|
+
stations.find((station) => station.dataset.node === nodeId)?.focus();
|
|
34
|
+
}
|
|
35
|
+
function chosenKeyOf(definition, { nodeId, lineIndex }) {
|
|
36
|
+
const edge = outgoingEdgesOf(definition, nodeId).at(lineIndex);
|
|
37
|
+
return edge ? edgeKeyOf(edge) : null;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=use-keyboard-cursor.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ElkLayout } from "./elk-layout";
|
|
2
|
+
import type { VisibleGraph } from "./graph-view-model";
|
|
3
|
+
import { type NodeOffset } from "./metro/layout-diff";
|
|
4
|
+
import { type RemovedStation } from "./metro/removed-stations";
|
|
5
|
+
export interface LayoutChanges {
|
|
6
|
+
added: ReadonlySet<string>;
|
|
7
|
+
moved: ReadonlySet<string>;
|
|
8
|
+
offsets: ReadonlyMap<string, NodeOffset>;
|
|
9
|
+
removed: readonly RemovedStation[];
|
|
10
|
+
}
|
|
11
|
+
export declare function useLayoutChanges(layout: ElkLayout | null, graph: VisibleGraph): LayoutChanges;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// What the latest layout added, moved and dropped over the one before it, kept until the layout changes again.
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { diffLayouts, offsetsOf } from "./metro/layout-diff";
|
|
4
|
+
import { removedStationsOf } from "./metro/removed-stations";
|
|
5
|
+
/** How long a removed station fades; the same 300 ms as `changeFade` in run-graph.module.css. */
|
|
6
|
+
const FADE_MS = 300;
|
|
7
|
+
const NOTHING_CHANGED = { added: new Set(), moved: new Set(), offsets: new Map(), removed: [] };
|
|
8
|
+
export function useLayoutChanges(layout, graph) {
|
|
9
|
+
const previous = useRef(null);
|
|
10
|
+
const changes = useMemo(() => (layout ? changesOf(previous.current, layout) : NOTHING_CHANGED), [layout]);
|
|
11
|
+
const [clearedChanges, setClearedChanges] = useState(null);
|
|
12
|
+
const [fadedLayout, setFadedLayout] = useState(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (layout)
|
|
15
|
+
previous.current = { layout, graph };
|
|
16
|
+
const timer = setTimeout(() => setFadedLayout(layout), FADE_MS);
|
|
17
|
+
return () => clearTimeout(timer);
|
|
18
|
+
}, [layout]);
|
|
19
|
+
useEffect(() => afterNextPaint(() => setClearedChanges(changes)), [changes]);
|
|
20
|
+
return {
|
|
21
|
+
...changes,
|
|
22
|
+
offsets: clearedChanges === changes ? NOTHING_CHANGED.offsets : changes.offsets,
|
|
23
|
+
removed: fadedLayout === layout ? NOTHING_CHANGED.removed : changes.removed,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function changesOf(before, layout) {
|
|
27
|
+
const { added, moved } = diffLayouts(before?.layout ?? null, layout);
|
|
28
|
+
return {
|
|
29
|
+
added: new Set(added),
|
|
30
|
+
moved: new Set(moved),
|
|
31
|
+
offsets: offsetsOf(before?.layout ?? null, layout),
|
|
32
|
+
removed: before ? removedStationsOf(before, layout) : [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function afterNextPaint(callback) {
|
|
36
|
+
let inner = 0;
|
|
37
|
+
const outer = requestAnimationFrame(() => {
|
|
38
|
+
inner = requestAnimationFrame(callback);
|
|
39
|
+
});
|
|
40
|
+
return () => {
|
|
41
|
+
cancelAnimationFrame(outer);
|
|
42
|
+
cancelAnimationFrame(inner);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=use-layout-changes.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Tells the viewport each new size of the element it draws into, so it can fit the drawing to it.
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { useElementSize } from "./use-element-size";
|
|
4
|
+
export function useMeasuredBox(dispatch) {
|
|
5
|
+
const [ref, box] = useElementSize();
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (box) {
|
|
8
|
+
dispatch({ type: "measured", box });
|
|
9
|
+
}
|
|
10
|
+
}, [box, dispatch]);
|
|
11
|
+
return ref;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=use-measured-box.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AssemblyLineDefinition } from "./assembly-line-definition";
|
|
2
|
+
import type { StationVisits } from "./metro/station-visits";
|
|
3
|
+
export declare function useNodeSize(definition: AssemblyLineDefinition, visits: ReadonlyMap<string, StationVisits> | undefined): {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
widthOf: (nodeId: string) => number;
|
|
7
|
+
};
|