gloomberb 0.20.2 → 0.20.3
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +2 -1
- package/src/account/auth-form.tsx +13 -8
- package/src/account/upgrade-dialog.tsx +1 -1
- package/src/api-client/central-bank-rates.ts +5 -0
- package/src/api-client/data.ts +17 -4
- package/src/api-client/debt-maturities.ts +45 -2
- package/src/api-client/earnings.ts +4 -2
- package/src/api-client/errors.ts +21 -11
- package/src/api-client/index.ts +1 -0
- package/src/api-client/paths.ts +9 -1
- package/src/api-client/social-mentions.ts +47 -0
- package/src/api-client/types/econ.ts +4 -0
- package/src/app.tsx +11 -1
- package/src/cli/command-options.ts +2 -1
- package/src/cli/commands/market.ts +111 -29
- package/src/cli/commands/options-chain.ts +23 -6
- package/src/cli/commands/overview.ts +13 -5
- package/src/cli/commands/plugins.ts +49 -18
- package/src/cli/commands/search.ts +25 -6
- package/src/cli/commands/ticker.ts +4 -2
- package/src/cli/fx-quote-rate.ts +49 -1
- package/src/cli/glossary.ts +95 -15
- package/src/cli/history-rows.ts +9 -25
- package/src/cli/index.ts +6 -38
- package/src/cli/known-gaps.ts +3 -3
- package/src/cli/listing-arg.ts +78 -18
- package/src/cli/name-entries.ts +3 -2
- package/src/cli/not-a-ticker.ts +6 -2
- package/src/cli/pane-functions/capabilities.ts +12 -1
- package/src/cli/pane-functions/function-help.ts +23 -11
- package/src/cli/pane-functions/headless.ts +3 -1
- package/src/cli/pane-functions/index.ts +32 -4
- package/src/cli/pane-functions/market-session.ts +8 -3
- package/src/cli/pane-functions/resolver.ts +18 -11
- package/src/cli/pane-functions/screenshot-payload.ts +36 -6
- package/src/cli/pane-functions/screenshot-render.ts +4 -0
- package/src/cli/quote-answer.ts +10 -0
- package/src/cli/report-tables.ts +22 -2
- package/src/cli/result.ts +7 -3
- package/src/cli/spreadsheet-hint.ts +43 -0
- package/src/cli/symbol-list.ts +58 -4
- package/src/cli/symbol-rows.ts +49 -2
- package/src/cli/ticker-resolution.ts +98 -5
- package/src/cli/unknown-command.ts +88 -0
- package/src/components/command-bar/assist/model.ts +6 -1
- package/src/components/command-bar/commands/direct/index.ts +9 -1
- package/src/components/command-bar/commands/registry.ts +18 -0
- package/src/components/command-bar/pane-actions.ts +30 -13
- package/src/components/command-bar/panel/index.tsx +6 -3
- package/src/components/command-bar/panel/prompt-binding.ts +4 -0
- package/src/components/command-bar/panel/types.ts +3 -0
- package/src/components/command-bar/routes/header-market.ts +108 -0
- package/src/components/command-bar/routes/root/command-items.ts +5 -0
- package/src/components/command-bar/routes/root/provider-search.ts +190 -32
- package/src/components/command-bar/routes/root/results.ts +3 -0
- package/src/components/command-bar/routes/root/runtime.ts +28 -5
- package/src/components/command-bar/routes/ticker-search/results.ts +53 -6
- package/src/components/command-bar/routing/list-state.ts +38 -0
- package/src/components/command-bar/selection-hint.ts +28 -0
- package/src/components/command-bar/surface/index.tsx +41 -3
- package/src/components/command-bar/view-model.ts +15 -0
- package/src/components/command-bar/workflow/tickers.ts +3 -2
- package/src/components/company-logo.tsx +20 -2
- package/src/components/data-table/export.ts +13 -8
- package/src/components/feedback-dialog.tsx +2 -1
- package/src/components/form-modal/field-row.tsx +2 -1
- package/src/components/input-search-bar.tsx +2 -2
- package/src/components/layout/double-escape-close.ts +8 -5
- package/src/components/layout/header.tsx +75 -44
- package/src/components/layout/market-summary.ts +322 -116
- package/src/components/layout/pane/footer/index.tsx +26 -8
- package/src/components/layout/pane/footer/model.ts +46 -20
- package/src/components/layout/pane/header.tsx +3 -2
- package/src/components/layout/shell/chrome.ts +15 -15
- package/src/components/layout/status-bar.tsx +8 -7
- package/src/components/layout/status-widget-space.ts +8 -0
- package/src/components/markdown-editor.tsx +2 -2
- package/src/components/onboarding/account-step/form-panel.tsx +0 -3
- package/src/components/onboarding/onboarding-keyboard.ts +15 -6
- package/src/components/onboarding/onboarding-wizard.tsx +61 -11
- package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +0 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +0 -2
- package/src/components/price-sparkline/model.ts +26 -10
- package/src/components/ticker/list-table-view.tsx +29 -4
- package/src/components/ui/button.tsx +13 -2
- package/src/components/ui/column-grid.tsx +18 -9
- package/src/components/ui/data-table/index.tsx +1 -1
- package/src/components/ui/data-table/opentui/index.tsx +2 -1
- package/src/components/ui/data-table/types.ts +18 -0
- package/src/components/ui/delayed-mark.tsx +3 -2
- package/src/components/ui/field-grid.tsx +0 -2
- package/src/components/ui/fields.tsx +7 -4
- package/src/components/ui/inline-quick-add.tsx +2 -2
- package/src/components/ui/key-hint-words.ts +153 -0
- package/src/components/ui/key-hints.tsx +73 -0
- package/src/components/ui/menu.tsx +3 -1
- package/src/components/ui/message-composer.tsx +2 -2
- package/src/components/ui/shortcut-hint.tsx +28 -3
- package/src/components/ui/tabs.tsx +7 -0
- package/src/components/ui/text-prompt-dialog.tsx +2 -1
- package/src/core/state/app/command-bar-launch.ts +3 -0
- package/src/data/config/store/normalize.ts +6 -0
- package/src/docs/snapshot.json +120 -69
- package/src/i18n/es.ts +24 -1
- package/src/i18n/ja.ts +24 -1
- package/src/i18n/ko.ts +24 -1
- package/src/i18n/zh-cn.ts +24 -1
- package/src/i18n/zh-tw.ts +24 -1
- package/src/layout/pane-manager/gridlock.ts +11 -0
- package/src/market-data/bars-per-year.ts +27 -9
- package/src/market-data/coordinator/quotes.ts +22 -3
- package/src/market-data/futures-board.ts +80 -0
- package/src/market-data/futures-contract.ts +9 -3
- package/src/market-data/market/change-basis.ts +2 -2
- package/src/market-data/market/dated-previous-close.ts +163 -47
- package/src/market-data/market/format.ts +14 -3
- package/src/market-data/market/freshness.ts +24 -7
- package/src/market-data/market/header-market.ts +154 -0
- package/src/market-data/market/index-level.ts +29 -0
- package/src/market-data/market/index-session-venues.ts +44 -0
- package/src/market-data/market/status.ts +7 -2
- package/src/market-data/market/venue-session.ts +72 -0
- package/src/market-data/model-dividend-yield.ts +23 -8
- package/src/market-data/options-alternatives.ts +39 -4
- package/src/market-data/published-apac-sessions.ts +40 -2
- package/src/market-data/quotes/export-identity.ts +76 -0
- package/src/market-data/quotes/freshness.ts +22 -0
- package/src/market-data/quotes/time.ts +42 -1
- package/src/market-data/realized-volatility.ts +11 -7
- package/src/market-data/tax-equivalent.ts +145 -27
- package/src/plugins/builtin/account-management/pane.tsx +2 -2
- package/src/plugins/builtin/alerts/alert-engine.ts +12 -6
- package/src/plugins/builtin/alerts/alert-log.ts +6 -2
- package/src/plugins/builtin/alerts/calendar-events.ts +74 -12
- package/src/plugins/builtin/alerts/cli-forms.ts +11 -1
- package/src/plugins/builtin/alerts/cli-move.ts +234 -0
- package/src/plugins/builtin/alerts/cli.ts +224 -33
- package/src/plugins/builtin/alerts/command.ts +33 -6
- package/src/plugins/builtin/alerts/event-rows.ts +18 -4
- package/src/plugins/builtin/alerts/events-pane.tsx +6 -2
- package/src/plugins/builtin/alerts/events.ts +9 -0
- package/src/plugins/builtin/alerts/format.ts +40 -15
- package/src/plugins/builtin/alerts/headless.ts +31 -18
- package/src/plugins/builtin/alerts/history.ts +1 -0
- package/src/plugins/builtin/alerts/index.tsx +86 -12
- package/src/plugins/builtin/alerts/live.ts +2 -1
- package/src/plugins/builtin/alerts/move-checks.ts +155 -0
- package/src/plugins/builtin/alerts/move.ts +160 -0
- package/src/plugins/builtin/alerts/pane.tsx +52 -22
- package/src/plugins/builtin/alerts/price-text.ts +62 -0
- package/src/plugins/builtin/alerts/price.ts +17 -0
- package/src/plugins/builtin/alerts/quotes.ts +84 -3
- package/src/plugins/builtin/alerts/scheduled-check.ts +7 -1
- package/src/plugins/builtin/alerts/storage.ts +20 -7
- package/src/plugins/builtin/alerts/types.ts +13 -0
- package/src/plugins/builtin/analytics/risk-client.ts +60 -39
- package/src/plugins/builtin/analytics/risk-episodes.ts +18 -0
- package/src/plugins/builtin/analytics/risk-headless.ts +20 -4
- package/src/plugins/builtin/analytics/risk-model.ts +68 -1
- package/src/plugins/builtin/analytics/risk-pane.tsx +15 -3
- package/src/plugins/builtin/backtest/engine.ts +4 -2
- package/src/plugins/builtin/backtest/window.ts +3 -1
- package/src/plugins/builtin/broker-manager/sign-in-end.ts +1 -1
- package/src/plugins/builtin/central-bank-rates/client.ts +4 -0
- package/src/plugins/builtin/central-bank-rates/headless.ts +1 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +18 -8
- package/src/plugins/builtin/central-bank-rates/pane.tsx +6 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +5 -0
- package/src/plugins/builtin/chart-composer/headless-schema.ts +17 -1
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +9 -2
- package/src/plugins/builtin/crypto-board/headless.ts +82 -17
- package/src/plugins/builtin/crypto-board/index.tsx +24 -2
- package/src/plugins/builtin/crypto-board/model.ts +5 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +4 -1
- package/src/plugins/builtin/debt-maturities/client.ts +111 -6
- package/src/plugins/builtin/debt-maturities/headless.ts +84 -1
- package/src/plugins/builtin/debt-maturities/model.ts +97 -14
- package/src/plugins/builtin/debt-maturities/pane.tsx +165 -15
- package/src/plugins/builtin/debt-maturities/series.ts +3 -1
- package/src/plugins/builtin/dividend-yield/client.ts +22 -6
- package/src/plugins/builtin/dividend-yield/headless.ts +113 -46
- package/src/plugins/builtin/dividend-yield/model.ts +5 -2
- package/src/plugins/builtin/dividend-yield/pane.tsx +6 -3
- package/src/plugins/builtin/dividend-yield/ranking-reads.ts +11 -4
- package/src/plugins/builtin/dividend-yield/ranking.ts +113 -18
- package/src/plugins/builtin/dividend-yield/types.ts +2 -0
- package/src/plugins/builtin/dividend-yield/view.ts +3 -0
- package/src/plugins/builtin/econ/calendar-model.ts +21 -3
- package/src/plugins/builtin/econ/detail-view.tsx +5 -3
- package/src/plugins/builtin/econ/figures.ts +13 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +6 -3
- package/src/plugins/builtin/econ/index.tsx +5 -3
- package/src/plugins/builtin/econ/types.ts +5 -0
- package/src/plugins/builtin/equity-screener/footer.ts +45 -0
- package/src/plugins/builtin/equity-screener/pane.tsx +4 -18
- package/src/plugins/builtin/equity-screener/ticker-check.tsx +2 -1
- package/src/plugins/builtin/fixed-income/model.ts +1 -0
- package/src/plugins/builtin/futures/table.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +3 -10
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/function-index.ts +1 -0
- package/src/plugins/builtin/insider/client.ts +31 -14
- package/src/plugins/builtin/insider/signals-model.ts +2 -7
- package/src/plugins/builtin/iv-history/headless.ts +1 -2
- package/src/plugins/builtin/iv-history/model.ts +33 -23
- package/src/plugins/builtin/iv-history/screen-pane.tsx +0 -3
- package/src/plugins/builtin/kelly-sizer/headless.ts +64 -16
- package/src/plugins/builtin/kelly-sizer/history.ts +37 -28
- package/src/plugins/builtin/kelly-sizer/pane.tsx +43 -10
- package/src/plugins/builtin/kelly-sizer/sections.tsx +7 -2
- package/src/plugins/builtin/kelly-sizer/units.ts +29 -0
- package/src/plugins/builtin/news/index.tsx +7 -13
- package/src/plugins/builtin/news/overview-headlines.tsx +117 -0
- package/src/plugins/builtin/news/ticker-news.ts +35 -0
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +8 -6
- package/src/plugins/builtin/news/wire/news/row.ts +49 -0
- package/src/plugins/builtin/news/wire/news/table.tsx +9 -20
- package/src/plugins/builtin/options/analytics.ts +7 -2
- package/src/plugins/builtin/options/live-quotes.ts +6 -1
- package/src/plugins/builtin/options/table.ts +3 -2
- package/src/plugins/builtin/options/view.tsx +11 -9
- package/src/plugins/builtin/options-scenario/client.ts +3 -0
- package/src/plugins/builtin/options-scenario/headless.ts +1 -1
- package/src/plugins/builtin/perps/client.ts +5 -4
- package/src/plugins/builtin/perps/headless.ts +134 -124
- package/src/plugins/builtin/perps/markets-section.tsx +2 -2
- package/src/plugins/builtin/perps/model.ts +8 -4
- package/src/plugins/builtin/perps/open-market.ts +4 -4
- package/src/plugins/builtin/perps/venue-markets.ts +3 -6
- package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -0
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +34 -10
- package/src/plugins/builtin/portfolio-list/cli/period-report.ts +28 -2
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +7 -3
- package/src/plugins/builtin/portfolio-list/cli/render.ts +66 -22
- package/src/plugins/builtin/portfolio-list/grid.tsx +5 -3
- package/src/plugins/builtin/portfolio-list/pane/data.ts +34 -1
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -0
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +15 -6
- package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +19 -7
- package/src/plugins/builtin/portfolio-list/table.tsx +30 -4
- package/src/plugins/builtin/realized-vol/evidence.ts +33 -6
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +135 -0
- package/src/plugins/builtin/realized-vol/headless.ts +44 -8
- package/src/plugins/builtin/realized-vol/model.ts +9 -5
- package/src/plugins/builtin/realized-vol/pane.tsx +49 -15
- package/src/plugins/builtin/sec/headless.ts +48 -6
- package/src/plugins/builtin/sec/index.tsx +6 -4
- package/src/plugins/builtin/sec/model.ts +4 -1
- package/src/plugins/builtin/shared/earnings-calendar.ts +2 -0
- package/src/plugins/builtin/shared/market-cap-bands.ts +12 -0
- package/src/plugins/builtin/shared/report-freshness.ts +3 -1
- package/src/plugins/builtin/shared/use-quote-board.ts +5 -3
- package/src/plugins/builtin/shared/volatility/options.ts +63 -2
- package/src/plugins/builtin/social-mentions/headless.ts +72 -3
- package/src/plugins/builtin/social-mentions/index.tsx +8 -4
- package/src/plugins/builtin/social-mentions/lock-note.ts +6 -2
- package/src/plugins/builtin/social-mentions/outliers-client.ts +101 -0
- package/src/plugins/builtin/social-mentions/outliers-model.ts +162 -0
- package/src/plugins/builtin/social-mentions/outliers-names.ts +51 -0
- package/src/plugins/builtin/social-mentions/outliers.tsx +276 -0
- package/src/plugins/builtin/social-mentions/pane.tsx +32 -3
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -2
- package/src/plugins/builtin/thirteenf/api.ts +36 -2
- package/src/plugins/builtin/thirteenf/data.ts +4 -1
- package/src/plugins/builtin/thirteenf/headless.ts +14 -6
- package/src/plugins/builtin/thirteenf/model.ts +56 -1
- package/src/plugins/builtin/thirteenf/pane.tsx +8 -8
- package/src/plugins/builtin/thirteenf/report-notes.ts +11 -0
- package/src/plugins/builtin/thirteenf/table.ts +2 -1
- package/src/plugins/builtin/thirteenf/types.ts +6 -0
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +23 -3
- package/src/plugins/builtin/ticker-detail/financials/model.ts +5 -0
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -1
- package/src/plugins/builtin/ticker-detail/headless.ts +21 -66
- package/src/plugins/builtin/ticker-detail/index.tsx +5 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +13 -1
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +15 -0
- package/src/plugins/builtin/ticker-detail/overview/tax-equivalent.ts +69 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +41 -6
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +47 -24
- package/src/plugins/builtin/ticker-detail/quote-monitor/export.ts +46 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +20 -1
- package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +120 -0
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +1 -5
- package/src/plugins/builtin/ticker-detail/settings.ts +6 -6
- package/src/plugins/builtin/treasury-auctions/cache.ts +85 -19
- package/src/plugins/builtin/treasury-auctions/index.tsx +22 -11
- package/src/plugins/builtin/treasury-auctions/model.ts +23 -0
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +128 -0
- package/src/plugins/builtin/world-indices/client.ts +2 -0
- package/src/plugins/compat.ts +15 -0
- package/src/plugins/host-link.ts +6 -1
- package/src/plugins/installer.ts +8 -3
- package/src/portfolio/column-values.ts +14 -4
- package/src/portfolio/listed-symbol.ts +78 -0
- package/src/portfolio/real-return.ts +172 -0
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/browser/config-host.ts +56 -15
- package/src/renderers/browser/main.tsx +3 -1
- package/src/renderers/browser/ui-host.tsx +1 -0
- package/src/renderers/cloudflare/http-proxy.ts +1 -0
- package/src/renderers/dom/boot-frame.ts +2 -2
- package/src/renderers/dom/data-table/row.tsx +4 -1
- package/src/renderers/dom/desktop/controls.tsx +4 -4
- package/src/renderers/dom/desktop/dialog-actions.tsx +60 -41
- package/src/renderers/dom/dom-ui-host.tsx +3 -1
- package/src/renderers/dom/host/input.tsx +4 -1
- package/src/renderers/dom/host/tabs.tsx +10 -1
- package/src/renderers/dom/styles.css +33 -13
- package/src/renderers/electrobun/bun/desktop/app-name.ts +1 -1
- package/src/renderers/opentui/host.tsx +2 -1
- package/src/sources/gloomberb-cloud/fred-series.ts +12 -0
- package/src/sources/gloomberb-cloud/index.ts +31 -2
- package/src/sources/gloomberb-cloud/normalizers.ts +29 -3
- package/src/sources/provider-router/cached-routes.ts +19 -7
- package/src/state/pane-table-export-registry.ts +19 -6
- package/src/test-support/preload.ts +5 -1
- package/src/theme/colors.ts +9 -1
- package/src/theme/themes.ts +62 -15
- package/src/theme/tone-contrast.ts +40 -0
- package/src/theme/ui-tokens.ts +23 -3
- package/src/tickers/batched-lookups.ts +57 -8
- package/src/tickers/company-name-listing.ts +156 -14
- package/src/tickers/company-name.ts +30 -6
- package/src/tickers/list.ts +7 -0
- package/src/tickers/search/home-listing.ts +31 -9
- package/src/tickers/search/index.ts +13 -3
- package/src/tickers/search/listing-index.ts +558 -0
- package/src/tickers/search/major-listings.chunk.ts +10 -0
- package/src/tickers/search/major-listings.json +3346 -0
- package/src/tickers/search/ranking.ts +68 -1
- package/src/tickers/search/types.ts +4 -0
- package/src/tickers/terminal-codes.ts +26 -1
- package/src/time-series/calendar-month-returns.ts +47 -0
- package/src/time-series/currency-conversion.ts +130 -0
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +34 -11
- package/src/time-series/resolve-context.ts +3 -0
- package/src/time-series/resolve.ts +14 -2
- package/src/time-series/spec.ts +1 -0
- package/src/time-series/studies/indicators.ts +4 -1
- package/src/time-series/types.ts +8 -0
- package/src/types/config.ts +8 -0
- package/src/types/data-provider.ts +28 -0
- package/src/types/financials.ts +20 -2
- package/src/types/headless.ts +12 -0
- package/src/ui/host.tsx +8 -0
- package/src/utils/datetime-format.ts +17 -3
- package/src/utils/display-number.ts +15 -0
- package/src/utils/double-escape-close.ts +61 -16
- package/src/utils/float32-price.ts +24 -0
- package/src/utils/forward-dividend.ts +81 -16
- package/src/utils/fx-market-hours.ts +11 -0
- package/src/utils/plugin-proxy-hosts.json +2 -1
- package/src/utils/price-history.ts +7 -6
- package/src/utils/report-timing.ts +62 -0
- package/src/utils/sec-filings.ts +32 -0
- package/src/utils/utc-time.ts +5 -0
|
@@ -4,6 +4,7 @@ import { type CompanyFrom, companyFromLabel } from "../../../../types/company-fr
|
|
|
4
4
|
import { clipToDisplayWidth, displayWidth } from "../../../../utils/format";
|
|
5
5
|
import { formatShortDate } from "../../../../utils/datetime-format";
|
|
6
6
|
import { getShortcutHintWidth } from "../../../ui/shortcut-hint";
|
|
7
|
+
import { KEY_HINT_GAP_PX, keycapText, keyHintCells, keyHintTitle, keyHintWords } from "../../../ui/key-hint-words";
|
|
7
8
|
|
|
8
9
|
export interface PaneFooterRegistration {
|
|
9
10
|
order?: number;
|
|
@@ -229,10 +230,20 @@ export interface PaneFooterPart {
|
|
|
229
230
|
export interface PaneHint {
|
|
230
231
|
id: string;
|
|
231
232
|
key: string;
|
|
233
|
+
/**
|
|
234
|
+
* What the terminal writes after `[key]`: the rest of the word when a letter
|
|
235
|
+
* key starts it (`"dd"`, `[a]dd`), a space and the words when it does not
|
|
236
|
+
* (`" remove"`, `[x] remove`), and the words after any other key (`"pick"`
|
|
237
|
+
* after `Enter`). The desktop and the web show the key in a keycap before
|
|
238
|
+
* the whole words, read from this (keyHintWords).
|
|
239
|
+
*/
|
|
232
240
|
label: string;
|
|
233
241
|
/**
|
|
234
242
|
* The action's full name in the pane menu. Defaults to the hint read as one
|
|
235
|
-
* word (`[a]dd` is "Add"); set it when the key is not the first letter
|
|
243
|
+
* word (`[a]dd` is "Add"); set it when the key is not the first letter, and
|
|
244
|
+
* when the label is a whole word right after a letter key (`[m]re-arm`), so
|
|
245
|
+
* the desktop reads "re-arm", not "mre-arm". An `id` that names the label
|
|
246
|
+
* (`id: "rearm"`) does the same for the desktop.
|
|
236
247
|
*/
|
|
237
248
|
title?: string;
|
|
238
249
|
onPress?: (event?: PaneFooterPressEvent) => void;
|
|
@@ -296,12 +307,34 @@ type PaneHintKeyLabel = (key: string) => string;
|
|
|
296
307
|
|
|
297
308
|
const KEY_AS_WRITTEN: PaneHintKeyLabel = (key) => key;
|
|
298
309
|
|
|
299
|
-
|
|
300
|
-
|
|
310
|
+
/** How much room hints take on a host, in cells: each hint, and the gap between two. */
|
|
311
|
+
export interface PaneHintMetrics {
|
|
312
|
+
width(hint: Pick<PaneHint, "key" | "label" | "title" | "id">): number;
|
|
313
|
+
gap: number;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/** The terminal's hints: `[s]eries`, a column apart. `keyLabel` writes the key as the host shows it. */
|
|
317
|
+
export function terminalHintMetrics(keyLabel: PaneHintKeyLabel = KEY_AS_WRITTEN): PaneHintMetrics {
|
|
318
|
+
return { width: (hint) => getShortcutHintWidth(keyLabel(hint.key), hint.label), gap: HINT_GAP };
|
|
301
319
|
}
|
|
302
320
|
|
|
303
|
-
|
|
304
|
-
|
|
321
|
+
/**
|
|
322
|
+
* The desktop's and the web's hints: a keycap and the whole words (KeyHint),
|
|
323
|
+
* farther apart, on a grid of `cellPx` cells. The text scales with the cell
|
|
324
|
+
* and the spacing does not, so pass the live cell (useUiCapabilities().cellWidthPx).
|
|
325
|
+
*/
|
|
326
|
+
export function desktopHintMetrics(cellPx: number): PaneHintMetrics {
|
|
327
|
+
return {
|
|
328
|
+
width: (hint) => keyHintCells(keycapText(hint.key), keyHintWords(hint), cellPx),
|
|
329
|
+
gap: KEY_HINT_GAP_PX / cellPx,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const TERMINAL_HINT_METRICS = terminalHintMetrics();
|
|
334
|
+
|
|
335
|
+
/** Cells `hints` take side by side, rounded up to a whole cell. */
|
|
336
|
+
export function totalHintsWidth(hints: readonly Pick<PaneHint, "key" | "label" | "title" | "id">[], metrics: PaneHintMetrics = TERMINAL_HINT_METRICS): number {
|
|
337
|
+
return Math.ceil(hints.reduce((total, hint, index) => total + (index > 0 ? metrics.gap : 0) + metrics.width(hint), 0) - 1e-9);
|
|
305
338
|
}
|
|
306
339
|
|
|
307
340
|
function infoTextWidth(segments: readonly PaneFooterSegment[]): number {
|
|
@@ -418,7 +451,7 @@ export function layoutPaneFooterHintRow(
|
|
|
418
451
|
footer: CombinedPaneFooter,
|
|
419
452
|
contentWidth: number,
|
|
420
453
|
iconReserve = 0,
|
|
421
|
-
|
|
454
|
+
metrics: PaneHintMetrics = TERMINAL_HINT_METRICS,
|
|
422
455
|
): PaneFooterHintRow {
|
|
423
456
|
const width = Math.max(0, Math.floor(contentWidth));
|
|
424
457
|
const hints = footer.hints.filter((hint) => !hint.disabled);
|
|
@@ -434,12 +467,12 @@ export function layoutPaneFooterHintRow(
|
|
|
434
467
|
const more = moreControl(hintBudget);
|
|
435
468
|
let visible = hints;
|
|
436
469
|
let overflow: PaneHint[] = [];
|
|
437
|
-
if (totalHintsWidth(hints,
|
|
438
|
-
const room = Math.max(0, hintBudget - more.width - (more.width > 0 ?
|
|
470
|
+
if (totalHintsWidth(hints, metrics) > hintBudget) {
|
|
471
|
+
const room = Math.max(0, hintBudget - more.width - (more.width > 0 ? metrics.gap : 0));
|
|
439
472
|
visible = [];
|
|
440
473
|
let used = 0;
|
|
441
474
|
for (const hint of hints) {
|
|
442
|
-
const next = used + (visible.length > 0 ?
|
|
475
|
+
const next = used + (visible.length > 0 ? metrics.gap : 0) + metrics.width(hint);
|
|
443
476
|
if (next > room) break;
|
|
444
477
|
visible.push(hint);
|
|
445
478
|
used = next;
|
|
@@ -447,8 +480,8 @@ export function layoutPaneFooterHintRow(
|
|
|
447
480
|
overflow = hints.slice(visible.length);
|
|
448
481
|
}
|
|
449
482
|
const hintsWidth = overflow.length > 0
|
|
450
|
-
? totalHintsWidth(visible,
|
|
451
|
-
: totalHintsWidth(visible,
|
|
483
|
+
? Math.ceil(totalHintsWidth(visible, metrics) + (visible.length > 0 ? metrics.gap : 0) + more.width)
|
|
484
|
+
: totalHintsWidth(visible, metrics);
|
|
452
485
|
return {
|
|
453
486
|
hints: visible,
|
|
454
487
|
overflow,
|
|
@@ -460,15 +493,8 @@ export function layoutPaneFooterHintRow(
|
|
|
460
493
|
}
|
|
461
494
|
|
|
462
495
|
/** The name a hint goes by in the pane menu: `[a]dd` is "Add", `[r]efresh` is "Refresh". */
|
|
463
|
-
export function paneHintTitle(hint: Pick<PaneHint, "key" | "label" | "title">): string {
|
|
464
|
-
|
|
465
|
-
const label = hint.label.trim();
|
|
466
|
-
const key = hint.key;
|
|
467
|
-
const joined = key.length === 1 && /^[a-z]$/i.test(key) && /^[a-z]/.test(hint.label)
|
|
468
|
-
&& !label.toLowerCase().startsWith(key.toLowerCase())
|
|
469
|
-
? `${key}${label}`
|
|
470
|
-
: label;
|
|
471
|
-
return joined.charAt(0).toUpperCase() + joined.slice(1);
|
|
496
|
+
export function paneHintTitle(hint: Pick<PaneHint, "key" | "label" | "title" | "id">): string {
|
|
497
|
+
return keyHintTitle(hint);
|
|
472
498
|
}
|
|
473
499
|
|
|
474
500
|
export function hasPaneFooterContent(footer?: CombinedPaneFooter | null): boolean {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Box, Text, useActionShortcut, useNativeRenderer, useRendererHost, useUiCapabilities } from "../../../ui";
|
|
2
2
|
import { useCallback, useMemo, useRef, type ReactNode } from "react";
|
|
3
3
|
import { colors, floatingPaneTitleBg, paneTitleBg, paneTitleText } from "../../../theme/colors";
|
|
4
|
+
import { paneTitleTone } from "../../../theme/tone-contrast";
|
|
4
5
|
import { WEB_CELL_WIDTH } from "../../../theme/font-scale";
|
|
5
6
|
import { displayWidth, truncateToDisplayWidth } from "../../../utils/format";
|
|
6
7
|
import { capturePointerDrag } from "../../../ui/pointer-drag";
|
|
@@ -579,7 +580,7 @@ export function PaneHeader({
|
|
|
579
580
|
<TerminalPaneButton
|
|
580
581
|
key={setting.key}
|
|
581
582
|
text={quickSettingText(setting)}
|
|
582
|
-
fg={setting.active ? colors.warning : colors.textDim}
|
|
583
|
+
fg={setting.active ? paneTitleTone(colors.warning, visuallyFocused, floating) : colors.textDim}
|
|
583
584
|
role="pane-quick-setting"
|
|
584
585
|
onMouseDown={setting.onMouseDown}
|
|
585
586
|
/>
|
|
@@ -640,7 +641,7 @@ export function PaneHeader({
|
|
|
640
641
|
<TerminalPaneButton
|
|
641
642
|
key={setting.key}
|
|
642
643
|
text={quickSettingText(setting)}
|
|
643
|
-
fg={setting.active ? colors.warning : colors.textDim}
|
|
644
|
+
fg={setting.active ? paneTitleTone(colors.warning, visuallyFocused, floating) : colors.textDim}
|
|
644
645
|
role="pane-quick-setting"
|
|
645
646
|
onMouseDown={setting.onMouseDown}
|
|
646
647
|
/>
|
|
@@ -16,22 +16,21 @@ const COMMAND_SURFACE_MIN_WIDTH = { native: 46, terminal: 42 };
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Market budgets used to size the command prompt, widest first. These stay
|
|
19
|
-
* independent of label wording so a longer
|
|
20
|
-
* or the sheet attached to it:
|
|
19
|
+
* independent of label wording so a longer state or a wider index level
|
|
20
|
+
* cannot resize the prompt or the sheet attached to it:
|
|
21
21
|
*
|
|
22
|
-
* 42
|
|
23
|
-
* 31
|
|
24
|
-
* 21
|
|
22
|
+
* 42 the exchange's state and the market ("NYSE closed S&P 500 6,843 +0.20%")
|
|
23
|
+
* 31 a short state and the market
|
|
24
|
+
* 21 the market alone, a wide name or level (`Hang Seng 24,533`) without its move
|
|
25
25
|
*
|
|
26
26
|
* Steps rather than a share of the window: a reserve of, say, 18 columns is
|
|
27
|
-
* too narrow for anything and would waste all 18.
|
|
28
|
-
* step for "everything but the countdown", which would cost the sheet eleven
|
|
29
|
-
* columns to add the base currency, the one value here that barely moves.
|
|
27
|
+
* too narrow for anything and would waste all 18.
|
|
30
28
|
*/
|
|
31
29
|
const HEADER_MARKET_TIERS = [42, 31, 21] as const;
|
|
32
30
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
31
|
+
* The most the cluster takes from room the prompt and the update status leave
|
|
32
|
+
* over: the state with when the session opens or closes, and the market, as in
|
|
33
|
+
* "NYSE pre-market · opens 9:30 ET S&P 500 6,843 +0.20%".
|
|
35
34
|
*/
|
|
36
35
|
const HEADER_MARKET_FULL_COLUMNS = 64;
|
|
37
36
|
|
|
@@ -117,11 +116,12 @@ export function resolveHeaderPromptGeometry(options: {
|
|
|
117
116
|
termWidth - left - updateReserve - marketReserve,
|
|
118
117
|
),
|
|
119
118
|
);
|
|
120
|
-
// Spend only space left after the prompt and update reserve have their room
|
|
121
|
-
// The longer market label gives way before either can
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
// Spend only space left after the prompt and update reserve have their room,
|
|
120
|
+
// up to the full cluster. The longer market label gives way before either can
|
|
121
|
+
// lose a column, and a header too narrow for a reserve stays without one.
|
|
122
|
+
const spare = termWidth - left - width - updateReserve;
|
|
123
|
+
const marketColumns = options.allowMarketExpansion !== false && marketReserve > 0
|
|
124
|
+
? Math.max(marketReserve, Math.min(HEADER_MARKET_FULL_COLUMNS, spare))
|
|
125
125
|
: marketReserve;
|
|
126
126
|
return { left, width, marketColumns, updateColumns: Math.max(0, termWidth - left - width - marketColumns) };
|
|
127
127
|
}
|
|
@@ -43,6 +43,7 @@ import { getDesktopWindows, layoutMoveTargets } from "../../state/desktop-window
|
|
|
43
43
|
import { fireAndForget } from "../../utils/fire-and-forget";
|
|
44
44
|
import { recordFunctionOpen } from "../../telemetry/usage-counts";
|
|
45
45
|
import {
|
|
46
|
+
NARROW_STATUS_BAR_COLUMNS,
|
|
46
47
|
STATUS_WIDGET_COLUMNS,
|
|
47
48
|
useClaimedStatusWidgetColumns,
|
|
48
49
|
usePublishStatusWidgetRoom,
|
|
@@ -109,8 +110,6 @@ function truncate(text: string, width: number): string {
|
|
|
109
110
|
/** The longest a layout tab's name runs, and the shortest a narrow bar cuts every name to before its tabs scroll. */
|
|
110
111
|
const LAYOUT_NAME_MAX = 14;
|
|
111
112
|
const LAYOUT_NAME_MIN = 8;
|
|
112
|
-
/** Below this many columns the bar cuts the names to fit, as Tidy stacks the panes in one column. */
|
|
113
|
-
const NARROW_TERMINAL_WIDTH = 80;
|
|
114
113
|
|
|
115
114
|
const openLayoutWorkflow = (actionId: "new-layout" | "rename-layout") => {
|
|
116
115
|
openFormModal({ kind: "builtin", actionId });
|
|
@@ -176,8 +175,10 @@ export function StatusBar() {
|
|
|
176
175
|
const layoutTab = (index: number, nameWidth: number, activeCut?: ActiveTabCut) => {
|
|
177
176
|
const layout = layouts[index]!;
|
|
178
177
|
const cut = index === activeLayoutIdx ? activeCut : undefined;
|
|
178
|
+
const key = cut?.key === false ? "" : tabKey(index);
|
|
179
179
|
return {
|
|
180
|
-
label: `${
|
|
180
|
+
label: `${key}${truncate(layout.name, cut?.nameWidth ?? nameWidth)}${layoutMarkers[index] ?? ""}`,
|
|
181
|
+
...(key ? { keyPrefix: key } : {}),
|
|
181
182
|
value: String(index),
|
|
182
183
|
reorderable: true,
|
|
183
184
|
};
|
|
@@ -220,7 +221,7 @@ export function StatusBar() {
|
|
|
220
221
|
// end of a name (`CIO` of `FX Desk - CIO`).
|
|
221
222
|
const overflowsAt = (width: number) => !nativePaneChrome && tabsWidthOf(savedLayoutTabsAt(width)) > tabsRoom;
|
|
222
223
|
let nameWidth = LAYOUT_NAME_MAX;
|
|
223
|
-
if (termWidth <
|
|
224
|
+
if (termWidth < NARROW_STATUS_BAR_COLUMNS) {
|
|
224
225
|
while (overflowsAt(nameWidth) && nameWidth > LAYOUT_NAME_MIN) nameWidth -= 1;
|
|
225
226
|
if (overflowsAt(nameWidth)) nameWidth = LAYOUT_NAME_MAX;
|
|
226
227
|
}
|
|
@@ -231,13 +232,13 @@ export function StatusBar() {
|
|
|
231
232
|
if (activeTooWide()) Object.assign(activeCut, { key: false, nameWidth });
|
|
232
233
|
while (activeTooWide() && activeCut.nameWidth > 1) activeCut.nameWidth -= 1;
|
|
233
234
|
const savedLayoutTabs = savedLayoutTabsAt(nameWidth, activeCut);
|
|
235
|
+
const transientKey = transientLayout?.shortcutActionId ? actionKey(transientLayout.shortcutActionId) : "";
|
|
234
236
|
const layoutTabs = transientLayout
|
|
235
237
|
? [
|
|
236
238
|
...savedLayoutTabs,
|
|
237
239
|
{
|
|
238
|
-
label: [transientLayout.
|
|
239
|
-
|
|
240
|
-
.join(" "),
|
|
240
|
+
label: [transientKey, transientLayout.label].filter(Boolean).join(" "),
|
|
241
|
+
...(transientKey ? { keyPrefix: `${transientKey} ` } : {}),
|
|
241
242
|
value: transientLayout.id,
|
|
242
243
|
reorderable: false,
|
|
243
244
|
},
|
|
@@ -10,6 +10,14 @@ import { useEffect, useSyncExternalStore } from "react";
|
|
|
10
10
|
/** Held back for the widgets whether or not they claim more. */
|
|
11
11
|
export const STATUS_WIDGET_COLUMNS = 20;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Below this many columns the status bar is a narrow terminal's or a phone's,
|
|
15
|
+
* as Tidy reads the same width: the layout tabs are cut to fit in the
|
|
16
|
+
* terminal, and on the desktop and the web, where the tabs give way to the
|
|
17
|
+
* widgets, a widget takes its short form so the tab in front shows whole.
|
|
18
|
+
*/
|
|
19
|
+
export const NARROW_STATUS_BAR_COLUMNS = 80;
|
|
20
|
+
|
|
13
21
|
const claims = new Map<string, number>();
|
|
14
22
|
let room = Number.POSITIVE_INFINITY;
|
|
15
23
|
const listeners = new Set<() => void>();
|
|
@@ -2,7 +2,7 @@ import { Textarea, useSyntaxStyleFactory } from "../ui";
|
|
|
2
2
|
import { type SyntaxStyleLike } from "../ui";
|
|
3
3
|
import { useRef, useEffect, useCallback } from "react";
|
|
4
4
|
import { type Highlight, type TextareaRenderable } from "../ui";
|
|
5
|
-
import { colors } from "../theme/colors";
|
|
5
|
+
import { colors, placeholderText } from "../theme/colors";
|
|
6
6
|
|
|
7
7
|
interface LinePattern {
|
|
8
8
|
regex: RegExp;
|
|
@@ -138,7 +138,7 @@ export function MarkdownEditor({
|
|
|
138
138
|
placeholder={placeholder}
|
|
139
139
|
focused={focused}
|
|
140
140
|
textColor={colors.text}
|
|
141
|
-
placeholderColor={
|
|
141
|
+
placeholderColor={placeholderText()}
|
|
142
142
|
backgroundColor={focused ? colors.panel : colors.bg}
|
|
143
143
|
flexGrow={1}
|
|
144
144
|
height="100%"
|
|
@@ -49,7 +49,6 @@ function TuiFieldRow({
|
|
|
49
49
|
focused
|
|
50
50
|
backgroundColor={colors.panel}
|
|
51
51
|
textColor={colors.text}
|
|
52
|
-
placeholderColor={colors.textDim}
|
|
53
52
|
onChange={onChange}
|
|
54
53
|
/>
|
|
55
54
|
) : (
|
|
@@ -111,7 +110,6 @@ export function AccountFormPanel({
|
|
|
111
110
|
focused={onEmail && editing && !submitting}
|
|
112
111
|
backgroundColor={colors.panel}
|
|
113
112
|
textColor={colors.text}
|
|
114
|
-
placeholderColor={colors.textDim}
|
|
115
113
|
onMouseDown={() => onFieldFocus(0)}
|
|
116
114
|
onChange={onEmailChange}
|
|
117
115
|
/>
|
|
@@ -126,7 +124,6 @@ export function AccountFormPanel({
|
|
|
126
124
|
focused={!onEmail && editing && !submitting}
|
|
127
125
|
backgroundColor={colors.panel}
|
|
128
126
|
textColor={colors.text}
|
|
129
|
-
placeholderColor={colors.textDim}
|
|
130
127
|
onMouseDown={() => onFieldFocus(1)}
|
|
131
128
|
onChange={onPasswordChange}
|
|
132
129
|
/>
|
|
@@ -62,7 +62,8 @@ export function useOnboardingKeyboard({
|
|
|
62
62
|
submitAccountField, backPortfolio, continuePortfolio, setPortfolioOptionIdx, activeBrokerFields,
|
|
63
63
|
brokerFieldIdx, setBrokerSelectIdx, brokerChoices, openBrokerGuide, chosenDesks, finishDesks,
|
|
64
64
|
setDeskCursor, deskCursor, setChosenDesks, continueAccount, skipSetup, primaryUpgradeAction,
|
|
65
|
-
setBillingInterval, keybindings, dialogOpen, commandBarOpen, saveProgressInBackground, goBack,
|
|
65
|
+
setBillingInterval, keybindings, dialogOpen, commandBarOpen, saveProgressInBackground, goBack, coachAside = false,
|
|
66
|
+
inputCaptured = false,
|
|
66
67
|
}: {
|
|
67
68
|
stage: OnboardingStage;
|
|
68
69
|
progress: OnboardingProgress;
|
|
@@ -109,6 +110,10 @@ export function useOnboardingKeyboard({
|
|
|
109
110
|
saveProgressInBackground: (patch: Partial<OnboardingProgress> & Pick<OnboardingProgress, "stage">, baseConfig?: AppConfig | undefined) => void;
|
|
110
111
|
/** Back on the card: to the step the user came from. */
|
|
111
112
|
goBack: () => void;
|
|
113
|
+
/** The workspace coach has stepped aside for a pane opened after it, and takes no keys. */
|
|
114
|
+
coachAside?: boolean;
|
|
115
|
+
/** A pane holds the keyboard (SET_INPUT_CAPTURED): the research coach takes none of its keys. */
|
|
116
|
+
inputCaptured?: boolean;
|
|
112
117
|
}) {
|
|
113
118
|
const activeSection: OnboardingSectionId = stage === "portfolio" || stage === "desks"
|
|
114
119
|
? "portfolio"
|
|
@@ -304,11 +309,15 @@ export function useOnboardingKeyboard({
|
|
|
304
309
|
|
|
305
310
|
/**
|
|
306
311
|
* The research coach floats over a live workspace, so it takes no key a pane
|
|
307
|
-
* could want. It answers the notification keys, like a toast that stays up
|
|
308
|
-
*
|
|
312
|
+
* could want. It answers the notification keys, like a toast that stays up:
|
|
313
|
+
* after a toast's own (the shell's handler is older and runs first), and
|
|
314
|
+
* before the focused pane, so the key its buttons show acts on the card
|
|
315
|
+
* only, never on the pane under it. Never in a field or while a pane holds
|
|
316
|
+
* the keyboard: there Alt+Backspace deletes a word, as it should.
|
|
309
317
|
*/
|
|
310
318
|
useShortcut((event) => {
|
|
311
|
-
|
|
319
|
+
// A terminal reports Alt as meta, which reaches a handler even in a field: the field keeps it.
|
|
320
|
+
if (event.targetEditable === true) return;
|
|
312
321
|
const connect = matchesKeybindingAction(keybindings, "notification-action", event);
|
|
313
322
|
const dismiss = matchesKeybindingAction(keybindings, "notification-dismiss", event) || isPlainKey(event, "f10");
|
|
314
323
|
if (!connect && !dismiss) return;
|
|
@@ -317,7 +326,7 @@ export function useOnboardingKeyboard({
|
|
|
317
326
|
if (connect) saveProgressInBackground({ stage: "account" });
|
|
318
327
|
else void finish();
|
|
319
328
|
}, {
|
|
320
|
-
phase: "
|
|
321
|
-
enabled: stage === "research" && !helpFocused && !dialogOpen && !commandBarOpen,
|
|
329
|
+
phase: "before",
|
|
330
|
+
enabled: stage === "research" && !helpFocused && !coachAside && !inputCaptured && !dialogOpen && !commandBarOpen,
|
|
322
331
|
});
|
|
323
332
|
}
|
|
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|
|
2
2
|
import { recordResearchActivity, type ResearchActivity } from "../../api-client/research-activity";
|
|
3
3
|
import type { AppBrokerImportRuntime } from "../../app/runtime/broker-import";
|
|
4
4
|
import { type AppConfig, findPaneInstance, type OnboardingStage } from "../../types/config";
|
|
5
|
-
import { useViewport } from "../../react/input";
|
|
5
|
+
import { useBeforeShortcut, useViewport } from "../../react/input";
|
|
6
6
|
import { useKeybindings } from "../../app/keybindings";
|
|
7
7
|
import { useAppDispatch, useAppSelector, useAppStateRef } from "../../state/app/context";
|
|
8
8
|
import {
|
|
@@ -83,6 +83,11 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
|
|
|
83
83
|
const keybindings = useKeybindings();
|
|
84
84
|
const dialogOpen = useDialogState((dialog) => dialog.isOpen);
|
|
85
85
|
const commandBarOpen = useAppSelector((state) => state.commandBarOpen);
|
|
86
|
+
// A pane holding the keyboard (a chat composer, a ticker search): the card's keys are its.
|
|
87
|
+
const inputCaptured = useAppSelector((state) => state.inputCaptured);
|
|
88
|
+
// Whether the last key went to a field: there the card shows no keys, since they type.
|
|
89
|
+
const [typingInField, setTypingInField] = useState(false);
|
|
90
|
+
useBeforeShortcut((event) => setTypingInField(event.targetEditable === true));
|
|
86
91
|
const { width: viewportWidth, height: viewportHeight } = useViewport();
|
|
87
92
|
const dispatch = useAppDispatch();
|
|
88
93
|
const stateRef = useAppStateRef();
|
|
@@ -256,6 +261,7 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
|
|
|
256
261
|
? findPaneInstance(config.layout, focusedPaneId)
|
|
257
262
|
: null;
|
|
258
263
|
const helpFocused = focusedInstance?.paneId === "help";
|
|
264
|
+
const coachAside = useCoachStepsAside(config, stage);
|
|
259
265
|
const {
|
|
260
266
|
offer, pricing, billingInterval, setBillingInterval, planAccess, primaryUpgradeAction, continueFree,
|
|
261
267
|
} = useOnboardingUpgrade({
|
|
@@ -313,10 +319,13 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
|
|
|
313
319
|
submitAccountField, backPortfolio, continuePortfolio, setPortfolioOptionIdx, activeBrokerFields,
|
|
314
320
|
brokerFieldIdx, setBrokerSelectIdx, brokerChoices, openBrokerGuide, chosenDesks, finishDesks,
|
|
315
321
|
setDeskCursor, deskCursor, setChosenDesks, continueAccount, skipSetup, primaryUpgradeAction,
|
|
316
|
-
setBillingInterval, keybindings, dialogOpen, commandBarOpen, saveProgressInBackground, goBack,
|
|
322
|
+
setBillingInterval, keybindings, dialogOpen, commandBarOpen, saveProgressInBackground, goBack, coachAside,
|
|
323
|
+
inputCaptured,
|
|
317
324
|
});
|
|
318
325
|
|
|
319
326
|
return {
|
|
327
|
+
coachAside,
|
|
328
|
+
coachKeysHidden: inputCaptured || typingInField,
|
|
320
329
|
helpFocused, stage, progress, notificationDismissShortcut, finish, notificationActionShortcut,
|
|
321
330
|
saveProgressInBackground, colors, commandBarShortcut, selectedBrokerId, brokerOptions, portfolioSub,
|
|
322
331
|
sectionAvailability, goToSection, skipSetup, isFinishing, isBrokerCommitting, desktop, positions,
|
|
@@ -330,8 +339,46 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
|
|
|
330
339
|
};
|
|
331
340
|
}
|
|
332
341
|
|
|
342
|
+
/**
|
|
343
|
+
* A card button's letter key, shown only while no field is being typed in: in
|
|
344
|
+
* a field the letter is typed (the Skip button's `s` went into the Ticker
|
|
345
|
+
* field), and it acts on the card once Esc leaves the field.
|
|
346
|
+
*/
|
|
347
|
+
export function cardKey(key: string, editingField: boolean): string | undefined {
|
|
348
|
+
return editingField && key.length === 1 ? undefined : key;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/** Every pane of every desk, by instance id. */
|
|
352
|
+
function paneIdsOf(config: AppConfig): Set<string> {
|
|
353
|
+
return new Set([config.layout, ...config.layouts.map((saved) => saved.layout)]
|
|
354
|
+
.flatMap((layout) => layout.instances.map((instance) => instance.instanceId)));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Whether the workspace coach steps aside: while a pane opened after it is
|
|
359
|
+
* open, as it does while Help has focus. It floats above the whole shell, so
|
|
360
|
+
* it would otherwise cover a pane the user opened under it (a floating 13F
|
|
361
|
+
* pane at the top right), and its keys would compete with that pane's.
|
|
362
|
+
*/
|
|
363
|
+
export function coachStepsAside(shownWith: ReadonlySet<string> | null, config: AppConfig): boolean {
|
|
364
|
+
if (!shownWith) return false;
|
|
365
|
+
for (const id of paneIdsOf(config)) if (!shownWith.has(id)) return true;
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function useCoachStepsAside(config: AppConfig, stage: OnboardingStage): boolean {
|
|
370
|
+
// The panes the coach came up with: the workspace it was built around.
|
|
371
|
+
const [shownWith, setShownWith] = useState<ReadonlySet<string> | null>(null);
|
|
372
|
+
useEffect(() => {
|
|
373
|
+
if (stage !== "research") setShownWith(null);
|
|
374
|
+
else setShownWith((current) => current ?? paneIdsOf(config));
|
|
375
|
+
}, [config, stage]);
|
|
376
|
+
return stage === "research" && coachStepsAside(shownWith, config);
|
|
377
|
+
}
|
|
378
|
+
|
|
333
379
|
export function OnboardingWizard(props: OnboardingWizardProps) {
|
|
334
380
|
const {
|
|
381
|
+
coachAside, coachKeysHidden,
|
|
335
382
|
helpFocused, stage, progress, notificationDismissShortcut, finish, notificationActionShortcut,
|
|
336
383
|
saveProgressInBackground, colors, commandBarShortcut, selectedBrokerId, brokerOptions, portfolioSub,
|
|
337
384
|
sectionAvailability, goToSection, skipSetup, isFinishing, isBrokerCommitting, desktop, positions,
|
|
@@ -344,7 +391,7 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
|
|
|
344
391
|
goBack, rerun,
|
|
345
392
|
} = useOnboardingWizard(props);
|
|
346
393
|
|
|
347
|
-
if (helpFocused) {
|
|
394
|
+
if (helpFocused || coachAside) {
|
|
348
395
|
return null;
|
|
349
396
|
}
|
|
350
397
|
|
|
@@ -356,18 +403,19 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
|
|
|
356
403
|
{/* Each button shows its key, as Connect shows Alt+Enter; in the
|
|
357
404
|
terminal the second wraps under the first. The desktop card has no
|
|
358
405
|
room for both: like a toast, its dismiss key is in the tooltip.
|
|
359
|
-
F10 also dismisses it.
|
|
406
|
+
F10 also dismisses it. In a field, or with a pane holding the
|
|
407
|
+
keyboard, the keys are the field's: the card shows none. */}
|
|
360
408
|
<OnboardingButton
|
|
361
409
|
label="Keep exploring"
|
|
362
410
|
variant="ghost"
|
|
363
|
-
shortcut={!desktop && notificationDismissShortcut ? notificationDismissShortcut : undefined}
|
|
411
|
+
shortcut={!desktop && !coachKeysHidden && notificationDismissShortcut ? notificationDismissShortcut : undefined}
|
|
364
412
|
title={desktop && notificationDismissShortcut ? `${t("Keep exploring")} (${notificationDismissShortcut})` : undefined}
|
|
365
413
|
onPress={() => { void finish(); }}
|
|
366
414
|
/>
|
|
367
415
|
<OnboardingButton
|
|
368
416
|
label="Connect free Cloud"
|
|
369
417
|
variant="primary"
|
|
370
|
-
shortcut={notificationActionShortcut || undefined}
|
|
418
|
+
shortcut={!coachKeysHidden && notificationActionShortcut || undefined}
|
|
371
419
|
onPress={() => saveProgressInBackground({ stage: "account" })}
|
|
372
420
|
/>
|
|
373
421
|
</>}>
|
|
@@ -463,14 +511,14 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
|
|
|
463
511
|
{portfolioSub === "positions" ? (
|
|
464
512
|
<>
|
|
465
513
|
{brokerOptions.length > 0 && positionCount > 0 ? (
|
|
466
|
-
<OnboardingButton label="Connect a broker" variant="ghost" shortcut={CONNECT_BROKER_KEY} onPress={openBrokerConnect} />
|
|
514
|
+
<OnboardingButton label="Connect a broker" variant="ghost" shortcut={cardKey(CONNECT_BROKER_KEY, editingField)} onPress={openBrokerConnect} />
|
|
467
515
|
) : null}
|
|
468
516
|
{/* Holding nothing yet, the step can be left as the Desks step can. */}
|
|
469
517
|
{positionCount === 0 ? (
|
|
470
518
|
<OnboardingButton
|
|
471
519
|
label="Skip"
|
|
472
520
|
variant="ghost"
|
|
473
|
-
shortcut={SKIP_PORTFOLIO_KEY}
|
|
521
|
+
shortcut={cardKey(SKIP_PORTFOLIO_KEY, editingField)}
|
|
474
522
|
disabled={positions.submitting}
|
|
475
523
|
onPress={skipPositions}
|
|
476
524
|
/>
|
|
@@ -596,7 +644,7 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
|
|
|
596
644
|
available={sectionAvailability}
|
|
597
645
|
onNavigate={goToSection}
|
|
598
646
|
onDismiss={skipSetup}
|
|
599
|
-
dismissShortcut={SKIP_SETUP_KEY}
|
|
647
|
+
dismissShortcut={cardKey(SKIP_SETUP_KEY, editingField)}
|
|
600
648
|
dismissing={isFinishing}
|
|
601
649
|
/>
|
|
602
650
|
<OnboardingTitle
|
|
@@ -630,12 +678,14 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
|
|
|
630
678
|
) : null}
|
|
631
679
|
{!desktop && browserSignIn ? (
|
|
632
680
|
<Box height={1}>
|
|
633
|
-
<Text fg={colors.textMuted}>{
|
|
681
|
+
<Text fg={colors.textMuted}>{editingField
|
|
682
|
+
? t("Esc, then b: sign in with the browser instead")
|
|
683
|
+
: t("b: sign in with the browser instead")}</Text>
|
|
634
684
|
</Box>
|
|
635
685
|
) : null}
|
|
636
686
|
<OnboardingActions
|
|
637
687
|
hint={desktop && browserSignIn ? (
|
|
638
|
-
<Button label="Sign in with the browser instead" variant="plain" compact shortcut={BROWSER_SIGN_IN_KEY} onPress={account.beginQrSignIn} />
|
|
688
|
+
<Button label="Sign in with the browser instead" variant="plain" compact shortcut={cardKey(BROWSER_SIGN_IN_KEY, editingField)} onPress={account.beginQrSignIn} />
|
|
639
689
|
) : undefined}
|
|
640
690
|
>
|
|
641
691
|
<OnboardingButton
|
|
@@ -76,7 +76,6 @@ export function BrokerFieldsPanel({
|
|
|
76
76
|
focused
|
|
77
77
|
backgroundColor={colors.panel}
|
|
78
78
|
textColor={colors.text}
|
|
79
|
-
placeholderColor={colors.textDim}
|
|
80
79
|
onChange={(nextValue) => onBrokerFieldChange(selectedBrokerId, field.key, nextValue)}
|
|
81
80
|
onSubmit={() => onSubmitBrokerField?.()}
|
|
82
81
|
/>
|
|
@@ -190,7 +190,6 @@ function DesktopPositionsPanel({
|
|
|
190
190
|
size: "comfortable" as const,
|
|
191
191
|
backgroundColor: colors.panel,
|
|
192
192
|
textColor: colors.text,
|
|
193
|
-
placeholderColor: colors.textDim,
|
|
194
193
|
onMouseDown: () => state.focusField(index),
|
|
195
194
|
});
|
|
196
195
|
|
|
@@ -271,7 +270,6 @@ function TuiFieldRow({
|
|
|
271
270
|
focused={!state.submitting}
|
|
272
271
|
backgroundColor={colors.panel}
|
|
273
272
|
textColor={colors.text}
|
|
274
|
-
placeholderColor={colors.textDim}
|
|
275
273
|
onChange={(next) => state.setField(field, next)}
|
|
276
274
|
/>
|
|
277
275
|
) : (
|
|
@@ -39,19 +39,35 @@ function closeValue(point: PricePoint): number | null {
|
|
|
39
39
|
return Number.isFinite(point.close) ? point.close : null;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* The bars a sparkline draws: those within the period of the latest one, or
|
|
44
|
+
* the last few when that leaves fewer than two. A series runs oldest to
|
|
45
|
+
* newest, so they are found from its end: every quote that moves a line asks
|
|
46
|
+
* for a month of a series of two thousand weekly bars, and testing each bar
|
|
47
|
+
* cost more than all else the quote set off.
|
|
48
|
+
*/
|
|
42
49
|
export function resolveSparklineHistory(priceHistory: PricePoint[], period: SparklineWindow = "1M"): PricePoint[] {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
let latest = priceHistory.length - 1;
|
|
51
|
+
while (latest >= 0 && !Number.isFinite(getPricePointTimestamp(priceHistory[latest]!))) latest -= 1;
|
|
52
|
+
if (latest < 0) return [];
|
|
53
|
+
|
|
54
|
+
const cutoffTime = getPricePointTimestamp(priceHistory[latest]!) - PERIOD_WINDOW_DAYS[period] * 86_400_000;
|
|
55
|
+
const windowHistory: PricePoint[] = [];
|
|
56
|
+
for (let index = latest; index >= 0; index -= 1) {
|
|
57
|
+
const point = priceHistory[index]!;
|
|
58
|
+
const time = getPricePointTimestamp(point);
|
|
59
|
+
if (!Number.isFinite(time)) continue;
|
|
60
|
+
if (time < cutoffTime) break;
|
|
61
|
+
windowHistory.push(point);
|
|
52
62
|
}
|
|
63
|
+
if (windowHistory.length >= 2) return windowHistory.reverse();
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
const recentHistory: PricePoint[] = [];
|
|
66
|
+
for (let index = latest; index >= 0 && recentHistory.length < PERIOD_FALLBACK_POINTS[period]; index -= 1) {
|
|
67
|
+
const point = priceHistory[index]!;
|
|
68
|
+
if (Number.isFinite(getPricePointTimestamp(point))) recentHistory.push(point);
|
|
69
|
+
}
|
|
70
|
+
return recentHistory.reverse();
|
|
55
71
|
}
|
|
56
72
|
|
|
57
73
|
export function sparklineValues(priceHistory: PricePoint[]): number[] {
|