@dudousxd/nestjs-catalog-react 0.21.0 → 0.22.0

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,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Background, BackgroundVariant, ConnectionLineType, Controls, MiniMap, NodeToolbar, Panel, Position, ReactFlow, ReactFlowProvider, useReactFlow, } from '@xyflow/react';
2
+ import { Background, BackgroundVariant, ConnectionLineType, Controls, MiniMap, Panel, ReactFlow, ReactFlowProvider, useReactFlow, } from '@xyflow/react';
3
3
  // React Flow ships its own stylesheet and renders as an unstyled pile of divs
4
4
  // without it — no edges, every node at the top-left corner. Imported by the
5
5
  // component that needs it rather than left to the host, because a missing
@@ -7,7 +7,7 @@ import { Background, BackgroundVariant, ConnectionLineType, Controls, MiniMap, N
7
7
  // See src/styles.d.ts for why `tsc` tolerates this import.
8
8
  import '@xyflow/react/dist/style.css';
9
9
  import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
10
- import { ArrowRight, ChevronDown, CircleAlert, CircleDashed, Code2, Database, ExternalLink, Filter, GitBranch, Info, LayoutGrid, Link2, Loader2, Maximize2, Minimize2, PanelRight, Plug, Plus, Repeat, Save, Trash2, TriangleAlert, Unplug, X, } from 'lucide-react';
10
+ import { ArrowRight, ChevronDown, CircleAlert, CircleDashed, Code2, Database, ExternalLink, Filter, GitBranch, Info, LayoutGrid, Loader2, Maximize2, Minimize2, PanelRight, Plug, Plus, Repeat, Save, Trash2, TriangleAlert, Unplug, X, } from 'lucide-react';
11
11
  import { AnimatePresence, motion, useReducedMotion } from 'motion/react';
12
12
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
13
13
  import { connectionOptionsFor } from './ConnectionPanel';
@@ -25,13 +25,18 @@ import { Select, SelectField } from './ui/select';
25
25
  import { Sheet } from './ui/sheet';
26
26
  import { Switch } from './ui/switch';
27
27
  import { Tooltip, TooltipProvider } from './ui/tooltip';
28
+ import { buildCanvasMenu, deleteCost, } from './workflow/canvas-menu';
29
+ import { graphWithNodeBetween, newEdge, newKindsFrom, newNodeOfKind, nodeBetween, uniqueName, } from './workflow/create';
28
30
  import { WorkflowEdgeProvider, workflowEdgeTypes } from './workflow/edges';
29
- import { NODE_HEIGHT, NODE_WIDTH, defaultLabel, describeFilterPredicate, flowingEdgeIds, layout, layoutIfUnarranged, nextPosition, toFlowEdges, toFlowNodes, } from './workflow/graph';
31
+ import { defaultLabel, describeFilterPredicate, flowingEdgeIds, layout, layoutIfUnarranged, nextPosition, toFlowEdges, toFlowNodes, } from './workflow/graph';
30
32
  import { HistoryControls, keepKnown, namesOf, nodeEditAction, reverted, snapshotOf, undone, useUndoShortcut, useUnsavedGuard, withEdit, } from './workflow/history';
31
33
  import { PublishControls, RunControls, SchedulePanel, ShrinkRefusalNote, WorkflowStatusBadge, } from './workflow/lifecycle';
34
+ import { CanvasContextMenu, NodeActionsToolbar } from './workflow/menu';
32
35
  import { WORKFLOW_BRANCH_LABELS, WORKFLOW_FILTER_MAX_DEPTH, WORKFLOW_FILTER_MAX_VALUES, WORKFLOW_FILTER_OPERATORS, WORKFLOW_NODE_KINDS, callableWorkflowBlock, describeDurability, isWorkflowBranchLabel, isWorkflowFilterOperator, isWorkflowFilterPredicateKind, isWorkflowNodeKind, isWorkflowPredicateKind, newLocalId, nodeName, producedTypes, unreachableFilterPredicateKind, unreachableNodeKind, unreachablePredicateKind, workflowNarrowedTypes, } from './workflow/model';
33
36
  import { WORKFLOW_NAME } from './workflow/name';
34
37
  import { WorkflowNodeProvider, workflowNodeTypes } from './workflow/nodes';
38
+ import { freeSpot, placeNextTo } from './workflow/place';
39
+ import { removeNodes, wiresOn } from './workflow/removal';
35
40
  import { RunsAsPanel } from './workflow/runs';
36
41
  import { canConnect, edgeId, hasBlockingProblem, problemsByNode, validateWorkflow, } from './workflow/validate';
37
42
  import { PendingWireLine, WiringHint, useClickWiring, } from './workflow/wiring';
@@ -556,92 +561,6 @@ function nextSelection(current, changes) {
556
561
  }
557
562
  return next;
558
563
  }
