@gloom-sh/terminal 0.20.3 → 0.20.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +3 -1
- package/src/account/auth-dialog.tsx +17 -0
- package/src/api-client/data.ts +144 -35
- package/src/api-client/fx-interventions.ts +64 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/release-summaries.ts +21 -0
- package/src/api-client/types/econ.ts +12 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +8 -2
- package/src/app/keybindings/config.ts +2 -1
- package/src/app/keybindings/index.ts +1 -0
- package/src/app/keybindings/labels.ts +6 -1
- package/src/app/keybindings/resolve.ts +23 -4
- package/src/app/keybindings/terminal-keys.ts +35 -0
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +274 -67
- package/src/architecture/ui-literals-allowlist.json +1 -1
- package/src/capabilities/chart-series.ts +27 -1
- package/src/cli/commands/keybindings.ts +5 -5
- package/src/cli/commands/market.ts +154 -21
- package/src/cli/commands/news-search.ts +60 -10
- package/src/cli/commands/overview.ts +16 -1
- package/src/cli/commands/plugins.ts +27 -5
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +20 -4
- package/src/cli/commands/ticker.ts +60 -19
- package/src/cli/fx-forward.ts +25 -7
- package/src/cli/glossary.ts +19 -5
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index.ts +8 -8
- package/src/cli/known-gaps.ts +27 -1
- package/src/cli/listing-arg.ts +11 -1
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/function-help.ts +5 -5
- package/src/cli/report-tables.ts +18 -6
- package/src/cli/result.ts +15 -7
- package/src/cli/types.ts +2 -0
- package/src/components/chart/composite/axis-overlays.tsx +22 -0
- package/src/components/chart/composite/composite-chart.tsx +54 -13
- package/src/components/chart/composite/event-captions.ts +109 -0
- package/src/components/chart/composite/event-guides.ts +74 -0
- package/src/components/chart/composite/rasterizer.ts +2 -0
- package/src/components/chart/composite/text-renderer.ts +2 -0
- package/src/components/chart/composite/types.ts +31 -0
- package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/provider-search.ts +5 -4
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/detached-pane-shell.tsx +1 -1
- package/src/components/layout/floating-pane.tsx +5 -1
- package/src/components/layout/pane/footer/index.tsx +21 -14
- package/src/components/layout/pane/footer/model.ts +6 -0
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
- package/src/components/layout/shell/active-drag.ts +149 -105
- package/src/components/layout/shell/drag/drop-zones.ts +162 -0
- package/src/components/layout/shell/drag/index.ts +47 -218
- package/src/components/layout/shell/drag/live.ts +10 -3
- package/src/components/layout/shell/drag/overlays.tsx +182 -5
- package/src/components/layout/shell/drag/runtime.ts +29 -6
- package/src/components/layout/shell/drag/shared-edges.ts +156 -0
- package/src/components/layout/shell/index.tsx +11 -6
- package/src/components/layout/shell/menu.ts +11 -2
- package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
- package/src/components/layout/shell/native/window-state.ts +2 -2
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/shell/pane/layers.tsx +71 -7
- package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
- package/src/components/layout/shell/window-mode/index.ts +8 -10
- package/src/components/layout/status-bar.tsx +6 -1
- package/src/components/layout/window-edit/mode.ts +39 -7
- package/src/components/layout/window-edit/presentation.ts +1 -1
- package/src/components/onboarding/first-run-workspace.ts +44 -2
- package/src/components/onboarding/onboarding-frame.tsx +11 -2
- package/src/components/onboarding/onboarding-keyboard.ts +20 -0
- package/src/components/onboarding/onboarding-wizard.tsx +16 -11
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
- package/src/components/onboarding/use-onboarding-progress.ts +12 -4
- package/src/components/pane-settings-dialog/desktop.tsx +2 -2
- package/src/components/pane-settings-dialog/tui.tsx +2 -2
- package/src/components/pane-settings-dialog/value.ts +6 -0
- package/src/components/pane-settings-dialog.tsx +3 -3
- package/src/components/reader/detail-reader.tsx +4 -0
- package/src/components/ui/button.tsx +2 -0
- package/src/components/ui/choice-dialog.tsx +1 -0
- package/src/components/ui/data-table/index.tsx +4 -3
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/list-view.tsx +7 -12
- package/src/components/ui/loading.tsx +10 -3
- package/src/components/ui/menu.tsx +6 -2
- package/src/components/ui/page-stack-view.tsx +3 -0
- package/src/components/ui/pane-link-chip.tsx +269 -54
- package/src/components/ui/query-bar.tsx +2 -1
- package/src/components/ui/quote.ts +14 -1
- package/src/components/ui/tabs.tsx +97 -19
- package/src/core/state/app/layout-reducer.ts +7 -0
- package/src/core/state/app/layout.ts +44 -7
- package/src/core/state/app/state.ts +1 -1
- package/src/core/state/app/types.ts +22 -2
- package/src/data/config/layout.ts +5 -2
- package/src/docs/snapshot.json +54 -13
- package/src/i18n/es.ts +9 -8
- package/src/i18n/ja.ts +9 -8
- package/src/i18n/ko.ts +9 -8
- package/src/i18n/zh-cn.ts +9 -8
- package/src/i18n/zh-tw.ts +9 -8
- package/src/layout/pane-manager/floating-actions.ts +17 -0
- package/src/layout/pane-manager/floating-stack.ts +187 -0
- package/src/layout/pane-manager/floating.ts +4 -2
- package/src/layout/pane-manager/gridlock.ts +5 -1
- package/src/layout/pane-manager/index.ts +11 -0
- package/src/layout/pane-manager/layout-state.ts +10 -3
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/futures-board.ts +46 -1
- package/src/market-data/futures-contract.ts +12 -3
- package/src/market-data/fx-interventions.ts +270 -0
- package/src/market-data/market/dated-previous-close.ts +94 -15
- package/src/market-data/market/status.ts +17 -1
- package/src/news/news-model.ts +44 -2
- package/src/plugins/builtin/alerts/cli.ts +4 -4
- package/src/plugins/builtin/alerts/format.ts +1 -2
- package/src/plugins/builtin/alerts/headless.ts +1 -2
- package/src/plugins/builtin/alerts/move-checks.ts +12 -6
- package/src/plugins/builtin/alerts/move.ts +30 -9
- package/src/plugins/builtin/alerts/pane.tsx +0 -2
- package/src/plugins/builtin/alerts/storage.ts +4 -2
- package/src/plugins/builtin/alerts/types.ts +12 -0
- package/src/plugins/builtin/analytics/risk-client.ts +10 -4
- package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
- package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
- package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
- package/src/plugins/builtin/awards/index.tsx +1 -1
- package/src/plugins/builtin/buildout/index.tsx +1 -0
- package/src/plugins/builtin/catalysts/index.tsx +2 -2
- package/src/plugins/builtin/cds/headless.ts +4 -0
- package/src/plugins/builtin/changelog/index.tsx +292 -101
- package/src/plugins/builtin/changelog/versions.ts +293 -0
- package/src/plugins/builtin/chart-composer/headless.ts +2 -1
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
- package/src/plugins/builtin/chat/content/composer.tsx +5 -4
- package/src/plugins/builtin/chat/content/index.tsx +12 -2
- package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
- package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
- package/src/plugins/builtin/chat/layout.ts +5 -2
- package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
- package/src/plugins/builtin/chat/message/render-state.ts +2 -5
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
- package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
- package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
- package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
- package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
- package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
- package/src/plugins/builtin/cloud/askg/model.ts +14 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
- package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
- package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
- package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +52 -9
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
- package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
- package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
- package/src/plugins/builtin/company-attention/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +3 -1
- package/src/plugins/builtin/company-kpis/index.tsx +2 -2
- package/src/plugins/builtin/cot/headless.ts +14 -2
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/crypto-board/index.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
- package/src/plugins/builtin/doe/index.tsx +1 -1
- package/src/plugins/builtin/earnings/index.tsx +2 -2
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +74 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
- package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
- package/src/plugins/builtin/executives/index.tsx +1 -0
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fixed-income/index.tsx +1 -0
- package/src/plugins/builtin/futures/index.tsx +25 -4
- package/src/plugins/builtin/futures/model.ts +28 -32
- package/src/plugins/builtin/futures/series.ts +4 -3
- package/src/plugins/builtin/futures/table.tsx +16 -9
- package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
- package/src/plugins/builtin/futures-curve/headless.ts +3 -3
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +18 -0
- package/src/plugins/builtin/gpu/index.tsx +1 -1
- package/src/plugins/builtin/help/functions-table.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +14 -4
- package/src/plugins/builtin/help/keybindings-editor.tsx +19 -5
- package/src/plugins/builtin/holders/index.tsx +1 -0
- package/src/plugins/builtin/holders/report-header.ts +2 -2
- package/src/plugins/builtin/insider/index.tsx +1 -0
- package/src/plugins/builtin/iv-history/index.tsx +1 -1
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/layout-manager/index.tsx +8 -8
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +19 -3
- package/src/plugins/builtin/macro-day/pane.tsx +14 -9
- package/src/plugins/builtin/macro-day/releases.ts +25 -7
- package/src/plugins/builtin/market-valuation/index.tsx +1 -0
- package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
- package/src/plugins/builtin/members/index.tsx +1 -1
- package/src/plugins/builtin/mna/index.tsx +1 -0
- package/src/plugins/builtin/news/headless.ts +2 -2
- package/src/plugins/builtin/news/index.tsx +4 -3
- package/src/plugins/builtin/news/wire/index.tsx +5 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options-positioning/index.tsx +1 -0
- package/src/plugins/builtin/pe-band/index.tsx +1 -1
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/event-model.ts +9 -1
- package/src/plugins/builtin/research/event-sources.ts +22 -0
- package/src/plugins/builtin/research/headless.ts +11 -5
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research-search/index.tsx +1 -0
- package/src/plugins/builtin/research-search/pane.tsx +8 -0
- package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/scanner/headless.ts +52 -13
- package/src/plugins/builtin/seasonality/index.tsx +1 -1
- package/src/plugins/builtin/sec/index.tsx +1 -0
- package/src/plugins/builtin/series-inventory.ts +1 -1
- package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
- package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
- package/src/plugins/builtin/short-interest/index.tsx +1 -0
- package/src/plugins/builtin/social-mentions/index.tsx +1 -1
- package/src/plugins/builtin/supply-chain/index.tsx +1 -0
- package/src/plugins/builtin/thirteenf/data.ts +43 -10
- package/src/plugins/builtin/thirteenf/headless.ts +55 -11
- package/src/plugins/builtin/thirteenf/model.ts +25 -9
- package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
- package/src/plugins/builtin/thirteenf/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/financials/model.ts +12 -0
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +5 -5
- package/src/plugins/builtin/ticker-detail/headless.ts +18 -13
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +34 -17
- package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
- package/src/plugins/builtin/time-sales/client.ts +9 -11
- package/src/plugins/builtin/time-sales/index.tsx +1 -1
- package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +18 -3
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +109 -19
- package/src/plugins/builtin/treasury-auctions/index.tsx +14 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +256 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +139 -28
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
- package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
- package/src/plugins/builtin/vol-surface/index.tsx +1 -1
- package/src/plugins/builtin/world-venue-map/index.ts +1 -0
- package/src/plugins/builtin/yield-curve/curves.ts +10 -4
- package/src/plugins/builtin/yield-curve/headless.ts +6 -2
- package/src/plugins/builtin/yield-curve/index.tsx +3 -3
- package/src/plugins/builtin/yield-curve/series.ts +10 -0
- package/src/plugins/builtin/yield-curve/world.ts +3 -1
- package/src/plugins/installer.ts +45 -0
- package/src/portfolio/column-values.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
- package/src/public/remote.ts +7 -1
- package/src/remote/client.ts +191 -11
- package/src/remote/controller-utils.ts +13 -1
- package/src/remote/controller.ts +88 -26
- package/src/remote/endpoint.ts +24 -0
- package/src/remote/form.ts +59 -4
- package/src/remote/resources.ts +56 -19
- package/src/remote/schema.ts +22 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-helpers.ts +29 -1
- package/src/remote/semantic-tree.tsx +44 -15
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/cloudflare/worker.ts +16 -1
- package/src/renderers/dom/styles.css +40 -6
- package/src/renderers/opentui/host.tsx +6 -0
- package/src/renderers/share/layout-view.tsx +1 -1
- package/src/series/standalone.ts +2 -2
- package/src/shares/api.ts +21 -4
- package/src/shares/item.ts +73 -0
- package/src/shares/pane-item.ts +205 -0
- package/src/shares/pane.ts +4 -0
- package/src/shares/payload.ts +9 -5
- package/src/sources/gloomberb-cloud/news.ts +37 -12
- package/src/state/opening-ticker-panes.ts +47 -0
- package/src/test-support/cli-context.ts +2 -0
- package/src/test-support/preload.ts +4 -1
- package/src/tickers/instrument-kind.ts +23 -3
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/resolve.ts +2 -2
- package/src/types/config.ts +5 -0
- package/src/types/context-menu.ts +2 -0
- package/src/types/financials.ts +1 -0
- package/src/types/plugin-commands.ts +140 -0
- package/src/types/plugin-context.ts +125 -0
- package/src/types/plugin-contributions.ts +55 -0
- package/src/types/plugin-definition.ts +234 -0
- package/src/types/plugin-notifications.ts +38 -0
- package/src/types/plugin-pane-settings.ts +116 -0
- package/src/types/plugin-pane-templates.ts +160 -0
- package/src/types/plugin-panes.ts +243 -0
- package/src/types/plugin-reports.ts +35 -0
- package/src/types/plugin-shared.ts +14 -0
- package/src/types/plugin-state.ts +71 -0
- package/src/types/plugin.ts +14 -1169
- package/src/ui/index.tsx +14 -3
- package/src/updater/github-releases.ts +23 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/cli-output.ts +22 -9
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/untrusted-text.ts +29 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import type { ChangelogRelease } from "../../../updater/github-releases";
|
|
2
|
+
import { compareSemver } from "../../../utils/semver";
|
|
3
|
+
import { nextHeaderSort, type SortDirection } from "../../../utils/sort-values";
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* The Changelog by minor version: every update of 0.20 under one row, with
|
|
7
|
+
* the version's title and highlights from the repository's CHANGELOG.md, or,
|
|
8
|
+
* for a version it does not cover yet, from the updates' own notes. The
|
|
9
|
+
* website's changelog reads the same file the same way.
|
|
10
|
+
*
|
|
11
|
+
* CHANGELOG.md has one section per minor version:
|
|
12
|
+
*
|
|
13
|
+
* ## 0.20: A faster desktop app, broker CSV imports, and a header market
|
|
14
|
+
*
|
|
15
|
+
* - **A faster, lighter desktop app.** Starts a third faster on Mac. (0.20.0)
|
|
16
|
+
* 
|
|
17
|
+
*
|
|
18
|
+
* A bullet may wrap onto the lines under it, as markdown lets it, up to a
|
|
19
|
+
* blank line or the next bullet. Anything else (the title, the intro, HTML
|
|
20
|
+
* comments, other headings, paragraphs between bullets, the pictures) is
|
|
21
|
+
* skipped here.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** Highlights shown for a version at most. */
|
|
25
|
+
export const HIGHLIGHTS_MAX = 5;
|
|
26
|
+
|
|
27
|
+
export interface ChangelogHighlight {
|
|
28
|
+
/** The bold claim, as written: "A faster, lighter desktop app." */
|
|
29
|
+
lead: string;
|
|
30
|
+
/** The line after the claim (inline markdown), or "". */
|
|
31
|
+
detail: string;
|
|
32
|
+
/** The updates it shipped in, without the "v": "0.20.0". */
|
|
33
|
+
versions: string[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface VersionSummary {
|
|
37
|
+
/** "0.20" */
|
|
38
|
+
minor: string;
|
|
39
|
+
title: string | null;
|
|
40
|
+
highlights: ChangelogHighlight[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ChangelogVersion {
|
|
44
|
+
/** "v0.20": a row's stable id. */
|
|
45
|
+
id: string;
|
|
46
|
+
/** "0.20" */
|
|
47
|
+
minor: string;
|
|
48
|
+
title: string;
|
|
49
|
+
highlights: ChangelogHighlight[];
|
|
50
|
+
/** Newest first, as GitHub lists them. */
|
|
51
|
+
releases: ChangelogRelease[];
|
|
52
|
+
firstPublishedAt: string;
|
|
53
|
+
lastPublishedAt: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const SECTION = /^##\s+v?(\d+\.\d+)(?:\s*:\s*(.*))?$/;
|
|
57
|
+
const VERSIONS = /\s*\(\s*(v?\d+\.\d+\.\d+(?:\s*,\s*v?\d+\.\d+\.\d+)*)\s*\)\s*$/;
|
|
58
|
+
const BULLET = /^[-*]\s+(.+)$/;
|
|
59
|
+
const BOLD_LEAD = /^\*\*(.+?)\*\*\s*(.*)$/;
|
|
60
|
+
const PULL_REFS = /\s*\(\s*#\d+(?:\s*,\s*#\d+)*\s*\)\s*$/;
|
|
61
|
+
const IMAGE = /^!\[[^\]]*\]\([^)\s]+\)$/;
|
|
62
|
+
|
|
63
|
+
/** "**Claim.** Line" as its claim and its line; text without a claim is all claim. */
|
|
64
|
+
function splitLead(text: string): { lead: string; detail: string } {
|
|
65
|
+
const match = text.match(BOLD_LEAD);
|
|
66
|
+
if (match?.[1]) return { lead: match[1].trim(), detail: match[2]?.trim() ?? "" };
|
|
67
|
+
return { lead: text.trim(), detail: "" };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A bullet as written, its wrapped lines joined: `paused` after a blank line, when only an indented line continues it. */
|
|
71
|
+
interface OpenBullet {
|
|
72
|
+
text: string;
|
|
73
|
+
paused: boolean;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function readBullet(text: string): ChangelogHighlight | null {
|
|
77
|
+
const versions = text.match(VERSIONS);
|
|
78
|
+
const claim = versions ? text.slice(0, versions.index).trim() : text;
|
|
79
|
+
if (!claim) return null;
|
|
80
|
+
return {
|
|
81
|
+
...splitLead(claim),
|
|
82
|
+
versions: versions?.[1] ? versions[1].split(",").map((version) => version.trim().replace(/^v/i, "")) : [],
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function parseVersionSummaries(markdown: string | null | undefined): Map<string, VersionSummary> {
|
|
87
|
+
const summaries = new Map<string, VersionSummary>();
|
|
88
|
+
if (!markdown?.trim()) return summaries;
|
|
89
|
+
|
|
90
|
+
// HTML comments hold the format notes and an example section.
|
|
91
|
+
const lines = markdown.replace(/<!--[\s\S]*?(-->|$)/g, "").replace(/\r\n/g, "\n").split("\n");
|
|
92
|
+
let current: VersionSummary | null = null;
|
|
93
|
+
let open: OpenBullet | null = null;
|
|
94
|
+
|
|
95
|
+
const close = () => {
|
|
96
|
+
const highlight = open ? readBullet(open.text) : null;
|
|
97
|
+
if (current && highlight) current.highlights.push(highlight);
|
|
98
|
+
open = null;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
for (const line of lines) {
|
|
102
|
+
const trimmed = line.trim();
|
|
103
|
+
if (!trimmed) {
|
|
104
|
+
if (open) open.paused = true;
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (/^#{1,6}\s/.test(trimmed)) {
|
|
108
|
+
close();
|
|
109
|
+
const section = trimmed.match(SECTION);
|
|
110
|
+
current = null;
|
|
111
|
+
// The newest section for a version wins over a repeated one below it.
|
|
112
|
+
if (section?.[1] && !summaries.has(section[1])) {
|
|
113
|
+
current = { minor: section[1], title: section[2]?.trim() || null, highlights: [] };
|
|
114
|
+
summaries.set(section[1], current);
|
|
115
|
+
}
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (!current) continue;
|
|
119
|
+
|
|
120
|
+
const bullet = line.match(BULLET);
|
|
121
|
+
if (bullet?.[1]) {
|
|
122
|
+
close();
|
|
123
|
+
open = { text: bullet[1].trim(), paused: false };
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
// A picture under a highlight is the website's; it does not end the bullet.
|
|
127
|
+
if (IMAGE.test(trimmed)) continue;
|
|
128
|
+
// A wrapped line of the bullet: right under it, or indented under it.
|
|
129
|
+
if (open && (!open.paused || /^\s/.test(line))) {
|
|
130
|
+
open.text = `${open.text} ${trimmed}`;
|
|
131
|
+
open.paused = false;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
close();
|
|
135
|
+
}
|
|
136
|
+
close();
|
|
137
|
+
|
|
138
|
+
return summaries;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** "v0.20.3" is 0.20; a tag that is not a version stands alone. */
|
|
142
|
+
function minorOf(tagName: string): string {
|
|
143
|
+
return tagName.match(/^v?(\d+\.\d+)\.\d+$/i)?.[1] ?? tagName;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A plain bullet's claim: its first sentence, up to a colon that brings in
|
|
148
|
+
* the details. Never inside inline code.
|
|
149
|
+
*/
|
|
150
|
+
function firstClaim(text: string): string {
|
|
151
|
+
let code = false;
|
|
152
|
+
for (let index = 0; index < text.length; index += 1) {
|
|
153
|
+
const char = text[index];
|
|
154
|
+
if (char === "`") code = !code;
|
|
155
|
+
if (code) continue;
|
|
156
|
+
const next = text[index + 1];
|
|
157
|
+
if ((char === "." || char === "!" || char === "?") && (next === undefined || next === " ")) return text.slice(0, index + 1);
|
|
158
|
+
if (char === ":" && next === " ") return `${text.slice(0, index)}.`;
|
|
159
|
+
}
|
|
160
|
+
return text;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* An update's top highlight: the claim of the first bullet of its notes, a
|
|
165
|
+
* plain bullet's first sentence, or its title when the notes have no bullet.
|
|
166
|
+
*/
|
|
167
|
+
export function topHighlight(release: ChangelogRelease): ChangelogHighlight {
|
|
168
|
+
const versions = [release.version.replace(/^v/i, "")];
|
|
169
|
+
const bullet = release.body.split(/\r?\n/).map((line) => line.trim().match(BULLET)?.[1]).find(Boolean);
|
|
170
|
+
if (!bullet) return { lead: release.title, detail: "", versions };
|
|
171
|
+
const lead = bullet.startsWith("**") ? splitLead(bullet).lead : firstClaim(bullet.replace(PULL_REFS, ""));
|
|
172
|
+
return { lead, detail: "", versions };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function fallbackTitle(releases: ChangelogRelease[], minor: string): string {
|
|
176
|
+
const first = releases.find((release) => release.version.replace(/^v/i, "") === `${minor}.0`) ?? releases.at(-1);
|
|
177
|
+
return first?.title ?? `Version ${minor}`;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The highest version first, by number, so a fix shipped to 0.19 after 0.20
|
|
182
|
+
* came out stays under 0.20; a tag that is not a version goes after them.
|
|
183
|
+
*/
|
|
184
|
+
function compareMinors(left: string, right: string): number {
|
|
185
|
+
const a = left.match(/^(\d+)\.(\d+)$/);
|
|
186
|
+
const b = right.match(/^(\d+)\.(\d+)$/);
|
|
187
|
+
if (!a || !b) return Number(!a) - Number(!b);
|
|
188
|
+
return Number(b[1]) - Number(a[1]) || Number(b[2]) - Number(a[2]);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The releases (newest first) as one version per minor, the highest first. A
|
|
193
|
+
* version's title and highlights come from its summary; what the summary
|
|
194
|
+
* leaves out comes from the updates themselves, so a missing or half-written
|
|
195
|
+
* summary never empties a row. With `cut`, the list stopped at its limit, so
|
|
196
|
+
* its oldest version may be missing updates and is left out.
|
|
197
|
+
*/
|
|
198
|
+
export function groupChangelogVersions(
|
|
199
|
+
releases: ChangelogRelease[],
|
|
200
|
+
summaries: Map<string, VersionSummary>,
|
|
201
|
+
{ cut = false }: { cut?: boolean } = {},
|
|
202
|
+
): ChangelogVersion[] {
|
|
203
|
+
const byMinor = new Map<string, ChangelogRelease[]>();
|
|
204
|
+
for (const release of releases) {
|
|
205
|
+
const minor = minorOf(release.version);
|
|
206
|
+
const group = byMinor.get(minor);
|
|
207
|
+
if (group) group.push(release);
|
|
208
|
+
else byMinor.set(minor, [release]);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const versions = [...byMinor]
|
|
212
|
+
.sort(([left], [right]) => compareMinors(left, right))
|
|
213
|
+
.map(([minor, group]): ChangelogVersion => {
|
|
214
|
+
const summary = summaries.get(minor);
|
|
215
|
+
const highlights = summary?.highlights.length
|
|
216
|
+
? summary.highlights.slice(0, HIGHLIGHTS_MAX)
|
|
217
|
+
// The newest updates', in the order they shipped.
|
|
218
|
+
: group.slice(0, HIGHLIGHTS_MAX).reverse().map(topHighlight);
|
|
219
|
+
return {
|
|
220
|
+
id: /^\d+\.\d+$/.test(minor) ? `v${minor}` : minor,
|
|
221
|
+
minor,
|
|
222
|
+
title: summary?.title ?? fallbackTitle(group, minor),
|
|
223
|
+
highlights,
|
|
224
|
+
releases: group,
|
|
225
|
+
firstPublishedAt: group.at(-1)?.publishedAt ?? "",
|
|
226
|
+
lastPublishedAt: group[0]?.publishedAt ?? "",
|
|
227
|
+
};
|
|
228
|
+
});
|
|
229
|
+
return cut && versions.length > 1 ? versions.slice(0, -1) : versions;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** The version a release belongs to, by its id, for a layout that kept an open release. */
|
|
233
|
+
export function versionOfRelease(versions: ChangelogVersion[], releaseId: string | null): ChangelogVersion | null {
|
|
234
|
+
if (!releaseId) return null;
|
|
235
|
+
return versions.find((version) => version.releases.some((release) => release.id === releaseId)) ?? null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/** A version's highlights as the markdown list its detail shows, each naming its updates. */
|
|
239
|
+
export function highlightsMarkdown(version: ChangelogVersion): string {
|
|
240
|
+
return version.highlights.map((highlight) => {
|
|
241
|
+
const claim = `**${highlight.lead}**`;
|
|
242
|
+
const detail = highlight.detail ? ` ${highlight.detail}` : "";
|
|
243
|
+
const shipped = highlight.versions.length ? ` (${highlight.versions.join(", ")})` : "";
|
|
244
|
+
return `- ${claim}${detail}${shipped}`;
|
|
245
|
+
}).join("\n");
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export type ChangelogVersionColumnId = "date" | "version" | "title" | "updates";
|
|
249
|
+
|
|
250
|
+
export interface ChangelogVersionSort {
|
|
251
|
+
columnId: ChangelogVersionColumnId;
|
|
252
|
+
direction: SortDirection;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** The highest version first: a fix to an older version shipped later does not move it above the newer one. */
|
|
256
|
+
export const DEFAULT_CHANGELOG_VERSION_SORT: ChangelogVersionSort = { columnId: "version", direction: "desc" };
|
|
257
|
+
|
|
258
|
+
function isVersionColumnId(columnId: string): columnId is ChangelogVersionColumnId {
|
|
259
|
+
return columnId === "date" || columnId === "version" || columnId === "title" || columnId === "updates";
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function dateValue(value: string): number {
|
|
263
|
+
const timestamp = Date.parse(value);
|
|
264
|
+
return Number.isFinite(timestamp) ? timestamp : 0;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function compareVersions(left: ChangelogVersion, right: ChangelogVersion, columnId: ChangelogVersionColumnId): number {
|
|
268
|
+
switch (columnId) {
|
|
269
|
+
case "date":
|
|
270
|
+
return dateValue(left.lastPublishedAt) - dateValue(right.lastPublishedAt);
|
|
271
|
+
case "version":
|
|
272
|
+
return compareSemver(`${left.minor}.0`, `${right.minor}.0`) ?? left.minor.localeCompare(right.minor, undefined, { numeric: true });
|
|
273
|
+
case "title":
|
|
274
|
+
return left.title.localeCompare(right.title, undefined, { numeric: true, sensitivity: "base" });
|
|
275
|
+
case "updates":
|
|
276
|
+
return left.releases.length - right.releases.length;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export function sortChangelogVersions(versions: ChangelogVersion[], sort: ChangelogVersionSort): ChangelogVersion[] {
|
|
281
|
+
return versions
|
|
282
|
+
.map((version, index) => ({ version, index }))
|
|
283
|
+
.sort((left, right) => {
|
|
284
|
+
const comparison = compareVersions(left.version, right.version, sort.columnId);
|
|
285
|
+
return (sort.direction === "asc" ? comparison : -comparison) || left.index - right.index;
|
|
286
|
+
})
|
|
287
|
+
.map((entry) => entry.version);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export function nextChangelogVersionSort(current: ChangelogVersionSort, columnId: string): ChangelogVersionSort {
|
|
291
|
+
if (!isVersionColumnId(columnId)) return current;
|
|
292
|
+
return nextHeaderSort(current, columnId, { firstDirection: (id) => (id === "title" ? "asc" : "desc") });
|
|
293
|
+
}
|
|
@@ -30,6 +30,7 @@ import type { HistorySession } from "../../../types/price-history";
|
|
|
30
30
|
import type { TickerFinancials, PricePoint, Quote } from "../../../types/financials";
|
|
31
31
|
import { chartQuoteOverrideKeyForTarget, getLiveChartQuoteTargets } from "../../../time-series/live-quotes";
|
|
32
32
|
import { createChartSeriesResolver } from "../../../capabilities";
|
|
33
|
+
import { uncoveredCapabilityMessage } from "../../../capabilities/chart-series";
|
|
33
34
|
import { loadFuturesContractTerms, loadFuturesPriceUnit } from "../../../market-data/futures-contract";
|
|
34
35
|
import { loadDailyFxCloses } from "../../../time-series/currency-conversion";
|
|
35
36
|
import { canonicalExchange, isKnownExchangeCode, isUsListingExchange, parsePublicTickerKey, publicTickerKey } from "../../../utils/exchanges";
|
|
@@ -86,7 +87,7 @@ function headlessCapabilityResolver(context: HeadlessPaneContext) {
|
|
|
86
87
|
const request = <T,>(path: string, init?: RequestInit) => context.apiClient.geo<T>(path, { ...init, signal: init?.signal ?? context.signal });
|
|
87
88
|
return resolveGeoChartSeries(request, source.seriesId, viewport, context.signal);
|
|
88
89
|
}
|
|
89
|
-
if (!registry) throw new Error(
|
|
90
|
+
if (!registry) throw new Error(uncoveredCapabilityMessage(source.capabilityId, source.seriesId));
|
|
90
91
|
return registry(source, viewport, spec);
|
|
91
92
|
};
|
|
92
93
|
}
|
|
@@ -520,6 +520,7 @@ export const chartComposerModule: PluginModule = {
|
|
|
520
520
|
icon: "G",
|
|
521
521
|
component: ChartComposerPane,
|
|
522
522
|
defaultPosition: "right",
|
|
523
|
+
shareItem: { ticker: true },
|
|
523
524
|
tickerFollower: chartShowsOneSecurity,
|
|
524
525
|
retargetTicker: retargetChartTicker,
|
|
525
526
|
defaultMode: "floating",
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { isIntradaySeries } from "../../../components/chart/composite/session-shading";
|
|
2
|
+
import type { CompositeChartEvent } from "../../../components/chart/composite/types";
|
|
3
|
+
import type { FxInterventionsPayload } from "../../../api-client/fx-interventions";
|
|
4
|
+
import {
|
|
5
|
+
fxInterventionMarkers, fxInterventionPair, fxInterventionSharedCaptions, type FxInterventionMarker, type FxInterventionPair,
|
|
6
|
+
} from "../../../market-data/fx-interventions";
|
|
7
|
+
import type { ChartSpec, ResolvedSeries } from "../../../time-series/types";
|
|
8
|
+
|
|
9
|
+
const DAY_MS = 86_400_000;
|
|
10
|
+
/** A bar further than this before the day is not its bar (a gap in the bars): the event goes at the day itself. */
|
|
11
|
+
const LONGEST_BAR_MS = 32 * DAY_MS;
|
|
12
|
+
|
|
13
|
+
type PriceEntry = ChartSpec["series"][number] & { source: Extract<ChartSpec["series"][number]["source"], { kind: "security" }> };
|
|
14
|
+
|
|
15
|
+
/** The chart's first price series shown in its own values: the one price levels and interventions belong to. */
|
|
16
|
+
export function rawPriceEntry(spec: ChartSpec): PriceEntry | undefined {
|
|
17
|
+
return spec.series.find((candidate): candidate is PriceEntry => (
|
|
18
|
+
candidate.visible !== false
|
|
19
|
+
&& candidate.transform === "raw"
|
|
20
|
+
&& candidate.source.kind === "security"
|
|
21
|
+
&& (candidate.source.fieldId === "market.ohlcv" || candidate.source.fieldId === "market.close")
|
|
22
|
+
));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The yen pair a chart's price series is, or null: a future (6J=F), a transformed series or another pair gets no markers. */
|
|
26
|
+
export function chartInterventionPair(spec: ChartSpec): FxInterventionPair | null {
|
|
27
|
+
const entry = rawPriceEntry(spec);
|
|
28
|
+
return entry ? fxInterventionPair(entry.source.instrument.symbol, entry.source.instrument.exchange) : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Japan's interventions as chart events, each on the bar that holds its day:
|
|
33
|
+
* the day's first bar (its daily bar, or its first intraday one), else the bar
|
|
34
|
+
* before it, which a weekly or monthly bar starting earlier is. A total with
|
|
35
|
+
* no day yet is dotted from its first day's bar to its last day's. `barTimes`
|
|
36
|
+
* are the pair's bar times, oldest first; a daily or longer bar counts as the
|
|
37
|
+
* nearest UTC day, since one is stamped at a venue's midnight (23:00Z for
|
|
38
|
+
* London's in summer).
|
|
39
|
+
*/
|
|
40
|
+
export function interventionChartEvents(
|
|
41
|
+
markers: readonly FxInterventionMarker[],
|
|
42
|
+
barTimes: readonly number[],
|
|
43
|
+
daily = true,
|
|
44
|
+
): CompositeChartEvent[] {
|
|
45
|
+
const keys = daily ? barTimes.map((time) => Math.round(time / DAY_MS) * DAY_MS) : barTimes;
|
|
46
|
+
// The first bar at or after `time`.
|
|
47
|
+
const firstFrom = (time: number) => {
|
|
48
|
+
let low = 0, high = keys.length;
|
|
49
|
+
while (low < high) {
|
|
50
|
+
const middle = (low + high) >>> 1;
|
|
51
|
+
if (keys[middle]! < time) low = middle + 1;
|
|
52
|
+
else high = middle;
|
|
53
|
+
}
|
|
54
|
+
return low;
|
|
55
|
+
};
|
|
56
|
+
const firstBarOf = (date: string) => {
|
|
57
|
+
const day = Date.parse(`${date}T00:00:00Z`);
|
|
58
|
+
const index = firstFrom(day);
|
|
59
|
+
if (index < keys.length && keys[index]! < day + DAY_MS) return barTimes[index]!;
|
|
60
|
+
return index > 0 && day - keys[index - 1]! < LONGEST_BAR_MS ? barTimes[index - 1]! : day;
|
|
61
|
+
};
|
|
62
|
+
const lastBarOf = (date: string) => {
|
|
63
|
+
const end = Date.parse(`${date}T00:00:00Z`) + DAY_MS;
|
|
64
|
+
const index = firstFrom(end) - 1;
|
|
65
|
+
return index >= 0 && end - keys[index]! < LONGEST_BAR_MS + DAY_MS ? barTimes[index]! : end - DAY_MS;
|
|
66
|
+
};
|
|
67
|
+
return markers.map((marker) => {
|
|
68
|
+
const time = firstBarOf(marker.date);
|
|
69
|
+
return {
|
|
70
|
+
id: marker.id,
|
|
71
|
+
time,
|
|
72
|
+
...(marker.endDate ? { endTime: Math.max(time, lastBarOf(marker.endDate)) } : {}),
|
|
73
|
+
captions: marker.captions,
|
|
74
|
+
...(marker.undated ? { dotted: true } : {}),
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** What a chart draws for Japan's interventions: the events, and one caption for those too close to caption apart. */
|
|
80
|
+
export interface ChartInterventions {
|
|
81
|
+
events: CompositeChartEvent[];
|
|
82
|
+
merge: (events: readonly CompositeChartEvent[]) => readonly string[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The interventions a chart marks: in its raw price series' yen pair, on that
|
|
87
|
+
* series' bars; none for any other chart.
|
|
88
|
+
*/
|
|
89
|
+
export function chartInterventions(
|
|
90
|
+
spec: ChartSpec,
|
|
91
|
+
series: readonly ResolvedSeries[],
|
|
92
|
+
payload: FxInterventionsPayload | null,
|
|
93
|
+
): ChartInterventions | null {
|
|
94
|
+
const entry = rawPriceEntry(spec);
|
|
95
|
+
const pair = chartInterventionPair(spec);
|
|
96
|
+
const bars = entry ? series.find((candidate) => candidate.id === entry.id) : undefined;
|
|
97
|
+
if (!payload || !pair || !bars) return null;
|
|
98
|
+
const markers = fxInterventionMarkers(payload, pair);
|
|
99
|
+
if (markers.length === 0) return null;
|
|
100
|
+
const byId = new Map(markers.map((marker) => [marker.id, marker]));
|
|
101
|
+
return {
|
|
102
|
+
events: interventionChartEvents(markers, bars.points.map((point) => point.date.getTime()), !isIntradaySeries(bars)),
|
|
103
|
+
merge: (events) => fxInterventionSharedCaptions(events.flatMap((event) => byId.get(event.id) ?? [])),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -24,6 +24,9 @@ import { savedCopyFooterInfo } from "../../../components/layout/pane/footer";
|
|
|
24
24
|
import { useChartViewReset, useChartViewResetListener } from "../../../components/chart/core/view-reset";
|
|
25
25
|
import { formatCompositeDatasetDate } from "../../../components/chart/composite/format";
|
|
26
26
|
import type { CompositeChartLevels, CompositeLevelEdit } from "../../../components/chart/composite/levels";
|
|
27
|
+
import type { FxInterventionsPayload } from "../../../api-client/fx-interventions";
|
|
28
|
+
import { loadFxInterventions } from "../../../market-data/fx-interventions";
|
|
29
|
+
import { chartInterventionPair, chartInterventions, rawPriceEntry } from "./intervention-events";
|
|
27
30
|
import type { PaneProps, TickerResearchTabProps } from "../../../types/plugin";
|
|
28
31
|
import type { ChartResolution, TimeRange } from "../../../components/chart/core/types";
|
|
29
32
|
import type { ChartSpec, ResolvedSeries } from "../../../time-series/types";
|
|
@@ -262,14 +265,9 @@ function levelListing(spec: ChartSpec, series: readonly ResolvedSeries[]): {
|
|
|
262
265
|
instrument: InstrumentRef;
|
|
263
266
|
lastPrice: number | null;
|
|
264
267
|
} | null {
|
|
265
|
-
const entry = spec
|
|
266
|
-
candidate.visible !== false
|
|
267
|
-
&& candidate.transform === "raw"
|
|
268
|
-
&& candidate.source.kind === "security"
|
|
269
|
-
&& (candidate.source.fieldId === "market.ohlcv" || candidate.source.fieldId === "market.close")
|
|
270
|
-
));
|
|
268
|
+
const entry = rawPriceEntry(spec);
|
|
271
269
|
const resolved = entry ? series.find((candidate) => candidate.id === entry.id) : undefined;
|
|
272
|
-
if (!entry ||
|
|
270
|
+
if (!entry || !resolved) return null;
|
|
273
271
|
const exchange = resolved.timeBasis?.exchange || canonicalExchange(entry.source.instrument.exchange) || undefined;
|
|
274
272
|
const last = resolved.points.findLast((point) => Number.isFinite(point.close ?? point.value));
|
|
275
273
|
return {
|
|
@@ -609,6 +607,20 @@ function ChartComposerSurface({
|
|
|
609
607
|
...(alertsOn ? { action: { label: "alert", title: "Alert at Level", run: (level) => { void alertAtLevel(level.value); } } } : {}),
|
|
610
608
|
};
|
|
611
609
|
}, [alertAtLevel, alertsJson, alertsOn, editLevels, levelStore, listing, trade?.levels, trade?.contract]);
|
|
610
|
+
// A yen pair's chart marks Japan's interventions in it, from the Ministry of Finance's releases.
|
|
611
|
+
const [interventions, setInterventions] = useState<FxInterventionsPayload | null>(null);
|
|
612
|
+
const wantsInterventions = chartInterventionPair(spec) !== null;
|
|
613
|
+
useEffect(() => {
|
|
614
|
+
if (!wantsInterventions) return;
|
|
615
|
+
let live = true;
|
|
616
|
+
void loadFxInterventions().then((payload) => { if (live) setInterventions(payload); });
|
|
617
|
+
return () => { live = false; };
|
|
618
|
+
}, [wantsInterventions]);
|
|
619
|
+
const chartSeries = resolution.bufferedSeries ?? resolution.series;
|
|
620
|
+
const interventionMarks = useMemo(
|
|
621
|
+
() => wantsInterventions ? chartInterventions(spec, chartSeries, interventions) : null,
|
|
622
|
+
[chartSeries, interventions, spec, wantsInterventions],
|
|
623
|
+
);
|
|
612
624
|
const [interactionCaptured, setInteractionCapturedState] = useState(false);
|
|
613
625
|
// Typing in quick-add must not freeze the plot: it only takes the keyboard.
|
|
614
626
|
const [modalCaptured, setModalCaptured] = useState(false);
|
|
@@ -1342,6 +1354,8 @@ function ChartComposerSurface({
|
|
|
1342
1354
|
timePick={timePick}
|
|
1343
1355
|
pricePick={pricePick}
|
|
1344
1356
|
levels={chartLevels}
|
|
1357
|
+
events={interventionMarks?.events}
|
|
1358
|
+
mergeEventCaptions={interventionMarks?.merge}
|
|
1345
1359
|
rangeStatisticsSeriesId={rangeStatisticsSeriesId}
|
|
1346
1360
|
emptyMessage={emptyMessage}
|
|
1347
1361
|
emptyDetail={emptyDetail}
|
|
@@ -279,7 +279,7 @@ export function getChatComposerAreaHeight({
|
|
|
279
279
|
replyTo,
|
|
280
280
|
mentionSuggestionCount,
|
|
281
281
|
draftAttachmentCount = 0,
|
|
282
|
-
|
|
282
|
+
draftLinkRows = 0,
|
|
283
283
|
promptRows = 0,
|
|
284
284
|
}: {
|
|
285
285
|
canSend: boolean;
|
|
@@ -290,8 +290,8 @@ export function getChatComposerAreaHeight({
|
|
|
290
290
|
mentionSuggestionCount?: number;
|
|
291
291
|
/** The terminal draws a row per waiting image; the desktop strip sizes itself. */
|
|
292
292
|
draftAttachmentCount?: number;
|
|
293
|
-
/** The
|
|
294
|
-
|
|
293
|
+
/** The terminal rows the waiting share links' cards take, which an edit shows too; the desktop strip sizes itself. */
|
|
294
|
+
draftLinkRows?: number;
|
|
295
295
|
/** Terminal rows the handle prompt above the composer takes. */
|
|
296
296
|
promptRows?: number;
|
|
297
297
|
}) {
|
|
@@ -300,5 +300,6 @@ export function getChatComposerAreaHeight({
|
|
|
300
300
|
+ (editingMessage || replyTo ? 1 : 0)
|
|
301
301
|
+ Math.max(0, mentionSuggestionCount ?? 0)
|
|
302
302
|
+ (!nativePaneChrome && !editingMessage ? draftAttachmentCount : 0)
|
|
303
|
-
|
|
303
|
+
// The waiting share links' cards, each as tall as what it says.
|
|
304
|
+
+ (!nativePaneChrome ? draftLinkRows : 0);
|
|
304
305
|
}
|
|
@@ -60,6 +60,9 @@ import { openChatPaneLink } from "../pane-links/open";
|
|
|
60
60
|
import { runChatCommand, useChatFunctions } from "../pane-links/commands";
|
|
61
61
|
import type { ChatMessagePaneLink } from "../pane-links/model";
|
|
62
62
|
import { splitComposerDraft, type ComposerShareLink } from "../pane-links/composer";
|
|
63
|
+
import { useSharePreviewStates } from "../pane-links/previews";
|
|
64
|
+
import { terminalChatPaneChipRows } from "../pane-links/share-card";
|
|
65
|
+
import { terminalComposerChipWidth } from "../message/pane-chip";
|
|
63
66
|
import { teamStore } from "../../../../team/store";
|
|
64
67
|
import { requestAccountManagementTab } from "../../account-management/navigation";
|
|
65
68
|
import {
|
|
@@ -377,6 +380,13 @@ function ChatConversation({
|
|
|
377
380
|
useEffect(() => {
|
|
378
381
|
setMentionSelectedIndex(0);
|
|
379
382
|
}, [suggestionTriggerKey]);
|
|
383
|
+
// The waiting links' cards are as tall as what they say, which changes as each share is read.
|
|
384
|
+
const draftLinkStates = useSharePreviewStates(nativePaneChrome ? [] : draftLinks.map((link) => link.id));
|
|
385
|
+
const draftLinkRows = useMemo(
|
|
386
|
+
() => draftLinks.reduce((rows, link) => rows + terminalChatPaneChipRows(link, terminalComposerChipWidth(contentWidth)), 0),
|
|
387
|
+
// The rows are read from the share previews' cache, which `draftLinkStates` follows.
|
|
388
|
+
[contentWidth, draftLinkStates, draftLinks],
|
|
389
|
+
);
|
|
380
390
|
const {
|
|
381
391
|
composerHeight,
|
|
382
392
|
messageAreaHeight,
|
|
@@ -390,7 +400,7 @@ function ChatConversation({
|
|
|
390
400
|
replyTo,
|
|
391
401
|
stackHeader: stackedNav && !channelListOpen,
|
|
392
402
|
draftAttachmentCount: draftAttachments.length,
|
|
393
|
-
|
|
403
|
+
draftLinkRows,
|
|
394
404
|
promptRows: canSend && !nativePaneChrome ? chatHandlePromptRows(handlePrompt, contentWidth) : 0,
|
|
395
405
|
});
|
|
396
406
|
const {
|
|
@@ -948,7 +958,7 @@ function ChatConversation({
|
|
|
948
958
|
setSelectedIdx,
|
|
949
959
|
stickyTranscript,
|
|
950
960
|
useDefaultControllerChannel,
|
|
951
|
-
composerLayoutKey: `${editingMessage ? "" : draftAttachments.map((attachment) => attachment.status).join(",")}:${draftLinks.length}`,
|
|
961
|
+
composerLayoutKey: `${editingMessage ? "" : draftAttachments.map((attachment) => attachment.status).join(",")}:${draftLinks.length}:${draftLinkRows}`,
|
|
952
962
|
highlightMessage,
|
|
953
963
|
clearHover,
|
|
954
964
|
clearHighlight,
|
|
@@ -49,7 +49,7 @@ export function resolveChatContentHeightMetrics({
|
|
|
49
49
|
replyTo,
|
|
50
50
|
stackHeader = false,
|
|
51
51
|
draftAttachmentCount = 0,
|
|
52
|
-
|
|
52
|
+
draftLinkRows = 0,
|
|
53
53
|
promptRows = 0,
|
|
54
54
|
}: {
|
|
55
55
|
canSend: boolean;
|
|
@@ -62,7 +62,7 @@ export function resolveChatContentHeightMetrics({
|
|
|
62
62
|
/** The narrow stack's Back row is drawn above the transcript. */
|
|
63
63
|
stackHeader?: boolean;
|
|
64
64
|
draftAttachmentCount?: number;
|
|
65
|
-
|
|
65
|
+
draftLinkRows?: number;
|
|
66
66
|
/** Terminal rows the handle prompt above the composer takes. */
|
|
67
67
|
promptRows?: number;
|
|
68
68
|
}) {
|
|
@@ -79,7 +79,7 @@ export function resolveChatContentHeightMetrics({
|
|
|
79
79
|
nativePaneChrome,
|
|
80
80
|
replyTo,
|
|
81
81
|
draftAttachmentCount,
|
|
82
|
-
|
|
82
|
+
draftLinkRows,
|
|
83
83
|
promptRows,
|
|
84
84
|
});
|
|
85
85
|
// In the terminal the Back row replaces the top rule.
|
|
@@ -3,7 +3,7 @@ import type { ChatAttachment } from "../../../../api-client";
|
|
|
3
3
|
import { chatMessageTokens } from "../markdown";
|
|
4
4
|
import { chatImageLabel } from "../attachments/model";
|
|
5
5
|
import { wirePaneTarget, type ChatMessagePaneLink } from "../pane-links/model";
|
|
6
|
-
import { chatPaneLinkPane, peekSharePreview } from "../pane-links/previews";
|
|
6
|
+
import { chatPaneLinkPane, peekSharePreview, sharePreviewTitle } from "../pane-links/previews";
|
|
7
7
|
import { resolveChatCommand, type ChatFunction } from "../pane-links/commands";
|
|
8
8
|
|
|
9
9
|
export type ChatOpenTarget =
|
|
@@ -12,12 +12,12 @@ export type ChatOpenTarget =
|
|
|
12
12
|
| { kind: "link"; url: string; label: string }
|
|
13
13
|
| { kind: "image"; index: number; url: string; label: string };
|
|
14
14
|
|
|
15
|
-
/** What the Open list calls a chip: the share's title once read, else its link; a Wire post's pane; a function as written. */
|
|
15
|
+
/** What the Open list calls a chip: the share's item or title once read, else its link; a Wire post's pane; a function as written. */
|
|
16
16
|
function paneLinkLabel(link: ChatMessagePaneLink): string {
|
|
17
17
|
if (link.kind === "command") return link.query;
|
|
18
18
|
if (link.kind === "share") {
|
|
19
19
|
const preview = peekSharePreview(link.id);
|
|
20
|
-
return preview.status === "ready" ? preview
|
|
20
|
+
return preview.status === "ready" ? sharePreviewTitle(preview) : link.url;
|
|
21
21
|
}
|
|
22
22
|
const target = wirePaneTarget(link.link);
|
|
23
23
|
const name = chatPaneLinkPane(target.paneId)?.name ?? target.name;
|
|
@@ -13,6 +13,7 @@ import type { InlineTickerCatalogEntry } from "../../../state/hooks/inline-ticke
|
|
|
13
13
|
import { STICKY_BOTTOM_THRESHOLD_PX } from "../../../ui/sticky-scroll";
|
|
14
14
|
import { terminalReactionRows } from "./reactions";
|
|
15
15
|
import { chatMessagePaneLinks } from "./pane-links/model";
|
|
16
|
+
import { terminalChatPaneChipRows } from "./pane-links/share-card";
|
|
16
17
|
import { chatInlineTokens, type ChatInlineToken, type ChatTextStyle } from "./markdown";
|
|
17
18
|
|
|
18
19
|
const MESSAGE_GROUP_THRESHOLD_MS = 5 * 60 * 1000;
|
|
@@ -329,7 +330,7 @@ export function estimateMessageHeight(
|
|
|
329
330
|
const headerHeight = grouped ? 0 : 1;
|
|
330
331
|
const contentLineWidth = Math.max(width - 4, 1);
|
|
331
332
|
const imageCount = message.attachments?.length ?? 0;
|
|
332
|
-
// A
|
|
333
|
+
// A share link's card rows or a Wire post link's chip row, in place of the link's text.
|
|
333
334
|
const { links, content } = chatMessagePaneLinks(message);
|
|
334
335
|
// The terminal draws a row per image and one for a review note; an image-only message has no text row.
|
|
335
336
|
const bodyLineCount = content.length === 0 && (imageCount > 0 || links.length > 0)
|
|
@@ -337,7 +338,9 @@ export function estimateMessageHeight(
|
|
|
337
338
|
: getMessageBodyTokenLines(content, contentLineWidth, catalog ?? {}).length;
|
|
338
339
|
const reviewNoteHeight = message.attachmentReview ? 1 : 0;
|
|
339
340
|
const reactionRows = message.reactions?.length ? terminalReactionRows(message.reactions, contentLineWidth).length : 0;
|
|
340
|
-
|
|
341
|
+
// A share's card is as tall as what it says, as it reads now.
|
|
342
|
+
const linkRows = links.reduce((rows, link) => rows + terminalChatPaneChipRows(link, contentLineWidth), 0);
|
|
343
|
+
return headerHeight + (message.replyTo ? 1 : 0) + bodyLineCount + linkRows + imageCount + reviewNoteHeight + reactionRows;
|
|
341
344
|
}
|
|
342
345
|
|
|
343
346
|
export function estimateComposerHeight(text: string, width: number) {
|