@dexhq/canvas 0.14.0 → 0.16.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 +70 -0
- package/README.md +5 -3
- package/app/canvas/activity-parts.tsx +50 -6
- package/app/canvas/activity.tsx +10 -18
- package/app/canvas/agent-changes.ts +18 -8
- package/app/canvas/anchoring.ts +15 -7
- package/app/canvas/canvas-context.tsx +6 -2
- package/app/canvas/canvas-input.ts +186 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +7 -44
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +250 -27
- package/app/canvas/canvas-ui.ts +13 -3
- package/app/canvas/canvas.css +147 -29
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +270 -111
- package/app/canvas/element-link.ts +135 -0
- package/app/canvas/element-picker.ts +223 -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/export-dialog.tsx +265 -0
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +83 -16
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-context-menu.tsx +61 -7
- package/app/canvas/frame-node.tsx +19 -20
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +68 -22
- package/app/canvas/linked-element.tsx +196 -0
- package/app/canvas/live-page.ts +156 -19
- package/app/canvas/mentions.tsx +209 -0
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/picked-box.tsx +21 -0
- package/app/canvas/removed-views-panel.tsx +4 -4
- package/app/canvas/request-node.tsx +151 -0
- package/app/canvas/review-panel.tsx +8 -3
- package/app/canvas/section-node.tsx +6 -133
- package/app/canvas/spec-margin.tsx +4 -1
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/teammates-layer.tsx +205 -0
- package/app/canvas/text-layer.tsx +103 -17
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/tool-cursors.ts +7 -6
- package/app/canvas/tool-icons.tsx +24 -56
- package/app/canvas/typing.ts +12 -0
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +40 -42
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/use-canvas-editor.ts +4 -2
- package/app/canvas/xray.ts +3 -12
- package/app/export/player-model.ts +159 -0
- package/app/export/player.tsx +198 -0
- package/app/export.html +31 -0
- package/app/export.tsx +9 -0
- package/app/frame/announce-refreshes.ts +21 -0
- package/app/frame/start-frame.tsx +50 -0
- package/app/frame/view-loads.ts +161 -0
- package/app/frame/views.ts +13 -49
- package/app/frame.tsx +2 -33
- package/app/i18n/locales/en/messages.po +233 -14
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +232 -13
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/dex-glyphs.tsx +219 -0
- package/app/icons/glyphs.tsx +80 -80
- package/app/kit/use-flow.ts +2 -1
- package/app/live/canvas-teammates.ts +90 -0
- package/app/live/studio-api.ts +30 -20
- package/app/main.tsx +3 -0
- package/app/pages/canvas.tsx +45 -14
- package/app/pages/commands-settings.tsx +17 -3
- package/app/pages/render.tsx +39 -11
- package/app/shell/bell.tsx +15 -5
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/presence.tsx +123 -26
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/shell/thread-list.tsx +25 -8
- package/app/shell/working-on.tsx +35 -3
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +39 -11
- package/app/ui/reference.tsx +21 -8
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/bin/sudio.mjs +1 -1
- 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 +5 -5
- package/dist/cli/commands/create.mjs +4 -4
- package/dist/cli/commands/export.d.mts +40 -0
- package/dist/cli/commands/export.mjs +66 -0
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/cli/commands/init.d.mts +2 -2
- package/dist/cli/commands/upgrade.mjs +1 -1
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +13 -7
- package/dist/cli/main.d.mts +42 -5
- package/dist/cli/main.mjs +1 -0
- package/dist/config/load.mjs +14 -2
- package/dist/config/project-files.d.mts +11 -0
- package/dist/config/project-files.mjs +23 -2
- package/dist/config/renamed.d.mts +7 -2
- package/dist/config/renamed.mjs +13 -3
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/commands.d.mts +11 -9
- package/dist/content/commands.mjs +22 -16
- package/dist/content/comments-log.mjs +2 -1
- package/dist/content/content.d.mts +13 -143
- package/dist/content/content.mjs +55 -76
- package/dist/content/element-words.d.mts +42 -0
- package/dist/content/element-words.mjs +112 -0
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/hosted-person.d.mts +31 -0
- package/dist/content/hosted-person.mjs +68 -0
- package/dist/content/merge-rules.d.mts +5 -0
- package/dist/content/merge-rules.mjs +17 -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/screenshot.mjs +9 -0
- package/dist/content/text-edit.d.mts +24 -14
- package/dist/content/text-edit.mjs +92 -81
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +285 -0
- package/dist/content/thread-module.d.mts +2 -4
- package/dist/content/thread-module.mjs +4 -5
- package/dist/content/threads.mjs +1 -1
- package/dist/paste/paste.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/agents.d.mts +10 -0
- package/dist/server/agents.mjs +21 -6
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/canvas-presence.d.mts +22 -0
- package/dist/server/canvas-presence.mjs +160 -0
- package/dist/server/channel.d.mts +13 -24
- package/dist/server/channel.mjs +55 -37
- package/dist/server/claimed-presence.d.mts +3 -2
- package/dist/server/claimed-presence.mjs +15 -7
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/command-settings.mjs +1 -1
- package/dist/server/comments/actions.d.mts +145 -0
- package/dist/server/comments/actions.mjs +146 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +67 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +59 -23
- package/dist/server/export/build.d.mts +15 -0
- package/dist/server/export/build.mjs +220 -0
- package/dist/server/export/page.d.mts +25 -0
- package/dist/server/export/page.mjs +40 -0
- package/dist/server/export/plugin.d.mts +31 -0
- package/dist/server/export/plugin.mjs +69 -0
- package/dist/server/export/run.d.mts +9 -0
- package/dist/server/export/run.mjs +61 -0
- package/dist/server/export/save.d.mts +7 -0
- package/dist/server/export/save.mjs +29 -0
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/hosted.d.mts +8 -0
- package/dist/server/hosted.mjs +78 -0
- package/dist/server/live-mirror.mjs +66 -10
- package/dist/server/live.mjs +28 -1
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +9 -8
- package/dist/server/me.d.mts +3 -1
- package/dist/server/me.mjs +8 -2
- package/dist/server/notices.d.mts +1 -1
- package/dist/server/notices.mjs +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 +1 -1
- package/dist/server/people.d.mts +8 -3
- package/dist/server/people.mjs +6 -2
- package/dist/server/pictures.d.mts +1 -1
- package/dist/server/pictures.mjs +2 -2
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/prebundle.d.mts +32 -0
- package/dist/server/prebundle.mjs +115 -0
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/problems.d.mts +8 -0
- package/dist/server/problems.mjs +13 -0
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +76 -78
- package/dist/server/source-stamp.d.mts +4 -3
- package/dist/server/source-stamp.mjs +60 -31
- package/dist/server/state.d.mts +19 -10
- package/dist/server/state.mjs +27 -18
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +17 -3
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.d.mts +8 -0
- package/dist/server/thread-source.mjs +25 -6
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/export.d.mts +5 -0
- package/dist/server/tools/export.mjs +35 -0
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/place-frame.mjs +16 -16
- 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 +2 -2
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.d.mts +9 -4
- package/dist/server/vite.mjs +65 -63
- package/dist/server/web-app.mjs +4 -7
- package/dist/server/welcome.mjs +2 -1
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.d.mts +4 -0
- package/dist/setup/apply.mjs +5 -4
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +72 -22
- package/dist/setup/design-system-checks.mjs +3 -17
- 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 +19 -3
- package/dist/setup/detect/workspace.d.mts +10 -10
- package/dist/setup/detect/workspace.mjs +10 -12
- package/dist/setup/detect.d.mts +0 -2
- package/dist/setup/detect.mjs +1 -3
- package/dist/setup/doctor.d.mts +4 -1
- package/dist/setup/doctor.mjs +8 -6
- package/dist/setup/migrate/dex-folder.d.mts +61 -0
- package/dist/setup/migrate/dex-folder.mjs +544 -0
- package/dist/setup/migrate/files-folder.mjs +1 -1
- package/dist/setup/migrate/guides.mjs +1 -1
- package/dist/setup/migrate/migrations.mjs +4 -0
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/migrate/setup-files.d.mts +5 -0
- package/dist/setup/migrate/setup-files.mjs +115 -0
- package/dist/setup/migrate/studio-state.d.mts +2 -2
- package/dist/setup/migrate/studio-state.mjs +4 -4
- package/dist/setup/placement.d.mts +1 -1
- package/dist/setup/placement.mjs +5 -4
- package/dist/setup/plan.d.mts +5 -5
- package/dist/setup/plan.mjs +8 -12
- package/dist/setup/project.d.mts +6 -1
- package/dist/setup/project.mjs +10 -10
- package/dist/setup/prompts.d.mts +2 -1
- package/dist/setup/prompts.mjs +4 -3
- package/dist/setup/questions.mjs +3 -2
- package/dist/setup/starters.d.mts +3 -1
- package/dist/setup/starters.mjs +9 -3
- package/dist/setup/write.d.mts +15 -3
- package/dist/setup/write.mjs +23 -3
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.d.mts +22 -7
- package/dist/shared/canvas-core.mjs +39 -11
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +55 -0
- package/dist/shared/comments/routes.mjs +39 -0
- package/dist/shared/export-core.d.mts +62 -0
- package/dist/shared/export-core.mjs +101 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/live-core.d.mts +2 -0
- package/dist/shared/live-core.mjs +6 -1
- package/dist/shared/live-presence.d.mts +57 -2
- package/dist/shared/live-presence.mjs +90 -4
- package/dist/shared/page-messages.d.mts +14 -1
- package/dist/shared/page-messages.mjs +30 -3
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/people-core.d.mts +28 -0
- package/dist/shared/people-core.mjs +27 -1
- package/dist/shared/presence-core.d.mts +13 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/references-core.d.mts +4 -0
- package/dist/shared/references-core.mjs +12 -4
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +1 -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 +21 -0
- package/dist/shared/studio-files.mjs +16 -2
- package/dist/shared/studio-routes.d.mts +29 -63
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +29 -6
- package/dist/shared/threads-core.mjs +68 -13
- package/extension/dist/feedback.js +104 -284
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +104 -284
- package/package.json +2 -2
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +4 -4
- package/src/cli/commands/export.ts +78 -0
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/commands/upgrade.ts +1 -1
- package/src/cli/help.ts +13 -7
- package/src/cli/main.ts +1 -0
- package/src/config/load.ts +26 -2
- package/src/config/project-files.ts +36 -6
- package/src/config/renamed.ts +19 -4
- package/src/content/capture.ts +6 -12
- package/src/content/commands.ts +30 -18
- package/src/content/comments-log.ts +4 -1
- package/src/content/content.ts +71 -257
- package/src/content/element-words.ts +175 -0
- package/src/content/flow-specs.ts +2 -1
- package/src/content/hosted-person.ts +107 -0
- package/src/content/merge-rules.ts +29 -0
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/screenshot.ts +14 -0
- package/src/content/text-edit.ts +172 -105
- package/src/content/text-replace.ts +420 -0
- package/src/content/thread-module.ts +2 -4
- package/src/content/trash.ts +1 -1
- 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/agents.ts +48 -17
- package/src/server/canvas-presence.ts +237 -0
- package/src/server/channel.ts +95 -53
- package/src/server/claimed-presence.ts +26 -10
- package/src/server/command-settings.ts +1 -1
- package/src/server/comments/actions.ts +333 -0
- package/src/server/comments/routes.ts +131 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +94 -33
- package/src/server/export/build.ts +310 -0
- package/src/server/export/page.ts +85 -0
- package/src/server/export/plugin.ts +138 -0
- package/src/server/export/run.ts +79 -0
- package/src/server/export/save.ts +38 -0
- package/src/server/file-lock.ts +205 -54
- package/src/server/hosted.ts +113 -0
- package/src/server/live-mirror.ts +93 -8
- package/src/server/live.ts +46 -1
- package/src/server/machine-update.ts +3 -3
- package/src/server/mcp.ts +15 -14
- package/src/server/me.ts +12 -6
- package/src/server/notices.ts +2 -2
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +13 -3
- package/src/server/pictures.ts +2 -2
- package/src/server/port.ts +94 -20
- package/src/server/prebundle.ts +230 -0
- package/src/server/presence.ts +12 -4
- package/src/server/problems.ts +11 -0
- package/src/server/requests.ts +115 -110
- package/src/server/roster.ts +1 -1
- package/src/server/saved.ts +1 -1
- package/src/server/source-stamp.ts +118 -37
- package/src/server/state.ts +53 -31
- package/src/server/studio-for.ts +26 -2
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/thread-source.ts +35 -3
- package/src/server/tools/export.ts +56 -0
- package/src/server/tools/place-frame.ts +23 -15
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/thread-list.ts +1 -1
- package/src/server/tools/watch.ts +7 -7
- package/src/server/updates.ts +2 -2
- package/src/server/vite.ts +106 -110
- package/src/server/web-app.ts +11 -9
- package/src/server/welcome.ts +3 -1
- package/src/setup/apply.ts +8 -5
- package/src/setup/create.ts +101 -27
- package/src/setup/design-system-checks.ts +8 -21
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +23 -2
- package/src/setup/detect/workspace.ts +20 -21
- package/src/setup/detect.ts +0 -4
- package/src/setup/doctor.ts +13 -6
- package/src/setup/migrate/dex-folder.ts +842 -0
- package/src/setup/migrate/files-folder.ts +1 -1
- package/src/setup/migrate/guides.ts +3 -1
- package/src/setup/migrate/migrations.ts +8 -2
- package/src/setup/migrate/setup-files.ts +198 -0
- package/src/setup/migrate/studio-state.ts +12 -10
- package/src/setup/own-app.ts +1 -1
- package/src/setup/placement.ts +7 -6
- package/src/setup/plan.ts +13 -18
- package/src/setup/project.ts +11 -10
- package/src/setup/prompts.ts +5 -4
- package/src/setup/questions.ts +6 -3
- package/src/setup/starters.ts +11 -4
- package/src/setup/write.ts +34 -3
- package/src/shared/canvas-core.ts +48 -9
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +81 -0
- package/src/shared/export-core.ts +198 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/live-core.ts +8 -0
- package/src/shared/live-presence.ts +171 -2
- package/src/shared/page-messages.ts +38 -2
- package/src/shared/page-review.ts +11 -16
- package/src/shared/people-core.ts +44 -0
- package/src/shared/presence-core.ts +18 -2
- package/src/shared/references-core.ts +22 -3
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +2 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +29 -1
- package/src/shared/studio-routes.ts +32 -65
- package/src/shared/threads-core.ts +134 -12
- package/templates/methods/explore.md +1 -1
- package/templates/methods/handoff.md +1 -1
- package/templates/methods/review.md +2 -1
- package/templates/rules/canvas-frames.md +6 -3
- package/templates/rules/commands.md +1 -0
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/studio.md +17 -11
- package/templates/skills/comprehend/SKILL.md +56 -0
- package/templates/skills/distill/SKILL.md +172 -0
- package/templates/skills/export-prototype/SKILL.md +35 -0
- package/templates/skills/riff/SKILL.md +21 -0
- package/templates/skills/riff-deep/SKILL.md +40 -0
- package/templates/skills/riff-max/SKILL.md +46 -0
- package/templates/skills/riff-state/SKILL.md +45 -0
- package/templates/skills/riff-up/SKILL.md +38 -0
- package/templates/skills/riff-wide/SKILL.md +40 -0
- package/templates/starters/standalone/README.md +1 -1
- package/templates/starters/turborepo/README.md +2 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +2 -2
- package/templates/starters/vite/README.md +1 -1
- 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/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
package/app/live/studio-api.ts
CHANGED
|
@@ -75,6 +75,8 @@ interface Me {
|
|
|
75
75
|
loaded: boolean;
|
|
76
76
|
/** Who you would join as, when Dex knows you but you are no contributor. */
|
|
77
77
|
newcomer: Contributor | null;
|
|
78
|
+
/** A viewer, in Dex in the browser: they never change the files. */
|
|
79
|
+
viewer?: true;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
/**
|
|
@@ -82,7 +84,7 @@ interface Me {
|
|
|
82
84
|
* the page, so the first paint shows you and not a placeholder.
|
|
83
85
|
*/
|
|
84
86
|
const meFromPage = ():
|
|
85
|
-
| Pick<Me, "cloud" | "contributor" | "git" | "newcomer">
|
|
87
|
+
| Pick<Me, "cloud" | "contributor" | "git" | "newcomer" | "viewer">
|
|
86
88
|
| undefined => {
|
|
87
89
|
const content =
|
|
88
90
|
typeof document === "undefined"
|
|
@@ -100,6 +102,7 @@ const meFromPage = ():
|
|
|
100
102
|
contributor: me.contributor ?? null,
|
|
101
103
|
git: typeof me.git === "string" ? me.git : "",
|
|
102
104
|
newcomer: me.newcomer ?? null,
|
|
105
|
+
...(me.viewer === true && { viewer: true as const }),
|
|
103
106
|
};
|
|
104
107
|
} catch {
|
|
105
108
|
return;
|
|
@@ -234,20 +237,6 @@ export function useMe() {
|
|
|
234
237
|
};
|
|
235
238
|
}
|
|
236
239
|
|
|
237
|
-
/**
|
|
238
|
-
* Change a thread as the person using the studio: reply, react, hand it to
|
|
239
|
-
* people or the agent, resolve, dismiss or reopen it.
|
|
240
|
-
*/
|
|
241
|
-
export const changeThread = (
|
|
242
|
-
{ id, slug }: { id: string; slug: string },
|
|
243
|
-
change: PersonChange
|
|
244
|
-
) =>
|
|
245
|
-
studioRequest("threads", {
|
|
246
|
-
method: "POST",
|
|
247
|
-
query: { slug },
|
|
248
|
-
body: { id, ...change },
|
|
249
|
-
});
|
|
250
|
-
|
|
251
240
|
/**
|
|
252
241
|
* Everyone's annotations (picks) on one prototype, kept current. A pick saved
|
|
253
242
|
* or removed shows at once; the server's answer then stands, and a refusal
|
|
@@ -487,11 +476,32 @@ export function useThreads(slug: string) {
|
|
|
487
476
|
}
|
|
488
477
|
return changeGuestThread(slug, current, change);
|
|
489
478
|
}
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
)
|
|
494
|
-
|
|
479
|
+
const { target } = change;
|
|
480
|
+
// A request moved or resized on the canvas is there at once, as a frame
|
|
481
|
+
// dropped is; the threads as they are come back if it is refused.
|
|
482
|
+
if (target) {
|
|
483
|
+
shown.set((current = []) =>
|
|
484
|
+
current.map((entry) =>
|
|
485
|
+
entry.id === id ? { ...entry, target } : entry
|
|
486
|
+
)
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
try {
|
|
490
|
+
const thread = await studioRequest("threads", {
|
|
491
|
+
method: "POST",
|
|
492
|
+
query: { slug },
|
|
493
|
+
body: { id, ...change },
|
|
494
|
+
});
|
|
495
|
+
shown.set((current = []) =>
|
|
496
|
+
current.map((entry) => (entry.id === id ? thread : entry))
|
|
497
|
+
);
|
|
498
|
+
return thread;
|
|
499
|
+
} catch (error) {
|
|
500
|
+
if (target) {
|
|
501
|
+
await shown.reload();
|
|
502
|
+
}
|
|
503
|
+
throw error;
|
|
504
|
+
}
|
|
495
505
|
},
|
|
496
506
|
[slug, shown, threads]
|
|
497
507
|
);
|
package/app/main.tsx
CHANGED
|
@@ -12,6 +12,7 @@ import { StudioI18n } from "./i18n/provider";
|
|
|
12
12
|
import { carryOverStorage } from "./renamed-storage";
|
|
13
13
|
// Chrome offers Install once, as the page loads: kept for Settings.
|
|
14
14
|
import "./shell/install-prompt";
|
|
15
|
+
import { refuseStrayFileDrops } from "./ui/file-drop";
|
|
15
16
|
import { StudioThemeProvider } from "./ui/theme-provider";
|
|
16
17
|
|
|
17
18
|
// A view's address from before views had a page of their own goes there.
|
|
@@ -23,6 +24,8 @@ const view = viewAt(
|
|
|
23
24
|
const frameAddress = view && framePage(view.slug, view.view, view.search);
|
|
24
25
|
// What the browser kept under Sudio's keys, under Dex's from now on.
|
|
25
26
|
carryOverStorage();
|
|
27
|
+
// A file dropped where nothing takes it is never opened in place of Dex.
|
|
28
|
+
refuseStrayFileDrops(window);
|
|
26
29
|
const root = document.getElementById("root");
|
|
27
30
|
if (!root) {
|
|
28
31
|
throw new Error("Dex needs a #root element in index.html.");
|
package/app/pages/canvas.tsx
CHANGED
|
@@ -59,8 +59,10 @@ import { ActionNotice, TopNotices } from "../canvas/change-notice";
|
|
|
59
59
|
import {
|
|
60
60
|
CommentsPanel,
|
|
61
61
|
FloatingCommentCard,
|
|
62
|
+
showWhileHidden,
|
|
62
63
|
useHideCommentsWhile,
|
|
63
64
|
useIsTeamComment,
|
|
65
|
+
useOpenedWhileHidden,
|
|
64
66
|
} from "../canvas/comments";
|
|
65
67
|
import { DrawLayer } from "../canvas/draw-layer";
|
|
66
68
|
import type { DrawKind } from "../canvas/draw-model";
|
|
@@ -68,12 +70,14 @@ import {
|
|
|
68
70
|
CanvasViewProvider,
|
|
69
71
|
useCanvasView,
|
|
70
72
|
} from "../canvas/engine/canvas-view";
|
|
73
|
+
import { FindBar } from "../canvas/find-bar";
|
|
71
74
|
import { FlowCanvas } from "../canvas/flow-canvas";
|
|
72
75
|
import { askName } from "../canvas/flow-naming";
|
|
73
76
|
import { CommentsOrReviewsBody } from "../canvas/imported-reviews";
|
|
74
77
|
import { useInspectTools } from "../canvas/inspect-tools";
|
|
75
78
|
import { LargeCanvasNotice } from "../canvas/large-canvas-notice";
|
|
76
79
|
import { openSpot, resolveLayout } from "../canvas/layout";
|
|
80
|
+
import { useElementLink } from "../canvas/linked-element";
|
|
77
81
|
import {
|
|
78
82
|
AFTER_RELOAD_KEY,
|
|
79
83
|
keyOfFrame,
|
|
@@ -141,6 +145,7 @@ import { useDevices } from "../live/use-devices";
|
|
|
141
145
|
import { findPrototype, type Prototype } from "../registry";
|
|
142
146
|
import { ChromeTheme } from "../shell/chrome-theme";
|
|
143
147
|
import { CanvasFeedback } from "../shell/feedback-link";
|
|
148
|
+
import { PresenceHidden } from "../shell/presence";
|
|
144
149
|
import type { Canvas, SketchFrame, Thread } from "../types";
|
|
145
150
|
import { NotFound } from "./not-found";
|
|
146
151
|
|
|
@@ -184,6 +189,8 @@ const savedCanvas = (editor: CanvasEditor) =>
|
|
|
184
189
|
const CanvasFloatingComment = ({ threads }: { threads: ThreadsApi }) => {
|
|
185
190
|
const ui = useCanvasUiStore();
|
|
186
191
|
const floating = useCanvasUi((state) => state.floating);
|
|
192
|
+
const specThread = useCanvasUi((state) => state.specThread);
|
|
193
|
+
useOpenedWhileHidden(floating, specThread);
|
|
187
194
|
return (
|
|
188
195
|
<FloatingCommentCard
|
|
189
196
|
floating={floating}
|
|
@@ -227,7 +234,12 @@ const CanvasWorkspace = ({ prototype }: { prototype: Prototype }) => {
|
|
|
227
234
|
// Saves from a studio that doesn't know its person are its maker's. One
|
|
228
235
|
// that cannot say who you are keeps the canvas to view until it can.
|
|
229
236
|
const who = useMe();
|
|
230
|
-
const editor = useCanvasEditor(
|
|
237
|
+
const editor = useCanvasEditor(
|
|
238
|
+
prototype,
|
|
239
|
+
who.known,
|
|
240
|
+
who.contributor?.slug,
|
|
241
|
+
Boolean(who.viewer)
|
|
242
|
+
);
|
|
231
243
|
const connection = useServerConnection();
|
|
232
244
|
// Who the studio saves as, as canvas.json's read said: what is yours here.
|
|
233
245
|
const me = editor.person;
|
|
@@ -263,7 +275,8 @@ const CanvasWorkspace = ({ prototype }: { prototype: Prototype }) => {
|
|
|
263
275
|
const interacting = useStateOf(ui, (state) => state.interacting);
|
|
264
276
|
const [focused, setFocused] = useState(false);
|
|
265
277
|
const toggleFocus = useCallback(() => setFocused((value) => !value), []);
|
|
266
|
-
// With the panels hidden (⌘\), comments hide too, until ⇧C.
|
|
278
|
+
// With the panels hidden (⌘\), comments hide too, until ⇧C. No frame shows
|
|
279
|
+
// an agent at work either (PresenceHidden, below).
|
|
267
280
|
useHideCommentsWhile(focused);
|
|
268
281
|
const fullScreenSpec = useStateOf(ui, (state) => state.fullScreenSpec);
|
|
269
282
|
const closeSpec = useCallback(() => ui.setFullScreenSpec(), [ui]);
|
|
@@ -285,23 +298,22 @@ const CanvasWorkspace = ({ prototype }: { prototype: Prototype }) => {
|
|
|
285
298
|
const seeChange = useRef<(thread: Thread) => void>(() => undefined);
|
|
286
299
|
// The heads-up opens comments with one function for good, so the
|
|
287
300
|
// canvas rendering never renders it again.
|
|
288
|
-
const openThreadNow = useRef<(id: string
|
|
289
|
-
() => undefined
|
|
290
|
-
);
|
|
301
|
+
const openThreadNow = useRef<(id: string) => void>(() => undefined);
|
|
291
302
|
const openFromBar = useCallback(
|
|
292
|
-
(id: string
|
|
303
|
+
(id: string) => openThreadNow.current(id),
|
|
293
304
|
[]
|
|
294
305
|
);
|
|
295
306
|
// A spec's thread opens beside its spec, where its words are: on the
|
|
296
307
|
// canvas when the spec is placed there, else with the spec full screen.
|
|
297
308
|
// A document's, and any other, as a floating card.
|
|
298
309
|
const openAnyThread = useCallback(
|
|
299
|
-
(id: string, at
|
|
310
|
+
(id: string, at?: ScreenPoint) => {
|
|
300
311
|
const thread = threads.threads.find((entry) => entry.id === id);
|
|
301
312
|
// Reading a completed comment counts its change as seen.
|
|
302
313
|
if (thread) {
|
|
303
314
|
seeChange.current(thread);
|
|
304
315
|
}
|
|
316
|
+
showWhileHidden(id);
|
|
305
317
|
const spec =
|
|
306
318
|
thread?.target.kind === "spec" ? thread.target.spec : undefined;
|
|
307
319
|
if (spec === undefined || spec.startsWith("docs/")) {
|
|
@@ -315,14 +327,12 @@ const CanvasWorkspace = ({ prototype }: { prototype: Prototype }) => {
|
|
|
315
327
|
},
|
|
316
328
|
[threads.threads, ui, openThread, editor.canvas, fullScreenSpec]
|
|
317
329
|
);
|
|
318
|
-
useLayoutEffect(() => {
|
|
319
|
-
openThreadNow.current = openAnyThread;
|
|
320
|
-
}, [openAnyThread]);
|
|
321
330
|
const focusThread = useThreadFocus(
|
|
322
331
|
threads.threads,
|
|
323
332
|
editor.canvas,
|
|
324
333
|
openAnyThread
|
|
325
334
|
);
|
|
335
|
+
useElementLink(editor.canvas, { say: inspect.say, ui });
|
|
326
336
|
useEffect(() => {
|
|
327
337
|
if (resume.active) {
|
|
328
338
|
sketches.setActive(resume.active);
|
|
@@ -424,6 +434,7 @@ const CanvasWorkspace = ({ prototype }: { prototype: Prototype }) => {
|
|
|
424
434
|
file: prototype.slug,
|
|
425
435
|
loaded: threads.loaded && who.loaded,
|
|
426
436
|
me: who.contributor?.name,
|
|
437
|
+
mentionable: who.contributor?.slug,
|
|
427
438
|
quiet:
|
|
428
439
|
busy ||
|
|
429
440
|
writing ||
|
|
@@ -432,6 +443,23 @@ const CanvasWorkspace = ({ prototype }: { prototype: Prototype }) => {
|
|
|
432
443
|
threads: threads.threads,
|
|
433
444
|
});
|
|
434
445
|
seeChange.current = agentChanges.see;
|
|
446
|
+
// From the heads-up, the canvas moves to the comment, and its card opens
|
|
447
|
+
// at its pin. One an agent completed outlines where its change landed,
|
|
448
|
+
// and goes there when the comment has no pin (a request for a view, or a
|
|
449
|
+
// comment on the whole file).
|
|
450
|
+
const { outline } = agentChanges;
|
|
451
|
+
useLayoutEffect(() => {
|
|
452
|
+
openThreadNow.current = (id) => {
|
|
453
|
+
const thread = threads.threads.find((entry) => entry.id === id);
|
|
454
|
+
if (!thread) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
const atPin = focusThread(thread);
|
|
458
|
+
if (thread.status === "resolved") {
|
|
459
|
+
outline([thread], { move: !atPin });
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
}, [threads.threads, focusThread, outline]);
|
|
435
463
|
const { toggle: togglePanel } = panels;
|
|
436
464
|
const toggleStickers = useCallback(
|
|
437
465
|
() => togglePanel("stickers"),
|
|
@@ -655,10 +683,12 @@ const CanvasWorkspace = ({ prototype }: { prototype: Prototype }) => {
|
|
|
655
683
|
<div className="flex h-dvh flex-col bg-background">
|
|
656
684
|
<ChromeTheme />
|
|
657
685
|
<div className="@container/canvas relative min-h-0 flex-1">
|
|
658
|
-
<
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
686
|
+
<PresenceHidden when={focused}>
|
|
687
|
+
<FlowCanvas
|
|
688
|
+
selection={selection}
|
|
689
|
+
setSelection={setSelection}
|
|
690
|
+
/>
|
|
691
|
+
</PresenceHidden>
|
|
662
692
|
<DrawLayer kind={drawing} onEnd={stopDrawing} />
|
|
663
693
|
<SlidePdf />
|
|
664
694
|
<LeftPanels
|
|
@@ -696,6 +726,7 @@ const CanvasWorkspace = ({ prototype }: { prototype: Prototype }) => {
|
|
|
696
726
|
GUEST_REVIEW && !focused && panels.right === "comments"
|
|
697
727
|
}
|
|
698
728
|
/>
|
|
729
|
+
<FindBar writable={studio.local} />
|
|
699
730
|
<ServerNotice />
|
|
700
731
|
<TopNotices>
|
|
701
732
|
<ActionNotice notice={inspect.notice} />
|
|
@@ -16,7 +16,13 @@ import {
|
|
|
16
16
|
import { Switch } from "@studio/ui/shadcn/switch";
|
|
17
17
|
import { Textarea } from "@studio/ui/shadcn/textarea";
|
|
18
18
|
import { cn } from "cn";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
type DragEvent,
|
|
21
|
+
Fragment,
|
|
22
|
+
type ReactNode,
|
|
23
|
+
useId,
|
|
24
|
+
useState,
|
|
25
|
+
} from "react";
|
|
20
26
|
import {
|
|
21
27
|
type Command,
|
|
22
28
|
type CommandSwitch,
|
|
@@ -254,6 +260,13 @@ const QuickBarPicker = ({
|
|
|
254
260
|
}) => {
|
|
255
261
|
const { t } = useLingui();
|
|
256
262
|
const [dragging, setDragging] = useState<string>();
|
|
263
|
+
// Only a skill being moved, on dragenter as on dragover (file-drop.ts says
|
|
264
|
+
// why): a file dragged over the quick bar is not one of its skills.
|
|
265
|
+
const takeMove = (event: DragEvent) => {
|
|
266
|
+
if (dragging) {
|
|
267
|
+
event.preventDefault();
|
|
268
|
+
}
|
|
269
|
+
};
|
|
257
270
|
const choose = useStudioAction(
|
|
258
271
|
(quick: string[]) =>
|
|
259
272
|
studioRequest("commands", { method: "PUT", body: { quick } }),
|
|
@@ -307,7 +320,8 @@ const QuickBarPicker = ({
|
|
|
307
320
|
draggable
|
|
308
321
|
key={name}
|
|
309
322
|
onDragEnd={() => setDragging(undefined)}
|
|
310
|
-
|
|
323
|
+
onDragEnter={takeMove}
|
|
324
|
+
onDragOver={takeMove}
|
|
311
325
|
onDragStart={() => setDragging(name)}
|
|
312
326
|
onDrop={() => {
|
|
313
327
|
if (dragging && dragging !== name) {
|
|
@@ -549,7 +563,7 @@ const CommandEditor = ({
|
|
|
549
563
|
onChange,
|
|
550
564
|
}: {
|
|
551
565
|
command: Command | undefined;
|
|
552
|
-
/** Where the project's own skills are saved: "
|
|
566
|
+
/** Where the project's own skills are saved: "dex/skills". */
|
|
553
567
|
folder: string;
|
|
554
568
|
onBack: () => void;
|
|
555
569
|
onChange: (answer: CommandsAnswer) => void;
|
package/app/pages/render.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { type ComponentType, Suspense, useEffect, useMemo } from "react";
|
|
|
4
4
|
import { type FileError, placeOf } from "../../src/shared/file-errors.ts";
|
|
5
5
|
import { tellStudio, VIEW_RENDERED } from "../../src/shared/page-messages.ts";
|
|
6
6
|
import { useFileErrors } from "../frame/file-errors";
|
|
7
|
+
import { isLoadFailure } from "../frame/view-loads";
|
|
7
8
|
import { useInspectOverrides } from "../kit/inspect-runtime";
|
|
8
9
|
import { Boundary } from "../ui/boundary";
|
|
9
10
|
|
|
@@ -51,7 +52,9 @@ const useReportHeight = () => {
|
|
|
51
52
|
* Marks the page once its view has rendered, past the spinner: a canvas
|
|
52
53
|
* frame shows its page only then, and pictures of views
|
|
53
54
|
* (src/content/screenshot.ts) wait for it, so the page of a view that is not
|
|
54
|
-
* there yet, which has only a note, is never pictured.
|
|
55
|
+
* there yet, which has only a note, is never pictured. Marked again for each
|
|
56
|
+
* other view it renders, such as one loaded again once fixed, so an agent's
|
|
57
|
+
* presence takes it as a page of its own (app/shell/presence.tsx).
|
|
55
58
|
*/
|
|
56
59
|
const MarkRendered = () => {
|
|
57
60
|
useEffect(() => {
|
|
@@ -62,10 +65,6 @@ const MarkRendered = () => {
|
|
|
62
65
|
return null;
|
|
63
66
|
};
|
|
64
67
|
|
|
65
|
-
// How each browser says a module failed to load: Chromium, Firefox, Safari.
|
|
66
|
-
const LOAD_FAILED_RE =
|
|
67
|
-
/dynamically imported module|Importing a module script failed/;
|
|
68
|
-
|
|
69
68
|
/**
|
|
70
69
|
* Why the view's module didn't load, from the files the server can't read:
|
|
71
70
|
* this prototype's first, as the address the browser names may be the view
|
|
@@ -78,17 +77,26 @@ const loadErrorOf = (
|
|
|
78
77
|
(slug && errors.find((found) => found.path.startsWith(`files/${slug}/`))) ||
|
|
79
78
|
errors[0];
|
|
80
79
|
|
|
80
|
+
/**
|
|
81
|
+
* What a view that couldn't load says when no file is to blame. With a
|
|
82
|
+
* development server it tries again as files change (frame/view-loads.ts);
|
|
83
|
+
* a built studio has none, and only a new page fetches the view again.
|
|
84
|
+
*/
|
|
85
|
+
const UNLOADED_NOTE = import.meta.hot
|
|
86
|
+
? "Something it imports didn’t load. It tries again when a file changes."
|
|
87
|
+
: "Something it imports didn’t load. Loading the page again may bring it back.";
|
|
88
|
+
|
|
81
89
|
/**
|
|
82
90
|
* A view that threw while rendering, or whose file couldn't load, with why.
|
|
83
91
|
* A prototype's frame carries none of Dex's words: they load only for Dex's
|
|
84
92
|
* own frame pages (frame/studio-view.tsx). So this says it plainly, in
|
|
85
|
-
* English. It goes once the file is fixed
|
|
93
|
+
* English. It goes once the file is fixed, or, when the server names no
|
|
94
|
+
* file, once a change lets it load (frame/view-loads.ts).
|
|
86
95
|
*/
|
|
87
96
|
const ViewBroke = ({ error, slug }: { error: Error; slug?: string }) => {
|
|
88
97
|
const errors = useFileErrors();
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
: undefined;
|
|
98
|
+
const unloaded = isLoadFailure(error);
|
|
99
|
+
const found = unloaded ? loadErrorOf(errors, slug) : undefined;
|
|
92
100
|
const where = found ? placeOf(found) : undefined;
|
|
93
101
|
return (
|
|
94
102
|
<div
|
|
@@ -96,7 +104,7 @@ const ViewBroke = ({ error, slug }: { error: Error; slug?: string }) => {
|
|
|
96
104
|
role="alert"
|
|
97
105
|
>
|
|
98
106
|
<p className="font-medium">
|
|
99
|
-
{
|
|
107
|
+
{unloaded
|
|
100
108
|
? "This view can’t load."
|
|
101
109
|
: "This view hit an error while rendering."}
|
|
102
110
|
</p>
|
|
@@ -105,6 +113,9 @@ const ViewBroke = ({ error, slug }: { error: Error; slug?: string }) => {
|
|
|
105
113
|
{where}
|
|
106
114
|
</p>
|
|
107
115
|
) : null}
|
|
116
|
+
{unloaded && !found ? (
|
|
117
|
+
<p className="text-muted-foreground text-sm">{UNLOADED_NOTE}</p>
|
|
118
|
+
) : null}
|
|
108
119
|
<pre className="max-w-full overflow-auto whitespace-pre-wrap text-muted-foreground text-xs">
|
|
109
120
|
{found?.message ?? error.message}
|
|
110
121
|
</pre>
|
|
@@ -117,6 +128,23 @@ const ViewBroke = ({ error, slug }: { error: Error; slug?: string }) => {
|
|
|
117
128
|
);
|
|
118
129
|
};
|
|
119
130
|
|
|
131
|
+
/**
|
|
132
|
+
* A number for each view the page renders, its mark's key: another view
|
|
133
|
+
* mounts the mark afresh, which takes it off and puts it back.
|
|
134
|
+
*/
|
|
135
|
+
const viewNumbers = new WeakMap<ComponentType, number>();
|
|
136
|
+
let viewsNumbered = 0;
|
|
137
|
+
|
|
138
|
+
const numberOf = (view: ComponentType): number => {
|
|
139
|
+
let number = viewNumbers.get(view);
|
|
140
|
+
if (number === undefined) {
|
|
141
|
+
viewsNumbered += 1;
|
|
142
|
+
number = viewsNumbered;
|
|
143
|
+
viewNumbers.set(view, number);
|
|
144
|
+
}
|
|
145
|
+
return number;
|
|
146
|
+
};
|
|
147
|
+
|
|
120
148
|
/** One view, as a frame or a link shows it: on the page, in the provider. */
|
|
121
149
|
export const RenderedView = ({
|
|
122
150
|
Component,
|
|
@@ -155,7 +183,7 @@ export const RenderedView = ({
|
|
|
155
183
|
<Component />
|
|
156
184
|
</StudioProvider>
|
|
157
185
|
</Boundary>
|
|
158
|
-
<MarkRendered />
|
|
186
|
+
<MarkRendered key={numberOf(Component)} />
|
|
159
187
|
</Suspense>
|
|
160
188
|
</div>
|
|
161
189
|
);
|
package/app/shell/bell.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
useSyncExternalStore,
|
|
19
19
|
} from "react";
|
|
20
20
|
import { isClosed, threadState } from "../../src/shared/threads-core.ts";
|
|
21
|
+
import { useMentionable } from "../canvas/mentions";
|
|
21
22
|
import { Tip } from "../canvas/tip";
|
|
22
23
|
import { CAN_WRITE, HAS_COMMENTS, useMe } from "../live/studio-api";
|
|
23
24
|
import { findPrototype } from "../registry";
|
|
@@ -152,6 +153,7 @@ const BellPopover = ({
|
|
|
152
153
|
count,
|
|
153
154
|
filter,
|
|
154
155
|
label,
|
|
156
|
+
canBeMentioned = false,
|
|
155
157
|
name,
|
|
156
158
|
onFilter,
|
|
157
159
|
onOpenChange,
|
|
@@ -163,6 +165,8 @@ const BellPopover = ({
|
|
|
163
165
|
filter: ThreadFilter;
|
|
164
166
|
/** Its tip. */
|
|
165
167
|
label: string;
|
|
168
|
+
/** Mentions among the filters: you are someone who can be mentioned. */
|
|
169
|
+
canBeMentioned?: boolean;
|
|
166
170
|
/** What the button says it is, with what is new. */
|
|
167
171
|
name: string;
|
|
168
172
|
onFilter: (filter: ThreadFilter) => void;
|
|
@@ -199,12 +203,12 @@ const BellPopover = ({
|
|
|
199
203
|
</Tip>
|
|
200
204
|
<PopoverContent
|
|
201
205
|
align="start"
|
|
202
|
-
className="
|
|
206
|
+
className={cn("gap-0 p-1", canBeMentioned ? "w-96" : "w-80")}
|
|
203
207
|
side="bottom"
|
|
204
208
|
sideOffset={6}
|
|
205
209
|
>
|
|
206
210
|
<div className="flex items-center justify-between gap-2 px-2 py-1.5">
|
|
207
|
-
<PopoverTitle className="studio-small font-medium">
|
|
211
|
+
<PopoverTitle className="studio-small whitespace-nowrap font-medium">
|
|
208
212
|
<Trans>Comments</Trans>
|
|
209
213
|
{count > 0 ? (
|
|
210
214
|
// How many are new: here, not on the bell, which has only a dot.
|
|
@@ -213,7 +217,11 @@ const BellPopover = ({
|
|
|
213
217
|
</span>
|
|
214
218
|
) : null}
|
|
215
219
|
</PopoverTitle>
|
|
216
|
-
<ThreadFilterTabs
|
|
220
|
+
<ThreadFilterTabs
|
|
221
|
+
canBeMentioned={canBeMentioned}
|
|
222
|
+
onChange={onFilter}
|
|
223
|
+
value={filter}
|
|
224
|
+
/>
|
|
217
225
|
</div>
|
|
218
226
|
{children}
|
|
219
227
|
</PopoverContent>
|
|
@@ -251,6 +259,7 @@ const NotificationsBell = ({
|
|
|
251
259
|
const threads = every.filter((thread) => !thread.review);
|
|
252
260
|
const { _ } = useLingui();
|
|
253
261
|
const me = useMe().contributor?.name;
|
|
262
|
+
const mentionable = useMentionable();
|
|
254
263
|
const seen = useSeen();
|
|
255
264
|
// While open, the popover lists what was new when it opened.
|
|
256
265
|
const [openedFrom, setOpenedFrom] = useState<number>();
|
|
@@ -264,8 +273,8 @@ const NotificationsBell = ({
|
|
|
264
273
|
: threads
|
|
265
274
|
.filter((thread) => !(isClosed(thread) || fresh.includes(thread)))
|
|
266
275
|
.sort(newestFirst);
|
|
267
|
-
const shownFresh = fresh.filter(byFilter(filter));
|
|
268
|
-
const shownOthers = others.filter(byFilter(filter));
|
|
276
|
+
const shownFresh = fresh.filter(byFilter(filter, mentionable));
|
|
277
|
+
const shownOthers = others.filter(byFilter(filter, mentionable));
|
|
269
278
|
const close = () => setOpenedFrom(undefined);
|
|
270
279
|
const open = () => {
|
|
271
280
|
setOpenedFrom(seen);
|
|
@@ -275,6 +284,7 @@ const NotificationsBell = ({
|
|
|
275
284
|
|
|
276
285
|
return (
|
|
277
286
|
<BellPopover
|
|
287
|
+
canBeMentioned={mentionable !== undefined}
|
|
278
288
|
count={count}
|
|
279
289
|
filter={filter}
|
|
280
290
|
label={_(msg`Notifications`)}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Plural, Trans, useLingui } from "@lingui/react/macro";
|
|
2
2
|
import { Icon } from "@studio/icons";
|
|
3
|
+
import { useFileDrop } from "@studio/ui/file-drop";
|
|
3
4
|
import { Segmented } from "@studio/ui/segmented";
|
|
4
5
|
import {
|
|
5
6
|
Attachment,
|
|
@@ -23,7 +24,6 @@ import { Textarea } from "@studio/ui/shadcn/textarea";
|
|
|
23
24
|
import { cn } from "cn";
|
|
24
25
|
import {
|
|
25
26
|
type ClipboardEvent,
|
|
26
|
-
type DragEvent,
|
|
27
27
|
type FormEvent,
|
|
28
28
|
type KeyboardEvent,
|
|
29
29
|
type ReactNode,
|
|
@@ -53,7 +53,9 @@ import { PRODUCT } from "../../src/shared/product.ts";
|
|
|
53
53
|
// what was written when it doesn't go. The same form serves Dex's dialog
|
|
54
54
|
// and the extension's page (extension/feedback.tsx), which starts it with the
|
|
55
55
|
// page's screenshot attached; Markup ports it, line for line, into its shadow
|
|
56
|
-
// root.
|
|
56
|
+
// root. Each puts it on a surface with no padding of its own: the form pads
|
|
57
|
+
// itself, so it fills the surface to the edge and a file dropped anywhere on
|
|
58
|
+
// what looks like the form lands on it, not on the page, which would open it.
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
61
|
* Dex information, sent when the person keeps "Add Dex information"
|
|
@@ -117,7 +119,6 @@ export const FeedbackForm = ({
|
|
|
117
119
|
const [files, setFiles] = useState<File[]>(draft.files ?? []);
|
|
118
120
|
const [withDetails, setWithDetails] = useState(true);
|
|
119
121
|
const [status, setStatus] = useState<Status>({ step: "writing" });
|
|
120
|
-
const [over, setOver] = useState(false);
|
|
121
122
|
|
|
122
123
|
const feedback: Feedback = {
|
|
123
124
|
kind,
|
|
@@ -149,6 +150,9 @@ export const FeedbackForm = ({
|
|
|
149
150
|
// Every file, so one it can't take stays to say why, not vanish.
|
|
150
151
|
setFiles((current) => [...current, ...more]);
|
|
151
152
|
|
|
153
|
+
// A file dropped anywhere on the form attaches.
|
|
154
|
+
const { over, zone } = useFileDrop(attach);
|
|
155
|
+
|
|
152
156
|
if (status.step === "sent") {
|
|
153
157
|
return <Thanks email={status.email} onClose={onClose} />;
|
|
154
158
|
}
|
|
@@ -164,24 +168,9 @@ export const FeedbackForm = ({
|
|
|
164
168
|
// biome-ignore lint/a11y/noNoninteractiveElementInteractions: ⌘Enter sends from any field, and files dropped anywhere on the form attach
|
|
165
169
|
<form
|
|
166
170
|
aria-labelledby={`${ids}-title`}
|
|
167
|
-
className="flex min-w-0 flex-col gap-4"
|
|
171
|
+
className="flex min-w-0 flex-col gap-4 p-6"
|
|
168
172
|
noValidate
|
|
169
|
-
|
|
170
|
-
if (!event.currentTarget.contains(event.relatedTarget as Node)) {
|
|
171
|
-
setOver(false);
|
|
172
|
-
}
|
|
173
|
-
}}
|
|
174
|
-
onDragOver={(event: DragEvent) => {
|
|
175
|
-
if (event.dataTransfer.types.includes("Files")) {
|
|
176
|
-
event.preventDefault();
|
|
177
|
-
setOver(true);
|
|
178
|
-
}
|
|
179
|
-
}}
|
|
180
|
-
onDrop={(event: DragEvent) => {
|
|
181
|
-
event.preventDefault();
|
|
182
|
-
setOver(false);
|
|
183
|
-
attach([...event.dataTransfer.files]);
|
|
184
|
-
}}
|
|
173
|
+
{...zone}
|
|
185
174
|
onKeyDown={(event: KeyboardEvent) => {
|
|
186
175
|
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
|
|
187
176
|
event.preventDefault();
|
|
@@ -608,7 +597,7 @@ const Thumbnail = ({ file }: { file: File }) => {
|
|
|
608
597
|
|
|
609
598
|
/** Sent: thanks, where a reply would go, and a way out. */
|
|
610
599
|
const Thanks = ({ email, onClose }: { email: string; onClose: () => void }) => (
|
|
611
|
-
<div className="flex flex-col items-center gap-3 py-
|
|
600
|
+
<div className="flex flex-col items-center gap-3 px-6 py-10 text-center">
|
|
612
601
|
<span className="flex size-10 items-center justify-center rounded-xl bg-muted">
|
|
613
602
|
<Icon className="size-5" name="CircleCheck" />
|
|
614
603
|
</span>
|
|
@@ -32,9 +32,10 @@ export const FeedbackLink = ({ className }: { className: string }) => {
|
|
|
32
32
|
</Tip>
|
|
33
33
|
</TipGroup>
|
|
34
34
|
<Dialog onOpenChange={setOpen} open={open}>
|
|
35
|
+
{/* No padding: the form pads itself, so a file dropped on its edge lands on it. */}
|
|
35
36
|
<DialogContent
|
|
36
37
|
aria-label={t`Send feedback`}
|
|
37
|
-
className="max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-md"
|
|
38
|
+
className="max-h-[calc(100dvh-2rem)] overflow-y-auto p-0 sm:max-w-md"
|
|
38
39
|
showCloseButton={false}
|
|
39
40
|
>
|
|
40
41
|
<DexFeedback onClose={() => setOpen(false)} />
|