@industry-theme/principal-view-panels 0.1.12 → 0.1.14
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.
|
@@ -8,9 +8,7 @@ export declare const createMockContext: (overrides?: Partial<PanelContextValue>)
|
|
|
8
8
|
* Mock Panel Actions for Storybook
|
|
9
9
|
*/
|
|
10
10
|
export declare const createMockActions: (overrides?: Partial<PanelActions> & {
|
|
11
|
-
readFile?: (path: string) => Promise<
|
|
12
|
-
content: string;
|
|
13
|
-
}>;
|
|
11
|
+
readFile?: (path: string) => Promise<string>;
|
|
14
12
|
writeFile?: (path: string, content: string) => Promise<void>;
|
|
15
13
|
}) => PanelActions & Record<string, any>;
|
|
16
14
|
/**
|
|
@@ -25,9 +23,7 @@ export declare const MockPanelProvider: React.FC<{
|
|
|
25
23
|
children: (props: PanelComponentProps) => React.ReactNode;
|
|
26
24
|
contextOverrides?: Partial<PanelContextValue>;
|
|
27
25
|
actionsOverrides?: Partial<PanelActions> & {
|
|
28
|
-
readFile?: (path: string) => Promise<
|
|
29
|
-
content: string;
|
|
30
|
-
}>;
|
|
26
|
+
readFile?: (path: string) => Promise<string>;
|
|
31
27
|
writeFile?: (path: string, content: string) => Promise<void>;
|
|
32
28
|
};
|
|
33
29
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panelContext.d.ts","sourceRoot":"","sources":["../../src/mocks/panelContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EAIlB,MAAM,UAAU,CAAC;AA+BlB;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,OAAO,CAAC,iBAAiB,CAAC,KACrC,iBAiHF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,OAAO,CAAC,YAAY,CAAC,GAAG;I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AC,IAAI,CAAC,CAAC;KAC9D,CAAC;CACH,CAMA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrincipalViewGraphPanel.d.ts","sourceRoot":"","sources":["../../src/panels/PrincipalViewGraphPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAoD/E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"PrincipalViewGraphPanel.d.ts","sourceRoot":"","sources":["../../src/panels/PrincipalViewGraphPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAoD/E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA8hCjE,CAAC"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -47788,19 +47788,11 @@ function requireEdgeInfoPanel() {
|
|
|
47788
47788
|
EdgeInfoPanel.EdgeInfoPanel = void 0;
|
|
47789
47789
|
const jsx_runtime_1 = require$$0;
|
|
47790
47790
|
const industry_theme_1 = requireCjs();
|
|
47791
|
-
const
|
|
47791
|
+
const SIDE_OPTIONS = ["top", "right", "bottom", "left"];
|
|
47792
|
+
const EdgeInfoPanel$1 = ({ edge, typeDefinition, sourceNodeId, targetNodeId, onClose, onDelete, onUpdateSides }) => {
|
|
47793
|
+
var _a, _b;
|
|
47792
47794
|
const { theme } = (0, industry_theme_1.useTheme)();
|
|
47793
47795
|
const edgeColor = typeDefinition.color || theme.colors.primary;
|
|
47794
|
-
const displayFields = typeDefinition.dataSchema ? Object.entries(typeDefinition.dataSchema).filter(([, schema2]) => schema2.displayInInfo).map(([field, schema2]) => {
|
|
47795
|
-
var _a;
|
|
47796
|
-
return {
|
|
47797
|
-
field,
|
|
47798
|
-
label: schema2.label || field,
|
|
47799
|
-
value: (_a = edge.data) == null ? void 0 : _a[field]
|
|
47800
|
-
};
|
|
47801
|
-
}) : [];
|
|
47802
|
-
const hasSchemaFields = displayFields.length > 0;
|
|
47803
|
-
const edgeDataEntries = edge.data ? Object.entries(edge.data) : [];
|
|
47804
47796
|
return (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
47805
47797
|
position: "absolute",
|
|
47806
47798
|
top: "60px",
|
|
@@ -47850,17 +47842,37 @@ function requireEdgeInfoPanel() {
|
|
|
47850
47842
|
backgroundColor: theme.colors.muted,
|
|
47851
47843
|
padding: "2px 6px",
|
|
47852
47844
|
borderRadius: "3px"
|
|
47853
|
-
}, children: targetNodeId })] })] }),
|
|
47854
|
-
|
|
47855
|
-
|
|
47856
|
-
|
|
47857
|
-
|
|
47858
|
-
},
|
|
47859
|
-
|
|
47860
|
-
|
|
47861
|
-
|
|
47862
|
-
|
|
47863
|
-
|
|
47845
|
+
}, children: targetNodeId })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "12px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: "10px", color: theme.colors.textSecondary, marginBottom: "8px" }, children: "Connection Sides" }), (0, jsx_runtime_1.jsxs)("div", { style: { display: "flex", gap: "12px" }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: "10px", color: theme.colors.textMuted, marginBottom: "4px" }, children: "From Side" }), (0, jsx_runtime_1.jsx)("select", { value: ((_a = edge.data) == null ? void 0 : _a.fromSide) || "right", onChange: (e) => {
|
|
47846
|
+
var _a2;
|
|
47847
|
+
if (onUpdateSides) {
|
|
47848
|
+
onUpdateSides(edge.id, e.target.value, ((_a2 = edge.data) == null ? void 0 : _a2.toSide) || "left");
|
|
47849
|
+
}
|
|
47850
|
+
}, disabled: !onUpdateSides, style: {
|
|
47851
|
+
width: "100%",
|
|
47852
|
+
padding: "6px 8px",
|
|
47853
|
+
fontSize: "12px",
|
|
47854
|
+
borderRadius: "4px",
|
|
47855
|
+
border: `1px solid ${theme.colors.border}`,
|
|
47856
|
+
backgroundColor: theme.colors.background,
|
|
47857
|
+
color: theme.colors.text,
|
|
47858
|
+
cursor: onUpdateSides ? "pointer" : "not-allowed",
|
|
47859
|
+
opacity: onUpdateSides ? 1 : 0.6
|
|
47860
|
+
}, children: SIDE_OPTIONS.map((side) => (0, jsx_runtime_1.jsx)("option", { value: side, children: side }, side)) })] }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1 }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: "10px", color: theme.colors.textMuted, marginBottom: "4px" }, children: "To Side" }), (0, jsx_runtime_1.jsx)("select", { value: ((_b = edge.data) == null ? void 0 : _b.toSide) || "left", onChange: (e) => {
|
|
47861
|
+
var _a2;
|
|
47862
|
+
if (onUpdateSides) {
|
|
47863
|
+
onUpdateSides(edge.id, ((_a2 = edge.data) == null ? void 0 : _a2.fromSide) || "right", e.target.value);
|
|
47864
|
+
}
|
|
47865
|
+
}, disabled: !onUpdateSides, style: {
|
|
47866
|
+
width: "100%",
|
|
47867
|
+
padding: "6px 8px",
|
|
47868
|
+
fontSize: "12px",
|
|
47869
|
+
borderRadius: "4px",
|
|
47870
|
+
border: `1px solid ${theme.colors.border}`,
|
|
47871
|
+
backgroundColor: theme.colors.background,
|
|
47872
|
+
color: theme.colors.text,
|
|
47873
|
+
cursor: onUpdateSides ? "pointer" : "not-allowed",
|
|
47874
|
+
opacity: onUpdateSides ? 1 : 0.6
|
|
47875
|
+
}, children: SIDE_OPTIONS.map((side) => (0, jsx_runtime_1.jsx)("option", { value: side, children: side }, side)) })] })] })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
47864
47876
|
fontSize: "10px",
|
|
47865
47877
|
color: theme.colors.textMuted,
|
|
47866
47878
|
marginTop: "12px",
|
|
@@ -48237,6 +48249,16 @@ function requireGraphRenderer() {
|
|
|
48237
48249
|
const onCloseEdgeInfoPanel = (0, react_1.useCallback)(() => {
|
|
48238
48250
|
setSelectedEdgeId(null);
|
|
48239
48251
|
}, []);
|
|
48252
|
+
const handleUpdateEdgeSides = (0, react_1.useCallback)((edgeId, fromSide, toSide) => {
|
|
48253
|
+
setLocalEdges((currentEdges) => currentEdges.map((edge) => edge.id === edgeId ? {
|
|
48254
|
+
...edge,
|
|
48255
|
+
data: {
|
|
48256
|
+
...edge.data,
|
|
48257
|
+
fromSide,
|
|
48258
|
+
toSide
|
|
48259
|
+
}
|
|
48260
|
+
} : edge));
|
|
48261
|
+
}, []);
|
|
48240
48262
|
const onCloseNodeInfoPanel = (0, react_1.useCallback)(() => {
|
|
48241
48263
|
setSelectedNodeId(null);
|
|
48242
48264
|
}, []);
|
|
@@ -48675,11 +48697,11 @@ function requireGraphRenderer() {
|
|
|
48675
48697
|
}, 100);
|
|
48676
48698
|
return () => clearTimeout(timeoutId);
|
|
48677
48699
|
}, [baseNodesKey, fitView]);
|
|
48678
|
-
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.ReactFlow, { nodes: xyflowNodes, edges: xyflowEdges, nodeTypes, edgeTypes, minZoom: 0.1, maxZoom: 4, defaultEdgeOptions: { type: "custom" }, onEdgeClick, onNodeClick, proOptions: { hideAttribution: true }, nodesDraggable: editable, elementsSelectable:
|
|
48700
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_2.ReactFlow, { nodes: xyflowNodes, edges: xyflowEdges, nodeTypes, edgeTypes, minZoom: 0.1, maxZoom: 4, defaultEdgeOptions: { type: "custom" }, onEdgeClick, onNodeClick, proOptions: { hideAttribution: true }, nodesDraggable: editable, elementsSelectable: true, nodesConnectable: editable, edgesReconnectable: editable, reconnectRadius: 100, elevateEdgesOnSelect: true, onNodesChange: handleNodesChange, onConnect: handleConnect, onReconnectStart: handleReconnectStart, onReconnect: handleReconnect, onReconnectEnd: handleReconnectEnd, panOnDrag: true, selectionOnDrag: false, children: [showBackground && (0, jsx_runtime_1.jsx)(react_2.Background, { color: theme.colors.border, gap: 16, size: 1 }), showControls && (0, jsx_runtime_1.jsx)(react_2.Controls, { showZoom: true, showFitView: true, showInteractive: true }), showMinimap && (0, jsx_runtime_1.jsx)(react_2.MiniMap, { nodeColor: (node) => {
|
|
48679
48701
|
var _a;
|
|
48680
48702
|
const nodeData = node.data;
|
|
48681
48703
|
return ((_a = nodeData == null ? void 0 : nodeData.typeDefinition) == null ? void 0 : _a.color) || theme.colors.secondary;
|
|
48682
|
-
}, nodeBorderRadius: 2, pannable: true, zoomable: true })] }, baseNodesKey), selectedEdge && selectedEdgeTypeDefinition && (0, jsx_runtime_1.jsx)(EdgeInfoPanel_1.EdgeInfoPanel, { edge: selectedEdge, typeDefinition: selectedEdgeTypeDefinition, sourceNodeId: selectedEdge.from, targetNodeId: selectedEdge.to, onClose: onCloseEdgeInfoPanel, onDelete: editable ? handleEdgeDelete : void 0 }), selectedNode && selectedNodeTypeDefinition && (0, jsx_runtime_1.jsx)(NodeInfoPanel_1.NodeInfoPanel, { node: selectedNode, typeDefinition: selectedNodeTypeDefinition, availableNodeTypes: configuration.nodeTypes, onClose: onCloseNodeInfoPanel, onDelete: editable ? handleNodeDelete : void 0, onUpdate: editable ? handleNodeUpdate : void 0 }), pendingConnection && (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
48704
|
+
}, nodeBorderRadius: 2, pannable: true, zoomable: true })] }, baseNodesKey), selectedEdge && selectedEdgeTypeDefinition && (0, jsx_runtime_1.jsx)(EdgeInfoPanel_1.EdgeInfoPanel, { edge: selectedEdge, typeDefinition: selectedEdgeTypeDefinition, sourceNodeId: selectedEdge.from, targetNodeId: selectedEdge.to, onClose: onCloseEdgeInfoPanel, onDelete: editable ? handleEdgeDelete : void 0, onUpdateSides: editable ? handleUpdateEdgeSides : void 0 }), selectedNode && selectedNodeTypeDefinition && (0, jsx_runtime_1.jsx)(NodeInfoPanel_1.NodeInfoPanel, { node: selectedNode, typeDefinition: selectedNodeTypeDefinition, availableNodeTypes: configuration.nodeTypes, onClose: onCloseNodeInfoPanel, onDelete: editable ? handleNodeDelete : void 0, onUpdate: editable ? handleNodeUpdate : void 0 }), pendingConnection && (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
48683
48705
|
position: "absolute",
|
|
48684
48706
|
top: "50%",
|
|
48685
48707
|
left: "50%",
|
|
@@ -53345,20 +53367,19 @@ const PrincipalViewGraphPanel = ({
|
|
|
53345
53367
|
throw new Error("Repository path not available");
|
|
53346
53368
|
}
|
|
53347
53369
|
const fullPath = `${repositoryPath}/${selectedConfig.path}`;
|
|
53348
|
-
const
|
|
53349
|
-
if (!
|
|
53370
|
+
const configContent = await readFile(fullPath);
|
|
53371
|
+
if (!configContent || typeof configContent !== "string") {
|
|
53350
53372
|
throw new Error("Failed to read config file");
|
|
53351
53373
|
}
|
|
53352
|
-
const configContent = fileResult.content;
|
|
53353
53374
|
const canvas = ConfigLoader.parseCanvas(configContent);
|
|
53354
53375
|
let library = null;
|
|
53355
53376
|
const libraryPath = ConfigLoader.findLibraryPath(fileTreeData2.allFiles);
|
|
53356
53377
|
if (libraryPath) {
|
|
53357
53378
|
try {
|
|
53358
53379
|
const libraryFullPath = `${repositoryPath}/${libraryPath}`;
|
|
53359
|
-
const
|
|
53360
|
-
if (
|
|
53361
|
-
library = ConfigLoader.parseLibrary(
|
|
53380
|
+
const libraryContent = await readFile(libraryFullPath);
|
|
53381
|
+
if (libraryContent && typeof libraryContent === "string") {
|
|
53382
|
+
library = ConfigLoader.parseLibrary(libraryContent);
|
|
53362
53383
|
}
|
|
53363
53384
|
} catch (libraryError) {
|
|
53364
53385
|
console.warn("[PrincipalView] Failed to load library.yaml:", libraryError);
|
|
@@ -53374,9 +53395,9 @@ const PrincipalViewGraphPanel = ({
|
|
|
53374
53395
|
if (config.id === selectedConfig.id) continue;
|
|
53375
53396
|
try {
|
|
53376
53397
|
const configFullPath = `${repositoryPath}/${config.path}`;
|
|
53377
|
-
const
|
|
53378
|
-
if (
|
|
53379
|
-
const configCanvas = ConfigLoader.parseCanvas(
|
|
53398
|
+
const configContentStr = await readFile(configFullPath);
|
|
53399
|
+
if (configContentStr && typeof configContentStr === "string") {
|
|
53400
|
+
const configCanvas = ConfigLoader.parseCanvas(configContentStr);
|
|
53380
53401
|
setState((prev) => {
|
|
53381
53402
|
var _a3, _b2;
|
|
53382
53403
|
return {
|