gloomberb 0.19.3 → 0.19.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -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/commands/command-utils.ts +4 -0
- package/src/cli/commands/market.ts +119 -27
- package/src/cli/commands/search.ts +1 -1
- package/src/cli/commands/ticker.ts +10 -6
- package/src/cli/currency-name-hint.ts +60 -0
- package/src/cli/desktop-pane-shot-api-policy.ts +10 -2
- package/src/cli/desktop-pane-shot.ts +2 -1
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +17 -2
- package/src/cli/not-a-ticker.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +9 -1
- package/src/cli/pane-functions/headless.ts +7 -3
- package/src/cli/pane-functions/market-session.ts +6 -7
- package/src/cli/series-search.ts +4 -5
- package/src/components/chart/composite/panel-bitmap.ts +28 -2
- package/src/components/chart/composite/time-axis.ts +17 -2
- 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 +160 -28
- 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 +304 -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/components/layout/window-controls.tsx +96 -35
- package/src/components/layout/window-fullscreen.ts +20 -0
- package/src/components/quote-flash.ts +36 -32
- 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/events.ts +17 -1
- 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/frame-scheduler.ts +47 -10
- package/src/market-data/frame-wake.ts +74 -0
- package/src/market-data/futures-board.ts +7 -6
- package/src/market-data/hooks.tsx +43 -3
- package/src/market-data/performance.ts +78 -9
- package/src/market-data/request-types.ts +6 -3
- package/src/news/aggregator.ts +12 -1
- package/src/plugins/builtin/alerts/cli.ts +2 -1
- package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
- package/src/plugins/builtin/attention/evidence.ts +1 -1
- package/src/plugins/builtin/awards/client.ts +1 -1
- package/src/plugins/builtin/awards/evidence.ts +1 -1
- package/src/plugins/builtin/awards/pane.tsx +2 -1
- package/src/plugins/builtin/bond-calculator/math.ts +1 -1
- package/src/plugins/builtin/broker-manager/footer.ts +3 -2
- package/src/plugins/builtin/broker-manager/index.tsx +2 -1
- package/src/plugins/builtin/broker-manager/keyboard.ts +2 -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/catalysts/evidence.ts +1 -1
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/chart-composer/headless.ts +40 -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/cloud-tweets/table.tsx +3 -2
- package/src/plugins/builtin/comment-letters/client.ts +2 -1
- package/src/plugins/builtin/company-kpis/client.ts +1 -1
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
- package/src/plugins/builtin/cot/headless.ts +9 -3
- package/src/plugins/builtin/cot/model.ts +44 -3
- package/src/plugins/builtin/credit-documents/client.ts +1 -1
- package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
- package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
- package/src/plugins/builtin/econ/calendar-model.ts +2 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
- package/src/plugins/builtin/econ/print-watch.ts +3 -1
- package/src/plugins/builtin/futures/series.ts +16 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
- package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
- package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
- package/src/plugins/builtin/gpu/headless.ts +2 -1
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/index.tsx +3 -2
- package/src/plugins/builtin/insider/display.ts +45 -6
- package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
- package/src/plugins/builtin/iv-history/client.ts +2 -1
- package/src/plugins/builtin/iv-history/headless.ts +2 -1
- package/src/plugins/builtin/jobs/pages.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
- package/src/plugins/builtin/members/client.ts +1 -1
- package/src/plugins/builtin/mna/distress/client.ts +1 -0
- package/src/plugins/builtin/mna/pane.tsx +4 -1
- package/src/plugins/builtin/options/market-reference.ts +1 -1
- package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
- package/src/plugins/builtin/options/view.tsx +2 -1
- package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
- package/src/plugins/builtin/options-scenario/csp.ts +28 -9
- package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/client.ts +1 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
- package/src/plugins/builtin/research/analyst-model.ts +1 -0
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
- package/src/plugins/builtin/research/index.tsx +1 -0
- package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
- package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
- package/src/plugins/builtin/research-search/snippet.ts +1 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
- package/src/plugins/builtin/sec/index.tsx +7 -4
- package/src/plugins/builtin/sec/row-summaries.ts +28 -12
- package/src/plugins/builtin/sectors/client.ts +18 -8
- package/src/plugins/builtin/sectors/index.tsx +19 -5
- package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
- package/src/plugins/builtin/social-mentions/client.ts +2 -1
- package/src/plugins/builtin/supply-chain/client.ts +1 -1
- package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +25 -2
- package/src/plugins/builtin/time-sales/client.ts +1 -0
- package/src/plugins/builtin/vol-surface/client.ts +2 -1
- package/src/plugins/builtin/yield-curve/headless.ts +3 -1
- package/src/portfolio/column-values.ts +76 -10
- 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/host/box.tsx +204 -176
- package/src/renderers/dom/host/style.ts +49 -20
- package/src/renderers/dom/host/text.tsx +3 -2
- package/src/renderers/dom/styles.css +32 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +2 -0
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +25 -1
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
- package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
- package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
- package/src/renderers/electrobun/shared/protocol.ts +6 -0
- package/src/renderers/electrobun/view/ui-host.tsx +7 -0
- package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
- package/src/shares/portable-layout.ts +99 -2
- package/src/sources/provider-router/index.ts +9 -3
- package/src/sources/provider-router/sources.ts +26 -1
- package/src/sync/core-contributors.ts +18 -4
- package/src/time-series/price-units.ts +11 -0
- package/src/time-series/resolve.ts +12 -0
- package/src/types/config.ts +17 -1
- package/src/types/plugin.ts +6 -0
- package/src/ui/host.tsx +2 -0
- package/src/utils/currency-names.ts +20 -0
- package/src/utils/currency-pair.ts +6 -0
- package/src/utils/exchange-rate-snapshot.ts +20 -2
- package/src/utils/fx-market-hours.ts +43 -0
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Box, Text, useActionShortcut, useNativeRenderer, useRendererHost, useUiCapabilities } from "../../../ui";
|
|
2
|
-
import { useCallback, useRef, type ReactNode } from "react";
|
|
2
|
+
import { useCallback, useMemo, useRef, type ReactNode } from "react";
|
|
3
3
|
import { colors, floatingPaneTitleBg, paneTitleBg, paneTitleText } from "../../../theme/colors";
|
|
4
4
|
import { WEB_CELL_WIDTH } from "../../../theme/font-scale";
|
|
5
5
|
import { displayWidth, truncateToDisplayWidth } from "../../../utils/format";
|
|
6
6
|
import { capturePointerDrag } from "../../../ui/pointer-drag";
|
|
7
7
|
import { Tabs } from "../../ui/tabs";
|
|
8
|
+
import { Divider } from "../../ui/display";
|
|
8
9
|
import { ICON_GLYPHS, Icon, IconButton } from "../../ui/icon";
|
|
10
|
+
import { Button } from "../../ui/button";
|
|
11
|
+
import { t } from "../../../i18n";
|
|
9
12
|
import type { PaneHeaderTabsRegistration } from "./header-tabs";
|
|
10
13
|
import { nativePaneHeaderRows } from "./sizing";
|
|
11
14
|
|
|
@@ -25,9 +28,80 @@ export const PANE_HEADER_ASK_MIN_WIDTH = 32;
|
|
|
25
28
|
export const PANE_HEADER_RESTORE = " - ";
|
|
26
29
|
const PANE_HEADER_LOCK = " 🔒 ";
|
|
27
30
|
const HIDDEN_HEADER_BUTTON = { visibility: "hidden" } as const;
|
|
31
|
+
/** Terminal: between two tabs of a stack, and the most of a title one tab shows. */
|
|
32
|
+
const STACK_TAB_SEPARATOR = " │ ";
|
|
33
|
+
const STACK_TAB_MAX_WIDTH = 16;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Panes stacked in one spot of the dock: the header names each as a tab in
|
|
37
|
+
* place of the title, the one shown first among equals.
|
|
38
|
+
*/
|
|
39
|
+
export interface PaneHeaderStack {
|
|
40
|
+
/** In tab order. */
|
|
41
|
+
tabs: ReadonlyArray<{ id: string; title: string }>;
|
|
42
|
+
/** The pane shown. */
|
|
43
|
+
active: string;
|
|
44
|
+
/** A click on a tab: show that pane. */
|
|
45
|
+
onSelect: (id: string) => void;
|
|
46
|
+
/** A press on a tab, in place of the header's: a drag moves that pane out of the stack. */
|
|
47
|
+
onTabMouseDown?: (id: string, event: any) => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Terminal: each tab of a stack in its header, as text and where it starts,
|
|
52
|
+
* in cells from where the title starts (after the grip). The pointer runtime
|
|
53
|
+
* finds the tab under a press with it.
|
|
54
|
+
*/
|
|
55
|
+
export function stackTabSpans(titles: readonly string[]): Array<{ start: number; text: string }> {
|
|
56
|
+
let start = 0;
|
|
57
|
+
return titles.map((title) => {
|
|
58
|
+
const text = truncateToDisplayWidth(title, STACK_TAB_MAX_WIDTH);
|
|
59
|
+
const span = { start, text };
|
|
60
|
+
start += displayWidth(text) + STACK_TAB_SEPARATOR.length;
|
|
61
|
+
return span;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Terminal: the cells before a header's title: the grip, after the corner a focused or floating pane draws. */
|
|
66
|
+
export function paneHeaderTitleStart(framed: boolean): number {
|
|
67
|
+
return (framed ? 2 : 0) + PANE_HEADER_GRIP.length;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Terminal: how wide a stack's tabs are, all of them. */
|
|
71
|
+
function stackTabsWidth(stack: PaneHeaderStack): number {
|
|
72
|
+
const last = stackTabSpans(stack.tabs.map((tab) => tab.title)).at(-1);
|
|
73
|
+
return last ? last.start + displayWidth(last.text) : 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Terminal: a stack's tabs in at most `width` cells (all of them with `pad`), the shown one in `activeFg`, the rest dim. */
|
|
77
|
+
function TerminalStackTabs({ stack, width, activeFg, pad }: { stack: PaneHeaderStack; width: number; activeFg: string; pad: boolean }) {
|
|
78
|
+
const spans = stackTabSpans(stack.tabs.map((tab) => tab.title));
|
|
79
|
+
const parts: Array<{ key: string; text: string; fg: string }> = [];
|
|
80
|
+
stack.tabs.forEach((tab, index) => {
|
|
81
|
+
if (index > 0) parts.push({ key: `sep:${tab.id}`, text: STACK_TAB_SEPARATOR, fg: colors.border });
|
|
82
|
+
parts.push({ key: tab.id, text: spans[index]!.text, fg: tab.id === stack.active ? activeFg : colors.textDim });
|
|
83
|
+
});
|
|
84
|
+
let left = width;
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
{parts.map((part) => {
|
|
88
|
+
const text = truncateToDisplayWidth(part.text, Math.max(0, left));
|
|
89
|
+
left -= displayWidth(text);
|
|
90
|
+
return text ? <Text key={part.key} fg={part.fg} selectable={false}>{text}</Text> : null;
|
|
91
|
+
})}
|
|
92
|
+
{pad && left > 0 && <Text fg={activeFg} selectable={false}>{" ".repeat(left)}</Text>}
|
|
93
|
+
</>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
28
96
|
|
|
29
97
|
interface PaneHeaderProps {
|
|
30
98
|
title: string;
|
|
99
|
+
/**
|
|
100
|
+
* Desktop and web: the ticker of a single-ticker pane, drawn where its title names it as a
|
|
101
|
+
* control that opens ticker search for the pane (`onTitleTickerPress`).
|
|
102
|
+
*/
|
|
103
|
+
titleTicker?: string | null;
|
|
104
|
+
onTitleTickerPress?: () => void;
|
|
31
105
|
width: number;
|
|
32
106
|
focused: boolean;
|
|
33
107
|
windowModeSelected?: boolean;
|
|
@@ -37,6 +111,8 @@ interface PaneHeaderProps {
|
|
|
37
111
|
quickSettings?: PaneHeaderQuickSetting[];
|
|
38
112
|
/** Desktop only: the pane's primary tab strip, drawn as title-bar tabs. */
|
|
39
113
|
tabs?: PaneHeaderTabsRegistration | null;
|
|
114
|
+
/** Panes stacked in this spot: their tabs replace the title. */
|
|
115
|
+
stack?: PaneHeaderStack | null;
|
|
40
116
|
/** The body colour the active title-bar tab opens into. */
|
|
41
117
|
bodyBackground?: string;
|
|
42
118
|
/**
|
|
@@ -122,8 +198,61 @@ function TerminalPaneButton({
|
|
|
122
198
|
);
|
|
123
199
|
}
|
|
124
200
|
|
|
201
|
+
/**
|
|
202
|
+
* Where `symbol` stands in a pane's title as a word of its own ("OMON SPY", "Chart: NVDA \u29c9
|
|
203
|
+
* Linked to DES"), so the header can draw it as a control. Null when the title does not name it.
|
|
204
|
+
*/
|
|
205
|
+
export function findTitleTicker(title: string, symbol: string): { start: number; end: number } | null {
|
|
206
|
+
if (!symbol) return null;
|
|
207
|
+
for (let start = title.indexOf(symbol); start >= 0; start = title.indexOf(symbol, start + 1)) {
|
|
208
|
+
const end = start + symbol.length;
|
|
209
|
+
if ((start === 0 || /\s/.test(title[start - 1]!)) && (end === title.length || /[\s,]/.test(title[end]!))) {
|
|
210
|
+
return { start, end };
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The ticker in a single-ticker pane's title: a ghost button in the title's own type, marked
|
|
218
|
+
* with the chevron a query bar's choices carry, that opens ticker search for the pane. It sits
|
|
219
|
+
* where the title's text put the ticker, so only the chevron and the hover fill tell it apart.
|
|
220
|
+
*/
|
|
221
|
+
function PaneTitleTicker({ symbol, color, onPress }: {
|
|
222
|
+
symbol: string;
|
|
223
|
+
color: string;
|
|
224
|
+
onPress: () => void;
|
|
225
|
+
}) {
|
|
226
|
+
const searchShortcut = useActionShortcut("ticker-search");
|
|
227
|
+
const label = "Change ticker";
|
|
228
|
+
// A span in the title's line, so the title still ends in one ellipsis. The button's inset goes
|
|
229
|
+
// into the space before it, so the ticker's letters stay where the title's text put them.
|
|
230
|
+
return (
|
|
231
|
+
<Text
|
|
232
|
+
data-gloom-role="pane-title-ticker"
|
|
233
|
+
style={{ display: "inline-flex", verticalAlign: "top", marginLeft: "calc(-1 * var(--gloom-space-xs))" }}
|
|
234
|
+
>
|
|
235
|
+
<Button
|
|
236
|
+
label={label}
|
|
237
|
+
title={searchShortcut ? `${t(label)} (${searchShortcut})` : t(label)}
|
|
238
|
+
variant="plain"
|
|
239
|
+
compact
|
|
240
|
+
stopPropagation
|
|
241
|
+
onPress={onPress}
|
|
242
|
+
>
|
|
243
|
+
<Text fg={color} selectable={false} style={{ fontWeight: "var(--gloom-weight-bold)" }}>{symbol}</Text>
|
|
244
|
+
<Text style={{ display: "inline-flex", marginLeft: "var(--gloom-space-xs)" }}>
|
|
245
|
+
<Icon name="chevron-down" size={9} color={colors.textMuted} />
|
|
246
|
+
</Text>
|
|
247
|
+
</Button>
|
|
248
|
+
</Text>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
125
252
|
export function PaneHeader({
|
|
126
253
|
title,
|
|
254
|
+
titleTicker = null,
|
|
255
|
+
onTitleTickerPress,
|
|
127
256
|
width,
|
|
128
257
|
focused,
|
|
129
258
|
windowModeSelected = false,
|
|
@@ -132,6 +261,7 @@ export function PaneHeader({
|
|
|
132
261
|
showActions = false,
|
|
133
262
|
quickSettings = [],
|
|
134
263
|
tabs = null,
|
|
264
|
+
stack = null,
|
|
135
265
|
bodyBackground,
|
|
136
266
|
topRule = false,
|
|
137
267
|
titleBar = null,
|
|
@@ -165,6 +295,7 @@ export function PaneHeader({
|
|
|
165
295
|
const terminalQuickSettingsWidth = quickSettings.reduce((total, setting) => total + displayWidth(quickSettingText(setting)), 0)
|
|
166
296
|
+ displayWidth(lockText) + helpText.length;
|
|
167
297
|
const textColor = paneTitleText(visuallyFocused, floating);
|
|
298
|
+
const tickerAt = titleTicker ? findTitleTicker(title, titleTicker) : null;
|
|
168
299
|
const topInset = topRule ? 1 : 0;
|
|
169
300
|
const handleTerminalHeaderMouseDown = useCallback((event: any) => {
|
|
170
301
|
capturePointerDrag(nativeRenderer, terminalHeaderRef.current);
|
|
@@ -174,10 +305,20 @@ export function PaneHeader({
|
|
|
174
305
|
// padding. Tabs and buttons stop the press before it gets here. A fullscreen
|
|
175
306
|
// pane cannot move, so there the bar moves the desktop window instead.
|
|
176
307
|
const windowDrag = Boolean(titleBar) || (fullscreen && titleBarOverlay === true && nativeWindowChrome === true);
|
|
177
|
-
const beginPaneDrag = (event: { stopPropagation?: () => void }) => {
|
|
308
|
+
const beginPaneDrag = (event: { stopPropagation?: () => void; target?: unknown }) => {
|
|
178
309
|
event.stopPropagation?.();
|
|
310
|
+
// A press on one of a stack's tabs moves that pane, not the one shown.
|
|
311
|
+
const tabId = stack?.onTabMouseDown ? stackTabOfTarget(event.target) : null;
|
|
312
|
+
if (tabId && stack?.onTabMouseDown) {
|
|
313
|
+
stack.onTabMouseDown(tabId, event);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
179
316
|
onHeaderMouseDown?.(event);
|
|
180
317
|
};
|
|
318
|
+
const stackTabItems = useMemo(
|
|
319
|
+
() => stack?.tabs.map((tab) => ({ label: tab.title, value: tab.id })) ?? null,
|
|
320
|
+
[stack?.tabs],
|
|
321
|
+
);
|
|
181
322
|
const beginWindowDrag = (event?: { stopPropagation?: () => void; detail?: number }) => {
|
|
182
323
|
event?.stopPropagation?.();
|
|
183
324
|
if (titleBar) {
|
|
@@ -193,6 +334,24 @@ export function PaneHeader({
|
|
|
193
334
|
if (nativePaneChrome) {
|
|
194
335
|
// Focused, the rule is the accent; otherwise the one hairline.
|
|
195
336
|
const ruleColor = visuallyFocused ? colors.borderFocused : "var(--gloom-hairline)";
|
|
337
|
+
// Title-bar tabs, the pane's own and a stack's alike: the strip hangs over
|
|
338
|
+
// the header's rules so the active tab's box opens into the pane.
|
|
339
|
+
const headerTabStripStyle = {
|
|
340
|
+
alignSelf: "stretch",
|
|
341
|
+
marginTop: -topInset,
|
|
342
|
+
marginBottom: -1,
|
|
343
|
+
// Undoes the negative top margin for what is centred in the strip:
|
|
344
|
+
// the overflow chevron, and the tab labels (styles.css).
|
|
345
|
+
"--pane-tab-top-inset": `${topInset}px`,
|
|
346
|
+
// The active tab's box opens into the pane over the bottom rule
|
|
347
|
+
// (styles.css), drawn in the rule's colour so the two are one line.
|
|
348
|
+
"--pane-tab-border": ruleColor,
|
|
349
|
+
// Until the strip has measured the surface under the tab (top-surface.ts).
|
|
350
|
+
"--pane-tab-active-bg": bodyBackground ?? colors.bg,
|
|
351
|
+
// The active tab reads as active whenever the pane is focused, even
|
|
352
|
+
// while a detail or field inside the pane owns the keyboard.
|
|
353
|
+
"--pane-tab-active-fg": visuallyFocused ? colors.textBright : colors.text,
|
|
354
|
+
} as const;
|
|
196
355
|
// No width of its own: it stretches across its pane, so it follows a
|
|
197
356
|
// frame a resize sizes outside React.
|
|
198
357
|
return (
|
|
@@ -231,25 +390,64 @@ export function PaneHeader({
|
|
|
231
390
|
<Icon name="grip" size={12} color={visuallyFocused ? colors.borderFocused : colors.textMuted} />
|
|
232
391
|
</Box>
|
|
233
392
|
)}
|
|
234
|
-
{
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
// change width as the pane takes and loses focus.
|
|
244
|
-
fontWeight: 700,
|
|
245
|
-
whiteSpace: "nowrap",
|
|
246
|
-
overflow: "hidden",
|
|
247
|
-
textOverflow: "ellipsis",
|
|
248
|
-
}}
|
|
393
|
+
{stack && stackTabItems ? (
|
|
394
|
+
// The panes stacked here, in place of the title: the same title-bar
|
|
395
|
+
// tabs as a pane's own strip. A press on one moves that pane
|
|
396
|
+
// (beginPaneDrag), so the strip lets it through to the header.
|
|
397
|
+
<Box
|
|
398
|
+
data-gloom-role="pane-stack-tabs"
|
|
399
|
+
flexShrink={1}
|
|
400
|
+
minWidth={0}
|
|
401
|
+
style={{ ...headerTabStripStyle, ...(tabs ? { maxWidth: "40%" } : {}) }}
|
|
249
402
|
>
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
403
|
+
<Tabs
|
|
404
|
+
tabs={stackTabItems}
|
|
405
|
+
activeValue={stack.active}
|
|
406
|
+
onSelect={stack.onSelect}
|
|
407
|
+
variant="header"
|
|
408
|
+
focused={visuallyFocused}
|
|
409
|
+
keyboardNavigation={false}
|
|
410
|
+
paneMenu={false}
|
|
411
|
+
/>
|
|
412
|
+
</Box>
|
|
413
|
+
) : (
|
|
414
|
+
/* Full header height, so trimming the title to its capitals never lets
|
|
415
|
+
this clip cut descenders. */
|
|
416
|
+
<Box data-gloom-role="pane-header-chrome" minWidth={0} flexShrink={tabs ? 0 : 1} overflow="hidden" flexDirection="row" alignItems="center" style={{ alignSelf: "stretch", ...(tabs ? { maxWidth: "40%" } : {}) }}>
|
|
417
|
+
<Text
|
|
418
|
+
fg={textColor}
|
|
419
|
+
selectable={false}
|
|
420
|
+
data-gloom-role="pane-title"
|
|
421
|
+
style={{
|
|
422
|
+
// Focus changes the colour, never the weight: a bold title would
|
|
423
|
+
// change width as the pane takes and loses focus.
|
|
424
|
+
fontWeight: 700,
|
|
425
|
+
whiteSpace: "nowrap",
|
|
426
|
+
overflow: "hidden",
|
|
427
|
+
textOverflow: "ellipsis",
|
|
428
|
+
}}
|
|
429
|
+
>
|
|
430
|
+
{tickerAt && onTitleTickerPress ? (
|
|
431
|
+
<>
|
|
432
|
+
{title.slice(0, tickerAt.start)}
|
|
433
|
+
<PaneTitleTicker
|
|
434
|
+
symbol={title.slice(tickerAt.start, tickerAt.end)}
|
|
435
|
+
color={textColor}
|
|
436
|
+
onPress={onTitleTickerPress}
|
|
437
|
+
/>
|
|
438
|
+
{title.slice(tickerAt.end)}
|
|
439
|
+
</>
|
|
440
|
+
) : title}
|
|
441
|
+
</Text>
|
|
442
|
+
</Box>
|
|
443
|
+
)}
|
|
444
|
+
{stack && tabs && (
|
|
445
|
+
// Two strips, two roles: the panes stacked here, then the views of
|
|
446
|
+
// the one shown. The rule keeps them from reading as one strip.
|
|
447
|
+
<Box flexDirection="row" flexShrink={0} style={{ alignSelf: "stretch", marginLeft: "var(--gloom-space-sm)", paddingBlock: "var(--gloom-space-xs)" }}>
|
|
448
|
+
<Divider orientation="vertical" />
|
|
449
|
+
</Box>
|
|
450
|
+
)}
|
|
253
451
|
{tabs && (
|
|
254
452
|
<Box
|
|
255
453
|
data-gloom-role="pane-header-tabs"
|
|
@@ -259,23 +457,7 @@ export function PaneHeader({
|
|
|
259
457
|
// Tabs select on click; the header must not start a pane drag.
|
|
260
458
|
event.stopPropagation?.();
|
|
261
459
|
}}
|
|
262
|
-
style={{
|
|
263
|
-
alignSelf: "stretch",
|
|
264
|
-
marginTop: -topInset,
|
|
265
|
-
marginBottom: -1,
|
|
266
|
-
marginLeft: "var(--gloom-space-sm)",
|
|
267
|
-
// Undoes the negative top margin for what is centred in the strip:
|
|
268
|
-
// the overflow chevron, and the tab labels (styles.css).
|
|
269
|
-
"--pane-tab-top-inset": `${topInset}px`,
|
|
270
|
-
// The active tab's box opens into the pane over the bottom rule
|
|
271
|
-
// (styles.css), drawn in the rule's colour so the two are one line.
|
|
272
|
-
"--pane-tab-border": ruleColor,
|
|
273
|
-
// Until the strip has measured the surface under the tab (top-surface.ts).
|
|
274
|
-
"--pane-tab-active-bg": bodyBackground ?? colors.bg,
|
|
275
|
-
// The active tab reads as active whenever the pane is focused, even
|
|
276
|
-
// while a detail or field inside the pane owns the keyboard.
|
|
277
|
-
"--pane-tab-active-fg": visuallyFocused ? colors.textBright : colors.text,
|
|
278
|
-
}}
|
|
460
|
+
style={{ ...headerTabStripStyle, marginLeft: "var(--gloom-space-sm)" }}
|
|
279
461
|
>
|
|
280
462
|
<Tabs
|
|
281
463
|
tabs={tabs.tabs}
|
|
@@ -366,7 +548,7 @@ export function PaneHeader({
|
|
|
366
548
|
const contentWidth = PANE_HEADER_GRIP.length + terminalQuickSettingsWidth + closeText.length + actionText.length;
|
|
367
549
|
const titleWidth = Math.max(0, innerWidth - contentWidth);
|
|
368
550
|
const clippedTitle = truncateToDisplayWidth(title, titleWidth);
|
|
369
|
-
const fillLen = Math.max(0, innerWidth - PANE_HEADER_GRIP.length - displayWidth(clippedTitle) - terminalQuickSettingsWidth - actionText.length - closeText.length);
|
|
551
|
+
const fillLen = Math.max(0, innerWidth - PANE_HEADER_GRIP.length - (stack ? Math.min(titleWidth, stackTabsWidth(stack)) : displayWidth(clippedTitle)) - terminalQuickSettingsWidth - actionText.length - closeText.length);
|
|
370
552
|
const fill = "─".repeat(fillLen);
|
|
371
553
|
|
|
372
554
|
return (
|
|
@@ -382,7 +564,14 @@ export function PaneHeader({
|
|
|
382
564
|
onMouseDragEnd={onHeaderMouseDragEnd}
|
|
383
565
|
>
|
|
384
566
|
<Text fg={borderColor} selectable={false}>{"┌─"}</Text>
|
|
385
|
-
|
|
567
|
+
{stack ? (
|
|
568
|
+
<>
|
|
569
|
+
<Text fg={textColor} selectable={false}>{PANE_HEADER_GRIP}</Text>
|
|
570
|
+
<TerminalStackTabs stack={stack} width={titleWidth} activeFg={textColor} pad={false} />
|
|
571
|
+
</>
|
|
572
|
+
) : (
|
|
573
|
+
<Text fg={textColor} selectable={false}>{`${PANE_HEADER_GRIP}${clippedTitle}`}</Text>
|
|
574
|
+
)}
|
|
386
575
|
{quickSettings.map((setting) => (
|
|
387
576
|
<TerminalPaneButton
|
|
388
577
|
key={setting.key}
|
|
@@ -434,9 +623,16 @@ export function PaneHeader({
|
|
|
434
623
|
onMouseDrag={onHeaderMouseDrag}
|
|
435
624
|
onMouseDragEnd={onHeaderMouseDragEnd}
|
|
436
625
|
>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
626
|
+
{stack ? (
|
|
627
|
+
<>
|
|
628
|
+
<Text fg={textColor} selectable={false}>{PANE_HEADER_GRIP}</Text>
|
|
629
|
+
<TerminalStackTabs stack={stack} width={titleWidth} activeFg={textColor} pad />
|
|
630
|
+
</>
|
|
631
|
+
) : (
|
|
632
|
+
<Text fg={textColor} selectable={false}>
|
|
633
|
+
{`${PANE_HEADER_GRIP}${clippedTitle}${padding}`}
|
|
634
|
+
</Text>
|
|
635
|
+
)}
|
|
440
636
|
{quickSettings.map((setting) => (
|
|
441
637
|
<TerminalPaneButton
|
|
442
638
|
key={setting.key}
|
|
@@ -469,3 +665,9 @@ export function PaneHeader({
|
|
|
469
665
|
</Box>
|
|
470
666
|
);
|
|
471
667
|
}
|
|
668
|
+
|
|
669
|
+
/** Desktop: the stack tab a press landed on, by the tab button it hit. */
|
|
670
|
+
function stackTabOfTarget(target: unknown): string | null {
|
|
671
|
+
const element = target as { closest?: (selector: string) => { getAttribute(name: string): string | null } | null } | null;
|
|
672
|
+
return element?.closest?.('[data-gloom-role="pane-stack-tabs"] [data-tab-value]')?.getAttribute("data-tab-value") ?? null;
|
|
673
|
+
}
|
|
@@ -2,8 +2,8 @@ import { Box, useUiCapabilities } from "../../../ui";
|
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
import { paneBg } from "../../../theme/colors";
|
|
4
4
|
import { useThemeColors } from "../../../theme/theme-context";
|
|
5
|
-
import { PaneBodyFrame, getPaneWindowAttributes } from "./frame";
|
|
6
|
-
import { PaneHeader, type PaneHeaderQuickSetting } from "./header";
|
|
5
|
+
import { PaneBodyFrame, getPaneWindowAttributes, type DockEdge } from "./frame";
|
|
6
|
+
import { PaneHeader, type PaneHeaderQuickSetting, type PaneHeaderStack } from "./header";
|
|
7
7
|
import { PaneHeaderTabsProvider, usePaneHeaderTabsHost } from "./header-tabs";
|
|
8
8
|
import { hasPaneFooterContent, PaneFooterBar, type CombinedPaneFooter } from "./footer";
|
|
9
9
|
import { paneHeaderRows, resolvePaneBodyFrame, shouldReservePaneFooter } from "./sizing";
|
|
@@ -11,6 +11,12 @@ import { paneHeaderRows, resolvePaneBodyFrame, shouldReservePaneFooter } from ".
|
|
|
11
11
|
interface PaneWrapperProps {
|
|
12
12
|
paneId?: string;
|
|
13
13
|
title?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Desktop and web: the ticker the title shows, drawn as a control that opens ticker search for
|
|
16
|
+
* the pane (`onTitleTickerPress`).
|
|
17
|
+
*/
|
|
18
|
+
titleTicker?: string | null;
|
|
19
|
+
onTitleTickerPress?: () => void;
|
|
14
20
|
focused: boolean;
|
|
15
21
|
windowModeSelected?: boolean;
|
|
16
22
|
width?: number;
|
|
@@ -27,6 +33,10 @@ interface PaneWrapperProps {
|
|
|
27
33
|
quickSettings?: PaneHeaderQuickSetting[];
|
|
28
34
|
/** A dock divider line is drawn over the top row (the pane is below another). */
|
|
29
35
|
topRule?: boolean;
|
|
36
|
+
/** Desktop: the sides that face another docked pane across the gap between them. */
|
|
37
|
+
dockEdges?: readonly DockEdge[];
|
|
38
|
+
/** Panes stacked as tabs in this spot. */
|
|
39
|
+
stack?: PaneHeaderStack | null;
|
|
30
40
|
onMouseDown?: (event: any) => void;
|
|
31
41
|
onMouseDownCapture?: (event: any) => void;
|
|
32
42
|
onHeaderMouseMove?: (event: any) => void;
|
|
@@ -47,6 +57,8 @@ interface PaneWrapperProps {
|
|
|
47
57
|
export function PaneWrapper({
|
|
48
58
|
paneId,
|
|
49
59
|
title,
|
|
60
|
+
titleTicker = null,
|
|
61
|
+
onTitleTickerPress,
|
|
50
62
|
focused,
|
|
51
63
|
windowModeSelected = false,
|
|
52
64
|
width = 0,
|
|
@@ -57,6 +69,8 @@ export function PaneWrapper({
|
|
|
57
69
|
showActions = false,
|
|
58
70
|
quickSettings,
|
|
59
71
|
topRule = false,
|
|
72
|
+
dockEdges,
|
|
73
|
+
stack,
|
|
60
74
|
onMouseDown,
|
|
61
75
|
onMouseDownCapture,
|
|
62
76
|
onHeaderMouseMove,
|
|
@@ -105,6 +119,7 @@ export function PaneWrapper({
|
|
|
105
119
|
focused,
|
|
106
120
|
windowModeSelected,
|
|
107
121
|
showBorderColor: true,
|
|
122
|
+
dockEdges,
|
|
108
123
|
})}
|
|
109
124
|
onMouseDown={onMouseDown}
|
|
110
125
|
onMouseDownCapture={onMouseDownCapture}
|
|
@@ -112,6 +127,8 @@ export function PaneWrapper({
|
|
|
112
127
|
{title && (
|
|
113
128
|
<PaneHeader
|
|
114
129
|
title={title}
|
|
130
|
+
titleTicker={titleTicker}
|
|
131
|
+
onTitleTickerPress={onTitleTickerPress}
|
|
115
132
|
width={width}
|
|
116
133
|
focused={focused}
|
|
117
134
|
windowModeSelected={windowModeSelected}
|
|
@@ -119,6 +136,7 @@ export function PaneWrapper({
|
|
|
119
136
|
showActions={showActions}
|
|
120
137
|
quickSettings={quickSettings}
|
|
121
138
|
tabs={headerTabs}
|
|
139
|
+
stack={stack}
|
|
122
140
|
bodyBackground={bg}
|
|
123
141
|
topRule={topRule}
|
|
124
142
|
onHeaderMouseMove={onHeaderMouseMove}
|