@principal-ai/principal-view-react 0.16.21 → 0.16.23

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.
Files changed (47) hide show
  1. package/dist/components/GraphRenderer.js.map +1 -1
  2. package/dist/components/session-events/SessionEventFeed.d.ts.map +1 -1
  3. package/dist/components/session-events/SessionEventFeed.js +10 -3
  4. package/dist/components/session-events/SessionEventFeed.js.map +1 -1
  5. package/dist/graphify/consolidated.d.ts +170 -0
  6. package/dist/graphify/consolidated.d.ts.map +1 -0
  7. package/dist/graphify/consolidated.js +11 -0
  8. package/dist/graphify/consolidated.js.map +1 -0
  9. package/dist/graphify/index.d.ts +9 -0
  10. package/dist/graphify/index.d.ts.map +1 -0
  11. package/dist/graphify/index.js +8 -0
  12. package/dist/graphify/index.js.map +1 -0
  13. package/dist/graphify/types.d.ts +141 -0
  14. package/dist/graphify/types.d.ts.map +1 -0
  15. package/dist/graphify/types.js +8 -0
  16. package/dist/graphify/types.js.map +1 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/subsystem/SubsystemComponentGraph.d.ts +28 -0
  20. package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -0
  21. package/dist/subsystem/SubsystemComponentGraph.js +365 -0
  22. package/dist/subsystem/SubsystemComponentGraph.js.map +1 -0
  23. package/dist/subsystem/model.d.ts +131 -0
  24. package/dist/subsystem/model.d.ts.map +1 -0
  25. package/dist/subsystem/model.js +296 -0
  26. package/dist/subsystem/model.js.map +1 -0
  27. package/dist/subsystem/nodes.d.ts +28 -0
  28. package/dist/subsystem/nodes.d.ts.map +1 -0
  29. package/dist/subsystem/nodes.js +230 -0
  30. package/dist/subsystem/nodes.js.map +1 -0
  31. package/dist/utils/elkLayout.d.ts +19 -0
  32. package/dist/utils/elkLayout.d.ts.map +1 -1
  33. package/dist/utils/elkLayout.js +72 -9
  34. package/dist/utils/elkLayout.js.map +1 -1
  35. package/package.json +3 -3
  36. package/src/components/GraphRenderer.tsx +2 -2
  37. package/src/components/session-events/SessionEventFeed.tsx +20 -3
  38. package/src/graphify/consolidated.ts +202 -0
  39. package/src/graphify/index.ts +36 -0
  40. package/src/graphify/types.ts +164 -0
  41. package/src/index.ts +31 -0
  42. package/src/stories/SubsystemComponentGraph.stories.tsx +761 -0
  43. package/src/subsystem/SubsystemComponentGraph.tsx +585 -0
  44. package/src/subsystem/model.test.ts +81 -0
  45. package/src/subsystem/model.ts +434 -0
  46. package/src/subsystem/nodes.tsx +353 -0
  47. package/src/utils/elkLayout.ts +98 -9
