@principal-ai/subsystems-react 0.56.34 → 0.56.36
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/subsystem/SubsystemComponentGraph.d.ts +106 -2
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +454 -70
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/TrailStepsNav.d.ts +4 -2
- package/dist/subsystem/TrailStepsNav.d.ts.map +1 -1
- package/dist/subsystem/TrailStepsNav.js +14 -4
- package/dist/subsystem/TrailStepsNav.js.map +1 -1
- package/dist/subsystem/TrailsPanel.d.ts +18 -2
- package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
- package/dist/subsystem/TrailsPanel.js +40 -18
- package/dist/subsystem/TrailsPanel.js.map +1 -1
- package/dist/subsystem/model.d.ts +27 -6
- package/dist/subsystem/model.d.ts.map +1 -1
- package/dist/subsystem/model.js +48 -45
- package/dist/subsystem/model.js.map +1 -1
- package/dist/subsystem/nodeIconography.d.ts +25 -0
- package/dist/subsystem/nodeIconography.d.ts.map +1 -0
- package/dist/subsystem/nodeIconography.js +55 -0
- package/dist/subsystem/nodeIconography.js.map +1 -0
- package/dist/subsystem/nodes.d.ts +4 -3
- package/dist/subsystem/nodes.d.ts.map +1 -1
- package/dist/subsystem/nodes.js +149 -153
- package/dist/subsystem/nodes.js.map +1 -1
- package/dist/subsystem/stepEmphasis.d.ts +5 -0
- package/dist/subsystem/stepEmphasis.d.ts.map +1 -1
- package/dist/subsystem/stepEmphasis.js +7 -0
- package/dist/subsystem/stepEmphasis.js.map +1 -1
- package/package.json +1 -1
- package/src/stories/Canvases/Subsystem/AgentDrivenWalkthrough.stories.tsx +2079 -0
- package/src/stories/Canvases/Subsystem/Deprecated.stories.tsx +1 -1
- package/src/stories/Canvases/Subsystem/NodeAnatomy.stories.tsx +17 -21
- package/src/stories/Canvases/Subsystem/NodeIconography.stories.tsx +960 -0
- package/src/stories/Canvases/Subsystem/Spotlights.stories.tsx +1 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +609 -70
- package/src/subsystem/TrailStepsNav.tsx +16 -4
- package/src/subsystem/TrailsPanel.tsx +86 -12
- package/src/subsystem/model.test.ts +17 -13
- package/src/subsystem/model.ts +66 -48
- package/src/subsystem/nodeIconography.ts +88 -0
- package/src/subsystem/nodes.component.test.tsx +177 -0
- package/src/subsystem/nodes.tsx +256 -174
- package/src/subsystem/stepEmphasis.ts +8 -0
package/src/subsystem/nodes.tsx
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
* Subsystem component/group node + edge renderers.
|
|
3
3
|
*
|
|
4
4
|
* Lightweight, purpose-built for the subsystem component graph: a component
|
|
5
|
-
* renders
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* renders a primary construct icon + label above its name, with secondary
|
|
6
|
+
* role/storage/deprecation badges below and host-local state markers at the
|
|
7
|
+
* corners. Groups render as package containers. Clicking a component calls
|
|
8
|
+
* `onSelect` (to open the entry point / file).
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
|
-
import { createContext, useContext, useState, type ReactNode } from 'react';
|
|
11
|
+
import { createContext, useContext, useState, type CSSProperties, type ReactNode } from 'react';
|
|
11
12
|
import {
|
|
12
13
|
Handle,
|
|
13
14
|
Position,
|
|
@@ -35,17 +36,17 @@ import {
|
|
|
35
36
|
moduleBadgeHoverLabel,
|
|
36
37
|
moduleBadgeWidth,
|
|
37
38
|
packageColor,
|
|
39
|
+
HOST_PROPOSAL_COLOR,
|
|
38
40
|
FOLDER_FRAME_COLOR,
|
|
39
41
|
isFolderFrame,
|
|
40
42
|
isCardFrame,
|
|
41
43
|
type SubsystemGraphNodeData,
|
|
42
44
|
type SubsystemGroupNodeData,
|
|
43
45
|
type SubsystemGraphEdge,
|
|
44
|
-
type SubsystemNodeIssue,
|
|
45
46
|
} from './model';
|
|
46
47
|
import { componentColor } from '../pierre/constructColors';
|
|
47
48
|
import { resolvePierreSyntaxThemeName } from '../pierre/pierreSyntaxTheme';
|
|
48
|
-
import { ISSUE_KIND_ICON
|
|
49
|
+
import { ISSUE_KIND_ICON } from './IssueList';
|
|
49
50
|
import {
|
|
50
51
|
CARD_GAP,
|
|
51
52
|
CARD_PAD_X,
|
|
@@ -57,8 +58,25 @@ import {
|
|
|
57
58
|
TOGGLE_SIZE,
|
|
58
59
|
} from './containerCard';
|
|
59
60
|
import { MORPH_MS } from './graphMorph';
|
|
60
|
-
import { technologyBrand } from './techIcons';
|
|
61
|
-
import {
|
|
61
|
+
import { TechMark, technologyBrand } from './techIcons';
|
|
62
|
+
import {
|
|
63
|
+
DEPRECATED_ICON,
|
|
64
|
+
ROLE_ICON,
|
|
65
|
+
STORAGE_ICON,
|
|
66
|
+
iconForComponent,
|
|
67
|
+
} from './nodeIconography';
|
|
68
|
+
import {
|
|
69
|
+
AppWindow,
|
|
70
|
+
CirclePlus,
|
|
71
|
+
CircleX,
|
|
72
|
+
Component,
|
|
73
|
+
Database,
|
|
74
|
+
Maximize2,
|
|
75
|
+
Minimize2,
|
|
76
|
+
Package,
|
|
77
|
+
TriangleAlert,
|
|
78
|
+
WandSparkles,
|
|
79
|
+
} from 'lucide-react';
|
|
62
80
|
import type { LucideIcon } from 'lucide-react';
|
|
63
81
|
|
|
64
82
|
export const CONSTRUCT_LABEL: Record<string, string> = {
|
|
@@ -133,34 +151,61 @@ function useSubsystemCallbacks(): SubsystemGraphCallbacks {
|
|
|
133
151
|
return useContext(SubsystemCallbacksContext) ?? SUBSYSTEM_CALLBACKS;
|
|
134
152
|
}
|
|
135
153
|
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
154
|
+
/** A compact host-local state marker, anchored over a node corner. */
|
|
155
|
+
function NodeStateMarker({
|
|
156
|
+
label,
|
|
157
|
+
color,
|
|
158
|
+
Icon,
|
|
159
|
+
anchor,
|
|
160
|
+
count,
|
|
161
|
+
}: {
|
|
162
|
+
label: string;
|
|
163
|
+
color: string;
|
|
164
|
+
Icon: LucideIcon;
|
|
165
|
+
anchor: 'top-right' | 'bottom-right';
|
|
166
|
+
count?: number;
|
|
167
|
+
}) {
|
|
147
168
|
const { theme } = useTheme();
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
? (theme.colors.error ?? '#e5534b')
|
|
151
|
-
: (theme.colors.warning ?? '#d4a017');
|
|
152
|
-
const Icon = issue.rung
|
|
153
|
-
? ISSUE_RUNG_ICON[issue.rung]
|
|
154
|
-
: issue.kind
|
|
155
|
-
? (ISSUE_KIND_ICON[issue.kind] ?? Search)
|
|
156
|
-
: Search;
|
|
169
|
+
const nodeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
170
|
+
const showCount = (count ?? 0) > 1;
|
|
157
171
|
return (
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
172
|
+
<div
|
|
173
|
+
title={label}
|
|
174
|
+
aria-label={showCount ? `${label}: ${count}` : label}
|
|
175
|
+
style={{
|
|
176
|
+
position: 'absolute',
|
|
177
|
+
zIndex: 2,
|
|
178
|
+
display: 'inline-flex',
|
|
179
|
+
alignItems: 'center',
|
|
180
|
+
justifyContent: 'center',
|
|
181
|
+
gap: showCount ? 4 : 0,
|
|
182
|
+
width: showCount ? undefined : 26,
|
|
183
|
+
minWidth: 26,
|
|
184
|
+
height: 26,
|
|
185
|
+
boxSizing: 'border-box',
|
|
186
|
+
padding: showCount ? '0 5px' : 0,
|
|
187
|
+
border: `2px solid ${color}`,
|
|
188
|
+
borderRadius: 5,
|
|
189
|
+
background: nodeBg,
|
|
190
|
+
color,
|
|
191
|
+
fontFamily: theme.fonts.monospace,
|
|
192
|
+
fontSize: theme.fontSizes[1],
|
|
193
|
+
fontWeight: 700,
|
|
194
|
+
lineHeight: 1.1,
|
|
195
|
+
pointerEvents: 'none',
|
|
196
|
+
...(anchor === 'top-right'
|
|
197
|
+
? { top: -10, right: -8 }
|
|
198
|
+
: { bottom: -8, right: -8 }),
|
|
199
|
+
}}
|
|
200
|
+
>
|
|
201
|
+
<Icon
|
|
202
|
+
className={label === 'working' ? 'agent-working-icon' : undefined}
|
|
203
|
+
size={14}
|
|
204
|
+
strokeWidth={2}
|
|
205
|
+
aria-hidden="true"
|
|
206
|
+
/>
|
|
207
|
+
{showCount ? <span>{count}</span> : null}
|
|
208
|
+
</div>
|
|
164
209
|
);
|
|
165
210
|
}
|
|
166
211
|
|
|
@@ -221,76 +266,79 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
221
266
|
const c = data.component;
|
|
222
267
|
const [hover, setHover] = useState(false);
|
|
223
268
|
// Construct owns node color, derived from the active Pierre syntax theme —
|
|
224
|
-
// the same palette the declaration panel and file drawer render with.
|
|
225
|
-
//
|
|
226
|
-
// come later. A component-authored `color` override wins over the construct.
|
|
269
|
+
// the same palette the declaration panel and file drawer render with. A
|
|
270
|
+
// component-authored `color` override wins over the construct.
|
|
227
271
|
const color = componentColor(c, resolvePierreSyntaxThemeName(mode));
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
const
|
|
272
|
+
const proposed = data.proposed === true;
|
|
273
|
+
const proposalColor = HOST_PROPOSAL_COLOR;
|
|
274
|
+
const working = data.working === true;
|
|
275
|
+
const workingColor = theme.colors.accent ?? theme.colors.primary ?? '#a78bfa';
|
|
276
|
+
const removed = data.removed === true;
|
|
277
|
+
const removedColor = DEPRECATED_COLOR;
|
|
278
|
+
const issue = data.issue;
|
|
279
|
+
const issueColor =
|
|
280
|
+
issue?.severity === 'error'
|
|
281
|
+
? (theme.colors.error ?? '#e5534b')
|
|
282
|
+
: (theme.colors.warning ?? '#d4a017');
|
|
283
|
+
// Primary identity: framework stereotypes may override the construct glyph
|
|
284
|
+
// with an official technology mark; custom entities use their authored kind.
|
|
285
|
+
const PrimaryIcon = iconForComponent(c);
|
|
286
|
+
const primaryBrand =
|
|
287
|
+
c.framework && c.stereotype ? technologyBrand(c.framework) : undefined;
|
|
288
|
+
const primaryLabel = constructBadgeLabel(c);
|
|
289
|
+
const primaryColor = constructBadgeColor(c) ?? color;
|
|
231
290
|
const configuredMax = callbacks.maxNodeWidth;
|
|
232
291
|
const maxWidth = configuredMax ?? 300;
|
|
233
|
-
// `symbol` is the source of truth; `name` is derived from it consistently.
|
|
234
292
|
const displayName = deriveNameFromSymbol(c.symbol, c.construct, c.name, c.file, c.stereotype);
|
|
235
|
-
// Top badges are absolutely positioned — widen the node so they nowrap
|
|
236
|
-
// instead of wrapping, including when construct + role share the top.
|
|
237
293
|
const badgeMinWidth = nodeMinWidthForBadges(c);
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
|
|
294
|
+
const roleLabel = rightBadgeLabel(c);
|
|
295
|
+
const roleColor = rightBadgeColor(c);
|
|
296
|
+
const RoleIcon =
|
|
297
|
+
roleLabel === 'entry' || roleLabel === 'service' ? ROLE_ICON[roleLabel] : undefined;
|
|
241
298
|
const storageLabel = storageBadgeLabel(c);
|
|
242
299
|
const storageColor = storageBadgeColor(c);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
// removal provenance, which is the whole reason the badge exists.
|
|
300
|
+
const storageIconKey = storageLabel === 'db' ? 'external' : storageLabel?.toLowerCase();
|
|
301
|
+
const StorageIcon = storageIconKey ? STORAGE_ICON[storageIconKey] : undefined;
|
|
246
302
|
const deprecatedLabel = deprecatedBadgeLabel(c);
|
|
247
303
|
const deprecatedColor = deprecatedBadgeColor(c);
|
|
248
304
|
const removal = c.removedIn;
|
|
249
305
|
const [showRemoval, setShowRemoval] = useState(false);
|
|
250
|
-
// Set while a file is open in the drawer: true → spotlight, false → dim,
|
|
251
|
-
// absent (no file open) → neutral.
|
|
252
306
|
const fileMatch = data.fileMatch as boolean | undefined;
|
|
253
|
-
// Node fill lifts on hover as the clickability affordance; badges share it
|
|
254
|
-
// so they read as tabs on the same surface rather than floating patches.
|
|
255
307
|
const nodeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
256
308
|
const hoverBg =
|
|
257
309
|
theme.colors.backgroundHover ?? theme.colors.backgroundTertiary ?? nodeBg;
|
|
258
|
-
//
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
: c.deprecated
|
|
264
|
-
? DEPRECATED_COLOR
|
|
310
|
+
// State rides on markers and the name, not on a different border hue.
|
|
311
|
+
const borderColor = removed
|
|
312
|
+
? removedColor
|
|
313
|
+
: fileMatch
|
|
314
|
+
? theme.colors.primary
|
|
265
315
|
: color;
|
|
266
|
-
// Selection is stamped into data by the graph component — React Flow's own
|
|
267
|
-
// `selected` never updates because the node stops click propagation.
|
|
268
316
|
const isSelected = selected || (data.isSelected as boolean | undefined) === true;
|
|
269
|
-
// Externals are "outside" the system — square corners on the node + badges.
|
|
270
317
|
const isExternal = c.construct === 'external';
|
|
271
318
|
const nodeRadius = isExternal ? 0 : 8;
|
|
272
319
|
const badgeRadius = isExternal ? 0 : 4;
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
:
|
|
292
|
-
|
|
293
|
-
|
|
320
|
+
const borderW = proposed ? 3 : isSelected || fileMatch ? 4 : 2;
|
|
321
|
+
const badgeBottom = -9 - borderW;
|
|
322
|
+
const borderStyle = removed || proposed ? 'dashed' : 'solid';
|
|
323
|
+
const secondaryBadgeStyle: CSSProperties = {
|
|
324
|
+
display: 'inline-flex',
|
|
325
|
+
alignItems: 'center',
|
|
326
|
+
justifyContent: 'center',
|
|
327
|
+
boxSizing: 'border-box',
|
|
328
|
+
gap: 5,
|
|
329
|
+
height: 26,
|
|
330
|
+
padding: '2px 8px',
|
|
331
|
+
fontFamily: theme.fonts.monospace,
|
|
332
|
+
fontSize: theme.fontSizes[1],
|
|
333
|
+
fontWeight: 700,
|
|
334
|
+
letterSpacing: 0.5,
|
|
335
|
+
lineHeight: '17px',
|
|
336
|
+
textTransform: 'uppercase',
|
|
337
|
+
whiteSpace: 'nowrap',
|
|
338
|
+
background: nodeBg,
|
|
339
|
+
border: `2px solid currentColor`,
|
|
340
|
+
borderRadius: badgeRadius,
|
|
341
|
+
};
|
|
294
342
|
|
|
295
343
|
return (
|
|
296
344
|
<div
|
|
@@ -310,65 +358,119 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
310
358
|
position: 'relative',
|
|
311
359
|
display: 'flex',
|
|
312
360
|
flexDirection: 'column',
|
|
313
|
-
justifyContent: '
|
|
361
|
+
justifyContent: 'flex-start',
|
|
314
362
|
alignItems: 'center',
|
|
315
363
|
boxSizing: 'border-box',
|
|
316
364
|
width: nodeWidth,
|
|
317
365
|
height: nodeHeight,
|
|
318
366
|
minWidth: badgeMinWidth,
|
|
319
367
|
maxWidth,
|
|
320
|
-
|
|
368
|
+
gap: 8,
|
|
369
|
+
padding: '14px 16px 0',
|
|
370
|
+
overflow: 'visible',
|
|
321
371
|
borderRadius: nodeRadius,
|
|
322
372
|
background: hover ? hoverBg : nodeBg,
|
|
323
|
-
//
|
|
324
|
-
//
|
|
325
|
-
// one; the left construct badge keeps construct color either way.
|
|
373
|
+
// Selection / file-match thickens the border. Proposed and removed
|
|
374
|
+
// ghosts are dashed; all other states keep the construct-colored border.
|
|
326
375
|
border: `${borderW}px ${borderStyle} ${borderColor}`,
|
|
327
|
-
boxShadow:
|
|
328
|
-
? `0
|
|
329
|
-
:
|
|
330
|
-
|
|
376
|
+
boxShadow: working
|
|
377
|
+
? `0 0 0 3px ${workingColor}55, 0 0 18px ${workingColor}44`
|
|
378
|
+
: fileMatch
|
|
379
|
+
? `0 1px 4px rgba(0,0,0,0.25), 0 0 12px ${theme.colors.primary}55`
|
|
380
|
+
: '0 1px 4px rgba(0,0,0,0.25)',
|
|
381
|
+
opacity: removed
|
|
382
|
+
? 0.45
|
|
383
|
+
: working || (fileMatch !== false && data.dimmed !== true)
|
|
384
|
+
? 1
|
|
385
|
+
: 0.18,
|
|
331
386
|
transition: 'opacity 150ms ease, background-color 120ms ease',
|
|
332
387
|
cursor: 'pointer',
|
|
333
388
|
fontFamily: theme.fonts.body,
|
|
334
389
|
}}
|
|
335
390
|
>
|
|
336
|
-
{/*
|
|
337
|
-
React UI unit reads as "react · component" instead of "function".
|
|
338
|
-
Persistent; pointer-events none so clicks pass through to the node.
|
|
339
|
-
Framework badges use brand color; border stays construct-colored. */}
|
|
391
|
+
{/* Primary identity — construct / framework / entity icon and label. */}
|
|
340
392
|
<div
|
|
393
|
+
title={primaryLabel}
|
|
394
|
+
aria-label={primaryLabel}
|
|
341
395
|
style={{
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
lineHeight:
|
|
351
|
-
whiteSpace: 'nowrap',
|
|
352
|
-
color: badgeColor,
|
|
353
|
-
background: nodeBg,
|
|
354
|
-
border: `2px solid ${badgeColor}`,
|
|
355
|
-
borderRadius: badgeRadius,
|
|
356
|
-
padding: '2px 8px',
|
|
396
|
+
display: 'inline-flex',
|
|
397
|
+
alignItems: 'center',
|
|
398
|
+
justifyContent: 'center',
|
|
399
|
+
gap: 6,
|
|
400
|
+
maxWidth: '100%',
|
|
401
|
+
height: 24,
|
|
402
|
+
flex: '0 0 auto',
|
|
403
|
+
color: primaryColor,
|
|
404
|
+
lineHeight: 1,
|
|
357
405
|
}}
|
|
358
406
|
>
|
|
359
|
-
{
|
|
407
|
+
{primaryBrand ? (
|
|
408
|
+
<TechMark brand={primaryBrand} size={24} showTitle={false} />
|
|
409
|
+
) : (
|
|
410
|
+
<PrimaryIcon
|
|
411
|
+
size={c.construct === 'function' ? 34 : 24}
|
|
412
|
+
strokeWidth={2}
|
|
413
|
+
aria-hidden="true"
|
|
414
|
+
/>
|
|
415
|
+
)}
|
|
416
|
+
<span
|
|
417
|
+
style={{
|
|
418
|
+
minWidth: 0,
|
|
419
|
+
overflow: 'hidden',
|
|
420
|
+
textOverflow: 'ellipsis',
|
|
421
|
+
fontFamily: theme.fonts.monospace,
|
|
422
|
+
fontSize: theme.fontSizes[1],
|
|
423
|
+
fontWeight: 600,
|
|
424
|
+
letterSpacing: 0.25,
|
|
425
|
+
lineHeight: '16px',
|
|
426
|
+
textTransform: 'uppercase',
|
|
427
|
+
whiteSpace: 'nowrap',
|
|
428
|
+
}}
|
|
429
|
+
>
|
|
430
|
+
{primaryLabel.toUpperCase()}
|
|
431
|
+
</span>
|
|
360
432
|
</div>
|
|
361
433
|
|
|
362
|
-
{
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
434
|
+
{working && (
|
|
435
|
+
<NodeStateMarker
|
|
436
|
+
label="working"
|
|
437
|
+
color={workingColor}
|
|
438
|
+
Icon={WandSparkles}
|
|
439
|
+
anchor="top-right"
|
|
440
|
+
/>
|
|
441
|
+
)}
|
|
442
|
+
{issue && (
|
|
443
|
+
<NodeStateMarker
|
|
444
|
+
label="issue"
|
|
445
|
+
color={issueColor}
|
|
446
|
+
Icon={TriangleAlert}
|
|
447
|
+
anchor="bottom-right"
|
|
448
|
+
count={issue.count}
|
|
449
|
+
/>
|
|
450
|
+
)}
|
|
451
|
+
{proposed && (
|
|
452
|
+
<NodeStateMarker
|
|
453
|
+
label="proposed"
|
|
454
|
+
color={proposalColor}
|
|
455
|
+
Icon={CirclePlus}
|
|
456
|
+
anchor="top-right"
|
|
457
|
+
/>
|
|
458
|
+
)}
|
|
459
|
+
{removed && (
|
|
460
|
+
<NodeStateMarker
|
|
461
|
+
label="removed"
|
|
462
|
+
color={removedColor}
|
|
463
|
+
Icon={CircleX}
|
|
464
|
+
anchor="top-right"
|
|
465
|
+
/>
|
|
466
|
+
)}
|
|
467
|
+
|
|
468
|
+
{/* Secondary badges — orthogonal role, storage backing, and deprecation. */}
|
|
469
|
+
{(roleLabel != null || storageLabel != null || deprecatedLabel != null) && (
|
|
368
470
|
<div
|
|
369
471
|
style={{
|
|
370
472
|
position: 'absolute',
|
|
371
|
-
bottom:
|
|
473
|
+
bottom: badgeBottom,
|
|
372
474
|
left: '50%',
|
|
373
475
|
transform: 'translateX(-50%)',
|
|
374
476
|
zIndex: 1,
|
|
@@ -377,46 +479,27 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
377
479
|
whiteSpace: 'nowrap',
|
|
378
480
|
}}
|
|
379
481
|
>
|
|
380
|
-
{storageLabel != null && storageColor != null && (
|
|
482
|
+
{storageLabel != null && storageColor != null && StorageIcon && (
|
|
381
483
|
<span
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
letterSpacing: 0.5,
|
|
386
|
-
textTransform: 'uppercase',
|
|
387
|
-
lineHeight: '17px',
|
|
388
|
-
color: storageColor,
|
|
389
|
-
background: nodeBg,
|
|
390
|
-
border: `2px solid ${storageColor}`,
|
|
391
|
-
borderRadius: badgeRadius,
|
|
392
|
-
padding: '2px 8px',
|
|
393
|
-
}}
|
|
484
|
+
title={storageLabel}
|
|
485
|
+
aria-label={storageLabel}
|
|
486
|
+
style={{ ...secondaryBadgeStyle, color: storageColor }}
|
|
394
487
|
>
|
|
395
|
-
{
|
|
488
|
+
<StorageIcon size={14} strokeWidth={2} aria-hidden="true" />
|
|
489
|
+
<span>{storageLabel}</span>
|
|
396
490
|
</span>
|
|
397
491
|
)}
|
|
398
|
-
{
|
|
492
|
+
{roleLabel != null && roleColor != null && RoleIcon && (
|
|
399
493
|
<span
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
letterSpacing: 0.5,
|
|
404
|
-
textTransform: 'uppercase',
|
|
405
|
-
lineHeight: '17px',
|
|
406
|
-
color: topRightColor,
|
|
407
|
-
background: nodeBg,
|
|
408
|
-
border: `2px solid ${topRightColor}`,
|
|
409
|
-
borderRadius: badgeRadius,
|
|
410
|
-
padding: '2px 8px',
|
|
411
|
-
}}
|
|
494
|
+
title={roleLabel}
|
|
495
|
+
aria-label={roleLabel}
|
|
496
|
+
style={{ ...secondaryBadgeStyle, color: roleColor }}
|
|
412
497
|
>
|
|
413
|
-
{
|
|
498
|
+
<RoleIcon size={14} strokeWidth={2} aria-hidden="true" />
|
|
499
|
+
<span>{roleLabel}</span>
|
|
414
500
|
</span>
|
|
415
501
|
)}
|
|
416
502
|
{deprecatedLabel != null && deprecatedColor != null && (
|
|
417
|
-
// Its own click target: stops propagation so opening the provenance
|
|
418
|
-
// doesn't also select the node, and toggles a popover rather than
|
|
419
|
-
// leaning on a title tooltip (which truncates the commit subject).
|
|
420
503
|
<span
|
|
421
504
|
role="button"
|
|
422
505
|
tabIndex={0}
|
|
@@ -437,22 +520,10 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
437
520
|
setShowRemoval((v) => !v);
|
|
438
521
|
}
|
|
439
522
|
}}
|
|
440
|
-
style={{
|
|
441
|
-
position: 'relative',
|
|
442
|
-
fontFamily: theme.fonts.monospace,
|
|
443
|
-
fontSize: theme.fontSizes[1],
|
|
444
|
-
letterSpacing: 0.5,
|
|
445
|
-
textTransform: 'uppercase',
|
|
446
|
-
lineHeight: '17px',
|
|
447
|
-
color: deprecatedColor,
|
|
448
|
-
background: nodeBg,
|
|
449
|
-
border: `2px solid ${deprecatedColor}`,
|
|
450
|
-
borderRadius: badgeRadius,
|
|
451
|
-
padding: '2px 8px',
|
|
452
|
-
cursor: 'pointer',
|
|
453
|
-
}}
|
|
523
|
+
style={{ ...secondaryBadgeStyle, color: deprecatedColor, cursor: 'pointer' }}
|
|
454
524
|
>
|
|
455
|
-
{
|
|
525
|
+
<DEPRECATED_ICON size={14} strokeWidth={2} aria-hidden="true" />
|
|
526
|
+
<span>{deprecatedLabel}</span>
|
|
456
527
|
</span>
|
|
457
528
|
)}
|
|
458
529
|
</div>
|
|
@@ -519,7 +590,8 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
519
590
|
style={{
|
|
520
591
|
fontSize: theme.fontSizes[2],
|
|
521
592
|
fontWeight: 600,
|
|
522
|
-
color: theme.colors.text,
|
|
593
|
+
color: proposed ? proposalColor : theme.colors.text,
|
|
594
|
+
textDecoration: removed ? 'line-through' : undefined,
|
|
523
595
|
lineHeight: 1.2,
|
|
524
596
|
textAlign: 'center',
|
|
525
597
|
// Let long names wrap within the node's capped width (instead of
|
|
@@ -545,7 +617,8 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
545
617
|
style={{
|
|
546
618
|
fontSize: theme.fontSizes[0],
|
|
547
619
|
fontFamily: theme.fonts.monospace,
|
|
548
|
-
color: color,
|
|
620
|
+
color: proposed ? proposalColor : color,
|
|
621
|
+
textDecoration: removed ? 'line-through' : undefined,
|
|
549
622
|
marginTop: 1,
|
|
550
623
|
textAlign: 'center',
|
|
551
624
|
whiteSpace: 'nowrap',
|
|
@@ -559,8 +632,6 @@ export function SubsystemComponentNode(props: NodeProps<Node<SubsystemGraphNodeD
|
|
|
559
632
|
</div>
|
|
560
633
|
)}
|
|
561
634
|
|
|
562
|
-
{data.issue && <NodeIssueOverlay issue={data.issue} />}
|
|
563
|
-
|
|
564
635
|
<Handle type="target" position={Position.Left} style={{ opacity: 0 }} />
|
|
565
636
|
<Handle type="source" position={Position.Right} style={{ opacity: 0 }} />
|
|
566
637
|
</div>
|
|
@@ -971,15 +1042,26 @@ export function SubsystemEdge({
|
|
|
971
1042
|
// MECHANISM_* tables, graphify-native relations use the separate
|
|
972
1043
|
// GRAPHIFY_RELATION_* palette (see edgeColor / edgeStrokeStyle).
|
|
973
1044
|
const edgeRef = { mechanism, provenance: data?.provenance };
|
|
974
|
-
const
|
|
1045
|
+
const ghost = data?.ghost === true;
|
|
1046
|
+
const proposed = data?.proposed === true;
|
|
1047
|
+
const color = proposed
|
|
1048
|
+
? HOST_PROPOSAL_COLOR
|
|
1049
|
+
: edgeColor(edgeRef);
|
|
975
1050
|
// Dash style encodes provenance (graphify) and relationship kind (dashed =
|
|
976
1051
|
// inverted-control or observational: hierarchy, registration, watches).
|
|
977
|
-
|
|
1052
|
+
// Host-local proposal/previous-state edges are dashed too.
|
|
1053
|
+
const isDashed = proposed || ghost || edgeStrokeStyle(edgeRef) === 'dashed';
|
|
978
1054
|
const dimmed = data?.dimmed === true;
|
|
979
1055
|
// Dim the stroke by color, never via path `opacity`. SVG markers are shared
|
|
980
1056
|
// by id; opacity on the referencing path paints every arrowhead that uses
|
|
981
1057
|
// the same marker — including the focused edge's target.
|
|
982
|
-
const stroke =
|
|
1058
|
+
const stroke = proposed
|
|
1059
|
+
? color
|
|
1060
|
+
: ghost
|
|
1061
|
+
? hexWithAlpha(color, 0.45)
|
|
1062
|
+
: dimmed
|
|
1063
|
+
? hexWithAlpha(color, EDGE_DIM_ALPHA)
|
|
1064
|
+
: color;
|
|
983
1065
|
|
|
984
1066
|
return (
|
|
985
1067
|
<>
|
|
@@ -999,7 +1081,7 @@ export function SubsystemEdge({
|
|
|
999
1081
|
d={path}
|
|
1000
1082
|
fill="none"
|
|
1001
1083
|
stroke={stroke}
|
|
1002
|
-
strokeWidth={1.5}
|
|
1084
|
+
strokeWidth={ghost || proposed ? 1 : 1.5}
|
|
1003
1085
|
strokeDasharray={isDashed ? '6 4' : undefined}
|
|
1004
1086
|
markerEnd={markerEnd}
|
|
1005
1087
|
style={{ pointerEvents: 'none' }}
|
|
@@ -106,6 +106,14 @@ export function emphasisKey(
|
|
|
106
106
|
return `${trailId}:${stepClaimKey(step)}`;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* PROTOTYPE: a staged replacement is a variation of the step it would replace,
|
|
111
|
+
* not the next sequential step (`2` becomes `2a`).
|
|
112
|
+
*/
|
|
113
|
+
export function variationStepNumber(stepNumber: number, suffix = 'a'): string {
|
|
114
|
+
return `${stepNumber}${suffix}`;
|
|
115
|
+
}
|
|
116
|
+
|
|
109
117
|
export function buildStepEmphasisMap(
|
|
110
118
|
records: readonly StepEmphasisRecord[],
|
|
111
119
|
): StepEmphasisMap {
|