zidane-ui 9.3.1 → 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 +2 -0
- package/dist/adapters/live.js +3 -0
- package/dist/adapters/server-git-host.js +5 -2
- package/dist/adapters/server-host.js +17 -11
- package/dist/adapters/server-machines-host.js +7 -0
- 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.js +15 -1
- package/dist/chat/SessionStreamsProvider.d.ts +1 -1
- 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/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/hosts.d.ts +4 -0
- package/dist/chat/headless/index.d.ts +25 -25
- package/dist/chat/headless/index.js +6 -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 +2 -0
- package/dist/chat/headless/prompt-origin.js +6 -2
- package/dist/chat/headless/sidebar/directory.d.ts +10 -1
- package/dist/chat/headless/sidebar/directory.js +9 -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/index.d.ts +2 -2
- package/dist/chat/headless/sidebar/index.js +2 -2
- package/dist/chat/headless/sidebar/labels.d.ts +9 -2
- package/dist/chat/headless/sidebar/labels.js +8 -1
- 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/store.d.ts +21 -5
- package/dist/chat/headless/streams/store.js +36 -7
- package/dist/chat/headless/streams/transcript-map.js +2 -5
- package/dist/chat/headless/streams/types.d.ts +2 -1
- package/dist/chat/headless/transcript/collapse.js +3 -0
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat/index.js +2 -2
- 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/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/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 +3 -11
- package/dist/chat/transcript/SessionChip.d.ts +11 -0
- package/dist/chat/transcript/SessionChip.js +34 -0
- package/dist/chat/transcript/TranscriptRail.d.ts +1 -1
- 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 +11 -3
- package/dist/chat/transcript/index.d.ts +2 -2
- package/dist/chat/transcript/index.js +2 -2
- 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/prompt.d.ts +1 -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/tool-parts.js +0 -1
- 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 -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-C6-t1SS9.d.ts → index-BheVJOLc.d.ts} +1 -0
- 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/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/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/styles.css +32 -7
- 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/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 +17 -3
- /package/dist/dist/{index-De9AbmxS.d.ts → index-ttmMvjgM.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readMenuExitMs, usePresence } from "../motion/presence.js";
|
|
2
2
|
import { useMotionLevel } from "../motion/reduced.js";
|
|
3
3
|
import { useTooltipArming } from "./tooltip-arming.js";
|
|
4
|
-
import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { useEffect, useEffectEvent, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
// src/components/Tooltip.tsx
|
|
@@ -51,6 +51,7 @@ function Tooltip({ children, className = "", style, ...tip }) {
|
|
|
51
51
|
anchor: host,
|
|
52
52
|
initial: arm.armed,
|
|
53
53
|
pointerInside: arm.pointerInside,
|
|
54
|
+
pressed: arm.pressed,
|
|
54
55
|
...tip
|
|
55
56
|
})]
|
|
56
57
|
});
|
|
@@ -76,6 +77,7 @@ function useTooltip(label, options = {}) {
|
|
|
76
77
|
anchor,
|
|
77
78
|
initial: arm.armed,
|
|
78
79
|
pointerInside: arm.pointerInside,
|
|
80
|
+
pressed: arm.pressed,
|
|
79
81
|
portal: true,
|
|
80
82
|
...options,
|
|
81
83
|
label
|
|
@@ -88,7 +90,7 @@ function useTooltip(label, options = {}) {
|
|
|
88
90
|
*
|
|
89
91
|
* @param props - {@link AnchoredTooltipProps}.
|
|
90
92
|
*/
|
|
91
|
-
function AnchoredTooltip({ anchor, label, side = "bottom", align = "center", portal = false, maxWidth, disabled = false, initial, pointerInside: inside }) {
|
|
93
|
+
function AnchoredTooltip({ anchor, label, side = "bottom", align = "center", portal = false, maxWidth, disabled = false, initial, pointerInside: inside, pressed }) {
|
|
92
94
|
const y = side === "bottom" ? "top-full mt-1.5" : "bottom-full mb-1.5";
|
|
93
95
|
const x = align === "end" ? "right-0" : "left-1/2 -translate-x-1/2";
|
|
94
96
|
const id = useId();
|
|
@@ -100,11 +102,11 @@ function AnchoredTooltip({ anchor, label, side = "bottom", align = "center", por
|
|
|
100
102
|
const bubbleRef = useRef(null);
|
|
101
103
|
const timer = useRef(void 0);
|
|
102
104
|
const pointerInside = useRef(false);
|
|
103
|
-
const focusedRef = useRef(false);
|
|
104
105
|
const enterRef = useRef(null);
|
|
105
|
-
|
|
106
|
+
const isFocused = useEffectEvent(() => focused);
|
|
106
107
|
const [pos, setPos] = useState(null);
|
|
107
108
|
const open = !disabled && (hovered || focused) && !suppressed && !dismissed;
|
|
109
|
+
if (open && vanished) setVanished(false);
|
|
108
110
|
const presence = usePresence(open, {
|
|
109
111
|
enter: portal,
|
|
110
112
|
exitMs: readMenuExitMs
|
|
@@ -116,7 +118,6 @@ function AnchoredTooltip({ anchor, label, side = "bottom", align = "center", por
|
|
|
116
118
|
openCount += 1;
|
|
117
119
|
fadingOut?.();
|
|
118
120
|
fadingOut = null;
|
|
119
|
-
setVanished(false);
|
|
120
121
|
return () => {
|
|
121
122
|
openCount -= 1;
|
|
122
123
|
lastClosedAt = performance.now();
|
|
@@ -139,7 +140,7 @@ function AnchoredTooltip({ anchor, label, side = "bottom", align = "center", por
|
|
|
139
140
|
pointerInside.current = false;
|
|
140
141
|
clearTimeout(timer.current);
|
|
141
142
|
setHovered(false);
|
|
142
|
-
if (!
|
|
143
|
+
if (!isFocused()) reset();
|
|
143
144
|
};
|
|
144
145
|
const press = () => setSuppressed(true);
|
|
145
146
|
const key = (e) => {
|
|
@@ -170,6 +171,7 @@ function AnchoredTooltip({ anchor, label, side = "bottom", align = "center", por
|
|
|
170
171
|
};
|
|
171
172
|
}, [anchor]);
|
|
172
173
|
useEffect(() => {
|
|
174
|
+
if (pressed?.()) setSuppressed(true);
|
|
173
175
|
if (initial === "hover" && (inside ? inside() : hovering(anchor))) enterRef.current?.();
|
|
174
176
|
const active = document.activeElement;
|
|
175
177
|
if (initial === "focus" && active && anchor.contains(active) && isFocusVisible(active)) setFocused(true);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Hands `node` to a ref of either kind: calls a callback ref, sets an object ref's `current`.
|
|
4
|
+
*
|
|
5
|
+
* @param ref - The ref, or `undefined` for none.
|
|
6
|
+
* @param node - What it refers to now.
|
|
7
|
+
*/
|
|
8
|
+
export declare function assignRef<T>(ref: Ref<T> | undefined, node: T | null): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/components/assign-ref.ts
|
|
2
|
+
/**
|
|
3
|
+
* Hands `node` to a ref of either kind: calls a callback ref, sets an object ref's `current`.
|
|
4
|
+
*
|
|
5
|
+
* @param ref - The ref, or `undefined` for none.
|
|
6
|
+
* @param node - What it refers to now.
|
|
7
|
+
*/
|
|
8
|
+
function assignRef(ref, node) {
|
|
9
|
+
if (typeof ref === "function") ref(node);
|
|
10
|
+
else if (ref) ref.current = node;
|
|
11
|
+
}
|
|
12
|
+
export { assignRef };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { menuTransition, useMotionPrefs } from "../../motion/springs.js";
|
|
2
|
+
import { assignRef } from "../assign-ref.js";
|
|
2
3
|
import { anchorNudge, useAnchoredPosition } from "./useAnchoredPosition.js";
|
|
3
4
|
import { forwardRef, useCallback, useRef, useSyncExternalStore } from "react";
|
|
4
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -46,8 +47,7 @@ function Surface({ anchor, side = "bottom", align = "start", offset, width, clas
|
|
|
46
47
|
} : { opacity: 0 };
|
|
47
48
|
const setRef = useCallback((node) => {
|
|
48
49
|
localRef.current = node;
|
|
49
|
-
|
|
50
|
-
else if (forwardedRef) forwardedRef.current = node;
|
|
50
|
+
assignRef(forwardedRef, node);
|
|
51
51
|
}, [forwardedRef]);
|
|
52
52
|
const placed = placement !== null;
|
|
53
53
|
return /* @__PURE__ */ jsx(m.div, {
|
|
@@ -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;
|
|
@@ -78,7 +80,7 @@ export declare function placeSurface(a: Rect, size: {
|
|
|
78
80
|
* resize, on scroll outside the surface and when the surface's own size changes.
|
|
79
81
|
*
|
|
80
82
|
* @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.
|
|
83
|
+
* @param anchor - The element, ref or point to place against.
|
|
82
84
|
* @param surfaceRef - Ref to the surface element, measured for its size.
|
|
83
85
|
* @param options - The preferred `side` (default `bottom`), `align` (default `start`) and `offset`
|
|
84
86
|
* in px (default 6).
|
|
@@ -46,7 +46,7 @@ function anchorRect(anchor) {
|
|
|
46
46
|
height: 0
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
return anchor.element?.getBoundingClientRect() ?? null;
|
|
49
|
+
return ("ref" in anchor ? anchor.ref.current : anchor.element)?.getBoundingClientRect() ?? null;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Computes where a surface goes next to an anchor. It tries `side`, flips to the opposite side
|
|
@@ -96,7 +96,7 @@ function placeSurface(a, size, side, align, offset, viewport = {
|
|
|
96
96
|
* resize, on scroll outside the surface and when the surface's own size changes.
|
|
97
97
|
*
|
|
98
98
|
* @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.
|
|
99
|
+
* @param anchor - The element, ref or point to place against.
|
|
100
100
|
* @param surfaceRef - Ref to the surface element, measured for its size.
|
|
101
101
|
* @param options - The preferred `side` (default `bottom`), `align` (default `start`) and `offset`
|
|
102
102
|
* in px (default 6).
|
|
@@ -104,19 +104,18 @@ function placeSurface(a, size, side, align, offset, viewport = {
|
|
|
104
104
|
*/
|
|
105
105
|
function useAnchoredPosition(open, anchor, surfaceRef, { side = "bottom", align = "start", offset = 6 } = {}) {
|
|
106
106
|
const [placement, setPlacement] = useState(null);
|
|
107
|
+
if (!open && placement !== null) setPlacement(null);
|
|
107
108
|
const element = "element" in anchor ? anchor.element : null;
|
|
109
|
+
const ref = "ref" in anchor ? anchor.ref : null;
|
|
108
110
|
const px = "point" in anchor ? anchor.point.x : null;
|
|
109
111
|
const py = "point" in anchor ? anchor.point.y : null;
|
|
110
112
|
useLayoutEffect(() => {
|
|
111
|
-
if (!open)
|
|
112
|
-
setPlacement(null);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
113
|
+
if (!open) return void 0;
|
|
115
114
|
const measure = () => {
|
|
116
115
|
const a = anchorRect(px !== null && py !== null ? { point: {
|
|
117
116
|
x: px,
|
|
118
117
|
y: py
|
|
119
|
-
} } : { element });
|
|
118
|
+
} } : ref ? { ref } : { element });
|
|
120
119
|
const surface = surfaceRef.current;
|
|
121
120
|
if (!a || !surface) return;
|
|
122
121
|
const next = placeSurface(a, {
|
|
@@ -142,6 +141,7 @@ function useAnchoredPosition(open, anchor, surfaceRef, { side = "bottom", align
|
|
|
142
141
|
}, [
|
|
143
142
|
open,
|
|
144
143
|
element,
|
|
144
|
+
ref,
|
|
145
145
|
px,
|
|
146
146
|
py,
|
|
147
147
|
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 };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { KeyCombo } from "../Keycap.js";
|
|
2
2
|
import { MenuRow } from "../Menu.js";
|
|
3
|
+
import { objectKey } from "../object-key.js";
|
|
3
4
|
import { layoutPalette, placeOfRow, useMaxHeight } from "./palette-layout.js";
|
|
4
5
|
import { Fragment, memo, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
5
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -75,11 +76,6 @@ function PaletteList({ groups, cursor, query, nested, onHover, onRun, renderRow,
|
|
|
75
76
|
sections,
|
|
76
77
|
viewHeight
|
|
77
78
|
]);
|
|
78
|
-
const shownSections = useRef(sections);
|
|
79
|
-
const snap = shownSections.current !== sections;
|
|
80
|
-
useLayoutEffect(() => {
|
|
81
|
-
shownSections.current = sections;
|
|
82
|
-
}, [sections]);
|
|
83
79
|
const marked = placeOfRow(sections, cursor);
|
|
84
80
|
const from = scrollTop - 320;
|
|
85
81
|
const to = scrollTop + viewHeight + 320;
|
|
@@ -106,14 +102,13 @@ function PaletteList({ groups, cursor, query, nested, onHover, onRun, renderRow,
|
|
|
106
102
|
children: [marked && /* @__PURE__ */ jsx("div", {
|
|
107
103
|
"aria-hidden": true,
|
|
108
104
|
className: "zg-palette-cursor",
|
|
109
|
-
"data-snap": snap ? "" : void 0,
|
|
110
105
|
style: {
|
|
111
106
|
height: 34,
|
|
112
107
|
left: 6,
|
|
113
108
|
right: 6,
|
|
114
109
|
transform: `translateY(${marked.top}px)`
|
|
115
110
|
}
|
|
116
|
-
}), sections.map((s) => {
|
|
111
|
+
}, objectKey(sections)), sections.map((s) => {
|
|
117
112
|
const rowsTop = s.top + 30;
|
|
118
113
|
const lo = Math.max(0, Math.floor((from - rowsTop) / 34));
|
|
119
114
|
const hi = Math.min(s.rows.length - 1, Math.floor((to - rowsTop) / 34));
|
|
@@ -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
|
}
|
package/dist/core.css
CHANGED
|
@@ -3715,8 +3715,8 @@ html[data-motion='reduced'] .zg-seg > span:nth-child(-n + 3) {
|
|
|
3715
3715
|
|
|
3716
3716
|
/* Command palette. The cursor is one block under the rows that glides to
|
|
3717
3717
|
the marked row (a transform: no layout, no repaint of the rows); a new list
|
|
3718
|
-
puts
|
|
3719
|
-
own, so hover and keyboard mark the same way. */
|
|
3718
|
+
puts a new one in place at once (`PaletteList` keys it by the list). The rows
|
|
3719
|
+
draw no background of their own, so hover and keyboard mark the same way. */
|
|
3720
3720
|
.zg-palette-cursor {
|
|
3721
3721
|
position: absolute;
|
|
3722
3722
|
top: 0;
|
|
@@ -3760,7 +3760,7 @@ html[data-motion='reduced'] .zg-seg > span:nth-child(-n + 3) {
|
|
|
3760
3760
|
/* `snap`'s curve, quicker: the cursor follows a held arrow key, so it must
|
|
3761
3761
|
land before the next repeat. Scaling the duration keeps every motion mode
|
|
3762
3762
|
(springs off: the tween; reduced, off: 0ms). */
|
|
3763
|
-
.zg-palette-cursor
|
|
3763
|
+
.zg-palette-cursor {
|
|
3764
3764
|
transition: transform calc(var(--zg-motion-snap-duration) * 0.6) var(--zg-motion-snap-ease);
|
|
3765
3765
|
}
|
|
3766
3766
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "./execution-failure-SREfl-EZ.js";
|
|
2
2
|
import "./timeout-CmTx6V9y.js";
|
|
3
|
+
import "./index-ttmMvjgM.js";
|
|
3
4
|
import "./sandbox-CSUihARm.js";
|
|
4
5
|
import "./oauth-callback-page-CV9oTMGy.js";
|
|
5
6
|
import "../node_modules/.bun/hookable@6.1.2/node_modules/hookable/dist/index.js";
|
package/dist/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SL as SessionSort, aL as QueryBound, bL as SessionQueryNot, cL as SessionFieldName, dL as SessionGroupBy, fL as SessionGroupOrder, gL as SessionQueryAny, hL as SessionQueryAll, iL as FacetPath, lL as SessionFieldPath, mL as SessionQuery, oL as QueryValue, oP as EnvironmentConfigValue, sL as SessionCondition, sU as ThinkingLevel } from "./index-
|
|
1
|
+
import { SL as SessionSort, aL as QueryBound, bL as SessionQueryNot, cL as SessionFieldName, dL as SessionGroupBy, fL as SessionGroupOrder, gL as SessionQueryAny, hL as SessionQueryAll, iL as FacetPath, lL as SessionFieldPath, mL as SessionQuery, oL as QueryValue, oP as EnvironmentConfigValue, sL as SessionCondition, sU as ThinkingLevel } from "./index-BheVJOLc.js";
|
|
2
2
|
import "./execution-failure-SREfl-EZ.js";
|
|
3
3
|
import { d as AuthFailureKind, u as AuthFailure } from "./timeout-CmTx6V9y.js";
|
|
4
|
-
import "./index-
|
|
4
|
+
import "./index-ttmMvjgM.js";
|
|
5
5
|
import "./sandbox-CSUihARm.js";
|
|
6
6
|
import "./oauth-callback-page-CV9oTMGy.js";
|
package/dist/files/FilesTab.js
CHANGED
|
@@ -259,7 +259,6 @@ function FilesTab({ scope, layout: layoutStore, chat = null, useEdits = useNoEdi
|
|
|
259
259
|
width: layout.filesTreeWidth ?? TREE_WIDTH.default,
|
|
260
260
|
controlRef: treeControl,
|
|
261
261
|
entries,
|
|
262
|
-
truncated: workspace.truncated,
|
|
263
262
|
onExpandFolder: workspace.openFolder,
|
|
264
263
|
gitStatus: workspace.status,
|
|
265
264
|
selectedPath: selected,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { FilesTreeSide } from "../appearance/headless/prefs.js";
|
|
9
9
|
import { FileTreeControl, FileTreeEditing } from "../code/editor/FileTree.js";
|
|
10
10
|
import { FileActionTarget } from "./file-actions.js";
|
|
11
|
-
import { GitStatusEntry, WorkspaceEntry
|
|
11
|
+
import { GitStatusEntry, WorkspaceEntry } from "./headless/host.js";
|
|
12
12
|
import { FilesLayoutStore } from "./headless/view.js";
|
|
13
13
|
import { KeyboardEvent, ReactNode, RefObject } from "react";
|
|
14
14
|
export declare const TREE_WIDTH: {
|
|
@@ -27,9 +27,7 @@ export interface TreeColumnProps {
|
|
|
27
27
|
width: number;
|
|
28
28
|
controlRef: RefObject<FileTreeControl | null>;
|
|
29
29
|
entries: WorkspaceEntry[] | null;
|
|
30
|
-
/**
|
|
31
|
-
truncated?: WorkspaceListing['truncated'] | null;
|
|
32
|
-
/** An ignored folder (one node) was opened: list what is under it. */
|
|
30
|
+
/** An ignored or deferred folder (one node) was opened: list what is under it. */
|
|
33
31
|
onExpandFolder?: (path: string) => void;
|
|
34
32
|
gitStatus: GitStatusEntry[];
|
|
35
33
|
selectedPath: string | null;
|
package/dist/files/TreeColumn.js
CHANGED
|
@@ -150,11 +150,6 @@ const TreeColumn = memo((p) => {
|
|
|
150
150
|
})
|
|
151
151
|
]
|
|
152
152
|
}),
|
|
153
|
-
p.truncated && !p.search && /* @__PURE__ */ jsx("p", {
|
|
154
|
-
className: "zg-meta shrink-0 mx-3 mb-1 truncate",
|
|
155
|
-
title: labels.filesTruncated(p.truncated.shown, p.truncated.total, !!p.truncated.atLeast),
|
|
156
|
-
children: labels.filesTruncated(p.truncated.shown, p.truncated.total, !!p.truncated.atLeast)
|
|
157
|
-
}),
|
|
158
153
|
p.notice && !p.search && /* @__PURE__ */ jsx(Notice, {
|
|
159
154
|
tone: "error",
|
|
160
155
|
compact: true,
|
|
@@ -24,17 +24,13 @@ export interface WorkspaceEntry {
|
|
|
24
24
|
kind: 'file' | 'dir';
|
|
25
25
|
/** Gitignored (only present when listed with `showIgnored`). An ignored folder is one node: list it with `dir` to open it. */
|
|
26
26
|
ignored?: boolean;
|
|
27
|
+
/** A folder not walked yet (a big folder outside a repository): one node, list it with `dir` to open it. */
|
|
28
|
+
deferred?: boolean;
|
|
27
29
|
}
|
|
28
|
-
/** A folder's listing
|
|
30
|
+
/** A folder's listing. */
|
|
29
31
|
export interface WorkspaceListing {
|
|
30
32
|
/** The entries. */
|
|
31
33
|
entries: WorkspaceEntry[];
|
|
32
|
-
/** Set when the listing was cut: how many it holds and how many there are (`atLeast`: more than that). */
|
|
33
|
-
truncated?: {
|
|
34
|
-
shown: number;
|
|
35
|
-
total: number;
|
|
36
|
-
atLeast?: boolean;
|
|
37
|
-
};
|
|
38
34
|
}
|
|
39
35
|
/** The media kinds a browser plays on its own. */
|
|
40
36
|
export type MediaKind = 'image' | 'video' | 'audio' | 'pdf';
|
|
@@ -18,7 +18,6 @@ export declare const DEFAULT_FILES_LABELS: {
|
|
|
18
18
|
filesRefresh: string;
|
|
19
19
|
filesNoChanged: string;
|
|
20
20
|
filesEmptyFolder: string;
|
|
21
|
-
filesTruncated: (shown: number, total: number, atLeast: boolean) => string;
|
|
22
21
|
filesOpenFiles: string;
|
|
23
22
|
filesPickFile: string;
|
|
24
23
|
/** Under the editor's empty title. */
|
|
@@ -20,7 +20,6 @@ const DEFAULT_FILES_LABELS = {
|
|
|
20
20
|
filesRefresh: "Refresh",
|
|
21
21
|
filesNoChanged: "No changed files",
|
|
22
22
|
filesEmptyFolder: "Empty folder",
|
|
23
|
-
filesTruncated: (shown, total, atLeast) => `Showing ${shown.toLocaleString()} of ${total.toLocaleString()}${atLeast ? "+" : ""}: search to find more`,
|
|
24
23
|
filesOpenFiles: "Open files",
|
|
25
24
|
filesPickFile: "No file open",
|
|
26
25
|
/** Under the editor's empty title. */
|
|
@@ -5,7 +5,7 @@ function sameEntries(a, b) {
|
|
|
5
5
|
for (let i = 0; i < a.length; i++) {
|
|
6
6
|
const x = a[i];
|
|
7
7
|
const y = b[i];
|
|
8
|
-
if (x.path !== y.path || x.kind !== y.kind || Boolean(x.ignored) !== Boolean(y.ignored)) return false;
|
|
8
|
+
if (x.path !== y.path || x.kind !== y.kind || Boolean(x.ignored) !== Boolean(y.ignored) || Boolean(x.deferred) !== Boolean(y.deferred)) return false;
|
|
9
9
|
}
|
|
10
10
|
return true;
|
|
11
11
|
}
|
|
@@ -50,9 +50,7 @@ function useCodeReview({ filePath, kind, excerptOf, extraItems, chat }) {
|
|
|
50
50
|
setSelected(range);
|
|
51
51
|
if (chat) setDraft(range);
|
|
52
52
|
}, [chat]);
|
|
53
|
-
|
|
54
|
-
if (!chat) setDraft(null);
|
|
55
|
-
}, [chat]);
|
|
53
|
+
if (!chat && draft !== null) setDraft(null);
|
|
56
54
|
const submitDraft = (text) => {
|
|
57
55
|
if (!draft || !chat || !text.trim()) return;
|
|
58
56
|
const body = serializeReviewComment({
|
|
@@ -7,5 +7,5 @@ export type SeverityCounts = ReturnType<typeof countBySeverity>;
|
|
|
7
7
|
*/
|
|
8
8
|
export type DiagnosticsVersion = number | string | null | undefined | readonly unknown[] | object;
|
|
9
9
|
export declare function useFilesDiagnostics(cwd: string | null, paths: readonly string[], version: DiagnosticsVersion): ReadonlyMap<string, SeverityCounts> | null;
|
|
10
|
-
/** Primitive versions pass through; an object version becomes `length:
|
|
10
|
+
/** Primitive versions pass through; an object version becomes `length:number`, a number per identity. */
|
|
11
11
|
export declare function useVersionKey(version: DiagnosticsVersion): string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { countBySeverity } from "../code/editor/diagnostics.js";
|
|
2
|
+
import { objectKey } from "../components/object-key.js";
|
|
2
3
|
import { useDiagnosticsRun } from "./useDiagnosticsRun.js";
|
|
3
|
-
import { useMemo
|
|
4
|
+
import { useMemo } from "react";
|
|
4
5
|
// src/files/useFilesDiagnostics.ts
|
|
5
6
|
function useFilesDiagnostics(cwd, paths, version) {
|
|
6
7
|
const { result } = useDiagnosticsRun(cwd, paths, {
|
|
@@ -15,17 +16,9 @@ function useFilesDiagnostics(cwd, paths, version) {
|
|
|
15
16
|
return new Map([...byPath].map(([p, items]) => [p, countBySeverity(items)]));
|
|
16
17
|
}, [result]);
|
|
17
18
|
}
|
|
18
|
-
/** Primitive versions pass through; an object version becomes `length:
|
|
19
|
+
/** Primitive versions pass through; an object version becomes `length:number`, a number per identity. */
|
|
19
20
|
function useVersionKey(version) {
|
|
20
|
-
const last = useRef({
|
|
21
|
-
value: version,
|
|
22
|
-
counter: 0
|
|
23
|
-
});
|
|
24
21
|
if (version === null || version === void 0 || typeof version !== "object") return String(version);
|
|
25
|
-
|
|
26
|
-
value: version,
|
|
27
|
-
counter: last.current.counter + 1
|
|
28
|
-
};
|
|
29
|
-
return `${Array.isArray(version) ? version.length : 0}:${last.current.counter}`;
|
|
22
|
+
return `${Array.isArray(version) ? version.length : 0}:${objectKey(version)}`;
|
|
30
23
|
}
|
|
31
24
|
export { useFilesDiagnostics, useVersionKey };
|
|
@@ -34,27 +34,24 @@ function useOpenFiles(scope, layout, layoutStore, prefs, source) {
|
|
|
34
34
|
useEffect(() => {
|
|
35
35
|
for (const f of open) retired.current.delete(f.path);
|
|
36
36
|
}, [open]);
|
|
37
|
-
const holding =
|
|
37
|
+
const [holding, setHolding] = useState(() => ({
|
|
38
38
|
buffers,
|
|
39
39
|
slots: /* @__PURE__ */ new Map()
|
|
40
|
-
});
|
|
41
|
-
if (holding.
|
|
40
|
+
}));
|
|
41
|
+
if (holding.buffers !== buffers) setHolding({
|
|
42
42
|
buffers,
|
|
43
43
|
slots: /* @__PURE__ */ new Map()
|
|
44
|
-
};
|
|
45
|
-
const slots = holding.
|
|
44
|
+
});
|
|
45
|
+
const slots = holding.slots;
|
|
46
46
|
const editKey = useCallback((path) => {
|
|
47
47
|
let held = slots.get(path);
|
|
48
48
|
if (!held) slots.set(path, held = buffers.claim(path));
|
|
49
49
|
return buffers.key(path, held);
|
|
50
50
|
}, [buffers, slots]);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
h.slots.clear();
|
|
56
|
-
};
|
|
57
|
-
}, [buffers]);
|
|
51
|
+
useEffect(() => () => {
|
|
52
|
+
for (const [p, s] of holding.slots) holding.buffers.release(p, s);
|
|
53
|
+
holding.slots.clear();
|
|
54
|
+
}, [holding]);
|
|
58
55
|
const resetEditSession = useCallback((path) => {
|
|
59
56
|
const held = slots.get(path);
|
|
60
57
|
if (held) slots.set(path, buffers.reset(path, held));
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* when the repository moves (`folder-changes`), debounced: a run emitting
|
|
6
6
|
* ten results in a second costs one listing, not ten.
|
|
7
7
|
*
|
|
8
|
-
* An ignored folder comes as one node; `openFolder` lists what
|
|
9
|
-
* (`FilesHost.list` with `dir`) when the tree opens it, and
|
|
10
|
-
* lists the opened ones again.
|
|
8
|
+
* An ignored or deferred folder comes as one node; `openFolder` lists what
|
|
9
|
+
* is under it (`FilesHost.list` with `dir`) when the tree opens it, and
|
|
10
|
+
* every refresh lists the opened ones again.
|
|
11
11
|
*/
|
|
12
12
|
import { SessionEditEvent } from "../session/headless/session-diffs.js";
|
|
13
|
-
import { FilesScope, GitStatusEntry, WorkspaceEntry
|
|
13
|
+
import { FilesScope, GitStatusEntry, WorkspaceEntry } from "./headless/host.js";
|
|
14
14
|
import { SessionEditsHook } from "./tab-hooks.js";
|
|
15
15
|
export interface Workspace {
|
|
16
16
|
/** null while the first listing is in flight. */
|
|
@@ -22,9 +22,7 @@ export interface Workspace {
|
|
|
22
22
|
refresh: () => Promise<void>;
|
|
23
23
|
/** Fires after the folder may have changed, debounced (same trigger as `refresh`). */
|
|
24
24
|
onToolResult: (handler: () => void) => () => void;
|
|
25
|
-
/**
|
|
26
|
-
truncated: WorkspaceListing['truncated'] | null;
|
|
27
|
-
/** Lists what is under an ignored folder (relative, no trailing `/`) into `entries`. */
|
|
25
|
+
/** Lists what is under an ignored or deferred folder (relative, no trailing `/`) into `entries`. */
|
|
28
26
|
openFolder: (dir: string) => void;
|
|
29
27
|
}
|
|
30
28
|
export declare function useWorkspace(scope: FilesScope, showIgnored: boolean,
|