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.
Files changed (316) hide show
  1. package/README.md +3 -1
  2. package/README.zh-CN.md +1 -1
  3. package/bin/gloom +9 -0
  4. package/bin/without-bun.cjs +98 -0
  5. package/package.json +4 -1
  6. package/src/api-client/data.ts +148 -37
  7. package/src/api-client/hk-tenders.ts +59 -0
  8. package/src/api-client/index.ts +1 -0
  9. package/src/api-client/types/econ.ts +30 -0
  10. package/src/api-client/yield-curves.ts +1 -1
  11. package/src/app/global-shortcuts.ts +4 -1
  12. package/src/app/keybindings/actions.ts +6 -0
  13. package/src/app/keybindings/config.ts +2 -1
  14. package/src/app/keybindings/index.ts +1 -0
  15. package/src/app/keybindings/labels.ts +6 -1
  16. package/src/app/keybindings/resolve.ts +23 -4
  17. package/src/app/keybindings/terminal-keys.ts +35 -0
  18. package/src/app/pane-runtime/index.tsx +2 -2
  19. package/src/app/pane-runtime/ticker-open-runtime.ts +68 -40
  20. package/src/app.tsx +18 -13
  21. package/src/architecture/floating-promise-allowlist.json +313 -0
  22. package/src/architecture/ui-literals-allowlist.json +1 -1
  23. package/src/capabilities/chart-series.ts +27 -1
  24. package/src/cli/commands/keybindings.ts +5 -5
  25. package/src/cli/commands/market.ts +238 -57
  26. package/src/cli/commands/news-search.ts +81 -14
  27. package/src/cli/commands/overview.ts +27 -6
  28. package/src/cli/commands/remote.ts +16 -17
  29. package/src/cli/commands/system.ts +1 -1
  30. package/src/cli/commands/ticker.ts +3 -1
  31. package/src/cli/early-command.ts +2 -0
  32. package/src/cli/errors.ts +10 -1
  33. package/src/cli/fx-forward.ts +89 -7
  34. package/src/cli/fx-pair.ts +1 -1
  35. package/src/cli/fx-quote-rate.ts +23 -0
  36. package/src/cli/glossary.ts +19 -5
  37. package/src/cli/help.ts +1 -0
  38. package/src/cli/history-rows.ts +5 -3
  39. package/src/cli/index-roots.ts +5 -4
  40. package/src/cli/index.ts +40 -3
  41. package/src/cli/known-gaps.ts +38 -9
  42. package/src/cli/listing-arg.ts +17 -5
  43. package/src/cli/name-entries.ts +5 -1
  44. package/src/cli/not-a-ticker.ts +4 -0
  45. package/src/cli/options.ts +52 -3
  46. package/src/cli/output-file.ts +5 -3
  47. package/src/cli/pane-functions/catalog.ts +15 -0
  48. package/src/cli/pane-functions/function-help.ts +4 -4
  49. package/src/cli/pane-functions/headless.ts +9 -4
  50. package/src/cli/pane-functions/index.ts +6 -4
  51. package/src/cli/pane-functions/resolver.ts +2 -2
  52. package/src/cli/result.ts +21 -2
  53. package/src/cli/spreadsheet-hint.ts +7 -3
  54. package/src/cli/treasury-yields.ts +5 -3
  55. package/src/components/chart/composite/legend.tsx +40 -2
  56. package/src/components/command-bar/pane-settings.ts +2 -2
  57. package/src/components/command-bar/routes/root/results.ts +6 -2
  58. package/src/components/command-bar/workflow/tickers.ts +2 -2
  59. package/src/components/data-table/view.tsx +9 -2
  60. package/src/components/input-search-bar.tsx +9 -2
  61. package/src/components/layout/pane/header.tsx +2 -0
  62. package/src/components/layout/shell/pane/capture.ts +4 -1
  63. package/src/components/layout/status-bar.tsx +6 -1
  64. package/src/components/onboarding/first-run-workspace.ts +44 -2
  65. package/src/components/onboarding/onboarding-frame.tsx +11 -2
  66. package/src/components/onboarding/onboarding-keyboard.ts +16 -0
  67. package/src/components/onboarding/onboarding-wizard.tsx +8 -8
  68. package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
  69. package/src/components/onboarding/use-onboarding-progress.ts +12 -4
  70. package/src/components/pane-settings-dialog/desktop.tsx +2 -2
  71. package/src/components/pane-settings-dialog/tui.tsx +2 -2
  72. package/src/components/pane-settings-dialog/value.ts +6 -0
  73. package/src/components/pane-settings-dialog.tsx +3 -3
  74. package/src/components/reader/detail-reader.tsx +4 -0
  75. package/src/components/ui/data-table/opentui/index.tsx +11 -4
  76. package/src/components/ui/data-table/opentui/model.ts +8 -6
  77. package/src/components/ui/data-table/types.ts +6 -1
  78. package/src/components/ui/index.ts +1 -1
  79. package/src/components/ui/page-stack-view.tsx +3 -0
  80. package/src/components/ui/pane-link-chip.tsx +269 -54
  81. package/src/components/ui/query-bar.tsx +2 -1
  82. package/src/components/ui/table-layout.ts +38 -1
  83. package/src/components/ui/tabs.tsx +97 -19
  84. package/src/core/state/app/layout-reducer.ts +7 -0
  85. package/src/core/state/app/layout.ts +44 -7
  86. package/src/core/state/app/state.ts +1 -1
  87. package/src/core/state/app/types.ts +22 -2
  88. package/src/docs/snapshot.json +30 -13
  89. package/src/market-data/depositary-pair.ts +5 -3
  90. package/src/market-data/market/change-basis.ts +9 -5
  91. package/src/market-data/market/dated-previous-close.ts +147 -17
  92. package/src/market-data/market/status.ts +17 -1
  93. package/src/market-data/quotes/contributions.ts +2 -0
  94. package/src/market-data/quotes/listing-enterprise-value.ts +50 -0
  95. package/src/plugins/builtin/alerts/metric-data.ts +15 -2
  96. package/src/plugins/builtin/analytics/risk-client.ts +10 -4
  97. package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
  98. package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
  99. package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
  100. package/src/plugins/builtin/awards/index.tsx +1 -1
  101. package/src/plugins/builtin/backtest/headless.ts +1 -1
  102. package/src/plugins/builtin/buildout/index.tsx +1 -0
  103. package/src/plugins/builtin/catalysts/index.tsx +2 -2
  104. package/src/plugins/builtin/cds/headless.ts +4 -0
  105. package/src/plugins/builtin/cds/model.ts +0 -6
  106. package/src/plugins/builtin/chart-composer/formula.ts +16 -3
  107. package/src/plugins/builtin/chart-composer/headless-schema.ts +2 -0
  108. package/src/plugins/builtin/chart-composer/headless.ts +4 -2
  109. package/src/plugins/builtin/chart-composer/index.tsx +1 -0
  110. package/src/plugins/builtin/chart-composer/presets.ts +1 -0
  111. package/src/plugins/builtin/chat/content/composer.tsx +5 -4
  112. package/src/plugins/builtin/chat/content/index.tsx +12 -2
  113. package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
  114. package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
  115. package/src/plugins/builtin/chat/layout.ts +5 -2
  116. package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
  117. package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
  118. package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
  119. package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
  120. package/src/plugins/builtin/cloud/askg/pane.tsx +55 -13
  121. package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
  122. package/src/plugins/builtin/cloud/terminal-relay/redact.ts +5 -3
  123. package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
  124. package/src/plugins/builtin/company-attention/index.tsx +1 -1
  125. package/src/plugins/builtin/company-kpis/headless.ts +3 -1
  126. package/src/plugins/builtin/company-kpis/index.tsx +2 -2
  127. package/src/plugins/builtin/cot/index.tsx +1 -1
  128. package/src/plugins/builtin/cpi/index.tsx +1 -1
  129. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +20 -7
  130. package/src/plugins/builtin/credit-boards/client.ts +8 -0
  131. package/src/plugins/builtin/credit-boards/headless.ts +4 -1
  132. package/src/plugins/builtin/credit-boards/model.ts +58 -4
  133. package/src/plugins/builtin/credit-boards/series.ts +63 -6
  134. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +3 -2
  135. package/src/plugins/builtin/credit-conditions/headless.ts +24 -6
  136. package/src/plugins/builtin/credit-conditions/index.tsx +1 -1
  137. package/src/plugins/builtin/credit-conditions/model.ts +12 -6
  138. package/src/plugins/builtin/credit-conditions/series.ts +2 -1
  139. package/src/plugins/builtin/crypto-board/index.tsx +1 -0
  140. package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
  141. package/src/plugins/builtin/doe/index.tsx +1 -1
  142. package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
  143. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  144. package/src/plugins/builtin/econ/calendar-model.ts +115 -8
  145. package/src/plugins/builtin/econ/calendar-source.ts +7 -1
  146. package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
  147. package/src/plugins/builtin/econ/index.tsx +42 -8
  148. package/src/plugins/builtin/econ/types.ts +3 -0
  149. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  150. package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
  151. package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
  152. package/src/plugins/builtin/executives/index.tsx +1 -0
  153. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  154. package/src/plugins/builtin/fixed-income/index.tsx +3 -0
  155. package/src/plugins/builtin/futures-curve/headless.ts +3 -3
  156. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  157. package/src/plugins/builtin/futures-curve/model.ts +18 -0
  158. package/src/plugins/builtin/fx-matrix/index.tsx +44 -14
  159. package/src/plugins/builtin/gpu/index.tsx +1 -1
  160. package/src/plugins/builtin/help/functions-table.tsx +1 -1
  161. package/src/plugins/builtin/help/index.tsx +11 -1
  162. package/src/plugins/builtin/help/keybindings-editor.tsx +7 -3
  163. package/src/plugins/builtin/holders/index.tsx +1 -0
  164. package/src/plugins/builtin/holders/report-header.ts +2 -2
  165. package/src/plugins/builtin/insider/index.tsx +1 -0
  166. package/src/plugins/builtin/iv-history/index.tsx +1 -1
  167. package/src/plugins/builtin/jobs/index.tsx +1 -0
  168. package/src/plugins/builtin/macro-day/headless.ts +27 -8
  169. package/src/plugins/builtin/macro-day/index.tsx +1 -1
  170. package/src/plugins/builtin/macro-day/model.ts +19 -3
  171. package/src/plugins/builtin/macro-day/pane.tsx +14 -9
  172. package/src/plugins/builtin/macro-day/releases.ts +25 -7
  173. package/src/plugins/builtin/market-valuation/index.tsx +1 -0
  174. package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
  175. package/src/plugins/builtin/members/index.tsx +1 -1
  176. package/src/plugins/builtin/mna/index.tsx +1 -0
  177. package/src/plugins/builtin/news/index.tsx +1 -0
  178. package/src/plugins/builtin/news/wire/index.tsx +5 -1
  179. package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
  180. package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
  181. package/src/plugins/builtin/options/index.tsx +1 -0
  182. package/src/plugins/builtin/options-positioning/index.tsx +1 -0
  183. package/src/plugins/builtin/pe-band/index.tsx +1 -1
  184. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
  185. package/src/plugins/builtin/portfolio-list/cli/render.ts +20 -3
  186. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +5 -1
  187. package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
  188. package/src/plugins/builtin/power/index.tsx +1 -1
  189. package/src/plugins/builtin/realized-vol/index.tsx +1 -1
  190. package/src/plugins/builtin/research/headless-schema.ts +4 -3
  191. package/src/plugins/builtin/research/headless.ts +10 -4
  192. package/src/plugins/builtin/research/index.tsx +4 -0
  193. package/src/plugins/builtin/research/relative-valuation-columns.ts +145 -47
  194. package/src/plugins/builtin/research/relative-valuation-currency.ts +31 -0
  195. package/src/plugins/builtin/research/relative-valuation-headless.ts +25 -8
  196. package/src/plugins/builtin/research/relative-valuation-model.ts +40 -9
  197. package/src/plugins/builtin/research/relative-valuation-pane.tsx +3 -2
  198. package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -2
  199. package/src/plugins/builtin/research-search/index.tsx +1 -0
  200. package/src/plugins/builtin/research-search/pane.tsx +8 -0
  201. package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
  202. package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
  203. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  204. package/src/plugins/builtin/scanner/headless.ts +52 -13
  205. package/src/plugins/builtin/seasonality/index.tsx +1 -1
  206. package/src/plugins/builtin/sec/index.tsx +1 -0
  207. package/src/plugins/builtin/series-inventory.ts +1 -1
  208. package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
  209. package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
  210. package/src/plugins/builtin/short-interest/index.tsx +1 -0
  211. package/src/plugins/builtin/social-mentions/index.tsx +1 -1
  212. package/src/plugins/builtin/supply-chain/index.tsx +1 -0
  213. package/src/plugins/builtin/thirteenf/api.ts +47 -4
  214. package/src/plugins/builtin/thirteenf/data.ts +43 -10
  215. package/src/plugins/builtin/thirteenf/headless.ts +55 -11
  216. package/src/plugins/builtin/thirteenf/model.ts +25 -9
  217. package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
  218. package/src/plugins/builtin/thirteenf/types.ts +2 -0
  219. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
  220. package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +8 -7
  221. package/src/plugins/builtin/ticker-detail/data-panes/history-bars.ts +8 -5
  222. package/src/plugins/builtin/ticker-detail/financials/model.ts +18 -2
  223. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
  224. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +6 -6
  225. package/src/plugins/builtin/ticker-detail/headless.ts +24 -17
  226. package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
  227. package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
  228. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +6 -4
  229. package/src/plugins/builtin/time-sales/client.ts +9 -11
  230. package/src/plugins/builtin/time-sales/index.tsx +1 -1
  231. package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
  232. package/src/plugins/builtin/treasury-auctions/cache.ts +54 -5
  233. package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
  234. package/src/plugins/builtin/treasury-auctions/headless.ts +150 -22
  235. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +126 -0
  236. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +347 -0
  237. package/src/plugins/builtin/treasury-auctions/hk.ts +363 -0
  238. package/src/plugins/builtin/treasury-auctions/index.tsx +27 -4
  239. package/src/plugins/builtin/treasury-auctions/model.ts +264 -28
  240. package/src/plugins/builtin/treasury-auctions/pane.tsx +176 -41
  241. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
  242. package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
  243. package/src/plugins/builtin/vol-surface/index.tsx +1 -1
  244. package/src/plugins/builtin/world-venue-map/index.ts +1 -0
  245. package/src/plugins/builtin/yield-curve/curves.ts +10 -4
  246. package/src/plugins/builtin/yield-curve/headless.ts +6 -2
  247. package/src/plugins/builtin/yield-curve/index.tsx +3 -3
  248. package/src/plugins/builtin/yield-curve/series.ts +10 -0
  249. package/src/plugins/builtin/yield-curve/world.ts +3 -1
  250. package/src/portfolio/collection-name.ts +22 -0
  251. package/src/portfolio/column-values.ts +2 -1
  252. package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
  253. package/src/public/remote.ts +7 -1
  254. package/src/remote/client.ts +191 -11
  255. package/src/remote/controller-utils.ts +13 -1
  256. package/src/remote/controller.ts +88 -26
  257. package/src/remote/endpoint.ts +24 -0
  258. package/src/remote/form.ts +59 -4
  259. package/src/remote/resources.ts +44 -18
  260. package/src/remote/schema.ts +21 -9
  261. package/src/remote/secrets.ts +12 -0
  262. package/src/remote/semantic-tree.tsx +14 -2
  263. package/src/remote/server.ts +2 -1
  264. package/src/remote/surface.tsx +192 -0
  265. package/src/remote/types.ts +5 -0
  266. package/src/renderers/dom/data-table/frozen-column.ts +3 -1
  267. package/src/renderers/dom/data-table/index.tsx +27 -9
  268. package/src/renderers/dom/data-table/row.tsx +2 -0
  269. package/src/renderers/electrobun/bun/desktop/backend.ts +27 -24
  270. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +3 -3
  271. package/src/renderers/electrobun/bun/desktop/snapshot-commit.ts +77 -0
  272. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  273. package/src/renderers/electrobun/view/backend-rpc.ts +3 -0
  274. package/src/renderers/electrobun/view/desktop/window/bridge.ts +3 -0
  275. package/src/renderers/opentui/host.tsx +6 -0
  276. package/src/series/standalone.ts +2 -2
  277. package/src/shares/api.ts +21 -4
  278. package/src/shares/item.ts +73 -0
  279. package/src/shares/pane-item.ts +205 -0
  280. package/src/shares/pane.ts +4 -0
  281. package/src/shares/payload.ts +9 -5
  282. package/src/sources/gloomberb-cloud/news.ts +2 -0
  283. package/src/sources/gloomberb-cloud/normalizers.ts +9 -5
  284. package/src/sources/provider-router/cache.ts +3 -1
  285. package/src/sync/controller.ts +17 -2
  286. package/src/sync/other-window-tabs.ts +32 -1
  287. package/src/sync/react.ts +4 -4
  288. package/src/tickers/renamed-listings.ts +105 -0
  289. package/src/tickers/search/index.ts +103 -16
  290. package/src/time-series/bar-spacing.ts +33 -0
  291. package/src/time-series/base-series.ts +21 -3
  292. package/src/time-series/chart-bounds.ts +31 -0
  293. package/src/time-series/field-catalog.ts +17 -0
  294. package/src/time-series/fundamentals.ts +143 -11
  295. package/src/time-series/ice-credit.ts +32 -6
  296. package/src/time-series/resolve.ts +11 -7
  297. package/src/time-series/session-bar.ts +78 -9
  298. package/src/time-series/studies/formula.ts +53 -10
  299. package/src/time-series/studies/pair.ts +18 -7
  300. package/src/time-series/studies/units.ts +49 -2
  301. package/src/time-series/types.ts +12 -0
  302. package/src/types/desktop-window.ts +2 -0
  303. package/src/types/financials.ts +7 -0
  304. package/src/types/headless.ts +8 -0
  305. package/src/types/plugin-pane-settings.ts +2 -0
  306. package/src/types/plugin-panes.ts +22 -0
  307. package/src/utils/central-banks.ts +86 -1
  308. package/src/utils/cli-output.ts +6 -3
  309. package/src/utils/datetime-format.ts +12 -3
  310. package/src/utils/depositary-receipt.ts +28 -3
  311. package/src/utils/ebitda.ts +128 -0
  312. package/src/utils/format.ts +1 -1
  313. package/src/utils/fundamentals.ts +14 -0
  314. package/src/utils/max-drawdown.ts +97 -16
  315. package/src/utils/shell-word.ts +13 -0
  316. package/src/utils/untrusted-text.ts +29 -0
