@industry-theme/principal-view-panels 0.12.55 → 0.12.56

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;I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7 +14,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
14
14
  import * as React from "react";
15
15
  import React__default, { createContext, useContext, useState, useCallback, useMemo, memo, forwardRef, useRef, useEffect, useLayoutEffect, createElement, useImperativeHandle } from "react";
16
16
  import { createPortal } from "react-dom";
17
- import { CanvasConverter, buildScopeColorMap, DRAFT_NODE_COLOR, renderEventTemplate, CanvasDiscovery, ExecutionValidator, renderWorkflow, LibraryDiscovery, getSpanDuration } from "@principal-ai/principal-view-core";
17
+ import { CanvasConverter, buildScopeColorMap, buildSpanColorMap, resolveEventSpanColor, DEFAULT_SPAN_COLOR, DRAFT_NODE_COLOR, renderEventTemplate, CanvasDiscovery, ExecutionValidator, renderWorkflow, LibraryDiscovery, getSpanDuration } from "@principal-ai/principal-view-core";
18
18
  import { StoryboardWorkflowsTreeCore, CanvasListTreeCore, hasWorkflowContent } from "@principal-ade/dynamic-file-tree";
19
19
  import { trace, context, SpanStatusCode } from "@opentelemetry/api";
20
20
  import { SpanStatusCode as SpanStatusCode2 } from "@opentelemetry/api";
@@ -86701,12 +86701,13 @@ const CustomNode = ({ data, selected: selected2, dragging }) => {
86701
86701
  }
86702
86702
  const nodeDataColor = nodeData.color;
86703
86703
  const scopeColor = nodeData.scopeColor;
86704
- const baseColor = scopeColor || nodeDataColor || typeDefinition.color || "#888";
86704
+ const spanColor = nodeData.spanColor;
86705
86705
  const nodeDataStates = nodeData.states;
86706
86706
  const stateColor = state && (((_a = nodeDataStates == null ? void 0 : nodeDataStates[state]) == null ? void 0 : _a.color) || ((_c = (_b = typeDefinition.states) == null ? void 0 : _b[state]) == null ? void 0 : _c.color));
86707
- const fillColor = stateColor || baseColor;
86707
+ const baseFillColor = spanColor || nodeDataColor || typeDefinition.color || "#888";
86708
+ const fillColor = stateColor || baseFillColor;
86708
86709
  const nodeDataStroke = nodeData.stroke;
86709
- const baseStrokeColor = nodeDataStroke || typeDefinition.stroke || fillColor;
86710
+ const baseStrokeColor = nodeDataStroke || scopeColor || fillColor;
86710
86711
  const status = nodeData == null ? void 0 : nodeData.status;
86711
86712
  const strokeColor = baseStrokeColor;
86712
86713
  const color2 = fillColor;
@@ -88505,28 +88506,29 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
88505
88506
  fontSize: "12px"
88506
88507
  }, children: "Cancel" })] })] });
88507
88508
  };
