@principal-ai/subsystems-react 0.56.36 → 0.56.38
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/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.d.ts +13 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +52 -13
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/TrailsPanel.d.ts +6 -1
- package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
- package/dist/subsystem/TrailsPanel.js +6 -2
- package/dist/subsystem/TrailsPanel.js.map +1 -1
- package/dist/subsystem/nodes.d.ts +5 -5
- package/dist/subsystem/nodes.d.ts.map +1 -1
- package/dist/subsystem/nodes.js +196 -177
- package/dist/subsystem/nodes.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +3 -1
- package/src/stories/Canvases/Subsystem/AgentDrivenWalkthrough.stories.tsx +1543 -52
- package/src/subsystem/SubsystemComponentGraph.tsx +61 -12
- package/src/subsystem/TrailsPanel.test.tsx +32 -0
- package/src/subsystem/TrailsPanel.tsx +11 -1
- package/src/subsystem/nodes.tsx +291 -220
package/src/subsystem/nodes.tsx
CHANGED
|
@@ -8,15 +8,21 @@
|
|
|
8
8
|
* `onSelect` (to open the entry point / file).
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
createContext,
|
|
13
|
+
useContext,
|
|
14
|
+
useState,
|
|
15
|
+
type CSSProperties,
|
|
16
|
+
type ReactNode,
|
|
17
|
+
} from "react";
|
|
12
18
|
import {
|
|
13
19
|
Handle,
|
|
14
20
|
Position,
|
|
15
21
|
type Node,
|
|
16
22
|
type NodeProps,
|
|
17
23
|
type EdgeProps,
|
|
18
|
-
} from
|
|
19
|
-
import { useTheme } from
|
|
24
|
+
} from "@xyflow/react";
|
|
25
|
+
import { useTheme } from "@principal-ade/industry-theme";
|
|
20
26
|
import {
|
|
21
27
|
edgeColor,
|
|
22
28
|
edgeStrokeStyle,
|
|
@@ -43,10 +49,10 @@ import {
|
|
|
43
49
|
type SubsystemGraphNodeData,
|
|
44
50
|
type SubsystemGroupNodeData,
|
|
45
51
|
type SubsystemGraphEdge,
|
|
46
|
-
} from
|
|
47
|
-
import { componentColor } from
|
|
48
|
-
import { resolvePierreSyntaxThemeName } from
|
|
49
|
-
import { ISSUE_KIND_ICON } from
|
|
52
|
+
} from "./model";
|
|
53
|
+
import { componentColor } from "../pierre/constructColors";
|
|
54
|
+
import { resolvePierreSyntaxThemeName } from "../pierre/pierreSyntaxTheme";
|
|
55
|
+
import { ISSUE_KIND_ICON } from "./IssueList";
|
|
50
56
|
import {
|
|
51
57
|
CARD_GAP,
|
|
52
58
|
CARD_PAD_X,
|
|
@@ -56,15 +62,15 @@ import {
|
|
|
56
62
|
NODE_W,
|
|
57
63
|
TOGGLE_INSET,
|
|
58
64
|
TOGGLE_SIZE,
|
|
59
|
-
} from
|
|
60
|
-
import { MORPH_MS } from
|
|
61
|
-
import { TechMark, technologyBrand } from
|
|
65
|
+
} from "./containerCard";
|
|
66
|
+
import { MORPH_MS } from "./graphMorph";
|
|
67
|
+
import { TechMark, technologyBrand } from "./techIcons";
|
|
62
68
|
import {
|
|
63
69
|
DEPRECATED_ICON,
|
|
64
70
|
ROLE_ICON,
|
|
65
71
|
STORAGE_ICON,
|
|
66
72
|
iconForComponent,
|
|
67
|
-
} from
|
|
73
|
+
} from "./nodeIconography";
|
|
68
74
|
import {
|
|
69
75
|
AppWindow,
|
|
70
76
|
CirclePlus,
|
|
@@ -76,33 +82,35 @@ import {
|
|
|
76
82
|
Package,
|
|
77
83
|
TriangleAlert,
|
|
78
84
|
WandSparkles,
|
|
79
|
-
} from
|
|
80
|
-
import type { LucideIcon } from
|
|
85
|
+
} from "lucide-react";
|
|
86
|
+
import type { LucideIcon } from "lucide-react";
|
|
81
87
|
|
|
82
88
|
export const CONSTRUCT_LABEL: Record<string, string> = {
|
|
83
|
-
class:
|
|
84
|
-
function:
|
|
85
|
-
method:
|
|
86
|
-
interface:
|
|
87
|
-
type_alias:
|
|
88
|
-
enum:
|
|
89
|
-
store:
|
|
90
|
-
external:
|
|
91
|
-
custom_entity:
|
|
89
|
+
class: "class",
|
|
90
|
+
function: "function",
|
|
91
|
+
method: "method",
|
|
92
|
+
interface: "interface",
|
|
93
|
+
type_alias: "type alias",
|
|
94
|
+
enum: "enum",
|
|
95
|
+
store: "store",
|
|
96
|
+
external: "external",
|
|
97
|
+
custom_entity: "entity",
|
|
92
98
|
};
|
|
93
99
|
|
|
94
100
|
/** Insert zero-width spaces at identifier word boundaries so long names wrap
|
|
95
101
|
* on naming conventions (snake_case `foo_`|`bar`, camelCase `foo`|`Bar`,
|
|
96
102
|
* PascalCase `Foo`|`Bar`, acronym `ABC`|`Def`) instead of mid-character. */
|
|
97
103
|
function breakWords(s: string): string {
|
|
98
|
-
const zwsp =
|
|
99
|
-
return
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
const zwsp = "\u200b";
|
|
105
|
+
return (
|
|
106
|
+
s
|
|
107
|
+
// camelCase: lower/digit → Upper (and the boundary before it holds)
|
|
108
|
+
.replace(/([a-z0-9])([A-Z])/g, `$1${zwsp}$2`)
|
|
109
|
+
// acronym → word: `ABC`|`Def` (two Uppercase then a lowercase)
|
|
110
|
+
.replace(/([A-Z])([A-Z][a-z])/g, `$1${zwsp}$2`)
|
|
111
|
+
// separators: break after `_`, `-`, `.`
|
|
112
|
+
.replace(/([_\-.])([^_\-.\u200b])/g, `$1${zwsp}$2`)
|
|
113
|
+
);
|
|
106
114
|
}
|
|
107
115
|
|
|
108
116
|
export interface SubsystemGraphCallbacks {
|
|
@@ -162,7 +170,7 @@ function NodeStateMarker({
|
|
|
162
170
|
label: string;
|
|
163
171
|
color: string;
|
|
164
172
|
Icon: LucideIcon;
|
|
165
|
-
anchor:
|
|
173
|
+
anchor: "top-right" | "top-left" | "bottom-right";
|
|
166
174
|
count?: number;
|
|
167
175
|
}) {
|
|
168
176
|
const { theme } = useTheme();
|
|
@@ -173,17 +181,17 @@ function NodeStateMarker({
|
|
|
173
181
|
title={label}
|
|
174
182
|
aria-label={showCount ? `${label}: ${count}` : label}
|
|
175
183
|
style={{
|
|
176
|
-
position:
|
|
184
|
+
position: "absolute",
|
|
177
185
|
zIndex: 2,
|
|
178
|
-
display:
|
|
179
|
-
alignItems:
|
|
180
|
-
justifyContent:
|
|
186
|
+
display: "inline-flex",
|
|
187
|
+
alignItems: "center",
|
|
188
|
+
justifyContent: "center",
|
|
181
189
|
gap: showCount ? 4 : 0,
|
|
182
190
|
width: showCount ? undefined : 26,
|
|
183
191
|
minWidth: 26,
|
|
184
192
|
height: 26,
|
|
185
|
-
boxSizing:
|
|
186
|
-
padding: showCount ?
|
|
193
|
+
boxSizing: "border-box",
|
|
194
|
+
padding: showCount ? "0 5px" : 0,
|
|
187
195
|
border: `2px solid ${color}`,
|
|
188
196
|
borderRadius: 5,
|
|
189
197
|
background: nodeBg,
|
|
@@ -192,14 +200,16 @@ function NodeStateMarker({
|
|
|
192
200
|
fontSize: theme.fontSizes[1],
|
|
193
201
|
fontWeight: 700,
|
|
194
202
|
lineHeight: 1.1,
|
|
195
|
-
pointerEvents:
|
|
196
|
-
...(anchor ===
|
|
203
|
+
pointerEvents: "none",
|
|
204
|
+
...(anchor === "top-right"
|
|
197
205
|
? { top: -10, right: -8 }
|
|
198
|
-
:
|
|
206
|
+
: anchor === "top-left"
|
|
207
|
+
? { top: -10, left: -8 }
|
|
208
|
+
: { bottom: -8, right: -8 }),
|
|
199
209
|
}}
|
|
200
210
|
>
|
|
201
211
|
<Icon
|
|
202
|
-
className={label ===
|
|
212
|
+
className={label === "working" ? "agent-working-icon" : undefined}
|
|
203
213
|
size={14}
|
|
204
214
|
strokeWidth={2}
|
|
205
215
|
aria-hidden="true"
|
|
@@ -233,14 +243,14 @@ function IssueChip({
|
|
|
233
243
|
<div
|
|
234
244
|
aria-hidden
|
|
235
245
|
style={{
|
|
236
|
-
position:
|
|
246
|
+
position: "absolute",
|
|
237
247
|
zIndex: 2,
|
|
238
|
-
display:
|
|
239
|
-
alignItems:
|
|
240
|
-
justifyContent:
|
|
248
|
+
display: "inline-flex",
|
|
249
|
+
alignItems: "center",
|
|
250
|
+
justifyContent: "center",
|
|
241
251
|
gap: 4,
|
|
242
252
|
minWidth: 22,
|
|
243
|
-
padding:
|
|
253
|
+
padding: "3px 5px",
|
|
244
254
|
borderRadius: 5,
|
|
245
255
|
border: `2px solid ${color}`,
|
|
246
256
|
background: badgeBg,
|
|
@@ -249,7 +259,7 @@ function IssueChip({
|
|
|
249
259
|
fontSize: theme.fontSizes[1],
|
|
250
260
|
fontWeight: 700,
|
|
251
261
|
lineHeight: 1.1,
|
|
252
|
-
pointerEvents:
|
|
262
|
+
pointerEvents: "none",
|
|
253
263
|
...anchor,
|
|
254
264
|
}}
|
|
255
265
|
>
|
|
@@ -259,7 +269,9 @@ function IssueChip({
|
|
|
259
269
|
);
|
|
260
270
|
}
|
|
261
271
|
|
|
262
|
-
export function SubsystemComponentNode(
|
|
272
|
+
export function SubsystemComponentNode(
|
|
273
|
+
props: NodeProps<Node<SubsystemGraphNodeData, "subsystem-component">>,
|
|
274
|
+
) {
|
|
263
275
|
const { theme, mode } = useTheme();
|
|
264
276
|
const callbacks = useSubsystemCallbacks();
|
|
265
277
|
const { data, selected, width: nodeWidth, height: nodeHeight } = props;
|
|
@@ -272,14 +284,14 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
272
284
|
const proposed = data.proposed === true;
|
|
273
285
|
const proposalColor = HOST_PROPOSAL_COLOR;
|
|
274
286
|
const working = data.working === true;
|
|
275
|
-
const workingColor = theme.colors.accent ?? theme.colors.primary ??
|
|
287
|
+
const workingColor = theme.colors.accent ?? theme.colors.primary ?? "#a78bfa";
|
|
276
288
|
const removed = data.removed === true;
|
|
277
289
|
const removedColor = DEPRECATED_COLOR;
|
|
278
290
|
const issue = data.issue;
|
|
279
291
|
const issueColor =
|
|
280
|
-
issue?.severity ===
|
|
281
|
-
? (theme.colors.error ??
|
|
282
|
-
: (theme.colors.warning ??
|
|
292
|
+
issue?.severity === "error"
|
|
293
|
+
? (theme.colors.error ?? "#e5534b")
|
|
294
|
+
: (theme.colors.warning ?? "#d4a017");
|
|
283
295
|
// Primary identity: framework stereotypes may override the construct glyph
|
|
284
296
|
// with an official technology mark; custom entities use their authored kind.
|
|
285
297
|
const PrimaryIcon = iconForComponent(c);
|
|
@@ -289,15 +301,24 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
289
301
|
const primaryColor = constructBadgeColor(c) ?? color;
|
|
290
302
|
const configuredMax = callbacks.maxNodeWidth;
|
|
291
303
|
const maxWidth = configuredMax ?? 300;
|
|
292
|
-
const displayName = deriveNameFromSymbol(
|
|
304
|
+
const displayName = deriveNameFromSymbol(
|
|
305
|
+
c.symbol,
|
|
306
|
+
c.construct,
|
|
307
|
+
c.name,
|
|
308
|
+
c.file,
|
|
309
|
+
c.stereotype,
|
|
310
|
+
);
|
|
293
311
|
const badgeMinWidth = nodeMinWidthForBadges(c);
|
|
294
312
|
const roleLabel = rightBadgeLabel(c);
|
|
295
313
|
const roleColor = rightBadgeColor(c);
|
|
296
314
|
const RoleIcon =
|
|
297
|
-
roleLabel ===
|
|
315
|
+
roleLabel === "entry" || roleLabel === "service"
|
|
316
|
+
? ROLE_ICON[roleLabel]
|
|
317
|
+
: undefined;
|
|
298
318
|
const storageLabel = storageBadgeLabel(c);
|
|
299
319
|
const storageColor = storageBadgeColor(c);
|
|
300
|
-
const storageIconKey =
|
|
320
|
+
const storageIconKey =
|
|
321
|
+
storageLabel === "db" ? "external" : storageLabel?.toLowerCase();
|
|
301
322
|
const StorageIcon = storageIconKey ? STORAGE_ICON[storageIconKey] : undefined;
|
|
302
323
|
const deprecatedLabel = deprecatedBadgeLabel(c);
|
|
303
324
|
const deprecatedColor = deprecatedBadgeColor(c);
|
|
@@ -313,28 +334,29 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
313
334
|
: fileMatch
|
|
314
335
|
? theme.colors.primary
|
|
315
336
|
: color;
|
|
316
|
-
const isSelected =
|
|
317
|
-
|
|
337
|
+
const isSelected =
|
|
338
|
+
selected || (data.isSelected as boolean | undefined) === true;
|
|
339
|
+
const isExternal = c.construct === "external";
|
|
318
340
|
const nodeRadius = isExternal ? 0 : 8;
|
|
319
341
|
const badgeRadius = isExternal ? 0 : 4;
|
|
320
342
|
const borderW = proposed ? 3 : isSelected || fileMatch ? 4 : 2;
|
|
321
343
|
const badgeBottom = -9 - borderW;
|
|
322
|
-
const borderStyle = removed || proposed ?
|
|
344
|
+
const borderStyle = removed || proposed ? "dashed" : "solid";
|
|
323
345
|
const secondaryBadgeStyle: CSSProperties = {
|
|
324
|
-
display:
|
|
325
|
-
alignItems:
|
|
326
|
-
justifyContent:
|
|
327
|
-
boxSizing:
|
|
346
|
+
display: "inline-flex",
|
|
347
|
+
alignItems: "center",
|
|
348
|
+
justifyContent: "center",
|
|
349
|
+
boxSizing: "border-box",
|
|
328
350
|
gap: 5,
|
|
329
351
|
height: 26,
|
|
330
|
-
padding:
|
|
352
|
+
padding: "2px 8px",
|
|
331
353
|
fontFamily: theme.fonts.monospace,
|
|
332
354
|
fontSize: theme.fontSizes[1],
|
|
333
355
|
fontWeight: 700,
|
|
334
356
|
letterSpacing: 0.5,
|
|
335
|
-
lineHeight:
|
|
336
|
-
textTransform:
|
|
337
|
-
whiteSpace:
|
|
357
|
+
lineHeight: "17px",
|
|
358
|
+
textTransform: "uppercase",
|
|
359
|
+
whiteSpace: "nowrap",
|
|
338
360
|
background: nodeBg,
|
|
339
361
|
border: `2px solid currentColor`,
|
|
340
362
|
borderRadius: badgeRadius,
|
|
@@ -355,19 +377,19 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
355
377
|
callbacks.onSelect?.(c.alias);
|
|
356
378
|
}}
|
|
357
379
|
style={{
|
|
358
|
-
position:
|
|
359
|
-
display:
|
|
360
|
-
flexDirection:
|
|
361
|
-
justifyContent:
|
|
362
|
-
alignItems:
|
|
363
|
-
boxSizing:
|
|
380
|
+
position: "relative",
|
|
381
|
+
display: "flex",
|
|
382
|
+
flexDirection: "column",
|
|
383
|
+
justifyContent: "flex-start",
|
|
384
|
+
alignItems: "center",
|
|
385
|
+
boxSizing: "border-box",
|
|
364
386
|
width: nodeWidth,
|
|
365
387
|
height: nodeHeight,
|
|
366
388
|
minWidth: badgeMinWidth,
|
|
367
389
|
maxWidth,
|
|
368
390
|
gap: 8,
|
|
369
|
-
padding:
|
|
370
|
-
overflow:
|
|
391
|
+
padding: "14px 16px 0",
|
|
392
|
+
overflow: "visible",
|
|
371
393
|
borderRadius: nodeRadius,
|
|
372
394
|
background: hover ? hoverBg : nodeBg,
|
|
373
395
|
// Selection / file-match thickens the border. Proposed and removed
|
|
@@ -377,14 +399,14 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
377
399
|
? `0 0 0 3px ${workingColor}55, 0 0 18px ${workingColor}44`
|
|
378
400
|
: fileMatch
|
|
379
401
|
? `0 1px 4px rgba(0,0,0,0.25), 0 0 12px ${theme.colors.primary}55`
|
|
380
|
-
:
|
|
402
|
+
: "0 1px 4px rgba(0,0,0,0.25)",
|
|
381
403
|
opacity: removed
|
|
382
404
|
? 0.45
|
|
383
405
|
: working || (fileMatch !== false && data.dimmed !== true)
|
|
384
406
|
? 1
|
|
385
407
|
: 0.18,
|
|
386
|
-
transition:
|
|
387
|
-
cursor:
|
|
408
|
+
transition: "opacity 150ms ease, background-color 120ms ease",
|
|
409
|
+
cursor: "pointer",
|
|
388
410
|
fontFamily: theme.fonts.body,
|
|
389
411
|
}}
|
|
390
412
|
>
|
|
@@ -393,13 +415,13 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
393
415
|
title={primaryLabel}
|
|
394
416
|
aria-label={primaryLabel}
|
|
395
417
|
style={{
|
|
396
|
-
display:
|
|
397
|
-
alignItems:
|
|
398
|
-
justifyContent:
|
|
418
|
+
display: "inline-flex",
|
|
419
|
+
alignItems: "center",
|
|
420
|
+
justifyContent: "center",
|
|
399
421
|
gap: 6,
|
|
400
|
-
maxWidth:
|
|
422
|
+
maxWidth: "100%",
|
|
401
423
|
height: 24,
|
|
402
|
-
flex:
|
|
424
|
+
flex: "0 0 auto",
|
|
403
425
|
color: primaryColor,
|
|
404
426
|
lineHeight: 1,
|
|
405
427
|
}}
|
|
@@ -408,7 +430,7 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
408
430
|
<TechMark brand={primaryBrand} size={24} showTitle={false} />
|
|
409
431
|
) : (
|
|
410
432
|
<PrimaryIcon
|
|
411
|
-
size={c.construct ===
|
|
433
|
+
size={c.construct === "function" ? 34 : 24}
|
|
412
434
|
strokeWidth={2}
|
|
413
435
|
aria-hidden="true"
|
|
414
436
|
/>
|
|
@@ -416,15 +438,15 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
416
438
|
<span
|
|
417
439
|
style={{
|
|
418
440
|
minWidth: 0,
|
|
419
|
-
overflow:
|
|
420
|
-
textOverflow:
|
|
441
|
+
overflow: "hidden",
|
|
442
|
+
textOverflow: "ellipsis",
|
|
421
443
|
fontFamily: theme.fonts.monospace,
|
|
422
444
|
fontSize: theme.fontSizes[1],
|
|
423
445
|
fontWeight: 600,
|
|
424
446
|
letterSpacing: 0.25,
|
|
425
|
-
lineHeight:
|
|
426
|
-
textTransform:
|
|
427
|
-
whiteSpace:
|
|
447
|
+
lineHeight: "16px",
|
|
448
|
+
textTransform: "uppercase",
|
|
449
|
+
whiteSpace: "nowrap",
|
|
428
450
|
}}
|
|
429
451
|
>
|
|
430
452
|
{primaryLabel.toUpperCase()}
|
|
@@ -453,7 +475,7 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
453
475
|
label="proposed"
|
|
454
476
|
color={proposalColor}
|
|
455
477
|
Icon={CirclePlus}
|
|
456
|
-
anchor="top-right"
|
|
478
|
+
anchor={working ? "top-left" : "top-right"}
|
|
457
479
|
/>
|
|
458
480
|
)}
|
|
459
481
|
{removed && (
|
|
@@ -461,22 +483,24 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
461
483
|
label="removed"
|
|
462
484
|
color={removedColor}
|
|
463
485
|
Icon={CircleX}
|
|
464
|
-
anchor="top-right"
|
|
486
|
+
anchor={working ? "top-left" : "top-right"}
|
|
465
487
|
/>
|
|
466
488
|
)}
|
|
467
489
|
|
|
468
490
|
{/* Secondary badges — orthogonal role, storage backing, and deprecation. */}
|
|
469
|
-
{(roleLabel != null ||
|
|
491
|
+
{(roleLabel != null ||
|
|
492
|
+
storageLabel != null ||
|
|
493
|
+
deprecatedLabel != null) && (
|
|
470
494
|
<div
|
|
471
495
|
style={{
|
|
472
|
-
position:
|
|
496
|
+
position: "absolute",
|
|
473
497
|
bottom: badgeBottom,
|
|
474
|
-
left:
|
|
475
|
-
transform:
|
|
498
|
+
left: "50%",
|
|
499
|
+
transform: "translateX(-50%)",
|
|
476
500
|
zIndex: 1,
|
|
477
|
-
display:
|
|
501
|
+
display: "flex",
|
|
478
502
|
gap: 6,
|
|
479
|
-
whiteSpace:
|
|
503
|
+
whiteSpace: "nowrap",
|
|
480
504
|
}}
|
|
481
505
|
>
|
|
482
506
|
{storageLabel != null && storageColor != null && StorageIcon && (
|
|
@@ -507,20 +531,24 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
507
531
|
aria-label={
|
|
508
532
|
removal
|
|
509
533
|
? `Deprecated — removed in ${removal.commit}. Show removal details.`
|
|
510
|
-
:
|
|
534
|
+
: "Deprecated — show removal details."
|
|
511
535
|
}
|
|
512
536
|
onClick={(e) => {
|
|
513
537
|
e.stopPropagation();
|
|
514
538
|
setShowRemoval((v) => !v);
|
|
515
539
|
}}
|
|
516
540
|
onKeyDown={(e) => {
|
|
517
|
-
if (e.key ===
|
|
541
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
518
542
|
e.stopPropagation();
|
|
519
543
|
e.preventDefault();
|
|
520
544
|
setShowRemoval((v) => !v);
|
|
521
545
|
}
|
|
522
546
|
}}
|
|
523
|
-
style={{
|
|
547
|
+
style={{
|
|
548
|
+
...secondaryBadgeStyle,
|
|
549
|
+
color: deprecatedColor,
|
|
550
|
+
cursor: "pointer",
|
|
551
|
+
}}
|
|
524
552
|
>
|
|
525
553
|
<DEPRECATED_ICON size={14} strokeWidth={2} aria-hidden="true" />
|
|
526
554
|
<span>{deprecatedLabel}</span>
|
|
@@ -537,24 +565,24 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
537
565
|
aria-label="Removal provenance"
|
|
538
566
|
onClick={(e) => e.stopPropagation()}
|
|
539
567
|
style={{
|
|
540
|
-
position:
|
|
541
|
-
bottom:
|
|
542
|
-
left:
|
|
543
|
-
transform:
|
|
568
|
+
position: "absolute",
|
|
569
|
+
bottom: "100%",
|
|
570
|
+
left: "50%",
|
|
571
|
+
transform: "translateX(-50%)",
|
|
544
572
|
marginBottom: 6,
|
|
545
573
|
zIndex: 20,
|
|
546
574
|
width: 260,
|
|
547
|
-
padding:
|
|
575
|
+
padding: "8px 10px",
|
|
548
576
|
borderRadius: 6,
|
|
549
577
|
background: nodeBg,
|
|
550
578
|
border: `1px solid ${DEPRECATED_COLOR}`,
|
|
551
|
-
boxShadow:
|
|
579
|
+
boxShadow: "0 6px 20px rgba(0,0,0,0.35)",
|
|
552
580
|
fontFamily: theme.fonts.body,
|
|
553
581
|
fontSize: theme.fontSizes[1],
|
|
554
582
|
color: theme.colors.text,
|
|
555
|
-
textAlign:
|
|
556
|
-
whiteSpace:
|
|
557
|
-
cursor:
|
|
583
|
+
textAlign: "left",
|
|
584
|
+
whiteSpace: "normal",
|
|
585
|
+
cursor: "default",
|
|
558
586
|
}}
|
|
559
587
|
>
|
|
560
588
|
<div
|
|
@@ -568,11 +596,15 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
568
596
|
</div>
|
|
569
597
|
{removal ? (
|
|
570
598
|
<>
|
|
571
|
-
<div
|
|
599
|
+
<div
|
|
600
|
+
style={{ fontFamily: theme.fonts.monospace, marginBottom: 4 }}
|
|
601
|
+
>
|
|
572
602
|
removed in {removal.commit}
|
|
573
603
|
</div>
|
|
574
604
|
{removal.reason && (
|
|
575
|
-
<div style={{ color: theme.colors.textSecondary }}>
|
|
605
|
+
<div style={{ color: theme.colors.textSecondary }}>
|
|
606
|
+
{removal.reason}
|
|
607
|
+
</div>
|
|
576
608
|
)}
|
|
577
609
|
</>
|
|
578
610
|
) : (
|
|
@@ -591,14 +623,14 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
591
623
|
fontSize: theme.fontSizes[2],
|
|
592
624
|
fontWeight: 600,
|
|
593
625
|
color: proposed ? proposalColor : theme.colors.text,
|
|
594
|
-
textDecoration: removed ?
|
|
626
|
+
textDecoration: removed ? "line-through" : undefined,
|
|
595
627
|
lineHeight: 1.2,
|
|
596
|
-
textAlign:
|
|
628
|
+
textAlign: "center",
|
|
597
629
|
// Let long names wrap within the node's capped width (instead of
|
|
598
630
|
// truncating), but cap each line so the node doesn't grow unbounded.
|
|
599
|
-
whiteSpace:
|
|
600
|
-
overflowWrap:
|
|
601
|
-
maxWidth:
|
|
631
|
+
whiteSpace: "normal",
|
|
632
|
+
overflowWrap: "anywhere",
|
|
633
|
+
maxWidth: "100%",
|
|
602
634
|
fontFamily: theme.fonts.body,
|
|
603
635
|
}}
|
|
604
636
|
>
|
|
@@ -610,27 +642,25 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
610
642
|
(e.g. the dotted host on methods, or a different code identity). */}
|
|
611
643
|
{c.symbol &&
|
|
612
644
|
c.symbol !==
|
|
613
|
-
displayName
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
</div>
|
|
633
|
-
)}
|
|
645
|
+
displayName.replace(/ ?\{\}$/, "").replace(/\(\)$/, "") && (
|
|
646
|
+
<div
|
|
647
|
+
style={{
|
|
648
|
+
fontSize: theme.fontSizes[0],
|
|
649
|
+
fontFamily: theme.fonts.monospace,
|
|
650
|
+
color: proposed ? proposalColor : color,
|
|
651
|
+
textDecoration: removed ? "line-through" : undefined,
|
|
652
|
+
marginTop: 1,
|
|
653
|
+
textAlign: "center",
|
|
654
|
+
whiteSpace: "nowrap",
|
|
655
|
+
overflow: "hidden",
|
|
656
|
+
textOverflow: "ellipsis",
|
|
657
|
+
maxWidth: "100%",
|
|
658
|
+
}}
|
|
659
|
+
title={c.symbol}
|
|
660
|
+
>
|
|
661
|
+
{c.symbol}
|
|
662
|
+
</div>
|
|
663
|
+
)}
|
|
634
664
|
|
|
635
665
|
<Handle type="target" position={Position.Left} style={{ opacity: 0 }} />
|
|
636
666
|
<Handle type="source" position={Position.Right} style={{ opacity: 0 }} />
|
|
@@ -649,10 +679,16 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
649
679
|
* code folder, not a container, so it keeps the bare dashed frame with a
|
|
650
680
|
* collapsible path badge.
|
|
651
681
|
*/
|
|
652
|
-
export function SubsystemGroupNode(
|
|
682
|
+
export function SubsystemGroupNode(
|
|
683
|
+
props: NodeProps<Node<SubsystemGroupNodeData, "subsystem-group">>,
|
|
684
|
+
) {
|
|
653
685
|
const region = props.data.region;
|
|
654
686
|
if (!region) return null;
|
|
655
|
-
return isCardFrame(region) ?
|
|
687
|
+
return isCardFrame(region) ? (
|
|
688
|
+
<CardFrame {...props} />
|
|
689
|
+
) : (
|
|
690
|
+
<BadgeFrame {...props} />
|
|
691
|
+
);
|
|
656
692
|
}
|
|
657
693
|
|
|
658
694
|
/**
|
|
@@ -665,7 +701,9 @@ export function SubsystemGroupNode(props: NodeProps<Node<SubsystemGroupNodeData,
|
|
|
665
701
|
* encoding: a process is a deployment unit (solid, slight radius), a package is
|
|
666
702
|
* code organisation (dashed, rounded).
|
|
667
703
|
*/
|
|
668
|
-
function CardFrame(
|
|
704
|
+
function CardFrame(
|
|
705
|
+
props: NodeProps<Node<SubsystemGroupNodeData, "subsystem-group">>,
|
|
706
|
+
) {
|
|
669
707
|
const { theme } = useTheme();
|
|
670
708
|
const { data, width, height, selected } = props as unknown as {
|
|
671
709
|
data: SubsystemGroupNodeData;
|
|
@@ -680,34 +718,38 @@ function CardFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-grou
|
|
|
680
718
|
const dimmed = data.dimmed === true;
|
|
681
719
|
const hidden = (data as { hidden?: boolean }).hidden === true;
|
|
682
720
|
const collapsed = data.collapsed === true;
|
|
683
|
-
const isPackage = region.kind ===
|
|
684
|
-
const frameStyle = !isPackage || selected ?
|
|
721
|
+
const isPackage = region.kind === "package" || region.chrome === "package";
|
|
722
|
+
const frameStyle = !isPackage || selected ? "solid" : "dashed";
|
|
685
723
|
const frameRadius = isPackage ? 12 : 4;
|
|
686
|
-
const containerKind = region.containerKind ??
|
|
687
|
-
const Icon = isPackage
|
|
724
|
+
const containerKind = region.containerKind ?? "application";
|
|
725
|
+
const Icon = isPackage
|
|
726
|
+
? Package
|
|
727
|
+
: containerKind === "data-store"
|
|
728
|
+
? Database
|
|
729
|
+
: AppWindow;
|
|
688
730
|
// The technology row falls back to the kind so it is never blank — the same
|
|
689
731
|
// fallback the C4 card uses.
|
|
690
|
-
const topLabel = region.technology ?? (isPackage ?
|
|
732
|
+
const topLabel = region.technology ?? (isPackage ? "package" : containerKind);
|
|
691
733
|
const ToggleIcon = collapsed ? Maximize2 : Minimize2;
|
|
692
734
|
|
|
693
735
|
return (
|
|
694
736
|
<div
|
|
695
737
|
title={region.description}
|
|
696
738
|
style={{
|
|
697
|
-
position:
|
|
739
|
+
position: "relative",
|
|
698
740
|
width: width ?? (collapsed ? NODE_W : 400),
|
|
699
741
|
height: height ?? (collapsed ? NODE_H : 300),
|
|
700
|
-
boxSizing:
|
|
742
|
+
boxSizing: "border-box",
|
|
701
743
|
borderRadius: frameRadius,
|
|
702
744
|
border: `2px ${frameStyle} ${color}`,
|
|
703
745
|
background: theme.colors.backgroundSecondary ?? theme.colors.background,
|
|
704
|
-
boxShadow:
|
|
746
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.25)",
|
|
705
747
|
opacity: hidden ? 0 : dimmed ? 0.35 : 1,
|
|
706
748
|
// React Flow snaps the wrapper to the new size; this box eases between
|
|
707
749
|
// the open frame and the closed card so the toggle reads as a grow /
|
|
708
750
|
// shrink rather than a swap.
|
|
709
751
|
transition: `opacity 150ms ease, width ${MORPH_MS}ms ease, height ${MORPH_MS}ms ease`,
|
|
710
|
-
pointerEvents:
|
|
752
|
+
pointerEvents: "none",
|
|
711
753
|
fontFamily: theme.fonts.body,
|
|
712
754
|
}}
|
|
713
755
|
>
|
|
@@ -715,21 +757,21 @@ function CardFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-grou
|
|
|
715
757
|
(`OPEN_HEADER_PAD`), inset by the card's own padding. */}
|
|
716
758
|
<div
|
|
717
759
|
style={{
|
|
718
|
-
position:
|
|
760
|
+
position: "absolute",
|
|
719
761
|
top: 0,
|
|
720
762
|
left: 0,
|
|
721
763
|
right: 0,
|
|
722
|
-
display:
|
|
723
|
-
flexDirection:
|
|
764
|
+
display: "flex",
|
|
765
|
+
flexDirection: "column",
|
|
724
766
|
gap: CARD_GAP,
|
|
725
767
|
padding: `${CARD_PAD_Y}px ${CARD_PAD_X}px`,
|
|
726
|
-
boxSizing:
|
|
768
|
+
boxSizing: "border-box",
|
|
727
769
|
}}
|
|
728
770
|
>
|
|
729
771
|
<ContainerCardHeader
|
|
730
772
|
label={region.label}
|
|
731
773
|
Icon={Icon}
|
|
732
|
-
iconLabel={isPackage ?
|
|
774
|
+
iconLabel={isPackage ? "package" : containerKind}
|
|
733
775
|
color={color}
|
|
734
776
|
topLabel={topLabel}
|
|
735
777
|
brand={brand}
|
|
@@ -746,25 +788,26 @@ function CardFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-grou
|
|
|
746
788
|
data.onToggleCollapse?.();
|
|
747
789
|
}}
|
|
748
790
|
onDoubleClick={(e) => e.stopPropagation()}
|
|
749
|
-
aria-label={collapsed ?
|
|
791
|
+
aria-label={collapsed ? "Show members" : "Hide members"}
|
|
750
792
|
aria-pressed={collapsed}
|
|
751
793
|
style={{
|
|
752
|
-
position:
|
|
794
|
+
position: "absolute",
|
|
753
795
|
right: TOGGLE_INSET,
|
|
754
796
|
bottom: TOGGLE_INSET,
|
|
755
|
-
display:
|
|
756
|
-
alignItems:
|
|
757
|
-
justifyContent:
|
|
797
|
+
display: "inline-flex",
|
|
798
|
+
alignItems: "center",
|
|
799
|
+
justifyContent: "center",
|
|
758
800
|
width: TOGGLE_SIZE,
|
|
759
801
|
height: TOGGLE_SIZE,
|
|
760
802
|
padding: 0,
|
|
761
803
|
borderRadius: 4,
|
|
762
804
|
border: `1px solid ${color}`,
|
|
763
|
-
background:
|
|
805
|
+
background:
|
|
806
|
+
theme.colors.backgroundSecondary ?? theme.colors.background,
|
|
764
807
|
color,
|
|
765
|
-
cursor:
|
|
808
|
+
cursor: "pointer",
|
|
766
809
|
lineHeight: 1,
|
|
767
|
-
pointerEvents:
|
|
810
|
+
pointerEvents: "auto",
|
|
768
811
|
}}
|
|
769
812
|
>
|
|
770
813
|
<ToggleIcon size={13} strokeWidth={2.25} />
|
|
@@ -773,9 +816,9 @@ function CardFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-grou
|
|
|
773
816
|
{data.issue && ISSUE_KIND_ICON[data.issue.kind] && (
|
|
774
817
|
<IssueChip
|
|
775
818
|
color={
|
|
776
|
-
data.issue.severity ===
|
|
777
|
-
? (theme.colors.error ??
|
|
778
|
-
: (theme.colors.warning ??
|
|
819
|
+
data.issue.severity === "error"
|
|
820
|
+
? (theme.colors.error ?? "#e5534b")
|
|
821
|
+
: (theme.colors.warning ?? "#d4a017")
|
|
779
822
|
}
|
|
780
823
|
Icon={ISSUE_KIND_ICON[data.issue.kind]!}
|
|
781
824
|
count={data.issue.count}
|
|
@@ -786,8 +829,16 @@ function CardFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-grou
|
|
|
786
829
|
up onto it, and React Flow needs a handle on each end to draw them. */}
|
|
787
830
|
{collapsed && (
|
|
788
831
|
<>
|
|
789
|
-
<Handle
|
|
790
|
-
|
|
832
|
+
<Handle
|
|
833
|
+
type="target"
|
|
834
|
+
position={Position.Left}
|
|
835
|
+
style={{ opacity: 0 }}
|
|
836
|
+
/>
|
|
837
|
+
<Handle
|
|
838
|
+
type="source"
|
|
839
|
+
position={Position.Right}
|
|
840
|
+
style={{ opacity: 0 }}
|
|
841
|
+
/>
|
|
791
842
|
</>
|
|
792
843
|
)}
|
|
793
844
|
</div>
|
|
@@ -798,7 +849,9 @@ function CardFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-grou
|
|
|
798
849
|
* transparent body, and a path badge astride the top edge that collapses a long
|
|
799
850
|
* path to `first/…/last` and expands on click.
|
|
800
851
|
*/
|
|
801
|
-
function BadgeFrame(
|
|
852
|
+
function BadgeFrame(
|
|
853
|
+
props: NodeProps<Node<SubsystemGroupNodeData, "subsystem-group">>,
|
|
854
|
+
) {
|
|
802
855
|
const { theme } = useTheme();
|
|
803
856
|
const { data, width, height, selected } = props as unknown as {
|
|
804
857
|
data: SubsystemGroupNodeData;
|
|
@@ -811,7 +864,8 @@ function BadgeFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-gro
|
|
|
811
864
|
// (directory, or a module whose key names a folder) share one neutral hue;
|
|
812
865
|
// everything else hashes per key.
|
|
813
866
|
const color =
|
|
814
|
-
data.color ??
|
|
867
|
+
data.color ??
|
|
868
|
+
(isFolderFrame(region) ? FOLDER_FRAME_COLOR : packageColor(region.key));
|
|
815
869
|
const dimmed = data.dimmed === true;
|
|
816
870
|
const hidden = (data as { hidden?: boolean }).hidden === true;
|
|
817
871
|
// Label is the region identity alone (the path). Kind is carried by the
|
|
@@ -819,7 +873,10 @@ function BadgeFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-gro
|
|
|
819
873
|
const label = region.label;
|
|
820
874
|
const [expandedLabel, setExpandedLabel] = useState<string | null>(null);
|
|
821
875
|
const expanded = expandedLabel === label;
|
|
822
|
-
const availableBadgeWidth = Math.max(
|
|
876
|
+
const availableBadgeWidth = Math.max(
|
|
877
|
+
0,
|
|
878
|
+
(width ?? 400) - MODULE_BADGE_INSET * 2 - 4,
|
|
879
|
+
);
|
|
823
880
|
const collapsedLabel = moduleBadgeLabel(label, availableBadgeWidth);
|
|
824
881
|
// A module badge is collapsible while something collapsed, and stays
|
|
825
882
|
// togglable while expanded (so the full path can collapse back).
|
|
@@ -827,57 +884,71 @@ function BadgeFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-gro
|
|
|
827
884
|
// Hover affords clickability by revealing more of the path — the badge
|
|
828
885
|
// widens to fit real text (never stretched), hinting before the click.
|
|
829
886
|
const [hover, setHover] = useState(false);
|
|
830
|
-
const hoveredLabel = canToggle
|
|
887
|
+
const hoveredLabel = canToggle
|
|
888
|
+
? moduleBadgeHoverLabel(label, availableBadgeWidth)
|
|
889
|
+
: label;
|
|
831
890
|
const badgeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
832
891
|
// Code folders stay dashed until selected; the body is transparent so nested
|
|
833
892
|
// frames don't stack washes.
|
|
834
|
-
const frameStyle = selected ?
|
|
893
|
+
const frameStyle = selected ? "solid" : "dashed";
|
|
835
894
|
|
|
836
895
|
return (
|
|
837
896
|
<div
|
|
838
897
|
style={{
|
|
839
|
-
position:
|
|
898
|
+
position: "relative",
|
|
840
899
|
width: width ?? 400,
|
|
841
900
|
height: height ?? 300,
|
|
842
|
-
boxSizing:
|
|
901
|
+
boxSizing: "border-box",
|
|
843
902
|
borderRadius: 12,
|
|
844
903
|
border: `2px ${frameStyle} ${color}`,
|
|
845
|
-
background:
|
|
904
|
+
background: "transparent",
|
|
846
905
|
opacity: hidden ? 0 : dimmed ? 0.35 : 1,
|
|
847
|
-
transition:
|
|
848
|
-
pointerEvents:
|
|
906
|
+
transition: "opacity 150ms ease",
|
|
907
|
+
pointerEvents: "none",
|
|
849
908
|
}}
|
|
850
909
|
>
|
|
851
910
|
<div
|
|
852
911
|
className="nodrag nopan"
|
|
853
|
-
role={canToggle ?
|
|
912
|
+
role={canToggle ? "button" : undefined}
|
|
854
913
|
tabIndex={canToggle && !hidden ? 0 : undefined}
|
|
855
914
|
aria-expanded={canToggle ? expanded : undefined}
|
|
856
|
-
aria-label={
|
|
915
|
+
aria-label={
|
|
916
|
+
canToggle
|
|
917
|
+
? `${expanded ? "Collapse" : "Expand"} module path: ${label}`
|
|
918
|
+
: undefined
|
|
919
|
+
}
|
|
857
920
|
onMouseEnter={canToggle ? () => setHover(true) : undefined}
|
|
858
921
|
onMouseLeave={canToggle ? () => setHover(false) : undefined}
|
|
859
|
-
onClick={
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
event
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
922
|
+
onClick={
|
|
923
|
+
canToggle
|
|
924
|
+
? (event) => {
|
|
925
|
+
event.stopPropagation();
|
|
926
|
+
setExpandedLabel(expanded ? null : label);
|
|
927
|
+
}
|
|
928
|
+
: undefined
|
|
929
|
+
}
|
|
930
|
+
onKeyDown={
|
|
931
|
+
canToggle
|
|
932
|
+
? (event) => {
|
|
933
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
934
|
+
event.preventDefault();
|
|
935
|
+
event.stopPropagation();
|
|
936
|
+
setExpandedLabel(expanded ? null : label);
|
|
937
|
+
} else if (event.key === "Escape" && expanded) {
|
|
938
|
+
event.stopPropagation();
|
|
939
|
+
setExpandedLabel(null);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
: undefined
|
|
943
|
+
}
|
|
873
944
|
style={{
|
|
874
|
-
position:
|
|
945
|
+
position: "absolute",
|
|
875
946
|
// Centred astride the top edge like component badges. Always set
|
|
876
947
|
// left/transform explicitly — React Flow reuses group DOM nodes and
|
|
877
948
|
// `undefined` does not clear a prior value.
|
|
878
949
|
top: 0,
|
|
879
950
|
left: 12,
|
|
880
|
-
transform:
|
|
951
|
+
transform: "translateY(-50%)",
|
|
881
952
|
zIndex: canToggle ? 10 : undefined,
|
|
882
953
|
// Width is explicit while collapsible so hover-reveal of more path
|
|
883
954
|
// text animates; the cap keeps both states inside the frame.
|
|
@@ -885,13 +956,16 @@ function BadgeFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-gro
|
|
|
885
956
|
canToggle && !expanded
|
|
886
957
|
? hover
|
|
887
958
|
? Math.min(availableBadgeWidth, moduleBadgeWidth(hoveredLabel))
|
|
888
|
-
: Math.min(
|
|
959
|
+
: Math.min(
|
|
960
|
+
availableBadgeWidth,
|
|
961
|
+
moduleBadgeWidth(collapsedLabel),
|
|
962
|
+
)
|
|
889
963
|
: undefined,
|
|
890
|
-
transition:
|
|
891
|
-
cursor: canToggle ?
|
|
964
|
+
transition: "width 140ms ease, box-shadow 120ms ease",
|
|
965
|
+
cursor: canToggle ? "pointer" : undefined,
|
|
892
966
|
// The trailing halo squares the rounded corners back off in the fill
|
|
893
967
|
// colour, so an edge crossing a corner can't show through the notch.
|
|
894
|
-
boxShadow: `${canToggle && hover ? `0 2px 10px ${color}55, ` :
|
|
968
|
+
boxShadow: `${canToggle && hover ? `0 2px 10px ${color}55, ` : ""}0 0 0 1.5px ${badgeBg}`,
|
|
895
969
|
fontFamily: theme.fonts.monospace,
|
|
896
970
|
fontSize: theme.fontSizes[3],
|
|
897
971
|
fontWeight: 700,
|
|
@@ -900,12 +974,12 @@ function BadgeFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-gro
|
|
|
900
974
|
background: badgeBg,
|
|
901
975
|
border: `2px solid ${color}`,
|
|
902
976
|
borderRadius: 4,
|
|
903
|
-
padding:
|
|
904
|
-
whiteSpace:
|
|
905
|
-
overflow:
|
|
906
|
-
textOverflow:
|
|
907
|
-
boxSizing:
|
|
908
|
-
pointerEvents: hidden ?
|
|
977
|
+
padding: "3px 9px",
|
|
978
|
+
whiteSpace: "nowrap",
|
|
979
|
+
overflow: "hidden",
|
|
980
|
+
textOverflow: "ellipsis",
|
|
981
|
+
boxSizing: "border-box",
|
|
982
|
+
pointerEvents: hidden ? "none" : "auto",
|
|
909
983
|
// Cap the collapsed badge at the frame's inner width so it never
|
|
910
984
|
// spills past the module — it gets the `…`/click-to-expand treatment
|
|
911
985
|
// instead. Expanding lifts the cap so the full path grows the badge
|
|
@@ -914,7 +988,7 @@ function BadgeFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-gro
|
|
|
914
988
|
}}
|
|
915
989
|
>
|
|
916
990
|
{canToggle ? (
|
|
917
|
-
<span style={{ whiteSpace:
|
|
991
|
+
<span style={{ whiteSpace: "nowrap" }}>
|
|
918
992
|
{expanded ? label : hover ? hoveredLabel : collapsedLabel}
|
|
919
993
|
</span>
|
|
920
994
|
) : (
|
|
@@ -926,9 +1000,9 @@ function BadgeFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-gro
|
|
|
926
1000
|
{data.issue && ISSUE_KIND_ICON[data.issue.kind] && (
|
|
927
1001
|
<IssueChip
|
|
928
1002
|
color={
|
|
929
|
-
data.issue.severity ===
|
|
930
|
-
? (theme.colors.error ??
|
|
931
|
-
: (theme.colors.warning ??
|
|
1003
|
+
data.issue.severity === "error"
|
|
1004
|
+
? (theme.colors.error ?? "#e5534b")
|
|
1005
|
+
: (theme.colors.warning ?? "#d4a017")
|
|
932
1006
|
}
|
|
933
1007
|
Icon={ISSUE_KIND_ICON[data.issue.kind]!}
|
|
934
1008
|
count={data.issue.count}
|
|
@@ -942,12 +1016,12 @@ function BadgeFrame(props: NodeProps<Node<SubsystemGroupNodeData, 'subsystem-gro
|
|
|
942
1016
|
* each opacity gets its own SVG marker id — path `opacity` leaks across every
|
|
943
1017
|
* edge that shares a `url(#marker)` (the focused edge's arrowhead dims). */
|
|
944
1018
|
export function hexWithAlpha(hex: string, alpha: number): string {
|
|
945
|
-
const raw = hex.replace(
|
|
946
|
-
const full = raw.length === 3 ? [...raw].map((c) => c + c).join(
|
|
1019
|
+
const raw = hex.replace("#", "");
|
|
1020
|
+
const full = raw.length === 3 ? [...raw].map((c) => c + c).join("") : raw;
|
|
947
1021
|
if (!/^[0-9a-fA-F]{6}$/.test(full)) return hex;
|
|
948
1022
|
const a = Math.round(Math.min(1, Math.max(0, alpha)) * 255)
|
|
949
1023
|
.toString(16)
|
|
950
|
-
.padStart(2,
|
|
1024
|
+
.padStart(2, "0");
|
|
951
1025
|
return `#${full}${a}`;
|
|
952
1026
|
}
|
|
953
1027
|
|
|
@@ -1036,21 +1110,19 @@ export function SubsystemEdge({
|
|
|
1036
1110
|
data,
|
|
1037
1111
|
markerEnd,
|
|
1038
1112
|
}: EdgeProps<SubsystemGraphEdge>) {
|
|
1039
|
-
const path = data?.elkPath ??
|
|
1040
|
-
const mechanism = data?.mechanism ??
|
|
1113
|
+
const path = data?.elkPath ?? "";
|
|
1114
|
+
const mechanism = data?.mechanism ?? "uses";
|
|
1041
1115
|
// Color + dash resolve from provenance: subsystem mechanisms use the
|
|
1042
1116
|
// MECHANISM_* tables, graphify-native relations use the separate
|
|
1043
1117
|
// GRAPHIFY_RELATION_* palette (see edgeColor / edgeStrokeStyle).
|
|
1044
1118
|
const edgeRef = { mechanism, provenance: data?.provenance };
|
|
1045
1119
|
const ghost = data?.ghost === true;
|
|
1046
1120
|
const proposed = data?.proposed === true;
|
|
1047
|
-
const color = proposed
|
|
1048
|
-
? HOST_PROPOSAL_COLOR
|
|
1049
|
-
: edgeColor(edgeRef);
|
|
1121
|
+
const color = proposed ? HOST_PROPOSAL_COLOR : edgeColor(edgeRef);
|
|
1050
1122
|
// Dash style encodes provenance (graphify) and relationship kind (dashed =
|
|
1051
1123
|
// inverted-control or observational: hierarchy, registration, watches).
|
|
1052
1124
|
// Host-local proposal/previous-state edges are dashed too.
|
|
1053
|
-
const isDashed = proposed || ghost || edgeStrokeStyle(edgeRef) ===
|
|
1125
|
+
const isDashed = proposed || ghost || edgeStrokeStyle(edgeRef) === "dashed";
|
|
1054
1126
|
const dimmed = data?.dimmed === true;
|
|
1055
1127
|
// Dim the stroke by color, never via path `opacity`. SVG markers are shared
|
|
1056
1128
|
// by id; opacity on the referencing path paints every arrowhead that uses
|
|
@@ -1082,11 +1154,10 @@ export function SubsystemEdge({
|
|
|
1082
1154
|
fill="none"
|
|
1083
1155
|
stroke={stroke}
|
|
1084
1156
|
strokeWidth={ghost || proposed ? 1 : 1.5}
|
|
1085
|
-
strokeDasharray={isDashed ?
|
|
1157
|
+
strokeDasharray={isDashed ? "6 4" : undefined}
|
|
1086
1158
|
markerEnd={markerEnd}
|
|
1087
|
-
style={{ pointerEvents:
|
|
1159
|
+
style={{ pointerEvents: "none" }}
|
|
1088
1160
|
/>
|
|
1089
1161
|
</>
|
|
1090
1162
|
);
|
|
1091
1163
|
}
|
|
1092
|
-
|