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
|
@@ -3,6 +3,7 @@ import type { TickerRecord } from "../../../types/ticker";
|
|
|
3
3
|
import { splitSymbolArgs, splitSymbolWords, symbolInputKey, uniqueSymbols } from "../../../cli/symbol-args";
|
|
4
4
|
import { protectFigureCommas } from "../../../cli/symbol-cells";
|
|
5
5
|
import { readSymbolList } from "../../../cli/symbol-list";
|
|
6
|
+
import { endsInLegalForm, isLegalForm, readTerminalListingCode } from "../../../tickers/terminal-codes";
|
|
6
7
|
import { readNameEntries } from "../../../cli/name-entries";
|
|
7
8
|
import {
|
|
8
9
|
addSymbols,
|
|
@@ -43,6 +44,86 @@ export interface PastedSymbolList {
|
|
|
43
44
|
separated: boolean;
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/** A symbol as one word, in capitals: NFE, BRK.B, 0700, VOD:LSE. */
|
|
48
|
+
const CAPITAL_SYMBOL = /^\$?[A-Z0-9][A-Z0-9.\-]{0,11}(?::[A-Z0-9]{1,8})?$/;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A ticker among words split by spaces alone: up to five letters, with a share
|
|
52
|
+
* class (BRK.B) or a venue (VOD:LSE), or a numeric code (0700). A longer word
|
|
53
|
+
* in capitals is a name's (FORTRESS, AMERICA).
|
|
54
|
+
*/
|
|
55
|
+
const SPACED_TICKER = /^\$?(?:[A-Z]{1,5}(?:[.\-][A-Z]{1,2})?|\d{4,6})(?::[A-Z]{1,8})?$/;
|
|
56
|
+
|
|
57
|
+
/** Words that join a name's other words (BANK OF AMERICA, PROCTER & GAMBLE), never a symbol of a list. */
|
|
58
|
+
const JOINING_WORDS: ReadonlySet<string> = new Set(["OF", "AND", "&", "THE", "FOR", "DE", "DU", "DES", "DEL", "LA", "LE"]);
|
|
59
|
+
|
|
60
|
+
/** A terminal code with spaces (`NFE US Equity`, `VOD LN`), never a name before its legal form (`SAP SE`). */
|
|
61
|
+
function isSpacedCode(entry: string): boolean {
|
|
62
|
+
return entry.includes(" ") && !endsInLegalForm(entry) && readTerminalListingCode(entry) != null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* A company's name as a list holds one: up to five words, the first and each
|
|
67
|
+
* but a joining word capitalized (`Apple Inc`, `Bank of America`, `NEW
|
|
68
|
+
* FORTRESS ENERGY INC`). A sentence is none: `how did NVDA do today`, `and why?`.
|
|
69
|
+
*/
|
|
70
|
+
function isShortName(entry: string): boolean {
|
|
71
|
+
const words = entry.split(/\s+/);
|
|
72
|
+
return words.length <= 5 && !/[?!]/.test(entry) && /^\p{Lu}/u.test(words[0]!)
|
|
73
|
+
&& words.every((word) => /^[\p{Lu}\d&]/u.test(word) || JOINING_WORDS.has(word.toUpperCase()));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The entries of a list split by commas, semicolons, tabs or lines, when every
|
|
78
|
+
* one is a symbol, a terminal code or a short name, and two or more hold a
|
|
79
|
+
* symbol or there are three or more: `NFE, RAD`, `Apple, Microsoft, Nvidia`.
|
|
80
|
+
* Null for a sentence with a comma (`how did NVDA do today, and why?`).
|
|
81
|
+
*/
|
|
82
|
+
function separatedList(query: string): string[] | null {
|
|
83
|
+
const entries = uniqueSymbols(splitSymbolArgs([query])).symbols;
|
|
84
|
+
if (entries.length < 2) return null;
|
|
85
|
+
let symbols = 0;
|
|
86
|
+
for (const entry of entries) {
|
|
87
|
+
const symbol = isSpacedCode(entry) || (CAPITAL_SYMBOL.test(entry) && !JOINING_WORDS.has(entry));
|
|
88
|
+
if (!symbol && !isShortName(entry)) return null;
|
|
89
|
+
if (symbol) symbols += 1;
|
|
90
|
+
}
|
|
91
|
+
return symbols >= 1 || entries.length >= 3 ? entries : null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The symbols of a list pasted into the bare command bar, which flattens its
|
|
96
|
+
* lines into spaces: entries split by commas, semicolons, tabs or lines
|
|
97
|
+
* (`separatedList`), or by spaces alone three or more tickers in capitals,
|
|
98
|
+
* where Bloomberg's cells keep their words (`NFE US Equity RAD US Equity`).
|
|
99
|
+
* Null for anything else, which stays a search: a name in capitals (`BANK OF
|
|
100
|
+
* AMERICA`, `NEW FORTRESS ENERGY INC`), a sentence, one code.
|
|
101
|
+
*/
|
|
102
|
+
export function pastedRootList(query: string): string[] | null {
|
|
103
|
+
const text = protectFigureCommas(query.trim());
|
|
104
|
+
if (/[,;\t\r\n]/.test(text)) return separatedList(query);
|
|
105
|
+
const words = text.split(/\s+/).filter(Boolean);
|
|
106
|
+
const entries: string[] = [];
|
|
107
|
+
let codes = 0;
|
|
108
|
+
for (let index = 0; index < words.length;) {
|
|
109
|
+
// A terminal code's words read as one: `NFE US Equity`, `1128 HK Equity`, `VOD LN`.
|
|
110
|
+
const code = [3, 2].map((size) => words.slice(index, index + size).join(" "))
|
|
111
|
+
.find((candidate) => candidate.split(" ").length > 1 && isSpacedCode(candidate));
|
|
112
|
+
if (code) {
|
|
113
|
+
entries.push(code);
|
|
114
|
+
index += code.split(" ").length;
|
|
115
|
+
codes += 1;
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const word = words[index]!;
|
|
119
|
+
if (!SPACED_TICKER.test(word) || JOINING_WORDS.has(word) || isLegalForm(word)) return null;
|
|
120
|
+
entries.push(word.replace(/^\$/, ""));
|
|
121
|
+
index += 1;
|
|
122
|
+
}
|
|
123
|
+
const unique = [...new Set(entries)];
|
|
124
|
+
return unique.length >= 3 || (codes > 0 && unique.length >= 2) ? unique : null;
|
|
125
|
+
}
|
|
126
|
+
|
|
46
127
|
/**
|
|
47
128
|
* The entries of text typed or pasted after `AW`, split as `gloom quote`
|
|
48
129
|
* splits its arguments (`splitSymbolArgs`): on commas, semicolons, tabs and
|
|
@@ -33,6 +33,8 @@ import { ATTENTION_OFF_MESSAGE } from "../../../../telemetry/attention-setting";
|
|
|
33
33
|
import { NIGHTLY_CHANNEL_SUMMARY, withUpdateChannel } from "../../../../updater/channel";
|
|
34
34
|
import { isPrereleaseVersion } from "../../../../utils/semver";
|
|
35
35
|
import { VERSION } from "../../../../version";
|
|
36
|
+
import { getDesktopWindows } from "../../../../state/desktop-windows";
|
|
37
|
+
import { fireAndForget } from "../../../../utils/fire-and-forget";
|
|
36
38
|
|
|
37
39
|
type NotifyFn = (body: string, options?: { type?: "info" | "success" | "error" }) => void;
|
|
38
40
|
|
|
@@ -125,6 +127,10 @@ export function runDirectCommandAction(options: {
|
|
|
125
127
|
closeAll({ revertThemePreview: false });
|
|
126
128
|
pluginRegistry.openWindowMode(state.focusedPaneId ?? undefined, parseWindowModeCommandArg(arg) ?? "move");
|
|
127
129
|
return;
|
|
130
|
+
case "new-window":
|
|
131
|
+
closeAll({ revertThemePreview: false });
|
|
132
|
+
fireAndForget(getDesktopWindows()?.openWindow(), "desktop.openWindow");
|
|
133
|
+
return;
|
|
128
134
|
case "minimize-window":
|
|
129
135
|
case "maximize-window":
|
|
130
136
|
closeAll({ revertThemePreview: false });
|
|
@@ -189,6 +189,14 @@ export const commands: Command[] = [
|
|
|
189
189
|
argPlaceholder: "move|resize",
|
|
190
190
|
category: "Config",
|
|
191
191
|
},
|
|
192
|
+
// Listed only in the desktop app's full windows.
|
|
193
|
+
{
|
|
194
|
+
id: "new-window",
|
|
195
|
+
prefix: "",
|
|
196
|
+
label: "New Window",
|
|
197
|
+
description: "Open another app window with its own layout tabs, for another screen",
|
|
198
|
+
category: "Config",
|
|
199
|
+
},
|
|
192
200
|
// The keyboard's way to the title bar buttons the desktop draws for itself
|
|
193
201
|
// on Windows; the command bar lists these only on that host.
|
|
194
202
|
{
|
|
@@ -9,7 +9,27 @@ import {
|
|
|
9
9
|
} from "../../../types/config";
|
|
10
10
|
import { groupIdFor } from "../../layout/status-bar-groups";
|
|
11
11
|
import type { ResultItem } from "../list/model";
|
|
12
|
-
import type { LayoutItemsContext } from "./types";
|
|
12
|
+
import type { CloseAll, LayoutItemsContext } from "./types";
|
|
13
|
+
import { getDesktopWindows, layoutMoveTargets } from "../../../state/desktop-windows";
|
|
14
|
+
import { fireAndForget } from "../../../utils/fire-and-forget";
|
|
15
|
+
|
|
16
|
+
/** The desktop app's other windows, and a new one, where the current layout tab can go. */
|
|
17
|
+
function layoutWindowMoves(layoutId: string | undefined, tabCount: number, closeAll: CloseAll): ResultItem[] {
|
|
18
|
+
const windows = getDesktopWindows();
|
|
19
|
+
if (!windows || !layoutId) return [];
|
|
20
|
+
return layoutMoveTargets(windows, tabCount).map((move) => ({
|
|
21
|
+
id: `layout-move-to-window:${move.key}`,
|
|
22
|
+
label: move.label,
|
|
23
|
+
detail: move.detail ?? "Open a window for the current layout tab",
|
|
24
|
+
searchText: "screen monitor display",
|
|
25
|
+
category: "Current Layout",
|
|
26
|
+
kind: "action" as const,
|
|
27
|
+
action: () => {
|
|
28
|
+
closeAll({ revertThemePreview: false });
|
|
29
|
+
fireAndForget(windows.moveLayout(layoutId, move.target), "desktop.moveLayoutToWindow");
|
|
30
|
+
},
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
13
33
|
|
|
14
34
|
/**
|
|
15
35
|
* The saved layouts drawn in the same run of status bar tabs as `index`, in tab
|
|
@@ -176,6 +196,7 @@ export function buildCurrentLayoutItems({
|
|
|
176
196
|
},
|
|
177
197
|
moveLayoutTab(-1),
|
|
178
198
|
moveLayoutTab(1),
|
|
199
|
+
...layoutWindowMoves(state.config.layouts[activeLayoutIndex]?.id, state.config.layouts.length, closeAll),
|
|
179
200
|
{
|
|
180
201
|
id: "layout-duplicate-layout",
|
|
181
202
|
label: "Duplicate Layout",
|
|
@@ -9,8 +9,28 @@ import { resolveTickerForPane } from "../../../state/app/context";
|
|
|
9
9
|
import { findPaneInstance } from "../../../types/config";
|
|
10
10
|
import { tf } from "../../../i18n";
|
|
11
11
|
import type { ResultItem } from "../list/model";
|
|
12
|
-
import type { LayoutItemsContext } from "./types";
|
|
13
12
|
import { WINDOW_MODE_COMMAND_OPTIONS } from "./window-mode";
|
|
13
|
+
import { getDesktopWindows, windowMoveTargets } from "../../../state/desktop-windows";
|
|
14
|
+
import { fireAndForget } from "../../../utils/fire-and-forget";
|
|
15
|
+
import type { CloseAll, LayoutItemsContext } from "./types";
|
|
16
|
+
|
|
17
|
+
/** The desktop app's other windows, and a new one, where the focused pane can go. */
|
|
18
|
+
function focusedPaneWindowMoves(paneId: string, closeAll: CloseAll): ResultItem[] {
|
|
19
|
+
const windows = getDesktopWindows();
|
|
20
|
+
if (!windows) return [];
|
|
21
|
+
return windowMoveTargets(windows, { prefix: "pane" }).map((move) => ({
|
|
22
|
+
id: `layout-move-to-window:${move.key}`,
|
|
23
|
+
label: move.label,
|
|
24
|
+
detail: move.detail ?? "Open a window for the focused pane",
|
|
25
|
+
searchText: "screen monitor display",
|
|
26
|
+
category: "Focused Pane",
|
|
27
|
+
kind: "action" as const,
|
|
28
|
+
action: () => {
|
|
29
|
+
closeAll({ revertThemePreview: false });
|
|
30
|
+
fireAndForget(windows.movePane(paneId, move.target), "desktop.movePaneToWindow");
|
|
31
|
+
},
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
14
34
|
|
|
15
35
|
export function buildFocusedPaneLayoutItems({
|
|
16
36
|
closeAll,
|
|
@@ -103,6 +123,7 @@ export function buildFocusedPaneLayoutItems({
|
|
|
103
123
|
pluginRegistry.movePaneBack(focusedPane.instanceId);
|
|
104
124
|
},
|
|
105
125
|
}] : []),
|
|
126
|
+
...focusedPaneWindowMoves(focusedPane.instanceId, closeAll),
|
|
106
127
|
...WINDOW_MODE_COMMAND_OPTIONS.map((option) => ({
|
|
107
128
|
id: `layout-window-mode:${option.mode}`,
|
|
108
129
|
label: option.label,
|
|
@@ -8,6 +8,7 @@ import type {
|
|
|
8
8
|
import { fuzzyFilter } from "../../../utils/fuzzy-search";
|
|
9
9
|
import { summarizeError } from "../helpers";
|
|
10
10
|
import type { ResultItem } from "../list/model";
|
|
11
|
+
import { tickerFirstQuery } from "../routes/root/ticker-first";
|
|
11
12
|
|
|
12
13
|
type LogErrorFn = (message: string, details: Record<string, unknown>) => void;
|
|
13
14
|
|
|
@@ -129,13 +130,28 @@ export function getAvailablePaneShortcutTemplatesForQuery(options: {
|
|
|
129
130
|
query: string;
|
|
130
131
|
logError?: LogErrorFn;
|
|
131
132
|
}): PaneTemplateDef[] {
|
|
132
|
-
const trimmed = options.query.trim();
|
|
133
|
-
const upper = trimmed.toUpperCase();
|
|
134
133
|
const disabledPluginIds = new Set(options.disabledPlugins);
|
|
135
134
|
const enabled = [...options.pluginRegistry.paneTemplates.values()].filter((template) => {
|
|
136
135
|
const pluginId = options.pluginRegistry.getPaneTemplatePluginId(template.id);
|
|
137
136
|
return !pluginId || !disabledPluginIds.has(pluginId);
|
|
138
137
|
});
|
|
138
|
+
const typed = matchingShortcutTemplates(options, enabled, options.query.trim());
|
|
139
|
+
if (typed.length > 0) return typed;
|
|
140
|
+
// Bloomberg's order, the ticker first (`NFE CDS`), is the code's with that ticker.
|
|
141
|
+
const reordered = tickerFirstQuery(options.query, (code) => enabled.some((template) => {
|
|
142
|
+
const argKind = getPaneTemplateArgKind(template);
|
|
143
|
+
return (argKind === "ticker" || argKind === "ticker-list" || (argKind === "text" && template.shortcut?.focusedIssuer === true))
|
|
144
|
+
&& paneTemplateShortcutPrefixes(template).some((prefix) => prefix.toUpperCase() === code);
|
|
145
|
+
}));
|
|
146
|
+
return reordered ? matchingShortcutTemplates(options, enabled, reordered) : [];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function matchingShortcutTemplates(
|
|
150
|
+
options: { context: PaneTemplateContext; query: string; logError?: LogErrorFn },
|
|
151
|
+
enabled: readonly PaneTemplateDef[],
|
|
152
|
+
trimmed: string,
|
|
153
|
+
): PaneTemplateDef[] {
|
|
154
|
+
const upper = trimmed.toUpperCase();
|
|
139
155
|
return enabled.filter((template) => {
|
|
140
156
|
const argKind = getPaneTemplateArgKind(template);
|
|
141
157
|
// The longest matching mnemonic wins, so an alias sharing a stem cannot shadow the typed one.
|
|
@@ -157,7 +173,7 @@ export function getAvailablePaneShortcutTemplatesForQuery(options: {
|
|
|
157
173
|
} catch (error) {
|
|
158
174
|
options.logError?.("Pane shortcut canCreate failed", {
|
|
159
175
|
templateId: template.id,
|
|
160
|
-
query:
|
|
176
|
+
query: trimmed,
|
|
161
177
|
error: summarizeError(error),
|
|
162
178
|
});
|
|
163
179
|
return false;
|
|
@@ -178,11 +178,14 @@ export function useCommandBarPaneTemplateActions({
|
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
180
|
try {
|
|
181
|
+
// A watchlist's name reads as its symbols, at most the function's maximum, and the bar says so.
|
|
182
|
+
const notes: string[] = [];
|
|
181
183
|
const symbols = await resolveTickerListInput(
|
|
182
184
|
trimmedList,
|
|
183
185
|
activeCollectionId,
|
|
184
186
|
buildWorkflowDeps(),
|
|
185
187
|
template.shortcut?.keepArgToken,
|
|
188
|
+
{ maximum: template.headless?.argument.maximum, notes },
|
|
186
189
|
);
|
|
187
190
|
const createOptions = {
|
|
188
191
|
arg: trimmedList,
|
|
@@ -192,6 +195,7 @@ export function useCommandBarPaneTemplateActions({
|
|
|
192
195
|
openPaneTemplateWorkflow(template, { arg: trimmedArg });
|
|
193
196
|
return;
|
|
194
197
|
}
|
|
198
|
+
if (notes.length > 0) notify(notes.join(" "), { type: "info" });
|
|
195
199
|
await openPaneTemplateDirect(template, createOptions);
|
|
196
200
|
} catch {
|
|
197
201
|
openPaneTemplateWorkflow(template, { arg: trimmedArg });
|
|
@@ -209,6 +213,7 @@ export function useCommandBarPaneTemplateActions({
|
|
|
209
213
|
activeTickerSymbol,
|
|
210
214
|
buildWorkflowDeps,
|
|
211
215
|
getPaneTemplateContext,
|
|
216
|
+
notify,
|
|
212
217
|
openModeRoute,
|
|
213
218
|
openPaneTemplateDirect,
|
|
214
219
|
openPaneTemplateWorkflow,
|
|
@@ -13,11 +13,12 @@ import {
|
|
|
13
13
|
type AssistRowHandlers,
|
|
14
14
|
} from "../../assist/model";
|
|
15
15
|
import { matchPrefix, type Command } from "../../commands/registry";
|
|
16
|
+
import { pastedRootList } from "../../commands/collection-list";
|
|
16
17
|
import { isCollectionCommand, SECURITY_DESCRIPTION_SEARCH } from "../../helpers";
|
|
17
18
|
import { recentPaneTemplateArg } from "../../pane-templates/items";
|
|
18
|
-
import { dedupeById } from "../../view-model";
|
|
19
|
+
import { dedupeById, PASTED_LIST_CATEGORY } from "../../view-model";
|
|
19
20
|
import type { ResultItem } from "../../list/model";
|
|
20
|
-
import type
|
|
21
|
+
import { shortcutArgument, type parseRootShortcutIntent } from "./shortcuts";
|
|
21
22
|
import type { CommandBarRoute } from "../../workflow/types";
|
|
22
23
|
import { createRootCommandItemBuilder } from "./command-items";
|
|
23
24
|
import { buildRootShortcutItem } from "./shortcut-items";
|
|
@@ -127,6 +128,22 @@ function isAssistSectionVisible(
|
|
|
127
128
|
return assist.auto;
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
/** "Add 4 symbols to a watchlist", which runs AW on the list as its entries, Bloomberg's codes kept whole. */
|
|
132
|
+
function pastedListItem(
|
|
133
|
+
symbols: readonly string[],
|
|
134
|
+
executeCollectionCommand: RootResultModelOptions["executeCollectionCommand"],
|
|
135
|
+
): ResultItem {
|
|
136
|
+
const shown = symbols.slice(0, 6).join(", ");
|
|
137
|
+
return {
|
|
138
|
+
id: `pasted-list:${symbols.length}:${symbols[0]}`,
|
|
139
|
+
label: `Add ${symbols.length} symbols to a watchlist`,
|
|
140
|
+
detail: symbols.length > 6 ? `${shown} and ${symbols.length - 6} more` : shown,
|
|
141
|
+
category: PASTED_LIST_CATEGORY,
|
|
142
|
+
kind: "action",
|
|
143
|
+
action: () => { void executeCollectionCommand("add-watchlist", symbols.join(", ")); },
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
130
147
|
/**
|
|
131
148
|
* The text a key would replay. An inferred ticker is left out on purpose: the
|
|
132
149
|
* key should follow the focused ticker at press time, not freeze today's.
|
|
@@ -277,6 +294,8 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
|
|
|
277
294
|
|
|
278
295
|
const items: ResultItem[] = [];
|
|
279
296
|
const match = matchPrefix(rootQuery, availableCommands);
|
|
297
|
+
// A pasted list, which the bar flattens into one line, leads with adding its symbols. The AI is still offered.
|
|
298
|
+
const pastedList = rootShortcutIntent.kind === "none" && !match && rootQuery ? pastedRootList(rootQuery) : null;
|
|
280
299
|
let initialIdx = 0;
|
|
281
300
|
// Off when the code's own rows only say why the argument opens nothing (`PF Nope`).
|
|
282
301
|
let shortcutRuns = true;
|
|
@@ -296,7 +315,7 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
|
|
|
296
315
|
const templateItems = matchingTemplates.length > 0
|
|
297
316
|
? matchingTemplates.map((template) => createPaneTemplateItem(template, {
|
|
298
317
|
category: "Panes",
|
|
299
|
-
createOptions: rootShortcutIntent
|
|
318
|
+
createOptions: shortcutArgument(rootShortcutIntent) ? { arg: shortcutArgument(rootShortcutIntent) } : undefined,
|
|
300
319
|
showShortcut: true,
|
|
301
320
|
shortcutExecution: true,
|
|
302
321
|
}))
|
|
@@ -396,6 +415,7 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
|
|
|
396
415
|
...tickerActionItems(),
|
|
397
416
|
...pluginCommandItems(),
|
|
398
417
|
];
|
|
418
|
+
if (pastedList) items.push(pastedListItem(pastedList, executeCollectionCommand));
|
|
399
419
|
items.push(...rankMatchBlock(allItems, providerMatchItems, rootQuery));
|
|
400
420
|
}
|
|
401
421
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "../../helpers";
|
|
15
15
|
import type { ResultItem } from "../../list/model";
|
|
16
16
|
import { getPaneTemplateArgKind } from "../../pane-templates/items";
|
|
17
|
-
import { parseRootShortcutIntent } from "./shortcuts";
|
|
17
|
+
import { parseRootShortcutIntent, shortcutArgument } from "./shortcuts";
|
|
18
18
|
import { buildHelpArgumentItems } from "./help-items";
|
|
19
19
|
import { recordFunctionOpen } from "../../../../telemetry/usage-counts";
|
|
20
20
|
|
|
@@ -109,9 +109,11 @@ export function buildImmediateRootSelection(options: RootSelectionCommandOptions
|
|
|
109
109
|
promptTicker: options.promptTickerSymbol,
|
|
110
110
|
});
|
|
111
111
|
if (intent.kind !== "none" && intent.source === "pane-template") {
|
|
112
|
+
// An issuer's function opens on the ticker in focus it was given, as if typed.
|
|
113
|
+
const arg = shortcutArgument(intent);
|
|
112
114
|
return options.createPaneTemplateItem(intent.template, {
|
|
113
115
|
category: "Panes",
|
|
114
|
-
createOptions:
|
|
116
|
+
createOptions: arg ? { arg } : undefined,
|
|
115
117
|
showShortcut: true,
|
|
116
118
|
shortcutExecution: true,
|
|
117
119
|
});
|
|
@@ -35,7 +35,7 @@ export function buildRootShortcutFeedback({
|
|
|
35
35
|
if (rootShortcutIntent.source === "pane-template") {
|
|
36
36
|
const argKind = getPaneTemplateArgKind(rootShortcutIntent.template);
|
|
37
37
|
if (argKind === "ticker") {
|
|
38
|
-
if (rootShortcutIntent.template.shortcut?.argOptional && !rootShortcutIntent.argText) {
|
|
38
|
+
if (rootShortcutIntent.template.shortcut?.argOptional && !rootShortcutIntent.argText && !rootShortcutIntent.inferredArg) {
|
|
39
39
|
return `Shortcut: ${rootShortcutIntent.label}`;
|
|
40
40
|
}
|
|
41
41
|
// Same ticker the intent inferred: the prompt's, so a linked desk counts.
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
resolvePreferredCollectionTarget,
|
|
18
18
|
resolveSoleCollectionTarget,
|
|
19
19
|
} from "../../workflow/ops";
|
|
20
|
-
import type
|
|
20
|
+
import { shortcutArgument, type parseRootShortcutIntent } from "./shortcuts";
|
|
21
21
|
import { recordFunctionOpen } from "../../../../telemetry/usage-counts";
|
|
22
22
|
|
|
23
23
|
type RootShortcutIntent = ReturnType<typeof parseRootShortcutIntent>;
|
|
@@ -62,11 +62,10 @@ export function buildRootShortcutItem({
|
|
|
62
62
|
if (rootShortcutIntent.kind === "none") return null;
|
|
63
63
|
|
|
64
64
|
if (rootShortcutIntent.source === "pane-template") {
|
|
65
|
+
const arg = shortcutArgument(rootShortcutIntent);
|
|
65
66
|
return createPaneTemplateItem(rootShortcutIntent.template, {
|
|
66
67
|
category: "Panes",
|
|
67
|
-
createOptions:
|
|
68
|
-
? { arg: rootShortcutIntent.argText }
|
|
69
|
-
: undefined,
|
|
68
|
+
createOptions: arg ? { arg } : undefined,
|
|
70
69
|
showShortcut: true,
|
|
71
70
|
shortcutExecution: true,
|
|
72
71
|
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { CommandDef, PaneTemplateDef } from "../../../../types/plugin";
|
|
2
|
+
import { tickerFirstQuery } from "./ticker-first";
|
|
3
|
+
import { kindFromListingSyntax } from "../../../../tickers/instrument-kind";
|
|
4
|
+
import { isRoundTheClockCoin } from "../../../../utils/crypto-pair";
|
|
5
|
+
import { parsePublicTickerKey } from "../../../../utils/exchanges";
|
|
2
6
|
import { getCommandPrefixes, type Command } from "../../commands/registry";
|
|
3
7
|
import { getPaneTemplateDisplayLabel, paneTemplateShortcutPrefixes } from "../../pane-templates/items";
|
|
4
8
|
|
|
@@ -14,6 +18,8 @@ interface ShortcutIntentBase {
|
|
|
14
18
|
argPlaceholder?: string;
|
|
15
19
|
argText: string;
|
|
16
20
|
completionQuery: string | null;
|
|
21
|
+
/** The ticker in focus the argument was filled with, when none was typed. */
|
|
22
|
+
inferredArg?: string;
|
|
17
23
|
}
|
|
18
24
|
|
|
19
25
|
interface CommandShortcutIntent extends ShortcutIntentBase {
|
|
@@ -72,9 +78,9 @@ export function getPluginCommandShortcutArgKind(command: CommandDef): RootShortc
|
|
|
72
78
|
return command.shortcutArg?.kind ?? (command.shortcutArg ? "text" : null);
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
function inferShortcutArg(argKind: RootShortcutArgKind | null, activeTicker: string | null): string | null {
|
|
81
|
+
function inferShortcutArg(argKind: RootShortcutArgKind | null, activeTicker: string | null, issuer = false): string | null {
|
|
76
82
|
if (!activeTicker) return null;
|
|
77
|
-
if (argKind === "ticker" || argKind === "ticker-list") {
|
|
83
|
+
if (argKind === "ticker" || argKind === "ticker-list" || (issuer && argKind === "text")) {
|
|
78
84
|
return activeTicker;
|
|
79
85
|
}
|
|
80
86
|
return null;
|
|
@@ -142,6 +148,28 @@ export function leadingShortcutCode({
|
|
|
142
148
|
.find((candidate) => candidate.prefix === first)?.prefix ?? null;
|
|
143
149
|
}
|
|
144
150
|
|
|
151
|
+
/** What a shortcut opens with: the argument typed, else the ticker in focus an issuer's function took. */
|
|
152
|
+
export function shortcutArgument(intent: Exclude<ShortcutIntent, { kind: "none" }>): string {
|
|
153
|
+
return intent.argText || intent.inferredArg || "";
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** A function whose argument is a company it reports on, which opens on the ticker in focus when none is typed. */
|
|
157
|
+
function takesIssuer(template: PaneTemplateDef | undefined): boolean {
|
|
158
|
+
return template?.shortcut?.focusedIssuer === true;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Whether a ticker in focus can be a company an issuer's function reports on:
|
|
163
|
+
* never an index, a currency or coin pair, a future or a coin (`^VIX`,
|
|
164
|
+
* `EURUSD=X`, `EUR/USD`, `CL=F`, `BTC-USD`), with which CDS and TRACE open
|
|
165
|
+
* market-wide.
|
|
166
|
+
*/
|
|
167
|
+
function canBeIssuer(symbol: string): boolean {
|
|
168
|
+
const { symbol: bare, exchange } = parsePublicTickerKey(symbol);
|
|
169
|
+
if (bare.includes("/") || isRoundTheClockCoin(symbol, exchange)) return false;
|
|
170
|
+
return kindFromListingSyntax(symbol, exchange) == null;
|
|
171
|
+
}
|
|
172
|
+
|
|
145
173
|
export function parseRootShortcutIntent({
|
|
146
174
|
query,
|
|
147
175
|
commands,
|
|
@@ -158,23 +186,38 @@ export function parseRootShortcutIntent({
|
|
|
158
186
|
/** The command prompt's instrument, used when a pane requires a ticker and the focused pane has none. */
|
|
159
187
|
promptTicker?: string | null;
|
|
160
188
|
}): ShortcutIntent {
|
|
161
|
-
const
|
|
162
|
-
if (!
|
|
189
|
+
const typed = query.trim();
|
|
190
|
+
if (!typed) return { kind: "none" };
|
|
163
191
|
|
|
164
|
-
const
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
192
|
+
const candidates = buildShortcutCandidates(commands, pluginCommands, paneTemplates);
|
|
193
|
+
const leading = (text: string) => {
|
|
194
|
+
const upper = text.toUpperCase();
|
|
195
|
+
return candidates.find((candidate) => {
|
|
196
|
+
if (upper === candidate.prefix) return true;
|
|
197
|
+
return !!candidate.argKind && upper.startsWith(`${candidate.prefix} `);
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
let trimmed = typed;
|
|
201
|
+
let match = leading(trimmed);
|
|
202
|
+
if (!match) {
|
|
203
|
+
// Bloomberg's order, the ticker first: `NFE CDS`, `NFE US Equity CDS`.
|
|
204
|
+
const reordered = tickerFirstQuery(typed, (code) => candidates.some((candidate) => candidate.prefix === code && candidate.argKind
|
|
205
|
+
&& (candidate.argKind !== "text" || takesIssuer(candidate.template))));
|
|
206
|
+
match = reordered ? leading(reordered) : undefined;
|
|
207
|
+
if (!reordered || !match) return { kind: "none" };
|
|
208
|
+
trimmed = reordered;
|
|
209
|
+
}
|
|
170
210
|
|
|
171
211
|
const argText = trimmed.slice(match.prefix.length).trim();
|
|
172
|
-
// A pane that requires a ticker takes the one already in the prompt
|
|
173
|
-
//
|
|
212
|
+
// A pane that requires a ticker takes the one already in the prompt, and so
|
|
213
|
+
// does one that takes an issuer (CDS, TRACE). Another optional ticker stays
|
|
214
|
+
// unbound, and other commands keep the focused ticker.
|
|
215
|
+
const issuer = takesIssuer(match.template);
|
|
216
|
+
const focused = promptTicker ?? activeTicker;
|
|
174
217
|
const inferFrom = match.source === "pane-template"
|
|
175
|
-
? (match.template?.shortcut?.argOptional ? null :
|
|
218
|
+
? (match.template?.shortcut?.argOptional && !(issuer && focused && canBeIssuer(focused)) ? null : focused)
|
|
176
219
|
: activeTicker;
|
|
177
|
-
const inferredArg = inferShortcutArg(match.argKind, inferFrom);
|
|
220
|
+
const inferredArg = inferShortcutArg(match.argKind, inferFrom, issuer);
|
|
178
221
|
const completionQuery = inferredArg ? `${match.prefix} ${inferredArg}` : null;
|
|
179
222
|
|
|
180
223
|
let kind: Exclude<ShortcutIntentKind, "none">;
|
|
@@ -195,6 +238,7 @@ export function parseRootShortcutIntent({
|
|
|
195
238
|
argPlaceholder: match.argPlaceholder,
|
|
196
239
|
argText,
|
|
197
240
|
completionQuery,
|
|
241
|
+
...(kind === "inferred-complete" && inferredArg && issuer ? { inferredArg } : {}),
|
|
198
242
|
};
|
|
199
243
|
|
|
200
244
|
if (match.source === "command" && match.command) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { readTerminalListingCode } from "../../../../tickers/terminal-codes";
|
|
2
|
+
|
|
3
|
+
/** A plain ticker, as one word: NFE, BRK.B, 0700, VOD:LSE. */
|
|
4
|
+
const TICKER_WORD = /^\$?[A-Za-z0-9][A-Za-z0-9.\-]{0,11}(?::[A-Za-z0-9]{1,8})?$/;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The ticker a query names before a function code: one word, or a terminal
|
|
8
|
+
* code (`NFE US Equity`, `VOD LN`) read as its listing. Null for anything
|
|
9
|
+
* else, so a company's name stays a search.
|
|
10
|
+
*/
|
|
11
|
+
function tickerBeforeCode(text: string): string | null {
|
|
12
|
+
const words = text.trim().split(/\s+/);
|
|
13
|
+
if (words.length === 1) return TICKER_WORD.test(words[0]!) ? words[0]!.replace(/^\$/, "").toUpperCase() : null;
|
|
14
|
+
return readTerminalListingCode(text)?.key ?? null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A query in Bloomberg's word order, the ticker first, as the bar reads it:
|
|
19
|
+
* `NFE CDS` and `NFE US Equity CDS` are `CDS NFE`, when `takesTicker` says
|
|
20
|
+
* the last word is a function code that takes one. Null for anything else,
|
|
21
|
+
* and for a whole query that is a listing's code, whose market code is a
|
|
22
|
+
* function's too: `SAP GR` is SAP on Xetra, `AMD GF` AMD in Frankfurt,
|
|
23
|
+
* `600519 CG` Moutai in Shanghai.
|
|
24
|
+
*/
|
|
25
|
+
export function tickerFirstQuery(query: string, takesTicker: (code: string) => boolean): string | null {
|
|
26
|
+
const words = query.trim().split(/\s+/);
|
|
27
|
+
if (words.length < 2 || readTerminalListingCode(query) != null) return null;
|
|
28
|
+
const code = words.at(-1)!.toUpperCase();
|
|
29
|
+
if (!takesTicker(code)) return null;
|
|
30
|
+
const ticker = tickerBeforeCode(words.slice(0, -1).join(" "));
|
|
31
|
+
return ticker ? `${code} ${ticker}` : null;
|
|
32
|
+
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "../../../state/app/context";
|
|
12
12
|
import { scheduleConfigSave } from "../../../state/config-save-scheduler";
|
|
13
13
|
import { commands } from "../commands/registry";
|
|
14
|
+
import { getDesktopWindows } from "../../../state/desktop-windows";
|
|
14
15
|
import type { ThemePickerHandle } from "../theme-picker";
|
|
15
16
|
import type { ListScreenState } from "../list/model";
|
|
16
17
|
|
|
@@ -97,6 +98,7 @@ export function useCommandBarEnvironment() {
|
|
|
97
98
|
() => commands.filter((command) => {
|
|
98
99
|
if (command.id === "cycle-chart-renderer") return !nativePaneChrome;
|
|
99
100
|
if (command.id === "minimize-window" || command.id === "maximize-window") return drawsWindowControls;
|
|
101
|
+
if (command.id === "new-window") return getDesktopWindows() !== null;
|
|
100
102
|
return true;
|
|
101
103
|
}),
|
|
102
104
|
[drawsWindowControls, nativePaneChrome],
|
|
@@ -192,6 +192,12 @@ const EXACT_MATCH_SECTION_PRIORITY = -150;
|
|
|
192
192
|
* so it sits under an exact symbol and above the AI's guess.
|
|
193
193
|
*/
|
|
194
194
|
const DID_YOU_MEAN_SECTION_PRIORITY = -120;
|
|
195
|
+
/**
|
|
196
|
+
* The offer to add a list pasted into the bar (`Add 12 symbols to a
|
|
197
|
+
* watchlist`): what the user put in, so it sits above the AI's reading of it.
|
|
198
|
+
*/
|
|
199
|
+
export const PASTED_LIST_CATEGORY = "Pasted list";
|
|
200
|
+
const PASTED_LIST_SECTION_PRIORITY = -110;
|
|
195
201
|
/**
|
|
196
202
|
* The AI leads the rest even though it is the slowest source (~600ms+): it
|
|
197
203
|
* translates the sentence the user typed into commands, which is the answer to
|
|
@@ -219,6 +225,7 @@ function getCategoryPriority(category: string, options?: CommandBarSectionOption
|
|
|
219
225
|
if (normalized === "exact match") return EXACT_MATCH_SECTION_PRIORITY;
|
|
220
226
|
if (normalized === "did you mean") return DID_YOU_MEAN_SECTION_PRIORITY;
|
|
221
227
|
if (category === PLUGIN_INSTALL_CATEGORY) return PLUGIN_INSTALL_SECTION_PRIORITY;
|
|
228
|
+
if (category === PASTED_LIST_CATEGORY) return PASTED_LIST_SECTION_PRIORITY;
|
|
222
229
|
if (normalized === "instruments") return INSTRUMENTS_SECTION_PRIORITY;
|
|
223
230
|
if (normalized === "suggested") return SUGGESTED_SECTION_PRIORITY;
|
|
224
231
|
if (sectionOrder === "app-first") {
|
|
@@ -170,7 +170,8 @@ async function resolvePaneTemplateOptions(
|
|
|
170
170
|
const rawInput = resolvedOptions?.arg ?? resolvedOptions?.values?.tickers ?? "";
|
|
171
171
|
const symbols = !String(rawInput).trim() && template.shortcut?.openWithoutArg
|
|
172
172
|
? []
|
|
173
|
-
: await resolveTickerListInput(rawInput, baseContext.activeCollectionId, deps, template.shortcut?.keepArgToken
|
|
173
|
+
: await resolveTickerListInput(rawInput, baseContext.activeCollectionId, deps, template.shortcut?.keepArgToken,
|
|
174
|
+
{ maximum: template.headless?.argument.maximum });
|
|
174
175
|
resolvedOptions = {
|
|
175
176
|
...resolvedOptions,
|
|
176
177
|
arg: rawInput,
|
|
@@ -4,6 +4,7 @@ import type { AppAction, AppState } from "../../../state/app/context";
|
|
|
4
4
|
import type { AppTickerRepositoryPort } from "../../../core/app-service-ports";
|
|
5
5
|
import type { PluginRegistry } from "../../../plugins/registry";
|
|
6
6
|
import { isManualPortfolio } from "../../../portfolio/mutations";
|
|
7
|
+
import { findNamedCollection, readWatchlistArgument } from "../../../portfolio/collection-name";
|
|
7
8
|
import type { DataProvider } from "../../../types/data-provider";
|
|
8
9
|
import type { Portfolio, TickerRecord, Watchlist } from "../../../types/ticker";
|
|
9
10
|
import { AmbiguousTickerError, resolveTickerSearch, upsertTickerFromSearchResult } from "../../../tickers/search";
|
|
@@ -260,12 +261,31 @@ export async function applyCollectionMembershipChange(
|
|
|
260
261
|
return result;
|
|
261
262
|
}
|
|
262
263
|
|
|
264
|
+
/** How a function reads a list argument that names a watchlist: at most `maximum` symbols, its note pushed to `notes`. */
|
|
265
|
+
export interface TickerListReading {
|
|
266
|
+
maximum?: number;
|
|
267
|
+
notes?: string[];
|
|
268
|
+
}
|
|
269
|
+
|
|
263
270
|
export async function resolveTickerListInput(
|
|
264
271
|
rawInput: string,
|
|
265
272
|
collectionId: string | null,
|
|
266
273
|
deps: SharedWorkflowDeps,
|
|
267
274
|
keepToken?: (token: string) => boolean,
|
|
275
|
+
reading?: TickerListReading,
|
|
268
276
|
): Promise<string[]> {
|
|
277
|
+
// A watchlist's name stands for its symbols, as `fn` reads it (`SIW HY3`), with the note saying so.
|
|
278
|
+
const state = deps.getState();
|
|
279
|
+
const watchlist = /[,;\n]/.test(rawInput) ? null : findNamedCollection(state.config.watchlists, rawInput);
|
|
280
|
+
const members = watchlist
|
|
281
|
+
? [...state.tickers.values()].filter((ticker) => ticker.metadata.watchlists.includes(watchlist.id)).map((ticker) => ticker.metadata.ticker)
|
|
282
|
+
: [];
|
|
283
|
+
if (watchlist && members.length > 0) {
|
|
284
|
+
const read = readWatchlistArgument(rawInput, watchlist, members, reading?.maximum);
|
|
285
|
+
reading?.notes?.push(read.note);
|
|
286
|
+
return read.symbols;
|
|
287
|
+
}
|
|
288
|
+
|
|
269
289
|
const tokens = parseTickerListInput(rawInput);
|
|
270
290
|
const symbols: string[] = [];
|
|
271
291
|
const seen = new Set<string>();
|