88508
- function useCanvasToLegacy(canvas, library) {
88509
+ function useCanvasToLegacy(canvas, library, spansCanvas, workflowSpanPattern) {
88509
88510
  return useMemo(() => {
88510
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l, _m;
88511
+ var _a, _b, _c, _d, _e2, _f, _g, _h, _i, _j, _k, _l;
88511
88512
  if (!canvas)
88512
88513
  return null;
88513
88514
  const { nodes, edges } = CanvasConverter.canvasToGraph(canvas);
88514
88515
  const scopeColorMap = buildScopeColorMap(library == null ? void 0 : library.resources);
88516
+ const spanColorMap = buildSpanColorMap(spansCanvas);
88517
+ const spanColor = resolveEventSpanColor(workflowSpanPattern, spanColorMap);
88515
88518
  for (const node2 of nodes) {
88516
88519
  const otel = (_a = node2.data) == null ? void 0 : _a.otel;
88517
88520
  const scope = otel == null ? void 0 : otel.scope;
88518
- const status = (_b = node2.data) == null ? void 0 : _b.status;
88521
+ let nodeScopeColor;
88519
88522
  if (scope && scopeColorMap[scope]) {
88520
- node2.data = {
88521
- ...node2.data,
88522
- scopeColor: scopeColorMap[scope]
88523
- };
88524
- } else if (status === "draft" || !scope) {
88525
- node2.data = {
88526
- ...node2.data,
88527
- scopeColor: DRAFT_NODE_COLOR
88528
- };
88523
+ nodeScopeColor = scopeColorMap[scope];
88524
+ } else {
88525
+ nodeScopeColor = DRAFT_NODE_COLOR;
88529
88526
  }
88527
+ node2.data = {
88528
+ ...node2.data,
88529
+ scopeColor: nodeScopeColor,
88530
+ spanColor: workflowSpanPattern ? spanColor : DEFAULT_SPAN_COLOR
88531
+ };
88530
88532
  }
88531
88533
  const nodeTypes2 = {};
88532
88534
  const edgeTypes2 = {};
@@ -88555,7 +88557,7 @@ function useCanvasToLegacy(canvas, library) {
88555
88557
  };
88556
88558
  }
88557
88559
  }
88558
- if ((_c = canvas.pv) == null ? void 0 : _c.nodeTypes) {
88560
+ if ((_b = canvas.pv) == null ? void 0 : _b.nodeTypes) {
88559
88561
  for (const [id2, def] of Object.entries(canvas.pv.nodeTypes)) {
88560
88562
  nodeTypes2[id2] = {
88561
88563
  description: def.description,
@@ -88570,7 +88572,7 @@ function useCanvasToLegacy(canvas, library) {
88570
88572
  const vv = node2.pv;
88571
88573
  const nodeType = (vv == null ? void 0 : vv.nodeType) || node2.type;
88572
88574
  if (!nodeTypes2[nodeType]) {
88573
- const fillColor = (vv == null ? void 0 : vv.fill) || (typeof node2.color === "string" ? node2.color : void 0) || ((_e2 = (_d = vv == null ? void 0 : vv.states) == null ? void 0 : _d.idle) == null ? void 0 : _e2.color);
88575
+ const fillColor = (vv == null ? void 0 : vv.fill) || (typeof node2.color === "string" ? node2.color : void 0) || ((_d = (_c = vv == null ? void 0 : vv.states) == null ? void 0 : _c.idle) == null ? void 0 : _d.color);
88574
88576
  let nodeDescription = `${nodeType} node`;
88575
88577
  if (node2.type === "text" && "text" in node2) {
88576
88578
  const lines = node2.text.split("\n");
@@ -88592,7 +88594,7 @@ function useCanvasToLegacy(canvas, library) {
88592
88594
  };
88593
88595
  }
88594
88596
  }
88595
- if ((_f = canvas.pv) == null ? void 0 : _f.edgeTypes) {
88597
+ if ((_e2 = canvas.pv) == null ? void 0 : _e2.edgeTypes) {
88596
88598
  for (const [id2, def] of Object.entries(canvas.pv.edgeTypes)) {
88597
88599
  edgeTypes2[id2] = {
88598
88600
  style: def.style || "solid",
@@ -88606,12 +88608,12 @@ function useCanvasToLegacy(canvas, library) {
88606
88608
  }
88607
88609
  const allowedConnections = [];
88608
88610
  for (const edge of canvas.edges || []) {
88609
- const edgeType = ((_g = edge.pv) == null ? void 0 : _g.edgeType) || "default";
88611
+ const edgeType = ((_f = edge.pv) == null ? void 0 : _f.edgeType) || "default";
88610
88612
  if (!edgeTypes2[edgeType]) {
88611
88613
  edgeTypes2[edgeType] = {
88612
- style: ((_h = edge.pv) == null ? void 0 : _h.style) || "solid",
88614
+ style: ((_g = edge.pv) == null ? void 0 : _g.style) || "solid",
88613
88615
  color: typeof edge.color === "string" ? edge.color : void 0,
88614
- width: (_i = edge.pv) == null ? void 0 : _i.width,
88616
+ width: (_h = edge.pv) == null ? void 0 : _h.width,
88615
88617
  directed: true
88616
88618
  };
88617
88619
  }
@@ -88621,16 +88623,16 @@ function useCanvasToLegacy(canvas, library) {
88621
88623
  via: edgeType
88622
88624
  });
88623
88625
  }
88624
- const display = ((_j = canvas.pv) == null ? void 0 : _j.display) ? {
88626
+ const display = ((_i = canvas.pv) == null ? void 0 : _i.display) ? {
88625
88627
  layout: canvas.pv.display.layout || "manual",
88626
88628
  theme: canvas.pv.display.theme,
88627
88629
  animations: canvas.pv.display.animations
88628
88630
  } : { layout: "manual" };
88629
88631
  const configuration = {
88630
88632
  metadata: {
88631
- name: ((_k = canvas.pv) == null ? void 0 : _k.name) || "Untitled",
88632
- version: ((_l = canvas.pv) == null ? void 0 : _l.version) || "1.0.0",
88633
- description: (_m = canvas.pv) == null ? void 0 : _m.description
88633
+ name: ((_j = canvas.pv) == null ? void 0 : _j.name) || "Untitled",
88634
+ version: ((_k = canvas.pv) == null ? void 0 : _k.version) || "1.0.0",
88635
+ description: (_l = canvas.pv) == null ? void 0 : _l.description
88634
88636
  },
88635
88637
  nodeTypes: nodeTypes2,
88636
88638
  edgeTypes: edgeTypes2,
@@ -88638,17 +88640,17 @@ function useCanvasToLegacy(canvas, library) {
88638
88640
  display
88639
88641
  };
88640
88642
  return { configuration, nodes, edges };
88641
- }, [canvas, library]);
88643
+ }, [canvas, library, spansCanvas, workflowSpanPattern]);
88642
88644
  }
88643
88645
  const GraphRenderer = forwardRef((props2, ref) => {
88644
- const { canvas, library, className, width = "100%", height = "100%" } = props2;
88646
+ const { canvas, library, spansCanvas, workflowSpanPattern, className, width = "100%", height = "100%" } = props2;
88645
88647
  const { theme: theme2 } = useTheme();
88646
88648
  const containerRef = useRef(null);
88647
88649
  const [portalTarget, setPortalTarget] = useState(null);
88648
88650
  useEffect(() => {
88649
88651
  setPortalTarget(containerRef.current);
88650
88652
  }, []);
88651
- const canvasData = useCanvasToLegacy(canvas, library);
88653
+ const canvasData = useCanvasToLegacy(canvas, library, spansCanvas, workflowSpanPattern);
88652
88654
  const editStateRef = useRef(createEmptyEditState());
88653
88655
  const resetVisualStateRef = useRef(null);
88654
88656
  const { canUndo: canUndoState, canRedo: canRedoState, undo: undoFromStack, redo: redoFromStack, pushHistory, clearHistory } = useUndoRedo();
@@ -95383,7 +95385,7 @@ const CanvasEditorPanel = ({
95383
95385
  setIsCarouselExpanded(false);
95384
95386
  }, []);
95385
95387
  const saveAllChanges = useCallback(async () => {
95386
- var _a2;
95388
+ var _a2, _b2;
95387
95389
  if (!state.canvas || !canvasPath) return;
95388
95390
  const pendingChanges = (_a2 = graphRef.current) == null ? void 0 : _a2.getPendingChanges();
95389
95391
  const hasGraphChanges = (pendingChanges == null ? void 0 : pendingChanges.hasChanges) ?? false;
@@ -95410,6 +95412,7 @@ const CanvasEditorPanel = ({
95410
95412
  isSaving: false,
95411
95413
  hasUnsavedChanges: false
95412
95414
  }));
95415
+ (_b2 = graphRef.current) == null ? void 0 : _b2.resetEditState();
95413
95416
  } catch (error) {
95414
95417
  console.error("[PrincipalView] Error saving changes:", error);
95415
95418
  setState((prev) => ({