@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
package/src/i18n/zh-tw.ts
CHANGED
|
@@ -243,7 +243,7 @@ export const zhTW: Record<string, string> = {
|
|
|
243
243
|
"Duplicate Pane": "複製面板",
|
|
244
244
|
"Remove Pane": "移除面板",
|
|
245
245
|
"Float Pane": "浮動面板",
|
|
246
|
-
"
|
|
246
|
+
"Return to Layout": "返回版面設定",
|
|
247
247
|
"Move to New Layout": "移到新版面設定",
|
|
248
248
|
"Move Back to {layout}": "移回 {layout}",
|
|
249
249
|
"Settings": "設定",
|
|
@@ -271,8 +271,8 @@ export const zhTW: Record<string, string> = {
|
|
|
271
271
|
"Create a new layout": "建立新版面設定",
|
|
272
272
|
"Rename the current layout preset": "重新命名目前版面設定預設",
|
|
273
273
|
"Delete the current layout preset": "刪除目前版面設定預設",
|
|
274
|
-
"
|
|
275
|
-
"
|
|
274
|
+
"Take a pane out of the layout into a floating window": "把面板從版面設定移到浮動視窗",
|
|
275
|
+
"Put a floating pane back into the layout": "把浮動面板放回版面設定",
|
|
276
276
|
"Remove a pane from the layout": "從版面設定中移除面板",
|
|
277
277
|
"Swap two pane positions": "交換兩個面板的位置",
|
|
278
278
|
"Arrange all visible panes into a tiled grid": "將所有可見面板平鋪排列",
|
|
@@ -561,10 +561,10 @@ export const zhTW: Record<string, string> = {
|
|
|
561
561
|
"Copy the active terminal selection.": "複製目前終端機選取內容。",
|
|
562
562
|
"Paste clipboard text into the active input.": "將剪貼簿文字貼到目前的輸入欄位。",
|
|
563
563
|
"Restart into a downloaded app update, or retry one that failed.": "使用已下載的更新重新啟動,或重試失敗的更新。",
|
|
564
|
-
"Close the focused pane,
|
|
564
|
+
"Close the focused pane, in the layout or floating. Locked panes stay open.": "關閉聚焦面板(在版面設定中或浮動)。鎖定的面板保持開啟。",
|
|
565
565
|
"Close all floating panes.": "關閉所有浮動面板。",
|
|
566
566
|
"Edit settings for the focused pane.": "編輯聚焦面板的設定。",
|
|
567
|
-
"
|
|
567
|
+
"Float the focused pane, or return it to the layout.": "浮動聚焦面板,或將其返回版面設定。",
|
|
568
568
|
"Pop the focused pane out to a desktop window.": "把聚焦面板彈出為桌面視窗。",
|
|
569
569
|
"Copy a screenshot of the focused pane.": "複製聚焦面板的截圖。",
|
|
570
570
|
"Open layout actions.": "開啟版面設定操作。",
|
|
@@ -573,8 +573,8 @@ export const zhTW: Record<string, string> = {
|
|
|
573
573
|
"Cancel an active pane drag.": "取消正在進行的面板拖曳。",
|
|
574
574
|
"Close the focused pane when nothing is being dragged.": "未拖曳時關閉聚焦面板。",
|
|
575
575
|
"Switch between move and resize.": "在移動與縮放之間切換。",
|
|
576
|
-
"
|
|
577
|
-
"Move, resize, or choose
|
|
576
|
+
"Float the selected window, or return it to the layout.": "浮動所選視窗,或將其返回版面設定。",
|
|
577
|
+
"Move, resize, or choose where it goes in the layout.": "移動、縮放,或選擇它在版面設定中的位置。",
|
|
578
578
|
"Use larger move and resize steps with direction keys.": "配合方向鍵使用更大的移動/縮放步長。",
|
|
579
579
|
"Cycle windows or resize handles.": "循環切換視窗或縮放控制點。",
|
|
580
580
|
"Commit pending changes or exit window mode.": "確認待處理的變更或結束視窗模式。",
|
|
@@ -613,7 +613,6 @@ export const zhTW: Record<string, string> = {
|
|
|
613
613
|
"Open ticker search": "開啟股票搜尋",
|
|
614
614
|
"Switch between panels": "在面板間切換",
|
|
615
615
|
"Close the focused pane": "關閉聚焦面板",
|
|
616
|
-
"Dock or float the focused pane": "停靠或浮動聚焦面板",
|
|
617
616
|
"Quit": "結束",
|
|
618
617
|
"Open security details": "開啟證券詳情",
|
|
619
618
|
"Switch theme": "切換主題",
|
|
@@ -1546,6 +1545,7 @@ export const zhTW: Record<string, string> = {
|
|
|
1546
1545
|
"Transcripts, summaries, guidance and scores.": "逐字稿、摘要、財測和評分。",
|
|
1547
1546
|
"YOUR WORKSPACE": "你的工作區",
|
|
1548
1547
|
"Your holdings as a heatmap, a watchlist, and {ticker} charted. Every pane moves; {shortcut} adds more.": "持股熱力圖、觀察清單和 {ticker} 的圖表。每個面板都可移動;{shortcut} 可新增更多。",
|
|
1548
|
+
"A watchlist, the top news, and {ticker} charted. Every pane moves; {shortcut} adds more.": "觀察清單、頭條新聞和 {ticker} 的圖表。每個面板都可移動;{shortcut} 可新增更多。",
|
|
1549
1549
|
"b: sign in with the browser instead": "b:改用瀏覽器登入",
|
|
1550
1550
|
"Esc, then b: sign in with the browser instead": "按 Esc 後按 b:改用瀏覽器登入",
|
|
1551
1551
|
"Sign in with the browser instead": "改用瀏覽器登入",
|
|
@@ -1562,6 +1562,7 @@ export const zhTW: Record<string, string> = {
|
|
|
1562
1562
|
"FX & macro": "外匯與總經",
|
|
1563
1563
|
"Active trading": "積極交易",
|
|
1564
1564
|
"Your holdings as a heatmap, a watchlist, and {ticker} charted. Your desks are tabs at the bottom; {shortcut} adds more.": "持股熱力圖、觀察清單和 {ticker} 的圖表。你的交易台在底部分頁;{shortcut} 可新增更多。",
|
|
1565
|
+
"A watchlist, the top news, and {ticker} charted. Your desks are tabs at the bottom; {shortcut} adds more.": "觀察清單、頭條新聞和 {ticker} 的圖表。你的交易台在底部分頁;{shortcut} 可新增更多。",
|
|
1565
1566
|
// ── Upgrade sheet ─────────────────────────────────────────
|
|
1566
1567
|
"Start free trial": "開始免費試用",
|
|
1567
1568
|
"Your last payment didn't go through": "上次付款未成功",
|
|
@@ -43,7 +43,24 @@ export function detachPaneToFrame(
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
/**
|
|
47
|
+
* `instanceId` floating at `rect`, in front unless `rect` says its z. A tab of
|
|
48
|
+
* a floating stack keeps its place in the list (the stack's tab order), and
|
|
49
|
+
* the other tabs move with it.
|
|
50
|
+
*/
|
|
46
51
|
export function floatAtRect(layout: LayoutConfig, instanceId: string, rect: FloatingRect): LayoutConfig {
|
|
52
|
+
const stack = layout.floating.find((entry) => entry.instanceId === instanceId)?.stack;
|
|
53
|
+
if (stack) {
|
|
54
|
+
const placed = { x: rect.x, y: rect.y, width: rect.width, height: rect.height };
|
|
55
|
+
const zIndex = rect.zIndex ?? maxFloatingZ(layout) + 1;
|
|
56
|
+
return finalizeLayout({
|
|
57
|
+
...layout,
|
|
58
|
+
floating: compactFloatingZ(layout.floating.map((entry) => {
|
|
59
|
+
if (entry.instanceId === instanceId) return { ...entry, ...placed, zIndex };
|
|
60
|
+
return entry.stack === stack ? { ...entry, ...placed } : entry;
|
|
61
|
+
})),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
47
64
|
const base = detachPane(layout, instanceId);
|
|
48
65
|
return finalizeLayout({
|
|
49
66
|
...base,
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import type { FloatingPaneEntry, LayoutConfig } from "../../types/config";
|
|
2
|
+
import { compactFloatingZ, maxFloatingZ } from "./floating";
|
|
3
|
+
import { detachPane, finalizeLayout } from "./layout-state";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Floating windows stacked as tabs: the members share a `stack` key and one
|
|
7
|
+
* rect, in the order the layout lists them, and the one in front (highest z,
|
|
8
|
+
* the later one of equals) is the tab shown. Raising a member (a click on its
|
|
9
|
+
* tab, focus) shows it; moving or resizing the stack moves every member
|
|
10
|
+
* (`floatAtRect`). A key with one member left is dropped when the layout is
|
|
11
|
+
* finalized.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** The members of the stack `instanceId` floats in, in tab order; empty when it floats alone. */
|
|
15
|
+
export function floatingStackMembers(floating: readonly FloatingPaneEntry[], instanceId: string): FloatingPaneEntry[] {
|
|
16
|
+
const entry = floating.find((candidate) => candidate.instanceId === instanceId);
|
|
17
|
+
if (!entry?.stack) return [];
|
|
18
|
+
const members = floating.filter((candidate) => candidate.stack === entry.stack);
|
|
19
|
+
return members.length > 1 ? members : [];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The member a stack shows: the one in front. */
|
|
23
|
+
function shownStackMember(members: readonly FloatingPaneEntry[]): FloatingPaneEntry | undefined {
|
|
24
|
+
let shown: FloatingPaneEntry | undefined;
|
|
25
|
+
for (const member of members) {
|
|
26
|
+
if (!shown || (member.zIndex ?? 50) >= (shown.zIndex ?? 50)) shown = member;
|
|
27
|
+
}
|
|
28
|
+
return shown;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Every floating stack, by the pane it shows, with its tabs in order. A list
|
|
33
|
+
* sorted some other way (front to back) takes the layout's list as `order`.
|
|
34
|
+
*/
|
|
35
|
+
export function floatingStacks(
|
|
36
|
+
floating: readonly FloatingPaneEntry[],
|
|
37
|
+
order?: readonly { instanceId: string }[],
|
|
38
|
+
): Map<string, string[]> {
|
|
39
|
+
const rank = order ? new Map(order.map((entry, index) => [entry.instanceId, index])) : null;
|
|
40
|
+
const byKey = new Map<string, FloatingPaneEntry[]>();
|
|
41
|
+
for (const entry of floating) {
|
|
42
|
+
if (!entry.stack) continue;
|
|
43
|
+
const members = byKey.get(entry.stack) ?? [];
|
|
44
|
+
members.push(entry);
|
|
45
|
+
byKey.set(entry.stack, members);
|
|
46
|
+
}
|
|
47
|
+
const stacks = new Map<string, string[]>();
|
|
48
|
+
for (const members of byKey.values()) {
|
|
49
|
+
if (members.length < 2) continue;
|
|
50
|
+
const tabs = rank ? [...members].sort((a, b) => (rank.get(a.instanceId) ?? 0) - (rank.get(b.instanceId) ?? 0)) : members;
|
|
51
|
+
stacks.set(shownStackMember(members)!.instanceId, tabs.map((member) => member.instanceId));
|
|
52
|
+
}
|
|
53
|
+
return stacks;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Floating entries as a saved layout may hold them, made whole: a `stack`
|
|
58
|
+
* key that is not a non-empty string, or that one entry alone has, is
|
|
59
|
+
* dropped, and every member of a stack takes the rect of the tab it shows.
|
|
60
|
+
* A client that does not know stacks keeps the key but draws each member as
|
|
61
|
+
* a window of its own, so it may have moved them apart.
|
|
62
|
+
*/
|
|
63
|
+
export function alignFloatingStacks<T extends FloatingPaneEntry>(floating: readonly T[]): T[] {
|
|
64
|
+
const byKey = new Map<string, T[]>();
|
|
65
|
+
for (const entry of floating) {
|
|
66
|
+
if (typeof entry.stack !== "string" || entry.stack.length === 0) continue;
|
|
67
|
+
byKey.set(entry.stack, [...(byKey.get(entry.stack) ?? []), entry]);
|
|
68
|
+
}
|
|
69
|
+
const rects = new Map<string, Pick<FloatingPaneEntry, "x" | "y" | "width" | "height">>();
|
|
70
|
+
for (const [key, members] of byKey) {
|
|
71
|
+
if (members.length < 2) continue;
|
|
72
|
+
const { x, y, width, height } = shownStackMember(members)!;
|
|
73
|
+
rects.set(key, { x, y, width, height });
|
|
74
|
+
}
|
|
75
|
+
return floating.map((entry) => {
|
|
76
|
+
const rect = typeof entry.stack === "string" ? rects.get(entry.stack) : undefined;
|
|
77
|
+
if (rect) return { ...entry, ...rect };
|
|
78
|
+
if (!("stack" in entry)) return entry;
|
|
79
|
+
const { stack: _stack, ...rest } = entry;
|
|
80
|
+
return rest as T;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** The floating panes behind the tab their stack shows. */
|
|
85
|
+
export function hiddenFloatingTabIds(floating: readonly FloatingPaneEntry[]): Set<string> {
|
|
86
|
+
const hidden = new Set<string>();
|
|
87
|
+
for (const [shown, members] of floatingStacks(floating)) {
|
|
88
|
+
for (const id of members) if (id !== shown) hidden.add(id);
|
|
89
|
+
}
|
|
90
|
+
return hidden;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* A key no stack has yet, for a stack `instanceId` starts: its own id unless
|
|
95
|
+
* that is taken. A tab pulled out of a stack leaves the key with the tabs
|
|
96
|
+
* that stay, so the id of the window that started a stack may still name it.
|
|
97
|
+
*/
|
|
98
|
+
function newStackKey(floating: readonly FloatingPaneEntry[], instanceId: string): string {
|
|
99
|
+
const taken = new Set(floating.flatMap((entry) => (entry.stack ? [entry.stack] : [])));
|
|
100
|
+
let key = instanceId;
|
|
101
|
+
for (let n = 2; taken.has(key); n += 1) key = `${instanceId}#${n}`;
|
|
102
|
+
return key;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* `draggedId` as the last tab of the floating window `targetId` (or its
|
|
107
|
+
* stack), shown, at its rect. The dragged pane leaves wherever it was: the
|
|
108
|
+
* dock, another stack, a floating spot of its own.
|
|
109
|
+
*/
|
|
110
|
+
export function stackFloatingOnto(layout: LayoutConfig, draggedId: string, targetId: string): LayoutConfig {
|
|
111
|
+
if (draggedId === targetId) return layout;
|
|
112
|
+
const target = layout.floating.find((entry) => entry.instanceId === targetId);
|
|
113
|
+
if (!target) return layout;
|
|
114
|
+
const key = target.stack ?? newStackKey(layout.floating, target.instanceId);
|
|
115
|
+
const base = detachPane(layout, draggedId);
|
|
116
|
+
const floating = base.floating.map((entry) => (entry.instanceId === targetId ? { ...entry, stack: key } : entry));
|
|
117
|
+
floating.push({
|
|
118
|
+
instanceId: draggedId,
|
|
119
|
+
x: target.x,
|
|
120
|
+
y: target.y,
|
|
121
|
+
width: target.width,
|
|
122
|
+
height: target.height,
|
|
123
|
+
zIndex: maxFloatingZ(layout) + 1,
|
|
124
|
+
stack: key,
|
|
125
|
+
});
|
|
126
|
+
return finalizeLayout({ ...base, floating: compactFloatingZ(floating) });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** `instanceId` out of its floating stack, where it is, the others left as they are. */
|
|
130
|
+
export function unstackFloating(layout: LayoutConfig, instanceId: string): LayoutConfig {
|
|
131
|
+
const entry = layout.floating.find((candidate) => candidate.instanceId === instanceId);
|
|
132
|
+
if (!entry?.stack) return layout;
|
|
133
|
+
return finalizeLayout({
|
|
134
|
+
...layout,
|
|
135
|
+
floating: layout.floating.map((candidate) => {
|
|
136
|
+
if (candidate.instanceId !== instanceId) return candidate;
|
|
137
|
+
const { stack: _stack, ...rest } = candidate;
|
|
138
|
+
return rest;
|
|
139
|
+
}),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export type FloatingSplitSide = "left" | "right" | "top" | "bottom";
|
|
144
|
+
|
|
145
|
+
/** The two halves of `rect` a split on `side` makes: the dropped window's, then the target's. */
|
|
146
|
+
export function floatingSplitRects(
|
|
147
|
+
rect: { x: number; y: number; width: number; height: number },
|
|
148
|
+
side: FloatingSplitSide,
|
|
149
|
+
): [{ x: number; y: number; width: number; height: number }, { x: number; y: number; width: number; height: number }] {
|
|
150
|
+
const { x, y, width, height } = rect;
|
|
151
|
+
if (side === "left" || side === "right") {
|
|
152
|
+
const half = width / 2;
|
|
153
|
+
const left = { x, y, width: half, height };
|
|
154
|
+
const right = { x: x + half, y, width: width - half, height };
|
|
155
|
+
return side === "left" ? [left, right] : [right, left];
|
|
156
|
+
}
|
|
157
|
+
const half = height / 2;
|
|
158
|
+
const top = { x, y, width, height: half };
|
|
159
|
+
const bottom = { x, y: y + half, width, height: height - half };
|
|
160
|
+
return side === "top" ? [top, bottom] : [bottom, top];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* `draggedId` beside the floating window `targetId` on `side`, sharing its
|
|
165
|
+
* rect: each takes half, edge to edge, so their shared edge resizes both.
|
|
166
|
+
* The target's stack, if it is one, keeps its tabs and takes its half whole.
|
|
167
|
+
*/
|
|
168
|
+
export function splitFloating(layout: LayoutConfig, draggedId: string, targetId: string, side: FloatingSplitSide): LayoutConfig {
|
|
169
|
+
if (draggedId === targetId) return layout;
|
|
170
|
+
const target = layout.floating.find((entry) => entry.instanceId === targetId);
|
|
171
|
+
if (!target) return layout;
|
|
172
|
+
const [dropped, kept] = floatingSplitRects(target, side);
|
|
173
|
+
const base = finalizeLayout(detachPane(layout, draggedId));
|
|
174
|
+
const resized = finalizeLayout({
|
|
175
|
+
...base,
|
|
176
|
+
floating: base.floating.map((entry) => (
|
|
177
|
+
entry.instanceId === targetId || (target.stack && entry.stack === target.stack) ? { ...entry, ...kept } : entry
|
|
178
|
+
)),
|
|
179
|
+
});
|
|
180
|
+
return finalizeLayout({
|
|
181
|
+
...resized,
|
|
182
|
+
floating: compactFloatingZ([
|
|
183
|
+
...resized.floating,
|
|
184
|
+
{ instanceId: draggedId, ...dropped, zIndex: maxFloatingZ(resized) + 1 },
|
|
185
|
+
]),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
@@ -89,9 +89,11 @@ const FLOATING_PANE_BASE_Z = 50;
|
|
|
89
89
|
* pair at `under` and `over`: on the desktop the landing preview under the
|
|
90
90
|
* pane on the move (lifted to `over` while it is over a target, or its outline
|
|
91
91
|
* when it was docked); in the terminal, which cannot see through a pane, the
|
|
92
|
-
* docked pane's outline under the landing outline.
|
|
92
|
+
* docked pane's outline under the landing outline. The drop targets a move
|
|
93
|
+
* offers (the target on the pane under the pointer, the strips along the
|
|
94
|
+
* window's edges) sit over both, at `targets`.
|
|
93
95
|
*/
|
|
94
|
-
export const SHELL_DRAG_Z = { under: 95, over: 96 } as const;
|
|
96
|
+
export const SHELL_DRAG_Z = { under: 95, over: 96, targets: 97 } as const;
|
|
95
97
|
|
|
96
98
|
/** The lowest of the shell's fixed overlays over every pane. */
|
|
97
99
|
const SHELL_PREVIEW_Z = SHELL_DRAG_Z.under;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DockLayoutNode, FloatingPaneEntry, LayoutConfig } from "../../types/config";
|
|
2
2
|
import { buildDockStack, isDockStack } from "./dock-stack";
|
|
3
|
+
import { floatingStacks, hiddenFloatingTabIds } from "./floating-stack";
|
|
3
4
|
import type { AppNotificationRequest } from "../../types/plugin";
|
|
4
5
|
import {
|
|
5
6
|
boundsForRects,
|
|
@@ -165,7 +166,10 @@ export function gridlockAllPanes(
|
|
|
165
166
|
const dockedRects: GridlockRect[] = leaves.map((leaf) => ({ instanceId: leaf.instanceId, ...leaf.rect }));
|
|
166
167
|
// A stack is tiled as the tab it shows and keeps its other tabs.
|
|
167
168
|
const stacks = new Map(leaves.flatMap((leaf) => (leaf.stack ? [[leaf.instanceId, leaf.stack] as const] : [])));
|
|
168
|
-
|
|
169
|
+
// A floating stack is tiled as the tab it shows, and keeps its tabs as a docked stack.
|
|
170
|
+
for (const [shown, members] of floatingStacks(visibleLayout.floating)) stacks.set(shown, members);
|
|
171
|
+
const hiddenTabs = hiddenFloatingTabIds(visibleLayout.floating);
|
|
172
|
+
const floatingRects: GridlockRect[] = visibleLayout.floating.filter((entry) => !hiddenTabs.has(entry.instanceId)).map((entry) => ({
|
|
169
173
|
instanceId: entry.instanceId,
|
|
170
174
|
x: entry.x,
|
|
171
175
|
y: entry.y,
|
|
@@ -54,6 +54,17 @@ export {
|
|
|
54
54
|
swapPanes,
|
|
55
55
|
} from "./docking";
|
|
56
56
|
|
|
57
|
+
export {
|
|
58
|
+
floatingSplitRects,
|
|
59
|
+
floatingStackMembers,
|
|
60
|
+
floatingStacks,
|
|
61
|
+
hiddenFloatingTabIds,
|
|
62
|
+
splitFloating,
|
|
63
|
+
stackFloatingOnto,
|
|
64
|
+
unstackFloating,
|
|
65
|
+
type FloatingSplitSide,
|
|
66
|
+
} from "./floating-stack";
|
|
67
|
+
|
|
57
68
|
export { restoreHiddenPanes } from "./hidden-panes";
|
|
58
69
|
export {
|
|
59
70
|
removeFloatingPanes,
|
|
@@ -27,14 +27,21 @@ function normalizeFloatingEntries(layout: LayoutConfig): FloatingPaneEntry[] {
|
|
|
27
27
|
const dockedIds = new Set(getDockedInstanceIds(layout.dockRoot));
|
|
28
28
|
const detachedIds = new Set((layout.detached ?? []).map((entry) => entry.instanceId));
|
|
29
29
|
const seen = new Set<string>();
|
|
30
|
-
|
|
30
|
+
const kept = layout.floating
|
|
31
31
|
.filter((entry) => !dockedIds.has(entry.instanceId) && !detachedIds.has(entry.instanceId))
|
|
32
32
|
.filter((entry) => {
|
|
33
33
|
if (seen.has(entry.instanceId)) return false;
|
|
34
34
|
seen.add(entry.instanceId);
|
|
35
35
|
return true;
|
|
36
|
-
})
|
|
37
|
-
|
|
36
|
+
});
|
|
37
|
+
// A floating stack left with one tab is a window of its own again.
|
|
38
|
+
const stackSizes = new Map<string, number>();
|
|
39
|
+
for (const entry of kept) if (entry.stack) stackSizes.set(entry.stack, (stackSizes.get(entry.stack) ?? 0) + 1);
|
|
40
|
+
return kept.map((entry) => {
|
|
41
|
+
if (!entry.stack || (stackSizes.get(entry.stack) ?? 0) > 1) return { ...entry };
|
|
42
|
+
const { stack: _stack, ...rest } = entry;
|
|
43
|
+
return rest;
|
|
44
|
+
});
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
function normalizeDetachedEntries(layout: LayoutConfig) {
|
|
@@ -3,6 +3,7 @@ import { canonicalExchange, parsePublicTickerKey } from "../utils/exchanges";
|
|
|
3
3
|
import { formatNumber } from "../utils/format";
|
|
4
4
|
import { formatUtcDayTime } from "../utils/utc-time";
|
|
5
5
|
import { heldCurrencyUnit } from "../utils/currency-units";
|
|
6
|
+
import { adrRatioText } from "../utils/depositary-receipt";
|
|
6
7
|
import { regularSessionCloseOn } from "./market/freshness";
|
|
7
8
|
import { getRegularSessionDisplay, regularSessionDisplayDate } from "./market/status";
|
|
8
9
|
|
|
@@ -72,12 +73,13 @@ function homeLineRatioText(pair: DepositaryPair): string {
|
|
|
72
73
|
|
|
73
74
|
/**
|
|
74
75
|
* The ratio as a listing's report states it, from its side of the pair:
|
|
75
|
-
* `1 ADR = 10 ordinary shares of GGAL.BA` on the receipt
|
|
76
|
-
* of
|
|
76
|
+
* `1 ADR = 10 ordinary shares of GGAL.BA` on the receipt (`2 preferred
|
|
77
|
+
* shares of PETR4.SA`, homeShareClass), `1 GGAL ADR = 10 of these shares`
|
|
78
|
+
* on a home line.
|
|
77
79
|
*/
|
|
78
80
|
export function depositaryPairText(pair: DepositaryPair, receiptSide: boolean): string {
|
|
79
81
|
if (!receiptSide) return homeLineRatioText(pair);
|
|
80
|
-
return `1 ADR = ${ratioCount(pair.ratio)}
|
|
82
|
+
return `${adrRatioText(pair.ratio, pair.ordinary[0]) ?? `1 ADR = ${ratioCount(pair.ratio)}`} of ${pair.ordinary.join(" / ")}`;
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
/** A price as the comparison reads it, with when it was observed. */
|
|
@@ -173,6 +173,41 @@ export const FUTURES_SECTOR_ORDER: FuturesSector[] = [
|
|
|
173
173
|
"currencies",
|
|
174
174
|
];
|
|
175
175
|
|
|
176
|
+
/**
|
|
177
|
+
* The board's groups a reader names by a word: its sectors in any of their
|
|
178
|
+
* forms, and the two the Agriculture sector holds that traders name apart,
|
|
179
|
+
* the softs (grown, not mined, and traded in New York) and the grains with
|
|
180
|
+
* their soybean products.
|
|
181
|
+
*/
|
|
182
|
+
const FUTURES_GROUP_WORDS: ReadonlyArray<{ words: readonly string[]; label: string; matches: (contract: FuturesContract) => boolean }> = [
|
|
183
|
+
{ words: ["softs", "soft", "soft commodities"], label: "softs", matches: (contract) => ["KC", "SB", "CC", "CT", "OJ"].includes(contract.code) },
|
|
184
|
+
{ words: ["grains", "grain", "grains and oilseeds"], label: "grains", matches: (contract) => ["ZC", "ZS", "ZM", "ZL", "ZW", "KE"].includes(contract.code) },
|
|
185
|
+
{ words: ["agriculture", "agricultural", "ags", "ag", "agri"], label: "agriculture", matches: (contract) => contract.sector === "agriculture" },
|
|
186
|
+
{ words: ["metals", "metal"], label: "metals", matches: (contract) => contract.sector === "metals" },
|
|
187
|
+
{ words: ["energy", "energies"], label: "energy", matches: (contract) => contract.sector === "energy" },
|
|
188
|
+
{ words: ["livestock", "meats"], label: "livestock", matches: (contract) => contract.sector === "livestock" },
|
|
189
|
+
{ words: ["currencies", "currency", "fx"], label: "currencies", matches: (contract) => contract.sector === "currencies" },
|
|
190
|
+
{ words: ["rates", "interest rates", "treasuries"], label: "rates", matches: (contract) => contract.sector === "rates" },
|
|
191
|
+
{ words: ["equity index", "equity indices", "indices", "stock index", "stock indices"], label: "equity index",
|
|
192
|
+
matches: (contract) => contract.sector === "equity-index" },
|
|
193
|
+
{ words: ["equity sectors", "sector futures"], label: "equity sectors", matches: (contract) => contract.sector === "equity-sectors" },
|
|
194
|
+
];
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* The rows a group word stands for (`FUT softs`, `FUT agriculture`), or null
|
|
198
|
+
* for any other search. A sector's word lists that sector alone: "energy"
|
|
199
|
+
* is the energy futures, not the S&P Energy sector future beside them.
|
|
200
|
+
*/
|
|
201
|
+
export function futuresGroupFilter(query: string): ((contract: FuturesContract) => boolean) | null {
|
|
202
|
+
const typed = query.trim().toLowerCase().replace(/\s+/g, " ");
|
|
203
|
+
return FUTURES_GROUP_WORDS.find((group) => group.words.includes(typed))?.matches ?? null;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/** The group words a contract is found by, as a catalog search reads them: KC is softs and agriculture. */
|
|
207
|
+
export function futuresGroupTags(contract: FuturesContract): string[] {
|
|
208
|
+
return FUTURES_GROUP_WORDS.filter((group) => group.matches(contract)).map((group) => group.label);
|
|
209
|
+
}
|
|
210
|
+
|
|
176
211
|
export function getContractsBySector(): Map<FuturesSector, FuturesContract[]> {
|
|
177
212
|
const map = new Map<FuturesSector, FuturesContract[]>();
|
|
178
213
|
for (const sector of FUTURES_SECTOR_ORDER) {
|
|
@@ -235,7 +270,17 @@ export function futuresBoardContract(value: unknown): FuturesContract | null {
|
|
|
235
270
|
return BY_SYMBOL.get(typed(value)) ?? futuresContractByCode(value);
|
|
236
271
|
}
|
|
237
272
|
|
|
238
|
-
|
|
273
|
+
/**
|
|
274
|
+
* A contract's name as a reader may type it, with its number marked any way:
|
|
275
|
+
* "SUGAR NO. 11", the CFTC's name, and "Sugar #11", the board's, are both
|
|
276
|
+
* "sugar 11". Lower case, "No."/"Nr." before a number and "#" dropped,
|
|
277
|
+
* spaces collapsed.
|
|
278
|
+
*/
|
|
279
|
+
export function futuresNameKey(text: string): string {
|
|
280
|
+
return text.toLowerCase().replace(/\b(?:no|nr)\.?\s*(?=\d)/g, " ").replace(/#/g, " ").replace(/\s+/g, " ").trim();
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const nameWords = (text: string) => futuresNameKey(text).split(/[^a-z0-9]+/).filter(Boolean);
|
|
239
284
|
|
|
240
285
|
/**
|
|
241
286
|
* The item a typed name means: every word of it starts a word of the item's
|
|
@@ -325,8 +325,12 @@ export type FuturesChangeTerms = Pick<FuturesContractTermsPayload, "settlement">
|
|
|
325
325
|
* is confirmed: Wednesday's 7,720.50 close at 23:18 UTC, "+14 vs Wed 4 Nov
|
|
326
326
|
* close", never +137.75 from Tuesday's settlement, two sessions. At any
|
|
327
327
|
* other time the terms are behind and nothing dates it (null);
|
|
328
|
-
* -
|
|
329
|
-
*
|
|
328
|
+
* - once the move's own session has settled, is the session before's
|
|
329
|
+
* settlement when the quote closes on its own (Gloom Cloud then measures
|
|
330
|
+
* it from the one before: CC=F's 5,155 on Fri 6 Nov 2026, "-26 vs Thu 5
|
|
331
|
+
* Nov settle"), and otherwise the session before's close;
|
|
332
|
+
* - without a settlement in the terms, is the session before's close, which
|
|
333
|
+
* nothing else checks.
|
|
330
334
|
* On a venue without a calendar only a settlement is named. Null without a
|
|
331
335
|
* session date, a move or terms.
|
|
332
336
|
*/
|
|
@@ -350,10 +354,15 @@ export function futuresChangeBasis(
|
|
|
350
354
|
if (settled && settled.date <= session && Math.abs(reference - settled.price) <= settlementTolerance(terms.spec?.tick, settled.price)) {
|
|
351
355
|
return { kind: "settle", session: settled.date };
|
|
352
356
|
}
|
|
357
|
+
const sameContract = !!move.month && terms.deliveryMonth?.slice(0, 7) === move.month;
|
|
353
358
|
if (settled && previous && settled.date === previous) {
|
|
354
|
-
const sameContract = !!move.month && terms.deliveryMonth?.slice(0, 7) === move.month;
|
|
355
359
|
return sameContract && Number.isFinite(move.price) ? { kind: "settle", session: previous, from: settled.price } : null;
|
|
356
360
|
}
|
|
361
|
+
// The move's own session settled, and the quote closes on that settlement: Gloom Cloud measures it from the one before.
|
|
362
|
+
if (settled && previous && settled.date === session && sameContract
|
|
363
|
+
&& Math.abs(move.price - settled.price) <= settlementTolerance(terms.spec?.tick, settled.price)) {
|
|
364
|
+
return { kind: "settle", session: previous };
|
|
365
|
+
}
|
|
357
366
|
if (settled && previous && settled.date < previous) return print?.overnight && print.tradeDate === moveDate ? { kind: "close", session: previous } : null;
|
|
358
367
|
return previous ? { kind: "close", session: previous } : null;
|
|
359
368
|
}
|