@bian-womp/spark-workbench 0.3.30 → 0.3.31

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.
Files changed (33) hide show
  1. package/lib/cjs/index.cjs +37 -39
  2. package/lib/cjs/index.cjs.map +1 -1
  3. package/lib/cjs/src/misc/WorkbenchCanvas.d.ts.map +1 -1
  4. package/lib/cjs/src/misc/context/WorkbenchContext.d.ts +20 -9
  5. package/lib/cjs/src/misc/context/WorkbenchContext.d.ts.map +1 -1
  6. package/lib/cjs/src/misc/context-menu/ContextMenuButton.d.ts +1 -2
  7. package/lib/cjs/src/misc/context-menu/ContextMenuButton.d.ts.map +1 -1
  8. package/lib/cjs/src/misc/context-menu/ContextMenuHandlers.d.ts +0 -5
  9. package/lib/cjs/src/misc/context-menu/ContextMenuHandlers.d.ts.map +1 -1
  10. package/lib/cjs/src/misc/context-menu/ContextMenuHelpers.d.ts.map +1 -1
  11. package/lib/cjs/src/misc/context-menu/DefaultContextMenu.d.ts +1 -1
  12. package/lib/cjs/src/misc/context-menu/DefaultContextMenu.d.ts.map +1 -1
  13. package/lib/cjs/src/misc/context-menu/NodeContextMenu.d.ts +1 -1
  14. package/lib/cjs/src/misc/context-menu/NodeContextMenu.d.ts.map +1 -1
  15. package/lib/cjs/src/misc/context-menu/SelectionContextMenu.d.ts +1 -1
  16. package/lib/cjs/src/misc/context-menu/SelectionContextMenu.d.ts.map +1 -1
  17. package/lib/esm/index.js +37 -39
  18. package/lib/esm/index.js.map +1 -1
  19. package/lib/esm/src/misc/WorkbenchCanvas.d.ts.map +1 -1
  20. package/lib/esm/src/misc/context/WorkbenchContext.d.ts +20 -9
  21. package/lib/esm/src/misc/context/WorkbenchContext.d.ts.map +1 -1
  22. package/lib/esm/src/misc/context-menu/ContextMenuButton.d.ts +1 -2
  23. package/lib/esm/src/misc/context-menu/ContextMenuButton.d.ts.map +1 -1
  24. package/lib/esm/src/misc/context-menu/ContextMenuHandlers.d.ts +0 -5
  25. package/lib/esm/src/misc/context-menu/ContextMenuHandlers.d.ts.map +1 -1
  26. package/lib/esm/src/misc/context-menu/ContextMenuHelpers.d.ts.map +1 -1
  27. package/lib/esm/src/misc/context-menu/DefaultContextMenu.d.ts +1 -1
  28. package/lib/esm/src/misc/context-menu/DefaultContextMenu.d.ts.map +1 -1
  29. package/lib/esm/src/misc/context-menu/NodeContextMenu.d.ts +1 -1
  30. package/lib/esm/src/misc/context-menu/NodeContextMenu.d.ts.map +1 -1
  31. package/lib/esm/src/misc/context-menu/SelectionContextMenu.d.ts +1 -1
  32. package/lib/esm/src/misc/context-menu/SelectionContextMenu.d.ts.map +1 -1
  33. package/package.json +4 -4
package/lib/cjs/index.cjs CHANGED
@@ -5067,13 +5067,6 @@ function createNodeContextMenuHandlers(nodeId, wb, runner, registry, outputsMap,
5067
5067
  onClose();
5068
5068
  },
