@dexhq/canvas 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/README.md +21 -18
- package/app/canvas/activity.tsx +8 -15
- package/app/canvas/anchoring.ts +3 -5
- package/app/canvas/canvas-input.ts +151 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +5 -42
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +7 -3
- package/app/canvas/canvas-ui.ts +2 -1
- package/app/canvas/canvas.css +61 -26
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +204 -82
- package/app/canvas/element-picker.ts +200 -27
- package/app/canvas/engine/canvas-gestures.ts +72 -17
- package/app/canvas/engine/canvas-store.ts +17 -1
- package/app/canvas/engine/engine.css +6 -3
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +18 -2
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-node.tsx +43 -26
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +27 -0
- package/app/canvas/live-page.ts +142 -19
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/section-node.tsx +2 -0
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/tool-cursors.ts +16 -16
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +34 -40
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/xray.ts +3 -12
- package/app/frame.tsx +5 -0
- package/app/i18n/locales/en/messages.po +114 -12
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +114 -12
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/{sets/lucide.tsx → glyphs.tsx} +7 -5
- package/app/icons/index.tsx +3 -3
- package/app/icons/types.ts +3 -10
- package/app/index.html +3 -3
- package/app/main.tsx +3 -0
- package/app/pages/canvas-settings.tsx +35 -0
- package/app/pages/canvas.tsx +27 -8
- package/app/pages/commands-settings.tsx +16 -2
- package/app/shell/about.tsx +5 -4
- package/app/shell/feedback-details.ts +0 -3
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/instructions-editor.tsx +1 -1
- package/app/shell/presence-style.ts +59 -0
- package/app/shell/presence.tsx +6 -3
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/shell/settings-sections.ts +12 -0
- package/app/shell/sidebar.tsx +1 -1
- package/app/studio-ui.d.ts +0 -9
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +1 -1
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/dist/cli/banner.d.mts +4 -2
- package/dist/cli/banner.mjs +34 -11
- package/dist/cli/commands/app.mjs +19 -11
- package/dist/cli/commands/create.d.mts +26 -14
- package/dist/cli/commands/create.mjs +13 -7
- package/dist/cli/commands/dev.mjs +2 -3
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/cli/commands/init.d.mts +11 -6
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +3 -3
- package/dist/cli/main.d.mts +22 -12
- package/dist/config/index.d.mts +6 -5
- package/dist/config/project-files.d.mts +6 -3
- package/dist/config/project-files.mjs +14 -5
- package/dist/config/renamed.d.mts +0 -2
- package/dist/config/renamed.mjs +1 -3
- package/dist/config/schema.d.mts +0 -5
- package/dist/config/schema.mjs +0 -5
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/content.d.mts +3 -141
- package/dist/content/content.mjs +7 -65
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/prototype-summary.d.mts +3 -39
- package/dist/content/prototype-summary.mjs +2 -3
- package/dist/content/prototypes.mjs +1 -1
- package/dist/content/snapshot-client.mjs +1 -1
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +309 -0
- package/dist/content/thread-module.mjs +1 -1
- package/dist/content/threads.mjs +1 -1
- package/dist/paths.d.mts +0 -2
- package/dist/paths.mjs +1 -3
- package/dist/server/agent-env.d.mts +5 -1
- package/dist/server/agent-env.mjs +7 -2
- package/dist/server/agent-session.d.mts +14 -1
- package/dist/server/agent-session.mjs +84 -19
- package/dist/server/brief.mjs +3 -3
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/channel.d.mts +19 -24
- package/dist/server/channel.mjs +70 -37
- package/dist/server/claimed-presence.d.mts +18 -0
- package/dist/server/claimed-presence.mjs +58 -0
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/comments/actions.d.mts +153 -0
- package/dist/server/comments/actions.mjs +154 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +88 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +36 -13
- package/dist/server/file-errors.d.mts +7 -2
- package/dist/server/file-errors.mjs +31 -8
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +7 -8
- package/dist/server/me.d.mts +1 -1
- package/dist/server/open-page.d.mts +22 -0
- package/dist/server/open-page.mjs +20 -2
- package/dist/server/outcome.d.mts +22 -0
- package/dist/server/outcome.mjs +8 -0
- package/dist/server/own-copies.mjs +2 -2
- package/dist/server/people.d.mts +1 -1
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +32 -47
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +18 -4
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.mjs +2 -2
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/reading.mjs +13 -4
- package/dist/server/tools/show.d.mts +1 -1
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/thread-list.mjs +1 -1
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.mjs +28 -31
- package/dist/server/web-app.mjs +7 -10
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.mjs +8 -14
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +118 -36
- package/dist/setup/design-system-checks.mjs +3 -12
- package/dist/setup/desktop-app-script.mjs +4 -3
- package/dist/setup/desktop-app-start.d.mts +8 -2
- package/dist/setup/desktop-app-start.mjs +64 -29
- package/dist/setup/desktop-app.d.mts +8 -0
- package/dist/setup/desktop-app.mjs +20 -4
- package/dist/setup/detect.d.mts +14 -7
- package/dist/setup/detect.mjs +56 -10
- package/dist/setup/doctor.mjs +2 -4
- package/dist/setup/existing-setup.d.mts +1 -3
- package/dist/setup/existing-setup.mjs +10 -11
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/own-app.d.mts +1 -2
- package/dist/setup/own-app.mjs +4 -5
- package/dist/setup/plan.d.mts +8 -6
- package/dist/setup/plan.mjs +64 -48
- package/dist/setup/project.d.mts +6 -17
- package/dist/setup/project.mjs +17 -61
- package/dist/setup/prompts.d.mts +5 -5
- package/dist/setup/prompts.mjs +28 -61
- package/dist/setup/questions.d.mts +12 -4
- package/dist/setup/questions.mjs +10 -25
- package/dist/setup/starters.d.mts +2 -0
- package/dist/setup/starters.mjs +26 -9
- package/dist/setup/workspace-setup.d.mts +1 -2
- package/dist/setup/workspace-setup.mjs +4 -6
- package/dist/setup/write.d.mts +15 -5
- package/dist/setup/write.mjs +35 -9
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.mjs +1 -1
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +53 -0
- package/dist/shared/comments/routes.mjs +37 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/presence-core.d.mts +11 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +7 -1
- package/dist/shared/signup.d.mts +2 -5
- package/dist/shared/signup.mjs +2 -35
- package/dist/shared/studio-events.d.mts +0 -6
- package/dist/shared/studio-events.mjs +1 -5
- package/dist/shared/studio-files.d.mts +12 -0
- package/dist/shared/studio-files.mjs +6 -1
- package/dist/shared/studio-routes.d.mts +16 -62
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +2 -2
- package/dist/shared/threads-core.mjs +1 -1
- package/extension/dist/feedback.js +148 -138
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +146 -136
- package/package.json +3 -20
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +17 -9
- package/src/cli/commands/dev.ts +0 -3
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/help.ts +3 -3
- package/src/config/index.ts +6 -5
- package/src/config/project-files.ts +21 -11
- package/src/config/renamed.ts +0 -3
- package/src/config/schema.ts +0 -1
- package/src/content/capture.ts +6 -12
- package/src/content/content.ts +7 -244
- package/src/content/flow-specs.ts +2 -1
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/snapshot-client.ts +1 -1
- package/src/content/text-replace.ts +449 -0
- package/src/paths.ts +0 -8
- package/src/server/agent-env.ts +12 -2
- package/src/server/agent-session.ts +124 -34
- package/src/server/brief.ts +8 -3
- package/src/server/channel.ts +121 -52
- package/src/server/claimed-presence.ts +93 -0
- package/src/server/comments/actions.ts +352 -0
- package/src/server/comments/routes.ts +176 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +49 -15
- package/src/server/file-errors.ts +47 -13
- package/src/server/file-lock.ts +205 -54
- package/src/server/mcp.ts +13 -14
- package/src/server/me.ts +2 -5
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +2 -1
- package/src/server/port.ts +94 -20
- package/src/server/presence.ts +11 -3
- package/src/server/requests.ts +60 -70
- package/src/server/studio-for.ts +27 -3
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/watch.ts +7 -7
- package/src/server/vite.ts +37 -40
- package/src/server/web-app.ts +14 -12
- package/src/setup/apply.ts +10 -16
- package/src/setup/create.ts +143 -37
- package/src/setup/design-system-checks.ts +7 -15
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +24 -3
- package/src/setup/detect.ts +56 -14
- package/src/setup/doctor.ts +4 -4
- package/src/setup/existing-setup.ts +10 -12
- package/src/setup/own-app.ts +2 -5
- package/src/setup/plan.ts +93 -84
- package/src/setup/project.ts +25 -118
- package/src/setup/prompts.ts +44 -127
- package/src/setup/questions.ts +27 -29
- package/src/setup/starters.ts +35 -10
- package/src/setup/workspace-setup.ts +8 -18
- package/src/setup/write.ts +52 -9
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +79 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/page-review.ts +11 -16
- package/src/shared/presence-core.ts +16 -2
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +11 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +14 -0
- package/src/shared/studio-routes.ts +21 -64
- package/src/shared/threads-core.ts +2 -2
- package/templates/methods/review.md +2 -2
- package/templates/rules/canvas-frames.md +104 -0
- package/templates/rules/canvas.md +8 -142
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/snapshots.md +52 -0
- package/templates/starters/standalone/README.md +7 -7
- package/templates/starters/standalone/components.json +1 -1
- package/templates/starters/standalone/package.json +1 -2
- package/templates/starters/turborepo/README.md +6 -6
- package/templates/starters/turborepo/apps/web/components.json +1 -1
- package/templates/starters/turborepo/apps/web/package.json +1 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
- package/templates/starters/turborepo/packages/ui/components.json +1 -1
- package/templates/starters/turborepo/packages/ui/package.json +1 -2
- package/templates/starters/vite/README.md +7 -6
- package/templates/starters/vite/components.json +1 -1
- package/templates/starters/vite/package.json +1 -2
- package/templates/starters/vite/src/app.tsx +3 -4
- package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
- package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
- package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
- package/templates/starters/vite/src/components/ui/button.tsx +17 -12
- package/templates/starters/vite/src/components/ui/card.tsx +1 -1
- package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
- package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
- package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
- package/templates/starters/vite/src/components/ui/field.tsx +3 -1
- package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
- package/templates/starters/vite/src/components/ui/input.tsx +1 -1
- package/templates/starters/vite/src/components/ui/label.tsx +2 -0
- package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
- package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
- package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
- package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
- package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
- package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
- package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
- package/templates/starters/vite/src/index.css +533 -111
- package/app/icons/sets/hugeicons.tsx +0 -259
- package/app/icons/sets/phosphor.tsx +0 -251
- package/dist/server/icon-set.d.mts +0 -15
- package/dist/server/icon-set.mjs +0 -31
- package/dist/server/tools/close-reply.d.mts +0 -6
- package/dist/server/tools/close-reply.mjs +0 -138
- package/dist/server/tools/comment.d.mts +0 -6
- package/dist/server/tools/comment.mjs +0 -49
- package/dist/shared/icon-sets.d.mts +0 -9
- package/dist/shared/icon-sets.mjs +0 -21
- package/src/server/icon-set.ts +0 -56
- package/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
- package/src/shared/icon-sets.ts +0 -23
- /package/app/public/{sudio-192.png → dex-192.png} +0 -0
- /package/app/public/{sudio-512.png → dex-512.png} +0 -0
- /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
- /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
- /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
- /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @dexhq/canvas
|
|
2
2
|
|
|
3
|
+
## 0.15.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7e4d6e8: ⌘F finds words on every frame of the canvas: each match painted yellow on its page, the canvas moving to the current one, the count, steps either way and a list of matches by frame. Replace all changes the words where they are written as text in your own files, with Undo.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- ea8099e: Opening an agent from the canvas works when the login shell doesn't put Node on its PATH (nvm loaded only in some shells): the terminal Dex opens puts the Node running Dex first on it.
|
|
12
|
+
- 589f164: The Mac app made by a Dex that moved off a taken port now opens the port that Dex moved to, so it starts, and `dex app install` says which address the app opens. Opened from its start link, the app no longer starts a second `dex dev`. When something else holds the app's port, the app says what (another checkout's Dex, or the process), where this project's Dex runs if it runs elsewhere, and only suggests fixes the app can use.
|
|
13
|
+
- 3eaf154: A field in an input group shows its focus once, around the group: the canvas's comment search no longer draws a second outline through its search icon.
|
|
14
|
+
- 9ac6654: In Safari and the Dex app, the canvas's keys work again once you leave a live frame with Escape, or outline an element in one with the comment tool. Before, the frame's page kept the keyboard, so H, ⇧C and the other hotkeys did nothing; only C, V, Escape and the zoom keys reached the canvas.
|
|
15
|
+
- 6d1cb80: In Safari and the Mac app, the canvas stays sharp zoomed in with a frame selected or the pointer over it: the size label has no backdrop blur, and what fades or grows in on the canvas no longer makes WebKit draw the whole canvas at the screen's scale and stretch it.
|
|
16
|
+
- 2adbb05: The green tick where an agent's change landed now hides with the comment pins (⇧C), and shows only where its comment's pin would, so a Comments filter that leaves out resolved comments leaves out ticks too. A Done comment opened while comments are hidden shows its tick with its pin.
|
|
17
|
+
- b6582b4: Comments from people and agents now go through one set of actions, and request bodies are checked: a comment request with a field of the wrong type is refused, naming the field.
|
|
18
|
+
- 3e7bd3b: A comment opened from the agent heads-up now opens, one an agent completed too: the canvas moves to it, and its card appears at its pin, or by its frame when its element is gone, not at the top right. ⇧C hides comment pins on the canvas only: the Comments list still shows every comment, and one opened from it shows with its pin.
|
|
19
|
+
- 44c259f: Escape that closes a dialog on a live frame's page stays with the page, whatever design system made the dialog: the frame stays live and keeps showing Reset, where before it left the frame too, and a `<dialog>` opened with `showModal()` closes on Escape again.
|
|
20
|
+
- 087af74: A file dropped on the feedback form attaches wherever it lands: on its edge too, and in Safari and the Dex app when let go just as the pointer moves onto another part of the form, where it used to open in place of the page (or in Preview, from the app); dragging one over the form shows a copy, not a move.
|
|
21
|
+
- 087af74: A file dropped anywhere on Import reviews, or on the canvas just as the pointer reaches it, is taken in Safari and the Dex app too, and one dropped where nothing takes it (the toolbar, a dialog's backdrop, a live frame, Markup's panel) is refused instead of opening in place of the page.
|
|
22
|
+
- ca91b55: Remove canvas model code nothing called: moving a section, updating several frames at once, the off-canvas test and the panel feature list.
|
|
23
|
+
- 54dc82e: Code that was in two places is in one: the canvas's types, sending to the feedback relay, the update after Sync, a review's header and a suggestion's buttons. Nothing Dex or Markup does changes.
|
|
24
|
+
- 2863775: Remove CLI and server code nothing called, and stop shipping the interface's import check, which only a test ran.
|
|
25
|
+
- 41dffdd: An imported review stays on Comments' Reviews page once its comments are closed: resolved, Done and Not done comments show there, dimmed, and keep their pins, as the team's do. Hide resolved still hides them.
|
|
26
|
+
- 29c4136: Two Dex processes on one machine no longer end up holding one lock at once (the repository's turn, the install lock, comments, canvases, presence). A Dex that comes back late, after its lock was taken over, leaves the next holder's lock alone, and a takeover left halfway by a process that stopped no longer lets two waiters in.
|
|
27
|
+
- 339e54c: A comment's pin stays on its element when the element's words change, as when an agent rewrites a heading a comment is on, and when the words change before the comment is posted; it used to disappear while the comment stayed in the agent's threads. A comment whose row moves in a list, or whose element gets new markup around it, follows its words there. A plain element (no ARIA states, no design-system component) that another takes the place of keeps the pin there.
|
|
28
|
+
- e360183: In Chrome, zoomed out where frames show their pictures, a frame's comment pins and the ticks where an agent's changes landed stay on its picture, as in Safari and the Dex app, instead of going a moment later. So a comment opened from the heads-up on a tall frame opens beside its pin, not at the frame's corner.
|
|
29
|
+
- c1cdf84: `dex dev` no longer takes a port that another checkout's Dex, or another process, already holds on the other address family (IPv4 or IPv6) or on every address, where a browser on `localhost` could reach it instead. It counts that port as taken: it moves to the next free one, or, when `STUDIO_PORT` asks for that port, says what holds it.
|
|
30
|
+
- f8c405c: An agent stops showing at work on the canvas once its work ends, however it ends: a comment closed, answered or let go, back to `watch` with nothing in hand, or its session ended or killed. Claude Code's edit marks now go with it, not two minutes later. `where` says who the canvas shows at work on the open file, and until when.
|
|
31
|
+
- d21b6aa: Importing a review no longer reloads the page when its snapshots are written where earlier ones were deleted, so the Comments panel stays open on Reviews with the review listed. Their frames update in place.
|
|
32
|
+
- bf9b26c: Zoomed out so far that a section's name would reach into the section above (below about 7% with the browser's usual font size, as fitting a canvas of many stacked sections does), section names hide, as frame names already do further in. A press there reaches what is drawn, and dragging a section by its name no longer resizes a frame in the section above. A section drawn that far out still asks for its name.
|
|
33
|
+
- 3b50db2: Canvas: a section dragged while you zoom keeps its frames with it, even as their pages load and grow.
|
|
34
|
+
- ea8099e: `dex create` in a folder with files but no package.json (an agent's `work/` and `outputs/`) starts the new project beside them instead of stopping, and a new project connects the agent running setup instead of always Claude Code.
|
|
35
|
+
- 0e503a9: Run again under Bun, setup no longer takes a studio in Bun's global cache for one the project has installed, so it still runs the install the project needs.
|
|
36
|
+
- 029ae68: A thumbnail no longer shows the scrollbar of a scrolling area inside its frame, such as an app's main pane, where the system always shows scrollbars; a frame in use still scrolls as before.
|
|
37
|
+
- 65a5fbc: Canvas: in Safari and the Dex app, a pinch over a frame in use zooms as smoothly and as far as one over the empty canvas, and a pinch never jumps as it starts.
|
|
38
|
+
|
|
39
|
+
## 0.14.0
|
|
40
|
+
|
|
41
|
+
### Minor Changes
|
|
42
|
+
|
|
43
|
+
- 66fc3c9: `dex create --preset <code> --base <library>` sets shadcn up with the look and library you chose, setup connects the agent that runs it, and pnpm 11 projects install without stopping on esbuild's build script. A view with an import that doesn't resolve no longer reloads in a loop, and app components beside the design system's are styled in views.
|
|
44
|
+
- 25da0f8: A new project from `dex create` starts with the look of Dex's own interface: round controls, a visible focus outline, Inter and Lucide icons, in place of shadcn's Vega with Hugeicons. Setup adds a `dex` script, so Dex starts with `npm run dex`; a project set up before keeps its `studio` script.
|
|
45
|
+
- 2a55803: Dex's interface keeps its own look: it always draws with Lucide (`ui.icons` and `--icons` are gone; `create` takes `ui.icons` out of an older config), and `create` no longer builds the interface from your shadcn components unless you pass `--primitives`. The `/` menu's long descriptions no longer overlap the next command.
|
|
46
|
+
- 7f7c467: Every agent shows at work on the canvas again, not only Claude Code with its hook: an agent that edits a view it holds a comment on is shown there. Settings → Canvas chooses how agents at work show: in blocks, as an edge only, or not at all.
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- edc2fcf: The studio loads again: About no longer reads a homepage the package doesn't have, and links to Dex on npm. Publishing now type-checks the interface too.
|
|
51
|
+
- dd3d324: The tab, home-screen and installed-app icons have new file names (`dex-icon.svg`, `dex-192.png` and the rest), so browsers and installed apps that cached the old icons fetch the Dex mark. The "Dex isn't running" page now shows it in its tab too.
|
|
52
|
+
- 199979a: Canvas: a step's Play stays on its label while its page is used live or resized, and Reset and Pick no longer shift it as they come and change
|
|
53
|
+
- 64bc15b: Agents read less to work on a canvas: `rules/canvas.md` keeps the grid, frames and ownership, and snapshots (`rules/snapshots.md`) and specs, slides, devices, wireframes and Play (`rules/canvas-frames.md`) are read only when the work is about them. The brief names Dex's rules folder once instead of on every entry.
|
|
54
|
+
- d304a48: Canvas tool cursors are back to the system's size: 16 px with 1 px lines, where the comment pin and Select's arrow stood well above the system pointer.
|
|
55
|
+
|
|
3
56
|
## 0.13.0
|
|
4
57
|
|
|
5
58
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -125,11 +125,13 @@ npm create dex@latest
|
|
|
125
125
|
|
|
126
126
|
`pnpm create dex`, `yarn create dex` and `bun create dex` work too;
|
|
127
127
|
with npm, flags go after `--` (`npm create dex@latest -- --yes`). It runs
|
|
128
|
-
`dex create` from `@dexhq/canvas`, which
|
|
129
|
-
directly
|
|
128
|
+
`dex create` from `@dexhq/canvas`, which
|
|
129
|
+
`npx --package=@dexhq/canvas dex create` runs directly (the package has two
|
|
130
|
+
commands, so npx needs the one to run).
|
|
130
131
|
|
|
131
132
|
Run it where the project's `package.json` is, or anywhere in a workspace
|
|
132
|
-
(monorepo). In
|
|
133
|
+
(monorepo). In a folder with no `package.json` (empty, or holding only
|
|
134
|
+
notes or an agent's `work/` and `outputs/`) it starts a new project from the shadcn
|
|
133
135
|
starter instead (Vite, React and shadcn on Base UI, with every component the
|
|
134
136
|
studio's own interface uses), then sets the studio up in it the same way. It
|
|
135
137
|
says what it does at each step:
|
|
@@ -177,11 +179,12 @@ it plans only what differs from what this version writes, as `storybook
|
|
|
177
179
|
automigrate` does. The choices come from `dex.config.ts` first, then flags,
|
|
178
180
|
then what it finds. Facts the project's files say are dropped from
|
|
179
181
|
`designSystem`, only where the design system resolves the same without them;
|
|
180
|
-
`
|
|
181
|
-
copies the project's paths extends its tsconfig
|
|
182
|
-
config or the install an earlier run left out is
|
|
183
|
-
range too old for what it writes is raised. The
|
|
184
|
-
comments and formatting. What an older setup
|
|
182
|
+
`plugins: [next()]` is added and `ui.icons`, no longer read, taken out; a
|
|
183
|
+
studio `tsconfig.json` that copies the project's paths extends its tsconfig
|
|
184
|
+
instead; a file, an agent's config or the install an earlier run left out is
|
|
185
|
+
made; and a `@dexhq/canvas` range too old for what it writes is raised. The
|
|
186
|
+
config keeps its other keys, comments and formatting. What an older setup
|
|
187
|
+
added to the project's own files
|
|
185
188
|
(`.gitignore` lines, the `studio:build` and `studio:claude` scripts) stays,
|
|
186
189
|
and the plan says so in a `note`; `DESIGN.md`, `provider.tsx`,
|
|
187
190
|
`contributors.json` and files are never touched. It asks "Go ahead?" once;
|
|
@@ -275,10 +278,10 @@ Every question has a flag, so agents and CI can run it without a terminal:
|
|
|
275
278
|
| `[folder]` | Where: the project, or a new one (default: here) |
|
|
276
279
|
| `--app <name>` \| `--in <package>` | In a workspace: its own app, `apps/<name>`, or inside a package |
|
|
277
280
|
| `--components <folder>` \| `none`, `--shadcn` | The components; `--shadcn` sets up shadcn first |
|
|
281
|
+
| `--preset <code>`, `--base base` \| `radix` \| `aria` | How `shadcn init` sets it up: a preset's name or the code [ui.shadcn.com/create](https://ui.shadcn.com/create) gives, and the component library. Either one implies `--shadcn` |
|
|
278
282
|
| `--import <specifier>` | How prototypes import them, when it cannot tell |
|
|
279
283
|
| `--styles <file>` \| `none` | The global stylesheet |
|
|
280
|
-
| `--primitives
|
|
281
|
-
| `--icons lucide\|phosphor\|hugeicons` | The icon set the interface draws with (`ui.icons`, always written). Default: `components.json`'s `iconLibrary`, else the set in your dependencies, else Lucide. Lucide comes with Dex; Phosphor and Hugeicons are optional peers, which setup installs when the project lacks them |
|
|
284
|
+
| `--primitives` | The studio's own interface from your components, when they are shadcn on Base UI (`ui.primitives`). Off by default: the interface keeps Dex's own look. |
|
|
282
285
|
| `--provider <module>` \| `none` | What wraps every view (`designSystem.provider`): your own module, or none. Default: for Mantine, Chakra UI (its version decides which provider) or Radix Themes, a `provider.tsx` it writes in the studio's folder; otherwise none |
|
|
283
286
|
| `--design-md draft` \| `none` \| `<path>` \| `<url>` | How `DESIGN.md` starts: a draft (default), empty, a file in the repository linked as the design system's guide, or a file or URL copied in |
|
|
284
287
|
| `--agent <ids>` \| `none` | The agents: `claude,codex,cursor,copilot,opencode` |
|
|
@@ -305,7 +308,7 @@ exports, components that aren't React, a Tailwind 3 config.
|
|
|
305
308
|
```json
|
|
306
309
|
{"step":"detect","key":"components","value":{"folder":"src/components/ui","import":"@/components/ui","count":12},"evidence":"components.json → aliases.ui","confidence":"certain"}
|
|
307
310
|
{"step":"decide","key":"components","value":{"folder":"src/components/ui","import":"@/components/ui"},"source":"components.json → aliases.ui","flag":"--components"}
|
|
308
|
-
{"step":"question","key":"
|
|
311
|
+
{"step":"question","key":"styles","question":"Which stylesheet holds the design system's tokens, fonts and Tailwind?","choices":[{"value":"src/index.css","label":"src/index.css","flags":["--styles","src/index.css"]},{"value":"none","label":"None","flags":["--styles","none"]}],"default":"src/index.css","flag":"--styles"}
|
|
309
312
|
{"step":"hint","key":"provider","message":"@primer/react exports BaseStyles and ThemeProvider: if its components need them, wrap every view in them with a provider module (designSystem.provider).","evidence":"node_modules/@primer/react/lib/index.d.ts"}
|
|
310
313
|
{"step":"plan","action":"create","path":"dex.config.ts","detail":"design system acme, scanned from src/components/ui"}
|
|
311
314
|
{"step":"write","action":"create","path":"dex.config.ts"}
|
|
@@ -316,9 +319,9 @@ exports, components that aren't React, a Tailwind 3 config.
|
|
|
316
319
|
|
|
317
320
|
| `step` | Fields |
|
|
318
321
|
| --- | --- |
|
|
319
|
-
| `detect` | `key` (`studio` where one is set up: `{config, content}`; `workspace`, `components`, `styles`, `primitives`, `
|
|
322
|
+
| `detect` | `key` (`studio` where one is set up: `{config, content}`; `workspace`, `components`, `styles`, `primitives`, `designMd`, `agents`, `packageManager`, and `provider` when the design system needs one: `{library, component}`), `value`, `evidence`, `confidence` (`certain`, `likely`, `guess`) |
|
|
320
323
|
| `decide` | `key` (those, `dir`, and `placement` in a workspace: `{kind, folder, name}` or `{kind, folder, package}`), `value`, `source` (the flag, or the evidence), `flag`, `warning` for a guess. `designMd`'s value is `{kind: "draft", summary}` (counts of colours, typography, radii, spacing and components, the sections and the stylesheets), `{kind: "link", file}`, `{kind: "import", from, lines, problem}` or `{kind: "none"}`. `provider` (when the design system needs one, or `--provider` names one) is `{kind: "write", file, component}`, `{kind: "module", module}` or `"none"` |
|
|
321
|
-
| `question` | A decision it took without being sure: `key` (`components`, `styles`, `
|
|
324
|
+
| `question` | A decision it took without being sure: `key` (`components`, `styles`, `designMd`, `packageManager` or `placement`), `question` (one sentence), `choices` (what it found, plus `none` where that is an answer: each `{value, label, evidence, flags}`, `flags` the exact arguments that answer with it), `default` (the `value` it takes; left out when no choice is safe, and then a run that writes stops with code 2), `flag` |
|
|
322
325
|
| `hint` | For the agent's part, changing nothing setup does: `key` (`provider`: a provider or theme the design system exports; `framework`: components that are Svelte, Vue, Lit or Astro; `tailwind`: a Tailwind 3 config views get; `next`: `next()` written), `message`, `evidence` |
|
|
323
326
|
| `plan` | `action` (`create`, `edit`, `run`, `ask`, or `note` for what it leaves in your own files), `path` or `command`, `detail`: on a set-up studio, only what differs |
|
|
324
327
|
| `write` | `action`, `path` |
|
|
@@ -490,11 +493,11 @@ run again:
|
|
|
490
493
|
shadcn on Base UI (Vega style, Hugeicons), and its theme is plain shadcn
|
|
491
494
|
neutral with Inter: the studio's own look, never the design system's.
|
|
492
495
|
`node scripts/interface-components.mjs` brings them back to stock. A
|
|
493
|
-
project's own Base UI components replace them with `ui.primitives
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
496
|
+
project's own Base UI components replace them with `ui.primitives`, set
|
|
497
|
+
by hand or with `create --primitives`: off by default, so the interface
|
|
498
|
+
looks like Dex.
|
|
499
|
+
- Icons (`app/icons`): Lucide, by name, in `glyphs.tsx`; the interface
|
|
500
|
+
draws every icon through `<Icon>`. To add one, add it to `glyphs.tsx`.
|
|
498
501
|
- Languages (`app/i18n`): Lingui. Write interface text with its macros
|
|
499
502
|
(`<Trans>`, t`…`, msg`…`), then `npm run i18n --workspace dex`
|
|
500
503
|
to extract and compile the catalogs in `app/i18n/locales` (committed).
|
package/app/canvas/activity.tsx
CHANGED
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
Matrix,
|
|
43
43
|
} from "./activity-parts";
|
|
44
44
|
import { commentWords } from "./agent-changes";
|
|
45
|
-
import type { ScreenPoint } from "./canvas-context";
|
|
46
45
|
import { DoneTick } from "./change-notice";
|
|
47
46
|
import { DOCKS_CHANGED } from "./toolbar-parts";
|
|
48
47
|
import { type ActivityState, useActivity } from "./use-activity";
|
|
@@ -416,7 +415,7 @@ const ItemRow = ({
|
|
|
416
415
|
onOpen,
|
|
417
416
|
}: {
|
|
418
417
|
item: ActivityItem;
|
|
419
|
-
onOpen: (thread: Thread
|
|
418
|
+
onOpen: (thread: Thread) => void;
|
|
420
419
|
}) => {
|
|
421
420
|
const { t } = useLingui();
|
|
422
421
|
const words: Record<ActivityItem["status"], string> = {
|
|
@@ -447,7 +446,7 @@ const ItemRow = ({
|
|
|
447
446
|
<span className="font-medium">{words[item.status]}</span>{" "}
|
|
448
447
|
<button
|
|
449
448
|
className="text-muted-foreground underline decoration-foreground/25 underline-offset-[3px] outline-none hover:text-foreground hover:decoration-foreground focus-visible:text-foreground"
|
|
450
|
-
onClick={(
|
|
449
|
+
onClick={() => onOpen(item.thread)}
|
|
451
450
|
type="button"
|
|
452
451
|
>
|
|
453
452
|
{commentWords(item.thread)}
|
|
@@ -487,7 +486,7 @@ const Log = ({
|
|
|
487
486
|
items: ActivityItem[];
|
|
488
487
|
/** The comment the bar speaks of, kept in the log however old. */
|
|
489
488
|
news?: Thread;
|
|
490
|
-
onOpen: (thread: Thread
|
|
489
|
+
onOpen: (thread: Thread) => void;
|
|
491
490
|
}) => {
|
|
492
491
|
const ref = useRef<HTMLDivElement>(null);
|
|
493
492
|
// At the newest end, a new comment keeps it there; scrolled away to read
|
|
@@ -680,7 +679,7 @@ const PanelContent = ({
|
|
|
680
679
|
activity: ActivityState;
|
|
681
680
|
kind: PanelKind;
|
|
682
681
|
onFullSetup: () => void;
|
|
683
|
-
onOpen: (thread: Thread
|
|
682
|
+
onOpen: (thread: Thread) => void;
|
|
684
683
|
opensUp: boolean;
|
|
685
684
|
}) => {
|
|
686
685
|
const { t } = useLingui();
|
|
@@ -810,13 +809,14 @@ const PANEL_FOR: Partial<Record<BarAction, PanelKind>> = {
|
|
|
810
809
|
* The agent heads-up, docked in a corner of the canvas: a leaf that reads
|
|
811
810
|
* the live data itself, so the canvas rendering never renders it, nor it the
|
|
812
811
|
* canvas. `slug` is the file whose comments its log lists; `openThread`
|
|
813
|
-
*
|
|
812
|
+
* moves the canvas to one and opens it at its pin (one an agent completed
|
|
813
|
+
* also outlines where its change landed), and stays the same function.
|
|
814
814
|
*/
|
|
815
815
|
export const Activity = memo(function Activity({
|
|
816
816
|
openThread,
|
|
817
817
|
slug,
|
|
818
818
|
}: {
|
|
819
|
-
openThread: (id: string
|
|
819
|
+
openThread: (id: string) => void;
|
|
820
820
|
slug: string;
|
|
821
821
|
}) {
|
|
822
822
|
const [connecting, setConnecting] = useState(false);
|
|
@@ -857,14 +857,7 @@ export const Activity = memo(function Activity({
|
|
|
857
857
|
setPanel(PANEL_FOR[action]);
|
|
858
858
|
};
|
|
859
859
|
|
|
860
|
-
const openItem = (thread: Thread
|
|
861
|
-
if (thread.status === "resolved") {
|
|
862
|
-
activity.goToChange(thread);
|
|
863
|
-
return;
|
|
864
|
-
}
|
|
865
|
-
const box = at.getBoundingClientRect();
|
|
866
|
-
openThread(thread.id, { left: box.left, top: box.top });
|
|
867
|
-
};
|
|
860
|
+
const openItem = (thread: Thread) => openThread(thread.id);
|
|
868
861
|
|
|
869
862
|
const shown = panel ? (
|
|
870
863
|
<PanelContent
|
package/app/canvas/anchoring.ts
CHANGED
|
@@ -41,7 +41,8 @@ export interface Point {
|
|
|
41
41
|
|
|
42
42
|
type Frames = ReadonlyMap<string, Frame>;
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
/** Whether a comment is on a frame: on one of its elements, or all of it. */
|
|
45
|
+
export const isOnFrame = (target: ThreadTarget): target is OnFrameTarget =>
|
|
45
46
|
target.kind === "element" || target.kind === "frame";
|
|
46
47
|
|
|
47
48
|
const sameParams = (
|
|
@@ -171,10 +172,6 @@ const indexOf = (threads: readonly Thread[], canvas: Canvas): Index => {
|
|
|
171
172
|
export const frameOf = (thread: Thread, canvas: Canvas) =>
|
|
172
173
|
anchorIn(framesOf(canvas), thread);
|
|
173
174
|
|
|
174
|
-
/** A comment on a frame that is no longer on the canvas. */
|
|
175
|
-
export const isOffCanvas = (thread: Thread, canvas: Canvas) =>
|
|
176
|
-
isOnFrame(thread.target) && frameOf(thread, canvas) === undefined;
|
|
177
|
-
|
|
178
175
|
/** The threads on one frame, wherever it has moved. */
|
|
179
176
|
export const threadsOn = (
|
|
180
177
|
threads: readonly Thread[],
|
|
@@ -258,6 +255,7 @@ export const locatorsOf = (target: ThreadTarget): ElementLocator[] =>
|
|
|
258
255
|
text: target.text,
|
|
259
256
|
code: target.code,
|
|
260
257
|
within: target.within,
|
|
258
|
+
openers: target.openers,
|
|
261
259
|
},
|
|
262
260
|
...(target.also ?? []),
|
|
263
261
|
...(target.openers ?? []),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { toolFromFrame, zoomCommand } from "./canvas-keys.ts";
|
|
1
|
+
import { isFindKey, toolFromFrame, zoomCommand } from "./canvas-keys.ts";
|
|
2
2
|
import { zoomsCanvas } from "./engine/camera.ts";
|
|
3
|
+
import { KEEPS_POINTER, MOVING } from "./engine/canvas-store.ts";
|
|
3
4
|
import { isTyping, pressesControl } from "./typing.ts";
|
|
4
5
|
|
|
5
6
|
// Wheels, pinches and zoom keys that are the canvas's wherever they happen,
|
|
@@ -23,7 +24,10 @@ import { isTyping, pressesControl } from "./typing.ts";
|
|
|
23
24
|
// every live page on it ask, keeps the canvas or the page it started on
|
|
24
25
|
// moving to its end, and nothing else.
|
|
25
26
|
|
|
26
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Wheel events, or the steps of a pinch, this close together are one
|
|
29
|
+
* gesture, and go one way.
|
|
30
|
+
*/
|
|
27
31
|
const GESTURE_GAP_MS = 200;
|
|
28
32
|
/** The canvas zooms by 2^(-deltaY / 50) for a pinch on a Mac (camera.ts). */
|
|
29
33
|
const PINCH_DELTA_PER_DOUBLING = 50;
|
|
@@ -181,14 +185,18 @@ const gestureOn = (element: Element) =>
|
|
|
181
185
|
/** Wheels a frame's page passed on: the gesture sent them to the canvas. */
|
|
182
186
|
const passedOn = new WeakSet<Event>();
|
|
183
187
|
|
|
184
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* Turns Safari's pinch into the ctrl-wheel the canvas zooms by. WebKit keeps
|
|
190
|
+
* a scale per page and can start a pinch where an earlier one on that page
|
|
191
|
+
* left off, so each step zooms by its change from the scale before it.
|
|
192
|
+
*/
|
|
185
193
|
const pinchAsWheel = (onWheel: (wheel: WheelEventInit) => void) => {
|
|
186
194
|
let scale = 1;
|
|
187
195
|
return (event: Event) => {
|
|
188
196
|
const gesture = event as GestureEvent;
|
|
189
197
|
event.preventDefault();
|
|
190
198
|
if (event.type === "gesturestart") {
|
|
191
|
-
scale = 1;
|
|
199
|
+
scale = gesture.scale || 1;
|
|
192
200
|
return;
|
|
193
201
|
}
|
|
194
202
|
const ratio = gesture.scale / scale;
|
|
@@ -206,13 +214,54 @@ const GESTURES = ["gesturestart", "gesturechange"] as const;
|
|
|
206
214
|
|
|
207
215
|
/**
|
|
208
216
|
* The keys a frame's page passes on and takes from the page: the zoom keys,
|
|
209
|
-
* and Escape to leave the frame. The page uses them first: an Escape that
|
|
210
|
-
* closes a menu there, or ends typing an accent, stays.
|
|
217
|
+
* ⌘F, and Escape to leave the frame. The page uses them first: an Escape that
|
|
218
|
+
* closes a dialog or menu there, or ends typing an accent, stays.
|
|
211
219
|
*/
|
|
212
220
|
const isCanvasKey = (event: KeyboardEvent) =>
|
|
213
221
|
zoomCommand(event) !== undefined ||
|
|
222
|
+
isFindKey(event) ||
|
|
214
223
|
(event.key === "Escape" && !event.isComposing);
|
|
215
224
|
|
|
225
|
+
/**
|
|
226
|
+
* What Escape closes on a page wherever it is pressed: a modal (a `<dialog>`
|
|
227
|
+
* opened with showModal, or a dialog marked aria-modal) and a popover that
|
|
228
|
+
* light dismisses. In `:is()`, a browser that doesn't know one of them still
|
|
229
|
+
* reads the others.
|
|
230
|
+
*/
|
|
231
|
+
const CLOSES_ON_ESCAPE =
|
|
232
|
+
':is(:modal, :popover-open:not([popover="manual" i]), [aria-modal="true"])';
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* What Escape closes when it is pressed in it: those, in a shadow root too,
|
|
236
|
+
* and a design system's dialog marked only by its role. A `<dialog>` opened
|
|
237
|
+
* with show() stays open.
|
|
238
|
+
*/
|
|
239
|
+
const CLOSES_FROM_INSIDE = `:is(${CLOSES_ON_ESCAPE}, [role="dialog"], [role="alertdialog"])`;
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Whether an element shows. One kept on the page while closed is hidden;
|
|
243
|
+
* browsers without the check go by its being there.
|
|
244
|
+
*/
|
|
245
|
+
const shows = (element: Element) =>
|
|
246
|
+
element.checkVisibility?.({
|
|
247
|
+
opacityProperty: true,
|
|
248
|
+
visibilityProperty: true,
|
|
249
|
+
}) ?? true;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Whether `page` has a use for an Escape, asked before it hears it: one
|
|
253
|
+
* pressed in a dialog or popover (CLOSES_FROM_INSIDE), or while a modal or
|
|
254
|
+
* popover shows there, closes it. A dialog that closes without preventing
|
|
255
|
+
* the key is gone by the time the page's window hears it, and a `<dialog>`
|
|
256
|
+
* or popover closes only if the key keeps its default.
|
|
257
|
+
*/
|
|
258
|
+
const pageTakesEscape = (event: KeyboardEvent, page: Window) =>
|
|
259
|
+
event
|
|
260
|
+
.composedPath()
|
|
261
|
+
.some(
|
|
262
|
+
(target) => asElement(target)?.matches(CLOSES_FROM_INSIDE) === true
|
|
263
|
+
) || [...page.document.querySelectorAll(CLOSES_ON_ESCAPE)].some(shows);
|
|
264
|
+
|
|
216
265
|
/** Menus, lists and trees, which jump to the item a letter starts. */
|
|
217
266
|
const TYPES_AHEAD =
|
|
218
267
|
'[role="menu"], [role="menubar"], [role="listbox"], [role="tree"], [role="treegrid"]';
|
|
@@ -260,6 +309,53 @@ const HELD_KEYS = new Set([
|
|
|
260
309
|
"ControlRight",
|
|
261
310
|
]);
|
|
262
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Keeps a frame taking the pointer while the canvas moves with the pinch its
|
|
314
|
+
* page passes on (engine.css), until the pinch is over and the canvas has
|
|
315
|
+
* settled. WebKit gives a pinch only to the page it started on, and drops
|
|
316
|
+
* the rest of it once that page lets the pointer through. Wheels need no
|
|
317
|
+
* hold: WebKit keeps a scroll with the page it started on whatever the
|
|
318
|
+
* pointer does, and Chromium asks where each wheel is.
|
|
319
|
+
*/
|
|
320
|
+
const holdPointer = (iframe: HTMLIFrameElement) => {
|
|
321
|
+
const surface = iframe.closest(RENDERER);
|
|
322
|
+
const moving = () => surface?.classList.contains(MOVING) === true;
|
|
323
|
+
let pinchEnd: ReturnType<typeof setTimeout> | undefined;
|
|
324
|
+
const cancelRelease = () => {
|
|
325
|
+
clearTimeout(pinchEnd);
|
|
326
|
+
settling.disconnect();
|
|
327
|
+
};
|
|
328
|
+
const release = () => {
|
|
329
|
+
cancelRelease();
|
|
330
|
+
iframe.removeAttribute(KEEPS_POINTER);
|
|
331
|
+
};
|
|
332
|
+
const settling = new MutationObserver(() => {
|
|
333
|
+
if (!moving()) {
|
|
334
|
+
release();
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
const pinchOver = () => {
|
|
338
|
+
if (surface && moving()) {
|
|
339
|
+
settling.observe(surface, { attributeFilter: ["class"] });
|
|
340
|
+
} else {
|
|
341
|
+
release();
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
return {
|
|
345
|
+
/** A step of the pinch its page passes on. */
|
|
346
|
+
hold: () => {
|
|
347
|
+
cancelRelease();
|
|
348
|
+
// Marked once: a pinch steps 60 to 120 times a second.
|
|
349
|
+
if (!iframe.hasAttribute(KEEPS_POINTER)) {
|
|
350
|
+
iframe.setAttribute(KEEPS_POINTER, "true");
|
|
351
|
+
}
|
|
352
|
+
pinchEnd = setTimeout(pinchOver, GESTURE_GAP_MS);
|
|
353
|
+
},
|
|
354
|
+
/** Lets the pointer through again: its page has gone, or is unwatched. */
|
|
355
|
+
release,
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
|
|
263
359
|
/**
|
|
264
360
|
* Passes what is the canvas's over a frame's page on to the canvas, as wheels
|
|
265
361
|
* and keys over the frame: now, and on each page the frame loads. A page from
|
|
@@ -268,6 +364,7 @@ const HELD_KEYS = new Set([
|
|
|
268
364
|
*/
|
|
269
365
|
export const watchFrameInput = (iframe: HTMLIFrameElement): (() => void) => {
|
|
270
366
|
const gesture = gestureOn(iframe);
|
|
367
|
+
const pointer = holdPointer(iframe);
|
|
271
368
|
// The page's pixels are scaled by the canvas's zoom.
|
|
272
369
|
const toCanvas = (wheel: WheelEventInit) => {
|
|
273
370
|
const box = iframe.getBoundingClientRect();
|
|
@@ -331,7 +428,7 @@ export const watchFrameInput = (iframe: HTMLIFrameElement): (() => void) => {
|
|
|
331
428
|
* Lets go of every key the page passed down: its page has gone, or lost
|
|
332
429
|
* the keyboard to another app, and their key-ups will never come.
|
|
333
430
|
*/
|
|
334
|
-
const
|
|
431
|
+
const releaseKeys = () => {
|
|
335
432
|
for (const [code, key] of down) {
|
|
336
433
|
iframe.dispatchEvent(
|
|
337
434
|
new KeyboardEvent("keyup", { bubbles: true, code, key })
|
|
@@ -339,8 +436,17 @@ export const watchFrameInput = (iframe: HTMLIFrameElement): (() => void) => {
|
|
|
339
436
|
}
|
|
340
437
|
down.clear();
|
|
341
438
|
};
|
|
439
|
+
// The Escapes the page has a use for, noted before it hears them (listen).
|
|
440
|
+
const pageEscapes = new WeakSet<KeyboardEvent>();
|
|
441
|
+
// Whether the Escape held down went to the page: its repeats go there too,
|
|
442
|
+
// though the dialog it closed has gone. The page's until onKey hears it: a
|
|
443
|
+
// press the page stops never reaches onKey.
|
|
444
|
+
let escapeToPage = false;
|
|
342
445
|
const onKey = (event: KeyboardEvent) => {
|
|
343
|
-
if (event.
|
|
446
|
+
if (event.key === "Escape" && !event.repeat) {
|
|
447
|
+
escapeToPage = event.defaultPrevented || pageEscapes.has(event);
|
|
448
|
+
}
|
|
449
|
+
if (event.defaultPrevented || (event.key === "Escape" && escapeToPage)) {
|
|
344
450
|
return;
|
|
345
451
|
}
|
|
346
452
|
// Space held is the hand, as it is over the canvas, unless the page has
|
|
@@ -387,13 +493,29 @@ export const watchFrameInput = (iframe: HTMLIFrameElement): (() => void) => {
|
|
|
387
493
|
const onBlur = () => {
|
|
388
494
|
setTimeout(() => {
|
|
389
495
|
if (!iframe.ownerDocument.hasFocus()) {
|
|
390
|
-
|
|
496
|
+
releaseKeys();
|
|
391
497
|
}
|
|
392
498
|
}, 0);
|
|
393
499
|
};
|
|
394
|
-
const
|
|
500
|
+
const pinch = pinchAsWheel(toCanvas);
|
|
501
|
+
const onGesture = (event: Event) => {
|
|
502
|
+
pointer.hold();
|
|
503
|
+
pinch(event);
|
|
504
|
+
};
|
|
395
505
|
const listen = (page: Window) => {
|
|
506
|
+
const onKeyBeforePage = (event: KeyboardEvent) => {
|
|
507
|
+
if (event.key !== "Escape") {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
if (!event.repeat) {
|
|
511
|
+
escapeToPage = true;
|
|
512
|
+
}
|
|
513
|
+
if (pageTakesEscape(event, page)) {
|
|
514
|
+
pageEscapes.add(event);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
396
517
|
page.addEventListener("wheel", onWheel, { passive: false });
|
|
518
|
+
page.addEventListener("keydown", onKeyBeforePage, { capture: true });
|
|
397
519
|
page.addEventListener("keydown", onKey);
|
|
398
520
|
page.addEventListener("keyup", onKeyUp);
|
|
399
521
|
page.addEventListener("blur", onBlur);
|
|
@@ -402,6 +524,7 @@ export const watchFrameInput = (iframe: HTMLIFrameElement): (() => void) => {
|
|
|
402
524
|
}
|
|
403
525
|
return () => {
|
|
404
526
|
page.removeEventListener("wheel", onWheel);
|
|
527
|
+
page.removeEventListener("keydown", onKeyBeforePage, { capture: true });
|
|
405
528
|
page.removeEventListener("keydown", onKey);
|
|
406
529
|
page.removeEventListener("keyup", onKeyUp);
|
|
407
530
|
page.removeEventListener("blur", onBlur);
|
|
@@ -412,18 +535,19 @@ export const watchFrameInput = (iframe: HTMLIFrameElement): (() => void) => {
|
|
|
412
535
|
};
|
|
413
536
|
let unlisten: (() => void) | undefined;
|
|
414
537
|
const unwatch = () => {
|
|
415
|
-
|
|
538
|
+
releaseKeys();
|
|
416
539
|
try {
|
|
417
540
|
unlisten?.();
|
|
418
541
|
} catch {
|
|
419
542
|
// The page is from another origin now, and took its listeners with it.
|
|
420
543
|
}
|
|
421
544
|
unlisten = undefined;
|
|
545
|
+
// The page that had a gesture has gone, and the next starts afresh.
|
|
546
|
+
gesture.forget(iframe);
|
|
547
|
+
pointer.release();
|
|
422
548
|
};
|
|
423
549
|
const watch = () => {
|
|
424
550
|
unwatch();
|
|
425
|
-
// The page that had a gesture has gone, and the next starts afresh.
|
|
426
|
-
gesture.forget(iframe);
|
|
427
551
|
try {
|
|
428
552
|
const page = iframe.contentWindow;
|
|
429
553
|
unlisten = page ? listen(page) : undefined;
|
|
@@ -436,10 +560,23 @@ export const watchFrameInput = (iframe: HTMLIFrameElement): (() => void) => {
|
|
|
436
560
|
return () => {
|
|
437
561
|
iframe.removeEventListener("load", watch);
|
|
438
562
|
unwatch();
|
|
439
|
-
gesture.forget(iframe);
|
|
440
563
|
};
|
|
441
564
|
};
|
|
442
565
|
|
|
566
|
+
/**
|
|
567
|
+
* Gives the canvas back the keyboard, if a frame's page has it. Blurring the
|
|
568
|
+
* iframe is not enough: WebKit (Safari, the Dex app) leaves the keyboard in
|
|
569
|
+
* its page, which keeps every key but the few it passes on (watchFrameInput).
|
|
570
|
+
* Focusing the canvas's window takes it back there too.
|
|
571
|
+
*/
|
|
572
|
+
export const takeKeyboardFrom = (iframe: HTMLIFrameElement): void => {
|
|
573
|
+
if (iframe.ownerDocument.activeElement !== iframe) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
iframe.blur();
|
|
577
|
+
iframe.ownerDocument.defaultView?.focus();
|
|
578
|
+
};
|
|
579
|
+
|
|
443
580
|
/**
|
|
444
581
|
* Makes `element`, a live frame on the canvas's own page, a page of its own
|
|
445
582
|
* to the canvas's wheels (canvasTakesWheel): a gesture that starts by
|
|
@@ -145,6 +145,15 @@ export const zoomCommand = (
|
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* ⌘F (Ctrl F off a Mac): find on the frames, in place of the browser's own
|
|
150
|
+
* find, which would search the studio around them. It works while typing.
|
|
151
|
+
*/
|
|
152
|
+
export const isFindKey = (key: CanvasKey): boolean =>
|
|
153
|
+
(key.metaKey || key.ctrlKey) &&
|
|
154
|
+
!(key.altKey || key.shiftKey) &&
|
|
155
|
+
key.key.toLowerCase() === "f";
|
|
156
|
+
|
|
148
157
|
/**
|
|
149
158
|
* ⌘ with Z, \, A or D, and ⌥⌘Enter, Figma's Present, to play the one selected
|
|
150
159
|
* frame. While wireframing, ⌘A and ⌥⌘Enter leave the frames alone.
|
|
@@ -274,18 +274,12 @@ const rowFor = (section: Section, cell: Pick<Cell, "above" | "row">): Row => {
|
|
|
274
274
|
return row;
|
|
275
275
|
};
|
|
276
276
|
|
|
277
|
-
/** Move a frame to a cell in any section, or to a new row. */
|
|
278
|
-
export const placeFrame = (
|
|
279
|
-
canvas: Canvas,
|
|
280
|
-
from: FrameAddress,
|
|
281
|
-
to: Cell
|
|
282
|
-
): Canvas => moveFrame(canvas, from, to).canvas;
|
|
283
|
-
|
|
284
277
|
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* No key when there is no such
|
|
278
|
+
* Move a frame to a cell in any section, or to a new row, with the key the
|
|
279
|
+
* frame ends at: its id may change, when the row it lands in has a frame by
|
|
280
|
+
* that id. A frame already on that step, as one pushed there by another
|
|
281
|
+
* frame of the same drop is, ends where it is. No key when there is no such
|
|
282
|
+
* frame or cell.
|
|
289
283
|
*/
|
|
290
284
|
export const moveFrame = (
|
|
291
285
|
canvas: Canvas,
|
|
@@ -662,17 +656,6 @@ export const editSketch = (
|
|
|
662
656
|
};
|
|
663
657
|
};
|
|
664
658
|
|
|
665
|
-
/** Change several frames the same way: grids on every selected frame. */
|
|
666
|
-
export const updateFrames = (
|
|
667
|
-
canvas: Canvas,
|
|
668
|
-
addresses: FrameAddress[],
|
|
669
|
-
patch: FramePatch
|
|
670
|
-
): Canvas =>
|
|
671
|
-
addresses.reduce(
|
|
672
|
-
(changed, address) => updateFrame(changed, address, patch),
|
|
673
|
-
canvas
|
|
674
|
-
);
|
|
675
|
-
|
|
676
659
|
export const frameName = (frame: Frame | NewFrame): string => {
|
|
677
660
|
const it = kinded(frame);
|
|
678
661
|
switch (it.kind) {
|
|
@@ -837,26 +820,6 @@ export function updateSection(
|
|
|
837
820
|
return next;
|
|
838
821
|
}
|
|
839
822
|
|
|
840
|
-
/** Move a section so it sits before `index` (or last). */
|
|
841
|
-
export function moveSection(
|
|
842
|
-
canvas: Canvas,
|
|
843
|
-
sectionId: string,
|
|
844
|
-
index: number
|
|
845
|
-
): Canvas {
|
|
846
|
-
const next = clone(canvas);
|
|
847
|
-
const from = next.sections.findIndex((section) => section.id === sectionId);
|
|
848
|
-
if (from < 0) {
|
|
849
|
-
return canvas;
|
|
850
|
-
}
|
|
851
|
-
const [section] = next.sections.splice(from, 1);
|
|
852
|
-
if (!section) {
|
|
853
|
-
return canvas;
|
|
854
|
-
}
|
|
855
|
-
const at = index > from ? index - 1 : index;
|
|
856
|
-
next.sections.splice(Math.min(at, next.sections.length), 0, section);
|
|
857
|
-
return next;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
823
|
/**
|
|
861
824
|
* Move a row of a section so it sits before `index` among its rows (or last).
|
|
862
825
|
* The same canvas when it is there already.
|