@industry-theme/principal-view-panels 0.12.2 → 0.12.3

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":"StoryboardListPanel.d.ts","sourceRoot":"","sources":["../../src/panels/StoryboardListPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAqE9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CAy4BvE,CAAC"}
1
+ {"version":3,"file":"StoryboardListPanel.d.ts","sourceRoot":"","sources":["../../src/panels/StoryboardListPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiD,MAAM,OAAO,CAAC;AACtE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAqE9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CA+5BvE,CAAC"}
@@ -88086,6 +88086,90 @@ const GraphRenderer = forwardRef((props2, ref) => {
88086
88086
  return jsx("div", { className, style: { width, height, position: "relative" }, 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, onNodeClick, fitViewToNodeIds, fitViewPadding }) }) });
88087
88087
  });
88088
88088
  GraphRenderer.displayName = "GraphRenderer";
88089
+ const DEFAULT_NODE_WIDTH = 200;
88090
+ const DEFAULT_NODE_HEIGHT = 100;
88091
+ const GROUP_PADDING = 40;
88092
+ function prefixNodeId(canvasId, nodeId) {
88093
+ return `${canvasId}:${nodeId}`;
88094
+ }
88095
+ function calculateCanvasBounds(canvas) {
88096
+ if (!canvas.nodes || canvas.nodes.length === 0) {
88097
+ return { minX: 0, minY: 0, maxX: DEFAULT_NODE_WIDTH, maxY: DEFAULT_NODE_HEIGHT };
88098
+ }
88099
+ let minX = Infinity;
88100
+ let minY = Infinity;
88101
+ let maxX = -Infinity;
88102
+ let maxY = -Infinity;
88103
+ for (const node2 of canvas.nodes) {
88104
+ const x = node2.x ?? 0;
88105
+ const y = node2.y ?? 0;
88106
+ const width = node2.width ?? DEFAULT_NODE_WIDTH;
88107
+ const height = node2.height ?? DEFAULT_NODE_HEIGHT;
88108
+ minX = Math.min(minX, x);
88109
+ minY = Math.min(minY, y);
88110
+ maxX = Math.max(maxX, x + width);
88111
+ maxY = Math.max(maxY, y + height);
88112
+ }
88113
+ return { minX, minY, maxX, maxY };
88114
+ }
88115
+ function mergeCanvases(placements, options = {}) {
88116
+ var _a;
88117
+ const { showGroups = true } = options;
88118
+ const groupNodes = [];
88119
+ const mergedNodes = [];
88120
+ const mergedEdges = [];
88121
+ for (const placement of placements) {
88122
+ const { canvasId, canvas, position: position2, label } = placement;
88123
+ if (showGroups && canvas.nodes && canvas.nodes.length > 0) {
88124
+ const bounds = calculateCanvasBounds(canvas);
88125
+ const groupNode = {
88126
+ id: `${canvasId}:__group__`,
88127
+ type: "group",
88128
+ label: label ?? ((_a = canvas.pv) == null ? void 0 : _a.name) ?? canvasId,
88129
+ x: position2.x + bounds.minX - GROUP_PADDING,
88130
+ y: position2.y + bounds.minY - GROUP_PADDING,
88131
+ width: bounds.maxX - bounds.minX + GROUP_PADDING * 2,
88132
+ height: bounds.maxY - bounds.minY + GROUP_PADDING * 2
88133
+ };
88134
+ groupNodes.push(groupNode);
88135
+ }
88136
+ if (canvas.nodes) {
88137
+ for (const node2 of canvas.nodes) {
88138
+ const mergedNode = {
88139
+ ...node2,
88140
+ id: prefixNodeId(canvasId, node2.id),
88141
+ x: (node2.x ?? 0) + position2.x,
88142
+ y: (node2.y ?? 0) + position2.y
88143
+ };
88144
+ mergedNodes.push(mergedNode);
88145
+ }
88146
+ }
88147
+ if (canvas.edges) {
88148
+ for (const edge of canvas.edges) {
88149
+ const mergedEdge = {
88150
+ ...edge,
88151
+ id: prefixNodeId(canvasId, edge.id),
88152
+ fromNode: prefixNodeId(canvasId, edge.fromNode),
88153
+ toNode: prefixNodeId(canvasId, edge.toNode)
88154
+ };
88155
+ mergedEdges.push(mergedEdge);
88156
+ }
88157
+ }
88158
+ }
88159
+ const mergedCanvas = {
88160
+ nodes: [...groupNodes, ...mergedNodes],
88161
+ edges: mergedEdges,
88162
+ pv: {
88163
+ version: "1.0.0",
88164
+ name: "Multi-Canvas View"
88165
+ }
88166
+ };
88167
+ return mergedCanvas;
88168
+ }
88169
+ forwardRef(function MultiCanvasRenderer({ layout, onLayoutChange: _onLayoutChange, showGroups = true, ...graphRendererProps }, ref) {
88170
+ const mergedCanvas = useMemo(() => mergeCanvases(layout.placements, { showGroups }), [layout.placements, showGroups]);
88171
+ return jsx(GraphRenderer, { ref, canvas: mergedCanvas, editable: false, ...graphRendererProps });
88172
+ });
88089
88173
  /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
88090
88174
  function isNothing(subject) {
88091
88175
  return typeof subject === "undefined" || subject === null;
@@ -98712,18 +98796,36 @@ const StoryboardListPanel = ({
98712
98796
  "button",
98713
98797
  {
98714
98798
  onClick: toggleHelp,
98799
+ draggable: true,
98800
+ onDragStart: (e) => {
98801
+ const cliCommand = storyboards.length > 0 ? "npx @principal-ai/principal-view-cli@latest --help" : "npx @principal-ai/principal-view-cli@latest init";
98802
+ const dragData = {
98803
+ dataType: "cli-command",
98804
+ primaryData: cliCommand,
98805
+ metadata: {
98806
+ description: "Principal View CLI command",
98807
+ action: storyboards.length > 0 ? "help" : "init"
98808
+ },
98809
+ suggestedActions: ["paste", "execute"],
98810
+ sourcePanel: "storyboard-list",
98811
+ dragPreview: cliCommand
98812
+ };
98813
+ e.dataTransfer.setData("application/x-panel-data", JSON.stringify(dragData));
98814
+ e.dataTransfer.setData("text/plain", cliCommand);
98815
+ e.dataTransfer.effectAllowed = "copy";
98816
+ },
98715
98817
  style: {
98716
98818
  background: showHelp ? theme2.colors.primary : theme2.colors.backgroundSecondary,
98717
98819
  border: `1px solid ${theme2.colors.border}`,
98718
98820
  borderRadius: theme2.radii[1],
98719
98821
  padding: "6px",
98720
- cursor: "pointer",
98822
+ cursor: "grab",
98721
98823
  display: "flex",
98722
98824
  alignItems: "center",
98723
98825
  justifyContent: "center",
98724
98826
  transition: "all 0.2s ease"
98725
98827
  },
98726
- title: "Help & Getting Started",
98828
+ title: "Help & Getting Started (drag to copy CLI command)",
98727
98829
  children: /* @__PURE__ */ jsx(
98728
98830
  CircleQuestionMark,
98729
98831
  {