559
- /**
560
- * A fresh node of one kind, carrying only the fields that kind has.
561
- *
562
- * Built per kind rather than as one shape with optional fields, because the
563
- * executable model is a discriminated union: a source carries a source kind and
564
- * a config, a transform carries a transform, a sink carries the type it commits,
565
- * and nothing carries a field belonging to another kind.
566
- */
567
- function newNodeOfKind(kind, id, position, name) {
568
- if (kind === 'source') {
569
- return { id, name, kind: 'source', sourceKind: 'http', config: {}, position };
570
- }
571
- if (kind === 'transform') {
572
- return { id, name, kind: 'transform', transformId: '', position };
573
- }
574
- if (kind === 'call') {
575
- // Both empty, and the graph is invalid until they are not — deliberately.
576
- // There is no list of workflows to default from (see `CallableWorkflowRef`
577
- // in core), and defaulting a *version* to "1" would be the one guess that
578
- // matters: it would silently pin whichever code happens to be registered as
579
- // version 1 in whatever deployment this graph is promoted into.
580
- return { id, name, kind: 'call', callName: '', callVersion: '', config: {}, position };
581
- }
582
- if (kind === 'if') {
583
- // No variable, so the graph is invalid until somebody names one. There is
584
- // nothing to guess: which variable tells this deployment apart from another
585
- // is the entire content of the node, and a default would be a decision the
586
- // graph appears to make and nobody authored.
587
- //
588
- // The *kind* of test does get a default, and it is the deployment one,
589
- // because a predicate has to be one of them and an empty variable name is a
590
- // gate that visibly refuses to publish. A row-count gate with its default
591
- // threshold would publish happily while testing something nobody chose.
592
- return { id, name, kind: 'if', predicate: { kind: 'env', envVar: '' }, position };
593
- }
594
- if (kind === 'filter') {
595
- // One empty comparison rather than an empty `all`, and rather than nothing.
596
- //
597
- // Nothing is not available: the model has no "no predicate yet" state, on
598
- // purpose, because a filter whose test is absent has to be given one by
599
- // somebody and every default is a rule about rows nobody wrote. An empty
600
- // `all` *is* representable and is refused by the validator, which is exactly
601
- // why it is not the starting point — a group with no conditions keeps every
602
- // row, so a filter that started that way would draw as a working node that
603
- // does nothing.
604
- //
605
- // So it starts as one comparison with no column, which the validator refuses
606
- // by name: the node says "needs a column" on the canvas from the moment it
607
- // is dropped. The operator defaults to `equals` because it is the only one
608
- // that is a guess about *form* rather than about data — every other choice
609
- // implies something about the column's type before a column is chosen.
610
- return {
611
- id,
612
- name,
613
- kind: 'filter',
614
- predicate: { kind: 'compare', column: '', operator: 'equals', value: '' },
615
- position,
616
- };
617
- }
618
- if (kind === 'sink') {
619
- return { id, name, kind: 'sink', targetType: '', position };
620
- }
621
- return unreachableNodeKind(kind, 'newNodeOfKind');
622
- }
623
- /**
624
- * A wire, with its branch already decided when it leaves an `if`.
625
- *
626
- * Assigned here rather than left blank for somebody to fill in, because a blank
627
- * one is refused by `validateWorkflow` and the refusal would fire on the very
628
- * first wire out of a node somebody just created — the premature-error problem
629
- * `partitionProblems` exists to describe, arrived at from a different direction.
630
- *
631
- * The first wire out of a gate is the `then`, the second is the `else`, and
632
- * after that it is `then` again. That ordering is not arbitrary: those are the
633
- * two somebody is drawing when they draw a gate, in that order, and a third wire
634
- * is fan-out on a side they then choose in the inspector. Every one of them is
635
- * editable there, so this is a default and never a decision.
636
- */
637
- function newEdge(nodes, edges, from, to) {
638
- const source = nodes.find((node) => node.id === from);
639
- if (source?.kind !== 'if')
640
- return { from, to };
641
- const taken = edges.filter((edge) => edge.from === from).map((edge) => edge.branch);
642
- const free = WORKFLOW_BRANCH_LABELS.find((label) => !taken.includes(label));
643
- return { from, to, branch: free ?? 'then' };
644
- }
645
564
  /** The same graph with one wire moved onto the other side of its gate. */
