TheYuchen commited on
Commit
6d69c3f
·
1 Parent(s): 816718a

Pipeline shelf: palette becomes the grammar (marker: pipeline-shelf)

Browse files

Rebuild NodePalette as five stage columns in pipeline order — Source →
Backend → Algorithm → Metric → Sink — separated by faint arrow glyphs,
so the palette itself reads as the sentence structure a valid pipeline
follows. Each column: 10px uppercase header + one-line tagline, blocks
stacked vertically as compact h-9 rows (icon + name; the tagline moved
into the row tooltip). Killed: the rotated vertical family-letter
rails, the count-filter chips, the horizontal tile sprawl. Kept
exactly: drag-to-canvas (dataTransfer payload), tap/click-to-add via
pendingBlockKinds, the touch-drag bridge, plugin badges + delete,
paper links, search (now filtering rows across columns), "Add blocks",
and the collapse-to-strip affordance. New: a subtle count dot on rows
already placed (canvasKinds is a multiset, so it counts copies).

Columns share width equally (min 120px); a column with ≥5 blocks
(plugins join their declared family) scrolls internally behind a
mask-image fade — growth is vertical, never horizontal. Responsive by
container query (ResizeObserver, same pattern as MultiverseBoard):
below 880px container width the shelf wraps to two rows
(Source/Backend/Algorithm over Metric/Sink) with a 96px column floor
so 360px phones still fit three stages plus arrows.

Copy that named the old strip follows the rename: EmptyCanvas teaches
the left-to-right grammar, FlowCanvas's two "strip above" notices say
"pipeline shelf", tour slide 2 spells the five stages, and the
App.tsx MIN_CANVAS_W comment drops the dead 108px-tile math.

frontend/src/App.tsx CHANGED
@@ -64,7 +64,7 @@ const COLLAPSED_W = 32;
64
  const WIDE_QUERY = "(min-width: 1200px)";
65
 
66
  // Minimum width we ever want to leave for the canvas (NodePalette + React
67
- // Flow). Below this, NodePalette tiles (each fixed at 108px and shrink-0)
68
  // start overflowing horizontally because `<main>` has no overflow clip —
69
  // they visually escape the canvas column and cover whatever's in the
70
  // right pane. The dynamic clamp in the resize handler caps the side
 
64
  const WIDE_QUERY = "(min-width: 1200px)";
65
 
66
  // Minimum width we ever want to leave for the canvas (NodePalette + React
67
+ // Flow). Below this, the NodePalette pipeline-shelf columns (min 96px each)
68
  // start overflowing horizontally because `<main>` has no overflow clip —
69
  // they visually escape the canvas column and cover whatever's in the
70
  // right pane. The dynamic clamp in the resize handler caps the side
frontend/src/components/EmptyCanvas.tsx CHANGED
@@ -15,7 +15,9 @@ export function EmptyCanvas() {
15
  the copy describes where to look instead of quoting text
16
  the user cannot see. */}
17
  <div className="text-sm text-mute mb-3">
18
- Drag blocks from the strip above, or load a preset from the
 
 
19
  toolbar's layers-icon menu — then hit{" "}
20
  <span className="kbd">Run</span> (toolbar top-right; round
21
  button bottom-right on phones) and evidence collects in the
 
15
  the copy describes where to look instead of quoting text
16
  the user cannot see. */}
17
  <div className="text-sm text-mute mb-3">
18
+ Drag blocks from the shelf above — its columns read left to
19
+ right as the pipeline grammar (Source → … → Sink) — or load a
20
+ preset from the
21
  toolbar's layers-icon menu — then hit{" "}
22
  <span className="kbd">Run</span> (toolbar top-right; round
23
  button bottom-right on phones) and evidence collects in the
