zidane-ui 9.2.3 → 9.4.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/live.d.ts +8 -0
- package/dist/adapters/live.js +19 -8
- package/dist/adapters/server-composer-host.js +22 -9
- package/dist/adapters/server-git-host.js +5 -2
- package/dist/adapters/server-host.js +158 -27
- package/dist/adapters/server-machines-host.js +7 -0
- package/dist/adapters/server-media.d.ts +9 -1
- package/dist/adapters/server-media.js +14 -1
- package/dist/adapters/server-session-host.js +49 -0
- 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/appearance/ZoomIndicator.js +5 -8
- package/dist/chat/HostTranscript.d.ts +0 -12
- package/dist/chat/HostTranscript.js +20 -1
- package/dist/chat/SessionStreamsProvider.d.ts +9 -1
- package/dist/chat/SessionStreamsProvider.js +11 -2
- package/dist/chat/Transcript.d.ts +21 -11
- package/dist/chat/Transcript.js +346 -161
- 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/use-draft-target.js +15 -3
- package/dist/chat/headless/block-runs.js +26 -1
- package/dist/chat/headless/chip-views.js +1 -1
- package/dist/chat/headless/draft-target.d.ts +28 -1
- package/dist/chat/headless/draft-target.js +22 -1
- package/dist/chat/headless/host.d.ts +43 -7
- package/dist/chat/headless/hosts.d.ts +4 -0
- package/dist/chat/headless/index.d.ts +27 -26
- package/dist/chat/headless/index.js +15 -14
- package/dist/chat/headless/labels.d.ts +17 -0
- package/dist/chat/headless/labels.js +17 -0
- package/dist/chat/headless/markdown-chunks.d.ts +2 -1
- package/dist/chat/headless/markdown-chunks.js +12 -20
- package/dist/chat/headless/markdown-scan.d.ts +64 -0
- package/dist/chat/headless/markdown-scan.js +119 -0
- package/dist/chat/headless/markdown-stream.d.ts +64 -0
- package/dist/chat/headless/markdown-stream.js +143 -0
- package/dist/chat/headless/output-pager.d.ts +68 -0
- package/dist/chat/headless/output-pager.js +113 -0
- package/dist/chat/headless/prompt-origin.d.ts +2 -0
- package/dist/chat/headless/prompt-origin.js +6 -2
- package/dist/chat/headless/session-list.d.ts +10 -0
- package/dist/chat/headless/sidebar/activity.d.ts +14 -0
- package/dist/chat/headless/sidebar/activity.js +32 -0
- package/dist/chat/headless/sidebar/directory.d.ts +19 -2
- package/dist/chat/headless/sidebar/directory.js +19 -51
- package/dist/chat/headless/sidebar/environment.d.ts +15 -4
- package/dist/chat/headless/sidebar/environment.js +27 -9
- package/dist/chat/headless/sidebar/index.d.ts +2 -2
- package/dist/chat/headless/sidebar/index.js +2 -2
- package/dist/chat/headless/sidebar/labels.d.ts +19 -2
- package/dist/chat/headless/sidebar/labels.js +8 -1
- package/dist/chat/headless/sidebar/prewarm.d.ts +68 -0
- package/dist/chat/headless/sidebar/prewarm.js +114 -0
- package/dist/chat/headless/streams/actions.d.ts +4 -2
- package/dist/chat/headless/streams/actions.js +2 -1
- package/dist/chat/headless/streams/event-bytes.d.ts +17 -0
- package/dist/chat/headless/streams/event-bytes.js +46 -0
- package/dist/chat/headless/streams/live-events.d.ts +25 -1
- package/dist/chat/headless/streams/live-events.js +53 -2
- package/dist/chat/headless/streams/selectors.d.ts +3 -0
- package/dist/chat/headless/streams/selectors.js +8 -1
- package/dist/chat/headless/streams/session-streams.d.ts +15 -3
- package/dist/chat/headless/streams/session-streams.js +31 -3
- package/dist/chat/headless/streams/store.d.ts +45 -6
- package/dist/chat/headless/streams/store.js +85 -31
- package/dist/chat/headless/streams/transcript-map.d.ts +57 -0
- package/dist/chat/headless/streams/transcript-map.js +85 -0
- package/dist/chat/headless/streams/transcript.d.ts +4 -2
- package/dist/chat/headless/streams/transcript.js +19 -7
- package/dist/chat/headless/streams/types.d.ts +2 -1
- package/dist/chat/headless/transcript/batch.js +5 -1
- package/dist/chat/headless/transcript/blob-media.d.ts +15 -0
- package/dist/chat/headless/transcript/blob-media.js +23 -0
- package/dist/chat/headless/transcript/collapse.d.ts +10 -0
- package/dist/chat/headless/transcript/collapse.js +35 -6
- package/dist/chat/headless/transcript/derive.d.ts +98 -0
- package/dist/chat/headless/transcript/derive.js +89 -0
- package/dist/chat/headless/transcript/exchange-media.d.ts +3 -1
- package/dist/chat/headless/transcript/exchange-media.js +8 -5
- package/dist/chat/headless/transcript/fold-attachments.d.ts +2 -0
- package/dist/chat/headless/transcript/fold-attachments.js +3 -2
- package/dist/chat/headless/transcript/fold.d.ts +2 -1
- package/dist/chat/headless/transcript/fold.js +16 -6
- package/dist/chat/headless/transcript/incremental.d.ts +53 -0
- package/dist/chat/headless/transcript/incremental.js +181 -0
- package/dist/chat/headless/transcript/index.d.ts +2 -2
- package/dist/chat/headless/transcript/index.js +2 -2
- package/dist/chat/headless/transcript/nesting.js +2 -1
- package/dist/chat/headless/transcript/rail.d.ts +50 -1
- package/dist/chat/headless/transcript/rail.js +165 -23
- package/dist/chat/headless/transcript/rows.d.ts +5 -1
- package/dist/chat/headless/transcript/run-failures.js +2 -1
- package/dist/chat/headless/transcript/seams.d.ts +78 -0
- package/dist/chat/headless/transcript/seams.js +116 -0
- package/dist/chat/headless/transcript/tool-media.d.ts +6 -7
- package/dist/chat/headless/transcript/tool-media.js +27 -9
- package/dist/chat/index.d.ts +9 -8
- package/dist/chat/index.js +18 -17
- package/dist/chat/sidebar/ProjectIcon.js +1 -1
- package/dist/chat/sidebar/RowChips.js +2 -2
- package/dist/chat/sidebar/SessionSidebar.d.ts +6 -0
- package/dist/chat/sidebar/SessionSidebar.js +23 -16
- package/dist/chat/sidebar/SidebarFilterMenu.js +0 -1
- package/dist/chat/sidebar/SidebarFold.js +17 -16
- package/dist/chat/sidebar/SidebarFooter.d.ts +8 -5
- package/dist/chat/sidebar/SidebarFooter.js +6 -6
- package/dist/chat/sidebar/SidebarSessionRow.d.ts +7 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +11 -8
- 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.js +28 -4
- package/dist/chat/sidebar/useInboxRows.js +6 -6
- package/dist/chat/sidebar/useInboxTriage.js +50 -47
- package/dist/chat/sidebar/useSessionSearch.js +19 -18
- package/dist/chat/testing/contract.d.ts +5 -3
- package/dist/chat/testing/contract.js +66 -1
- package/dist/chat/transcript/DiffLines.d.ts +6 -1
- package/dist/chat/transcript/DiffLines.js +35 -20
- package/dist/chat/transcript/EditDiffBlock.d.ts +5 -1
- package/dist/chat/transcript/EditDiffBlock.js +89 -30
- package/dist/chat/transcript/FileChip.js +28 -0
- package/dist/chat/transcript/LazyRow.d.ts +40 -40
- package/dist/chat/transcript/LazyRow.js +100 -149
- package/dist/chat/transcript/MermaidDiagram.js +2 -1
- package/dist/chat/transcript/PromptEcho.js +3 -11
- package/dist/chat/transcript/SessionChip.d.ts +11 -0
- package/dist/chat/transcript/SessionChip.js +34 -0
- package/dist/chat/transcript/SubagentBlock.js +3 -2
- package/dist/chat/transcript/TranscriptRail.d.ts +25 -2
- package/dist/chat/transcript/TranscriptRail.js +175 -17
- package/dist/chat/transcript/TranscriptRow.d.ts +4 -7
- package/dist/chat/transcript/TranscriptRow.js +4 -3
- package/dist/chat/transcript/actions.d.ts +37 -1
- package/dist/chat/transcript/actions.js +27 -1
- package/dist/chat/transcript/chip-details.d.ts +11 -0
- package/dist/chat/transcript/chip-details.js +17 -1
- package/dist/chat/transcript/clipped-output.d.ts +58 -0
- package/dist/chat/transcript/clipped-output.js +131 -0
- package/dist/chat/transcript/fold-attachments.js +10 -5
- package/dist/chat/transcript/fold-worker.js +5 -3
- package/dist/chat/transcript/fold.js +13 -4
- package/dist/chat/transcript/index.d.ts +11 -10
- package/dist/chat/transcript/index.js +10 -9
- package/dist/chat/transcript/markdown-cache.d.ts +17 -2
- package/dist/chat/transcript/markdown-cache.js +48 -4
- package/dist/chat/transcript/markdown.js +110 -55
- package/dist/chat/transcript/media-gallery.d.ts +3 -2
- package/dist/chat/transcript/media-gallery.js +19 -19
- package/dist/chat/transcript/messages.js +5 -4
- package/dist/chat/transcript/notices.js +2 -1
- package/dist/chat/transcript/prompt.d.ts +1 -1
- package/dist/chat/transcript/prompt.js +6 -4
- package/dist/chat/transcript/prose.js +2 -1
- package/dist/chat/transcript/root-items.d.ts +96 -0
- package/dist/chat/transcript/root-items.js +180 -0
- package/dist/chat/transcript/row-mount.d.ts +184 -0
- package/dist/chat/transcript/row-mount.js +532 -0
- package/dist/chat/transcript/row-parking.d.ts +152 -0
- package/dist/chat/transcript/row-parking.js +171 -0
- package/dist/chat/transcript/row-ui-state.d.ts +37 -0
- package/dist/chat/transcript/row-ui-state.js +53 -0
- package/dist/chat/transcript/run-rows.js +3 -2
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/tasks.js +3 -2
- package/dist/chat/transcript/tool-media.d.ts +4 -2
- package/dist/chat/transcript/tool-media.js +15 -7
- package/dist/chat/transcript/tool-parts.d.ts +27 -4
- package/dist/chat/transcript/tool-parts.js +31 -6
- package/dist/chat/transcript/tool-payload.js +26 -11
- package/dist/chat/transcript/tool-row.d.ts +2 -1
- package/dist/chat/transcript/tool-row.js +38 -19
- package/dist/chat/transcript/use-transcript-rows.d.ts +25 -8
- package/dist/chat/transcript/use-transcript-rows.js +28 -46
- package/dist/chat/transcript/useHistoryBackfill.d.ts +42 -0
- package/dist/chat/transcript/useHistoryBackfill.js +170 -0
- package/dist/chat/transcript/useStickToBottom.js +2 -3
- 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 +35 -19
- package/dist/chat/transcript/useTranscriptSelectionCopy.d.ts +5 -5
- package/dist/chat/transcript/useTranscriptSelectionCopy.js +28 -7
- package/dist/chat/transcript/view-scope.d.ts +26 -6
- package/dist/chat/transcript/view-scope.js +106 -20
- package/dist/code/editor/FileTree.d.ts +2 -0
- package/dist/code/editor/FileTree.js +1 -1
- package/dist/code/editor/FileView.js +16 -25
- 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/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/RowActionsMenu.js +7 -14
- package/dist/components/Tooltip.d.ts +4 -1
- package/dist/components/Tooltip.js +8 -6
- package/dist/components/assign-ref.d.ts +8 -0
- package/dist/components/assign-ref.js +12 -0
- package/dist/components/floating/FloatingSurface.js +2 -2
- package/dist/components/floating/HoverCard.js +32 -14
- package/dist/components/floating/Popover.js +4 -7
- package/dist/components/floating/useAnchoredPosition.d.ts +5 -3
- package/dist/components/floating/useAnchoredPosition.js +7 -7
- package/dist/components/object-key.d.ts +7 -0
- package/dist/components/object-key.js +18 -0
- package/dist/components/palette/PaletteList.js +2 -7
- package/dist/components/tooltip-arming.d.ts +3 -0
- package/dist/components/tooltip-arming.js +8 -1
- package/dist/core.css +3 -3
- package/dist/dist/{index-E1Z0aPmi.d.ts → index-BheVJOLc.d.ts} +3 -1
- package/dist/dist/index.d.ts +2 -2
- 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 +3 -7
- 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/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 +5 -3
- package/dist/git/MoveSessionDialog.d.ts +18 -8
- package/dist/git/MoveSessionDialog.js +32 -53
- package/dist/git/MoveToDialog.d.ts +61 -0
- package/dist/git/MoveToDialog.js +240 -0
- package/dist/git/SandboxManager.js +9 -4
- package/dist/git/SyncChip.js +11 -4
- package/dist/git/TeleportSessionDialog.d.ts +69 -0
- package/dist/git/TeleportSessionDialog.js +440 -0
- 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 +44 -1
- package/dist/git/headless/labels.js +50 -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 +4 -2
- package/dist/git/index.js +4 -2
- package/dist/git/useEnvironmentChoices.d.ts +5 -2
- package/dist/git/useEnvironmentChoices.js +12 -4
- 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 +3 -2
- package/dist/index.js +2 -1
- 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/machines/AddServerForm.js +55 -3
- 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/HostsSection.js +5 -1
- package/dist/machines/OrganizationPanel.d.ts +25 -0
- package/dist/machines/OrganizationPanel.js +266 -0
- package/dist/machines/PersonalLayerPanel.d.ts +32 -0
- package/dist/machines/PersonalLayerPanel.js +360 -0
- package/dist/machines/headless/fixture-host.d.ts +10 -0
- package/dist/machines/headless/fixture-host.js +44 -0
- package/dist/machines/headless/host.d.ts +21 -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 +55 -0
- package/dist/machines/headless/labels.js +58 -1
- package/dist/machines/headless/layer.d.ts +64 -0
- package/dist/machines/headless/layer.js +56 -0
- package/dist/machines/headless/organization.d.ts +38 -0
- package/dist/machines/headless/organization.js +44 -0
- package/dist/machines/index.d.ts +3 -1
- package/dist/machines/index.js +3 -1
- package/dist/machines/testing/contract.d.ts +25 -1
- package/dist/machines/testing/contract.js +97 -1
- 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/palette/headless/app-sources.js +37 -0
- package/dist/palette/headless/labels.js +3 -0
- package/dist/server/sse-handler.js +25 -2
- package/dist/session/DiffFileTree.js +1 -4
- package/dist/session/OpenSessionsDialog.d.ts +46 -0
- package/dist/session/OpenSessionsDialog.js +170 -0
- package/dist/session/PlanTracker.js +1 -2
- package/dist/session/ProjectHome.js +10 -9
- package/dist/session/RemindersPanel.js +10 -12
- package/dist/session/SecretsPanel.js +2 -1
- package/dist/session/SessionHeader.js +1 -0
- package/dist/session/SessionPeopleStack.d.ts +23 -0
- package/dist/session/SessionPeopleStack.js +65 -0
- package/dist/session/SessionPlaceMenu.js +5 -4
- package/dist/session/ShareSessionDialog.d.ts +32 -0
- package/dist/session/ShareSessionDialog.js +342 -0
- package/dist/session/TypingLine.d.ts +22 -0
- package/dist/session/TypingLine.js +31 -0
- package/dist/session/headless/host.d.ts +40 -1
- package/dist/session/headless/index.d.ts +4 -2
- package/dist/session/headless/index.js +3 -1
- package/dist/session/headless/labels.d.ts +49 -0
- package/dist/session/headless/labels.js +56 -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/typing.d.ts +37 -0
- package/dist/session/headless/typing.js +60 -0
- package/dist/session/index.d.ts +5 -1
- package/dist/session/index.js +5 -1
- package/dist/settings/headless/fixture-performance.js +4 -2
- package/dist/settings/headless/performance.d.ts +4 -0
- package/dist/settings/headless/search.d.ts +1 -1
- package/dist/settings/headless/sections-host.d.ts +7 -2
- package/dist/settings/section.d.ts +15 -3
- package/dist/settings/section.js +15 -3
- package/dist/settings/sections/environments/EnvironmentsSection.js +30 -6
- 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/performance/PerformanceSection.js +8 -1
- package/dist/settings/sections/performance/labels.d.ts +2 -0
- package/dist/settings/sections/performance/labels.js +2 -0
- package/dist/styles.css +65 -9
- 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/views/headless/answers.d.ts +8 -2
- package/dist/views/headless/answers.js +58 -1
- package/dist/views/headless/placement.d.ts +78 -0
- package/dist/views/headless/placement.js +154 -44
- package/dist/workspace/LayoutBudget.js +1 -7
- package/package.json +2 -2
- package/src/styles/chat.css +3 -1
- package/src/styles/palette.css +3 -3
- package/src/styles/transcript.css +50 -5
- /package/dist/dist/{index-De9AbmxS.d.ts → index-ttmMvjgM.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FLIP_CLIP_ATTR } from "../../motion/flip-list.js";
|
|
2
2
|
import { readMotionMs, usePresence } from "../../motion/presence.js";
|
|
3
|
-
import { Children,
|
|
3
|
+
import { Children, useState } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
// src/chat/sidebar/SidebarFold.tsx
|
|
6
6
|
const readSettleMs = () => readMotionMs("settle");
|
|
@@ -9,24 +9,25 @@ function SidebarFold({ open, folded, children, className, style }) {
|
|
|
9
9
|
const has = Children.count(children) > 0;
|
|
10
10
|
const shown = open && has;
|
|
11
11
|
const staying = usePresence(shown, { exitMs: readSettleMs }).mounted;
|
|
12
|
-
const
|
|
13
|
-
if (shown) last.current = children;
|
|
14
|
-
const was = useRef({
|
|
12
|
+
const [fold, setFold] = useState({
|
|
15
13
|
shown,
|
|
16
|
-
folded
|
|
14
|
+
folded,
|
|
15
|
+
last: shown ? children : null,
|
|
16
|
+
instant: false,
|
|
17
|
+
emptied: false
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (shown) emptied.current = false;
|
|
22
|
-
else if (was.current.shown && byRows) emptied.current = true;
|
|
23
|
-
const rows = shown ? children : staying && !emptied.current ? last.current : null;
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
was.current = {
|
|
19
|
+
if (fold.shown !== shown || fold.folded !== folded || shown && fold.last !== children) {
|
|
20
|
+
const byRows = folded !== void 0 && fold.folded === folded;
|
|
21
|
+
setFold({
|
|
26
22
|
shown,
|
|
27
|
-
folded
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
folded,
|
|
24
|
+
last: shown ? children : fold.last,
|
|
25
|
+
instant: shown !== fold.shown && byRows,
|
|
26
|
+
emptied: shown ? false : fold.shown && byRows || fold.emptied
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
const { instant, emptied } = fold;
|
|
30
|
+
const rows = shown ? children : staying && !emptied ? fold.last : null;
|
|
30
31
|
return /* @__PURE__ */ jsx("li", {
|
|
31
32
|
className: `zg-fold zg-collapsible${className ? ` ${className}` : ""}`,
|
|
32
33
|
style,
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* [status …] [spaces] [settings]
|
|
5
5
|
*
|
|
6
|
-
* The status side holds what the
|
|
7
|
-
*
|
|
6
|
+
* The status side holds what is the same in every space (the daemon dot), then
|
|
7
|
+
* what the app puts there (the sign-in prompt, the usage chip, the compacting
|
|
8
|
+
* indicator, each below), then what
|
|
8
9
|
* extensions put in `sidebar.footer` and `app.statusbar`; the spaces
|
|
9
10
|
* switcher sits at the TRUE center (equal `1fr` sides, each clipping rather
|
|
10
11
|
* than pushing it; without it the status side runs up to the gear, clipping
|
|
@@ -23,7 +24,9 @@ export interface SidebarSettingsNote {
|
|
|
23
24
|
}
|
|
24
25
|
/** Props of {@link SidebarFooter}. */
|
|
25
26
|
export interface SidebarFooterProps {
|
|
26
|
-
/** The status side
|
|
27
|
+
/** The status side's start: what is the same in every space (the daemon dot). It stays put on a space switch. */
|
|
28
|
+
pinned?: ReactNode;
|
|
29
|
+
/** The status side, after `pinned`: the app's indicators. They slide with the list on a space switch. */
|
|
27
30
|
status?: ReactNode;
|
|
28
31
|
/** The center: the spaces switcher (Spaces on). */
|
|
29
32
|
spaces?: ReactNode;
|
|
@@ -41,9 +44,9 @@ export interface SidebarFooterProps {
|
|
|
41
44
|
/**
|
|
42
45
|
* Renders the sidebar's footer strip.
|
|
43
46
|
*
|
|
44
|
-
* @param props - The status side, the spaces switcher, the settings gear, `className` and `style`.
|
|
47
|
+
* @param props - The pinned status, the status side, the spaces switcher, the settings gear, `className` and `style`.
|
|
45
48
|
*/
|
|
46
|
-
export declare function SidebarFooter({ status, spaces, onOpenSettings, settingsNote, sessionId, className, style }: SidebarFooterProps): import("react").JSX.Element;
|
|
49
|
+
export declare function SidebarFooter({ pinned, status, spaces, onOpenSettings, settingsNote, sessionId, className, style }: SidebarFooterProps): import("react").JSX.Element;
|
|
47
50
|
/** Props of {@link SidebarSignInPrompt}. */
|
|
48
51
|
export interface SidebarSignInPromptProps {
|
|
49
52
|
/** Opens the sign-in. */
|
|
@@ -11,18 +11,18 @@ import { activeSnapshotFor, compactingParts, formatUsagePercent, mostConstrained
|
|
|
11
11
|
/**
|
|
12
12
|
* Renders the sidebar's footer strip.
|
|
13
13
|
*
|
|
14
|
-
* @param props - The status side, the spaces switcher, the settings gear, `className` and `style`.
|
|
14
|
+
* @param props - The pinned status, the status side, the spaces switcher, the settings gear, `className` and `style`.
|
|
15
15
|
*/
|
|
16
|
-
function SidebarFooter({ status, spaces, onOpenSettings, settingsNote, sessionId, className = "", style }) {
|
|
16
|
+
function SidebarFooter({ pinned, status, spaces, onOpenSettings, settingsNote, sessionId, className = "", style }) {
|
|
17
17
|
const scoped = sessionId ? { sessionId } : {};
|
|
18
18
|
const labels = useSidebarLabels();
|
|
19
19
|
return /* @__PURE__ */ jsxs("div", {
|
|
20
20
|
className: `grid ${spaces ? "grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]" : "grid-cols-[minmax(0,1fr)_auto]"} items-center gap-2 px-2 pt-[5px] pb-1 text-zg-meta text-[var(--zg-text-muted)] shrink-0${className ? ` ${className}` : ""}`,
|
|
21
21
|
style,
|
|
22
22
|
children: [
|
|
23
|
-
/* @__PURE__ */
|
|
24
|
-
className: "relative flex items-center min-w-0 -mx-1.5 px-1.5 [overflow-x:clip]",
|
|
25
|
-
children: /* @__PURE__ */ jsxs(SpaceSlideRegion, {
|
|
23
|
+
/* @__PURE__ */ jsxs("div", {
|
|
24
|
+
className: "relative flex items-center gap-2 min-w-0 -mx-1.5 px-1.5 [overflow-x:clip]",
|
|
25
|
+
children: [pinned, /* @__PURE__ */ jsxs(SpaceSlideRegion, {
|
|
26
26
|
className: "flex items-center gap-2 min-w-0",
|
|
27
27
|
children: [
|
|
28
28
|
status,
|
|
@@ -35,7 +35,7 @@ function SidebarFooter({ status, spaces, onOpenSettings, settingsNote, sessionId
|
|
|
35
35
|
...scoped
|
|
36
36
|
})
|
|
37
37
|
]
|
|
38
|
-
})
|
|
38
|
+
})]
|
|
39
39
|
}),
|
|
40
40
|
spaces && /* @__PURE__ */ jsx("div", {
|
|
41
41
|
className: "flex items-center justify-center min-w-0",
|
|
@@ -44,6 +44,12 @@ export interface SidebarRowHandlers {
|
|
|
44
44
|
onMoveToSpace: (sessionId: string, spaceId: string) => void;
|
|
45
45
|
/** Moves it to another environment of its host ("Move to…"). Absent: no row. */
|
|
46
46
|
onMoveSession?: (sessionId: string) => void;
|
|
47
|
+
/** Teleports it to another host ("Teleport to…"). Absent: no row. */
|
|
48
|
+
onTeleportSession?: (sessionId: string) => void;
|
|
49
|
+
/** Opens who shares it ("Share…"). Absent: no row. */
|
|
50
|
+
onShareSession?: (sessionId: string) => void;
|
|
51
|
+
/** Whether this session can be shared. Absent: it can, when `onShareSession` is given. */
|
|
52
|
+
canShareSession?: (sessionId: string) => boolean;
|
|
47
53
|
/** Its menu opened. */
|
|
48
54
|
onOpenMenu: (sessionId: string) => void;
|
|
49
55
|
/** Its menu closed. */
|
|
@@ -124,4 +130,4 @@ export interface SidebarSessionRowProps extends SidebarRowHandlers {
|
|
|
124
130
|
style?: CSSProperties;
|
|
125
131
|
}
|
|
126
132
|
/** Renders one session of the sidebar list. Memoized: keep every prop stable. */
|
|
127
|
-
export declare const SidebarSessionRow: import("react").MemoExoticComponent<({ sessionId, title, cwd, hostId, hostBadge, spaceId, isMain, isActive, isRenaming, archived, favorite, scheduled, startedFromKey, renameValue, menuOpen, onSelect, onRenameValueChange, onRenameCommit, onRenameCancel, onStartRename, onDelete, onSetArchived, onSetFavorite, onRetryEnvironment, onWakeEnvironment, onRunEnvironmentAction, onMoveToSpace, onMoveSession, onOpenMenu, onCloseMenu, excerpt, excerptQuery, project, updatedAt, environment, runDetails, artifactBadges, spaces, live, decoration, inboxSection, inboxHandlers, snoozedUntil, woke, recede, selected, swept, className, style }: SidebarSessionRowProps) => import("react").JSX.Element | null>;
|
|
133
|
+
export declare const SidebarSessionRow: import("react").MemoExoticComponent<({ sessionId, title, cwd, hostId, hostBadge, spaceId, isMain, isActive, isRenaming, archived, favorite, scheduled, startedFromKey, renameValue, menuOpen, onSelect, onRenameValueChange, onRenameCommit, onRenameCancel, onStartRename, onDelete, onSetArchived, onSetFavorite, onRetryEnvironment, onWakeEnvironment, onRunEnvironmentAction, onMoveToSpace, onMoveSession, onTeleportSession, onShareSession, canShareSession, onOpenMenu, onCloseMenu, excerpt, excerptQuery, project, updatedAt, environment, runDetails, artifactBadges, spaces, live, decoration, inboxSection, inboxHandlers, snoozedUntil, woke, recede, selected, swept, className, style }: SidebarSessionRowProps) => import("react").JSX.Element | null>;
|
|
@@ -27,7 +27,7 @@ const ExcerptHighlight = memo(({ text, query }) => {
|
|
|
27
27
|
});
|
|
28
28
|
ExcerptHighlight.displayName = "ExcerptHighlight";
|
|
29
29
|
/** Renders one session of the sidebar list. Memoized: keep every prop stable. */
|
|
30
|
-
const SidebarSessionRow = memo(({ sessionId, title, cwd, hostId, hostBadge = true, spaceId, isMain, isActive, isRenaming, archived, favorite = false, scheduled = false, startedFromKey, renameValue, menuOpen, onSelect, onRenameValueChange, onRenameCommit, onRenameCancel, onStartRename, onDelete, onSetArchived, onSetFavorite, onRetryEnvironment, onWakeEnvironment, onRunEnvironmentAction, onMoveToSpace, onMoveSession, onOpenMenu, onCloseMenu, excerpt, excerptQuery, project, updatedAt, environment, runDetails, artifactBadges, spaces, live, decoration, inboxSection, inboxHandlers, snoozedUntil, woke = false, recede = false, selected = false, swept = false, className, style }) => {
|
|
30
|
+
const SidebarSessionRow = memo(({ sessionId, title, cwd, hostId, hostBadge = true, spaceId, isMain, isActive, isRenaming, archived, favorite = false, scheduled = false, startedFromKey, renameValue, menuOpen, onSelect, onRenameValueChange, onRenameCommit, onRenameCancel, onStartRename, onDelete, onSetArchived, onSetFavorite, onRetryEnvironment, onWakeEnvironment, onRunEnvironmentAction, onMoveToSpace, onMoveSession, onTeleportSession, onShareSession, canShareSession, onOpenMenu, onCloseMenu, excerpt, excerptQuery, project, updatedAt, environment, runDetails, artifactBadges, spaces, live, decoration, inboxSection, inboxHandlers, snoozedUntil, woke = false, recede = false, selected = false, swept = false, className, style }) => {
|
|
31
31
|
const { SessionStatusDot, RowMeta, RowArtifacts } = live;
|
|
32
32
|
const host = useSidebarHost();
|
|
33
33
|
const labels = useSidebarLabels();
|
|
@@ -36,7 +36,7 @@ const SidebarSessionRow = memo(({ sessionId, title, cwd, hostId, hostBadge = tru
|
|
|
36
36
|
/** A new commit or pull request just arrived: the row sweeps once. */
|
|
37
37
|
const [arrived, setArrived] = useState(false);
|
|
38
38
|
const environmentActions = useEnvironmentActions(sessionId, menuOpen && environment?.state === "ready");
|
|
39
|
-
const
|
|
39
|
+
const baseMenuItems = useMemo(() => sessionMenuItems({
|
|
40
40
|
id: sessionId,
|
|
41
41
|
title,
|
|
42
42
|
cwd: cwd ?? "",
|
|
@@ -59,11 +59,13 @@ const SidebarSessionRow = memo(({ sessionId, title, cwd, hostId, hostBadge = tru
|
|
|
59
59
|
...onWakeEnvironment ? { wakeEnvironment: () => onWakeEnvironment(sessionId) } : {},
|
|
60
60
|
runEnvironmentAction: (actionId, label) => onRunEnvironmentAction(sessionId, actionId, label),
|
|
61
61
|
moveToSpace: (space) => onMoveToSpace(sessionId, space),
|
|
62
|
-
...onMoveSession ? { moveSession: () => onMoveSession(sessionId) } : {}
|
|
62
|
+
...onMoveSession ? { moveSession: () => onMoveSession(sessionId) } : {},
|
|
63
|
+
...onTeleportSession ? { teleportSession: () => onTeleportSession(sessionId) } : {},
|
|
64
|
+
...onShareSession && (canShareSession?.(sessionId) ?? true) ? { shareSession: () => onShareSession(sessionId) } : {}
|
|
63
65
|
}, labels).map((item) => inboxSection && item.id === "favorite" ? {
|
|
64
66
|
...item,
|
|
65
67
|
label: favorite ? labels.inboxMenuUnpin : labels.inboxMenuPin
|
|
66
|
-
} : item)
|
|
68
|
+
} : item), [
|
|
67
69
|
sessionId,
|
|
68
70
|
title,
|
|
69
71
|
cwd,
|
|
@@ -77,10 +79,7 @@ const SidebarSessionRow = memo(({ sessionId, title, cwd, hostId, hostBadge = tru
|
|
|
77
79
|
environmentActions,
|
|
78
80
|
host,
|
|
79
81
|
labels,
|
|
80
|
-
menuOpen,
|
|
81
|
-
selected,
|
|
82
82
|
inboxSection,
|
|
83
|
-
inboxHandlers,
|
|
84
83
|
onStartRename,
|
|
85
84
|
onDelete,
|
|
86
85
|
onSetArchived,
|
|
@@ -89,8 +88,12 @@ const SidebarSessionRow = memo(({ sessionId, title, cwd, hostId, hostBadge = tru
|
|
|
89
88
|
onWakeEnvironment,
|
|
90
89
|
onRunEnvironmentAction,
|
|
91
90
|
onMoveToSpace,
|
|
92
|
-
onMoveSession
|
|
91
|
+
onMoveSession,
|
|
92
|
+
onTeleportSession,
|
|
93
|
+
onShareSession,
|
|
94
|
+
canShareSession
|
|
93
95
|
]);
|
|
96
|
+
const menuItems = menuOpen && inboxSection && inboxHandlers ? baseMenuItems.concat(inboxHandlers.menuItems(sessionId, inboxSection)) : baseMenuItems;
|
|
94
97
|
const handleSelect = useCallback(() => onSelect(sessionId), [sessionId, onSelect]);
|
|
95
98
|
const handleOpenMenu = useCallback(() => onOpenMenu(sessionId), [sessionId, onOpenMenu]);
|
|
96
99
|
const handleCloseMenu = useCallback(() => onCloseMenu(sessionId), [sessionId, onCloseMenu]);
|
|
@@ -56,6 +56,10 @@ export interface SessionMenuActions {
|
|
|
56
56
|
moveToSpace: (spaceId: string) => void;
|
|
57
57
|
/** Move to another environment of its host ("Move to…", `useMoveSession`). Absent: no row. */
|
|
58
58
|
moveSession?: () => void;
|
|
59
|
+
/** Teleport to another host ("Teleport to…", `useTeleportSession`). Absent: no row. */
|
|
60
|
+
teleportSession?: () => void;
|
|
61
|
+
/** Who shares it ("Share…", `useShareSession`). Absent: no row. */
|
|
62
|
+
shareSession?: () => void;
|
|
59
63
|
}
|
|
60
64
|
/** What the menu knows beyond the conversation. */
|
|
61
65
|
export interface SessionMenuContext {
|
|
@@ -95,7 +95,7 @@ function sessionMenuItems(session, context, actions, labels) {
|
|
|
95
95
|
onSelect: () => void openWindow(id, "panels").catch(ignore)
|
|
96
96
|
}
|
|
97
97
|
] : [],
|
|
98
|
-
...actions.wakeEnvironment && environment === "ready" && !session.environment?.resuming && isExternalEnvironment(session.environment) ? [{
|
|
98
|
+
...actions.wakeEnvironment && environment === "ready" && !session.environment?.resuming && !session.environment?.busy && isExternalEnvironment(session.environment) ? [{
|
|
99
99
|
id: "wake-environment",
|
|
100
100
|
label: labels.menuWakeEnvironment,
|
|
101
101
|
group: "environment",
|
|
@@ -113,7 +113,19 @@ function sessionMenuItems(session, context, actions, labels) {
|
|
|
113
113
|
group: "environment",
|
|
114
114
|
onSelect: actions.moveSession
|
|
115
115
|
}] : [],
|
|
116
|
-
...environment
|
|
116
|
+
...actions.teleportSession && !session.isMain && environment !== "provisioning" ? [{
|
|
117
|
+
id: "teleport",
|
|
118
|
+
label: labels.menuTeleportTo,
|
|
119
|
+
group: "environment",
|
|
120
|
+
onSelect: actions.teleportSession
|
|
121
|
+
}] : [],
|
|
122
|
+
...actions.shareSession && !session.isMain ? [{
|
|
123
|
+
id: "share",
|
|
124
|
+
label: labels.menuShare,
|
|
125
|
+
group: "environment",
|
|
126
|
+
onSelect: actions.shareSession
|
|
127
|
+
}] : [],
|
|
128
|
+
...environment === "ready" && !session.environment?.busy ? context.environmentActions.map((action) => ({
|
|
117
129
|
id: `environment:${action.id}`,
|
|
118
130
|
label: action.label,
|
|
119
131
|
group: "environment",
|
|
@@ -27,6 +27,11 @@ import { isRunEstimated, sessionBadgeTarget } from "zidane/chat/pure";
|
|
|
27
27
|
// src/chat/sidebar/sidebar-live.tsx
|
|
28
28
|
/** A state shows at least this long, so a quick tool call does not flicker by. */
|
|
29
29
|
const STATE_HOLD_MS = 500;
|
|
30
|
+
/**
|
|
31
|
+
* A state shown this long sizes the trailing slot to itself. Quicker ones leave the slot at the widest of them,
|
|
32
|
+
* so a burst of steps never moves the title beside it.
|
|
33
|
+
*/
|
|
34
|
+
const STATE_FIT_MS = 1500;
|
|
30
35
|
/** How long a new commit or pull request reads as new (the badge pop, the row sweep). */
|
|
31
36
|
const ARRIVAL_MS = 1600;
|
|
32
37
|
/**
|
|
@@ -47,6 +52,24 @@ function useArrival(at) {
|
|
|
47
52
|
return Date.now() - at < ARRIVAL_MS;
|
|
48
53
|
}
|
|
49
54
|
/**
|
|
55
|
+
* A count that moves on once `value` has held still for `ms` after a change. A value that comes back after
|
|
56
|
+
* another counts again.
|
|
57
|
+
*
|
|
58
|
+
* @param value - The value on show.
|
|
59
|
+
* @param ms - How long it must hold still to count.
|
|
60
|
+
*/
|
|
61
|
+
function useLastingCount(value, ms) {
|
|
62
|
+
const [count, bump] = useReducer((n) => n + 1, 0);
|
|
63
|
+
const seen = useRef(value);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (seen.current === value) return void 0;
|
|
66
|
+
seen.current = value;
|
|
67
|
+
const t = window.setTimeout(bump, ms);
|
|
68
|
+
return () => window.clearTimeout(t);
|
|
69
|
+
}, [value, ms]);
|
|
70
|
+
return count;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
50
73
|
* The arrivals already played, by what arrived (a session's badge line, one of its badges) and when. A row
|
|
51
74
|
* mounts again when it moves between the list and a shelf: it must look as it did, not grow its badge line
|
|
52
75
|
* or pop its badges a second time (the moving copy would be measured mid-grow, and the row would jump).
|
|
@@ -77,10 +100,10 @@ const none = () => null;
|
|
|
77
100
|
const noHost = () => void 0;
|
|
78
101
|
/** How long ago `at` was, kept current by the shared minute tick (its own component: the tick re-renders this text only). */
|
|
79
102
|
function Ago({ at, className }) {
|
|
80
|
-
useMinuteTick();
|
|
103
|
+
const now = useMinuteTick();
|
|
81
104
|
return /* @__PURE__ */ jsx("span", {
|
|
82
105
|
className,
|
|
83
|
-
children: relativeTime(at,
|
|
106
|
+
children: relativeTime(at, now)
|
|
84
107
|
});
|
|
85
108
|
}
|
|
86
109
|
/** A number in the badge text that rolls when it changes: the text around the first occurrence of `count`. */
|
|
@@ -277,7 +300,7 @@ function BadgeLine({ sessionId, startedFromKey, entry, host, project, environmen
|
|
|
277
300
|
className: "zg-row-extra",
|
|
278
301
|
"data-grow": growIn ? "" : void 0,
|
|
279
302
|
children: /* @__PURE__ */ jsxs("div", {
|
|
280
|
-
className: "zg-badge-strip zg-scroll-fade-x pt-1",
|
|
303
|
+
className: "zg-badge-strip zg-scroll-area zg-scroll-fade-x pt-1",
|
|
281
304
|
"data-testid": "row-artifacts",
|
|
282
305
|
children: [
|
|
283
306
|
project && /* @__PURE__ */ jsx(ProjectChip, { project }),
|
|
@@ -415,11 +438,12 @@ function createSidebarLive(options) {
|
|
|
415
438
|
const live = running || compacting;
|
|
416
439
|
const label = useMemo(() => activity ? activityLabel(activity, labels) : { text: labels.rowRunning }, [activity, labels]);
|
|
417
440
|
const shown = useCadencedValue(label, STATE_HOLD_MS);
|
|
441
|
+
const lasted = useLastingCount(shown.text, STATE_FIT_MS);
|
|
418
442
|
const mode = needsYou ? "needs" : live ? "live" : "idle";
|
|
419
443
|
return /* @__PURE__ */ jsx("span", {
|
|
420
444
|
className: "zg-row-meta min-w-0 inline-flex justify-end",
|
|
421
445
|
children: /* @__PURE__ */ jsx(HeldWidth, {
|
|
422
|
-
holdKey: mode,
|
|
446
|
+
holdKey: mode === "live" ? `live-${lasted}` : mode,
|
|
423
447
|
children: /* @__PURE__ */ jsx(Crossfade, {
|
|
424
448
|
activeKey: mode,
|
|
425
449
|
variant: "text",
|
|
@@ -73,21 +73,21 @@ function useInboxRows({ on, sessions, groupBy, earlierAfterMs, needsYou, activeI
|
|
|
73
73
|
}));
|
|
74
74
|
}, []);
|
|
75
75
|
const holdRunning = useRunHold(sessions, on);
|
|
76
|
-
const [
|
|
76
|
+
const [now, setNow] = useState(() => Date.now());
|
|
77
77
|
useEffect(() => {
|
|
78
78
|
if (!on) return;
|
|
79
|
-
const next = nextInboxChangeAt(sessions,
|
|
79
|
+
const next = nextInboxChangeAt(sessions, now, earlierAfterMs);
|
|
80
80
|
if (next === void 0) return;
|
|
81
|
-
const timer = setTimeout(() =>
|
|
81
|
+
const timer = setTimeout(() => setNow(Date.now()), Math.min(2 ** 31 - 1, Math.max(0, next - Date.now())));
|
|
82
82
|
return () => clearTimeout(timer);
|
|
83
83
|
}, [
|
|
84
84
|
on,
|
|
85
85
|
sessions,
|
|
86
|
-
|
|
86
|
+
now,
|
|
87
87
|
earlierAfterMs
|
|
88
88
|
]);
|
|
89
89
|
const rows = useMemo(() => on ? buildInboxRows(sessions, {
|
|
90
|
-
now
|
|
90
|
+
now,
|
|
91
91
|
groupBy,
|
|
92
92
|
collapsedShelves,
|
|
93
93
|
collapsedFolders,
|
|
@@ -104,7 +104,7 @@ function useInboxRows({ on, sessions, groupBy, earlierAfterMs, needsYou, activeI
|
|
|
104
104
|
collapsedFolders,
|
|
105
105
|
shelfShown,
|
|
106
106
|
activeId,
|
|
107
|
-
|
|
107
|
+
now,
|
|
108
108
|
earlierAfterMs,
|
|
109
109
|
needsYou,
|
|
110
110
|
holdRunning
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { errorMessage } from "../../components/report-error.js";
|
|
2
|
+
import { useLatest } from "../../hooks/useLatest.js";
|
|
2
3
|
import { compareInboxSection } from "../headless/sidebar/inbox.js";
|
|
3
4
|
import { applyInboxPatch } from "../headless/sidebar/inbox-state.js";
|
|
4
5
|
import { INBOX_SNOOZE_PRESETS, inboxDragPreview, inverseInboxPatch, snoozeUntil } from "./inbox-triage.js";
|
|
@@ -34,7 +35,7 @@ function useInboxTriage(options) {
|
|
|
34
35
|
/** The custom snooze time picked so far: saved when the field loses focus or on Enter, not on each change. */
|
|
35
36
|
const picked = useRef("");
|
|
36
37
|
const timeInput = useRef(null);
|
|
37
|
-
const live =
|
|
38
|
+
const live = useLatest({
|
|
38
39
|
rows,
|
|
39
40
|
selected,
|
|
40
41
|
onSetInboxState,
|
|
@@ -43,39 +44,31 @@ function useInboxTriage(options) {
|
|
|
43
44
|
labels,
|
|
44
45
|
needsYou
|
|
45
46
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
setSelected(EMPTY);
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
setSelected((current) => {
|
|
63
|
-
if (current.size === 0) return current;
|
|
64
|
-
const listed = new Set(rows.flatMap((r) => r.kind === "session" ? [r.id] : []));
|
|
65
|
-
const kept = [...current].filter((id) => listed.has(id));
|
|
66
|
-
return kept.length === current.size ? current : new Set(kept);
|
|
67
|
-
});
|
|
68
|
-
}, [enabled, rows]);
|
|
69
|
-
const sessionRow = (id) => live.current.rows.find((r) => r.kind === "session" && r.id === id);
|
|
47
|
+
const kept = useMemo(() => {
|
|
48
|
+
if (!enabled) return EMPTY;
|
|
49
|
+
if (selected.size === 0) return selected;
|
|
50
|
+
const listed = new Set(rows.flatMap((r) => r.kind === "session" ? [r.id] : []));
|
|
51
|
+
const ids = [...selected].filter((id) => listed.has(id));
|
|
52
|
+
return ids.length === selected.size ? selected : new Set(ids);
|
|
53
|
+
}, [
|
|
54
|
+
enabled,
|
|
55
|
+
rows,
|
|
56
|
+
selected
|
|
57
|
+
]);
|
|
58
|
+
if (kept !== selected) setSelected(kept);
|
|
59
|
+
const sessionRow = useCallback((id) => live().rows.find((r) => r.kind === "session" && r.id === id), [live]);
|
|
70
60
|
/** The row and, when it is selected, every selected row. */
|
|
71
|
-
const targetsOf = (id) =>
|
|
72
|
-
|
|
61
|
+
const targetsOf = useCallback((id) => {
|
|
62
|
+
const current = live().selected;
|
|
63
|
+
return current.has(id) ? [...current] : [id];
|
|
64
|
+
}, [live]);
|
|
65
|
+
const failed = useCallback((err) => notify(live().labels.inboxActionFailed(errorMessage(err))), [notify, live]);
|
|
73
66
|
/**
|
|
74
67
|
* Saves a change on each session; ⌘Z takes back the ones that saved for a moment. No toast: the row moving
|
|
75
68
|
* says it was done. A failed save is reported.
|
|
76
69
|
*/
|
|
77
70
|
const apply = useCallback((ids, patchFor) => {
|
|
78
|
-
const save = live.
|
|
71
|
+
const save = live().onSetInboxState;
|
|
79
72
|
if (!save || ids.length === 0) return;
|
|
80
73
|
const now = Date.now();
|
|
81
74
|
const before = ids.flatMap((id) => {
|
|
@@ -105,7 +98,11 @@ function useInboxTriage(options) {
|
|
|
105
98
|
if (ok.length === 0 && undo.current === revert) undo.current = null;
|
|
106
99
|
});
|
|
107
100
|
setSelected(EMPTY);
|
|
108
|
-
}, [
|
|
101
|
+
}, [
|
|
102
|
+
failed,
|
|
103
|
+
sessionRow,
|
|
104
|
+
live
|
|
105
|
+
]);
|
|
109
106
|
const settle = useCallback((ids) => apply(ids, () => ({ settled: true })), [apply]);
|
|
110
107
|
const bringBack = useCallback((ids) => apply(ids, () => ({
|
|
111
108
|
settled: false,
|
|
@@ -133,7 +130,7 @@ function useInboxTriage(options) {
|
|
|
133
130
|
const ids = targetsOf(sessionId);
|
|
134
131
|
if (action === "settle") settle(ids);
|
|
135
132
|
else if (action === "unsettle" || action === "wake") bringBack(ids);
|
|
136
|
-
else live.
|
|
133
|
+
else live().onSetInboxState?.(sessionId, { woke: false }).catch(failed);
|
|
137
134
|
};
|
|
138
135
|
const snooze = (sessionId, preset) => {
|
|
139
136
|
const ids = targetsOf(sessionId);
|
|
@@ -157,7 +154,7 @@ function useInboxTriage(options) {
|
|
|
157
154
|
const listMaybe = listRef.current;
|
|
158
155
|
if (!listMaybe) return;
|
|
159
156
|
const list = listMaybe;
|
|
160
|
-
const order = live.
|
|
157
|
+
const order = live().rows.flatMap((r) => r.kind === "session" && r.section === section ? [r.id] : []);
|
|
161
158
|
const start = order.indexOf(sessionId);
|
|
162
159
|
let picked = [sessionId];
|
|
163
160
|
setSwept(new Set(picked));
|
|
@@ -193,7 +190,7 @@ function useInboxTriage(options) {
|
|
|
193
190
|
event.preventDefault();
|
|
194
191
|
};
|
|
195
192
|
const menuItems = (sessionId, section) => {
|
|
196
|
-
const l = live.
|
|
193
|
+
const l = live().labels;
|
|
197
194
|
const ids = targetsOf(sessionId);
|
|
198
195
|
const many = ids.length > 1;
|
|
199
196
|
const snoozeRows = INBOX_SNOOZE_PRESETS.map((preset) => ({
|
|
@@ -228,7 +225,7 @@ function useInboxTriage(options) {
|
|
|
228
225
|
label: allPinned ? l.inboxUnpinMany(ids.length) : l.inboxPinMany(ids.length),
|
|
229
226
|
group: "inbox-many",
|
|
230
227
|
onSelect: () => {
|
|
231
|
-
for (const id of ids) live.
|
|
228
|
+
for (const id of ids) live().onSetFavorite(id, !allPinned).catch(failed);
|
|
232
229
|
setSelected(EMPTY);
|
|
233
230
|
}
|
|
234
231
|
}, {
|
|
@@ -236,7 +233,7 @@ function useInboxTriage(options) {
|
|
|
236
233
|
label: l.inboxArchiveMany(ids.length),
|
|
237
234
|
group: "inbox-many",
|
|
238
235
|
onSelect: () => {
|
|
239
|
-
for (const id of ids) live.
|
|
236
|
+
for (const id of ids) live().onSetArchived(id, true).catch(failed);
|
|
240
237
|
setSelected(EMPTY);
|
|
241
238
|
}
|
|
242
239
|
});
|
|
@@ -255,7 +252,10 @@ function useInboxTriage(options) {
|
|
|
255
252
|
bringBack,
|
|
256
253
|
snoozeAt,
|
|
257
254
|
failed,
|
|
258
|
-
listRef
|
|
255
|
+
listRef,
|
|
256
|
+
sessionRow,
|
|
257
|
+
live,
|
|
258
|
+
targetsOf
|
|
259
259
|
]);
|
|
260
260
|
const onClickCapture = useCallback((event) => {
|
|
261
261
|
if (!enabled) return;
|
|
@@ -277,25 +277,25 @@ function useInboxTriage(options) {
|
|
|
277
277
|
if (event.shiftKey && anchor.current) {
|
|
278
278
|
event.preventDefault();
|
|
279
279
|
event.stopPropagation();
|
|
280
|
-
const order = live.
|
|
280
|
+
const order = live().rows.flatMap((r) => r.kind === "session" ? [r.id] : []);
|
|
281
281
|
const a = order.indexOf(anchor.current);
|
|
282
282
|
const b = order.indexOf(id);
|
|
283
283
|
if (a >= 0 && b >= 0) setSelected(new Set(order.slice(Math.min(a, b), Math.max(a, b) + 1)));
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
286
|
anchor.current = id;
|
|
287
|
-
if (live.
|
|
288
|
-
}, [enabled]);
|
|
287
|
+
if (live().selected.size > 0) setSelected(EMPTY);
|
|
288
|
+
}, [enabled, live]);
|
|
289
289
|
const onKeyDown = useCallback((event) => {
|
|
290
|
-
if (event.key === "Escape" && live.
|
|
290
|
+
if (event.key === "Escape" && live().selected.size > 0) {
|
|
291
291
|
setSelected(EMPTY);
|
|
292
292
|
event.stopPropagation();
|
|
293
293
|
}
|
|
294
|
-
}, []);
|
|
294
|
+
}, [live]);
|
|
295
295
|
/** Drops `id` (from `from`) per `state`. */
|
|
296
296
|
const drop = useCallback((id, from, state) => {
|
|
297
297
|
const { action } = state;
|
|
298
|
-
const l = live
|
|
298
|
+
const l = live();
|
|
299
299
|
const save = l.onSetInboxState;
|
|
300
300
|
if (!action) return;
|
|
301
301
|
if (action === "settle") {
|
|
@@ -332,7 +332,8 @@ function useInboxTriage(options) {
|
|
|
332
332
|
}, [
|
|
333
333
|
settle,
|
|
334
334
|
bringBack,
|
|
335
|
-
failed
|
|
335
|
+
failed,
|
|
336
|
+
live
|
|
336
337
|
]);
|
|
337
338
|
return {
|
|
338
339
|
handlers,
|
|
@@ -342,7 +343,7 @@ function useInboxTriage(options) {
|
|
|
342
343
|
onKeyDown,
|
|
343
344
|
onPointerDown: useCallback((event) => {
|
|
344
345
|
const listMaybe = listRef.current;
|
|
345
|
-
if (!enabled || !listMaybe || !live.
|
|
346
|
+
if (!enabled || !listMaybe || !live().onSetInboxState || event.button !== 0 || event.pointerType === "touch") return;
|
|
346
347
|
const target = event.target;
|
|
347
348
|
if (target.closest(".zg-row-actions, .zg-row-dots, input, textarea, [contenteditable=\"true\"]")) return;
|
|
348
349
|
const rowMaybe = target.closest("[data-session-id]");
|
|
@@ -458,7 +459,7 @@ function useInboxTriage(options) {
|
|
|
458
459
|
last = i;
|
|
459
460
|
continue;
|
|
460
461
|
}
|
|
461
|
-
if (compareInboxSection(section, moved, other, live.
|
|
462
|
+
if (compareInboxSection(section, moved, other, live().needsYou) < 0) {
|
|
462
463
|
at = i;
|
|
463
464
|
break;
|
|
464
465
|
}
|
|
@@ -506,7 +507,7 @@ function useInboxTriage(options) {
|
|
|
506
507
|
const shift = preview.shifts[i];
|
|
507
508
|
el.style.transform = shift ? `translateY(${shift}px)` : "";
|
|
508
509
|
});
|
|
509
|
-
if (!state || state.action !== preview.action) badge.textContent = preview.action && preview.action !== "move" ? live.
|
|
510
|
+
if (!state || state.action !== preview.action) badge.textContent = preview.action && preview.action !== "move" ? live().labels.inboxDrop[preview.action] : "";
|
|
510
511
|
state = {
|
|
511
512
|
action: preview.action,
|
|
512
513
|
over: preview.section,
|
|
@@ -586,9 +587,11 @@ function useInboxTriage(options) {
|
|
|
586
587
|
enabled,
|
|
587
588
|
listRef,
|
|
588
589
|
flip,
|
|
589
|
-
drop
|
|
590
|
+
drop,
|
|
591
|
+
sessionRow,
|
|
592
|
+
live
|
|
590
593
|
]),
|
|
591
|
-
timeField:
|
|
594
|
+
timeField: hasSave ? /* @__PURE__ */ jsx("input", {
|
|
592
595
|
ref: timeInput,
|
|
593
596
|
type: "datetime-local",
|
|
594
597
|
"aria-label": labels.inboxSnoozeTime,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
// src/chat/sidebar/useSessionSearch.ts
|
|
3
|
+
const NO_HITS = [];
|
|
3
4
|
/**
|
|
4
5
|
* Debounce between the last search keystroke and the content search. Title
|
|
5
6
|
* matching is local and instant; only the content scan waits it out.
|
|
@@ -14,35 +15,35 @@ const SEARCH_DEBOUNCE_MS = 200;
|
|
|
14
15
|
*/
|
|
15
16
|
function useSessionSearch(sessions, archiveFilter, search) {
|
|
16
17
|
const [searchQuery, setSearchQuery] = useState("");
|
|
17
|
-
|
|
18
|
-
const [
|
|
18
|
+
/** The last answer, and what it answers: a search is on while the query, the archive or the search differ. */
|
|
19
|
+
const [answer, setAnswer] = useState(null);
|
|
19
20
|
/** The newest search sent: an answer to an older one is a stale scan a newer keystroke superseded. */
|
|
20
21
|
const latest = useRef(0);
|
|
21
22
|
const trimmedQuery = searchQuery.trim();
|
|
22
23
|
const searchMode = trimmedQuery.length > 0;
|
|
24
|
+
const contentSearch = searchMode ? search : void 0;
|
|
25
|
+
if (!contentSearch && answer !== null) setAnswer(null);
|
|
26
|
+
const contentHits = contentSearch && answer ? answer.hits : NO_HITS;
|
|
27
|
+
const searching = contentSearch !== void 0 && !(answer?.query === trimmedQuery && answer.archive === archiveFilter && answer.search === contentSearch);
|
|
23
28
|
useEffect(() => {
|
|
24
|
-
if (!
|
|
25
|
-
setContentHits([]);
|
|
26
|
-
setSearching(false);
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
setSearching(true);
|
|
29
|
+
if (!contentSearch) return;
|
|
30
30
|
const timer = setTimeout(() => {
|
|
31
31
|
const ask = ++latest.current;
|
|
32
|
-
|
|
33
|
-
if (ask
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
const answered = (hits) => {
|
|
33
|
+
if (ask === latest.current) setAnswer((prev) => ({
|
|
34
|
+
query: trimmedQuery,
|
|
35
|
+
archive: archiveFilter,
|
|
36
|
+
search: contentSearch,
|
|
37
|
+
hits: hits ?? prev?.hits ?? NO_HITS
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
contentSearch(trimmedQuery, { archive: archiveFilter }).then(answered, () => answered(null));
|
|
39
41
|
}, SEARCH_DEBOUNCE_MS);
|
|
40
42
|
return () => clearTimeout(timer);
|
|
41
43
|
}, [
|
|
42
|
-
|
|
44
|
+
contentSearch,
|
|
43
45
|
trimmedQuery,
|
|
44
|
-
archiveFilter
|
|
45
|
-
search
|
|
46
|
+
archiveFilter
|
|
46
47
|
]);
|
|
47
48
|
/** Local (instant) axis of the merged results: sessions whose TITLE contains every query term. */
|
|
48
49
|
const titleMatches = useMemo(() => {
|