system-canvas-standalone 0.2.41 → 0.2.42
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/system-canvas.js +45 -20
- package/dist/system-canvas.js.map +1 -1
- package/dist/system-canvas.min.js +11 -11
- package/dist/system-canvas.min.js.map +1 -1
- package/package.json +3 -3
package/dist/system-canvas.js
CHANGED
|
@@ -15841,10 +15841,10 @@ var SystemCanvas = (() => {
|
|
|
15841
15841
|
// ../react/dist/hooks/useMultiSelect.js
|
|
15842
15842
|
var import_react7 = __toESM(require_react(), 1);
|
|
15843
15843
|
function useMultiSelect(options) {
|
|
15844
|
-
const { svgRef, viewport, nodesRef, containerRef, enabled } = options;
|
|
15844
|
+
const { svgRef, viewport, nodesRef, containerRef, enabled, activationKey = "space" } = options;
|
|
15845
15845
|
const [selectedIds, setSelectedIds] = (0, import_react7.useState)(() => /* @__PURE__ */ new Set());
|
|
15846
15846
|
const [marqueeRect, setMarqueeRect] = (0, import_react7.useState)(null);
|
|
15847
|
-
const marqueeActiveRef = (0, import_react7.useRef)(
|
|
15847
|
+
const marqueeActiveRef = (0, import_react7.useRef)(activationKey === "none");
|
|
15848
15848
|
const isDrawingRef = (0, import_react7.useRef)(false);
|
|
15849
15849
|
const startScreenRef = (0, import_react7.useRef)(null);
|
|
15850
15850
|
const pointerIdRef = (0, import_react7.useRef)(null);
|
|
@@ -15879,28 +15879,47 @@ var SystemCanvas = (() => {
|
|
|
15879
15879
|
(0, import_react7.useEffect)(() => {
|
|
15880
15880
|
if (!enabled)
|
|
15881
15881
|
return;
|
|
15882
|
+
if (activationKey === "none") {
|
|
15883
|
+
marqueeActiveRef.current = true;
|
|
15884
|
+
return;
|
|
15885
|
+
}
|
|
15882
15886
|
const container = containerRef.current;
|
|
15883
15887
|
if (!container)
|
|
15884
15888
|
return;
|
|
15889
|
+
const matchesKey = (e) => {
|
|
15890
|
+
switch (activationKey) {
|
|
15891
|
+
case "space":
|
|
15892
|
+
return e.code === "Space";
|
|
15893
|
+
case "shift":
|
|
15894
|
+
return e.key === "Shift";
|
|
15895
|
+
case "alt":
|
|
15896
|
+
return e.key === "Alt";
|
|
15897
|
+
case "meta":
|
|
15898
|
+
return e.key === "Meta";
|
|
15899
|
+
default:
|
|
15900
|
+
return false;
|
|
15901
|
+
}
|
|
15902
|
+
};
|
|
15885
15903
|
const onKeyDown = (e) => {
|
|
15886
|
-
if (e
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
e.preventDefault();
|
|
15892
|
-
marqueeActiveRef.current = true;
|
|
15904
|
+
if (!matchesKey(e) || e.repeat)
|
|
15905
|
+
return;
|
|
15906
|
+
const active = document.activeElement;
|
|
15907
|
+
if (active instanceof HTMLInputElement || active instanceof HTMLTextAreaElement || active instanceof HTMLElement && active.isContentEditable) {
|
|
15908
|
+
return;
|
|
15893
15909
|
}
|
|
15910
|
+
if (activationKey === "space")
|
|
15911
|
+
e.preventDefault();
|
|
15912
|
+
marqueeActiveRef.current = true;
|
|
15894
15913
|
};
|
|
15895
15914
|
const onKeyUp = (e) => {
|
|
15896
|
-
if (e
|
|
15897
|
-
|
|
15898
|
-
|
|
15899
|
-
|
|
15900
|
-
|
|
15901
|
-
|
|
15902
|
-
|
|
15903
|
-
|
|
15915
|
+
if (!matchesKey(e))
|
|
15916
|
+
return;
|
|
15917
|
+
marqueeActiveRef.current = false;
|
|
15918
|
+
if (isDrawingRef.current) {
|
|
15919
|
+
isDrawingRef.current = false;
|
|
15920
|
+
startScreenRef.current = null;
|
|
15921
|
+
pointerIdRef.current = null;
|
|
15922
|
+
setMarqueeRect(null);
|
|
15904
15923
|
}
|
|
15905
15924
|
};
|
|
15906
15925
|
container.addEventListener("keydown", onKeyDown);
|
|
@@ -15909,7 +15928,7 @@ var SystemCanvas = (() => {
|
|
|
15909
15928
|
container.removeEventListener("keydown", onKeyDown);
|
|
15910
15929
|
container.removeEventListener("keyup", onKeyUp);
|
|
15911
15930
|
};
|
|
15912
|
-
}, [enabled, containerRef]);
|
|
15931
|
+
}, [enabled, containerRef, activationKey]);
|
|
15913
15932
|
(0, import_react7.useEffect)(() => {
|
|
15914
15933
|
if (!enabled)
|
|
15915
15934
|
return;
|
|
@@ -15946,6 +15965,10 @@ var SystemCanvas = (() => {
|
|
|
15946
15965
|
if (target && typeof target.closest === "function") {
|
|
15947
15966
|
if (target.closest(".system-canvas-node"))
|
|
15948
15967
|
return;
|
|
15968
|
+
if (target.closest(".system-canvas-resize-handles"))
|
|
15969
|
+
return;
|
|
15970
|
+
if (target.closest(".system-canvas-connection-handles"))
|
|
15971
|
+
return;
|
|
15949
15972
|
}
|
|
15950
15973
|
const svg = svgRef.current;
|
|
15951
15974
|
if (!svg)
|
|
@@ -22915,7 +22938,7 @@ var SystemCanvas = (() => {
|
|
|
22915
22938
|
// ../react/dist/components/SystemCanvas.js
|
|
22916
22939
|
var CASCADE_WINDOW_MS = 1500;
|
|
22917
22940
|
var CASCADE_OFFSET = 20;
|
|
22918
|
-
var SystemCanvas = (0, import_react34.forwardRef)(function SystemCanvas2({ canvas, onResolveCanvas, canvases, rootLabel = "Home", onNavigate, externalNavigation = false, onBreadcrumbClick, onBreadcrumbsChange, onNodeClick, onNodeDoubleClick, onEdgeClick, onEdgeDoubleClick, onContextMenu, onSelectionChange, nodeContextMenu, edgeContextMenu, canvasContextMenu, editable = false, onNodeAdd, onNodeUpdate, onNodesUpdate, onNodeDelete, onNodesDelete, onEdgeUpdate, onEdgeDelete, onEdgeAdd, canDropNodeOn, onNodeDrop, renderAddNodeButton, showExportButton = false, renderExportButton, onImport, showNodeToolbar = true, renderNodeToolbar, theme: themeProp, themes: customThemes, edgeStyle = "bezier", defaultViewport, minZoom: minZoomProp, maxZoom, onViewportChange, panMode = "drag", autoFit = "canvas-change", laneHeaders = "pinned", snapToLanes = false, zoomNavigation = false, snapGrid, guideThreshold, alignDistributeMenu, historyDepth, onUndo, onRedo, collaborators = [], className, style }, forwardedRef) {
|
|
22941
|
+
var SystemCanvas = (0, import_react34.forwardRef)(function SystemCanvas2({ canvas, onResolveCanvas, canvases, rootLabel = "Home", onNavigate, externalNavigation = false, onBreadcrumbClick, onBreadcrumbsChange, onNodeClick, onNodeDoubleClick, onEdgeClick, onEdgeDoubleClick, onContextMenu, onSelectionChange, nodeContextMenu, edgeContextMenu, canvasContextMenu, editable = false, onNodeAdd, onNodeUpdate, onNodesUpdate, onNodeDelete, onNodesDelete, onEdgeUpdate, onEdgeDelete, onEdgeAdd, canDropNodeOn, onNodeDrop, renderAddNodeButton, showExportButton = false, renderExportButton, onImport, showNodeToolbar = true, renderNodeToolbar, theme: themeProp, themes: customThemes, edgeStyle = "bezier", defaultViewport, minZoom: minZoomProp, maxZoom, onViewportChange, panMode = "drag", multiSelectKey = "auto", autoFit = "canvas-change", laneHeaders = "pinned", snapToLanes = false, zoomNavigation = false, snapGrid, guideThreshold, alignDistributeMenu, historyDepth, onUndo, onRedo, collaborators = [], className, style }, forwardedRef) {
|
|
22919
22942
|
const zoomNavConfig = (0, import_react34.useMemo)(() => {
|
|
22920
22943
|
const defaults = {
|
|
22921
22944
|
enterThreshold: 0.66,
|
|
@@ -23043,12 +23066,14 @@ var SystemCanvas = (() => {
|
|
|
23043
23066
|
const [importError, setImportError] = (0, import_react34.useState)(null);
|
|
23044
23067
|
const svgProxyRef = (0, import_react34.useRef)(null);
|
|
23045
23068
|
const containerRef = (0, import_react34.useRef)(null);
|
|
23069
|
+
const resolvedMultiSelectKey = multiSelectKey === "auto" ? panMode === "trackpad" ? "none" : "space" : multiSelectKey;
|
|
23046
23070
|
const { selectedIds, selectNode, toggleNode, selectAll, clearSelection, selectMultiple, marqueeRect, marqueeActiveRef } = useMultiSelect({
|
|
23047
23071
|
svgRef: svgProxyRef,
|
|
23048
23072
|
viewport: viewportStateRef,
|
|
23049
23073
|
nodesRef,
|
|
23050
23074
|
containerRef,
|
|
23051
|
-
enabled: editable
|
|
23075
|
+
enabled: editable,
|
|
23076
|
+
activationKey: resolvedMultiSelectKey
|
|
23052
23077
|
});
|
|
23053
23078
|
const selectedIdsRef = (0, import_react34.useRef)(selectedIds);
|
|
23054
23079
|
(0, import_react34.useEffect)(() => {
|