5069
5069
  onDuplicate: async () => {
5070
- wb.duplicateNode(nodeId, runner, {
5071
- commit: true,
5072
- reason: "duplicate-node",
5073
- });
5074
- onClose();
5075
- },
5076
- onDuplicateWithEdges: async () => {
5077
5070
  wb.duplicateNodeWithEdges(nodeId, runner, {
5078
5071
  commit: true,
5079
5072
  reason: "duplicate-node-with-edges",
@@ -5569,11 +5562,11 @@ function formatShortcut(shortcut) {
5569
5562
  navigator.userAgent.toLowerCase().includes("mac");
5570
5563
  return shortcut.replace(/⌘\/Ctrl/g, isMac ? "⌘" : "Ctrl");
5571
5564
  }
5572
- function ContextMenuButton({ label, onClick, disabled = false, shortcut, enableKeyboardShortcuts = true, }) {
5573
- return (jsxRuntime.jsxs("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-between", onClick: onClick, disabled: disabled, children: [jsxRuntime.jsx("span", { children: label }), enableKeyboardShortcuts && shortcut && (jsxRuntime.jsx("span", { className: "text-gray-400 text-xs ml-4", children: formatShortcut(shortcut) }))] }));
5565
+ function ContextMenuButton({ label, onClick, disabled = false, shortcut, }) {
5566
+ return (jsxRuntime.jsxs("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-between", onClick: onClick, disabled: disabled, children: [jsxRuntime.jsx("span", { children: label }), shortcut && (jsxRuntime.jsx("span", { className: "text-gray-400 text-xs ml-4", children: formatShortcut(shortcut) }))] }));
5574
5567
  }
5575
5568
 
5576
- function DefaultContextMenu({ open, clientPos, handlers, registry, nodeIds, enableKeyboardShortcuts = true, keyboardShortcuts = {
5569
+ function DefaultContextMenu({ open, clientPos, handlers, registry, nodeIds, keyboardShortcuts = {
5577
5570
  undo: "⌘/Ctrl + Z",
5578
5571
  redo: "⌘/Ctrl + Shift + Z",
5579
5572
  paste: "⌘/Ctrl + V",
@@ -5680,16 +5673,15 @@ function DefaultContextMenu({ open, clientPos, handlers, registry, nodeIds, enab
5680
5673
  return (jsxRuntime.jsxs("div", { ref: ref, tabIndex: -1, className: "fixed z-[1000] bg-white border border-gray-300 rounded-lg shadow-lg p-1 min-w-[180px] text-sm text-gray-700 select-none", style: { left: x, top: y }, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), onWheel: (e) => e.stopPropagation(), onContextMenu: (e) => {
5681
5674
  e.preventDefault();
5682
5675
  e.stopPropagation();
5683
- }, children: [hasPasteData && handlers.onPaste && (jsxRuntime.jsx(ContextMenuButton, { label: "Paste", onClick: handlePaste, shortcut: keyboardShortcuts.paste, enableKeyboardShortcuts: enableKeyboardShortcuts })), (handlers.onUndo || handlers.onRedo || handlers.onSelectAll) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasPasteData && handlers.onPaste && (jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" })), handlers.onSelectAll && (jsxRuntime.jsx(ContextMenuButton, { label: "Select All", onClick: handlers.onSelectAll, shortcut: keyboardShortcuts.selectAll, enableKeyboardShortcuts: enableKeyboardShortcuts })), handlers.onSelectAll && (handlers.onUndo || handlers.onRedo) && (jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" })), handlers.onUndo && (jsxRuntime.jsx(ContextMenuButton, { label: "Undo", onClick: handlers.onUndo, disabled: !canUndo, shortcut: keyboardShortcuts.undo, enableKeyboardShortcuts: enableKeyboardShortcuts })), handlers.onRedo && (jsxRuntime.jsx(ContextMenuButton, { label: "Redo", onClick: handlers.onRedo, disabled: !canRedo, shortcut: keyboardShortcuts.redo, enableKeyboardShortcuts: enableKeyboardShortcuts })), (handlers.onUndo || handlers.onRedo) && (jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" }))] })), hasPasteData &&
5676
+ }, children: [hasPasteData && handlers.onPaste && (jsxRuntime.jsx(ContextMenuButton, { label: "Paste", onClick: handlePaste, shortcut: keyboardShortcuts.paste })), (handlers.onUndo || handlers.onRedo || handlers.onSelectAll) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [hasPasteData && handlers.onPaste && (jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" })), handlers.onSelectAll && (jsxRuntime.jsx(ContextMenuButton, { label: "Select All", onClick: handlers.onSelectAll, shortcut: keyboardShortcuts.selectAll })), handlers.onSelectAll && (handlers.onUndo || handlers.onRedo) && (jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" })), handlers.onUndo && (jsxRuntime.jsx(ContextMenuButton, { label: "Undo", onClick: handlers.onUndo, disabled: !canUndo, shortcut: keyboardShortcuts.undo })), handlers.onRedo && (jsxRuntime.jsx(ContextMenuButton, { label: "Redo", onClick: handlers.onRedo, disabled: !canRedo, shortcut: keyboardShortcuts.redo })), (handlers.onUndo || handlers.onRedo) && (jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" }))] })), hasPasteData &&
5684
5677
  handlers.onPaste &&
5685
5678
  !handlers.onUndo &&
5686
5679
  !handlers.onRedo && jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" }), jsxRuntime.jsxs("div", { className: "px-2 py-1 font-semibold text-gray-700", children: ["Add Node", " ", jsxRuntime.jsxs("span", { className: "text-gray-500 font-normal", children: ["(", totalCount, ")"] })] }), jsxRuntime.jsx("div", { className: "px-2 pb-1", children: jsxRuntime.jsx("input", { ref: inputRef, type: "text", value: query, onChange: (e) => setQuery(e.target.value), placeholder: "Filter nodes...", className: "w-full border border-gray-300 rounded px-2 py-1 text-sm outline-none focus:border-gray-400 select-text", onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), onWheel: (e) => e.stopPropagation() }) }), jsxRuntime.jsx("div", { className: "max-h-60 overflow-auto", children: totalCount > 0 ? (renderTree(root)) : (jsxRuntime.jsx("div", { className: "px-3 py-2 text-gray-400", children: "No matches" })) })] }));
5687
5680
  }
5688
5681
 
5689
- function NodeContextMenu({ open, clientPos, nodeId, handlers, bakeableOutputs, runMode, wb, enableKeyboardShortcuts = true, keyboardShortcuts = {
5682
+ function NodeContextMenu({ open, clientPos, nodeId, handlers, bakeableOutputs, runMode, wb, keyboardShortcuts = {
5690
5683
  copy: "⌘/Ctrl + C",
5691
5684
  duplicate: "⌘/Ctrl + E",
5692
- duplicateWithEdges: "⌘/Ctrl + Shift + E",
5693
5685
  delete: "Delete",
5694
5686
  }, }) {
5695
5687
  const ref = React.useRef(null);
@@ -5737,10 +5729,10 @@ function NodeContextMenu({ open, clientPos, nodeId, handlers, bakeableOutputs, r
5737
5729
  return (jsxRuntime.jsxs("div", { ref: ref, tabIndex: -1, className: "fixed z-[1000] bg-white border border-gray-300 rounded-lg shadow-lg p-1 min-w-[180px] text-sm text-gray-700 select-none", style: { left: x, top: y }, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), onWheel: (e) => e.stopPropagation(), onContextMenu: (e) => {
5738
5730
  e.preventDefault();
5739
5731
  e.stopPropagation();
5740
- }, children: [jsxRuntime.jsxs("div", { className: "px-2 py-1 font-semibold text-gray-700", children: ["Node (", nodeId, ")"] }), jsxRuntime.jsx(ContextMenuButton, { label: "Delete", onClick: handlers.onDelete, shortcut: keyboardShortcuts.delete, enableKeyboardShortcuts: enableKeyboardShortcuts }), jsxRuntime.jsx(ContextMenuButton, { label: "Duplicate", onClick: handlers.onDuplicate, shortcut: keyboardShortcuts.duplicate, enableKeyboardShortcuts: enableKeyboardShortcuts }), jsxRuntime.jsx(ContextMenuButton, { label: "Duplicate with edges", onClick: handlers.onDuplicateWithEdges, shortcut: keyboardShortcuts.duplicateWithEdges, enableKeyboardShortcuts: enableKeyboardShortcuts }), handlers.onRunNode && (jsxRuntime.jsx("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100", onClick: handlers.onRunNode, children: "Run node" })), runMode === "manual" && handlers.onRunFromHere && hasOutboundEdges && (jsxRuntime.jsx("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100", onClick: handlers.onRunFromHere, children: isStartNode ? "Run workflow" : "Run from here" })), jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" }), jsxRuntime.jsx(ContextMenuButton, { label: "Copy", onClick: handlers.onCopy, shortcut: keyboardShortcuts.copy, enableKeyboardShortcuts: enableKeyboardShortcuts }), jsxRuntime.jsx("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100", onClick: handlers.onCopyId, children: "Copy Node ID" }), bakeableOutputs.length > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" }), jsxRuntime.jsx("div", { className: "px-2 py-1 font-semibold text-gray-700", children: "Bake" }), bakeableOutputs.map((h) => (jsxRuntime.jsxs("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100", onClick: () => handlers.onBake(h), children: ["Bake: ", h] }, h)))] }))] }));
5732
+ }, children: [jsxRuntime.jsxs("div", { className: "px-2 py-1 font-semibold text-gray-700", children: ["Node (", nodeId, ")"] }), jsxRuntime.jsx(ContextMenuButton, { label: "Delete", onClick: handlers.onDelete, shortcut: keyboardShortcuts.delete }), jsxRuntime.jsx(ContextMenuButton, { label: "Duplicate", onClick: handlers.onDuplicate, shortcut: keyboardShortcuts.duplicate }), handlers.onRunNode && (jsxRuntime.jsx("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100", onClick: handlers.onRunNode, children: "Run node" })), runMode === "manual" && handlers.onRunFromHere && hasOutboundEdges && (jsxRuntime.jsx("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100", onClick: handlers.onRunFromHere, children: isStartNode ? "Run workflow" : "Run from here" })), jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" }), jsxRuntime.jsx(ContextMenuButton, { label: "Copy", onClick: handlers.onCopy, shortcut: keyboardShortcuts.copy }), jsxRuntime.jsx("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100", onClick: handlers.onCopyId, children: "Copy Node ID" }), bakeableOutputs.length > 0 && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "h-px bg-gray-200 my-1" }), jsxRuntime.jsx("div", { className: "px-2 py-1 font-semibold text-gray-700", children: "Bake" }), bakeableOutputs.map((h) => (jsxRuntime.jsxs("button", { className: "block w-full text-left px-2 py-1 hover:bg-gray-100", onClick: () => handlers.onBake(h), children: ["Bake: ", h] }, h)))] }))] }));
5741
5733
  }
5742
5734
 
5743
- function SelectionContextMenu({ open, clientPos, handlers, enableKeyboardShortcuts = true, keyboardShortcuts = {
5735
+ function SelectionContextMenu({ open, clientPos, handlers, keyboardShortcuts = {
5744
5736
  copy: "⌘/Ctrl + C",
5745
5737
  duplicate: "⌘/Ctrl + E",
5746
5738
  delete: "Delete",
@@ -5782,7 +5774,7 @@ function SelectionContextMenu({ open, clientPos, handlers, enableKeyboardShortcu
5782
5774
  return (jsxRuntime.jsxs("div", { ref: ref, tabIndex: -1, className: "fixed z-[1000] bg-white border border-gray-300 rounded-lg shadow-lg p-1 min-w-[180px] text-sm text-gray-700 select-none", style: { left: x, top: y }, onClick: (e) => e.stopPropagation(), onMouseDown: (e) => e.stopPropagation(), onWheel: (e) => e.stopPropagation(), onContextMenu: (e) => {
5783
5775
  e.preventDefault();
5784
5776
  e.stopPropagation();
5785
- }, children: [jsxRuntime.jsx("div", { className: "px-2 py-1 font-semibold text-gray-700", children: "Selection" }), jsxRuntime.jsx(ContextMenuButton, { label: "Copy", onClick: handlers.onCopy, shortcut: keyboardShortcuts.copy, enableKeyboardShortcuts: enableKeyboardShortcuts }), handlers.onDuplicate && (jsxRuntime.jsx(ContextMenuButton, { label: "Duplicate", onClick: handlers.onDuplicate, shortcut: keyboardShortcuts.duplicate, enableKeyboardShortcuts: enableKeyboardShortcuts })), jsxRuntime.jsx(ContextMenuButton, { label: "Delete", onClick: handlers.onDelete, shortcut: keyboardShortcuts.delete, enableKeyboardShortcuts: enableKeyboardShortcuts })] }));
5777
+ }, children: [jsxRuntime.jsx("div", { className: "px-2 py-1 font-semibold text-gray-700", children: "Selection" }), jsxRuntime.jsx(ContextMenuButton, { label: "Copy", onClick: handlers.onCopy, shortcut: keyboardShortcuts.copy }), handlers.onDuplicate && (jsxRuntime.jsx(ContextMenuButton, { label: "Duplicate", onClick: handlers.onDuplicate, shortcut: keyboardShortcuts.duplicate })), jsxRuntime.jsx(ContextMenuButton, { label: "Delete", onClick: handlers.onDelete, shortcut: keyboardShortcuts.delete })] }));
5786
5778
  }
5787
5779
 
5788
5780
  function KeyboardShortcutToast({ message, duration = 1000, onClose, }) {
@@ -6354,14 +6346,23 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6354
6346
  return getBakeableOutputs(menuState.nodeId, wb, wb.registry, outputTypesMap);
6355
6347
  }, [menuState, wb, wb.registry, registryVersion, outputTypesMap]);
6356
6348
  // Keyboard shortcuts configuration
6357
- const enableKeyboardShortcuts = overrides?.enableKeyboardShortcuts !== false; // Default to true
6349
+ const keyboardShortcutEnables = React.useMemo(() => ({
6350
+ undo: true,
6351
+ redo: true,
6352
+ copy: true,
6353
+ paste: true,
6354
+ duplicate: true,
6355
+ selectAll: true,
6356
+ ...(overrides?.enableKeyboardShortcuts ?? {}),
6357
+ }), [overrides?.enableKeyboardShortcuts]);
6358
+ const isShortcutEnabled = React.useCallback((action) => keyboardShortcutEnables[action] !== false, [keyboardShortcutEnables]);
6359
+ const hasEnabledKeyboardShortcuts = React.useMemo(() => Object.values(keyboardShortcutEnables).some(Boolean), [keyboardShortcutEnables]);
6358
6360
  const keyboardShortcuts = React.useMemo(() => overrides?.keyboardShortcuts || {
6359
6361
  undo: "⌘/Ctrl + Z",
6360
6362
  redo: "⌘/Ctrl + Shift + Z",
6361
6363
  copy: "⌘/Ctrl + C",
6362
6364
  paste: "⌘/Ctrl + V",
6363
6365
  duplicate: "⌘/Ctrl + E",
6364
- duplicateWithEdges: "⌘/Ctrl + Shift + E",
6365
6366
  selectAll: "⌘/Ctrl + A",
6366
6367
  delete: "Delete",
6367
6368
  }, [overrides?.keyboardShortcuts]);
@@ -6369,7 +6370,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6369
6370
  const { toast, showToast, hideToast } = useKeyboardShortcutToast();
6370
6371
  // Keyboard shortcut handler
6371
6372
  React.useEffect(() => {
6372
- if (!enableKeyboardShortcuts)
6373
+ if (!hasEnabledKeyboardShortcuts)
6373
6374
  return;
6374
6375
  const handleKeyDown = async (e) => {
6375
6376
  // Check if target is inside WorkbenchCanvas container
@@ -6392,6 +6393,8 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6392
6393
  const key = e.key.toLowerCase();
6393
6394
  // Undo: Cmd/Ctrl + Z
6394
6395
  if (modKey && key === "z" && !e.shiftKey && !e.altKey) {
6396
+ if (!isShortcutEnabled("undo"))
6397
+ return;
6395
6398
  e.preventDefault();
6396
6399
  if (runner &&
6397
6400
  "onUndo" in defaultContextMenuHandlers &&
@@ -6407,6 +6410,8 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6407
6410
  }
6408
6411
  // Redo: Cmd/Ctrl + Shift + Z
6409
6412
  if (modKey && e.shiftKey && key === "z" && !e.altKey) {
6413
+ if (!isShortcutEnabled("redo"))
6414
+ return;
6410
6415
  e.preventDefault();
6411
6416
  if (runner &&
6412
6417
  "onRedo" in defaultContextMenuHandlers &&
@@ -6422,6 +6427,8 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6422
6427
  }
6423
6428
  // Copy: Cmd/Ctrl + C
6424
6429
  if (modKey && key === "c" && !e.shiftKey && !e.altKey) {
6430
+ if (!isShortcutEnabled("copy"))
6431
+ return;
6425
6432
  const selection = wb.getSelection();
6426
6433
  if (selection.nodes.length > 0 || selection.edges.length > 0) {
6427
6434
  e.preventDefault();
@@ -6439,6 +6446,8 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6439
6446
  }
6440
6447
  // Duplicate: Cmd/Ctrl + E
6441
6448
  if (modKey && key === "e" && !e.shiftKey && !e.altKey) {
6449
+ if (!isShortcutEnabled("duplicate"))
6450
+ return;
6442
6451
  const selection = wb.getSelection();
6443
6452
  if (selection.nodes.length === 1 &&
6444
6453
  nodeContextMenuHandlers?.onDuplicate) {
@@ -6458,20 +6467,10 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6458
6467
  }
6459
6468
  return;
6460
6469
  }
6461
- // Duplicate with edges: Cmd/Ctrl + Shift + E
6462
- if (modKey && key === "e" && e.shiftKey && !e.altKey) {
6463
- const selection = wb.getSelection();
6464
- if (selection.nodes.length === 1 &&
6465
- nodeContextMenuHandlers?.onDuplicateWithEdges) {
6466
- e.preventDefault();
6467
- const modKeyLabel = isMac ? "⌘" : "Ctrl";
6468
- showToast(`Duplicate with edges (${modKeyLabel} + Shift + E)`);
6469
- nodeContextMenuHandlers.onDuplicateWithEdges();
6470
- }
6471
- return;
6472
- }
6473
6470
  // Paste: Cmd/Ctrl + V
6474
6471
  if (modKey && key === "v" && !e.shiftKey && !e.altKey) {
6472
+ if (!isShortcutEnabled("paste"))
6473
+ return;
6475
6474
  e.preventDefault();
6476
6475
  if ("hasPasteData" in defaultContextMenuHandlers &&
6477
6476
  defaultContextMenuHandlers.hasPasteData &&
@@ -6490,6 +6489,8 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6490
6489
  }
6491
6490
  // Select All: Cmd/Ctrl + A
6492
6491
  if (modKey && key === "a" && !e.shiftKey && !e.altKey) {
6492
+ if (!isShortcutEnabled("selectAll"))
6493
+ return;
6493
6494
  e.preventDefault();
6494
6495
  if (defaultContextMenuHandlers.onSelectAll) {
6495
6496
  const modKeyLabel = isMac ? "⌘" : "Ctrl";
@@ -6506,7 +6507,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6506
6507
  window.removeEventListener("keydown", handleKeyDown);
6507
6508
  };
6508
6509
  }, [
6509
- enableKeyboardShortcuts,
6510
+ hasEnabledKeyboardShortcuts,
6510
6511
  wb,
6511
6512
  runner,
6512
6513
  defaultContextMenuHandlers,
@@ -6514,6 +6515,7 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6514
6515
  nodeContextMenuHandlers,
6515
6516
  rfInstanceRef,
6516
6517
  showToast,
6518
+ isShortcutEnabled,
6517
6519
  ]);
6518
6520
  // Get custom renderers from UI extension registry (reactive to uiVersion changes)
6519
6521
  const { BackgroundRenderer, MinimapRenderer, ControlsRenderer, DefaultContextMenuRenderer, NodeContextMenuRenderer, SelectionContextMenuRenderer, connectionLineRenderer, } = React.useMemo(() => {
@@ -6563,14 +6565,10 @@ const WorkbenchCanvasComponent = React.forwardRef((props, ref) => {
6563
6565
  userOnInit(inst);
6564
6566
  }
6565
6567
  }, onConnect: onConnect, onEdgesChange: onEdgesChange, onEdgesDelete: onEdgesDelete, onNodesDelete: onNodesDelete, onNodesChange: onNodesChange, onMove: onMove, onMoveEnd: onMoveEnd, deleteKeyCode: ["Backspace", "Delete"], proOptions: { hideAttribution: true }, noDragClassName: "wb-nodrag", noWheelClassName: "wb-nowheel", noPanClassName: "wb-nopan", children: [BackgroundRenderer ? (jsxRuntime.jsx(BackgroundRenderer, {})) : (jsxRuntime.jsx(react.Background, { id: "workbench-canvas-background", variant: react.BackgroundVariant.Dots, gap: 12, size: 1 })), MinimapRenderer ? jsxRuntime.jsx(MinimapRenderer, {}) : jsxRuntime.jsx(react.MiniMap, {}), ControlsRenderer ? jsxRuntime.jsx(ControlsRenderer, {}) : jsxRuntime.jsx(react.Controls, {}), menuState?.type === "default" &&
6566
- (DefaultContextMenuRenderer ? (jsxRuntime.jsx(DefaultContextMenuRenderer, { open: true, clientPos: menuState.menuPos, handlers: defaultContextMenuHandlers, registry: wb.registry, nodeIds: nodeIds, ...(enableKeyboardShortcuts !== false
6567
- ? { enableKeyboardShortcuts, keyboardShortcuts }
6568
- : {}) })) : (jsxRuntime.jsx(DefaultContextMenu, { open: true, clientPos: menuState.menuPos, handlers: defaultContextMenuHandlers, registry: wb.registry, nodeIds: nodeIds, enableKeyboardShortcuts: enableKeyboardShortcuts, keyboardShortcuts: keyboardShortcuts }))), menuState?.type === "node" &&
6568
+ (DefaultContextMenuRenderer ? (jsxRuntime.jsx(DefaultContextMenuRenderer, { open: true, clientPos: menuState.menuPos, handlers: defaultContextMenuHandlers, registry: wb.registry, nodeIds: nodeIds, keyboardShortcuts: keyboardShortcuts })) : (jsxRuntime.jsx(DefaultContextMenu, { open: true, clientPos: menuState.menuPos, handlers: defaultContextMenuHandlers, registry: wb.registry, nodeIds: nodeIds, keyboardShortcuts: keyboardShortcuts }))), menuState?.type === "node" &&
6569
6569
  nodeContextMenuHandlers &&
6570
- (NodeContextMenuRenderer ? (jsxRuntime.jsx(NodeContextMenuRenderer, { open: true, clientPos: menuState.menuPos, nodeId: menuState.nodeId, handlers: nodeContextMenuHandlers, bakeableOutputs: bakeableOutputs, runMode: runMode, wb: wb, ...(enableKeyboardShortcuts !== false
6571
- ? { enableKeyboardShortcuts, keyboardShortcuts }
6572
- : {}) })) : (jsxRuntime.jsx(NodeContextMenu, { open: true, clientPos: menuState.menuPos, nodeId: menuState.nodeId, handlers: nodeContextMenuHandlers, bakeableOutputs: bakeableOutputs, runMode: runMode }))), menuState?.type === "selection" &&
6573
- (SelectionContextMenuRenderer ? (jsxRuntime.jsx(SelectionContextMenuRenderer, { open: true, clientPos: menuState.menuPos, handlers: selectionContextMenuHandlers, enableKeyboardShortcuts: enableKeyboardShortcuts, keyboardShortcuts: keyboardShortcuts })) : (jsxRuntime.jsx(SelectionContextMenu, { open: true, clientPos: menuState.menuPos, handlers: selectionContextMenuHandlers, enableKeyboardShortcuts: enableKeyboardShortcuts, keyboardShortcuts: keyboardShortcuts })))] }), jsxRuntime.jsx(SelectionBoundOverlay, { selection: selection, rfInstance: rfInstanceRef.current, viewportTick: selectionOverlayTick })] }), toast && (jsxRuntime.jsx(KeyboardShortcutToast, { message: toast.message, onClose: hideToast }, toast.id))] }));
6570
+ (NodeContextMenuRenderer ? (jsxRuntime.jsx(NodeContextMenuRenderer, { open: true, clientPos: menuState.menuPos, nodeId: menuState.nodeId, handlers: nodeContextMenuHandlers, bakeableOutputs: bakeableOutputs, runMode: runMode, wb: wb, keyboardShortcuts: keyboardShortcuts })) : (jsxRuntime.jsx(NodeContextMenu, { open: true, clientPos: menuState.menuPos, nodeId: menuState.nodeId, handlers: nodeContextMenuHandlers, bakeableOutputs: bakeableOutputs, runMode: runMode }))), menuState?.type === "selection" &&
6571
+ (SelectionContextMenuRenderer ? (jsxRuntime.jsx(SelectionContextMenuRenderer, { open: true, clientPos: menuState.menuPos, handlers: selectionContextMenuHandlers, keyboardShortcuts: keyboardShortcuts })) : (jsxRuntime.jsx(SelectionContextMenu, { open: true, clientPos: menuState.menuPos, handlers: selectionContextMenuHandlers, keyboardShortcuts: keyboardShortcuts })))] }), jsxRuntime.jsx(SelectionBoundOverlay, { selection: selection, rfInstance: rfInstanceRef.current, viewportTick: selectionOverlayTick })] }), toast && (jsxRuntime.jsx(KeyboardShortcutToast, { message: toast.message, onClose: hideToast }, toast.id))] }));
6574
6572
  });
6575
6573
  const WorkbenchCanvas = WorkbenchCanvasComponent;
6576
6574