@dudousxd/nestjs-catalog-react 0.19.0 → 0.21.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.
- package/dist/TraceExplorer.d.ts +11 -1
- package/dist/TraceExplorer.js +64 -3
- package/dist/WorkflowCanvas.js +1082 -73
- package/dist/context.d.ts +132 -1
- package/dist/context.js +18 -0
- package/dist/index.d.ts +1 -1
- package/dist/routes.d.ts +48 -0
- package/dist/routes.js +5 -0
- package/dist/workflow/graph.js +21 -1
- package/dist/workflow/history.d.ts +291 -0
- package/dist/workflow/history.js +343 -0
- package/package.json +8 -8
package/dist/WorkflowCanvas.js
CHANGED
|
@@ -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, Position, ReactFlow, ReactFlowProvider, useReactFlow, } from '@xyflow/react';
|
|
2
|
+
import { Background, BackgroundVariant, ConnectionLineType, Controls, MiniMap, NodeToolbar, Panel, Position, 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,8 +7,8 @@ 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, CircleAlert, CircleDashed, Code2, Database, ExternalLink, GitBranch, LayoutGrid, Link2, Loader2, Plug, Plus, Repeat, Save, Trash2, TriangleAlert, Unplug, } from 'lucide-react';
|
|
11
|
-
import { useReducedMotion } from 'motion/react';
|
|
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';
|
|
11
|
+
import { AnimatePresence, motion, useReducedMotion } from 'motion/react';
|
|
12
12
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
13
13
|
import { connectionOptionsFor } from './ConnectionPanel';
|
|
14
14
|
import { TransformEditor } from './TransformEditor';
|
|
@@ -27,6 +27,7 @@ import { Switch } from './ui/switch';
|
|
|
27
27
|
import { Tooltip, TooltipProvider } from './ui/tooltip';
|
|
28
28
|
import { WorkflowEdgeProvider, workflowEdgeTypes } from './workflow/edges';
|
|
29
29
|
import { NODE_HEIGHT, NODE_WIDTH, defaultLabel, describeFilterPredicate, flowingEdgeIds, layout, layoutIfUnarranged, nextPosition, toFlowEdges, toFlowNodes, } from './workflow/graph';
|
|
30
|
+
import { HistoryControls, keepKnown, namesOf, nodeEditAction, reverted, snapshotOf, undone, useUndoShortcut, useUnsavedGuard, withEdit, } from './workflow/history';
|
|
30
31
|
import { PublishControls, RunControls, SchedulePanel, ShrinkRefusalNote, WorkflowStatusBadge, } from './workflow/lifecycle';
|
|
31
32
|
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';
|
|
32
33
|
import { WORKFLOW_NAME } from './workflow/name';
|
|
@@ -37,6 +38,424 @@ import { PendingWireLine, WiringHint, useClickWiring, } from './workflow/wiring'
|
|
|
37
38
|
const MUTED = 'text-zinc-400 dark:text-zinc-500';
|
|
38
39
|
const RULE = 'border-zinc-200 dark:border-zinc-800';
|
|
39
40
|
const PANEL = 'bg-white dark:bg-zinc-900';
|
|
41
|
+
/**
|
|
42
|
+
* A card INSIDE a floating panel.
|
|
43
|
+
*
|
|
44
|
+
* Deliberately not {@link PANEL}. An opaque white card on a translucent panel
|
|
45
|
+
* cancels the blur it is sitting on and the rail stops reading as one surface —
|
|
46
|
+
* it becomes four white boxes with a frosted gap between them.
|
|
47
|
+
*/
|
|
48
|
+
const SUBPANEL = 'bg-zinc-50/60 dark:bg-zinc-950/40';
|
|
49
|
+
/**
|
|
50
|
+
* What a thing floating ON the canvas looks like.
|
|
51
|
+
*
|
|
52
|
+
* Translucent with a blur rather than opaque, and that is the whole point of the
|
|
53
|
+
* layout this belongs to: a panel that blanks out what is behind it turns the
|
|
54
|
+
* canvas back into a box with a border, only now the box is a worse shape. The
|
|
55
|
+
* graph stays perceptible through the chrome, so the surface reads as continuous
|
|
56
|
+
* and the panels read as sitting on it.
|
|
57
|
+
*/
|
|
58
|
+
const FLOATING = cn('rounded-xl border shadow-lg shadow-zinc-950/5 dark:shadow-zinc-950/40', 'border-zinc-200/80 bg-white/85 backdrop-blur-md', 'dark:border-zinc-800/80 dark:bg-zinc-900/85');
|
|
59
|
+
/**
|
|
60
|
+
* How much of the canvas the floating chrome covers, per edge, in CSS pixels.
|
|
61
|
+
*
|
|
62
|
+
* ONE definition, read by two things that would otherwise drift: the Tailwind
|
|
63
|
+
* insets the chrome is positioned with, and the per-side `fitView` padding the
|
|
64
|
+
* graph is fitted into. That second use is what makes a full-bleed canvas
|
|
65
|
+
* honest — React Flow fits the graph to the *viewport*, so without this it
|
|
66
|
+
* would happily centre a node underneath the action cluster and leave somebody
|
|
67
|
+
* dragging a box out from under a panel to read it.
|
|
68
|
+
*
|
|
69
|
+
* Deliberately generous rather than measured. Measuring the real panels every
|
|
70
|
+
* frame would be a ResizeObserver feeding a value into a fit that then moves
|
|
71
|
+
* the panels' backdrop, and the loop that produces is worse than 20px of slack.
|
|
72
|
+
*/
|
|
73
|
+
const CHROME = {
|
|
74
|
+
top: 150,
|
|
75
|
+
bottom: 90,
|
|
76
|
+
side: 28,
|
|
77
|
+
/** The rail's width plus its gutter, when it is open. */
|
|
78
|
+
rail: 336,
|
|
79
|
+
/**
|
|
80
|
+
* The top inset once the workflow card is collapsed to its head.
|
|
81
|
+
*
|
|
82
|
+
* The card is the tallest thing on this screen and the only one focus mode
|
|
83
|
+
* changes the height of, so it is the only inset that moves with the mode.
|
|
84
|
+
* The dock is still at the bottom and the actions are untouched, so those two
|
|
85
|
+
* keep their numbers.
|
|
86
|
+
*/
|
|
87
|
+
topFocused: 76,
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* {@link CHROME} as the padding `fitView` wants.
|
|
91
|
+
*
|
|
92
|
+
* Two sides move, and only two: the right, because the rail comes and goes, and
|
|
93
|
+
* the top, because focus mode collapses the card to its head. The whole reason
|
|
94
|
+
* this function exists is that a fit which ignored either would put a node under
|
|
95
|
+
* a panel — so a mode that makes the chrome smaller has to say so here, or the
|
|
96
|
+
* canvas it just bought would go unused.
|
|
97
|
+
*/
|
|
98
|
+
function chromeFitPadding(railOpen, cardCollapsed) {
|
|
99
|
+
return {
|
|
100
|
+
top: `${cardCollapsed ? CHROME.topFocused : CHROME.top}px`,
|
|
101
|
+
bottom: `${CHROME.bottom}px`,
|
|
102
|
+
left: `${CHROME.side}px`,
|
|
103
|
+
right: `${railOpen ? CHROME.rail : CHROME.side}px`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Whether the details rail starts on screen.
|
|
108
|
+
*
|
|
109
|
+
* Read once, from the width at mount, rather than subscribed to. A live media
|
|
110
|
+
* query would reopen a panel somebody had just closed because they turned their
|
|
111
|
+
* tablet, which is worse than the panel being open on a narrow screen they can
|
|
112
|
+
* shut it on.
|
|
113
|
+
*
|
|
114
|
+
* `typeof window` guards server rendering, where there is no width to ask about
|
|
115
|
+
* and a bare `window` is a crash rather than a layout bug. Open is the right
|
|
116
|
+
* answer there: it is what hydrates into on a desktop, and a panel that appears
|
|
117
|
+
* after hydration is a worse first paint than one that was always there.
|
|
118
|
+
*/
|
|
119
|
+
function railOpenByWidth() {
|
|
120
|
+
return typeof window === 'undefined' ? true : window.innerWidth >= 1024;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Whether this is a pointer that can hover at all.
|
|
124
|
+
*
|
|
125
|
+
* The whole shrink-and-expand idea below is built on hover, and hover is not a
|
|
126
|
+
* thing every pointer has. On a touch screen there is no state between "not
|
|
127
|
+
* touching" and "touching": the first contact with a pannable minimap IS a pan,
|
|
128
|
+
* so a map that expanded on touch would turn a navigation gesture into a resize
|
|
129
|
+
* gesture and move the viewport while doing it. There is no version of
|
|
130
|
+
* hover-to-expand that works there, so the honest answer is not to shrink at
|
|
131
|
+
* all — a finger gets the map exactly as it is today.
|
|
132
|
+
*
|
|
133
|
+
* `pointer: fine` as well as `hover: hover`, because the pair is what excludes a
|
|
134
|
+
* TV remote and a Wii-style pointer: those report `hover: hover` with a coarse
|
|
135
|
+
* pointer, and a 96px target you have to wave at is worse than a 200px one.
|
|
136
|
+
*
|
|
137
|
+
* Every failure answers `false` — no window, no `matchMedia` (jsdom does not
|
|
138
|
+
* implement it), or a throw. `false` means "do not shrink", which is the answer
|
|
139
|
+
* that takes nothing away, and that is the same rule
|
|
140
|
+
* {@link focusModeAtMount} follows for the same reason.
|
|
141
|
+
*/
|
|
142
|
+
const HOVER_POINTER_QUERY = '(hover: hover) and (pointer: fine)';
|
|
143
|
+
function hoverCapablePointer() {
|
|
144
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function')
|
|
145
|
+
return false;
|
|
146
|
+
try {
|
|
147
|
+
return window.matchMedia(HOVER_POINTER_QUERY).matches;
|
|
148
|
+
}
|
|
149
|
+
catch {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* How much of its size the overview keeps while focus mode has the screen.
|
|
155
|
+
*
|
|
156
|
+
* React Flow's minimap is 200×150, and 0.48 of that is 96×72 — whole pixels on
|
|
157
|
+
* both axes, which a rounder-looking 0.5 would also give but 0.45 would not. A
|
|
158
|
+
* fractional height puts the mask's bottom edge on a half-pixel and the
|
|
159
|
+
* viewport box picks up a grey seam that reads as a border it does not have.
|
|
160
|
+
*
|
|
161
|
+
* WHAT SURVIVES AT THIS SIZE, which is the only question that matters — a
|
|
162
|
+
* shrunk minimap that reads as decoration has taken the navigation aid away and
|
|
163
|
+
* kept the pixels. At 96×72 the map still carries the one thing it is for: WHERE
|
|
164
|
+
* THE VIEWPORT IS IN THE GRAPH. That is drawn as a hole in a tinted mask, so it
|
|
165
|
+
* is an area rather than a detail, and area survives scaling — the box keeps its
|
|
166
|
+
* position and its proportion of the whole, which is the entire "am I looking at
|
|
167
|
+
* the middle of this graph or the far edge" question. The node dots keep their
|
|
168
|
+
* kind colours (see {@link miniMapColor}), so a cluster and a lone box on the
|
|
169
|
+
* other side of the graph are still two different pictures.
|
|
170
|
+
*
|
|
171
|
+
* WHAT IS SACRIFICED: reading an individual node's position precisely, and any
|
|
172
|
+
* hope of telling two adjacent nodes apart. Both are recovered by hovering, and
|
|
173
|
+
* neither was ever a gesture here — no `onNodeClick` is passed to the minimap,
|
|
174
|
+
* so a dot has never been a target.
|
|
175
|
+
*
|
|
176
|
+
* A single scale rather than a smaller `style={{ width, height }}`, and that is
|
|
177
|
+
* NOT a shortcut — see {@link FocusMiniMap} for why it is the only version of
|
|
178
|
+
* this that cannot make a drag jump under the finger.
|
|
179
|
+
*
|
|
180
|
+
* SPELLED AS A LITERAL CLASS, and it has to be. This package ships as compiled
|
|
181
|
+
* JS and the console's stylesheet points Tailwind at `dist/**\/*.js` to find the
|
|
182
|
+
* classes in it. Tailwind emits only what it can SEE in that text, so a class
|
|
183
|
+
* built as `scale-[${scale}]` survives compilation as an un-evaluated template
|
|
184
|
+
* and the rule is never generated — no error, no warning, and a focus mode
|
|
185
|
+
* whose minimap simply never shrinks. Hence one string, and the arithmetic in
|
|
186
|
+
* this comment rather than in the code: 200×150 × 0.48 = 96×72.
|
|
187
|
+
*/
|
|
188
|
+
const MINIMAP_FOCUSED_CLASS = 'scale-[0.48]';
|
|
189
|
+
/* ---------------------------------------------------------------------------
|
|
190
|
+
* Focus mode.
|
|
191
|
+
* ------------------------------------------------------------------------- */
|
|
192
|
+
/**
|
|
193
|
+
* The key focus mode is remembered under, and — deliberately — `sessionStorage`.
|
|
194
|
+
*
|
|
195
|
+
* ## Why it is remembered at all
|
|
196
|
+
*
|
|
197
|
+
* A mode somebody has to re-enter after every reload is a mode nobody uses. The
|
|
198
|
+
* person this exists for is the one drawing a forty-node graph, and that person
|
|
199
|
+
* reloads: a deploy lands, a query is retried, a tab is restored. Losing the
|
|
200
|
+
* layout each time makes the gesture a novelty.
|
|
201
|
+
*
|
|
202
|
+
* ## Why it is not `localStorage`
|
|
203
|
+
*
|
|
204
|
+
* This mode HIDES things — the workflow picker, the name field, the description.
|
|
205
|
+
* A preference that hides controls and is restored silently a week later is
|
|
206
|
+
* somebody opening the console, finding a screen with fewer controls than they
|
|
207
|
+
* remember, and having no way to connect that to a keypress from last Tuesday.
|
|
208
|
+
* That is the exact confusion a persisted hiding-mode causes, and it is worse
|
|
209
|
+
* than re-pressing a key.
|
|
210
|
+
*
|
|
211
|
+
* `sessionStorage` is the honest middle: the mode lives exactly as long as the
|
|
212
|
+
* TAB that chose it. A reload keeps it, because a reload is the same working
|
|
213
|
+
* session and is usually not even deliberate. A new tab, or tomorrow, starts
|
|
214
|
+
* with the chrome present. Nobody inherits a hidden control from a decision they
|
|
215
|
+
* cannot remember making.
|
|
216
|
+
*
|
|
217
|
+
* It is per-tab rather than per-workflow on purpose: focus is a statement about
|
|
218
|
+
* how somebody wants to WORK, not about a particular graph, and re-entering it
|
|
219
|
+
* on every switch of the picker would make it feel like a property of the
|
|
220
|
+
* document.
|
|
221
|
+
*/
|
|
222
|
+
const FOCUS_STORAGE_KEY = 'catalog.workflowCanvas.focus';
|
|
223
|
+
/**
|
|
224
|
+
* Whether focus mode was on in this tab.
|
|
225
|
+
*
|
|
226
|
+
* Every failure answers `false` — no window (a host rendering this on a server),
|
|
227
|
+
* no storage (Safari's private mode throws on `sessionStorage` access rather
|
|
228
|
+
* than returning null), or anything stored that is not exactly `'1'`. The chrome
|
|
229
|
+
* being present is the state that hides nothing, so it is the only safe answer
|
|
230
|
+
* to "I could not tell".
|
|
231
|
+
*/
|
|
232
|
+
function focusModeAtMount() {
|
|
233
|
+
if (typeof window === 'undefined')
|
|
234
|
+
return false;
|
|
235
|
+
try {
|
|
236
|
+
return window.sessionStorage.getItem(FOCUS_STORAGE_KEY) === '1';
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Whether the details rail starts on screen, once focus mode has had its say.
|
|
244
|
+
*
|
|
245
|
+
* A mount that restores focus (see {@link focusModeAtMount}) has to start with
|
|
246
|
+
* the rail away, or a reload puts back the one panel the mode had just taken and
|
|
247
|
+
* focus arrives half-applied. Measured in a browser before this existed: press
|
|
248
|
+
* F, reload, and the rail was open again with the toggle still reading "Turn off
|
|
249
|
+
* focus mode" — a screen making two claims about itself.
|
|
250
|
+
*/
|
|
251
|
+
function railOpenByDefault() {
|
|
252
|
+
return !focusModeAtMount() && railOpenByWidth();
|
|
253
|
+
}
|
|
254
|
+
/** Remember it, or fail silently — a mode is not worth an exception. */
|
|
255
|
+
function rememberFocusMode(on) {
|
|
256
|
+
if (typeof window === 'undefined')
|
|
257
|
+
return;
|
|
258
|
+
try {
|
|
259
|
+
window.sessionStorage.setItem(FOCUS_STORAGE_KEY, on ? '1' : '0');
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
// A browser that refuses storage still gets the mode, for this render.
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* The key that toggles focus mode.
|
|
267
|
+
*
|
|
268
|
+
* A bare letter rather than a chord, because this is a drawing surface and the
|
|
269
|
+
* hand that would reach for a modifier is the hand on the pointer. `f` is the
|
|
270
|
+
* mnemonic and nothing else on this screen claims it: React Flow binds only
|
|
271
|
+
* Delete/Backspace and the arrows, and Escape already means "put the half-drawn
|
|
272
|
+
* wire away" (see `workflow/wiring.tsx`), which is why this is not Escape.
|
|
273
|
+
*
|
|
274
|
+
* Discoverable rather than folklore: the toggle renders the letter beside its
|
|
275
|
+
* icon and its tooltip names it, so the shortcut is learnable from the control
|
|
276
|
+
* it duplicates instead of from a changelog.
|
|
277
|
+
*/
|
|
278
|
+
const FOCUS_SHORTCUT = 'f';
|
|
279
|
+
/**
|
|
280
|
+
* Whether a keypress belongs to whatever the person is typing into.
|
|
281
|
+
*
|
|
282
|
+
* The failure this prevents is specific and would be reported as "the panels
|
|
283
|
+
* vanish while I name a node": this screen is covered in text fields — the name
|
|
284
|
+
* field, the inspector's config editor, the transform's code surface — and a
|
|
285
|
+
* bare-letter shortcut that did not ask would fire on the `f` of "fleet".
|
|
286
|
+
*
|
|
287
|
+
* Narrowed with `instanceof` rather than by reading `tagName` off an `EventTarget`,
|
|
288
|
+
* because a target can be a document or a window and neither has one.
|
|
289
|
+
* `isContentEditable` covers the code editor, which is a `div`.
|
|
290
|
+
*/
|
|
291
|
+
function typingInto(target) {
|
|
292
|
+
if (!(target instanceof HTMLElement))
|
|
293
|
+
return false;
|
|
294
|
+
if (target.isContentEditable)
|
|
295
|
+
return true;
|
|
296
|
+
return (target instanceof HTMLInputElement ||
|
|
297
|
+
target instanceof HTMLTextAreaElement ||
|
|
298
|
+
target instanceof HTMLSelectElement);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Whether the chrome is compacted so the graph gets the screen, and the one
|
|
302
|
+
* gesture that changes it.
|
|
303
|
+
*
|
|
304
|
+
* ## What the mode does, and what it deliberately does not
|
|
305
|
+
*
|
|
306
|
+
* ON: the workflow card collapses to its head, the node dock drops its labels
|
|
307
|
+
* (the form it already takes on a phone — see `AddButton` — rather than a second
|
|
308
|
+
* compact form invented for this), and the rail goes away.
|
|
309
|
+
*
|
|
310
|
+
* OFF-LIMITS: the action cluster. That is not an oversight, it is the reason the
|
|
311
|
+
* mode is safe. Every signal on this screen that prevents a mistake lives in that
|
|
312
|
+
* cluster or hangs off it — Save doubles as the unsaved indicator, the refusal
|
|
313
|
+
* notes appear beneath the button that caused them, the shrink refusal with its
|
|
314
|
+
* acknowledge control is one of those notes, and the rail toggle carries the
|
|
315
|
+
* problem count and its colour while the rail is away. It is also the smallest of
|
|
316
|
+
* the three groups, so hiding it would buy the least canvas for the most risk.
|
|
317
|
+
* What is left in focus is a graph plus the things that can tell you the graph is
|
|
318
|
+
* wrong.
|
|
319
|
+
*
|
|
320
|
+
* ## Why one gesture rather than three
|
|
321
|
+
*
|
|
322
|
+
* Because the ask was "compactar os menus" for "real estate", and real estate is
|
|
323
|
+
* a property of the whole screen. Three independent collapses is three decisions
|
|
324
|
+
* and six states to be in; a person who wants the room wants the room. The rail
|
|
325
|
+
* keeps its own toggle because it had one before this and closing it alone is a
|
|
326
|
+
* legitimate smaller wish.
|
|
327
|
+
*
|
|
328
|
+
* ## Why the rail is passed in rather than owned here
|
|
329
|
+
*
|
|
330
|
+
* Because it existed first and is still operable on its own. This hook borrows
|
|
331
|
+
* it for the duration of the mode and gives it back; it does not become the
|
|
332
|
+
* rail's owner, which is what taking the `useState` would have meant.
|
|
333
|
+
*/
|
|
334
|
+
function useFocusMode(railOpen, setRailOpen) {
|
|
335
|
+
const [focused, setFocused] = useState(focusModeAtMount);
|
|
336
|
+
/**
|
|
337
|
+
* Whether the rail was open before focus took it away.
|
|
338
|
+
*
|
|
339
|
+
* A ref rather than state: nothing renders from it, and leaving focus should
|
|
340
|
+
* put the screen back the way it was found rather than assert a default. A
|
|
341
|
+
* person who had closed the rail themselves and then used focus would
|
|
342
|
+
* otherwise get a panel they never asked for on the way out.
|
|
343
|
+
*
|
|
344
|
+
* Seeded from the WIDTH rather than from `railOpen`, and the two differ in
|
|
345
|
+
* exactly one case: a mount that restored focus, where `railOpen` is already
|
|
346
|
+
* false because focus put it there. Seeding from it would mean leaving focus
|
|
347
|
+
* after a reload left the rail away too — restoring a state that focus itself
|
|
348
|
+
* created rather than the one it displaced.
|
|
349
|
+
*/
|
|
350
|
+
const railBeforeFocus = useRef(railOpenByWidth());
|
|
351
|
+
const toggleFocus = useCallback(() => {
|
|
352
|
+
const next = !focused;
|
|
353
|
+
rememberFocusMode(next);
|
|
354
|
+
if (next)
|
|
355
|
+
railBeforeFocus.current = railOpen;
|
|
356
|
+
setRailOpen(next ? false : railBeforeFocus.current);
|
|
357
|
+
setFocused(next);
|
|
358
|
+
}, [focused, railOpen, setRailOpen]);
|
|
359
|
+
/**
|
|
360
|
+
* The keyboard way in and out. See {@link FOCUS_SHORTCUT}.
|
|
361
|
+
*
|
|
362
|
+
* On `window` rather than on the canvas container, because the point of the
|
|
363
|
+
* shortcut is that it works while the hands are on the graph — and React
|
|
364
|
+
* Flow's pane is not a focusable element, so a container-scoped handler would
|
|
365
|
+
* only fire after somebody had tabbed to something.
|
|
366
|
+
*
|
|
367
|
+
* Every modifier is refused rather than ignored: `Ctrl+F` is find, `Cmd+F` is
|
|
368
|
+
* find, and a shortcut that swallowed either would be a bug reported as "the
|
|
369
|
+
* browser's search is broken on this screen".
|
|
370
|
+
*/
|
|
371
|
+
useEffect(() => {
|
|
372
|
+
function onKeyDown(event) {
|
|
373
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
374
|
+
return;
|
|
375
|
+
if (event.key.toLowerCase() !== FOCUS_SHORTCUT)
|
|
376
|
+
return;
|
|
377
|
+
if (typingInto(event.target))
|
|
378
|
+
return;
|
|
379
|
+
event.preventDefault();
|
|
380
|
+
toggleFocus();
|
|
381
|
+
}
|
|
382
|
+
window.addEventListener('keydown', onKeyDown);
|
|
383
|
+
return () => window.removeEventListener('keydown', onKeyDown);
|
|
384
|
+
}, [toggleFocus]);
|
|
385
|
+
return { focused, toggleFocus };
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Whether the workflow card actually folds — because focus mode REFUSES to fold
|
|
389
|
+
* it while the graph has no name.
|
|
390
|
+
*
|
|
391
|
+
* The one place this mode could become a trap. Save is disabled on an empty name
|
|
392
|
+
* (see `CanvasActions`), and the field that fills it in is inside the card — so a
|
|
393
|
+
* focus mode that collapsed the card unconditionally would leave somebody who had
|
|
394
|
+
* just picked "New workflow" with a dead Save button, a tooltip about a field
|
|
395
|
+
* they cannot see, and no way to connect the two.
|
|
396
|
+
*
|
|
397
|
+
* So the card is chrome that is quiet when it has nothing to report and asserts
|
|
398
|
+
* itself when it does: it stays open, in focus mode, exactly while the only
|
|
399
|
+
* control that can unblock Save is the one it holds. {@link FocusToggle} says so
|
|
400
|
+
* rather than appearing broken, and `WorkflowCard` additionally declines to fold
|
|
401
|
+
* while the caret is still in the field.
|
|
402
|
+
*/
|
|
403
|
+
function focusCollapsesTheCard(focused, draftName) {
|
|
404
|
+
return focused && draftName.trim().length > 0;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Every kind of node, and how it is offered.
|
|
408
|
+
*
|
|
409
|
+
* A `Record` over `WorkflowNodeKind` rather than a hand-written row of buttons,
|
|
410
|
+
* and that is a bug fix rather than a tidy-up: `filter` shipped complete — model,
|
|
411
|
+
* validator, executor, inspector, its own colour on the canvas — and could not be
|
|
412
|
+
* added from this screen at all, because the row that offers the kinds was six
|
|
413
|
+
* JSX elements somebody had typed out and only five of them had been typed. Every
|
|
414
|
+
* other exhaustiveness guard in this file caught its case; none of them could
|
|
415
|
+
* catch a list maintained by hand.
|
|
416
|
+
*
|
|
417
|
+
* So the row maps {@link WORKFLOW_NODE_KINDS} and looks each kind up here. A new
|
|
418
|
+
* kind now fails to compile in this file until somebody says how it is offered,
|
|
419
|
+
* which is the only way a palette stays complete.
|
|
420
|
+
*
|
|
421
|
+
* The icons match `KIND_STYLE` in `workflow/nodes.tsx` on purpose — the thing you
|
|
422
|
+
* press to make a box should wear the box's own mark — and `if` and `filter` keep
|
|
423
|
+
* the distinction that file argues for: a fork decides which boxes run, a funnel
|
|
424
|
+
* takes rows away. They are the two that must never be confused at a glance, so
|
|
425
|
+
* they never share an icon or a sentence.
|
|
426
|
+
*/
|
|
427
|
+
const ADD_NODE = {
|
|
428
|
+
source: {
|
|
429
|
+
icon: Plug,
|
|
430
|
+
label: 'Source',
|
|
431
|
+
hint: 'Reads records out of a system: a kind, an optional named connection, and a config.',
|
|
432
|
+
},
|
|
433
|
+
transform: {
|
|
434
|
+
icon: Repeat,
|
|
435
|
+
label: 'Transform',
|
|
436
|
+
hint: 'Code that reshapes whatever is wired into it.',
|
|
437
|
+
},
|
|
438
|
+
sink: {
|
|
439
|
+
icon: Database,
|
|
440
|
+
label: 'Sink',
|
|
441
|
+
hint: 'Writes and commits one object type. Several are fine — each commits independently.',
|
|
442
|
+
},
|
|
443
|
+
call: {
|
|
444
|
+
icon: ExternalLink,
|
|
445
|
+
label: 'Call',
|
|
446
|
+
hint: 'Hands this step to a durable workflow that already exists, by name and pinned version. It runs as a child of this load, with its own retries.',
|
|
447
|
+
},
|
|
448
|
+
if: {
|
|
449
|
+
icon: GitBranch,
|
|
450
|
+
label: 'If',
|
|
451
|
+
hint: 'Sends the rows down one of two branches, depending on an environment variable where the load runs. The other branch is skipped — a sink on it commits nothing and leaves what is published alone.',
|
|
452
|
+
},
|
|
453
|
+
filter: {
|
|
454
|
+
icon: Filter,
|
|
455
|
+
label: 'Filter',
|
|
456
|
+
hint: 'Drops the rows that fail a test you write here. Unlike an If, every box still runs — there are simply fewer rows in them from this point on.',
|
|
457
|
+
},
|
|
458
|
+
};
|
|
40
459
|
/**
|
|
41
460
|
* The value the workflow picker uses for "start a fresh one".
|
|
42
461
|
*
|
|
@@ -69,10 +488,14 @@ const ARIA_LABELS = {
|
|
|
69
488
|
'minimap.ariaLabel': `Overview of the ${WORKFLOW_NAME.singular}`,
|
|
70
489
|
};
|
|
71
490
|
function blankDraft() {
|
|
72
|
-
|
|
491
|
+
const empty = { name: '', description: '', nodes: [], edges: [] };
|
|
492
|
+
// A blank canvas has a baseline too, and it is the blank canvas: Reset on a
|
|
493
|
+
// never-saved graph means "clear it", which is exactly what going back to
|
|
494
|
+
// "nothing has been stored" should mean.
|
|
495
|
+
return { ...empty, dirty: false, past: [], baseline: snapshotOf(empty) };
|
|
73
496
|
}
|
|
74
497
|
function draftFrom(workflow) {
|
|
75
|
-
|
|
498
|
+
const loaded = {
|
|
76
499
|
id: workflow.id,
|
|
77
500
|
name: workflow.name,
|
|
78
501
|
description: workflow.description ?? '',
|
|
@@ -93,7 +516,12 @@ function draftFrom(workflow) {
|
|
|
93
516
|
edges: workflow.edges.map((edge) => ({ from: edge.from, to: edge.to })),
|
|
94
517
|
version: workflow.version,
|
|
95
518
|
dirty: false,
|
|
519
|
+
past: [],
|
|
96
520
|
};
|
|
521
|
+
// The baseline holds the SAME arrays the draft starts with, which is what
|
|
522
|
+
// makes undoing all the way back compare equal to it and go genuinely clean.
|
|
523
|
+
// See `sameSnapshot`.
|
|
524
|
+
return { ...loaded, baseline: snapshotOf(loaded) };
|
|
97
525
|
}
|
|
98
526
|
/**
|
|
99
527
|
* Transforms wired to each other, ending at one or more sinks.
|
|
@@ -536,20 +964,36 @@ function saveHint(blocked, unfinished) {
|
|
|
536
964
|
* list beside the canvas is empty and the real answer is "two boxes are not
|
|
537
965
|
* finished", so that case gets its own sentence and names them.
|
|
538
966
|
*/
|
|
539
|
-
function CanvasActions({ draft, stored, canEdit, blocked, unfinished, saving, running, durabilityDetail, acknowledging, onAcknowledgingChange, onSave, onRun, onLifecycleChange, onAskDelete, }) {
|
|
540
|
-
return (_jsxs("div", { className: "flex flex-wrap items-
|
|
967
|
+
function CanvasActions({ draft, stored, canEdit, blocked, unfinished, saving, running, durabilityDetail, acknowledging, reducedMotion, resetting, onAcknowledgingChange, onResettingChange, onUndo, onReset, onSave, onRun, onLifecycleChange, onAskDelete, }) {
|
|
968
|
+
return (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [_jsx(HistoryControls, { draft: draft, canEdit: canEdit, reducedMotion: reducedMotion, resetting: resetting, onResettingChange: onResettingChange, onUndo: onUndo, onReset: onReset }), _jsx(Tooltip, { content: saveHint(blocked, unfinished), children: _jsxs(Button, { size: "sm", onClick: onSave, disabled: !canEdit ||
|
|
541
969
|
saving ||
|
|
542
970
|
draft.name.trim().length === 0 ||
|
|
543
|
-
(!draft.dirty && Boolean(draft.id)),
|
|
544
|
-
|
|
545
|
-
|
|
971
|
+
(!draft.dirty && Boolean(draft.id)),
|
|
972
|
+
// The amber is the whole signal — a graph that would never run says so
|
|
973
|
+
// on the button before it is pressed — so it has to survive the
|
|
974
|
+
// variant's own background. `cn` is tailwind-merge, so the later
|
|
975
|
+
// `bg-*` wins rather than fighting.
|
|
976
|
+
className: cn('shrink-0', blocked
|
|
977
|
+
? 'bg-amber-600 text-white hover:bg-amber-500 dark:bg-amber-600 dark:text-white dark:hover:bg-amber-500'
|
|
978
|
+
: 'bg-zinc-950 text-zinc-50 hover:bg-zinc-800 dark:bg-zinc-100 dark:text-zinc-950 dark:hover:bg-zinc-200'), children: [saving ? _jsx(Loader2, { size: 12, className: "animate-spin" }) : _jsx(Save, { size: 12 }), draft.dirty ? 'Save' : 'Saved'] }) }), stored && (_jsx(PublishControls, { workflow: stored, dirty: draft.dirty, canEdit: canEdit, onPublished: onLifecycleChange })), _jsx(RunControls, { workflowId: draft.id, dirty: draft.dirty, canEdit: canEdit, running: running, durabilityDetail: durabilityDetail, acknowledging: acknowledging, onAcknowledgingChange: onAcknowledgingChange, onRun: onRun }), draft.id && canEdit && (_jsx(Tooltip, { content: `Delete this ${WORKFLOW_NAME.singular}, and the connector it runs as with it.`, children: _jsx(Button, { variant: "outline", size: "icon", onClick: onAskDelete, "aria-label": `Delete this ${WORKFLOW_NAME.singular}`, className: "text-zinc-400 hover:text-red-600", children: _jsx(Trash2, { size: 12 }) }) }))] }));
|
|
546
979
|
}
|
|
547
|
-
/**
|
|
548
|
-
|
|
549
|
-
|
|
980
|
+
/**
|
|
981
|
+
* The tool dock: every kind that can be put on the canvas, and the tidy control.
|
|
982
|
+
*
|
|
983
|
+
* Bottom centre, floating, because it is the one piece of chrome somebody
|
|
984
|
+
* touches continuously while drawing and the bottom edge is where every canvas
|
|
985
|
+
* tool that has ever been good keeps its tools. It is also the only corner React
|
|
986
|
+
* Flow's own overlays do not claim.
|
|
987
|
+
*
|
|
988
|
+
* The kinds come from {@link WORKFLOW_NODE_KINDS} through {@link ADD_NODE}, so
|
|
989
|
+
* the dock cannot fall behind the model — see the note on `ADD_NODE` for the bug
|
|
990
|
+
* that made that necessary.
|
|
991
|
+
*/
|
|
992
|
+
function AddNodeBar({ refreshing, compact, onAdd, onTidy, }) {
|
|
993
|
+
return (_jsxs("div", { className: cn('pointer-events-auto flex max-w-full items-center gap-1 overflow-x-auto p-1.5', FLOATING), children: [WORKFLOW_NODE_KINDS.map((kind) => (_jsx(AddButton, { kind: kind, compact: compact, onClick: () => onAdd(kind) }, kind))), _jsx("span", { className: cn('mx-1 h-6 w-px shrink-0 bg-zinc-200 dark:bg-zinc-800'), "aria-hidden": true }), _jsx(Tooltip, { content: "Lay the nodes out left to right by dependency, with every sink in the last column.", children: _jsxs(Button, { variant: "ghost", size: "sm", onClick: onTidy, "aria-label": "Tidy the layout", className: "shrink-0", children: [_jsx(LayoutGrid, { size: 12 }), _jsx("span", { className: compact ? 'hidden' : 'hidden md:inline', children: "Tidy" })] }) }), refreshing && (
|
|
550
994
|
// A background refetch says so without replacing anything: the graph on
|
|
551
995
|
// screen stays exactly where it is.
|
|
552
|
-
_jsx("span", { className: cn('
|
|
996
|
+
_jsx("span", { className: cn('shrink-0 px-1 font-mono text-[10px]', MUTED), children: "refreshing\u2026" }))] }));
|
|
553
997
|
}
|
|
554
998
|
/**
|
|
555
999
|
* Which workflow the screen should be showing.
|
|
@@ -600,6 +1044,142 @@ function miniMapColor(data) {
|
|
|
600
1044
|
return '#f43f5e';
|
|
601
1045
|
return '#8b5cf6';
|
|
602
1046
|
}
|
|
1047
|
+
/**
|
|
1048
|
+
* The overview, and the one thing focus mode does to it.
|
|
1049
|
+
*
|
|
1050
|
+
* WHY IT SHRINKS RATHER THAN GOES
|
|
1051
|
+
* -------------------------------
|
|
1052
|
+
* Focus mode's argument everywhere else is that the chrome it hides is chrome
|
|
1053
|
+
* you do not need while drawing. The minimap is the exception: it is a
|
|
1054
|
+
* navigation aid for exactly the big graph that made somebody want the room in
|
|
1055
|
+
* the first place, so taking it away is taking away the thing the mode is FOR.
|
|
1056
|
+
* It shrinks to the size at which it still answers "where am I", and hovering
|
|
1057
|
+
* it brings the rest back. See {@link MINIMAP_FOCUSED_CLASS} for what survives
|
|
1058
|
+
* at that size and what does not.
|
|
1059
|
+
*
|
|
1060
|
+
* WHY A TRANSFORM AND NOT A SMALLER MINIMAP
|
|
1061
|
+
* -----------------------------------------
|
|
1062
|
+
* React Flow sizes the minimap from `style.width`/`style.height` (defaulting to
|
|
1063
|
+
* 200×150) and derives `viewScale` from them — `boundingRect.width /
|
|
1064
|
+
* elementWidth`. Its pan handler then moves the viewport by `rawClientDelta *
|
|
1065
|
+
* viewScale`, reading `viewScale` LIVE from a ref on every mousemove.
|
|
1066
|
+
*
|
|
1067
|
+
* So shrinking the honest way — passing a smaller width and height — would
|
|
1068
|
+
* change the pan gain, and change it on every frame of an animation between the
|
|
1069
|
+
* two sizes. A drag that started while the map was small and expanded mid-
|
|
1070
|
+
* gesture would have the viewport accelerate under the finger, continuously,
|
|
1071
|
+
* for the length of the animation. That is the exact failure worth avoiding.
|
|
1072
|
+
*
|
|
1073
|
+
* Scaling has none of it: `style.width` stays 200 in both states, so `viewScale`
|
|
1074
|
+
* is a constant and the pan gain is IDENTICAL small, large, and every frame in
|
|
1075
|
+
* between. Scale is a compositor property, so the animation never touches
|
|
1076
|
+
* layout, never re-renders React Flow, and never resolves against `height:
|
|
1077
|
+
* auto` — which is the shape of animation that never settled under jsdom and
|
|
1078
|
+
* left the card body mounted forever in a test. There is nothing here for that
|
|
1079
|
+
* to happen to: the element is always mounted, always 200×150 in layout, and
|
|
1080
|
+
* the only thing moving is one compositor property.
|
|
1081
|
+
*
|
|
1082
|
+
* (Tailwind v4 emits `scale-*` as the INDEPENDENT `scale` property rather than
|
|
1083
|
+
* as `transform: scale(...)`, so the computed `transform` here reads `none` and
|
|
1084
|
+
* the size lives in `scale`. It honours `transform-origin` exactly the same
|
|
1085
|
+
* way, and `transition-transform` in v4 expands to `transform, translate,
|
|
1086
|
+
* scale, rotate` — so the transition below does cover it. Both checked in a
|
|
1087
|
+
* browser rather than assumed, because a transition that silently covers
|
|
1088
|
+
* nothing is a snap that looks like a missing animation.)
|
|
1089
|
+
*
|
|
1090
|
+
* The residue is that while shrunk the pan gain is calibrated for the large map
|
|
1091
|
+
* — a drag would move the viewport less than the small drawing suggests. On a
|
|
1092
|
+
* fine pointer that state is unreachable: a drag needs a press, a press needs
|
|
1093
|
+
* the pointer over the element, and the pointer being over the element is what
|
|
1094
|
+
* expands it. Every drag begins on a settled, full-size map. On a touch screen
|
|
1095
|
+
* there is no shrinking at all ({@link hoverCapablePointer}), so it cannot
|
|
1096
|
+
* arise there either. Expand-then-pan, arrived at by geometry rather than by
|
|
1097
|
+
* disabling anything.
|
|
1098
|
+
*
|
|
1099
|
+
* WHY IT CANNOT FLICKER
|
|
1100
|
+
* ---------------------
|
|
1101
|
+
* Both states are anchored at the same bottom-left corner and the transform
|
|
1102
|
+
* origin is that corner, so the small box is a strict sub-rectangle of the
|
|
1103
|
+
* large one. A pointer that enters the small box is therefore still inside the
|
|
1104
|
+
* large box once it expands, and expansion can never move the element out from
|
|
1105
|
+
* under the pointer that caused it. The one geometry that oscillates — expand,
|
|
1106
|
+
* pointer now outside, collapse, repeat — needs the two boxes to disagree about
|
|
1107
|
+
* a region, and containment is what rules that out.
|
|
1108
|
+
*
|
|
1109
|
+
* It also cannot collide with the zoom controls above it, because the expanded
|
|
1110
|
+
* size is the size the minimap already is today: the gap the shrink opens up is
|
|
1111
|
+
* space that was always reserved for this element, so growing back into it
|
|
1112
|
+
* covers nothing that was not already covered.
|
|
1113
|
+
*/
|
|
1114
|
+
function FocusMiniMap({ focused }) {
|
|
1115
|
+
/*
|
|
1116
|
+
* Read once at mount rather than subscribed to, which is the same call
|
|
1117
|
+
* `railOpenByWidth` makes and for the same reason: a live query would re-shrink
|
|
1118
|
+
* the map under a pointer that is resting on it because a tablet was docked.
|
|
1119
|
+
* The cost of being wrong is one session on the size it booted with.
|
|
1120
|
+
*/
|
|
1121
|
+
const [canHover] = useState(hoverCapablePointer);
|
|
1122
|
+
const shrinks = focused && canHover;
|
|
1123
|
+
return (
|
|
1124
|
+
/*
|
|
1125
|
+
* React Flow's own `Panel`, so this wrapper IS the panel: it takes the
|
|
1126
|
+
* absolute positioning, the 15px margin, the z-index and — the reason it is
|
|
1127
|
+
* `Panel` rather than a hand-rolled div — the rule that switches
|
|
1128
|
+
* `pointer-events` off while a box-selection is being dragged across the
|
|
1129
|
+
* canvas. The minimap inside is switched to `static` so it stops being the
|
|
1130
|
+
* positioned element and becomes this one's content; without that there
|
|
1131
|
+
* would be two absolutely-positioned boxes fighting over one corner.
|
|
1132
|
+
*/
|
|
1133
|
+
_jsx(Panel, { position: "bottom-left",
|
|
1134
|
+
/*
|
|
1135
|
+
* THE KEYBOARD PATH, and it exists only while the map is shrunk.
|
|
1136
|
+
*
|
|
1137
|
+
* A minimap that expands on hover cannot be expanded by somebody who has
|
|
1138
|
+
* no pointer, and `focus-within` is only an answer if something in here
|
|
1139
|
+
* can hold a caret — React Flow's minimap is an `svg` with `role="img"`,
|
|
1140
|
+
* which cannot. So the panel itself becomes the focus stop.
|
|
1141
|
+
*
|
|
1142
|
+
* Conditional on `shrinks`, and that is the whole reason this is safe:
|
|
1143
|
+
* outside focus mode the tab order is byte-for-byte the one the previous
|
|
1144
|
+
* round measured and settled — app nav, card, actions, rail toggle, dock,
|
|
1145
|
+
* rail, canvas — because `undefined` puts no stop here at all. Inside
|
|
1146
|
+
* focus mode there is one extra stop, at the end, on the element that
|
|
1147
|
+
* needs it. That is a net gain for a keyboard: the minimap was never
|
|
1148
|
+
* reachable before, in either mode.
|
|
1149
|
+
*/
|
|
1150
|
+
tabIndex: shrinks ? 0 : undefined, role: shrinks ? 'group' : undefined, "aria-label": shrinks
|
|
1151
|
+
? 'Graph overview, reduced. Hold focus here, or hover it, to see it full size.'
|
|
1152
|
+
: undefined, className: cn(
|
|
1153
|
+
// An overview is worth least on the screen with least room for it:
|
|
1154
|
+
// below `lg` it would cover a sixth of the canvas to describe the other
|
|
1155
|
+
// five. Moved here from the minimap itself along with the positioning.
|
|
1156
|
+
'hidden lg:block',
|
|
1157
|
+
// The corner both states share. `scale` alone would shrink about the
|
|
1158
|
+
// centre and unpin the map from the corner it is anchored to, which is
|
|
1159
|
+
// also what makes the containment argument above hold.
|
|
1160
|
+
'origin-bottom-left',
|
|
1161
|
+
/*
|
|
1162
|
+
* A tween on a transform, matching the duration and the curve the card
|
|
1163
|
+
* body folds on, so the two halves of one gesture move as one gesture.
|
|
1164
|
+
*
|
|
1165
|
+
* `prefers-reduced-motion` gets the same end state and no transition —
|
|
1166
|
+
* a CSS variant rather than the `useReducedMotion()` hook the motion
|
|
1167
|
+
* components here use, because this animation is CSS and the media
|
|
1168
|
+
* query is the direct expression of it. There is no state to keep in
|
|
1169
|
+
* step and nothing to settle.
|
|
1170
|
+
*/
|
|
1171
|
+
'transition-transform duration-200 ease-[cubic-bezier(0.32,0.72,0,1)]', 'motion-reduce:transition-none',
|
|
1172
|
+
// `focus` as well as `focus-within`: the stop is on this element, so it
|
|
1173
|
+
// is `focus` that fires today. `focus-within` is here so that a control
|
|
1174
|
+
// added inside later expands the map rather than being drawn at half
|
|
1175
|
+
// size under somebody's caret.
|
|
1176
|
+
shrinks && MINIMAP_FOCUSED_CLASS, shrinks && 'hover:scale-100 focus:scale-100 focus-within:scale-100',
|
|
1177
|
+
// The focus ring goes on the panel, because the panel is the focus stop.
|
|
1178
|
+
shrinks && 'rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-sky-500'), children: _jsx(MiniMap, { pannable: true, zoomable: true,
|
|
1179
|
+
// Positioning now belongs to the panel above, so the minimap stops
|
|
1180
|
+
// claiming a corner and just draws in the box it is given.
|
|
1181
|
+
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
|
+
}
|
|
603
1183
|
/**
|
|
604
1184
|
* The graph itself, and the two states in which there is no graph to draw.
|
|
605
1185
|
*
|
|
@@ -607,8 +1187,25 @@ function miniMapColor(data) {
|
|
|
607
1187
|
* place of the screen, so the header and its controls stay put while a refetch
|
|
608
1188
|
* resolves — and a failed read never looks like an empty workflow.
|
|
609
1189
|
*/
|
|
610
|
-
function GraphSurface({ loading, failed, error, onRetry, canEdit, draft, flowNodes, flowEdges, onInspect, onEditCode, onNodesChange, onEdgesChange, onConnect, isValidConnection, onConnectEnd, onNodeEnter, onNodeLeave, onPaneClick, onDisconnect, wiring, wiringRefusal, nodeMenu, }) {
|
|
611
|
-
|
|
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, }) {
|
|
1191
|
+
/*
|
|
1192
|
+
* Memoised because they are context values read by every node and every edge
|
|
1193
|
+
* on the canvas. Written inline, as they were, each of these was a fresh
|
|
1194
|
+
* object on every render of the screen — and this screen now re-renders for
|
|
1195
|
+
* things the graph does not care about, like opening the rail. A new context
|
|
1196
|
+
* value re-renders every consumer, which on a large graph is every box and
|
|
1197
|
+
* every wire, for a panel sliding in at the side.
|
|
1198
|
+
*/
|
|
1199
|
+
const nodeHandlers = useMemo(() => ({ onInspect, onEditCode, canEdit, wiring }), [onInspect, onEditCode, canEdit, wiring]);
|
|
1200
|
+
const edgeHandlers = useMemo(() => ({ onDisconnect, canEdit }), [onDisconnect, canEdit]);
|
|
1201
|
+
return (
|
|
1202
|
+
/*
|
|
1203
|
+
* The surface IS the screen: pinned to all four edges, with the chrome
|
|
1204
|
+
* layered over it by a sibling. Nothing here is a box in a column any more,
|
|
1205
|
+
* so there is no border and no rounded corner — a full-bleed canvas that
|
|
1206
|
+
* draws its own frame is a canvas pretending to still be a widget.
|
|
1207
|
+
*/
|
|
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,
|
|
612
1209
|
// Off, so there is exactly ONE click path through a handle and it
|
|
613
1210
|
// is the one in `workflow/wiring.tsx`. React Flow's own click
|
|
614
1211
|
// wiring connects but draws nothing while it is open and cannot
|
|
@@ -618,7 +1215,10 @@ function GraphSurface({ loading, failed, error, onRetry, canEdit, draft, flowNod
|
|
|
618
1215
|
// A wider drop zone than the 20px default, because these handles are
|
|
619
1216
|
// the only drop target on the screen and missing one reads as the
|
|
620
1217
|
// canvas ignoring you.
|
|
621
|
-
connectionRadius: 28, proOptions: { hideAttribution: false }, ariaLabelConfig: ARIA_LABELS, "aria-label": `${WORKFLOW_NAME.title} canvas. ${draft.nodes.length} nodes, ${draft.edges.length} connections.`, fitView: true, children: [_jsx(Background, { variant: BackgroundVariant.Dots, gap: 18, size: 1 }), _jsx(Controls, { showInteractive: false,
|
|
1218
|
+
connectionRadius: 28, proOptions: { hideAttribution: false }, ariaLabelConfig: ARIA_LABELS, "aria-label": `${WORKFLOW_NAME.title} canvas. ${draft.nodes.length} nodes, ${draft.edges.length} connections.`, fitView: true, fitViewOptions: { padding: fitPadding }, children: [_jsx(Background, { variant: BackgroundVariant.Dots, gap: 18, size: 1 }), _jsx(Controls, { showInteractive: false, position: "bottom-left", className: cn('!bottom-[9.5rem] !overflow-hidden !rounded-lg !border !border-zinc-200', '!shadow-sm dark:!border-zinc-800 [&>button]:!border-none',
|
|
1219
|
+
// Below `lg` the minimap is gone, so the zoom controls drop
|
|
1220
|
+
// back down into the corner it vacated.
|
|
1221
|
+
'!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] }) }) }))] }));
|
|
622
1222
|
}
|
|
623
1223
|
/**
|
|
624
1224
|
* The wiring control that lives on a node, and the menu behind it.
|
|
@@ -900,7 +1500,55 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
900
1500
|
const [inspecting, setInspecting] = useState(null);
|
|
901
1501
|
const [editingCodeFor, setEditingCodeFor] = useState(null);
|
|
902
1502
|
const [confirmingDelete, setConfirmingDelete] = useState(false);
|
|
1503
|
+
/**
|
|
1504
|
+
* Whether the "throw away every unsaved edit" dialog is open.
|
|
1505
|
+
*
|
|
1506
|
+
* Held here rather than inside the controls because Reset is destructive of
|
|
1507
|
+
* work in exactly the way deleting the workflow is destructive of the
|
|
1508
|
+
* workflow, and this screen keeps every "are you sure" at the level that owns
|
|
1509
|
+
* the thing being destroyed.
|
|
1510
|
+
*/
|
|
1511
|
+
const [resetting, setResetting] = useState(false);
|
|
903
1512
|
const [run, setRun] = useState(null);
|
|
1513
|
+
/**
|
|
1514
|
+
* Whether the details rail is on screen.
|
|
1515
|
+
*
|
|
1516
|
+
* Open by default where there is room for it, and that default is the answer
|
|
1517
|
+
* to "the problems have to stay visible": they are visible, in full, from the
|
|
1518
|
+
* first paint on any screen that can afford 19rem. Closing it is a choice
|
|
1519
|
+
* somebody makes to get the room back, and the toggle then carries the problem
|
|
1520
|
+
* count so the *fact* of a problem never depends on the panel being open.
|
|
1521
|
+
*
|
|
1522
|
+
* Read once, from the width at mount, rather than subscribed to. A live media
|
|
1523
|
+
* query would reopen a panel somebody had just closed because they turned
|
|
1524
|
+
* their tablet, which is worse than the panel being open on a narrow screen
|
|
1525
|
+
* they can shut it on. `globalThis.innerWidth` guards the case where there is
|
|
1526
|
+
* no window at all — this component is rendered on a server by anybody using
|
|
1527
|
+
* SSR, and a bare `window` there is a crash rather than a layout bug.
|
|
1528
|
+
*/
|
|
1529
|
+
const [railOpen, setRailOpen] = useState(railOpenByDefault);
|
|
1530
|
+
const { focused, toggleFocus } = useFocusMode(railOpen, setRailOpen);
|
|
1531
|
+
const cardCollapsed = focusCollapsesTheCard(focused, draft.name);
|
|
1532
|
+
/**
|
|
1533
|
+
* The region of the viewport the graph should be fitted into.
|
|
1534
|
+
*
|
|
1535
|
+
* See {@link CHROME}. Two sides move: the right with the rail, the top with
|
|
1536
|
+
* the card's collapse.
|
|
1537
|
+
*
|
|
1538
|
+
* Declared up here with the state rather than beside its use, because both
|
|
1539
|
+
* `fitView` call sites below name it in a dependency array — and a `const` read
|
|
1540
|
+
* by a hook that runs earlier in the body is a temporal-dead-zone crash, not a
|
|
1541
|
+
* lint warning.
|
|
1542
|
+
*
|
|
1543
|
+
* Toggling the rail deliberately does NOT re-fit, and neither does entering
|
|
1544
|
+
* focus. That would throw away a viewport somebody had panned to, in response
|
|
1545
|
+
* to an action about a panel; the new padding applies at the next fit that was
|
|
1546
|
+
* going to happen anyway — opening a graph, or pressing Tidy. Focus is the
|
|
1547
|
+
* stronger case for the same rule: somebody who has just asked for room is
|
|
1548
|
+
* looking at a particular part of the graph, and jumping the viewport is the
|
|
1549
|
+
* one thing that would lose it.
|
|
1550
|
+
*/
|
|
1551
|
+
const fitPadding = useMemo(() => chromeFitPadding(railOpen, cardCollapsed), [railOpen, cardCollapsed]);
|
|
904
1552
|
/**
|
|
905
1553
|
* Whether the "this load is expected to shrink" dialog is open.
|
|
906
1554
|
*
|
|
@@ -983,13 +1631,32 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
983
1631
|
// `draftId` is the trigger, not a value the body reads — which is exactly why
|
|
984
1632
|
// the rule calls it unnecessary. Dropping it would fit the view once on mount
|
|
985
1633
|
// and never again, leaving every workflow opened afterwards off-screen.
|
|
986
|
-
//
|
|
1634
|
+
// `fitPadding` is read by the body but deliberately kept OUT of the deps: it
|
|
1635
|
+
// changes when the rail is toggled, and re-fitting there would yank the
|
|
1636
|
+
// viewport away from wherever somebody had panned to, as the side effect of
|
|
1637
|
+
// opening a panel. The padding it fits with is whatever is current at the next
|
|
1638
|
+
// graph swap, which is the moment a fit is wanted.
|
|
1639
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: draftId is what the effect watches for, not something its body uses; fitPadding is read but must not re-trigger it
|
|
987
1640
|
useEffect(() => {
|
|
988
|
-
const frame = window.requestAnimationFrame(() => fitView({ padding:
|
|
1641
|
+
const frame = window.requestAnimationFrame(() => fitView({ padding: fitPadding, duration: 200 }));
|
|
989
1642
|
return () => window.cancelAnimationFrame(frame);
|
|
990
1643
|
}, [draftId, fitView]);
|
|
991
|
-
|
|
992
|
-
|
|
1644
|
+
/**
|
|
1645
|
+
* Every change to the drawing, through one door — and every one of them
|
|
1646
|
+
* recorded so it can be taken back.
|
|
1647
|
+
*
|
|
1648
|
+
* The action is REQUIRED rather than optional, which is the only thing keeping
|
|
1649
|
+
* the undo announcement honest: a default would let a new call site add an
|
|
1650
|
+
* entry that reverts something and says nothing about what.
|
|
1651
|
+
*
|
|
1652
|
+
* It may be a function of the current draft, for the labels that need to name
|
|
1653
|
+
* a node. Computing those here would mean this callback depends on
|
|
1654
|
+
* `draft.nodes` and is rebuilt on every graph change, which React Flow feels;
|
|
1655
|
+
* computing them inside the updater keeps the dependency list empty and keeps
|
|
1656
|
+
* the whole thing pure.
|
|
1657
|
+
*/
|
|
1658
|
+
const edit = useCallback((change, action) => {
|
|
1659
|
+
setDraft((current) => withEdit(current, change(current), typeof action === 'function' ? action(current) : action));
|
|
993
1660
|
}, []);
|
|
994
1661
|
const transformIds = useMemo(() => new Set(transforms.map((transform) => transform.id)), [transforms]);
|
|
995
1662
|
/**
|
|
@@ -1068,6 +1735,11 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1068
1735
|
const { positions, removed } = nodeMovesAndRemovals(changes);
|
|
1069
1736
|
if (positions.size === 0 && removed.size === 0)
|
|
1070
1737
|
return;
|
|
1738
|
+
// The drag's own answer to "is this still one gesture". React Flow sets it
|
|
1739
|
+
// on every frame while the pointer is down and clears it on the frame that
|
|
1740
|
+
// drops the node, so a drag across the canvas is one undo step however
|
|
1741
|
+
// many hundred position changes it emitted and however long it took.
|
|
1742
|
+
const dragging = changes.some((change) => change.type === 'position' && change.dragging === true);
|
|
1071
1743
|
edit((current) => ({
|
|
1072
1744
|
...current,
|
|
1073
1745
|
nodes: current.nodes
|
|
@@ -1080,7 +1752,16 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1080
1752
|
// would produce edges pointing at nothing, which React Flow silently
|
|
1081
1753
|
// drops from the canvas while the save still sends them.
|
|
1082
1754
|
edges: current.edges.filter((edge) => !removed.has(edge.from) && !removed.has(edge.to)),
|
|
1083
|
-
}))
|
|
1755
|
+
}), (current) => removed.size > 0
|
|
1756
|
+
? // A deletion is never folded into a move: it is the one change on
|
|
1757
|
+
// this canvas somebody is most likely to want back, and it must
|
|
1758
|
+
// not disappear into the drag that happened just before it.
|
|
1759
|
+
{ label: `deleting ${namesOf(current.nodes, removed)}` }
|
|
1760
|
+
: {
|
|
1761
|
+
label: `moving ${namesOf(current.nodes, positions.keys())}`,
|
|
1762
|
+
run: 'move',
|
|
1763
|
+
continuing: dragging,
|
|
1764
|
+
});
|
|
1084
1765
|
if (removed.size > 0) {
|
|
1085
1766
|
// Housekeeping, not a rule: a node that no longer exists cannot be
|
|
1086
1767
|
// unfinished, and leaving its id behind would hold back a later node
|
|
@@ -1097,7 +1778,9 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1097
1778
|
edit((current) => ({
|
|
1098
1779
|
...current,
|
|
1099
1780
|
edges: current.edges.filter((edge) => !removed.has(edgeId(edge))),
|
|
1100
|
-
})
|
|
1781
|
+
}), {
|
|
1782
|
+
label: `removing ${removed.size} connection${removed.size === 1 ? '' : 's'}`,
|
|
1783
|
+
});
|
|
1101
1784
|
setAnnouncement(`${removed.size} connection${removed.size === 1 ? '' : 's'} removed.`);
|
|
1102
1785
|
}, [edit]);
|
|
1103
1786
|
/**
|
|
@@ -1140,6 +1823,8 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1140
1823
|
edit((current) => ({
|
|
1141
1824
|
...current,
|
|
1142
1825
|
edges: current.edges.filter((candidate) => edgeId(candidate) !== id),
|
|
1826
|
+
}), (current) => ({
|
|
1827
|
+
label: `disconnecting ${namesOf(current.nodes, [edge.from])} from ${namesOf(current.nodes, [edge.to])}`,
|
|
1143
1828
|
}));
|
|
1144
1829
|
markStarted(edge.from, edge.to);
|
|
1145
1830
|
setAnnouncement('Connection removed.');
|
|
@@ -1153,7 +1838,9 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1153
1838
|
* can make here: it inverts which half of the pipeline runs.
|
|
1154
1839
|
*/
|
|
1155
1840
|
const setBranch = useCallback((edge, branch) => {
|
|
1156
|
-
edit((current) => ({ ...current, edges: edgeOnBranch(current.edges, edge, branch) }))
|
|
1841
|
+
edit((current) => ({ ...current, edges: edgeOnBranch(current.edges, edge, branch) }), (current) => ({
|
|
1842
|
+
label: `putting ${namesOf(current.nodes, [edge.to])} on the "${branch}" branch`,
|
|
1843
|
+
}));
|
|
1157
1844
|
markStarted(edge.from, edge.to);
|
|
1158
1845
|
setAnnouncement(`${nodeLabelIn(draft.nodes, edge.to)} is now on the "${branch}" branch of ${nodeLabelIn(draft.nodes, edge.from)}.`);
|
|
1159
1846
|
}, [draft.nodes, edit, markStarted]);
|
|
@@ -1169,6 +1856,8 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1169
1856
|
edit((current) => ({
|
|
1170
1857
|
...current,
|
|
1171
1858
|
edges: [...current.edges, newEdge(current.nodes, current.edges, from, to)],
|
|
1859
|
+
}), (current) => ({
|
|
1860
|
+
label: `connecting ${namesOf(current.nodes, [from])} to ${namesOf(current.nodes, [to])}`,
|
|
1172
1861
|
}));
|
|
1173
1862
|
markStarted(from, to);
|
|
1174
1863
|
setAnnouncement(`${nodeLabelIn(draft.nodes, from)} now feeds ${nodeLabelIn(draft.nodes, to)}.`);
|
|
@@ -1254,6 +1943,11 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1254
1943
|
mutationFn: ({ id, options }) => client.runWorkflow(id, options),
|
|
1255
1944
|
onSuccess: (result) => {
|
|
1256
1945
|
setRun(result);
|
|
1946
|
+
// The answer to a run is written in the rail, so a run that finishes while
|
|
1947
|
+
// the rail is put away would report itself into a panel nobody can see.
|
|
1948
|
+
// Pressing Run is the clearest possible statement that somebody wants the
|
|
1949
|
+
// outcome, so this is the one place the screen opens it on their behalf.
|
|
1950
|
+
setRailOpen(true);
|
|
1257
1951
|
// A run writes rows, so the catalog snapshot every other screen reads is
|
|
1258
1952
|
// now stale. Invalidating it here is what stops the object explorer
|
|
1259
1953
|
// showing yesterday's counts beside a run that just finished.
|
|
@@ -1305,6 +1999,12 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1305
1999
|
edit((current) => ({
|
|
1306
2000
|
...current,
|
|
1307
2001
|
nodes: runningTransform(current.nodes, nodeId, created.id),
|
|
2002
|
+
}),
|
|
2003
|
+
// Only the half of this that lives in the draft. The transform itself
|
|
2004
|
+
// was created on the server and stays there — undoing this unpicks the
|
|
2005
|
+
// node from it, which is the part of the act this canvas owns.
|
|
2006
|
+
(current) => ({
|
|
2007
|
+
label: `pointing ${namesOf(current.nodes, [nodeId])} at "${created.name}"`,
|
|
1308
2008
|
}));
|
|
1309
2009
|
markStarted(nodeId);
|
|
1310
2010
|
// Written into the cache as well as invalidated: the code sheet below
|
|
@@ -1331,14 +2031,14 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1331
2031
|
});
|
|
1332
2032
|
const addNode = useCallback((kind) => {
|
|
1333
2033
|
const id = newLocalId(kind);
|
|
1334
|
-
|
|
2034
|
+
edit((current) => {
|
|
1335
2035
|
const node = newNodeOfKind(kind, id, nextPosition(current.nodes), uniqueName(current.nodes, kind));
|
|
1336
|
-
return { ...current, nodes: [...current.nodes, node]
|
|
1337
|
-
});
|
|
2036
|
+
return { ...current, nodes: [...current.nodes, node] };
|
|
2037
|
+
}, { label: `adding a ${kind} node` });
|
|
1338
2038
|
setUnstarted((current) => new Set([...current, id]));
|
|
1339
2039
|
setInspecting(id);
|
|
1340
2040
|
setAnnouncement(`A ${kind} node was added. Its inspector is open.`);
|
|
1341
|
-
}, []);
|
|
2041
|
+
}, [edit]);
|
|
1342
2042
|
/**
|
|
1343
2043
|
* Make the next node and wire it in, as one action.
|
|
1344
2044
|
*
|
|
@@ -1368,7 +2068,11 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1368
2068
|
...current,
|
|
1369
2069
|
nodes: [...current.nodes, node],
|
|
1370
2070
|
edges: [...current.edges, newEdge(current.nodes, current.edges, fromId, node.id)],
|
|
1371
|
-
})
|
|
2071
|
+
}),
|
|
2072
|
+
// ONE entry, for two graph changes. The node and the wire are a single
|
|
2073
|
+
// gesture — "put the next box here" — and undoing them separately would
|
|
2074
|
+
// leave a node somebody never asked for on its own on the canvas.
|
|
2075
|
+
{ label: `adding ${nodeName(node)} wired from ${nodeName(from)}` });
|
|
1372
2076
|
setUnstarted((current) => new Set([...current, node.id]));
|
|
1373
2077
|
menu.close();
|
|
1374
2078
|
setInspecting(node.id);
|
|
@@ -1378,10 +2082,63 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1378
2082
|
edit((current) => ({
|
|
1379
2083
|
...current,
|
|
1380
2084
|
nodes: layout(current.nodes, current.edges),
|
|
1381
|
-
})
|
|
1382
|
-
|
|
2085
|
+
}),
|
|
2086
|
+
// One entry, and a big one: Tidy moves every node at once, and it is
|
|
2087
|
+
// precisely the control somebody presses on a layout they had arranged by
|
|
2088
|
+
// hand and then wants back.
|
|
2089
|
+
{ label: 'tidying the layout' });
|
|
2090
|
+
window.requestAnimationFrame(() => fitView({ padding: fitPadding, duration: 200 }));
|
|
1383
2091
|
setAnnouncement('The nodes were laid out left to right by dependency, with every sink in the last column.');
|
|
1384
|
-
}, [edit, fitView]);
|
|
2092
|
+
}, [edit, fitView, fitPadding]);
|
|
2093
|
+
/**
|
|
2094
|
+
* One action back.
|
|
2095
|
+
*
|
|
2096
|
+
* Announced with the name of what it took back, because undo is the one
|
|
2097
|
+
* control here whose effect is routinely invisible: the node it just put back
|
|
2098
|
+
* may be off screen, and a revert nobody can see is indistinguishable from a
|
|
2099
|
+
* button that did nothing.
|
|
2100
|
+
*
|
|
2101
|
+
* The step is computed out here rather than inside the updater so the label is
|
|
2102
|
+
* available to say — and so nothing sets state from inside a `setState`
|
|
2103
|
+
* updater, which React is free to replay.
|
|
2104
|
+
*/
|
|
2105
|
+
const undo = useCallback(() => {
|
|
2106
|
+
const step = undone(draft);
|
|
2107
|
+
if (!step) {
|
|
2108
|
+
setAnnouncement('There is nothing to take back — this drawing is as it was loaded.');
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
setDraft(step.draft);
|
|
2112
|
+
// The inspector is open on a node that may have just stopped existing, and
|
|
2113
|
+
// a sheet describing a deleted node is worse than no sheet.
|
|
2114
|
+
setInspecting((current) => current && step.draft.nodes.some((node) => node.id === current) ? current : null);
|
|
2115
|
+
setUnstarted((current) => keepKnown(current, step.draft.nodes));
|
|
2116
|
+
const left = step.draft.past.length;
|
|
2117
|
+
setAnnouncement(`Undone: ${step.label}. ${left === 0 ? 'Nothing left to take back.' : `${left} ${left === 1 ? 'action' : 'actions'} left to take back.`}`);
|
|
2118
|
+
}, [draft]);
|
|
2119
|
+
/**
|
|
2120
|
+
* All the way back to the version the server last stored.
|
|
2121
|
+
*
|
|
2122
|
+
* Deliberately NOT "undo until the stack is empty". Save halfway through a
|
|
2123
|
+
* session and the baseline moves to that save, so this returns to the saved
|
|
2124
|
+
* v2 — whereas undoing forty times would walk straight past it back to the v1
|
|
2125
|
+
* the tab was opened on. Which of the two somebody means by "reset" is not in
|
|
2126
|
+
* doubt, and the confirmation says which one this is.
|
|
2127
|
+
*/
|
|
2128
|
+
const reset = useCallback(() => {
|
|
2129
|
+
const back = reverted(draft);
|
|
2130
|
+
setDraft(back);
|
|
2131
|
+
setResetting(false);
|
|
2132
|
+
setInspecting(null);
|
|
2133
|
+
setSelectedNodeIds([]);
|
|
2134
|
+
setSelectedEdgeIds([]);
|
|
2135
|
+
setUnstarted(new Set());
|
|
2136
|
+
setAnnouncement(draft.id
|
|
2137
|
+
? `Reset. The drawing is back to v${draft.version ?? 1}, as the server stored it. Nothing on the server was changed.`
|
|
2138
|
+
: 'Reset. The canvas is empty again, which is where this unsaved workflow started.');
|
|
2139
|
+
}, [draft]);
|
|
2140
|
+
useUndoShortcut({ enabled: canEdit, onUndo: undo, onSay: setAnnouncement });
|
|
2141
|
+
useUnsavedGuard(draft.dirty);
|
|
1385
2142
|
const durability = describeDurability(capabilities?.durable);
|
|
1386
2143
|
// Asked about EVERY problem, not about `live`. This is the guarantee: a graph
|
|
1387
2144
|
// that would silently do nothing is coloured as unsaveable from the moment it
|
|
@@ -1484,29 +2241,45 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1484
2241
|
}), [client]);
|
|
1485
2242
|
return (
|
|
1486
2243
|
/*
|
|
1487
|
-
*
|
|
1488
|
-
* canvas that takes whatever is left.
|
|
2244
|
+
* THE CANVAS IS THE SCREEN.
|
|
1489
2245
|
*
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
1494
|
-
*
|
|
1495
|
-
*
|
|
1496
|
-
*
|
|
2246
|
+
* One positioned box filling whatever the host gives it, with exactly two
|
|
2247
|
+
* layers in it: the graph, pinned to all four edges, and the chrome floating
|
|
2248
|
+
* over the graph. Nothing is in normal flow and nothing scrolls — a
|
|
2249
|
+
* full-bleed canvas that can be scrolled away from is a canvas that is not
|
|
2250
|
+
* actually the screen.
|
|
2251
|
+
*
|
|
2252
|
+
* What that buys, and it is the whole point: the drawing surface is now the
|
|
2253
|
+
* entire viewport instead of the ~55% left over after a header, a button row
|
|
2254
|
+
* and a column of panels had taken their share.
|
|
2255
|
+
*
|
|
2256
|
+
* What it costs is occlusion — a panel over the canvas covers graph. Three
|
|
2257
|
+
* things pay that back. The chrome is compact and translucent, so what is
|
|
2258
|
+
* behind it stays perceptible. Everything permanent is either an
|
|
2259
|
+
* always-needed control or dismissible. And `fitView` is given the chrome's
|
|
2260
|
+
* own insets (see `CHROME`), so the graph is fitted into the region nothing
|
|
2261
|
+
* covers rather than into the raw viewport — which is what stops a node
|
|
2262
|
+
* being centred underneath the action cluster.
|
|
1497
2263
|
*/
|
|
1498
|
-
_jsxs("div", { className: "
|
|
2264
|
+
_jsxs("div", { className: "relative h-full min-h-0 w-full overflow-hidden", children: [_jsxs("div", { className: "pointer-events-none absolute inset-0 z-20 flex flex-col gap-3 p-3 sm:p-4", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsx(WorkflowCard, { eyebrow: eyebrow, title: title, intro: intro, stored: stored, produces: produces, durability: durability, selected: selected, workflowOptions: workflowOptions, workflowsPending: workflows.isPending, draftName: draft.name, canEdit: canEdit, collapsed: cardCollapsed, reducedMotion: reducedMotion, onExpand: toggleFocus, onSelect: (value) => {
|
|
1499
2265
|
loadedRef.current = null;
|
|
1500
2266
|
setSelected(value);
|
|
1501
|
-
},
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
2267
|
+
},
|
|
2268
|
+
// Typing is one action, not one per keystroke: consecutive edits
|
|
2269
|
+
// sharing the `rename` run fold together while the run is open. See
|
|
2270
|
+
// `RUN_WINDOW_MS`.
|
|
2271
|
+
onRename: (name) => edit((current) => ({ ...current, name }), {
|
|
2272
|
+
label: 'renaming this workflow',
|
|
2273
|
+
run: 'rename',
|
|
2274
|
+
}) }), _jsxs("div", { className: "flex max-w-full flex-col items-end gap-2", children: [_jsxs("div", { className: cn('pointer-events-auto flex items-start gap-2 p-1.5', FLOATING), children: [_jsx(CanvasActions, { draft: draft, stored: stored, canEdit: canEdit, blocked: blocked, unfinished: unfinished, saving: save.isPending, running: runIt.isPending, durabilityDetail: durability.detail, acknowledging: acknowledging, reducedMotion: reducedMotion, resetting: resetting, onAcknowledgingChange: setAcknowledging, onResettingChange: setResetting, onUndo: undo, onReset: reset, onSave: saveNow, onRun: runNow, onLifecycleChange: onLifecycleChange, onAskDelete: () => setConfirmingDelete(true) }), _jsx("span", { className: "h-6 w-px shrink-0 bg-zinc-200 dark:bg-zinc-800", "aria-hidden": true }), _jsx(RailToggle, { open: railOpen, problems: live, onToggle: () => setRailOpen((o) => !o) }), _jsx(FocusToggle, { on: focused, cardCollapsed: cardCollapsed, onToggle: toggleFocus })] }), _jsxs("div", { className: "pointer-events-auto w-[min(26rem,100%)] empty:hidden", children: [save.error && _jsx(RefusalNote, { lead: "The server refused it:", error: save.error }), runIt.error && _jsx(RefusalNote, { lead: "The run could not start:", error: runIt.error }), _jsx(ShrinkRefusalNote, { run: run, error: runIt.error, onAcknowledge: () => setAcknowledging(true) })] })] })] }), canEdit && (_jsx("div", { className: "absolute inset-x-0 bottom-3 flex justify-center px-3 sm:bottom-4 sm:px-4", children: _jsx(AddNodeBar, { refreshing: workflows.isFetching && !workflows.isPending, compact: focused, onAdd: addNode, onTidy: tidy }) })), _jsx("div", { className: "flex min-h-0 flex-1 justify-end pb-14", children: _jsx(AnimatePresence, { initial: false, children: railOpen && (_jsx(WiringRail, { draft: draft, problems: live, pending: pending, run: run, canEdit: canEdit, reducedMotion: reducedMotion, onInspect: setInspecting, onDisconnect: disconnect, onClose: () => setRailOpen(false), children: stored && (_jsxs(_Fragment, { children: [_jsx(SchedulePanel, { workflow: stored, canEdit: canEdit, onScheduled: onLifecycleChange }, stored.id), _jsx(RunsAsPanel, { workflowId: stored.id, status: stored.status, transforms: graphTransforms })] })) })) }) })] }), _jsx(GraphSurface, { focused: focused, loading: workflows.isPending, failed: workflows.isError, error: workflows.error, onRetry: () => workflows.refetch(), canEdit: canEdit, draft: draft, flowNodes: flowNodes, flowEdges: flowEdges, onInspect: setInspecting, onEditCode: setEditingCodeFor, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, onConnect: onConnect, isValidConnection: isValidConnection, onConnectEnd: announceRefusedDrop, onNodeEnter: menu.onNodeEnter, onNodeLeave: menu.onNodeLeave,
|
|
2275
|
+
// Clicking empty canvas puts away everything that is half-open: the
|
|
2276
|
+
// wiring menu, and a wire that was started and never landed. React
|
|
2277
|
+
// Flow only fires this for clicks on the pane ITSELF, so finishing a
|
|
2278
|
+
// wire on a handle does not also cancel it on the way past.
|
|
2279
|
+
onPaneClick: () => {
|
|
2280
|
+
menu.close();
|
|
2281
|
+
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) => {
|
|
1510
2283
|
// Editing any field is the clearest statement there is that somebody
|
|
1511
2284
|
// is working on this node rather than looking at one they just made.
|
|
1512
2285
|
markStarted(next.id);
|
|
@@ -1522,19 +2295,20 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1522
2295
|
// updater below: an updater is called again on every re-render React
|
|
1523
2296
|
// decides to replay, and a `setState` in one is a side effect that
|
|
1524
2297
|
// would fire with it.
|
|
1525
|
-
|
|
2298
|
+
const before = draft.nodes.find((node) => node.id === next.id);
|
|
2299
|
+
if (readsDifferently(before, next)) {
|
|
1526
2300
|
forgetShape(next.id);
|
|
1527
2301
|
}
|
|
1528
2302
|
edit((current) => ({
|
|
1529
2303
|
...current,
|
|
1530
2304
|
nodes: current.nodes.map((node) => (node.id === next.id ? next : node)),
|
|
1531
|
-
}));
|
|
2305
|
+
}), nodeEditAction(before, next));
|
|
1532
2306
|
}, onConnect: connect, onConnectToNew: connectToNew, onDisconnect: disconnect, onBranch: setBranch, onCreateTransform: (nodeId) => createTransform.mutate(nodeId), creatingTransform: createTransform.isPending, createTransformError: createTransform.error, onDelete: (nodeId) => {
|
|
1533
2307
|
edit((current) => ({
|
|
1534
2308
|
...current,
|
|
1535
2309
|
nodes: current.nodes.filter((node) => node.id !== nodeId),
|
|
1536
2310
|
edges: current.edges.filter((edge) => edge.from !== nodeId && edge.to !== nodeId),
|
|
1537
|
-
}));
|
|
2311
|
+
}), (current) => ({ label: `deleting ${namesOf(current.nodes, [nodeId])}` }));
|
|
1538
2312
|
setInspecting(null);
|
|
1539
2313
|
setAnnouncement('Node removed, along with its connections.');
|
|
1540
2314
|
}, onEditCode: (nodeId) => setEditingCodeFor(nodeId) }), _jsx(Sheet, { open: editingCodeFor !== null, onOpenChange: (open) => {
|
|
@@ -1547,8 +2321,21 @@ function Canvas({ title = WORKFLOW_NAME.titlePlural, eyebrow = 'Ingestion', intr
|
|
|
1547
2321
|
});
|
|
1548
2322
|
} })) : (_jsx("p", { className: cn('py-8 text-center text-xs', MUTED), children: "This node does not name a transform yet. Choose one in the inspector first \u2014 there is no code to open until it does." })) }), _jsx(ConfirmDialog, { open: confirmingDelete, onOpenChange: setConfirmingDelete, title: `Delete "${draft.name || WORKFLOW_NAME.singular}"?`, description: `The connector it runs as goes with it, and the run history keyed on that connector goes too — including the incremental watermark, so anything rebuilt later reads its source from the beginning. The snapshots it already committed stay where they are. The transforms and connections it wired together are not touched: they are shared, and other ${WORKFLOW_NAME.plural} may use them.`, confirmLabel: "Delete", pending: remove.isPending, error: remove.error instanceof Error ? remove.error.message : undefined, onConfirm: () => draft.id && remove.mutate(draft.id) })] }));
|
|
1549
2323
|
}
|
|
1550
|
-
|
|
1551
|
-
|
|
2324
|
+
/**
|
|
2325
|
+
* "a" or "an", for a name that is now generated rather than typed out.
|
|
2326
|
+
*
|
|
2327
|
+
* Worth the three lines: the row used to carry six hand-written labels, and the
|
|
2328
|
+
* moment they were derived from the kind the sixth one read "Add a if node".
|
|
2329
|
+
* That string is not decoration — it is the whole accessible name of the button,
|
|
2330
|
+
* so the only person it is wrong for is the one who cannot see the icon.
|
|
2331
|
+
*/
|
|
2332
|
+
function article(word) {
|
|
2333
|
+
return /^[aeiou]/i.test(word) ? 'an' : 'a';
|
|
2334
|
+
}
|
|
2335
|
+
function AddButton({ kind, compact, onClick, }) {
|
|
2336
|
+
const { icon: Icon, label, hint } = ADD_NODE[kind];
|
|
2337
|
+
const noun = label.toLowerCase();
|
|
2338
|
+
return (_jsx(Tooltip, { content: hint, children: _jsxs(Button, { variant: "ghost", size: "sm", onClick: onClick, "aria-label": `Add ${article(noun)} ${noun} node`, className: "shrink-0 text-zinc-600 dark:text-zinc-300", children: [_jsx(Plus, { size: 11 }), _jsx(Icon, { size: 12 }), _jsx("span", { className: compact ? 'hidden' : 'hidden md:inline', children: label })] }) }));
|
|
1552
2339
|
}
|
|
1553
2340
|
/**
|
|
1554
2341
|
* Whether a failed run resumes or restarts, stated on the screen that implies
|
|
@@ -1578,6 +2365,198 @@ function DurabilityBanner({ durability, }) {
|
|
|
1578
2365
|
function CanvasSkeleton() {
|
|
1579
2366
|
return (_jsx("div", { className: "flex h-full w-full items-center justify-center bg-zinc-50 dark:bg-zinc-950", children: _jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "h-16 w-48 animate-pulse rounded-lg bg-zinc-200 dark:bg-zinc-800" }), _jsx(ArrowRight, { size: 14, className: MUTED }), _jsx("div", { className: "h-16 w-48 animate-pulse rounded-lg bg-zinc-200 dark:bg-zinc-800" }), _jsx(ArrowRight, { size: 14, className: MUTED }), _jsx("div", { className: "h-16 w-48 animate-pulse rounded-lg bg-zinc-200 dark:bg-zinc-800" })] }) }));
|
|
1580
2367
|
}
|
|
2368
|
+
/**
|
|
2369
|
+
* Show or hide the details rail, and say what is in it while it is hidden.
|
|
2370
|
+
*
|
|
2371
|
+
* The count is the load-bearing part. A rail that can be closed is a rail that
|
|
2372
|
+
* can hide the problems list, and "there are two errors" is not something
|
|
2373
|
+
* somebody should have to open a panel to discover — so the closed state carries
|
|
2374
|
+
* the number and the colour, and opening it is what gets the sentences. The
|
|
2375
|
+
* accessible name says the same thing in words, because a red 2 on a button is
|
|
2376
|
+
* not information if you cannot see it.
|
|
2377
|
+
*/
|
|
2378
|
+
function RailToggle({ open, problems, onToggle, }) {
|
|
2379
|
+
const badge = problemBadge(problems);
|
|
2380
|
+
const hint = open
|
|
2381
|
+
? 'Hide the wiring, problems, schedule and run history, and give the canvas the room.'
|
|
2382
|
+
: `Show the wiring, problems, schedule and run history.${badge ? ` ${badge.sentence}` : ''}`;
|
|
2383
|
+
const name = open
|
|
2384
|
+
? 'Hide the details panel'
|
|
2385
|
+
: `Show the details panel${badge ? `, ${badge.summary}` : ''}`;
|
|
2386
|
+
return (_jsx(Tooltip, { content: hint, children: _jsxs(Button, { variant: "ghost", size: "sm", onClick: onToggle, "aria-expanded": open, "aria-label": name, className: "shrink-0", children: [_jsx(PanelRight, { size: 12 }), !open && badge && (_jsx("span", { className: cn('rounded px-1 font-mono text-[10px]', badge.tone), children: badge.count }))] }) }));
|
|
2387
|
+
}
|
|
2388
|
+
/**
|
|
2389
|
+
* The one number a closed rail has to carry, or nothing at all.
|
|
2390
|
+
*
|
|
2391
|
+
* Errors win over warnings rather than being summed: a graph with one error and
|
|
2392
|
+
* six warnings is an error, and "7" beside a neutral chip would be the button
|
|
2393
|
+
* averaging two different facts into one that is neither.
|
|
2394
|
+
*
|
|
2395
|
+
* Split out of {@link RailToggle} because the three shapes it produces — a
|
|
2396
|
+
* count, a colour and two grammatical forms — were four nested ternaries inside
|
|
2397
|
+
* JSX, which is how a badge ends up saying "1 errors".
|
|
2398
|
+
*/
|
|
2399
|
+
function problemBadge(problems) {
|
|
2400
|
+
const errors = problems.filter((problem) => problem.level === 'error').length;
|
|
2401
|
+
const warnings = problems.length - errors;
|
|
2402
|
+
if (errors > 0) {
|
|
2403
|
+
return {
|
|
2404
|
+
count: errors,
|
|
2405
|
+
summary: `${errors} ${errors === 1 ? 'error' : 'errors'}`,
|
|
2406
|
+
sentence: `There ${errors === 1 ? 'is' : 'are'} ${errors} ${errors === 1 ? 'error' : 'errors'}.`,
|
|
2407
|
+
tone: 'bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-300',
|
|
2408
|
+
};
|
|
2409
|
+
}
|
|
2410
|
+
if (warnings > 0) {
|
|
2411
|
+
return {
|
|
2412
|
+
count: warnings,
|
|
2413
|
+
summary: `${warnings} ${warnings === 1 ? 'warning' : 'warnings'}`,
|
|
2414
|
+
sentence: `There ${warnings === 1 ? 'is' : 'are'} ${warnings} ${warnings === 1 ? 'warning' : 'warnings'}.`,
|
|
2415
|
+
tone: 'bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300',
|
|
2416
|
+
};
|
|
2417
|
+
}
|
|
2418
|
+
return null;
|
|
2419
|
+
}
|
|
2420
|
+
/**
|
|
2421
|
+
* Give the canvas the screen, or give the chrome back.
|
|
2422
|
+
*
|
|
2423
|
+
* ## What this control promises, and what it does not
|
|
2424
|
+
*
|
|
2425
|
+
* It promises room, and it says exactly what it takes to get it — "the card and
|
|
2426
|
+
* the dock labels" — rather than "focus mode", because a mode named after a
|
|
2427
|
+
* feeling is a mode nobody can predict. What it explicitly does not promise is
|
|
2428
|
+
* that the screen goes quiet: the action cluster it sits inside stays whole, so
|
|
2429
|
+
* Save, the refusals and the problem count are all still here after it is
|
|
2430
|
+
* pressed. Somebody reading the tooltip should come away knowing that nothing
|
|
2431
|
+
* which can stop a mistake is about to disappear.
|
|
2432
|
+
*
|
|
2433
|
+
* ## The refusal
|
|
2434
|
+
*
|
|
2435
|
+
* The refusal is the case where the mode is ON and the card stayed open anyway,
|
|
2436
|
+
* because the graph has no name and the field that fixes that is inside it (see
|
|
2437
|
+
* `cardCollapsed`). A control that had been pressed and visibly done nothing
|
|
2438
|
+
* would read as broken, so it says which of the two things it is. The word is in
|
|
2439
|
+
* the accessible name too, not only in the tooltip — a tooltip is a pointer
|
|
2440
|
+
* affordance and this is the one state where the button's behaviour differs
|
|
2441
|
+
* from its label.
|
|
2442
|
+
*
|
|
2443
|
+
* ## The shortcut
|
|
2444
|
+
*
|
|
2445
|
+
* Rendered as a letter beside the icon rather than mentioned only in prose. A
|
|
2446
|
+
* keyboard shortcut nobody can see is a shortcut for whoever read the commit,
|
|
2447
|
+
* and this screen's whole argument is that the hands stay on the canvas.
|
|
2448
|
+
* `aria-hidden` on the glyph because the accessible name already spells it out
|
|
2449
|
+
* as a sentence, and "F" read aloud in the middle of one is noise.
|
|
2450
|
+
*/
|
|
2451
|
+
function FocusToggle({ on, cardCollapsed, onToggle, }) {
|
|
2452
|
+
const refusing = on && !cardCollapsed;
|
|
2453
|
+
const hint = refusing
|
|
2454
|
+
? `Focus is on, but the card is staying until this ${WORKFLOW_NAME.singular} has a name — the field that gives it one is in there, and Save is held back without it. Press ${FOCUS_SHORTCUT.toUpperCase()} or this button to turn focus off.`
|
|
2455
|
+
: on
|
|
2456
|
+
? `Bring back the ${WORKFLOW_NAME.singular} card and the dock's labels. Shortcut: ${FOCUS_SHORTCUT.toUpperCase()}.`
|
|
2457
|
+
: `Collapse the ${WORKFLOW_NAME.singular} card, drop the dock to icons and put the details panel away, so the graph gets the screen. Save, the refusals and the problem count stay exactly where they are. Shortcut: ${FOCUS_SHORTCUT.toUpperCase()}.`;
|
|
2458
|
+
const name = refusing
|
|
2459
|
+
? 'Turn off focus mode (the card is staying: this workflow has no name yet)'
|
|
2460
|
+
: on
|
|
2461
|
+
? `Turn off focus mode, shortcut ${FOCUS_SHORTCUT.toUpperCase()}`
|
|
2462
|
+
: `Turn on focus mode and give the canvas the room, shortcut ${FOCUS_SHORTCUT.toUpperCase()}`;
|
|
2463
|
+
return (_jsx(Tooltip, { content: hint, children: _jsxs(Button, { variant: "ghost", size: "sm", onClick: onToggle, "aria-pressed": on, "aria-label": name, className: cn('shrink-0',
|
|
2464
|
+
// On, the control is the only thing on screen saying so — the chrome
|
|
2465
|
+
// it collapsed cannot say it is missing. So it carries the state in
|
|
2466
|
+
// its own colour rather than relying on a panel that is gone.
|
|
2467
|
+
on && 'bg-sky-100 text-sky-700 dark:bg-sky-950 dark:text-sky-300'), children: [on ? _jsx(Minimize2, { size: 12 }) : _jsx(Maximize2, { size: 12 }), _jsx("span", { "aria-hidden": true, className: "rounded border border-current/30 px-1 font-mono text-[10px] leading-4 opacity-70", children: FOCUS_SHORTCUT.toUpperCase() })] }) }));
|
|
2468
|
+
}
|
|
2469
|
+
/**
|
|
2470
|
+
* Which graph this is, and the two fields that name it — top-left, floating.
|
|
2471
|
+
*
|
|
2472
|
+
* The corner a document's identity lives in, in every tool shaped like this one.
|
|
2473
|
+
* What is deliberately NOT here is the description paragraph: it explains the
|
|
2474
|
+
* screen to somebody arriving at it and says nothing to somebody mid-draw, so it
|
|
2475
|
+
* costs three lines of canvas forever to be read once. It is still reachable
|
|
2476
|
+
* from the button beside the title, and still read out in full to a screen
|
|
2477
|
+
* reader, which is the one audience a tooltip would have failed.
|
|
2478
|
+
*
|
|
2479
|
+
* ## Collapsed
|
|
2480
|
+
*
|
|
2481
|
+
* The tallest panel on the screen, so the one focus mode is really about: ~400
|
|
2482
|
+
* by ~270 of the canvas, most of it two fields and a paragraph about durability
|
|
2483
|
+
* that nobody reads twice. Collapsed, what is left is the head — and the head
|
|
2484
|
+
* gains something rather than only losing things, because the name that was in
|
|
2485
|
+
* the field has to go somewhere: it moves up beside the title, truncated, so the
|
|
2486
|
+
* card still answers "which graph am I looking at" while it is small.
|
|
2487
|
+
*
|
|
2488
|
+
* What SURVIVES the collapse is the point. The status badges stay, so a graph
|
|
2489
|
+
* that is `adopted`, unpublished or disabled still says so; the commits badge
|
|
2490
|
+
* stays, so which type this writes is still on screen. Those are the two facts
|
|
2491
|
+
* on this card that can stop a mistake, and neither of them is worth the height
|
|
2492
|
+
* that the fields cost.
|
|
2493
|
+
*
|
|
2494
|
+
* The `h1` is in both states, at the same level, so collapsing does not knock a
|
|
2495
|
+
* heading out of the document outline — a screen whose only `h1` comes and goes
|
|
2496
|
+
* with a display preference is a screen that reads differently to a screen
|
|
2497
|
+
* reader depending on a decision made about pixels.
|
|
2498
|
+
*/
|
|
2499
|
+
function WorkflowCard({ eyebrow, title, intro, stored, produces, durability, selected, workflowOptions, workflowsPending, draftName, canEdit, collapsed, reducedMotion, onExpand, onSelect, onRename, }) {
|
|
2500
|
+
/**
|
|
2501
|
+
* Whether something inside this card currently has the keyboard.
|
|
2502
|
+
*
|
|
2503
|
+
* The card will not fold while it does, and that is a correctness fix rather
|
|
2504
|
+
* than a nicety. The refusal above holds the card open while the graph has no
|
|
2505
|
+
* name — so the very next thing that happens is somebody typing one, and the
|
|
2506
|
+
* condition that was holding the card open stops being true on the FIRST
|
|
2507
|
+
* character. Without this, the field disappears out from under the caret
|
|
2508
|
+
* mid-word and the rest of the name is typed into nothing.
|
|
2509
|
+
*
|
|
2510
|
+
* Tracked by bubbling rather than by handlers on each field: `focusin` and
|
|
2511
|
+
* `focusout` bubble (unlike `focus` and `blur`), which React exposes as
|
|
2512
|
+
* `onFocus`/`onBlur` on any ancestor, so this works for the picker, the name
|
|
2513
|
+
* field and anything added to the card later without threading a prop.
|
|
2514
|
+
*
|
|
2515
|
+
* `relatedTarget` is where the focus WENT. Still inside the card — Tab from
|
|
2516
|
+
* the picker to the name field — is not a departure. `null` is a departure:
|
|
2517
|
+
* it is what a click on something unfocusable produces, and the card folding
|
|
2518
|
+
* then is right.
|
|
2519
|
+
*/
|
|
2520
|
+
const [holdsFocus, setHoldsFocus] = useState(false);
|
|
2521
|
+
const folded = collapsed && !holdsFocus;
|
|
2522
|
+
return (
|
|
2523
|
+
/*
|
|
2524
|
+
* `layout` rather than a CSS transition, because the box goes from a fixed
|
|
2525
|
+
* 24rem to whatever its head needs and there is no width to transition TO —
|
|
2526
|
+
* `auto` is not an animatable value. Motion measures both states and
|
|
2527
|
+
* interpolates the real numbers, which is the difference between a panel
|
|
2528
|
+
* that folds and one that snaps and then re-renders at the new size.
|
|
2529
|
+
*/
|
|
2530
|
+
_jsxs(motion.div, { layout: !reducedMotion, transition: reducedMotion ? { duration: 0 } : { type: 'spring', stiffness: 420, damping: 34 }, onFocus: () => setHoldsFocus(true), onBlur: (event) => {
|
|
2531
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
2532
|
+
setHoldsFocus(false);
|
|
2533
|
+
}, className: cn('pointer-events-auto p-3',
|
|
2534
|
+
// Collapsed it is allowed to be WIDER than the 24rem it is fixed at
|
|
2535
|
+
// open, and that is not a slip. Wrapping the head onto a second line
|
|
2536
|
+
// costs 23px of height across the full width of the panel; letting it
|
|
2537
|
+
// run to 30rem costs a strip of canvas beside a title, at the top-left
|
|
2538
|
+
// corner where a graph laid out left-to-right has nothing yet. Height is
|
|
2539
|
+
// the expensive axis here, so the trade goes that way.
|
|
2540
|
+
folded ? 'w-auto max-w-[min(30rem,100%)] py-2' : 'w-[min(24rem,100%)]', FLOATING), children: [_jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [!folded && (_jsx("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.18em]', MUTED), children: eyebrow })), _jsx("h1", { className: "text-sm font-semibold tracking-tight", children: title }), folded && (_jsx("p", { className: cn('max-w-[12rem] truncate text-xs', MUTED), title: draftName, children: draftName })), stored && _jsx(WorkflowStatusBadge, { workflow: stored }), _jsx(CommitsBadge, { produces: produces }), folded ? (_jsx(Tooltip, { content: `Bring the ${WORKFLOW_NAME.singular} picker, the name field and the checkpointing note back, and leave focus mode. Shortcut: ${FOCUS_SHORTCUT.toUpperCase()}.`, children: _jsx(Button, { variant: "ghost", size: "icon", onClick: onExpand, "aria-expanded": false, "aria-label": "Show the workflow card and leave focus mode", className: "ml-auto h-5 w-5", children: _jsx(ChevronDown, { size: 11 }) }) })) : (_jsx(Tooltip, { content: intro, children: _jsx(Button, { variant: "ghost", size: "icon", "aria-label": "What this screen is for", className: "ml-auto h-5 w-5", children: _jsx(Info, { size: 11 }) }) }))] }), _jsx("p", { className: "sr-only", children: intro }), _jsx(AnimatePresence, { initial: false, children: !folded && (_jsxs(motion.div, { initial: reducedMotion ? false : { height: 0, opacity: 0 }, animate: { height: 'auto', opacity: 1 }, exit: reducedMotion ? { opacity: 0 } : { height: 0, opacity: 0 },
|
|
2541
|
+
/*
|
|
2542
|
+
* A tween, and NOT the spring the rail and the outer box use.
|
|
2543
|
+
*
|
|
2544
|
+
* Two reasons, one aesthetic and one that cost an afternoon. A
|
|
2545
|
+
* spring overshoots, and a height overshooting past zero is a panel
|
|
2546
|
+
* that clips itself against its own border on the way down — the
|
|
2547
|
+
* one place on this screen where bounce reads as a glitch rather
|
|
2548
|
+
* than as life. And a spring on a height resolved from `auto` has
|
|
2549
|
+
* no analytic end: it settles by threshold, on frames. Under jsdom,
|
|
2550
|
+
* which reports no layout, it never settled at all and
|
|
2551
|
+
* `AnimatePresence` therefore never unmounted the body — so focus
|
|
2552
|
+
* mode "worked" in a browser and left the picker and the name field
|
|
2553
|
+
* in the document forever in a test. A tween ends on a clock.
|
|
2554
|
+
*/
|
|
2555
|
+
transition: reducedMotion ? { duration: 0 } : { duration: 0.22, ease: [0.32, 0.72, 0, 1] },
|
|
2556
|
+
// Or the fields spill out of the box on the way down: the height is
|
|
2557
|
+
// being animated from zero and their own height is not.
|
|
2558
|
+
className: "overflow-hidden", children: [_jsxs("div", { className: "mt-2.5 grid gap-2", children: [_jsx(SelectField, { label: WORKFLOW_NAME.title, ariaLabel: `Which ${WORKFLOW_NAME.singular} to edit`, value: selected, onValueChange: onSelect, options: workflowOptions, disabled: workflowsPending }), _jsx(TextField, { label: "Name", value: draftName, onChange: onRename, placeholder: "Fleet readiness", disabled: !canEdit })] }), _jsx(DurabilityBanner, { durability: durability })] }, "body")) })] }));
|
|
2559
|
+
}
|
|
1581
2560
|
/**
|
|
1582
2561
|
* That there are none, said rather than drawn as a blank canvas.
|
|
1583
2562
|
*
|
|
@@ -1599,10 +2578,21 @@ function CanvasSkeleton() {
|
|
|
1599
2578
|
* wondering whether the two do different things.
|
|
1600
2579
|
*/
|
|
1601
2580
|
function NothingDrawnYet() {
|
|
1602
|
-
return (
|
|
2581
|
+
return (
|
|
2582
|
+
/*
|
|
2583
|
+
* Centred ON the canvas rather than stated above it, now that the canvas is
|
|
2584
|
+
* the screen. An empty surface is where somebody is already looking, and it
|
|
2585
|
+
* is the thing being explained.
|
|
2586
|
+
*
|
|
2587
|
+
* `pointer-events-none` throughout: it carries no control — the one that
|
|
2588
|
+
* creates a workflow is the picker in the card — and a plate over the middle
|
|
2589
|
+
* of the canvas that swallowed a pan would make the empty state feel like a
|
|
2590
|
+
* broken canvas, which is precisely the reading it exists to prevent.
|
|
2591
|
+
*/
|
|
2592
|
+
_jsx("div", { className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center p-6", children: _jsxs("div", { className: cn('max-w-md rounded-xl border border-dashed px-4 py-3 text-center backdrop-blur-sm', RULE), children: [_jsxs("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: ["No ", WORKFLOW_NAME.plural, " yet"] }), _jsxs("p", { className: cn('mt-1.5 text-[11px] leading-relaxed', MUTED), children: ["Nothing is missing \u2014 this deployment has never had one drawn. Add a source, wire it into a sink and save, and it becomes the first. If this deployment has connectors already loading data, they are not shown here and nothing turns them into ", WORKFLOW_NAME.plural, ' ', "automatically."] })] }) }));
|
|
1603
2593
|
}
|
|
1604
2594
|
function CanvasFailure({ error, onRetry, }) {
|
|
1605
|
-
return (_jsx("div", { className: "flex h-full w-full items-center justify-center bg-red-50 px-6 dark:bg-red-950/30", children: _jsxs("div", { className: "max-w-md text-center", children: [_jsx(CircleAlert, { size: 18, className: "mx-auto text-red-600" }), _jsxs("p", { className: "mt-2 text-sm text-red-700 dark:text-red-300", children: ["The ", WORKFLOW_NAME.plural, " could not be read, so nothing below is drawn. This is not an empty ", WORKFLOW_NAME.singular, "."] }), _jsx("p", { className: "mt-1 font-mono text-[11px] text-red-600 dark:text-red-400", children: error instanceof Error ? error.message : 'No reason was given.' }), _jsx(
|
|
2595
|
+
return (_jsx("div", { className: "flex h-full w-full items-center justify-center bg-red-50 px-6 dark:bg-red-950/30", children: _jsxs("div", { className: "max-w-md text-center", children: [_jsx(CircleAlert, { size: 18, className: "mx-auto text-red-600" }), _jsxs("p", { className: "mt-2 text-sm text-red-700 dark:text-red-300", children: ["The ", WORKFLOW_NAME.plural, " could not be read, so nothing below is drawn. This is not an empty ", WORKFLOW_NAME.singular, "."] }), _jsx("p", { className: "mt-1 font-mono text-[11px] text-red-600 dark:text-red-400", children: error instanceof Error ? error.message : 'No reason was given.' }), _jsx(Button, { variant: "outline", size: "sm", onClick: onRetry, className: "mt-3 border-red-300 text-red-700 dark:border-red-800 dark:text-red-300", children: "Try again" })] }) }));
|
|
1606
2596
|
}
|
|
1607
2597
|
/**
|
|
1608
2598
|
* The graph as a list, beside the graph as a picture.
|
|
@@ -1616,7 +2606,7 @@ function CanvasFailure({ error, onRetry, }) {
|
|
|
1616
2606
|
* The problems list sits in the same rail for the same reason: a red ring
|
|
1617
2607
|
* around a node off the left edge of the viewport communicates nothing.
|
|
1618
2608
|
*/
|
|
1619
|
-
function WiringRail({ draft, problems, pending, run, canEdit, onInspect, onDisconnect, children, }) {
|
|
2609
|
+
function WiringRail({ draft, problems, pending, run, canEdit, reducedMotion, onInspect, onDisconnect, onClose, children, }) {
|
|
1620
2610
|
const label = (id) => {
|
|
1621
2611
|
const node = draft.nodes.find((n) => n.id === id);
|
|
1622
2612
|
return node ? nodeName(node) : id;
|
|
@@ -1624,19 +2614,38 @@ function WiringRail({ draft, problems, pending, run, canEdit, onInspect, onDisco
|
|
|
1624
2614
|
const errors = problems.filter((problem) => problem.level === 'error');
|
|
1625
2615
|
const warnings = problems.filter((problem) => problem.level === 'warning');
|
|
1626
2616
|
const sinks = draft.nodes.filter((node) => node.kind === 'sink');
|
|
1627
|
-
return (
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
2617
|
+
return (
|
|
2618
|
+
/*
|
|
2619
|
+
* Floating over the right edge of the canvas rather than beside it in a
|
|
2620
|
+
* column, and NOT a modal sheet.
|
|
2621
|
+
*
|
|
2622
|
+
* The distinction matters for exactly one reason, which `ui/sheet.tsx` spells
|
|
2623
|
+
* out from the other direction: a panel that covers the canvas while a
|
|
2624
|
+
* keyboard user tabs into what is behind it leaks focus onto controls they
|
|
2625
|
+
* cannot see. That argument is about a panel that HIDES things. This one
|
|
2626
|
+
* hides nothing — it is always open when it is rendered, everything in it is
|
|
2627
|
+
* operable, and Tab flowing between it and the canvas is the correct order
|
|
2628
|
+
* rather than a leak. So no focus trap, and deliberately no Escape handler
|
|
2629
|
+
* either: Escape on this screen already means "put the half-drawn wire away"
|
|
2630
|
+
* (see `workflow/wiring.tsx`), and a second meaning would take that key away
|
|
2631
|
+
* from the gesture that needs it most.
|
|
2632
|
+
*
|
|
2633
|
+
* `dismissible` is the whole reason it may float: an always-on 19rem panel is
|
|
2634
|
+
* 19rem of canvas somebody never agreed to spend.
|
|
2635
|
+
*/
|
|
2636
|
+
_jsxs(motion.aside, { initial: reducedMotion ? false : { opacity: 0, x: 24 }, animate: { opacity: 1, x: 0 }, exit: reducedMotion ? { opacity: 0 } : { opacity: 0, x: 24 }, transition: reducedMotion ? { duration: 0 } : { type: 'spring', stiffness: 420, damping: 34 }, className: cn('pointer-events-auto flex max-h-full w-[min(19rem,calc(100vw-2rem))] flex-col', 'overflow-y-auto p-3', FLOATING), "aria-label": `${WORKFLOW_NAME.title} wiring and problems`, children: [_jsxs("div", { className: "mb-2 flex shrink-0 items-center gap-2", children: [_jsx("p", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Details" }), _jsx(Tooltip, { content: "Put this panel away and give the canvas the room.", children: _jsx(Button, { variant: "ghost", size: "icon", onClick: onClose, "aria-label": "Hide the details panel", className: "ml-auto h-5 w-5", children: _jsx(X, { size: 11 }) }) })] }), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsx(PendingWork, { pending: pending, label: label, onInspect: onInspect }), _jsxs("section", { className: cn('rounded-lg border p-3', RULE, SUBPANEL), children: [_jsx("h2", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Problems" }), problems.length === 0 ? (_jsx("p", { className: cn('mt-2 text-[11px]', MUTED), children: "Nothing to flag here. The server checks it again on save." })) : (_jsx("ul", { className: "mt-2 space-y-2", children: [...errors, ...warnings].map((problem) => (_jsxs("li", { className: "flex gap-1.5 text-[11px] leading-relaxed", children: [problem.level === 'error' ? (_jsx(CircleAlert, { size: 11, className: "mt-0.5 shrink-0 text-red-500" })) : (_jsx(TriangleAlert, { size: 11, className: "mt-0.5 shrink-0 text-amber-500" })), _jsxs("span", { children: [problem.message, problem.nodeIds.length > 0 && (_jsx("span", { className: "ml-1", children: problem.nodeIds.map((nodeId) => (_jsx("button", { type: "button", onClick: () => onInspect(nodeId), className: cn('mr-1 rounded border px-1 font-mono text-[9px]', RULE, MUTED), children: label(nodeId) }, nodeId))) }))] })] }, `${problem.code}:${problem.nodeIds.join(',')}`))) }))] }), run && (_jsxs("section", { className: cn('rounded-lg border p-3', RULE, SUBPANEL), children: [_jsx("h2", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Last run" }), _jsxs("p", { className: "mt-1 text-[11px]", children: [run.status, _jsx("span", { className: cn('ml-1 font-mono text-[10px]', MUTED), children: run.durable ? 'checkpointed per node' : 'ran inline, no checkpoints' })] }), sinks.length > 0 && (_jsxs("div", { className: "mt-2", children: [_jsx("h3", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Committed" }), _jsx("ul", { className: "mt-1 space-y-1", children: sinks.map((sink) => {
|
|
2637
|
+
const outcome = run.nodes.find((node) => node.nodeId === sink.id);
|
|
2638
|
+
const type = sink.kind === 'sink' && sink.targetType ? sink.targetType : 'no type';
|
|
2639
|
+
return (_jsxs("li", { className: "flex items-center gap-1.5 text-[11px]", children: [_jsx("span", { className: "truncate font-mono text-[10px]", children: type }), _jsx("span", { className: cn('ml-auto shrink-0 font-mono text-[10px]', outcome?.status === 'failed'
|
|
2640
|
+
? 'text-red-500'
|
|
2641
|
+
: outcome?.status === 'succeeded'
|
|
2642
|
+
? 'text-emerald-600 dark:text-emerald-400'
|
|
2643
|
+
: MUTED), children: outcome
|
|
2644
|
+
? outcome.status === 'succeeded' && typeof outcome.rows === 'number'
|
|
2645
|
+
? `${outcome.rows} rows`
|
|
2646
|
+
: outcome.status
|
|
2647
|
+
: 'no outcome recorded' })] }, sink.id));
|
|
2648
|
+
}) }), _jsx("p", { className: cn('mt-1 text-[10px] leading-relaxed', MUTED), children: "Each sink commits on its own. One committing and another failing is a failed run that nevertheless wrote something, not a partial success that will be rolled back." })] })), _jsx("ul", { className: "mt-2 space-y-1", children: run.nodes.map((node) => (_jsxs("li", { className: "flex items-center gap-1.5 font-mono text-[10px]", children: [_jsx("span", { className: "truncate", children: label(node.nodeId) }), _jsx("span", { className: cn('ml-auto shrink-0', node.status === 'failed' ? 'text-red-500' : MUTED), children: node.replayed ? 'replayed' : node.status })] }, node.nodeId))) }), run.error && _jsx("p", { className: "mt-2 text-[11px] text-red-600", children: run.error })] })), _jsxs("section", { className: cn('rounded-lg border p-3', RULE, SUBPANEL), children: [_jsx("h2", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Wiring" }), draft.edges.length === 0 ? (_jsx("p", { className: cn('mt-2 text-[11px]', MUTED), children: "Nothing is wired together yet." })) : (_jsx("ul", { className: "mt-2 space-y-1", children: draft.edges.map((edge) => (_jsxs("li", { className: "flex items-center gap-1.5 text-[11px]", children: [_jsx("button", { type: "button", onClick: () => onInspect(edge.from), className: "truncate hover:underline", children: label(edge.from) }), _jsx(ArrowRight, { size: 10, className: cn('shrink-0', MUTED) }), _jsx("button", { type: "button", onClick: () => onInspect(edge.to), className: "truncate hover:underline", children: label(edge.to) }), canEdit && (_jsx(Tooltip, { content: "Remove this connection.", children: _jsx("button", { type: "button", onClick: () => onDisconnect(edge), "aria-label": `Disconnect ${label(edge.from)} from ${label(edge.to)}`, className: "ml-auto shrink-0 rounded p-0.5 text-zinc-400 hover:text-red-600", children: _jsx(Unplug, { size: 11 }) }) }))] }, edgeId(edge)))) }))] }), children] })] }));
|
|
1640
2649
|
}
|
|
1641
2650
|
/**
|
|
1642
2651
|
* What is left to do on the nodes nobody has finished.
|
|
@@ -1656,7 +2665,7 @@ function PendingWork({ pending, label, onInspect, }) {
|
|
|
1656
2665
|
const byNode = useMemo(() => problemsByNode(pending), [pending]);
|
|
1657
2666
|
if (byNode.size === 0)
|
|
1658
2667
|
return null;
|
|
1659
|
-
return (_jsxs("section", { className: cn('rounded-lg border p-3', RULE,
|
|
2668
|
+
return (_jsxs("section", { className: cn('rounded-lg border p-3', RULE, SUBPANEL), children: [_jsx("h2", { className: cn('font-mono text-[10px] uppercase tracking-[0.14em]', MUTED), children: "Still to do" }), _jsx("ul", { className: "mt-2 space-y-1.5", children: [...byNode.entries()].map(([nodeId, items]) => (_jsxs("li", { className: "flex gap-1.5 text-[11px] leading-relaxed", children: [_jsx(CircleDashed, { size: 11, className: cn('mt-0.5 shrink-0', MUTED) }), _jsxs("span", { children: [_jsx("button", { type: "button", onClick: () => onInspect(nodeId), className: "font-medium hover:underline", children: label(nodeId) }), _jsxs("span", { className: MUTED, children: [' — ', items.map((problem) => todoFor(problem)).join('; '), "."] })] })] }, nodeId))) }), _jsx("p", { className: cn('mt-2 text-[10px] leading-relaxed', MUTED), children: "These are not problems yet \u2014 a node that was just added is unwired and unconfigured by construction. They are checked in full the moment you save." })] }));
|
|
1660
2669
|
}
|
|
1661
2670
|
/**
|
|
1662
2671
|
* One end of a node's wiring — everything feeding it, or everything it feeds.
|