gloomberb 0.20.4 → 0.20.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/README.md +2 -0
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +3 -1
- package/src/api-client/data.ts +138 -35
- package/src/api-client/types/econ.ts +12 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +6 -0
- package/src/app/keybindings/config.ts +2 -1
- package/src/app/keybindings/index.ts +1 -0
- package/src/app/keybindings/labels.ts +6 -1
- package/src/app/keybindings/resolve.ts +23 -4
- package/src/app/keybindings/terminal-keys.ts +35 -0
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +68 -40
- package/src/architecture/ui-literals-allowlist.json +1 -1
- package/src/capabilities/chart-series.ts +27 -1
- package/src/cli/commands/keybindings.ts +5 -5
- package/src/cli/commands/market.ts +78 -21
- package/src/cli/commands/news-search.ts +59 -7
- package/src/cli/commands/overview.ts +16 -1
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +1 -1
- package/src/cli/fx-forward.ts +25 -7
- package/src/cli/glossary.ts +19 -5
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/known-gaps.ts +27 -1
- package/src/cli/listing-arg.ts +11 -1
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/function-help.ts +2 -2
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/status-bar.tsx +6 -1
- package/src/components/onboarding/first-run-workspace.ts +44 -2
- package/src/components/onboarding/onboarding-frame.tsx +11 -2
- package/src/components/onboarding/onboarding-keyboard.ts +16 -0
- package/src/components/onboarding/onboarding-wizard.tsx +8 -8
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
- package/src/components/onboarding/use-onboarding-progress.ts +12 -4
- package/src/components/pane-settings-dialog/desktop.tsx +2 -2
- package/src/components/pane-settings-dialog/tui.tsx +2 -2
- package/src/components/pane-settings-dialog/value.ts +6 -0
- package/src/components/pane-settings-dialog.tsx +3 -3
- package/src/components/reader/detail-reader.tsx +4 -0
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/page-stack-view.tsx +3 -0
- package/src/components/ui/pane-link-chip.tsx +269 -54
- package/src/components/ui/query-bar.tsx +2 -1
- package/src/components/ui/tabs.tsx +97 -19
- package/src/core/state/app/layout-reducer.ts +7 -0
- package/src/core/state/app/layout.ts +44 -7
- package/src/core/state/app/state.ts +1 -1
- package/src/core/state/app/types.ts +22 -2
- package/src/docs/snapshot.json +27 -10
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/market/dated-previous-close.ts +94 -15
- package/src/market-data/market/status.ts +17 -1
- package/src/plugins/builtin/analytics/risk-client.ts +10 -4
- package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
- package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
- package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
- package/src/plugins/builtin/awards/index.tsx +1 -1
- package/src/plugins/builtin/buildout/index.tsx +1 -0
- package/src/plugins/builtin/catalysts/index.tsx +2 -2
- package/src/plugins/builtin/cds/headless.ts +4 -0
- package/src/plugins/builtin/chart-composer/headless.ts +2 -1
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chat/content/composer.tsx +5 -4
- package/src/plugins/builtin/chat/content/index.tsx +12 -2
- package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
- package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
- package/src/plugins/builtin/chat/layout.ts +5 -2
- package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
- package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +5 -3
- package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
- package/src/plugins/builtin/company-attention/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +3 -1
- package/src/plugins/builtin/company-kpis/index.tsx +2 -2
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/crypto-board/index.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
- package/src/plugins/builtin/doe/index.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +74 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
- package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
- package/src/plugins/builtin/executives/index.tsx +1 -0
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fixed-income/index.tsx +1 -0
- package/src/plugins/builtin/futures-curve/headless.ts +3 -3
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +18 -0
- package/src/plugins/builtin/gpu/index.tsx +1 -1
- package/src/plugins/builtin/help/functions-table.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +11 -1
- package/src/plugins/builtin/help/keybindings-editor.tsx +1 -1
- package/src/plugins/builtin/holders/index.tsx +1 -0
- package/src/plugins/builtin/holders/report-header.ts +2 -2
- package/src/plugins/builtin/insider/index.tsx +1 -0
- package/src/plugins/builtin/iv-history/index.tsx +1 -1
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +19 -3
- package/src/plugins/builtin/macro-day/pane.tsx +14 -9
- package/src/plugins/builtin/macro-day/releases.ts +25 -7
- package/src/plugins/builtin/market-valuation/index.tsx +1 -0
- package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
- package/src/plugins/builtin/members/index.tsx +1 -1
- package/src/plugins/builtin/mna/index.tsx +1 -0
- package/src/plugins/builtin/news/index.tsx +1 -0
- package/src/plugins/builtin/news/wire/index.tsx +5 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options-positioning/index.tsx +1 -0
- package/src/plugins/builtin/pe-band/index.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/headless.ts +10 -4
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research-search/index.tsx +1 -0
- package/src/plugins/builtin/research-search/pane.tsx +8 -0
- package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/scanner/headless.ts +52 -13
- package/src/plugins/builtin/seasonality/index.tsx +1 -1
- package/src/plugins/builtin/sec/index.tsx +1 -0
- package/src/plugins/builtin/series-inventory.ts +1 -1
- package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
- package/src/plugins/builtin/short-interest/index.tsx +1 -0
- package/src/plugins/builtin/social-mentions/index.tsx +1 -1
- package/src/plugins/builtin/supply-chain/index.tsx +1 -0
- package/src/plugins/builtin/thirteenf/data.ts +43 -10
- package/src/plugins/builtin/thirteenf/headless.ts +55 -11
- package/src/plugins/builtin/thirteenf/model.ts +25 -9
- package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
- package/src/plugins/builtin/thirteenf/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/financials/model.ts +12 -0
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +5 -5
- package/src/plugins/builtin/ticker-detail/headless.ts +18 -13
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +6 -4
- package/src/plugins/builtin/time-sales/client.ts +9 -11
- package/src/plugins/builtin/time-sales/index.tsx +1 -1
- package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +18 -3
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +109 -19
- package/src/plugins/builtin/treasury-auctions/index.tsx +14 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +256 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +139 -28
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
- package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
- package/src/plugins/builtin/vol-surface/index.tsx +1 -1
- package/src/plugins/builtin/world-venue-map/index.ts +1 -0
- package/src/plugins/builtin/yield-curve/curves.ts +10 -4
- package/src/plugins/builtin/yield-curve/headless.ts +6 -2
- package/src/plugins/builtin/yield-curve/index.tsx +3 -3
- package/src/plugins/builtin/yield-curve/series.ts +10 -0
- package/src/plugins/builtin/yield-curve/world.ts +3 -1
- package/src/portfolio/column-values.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
- package/src/public/remote.ts +7 -1
- package/src/remote/client.ts +191 -11
- package/src/remote/controller-utils.ts +13 -1
- package/src/remote/controller.ts +88 -26
- package/src/remote/endpoint.ts +24 -0
- package/src/remote/form.ts +59 -4
- package/src/remote/resources.ts +44 -18
- package/src/remote/schema.ts +21 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-tree.tsx +14 -2
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/opentui/host.tsx +6 -0
- package/src/series/standalone.ts +2 -2
- package/src/shares/api.ts +21 -4
- package/src/shares/item.ts +73 -0
- package/src/shares/pane-item.ts +205 -0
- package/src/shares/pane.ts +4 -0
- package/src/shares/payload.ts +9 -5
- package/src/sources/gloomberb-cloud/news.ts +2 -0
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/resolve.ts +2 -2
- package/src/types/financials.ts +1 -0
- package/src/types/plugin-pane-settings.ts +2 -0
- package/src/types/plugin-panes.ts +22 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/untrusted-text.ts +29 -0
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
advertisedChord,
|
|
19
19
|
formatChordForHost,
|
|
20
20
|
useKeybindings,
|
|
21
|
+
useTerminalReportsControlKeys,
|
|
21
22
|
type KeyChord,
|
|
22
23
|
} from "../../app/keybindings";
|
|
23
24
|
import { getShortcutDisplayMode, type ShortcutDisplayMode } from "../../utils/shortcut-labels";
|
|
@@ -144,7 +145,9 @@ export function StatusBar() {
|
|
|
144
145
|
};
|
|
145
146
|
// Tabs name the digit that switches to them, as bound on this host. Past
|
|
146
147
|
// nine there is no digit, and a rebinding off the digits has none either.
|
|
147
|
-
|
|
148
|
+
// A terminal that cannot send Control with a digit names Alt+1 instead.
|
|
149
|
+
const legacyTerminal = useTerminalReportsControlKeys() === false;
|
|
150
|
+
const switchChord = advertisedChord(keybindings, "switch-layout", shortcutMode, { legacyTerminal });
|
|
148
151
|
const tabKey = (index: number): string => (
|
|
149
152
|
switchChord?.key === "digit" && index < 9 ? `${compactChordLabel(switchChord, shortcutMode, index + 1)} ` : ""
|
|
150
153
|
);
|
|
@@ -560,6 +563,7 @@ function StatusBarLayoutControl({
|
|
|
560
563
|
| "layoutTabItems"
|
|
561
564
|
| "layoutTabsWidth"
|
|
562
565
|
> & { nativePaneChrome: boolean }) {
|
|
566
|
+
const colors = useThemeColors();
|
|
563
567
|
if (!hasMultipleLayouts) return null;
|
|
564
568
|
// On the desktop and the web the strip is as wide as its tabs, gives way
|
|
565
569
|
// first when the bar runs out of room and scrolls inside, like the
|
|
@@ -580,6 +584,7 @@ function StatusBarLayoutControl({
|
|
|
580
584
|
onReorder={handleLayoutReorder}
|
|
581
585
|
compact
|
|
582
586
|
variant="pill"
|
|
587
|
+
background={colors.panel}
|
|
583
588
|
/>
|
|
584
589
|
</Box>
|
|
585
590
|
</Box>
|
|
@@ -98,23 +98,43 @@ export function planFirstRunWatchlist(
|
|
|
98
98
|
return { create, update };
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Below this many columns or rows the first-run Home shows three spots, not
|
|
103
|
+
* five: at 80x24 five cut headlines to nine characters and pane titles to
|
|
104
|
+
* "Main P...". 120x36 and up keep all five side by side.
|
|
105
|
+
*/
|
|
106
|
+
const COMPACT_HOME_BELOW = { width: 100, height: 30 } as const;
|
|
107
|
+
|
|
108
|
+
export function isCompactHomeViewport(viewport: { width: number; height: number }): boolean {
|
|
109
|
+
return viewport.width < COMPACT_HOME_BELOW.width || viewport.height < COMPACT_HOME_BELOW.height;
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
/**
|
|
102
113
|
* The workspace a first run lands on: the holdings as a mark-to-market
|
|
103
114
|
* heatmap, a watchlist, the largest position's chart, the top news wire, and
|
|
104
115
|
* a market read beside it. Everything is docked, so the first screen reads at
|
|
105
116
|
* any window size. Anything the host cannot render is left out rather than
|
|
106
117
|
* shown as a placeholder.
|
|
118
|
+
*
|
|
119
|
+
* `compact` (a small terminal, isCompactHomeViewport) keeps the same panes in
|
|
120
|
+
* three spots: the watchlist beside the chart (the heatmap with `holdings`),
|
|
121
|
+
* and the news across the whole width with the market read, Trending and the
|
|
122
|
+
* other list as tabs behind it.
|
|
107
123
|
*/
|
|
108
124
|
export function buildFirstRunLayout({
|
|
109
125
|
symbol,
|
|
110
126
|
portfolioId,
|
|
111
127
|
watchlistId,
|
|
112
128
|
hasPane,
|
|
129
|
+
compact = false,
|
|
130
|
+
holdings = false,
|
|
113
131
|
}: {
|
|
114
132
|
symbol: string;
|
|
115
133
|
portfolioId: string;
|
|
116
134
|
watchlistId: string;
|
|
117
135
|
hasPane: (paneId: string) => boolean;
|
|
136
|
+
compact?: boolean;
|
|
137
|
+
holdings?: boolean;
|
|
118
138
|
}): SavedLayout {
|
|
119
139
|
const instances: PaneInstanceConfig[] = [
|
|
120
140
|
{
|
|
@@ -173,10 +193,32 @@ export function buildFirstRunLayout({
|
|
|
173
193
|
if (readPaneId) instances.push({ instanceId: readId, paneId: readPaneId, binding: { kind: "none" } });
|
|
174
194
|
const trending = hasPane("attention-trending");
|
|
175
195
|
if (trending) instances.push({ instanceId: FIRST_RUN_PANE_IDS.trending, paneId: "attention-trending", binding: { kind: "none" } });
|
|
176
|
-
const
|
|
196
|
+
const readIds = [
|
|
177
197
|
...(readPaneId ? [readId] : []),
|
|
178
198
|
...(trending ? [FIRST_RUN_PANE_IDS.trending] : []),
|
|
179
|
-
]
|
|
199
|
+
];
|
|
200
|
+
if (compact) {
|
|
201
|
+
// The list beside the chart is the holdings when there are any, else the watchlist; the other one is the
|
|
202
|
+
// last tab behind the news, where the strip has room to name it.
|
|
203
|
+
const [list, other] = holdings
|
|
204
|
+
? [FIRST_RUN_PANE_IDS.heatmap, FIRST_RUN_PANE_IDS.watchlist]
|
|
205
|
+
: [FIRST_RUN_PANE_IDS.watchlist, FIRST_RUN_PANE_IDS.heatmap];
|
|
206
|
+
const top = { kind: "split" as const, axis: "horizontal" as const, ratio: 0.42,
|
|
207
|
+
first: { kind: "pane" as const, instanceId: list }, second: { kind: "pane" as const, instanceId: FIRST_RUN_PANE_IDS.chart } };
|
|
208
|
+
const below = buildDockStack([...(secondary ? [secondary.instanceId] : []), ...readIds, other]);
|
|
209
|
+
return {
|
|
210
|
+
name: "Home",
|
|
211
|
+
layout: {
|
|
212
|
+
dockRoot: below ? { kind: "split", axis: "vertical", ratio: 0.55, first: top, second: below } : top,
|
|
213
|
+
instances,
|
|
214
|
+
floating: [],
|
|
215
|
+
detached: [],
|
|
216
|
+
},
|
|
217
|
+
paneState: {},
|
|
218
|
+
focusedPaneId: FIRST_RUN_PANE_IDS.chart,
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const beside = buildDockStack(readIds);
|
|
180
222
|
const lower = secondary && beside ? { kind: "split" as const, axis: "horizontal" as const, ratio: 0.6,
|
|
181
223
|
first: { kind: "pane" as const, instanceId: secondary.instanceId }, second: beside }
|
|
182
224
|
: secondary ? { kind: "pane" as const, instanceId: secondary.instanceId } : beside;
|
|
@@ -9,6 +9,7 @@ import { Button, ListView, type ListViewItem } from "../ui";
|
|
|
9
9
|
import type { ButtonProps } from "../ui/button";
|
|
10
10
|
import { ListRowLines } from "../ui/list-row-lines";
|
|
11
11
|
import { TITLEBAR_OVERLAY_HEIGHT_PX } from "../layout/titlebar-overlay";
|
|
12
|
+
import { RemoteSurface, useRemoteSurfaceHeader, useRemoteSurfaceHeading } from "../../remote/surface";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Spacing for the DOM card, in px. The card is a form the user fills in, not
|
|
@@ -58,6 +59,9 @@ export function OnboardingModal({
|
|
|
58
59
|
const desktop = useUiCapabilities().nativePaneChrome === true;
|
|
59
60
|
const viewport = useViewport();
|
|
60
61
|
|
|
62
|
+
// It covers the app, so remote control reads it as the open form.
|
|
63
|
+
const content = <RemoteSurface kind="setup">{children}</RemoteSurface>;
|
|
64
|
+
|
|
61
65
|
if (desktop) {
|
|
62
66
|
return (
|
|
63
67
|
<Box
|
|
@@ -92,7 +96,7 @@ export function OnboardingModal({
|
|
|
92
96
|
}}
|
|
93
97
|
data-gloom-role="onboarding-modal"
|
|
94
98
|
>
|
|
95
|
-
{
|
|
99
|
+
{content}
|
|
96
100
|
</Box>
|
|
97
101
|
</Box>
|
|
98
102
|
);
|
|
@@ -126,7 +130,7 @@ export function OnboardingModal({
|
|
|
126
130
|
borderColor={colors.borderFocused}
|
|
127
131
|
data-gloom-role="onboarding-modal"
|
|
128
132
|
>
|
|
129
|
-
{
|
|
133
|
+
{content}
|
|
130
134
|
</Box>
|
|
131
135
|
</Box>
|
|
132
136
|
);
|
|
@@ -245,6 +249,7 @@ export function OnboardingTitle({
|
|
|
245
249
|
}) {
|
|
246
250
|
const colors = useThemeColors();
|
|
247
251
|
const desktop = useUiCapabilities().nativePaneChrome === true;
|
|
252
|
+
useRemoteSurfaceHeading({ step, title: titleSuffix ? `${title} ${titleSuffix}` : title, description });
|
|
248
253
|
|
|
249
254
|
if (desktop) {
|
|
250
255
|
return (
|
|
@@ -340,6 +345,10 @@ export function OnboardingHeader({
|
|
|
340
345
|
{ id: "cloud", label: t("Gloom Cloud") },
|
|
341
346
|
{ id: "pro", label: t("Pro") },
|
|
342
347
|
];
|
|
348
|
+
useRemoteSurfaceHeader({
|
|
349
|
+
section: sections.find((section) => section.id === active)?.label,
|
|
350
|
+
cancel: showDismiss && !dismissing && !dismissDisabled ? onDismiss : undefined,
|
|
351
|
+
});
|
|
343
352
|
|
|
344
353
|
if (!desktop) {
|
|
345
354
|
return (
|
|
@@ -4,6 +4,7 @@ import type { BrokerConfigField } from "../../types/broker";
|
|
|
4
4
|
import { useShortcut, type KeyEventLike } from "../../react/input";
|
|
5
5
|
import { matchKeybinding, matchesKeybindingAction, type ResolvedKeybindings } from "../../app/keybindings";
|
|
6
6
|
import { isPlainKey } from "../../utils/keyboard";
|
|
7
|
+
import { keepEscapeFromClosing } from "../../utils/double-escape-close";
|
|
7
8
|
import { isCopyShortcut, isPasteShortcut } from "../../utils/selection-clipboard";
|
|
8
9
|
import type { CloudBillingInterval } from "../../account/billing";
|
|
9
10
|
import type { usePlanAccess } from "../../api-client/plan-access";
|
|
@@ -333,4 +334,19 @@ export function useOnboardingKeyboard({
|
|
|
333
334
|
phase: "before",
|
|
334
335
|
enabled: stage === "research" && !helpFocused && !coachAside && !inputCaptured && !dialogOpen && !commandBarOpen,
|
|
335
336
|
});
|
|
337
|
+
|
|
338
|
+
// Esc puts the card away, as it closes any card. Scoped, so it runs ahead
|
|
339
|
+
// of the shell's double-Esc arming: this Esc is not half of closing the
|
|
340
|
+
// pane under the card.
|
|
341
|
+
useShortcut((event) => {
|
|
342
|
+
if (event.targetEditable === true || !isPlainKey(event, "escape", "esc")) return;
|
|
343
|
+
keepEscapeFromClosing(event);
|
|
344
|
+
event.preventDefault();
|
|
345
|
+
event.stopPropagation();
|
|
346
|
+
void finish();
|
|
347
|
+
}, {
|
|
348
|
+
phase: "before",
|
|
349
|
+
scope: "onboarding:research",
|
|
350
|
+
enabled: stage === "research" && !helpFocused && !coachAside && !inputCaptured && !dialogOpen && !commandBarOpen,
|
|
351
|
+
});
|
|
336
352
|
}
|
|
@@ -79,7 +79,6 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
|
|
|
79
79
|
const rendererHost = useRendererHost();
|
|
80
80
|
const commandBarShortcut = useCommandBarShortcut();
|
|
81
81
|
const notificationActionShortcut = useActionShortcut("notification-action");
|
|
82
|
-
const notificationDismissShortcut = useActionShortcut("notification-dismiss");
|
|
83
82
|
const keybindings = useKeybindings();
|
|
84
83
|
const dialogOpen = useDialogState((dialog) => dialog.isOpen);
|
|
85
84
|
const commandBarOpen = useAppSelector((state) => state.commandBarOpen);
|
|
@@ -326,7 +325,7 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
|
|
|
326
325
|
return {
|
|
327
326
|
coachAside,
|
|
328
327
|
coachKeysHidden: inputCaptured || typingInField,
|
|
329
|
-
helpFocused, stage, progress,
|
|
328
|
+
helpFocused, stage, progress, finish, notificationActionShortcut,
|
|
330
329
|
saveProgressInBackground, colors, commandBarShortcut, selectedBrokerId, brokerOptions, portfolioSub,
|
|
331
330
|
sectionAvailability, goToSection, skipSetup, isFinishing, isBrokerCommitting, desktop, positions,
|
|
332
331
|
inputRef, editingField, selectedPositionSymbol, brokerChoices, portfolioOptionIdx, setPortfolioOptionIdx,
|
|
@@ -379,7 +378,7 @@ function useCoachStepsAside(config: AppConfig, stage: OnboardingStage): boolean
|
|
|
379
378
|
export function OnboardingWizard(props: OnboardingWizardProps) {
|
|
380
379
|
const {
|
|
381
380
|
coachAside, coachKeysHidden,
|
|
382
|
-
helpFocused, stage, progress,
|
|
381
|
+
helpFocused, stage, progress, finish, notificationActionShortcut,
|
|
383
382
|
saveProgressInBackground, colors, commandBarShortcut, selectedBrokerId, brokerOptions, portfolioSub,
|
|
384
383
|
sectionAvailability, goToSection, skipSetup, isFinishing, isBrokerCommitting, desktop, positions,
|
|
385
384
|
inputRef, editingField, selectedPositionSymbol, brokerChoices, portfolioOptionIdx, setPortfolioOptionIdx,
|
|
@@ -401,15 +400,16 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
|
|
|
401
400
|
title={tf("Built around {ticker}", { ticker })}
|
|
402
401
|
actions={<>
|
|
403
402
|
{/* Each button shows its key, as Connect shows Alt+Enter; in the
|
|
404
|
-
terminal the second wraps under the first
|
|
405
|
-
room for both:
|
|
406
|
-
|
|
403
|
+
terminal the second wraps under the first where the row is short.
|
|
404
|
+
The desktop card has no room for both: its dismiss key is in the
|
|
405
|
+
tooltip. Esc puts it away as it closes any card; the notification
|
|
406
|
+
dismiss key and F10 do too. In a field, or with a pane holding the
|
|
407
407
|
keyboard, the keys are the field's: the card shows none. */}
|
|
408
408
|
<OnboardingButton
|
|
409
409
|
label="Keep exploring"
|
|
410
410
|
variant="ghost"
|
|
411
|
-
shortcut={!desktop && !coachKeysHidden
|
|
412
|
-
title={desktop
|
|
411
|
+
shortcut={!desktop && !coachKeysHidden ? "Esc" : undefined}
|
|
412
|
+
title={desktop ? `${t("Keep exploring")} (Esc)` : undefined}
|
|
413
413
|
onPress={() => { void finish(); }}
|
|
414
414
|
/>
|
|
415
415
|
<OnboardingButton
|
|
@@ -9,6 +9,8 @@ import { formatPercentRaw } from "../../../utils/format";
|
|
|
9
9
|
import { Button, NumberField, TextField } from "../../ui";
|
|
10
10
|
import { DelayedMark } from "../../ui/delayed-mark";
|
|
11
11
|
import { useFreeQuoteDelay } from "../../../api-client/plan-access";
|
|
12
|
+
import { useRemoteUiNode } from "../../../remote/semantic-tree";
|
|
13
|
+
import { remoteStringValue } from "../../../remote/semantic-helpers";
|
|
12
14
|
import { ONBOARDING_DESKTOP } from "../onboarding-frame";
|
|
13
15
|
import {
|
|
14
16
|
POSITION_FIELDS,
|
|
@@ -379,7 +381,66 @@ export interface PositionsPanelProps {
|
|
|
379
381
|
shortcut: string;
|
|
380
382
|
}
|
|
381
383
|
|
|
384
|
+
/**
|
|
385
|
+
* One field of the position form as remote control fills it, the same on both
|
|
386
|
+
* hosts: the terminal draws only the field being typed in as an input, and
|
|
387
|
+
* Enter there is the card's key, not the input's. `submit` adds the position,
|
|
388
|
+
* as the desktop's Add button does.
|
|
389
|
+
*/
|
|
390
|
+
function RemotePositionField({ field, index, state, editing }: { field: PositionFieldId; index: number; state: OnboardingPositionsState; editing: boolean }) {
|
|
391
|
+
useRemoteUiNode({
|
|
392
|
+
role: "form-field",
|
|
393
|
+
label: fieldLabel(field, state),
|
|
394
|
+
disabled: state.submitting,
|
|
395
|
+
actions: {
|
|
396
|
+
focus: () => state.focusField(index),
|
|
397
|
+
setValue: (input) => state.setField(field, remoteStringValue(input)),
|
|
398
|
+
submit: () => state.addPosition(),
|
|
399
|
+
},
|
|
400
|
+
metadata: {
|
|
401
|
+
fieldId: field,
|
|
402
|
+
fieldType: field === "shares" || field === "avgCost" ? "number" : "text",
|
|
403
|
+
active: editing && index === state.fieldIdx,
|
|
404
|
+
value: state.draft[field],
|
|
405
|
+
placeholder: fieldPlaceholder(field, state),
|
|
406
|
+
...(field === "ticker" && state.error ? { error: state.error } : {}),
|
|
407
|
+
},
|
|
408
|
+
});
|
|
409
|
+
return null;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/** The positions added so far, as remote control reads them; `remove` takes one off by its symbol or index. */
|
|
413
|
+
function RemotePositionList({ state }: { state: OnboardingPositionsState }) {
|
|
414
|
+
useRemoteUiNode({
|
|
415
|
+
role: "list",
|
|
416
|
+
label: t("Positions"),
|
|
417
|
+
actions: {
|
|
418
|
+
remove: (input) => {
|
|
419
|
+
const record = input && typeof input === "object" ? input as { id?: unknown; index?: unknown } : {};
|
|
420
|
+
const symbol = typeof record.index === "number"
|
|
421
|
+
? state.positions[record.index]?.symbol
|
|
422
|
+
: typeof record.id === "string" ? record.id : remoteStringValue(input, "");
|
|
423
|
+
const row = state.positions.find((entry) => entry.symbol === symbol?.toUpperCase());
|
|
424
|
+
if (!row) throw new Error(`No position ${symbol ? `"${symbol}"` : "at that index"} is listed.`);
|
|
425
|
+
return state.removePosition(row.symbol);
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
metadata: {
|
|
429
|
+
items: state.positions.map((row, index) => ({ index, id: row.symbol, label: row.symbol, detail: positionSummary(row) })),
|
|
430
|
+
},
|
|
431
|
+
});
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
|
|
382
435
|
export function PositionsPanel(props: PositionsPanelProps) {
|
|
383
436
|
const desktop = useUiCapabilities().nativePaneChrome === true;
|
|
384
|
-
return
|
|
437
|
+
return (
|
|
438
|
+
<>
|
|
439
|
+
{POSITION_FIELDS.map((field, index) => (
|
|
440
|
+
<RemotePositionField key={field} field={field} index={index} state={props.state} editing={props.editing} />
|
|
441
|
+
))}
|
|
442
|
+
<RemotePositionList state={props.state} />
|
|
443
|
+
{desktop ? <DesktopPositionsPanel {...props} /> : <TuiPositionsPanel {...props} />}
|
|
444
|
+
</>
|
|
445
|
+
);
|
|
385
446
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
applyFirstRunLayout,
|
|
15
15
|
buildFirstRunLayout,
|
|
16
16
|
FIRST_RUN_WATCHLIST,
|
|
17
|
+
isCompactHomeViewport,
|
|
17
18
|
onboardingDeskLayoutId,
|
|
18
19
|
planFirstRunWatchlist,
|
|
19
20
|
setupDeskPicks,
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
type BrokerOption,
|
|
29
30
|
} from "./wizard-model";
|
|
30
31
|
import { logFailure } from "../../utils/log-failure";
|
|
32
|
+
import { useViewport } from "../../react/input";
|
|
31
33
|
|
|
32
34
|
const onboardingLog = debugLog.createLogger("onboarding");
|
|
33
35
|
|
|
@@ -109,6 +111,10 @@ export function useOnboardingWorkspace({
|
|
|
109
111
|
const [deskCursor, setDeskCursor] = useState(0);
|
|
110
112
|
const [buildingDesks, setBuildingDesks] = useState(false);
|
|
111
113
|
const buildingDesksRef = useRef(false);
|
|
114
|
+
// The window the workspace is built for: a small terminal gets the compact Home.
|
|
115
|
+
const viewport = useViewport();
|
|
116
|
+
const viewportRef = useRef(viewport);
|
|
117
|
+
viewportRef.current = viewport;
|
|
112
118
|
|
|
113
119
|
/**
|
|
114
120
|
* Seeds the watchlist and swaps Home for the first-run workspace built
|
|
@@ -152,18 +158,20 @@ export function useOnboardingWorkspace({
|
|
|
152
158
|
onboardingLog.error("First-run watchlist update failed", { symbol: ticker.metadata.ticker, error: String(error) });
|
|
153
159
|
}
|
|
154
160
|
}
|
|
161
|
+
const { tickers, financials } = stateRef.current;
|
|
162
|
+
const held = [...tickers.values()]
|
|
163
|
+
.filter((ticker) => ticker.metadata.portfolios.includes(portfolioId))
|
|
164
|
+
.map((ticker) => ticker.metadata.ticker);
|
|
155
165
|
const home = buildFirstRunLayout({
|
|
156
166
|
symbol,
|
|
157
167
|
portfolioId,
|
|
158
168
|
watchlistId,
|
|
159
169
|
hasPane: (paneId) => pluginRegistry.panes?.has(paneId) ?? false,
|
|
170
|
+
compact: isCompactHomeViewport(viewportRef.current),
|
|
171
|
+
holdings: held.length > 0,
|
|
160
172
|
});
|
|
161
173
|
const workspace = applyFirstRunLayout(config, home, [], { rerun });
|
|
162
174
|
if (desks.length === 0) return workspace;
|
|
163
|
-
const { tickers, financials } = stateRef.current;
|
|
164
|
-
const held = [...tickers.values()]
|
|
165
|
-
.filter((ticker) => ticker.metadata.portfolios.includes(portfolioId))
|
|
166
|
-
.map((ticker) => ticker.metadata.ticker);
|
|
167
175
|
const company = pickDeskCompany([symbol, ...held], (candidate) => (
|
|
168
176
|
isDeskStock(tickers.get(candidate), financials.get(candidate))
|
|
169
177
|
));
|
|
@@ -7,7 +7,7 @@ import { Checkbox } from "../ui/checkbox";
|
|
|
7
7
|
import { Button } from "../ui/button";
|
|
8
8
|
import { Badge } from "../ui/display";
|
|
9
9
|
import { DialogFrame } from "../ui/frame";
|
|
10
|
-
import { isPaneSettingDisabled, noteColor, summarizePaneSettingValue } from "./value";
|
|
10
|
+
import { isPaneSettingDisabled, noteColor, paneSettingValue, summarizePaneSettingValue } from "./value";
|
|
11
11
|
|
|
12
12
|
const DESKTOP_TEXT_STYLE = {
|
|
13
13
|
letterSpacing: 0,
|
|
@@ -190,7 +190,7 @@ function DesktopSettingsList({
|
|
|
190
190
|
key={field.key}
|
|
191
191
|
field={field}
|
|
192
192
|
selected={index === selectedIndex}
|
|
193
|
-
currentValue={settings
|
|
193
|
+
currentValue={paneSettingValue(field, settings)}
|
|
194
194
|
note={noteFor?.(field) ?? null}
|
|
195
195
|
onHover={() => onHover(field, index)}
|
|
196
196
|
onEdit={() => onEdit(field, index)}
|
|
@@ -6,7 +6,7 @@ import { colors } from "../../theme/colors";
|
|
|
6
6
|
import { useViewport } from "../../react/input";
|
|
7
7
|
import { DialogFrame, ListView } from "../ui";
|
|
8
8
|
import type { ListViewProps } from "../ui/list-view";
|
|
9
|
-
import { isPaneSettingDisabled, noteColor, summarizePaneSettingValue } from "./value";
|
|
9
|
+
import { isPaneSettingDisabled, noteColor, paneSettingValue, summarizePaneSettingValue } from "./value";
|
|
10
10
|
|
|
11
11
|
/** Terminal rows a settings dialog spends around its list: edge, frame, title, description. */
|
|
12
12
|
const TUI_DIALOG_LIST_CHROME_ROWS = 11;
|
|
@@ -82,7 +82,7 @@ export function TuiPaneSettingsDialogBody({
|
|
|
82
82
|
id: field.key,
|
|
83
83
|
label: t(field.label),
|
|
84
84
|
description: notes[index]?.text ?? (field.description ? t(field.description) : field.description),
|
|
85
|
-
detail: notes[index]?.status ?? summarizePaneSettingValue(field, settings
|
|
85
|
+
detail: notes[index]?.status ?? summarizePaneSettingValue(field, paneSettingValue(field, settings)),
|
|
86
86
|
disabled: isPaneSettingDisabled(field),
|
|
87
87
|
}))}
|
|
88
88
|
descriptionColor={(index) => (notes[index]?.text ? noteColor(notes[index]) : undefined)}
|
|
@@ -17,6 +17,12 @@ export function noteColor(note: PaneSettingRowNote | null | undefined): string |
|
|
|
17
17
|
return note.tone === "negative" ? colors.negative : colors.warning;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
/** A field's value in a pane's settings, an unset select reading as its default option. */
|
|
21
|
+
export function paneSettingValue(field: PaneSettingField, settings: Readonly<Record<string, unknown>>): unknown {
|
|
22
|
+
const value = settings[field.key];
|
|
23
|
+
return value == null && field.type === "select" ? field.defaultValue : value;
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
export function summarizePaneSettingValue(field: PaneSettingField, value: unknown): string {
|
|
21
27
|
switch (field.type) {
|
|
22
28
|
case "action":
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
TuiPaneSettingsDialogBody,
|
|
20
20
|
TuiUnavailablePaneSettingsDialog,
|
|
21
21
|
} from "./pane-settings-dialog/tui";
|
|
22
|
-
import { isPaneSettingDisabled, isSpaceKey, stepPaneSettingSelect } from "./pane-settings-dialog/value";
|
|
22
|
+
import { isPaneSettingDisabled, isSpaceKey, paneSettingValue, stepPaneSettingSelect } from "./pane-settings-dialog/value";
|
|
23
23
|
import { useRowNotes } from "./ui/row-notes";
|
|
24
24
|
import { logFailure } from "../utils/log-failure";
|
|
25
25
|
|
|
@@ -118,7 +118,7 @@ export function PaneSettingsDialogContent({
|
|
|
118
118
|
if (!closed && mounted.current) setSettingsRevision((revision) => revision + 1);
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
const currentValue = descriptor.context.settings
|
|
121
|
+
const currentValue = paneSettingValue(field, descriptor.context.settings);
|
|
122
122
|
|
|
123
123
|
if (field.type === "toggle") {
|
|
124
124
|
await applyAndRefresh(field, currentValue !== true);
|
|
@@ -175,7 +175,7 @@ export function PaneSettingsDialogContent({
|
|
|
175
175
|
/** Left and right change a toggle or step a select in place, the way a settings list does. */
|
|
176
176
|
const stepField = (field: PaneSettingField | undefined, direction: -1 | 1) => {
|
|
177
177
|
if (!field || !descriptor) return;
|
|
178
|
-
const currentValue = descriptor.context.settings
|
|
178
|
+
const currentValue = paneSettingValue(field, descriptor.context.settings);
|
|
179
179
|
if (field.type === "toggle") {
|
|
180
180
|
void applyAndRefresh(field, currentValue !== true).catch(logFailure("pane-settings-dialog", "Toggle pane setting failed"));
|
|
181
181
|
return;
|
|
@@ -9,6 +9,8 @@ import { DetailScrollBody } from "../ui/detail-scroll-body";
|
|
|
9
9
|
import { KeyValueRow } from "../ui/display";
|
|
10
10
|
import { ExternalLink, usePaneLinkMenuEntry } from "../ui/external-link";
|
|
11
11
|
import { parseArticle } from "./article-text";
|
|
12
|
+
import { shareItemExcerpt } from "../../shares/item";
|
|
13
|
+
import { usePaneShareItem } from "../../shares/pane-item";
|
|
12
14
|
import { DESKTOP_LINE_HEIGHT, READER_APP_FONT, READER_COLUMN_FONT, READER_HEADING_STYLE, READER_MEASURE, ReaderBlock, ReaderText, type ReaderGeometry } from "./reader-text";
|
|
13
15
|
|
|
14
16
|
export interface DetailFact {
|
|
@@ -82,6 +84,8 @@ export const DetailReader = forwardRef<ScrollBoxRenderable, DetailReaderProps>(f
|
|
|
82
84
|
ref,
|
|
83
85
|
) {
|
|
84
86
|
const { nativePaneChrome } = useUiCapabilities();
|
|
87
|
+
// The text's opening says what the open item is about, for a link to the pane.
|
|
88
|
+
usePaneShareItem(body ? () => ({ excerpt: shareItemExcerpt(body, { markdown: bodyFormat === "markdown" }) }) : null, { kit: true });
|
|
85
89
|
return (
|
|
86
90
|
<DetailScrollBody ref={ref} resetScrollKey={resetScrollKey}>
|
|
87
91
|
{nativePaneChrome
|
|
@@ -75,7 +75,7 @@ export { InlineQuickAddRow } from "./inline-quick-add";
|
|
|
75
75
|
export type { InlineQuickAddRowProps } from "./inline-quick-add";
|
|
76
76
|
|
|
77
77
|
export { ExternalLink, ExternalLinkText, openUrl, PaneLinkMenu, usePaneLinkMenuEntry } from "./external-link";
|
|
78
|
-
export { DesktopPaneLinkChip, TerminalPaneLinkChip } from "./pane-link-chip";
|
|
78
|
+
export { DesktopPaneLinkChip, TerminalPaneLinkChip, TerminalPaneLinkItemCard, terminalItemCardRows } from "./pane-link-chip";
|
|
79
79
|
export type { PaneLinkChipContent } from "./pane-link-chip";
|
|
80
80
|
export { ButtonActionScope } from "./action-scope";
|
|
81
81
|
export { RemoteImage } from "./remote-image";
|
|
@@ -2,6 +2,7 @@ import { Box, Text, TextAttributes, useUiHost } from "../../ui";
|
|
|
2
2
|
import { useShortcut } from "../../react/input";
|
|
3
3
|
import { useCallback, type ComponentType, type ReactNode } from "react";
|
|
4
4
|
import { colors } from "../../theme/colors";
|
|
5
|
+
import { usePaneShareItem } from "../../shares/pane-item";
|
|
5
6
|
import {
|
|
6
7
|
isDetailBackNavigationKey,
|
|
7
8
|
isMouseBackNavigationEvent,
|
|
@@ -31,6 +32,8 @@ export function PageStackView({
|
|
|
31
32
|
backHint,
|
|
32
33
|
}: PageStackViewProps) {
|
|
33
34
|
const HostPageStackView = useUiHost().PageStackView as ComponentType<PageStackViewProps> | undefined;
|
|
35
|
+
// The open detail's title names what the pane is on, for a link to it.
|
|
36
|
+
usePaneShareItem(detailOpen && detailTitle ? { title: detailTitle } : null, { kit: true });
|
|
34
37
|
const props = {
|
|
35
38
|
focused,
|
|
36
39
|
detailOpen,
|