@gloom-sh/terminal 0.20.17 → 0.20.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/src/account/auth-dialog.tsx +19 -1
- package/src/account/billing.ts +2 -1
- package/src/account/heard-from-question.tsx +235 -0
- package/src/account/heard-from.ts +97 -0
- package/src/api-client/cot.ts +5 -6
- package/src/api-client/data.ts +14 -3
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +64 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +37 -4
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +1 -2
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +191 -39
- package/src/cli/commands/overview.ts +7 -1
- package/src/cli/commands/plugins.ts +3 -2
- package/src/cli/commands/search.ts +30 -6
- package/src/cli/commands/ticker.ts +13 -6
- package/src/cli/context.ts +24 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +276 -52
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +65 -11
- package/src/cli/help.ts +1 -1
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +8 -4
- package/src/cli/index.ts +2 -1
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +192 -38
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +877 -0
- package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
- package/src/cli/pane-functions/catalog.ts +50 -16
- package/src/cli/pane-functions/data.ts +16 -4
- package/src/cli/pane-functions/dom.ts +54 -8
- package/src/cli/pane-functions/freshness.ts +39 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +175 -50
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +11 -7
- package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +36 -1
- package/src/cli/pane-functions/screenshot-render.ts +24 -9
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +33 -17
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +22 -4
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +48 -20
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +11 -2
- package/src/components/chart-table/layout.ts +16 -17
- package/src/components/command-bar/pane-templates/items.ts +17 -1
- package/src/components/command-bar/routes/root/provider-search.ts +10 -1
- package/src/components/command-bar/routes/root/results.ts +34 -2
- package/src/components/command-bar/routes/root/runtime.ts +19 -4
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +32 -13
- package/src/components/data-table/view.tsx +15 -2
- package/src/components/form-modal/content.tsx +9 -4
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +9 -5
- package/src/components/layout/pane/capture-status.ts +6 -0
- package/src/components/layout/pane/footer/index.tsx +2 -0
- package/src/components/layout/pane/footer/model.ts +123 -17
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- package/src/components/market-board/index.tsx +4 -2
- package/src/components/onboarding/onboarding-frame.tsx +6 -2
- package/src/components/onboarding/onboarding-keyboard.ts +7 -1
- package/src/components/onboarding/onboarding-wizard.tsx +3 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
- package/src/components/onboarding/setup-cards.ts +36 -0
- package/src/components/onboarding/use-onboarding-progress.ts +22 -1
- package/src/components/onboarding/wizard-account.ts +6 -1
- package/src/components/onboarding/wizard-model.ts +32 -6
- package/src/components/onboarding/wizard-positions.ts +1 -1
- package/src/components/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- package/src/components/sign-in-gate.tsx +3 -1
- package/src/components/toggle-list.tsx +6 -8
- package/src/components/ui/confirm-dialog.tsx +47 -7
- package/src/components/ui/data-table/opentui/index.tsx +7 -0
- package/src/components/ui/data-table/types.ts +8 -0
- package/src/components/ui/display.tsx +17 -2
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/stat-grid.tsx +4 -0
- package/src/components/ui/status.tsx +13 -1
- package/src/components/ui/table-layout.ts +34 -2
- package/src/components/use-pane-notice-footer.tsx +16 -3
- package/src/data/config/store/index.ts +31 -0
- package/src/data/config/store/node.ts +61 -11
- package/src/data/config/store/normalize.ts +4 -6
- package/src/data/config/store/shared-file.ts +309 -0
- package/src/data/profile-merge.ts +299 -0
- package/src/data/sqlite/checkpointer.ts +11 -1
- package/src/data/sqlite/database.ts +1 -1
- package/src/data/ticker-repository.ts +134 -10
- package/src/data/ticker-store.ts +67 -0
- package/src/data/ticker-writes.ts +5 -0
- package/src/i18n/es.ts +27 -0
- package/src/i18n/ja.ts +27 -0
- package/src/i18n/ko.ts +27 -0
- package/src/i18n/zh-cn.ts +27 -0
- package/src/i18n/zh-tw.ts +27 -0
- package/src/layout-marketplace/gallery-desktop.tsx +2 -2
- package/src/market-data/ah-pair.ts +122 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +11 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/market-data/split-terms.ts +28 -0
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -0
- package/src/plugins/builtin/account-management/footer.ts +1 -1
- package/src/plugins/builtin/account-management/keyboard.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +75 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
- package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
- package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
- package/src/plugins/builtin/alerts/cli-move.ts +2 -2
- package/src/plugins/builtin/alerts/cli.ts +101 -48
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +97 -16
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +27 -14
- package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
- package/src/plugins/builtin/analytics/risk-model.ts +92 -4
- package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
- package/src/plugins/builtin/awards/pane.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
- package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +10 -5
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +57 -15
- package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
- package/src/plugins/builtin/composite/alt-data.ts +20 -0
- package/src/plugins/builtin/composite/application.ts +14 -0
- package/src/plugins/builtin/composite/broker.ts +12 -0
- package/src/plugins/builtin/composite/credit.ts +33 -0
- package/src/plugins/builtin/composite/crypto.ts +10 -0
- package/src/plugins/builtin/composite/earnings.ts +12 -0
- package/src/plugins/builtin/composite/filings.ts +13 -0
- package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
- package/src/plugins/builtin/composite/global-markets.ts +12 -0
- package/src/plugins/builtin/composite/options-volatility.ts +23 -0
- package/src/plugins/builtin/composite/ownership.ts +23 -0
- package/src/plugins/builtin/composite/portfolio.ts +10 -0
- package/src/plugins/builtin/composite/quant.ts +15 -0
- package/src/plugins/builtin/composite/rates-macro.ts +30 -0
- package/src/plugins/builtin/composite/screeners.ts +11 -0
- package/src/plugins/builtin/composite/shared.ts +11 -0
- package/src/plugins/builtin/composite/ticker-core.ts +36 -0
- package/src/plugins/builtin/congress-trades/headless.ts +31 -3
- package/src/plugins/builtin/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- package/src/plugins/builtin/dividend-yield/client.ts +57 -16
- package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
- package/src/plugins/builtin/dividend-yield/model.ts +4 -3
- package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
- package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +23 -12
- package/src/plugins/builtin/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +16 -6
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +7 -4
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +7 -2
- package/src/plugins/builtin/equity-screener/headless.ts +4 -1
- package/src/plugins/builtin/equity-screener/model.ts +7 -6
- package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
- package/src/plugins/builtin/exposure/model.ts +10 -0
- package/src/plugins/builtin/exposure/pane.tsx +10 -3
- package/src/plugins/builtin/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
- package/src/plugins/builtin/mna/detail.tsx +67 -6
- package/src/plugins/builtin/mna/headless.ts +128 -13
- package/src/plugins/builtin/mna/model.ts +219 -16
- package/src/plugins/builtin/mna/pane.tsx +34 -6
- package/src/plugins/builtin/money-markets/model.ts +14 -5
- package/src/plugins/builtin/money-markets/pane.tsx +4 -3
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -8
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
- package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
- package/src/plugins/builtin/options-scenario/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
- package/src/plugins/builtin/pe-band/client.ts +13 -1
- package/src/plugins/builtin/pe-band/headless.ts +2 -2
- package/src/plugins/builtin/pe-band/model.ts +63 -10
- package/src/plugins/builtin/pe-band/pane.tsx +5 -5
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
- package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
- package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
- package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
- package/src/plugins/builtin/research/event-model.ts +43 -19
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +49 -5
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- package/src/plugins/builtin/supply-chain/client.ts +34 -9
- package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
- package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
- package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
- package/src/plugins/builtin/supply-chain/headless.ts +19 -4
- package/src/plugins/builtin/supply-chain/model.ts +50 -6
- package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
- package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
- package/src/plugins/builtin/volatility/model.ts +17 -0
- package/src/plugins/builtin/volatility/pane.tsx +16 -7
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/table.tsx +15 -0
- package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
- package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
- package/src/plugins/builtin/world-venue-map/index.ts +19 -6
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
- package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
- package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
- package/src/plugins/builtin/world-venue-map/model.ts +6 -1
- package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- package/src/plugins/catalog-data.ts +20 -0
- package/src/plugins/catalog-lazy.ts +51 -0
- package/src/plugins/catalog-ui.ts +16 -18
- package/src/plugins/host-smoke.ts +5 -2
- package/src/portfolio/allocation.ts +79 -19
- package/src/portfolio/cash-balances.ts +76 -0
- package/src/portfolio/mutations.ts +43 -8
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/host/tabs.tsx +57 -8
- package/src/renderers/dom/styles.css +13 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
- package/src/renderers/electrobun/view/http-fetch.ts +3 -2
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
- package/src/series/standalone-catalog.ts +5 -4
- package/src/series/standalone.ts +13 -7
- package/src/sources/gloomberb-cloud/index.ts +22 -9
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/history.ts +32 -6
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +42 -3
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +3 -2
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +48 -4
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/types/ticker.ts +10 -2
- package/src/ui/host.tsx +2 -0
- package/src/utils/cli-output.ts +1 -1
- package/src/utils/declared-dividends.ts +13 -1
- package/src/utils/dividend-cash.ts +5 -1
- package/src/utils/exchange-announcements.ts +7 -2
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
- package/src/utils/remove-folder.ts +37 -0
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DATA_SERVICE_UNREACHABLE_MESSAGE } from "../utils/network-failure";
|
|
2
|
+
|
|
3
|
+
/** What to check when nothing answered: the connection, and the proxy when one is set. */
|
|
4
|
+
export function unreachableHint(): string {
|
|
5
|
+
const env = typeof process === "undefined" ? {} : process.env;
|
|
6
|
+
const proxy = ["HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy"].find((name) => env[name]?.trim());
|
|
7
|
+
return proxy
|
|
8
|
+
? `Check the internet connection and the proxy in ${proxy}, then try again.`
|
|
9
|
+
: "Check the internet connection, then try again.";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* What a command that answered from saved copies says when the data service
|
|
14
|
+
* went unanswered: the words a command with nothing to show fails with
|
|
15
|
+
* (`unreachableError`), and that what it printed is the copy its source line
|
|
16
|
+
* dates. Offline, DES printed a saved quote as "15 min delayed" and nothing
|
|
17
|
+
* said the service was never reached.
|
|
18
|
+
*/
|
|
19
|
+
export function savedCopyUnreachableWarning(): string {
|
|
20
|
+
return `${DATA_SERVICE_UNREACHABLE_MESSAGE}, so this is the copy saved earlier. ${unreachableHint()}`;
|
|
21
|
+
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef } from "react";
|
|
2
2
|
import { usePaneSettingValue } from "../../../state/app/context";
|
|
3
|
-
import { CHART_DRAWINGS_SETTING_KEY,
|
|
3
|
+
import { CHART_DRAWINGS_SETTING_KEY, readSavedChartDrawings, type ChartDrawing, type SavedChartDrawings } from "./tools";
|
|
4
4
|
|
|
5
5
|
let nextDrawingSequence = 1;
|
|
6
6
|
|
|
7
|
+
/** Drawings are saved with the pane, so, like levels, their ids must not repeat across sessions. */
|
|
7
8
|
export function nextDrawingId(): string {
|
|
8
|
-
return `drawing:${nextDrawingSequence++}`;
|
|
9
|
+
return `drawing:${Date.now().toString(36)}-${(nextDrawingSequence++).toString(36)}`;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
/** Levels are stored with the account, so their ids must not repeat across sessions. */
|
|
@@ -36,19 +37,19 @@ export function ChartDrawingStore({
|
|
|
36
37
|
NO_DRAWINGS,
|
|
37
38
|
paneInstanceId,
|
|
38
39
|
);
|
|
39
|
-
const restoredRef = useRef<
|
|
40
|
+
const restoredRef = useRef<SavedChartDrawings | null>(null);
|
|
40
41
|
if (restoredRef.current === null) {
|
|
41
|
-
restoredRef.current =
|
|
42
|
+
restoredRef.current = readSavedChartDrawings(stored);
|
|
42
43
|
}
|
|
43
44
|
// What the settings hold, so removing the last drawing is told even when the
|
|
44
45
|
// pane opened with none: it is not "nothing to say" but "the stored one is gone".
|
|
45
|
-
const writtenRef = useRef<readonly ChartDrawing[]>(restoredRef.current);
|
|
46
|
+
const writtenRef = useRef<readonly ChartDrawing[]>(restoredRef.current.drawings);
|
|
46
47
|
const pendingRef = useRef<readonly ChartDrawing[] | null>(null);
|
|
47
48
|
const setStoredRef = useRef(setStored);
|
|
48
49
|
setStoredRef.current = setStored;
|
|
49
50
|
|
|
50
51
|
useEffect(() => {
|
|
51
|
-
const restored = restoredRef.current;
|
|
52
|
+
const restored = restoredRef.current?.drawings;
|
|
52
53
|
if (restored && restored.length > 0) onRestore(restored);
|
|
53
54
|
// Restoring once on mount: later writes must not scroll back in time.
|
|
54
55
|
}, []);
|
|
@@ -56,7 +57,10 @@ export function ChartDrawingStore({
|
|
|
56
57
|
const write = useCallback((next: readonly ChartDrawing[]) => {
|
|
57
58
|
pendingRef.current = null;
|
|
58
59
|
writtenRef.current = next;
|
|
59
|
-
|
|
60
|
+
// Saved entries this build cannot read ride along, so the next edit never
|
|
61
|
+
// writes away a drawing a newer build made.
|
|
62
|
+
const unreadable = restoredRef.current?.unreadable ?? [];
|
|
63
|
+
setStoredRef.current(unreadable.length > 0 ? [...next, ...unreadable as ChartDrawing[]] : next);
|
|
60
64
|
}, []);
|
|
61
65
|
|
|
62
66
|
useEffect(() => {
|
|
@@ -783,6 +783,7 @@ export function formatCompositePointDetails(point: TimeSeriesPoint | null | unde
|
|
|
783
783
|
details.push(`${isFiscalPeriod ? "Period ended" : "Observed"} ${observedAt}`);
|
|
784
784
|
}
|
|
785
785
|
if (availableAt && availableAt !== observedAt) details.push(`Available ${availableAt}`);
|
|
786
|
+
if (point.nativeAmount) details.push(`Native ${compactNumber(point.nativeAmount.value)} ${point.nativeAmount.currency}`);
|
|
786
787
|
|
|
787
788
|
const quality = point.provenance?.quality;
|
|
788
789
|
if (quality) details.push(`${quality[0]!.toUpperCase()}${quality.slice(1)}`);
|
|
@@ -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 { MISSING_VALUE, displayWidth, formatPercentRaw } from "../../../utils/format";
|
|
5
|
+
import { MISSING_VALUE, displayWidth, formatPercentRaw, formatCompact } from "../../../utils/format";
|
|
6
6
|
import type { ResolvedSeries } from "../../../time-series/types";
|
|
7
7
|
import { consumeChartMouseEvent, type ChartMouseEvent } from "../core/pointer";
|
|
8
8
|
import {
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import type { CompositeChartProps, CompositeChartScene } from "./types";
|
|
16
16
|
import { DIRECTION_MARKER, seriesColorsDirection, seriesCueCssBackground, type SeriesLineCue } from "./series-cues";
|
|
17
17
|
import { DisclosureMarker as KitDisclosureMarker } from "../../ui/disclosure-marker";
|
|
18
|
+
import { usePaneCapture } from "../../layout/pane/capture-status";
|
|
18
19
|
|
|
19
20
|
const LEGEND_WHEEL_DELTA_PER_CELL = 8;
|
|
20
21
|
const NO_LINE_CUES: ReadonlyMap<string, SeriesLineCue> = new Map();
|
|
@@ -253,7 +254,7 @@ export function CompositeLegend({
|
|
|
253
254
|
cellPlot = false,
|
|
254
255
|
directionDownColor = null,
|
|
255
256
|
width,
|
|
256
|
-
accessory,
|
|
257
|
+
accessory: liveAccessory,
|
|
257
258
|
accessoryWidth,
|
|
258
259
|
formatValue,
|
|
259
260
|
showLatestChangePercent,
|
|
@@ -297,6 +298,7 @@ export function CompositeLegend({
|
|
|
297
298
|
/** Folds or opens the legend: a chevron in its inset, shown under the pointer while it is open. */
|
|
298
299
|
onToggleCollapsed?: () => void;
|
|
299
300
|
}) {
|
|
301
|
+
const accessory = usePaneCapture() ? null : liveAccessory;
|
|
300
302
|
const isDesktopWeb = useUiCapabilities().nativePaneChrome === true;
|
|
301
303
|
const foldKey = useShortcutLabel()("Shift+L");
|
|
302
304
|
// Folded, the legend keeps its first series; the rest wait behind a count.
|
|
@@ -331,8 +333,11 @@ export function CompositeLegend({
|
|
|
331
333
|
// What a futures price counts, beside its number as FUT prints it.
|
|
332
334
|
const statedUnit = entry.points.length > 0 && !formatValue && entry.statedUnit ? ` ${entry.statedUnit}` : "";
|
|
333
335
|
// A statement value names the fiscal period it reports, as FA's columns do.
|
|
336
|
+
const native = cursorValue?.point?.nativeAmount;
|
|
337
|
+
const statementEnd = native ? cursorValue?.point?.observedAt.toISOString().slice(0, 10) : undefined;
|
|
334
338
|
const fiscalPeriod = withFiscalPeriods && cursorValue?.value != null ? cursorValue.point?.fiscalPeriod : undefined;
|
|
335
|
-
const
|
|
339
|
+
const readDate = statementEnd ?? ownDate;
|
|
340
|
+
const valueTail = `${readDate ? ` ${readDate}` : ""}${fiscalPeriod && !statementEnd ? ` ${fiscalPeriod}` : ""}${native && withFiscalPeriods ? ` (${formatCompact(native.value)} ${native.currency})` : ""}${changeText}`;
|
|
336
341
|
const readsRight = entry.points.length > 0 && entry.axis === "right" && leftPanels.has(entry.panelId);
|
|
337
342
|
const axisNote = readsRight && withAxisNotes ? RIGHT_AXIS_NOTE : "";
|
|
338
343
|
const valueText = entry.points.length === 0
|
|
@@ -458,6 +463,17 @@ export function CompositeLegend({
|
|
|
458
463
|
if (entries.some(({ axisNote }) => axisNote) && minimumWidthOf(entries) > widthBeforeAccessory) {
|
|
459
464
|
entries = buildEntries(entries.some(({ fiscalPeriod }) => fiscalPeriod), false);
|
|
460
465
|
}
|
|
466
|
+
if (entries.some((entry) => entry.entry.compactLabel) && measureSeriesWidth() > widthBeforeAccessory) {
|
|
467
|
+
for (const entry of entries) setEntryLabel(entry, entry.compactLabel, displayWidth(entry.compactLabel));
|
|
468
|
+
if (measureSeriesWidth() > widthBeforeAccessory) {
|
|
469
|
+
for (const entry of entries) {
|
|
470
|
+
if (!entry.entry.compactLabel) continue;
|
|
471
|
+
const { name, suffix } = labelParts(entry, entry.compactLabel);
|
|
472
|
+
entry.compactLabel = (nameWords(name)[0] ?? name) + suffix;
|
|
473
|
+
setEntryLabel(entry, entry.compactLabel, displayWidth(entry.compactLabel));
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
461
477
|
const fitsOneLine = minimumWidthOf(entries, true) <= widthBeforeAccessory;
|
|
462
478
|
// Entries that cannot share a line even with names cut to fragments wrap onto
|
|
463
479
|
// more lines when the chart gives them room, each whole, its name only cut
|
|
@@ -659,24 +675,36 @@ export function CompositeLegend({
|
|
|
659
675
|
</Box>
|
|
660
676
|
);
|
|
661
677
|
};
|
|
662
|
-
const scrollLine = (line: number[] | null, key: string | number, ref: typeof scrollRef | undefined) =>
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
height={1}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
678
|
+
const scrollLine = (line: number[] | null, key: string | number, ref: typeof scrollRef | undefined) => {
|
|
679
|
+
const contentWidth = line ? lineWidth(line) : desiredSeriesWidth;
|
|
680
|
+
const count = ref && !collapsed && series.length > 1 && contentWidth > seriesWidth ? `${series.length} series` : "";
|
|
681
|
+
const countWidth = count ? Math.min(seriesWidth, displayWidth(count) + 1) : 0;
|
|
682
|
+
return (
|
|
683
|
+
<Box key={key} flexDirection="row" width={seriesWidth} height={1} flexShrink={0}>
|
|
684
|
+
<ScrollBox
|
|
685
|
+
ref={ref}
|
|
686
|
+
width={Math.max(0, seriesWidth - countWidth)}
|
|
687
|
+
height={1}
|
|
688
|
+
flexShrink={0}
|
|
689
|
+
scrollX
|
|
690
|
+
focusable={false}
|
|
691
|
+
horizontalScrollbarOptions={{ visible: false }}
|
|
692
|
+
onMouseScroll={ref ? handleMouseScroll : undefined}
|
|
693
|
+
data-gloom-role="composite-chart-legend-scroll"
|
|
694
|
+
>
|
|
695
|
+
<Box flexDirection="row" width={contentWidth} height={1} gap={1}>
|
|
696
|
+
{line ? line.map((index) => renderEntry(entries[index]!, index)) : entries.map(renderEntry)}
|
|
697
|
+
</Box>
|
|
698
|
+
</ScrollBox>
|
|
699
|
+
{count ? (
|
|
700
|
+
<Box width={countWidth} height={1} flexShrink={0} paddingLeft={countWidth > displayWidth(count) ? 1 : 0}
|
|
701
|
+
data-gloom-role="composite-chart-legend-count" title={series.map((entry) => entry.label).join(" · ")}>
|
|
702
|
+
<Text fg={themeColors.textDim}>{countWidth < displayWidth(count) ? String(series.length) : count}</Text>
|
|
703
|
+
</Box>
|
|
704
|
+
) : null}
|
|
677
705
|
</Box>
|
|
678
|
-
|
|
679
|
-
|
|
706
|
+
);
|
|
707
|
+
};
|
|
680
708
|
const lineCount = lines?.length ?? 1;
|
|
681
709
|
const foldLabel = foldedCount > 0
|
|
682
710
|
? `Show ${foldedCount} more series (${foldKey})`
|
|
@@ -104,7 +104,7 @@ export function PanelPlotSurface({
|
|
|
104
104
|
);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
/** A value axis, with the cursor's value
|
|
107
|
+
/** A value axis, with the cursor's value and each series' observation at that time. */
|
|
108
108
|
export function PanelValueAxis({
|
|
109
109
|
view,
|
|
110
110
|
formatAxisValue,
|
|
@@ -122,8 +122,8 @@ export function PanelValueAxis({
|
|
|
122
122
|
// The pointer's value on the axes follows the level line it belongs to.
|
|
123
123
|
const axisCursorYRatio = isDesktopWeb ? pointerCursorYRatio : activeCursorYRatio;
|
|
124
124
|
const seriesTags = useMemo(
|
|
125
|
-
() =>
|
|
126
|
-
[formatAxisValue,
|
|
125
|
+
() => resolveSeriesAxisTags(panel, scene, formatAxisValue).filter((tag) => tag.side === side),
|
|
126
|
+
[formatAxisValue, panel, scene, side],
|
|
127
127
|
);
|
|
128
128
|
return (
|
|
129
129
|
<PriceAxisLabels
|
|
@@ -75,6 +75,8 @@ export function usePlotGestures({
|
|
|
75
75
|
renderer,
|
|
76
76
|
plotSize,
|
|
77
77
|
plotAspect,
|
|
78
|
+
cellWidthPx,
|
|
79
|
+
cellHeightPx,
|
|
78
80
|
plotSpanFactor,
|
|
79
81
|
setToolDrag,
|
|
80
82
|
levelDomain,
|
|
@@ -96,6 +98,8 @@ export function usePlotGestures({
|
|
|
96
98
|
renderer: ReturnType<typeof useNativeRenderer>;
|
|
97
99
|
plotSize: MeasuredCellSize;
|
|
98
100
|
plotAspect: number;
|
|
101
|
+
cellWidthPx: number;
|
|
102
|
+
cellHeightPx: number;
|
|
99
103
|
plotSpanFactor: number;
|
|
100
104
|
setToolDrag: Dispatch<SetStateAction<ChartToolDrag | null>>;
|
|
101
105
|
levelDomain: CompositeAxisDomain | null;
|
|
@@ -358,14 +362,17 @@ export function usePlotGestures({
|
|
|
358
362
|
}
|
|
359
363
|
setToolDrag(null);
|
|
360
364
|
if (isDrawingTool(drag.kind)) {
|
|
361
|
-
const drawing = resolveDrawingFromDrag(scene, panel, drag, drawColor, nextDrawingId()
|
|
365
|
+
const drawing = resolveDrawingFromDrag(scene, panel, drag, drawColor, nextDrawingId(), {
|
|
366
|
+
width: plotSize.width * cellWidthPx,
|
|
367
|
+
height: plotSize.height * cellHeightPx,
|
|
368
|
+
});
|
|
362
369
|
if (drawing) onDraw(drawing);
|
|
363
370
|
return;
|
|
364
371
|
}
|
|
365
372
|
if (drag.kind !== "zoom") return;
|
|
366
373
|
const range = resolveZoomBoxRange(scene, drag, frame.minimumSpanMs);
|
|
367
374
|
if (range) onSetViewport(range);
|
|
368
|
-
}, [drawColor, frame.minimumSpanMs, levels, onDraw, onSetViewport, panel, scene]);
|
|
375
|
+
}, [cellHeightPx, cellWidthPx, drawColor, frame.minimumSpanMs, levels, onDraw, onSetViewport, panel, plotSize.height, plotSize.width, scene]);
|
|
369
376
|
const resetDrag = useCallback(() => {
|
|
370
377
|
const drag = dragRef.current;
|
|
371
378
|
if (drag?.kind === "pan") {
|
|
@@ -153,7 +153,7 @@ export function CompositePanelSurface({
|
|
|
153
153
|
panel, scene, frame, viewport, armedTool, drawings, drawColor, levels, plotWidth,
|
|
154
154
|
onActivate, onPointerPress, onPickTime, onPickPrice, onSelectDrawing, onEditDrawing, onDraw, onSelectLevel,
|
|
155
155
|
onPanViewport, onSetViewport, onSetValueScale, onDragActiveChange, onToggleMaximized,
|
|
156
|
-
isDesktopWeb, renderer, plotSize, plotAspect, plotSpanFactor, setToolDrag,
|
|
156
|
+
isDesktopWeb, renderer, plotSize, plotAspect, cellWidthPx, cellHeightPx, plotSpanFactor, setToolDrag,
|
|
157
157
|
levelDomain, projectedLevels, levelDraftRef, setLevelDraft,
|
|
158
158
|
plotPointer, pointerRatios, updateCursor, stopCoast, startCoast,
|
|
159
159
|
});
|
|
@@ -37,7 +37,7 @@ interface PriceAxisLabelsProps {
|
|
|
37
37
|
axisColor?: string;
|
|
38
38
|
/** Anchors that stay put while the cursor moves, such as a measure start. */
|
|
39
39
|
extraMarkers?: readonly PriceAxisMarker[];
|
|
40
|
-
/**
|
|
40
|
+
/** Series observations, separate from a drawing tool's endpoint. */
|
|
41
41
|
seriesTags?: readonly SeriesAxisTag[];
|
|
42
42
|
measuredPixelHeight?: number;
|
|
43
43
|
/** A value axis the pointer stretches and squeezes: a drag or the wheel on it, a double click back. */
|
|
@@ -218,18 +218,20 @@ export function PriceAxisLabels({
|
|
|
218
218
|
data-gloom-side={side}
|
|
219
219
|
>
|
|
220
220
|
{Array.from({ length: height }, (_, row) => {
|
|
221
|
+
const seriesTag = fractionalViewport ? undefined : placedSeriesTags.find((tag) =>
|
|
222
|
+
Math.min(height - 1, Math.floor(tag.centerY / pixelHeight * height)) === row);
|
|
221
223
|
const isCursorRow = !usePixelOverlay && cursorLabel !== null && cursorRow === row;
|
|
222
224
|
const marker = usePixelOverlay || usePixelTicks
|
|
223
225
|
? undefined
|
|
224
226
|
: extraMarkers?.find((entry) => entry.row === row);
|
|
225
|
-
const label = isCursorRow
|
|
227
|
+
const label = seriesTag?.label ?? (isCursorRow
|
|
226
228
|
? cursorLabel
|
|
227
|
-
: marker?.label ?? (usePixelTicks || (footButton && row === height - 1) ? null : axisLabels.get(row) ?? null);
|
|
229
|
+
: marker?.label ?? (usePixelTicks || (footButton && row === height - 1) ? null : axisLabels.get(row) ?? null));
|
|
228
230
|
return (
|
|
229
231
|
<AxisRow
|
|
230
232
|
key={row}
|
|
231
233
|
label={label}
|
|
232
|
-
fg={isCursorRow ? cursorColor : marker ? marker.color : axisColor}
|
|
234
|
+
fg={seriesTag?.color ?? (isCursorRow ? cursorColor : marker ? marker.color : axisColor)}
|
|
233
235
|
side={side}
|
|
234
236
|
axisWidth={axisWidth}
|
|
235
237
|
axisSectionWidth={axisSectionWidth}
|
|
@@ -271,7 +273,7 @@ export function PriceAxisLabels({
|
|
|
271
273
|
{axisPaddingWidth > 0 ? <Box width={axisPaddingWidth} /> : null}
|
|
272
274
|
</Box>
|
|
273
275
|
)) : null}
|
|
274
|
-
{seriesTags ? <SeriesAxisTags placed={placedSeriesTags} pixelHeight={pixelHeight} lanes={lanes} background={cursorBackgroundColor} /> : null}
|
|
276
|
+
{seriesTags && fractionalViewport ? <SeriesAxisTags placed={placedSeriesTags} pixelHeight={pixelHeight} lanes={lanes} background={cursorBackgroundColor} /> : null}
|
|
275
277
|
{usePixelOverlay ? (
|
|
276
278
|
<Box
|
|
277
279
|
width={axisSectionWidth}
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
CompositePanelScene,
|
|
12
12
|
} from "./types";
|
|
13
13
|
import { clamp } from "../../../utils/math";
|
|
14
|
+
import { isRecord } from "../../../utils/guards";
|
|
14
15
|
|
|
15
16
|
/** Pointer tools that take the drag away from panning while one is picked. */
|
|
16
17
|
export type ChartToolKind = "measure" | "zoom" | "line" | "pencil" | "level" | "rect" | "fib" | "ray";
|
|
@@ -36,54 +37,129 @@ export interface ChartDrawing {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
export const CHART_DRAWINGS_SETTING_KEY = "chartDrawings";
|
|
40
|
+
|
|
41
|
+
// What a public link to a chart carries, and what a link it receives is held
|
|
42
|
+
// to. A pane's own saved drawings have no cap: they are the person's work.
|
|
39
43
|
const MAX_SHARED_CHART_DRAWINGS = 100;
|
|
40
44
|
const MAX_SHARED_DRAWING_POINTS = 5_000;
|
|
45
|
+
// A shared pane fits in 128 KB; a chart's setup takes a KB or two of the rest.
|
|
46
|
+
const MAX_SHARED_DRAWING_BYTES = 96 * 1024;
|
|
47
|
+
|
|
48
|
+
const MAX_DRAWING_ID_LENGTH = 160;
|
|
49
|
+
const DRAWING_KEYS: ReadonlySet<string> = new Set(["id", "panelId", "points", "color"]);
|
|
50
|
+
|
|
51
|
+
/** One saved drawing, or null when this build cannot read it. */
|
|
52
|
+
function parseChartDrawing(entry: unknown): ChartDrawing | null {
|
|
53
|
+
if (!isRecord(entry) || !Object.keys(entry).every((key) => DRAWING_KEYS.has(key))) return null;
|
|
54
|
+
if (
|
|
55
|
+
typeof entry.id !== "string"
|
|
56
|
+
|| entry.id.length === 0
|
|
57
|
+
|| entry.id.length > MAX_DRAWING_ID_LENGTH
|
|
58
|
+
|| typeof entry.panelId !== "string"
|
|
59
|
+
|| entry.panelId.length === 0
|
|
60
|
+
|| entry.panelId.length > 120
|
|
61
|
+
|| typeof entry.color !== "string"
|
|
62
|
+
|| !/^#[0-9a-f]{6}$/i.test(entry.color)
|
|
63
|
+
|| !Array.isArray(entry.points)
|
|
64
|
+
|| entry.points.length < 2
|
|
65
|
+
) return null;
|
|
66
|
+
const points: ChartDrawingPoint[] = [];
|
|
67
|
+
for (const point of entry.points) {
|
|
68
|
+
if (
|
|
69
|
+
!isRecord(point)
|
|
70
|
+
|| !Object.keys(point).every((key) => key === "time" || key === "value")
|
|
71
|
+
|| typeof point.time !== "number"
|
|
72
|
+
|| !Number.isFinite(point.time)
|
|
73
|
+
|| typeof point.value !== "number"
|
|
74
|
+
|| !Number.isFinite(point.value)
|
|
75
|
+
) return null;
|
|
76
|
+
points.push({ time: point.time, value: point.value });
|
|
77
|
+
}
|
|
78
|
+
return { id: entry.id, panelId: entry.panelId, points, color: entry.color };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** `id` with a mark that no drawing in `taken` has; the shape prefix stays first. */
|
|
82
|
+
function unusedDrawingId(id: string, taken: ReadonlySet<string>): string {
|
|
83
|
+
const base = id.slice(0, MAX_DRAWING_ID_LENGTH - 8);
|
|
84
|
+
for (let copy = 2; ; copy += 1) {
|
|
85
|
+
const candidate = `${base}~${copy}`;
|
|
86
|
+
if (!taken.has(candidate)) return candidate;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface SavedChartDrawings {
|
|
91
|
+
drawings: ChartDrawing[];
|
|
92
|
+
/** Entries this build cannot read, as they were, so writing the list back keeps them. */
|
|
93
|
+
unreadable: unknown[];
|
|
94
|
+
}
|
|
41
95
|
|
|
96
|
+
/**
|
|
97
|
+
* A pane's own saved drawings. An entry this build cannot read (damaged, or
|
|
98
|
+
* written by a newer build) is set aside on its own and every other one
|
|
99
|
+
* restores. Older builds reused ids across restarts, so two drawings can share
|
|
100
|
+
* one; the later gets an id of its own, or removing one would take both.
|
|
101
|
+
*/
|
|
102
|
+
export function readSavedChartDrawings(value: unknown): SavedChartDrawings {
|
|
103
|
+
const saved: SavedChartDrawings = { drawings: [], unreadable: [] };
|
|
104
|
+
if (!Array.isArray(value)) return saved;
|
|
105
|
+
const ids = new Set<string>();
|
|
106
|
+
for (const entry of value) {
|
|
107
|
+
const drawing = parseChartDrawing(entry);
|
|
108
|
+
if (!drawing) {
|
|
109
|
+
saved.unreadable.push(entry);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const id = ids.has(drawing.id) ? unusedDrawingId(drawing.id, ids) : drawing.id;
|
|
113
|
+
ids.add(id);
|
|
114
|
+
saved.drawings.push(id === drawing.id ? drawing : { ...drawing, id });
|
|
115
|
+
}
|
|
116
|
+
return saved;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Every drawing of a pane's own saved list that this build can read. */
|
|
42
120
|
export function parseChartDrawings(value: unknown): ChartDrawing[] {
|
|
43
|
-
|
|
121
|
+
return readSavedChartDrawings(value).drawings;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The drawings a received public link carries: all of them readable and
|
|
126
|
+
* within what a link carries, else null.
|
|
127
|
+
*/
|
|
128
|
+
export function parseSharedChartDrawings(value: unknown): ChartDrawing[] | null {
|
|
129
|
+
if (!Array.isArray(value) || value.length > MAX_SHARED_CHART_DRAWINGS) return null;
|
|
44
130
|
let pointCount = 0;
|
|
45
131
|
const drawings: ChartDrawing[] = [];
|
|
46
132
|
for (const entry of value) {
|
|
47
|
-
|
|
48
|
-
const drawing =
|
|
49
|
-
if (!
|
|
50
|
-
|
|
51
|
-
typeof drawing.id !== "string"
|
|
52
|
-
|| drawing.id.length === 0
|
|
53
|
-
|| drawing.id.length > 160
|
|
54
|
-
|| typeof drawing.panelId !== "string"
|
|
55
|
-
|| drawing.panelId.length === 0
|
|
56
|
-
|| drawing.panelId.length > 120
|
|
57
|
-
|| typeof drawing.color !== "string"
|
|
58
|
-
|| !/^#[0-9a-f]{6}$/i.test(drawing.color)
|
|
59
|
-
|| !Array.isArray(drawing.points)
|
|
60
|
-
|| drawing.points.length < 2
|
|
61
|
-
) return [];
|
|
62
|
-
pointCount += drawing.points.length;
|
|
63
|
-
if (pointCount > MAX_SHARED_DRAWING_POINTS) return [];
|
|
64
|
-
const points: ChartDrawingPoint[] = [];
|
|
65
|
-
for (const point of drawing.points) {
|
|
66
|
-
if (!point || typeof point !== "object" || Array.isArray(point)) return [];
|
|
67
|
-
const raw = point as Record<string, unknown>;
|
|
68
|
-
if (
|
|
69
|
-
!Object.keys(raw).every((key) => key === "time" || key === "value")
|
|
70
|
-
|| typeof raw.time !== "number"
|
|
71
|
-
|| !Number.isFinite(raw.time)
|
|
72
|
-
|| typeof raw.value !== "number"
|
|
73
|
-
|| !Number.isFinite(raw.value)
|
|
74
|
-
) return [];
|
|
75
|
-
points.push({ time: raw.time, value: raw.value });
|
|
76
|
-
}
|
|
77
|
-
drawings.push({
|
|
78
|
-
id: drawing.id,
|
|
79
|
-
panelId: drawing.panelId,
|
|
80
|
-
points,
|
|
81
|
-
color: drawing.color,
|
|
82
|
-
});
|
|
133
|
+
pointCount += isRecord(entry) && Array.isArray(entry.points) ? entry.points.length : 0;
|
|
134
|
+
const drawing = pointCount > MAX_SHARED_DRAWING_POINTS ? null : parseChartDrawing(entry);
|
|
135
|
+
if (!drawing) return null;
|
|
136
|
+
drawings.push(drawing);
|
|
83
137
|
}
|
|
84
138
|
return drawings;
|
|
85
139
|
}
|
|
86
140
|
|
|
141
|
+
const utf8 = new TextEncoder();
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* What of a pane's drawings a public link carries: the newest that fit in one,
|
|
145
|
+
* in their order. A chart with more shares its latest work, not nothing, and
|
|
146
|
+
* every build opens the link with its drawings.
|
|
147
|
+
*/
|
|
148
|
+
export function shareableChartDrawings(drawings: readonly ChartDrawing[]): ChartDrawing[] {
|
|
149
|
+
const kept: ChartDrawing[] = [];
|
|
150
|
+
let points = 0;
|
|
151
|
+
let bytes = 2;
|
|
152
|
+
for (let index = drawings.length - 1; index >= 0 && kept.length < MAX_SHARED_CHART_DRAWINGS; index -= 1) {
|
|
153
|
+
const drawing = drawings[index]!;
|
|
154
|
+
const size = utf8.encode(JSON.stringify(drawing)).byteLength + 1;
|
|
155
|
+
if (points + drawing.points.length > MAX_SHARED_DRAWING_POINTS || bytes + size > MAX_SHARED_DRAWING_BYTES) continue;
|
|
156
|
+
kept.push(drawing);
|
|
157
|
+
points += drawing.points.length;
|
|
158
|
+
bytes += size;
|
|
159
|
+
}
|
|
160
|
+
return kept.reverse();
|
|
161
|
+
}
|
|
162
|
+
|
|
87
163
|
/**
|
|
88
164
|
* The shape rides in the id (`fib:3`) rather than a field of its own: an older
|
|
89
165
|
* build refuses a saved drawing with a key it does not know and would drop every
|
|
@@ -149,13 +225,62 @@ function drawingPointFrom(
|
|
|
149
225
|
: { time: unprojectCompositeTimestamp(scene.timeScale, xRatio), value };
|
|
150
226
|
}
|
|
151
227
|
|
|
152
|
-
/**
|
|
228
|
+
/** The plot's size in pixels, which a freehand stroke is simplified against. */
|
|
229
|
+
interface PlotPixelSize {
|
|
230
|
+
width: number;
|
|
231
|
+
height: number;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* How far, in plot pixels, a saved freehand stroke may stray from the trail
|
|
236
|
+
* the pointer drew: under one, so the stroke looks the same once let go.
|
|
237
|
+
*/
|
|
238
|
+
const STROKE_TOLERANCE_PX = 0.5;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* The pointer's trail with only the points its shape needs: every point it had
|
|
242
|
+
* stays within `STROKE_TOLERANCE_PX` of the line through the ones kept
|
|
243
|
+
* (Ramer-Douglas-Peucker). The pointer reports every move, so a slow or long
|
|
244
|
+
* stroke would otherwise save thousands of points along the same line.
|
|
245
|
+
*/
|
|
246
|
+
function simplifyStroke<T extends { xRatio: number; yRatio: number }>(path: readonly T[], plot: PlotPixelSize): T[] {
|
|
247
|
+
if (path.length <= 2 || !(plot.width > 0 && plot.height > 0)) return [...path];
|
|
248
|
+
const pixels = path.map((point) => ({ x: point.xRatio * plot.width, y: point.yRatio * plot.height }));
|
|
249
|
+
const keep = new Uint8Array(path.length);
|
|
250
|
+
keep[0] = 1;
|
|
251
|
+
keep[path.length - 1] = 1;
|
|
252
|
+
// A stack, not recursion: a long stroke is thousands of points deep.
|
|
253
|
+
const spans: Array<[number, number]> = [[0, path.length - 1]];
|
|
254
|
+
while (spans.length > 0) {
|
|
255
|
+
const [first, last] = spans.pop()!;
|
|
256
|
+
let farthest = -1;
|
|
257
|
+
let distance = STROKE_TOLERANCE_PX;
|
|
258
|
+
for (let index = first + 1; index < last; index += 1) {
|
|
259
|
+
// To the segment, not its line: a stroke that doubles back keeps its turn.
|
|
260
|
+
const next = distanceToSegment(pixels[index]!, pixels[first]!, pixels[last]!);
|
|
261
|
+
if (next > distance) {
|
|
262
|
+
distance = next;
|
|
263
|
+
farthest = index;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
if (farthest < 0) continue;
|
|
267
|
+
keep[farthest] = 1;
|
|
268
|
+
spans.push([first, farthest], [farthest, last]);
|
|
269
|
+
}
|
|
270
|
+
return path.filter((_, index) => keep[index] === 1);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Data anchors for a finished drag, so a drawing survives pan and zoom. Given
|
|
275
|
+
* the plot's pixel size, a freehand stroke keeps only the points its shape needs.
|
|
276
|
+
*/
|
|
153
277
|
export function resolveDrawingFromDrag(
|
|
154
278
|
scene: Pick<CompositeChartScene, "timeScale">,
|
|
155
279
|
panel: CompositePanelScene,
|
|
156
280
|
drag: ChartToolDrag,
|
|
157
281
|
color: string,
|
|
158
282
|
id: string,
|
|
283
|
+
plot?: PlotPixelSize,
|
|
159
284
|
): ChartDrawing | null {
|
|
160
285
|
const domain = resolveMeasureAxisDomain(panel);
|
|
161
286
|
// A ray needs only its price, so a click places one.
|
|
@@ -169,7 +294,7 @@ export function resolveDrawingFromDrag(
|
|
|
169
294
|
return start && end ? { id: shapedDrawingId(drag.kind, id), panelId: panel.id, points: [start, end], color } : null;
|
|
170
295
|
}
|
|
171
296
|
const source = drag.kind === "pencil" && drag.path.length > 1
|
|
172
|
-
? drag.path
|
|
297
|
+
? plot ? simplifyStroke(drag.path, plot) : drag.path
|
|
173
298
|
: [
|
|
174
299
|
{ xRatio: drag.startXRatio, yRatio: drag.startYRatio },
|
|
175
300
|
{ xRatio: drag.endXRatio, yRatio: drag.endYRatio },
|
|
@@ -10,6 +10,7 @@ import { PriceSparkline } from "../price-sparkline/view";
|
|
|
10
10
|
import { StatGrid, type StatItem } from "../ui/stat-grid";
|
|
11
11
|
import type { TableWidthColumn } from "../ui/table-layout";
|
|
12
12
|
import { CHART_COMPACT_ROWS, chartTableChromeRows, chartTableLayout, type ChartTableLayout } from "./layout";
|
|
13
|
+
import { useRemoteUiNode } from "../../remote/semantic-tree";
|
|
13
14
|
|
|
14
15
|
const DAY_MS = 86_400_000;
|
|
15
16
|
/** Daily series shorter than this still span two weeks, so the axis reads days, not hours. */
|
|
@@ -75,7 +76,7 @@ export interface ChartTableHeaderProps {
|
|
|
75
76
|
height: number;
|
|
76
77
|
/** Body rows the table holds. */
|
|
77
78
|
tableRows: number;
|
|
78
|
-
/**
|
|
79
|
+
/** Rows occupied by the table header, disclosure and scrollbars. */
|
|
79
80
|
tableChromeRows?: number;
|
|
80
81
|
/** The table's columns, to count its scrollbar row when `tableChromeRows` is not given. */
|
|
81
82
|
tableColumns?: readonly TableWidthColumn[];
|
|
@@ -180,7 +181,7 @@ export function useChartTableLayout(props: ChartTableHeaderProps): ChartTableLay
|
|
|
180
181
|
figures: props.figures,
|
|
181
182
|
tableRows: props.tableRows,
|
|
182
183
|
tableChromeRows: props.tableChromeRows
|
|
183
|
-
?? (props.tableColumns ? chartTableChromeRows(props.tableColumns, props.width) : undefined),
|
|
184
|
+
?? (props.tableColumns ? chartTableChromeRows(props.tableColumns, props.width, props.tableRows) : undefined),
|
|
184
185
|
chart: hasChart
|
|
185
186
|
? {
|
|
186
187
|
minRows: chart.minRows,
|
|
@@ -205,6 +206,14 @@ export function ChartTableHeader(props: ChartTableHeaderProps) {
|
|
|
205
206
|
const { width, query, chart } = props;
|
|
206
207
|
const colors = useThemeColors();
|
|
207
208
|
const layout = useChartTableLayout(props);
|
|
209
|
+
const essential = props.figures?.filter((item) => item.essential === true) ?? [];
|
|
210
|
+
useRemoteUiNode(essential.length ? {
|
|
211
|
+
role: "figure-layout", label: "Essential figures",
|
|
212
|
+
metadata: {
|
|
213
|
+
figures: essential.map(({ label, value }) => ({ label, value })),
|
|
214
|
+
omitted: essential.filter((item) => !layout.figures.includes(item)).map((item) => item.label),
|
|
215
|
+
},
|
|
216
|
+
} : null);
|
|
208
217
|
const series = chart?.series;
|
|
209
218
|
const viewport = useMemo(() => {
|
|
210
219
|
if (chart?.viewport || !series?.length) return chart?.viewport;
|