Cleanup: dead touch-drag bridge, empty-state + tour copy, docs
Browse files- touchDrag / pendingTouchDrop machinery removed from the store and
FlowCanvas (selectors, both effects, the TouchDragPreview chip):
the shelf was its only producer — grep confirms zero remaining
references. Tap-to-add via the Add-block popover is the touch path;
the shared splice-highlight logic (findClosestEdge +
dropTargetEdgeId) stays, since the mouse drag-from-popover path
still uses it.
- EmptyCanvas teaches the two add paths ("+ Add block", drag from a
block's edge into empty space) and carries the five-stage grammar
line the shelf used to illustrate.
- Tour slide 2 (ComposeSlide) no longer claims a pipeline shelf
exists; minimal rewording to "+ Add block" + edge-drag, grammar
order kept.
- docs/EVIDENCE_WORKBENCH.md: the palette-as-grammar paragraph
rewritten honestly — shelf superseded by the chooser popover +
grammar-aware insertion; design principle stated (constant chrome,
growth in on-demand surfaces).
- Store/FlowCanvas comments updated to name the chooser instead of
NodePalette; App.tsx MIN_CANVAS_W rationale updated (tier 1).
Gates: tsc, build, VITE_ANON=1 build (markers block-chooser +
canvas-insert-menu + "Add block" in bundle, pipeline-shelf absent),
86 backend tests, node lanes (export_python, svg_paper, zip,
difference_funnel, autoconnect smoke) all green.
- docs/EVIDENCE_WORKBENCH.md +25 -16
- frontend/src/App.tsx +2 -2
- frontend/src/components/EmptyCanvas.tsx +14 -8
- frontend/src/components/FlowCanvas.tsx +3 -142
- frontend/src/components/WelcomeTour.tsx +5 -3
- frontend/src/lib/store.ts +9 -39
|
@@ -54,22 +54,31 @@ detail). Internal ids stay frozen ("compose"/"multiverse" in scenario
|
|
| 54 |
uiState, localStorage, provenance); only labels speak the new language
|
| 55 |
("Pipeline editor"/"Evidence board").
|
| 56 |
|
| 57 |
-
**Palette as grammar (
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
the
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
### 1.2 Grounding in documented practice
|
| 75 |
|
|
|
|
| 54 |
uiState, localStorage, provenance); only labels speak the new language
|
| 55 |
("Pipeline editor"/"Evidence board").
|
| 56 |
|
| 57 |
+
**Palette as grammar, second pass (markers `block-chooser`,
|
| 58 |
+
`canvas-insert-menu`; supersedes the pipeline shelf).** The shelf —
|
| 59 |
+
an always-visible five-column strip above the canvas — taught the
|
| 60 |
+
grammar at a permanent price: ~300px of chrome, mostly whitespace,
|
| 61 |
+
growing with the block count and squeezing the very canvas it fed.
|
| 62 |
+
It is gone; the palette's permanent chrome is now exactly ONE toolbar
|
| 63 |
+
button, **+ Add block**. Its popover keeps the pedagogy: five stage
|
| 64 |
+
sections in pipeline order (Source → Backend → Algorithm → Metric →
|
| 65 |
+
Sink, each with the shelf's one-line tagline), compact rows with
|
| 66 |
+
plugin badges, on-canvas count dots and plugin delete; click adds
|
| 67 |
+
through pendingBlockKinds and the popover STAYS OPEN for multi-add
|
| 68 |
+
(the row flashes "added ✓"), drag carries the unchanged dataTransfer
|
| 69 |
+
payload so the splice-on-edge drop still works, search filters live,
|
| 70 |
+
rows lock while a run is in progress. The grammar also moved into the
|
| 71 |
+
canvas itself: releasing a connection drag from a node's source
|
| 72 |
+
handle over empty pane opens a mini insert menu listing only blocks
|
| 73 |
+
whose family can legally FOLLOW per auto-connect's ordering
|
| 74 |
+
(`nextFamilies` in autoConnect.ts: algorithm→algorithm chains,
|
| 75 |
+
source/backend never repeat, sink is terminal) — picking one places
|
| 76 |
+
the block at the drop point and wires the pending connection;
|
| 77 |
+
double-click on empty pane opens the same menu unfiltered. Design
|
| 78 |
+
principle: chrome cost stays constant while the catalog grows —
|
| 79 |
+
growth lands in on-demand surfaces (popover, contextual menu), never
|
| 80 |
+
in permanent layout. Tap-to-add via the popover is the touch path;
|
| 81 |
+
the shelf's PointerEvent touch-drag bridge was deleted with it.
|
| 82 |
|
| 83 |
### 1.2 Grounding in documented practice
|
| 84 |
|
|
@@ -66,8 +66,8 @@ const WIDE_QUERY = "(min-width: 1200px)";
|
|
| 66 |
// Minimum width we ever want to leave for the canvas (React Flow +
|
| 67 |
// its two-row toolbar). The dynamic clamp in the resize handler caps
|
| 68 |
// the side panes so the center column never falls below this,
|
| 69 |
-
// regardless of viewport size. (The old rationale — pipeline
|
| 70 |
-
// columns overflowing `<main>` — died with the shelf; the floor
|
| 71 |
// simply keeps the toolbar rows and a useful slice of canvas usable.)
|
| 72 |
const MIN_CANVAS_W = 280;
|
| 73 |
// Reserve the side resizer's footprint when computing the canvas budget.
|
|
|
|
| 66 |
// Minimum width we ever want to leave for the canvas (React Flow +
|
| 67 |
// its two-row toolbar). The dynamic clamp in the resize handler caps
|
| 68 |
// the side panes so the center column never falls below this,
|
| 69 |
+
// regardless of viewport size. (The old rationale — the pipeline
|
| 70 |
+
// shelf's columns overflowing `<main>` — died with the shelf; the floor
|
| 71 |
// simply keeps the toolbar rows and a useful slice of canvas usable.)
|
| 72 |
const MIN_CANVAS_W = 280;
|
| 73 |
// Reserve the side resizer's footprint when computing the canvas budget.
|
|
@@ -1,9 +1,11 @@
|
|
| 1 |
import { NODE_CATALOG } from "../lib/nodeCatalog";
|
| 2 |
|
| 3 |
/**
|
| 4 |
-
* Empty-state overlay shown when the canvas has no nodes.
|
| 5 |
-
*
|
| 6 |
-
*
|
|
|
|
|
|
|
| 7 |
*/
|
| 8 |
export function EmptyCanvas() {
|
| 9 |
return (
|
|
@@ -15,11 +17,15 @@ 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 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
<span className="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
button bottom-right on phones) and evidence collects in the
|
| 24 |
right-hand pane.
|
| 25 |
</div>
|
|
|
|
| 1 |
import { NODE_CATALOG } from "../lib/nodeCatalog";
|
| 2 |
|
| 3 |
/**
|
| 4 |
+
* Empty-state overlay shown when the canvas has no nodes. Teaches the
|
| 5 |
+
* two add paths — the "+ Add block" chooser in the toolbar, and
|
| 6 |
+
* dragging out of a block's edge into empty space — plus the preset
|
| 7 |
+
* shortcut, and carries the five-stage grammar line the old pipeline
|
| 8 |
+
* shelf used to illustrate (the tour's slide 2 is the other carrier).
|
| 9 |
*/
|
| 10 |
export function EmptyCanvas() {
|
| 11 |
return (
|
|
|
|
| 17 |
the copy describes where to look instead of quoting text
|
| 18 |
the user cannot see. */}
|
| 19 |
<div className="text-sm text-mute mb-3">
|
| 20 |
+
Hit <span className="kbd">+ Add block</span> in the toolbar
|
| 21 |
+
(click rows to add, or drag them in), or — once blocks exist —
|
| 22 |
+
drag from a block's right edge into empty space and pick what
|
| 23 |
+
legally comes next. Pipelines read left to right:{" "}
|
| 24 |
+
<span className="whitespace-nowrap">
|
| 25 |
+
Source → Backend → Algorithm → Metric → Sink
|
| 26 |
+
</span>
|
| 27 |
+
. Or load a preset from the toolbar's layers-icon menu, then
|
| 28 |
+
hit <span className="kbd">Run</span> (toolbar top-right; round
|
| 29 |
button bottom-right on phones) and evidence collects in the
|
| 30 |
right-hand pane.
|
| 31 |
</div>
|
|
@@ -37,7 +37,6 @@ import {
|
|
| 37 |
NODE_BY_KIND,
|
| 38 |
resolveNodeSpec,
|
| 39 |
type NodeKind,
|
| 40 |
-
type PluginNodeSpec,
|
| 41 |
} from "../lib/nodeCatalog";
|
| 42 |
import {
|
| 43 |
DEFAULT_PRESET_KEY,
|
|
@@ -229,9 +228,9 @@ export function FlowCanvas() {
|
|
| 229 |
.join("|"),
|
| 230 |
[nodes],
|
| 231 |
);
|
| 232 |
-
// BlockPicker bridge (audit S2): publish the kind
|
| 233 |
-
// the canvas so the
|
| 234 |
-
//
|
| 235 |
useEffect(() => {
|
| 236 |
useApp
|
| 237 |
.getState()
|
|
@@ -918,94 +917,6 @@ export function FlowCanvas() {
|
|
| 918 |
});
|
| 919 |
}, [edges, dropTargetEdgeId, stepByNodeId, nodes, preflightPlugins, staleEncodings]);
|
| 920 |
|
| 921 |
-
// ---- Touch drag bridge (mobile drag-to-insert) ---------------------
|
| 922 |
-
//
|
| 923 |
-
// HTML5 drag-and-drop doesn't fire on touch devices, so PaletteTile
|
| 924 |
-
// implements a parallel PointerEvent-based drag and publishes its
|
| 925 |
-
// state through the Zustand store. Here:
|
| 926 |
-
// * touchDrag (non-null while a finger is dragging) drives the
|
| 927 |
-
// floating preview chip and the edge-highlight target.
|
| 928 |
-
// * pendingTouchDrop is set once on pointerup; we commit the
|
| 929 |
-
// drop (splice into the closest edge, or land at the cursor).
|
| 930 |
-
const touchDrag = useApp((s) => s.touchDrag);
|
| 931 |
-
const pendingTouchDrop = useApp((s) => s.pendingTouchDrop);
|
| 932 |
-
const setPendingTouchDrop = useApp((s) => s.setPendingTouchDrop);
|
| 933 |
-
|
| 934 |
-
// While a touch drag is active, mirror the cursor position into
|
| 935 |
-
// dropTargetEdgeId so the same dashed-accent highlight that mouse
|
| 936 |
-
// drag uses also lights up for the touch user.
|
| 937 |
-
useEffect(() => {
|
| 938 |
-
if (!touchDrag) {
|
| 939 |
-
// Drag ended or was cancelled: clear the highlight, or an
|
| 940 |
-
// aborted touch drag leaves an edge lit indefinitely (audit
|
| 941 |
-
// S3). Safe for the drop path — the commit effect below reads
|
| 942 |
-
// this render's dropTargetEdgeId, not the cleared next-render
|
| 943 |
-
// value.
|
| 944 |
-
setDropTargetEdgeId(null);
|
| 945 |
-
return;
|
| 946 |
-
}
|
| 947 |
-
const next = findClosestEdge(touchDrag.x, touchDrag.y);
|
| 948 |
-
setDropTargetEdgeId((prev) => (prev === next ? prev : next));
|
| 949 |
-
}, [touchDrag, findClosestEdge]);
|
| 950 |
-
|
| 951 |
-
// Commit the drop once the finger lifts. Same splice-vs-land logic
|
| 952 |
-
// as onDrop, just sourced from the store instead of a DragEvent.
|
| 953 |
-
useEffect(() => {
|
| 954 |
-
if (!pendingTouchDrop) return;
|
| 955 |
-
const { kind, x, y } = pendingTouchDrop;
|
| 956 |
-
setPendingTouchDrop(null);
|
| 957 |
-
|
| 958 |
-
const targetEdgeId = dropTargetEdgeId;
|
| 959 |
-
setDropTargetEdgeId(null);
|
| 960 |
-
|
| 961 |
-
const plugins = useApp.getState().plugins;
|
| 962 |
-
const spec = resolveNodeSpec(kind, plugins);
|
| 963 |
-
if (!spec) return;
|
| 964 |
-
|
| 965 |
-
// If the finger went up off-canvas (over the palette strip or a
|
| 966 |
-
// pane resizer), abort. wrapperRef bounds drive this check.
|
| 967 |
-
const rect = wrapperRef.current?.getBoundingClientRect();
|
| 968 |
-
if (!rect || x < rect.left || x > rect.right || y < rect.top || y > rect.bottom) {
|
| 969 |
-
return;
|
| 970 |
-
}
|
| 971 |
-
|
| 972 |
-
const position = screenToFlowPosition({ x, y });
|
| 973 |
-
const id = freshNodeId();
|
| 974 |
-
const node: RFNode = {
|
| 975 |
-
id,
|
| 976 |
-
type: "qnode",
|
| 977 |
-
position,
|
| 978 |
-
data: {
|
| 979 |
-
kind: kind as NodeKind,
|
| 980 |
-
params: { ...((spec.defaultData as Record<string, unknown>) ?? {}) },
|
| 981 |
-
},
|
| 982 |
-
};
|
| 983 |
-
|
| 984 |
-
if (targetEdgeId) {
|
| 985 |
-
const target = edges.find((edge) => edge.id === targetEdgeId);
|
| 986 |
-
if (target) {
|
| 987 |
-
setNodes((ns) => ns.concat(node));
|
| 988 |
-
setEdges((es) => {
|
| 989 |
-
const withoutOld = es.filter((edge) => edge.id !== targetEdgeId);
|
| 990 |
-
return withoutOld.concat(
|
| 991 |
-
{ id: `e${id}-in`, source: target.source, target: id },
|
| 992 |
-
{ id: `e${id}-out`, source: id, target: target.target },
|
| 993 |
-
);
|
| 994 |
-
});
|
| 995 |
-
return;
|
| 996 |
-
}
|
| 997 |
-
}
|
| 998 |
-
setNodes((ns) => ns.concat(node));
|
| 999 |
-
}, [
|
| 1000 |
-
pendingTouchDrop,
|
| 1001 |
-
dropTargetEdgeId,
|
| 1002 |
-
edges,
|
| 1003 |
-
screenToFlowPosition,
|
| 1004 |
-
setNodes,
|
| 1005 |
-
setEdges,
|
| 1006 |
-
setPendingTouchDrop,
|
| 1007 |
-
]);
|
| 1008 |
-
|
| 1009 |
// Monotonic counter so we can tell stale `loadSample` resolutions
|
| 1010 |
// (from a prior preset click OR a prior restore) from the most
|
| 1011 |
// recent one. Without this, a user who quickly toggles between two
|
|
@@ -2070,13 +1981,6 @@ export function FlowCanvas() {
|
|
| 2070 |
{notice && (
|
| 2071 |
<CanvasToast notice={notice} onDismiss={() => setNotice(null)} />
|
| 2072 |
)}
|
| 2073 |
-
{/* Floating preview while a finger drags a palette tile. fixed
|
| 2074 |
-
positioning ignores the wrapper so it follows the finger
|
| 2075 |
-
even off-canvas; pointer-events:none means the touch keeps
|
| 2076 |
-
hitting whatever is underneath. */}
|
| 2077 |
-
{touchDrag && (
|
| 2078 |
-
<TouchDragPreview kind={touchDrag.kind} x={touchDrag.x} y={touchDrag.y} />
|
| 2079 |
-
)}
|
| 2080 |
{/* Mobile-only Run FAB. The Run button in the canvas toolbar
|
| 2081 |
sits ~108px from the top — well outside thumb arc on tall
|
| 2082 |
phones. This bottom-right FAB at md:hidden is what mobile
|
|
@@ -2277,9 +2181,6 @@ function ConfigContextBar({
|
|
| 2277 |
);
|
| 2278 |
}
|
| 2279 |
|
| 2280 |
-
/** Floating chip following the finger during a touch drag. Shows the
|
| 2281 |
-
* block's family color + initials so the user sees what they're
|
| 2282 |
-
* carrying. */
|
| 2283 |
/** Soft banner above the canvas summarising pre-flight findings.
|
| 2284 |
* Renders as a collapsed-by-default single line "N issues" chip;
|
| 2285 |
* expands on click into a per-finding list. The Run button stays
|
|
@@ -2332,46 +2233,6 @@ function PreflightBanner({ findings }: { findings: PreflightFinding[] }) {
|
|
| 2332 |
);
|
| 2333 |
}
|
| 2334 |
|
| 2335 |
-
function TouchDragPreview({
|
| 2336 |
-
kind,
|
| 2337 |
-
x,
|
| 2338 |
-
y,
|
| 2339 |
-
}: {
|
| 2340 |
-
kind: NodeKind;
|
| 2341 |
-
x: number;
|
| 2342 |
-
y: number;
|
| 2343 |
-
}) {
|
| 2344 |
-
const plugins = useApp((s) => s.plugins);
|
| 2345 |
-
const spec = resolveNodeSpec(kind, plugins);
|
| 2346 |
-
if (!spec) return null;
|
| 2347 |
-
const isPlugin = "isPlugin" in spec && spec.isPlugin;
|
| 2348 |
-
const Icon = spec.icon;
|
| 2349 |
-
return (
|
| 2350 |
-
<div
|
| 2351 |
-
className="fixed z-50 pointer-events-none flex items-center gap-1.5 px-2 py-1 rounded-md border border-accent2 bg-surface shadow-lg text-[11px] font-medium text-ink"
|
| 2352 |
-
style={{
|
| 2353 |
-
left: x + 8,
|
| 2354 |
-
top: y + 8,
|
| 2355 |
-
// Slight rotation to look "held" and lifted.
|
| 2356 |
-
transform: "rotate(-2deg)",
|
| 2357 |
-
}}
|
| 2358 |
-
aria-hidden
|
| 2359 |
-
>
|
| 2360 |
-
{isPlugin ? (
|
| 2361 |
-
<span
|
| 2362 |
-
className="w-5 h-5 rounded-sm flex items-center justify-center text-[9px] font-bold text-white"
|
| 2363 |
-
style={{ backgroundColor: (spec as PluginNodeSpec).pluginColor }}
|
| 2364 |
-
>
|
| 2365 |
-
{(spec as PluginNodeSpec).initials}
|
| 2366 |
-
</span>
|
| 2367 |
-
) : (
|
| 2368 |
-
<Icon className={`w-3.5 h-3.5 ${spec.accent}`} />
|
| 2369 |
-
)}
|
| 2370 |
-
<span>{spec.label}</span>
|
| 2371 |
-
</div>
|
| 2372 |
-
);
|
| 2373 |
-
}
|
| 2374 |
-
|
| 2375 |
/**
|
| 2376 |
* Absolute-positioned toast pinned to the bottom-center of the canvas.
|
| 2377 |
* Handles Auto-connect summaries, Auto-connect warnings (multi-line via
|
|
|
|
| 37 |
NODE_BY_KIND,
|
| 38 |
resolveNodeSpec,
|
| 39 |
type NodeKind,
|
|
|
|
| 40 |
} from "../lib/nodeCatalog";
|
| 41 |
import {
|
| 42 |
DEFAULT_PRESET_KEY,
|
|
|
|
| 228 |
.join("|"),
|
| 229 |
[nodes],
|
| 230 |
);
|
| 231 |
+
// BlockPicker bridge (audit S2): publish the kind multiset actually
|
| 232 |
+
// on the canvas so the Add-block chooser renders live per-row
|
| 233 |
+
// "on canvas" count dots.
|
| 234 |
useEffect(() => {
|
| 235 |
useApp
|
| 236 |
.getState()
|
|
|
|
| 917 |
});
|
| 918 |
}, [edges, dropTargetEdgeId, stepByNodeId, nodes, preflightPlugins, staleEncodings]);
|
| 919 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 920 |
// Monotonic counter so we can tell stale `loadSample` resolutions
|
| 921 |
// (from a prior preset click OR a prior restore) from the most
|
| 922 |
// recent one. Without this, a user who quickly toggles between two
|
|
|
|
| 1981 |
{notice && (
|
| 1982 |
<CanvasToast notice={notice} onDismiss={() => setNotice(null)} />
|
| 1983 |
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1984 |
{/* Mobile-only Run FAB. The Run button in the canvas toolbar
|
| 1985 |
sits ~108px from the top — well outside thumb arc on tall
|
| 1986 |
phones. This bottom-right FAB at md:hidden is what mobile
|
|
|
|
| 2181 |
);
|
| 2182 |
}
|
| 2183 |
|
|
|
|
|
|
|
|
|
|
| 2184 |
/** Soft banner above the canvas summarising pre-flight findings.
|
| 2185 |
* Renders as a collapsed-by-default single line "N issues" chip;
|
| 2186 |
* expands on click into a per-finding list. The Run button stays
|
|
|
|
| 2233 |
);
|
| 2234 |
}
|
| 2235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2236 |
/**
|
| 2237 |
* Absolute-positioned toast pinned to the bottom-center of the canvas.
|
| 2238 |
* Handles Auto-connect summaries, Auto-connect warnings (multi-line via
|
|
@@ -306,9 +306,11 @@ 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:
|
| 310 |
-
|
| 311 |
-
|
|
|
|
|
|
|
| 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
|
|
|
|
| 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: add blocks with{" "}
|
| 310 |
+
<span className="text-ink font-medium">+ Add block</span> — the
|
| 311 |
+
catalog reads in grammar order, Source → Backend → Algorithm →
|
| 312 |
+
Metric → Sink — or drag from a block's edge into empty space to
|
| 313 |
+
grow the chain; wire them (or Auto-connect), press{" "}
|
| 314 |
<span className="kbd">Run pipeline</span>. Ribbons carry the circuit
|
| 315 |
between blocks — a shrinking ribbon means a step compressed it (width
|
| 316 |
tracks gate count
|
|
@@ -290,9 +290,10 @@ interface AppState {
|
|
| 290 |
setUseLiveIbm: (v: boolean) => void;
|
| 291 |
|
| 292 |
/**
|
| 293 |
-
* Cross-component bridge:
|
| 294 |
-
*
|
| 295 |
-
* this via useEffect, creates the nodes,
|
|
|
|
| 296 |
*/
|
| 297 |
pendingBlockKinds: NodeKind[];
|
| 298 |
addBlocksToCanvas: (kinds: NodeKind[]) => void;
|
|
@@ -300,8 +301,8 @@ interface AppState {
|
|
| 300 |
|
| 301 |
/** Reverse bridge (audit S2): FlowCanvas publishes the kinds
|
| 302 |
* currently on the canvas whenever the kind multiset changes, so
|
| 303 |
-
* the
|
| 304 |
-
*
|
| 305 |
canvasKinds: NodeKind[];
|
| 306 |
setCanvasKinds: (kinds: NodeKind[]) => void;
|
| 307 |
|
|
@@ -314,39 +315,12 @@ interface AppState {
|
|
| 314 |
bumpHintExpandLeftPane: () => void;
|
| 315 |
|
| 316 |
/** Plugin manifests this user has uploaded. Refreshed on app boot
|
| 317 |
-
* and after every upload/delete.
|
| 318 |
-
* these into the canonical NodeCatalog so
|
| 319 |
-
* built-in blocks. */
|
| 320 |
plugins: PluginManifest[];
|
| 321 |
setPlugins: (p: PluginManifest[]) => void;
|
| 322 |
|
| 323 |
-
/**
|
| 324 |
-
* Touch-drag bridge between NodePalette (where the touch starts)
|
| 325 |
-
* and FlowCanvas (which renders the floating preview, computes the
|
| 326 |
-
* edge under the finger, and ultimately commits the drop).
|
| 327 |
-
*
|
| 328 |
-
* touchDrag — non-null while a touch drag is active. The
|
| 329 |
-
* palette tile updates x/y on every pointermove.
|
| 330 |
-
* The canvas reads x/y to render a floating
|
| 331 |
-
* preview and to compute which edge to splice.
|
| 332 |
-
* pendingTouchDrop — set once by the palette on pointerup. The
|
| 333 |
-
* canvas's useEffect commits the drop (splice
|
| 334 |
-
* into the closest edge OR add at the cursor
|
| 335 |
-
* position) and clears it.
|
| 336 |
-
*
|
| 337 |
-
* Why a separate "pending" signal instead of just one field: the
|
| 338 |
-
* preview state should disappear immediately on release, but the
|
| 339 |
-
* actual node creation needs the cursor's final coordinates AND
|
| 340 |
-
* needs to fire from FlowCanvas (which owns the React Flow nodes).
|
| 341 |
-
*/
|
| 342 |
-
touchDrag: { kind: NodeKind; x: number; y: number } | null;
|
| 343 |
-
setTouchDrag: (
|
| 344 |
-
v: { kind: NodeKind; x: number; y: number } | null,
|
| 345 |
-
) => void;
|
| 346 |
-
pendingTouchDrop: { kind: NodeKind; x: number; y: number } | null;
|
| 347 |
-
setPendingTouchDrop: (
|
| 348 |
-
v: { kind: NodeKind; x: number; y: number } | null,
|
| 349 |
-
) => void;
|
| 350 |
|
| 351 |
/**
|
| 352 |
* Scenario bridge (Wave P): a scenario boot (?scenario=Fn) can ask
|
|
@@ -554,10 +528,6 @@ export const useApp = create<AppState>((set) => ({
|
|
| 554 |
set((s) => ({ hintExpandLeftPane: s.hintExpandLeftPane + 1 })),
|
| 555 |
plugins: [],
|
| 556 |
setPlugins: (p) => set({ plugins: p }),
|
| 557 |
-
touchDrag: null,
|
| 558 |
-
setTouchDrag: (v) => set({ touchDrag: v }),
|
| 559 |
-
pendingTouchDrop: null,
|
| 560 |
-
setPendingTouchDrop: (v) => set({ pendingTouchDrop: v }),
|
| 561 |
pendingAutoRun: null,
|
| 562 |
requestAutoRun: (sampleKey, opts) =>
|
| 563 |
set({ pendingAutoRun: { sampleKey, ...(opts ?? {}) } }),
|
|
|
|
| 290 |
setUseLiveIbm: (v: boolean) => void;
|
| 291 |
|
| 292 |
/**
|
| 293 |
+
* Cross-component bridge: the Add-block chooser (BlockPicker
|
| 294 |
+
* popover) pushes block kinds here when the user clicks a catalog
|
| 295 |
+
* row. FlowCanvas watches this via useEffect, creates the nodes,
|
| 296 |
+
* auto-connects, and clears.
|
| 297 |
*/
|
| 298 |
pendingBlockKinds: NodeKind[];
|
| 299 |
addBlocksToCanvas: (kinds: NodeKind[]) => void;
|
|
|
|
| 301 |
|
| 302 |
/** Reverse bridge (audit S2): FlowCanvas publishes the kinds
|
| 303 |
* currently on the canvas whenever the kind multiset changes, so
|
| 304 |
+
* the Add-block chooser can render live per-row "on canvas" count
|
| 305 |
+
* dots. */
|
| 306 |
canvasKinds: NodeKind[];
|
| 307 |
setCanvasKinds: (kinds: NodeKind[]) => void;
|
| 308 |
|
|
|
|
| 315 |
bumpHintExpandLeftPane: () => void;
|
| 316 |
|
| 317 |
/** Plugin manifests this user has uploaded. Refreshed on app boot
|
| 318 |
+
* and after every upload/delete. The Add-block chooser and the
|
| 319 |
+
* canvas insert menu merge these into the canonical NodeCatalog so
|
| 320 |
+
* they appear alongside built-in blocks. */
|
| 321 |
plugins: PluginManifest[];
|
| 322 |
setPlugins: (p: PluginManifest[]) => void;
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
|
| 325 |
/**
|
| 326 |
* Scenario bridge (Wave P): a scenario boot (?scenario=Fn) can ask
|
|
|
|
| 528 |
set((s) => ({ hintExpandLeftPane: s.hintExpandLeftPane + 1 })),
|
| 529 |
plugins: [],
|
| 530 |
setPlugins: (p) => set({ plugins: p }),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 531 |
pendingAutoRun: null,
|
| 532 |
requestAutoRun: (sampleKey, opts) =>
|
| 533 |
set({ pendingAutoRun: { sampleKey, ...(opts ?? {}) } }),
|