@@ -0,0 +1,296 @@
1
+ /**
2
+ * Subsystem component-graph data model + converters.
3
+ *
4
+ * A subsystem snapshot (see the "Subsystem artifact: facets" topic) is captured
5
+ * as component nodes (kind-tagged source units), file refs, integration edges,
6
+ * and entry points. This module defines the minimal document shape for the
7
+ * *graph* facet and converts it to React Flow nodes/edges — packages render as
8
+ * subgraphs, only cross-package edges leave the box, and shared seams
9
+ * (registries/barrels/facades) are edge targets, never member nodes.
10
+ *
11
+ * Self-contained in this package (not yet promoted to `@principal-ai/core`), so
12
+ * we can iterate on the UI + story without publishing a dependency.
13
+ */
14
+ import { MarkerType, } from '@xyflow/react';
15
+ import { computeElkLayout } from '../utils/elkLayout';
16
+ /**
17
+ * Derive a consistent display `name` from a code `symbol` + kind.
18
+ *
19
+ * `symbol` is the source of truth (fully-qualified code identity). For most
20
+ * kinds the name is the symbol itself or its last dotted segment:
21
+ * - class/type/module/function/script/... symbol → symbol (e.g. `SessionReader`)
22
+ * - method `Owner.method` → last segment (e.g. `SessionReader.normalize` → `normalize`)
23
+ * - module, no symbol → basename of `file` (e.g. `transcript.ts` → `transcript`) —
24
+ * a common-sense convention for whole-file modules, not a real TS name
25
+ * - otherwise no symbol → fall back to an existing name
26
+ */
27
+ export function deriveNameFromSymbol(symbol, kind, existingName, file) {
28
+ if (symbol && symbol.trim()) {
29
+ if (kind === 'method') {
30
+ const idx = symbol.lastIndexOf('.');
31
+ return idx >= 0 ? symbol.slice(idx + 1) : symbol;
32
+ }
33
+ return symbol;
34
+ }
35
+ // Module nodes without a symbol are whole files → use the file basename.
36
+ if (kind === 'module' && file) {
37
+ const base = file.split('/').pop() ?? '';
38
+ const clean = base.replace(/\.[^.]+$/, ''); // strip extension
39
+ if (clean)
40
+ return clean;
41
+ }
42
+ return existingName ?? 'untitled';
43
+ }
44
+ export const MECHANISM_COLOR = {
45
+ imports: '#0893d2',
46
+ imports_from: '#5aa9e6',
47
+ re_exports: '#3aa5c9',
48
+ defines: '#2e86ab',
49
+ calls: '#4ec9b0',
50
+ extends: '#b48ead',
51
+ inherits: '#9b6fd0',
52
+ implements: '#c586c0',
53
+ mixes_in: '#d474a8',
54
+ uses: '#e3b341',
55
+ method: '#c586c0',
56
+ references: '#e07a5f',
57
+ contains: '#6c5ce7',
58
+ feeds: '#22c55e',
59
+ produces: '#e07a5f',
60
+ 'registers-into': '#ff6b35', // orange
61
+ };
62
+ const MECHANISM_STYLE = {
63
+ imports: 'solid',
64
+ imports_from: 'solid',
65
+ re_exports: 'solid',
66
+ defines: 'solid',
67
+ calls: 'solid',
68
+ extends: 'dashed',
69
+ inherits: 'dashed',
70
+ implements: 'dashed',
71
+ mixes_in: 'dashed',
72
+ uses: 'solid',
73
+ method: 'solid',
74
+ references: 'dotted',
75
+ contains: 'solid',
76
+ feeds: 'solid',
77
+ produces: 'solid',
78
+ 'registers-into': 'dashed',
79
+ };
80
+ /** Package color palette (derived deterministically from the package name). */
81
+ export function packageColor(name) {
82
+ const palette = [
83
+ '#0893d2',
84
+ '#4ec9b0',
85
+ '#ff6b35',
86
+ '#b48ead',
87
+ '#e3b341',
88
+ '#5aa9e6',
89
+ ];
90
+ let h = 0;
91
+ for (let i = 0; i < name.length; i++)
92
+ h = (h * 31 + name.charCodeAt(i)) >>> 0;
93
+ return palette[h % palette.length];
94
+ }
95
+ /** Color per component kind — the informative signal (rather than package). */
96
+ export const KIND_COLOR = {
97
+ class: '#0893d2',
98
+ module: '#4ec9b0',
99
+ script: '#ff6b35',
100
+ registry: '#b48ead',
101
+ service: '#e3b341',
102
+ consumer: '#5aa9e6',
103
+ function: '#6c5ce7',
104
+ method: '#c586c0',
105
+ type: '#e07a5f',
106
+ package: '#2e86ab', // steel blue (an npm package container)
107
+ };
108
+ /**
109
+ * Convert a subsystem graph document into React Flow nodes. We render **flat**
110
+ * (no React Flow parent/group nodes) for robustness: package regions are laid
111
+ * out in a grid and each component carries its package + a `pkgBounds`
112
+ * rectangle on its node data so the group wrapper (drawn by the graph
113
+ * component) can frame it. Only components' real positions matter to React
114
+ * Flow; the package boundary is a visual region, not a sub-flow node.
115
+ */
116
+ export function convertSubsystemToNodes(doc, opts = {}) {
117
+ const { maxNodeWidth } = opts;
118
+ // Group components by package.
119
+ const byPkg = new Map();
120
+ for (const c of doc.components) {
121
+ const list = byPkg.get(c.purl) ?? [];
122
+ list.push(c);
123
+ byPkg.set(c.purl, list);
124
+ }
125
+ const nodes = [];
126
+ const COLS = 2;
127
+ const COL_W = 240;
128
+ const ROW_H = 150;
129
+ const PAD = 30;
130
+ const GROUP_GAP = 60;
131
+ let cursorY = PAD;
132
+ for (const comps of byPkg.values()) {
133
+ const rows = Math.ceil(comps.length / COLS);
134
+ const heightPx = ROW_H * rows;
135
+ comps.forEach((c, i) => {
136
+ const col = i % COLS;
137
+ const row = Math.floor(i / COLS);
138
+ const isPkg = c.kind === 'package';
139
+ // Estimate rendered node width from the longest text line so ELK reserves
140
+ // the right space (names can wrap, so we cap at the configurable max).
141
+ const text = [c.symbol, c.name, c.file.split('/').pop() ?? '']
142
+ .filter((t) => !!t)
143
+ .sort((a, b) => b.length - a.length)[0];
144
+ const cap = maxNodeWidth ?? (isPkg ? 320 : 300);
145
+ const textWidth = Math.min(cap, Math.max(60, (text?.length ?? 10) * 8));
146
+ // Account for CSS minWidth and padding/border so ELK's port positions match
147
+ // the actual rendered node boundaries.
148
+ const cssMinWidth = isPkg ? 200 : 150;
149
+ const cssPadding = isPkg ? 24 : 20; // horizontal padding (left + right)
150
+ const cssBorder = 4; // 2px border each side
151
+ const rawWidth = Math.max(cssMinWidth, (isPkg ? Math.max(220, textWidth) : textWidth) + cssPadding + cssBorder);
152
+ const nodeWidth = Math.max(cssMinWidth, Math.min(cap, rawWidth));
153
+ nodes.push({
154
+ id: c.id,
155
+ type: 'subsystem-component',
156
+ position: { x: PAD + col * COL_W, y: cursorY + row * ROW_H },
157
+ width: nodeWidth,
158
+ height: isPkg ? 100 : 84,
159
+ data: { component: c },
160
+ });
161
+ });
162
+ cursorY += heightPx + PAD * 2 + GROUP_GAP;
163
+ }
164
+ return nodes;
165
+ }
166
+ /**
167
+ * Convert a subsystem graph document into React Flow edges. Edges whose target
168
+ * is an external label (not a component id) point at a synthetic stub so the
169
+ * relationship is visible without a member node.
170
+ */
171
+ export function convertSubsystemToEdges(doc) {
172
+ const compIds = new Set(doc.components.map((c) => c.id));
173
+ const edges = [];
174
+ for (const e of doc.edges) {
175
+ const color = MECHANISM_COLOR[e.mechanism];
176
+ const style = MECHANISM_STYLE[e.mechanism];
177
+ // If `to` is a real component, connect directly; otherwise point at a stub node.
178
+ const isExternal = !compIds.has(e.to);
179
+ const targetId = isExternal ? `external:${e.to}` : e.to;
180
+ edges.push({
181
+ id: e.id,
182
+ source: e.from,
183
+ target: targetId,
184
+ data: { mechanism: e.mechanism, refs: e.refs },
185
+ type: 'subsystem-edge',
186
+ markerEnd: { type: MarkerType.ArrowClosed, color, width: 16, height: 16 },
187
+ style: { color, stroke: color, strokeDasharray: style === 'dashed' ? '6 4' : undefined },
188
+ // `label` feeds ELK's label-space reservation only; the visible label is
189
+ // rendered by the custom SubsystemEdge as an HTML overlay.
190
+ label: e.mechanism,
191
+ // Mechanism label rendered via the custom SubsystemEdge (an HTML overlay
192
+ // above the SVG edges, so it can't be hidden behind other edge lines).
193
+ });
194
+ }
195
+ return edges;
196
+ }
197
+ /**
198
+ * Build the full React Flow graph (nodes + edges) using **ELK auto-layout** to
199
+ * position every node (including external stub targets), so the graph is
200
+ * layered with minimized crossings.
201
+ */
202
+ export async function buildSubsystemGraph(doc, opts = {}) {
203
+ const { maxNodeWidth, showEdgeLabels, measuredWidths, measuredHeights } = opts;
204
+ const nodes = convertSubsystemToNodes(doc, { maxNodeWidth });
205
+ const edges = convertSubsystemToEdges(doc);
206
+ // External edge targets that aren't real components → create stub nodes so
207
+ // cross-package edges have something to land on.
208
+ const realIds = new Set(doc.components.map((c) => c.id));
209
+ const externalIds = [];
210
+ for (const e of doc.edges) {
211
+ if (!realIds.has(e.to)) {
212
+ const extId = `external:${e.to}`;
213
+ if (!externalIds.includes(extId))
214
+ externalIds.push(extId);
215
+ }
216
+ }
217
+ for (const extId of externalIds) {
218
+ const label = extId.replace(/^external:/, '');
219
+ const extTextWidth = Math.min(300, Math.max(150, label.length * 8));
220
+ nodes.push({
221
+ id: extId,
222
+ type: 'subsystem-component',
223
+ position: { x: 0, y: 0 },
224
+ width: Math.max(150, extTextWidth + 24),
225
+ height: 60,
226
+ data: {
227
+ component: {
228
+ id: extId,
229
+ name: label,
230
+ kind: 'consumer',
231
+ purl: 'external',
232
+ file: '',
233
+ purpose: 'cross-package integration target (not a member node)',
234
+ },
235
+ },
236
+ draggable: false,
237
+ });
238
+ }
239
+ // Apply measured dimensions (second pass) so ELK gets the real node sizes.
240
+ if (measuredWidths && measuredWidths.size > 0) {
241
+ for (const n of nodes) {
242
+ const mw = measuredWidths.get(n.id);
243
+ if (mw)
244
+ n.width = mw;
245
+ }
246
+ }
247
+ if (measuredHeights && measuredHeights.size > 0) {
248
+ for (const n of nodes) {
249
+ const mh = measuredHeights.get(n.id);
250
+ if (mh)
251
+ n.height = mh;
252
+ }
253
+ }
254
+ // ELK auto-layout: position nodes (layered, minimized crossings).
255
+ let placedNodes = nodes;
256
+ let labelPositions = new Map();
257
+ let elkPathStrings = new Map();
258
+ if (nodes.length > 0) {
259
+ try {
260
+ const result = await computeElkLayout(nodes, edges, {
261
+ routingStyle: 'orthogonal',
262
+ direction: 'RIGHT',
263
+ nodeSpacing: 60,
264
+ edgeSpacing: 30,
265
+ edgeNodeSpacing: 60,
266
+ interLayerSpacing: 120,
267
+ preserveNodePositions: false,
268
+ edgeLabels: showEdgeLabels === false ? { enabled: false } : { enabled: true, placement: 'CENTER' },
269
+ });
270
+ placedNodes = result.nodes;
271
+ labelPositions = result.edgeLabelPositions;
272
+ elkPathStrings = result.edgePaths;
273
+ }
274
+ catch (err) {
275
+ // Fall back to the (unpositioned) grid if ELK is unavailable.
276
+ console.warn('[subsystem-graph] ELK layout failed, using manual positions:', err);
277
+ }
278
+ }
279
+ // Stamp ELK-computed label midpoints onto edge data so the overlay can
280
+ // position labels at the actual path midpoint (not the node-center midpoint).
281
+ for (const e of edges) {
282
+ const pos = labelPositions.get(e.id);
283
+ if (pos) {
284
+ const d = e.data;
285
+ d.labelX = pos.x;
286
+ d.labelY = pos.y;
287
+ }
288
+ const elkP = elkPathStrings.get(e.id);
289
+ if (elkP) {
290
+ const d = e.data;
291
+ d.elkPath = elkP;
292
+ }
293
+ }
294
+ return { nodes: placedNodes, edges };
295
+ }
296
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/subsystem/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,UAAU,GAGX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AA8EtD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAClC,MAA0B,EAC1B,IAA4B,EAC5B,YAAqB,EACrB,IAAa;IAEb,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE;QAC3B,IAAI,IAAI,KAAK,QAAQ,EAAE;YACrB,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACpC,OAAO,GAAG,IAAI,CAA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R,MAAM,CAAC,GAAI,CAAwB,CAAC,IAA8B,CAAC;YACnE,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC;SAClB;KACF;IAED,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Subsystem component/group node + edge renderers.
3
+ *
4
+ * Lightweight, purpose-built for the subsystem component graph: a component
5
+ * renders its name (kind-tagged, colored by package) plus its symbol/purpose
6
+ * and a click-to-open file chip. Groups render as package containers. Clicking
7
+ * a component calls `onSelect` (to open the entry point / file).
8
+ */
9
+ import { type NodeProps, type EdgeProps } from '@xyflow/react';
10
+ import { type SubsystemGraphNode, type SubsystemGraphEdge } from './model';
11
+ export declare const KIND_LABEL: Record<string, string>;
12
+ export interface SubsystemGraphCallbacks {
13
+ /** Click a component — open its file/entry point. */
14
+ onSelect?: (componentId: string) => void;
15
+ /** Click an edge (or its label) — select the relationship. */
16
+ onEdgeSelect?: (edgeId: string) => void;
17
+ /** Upper bound for node width; nodes grow with content up to this, then wrap. */
18
+ maxNodeWidth?: number;
19
+ }
20
+ /** Root callbacks carried through node data (injected by the graph component). */
21
+ export declare const SUBSYSTEM_CALLBACKS: SubsystemGraphCallbacks;
22
+ export declare function SubsystemComponentNode(props: NodeProps<SubsystemGraphNode>): import("react/jsx-runtime").JSX.Element;
23
+ /** Subsystem edge — SVG path only. The mechanism label is rendered as an
24
+ * absolutely-positioned HTML overlay OUTSIDE the ReactFlow tree (by the
25
+ * parent Inner component) so it sits above the pane and receives pointer
26
+ * events. */
27
+ export declare function SubsystemEdge({ data, markerEnd, }: EdgeProps<SubsystemGraphEdge>): import("react/jsx-runtime").JSX.Element;
28
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/subsystem/nodes.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,eAAe,CAAC;AAEvB,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAW7C,CAAC;AAsDF,MAAM,WAAW,uBAAuB;IACtC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,iFAAiF;IACjF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,EAAE,uBAA4B,CAAC;AAE/D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,CAAC,kBAAkB,CAAC,2CA8M1E;AAED;;;cAGc;AACd,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,SAAS,GACV,EAAE,SAAS,CAAC,kBAAkB,CAAC,2CAkC/B"}
@@ -0,0 +1,230 @@
1
+ import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * Subsystem component/group node + edge renderers.
4
+ *
5
+ * Lightweight, purpose-built for the subsystem component graph: a component
6
+ * renders its name (kind-tagged, colored by package) plus its symbol/purpose
7
+ * and a click-to-open file chip. Groups render as package containers. Clicking
8
+ * a component calls `onSelect` (to open the entry point / file).
9
+ */
10
+ import { useState } from 'react';
11
+ import { Handle, Position, } from '@xyflow/react';
12
+ import { useTheme } from '@principal-ade/industry-theme';
13
+ import { KIND_COLOR, MECHANISM_COLOR, deriveNameFromSymbol, } from './model';
14
+ export const KIND_LABEL = {
15
+ class: 'class',
16
+ module: 'module',
17
+ script: 'script',
18
+ registry: 'registry',
19
+ service: 'service',
20
+ consumer: 'consumer',
21
+ function: 'function',
22
+ method: 'method',
23
+ type: 'type',
24
+ package: 'package',
25
+ };
26
+ /** Owning class of a method, derived from its `Symbol.Class.method` symbol. */
27
+ function ownerClass(symbol) {
28
+ if (!symbol)
29
+ return undefined;
30
+ const idx = symbol.lastIndexOf('.');
31
+ return idx > 0 ? symbol.slice(0, idx) : undefined;
32
+ }
33
+ /** Namespace/owner extracted from a PURL or npm scope. */
34
+ function purlNamespace(purl) {
35
+ if (!purl)
36
+ return undefined;
37
+ // pkg:github/owner/repo → owner
38
+ const hosted = purl.match(/^pkg:(github|gitlab|bitbucket)\/([^/]+)\//);
39
+ if (hosted)
40
+ return hosted[2];
41
+ // pkg:npm/@scope/name → @scope
42
+ const scoped = purl.match(/^pkg:npm\/(@[^/]+)\//);
43
+ if (scoped)
44
+ return scoped[1];
45
+ // pkg:generic/local/... → local
46
+ if (purl.startsWith('pkg:generic/local/'))
47
+ return 'local';
48
+ // @scope/name → @scope (legacy npm)
49
+ if (purl.startsWith('@')) {
50
+ const idx = purl.indexOf('/');
51
+ return idx > 0 ? purl.slice(0, idx) : undefined;
52
+ }
53
+ return undefined;
54
+ }
55
+ /** Short label for the hosting platform of a PURL. */
56
+ function purlRegistry(purl) {
57
+ if (!purl)
58
+ return '';
59
+ if (purl.startsWith('pkg:github/'))
60
+ return ' · github';
61
+ if (purl.startsWith('pkg:gitlab/'))
62
+ return ' · gitlab';
63
+ if (purl.startsWith('pkg:bitbucket/'))
64
+ return ' · bitbucket';
65
+ if (purl.startsWith('pkg:generic/local/'))
66
+ return ' · local';
67
+ if (purl.startsWith('pkg:npm/'))
68
+ return ' · npm';
69
+ if (purl.startsWith('@'))
70
+ return ' · npm';
71
+ return '';
72
+ }
73
+ /** Insert zero-width spaces at identifier word boundaries so long names wrap
74
+ * on naming conventions (snake_case `foo_`|`bar`, camelCase `foo`|`Bar`,
75
+ * PascalCase `Foo`|`Bar`, acronym `ABC`|`Def`) instead of mid-character. */
76
+ function breakWords(s) {
77
+ const zwsp = '\u200b';
78
+ return s
79
+ // camelCase: lower/digit → Upper (and the boundary before it holds)
80
+ .replace(/([a-z0-9])([A-Z])/g, `$1${zwsp}$2`)
81
+ // acronym → word: `ABC`|`Def` (two Uppercase then a lowercase)
82
+ .replace(/([A-Z])([A-Z][a-z])/g, `$1${zwsp}$2`)
83
+ // separators: break after `_`, `-`, `.`
84
+ .replace(/([_\-.])([^_\-.\u200b])/g, `$1${zwsp}$2`);
85
+ }
86
+ /** Root callbacks carried through node data (injected by the graph component). */
87
+ export const SUBSYSTEM_CALLBACKS = {};
88
+ export function SubsystemComponentNode(props) {
89
+ const { theme } = useTheme();
90
+ const { data, selected, width: nodeWidth, height: nodeHeight } = props;
91
+ const c = data.component;
92
+ const color = KIND_COLOR[c.kind] ?? '#888';
93
+ const muted = theme.colors.textMuted ?? theme.colors.textSecondary;
94
+ const [hover, setHover] = useState(false);
95
+ const isPackage = c.kind === 'package';
96
+ const configuredMax = SUBSYSTEM_CALLBACKS.maxNodeWidth;
97
+ const maxWidth = isPackage ? (configuredMax ?? 320) : (configuredMax ?? 300);
98
+ // `symbol` is the source of truth; `name` is derived from it consistently.
99
+ const displayName = deriveNameFromSymbol(c.symbol, c.kind, c.name, c.file);
100
+ return (_jsxs("div", { onMouseEnter: () => setHover(true), onMouseLeave: () => setHover(false), onClick: (e) => {
101
+ e.stopPropagation();
102
+ SUBSYSTEM_CALLBACKS.onSelect?.(c.id);
103
+ }, style: {
104
+ position: 'relative',
105
+ display: 'flex',
106
+ flexDirection: 'column',
107
+ justifyContent: 'center',
108
+ alignItems: 'center',
109
+ boxSizing: 'border-box',
110
+ width: nodeWidth,
111
+ height: nodeHeight,
112
+ minWidth: isPackage ? 200 : 150,
113
+ maxWidth,
114
+ padding: isPackage ? '10px 12px' : '6px 10px',
115
+ borderRadius: isPackage ? 10 : 8,
116
+ background: theme.colors.backgroundSecondary ?? theme.colors.background,
117
+ border: `2px ${isPackage ? 'dashed' : 'solid'} ${selected ? theme.colors.primary : color}`,
118
+ boxShadow: '0 1px 4px rgba(0,0,0,0.25)',
119
+ cursor: 'pointer',
120
+ fontFamily: theme.fonts.body,
121
+ }, children: [hover && (_jsxs("div", { style: {
122
+ position: 'absolute',
123
+ top: -26,
124
+ left: 0,
125
+ zIndex: 1000,
126
+ display: 'flex',
127
+ alignItems: 'center',
128
+ gap: 6,
129
+ whiteSpace: 'nowrap',
130
+ fontSize: theme.fontSizes[0] * 0.8,
131
+ fontFamily: theme.fonts.monospace,
132
+ textTransform: 'uppercase',
133
+ letterSpacing: 0.5,
134
+ color,
135
+ background: theme.colors.background,
136
+ border: `1px solid ${theme.colors.border}`,
137
+ borderRadius: 4,
138
+ padding: '1px 6px',
139
+ }, children: [KIND_LABEL[c.kind] ?? c.kind, c.kind === 'package' ? purlRegistry(c.purl) : c.purl ? ` · ${c.purl}` : '', c.capture && c.capture !== 'edited' ? ` · ${c.capture}` : ''] })), hover && c.purpose && (_jsx("div", { style: {
140
+ position: 'absolute',
141
+ top: '100%',
142
+ left: 0,
143
+ marginTop: 4,
144
+ zIndex: 1000,
145
+ maxWidth: 260,
146
+ fontSize: theme.fontSizes[0] * 0.85,
147
+ fontFamily: theme.fonts.body,
148
+ color: theme.colors.text,
149
+ background: theme.colors.background,
150
+ border: `1px solid ${theme.colors.border}`,
151
+ borderRadius: 4,
152
+ padding: '4px 8px',
153
+ boxShadow: '0 2px 8px rgba(0,0,0,0.3)',
154
+ lineHeight: 1.4,
155
+ }, children: c.purpose })), c.kind === 'method' && ownerClass(c.symbol) && (_jsx("div", { style: {
156
+ fontSize: theme.fontSizes[0] * 0.78,
157
+ fontFamily: theme.fonts.monospace,
158
+ color: muted,
159
+ textAlign: 'center',
160
+ whiteSpace: 'nowrap',
161
+ overflow: 'hidden',
162
+ textOverflow: 'ellipsis',
163
+ maxWidth: '100%',
164
+ marginBottom: 1,
165
+ }, title: ownerClass(c.symbol), children: ownerClass(c.symbol) })), c.kind === 'package' && purlNamespace(c.purl) && (_jsx("div", { style: {
166
+ fontSize: theme.fontSizes[0] * 0.78,
167
+ fontFamily: theme.fonts.monospace,
168
+ color: muted,
169
+ textAlign: 'center',
170
+ whiteSpace: 'nowrap',
171
+ overflow: 'hidden',
172
+ textOverflow: 'ellipsis',
173
+ maxWidth: '100%',
174
+ marginBottom: 1,
175
+ }, title: c.purl, children: purlNamespace(c.purl) })), _jsx("div", { style: {
176
+ fontSize: theme.fontSizes[2],
177
+ fontWeight: 600,
178
+ color: theme.colors.text,
179
+ lineHeight: 1.2,
180
+ textAlign: 'center',
181
+ // Let long names wrap within the node's capped width (instead of
182
+ // truncating), but cap each line so the node doesn't grow unbounded.
183
+ whiteSpace: 'normal',
184
+ overflowWrap: 'anywhere',
185
+ maxWidth: '100%',
186
+ // Types get a serif name to distinguish them from runtime units.
187
+ fontFamily: c.kind === 'type' ? 'Georgia, "Times New Roman", serif' : theme.fonts.body,
188
+ }, children: c.kind === 'method' ? `.${breakWords(displayName)}` : breakWords(displayName) }), c.symbol && c.kind !== 'method' && c.kind !== 'package' && c.symbol !== displayName && (_jsx("div", { style: {
189
+ fontSize: theme.fontSizes[0] * 0.82,
190
+ fontFamily: theme.fonts.monospace,
191
+ color: color,
192
+ marginTop: 1,
193
+ textAlign: 'center',
194
+ whiteSpace: 'nowrap',
195
+ overflow: 'hidden',
196
+ textOverflow: 'ellipsis',
197
+ maxWidth: '100%',
198
+ }, title: c.symbol, children: c.symbol })), c.file && c.kind !== 'package' && (_jsx("div", { onClick: (e) => {
199
+ e.stopPropagation();
200
+ SUBSYSTEM_CALLBACKS.onSelect?.(c.id);
201
+ }, style: {
202
+ alignSelf: 'center',
203
+ marginTop: 3,
204
+ fontSize: theme.fontSizes[0] * 0.78,
205
+ fontFamily: theme.fonts.monospace,
206
+ color: theme.colors.primary,
207
+ border: `1px solid ${theme.colors.border}`,
208
+ borderRadius: 4,
209
+ padding: '1px 5px',
210
+ cursor: 'pointer',
211
+ maxWidth: '100%',
212
+ overflow: 'hidden',
213
+ textOverflow: 'ellipsis',
214
+ whiteSpace: 'nowrap',
215
+ }, children: c.file.split('/').pop() })), _jsx(Handle, { type: "target", position: Position.Left, style: { opacity: 0 } }), _jsx(Handle, { type: "source", position: Position.Right, style: { opacity: 0 } })] }));
216
+ }
217
+ /** Subsystem edge — SVG path only. The mechanism label is rendered as an
218
+ * absolutely-positioned HTML overlay OUTSIDE the ReactFlow tree (by the
219
+ * parent Inner component) so it sits above the pane and receives pointer
220
+ * events. */
221
+ export function SubsystemEdge({ data, markerEnd, }) {
222
+ const path = data?.elkPath ?? '';
223
+ const mechanism = data?.mechanism ?? 'imports';
224
+ const color = MECHANISM_COLOR[mechanism] ?? '#888';
225
+ const isDashed = mechanism === 'registers-into';
226
+ const dimmed = data?.dimmed === true;
227
+ const opacity = dimmed ? 0.15 : 1;
228
+ 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: color, strokeWidth: 1.5, strokeDasharray: isDashed ? '6 4' : undefined, opacity: opacity, markerEnd: markerEnd, style: { pointerEvents: 'none' } })] }));
229
+ }
230
+ //# sourceMappingURL=nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/subsystem/nodes.tsx"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EACL,MAAM,EACN,QAAQ,GAGT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EACL,UAAU,EACV,eAAe,EACf,oBAAoB,GAGrB,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,MAAM,UAAU,GAA2B;IAChD,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,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C,KAAK,CAAC,CAAC,CAAC,SAAS,EAC7C,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,GAChC,IACD,CACJ,CAAC;AACJ,CAAC"}
@@ -38,6 +38,23 @@ export interface ElkLayoutOptions {
38
38
  * @default 10
39
39
  */
40
40
  edgeNodeSpacing?: number;
41
+ /**
42
+ * Minimum horizontal distance between layers (node-to-node across layers).
43
+ * Controls the gap that prevents nodes in adjacent layers from overlapping.
44
+ * @default 0
45
+ */
46
+ interLayerSpacing?: number;
47
+ /**
48
+ * Reserve space along edges for inline labels so they don't overlap nodes
49
+ * or other edges. When enabled ELK places labels inline on the edge with the
50
+ * given margin model.
51
+ */
52
+ edgeLabels?: {
53
+ /** Whether to reserve label space in the layout. @default true */
54
+ enabled?: boolean;
55
+ /** Placement of inline labels. @default 'CENTER' */
56
+ placement?: 'CENTER' | 'TAIL' | 'HEAD';
57
+ };
41
58
  /**
42
59
  * Layout direction
43
60
  * @default 'RIGHT'
@@ -55,6 +72,8 @@ export interface ElkLayoutResult {
55
72
  x: number;
56
73
  y: number;
57
74
  }>;
75
+ /** Raw ELK path points per edge (for debugging). */
76
+ edgePathPoints: Map<string, Point[]>;
58
77
  }
59
78
  /** Point in 2D space */
60
79
  export interface Point {
@@ -1 +1 @@
1
- {"version":3,"file":"elkLayout.d.ts","sourceRoot":"","sources":["../../src/utils/elkLayout.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEhD,sDAAsD;AACtD,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC;AAEpE,6BAA6B;AAC7B,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,eAAe,CAAC;IAE/B;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,OAAO,C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