frontend/src/components/FlowCanvas.tsx CHANGED
@@ -1113,7 +1113,7 @@ export function FlowCanvas() {
1113
  setPrecisionTarget(null);
1114
  useApp.getState().setRestoredFrom(null);
1115
  setNotice({
1116
- text: "New configuration — drag blocks from the strip above or pick a preset, then Run to archive its first evidence.",
1117
  tone: "ok",
1118
  });
1119
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1281,7 +1281,7 @@ export function FlowCanvas() {
1281
  }
1282
  if (nodes.length === 0) {
1283
  setNotice({
1284
- text: "Canvas is empty. Drag blocks from the strip above, click \"Add blocks\" for a multi-select list, or pick a preset.",
1285
  tone: "danger",
1286
  });
1287
  return;
 
1113
  setPrecisionTarget(null);
1114
  useApp.getState().setRestoredFrom(null);
1115
  setNotice({
1116
+ text: "New configuration — drag blocks from the pipeline shelf above or pick a preset, then Run to archive its first evidence.",
1117
  tone: "ok",
1118
  });
1119
  // eslint-disable-next-line react-hooks/exhaustive-deps
 
1281
  }
1282
  if (nodes.length === 0) {
1283
  setNotice({
1284
+ text: "Canvas is empty. Drag blocks from the pipeline shelf above, click \"Add blocks\" for a multi-select list, or pick a preset.",
1285
  tone: "danger",
1286
  });
1287
  return;
frontend/src/components/NodePalette.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { useMemo, useState } from "react";
2
  import { ChevronDown, FileText, Search, X } from "lucide-react";
3
  import { api } from "../lib/api";
4
  import {
@@ -14,53 +14,87 @@ import { bumpPluginsRev, getUserId } from "../lib/userId";
14
  import { BlockPicker } from "./BlockPicker";
15
 
16
  /**
17
- * Categorised block catalog above the canvas.
 
 
 
 
 
 
 
 
 
18
  *
19
- * Two complementary interaction modes:
20
- * - **Drag** a tile onto the canvas (quick, for users who know what
21
- * they want).
22
- * - **"Add blocks" dropdown** (BlockPicker) — a categorised
23
- * multi-select list where users browse all available blocks, check
24
- * the ones they want, and batch-add them in one click. Better for
25
- * newcomers or when building a pipeline from scratch.
 
 
 
 
26
  *
27
- * Blocks are grouped by family; each family section is collapsible. A
28
- * search box filters across all families in real time.
 
 
 
29
  */
30
 
31
- const FAMILY_META: {
32
  key: NodeSpec["family"];
33
  label: string;
34
- description: string;
35
  }[] = [
36
- { key: "source", label: "Source", description: "Where the pipeline starts" },
37
- { key: "backend", label: "Backend", description: "Provides a noise model" },
38
- {
39
- key: "algorithm",
40
- label: "Algorithm",
41
- description: "Research algorithms that transform or analyse the circuit",
42
- },
43
- { key: "metric", label: "Metric", description: "Computes a quantitative score" },
44
- { key: "sink", label: "Sink", description: "Aggregates final output" },
45
  ];
46
 
 
 
 
47
  export function NodePalette() {
48
  const [search, setSearch] = useState("");
49
  // Kinds currently on the canvas — published by FlowCanvas (store
50
- // bridge, audit S2) and passed to BlockPicker for live "on canvas"
51
- // badges. The old prop defaulted to an empty set and no caller ever
52
- // threaded the real kinds, so the badges were dead code.
53
  const canvasKindsArr = useApp((s) => s.canvasKinds);
54
  const canvasKinds = useMemo(
55
  () => new Set<NodeKind>(canvasKindsArr),
56
  [canvasKindsArr],
57
  );
 
 
 
 
 
58
  const [expanded, setExpanded] = useState(true);
59
- // null = show all families; a family key = show only that family.
60
- const [activeFamily, setActiveFamily] = useState<NodeSpec["family"] | null>(null);
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  // Plugin manifests this browser has uploaded — merged with NODE_CATALOG
63
- // so plugins show up under their declared family alongside built-ins.
 
 
64
  const plugins = useApp((s) => s.plugins);
65
  const setPlugins = useApp((s) => s.setPlugins);
66
  const pluginSpecs: PluginNodeSpec[] = useMemo(
@@ -72,9 +106,6 @@ export function NodePalette() {
72
  [pluginSpecs],
73
  );
74
 
75
- const toggleFamily = (fam: NodeSpec["family"]) =>
76
- setActiveFamily((cur) => (cur === fam ? null : fam));
77
-
78
  const handleDeletePlugin = async (kind: string) => {
79
  try {
80
  await api.deletePlugin(getUserId(), kind);
@@ -127,6 +158,12 @@ export function NodePalette() {
127
  );
128
  }
129
 
 
 
 
 
 
 
130
  return (
131
  <div className="shrink-0 border-b border-edge bg-surface/40">
132
  {/* Header row */}
@@ -137,7 +174,7 @@ export function NodePalette() {
137
  protocol itself is a paper claim and stays fully exercised
138
  via the backend API; uploaded plugins still appear here and
139
  still execute. */}
140
- {/* Search */}
141
  <div className="relative flex-1 max-w-[200px]">
142
  <Search className="absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-mute pointer-events-none" />
143
  <input
@@ -158,31 +195,6 @@ export function NodePalette() {
158
  </button>
159
  )}
160
  </div>
161
- {/* Family chips */}
162
- <div className="hidden md:flex items-center gap-1">
163
- {FAMILY_META.map((fm) => {
164
- const count = filtered.filter((n) => n.family === fm.key).length;
165
- if (count === 0) return null;
166
- return (
167
- <button
168
- key={fm.key}
169
- type="button"
170
- onClick={() => toggleFamily(fm.key)}
171
- className={`text-[10px] px-1.5 py-0.5 rounded border transition-colors ${
172
- activeFamily === fm.key
173
- ? "border-accent/60 bg-accent/10 text-accent"
174
- : activeFamily !== null
175
- ? "border-edge/40 text-mute/40 bg-transparent"
176
- : "border-edge bg-surfaceAlt text-mute hover:text-ink"
177
- }`}
178
- title={`${fm.description} (${count})`}
179
- >
180
- {fm.label}
181
- <span className="ml-0.5 text-mute/50">{count}</span>
182
- </button>
183
- );
184
- })}
185
- </div>
186
  <div className="flex-1" />
187
  <span className="hidden lg:inline text-[10px] text-mute/60">
188
  drag to canvas or use Add blocks
@@ -197,71 +209,115 @@ export function NodePalette() {
197
  </button>
198
  </div>
199
 
200
- {/* Block grid grouped by family */}
201
- <div className="px-3 pb-2 flex flex-nowrap overflow-x-auto md:flex-wrap md:overflow-visible items-start gap-x-1 gap-y-1">
202
- {FAMILY_META.map((fm, famIdx) => {
203
- // When a family filter is active, only show that family.
204
- if (activeFamily !== null && activeFamily !== fm.key) return null;
205
- const items = filtered.filter((n) => n.family === fm.key);
206
- if (items.length === 0) return null;
207
- return (
208
- <div key={fm.key} className="shrink-0 flex items-start gap-1">
209
- <button
210
- type="button"
211
- onClick={() => toggleFamily(fm.key)}
212
- className={`hidden md:flex flex-col items-center justify-center py-1 px-0.5 gap-0.5 hover:text-mute transition-colors self-stretch ${
213
- activeFamily === fm.key ? "text-accent" : "text-mute/60"
214
- }`}
215
- title={`${fm.label}: ${fm.description}`}
216
- >
217
- <span
218
- className="text-[9px] uppercase tracking-widest whitespace-nowrap font-medium"
219
- style={{ writingMode: "vertical-rl" }}
220
- >
221
- {fm.label}
222
- </span>
223
- </button>
224
- <div className="flex items-center gap-1 flex-wrap">
225
- {items.map((n) => (
226
- <PaletteTile
227
- key={n.kind}
228
- spec={n}
229
- onDelete={
230
- "isPlugin" in n && n.isPlugin
231
- ? () => handleDeletePlugin(n.kind)
232
- : undefined
233
- }
234
- />
235
- ))}
236
- </div>
237
- {/* Divider between visible families (not after the last) */}
238
- {activeFamily === null && famIdx < FAMILY_META.length - 1 && (
239
- <div className="hidden md:block w-px self-stretch bg-edge/40 mx-0.5" />
240
- )}
241
- </div>
242
- );
243
- })}
244
- {filtered.filter(
245
- (n) => activeFamily === null || n.family === activeFamily,
246
- ).length === 0 && (
247
- <div className="py-4 w-full text-center text-[11px] text-mute">
248
- No blocks match{search.trim() ? ` "${search}"` : ""}
249
- {activeFamily !== null
250
- ? ` in the ${
251
- FAMILY_META.find((f) => f.key === activeFamily)?.label ??
252
- activeFamily
253
- } family`
254
- : ""}
255
- .
256
- {activeFamily !== null && (
257
- <button
258
- type="button"
259
- className="ml-1.5 underline decoration-dotted hover:text-ink"
260
- onClick={() => setActiveFamily(null)}
261
- >
262
- Show all families
263
- </button>
264
- )}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  </div>
266
  )}
267
  </div>
@@ -269,13 +325,17 @@ export function NodePalette() {
269
  );
270
  }
271
 
272
- function PaletteTile({
273
  spec,
 
274
  onDelete,
275
  }: {
276
  spec: NodeSpec | PluginNodeSpec;
277
- /** When set, shows a red × in the corner that calls back on click —
278
- * used for user-uploaded plugins. */
 
 
 
279
  onDelete?: () => void;
280
  }) {
281
  const addBlocksToCanvas = useApp((s) => s.addBlocksToCanvas);
@@ -338,8 +398,8 @@ function PaletteTile({
338
  }
339
  }
340
  setTouchDrag({ kind: spec.kind, x: ev.clientX, y: ev.clientY });
341
- // preventDefault suppresses the palette strip's horizontal
342
- // scroll once we've committed to dragging.
343
  ev.preventDefault();
344
  };
345
 
@@ -383,24 +443,55 @@ function PaletteTile({
383
  onPointerDown={onPointerDown}
384
  onClick={addToCanvas}
385
  // The button gives us Enter/Space → click for free; we override
386
- // Space below so it doesn't also scroll the strip.
387
  onKeyDown={(e) => {
388
  if (e.key === " ") {
389
  e.preventDefault();
390
  addToCanvas();
391
  }
392
  }}
393
- className={`qf-no-callout group relative shrink-0 cursor-grab active:cursor-grabbing flex flex-col items-center justify-center gap-0.5 w-[108px] h-[76px] rounded-md border transition-colors text-center px-1.5 py-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${
394
  isPlugin
395
  ? "border-edge bg-surface/60 hover:bg-surfaceAlt"
396
  : "border-edge/60 hover:border-edge hover:bg-surfaceAlt"
397
  }`}
398
- title={spec.description}
 
 
399
  aria-label={`Add ${spec.label} block to canvas. ${spec.tagline}`}
400
  >
401
- {/* Top-right corner badge: paper link, delete button, or nothing.
402
- These are interactive children; stopPropagation keeps the
403
- parent button from also firing. */}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  {spec.paper && !isPlugin && !ANON && (
405
  <a
406
  href={spec.paper.url}
@@ -409,18 +500,16 @@ function PaletteTile({
409
  draggable={false}
410
  onDragStart={(e) => e.stopPropagation()}
411
  onClick={(e) => e.stopPropagation()}
412
- className="absolute top-1 right-1 w-5 h-5 rounded-full bg-accent/20 border border-accent/70 text-accent hover:bg-accent/40 hover:border-accent hover:text-ink flex items-center justify-center shadow-sm transition-colors z-10"
413
  title={`Paper: ${spec.paper.title} (${spec.paper.venue})`}
414
  aria-label={`Open paper: ${spec.paper.title}`}
415
  >
416
- <FileText className="w-2.5 h-2.5" strokeWidth={2} />
417
  </a>
418
  )}
419
  {isPlugin && onDelete && (
420
- // Always visible: previously hover-only, which left mobile +
421
- // keyboard users with no way to find or activate the delete
422
- // affordance. Slight opacity at rest keeps it from drawing too
423
- // much focus when the user is browsing the catalogue.
424
  <button
425
  type="button"
426
  draggable={false}
@@ -434,35 +523,13 @@ function PaletteTile({
434
  // focused on the delete X.
435
  if (e.key === "Enter" || e.key === " ") e.stopPropagation();
436
  }}
437
- className="absolute top-1 right-1 w-5 h-5 rounded-full border border-edge bg-surface text-mute hover:text-danger hover:border-danger/60 flex items-center justify-center opacity-70 hover:opacity-100 focus:opacity-100 transition-opacity z-10"
438
  title={`Delete plugin ${spec.label}`}
439
  aria-label={`Delete plugin ${spec.label}`}
440
  >
441
- <X className="w-3 h-3" strokeWidth={2.5} />
442
  </button>
443
  )}
444
- {isPlugin ? (
445
- <span
446
- className="w-6 h-6 rounded-md flex items-center justify-center text-[10px] font-bold text-white"
447
- style={{ backgroundColor: (spec as PluginNodeSpec).pluginColor }}
448
- aria-hidden
449
- >
450
- {(spec as PluginNodeSpec).initials}
451
- </span>
452
- ) : (
453
- <span
454
- className={`w-6 h-6 rounded-md border ${spec.accentRing} bg-surface flex items-center justify-center ${spec.accent}`}
455
- aria-hidden
456
- >
457
- <Icon className="w-3 h-3" strokeWidth={2} />
458
- </span>
459
- )}
460
- <span className="text-[10px] text-ink truncate max-w-full leading-tight">
461
- {spec.label}
462
- </span>
463
- <span className="text-[9px] text-mute/80 leading-tight max-w-full line-clamp-2">
464
- {spec.tagline}
465
- </span>
466
  </button>
467
  );
468
  }
 
1
+ import { Fragment, useEffect, useMemo, useRef, useState } from "react";
2
  import { ChevronDown, FileText, Search, X } from "lucide-react";
3
  import { api } from "../lib/api";
4
  import {
 
14
  import { BlockPicker } from "./BlockPicker";
15
 
16
  /**
17
+ * Pipeline shelf (marker: pipeline-shelf) — the block palette above the
18
+ * canvas, laid out AS the pipeline grammar itself: five stage columns,
19
+ * Source → Backend → Algorithm → Metric → Sink, separated by faint
20
+ * arrow glyphs. Each column carries a compact header (stage name + a
21
+ * one-line tagline) and stacks its blocks VERTICALLY beneath as
22
+ * compact rows, so the shelf teaches the sentence structure a valid
23
+ * pipeline follows while it serves as the drag source. Growth is
24
+ * always vertical: a column with ≥5 blocks (plugins join their
25
+ * declared family's column) scrolls internally behind a subtle fade
26
+ * instead of sprawling horizontally.
27
  *
28
+ * Interaction modes preserved from the previous strip:
29
+ * - **Drag** a row onto the canvas (HTML5 dataTransfer payload
30
+ * "application/reactflow", unchanged — FlowCanvas's onDrop and
31
+ * edge-splice targeting work as before).
32
+ * - **Tap / click / Enter / Space** queue the kind through the
33
+ * pendingBlockKinds store bridge (same path BlockPicker uses).
34
+ * - **Touch drag** via the PointerEvent bridge (touchDrag /
35
+ * pendingTouchDrop in the store; FlowCanvas renders the floating
36
+ * preview and commits the drop).
37
+ * - **"Add blocks"** (BlockPicker modal) and the live search stay in
38
+ * the header row; search filters rows across all five columns.
39
  *
40
+ * Responsive: a ResizeObserver on the shelf (container query, same
41
+ * pattern as MultiverseBoard's grid — the palette lives in a resizable
42
+ * center column, so viewport breakpoints would lie) wraps the shelf to
43
+ * two rows below ~880px container width: Source/Backend/Algorithm on
44
+ * top, Metric/Sink below.
45
  */
46
 
47
+ const STAGE_META: {
48
  key: NodeSpec["family"];
49
  label: string;
50
+ tagline: string;
51
  }[] = [
52
+ { key: "source", label: "Source", tagline: "where the circuit comes from" },
53
+ { key: "backend", label: "Backend", tagline: "the noisy machine" },
54
+ { key: "algorithm", label: "Algorithm", tagline: "transforms the circuit" },
55
+ { key: "metric", label: "Metric", tagline: "measures the result" },
56
+ { key: "sink", label: "Sink", tagline: "collects the evidence" },
 
 
 
 
57
  ];
58
 
59
+ /** Container width below which the shelf wraps to two rows. */
60
+ const SHELF_WRAP_PX = 880;
61
+
62
  export function NodePalette() {
63
  const [search, setSearch] = useState("");
64
  // Kinds currently on the canvas — published by FlowCanvas (store
65
+ // bridge, audit S2). It is a MULTISET (one entry per node), so the
66
+ // shelf can show a per-row count dot for kinds already placed;
67
+ // BlockPicker keeps consuming it as a Set for its badges.
68
  const canvasKindsArr = useApp((s) => s.canvasKinds);
69
  const canvasKinds = useMemo(
70
  () => new Set<NodeKind>(canvasKindsArr),
71
  [canvasKindsArr],
72
  );
73
+ const canvasCounts = useMemo(() => {
74
+ const m = new Map<string, number>();
75
+ for (const k of canvasKindsArr) m.set(k, (m.get(k) ?? 0) + 1);
76
+ return m;
77
+ }, [canvasKindsArr]);
78
  const [expanded, setExpanded] = useState(true);
79
+
80
+ // Container-query wrap (ResizeObserver like MultiverseBoard, NOT a
81
+ // viewport breakpoint: the center column is user-resizable).
82
+ const shelfRef = useRef<HTMLDivElement>(null);
83
+ const [narrow, setNarrow] = useState(false);
84
+ useEffect(() => {
85
+ const el = shelfRef.current;
86
+ if (!el) return;
87
+ const update = () => setNarrow(el.clientWidth < SHELF_WRAP_PX);
88
+ update();
89
+ const ro = new ResizeObserver(update);
90
+ ro.observe(el);
91
+ return () => ro.disconnect();
92
+ }, [expanded]);
93
 
94
  // Plugin manifests this browser has uploaded — merged with NODE_CATALOG
95
+ // so plugins show up under their declared family alongside built-ins
96
+ // (resolveNodeSpec family; manifests without a known family synthesize
97
+ // as "algorithm" and land in that column, plugin badge intact).
98
  const plugins = useApp((s) => s.plugins);
99
  const setPlugins = useApp((s) => s.setPlugins);
100
  const pluginSpecs: PluginNodeSpec[] = useMemo(
 
106
  [pluginSpecs],
107
  );
108
 
 
 
 
109
  const handleDeletePlugin = async (kind: string) => {
110
  try {
111
  await api.deletePlugin(getUserId(), kind);
 
158
  );
159
  }
160
 
161
+ // Stage rows: one row of five in wide containers; Source/Backend/
162
+ // Algorithm over Metric/Sink when narrow.
163
+ const stageRows = narrow
164
+ ? [STAGE_META.slice(0, 3), STAGE_META.slice(3)]
165
+ : [STAGE_META];
166
+
167
  return (
168
  <div className="shrink-0 border-b border-edge bg-surface/40">
169
  {/* Header row */}
 
174
  protocol itself is a paper claim and stays fully exercised
175
  via the backend API; uploaded plugins still appear here and
176
  still execute. */}
177
+ {/* Search — filters rows across all five stage columns, live */}
178
  <div className="relative flex-1 max-w-[200px]">
179
  <Search className="absolute left-2 top-1/2 -translate-y-1/2 w-3 h-3 text-mute pointer-events-none" />
180
  <input
 
195
  </button>
196
  )}
197
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  <div className="flex-1" />
199
  <span className="hidden lg:inline text-[10px] text-mute/60">
200
  drag to canvas or use Add blocks
 
209
  </button>
210
  </div>
211
 
212
+ {/* The shelf: stage columns in pipeline order, arrows between */}
213
+ <div
214
+ ref={shelfRef}
215
+ data-marker="pipeline-shelf"
216
+ className="px-3 pb-2 flex flex-col gap-1.5"
217
+ >
218
+ {stageRows.map((row, ri) => (
219
+ <div key={ri} className="flex items-stretch gap-1">
220
+ {row.map((st, i) => (
221
+ <Fragment key={st.key}>
222
+ {i > 0 && (
223
+ <div
224
+ className="shrink-0 self-start pt-1 text-[11px] leading-none text-mute/40 select-none"
225
+ aria-hidden="true"
226
+ >
227
+ →
228
+ </div>
229
+ )}
230
+ <StageColumn
231
+ meta={st}
232
+ narrow={narrow}
233
+ items={filtered.filter((n) => n.family === st.key)}
234
+ searching={search.trim().length > 0}
235
+ canvasCounts={canvasCounts}
236
+ onDeletePlugin={handleDeletePlugin}
237
+ />
238
+ </Fragment>
239
+ ))}
240
+ </div>
241
+ ))}
242
+ {search.trim() && filtered.length === 0 && (
243
+ <div className="py-1 w-full text-center text-[11px] text-mute">
244
+ No blocks match "{search.trim()}".
245
+ </div>
246
+ )}
247
+ </div>
248
+ </div>
249
+ );
250
+ }
251
+
252
+ /** One stage of the grammar: compact header + vertically stacked block
253
+ * rows. ≥5 rows → the body scrolls internally behind a fade (growth
254
+ * is vertical, never horizontal sprawl). */
255
+ function StageColumn({
256
+ meta,
257
+ narrow,
258
+ items,
259
+ searching,
260
+ canvasCounts,
261
+ onDeletePlugin,
262
+ }: {
263
+ meta: (typeof STAGE_META)[number];
264
+ narrow: boolean;
265
+ items: (NodeSpec | PluginNodeSpec)[];
266
+ searching: boolean;
267
+ canvasCounts: Map<string, number>;
268
+ onDeletePlugin: (kind: string) => void;
269
+ }) {
270
+ // Columns share width equally (flex-1 basis-0). Min width 120px in
271
+ // the wide layout; the narrow two-row layout relaxes to 96px so a
272
+ // 360px phone column still fits three stages plus arrows.
273
+ const scrollable = items.length >= 5;
274
+ return (
275
+ <div
276
+ className={`flex-1 basis-0 flex flex-col ${
277
+ narrow ? "min-w-[96px]" : "min-w-[120px]"
278
+ }`}
279
+ >
280
+ <div className="px-0.5 pb-1" title={`${meta.label}: ${meta.tagline}`}>
281
+ <div className="text-[10px] uppercase tracking-wider font-medium text-mute leading-tight">
282
+ {meta.label}
283
+ </div>
284
+ <div className="text-[9px] text-mute/60 leading-tight truncate">
285
+ {meta.tagline}
286
+ </div>
287
+ </div>
288
+ <div
289
+ className={`flex flex-col gap-1 ${
290
+ scrollable ? "overflow-y-auto max-h-[124px] pr-0.5" : ""
291
+ }`}
292
+ // Subtle bottom fade signals there are more rows below the
293
+ // 3-row window. mask-image is theme-independent (no hardcoded
294
+ // background color under a translucent shelf).
295
+ style={
296
+ scrollable
297
+ ? {
298
+ maskImage:
299
+ "linear-gradient(to bottom, black calc(100% - 14px), transparent)",
300
+ WebkitMaskImage:
301
+ "linear-gradient(to bottom, black calc(100% - 14px), transparent)",
302
+ }
303
+ : undefined
304
+ }
305
+ >
306
+ {items.map((n) => (
307
+ <ShelfRow
308
+ key={n.kind}
309
+ spec={n}
310
+ canvasCount={canvasCounts.get(n.kind) ?? 0}
311
+ onDelete={
312
+ "isPlugin" in n && n.isPlugin
313
+ ? () => onDeletePlugin(n.kind)
314
+ : undefined
315
+ }
316
+ />
317
+ ))}
318
+ {items.length === 0 && searching && (
319
+ <div className="px-1 py-1.5 text-[9px] italic text-mute/50">
320
+ no match
321
  </div>
322
  )}
323
  </div>
 
325
  );
326
  }
327
 
328
+ function ShelfRow({
329
  spec,
330
+ canvasCount,
331
  onDelete,
332
  }: {
333
  spec: NodeSpec | PluginNodeSpec;
334
+ /** Copies of this kind already on the canvas (0 = none) — rendered
335
+ * as a subtle count dot so "already placed" reads at a glance. */
336
+ canvasCount: number;
337
+ /** When set, shows a small × that calls back on click — used for
338
+ * user-uploaded plugins. */
339
  onDelete?: () => void;
340
  }) {
341
  const addBlocksToCanvas = useApp((s) => s.addBlocksToCanvas);
 
398
  }
399
  }
400
  setTouchDrag({ kind: spec.kind, x: ev.clientX, y: ev.clientY });
401
+ // preventDefault suppresses the column's internal scroll once
402
+ // we've committed to dragging.
403
  ev.preventDefault();
404
  };
405
 
 
443
  onPointerDown={onPointerDown}
444
  onClick={addToCanvas}
445
  // The button gives us Enter/Space → click for free; we override
446
+ // Space below so it doesn't also scroll the column.
447
  onKeyDown={(e) => {
448
  if (e.key === " ") {
449
  e.preventDefault();
450
  addToCanvas();
451
  }
452
  }}
453
+ className={`qf-no-callout group relative shrink-0 cursor-grab active:cursor-grabbing flex items-center gap-1.5 w-full h-9 rounded-md border transition-colors text-left px-1.5 focus:outline-none focus-visible:ring-2 focus-visible:ring-accent ${
454
  isPlugin
455
  ? "border-edge bg-surface/60 hover:bg-surfaceAlt"
456
  : "border-edge/60 hover:border-edge hover:bg-surfaceAlt"
457
  }`}
458
+ // The tile's visible tagline moved here: tooltip = tagline +
459
+ // long-form description.
460
+ title={`${spec.tagline} — ${spec.description}`}
461
  aria-label={`Add ${spec.label} block to canvas. ${spec.tagline}`}
462
  >
463
+ {isPlugin ? (
464
+ <span
465
+ className="shrink-0 w-5 h-5 rounded-md flex items-center justify-center text-[9px] font-bold text-white"
466
+ style={{ backgroundColor: (spec as PluginNodeSpec).pluginColor }}
467
+ aria-hidden
468
+ >
469
+ {(spec as PluginNodeSpec).initials}
470
+ </span>
471
+ ) : (
472
+ <span
473
+ className={`shrink-0 w-5 h-5 rounded-md border ${spec.accentRing} bg-surface flex items-center justify-center ${spec.accent}`}
474
+ aria-hidden
475
+ >
476
+ <Icon className="w-3 h-3" strokeWidth={2} />
477
+ </span>
478
+ )}
479
+ <span className="flex-1 min-w-0 text-[10px] text-ink truncate leading-tight">
480
+ {spec.label}
481
+ </span>
482
+ {/* "On canvas" count dot — subtle, non-interactive. */}
483
+ {canvasCount > 0 && (
484
+ <span
485
+ className="shrink-0 min-w-[14px] h-3.5 px-0.5 rounded-full bg-accent/15 border border-accent/40 text-accent text-[8px] leading-none font-medium flex items-center justify-center tabular-nums"
486
+ title={`${canvasCount} on canvas`}
487
+ aria-label={`${canvasCount} already on canvas`}
488
+ >
489
+ {canvasCount}
490
+ </span>
491
+ )}
492
+ {/* Right-edge adornments: paper link (built-ins, non-anon) or
493
+ plugin delete. Interactive children; stopPropagation keeps
494
+ the parent button from also firing. */}
495
  {spec.paper && !isPlugin && !ANON && (
496
  <a
497
  href={spec.paper.url}
 
500
  draggable={false}
501
  onDragStart={(e) => e.stopPropagation()}
502
  onClick={(e) => e.stopPropagation()}
503
+ className="shrink-0 w-4 h-4 rounded-full bg-accent/20 border border-accent/70 text-accent hover:bg-accent/40 hover:border-accent hover:text-ink flex items-center justify-center transition-colors"
504
  title={`Paper: ${spec.paper.title} (${spec.paper.venue})`}
505
  aria-label={`Open paper: ${spec.paper.title}`}
506
  >
507
+ <FileText className="w-2 h-2" strokeWidth={2} />
508
  </a>
509
  )}
510
  {isPlugin && onDelete && (
511
+ // Always visible (hover-only left mobile + keyboard users with
512
+ // no way to find it); slight rest opacity keeps it quiet.
 
 
513
  <button
514
  type="button"
515
  draggable={false}
 
523
  // focused on the delete X.
524
  if (e.key === "Enter" || e.key === " ") e.stopPropagation();
525
  }}
526
+ className="shrink-0 w-4 h-4 rounded-full border border-edge bg-surface text-mute hover:text-danger hover:border-danger/60 flex items-center justify-center opacity-70 hover:opacity-100 focus:opacity-100 transition-opacity"
527
  title={`Delete plugin ${spec.label}`}
528
  aria-label={`Delete plugin ${spec.label}`}
529
  >
530
+ <X className="w-2.5 h-2.5" strokeWidth={2.5} />
531
  </button>
532
  )}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  </button>
534
  );
535
  }
frontend/src/components/WelcomeTour.tsx CHANGED
@@ -306,8 +306,10 @@ function ComposeSlide() {
306
  <p>
307
  From the Evidence board (home), open the{" "}
308
  <span className="text-ink font-medium">Pipeline editor</span> to
309
- define a configuration: drag blocks, wire them (or Auto-connect),
310
- press <span className="kbd">Run pipeline</span>. Ribbons carry the circuit
 
 
311
  between blocks — a shrinking ribbon means a step compressed it (width
312
  tracks gate count
313
  <TipIcon className="mx-0.5 align-text-top" hint={gloss("gates")} />).
 
306
  <p>
307
  From the Evidence board (home), open the{" "}
308
  <span className="text-ink font-medium">Pipeline editor</span> to
309
+ define a configuration: drag blocks from the pipeline shelf — its
310
+ columns spell the grammar, Source → Backend → Algorithm → Metric →
311
+ Sink — wire them (or Auto-connect), press{" "}
312
+ <span className="kbd">Run pipeline</span>. Ribbons carry the circuit
313
  between blocks — a shrinking ribbon means a step compressed it (width
314
  tracks gate count
315
  <TipIcon className="mx-0.5 align-text-top" hint={gloss("gates")} />).