package/src/cli/result.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  cliPlainEnabled,
4
4
  cliStyles,
5
5
  cliTerminalWidth,
6
+ renderForFile,
6
7
  renderStats,
7
8
  renderTable,
8
9
  statValueWidth,
@@ -623,6 +624,19 @@ function renderTextRows<T, Row extends Record<string, unknown>>(
623
624
  : renderTextTable(rows as Row[], columns, renderOptions.rowNote);
624
625
  }
625
626
 
627
+ /** What `printCliResult` drew for the file `--output` names, since `takeCliFileExport` last took it. */
628
+ let fileExport: string[] = [];
629
+
630
+ /**
631
+ * The export a command printed for its `--output` file, or null when it
632
+ * printed none: the text the file is written with (dispatchCli).
633
+ */
634
+ export function takeCliFileExport(): string | null {
635
+ const taken = fileExport.filter(Boolean);
636
+ fileExport = [];
637
+ return taken.length > 0 ? taken.join("\n") : null;
638
+ }
639
+
626
640
  /** Settles once the result `printCliResult` last wrote has left the process: a pipe can hold it back. */
627
641
  let stdoutWritten: Promise<void> = Promise.resolve();
628
642
 
@@ -644,13 +658,18 @@ export function printCliResult<T, Row extends Record<string, unknown> = Record<s
644
658
  if (options.quiet && options.format === "text") return;
