@sixb/app 0.2.3 → 0.2.5
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/assets/connector-icons/README.md +1 -0
- package/assets/connector-icons/ctm.png +0 -0
- package/dist/agent/activity-label.d.ts.map +1 -1
- package/dist/agent/agent-chat.d.ts +3 -1
- package/dist/agent/agent-chat.d.ts.map +1 -1
- package/dist/agent/agent-panel.d.ts.map +1 -1
- package/dist/agent/artifact-panel.d.ts +3 -1
- package/dist/agent/artifact-panel.d.ts.map +1 -1
- package/dist/agent/background/background-tool-row.d.ts.map +1 -1
- package/dist/agent/background/interpret.d.ts +1 -1
- package/dist/agent/background/interpret.d.ts.map +1 -1
- package/dist/agent/components/composer-settings.d.ts +1 -1
- package/dist/agent/components/composer-settings.d.ts.map +1 -1
- package/dist/agent/components/composer.d.ts +22 -5
- package/dist/agent/components/composer.d.ts.map +1 -1
- package/dist/agent/components/context-meter.d.ts +1 -1
- package/dist/agent/components/context-meter.d.ts.map +1 -1
- package/dist/agent/components/conversation-panel.d.ts +8 -2
- package/dist/agent/components/conversation-panel.d.ts.map +1 -1
- package/dist/agent/components/message-parts.d.ts +2 -1
- package/dist/agent/components/message-parts.d.ts.map +1 -1
- package/dist/agent/components/message-view.d.ts.map +1 -1
- package/dist/agent/components/pending-messages.d.ts +20 -0
- package/dist/agent/components/pending-messages.d.ts.map +1 -0
- package/dist/agent/components/sandbox-recovery.d.ts +11 -2
- package/dist/agent/components/sandbox-recovery.d.ts.map +1 -1
- package/dist/agent/components/threads-button.d.ts +1 -1
- package/dist/agent/components/threads-button.d.ts.map +1 -1
- package/dist/agent/components/transcript.d.ts +5 -0
- package/dist/agent/components/transcript.d.ts.map +1 -1
- package/dist/agent/conversation.d.ts +3 -6
- package/dist/agent/conversation.d.ts.map +1 -1
- package/dist/agent/delegation/agent-exchange.d.ts +16 -0
- package/dist/agent/delegation/agent-exchange.d.ts.map +1 -0
- package/dist/agent/delegation/child-card.d.ts +3 -3
- package/dist/agent/delegation/child-card.d.ts.map +1 -1
- package/dist/agent/delegation/child-parts.d.ts +1 -10
- package/dist/agent/delegation/child-parts.d.ts.map +1 -1
- package/dist/agent/delegation/child-work.d.ts.map +1 -1
- package/dist/agent/delegation/interpret.d.ts +9 -10
- package/dist/agent/delegation/interpret.d.ts.map +1 -1
- package/dist/agent/delegation/use-children.d.ts.map +1 -1
- package/dist/agent/file-edits/file-edit-tool-view.d.ts +10 -0
- package/dist/agent/file-edits/file-edit-tool-view.d.ts.map +1 -0
- package/dist/agent/file-edits/interpret.d.ts +25 -0
- package/dist/agent/file-edits/interpret.d.ts.map +1 -0
- package/dist/agent/hooks/use-agent-conversation.d.ts +16 -4
- package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
- package/dist/agent/hooks/use-thread-stream.d.ts.map +1 -1
- package/dist/agent/i18n/en.d.ts +114 -5
- package/dist/agent/i18n/en.d.ts.map +1 -1
- package/dist/agent/i18n/fr.d.ts.map +1 -1
- package/dist/agent/i18n/index.d.ts +190 -8
- package/dist/agent/i18n/index.d.ts.map +1 -1
- package/dist/agent/inbox-handoff.d.ts +10 -0
- package/dist/agent/inbox-handoff.d.ts.map +1 -0
- package/dist/agent/live-run.d.ts +8 -1
- package/dist/agent/live-run.d.ts.map +1 -1
- package/dist/agent/message-agent/interpret.d.ts +2 -2
- package/dist/agent/message-agent/interpret.d.ts.map +1 -1
- package/dist/agent/publish-artifact/interpret.d.ts +1 -1
- package/dist/agent/publish-artifact/interpret.d.ts.map +1 -1
- package/dist/agent/questions/interpret.d.ts +31 -0
- package/dist/agent/questions/interpret.d.ts.map +1 -0
- package/dist/agent/questions/question-card.d.ts +16 -0
- package/dist/agent/questions/question-card.d.ts.map +1 -0
- package/dist/agent/questions/question-composer.d.ts +15 -0
- package/dist/agent/questions/question-composer.d.ts.map +1 -0
- package/dist/agent/read/interpret.d.ts +8 -1
- package/dist/agent/read/interpret.d.ts.map +1 -1
- package/dist/agent/read/read-tool-view.d.ts.map +1 -1
- package/dist/agent/search/interpret.d.ts +101 -0
- package/dist/agent/search/interpret.d.ts.map +1 -0
- package/dist/agent/search/search-tool-view.d.ts +10 -0
- package/dist/agent/search/search-tool-view.d.ts.map +1 -0
- package/dist/agent/thread-state.d.ts +26 -0
- package/dist/agent/thread-state.d.ts.map +1 -0
- package/dist/agent/tool-views/built-in.d.ts.map +1 -1
- package/dist/agent/tool-views/registry.d.ts +5 -6
- package/dist/agent/tool-views/registry.d.ts.map +1 -1
- package/dist/agent/types.d.ts +5 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/view-file/view-file-tool-view.d.ts +2 -1
- package/dist/agent/view-file/view-file-tool-view.d.ts.map +1 -1
- package/dist/agent/waits.d.ts +14 -0
- package/dist/agent/waits.d.ts.map +1 -0
- package/dist/artifacts/card-preview.d.ts.map +1 -1
- package/dist/artifacts/edit-session.d.ts +11 -1
- package/dist/artifacts/edit-session.d.ts.map +1 -1
- package/dist/artifacts/editor/block-handle.d.ts +20 -0
- package/dist/artifacts/editor/block-handle.d.ts.map +1 -0
- package/dist/artifacts/editor/blocks.d.ts +34 -0
- package/dist/artifacts/editor/blocks.d.ts.map +1 -0
- package/dist/artifacts/editor/callout-view.d.ts +7 -0
- package/dist/artifacts/editor/callout-view.d.ts.map +1 -0
- package/dist/artifacts/editor/document-editor.d.ts +30 -0
- package/dist/artifacts/editor/document-editor.d.ts.map +1 -0
- package/dist/artifacts/editor/figure-view.d.ts +12 -0
- package/dist/artifacts/editor/figure-view.d.ts.map +1 -0
- package/dist/artifacts/editor/find-blocks.d.ts +6 -0
- package/dist/artifacts/editor/find-blocks.d.ts.map +1 -0
- package/dist/artifacts/editor/markdown-document.d.ts +12 -0
- package/dist/artifacts/editor/markdown-document.d.ts.map +1 -0
- package/dist/artifacts/editor/messages.d.ts +4 -0
- package/dist/artifacts/editor/messages.d.ts.map +1 -0
- package/dist/artifacts/editor/schema.d.ts +21 -0
- package/dist/artifacts/editor/schema.d.ts.map +1 -0
- package/dist/artifacts/editor/selection-toolbar.d.ts +35 -0
- package/dist/artifacts/editor/selection-toolbar.d.ts.map +1 -0
- package/dist/artifacts/editor/slash-menu.d.ts +43 -0
- package/dist/artifacts/editor/slash-menu.d.ts.map +1 -0
- package/dist/artifacts/editor/upload.d.ts +12 -0
- package/dist/artifacts/editor/upload.d.ts.map +1 -0
- package/dist/artifacts/file-source.d.ts +5 -0
- package/dist/artifacts/file-source.d.ts.map +1 -1
- package/dist/artifacts/frame-editor/bundle.d.ts +7 -0
- package/dist/artifacts/frame-editor/bundle.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/commands.d.ts +93 -0
- package/dist/artifacts/frame-editor/commands.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/entry.d.ts +2 -0
- package/dist/artifacts/frame-editor/entry.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/frame.d.ts +5 -0
- package/dist/artifacts/frame-editor/frame.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/keys.d.ts +8 -0
- package/dist/artifacts/frame-editor/keys.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/protocol.d.ts +186 -0
- package/dist/artifacts/frame-editor/protocol.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/schema.d.ts +34 -0
- package/dist/artifacts/frame-editor/schema.d.ts.map +1 -0
- package/dist/artifacts/frame-editor/style.d.ts +2 -0
- package/dist/artifacts/frame-editor/style.d.ts.map +1 -0
- package/dist/artifacts/frame.d.ts +2 -2
- package/dist/artifacts/frame.d.ts.map +1 -1
- package/dist/artifacts/live/boards.d.ts +2 -0
- package/dist/artifacts/live/boards.d.ts.map +1 -1
- package/dist/artifacts/live/document.d.ts +32 -0
- package/dist/artifacts/live/document.d.ts.map +1 -0
- package/dist/artifacts/live/header.d.ts +4 -4
- package/dist/artifacts/live/header.d.ts.map +1 -1
- package/dist/artifacts/live/presence.d.ts.map +1 -1
- package/dist/artifacts/live/session.d.ts +2 -0
- package/dist/artifacts/live/session.d.ts.map +1 -1
- package/dist/artifacts/live/view.d.ts +4 -3
- package/dist/artifacts/live/view.d.ts.map +1 -1
- package/dist/artifacts/messages.d.ts +278 -2
- package/dist/artifacts/messages.d.ts.map +1 -1
- package/dist/artifacts/pdf.d.ts +8 -0
- package/dist/artifacts/pdf.d.ts.map +1 -0
- package/dist/artifacts/queries.d.ts +80 -0
- package/dist/artifacts/queries.d.ts.map +1 -1
- package/dist/artifacts/references/references.d.ts +3 -3
- package/dist/artifacts/references/references.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board-editor.d.ts +11 -4
- package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/board.d.ts +14 -2
- package/dist/artifacts/renderers/canvas/board.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/canvas.d.ts +4 -3
- package/dist/artifacts/renderers/canvas/canvas.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts +4 -2
- package/dist/artifacts/renderers/canvas/comment-pins.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comments-panel.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/comments.d.ts +2 -1
- package/dist/artifacts/renderers/canvas/comments.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/controls.d.ts +15 -4
- package/dist/artifacts/renderers/canvas/controls.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/focus.d.ts +19 -5
- package/dist/artifacts/renderers/canvas/focus.d.ts.map +1 -1
- package/dist/artifacts/renderers/canvas/gestures.d.ts +46 -0
- package/dist/artifacts/renderers/canvas/gestures.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-resize.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/page-resize.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-size-controls.d.ts +21 -0
- package/dist/artifacts/renderers/canvas/page-size-controls.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-size.d.ts +93 -0
- package/dist/artifacts/renderers/canvas/page-size.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/page-zoom.d.ts +64 -0
- package/dist/artifacts/renderers/canvas/page-zoom.d.ts.map +1 -0
- package/dist/artifacts/renderers/canvas/shown-size.d.ts +26 -0
- package/dist/artifacts/renderers/canvas/shown-size.d.ts.map +1 -0
- package/dist/artifacts/renderers/designed-document.d.ts +28 -0
- package/dist/artifacts/renderers/designed-document.d.ts.map +1 -0
- package/dist/artifacts/renderers/document-tree.d.ts +2 -0
- package/dist/artifacts/renderers/document-tree.d.ts.map +1 -1
- package/dist/artifacts/renderers/document.d.ts +9 -1
- package/dist/artifacts/renderers/document.d.ts.map +1 -1
- package/dist/artifacts/renderers/live-frame.d.ts +145 -0
- package/dist/artifacts/renderers/live-frame.d.ts.map +1 -0
- package/dist/artifacts/renderers/page-editor.d.ts +16 -0
- package/dist/artifacts/renderers/page-editor.d.ts.map +1 -0
- package/dist/artifacts/renderers/page.d.ts +10 -1
- package/dist/artifacts/renderers/page.d.ts.map +1 -1
- package/dist/artifacts/viewer.d.ts.map +1 -1
- package/dist/{chunk-001c4gnk.js → chunk-4fex83k2.js} +19965 -13027
- package/dist/chunk-4fex83k2.js.map +239 -0
- package/dist/{chunk-5crvhjp2.js → chunk-4wm09prf.js} +1633 -1999
- package/dist/chunk-4wm09prf.js.map +27 -0
- package/dist/{chunk-fwb9mxwm.js → chunk-5sgac68y.js} +1 -1
- package/dist/{chunk-kes4ygmz.js → chunk-69qgh20f.js} +1 -1
- package/dist/chunk-y51c4tsz.js +11 -0
- package/dist/chunk-y51c4tsz.js.map +10 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -6
- package/dist/index.js.map +5 -5
- package/dist/pages/console/data/messages.d.ts +6 -0
- package/dist/pages/console/data/messages.d.ts.map +1 -1
- package/dist/pages/console/data/shared.d.ts.map +1 -1
- package/dist/pages.js +12 -5
- package/dist/pages.js.map +6 -6
- package/dist/shell/search-command.d.ts.map +1 -1
- package/package.json +22 -5
- package/src/agent/activity-label.ts +9 -1
- package/src/agent/agent-chat.tsx +57 -37
- package/src/agent/agent-execution-trace.tsx +2 -2
- package/src/agent/agent-panel.tsx +6 -4
- package/src/agent/agent.css +254 -0
- package/src/agent/artifact-panel.tsx +77 -22
- package/src/agent/background/background-tool-row.tsx +24 -10
- package/src/agent/background/interpret.ts +60 -51
- package/src/agent/components/composer-settings.tsx +20 -10
- package/src/agent/components/composer.tsx +342 -104
- package/src/agent/components/context-meter.tsx +7 -3
- package/src/agent/components/conversation-panel.tsx +96 -37
- package/src/agent/components/message-parts.tsx +390 -64
- package/src/agent/components/message-view.tsx +12 -2
- package/src/agent/components/pending-messages.tsx +338 -0
- package/src/agent/components/sandbox-recovery.tsx +36 -17
- package/src/agent/components/threads-button.tsx +3 -2
- package/src/agent/components/transcript.tsx +92 -45
- package/src/agent/conversation.ts +203 -54
- package/src/agent/delegation/agent-exchange.tsx +53 -0
- package/src/agent/delegation/child-card.tsx +6 -40
- package/src/agent/delegation/child-parts.tsx +1 -84
- package/src/agent/delegation/child-work.tsx +19 -5
- package/src/agent/delegation/interpret.ts +64 -61
- package/src/agent/delegation/model.ts +1 -1
- package/src/agent/file-edits/file-edit-tool-view.tsx +126 -0
- package/src/agent/file-edits/interpret.ts +120 -0
- package/src/agent/hooks/use-agent-conversation.ts +360 -92
- package/src/agent/hooks/use-thread-stream.ts +10 -0
- package/src/agent/i18n/en.ts +134 -16
- package/src/agent/i18n/fr.ts +122 -16
- package/src/agent/inbox-handoff.ts +47 -0
- package/src/agent/live-run.ts +23 -2
- package/src/agent/message-agent/interpret.ts +4 -3
- package/src/agent/publish-artifact/interpret.ts +14 -5
- package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +2 -2
- package/src/agent/questions/interpret.ts +90 -0
- package/src/agent/questions/question-card.tsx +57 -0
- package/src/agent/questions/question-composer.tsx +257 -0
- package/src/agent/react-router.tsx +2 -2
- package/src/agent/read/interpret.ts +34 -1
- package/src/agent/read/read-tool-view.tsx +20 -4
- package/src/agent/search/interpret.ts +367 -0
- package/src/agent/search/search-tool-view.tsx +235 -0
- package/src/agent/thread-state.ts +114 -0
- package/src/agent/tool-views/built-in.tsx +33 -6
- package/src/agent/tool-views/registry.tsx +28 -2
- package/src/agent/types.ts +7 -0
- package/src/agent/view-file/view-file-tool-view.tsx +33 -19
- package/src/agent/waits.ts +50 -0
- package/src/artifacts/artifacts.css +434 -0
- package/src/artifacts/card-preview.tsx +6 -1
- package/src/artifacts/edit-session.tsx +15 -1
- package/src/artifacts/editor/block-handle.tsx +278 -0
- package/src/artifacts/editor/blocks.ts +216 -0
- package/src/artifacts/editor/callout-view.tsx +31 -0
- package/src/artifacts/editor/document-editor.tsx +484 -0
- package/src/artifacts/editor/figure-view.tsx +66 -0
- package/src/artifacts/editor/find-blocks.ts +19 -0
- package/src/artifacts/editor/markdown-document.tsx +72 -0
- package/src/artifacts/editor/messages.ts +4 -0
- package/src/artifacts/editor/schema.ts +159 -0
- package/src/artifacts/editor/selection-toolbar.tsx +364 -0
- package/src/artifacts/editor/slash-menu.tsx +251 -0
- package/src/artifacts/editor/upload.ts +40 -0
- package/src/artifacts/file-source.ts +11 -0
- package/src/artifacts/frame-editor/bundle.ts +8 -0
- package/src/artifacts/frame-editor/commands.ts +565 -0
- package/src/artifacts/frame-editor/entry.ts +6 -0
- package/src/artifacts/frame-editor/frame.ts +847 -0
- package/src/artifacts/frame-editor/generated/editor.txt +149 -0
- package/src/artifacts/frame-editor/generated.d.ts +5 -0
- package/src/artifacts/frame-editor/keys.ts +323 -0
- package/src/artifacts/frame-editor/protocol.ts +151 -0
- package/src/artifacts/frame-editor/schema.ts +293 -0
- package/src/artifacts/frame-editor/style.ts +58 -0
- package/src/artifacts/frame.tsx +14 -5
- package/src/artifacts/live/boards.ts +46 -3
- package/src/artifacts/live/document.ts +89 -0
- package/src/artifacts/live/header.tsx +9 -14
- package/src/artifacts/live/presence.ts +5 -1
- package/src/artifacts/live/session.ts +4 -2
- package/src/artifacts/live/view.ts +14 -8
- package/src/artifacts/messages.ts +192 -2
- package/src/artifacts/pdf.ts +50 -0
- package/src/artifacts/references/references.tsx +46 -11
- package/src/artifacts/renderers/canvas/board-editor.tsx +44 -155
- package/src/artifacts/renderers/canvas/board.tsx +70 -8
- package/src/artifacts/renderers/canvas/canvas.tsx +66 -15
- package/src/artifacts/renderers/canvas/comment-pins.tsx +5 -0
- package/src/artifacts/renderers/canvas/comments-panel.tsx +58 -1
- package/src/artifacts/renderers/canvas/comments.ts +8 -4
- package/src/artifacts/renderers/canvas/controls.tsx +64 -30
- package/src/artifacts/renderers/canvas/focus.tsx +200 -56
- package/src/artifacts/renderers/canvas/gestures.ts +265 -0
- package/src/artifacts/renderers/canvas/page-resize.tsx +542 -0
- package/src/artifacts/renderers/canvas/page-size-controls.tsx +193 -0
- package/src/artifacts/renderers/canvas/page-size.ts +218 -0
- package/src/artifacts/renderers/canvas/page-zoom.ts +280 -0
- package/src/artifacts/renderers/canvas/shown-size.ts +105 -0
- package/src/artifacts/renderers/designed-document.tsx +277 -0
- package/src/artifacts/renderers/document-tree.ts +9 -0
- package/src/artifacts/renderers/document.tsx +13 -102
- package/src/artifacts/renderers/live-frame.ts +163 -0
- package/src/artifacts/renderers/page-editor.tsx +613 -0
- package/src/artifacts/renderers/page.tsx +21 -4
- package/src/artifacts/viewer.tsx +101 -41
- package/src/index.ts +8 -0
- package/src/pages/console/data/messages.ts +6 -0
- package/src/pages/console/data/projections.tsx +4 -0
- package/src/pages/console/data/shared.tsx +1 -0
- package/src/pages/console/ontology/lineage/trail.tsx +3 -0
- package/src/shell/search-command.tsx +2 -0
- package/dist/chunk-001c4gnk.js.map +0 -204
- package/dist/chunk-5crvhjp2.js.map +0 -28
- /package/dist/{chunk-fwb9mxwm.js.map → chunk-5sgac68y.js.map} +0 -0
- /package/dist/{chunk-kes4ygmz.js.map → chunk-69qgh20f.js.map} +0 -0
|
@@ -18,6 +18,8 @@ import { cn } from "@sixb/ui/lib/utils"
|
|
|
18
18
|
import {
|
|
19
19
|
Check,
|
|
20
20
|
CornerDownRight,
|
|
21
|
+
Eye,
|
|
22
|
+
Lock,
|
|
21
23
|
MessageSquare,
|
|
22
24
|
MessageSquarePlus,
|
|
23
25
|
MoreHorizontal,
|
|
@@ -34,6 +36,7 @@ import {
|
|
|
34
36
|
useRef,
|
|
35
37
|
useState,
|
|
36
38
|
} from "react"
|
|
39
|
+
import { useSharedGuest } from "../../../shared-session"
|
|
37
40
|
import { GuestBadge } from "../../guest-badge"
|
|
38
41
|
import { useArtifactMessages } from "../../messages"
|
|
39
42
|
import { PersonAvatar } from "../../person-avatar"
|
|
@@ -49,6 +52,10 @@ import {
|
|
|
49
52
|
// who wrote it and its replies, resolved, reopened, replied to or deleted in place. The reader
|
|
50
53
|
// picks some to send to the Agent, which puts them, quoted with where they are, in the message
|
|
51
54
|
// they are writing. Beside the canvas while it is wide, a sheet over its foot on a phone.
|
|
55
|
+
//
|
|
56
|
+
// A member is told who reads what: a reply in a guest's thread reaches the guest, and once guests
|
|
57
|
+
// comment on the canvas, the team's own threads are marked internal. A guest reads only their
|
|
58
|
+
// link's threads, as the API lists them, and is told nothing of the others.
|
|
52
59
|
|
|
53
60
|
export type CommentFilter = "open" | "resolved"
|
|
54
61
|
|
|
@@ -102,6 +109,11 @@ export function CommentsPanel({
|
|
|
102
109
|
const [sent, setSent] = useState(false)
|
|
103
110
|
const [failure, setFailure] = useState<string | null>(null)
|
|
104
111
|
|
|
112
|
+
// Guests reach the canvas once one has commented: the team's own threads then say so. A guest
|
|
113
|
+
// is listed no thread of the team's.
|
|
114
|
+
const member = useSharedGuest() === null
|
|
115
|
+
const guestsHere = threads.some((thread) => thread.comment.author.type === "guest")
|
|
116
|
+
|
|
105
117
|
// What is chosen stays among the threads shown.
|
|
106
118
|
useEffect(() => {
|
|
107
119
|
setChosen((current) => {
|
|
@@ -254,6 +266,12 @@ export function CommentsPanel({
|
|
|
254
266
|
choosing={choosing}
|
|
255
267
|
chosen={chosen.has(thread.comment.id)}
|
|
256
268
|
nameOf={nameOf}
|
|
269
|
+
guest={
|
|
270
|
+
member && thread.comment.author.type === "guest"
|
|
271
|
+
? (nameOf(thread.comment)?.name ?? messages.guest)
|
|
272
|
+
: null
|
|
273
|
+
}
|
|
274
|
+
internal={guestsHere && thread.comment.author.type !== "guest"}
|
|
257
275
|
manages={canManage(thread.comment)}
|
|
258
276
|
onChoose={(next) =>
|
|
259
277
|
setChosen((current) => {
|
|
@@ -315,6 +333,8 @@ function ThreadCard({
|
|
|
315
333
|
choosing,
|
|
316
334
|
chosen,
|
|
317
335
|
nameOf,
|
|
336
|
+
guest,
|
|
337
|
+
internal,
|
|
318
338
|
manages,
|
|
319
339
|
onChoose,
|
|
320
340
|
onActivate,
|
|
@@ -328,6 +348,10 @@ function ThreadCard({
|
|
|
328
348
|
readonly choosing: boolean
|
|
329
349
|
readonly chosen: boolean
|
|
330
350
|
readonly nameOf: (comment: ArtifactComment) => CommentAuthor | null
|
|
351
|
+
/** The guest who started the thread, who reads its replies, as a member is told. */
|
|
352
|
+
readonly guest: string | null
|
|
353
|
+
/** The team's own thread, on a canvas guests comment on. */
|
|
354
|
+
readonly internal: boolean
|
|
331
355
|
readonly manages: boolean
|
|
332
356
|
readonly onChoose: (chosen: boolean) => void
|
|
333
357
|
readonly onActivate: () => void
|
|
@@ -419,7 +443,11 @@ function ThreadCard({
|
|
|
419
443
|
) : null}
|
|
420
444
|
</div>
|
|
421
445
|
|
|
422
|
-
<Message
|
|
446
|
+
<Message
|
|
447
|
+
comment={comment}
|
|
448
|
+
nameOf={nameOf}
|
|
449
|
+
{...(internal ? { badge: <InternalBadge /> } : {})}
|
|
450
|
+
/>
|
|
423
451
|
{replies.map((reply) => (
|
|
424
452
|
<div key={reply.id} className="mt-2.5 border-l-2 border-border/70 pl-2.5">
|
|
425
453
|
<Message comment={reply} nameOf={nameOf} />
|
|
@@ -431,6 +459,17 @@ function ThreadCard({
|
|
|
431
459
|
compact
|
|
432
460
|
autoFocus={replying}
|
|
433
461
|
placeholder={messages.replyPlaceholder}
|
|
462
|
+
notice={
|
|
463
|
+
guest ? (
|
|
464
|
+
<p
|
|
465
|
+
title={messages.guestSeesHint}
|
|
466
|
+
className="m-0 flex items-center gap-1 text-[11px] leading-4 text-muted-foreground [&_svg]:size-3 [&_svg]:shrink-0"
|
|
467
|
+
>
|
|
468
|
+
<Eye aria-hidden="true" />
|
|
469
|
+
<span className="min-w-0 truncate">{messages.guestSees(guest)}</span>
|
|
470
|
+
</p>
|
|
471
|
+
) : undefined
|
|
472
|
+
}
|
|
434
473
|
onSubmit={async (body) => {
|
|
435
474
|
await onReply(body)
|
|
436
475
|
setReplying(false)
|
|
@@ -469,6 +508,20 @@ function ThreadCard({
|
|
|
469
508
|
)
|
|
470
509
|
}
|
|
471
510
|
|
|
511
|
+
/** Beside a thread only the team reads, on a canvas guests comment on. */
|
|
512
|
+
function InternalBadge() {
|
|
513
|
+
const messages = useArtifactMessages().canvas.comments
|
|
514
|
+
return (
|
|
515
|
+
<span
|
|
516
|
+
title={messages.internalHint}
|
|
517
|
+
className="inline-flex h-4 shrink-0 items-center gap-0.5 rounded-full px-1.5 text-[10.5px] leading-none font-medium tracking-[0.01em] text-muted-foreground ring-1 ring-border/70 ring-inset [&_svg]:size-2.5"
|
|
518
|
+
>
|
|
519
|
+
<Lock aria-hidden="true" />
|
|
520
|
+
{messages.internal}
|
|
521
|
+
</span>
|
|
522
|
+
)
|
|
523
|
+
}
|
|
524
|
+
|
|
472
525
|
/** Where a thread is: its board, and its element by its first words, or that it is gone. */
|
|
473
526
|
function Where({ place }: { readonly place: ThreadPlace }) {
|
|
474
527
|
const messages = useArtifactMessages().canvas.comments
|
|
@@ -497,9 +550,12 @@ function Where({ place }: { readonly place: ThreadPlace }) {
|
|
|
497
550
|
function Message({
|
|
498
551
|
comment,
|
|
499
552
|
nameOf,
|
|
553
|
+
badge,
|
|
500
554
|
}: {
|
|
501
555
|
readonly comment: ArtifactComment
|
|
502
556
|
readonly nameOf: (comment: ArtifactComment) => CommentAuthor | null
|
|
557
|
+
/** At the end of its author's line: what the thread is, such as internal. */
|
|
558
|
+
readonly badge?: ReactNode
|
|
503
559
|
}) {
|
|
504
560
|
const messages = useArtifactMessages().canvas.comments
|
|
505
561
|
const when = useWhen()
|
|
@@ -520,6 +576,7 @@ function Message({
|
|
|
520
576
|
<time dateTime={comment.createdAt} className="shrink-0 text-muted-foreground">
|
|
521
577
|
{when(comment.createdAt)}
|
|
522
578
|
</time>
|
|
579
|
+
{badge ? <span className="ml-auto flex shrink-0 pl-1">{badge}</span> : null}
|
|
523
580
|
</div>
|
|
524
581
|
<p className="m-0 mt-1 text-sm leading-5 break-words whitespace-pre-wrap text-foreground">
|
|
525
582
|
{comment.body}
|
|
@@ -199,14 +199,17 @@ export interface CommentAuthor {
|
|
|
199
199
|
/**
|
|
200
200
|
* Who wrote a comment: the reader themselves, else the name the API gives its author, and the
|
|
201
201
|
* Agent for them when its run wrote it. A shared link's guest is marked as one, for everyone, and
|
|
202
|
-
* is "you" to themselves.
|
|
202
|
+
* is "you" to themselves. A guest never learns a member's email: one without a profile name is a
|
|
203
|
+
* team member to them, as on the canvas's presence. Null for an author the project cannot name.
|
|
203
204
|
*/
|
|
204
205
|
export function useCommentAuthors(): (
|
|
205
206
|
comment: Pick<ArtifactComment, "author" | "authorName" | "origin">
|
|
206
207
|
) => CommentAuthor | null {
|
|
207
208
|
const user = useCurrentUser()
|
|
208
209
|
const guest = useSharedGuest()
|
|
209
|
-
const
|
|
210
|
+
const all = useArtifactMessages()
|
|
211
|
+
const messages = all.canvas.comments
|
|
212
|
+
const unnamed = guest ? all.live.teamMember : null
|
|
210
213
|
|
|
211
214
|
return ({ author, authorName, origin }) => {
|
|
212
215
|
if (author.type === "guest") {
|
|
@@ -216,10 +219,11 @@ export function useCommentAuthors(): (
|
|
|
216
219
|
|
|
217
220
|
const own = author.type === "user" && author.id === user?.id
|
|
218
221
|
if (origin) {
|
|
219
|
-
const name = own ? messages.you.toLowerCase() : (authorName ?? messages.someone)
|
|
222
|
+
const name = own ? messages.you.toLowerCase() : (authorName ?? unnamed ?? messages.someone)
|
|
220
223
|
return { name: messages.agentFor(name), you: false, agent: true }
|
|
221
224
|
}
|
|
222
225
|
if (own) return { name: user.displayName ?? user.email ?? authorName ?? "", you: true }
|
|
223
|
-
|
|
226
|
+
const name = authorName ?? unnamed
|
|
227
|
+
return name ? { name, you: false } : null
|
|
224
228
|
}
|
|
225
229
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { cn } from "@sixb/ui/lib/utils"
|
|
1
2
|
import { Panel, useReactFlow, useStore } from "@xyflow/react"
|
|
2
3
|
import { Maximize, Minus, Plus } from "lucide-react"
|
|
3
4
|
import type { ReactNode } from "react"
|
|
@@ -6,46 +7,79 @@ import { useArtifactMessages } from "../../messages"
|
|
|
6
7
|
/** How long the board takes to move when a control moves it. */
|
|
7
8
|
const DURATION = 220
|
|
8
9
|
|
|
9
|
-
/**
|
|
10
|
-
* The board's zoom controls, floating in its corner: out, the zoom as a percent, which goes to 100%
|
|
11
|
-
* when pressed, in, and fit to everything. Each stays a comfortable target on a phone.
|
|
12
|
-
*/
|
|
10
|
+
/** The canvas's zoom controls, floating in its corner, moving the board as React Flow holds it. */
|
|
13
11
|
export function CanvasControls({ padding }: { readonly padding: number }) {
|
|
14
12
|
const messages = useArtifactMessages().canvas
|
|
15
13
|
const { zoomIn, zoomOut, zoomTo, fitView } = useReactFlow()
|
|
16
14
|
const zoom = useStore((state) => state.transform[2])
|
|
17
15
|
return (
|
|
18
16
|
<Panel position="bottom-left" className="!m-3">
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
className="h-8 w-12 rounded-lg text-center text-xs font-medium text-muted-foreground tabular-nums outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
|
|
28
|
-
>
|
|
29
|
-
<span aria-live="polite">{messages.zoom(Math.round(zoom * 100))}</span>
|
|
30
|
-
<span className="sr-only">, {messages.actualSize}</span>
|
|
31
|
-
</button>
|
|
32
|
-
<Control label={messages.zoomIn} onClick={() => zoomIn({ duration: DURATION })}>
|
|
33
|
-
<Plus className="size-4" aria-hidden="true" />
|
|
34
|
-
</Control>
|
|
35
|
-
<span className="mx-1 h-5 w-px bg-border" aria-hidden="true" />
|
|
36
|
-
<Control
|
|
37
|
-
label={messages.fitView}
|
|
38
|
-
onClick={() => void fitView({ padding, duration: DURATION })}
|
|
39
|
-
wide
|
|
40
|
-
>
|
|
41
|
-
<Maximize className="size-3.5" aria-hidden="true" />
|
|
42
|
-
<span className="text-xs font-medium">{messages.fit}</span>
|
|
43
|
-
</Control>
|
|
44
|
-
</div>
|
|
17
|
+
<ZoomBar
|
|
18
|
+
zoom={zoom}
|
|
19
|
+
fitLabel={messages.fitView}
|
|
20
|
+
onZoomOut={() => zoomOut({ duration: DURATION })}
|
|
21
|
+
onActualSize={() => void zoomTo(1, { duration: DURATION })}
|
|
22
|
+
onZoomIn={() => zoomIn({ duration: DURATION })}
|
|
23
|
+
onFit={() => void fitView({ padding, duration: DURATION })}
|
|
24
|
+
/>
|
|
45
25
|
</Panel>
|
|
46
26
|
)
|
|
47
27
|
}
|
|
48
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Zoom controls: out, the zoom as a percent, which goes to 100% when pressed, in, and fit. The
|
|
31
|
+
* canvas and an opened board show the same. Each stays a comfortable target on a phone.
|
|
32
|
+
*/
|
|
33
|
+
export function ZoomBar({
|
|
34
|
+
zoom,
|
|
35
|
+
fitLabel,
|
|
36
|
+
onZoomOut,
|
|
37
|
+
onActualSize,
|
|
38
|
+
onZoomIn,
|
|
39
|
+
onFit,
|
|
40
|
+
className,
|
|
41
|
+
}: {
|
|
42
|
+
readonly zoom: number
|
|
43
|
+
/** What fitting shows: everything on the canvas, or the whole page. */
|
|
44
|
+
readonly fitLabel: string
|
|
45
|
+
readonly onZoomOut: () => void
|
|
46
|
+
readonly onActualSize: () => void
|
|
47
|
+
readonly onZoomIn: () => void
|
|
48
|
+
readonly onFit: () => void
|
|
49
|
+
readonly className?: string
|
|
50
|
+
}) {
|
|
51
|
+
const messages = useArtifactMessages().canvas
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
className={cn(
|
|
55
|
+
"flex items-center gap-0.5 rounded-xl border border-border bg-background/90 p-1 shadow-[0_1px_2px_rgb(0_0_0/0.06),0_8px_24px_-12px_rgb(0_0_0/0.25)] backdrop-blur",
|
|
56
|
+
className
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
<Control label={messages.zoomOut} onClick={onZoomOut}>
|
|
60
|
+
<Minus className="size-4" aria-hidden="true" />
|
|
61
|
+
</Control>
|
|
62
|
+
<button
|
|
63
|
+
type="button"
|
|
64
|
+
title={messages.actualSize}
|
|
65
|
+
onClick={onActualSize}
|
|
66
|
+
className="h-8 w-12 rounded-lg text-center text-xs font-medium text-muted-foreground tabular-nums outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
|
|
67
|
+
>
|
|
68
|
+
<span aria-live="polite">{messages.zoom(Math.round(zoom * 100))}</span>
|
|
69
|
+
<span className="sr-only">, {messages.actualSize}</span>
|
|
70
|
+
</button>
|
|
71
|
+
<Control label={messages.zoomIn} onClick={onZoomIn}>
|
|
72
|
+
<Plus className="size-4" aria-hidden="true" />
|
|
73
|
+
</Control>
|
|
74
|
+
<span className="mx-1 h-5 w-px bg-border" aria-hidden="true" />
|
|
75
|
+
<Control label={fitLabel} onClick={onFit} wide>
|
|
76
|
+
<Maximize className="size-3.5" aria-hidden="true" />
|
|
77
|
+
<span className="text-xs font-medium">{messages.fit}</span>
|
|
78
|
+
</Control>
|
|
79
|
+
</div>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
|
|
49
83
|
function Control({
|
|
50
84
|
label,
|
|
51
85
|
onClick,
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
-
import type { CanvasArrow, CanvasBoard } from "@sixb/core/artifacts"
|
|
1
|
+
import type { CanvasArrow, CanvasBoard, FrameZoom, FrameZoomStep } from "@sixb/core/artifacts"
|
|
2
|
+
import { cn } from "@sixb/ui/lib/utils"
|
|
2
3
|
import { ArrowLeft, ChevronLeft, ChevronRight } from "lucide-react"
|
|
3
|
-
import { type ReactNode, useCallback, useEffect, useState } from "react"
|
|
4
|
+
import { type ReactNode, useCallback, useEffect, useMemo, useState } from "react"
|
|
4
5
|
import type { LiveArtifact } from "../../live/session"
|
|
5
6
|
import { useArtifactMessages } from "../../messages"
|
|
6
7
|
import type { ArtifactVersion } from "../../queries"
|
|
7
8
|
import { type BoardEditor, BoardStage, type CommentPick, type StageMode } from "./board-editor"
|
|
8
9
|
import type { DraftPlace, PinPlace } from "./comment-pins"
|
|
10
|
+
import { ZoomBar } from "./controls"
|
|
11
|
+
import type { Box } from "./draft"
|
|
12
|
+
import { PageResizer } from "./page-resize"
|
|
13
|
+
import type { PageSize, SizeName, SnappedSize } from "./page-size"
|
|
14
|
+
import { SizeControls } from "./page-size-controls"
|
|
15
|
+
import { usePageZoom } from "./page-zoom"
|
|
16
|
+
import { useShownSize } from "./shown-size"
|
|
17
|
+
|
|
18
|
+
/** How long a size kept as the board's is said. */
|
|
19
|
+
const KEPT_MS = 2400
|
|
9
20
|
|
|
10
21
|
/**
|
|
11
22
|
* A board opened over the canvas: its page at the board's own size, as the canvas and its picture
|
|
12
|
-
* show it,
|
|
13
|
-
*
|
|
14
|
-
*
|
|
23
|
+
* show it, and answering like a page. Its picture shows until the page is ready, and stays, with
|
|
24
|
+
* a word, if the page never is. ← and → step through the boards in the canvas's order, and Esc
|
|
25
|
+
* goes back to the canvas.
|
|
26
|
+
*
|
|
27
|
+
* It opens fitted: whole, or, taller than wide, to its width, scrolling down it as a document's
|
|
28
|
+
* page. The zoom bar, a pinch or ⌘ with the wheel over it, ⌘ +, − and 0, and a double-click beside
|
|
29
|
+
* it zoom it. Its edges resize it for the reader alone, laid out again at that size while it is
|
|
30
|
+
* open, until they go back to the board's size; whoever may change the canvas keeps it as the
|
|
31
|
+
* board's.
|
|
15
32
|
*
|
|
16
33
|
* It is a prototype too: pressing a button or a link within the page that reads as the label of an
|
|
17
34
|
* arrow leaving the board opens the board the arrow points to.
|
|
@@ -39,6 +56,7 @@ export function BoardFocus({
|
|
|
39
56
|
onOpenPin,
|
|
40
57
|
onSubmitDraft,
|
|
41
58
|
onCancelDraft,
|
|
59
|
+
onResizeBoard,
|
|
42
60
|
}: {
|
|
43
61
|
readonly version: ArtifactVersion
|
|
44
62
|
readonly boards: readonly CanvasBoard[]
|
|
@@ -64,14 +82,68 @@ export function BoardFocus({
|
|
|
64
82
|
readonly onOpenPin?: (id: string) => void
|
|
65
83
|
readonly onSubmitDraft?: (body: string) => Promise<void>
|
|
66
84
|
readonly onCancelDraft?: () => void
|
|
85
|
+
/**
|
|
86
|
+
* Resizes a board on the canvas, as its handles do while the canvas is edited: Keep this size.
|
|
87
|
+
* Absent for whoever may not change the canvas.
|
|
88
|
+
*/
|
|
89
|
+
readonly onResizeBoard?: (id: string, box: Box) => void
|
|
67
90
|
}) {
|
|
68
91
|
const messages = useArtifactMessages().canvas
|
|
69
92
|
const index = boards.findIndex((board) => board.id === id)
|
|
70
93
|
const board = boards[index]
|
|
71
94
|
const previous = boards[index - 1]
|
|
72
95
|
const next = boards[index + 1]
|
|
96
|
+
|
|
97
|
+
const [kept, setKept] = useState<PageSize | null>(null)
|
|
98
|
+
const own = useMemo(() => ({ w: board?.w ?? 1, h: board?.h ?? 1 }), [board?.w, board?.h])
|
|
99
|
+
const size = useShownSize(id, own)
|
|
100
|
+
const { shown, resized, suggestions } = size
|
|
101
|
+
|
|
73
102
|
const [stage, setStage] = useState<HTMLDivElement | null>(null)
|
|
74
|
-
const
|
|
103
|
+
const view = useSize(stage)
|
|
104
|
+
const zoom = usePageZoom({ id, page: shown, view, stage })
|
|
105
|
+
|
|
106
|
+
/** A size picked from the menu: the page fitted at it. */
|
|
107
|
+
const pickSize = (picked: PageSize, name: SizeName) => {
|
|
108
|
+
size.pick(picked, name)
|
|
109
|
+
zoom.fit("open")
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const reset = () => {
|
|
113
|
+
size.reset()
|
|
114
|
+
zoom.fit("open")
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A resize ends: what it snapped to says whether its width carries to the other boards. */
|
|
118
|
+
const resizedBy = (snapped: SnappedSize | null) => {
|
|
119
|
+
zoom.release()
|
|
120
|
+
if (snapped) size.settle(snapped)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const keep =
|
|
124
|
+
onResizeBoard && board
|
|
125
|
+
? () => {
|
|
126
|
+
onResizeBoard(board.id, { x: board.x, y: board.y, w: shown.w, h: shown.h })
|
|
127
|
+
size.keep()
|
|
128
|
+
setKept(shown)
|
|
129
|
+
}
|
|
130
|
+
: undefined
|
|
131
|
+
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (!kept) return
|
|
134
|
+
const timer = window.setTimeout(() => setKept(null), KEPT_MS)
|
|
135
|
+
return () => window.clearTimeout(timer)
|
|
136
|
+
}, [kept])
|
|
137
|
+
|
|
138
|
+
const { step, zoomTo, zoomBy } = zoom
|
|
139
|
+
const zoomStep = useCallback(
|
|
140
|
+
(to: FrameZoomStep) => (to === "actual" ? zoomTo(1) : step(to)),
|
|
141
|
+
[step, zoomTo]
|
|
142
|
+
)
|
|
143
|
+
const onZoom = useCallback(
|
|
144
|
+
(by: FrameZoom) => ("step" in by ? zoomStep(by.step) : zoomBy(by.factor, by.at)),
|
|
145
|
+
[zoomStep, zoomBy]
|
|
146
|
+
)
|
|
75
147
|
|
|
76
148
|
const onPress = useCallback(
|
|
77
149
|
(text: string) => {
|
|
@@ -84,15 +156,27 @@ export function BoardFocus({
|
|
|
84
156
|
|
|
85
157
|
useEffect(() => {
|
|
86
158
|
const onKey = (event: KeyboardEvent) => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
159
|
+
// ⌘ +, − and 0 zoom the board, not the app around it.
|
|
160
|
+
if (event.metaKey || event.ctrlKey) {
|
|
161
|
+
const to = zoomKey(event)
|
|
162
|
+
if (to) {
|
|
163
|
+
event.preventDefault()
|
|
164
|
+
zoomStep(to)
|
|
165
|
+
}
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
if (event.altKey) return
|
|
169
|
+
// Keys typed into a field are the field's, and a menu's are its own; arrows on the page's
|
|
170
|
+
// handles and their suggestions resize it.
|
|
171
|
+
const target = event.target instanceof Element ? event.target : null
|
|
90
172
|
if (
|
|
91
|
-
target
|
|
92
|
-
|
|
173
|
+
target?.closest(
|
|
174
|
+
"input, textarea, select, [contenteditable], [data-board-tools], [role=menu]"
|
|
175
|
+
)
|
|
93
176
|
) {
|
|
94
177
|
return
|
|
95
178
|
}
|
|
179
|
+
if (event.key !== "Escape" && target?.closest("[data-page-resizer]")) return
|
|
96
180
|
if (event.key === "Escape") {
|
|
97
181
|
if (!onEscape?.()) onClose()
|
|
98
182
|
} else if (event.key === "ArrowLeft" && previous) onOpen(previous.id)
|
|
@@ -102,12 +186,13 @@ export function BoardFocus({
|
|
|
102
186
|
}
|
|
103
187
|
window.addEventListener("keydown", onKey)
|
|
104
188
|
return () => window.removeEventListener("keydown", onKey)
|
|
105
|
-
}, [previous, next, onOpen, onClose, onEscape])
|
|
189
|
+
}, [previous, next, onOpen, onClose, onEscape, zoomStep])
|
|
106
190
|
|
|
107
191
|
if (!board) return null
|
|
108
192
|
const title = board.title ?? board.id
|
|
109
|
-
const scale
|
|
110
|
-
const picture = pictureOf?.(board.id)
|
|
193
|
+
const { scale, placement } = zoom
|
|
194
|
+
const picture = resized ? undefined : pictureOf?.(board.id)
|
|
195
|
+
|
|
111
196
|
return (
|
|
112
197
|
<div
|
|
113
198
|
role="dialog"
|
|
@@ -130,10 +215,19 @@ export function BoardFocus({
|
|
|
130
215
|
{mode === "edit" ? messages.edit.hint : messages.comments.modeHint}
|
|
131
216
|
</span>
|
|
132
217
|
) : null}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
218
|
+
<div className="ml-auto flex shrink-0 items-center">
|
|
219
|
+
<SizeControls
|
|
220
|
+
shown={shown}
|
|
221
|
+
board={own}
|
|
222
|
+
suggestions={suggestions}
|
|
223
|
+
kept={kept}
|
|
224
|
+
onPick={pickSize}
|
|
225
|
+
onReset={reset}
|
|
226
|
+
onKeep={keep}
|
|
227
|
+
/>
|
|
228
|
+
{tools}
|
|
229
|
+
</div>
|
|
230
|
+
<span className="shrink-0 text-xs whitespace-nowrap text-muted-foreground tabular-nums max-sm:hidden">
|
|
137
231
|
{messages.position(index + 1, boards.length)}
|
|
138
232
|
</span>
|
|
139
233
|
<Step
|
|
@@ -147,49 +241,102 @@ export function BoardFocus({
|
|
|
147
241
|
<ChevronRight className="size-4" aria-hidden="true" />
|
|
148
242
|
</Step>
|
|
149
243
|
</div>
|
|
150
|
-
<div className="
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
244
|
+
<div className="relative min-h-0 flex-1 bg-muted/40">
|
|
245
|
+
{/* Scrolled over the page when it is larger than the view; pinched, zoomed instead. */}
|
|
246
|
+
<div
|
|
247
|
+
ref={setStage}
|
|
248
|
+
data-board-stage=""
|
|
249
|
+
className="absolute inset-0 touch-pan-x touch-pan-y overflow-auto overscroll-contain"
|
|
250
|
+
onDoubleClick={(event) => {
|
|
251
|
+
if ((event.target as Element).closest("[data-board-page]")) return
|
|
252
|
+
const at = zoom.pageAt(event.clientX, event.clientY)
|
|
253
|
+
if (at) zoom.toggle(at)
|
|
254
|
+
}}
|
|
255
|
+
>
|
|
256
|
+
{placement && scale > 0 ? (
|
|
257
|
+
<div className="relative" style={{ width: placement.width, height: placement.height }}>
|
|
258
|
+
{/* The box the page takes on screen; the page inside is laid out at its size. */}
|
|
259
|
+
<div
|
|
260
|
+
key={board.id}
|
|
261
|
+
data-board-page=""
|
|
262
|
+
className={cn(
|
|
263
|
+
"group/page sixb-canvas-surface absolute motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-97 motion-safe:duration-300 motion-safe:ease-out",
|
|
264
|
+
zoom.settling ? "motion-safe:transition-[left,top] motion-safe:ease-out" : null
|
|
265
|
+
)}
|
|
266
|
+
style={{
|
|
267
|
+
left: placement.left,
|
|
268
|
+
top: placement.top,
|
|
269
|
+
width: shown.w * scale,
|
|
270
|
+
height: shown.h * scale,
|
|
271
|
+
}}
|
|
272
|
+
>
|
|
273
|
+
<BoardStage
|
|
274
|
+
version={version}
|
|
275
|
+
board={board}
|
|
276
|
+
size={shown}
|
|
277
|
+
title={title}
|
|
278
|
+
scale={scale}
|
|
279
|
+
live={live}
|
|
280
|
+
canvas={canvas}
|
|
281
|
+
mode={mode}
|
|
282
|
+
pins={pins.filter((pin) => pin.board === board.id)}
|
|
283
|
+
activePin={activePin}
|
|
284
|
+
draft={draft?.board === board.id ? draft : null}
|
|
285
|
+
// Its picture is of the board at its own size.
|
|
286
|
+
fallback={picture ? <BoardPicture src={picture} /> : undefined}
|
|
287
|
+
failure={
|
|
288
|
+
<div className="relative size-full">
|
|
289
|
+
{picture ? <BoardPicture src={picture} /> : null}
|
|
290
|
+
<p className="absolute inset-x-0 bottom-0 m-0 bg-background/90 px-4 py-2 text-sm text-muted-foreground">
|
|
291
|
+
{messages.boardFailed}
|
|
292
|
+
</p>
|
|
293
|
+
</div>
|
|
294
|
+
}
|
|
295
|
+
onPress={onPress}
|
|
296
|
+
onPick={pick}
|
|
297
|
+
onOpenPin={(pin) => onOpenPin?.(pin)}
|
|
298
|
+
onSubmitDraft={(body) => onSubmitDraft?.(body) ?? Promise.resolve()}
|
|
299
|
+
onCancelDraft={() => onCancelDraft?.()}
|
|
300
|
+
onContentHeight={size.onContentHeight}
|
|
301
|
+
onZoom={onZoom}
|
|
302
|
+
/>
|
|
303
|
+
<PageResizer
|
|
304
|
+
size={shown}
|
|
305
|
+
scale={scale}
|
|
306
|
+
suggestions={suggestions}
|
|
307
|
+
stage={stage}
|
|
308
|
+
onStart={zoom.hold}
|
|
309
|
+
onResize={size.resize}
|
|
310
|
+
onEnd={resizedBy}
|
|
311
|
+
/>
|
|
312
|
+
</div>
|
|
185
313
|
</div>
|
|
186
314
|
) : null}
|
|
187
315
|
</div>
|
|
316
|
+
|
|
317
|
+
<ZoomBar
|
|
318
|
+
zoom={scale}
|
|
319
|
+
fitLabel={messages.fitPage}
|
|
320
|
+
onZoomOut={() => zoom.step("out")}
|
|
321
|
+
onActualSize={() => zoom.zoomTo(1)}
|
|
322
|
+
onZoomIn={() => zoom.step("in")}
|
|
323
|
+
onFit={() => zoom.fit("whole")}
|
|
324
|
+
className="absolute bottom-3 left-3 z-20"
|
|
325
|
+
/>
|
|
188
326
|
</div>
|
|
189
327
|
</div>
|
|
190
328
|
)
|
|
191
329
|
}
|
|
192
330
|
|
|
331
|
+
/** ⌘ or Ctrl with +, − or 0 as a zoom step. */
|
|
332
|
+
export function zoomKey(event: KeyboardEvent): FrameZoomStep | null {
|
|
333
|
+
if (event.altKey) return null
|
|
334
|
+
if (event.key === "=" || event.key === "+") return "in"
|
|
335
|
+
if (event.key === "-") return "out"
|
|
336
|
+
if (event.key === "0") return "actual"
|
|
337
|
+
return null
|
|
338
|
+
}
|
|
339
|
+
|
|
193
340
|
/**
|
|
194
341
|
* The board an arrow leaving `from` points to, when its label reads as `pressed`, case and spaces
|
|
195
342
|
* aside: the first such arrow the canvas lists, to a board.
|
|
@@ -214,9 +361,6 @@ function wordsOf(text: string): string {
|
|
|
214
361
|
return text.replace(/\s+/g, " ").trim().toLowerCase()
|
|
215
362
|
}
|
|
216
363
|
|
|
217
|
-
/** The most an opened board is enlarged to fit the viewer, as far as the canvas zooms. */
|
|
218
|
-
const MAX_SCALE = 2.5
|
|
219
|
-
|
|
220
364
|
/** A board's picture at its own size, drawn from its top as its tile draws it. */
|
|
221
365
|
function BoardPicture({ src }: { readonly src: string }) {
|
|
222
366
|
return (
|