@gloom-sh/terminal 0.20.11 → 0.20.12
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 -1
- package/src/api-client/awards.ts +16 -0
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +55 -2
- package/src/api-client/index.ts +18 -1
- package/src/api-client/request.ts +86 -3
- package/src/api-client/socket-connection.ts +12 -1
- package/src/api-client/socket.ts +21 -3
- package/src/api-client/supply-chain-graph.ts +4 -2
- package/src/api-client/supply-chain.ts +8 -0
- package/src/api-client/types/econ.ts +10 -7
- package/src/api-client/types/filings-and-calls.ts +8 -0
- package/src/app/global-shortcuts.ts +2 -1
- package/src/app/keybindings/actions.ts +19 -0
- package/src/app/pane-runtime/index.tsx +18 -3
- package/src/app/pane-runtime/layout-placement.ts +63 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
- package/src/capabilities/chart-series.ts +4 -1
- package/src/cli/board-coins.ts +10 -1
- package/src/cli/commands/crypto-hints.ts +3 -2
- package/src/cli/commands/fred-series.ts +0 -54
- package/src/cli/commands/market.ts +209 -31
- package/src/cli/commands/overview.ts +47 -14
- package/src/cli/commands/search.ts +37 -8
- package/src/cli/commands/ticker.ts +15 -4
- package/src/cli/desktop-pane-shot.ts +27 -2
- package/src/cli/fx-quote-rate.ts +1 -1
- package/src/cli/glossary.ts +14 -5
- package/src/cli/history-catalog-series.ts +85 -0
- package/src/cli/index.ts +1 -1
- package/src/cli/list-progress.ts +45 -0
- package/src/cli/listing-arg.ts +71 -7
- package/src/cli/name-entries.ts +8 -4
- package/src/cli/not-a-ticker.ts +2 -2
- package/src/cli/pane-functions/freshness.ts +50 -3
- package/src/cli/pane-functions/index.ts +7 -4
- package/src/cli/pane-functions/market-session.ts +66 -14
- package/src/cli/pane-functions/options.ts +5 -0
- package/src/cli/pane-functions/resolver.ts +9 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
- package/src/cli/pane-functions/screenshot-types.ts +6 -0
- package/src/cli/quote-answer.ts +49 -10
- package/src/cli/quote-list-reads.ts +87 -0
- package/src/cli/report-tables.ts +70 -13
- package/src/cli/result.ts +24 -2
- package/src/cli/symbol-list.ts +31 -4
- package/src/cli/terminal-code-hints.ts +83 -0
- package/src/cli/ticker-resolution.ts +2 -1
- package/src/cli/treasury-yields.ts +5 -0
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/routing/launch-request.ts +2 -1
- package/src/components/command-bar/routing/navigation-state.ts +4 -2
- package/src/components/command-bar/workflow/types.ts +6 -0
- package/src/components/layout/detached-pane-shell.tsx +3 -0
- package/src/components/layout/double-escape-close.ts +34 -3
- package/src/components/layout/floating-pane.tsx +10 -4
- package/src/components/layout/pane/cycle-order.ts +66 -2
- package/src/components/layout/pane/header.tsx +140 -31
- package/src/components/layout/pane/sidebar.tsx +13 -5
- package/src/components/layout/pane/status-footer.ts +3 -1
- package/src/components/layout/shell/drag/runtime.ts +5 -0
- package/src/components/layout/shell/index.tsx +25 -0
- package/src/components/layout/shell/menu.ts +9 -0
- package/src/components/layout/shell/pane/actions.ts +36 -0
- package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
- package/src/components/layout/shell/pane-occlusion.ts +40 -0
- package/src/components/layout/shell/shortcuts.ts +17 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
- package/src/components/layout/shell/window-mode/index.ts +5 -16
- package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
- package/src/components/market-board/index.tsx +14 -5
- package/src/components/metric-treemap/index.tsx +3 -1
- package/src/components/ui/button.tsx +48 -4
- package/src/components/ui/data-table/opentui/index.tsx +24 -9
- package/src/components/ui/data-table/types.ts +7 -0
- package/src/components/ui/inline-quick-add.tsx +19 -3
- package/src/components/ui/list-view.tsx +11 -5
- package/src/components/ui/query-bar.tsx +16 -1
- package/src/components/ui/selection-fill.ts +39 -0
- package/src/core/state/app/layout-reducer.ts +2 -1
- package/src/core/state/app/pane-choices.ts +68 -0
- package/src/core/state/app/state.ts +14 -6
- package/src/core/state/app/types.ts +8 -0
- package/src/layout/pane-manager/dock-tree.ts +19 -0
- package/src/layout/pane-manager/index.ts +3 -0
- package/src/market-data/market/freshness.ts +33 -0
- package/src/market-data/market/status.ts +5 -1
- package/src/market-data/quotes/contributions.ts +10 -0
- package/src/market-data/quotes/freshness.ts +19 -0
- package/src/market-data/quotes/live-valuation.ts +31 -4
- package/src/market-data/quotes/resolution.ts +4 -0
- package/src/market-data/quotes/time.ts +0 -14
- package/src/plugins/builtin/account-management/index.tsx +1 -0
- package/src/plugins/builtin/awards/detail.tsx +12 -4
- package/src/plugins/builtin/awards/headless.ts +29 -8
- package/src/plugins/builtin/awards/model.ts +36 -2
- package/src/plugins/builtin/awards/pane.tsx +7 -4
- package/src/plugins/builtin/broker-manager/index.tsx +1 -0
- package/src/plugins/builtin/broker-trading/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
- package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
- package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
- package/src/plugins/builtin/chart-composer/headless.ts +5 -1
- package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
- package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
- package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
- package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
- package/src/plugins/builtin/chat/sidebar.tsx +3 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
- package/src/plugins/builtin/cloud/plugin.tsx +1 -0
- package/src/plugins/builtin/cloud/team/module.tsx +1 -0
- package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
- package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
- package/src/plugins/builtin/company-kpis/model.ts +3 -3
- package/src/plugins/builtin/connections/index.ts +1 -0
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
- package/src/plugins/builtin/credit-boards/client.ts +5 -0
- package/src/plugins/builtin/credit-boards/headless.ts +1 -6
- package/src/plugins/builtin/credit-boards/model.ts +0 -6
- package/src/plugins/builtin/credit-boards/series.ts +19 -8
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
- package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
- package/src/plugins/builtin/debt-maturities/model.ts +9 -15
- package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
- package/src/plugins/builtin/earnings/board-model.ts +33 -4
- package/src/plugins/builtin/earnings/board.tsx +15 -3
- package/src/plugins/builtin/earnings/calendar.tsx +10 -6
- package/src/plugins/builtin/earnings/client.ts +0 -9
- package/src/plugins/builtin/earnings/headless.ts +10 -7
- package/src/plugins/builtin/earnings/history.tsx +21 -14
- package/src/plugins/builtin/earnings-calls/data.ts +24 -4
- package/src/plugins/builtin/earnings-calls/format.ts +23 -5
- package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/earnings-calls/model.ts +11 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
- package/src/plugins/builtin/econ/calendar-model.ts +27 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
- package/src/plugins/builtin/econ/index.tsx +9 -2
- package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
- package/src/plugins/builtin/fear-greed/headless.ts +16 -13
- package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +30 -19
- package/src/plugins/builtin/insider/table.tsx +10 -7
- package/src/plugins/builtin/insider/tickers.tsx +1 -1
- package/src/plugins/builtin/iv-history/headless.ts +9 -8
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/macro-day/headless.ts +3 -3
- package/src/plugins/builtin/macro-day/model.ts +1 -1
- package/src/plugins/builtin/macro-day/releases.ts +25 -16
- package/src/plugins/builtin/market-movers/index.tsx +20 -8
- package/src/plugins/builtin/market-movers/model.ts +5 -0
- package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
- package/src/plugins/builtin/money-markets/headless.ts +12 -2
- package/src/plugins/builtin/money-markets/pane.tsx +10 -1
- package/src/plugins/builtin/options/view.tsx +1 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
- package/src/plugins/builtin/portfolio-list/table.tsx +10 -1
- package/src/plugins/builtin/realized-vol/headless.ts +28 -2
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/shared/source-footer.ts +70 -0
- package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
- package/src/plugins/builtin/short-volume/pane.tsx +5 -1
- package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
- package/src/plugins/builtin/supply-chain/client.ts +3 -1
- package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
- package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
- package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
- package/src/plugins/builtin/supply-chain/headless.ts +13 -7
- package/src/plugins/builtin/supply-chain/model.ts +68 -11
- package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
- package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
- package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
- package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
- package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
- package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
- package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
- package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
- package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
- package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
- package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +4 -2
- package/src/plugins/builtin/vol-surface/pane.tsx +5 -2
- package/src/plugins/runtime/index.tsx +1 -0
- package/src/plugins/runtime/state.ts +20 -0
- package/src/portfolio/column-values.ts +8 -2
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/react.ts +7 -0
- package/src/react/auto-refresh.ts +29 -0
- package/src/renderers/browser/deeplink-bridge.ts +24 -3
- package/src/renderers/dom/desktop/query-bar.tsx +229 -60
- package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
- package/src/renderers/dom/host/overflow-fade.ts +1 -2
- package/src/renderers/dom/styles.css +25 -5
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
- package/src/series/types.ts +2 -0
- package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
- package/src/sources/gloomberb-cloud/index.ts +25 -1
- package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
- package/src/sources/provider-errors.ts +64 -1
- package/src/sources/provider-router/batches.ts +19 -0
- package/src/sources/provider-router/index.ts +7 -1
- package/src/state/app/context/index.tsx +24 -1
- package/src/state/pane-unsent-work.ts +47 -0
- package/src/test-support/shell-pane-keys.tsx +5 -0
- package/src/test-support/telemetry-guard.ts +83 -0
- package/src/test-support/test-env.ts +12 -0
- package/src/theme/colors.ts +17 -1
- package/src/theme/ui-tokens.ts +50 -1
- package/src/tickers/listing-venues.ts +11 -1
- package/src/tickers/search/japanese-names.json +1 -0
- package/src/tickers/search/japanese-names.ts +152 -0
- package/src/tickers/terminal-codes.ts +55 -6
- package/src/time-series/base-series.ts +3 -0
- package/src/types/data-provider.ts +6 -0
- package/src/types/financials.ts +11 -0
- package/src/types/plugin-contributions.ts +7 -0
- package/src/types/plugin-panes.ts +7 -0
- package/src/ui/host.tsx +6 -0
- package/src/utils/double-escape-close.ts +42 -0
- package/src/utils/fx-status.ts +30 -7
- package/src/utils/network-failure.ts +23 -0
|
@@ -15,6 +15,10 @@ interface ShellPaneManagementShortcutOptions {
|
|
|
15
15
|
closeAllFloatingPanes(): boolean;
|
|
16
16
|
/** `focusNextFloating`: the top floating pane left takes the focus, for closing them one after another. */
|
|
17
17
|
closeFocusedPane(options?: { focusNextFloating?: boolean }): boolean;
|
|
18
|
+
/** Closes the focused pane when it is a floating window one Esc closes; false otherwise. */
|
|
19
|
+
closeFocusedFloatingPane(): boolean;
|
|
20
|
+
/** Esc Esc's close: the focused pane, then the next floating one, unless it holds unsent work. */
|
|
21
|
+
closeFocusedPaneOnEscape(): boolean;
|
|
18
22
|
copyFocusedPaneScreenshot(): boolean;
|
|
19
23
|
exportFocusedPaneCsv(): boolean;
|
|
20
24
|
focusedPaneId: string | null;
|
|
@@ -27,6 +31,8 @@ interface ShellPaneManagementShortcutOptions {
|
|
|
27
31
|
overlayOpen: boolean;
|
|
28
32
|
popOutFocusedPane(): boolean;
|
|
29
33
|
shareFocusedPane(): boolean;
|
|
34
|
+
/** Shows the tab of the focused pane's stack `direction` steps to; false when it is in no stack. */
|
|
35
|
+
showAdjacentStackTab(direction: 1 | -1): boolean;
|
|
30
36
|
startWindowMode(paneId?: string, mode?: WindowEditMode): void;
|
|
31
37
|
toggleFocusedPaneFullscreen(): boolean;
|
|
32
38
|
toggleFocusedPaneFloating(): boolean;
|
|
@@ -37,7 +43,9 @@ export function useShellPaneManagementShortcuts({
|
|
|
37
43
|
askAboutFocusedPane,
|
|
38
44
|
cancelActiveDrag,
|
|
39
45
|
closeAllFloatingPanes,
|
|
46
|
+
closeFocusedFloatingPane,
|
|
40
47
|
closeFocusedPane,
|
|
48
|
+
closeFocusedPaneOnEscape,
|
|
41
49
|
copyFocusedPaneScreenshot,
|
|
42
50
|
exportFocusedPaneCsv,
|
|
43
51
|
focusedPaneId,
|
|
@@ -50,6 +58,7 @@ export function useShellPaneManagementShortcuts({
|
|
|
50
58
|
overlayOpen,
|
|
51
59
|
popOutFocusedPane,
|
|
52
60
|
shareFocusedPane,
|
|
61
|
+
showAdjacentStackTab,
|
|
53
62
|
startWindowMode,
|
|
54
63
|
toggleFocusedPaneFullscreen,
|
|
55
64
|
toggleFocusedPaneFloating,
|
|
@@ -59,13 +68,15 @@ export function useShellPaneManagementShortcuts({
|
|
|
59
68
|
const [shots] = useState(createOneShots);
|
|
60
69
|
const keybindings = useKeybindings();
|
|
61
70
|
|
|
62
|
-
// Esc Esc closes the focused pane and hands the focus to the next floating
|
|
71
|
+
// Esc Esc closes the focused pane and hands the focus to the next floating
|
|
72
|
+
// one; one Esc nothing took closes a floating window.
|
|
63
73
|
useDoubleEscapeClose({
|
|
64
74
|
targetId: focusedPaneId,
|
|
65
75
|
overlayOpen,
|
|
66
76
|
editing: inputCaptured,
|
|
67
77
|
dragging: hasActiveDrag,
|
|
68
|
-
close:
|
|
78
|
+
close: closeFocusedPaneOnEscape,
|
|
79
|
+
closeOnSingle: closeFocusedFloatingPane,
|
|
69
80
|
});
|
|
70
81
|
|
|
71
82
|
useShortcut((event) => {
|
|
@@ -109,6 +120,19 @@ export function useShellPaneManagementShortcuts({
|
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
|
|
123
|
+
// A stack's tabs step like movement keys, a press each and no cooldown,
|
|
124
|
+
// and ahead of the panes: a list that reads PageDown without its
|
|
125
|
+
// modifiers would otherwise take Ctrl+PageDown.
|
|
126
|
+
if ((shortcut === "next-tab" || shortcut === "prev-tab") && !overlayOpen && !hasActiveDrag()) {
|
|
127
|
+
if (!inputCaptured || inputCaptureAllowsPaneManagementShortcut(shortcut, event)) {
|
|
128
|
+
if (showAdjacentStackTab(shortcut === "next-tab" ? 1 : -1)) {
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
event.stopPropagation();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
112
136
|
if ((event.name === "escape" || event.name === "esc") && hasActiveDrag()) {
|
|
113
137
|
cancelActiveDrag();
|
|
114
138
|
event.preventDefault();
|
|
@@ -136,7 +160,7 @@ export function useShellPaneManagementShortcuts({
|
|
|
136
160
|
const shortcut = resolvePaneManagementShortcut(event, keybindings);
|
|
137
161
|
if (!shortcut || hasActiveDrag() || overlayOpen) return;
|
|
138
162
|
if (inputCaptured && !inputCaptureAllowsPaneManagementShortcut(shortcut, event)) return;
|
|
139
|
-
if (shortcut === "menu") return;
|
|
163
|
+
if (shortcut === "menu" || shortcut === "next-tab" || shortcut === "prev-tab") return;
|
|
140
164
|
const shot = shots.get(shortcut);
|
|
141
165
|
if (shot.refuses(event)) {
|
|
142
166
|
event.preventDefault();
|
|
@@ -62,6 +62,46 @@ export function resolveOccludedPaneIds(
|
|
|
62
62
|
return occluded;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Docked panes whose title bar floating windows hide, half of it or more. A
|
|
67
|
+
* focused pane shows its focus there (the frame, the title), so focus moved
|
|
68
|
+
* to one of these could not be seen: Tab passes them by. The bar is judged
|
|
69
|
+
* along its middle line, where the title reads: the terminal's one row (the
|
|
70
|
+
* frame's top line, title in it), the desktop's taller bar whatever line
|
|
71
|
+
* sits over its top (a divider, a window's border). A window over the body,
|
|
72
|
+
* or over no more than the top edge of the bar, hides nothing that says
|
|
73
|
+
* focus.
|
|
74
|
+
*
|
|
75
|
+
* `headerRows` is the bar's height in the layout's units: 1 on the terminal,
|
|
76
|
+
* the chrome row on the desktop (`paneHeaderRows`).
|
|
77
|
+
*/
|
|
78
|
+
export function resolveTitleCoveredPaneIds(
|
|
79
|
+
docked: ReadonlyArray<{ paneId: string; rect: LayoutBounds }>,
|
|
80
|
+
floating: readonly LayoutBounds[],
|
|
81
|
+
{ headerRows = 1 }: { headerRows?: number } = {},
|
|
82
|
+
): Set<string> {
|
|
83
|
+
const covered = new Set<string>();
|
|
84
|
+
if (floating.length === 0) return covered;
|
|
85
|
+
for (const { paneId, rect } of docked) {
|
|
86
|
+
if (rect.width <= 0) continue;
|
|
87
|
+
const titleLine = rect.y + Math.min(headerRows, rect.height) / 2;
|
|
88
|
+
const spans = floating
|
|
89
|
+
.filter((window) => titleLine >= window.y && titleLine < window.y + window.height)
|
|
90
|
+
.map((window) => [Math.max(rect.x, window.x), Math.min(rect.x + rect.width, window.x + window.width)] as const)
|
|
91
|
+
.filter(([start, end]) => end > start)
|
|
92
|
+
.toSorted((left, right) => left[0] - right[0]);
|
|
93
|
+
let hidden = 0;
|
|
94
|
+
let reach = rect.x;
|
|
95
|
+
for (const [start, end] of spans) {
|
|
96
|
+
if (end <= reach) continue;
|
|
97
|
+
hidden += end - Math.max(start, reach);
|
|
98
|
+
reach = end;
|
|
99
|
+
}
|
|
100
|
+
if (hidden * 2 >= rect.width) covered.add(paneId);
|
|
101
|
+
}
|
|
102
|
+
return covered;
|
|
103
|
+
}
|
|
104
|
+
|
|
65
105
|
/**
|
|
66
106
|
* Where focus belongs when the focused pane is hidden under floating panes,
|
|
67
107
|
* as a docked pane is under a window that fills a narrow terminal: the
|
|
@@ -13,6 +13,8 @@ import type { ShortcutDisplayMode } from "../../../utils/shortcut-labels";
|
|
|
13
13
|
|
|
14
14
|
export type PaneManagementShortcut =
|
|
15
15
|
| "menu"
|
|
16
|
+
| "next-tab"
|
|
17
|
+
| "prev-tab"
|
|
16
18
|
| "settings"
|
|
17
19
|
| "toggle-fullscreen"
|
|
18
20
|
| "new-layout"
|
|
@@ -31,6 +33,8 @@ export type PaneManagementShortcut =
|
|
|
31
33
|
|
|
32
34
|
const PANE_ACTION_TO_SHORTCUT: Partial<Record<CoreKeybindingActionId, PaneManagementShortcut>> = {
|
|
33
35
|
"pane-menu": "menu",
|
|
36
|
+
"pane-next-tab": "next-tab",
|
|
37
|
+
"pane-prev-tab": "prev-tab",
|
|
34
38
|
"pane-settings": "settings",
|
|
35
39
|
"pane-fullscreen": "toggle-fullscreen",
|
|
36
40
|
"pane-new-layout": "new-layout",
|
|
@@ -50,7 +54,8 @@ const PANE_ACTION_TO_SHORTCUT: Partial<Record<CoreKeybindingActionId, PaneManage
|
|
|
50
54
|
|
|
51
55
|
export type PaneManagementAccelerators = Record<
|
|
52
56
|
"menu" | "settings" | "fullscreen" | "newLayout" | "toggleFloating" | "popOut" | "copyScreenshot" | "exportCsv" | "share" | "ask" | "close"
|
|
53
|
-
| "closeAllFloating" | "layoutGallery" | "gridlockAll" | "windowMode" | "windowResizeMode" | "tickerSearch"
|
|
57
|
+
| "closeAllFloating" | "layoutGallery" | "gridlockAll" | "windowMode" | "windowResizeMode" | "tickerSearch"
|
|
58
|
+
| "nextTab" | "prevTab",
|
|
54
59
|
string | undefined
|
|
55
60
|
>;
|
|
56
61
|
|
|
@@ -67,6 +72,13 @@ export function paneManagementAccelerators(
|
|
|
67
72
|
const terminalAsk = mode === "terminal" ? advertisedChord(keybindings, "pane-ask", "terminal") : null;
|
|
68
73
|
// The backtick has no modifier, so it is said as the terminal advertises it.
|
|
69
74
|
const tickerSearch = advertisedChord(keybindings, "ticker-search", mode);
|
|
75
|
+
// Stack tabs are on Control in every host; a native menu shows no
|
|
76
|
+
// accelerator it cannot take on the platform modifier.
|
|
77
|
+
const tabChord = (id: "pane-next-tab" | "pane-prev-tab") => {
|
|
78
|
+
if (mode !== "terminal") return menuAcceleratorFor(keybindings, id);
|
|
79
|
+
const chord = advertisedChord(keybindings, id, mode);
|
|
80
|
+
return chord ? serializeKeyChord(chord) : undefined;
|
|
81
|
+
};
|
|
70
82
|
return {
|
|
71
83
|
menu: menuAcceleratorFor(keybindings, "pane-menu"),
|
|
72
84
|
settings: menuAcceleratorFor(keybindings, "pane-settings"),
|
|
@@ -85,6 +97,8 @@ export function paneManagementAccelerators(
|
|
|
85
97
|
windowMode: menuAcceleratorFor(keybindings, "window-move-mode"),
|
|
86
98
|
windowResizeMode: menuAcceleratorFor(keybindings, "window-resize-mode"),
|
|
87
99
|
tickerSearch: tickerSearch ? serializeKeyChord(tickerSearch) : undefined,
|
|
100
|
+
nextTab: tabChord("pane-next-tab"),
|
|
101
|
+
prevTab: tabChord("pane-prev-tab"),
|
|
88
102
|
};
|
|
89
103
|
}
|
|
90
104
|
|
|
@@ -119,6 +133,8 @@ export function inputCaptureAllowsPaneManagementShortcut(
|
|
|
119
133
|
// A screenshot does not edit the field that captured input. Keep it available
|
|
120
134
|
// from composers (ASKG, chat, etc.) on both desktop modifier layouts.
|
|
121
135
|
if (shortcut === "copy-screenshot") return event.ctrl || event.meta || event.super === true;
|
|
136
|
+
// Stepping a stack's tabs edits no field; a chord rebound to a plain key stays the field's.
|
|
137
|
+
if (shortcut === "next-tab" || shortcut === "prev-tab") return event.ctrl || event.meta || event.super === true;
|
|
122
138
|
// Command chords are never text. Alt+A and Ctrl+Shift+A edit a terminal
|
|
123
139
|
// field (line start), so a field that has the keyboard keeps them there.
|
|
124
140
|
if (shortcut === "toggle-fullscreen" || shortcut === "new-layout" || shortcut === "ask") return event.meta || event.super === true;
|
|
@@ -19,7 +19,13 @@ import type {
|
|
|
19
19
|
VisibleFloatingPane,
|
|
20
20
|
} from "./drag/runtime";
|
|
21
21
|
import type { WindowEditState } from "../window-edit/mode";
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
paneHeaderTitleStart,
|
|
24
|
+
stackTabSpans,
|
|
25
|
+
terminalHeaderTitleWidth,
|
|
26
|
+
terminalHeaderTrailingWidth,
|
|
27
|
+
type PaneHeaderQuickSetting,
|
|
28
|
+
} from "../pane/header";
|
|
23
29
|
import { displayWidth } from "../../../utils/format";
|
|
24
30
|
|
|
25
31
|
interface UseShellTerminalPointerRuntimeOptions {
|
|
@@ -43,6 +49,8 @@ interface UseShellTerminalPointerRuntimeOptions {
|
|
|
43
49
|
/** The header's `?`: the pane's entry in DOCS. */
|
|
44
50
|
openPaneDocs: (paneId: string) => void;
|
|
45
51
|
getPaneTitle: (pane: ResolvedPane) => string;
|
|
52
|
+
/** A pane's quick settings, which take room from a stack's tabs in its header. */
|
|
53
|
+
getPaneQuickSettings: (paneId: string) => ReadonlyArray<Pick<PaneHeaderQuickSetting, "icon">>;
|
|
46
54
|
paneMap: Map<string, ResolvedPane>;
|
|
47
55
|
selectWindowModePane: (paneId: string) => void;
|
|
48
56
|
setHoveredMenuItemId: Dispatch<SetStateAction<string | null>>;
|
|
@@ -67,19 +75,29 @@ function getVisibleFloatingRect(
|
|
|
67
75
|
: visibleRect;
|
|
68
76
|
}
|
|
69
77
|
|
|
70
|
-
/**
|
|
78
|
+
/**
|
|
79
|
+
* The tab of a stack whose title is `x` cells into its header's title, laid
|
|
80
|
+
* out as the header lays it out (`stackTabSpans`) in a header `width` wide
|
|
81
|
+
* that shows `shown`.
|
|
82
|
+
*/
|
|
71
83
|
function stackTabAt(
|
|
72
84
|
stack: readonly string[],
|
|
85
|
+
shown: string,
|
|
73
86
|
x: number,
|
|
87
|
+
header: { width: number; framed: boolean; corner: boolean },
|
|
74
88
|
paneMap: Map<string, ResolvedPane>,
|
|
75
89
|
getPaneTitle: (pane: ResolvedPane) => string,
|
|
90
|
+
getPaneQuickSettings: (paneId: string) => ReadonlyArray<Pick<PaneHeaderQuickSetting, "icon">>,
|
|
76
91
|
): string | null {
|
|
77
92
|
const titles = stack.map((id) => {
|
|
78
93
|
const pane = paneMap.get(id);
|
|
79
94
|
return pane ? getPaneTitle(pane) : id;
|
|
80
95
|
});
|
|
81
|
-
const
|
|
82
|
-
|
|
96
|
+
const trailing = terminalHeaderTrailingWidth(getPaneQuickSettings(shown), paneMap.get(shown)?.instance.locked === true, true);
|
|
97
|
+
const titleWidth = terminalHeaderTitleWidth(header.width, { framed: header.framed, corner: header.corner, trailing });
|
|
98
|
+
const span = stackTabSpans(titles, stack.indexOf(shown), titleWidth)
|
|
99
|
+
.find((candidate) => x >= candidate.start && x < candidate.start + displayWidth(candidate.text));
|
|
100
|
+
return span ? stack[span.index]! : null;
|
|
83
101
|
}
|
|
84
102
|
|
|
85
103
|
function sortedFloatingPanes(visibleFloatingPanes: VisibleFloatingPane[]): VisibleFloatingPane[] {
|
|
@@ -102,6 +120,7 @@ export function useShellTerminalPointerRuntime({
|
|
|
102
120
|
openPaneMenu,
|
|
103
121
|
openPaneDocs,
|
|
104
122
|
getPaneTitle,
|
|
123
|
+
getPaneQuickSettings,
|
|
105
124
|
paneMap,
|
|
106
125
|
selectWindowModePane,
|
|
107
126
|
setHoveredMenuItemId,
|
|
@@ -269,7 +288,13 @@ export function useShellTerminalPointerRuntime({
|
|
|
269
288
|
// A press on a tab of a floating stack pulls that tab out; the rest
|
|
270
289
|
// of the bar moves the stack. A floating title bar is always framed.
|
|
271
290
|
const stack = floatingStacks(visibleFloatingPanes.map((entry) => entry.pane.floating!), floatingOrder).get(paneId);
|
|
272
|
-
const tabId = stack
|
|
291
|
+
const tabId = stack
|
|
292
|
+
? stackTabAt(stack, paneId, relativeX - paneHeaderTitleStart(true), {
|
|
293
|
+
width: rect.width,
|
|
294
|
+
framed: true,
|
|
295
|
+
corner: true,
|
|
296
|
+
}, paneMap, getPaneTitle, getPaneQuickSettings)
|
|
297
|
+
: null;
|
|
273
298
|
startDrag({
|
|
274
299
|
type: "pane-drag",
|
|
275
300
|
paneId: tabId ?? paneId,
|
|
@@ -360,7 +385,14 @@ export function useShellTerminalPointerRuntime({
|
|
|
360
385
|
if (relativeY === 0) {
|
|
361
386
|
// A press on one of a stack's tabs moves that pane; the release
|
|
362
387
|
// shows it if the pointer did not move.
|
|
363
|
-
const
|
|
388
|
+
const framed = isFocused || transientFocusActive;
|
|
389
|
+
const tabId = leaf.stack
|
|
390
|
+
? stackTabAt(leaf.stack, leaf.instanceId, relativeX - paneHeaderTitleStart(framed), {
|
|
391
|
+
width: leaf.rect.width,
|
|
392
|
+
framed,
|
|
393
|
+
corner: transientFocusActive,
|
|
394
|
+
}, paneMap, getPaneTitle, getPaneQuickSettings)
|
|
395
|
+
: null;
|
|
364
396
|
startDrag({
|
|
365
397
|
type: "pane-drag",
|
|
366
398
|
paneId: tabId ?? leaf.instanceId,
|
|
@@ -389,6 +421,7 @@ export function useShellTerminalPointerRuntime({
|
|
|
389
421
|
focusPane,
|
|
390
422
|
floatingOrder,
|
|
391
423
|
focusedPaneId,
|
|
424
|
+
getPaneQuickSettings,
|
|
392
425
|
getPaneTitle,
|
|
393
426
|
handleActiveDrag,
|
|
394
427
|
handleFloatingClose,
|
|
@@ -126,26 +126,15 @@ export function useShellWindowMode({
|
|
|
126
126
|
setWindowMode(null);
|
|
127
127
|
}, []);
|
|
128
128
|
|
|
129
|
+
// Enter applies what the mode changed and leaves it, as Enter does in a
|
|
130
|
+
// dialog; Esc leaves it with nothing changed.
|
|
129
131
|
const commitWindowMode = useCallback(() => {
|
|
130
132
|
if (!windowMode) return;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if (!hasPendingCommit) {
|
|
134
|
-
focusPane(windowMode.paneId);
|
|
135
|
-
setWindowMode(null);
|
|
136
|
-
return;
|
|
133
|
+
if (windowEditHasPendingCommit(windowMode, bounds, dockGeometryOptions)) {
|
|
134
|
+
persistLayout(resolveWindowEditCommitLayout(windowMode, bounds, dockGeometryOptions));
|
|
137
135
|
}
|
|
138
|
-
|
|
139
|
-
persistLayout(committedLayout);
|
|
140
136
|
focusPane(windowMode.paneId);
|
|
141
|
-
setWindowMode(
|
|
142
|
-
paneId: windowMode.paneId,
|
|
143
|
-
previewLayout: committedLayout,
|
|
144
|
-
mode: "move",
|
|
145
|
-
focus: normalizeWindowEditFocus({ kind: "move" }, committedLayout, windowMode.paneId, "move", bounds, dockGeometryOptions),
|
|
146
|
-
dirty: false,
|
|
147
|
-
notice: "Committed",
|
|
148
|
-
});
|
|
137
|
+
setWindowMode(null);
|
|
149
138
|
}, [bounds, dockGeometryOptions, focusPane, persistLayout, windowMode]);
|
|
150
139
|
|
|
151
140
|
const updateWindowModePreviewLayout = useCallback((nextLayout: LayoutConfig, paneId?: string) => {
|
|
@@ -129,7 +129,9 @@ export function ShellWindowModeOverlays({
|
|
|
129
129
|
/>
|
|
130
130
|
))}
|
|
131
131
|
|
|
132
|
-
{
|
|
132
|
+
{/* Outside window mode a floating pane draws its own sides, in the focus colour when focused (floating-pane.tsx). */}
|
|
133
|
+
{highlightedPaneId && !nativePaneChrome && highlightedRect && highlightedRect.height >= 2 && (!overlayOpen || menuOpen)
|
|
134
|
+
&& (windowMode || !highlightedFloatingPane) && (() => {
|
|
133
135
|
const selectedInWindowMode = !!windowMode;
|
|
134
136
|
const borderColor = selectedInWindowMode ? colors.borderFocused : colors.border;
|
|
135
137
|
const bodyTop = highlightedRect.y + 1;
|
|
@@ -88,13 +88,19 @@ export interface MarketBoardStackProps<T extends MarketBoardRow> {
|
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* What a board gives up, in order, when the pane is too narrow for it: the
|
|
91
|
-
* second label, the sparkline, the as-of year, then the change date
|
|
92
|
-
* percentile
|
|
93
|
-
* before the data columns.
|
|
91
|
+
* second label, the sparkline, the as-of year, then the change date, the
|
|
92
|
+
* percentile, the pane's own extra columns and the change. Shortening dates
|
|
93
|
+
* costs less than losing a column, so it comes before the data columns. The
|
|
94
|
+
* value and its date are never given up: a narrow board read as names alone
|
|
95
|
+
* (SOVR without its 5Y) or without the date of its figures (CBR without AS OF).
|
|
94
96
|
*/
|
|
95
|
-
const FIT_STEPS = ["labelDetail", "history", "shortAsOf", "changeAsOf", "percentile"] as const;
|
|
97
|
+
const FIT_STEPS = ["labelDetail", "history", "shortAsOf", "changeAsOf", "percentile", "extra", "change"] as const;
|
|
96
98
|
/** The narrowest the name column gives way to in a board too narrow for every column. */
|
|
97
99
|
const MIN_GROW_WIDTH = 10;
|
|
100
|
+
/** Narrower still, once only the name, the value and its date are left, so those two stay whole. */
|
|
101
|
+
const MIN_LABEL_WIDTH = 6;
|
|
102
|
+
/** The columns a board always has; any other is a pane's extra one. */
|
|
103
|
+
const BOARD_COLUMN_IDS = new Set(["label", "labelDetail", "value", "change", "changeAsOf", "percentile", "history", "asOf"]);
|
|
98
104
|
/** An as-of date without its year ("09-17"). */
|
|
99
105
|
const SHORT_AS_OF_WIDTH = 5;
|
|
100
106
|
/** The word a stale or partial row's date carries, with its space: "2026-09-17 stale", "2026-10-19 so far". */
|
|
@@ -116,6 +122,8 @@ function fitBoardColumns(candidates: DataTableColumn[], width: number, wordWidth
|
|
|
116
122
|
if (step === "shortAsOf") {
|
|
117
123
|
shortAsOf = true;
|
|
118
124
|
columns = withAsOfWidth(columns, SHORT_AS_OF_WIDTH + wordWidth);
|
|
125
|
+
} else if (step === "extra") {
|
|
126
|
+
columns = columns.filter((column) => BOARD_COLUMN_IDS.has(column.id));
|
|
119
127
|
} else {
|
|
120
128
|
columns = columns.filter((column) => column.id !== step);
|
|
121
129
|
}
|
|
@@ -130,9 +138,10 @@ function fitBoardColumns(candidates: DataTableColumn[], width: number, wordWidth
|
|
|
130
138
|
// that gives way when the board is still too wide, so the date and its word are never cut.
|
|
131
139
|
const growId = columns.some((column) => column.id === "labelDetail") ? "labelDetail" : "label";
|
|
132
140
|
const excess = Math.max(0, getTableWidth(columns) - width);
|
|
141
|
+
const floor = columns.length <= 3 ? MIN_LABEL_WIDTH : MIN_GROW_WIDTH;
|
|
133
142
|
return {
|
|
134
143
|
columns: columns.map((column) => column.id === growId
|
|
135
|
-
? { ...column, width: Math.max(
|
|
144
|
+
? { ...column, width: Math.max(Math.min(floor, column.width), column.width - excess), flexGrow: 1 } : column),
|
|
136
145
|
shortAsOf,
|
|
137
146
|
};
|
|
138
147
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback, useMemo, useRef, useState, type CSSProperties } from "react";
|
|
2
2
|
import { Box, Text, TextAttributes, useUiCapabilities } from "../../ui";
|
|
3
3
|
import { blendHex, colors, priceColor } from "../../theme/colors";
|
|
4
|
+
import { useSelectionFill } from "../ui/selection-fill";
|
|
4
5
|
import { blendForContrast, higherContrast } from "../../theme/color-utils";
|
|
5
6
|
import { t } from "../../i18n";
|
|
6
7
|
import { padTo } from "../../utils/format";
|
|
@@ -98,7 +99,8 @@ function Tile<T>({ tile, selected, onSelect, onActivate, pointerMoved }: {
|
|
|
98
99
|
const renderWidth = Math.max(1, tile.width - (tile.width > 2 ? 1 : 0));
|
|
99
100
|
const renderHeight = Math.max(1, tile.height - (tile.height > 2 ? 1 : 0));
|
|
100
101
|
const innerWidth = Math.max(1, renderWidth - 1);
|
|
101
|
-
const
|
|
102
|
+
const selectionFill = useSelectionFill();
|
|
103
|
+
const backgroundColor = selected ? selectionFill.bg : metricTileColor(tile.item);
|
|
102
104
|
const textColor = tileTextColor(backgroundColor);
|
|
103
105
|
const attributes = selected ? TextAttributes.BOLD : TextAttributes.NONE;
|
|
104
106
|
const lines = visibleLines(tile.item);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Box, Text, useUiHost } from "../../ui";
|
|
1
|
+
import { Box, Span, Text, useUiHost } from "../../ui";
|
|
2
2
|
import { TextAttributes } from "../../ui";
|
|
3
|
-
import { type ComponentType, type ReactNode } from "react";
|
|
3
|
+
import { Children, cloneElement, isValidElement, type ComponentType, type ReactNode } from "react";
|
|
4
4
|
import type { ThemeColors } from "../../theme/colors";
|
|
5
5
|
import { useThemeColors } from "../../theme/theme-context";
|
|
6
6
|
import { t } from "../../i18n";
|
|
@@ -70,6 +70,18 @@ export function buttonShortcutColor(palette: { bg?: string; fg: string }, inert:
|
|
|
70
70
|
return inert ? colors.textMuted : colors.textDim;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/** Primary and danger are filled with their own colour, which focus keeps. */
|
|
74
|
+
function isFilledVariant(variant: ButtonVariant): boolean {
|
|
75
|
+
return variant === "primary" || variant === "danger";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* A terminal button's colours. Focus (`active`) fills a secondary or ghost
|
|
80
|
+
* button with the selection; a filled one keeps its fill, which is already
|
|
81
|
+
* stronger than the selection, and marks focus on its label instead
|
|
82
|
+
* (`buttonLabelAttributes`), so a focused primary never reads weaker than an
|
|
83
|
+
* unfocused one.
|
|
84
|
+
*/
|
|
73
85
|
export function resolveButtonColors(variant: ButtonVariant, active: boolean, disabled: boolean, colors: ThemeColors, tone?: ButtonProps["tone"]): { bg?: string; fg: string } {
|
|
74
86
|
if (variant === "quiet") return { bg: active ? colors.selected : undefined, fg: disabled ? colors.textMuted : active ? colors.textBright : colors.textDim };
|
|
75
87
|
if (variant === "plain") {
|
|
@@ -79,7 +91,7 @@ export function resolveButtonColors(variant: ButtonVariant, active: boolean, dis
|
|
|
79
91
|
return { bg: colors.panel, fg: colors.textMuted };
|
|
80
92
|
}
|
|
81
93
|
if (tone && variant === "primary") return { bg: colors[tone], fg: colors.bg };
|
|
82
|
-
if (active) {
|
|
94
|
+
if (active && !isFilledVariant(variant)) {
|
|
83
95
|
return { bg: colors.selected, fg: colors.selectedText };
|
|
84
96
|
}
|
|
85
97
|
|
|
@@ -96,6 +108,35 @@ export function resolveButtonColors(variant: ButtonVariant, active: boolean, dis
|
|
|
96
108
|
}
|
|
97
109
|
}
|
|
98
110
|
|
|
111
|
+
/**
|
|
112
|
+
* A terminal button's label: bold when focused, and underlined too on a
|
|
113
|
+
* filled button, whose fill does not change with focus.
|
|
114
|
+
*/
|
|
115
|
+
export function buttonLabelAttributes(variant: ButtonVariant, active: boolean, inert: boolean): number {
|
|
116
|
+
if (!active) return 0;
|
|
117
|
+
return TextAttributes.BOLD | (isFilledVariant(variant) && !inert ? TextAttributes.UNDERLINE : 0);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A terminal button's own content (`children`) as it draws focused: the text
|
|
122
|
+
* in it marked as a label is (`buttonLabelAttributes`), so a focused filled
|
|
123
|
+
* button drawn from children reads stronger than an unfocused one too. Text
|
|
124
|
+
* a component of the caller's draws is its own to mark.
|
|
125
|
+
*/
|
|
126
|
+
export function markButtonContent(children: ReactNode, attributes: number): ReactNode {
|
|
127
|
+
if (!attributes) return children;
|
|
128
|
+
return Children.map(children, (child): ReactNode => {
|
|
129
|
+
if (!isValidElement<{ attributes?: number; children?: ReactNode }>(child)) return child;
|
|
130
|
+
if (child.type === Text || child.type === Span) {
|
|
131
|
+
return cloneElement(child, { attributes: (child.props.attributes ?? 0) | attributes });
|
|
132
|
+
}
|
|
133
|
+
if (typeof child.type === "string" || child.type === Box) {
|
|
134
|
+
return child.props.children === undefined ? child : cloneElement(child, undefined, markButtonContent(child.props.children, attributes));
|
|
135
|
+
}
|
|
136
|
+
return child;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
99
140
|
/**
|
|
100
141
|
* Terminal cells a button takes: the padded label, then its key. For a row that
|
|
101
142
|
* has to know whether its buttons fit before it lays them out.
|
|
@@ -189,7 +230,10 @@ export function Button({
|
|
|
189
230
|
if (!inert) onPress?.();
|
|
190
231
|
}}
|
|
191
232
|
>
|
|
192
|
-
{children
|
|
233
|
+
{children != null
|
|
234
|
+
// A filled button's fill does not change with focus: its content carries the mark a label would.
|
|
235
|
+
? isFilledVariant(variant) ? markButtonContent(children, buttonLabelAttributes(variant, active, inert)) : children
|
|
236
|
+
: <Text fg={palette.fg} attributes={buttonLabelAttributes(variant, active, inert)}>
|
|
193
237
|
{compact ? displayLabel ?? label : ` ${displayLabel ?? label} `}
|
|
194
238
|
</Text>}
|
|
195
239
|
{shortcut && (
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { Box, ScrollBox, Span, Text, TextAttributes, useNativeRenderer, type BoxRenderable } from "../../../../ui";
|
|
3
3
|
import { capturePointerDrag, releasePointerDrag } from "../../../../ui/pointer-drag";
|
|
4
|
-
import { hoverBg } from "../../../../theme/colors";
|
|
4
|
+
import { hoverBg, inactiveSelectedText } from "../../../../theme/colors";
|
|
5
5
|
import { selectedRowCellColor } from "../../../../theme/tone-contrast";
|
|
6
6
|
import { useThemeColors } from "../../../../theme/theme-context";
|
|
7
7
|
import { usePaneInstance } from "../../../../state/app/context";
|
|
8
|
+
import { useSelectionFill } from "../../selection-fill";
|
|
8
9
|
import { useShortcut, useViewport } from "../../../../react/input";
|
|
9
10
|
import { measurePerf } from "../../../../utils/perf-marks";
|
|
10
11
|
import { displayWidth } from "../../../../utils/format";
|
|
@@ -120,6 +121,8 @@ function OpenTuiDataTableRowInner<
|
|
|
120
121
|
rowContextMenuSurface,
|
|
121
122
|
sectionWidth,
|
|
122
123
|
selected,
|
|
124
|
+
selectionBg,
|
|
125
|
+
selectionLit: paneSelectionLit,
|
|
123
126
|
selectedTextOverridesCellColor,
|
|
124
127
|
columnClips,
|
|
125
128
|
cellWidths,
|
|
@@ -162,15 +165,23 @@ function OpenTuiDataTableRowInner<
|
|
|
162
165
|
renderSectionHeader?: DataTableProps<T, C>["renderSectionHeader"];
|
|
163
166
|
rowContextMenuSurface: boolean;
|
|
164
167
|
selected: boolean;
|
|
168
|
+
/** The selected row's fill (`useSelectionFill`): quieter, in the row's own text colours, when the pane is not focused. */
|
|
169
|
+
selectionBg: string;
|
|
170
|
+
selectionLit: boolean;
|
|
165
171
|
selectedTextOverridesCellColor: boolean;
|
|
166
172
|
/** How the viewport cuts each column, null when every column shows whole (resolveDataTableColumnClips). */
|
|
167
173
|
columnClips: readonly (DataTableColumnClip | null)[] | null;
|
|
168
174
|
}) {
|
|
169
175
|
const sectionHeader = renderSectionHeader?.(item, index) ?? null;
|
|
176
|
+
const selectionLit = selected && paneSelectionLit;
|
|
177
|
+
// On the quieter fill a row keeps its own colours, each lifted only where it would not read there.
|
|
178
|
+
const ink = (color: string) => (selected && !selectionLit ? inactiveSelectedText(color, colors) : color);
|
|
170
179
|
|
|
171
180
|
if (sectionHeader) {
|
|
172
181
|
// A header the cursor can land on (a collapsible group) shows it like a row.
|
|
173
|
-
const headerColor =
|
|
182
|
+
const headerColor = selectionLit
|
|
183
|
+
? sectionHeader.color ?? colors.selectedText
|
|
184
|
+
: ink(sectionHeader.color ?? colors.textBright);
|
|
174
185
|
const action = sectionHeader.action;
|
|
175
186
|
return (
|
|
176
187
|
<Box
|
|
@@ -180,7 +191,7 @@ function OpenTuiDataTableRowInner<
|
|
|
180
191
|
// Beside a pinned first column the heading stays in view too, not cut to its last letters.
|
|
181
192
|
paddingLeft={horizontalPadding + (frozenColumnOffset ?? 0)}
|
|
182
193
|
paddingRight={horizontalPadding}
|
|
183
|
-
backgroundColor={selected ?
|
|
194
|
+
backgroundColor={selected ? selectionBg : sectionHeader.backgroundColor ?? colors.bg}
|
|
184
195
|
onMouseDown={(event: any) => {
|
|
185
196
|
focusPane();
|
|
186
197
|
onTableMouseDown?.(event);
|
|
@@ -211,7 +222,7 @@ function OpenTuiDataTableRowInner<
|
|
|
211
222
|
action.onPress();
|
|
212
223
|
}}
|
|
213
224
|
>
|
|
214
|
-
<Text fg={
|
|
225
|
+
<Text fg={selectionLit ? colors.selectedText : ink(colors.text)}>{action.label}</Text>
|
|
215
226
|
</Box>
|
|
216
227
|
</Box>
|
|
217
228
|
) : (
|
|
@@ -226,11 +237,11 @@ function OpenTuiDataTableRowInner<
|
|
|
226
237
|
);
|
|
227
238
|
}
|
|
228
239
|
|
|
229
|
-
const rowState = { selected };
|
|
240
|
+
const rowState = { selected, inactive: selected && !selectionLit };
|
|
230
241
|
const widths: (number | null)[] = [];
|
|
231
242
|
cellWidths.set(itemKey, { columnsKey, widths });
|
|
232
243
|
const rowBackgroundColor = getRowBackgroundColor?.(item, index, rowState);
|
|
233
|
-
const rowBg = selected ?
|
|
244
|
+
const rowBg = selected ? selectionBg : rowBackgroundColor ?? colors.bg;
|
|
234
245
|
const rowHoverBg = selected ? undefined : hoverBg(colors);
|
|
235
246
|
|
|
236
247
|
return (
|
|
@@ -306,13 +317,14 @@ function OpenTuiDataTableRowInner<
|
|
|
306
317
|
)) : (
|
|
307
318
|
<Text
|
|
308
319
|
attributes={cell.attributes ?? TextAttributes.NONE}
|
|
309
|
-
fg={
|
|
320
|
+
fg={selectionLit
|
|
310
321
|
? selectedRowCellColor(cell.color, !!selectedTextOverridesCellColor, cell.keepColorWhenSelected, colors) ?? colors.selectedText
|
|
311
|
-
|
|
322
|
+
// A cell on a fill of its own keeps the colour it chose for it.
|
|
323
|
+
: cell.backgroundColor && cell.backgroundColor !== selectionBg ? cell.color ?? colors.text : ink(cell.color ?? colors.text)}
|
|
312
324
|
>
|
|
313
325
|
{fitted.note ? <>
|
|
314
326
|
{`${frozen ? " ".repeat(horizontalPadding) : ""}${" ".repeat(inset)}${fitted.text}`}
|
|
315
|
-
<Span fg={colors.textDim} attributes={TextAttributes.NONE}>{fitted.note}</Span>
|
|
327
|
+
<Span fg={ink(colors.textDim)} attributes={TextAttributes.NONE}>{fitted.note}</Span>
|
|
316
328
|
{`${fitted.padding ?? ""}${frozen ? " ".repeat(columnGap) : ""}`}
|
|
317
329
|
</> : `${frozen ? " ".repeat(horizontalPadding) : ""}${" ".repeat(inset)}${fitted.text}${frozen ? " ".repeat(columnGap) : ""}`}
|
|
318
330
|
</Text>
|
|
@@ -376,6 +388,7 @@ export function OpenTuiDataTable<T, C extends DataTableColumn = DataTableColumn>
|
|
|
376
388
|
const colors = useThemeColors();
|
|
377
389
|
const focusPane = useFocusOwningPane();
|
|
378
390
|
const paneInstanceId = usePaneInstance()?.instanceId ?? null;
|
|
391
|
+
const selectionFill = useSelectionFill();
|
|
379
392
|
const appViewport = useViewport();
|
|
380
393
|
const nativeRenderer = useNativeRenderer();
|
|
381
394
|
const [scrollVersion, setScrollVersion] = useState(0);
|
|
@@ -1028,6 +1041,8 @@ export function OpenTuiDataTable<T, C extends DataTableColumn = DataTableColumn>
|
|
|
1028
1041
|
rowVersion={getRowVersion?.(item, index)}
|
|
1029
1042
|
sectionWidth={sectionWidth}
|
|
1030
1043
|
selected={isSelected(item, index)}
|
|
1044
|
+
selectionBg={selectionFill.bg}
|
|
1045
|
+
selectionLit={selectionFill.lit}
|
|
1031
1046
|
selectedTextOverridesCellColor={selectedTextOverridesCellColor}
|
|
1032
1047
|
columnClips={columnClips}
|
|
1033
1048
|
cellWidths={rowCellWidths}
|
|
@@ -140,6 +140,13 @@ export type DataTableScrollAlign = "nearest" | "center" | "start";
|
|
|
140
140
|
|
|
141
141
|
interface DataTableRowState {
|
|
142
142
|
selected: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Terminal: the selected row's pane does not have the keys, so the row sits
|
|
145
|
+
* on the quieter fill (`inactiveSelectedBg`) in its own colours. A colour a
|
|
146
|
+
* cell picks for the selection is picked for that fill
|
|
147
|
+
* (`inactiveSelectedText`).
|
|
148
|
+
*/
|
|
149
|
+
inactive?: boolean;
|
|
143
150
|
}
|
|
144
151
|
|
|
145
152
|
export interface DataTableVisibleRange {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo, type ReactNode, type RefObject } from "react";
|
|
1
|
+
import { useEffect, useMemo, type ReactNode, type RefObject } from "react";
|
|
2
2
|
import { Box, Input, Text, useUiCapabilities, type InputRenderable } from "../../ui";
|
|
3
3
|
import { colors, placeholderText } from "../../theme/colors";
|
|
4
4
|
import { Icon } from "./icon";
|
|
@@ -25,6 +25,12 @@ export interface InlineQuickAddRowProps {
|
|
|
25
25
|
joinPastedLines?: PastedLines;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/** The terminal field's scrolled window over its text; a DOM input has none. */
|
|
29
|
+
interface FieldView {
|
|
30
|
+
getViewport?(): { offsetX: number; offsetY: number; width: number; height: number };
|
|
31
|
+
setViewport?(x: number, y: number, width: number, height: number): void;
|
|
32
|
+
}
|
|
33
|
+
|
|
28
34
|
/** Shared one-row composer used by pane-native inline add flows. */
|
|
29
35
|
export function InlineQuickAddRow({
|
|
30
36
|
value,
|
|
@@ -51,11 +57,21 @@ export function InlineQuickAddRow({
|
|
|
51
57
|
// A typed query hugs its preview unless the caller asked for a wider field.
|
|
52
58
|
// The cursor and the next keystroke both need a cell: a key lands before
|
|
53
59
|
// the field widens, and with one cell to spare the input scrolled its
|
|
54
|
-
// first character out of view (OMV.VI read "MV.VI").
|
|
55
|
-
|
|
60
|
+
// first character out of view (OMV.VI read "MV.VI"). The terminal field
|
|
61
|
+
// also keeps a fifth of its width clear after the cursor, so a longer
|
|
62
|
+
// symbol needs that much more (USDTRY=X read "SDTRY=X").
|
|
63
|
+
return Math.max(minInputWidth ?? 4, Math.min(maxInputWidth, queryWidth + 2 + Math.floor(queryWidth / 4)));
|
|
56
64
|
}
|
|
57
65
|
return Math.max(minInputWidth ?? 6, Math.min(10, Math.floor(width * 0.18)));
|
|
58
66
|
}, [maxInputWidth, minInputWidth, value, width]);
|
|
67
|
+
// A field that ran out of room scrolls its text, and keeps that scroll once the text fits again: keys typed
|
|
68
|
+
// faster than the field widens left USDTRY=X reading "SDTRY=X". Text that fits shows from its first character.
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const view = (inputRef.current as { editorView?: FieldView } | null)?.editorView;
|
|
71
|
+
const viewport = view?.getViewport?.();
|
|
72
|
+
if (!viewport || viewport.offsetX === 0 || [...value].length >= inputWidth) return;
|
|
73
|
+
view?.setViewport?.(0, viewport.offsetY, inputWidth, viewport.height);
|
|
74
|
+
}, [inputRef, inputWidth, value]);
|
|
59
75
|
const hasPreview = preview !== undefined && preview !== null;
|
|
60
76
|
const previewWidth = Math.max(4, width - inputWidth - 5);
|
|
61
77
|
const { nativePaneChrome } = useUiCapabilities();
|