@industry-theme/principal-view-panels 0.12.61 → 0.12.63
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":"CanvasEditorPanel.d.ts","sourceRoot":"","sources":["../../src/panels/CanvasEditorPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAI5D,OAAO,KAAK,EAAyE,gBAAgB,EAA+C,MAAM,mCAAmC,CAAC;AAC9L,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAKxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAiCrE;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,2BAA2B;IACzE;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE3C;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEnC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC,CAAC;IAEH;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC;;;;OAIG;IACH,aAAa,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAEvC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"CanvasEditorPanel.d.ts","sourceRoot":"","sources":["../../src/panels/CanvasEditorPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAI5D,OAAO,KAAK,EAAyE,gBAAgB,EAA+C,MAAM,mCAAmC,CAAC;AAC9L,OAAO,EAAqB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAKxE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAiCrE;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,2BAA2B;IACzE;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE3C;;OAEG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,gBAAgB,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEnC;;;OAGG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC,CAAC;IAEH;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnC;;;;OAIG;IACH,aAAa,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAEvC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA6iD9D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoryGraphRenderer.d.ts","sourceRoot":"","sources":["../../../src/panels/composable-explanation/StoryGraphRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChC,iCAAiC;IACjC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACtC,gDAAgD;IAChD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,sCAAsC;IACtC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,yBAAyB;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACzG,qCAAqC;IACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,+BAA+B;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kDAAkD;IAClD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,mBAAmB;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"StoryGraphRenderer.d.ts","sourceRoot":"","sources":["../../../src/panels/composable-explanation/StoryGraphRenderer.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,iBAAiB,EACvB,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChC,iCAAiC;IACjC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB;IACtC,gDAAgD;IAChD,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACtC,sCAAsC;IACtC,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,yBAAyB;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,sCAAsC;IACtC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACzG,qCAAqC;IACrC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,+BAA+B;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kDAAkD;IAClD,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,mBAAmB;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA2OhE,CAAC;AAEF;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,KAAK,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;CACH,CAAC,EACF,kBAAkB,GAAE,MAAe,GAClC,SAAS,EAAE,CAsDb"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -87346,6 +87346,56 @@ function convertToXYFlowEdges(edges, configuration, violations = []) {
|
|
|
87346
87346
|
};
|
|
87347
87347
|
});
|
|
87348
87348
|
}
|
|
87349
|
+
const DEFAULT_NODE_WIDTH$1 = 200;
|
|
87350
|
+
const DEFAULT_NODE_HEIGHT$1 = 100;
|
|
87351
|
+
function getCanvasBounds(canvas) {
|
|
87352
|
+
if (!canvas.nodes || canvas.nodes.length === 0) {
|
|
87353
|
+
return {
|
|
87354
|
+
minX: 0,
|
|
87355
|
+
minY: 0,
|
|
87356
|
+
maxX: DEFAULT_NODE_WIDTH$1,
|
|
87357
|
+
maxY: DEFAULT_NODE_HEIGHT$1,
|
|
87358
|
+
width: DEFAULT_NODE_WIDTH$1,
|
|
87359
|
+
height: DEFAULT_NODE_HEIGHT$1
|
|
87360
|
+
};
|
|
87361
|
+
}
|
|
87362
|
+
let minX = Infinity;
|
|
87363
|
+
let minY = Infinity;
|
|
87364
|
+
let maxX = -Infinity;
|
|
87365
|
+
let maxY = -Infinity;
|
|
87366
|
+
for (const node2 of canvas.nodes) {
|
|
87367
|
+
const x = node2.x ?? 0;
|
|
87368
|
+
const y = node2.y ?? 0;
|
|
87369
|
+
const width = node2.width ?? DEFAULT_NODE_WIDTH$1;
|
|
87370
|
+
const height = node2.height ?? DEFAULT_NODE_HEIGHT$1;
|
|
87371
|
+
minX = Math.min(minX, x);
|
|
87372
|
+
minY = Math.min(minY, y);
|
|
87373
|
+
maxX = Math.max(maxX, x + width);
|
|
87374
|
+
maxY = Math.max(maxY, y + height);
|
|
87375
|
+
}
|
|
87376
|
+
return {
|
|
87377
|
+
minX,
|
|
87378
|
+
minY,
|
|
87379
|
+
maxX,
|
|
87380
|
+
maxY,
|
|
87381
|
+
width: maxX - minX,
|
|
87382
|
+
height: maxY - minY
|
|
87383
|
+
};
|
|
87384
|
+
}
|
|
87385
|
+
function calculateInitialViewport(bounds, containerWidth, containerHeight, options = {}) {
|
|
87386
|
+
const { padding = 0.2, minZoom = 0.1, maxZoom = 1.5 } = options;
|
|
87387
|
+
const effectiveWidth = containerWidth * (1 - padding);
|
|
87388
|
+
const effectiveHeight = containerHeight * (1 - padding);
|
|
87389
|
+
const zoomX = effectiveWidth / bounds.width;
|
|
87390
|
+
const zoomY = effectiveHeight / bounds.height;
|
|
87391
|
+
let zoom2 = Math.min(zoomX, zoomY);
|
|
87392
|
+
zoom2 = Math.max(minZoom, Math.min(maxZoom, zoom2));
|
|
87393
|
+
const boundsCenterX = bounds.minX + bounds.width / 2;
|
|
87394
|
+
const boundsCenterY = bounds.minY + bounds.height / 2;
|
|
87395
|
+
const x = containerWidth / 2 - boundsCenterX * zoom2;
|
|
87396
|
+
const y = containerHeight / 2 - boundsCenterY * zoom2;
|
|
87397
|
+
return { x, y, zoom: zoom2 };
|
|
87398
|
+
}
|
|
87349
87399
|
const MAX_HISTORY_SIZE = 50;
|
|
87350
87400
|
function useUndoRedo() {
|
|
87351
87401
|
const undoStackRef = useRef([]);
|
|
@@ -87445,7 +87495,7 @@ const CenterIndicator = ({ color: color2 }) => {
|
|
|
87445
87495
|
zIndex: 5
|
|
87446
87496
|
}, children: [jsx("line", { x1: screenX, y1: screenY - size, x2: screenX, y2: screenY + size, stroke: color2, strokeWidth, opacity: 0.7 }), jsx("line", { x1: screenX - size, y1: screenY, x2: screenX + size, y2: screenY, stroke: color2, strokeWidth, opacity: 0.7 }), jsx("circle", { cx: screenX, cy: screenY, r: 3, fill: color2, opacity: 0.7 })] });
|
|
87447
87497
|
};
|
|
87448
|
-
const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges, violations = [], configName: _configName, showMinimap = false, showControls = true, showBackground = true, backgroundVariant = "lines", backgroundGap, showCenterIndicator = false, showTooltips = true, fitViewDuration = 200, highlightedNodeId, activeNodeIds, events = [], onEventProcessed, editable = false, onPendingChangesChange, onEditStateChange, editStateRef, resetVisualStateRef, undoRedoFunctionsRef, pushHistory, clearHistory, undoFromStack, redoFromStack, onNodeClick: onNodeClickProp, fitViewToNodeIds, fitViewPadding = 0.2, draggableNodeIds, onNodeDragStop: onNodeDragStopProp, onCopy }) => {
|
|
87498
|
+
const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges, violations = [], configName: _configName, showMinimap = false, showControls = true, showBackground = true, backgroundVariant = "lines", backgroundGap, showCenterIndicator = false, showTooltips = true, fitViewDuration = 200, highlightedNodeId, activeNodeIds, events = [], onEventProcessed, editable = false, onPendingChangesChange, onEditStateChange, editStateRef, resetVisualStateRef, undoRedoFunctionsRef, pushHistory, clearHistory, undoFromStack, redoFromStack, onNodeClick: onNodeClickProp, fitViewToNodeIds, fitViewPadding = 0.2, draggableNodeIds, onNodeDragStop: onNodeDragStopProp, onCopy, initialViewport }) => {
|
|
87449
87499
|
const { fitView: fitView2, fitBounds, getNodes } = useReactFlow();
|
|
87450
87500
|
const updateNodeInternals2 = useUpdateNodeInternals();
|
|
87451
87501
|
const { theme: theme2 } = useTheme();
|
|
@@ -88441,6 +88491,9 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
|
|
|
88441
88491
|
if (fitViewToNodeIds && fitViewToNodeIds.length > 0) {
|
|
88442
88492
|
return;
|
|
88443
88493
|
}
|
|
88494
|
+
if (initialViewport) {
|
|
88495
|
+
return;
|
|
88496
|
+
}
|
|
88444
88497
|
const timeoutId = setTimeout(() => {
|
|
88445
88498
|
fitView2({
|
|
88446
88499
|
padding: 0.2,
|
|
@@ -88451,7 +88504,7 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
|
|
|
88451
88504
|
});
|
|
88452
88505
|
}, 100);
|
|
88453
88506
|
return () => clearTimeout(timeoutId);
|
|
88454
|
-
}, [baseNodesKey, baseEdgesKey, fitView2, fitViewDuration, fitViewToNodeIds]);
|
|
88507
|
+
}, [baseNodesKey, baseEdgesKey, fitView2, fitViewDuration, fitViewToNodeIds, initialViewport]);
|
|
88455
88508
|
const fitViewToNodeIdsKey = useMemo(() => fitViewToNodeIds && fitViewToNodeIds.length > 0 ? fitViewToNodeIds.slice().sort().join(",") : "", [fitViewToNodeIds]);
|
|
88456
88509
|
useEffect(() => {
|
|
88457
88510
|
if (!fitViewToNodeIdsKey || !fitViewToNodeIds || fitViewToNodeIds.length === 0) {
|
|
@@ -88486,7 +88539,7 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
|
|
|
88486
88539
|
}, 150);
|
|
88487
88540
|
return () => clearTimeout(timeoutId);
|
|
88488
88541
|
}, [fitViewToNodeIdsKey, fitViewToNodeIds, fitViewPadding, fitView2, fitViewDuration, getNodes, fitBounds]);
|
|
88489
|
-
return jsxs(GraphEditProvider, { value: graphEditContextValue, children: [jsxs(index$2, { nodes: xyflowNodes, edges: xyflowEdges, nodeTypes, edgeTypes, minZoom: 0.1, maxZoom: 4, defaultEdgeOptions: { type: "custom" }, onEdgeClick, onNodeClick, onNodeDoubleClick, onNodeDrag: handleNodeDrag, onNodeDragStop: handleNodeDragStop, proOptions: { hideAttribution: true }, nodesDraggable: editable || draggableNodeIds && draggableNodeIds.size > 0, elementsSelectable: editable, selectNodesOnDrag: false, nodesConnectable: editable, edgesReconnectable: editable, reconnectRadius: 25, elevateEdgesOnSelect: true, onNodesChange: handleNodesChange, onEdgesChange: handleEdgesChange, onConnect: handleConnect, onReconnectStart: handleReconnectStart, onReconnect: handleReconnect, onReconnectEnd: handleReconnectEnd, onPaneClick, onSelectionChange: handleSelectionChange, panOnDrag: !editable, panOnScroll: true, zoomOnScroll: false, zoomOnPinch: true, zoomOnDoubleClick: false, selectionOnDrag: false, selectionKeyCode: null, multiSelectionKeyCode: "Shift", children: [showBackground && jsx(Background, { color: backgroundVariant === "dots" ? theme2.colors.border : theme2.colors.textMuted, gap: backgroundGap ?? (backgroundVariant === "dots" ? 16 : 50), size: backgroundVariant === "dots" ? 1 : 0.5, variant: backgroundVariant === "dots" ? BackgroundVariant.Dots : backgroundVariant === "lines" ? BackgroundVariant.Lines : BackgroundVariant.Cross }), showControls && jsx(Controls, { showZoom: true, showFitView: true, showInteractive: true }), showMinimap && jsx(MiniMap, { nodeColor: (node2) => {
|
|
88542
|
+
return jsxs(GraphEditProvider, { value: graphEditContextValue, children: [jsxs(index$2, { nodes: xyflowNodes, edges: xyflowEdges, nodeTypes, edgeTypes, minZoom: 0.1, maxZoom: 4, defaultViewport: initialViewport, defaultEdgeOptions: { type: "custom" }, onEdgeClick, onNodeClick, onNodeDoubleClick, onNodeDrag: handleNodeDrag, onNodeDragStop: handleNodeDragStop, proOptions: { hideAttribution: true }, nodesDraggable: editable || draggableNodeIds && draggableNodeIds.size > 0, elementsSelectable: editable, selectNodesOnDrag: false, nodesConnectable: editable, edgesReconnectable: editable, reconnectRadius: 25, elevateEdgesOnSelect: true, onNodesChange: handleNodesChange, onEdgesChange: handleEdgesChange, onConnect: handleConnect, onReconnectStart: handleReconnectStart, onReconnect: handleReconnect, onReconnectEnd: handleReconnectEnd, onPaneClick, onSelectionChange: handleSelectionChange, panOnDrag: !editable, panOnScroll: true, zoomOnScroll: false, zoomOnPinch: true, zoomOnDoubleClick: false, selectionOnDrag: false, selectionKeyCode: null, multiSelectionKeyCode: "Shift", children: [showBackground && jsx(Background, { color: backgroundVariant === "dots" ? theme2.colors.border : theme2.colors.textMuted, gap: backgroundGap ?? (backgroundVariant === "dots" ? 16 : 50), size: backgroundVariant === "dots" ? 1 : 0.5, variant: backgroundVariant === "dots" ? BackgroundVariant.Dots : backgroundVariant === "lines" ? BackgroundVariant.Lines : BackgroundVariant.Cross }), showControls && jsx(Controls, { showZoom: true, showFitView: true, showInteractive: true }), showMinimap && jsx(MiniMap, { nodeColor: (node2) => {
|
|
88490
88543
|
var _a;
|
|
88491
88544
|
const nodeData = node2.data;
|
|
88492
88545
|
return ((_a = nodeData == null ? void 0 : nodeData.typeDefinition) == null ? void 0 : _a.color) || theme2.colors.secondary;
|
|
@@ -88665,7 +88718,7 @@ function useCanvasToLegacy(canvas, library, spansCanvas, workflowSpanPattern) {
|
|
|
88665
88718
|
}, [canvas, library, spansCanvas, workflowSpanPattern]);
|
|
88666
88719
|
}
|
|
88667
88720
|
const GraphRenderer = forwardRef((props2, ref) => {
|
|
88668
|
-
const { canvas, library, spansCanvas, workflowSpanPattern, className, width = "100%", height = "100%" } = props2;
|
|
88721
|
+
const { canvas, library, spansCanvas, workflowSpanPattern, className, width = "100%", height = "100%", containerWidth, containerHeight } = props2;
|
|
88669
88722
|
const { theme: theme2 } = useTheme();
|
|
88670
88723
|
const containerRef = useRef(null);
|
|
88671
88724
|
const [portalTarget, setPortalTarget] = useState(null);
|
|
@@ -88673,6 +88726,17 @@ const GraphRenderer = forwardRef((props2, ref) => {
|
|
|
88673
88726
|
setPortalTarget(containerRef.current);
|
|
88674
88727
|
}, []);
|
|
88675
88728
|
const canvasData = useCanvasToLegacy(canvas, library, spansCanvas, workflowSpanPattern);
|
|
88729
|
+
const initialViewport = useMemo(() => {
|
|
88730
|
+
if (!containerWidth || !containerHeight || !canvas) {
|
|
88731
|
+
return void 0;
|
|
88732
|
+
}
|
|
88733
|
+
const bounds = getCanvasBounds(canvas);
|
|
88734
|
+
return calculateInitialViewport(bounds, containerWidth, containerHeight, {
|
|
88735
|
+
padding: 0.2,
|
|
88736
|
+
minZoom: 0.1,
|
|
88737
|
+
maxZoom: 1.5
|
|
88738
|
+
});
|
|
88739
|
+
}, [canvas, containerWidth, containerHeight]);
|
|
88676
88740
|
const editStateRef = useRef(createEmptyEditState());
|
|
88677
88741
|
const resetVisualStateRef = useRef(null);
|
|
88678
88742
|
const { canUndo: canUndoState, canRedo: canRedoState, undo: undoFromStack, redo: redoFromStack, pushHistory, clearHistory } = useUndoRedo();
|
|
@@ -88739,7 +88803,7 @@ const GraphRenderer = forwardRef((props2, ref) => {
|
|
|
88739
88803
|
}
|
|
88740
88804
|
const { configuration, nodes, edges } = canvasData;
|
|
88741
88805
|
const { violations, configName, showMinimap, showControls, showBackground, backgroundVariant, backgroundGap, showCenterIndicator, showTooltips, fitViewDuration, highlightedNodeId, activeNodeIds, events, onEventProcessed, editable, onPendingChangesChange, onNodeClick, fitViewToNodeIds, fitViewPadding, draggableNodeIds, onNodeDragStop, onCopy } = props2;
|
|
88742
|
-
return jsx("div", { ref: containerRef, className, style: { width, height, position: "relative" }, children: jsx(TooltipPortalContext.Provider, { value: portalTarget, children: jsx(ReactFlowProvider, { children: jsx(GraphRendererInner, { configuration, nodes, edges, violations, configName, showMinimap, showControls, showBackground, backgroundVariant, backgroundGap, showCenterIndicator, showTooltips, fitViewDuration, highlightedNodeId, activeNodeIds, events, onEventProcessed, editable, onPendingChangesChange, editStateRef, resetVisualStateRef, undoRedoFunctionsRef, pushHistory, clearHistory, undoFromStack, redoFromStack, onNodeClick, fitViewToNodeIds, fitViewPadding, draggableNodeIds, onNodeDragStop, onCopy }) }) }) });
|
|
88806
|
+
return jsx("div", { ref: containerRef, className, style: { width, height, position: "relative" }, children: jsx(TooltipPortalContext.Provider, { value: portalTarget, children: jsx(ReactFlowProvider, { children: jsx(GraphRendererInner, { configuration, nodes, edges, violations, configName, showMinimap, showControls, showBackground, backgroundVariant, backgroundGap, showCenterIndicator, showTooltips, fitViewDuration, highlightedNodeId, activeNodeIds, events, onEventProcessed, editable, onPendingChangesChange, editStateRef, resetVisualStateRef, undoRedoFunctionsRef, pushHistory, clearHistory, undoFromStack, redoFromStack, onNodeClick, fitViewToNodeIds, fitViewPadding, draggableNodeIds, onNodeDragStop, onCopy, initialViewport }) }) }) });
|
|
88743
88807
|
});
|
|
88744
88808
|
GraphRenderer.displayName = "GraphRenderer";
|
|
88745
88809
|
const DEFAULT_NODE_WIDTH = 200;
|
|
@@ -95056,6 +95120,8 @@ const CanvasEditorPanel = ({
|
|
|
95056
95120
|
var _a, _b, _c, _d;
|
|
95057
95121
|
const { theme: theme2 } = useTheme();
|
|
95058
95122
|
const graphRef = useRef(null);
|
|
95123
|
+
const canvasContainerRef = useRef(null);
|
|
95124
|
+
const [containerDimensions, setContainerDimensions] = useState(null);
|
|
95059
95125
|
const [state, setState] = useState({
|
|
95060
95126
|
canvas: null,
|
|
95061
95127
|
library: null,
|
|
@@ -95078,6 +95144,18 @@ const CanvasEditorPanel = ({
|
|
|
95078
95144
|
isSearchOpen: false,
|
|
95079
95145
|
searchQuery: ""
|
|
95080
95146
|
});
|
|
95147
|
+
useEffect(() => {
|
|
95148
|
+
const container = canvasContainerRef.current;
|
|
95149
|
+
if (!container) return;
|
|
95150
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
95151
|
+
const { width, height } = entry.contentRect;
|
|
95152
|
+
if (width > 0 && height > 0) {
|
|
95153
|
+
setContainerDimensions({ width, height });
|
|
95154
|
+
}
|
|
95155
|
+
});
|
|
95156
|
+
observer.observe(container);
|
|
95157
|
+
return () => observer.disconnect();
|
|
95158
|
+
}, [state.loading]);
|
|
95081
95159
|
const [shouldFitToNodes, setShouldFitToNodes] = useState(false);
|
|
95082
95160
|
const [fitCounter, setFitCounter] = useState(0);
|
|
95083
95161
|
const [isCarouselExpanded, setIsCarouselExpanded] = useState(false);
|
|
@@ -95911,7 +95989,7 @@ const CanvasEditorPanel = ({
|
|
|
95911
95989
|
}
|
|
95912
95990
|
) }) : /* @__PURE__ */ jsx("div", {}),
|
|
95913
95991
|
rightPanel: /* @__PURE__ */ jsxs("div", { style: { height: "100%", display: "flex", flexDirection: "column", background: theme2.colors.background, position: "relative" }, children: [
|
|
95914
|
-
/* @__PURE__ */ jsxs("div", { style: { flex: 1, position: "relative", minHeight: 0, width: "100%", height: "100%" }, children: [
|
|
95992
|
+
/* @__PURE__ */ jsxs("div", { ref: canvasContainerRef, style: { flex: 1, position: "relative", minHeight: 0, width: "100%", height: "100%" }, children: [
|
|
95915
95993
|
/* @__PURE__ */ jsx(
|
|
95916
95994
|
GraphRenderer,
|
|
95917
95995
|
{
|
|
@@ -95931,7 +96009,9 @@ const CanvasEditorPanel = ({
|
|
|
95931
96009
|
highlightedNodeId: state.highlightedNodeId,
|
|
95932
96010
|
activeNodeIds,
|
|
95933
96011
|
fitViewToNodeIds,
|
|
95934
|
-
fitViewPadding: 0.15
|
|
96012
|
+
fitViewPadding: 0.15,
|
|
96013
|
+
containerWidth: containerDimensions == null ? void 0 : containerDimensions.width,
|
|
96014
|
+
containerHeight: containerDimensions == null ? void 0 : containerDimensions.height
|
|
95935
96015
|
}
|
|
95936
96016
|
),
|
|
95937
96017
|
state.isEditMode && state.hasUnsavedChanges && /* @__PURE__ */ jsxs("div", { style: {
|