@gloom-sh/terminal 0.20.21 → 0.20.23
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 +4 -3
- package/patches/electrobun-devkit@2.0.5.patch +169 -3
- package/src/account/heard-from-question.tsx +6 -4
- package/src/account/heard-from.ts +3 -4
- package/src/api-client/buybacks.ts +108 -0
- package/src/api-client/data.ts +213 -1
- package/src/api-client/dilution.ts +183 -0
- package/src/api-client/earnings.ts +2 -2
- package/src/api-client/equity-screener.ts +7 -0
- package/src/api-client/exchange-announcements.ts +16 -5
- package/src/api-client/exchange-short-balances.ts +24 -0
- package/src/api-client/heard-from.ts +5 -7
- package/src/api-client/hk-cbbc.ts +134 -0
- package/src/api-client/hk-ccass.ts +233 -0
- package/src/api-client/index.ts +55 -3
- package/src/api-client/jpx-short-positions.ts +24 -0
- package/src/api-client/market-discovery.ts +34 -6
- package/src/api-client/members.ts +5 -0
- package/src/api-client/ownership-disclosures.ts +68 -0
- package/src/api-client/paths.ts +2 -2
- package/src/api-client/request.ts +39 -10
- package/src/api-client/revenue-breakdown.ts +6 -2
- package/src/api-client/sfc-short-positions.ts +19 -0
- package/src/api-client/supply-chain.ts +22 -0
- package/src/api-client/taiwan-revenue.ts +134 -0
- package/src/api-client/types/jobs.ts +1 -0
- package/src/api-client/types/ticker-data.ts +3 -1
- package/src/api-client/types/world-venues.ts +1 -0
- package/src/app/language-observer.tsx +6 -1
- package/src/app/pane-runtime/plugin-bindings.ts +9 -4
- package/src/app/runtime/plugin-bindings.ts +20 -2
- package/src/architecture/core-builtin-allowlist.json +2 -2
- package/src/architecture/dom-cell-metrics-allowlist.json +2 -2
- package/src/architecture/dom-text-cuts-allowlist.json +2 -2
- package/src/architecture/floating-promise-allowlist.json +2 -2
- package/src/architecture/pane-tabs-allowlist.json +3 -0
- package/src/brokers/account-cache.ts +2 -1
- package/src/brokers/account-choice.ts +121 -0
- package/src/brokers/broker-portfolio-sync.ts +30 -5
- package/src/brokers/profile-form.ts +3 -0
- package/src/brokers/signed-in/adapter.ts +16 -5
- package/src/brokers/sync-broker-instance.ts +27 -3
- package/src/capabilities/asset-data-inputs.ts +8 -0
- package/src/capabilities/factories.ts +4 -0
- package/src/cli/commands/market.ts +141 -76
- package/src/cli/commands/news-search.ts +12 -0
- package/src/cli/commands/options-chain.ts +9 -3
- package/src/cli/commands/options-leaps.ts +55 -30
- package/src/cli/commands/overview.ts +20 -23
- package/src/cli/commands/search.ts +2 -1
- package/src/cli/commands/ticker.ts +17 -18
- package/src/cli/csv-export.ts +9 -5
- package/src/cli/desktop-pane-shot-browser.ts +143 -53
- package/src/cli/desktop-pane-shot.ts +50 -64
- package/src/cli/export-source.ts +9 -4
- package/src/cli/history-demergers.ts +134 -11
- package/src/cli/history-rows.ts +47 -7
- package/src/cli/listing-arg.ts +45 -18
- package/src/cli/pane-functions/catalog-snapshot.json +26 -22
- package/src/cli/pane-functions/catalog.ts +6 -2
- package/src/cli/pane-functions/data.ts +3 -1
- package/src/cli/pane-functions/dom.ts +8 -5
- package/src/cli/pane-functions/freshness.ts +6 -1
- package/src/cli/pane-functions/function-help.ts +32 -2
- package/src/cli/pane-functions/headless.ts +79 -27
- package/src/cli/pane-functions/index.ts +2 -1
- package/src/cli/pane-functions/market-session.ts +13 -3
- package/src/cli/pane-functions/resolver.ts +4 -1
- package/src/cli/pane-functions/screenshot-assessment.ts +26 -10
- package/src/cli/pane-functions/screenshot-bridge.ts +4 -1
- package/src/cli/pane-functions/screenshot-data-evidence.ts +11 -5
- package/src/cli/pane-functions/screenshot-payload.ts +21 -3
- package/src/cli/pane-functions/screenshot-render.ts +2 -0
- package/src/cli/pane-functions/ticker-question.ts +52 -47
- package/src/cli/rendered-table-rows.ts +75 -0
- package/src/cli/report-tables.ts +7 -1
- package/src/cli/result.ts +9 -2
- package/src/cli/symbol-list.ts +52 -14
- package/src/cli/ticker-resolution.ts +133 -38
- package/src/cli/visible-key-values.ts +3 -2
- package/src/components/chart/composite/composite-chart.tsx +12 -0
- package/src/components/chart/composite/format.ts +14 -1
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +37 -14
- package/src/components/chart/composite/panel-surface.tsx +1 -0
- package/src/components/chart/composite/text-renderer.ts +104 -44
- package/src/components/chart/composite/types.ts +18 -0
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +38 -15
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart-table/header.tsx +11 -5
- package/src/components/chart-table/selection.ts +20 -1
- package/src/components/command-bar/routes/root/start-here.ts +1 -1
- package/src/components/command-bar/routes/ticker-search/results.ts +2 -1
- package/src/components/data-table/export.ts +3 -1
- package/src/components/data-table/sections.ts +12 -1
- package/src/components/data-table/view.tsx +52 -8
- package/src/components/feed-data-table/stack-view.tsx +88 -5
- package/src/components/index.ts +3 -3
- package/src/components/layout/floating-pane.tsx +5 -2
- package/src/components/layout/pane/header.tsx +33 -32
- package/src/components/layout/pane/index.tsx +6 -2
- package/src/components/layout/pane/link-note.ts +12 -0
- package/src/components/layout/pane/title.ts +1 -3
- package/src/components/market-board/index.tsx +8 -11
- package/src/components/reader/reader-text.tsx +25 -2
- package/src/components/ticker/badge/index.tsx +9 -4
- package/src/components/ticker/badge/list.tsx +3 -1
- package/src/components/ticker/list-table-view.tsx +4 -0
- package/src/components/ui/data-table/column-fit.ts +129 -0
- package/src/components/ui/data-table/display-columns.ts +28 -9
- package/src/components/ui/data-table/index.tsx +64 -16
- package/src/components/ui/data-table/muted-row.tsx +47 -0
- package/src/components/ui/data-table/opentui/index.tsx +47 -11
- package/src/components/ui/data-table/spill.ts +36 -0
- package/src/components/ui/data-table/types.ts +113 -6
- package/src/components/ui/data-table/use-column-order.ts +11 -0
- package/src/components/ui/data-table/visible-range.ts +9 -1
- package/src/components/ui/day-cell.ts +30 -0
- package/src/components/ui/icon.tsx +50 -3
- package/src/components/ui/index.ts +3 -1
- package/src/components/ui/list-view.tsx +2 -2
- package/src/components/ui/prose.tsx +3 -1
- package/src/components/ui/table-layout.ts +220 -6
- package/src/components/ui/terminal-hover-label.tsx +49 -0
- package/src/components/use-pinned-moment.ts +222 -13
- package/src/core/state/app/layout.ts +7 -2
- package/src/core/state/app/state.ts +17 -4
- package/src/core/state/app/types.ts +2 -1
- package/src/data/config/store/legacy-tabs.ts +51 -0
- package/src/data/config/store/node.ts +2 -2
- package/src/data/config/store/normalize.ts +11 -5
- package/src/data/config/store/shared-file.ts +8 -7
- package/src/data/config/store/shared-layout.ts +146 -0
- package/src/data/sqlite/access.ts +90 -12
- package/src/data/sqlite/checkpointer.ts +75 -12
- package/src/data/sqlite/database.ts +18 -1
- package/src/data/sqlite/retry.ts +1 -1
- package/src/docs/load.ts +5 -2
- package/src/docs/snapshot.json +1862 -4456
- package/src/i18n/es.ts +109 -0
- package/src/i18n/index.ts +74 -4
- package/src/i18n/ja.ts +109 -0
- package/src/i18n/ko.ts +109 -0
- package/src/i18n/react.ts +10 -2
- package/src/i18n/zh-cn.ts +109 -0
- package/src/i18n/zh-tw.ts +109 -0
- package/src/layout/pane-manager/dock-normalization.ts +61 -0
- package/src/market-data/ah-pair.ts +7 -2
- package/src/market-data/fund-actions.ts +21 -0
- package/src/market-data/market/freshness.ts +39 -35
- package/src/market-data/market/globex-day.ts +14 -0
- package/src/market-data/market/split-price-basis.ts +55 -0
- package/src/market-data/market/status.ts +2 -4
- package/src/market-data/price-adjustments.ts +115 -0
- package/src/market-data/published-us-sessions.ts +3 -2
- package/src/market-data/quotes/balance-sheet-rate.ts +6 -2
- package/src/market-data/quotes/day-range.ts +24 -9
- package/src/market-data/quotes/freshness.ts +4 -3
- package/src/market-data/quotes/live-valuation.ts +4 -2
- package/src/market-data/quotes/metadata.ts +48 -5
- package/src/market-data/quotes/regular-session-valuation.ts +18 -1
- package/src/market-data/quotes/resolution.ts +18 -29
- package/src/market-data/quotes/time.ts +138 -14
- package/src/news/query-presets.ts +6 -4
- package/src/plugins/builtin/alerts/cli-forms.ts +3 -0
- package/src/plugins/builtin/alerts/cli.ts +19 -7
- package/src/plugins/builtin/alerts/events-pane.tsx +1 -0
- package/src/plugins/builtin/alerts/format.ts +22 -10
- package/src/plugins/builtin/alerts/headless.ts +7 -4
- package/src/plugins/builtin/alerts/history-pane.tsx +93 -36
- package/src/plugins/builtin/alerts/history-rows.ts +24 -1
- package/src/plugins/builtin/alerts/index.tsx +8 -10
- package/src/plugins/builtin/alerts/metric-data.ts +24 -6
- package/src/plugins/builtin/alerts/pane.tsx +9 -0
- package/src/plugins/builtin/alerts/pro-rules.ts +1 -0
- package/src/plugins/builtin/alerts/research-builder.ts +6 -2
- package/src/plugins/builtin/alerts/research-rules.ts +12 -0
- package/src/plugins/builtin/alerts/types.ts +1 -0
- package/src/plugins/builtin/awards/detail.tsx +5 -4
- package/src/plugins/builtin/awards/headless.ts +13 -4
- package/src/plugins/builtin/awards/model.ts +36 -1
- package/src/plugins/builtin/awards/pane.tsx +29 -9
- package/src/plugins/builtin/backtest/pane.tsx +4 -2
- package/src/plugins/builtin/bond-calculator/pane.tsx +2 -1
- package/src/plugins/builtin/broker-manager/detail.tsx +67 -4
- package/src/plugins/builtin/broker-manager/index.tsx +35 -4
- package/src/plugins/builtin/broker-manager/keyboard.ts +10 -0
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +35 -2
- package/src/plugins/builtin/broker-trading/orders.tsx +14 -5
- package/src/plugins/builtin/broker-trading/ticket.tsx +1 -0
- package/src/plugins/builtin/buildout/format.ts +3 -1
- package/src/plugins/builtin/buybacks/client.ts +48 -0
- package/src/plugins/builtin/buybacks/index.tsx +22 -0
- package/src/plugins/builtin/buybacks/model.ts +151 -0
- package/src/plugins/builtin/buybacks/pane.tsx +140 -0
- package/src/plugins/builtin/buybacks/series.ts +36 -0
- package/src/plugins/builtin/catalysts/detail.tsx +14 -8
- package/src/plugins/builtin/catalysts/evidence.ts +11 -3
- package/src/plugins/builtin/catalysts/headless.ts +51 -8
- package/src/plugins/builtin/catalysts/kinds.ts +413 -0
- package/src/plugins/builtin/catalysts/model.ts +61 -18
- package/src/plugins/builtin/catalysts/pane.tsx +85 -19
- package/src/plugins/builtin/cds/client.ts +9 -2
- package/src/plugins/builtin/cds/headless.ts +25 -10
- package/src/plugins/builtin/cds/model.ts +37 -12
- package/src/plugins/builtin/cds/pane.tsx +18 -10
- package/src/plugins/builtin/chart-composer/chart-spec-edit.ts +68 -7
- package/src/plugins/builtin/chart-composer/chart-title.ts +114 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +13 -1
- package/src/plugins/builtin/chart-composer/index.tsx +2 -68
- package/src/plugins/builtin/chart-composer/leverage-overlay.ts +2 -4
- package/src/plugins/builtin/chart-composer/pane.tsx +11 -3
- package/src/plugins/builtin/chart-composer/presets.ts +1 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +46 -12
- package/src/plugins/builtin/chat/channels.ts +5 -2
- package/src/plugins/builtin/chat/content/composer-runtime.ts +64 -65
- package/src/plugins/builtin/chat/content/footer.tsx +17 -7
- package/src/plugins/builtin/chat/content/index.tsx +108 -36
- package/src/plugins/builtin/chat/content/new-dm-dialog.tsx +21 -8
- package/src/plugins/builtin/chat/content/selection-runtime.ts +16 -0
- package/src/plugins/builtin/chat/content/shortcuts.ts +3 -0
- package/src/plugins/builtin/chat/content/snapshot.ts +37 -13
- package/src/plugins/builtin/chat/content/transcript.tsx +12 -0
- package/src/plugins/builtin/chat/content/types.ts +2 -0
- package/src/plugins/builtin/chat/controller/channels.ts +15 -15
- package/src/plugins/builtin/chat/controller/draft-sync.ts +13 -7
- package/src/plugins/builtin/chat/controller/index.ts +140 -34
- package/src/plugins/builtin/chat/controller/lifecycle.ts +8 -12
- package/src/plugins/builtin/chat/controller/persistence.ts +32 -4
- package/src/plugins/builtin/chat/controller/send.ts +41 -17
- package/src/plugins/builtin/chat/controller/session-runtime.ts +28 -27
- package/src/plugins/builtin/chat/controller/state.ts +21 -8
- package/src/plugins/builtin/chat/controller/storage.ts +41 -4
- package/src/plugins/builtin/chat/controller/view.ts +6 -3
- package/src/plugins/builtin/chat/index.tsx +1 -1
- package/src/plugins/builtin/chat/layout.ts +8 -1
- package/src/plugins/builtin/chat/message/desktop.tsx +15 -11
- package/src/plugins/builtin/chat/message/header.tsx +112 -30
- package/src/plugins/builtin/chat/message/reactions.tsx +10 -11
- package/src/plugins/builtin/chat/message/render-state.ts +4 -2
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/message/types.ts +5 -0
- package/src/plugins/builtin/chat/pane-requests.ts +8 -4
- package/src/plugins/builtin/clinical-trials/model.ts +2 -2
- package/src/plugins/builtin/clinical-trials/pane.tsx +3 -3
- package/src/plugins/builtin/cloud/askg/pane.tsx +60 -50
- package/src/plugins/builtin/cloud/auth-actions.tsx +2 -1
- package/src/plugins/builtin/cloud-tweets/table.tsx +25 -2
- package/src/plugins/builtin/comment-letters/pane.tsx +4 -2
- package/src/plugins/builtin/commodity-balances/headless.ts +2 -1
- package/src/plugins/builtin/company-attention/building-model.ts +3 -4
- package/src/plugins/builtin/company-attention/building.tsx +2 -0
- package/src/plugins/builtin/company-attention/headless.ts +2 -2
- package/src/plugins/builtin/company-attention/model.ts +2 -0
- package/src/plugins/builtin/company-attention/moves-model.ts +2 -1
- package/src/plugins/builtin/company-attention/moves.tsx +2 -0
- package/src/plugins/builtin/company-attention/pane.tsx +17 -3
- package/src/plugins/builtin/company-attention/signals-model.ts +3 -4
- package/src/plugins/builtin/company-attention/signals.tsx +5 -0
- package/src/plugins/builtin/company-kpis/headless.ts +26 -10
- package/src/plugins/builtin/company-kpis/model.ts +58 -10
- package/src/plugins/builtin/company-kpis/pane.tsx +36 -19
- package/src/plugins/builtin/company-kpis/taiwan-monthly-model.ts +99 -0
- package/src/plugins/builtin/company-kpis/taiwan-monthly-view.tsx +327 -0
- package/src/plugins/builtin/composite/ownership-browser.ts +28 -0
- package/src/plugins/builtin/composite/ownership.ts +5 -1
- package/src/plugins/builtin/congress-trades/detail.tsx +44 -8
- package/src/plugins/builtin/congress-trades/headless.ts +15 -11
- package/src/plugins/builtin/congress-trades/model.ts +104 -11
- package/src/plugins/builtin/congress-trades/pane.tsx +11 -6
- package/src/plugins/builtin/congress-trades/table.tsx +17 -10
- package/src/plugins/builtin/congress-trades/use-feed.ts +13 -2
- package/src/plugins/builtin/correlation/compute.ts +6 -1
- package/src/plugins/builtin/correlation/headless.ts +2 -2
- package/src/plugins/builtin/correlation/relationship/pane.tsx +11 -8
- package/src/plugins/builtin/correlation/relationship/view-model.ts +1 -19
- package/src/plugins/builtin/cot/headless.ts +1 -1
- package/src/plugins/builtin/cot/pane.tsx +7 -2
- package/src/plugins/builtin/cpi/headless.ts +2 -1
- package/src/plugins/builtin/credit-conditions/headless.ts +2 -1
- package/src/plugins/builtin/credit-documents/detail.tsx +2 -1
- package/src/plugins/builtin/credit-documents/export.ts +18 -12
- package/src/plugins/builtin/credit-documents/model.ts +106 -25
- package/src/plugins/builtin/credit-documents/pane.tsx +9 -5
- package/src/plugins/builtin/crypto-board/defi-view.tsx +2 -1
- package/src/plugins/builtin/crypto-board/defi.ts +5 -4
- package/src/plugins/builtin/crypto-board/headless.ts +7 -2
- package/src/plugins/builtin/crypto-board/model.ts +6 -4
- package/src/plugins/builtin/crypto-board/pane.tsx +2 -1
- package/src/plugins/builtin/crypto-board/supply.ts +4 -3
- package/src/plugins/builtin/crypto-etf-flows/headless.ts +15 -8
- package/src/plugins/builtin/crypto-etf-flows/pane.tsx +6 -5
- package/src/plugins/builtin/custom-view/loader.ts +95 -34
- package/src/plugins/builtin/custom-view/pane.tsx +31 -41
- package/src/plugins/builtin/custom-view/table.ts +201 -0
- package/src/plugins/builtin/debt-maturities/headless.ts +56 -38
- package/src/plugins/builtin/debt-maturities/model.ts +2 -1
- package/src/plugins/builtin/debt-maturities/pane.tsx +24 -22
- package/src/plugins/builtin/dilution/index.tsx +74 -0
- package/src/plugins/builtin/dilution/model.ts +159 -0
- package/src/plugins/builtin/dilution/pane.tsx +592 -0
- package/src/plugins/builtin/dividend-yield/client.ts +14 -17
- package/src/plugins/builtin/dividend-yield/headless.ts +24 -16
- package/src/plugins/builtin/dividend-yield/index.tsx +2 -1
- package/src/plugins/builtin/dividend-yield/model.ts +52 -10
- package/src/plugins/builtin/dividend-yield/pane.tsx +89 -17
- package/src/plugins/builtin/dividend-yield/ranking-view.tsx +6 -2
- package/src/plugins/builtin/dividend-yield/ranking.ts +7 -3
- package/src/plugins/builtin/dividend-yield/types.ts +2 -3
- package/src/plugins/builtin/dividend-yield/view.ts +58 -12
- package/src/plugins/builtin/docs/index.tsx +1 -1
- package/src/plugins/builtin/docs/pane.tsx +7 -3
- package/src/plugins/builtin/docs/use-docs.ts +2 -1
- package/src/plugins/builtin/earnings/board-model.ts +19 -6
- package/src/plugins/builtin/earnings/board-table.ts +64 -48
- package/src/plugins/builtin/earnings/board.tsx +93 -51
- package/src/plugins/builtin/earnings/headless.ts +71 -12
- package/src/plugins/builtin/earnings/history-model.ts +28 -15
- package/src/plugins/builtin/earnings/history.tsx +1 -1
- package/src/plugins/builtin/earnings-calls/calendar.tsx +23 -10
- package/src/plugins/builtin/earnings-calls/format.ts +34 -0
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -4
- package/src/plugins/builtin/earnings-calls/pane.tsx +22 -17
- package/src/plugins/builtin/earnings-calls/transcript-view.tsx +14 -12
- package/src/plugins/builtin/earnings-ripple/pane.tsx +4 -3
- package/src/plugins/builtin/econ/calendar-model.ts +207 -3
- package/src/plugins/builtin/econ/columns.ts +132 -0
- package/src/plugins/builtin/econ/index.tsx +27 -79
- package/src/plugins/builtin/econ-statistics/detail.tsx +2 -2
- package/src/plugins/builtin/econ-statistics/headless.ts +10 -5
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -3
- package/src/plugins/builtin/econ-statistics/view.ts +15 -4
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/model.ts +12 -3
- package/src/plugins/builtin/estimate-revisions/headless.ts +23 -2
- package/src/plugins/builtin/estimate-revisions/model.ts +63 -13
- package/src/plugins/builtin/estimate-revisions/pane.tsx +228 -225
- package/src/plugins/builtin/estimate-revisions/sorting.ts +8 -16
- package/src/plugins/builtin/exposure/drivers.ts +5 -2
- package/src/plugins/builtin/exposure/headless.ts +6 -3
- package/src/plugins/builtin/exposure/model.ts +2 -1
- package/src/plugins/builtin/exposure/pane.tsx +16 -7
- package/src/plugins/builtin/fear-greed/format.ts +7 -7
- package/src/plugins/builtin/fear-greed/pane.tsx +21 -7
- package/src/plugins/builtin/futures-curve/headless.ts +14 -9
- package/src/plugins/builtin/futures-curve/model.ts +12 -4
- package/src/plugins/builtin/futures-curve/pane.tsx +18 -15
- package/src/plugins/builtin/fx-matrix/headless.ts +3 -2
- package/src/plugins/builtin/gpu/headless.ts +10 -4
- package/src/plugins/builtin/holders/beneficial-model.ts +1 -1
- package/src/plugins/builtin/holders/beneficial-view.tsx +3 -2
- package/src/plugins/builtin/holders/ccass-market-pane.tsx +363 -0
- package/src/plugins/builtin/holders/ccass-view.tsx +323 -0
- package/src/plugins/builtin/holders/disclosures-view.tsx +66 -0
- package/src/plugins/builtin/holders/disclosures.ts +47 -0
- package/src/plugins/builtin/holders/headless.ts +9 -2
- package/src/plugins/builtin/holders/index.tsx +75 -1
- package/src/plugins/builtin/holders/pane.tsx +37 -10
- package/src/plugins/builtin/holders/report-rows.ts +2 -0
- package/src/plugins/builtin/holders/table-model.ts +14 -6
- package/src/plugins/builtin/holders/types.ts +2 -2
- package/src/plugins/builtin/insider/activity-chart.ts +141 -0
- package/src/plugins/builtin/insider/headless.ts +2 -1
- package/src/plugins/builtin/insider/index.tsx +74 -12
- package/src/plugins/builtin/insider/signals-cells.tsx +15 -8
- package/src/plugins/builtin/insider/signals.tsx +6 -5
- package/src/plugins/builtin/insider/table-model.ts +17 -17
- package/src/plugins/builtin/insider/table.tsx +18 -10
- package/src/plugins/builtin/ipo-calendar/headless.ts +55 -11
- package/src/plugins/builtin/ipo-calendar/listing-ipo.ts +31 -4
- package/src/plugins/builtin/ipo-calendar/model.ts +238 -48
- package/src/plugins/builtin/ipo-calendar/pane.tsx +91 -25
- package/src/plugins/builtin/iv-history/client.ts +17 -8
- package/src/plugins/builtin/iv-history/format.ts +23 -12
- package/src/plugins/builtin/iv-history/headless.ts +9 -5
- package/src/plugins/builtin/iv-history/model.ts +15 -13
- package/src/plugins/builtin/iv-history/pane.tsx +5 -2
- package/src/plugins/builtin/iv-history/screen-pane.tsx +46 -24
- package/src/plugins/builtin/jobs/headless.ts +4 -3
- package/src/plugins/builtin/jobs/pane.tsx +6 -5
- package/src/plugins/builtin/jodi/headless.ts +15 -2
- package/src/plugins/builtin/jodi/model.ts +46 -5
- package/src/plugins/builtin/jodi/pane.tsx +17 -13
- package/src/plugins/builtin/kelly-sizer/headless.ts +11 -4
- package/src/plugins/builtin/kelly-sizer/pane.tsx +19 -9
- package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -1
- package/src/plugins/builtin/kelly-sizer/units.ts +26 -0
- package/src/plugins/builtin/macro-day/pane.tsx +12 -5
- package/src/plugins/builtin/market-halts/model.ts +10 -8
- package/src/plugins/builtin/market-halts/pane.tsx +15 -3
- package/src/plugins/builtin/market-heatmap/data.ts +17 -2
- package/src/plugins/builtin/market-heatmap/headless.ts +56 -6
- package/src/plugins/builtin/market-heatmap/index.tsx +55 -1
- package/src/plugins/builtin/market-heatmap/model.ts +27 -1
- package/src/plugins/builtin/market-movers/model.ts +7 -1
- package/src/plugins/builtin/market-movers/session-table.ts +1 -0
- package/src/plugins/builtin/market-movers/session.ts +1 -1
- package/src/plugins/builtin/market-movers/table.ts +1 -1
- package/src/plugins/builtin/members/headless.ts +13 -5
- package/src/plugins/builtin/members/model.ts +35 -1
- package/src/plugins/builtin/members/pane.tsx +16 -8
- package/src/plugins/builtin/mna/distress/detail.tsx +7 -6
- package/src/plugins/builtin/mna/distress/model.ts +7 -7
- package/src/plugins/builtin/mna/distress/pane.tsx +8 -7
- package/src/plugins/builtin/mna/headless.ts +40 -7
- package/src/plugins/builtin/mna/model.ts +66 -6
- package/src/plugins/builtin/mna/pane.tsx +118 -60
- package/src/plugins/builtin/news/wire/industry-pane.tsx +1 -0
- package/src/plugins/builtin/news/wire/news/row.ts +5 -12
- package/src/plugins/builtin/news/wire/news/table.tsx +46 -44
- package/src/plugins/builtin/notes/index.tsx +2 -1
- package/src/plugins/builtin/openfda/model.ts +1 -1
- package/src/plugins/builtin/openfda/pane.tsx +37 -9
- package/src/plugins/builtin/options/analytics.ts +30 -6
- package/src/plugins/builtin/options/calc-seed.ts +38 -3
- package/src/plugins/builtin/options/footer.ts +18 -1
- package/src/plugins/builtin/options/live-quotes.ts +21 -6
- package/src/plugins/builtin/options/open-interest-as-of.ts +5 -0
- package/src/plugins/builtin/options/quote-context.tsx +21 -8
- package/src/plugins/builtin/options/table.ts +17 -2
- package/src/plugins/builtin/options/view.tsx +97 -46
- package/src/plugins/builtin/options-calculator/model.ts +65 -3
- package/src/plugins/builtin/options-calculator/pane.tsx +11 -3
- package/src/plugins/builtin/options-calculator/valuation.ts +33 -0
- package/src/plugins/builtin/options-positioning/cbbc-model.ts +160 -0
- package/src/plugins/builtin/options-positioning/cbbc-view.tsx +453 -0
- package/src/plugins/builtin/options-positioning/index.tsx +22 -1
- package/src/plugins/builtin/options-positioning/pane.tsx +16 -1
- package/src/plugins/builtin/options-scenario/charts.tsx +2 -1
- package/src/plugins/builtin/options-scenario/csp-screen-headless.ts +5 -5
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +11 -14
- package/src/plugins/builtin/options-scenario/csp-screen.ts +9 -1
- package/src/plugins/builtin/options-scenario/headless.ts +3 -3
- package/src/plugins/builtin/options-scenario/index.tsx +1 -1
- package/src/plugins/builtin/options-scenario/model.ts +7 -0
- package/src/plugins/builtin/options-scenario/pane.tsx +24 -14
- package/src/plugins/builtin/pe-band/headless.ts +1 -1
- package/src/plugins/builtin/pe-band/model.ts +41 -18
- package/src/plugins/builtin/pe-band/pane.tsx +8 -6
- package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/equity-row.tsx +4 -6
- package/src/plugins/builtin/perps/headless.ts +19 -12
- package/src/plugins/builtin/perps/markets-section.tsx +19 -15
- package/src/plugins/builtin/perps/model.ts +14 -5
- package/src/plugins/builtin/portfolio-list/cached-account.ts +3 -1
- package/src/plugins/builtin/portfolio-list/cli/import-positions.ts +6 -18
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +1 -1
- package/src/plugins/builtin/portfolio-list/pane/purchase-date-fx.ts +1 -1
- package/src/plugins/builtin/portfolio-list/positions-import/index.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/positions-import/lookup.ts +28 -57
- package/src/plugins/builtin/portfolio-list/settings.ts +4 -3
- package/src/plugins/builtin/portfolio-list/table.tsx +19 -2
- package/src/plugins/builtin/power/client.ts +2 -2
- package/src/plugins/builtin/power/detail.tsx +11 -8
- package/src/plugins/builtin/power/gas-model.ts +2 -1
- package/src/plugins/builtin/power/gas.tsx +3 -2
- package/src/plugins/builtin/power/headless.ts +4 -1
- package/src/plugins/builtin/power/model.ts +19 -0
- package/src/plugins/builtin/power/pane.tsx +5 -4
- package/src/plugins/builtin/power/prices-headless.ts +4 -3
- package/src/plugins/builtin/power/prices.tsx +7 -6
- package/src/plugins/builtin/primary-dealers/headless.ts +1 -1
- package/src/plugins/builtin/primary-dealers/model.ts +2 -1
- package/src/plugins/builtin/rate-path/headless.ts +5 -2
- package/src/plugins/builtin/rate-path/pane.tsx +13 -10
- package/src/plugins/builtin/realized-vol/fx-proxy.ts +7 -8
- package/src/plugins/builtin/realized-vol/headless.ts +3 -4
- package/src/plugins/builtin/realized-vol/pane.tsx +5 -4
- package/src/plugins/builtin/relative-rotation/headless.ts +2 -1
- package/src/plugins/builtin/research/analyst-model.ts +1 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +2 -1
- package/src/plugins/builtin/research/earnings-estimates-pane.tsx +262 -0
- package/src/plugins/builtin/research/event-charts.ts +322 -0
- package/src/plugins/builtin/research/event-data.ts +140 -0
- package/src/plugins/builtin/research/event-detail.tsx +442 -0
- package/src/plugins/builtin/research/event-model.ts +338 -39
- package/src/plugins/builtin/research/event-sources.ts +58 -8
- package/src/plugins/builtin/research/event-views.tsx +397 -0
- package/src/plugins/builtin/research/events-headless.ts +60 -4
- package/src/plugins/builtin/research/headless-schema.ts +2 -2
- package/src/plugins/builtin/research/headless.ts +84 -7
- package/src/plugins/builtin/research/index.tsx +19 -17
- package/src/plugins/builtin/research/relative-valuation-columns.ts +39 -14
- package/src/plugins/builtin/research/relative-valuation-headless.ts +9 -5
- package/src/plugins/builtin/research/relative-valuation-model.ts +23 -8
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +10 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +9 -4
- package/src/plugins/builtin/revenue-breakdown/headless.ts +1 -1
- package/src/plugins/builtin/revenue-breakdown/index.tsx +2 -1
- package/src/plugins/builtin/revenue-breakdown/model.ts +2 -0
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +10 -0
- package/src/plugins/builtin/risk-factors/pane.tsx +14 -9
- package/src/plugins/builtin/scanner/flow-pane.tsx +10 -0
- package/src/plugins/builtin/scanner/headless.ts +2 -0
- package/src/plugins/builtin/scanner/lock-note.ts +5 -9
- package/src/plugins/builtin/sec/exchange-filings.ts +69 -0
- package/src/plugins/builtin/sec/fund-facts.ts +10 -8
- package/src/plugins/builtin/sec/headless.ts +60 -8
- package/src/plugins/builtin/sec/index.tsx +169 -61
- package/src/plugins/builtin/sec/model.ts +10 -4
- package/src/plugins/builtin/sec/row-summaries.ts +1 -0
- package/src/plugins/builtin/series-inventory.ts +4 -0
- package/src/plugins/builtin/shared/beat-miss-chart.ts +66 -0
- package/src/plugins/builtin/shared/day-entries.ts +41 -0
- package/src/plugins/builtin/shared/earnings-calendar.ts +80 -53
- package/src/plugins/builtin/shared/earnings-report.ts +53 -15
- package/src/plugins/builtin/shared/history-span.ts +2 -1
- package/src/plugins/builtin/shared/locked-rows.tsx +1 -1
- package/src/plugins/builtin/shared/pro-lock-note.ts +8 -12
- package/src/plugins/builtin/shared/report-freshness.ts +4 -1
- package/src/plugins/builtin/shared/ticker-request.ts +4 -2
- package/src/plugins/builtin/shared/volatility/live-session.ts +6 -7
- package/src/plugins/builtin/shared/volatility/option-snapshot.ts +30 -0
- package/src/plugins/builtin/shared/volatility/quote-session.ts +49 -0
- package/src/plugins/builtin/short-interest/exchange-balances.ts +76 -0
- package/src/plugins/builtin/short-interest/exchange-positions-pane.tsx +55 -0
- package/src/plugins/builtin/short-interest/headless.ts +15 -2
- package/src/plugins/builtin/short-interest/index.tsx +7 -3
- package/src/plugins/builtin/short-interest/jpx.ts +38 -0
- package/src/plugins/builtin/short-interest/model.ts +3 -2
- package/src/plugins/builtin/short-interest/pane.tsx +4 -3
- package/src/plugins/builtin/short-interest/publications-model.ts +73 -2
- package/src/plugins/builtin/short-interest/publications-pane.tsx +16 -4
- package/src/plugins/builtin/short-interest/sfc.ts +40 -0
- package/src/plugins/builtin/short-interest/surface.tsx +16 -2
- package/src/plugins/builtin/short-volume/headless.ts +18 -3
- package/src/plugins/builtin/short-volume/model.ts +6 -1
- package/src/plugins/builtin/short-volume/pane.tsx +8 -7
- package/src/plugins/builtin/short-volume/sgx.ts +23 -0
- package/src/plugins/builtin/social-mentions/outliers-model.ts +2 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +10 -8
- package/src/plugins/builtin/supply-chain/client.ts +10 -2
- package/src/plugins/builtin/supply-chain/directories.ts +18 -0
- package/src/plugins/builtin/supply-chain/evidence.ts +12 -4
- package/src/plugins/builtin/supply-chain/headless.ts +20 -7
- package/src/plugins/builtin/supply-chain/pane.tsx +40 -11
- package/src/plugins/builtin/thirteenf/api.ts +299 -31
- package/src/plugins/builtin/thirteenf/data.ts +126 -32
- package/src/plugins/builtin/thirteenf/format.ts +4 -6
- package/src/plugins/builtin/thirteenf/headless.ts +68 -29
- package/src/plugins/builtin/thirteenf/model.ts +24 -11
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +16 -8
- package/src/plugins/builtin/thirteenf/pane.tsx +45 -22
- package/src/plugins/builtin/thirteenf/report-notes.ts +52 -2
- package/src/plugins/builtin/thirteenf/session-scope.ts +57 -0
- package/src/plugins/builtin/thirteenf/signals-pane.tsx +17 -4
- package/src/plugins/builtin/thirteenf/split-history.ts +119 -0
- package/src/plugins/builtin/thirteenf/table.ts +6 -6
- package/src/plugins/builtin/thirteenf/types.ts +17 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +11 -0
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +12 -8
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +5 -4
- package/src/plugins/builtin/ticker-detail/data-panes/returns-model.ts +7 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +12 -5
- package/src/plugins/builtin/ticker-detail/financials/aggregation.ts +35 -5
- package/src/plugins/builtin/ticker-detail/financials/exchange-table.tsx +61 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +210 -43
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +69 -8
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +64 -10
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +132 -68
- package/src/plugins/builtin/ticker-detail/headless.ts +37 -13
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +75 -14
- package/src/plugins/builtin/ticker-detail/overview/model.ts +87 -35
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -8
- package/src/plugins/builtin/ticker-detail/overview/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +50 -17
- package/src/plugins/builtin/ticker-detail/pane.tsx +5 -3
- package/src/plugins/builtin/ticker-detail/research-groups.ts +15 -2
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +2 -1
- package/src/plugins/builtin/time-sales/headless.ts +3 -3
- package/src/plugins/builtin/time-sales/model.ts +16 -9
- package/src/plugins/builtin/time-sales/pane.tsx +27 -24
- package/src/plugins/builtin/trace-bonds/pane.tsx +3 -2
- package/src/plugins/builtin/treasury-auctions/cache.ts +44 -19
- package/src/plugins/builtin/treasury-auctions/client.ts +9 -4
- package/src/plugins/builtin/treasury-daily/client.ts +43 -9
- package/src/plugins/builtin/treasury-daily/pane.tsx +48 -27
- package/src/plugins/builtin/treasury-daily/resource.ts +33 -0
- package/src/plugins/builtin/vol-surface/charts.tsx +3 -1
- package/src/plugins/builtin/vol-surface/events.ts +8 -5
- package/src/plugins/builtin/vol-surface/evidence.ts +2 -2
- package/src/plugins/builtin/vol-surface/headless.ts +46 -28
- package/src/plugins/builtin/vol-surface/heat-grid.tsx +2 -1
- package/src/plugins/builtin/vol-surface/model.ts +34 -9
- package/src/plugins/builtin/vol-surface/pane.tsx +35 -67
- package/src/plugins/builtin/vol-surface/quote-coverage.ts +68 -0
- package/src/plugins/builtin/vol-surface/tables.ts +57 -6
- package/src/plugins/builtin/volatility/charts.tsx +7 -3
- package/src/plugins/builtin/volatility/headless.ts +5 -5
- package/src/plugins/builtin/volatility/pane.tsx +8 -5
- package/src/plugins/builtin/world-indices/headless.ts +5 -3
- package/src/plugins/builtin/world-venue-map/headless.ts +15 -1
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +5 -3
- package/src/plugins/builtin/world-venue-map/pane.tsx +4 -3
- package/src/plugins/builtin/world-venue-map/venue-exceptions.ts +72 -0
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +20 -11
- package/src/plugins/builtin/yield-curve/headless.ts +4 -2
- package/src/plugins/builtin/yield-curve/index.tsx +4 -3
- package/src/plugins/catalog-browser.ts +3 -34
- package/src/plugins/marketplace/feed.ts +3 -2
- package/src/plugins/registry/contributions.ts +37 -10
- package/src/plugins/registry/index.ts +2 -1
- package/src/portfolio/column-values.ts +8 -9
- package/src/portfolio/positions-import/parse.ts +14 -6
- package/src/portfolio/positions-import/plan.ts +3 -2
- package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
- package/src/public/i18n.ts +3 -2
- package/src/react/async-resource.ts +3 -1
- package/src/renderers/dom/css.d.ts +1 -0
- package/src/renderers/dom/data-table/index.tsx +100 -8
- package/src/renderers/dom/data-table/row.tsx +40 -4
- package/src/renderers/dom/desktop/icons.tsx +147 -3
- package/src/renderers/dom/desktop/popover.tsx +2 -2
- package/src/renderers/dom/host/media-surface.tsx +204 -45
- package/src/renderers/dom/host/tabs.tsx +1 -0
- package/src/renderers/dom/styles.css +14 -2
- package/src/renderers/electrobun/bun/desktop/backend.ts +14 -1
- package/src/renderers/electrobun/bun/desktop/rpc-timing.ts +9 -3
- package/src/renderers/electrobun/shared/protocol.ts +2 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +5 -2
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +7 -1
- package/src/renderers/electrobun/view/remote/asset-data-client.ts +2 -0
- package/src/renderers/electrobun/view/rpc-timeout.ts +44 -3
- package/src/sources/gloomberb-cloud/batched-lookups.ts +12 -1
- package/src/sources/gloomberb-cloud/index.ts +44 -10
- package/src/sources/gloomberb-cloud/normalizers.ts +8 -2
- package/src/sources/listing-symbols.ts +7 -1
- package/src/sources/provider-router/cache.ts +5 -4
- package/src/sources/provider-router/financials.ts +44 -22
- package/src/sources/provider-router/index.ts +9 -1
- package/src/state/app/context/index.tsx +12 -4
- package/src/state/app/tab-cursor.ts +47 -6
- package/src/sync/broker-instances.ts +63 -11
- package/src/sync/config-merge.ts +1 -1
- package/src/sync/sanitize.ts +2 -0
- package/src/telemetry/stall-clocks.ts +3 -0
- package/src/telemetry/stall-reports.ts +12 -3
- package/src/telemetry/windows-process-activity.ts +41 -0
- package/src/telemetry/windows-time.ts +32 -0
- package/src/test-support/cloud-api.ts +34 -0
- package/src/test-support/scoped-earnings.ts +24 -0
- package/src/test-support/strict-table-capture.tsx +83 -0
- package/src/tickers/search/index.ts +23 -7
- package/src/tickers/terminal-codes.ts +1 -6
- package/src/time-series/alignment.ts +14 -4
- package/src/time-series/base-series.ts +5 -4
- package/src/time-series/chart-data.ts +2 -0
- package/src/time-series/chart-seed.ts +3 -1
- package/src/time-series/daily-valuation.ts +13 -6
- package/src/time-series/filed-trailing-eps.ts +16 -3
- package/src/time-series/fundamentals/current-valuation.ts +30 -5
- package/src/time-series/fundamentals/historical-valuation.ts +20 -0
- package/src/time-series/fundamentals/history-link.ts +25 -0
- package/src/time-series/fundamentals/quarterly-ttm.ts +50 -5
- package/src/time-series/fundamentals/series.ts +13 -1
- package/src/time-series/market.ts +30 -4
- package/src/time-series/price-comparison.ts +39 -60
- package/src/time-series/resolve.ts +18 -11
- package/src/time-series/spec.ts +2 -1
- package/src/time-series/studies/formula.ts +4 -2
- package/src/time-series/studies/indicators.ts +2 -0
- package/src/time-series/studies/pair.ts +4 -2
- package/src/time-series/studies/shared.ts +1 -0
- package/src/time-series/types.ts +2 -1
- package/src/time-series/use-chart-resolution.ts +32 -14
- package/src/time-series/valuation-currency.ts +2 -0
- package/src/types/config.ts +13 -61
- package/src/types/data-provider.ts +8 -0
- package/src/types/financials.ts +94 -15
- package/src/types/headless.ts +30 -0
- package/src/types/plugin-context.ts +8 -1
- package/src/ui/dialog-context.ts +8 -0
- package/src/utils/crypto-pair.ts +10 -0
- package/src/utils/datetime-format.ts +23 -1
- package/src/utils/day-format.ts +104 -0
- package/src/utils/declared-dividends.ts +12 -2
- package/src/utils/exchange-announcements.ts +38 -12
- package/src/utils/exchange-notation.generated.ts +3 -1
- package/src/utils/exchanges.ts +2 -1
- package/src/utils/financial-statements.ts +40 -46
- package/src/utils/format.ts +39 -12
- package/src/utils/forward-dividend.ts +2 -1
- package/src/utils/fundamentals.ts +1 -0
- package/src/utils/main-thread-stall.ts +9 -1
- package/src/utils/rpc-timeout-error.ts +36 -11
- package/src/utils/sec.ts +3 -1
- package/src/utils/share-multiples.ts +1 -1
- package/src/utils/stall-process-activity.ts +70 -0
- package/src/utils/statement-scope.ts +103 -0
- package/src/utils/trailing-dividend.ts +47 -0
- package/src/utils/trailing-eps.ts +1 -1
- package/src/utils/zoned-date-time.ts +1 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +0 -771
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { formatDay } from "../../../components/ui/day-cell";
|
|
2
3
|
import { Box, TextAttributes, useUiCapabilities } from "../../../ui";
|
|
3
4
|
import { withCompanyLogo } from "../../../components/company-logo";
|
|
4
5
|
import {
|
|
@@ -323,7 +324,7 @@ export function CryptoBoardPane({ width, height, focused }: PaneProps) {
|
|
|
323
324
|
supplyChangeFigure("change-7d", "7D change", total.change7d, total.change7dPercent),
|
|
324
325
|
supplyChangeFigure("change-30d", "30D change", total.change30d, total.change30dPercent),
|
|
325
326
|
// Its publisher and where the count starts, as the DeFi tab's source says them: ALL draws from that day's few coins.
|
|
326
|
-
{ id: "source", label: "Source", value: STABLECOIN_SUPPLY_PUBLISHER, ...(since ? { detail: `daily since ${since}` } : {}) },
|
|
327
|
+
{ id: "source", label: "Source", value: STABLECOIN_SUPPLY_PUBLISHER, ...(since ? { detail: `daily since ${formatDay(since)}` } : {}) },
|
|
327
328
|
];
|
|
328
329
|
}, [stablecoins, supply]);
|
|
329
330
|
const supplyError = !supply && supplyResource.error ? supplyResource.error : null;
|
|
@@ -123,8 +123,9 @@ export function supplyHistoryStart(payload: StablecoinSupplyPayload | null | und
|
|
|
123
123
|
/**
|
|
124
124
|
* `Total supply 306.33B · 7D -1.45B (-0.47%) · 30D +1.75B (+0.57%) · as of 2026-10-18 UTC close · DefiLlama, daily since 2017-11-28`,
|
|
125
125
|
* as the CLI states it and as it states the DeFi total: the start says where the count, and a chart of ALL, begins.
|
|
126
|
+
* Its days are ISO, as JSON and CSV keep them; the text writes them day first (`day`, `formatDay`).
|
|
126
127
|
*/
|
|
127
|
-
export function supplySummaryLine(payload: StablecoinSupplyPayload): string | null {
|
|
128
|
+
export function supplySummaryLine(payload: StablecoinSupplyPayload, day: (value: string) => string = (value) => value): string | null {
|
|
128
129
|
const total = payload.total;
|
|
129
130
|
if (!total) return null;
|
|
130
131
|
const change = (amount: number | null, percent: number | null) => (
|
|
@@ -135,8 +136,8 @@ export function supplySummaryLine(payload: StablecoinSupplyPayload): string | nu
|
|
|
135
136
|
`Total supply ${formatCompact(total.supply, { fixedDecimals: true })}`,
|
|
136
137
|
`7D ${change(total.change7d, total.change7dPercent)}`,
|
|
137
138
|
`30D ${change(total.change30d, total.change30dPercent)}`,
|
|
138
|
-
...(payload.asOf ? [utcCloseAsOfText(payload.asOf)] : []),
|
|
139
|
-
`${STABLECOIN_SUPPLY_PUBLISHER}${since ? `, daily since ${since}` : ""}`,
|
|
139
|
+
...(payload.asOf ? [utcCloseAsOfText(payload.asOf, day)] : []),
|
|
140
|
+
`${STABLECOIN_SUPPLY_PUBLISHER}${since ? `, daily since ${day(since)}` : ""}`,
|
|
140
141
|
].join(" · ");
|
|
141
142
|
}
|
|
142
143
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatDay } from "../../../utils/day-format";
|
|
1
2
|
import type { CryptoEtfFlowsPayload } from "../../../api-client/crypto-etf-flows";
|
|
2
3
|
import type { HeadlessPaneColumn, HeadlessPaneFreshness } from "../../../types/headless";
|
|
3
4
|
import type { HeadlessPaneDefinition } from "../../../types/plugin";
|
|
@@ -31,29 +32,33 @@ function flowColumns(payload: CryptoEtfFlowsPayload): HeadlessPaneColumn[] {
|
|
|
31
32
|
key: fund.ticker, header: fund.ticker, literalHeader: true, align: "right",
|
|
32
33
|
format: (value, row) => value == null && Array.isArray(row.pending) && row.pending.includes(fund.ticker) ? "pending" : flowCell(value),
|
|
33
34
|
})),
|
|
34
|
-
{ key: "pending", header: "Pending", format: (value) => Array.isArray(value) && value.length ? value.join(", ") : "" },
|
|
35
|
+
{ key: "pending", header: "Pending", omitWhenEmpty: true, format: (value) => Array.isArray(value) && value.length ? value.join(", ") : "" },
|
|
35
36
|
];
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
/** A day as a note writes it: ISO, as JSON and CSV keep it, or day first (`formatDay`) in the text. */
|
|
40
|
+
type NoteDay = (day: string) => string;
|
|
41
|
+
const isoNoteDay: NoteDay = (day) => day;
|
|
42
|
+
|
|
38
43
|
/** "Net flows of the US spot bitcoin ETFs in US$ millions. 2026-10-19 to 2026-10-23: +$301.20M over 5 trading days." */
|
|
39
|
-
function windowSummaryLine(payload: CryptoEtfFlowsPayload, window: PriceWindow, days: CryptoEtfFlowsPayload["days"]): string {
|
|
44
|
+
function windowSummaryLine(payload: CryptoEtfFlowsPayload, window: PriceWindow, days: CryptoEtfFlowsPayload["days"], day: NoteDay = isoNoteDay): string {
|
|
40
45
|
const total = days.some((day) => day.total != null) ? days.reduce((sum, day) => sum + (day.total ?? 0), 0) : null;
|
|
41
|
-
return `Net flows of the US spot ${cryptoEtfFlowAssetLabel(payload.asset).toLowerCase()} ETFs in US$ millions. ${window.from} to ${window.to}: `
|
|
46
|
+
return `Net flows of the US spot ${cryptoEtfFlowAssetLabel(payload.asset).toLowerCase()} ETFs in US$ millions. ${day(window.from)} to ${day(window.to)}: `
|
|
42
47
|
+ `${formatFlowAmount(total)} over ${days.length} trading ${days.length === 1 ? "day" : "days"}.`;
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
/** "Net flows of the US spot bitcoin ETFs in US$ millions. 2026-10-20: -$6.70M (IBIT pending); 5 days ..., since 2024-01-11 +$57.47B." */
|
|
46
|
-
function summaryLine(payload: CryptoEtfFlowsPayload): string {
|
|
51
|
+
function summaryLine(payload: CryptoEtfFlowsPayload, day: NoteDay = isoNoteDay): string {
|
|
47
52
|
const summary = cryptoEtfFlowSummary(payload);
|
|
48
53
|
const pending = pendingText(summary.latest);
|
|
49
54
|
return [
|
|
50
55
|
`Net flows of the US spot ${cryptoEtfFlowAssetLabel(payload.asset).toLowerCase()} ETFs in US$ millions.`,
|
|
51
|
-
`${summary.latest?.date ?? payload.asOf}: ${formatFlowAmount(summary.latest?.total)}${pending ? ` (${pending})` : ""};`,
|
|
56
|
+
`${day(summary.latest?.date ?? payload.asOf)}: ${formatFlowAmount(summary.latest?.total)}${pending ? ` (${pending})` : ""};`,
|
|
52
57
|
[
|
|
53
58
|
// A day still pending is left out of the rolling sums, which say the day they end on.
|
|
54
|
-
summary.week != null ? `5 days${summary.through ? ` through ${summary.through}` : ""} ${formatFlowAmount(summary.week)}` : null,
|
|
55
|
-
summary.month != null ? `20 days${summary.through ? ` through ${summary.through}` : ""} ${formatFlowAmount(summary.month)}` : null,
|
|
56
|
-
summary.firstDate ? `since ${summary.firstDate} ${formatFlowAmount(summary.sinceLaunch)}` : null,
|
|
59
|
+
summary.week != null ? `5 days${summary.through ? ` through ${day(summary.through)}` : ""} ${formatFlowAmount(summary.week)}` : null,
|
|
60
|
+
summary.month != null ? `20 days${summary.through ? ` through ${day(summary.through)}` : ""} ${formatFlowAmount(summary.month)}` : null,
|
|
61
|
+
summary.firstDate ? `since ${day(summary.firstDate)} ${formatFlowAmount(summary.sinceLaunch)}` : null,
|
|
57
62
|
].filter(Boolean).join(", ") + ".",
|
|
58
63
|
].join(" ");
|
|
59
64
|
}
|
|
@@ -172,6 +177,8 @@ export const cryptoEtfFlowsHeadless: HeadlessPaneDefinition<"rows"> = {
|
|
|
172
177
|
columns: flowColumns(payload),
|
|
173
178
|
...(window && !days.length ? { errors: [`No US trading day with flows from ${window.from} to ${window.to}.`] } : {}),
|
|
174
179
|
notes: [window ? windowSummaryLine(payload, window, days) : summaryLine(payload), ...funds ? [funds] : [], `Source: ${payload.source.publisher}, ${payload.source.url}`],
|
|
180
|
+
// The text reads the days first, as the pane does; JSON and CSV keep them in ISO.
|
|
181
|
+
textNotes: [window ? windowSummaryLine(payload, window, days, formatDay) : summaryLine(payload, formatDay), ...funds ? [funds] : [], `Source: ${payload.source.publisher}, ${payload.source.url}`],
|
|
175
182
|
complete: !payload.stale,
|
|
176
183
|
...(payload.stale ? { warnings: [`The flows were last read ${payload.fetchedAt.slice(0, 10)}; newer days may be missing.`] } : {}),
|
|
177
184
|
freshness: cryptoEtfFlowFreshness(payload, asOf, !(window && asOf !== payload.asOf)),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { dayCell, formatDay } from "../../../components/ui/day-cell";
|
|
1
2
|
import { useCallback, useMemo } from "react";
|
|
2
3
|
import type { CryptoEtfFlowAsset, CryptoEtfFlowDay } from "../../../api-client/crypto-etf-flows";
|
|
3
4
|
import { isAccessDenied } from "../../../api-client/errors";
|
|
@@ -89,7 +90,7 @@ export function CryptoEtfFlowsPane({ focused, width, height }: PaneProps) {
|
|
|
89
90
|
const points = cumulativeFlows(data).filter((point) => point.date >= first)
|
|
90
91
|
.map((point) => scalarPoint(new Date(`${point.date}T00:00:00Z`), point.value * 1_000_000));
|
|
91
92
|
const launch = data.days.at(-1)?.date;
|
|
92
|
-
return [staticSeries(points, { id: `etf-flows:${asset}`, label: `${label} ETF net flows since ${launch
|
|
93
|
+
return [staticSeries(points, { id: `etf-flows:${asset}`, label: `${label} ETF net flows since ${launch ? formatDay(launch) : "launch"}`, color: colors.positive, calendarSpaced: true })];
|
|
93
94
|
}, [asset, data, days, label]);
|
|
94
95
|
const link = useChartTableSelection({ rows: days, getId: rowId, getDate: rowDate, selectedId, onSelect: selectDay, focused });
|
|
95
96
|
|
|
@@ -97,12 +98,12 @@ export function CryptoEtfFlowsPane({ focused, width, height }: PaneProps) {
|
|
|
97
98
|
const pending = pendingText(latest);
|
|
98
99
|
const figures: StatItem[] = summary ? [
|
|
99
100
|
{ id: "latest", label: "Latest day", value: formatFlowAmount(latest?.total), color: flowColor(latest?.total, colors),
|
|
100
|
-
detail: [latest?.date, pending].filter(Boolean).join(" · ") || undefined },
|
|
101
|
+
detail: [latest?.date ? formatDay(latest.date) : null, pending].filter(Boolean).join(" · ") || undefined },
|
|
101
102
|
// The rolling sums leave out a day still pending, and say the day they end on.
|
|
102
103
|
{ id: "week", label: "5 days", value: formatFlowAmount(summary.week), color: flowColor(summary.week, colors),
|
|
103
|
-
...summary.through ? { detail: `through ${summary.through}` } : {} },
|
|
104
|
+
...summary.through ? { detail: `through ${formatDay(summary.through)}` } : {} },
|
|
104
105
|
{ id: "month", label: "20 days", value: formatFlowAmount(summary.month), color: flowColor(summary.month, colors),
|
|
105
|
-
...summary.through ? { detail: `through ${summary.through}` } : {} },
|
|
106
|
+
...summary.through ? { detail: `through ${formatDay(summary.through)}` } : {} },
|
|
106
107
|
] : [];
|
|
107
108
|
|
|
108
109
|
const updatedAgo = useUpdatedAgo(resource.updatedAt);
|
|
@@ -143,7 +144,7 @@ export function CryptoEtfFlowsPane({ focused, width, height }: PaneProps) {
|
|
|
143
144
|
}, [range, refresh, resetChartView, selectRange]);
|
|
144
145
|
|
|
145
146
|
const renderCell = useCallback((day: CryptoEtfFlowDay, column: CryptoEtfFlowColumn): DataTableCell => {
|
|
146
|
-
if (column.id === "date") return {
|
|
147
|
+
if (column.id === "date") return { ...dayCell(day.date), color: colors.text };
|
|
147
148
|
if (column.id === "total") return { text: formatFlow(day.total), value: day.total, color: flowColor(day.total, colors) };
|
|
148
149
|
if (column.id === "price") return { text: formatPriceChange(day.priceChangePct), value: day.priceChangePct ?? null, color: flowColor(day.priceChangePct, colors) };
|
|
149
150
|
const ticker = fundTickerOfColumn(column.id) ?? "";
|
|
@@ -1,14 +1,27 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
HeadlessBundleResult,
|
|
3
|
+
HeadlessPaneColumn,
|
|
4
|
+
HeadlessPaneDefinition,
|
|
5
|
+
HeadlessPaneResult,
|
|
6
|
+
HeadlessPaneRow,
|
|
7
|
+
HeadlessRowsResult,
|
|
8
|
+
HeadlessSeries,
|
|
9
|
+
HeadlessSeriesResult,
|
|
10
|
+
HeadlessSnapshotResult,
|
|
11
|
+
} from "../../../types/headless";
|
|
12
|
+
import { loadResolvedHeadlessPaneModel } from "../../../cli/pane-functions/headless";
|
|
3
13
|
import { resolvePaneFunction, UnknownPaneFunctionError } from "../../../cli/pane-functions/resolver";
|
|
4
14
|
import type { AppConfig } from "../../../types/config";
|
|
15
|
+
import { formatCompact } from "../../../utils/format";
|
|
5
16
|
import { getSharedRegistry, type PluginRegistry } from "../../registry";
|
|
6
17
|
import { marketContextFromRegistry } from "../cloud/askg/host";
|
|
7
18
|
import { notViewSourceMessage, unknownViewSourceMessage } from "./sources";
|
|
19
|
+
import { withViewRowSource } from "./table";
|
|
8
20
|
import { applyViewProjection, unknownViewKeys, type UnknownViewKey, type ViewKeyPlace, type ViewRow, type ViewSource, type ViewSpec } from "./view-spec";
|
|
9
21
|
|
|
10
22
|
export interface LoadedView {
|
|
11
23
|
rows: ViewRow[];
|
|
24
|
+
/** The source's columns as it defines them, formats included, so the view draws a value as the source does. */
|
|
12
25
|
columns: HeadlessPaneColumn[];
|
|
13
26
|
errors: string[];
|
|
14
27
|
sourceLabel: string;
|
|
@@ -23,40 +36,89 @@ export function setViewRefResolver(resolver: ViewRefResolver | null): void {
|
|
|
23
36
|
refResolver = resolver;
|
|
24
37
|
}
|
|
25
38
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
/** Every key the rows carry, headed by the key, for a source that lists no columns. */
|
|
40
|
+
function rowKeyColumns(rows: readonly HeadlessPaneRow[]): HeadlessPaneColumn[] {
|
|
41
|
+
const keys = new Set<string>();
|
|
42
|
+
for (const row of rows) for (const key of Object.keys(row)) keys.add(key);
|
|
43
|
+
return [...keys].map((key) => ({ key, header: key }));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** A section of entries flattens into rows of its label and value. */
|
|
47
|
+
const ENTRY_COLUMNS: HeadlessPaneColumn[] = [{ key: "label", header: "Label" }, { key: "value", header: "Value" }];
|
|
48
|
+
const ENTRY_COLUMN_MAP: ReadonlyMap<string, HeadlessPaneColumn> = new Map(ENTRY_COLUMNS.map((column) => [column.key, column]));
|
|
49
|
+
|
|
50
|
+
/** A series value at the decimals or in the short form the text report prints it with. */
|
|
51
|
+
function seriesFormat(series: HeadlessSeries): Pick<HeadlessPaneColumn, "format"> {
|
|
52
|
+
const { textDecimals, textCompact } = series;
|
|
53
|
+
if (textCompact) return { format: (value) => (typeof value === "number" ? formatCompact(value) : "") };
|
|
54
|
+
if (textDecimals !== undefined) return { format: (value) => (typeof value === "number" ? value.toFixed(textDecimals) : "") };
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A point's date as the text it sorts and filters by: an ISO instant for a time, the string the source gave otherwise. */
|
|
59
|
+
function seriesDate(date: HeadlessSeries["points"][number]["date"]): string {
|
|
60
|
+
if (date instanceof Date) return Number.isFinite(date.getTime()) ? date.toISOString() : "";
|
|
61
|
+
if (typeof date === "number") return Number.isFinite(date) ? new Date(date).toISOString() : "";
|
|
62
|
+
return String(date);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The source's result as one table, with the columns that draw it as the
|
|
67
|
+
* source defines them (their formats too). A bundle flattens into one table
|
|
68
|
+
* with a section column, each row tagged with its own section's columns,
|
|
69
|
+
* since two sections can format one key apart; a series into rows of date
|
|
70
|
+
* plus one column per series.
|
|
71
|
+
*/
|
|
72
|
+
function viewTableFrom(definition: HeadlessPaneDefinition, result: HeadlessPaneResult): { rows: ViewRow[]; columns: HeadlessPaneColumn[] } {
|
|
73
|
+
switch (definition.shape) {
|
|
74
|
+
case "rows": {
|
|
75
|
+
const { rows, columns } = result as HeadlessRowsResult;
|
|
76
|
+
return { rows, columns: columns ?? definition.columns ?? rowKeyColumns(rows) };
|
|
41
77
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
78
|
+
case "snapshot": {
|
|
79
|
+
const { items } = result as HeadlessSnapshotResult;
|
|
80
|
+
return { rows: items, columns: definition.columns ?? rowKeyColumns(items) };
|
|
81
|
+
}
|
|
82
|
+
case "bundle": {
|
|
83
|
+
const rows: ViewRow[] = [];
|
|
84
|
+
const columns = new Map<string, HeadlessPaneColumn>([["section", { key: "section", header: "Section" }]]);
|
|
85
|
+
for (const section of (result as HeadlessBundleResult).sections) {
|
|
86
|
+
if (section.entries) {
|
|
87
|
+
for (const column of ENTRY_COLUMNS) if (!columns.has(column.key)) columns.set(column.key, column);
|
|
88
|
+
for (const entry of section.entries) {
|
|
89
|
+
rows.push(withViewRowSource({ section: section.title, label: entry.label, value: entry.value }, {
|
|
90
|
+
columns: ENTRY_COLUMN_MAP,
|
|
91
|
+
...(entry.formatted !== undefined ? { text: { value: entry.formatted } } : {}),
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
const own = section.columns ?? definition.columns ?? rowKeyColumns(section.rows);
|
|
97
|
+
for (const column of own) columns.set(column.key, column);
|
|
98
|
+
const byKey = new Map(own.map((column) => [column.key, column]));
|
|
99
|
+
for (const row of section.rows) rows.push(withViewRowSource({ section: section.title, ...row }, { columns: byKey }));
|
|
100
|
+
}
|
|
101
|
+
return { rows, columns: [...columns.values()] };
|
|
102
|
+
}
|
|
103
|
+
case "series": {
|
|
104
|
+
const byDate = new Map<string, ViewRow>();
|
|
105
|
+
const columns: HeadlessPaneColumn[] = [{ key: "date", header: "Date" }];
|
|
106
|
+
for (const series of (result as HeadlessSeriesResult).series) {
|
|
107
|
+
columns.push({ key: series.id, header: series.label, align: "right", ...seriesFormat(series) });
|
|
108
|
+
for (const point of series.points) {
|
|
109
|
+
const date = seriesDate(point.date);
|
|
110
|
+
const row = byDate.get(date) ?? { date };
|
|
111
|
+
row[series.id] = point.value ?? point.close ?? null;
|
|
112
|
+
byDate.set(date, row);
|
|
113
|
+
}
|
|
55
114
|
}
|
|
115
|
+
return { rows: [...byDate.values()], columns };
|
|
116
|
+
}
|
|
117
|
+
default: {
|
|
118
|
+
const _exhaustive: never = definition.shape;
|
|
119
|
+
return _exhaustive;
|
|
56
120
|
}
|
|
57
|
-
return { rows: [...byDate.values()], columns };
|
|
58
121
|
}
|
|
59
|
-
return { rows: [], columns: [] };
|
|
60
122
|
}
|
|
61
123
|
|
|
62
124
|
/**
|
|
@@ -101,8 +163,7 @@ export async function loadViewSource(
|
|
|
101
163
|
});
|
|
102
164
|
if (!resolved.headless) throw new Error(notViewSourceMessage(registry, resolved.label));
|
|
103
165
|
const loaded = await loadResolvedHeadlessPaneModel(resolved, context, spec.source.argument ?? "", signal);
|
|
104
|
-
const
|
|
105
|
-
const { rows, columns } = rowsFromResult(serialized);
|
|
166
|
+
const { rows, columns } = viewTableFrom(loaded.definition, loaded.result);
|
|
106
167
|
return {
|
|
107
168
|
rows,
|
|
108
169
|
columns,
|
|
@@ -9,7 +9,6 @@ import { teamStore } from "../../../team/store";
|
|
|
9
9
|
import { teamViewsStore } from "../cloud/team/views";
|
|
10
10
|
import { setPaneSettings } from "../../../pane-settings";
|
|
11
11
|
import { customViewInstanceSettings } from "./index";
|
|
12
|
-
import type { DataTableColumn } from "../../../components/ui/data-table/types";
|
|
13
12
|
import { PaneStatusBody, TextPromptDialog, usePaneFooter } from "../../../components";
|
|
14
13
|
import { useAsyncResource } from "../../../react/async-resource";
|
|
15
14
|
import { useShortcut } from "../../../react/input";
|
|
@@ -36,14 +35,13 @@ import {
|
|
|
36
35
|
viewStreamTargets,
|
|
37
36
|
type ViewRowRange,
|
|
38
37
|
} from "./live-quotes";
|
|
39
|
-
import { loadViewSource
|
|
38
|
+
import { loadViewSource } from "./loader";
|
|
39
|
+
import { sizeViewColumns, viewCellColumns, viewCellExportValue, viewCellText, type ViewTableColumn } from "./table";
|
|
40
40
|
import {
|
|
41
41
|
applyViewProjection,
|
|
42
42
|
EXAMPLE_VIEW_SPEC,
|
|
43
|
-
formatViewValue,
|
|
44
43
|
growViewColumnDecimals,
|
|
45
44
|
parseViewSpecOr,
|
|
46
|
-
type ViewColumn,
|
|
47
45
|
type ViewRow,
|
|
48
46
|
type ViewSort,
|
|
49
47
|
type ViewSpec,
|
|
@@ -52,9 +50,6 @@ import {
|
|
|
52
50
|
export const CUSTOM_VIEW_PANE_ID = "custom-view";
|
|
53
51
|
export const CUSTOM_VIEW_SPEC_SETTING = "spec";
|
|
54
52
|
|
|
55
|
-
type Column = DataTableColumn & { key: string; transform?: ViewColumn["transform"] };
|
|
56
|
-
|
|
57
|
-
const DEFAULT_COLUMN_WIDTH = 14;
|
|
58
53
|
const NO_ROWS: ViewRow[] = [];
|
|
59
54
|
const NO_SYMBOLS: readonly (string | null)[] = [];
|
|
60
55
|
const NO_TARGETS: QuoteSubscriptionTarget[] = [];
|
|
@@ -72,24 +67,15 @@ function sameSymbols(left: readonly (string | null)[], right: readonly (string |
|
|
|
72
67
|
return left.length === right.length && left.every((symbol, index) => symbol === right[index]);
|
|
73
68
|
}
|
|
74
69
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
id: column.key,
|
|
85
|
-
key: column.key,
|
|
86
|
-
label: column.label ?? source?.header ?? column.key,
|
|
87
|
-
align: align === "right" ? "right" : "left",
|
|
88
|
-
width: column.width ?? (index === 0 ? 18 : DEFAULT_COLUMN_WIDTH),
|
|
89
|
-
...(index === 0 ? { flexGrow: 1 } : {}),
|
|
90
|
-
transform: column.transform,
|
|
91
|
-
};
|
|
92
|
-
});
|
|
70
|
+
/** The first number a column holds, which an `index100` column is rebased to. */
|
|
71
|
+
function indexBases(columns: readonly { key: string; transform?: string }[], rows: readonly ViewRow[]): Map<string, number> {
|
|
72
|
+
const bases = new Map<string, number>();
|
|
73
|
+
for (const column of columns) {
|
|
74
|
+
if (column.transform !== "index100") continue;
|
|
75
|
+
const first = rows.find((row) => typeof row[column.key] === "number")?.[column.key];
|
|
76
|
+
if (typeof first === "number") bases.set(column.key, first);
|
|
77
|
+
}
|
|
78
|
+
return bases;
|
|
93
79
|
}
|
|
94
80
|
|
|
95
81
|
/** What an empty view says: ask for one, or open one from a spec that works as typed. */
|
|
@@ -125,7 +111,7 @@ export function CustomViewPane({ focused, width, height }: PaneProps) {
|
|
|
125
111
|
setSort(undefined);
|
|
126
112
|
}, [spec]);
|
|
127
113
|
|
|
128
|
-
const columns = useMemo(() => (spec ?
|
|
114
|
+
const columns = useMemo(() => (spec ? viewCellColumns(spec, data?.columns ?? []) : []), [data?.columns, spec]);
|
|
129
115
|
const symbolKey = spec?.presentation.symbolKey ?? (columns.some((column) => column.key === "symbol") ? "symbol" : null);
|
|
130
116
|
|
|
131
117
|
// Price, change and volume columns of rows that name a symbol stream through
|
|
@@ -182,15 +168,7 @@ export function CustomViewPane({ focused, width, height }: PaneProps) {
|
|
|
182
168
|
useEffect(() => {
|
|
183
169
|
setStreamOrder((current) => (sameSymbols(current, displayedSymbols) ? current : displayedSymbols));
|
|
184
170
|
}, [displayedSymbols]);
|
|
185
|
-
const baseByColumn = useMemo(() =>
|
|
186
|
-
const bases = new Map<string, number>();
|
|
187
|
-
for (const column of columns) {
|
|
188
|
-
if (column.transform !== "index100") continue;
|
|
189
|
-
const first = rows.find((row) => typeof row[column.key] === "number")?.[column.key];
|
|
190
|
-
if (typeof first === "number") bases.set(column.key, first);
|
|
191
|
-
}
|
|
192
|
-
return bases;
|
|
193
|
-
}, [columns, rows]);
|
|
171
|
+
const baseByColumn = useMemo(() => indexBases(columns, rows), [columns, rows]);
|
|
194
172
|
const decimalFloors = useMemo(() => liveViewDecimalFloors(sourceRows, liveFields), [liveFields, sourceRows]);
|
|
195
173
|
// A column's decimals only grow while this spec is shown, so a tick that
|
|
196
174
|
// crosses 100 or lands on a whole number never reflows the column.
|
|
@@ -205,15 +183,27 @@ export function CustomViewPane({ focused, width, height }: PaneProps) {
|
|
|
205
183
|
heldDecimals.current = { spec, decimals };
|
|
206
184
|
return decimals;
|
|
207
185
|
}, [columns, decimalFloors, rows, spec]);
|
|
186
|
+
// Sized on the rows as loaded, so a live tick never moves a column; again only when a column's decimals grow.
|
|
187
|
+
const liveKeys = useMemo(() => new Set(liveFields.keys()), [liveFields]);
|
|
188
|
+
const tableColumns = useMemo(() => {
|
|
189
|
+
const bases = indexBases(columns, sourceRows);
|
|
190
|
+
return sizeViewColumns(columns, sourceRows, (row, column) => (
|
|
191
|
+
viewCellText(row, column, bases.get(column.key), decimalsByColumn.get(column.key))
|
|
192
|
+
), liveKeys);
|
|
193
|
+
}, [columns, decimalsByColumn, liveKeys, sourceRows]);
|
|
208
194
|
const activeSort = sort === undefined ? spec?.projection.sort ?? null : sort;
|
|
209
195
|
// Memoized so the table's row memo holds while the selection moves.
|
|
210
196
|
const rowKey = useCallback((row: ViewRow, index: number) => (
|
|
211
197
|
`${symbolKey && typeof row[symbolKey] === "string" ? row[symbolKey] : ""}:${index}`
|
|
212
198
|
), [symbolKey]);
|
|
213
|
-
const renderRowCell = useCallback((row: ViewRow, column:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
199
|
+
const renderRowCell = useCallback((row: ViewRow, column: ViewTableColumn) => {
|
|
200
|
+
const value = viewCellExportValue(row, column);
|
|
201
|
+
return {
|
|
202
|
+
text: viewCellText(row, column, baseByColumn.get(column.key), decimalsByColumn.get(column.key)),
|
|
203
|
+
...(value !== undefined ? { value } : {}),
|
|
204
|
+
color: column.key === symbolKey ? colors.textBright : undefined,
|
|
205
|
+
};
|
|
206
|
+
}, [baseByColumn, decimalsByColumn, symbolKey]);
|
|
217
207
|
|
|
218
208
|
/**
|
|
219
209
|
* Publishes this view to a team. An inline view becomes a new team view
|
|
@@ -385,7 +375,7 @@ export function CustomViewPane({ focused, width, height }: PaneProps) {
|
|
|
385
375
|
}
|
|
386
376
|
|
|
387
377
|
return (
|
|
388
|
-
<DataTableView<ViewRow,
|
|
378
|
+
<DataTableView<ViewRow, ViewTableColumn>
|
|
389
379
|
focused={focused}
|
|
390
380
|
rootWidth={width}
|
|
391
381
|
rootHeight={height}
|
|
@@ -394,7 +384,7 @@ export function CustomViewPane({ focused, width, height }: PaneProps) {
|
|
|
394
384
|
selectedIndex,
|
|
395
385
|
onChange: (index) => setSelectedIndex(index),
|
|
396
386
|
}}
|
|
397
|
-
columns={
|
|
387
|
+
columns={tableColumns}
|
|
398
388
|
items={rows}
|
|
399
389
|
sortColumnId={activeSort?.by ?? null}
|
|
400
390
|
sortDirection={activeSort?.direction ?? "desc"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a view's table draws its source's rows: the text of each cell, from
|
|
3
|
+
* the spec's transform or the source's own format, and how wide each column
|
|
4
|
+
* is set (docs/pane-conventions.md, "Columns in a narrow pane"): codes and
|
|
5
|
+
* figures as wide as what they hold, the columns of names and sentences set
|
|
6
|
+
* to grow with the pane.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { DataTableColumn } from "../../../components/ui/data-table/types";
|
|
10
|
+
import type { HeadlessPaneColumn } from "../../../types/headless";
|
|
11
|
+
import { displayWidth } from "../../../utils/format";
|
|
12
|
+
import { formatViewValue, type ViewColumn, type ViewRow, type ViewSpec, type ViewTransform } from "./view-spec";
|
|
13
|
+
|
|
14
|
+
/** A view's column before it is sized: what heads it and draws its cells. */
|
|
15
|
+
interface ViewCellColumn {
|
|
16
|
+
key: string;
|
|
17
|
+
label: string;
|
|
18
|
+
align?: "left" | "right";
|
|
19
|
+
/** The width the spec set, which the table keeps whatever the cells hold. */
|
|
20
|
+
width?: number;
|
|
21
|
+
transform?: ViewTransform;
|
|
22
|
+
/** The source's own column for the key, whose format draws its cells; absent for a key the source lists no column for. */
|
|
23
|
+
source?: HeadlessPaneColumn;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ViewTableColumn = DataTableColumn & Pick<ViewCellColumn, "key" | "transform" | "source">;
|
|
27
|
+
|
|
28
|
+
const ROW_SOURCE = Symbol("view row source");
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* How the source drew one row's cells, where the view's columns cannot say
|
|
32
|
+
* it: a bundle's sections each format their own keys, and two sections can
|
|
33
|
+
* format one key apart; an entry carries its value's text already formatted.
|
|
34
|
+
*/
|
|
35
|
+
interface ViewRowSource {
|
|
36
|
+
columns: ReadonlyMap<string, HeadlessPaneColumn>;
|
|
37
|
+
/** Cell text the source wrote itself, by key. */
|
|
38
|
+
text?: Readonly<Record<string, string>>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type SourcedRow = ViewRow & { [ROW_SOURCE]?: ViewRowSource };
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Tags `row` with the columns and text its source drew it with. A symbol key
|
|
45
|
+
* is no row key: filters, sorts, the source's key list and exports never see
|
|
46
|
+
* it, and the copy a live quote makes of the row keeps it.
|
|
47
|
+
*/
|
|
48
|
+
export function withViewRowSource(row: ViewRow, source: ViewRowSource): ViewRow {
|
|
49
|
+
(row as SourcedRow)[ROW_SOURCE] = source;
|
|
50
|
+
return row;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The spec's columns, or the source's when it names none, with their source column and the header, alignment and width the spec set. */
|
|
54
|
+
export function viewCellColumns(spec: ViewSpec, columns: readonly HeadlessPaneColumn[]): ViewCellColumn[] {
|
|
55
|
+
const known = new Map(columns.map((column) => [column.key, column]));
|
|
56
|
+
const picked: ViewColumn[] = spec.projection.columns.length > 0 ? spec.projection.columns : columns.map((column) => ({ key: column.key }));
|
|
57
|
+
return picked.map((column) => {
|
|
58
|
+
const source = known.get(column.key);
|
|
59
|
+
const align = column.align ?? source?.align;
|
|
60
|
+
return {
|
|
61
|
+
key: column.key,
|
|
62
|
+
label: column.label ?? source?.header ?? column.key,
|
|
63
|
+
// Center reads as left in a table; a column neither aligns is aligned by what it holds (sizeViewColumns).
|
|
64
|
+
...(align ? { align: align === "right" ? "right" as const : "left" as const } : {}),
|
|
65
|
+
...(column.width !== undefined ? { width: column.width } : {}),
|
|
66
|
+
...(column.transform ? { transform: column.transform } : {}),
|
|
67
|
+
...(source ? { source } : {}),
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A source format's text, or null where the row is one it cannot read. */
|
|
73
|
+
function formattedText(format: NonNullable<HeadlessPaneColumn["format"]>, value: unknown, row: ViewRow): string | null {
|
|
74
|
+
try {
|
|
75
|
+
return format(value, row);
|
|
76
|
+
} catch {
|
|
77
|
+
// Intentional ignore: a source's format written for its own rows that cannot read a live or flattened one shows the plain value.
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The format a source draws a column's cells with: the text report's, which
|
|
84
|
+
* says more than an export's (a time to the second, a list joined), except
|
|
85
|
+
* for a value the report prints under its row rather than in its column.
|
|
86
|
+
*/
|
|
87
|
+
function sourceFormat(column: HeadlessPaneColumn): HeadlessPaneColumn["format"] {
|
|
88
|
+
return column.underRow ? column.format : column.textFormat ?? column.format;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A cell's text: the spec's transform when the column names one, else the
|
|
93
|
+
* text the source draws the value with (the row's own section's format where
|
|
94
|
+
* it has one), else the plain value.
|
|
95
|
+
* `base` and `decimals` are formatViewValue's.
|
|
96
|
+
*/
|
|
97
|
+
export function viewCellText(row: ViewRow, column: Pick<ViewCellColumn, "key" | "transform" | "source">, base?: number, decimals?: number): string {
|
|
98
|
+
const value = row[column.key];
|
|
99
|
+
if (!column.transform) {
|
|
100
|
+
const own = (row as SourcedRow)[ROW_SOURCE];
|
|
101
|
+
const written = own?.text?.[column.key];
|
|
102
|
+
if (written !== undefined) return written;
|
|
103
|
+
// A row with columns of its own never takes another section's format for a key they leave out.
|
|
104
|
+
const source = own ? own.columns.get(column.key) : column.source;
|
|
105
|
+
const format = source ? sourceFormat(source) : undefined;
|
|
106
|
+
const text = format ? formattedText(format, value, row) : null;
|
|
107
|
+
if (text !== null) return text;
|
|
108
|
+
}
|
|
109
|
+
return formatViewValue(value, column.transform, base, decimals);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The number a cell exports, for a column that shows it in its own unit:
|
|
114
|
+
* CSV and `fn VIEW` keep the source's figure (123456789 for 123.46M) rather
|
|
115
|
+
* than read it back from the text. A percent, an absolute value or an index
|
|
116
|
+
* shows another number, which exports as it reads.
|
|
117
|
+
*/
|
|
118
|
+
export function viewCellExportValue(row: ViewRow, column: Pick<ViewCellColumn, "key" | "transform">): number | undefined {
|
|
119
|
+
const value = row[column.key];
|
|
120
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return undefined;
|
|
121
|
+
return column.transform === undefined || column.transform === "raw" || column.transform === "compact" ? value : undefined;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** Text no wider than this is a code, whatever it says: a ticker, a currency, an exchange, a short date. */
|
|
125
|
+
const CODE_WIDTH = 12;
|
|
126
|
+
/** The widest a column of names or sentences is set; the cells past it end in an ellipsis. */
|
|
127
|
+
const TEXT_WIDTH = 40;
|
|
128
|
+
/**
|
|
129
|
+
* The width the column that grows is set to: it takes what the pane has
|
|
130
|
+
* beyond the other columns, up to its whole text, so a narrow pane cuts a
|
|
131
|
+
* long name before it pushes a figure out of view.
|
|
132
|
+
*/
|
|
133
|
+
const GROWING_WIDTH = 20;
|
|
134
|
+
/** The widest a column of codes or figures is set, so one odd value cannot take the pane. */
|
|
135
|
+
const FIGURE_WIDTH = 32;
|
|
136
|
+
/** The rows a column is measured on; a longer list is read that far. */
|
|
137
|
+
const MEASURED_ROWS = 500;
|
|
138
|
+
|
|
139
|
+
/** Most of what the cells say is letters: names and sentences, not dates, times or numbers with a unit. */
|
|
140
|
+
function isWording(texts: readonly string[]): boolean {
|
|
141
|
+
let letters = 0;
|
|
142
|
+
let characters = 0;
|
|
143
|
+
for (const text of texts) {
|
|
144
|
+
for (const character of text) {
|
|
145
|
+
if (/\s/.test(character)) continue;
|
|
146
|
+
characters += 1;
|
|
147
|
+
if (/\p{L}/u.test(character)) letters += 1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return characters > 0 && letters * 2 >= characters;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Sets each column's width from what it holds on `rows`, the source's rows
|
|
155
|
+
* as loaded, so a live tick never moves a column. A column of numbers is
|
|
156
|
+
* right-aligned unless the spec or source aligns it; it and a column of
|
|
157
|
+
* codes are as wide as their widest text, a cell more for a figure that
|
|
158
|
+
* streams (`live`), whose next tick can be a digit longer. A column of names
|
|
159
|
+
* or sentences (the source's `shrink`, or text longer than a code that is
|
|
160
|
+
* mostly letters) is set to its widest text up to TEXT_WIDTH, except the one
|
|
161
|
+
* with the longest text, which is set to at most GROWING_WIDTH and grows
|
|
162
|
+
* with the pane: a name or a headline gets the pane's spare width, and a
|
|
163
|
+
* ticker, a date or a publisher does not. A width the spec set is kept.
|
|
164
|
+
*/
|
|
165
|
+
export function sizeViewColumns(
|
|
166
|
+
columns: readonly ViewCellColumn[],
|
|
167
|
+
rows: readonly ViewRow[],
|
|
168
|
+
text: (row: ViewRow, column: ViewCellColumn) => string,
|
|
169
|
+
live: ReadonlySet<string> = new Set(),
|
|
170
|
+
): ViewTableColumn[] {
|
|
171
|
+
const measured = rows.length > MEASURED_ROWS ? rows.slice(0, MEASURED_ROWS) : rows;
|
|
172
|
+
const read = columns.map((column) => {
|
|
173
|
+
const texts = measured.map((row) => text(row, column));
|
|
174
|
+
const widest = texts.reduce((most, cell) => Math.max(most, displayWidth(cell)), 0);
|
|
175
|
+
const values = measured.map((row) => row[column.key]).filter((value) => value !== null && value !== undefined && value !== "");
|
|
176
|
+
const numeric = values.length > 0 && values.every((value) => typeof value === "number");
|
|
177
|
+
const wording = !numeric && column.source?.shrink !== false
|
|
178
|
+
&& (column.source?.shrink === true || (widest > CODE_WIDTH && isWording(texts)));
|
|
179
|
+
return { column, widest, numeric, wording };
|
|
180
|
+
});
|
|
181
|
+
// The first of the widest, so a name ahead of a description of the same length keeps the room.
|
|
182
|
+
const grows = read.reduce<(typeof read)[number] | null>((best, entry) => (
|
|
183
|
+
entry.wording && (!best || entry.widest > best.widest) ? entry : best
|
|
184
|
+
), null);
|
|
185
|
+
return read.map((entry) => {
|
|
186
|
+
const { column, widest, numeric, wording } = entry;
|
|
187
|
+
const width = column.width ?? (entry === grows ? Math.min(widest, GROWING_WIDTH)
|
|
188
|
+
: wording ? Math.min(widest, TEXT_WIDTH)
|
|
189
|
+
: Math.min(widest + (numeric && live.has(column.key) ? 1 : 0), FIGURE_WIDTH));
|
|
190
|
+
return {
|
|
191
|
+
id: column.key,
|
|
192
|
+
key: column.key,
|
|
193
|
+
label: column.label,
|
|
194
|
+
align: column.align ?? (numeric ? "right" : "left"),
|
|
195
|
+
width: Math.max(1, width),
|
|
196
|
+
...(entry === grows ? { flexGrow: 1 } : {}),
|
|
197
|
+
...(column.transform ? { transform: column.transform } : {}),
|
|
198
|
+
...(column.source ? { source: column.source } : {}),
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
}
|