@industry-theme/principal-view-panels 0.12.21 → 0.12.23
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,EAAoC,MAAM,mCAAmC,CAAC;AAKnL,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AA8BrE;;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,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,EAAoC,MAAM,mCAAmC,CAAC;AAKnL,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AA8BrE;;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,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAunC9D,CAAC"}
|
package/dist/panels.bundle.js
CHANGED
|
@@ -94555,6 +94555,7 @@ const CanvasEditorPanel = ({
|
|
|
94555
94555
|
return ((_a2 = slice == null ? void 0 : slice.data) == null ? void 0 : _a2.sha) || null;
|
|
94556
94556
|
}, [context2]);
|
|
94557
94557
|
const [pathCopied, setPathCopied] = useState(false);
|
|
94558
|
+
const [copiedNodesCount, setCopiedNodesCount] = useState(null);
|
|
94558
94559
|
const loadConfiguration = useCallback(async () => {
|
|
94559
94560
|
if (!canvasPath) {
|
|
94560
94561
|
setState((prev) => ({ ...prev, canvas: null, library: null, loading: false, error: null }));
|
|
@@ -94629,6 +94630,54 @@ const CanvasEditorPanel = ({
|
|
|
94629
94630
|
setTimeout(() => setPathCopied(false), 2e3);
|
|
94630
94631
|
});
|
|
94631
94632
|
}, [canvasPath]);
|
|
94633
|
+
const handleCopyNodes = useCallback((selectedNodeIds) => {
|
|
94634
|
+
var _a2;
|
|
94635
|
+
if (!state.canvas || selectedNodeIds.length === 0) return;
|
|
94636
|
+
const selectedSet = new Set(selectedNodeIds);
|
|
94637
|
+
const nodes = selectedNodeIds.map((nodeId) => {
|
|
94638
|
+
var _a3, _b2;
|
|
94639
|
+
const node2 = (_a3 = state.canvas.nodes) == null ? void 0 : _a3.find((n) => n.id === nodeId);
|
|
94640
|
+
if (!node2) return null;
|
|
94641
|
+
const pv = node2.pv;
|
|
94642
|
+
let label = (pv == null ? void 0 : pv.name) || nodeId;
|
|
94643
|
+
if ("text" in node2 && node2.text && !(pv == null ? void 0 : pv.name)) {
|
|
94644
|
+
label = node2.text.split("\n")[0].trim() || nodeId;
|
|
94645
|
+
}
|
|
94646
|
+
return {
|
|
94647
|
+
id: node2.id,
|
|
94648
|
+
type: node2.type,
|
|
94649
|
+
label,
|
|
94650
|
+
...(pv == null ? void 0 : pv.nodeType) && { nodeType: pv.nodeType },
|
|
94651
|
+
...(pv == null ? void 0 : pv.description) && { description: pv.description },
|
|
94652
|
+
...(pv == null ? void 0 : pv.icon) && { icon: pv.icon },
|
|
94653
|
+
...(pv == null ? void 0 : pv.eventRef) && { eventRef: pv.eventRef },
|
|
94654
|
+
...((_b2 = pv == null ? void 0 : pv.event) == null ? void 0 : _b2.name) && { eventName: pv.event.name },
|
|
94655
|
+
...(pv == null ? void 0 : pv.sources) && pv.sources.length > 0 && { sources: pv.sources }
|
|
94656
|
+
};
|
|
94657
|
+
}).filter(Boolean);
|
|
94658
|
+
const edges = (state.canvas.edges || []).filter((edge) => selectedSet.has(edge.fromNode) && selectedSet.has(edge.toNode)).map((edge) => {
|
|
94659
|
+
var _a3;
|
|
94660
|
+
return {
|
|
94661
|
+
from: edge.fromNode,
|
|
94662
|
+
to: edge.toNode,
|
|
94663
|
+
...((_a3 = edge.pv) == null ? void 0 : _a3.edgeType) && { type: edge.pv.edgeType }
|
|
94664
|
+
};
|
|
94665
|
+
});
|
|
94666
|
+
const copyContext = {
|
|
94667
|
+
canvas: {
|
|
94668
|
+
path: canvasPath || "unknown",
|
|
94669
|
+
name: canvasName || ((_a2 = state.canvas.pv) == null ? void 0 : _a2.name) || "Untitled"
|
|
94670
|
+
},
|
|
94671
|
+
nodes,
|
|
94672
|
+
...edges.length > 0 && { edges }
|
|
94673
|
+
};
|
|
94674
|
+
navigator.clipboard.writeText(JSON.stringify(copyContext, null, 2)).then(() => {
|
|
94675
|
+
setCopiedNodesCount(nodes.length);
|
|
94676
|
+
setTimeout(() => setCopiedNodesCount(null), 2e3);
|
|
94677
|
+
}).catch((err) => {
|
|
94678
|
+
console.error("[CanvasEditorPanel] Failed to copy nodes:", err);
|
|
94679
|
+
});
|
|
94680
|
+
}, [state.canvas, canvasPath, canvasName]);
|
|
94632
94681
|
const toggleEditMode = useCallback(() => {
|
|
94633
94682
|
setState((prev) => {
|
|
94634
94683
|
if (prev.isEditMode && prev.hasUnsavedChanges) {
|
|
@@ -95124,6 +95173,7 @@ const CanvasEditorPanel = ({
|
|
|
95124
95173
|
onPendingChangesChange: (hasChanges) => {
|
|
95125
95174
|
setState((prev) => ({ ...prev, hasUnsavedChanges: hasChanges }));
|
|
95126
95175
|
},
|
|
95176
|
+
onCopy: handleCopyNodes,
|
|
95127
95177
|
showBackground: state.showGridLines,
|
|
95128
95178
|
backgroundVariant: "lines",
|
|
95129
95179
|
showControls: true,
|
|
@@ -95291,6 +95341,35 @@ const CanvasEditorPanel = ({
|
|
|
95291
95341
|
color: theme2.colors.textMuted,
|
|
95292
95342
|
fontStyle: "italic"
|
|
95293
95343
|
}, children: "No edge types defined" })
|
|
95344
|
+
] }),
|
|
95345
|
+
copiedNodesCount !== null && /* @__PURE__ */ jsxs("div", { style: {
|
|
95346
|
+
position: "absolute",
|
|
95347
|
+
bottom: 16,
|
|
95348
|
+
left: "50%",
|
|
95349
|
+
transform: "translateX(-50%)",
|
|
95350
|
+
display: "flex",
|
|
95351
|
+
alignItems: "center",
|
|
95352
|
+
gap: theme2.space[2],
|
|
95353
|
+
padding: `${theme2.space[2]} ${theme2.space[3]}`,
|
|
95354
|
+
backgroundColor: theme2.colors.backgroundSecondary,
|
|
95355
|
+
border: `1px solid ${theme2.colors.border}`,
|
|
95356
|
+
borderRadius: theme2.radii[1],
|
|
95357
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
95358
|
+
zIndex: 50,
|
|
95359
|
+
animation: "fadeIn 0.15s ease-out"
|
|
95360
|
+
}, children: [
|
|
95361
|
+
/* @__PURE__ */ jsx(Check, { size: 14, style: { color: theme2.colors.success || "#22c55e" } }),
|
|
95362
|
+
/* @__PURE__ */ jsxs("span", { style: {
|
|
95363
|
+
fontSize: theme2.fontSizes[1],
|
|
95364
|
+
color: theme2.colors.text,
|
|
95365
|
+
whiteSpace: "nowrap"
|
|
95366
|
+
}, children: [
|
|
95367
|
+
"Copied ",
|
|
95368
|
+
copiedNodesCount,
|
|
95369
|
+
" node",
|
|
95370
|
+
copiedNodesCount !== 1 ? "s" : "",
|
|
95371
|
+
" to clipboard"
|
|
95372
|
+
] })
|
|
95294
95373
|
] })
|
|
95295
95374
|
] }),
|
|
95296
95375
|
state.selectedScenario && /* @__PURE__ */ jsx(
|