zidane-ui 9.3.1 → 9.5.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/dist/adapters/index.d.ts +2 -1
- package/dist/adapters/index.js +2 -1
- package/dist/adapters/live.d.ts +9 -2
- package/dist/adapters/live.js +8 -2
- package/dist/adapters/server-approvals-host.js +3 -1
- package/dist/adapters/server-channels-host.d.ts +32 -0
- package/dist/adapters/server-channels-host.js +49 -0
- package/dist/adapters/server-composer-host.js +13 -0
- package/dist/adapters/server-files-host.js +12 -31
- package/dist/adapters/server-git-host.js +5 -2
- package/dist/adapters/server-host.js +44 -14
- package/dist/adapters/server-machines-host.d.ts +5 -0
- package/dist/adapters/server-machines-host.js +15 -1
- package/dist/adapters/server-oauth-flow.d.ts +2 -1
- package/dist/adapters/server-projects.d.ts +15 -0
- package/dist/adapters/server-projects.js +225 -0
- package/dist/adapters/server-session-host.d.ts +2 -0
- package/dist/adapters/server-session-host.js +69 -1
- package/dist/adapters/server-settings-sections.js +4 -1
- package/dist/adapters/sse-host.js +3 -0
- package/dist/adapters/sse-protocol.d.ts +10 -0
- package/dist/app/AppHostProvider.d.ts +1 -1
- package/dist/app/AppHostProvider.js +7 -2
- package/dist/app/ModalProvider.d.ts +6 -2
- package/dist/app/ModalProvider.js +38 -10
- package/dist/app/headless/app-host.d.ts +3 -0
- package/dist/appearance/ZoomIndicator.js +5 -8
- package/dist/approvals/ApprovalsProvider.d.ts +2 -1
- package/dist/approvals/ApprovalsProvider.js +12 -4
- package/dist/approvals/headless/host.d.ts +13 -2
- package/dist/approvals/headless/index.d.ts +3 -3
- package/dist/approvals/headless/index.js +2 -2
- package/dist/approvals/headless/labels.d.ts +12 -2
- package/dist/approvals/headless/labels.js +19 -1
- package/dist/channels/BindingEditorDialog.d.ts +18 -0
- package/dist/channels/BindingEditorDialog.js +637 -0
- package/dist/channels/ChannelAlertsList.d.ts +25 -0
- package/dist/channels/ChannelAlertsList.js +107 -0
- package/dist/channels/ChannelDefaultsSection.d.ts +20 -0
- package/dist/channels/ChannelDefaultsSection.js +133 -0
- package/dist/channels/ChannelsProvider.d.ts +31 -0
- package/dist/channels/ChannelsProvider.js +29 -0
- package/dist/channels/ChannelsSettingsSection.d.ts +40 -0
- package/dist/channels/ChannelsSettingsSection.js +456 -0
- package/dist/channels/ConnectionSetupDialog.d.ts +16 -0
- package/dist/channels/ConnectionSetupDialog.js +470 -0
- package/dist/channels/HeldRepliesList.d.ts +27 -0
- package/dist/channels/HeldRepliesList.js +173 -0
- package/dist/channels/ProjectChannelsSection.d.ts +55 -0
- package/dist/channels/ProjectChannelsSection.js +433 -0
- package/dist/channels/ReadinessChecklist.d.ts +102 -0
- package/dist/channels/ReadinessChecklist.js +273 -0
- package/dist/channels/TestSessionBanner.d.ts +24 -0
- package/dist/channels/TestSessionBanner.js +44 -0
- package/dist/channels/channels-parts.d.ts +104 -0
- package/dist/channels/channels-parts.js +203 -0
- package/dist/channels/context.d.ts +9 -0
- package/dist/channels/context.js +14 -0
- package/dist/channels/headless/access.d.ts +127 -0
- package/dist/channels/headless/access.js +187 -0
- package/dist/channels/headless/fixture-host.d.ts +83 -0
- package/dist/channels/headless/fixture-host.js +557 -0
- package/dist/channels/headless/host.d.ts +245 -0
- package/dist/channels/headless/host.js +39 -0
- package/dist/channels/headless/index.d.ts +10 -0
- package/dist/channels/headless/index.js +5 -0
- package/dist/channels/headless/labels.d.ts +217 -0
- package/dist/channels/headless/labels.js +260 -0
- package/dist/channels/headless/state.d.ts +22 -0
- package/dist/channels/headless/state.js +303 -0
- package/dist/channels/index.d.ts +21 -0
- package/dist/channels/index.js +13 -0
- package/dist/channels/testing/contract.d.ts +31 -0
- package/dist/channels/testing/contract.js +378 -0
- package/dist/channels/testing/index.d.ts +7 -0
- package/dist/channels/testing/index.js +1 -0
- package/dist/chat/HostBadge.js +1 -0
- package/dist/chat/HostTranscript.js +15 -1
- package/dist/chat/OrchestratorBadge.d.ts +23 -0
- package/dist/chat/OrchestratorBadge.js +22 -0
- package/dist/chat/SessionGroupHeader.d.ts +11 -1
- package/dist/chat/SessionGroupHeader.js +25 -14
- package/dist/chat/SessionRow.d.ts +141 -0
- package/dist/chat/SessionRow.js +215 -0
- package/dist/chat/SessionStreamsProvider.d.ts +1 -1
- package/dist/chat/StatusDot.d.ts +7 -2
- package/dist/chat/StatusDot.js +3 -2
- package/dist/chat/Transcript.d.ts +3 -2
- package/dist/chat/Transcript.js +26 -7
- package/dist/chat/composer/ComposerEditor.js +1 -1
- package/dist/chat/composer/ContextBreakdown.d.ts +27 -2
- package/dist/chat/composer/ContextBreakdown.js +123 -2
- package/dist/chat/composer/DraftPickers.js +2 -0
- package/dist/chat/composer/HostContextOrb.d.ts +2 -0
- package/dist/chat/composer/HostContextOrb.js +17 -2
- package/dist/chat/composer/ModelOptionsPicker.js +6 -2
- package/dist/chat/composer/ModelPicker.d.ts +1 -1
- package/dist/chat/composer/PlacePicker.d.ts +3 -1
- package/dist/chat/composer/PlacePicker.js +5 -1
- package/dist/chat/composer/ProjectMenu.d.ts +16 -3
- package/dist/chat/composer/ProjectMenu.js +102 -20
- package/dist/chat/composer/ScopeToggle.d.ts +3 -1
- package/dist/chat/composer/ScopeToggle.js +2 -1
- package/dist/chat/composer/ServerScopeToggle.d.ts +3 -1
- package/dist/chat/composer/ServerScopeToggle.js +2 -1
- package/dist/chat/composer/index.d.ts +2 -2
- package/dist/chat/composer/index.js +2 -2
- package/dist/chat/composer/use-draft-target.d.ts +5 -0
- package/dist/chat/composer/use-draft-target.js +18 -3
- package/dist/chat/composer/use-send-prompt.d.ts +2 -0
- package/dist/chat/composer/use-send-prompt.js +4 -1
- package/dist/chat/headless/answered-first.d.ts +28 -0
- package/dist/chat/headless/answered-first.js +14 -0
- package/dist/chat/headless/block-runs.js +26 -1
- package/dist/chat/headless/chip-labels.d.ts +2 -0
- package/dist/chat/headless/chip-labels.js +2 -0
- package/dist/chat/headless/chip-views.js +1 -1
- package/dist/chat/headless/composer/composer-sources.d.ts +5 -2
- package/dist/chat/headless/composer/composer-sources.js +6 -0
- package/dist/chat/headless/composer/host.d.ts +13 -0
- package/dist/chat/headless/composer/index.d.ts +2 -2
- package/dist/chat/headless/composer/labels-chrome.d.ts +3 -0
- package/dist/chat/headless/composer/labels-chrome.js +4 -1
- package/dist/chat/headless/composer/labels-editor.d.ts +2 -0
- package/dist/chat/headless/composer/labels-editor.js +2 -0
- package/dist/chat/headless/draft-target.d.ts +30 -1
- package/dist/chat/headless/draft-target.js +22 -1
- package/dist/chat/headless/folder-groups.d.ts +41 -0
- package/dist/chat/headless/folder-groups.js +76 -0
- package/dist/chat/headless/host.d.ts +16 -1
- package/dist/chat/headless/hosts.d.ts +4 -0
- package/dist/chat/headless/index.d.ts +31 -27
- package/dist/chat/headless/index.js +33 -29
- package/dist/chat/headless/labels.d.ts +34 -4
- package/dist/chat/headless/labels.js +28 -6
- package/dist/chat/headless/markdown-scan.d.ts +0 -2
- package/dist/chat/headless/markdown-scan.js +3 -8
- package/dist/chat/headless/markdown-stream.js +3 -3
- package/dist/chat/headless/prompt-origin.d.ts +4 -2
- package/dist/chat/headless/prompt-origin.js +9 -5
- package/dist/chat/headless/send-flow.d.ts +2 -0
- package/dist/chat/headless/session-list.d.ts +28 -2
- package/dist/chat/headless/sidebar/directory.d.ts +15 -1
- package/dist/chat/headless/sidebar/directory.js +11 -1
- package/dist/chat/headless/sidebar/environment.d.ts +15 -4
- package/dist/chat/headless/sidebar/environment.js +27 -9
- package/dist/chat/headless/sidebar/inbox.d.ts +13 -3
- package/dist/chat/headless/sidebar/inbox.js +40 -19
- package/dist/chat/headless/sidebar/index.d.ts +6 -4
- package/dist/chat/headless/sidebar/index.js +5 -3
- package/dist/chat/headless/sidebar/labels.d.ts +38 -8
- package/dist/chat/headless/sidebar/labels.js +8 -4
- package/dist/chat/headless/sidebar/project-main.d.ts +43 -0
- package/dist/chat/headless/sidebar/project-main.js +46 -0
- package/dist/chat/headless/sidebar/row-changes.d.ts +43 -0
- package/dist/chat/headless/sidebar/row-changes.js +43 -0
- package/dist/chat/headless/sidebar/rows.d.ts +2 -1
- package/dist/chat/headless/sidebar/rows.js +7 -3
- package/dist/chat/headless/sidebar/types.d.ts +12 -0
- package/dist/chat/headless/streams/actions.d.ts +2 -2
- package/dist/chat/headless/streams/actions.js +1 -1
- package/dist/chat/headless/streams/event-bytes.d.ts +12 -1
- package/dist/chat/headless/streams/event-bytes.js +13 -1
- package/dist/chat/headless/streams/live-events.d.ts +12 -0
- package/dist/chat/headless/streams/live-events.js +21 -2
- package/dist/chat/headless/streams/store.d.ts +38 -5
- package/dist/chat/headless/streams/store.js +74 -22
- package/dist/chat/headless/streams/transcript-map.js +2 -5
- package/dist/chat/headless/streams/types.d.ts +4 -2
- package/dist/chat/headless/transcript/collapse.js +6 -1
- package/dist/chat/headless/transcript/rail.d.ts +8 -1
- package/dist/chat/headless/transcript/rail.js +9 -2
- package/dist/chat/headless/transcript/rows.d.ts +5 -1
- package/dist/chat/headless/transcript-labels.d.ts +1 -0
- package/dist/chat/index.d.ts +6 -4
- package/dist/chat/index.js +8 -6
- package/dist/chat/interactions/HostInteractions.js +4 -2
- package/dist/chat/interactions/InboxPanel.js +6 -4
- package/dist/chat/interactions/use-answer-interaction.d.ts +11 -0
- package/dist/chat/interactions/use-answer-interaction.js +19 -0
- package/dist/chat/rich-composer/artifact-mentions.d.ts +29 -0
- package/dist/chat/rich-composer/artifact-mentions.js +40 -0
- package/dist/chat/rich-composer/composer-extensions.d.ts +3 -2
- package/dist/chat/rich-composer/composer-extensions.js +12 -9
- package/dist/chat/rich-composer/use-composer-sources.js +1 -0
- package/dist/chat/sidebar/InboxList.d.ts +13 -2
- package/dist/chat/sidebar/InboxList.js +44 -48
- package/dist/chat/sidebar/MainSessionRow.d.ts +2 -1
- package/dist/chat/sidebar/MainSessionRow.js +1 -1
- package/dist/chat/sidebar/ProjectIcon.d.ts +8 -4
- package/dist/chat/sidebar/ProjectIcon.js +16 -4
- package/dist/chat/sidebar/RowChips.js +2 -2
- package/dist/chat/sidebar/SessionSidebar.d.ts +47 -0
- package/dist/chat/sidebar/SessionSidebar.js +85 -28
- package/dist/chat/sidebar/SidebarFilterMenu.js +0 -1
- package/dist/chat/sidebar/SidebarFold.js +17 -16
- package/dist/chat/sidebar/SidebarFooter.d.ts +2 -23
- package/dist/chat/sidebar/SidebarFooter.js +2 -43
- package/dist/chat/sidebar/SidebarGroupHeader.d.ts +7 -3
- package/dist/chat/sidebar/SidebarGroupHeader.js +15 -10
- package/dist/chat/sidebar/SidebarLiveProvider.d.ts +22 -0
- package/dist/chat/sidebar/SidebarLiveProvider.js +20 -0
- package/dist/chat/sidebar/SidebarSessionRow.d.ts +12 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +25 -13
- package/dist/chat/sidebar/inbox-triage.d.ts +18 -2
- package/dist/chat/sidebar/inbox-triage.js +39 -12
- package/dist/chat/sidebar/index.d.ts +5 -4
- package/dist/chat/sidebar/index.js +3 -2
- package/dist/chat/sidebar/session-menu.d.ts +4 -0
- package/dist/chat/sidebar/session-menu.js +14 -2
- package/dist/chat/sidebar/sidebar-live.d.ts +29 -2
- package/dist/chat/sidebar/sidebar-live.js +64 -6
- package/dist/chat/sidebar/useInboxRows.js +8 -9
- package/dist/chat/sidebar/useInboxTriage.d.ts +5 -2
- package/dist/chat/sidebar/useInboxTriage.js +78 -67
- package/dist/chat/sidebar/useSessionSearch.js +19 -18
- package/dist/chat/testing/fixture-composer-host.d.ts +3 -1
- package/dist/chat/testing/fixture-composer-host.js +1 -0
- package/dist/chat/transcript/FileChip.js +28 -0
- package/dist/chat/transcript/LazyRow.d.ts +1 -1
- package/dist/chat/transcript/LazyRow.js +3 -4
- package/dist/chat/transcript/PromptEcho.js +18 -13
- package/dist/chat/transcript/PromptOriginLabel.d.ts +1 -1
- package/dist/chat/transcript/SessionChip.d.ts +11 -0
- package/dist/chat/transcript/SessionChip.js +34 -0
- package/dist/chat/transcript/TranscriptRail.d.ts +4 -2
- package/dist/chat/transcript/TranscriptRail.js +12 -2
- package/dist/chat/transcript/TranscriptRow.js +1 -0
- package/dist/chat/transcript/badges.d.ts +1 -0
- package/dist/chat/transcript/badges.js +1 -0
- package/dist/chat/transcript/chip-details.d.ts +11 -0
- package/dist/chat/transcript/chip-details.js +17 -1
- package/dist/chat/transcript/fold-worker.js +2 -1
- package/dist/chat/transcript/fold.js +13 -4
- package/dist/chat/transcript/index.d.ts +3 -3
- package/dist/chat/transcript/index.js +3 -3
- package/dist/chat/transcript/inline-facts.d.ts +9 -0
- package/dist/chat/transcript/inline-facts.js +20 -0
- package/dist/chat/transcript/markdown-cache.d.ts +10 -1
- package/dist/chat/transcript/markdown-cache.js +37 -4
- package/dist/chat/transcript/markdown.js +27 -34
- package/dist/chat/transcript/media-gallery.js +13 -16
- package/dist/chat/transcript/messages.js +5 -4
- package/dist/chat/transcript/notices.d.ts +25 -3
- package/dist/chat/transcript/notices.js +136 -17
- package/dist/chat/transcript/prompt.d.ts +1 -1
- package/dist/chat/transcript/prompt.js +8 -1
- package/dist/chat/transcript/row-mount.d.ts +27 -8
- package/dist/chat/transcript/row-mount.js +114 -80
- package/dist/chat/transcript/row-parking.d.ts +27 -0
- package/dist/chat/transcript/row-parking.js +37 -1
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/tasks.d.ts +1 -1
- package/dist/chat/transcript/tasks.js +1 -1
- package/dist/chat/transcript/tool-parts.js +0 -1
- package/dist/chat/transcript/tool-row.js +3 -2
- package/dist/chat/transcript/use-transcript-rows.d.ts +1 -1
- package/dist/chat/transcript/useHistoryBackfill.d.ts +42 -0
- package/dist/chat/transcript/useHistoryBackfill.js +170 -0
- package/dist/chat/transcript/useTranscriptFind.js +2 -4
- package/dist/chat/transcript/useTranscriptScroll.d.ts +7 -4
- package/dist/chat/transcript/useTranscriptScroll.js +12 -1
- package/dist/chat/transcript/useTranscriptSearch.d.ts +2 -2
- package/dist/chat/transcript/useTranscriptSearch.js +6 -6
- package/dist/chat/transcript/useTranscriptSelectionCopy.d.ts +5 -5
- package/dist/chat/transcript/useTranscriptSelectionCopy.js +28 -7
- package/dist/code/editor/FileTree.d.ts +2 -0
- package/dist/code/editor/FileTree.js +1 -1
- package/dist/code/editor/FileView.js +16 -27
- package/dist/code/editor/find/useFind.js +17 -17
- package/dist/code/editor/useCodeDocument.js +22 -19
- package/dist/code/editor/useDetachCleanup.js +4 -3
- package/dist/code/use-highlighted-html.js +12 -13
- package/dist/components/Form.d.ts +28 -1
- package/dist/components/Form.js +43 -7
- package/dist/components/HelpTip.d.ts +22 -0
- package/dist/components/HelpTip.js +26 -0
- package/dist/components/IconButton.d.ts +3 -1
- package/dist/components/IconButton.js +7 -2
- package/dist/components/IconButtonTip.d.ts +3 -1
- package/dist/components/IconButtonTip.js +2 -1
- package/dist/components/Menu.js +1 -1
- package/dist/components/Notice.d.ts +6 -4
- package/dist/components/Notice.js +73 -27
- package/dist/components/Progress.js +10 -4
- package/dist/components/RowActionsMenu.js +7 -14
- package/dist/components/SearchField.d.ts +46 -0
- package/dist/components/SearchField.js +50 -0
- package/dist/components/ShowMore.d.ts +48 -0
- package/dist/components/ShowMore.js +57 -0
- package/dist/components/Tooltip.d.ts +4 -1
- package/dist/components/Tooltip.js +16 -11
- package/dist/components/assign-ref.d.ts +8 -0
- package/dist/components/assign-ref.js +12 -0
- package/dist/components/charts/ScatterChart.js +13 -6
- package/dist/components/floating/FloatingSurface.js +4 -4
- package/dist/components/floating/HoverCard.js +32 -14
- package/dist/components/floating/Popover.js +4 -7
- package/dist/components/floating/useAnchoredPosition.d.ts +20 -4
- package/dist/components/floating/useAnchoredPosition.js +44 -10
- package/dist/components/object-key.d.ts +7 -0
- package/dist/components/object-key.js +18 -0
- package/dist/components/palette/PaletteList.d.ts +5 -5
- package/dist/components/palette/PaletteList.js +1 -7
- package/dist/components/palette/PalettePanel.js +18 -12
- package/dist/components/palette/palette-layout.d.ts +5 -1
- package/dist/components/palette/palette-layout.js +13 -10
- package/dist/components/tooltip-arming.d.ts +3 -0
- package/dist/components/tooltip-arming.js +8 -1
- package/dist/core.css +45 -20
- package/dist/dist/index-BmO8bRgK.d.ts +1 -0
- package/dist/dist/{index-C6-t1SS9.d.ts → index-Bsp5Ku7r.d.ts} +264 -133
- package/dist/dist/index.d.ts +5 -5
- package/dist/dist/sandbox-Bzg_jJK2.d.ts +2 -0
- package/dist/dist/{timeout-CmTx6V9y.d.ts → timeout-NoG7ppkm.d.ts} +1 -1
- package/dist/files/FilesProvider.d.ts +2 -0
- package/dist/files/FilesProvider.js +5 -1
- package/dist/files/FilesTab.js +0 -1
- package/dist/files/TreeColumn.d.ts +2 -4
- package/dist/files/TreeColumn.js +0 -5
- package/dist/files/headless/host.d.ts +9 -9
- package/dist/files/headless/labels.d.ts +0 -1
- package/dist/files/headless/labels.js +0 -1
- package/dist/files/headless/workspace-diff.js +1 -1
- package/dist/files/index.d.ts +2 -2
- package/dist/files/index.js +2 -2
- package/dist/files/useCodeReview.js +1 -3
- package/dist/files/useFilesDiagnostics.d.ts +1 -1
- package/dist/files/useFilesDiagnostics.js +4 -11
- package/dist/files/useOpenFiles.js +9 -12
- package/dist/files/useWorkspace.d.ts +5 -7
- package/dist/files/useWorkspace.js +4 -15
- package/dist/git/GitBar.js +13 -5
- package/dist/git/MoveSessionDialog.d.ts +18 -8
- package/dist/git/MoveSessionDialog.js +39 -57
- package/dist/git/MoveToDialog.d.ts +63 -0
- package/dist/git/MoveToDialog.js +267 -0
- package/dist/git/SandboxManager.js +9 -4
- package/dist/git/SyncChip.js +11 -4
- package/dist/git/TeleportSessionDialog.d.ts +76 -0
- package/dist/git/TeleportSessionDialog.js +596 -0
- package/dist/git/WherePicker.js +4 -1
- package/dist/git/headless/host.d.ts +14 -0
- package/dist/git/headless/index.d.ts +2 -1
- package/dist/git/headless/index.js +2 -1
- package/dist/git/headless/labels.d.ts +52 -1
- package/dist/git/headless/labels.js +58 -0
- package/dist/git/headless/sandboxes.d.ts +1 -1
- package/dist/git/headless/sandboxes.js +4 -3
- package/dist/git/headless/teleport.d.ts +76 -0
- package/dist/git/headless/teleport.js +19 -0
- package/dist/git/index.d.ts +5 -3
- package/dist/git/index.js +5 -3
- package/dist/git/useEnvironmentChoices.d.ts +24 -2
- package/dist/git/useEnvironmentChoices.js +43 -11
- package/dist/hooks/useLastCount.d.ts +9 -0
- package/dist/hooks/useLastCount.js +29 -0
- package/dist/hooks/useLatest.d.ts +8 -0
- package/dist/hooks/useLatest.js +17 -0
- package/dist/hooks/useMinuteTick.d.ts +6 -2
- package/dist/hooks/useMinuteTick.js +12 -6
- package/dist/hooks/useNearViewport.js +11 -8
- package/dist/index.d.ts +8 -3
- package/dist/index.js +8 -3
- package/dist/keybindings/KeybindingsProvider.js +3 -4
- package/dist/keybindings/headless/catalog.d.ts +1 -1
- package/dist/keybindings/headless/catalog.js +18 -0
- package/dist/keybindings/headless/overrides.d.ts +1 -1
- package/dist/keybindings/headless/overrides.js +14 -3
- package/dist/labels.d.ts +7 -0
- package/dist/labels.js +10 -3
- package/dist/machines/AddMachineDialog.js +1 -1
- package/dist/machines/AddServerForm.d.ts +14 -2
- package/dist/machines/AddServerForm.js +198 -30
- package/dist/machines/Banners.d.ts +2 -2
- package/dist/machines/Banners.js +3 -3
- package/dist/machines/DaemonMenu.js +1 -3
- package/dist/machines/HostCapabilities.js +8 -4
- package/dist/machines/HostSignIn.d.ts +2 -1
- package/dist/machines/HostSignIn.js +1 -0
- package/dist/machines/HostSyncPanel.d.ts +4 -1
- package/dist/machines/HostSyncPanel.js +248 -132
- package/dist/machines/HostsSection.d.ts +2 -2
- package/dist/machines/HostsSection.js +94 -51
- package/dist/machines/LinkedAccountsPanel.d.ts +29 -0
- package/dist/machines/LinkedAccountsPanel.js +268 -0
- package/dist/machines/MachinesExplainer.d.ts +4 -4
- package/dist/machines/MachinesExplainer.js +27 -17
- package/dist/machines/OrganizationPanel.d.ts +32 -0
- package/dist/machines/OrganizationPanel.js +553 -0
- package/dist/machines/ProjectsSpendPanel.d.ts +22 -0
- package/dist/machines/ProjectsSpendPanel.js +160 -0
- package/dist/machines/ServerMachinesPanel.js +19 -4
- package/dist/machines/ServerUpdatePanel.js +3 -3
- package/dist/machines/SyncAccounts.d.ts +14 -7
- package/dist/machines/SyncAccounts.js +67 -81
- package/dist/machines/TokensPanel.js +54 -30
- package/dist/machines/headless/fixture-host.d.ts +15 -0
- package/dist/machines/headless/fixture-host.js +75 -0
- package/dist/machines/headless/fixtures.d.ts +12 -0
- package/dist/machines/headless/fixtures.js +71 -1
- package/dist/machines/headless/host.d.ts +25 -1
- package/dist/machines/headless/index.d.ts +3 -1
- package/dist/machines/headless/index.js +3 -1
- package/dist/machines/headless/labels.d.ts +104 -8
- package/dist/machines/headless/labels.js +121 -21
- package/dist/machines/headless/linked-accounts.d.ts +42 -0
- package/dist/machines/headless/linked-accounts.js +31 -0
- package/dist/machines/headless/organization.d.ts +44 -0
- package/dist/machines/headless/organization.js +54 -0
- package/dist/machines/headless/sync.d.ts +2 -0
- package/dist/machines/index.d.ts +4 -1
- package/dist/machines/index.js +4 -1
- package/dist/machines/sync-rows.d.ts +8 -0
- package/dist/machines/sync-rows.js +10 -0
- package/dist/machines/testing/index.d.ts +3 -3
- package/dist/machines/testing/index.js +2 -2
- package/dist/motion/grow.js +12 -13
- package/dist/motion/swap.js +2 -5
- package/dist/motion/use-flip-list.d.ts +14 -0
- package/dist/motion/use-flip-list.js +17 -12
- package/dist/onboarding/demos/extensions.d.ts +4 -0
- package/dist/onboarding/demos/extensions.js +27 -1
- package/dist/onboarding/demos/sidebar-layout.d.ts +4 -2
- package/dist/onboarding/demos/sidebar-layout.js +5 -2
- package/dist/onboarding/headless/labels.d.ts +9 -0
- package/dist/onboarding/headless/labels.js +2 -0
- package/dist/onboarding/steps/SidebarStep.js +4 -2
- package/dist/onboarding/steps/setting-cards.d.ts +4 -2
- package/dist/onboarding/steps/setting-cards.js +3 -2
- package/dist/palette/PaletteDialog.js +4 -4
- package/dist/palette/PaletteRows.js +34 -16
- package/dist/palette/headless/app-sources.js +40 -1
- package/dist/palette/headless/labels.js +5 -2
- package/dist/palette/usePaletteController.js +4 -8
- package/dist/server/sse-handler.js +25 -2
- package/dist/session/ArtifactsPanel.js +11 -23
- package/dist/session/DiffFileTree.js +1 -4
- package/dist/session/NewProjectDialog.d.ts +33 -0
- package/dist/session/NewProjectDialog.js +216 -0
- package/dist/session/OpenProjectsDialog.d.ts +56 -0
- package/dist/session/OpenProjectsDialog.js +324 -0
- package/dist/session/OpenSessionsDialog.d.ts +46 -0
- package/dist/session/OpenSessionsDialog.js +295 -0
- package/dist/session/PlanTracker.js +1 -2
- package/dist/session/ProjectArtifactsHome.d.ts +42 -0
- package/dist/session/ProjectArtifactsHome.js +98 -0
- package/dist/session/ProjectArtifactsSection.d.ts +13 -0
- package/dist/session/ProjectArtifactsSection.js +367 -0
- package/dist/session/ProjectBudgetsSection.d.ts +7 -0
- package/dist/session/ProjectBudgetsSection.js +377 -0
- package/dist/session/ProjectContextSection.d.ts +20 -0
- package/dist/session/ProjectContextSection.js +139 -0
- package/dist/session/ProjectHome.d.ts +32 -5
- package/dist/session/ProjectHome.js +502 -254
- package/dist/session/ProjectInstructionsSection.d.ts +7 -0
- package/dist/session/ProjectInstructionsSection.js +179 -0
- package/dist/session/ProjectMainButton.d.ts +35 -0
- package/dist/session/ProjectMainButton.js +73 -0
- package/dist/session/ProjectName.d.ts +76 -0
- package/dist/session/ProjectName.js +140 -0
- package/dist/session/ProjectOrchestratorSection.d.ts +14 -0
- package/dist/session/ProjectOrchestratorSection.js +117 -0
- package/dist/session/ProjectPublishDialog.d.ts +30 -0
- package/dist/session/ProjectPublishDialog.js +420 -0
- package/dist/session/ProjectSessionAccessSection.d.ts +13 -0
- package/dist/session/ProjectSessionAccessSection.js +109 -0
- package/dist/session/ProjectSessionsList.d.ts +53 -0
- package/dist/session/ProjectSessionsList.js +316 -0
- package/dist/session/ProjectSettingsDialog.d.ts +30 -0
- package/dist/session/ProjectSettingsDialog.js +693 -0
- package/dist/session/ProjectShareDialog.d.ts +36 -0
- package/dist/session/ProjectShareDialog.js +190 -0
- package/dist/session/ProjectSkillsSection.d.ts +7 -0
- package/dist/session/ProjectSkillsSection.js +197 -0
- package/dist/session/ProjectToolsSection.d.ts +16 -0
- package/dist/session/ProjectToolsSection.js +347 -0
- package/dist/session/ProjectUsage.d.ts +61 -0
- package/dist/session/ProjectUsage.js +344 -0
- package/dist/session/ProviderUsageProvider.d.ts +2 -3
- package/dist/session/QueueTab.js +11 -1
- package/dist/session/RemindersPanel.js +10 -12
- package/dist/session/SecretsPanel.js +2 -1
- package/dist/session/SessionAccessNotice.d.ts +31 -0
- package/dist/session/SessionAccessNotice.js +69 -0
- package/dist/session/SessionDetailsDialog.d.ts +3 -1
- package/dist/session/SessionDetailsDialog.js +16 -1
- package/dist/session/SessionHeader.d.ts +10 -3
- package/dist/session/SessionHeader.js +19 -7
- package/dist/session/SessionPeopleStack.d.ts +24 -0
- package/dist/session/SessionPeopleStack.js +99 -0
- package/dist/session/SessionPlaceMenu.js +7 -6
- package/dist/session/SessionProvider.d.ts +13 -1
- package/dist/session/SessionProvider.js +21 -1
- package/dist/session/ShareSessionDialog.d.ts +32 -0
- package/dist/session/ShareSessionDialog.js +241 -0
- package/dist/session/TypingLine.d.ts +27 -0
- package/dist/session/TypingLine.js +42 -0
- package/dist/session/{UsagePanel.d.ts → UsageSection.d.ts} +9 -13
- package/dist/session/{UsagePanel.js → UsageSection.js} +40 -41
- package/dist/session/artifact-row-parts.d.ts +32 -0
- package/dist/session/artifact-row-parts.js +51 -0
- package/dist/session/headless/access.d.ts +33 -0
- package/dist/session/headless/access.js +48 -0
- package/dist/session/headless/fixture-host.d.ts +48 -9
- package/dist/session/headless/fixture-host.js +139 -1
- package/dist/session/headless/fixture-project-artifacts.d.ts +77 -0
- package/dist/session/headless/fixture-project-artifacts.js +168 -0
- package/dist/session/headless/fixture-project-content.d.ts +67 -0
- package/dist/session/headless/fixture-project-content.js +176 -0
- package/dist/session/headless/fixture-projects.d.ts +175 -0
- package/dist/session/headless/fixture-projects.js +498 -0
- package/dist/session/headless/home-layout.d.ts +18 -2
- package/dist/session/headless/home-layout.js +20 -7
- package/dist/session/headless/host.d.ts +302 -7
- package/dist/session/headless/index.d.ts +11 -4
- package/dist/session/headless/index.js +9 -2
- package/dist/session/headless/labels.d.ts +428 -4
- package/dist/session/headless/labels.js +109 -5
- package/dist/session/headless/orchestration-labels.d.ts +52 -0
- package/dist/session/headless/orchestration-labels.js +59 -0
- package/dist/session/headless/people.d.ts +29 -0
- package/dist/session/headless/people.js +53 -0
- package/dist/session/headless/place.d.ts +5 -0
- package/dist/session/headless/place.js +5 -1
- package/dist/session/headless/project-artifact-labels.d.ts +67 -0
- package/dist/session/headless/project-artifact-labels.js +96 -0
- package/dist/session/headless/project-artifacts.d.ts +124 -0
- package/dist/session/headless/project-artifacts.js +271 -0
- package/dist/session/headless/project-content-labels.d.ts +88 -0
- package/dist/session/headless/project-content-labels.js +152 -0
- package/dist/session/headless/project-labels.d.ts +123 -0
- package/dist/session/headless/project-labels.js +128 -0
- package/dist/session/headless/project-sessions.d.ts +37 -0
- package/dist/session/headless/project-sessions.js +57 -0
- package/dist/session/headless/project-usage-labels.d.ts +74 -0
- package/dist/session/headless/project-usage-labels.js +81 -0
- package/dist/session/headless/project-usage.d.ts +65 -0
- package/dist/session/headless/project-usage.js +92 -0
- package/dist/session/headless/projects.d.ts +158 -0
- package/dist/session/headless/projects.js +301 -0
- package/dist/session/headless/pushed-once.d.ts +22 -0
- package/dist/session/headless/pushed-once.js +28 -0
- package/dist/session/headless/queue.js +2 -1
- package/dist/session/headless/typing.d.ts +56 -0
- package/dist/session/headless/typing.js +115 -0
- package/dist/session/home-block-parts.d.ts +40 -0
- package/dist/session/home-block-parts.js +46 -0
- package/dist/session/index.d.ts +21 -4
- package/dist/session/index.js +20 -3
- package/dist/session/modal-shell.d.ts +1 -1
- package/dist/session/modal-shell.js +1 -1
- package/dist/session/project-artifact-parts.d.ts +59 -0
- package/dist/session/project-artifact-parts.js +222 -0
- package/dist/session/project-content-parts.d.ts +176 -0
- package/dist/session/project-content-parts.js +546 -0
- package/dist/session/project-files.d.ts +48 -0
- package/dist/session/project-files.js +54 -0
- package/dist/session/project-folder-actions.d.ts +11 -0
- package/dist/session/project-folder-actions.js +39 -0
- package/dist/session/project-mcp-add.d.ts +23 -0
- package/dist/session/project-mcp-add.js +107 -0
- package/dist/session/project-record-document.d.ts +48 -0
- package/dist/session/project-record-document.js +225 -0
- package/dist/session/project-settings-parts.d.ts +69 -0
- package/dist/session/project-settings-parts.js +90 -0
- package/dist/session/share-people.d.ts +222 -0
- package/dist/session/share-people.js +457 -0
- package/dist/session/testing/contract.d.ts +67 -8
- package/dist/session/testing/contract.js +343 -6
- package/dist/session/testing/index.d.ts +5 -2
- package/dist/session/testing/index.js +4 -1
- package/dist/session/testing/project-artifacts.contract.js +159 -0
- package/dist/session/testing/project-content.contract.d.ts +19 -0
- package/dist/session/testing/project-content.contract.js +221 -0
- package/dist/session/testing/project-sessions.contract.js +134 -0
- package/dist/session/use-folder-missing.d.ts +6 -0
- package/dist/session/use-folder-missing.js +31 -0
- package/dist/session/use-folder-project.d.ts +14 -0
- package/dist/session/use-folder-project.js +37 -0
- package/dist/session/use-home-projects.d.ts +48 -0
- package/dist/session/use-home-projects.js +118 -0
- package/dist/session/use-project-home-layout.d.ts +33 -0
- package/dist/session/use-project-home-layout.js +134 -0
- package/dist/session/use-project-home-on.d.ts +2 -0
- package/dist/session/use-project-home-on.js +14 -0
- package/dist/settings/SettingCard.d.ts +3 -1
- package/dist/settings/SettingCard.js +2 -1
- package/dist/settings/SettingDemo.d.ts +3 -1
- package/dist/settings/SettingDemo.js +4 -3
- package/dist/settings/SettingsShell.d.ts +2 -1
- package/dist/settings/SettingsShell.js +55 -43
- package/dist/settings/headless/index.d.ts +2 -1
- package/dist/settings/headless/index.js +2 -1
- package/dist/settings/headless/mcp-requirement.d.ts +93 -0
- package/dist/settings/headless/mcp-requirement.js +116 -0
- package/dist/settings/headless/search.d.ts +1 -1
- package/dist/settings/headless/sections-host.d.ts +7 -2
- package/dist/settings/index.d.ts +3 -2
- package/dist/settings/index.js +5 -4
- package/dist/settings/section.d.ts +24 -3
- package/dist/settings/section.js +27 -4
- package/dist/settings/sections/editor/labels.js +1 -1
- package/dist/settings/sections/environments/EnvironmentsSection.js +30 -6
- package/dist/settings/sections/extensions/ExtensionConfigRows.d.ts +6 -2
- package/dist/settings/sections/extensions/ExtensionConfigRows.js +10 -1
- package/dist/settings/sections/extensions/ExtensionOptionsSection.js +1 -0
- package/dist/settings/sections/extensions/ExtensionsSection.d.ts +6 -3
- package/dist/settings/sections/extensions/ExtensionsSection.js +24 -3
- package/dist/settings/sections/extensions/McpRequirementRow.d.ts +45 -0
- package/dist/settings/sections/extensions/McpRequirementRow.js +298 -0
- package/dist/settings/sections/extensions/labels.d.ts +4 -0
- package/dist/settings/sections/extensions/labels.js +4 -0
- package/dist/settings/sections/extensions/options-labels.d.ts +39 -0
- package/dist/settings/sections/extensions/options-labels.js +48 -1
- package/dist/settings/sections/extensions/use-mcp-setup.d.ts +6 -0
- package/dist/settings/sections/extensions/use-mcp-setup.js +41 -0
- package/dist/settings/sections/host-catalog/HostCatalogSection.js +3 -0
- package/dist/settings/sections/index.d.ts +4 -3
- package/dist/settings/sections/index.js +4 -3
- package/dist/settings/sections/instructions/InstructionsSection.d.ts +69 -1
- package/dist/settings/sections/instructions/InstructionsSection.js +181 -109
- package/dist/settings/sections/keybindings/labels.d.ts +3 -0
- package/dist/settings/sections/keybindings/labels.js +3 -0
- package/dist/settings/sections/keybindings/rows.js +12 -0
- package/dist/settings/sections/logs/LogsSection.js +5 -8
- package/dist/settings/sections/mcp/McpAddForm.d.ts +9 -2
- package/dist/settings/sections/mcp/McpAddForm.js +15 -7
- package/dist/settings/sections/mcp/McpServerRow.js +7 -47
- package/dist/settings/sections/mcp/McpSignIn.d.ts +38 -0
- package/dist/settings/sections/mcp/McpSignIn.js +72 -0
- package/dist/settings/sections/mcp/labels.js +1 -1
- package/dist/settings/sections/models/AgentDefaults.d.ts +12 -4
- package/dist/settings/sections/models/AgentDefaults.js +102 -70
- package/dist/settings/sections/models/ModelPickField.d.ts +10 -1
- package/dist/settings/sections/models/ModelPickField.js +87 -39
- package/dist/settings/sections/models/labels.d.ts +8 -0
- package/dist/settings/sections/models/labels.js +8 -0
- package/dist/settings/sections/performance/labels.js +2 -2
- package/dist/settings/sections/providers/ServerSignIn.d.ts +6 -1
- package/dist/settings/sections/providers/ServerSignIn.js +66 -61
- package/dist/settings/sections/skills/SkillList.d.ts +45 -0
- package/dist/settings/sections/skills/SkillList.js +58 -40
- package/dist/settings/server-app.d.ts +2 -0
- package/dist/settings/server-app.js +16 -4
- package/dist/styles.css +154 -36
- package/dist/terminal/HostTerminalSurface.js +28 -30
- package/dist/terminal/TerminalPanel.js +4 -12
- package/dist/terminal/TerminalProvider.d.ts +10 -2
- package/dist/terminal/TerminalProvider.js +10 -2
- package/dist/terminal/headless/labels.d.ts +0 -1
- package/dist/terminal/headless/labels.js +1 -2
- package/dist/terminal/headless/store.js +5 -1
- package/dist/theme/runtime-icons.js +7 -3
- package/dist/workspace/LayoutBudget.js +1 -7
- package/dist/workspace/PanelContentView.js +1 -1
- package/package.json +26 -2
- package/src/styles/app.css +6 -3
- package/src/styles/chat.css +3 -1
- package/src/styles/palette.css +15 -19
- package/src/styles/primitives.css +3 -1
- package/src/styles/transcript.css +39 -3
- package/dist/dist/index-De9AbmxS.d.ts +0 -1
- package/dist/dist/sandbox-CSUihARm.d.ts +0 -2
- /package/dist/dist/{execution-failure-SREfl-EZ.d.ts → execution-failure-_L2r_Qd-.d.ts} +0 -0
|
@@ -13,14 +13,13 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
*/
|
|
14
14
|
function HoverCard({ trigger, children, side = "right", align = "start", width, ariaLabel, testId, anchorTo }) {
|
|
15
15
|
const [open, setOpen] = useState(false);
|
|
16
|
-
const anchor = useRef(null);
|
|
17
|
-
const surface = useRef(null);
|
|
18
16
|
const timer = useRef(void 0);
|
|
19
17
|
const schedule = useCallback((next) => {
|
|
20
18
|
window.clearTimeout(timer.current);
|
|
21
19
|
timer.current = window.setTimeout(setOpen, next ? 250 : 150, next);
|
|
22
20
|
}, []);
|
|
23
21
|
const stay = useCallback(() => window.clearTimeout(timer.current), []);
|
|
22
|
+
const { triggerProps, anchor, placedAt, surface } = useHoverTrigger(anchorTo, schedule);
|
|
24
23
|
useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
25
24
|
useEffect(() => {
|
|
26
25
|
if (!open) return void 0;
|
|
@@ -34,20 +33,10 @@ function HoverCard({ trigger, children, side = "right", align = "start", width,
|
|
|
34
33
|
window.addEventListener("keydown", onKey, true);
|
|
35
34
|
return () => window.removeEventListener("keydown", onKey, true);
|
|
36
35
|
}, [open]);
|
|
37
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [trigger({
|
|
38
|
-
ref: (node) => {
|
|
39
|
-
anchor.current = node;
|
|
40
|
-
},
|
|
41
|
-
onPointerEnter: () => schedule(true),
|
|
42
|
-
onPointerLeave: () => schedule(false),
|
|
43
|
-
onFocus: () => schedule(true),
|
|
44
|
-
onBlur: (e) => {
|
|
45
|
-
if (!surface.current?.contains(e.relatedTarget)) schedule(false);
|
|
46
|
-
}
|
|
47
|
-
}, open), /* @__PURE__ */ jsx(FloatingSurface, {
|
|
36
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [trigger(triggerProps, open), /* @__PURE__ */ jsx(FloatingSurface, {
|
|
48
37
|
ref: surface,
|
|
49
38
|
open,
|
|
50
|
-
anchor: {
|
|
39
|
+
anchor: { ref: placedAt },
|
|
51
40
|
side,
|
|
52
41
|
align,
|
|
53
42
|
width,
|
|
@@ -64,4 +53,33 @@ function HoverCard({ trigger, children, side = "right", align = "start", width,
|
|
|
64
53
|
children
|
|
65
54
|
})] });
|
|
66
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The trigger's props, and the refs the card is placed and kept open by: the trigger, what it is placed against
|
|
58
|
+
* (the trigger, or the element `anchorTo` names for it) and the card.
|
|
59
|
+
*
|
|
60
|
+
* @param anchorTo - The element to place against instead of the trigger.
|
|
61
|
+
* @param schedule - Opens (`true`) or closes the card after its delay.
|
|
62
|
+
*/
|
|
63
|
+
function useHoverTrigger(anchorTo, schedule) {
|
|
64
|
+
const anchor = useRef(null);
|
|
65
|
+
const placedAt = useRef(null);
|
|
66
|
+
const surface = useRef(null);
|
|
67
|
+
return {
|
|
68
|
+
triggerProps: {
|
|
69
|
+
ref: (node) => {
|
|
70
|
+
anchor.current = node;
|
|
71
|
+
placedAt.current = node && anchorTo ? anchorTo(node) ?? node : node;
|
|
72
|
+
},
|
|
73
|
+
onPointerEnter: () => schedule(true),
|
|
74
|
+
onPointerLeave: () => schedule(false),
|
|
75
|
+
onFocus: () => schedule(true),
|
|
76
|
+
onBlur: (e) => {
|
|
77
|
+
if (!surface.current?.contains(e.relatedTarget)) schedule(false);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
anchor,
|
|
81
|
+
placedAt,
|
|
82
|
+
surface
|
|
83
|
+
};
|
|
84
|
+
}
|
|
67
85
|
export { HoverCard };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { assignRef } from "../assign-ref.js";
|
|
1
2
|
import { focusMenuRow, handleMenuKeyDown } from "../Menu.js";
|
|
2
3
|
import { FloatingSurface } from "./FloatingSurface.js";
|
|
3
4
|
import { usePopover } from "./usePopover.js";
|
|
@@ -15,12 +16,8 @@ function Popover({ trigger, children, side = "top", align = "start", width, role
|
|
|
15
16
|
const popover = usePopover({ onDismiss });
|
|
16
17
|
const { open, triggerRef, surfaceRef } = popover;
|
|
17
18
|
const surfaceId = useId();
|
|
18
|
-
const setTriggerRef = useCallback((node) =>
|
|
19
|
-
|
|
20
|
-
}, [triggerRef]);
|
|
21
|
-
const setSurfaceRef = useCallback((node) => {
|
|
22
|
-
surfaceRef.current = node;
|
|
23
|
-
}, [surfaceRef]);
|
|
19
|
+
const setTriggerRef = useCallback((node) => assignRef(triggerRef, node), [triggerRef]);
|
|
20
|
+
const setSurfaceRef = useCallback((node) => assignRef(surfaceRef, node), [surfaceRef]);
|
|
24
21
|
useEffect(() => {
|
|
25
22
|
const surface = surfaceRef.current;
|
|
26
23
|
if (!open || !surface || surface.contains(document.activeElement)) return;
|
|
@@ -53,7 +50,7 @@ function Popover({ trigger, children, side = "top", align = "start", width, role
|
|
|
53
50
|
ref: setSurfaceRef,
|
|
54
51
|
id: surfaceId,
|
|
55
52
|
open,
|
|
56
|
-
anchor: {
|
|
53
|
+
anchor: { ref: triggerRef },
|
|
57
54
|
side,
|
|
58
55
|
align,
|
|
59
56
|
width,
|
|
@@ -3,11 +3,13 @@ export type Side = 'top' | 'bottom' | 'right' | 'left';
|
|
|
3
3
|
/** How a surface lines up along the anchor's edge: with its start, its centre or its end. */
|
|
4
4
|
export type Align = 'start' | 'center' | 'end';
|
|
5
5
|
/**
|
|
6
|
-
* What a surface is placed against: an element,
|
|
7
|
-
* An element of `null` yields no placement.
|
|
6
|
+
* What a surface is placed against: an element, the element a ref holds (read when the surface is measured, so no
|
|
7
|
+
* render reads it), or a viewport point such as a right-click. An element of `null` yields no placement.
|
|
8
8
|
*/
|
|
9
9
|
export type Anchor = {
|
|
10
10
|
element: HTMLElement | null;
|
|
11
|
+
} | {
|
|
12
|
+
ref: React.RefObject<HTMLElement | null>;
|
|
11
13
|
} | {
|
|
12
14
|
point: {
|
|
13
15
|
x: number;
|
|
@@ -20,6 +22,16 @@ export interface Placement {
|
|
|
20
22
|
top: number;
|
|
21
23
|
/** Distance from the viewport's left edge, in px. */
|
|
22
24
|
left: number;
|
|
25
|
+
/**
|
|
26
|
+
* Distance from the viewport's bottom edge, in px, when the surface is held by its bottom edge (above its anchor,
|
|
27
|
+
* or aligned by its end beside it): it then grows upward, away from the anchor. Absent: held by `top`.
|
|
28
|
+
*/
|
|
29
|
+
bottom?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Distance from the viewport's right edge, in px, when the surface is held by its right edge (left of its anchor,
|
|
32
|
+
* or aligned by its end below or above it): it then grows leftward. Absent: held by `left`.
|
|
33
|
+
*/
|
|
34
|
+
right?: number;
|
|
23
35
|
/** The side actually used, which differs from the preferred one when the surface was flipped. */
|
|
24
36
|
side: Side;
|
|
25
37
|
/** CSS transform-origin that grows the surface out of its anchor. */
|
|
@@ -56,6 +68,8 @@ export interface Rect {
|
|
|
56
68
|
/**
|
|
57
69
|
* Computes where a surface goes next to an anchor. It tries `side`, flips to the opposite side
|
|
58
70
|
* when `side` does not fit but the opposite does, then clamps the result 8px inside the viewport.
|
|
71
|
+
* Unless clamped, the edge on the anchor's side (and the end edge, for `end`) is also given as
|
|
72
|
+
* `bottom` / `right`, the edges to hold the surface by.
|
|
59
73
|
*
|
|
60
74
|
* @param a - The anchor's rectangle.
|
|
61
75
|
* @param size - The surface's measured width and height.
|
|
@@ -63,6 +77,8 @@ export interface Rect {
|
|
|
63
77
|
* @param align - How the surface lines up along the anchor's edge.
|
|
64
78
|
* @param offset - Gap between anchor and surface, in px.
|
|
65
79
|
* @param viewport - The viewport size to fit in. Defaults to the window's inner size.
|
|
80
|
+
* @param keep - The side the surface is on already: it stays there while it fits, so content that grows does
|
|
81
|
+
* not flip it back and forth.
|
|
66
82
|
* @returns The position, the side used and the `transform-origin` that grows the surface out of the
|
|
67
83
|
* anchor.
|
|
68
84
|
*/
|
|
@@ -72,13 +88,13 @@ export declare function placeSurface(a: Rect, size: {
|
|
|
72
88
|
}, side: Side, align: Align, offset: number, viewport?: {
|
|
73
89
|
width: number;
|
|
74
90
|
height: number;
|
|
75
|
-
}): Placement;
|
|
91
|
+
}, keep?: Side): Placement;
|
|
76
92
|
/**
|
|
77
93
|
* Measures where a surface goes next to its anchor and keeps it current. It re-measures on
|
|
78
94
|
* resize, on scroll outside the surface and when the surface's own size changes.
|
|
79
95
|
*
|
|
80
96
|
* @param open - Whether the surface is shown. No placement is computed while it is closed.
|
|
81
|
-
* @param anchor - The element or point to place against.
|
|
97
|
+
* @param anchor - The element, ref or point to place against.
|
|
82
98
|
* @param surfaceRef - Ref to the surface element, measured for its size.
|
|
83
99
|
* @param options - The preferred `side` (default `bottom`), `align` (default `start`) and `offset`
|
|
84
100
|
* in px (default 6).
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import { useLayoutEffect, useState } from "react";
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
// src/components/floating/useAnchoredPosition.ts
|
|
3
3
|
/**
|
|
4
4
|
* Fixed-position placement for a floating surface: next to an element or at
|
|
5
5
|
* a point (a right-click), on the preferred side, flipped when it would not
|
|
6
6
|
* fit, clamped inside the viewport. Re-measures on resize, scroll and when
|
|
7
7
|
* the surface's own size changes.
|
|
8
|
+
*
|
|
9
|
+
* Content that lands late (a list read once open) must not move it: the
|
|
10
|
+
* surface is held by the edge on its anchor's side (`bottom` above it,
|
|
11
|
+
* `right` to its left, `right` when aligned by its end), so it grows away
|
|
12
|
+
* from its anchor in the frame the content lands, with no measure between.
|
|
13
|
+
* Once placed it keeps its side while that side still fits.
|
|
8
14
|
*/
|
|
9
15
|
const MARGIN = 8;
|
|
10
16
|
/**
|
|
@@ -46,11 +52,13 @@ function anchorRect(anchor) {
|
|
|
46
52
|
height: 0
|
|
47
53
|
};
|
|
48
54
|
}
|
|
49
|
-
return anchor.element?.getBoundingClientRect() ?? null;
|
|
55
|
+
return ("ref" in anchor ? anchor.ref.current : anchor.element)?.getBoundingClientRect() ?? null;
|
|
50
56
|
}
|
|
51
57
|
/**
|
|
52
58
|
* Computes where a surface goes next to an anchor. It tries `side`, flips to the opposite side
|
|
53
59
|
* when `side` does not fit but the opposite does, then clamps the result 8px inside the viewport.
|
|
60
|
+
* Unless clamped, the edge on the anchor's side (and the end edge, for `end`) is also given as
|
|
61
|
+
* `bottom` / `right`, the edges to hold the surface by.
|
|
54
62
|
*
|
|
55
63
|
* @param a - The anchor's rectangle.
|
|
56
64
|
* @param size - The surface's measured width and height.
|
|
@@ -58,13 +66,15 @@ function anchorRect(anchor) {
|
|
|
58
66
|
* @param align - How the surface lines up along the anchor's edge.
|
|
59
67
|
* @param offset - Gap between anchor and surface, in px.
|
|
60
68
|
* @param viewport - The viewport size to fit in. Defaults to the window's inner size.
|
|
69
|
+
* @param keep - The side the surface is on already: it stays there while it fits, so content that grows does
|
|
70
|
+
* not flip it back and forth.
|
|
61
71
|
* @returns The position, the side used and the `transform-origin` that grows the surface out of the
|
|
62
72
|
* anchor.
|
|
63
73
|
*/
|
|
64
74
|
function placeSurface(a, size, side, align, offset, viewport = {
|
|
65
75
|
width: window.innerWidth,
|
|
66
76
|
height: window.innerHeight
|
|
67
|
-
}) {
|
|
77
|
+
}, keep) {
|
|
68
78
|
const fits = (s) => s === "top" ? a.top - offset - size.height >= MARGIN : s === "bottom" ? a.bottom + offset + size.height <= viewport.height - MARGIN : s === "left" ? a.left - offset - size.width >= MARGIN : a.right + offset + size.width <= viewport.width - MARGIN;
|
|
69
79
|
const opposite = {
|
|
70
80
|
top: "bottom",
|
|
@@ -72,7 +82,7 @@ function placeSurface(a, size, side, align, offset, viewport = {
|
|
|
72
82
|
left: "right",
|
|
73
83
|
right: "left"
|
|
74
84
|
};
|
|
75
|
-
const chosen = fits(side) || !fits(opposite[side]) ? side : opposite[side];
|
|
85
|
+
const chosen = keep && fits(keep) ? keep : fits(side) || !fits(opposite[side]) ? side : opposite[side];
|
|
76
86
|
let top;
|
|
77
87
|
let left;
|
|
78
88
|
if (chosen === "top" || chosen === "bottom") {
|
|
@@ -82,13 +92,27 @@ function placeSurface(a, size, side, align, offset, viewport = {
|
|
|
82
92
|
left = chosen === "left" ? a.left - offset - size.width : a.right + offset;
|
|
83
93
|
top = align === "start" ? a.top : align === "end" ? a.bottom - size.height : a.top + a.height / 2 - size.height / 2;
|
|
84
94
|
}
|
|
95
|
+
const free = {
|
|
96
|
+
top,
|
|
97
|
+
left
|
|
98
|
+
};
|
|
85
99
|
left = Math.min(Math.max(MARGIN, left), Math.max(MARGIN, viewport.width - size.width - MARGIN));
|
|
86
100
|
top = Math.min(Math.max(MARGIN, top), Math.max(MARGIN, viewport.height - size.height - MARGIN));
|
|
101
|
+
const aboveOrBelow = chosen === "top" || chosen === "bottom";
|
|
102
|
+
const byBottom = top === free.top && (chosen === "top" || !aboveOrBelow && align === "end");
|
|
103
|
+
const byRight = left === free.left && (chosen === "left" || aboveOrBelow && align === "end");
|
|
104
|
+
const held = {
|
|
105
|
+
...byBottom ? { bottom: viewport.height - top - size.height } : {},
|
|
106
|
+
...byRight ? { right: viewport.width - left - size.width } : {}
|
|
107
|
+
};
|
|
108
|
+
const vertical = chosen === "top" ? "bottom" : chosen === "bottom" ? "top" : "center";
|
|
109
|
+
const horizontal = chosen === "left" ? "right" : chosen === "right" ? "left" : align === "end" ? "right" : align === "start" ? "left" : "center";
|
|
87
110
|
return {
|
|
88
111
|
top,
|
|
89
112
|
left,
|
|
113
|
+
...held,
|
|
90
114
|
side: chosen,
|
|
91
|
-
origin: `${
|
|
115
|
+
origin: `${vertical} ${horizontal}`
|
|
92
116
|
};
|
|
93
117
|
}
|
|
94
118
|
/**
|
|
@@ -96,7 +120,7 @@ function placeSurface(a, size, side, align, offset, viewport = {
|
|
|
96
120
|
* resize, on scroll outside the surface and when the surface's own size changes.
|
|
97
121
|
*
|
|
98
122
|
* @param open - Whether the surface is shown. No placement is computed while it is closed.
|
|
99
|
-
* @param anchor - The element or point to place against.
|
|
123
|
+
* @param anchor - The element, ref or point to place against.
|
|
100
124
|
* @param surfaceRef - Ref to the surface element, measured for its size.
|
|
101
125
|
* @param options - The preferred `side` (default `bottom`), `align` (default `start`) and `offset`
|
|
102
126
|
* in px (default 6).
|
|
@@ -104,26 +128,35 @@ function placeSurface(a, size, side, align, offset, viewport = {
|
|
|
104
128
|
*/
|
|
105
129
|
function useAnchoredPosition(open, anchor, surfaceRef, { side = "bottom", align = "start", offset = 6 } = {}) {
|
|
106
130
|
const [placement, setPlacement] = useState(null);
|
|
131
|
+
const placedSide = useRef(void 0);
|
|
132
|
+
if (!open && placement !== null) setPlacement(null);
|
|
107
133
|
const element = "element" in anchor ? anchor.element : null;
|
|
134
|
+
const ref = "ref" in anchor ? anchor.ref : null;
|
|
108
135
|
const px = "point" in anchor ? anchor.point.x : null;
|
|
109
136
|
const py = "point" in anchor ? anchor.point.y : null;
|
|
110
137
|
useLayoutEffect(() => {
|
|
111
138
|
if (!open) {
|
|
112
|
-
|
|
139
|
+
placedSide.current = void 0;
|
|
113
140
|
return;
|
|
114
141
|
}
|
|
115
142
|
const measure = () => {
|
|
116
143
|
const a = anchorRect(px !== null && py !== null ? { point: {
|
|
117
144
|
x: px,
|
|
118
145
|
y: py
|
|
119
|
-
} } : { element });
|
|
146
|
+
} } : ref ? { ref } : { element });
|
|
120
147
|
const surface = surfaceRef.current;
|
|
121
148
|
if (!a || !surface) return;
|
|
149
|
+
const root = document.documentElement;
|
|
150
|
+
const viewport = {
|
|
151
|
+
width: root.clientWidth || window.innerWidth,
|
|
152
|
+
height: root.clientHeight || window.innerHeight
|
|
153
|
+
};
|
|
122
154
|
const next = placeSurface(a, {
|
|
123
155
|
width: surface.offsetWidth,
|
|
124
156
|
height: surface.offsetHeight
|
|
125
|
-
}, side, align, offset);
|
|
126
|
-
|
|
157
|
+
}, side, align, offset, viewport, placedSide.current);
|
|
158
|
+
placedSide.current = next.side;
|
|
159
|
+
setPlacement((prev) => prev && prev.top === next.top && prev.left === next.left && prev.bottom === next.bottom && prev.right === next.right && prev.side === next.side ? prev : next);
|
|
127
160
|
};
|
|
128
161
|
const onScroll = (event) => {
|
|
129
162
|
if (event.target instanceof Node && surfaceRef.current?.contains(event.target)) return;
|
|
@@ -142,6 +175,7 @@ function useAnchoredPosition(open, anchor, surfaceRef, { side = "bottom", align
|
|
|
142
175
|
}, [
|
|
143
176
|
open,
|
|
144
177
|
element,
|
|
178
|
+
ref,
|
|
145
179
|
px,
|
|
146
180
|
py,
|
|
147
181
|
surfaceRef,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/components/object-key.ts
|
|
2
|
+
const keys = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
let next = 0;
|
|
4
|
+
/**
|
|
5
|
+
* A number per object identity: the same object always gives the same number, another object a new one.
|
|
6
|
+
*
|
|
7
|
+
* @param value - The object.
|
|
8
|
+
* @returns Its number.
|
|
9
|
+
*/
|
|
10
|
+
function objectKey(value) {
|
|
11
|
+
let key = keys.get(value);
|
|
12
|
+
if (key === void 0) {
|
|
13
|
+
key = ++next;
|
|
14
|
+
keys.set(value, key);
|
|
15
|
+
}
|
|
16
|
+
return key;
|
|
17
|
+
}
|
|
18
|
+
export { objectKey };
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* rows. Rows are memoized: moving the cursor renders the two rows it
|
|
7
7
|
* leaves and enters.
|
|
8
8
|
*
|
|
9
|
-
* The cursor is one block under the rows
|
|
10
|
-
* (a transform, so a move costs the compositor a frame and
|
|
11
|
-
* more than those two rows). A row says more only while it is
|
|
12
|
-
* description and its shortcut.
|
|
9
|
+
* The cursor is one block under the rows, moved to the row it marks in the
|
|
10
|
+
* frame of the key (a transform, so a move costs the compositor a frame and
|
|
11
|
+
* React nothing more than those two rows). A row says more only while it is
|
|
12
|
+
* marked: its description and its shortcut.
|
|
13
13
|
*
|
|
14
14
|
* Data is the caller's: any item with an id and a title (`PaletteEntry`),
|
|
15
15
|
* ranked into sections (`PaletteSection`). An app draws its own kinds of
|
|
@@ -111,7 +111,7 @@ export declare const PaletteRow: import("react").MemoExoticComponent<(props: Pal
|
|
|
111
111
|
}) => import("react").JSX.Element>;
|
|
112
112
|
/**
|
|
113
113
|
* Renders the palette's results: titled sections of rows in a `listbox`, windowed so only the
|
|
114
|
-
* rows in view are mounted. A block under the rows
|
|
114
|
+
* rows in view are mounted. A block under the rows marks the cursor's row.
|
|
115
115
|
*
|
|
116
116
|
* @param props - Component props.
|
|
117
117
|
*/
|
|
@@ -37,7 +37,7 @@ const PaletteRow = memo((props) => {
|
|
|
37
37
|
});
|
|
38
38
|
/**
|
|
39
39
|
* Renders the palette's results: titled sections of rows in a `listbox`, windowed so only the
|
|
40
|
-
* rows in view are mounted. A block under the rows
|
|
40
|
+
* rows in view are mounted. A block under the rows marks the cursor's row.
|
|
41
41
|
*
|
|
42
42
|
* @param props - Component props.
|
|
43
43
|
*/
|
|
@@ -75,11 +75,6 @@ function PaletteList({ groups, cursor, query, nested, onHover, onRun, renderRow,
|
|
|
75
75
|
sections,
|
|
76
76
|
viewHeight
|
|
77
77
|
]);
|
|
78
|
-
const shownSections = useRef(sections);
|
|
79
|
-
const snap = shownSections.current !== sections;
|
|
80
|
-
useLayoutEffect(() => {
|
|
81
|
-
shownSections.current = sections;
|
|
82
|
-
}, [sections]);
|
|
83
78
|
const marked = placeOfRow(sections, cursor);
|
|
84
79
|
const from = scrollTop - 320;
|
|
85
80
|
const to = scrollTop + viewHeight + 320;
|
|
@@ -106,7 +101,6 @@ function PaletteList({ groups, cursor, query, nested, onHover, onRun, renderRow,
|
|
|
106
101
|
children: [marked && /* @__PURE__ */ jsx("div", {
|
|
107
102
|
"aria-hidden": true,
|
|
108
103
|
className: "zg-palette-cursor",
|
|
109
|
-
"data-snap": snap ? "" : void 0,
|
|
110
104
|
style: {
|
|
111
105
|
height: 34,
|
|
112
106
|
left: 6,
|
|
@@ -130,14 +130,18 @@ function PalettePanel({ groups, query, onQueryChange, cursor, onCursorChange, on
|
|
|
130
130
|
...rest,
|
|
131
131
|
children: [
|
|
132
132
|
/* @__PURE__ */ jsxs("div", {
|
|
133
|
-
className: `flex items-center gap-2 h-[52px] shrink-0 shadow-[inset_0_-1px_0_var(--zg-hairline)] ${nested ? "pl-2.5 pr-4" : "px-4"}`,
|
|
133
|
+
className: `flex items-center gap-2.5 h-[52px] shrink-0 shadow-[inset_0_-1px_0_var(--zg-hairline)] ${nested ? "pl-2.5 pr-4" : "px-4"}`,
|
|
134
134
|
children: [
|
|
135
|
-
nested && onBack
|
|
135
|
+
nested && onBack ? /* @__PURE__ */ jsx(IconButton, {
|
|
136
136
|
icon: "i-ph-caret-left",
|
|
137
137
|
label: labels.paletteBack,
|
|
138
138
|
title: labels.paletteBackHint,
|
|
139
139
|
size: "sm",
|
|
140
140
|
onClick: onBack
|
|
141
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
142
|
+
"aria-hidden": true,
|
|
143
|
+
className: "shrink-0 w-4 inline-flex justify-center",
|
|
144
|
+
children: /* @__PURE__ */ jsx("span", { className: "i-ph-magnifying-glass text-zg-body text-[var(--zg-text-subtle)]" })
|
|
141
145
|
}),
|
|
142
146
|
title && /* @__PURE__ */ jsx("span", {
|
|
143
147
|
className: "zg-track-chip shrink-0 px-2.5 h-6 inline-flex items-center text-zg-label text-[var(--zg-text-muted)]",
|
|
@@ -171,9 +175,10 @@ function PalettePanel({ groups, query, onQueryChange, cursor, onCursorChange, on
|
|
|
171
175
|
spellCheck: false,
|
|
172
176
|
className: "flex-1 min-w-0 h-9 bg-transparent border-0 outline-none text-[length:var(--zg-font-size-prompt)] tracking-[-0.005em] text-[var(--zg-text)] placeholder:text-[var(--zg-text-subtle)]"
|
|
173
177
|
}),
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
"
|
|
178
|
+
/* @__PURE__ */ jsx("span", {
|
|
179
|
+
"aria-hidden": true,
|
|
180
|
+
className: "shrink-0 w-4 inline-flex justify-center",
|
|
181
|
+
children: running && /* @__PURE__ */ jsx("span", { className: "i-ph-circle-notch animate-spin text-zg-ui text-[var(--zg-text-muted)]" })
|
|
177
182
|
})
|
|
178
183
|
]
|
|
179
184
|
}),
|
|
@@ -197,11 +202,6 @@ function PalettePanel({ groups, query, onQueryChange, cursor, onCursorChange, on
|
|
|
197
202
|
/* @__PURE__ */ jsxs("div", {
|
|
198
203
|
className: "flex items-center gap-4 px-4 h-9 shrink-0 shadow-[inset_0_1px_0_var(--zg-hairline)]",
|
|
199
204
|
children: [
|
|
200
|
-
marked && /* @__PURE__ */ jsx(PaletteHint, {
|
|
201
|
-
keys: ["enter"],
|
|
202
|
-
label: verb?.(marked, nested) ?? paletteVerb(marked, nested, labels),
|
|
203
|
-
renderKeys
|
|
204
|
-
}),
|
|
205
205
|
nested && /* @__PURE__ */ jsx(PaletteHint, {
|
|
206
206
|
keys: ["⌫"],
|
|
207
207
|
label: labels.paletteBack,
|
|
@@ -211,6 +211,12 @@ function PalettePanel({ groups, query, onQueryChange, cursor, onCursorChange, on
|
|
|
211
211
|
keys: ["shift+tab"],
|
|
212
212
|
label: labels.paletteScopeHint,
|
|
213
213
|
renderKeys
|
|
214
|
+
}),
|
|
215
|
+
marked && /* @__PURE__ */ jsx(PaletteHint, {
|
|
216
|
+
className: "ml-auto",
|
|
217
|
+
keys: ["enter"],
|
|
218
|
+
label: verb?.(marked, nested) ?? paletteVerb(marked, nested, labels),
|
|
219
|
+
renderKeys
|
|
214
220
|
})
|
|
215
221
|
]
|
|
216
222
|
}),
|
|
@@ -230,9 +236,9 @@ function PalettePanel({ groups, query, onQueryChange, cursor, onCursorChange, on
|
|
|
230
236
|
});
|
|
231
237
|
}
|
|
232
238
|
/** A footer legend entry: the keys, then what they do. */
|
|
233
|
-
function PaletteHint({ keys, label, renderKeys }) {
|
|
239
|
+
function PaletteHint({ keys, label, renderKeys, className = "" }) {
|
|
234
240
|
return /* @__PURE__ */ jsxs("span", {
|
|
235
|
-
className:
|
|
241
|
+
className: `text-zg-meta text-[var(--zg-text-muted)] inline-flex items-center gap-1 ${className}`,
|
|
236
242
|
children: [keys.map((k) => /* @__PURE__ */ jsx(Fragment, { children: renderKeys(k) }, k)), /* @__PURE__ */ jsx("span", {
|
|
237
243
|
className: "ml-0.5",
|
|
238
244
|
children: label
|
|
@@ -46,5 +46,9 @@ export declare function placeOfRow(sections: readonly PlacedSection<PaletteEntry
|
|
|
46
46
|
top: number;
|
|
47
47
|
first: boolean;
|
|
48
48
|
} | null;
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* The list's cap: a share of the window, remeasured as it resizes. Read in the render of a list that mounts on
|
|
51
|
+
* the client (a palette opening), so the list is its height in its first render, not in a second one after a
|
|
52
|
+
* measure; a hydrating page reads the server's value first, as the server did.
|
|
53
|
+
*/
|
|
50
54
|
export declare function useMaxHeight(): number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useSyncExternalStore } from "react";
|
|
2
2
|
// src/components/palette/palette-layout.ts
|
|
3
3
|
/** Height of a palette row, in px. */
|
|
4
4
|
const PALETTE_ROW_H = 34;
|
|
@@ -55,15 +55,18 @@ function placeOfRow(sections, index) {
|
|
|
55
55
|
first: k === 0
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
function onResize(change) {
|
|
59
|
+
window.addEventListener("resize", change);
|
|
60
|
+
return () => window.removeEventListener("resize", change);
|
|
61
|
+
}
|
|
62
|
+
const windowMax = () => Math.round(window.innerHeight * MAX_HEIGHT_SHARE);
|
|
63
|
+
const serverMax = () => Math.round(SSR_WINDOW_H * MAX_HEIGHT_SHARE);
|
|
64
|
+
/**
|
|
65
|
+
* The list's cap: a share of the window, remeasured as it resizes. Read in the render of a list that mounts on
|
|
66
|
+
* the client (a palette opening), so the list is its height in its first render, not in a second one after a
|
|
67
|
+
* measure; a hydrating page reads the server's value first, as the server did.
|
|
68
|
+
*/
|
|
59
69
|
function useMaxHeight() {
|
|
60
|
-
|
|
61
|
-
useLayoutEffect(() => {
|
|
62
|
-
const measure = () => setMax(Math.round(window.innerHeight * MAX_HEIGHT_SHARE));
|
|
63
|
-
measure();
|
|
64
|
-
window.addEventListener("resize", measure);
|
|
65
|
-
return () => window.removeEventListener("resize", measure);
|
|
66
|
-
}, []);
|
|
67
|
-
return max;
|
|
70
|
+
return useSyncExternalStore(onResize, windowMax, serverMax);
|
|
68
71
|
}
|
|
69
72
|
export { PALETTE_HEADER_H, PALETTE_OVERSCAN_PX, PALETTE_PAD, PALETTE_ROW_H, layoutPalette, placeOfRow, useMaxHeight };
|
|
@@ -4,11 +4,14 @@ export interface TooltipArming {
|
|
|
4
4
|
armed: 'hover' | 'focus' | null;
|
|
5
5
|
/** The pointer is over the anchor now. */
|
|
6
6
|
pointerInside: () => boolean;
|
|
7
|
+
/** The anchor was pressed since the pointer came in: a press the tooltip, mounting after it, never heard. */
|
|
8
|
+
pressed: () => boolean;
|
|
7
9
|
/** Spread on the anchor (call them from your own handlers if you set the same ones). */
|
|
8
10
|
handlers: {
|
|
9
11
|
onMouseEnter: () => void;
|
|
10
12
|
onMouseLeave: () => void;
|
|
11
13
|
onFocus: () => void;
|
|
14
|
+
onPointerDown: () => void;
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
@@ -12,6 +12,7 @@ import { useRef, useState } from "react";
|
|
|
12
12
|
function useTooltipArming() {
|
|
13
13
|
const [armed, setArmed] = useState(null);
|
|
14
14
|
const inside = useRef(false);
|
|
15
|
+
const pressedRef = useRef(false);
|
|
15
16
|
const [handlers] = useState(() => ({
|
|
16
17
|
onMouseEnter: () => {
|
|
17
18
|
inside.current = true;
|
|
@@ -19,13 +20,19 @@ function useTooltipArming() {
|
|
|
19
20
|
},
|
|
20
21
|
onMouseLeave: () => {
|
|
21
22
|
inside.current = false;
|
|
23
|
+
pressedRef.current = false;
|
|
22
24
|
},
|
|
23
|
-
onFocus: () => setArmed((a) => a ?? "focus")
|
|
25
|
+
onFocus: () => setArmed((a) => a ?? "focus"),
|
|
26
|
+
onPointerDown: () => {
|
|
27
|
+
pressedRef.current = true;
|
|
28
|
+
}
|
|
24
29
|
}));
|
|
25
30
|
const [pointerInside] = useState(() => () => inside.current);
|
|
31
|
+
const [pressed] = useState(() => () => pressedRef.current);
|
|
26
32
|
return {
|
|
27
33
|
armed,
|
|
28
34
|
pointerInside,
|
|
35
|
+
pressed,
|
|
29
36
|
handlers
|
|
30
37
|
};
|
|
31
38
|
}
|