gloomberb 0.19.5 → 0.20.0
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/LICENSE +0 -4
- package/package.json +6 -5
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/patches/electrobun-devkit@2.0.5.patch +148 -0
- package/src/api-client/bond-trades.ts +59 -0
- package/src/api-client/data.ts +21 -0
- package/src/api-client/equity-screener.ts +23 -0
- package/src/api-client/index.ts +2 -0
- package/src/api-client/types/account.ts +86 -0
- package/src/api-client/types/assist.ts +32 -0
- package/src/api-client/types/auth.ts +63 -0
- package/src/api-client/types/billing.ts +54 -0
- package/src/api-client/types/chat.ts +180 -0
- package/src/api-client/types/congress.ts +107 -0
- package/src/api-client/types/credit.ts +110 -0
- package/src/api-client/types/econ.ts +158 -0
- package/src/api-client/types/equity-diagnostic.ts +73 -0
- package/src/api-client/types/filings-and-calls.ts +350 -0
- package/src/api-client/types/index.ts +25 -0
- package/src/api-client/types/jobs.ts +147 -0
- package/src/api-client/types/market.ts +122 -0
- package/src/api-client/types/news.ts +91 -0
- package/src/api-client/types/notes-and-theses.ts +172 -0
- package/src/api-client/types/quotes.ts +28 -0
- package/src/api-client/types/scanners.ts +125 -0
- package/src/api-client/types/screener.ts +65 -0
- package/src/api-client/types/search.ts +107 -0
- package/src/api-client/types/sync.ts +14 -0
- package/src/api-client/types/team-collections.ts +43 -0
- package/src/api-client/types/team-views.ts +32 -0
- package/src/api-client/types/teams.ts +135 -0
- package/src/api-client/types/ticker-data.ts +57 -0
- package/src/api-client/types/tweets.ts +59 -0
- package/src/api-client/types/world-venues.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/runtime/desktop-deeplink.ts +41 -6
- package/src/app/star-prompt/status-line.tsx +1 -1
- package/src/app.tsx +64 -23
- package/src/architecture/ui-tokens-allowlist.json +0 -8
- package/src/cli/commands/market.ts +149 -10
- package/src/cli/commands/search.ts +21 -3
- package/src/cli/commands/ticker.ts +90 -36
- package/src/cli/desktop-pane-shot-browser.ts +69 -3
- package/src/cli/glossary.ts +3 -3
- package/src/cli/known-gaps.ts +8 -0
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +25 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +4 -3
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- 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-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 +13 -5
- 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 +43 -14
- 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/data-table/export.ts +4 -1
- package/src/components/layout/detached-pane-shell.tsx +10 -37
- package/src/components/layout/double-escape-close.ts +90 -0
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +6 -3
- package/src/components/layout/pane/footer/index.tsx +2 -6
- package/src/components/layout/pane/footer/model.ts +6 -12
- package/src/components/layout/shell/active-drag.ts +53 -11
- package/src/components/layout/shell/drag/magnets.ts +128 -19
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +10 -2
- package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +24 -78
- package/src/components/layout/status-widget-space.ts +5 -5
- 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 +9 -6
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- 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/index.tsx +5 -1
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/data-table/render-cell.ts +19 -0
- package/src/components/ui/delayed-mark.tsx +59 -7
- package/src/components/ui/icon.tsx +1 -8
- package/src/components/ui/menu.tsx +6 -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 +13 -3
- package/src/i18n/ja.ts +13 -3
- package/src/i18n/ko.ts +13 -3
- package/src/i18n/zh-cn.ts +13 -3
- package/src/i18n/zh-tw.ts +13 -3
- 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/futures-contract.ts +14 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- 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/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -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/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chat/content/composer.tsx +21 -27
- package/src/plugins/builtin/chat/content/index.tsx +31 -3
- package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
- package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
- package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
- package/src/plugins/builtin/congress-trades/model.ts +2 -1
- package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/custom-view/index.tsx +1 -1
- package/src/plugins/builtin/custom-view/loader.ts +85 -8
- package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
- 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-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +28 -6
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
- package/src/plugins/builtin/equity-screener/headless.ts +37 -3
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +238 -27
- package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
- 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/executives/format.ts +5 -4
- package/src/plugins/builtin/executives/pane.tsx +1 -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/help/index.tsx +55 -1
- package/src/plugins/builtin/insider/model.ts +30 -2
- package/src/plugins/builtin/jobs/model.ts +2 -2
- 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-movers/index.tsx +4 -3
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/model.ts +2 -2
- package/src/plugins/builtin/notes/files.ts +2 -0
- package/src/plugins/builtin/notes/owner.tsx +20 -1
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
- package/src/plugins/builtin/notes/store.ts +6 -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 +2 -1
- package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +1 -1
- package/src/plugins/builtin/series-inventory.ts +1 -0
- package/src/plugins/builtin/shared/earnings-report.ts +7 -2
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
- package/src/plugins/builtin/short-interest/headless.ts +1 -1
- package/src/plugins/builtin/short-interest/model.ts +15 -6
- 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/types.ts +2 -0
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
- 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/detail.tsx +198 -0
- package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
- package/src/plugins/builtin/trace-bonds/history.ts +155 -0
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
- 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 +6 -1
- 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/plugins/installer.ts +16 -3
- package/src/plugins/plugin-names.ts +11 -2
- package/src/portfolio/collection-name.ts +19 -0
- package/src/remote/controller.ts +9 -2
- package/src/remote/schema.ts +2 -1
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +73 -3
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +44 -4
- 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/desktop/icons.tsx +0 -2
- package/src/renderers/dom/styles.css +0 -3
- 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 +320 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
- package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
- package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
- 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/update.ts +1 -1
- 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 +22 -109
- package/src/renderers/electrobun/bun/window/create.ts +23 -3
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/events.ts +4 -4
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/frame.ts +2 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/shared/protocol.ts +44 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/gloomberb-cloud/index.ts +5 -7
- package/src/sources/provider-router/batches.ts +18 -3
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/financials.ts +18 -4
- 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/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/data-provider.ts +14 -0
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +19 -3
- package/src/types/headless.ts +21 -0
- package/src/types/plugin.ts +6 -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/double-escape-close.ts +38 -16
- package/src/utils/format.ts +30 -5
- package/src/utils/futures-generic.ts +12 -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/price-earnings.ts +18 -0
- package/src/utils/sec-filings.ts +7 -1
- package/patches/electrobun@1.18.1.patch +0 -633
- package/src/api-client/types.ts +0 -2441
|
@@ -24,6 +24,8 @@ function loadObjc() {
|
|
|
24
24
|
const runtime = dlopen(LIBOBJC, {
|
|
25
25
|
objc_getClass: { args: [FFIType.ptr], returns: ID },
|
|
26
26
|
sel_registerName: { args: [FFIType.ptr], returns: FFIType.ptr },
|
|
27
|
+
objc_autoreleasePoolPush: { args: [], returns: FFIType.ptr },
|
|
28
|
+
objc_autoreleasePoolPop: { args: [FFIType.ptr], returns: FFIType.void },
|
|
27
29
|
}).symbols;
|
|
28
30
|
const msgSend = <const Args extends FFIType[], Returns extends FFIType>(args: Args, returns: Returns) =>
|
|
29
31
|
dlopen(LIBOBJC, { objc_msgSend: { args: [ID, FFIType.ptr, ...args], returns } }).symbols.objc_msgSend;
|
|
@@ -31,11 +33,23 @@ function loadObjc() {
|
|
|
31
33
|
return {
|
|
32
34
|
getClass: (name: string) => runtime.objc_getClass(cString(name)),
|
|
33
35
|
selector: (name: string) => runtime.sel_registerName(cString(name)),
|
|
36
|
+
/** Runs `run` in an autorelease pool of its own, for the objects class methods return: Bun's thread may have none. */
|
|
37
|
+
withAutoreleasePool: <T>(run: () => T): T => {
|
|
38
|
+
const pool = runtime.objc_autoreleasePoolPush();
|
|
39
|
+
try {
|
|
40
|
+
return run();
|
|
41
|
+
} finally {
|
|
42
|
+
runtime.objc_autoreleasePoolPop(pool);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
34
45
|
send: msgSend([], ID),
|
|
35
46
|
sendVoid: msgSend([], FFIType.void),
|
|
36
47
|
sendObject: msgSend([ID], ID),
|
|
37
48
|
sendCString: msgSend([FFIType.ptr], ID),
|
|
38
49
|
sendBytes: msgSend([FFIType.ptr, FFIType.u64], ID),
|
|
50
|
+
/** A message taking an NSSize or NSPoint: two doubles, passed as two on arm64 and x86-64 alike. */
|
|
51
|
+
sendDoubles: msgSend([FFIType.f64, FFIType.f64], ID),
|
|
52
|
+
sendObjects: msgSend([ID, ID], ID),
|
|
39
53
|
sendOnMainThread: msgSend([FFIType.ptr, ID, FFIType.bool], FFIType.void),
|
|
40
54
|
};
|
|
41
55
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { copyFileSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
|
|
2
|
+
import { dirname, join } from "path";
|
|
3
|
+
import { getGloomberbDirs } from "../../../../data/config/home";
|
|
4
|
+
import { emptyScreenSetup, parseScreenSetup, type ScreenSetup } from "../../../desktop/screen-setup";
|
|
5
|
+
import type { ScreenSetupStore } from "../../../desktop/window-controller";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The windows and where they sit, per monitor arrangement, beside the config
|
|
9
|
+
* and never in it: launch reads it before the config, and it describes this
|
|
10
|
+
* machine's screens, so it stays out of the synced config.
|
|
11
|
+
*/
|
|
12
|
+
const FILE_NAME = "desktop-windows.json";
|
|
13
|
+
|
|
14
|
+
function desktopScreenSetupPath(env: NodeJS.ProcessEnv = process.env): string {
|
|
15
|
+
return join(dirname(getGloomberbDirs(env).configFile), FILE_NAME);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function desktopScreenSetupStore(path: string = desktopScreenSetupPath()): ScreenSetupStore {
|
|
19
|
+
return {
|
|
20
|
+
load(): ScreenSetup {
|
|
21
|
+
let text: string;
|
|
22
|
+
try {
|
|
23
|
+
text = readFileSync(path, "utf8");
|
|
24
|
+
} catch {
|
|
25
|
+
// Intentional ignore: no file yet; the windows start from the defaults.
|
|
26
|
+
return emptyScreenSetup();
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const raw: unknown = JSON.parse(text);
|
|
30
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) return parseScreenSetup(raw);
|
|
31
|
+
} catch {
|
|
32
|
+
// Not JSON: kept below.
|
|
33
|
+
}
|
|
34
|
+
// The next save would replace a file this build cannot read: a copy stays beside it.
|
|
35
|
+
try {
|
|
36
|
+
copyFileSync(path, `${path}.bak`);
|
|
37
|
+
} catch {
|
|
38
|
+
// Intentional ignore: the windows start from the defaults either way.
|
|
39
|
+
}
|
|
40
|
+
console.error("[desktop] the window setup could not be read; a copy was kept as desktop-windows.json.bak");
|
|
41
|
+
return emptyScreenSetup();
|
|
42
|
+
},
|
|
43
|
+
save(setup: ScreenSetup): void {
|
|
44
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
45
|
+
try {
|
|
46
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
47
|
+
writeFileSync(temporary, JSON.stringify(setup));
|
|
48
|
+
renameSync(temporary, path);
|
|
49
|
+
} catch (error) {
|
|
50
|
+
rmSync(temporary, { force: true });
|
|
51
|
+
console.error("[desktop] could not save the window setup", error instanceof Error ? error.message : String(error));
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -15,6 +15,21 @@ export interface DesktopStateRpc {
|
|
|
15
15
|
|
|
16
16
|
interface DesktopStateBroadcasterOptions<Rpc extends DesktopStateRpc> {
|
|
17
17
|
forEachReadyWindowRpc: (callback: (rpc: Rpc) => void) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Which state a window draws: windows with the same view share one key.
|
|
20
|
+
* Without it every window gets the shared state.
|
|
21
|
+
*/
|
|
22
|
+
viewKey?: (rpc: Rpc) => string;
|
|
23
|
+
/** The state for a view key, from the shared one; null sends that window nothing. */
|
|
24
|
+
project?: (viewKey: string, shared: DesktopSharedStateSnapshot) => DesktopSharedStateSnapshot | null;
|
|
25
|
+
/** Each state sent to a window, with the number it carries, which the window's next sync names as its base. */
|
|
26
|
+
delivered?: (rpc: Rpc, snapshot: DesktopSharedStateSnapshot) => void;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface ProjectedState {
|
|
30
|
+
snapshot: DesktopSharedStateSnapshot | null;
|
|
31
|
+
key?: string;
|
|
32
|
+
encoded?: DesktopSharedStateSnapshot;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
/**
|
|
@@ -29,6 +44,7 @@ function desktopStateKey(snapshot: DesktopSharedStateSnapshot): string {
|
|
|
29
44
|
focusedPaneId: snapshot.focusedPaneId,
|
|
30
45
|
statusBarVisible: snapshot.statusBarVisible,
|
|
31
46
|
brokerSyncErrors: snapshot.brokerSyncErrors ?? {},
|
|
47
|
+
linkedTickers: snapshot.linkedTickers ?? {},
|
|
32
48
|
});
|
|
33
49
|
}
|
|
34
50
|
|
|
@@ -37,6 +53,7 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
|
|
|
37
53
|
private themePreview: DesktopThemePreviewState = { theme: null };
|
|
38
54
|
/** The state held by each window that sends its whole state: what it last sent here or was sent. */
|
|
39
55
|
private readonly heldStateKeys = new WeakMap<Rpc, string>();
|
|
56
|
+
private seq = 0;
|
|
40
57
|
|
|
41
58
|
constructor(private readonly options: DesktopStateBroadcasterOptions<Rpc>) {}
|
|
42
59
|
|
|
@@ -52,6 +69,12 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
|
|
|
52
69
|
this.dockPreview = { paneId: null, edge: null };
|
|
53
70
|
}
|
|
54
71
|
|
|
72
|
+
/** Numbers a state handed to a window outside a broadcast (its `init`), in the same series. */
|
|
73
|
+
stamp(snapshot: DesktopSharedStateSnapshot): DesktopSharedStateSnapshot {
|
|
74
|
+
this.seq += 1;
|
|
75
|
+
return { ...snapshot, stateSeq: this.seq };
|
|
76
|
+
}
|
|
77
|
+
|
|
55
78
|
/** A window that sent its whole state holds it, and is not sent it back. */
|
|
56
79
|
noteWindowState(rpc: Rpc, snapshot: DesktopSharedStateSnapshot): void {
|
|
57
80
|
this.heldStateKeys.set(rpc, desktopStateKey(snapshot));
|
|
@@ -72,18 +95,29 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
|
|
|
72
95
|
*/
|
|
73
96
|
sendDesktopState(snapshot: DesktopSharedStateSnapshot | null): void {
|
|
74
97
|
if (!snapshot) return;
|
|
75
|
-
|
|
76
|
-
|
|
98
|
+
this.seq += 1;
|
|
99
|
+
const seq = this.seq;
|
|
100
|
+
const views = new Map<string, ProjectedState>();
|
|
101
|
+
const { viewKey, project, delivered } = this.options;
|
|
77
102
|
this.options.forEachReadyWindowRpc((rpc) => {
|
|
103
|
+
const view = viewKey?.(rpc) ?? "";
|
|
104
|
+
let projected = views.get(view);
|
|
105
|
+
if (!projected) {
|
|
106
|
+
const shown = project ? project(view, snapshot) : snapshot;
|
|
107
|
+
projected = { snapshot: shown ? { ...shown, stateSeq: seq } : null };
|
|
108
|
+
views.set(view, projected);
|
|
109
|
+
}
|
|
110
|
+
if (!projected.snapshot) return;
|
|
78
111
|
const heldKey = this.heldStateKeys.get(rpc);
|
|
79
112
|
if (heldKey !== undefined) {
|
|
80
|
-
|
|
81
|
-
if (heldKey ===
|
|
82
|
-
this.heldStateKeys.set(rpc,
|
|
113
|
+
projected.key ??= desktopStateKey(projected.snapshot);
|
|
114
|
+
if (heldKey === projected.key) return;
|
|
115
|
+
this.heldStateKeys.set(rpc, projected.key);
|
|
83
116
|
}
|
|
84
|
-
|
|
117
|
+
projected.encoded ??= encodeRpcValue(projected.snapshot) as DesktopSharedStateSnapshot;
|
|
118
|
+
delivered?.(rpc, projected.snapshot);
|
|
85
119
|
rpc.send["desktop.state"]({
|
|
86
|
-
snapshot:
|
|
120
|
+
snapshot: projected.encoded,
|
|
87
121
|
});
|
|
88
122
|
});
|
|
89
123
|
}
|
|
@@ -101,11 +135,13 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
|
|
|
101
135
|
});
|
|
102
136
|
}
|
|
103
137
|
|
|
104
|
-
|
|
138
|
+
/** Every window but the one previewing (`fromRpc`) previews the theme too. */
|
|
139
|
+
sendThemePreview(preview: DesktopThemePreviewState, fromRpc?: Rpc): void {
|
|
105
140
|
if (this.themePreview.theme === preview.theme) return;
|
|
106
141
|
this.themePreview = preview;
|
|
107
142
|
const encodedPreview = encodeRpcValue(preview) as DesktopThemePreviewState;
|
|
108
143
|
this.options.forEachReadyWindowRpc((rpc) => {
|
|
144
|
+
if (rpc === fromRpc) return;
|
|
109
145
|
rpc.send["desktop.themePreview"]({
|
|
110
146
|
preview: encodedPreview,
|
|
111
147
|
});
|
|
@@ -40,7 +40,7 @@ type ElectrobunUpdater = typeof Electrobun.Updater;
|
|
|
40
40
|
/**
|
|
41
41
|
* The part of Electrobun's updater this flow uses. Tests pass a fake, because
|
|
42
42
|
* the real module cannot be loaded or exercised outside the packaged app.
|
|
43
|
-
* `setUpdateSource` is this app's patch (patches/electrobun@*.patch).
|
|
43
|
+
* `setUpdateSource` is this app's patch (patches/electrobun-devkit@*.patch).
|
|
44
44
|
*/
|
|
45
45
|
export type ElectrobunUpdaterApi = Pick<
|
|
46
46
|
ElectrobunUpdater,
|