gloomberb 0.20.4 → 0.20.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/README.md +3 -1
- package/README.zh-CN.md +1 -1
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +4 -1
- package/src/api-client/data.ts +148 -37
- package/src/api-client/hk-tenders.ts +59 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/types/econ.ts +30 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +6 -0
- 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 +68 -40
- package/src/app.tsx +18 -13
- package/src/architecture/floating-promise-allowlist.json +313 -0
- 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 +238 -57
- package/src/cli/commands/news-search.ts +81 -14
- package/src/cli/commands/overview.ts +27 -6
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +1 -1
- package/src/cli/commands/ticker.ts +3 -1
- package/src/cli/early-command.ts +2 -0
- package/src/cli/errors.ts +10 -1
- package/src/cli/fx-forward.ts +89 -7
- package/src/cli/fx-pair.ts +1 -1
- package/src/cli/fx-quote-rate.ts +23 -0
- package/src/cli/glossary.ts +19 -5
- package/src/cli/help.ts +1 -0
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index-roots.ts +5 -4
- package/src/cli/index.ts +40 -3
- package/src/cli/known-gaps.ts +38 -9
- package/src/cli/listing-arg.ts +17 -5
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/options.ts +52 -3
- package/src/cli/output-file.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +15 -0
- package/src/cli/pane-functions/function-help.ts +4 -4
- package/src/cli/pane-functions/headless.ts +9 -4
- package/src/cli/pane-functions/index.ts +6 -4
- package/src/cli/pane-functions/resolver.ts +2 -2
- package/src/cli/result.ts +21 -2
- package/src/cli/spreadsheet-hint.ts +7 -3
- package/src/cli/treasury-yields.ts +5 -3
- package/src/components/chart/composite/legend.tsx +40 -2
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/workflow/tickers.ts +2 -2
- package/src/components/data-table/view.tsx +9 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/status-bar.tsx +6 -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 +16 -0
- package/src/components/onboarding/onboarding-wizard.tsx +8 -8
- 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/data-table/opentui/index.tsx +11 -4
- package/src/components/ui/data-table/opentui/model.ts +8 -6
- package/src/components/ui/data-table/types.ts +6 -1
- package/src/components/ui/index.ts +1 -1
- 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/table-layout.ts +38 -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/docs/snapshot.json +30 -13
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/market/change-basis.ts +9 -5
- package/src/market-data/market/dated-previous-close.ts +147 -17
- package/src/market-data/market/status.ts +17 -1
- package/src/market-data/quotes/contributions.ts +2 -0
- package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
- package/src/plugins/builtin/alerts/metric-data.ts +15 -2
- 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/backtest/headless.ts +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/cds/model.ts +0 -6
- package/src/plugins/builtin/chart-composer/formula.ts +16 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
- package/src/plugins/builtin/chart-composer/headless.ts +4 -2
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/presets.ts +1 -0
- 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/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/pane.tsx +55 -13
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +5 -3
- 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/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
- package/src/plugins/builtin/credit-boards/client.ts +8 -0
- package/src/plugins/builtin/credit-boards/headless.ts +4 -1
- package/src/plugins/builtin/credit-boards/model.ts +58 -4
- package/src/plugins/builtin/credit-boards/series.ts +63 -6
- package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
- package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
- package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
- package/src/plugins/builtin/credit-conditions/model.ts +12 -6
- package/src/plugins/builtin/credit-conditions/series.ts +2 -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-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +115 -8
- package/src/plugins/builtin/econ/calendar-source.ts +7 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +42 -8
- package/src/plugins/builtin/econ/types.ts +3 -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 +3 -0
- 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/fx-matrix/index.tsx +44 -14
- 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 +11 -1
- package/src/plugins/builtin/help/keybindings-editor.tsx +7 -3
- 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/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/index.tsx +1 -0
- 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/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/cli/render.ts +20 -3
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/headless-schema.ts +4 -3
- package/src/plugins/builtin/research/headless.ts +10 -4
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
- package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
- package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
- package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
- 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/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/api.ts +47 -4
- 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/data-panes/historical-prices.tsx +8 -7
- package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
- package/src/plugins/builtin/ticker-detail/financials/model.ts +18 -2
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +6 -6
- package/src/plugins/builtin/ticker-detail/headless.ts +24 -17
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +6 -4
- 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 +54 -5
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +150 -22
- package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
- package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
- package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +27 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +264 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +176 -41
- 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/portfolio/collection-name.ts +22 -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 +44 -18
- package/src/remote/schema.ts +21 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-tree.tsx +14 -2
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/dom/data-table/frozen-column.ts +3 -1
- package/src/renderers/dom/data-table/index.tsx +27 -9
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
- package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
- package/src/renderers/opentui/host.tsx +6 -0
- 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 +2 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
- package/src/sources/provider-router/cache.ts +3 -1
- package/src/sync/controller.ts +17 -2
- package/src/sync/other-window-tabs.ts +32 -1
- package/src/sync/react.ts +4 -4
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/bar-spacing.ts +33 -0
- package/src/time-series/base-series.ts +21 -3
- package/src/time-series/chart-bounds.ts +31 -0
- package/src/time-series/field-catalog.ts +17 -0
- package/src/time-series/fundamentals.ts +143 -11
- package/src/time-series/ice-credit.ts +32 -6
- package/src/time-series/resolve.ts +11 -7
- package/src/time-series/session-bar.ts +78 -9
- package/src/time-series/studies/formula.ts +53 -10
- package/src/time-series/studies/pair.ts +18 -7
- package/src/time-series/studies/units.ts +49 -2
- package/src/time-series/types.ts +12 -0
- package/src/types/desktop-window.ts +2 -0
- package/src/types/financials.ts +7 -0
- package/src/types/headless.ts +8 -0
- package/src/types/plugin-pane-settings.ts +2 -0
- package/src/types/plugin-panes.ts +22 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/cli-output.ts +6 -3
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/ebitda.ts +128 -0
- package/src/utils/format.ts +1 -1
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/shell-word.ts +13 -0
- package/src/utils/untrusted-text.ts +29 -0
|
@@ -113,6 +113,10 @@ function parseDefaults(texts: readonly string[]): KeyChord[] {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
const DEFAULT_CHORDS = new Map(KEYBINDING_ACTIONS.map((action) => [action.id, parseDefaults(action.defaults)]));
|
|
116
|
+
const TERMINAL_DEFAULT_CHORDS = new Map(KEYBINDING_ACTIONS.map((action) => [
|
|
117
|
+
action.id,
|
|
118
|
+
[...DEFAULT_CHORDS.get(action.id)!, ...parseDefaults(action.terminalDefaults ?? [])],
|
|
119
|
+
]));
|
|
116
120
|
|
|
117
121
|
/**
|
|
118
122
|
* Two chords fire on the same keypress somewhere: identical, or one says
|
|
@@ -179,11 +183,13 @@ export function resolveKeybindings(
|
|
|
179
183
|
const hostActions = KEYBINDING_ACTIONS.filter((def) => (
|
|
180
184
|
options.host === "desktop" ? !def.terminalOnly : options.host === "terminal" ? !def.desktopOnly : true
|
|
181
185
|
));
|
|
186
|
+
// With no host the table is every host's at once (the CLI), so it has the terminal's chords too.
|
|
187
|
+
const defaults = options.host === "desktop" ? DEFAULT_CHORDS : TERMINAL_DEFAULT_CHORDS;
|
|
182
188
|
const actions: ResolvedKeybindingAction[] = hostActions.map((def) => resolveAction(
|
|
183
189
|
def,
|
|
184
190
|
undefined,
|
|
185
191
|
def.id,
|
|
186
|
-
|
|
192
|
+
defaults.get(def.id)!,
|
|
187
193
|
overrides,
|
|
188
194
|
issues,
|
|
189
195
|
));
|
|
@@ -229,12 +235,18 @@ export function resolveKeybindings(
|
|
|
229
235
|
|
|
230
236
|
/**
|
|
231
237
|
* The first action or command whose chord the event is, in table order. Actions
|
|
232
|
-
* win over commands, so a stray command binding never shadows a core key.
|
|
238
|
+
* win over commands, so a stray command binding never shadows a core key. The
|
|
239
|
+
* one exception is a command on a single key of the 1-9 family (`Alt+1`):
|
|
240
|
+
* that key was bound by hand, the family by default, so the command keeps it.
|
|
233
241
|
*/
|
|
234
242
|
export function matchKeybinding(resolved: ResolvedKeybindings, event: KeyChordEventLike): KeybindingMatch | null {
|
|
235
243
|
for (const action of resolved.actions) {
|
|
236
244
|
for (const chord of action.chords) {
|
|
237
245
|
if (!matchesKeyChord(chord, event)) continue;
|
|
246
|
+
const command = chord.key === "digit"
|
|
247
|
+
? resolved.commands.find((entry) => matchesKeyChord(entry.chord, event))
|
|
248
|
+
: undefined;
|
|
249
|
+
if (command) return { kind: "command", command };
|
|
238
250
|
return {
|
|
239
251
|
kind: "action",
|
|
240
252
|
id: action.id,
|
|
@@ -255,11 +267,18 @@ export function matchKeybinding(resolved: ResolvedKeybindings, event: KeyChordEv
|
|
|
255
267
|
* switcher's 1-9 included. Capture refuses such a chord, so a new binding never
|
|
256
268
|
* leaves a core key (the command bar, close pane, quit) dead. Null when no
|
|
257
269
|
* built-in action has it; a plugin shortcut or a bound command does not count.
|
|
270
|
+
* A command may take one digit of the 1-9 family (`Alt+1`): it wins that key
|
|
271
|
+
* (matchKeybinding), and the other eight still switch layouts.
|
|
258
272
|
*/
|
|
259
|
-
export function coreActionOnChord(
|
|
273
|
+
export function coreActionOnChord(
|
|
274
|
+
resolved: ResolvedKeybindings,
|
|
275
|
+
chord: KeyChord,
|
|
276
|
+
exceptId?: string,
|
|
277
|
+
{ command = false }: { command?: boolean } = {},
|
|
278
|
+
): ResolvedKeybindingAction | null {
|
|
260
279
|
return resolved.actions.find((action) => action.def && action.id !== exceptId
|
|
261
280
|
&& action.chords.some((existing) => keyChordsOverlap(existing, chord)
|
|
262
|
-
|| (existing.key === "digit" && /^[1-9]$/.test(chord.key) && keyChordsOverlap({ ...existing, key: chord.key }, chord))))
|
|
281
|
+
|| (!command && existing.key === "digit" && /^[1-9]$/.test(chord.key) && keyChordsOverlap({ ...existing, key: chord.key }, chord))))
|
|
263
282
|
?? null;
|
|
264
283
|
}
|
|
265
284
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useSyncExternalStore } from "react";
|
|
2
|
+
import type { KeyChord } from "./chord";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether the terminal reports Control with any key (the kitty keyboard
|
|
6
|
+
* protocol), as the terminal host learns it from the terminal's answers at
|
|
7
|
+
* start: true when it does, false when the terminal answered without it, null
|
|
8
|
+
* before it answers and outside a terminal. Without the protocol Control
|
|
9
|
+
* never reaches a digit: Ctrl+1 arrives as 1, Ctrl+3 as Esc. Alt does, as Esc
|
|
10
|
+
* then the digit.
|
|
11
|
+
*/
|
|
12
|
+
let reportsControlKeys: boolean | null = null;
|
|
13
|
+
const listeners = new Set<() => void>();
|
|
14
|
+
|
|
15
|
+
export function setTerminalReportsControlKeys(value: boolean | null): void {
|
|
16
|
+
if (value === reportsControlKeys) return;
|
|
17
|
+
reportsControlKeys = value;
|
|
18
|
+
for (const listener of listeners) listener();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function subscribe(listener: () => void): () => void {
|
|
22
|
+
listeners.add(listener);
|
|
23
|
+
return () => {
|
|
24
|
+
listeners.delete(listener);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function useTerminalReportsControlKeys(): boolean | null {
|
|
29
|
+
return useSyncExternalStore(subscribe, () => reportsControlKeys, () => null);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Whether a terminal without the kitty protocol can send the chord: not Control with a digit. */
|
|
33
|
+
export function legacyTerminalSends(chord: KeyChord): boolean {
|
|
34
|
+
return !((chord.ctrl || chord.primary) && (chord.key === "digit" || /^[0-9]$/.test(chord.key)));
|
|
35
|
+
}
|
|
@@ -106,8 +106,8 @@ export function useAppPaneRuntime({
|
|
|
106
106
|
));
|
|
107
107
|
}, [dispatch, stateRef]);
|
|
108
108
|
|
|
109
|
-
const activatePane = useCallback((paneId: string) => {
|
|
110
|
-
dispatch({ type: "FOCUS_PANE", paneId });
|
|
109
|
+
const activatePane = useCallback((paneId: string, options?: { trackTicker?: boolean }) => {
|
|
110
|
+
dispatch({ type: "FOCUS_PANE", paneId, ...options });
|
|
111
111
|
}, [dispatch]);
|
|
112
112
|
|
|
113
113
|
const {
|
|
@@ -21,15 +21,15 @@ import type {
|
|
|
21
21
|
import type { DataProvider } from "../../types/data-provider";
|
|
22
22
|
import type { PaneDef, PinTickerOptions } from "../../types/plugin";
|
|
23
23
|
import type { BrokerContractRef } from "../../types/instrument";
|
|
24
|
-
import type { TickerRecord } from "../../types/ticker";
|
|
25
24
|
import {
|
|
26
25
|
resolveTickerOpenTarget,
|
|
27
26
|
tickerOpenFailureMessage,
|
|
28
27
|
type TickerOpenTarget,
|
|
29
28
|
} from "../../tickers/open-target";
|
|
30
29
|
import {
|
|
31
|
-
createLocalTickerSearchCandidates,
|
|
32
30
|
findExactTickerSearchMatch,
|
|
31
|
+
normalizeTickerInput,
|
|
32
|
+
savedTickerForQuery,
|
|
33
33
|
upsertTickerFromSearchResult,
|
|
34
34
|
} from "../../tickers/search";
|
|
35
35
|
import { offerTickerListings, publishTickerOpenTarget as publishOpenTarget } from "./ticker-open-target";
|
|
@@ -41,8 +41,11 @@ import { tickerInstrumentLabel } from "../../tickers/instrument-label";
|
|
|
41
41
|
import { markTickerPaneOpening } from "../../state/opening-ticker-panes";
|
|
42
42
|
import { stableStringify } from "../../utils/hash";
|
|
43
43
|
|
|
44
|
+
type LayoutHistoryEntry = AppState["layoutHistory"][number];
|
|
45
|
+
|
|
44
46
|
interface UseAppTickerOpenRuntimeOptions {
|
|
45
|
-
|
|
47
|
+
/** `trackTicker: false` keeps a pane still looking its ticker up out of the recent tickers. */
|
|
48
|
+
activatePane: (paneId: string, options?: { trackTicker?: boolean }) => void;
|
|
46
49
|
buildPaneInstance: (paneType: string, options?: {
|
|
47
50
|
title?: string;
|
|
48
51
|
binding?: PaneBinding;
|
|
@@ -66,6 +69,10 @@ interface PaneAhead {
|
|
|
66
69
|
symbol: string;
|
|
67
70
|
/** The pane focused before it opened, which focus goes back to when nothing opens. */
|
|
68
71
|
sourcePaneId: string | null;
|
|
72
|
+
/** The layout it opened in, its undo history before the open, and that history as the open left it. */
|
|
73
|
+
layoutIndex: number;
|
|
74
|
+
historyBefore: LayoutHistoryEntry;
|
|
75
|
+
historyOpened: LayoutHistoryEntry | undefined;
|
|
69
76
|
stopOpening: () => void;
|
|
70
77
|
}
|
|
71
78
|
|
|
@@ -125,14 +132,6 @@ function findTargetPane(
|
|
|
125
132
|
return { existing, keepBinding };
|
|
126
133
|
}
|
|
127
134
|
|
|
128
|
-
/**
|
|
129
|
-
* Whether the app holds a ticker the key names, so opening it resolves here
|
|
130
|
-
* without a network lookup, as `resolveTickerSearch` reads a saved symbol.
|
|
131
|
-
*/
|
|
132
|
-
function holdsTicker(tickers: ReadonlyMap<string, TickerRecord>, symbol: string): boolean {
|
|
133
|
-
return tickers.has(symbol) || !!findExactTickerSearchMatch(createLocalTickerSearchCandidates(tickers.values()), symbol);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
135
|
/** Whether a pane opened ahead is still in the layout on its key: not closed, nor pointed at another ticker. */
|
|
137
136
|
function isPaneAheadInPlace(layout: LayoutConfig, ahead: PaneAhead): boolean {
|
|
138
137
|
const instance = findPaneInstance(layout, ahead.instanceId);
|
|
@@ -194,7 +193,8 @@ export function useAppTickerOpenRuntime({
|
|
|
194
193
|
|
|
195
194
|
/**
|
|
196
195
|
* Adds a new pane of `paneType` bound to `binding`, floating or docked as
|
|
197
|
-
* asked, and focuses it. `
|
|
196
|
+
* asked, and focuses it. `opening` runs with its id before it is placed, for
|
|
197
|
+
* a pane still looking its ticker up, which stays out of the recent tickers.
|
|
198
198
|
*/
|
|
199
199
|
const addTickerPane = useCallback((
|
|
200
200
|
paneType: string,
|
|
@@ -202,11 +202,11 @@ export function useAppTickerOpenRuntime({
|
|
|
202
202
|
binding: PaneBinding,
|
|
203
203
|
title: string,
|
|
204
204
|
options?: PinTickerOptions,
|
|
205
|
-
|
|
205
|
+
opening?: (instanceId: string) => void,
|
|
206
206
|
): string | null => {
|
|
207
207
|
const instance = buildPaneInstance(paneType, { title, binding });
|
|
208
208
|
if (!instance) return null;
|
|
209
|
-
|
|
209
|
+
opening?.(instance.instanceId);
|
|
210
210
|
|
|
211
211
|
const currentState = stateRef.current;
|
|
212
212
|
const currentLayout = currentState.config.layout;
|
|
@@ -228,7 +228,7 @@ export function useAppTickerOpenRuntime({
|
|
|
228
228
|
if (paneType === TICKER_RESEARCH_PANE_ID && options?.tabId) {
|
|
229
229
|
dispatch({ type: "UPDATE_PANE_STATE", paneId: instance.instanceId, patch: { ...options.tabState, activeTabId: options.tabId } });
|
|
230
230
|
}
|
|
231
|
-
activatePane(instance.instanceId);
|
|
231
|
+
activatePane(instance.instanceId, opening ? { trackTicker: false } : undefined);
|
|
232
232
|
return instance.instanceId;
|
|
233
233
|
}, [activatePane, buildPaneInstance, dispatch, persistLayout, pluginRegistry, stateRef]);
|
|
234
234
|
|
|
@@ -285,16 +285,17 @@ export function useAppTickerOpenRuntime({
|
|
|
285
285
|
* a slow connection), bound to the key as given and marked as opening; the
|
|
286
286
|
* lookup settles it (`settlePaneAhead`). Null when the open waits for the
|
|
287
287
|
* lookup instead: another pane type, a broker contract, a ticker the app
|
|
288
|
-
* holds (it resolves here, at once), or a
|
|
288
|
+
* holds however the key spells it (it resolves here, at once), or a
|
|
289
|
+
* research pane already on the key.
|
|
289
290
|
*/
|
|
290
291
|
const openPaneAhead = useCallback((rawSymbol: string, options?: PinTickerOptions): PaneAhead | null => {
|
|
291
292
|
const paneType = normalizePaneId(options?.paneType ?? TICKER_RESEARCH_PANE_ID);
|
|
292
293
|
const paneDef = pluginRegistry.panes.get(paneType);
|
|
293
|
-
const symbol = rawSymbol
|
|
294
|
+
const symbol = normalizeTickerInput(null, rawSymbol);
|
|
294
295
|
if (paneType !== TICKER_RESEARCH_PANE_ID || !paneDef || !symbol || options?.instrument) return null;
|
|
295
296
|
const state = stateRef.current;
|
|
296
297
|
const layout = state.config.layout;
|
|
297
|
-
if (
|
|
298
|
+
if (savedTickerForQuery(rawSymbol, state.tickers)) return null;
|
|
298
299
|
if (!options?.forceNewPane && layout.instances.some((instance) => instance.paneId === paneType
|
|
299
300
|
&& instance.binding?.kind === "fixed" && instance.binding.symbol === symbol && isPaneInLayout(layout, instance.instanceId))) return null;
|
|
300
301
|
const binding: PaneBinding = {
|
|
@@ -304,13 +305,16 @@ export function useAppTickerOpenRuntime({
|
|
|
304
305
|
...(options?.listing ? { listing: options.listing } : {}),
|
|
305
306
|
};
|
|
306
307
|
const sourcePaneId = state.focusedPaneId;
|
|
308
|
+
const layoutIndex = state.config.activeLayoutIndex;
|
|
309
|
+
const historyBefore = state.layoutHistory[layoutIndex] ?? { past: [], future: [] };
|
|
307
310
|
// Marked before it is placed, so its first frame already says it is loading.
|
|
308
311
|
let stopOpening = () => {};
|
|
309
312
|
const instanceId = addTickerPane(paneType, paneDef, binding, tickerInstrumentLabel(symbol, options?.instrument), options, (id) => {
|
|
310
313
|
stopOpening = markTickerPaneOpening(id);
|
|
311
314
|
});
|
|
312
315
|
if (!instanceId) return null;
|
|
313
|
-
|
|
316
|
+
const historyOpened = stateRef.current.layoutHistory[layoutIndex];
|
|
317
|
+
return { instanceId, symbol, sourcePaneId, layoutIndex, historyBefore, historyOpened, stopOpening };
|
|
314
318
|
}, [addTickerPane, pluginRegistry, stateRef]);
|
|
315
319
|
|
|
316
320
|
/**
|
|
@@ -318,8 +322,9 @@ export function useAppTickerOpenRuntime({
|
|
|
318
322
|
* listing found, or gives way to a pane already showing that listing, or
|
|
319
323
|
* closes when nothing opens (no listing, or a choice of listings the
|
|
320
324
|
* command bar now offers), focus going back where it was. A pane closed or
|
|
321
|
-
* pointed at another ticker meanwhile is left alone.
|
|
322
|
-
*
|
|
325
|
+
* pointed at another ticker meanwhile is left alone. The undo history and
|
|
326
|
+
* the recent tickers end as if the open had waited for the lookup. True
|
|
327
|
+
* when the open landed in a pane.
|
|
323
328
|
*/
|
|
324
329
|
const settlePaneAhead = useCallback((
|
|
325
330
|
ahead: PaneAhead,
|
|
@@ -330,34 +335,57 @@ export function useAppTickerOpenRuntime({
|
|
|
330
335
|
if (target) publishTickerOpenTarget(target);
|
|
331
336
|
const state = stateRef.current;
|
|
332
337
|
const layout = state.config.layout;
|
|
333
|
-
|
|
334
|
-
const focusedHere = state.focusedPaneId === ahead.instanceId;
|
|
338
|
+
const inPlace = isPaneAheadInPlace(layout, ahead);
|
|
339
|
+
const focusedHere = inPlace && state.focusedPaneId === ahead.instanceId;
|
|
335
340
|
const without = removePane(layout, ahead.instanceId);
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
341
|
+
const resolved = target ? targetPaneBinding(target, options) : null;
|
|
342
|
+
const existing = inPlace && target && resolved
|
|
343
|
+
? findTargetPane(state, without, TICKER_RESEARCH_PANE_ID, target, resolved.instrument, options, typed).existing
|
|
344
|
+
: null;
|
|
345
|
+
const instance = findPaneInstance(layout, ahead.instanceId);
|
|
346
|
+
const settled = target && resolved && !existing ? {
|
|
347
|
+
binding: resolved.binding,
|
|
348
|
+
title: inPlace && instance?.title && instance.title !== tickerInstrumentLabel(ahead.symbol, options?.instrument)
|
|
349
|
+
? instance.title
|
|
350
|
+
: tickerInstrumentLabel(target.symbol, resolved.instrument),
|
|
351
|
+
} : null;
|
|
352
|
+
// The steps taken while it loaded hold it on its key. An open that came to nothing leaves
|
|
353
|
+
// no step, and the history it found comes back whole when nothing was done since.
|
|
354
|
+
const settleHistory = () => {
|
|
355
|
+
if (stateRef.current.config.activeLayoutIndex !== ahead.layoutIndex) return;
|
|
356
|
+
const untouched = !settled && state.layoutHistory[ahead.layoutIndex] === ahead.historyOpened;
|
|
357
|
+
dispatch({
|
|
358
|
+
type: "SETTLE_OPENING_PANE",
|
|
359
|
+
settlement: { paneId: ahead.instanceId, symbol: ahead.symbol, settled, ...(untouched ? { before: ahead.historyBefore } : {}) },
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
if (!inPlace || !instance) {
|
|
363
|
+
settleHistory();
|
|
339
364
|
return false;
|
|
340
365
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
366
|
+
if (!settled) {
|
|
367
|
+
if (existing) {
|
|
368
|
+
persistLayout(without, { pushHistory: false });
|
|
369
|
+
if (options?.tabId) {
|
|
370
|
+
dispatch({ type: "UPDATE_PANE_STATE", paneId: existing.instanceId, patch: { ...options.tabState, activeTabId: options.tabId } });
|
|
371
|
+
}
|
|
372
|
+
if (focusedHere) focusVisiblePane(existing.instanceId, without);
|
|
373
|
+
} else {
|
|
374
|
+
const backTo = ahead.sourcePaneId && isPaneInLayout(without, ahead.sourcePaneId) ? ahead.sourcePaneId : null;
|
|
375
|
+
persistLayout(without, { pushHistory: false, ...(focusedHere ? { focusedPaneId: backTo } : {}) });
|
|
347
376
|
}
|
|
348
|
-
|
|
349
|
-
return
|
|
377
|
+
settleHistory();
|
|
378
|
+
return !!existing;
|
|
350
379
|
}
|
|
351
|
-
|
|
352
|
-
const title = !instance.title || instance.title === tickerInstrumentLabel(ahead.symbol, options?.instrument)
|
|
353
|
-
? tickerInstrumentLabel(target.symbol, instrument)
|
|
354
|
-
: instance.title;
|
|
355
|
-
if (title !== instance.title || stableStringify(instance.binding) !== stableStringify(binding)) {
|
|
380
|
+
if (settled.title !== instance.title || stableStringify(instance.binding) !== stableStringify(settled.binding)) {
|
|
356
381
|
persistLayout({
|
|
357
382
|
...layout,
|
|
358
|
-
instances: layout.instances.map((pane) => pane.instanceId === ahead.instanceId ? { ...pane,
|
|
383
|
+
instances: layout.instances.map((pane) => pane.instanceId === ahead.instanceId ? { ...pane, ...settled } : pane),
|
|
359
384
|
}, { pushHistory: false });
|
|
360
385
|
}
|
|
386
|
+
settleHistory();
|
|
387
|
+
// Focusing it left its key out of the recent tickers; the listing found goes in.
|
|
388
|
+
if (focusedHere && target) dispatch({ type: "TRACK_TICKER", symbol: target.symbol });
|
|
361
389
|
return true;
|
|
362
390
|
}, [dispatch, focusVisiblePane, persistLayout, publishTickerOpenTarget, stateRef]);
|
|
363
391
|
|
package/src/app.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box, ContextMenuProvider, useNativeRenderer, useRendererHost, useUiHost } from "./ui";
|
|
2
2
|
import { ToastViewport, useToastHost } from "./ui/toast";
|
|
3
|
-
import { useState, useEffect, useCallback, useRef, useMemo, useSyncExternalStore, type
|
|
3
|
+
import { useState, useEffect, useCallback, useRef, useMemo, useSyncExternalStore, type ReactNode } from "react";
|
|
4
4
|
import {
|
|
5
5
|
AppProvider,
|
|
6
6
|
getFocusedTickerSymbol,
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
useAppStateRef,
|
|
10
10
|
type AppState,
|
|
11
11
|
} from "./state/app/context";
|
|
12
|
-
import type { AppAction } from "./core/state/app/state";
|
|
13
12
|
import { bindAppActivity, isAppVisible, subscribeAppVisibility, useAppActive, useAppVisible } from "./state/app/activity";
|
|
14
13
|
import { Header } from "./components/layout/header";
|
|
15
14
|
import { StatusBar } from "./components/layout/status-bar";
|
|
@@ -57,7 +56,7 @@ import { useAppUpdateRuntime } from "./app/runtime/update";
|
|
|
57
56
|
import { resolveUpdateChannel } from "./updater/channel";
|
|
58
57
|
import { createCoreSyncContributors } from "./sync/core-contributors";
|
|
59
58
|
import { useCloudSyncRuntime } from "./sync/react";
|
|
60
|
-
import {
|
|
59
|
+
import { createSyncConfigDispatch, withOtherWindowTabs } from "./sync/other-window-tabs";
|
|
61
60
|
import { getDesktopWindows } from "./state/desktop-windows";
|
|
62
61
|
import type { OtherWindowTab } from "./types/desktop-window";
|
|
63
62
|
import { RemoteControlHost, type RemoteControlAdapter } from "./remote/app-host";
|
|
@@ -67,10 +66,11 @@ import {
|
|
|
67
66
|
resolveCliLaunchConfig,
|
|
68
67
|
resolveInitialAppConfig,
|
|
69
68
|
} from "./app/app-bootstrap-state";
|
|
70
|
-
import {
|
|
69
|
+
import { scheduleConfigSave } from "./state/config-save-scheduler";
|
|
71
70
|
import { LOW_PRIORITY_CONFIG_SAVE_DEBOUNCE_MS } from "./state/persist-scheduler";
|
|
72
71
|
import { savedLayoutsDifferOnlyInMirror } from "./core/state/app/layout";
|
|
73
72
|
import { measurePerf } from "./utils/perf-marks";
|
|
73
|
+
import { t } from "./i18n";
|
|
74
74
|
import { useAppLanguage } from "./i18n/react";
|
|
75
75
|
import { AppLanguageConfigObserver } from "./app/language-observer";
|
|
76
76
|
import { isPaneShareHandoff } from "./shares/location";
|
|
@@ -207,15 +207,12 @@ function AppInner({
|
|
|
207
207
|
otherWindowTabsRef.current = otherWindowTabs;
|
|
208
208
|
const syncState = useMemo(() => withOtherWindowTabs(state, otherWindowTabs), [state, otherWindowTabs]);
|
|
209
209
|
const getSyncState = useCallback(() => withOtherWindowTabs(stateRef.current, otherWindowTabsRef.current), [stateRef]);
|
|
210
|
-
const syncDispatch =
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (changesOtherWindowTabs(action.config, others)) void saveConfigImmediately(action.config);
|
|
217
|
-
dispatch({ ...action, config: withoutOtherWindowTabs(action.config, others, stateRef.current.config) });
|
|
218
|
-
}, [dispatch, stateRef]);
|
|
210
|
+
const syncDispatch = useMemo(() => createSyncConfigDispatch({
|
|
211
|
+
dispatch,
|
|
212
|
+
otherWindowTabs: () => otherWindowTabsRef.current,
|
|
213
|
+
currentConfig: () => stateRef.current.config,
|
|
214
|
+
onSaveFailure: () => pluginRegistry.notify({ type: "error", body: t("Could not save the tabs synced to your other windows.") }),
|
|
215
|
+
}), [dispatch, pluginRegistry, stateRef]);
|
|
219
216
|
const appActive = useAppActive();
|
|
220
217
|
const appVisible = useAppVisible();
|
|
221
218
|
const appActiveRef = useRef(appActive);
|
|
@@ -297,6 +294,14 @@ function AppInner({
|
|
|
297
294
|
});
|
|
298
295
|
}, [desktopWindowBridge, pluginRegistry, stateRef]);
|
|
299
296
|
|
|
297
|
+
// A window change the desktop app could not save: a window or popped-out pane closed, a pane docked or moved.
|
|
298
|
+
useEffect(() => {
|
|
299
|
+
if (desktopWindowBridge?.kind !== "main" || appWideWorkElsewhere || !desktopWindowBridge.subscribeSaveFailures) return;
|
|
300
|
+
return desktopWindowBridge.subscribeSaveFailures(() => {
|
|
301
|
+
pluginRegistry.notify({ type: "error", body: t("Could not save your window layout.") });
|
|
302
|
+
});
|
|
303
|
+
}, [appWideWorkElsewhere, desktopWindowBridge, pluginRegistry]);
|
|
304
|
+
|
|
300
305
|
useEffect(() => {
|
|
301
306
|
const disposers = createCoreSyncContributors().map((contributor) => (
|
|
302
307
|
pluginRegistry.registerSyncContributorForPlugin("core", contributor)
|