645
659
  // JSON keeps the router's own words; everything else is for a person, so a "Not a ticker" gets its hint.
646
660
  const hinted = (text: string) => options.format === "json" ? text : withSearchHints(text, args, isFredSeries);
647
- const serialized = hinted(serializeCliResult(result, options, renderOptions));
661
+ // An export `--output` names is drawn for the file (no colour), and held for the command's end to write.
662
+ const toFile = options.output !== undefined && options.format !== "text";
663
+ const serialized = hinted(toFile
664
+ ? renderForFile(() => serializeCliResult(result, options, renderOptions))
665
+ : serializeCliResult(result, options, renderOptions));
648
666
  // A CSV's closing source and note lines go to stderr with the warnings: in the file they are rows of junk to a spreadsheet.
649
667
  const { csv, footer } = options.format === "csv" ? splitCsvFooter(serialized) : { csv: serialized, footer: [] };
650
668
  const output = csv;
669
+ if (toFile) fileExport.push(output);
651
670
  // Bun's console writer can truncate a large pipe write after stdout has been
652
671
  // initialized. The stream queues the remaining bytes until the reader drains.
653
- if (output && !process.stdout.write(`${output}\n`)) {
672
+ else if (output && !process.stdout.write(`${output}\n`)) {
654
673
  stdoutWritten = new Promise((resolve) => process.stdout.once("drain", () => resolve()));
655
674
  }
656
675
  // JSON carries warnings in its envelope. Text, CSV and NDJSON are only the
@@ -1,12 +1,15 @@
1
+ import { commandWord } from "../utils/shell-word";
2
+
1
3
  /** Spreadsheet formats people ask for by name, which no command writes: CSV is the one a spreadsheet opens. */
2
4
  const SPREADSHEET_OPTIONS = new Set(["--xlsx", "--xls", "--excel", "--spreadsheet", "--sheet", "--sheets", "--tsv"]);
3
5
 
4
6
  /** A file named after a spreadsheet flag (`--xlsx rates.xlsx`), which becomes the CSV's name. */
5
7
  const SPREADSHEET_FILE = /\.(xlsx|xls|tsv)$/i;
6
8
 
7
- /** An argument as a shell reads it back: quoted when it holds a space or a character the shell acts on. */
9
+ /** An argument as a shell reads it back: quoted when it holds a space or a character the shell acts on; `"^TNX"` for cmd.exe. */
8
10
  function shellWord(arg: string): string {
9
- return /^[\w^=.,:/@%+-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", "'\\''")}'`;
11
+ if (!/^[\w^=.,:/@%+-]+$/.test(arg)) return `'${arg.replaceAll("'", "'\\''")}'`;
12
+ return arg.includes("^") ? commandWord(arg) : arg;
10
13
  }
11
14
 
12
15
  /**
@@ -39,5 +42,6 @@ export function spreadsheetOptionHint(flag: string, command: string, args: reado
39
42
  // Named after the command, a function by its code (`fn QQ`: qq.csv).
40
43
  const named = command.trim().split(/\s+/).filter((word, index) => index > 0 || word !== "fn");
41
44
  const output = file ? file.replace(SPREADSHEET_FILE, ".csv") : `${named.join("-").toLowerCase()}.csv`;
42
- return `Exports are --csv (opens in Excel and Google Sheets), --json or --ndjson: gloom ${words.map(shellWord).join(" ")} --csv > ${shellWord(output)}.`;
45
+ // --output writes the file in UTF-8 in every shell, where `>` is UTF-16 in Windows PowerShell 5.1.
46
+ return `Exports are --csv (opens in Excel and Google Sheets), --json or --ndjson: gloom ${words.map(shellWord).join(" ")} --csv --output ${shellWord(output)}.`;
43
47
  }
@@ -1,3 +1,5 @@
1
+ import { commandWord } from "../utils/shell-word";
2
+
1
3
  /**
2
4
  * A US Treasury yield typed as if it were a ticker: US10Y, UST10Y, US10YR,
3
5
  * USGG10YR, 10Y, TNX, "10 year yield". None is a ticker (TNX is TenX
@@ -68,18 +70,18 @@ export function treasuryYieldTenor(text: string): TreasuryYieldTenor | null {
68
70
  /** The commands with the yield: its Cboe index when there is one, its FRED series, the curve. */
69
71
  function yieldCommands(tenor: TreasuryYieldTenor): Array<readonly [command: string, gives: string]> {
70
72
  return [
71
- ...tenor.index ? [[`gloom quote ${tenor.index}`, "Cboe index"] as const] : [],
73
+ ...tenor.index ? [[`gloom quote ${commandWord(tenor.index)}`, "Cboe index"] as const] : [],
72
74
  [`gloom fred ${tenor.fred}`, "daily"],
73
75
  ["gloom yield-curve", "every tenor"],
74
76
  ];
75
77
  }
76
78
 
77
- /** "US 10-year Treasury yield: gloom quote ^TNX (Cboe index), ...", for `search`, `catalog` and a bare root. */
79
+ /** `US 10-year Treasury yield: gloom quote "^TNX" (Cboe index), ...`, for `search`, `catalog` and a bare root. */
78
80
  export function treasuryYieldLine(tenor: TreasuryYieldTenor): string {
79
81
  return `US ${tenor.label} Treasury yield: ${yieldCommands(tenor).map(([command, gives]) => `${command} (${gives})`).join(", ")}.`;
80
82
  }
81
83
 
82
- /** "Try `gloom quote ^TNX`, ... for the US 10-year Treasury yield.", after "Not a ticker: US10Y." */
84
+ /** "Try `gloom quote \"^TNX\"`, ... for the US 10-year Treasury yield.", after "Not a ticker: US10Y." */
83
85
  export function treasuryYieldHint(tenor: TreasuryYieldTenor): string {
84
86
  const commands = yieldCommands(tenor).map(([command]) => `\`${command}\``);
85
87
  return `Try ${commands.slice(0, -1).join(", ")} or ${commands.at(-1)} for the US ${tenor.label} Treasury yield.`;
@@ -2,7 +2,7 @@ import { memo, useEffect, useRef } from "react";
2
2
  import { Box, ScrollBox, Span, Text, useShortcutLabel, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
3
3
  import { colors as themeColors, hoverBg } from "../../../theme/colors";
4
4
  import { CANONICAL_EXCHANGE_ALIASES } from "../../../utils/exchanges";
5
- import { displayWidth, formatPercentRaw, truncateToDisplayWidth } from "../../../utils/format";
5
+ import { displayWidth, formatPercentRaw, truncateToDisplayWidth, truncateToWidth } from "../../../utils/format";
6
6
  import type { ResolvedSeries } from "../../../time-series/types";
7
7
  import { consumeChartMouseEvent, type ChartMouseEvent } from "../core/pointer";
8
8
  import {
@@ -99,6 +99,43 @@ function withoutListingExchange(label: string): string {
99
99
  ));
100
100
  }
101
101
 
102
+ /** Characters two labels start with alike. */
103
+ function sharedStart(left: string, right: string): number {
104
+ let index = 0;
105
+ while (index < left.length && index < right.length && left[index] === right[index]) index += 1;
106
+ return index;
107
+ }
108
+
109
+ /** The last characters of `value` that fit in `width` cells. */
110
+ function tailToWidth(value: string, width: number): string {
111
+ let tail = "";
112
+ for (const char of [...value].reverse()) {
113
+ if (displayWidth(char + tail) > width) break;
114
+ tail = char + tail;
115
+ }
116
+ return tail;
117
+ }
118
+
119
+ /**
120
+ * A legend name cut to `width` cells so it still tells itself from the other
121
+ * names in the legend: cut at its end while what shows gets past the start it
122
+ * shares with another; otherwise its head, `...`, then the end of what follows
123
+ * that shared start. `HY - IG` beside `HY` keeps `- IG`, and two formulas on
124
+ * one first leg keep their second (`FRED:BA...C0A0CM`, `FRED:BA...spread`).
125
+ */
126
+ export function distinguishingLabelCut(label: string, width: number, others: readonly string[]): string {
127
+ const plain = truncateToDisplayWidth(label, width);
128
+ if (plain === label || width <= 6) return plain;
129
+ const shared = Math.max(0, ...others.filter((other) => other !== label).map((other) => sharedStart(label, other)));
130
+ const stem = truncateToWidth(label, width - 3);
131
+ const rest = label.slice(shared).trimStart();
132
+ if (stem.length > shared || !rest) return plain;
133
+ // The end of the rest gets the room a third of a head leaves, the head whatever a short rest leaves over.
134
+ const room = width - 3;
135
+ const head = truncateToWidth(label, Math.min(room - 1, Math.max(Math.max(1, Math.floor(room / 3)), room - displayWidth(rest)))).trimEnd();
136
+ return `${head}...${tailToWidth(rest, room - displayWidth(head))}`;
137
+ }
138
+
102
139
  /**
103
140
  * Entries laid left to right into lines of `available` cells, one cell apart,
104
141
  * a new line when the next does not fit. With `maxLines`, what does not fit in
@@ -311,7 +348,8 @@ export function CompositeLegend({
311
348
  const setEntryLabel = (target: LegendEntry, label: string, labelWidth: number) => {
312
349
  target.label = label;
313
350
  target.labelWidth = labelWidth;
314
- target.text = [truncateToDisplayWidth(label, labelWidth), target.valueText].filter(Boolean).join(" ");
351
+ const others = entries.filter((other) => other !== target).map((other) => other.compactLabel);
352
+ target.text = [distinguishingLabelCut(label, labelWidth, others), target.valueText].filter(Boolean).join(" ");
315
353
  target.width = Math.max(1, displayWidth(target.text)) + target.markerWidth;
316
354
  };
317
355
  const measureSeriesWidth = () => entries.reduce(
@@ -1,7 +1,7 @@
1
1
  import type { PluginRegistry } from "../../plugins/registry";
2
2
  import { fuzzyFilter } from "../../utils/fuzzy-search";
3
3
  import type { ResultItem } from "./list/model";
4
- import { summarizePaneSettingValue } from "../pane-settings-dialog/value";
4
+ import { paneSettingValue, summarizePaneSettingValue } from "../pane-settings-dialog/value";
5
5
 
6
6
  /**
7
7
  * The focused pane's settings as root search results. The bar only finds a
@@ -21,7 +21,7 @@ export function buildPaneSettingResultItems(options: {
21
21
  const category = descriptor.settingsDef.title || "Pane Settings";
22
22
  const paneLabel = descriptor.pane.title || descriptor.paneDef.name || descriptor.pane.paneId;
23
23
  const items = descriptor.settingsDef.fields.map((field): ResultItem => {
24
- const currentValue = descriptor.context.settings[field.key];
24
+ const currentValue = paneSettingValue(field, descriptor.context.settings);
25
25
  const actionSearchText = field.type === "action"
26
26
  ? `${field.actionId} ${field.actionLabel ?? ""}`
27
27
  : "";
@@ -409,14 +409,18 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
409
409
  .filter((command) => command.id !== "quit")
410
410
  .map((command) => commandToItem(command))
411
411
  .filter((item): item is ResultItem => item !== null);
412
+ const pluginItems = pluginCommandItems();
413
+ // A layout action that is also a command (Add a Desk, DESK) is listed once, as the command.
414
+ const commandRows = new Set([...commandItems, ...pluginItems].map((item) => `${item.label}\u0000${item.right ?? ""}`));
412
415
  const allItems = [
413
416
  ...commandItems,
414
- ...buildLayoutItems("", { confirmDangerousActions: true }),
417
+ ...buildLayoutItems("", { confirmDangerousActions: true })
418
+ .filter((item) => !commandRows.has(`${item.label}\u0000${item.right ?? ""}`)),
415
419
  ...buildPaneSettingItems(state.focusedPaneId, rootQuery),
416
420
  ...paneShortcutItems({ includePromptableTickerTemplates: true }),
417
421
  ...nonShortcutPaneTemplateItems(),
418
422
  ...tickerActionItems(),
419
- ...pluginCommandItems(),
423
+ ...pluginItems,
420
424
  ];
421
425
  if (pastedList) items.push(pastedListItem(pastedList, executeCollectionCommand));
422
426
  items.push(...rankMatchBlock(allItems, providerMatchItems, rootQuery));
@@ -4,7 +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
+ import { findNamedCollection, readWatchlistArgument, watchlistMemberSymbol } from "../../../portfolio/collection-name";
8
8
  import type { DataProvider } from "../../../types/data-provider";
9
9
  import type { Portfolio, TickerRecord, Watchlist } from "../../../types/ticker";
10
10
  import { AmbiguousTickerError, resolveTickerSearch, upsertTickerFromSearchResult } from "../../../tickers/search";
@@ -278,7 +278,7 @@ export async function resolveTickerListInput(
278
278
  const state = deps.getState();
279
279
  const watchlist = /[,;\n]/.test(rawInput) ? null : findNamedCollection(state.config.watchlists, rawInput);
280
280
  const members = watchlist
281
- ? [...state.tickers.values()].filter((ticker) => ticker.metadata.watchlists.includes(watchlist.id)).map((ticker) => ticker.metadata.ticker)
281
+ ? [...state.tickers.values()].filter((ticker) => ticker.metadata.watchlists.includes(watchlist.id)).map((ticker) => watchlistMemberSymbol(ticker.metadata))
282
282
  : [];
283
283
  if (watchlist && members.length > 0) {
284
284
  const read = readWatchlistArgument(rawInput, watchlist, members, reading?.maximum);
@@ -13,7 +13,7 @@ import { useBeforeShortcut, useShortcut } from "../../react/input";
13
13
  import { isPlainKey, isPlainKeyboardEvent } from "../../utils/keyboard";
14
14
  import { DataTable, PaneStatusBody, type DataTableColumn, type DataTableProps, type PaneStatusBodyProps } from "../ui";
15
15
  import { useDataTableSortMenu } from "./sort-menu";
16
- import { tableScrollStep } from "../ui/table-layout";
16
+ import { tableFreezesFirstColumn, tableScrollStep } from "../ui/table-layout";
17
17
  import {
18
18
  TableViewFrame,
19
19
  useResetTableScroll,
@@ -694,7 +694,14 @@ export function DataTableView<
694
694
  columns: tableProps.columns,
695
695
  columnGap: tableProps.columnGap,
696
696
  horizontalPadding: tableProps.horizontalPadding,
697
- frozenFirstColumn: tableProps.freezeFirstColumn,
697
+ frozenFirstColumn: tableFreezesFirstColumn({
698
+ freezeFirstColumn: tableProps.freezeFirstColumn,
699
+ columns: tableProps.columns,
700
+ columnGap: tableProps.columnGap,
701
+ horizontalPadding: tableProps.horizontalPadding,
702
+ viewportWidth,
703
+ overflows: true,
704
+ }),
698
705
  scrollLeft: currentLeft,
699
706
  direction,
700
707
  viewportWidth,
@@ -31,7 +31,8 @@ export function InputSearchBar({
31
31
  width: number | "100%";
32
32
  focusToken: number;
33
33
  inputRef: RefObject<InputRenderable | null>;
34
- placeholder: string;
34
+ /** Longest first: a field too narrow for one shows the next that fits. */
35
+ placeholder: string | readonly string[];
35
36
  debounceMs: number;
36
37
  /** Leading marker; override when a pane shows more than one field. */
37
38
  glyph?: string;
@@ -137,7 +138,7 @@ export function InputSearchBar({
137
138
  ref={inputRef}
138
139
  value={draft}
139
140
  focused={focused && active}
140
- placeholder={placeholder}
141
+ placeholder={fittedPlaceholder(placeholder, typeof width === "number" ? width - (appearance === "strip" ? 2 : 0) : null)}
141
142
  placeholderColor={placeholderText()}
142
143
  textColor={colors.text}
143
144
  focusedTextColor={colors.text}
@@ -156,6 +157,12 @@ export function InputSearchBar({
156
157
  );
157
158
  }
158
159
 
160
+ /** The first placeholder that fits `room` cells (all of them when the field has no fixed width), else the last. */
161
+ function fittedPlaceholder(placeholder: string | readonly string[], room: number | null): string {
162
+ if (typeof placeholder === "string") return placeholder;
163
+ return placeholder.find((text) => room === null || text.length <= room) ?? placeholder.at(-1) ?? "";
164
+ }
165
+
159
166
  const SEARCH_ICON_STYLE = { marginRight: "var(--gloom-space-xs)" } as const;
160
167
 
161
168
  const SEARCH_STRIP_STYLE = {
@@ -409,6 +409,7 @@ export function PaneHeader({
409
409
  activeValue={stack.active}
410
410
  onSelect={stack.onSelect}
411
411
  variant="header"
412
+ background={backgroundColor}
412
413
  focused={visuallyFocused}
413
414
  keyboardNavigation={false}
414
415
  paneMenu={false}
@@ -468,6 +469,7 @@ export function PaneHeader({
468
469
  activeValue={tabs.activeValue}
469
470
  onSelect={tabs.onSelect}
470
471
  variant="header"
472
+ background={backgroundColor}
471
473
  focused={tabs.focused}
472
474
  keyboardNavigation={tabs.keyboardNavigation}
473
475
  onAdd={tabs.onAdd}
@@ -10,6 +10,7 @@ import { pinnedTabTime } from "../../../../state/app/tab-cursor";
10
10
  import type { LayoutConfig } from "../../../../types/config";
11
11
  import { useRendererHost, useUiCapabilities, type NativeRendererHost } from "../../../../ui";
12
12
  import { buildPaneSharePayload } from "../../../../shares/pane";
13
+ import { paneShareItemFor } from "../../../../shares/pane-item";
13
14
  import { preparePaneShare } from "../../../../shares/prepare";
14
15
  import { sharePaneLink, type PaneShareView } from "../../../../shares/flow";
15
16
  import { reportPaneBug } from "../../../../shares/bug-report-flow";
@@ -74,6 +75,7 @@ export function useShellPaneCapture(options: UseShellPaneCaptureOptions): void {
74
75
  const pane = current.paneMap.get(paneId);
75
76
  if (!pane) throw new Error("Focus a pane to share it.");
76
77
  const state = stateRef.current;
78
+ const personalData = panePersonalData({ registry: current.pluginRegistry, state, layout: current.layout, pane });
77
79
  return {
78
80
  sharePayload: publicSharing ? buildPaneSharePayload(
79
81
  pluginRegistry,
@@ -82,8 +84,9 @@ export function useShellPaneCapture(options: UseShellPaneCaptureOptions): void {
82
84
  resolveTickerForPane(state, paneId),
83
85
  state.tickers,
84
86
  pinnedTabTime(state),
87
+ paneShareItemFor({ pane, state, registry: pluginRegistry, personal: personalData !== null }),
85
88
  ) : null,
86
- personalData: panePersonalData({ registry: current.pluginRegistry, state, layout: current.layout, pane }),
89
+ personalData,
87
90
  };
88
91
  }, [pluginRegistry, publicSharing, stateRef]);
89
92
 
@@ -18,6 +18,7 @@ import {
18
18
  advertisedChord,
19
19
  formatChordForHost,
20
20
  useKeybindings,
21
+ useTerminalReportsControlKeys,
21
22
  type KeyChord,
22
23
  } from "../../app/keybindings";
23
24
  import { getShortcutDisplayMode, type ShortcutDisplayMode } from "../../utils/shortcut-labels";
@@ -144,7 +145,9 @@ export function StatusBar() {
144
145
  };
145
146
  // Tabs name the digit that switches to them, as bound on this host. Past
146
147
  // nine there is no digit, and a rebinding off the digits has none either.
147
- const switchChord = advertisedChord(keybindings, "switch-layout", shortcutMode);
148
+ // A terminal that cannot send Control with a digit names Alt+1 instead.
149
+ const legacyTerminal = useTerminalReportsControlKeys() === false;
150
+ const switchChord = advertisedChord(keybindings, "switch-layout", shortcutMode, { legacyTerminal });
148
151
  const tabKey = (index: number): string => (
149
152
  switchChord?.key === "digit" && index < 9 ? `${compactChordLabel(switchChord, shortcutMode, index + 1)} ` : ""
150
153
  );
@@ -560,6 +563,7 @@ function StatusBarLayoutControl({
560
563
  | "layoutTabItems"
561
564
  | "layoutTabsWidth"
562
565
  > & { nativePaneChrome: boolean }) {
566
+ const colors = useThemeColors();
563
567
  if (!hasMultipleLayouts) return null;
564
568
  // On the desktop and the web the strip is as wide as its tabs, gives way
565
569
  // first when the bar runs out of room and scrolls inside, like the
@@ -580,6 +584,7 @@ function StatusBarLayoutControl({
580
584
  onReorder={handleLayoutReorder}
581
585
  compact
582
586
  variant="pill"
587
+ background={colors.panel}
583
588
  />
584
589
  </Box>
585
590
  </Box>
@@ -98,23 +98,43 @@ export function planFirstRunWatchlist(
98
98
  return { create, update };
99
99
  }
100
100
 
101
+ /**
102
+ * Below this many columns or rows the first-run Home shows three spots, not
103
+ * five: at 80x24 five cut headlines to nine characters and pane titles to
104
+ * "Main P...". 120x36 and up keep all five side by side.
105
+ */
106
+ const COMPACT_HOME_BELOW = { width: 100, height: 30 } as const;
107
+
108
+ export function isCompactHomeViewport(viewport: { width: number; height: number }): boolean {
109
+ return viewport.width < COMPACT_HOME_BELOW.width || viewport.height < COMPACT_HOME_BELOW.height;
110
+ }
111
+
101
112
  /**
102
113
  * The workspace a first run lands on: the holdings as a mark-to-market
103
114
  * heatmap, a watchlist, the largest position's chart, the top news wire, and
104
115
  * a market read beside it. Everything is docked, so the first screen reads at
105
116
  * any window size. Anything the host cannot render is left out rather than
106
117
  * shown as a placeholder.
118
+ *
119
+ * `compact` (a small terminal, isCompactHomeViewport) keeps the same panes in
120
+ * three spots: the watchlist beside the chart (the heatmap with `holdings`),
121
+ * and the news across the whole width with the market read, Trending and the
122
+ * other list as tabs behind it.
107
123
  */
108
124
  export function buildFirstRunLayout({
109
125
  symbol,
110
126
  portfolioId,
111
127
  watchlistId,
112
128
  hasPane,
129
+ compact = false,
130
+ holdings = false,
113
131
  }: {
114
132
  symbol: string;
115
133
  portfolioId: string;
116
134
  watchlistId: string;
117
135
  hasPane: (paneId: string) => boolean;
136
+ compact?: boolean;
137
+ holdings?: boolean;
118
138
  }): SavedLayout {
119
139
  const instances: PaneInstanceConfig[] = [
120
140
  {
@@ -173,10 +193,32 @@ export function buildFirstRunLayout({
173
193
  if (readPaneId) instances.push({ instanceId: readId, paneId: readPaneId, binding: { kind: "none" } });
174
194
  const trending = hasPane("attention-trending");
175
195
  if (trending) instances.push({ instanceId: FIRST_RUN_PANE_IDS.trending, paneId: "attention-trending", binding: { kind: "none" } });
176
- const beside = buildDockStack([
196
+ const readIds = [
177
197
  ...(readPaneId ? [readId] : []),
178
198
  ...(trending ? [FIRST_RUN_PANE_IDS.trending] : []),
179
- ]);
199
+ ];
200
+ if (compact) {
201
+ // The list beside the chart is the holdings when there are any, else the watchlist; the other one is the
202
+ // last tab behind the news, where the strip has room to name it.
203
+ const [list, other] = holdings
204
+ ? [FIRST_RUN_PANE_IDS.heatmap, FIRST_RUN_PANE_IDS.watchlist]
205
+ : [FIRST_RUN_PANE_IDS.watchlist, FIRST_RUN_PANE_IDS.heatmap];
206
+ const top = { kind: "split" as const, axis: "horizontal" as const, ratio: 0.42,
207
+ first: { kind: "pane" as const, instanceId: list }, second: { kind: "pane" as const, instanceId: FIRST_RUN_PANE_IDS.chart } };
208
+ const below = buildDockStack([...(secondary ? [secondary.instanceId] : []), ...readIds, other]);
209
+ return {
210
+ name: "Home",
211
+ layout: {
212
+ dockRoot: below ? { kind: "split", axis: "vertical", ratio: 0.55, first: top, second: below } : top,
213
+ instances,
214
+ floating: [],
215
+ detached: [],
216
+ },
217
+ paneState: {},
218
+ focusedPaneId: FIRST_RUN_PANE_IDS.chart,
219
+ };
220
+ }
221
+ const beside = buildDockStack(readIds);
180
222
  const lower = secondary && beside ? { kind: "split" as const, axis: "horizontal" as const, ratio: 0.6,
181
223
  first: { kind: "pane" as const, instanceId: secondary.instanceId }, second: beside }
182
224
  : secondary ? { kind: "pane" as const, instanceId: secondary.instanceId } : beside;
@@ -9,6 +9,7 @@ import { Button, ListView, type ListViewItem } from "../ui";
9
9
  import type { ButtonProps } from "../ui/button";
10
10
  import { ListRowLines } from "../ui/list-row-lines";
11
11
  import { TITLEBAR_OVERLAY_HEIGHT_PX } from "../layout/titlebar-overlay";
12
+ import { RemoteSurface, useRemoteSurfaceHeader, useRemoteSurfaceHeading } from "../../remote/surface";
12
13
 
13
14
  /**
14
15
  * Spacing for the DOM card, in px. The card is a form the user fills in, not
@@ -58,6 +59,9 @@ export function OnboardingModal({
58
59
  const desktop = useUiCapabilities().nativePaneChrome === true;
59
60
  const viewport = useViewport();
60
61
 
62
+ // It covers the app, so remote control reads it as the open form.
63
+ const content = <RemoteSurface kind="setup">{children}</RemoteSurface>;
64
+
61
65
  if (desktop) {
62
66
  return (
63
67
  <Box
@@ -92,7 +96,7 @@ export function OnboardingModal({
92
96
  }}
93
97
  data-gloom-role="onboarding-modal"
94
98
  >
95
- {children}
99
+ {content}
96
100
  </Box>
97
101
  </Box>
98
102
  );
@@ -126,7 +130,7 @@ export function OnboardingModal({
126
130
  borderColor={colors.borderFocused}
127
131
  data-gloom-role="onboarding-modal"
128
132
  >
129
- {children}
133
+ {content}
130
134
  </Box>
131
135
  </Box>
132
136
  );
@@ -245,6 +249,7 @@ export function OnboardingTitle({
245
249
  }) {
246
250
  const colors = useThemeColors();
247
251
  const desktop = useUiCapabilities().nativePaneChrome === true;
252
+ useRemoteSurfaceHeading({ step, title: titleSuffix ? `${title} ${titleSuffix}` : title, description });
248
253
 
249
254
  if (desktop) {
250
255
  return (
@@ -340,6 +345,10 @@ export function OnboardingHeader({
340
345
  { id: "cloud", label: t("Gloom Cloud") },
341
346
  { id: "pro", label: t("Pro") },
342
347
  ];
348
+ useRemoteSurfaceHeader({
349
+ section: sections.find((section) => section.id === active)?.label,
350
+ cancel: showDismiss && !dismissing && !dismissDisabled ? onDismiss : undefined,
351
+ });
343
352
 
344
353
  if (!desktop) {
345
354
  return (
@@ -4,6 +4,7 @@ import type { BrokerConfigField } from "../../types/broker";
4
4
  import { useShortcut, type KeyEventLike } from "../../react/input";
5
5
  import { matchKeybinding, matchesKeybindingAction, type ResolvedKeybindings } from "../../app/keybindings";
6
6
  import { isPlainKey } from "../../utils/keyboard";
7
+ import { keepEscapeFromClosing } from "../../utils/double-escape-close";
7
8
  import { isCopyShortcut, isPasteShortcut } from "../../utils/selection-clipboard";
8
9
  import type { CloudBillingInterval } from "../../account/billing";
9
10
  import type { usePlanAccess } from "../../api-client/plan-access";
@@ -333,4 +334,19 @@ export function useOnboardingKeyboard({
333
334
  phase: "before",
334
335
  enabled: stage === "research" && !helpFocused && !coachAside && !inputCaptured && !dialogOpen && !commandBarOpen,
335
336
  });
337
+
338
+ // Esc puts the card away, as it closes any card. Scoped, so it runs ahead
339
+ // of the shell's double-Esc arming: this Esc is not half of closing the
340
+ // pane under the card.
341
+ useShortcut((event) => {
342
+ if (event.targetEditable === true || !isPlainKey(event, "escape", "esc")) return;
343
+ keepEscapeFromClosing(event);
344
+ event.preventDefault();
345
+ event.stopPropagation();
346
+ void finish();
347
+ }, {
348
+ phase: "before",
349
+ scope: "onboarding:research",
350
+ enabled: stage === "research" && !helpFocused && !coachAside && !inputCaptured && !dialogOpen && !commandBarOpen,
351
+ });
336
352
  }
@@ -79,7 +79,6 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
79
79
  const rendererHost = useRendererHost();
80
80
  const commandBarShortcut = useCommandBarShortcut();
81
81
  const notificationActionShortcut = useActionShortcut("notification-action");
82
- const notificationDismissShortcut = useActionShortcut("notification-dismiss");
83
82
  const keybindings = useKeybindings();
84
83
  const dialogOpen = useDialogState((dialog) => dialog.isOpen);
85
84
  const commandBarOpen = useAppSelector((state) => state.commandBarOpen);
@@ -326,7 +325,7 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
326
325
  return {
327
326
  coachAside,
328
327
  coachKeysHidden: inputCaptured || typingInField,
329
- helpFocused, stage, progress, notificationDismissShortcut, finish, notificationActionShortcut,
328
+ helpFocused, stage, progress, finish, notificationActionShortcut,
330
329
  saveProgressInBackground, colors, commandBarShortcut, selectedBrokerId, brokerOptions, portfolioSub,
331
330
  sectionAvailability, goToSection, skipSetup, isFinishing, isBrokerCommitting, desktop, positions,
332
331
  inputRef, editingField, selectedPositionSymbol, brokerChoices, portfolioOptionIdx, setPortfolioOptionIdx,
@@ -379,7 +378,7 @@ function useCoachStepsAside(config: AppConfig, stage: OnboardingStage): boolean
379
378
  export function OnboardingWizard(props: OnboardingWizardProps) {
380
379
  const {
381
380
  coachAside, coachKeysHidden,
382
- helpFocused, stage, progress, notificationDismissShortcut, finish, notificationActionShortcut,
381
+ helpFocused, stage, progress, finish, notificationActionShortcut,
383
382
  saveProgressInBackground, colors, commandBarShortcut, selectedBrokerId, brokerOptions, portfolioSub,
384
383
  sectionAvailability, goToSection, skipSetup, isFinishing, isBrokerCommitting, desktop, positions,
385
384
  inputRef, editingField, selectedPositionSymbol, brokerChoices, portfolioOptionIdx, setPortfolioOptionIdx,
@@ -401,15 +400,16 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
401
400
  title={tf("Built around {ticker}", { ticker })}
402
401
  actions={<>
403
402
  {/* Each button shows its key, as Connect shows Alt+Enter; in the
404
- terminal the second wraps under the first. The desktop card has no
405
- room for both: like a toast, its dismiss key is in the tooltip.
406
- F10 also dismisses it. In a field, or with a pane holding the
403
+ terminal the second wraps under the first where the row is short.
404
+ The desktop card has no room for both: its dismiss key is in the
405
+ tooltip. Esc puts it away as it closes any card; the notification
406
+ dismiss key and F10 do too. In a field, or with a pane holding the
407
407
  keyboard, the keys are the field's: the card shows none. */}
408
408
  <OnboardingButton
409
409
  label="Keep exploring"
410
410
  variant="ghost"
411
- shortcut={!desktop && !coachKeysHidden && notificationDismissShortcut ? notificationDismissShortcut : undefined}
412
- title={desktop && notificationDismissShortcut ? `${t("Keep exploring")} (${notificationDismissShortcut})` : undefined}
411
+ shortcut={!desktop && !coachKeysHidden ? "Esc" : undefined}
412
+ title={desktop ? `${t("Keep exploring")} (Esc)` : undefined}
413
413
  onPress={() => { void finish(); }}
414
414
  />
415
415
  <OnboardingButton