@principal-ai/subsystems-react 0.56.36 → 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/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/nodes.tsx +291 -220
package/dist/subsystem/nodes.js
CHANGED
|
@@ -8,41 +8,41 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
8
8
|
* corners. Groups render as package containers. Clicking a component calls
|
|
9
9
|
* `onSelect` (to open the entry point / file).
|
|
10
10
|
*/
|
|
11
|
-
import { createContext, useContext, useState } from
|
|
12
|
-
import { Handle, Position, } from
|
|
13
|
-
import { useTheme } from
|
|
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
|
|
15
|
-
import { componentColor } from
|
|
16
|
-
import { resolvePierreSyntaxThemeName } from
|
|
17
|
-
import { ISSUE_KIND_ICON } from
|
|
18
|
-
import { CARD_GAP, CARD_PAD_X, CARD_PAD_Y, ContainerCardHeader, NODE_H, NODE_W, TOGGLE_INSET, TOGGLE_SIZE, } from
|
|
19
|
-
import { MORPH_MS } from
|
|
20
|
-
import { TechMark, technologyBrand } from
|
|
21
|
-
import { DEPRECATED_ICON, ROLE_ICON, STORAGE_ICON, iconForComponent, } from
|
|
22
|
-
import { AppWindow, CirclePlus, CircleX, Component, Database, Maximize2, Minimize2, Package, TriangleAlert, WandSparkles, } from
|
|
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";
|
|
23
23
|
export const CONSTRUCT_LABEL = {
|
|
24
|
-
class:
|
|
25
|
-
function:
|
|
26
|
-
method:
|
|
27
|
-
interface:
|
|
28
|
-
type_alias:
|
|
29
|
-
enum:
|
|
30
|
-
store:
|
|
31
|
-
external:
|
|
32
|
-
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",
|
|
33
33
|
};
|
|
34
34
|
/** Insert zero-width spaces at identifier word boundaries so long names wrap
|
|
35
35
|
* on naming conventions (snake_case `foo_`|`bar`, camelCase `foo`|`Bar`,
|
|
36
36
|
* PascalCase `Foo`|`Bar`, acronym `ABC`|`Def`) instead of mid-character. */
|
|
37
37
|
function breakWords(s) {
|
|
38
|
-
const zwsp =
|
|
39
|
-
return s
|
|
38
|
+
const zwsp = "\u200b";
|
|
39
|
+
return (s
|
|
40
40
|
// camelCase: lower/digit → Upper (and the boundary before it holds)
|
|
41
41
|
.replace(/([a-z0-9])([A-Z])/g, `$1${zwsp}$2`)
|
|
42
42
|
// acronym → word: `ABC`|`Def` (two Uppercase then a lowercase)
|
|
43
43
|
.replace(/([A-Z])([A-Z][a-z])/g, `$1${zwsp}$2`)
|
|
44
44
|
// separators: break after `_`, `-`, `.`
|
|
45
|
-
.replace(/([_\-.])([^_\-.\u200b])/g, `$1${zwsp}$2`);
|
|
45
|
+
.replace(/([_\-.])([^_\-.\u200b])/g, `$1${zwsp}$2`));
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Root callbacks carried through node data (injected by the graph component).
|
|
@@ -69,17 +69,17 @@ function NodeStateMarker({ label, color, Icon, anchor, count, }) {
|
|
|
69
69
|
const nodeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
70
70
|
const showCount = (count ?? 0) > 1;
|
|
71
71
|
return (_jsxs("div", { title: label, "aria-label": showCount ? `${label}: ${count}` : label, style: {
|
|
72
|
-
position:
|
|
72
|
+
position: "absolute",
|
|
73
73
|
zIndex: 2,
|
|
74
|
-
display:
|
|
75
|
-
alignItems:
|
|
76
|
-
justifyContent:
|
|
74
|
+
display: "inline-flex",
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
justifyContent: "center",
|
|
77
77
|
gap: showCount ? 4 : 0,
|
|
78
78
|
width: showCount ? undefined : 26,
|
|
79
79
|
minWidth: 26,
|
|
80
80
|
height: 26,
|
|
81
|
-
boxSizing:
|
|
82
|
-
padding: showCount ?
|
|
81
|
+
boxSizing: "border-box",
|
|
82
|
+
padding: showCount ? "0 5px" : 0,
|
|
83
83
|
border: `2px solid ${color}`,
|
|
84
84
|
borderRadius: 5,
|
|
85
85
|
background: nodeBg,
|
|
@@ -88,11 +88,13 @@ function NodeStateMarker({ label, color, Icon, anchor, count, }) {
|
|
|
88
88
|
fontSize: theme.fontSizes[1],
|
|
89
89
|
fontWeight: 700,
|
|
90
90
|
lineHeight: 1.1,
|
|
91
|
-
pointerEvents:
|
|
92
|
-
...(anchor ===
|
|
91
|
+
pointerEvents: "none",
|
|
92
|
+
...(anchor === "top-right"
|
|
93
93
|
? { top: -10, right: -8 }
|
|
94
|
-
:
|
|
95
|
-
|
|
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] }));
|
|
96
98
|
}
|
|
97
99
|
/**
|
|
98
100
|
* The shared severity chip: a severity-colored ring around the finding's icon,
|
|
@@ -105,14 +107,14 @@ function IssueChip({ color, Icon, count, anchor, }) {
|
|
|
105
107
|
const { theme } = useTheme();
|
|
106
108
|
const badgeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
107
109
|
return (_jsxs("div", { "aria-hidden": true, style: {
|
|
108
|
-
position:
|
|
110
|
+
position: "absolute",
|
|
109
111
|
zIndex: 2,
|
|
110
|
-
display:
|
|
111
|
-
alignItems:
|
|
112
|
-
justifyContent:
|
|
112
|
+
display: "inline-flex",
|
|
113
|
+
alignItems: "center",
|
|
114
|
+
justifyContent: "center",
|
|
113
115
|
gap: 4,
|
|
114
116
|
minWidth: 22,
|
|
115
|
-
padding:
|
|
117
|
+
padding: "3px 5px",
|
|
116
118
|
borderRadius: 5,
|
|
117
119
|
border: `2px solid ${color}`,
|
|
118
120
|
background: badgeBg,
|
|
@@ -121,7 +123,7 @@ function IssueChip({ color, Icon, count, anchor, }) {
|
|
|
121
123
|
fontSize: theme.fontSizes[1],
|
|
122
124
|
fontWeight: 700,
|
|
123
125
|
lineHeight: 1.1,
|
|
124
|
-
pointerEvents:
|
|
126
|
+
pointerEvents: "none",
|
|
125
127
|
...anchor,
|
|
126
128
|
}, children: [_jsx(Icon, { size: 14, color: color }), count > 1 ? _jsx("span", { children: count }) : null] }));
|
|
127
129
|
}
|
|
@@ -138,13 +140,13 @@ export function SubsystemComponentNode(props) {
|
|
|
138
140
|
const proposed = data.proposed === true;
|
|
139
141
|
const proposalColor = HOST_PROPOSAL_COLOR;
|
|
140
142
|
const working = data.working === true;
|
|
141
|
-
const workingColor = theme.colors.accent ?? theme.colors.primary ??
|
|
143
|
+
const workingColor = theme.colors.accent ?? theme.colors.primary ?? "#a78bfa";
|
|
142
144
|
const removed = data.removed === true;
|
|
143
145
|
const removedColor = DEPRECATED_COLOR;
|
|
144
146
|
const issue = data.issue;
|
|
145
|
-
const issueColor = issue?.severity ===
|
|
146
|
-
? (theme.colors.error ??
|
|
147
|
-
: (theme.colors.warning ??
|
|
147
|
+
const issueColor = issue?.severity === "error"
|
|
148
|
+
? (theme.colors.error ?? "#e5534b")
|
|
149
|
+
: (theme.colors.warning ?? "#d4a017");
|
|
148
150
|
// Primary identity: framework stereotypes may override the construct glyph
|
|
149
151
|
// with an official technology mark; custom entities use their authored kind.
|
|
150
152
|
const PrimaryIcon = iconForComponent(c);
|
|
@@ -157,10 +159,12 @@ export function SubsystemComponentNode(props) {
|
|
|
157
159
|
const badgeMinWidth = nodeMinWidthForBadges(c);
|
|
158
160
|
const roleLabel = rightBadgeLabel(c);
|
|
159
161
|
const roleColor = rightBadgeColor(c);
|
|
160
|
-
const RoleIcon = roleLabel ===
|
|
162
|
+
const RoleIcon = roleLabel === "entry" || roleLabel === "service"
|
|
163
|
+
? ROLE_ICON[roleLabel]
|
|
164
|
+
: undefined;
|
|
161
165
|
const storageLabel = storageBadgeLabel(c);
|
|
162
166
|
const storageColor = storageBadgeColor(c);
|
|
163
|
-
const storageIconKey = storageLabel ===
|
|
167
|
+
const storageIconKey = storageLabel === "db" ? "external" : storageLabel?.toLowerCase();
|
|
164
168
|
const StorageIcon = storageIconKey ? STORAGE_ICON[storageIconKey] : undefined;
|
|
165
169
|
const deprecatedLabel = deprecatedBadgeLabel(c);
|
|
166
170
|
const deprecatedColor = deprecatedBadgeColor(c);
|
|
@@ -176,27 +180,27 @@ export function SubsystemComponentNode(props) {
|
|
|
176
180
|
? theme.colors.primary
|
|
177
181
|
: color;
|
|
178
182
|
const isSelected = selected || data.isSelected === true;
|
|
179
|
-
const isExternal = c.construct ===
|
|
183
|
+
const isExternal = c.construct === "external";
|
|
180
184
|
const nodeRadius = isExternal ? 0 : 8;
|
|
181
185
|
const badgeRadius = isExternal ? 0 : 4;
|
|
182
186
|
const borderW = proposed ? 3 : isSelected || fileMatch ? 4 : 2;
|
|
183
187
|
const badgeBottom = -9 - borderW;
|
|
184
|
-
const borderStyle = removed || proposed ?
|
|
188
|
+
const borderStyle = removed || proposed ? "dashed" : "solid";
|
|
185
189
|
const secondaryBadgeStyle = {
|
|
186
|
-
display:
|
|
187
|
-
alignItems:
|
|
188
|
-
justifyContent:
|
|
189
|
-
boxSizing:
|
|
190
|
+
display: "inline-flex",
|
|
191
|
+
alignItems: "center",
|
|
192
|
+
justifyContent: "center",
|
|
193
|
+
boxSizing: "border-box",
|
|
190
194
|
gap: 5,
|
|
191
195
|
height: 26,
|
|
192
|
-
padding:
|
|
196
|
+
padding: "2px 8px",
|
|
193
197
|
fontFamily: theme.fonts.monospace,
|
|
194
198
|
fontSize: theme.fontSizes[1],
|
|
195
199
|
fontWeight: 700,
|
|
196
200
|
letterSpacing: 0.5,
|
|
197
|
-
lineHeight:
|
|
198
|
-
textTransform:
|
|
199
|
-
whiteSpace:
|
|
201
|
+
lineHeight: "17px",
|
|
202
|
+
textTransform: "uppercase",
|
|
203
|
+
whiteSpace: "nowrap",
|
|
200
204
|
background: nodeBg,
|
|
201
205
|
border: `2px solid currentColor`,
|
|
202
206
|
borderRadius: badgeRadius,
|
|
@@ -211,19 +215,19 @@ export function SubsystemComponentNode(props) {
|
|
|
211
215
|
e.stopPropagation();
|
|
212
216
|
callbacks.onSelect?.(c.alias);
|
|
213
217
|
}, style: {
|
|
214
|
-
position:
|
|
215
|
-
display:
|
|
216
|
-
flexDirection:
|
|
217
|
-
justifyContent:
|
|
218
|
-
alignItems:
|
|
219
|
-
boxSizing:
|
|
218
|
+
position: "relative",
|
|
219
|
+
display: "flex",
|
|
220
|
+
flexDirection: "column",
|
|
221
|
+
justifyContent: "flex-start",
|
|
222
|
+
alignItems: "center",
|
|
223
|
+
boxSizing: "border-box",
|
|
220
224
|
width: nodeWidth,
|
|
221
225
|
height: nodeHeight,
|
|
222
226
|
minWidth: badgeMinWidth,
|
|
223
227
|
maxWidth,
|
|
224
228
|
gap: 8,
|
|
225
|
-
padding:
|
|
226
|
-
overflow:
|
|
229
|
+
padding: "14px 16px 0",
|
|
230
|
+
overflow: "visible",
|
|
227
231
|
borderRadius: nodeRadius,
|
|
228
232
|
background: hover ? hoverBg : nodeBg,
|
|
229
233
|
// Selection / file-match thickens the border. Proposed and removed
|
|
@@ -233,75 +237,81 @@ export function SubsystemComponentNode(props) {
|
|
|
233
237
|
? `0 0 0 3px ${workingColor}55, 0 0 18px ${workingColor}44`
|
|
234
238
|
: fileMatch
|
|
235
239
|
? `0 1px 4px rgba(0,0,0,0.25), 0 0 12px ${theme.colors.primary}55`
|
|
236
|
-
:
|
|
240
|
+
: "0 1px 4px rgba(0,0,0,0.25)",
|
|
237
241
|
opacity: removed
|
|
238
242
|
? 0.45
|
|
239
243
|
: working || (fileMatch !== false && data.dimmed !== true)
|
|
240
244
|
? 1
|
|
241
245
|
: 0.18,
|
|
242
|
-
transition:
|
|
243
|
-
cursor:
|
|
246
|
+
transition: "opacity 150ms ease, background-color 120ms ease",
|
|
247
|
+
cursor: "pointer",
|
|
244
248
|
fontFamily: theme.fonts.body,
|
|
245
249
|
}, children: [_jsxs("div", { title: primaryLabel, "aria-label": primaryLabel, style: {
|
|
246
|
-
display:
|
|
247
|
-
alignItems:
|
|
248
|
-
justifyContent:
|
|
250
|
+
display: "inline-flex",
|
|
251
|
+
alignItems: "center",
|
|
252
|
+
justifyContent: "center",
|
|
249
253
|
gap: 6,
|
|
250
|
-
maxWidth:
|
|
254
|
+
maxWidth: "100%",
|
|
251
255
|
height: 24,
|
|
252
|
-
flex:
|
|
256
|
+
flex: "0 0 auto",
|
|
253
257
|
color: primaryColor,
|
|
254
258
|
lineHeight: 1,
|
|
255
|
-
}, children: [primaryBrand ? (_jsx(TechMark, { brand: primaryBrand, size: 24, showTitle: false })) : (_jsx(PrimaryIcon, { size: c.construct ===
|
|
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: {
|
|
256
260
|
minWidth: 0,
|
|
257
|
-
overflow:
|
|
258
|
-
textOverflow:
|
|
261
|
+
overflow: "hidden",
|
|
262
|
+
textOverflow: "ellipsis",
|
|
259
263
|
fontFamily: theme.fonts.monospace,
|
|
260
264
|
fontSize: theme.fontSizes[1],
|
|
261
265
|
fontWeight: 600,
|
|
262
266
|
letterSpacing: 0.25,
|
|
263
|
-
lineHeight:
|
|
264
|
-
textTransform:
|
|
265
|
-
whiteSpace:
|
|
266
|
-
}, 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: "top-right" })), removed && (_jsx(NodeStateMarker, { label: "removed", color: removedColor, Icon: CircleX, anchor: "top-right" })), (roleLabel != null ||
|
|
267
|
-
|
|
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",
|
|
268
274
|
bottom: badgeBottom,
|
|
269
|
-
left:
|
|
270
|
-
transform:
|
|
275
|
+
left: "50%",
|
|
276
|
+
transform: "translateX(-50%)",
|
|
271
277
|
zIndex: 1,
|
|
272
|
-
display:
|
|
278
|
+
display: "flex",
|
|
273
279
|
gap: 6,
|
|
274
|
-
whiteSpace:
|
|
280
|
+
whiteSpace: "nowrap",
|
|
275
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
|
|
276
282
|
? `Deprecated — removed in ${removal.commit}. Show removal details.`
|
|
277
|
-
:
|
|
283
|
+
: "Deprecated — show removal details.", onClick: (e) => {
|
|
278
284
|
e.stopPropagation();
|
|
279
285
|
setShowRemoval((v) => !v);
|
|
280
286
|
}, onKeyDown: (e) => {
|
|
281
|
-
if (e.key ===
|
|
287
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
282
288
|
e.stopPropagation();
|
|
283
289
|
e.preventDefault();
|
|
284
290
|
setShowRemoval((v) => !v);
|
|
285
291
|
}
|
|
286
|
-
}, style: {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
292
|
+
}, style: {
|
|
293
|
+
...secondaryBadgeStyle,
|
|
294
|
+
color: deprecatedColor,
|
|
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%)",
|
|
291
301
|
marginBottom: 6,
|
|
292
302
|
zIndex: 20,
|
|
293
303
|
width: 260,
|
|
294
|
-
padding:
|
|
304
|
+
padding: "8px 10px",
|
|
295
305
|
borderRadius: 6,
|
|
296
306
|
background: nodeBg,
|
|
297
307
|
border: `1px solid ${DEPRECATED_COLOR}`,
|
|
298
|
-
boxShadow:
|
|
308
|
+
boxShadow: "0 6px 20px rgba(0,0,0,0.35)",
|
|
299
309
|
fontFamily: theme.fonts.body,
|
|
300
310
|
fontSize: theme.fontSizes[1],
|
|
301
311
|
color: theme.colors.text,
|
|
302
|
-
textAlign:
|
|
303
|
-
whiteSpace:
|
|
304
|
-
cursor:
|
|
312
|
+
textAlign: "left",
|
|
313
|
+
whiteSpace: "normal",
|
|
314
|
+
cursor: "default",
|
|
305
315
|
}, children: [_jsx("div", { style: {
|
|
306
316
|
fontWeight: 600,
|
|
307
317
|
marginBottom: 4,
|
|
@@ -310,30 +320,28 @@ export function SubsystemComponentNode(props) {
|
|
|
310
320
|
fontSize: theme.fontSizes[2],
|
|
311
321
|
fontWeight: 600,
|
|
312
322
|
color: proposed ? proposalColor : theme.colors.text,
|
|
313
|
-
textDecoration: removed ?
|
|
323
|
+
textDecoration: removed ? "line-through" : undefined,
|
|
314
324
|
lineHeight: 1.2,
|
|
315
|
-
textAlign:
|
|
325
|
+
textAlign: "center",
|
|
316
326
|
// Let long names wrap within the node's capped width (instead of
|
|
317
327
|
// truncating), but cap each line so the node doesn't grow unbounded.
|
|
318
|
-
whiteSpace:
|
|
319
|
-
overflowWrap:
|
|
320
|
-
maxWidth:
|
|
328
|
+
whiteSpace: "normal",
|
|
329
|
+
overflowWrap: "anywhere",
|
|
330
|
+
maxWidth: "100%",
|
|
321
331
|
fontFamily: theme.fonts.body,
|
|
322
332
|
}, children: breakWords(displayName) }), c.symbol &&
|
|
323
333
|
c.symbol !==
|
|
324
|
-
displayName
|
|
325
|
-
.replace(/ ?\{\}$/, '')
|
|
326
|
-
.replace(/\(\)$/, '') && (_jsx("div", { style: {
|
|
334
|
+
displayName.replace(/ ?\{\}$/, "").replace(/\(\)$/, "") && (_jsx("div", { style: {
|
|
327
335
|
fontSize: theme.fontSizes[0],
|
|
328
336
|
fontFamily: theme.fonts.monospace,
|
|
329
337
|
color: proposed ? proposalColor : color,
|
|
330
|
-
textDecoration: removed ?
|
|
338
|
+
textDecoration: removed ? "line-through" : undefined,
|
|
331
339
|
marginTop: 1,
|
|
332
|
-
textAlign:
|
|
333
|
-
whiteSpace:
|
|
334
|
-
overflow:
|
|
335
|
-
textOverflow:
|
|
336
|
-
maxWidth:
|
|
340
|
+
textAlign: "center",
|
|
341
|
+
whiteSpace: "nowrap",
|
|
342
|
+
overflow: "hidden",
|
|
343
|
+
textOverflow: "ellipsis",
|
|
344
|
+
maxWidth: "100%",
|
|
337
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 } })] }));
|
|
338
346
|
}
|
|
339
347
|
/**
|
|
@@ -351,7 +359,7 @@ export function SubsystemGroupNode(props) {
|
|
|
351
359
|
const region = props.data.region;
|
|
352
360
|
if (!region)
|
|
353
361
|
return null;
|
|
354
|
-
return isCardFrame(region) ? _jsx(CardFrame, { ...props }) : _jsx(BadgeFrame, { ...props });
|
|
362
|
+
return isCardFrame(region) ? (_jsx(CardFrame, { ...props })) : (_jsx(BadgeFrame, { ...props }));
|
|
355
363
|
}
|
|
356
364
|
/**
|
|
357
365
|
* The container-card chrome for a process / package frame.
|
|
@@ -373,51 +381,55 @@ function CardFrame(props) {
|
|
|
373
381
|
const dimmed = data.dimmed === true;
|
|
374
382
|
const hidden = data.hidden === true;
|
|
375
383
|
const collapsed = data.collapsed === true;
|
|
376
|
-
const isPackage = region.kind ===
|
|
377
|
-
const frameStyle = !isPackage || selected ?
|
|
384
|
+
const isPackage = region.kind === "package" || region.chrome === "package";
|
|
385
|
+
const frameStyle = !isPackage || selected ? "solid" : "dashed";
|
|
378
386
|
const frameRadius = isPackage ? 12 : 4;
|
|
379
|
-
const containerKind = region.containerKind ??
|
|
380
|
-
const Icon = isPackage
|
|
387
|
+
const containerKind = region.containerKind ?? "application";
|
|
388
|
+
const Icon = isPackage
|
|
389
|
+
? Package
|
|
390
|
+
: containerKind === "data-store"
|
|
391
|
+
? Database
|
|
392
|
+
: AppWindow;
|
|
381
393
|
// The technology row falls back to the kind so it is never blank — the same
|
|
382
394
|
// fallback the C4 card uses.
|
|
383
|
-
const topLabel = region.technology ?? (isPackage ?
|
|
395
|
+
const topLabel = region.technology ?? (isPackage ? "package" : containerKind);
|
|
384
396
|
const ToggleIcon = collapsed ? Maximize2 : Minimize2;
|
|
385
397
|
return (_jsxs("div", { title: region.description, style: {
|
|
386
|
-
position:
|
|
398
|
+
position: "relative",
|
|
387
399
|
width: width ?? (collapsed ? NODE_W : 400),
|
|
388
400
|
height: height ?? (collapsed ? NODE_H : 300),
|
|
389
|
-
boxSizing:
|
|
401
|
+
boxSizing: "border-box",
|
|
390
402
|
borderRadius: frameRadius,
|
|
391
403
|
border: `2px ${frameStyle} ${color}`,
|
|
392
404
|
background: theme.colors.backgroundSecondary ?? theme.colors.background,
|
|
393
|
-
boxShadow:
|
|
405
|
+
boxShadow: "0 1px 4px rgba(0,0,0,0.25)",
|
|
394
406
|
opacity: hidden ? 0 : dimmed ? 0.35 : 1,
|
|
395
407
|
// React Flow snaps the wrapper to the new size; this box eases between
|
|
396
408
|
// the open frame and the closed card so the toggle reads as a grow /
|
|
397
409
|
// shrink rather than a swap.
|
|
398
410
|
transition: `opacity 150ms ease, width ${MORPH_MS}ms ease, height ${MORPH_MS}ms ease`,
|
|
399
|
-
pointerEvents:
|
|
411
|
+
pointerEvents: "none",
|
|
400
412
|
fontFamily: theme.fonts.body,
|
|
401
413
|
}, children: [_jsx("div", { style: {
|
|
402
|
-
position:
|
|
414
|
+
position: "absolute",
|
|
403
415
|
top: 0,
|
|
404
416
|
left: 0,
|
|
405
417
|
right: 0,
|
|
406
|
-
display:
|
|
407
|
-
flexDirection:
|
|
418
|
+
display: "flex",
|
|
419
|
+
flexDirection: "column",
|
|
408
420
|
gap: CARD_GAP,
|
|
409
421
|
padding: `${CARD_PAD_Y}px ${CARD_PAD_X}px`,
|
|
410
|
-
boxSizing:
|
|
411
|
-
}, 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) => {
|
|
412
424
|
e.stopPropagation();
|
|
413
425
|
data.onToggleCollapse?.();
|
|
414
|
-
}, onDoubleClick: (e) => e.stopPropagation(), "aria-label": collapsed ?
|
|
415
|
-
position:
|
|
426
|
+
}, onDoubleClick: (e) => e.stopPropagation(), "aria-label": collapsed ? "Show members" : "Hide members", "aria-pressed": collapsed, style: {
|
|
427
|
+
position: "absolute",
|
|
416
428
|
right: TOGGLE_INSET,
|
|
417
429
|
bottom: TOGGLE_INSET,
|
|
418
|
-
display:
|
|
419
|
-
alignItems:
|
|
420
|
-
justifyContent:
|
|
430
|
+
display: "inline-flex",
|
|
431
|
+
alignItems: "center",
|
|
432
|
+
justifyContent: "center",
|
|
421
433
|
width: TOGGLE_SIZE,
|
|
422
434
|
height: TOGGLE_SIZE,
|
|
423
435
|
padding: 0,
|
|
@@ -425,12 +437,12 @@ function CardFrame(props) {
|
|
|
425
437
|
border: `1px solid ${color}`,
|
|
426
438
|
background: theme.colors.backgroundSecondary ?? theme.colors.background,
|
|
427
439
|
color,
|
|
428
|
-
cursor:
|
|
440
|
+
cursor: "pointer",
|
|
429
441
|
lineHeight: 1,
|
|
430
|
-
pointerEvents:
|
|
431
|
-
}, children: _jsx(ToggleIcon, { size: 13, strokeWidth: 2.25 }) })), data.issue && ISSUE_KIND_ICON[data.issue.kind] && (_jsx(IssueChip, { color: data.issue.severity ===
|
|
432
|
-
? (theme.colors.error ??
|
|
433
|
-
: (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 } })] }))] }));
|
|
434
446
|
}
|
|
435
447
|
/**
|
|
436
448
|
* The bare-frame chrome for a module / directory region: dashed border,
|
|
@@ -444,7 +456,8 @@ function BadgeFrame(props) {
|
|
|
444
456
|
// Explicit host override wins over the derived frame color. Folder frames
|
|
445
457
|
// (directory, or a module whose key names a folder) share one neutral hue;
|
|
446
458
|
// everything else hashes per key.
|
|
447
|
-
const color = data.color ??
|
|
459
|
+
const color = data.color ??
|
|
460
|
+
(isFolderFrame(region) ? FOLDER_FRAME_COLOR : packageColor(region.key));
|
|
448
461
|
const dimmed = data.dimmed === true;
|
|
449
462
|
const hidden = data.hidden === true;
|
|
450
463
|
// Label is the region identity alone (the path). Kind is carried by the
|
|
@@ -460,43 +473,51 @@ function BadgeFrame(props) {
|
|
|
460
473
|
// Hover affords clickability by revealing more of the path — the badge
|
|
461
474
|
// widens to fit real text (never stretched), hinting before the click.
|
|
462
475
|
const [hover, setHover] = useState(false);
|
|
463
|
-
const hoveredLabel = canToggle
|
|
476
|
+
const hoveredLabel = canToggle
|
|
477
|
+
? moduleBadgeHoverLabel(label, availableBadgeWidth)
|
|
478
|
+
: label;
|
|
464
479
|
const badgeBg = theme.colors.backgroundSecondary ?? theme.colors.background;
|
|
465
480
|
// Code folders stay dashed until selected; the body is transparent so nested
|
|
466
481
|
// frames don't stack washes.
|
|
467
|
-
const frameStyle = selected ?
|
|
482
|
+
const frameStyle = selected ? "solid" : "dashed";
|
|
468
483
|
return (_jsxs("div", { style: {
|
|
469
|
-
position:
|
|
484
|
+
position: "relative",
|
|
470
485
|
width: width ?? 400,
|
|
471
486
|
height: height ?? 300,
|
|
472
|
-
boxSizing:
|
|
487
|
+
boxSizing: "border-box",
|
|
473
488
|
borderRadius: 12,
|
|
474
489
|
border: `2px ${frameStyle} ${color}`,
|
|
475
|
-
background:
|
|
490
|
+
background: "transparent",
|
|
476
491
|
opacity: hidden ? 0 : dimmed ? 0.35 : 1,
|
|
477
|
-
transition:
|
|
478
|
-
pointerEvents:
|
|
479
|
-
}, children: [_jsx("div", { className: "nodrag nopan", role: canToggle ?
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
if (event.key === 'Enter' || event.key === ' ') {
|
|
484
|
-
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) => {
|
|
485
498
|
event.stopPropagation();
|
|
486
499
|
setExpandedLabel(expanded ? null : label);
|
|
487
500
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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
|
+
}
|
|
491
512
|
}
|
|
492
|
-
|
|
493
|
-
position:
|
|
513
|
+
: undefined, style: {
|
|
514
|
+
position: "absolute",
|
|
494
515
|
// Centred astride the top edge like component badges. Always set
|
|
495
516
|
// left/transform explicitly — React Flow reuses group DOM nodes and
|
|
496
517
|
// `undefined` does not clear a prior value.
|
|
497
518
|
top: 0,
|
|
498
519
|
left: 12,
|
|
499
|
-
transform:
|
|
520
|
+
transform: "translateY(-50%)",
|
|
500
521
|
zIndex: canToggle ? 10 : undefined,
|
|
501
522
|
// Width is explicit while collapsible so hover-reveal of more path
|
|
502
523
|
// text animates; the cap keeps both states inside the frame.
|
|
@@ -505,11 +526,11 @@ function BadgeFrame(props) {
|
|
|
505
526
|
? Math.min(availableBadgeWidth, moduleBadgeWidth(hoveredLabel))
|
|
506
527
|
: Math.min(availableBadgeWidth, moduleBadgeWidth(collapsedLabel))
|
|
507
528
|
: undefined,
|
|
508
|
-
transition:
|
|
509
|
-
cursor: canToggle ?
|
|
529
|
+
transition: "width 140ms ease, box-shadow 120ms ease",
|
|
530
|
+
cursor: canToggle ? "pointer" : undefined,
|
|
510
531
|
// The trailing halo squares the rounded corners back off in the fill
|
|
511
532
|
// colour, so an edge crossing a corner can't show through the notch.
|
|
512
|
-
boxShadow: `${canToggle && hover ? `0 2px 10px ${color}55, ` :
|
|
533
|
+
boxShadow: `${canToggle && hover ? `0 2px 10px ${color}55, ` : ""}0 0 0 1.5px ${badgeBg}`,
|
|
513
534
|
fontFamily: theme.fonts.monospace,
|
|
514
535
|
fontSize: theme.fontSizes[3],
|
|
515
536
|
fontWeight: 700,
|
|
@@ -518,32 +539,32 @@ function BadgeFrame(props) {
|
|
|
518
539
|
background: badgeBg,
|
|
519
540
|
border: `2px solid ${color}`,
|
|
520
541
|
borderRadius: 4,
|
|
521
|
-
padding:
|
|
522
|
-
whiteSpace:
|
|
523
|
-
overflow:
|
|
524
|
-
textOverflow:
|
|
525
|
-
boxSizing:
|
|
526
|
-
pointerEvents: hidden ?
|
|
542
|
+
padding: "3px 9px",
|
|
543
|
+
whiteSpace: "nowrap",
|
|
544
|
+
overflow: "hidden",
|
|
545
|
+
textOverflow: "ellipsis",
|
|
546
|
+
boxSizing: "border-box",
|
|
547
|
+
pointerEvents: hidden ? "none" : "auto",
|
|
527
548
|
// Cap the collapsed badge at the frame's inner width so it never
|
|
528
549
|
// spills past the module — it gets the `…`/click-to-expand treatment
|
|
529
550
|
// instead. Expanding lifts the cap so the full path grows the badge
|
|
530
551
|
// past the frame's edge.
|
|
531
552
|
maxWidth: expanded ? undefined : availableBadgeWidth,
|
|
532
|
-
}, children: canToggle ? (_jsx("span", { style: { whiteSpace:
|
|
533
|
-
? (theme.colors.error ??
|
|
534
|
-
: (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 } }))] }));
|
|
535
556
|
}
|
|
536
557
|
/** `#rrggbb` + alpha → `#rrggbbaa`. Used to dim a stroke/marker by color so
|
|
537
558
|
* each opacity gets its own SVG marker id — path `opacity` leaks across every
|
|
538
559
|
* edge that shares a `url(#marker)` (the focused edge's arrowhead dims). */
|
|
539
560
|
export function hexWithAlpha(hex, alpha) {
|
|
540
|
-
const raw = hex.replace(
|
|
541
|
-
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;
|
|
542
563
|
if (!/^[0-9a-fA-F]{6}$/.test(full))
|
|
543
564
|
return hex;
|
|
544
565
|
const a = Math.round(Math.min(1, Math.max(0, alpha)) * 255)
|
|
545
566
|
.toString(16)
|
|
546
|
-
.padStart(2,
|
|
567
|
+
.padStart(2, "0");
|
|
547
568
|
return `#${full}${a}`;
|
|
548
569
|
}
|
|
549
570
|
/**
|
|
@@ -613,21 +634,19 @@ export const EDGE_DIM_ALPHA = 0.15;
|
|
|
613
634
|
* parent Inner component) so it sits above the pane and receives pointer
|
|
614
635
|
* events. */
|
|
615
636
|
export function SubsystemEdge({ data, markerEnd, }) {
|
|
616
|
-
const path = data?.elkPath ??
|
|
617
|
-
const mechanism = data?.mechanism ??
|
|
637
|
+
const path = data?.elkPath ?? "";
|
|
638
|
+
const mechanism = data?.mechanism ?? "uses";
|
|
618
639
|
// Color + dash resolve from provenance: subsystem mechanisms use the
|
|
619
640
|
// MECHANISM_* tables, graphify-native relations use the separate
|
|
620
641
|
// GRAPHIFY_RELATION_* palette (see edgeColor / edgeStrokeStyle).
|
|
621
642
|
const edgeRef = { mechanism, provenance: data?.provenance };
|
|
622
643
|
const ghost = data?.ghost === true;
|
|
623
644
|
const proposed = data?.proposed === true;
|
|
624
|
-
const color = proposed
|
|
625
|
-
? HOST_PROPOSAL_COLOR
|
|
626
|
-
: edgeColor(edgeRef);
|
|
645
|
+
const color = proposed ? HOST_PROPOSAL_COLOR : edgeColor(edgeRef);
|
|
627
646
|
// Dash style encodes provenance (graphify) and relationship kind (dashed =
|
|
628
647
|
// inverted-control or observational: hierarchy, registration, watches).
|
|
629
648
|
// Host-local proposal/previous-state edges are dashed too.
|
|
630
|
-
const isDashed = proposed || ghost || edgeStrokeStyle(edgeRef) ===
|
|
649
|
+
const isDashed = proposed || ghost || edgeStrokeStyle(edgeRef) === "dashed";
|
|
631
650
|
const dimmed = data?.dimmed === true;
|
|
632
651
|
// Dim the stroke by color, never via path `opacity`. SVG markers are shared
|
|
633
652
|
// by id; opacity on the referencing path paints every arrowhead that uses
|
|
@@ -639,6 +658,6 @@ export function SubsystemEdge({ data, markerEnd, }) {
|
|
|
639
658
|
: dimmed
|
|
640
659
|
? hexWithAlpha(color, EDGE_DIM_ALPHA)
|
|
641
660
|
: color;
|
|
642
|
-
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 ?
|
|
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" } })] }));
|
|
643
662
|
}
|
|
644
663
|
//# sourceMappingURL=nodes.js.map
|