@industry-theme/principal-view-panels 0.12.64 → 0.12.65

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.
@@ -62,6 +62,18 @@ export interface CanvasEditorPanelProps extends CanvasEditorPanelPropsTyped {
62
62
  * When provided, displays a close button (X) in the header.
63
63
  */
64
64
  onClosePanel?: () => void;
65
+ /**
66
+ * Path to a .spans.canvas file (relative to repository root).
67
+ * When provided, span colors from this file are used to color event nodes.
68
+ * Span colors become the FILL color for nodes.
69
+ */
70
+ spansCanvasPath?: string | null;
71
+ /**
72
+ * Span pattern to use for coloring event nodes.
73
+ * Should match a spanPattern defined in the spansCanvas.
74
+ * When provided with spansCanvasPath, events are colored with the span's color.
75
+ */
76
+ workflowSpanPattern?: string | null;
65
77
  }
66
78
  /**
67
79
  * Principal View Graph Panel
@@ -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,EA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,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;IAE1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAmkD9D,CAAC"}
@@ -88539,12 +88539,11 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
88539
88539
  }, 150);
88540
88540
  return () => clearTimeout(timeoutId);
88541
88541
  }, [fitViewToNodeIdsKey, fitViewToNodeIds, fitViewPadding, fitView2, fitViewDuration, getNodes, fitBounds]);
88542
- const hasInitialViewport = !!initialViewport;
88543
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) => {
88544
88543
  var _a;
88545
88544
  const nodeData = node2.data;
88546
88545
  return ((_a = nodeData == null ? void 0 : nodeData.typeDefinition) == null ? void 0 : _a.color) || theme2.colors.secondary;
88547
- }, nodeBorderRadius: 2, pannable: true, zoomable: true }), showCenterIndicator && jsx(CenterIndicator, { color: theme2.colors.textMuted }), editable && alignmentGuides.length > 0 && jsx(AlignmentGuidesOverlay, { guides: alignmentGuides, color: theme2.colors.primary })] }, `${baseNodesKey}-${baseEdgesKey}-${hasInitialViewport ? "iv" : "no-iv"}`), pendingConnection && jsxs("div", { style: {
88546
+ }, nodeBorderRadius: 2, pannable: true, zoomable: true }), showCenterIndicator && jsx(CenterIndicator, { color: theme2.colors.textMuted }), editable && alignmentGuides.length > 0 && jsx(AlignmentGuidesOverlay, { guides: alignmentGuides, color: theme2.colors.primary })] }, `${baseNodesKey}-${baseEdgesKey}`), pendingConnection && jsxs("div", { style: {
88548
88547
  position: "absolute",
88549
88548
  top: "50%",
88550
88549
  left: "50%",
@@ -88804,6 +88803,10 @@ const GraphRenderer = forwardRef((props2, ref) => {
88804
88803
  }
88805
88804
  const { configuration, nodes, edges } = canvasData;
88806
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;
88806
+ const isWaitingForViewport = (containerWidth !== void 0 || containerHeight !== void 0) && !initialViewport;
88807
+ if (isWaitingForViewport) {
88808
+ return jsx("div", { ref: containerRef, className, style: { width, height, position: "relative" } });
88809
+ }
88807
88810
  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 }) }) }) });
88808
88811
  });
88809
88812
  GraphRenderer.displayName = "GraphRenderer";
@@ -95116,7 +95119,9 @@ const CanvasEditorPanel = ({
95116
95119
  traceMatchInfo,
95117
95120
  selectedScenarioId: selectedScenarioIdProp,
95118
95121
  selectedTrace,
95119
- onClosePanel
95122
+ onClosePanel,
95123
+ spansCanvasPath,
95124
+ workflowSpanPattern
95120
95125
  }) => {
95121
95126
  var _a, _b, _c, _d;
95122
95127
  const { theme: theme2 } = useTheme();
@@ -95126,6 +95131,7 @@ const CanvasEditorPanel = ({
95126
95131
  const [state, setState] = useState({
95127
95132
  canvas: null,
95128
95133
  library: null,
95134
+ spansCanvas: null,
95129
95135
  loading: true,
95130
95136
  error: null,
95131
95137
  showLegend: false,
@@ -95180,7 +95186,7 @@ const CanvasEditorPanel = ({
95180
95186
  const [currentSearchIndex, setCurrentSearchIndex] = useState(0);
95181
95187
  const loadConfiguration = useCallback(async () => {
95182
95188
  if (!canvasPath) {
95183
- setState((prev) => ({ ...prev, canvas: null, library: null, loading: false, error: null }));
95189
+ setState((prev) => ({ ...prev, canvas: null, library: null, spansCanvas: null, loading: false, error: null }));
95184
95190
  return;
95185
95191
  }
95186
95192
  setState((prev) => ({ ...prev, loading: true, error: null }));
@@ -95220,10 +95226,23 @@ const CanvasEditorPanel = ({
95220
95226
  }
95221
95227
  }
95222
95228
  }
95229
+ let spansCanvas = null;
95230
+ if (spansCanvasPath) {
95231
+ try {
95232
+ const spansFullPath = `${repositoryPath}/${spansCanvasPath}`;
95233
+ const spansContent = await readFile(spansFullPath);
95234
+ if (spansContent && typeof spansContent === "string") {
95235
+ spansCanvas = ConfigLoader.parseCanvas(spansContent);
95236
+ }
95237
+ } catch (spansError) {
95238
+ console.warn("[PrincipalView] Failed to load spans canvas:", spansError);
95239
+ }
95240
+ }
95223
95241
  setState((prev) => ({
95224
95242
  ...prev,
95225
95243
  canvas,
95226
95244
  library,
95245
+ spansCanvas,
95227
95246
  loading: false,
95228
95247
  error: null,
95229
95248
  hasUnsavedChanges: false
@@ -95234,11 +95253,12 @@ const CanvasEditorPanel = ({
95234
95253
  ...prev,
95235
95254
  canvas: null,
95236
95255
  library: null,
95256
+ spansCanvas: null,
95237
95257
  loading: false,
95238
95258
  error: error.message
95239
95259
  }));
95240
95260
  }
95241
- }, [canvasPath]);
95261
+ }, [canvasPath, spansCanvasPath]);
95242
95262
  const toggleLegend = useCallback(() => {
95243
95263
  setState((prev) => ({ ...prev, showLegend: !prev.showLegend }));
95244
95264
  }, []);
@@ -95997,6 +96017,8 @@ const CanvasEditorPanel = ({
95997
96017
  ref: graphRef,
95998
96018
  canvas: state.canvas,
95999
96019
  library: state.library ?? void 0,
96020
+ spansCanvas: state.spansCanvas ?? void 0,
96021
+ workflowSpanPattern: workflowSpanPattern ?? void 0,
96000
96022
  width: "100%",
96001
96023
  height: "100%",
96002
96024
  editable: state.isEditMode,