Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
26 changes: 26 additions & 0 deletions .context/TECHSTACK.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,32 @@ 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` 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; ⇧⌘U links (`setElementLink`); ⌃C is
the EyeDropper. ⌘F / ⌥⌘F is the find bar (`FindBar.tsx`, `findText.ts`: text nodes only,
replace-all is one undo step across frames). View toggles live in the store: ⇧C hides comment
pins, ⌥⌘\ other people's 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
3 changes: 3 additions & 0 deletions src/components/CanvasComments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export function CanvasComments({
const canvasId = useStore((s) => s.canvas?.id)
const pageId = useStore((s) => (s.canvas ? (s.activePageId ?? canvasPages(s.canvas)[0]!.id) : null))
const all = useStore((s) => s.comments)
/* ⇧C hides the pins; an open thread stays */
const commentsHidden = useStore((s) => s.commentsHidden)
/* only thread roots get a pin; replies live inside the root's popover */
const roots = all.filter(
(c): c is CanvasComment => isCanvasComment(c) && c.pageId === pageId && !c.parentId && !c.resolvedAt,
Expand Down Expand Up @@ -126,6 +128,7 @@ export function CanvasComments({
const replies = all.filter((r) => r.parentId === c.id).sort((a, b) => a.at - b.at)
const thread: [ElementComment, ...ElementComment[]] = [c, ...replies]
const open = openThread === c.id
if (commentsHidden && !open) return null
return (
<CommentPin
key={c.id}
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>
)
}
3 changes: 3 additions & 0 deletions src/components/Cursors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export const Cursors = memo(function Cursors() {
const peerViewports = useStore((s) => s.peerViewports)
const activePageId = useStore((s) => s.activePageId)
const me = getIdentity().clientId
/* ⌥⌘\ hides everyone else's pointer */
const hidden = useStore((s) => s.cursorsHidden)
if (hidden) return null

return (
<>
Expand Down
Loading
Loading