gloomberb 0.19.3 → 0.19.4
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/package.json +2 -2
- package/src/api-client/errors.ts +8 -0
- package/src/api-client/index.ts +18 -0
- package/src/api-client/request.ts +295 -42
- package/src/api-client/socket.ts +95 -0
- package/src/app/keybindings/actions.ts +1 -1
- package/src/app/pane-runtime/index.tsx +1 -1
- package/src/app/pane-runtime/ticker-inspector-runtime.ts +1 -1
- package/src/app/pane-runtime/ticker-open-runtime.ts +1 -1
- package/src/app/pane-runtime/ticker-open-target.ts +12 -2
- package/src/cli/desktop-pane-shot-api-policy.ts +10 -2
- package/src/cli/desktop-pane-shot.ts +2 -1
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/commands/direct/runtime.ts +3 -3
- package/src/components/command-bar/helpers.ts +2 -0
- package/src/components/command-bar/list/model.ts +9 -0
- package/src/components/command-bar/pane-actions.ts +46 -35
- package/src/components/command-bar/pane-templates/workflow.ts +6 -0
- package/src/components/command-bar/panel/index.tsx +30 -3
- package/src/components/command-bar/panel/types.ts +7 -0
- package/src/components/command-bar/routes/root/results.ts +4 -4
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +21 -16
- package/src/components/command-bar/routing/launch-request.ts +3 -2
- package/src/components/command-bar/routing/list-state.ts +4 -1
- package/src/components/command-bar/surface/index.tsx +15 -1
- package/src/components/layout/floating-pane.tsx +10 -0
- package/src/components/layout/pane/frame.tsx +6 -0
- package/src/components/layout/pane/header.tsx +244 -42
- package/src/components/layout/pane/index.tsx +20 -2
- package/src/components/layout/shell/active-drag.ts +128 -27
- package/src/components/layout/shell/drag/index.ts +99 -96
- package/src/components/layout/shell/drag/live.ts +3 -17
- package/src/components/layout/shell/drag/magnets.ts +198 -0
- package/src/components/layout/shell/drag/overlays.tsx +77 -75
- package/src/components/layout/shell/drag/runtime.ts +12 -7
- package/src/components/layout/shell/index.tsx +66 -32
- package/src/components/layout/shell/native/pointer-runtime.ts +7 -2
- package/src/components/layout/shell/native/surfaces.ts +1 -9
- package/src/components/layout/shell/native/window-state.ts +21 -25
- package/src/components/layout/shell/pane/layers.tsx +153 -24
- package/src/components/layout/shell/shortcuts.ts +4 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +24 -1
- package/src/components/layout/shell/window-mode/overlays.tsx +14 -6
- package/src/components/layout/status-bar.tsx +75 -6
- package/src/core/app-runtime.ts +4 -1
- package/src/core/connection-health.ts +76 -1
- package/src/core/state/app/command-bar-launch.ts +12 -0
- package/src/core/state/app/layout.ts +4 -3
- package/src/core/state/app/types.ts +4 -1
- package/src/data/config/layout.ts +2 -2
- package/src/data/config/store/fold-panes.ts +6 -1
- package/src/i18n/es.ts +8 -1
- package/src/i18n/ja.ts +8 -1
- package/src/i18n/ko.ts +8 -1
- package/src/i18n/zh-cn.ts +8 -1
- package/src/i18n/zh-tw.ts +8 -1
- package/src/layout/pane-follow.ts +3 -2
- package/src/layout/pane-layout-move.ts +2 -1
- package/src/layout/pane-manager/dock-stack.ts +38 -0
- package/src/layout/pane-manager/dock-tree.ts +76 -15
- package/src/layout/pane-manager/docking.ts +48 -6
- package/src/layout/pane-manager/floating-actions.ts +12 -3
- package/src/layout/pane-manager/floating-placement.ts +189 -0
- package/src/layout/pane-manager/floating.ts +23 -4
- package/src/layout/pane-manager/gridlock.ts +16 -4
- package/src/layout/pane-manager/hidden-panes.ts +30 -1
- package/src/layout/pane-manager/index.ts +2 -0
- package/src/layout/pane-manager/layout-state.ts +17 -0
- package/src/layout/pane-manager/types.ts +4 -1
- package/src/layout/ticker-retarget.ts +88 -0
- package/src/layout-marketplace/cloud.ts +9 -1
- package/src/market-data/connection-follow.ts +68 -0
- package/src/market-data/coordinator/entries.ts +15 -3
- package/src/market-data/coordinator/financials.ts +20 -7
- package/src/market-data/coordinator/index.ts +217 -4
- package/src/market-data/coordinator/quotes.ts +10 -0
- package/src/market-data/hooks.tsx +31 -0
- package/src/news/aggregator.ts +12 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +2 -1
- package/src/plugins/builtin/buildout/model/index.ts +6 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -1
- package/src/plugins/builtin/chart-composer/index.tsx +13 -0
- package/src/plugins/builtin/chat/controller/index.ts +10 -3
- package/src/plugins/builtin/chat/controller/session-runtime.ts +9 -2
- package/src/plugins/builtin/chat/status-widget.tsx +3 -1
- package/src/plugins/builtin/help/index.tsx +1 -1
- package/src/plugins/builtin/sectors/client.ts +18 -8
- package/src/plugins/builtin/sectors/index.tsx +19 -5
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +25 -2
- package/src/react/async-resource.ts +12 -0
- package/src/remote/controller.ts +3 -1
- package/src/renderers/browser/app-services.ts +8 -1
- package/src/renderers/browser/cloud-transport.ts +6 -1
- package/src/renderers/cloudflare/worker.ts +24 -2
- package/src/renderers/dom/styles.css +32 -0
- package/src/shares/portable-layout.ts +99 -2
- package/src/sources/provider-router/index.ts +2 -2
- package/src/sources/provider-router/sources.ts +26 -1
- package/src/sync/core-contributors.ts +18 -4
- package/src/time-series/resolve.ts +12 -0
- package/src/types/config.ts +17 -1
- package/src/types/plugin.ts +6 -0
|
@@ -1,26 +1,42 @@
|
|
|
1
1
|
import { memo, useCallback, useMemo, useRef, type RefObject } from "react";
|
|
2
2
|
import { Box, type BoxRenderable, type LiveBoxFrame } from "../../../../ui";
|
|
3
3
|
import { resolveOccludedPaneIds } from "../pane-occlusion";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import {
|
|
5
|
+
SHELL_DRAG_Z,
|
|
6
|
+
type DockDividerLayout,
|
|
7
|
+
type DockLeafLayout,
|
|
8
|
+
type FloatingRect,
|
|
9
|
+
type LayoutBounds,
|
|
10
|
+
type ResolvedPane,
|
|
10
11
|
} from "../../../../layout/pane-manager";
|
|
11
12
|
import { useThemeColors } from "../../../../theme/theme-context";
|
|
12
13
|
import { WEB_CELL_HEIGHT, WEB_CELL_WIDTH } from "../../../../theme/font-scale";
|
|
13
14
|
import { LivePaneFrameContext, type CellSize, type LivePaneFrame } from "../../../../ui/live-stretch";
|
|
14
15
|
import { constrainFloatingRectToBounds, sameRect, type ResizeEdges } from "../drag";
|
|
15
16
|
import { useLiveBoxFrame, useLiveCatchUp, useLiveDrag, type LiveDragGeometry, type LiveDragStore } from "../drag/live";
|
|
17
|
+
import { ARMED_DRAG_OPACITY } from "../drag/overlays";
|
|
16
18
|
import { pathKey } from "../../window-edit/mode";
|
|
17
19
|
import { FloatingPaneWrapper } from "../../floating-pane";
|
|
18
20
|
import { PaneContent } from "../../pane/content";
|
|
19
21
|
import { PaneWrapper } from "../../pane";
|
|
20
|
-
import type {
|
|
22
|
+
import type { DockEdge } from "../../pane/frame";
|
|
23
|
+
import type { PaneHeaderQuickSetting, PaneHeaderStack } from "../../pane/header";
|
|
21
24
|
import { hasPaneFooterContent, PaneFooterKeys, PaneFooterProvider } from "../../pane/footer";
|
|
22
25
|
import { resolvePaneBodyFrame, shouldReservePaneFooter } from "../../pane/sizing";
|
|
23
26
|
import { captureStampFooter, usePaneCaptureStamp } from "../../pane/capture-stamp";
|
|
27
|
+
import type { CombinedPaneFooter } from "../../pane/footer";
|
|
28
|
+
import { useActionShortcut } from "../../../../ui";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The terminal's route to ticker search for a single-ticker pane, which the desktop takes from
|
|
32
|
+
* the ticker in its title: the search's key ends the pane's footer, the first hint to go under
|
|
33
|
+
* More when the footer is narrow. The key is the app's and bound already, so the hint only says
|
|
34
|
+
* it (the pane menu has it as Change Ticker...); a click on it searches.
|
|
35
|
+
*/
|
|
36
|
+
function withChangeTickerHint(footer: CombinedPaneFooter, ticker: string | null, key: string, onPress: () => void): CombinedPaneFooter {
|
|
37
|
+
if (!ticker || !key) return footer;
|
|
38
|
+
return { ...footer, hints: [...footer.hints, { id: "change-ticker", key, label: " ticker", title: "Change Ticker", onPress, yieldsKey: true }] };
|
|
39
|
+
}
|
|
24
40
|
|
|
25
41
|
type ShellMouseHandler = (event: any) => void;
|
|
26
42
|
|
|
@@ -34,9 +50,13 @@ interface ShellPaneLayersProps {
|
|
|
34
50
|
dockDividerLayouts: DockDividerLayout[];
|
|
35
51
|
dockLeafLayouts: DockLeafLayout[];
|
|
36
52
|
focusedPaneId: string | null;
|
|
53
|
+
/** Shows and focuses a pane: a click on a stack's tab. */
|
|
54
|
+
focusPane: (paneId: string) => void;
|
|
37
55
|
/** Saved insertion order, independent of which floating window is in front. */
|
|
38
56
|
floatingOrder: readonly { instanceId: string }[];
|
|
39
57
|
getPaneTitle: (pane: ResolvedPane) => string;
|
|
58
|
+
/** The ticker a single-ticker pane shows, which ticker search changes from it; null for any other pane. */
|
|
59
|
+
getPaneTicker: (pane: ResolvedPane) => string | null;
|
|
40
60
|
getPaneQuickSettings: (paneId: string) => PaneHeaderQuickSetting[];
|
|
41
61
|
handleFloatingClose: (paneId: string) => void;
|
|
42
62
|
handleFloatingCloseMouseDown: (paneId: string, event: any) => void;
|
|
@@ -48,6 +68,8 @@ interface ShellPaneLayersProps {
|
|
|
48
68
|
handlePaneHelp: (paneId: string) => void;
|
|
49
69
|
/** Ask Gloom about the pane; null while nothing takes the question (its plugin is off). */
|
|
50
70
|
handlePaneAsk: ((paneId: string) => void) | null;
|
|
71
|
+
/** Ticker search for the pane: the ticker in its title, or its footer key in the terminal. */
|
|
72
|
+
handlePaneTicker: (paneId: string) => void;
|
|
51
73
|
hoveredPaneId: string | null;
|
|
52
74
|
live: LiveDragStore;
|
|
53
75
|
menuPaneId: string | null;
|
|
@@ -57,7 +79,7 @@ interface ShellPaneLayersProps {
|
|
|
57
79
|
paneMap: Map<string, ResolvedPane>;
|
|
58
80
|
setHoveredPaneIfChanged: (paneId: string | null) => void;
|
|
59
81
|
startNativeDividerDrag: (divider: DockDividerLayout, event: any) => void;
|
|
60
|
-
startNativeDockedDrag: (paneId: string, rect: LayoutBounds, event: any) => void;
|
|
82
|
+
startNativeDockedDrag: (paneId: string, rect: LayoutBounds, event: any, options?: { focus?: boolean }) => void;
|
|
61
83
|
startNativeFloatingDrag: (paneId: string, rect: FloatingRect, event: any) => void;
|
|
62
84
|
startNativeFloatResize: (paneId: string, rect: FloatingRect, event: any, edges?: ResizeEdges) => void;
|
|
63
85
|
transientFocusActive: boolean;
|
|
@@ -76,7 +98,8 @@ interface ShellPaneLayersProps {
|
|
|
76
98
|
interface PaneLayerActions {
|
|
77
99
|
paneMouseDown: (paneId: string, event: any) => void;
|
|
78
100
|
hover: (paneId: string) => void;
|
|
79
|
-
|
|
101
|
+
/** `focus` false: a press on a stack's hidden tab, which shows it only on release. */
|
|
102
|
+
dockedDragStart: (paneId: string, rect: LayoutBounds, event: any, options?: { focus?: boolean }) => void;
|
|
80
103
|
floatingDragStart: (paneId: string, rect: FloatingRect, event: any) => void;
|
|
81
104
|
floatResizeStart: (paneId: string, rect: FloatingRect, event: any, edges?: ResizeEdges) => void;
|
|
82
105
|
drag: ShellMouseHandler;
|
|
@@ -86,17 +109,25 @@ interface PaneLayerActions {
|
|
|
86
109
|
help: (paneId: string) => void;
|
|
87
110
|
/** The button beside the `?`: Ask Gloom about the pane. */
|
|
88
111
|
ask: (paneId: string) => void;
|
|
112
|
+
/** Ticker search for the pane: the ticker in its title, or its footer key in the terminal. */
|
|
113
|
+
ticker: (paneId: string) => void;
|
|
89
114
|
closeMouseDown: (paneId: string, event: any) => void;
|
|
90
115
|
/** Also the failure card's Close: keep it stable, the pane body is memoized on it. */
|
|
91
116
|
close: (paneId: string) => void;
|
|
92
117
|
restoreFullscreen: ShellMouseHandler;
|
|
93
118
|
dividerDragStart: (divider: DockDividerLayout, event: any) => void;
|
|
119
|
+
/** A click on one of a stack's tabs: show that pane. */
|
|
120
|
+
showTab: (paneId: string) => void;
|
|
94
121
|
}
|
|
95
122
|
|
|
96
123
|
interface PaneLayerProps {
|
|
97
124
|
pane: ResolvedPane;
|
|
98
125
|
rect: LayoutBounds;
|
|
99
126
|
title: string;
|
|
127
|
+
/** See `getPaneTicker`. */
|
|
128
|
+
ticker: string | null;
|
|
129
|
+
/** Ticker search's key as the terminal says it; empty when it has none. */
|
|
130
|
+
tickerSearchKey: string;
|
|
100
131
|
focused: boolean;
|
|
101
132
|
windowModeSelected: boolean;
|
|
102
133
|
showActions: boolean;
|
|
@@ -106,6 +137,10 @@ interface PaneLayerProps {
|
|
|
106
137
|
fullscreen: boolean;
|
|
107
138
|
/** Whether the header can start a move: not in fullscreen. */
|
|
108
139
|
movable: boolean;
|
|
140
|
+
/** Desktop, docked: the sides that face another pane across the gap between them. */
|
|
141
|
+
dockEdges?: readonly DockEdge[];
|
|
142
|
+
/** Docked: the panes stacked as tabs in this spot, this one shown. */
|
|
143
|
+
stackTabs?: ReadonlyArray<{ id: string; title: string }>;
|
|
109
144
|
nativePaneChrome: boolean;
|
|
110
145
|
nativeContextMenu: boolean;
|
|
111
146
|
/** Ask Gloom takes questions about panes, so the header offers it. */
|
|
@@ -115,6 +150,28 @@ interface PaneLayerProps {
|
|
|
115
150
|
}
|
|
116
151
|
|
|
117
152
|
const EMPTY_OCCLUSION: ReadonlySet<string> = new Set();
|
|
153
|
+
const ARMED_LAYER_STYLE = { opacity: ARMED_DRAG_OPACITY };
|
|
154
|
+
const SIDES: readonly DockEdge[] = ["left", "right", "top", "bottom"];
|
|
155
|
+
/** One array per combination of sides, so a docked layer's props stay equal between renders. */
|
|
156
|
+
const DOCK_EDGE_SETS = new Map<string, readonly DockEdge[]>();
|
|
157
|
+
|
|
158
|
+
/** The sides of a docked pane at `rect` that face another pane rather than the edge of the area. */
|
|
159
|
+
function dockEdgesOf(rect: LayoutBounds, width: number, height: number): readonly DockEdge[] {
|
|
160
|
+
const inside = {
|
|
161
|
+
left: rect.x > 0.01,
|
|
162
|
+
right: rect.x + rect.width < width - 0.01,
|
|
163
|
+
top: rect.y > 0.01,
|
|
164
|
+
bottom: rect.y + rect.height < height - 0.01,
|
|
165
|
+
};
|
|
166
|
+
const edges = SIDES.filter((side) => inside[side]);
|
|
167
|
+
const key = edges.join(" ");
|
|
168
|
+
let set = DOCK_EDGE_SETS.get(key);
|
|
169
|
+
if (!set) {
|
|
170
|
+
set = edges;
|
|
171
|
+
DOCK_EDGE_SETS.set(key, set);
|
|
172
|
+
}
|
|
173
|
+
return set;
|
|
174
|
+
}
|
|
118
175
|
const selectFloatingDragActive = (geometry: LiveDragGeometry) => geometry.floating !== null;
|
|
119
176
|
const selectNothing = () => null;
|
|
120
177
|
const selectNoDrag = () => false;
|
|
@@ -153,6 +210,8 @@ const DockedPaneLayer = memo(function DockedPaneLayer({
|
|
|
153
210
|
pane,
|
|
154
211
|
rect: layoutRect,
|
|
155
212
|
title,
|
|
213
|
+
ticker,
|
|
214
|
+
tickerSearchKey,
|
|
156
215
|
focused,
|
|
157
216
|
windowModeSelected,
|
|
158
217
|
showActions,
|
|
@@ -160,6 +219,8 @@ const DockedPaneLayer = memo(function DockedPaneLayer({
|
|
|
160
219
|
inView,
|
|
161
220
|
fullscreen,
|
|
162
221
|
movable,
|
|
222
|
+
dockEdges,
|
|
223
|
+
stackTabs,
|
|
163
224
|
nativePaneChrome,
|
|
164
225
|
nativeContextMenu,
|
|
165
226
|
canAsk,
|
|
@@ -186,6 +247,13 @@ const DockedPaneLayer = memo(function DockedPaneLayer({
|
|
|
186
247
|
: null), [nativePaneChrome, paneId]);
|
|
187
248
|
const liveFrame = useLivePaneFrame(live, rect, sizeOf);
|
|
188
249
|
const captureStamp = usePaneCaptureStamp(paneId);
|
|
250
|
+
// A stack's tabs: a click shows one, a press on one moves that pane.
|
|
251
|
+
const stack = useMemo<PaneHeaderStack | null>(() => (stackTabs ? {
|
|
252
|
+
tabs: stackTabs,
|
|
253
|
+
active: paneId,
|
|
254
|
+
onSelect: actions.showTab,
|
|
255
|
+
onTabMouseDown: nativeMove ? (tabId, event) => actions.dockedDragStart(tabId, rect, event, { focus: tabId === paneId }) : undefined,
|
|
256
|
+
} : null), [actions, nativeMove, paneId, rect, stackTabs]);
|
|
189
257
|
return (
|
|
190
258
|
<Box
|
|
191
259
|
ref={boxRef}
|
|
@@ -198,7 +266,7 @@ const DockedPaneLayer = memo(function DockedPaneLayer({
|
|
|
198
266
|
>
|
|
199
267
|
<PaneFooterProvider>
|
|
200
268
|
{(registeredFooter) => {
|
|
201
|
-
const footer = captureStampFooter(registeredFooter, captureStamp);
|
|
269
|
+
const footer = captureStampFooter(withChangeTickerHint(registeredFooter, nativePaneChrome ? null : ticker, tickerSearchKey, () => actions.ticker(paneId)), captureStamp);
|
|
202
270
|
const showFooter = hasPaneFooterContent(footer);
|
|
203
271
|
const reserveFooter = shouldReservePaneFooter(nativePaneChrome, showFooter);
|
|
204
272
|
const bodyFrame = resolvePaneBodyFrame({
|
|
@@ -212,6 +280,8 @@ const DockedPaneLayer = memo(function DockedPaneLayer({
|
|
|
212
280
|
<PaneWrapper
|
|
213
281
|
paneId={paneId}
|
|
214
282
|
title={title}
|
|
283
|
+
titleTicker={nativePaneChrome ? ticker : null}
|
|
284
|
+
onTitleTickerPress={() => actions.ticker(paneId)}
|
|
215
285
|
focused={focused}
|
|
216
286
|
width={rect.width}
|
|
217
287
|
height={rect.height}
|
|
@@ -220,6 +290,8 @@ const DockedPaneLayer = memo(function DockedPaneLayer({
|
|
|
220
290
|
showActions={showActions}
|
|
221
291
|
quickSettings={quickSettings}
|
|
222
292
|
topRule={rect.y > 0.01}
|
|
293
|
+
dockEdges={dockEdges}
|
|
294
|
+
stack={stack}
|
|
223
295
|
windowModeSelected={windowModeSelected}
|
|
224
296
|
footer={footer}
|
|
225
297
|
onMouseDownCapture={nativePaneChrome ? (event) => actions.paneMouseDown(paneId, event) : undefined}
|
|
@@ -260,6 +332,8 @@ const FloatingPaneFrame = memo(function FloatingPaneFrame({
|
|
|
260
332
|
pane,
|
|
261
333
|
rect,
|
|
262
334
|
title,
|
|
335
|
+
ticker,
|
|
336
|
+
tickerSearchKey,
|
|
263
337
|
focused,
|
|
264
338
|
windowModeSelected,
|
|
265
339
|
showActions,
|
|
@@ -287,7 +361,7 @@ const FloatingPaneFrame = memo(function FloatingPaneFrame({
|
|
|
287
361
|
return (
|
|
288
362
|
<PaneFooterProvider>
|
|
289
363
|
{(registeredFooter) => {
|
|
290
|
-
const footer = captureStampFooter(registeredFooter, captureStamp);
|
|
364
|
+
const footer = captureStampFooter(withChangeTickerHint(registeredFooter, nativePaneChrome ? null : ticker, tickerSearchKey, () => actions.ticker(paneId)), captureStamp);
|
|
291
365
|
const showFooter = hasPaneFooterContent(footer);
|
|
292
366
|
const reserveFooter = shouldReservePaneFooter(nativePaneChrome, showFooter);
|
|
293
367
|
const bodyFrame = resolvePaneBodyFrame({
|
|
@@ -301,6 +375,8 @@ const FloatingPaneFrame = memo(function FloatingPaneFrame({
|
|
|
301
375
|
<FloatingPaneWrapper
|
|
302
376
|
paneId={paneId}
|
|
303
377
|
title={title}
|
|
378
|
+
titleTicker={nativePaneChrome ? ticker : null}
|
|
379
|
+
onTitleTickerPress={() => actions.ticker(paneId)}
|
|
304
380
|
x={rect.x}
|
|
305
381
|
y={rect.y}
|
|
306
382
|
width={rect.width}
|
|
@@ -486,6 +562,12 @@ const FloatingPaneLayer = memo(function FloatingPaneLayer({
|
|
|
486
562
|
return sameRect(resized, rect) ? null : resized;
|
|
487
563
|
} : null), [contentHeight, paneId, rect, slide, width]);
|
|
488
564
|
const resizeRect = useLiveCatchUp(live, selectCatchUp);
|
|
565
|
+
// Over somewhere to land, the desktop pane rises over its landing preview
|
|
566
|
+
// and turns see-through, so the preview shows under it.
|
|
567
|
+
const selectArmed = useCallback((geometry: LiveDragGeometry) => (
|
|
568
|
+
geometry.paneDrag?.paneId === paneId && geometry.dockPreview !== null
|
|
569
|
+
), [paneId]);
|
|
570
|
+
const armed = useLiveDrag(live, slide ? selectArmed : selectNoDrag);
|
|
489
571
|
const preview = dragRect
|
|
490
572
|
? constrainFloatingRectToBounds(dragRect, width, contentHeight)
|
|
491
573
|
// The content catches up with the size; a left or top edge's move stays
|
|
@@ -513,7 +595,8 @@ const FloatingPaneLayer = memo(function FloatingPaneLayer({
|
|
|
513
595
|
top={0}
|
|
514
596
|
width={0}
|
|
515
597
|
height={0}
|
|
516
|
-
zIndex={zIndex}
|
|
598
|
+
zIndex={armed ? SHELL_DRAG_Z.over : zIndex}
|
|
599
|
+
style={armed ? ARMED_LAYER_STYLE : undefined}
|
|
517
600
|
>
|
|
518
601
|
{content}
|
|
519
602
|
{frame.movable && !frame.hidden && (
|
|
@@ -590,8 +673,10 @@ export function ShellPaneLayers({
|
|
|
590
673
|
dockDividerLayouts,
|
|
591
674
|
dockLeafLayouts,
|
|
592
675
|
focusedPaneId,
|
|
676
|
+
focusPane,
|
|
593
677
|
floatingOrder,
|
|
594
678
|
getPaneTitle,
|
|
679
|
+
getPaneTicker,
|
|
595
680
|
getPaneQuickSettings,
|
|
596
681
|
handleFloatingClose,
|
|
597
682
|
handleFloatingCloseMouseDown,
|
|
@@ -602,6 +687,7 @@ export function ShellPaneLayers({
|
|
|
602
687
|
handlePaneAction,
|
|
603
688
|
handlePaneHelp,
|
|
604
689
|
handlePaneAsk,
|
|
690
|
+
handlePaneTicker,
|
|
605
691
|
hoveredPaneId,
|
|
606
692
|
live,
|
|
607
693
|
menuPaneId,
|
|
@@ -643,6 +729,26 @@ export function ShellPaneLayers({
|
|
|
643
729
|
const floatingDragActive = useLiveDrag(live, nativePaneChrome ? selectNoDrag : selectFloatingDragActive);
|
|
644
730
|
const occludedPaneIds = nativePaneChrome || floatingDragActive ? EMPTY_OCCLUSION : coveredPaneIds;
|
|
645
731
|
const fullscreenRect = useMemo(() => ({ x: 0, y: 0, width, height: contentHeight }), [contentHeight, width]);
|
|
732
|
+
const tickerSearchKey = useActionShortcut("ticker-search");
|
|
733
|
+
// Each stack's tabs by the pane it shows, the same array while they and their titles stay.
|
|
734
|
+
const stackTabsCache = useRef(new Map<string, ReadonlyArray<{ id: string; title: string }>>());
|
|
735
|
+
const stackTabsById = useMemo(() => {
|
|
736
|
+
const byId = new Map<string, ReadonlyArray<{ id: string; title: string }>>();
|
|
737
|
+
const cache = new Map<string, ReadonlyArray<{ id: string; title: string }>>();
|
|
738
|
+
for (const leaf of dockLeafLayouts) {
|
|
739
|
+
if (!leaf.stack) continue;
|
|
740
|
+
const tabs = leaf.stack.map((id) => {
|
|
741
|
+
const member = paneMap.get(id);
|
|
742
|
+
return { id, title: member ? getPaneTitle(member) : id };
|
|
743
|
+
});
|
|
744
|
+
const key = tabs.map((tab) => `${tab.id}\u0000${tab.title}`).join("\u0001");
|
|
745
|
+
const kept = stackTabsCache.current.get(key) ?? tabs;
|
|
746
|
+
cache.set(key, kept);
|
|
747
|
+
byId.set(leaf.instanceId, kept);
|
|
748
|
+
}
|
|
749
|
+
stackTabsCache.current = cache;
|
|
750
|
+
return byId;
|
|
751
|
+
}, [dockLeafLayouts, getPaneTitle, paneMap]);
|
|
646
752
|
|
|
647
753
|
const handlersRef = useRef({
|
|
648
754
|
handleFloatingClose,
|
|
@@ -654,11 +760,13 @@ export function ShellPaneLayers({
|
|
|
654
760
|
handlePaneAction,
|
|
655
761
|
handlePaneHelp,
|
|
656
762
|
handlePaneAsk,
|
|
763
|
+
handlePaneTicker,
|
|
657
764
|
setHoveredPaneIfChanged,
|
|
658
765
|
startNativeDividerDrag,
|
|
659
766
|
startNativeDockedDrag,
|
|
660
767
|
startNativeFloatingDrag,
|
|
661
768
|
startNativeFloatResize,
|
|
769
|
+
focusPane,
|
|
662
770
|
});
|
|
663
771
|
handlersRef.current = {
|
|
664
772
|
handleFloatingClose,
|
|
@@ -670,17 +778,19 @@ export function ShellPaneLayers({
|
|
|
670
778
|
handlePaneAction,
|
|
671
779
|
handlePaneHelp,
|
|
672
780
|
handlePaneAsk,
|
|
781
|
+
handlePaneTicker,
|
|
673
782
|
setHoveredPaneIfChanged,
|
|
674
783
|
startNativeDividerDrag,
|
|
675
784
|
startNativeDockedDrag,
|
|
676
785
|
startNativeFloatingDrag,
|
|
677
786
|
startNativeFloatResize,
|
|
787
|
+
focusPane,
|
|
678
788
|
};
|
|
679
789
|
// Only called from events, never while rendering, so reading the latest handlers is safe.
|
|
680
790
|
const actions = useMemo<PaneLayerActions>(() => ({
|
|
681
791
|
paneMouseDown: (paneId, event) => handlersRef.current.handleNativePaneMouseDown(paneId, event),
|
|
682
792
|
hover: (paneId) => handlersRef.current.setHoveredPaneIfChanged(paneId),
|
|
683
|
-
dockedDragStart: (paneId, rect, event) => handlersRef.current.startNativeDockedDrag(paneId, rect, event),
|
|
793
|
+
dockedDragStart: (paneId, rect, event, options) => handlersRef.current.startNativeDockedDrag(paneId, rect, event, options),
|
|
684
794
|
floatingDragStart: (paneId, rect, event) => handlersRef.current.startNativeFloatingDrag(paneId, rect, event),
|
|
685
795
|
floatResizeStart: (paneId, rect, event, edges) => handlersRef.current.startNativeFloatResize(paneId, rect, event, edges),
|
|
686
796
|
drag: (event) => handlersRef.current.handleNativeDrag(event),
|
|
@@ -688,10 +798,12 @@ export function ShellPaneLayers({
|
|
|
688
798
|
menu: (paneId, rect, event) => handlersRef.current.handlePaneAction(paneId, rect, event),
|
|
689
799
|
help: (paneId) => handlersRef.current.handlePaneHelp(paneId),
|
|
690
800
|
ask: (paneId) => handlersRef.current.handlePaneAsk?.(paneId),
|
|
801
|
+
ticker: (paneId) => handlersRef.current.handlePaneTicker(paneId),
|
|
691
802
|
closeMouseDown: (paneId, event) => handlersRef.current.handleFloatingCloseMouseDown(paneId, event),
|
|
692
803
|
close: (paneId) => handlersRef.current.handleFloatingClose(paneId),
|
|
693
804
|
restoreFullscreen: (event) => handlersRef.current.handleRestoreFullscreen(event),
|
|
694
805
|
dividerDragStart: (divider, event) => handlersRef.current.startNativeDividerDrag(divider, event),
|
|
806
|
+
showTab: (paneId) => handlersRef.current.focusPane(paneId),
|
|
695
807
|
}), []);
|
|
696
808
|
|
|
697
809
|
// DOM z-index already stacks the windows. Reordering their React children
|
|
@@ -717,6 +829,8 @@ export function ShellPaneLayers({
|
|
|
717
829
|
pane,
|
|
718
830
|
rect,
|
|
719
831
|
title: getPaneTitle(pane),
|
|
832
|
+
ticker: getPaneTicker(pane),
|
|
833
|
+
tickerSearchKey,
|
|
720
834
|
focused,
|
|
721
835
|
windowModeSelected: windowModePaneId === paneId,
|
|
722
836
|
showActions: focused || hoveredPaneId === paneId || menuPaneId === paneId,
|
|
@@ -734,17 +848,32 @@ export function ShellPaneLayers({
|
|
|
734
848
|
|
|
735
849
|
return (
|
|
736
850
|
<>
|
|
737
|
-
{dockLeafLayouts.
|
|
738
|
-
if (transientFocusActive && leaf.instanceId !== transientFocusPaneId) return
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
851
|
+
{dockLeafLayouts.flatMap((leaf) => {
|
|
852
|
+
if (transientFocusActive && leaf.instanceId !== transientFocusPaneId) return [];
|
|
853
|
+
// Every tab of a stack has a layer of its own, keyed by its pane, so
|
|
854
|
+
// each keeps its own state (a draft, a scroll, a failure) and never
|
|
855
|
+
// another tab's. The hidden ones stay mounted out of sight, at the
|
|
856
|
+
// off-screen cadence, as a pane under a floating window does.
|
|
857
|
+
const members = transientFocusActive || !leaf.stack ? [leaf.instanceId] : leaf.stack;
|
|
858
|
+
const rect = transientFocusActive ? fullscreenRect : leaf.rect;
|
|
859
|
+
const stackTabs = transientFocusActive ? undefined : stackTabsById.get(leaf.instanceId);
|
|
860
|
+
return members.map((memberId) => {
|
|
861
|
+
const pane = paneMap.get(memberId);
|
|
862
|
+
if (!pane) return null;
|
|
863
|
+
const props = layerProps(pane, rect);
|
|
864
|
+
const shown = memberId === leaf.instanceId;
|
|
865
|
+
return (
|
|
866
|
+
<DockedPaneLayer
|
|
867
|
+
key={`dock:${memberId}`}
|
|
868
|
+
{...props}
|
|
869
|
+
hidden={props.hidden || !shown}
|
|
870
|
+
inView={props.inView && shown}
|
|
871
|
+
dockEdges={nativePaneChrome && !transientFocusActive ? dockEdgesOf(leaf.rect, width, contentHeight) : undefined}
|
|
872
|
+
stackTabs={shown ? stackTabs : undefined}
|
|
873
|
+
live={live}
|
|
874
|
+
/>
|
|
875
|
+
);
|
|
876
|
+
});
|
|
748
877
|
})}
|
|
749
878
|
|
|
750
879
|
{floatingLayers.map(({ pane, rect }) => {
|
|
@@ -50,7 +50,7 @@ const PANE_ACTION_TO_SHORTCUT: Partial<Record<CoreKeybindingActionId, PaneManage
|
|
|
50
50
|
|
|
51
51
|
export type PaneManagementAccelerators = Record<
|
|
52
52
|
"menu" | "settings" | "fullscreen" | "newLayout" | "toggleFloating" | "popOut" | "copyScreenshot" | "exportCsv" | "share" | "ask" | "close"
|
|
53
|
-
| "closeAllFloating" | "layoutGallery" | "gridlockAll" | "windowMode" | "windowResizeMode",
|
|
53
|
+
| "closeAllFloating" | "layoutGallery" | "gridlockAll" | "windowMode" | "windowResizeMode" | "tickerSearch",
|
|
54
54
|
string | undefined
|
|
55
55
|
>;
|
|
56
56
|
|
|
@@ -65,6 +65,8 @@ export function paneManagementAccelerators(
|
|
|
65
65
|
mode: ShortcutDisplayMode = "platform",
|
|
66
66
|
): PaneManagementAccelerators {
|
|
67
67
|
const terminalAsk = mode === "terminal" ? advertisedChord(keybindings, "pane-ask", "terminal") : null;
|
|
68
|
+
// The backtick has no modifier, so it is said as the terminal advertises it.
|
|
69
|
+
const tickerSearch = advertisedChord(keybindings, "ticker-search", mode);
|
|
68
70
|
return {
|
|
69
71
|
menu: menuAcceleratorFor(keybindings, "pane-menu"),
|
|
70
72
|
settings: menuAcceleratorFor(keybindings, "pane-settings"),
|
|
@@ -82,6 +84,7 @@ export function paneManagementAccelerators(
|
|
|
82
84
|
gridlockAll: menuAcceleratorFor(keybindings, "tidy-windows"),
|
|
83
85
|
windowMode: menuAcceleratorFor(keybindings, "window-move-mode"),
|
|
84
86
|
windowResizeMode: menuAcceleratorFor(keybindings, "window-resize-mode"),
|
|
87
|
+
tickerSearch: tickerSearch ? serializeKeyChord(tickerSearch) : undefined,
|
|
85
88
|
};
|
|
86
89
|
}
|
|
87
90
|
|
|
@@ -18,6 +18,8 @@ import type {
|
|
|
18
18
|
VisibleFloatingPane,
|
|
19
19
|
} from "./drag/runtime";
|
|
20
20
|
import type { WindowEditState } from "../window-edit/mode";
|
|
21
|
+
import { paneHeaderTitleStart, stackTabSpans } from "../pane/header";
|
|
22
|
+
import { displayWidth } from "../../../utils/format";
|
|
21
23
|
|
|
22
24
|
interface UseShellTerminalPointerRuntimeOptions {
|
|
23
25
|
appHeaderHeight: number;
|
|
@@ -39,6 +41,7 @@ interface UseShellTerminalPointerRuntimeOptions {
|
|
|
39
41
|
) => void;
|
|
40
42
|
/** The header's `?`: the pane's entry in DOCS. */
|
|
41
43
|
openPaneDocs: (paneId: string) => void;
|
|
44
|
+
getPaneTitle: (pane: ResolvedPane) => string;
|
|
42
45
|
paneMap: Map<string, ResolvedPane>;
|
|
43
46
|
selectWindowModePane: (paneId: string) => void;
|
|
44
47
|
setHoveredMenuItemId: Dispatch<SetStateAction<string | null>>;
|
|
@@ -61,6 +64,21 @@ function getVisibleFloatingRect(
|
|
|
61
64
|
: visibleRect;
|
|
62
65
|
}
|
|
63
66
|
|
|
67
|
+
/** The tab of a stack whose title is `x` cells into its header's title. */
|
|
68
|
+
function stackTabAt(
|
|
69
|
+
stack: readonly string[],
|
|
70
|
+
x: number,
|
|
71
|
+
paneMap: Map<string, ResolvedPane>,
|
|
72
|
+
getPaneTitle: (pane: ResolvedPane) => string,
|
|
73
|
+
): string | null {
|
|
74
|
+
const titles = stack.map((id) => {
|
|
75
|
+
const pane = paneMap.get(id);
|
|
76
|
+
return pane ? getPaneTitle(pane) : id;
|
|
77
|
+
});
|
|
78
|
+
const index = stackTabSpans(titles).findIndex((span) => x >= span.start && x < span.start + displayWidth(span.text));
|
|
79
|
+
return index >= 0 ? stack[index]! : null;
|
|
80
|
+
}
|
|
81
|
+
|
|
64
82
|
function sortedFloatingPanes(visibleFloatingPanes: VisibleFloatingPane[]): VisibleFloatingPane[] {
|
|
65
83
|
return [...visibleFloatingPanes].sort((a, b) => (b.pane.floating?.zIndex ?? 50) - (a.pane.floating?.zIndex ?? 50));
|
|
66
84
|
}
|
|
@@ -80,6 +98,7 @@ export function useShellTerminalPointerRuntime({
|
|
|
80
98
|
menuState,
|
|
81
99
|
openPaneMenu,
|
|
82
100
|
openPaneDocs,
|
|
101
|
+
getPaneTitle,
|
|
83
102
|
paneMap,
|
|
84
103
|
selectWindowModePane,
|
|
85
104
|
setHoveredMenuItemId,
|
|
@@ -331,9 +350,12 @@ export function useShellTerminalPointerRuntime({
|
|
|
331
350
|
return;
|
|
332
351
|
}
|
|
333
352
|
if (relativeY === 0) {
|
|
353
|
+
// A press on one of a stack's tabs moves that pane; the release
|
|
354
|
+
// shows it if the pointer did not move.
|
|
355
|
+
const tabId = leaf.stack ? stackTabAt(leaf.stack, relativeX - paneHeaderTitleStart(isFocused), paneMap, getPaneTitle) : null;
|
|
334
356
|
startDrag({
|
|
335
357
|
type: "pane-drag",
|
|
336
|
-
paneId: leaf.instanceId,
|
|
358
|
+
paneId: tabId ?? leaf.instanceId,
|
|
337
359
|
mode: "docked",
|
|
338
360
|
startX: preciseX,
|
|
339
361
|
startY: preciseShellY,
|
|
@@ -358,6 +380,7 @@ export function useShellTerminalPointerRuntime({
|
|
|
358
380
|
dockLeafLayouts,
|
|
359
381
|
focusPane,
|
|
360
382
|
focusedPaneId,
|
|
383
|
+
getPaneTitle,
|
|
361
384
|
handleActiveDrag,
|
|
362
385
|
handleFloatingClose,
|
|
363
386
|
live,
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
resolveNativeFloatingResizeCornerRect,
|
|
23
23
|
} from "../../window-edit/status";
|
|
24
24
|
import { MENU_Z_INDEX } from "../menu";
|
|
25
|
+
import { DesktopDropPreview } from "../drag/overlays";
|
|
25
26
|
import { truncateToDisplayWidth } from "../../../../utils/format";
|
|
26
27
|
|
|
27
28
|
interface ShellWindowModeOverlaysProps {
|
|
@@ -103,7 +104,18 @@ export function ShellWindowModeOverlays({
|
|
|
103
104
|
|
|
104
105
|
return (
|
|
105
106
|
<>
|
|
106
|
-
{windowModeDockMovePreview && (
|
|
107
|
+
{windowModeDockMovePreview && (nativePaneChrome ? (
|
|
108
|
+
<DesktopDropPreview
|
|
109
|
+
rect={windowModeDockMovePreview.rect}
|
|
110
|
+
zIndex={MENU_Z_INDEX - 2}
|
|
111
|
+
role="window-mode-drop-preview"
|
|
112
|
+
attributes={{
|
|
113
|
+
"data-target-id": windowModeDockMovePreview.targetId,
|
|
114
|
+
"data-position": windowModeDockMovePreview.position,
|
|
115
|
+
}}
|
|
116
|
+
/>
|
|
117
|
+
) : (
|
|
118
|
+
// An outline alone: the terminal cannot tint what is under it.
|
|
107
119
|
<Box
|
|
108
120
|
position="absolute"
|
|
109
121
|
left={windowModeDockMovePreview.rect.x}
|
|
@@ -114,12 +126,8 @@ export function ShellWindowModeOverlays({
|
|
|
114
126
|
border
|
|
115
127
|
borderStyle="single"
|
|
116
128
|
borderColor={colors.borderFocused}
|
|
117
|
-
backgroundColor={colors.panel}
|
|
118
|
-
data-gloom-role="window-mode-drop-preview"
|
|
119
|
-
data-target-id={windowModeDockMovePreview.targetId}
|
|
120
|
-
data-position={windowModeDockMovePreview.position}
|
|
121
129
|
/>
|
|
122
|
-
)}
|
|
130
|
+
))}
|
|
123
131
|
|
|
124
132
|
{highlightedPaneId && !nativePaneChrome && highlightedRect && highlightedRect.height >= 2 && (!overlayOpen || menuOpen) && (() => {
|
|
125
133
|
const selectedInWindowMode = !!windowMode;
|