gloomberb 0.19.4 → 0.19.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/src/api-client/equity-screener.ts +23 -0
- package/src/app/pane-runtime/index.tsx +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +10 -1
- package/src/app.tsx +63 -16
- package/src/cli/commands/command-utils.ts +4 -0
- package/src/cli/commands/market.ts +264 -33
- package/src/cli/commands/search.ts +22 -4
- package/src/cli/commands/ticker.ts +84 -39
- package/src/cli/currency-name-hint.ts +60 -0
- package/src/cli/glossary.ts +3 -3
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +25 -2
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/not-a-ticker.ts +5 -3
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +31 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +11 -6
- package/src/cli/pane-functions/market-session.ts +6 -7
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/series-search.ts +4 -5
- package/src/cli/symbol-list.ts +54 -2
- package/src/cli/symbol-rows.ts +14 -2
- package/src/cli/ticker-resolution.ts +89 -20
- package/src/components/chart/composite/axis-overlays.tsx +60 -27
- package/src/components/chart/composite/composite-chart.tsx +118 -63
- package/src/components/chart/composite/cursor-source.ts +111 -0
- package/src/components/chart/composite/format.ts +168 -6
- package/src/components/chart/composite/legend.tsx +8 -4
- package/src/components/chart/composite/panel-bitmap.ts +28 -2
- package/src/components/chart/composite/panel-labels.ts +20 -1
- package/src/components/chart/composite/panel-surface.tsx +201 -92
- package/src/components/chart/composite/price-axis-labels.tsx +92 -46
- package/src/components/chart/composite/price-series.ts +31 -8
- package/src/components/chart/composite/scene.ts +154 -59
- package/src/components/chart/composite/series-axis-tags.tsx +4 -2
- package/src/components/chart/composite/time-axis.ts +30 -7
- package/src/components/chart/composite/time-scale.ts +211 -56
- package/src/components/chart/composite/types.ts +11 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +32 -12
- package/src/components/chart/curve/curve-surface.tsx +5 -2
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
- package/src/components/chart/static/series.ts +3 -0
- package/src/components/command-bar/commands/collection-list.ts +81 -0
- package/src/components/command-bar/commands/direct/index.ts +6 -0
- package/src/components/command-bar/commands/registry.ts +8 -0
- package/src/components/command-bar/layout-items/current-layout.ts +22 -1
- package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
- package/src/components/command-bar/pane-templates/items.ts +19 -3
- package/src/components/command-bar/pane-templates/workflow.ts +5 -0
- package/src/components/command-bar/routes/root/results.ts +23 -3
- package/src/components/command-bar/routes/root/selection.ts +4 -2
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
- package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
- package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
- package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
- package/src/components/command-bar/surface/environment.ts +2 -0
- package/src/components/command-bar/view-model.ts +7 -0
- package/src/components/command-bar/workflow/ops.ts +2 -1
- package/src/components/command-bar/workflow/tickers.ts +20 -0
- package/src/components/layout/shell/active-drag.ts +38 -7
- package/src/components/layout/shell/drag/magnets.ts +106 -0
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +4 -0
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +20 -0
- package/src/components/layout/window-controls.tsx +96 -35
- package/src/components/layout/window-fullscreen.ts +20 -0
- package/src/components/onboarding/onboarding-keyboard.ts +5 -1
- package/src/components/onboarding/onboarding-wizard.tsx +15 -4
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +8 -5
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/quote-flash.ts +36 -32
- package/src/components/ticker/badge/index.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +23 -7
- package/src/components/ui/column-grid.tsx +8 -2
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/tabs.tsx +5 -2
- package/src/core/state/app/layout.ts +18 -3
- package/src/core/state/app/state.ts +2 -0
- package/src/core/state/app/types.ts +5 -0
- package/src/data/config/layout.ts +3 -0
- package/src/data/config/store/normalize.ts +39 -4
- package/src/i18n/es.ts +10 -0
- package/src/i18n/ja.ts +10 -0
- package/src/i18n/ko.ts +10 -0
- package/src/i18n/zh-cn.ts +10 -0
- package/src/i18n/zh-tw.ts +10 -0
- package/src/layout/pane-manager/floating-placement.ts +7 -4
- package/src/layout/pane-manager/floating.ts +5 -2
- package/src/market-data/bond-funds.ts +19 -0
- package/src/market-data/coordinator/events.ts +17 -1
- package/src/market-data/frame-scheduler.ts +47 -10
- package/src/market-data/frame-wake.ts +74 -0
- package/src/market-data/futures-board.ts +7 -6
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/hooks.tsx +12 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/market-data/performance.ts +78 -9
- package/src/market-data/request-types.ts +6 -3
- package/src/plugins/builtin/alerts/cli.ts +2 -1
- package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
- package/src/plugins/builtin/attention/evidence.ts +1 -1
- package/src/plugins/builtin/awards/client.ts +1 -1
- package/src/plugins/builtin/awards/evidence.ts +1 -1
- package/src/plugins/builtin/awards/pane.tsx +2 -1
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
- package/src/plugins/builtin/bond-calculator/math.ts +1 -1
- package/src/plugins/builtin/bond-calculator/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
- package/src/plugins/builtin/broker-manager/footer.ts +3 -2
- package/src/plugins/builtin/broker-manager/index.tsx +2 -1
- package/src/plugins/builtin/broker-manager/keyboard.ts +2 -1
- package/src/plugins/builtin/buildout/cells.tsx +25 -45
- package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
- package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
- package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
- package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
- package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
- package/src/plugins/builtin/buildout/format.ts +23 -1
- package/src/plugins/builtin/buildout/model/types.ts +1 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
- package/src/plugins/builtin/buildout/table-model.ts +12 -4
- package/src/plugins/builtin/catalysts/evidence.ts +1 -1
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chart-composer/headless.ts +40 -1
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +28 -3
- package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
- package/src/plugins/builtin/comment-letters/client.ts +2 -1
- package/src/plugins/builtin/company-kpis/client.ts +1 -1
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/cot/headless.ts +9 -3
- package/src/plugins/builtin/cot/model.ts +44 -3
- package/src/plugins/builtin/credit-documents/client.ts +1 -1
- package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
- package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
- package/src/plugins/builtin/debt-maturities/model.ts +66 -0
- package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
- package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +30 -6
- package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
- package/src/plugins/builtin/econ/print-watch.ts +3 -1
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +4 -16
- package/src/plugins/builtin/equity-screener/headless.ts +4 -2
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +180 -12
- package/src/plugins/builtin/equity-screener/pane.tsx +52 -12
- package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
- package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
- package/src/plugins/builtin/futures/series.ts +16 -1
- package/src/plugins/builtin/futures-curve/client.ts +19 -0
- package/src/plugins/builtin/futures-curve/headless.ts +52 -13
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +77 -6
- package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
- package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
- package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
- package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
- package/src/plugins/builtin/gpu/headless.ts +2 -1
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/index.tsx +2 -1
- package/src/plugins/builtin/insider/display.ts +45 -6
- package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
- package/src/plugins/builtin/iv-history/client.ts +2 -1
- package/src/plugins/builtin/iv-history/headless.ts +2 -1
- package/src/plugins/builtin/jobs/pages.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
- package/src/plugins/builtin/macro-day/client.ts +41 -0
- package/src/plugins/builtin/macro-day/headless.ts +19 -9
- package/src/plugins/builtin/macro-day/model.ts +3 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/members/client.ts +1 -1
- package/src/plugins/builtin/mna/distress/client.ts +1 -0
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/pane.tsx +4 -1
- package/src/plugins/builtin/options/market-reference.ts +1 -1
- package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
- package/src/plugins/builtin/options/view.tsx +2 -1
- package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
- package/src/plugins/builtin/options-scenario/csp.ts +28 -9
- package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/client.ts +1 -1
- package/src/plugins/builtin/perps/pane.tsx +3 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +4 -2
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/analyst-model.ts +1 -0
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/research/index.tsx +1 -0
- package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
- package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
- package/src/plugins/builtin/research-search/snippet.ts +1 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +8 -5
- package/src/plugins/builtin/sec/row-summaries.ts +28 -12
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
- package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
- package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/social-mentions/client.ts +2 -1
- package/src/plugins/builtin/supply-chain/client.ts +1 -1
- package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
- package/src/plugins/builtin/time-sales/client.ts +1 -0
- package/src/plugins/builtin/time-sales/pane.tsx +3 -2
- package/src/plugins/builtin/trace-bonds/client.ts +7 -4
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/vol-surface/client.ts +2 -1
- package/src/plugins/builtin/volatility/client.ts +6 -1
- package/src/plugins/builtin/volatility/headless.ts +0 -1
- package/src/plugins/builtin/yield-curve/curves.ts +15 -0
- package/src/plugins/builtin/yield-curve/headless.ts +9 -2
- package/src/plugins/builtin/yield-curve/index.tsx +5 -8
- package/src/plugins/host-modules.ts +22 -3
- package/src/plugins/host-smoke.ts +6 -3
- package/src/portfolio/collection-name.ts +19 -0
- package/src/portfolio/column-values.ts +76 -10
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +13 -2
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +15 -2
- package/src/renderers/desktop/geometry.ts +279 -0
- package/src/renderers/desktop/screen-setup.ts +246 -0
- package/src/renderers/desktop/sequential-window-host.ts +179 -0
- package/src/renderers/desktop/test-utils.ts +71 -0
- package/src/renderers/desktop/window-controller.ts +433 -0
- package/src/renderers/desktop/window-host.ts +70 -0
- package/src/renderers/desktop/window-layouts.ts +630 -0
- package/src/renderers/dom/data-frames.ts +15 -4
- package/src/renderers/dom/host/box.tsx +204 -176
- package/src/renderers/dom/host/style.ts +49 -20
- package/src/renderers/dom/host/text.tsx +3 -2
- package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
- package/src/renderers/electrobun/bun/desktop/backend.ts +322 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +29 -15
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
- package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
- package/src/renderers/electrobun/bun/index.ts +4 -97
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
- package/src/renderers/electrobun/shared/protocol.ts +50 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +15 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/renderers/electrobun/view/ui-host.tsx +7 -0
- package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/index.ts +7 -1
- package/src/state/app/context/index.tsx +16 -2
- package/src/state/desktop-windows.ts +63 -0
- package/src/sync/other-window-tabs.ts +62 -0
- package/src/tickers/company-name-listing.ts +23 -3
- package/src/tickers/listing-fate.ts +147 -1
- package/src/tickers/terminal-codes.ts +5 -0
- package/src/time-series/price-units.ts +11 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +4 -0
- package/src/types/headless.ts +19 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/host.tsx +2 -0
- package/src/ui/index.tsx +14 -13
- package/src/ui/same-props.ts +58 -0
- package/src/utils/cli-output.ts +33 -4
- package/src/utils/currency-names.ts +20 -0
- package/src/utils/currency-pair.ts +6 -0
- package/src/utils/exchange-rate-snapshot.ts +20 -2
- package/src/utils/format.ts +7 -2
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/fx-market-hours.ts +43 -0
- package/src/utils/http-proxy-upstream.ts +6 -2
- package/src/utils/plugin-proxy-hosts.json +0 -4
- package/src/utils/plugin-proxy-hosts.ts +22 -0
- package/src/utils/sec-filings.ts +7 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { AppSessionSnapshot } from "../../../core/state/session-persistence";
|
|
2
2
|
import type { PaneRuntimeState } from "../../../core/state/app/state";
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
DesktopDockPreviewState,
|
|
5
|
+
DesktopSharedStateSnapshot,
|
|
6
|
+
DesktopThemePreviewState,
|
|
7
|
+
DesktopWindowInfo,
|
|
8
|
+
OtherWindowTab,
|
|
9
|
+
} from "../../../types/desktop-window";
|
|
4
10
|
import type { DesktopApplicationMenuCommand } from "../../../types/desktop-menu";
|
|
5
11
|
import type { AppConfig, UpdateChannel } from "../../../types/config";
|
|
6
12
|
import type { CachedResourceRecord, ResourceCacheKey } from "../../../data/resource-store";
|
|
@@ -29,6 +35,12 @@ export interface ElectrobunBackendInit {
|
|
|
29
35
|
hostName?: string;
|
|
30
36
|
windowKind: "main" | "detached";
|
|
31
37
|
paneId?: string;
|
|
38
|
+
/** A full window's id: `main`, or an extra window's. Absent for a popped-out pane's window. */
|
|
39
|
+
windowId?: string;
|
|
40
|
+
/** Every full window, for moving a tab or pane between them. */
|
|
41
|
+
windows?: DesktopWindowInfo[];
|
|
42
|
+
/** The main window's: the tabs the other windows hold, for cloud sync. */
|
|
43
|
+
otherWindowTabs?: OtherWindowTab[];
|
|
32
44
|
/** What the launch's plugin seed could not install, for the main window to say once. */
|
|
33
45
|
pluginSeedNotice?: { body: string; type: "error" | "info" };
|
|
34
46
|
/** What the view needs to send crash reports and usage counts the same way the Bun process would. */
|
|
@@ -60,6 +72,9 @@ export interface DesktopRestartMessage {
|
|
|
60
72
|
|
|
61
73
|
export type DesktopWindowControlAction = "minimize" | "toggle-maximize" | "close";
|
|
62
74
|
|
|
75
|
+
/** The window edges the page pulls itself: the frame's own stop under its top. */
|
|
76
|
+
export type DesktopWindowResizeEdge = "top" | "top-left" | "top-right";
|
|
77
|
+
|
|
63
78
|
export type DesktopContextMenuItem =
|
|
64
79
|
| { type: "divider" }
|
|
65
80
|
| {
|
|
@@ -180,7 +195,8 @@ interface DesktopBackendRequestMap {
|
|
|
180
195
|
"capability.cancel": { request: { invocationId: string }; response: null };
|
|
181
196
|
"capability.subscribe": { request: DesktopCapabilitySubscribeRequest; response: null };
|
|
182
197
|
"capability.unsubscribe": { request: { subscriptionId: string }; response: null };
|
|
183
|
-
|
|
198
|
+
/** A full window's whole state. `baseSeq` names the last state it took from here; null, its own last sync. */
|
|
199
|
+
"desktop.syncMainState": { request: { snapshot: DesktopSharedStateSnapshot; baseSeq?: number | null }; response: null };
|
|
184
200
|
"desktop.setThemePreview": { request: { preview: DesktopThemePreviewState }; response: null };
|
|
185
201
|
"desktop.replaceDetachedPaneState": {
|
|
186
202
|
request: { paneId: string; paneState: PaneRuntimeState };
|
|
@@ -193,6 +209,13 @@ interface DesktopBackendRequestMap {
|
|
|
193
209
|
};
|
|
194
210
|
"desktop.closeDetachedPane": { request: { paneId: string }; response: null };
|
|
195
211
|
"desktop.focusDetachedPane": { request: { paneId: string }; response: null };
|
|
212
|
+
"desktop.openWindow": { request: null; response: null };
|
|
213
|
+
/** `windowId` null moves it to a new window. False when it cannot go. */
|
|
214
|
+
"desktop.moveLayoutToWindow": { request: { layoutId: string; windowId: string | null }; response: boolean };
|
|
215
|
+
"desktop.movePaneToWindow": { request: { paneId: string; windowId: string | null }; response: boolean };
|
|
216
|
+
"desktop.focusWindow": { request: { windowId: string }; response: null };
|
|
217
|
+
/** Brings forward the full window that shows a pane, on its tab, with the pane focused. False when no window has it. */
|
|
218
|
+
"desktop.focusPane": { request: { paneId: string }; response: boolean };
|
|
196
219
|
"pluginState.setMany": { request: { entries: DesktopPluginStateSetEntry[] }; response: null };
|
|
197
220
|
"pluginState.delete": { request: { pluginId: string; key: string }; response: null };
|
|
198
221
|
"plugins.listExternal": { request: null; response: DesktopExternalPluginBundle[] };
|
|
@@ -212,8 +235,11 @@ interface DesktopBackendRequestMap {
|
|
|
212
235
|
"host.exit": { request: null; response: null };
|
|
213
236
|
"host.windowControl": { request: { action: DesktopWindowControlAction }; response: null };
|
|
214
237
|
"host.windowFullscreen": { request: null; response: boolean };
|
|
238
|
+
"host.windowMaximized": { request: null; response: boolean };
|
|
215
239
|
/** Windows: moves the window with the pointer through the system's own move loop. */
|
|
216
240
|
"host.startWindowDrag": { request: null; response: null };
|
|
241
|
+
/** Windows: resizes the window from its top edge through the system's own size loop. */
|
|
242
|
+
"host.startWindowResize": { request: { edge: DesktopWindowResizeEdge }; response: null };
|
|
217
243
|
"host.openExternal": { request: { url: string }; response: boolean };
|
|
218
244
|
"host.copyText": { request: { text: string }; response: null };
|
|
219
245
|
"host.focusWindow": { request: null; response: null };
|
|
@@ -328,6 +354,24 @@ export interface DesktopDeepLinkMessage {
|
|
|
328
354
|
url: string;
|
|
329
355
|
}
|
|
330
356
|
|
|
357
|
+
interface DesktopWindowsMessage {
|
|
358
|
+
windows: DesktopWindowInfo[];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface DesktopOtherWindowTabsMessage {
|
|
362
|
+
/** `OtherWindowTab[]`, encoded as the shared state is. */
|
|
363
|
+
tabs: unknown;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
interface DesktopFocusPaneMessage {
|
|
367
|
+
paneId: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/** The window was minimized or brought back; a page cannot always tell by itself. */
|
|
371
|
+
interface DesktopWindowVisibilityMessage {
|
|
372
|
+
visible: boolean;
|
|
373
|
+
}
|
|
374
|
+
|
|
331
375
|
/** Plugin folders the Bun process updated in the background, for the main window to bring into its session. */
|
|
332
376
|
interface PluginsUpdatedMessage {
|
|
333
377
|
directories: string[];
|
|
@@ -365,6 +409,10 @@ export interface ElectrobunDesktopRpcSchema {
|
|
|
365
409
|
"desktop.dockPreview": DesktopDockPreviewMessage;
|
|
366
410
|
"desktop.themePreview": DesktopThemePreviewMessage;
|
|
367
411
|
"desktop.deepLink": DesktopDeepLinkMessage;
|
|
412
|
+
"desktop.windows": DesktopWindowsMessage;
|
|
413
|
+
"desktop.otherWindowTabs": DesktopOtherWindowTabsMessage;
|
|
414
|
+
"desktop.focusPane": DesktopFocusPaneMessage;
|
|
415
|
+
"desktop.windowVisibility": DesktopWindowVisibilityMessage;
|
|
368
416
|
"plugins.updated": PluginsUpdatedMessage;
|
|
369
417
|
"update.progress": UpdateProgressMessage;
|
|
370
418
|
"capability.event": CapabilityEventMessage;
|
|
@@ -85,6 +85,21 @@ const rpc = Electroview.defineRPC<ElectrobunDesktopRpcSchema>({
|
|
|
85
85
|
"desktop.themePreview": (message) => {
|
|
86
86
|
emit("desktop.themePreview", { preview: decodeRpcValue<DesktopThemePreviewMessage["preview"]>(message.preview) });
|
|
87
87
|
},
|
|
88
|
+
"desktop.windows": (message) => {
|
|
89
|
+
if (!Array.isArray(message?.windows)) return;
|
|
90
|
+
emit("desktop.windows", { windows: message.windows });
|
|
91
|
+
},
|
|
92
|
+
"desktop.otherWindowTabs": (message) => {
|
|
93
|
+
const tabs = decodeRpcValue<unknown>(message?.tabs);
|
|
94
|
+
if (Array.isArray(tabs)) emit("desktop.otherWindowTabs", { tabs });
|
|
95
|
+
},
|
|
96
|
+
"desktop.focusPane": (message) => {
|
|
97
|
+
if (typeof message?.paneId !== "string" || !message.paneId) return;
|
|
98
|
+
emit("desktop.focusPane", { paneId: message.paneId });
|
|
99
|
+
},
|
|
100
|
+
"desktop.windowVisibility": (message) => {
|
|
101
|
+
emit("desktop.windowVisibility", { visible: message?.visible !== false });
|
|
102
|
+
},
|
|
88
103
|
"update.progress": (message) => {
|
|
89
104
|
emit("update.progress", { progress: decodeRpcValue(message.progress) });
|
|
90
105
|
},
|
|
@@ -4,24 +4,84 @@ import type {
|
|
|
4
4
|
DesktopSharedStateSnapshot,
|
|
5
5
|
DesktopThemePreviewState,
|
|
6
6
|
DesktopWindowBridge,
|
|
7
|
+
DesktopWindowInfo,
|
|
8
|
+
DesktopWindowsBridge,
|
|
9
|
+
DesktopWindowTarget,
|
|
10
|
+
OtherWindowTab,
|
|
7
11
|
} from "../../../../../types/desktop-window";
|
|
8
12
|
import { backendRequest, getElectrobunBackendInitSnapshot, onBackendMessage } from "../../backend-rpc";
|
|
9
13
|
import { createDetachedSnapshotFilter } from "./snapshot";
|
|
10
14
|
|
|
15
|
+
const MAIN_WINDOW_ID = "main";
|
|
16
|
+
|
|
17
|
+
function targetWindowId(target: DesktopWindowTarget): string | null {
|
|
18
|
+
return "windowId" in target ? target.windowId : null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The full windows as the backend lists them, and for the main window the
|
|
23
|
+
* tabs the others hold, kept current by its `desktop.windows` and
|
|
24
|
+
* `desktop.otherWindowTabs` messages.
|
|
25
|
+
*/
|
|
26
|
+
function createDesktopWindowsBridge(
|
|
27
|
+
windowId: string,
|
|
28
|
+
initial: DesktopWindowInfo[],
|
|
29
|
+
initialTabs: readonly OtherWindowTab[],
|
|
30
|
+
): DesktopWindowsBridge {
|
|
31
|
+
let windows = initial;
|
|
32
|
+
let otherTabs = initialTabs;
|
|
33
|
+
const listeners = new Set<() => void>();
|
|
34
|
+
const changed = () => {
|
|
35
|
+
for (const listener of listeners) listener();
|
|
36
|
+
};
|
|
37
|
+
onBackendMessage("desktop.windows", (message) => {
|
|
38
|
+
windows = message.windows;
|
|
39
|
+
changed();
|
|
40
|
+
});
|
|
41
|
+
onBackendMessage("desktop.otherWindowTabs", (message) => {
|
|
42
|
+
otherTabs = message.tabs as OtherWindowTab[];
|
|
43
|
+
changed();
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
windowId,
|
|
47
|
+
list: () => windows,
|
|
48
|
+
subscribe(listener) {
|
|
49
|
+
listeners.add(listener);
|
|
50
|
+
return () => listeners.delete(listener);
|
|
51
|
+
},
|
|
52
|
+
async openWindow() {
|
|
53
|
+
await backendRequest("desktop.openWindow", null);
|
|
54
|
+
},
|
|
55
|
+
moveLayout: (layoutId, target) => backendRequest("desktop.moveLayoutToWindow", { layoutId, windowId: targetWindowId(target) }),
|
|
56
|
+
movePane: (paneId, target) => backendRequest("desktop.movePaneToWindow", { paneId, windowId: targetWindowId(target) }),
|
|
57
|
+
async focusWindow(targetId) {
|
|
58
|
+
await backendRequest("desktop.focusWindow", { windowId: targetId });
|
|
59
|
+
},
|
|
60
|
+
focusPane: (paneId) => backendRequest("desktop.focusPane", { paneId }),
|
|
61
|
+
subscribeFocusRequests: (listener) => onBackendMessage("desktop.focusPane", (message) => listener(message.paneId)),
|
|
62
|
+
otherWindowTabs: () => otherTabs,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
11
66
|
export function createDesktopWindowBridge(kind: "main" | "detached", paneId?: string): DesktopWindowBridge {
|
|
12
|
-
const
|
|
67
|
+
const init = getElectrobunBackendInitSnapshot();
|
|
68
|
+
const initialDesktopSnapshot = init?.desktopSnapshot ?? null;
|
|
13
69
|
const takeDetachedSnapshot = kind === "detached" && paneId
|
|
14
70
|
? createDetachedSnapshotFilter(paneId, initialDesktopSnapshot)
|
|
15
71
|
: null;
|
|
72
|
+
const windowId = kind === "main" ? init?.windowId ?? MAIN_WINDOW_ID : null;
|
|
16
73
|
|
|
17
74
|
return {
|
|
18
75
|
kind,
|
|
19
76
|
paneId,
|
|
77
|
+
primary: windowId === MAIN_WINDOW_ID,
|
|
78
|
+
windows: windowId ? createDesktopWindowsBridge(windowId, init?.windows ?? [], init?.otherWindowTabs ?? []) : undefined,
|
|
20
79
|
syncMainState: kind === "main"
|
|
21
|
-
? async (snapshot: DesktopSharedStateSnapshot) => {
|
|
22
|
-
await backendRequest("desktop.syncMainState", { snapshot });
|
|
80
|
+
? async (snapshot: DesktopSharedStateSnapshot, baseSeq?: number | null) => {
|
|
81
|
+
await backendRequest("desktop.syncMainState", { snapshot, baseSeq });
|
|
23
82
|
}
|
|
24
83
|
: undefined,
|
|
84
|
+
// The theme preview reaches every window from the one with Settings open.
|
|
25
85
|
syncThemePreview: kind === "main"
|
|
26
86
|
? async (preview: DesktopThemePreviewState) => {
|
|
27
87
|
await backendRequest("desktop.setThemePreview", { preview });
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
observeDesktopDeepLinks,
|
|
39
39
|
} from "../../../api-client/research-activity";
|
|
40
40
|
import { createDesktopWindowBridge } from "./desktop/window/bridge";
|
|
41
|
+
import { setDesktopWindows } from "../../../state/desktop-windows";
|
|
41
42
|
import type { DesktopApplicationMenuBridge } from "../../../types/desktop-menu";
|
|
42
43
|
import { prepareDetachedSnapshot } from "./desktop/window/snapshot";
|
|
43
44
|
import { createElectrobunAppServices } from "./app-services";
|
|
@@ -144,6 +145,9 @@ async function boot() {
|
|
|
144
145
|
backendRequest("capability.invoke", { capabilityId: NOTES_FILES_CAPABILITY_ID, operationId, payload })
|
|
145
146
|
)));
|
|
146
147
|
const init = await measurePerfAsync("startup.electrobun.backend-init", () => backendInitPromise);
|
|
148
|
+
// The main window does the app-wide work (account sync, the Dock badge,
|
|
149
|
+
// remote control, the boot frame); every other window draws its tabs.
|
|
150
|
+
const primaryWindow = init.windowKind === "main" && (init.windowId ?? "main") === "main";
|
|
147
151
|
// The environment's opt-out comes from the Bun process; the config
|
|
148
152
|
// switches are read live, so the command bar toggles apply at once.
|
|
149
153
|
installCrashReporter({
|
|
@@ -163,16 +167,16 @@ async function boot() {
|
|
|
163
167
|
installAttentionCounter({
|
|
164
168
|
allowed: () => !init.telemetry.optedOut && !browserDoNotTrack(),
|
|
165
169
|
launchConfig: () => init.config,
|
|
166
|
-
//
|
|
167
|
-
...(
|
|
170
|
+
// Only the main window syncs, and sends the other windows the settings it pulled.
|
|
171
|
+
...(!primaryWindow ? { accountSettingsPulled: () => true } : {}),
|
|
168
172
|
});
|
|
169
173
|
// Desktop has no Debug Log: this window's freezes go to the Bun process, which keeps the stall log.
|
|
170
174
|
setStallSink(forwardAttendedStalls(sendElectrobunStall).sink);
|
|
171
175
|
installElectrobunCapabilityStreamClient();
|
|
172
176
|
installFocusScopeRelease();
|
|
173
177
|
installElectrobunWindowFullscreenTracking();
|
|
174
|
-
if (
|
|
175
|
-
installDomMarketDataFrames();
|
|
178
|
+
if (primaryWindow) installElectrobunAppBadgeHost();
|
|
179
|
+
installDomMarketDataFrames((listener) => onBackendMessage("desktop.windowVisibility", ({ visible }) => listener(visible)));
|
|
176
180
|
installScreenshotWatermark();
|
|
177
181
|
const desktopSnapshot = init.windowKind === "detached" && init.paneId && init.desktopSnapshot
|
|
178
182
|
? prepareDetachedSnapshot(init.desktopSnapshot, init.paneId)
|
|
@@ -182,6 +186,8 @@ async function boot() {
|
|
|
182
186
|
// Said by the app once it is up, as the terminal says it.
|
|
183
187
|
setPluginSeedNotice(init.pluginSeedNotice ?? null);
|
|
184
188
|
const desktopWindowBridge = createDesktopWindowBridge(init.windowKind, init.paneId);
|
|
189
|
+
// Menus and the command bar offer the other windows from here.
|
|
190
|
+
setDesktopWindows(desktopWindowBridge.windows ?? null);
|
|
185
191
|
const desktopApplicationMenuBridge: DesktopApplicationMenuBridge = {
|
|
186
192
|
subscribe: (listener) => onBackendMessage("application-menu.select", ({ command }) => listener(command)),
|
|
187
193
|
};
|
|
@@ -190,7 +196,7 @@ async function boot() {
|
|
|
190
196
|
// id is made at the first push, and a gloom.sh link can bring a visitor id.
|
|
191
197
|
const viewStorage = viewIdStorage();
|
|
192
198
|
if (viewStorage) restoreViewIds(viewStorage, init.viewIds);
|
|
193
|
-
const mirrorViewIds = viewStorage &&
|
|
199
|
+
const mirrorViewIds = viewStorage && primaryWindow
|
|
194
200
|
? createViewIdMirror(viewStorage, init.viewIds, (ids) => backendRequest("host.saveViewIds", { ids }))
|
|
195
201
|
: () => {};
|
|
196
202
|
mirrorViewIds();
|
|
@@ -257,7 +263,7 @@ async function boot() {
|
|
|
257
263
|
if (marketplace) void activateUpdatedPlugins(directories, marketplace, pluginManager);
|
|
258
264
|
});
|
|
259
265
|
|
|
260
|
-
const remoteControlAdapter =
|
|
266
|
+
const remoteControlAdapter = primaryWindow
|
|
261
267
|
? {
|
|
262
268
|
registerHandler: setElectrobunRemoteRequestHandler,
|
|
263
269
|
terminalDevice: { kind: "desktop" as const, name: init.hostName?.trim() || "Gloom desktop" },
|
|
@@ -292,7 +298,7 @@ async function boot() {
|
|
|
292
298
|
});
|
|
293
299
|
// A layout with neither panes nor a status bar has nothing to wait for.
|
|
294
300
|
window.setTimeout(releaseBootFrame, BOOT_FRAME_RELEASE_FALLBACK_MS);
|
|
295
|
-
if (
|
|
301
|
+
if (primaryWindow) {
|
|
296
302
|
startBootFrameRecorder({
|
|
297
303
|
doc: document,
|
|
298
304
|
root: appRootElement,
|
|
@@ -47,6 +47,13 @@ export const webRendererHost: RendererHost = {
|
|
|
47
47
|
if (action === "close") await flushUsageCounts({ timeoutMs: 1_000 });
|
|
48
48
|
await backendRequest("host.windowControl", { action });
|
|
49
49
|
},
|
|
50
|
+
startWindowResize(edge) {
|
|
51
|
+
// Windows resizes the window itself, as it does from a native frame's edge.
|
|
52
|
+
if (detectPlatform() !== "win32") return;
|
|
53
|
+
void backendRequest("host.startWindowResize", { edge }).catch((error: unknown) => {
|
|
54
|
+
console.error("[desktop] could not start resizing the window", error instanceof Error ? error.message : String(error));
|
|
55
|
+
});
|
|
56
|
+
},
|
|
50
57
|
async openExternal(url) {
|
|
51
58
|
return await backendRequest("host.openExternal", { url });
|
|
52
59
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { setWindowFullscreen } from "../../../components/layout/window-fullscreen";
|
|
1
|
+
import { setWindowFullscreen, setWindowMaximized } from "../../../components/layout/window-fullscreen";
|
|
2
|
+
import { detectPlatform } from "../../../utils/platform";
|
|
2
3
|
import { backendRequest } from "./backend-rpc";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -12,7 +13,8 @@ const RESIZE_SETTLE_MS = 120;
|
|
|
12
13
|
* Keeps the view's idea of its window's fullscreen state current. Electrobun
|
|
13
14
|
* emits no fullscreen event and a webview cannot see its window's style mask,
|
|
14
15
|
* but entering and leaving fullscreen always resizes the window, so the host
|
|
15
|
-
* is asked every time the size settles.
|
|
16
|
+
* is asked every time the size settles. On Windows, so is maximizing, which
|
|
17
|
+
* takes away the window's top edge.
|
|
16
18
|
*/
|
|
17
19
|
export function installElectrobunWindowFullscreenTracking(): () => void {
|
|
18
20
|
let settleTimer: ReturnType<typeof setTimeout> | null = null;
|
|
@@ -26,7 +28,12 @@ export function installElectrobunWindowFullscreenTracking(): () => void {
|
|
|
26
28
|
}
|
|
27
29
|
reading = true;
|
|
28
30
|
try {
|
|
29
|
-
|
|
31
|
+
const [fullscreen, maximized] = await Promise.all([
|
|
32
|
+
backendRequest("host.windowFullscreen"),
|
|
33
|
+
detectPlatform() === "win32" ? backendRequest("host.windowMaximized") : false,
|
|
34
|
+
]);
|
|
35
|
+
setWindowFullscreen(fullscreen === true);
|
|
36
|
+
setWindowMaximized(maximized === true);
|
|
30
37
|
} catch {
|
|
31
38
|
// A host too old to answer has the window chrome the header already
|
|
32
39
|
// assumes, so leaving the last known state alone is the safe read.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isKnownExchangeCode } from "../utils/exchanges";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The FRED series a typed `FRED:<id>` names (`FRED:T10Y2Y` is T10Y2Y), as the
|
|
5
|
+
* catalog and `fn G` write a series: never the symbol FRED on a venue called
|
|
6
|
+
* T10Y2Y. A venue the app knows (`FRED:TSXV`) is that listing, so null, as is
|
|
7
|
+
* any other text.
|
|
8
|
+
*/
|
|
9
|
+
export function fredSeriesArgument(text: string): string | null {
|
|
10
|
+
const id = /^FRED:([A-Z0-9_]+)$/i.exec(text.trim())?.[1]?.toUpperCase();
|
|
11
|
+
return id && !isKnownExchangeCode(id) ? id : null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** What a command that reads listings says to `FRED:T10Y2Y`: it is a series, and where series are read. */
|
|
15
|
+
export function fredSeriesNotListing(id: string): { message: string; details: string } {
|
|
16
|
+
return { message: `FRED:${id} is a FRED series, not a listing.`, details: `Chart it with gloom fn G FRED:${id}, or read it with gloom fred ${id}.` };
|
|
17
|
+
}
|
|
@@ -110,12 +110,18 @@ export class ProviderRouterFinancialRoutes {
|
|
|
110
110
|
exchange?: string,
|
|
111
111
|
context?: MarketDataRequestContext,
|
|
112
112
|
): Promise<TickerFinancials> {
|
|
113
|
+
// An index files no statements, so its financials come back without a
|
|
114
|
+
// quote: the quote is asked beside them, not a round trip after.
|
|
115
|
+
const indexQuote = ticker.startsWith("^") ? this.getQuote(ticker, exchange, context) : null;
|
|
116
|
+
indexQuote?.catch(() => {
|
|
117
|
+
// Intentional ignore: the quote is awaited below when the financials lack one, and its failure handled there.
|
|
118
|
+
});
|
|
113
119
|
const financials = await this.loadTickerFinancials(ticker, exchange, context);
|
|
114
120
|
if (financials.quote) return financials;
|
|
115
121
|
// Statement depth does not establish quote freshness. Use the same quote
|
|
116
122
|
// fallback route as QQ, including its cache and broker/listing context.
|
|
117
123
|
try {
|
|
118
|
-
const quote = await this.getQuote(ticker, exchange, context);
|
|
124
|
+
const quote = await (indexQuote ?? this.getQuote(ticker, exchange, context));
|
|
119
125
|
return resolveTickerFinancialsQuoteState(financials, quote) ?? financials;
|
|
120
126
|
} catch {
|
|
121
127
|
// Delisted or temporarily unquoted issuers can still have valid accounts.
|
|
@@ -33,6 +33,7 @@ import type { TimeRange } from "../../time-series/range";
|
|
|
33
33
|
import type { ChartResolutionSupport, ManualChartResolution } from "../../time-series/resolution";
|
|
34
34
|
import { debugLog } from "../../utils/debug-log";
|
|
35
35
|
import { errorMessage } from "../../utils/errors";
|
|
36
|
+
import { isPastPreCloseRefetch } from "../../utils/exchange-rate-snapshot";
|
|
36
37
|
import { ProviderRouterBatchRoutes } from "./batches";
|
|
37
38
|
import { createSignedInRealtimeCloudAccess, type RealtimeCloudAccess } from "./realtime-access";
|
|
38
39
|
import { mapListingTargets, publicListingExchange } from "../listing-target";
|
|
@@ -362,7 +363,12 @@ export class AssetDataRouter implements DataProvider {
|
|
|
362
363
|
}
|
|
363
364
|
|
|
364
365
|
async getExchangeRate(fromCurrency: string, context?: Pick<MarketDataRequestContext, "cacheMode">): Promise<number> {
|
|
365
|
-
|
|
366
|
+
const query = this.getCachedQuery("getExchangeRate", [fromCurrency]);
|
|
367
|
+
// A rate read before the FX week closed is no close: once the close is out, wait for it instead of showing
|
|
368
|
+
// the old rate while it is read again, which the caller would then hold as read now.
|
|
369
|
+
const cached = query.getSnapshot().result;
|
|
370
|
+
const background = this.revalidateInBackground && !(cached && isPastPreCloseRefetch(cached));
|
|
371
|
+
return (await query.load({ force: context?.cacheMode === "refresh", background })).value;
|
|
366
372
|
}
|
|
367
373
|
|
|
368
374
|
async search(query: string, context?: SearchRequestContext): Promise<InstrumentSearchResult[]> {
|
|
@@ -52,6 +52,7 @@ export {
|
|
|
52
52
|
getEffectiveThemeId,
|
|
53
53
|
getFocusedCollectionId,
|
|
54
54
|
getFocusedTickerSymbol,
|
|
55
|
+
linkedSourceIds,
|
|
55
56
|
resolveCollectionForPane,
|
|
56
57
|
syncConfigActiveLayoutState,
|
|
57
58
|
resolveTickerForPane,
|
|
@@ -464,6 +465,9 @@ export function AppProvider({
|
|
|
464
465
|
const storeRef = useRef<AppContextStoreValue | null>(null);
|
|
465
466
|
const lastMainSyncRef = useRef<string | null>(null);
|
|
466
467
|
const latestMainStateRevisionRef = useRef(desktopSnapshot?.mainStateRevision ?? 0);
|
|
468
|
+
// The last state this window took from the desktop process. Its syncs name
|
|
469
|
+
// it, so what another window changed since is not undone by this one.
|
|
470
|
+
const lastTakenStateSeqRef = useRef<number | null>(desktopSnapshot?.stateSeq ?? null);
|
|
467
471
|
const lastDetachedPaneSyncRef = useRef<string | null>(null);
|
|
468
472
|
const lastThemePreviewSyncRef = useRef<string | null | undefined>(undefined);
|
|
469
473
|
|
|
@@ -490,12 +494,15 @@ export function AppProvider({
|
|
|
490
494
|
rawDispatch(dispatchedAction);
|
|
491
495
|
}, [desktopBridge, rawDispatch]);
|
|
492
496
|
|
|
497
|
+
// The linked tickers go back as they came, so the desktop process knows
|
|
498
|
+
// this window holds them; it never reads them from a window.
|
|
493
499
|
const buildDesktopSnapshot = useCallback((currentState: AppState): DesktopSharedStateSnapshot => ({
|
|
494
500
|
config: currentState.config,
|
|
495
501
|
paneState: currentState.paneState,
|
|
496
502
|
focusedPaneId: currentState.focusedPaneId,
|
|
497
503
|
statusBarVisible: currentState.statusBarVisible,
|
|
498
504
|
brokerSyncErrors: currentState.brokerSyncErrors,
|
|
505
|
+
...(currentState.linkedTickers ? { linkedTickers: currentState.linkedTickers } : {}),
|
|
499
506
|
}), []);
|
|
500
507
|
|
|
501
508
|
const serializeDesktopSnapshot = useCallback((snapshot: DesktopSharedStateSnapshot): string => JSON.stringify({
|
|
@@ -504,6 +511,7 @@ export function AppProvider({
|
|
|
504
511
|
focusedPaneId: snapshot.focusedPaneId,
|
|
505
512
|
statusBarVisible: snapshot.statusBarVisible,
|
|
506
513
|
brokerSyncErrors: snapshot.brokerSyncErrors ?? {},
|
|
514
|
+
linkedTickers: snapshot.linkedTickers ?? {},
|
|
507
515
|
}), []);
|
|
508
516
|
|
|
509
517
|
const serializePaneState = useCallback((paneState: PaneRuntimeState | undefined): string => JSON.stringify(paneState ?? {}), []);
|
|
@@ -559,6 +567,7 @@ export function AppProvider({
|
|
|
559
567
|
snapshot.mainStateRevision,
|
|
560
568
|
);
|
|
561
569
|
}
|
|
570
|
+
if (typeof snapshot.stateSeq === "number") lastTakenStateSeqRef.current = snapshot.stateSeq;
|
|
562
571
|
const currentSignature = serializeDesktopSnapshot(buildDesktopSnapshot(stateRef.current));
|
|
563
572
|
const nextSignature = serializeDesktopSnapshot(snapshot);
|
|
564
573
|
if (currentSignature === nextSignature) return;
|
|
@@ -582,7 +591,10 @@ export function AppProvider({
|
|
|
582
591
|
// a newer one has replaced it, so the next effect run sends it again. The
|
|
583
592
|
// two syncs below dedupe the same way.
|
|
584
593
|
fireAndForget(
|
|
585
|
-
desktopBridge.syncMainState(
|
|
594
|
+
desktopBridge.syncMainState(
|
|
595
|
+
{ ...snapshot, mainStateRevision: latestMainStateRevisionRef.current },
|
|
596
|
+
lastTakenStateSeqRef.current,
|
|
597
|
+
),
|
|
586
598
|
"desktop.syncMainState",
|
|
587
599
|
() => {
|
|
588
600
|
if (lastMainSyncRef.current === signature) lastMainSyncRef.current = null;
|
|
@@ -609,9 +621,11 @@ export function AppProvider({
|
|
|
609
621
|
});
|
|
610
622
|
}, [desktopBridge, state.themePreview]);
|
|
611
623
|
|
|
624
|
+
// Every window previews the theme Settings is trying out in another one.
|
|
612
625
|
useEffect(() => {
|
|
613
|
-
if (desktopBridge?.
|
|
626
|
+
if (!desktopBridge?.subscribeThemePreview) return;
|
|
614
627
|
return desktopBridge.subscribeThemePreview((preview) => {
|
|
628
|
+
lastThemePreviewSyncRef.current = preview.theme;
|
|
615
629
|
dispatch({ type: "PREVIEW_THEME", theme: preview.theme });
|
|
616
630
|
});
|
|
617
631
|
}, [desktopBridge, dispatch]);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { t, tf } from "../i18n";
|
|
2
|
+
import type { DesktopWindowInfo, DesktopWindowsBridge, DesktopWindowTarget } from "../types/desktop-window";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The desktop app's full windows, as the window this runs in sees them: set
|
|
6
|
+
* once at startup by the desktop view, absent in the terminal, the browser
|
|
7
|
+
* and a popped-out pane's window. Menus and the command bar read it when
|
|
8
|
+
* they open.
|
|
9
|
+
*/
|
|
10
|
+
let desktopWindows: DesktopWindowsBridge | null = null;
|
|
11
|
+
|
|
12
|
+
export function setDesktopWindows(bridge: DesktopWindowsBridge | null): void {
|
|
13
|
+
desktopWindows = bridge;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getDesktopWindows(): DesktopWindowsBridge | null {
|
|
17
|
+
return desktopWindows;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function windowLabel(info: DesktopWindowInfo): string {
|
|
21
|
+
return info.number <= 1 ? t("Main Window") : tf("Window {number}", { number: String(info.number) });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A place a tab or pane of this window can go. Labels are ready to show. */
|
|
25
|
+
export interface WindowMoveTarget {
|
|
26
|
+
key: string;
|
|
27
|
+
label: string;
|
|
28
|
+
/** The tab the other window shows, to tell windows apart. */
|
|
29
|
+
detail?: string;
|
|
30
|
+
target: DesktopWindowTarget;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Each other window, then a new one; empty where there is only one window and nothing can go. */
|
|
34
|
+
export function windowMoveTargets(
|
|
35
|
+
bridge: DesktopWindowsBridge,
|
|
36
|
+
options: { newWindow?: boolean; prefix?: "pane" | "layout" } = {},
|
|
37
|
+
): WindowMoveTarget[] {
|
|
38
|
+
const layout = options.prefix === "layout";
|
|
39
|
+
const others = bridge.list().filter((info) => info.id !== bridge.windowId);
|
|
40
|
+
const targets: WindowMoveTarget[] = others.map((info) => ({
|
|
41
|
+
key: info.id,
|
|
42
|
+
label: tf(layout ? "Move Layout to {window}" : "Move to {window}", { window: windowLabel(info) }),
|
|
43
|
+
...(info.activeLayoutName ? { detail: info.activeLayoutName } : {}),
|
|
44
|
+
target: { windowId: info.id },
|
|
45
|
+
}));
|
|
46
|
+
if (options.newWindow !== false) {
|
|
47
|
+
targets.push({
|
|
48
|
+
key: "new",
|
|
49
|
+
label: layout ? "Move Layout to New Window" : "Move to New Window",
|
|
50
|
+
target: { newWindow: true },
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return targets;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Where one of this window's tabs can go: the main window keeps its last
|
|
58
|
+
* tab, and a window's only tab gains nothing from a new window of its own.
|
|
59
|
+
*/
|
|
60
|
+
export function layoutMoveTargets(bridge: DesktopWindowsBridge, tabCount: number): WindowMoveTarget[] {
|
|
61
|
+
if (tabCount <= 1 && bridge.windowId === "main") return [];
|
|
62
|
+
return windowMoveTargets(bridge, { prefix: "layout", newWindow: tabCount > 1 });
|
|
63
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AppState } from "../core/state/app/state";
|
|
2
|
+
import type { AppConfig } from "../types/config";
|
|
3
|
+
import type { OtherWindowTab } from "../types/desktop-window";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Cloud sync runs in the desktop app's main window, whose state holds only
|
|
7
|
+
* its own tabs while other windows are open. Sync sees every window's tabs:
|
|
8
|
+
* the main window's as it has them now, the others' at their places among
|
|
9
|
+
* them. Without this, a push would leave out the tabs in other windows, and
|
|
10
|
+
* other devices would take them as deleted.
|
|
11
|
+
*
|
|
12
|
+
* The same state, unchanged, with one window, in the terminal and the browser.
|
|
13
|
+
*/
|
|
14
|
+
export function withOtherWindowTabs(state: AppState, others: readonly OtherWindowTab[]): AppState {
|
|
15
|
+
if (others.length === 0) return state;
|
|
16
|
+
const own = state.config.layouts;
|
|
17
|
+
const layouts = [...own];
|
|
18
|
+
for (const { at, tab } of [...others].sort((a, b) => a.at - b.at)) {
|
|
19
|
+
// A pulled copy the main window holds for a moment, until the backend gives it back to its window.
|
|
20
|
+
if (tab.id && layouts.some((entry) => entry.id === tab.id)) continue;
|
|
21
|
+
layouts.splice(Math.min(at, layouts.length), 0, tab);
|
|
22
|
+
}
|
|
23
|
+
const active = own[state.config.activeLayoutIndex];
|
|
24
|
+
const activeLayoutIndex = active ? layouts.indexOf(active) : state.config.activeLayoutIndex;
|
|
25
|
+
return { ...state, config: { ...state.config, layouts, activeLayoutIndex: Math.max(0, activeLayoutIndex) } };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Whether a config sync applies changes a tab another window holds. The whole
|
|
30
|
+
* config is then saved at once: the backend keeps such a tab in its window
|
|
31
|
+
* and takes the change where the pull made it. A later save of the main
|
|
32
|
+
* window's own tabs would not carry it.
|
|
33
|
+
*/
|
|
34
|
+
export function changesOtherWindowTabs(config: AppConfig, others: readonly OtherWindowTab[]): boolean {
|
|
35
|
+
const pulled = new Map(config.layouts.flatMap((entry) => (entry.id ? [[entry.id, entry] as const] : [])));
|
|
36
|
+
return others.some(({ tab }) => {
|
|
37
|
+
const next = tab.id ? pulled.get(tab.id) : undefined;
|
|
38
|
+
return !!next && JSON.stringify(next) !== JSON.stringify(tab);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A config sync applies, as the main window keeps it: without the other
|
|
44
|
+
* windows' tabs, which reach their windows through the whole config saved
|
|
45
|
+
* (`changesOtherWindowTabs`). The main window stays on the tab it shows when
|
|
46
|
+
* that tab is still there.
|
|
47
|
+
*/
|
|
48
|
+
export function withoutOtherWindowTabs(config: AppConfig, others: readonly OtherWindowTab[], current: AppConfig): AppConfig {
|
|
49
|
+
const ids = new Set(others.flatMap(({ tab }) => (tab.id ? [tab.id] : [])));
|
|
50
|
+
if (ids.size === 0) return config;
|
|
51
|
+
const layouts = config.layouts.filter((entry) => !entry.id || !ids.has(entry.id));
|
|
52
|
+
if (layouts.length === config.layouts.length || layouts.length === 0) return config;
|
|
53
|
+
const shownId = current.layouts[current.activeLayoutIndex]?.id;
|
|
54
|
+
const active = config.layouts[config.activeLayoutIndex];
|
|
55
|
+
const byShown = shownId ? layouts.findIndex((entry) => entry.id === shownId) : -1;
|
|
56
|
+
const byActive = active ? layouts.indexOf(active) : -1;
|
|
57
|
+
const activeLayoutIndex = byActive >= 0 ? byActive : byShown >= 0 ? byShown : 0;
|
|
58
|
+
const shown = layouts[activeLayoutIndex]!;
|
|
59
|
+
// The live layout is the shown tab's: one of another window's tabs would draw here.
|
|
60
|
+
const layout = byActive >= 0 ? config.layout : shown.layout;
|
|
61
|
+
return { ...config, layouts, activeLayoutIndex, layout };
|
|
62
|
+
}
|
|
@@ -253,6 +253,20 @@ export async function marksAnotherListing(dataProvider: Partial<Pick<DataProvide
|
|
|
253
253
|
result.symbol.toUpperCase() !== word.trim().toUpperCase() && namedByService(word, result));
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
/**
|
|
257
|
+
* The listing of `symbol` the service marks with `word` (`^VIX` on CXI for
|
|
258
|
+
* "VIX"), as `marksAnotherListing` reads the same search; null when search
|
|
259
|
+
* marks no listing of it, cannot search or is too busy to say.
|
|
260
|
+
*/
|
|
261
|
+
export async function serviceMarkedListing(dataProvider: Partial<Pick<DataProvider, "search">>, word: string,
|
|
262
|
+
symbol: string): Promise<{ symbol: string; exchange: string; name: string } | null> {
|
|
263
|
+
if (typeof dataProvider.search !== "function") return null;
|
|
264
|
+
const answer = await searchListings(dataProvider as Pick<DataProvider, "search">, word.trim());
|
|
265
|
+
const marked = Array.isArray(answer) ? answer.find((result) => result.symbol.toUpperCase() === symbol.toUpperCase()
|
|
266
|
+
&& namedByService(word, result)) : undefined;
|
|
267
|
+
return marked ? { symbol: marked.symbol.toUpperCase(), exchange: listedExchange(marked), name: marked.name } : null;
|
|
268
|
+
}
|
|
269
|
+
|
|
256
270
|
function searchListings(dataProvider: Pick<DataProvider, "search">, query: string): Promise<InstrumentSearchResult[] | ProviderBusyError> {
|
|
257
271
|
return dataProvider.search(query, { limit: LISTING_SEARCH_LIMIT })
|
|
258
272
|
.catch((error: unknown): InstrumentSearchResult[] | ProviderBusyError => {
|
|
@@ -307,8 +321,10 @@ const shareClassSymbol = (symbol: string) => symbol.trim().toUpperCase().replace
|
|
|
307
321
|
* be too ("Putnam US Equity", "Global US Equity"), so one for the US, or typed
|
|
308
322
|
* in lower case, is one only when search lists its root there (JPM on a US
|
|
309
323
|
* exchange, VOD on LSE); otherwise it is the name it reads as, and is searched
|
|
310
|
-
* as one. One in capitals naming a venue abroad (`MC FP`)
|
|
311
|
-
*
|
|
324
|
+
* as one. One in capitals naming a venue abroad (`MC FP`), or the US with its
|
|
325
|
+
* yellow key as the terminal writes it (`SEAS US Equity`, never all in
|
|
326
|
+
* capitals), is one as typed: the venue's own check speaks
|
|
327
|
+
* when the symbol is not there. A code that can name
|
|
312
328
|
* several listings (`VOLVB SS` is VOLVB or VOLV.B in Stockholm, `RY CN`
|
|
313
329
|
* Toronto or the Venture exchange) is the first of them search lists. A
|
|
314
330
|
* search that fails says nothing either way, and the code stands. Null for
|
|
@@ -321,7 +337,11 @@ export async function readTerminalCodeArg(
|
|
|
321
337
|
const code = readTerminalListingCode(typed);
|
|
322
338
|
if (!code?.market) return code;
|
|
323
339
|
const us = !code.exchange || isUsListingExchange(code.exchange);
|
|
324
|
-
|
|
340
|
+
// Its root in capitals and its yellow key typed as the terminal shows it (`SEAS US Equity`), a US code is one as
|
|
341
|
+
// typed, as a code abroad is: a line that stopped trading is one search no longer lists, and it is still that
|
|
342
|
+
// symbol, never a name. All in capitals (`PUTNAM US EQUITY`) it may be a fund's name, so search decides.
|
|
343
|
+
const keyed = /\s[Ee]quity$/.test(code.typed) && !/\p{Ll}/u.test(code.typed.split(" ")[0]!);
|
|
344
|
+
const verify = (us && !keyed) || /\p{Ll}/u.test(code.typed.split(" ")[0]!);
|
|
325
345
|
if (!verify && !code.alternatives) return code;
|
|
326
346
|
const listings: TerminalListing[] = [code, ...code.alternatives ?? []];
|
|
327
347
|
try {
|