@steffolino/diagram-kit-react 0.1.0
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/LICENSE +21 -0
- package/README.md +20 -0
- package/dist/DetailPanel.d.ts +17 -0
- package/dist/DetailPanel.d.ts.map +1 -0
- package/dist/DetailPanel.js +47 -0
- package/dist/DetailPanel.js.map +1 -0
- package/dist/DiagramView.d.ts +38 -0
- package/dist/DiagramView.d.ts.map +1 -0
- package/dist/DiagramView.js +200 -0
- package/dist/DiagramView.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Stefan Stretz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# @steffolino/diagram-kit-react
|
|
2
|
+
|
|
3
|
+
Interactive React renderer for `@steffolino/diagram-kit-core` graphs: real `dagre`
|
|
4
|
+
auto-layout, click-to-select detail panel.
|
|
5
|
+
|
|
6
|
+
```tsx
|
|
7
|
+
import { fromYaml } from '@steffolino/diagram-kit-adapters'
|
|
8
|
+
import { DiagramView } from '@steffolino/diagram-kit-react'
|
|
9
|
+
|
|
10
|
+
const graph = fromYaml(yamlSource)
|
|
11
|
+
|
|
12
|
+
function Diagram() {
|
|
13
|
+
return <DiagramView graph={graph} layout={{ direction: 'TB' }} />
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Requires `react`/`react-dom` ^18 or ^19 as peer dependencies.
|
|
18
|
+
|
|
19
|
+
Part of the diagram-kit monorepo. See the repo root README for the full
|
|
20
|
+
picture.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { DiagramNode, ThemeColors } from '@steffolino/diagram-kit-core';
|
|
3
|
+
export type DetailPanelPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
+
export interface DetailPanelProps {
|
|
5
|
+
node: DiagramNode;
|
|
6
|
+
colors: ThemeColors;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/** Which edge of the diagram the panel docks to. Default "right". */
|
|
9
|
+
position?: DetailPanelPosition;
|
|
10
|
+
/** Frosted-glass styling (translucent + backdrop blur) instead of a flat surface color. Default false. */
|
|
11
|
+
glass?: boolean;
|
|
12
|
+
/** The diagram's own laid-out width/height, so the panel scales down for a small diagram instead of overhanging past its edges at a fixed size. */
|
|
13
|
+
containerWidth: number;
|
|
14
|
+
containerHeight: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function DetailPanel({ node, colors, onClose, position, glass, containerWidth, containerHeight, }: DetailPanelProps): JSX.Element;
|
|
17
|
+
//# sourceMappingURL=DetailPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailPanel.d.ts","sourceRoot":"","sources":["../src/DetailPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,GAAG,EAAE,MAAM,OAAO,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG5E,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;AAErE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,WAAW,CAAA;IACjB,MAAM,EAAE,WAAW,CAAA;IACnB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,mBAAmB,CAAA;IAC9B,0GAA0G;IAC1G,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,mJAAmJ;IACnJ,cAAc,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;CACxB;AA2BD,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,MAAM,EACN,OAAO,EACP,QAAkB,EAClB,KAAa,EACb,cAAc,EACd,eAAe,GAChB,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAiDhC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { withAlpha } from '@steffolino/diagram-kit-core';
|
|
3
|
+
const SIDEBAR_SIZE = 260;
|
|
4
|
+
const BAR_SIZE = 160;
|
|
5
|
+
function positionStyle(position, colors, containerWidth, containerHeight) {
|
|
6
|
+
const width = Math.min(SIDEBAR_SIZE, containerWidth * 0.75);
|
|
7
|
+
const height = Math.min(BAR_SIZE, containerHeight * 0.6);
|
|
8
|
+
switch (position) {
|
|
9
|
+
case 'left':
|
|
10
|
+
return { top: 0, left: 0, bottom: 0, width, borderRight: `1px solid ${colors.border}` };
|
|
11
|
+
case 'top':
|
|
12
|
+
return { top: 0, left: 0, right: 0, height, borderBottom: `1px solid ${colors.border}` };
|
|
13
|
+
case 'bottom':
|
|
14
|
+
return { bottom: 0, left: 0, right: 0, height, borderTop: `1px solid ${colors.border}` };
|
|
15
|
+
case 'right':
|
|
16
|
+
default:
|
|
17
|
+
return { top: 0, right: 0, bottom: 0, width, borderLeft: `1px solid ${colors.border}` };
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function DetailPanel({ node, colors, onClose, position = 'right', glass = false, containerWidth, containerHeight, }) {
|
|
21
|
+
return (_jsxs("aside", { "aria-label": `Details for ${node.label}`, style: {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
padding: 16,
|
|
24
|
+
background: glass ? withAlpha(colors.surface, 0.6) : colors.surface,
|
|
25
|
+
backdropFilter: glass ? 'blur(14px) saturate(160%)' : undefined,
|
|
26
|
+
WebkitBackdropFilter: glass ? 'blur(14px) saturate(160%)' : undefined,
|
|
27
|
+
color: colors.text,
|
|
28
|
+
overflowY: 'auto',
|
|
29
|
+
...positionStyle(position, colors, containerWidth, containerHeight),
|
|
30
|
+
}, children: [_jsx("button", { type: "button", "aria-label": "Close details", onClick: onClose, style: {
|
|
31
|
+
background: 'none',
|
|
32
|
+
border: 'none',
|
|
33
|
+
color: colors.textMuted,
|
|
34
|
+
cursor: 'pointer',
|
|
35
|
+
float: 'right',
|
|
36
|
+
fontSize: 14,
|
|
37
|
+
}, children: "Close" }), _jsx("h3", { style: { margin: '0 0 4px', fontSize: 14, fontWeight: 600 }, children: node.label }), node.badge && (_jsx("span", { style: {
|
|
38
|
+
display: 'inline-block',
|
|
39
|
+
fontSize: 11,
|
|
40
|
+
padding: '2px 6px',
|
|
41
|
+
borderRadius: 4,
|
|
42
|
+
background: colors.border,
|
|
43
|
+
color: colors.textMuted,
|
|
44
|
+
marginBottom: 8,
|
|
45
|
+
}, children: node.badge })), node.detail && _jsx("p", { style: { fontSize: 13, color: colors.textMuted, lineHeight: 1.5 }, children: node.detail })] }));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=DetailPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailPanel.js","sourceRoot":"","sources":["../src/DetailPanel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAiBxD,MAAM,YAAY,GAAG,GAAG,CAAA;AACxB,MAAM,QAAQ,GAAG,GAAG,CAAA;AAEpB,SAAS,aAAa,CACpB,QAA6B,EAC7B,MAAmB,EACnB,cAAsB,EACtB,eAAuB;IAEvB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,cAAc,GAAG,IAAI,CAAC,CAAA;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,eAAe,GAAG,GAAG,CAAC,CAAA;IAExD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,MAAM;YACT,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,MAAM,CAAC,MAAM,EAAE,EAAE,CAAA;QACzF,KAAK,KAAK;YACR,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,aAAa,MAAM,CAAC,MAAM,EAAE,EAAE,CAAA;QAC1F,KAAK,QAAQ;YACX,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,MAAM,CAAC,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AE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,YAAG,IAAI,CAAC,KAAK,GAAM,EACjF,IAAI,CAAC,KAAK,IAAI,CACb,eACE,KAAK,EAAE;oBACL,OAAO,EAAE,cAAc;oBACvB,QAAQ,EAAE,EAAE;oBACZ,OAAO,EAAE,SAAS;oBAClB,YAAY,EAAE,CAAC;oBACf,UAAU,EAAE,MAAM,CAAC,MAAM;oBACzB,KAAK,EAAE,MAAM,CAAC,SAAS;oBACvB,YAAY,EAAE,CAAC;iBAChB,YAEA,IAAI,CAAC,KAAK,GACN,CACR,EACA,IAAI,CAAC,MAAM,IAAI,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,YAAG,IAAI,CAAC,MAAM,GAAK,IACjG,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type JSX } from 'react';
|
|
2
|
+
import type { DiagramGraph, DiagramTheme, LayoutOptions, StackLayoutOptions, StructuralLayoutOptions } from '@steffolino/diagram-kit-core';
|
|
3
|
+
import { type DetailPanelPosition } from './DetailPanel.js';
|
|
4
|
+
export type LayoutMode = 'graph' | 'structural' | 'stack' | 'cycle';
|
|
5
|
+
export interface DiagramViewProps {
|
|
6
|
+
graph: DiagramGraph;
|
|
7
|
+
/** "graph" (default): dagre layout. "structural": nested containment. "stack": sequential list. "cycle": left-to-right process with circular repeat loops. */
|
|
8
|
+
layoutMode?: LayoutMode;
|
|
9
|
+
layout?: LayoutOptions;
|
|
10
|
+
structuralLayout?: StructuralLayoutOptions;
|
|
11
|
+
stackLayout?: StackLayoutOptions;
|
|
12
|
+
theme?: DiagramTheme;
|
|
13
|
+
mode?: 'light' | 'dark';
|
|
14
|
+
/** Space around the graph, included in the diagram background. Default 0. */
|
|
15
|
+
padding?: number;
|
|
16
|
+
/** Show descriptions in a panel on selection (default), or below titles. */
|
|
17
|
+
detailPlacement?: 'panel' | 'inline';
|
|
18
|
+
/** Renders a built-in detail panel on node click when true (default). Pass false to only use onSelect. */
|
|
19
|
+
showDetailPanel?: boolean;
|
|
20
|
+
/** Which edge of the diagram the detail panel docks to. Default "right". */
|
|
21
|
+
detailPanelPosition?: DetailPanelPosition;
|
|
22
|
+
/** Frosted-glass node chips and detail panel (translucent + backdrop blur) over a soft gradient backdrop, instead of flat surface colors. Default false. */
|
|
23
|
+
glass?: boolean;
|
|
24
|
+
/** Tints each entity's own background/border with its category color instead of a neutral surface + accent dot. Default false — entities stay neutral (e.g. dark text on light/white), independent of the category palette. */
|
|
25
|
+
colorizeNodes?: boolean;
|
|
26
|
+
onSelect?: (nodeId: string | null) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Interactive diagram, four layout modes sharing one renderer: "graph"
|
|
30
|
+
* (real dagre auto-layout, edges drawn as routed lines or chunky block
|
|
31
|
+
* arrows), "structural" (nested boxes from containment, no connectors —
|
|
32
|
+
* a context card containing its layers, a directory containing its
|
|
33
|
+
* files), and "stack" (a flat sequential list, no hierarchy at all).
|
|
34
|
+
* "cycle" adds circular repeat loops to a left-to-right process.
|
|
35
|
+
* Descriptions appear on selection or inline beneath titles.
|
|
36
|
+
*/
|
|
37
|
+
export declare function DiagramView({ graph, layoutMode, layout, structuralLayout, stackLayout, theme, mode, padding, detailPlacement, showDetailPanel, detailPanelPosition, glass, colorizeNodes, onSelect, }: DiagramViewProps): JSX.Element;
|
|
38
|
+
//# sourceMappingURL=DiagramView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiagramView.d.ts","sourceRoot":"","sources":["../src/DiagramView.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,GAAG,EAAkB,MAAM,OAAO,CAAA;AACnE,OAAO,KAAK,EACV,YAAY,EAEZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,8BAA8B,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runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
3
|
+
import { layoutGraph, layoutCycle, layoutStructural, layoutStack, defaultTheme, categoryColor, pointsToSvgPath, blockArrowPoints, pointsToPolygon, withAlpha, detailLines, detailHeight, } from '@steffolino/diagram-kit-core';
|
|
4
|
+
import { DetailPanel } from './DetailPanel.js';
|
|
5
|
+
function NodeContent({ node, accent, colors }) {
|
|
6
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { style: { width: 8, height: 8, borderRadius: '50%', background: accent, flexShrink: 0 } }), _jsx("span", { style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: node.label }), node.badge && (_jsx("span", { style: { fontSize: 10, color: colors.textMuted, whiteSpace: 'nowrap' }, children: node.badge }))] }));
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Interactive diagram, four layout modes sharing one renderer: "graph"
|
|
10
|
+
* (real dagre auto-layout, edges drawn as routed lines or chunky block
|
|
11
|
+
* arrows), "structural" (nested boxes from containment, no connectors —
|
|
12
|
+
* a context card containing its layers, a directory containing its
|
|
13
|
+
* files), and "stack" (a flat sequential list, no hierarchy at all).
|
|
14
|
+
* "cycle" adds circular repeat loops to a left-to-right process.
|
|
15
|
+
* Descriptions appear on selection or inline beneath titles.
|
|
16
|
+
*/
|
|
17
|
+
export function DiagramView({ graph, layoutMode = 'graph', layout, structuralLayout, stackLayout, theme = defaultTheme, mode = 'light', padding = 0, detailPlacement = 'panel', showDetailPanel = true, detailPanelPosition = 'right', glass = false, colorizeNodes = false, onSelect, }) {
|
|
18
|
+
const [selectedId, setSelectedId] = useState(null);
|
|
19
|
+
const colors = theme[mode];
|
|
20
|
+
const showDetails = detailPlacement === 'inline';
|
|
21
|
+
const backdropGradient = useMemo(() => {
|
|
22
|
+
if (!glass)
|
|
23
|
+
return undefined;
|
|
24
|
+
const [a, b, c] = colors.categories;
|
|
25
|
+
return `radial-gradient(circle at 15% 15%, ${a ?? colors.edge}55, transparent 45%), radial-gradient(circle at 85% 30%, ${b ?? colors.edge}44, transparent 50%), radial-gradient(circle at 50% 90%, ${c ?? colors.edge}33, transparent 55%)`;
|
|
26
|
+
}, [glass, colors]);
|
|
27
|
+
const positioned = useMemo(() => {
|
|
28
|
+
if (layoutMode === 'cycle')
|
|
29
|
+
return layoutCycle(graph, { showDetails });
|
|
30
|
+
if (layoutMode === 'structural')
|
|
31
|
+
return layoutStructural(graph, { ...structuralLayout, showDetails });
|
|
32
|
+
if (layoutMode === 'stack')
|
|
33
|
+
return layoutStack(graph, { ...stackLayout, showDetails });
|
|
34
|
+
return layoutGraph(graph, { ...layout, showDetails });
|
|
35
|
+
}, [graph, layout, structuralLayout, stackLayout, layoutMode, showDetails]);
|
|
36
|
+
const nodeById = useMemo(() => new Map(graph.nodes.map((n) => [n.id, n])), [graph.nodes]);
|
|
37
|
+
const containerIds = useMemo(() => new Set(graph.nodes.filter((n) => n.parentId).map((n) => n.parentId)), [graph.nodes]);
|
|
38
|
+
const maxWeight = useMemo(() => Math.max(1, ...graph.edges.map((e) => e.weight ?? 1)), [graph.edges]);
|
|
39
|
+
const select = (id) => {
|
|
40
|
+
setSelectedId((current) => {
|
|
41
|
+
const next = current === id ? null : id;
|
|
42
|
+
onSelect?.(next);
|
|
43
|
+
return next;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const selectedNode = selectedId ? (nodeById.get(selectedId) ?? null) : null;
|
|
47
|
+
// Neutral by default (e.g. dark text on a light/white surface), independent
|
|
48
|
+
// of the category palette — the accent dot alone carries the category.
|
|
49
|
+
// With `colorizeNodes`, the entity's own fill/border tint toward its
|
|
50
|
+
// category color instead.
|
|
51
|
+
function entityFill(accent, glassAlpha, solidAlpha) {
|
|
52
|
+
if (colorizeNodes)
|
|
53
|
+
return withAlpha(accent, glass ? glassAlpha * 0.7 : solidAlpha);
|
|
54
|
+
return glass ? withAlpha(colors.surface, 0.55) : colors.surface;
|
|
55
|
+
}
|
|
56
|
+
function entityBorder(accent, selected) {
|
|
57
|
+
if (selected)
|
|
58
|
+
return accent;
|
|
59
|
+
if (colorizeNodes)
|
|
60
|
+
return withAlpha(accent, 0.5);
|
|
61
|
+
return glass ? withAlpha(colors.border, 0.5) : colors.border;
|
|
62
|
+
}
|
|
63
|
+
const chipStyle = (node, selected, accent) => ({
|
|
64
|
+
display: 'flex',
|
|
65
|
+
// With inline detail text, pin the title to a fixed offset from the box
|
|
66
|
+
// top (rather than centering) so it lines up across nodes whose boxes
|
|
67
|
+
// are taller than their own content (e.g. cycle mode's uniform-height
|
|
68
|
+
// boxes) — centering would push shorter-text titles down out of line
|
|
69
|
+
// with the rest of the row. With no inline detail, there's nothing
|
|
70
|
+
// below the title to align against, so just center it in the box.
|
|
71
|
+
alignItems: (showDetails ? 'flex-start' : 'center'),
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
gap: 6,
|
|
74
|
+
padding: showDetails ? '14px 10px 0' : '0 10px',
|
|
75
|
+
borderRadius: 8,
|
|
76
|
+
border: `1px solid ${entityBorder(accent, selected)}`,
|
|
77
|
+
background: entityFill(accent, 0.3, 0.14),
|
|
78
|
+
backdropFilter: glass ? 'blur(10px) saturate(160%)' : undefined,
|
|
79
|
+
WebkitBackdropFilter: glass ? 'blur(10px) saturate(160%)' : undefined,
|
|
80
|
+
color: colors.text,
|
|
81
|
+
fontSize: 12,
|
|
82
|
+
fontWeight: 500,
|
|
83
|
+
cursor: 'pointer',
|
|
84
|
+
boxShadow: selected ? `0 0 0 2px ${accent}33` : undefined,
|
|
85
|
+
});
|
|
86
|
+
function renderDescription(node, width) {
|
|
87
|
+
const lines = showDetails ? detailLines(node.detail, width - 24) : [];
|
|
88
|
+
return lines.length > 0 ? (_jsx("span", { style: { display: 'block', marginTop: 8, fontSize: 11, lineHeight: '15px', fontWeight: 400, color: colors.textMuted, textAlign: 'center' }, children: lines.map((line, i) => _jsx("span", { style: { display: 'block', whiteSpace: 'pre' }, children: line || '\u00a0' }, i)) })) : null;
|
|
89
|
+
}
|
|
90
|
+
function renderContent(node, width, accent) {
|
|
91
|
+
return (_jsxs("span", { style: { display: 'block', width: '100%', minWidth: 0 }, children: [_jsx("span", { style: { display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6 }, children: _jsx(NodeContent, { node: node, accent: accent, colors: colors }) }), renderDescription(node, width)] }));
|
|
92
|
+
}
|
|
93
|
+
function renderLeaf(node, position) {
|
|
94
|
+
const selected = node.id === selectedId;
|
|
95
|
+
const accent = categoryColor(node.category, theme, mode);
|
|
96
|
+
const left = position.x - position.width / 2;
|
|
97
|
+
const top = position.y - position.height / 2;
|
|
98
|
+
if (node.shape === 'cylinder') {
|
|
99
|
+
const capHeight = Math.min(20, position.height * 0.35);
|
|
100
|
+
return (_jsxs("div", { role: "button", tabIndex: 0, "aria-pressed": selected, onClick: () => select(node.id), onKeyDown: (e) => (e.key === 'Enter' || e.key === ' ') && select(node.id), style: { position: 'absolute', left, top, width: position.width, height: position.height, cursor: 'pointer' }, children: [_jsx("div", { style: {
|
|
101
|
+
position: 'absolute',
|
|
102
|
+
top: capHeight / 2,
|
|
103
|
+
left: 0,
|
|
104
|
+
right: 0,
|
|
105
|
+
bottom: 0,
|
|
106
|
+
borderRadius: '0 0 8px 8px',
|
|
107
|
+
border: `1px solid ${entityBorder(accent, selected)}`,
|
|
108
|
+
borderTop: 'none',
|
|
109
|
+
background: entityFill(accent, 0.3, 0.14),
|
|
110
|
+
} }), _jsx("div", { style: {
|
|
111
|
+
position: 'absolute',
|
|
112
|
+
top: 0,
|
|
113
|
+
left: 0,
|
|
114
|
+
right: 0,
|
|
115
|
+
height: capHeight,
|
|
116
|
+
borderRadius: '50%',
|
|
117
|
+
border: `1px solid ${entityBorder(accent, selected)}`,
|
|
118
|
+
background: entityFill(accent, 0.3, 0.14),
|
|
119
|
+
} }), _jsx("div", { style: {
|
|
120
|
+
position: 'absolute',
|
|
121
|
+
top: capHeight,
|
|
122
|
+
left: 0,
|
|
123
|
+
right: 0,
|
|
124
|
+
bottom: 0,
|
|
125
|
+
display: 'flex',
|
|
126
|
+
alignItems: 'center',
|
|
127
|
+
justifyContent: 'center',
|
|
128
|
+
gap: 6,
|
|
129
|
+
padding: '0 10px',
|
|
130
|
+
color: colors.text,
|
|
131
|
+
fontSize: 12,
|
|
132
|
+
fontWeight: 500,
|
|
133
|
+
}, children: renderContent(node, position.width, accent) })] }, node.id));
|
|
134
|
+
}
|
|
135
|
+
return (_jsx("button", { type: "button", "aria-pressed": selected, onClick: () => select(node.id), style: { position: 'absolute', left, top, width: position.width, height: position.height, ...chipStyle(node, selected, accent) }, children: renderContent(node, position.width, accent) }, node.id));
|
|
136
|
+
}
|
|
137
|
+
function renderContainer(node, position) {
|
|
138
|
+
const selected = node.id === selectedId;
|
|
139
|
+
const accent = categoryColor(node.category, theme, mode);
|
|
140
|
+
const left = position.x - position.width / 2;
|
|
141
|
+
const top = position.y - position.height / 2;
|
|
142
|
+
return (_jsxs("div", { style: {
|
|
143
|
+
position: 'absolute',
|
|
144
|
+
left,
|
|
145
|
+
top,
|
|
146
|
+
width: position.width,
|
|
147
|
+
height: position.height,
|
|
148
|
+
borderRadius: 10,
|
|
149
|
+
border: `1px ${node.borderStyle === 'dashed' ? 'dashed' : 'solid'} ${entityBorder(accent, selected)}`,
|
|
150
|
+
background: colorizeNodes
|
|
151
|
+
? withAlpha(accent, glass ? 0.14 : 0.1)
|
|
152
|
+
: glass
|
|
153
|
+
? withAlpha(colors.surface, 0.35)
|
|
154
|
+
: withAlpha(colors.surface, 0.6),
|
|
155
|
+
backdropFilter: glass ? 'blur(10px) saturate(160%)' : undefined,
|
|
156
|
+
WebkitBackdropFilter: glass ? 'blur(10px) saturate(160%)' : undefined,
|
|
157
|
+
}, children: [_jsxs("button", { type: "button", "aria-pressed": selected, onClick: () => select(node.id), style: {
|
|
158
|
+
display: 'flex',
|
|
159
|
+
alignItems: 'center',
|
|
160
|
+
gap: 6,
|
|
161
|
+
width: '100%',
|
|
162
|
+
padding: '6px 10px',
|
|
163
|
+
background: 'none',
|
|
164
|
+
border: 'none',
|
|
165
|
+
borderBottom: `1px solid ${colorizeNodes ? withAlpha(accent, 0.4) : colors.border}`,
|
|
166
|
+
color: colors.text,
|
|
167
|
+
fontSize: 12,
|
|
168
|
+
fontWeight: 600,
|
|
169
|
+
cursor: 'pointer',
|
|
170
|
+
textAlign: 'left',
|
|
171
|
+
}, children: [_jsx("span", { style: { width: 8, height: 8, borderRadius: '50%', background: accent, flexShrink: 0 } }), node.label, node.badge && (_jsx("span", { style: { fontSize: 10, fontWeight: 500, color: colors.textMuted }, children: node.badge }))] }), _jsx("div", { style: { padding: '0 12px', height: detailHeight(node, position.width, showDetails) }, children: renderDescription(node, position.width) })] }, node.id));
|
|
172
|
+
}
|
|
173
|
+
return (_jsxs("div", { style: {
|
|
174
|
+
position: 'relative',
|
|
175
|
+
width: positioned.width + padding * 2,
|
|
176
|
+
height: positioned.height + padding * 2,
|
|
177
|
+
background: backdropGradient ? `${backdropGradient}, ${colors.background}` : colors.background,
|
|
178
|
+
}, children: [_jsxs("div", { style: { position: 'absolute', left: padding, top: padding, width: positioned.width, height: positioned.height }, children: [positioned.edges.length > 0 && (_jsx("svg", { width: positioned.width, height: positioned.height, style: { position: 'absolute', inset: 0 }, "aria-hidden": "true", focusable: "false", children: positioned.edges.map((edge) => {
|
|
179
|
+
const source = graph.edges.find((e) => e.id === edge.id);
|
|
180
|
+
const strokeColor = layoutMode === 'cycle' && source && source.source === source.target
|
|
181
|
+
? categoryColor(nodeById.get(source.source)?.category, theme, mode)
|
|
182
|
+
: source?.projected ? colors.edgeProjected : colors.edge;
|
|
183
|
+
const midpoint = edge.points[Math.floor((edge.points.length - 1) / 2)];
|
|
184
|
+
if (edge.arrow || source?.style === 'block') {
|
|
185
|
+
const polygon = edge.arrow ?? blockArrowPoints(edge.points);
|
|
186
|
+
return (_jsxs("g", { children: [_jsx("polygon", { points: pointsToPolygon(polygon), fill: strokeColor, opacity: 0.85 }), source?.label && midpoint && (_jsx("text", { x: midpoint.x, y: midpoint.y - 12, textAnchor: "middle", fontSize: 10, fill: colors.textMuted, stroke: colors.background, strokeWidth: 4, paintOrder: "stroke", children: source.label }))] }, edge.id));
|
|
187
|
+
}
|
|
188
|
+
const strokeWidth = 1 + ((source?.weight ?? 1) / maxWeight) * 2;
|
|
189
|
+
return (_jsxs("g", { children: [_jsx("path", { d: pointsToSvgPath(edge.points), fill: "none", stroke: strokeColor, strokeWidth: strokeWidth, strokeDasharray: source?.projected ? '4 3' : undefined }), source?.label && midpoint && (_jsx("text", { x: midpoint.x, y: midpoint.y - 6, textAnchor: "middle", fontSize: 10, fill: colors.textMuted, stroke: colors.background, strokeWidth: 4, paintOrder: "stroke", children: source.label }))] }, edge.id));
|
|
190
|
+
}) })), positioned.nodes.map((position) => {
|
|
191
|
+
const node = nodeById.get(position.id);
|
|
192
|
+
if (!node)
|
|
193
|
+
return null;
|
|
194
|
+
if (layoutMode === 'structural' && containerIds.has(node.id)) {
|
|
195
|
+
return renderContainer(node, position);
|
|
196
|
+
}
|
|
197
|
+
return renderLeaf(node, position);
|
|
198
|
+
})] }), !showDetails && showDetailPanel && selectedNode && (_jsx(DetailPanel, { node: selectedNode, colors: colors, position: detailPanelPosition, glass: glass, containerWidth: positioned.width + padding * 2, containerHeight: positioned.height + padding * 2, onClose: () => select(null) }))] }));
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=DiagramView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiagramView.js","sourceRoot":"","sources":["../src/DiagramView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAA4B,MAAM,OAAO,CAAA;AASnE,OAAO,EACL,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,WAAW,EACX,YAAY,GACb,MAAM,8BAA8B,CAAA;AAC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O,GAAG,CAAC,EAChD,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAC3B,CACH,IACG,CACP,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { DiagramView } from './DiagramView.js';
|
|
2
|
+
export type { DiagramViewProps, LayoutMode } from './DiagramView.js';
|
|
3
|
+
export { DetailPanel } from './DetailPanel.js';
|
|
4
|
+
export type { DetailPanelProps, DetailPanelPosition } from './DetailPanel.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,YAAY,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@steffolino/diagram-kit-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Interactive React renderer for diagram-kit graphs: auto-layout, click-to-select detail panel.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Stefan Stretz",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/steffolino/diagram-kit.git",
|
|
10
|
+
"directory": "packages/react"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/steffolino/diagram-kit/tree/master/packages/react#readme",
|
|
13
|
+
"bugs": "https://github.com/steffolino/diagram-kit/issues",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"diagram",
|
|
19
|
+
"react",
|
|
20
|
+
"graph",
|
|
21
|
+
"visualization",
|
|
22
|
+
"architecture-diagram"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"main": "./dist/index.js",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@steffolino/diagram-kit-core": "0.1.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
43
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/react": "^19.0.0",
|
|
47
|
+
"@types/react-dom": "^19.0.0",
|
|
48
|
+
"typescript": "^5.7.2"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc -p tsconfig.json",
|
|
52
|
+
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput",
|
|
53
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
54
|
+
}
|
|
55
|
+
}
|