Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
b2cd1f4
feat(canvas): action registry with ⌘K palette, main menu and editor s…
kgoedecke Nov 8, 2026
4a66ddc
fix(canvas): address review on arrange, grouping, replace and find
kgoedecke Nov 8, 2026
bc2b821
fix(canvas): make paste to replace undo-safe and guard grouping again…
kgoedecke Nov 8, 2026
561aa33
fix(canvas): keep paste-to-replace undo retryable across several frames
kgoedecke Nov 8, 2026
7988f6a
Merge main into feat-cmd-k-action
kgoedecke Nov 8, 2026
8fd1f30
fix(canvas): keep outer margins, link images, match Unicode, drop sta…
kgoedecke Nov 8, 2026
188dbc9
fix(canvas): read Meta as the mod key off a Mac; link several images …
kgoedecke Nov 8, 2026
9fbe2c7
fix(canvas): never nest links when a picked parent and child are linked
kgoedecke Nov 8, 2026
a4f322d
fix(canvas): keep inner links' class, style and id when their box is …
kgoedecke Nov 8, 2026
1bccf9c
fix(canvas): keep SVG links as groups when their box is linked
kgoedecke Nov 8, 2026
d3d7396
fix(ui): draw shortcut symbols in Inter and even out menu separators
kgoedecke Nov 9, 2026
05aeb14
feat(desktop): build the macOS menu bar from the action registry
kgoedecke Nov 9, 2026
b496d2b
Merge remote-tracking branch 'origin/main' into kgoedecke/feat-cmd-k-…
kgoedecke Nov 9, 2026
502c006
fix(canvas): find a layer's parent on the tree, keep teammates' edits…
kgoedecke Nov 9, 2026
23f49d5
fix(canvas): group root layers against the body; keep failed replace …
kgoedecke Nov 9, 2026
57d73ef
fix(ui): inline the key-symbol font
kgoedecke Nov 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions .context/TECHSTACK.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ data-doop-webfonts>` for the roster families the frame names and does not load i
- View options (`src/lib/viewOptions.ts`, per browser under `doop:view-options`): the zoom pill's
menu opens on a field for a typed level (`150`, `150%`; `parseZoomPercent`) and switches the
pixel grid (⇧'), other people's cursors (⌘⌥\ / Ctrl+Alt+\) and the comment pins (⇧C), each read
by `code` (`viewOptionForKey`). Hidden pins still show under the Comment tool and for a thread
that is open. Tests: `viewOptions.test.ts`, `zoomMenu.test.tsx`.
by `code` (registry actions `pixel-grid`, `comments`, `cursors`). Hidden pins still show under
the Comment tool and for a thread that is open. Tests: `viewOptions.test.ts`, `zoomMenu.test.tsx`.
- Canvas panel layout (Settings → Appearance → Canvas panels, `src/lib/panelLayout.ts`, per
browser under `doop:panel-layout`): `floating` (the default) keeps the islands over a
full-window stage; `docked` makes Layers, the tool rail, the icon islands, the Inspector /
Expand Down Expand Up @@ -349,6 +349,36 @@ data-doop-webfonts>` for the roster families the frame names and does not load i
the brackets treat it as a frame, and ⌘A skips stack-locked shapes (`isStackLocked`). ↩ and Tab act only when no control has the keyboard (`isControlTarget`) and
something is selected, so buttons, menus and the Layers tree keep theirs. The bracket chords are
read by `code` too, since ⌥ changes the typed character on macOS. Tests: `selectionKeys.test.ts`.
- Canvas commands (`src/lib/actions/`): every editor command is one entry in `registry.ts` (id,
label key in the `actions` catalog, menu and section, chords, `edit`, `enabled`, `checked`,
`run`), and the keyboard (`dispatchActionKey`, called first by `CanvasPage`'s keydown), the ⌘K
palette (`CommandPalette.tsx`, cmdk through `ui/command.tsx`; text that names no command goes to
the agent's composer as a prompt), the main menu off the bar's Doop mark (`MainMenu.tsx`: File,
Edit, View, Object, Text, Arrange, Help) and the ⌃⇧? sheet (`ShortcutsSheet.tsx`) all read it.
`CanvasPage` lends the registry its modals and panels as the `ActionHost`. Chords (`chords.ts`)
are `mod` (⌘ on a Mac, Ctrl elsewhere), ⌥ chords by `code`, `macOnly` / `notMac` per platform (⌘Y
is outlines on a Mac, redo elsewhere), `global` for the two that act from fields (⌘K palette, ⌘/
agent; a bare `/` opens the agent outside fields). A chord whose command is disabled or finds
nothing falls through to the browser. ⌫, Esc, ↩/Tab and the arrows stay in `CanvasPage`'s own
handler (their rules are shown, `hintOnly`). What the commands do lives in `edits.ts`: align /
distribute / tidy / pack (`arrange.ts`, pure geometry) move frames as one undo step
(`patchFrames`) and layers through the runtime's `move` geometry edit; ⌘G / ⌥⌘G wrap sibling
layers in a `div` (carrying a flex parent's flow; grid children are refused; a frame edited while
its layout is read is left alone) and ⇧⌘G / ⌘⌫ unwrap (`groupElements` / `ungroupElements` in
`layers.ts`); ⇧A makes a box a flex container, or wraps the pick in one, turning the space between
the layers into `gap` and dropping their flow margins so nothing moves; ⌥⌘C / ⌥⌘V copy and paste
computed looks (`doop:computed`), text styles only between text layers; ⇧⌘V / ⇧⌘R paste over or
replace the selection from the canvas clip (a frame goes only once all its replacements land; one
undo step, a single `transfer` (`replaceFramesTracked`), so undo never removes a replacement
before its original is back; tests in `replaceFrames.test.ts`); ⇧⌘U links (`setElementLink`: an
image or SVG is wrapped in the link, other layers' content is); ⌃C is the EyeDropper. ⌘F / ⌥⌘F is
the find bar (`FindBar.tsx`, `findText.ts`: text nodes only, locked layers found but never
replaced, replace-all is one undo step across frames). View toggles: ⇧' / ⇧C / ⌥⌘\ switch the view
options (pixel grid, comment pins, cursors), ⌘Y outline mode (an adopted sheet in each frame's
runtime, never saved or exported), ⌥L collapses the Layers tree. N / ⇧N zoom to the next frame in
reading order, Home / End bring it into view, PgUp / PgDn change page. Tests:
`actionRegistry.test.ts` (no chord bound twice per platform, nor over a tool key),
`actionChords.test.ts`, `arrange.test.ts`, `groupLayers.test.ts`, `findText.test.ts`.
- `src/lib/tools.ts` defines bottom-toolbar tools and shortcuts. `Stage.tsx` delegates drawing
gestures and world-space previews to `CanvasDrawing.tsx`; Space/middle-button panning takes
precedence over drawing.
Expand Down
7 changes: 7 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"better-auth": "1.6.26",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"drizzle-orm": "^0.45.2",
"envalid": "8.2.0",
"express": "^4.19.2",
Expand Down
92 changes: 92 additions & 0 deletions src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { useMemo, useState } from 'react'
import { useT } from '../lib/i18n'
import { chordHint, firstChord } from '../lib/actions/chords'
import { ACTIONS, MENUS, isEnabled, runAction, type CanvasAction } from '../lib/actions/registry'
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandShortcut,
} from './ui/command'
import { CheckIcon, SparkIcon } from './ui/icons'
import { Modal } from './ui/modal'

/**
* ⌘K: every canvas command that can run right now, searchable by name and
* grouped by the menu it lives in, each with its chord. Text that names no
* command can go to the agent instead, as a prompt.
*/
export function CommandPalette({ onClose, onAsk }: { onClose: () => void; onAsk: ((prompt: string) => void) | null }) {
const t = useT()
const [query, setQuery] = useState('')
/* what can run is read once, as the palette opens: the selection does not change under it */
const [groups] = useState(() =>
MENUS.map((menu) => ({
menu,
actions: ACTIONS.filter((a) => a.menu === menu.id && a.id !== 'palette' && isEnabled(a)),
})).filter((g) => g.actions.length),
)
const ask = useMemo(() => (onAsk && query.trim() ? query.trim() : null), [onAsk, query])

function choose(action: CanvasAction) {
onClose()
/* after the modal lets go of focus, so a command that opens a field keeps it */
window.setTimeout(() => runAction(action), 0)
}

return (
<Modal size="lg" onClose={onClose} className="p-0 sm:p-0" aria-label={t('actions.palette')}>
<Command loop>
<CommandInput
autoFocus
value={query}
onValueChange={setQuery}
placeholder={t('actions.palettePlaceholder')}
aria-label={t('actions.palette')}
/>
<CommandList>
<CommandEmpty>{t('actions.paletteEmpty')}</CommandEmpty>
{groups.map(({ menu, actions }) => (
<CommandGroup key={menu.id} heading={t(menu.label)}>
{actions.map((action) => {
const chord = firstChord(action.keys)
const on = action.checked?.()
return (
<CommandItem
key={action.id}
value={`${t(action.label)} ${t(menu.label)} ${action.id}`}
onSelect={() => choose(action)}
>
<span className="flex size-3.5 flex-none items-center text-ink">
{on && <CheckIcon width={14} height={14} aria-hidden />}
</span>
<span className="min-w-0 flex-1 truncate">{t(action.label)}</span>
{chord && <CommandShortcut>{chordHint(chord)}</CommandShortcut>}
</CommandItem>
)
})}
</CommandGroup>
))}
{ask && onAsk && (
<CommandGroup heading={t('actions.askAgent')} forceMount>
<CommandItem
forceMount
value={`ask ${ask}`}
onSelect={() => {
onClose()
onAsk(ask)
}}
>
<SparkIcon width={14} height={14} aria-hidden className="flex-none text-brand" />
<span className="min-w-0 flex-1 truncate">{t('actions.paletteAsk', { query: ask })}</span>
</CommandItem>
</CommandGroup>
)}
</CommandList>
</Command>
</Modal>
)
}
Loading
Loading