646
565
  function edgeOnBranch(edges, moving, branch) {
647
566
  const id = edgeId(moving);
@@ -709,94 +628,6 @@ function nodeWiredFrom(draft, fromId, kind) {
709
628
  function runningTransform(nodes, nodeId, transformId) {
710
629
  return nodes.map((node) => node.id === nodeId && node.kind === 'transform' ? { ...node, transformId } : node);
711
630
  }
712
- /**
713
- * A name nobody has used yet, so the fourth transform is not also "Transform".
714
- *
715
- * Every node used to be born called exactly `defaultLabel(kind)`, which is how
716
- * a graph ends up with three boxes called "Transform" and a problem message
717
- * that has to fall back to naming the id — `Sink (sink_3b5a…)` — because the
718
- * name it was given identifies nothing. A message that names an id is a message
719
- * whose reader has to go hunting for which box it means.
720
- *
721
- * Compared against what nodes are *called* rather than against a counter, so
722
- * renaming "Transform 2" to "Join" frees the number again, and so a name typed
723
- * by hand is never duplicated by one generated afterwards. `nodeName` is what
724
- * the rest of the screen displays, so it is what has to be unique.
725
- */
726
- function uniqueName(nodes, kind) {
727
- const base = defaultLabel(kind);
728
- const taken = new Set(nodes.map((node) => nodeName(node)));
729
- if (!taken.has(base))
730
- return base;
731
- // `taken.size + 1` candidates for `taken.size` names: one of them is free, so
732
- // this always returns from inside the loop.
733
- for (let n = 2; n <= taken.size + 1; n += 1) {
734
- const candidate = `${base} ${n}`;
735
- if (!taken.has(candidate))
736
- return candidate;
737
- }
738
- return `${base} ${taken.size + 2}`;
739
- }
740
- /**
741
- * The grid `layout` uses, restated because it keeps its gaps to itself.
742
- *
743
- * `NODE_WIDTH` and `NODE_HEIGHT` are exported from `workflow/graph`; the column
744
- * and row gaps are not. They are repeated here so that a node created by wiring
745
- * from another one lands on the same grid Tidy would have put it on — otherwise
746
- * the two disagree and pressing Tidy shuffles everything by a few pixels for no
747
- * reason a reader can see. If they ever drift, the consequence is spacing that
748
- * looks slightly off, never a node in the wrong place: the placement below is
749
- * defined by what is *occupied*, not by these numbers.
750
- */
751
- const COLUMN_STEP = NODE_WIDTH + 96;
752
- const ROW_STEP = NODE_HEIGHT + 32;
753
- /**
754
- * Where a node created *by wiring from another node* goes.
755
- *
756
- * One column to the right of the node that spawned it, because that is exactly
757
- * what the canvas's arrangement means: `layout` puts a node one column past the
758
- * deepest thing feeding it, and a node created by this action is fed by that
759
- * node and nothing else. So the position that matches the picture is not a
760
- * guess — it is the position the layout would have chosen anyway.
761
- *
762
- * Then down a row at a time until the spot is free. The three obvious
763
- * alternatives are each wrong in their own way: under the cursor puts a node
764
- * wherever a menu happened to be dismissed, on top of an existing node reads as
765
- * "the button did nothing", and off-screen — which is what `nextPosition` does,
766
- * correctly, for the toolbar's add buttons, since those have no parent to sit
767
- * beside — leaves somebody looking at an unchanged canvas. Sitting beside its
768
- * parent means it is on screen whenever its parent is, which is the only
769
- * guarantee available without measuring the viewport.
770
- */
771
- function placeNextTo(from, nodes) {
772
- const taken = new Set(nodes.map((node) => `${node.position?.x ?? 0},${node.position?.y ?? 0}`));
773
- const x = (from.position?.x ?? 0) + COLUMN_STEP;
774
- let y = from.position?.y ?? 0;
775
- while (taken.has(`${x},${y}`))
776
- y += ROW_STEP;
777
- return { x, y };
778
- }
779
- /**
780
- * Which kinds of new node this one could legally feed — asked, never restated.
781
- *
782
- * The menu must offer only edges the graph allows, and the temptation is to
783
- * write that down: "a source may feed a transform or a sink; nothing follows a
784
- * sink". Writing it down is how the canvas ends up with a second copy of rules
785
- * that live in `canConnect`, and the first time the two disagree the menu either
786
- * offers an edge that is then refused or hides one that was always fine.
787
- *
788
- * So this builds a throwaway node of each kind, drops it into a copy of the
789
- * graph, and asks `canConnect` — the same function the drag uses, the same one
790
- * the "send its output to" picker filters with. The probe is never stored and
791
- * its id never leaves this function. When a rule changes, this follows.
792
- */
793
- function newKindsFrom(from, nodes, edges) {
794
- const probeId = '__probe__';
795
- return WORKFLOW_NODE_KINDS.filter((kind) => {
796
- const probe = newNodeOfKind(kind, probeId, { x: 0, y: 0 }, probeId);
797
- return canConnect([...nodes, probe], edges, from.id, probeId).ok;
798
- });
799
- }
800
631
  /**
801
632
  * Problems about a node nobody has finished, held back from the error list.
802
633
  *
@@ -1180,6 +1011,116 @@ function FocusMiniMap({ focused }) {
1180
1011
  // claiming a corner and just draws in the box it is given.
1181
1012
  position: "bottom-left", nodeColor: (node) => miniMapColor(node.data), className: cn('!static !m-0', '!overflow-hidden !rounded-lg !border !border-zinc-200 !shadow-sm dark:!border-zinc-800') }) }));
1182
1013
  }
1014
+ /**
1015
+ * What the hover toolbar's delete button says it will do.
1016
+ *
1017
+ * The whole warning, on the tooltip, because that button is an unlabelled icon
1018
+ * and the gesture behind it does not stop to ask. It names the node, counts the
1019
+ * wires that go with it, adds the published-graph consequence where there is
1020
+ * one, and points at the undo that makes the whole trade defensible.
1021
+ */
1022
+ function deleteHint(node, draft, stored) {
1023
+ if (!node)
1024
+ return 'Remove this node';
1025
+ const cost = deleteCost(wiresOn(draft.edges, [node.id]), stored?.status === 'ready') ??
1026
+ 'Nothing is wired to it.';
1027
+ return `Delete "${nodeName(node)}". ${cost} Ctrl+Z takes it back.`;
1028
+ }
1029
+ /**
1030
+ * The menu for a target, or nothing at all when there is no target.
1031
+ *
1032
+ * A free function rather than a ternary in the canvas, and the same for
1033
+ * {@link nodeTarget} and {@link idsOf} below. Each of them replaces one branch
1034
+ * inside a component that is the largest thing in this package and is held to a
1035
+ * complexity ceiling for exactly that reason — and each reads better as a named
1036
+ * thing than as a `?:` in the middle of a render.
1037
+ */
1038
+ function sectionsFor(target, context) {
1039
+ return target ? buildCanvasMenu(target, context) : [];
1040
+ }
1041
+ /** The hovered or selected node as a menu target, when there is one. */
1042
+ function nodeTarget(node) {
1043
+ return node ? { kind: 'node', nodeId: node.id } : undefined;
1044
+ }
1045
+ /** One node's id as a list, or an empty list. What `dropNodes` wants either way. */
1046
+ function idsOf(node) {
1047
+ return node ? [node.id] : [];
1048
+ }
1049
+ /**
1050
+ * A menu about to open, with a wire turned back into the graph's own edge.
1051
+ *
1052
+ * React Flow's edge carries `source`/`target` and no branch, and the branch is
1053
+ * the one thing an edge menu has to know: offering "move it to the else branch"
1054
+ * on a wire that is on no branch would be offering a change `validateWorkflow`
1055
+ * refuses, and offering nothing on a wire that IS on one would hide the largest
1056
+ * single change anybody can make from a menu.
1057
+ *
1058
+ * `null` when the wire is not in the draft at all — a stale click, which happens
1059
+ * when a menu is opened on the frame a graph is being replaced. Nothing is a
1060
+ * better answer there than a menu about an edge that no longer exists.
1061
+ */
1062
+ function menuOpening(target, anchor, edges) {
1063
+ if (target.kind !== 'edge')
1064
+ return { target, anchor };
1065
+ const found = edges.find((edge) => edge.from === target.edge.from && edge.to === target.edge.to);
1066
+ return found ? { target: { kind: 'edge', edge: found }, anchor } : null;
1067
+ }
1068
+ /**
1069
+ * What the menu is about, said for somebody who cannot see where it opened.
1070
+ *
1071
+ * A context menu is normally identified by the thing under the pointer, and a
1072
+ * screen reader user has no pointer — so "Menu" would be the whole of what they
1073
+ * were told about a popup with fourteen items in it. Every branch names the node
1074
+ * or nodes in the words that are on the canvas.
1075
+ */
1076
+ function describeMenuTarget(target, nodes) {
1077
+ if (!target)
1078
+ return 'Canvas menu';
1079
+ if (target.kind === 'node')
1080
+ return `Actions for ${nodeLabelIn(nodes, target.nodeId)}`;
1081
+ if (target.kind === 'edge') {
1082
+ const from = nodeLabelIn(nodes, target.edge.from);
1083
+ return `Actions for the connection from ${from} to ${nodeLabelIn(nodes, target.edge.to)}`;
1084
+ }
1085
+ if (target.kind === 'selection')
1086
+ return `Actions for ${target.nodeIds.length} selected nodes`;
1087
+ return 'Canvas menu';
1088
+ }
1089
+ /**
1090
+ * Where a context menu should hang, given the event that asked for one.
1091
+ *
1092
+ * A `contextmenu` event is not always a right-click. Pressing the dedicated
1093
+ * context-menu key, or Shift+F10, makes the browser dispatch exactly the same
1094
+ * event type at whatever has focus — which is what gives this canvas keyboard
1095
+ * parity for free, and is also the case that goes wrong if the coordinates on
1096
+ * the event are trusted.
1097
+ *
1098
+ * So a pointer is detected rather than assumed, and when there is not one the
1099
+ * anchor is the focused element's own box. That is better than a corner and
1100
+ * better than the viewport centre: the menu appears attached to the thing it
1101
+ * acts on, which is the same promise the pointer version makes.
1102
+ *
1103
+ * `currentTarget` is read synchronously, inside the dispatch, which is the only
1104
+ * time React guarantees it is set.
1105
+ */
1106
+ function anchorFor(event) {
1107
+ // `button === 2` and nothing else, which is a correction made in a browser
1108
+ // rather than a guess. The first version of this also accepted "the
1109
+ // coordinates are not (0, 0)" as evidence of a pointer, on the theory that a
1110
+ // keyboard-fired event carries none — and Chrome carries the LAST MOUSE
1111
+ // POSITION instead, measured: Shift+F10 on a node at (28, 443) produced a
1112
+ // `contextmenu` with `button: -1` and `clientX/Y` of (188, 500), left over
1113
+ // from a right-click somewhere else entirely. A keyboard user would have got
1114
+ // the menu wherever they last happened to click.
1115
+ if (event.button === 2)
1116
+ return { x: event.clientX, y: event.clientY, width: 0, height: 0 };
1117
+ const on = event.currentTarget;
1118
+ if (on instanceof Element) {
1119
+ const box = on.getBoundingClientRect();
1120
+ return { x: box.x, y: box.y, width: box.width, height: box.height };
1121
+ }
1122
+ return { x: 0, y: 0, width: 0, height: 0 };
1123
+ }
1183
1124
  /**
1184
1125
  * The graph itself, and the two states in which there is no graph to draw.
1185
1126
  *
@@ -1187,7 +1128,7 @@ function FocusMiniMap({ focused }) {
1187
1128
  * place of the screen, so the header and its controls stay put while a refetch
1188
1129
  * resolves — and a failed read never looks like an empty workflow.
1189
1130
  */
1190
- function GraphSurface({ loading, failed, error, onRetry, canEdit, draft, flowNodes, flowEdges, onInspect, onEditCode, onNodesChange, onEdgesChange, onConnect, isValidConnection, onConnectEnd, onNodeEnter, onNodeLeave, onPaneClick, onDisconnect, wiring, wiringRefusal, nodeMenu, fitPadding, focused, }) {
1131
+ function GraphSurface({ loading, failed, error, onRetry, canEdit, draft, flowNodes, flowEdges, onInspect, onEditCode, onNodesChange, onEdgesChange, onConnect, isValidConnection, onConnectEnd, onNodeEnter, onNodeLeave, onPaneClick, onDisconnect, onOpenMenu, wiring, wiringRefusal, nodeMenu, fitPadding, focused, }) {
1191
1132
  /*
1192
1133
  * Memoised because they are context values read by every node and every edge
1193
1134
  * on the canvas. Written inline, as they were, each of these was a fresh
@@ -1198,6 +1139,21 @@ function GraphSurface({ loading, failed, error, onRetry, canEdit, draft, flowNod
1198
1139
  */
1199
1140
  const nodeHandlers = useMemo(() => ({ onInspect, onEditCode, canEdit, wiring }), [onInspect, onEditCode, canEdit, wiring]);
1200
1141
  const edgeHandlers = useMemo(() => ({ onDisconnect, canEdit }), [onDisconnect, canEdit]);
1142
+ const { screenToFlowPosition } = useReactFlow();
1143
+ /**
1144
+ * One place that turns a `contextmenu` event into "this thing, anchored here".
1145
+ *
1146
+ * `preventDefault` is what takes the browser's own menu off the table, and it
1147
+ * is called ONLY from the four React Flow handlers below — a node, a wire, a
1148
+ * selection, and the pane. Every other right-click on the screen, including
1149
+ * every text field in the chrome floating over this canvas, is left entirely
1150
+ * alone, because a canvas has nothing better than cut/copy/paste to offer
1151
+ * inside an input.
1152
+ */
1153
+ const openMenu = useCallback((event, target) => {
1154
+ event.preventDefault();
1155
+ onOpenMenu(target, anchorFor(event));
1156
+ }, [onOpenMenu]);
1201
1157
  return (
1202
1158
  /*
1203
1159
  * The surface IS the screen: pinned to all four edges, with the chrome
@@ -1205,7 +1161,20 @@ function GraphSurface({ loading, failed, error, onRetry, canEdit, draft, flowNod
1205
1161
  * so there is no border and no rounded corner — a full-bleed canvas that
1206
1162
  * draws its own frame is a canvas pretending to still be a widget.
1207
1163
  */
1208
- _jsxs("div", { className: "absolute inset-0", children: [loading && _jsx(CanvasSkeleton, {}), failed && _jsx(CanvasFailure, { error: error, onRetry: onRetry }), !loading && !failed && (_jsx(WorkflowNodeProvider, { handlers: nodeHandlers, children: _jsx(WorkflowEdgeProvider, { handlers: edgeHandlers, children: _jsxs(ReactFlow, { className: CANVAS_THEME, nodes: flowNodes, edges: flowEdges, nodeTypes: workflowNodeTypes, edgeTypes: workflowEdgeTypes, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: onConnect, isValidConnection: isValidConnection, onConnectEnd: onConnectEnd, onNodeMouseEnter: (_event, node) => onNodeEnter(node.id), onNodeMouseLeave: onNodeLeave, onPaneClick: onPaneClick, connectionLineType: ConnectionLineType.SmoothStep,
1164
+ _jsxs("div", { className: "absolute inset-0", children: [loading && _jsx(CanvasSkeleton, {}), failed && _jsx(CanvasFailure, { error: error, onRetry: onRetry }), !loading && !failed && (_jsx(WorkflowNodeProvider, { handlers: nodeHandlers, children: _jsx(WorkflowEdgeProvider, { handlers: edgeHandlers, children: _jsxs(ReactFlow, { className: CANVAS_THEME, nodes: flowNodes, edges: flowEdges, nodeTypes: workflowNodeTypes, edgeTypes: workflowEdgeTypes, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: onConnect, isValidConnection: isValidConnection, onConnectEnd: onConnectEnd, onNodeMouseEnter: (_event, node) => onNodeEnter(node.id), onNodeMouseLeave: onNodeLeave, onPaneClick: onPaneClick, onNodeContextMenu: (event, node) => openMenu(event, { kind: 'node', nodeId: node.id }), onEdgeContextMenu: (event, edge) => openMenu(event, { kind: 'edge', edge: { from: edge.source, to: edge.target } }),
1165
+ // Several nodes at once gets its own target rather than falling
1166
+ // through to whichever node happened to be under the pointer: a
1167
+ // menu offering "send its output to" against five boxes would be
1168
+ // offering an action whose "its" has no referent.
1169
+ onSelectionContextMenu: (event, nodes) => openMenu(event, { kind: 'selection', nodeIds: nodes.map((node) => node.id) }),
1170
+ // The point is converted to GRAPH coordinates here and not later,
1171
+ // because "here" is only meaningful while the viewport is what it
1172
+ // was when the click happened — and a menu can sit open across a
1173
+ // pan. What the menu carries is the spot, not the pixel.
1174
+ onPaneContextMenu: (event) => openMenu(event, {
1175
+ kind: 'pane',
1176
+ at: screenToFlowPosition({ x: event.clientX, y: event.clientY }),
1177
+ }), connectionLineType: ConnectionLineType.SmoothStep,
1209
1178
  // Off, so there is exactly ONE click path through a handle and it
1210
1179
  // is the one in `workflow/wiring.tsx`. React Flow's own click
1211
1180
  // wiring connects but draws nothing while it is open and cannot
@@ -1220,80 +1189,6 @@ function GraphSurface({ loading, failed, error, onRetry, canEdit, draft, flowNod
1220
1189
  // back down into the corner it vacated.
1221
1190
  '!bottom-0 lg:!bottom-[9.5rem]') }), _jsx(FocusMiniMap, { focused: focused }), _jsx(PendingWireLine, { pending: wiring.pending }), _jsx(WiringHint, { pending: wiring.pending, refusal: wiringRefusal, nodes: draft.nodes, onCancel: wiring.cancel }), nodeMenu] }) }) }))] }));
1222
1191
  }
1223
- /**
1224
- * The wiring control that lives on a node, and the menu behind it.
1225
- *
1226
- * WHY THIS EXISTS
1227
- * ---------------
1228
- * Until this, the only way to make an edge on this canvas was to drag from one
1229
- * handle to another. That is React Flow's gesture, it is perfectly good, and it
1230
- * is invisible: nothing on the screen says the small circles are draggable, so
1231
- * the canvas worked for people who had used a node editor before and read as
1232
- * broken to everybody else. The wiring rail and the inspector's picker were the
1233
- * answers for keyboard users — they are still the answers for keyboard users —
1234
- * but reaching either means knowing to open a panel first.
1235
- *
1236
- * A control on the node, offering "connect to something that exists" and "make
1237
- * the next thing and connect it", is the ordinary affordance for this kind of
1238
- * editor. Its absence was the whole complaint.
1239
- *
1240
- * WHAT IT OFFERS
1241
- * --------------
1242
- * Only edges the graph allows, and it does not know which those are. Every
1243
- * option — existing target, new kind, all of it — is filtered by `canConnect`,
1244
- * the same function the drag is refused by. Offering an edge that is then
1245
- * rejected teaches somebody the menu is a guess; restating the node-kind rules
1246
- * here so the menu could be "smart" would be the same rules in a second place,
1247
- * which is how they drift.
1248
- *
1249
- * Disconnect is here too. Removing a wire otherwise means finding a two-pixel
1250
- * line on a canvas and pressing Delete, or scrolling the rail to the right row;
1251
- * the node is where somebody knows *which* wire they mean, so it is where the
1252
- * offer belongs.
1253
- *
1254
- * HOW IT IS PLACED
1255
- * ----------------
1256
- * `NodeToolbar` with an explicit `nodeId`, which is React Flow's documented way
1257
- * of rendering a toolbar for a node from outside that node's own component. So
1258
- * the position comes from the same measurements the canvas draws with, and this
1259
- * file does not do arithmetic on a viewport transform.
1260
- */
1261
- function NodeWiringMenu({ node, draft, canEdit, open, onOpenChange, onHoverChange, onConnect, onConnectToNew, onDisconnect, }) {
1262
- if (!node || !canEdit)
1263
- return null;
1264
- const targets = draft.nodes.filter((candidate) => canConnect(draft.nodes, draft.edges, node.id, candidate.id).ok);
1265
- const kinds = newKindsFrom(node, draft.nodes, draft.edges);
1266
- const wires = draft.edges.filter((edge) => edge.from === node.id || edge.to === node.id);
1267
- const label = (id) => nodeLabelIn(draft.nodes, id);
1268
- return (_jsxs(NodeToolbar, { nodeId: node.id, isVisible: true, position: Position.Top, align: "end",
1269
- // Flush against the node. The pointer has to travel from the node to this
1270
- // toolbar to use it, and any gap is canvas — which means `onNodeMouseLeave`
1271
- // fires with nothing to catch it and the control vanishes on the way to
1272
- // itself. Touching, the leave and the enter land in the same React batch.
1273
- offset: 0, onMouseEnter: () => onHoverChange(true), onMouseLeave: () => onHoverChange(false), className: "flex flex-col items-end gap-1", children: [_jsx(Tooltip, { content: `Wire ${nodeName(node)} to something, or make the next node from it.`, children: _jsxs("button", { type: "button", onClick: () => onOpenChange(!open), "aria-expanded": open, "aria-haspopup": "menu", "aria-label": `Wire ${nodeName(node)}`, className: cn('flex items-center gap-1 rounded-md border px-1.5 py-1 text-[10px] shadow-sm', RULE, PANEL, 'hover:bg-zinc-50 dark:hover:bg-zinc-800'), children: [_jsx(Link2, { size: 11 }), "Wire"] }) }), open && (_jsxs("div", { role: "menu", "aria-label": `Wiring for ${nodeName(node)}`, onKeyDown: (event) => {
1274
- if (event.key === 'Escape')
1275
- onOpenChange(false);
1276
- }, className: cn('w-60 rounded-md border p-1 text-left shadow-lg', RULE, PANEL,
1277
- // Above the nodes, which React Flow gives a z-index of their own.
1278
- 'z-10'), children: [_jsx(MenuGroup, { title: "Send its output to", children: targets.length === 0 ? (_jsx(MenuNote, { children: node.kind === 'sink'
1279
- ? 'A sink commits its rows. Nothing runs after one.'
1280
- : 'Nothing on the canvas can take its output yet. Make one below.' })) : (targets.map((target) => (_jsx(MenuItem, { onClick: () => {
1281
- onConnect(node.id, target.id);
1282
- onOpenChange(false);
1283
- }, icon: _jsx(ArrowRight, { size: 11, className: MUTED }), hint: target.kind, children: nodeName(target) }, target.id)))) }), kinds.length > 0 && (_jsx(MenuGroup, { title: "Or make one", children: kinds.map((kind) => (_jsxs(MenuItem, { onClick: () => onConnectToNew(node.id, kind), icon: _jsx(Plus, { size: 11, className: MUTED }), hint: "added and wired", children: ["New ", kind] }, kind))) })), wires.length > 0 && (_jsx(MenuGroup, { title: "Already wired", children: wires.map((edge) => (_jsxs(MenuItem, { onClick: () => {
1284
- onDisconnect(edge);
1285
- onOpenChange(false);
1286
- }, icon: _jsx(Unplug, { size: 11, className: MUTED }), hint: edge.from === node.id ? 'feeds' : 'fed by', children: ["Disconnect ", label(edge.from === node.id ? edge.to : edge.from)] }, edgeId(edge)))) }))] }))] }));
1287
- }
1288
- function MenuGroup({ title, children }) {
1289
- return (_jsxs("div", { className: "py-0.5", children: [_jsx("p", { className: cn('px-1.5 pb-0.5 font-mono text-[9px] uppercase tracking-[0.14em]', MUTED), children: title }), children] }));
1290
- }
1291
- function MenuNote({ children }) {
1292
- return _jsx("p", { className: cn('px-1.5 py-0.5 text-[11px] leading-relaxed', MUTED), children: children });
1293
- }
1294
- function MenuItem({ onClick, icon, hint, children, }) {
1295
- return (_jsxs("button", { type: "button", role: "menuitem", onClick: onClick, className: cn('flex w-full items-center gap-1.5 rounded px-1.5 py-1 text-left text-[11px]', 'hover:bg-zinc-100 dark:hover:bg-zinc-800'), children: [icon, _jsx("span", { className: "truncate", children: children }), _jsx("span", { className: cn('ml-auto shrink-0 font-mono text-[9px]', MUTED), children: hint })] }));
1296
- }
1297
1192
  /**
1298
1193
  * Which node the wiring control is attached to right now.
1299
1194
  *
@@ -1591,6 +1486,14 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
1591
1486
  * screen is silence too.
1592
1487
  */
1593
1488
  const [announcement, setAnnouncement] = useState('');
1489
+ /**
1490
+ * What was right-clicked, and where the menu should hang.
1491
+ *
1492
+ * One piece of state for both, because they are one event: the anchor is the
1493
+ * pointer for a right-click and the focused element's box for the context-menu
1494
+ * key, and neither survives the event that carried it.
1495
+ */
1496
+ const [contextMenu, setContextMenu] = useState(null);
1594
1497
  const menu = useWiringMenu(draft.nodes, selectedNodeIds);
1595
1498
  /**
1596
1499
  * Which workflow the draft was built from.
@@ -1622,6 +1525,9 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
1622
1525
  // not cross graphs. Keeping the map would be this screen holding one graph's
1623
1526
  // columns while drawing another's — silence is the right state on arrival.
1624
1527
  setShapesByNode(new Map());
1528
+ // A menu is about something in the graph that was on screen. Left open
1529
+ // across a swap it would offer to disconnect wires that no longer exist.
1530
+ setContextMenu(null);
1625
1531
  menu.reset();
1626
1532
  }, [workflows.data, selected, menu.reset]);
1627
1533
  // Fit after the graph swaps, on the frame after the new nodes have been laid
@@ -1829,6 +1735,36 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
1829
1735
  markStarted(edge.from, edge.to);
1830
1736
  setAnnouncement('Connection removed.');
1831
1737
  }, [edit, markStarted]);
1738
+ /**
1739
+ * Take nodes out, and say what went with them.
1740
+ *
1741
+ * The one path every deliberate node removal goes through — the hover
1742
+ * toolbar's button, the context menu's item, the selection menu, and the
1743
+ * inspector's "Remove this node". The Delete key reaches the same graph change
1744
+ * through React Flow's own change stream above, which labels its undo entry
1745
+ * the same way.
1746
+ *
1747
+ * The label is the FUNCTION form so it can name the node out of `current`, and
1748
+ * a deletion always opens its own entry rather than folding into whatever came
1749
+ * before it — it is the change somebody is most likely to want back, and it
1750
+ * must not disappear into the drag that happened a moment earlier.
1751
+ *
1752
+ * What this adds over the graph change itself is the sentence. Undo makes a
1753
+ * removal recoverable; it does not make it *visible* that a node took two
1754
+ * other nodes' wiring with it, and nothing else on the screen says so.
1755
+ */
1756
+ const dropNodes = useCallback((ids) => {
1757
+ const { said } = removeNodes(draft.nodes, draft.edges, ids);
1758
+ if (ids.length === 0)
1759
+ return;
1760
+ edit((current) => {
1761
+ const after = removeNodes(current.nodes, current.edges, ids);
1762
+ return { ...current, nodes: after.nodes, edges: after.edges };
1763
+ }, (current) => ({ label: `deleting ${namesOf(current.nodes, ids)}` }));
1764
+ setUnstarted((current) => without(current, ids));
1765
+ setAnnouncement(`${said} Ctrl+Z takes it back.`);
1766
+ }, [draft.nodes, draft.edges, edit]);
1767
+ const forgetMenu = useCallback(() => setContextMenu(null), []);
1832
1768
  /**
1833
1769
  * Put a wire on the other side of its gate.
1834
1770
  *
@@ -2029,10 +1965,24 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
2029
1965
  queryClient.invalidateQueries({ queryKey: catalogQueryKeys.workflows });
2030
1966
  },
2031
1967
  });
2032
- const addNode = useCallback((kind) => {
1968
+ /**
1969
+ * Add a node, somewhere.
1970
+ *
1971
+ * `at` is what the right-click menu supplies and the dock does not, and the
1972
+ * difference is the whole reason "add a node here" is worth having: the dock's
1973
+ * buttons have no idea where anybody is looking, so `nextPosition` correctly
1974
+ * puts a node past the right-hand edge of everything that exists. Somebody who
1975
+ * has just pointed at a patch of empty canvas has said exactly where they want
1976
+ * it, and putting it anywhere else reads as the menu ignoring them.
1977
+ *
1978
+ * `freeSpot` still applies to the pointer position, so a click on a spot that
1979
+ * is already occupied — easy to do at low zoom — drops the node below it
1980
+ * rather than on top of it.
1981
+ */
1982
+ const addNode = useCallback((kind, at) => {
2033
1983
  const id = newLocalId(kind);
2034
1984
  edit((current) => {
2035
- const node = newNodeOfKind(kind, id, nextPosition(current.nodes), uniqueName(current.nodes, kind));
1985
+ const node = newNodeOfKind(kind, id, at ? freeSpot(current.nodes, at) : nextPosition(current.nodes), uniqueName(current.nodes, kind));
2036
1986
  return { ...current, nodes: [...current.nodes, node] };
2037
1987
  }, { label: `adding a ${kind} node` });
2038
1988
  setUnstarted((current) => new Set([...current, id]));
@@ -2078,6 +2028,39 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
2078
2028
  setInspecting(node.id);
2079
2029
  setAnnouncement(`${nodeName(node)} was added and ${nodeName(from)} now feeds it. Its inspector is open.`);
2080
2030
  }, [draft, edit, menu.close]);
2031
+ /**
2032
+ * Put a node in the middle of a wire that already exists.
2033
+ *
2034
+ * `A → B` becomes `A → new → B` in one action. Four gestures before this, one
2035
+ * of which was undoing the connection you already had — and the graph passed
2036
+ * through a state in which it was broken, so the checks fired at somebody
2037
+ * halfway through a perfectly ordinary edit.
2038
+ *
2039
+ * All the care lives in `graphWithNodeBetween`: the branch label travels with
2040
+ * the first half, and the two new wires go in at the index the old one held so
2041
+ * the order of a join's inputs is not silently swapped. ONE undo entry, for
2042
+ * three graph changes, on the argument `connectToNew` already makes — it is
2043
+ * one gesture, and taking the pieces back separately would leave a node
2044
+ * nobody asked for stranded on a wire that no longer exists.
2045
+ */
2046
+ const insertBetween = useCallback((edge, kind) => {
2047
+ // Made once, out here. An updater React chose to replay would otherwise
2048
+ // mint a second node with a second id, and the one this function then
2049
+ // announced and opened would not be the one on the canvas.
2050
+ const node = nodeBetween(edge, kind, draft.nodes);
2051
+ edit((current) => {
2052
+ const next = graphWithNodeBetween(edge, node, current.nodes, current.edges);
2053
+ return { ...current, nodes: next.nodes, edges: next.edges };
2054
+ }, (current) => ({
2055
+ label: `putting ${nodeName(node)} between ${namesOf(current.nodes, [
2056
+ edge.from,
2057
+ ])} and ${namesOf(current.nodes, [edge.to])}`,
2058
+ }));
2059
+ setUnstarted((current) => new Set([...current, node.id]));
2060
+ markStarted(edge.from, edge.to);
2061
+ setInspecting(node.id);
2062
+ setAnnouncement(`${nodeName(node)} was put between ${nodeLabelIn(draft.nodes, edge.from)} and ${nodeLabelIn(draft.nodes, edge.to)}. Its inspector is open.`);
2063
+ }, [draft.nodes, edit, markStarted]);
2081
2064
  const tidy = useCallback(() => {
2082
2065
  edit((current) => ({
2083
2066
  ...current,
@@ -2179,6 +2162,63 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
2179
2162
  * away nodes somebody has moved since.
2180
2163
  */
2181
2164
  const stored = useMemo(() => storedWorkflow(workflows.data, draft.id), [workflows.data, draft.id]);
2165
+ /**
2166
+ * Everything the menus can ask for, in one object.
2167
+ *
2168
+ * Every entry is a callback that already exists on this screen with its own
2169
+ * announcement, its own undo label and its own `markStarted` bookkeeping. A
2170
+ * menu that reimplemented any of them would be a second path with one of those
2171
+ * steps quietly missing — which is exactly the class of bug that produced a
2172
+ * canvas with two things called "wire".
2173
+ *
2174
+ * Deliberately NOT memoised, along with the two lists below it. Everything
2175
+ * here is already a `useCallback`, so a dependency array would be ten entries
2176
+ * long and would say nothing a re-render does not; what it would buy is
2177
+ * skipping `buildCanvasMenu`, which is six `canConnect` probes over a graph
2178
+ * with tens of nodes in it. The memo would cost more to keep right than the
2179
+ * work it saves.
2180
+ */
2181
+ const menuActions = {
2182
+ inspect: setInspecting,
2183
+ editCode: setEditingCodeFor,
2184
+ connect,
2185
+ connectToNew,
2186
+ insertBetween,
2187
+ setBranch,
2188
+ disconnect,
2189
+ removeNodes: dropNodes,
2190
+ addAt: addNode,
2191
+ tidy,
2192
+ fitAll: () => fitView({ padding: fitPadding, duration: 200 }),
2193
+ // Fitted to the selection rather than to the graph, which is the only useful
2194
+ // reading of "bring these into view" when the reason somebody selected them
2195
+ // is that the graph is too big to see at once.
2196
+ fitNodes: (ids) => fitView({ nodes: ids.map((id) => ({ id })), padding: fitPadding, duration: 200 }),
2197
+ };
2198
+ const menuContext = {
2199
+ nodes: draft.nodes,
2200
+ edges: draft.edges,
2201
+ // Core's list, never a copy. See the note on `ADD_NODE` for the kind that
2202
+ // shipped complete and could not be added from this screen at all.
2203
+ kinds: WORKFLOW_NODE_KINDS,
2204
+ canEdit,
2205
+ published: stored?.status === 'ready',
2206
+ actions: menuActions,
2207
+ };
2208
+ /**
2209
+ * What the right-click menu is showing, and what the hover pill's menu is.
2210
+ *
2211
+ * Two lists built by one function from one model, which is the point: the pill
2212
+ * used to own a bespoke dropdown, and the moment a context menu existed the
2213
+ * two would have started answering "what can this node do" differently.
2214
+ */
2215
+ const contextSections = sectionsFor(contextMenu?.target, menuContext);
2216
+ const toolbarSections = sectionsFor(nodeTarget(menu.anchor), menuContext);
2217
+ const contextLabel = describeMenuTarget(contextMenu?.target, draft.nodes);
2218
+ /** Open the menu on whatever was right-clicked. See {@link menuOpening}. */
2219
+ const openMenuFor = useCallback((target, anchor) => {
2220
+ setContextMenu(menuOpening(target, anchor, draft.edges));
2221
+ }, [draft.edges]);
2182
2222
  /**
2183
2223
  * A publish, an unpublish or a schedule, written straight into the list.
2184
2224
  *
@@ -2278,8 +2318,12 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
2278
2318
  // wire on a handle does not also cancel it on the way past.
2279
2319
  onPaneClick: () => {
2280
2320
  menu.close();
2321
+ forgetMenu();
2281
2322
  wiring.cancel();
2282
- }, onDisconnect: disconnect, wiring: wiring, wiringRefusal: wiringRefusal, nodeMenu: _jsx(NodeWiringMenu, { node: menu.anchor, draft: draft, canEdit: canEdit, open: menu.open, onOpenChange: menu.onOpenChange, onHoverChange: menu.onHoverChange, onConnect: connect, onConnectToNew: connectToNew, onDisconnect: disconnect }), fitPadding: fitPadding }), workflows.isSuccess && workflows.data.length === 0 && _jsx(NothingDrawnYet, {}), _jsx("output", { "aria-live": "polite", className: "sr-only", children: announcement }), _jsx(NodeInspector, { node: inspectingNode, draft: draft, transforms: transforms, connections: connections, typeOptions: typeOptions, canEdit: canEdit, modelHref: modelHref, problems: problemsOf(problemsFor, inspectingNode), pending: problemsOf(pendingFor, inspectingNode), discovery: discovery, discoverable: { ...discoveryTarget(draft), onSave: saveNow, saving: save.isPending }, onDiscovered: rememberShape, onClose: () => setInspecting(null), onChange: (next) => {
2323
+ }, onDisconnect: disconnect, onOpenMenu: openMenuFor, wiring: wiring, wiringRefusal: wiringRefusal, nodeMenu: _jsx(NodeActionsToolbar, { node: menu.anchor, canEdit: canEdit, open: menu.open, sections: toolbarSections, deleteHint: deleteHint(menu.anchor, draft, stored), onOpenChange: menu.onOpenChange, onHoverChange: menu.onHoverChange, onDelete: () => {
2324
+ dropNodes(idsOf(menu.anchor));
2325
+ menu.reset();
2326
+ } }), fitPadding: fitPadding }), _jsx(CanvasContextMenu, { opening: contextMenu, sections: contextSections, label: contextLabel, onClose: forgetMenu }), workflows.isSuccess && workflows.data.length === 0 && _jsx(NothingDrawnYet, {}), _jsx("output", { "aria-live": "polite", className: "sr-only", children: announcement }), _jsx(NodeInspector, { node: inspectingNode, draft: draft, transforms: transforms, connections: connections, typeOptions: typeOptions, canEdit: canEdit, modelHref: modelHref, problems: problemsOf(problemsFor, inspectingNode), pending: problemsOf(pendingFor, inspectingNode), discovery: discovery, discoverable: { ...discoveryTarget(draft), onSave: saveNow, saving: save.isPending }, onDiscovered: rememberShape, onClose: () => setInspecting(null), onChange: (next) => {
2283
2327
  // Editing any field is the clearest statement there is that somebody
2284
2328
  // is working on this node rather than looking at one they just made.
2285
2329
  markStarted(next.id);
@@ -2303,14 +2347,13 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
2303
2347
  ...current,
2304
2348
  nodes: current.nodes.map((node) => (node.id === next.id ? next : node)),
2305
2349
  }), nodeEditAction(before, next));
2306
- }, onConnect: connect, onConnectToNew: connectToNew, onDisconnect: disconnect, onBranch: setBranch, onCreateTransform: (nodeId) => createTransform.mutate(nodeId), creatingTransform: createTransform.isPending, createTransformError: createTransform.error, onDelete: (nodeId) => {
2307
- edit((current) => ({
2308
- ...current,
2309
- nodes: current.nodes.filter((node) => node.id !== nodeId),
2310
- edges: current.edges.filter((edge) => edge.from !== nodeId && edge.to !== nodeId),
2311
- }), (current) => ({ label: `deleting ${namesOf(current.nodes, [nodeId])}` }));
2350
+ }, onConnect: connect, onConnectToNew: connectToNew, onDisconnect: disconnect, onBranch: setBranch, onCreateTransform: (nodeId) => createTransform.mutate(nodeId), creatingTransform: createTransform.isPending, createTransformError: createTransform.error,
2351
+ // The same path the hover button, the context menu and the selection
2352
+ // menu take. It was the only way to remove a node before those existed,
2353
+ // and it was the only one that did not say what the removal cost.
2354
+ onDelete: (nodeId) => {
2355
+ dropNodes([nodeId]);
2312
2356
  setInspecting(null);
2313
- setAnnouncement('Node removed, along with its connections.');
2314
2357
  }, onEditCode: (nodeId) => setEditingCodeFor(nodeId) }), _jsx(Sheet, { open: editingCodeFor !== null, onOpenChange: (open) => {
2315
2358
  if (!open)
2316
2359
  setEditingCodeFor(null);