gloomberb 0.20.4 → 0.20.6
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 +3 -1
- package/README.zh-CN.md +1 -1
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +4 -1
- package/src/api-client/data.ts +148 -37
- package/src/api-client/hk-tenders.ts +59 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/types/econ.ts +30 -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/app.tsx +18 -13
- package/src/architecture/floating-promise-allowlist.json +313 -0
- 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 +238 -57
- package/src/cli/commands/news-search.ts +81 -14
- package/src/cli/commands/overview.ts +27 -6
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +1 -1
- package/src/cli/commands/ticker.ts +3 -1
- package/src/cli/early-command.ts +2 -0
- package/src/cli/errors.ts +10 -1
- package/src/cli/fx-forward.ts +89 -7
- package/src/cli/fx-pair.ts +1 -1
- package/src/cli/fx-quote-rate.ts +23 -0
- package/src/cli/glossary.ts +19 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index-roots.ts +5 -4
- package/src/cli/index.ts +40 -3
- package/src/cli/known-gaps.ts +38 -9
- package/src/cli/listing-arg.ts +17 -5
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +52 -3
- package/src/cli/output-file.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +15 -0
- package/src/cli/pane-functions/function-help.ts +4 -4
- package/src/cli/pane-functions/headless.ts +9 -4
- package/src/cli/pane-functions/index.ts +6 -4
- package/src/cli/pane-functions/resolver.ts +2 -2
- package/src/cli/result.ts +21 -2
- package/src/cli/spreadsheet-hint.ts +7 -3
- package/src/cli/treasury-yields.ts +5 -3
- package/src/components/chart/composite/legend.tsx +40 -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/command-bar/workflow/tickers.ts +2 -2
- package/src/components/data-table/view.tsx +9 -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/data-table/opentui/index.tsx +11 -4
- package/src/components/ui/data-table/opentui/model.ts +8 -6
- package/src/components/ui/data-table/types.ts +6 -1
- 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/table-layout.ts +38 -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 +30 -13
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/market/change-basis.ts +9 -5
- package/src/market-data/market/dated-previous-close.ts +147 -17
- package/src/market-data/market/status.ts +17 -1
- package/src/market-data/quotes/contributions.ts +2 -0
- package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
- package/src/plugins/builtin/alerts/metric-data.ts +15 -2
- 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/backtest/headless.ts +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/cds/model.ts +0 -6
- package/src/plugins/builtin/chart-composer/formula.ts +16 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
- package/src/plugins/builtin/chart-composer/headless.ts +4 -2
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/presets.ts +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/pane.tsx +55 -13
- 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/credit-boards/cdx-pane.tsx +20 -7
- package/src/plugins/builtin/credit-boards/client.ts +8 -0
- package/src/plugins/builtin/credit-boards/headless.ts +4 -1
- package/src/plugins/builtin/credit-boards/model.ts +58 -4
- package/src/plugins/builtin/credit-boards/series.ts +63 -6
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
- package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
- package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
- package/src/plugins/builtin/credit-conditions/model.ts +12 -6
- package/src/plugins/builtin/credit-conditions/series.ts +2 -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 +115 -8
- package/src/plugins/builtin/econ/calendar-source.ts +7 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +42 -8
- package/src/plugins/builtin/econ/types.ts +3 -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 +3 -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/fx-matrix/index.tsx +44 -14
- 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 +7 -3
- 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/cli/render.ts +20 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
- 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-schema.ts +4 -3
- package/src/plugins/builtin/research/headless.ts +10 -4
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
- package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
- package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
- 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/api.ts +47 -4
- 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/data-panes/historical-prices.tsx +8 -7
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
- package/src/plugins/builtin/ticker-detail/financials/model.ts +18 -2
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +6 -6
- package/src/plugins/builtin/ticker-detail/headless.ts +24 -17
- 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 +54 -5
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +150 -22
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
- package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +27 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +264 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +176 -41
- 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/collection-name.ts +22 -0
- 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/dom/data-table/frozen-column.ts +3 -1
- package/src/renderers/dom/data-table/index.tsx +27 -9
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
- package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -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/sources/gloomberb-cloud/normalizers.ts +9 -5
- package/src/sources/provider-router/cache.ts +3 -1
- package/src/sync/controller.ts +17 -2
- package/src/sync/other-window-tabs.ts +32 -1
- package/src/sync/react.ts +4 -4
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/bar-spacing.ts +33 -0
- package/src/time-series/base-series.ts +21 -3
- package/src/time-series/chart-bounds.ts +31 -0
- package/src/time-series/field-catalog.ts +17 -0
- package/src/time-series/fundamentals.ts +143 -11
- package/src/time-series/ice-credit.ts +32 -6
- package/src/time-series/resolve.ts +11 -7
- package/src/time-series/session-bar.ts +78 -9
- package/src/time-series/studies/formula.ts +53 -10
- package/src/time-series/studies/pair.ts +18 -7
- package/src/time-series/studies/units.ts +49 -2
- package/src/time-series/types.ts +12 -0
- package/src/types/desktop-window.ts +2 -0
- package/src/types/financials.ts +7 -0
- package/src/types/headless.ts +8 -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/cli-output.ts +6 -3
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/ebitda.ts +128 -0
- package/src/utils/format.ts +1 -1
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/shell-word.ts +13 -0
- package/src/utils/untrusted-text.ts +29 -0
package/src/cli/result.ts
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
cliPlainEnabled,
|
|
4
4
|
cliStyles,
|
|
5
5
|
cliTerminalWidth,
|
|
6
|
+
renderForFile,
|
|
6
7
|
renderStats,
|
|
7
8
|
renderTable,
|
|
8
9
|
statValueWidth,
|
|
@@ -623,6 +624,19 @@ function renderTextRows<T, Row extends Record<string, unknown>>(
|
|
|
623
624
|
: renderTextTable(rows as Row[], columns, renderOptions.rowNote);
|
|
624
625
|
}
|
|
625
626
|
|
|
627
|
+
/** What `printCliResult` drew for the file `--output` names, since `takeCliFileExport` last took it. */
|
|
628
|
+
let fileExport: string[] = [];
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* The export a command printed for its `--output` file, or null when it
|
|
632
|
+
* printed none: the text the file is written with (dispatchCli).
|
|
633
|
+
*/
|
|
634
|
+
export function takeCliFileExport(): string | null {
|
|
635
|
+
const taken = fileExport.filter(Boolean);
|
|
636
|
+
fileExport = [];
|
|
637
|
+
return taken.length > 0 ? taken.join("\n") : null;
|
|
638
|
+
}
|
|
639
|
+
|
|
626
640
|
/** Settles once the result `printCliResult` last wrote has left the process: a pipe can hold it back. */
|
|
627
641
|
let stdoutWritten: Promise<void> = Promise.resolve();
|
|
628
642
|
|
|
@@ -644,13 +658,18 @@ export function printCliResult<T, Row extends Record<string, unknown> = Record<s
|
|
|
644
658
|
if (options.quiet && options.format === "text") return;
|
|
645
659
|
// JSON keeps the router's own words; everything else is for a person, so a "Not a ticker" gets its hint.
|
|
646
660
|
const hinted = (text: string) => options.format === "json" ? text : withSearchHints(text, args, isFredSeries);
|
|
647
|
-
|
|
661
|
+
// An export `--output` names is drawn for the file (no colour), and held for the command's end to write.
|
|
662
|
+
const toFile = options.output !== undefined && options.format !== "text";
|
|
663
|
+
const serialized = hinted(toFile
|
|
664
|
+
? renderForFile(() => serializeCliResult(result, options, renderOptions))
|
|
665
|
+
: serializeCliResult(result, options, renderOptions));
|
|
648
666
|
// A CSV's closing source and note lines go to stderr with the warnings: in the file they are rows of junk to a spreadsheet.
|
|
649
667
|
const { csv, footer } = options.format === "csv" ? splitCsvFooter(serialized) : { csv: serialized, footer: [] };
|
|
650
668
|
const output = csv;
|
|
669
|
+
if (toFile) fileExport.push(output);
|
|
651
670
|
// Bun's console writer can truncate a large pipe write after stdout has been
|
|
652
671
|
// initialized. The stream queues the remaining bytes until the reader drains.
|
|
653
|
-
if (output && !process.stdout.write(`${output}\n`)) {
|
|
672
|
+
else if (output && !process.stdout.write(`${output}\n`)) {
|
|
654
673
|
stdoutWritten = new Promise((resolve) => process.stdout.once("drain", () => resolve()));
|
|
655
674
|
}
|
|
656
675
|
// JSON carries warnings in its envelope. Text, CSV and NDJSON are only the
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { commandWord } from "../utils/shell-word";
|
|
2
|
+
|
|
1
3
|
/** Spreadsheet formats people ask for by name, which no command writes: CSV is the one a spreadsheet opens. */
|
|
2
4
|
const SPREADSHEET_OPTIONS = new Set(["--xlsx", "--xls", "--excel", "--spreadsheet", "--sheet", "--sheets", "--tsv"]);
|
|
3
5
|
|
|
4
6
|
/** A file named after a spreadsheet flag (`--xlsx rates.xlsx`), which becomes the CSV's name. */
|
|
5
7
|
const SPREADSHEET_FILE = /\.(xlsx|xls|tsv)$/i;
|
|
6
8
|
|
|
7
|
-
/** An argument as a shell reads it back: quoted when it holds a space or a character the shell acts on. */
|
|
9
|
+
/** An argument as a shell reads it back: quoted when it holds a space or a character the shell acts on; `"^TNX"` for cmd.exe. */
|
|
8
10
|
function shellWord(arg: string): string {
|
|
9
|
-
|
|
11
|
+
if (!/^[\w^=.,:/@%+-]+$/.test(arg)) return `'${arg.replaceAll("'", "'\\''")}'`;
|
|
12
|
+
return arg.includes("^") ? commandWord(arg) : arg;
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
/**
|
|
@@ -39,5 +42,6 @@ export function spreadsheetOptionHint(flag: string, command: string, args: reado
|
|
|
39
42
|
// Named after the command, a function by its code (`fn QQ`: qq.csv).
|
|
40
43
|
const named = command.trim().split(/\s+/).filter((word, index) => index > 0 || word !== "fn");
|
|
41
44
|
const output = file ? file.replace(SPREADSHEET_FILE, ".csv") : `${named.join("-").toLowerCase()}.csv`;
|
|
42
|
-
|
|
45
|
+
// --output writes the file in UTF-8 in every shell, where `>` is UTF-16 in Windows PowerShell 5.1.
|
|
46
|
+
return `Exports are --csv (opens in Excel and Google Sheets), --json or --ndjson: gloom ${words.map(shellWord).join(" ")} --csv --output ${shellWord(output)}.`;
|
|
43
47
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { commandWord } from "../utils/shell-word";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A US Treasury yield typed as if it were a ticker: US10Y, UST10Y, US10YR,
|
|
3
5
|
* USGG10YR, 10Y, TNX, "10 year yield". None is a ticker (TNX is TenX
|
|
@@ -68,18 +70,18 @@ export function treasuryYieldTenor(text: string): TreasuryYieldTenor | null {
|
|
|
68
70
|
/** The commands with the yield: its Cboe index when there is one, its FRED series, the curve. */
|
|
69
71
|
function yieldCommands(tenor: TreasuryYieldTenor): Array<readonly [command: string, gives: string]> {
|
|
70
72
|
return [
|
|
71
|
-
...tenor.index ? [[`gloom quote ${tenor.index}`, "Cboe index"] as const] : [],
|
|
73
|
+
...tenor.index ? [[`gloom quote ${commandWord(tenor.index)}`, "Cboe index"] as const] : [],
|
|
72
74
|
[`gloom fred ${tenor.fred}`, "daily"],
|
|
73
75
|
["gloom yield-curve", "every tenor"],
|
|
74
76
|
];
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
/**
|
|
79
|
+
/** `US 10-year Treasury yield: gloom quote "^TNX" (Cboe index), ...`, for `search`, `catalog` and a bare root. */
|
|
78
80
|
export function treasuryYieldLine(tenor: TreasuryYieldTenor): string {
|
|
79
81
|
return `US ${tenor.label} Treasury yield: ${yieldCommands(tenor).map(([command, gives]) => `${command} (${gives})`).join(", ")}.`;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
/** "Try `gloom quote ^TNX`, ... for the US 10-year Treasury yield.", after "Not a ticker: US10Y." */
|
|
84
|
+
/** "Try `gloom quote \"^TNX\"`, ... for the US 10-year Treasury yield.", after "Not a ticker: US10Y." */
|
|
83
85
|
export function treasuryYieldHint(tenor: TreasuryYieldTenor): string {
|
|
84
86
|
const commands = yieldCommands(tenor).map(([command]) => `\`${command}\``);
|
|
85
87
|
return `Try ${commands.slice(0, -1).join(", ")} or ${commands.at(-1)} for the US ${tenor.label} Treasury yield.`;
|
|
@@ -2,7 +2,7 @@ import { memo, useEffect, useRef } from "react";
|
|
|
2
2
|
import { Box, ScrollBox, Span, Text, useShortcutLabel, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
|
|
3
3
|
import { colors as themeColors, hoverBg } from "../../../theme/colors";
|
|
4
4
|
import { CANONICAL_EXCHANGE_ALIASES } from "../../../utils/exchanges";
|
|
5
|
-
import { displayWidth, formatPercentRaw, truncateToDisplayWidth } from "../../../utils/format";
|
|
5
|
+
import { displayWidth, formatPercentRaw, truncateToDisplayWidth, truncateToWidth } from "../../../utils/format";
|
|
6
6
|
import type { ResolvedSeries } from "../../../time-series/types";
|
|
7
7
|
import { consumeChartMouseEvent, type ChartMouseEvent } from "../core/pointer";
|
|
8
8
|
import {
|
|
@@ -99,6 +99,43 @@ function withoutListingExchange(label: string): string {
|
|
|
99
99
|
));
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/** Characters two labels start with alike. */
|
|
103
|
+
function sharedStart(left: string, right: string): number {
|
|
104
|
+
let index = 0;
|
|
105
|
+
while (index < left.length && index < right.length && left[index] === right[index]) index += 1;
|
|
106
|
+
return index;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The last characters of `value` that fit in `width` cells. */
|
|
110
|
+
function tailToWidth(value: string, width: number): string {
|
|
111
|
+
let tail = "";
|
|
112
|
+
for (const char of [...value].reverse()) {
|
|
113
|
+
if (displayWidth(char + tail) > width) break;
|
|
114
|
+
tail = char + tail;
|
|
115
|
+
}
|
|
116
|
+
return tail;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* A legend name cut to `width` cells so it still tells itself from the other
|
|
121
|
+
* names in the legend: cut at its end while what shows gets past the start it
|
|
122
|
+
* shares with another; otherwise its head, `...`, then the end of what follows
|
|
123
|
+
* that shared start. `HY - IG` beside `HY` keeps `- IG`, and two formulas on
|
|
124
|
+
* one first leg keep their second (`FRED:BA...C0A0CM`, `FRED:BA...spread`).
|
|
125
|
+
*/
|
|
126
|
+
export function distinguishingLabelCut(label: string, width: number, others: readonly string[]): string {
|
|
127
|
+
const plain = truncateToDisplayWidth(label, width);
|
|
128
|
+
if (plain === label || width <= 6) return plain;
|
|
129
|
+
const shared = Math.max(0, ...others.filter((other) => other !== label).map((other) => sharedStart(label, other)));
|
|
130
|
+
const stem = truncateToWidth(label, width - 3);
|
|
131
|
+
const rest = label.slice(shared).trimStart();
|
|
132
|
+
if (stem.length > shared || !rest) return plain;
|
|
133
|
+
// The end of the rest gets the room a third of a head leaves, the head whatever a short rest leaves over.
|
|
134
|
+
const room = width - 3;
|
|
135
|
+
const head = truncateToWidth(label, Math.min(room - 1, Math.max(Math.max(1, Math.floor(room / 3)), room - displayWidth(rest)))).trimEnd();
|
|
136
|
+
return `${head}...${tailToWidth(rest, room - displayWidth(head))}`;
|
|
137
|
+
}
|
|
138
|
+
|
|
102
139
|
/**
|
|
103
140
|
* Entries laid left to right into lines of `available` cells, one cell apart,
|
|
104
141
|
* a new line when the next does not fit. With `maxLines`, what does not fit in
|
|
@@ -311,7 +348,8 @@ export function CompositeLegend({
|
|
|
311
348
|
const setEntryLabel = (target: LegendEntry, label: string, labelWidth: number) => {
|
|
312
349
|
target.label = label;
|
|
313
350
|
target.labelWidth = labelWidth;
|
|
314
|
-
|
|
351
|
+
const others = entries.filter((other) => other !== target).map((other) => other.compactLabel);
|
|
352
|
+
target.text = [distinguishingLabelCut(label, labelWidth, others), target.valueText].filter(Boolean).join(" ");
|
|
315
353
|
target.width = Math.max(1, displayWidth(target.text)) + target.markerWidth;
|
|
316
354
|
};
|
|
317
355
|
const measureSeriesWidth = () => entries.reduce(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PluginRegistry } from "../../plugins/registry";
|
|
2
2
|
import { fuzzyFilter } from "../../utils/fuzzy-search";
|
|
3
3
|
import type { ResultItem } from "./list/model";
|
|
4
|
-
import { summarizePaneSettingValue } from "../pane-settings-dialog/value";
|
|
4
|
+
import { paneSettingValue, summarizePaneSettingValue } from "../pane-settings-dialog/value";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* The focused pane's settings as root search results. The bar only finds a
|
|
@@ -21,7 +21,7 @@ export function buildPaneSettingResultItems(options: {
|
|
|
21
21
|
const category = descriptor.settingsDef.title || "Pane Settings";
|
|
22
22
|
const paneLabel = descriptor.pane.title || descriptor.paneDef.name || descriptor.pane.paneId;
|
|
23
23
|
const items = descriptor.settingsDef.fields.map((field): ResultItem => {
|
|
24
|
-
const currentValue = descriptor.context.settings
|
|
24
|
+
const currentValue = paneSettingValue(field, descriptor.context.settings);
|
|
25
25
|
const actionSearchText = field.type === "action"
|
|
26
26
|
? `${field.actionId} ${field.actionLabel ?? ""}`
|
|
27
27
|
: "";
|
|
@@ -409,14 +409,18 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
|
|
|
409
409
|
.filter((command) => command.id !== "quit")
|
|
410
410
|
.map((command) => commandToItem(command))
|
|
411
411
|
.filter((item): item is ResultItem => item !== null);
|
|
412
|
+
const pluginItems = pluginCommandItems();
|
|
413
|
+
// A layout action that is also a command (Add a Desk, DESK) is listed once, as the command.
|
|
414
|
+
const commandRows = new Set([...commandItems, ...pluginItems].map((item) => `${item.label}\u0000${item.right ?? ""}`));
|
|
412
415
|
const allItems = [
|
|
413
416
|
...commandItems,
|
|
414
|
-
...buildLayoutItems("", { confirmDangerousActions: true })
|
|
417
|
+
...buildLayoutItems("", { confirmDangerousActions: true })
|
|
418
|
+
.filter((item) => !commandRows.has(`${item.label}\u0000${item.right ?? ""}`)),
|
|
415
419
|
...buildPaneSettingItems(state.focusedPaneId, rootQuery),
|
|
416
420
|
...paneShortcutItems({ includePromptableTickerTemplates: true }),
|
|
417
421
|
...nonShortcutPaneTemplateItems(),
|
|
418
422
|
...tickerActionItems(),
|
|
419
|
-
...
|
|
423
|
+
...pluginItems,
|
|
420
424
|
];
|
|
421
425
|
if (pastedList) items.push(pastedListItem(pastedList, executeCollectionCommand));
|
|
422
426
|
items.push(...rankMatchBlock(allItems, providerMatchItems, rootQuery));
|
|
@@ -4,7 +4,7 @@ import type { AppAction, AppState } from "../../../state/app/context";
|
|
|
4
4
|
import type { AppTickerRepositoryPort } from "../../../core/app-service-ports";
|
|
5
5
|
import type { PluginRegistry } from "../../../plugins/registry";
|
|
6
6
|
import { isManualPortfolio } from "../../../portfolio/mutations";
|
|
7
|
-
import { findNamedCollection, readWatchlistArgument } from "../../../portfolio/collection-name";
|
|
7
|
+
import { findNamedCollection, readWatchlistArgument, watchlistMemberSymbol } from "../../../portfolio/collection-name";
|
|
8
8
|
import type { DataProvider } from "../../../types/data-provider";
|
|
9
9
|
import type { Portfolio, TickerRecord, Watchlist } from "../../../types/ticker";
|
|
10
10
|
import { AmbiguousTickerError, resolveTickerSearch, upsertTickerFromSearchResult } from "../../../tickers/search";
|
|
@@ -278,7 +278,7 @@ export async function resolveTickerListInput(
|
|
|
278
278
|
const state = deps.getState();
|
|
279
279
|
const watchlist = /[,;\n]/.test(rawInput) ? null : findNamedCollection(state.config.watchlists, rawInput);
|
|
280
280
|
const members = watchlist
|
|
281
|
-
? [...state.tickers.values()].filter((ticker) => ticker.metadata.watchlists.includes(watchlist.id)).map((ticker) => ticker.metadata
|
|
281
|
+
? [...state.tickers.values()].filter((ticker) => ticker.metadata.watchlists.includes(watchlist.id)).map((ticker) => watchlistMemberSymbol(ticker.metadata))
|
|
282
282
|
: [];
|
|
283
283
|
if (watchlist && members.length > 0) {
|
|
284
284
|
const read = readWatchlistArgument(rawInput, watchlist, members, reading?.maximum);
|
|
@@ -13,7 +13,7 @@ import { useBeforeShortcut, useShortcut } from "../../react/input";
|
|
|
13
13
|
import { isPlainKey, isPlainKeyboardEvent } from "../../utils/keyboard";
|
|
14
14
|
import { DataTable, PaneStatusBody, type DataTableColumn, type DataTableProps, type PaneStatusBodyProps } from "../ui";
|
|
15
15
|
import { useDataTableSortMenu } from "./sort-menu";
|
|
16
|
-
import { tableScrollStep } from "../ui/table-layout";
|
|
16
|
+
import { tableFreezesFirstColumn, tableScrollStep } from "../ui/table-layout";
|
|
17
17
|
import {
|
|
18
18
|
TableViewFrame,
|
|
19
19
|
useResetTableScroll,
|
|
@@ -694,7 +694,14 @@ export function DataTableView<
|
|
|
694
694
|
columns: tableProps.columns,
|
|
695
695
|
columnGap: tableProps.columnGap,
|
|
696
696
|
horizontalPadding: tableProps.horizontalPadding,
|
|
697
|
-
frozenFirstColumn:
|
|
697
|
+
frozenFirstColumn: tableFreezesFirstColumn({
|
|
698
|
+
freezeFirstColumn: tableProps.freezeFirstColumn,
|
|
699
|
+
columns: tableProps.columns,
|
|
700
|
+
columnGap: tableProps.columnGap,
|
|
701
|
+
horizontalPadding: tableProps.horizontalPadding,
|
|
702
|
+
viewportWidth,
|
|
703
|
+
overflows: true,
|
|
704
|
+
}),
|
|
698
705
|
scrollLeft: currentLeft,
|
|
699
706
|
direction,
|
|
700
707
|
viewportWidth,
|
|
@@ -31,7 +31,8 @@ export function InputSearchBar({
|
|
|
31
31
|
width: number | "100%";
|
|
32
32
|
focusToken: number;
|
|
33
33
|
inputRef: RefObject<InputRenderable | null>;
|
|
34
|
-
|
|
34
|
+
/** Longest first: a field too narrow for one shows the next that fits. */
|
|
35
|
+
placeholder: string | readonly string[];
|
|
35
36
|
debounceMs: number;
|
|
36
37
|
/** Leading marker; override when a pane shows more than one field. */
|
|
37
38
|
glyph?: string;
|
|
@@ -137,7 +138,7 @@ export function InputSearchBar({
|
|
|
137
138
|
ref={inputRef}
|
|
138
139
|
value={draft}
|
|
139
140
|
focused={focused && active}
|
|
140
|
-
placeholder={placeholder}
|
|
141
|
+
placeholder={fittedPlaceholder(placeholder, typeof width === "number" ? width - (appearance === "strip" ? 2 : 0) : null)}
|
|
141
142
|
placeholderColor={placeholderText()}
|
|
142
143
|
textColor={colors.text}
|
|
143
144
|
focusedTextColor={colors.text}
|
|
@@ -156,6 +157,12 @@ export function InputSearchBar({
|
|
|
156
157
|
);
|
|
157
158
|
}
|
|
158
159
|
|
|
160
|
+
/** The first placeholder that fits `room` cells (all of them when the field has no fixed width), else the last. */
|
|
161
|
+
function fittedPlaceholder(placeholder: string | readonly string[], room: number | null): string {
|
|
162
|
+
if (typeof placeholder === "string") return placeholder;
|
|
163
|
+
return placeholder.find((text) => room === null || text.length <= room) ?? placeholder.at(-1) ?? "";
|
|
164
|
+
}
|
|
165
|
+
|
|
159
166
|
const SEARCH_ICON_STYLE = { marginRight: "var(--gloom-space-xs)" } as const;
|
|
160
167
|
|
|
161
168
|
const SEARCH_STRIP_STYLE = {
|
|
@@ -409,6 +409,7 @@ export function PaneHeader({
|
|
|
409
409
|
activeValue={stack.active}
|
|
410
410
|
onSelect={stack.onSelect}
|
|
411
411
|
variant="header"
|
|
412
|
+
background={backgroundColor}
|
|
412
413
|
focused={visuallyFocused}
|
|
413
414
|
keyboardNavigation={false}
|
|
414
415
|
paneMenu={false}
|
|
@@ -468,6 +469,7 @@ export function PaneHeader({
|
|
|
468
469
|
activeValue={tabs.activeValue}
|
|
469
470
|
onSelect={tabs.onSelect}
|
|
470
471
|
variant="header"
|
|
472
|
+
background={backgroundColor}
|
|
471
473
|
focused={tabs.focused}
|
|
472
474
|
keyboardNavigation={tabs.keyboardNavigation}
|
|
473
475
|
onAdd={tabs.onAdd}
|
|
@@ -10,6 +10,7 @@ import { pinnedTabTime } from "../../../../state/app/tab-cursor";
|
|
|
10
10
|
import type { LayoutConfig } from "../../../../types/config";
|
|
11
11
|
import { useRendererHost, useUiCapabilities, type NativeRendererHost } from "../../../../ui";
|
|
12
12
|
import { buildPaneSharePayload } from "../../../../shares/pane";
|
|
13
|
+
import { paneShareItemFor } from "../../../../shares/pane-item";
|
|
13
14
|
import { preparePaneShare } from "../../../../shares/prepare";
|
|
14
15
|
import { sharePaneLink, type PaneShareView } from "../../../../shares/flow";
|
|
15
16
|
import { reportPaneBug } from "../../../../shares/bug-report-flow";
|
|
@@ -74,6 +75,7 @@ export function useShellPaneCapture(options: UseShellPaneCaptureOptions): void {
|
|
|
74
75
|
const pane = current.paneMap.get(paneId);
|
|
75
76
|
if (!pane) throw new Error("Focus a pane to share it.");
|
|
76
77
|
const state = stateRef.current;
|
|
78
|
+
const personalData = panePersonalData({ registry: current.pluginRegistry, state, layout: current.layout, pane });
|
|
77
79
|
return {
|
|
78
80
|
sharePayload: publicSharing ? buildPaneSharePayload(
|
|
79
81
|
pluginRegistry,
|
|
@@ -82,8 +84,9 @@ export function useShellPaneCapture(options: UseShellPaneCaptureOptions): void {
|
|
|
82
84
|
resolveTickerForPane(state, paneId),
|
|
83
85
|
state.tickers,
|
|
84
86
|
pinnedTabTime(state),
|
|
87
|
+
paneShareItemFor({ pane, state, registry: pluginRegistry, personal: personalData !== null }),
|
|
85
88
|
) : null,
|
|
86
|
-
personalData
|
|
89
|
+
personalData,
|
|
87
90
|
};
|
|
88
91
|
}, [pluginRegistry, publicSharing, stateRef]);
|
|
89
92
|
|
|
@@ -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
|