Repository navigation
Add a quick-add bar: build graphs from plain sentences with / - #6
Merged
Merged
Conversation
Press / anywhere on the canvas: a small bar opens above the toast area. Type one plain sentence, press Enter, and it becomes a step — titled from the sentence (capitalized, truncated past 48 chars with the full text kept as the description), placed in free space, wired after the selected step, and selected — so Enter, sentence, Enter chains a whole workflow without touching the mouse. Esc closes; Shift+Enter makes a newline. The heavy lifting is one store action, quickAddStep(text, fallback): - With a workflow step selected it places the new step one column to the right (286px, the example graph's rhythm) and connects source-right → target-left. With nothing selected it lands at the fallback (the viewport center, provided by the caller). - Either way it bumps downward in 96px rows until the spot is free, so rapid-fire steps never stack on top of each other. - Node and wire land in a single commit — one undo step removes both. - The new step becomes the selection, which is what makes chaining work. The gesture is inspired by how the get-shit-done workflow tools accept a messy sentence and structure it for you, instead of asking the human to fill in a form first. Note: the two storage failure tests in store.test.ts fail on main before this change (see the separate fix PR); no new failures are introduced.
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.
What
Press
/anywhere on the canvas and a small bar opens. Type one plain sentence, press Enter, and it becomes a step:…and keeps the full text as the description),source-right → target-left),sentence ⏎ sentence ⏎ sentence ⏎sketches a whole workflow without touching the mouse. Esc closes, Shift+Enter inserts a newline, and the bar stays out of the way of toasts. The gesture follows the existing shortcut conventions (ignored while typing in inputs, registered in the sameonKeyhandler as ⌘N/⌘D/etc.).Design choices
quickAddStep(text, fallback)commits the node and its wire in a singlecommit, so one ⌘Z removes both — no half-added state.screenToFlowPosition), so the action is fully unit-testable.Tests
Note: the two storage-failure tests in
store.test.tsfail onmainbefore this branch — that's #3, independent of this change.