@industry-theme/principal-view-panels 0.1.26 → 0.1.28

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.
@@ -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;AAsD/E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA6rCjE,CAAC"}
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;AAsD/E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4sCjE,CAAC"}
@@ -48010,7 +48010,7 @@ function requireNodeInfoPanel() {
48010
48010
  "GitMerge",
48011
48011
  "GitPullRequest"
48012
48012
  ];
48013
- const NodeInfoPanel$1 = ({ node, typeDefinition, availableNodeTypes, onClose, onDelete, onUpdate }) => {
48013
+ const NodeInfoPanel$1 = ({ node, typeDefinition, availableNodeTypes, onClose, onDelete, onUpdate, onSourceClick }) => {
48014
48014
  var _a, _b, _c, _d, _e2, _f, _g, _h, _i;
48015
48015
  const { theme } = (0, industry_theme_1.useTheme)();
48016
48016
  const nodeColor = ((_a = node.data) == null ? void 0 : _a.color) || (typeDefinition == null ? void 0 : typeDefinition.color) || theme.colors.primary;
@@ -48093,7 +48093,22 @@ function requireNodeInfoPanel() {
48093
48093
  display: "flex",
48094
48094
  alignItems: "center",
48095
48095
  justifyContent: "center"
48096
- }, children: "×" })] }), ((_e2 = node.data) == null ? void 0 : _e2.description) && (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "12px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: "10px", color: theme.colors.textSecondary, marginBottom: "4px" }, children: "Description" }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: "12px" }, children: String(node.data.description) })] }), sources.length > 0 && (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "12px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: "10px", color: theme.colors.textSecondary, marginBottom: "4px" }, children: "Sources" }), (0, jsx_runtime_1.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: sources.map((source, index2) => (0, jsx_runtime_1.jsx)("span", { style: {
48096
+ }, children: "×" })] }), ((_e2 = node.data) == null ? void 0 : _e2.description) && (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "12px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: "10px", color: theme.colors.textSecondary, marginBottom: "4px" }, children: "Description" }), (0, jsx_runtime_1.jsx)("div", { style: { fontSize: "12px" }, children: String(node.data.description) })] }), sources.length > 0 && (0, jsx_runtime_1.jsxs)("div", { style: { marginBottom: "12px" }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: "10px", color: theme.colors.textSecondary, marginBottom: "4px" }, children: "Sources" }), (0, jsx_runtime_1.jsx)("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: sources.map((source, index2) => onSourceClick ? (0, jsx_runtime_1.jsx)("button", { onClick: () => onSourceClick(node.id, source), style: {
48097
+ fontSize: "11px",
48098
+ padding: "2px 8px",
48099
+ backgroundColor: theme.colors.muted,
48100
+ borderRadius: "4px",
48101
+ color: theme.colors.textSecondary,
48102
+ border: "none",
48103
+ cursor: "pointer",
48104
+ transition: "background-color 0.15s, color 0.15s"
48105
+ }, onMouseEnter: (e) => {
48106
+ e.currentTarget.style.backgroundColor = theme.colors.primary;
48107
+ e.currentTarget.style.color = theme.colors.background;
48108
+ }, onMouseLeave: (e) => {
48109
+ e.currentTarget.style.backgroundColor = theme.colors.muted;
48110
+ e.currentTarget.style.color = theme.colors.textSecondary;
48111
+ }, children: source }, index2) : (0, jsx_runtime_1.jsx)("span", { style: {
48097
48112
  fontSize: "11px",
48098
48113
  padding: "2px 8px",
48099
48114
  backgroundColor: theme.colors.muted,
@@ -48431,7 +48446,7 @@ function requireGraphRenderer() {
48431
48446
  createdEdges: [],
48432
48447
  deletedEdges: []
48433
48448
  });
48434
- const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges, violations = [], configName: _configName, showMinimap = true, showControls = true, showBackground = true, events = [], onEventProcessed, editable = false, autoUpdateEdgeSides = false, onPendingChangesChange, onEditStateChange, editStateRef }) => {
48449
+ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges, violations = [], configName: _configName, showMinimap = true, showControls = true, showBackground = true, events = [], onEventProcessed, editable = false, autoUpdateEdgeSides = false, onPendingChangesChange, onEditStateChange, editStateRef, onSourceClick }) => {
48435
48450
  const { fitView } = (0, react_2.useReactFlow)();
48436
48451
  const { theme } = (0, industry_theme_1.useTheme)();
48437
48452
  const [animationState, setAnimationState] = (0, react_1.useState)({
@@ -49004,7 +49019,7 @@ function requireGraphRenderer() {
49004
49019
  var _a;
49005
49020
  const nodeData = node.data;
49006
49021
  return ((_a = nodeData == null ? void 0 : nodeData.typeDefinition) == null ? void 0 : _a.color) || theme.colors.secondary;
49007
- }, nodeBorderRadius: 2, pannable: true, zoomable: true })] }, baseNodesKey), selectedNodeIds.size >= 2 && (0, jsx_runtime_1.jsx)(SelectionSidebar_1.SelectionSidebar, { selectedNodeIds, nodes, nodeTypeDefinitions: configuration.nodeTypes, onClose: onCloseNodeInfoPanel }), selectedEdgeIds.size === 1 && 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 }), selectedNodeIds.size === 1 && 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: {
49022
+ }, nodeBorderRadius: 2, pannable: true, zoomable: true })] }, baseNodesKey), selectedNodeIds.size >= 2 && (0, jsx_runtime_1.jsx)(SelectionSidebar_1.SelectionSidebar, { selectedNodeIds, nodes, nodeTypeDefinitions: configuration.nodeTypes, onClose: onCloseNodeInfoPanel }), selectedEdgeIds.size === 1 && 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 }), selectedNodeIds.size === 1 && 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, onSourceClick }), pendingConnection && (0, jsx_runtime_1.jsxs)("div", { style: {
49008
49023
  position: "absolute",
49009
49024
  top: "50%",
49010
49025
  left: "50%",
@@ -49217,8 +49232,8 @@ function requireGraphRenderer() {
49217
49232
  }, children: (0, jsx_runtime_1.jsx)("p", { children: "No canvas data provided." }) });
49218
49233
  }
