@principal-ai/subsystems-react 0.56.35 → 0.56.37
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 +50 -8
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -1
- package/dist/subsystem/SubsystemComponentGraph.js +291 -50
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -1
- package/dist/subsystem/TrailStepsNav.d.ts +1 -1
- package/dist/subsystem/TrailStepsNav.d.ts.map +1 -1
- package/dist/subsystem/TrailStepsNav.js +2 -1
- package/dist/subsystem/TrailStepsNav.js.map +1 -1
- package/dist/subsystem/TrailsPanel.d.ts +5 -5
- package/dist/subsystem/TrailsPanel.d.ts.map +1 -1
- package/dist/subsystem/TrailsPanel.js +23 -43
- package/dist/subsystem/TrailsPanel.js.map +1 -1
- package/dist/subsystem/model.d.ts +21 -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 +9 -8
- package/dist/subsystem/nodes.d.ts.map +1 -1
- package/dist/subsystem/nodes.js +271 -338
- 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/index.ts +3 -1
- package/src/stories/Canvases/Subsystem/AgentDrivenWalkthrough.stories.tsx +1842 -279
- 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 +791 -21
- package/src/stories/Canvases/Subsystem/Spotlights.stories.tsx +1 -1
- package/src/subsystem/SubsystemComponentGraph.tsx +359 -62
- package/src/subsystem/TrailStepsNav.tsx +2 -2
- package/src/subsystem/TrailsPanel.tsx +35 -89
- package/src/subsystem/model.test.ts +17 -13
- package/src/subsystem/model.ts +60 -48
- package/src/subsystem/nodeIconography.ts +88 -0
- package/src/subsystem/nodes.component.test.tsx +177 -0
- package/src/subsystem/nodes.tsx +463 -435
- package/src/subsystem/stepEmphasis.ts +8 -0
package/dist/subsystem/nodes.js
CHANGED
|
@@ -3,44 +3,46 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
* Subsystem component/group node + edge renderers.
|
|
4
4
|
*
|
|
5
5
|
* Lightweight, purpose-built for the subsystem component graph: a component
|
|
6
|
-
* renders
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* renders a primary construct icon + label above its name, with secondary
|
|
7
|
+
* role/storage/deprecation badges below and host-local state markers at the
|
|
8
|
+
* corners. Groups render as package containers. Clicking a component calls
|
|
9
|
+
* `onSelect` (to open the entry point / file).
|
|
9
10
|
*/
|
|
10
|
-
import { createContext, useContext, useState } from
|
|
11
|
-
import { Handle, Position, } from
|
|
12
|
-
import { useTheme } from
|
|
13
|
-
import { edgeColor, edgeStrokeStyle, DEPRECATED_COLOR, deprecatedBadgeColor, deprecatedBadgeLabel, constructBadgeColor, constructBadgeLabel, rightBadgeLabel, rightBadgeColor, storageBadgeLabel, storageBadgeColor, deriveNameFromSymbol, nodeMinWidthForBadges, MODULE_BADGE_INSET, moduleBadgeLabel, moduleBadgeHoverLabel, moduleBadgeWidth, packageColor, FOLDER_FRAME_COLOR, isFolderFrame, isCardFrame, } from
|
|
14
|
-
import { componentColor } from
|
|
15
|
-
import { resolvePierreSyntaxThemeName } from
|
|
16
|
-
import { ISSUE_KIND_ICON
|
|
17
|
-
import { CARD_GAP, CARD_PAD_X, CARD_PAD_Y, ContainerCardHeader, NODE_H, NODE_W, TOGGLE_INSET, TOGGLE_SIZE, } from
|
|
18
|
-
import { MORPH_MS } from
|
|
19
|
-
import { technologyBrand } from
|
|
20
|
-
import {
|
|
11
|
+
import { createContext, useContext, useState, } from "react";
|
|
12
|
+
import { Handle, Position, } from "@xyflow/react";
|
|
13
|
+
import { useTheme } from "@principal-ade/industry-theme";
|
|
14
|
+
import { edgeColor, edgeStrokeStyle, DEPRECATED_COLOR, deprecatedBadgeColor, deprecatedBadgeLabel, constructBadgeColor, constructBadgeLabel, rightBadgeLabel, rightBadgeColor, storageBadgeLabel, storageBadgeColor, deriveNameFromSymbol, nodeMinWidthForBadges, MODULE_BADGE_INSET, moduleBadgeLabel, moduleBadgeHoverLabel, moduleBadgeWidth, packageColor, HOST_PROPOSAL_COLOR, FOLDER_FRAME_COLOR, isFolderFrame, isCardFrame, } from "./model";
|
|
15
|
+
import { componentColor } from "../pierre/constructColors";
|
|
16
|
+
import { resolvePierreSyntaxThemeName } from "../pierre/pierreSyntaxTheme";
|
|
17
|
+
import { ISSUE_KIND_ICON } from "./IssueList";
|
|
18
|
+
import { CARD_GAP, CARD_PAD_X, CARD_PAD_Y, ContainerCardHeader, NODE_H, NODE_W, TOGGLE_INSET, TOGGLE_SIZE, } from "./containerCard";
|
|
19
|
+
import { MORPH_MS } from "./graphMorph";
|
|
20
|
+
import { TechMark, technologyBrand } from "./techIcons";
|
|
21
|
+
import { DEPRECATED_ICON, ROLE_ICON, STORAGE_ICON, iconForComponent, } from "./nodeIconography";
|
|
22
|
+
import { AppWindow, CirclePlus, CircleX, Component, Database, Maximize2, Minimize2, Package, TriangleAlert, WandSparkles, } from "lucide-react";
|
|
21
23
|
export const CONSTRUCT_LABEL = {
|
|
22
|
-
class:
|
|
23
|
-
function:
|
|
24
|
-
method:
|
|
25
|
-
interface:
|
|
26
|
-
type_alias:
|
|
27
|
-
enum:
|
|
28
|
-
store:
|
|
29
|
-
external:
|
|
30
|
-
custom_entity:
|
|
24
|
+
class: "class",
|
|
25
|
+
function: "function",
|
|
26
|
+
method: "method",
|
|
27
|
+
interface: "interface",
|
|
28
|
+
type_alias: "type alias",
|
|
29
|
+
enum: "enum",
|
|
30
|
+
store: "store",
|
|
31
|
+
external: "external",
|
|
32
|
+
custom_entity: "entity",
|
|
31
33
|
};
|
|
32
34
|
/** Insert zero-width spaces at identifier word boundaries so long names wrap
|
|
33
35
|
* on naming conventions (snake_case `foo_`|`bar`, camelCase `foo`|`Bar`,
|
|
34
36
|
* PascalCase `Foo`|`Bar`, acronym `ABC`|`Def`) instead of mid-character. */
|
|
35
37
|
function breakWords(s) {
|
|
36
|
-
const zwsp =
|
|
37
|
-
return s
|
|
38
|
+
const zwsp = "\u200b";
|
|
39
|
+
return (s
|
|
38
40
|
// camelCase: lower/digit → Upper (and the boundary before it holds)
|
|
39
41
|
.replace(/([a-z0-9])([A-Z])/g, `$1${zwsp}$2`)
|
|
40
42
|
// acronym → word: `ABC`|`Def` (two Uppercase then a lowercase)
|
|
41
43
|
.replace(/([A-Z])([A-Z][a-z])/g, `$1${zwsp}$2`)
|
|
42
44
|
// separators: break after `_`, `-`, `.`
|
|
43
|
-
.replace(/([_\-.])([^_\-.\u200b])/g, `$1${zwsp}$2`);
|
|
45
|
+
.replace(/([_\-.])([^_\-.\u200b])/g, `$1${zwsp}$2`));
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* Root callbacks carried through node data (injected by the graph component).
|
|
@@ -61,28 +63,38 @@ export function SubsystemCallbacksProvider({ value, children, }) {
|
|
|
61
63
|
function useSubsystemCallbacks() {
|
|
62
64
|
return useContext(SubsystemCallbacksContext) ?? SUBSYSTEM_CALLBACKS;
|
|
63
65
|
}
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
* dotted (see the node's `borderStyle`) and a severity-colored corner chip
|
|
67
|
-
* carries the count. The chip's icon is the earliest-failing construct rung
|
|
68
|
-
* (file → symbol → declaration → type → signature); a finding with no rung
|
|
69
|
-
* (e.g. a C4 process gap) wears its kind icon instead — see
|
|
70
|
-
* `SubsystemNodeIssue.kind`. The chip is purely additive and non-interactive;
|
|
71
|
-
* the border stays construct-colored, so severity never has to compete with
|
|
72
|
-
* the construct palette.
|
|
73
|
-
*/
|
|
74
|
-
function NodeIssueOverlay({ issue }) {
|
|
66
|
+
/** A compact host-local state marker, anchored over a node corner. */
|
|
67
|
+
function NodeStateMarker({ label, color, Icon, anchor, count, }) {
|
|
75
68
|
const { theme } = useTheme();
|
|
76
|
-
const
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
:
|
|
85
|
-
|
|
69
|
+
const nodeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
70
|
+
const showCount = (count ?? 0) > 1;
|
|
71
|
+
return (_jsxs("div", { title: label, "aria-label": showCount ? `${label}: ${count}` : label, style: {
|
|
72
|
+
position: "absolute",
|
|
73
|
+
zIndex: 2,
|
|
74
|
+
display: "inline-flex",
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
justifyContent: "center",
|
|
77
|
+
gap: showCount ? 4 : 0,
|
|
78
|
+
width: showCount ? undefined : 26,
|
|
79
|
+
minWidth: 26,
|
|
80
|
+
height: 26,
|
|
81
|
+
boxSizing: "border-box",
|
|
82
|
+
padding: showCount ? "0 5px" : 0,
|
|
83
|
+
border: `2px solid ${color}`,
|
|
84
|
+
borderRadius: 5,
|
|
85
|
+
background: nodeBg,
|
|
86
|
+
color,
|
|
87
|
+
fontFamily: theme.fonts.monospace,
|
|
88
|
+
fontSize: theme.fontSizes[1],
|
|
89
|
+
fontWeight: 700,
|
|
90
|
+
lineHeight: 1.1,
|
|
91
|
+
pointerEvents: "none",
|
|
92
|
+
...(anchor === "top-right"
|
|
93
|
+
? { top: -10, right: -8 }
|
|
94
|
+
: anchor === "top-left"
|
|
95
|
+
? { top: -10, left: -8 }
|
|
96
|
+
: { bottom: -8, right: -8 }),
|
|
97
|
+
}, children: [_jsx(Icon, { className: label === "working" ? "agent-working-icon" : undefined, size: 14, strokeWidth: 2, "aria-hidden": "true" }), showCount ? _jsx("span", { children: count }) : null] }));
|
|
86
98
|
}
|
|
87
99
|
/**
|
|
88
100
|
* The shared severity chip: a severity-colored ring around the finding's icon,
|
|
@@ -95,14 +107,14 @@ function IssueChip({ color, Icon, count, anchor, }) {
|
|
|
95
107
|
const { theme } = useTheme();
|
|
96
108
|
const badgeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
97
109
|
return (_jsxs("div", { "aria-hidden": true, style: {
|
|
98
|
-
position:
|
|
110
|
+
position: "absolute",
|
|
99
111
|
zIndex: 2,
|
|
100
|
-
display:
|
|
101
|
-
alignItems:
|
|
102
|
-
justifyContent:
|
|
112
|
+
display: "inline-flex",
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
justifyContent: "center",
|
|
103
115
|
gap: 4,
|
|
104
116
|
minWidth: 22,
|
|
105
|
-
padding:
|
|
117
|
+
padding: "3px 5px",
|
|
106
118
|
borderRadius: 5,
|
|
107
119
|
border: `2px solid ${color}`,
|
|
108
120
|
background: badgeBg,
|
|
@@ -111,7 +123,7 @@ function IssueChip({ color, Icon, count, anchor, }) {
|
|
|
111
123
|
fontSize: theme.fontSizes[1],
|
|
112
124
|
fontWeight: 700,
|
|
113
125
|
lineHeight: 1.1,
|
|
114
|
-
pointerEvents:
|
|
126
|
+
pointerEvents: "none",
|
|
115
127
|
...anchor,
|
|
116
128
|
}, children: [_jsx(Icon, { size: 14, color: color }), count > 1 ? _jsx("span", { children: count }) : null] }));
|
|
117
129
|
}
|
|
@@ -122,100 +134,77 @@ export function SubsystemComponentNode(props) {
|
|
|
122
134
|
const c = data.component;
|
|
123
135
|
const [hover, setHover] = useState(false);
|
|
124
136
|
// Construct owns node color, derived from the active Pierre syntax theme —
|
|
125
|
-
// the same palette the declaration panel and file drawer render with.
|
|
126
|
-
//
|
|
127
|
-
// come later. A component-authored `color` override wins over the construct.
|
|
137
|
+
// the same palette the declaration panel and file drawer render with. A
|
|
138
|
+
// component-authored `color` override wins over the construct.
|
|
128
139
|
const color = componentColor(c, resolvePierreSyntaxThemeName(mode));
|
|
129
|
-
// Host-local proposals use the same warning color as the Trails panel. The
|
|
130
|
-
// box keeps its construct badge, but its border/name/badge mark it as not yet
|
|
131
|
-
// part of the portable model.
|
|
132
140
|
const proposed = data.proposed === true;
|
|
133
|
-
const proposalColor =
|
|
134
|
-
// Host-local working indicator: a static ring plus a compact icon on the
|
|
135
|
-
// component the agent is currently working on.
|
|
141
|
+
const proposalColor = HOST_PROPOSAL_COLOR;
|
|
136
142
|
const working = data.working === true;
|
|
137
|
-
const workingColor = theme.colors.accent ?? theme.colors.primary ??
|
|
138
|
-
// Host-local removal ghost: the box stays in its slot, dimmed and badged,
|
|
139
|
-
// so the user can see what disappeared instead of only the surviving graph.
|
|
143
|
+
const workingColor = theme.colors.accent ?? theme.colors.primary ?? "#a78bfa";
|
|
140
144
|
const removed = data.removed === true;
|
|
141
145
|
const removedColor = DEPRECATED_COLOR;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
146
|
+
const issue = data.issue;
|
|
147
|
+
const issueColor = issue?.severity === "error"
|
|
148
|
+
? (theme.colors.error ?? "#e5534b")
|
|
149
|
+
: (theme.colors.warning ?? "#d4a017");
|
|
150
|
+
// Primary identity: framework stereotypes may override the construct glyph
|
|
151
|
+
// with an official technology mark; custom entities use their authored kind.
|
|
152
|
+
const PrimaryIcon = iconForComponent(c);
|
|
153
|
+
const primaryBrand = c.framework && c.stereotype ? technologyBrand(c.framework) : undefined;
|
|
154
|
+
const primaryLabel = constructBadgeLabel(c);
|
|
155
|
+
const primaryColor = constructBadgeColor(c) ?? color;
|
|
145
156
|
const configuredMax = callbacks.maxNodeWidth;
|
|
146
157
|
const maxWidth = configuredMax ?? 300;
|
|
147
|
-
// `symbol` is the source of truth; `name` is derived from it consistently.
|
|
148
158
|
const displayName = deriveNameFromSymbol(c.symbol, c.construct, c.name, c.file, c.stereotype);
|
|
149
|
-
// Top badges are absolutely positioned — widen the node so they nowrap
|
|
150
|
-
// instead of wrapping, including when construct + role share the top.
|
|
151
|
-
// Host-local badges must not feed back into geometry: proposal/working flags
|
|
152
|
-
// are stamped after ELK has sized the frames and after the camera has fit
|
|
153
|
-
// those rects. Growing the box here would overflow the container and leave
|
|
154
|
-
// the newly proposed node clipped. They use stacked vertical slots instead.
|
|
155
159
|
const badgeMinWidth = nodeMinWidthForBadges(c);
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
|
|
160
|
+
const roleLabel = rightBadgeLabel(c);
|
|
161
|
+
const roleColor = rightBadgeColor(c);
|
|
162
|
+
const RoleIcon = roleLabel === "entry" || roleLabel === "service"
|
|
163
|
+
? ROLE_ICON[roleLabel]
|
|
164
|
+
: undefined;
|
|
159
165
|
const storageLabel = storageBadgeLabel(c);
|
|
160
166
|
const storageColor = storageBadgeColor(c);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
// removal provenance, which is the whole reason the badge exists.
|
|
167
|
+
const storageIconKey = storageLabel === "db" ? "external" : storageLabel?.toLowerCase();
|
|
168
|
+
const StorageIcon = storageIconKey ? STORAGE_ICON[storageIconKey] : undefined;
|
|
164
169
|
const deprecatedLabel = deprecatedBadgeLabel(c);
|
|
165
170
|
const deprecatedColor = deprecatedBadgeColor(c);
|
|
166
171
|
const removal = c.removedIn;
|
|
167
172
|
const [showRemoval, setShowRemoval] = useState(false);
|
|
168
|
-
// Set while a file is open in the drawer: true → spotlight, false → dim,
|
|
169
|
-
// absent (no file open) → neutral.
|
|
170
173
|
const fileMatch = data.fileMatch;
|
|
171
|
-
// Node fill lifts on hover as the clickability affordance; badges share it
|
|
172
|
-
// so they read as tabs on the same surface rather than floating patches.
|
|
173
174
|
const nodeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
174
175
|
const hoverBg = theme.colors.backgroundHover ?? theme.colors.backgroundTertiary ?? nodeBg;
|
|
175
|
-
//
|
|
176
|
-
// since it means "not a live claim"; construct color stays on the left
|
|
177
|
-
// badge. File-open spotlight still wins with primary.
|
|
176
|
+
// State rides on markers and the name, not on a different border hue.
|
|
178
177
|
const borderColor = removed
|
|
179
178
|
? removedColor
|
|
180
|
-
:
|
|
181
|
-
?
|
|
182
|
-
:
|
|
183
|
-
? theme.colors.primary
|
|
184
|
-
: c.deprecated
|
|
185
|
-
? DEPRECATED_COLOR
|
|
186
|
-
: color;
|
|
187
|
-
// Selection is stamped into data by the graph component — React Flow's own
|
|
188
|
-
// `selected` never updates because the node stops click propagation.
|
|
179
|
+
: fileMatch
|
|
180
|
+
? theme.colors.primary
|
|
181
|
+
: color;
|
|
189
182
|
const isSelected = selected || data.isSelected === true;
|
|
190
|
-
|
|
191
|
-
const isExternal = c.construct === 'external';
|
|
183
|
+
const isExternal = c.construct === "external";
|
|
192
184
|
const nodeRadius = isExternal ? 0 : 8;
|
|
193
185
|
const badgeRadius = isExternal ? 0 : 4;
|
|
194
|
-
// The border thickens on selection / file-match. Absolutely-positioned
|
|
195
|
-
// badges are laid out from the padding box (inside the border), so a raw
|
|
196
|
-
// `top` / `left` would slide with the border. Anchor them to the border box
|
|
197
|
-
// instead, offsetting by the border width. Side badges sit flush with the
|
|
198
|
-
// node's left / right edge (`-borderW`); the top reference stays at -9.
|
|
199
186
|
const borderW = proposed ? 3 : isSelected || fileMatch ? 4 : 2;
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
:
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
187
|
+
const badgeBottom = -9 - borderW;
|
|
188
|
+
const borderStyle = removed || proposed ? "dashed" : "solid";
|
|
189
|
+
const secondaryBadgeStyle = {
|
|
190
|
+
display: "inline-flex",
|
|
191
|
+
alignItems: "center",
|
|
192
|
+
justifyContent: "center",
|
|
193
|
+
boxSizing: "border-box",
|
|
194
|
+
gap: 5,
|
|
195
|
+
height: 26,
|
|
196
|
+
padding: "2px 8px",
|
|
197
|
+
fontFamily: theme.fonts.monospace,
|
|
198
|
+
fontSize: theme.fontSizes[1],
|
|
199
|
+
fontWeight: 700,
|
|
200
|
+
letterSpacing: 0.5,
|
|
201
|
+
lineHeight: "17px",
|
|
202
|
+
textTransform: "uppercase",
|
|
203
|
+
whiteSpace: "nowrap",
|
|
204
|
+
background: nodeBg,
|
|
205
|
+
border: `2px solid currentColor`,
|
|
206
|
+
borderRadius: badgeRadius,
|
|
207
|
+
};
|
|
219
208
|
return (_jsxs("div", { onMouseEnter: () => {
|
|
220
209
|
setHover(true);
|
|
221
210
|
callbacks.onHover?.(c.alias);
|
|
@@ -226,179 +215,103 @@ export function SubsystemComponentNode(props) {
|
|
|
226
215
|
e.stopPropagation();
|
|
227
216
|
callbacks.onSelect?.(c.alias);
|
|
228
217
|
}, style: {
|
|
229
|
-
position:
|
|
230
|
-
display:
|
|
231
|
-
flexDirection:
|
|
232
|
-
justifyContent:
|
|
233
|
-
alignItems:
|
|
234
|
-
boxSizing:
|
|
218
|
+
position: "relative",
|
|
219
|
+
display: "flex",
|
|
220
|
+
flexDirection: "column",
|
|
221
|
+
justifyContent: "flex-start",
|
|
222
|
+
alignItems: "center",
|
|
223
|
+
boxSizing: "border-box",
|
|
235
224
|
width: nodeWidth,
|
|
236
225
|
height: nodeHeight,
|
|
237
226
|
minWidth: badgeMinWidth,
|
|
238
227
|
maxWidth,
|
|
239
|
-
|
|
228
|
+
gap: 8,
|
|
229
|
+
padding: "14px 16px 0",
|
|
230
|
+
overflow: "visible",
|
|
240
231
|
borderRadius: nodeRadius,
|
|
241
232
|
background: hover ? hoverBg : nodeBg,
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
// one; the left construct badge keeps construct color either way.
|
|
233
|
+
// Selection / file-match thickens the border. Proposed and removed
|
|
234
|
+
// ghosts are dashed; all other states keep the construct-colored border.
|
|
245
235
|
border: `${borderW}px ${borderStyle} ${borderColor}`,
|
|
246
236
|
boxShadow: working
|
|
247
237
|
? `0 0 0 3px ${workingColor}55, 0 0 18px ${workingColor}44`
|
|
248
238
|
: fileMatch
|
|
249
239
|
? `0 1px 4px rgba(0,0,0,0.25), 0 0 12px ${theme.colors.primary}55`
|
|
250
|
-
:
|
|
240
|
+
: "0 1px 4px rgba(0,0,0,0.25)",
|
|
251
241
|
opacity: removed
|
|
252
242
|
? 0.45
|
|
253
243
|
: working || (fileMatch !== false && data.dimmed !== true)
|
|
254
244
|
? 1
|
|
255
245
|
: 0.18,
|
|
256
|
-
transition:
|
|
257
|
-
cursor:
|
|
246
|
+
transition: "opacity 150ms ease, background-color 120ms ease",
|
|
247
|
+
cursor: "pointer",
|
|
258
248
|
fontFamily: theme.fonts.body,
|
|
259
|
-
}, children: [
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
zIndex: 1,
|
|
264
|
-
fontFamily: theme.fonts.monospace,
|
|
265
|
-
fontSize: theme.fontSizes[1],
|
|
266
|
-
letterSpacing: 0.5,
|
|
267
|
-
textTransform: 'uppercase',
|
|
268
|
-
lineHeight: '17px',
|
|
269
|
-
whiteSpace: 'nowrap',
|
|
270
|
-
color: badgeColor,
|
|
271
|
-
background: nodeBg,
|
|
272
|
-
border: `2px solid ${badgeColor}`,
|
|
273
|
-
borderRadius: badgeRadius,
|
|
274
|
-
padding: '2px 8px',
|
|
275
|
-
}, children: constructBadgeLabel(c) }), removed && (_jsx("div", { "aria-label": "removed", style: {
|
|
276
|
-
position: 'absolute',
|
|
277
|
-
top: 18,
|
|
278
|
-
right: badgeEdge,
|
|
279
|
-
zIndex: 1,
|
|
280
|
-
fontFamily: theme.fonts.monospace,
|
|
281
|
-
fontSize: theme.fontSizes[1],
|
|
282
|
-
letterSpacing: 0.5,
|
|
283
|
-
textTransform: 'uppercase',
|
|
284
|
-
lineHeight: '17px',
|
|
285
|
-
whiteSpace: 'nowrap',
|
|
286
|
-
color: removedColor,
|
|
287
|
-
background: nodeBg,
|
|
288
|
-
border: `2px solid ${removedColor}`,
|
|
289
|
-
borderRadius: badgeRadius,
|
|
290
|
-
padding: '2px 8px',
|
|
291
|
-
pointerEvents: 'none',
|
|
292
|
-
}, children: "removed" })), proposed && (_jsx("div", { style: {
|
|
293
|
-
position: 'absolute',
|
|
294
|
-
top: 18,
|
|
295
|
-
right: badgeEdge,
|
|
296
|
-
zIndex: 1,
|
|
297
|
-
fontFamily: theme.fonts.monospace,
|
|
298
|
-
fontSize: theme.fontSizes[1],
|
|
299
|
-
letterSpacing: 0.5,
|
|
300
|
-
textTransform: 'uppercase',
|
|
301
|
-
lineHeight: '17px',
|
|
302
|
-
whiteSpace: 'nowrap',
|
|
303
|
-
color: proposalColor,
|
|
304
|
-
background: nodeBg,
|
|
305
|
-
border: `2px solid ${proposalColor}`,
|
|
306
|
-
borderRadius: badgeRadius,
|
|
307
|
-
padding: '2px 8px',
|
|
308
|
-
pointerEvents: 'none',
|
|
309
|
-
}, children: "proposed" })), working && (_jsx("div", { "aria-label": "working", title: "working", style: {
|
|
310
|
-
position: 'absolute',
|
|
311
|
-
top: badgeTop,
|
|
312
|
-
right: badgeEdge,
|
|
313
|
-
zIndex: 1,
|
|
314
|
-
display: 'flex',
|
|
315
|
-
alignItems: 'center',
|
|
316
|
-
justifyContent: 'center',
|
|
317
|
-
width: 24,
|
|
318
|
-
height: 24,
|
|
319
|
-
color: workingColor,
|
|
320
|
-
background: nodeBg,
|
|
321
|
-
border: `1px solid ${workingColor}66`,
|
|
322
|
-
borderRadius: badgeRadius,
|
|
323
|
-
pointerEvents: 'none',
|
|
324
|
-
}, children: _jsx(WandSparkles, { className: "agent-working-icon", size: 14, strokeWidth: 2, "aria-hidden": "true" }) })), (topRightLabel != null || storageLabel != null || deprecatedLabel != null) && (_jsxs("div", { style: {
|
|
325
|
-
position: 'absolute',
|
|
326
|
-
bottom: badgeTop,
|
|
327
|
-
left: '50%',
|
|
328
|
-
transform: 'translateX(-50%)',
|
|
329
|
-
zIndex: 1,
|
|
330
|
-
display: 'flex',
|
|
249
|
+
}, children: [_jsxs("div", { title: primaryLabel, "aria-label": primaryLabel, style: {
|
|
250
|
+
display: "inline-flex",
|
|
251
|
+
alignItems: "center",
|
|
252
|
+
justifyContent: "center",
|
|
331
253
|
gap: 6,
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
border: `2px solid ${storageColor}`,
|
|
342
|
-
borderRadius: badgeRadius,
|
|
343
|
-
padding: '2px 8px',
|
|
344
|
-
}, children: storageLabel })), topRightLabel != null && topRightColor != null && (_jsx("span", { style: {
|
|
254
|
+
maxWidth: "100%",
|
|
255
|
+
height: 24,
|
|
256
|
+
flex: "0 0 auto",
|
|
257
|
+
color: primaryColor,
|
|
258
|
+
lineHeight: 1,
|
|
259
|
+
}, children: [primaryBrand ? (_jsx(TechMark, { brand: primaryBrand, size: 24, showTitle: false })) : (_jsx(PrimaryIcon, { size: c.construct === "function" ? 34 : 24, strokeWidth: 2, "aria-hidden": "true" })), _jsx("span", { style: {
|
|
260
|
+
minWidth: 0,
|
|
261
|
+
overflow: "hidden",
|
|
262
|
+
textOverflow: "ellipsis",
|
|
345
263
|
fontFamily: theme.fonts.monospace,
|
|
346
264
|
fontSize: theme.fontSizes[1],
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
lineHeight:
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
265
|
+
fontWeight: 600,
|
|
266
|
+
letterSpacing: 0.25,
|
|
267
|
+
lineHeight: "16px",
|
|
268
|
+
textTransform: "uppercase",
|
|
269
|
+
whiteSpace: "nowrap",
|
|
270
|
+
}, children: primaryLabel.toUpperCase() })] }), working && (_jsx(NodeStateMarker, { label: "working", color: workingColor, Icon: WandSparkles, anchor: "top-right" })), issue && (_jsx(NodeStateMarker, { label: "issue", color: issueColor, Icon: TriangleAlert, anchor: "bottom-right", count: issue.count })), proposed && (_jsx(NodeStateMarker, { label: "proposed", color: proposalColor, Icon: CirclePlus, anchor: working ? "top-left" : "top-right" })), removed && (_jsx(NodeStateMarker, { label: "removed", color: removedColor, Icon: CircleX, anchor: working ? "top-left" : "top-right" })), (roleLabel != null ||
|
|
271
|
+
storageLabel != null ||
|
|
272
|
+
deprecatedLabel != null) && (_jsxs("div", { style: {
|
|
273
|
+
position: "absolute",
|
|
274
|
+
bottom: badgeBottom,
|
|
275
|
+
left: "50%",
|
|
276
|
+
transform: "translateX(-50%)",
|
|
277
|
+
zIndex: 1,
|
|
278
|
+
display: "flex",
|
|
279
|
+
gap: 6,
|
|
280
|
+
whiteSpace: "nowrap",
|
|
281
|
+
}, children: [storageLabel != null && storageColor != null && StorageIcon && (_jsxs("span", { title: storageLabel, "aria-label": storageLabel, style: { ...secondaryBadgeStyle, color: storageColor }, children: [_jsx(StorageIcon, { size: 14, strokeWidth: 2, "aria-hidden": "true" }), _jsx("span", { children: storageLabel })] })), roleLabel != null && roleColor != null && RoleIcon && (_jsxs("span", { title: roleLabel, "aria-label": roleLabel, style: { ...secondaryBadgeStyle, color: roleColor }, children: [_jsx(RoleIcon, { size: 14, strokeWidth: 2, "aria-hidden": "true" }), _jsx("span", { children: roleLabel })] })), deprecatedLabel != null && deprecatedColor != null && (_jsxs("span", { role: "button", tabIndex: 0, "aria-expanded": showRemoval, "aria-label": removal
|
|
360
282
|
? `Deprecated — removed in ${removal.commit}. Show removal details.`
|
|
361
|
-
:
|
|
283
|
+
: "Deprecated — show removal details.", onClick: (e) => {
|
|
362
284
|
e.stopPropagation();
|
|
363
285
|
setShowRemoval((v) => !v);
|
|
364
286
|
}, onKeyDown: (e) => {
|
|
365
|
-
if (e.key ===
|
|
287
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
366
288
|
e.stopPropagation();
|
|
367
289
|
e.preventDefault();
|
|
368
290
|
setShowRemoval((v) => !v);
|
|
369
291
|
}
|
|
370
292
|
}, style: {
|
|
371
|
-
|
|
372
|
-
fontFamily: theme.fonts.monospace,
|
|
373
|
-
fontSize: theme.fontSizes[1],
|
|
374
|
-
letterSpacing: 0.5,
|
|
375
|
-
textTransform: 'uppercase',
|
|
376
|
-
lineHeight: '17px',
|
|
293
|
+
...secondaryBadgeStyle,
|
|
377
294
|
color: deprecatedColor,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
position: 'absolute',
|
|
385
|
-
bottom: '100%',
|
|
386
|
-
left: '50%',
|
|
387
|
-
transform: 'translateX(-50%)',
|
|
295
|
+
cursor: "pointer",
|
|
296
|
+
}, children: [_jsx(DEPRECATED_ICON, { size: 14, strokeWidth: 2, "aria-hidden": "true" }), _jsx("span", { children: deprecatedLabel })] }))] })), showRemoval && deprecatedLabel != null && (_jsxs("div", { role: "dialog", "aria-label": "Removal provenance", onClick: (e) => e.stopPropagation(), style: {
|
|
297
|
+
position: "absolute",
|
|
298
|
+
bottom: "100%",
|
|
299
|
+
left: "50%",
|
|
300
|
+
transform: "translateX(-50%)",
|
|
388
301
|
marginBottom: 6,
|
|
389
302
|
zIndex: 20,
|
|
390
303
|
width: 260,
|
|
391
|
-
padding:
|
|
304
|
+
padding: "8px 10px",
|
|
392
305
|
borderRadius: 6,
|
|
393
306
|
background: nodeBg,
|
|
394
307
|
border: `1px solid ${DEPRECATED_COLOR}`,
|
|
395
|
-
boxShadow:
|
|
308
|
+
boxShadow: "0 6px 20px rgba(0,0,0,0.35)",
|
|
396
309
|
fontFamily: theme.fonts.body,
|
|
397
310
|
fontSize: theme.fontSizes[1],
|
|
398
311
|
color: theme.colors.text,
|
|
399
|
-
textAlign:
|
|
400
|
-
whiteSpace:
|
|
401
|
-
cursor:
|
|
312
|
+
textAlign: "left",
|
|
313
|
+
whiteSpace: "normal",
|
|
314
|
+
cursor: "default",
|
|
402
315
|
}, children: [_jsx("div", { style: {
|
|
403
316
|
fontWeight: 600,
|
|
404
317
|
marginBottom: 4,
|
|
@@ -407,31 +320,29 @@ export function SubsystemComponentNode(props) {
|
|
|
407
320
|
fontSize: theme.fontSizes[2],
|
|
408
321
|
fontWeight: 600,
|
|
409
322
|
color: proposed ? proposalColor : theme.colors.text,
|
|
410
|
-
textDecoration: removed ?
|
|
323
|
+
textDecoration: removed ? "line-through" : undefined,
|
|
411
324
|
lineHeight: 1.2,
|
|
412
|
-
textAlign:
|
|
325
|
+
textAlign: "center",
|
|
413
326
|
// Let long names wrap within the node's capped width (instead of
|
|
414
327
|
// truncating), but cap each line so the node doesn't grow unbounded.
|
|
415
|
-
whiteSpace:
|
|
416
|
-
overflowWrap:
|
|
417
|
-
maxWidth:
|
|
328
|
+
whiteSpace: "normal",
|
|
329
|
+
overflowWrap: "anywhere",
|
|
330
|
+
maxWidth: "100%",
|
|
418
331
|
fontFamily: theme.fonts.body,
|
|
419
332
|
}, children: breakWords(displayName) }), c.symbol &&
|
|
420
333
|
c.symbol !==
|
|
421
|
-
displayName
|
|
422
|
-
.replace(/ ?\{\}$/, '')
|
|
423
|
-
.replace(/\(\)$/, '') && (_jsx("div", { style: {
|
|
334
|
+
displayName.replace(/ ?\{\}$/, "").replace(/\(\)$/, "") && (_jsx("div", { style: {
|
|
424
335
|
fontSize: theme.fontSizes[0],
|
|
425
336
|
fontFamily: theme.fonts.monospace,
|
|
426
337
|
color: proposed ? proposalColor : color,
|
|
427
|
-
textDecoration: removed ?
|
|
338
|
+
textDecoration: removed ? "line-through" : undefined,
|
|
428
339
|
marginTop: 1,
|
|
429
|
-
textAlign:
|
|
430
|
-
whiteSpace:
|
|
431
|
-
overflow:
|
|
432
|
-
textOverflow:
|
|
433
|
-
maxWidth:
|
|
434
|
-
}, title: c.symbol, children: c.symbol })),
|
|
340
|
+
textAlign: "center",
|
|
341
|
+
whiteSpace: "nowrap",
|
|
342
|
+
overflow: "hidden",
|
|
343
|
+
textOverflow: "ellipsis",
|
|
344
|
+
maxWidth: "100%",
|
|
345
|
+
}, title: c.symbol, children: c.symbol })), _jsx(Handle, { type: "target", position: Position.Left, style: { opacity: 0 } }), _jsx(Handle, { type: "source", position: Position.Right, style: { opacity: 0 } })] }));
|
|
435
346
|
}
|
|
436
347
|
/**
|
|
437
348
|
* Boundary frame — a React Flow parent node for a process, package or module
|
|
@@ -448,7 +359,7 @@ export function SubsystemGroupNode(props) {
|
|
|
448
359
|
const region = props.data.region;
|
|
449
360
|
if (!region)
|
|
450
361
|
return null;
|
|
451
|
-
return isCardFrame(region) ? _jsx(CardFrame, { ...props }) : _jsx(BadgeFrame, { ...props });
|
|
362
|
+
return isCardFrame(region) ? (_jsx(CardFrame, { ...props })) : (_jsx(BadgeFrame, { ...props }));
|
|
452
363
|
}
|
|
453
364
|
/**
|
|
454
365
|
* The container-card chrome for a process / package frame.
|
|
@@ -470,51 +381,55 @@ function CardFrame(props) {
|
|
|
470
381
|
const dimmed = data.dimmed === true;
|
|
471
382
|
const hidden = data.hidden === true;
|
|
472
383
|
const collapsed = data.collapsed === true;
|
|
473
|
-
const isPackage = region.kind ===
|
|
474
|
-
const frameStyle = !isPackage || selected ?
|
|
384
|
+
const isPackage = region.kind === "package" || region.chrome === "package";
|
|
385
|
+
const frameStyle = !isPackage || selected ? "solid" : "dashed";
|
|
475
386
|
const frameRadius = isPackage ? 12 : 4;
|
|
476
|
-
const containerKind = region.containerKind ??
|
|
477
|
-
const Icon = isPackage
|
|
387
|
+
const containerKind = region.containerKind ?? "application";
|
|
388
|
+
const Icon = isPackage
|
|
389
|
+
? Package
|
|
390
|
+
: containerKind === "data-store"
|
|
391
|
+
? Database
|
|
392
|
+
: AppWindow;
|
|
478
393
|
// The technology row falls back to the kind so it is never blank — the same
|
|
479
394
|
// fallback the C4 card uses.
|
|
480
|
-
const topLabel = region.technology ?? (isPackage ?
|
|
395
|
+
const topLabel = region.technology ?? (isPackage ? "package" : containerKind);
|
|
481
396
|
const ToggleIcon = collapsed ? Maximize2 : Minimize2;
|
|
482
397
|
return (_jsxs("div", { title: region.description, style: {
|
|
483
|
-
position:
|
|
398
|
+
position: "relative",
|
|
484
399
|
width: width ?? (collapsed ? NODE_W : 400),
|
|
485
400
|
height: height ?? (collapsed ? NODE_H : 300),
|
|
486
|
-
boxSizing:
|
|
401
|
+
boxSizing: "border-box",
|
|
487
402
|
borderRadius: frameRadius,
|
|
488
403
|
border: `2px ${frameStyle} ${color}`,
|
|
489
404
|
background: theme.colors.backgroundSecondary ?? theme.colors.background,
|
|
490
|
-
boxShadow:
|
|
405
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.25)",
|
|
491
406
|
opacity: hidden ? 0 : dimmed ? 0.35 : 1,
|
|
492
407
|
// React Flow snaps the wrapper to the new size; this box eases between
|
|
493
408
|
// the open frame and the closed card so the toggle reads as a grow /
|
|
494
409
|
// shrink rather than a swap.
|
|
495
410
|
transition: `opacity 150ms ease, width ${MORPH_MS}ms ease, height ${MORPH_MS}ms ease`,
|
|
496
|
-
pointerEvents:
|
|
411
|
+
pointerEvents: "none",
|
|
497
412
|
fontFamily: theme.fonts.body,
|
|
498
413
|
}, children: [_jsx("div", { style: {
|
|
499
|
-
position:
|
|
414
|
+
position: "absolute",
|
|
500
415
|
top: 0,
|
|
501
416
|
left: 0,
|
|
502
417
|
right: 0,
|
|
503
|
-
display:
|
|
504
|
-
flexDirection:
|
|
418
|
+
display: "flex",
|
|
419
|
+
flexDirection: "column",
|
|
505
420
|
gap: CARD_GAP,
|
|
506
421
|
padding: `${CARD_PAD_Y}px ${CARD_PAD_X}px`,
|
|
507
|
-
boxSizing:
|
|
508
|
-
}, children: _jsx(ContainerCardHeader, { label: region.label, Icon: Icon, iconLabel: isPackage ?
|
|
422
|
+
boxSizing: "border-box",
|
|
423
|
+
}, children: _jsx(ContainerCardHeader, { label: region.label, Icon: Icon, iconLabel: isPackage ? "package" : containerKind, color: color, topLabel: topLabel, brand: brand, hasTechRow: true, count: { value: region.memberAliases.length, Icon: Component } }) }), data.onToggleCollapse && (_jsx("button", { type: "button", className: "nodrag nopan", onClick: (e) => {
|
|
509
424
|
e.stopPropagation();
|
|
510
425
|
data.onToggleCollapse?.();
|
|
511
|
-
}, onDoubleClick: (e) => e.stopPropagation(), "aria-label": collapsed ?
|
|
512
|
-
position:
|
|
426
|
+
}, onDoubleClick: (e) => e.stopPropagation(), "aria-label": collapsed ? "Show members" : "Hide members", "aria-pressed": collapsed, style: {
|
|
427
|
+
position: "absolute",
|
|
513
428
|
right: TOGGLE_INSET,
|
|
514
429
|
bottom: TOGGLE_INSET,
|
|
515
|
-
display:
|
|
516
|
-
alignItems:
|
|
517
|
-
justifyContent:
|
|
430
|
+
display: "inline-flex",
|
|
431
|
+
alignItems: "center",
|
|
432
|
+
justifyContent: "center",
|
|
518
433
|
width: TOGGLE_SIZE,
|
|
519
434
|
height: TOGGLE_SIZE,
|
|
520
435
|
padding: 0,
|
|
@@ -522,12 +437,12 @@ function CardFrame(props) {
|
|
|
522
437
|
border: `1px solid ${color}`,
|
|
523
438
|
background: theme.colors.backgroundSecondary ?? theme.colors.background,
|
|
524
439
|
color,
|
|
525
|
-
cursor:
|
|
440
|
+
cursor: "pointer",
|
|
526
441
|
lineHeight: 1,
|
|
527
|
-
pointerEvents:
|
|
528
|
-
}, children: _jsx(ToggleIcon, { size: 13, strokeWidth: 2.25 }) })), data.issue && ISSUE_KIND_ICON[data.issue.kind] && (_jsx(IssueChip, { color: data.issue.severity ===
|
|
529
|
-
? (theme.colors.error ??
|
|
530
|
-
: (theme.colors.warning ??
|
|
442
|
+
pointerEvents: "auto",
|
|
443
|
+
}, children: _jsx(ToggleIcon, { size: 13, strokeWidth: 2.25 }) })), data.issue && ISSUE_KIND_ICON[data.issue.kind] && (_jsx(IssueChip, { color: data.issue.severity === "error"
|
|
444
|
+
? (theme.colors.error ?? "#e5534b")
|
|
445
|
+
: (theme.colors.warning ?? "#d4a017"), Icon: ISSUE_KIND_ICON[data.issue.kind], count: data.issue.count, anchor: { right: -9, bottom: -8 } })), collapsed && (_jsxs(_Fragment, { children: [_jsx(Handle, { type: "target", position: Position.Left, style: { opacity: 0 } }), _jsx(Handle, { type: "source", position: Position.Right, style: { opacity: 0 } })] }))] }));
|
|
531
446
|
}
|
|
532
447
|
/**
|
|
533
448
|
* The bare-frame chrome for a module / directory region: dashed border,
|
|
@@ -541,7 +456,8 @@ function BadgeFrame(props) {
|
|
|
541
456
|
// Explicit host override wins over the derived frame color. Folder frames
|
|
542
457
|
// (directory, or a module whose key names a folder) share one neutral hue;
|
|
543
458
|
// everything else hashes per key.
|
|
544
|
-
const color = data.color ??
|
|
459
|
+
const color = data.color ??
|
|
460
|
+
(isFolderFrame(region) ? FOLDER_FRAME_COLOR : packageColor(region.key));
|
|
545
461
|
const dimmed = data.dimmed === true;
|
|
546
462
|
const hidden = data.hidden === true;
|
|
547
463
|
// Label is the region identity alone (the path). Kind is carried by the
|
|
@@ -557,43 +473,51 @@ function BadgeFrame(props) {
|
|
|
557
473
|
// Hover affords clickability by revealing more of the path — the badge
|
|
558
474
|
// widens to fit real text (never stretched), hinting before the click.
|
|
559
475
|
const [hover, setHover] = useState(false);
|
|
560
|
-
const hoveredLabel = canToggle
|
|
476
|
+
const hoveredLabel = canToggle
|
|
477
|
+
? moduleBadgeHoverLabel(label, availableBadgeWidth)
|
|
478
|
+
: label;
|
|
561
479
|
const badgeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
562
480
|
// Code folders stay dashed until selected; the body is transparent so nested
|
|
563
481
|
// frames don't stack washes.
|
|
564
|
-
const frameStyle = selected ?
|
|
482
|
+
const frameStyle = selected ? "solid" : "dashed";
|
|
565
483
|
return (_jsxs("div", { style: {
|
|
566
|
-
position:
|
|
484
|
+
position: "relative",
|
|
567
485
|
width: width ?? 400,
|
|
568
486
|
height: height ?? 300,
|
|
569
|
-
boxSizing:
|
|
487
|
+
boxSizing: "border-box",
|
|
570
488
|
borderRadius: 12,
|
|
571
489
|
border: `2px ${frameStyle} ${color}`,
|
|
572
|
-
background:
|
|
490
|
+
background: "transparent",
|
|
573
491
|
opacity: hidden ? 0 : dimmed ? 0.35 : 1,
|
|
574
|
-
transition:
|
|
575
|
-
pointerEvents:
|
|
576
|
-
}, children: [_jsx("div", { className: "nodrag nopan", role: canToggle ?
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
581
|
-
event.preventDefault();
|
|
492
|
+
transition: "opacity 150ms ease",
|
|
493
|
+
pointerEvents: "none",
|
|
494
|
+
}, children: [_jsx("div", { className: "nodrag nopan", role: canToggle ? "button" : undefined, tabIndex: canToggle && !hidden ? 0 : undefined, "aria-expanded": canToggle ? expanded : undefined, "aria-label": canToggle
|
|
495
|
+
? `${expanded ? "Collapse" : "Expand"} module path: ${label}`
|
|
496
|
+
: undefined, onMouseEnter: canToggle ? () => setHover(true) : undefined, onMouseLeave: canToggle ? () => setHover(false) : undefined, onClick: canToggle
|
|
497
|
+
? (event) => {
|
|
582
498
|
event.stopPropagation();
|
|
583
499
|
setExpandedLabel(expanded ? null : label);
|
|
584
500
|
}
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
501
|
+
: undefined, onKeyDown: canToggle
|
|
502
|
+
? (event) => {
|
|
503
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
504
|
+
event.preventDefault();
|
|
505
|
+
event.stopPropagation();
|
|
506
|
+
setExpandedLabel(expanded ? null : label);
|
|
507
|
+
}
|
|
508
|
+
else if (event.key === "Escape" && expanded) {
|
|
509
|
+
event.stopPropagation();
|
|
510
|
+
setExpandedLabel(null);
|
|
511
|
+
}
|
|
588
512
|
}
|
|
589
|
-
|
|
590
|
-
position:
|
|
513
|
+
: undefined, style: {
|
|
514
|
+
position: "absolute",
|
|
591
515
|
// Centred astride the top edge like component badges. Always set
|
|
592
516
|
// left/transform explicitly — React Flow reuses group DOM nodes and
|
|
593
517
|
// `undefined` does not clear a prior value.
|
|
594
518
|
top: 0,
|
|
595
519
|
left: 12,
|
|
596
|
-
transform:
|
|
520
|
+
transform: "translateY(-50%)",
|
|
597
521
|
zIndex: canToggle ? 10 : undefined,
|
|
598
522
|
// Width is explicit while collapsible so hover-reveal of more path
|
|
599
523
|
// text animates; the cap keeps both states inside the frame.
|
|
@@ -602,11 +526,11 @@ function BadgeFrame(props) {
|
|
|
602
526
|
? Math.min(availableBadgeWidth, moduleBadgeWidth(hoveredLabel))
|
|
603
527
|
: Math.min(availableBadgeWidth, moduleBadgeWidth(collapsedLabel))
|
|
604
528
|
: undefined,
|
|
605
|
-
transition:
|
|
606
|
-
cursor: canToggle ?
|
|
529
|
+
transition: "width 140ms ease, box-shadow 120ms ease",
|
|
530
|
+
cursor: canToggle ? "pointer" : undefined,
|
|
607
531
|
// The trailing halo squares the rounded corners back off in the fill
|
|
608
532
|
// colour, so an edge crossing a corner can't show through the notch.
|
|
609
|
-
boxShadow: `${canToggle && hover ? `0 2px 10px ${color}55, ` :
|
|
533
|
+
boxShadow: `${canToggle && hover ? `0 2px 10px ${color}55, ` : ""}0 0 0 1.5px ${badgeBg}`,
|
|
610
534
|
fontFamily: theme.fonts.monospace,
|
|
611
535
|
fontSize: theme.fontSizes[3],
|
|
612
536
|
fontWeight: 700,
|
|
@@ -615,32 +539,32 @@ function BadgeFrame(props) {
|
|
|
615
539
|
background: badgeBg,
|
|
616
540
|
border: `2px solid ${color}`,
|
|
617
541
|
borderRadius: 4,
|
|
618
|
-
padding:
|
|
619
|
-
whiteSpace:
|
|
620
|
-
overflow:
|
|
621
|
-
textOverflow:
|
|
622
|
-
boxSizing:
|
|
623
|
-
pointerEvents: hidden ?
|
|
542
|
+
padding: "3px 9px",
|
|
543
|
+
whiteSpace: "nowrap",
|
|
544
|
+
overflow: "hidden",
|
|
545
|
+
textOverflow: "ellipsis",
|
|
546
|
+
boxSizing: "border-box",
|
|
547
|
+
pointerEvents: hidden ? "none" : "auto",
|
|
624
548
|
// Cap the collapsed badge at the frame's inner width so it never
|
|
625
549
|
// spills past the module — it gets the `…`/click-to-expand treatment
|
|
626
550
|
// instead. Expanding lifts the cap so the full path grows the badge
|
|
627
551
|
// past the frame's edge.
|
|
628
552
|
maxWidth: expanded ? undefined : availableBadgeWidth,
|
|
629
|
-
}, children: canToggle ? (_jsx("span", { style: { whiteSpace:
|
|
630
|
-
? (theme.colors.error ??
|
|
631
|
-
: (theme.colors.warning ??
|
|
553
|
+
}, children: canToggle ? (_jsx("span", { style: { whiteSpace: "nowrap" }, children: expanded ? label : hover ? hoveredLabel : collapsedLabel })) : (label) }), data.issue && ISSUE_KIND_ICON[data.issue.kind] && (_jsx(IssueChip, { color: data.issue.severity === "error"
|
|
554
|
+
? (theme.colors.error ?? "#e5534b")
|
|
555
|
+
: (theme.colors.warning ?? "#d4a017"), Icon: ISSUE_KIND_ICON[data.issue.kind], count: data.issue.count, anchor: { right: -9, bottom: -8 } }))] }));
|
|
632
556
|
}
|
|
633
557
|
/** `#rrggbb` + alpha → `#rrggbbaa`. Used to dim a stroke/marker by color so
|
|
634
558
|
* each opacity gets its own SVG marker id — path `opacity` leaks across every
|
|
635
559
|
* edge that shares a `url(#marker)` (the focused edge's arrowhead dims). */
|
|
636
560
|
export function hexWithAlpha(hex, alpha) {
|
|
637
|
-
const raw = hex.replace(
|
|
638
|
-
const full = raw.length === 3 ? [...raw].map((c) => c + c).join(
|
|
561
|
+
const raw = hex.replace("#", "");
|
|
562
|
+
const full = raw.length === 3 ? [...raw].map((c) => c + c).join("") : raw;
|
|
639
563
|
if (!/^[0-9a-fA-F]{6}$/.test(full))
|
|
640
564
|
return hex;
|
|
641
565
|
const a = Math.round(Math.min(1, Math.max(0, alpha)) * 255)
|
|
642
566
|
.toString(16)
|
|
643
|
-
.padStart(2,
|
|
567
|
+
.padStart(2, "0");
|
|
644
568
|
return `#${full}${a}`;
|
|
645
569
|
}
|
|
646
570
|
/**
|
|
@@ -710,21 +634,30 @@ export const EDGE_DIM_ALPHA = 0.15;
|
|
|
710
634
|
* parent Inner component) so it sits above the pane and receives pointer
|
|
711
635
|
* events. */
|
|
712
636
|
export function SubsystemEdge({ data, markerEnd, }) {
|
|
713
|
-
const path = data?.elkPath ??
|
|
714
|
-
const mechanism = data?.mechanism ??
|
|
637
|
+
const path = data?.elkPath ?? "";
|
|
638
|
+
const mechanism = data?.mechanism ?? "uses";
|
|
715
639
|
// Color + dash resolve from provenance: subsystem mechanisms use the
|
|
716
640
|
// MECHANISM_* tables, graphify-native relations use the separate
|
|
717
641
|
// GRAPHIFY_RELATION_* palette (see edgeColor / edgeStrokeStyle).
|
|
718
642
|
const edgeRef = { mechanism, provenance: data?.provenance };
|
|
719
|
-
const
|
|
643
|
+
const ghost = data?.ghost === true;
|
|
644
|
+
const proposed = data?.proposed === true;
|
|
645
|
+
const color = proposed ? HOST_PROPOSAL_COLOR : edgeColor(edgeRef);
|
|
720
646
|
// Dash style encodes provenance (graphify) and relationship kind (dashed =
|
|
721
647
|
// inverted-control or observational: hierarchy, registration, watches).
|
|
722
|
-
|
|
648
|
+
// Host-local proposal/previous-state edges are dashed too.
|
|
649
|
+
const isDashed = proposed || ghost || edgeStrokeStyle(edgeRef) === "dashed";
|
|
723
650
|
const dimmed = data?.dimmed === true;
|
|
724
651
|
// Dim the stroke by color, never via path `opacity`. SVG markers are shared
|
|
725
652
|
// by id; opacity on the referencing path paints every arrowhead that uses
|
|
726
653
|
// the same marker — including the focused edge's target.
|
|
727
|
-
const stroke =
|
|
728
|
-
|
|
654
|
+
const stroke = proposed
|
|
655
|
+
? color
|
|
656
|
+
: ghost
|
|
657
|
+
? hexWithAlpha(color, 0.45)
|
|
658
|
+
: dimmed
|
|
659
|
+
? hexWithAlpha(color, EDGE_DIM_ALPHA)
|
|
660
|
+
: color;
|
|
661
|
+
return (_jsxs(_Fragment, { children: [_jsx("path", { d: path, fill: "none", stroke: "transparent", strokeWidth: 20, className: "react-flow__edge-interaction" }), _jsx("path", { d: path, fill: "none", stroke: stroke, strokeWidth: ghost || proposed ? 1 : 1.5, strokeDasharray: isDashed ? "6 4" : undefined, markerEnd: markerEnd, style: { pointerEvents: "none" } })] }));
|
|
729
662
|
}
|
|
730
663
|
//# sourceMappingURL=nodes.js.map
|