Repository navigation
Add experiment design graph editor prototype - #144
Draft
kevindetry-milaboratories wants to merge 16 commits into
Draft
kevindetry-milaboratories wants to merge 16 commits into
kevindetry-milaboratories wants to merge 16 commits into
Conversation
A first, graph-only prototype of the experiment-design editor on a new "Design" page. State is local; block args and the workflow are not changed. - `ui/src/design-graph/` holds the editor. It uses plain Vue and `@milaboratories/uikit` only and imports nothing from the rest of the block UI, so it can move to a shared package later. - `toGraph` converts the authored materials into nodes and edges. A material with several parents gets an inserted `<child>::pool` node. - `withJunctions` adds a hidden junction for each separation with two or more partitions. Junctions are derived, not stored. - `layout` is a pure function: columns are step positions (a `round` label pushes a material to its round), rows follow a tree order, and edges are right-angle lines. - Nodes and edges have separate panels. Edits are immutable and keep an undo history. - Four example designs: one follows a synthetic study, three are invented.
Replace the right-angle edges with horizontal S-curves. - `layout` returns each edge's two ends and the x range of the column gap where it may change rows (`PlacedEdge`). The view draws straight leads up to that range and a cubic Bézier inside it, so a curve never crosses a node card. Edges between nodes on one row stay straight. - A separation's line runs into its junction, and each partition leaves the junction on its own curve. Merges into a pool mirror this. - Junctions of one parent share the gap center and differ by row, so the per-separation x offset is gone.
Every unsequenced node is now a shadow node: a faint dashed circle that shows on hover. Starting materials, unsequenced steps, split points and merges share one style. - Shadow materials carry no labels, only an optional `name`. Their ids are generated (`shadow-N`); unnamed ones show a grey placeholder. - Shadows are created only through actions: Start (toolbar), Add step (node panel), Insert step and Add partition (edge panel), and Add partition (split panel). "Add material" and the sequenced checkbox are gone. - Split points and merges stay derived from the design.
Each material gets two ports: the right one adds children, the left one adds parents. The node and edge properties move into a sidebar. - Clicking a port opens a sample picker in the sidebar: a mock sample table filtered by a metadata column and its values. The picked samples are added with the chosen connection type; slices added together form one split, several parents form a merge. - Dragging a port draws a connection. A drop on a node connects to it (a second parent makes a merge), a drop on an edge or split point joins that separation, a drop on empty space opens the picker. A drop that would make a cycle, drop other parents, or change nothing is refused while dragging. - The ends of a selected edge can be dragged to another node, or to another edge to make a partition. A moved edge keeps its type. - `connect.ts` holds the drop rules as pure functions; `edit.ts` gains the material-level edits. - When the sidebar opens, the selected node or edge is panned out from under it.
A first version of acting on several nodes at once. - Cmd/Ctrl+click (or Shift+click) toggles a node. Shift+drag on the background draws a selection box; a plain drag still pans. - With two or more nodes selected, a bar at the bottom of the canvas shows the count and the actions: set the connection type, add a step to each, merge them into one new shadow node, make one split of siblings, and move them under a new parent (the next node clicked). - The actions are pure edits in `edit.ts`: `setPartOf`, `addStepsTo`, `mergeInto`, `makeSplit` and `moveUnder`. Partitions of one split stay together when they move.
All actions now live in the right sidebar. With two or more nodes selected, the sidebar shows the count and the bulk actions in the same header layout as the node and edge panels. The floating bottom bar is gone. - "Cancel" takes the place of "Move under…" while picking a parent. - The view pans so the selected nodes are not under the sidebar.
- Delete any node from the sidebar or with Delete/Backspace. A deleted material's children take its parents and keep how they were made; slices that shared a split stay together. A deleted sample is free to place again. Deleting a split point dissolves the split; deleting a merge keeps the child's first parent. Several selected nodes are deleted together. - "Replace with sample" swaps a material for a sample from a single-choice picker and keeps every connection. - "Start" opens a picker that adds samples as roots, or a shadow node. - Escape cancels picking a parent, otherwise closes the sidebar. - Label fields in the sidebar no longer overlap: uikit text fields have a 160px minimum width.
- The sample picker has one filter: pick "column: value" options in a single dropdown. Values of one column match any of them; different columns must all match. The rule lives in `filter.ts` with tests. - Whole connections are solid and slices are dashed; remade stays dotted. The legend follows the new order.
- With several nodes selected, "Add children" opens the sample picker. The picked samples become children of one new shadow step made from all of the selected nodes (`of: [...]`, part `whole`); slices form one split. This replaces "Add step to each". - Cmd+drag (or Ctrl+drag) on the background draws the selection box, as Shift+drag does. - A merge refuses parents that are not in the design.
Columns now come only from the graph: one step per edge, half a step for a pool. A `round` label no longer moves a material to that round's column, so samples added to an empty canvas no longer form a staircase. Nodes with no parents and no children stack in the first column, in design order, below the connected trees.
The Design page now reads samples from the block's own table and keeps the design in the block data. - The block data gets an optional `design`: materials with their id, name (shadow nodes only) and how each was made. A sequenced material references a sample by its sample id. No new data version: the field is optional, so older packs keep it untouched. - Sample labels and metadata come live from the table and are never copied into the design. The sample panel shows them read-only. - A sample deleted from the table stays in the design as "Removed sample" in an error state. Duplicate or empty column labels get unique names. A stored design that cannot be drawn shows an alert with "Clear design". - The mock sample table and the example switcher are gone; the example designs remain as test fixtures. - Args, workflow and exports are unchanged. Undo stays local.
A shadow node with several parents is itself the merge, and a shadow node with one separation is itself the split, so the graph no longer adds a pool or a junction around it. Merging two nodes now adds one node, and adding children to several parents adds one node plus the children. The stored design is unchanged. - Only a whole merge without a step collapses; its parent edges are drawn as pooled edges. A slice or remade merge keeps its pool. - A shadow node with two or more separations keeps its junctions, so the separations stay apart. - Merge always stores a whole step. - A selected connection can be deleted, from the panel or with Delete; this drops one parent of a merge. - Selecting one edge into a merge no longer selects another, and "Add partition" shows only where it can act.
- The sidebar is uikit's PlSlideModal (non-modal), so its title, close button and spacing match the app. It starts below the canvas toolbar and pans the selection out from under it. - The sample list fills the panel and the Add button stays at the bottom. Rows show only the sample label, cut with an ellipsis; the full metadata is in a hover tooltip. - The filter picks a column, then its values; each filtered column shows as a chip. "Show in list" adds up to two columns as tags. - Escape in a sidebar field or dropdown no longer closes the sidebar. - No "shadow node" in the UI: the legend says "unsequenced", an unnamed one is "Unsequenced N", and the Start panel offers "Unsequenced start". - Panel titles name what is selected; Delete sits with the other actions.
- The block data holds a list of designs, each with an id, a label
and its materials, in place of the single unreleased `design`. It
stays an optional field on the current data version, so older packs
keep it untouched.
- The block sidebar lists the designs after a separator and ends
with "New Design", like the dataset entries.
- Each design has its own page: rename it in the title, delete it
with a confirmation. A new design starts empty, with a gray
placeholder name ("Design N").
- Designs are independent; a sample can be in several.
- "Insert step" on a multi-selection adds one unsequenced step between the nodes and their old parents, with no duplicate links. - "Connect to…" starts a pick mode: click or box-select children, then confirm. One unsequenced step joins all selected parents to all picked children; a single parent connects directly. Escape or Cancel ends the pick, and cycles are refused. - A port drag from a multi-selection does the same join. - Children left with one parent form one separation; a drop that changes nothing is refused.
…data into claude/design-graph-prototype-239b69 # Conflicts: # model/src/args.ts # pnpm-lock.yaml # pnpm-workspace.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A prototype of the experiment design editor in Samples & Data: a graph of how samples were made from each other (selection rounds, sorts, splits, merges). It is a draft to share the current state; it is not ready to merge.
What it does
designsfield on the current data version, so older block versions keep working with it.ui/src/design-graph/layout.ts): columns are step distances from the root, rows follow tree order, and edges are curves. No graph library is used.Not in this PR
ui/src/design-graph/and imports nothing from the rest of the block UI, so it can move to a shared package later.Open design questions