49219
49234
  const { configuration, nodes, edges } = canvasData;
49220
- const { violations, configName, showMinimap, showControls, showBackground, events, onEventProcessed, editable, autoUpdateEdgeSides, onPendingChangesChange } = props;
49221
- return (0, jsx_runtime_1.jsx)("div", { className, style: { width, height, position: "relative" }, children: (0, jsx_runtime_1.jsx)(react_2.ReactFlowProvider, { children: (0, jsx_runtime_1.jsx)(GraphRendererInner, { configuration, nodes, edges, violations, configName, showMinimap, showControls, showBackground, events, onEventProcessed, editable, autoUpdateEdgeSides, onPendingChangesChange, editStateRef }) }) });
49235
+ const { violations, configName, showMinimap, showControls, showBackground, events, onEventProcessed, editable, autoUpdateEdgeSides, onPendingChangesChange, onSourceClick } = props;
49236
+ return (0, jsx_runtime_1.jsx)("div", { className, style: { width, height, position: "relative" }, children: (0, jsx_runtime_1.jsx)(react_2.ReactFlowProvider, { children: (0, jsx_runtime_1.jsx)(GraphRendererInner, { configuration, nodes, edges, violations, configName, showMinimap, showControls, showBackground, events, onEventProcessed, editable, autoUpdateEdgeSides, onPendingChangesChange, editStateRef, onSourceClick }) }) });
49222
49237
  });
49223
49238
  exports$1.GraphRenderer.displayName = "GraphRenderer";
49224
49239
  })(GraphRenderer);
@@ -53759,6 +53774,18 @@ const PrincipalViewGraphPanel = ({
53759
53774
  const handlePendingChangesChange = useCallback((hasChanges) => {
53760
53775
  setState((prev) => ({ ...prev, hasUnsavedChanges: hasChanges }));
53761
53776
  }, []);
53777
+ const handleSourceClick = useCallback((nodeId, source) => {
53778
+ eventsRef.current.emit({
53779
+ type: "custom",
53780
+ source: "principal-view-graph",
53781
+ timestamp: Date.now(),
53782
+ payload: {
53783
+ action: "sourceClick",
53784
+ nodeId,
53785
+ source
53786
+ }
53787
+ });
53788
+ }, []);
53762
53789
  const toggleCanvasSelector = useCallback(() => {
53763
53790
  setState((prev) => ({ ...prev, showCanvasSelector: !prev.showCanvasSelector }));
53764
53791
  }, []);
@@ -54279,7 +54306,8 @@ const PrincipalViewGraphPanel = ({
54279
54306
  showBackground: true,
54280
54307
  editable: state.isEditMode,
54281
54308
  autoUpdateEdgeSides: state.layoutConfig.autoUpdateEdgeSides,
54282
- onPendingChangesChange: handlePendingChangesChange
54309
+ onPendingChangesChange: handlePendingChangesChange,
54310
+ onSourceClick: handleSourceClick
54283
54311
  },
54284
54312
  `graph-${state.layoutVersion}`
54285
54313
  ) }),