@industry-theme/principal-view-panels 0.12.13 → 0.12.15
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.
- package/dist/panels/CanvasEditorPanel.d.ts +5 -0
- package/dist/panels/CanvasEditorPanel.d.ts.map +1 -1
- package/dist/panels/StoryboardListPanel.d.ts.map +1 -1
- package/dist/panels.bundle.js +102 -18
- package/dist/panels.bundle.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -45,6 +45,11 @@ export interface CanvasEditorPanelProps extends CanvasEditorPanelPropsTyped {
|
|
|
45
45
|
matchType: 'full' | 'partial';
|
|
46
46
|
coveragePercent?: number;
|
|
47
47
|
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Optional callback to close the panel.
|
|
50
|
+
* When provided, displays a close button (X) in the header.
|
|
51
|
+
*/
|
|
52
|
+
onClosePanel?: () => void;
|
|
48
53
|
}
|
|
49
54
|
/**
|
|
50
55
|
* 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,EAAoC,MAAM,mCAAmC,CAAC;AAKnL,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AA6BrE;;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;I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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,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAs9B9D,CAAC"}
|
|
@@ -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,
|
|
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,CAg9BvE,CAAC"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -86408,7 +86408,7 @@ const CustomNode = ({ data, selected: selected2, dragging }) => {
|
|
|
86408
86408
|
// Default to not hidden
|
|
86409
86409
|
} = nodeProps;
|
|
86410
86410
|
const nodeOpacity = isHidden ? 0.4 : isActive ? 1 : 0.1;
|
|
86411
|
-
const showTooltip = isHovered && !dragging && shiftKeyPressed;
|
|
86411
|
+
const showTooltip = isHovered && !dragging && shiftKeyPressed || !editable && !!selected2;
|
|
86412
86412
|
const otelInfo = nodeData == null ? void 0 : nodeData.otel;
|
|
86413
86413
|
const description = nodeData == null ? void 0 : nodeData.description;
|
|
86414
86414
|
const sources = nodeData == null ? void 0 : nodeData.sources;
|
|
@@ -87231,6 +87231,15 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
|
|
|
87231
87231
|
setAnimationState({ nodeAnimations: {}, edgeAnimations: {} });
|
|
87232
87232
|
}
|
|
87233
87233
|
}, [propNodes, propEdges, editStateRef, onEditStateChange, onPendingChangesChange]);
|
|
87234
|
+
const propNodesRef = useRef(propNodes);
|
|
87235
|
+
useEffect(() => {
|
|
87236
|
+
if (!draggableNodeIds || draggableNodeIds.size === 0)
|
|
87237
|
+
return;
|
|
87238
|
+
if (propNodesRef.current === propNodes)
|
|
87239
|
+
return;
|
|
87240
|
+
propNodesRef.current = propNodes;
|
|
87241
|
+
setLocalNodes(propNodes);
|
|
87242
|
+
}, [propNodes, draggableNodeIds]);
|
|
87234
87243
|
const nodes = localNodes;
|
|
87235
87244
|
const edges = editable ? localEdges : propEdges;
|
|
87236
87245
|
const checkHasChanges = useCallback((state) => {
|
|
@@ -87680,19 +87689,23 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
|
|
|
87680
87689
|
const xyflowNodesBase = useMemo(() => {
|
|
87681
87690
|
const converted = convertToXYFlowNodes(localNodes, configuration, violations);
|
|
87682
87691
|
return converted.map((node2) => {
|
|
87692
|
+
var _a, _b;
|
|
87683
87693
|
const animation = animationState.nodeAnimations[node2.id];
|
|
87684
87694
|
const pendingPosition = editStateRef.current.positionChanges.get(node2.id);
|
|
87685
87695
|
const isDraggable = editable || (draggableNodeIds == null ? void 0 : draggableNodeIds.has(node2.id));
|
|
87686
|
-
if (isDraggable && !editable) {
|
|
87687
|
-
console.log("[GraphRenderer] Setting draggable=true for node:", node2.id);
|
|
87688
|
-
}
|
|
87689
87696
|
const hasDraggableNodeIds = draggableNodeIds && draggableNodeIds.size > 0;
|
|
87697
|
+
const dataWidth = typeof ((_a = node2.data) == null ? void 0 : _a.width) === "number" ? node2.data.width : void 0;
|
|
87698
|
+
const dataHeight = typeof ((_b = node2.data) == null ? void 0 : _b.height) === "number" ? node2.data.height : void 0;
|
|
87699
|
+
const nodeWidth = node2.width ?? dataWidth ?? 200;
|
|
87700
|
+
const nodeHeight = node2.height ?? dataHeight ?? 100;
|
|
87690
87701
|
return {
|
|
87691
87702
|
...node2,
|
|
87692
87703
|
...pendingPosition ? { position: pendingPosition } : {},
|
|
87693
87704
|
selected: selectedNodeIds.has(node2.id),
|
|
87694
87705
|
// Explicitly set draggable for each node when using draggableNodeIds
|
|
87695
87706
|
draggable: hasDraggableNodeIds ? isDraggable : editable || false,
|
|
87707
|
+
// Set measured dimensions for React Flow v12 controlled drag
|
|
87708
|
+
measured: { width: nodeWidth, height: nodeHeight },
|
|
87696
87709
|
data: {
|
|
87697
87710
|
...node2.data,
|
|
87698
87711
|
editable,
|
|
@@ -87747,7 +87760,21 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
|
|
|
87747
87760
|
}
|
|
87748
87761
|
prevEditableRef.current = editable;
|
|
87749
87762
|
}, [editable, xyflowNodesBase, updateNodeInternals2]);
|
|
87750
|
-
const
|
|
87763
|
+
const hasDraggableNodes = draggableNodeIds && draggableNodeIds.size > 0;
|
|
87764
|
+
const xyflowNodes = editable || hasDraggableNodes ? xyflowLocalNodes : xyflowNodesBase;
|
|
87765
|
+
const prevHasDraggableNodesRef = useRef(false);
|
|
87766
|
+
useEffect(() => {
|
|
87767
|
+
const hadDraggableNodes = prevHasDraggableNodesRef.current;
|
|
87768
|
+
prevHasDraggableNodesRef.current = hasDraggableNodes || false;
|
|
87769
|
+
if (hasDraggableNodes && !hadDraggableNodes) {
|
|
87770
|
+
setXyflowLocalNodes(xyflowNodesBase);
|
|
87771
|
+
setTimeout(() => {
|
|
87772
|
+
draggableNodeIds == null ? void 0 : draggableNodeIds.forEach((nodeId) => {
|
|
87773
|
+
updateNodeInternals2(nodeId);
|
|
87774
|
+
});
|
|
87775
|
+
}, 50);
|
|
87776
|
+
}
|
|
87777
|
+
}, [hasDraggableNodes, xyflowNodesBase, draggableNodeIds, updateNodeInternals2]);
|
|
87751
87778
|
const handleNodeDrag = useCallback((_event, node2) => {
|
|
87752
87779
|
const canDrag = editable || (draggableNodeIds == null ? void 0 : draggableNodeIds.has(node2.id));
|
|
87753
87780
|
if (!canDrag)
|
|
@@ -87764,12 +87791,43 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
|
|
|
87764
87791
|
}
|
|
87765
87792
|
}, [onNodeDragStopProp]);
|
|
87766
87793
|
const handleNodesChange = useCallback((changes) => {
|
|
87767
|
-
|
|
87794
|
+
const hasDraggableNodes2 = draggableNodeIds && draggableNodeIds.size > 0;
|
|
87795
|
+
if (!editable && !hasDraggableNodes2)
|
|
87768
87796
|
return;
|
|
87769
|
-
|
|
87770
|
-
if (
|
|
87797
|
+
let changesToApply = changes.filter((change) => change.type !== "select");
|
|
87798
|
+
if (!editable && hasDraggableNodes2) {
|
|
87799
|
+
changesToApply = changesToApply.filter((change) => change.type === "position" && "id" in change && draggableNodeIds.has(change.id));
|
|
87800
|
+
}
|
|
87801
|
+
if (changesToApply.length > 0) {
|
|
87771
87802
|
setXyflowLocalNodes((nds) => {
|
|
87772
|
-
const
|
|
87803
|
+
const groupPositionChanges = changesToApply.filter((change) => change.type === "position" && "id" in change && typeof change.id === "string" && change.id.endsWith(":__group__") && "position" in change && change.position !== void 0);
|
|
87804
|
+
const groupDeltas = /* @__PURE__ */ new Map();
|
|
87805
|
+
for (const change of groupPositionChanges) {
|
|
87806
|
+
const canvasPrefix = change.id.replace(":__group__", ":");
|
|
87807
|
+
const currentNode = nds.find((n) => n.id === change.id);
|
|
87808
|
+
if (currentNode && change.position) {
|
|
87809
|
+
const dx = change.position.x - currentNode.position.x;
|
|
87810
|
+
const dy = change.position.y - currentNode.position.y;
|
|
87811
|
+
groupDeltas.set(canvasPrefix, { dx, dy });
|
|
87812
|
+
}
|
|
87813
|
+
}
|
|
87814
|
+
let updated = applyNodeChanges(changesToApply, nds);
|
|
87815
|
+
if (groupDeltas.size > 0) {
|
|
87816
|
+
updated = updated.map((node2) => {
|
|
87817
|
+
for (const [prefix, delta] of groupDeltas) {
|
|
87818
|
+
if (node2.id.startsWith(prefix) && !node2.id.endsWith(":__group__")) {
|
|
87819
|
+
return {
|
|
87820
|
+
...node2,
|
|
87821
|
+
position: {
|
|
87822
|
+
x: node2.position.x + delta.dx,
|
|
87823
|
+
y: node2.position.y + delta.dy
|
|
87824
|
+
}
|
|
87825
|
+
};
|
|
87826
|
+
}
|
|
87827
|
+
}
|
|
87828
|
+
return node2;
|
|
87829
|
+
});
|
|
87830
|
+
}
|
|
87773
87831
|
return updated.map((node2) => ({
|
|
87774
87832
|
...node2,
|
|
87775
87833
|
selected: selectedNodeIds.has(node2.id)
|
|
@@ -87804,7 +87862,7 @@ const GraphRendererInner = ({ configuration, nodes: propNodes, edges: propEdges,
|
|
|
87804
87862
|
return { ...prev, positionChanges: newPositions };
|
|
87805
87863
|
});
|
|
87806
87864
|
}
|
|
87807
|
-
}, [editable, updateEditState, selectedNodeIds]);
|
|
87865
|
+
}, [editable, updateEditState, selectedNodeIds, draggableNodeIds]);
|
|
87808
87866
|
const xyflowEdgesBase = useMemo(() => {
|
|
87809
87867
|
const converted = convertToXYFlowEdges(edges, configuration, violations);
|
|
87810
87868
|
const filtered = converted.filter((edge) => {
|
|
@@ -88230,7 +88288,6 @@ const MultiCanvasRenderer = forwardRef(function MultiCanvasRenderer2({ layout, o
|
|
|
88230
88288
|
ids.add(`${placement.canvasId}:__group__`);
|
|
88231
88289
|
}
|
|
88232
88290
|
}
|
|
88233
|
-
console.log("[MultiCanvasRenderer] draggableNodeIds:", [...ids]);
|
|
88234
88291
|
return ids.size > 0 ? ids : void 0;
|
|
88235
88292
|
}, [layout.placements, showGroups]);
|
|
88236
88293
|
useMemo(() => {
|
|
@@ -94435,7 +94492,8 @@ const CanvasEditorPanel = ({
|
|
|
94435
94492
|
selectedWorkflowId: _selectedWorkflowId,
|
|
94436
94493
|
workflowPath: _workflowPath,
|
|
94437
94494
|
workflowFileInfo: _workflowFileInfo,
|
|
94438
|
-
traceMatchInfo
|
|
94495
|
+
traceMatchInfo,
|
|
94496
|
+
onClosePanel
|
|
94439
94497
|
}) => {
|
|
94440
94498
|
var _a, _b, _c;
|
|
94441
94499
|
const { theme: theme2 } = useTheme();
|
|
@@ -94468,6 +94526,7 @@ const CanvasEditorPanel = ({
|
|
|
94468
94526
|
actionsRef.current = actions;
|
|
94469
94527
|
eventsRef.current = events;
|
|
94470
94528
|
const skipNextFileChangeRef = useRef(false);
|
|
94529
|
+
const canEdit = !!actions.writeFile;
|
|
94471
94530
|
const canvasFileTimestampRef = useRef(null);
|
|
94472
94531
|
const fileTreeSha = React__default.useMemo(() => {
|
|
94473
94532
|
var _a2;
|
|
@@ -94621,8 +94680,7 @@ const CanvasEditorPanel = ({
|
|
|
94621
94680
|
try {
|
|
94622
94681
|
const ctx = contextRef.current;
|
|
94623
94682
|
const acts = actionsRef.current;
|
|
94624
|
-
|
|
94625
|
-
if (!writeFile) {
|
|
94683
|
+
if (!acts.writeFile) {
|
|
94626
94684
|
throw new Error("writeFile action not available");
|
|
94627
94685
|
}
|
|
94628
94686
|
const repositoryPath = ctx.repositoryPath;
|
|
@@ -94632,7 +94690,7 @@ const CanvasEditorPanel = ({
|
|
|
94632
94690
|
const updatedCanvas = hasGraphChanges && pendingChanges ? applyChangesToCanvas(state.canvas, pendingChanges) : state.canvas;
|
|
94633
94691
|
const jsonContent = JSON.stringify(updatedCanvas, null, 2);
|
|
94634
94692
|
const fullPath = `${repositoryPath}/${canvasPath}`;
|
|
94635
|
-
await writeFile(fullPath, jsonContent);
|
|
94693
|
+
await acts.writeFile(fullPath, jsonContent);
|
|
94636
94694
|
skipNextFileChangeRef.current = true;
|
|
94637
94695
|
setState((prev) => ({
|
|
94638
94696
|
...prev,
|
|
@@ -94849,7 +94907,7 @@ const CanvasEditorPanel = ({
|
|
|
94849
94907
|
] }),
|
|
94850
94908
|
/* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", gap: theme2.space[2], flexShrink: 0 } })
|
|
94851
94909
|
] }),
|
|
94852
|
-
/* @__PURE__ */ jsx(
|
|
94910
|
+
canEdit && /* @__PURE__ */ jsx(
|
|
94853
94911
|
"button",
|
|
94854
94912
|
{
|
|
94855
94913
|
onClick: () => loadConfiguration(),
|
|
@@ -94920,7 +94978,7 @@ const CanvasEditorPanel = ({
|
|
|
94920
94978
|
children: /* @__PURE__ */ jsx(Info2, { size: 18 })
|
|
94921
94979
|
}
|
|
94922
94980
|
),
|
|
94923
|
-
/* @__PURE__ */ jsx(
|
|
94981
|
+
canEdit && /* @__PURE__ */ jsx(
|
|
94924
94982
|
"button",
|
|
94925
94983
|
{
|
|
94926
94984
|
onClick: toggleEditMode,
|
|
@@ -94943,6 +95001,29 @@ const CanvasEditorPanel = ({
|
|
|
94943
95001
|
},
|
|
94944
95002
|
children: /* @__PURE__ */ jsx(Pencil, { size: 18 })
|
|
94945
95003
|
}
|
|
95004
|
+
),
|
|
95005
|
+
onClosePanel && /* @__PURE__ */ jsx(
|
|
95006
|
+
"button",
|
|
95007
|
+
{
|
|
95008
|
+
onClick: onClosePanel,
|
|
95009
|
+
title: "Close panel",
|
|
95010
|
+
style: {
|
|
95011
|
+
display: "flex",
|
|
95012
|
+
alignItems: "center",
|
|
95013
|
+
justifyContent: "center",
|
|
95014
|
+
width: 40,
|
|
95015
|
+
height: 39,
|
|
95016
|
+
padding: 0,
|
|
95017
|
+
backgroundColor: "transparent",
|
|
95018
|
+
color: theme2.colors.textMuted,
|
|
95019
|
+
border: "none",
|
|
95020
|
+
borderLeft: `1px solid ${theme2.colors.border}`,
|
|
95021
|
+
cursor: "pointer",
|
|
95022
|
+
transition: "all 0.15s",
|
|
95023
|
+
flexShrink: 0
|
|
95024
|
+
},
|
|
95025
|
+
children: /* @__PURE__ */ jsx(X, { size: 18 })
|
|
95026
|
+
}
|
|
94946
95027
|
)
|
|
94947
95028
|
] }),
|
|
94948
95029
|
/* @__PURE__ */ jsx("div", { style: { flex: 1, overflow: "hidden" }, children: /* @__PURE__ */ jsx(
|
|
@@ -98805,7 +98886,10 @@ const StoryboardListPanel = ({
|
|
|
98805
98886
|
const cliCommand = storyboards.length > 0 ? "npx @principal-ai/principal-view-cli@latest --help" : "npx @principal-ai/principal-view-cli@latest init";
|
|
98806
98887
|
navigator.clipboard.writeText(cliCommand).then(() => {
|
|
98807
98888
|
setCliCommandCopied(true);
|
|
98808
|
-
setTimeout(() =>
|
|
98889
|
+
setTimeout(() => {
|
|
98890
|
+
setShowHelp(false);
|
|
98891
|
+
setCliCommandCopied(false);
|
|
98892
|
+
}, 600);
|
|
98809
98893
|
});
|
|
98810
98894
|
}, [storyboards.length]);
|
|
98811
98895
|
const handleCopyInitCommand = useCallback(() => {
|