@gloom-sh/terminal 0.19.5 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/LICENSE +0 -4
  2. package/package.json +6 -5
  3. package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
  4. package/patches/electrobun-devkit@2.0.5.patch +148 -0
  5. package/src/api-client/bond-trades.ts +59 -0
  6. package/src/api-client/data.ts +21 -0
  7. package/src/api-client/equity-screener.ts +23 -0
  8. package/src/api-client/index.ts +2 -0
  9. package/src/api-client/types/account.ts +86 -0
  10. package/src/api-client/types/assist.ts +32 -0
  11. package/src/api-client/types/auth.ts +63 -0
  12. package/src/api-client/types/billing.ts +54 -0
  13. package/src/api-client/types/chat.ts +180 -0
  14. package/src/api-client/types/congress.ts +107 -0
  15. package/src/api-client/types/credit.ts +110 -0
  16. package/src/api-client/types/econ.ts +158 -0
  17. package/src/api-client/types/equity-diagnostic.ts +73 -0
  18. package/src/api-client/types/filings-and-calls.ts +350 -0
  19. package/src/api-client/types/index.ts +25 -0
  20. package/src/api-client/types/jobs.ts +147 -0
  21. package/src/api-client/types/market.ts +122 -0
  22. package/src/api-client/types/news.ts +91 -0
  23. package/src/api-client/types/notes-and-theses.ts +172 -0
  24. package/src/api-client/types/quotes.ts +28 -0
  25. package/src/api-client/types/scanners.ts +125 -0
  26. package/src/api-client/types/screener.ts +65 -0
  27. package/src/api-client/types/search.ts +107 -0
  28. package/src/api-client/types/sync.ts +14 -0
  29. package/src/api-client/types/team-collections.ts +43 -0
  30. package/src/api-client/types/team-views.ts +32 -0
  31. package/src/api-client/types/teams.ts +135 -0
  32. package/src/api-client/types/ticker-data.ts +57 -0
  33. package/src/api-client/types/tweets.ts +59 -0
  34. package/src/api-client/types/world-venues.ts +23 -0
  35. package/src/app/pane-runtime/index.tsx +2 -0
  36. package/src/app/pane-runtime/plugin-bindings.ts +10 -1
  37. package/src/app/runtime/desktop-deeplink.ts +41 -6
  38. package/src/app/star-prompt/status-line.tsx +1 -1
  39. package/src/app.tsx +64 -23
  40. package/src/architecture/ui-tokens-allowlist.json +0 -8
  41. package/src/cli/commands/market.ts +149 -10
  42. package/src/cli/commands/search.ts +21 -3
  43. package/src/cli/commands/ticker.ts +90 -36
  44. package/src/cli/desktop-pane-shot-browser.ts +69 -3
  45. package/src/cli/glossary.ts +3 -3
  46. package/src/cli/known-gaps.ts +8 -0
  47. package/src/cli/listing-arg.ts +12 -0
  48. package/src/cli/pane-functions/capabilities.ts +2 -0
  49. package/src/cli/pane-functions/catalog.ts +25 -5
  50. package/src/cli/pane-functions/function-help.ts +8 -5
  51. package/src/cli/pane-functions/headless.ts +4 -3
  52. package/src/cli/pane-functions/resolver.ts +75 -2
  53. package/src/cli/quote-answer.ts +9 -0
  54. package/src/cli/symbol-list.ts +54 -2
  55. package/src/cli/symbol-rows.ts +14 -2
  56. package/src/cli/ticker-resolution.ts +89 -20
  57. package/src/components/chart/composite/axis-overlays.tsx +60 -27
  58. package/src/components/chart/composite/composite-chart.tsx +118 -63
  59. package/src/components/chart/composite/cursor-source.ts +111 -0
  60. package/src/components/chart/composite/format.ts +168 -6
  61. package/src/components/chart/composite/legend.tsx +8 -4
  62. package/src/components/chart/composite/panel-labels.ts +20 -1
  63. package/src/components/chart/composite/panel-surface.tsx +201 -92
  64. package/src/components/chart/composite/price-axis-labels.tsx +92 -46
  65. package/src/components/chart/composite/price-series.ts +31 -8
  66. package/src/components/chart/composite/scene.ts +154 -59
  67. package/src/components/chart/composite/series-axis-tags.tsx +4 -2
  68. package/src/components/chart/composite/time-axis.ts +13 -5
  69. package/src/components/chart/composite/time-scale.ts +211 -56
  70. package/src/components/chart/composite/types.ts +11 -1
  71. package/src/components/chart/composite/use-composite-chart-keyboard.ts +43 -14
  72. package/src/components/chart/curve/curve-surface.tsx +5 -2
  73. package/src/components/chart/curve/model.ts +4 -1
  74. package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
  75. package/src/components/chart/static/series.ts +3 -0
  76. package/src/components/command-bar/commands/collection-list.ts +81 -0
  77. package/src/components/command-bar/commands/direct/index.ts +6 -0
  78. package/src/components/command-bar/commands/registry.ts +8 -0
  79. package/src/components/command-bar/layout-items/current-layout.ts +22 -1
  80. package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
  81. package/src/components/command-bar/pane-templates/items.ts +19 -3
  82. package/src/components/command-bar/pane-templates/workflow.ts +5 -0
  83. package/src/components/command-bar/routes/root/results.ts +23 -3
  84. package/src/components/command-bar/routes/root/selection.ts +4 -2
  85. package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
  86. package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
  87. package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
  88. package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
  89. package/src/components/command-bar/surface/environment.ts +2 -0
  90. package/src/components/command-bar/view-model.ts +7 -0
  91. package/src/components/command-bar/workflow/ops.ts +2 -1
  92. package/src/components/command-bar/workflow/tickers.ts +20 -0
  93. package/src/components/data-table/export.ts +4 -1
  94. package/src/components/layout/detached-pane-shell.tsx +10 -37
  95. package/src/components/layout/double-escape-close.ts +90 -0
  96. package/src/components/layout/header.tsx +3 -2
  97. package/src/components/layout/market-summary.ts +6 -3
  98. package/src/components/layout/pane/footer/index.tsx +2 -6
  99. package/src/components/layout/pane/footer/model.ts +6 -12
  100. package/src/components/layout/shell/active-drag.ts +53 -11
  101. package/src/components/layout/shell/drag/magnets.ts +128 -19
  102. package/src/components/layout/shell/menu.ts +15 -1
  103. package/src/components/layout/shell/pane/actions.ts +10 -2
  104. package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
  105. package/src/components/layout/shell/ticker-link-menu.ts +12 -3
  106. package/src/components/layout/status-bar.tsx +24 -78
  107. package/src/components/layout/status-widget-space.ts +5 -5
  108. package/src/components/onboarding/onboarding-keyboard.ts +5 -1
  109. package/src/components/onboarding/onboarding-wizard.tsx +15 -4
  110. package/src/components/onboarding/portfolio-step/positions-panel.tsx +9 -6
  111. package/src/components/onboarding/use-onboarding-progress.ts +20 -1
  112. package/src/components/price-sparkline/view.tsx +14 -6
  113. package/src/components/ticker/badge/index.tsx +8 -4
  114. package/src/components/ticker/badge/list.tsx +23 -7
  115. package/src/components/ui/column-grid.tsx +8 -2
  116. package/src/components/ui/data-table/index.tsx +5 -1
  117. package/src/components/ui/data-table/opentui/model.ts +4 -1
  118. package/src/components/ui/data-table/render-cell.ts +19 -0
  119. package/src/components/ui/delayed-mark.tsx +59 -7
  120. package/src/components/ui/icon.tsx +1 -8
  121. package/src/components/ui/menu.tsx +6 -1
  122. package/src/components/ui/tabs.tsx +5 -2
  123. package/src/core/state/app/layout.ts +18 -3
  124. package/src/core/state/app/state.ts +2 -0
  125. package/src/core/state/app/types.ts +5 -0
  126. package/src/data/config/layout.ts +3 -0
  127. package/src/data/config/store/normalize.ts +39 -4
  128. package/src/i18n/es.ts +13 -3
  129. package/src/i18n/ja.ts +13 -3
  130. package/src/i18n/ko.ts +13 -3
  131. package/src/i18n/zh-cn.ts +13 -3
  132. package/src/i18n/zh-tw.ts +13 -3
  133. package/src/layout/pane-manager/floating-placement.ts +7 -4
  134. package/src/layout/pane-manager/floating.ts +5 -2
  135. package/src/market-data/bond-funds.ts +19 -0
  136. package/src/market-data/futures-contract.ts +14 -3
  137. package/src/market-data/market/freshness.ts +18 -0
  138. package/src/market-data/market/status.ts +15 -2
  139. package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
  140. package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
  141. package/src/plugins/builtin/bond-calculator/model.ts +14 -5
  142. package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
  143. package/src/plugins/builtin/buildout/cells.tsx +25 -45
  144. package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
  145. package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
  146. package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
  147. package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
  148. package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
  149. package/src/plugins/builtin/buildout/format.ts +23 -1
  150. package/src/plugins/builtin/buildout/model/types.ts +1 -0
  151. package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
  152. package/src/plugins/builtin/buildout/table-model.ts +12 -4
  153. package/src/plugins/builtin/cds/headless.ts +1 -0
  154. package/src/plugins/builtin/cds/index.tsx +1 -1
  155. package/src/plugins/builtin/chat/content/composer.tsx +21 -27
  156. package/src/plugins/builtin/chat/content/index.tsx +31 -3
  157. package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
  158. package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
  159. package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
  160. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  161. package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
  162. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
  163. package/src/plugins/builtin/congress-trades/model.ts +2 -1
  164. package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
  165. package/src/plugins/builtin/correlation/headless.ts +3 -2
  166. package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
  167. package/src/plugins/builtin/custom-view/index.tsx +1 -1
  168. package/src/plugins/builtin/custom-view/loader.ts +85 -8
  169. package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
  170. package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
  171. package/src/plugins/builtin/debt-maturities/model.ts +66 -0
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
  173. package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
  174. package/src/plugins/builtin/econ/calendar-model.ts +28 -6
  175. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  176. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
  177. package/src/plugins/builtin/equity-screener/headless.ts +37 -3
  178. package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
  179. package/src/plugins/builtin/equity-screener/model.ts +238 -27
  180. package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
  181. package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
  182. package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
  183. package/src/plugins/builtin/executives/format.ts +5 -4
  184. package/src/plugins/builtin/executives/pane.tsx +1 -1
  185. package/src/plugins/builtin/futures-curve/client.ts +19 -0
  186. package/src/plugins/builtin/futures-curve/headless.ts +52 -13
  187. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  188. package/src/plugins/builtin/futures-curve/model.ts +77 -6
  189. package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
  190. package/src/plugins/builtin/help/index.tsx +55 -1
  191. package/src/plugins/builtin/insider/model.ts +30 -2
  192. package/src/plugins/builtin/jobs/model.ts +2 -2
  193. package/src/plugins/builtin/macro-day/client.ts +41 -0
  194. package/src/plugins/builtin/macro-day/headless.ts +19 -9
  195. package/src/plugins/builtin/macro-day/model.ts +3 -1
  196. package/src/plugins/builtin/market-movers/index.tsx +4 -3
  197. package/src/plugins/builtin/mna/distress/headless.ts +1 -0
  198. package/src/plugins/builtin/mna/model.ts +2 -2
  199. package/src/plugins/builtin/notes/files.ts +2 -0
  200. package/src/plugins/builtin/notes/owner.tsx +20 -1
  201. package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
  202. package/src/plugins/builtin/notes/store.ts +6 -1
  203. package/src/plugins/builtin/perps/pane.tsx +3 -1
  204. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
  205. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
  206. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
  207. package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
  208. package/src/plugins/builtin/rate-path/headless.ts +24 -10
  209. package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
  210. package/src/plugins/builtin/research/event-model.ts +10 -3
  211. package/src/plugins/builtin/research/events-headless.ts +20 -2
  212. package/src/plugins/builtin/sec/fund-facts.ts +17 -1
  213. package/src/plugins/builtin/sec/index.tsx +1 -1
  214. package/src/plugins/builtin/series-inventory.ts +1 -0
  215. package/src/plugins/builtin/shared/earnings-report.ts +7 -2
  216. package/src/plugins/builtin/shared/members-menu.tsx +103 -38
  217. package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
  218. package/src/plugins/builtin/short-interest/headless.ts +1 -1
  219. package/src/plugins/builtin/short-interest/model.ts +15 -6
  220. package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
  221. package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
  222. package/src/plugins/builtin/short-interest/types.ts +2 -0
  223. package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
  224. package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
  225. package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
  226. package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
  227. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
  228. package/src/plugins/builtin/time-sales/pane.tsx +3 -2
  229. package/src/plugins/builtin/trace-bonds/client.ts +7 -4
  230. package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
  231. package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
  232. package/src/plugins/builtin/trace-bonds/history.ts +155 -0
  233. package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
  234. package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
  235. package/src/plugins/builtin/volatility/client.ts +6 -1
  236. package/src/plugins/builtin/volatility/headless.ts +0 -1
  237. package/src/plugins/builtin/yield-curve/curves.ts +15 -0
  238. package/src/plugins/builtin/yield-curve/headless.ts +6 -1
  239. package/src/plugins/builtin/yield-curve/index.tsx +5 -8
  240. package/src/plugins/host-modules.ts +22 -3
  241. package/src/plugins/host-smoke.ts +6 -3
  242. package/src/plugins/installer.ts +16 -3
  243. package/src/plugins/plugin-names.ts +11 -2
  244. package/src/portfolio/collection-name.ts +19 -0
  245. package/src/remote/controller.ts +9 -2
  246. package/src/remote/schema.ts +2 -1
  247. package/src/renderers/browser/http-proxy-transport.ts +78 -8
  248. package/src/renderers/cloudflare/http-proxy.ts +73 -3
  249. package/src/renderers/cloudflare/proxy-session.ts +47 -24
  250. package/src/renderers/cloudflare/worker.ts +44 -4
  251. package/src/renderers/desktop/geometry.ts +279 -0
  252. package/src/renderers/desktop/screen-setup.ts +246 -0
  253. package/src/renderers/desktop/sequential-window-host.ts +179 -0
  254. package/src/renderers/desktop/test-utils.ts +71 -0
  255. package/src/renderers/desktop/window-controller.ts +433 -0
  256. package/src/renderers/desktop/window-host.ts +70 -0
  257. package/src/renderers/desktop/window-layouts.ts +630 -0
  258. package/src/renderers/dom/data-frames.ts +15 -4
  259. package/src/renderers/dom/desktop/icons.tsx +0 -2
  260. package/src/renderers/dom/styles.css +0 -3
  261. package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
  262. package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
  263. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
  264. package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
  265. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
  266. package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
  267. package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
  268. package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
  269. package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
  270. package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
  271. package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
  272. package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
  273. package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
  274. package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
  275. package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
  276. package/src/renderers/electrobun/bun/index.ts +22 -109
  277. package/src/renderers/electrobun/bun/window/create.ts +23 -3
  278. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
  279. package/src/renderers/electrobun/bun/window/events.ts +4 -4
  280. package/src/renderers/electrobun/bun/window/focus.ts +0 -25
  281. package/src/renderers/electrobun/bun/window/frame.ts +2 -1
  282. package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
  283. package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
  284. package/src/renderers/electrobun/shared/protocol.ts +44 -2
  285. package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
  286. package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
  287. package/src/renderers/electrobun/view/main.tsx +13 -7
  288. package/src/series/fred-argument.ts +17 -0
  289. package/src/sources/gloomberb-cloud/index.ts +5 -7
  290. package/src/sources/provider-router/batches.ts +18 -3
  291. package/src/sources/provider-router/financial-routes.ts +7 -1
  292. package/src/sources/provider-router/financials.ts +18 -4
  293. package/src/state/app/context/index.tsx +16 -2
  294. package/src/state/desktop-windows.ts +63 -0
  295. package/src/sync/other-window-tabs.ts +62 -0
  296. package/src/tickers/company-name-listing.ts +23 -3
  297. package/src/tickers/listing-fate.ts +147 -1
  298. package/src/tickers/terminal-codes.ts +5 -0
  299. package/src/time-series/types.ts +6 -0
  300. package/src/types/config.ts +10 -1
  301. package/src/types/data-provider.ts +14 -0
  302. package/src/types/desktop-window.ts +71 -2
  303. package/src/types/financials.ts +19 -3
  304. package/src/types/headless.ts +21 -0
  305. package/src/types/plugin.ts +6 -0
  306. package/src/ui/index.tsx +14 -13
  307. package/src/ui/same-props.ts +58 -0
  308. package/src/utils/cli-output.ts +33 -4
  309. package/src/utils/double-escape-close.ts +38 -16
  310. package/src/utils/format.ts +30 -5
  311. package/src/utils/futures-generic.ts +12 -0
  312. package/src/utils/http-proxy-upstream.ts +6 -2
  313. package/src/utils/plugin-proxy-hosts.json +0 -4
  314. package/src/utils/plugin-proxy-hosts.ts +22 -0
  315. package/src/utils/price-earnings.ts +18 -0
  316. package/src/utils/sec-filings.ts +7 -1
  317. package/patches/electrobun@1.18.1.patch +0 -633
  318. package/src/api-client/types.ts +0 -2441
@@ -27,6 +27,7 @@ export const KEEP_FREE_KEY = "f";
27
27
  export const CONNECT_BROKER_KEY = "b";
28
28
  export const BROWSER_SIGN_IN_KEY = "b";
29
29
  export const SKIP_DESKS_KEY = "s";
30
+ export const SKIP_PORTFOLIO_KEY = "s";
30
31
 
31
32
  /** Digits jump straight to a section the header would let you click. */
32
33
  const SECTION_DIGITS: Record<string, OnboardingSectionId> = { "1": "portfolio", "2": "cloud", "3": "pro" };
@@ -54,7 +55,7 @@ export function keyReachesPastOnboardingModal(event: KeyEventLike, keybindings:
54
55
  export function useOnboardingKeyboard({
55
56
  stage, progress, account, helpFocused, editingField, isBrokerCommitting, planAccess, continueFree, finish,
56
57
  sectionAvailability, goToSection, portfolioSub, positions, setEditingField, positionCount,
57
- continueFromPositions, openBrokerConnect, movePositionCursor, removePositionAtCursor, submitBrokerField,
58
+ continueFromPositions, skipPositions, openBrokerConnect, movePositionCursor, removePositionAtCursor, submitBrokerField,
58
59
  submitAccountField, backPortfolio, continuePortfolio, setPortfolioOptionIdx, activeBrokerFields,
59
60
  brokerFieldIdx, setBrokerSelectIdx, brokerChoices, openBrokerGuide, chosenDesks, finishDesks,
60
61
  setDeskCursor, deskCursor, setChosenDesks, continueAccount, skipSetup, primaryUpgradeAction,
@@ -76,6 +77,7 @@ export function useOnboardingKeyboard({
76
77
  setEditingField: Dispatch<SetStateAction<boolean>>;
77
78
  positionCount: number;
78
79
  continueFromPositions: () => void;
80
+ skipPositions: () => void;
79
81
  openBrokerConnect: () => void;
80
82
  movePositionCursor: (delta: number) => void;
81
83
  removePositionAtCursor: () => void;
@@ -165,6 +167,8 @@ export function useOnboardingKeyboard({
165
167
  positions.focusField(tab && event.shift ? POSITION_FIELDS.length - 1 : 0);
166
168
  } else if (letter(CONNECT_BROKER_KEY) && positionCount > 0) {
167
169
  openBrokerConnect();
170
+ } else if (letter(SKIP_PORTFOLIO_KEY) && positionCount === 0) {
171
+ skipPositions();
168
172
  } else if (!chord && (name === "up" || name === "k")) {
169
173
  movePositionCursor(-1);
170
174
  } else if (!chord && (name === "down" || name === "j")) {
@@ -49,6 +49,7 @@ import {
49
49
  CONNECT_BROKER_KEY,
50
50
  BROWSER_SIGN_IN_KEY,
51
51
  SKIP_DESKS_KEY,
52
+ SKIP_PORTFOLIO_KEY,
52
53
  } from "./onboarding-keyboard";
53
54
  import { useOnboardingBrokerFields, useOnboardingBrokerForm } from "./use-onboarding-broker-form";
54
55
  import { useOnboardingProgress, useOnboardingWorkspace, useOnboardingCompletion } from "./use-onboarding-progress";
@@ -155,7 +156,7 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
155
156
  }, [portfolioSub, stage]);
156
157
  const {
157
158
  chosenDesks, setChosenDesks, deskCursor, setDeskCursor, buildingDesks, continueFromPositions,
158
- finishDesks, handleBrokerSynced,
159
+ skipPositions, finishDesks, handleBrokerSynced,
159
160
  } = useOnboardingWorkspace({
160
161
  stateRef, pluginRegistry, dispatch, positions, setEditingField, saveProgressInBackground,
161
162
  setPersistenceError, finishingRef, brokerOptions, selectedBrokerId, setPortfolioSub,
@@ -306,7 +307,7 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
306
307
  useOnboardingKeyboard({
307
308
  stage, progress, account, helpFocused, editingField, isBrokerCommitting, planAccess, continueFree,
308
309
  finish, sectionAvailability, goToSection, portfolioSub, positions, setEditingField, positionCount,
309
- continueFromPositions, openBrokerConnect, movePositionCursor, removePositionAtCursor, submitBrokerField,
310
+ continueFromPositions, skipPositions, openBrokerConnect, movePositionCursor, removePositionAtCursor, submitBrokerField,
310
311
  submitAccountField, backPortfolio, continuePortfolio, setPortfolioOptionIdx, activeBrokerFields,
311
312
  brokerFieldIdx, setBrokerSelectIdx, brokerChoices, openBrokerGuide, chosenDesks, finishDesks,
312
313
  setDeskCursor, deskCursor, setChosenDesks, continueAccount, skipSetup, primaryUpgradeAction,
@@ -320,7 +321,7 @@ function useOnboardingWizard({ pluginRegistry, importBrokerPositions, onComplete
320
321
  inputRef, editingField, selectedPositionSymbol, brokerChoices, portfolioOptionIdx, setPortfolioOptionIdx,
321
322
  chooseBroker, activeBrokerFields, brokerFieldIdx, brokerSelectIdx, setBrokerSelectIdx, brokerValues,
322
323
  setBrokerFieldValue, isBrokerSyncing, brokerSyncError, persistenceError, positionCount,
323
- openBrokerConnect, continueFromPositions, backPortfolio, continuePortfolio, chosenDesks, deskCursor,
324
+ openBrokerConnect, continueFromPositions, skipPositions, backPortfolio, continuePortfolio, chosenDesks, deskCursor,
324
325
  setDeskCursor, setChosenDesks, buildingDesks, finishDesks, account, viewportWidth, viewportHeight, continueAccount,
325
326
  offer, planAccess, pricing, billingInterval, setBillingInterval, continueFree, primaryUpgradeAction,
326
327
  goBack, rerun,
@@ -335,7 +336,7 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
335
336
  inputRef, editingField, selectedPositionSymbol, brokerChoices, portfolioOptionIdx, setPortfolioOptionIdx,
336
337
  chooseBroker, activeBrokerFields, brokerFieldIdx, brokerSelectIdx, setBrokerSelectIdx, brokerValues,
337
338
  setBrokerFieldValue, isBrokerSyncing, brokerSyncError, persistenceError, positionCount,
338
- openBrokerConnect, continueFromPositions, backPortfolio, continuePortfolio, chosenDesks, deskCursor,
339
+ openBrokerConnect, continueFromPositions, skipPositions, backPortfolio, continuePortfolio, chosenDesks, deskCursor,
339
340
  setDeskCursor, setChosenDesks, buildingDesks, finishDesks, account, viewportWidth, viewportHeight, continueAccount,
340
341
  offer, planAccess, pricing, billingInterval, setBillingInterval, continueFree, primaryUpgradeAction,
341
342
  goBack, rerun,
@@ -462,6 +463,16 @@ export function OnboardingWizard(props: OnboardingWizardProps) {
462
463
  {brokerOptions.length > 0 && positionCount > 0 ? (
463
464
  <OnboardingButton label="Connect a broker" variant="ghost" shortcut={CONNECT_BROKER_KEY} onPress={openBrokerConnect} />
464
465
  ) : null}
466
+ {/* Holding nothing yet, the step can be left as the Desks step can. */}
467
+ {positionCount === 0 ? (
468
+ <OnboardingButton
469
+ label="Skip"
470
+ variant="ghost"
471
+ shortcut={SKIP_PORTFOLIO_KEY}
472
+ disabled={positions.submitting}
473
+ onPress={skipPositions}
474
+ />
475
+ ) : null}
465
476
  <OnboardingButton
466
477
  label="Continue"
467
478
  variant="primary"
@@ -49,7 +49,7 @@ function fieldPlaceholder(field: PositionFieldId, state: OnboardingPositionsStat
49
49
  /** Company name and last price for the symbol being typed, or why it will not resolve. */
50
50
  function PreviewLine({ preview, error }: Pick<OnboardingPositionsState, "preview" | "error">) {
51
51
  const colors = useThemeColors();
52
- // Signed out or free, the price is the delayed one, and says so.
52
+ // Signed out or free, the price is the delayed one, and says so: setup covers the status bar's note.
53
53
  const delay = useFreeQuoteDelay(preview.status === "ready" ? preview.quote : null);
54
54
  if (error) return <Text fg={colors.negative} wrapText>{error}</Text>;
55
55
  if (preview.status === "idle") return null;
@@ -61,14 +61,17 @@ function PreviewLine({ preview, error }: Pick<OnboardingPositionsState, "preview
61
61
  const headline = getRegularSessionDisplay(preview.quote);
62
62
  const price = headline?.price;
63
63
  const change = headline?.changePercent;
64
+ // Only the name gives way to a narrow row, clipped on its right: the symbol, price and move keep every cell.
64
65
  return (
65
66
  <Box flexDirection="row" alignItems="center" minWidth={0} overflow="hidden">
66
- <Text fg={colors.text} attributes={TextAttributes.BOLD}>{preview.symbol}</Text>
67
- {preview.name ? <Text fg={colors.textDim}>{` ${preview.name}`}</Text> : null}
68
- {price != null ? <Text fg={colors.text}>{` ${formatMarketPrice(price, { maxWidth: 12 })}`}</Text> : null}
69
- {change != null ? <Text fg={shownPriceColor(change, 2, colors)}>{` ${formatPercentRaw(change)}`}</Text> : null}
67
+ <Box flexShrink={0}><Text fg={colors.text} attributes={TextAttributes.BOLD}>{preview.symbol}</Text></Box>
68
+ {preview.name ? (
69
+ <Box flexShrink={1} minWidth={0} overflow="hidden" paddingLeft={2}><Text fg={colors.textDim}>{preview.name}</Text></Box>
70
+ ) : null}
71
+ {price != null ? <Box flexShrink={0} paddingLeft={2}><Text fg={colors.text}>{formatMarketPrice(price, { maxWidth: 12 })}</Text></Box> : null}
72
+ {change != null ? <Box flexShrink={0} paddingLeft={1}><Text fg={shownPriceColor(change, 2, colors)}>{formatPercentRaw(change)}</Text></Box> : null}
70
73
  {price != null && delay != null ? <Box flexShrink={0} paddingLeft={1}><DelayedMark minutes={delay} /></Box> : null}
71
- {preview.duplicate ? <Text fg={colors.textMuted}>{t(" already added")}</Text> : null}
74
+ {preview.duplicate ? <Box flexShrink={0}><Text fg={colors.textMuted}>{t(" already added")}</Text></Box> : null}
72
75
  </Box>
73
76
  );
74
77
  }
@@ -13,6 +13,7 @@ import type { useOnboardingPositions } from "./wizard-positions";
13
13
  import {
14
14
  applyFirstRunLayout,
15
15
  buildFirstRunLayout,
16
+ FIRST_RUN_WATCHLIST,
16
17
  onboardingDeskLayoutId,
17
18
  planFirstRunWatchlist,
18
19
  setupDeskPicks,
@@ -202,6 +203,24 @@ export function useOnboardingWorkspace({
202
203
  });
203
204
  }, [positions, saveProgressInBackground]);
204
205
 
206
+ /**
207
+ * Leaves "What do you hold?" holding nothing, as the Desks step can be left
208
+ * picking nothing: the workspace is built around the first name on the
209
+ * first-run watchlist, and holdings can be added once it is open.
210
+ */
211
+ const skipPositions = useCallback(() => {
212
+ if (positions.positions.length > 0) return;
213
+ setEditingField(false);
214
+ saveProgressInBackground({
215
+ stage: "desks",
216
+ path: "manual",
217
+ portfolioId: positions.portfolioId,
218
+ tickerSymbol: FIRST_RUN_WATCHLIST[0]!.ticker,
219
+ positionsImported: 0,
220
+ brokerName: undefined,
221
+ });
222
+ }, [positions, saveProgressInBackground]);
223
+
205
224
  /**
206
225
  * Leaves "What do you trade most?": builds the workspace with the picked desks as
207
226
  * tabs (none when skipped, which is today's workspace) and moves on.
@@ -261,7 +280,7 @@ export function useOnboardingWorkspace({
261
280
 
262
281
  return {
263
282
  chosenDesks, setChosenDesks, deskCursor, setDeskCursor, buildingDesks, continueFromPositions,
264
- finishDesks, handleBrokerSynced,
283
+ skipPositions, finishDesks, handleBrokerSynced,
265
284
  };
266
285
  }
267
286
 
@@ -1,4 +1,4 @@
1
- import { useMemo } from "react";
1
+ import { memo, useMemo } from "react";
2
2
  import {
3
3
  Box,
4
4
  ChartSurface,
@@ -7,8 +7,10 @@ import {
7
7
  useUiCapabilities,
8
8
  } from "../../ui";
9
9
  import { useThemeColors } from "../../theme/theme-context";
10
+ import { markPure } from "../../ui/same-props";
10
11
  import type { PricePoint } from "../../types/financials";
11
12
  import { resolveNativeBitmapSize, shouldRenderNativeBitmap } from "../chart/native/bitmap-support";
13
+ import { useNativeBitmapMetrics } from "../chart/native/use-bitmap-metrics";
12
14
  import { renderSparklineBitmap } from "./bitmap";
13
15
  import {
14
16
  buildSamples,
@@ -90,10 +92,14 @@ function TerminalPriceSparkline({
90
92
  }) {
91
93
  const { nativeCharts, cellWidthPx = 8, cellHeightPx = 18, pixelRatio = 1 } = useUiCapabilities();
92
94
  const nativeRenderer = useNativeRenderer();
93
- const rendererResolution = nativeRenderer.resolution;
94
- const rendererCapabilities = nativeRenderer.capabilities;
95
- const rendererTerminalWidth = nativeRenderer.terminalWidth;
96
- const rendererTerminalHeight = nativeRenderer.terminalHeight;
95
+ // Subscribed, not read off the renderer: the sparkline skips the renders a
96
+ // quote gives its row, so a resize or a late pixel size has to reach it.
97
+ const {
98
+ resolution: rendererResolution,
99
+ capabilities: rendererCapabilities,
100
+ terminalWidth: rendererTerminalWidth,
101
+ terminalHeight: rendererTerminalHeight,
102
+ } = useNativeBitmapMetrics(nativeRenderer);
97
103
  const bitmap = useMemo(() => {
98
104
  if (values.length < 2 || !shouldRenderNativeBitmap(nativeRenderer, nativeCharts === true)) return null;
99
105
  const bitmapSize = resolveNativeBitmapSize({
@@ -135,7 +141,9 @@ function TerminalPriceSparkline({
135
141
  );
136
142
  }
137
143
 
138
- export function PriceSparkline({
144
+ export const PriceSparkline = markPure(memo(PriceSparklineView));
145
+
146
+ function PriceSparklineView({
139
147
  priceHistory,
140
148
  width,
141
149
  trend,
@@ -11,6 +11,8 @@ import { usePaneLinkMenuEntry } from "../../ui/external-link";
11
11
 
12
12
  export interface TickerBadgeProps {
13
13
  symbol: string;
14
+ /** The listing the chip stands for when it is not the symbol as written (`2330` is `2330:TWSE`): what it resolves, prices and opens. */
15
+ listing?: string;
14
16
  status: TickerBadgeStatus;
15
17
  quote: Quote | null;
16
18
  liveQuote?: boolean;
@@ -37,6 +39,7 @@ const NATIVE_PRICE_OVER_RESTING_TEXT = { position: "absolute", inset: 0, overflo
37
39
 
38
40
  export function TickerBadge({
39
41
  symbol,
42
+ listing,
40
43
  status,
41
44
  quote,
42
45
  liveQuote = true,
@@ -49,8 +52,9 @@ export function TickerBadge({
49
52
  }: TickerBadgeProps) {
50
53
  const registry = getSharedRegistry();
51
54
  const { nativeContextMenu, nativePaneChrome } = useUiCapabilities();
52
- const ticker = typeof registry?.getTicker === "function" ? registry.getTicker(symbol) : null;
53
- const financials = typeof registry?.getData === "function" ? registry.getData(symbol) : null;
55
+ const key = listing ?? symbol;
56
+ const ticker = typeof registry?.getTicker === "function" ? registry.getTicker(key) : null;
57
+ const financials = typeof registry?.getData === "function" ? registry.getData(key) : null;
54
58
  const openTickerContextMenu = useTickerContextMenu({
55
59
  ticker,
56
60
  financials,
@@ -65,7 +69,7 @@ export function TickerBadge({
65
69
  const { fg: color, bg: backgroundColor } = tickerBadgeColors(tone, hovered);
66
70
  // An ambiguous symbol is worth opening: that is how the listing gets picked.
67
71
  const interactive = status !== "loading";
68
- usePaneLinkMenuEntry(interactive ? `ticker:${symbol}` : null, tf("Open {ticker}", { ticker: symbol }), () => onOpen(symbol));
72
+ usePaneLinkMenuEntry(interactive ? `ticker:${key}` : null, tf("Open {ticker}", { ticker: symbol }), () => onOpen(key));
69
73
 
70
74
  return (
71
75
  <Box paddingRight={trailingGap ? 1 : 0} flexShrink={0} justifyContent={nativePaneChrome ? "center" : undefined}>
@@ -95,7 +99,7 @@ export function TickerBadge({
95
99
  event.stopPropagation?.();
96
100
  event.preventDefault?.();
97
101
  if (!interactive) return;
98
- onOpen(symbol);
102
+ onOpen(key);
99
103
  }}
100
104
  onContextMenu={(event: any) => {
101
105
  void openTickerContextMenu(event);
@@ -28,6 +28,16 @@ export interface TickerBadgeListProps {
28
28
  * column of looked-up symbols can mix chips and bare words.
29
29
  */
30
30
  listed?: boolean;
31
+ /**
32
+ * The listing a symbol stands for when its own spelling names none: a
33
+ * number-only Asian listing (`2330`) reads as money, so the source's venue
34
+ * makes it `2330:TWSE`. The chip keeps the symbol as written and looks up,
35
+ * prices and opens the listing, as it does for any other ticker. `null`
36
+ * says the source names no listing the app can read: that symbol prints as
37
+ * plain text, as one whose lookup fails does, never as a chip of another
38
+ * look beside resolved ones. Symbols not listed here stand for themselves.
39
+ */
40
+ listings?: Readonly<Record<string, string | null>>;
31
41
  /** Opens a badge; by default the symbol is resolved and opened as a ticker link would be. */
32
42
  onOpen?: (symbol: string) => void;
33
43
  }
@@ -44,6 +54,7 @@ export function TickerBadgeList({
44
54
  fallbackColor = colors.textBright,
45
55
  liveQuote = true,
46
56
  listed = false,
57
+ listings,
47
58
  onOpen,
48
59
  }: TickerBadgeListProps) {
49
60
  const [hoveredSymbol, setHoveredSymbol] = useState<string | null>(null);
@@ -61,9 +72,11 @@ export function TickerBadgeList({
61
72
  )),
62
73
  [symbols],
63
74
  );
75
+ /** What a symbol is looked up and opened by: its listing, else itself. */
76
+ const keyOf = (symbol: string): string => listings?.[symbol] ?? symbol;
64
77
  const tickerTexts = useMemo(
65
- () => (listed ? [] : named.map((symbol) => `$${symbol}`)),
66
- [listed, named],
78
+ () => (listed ? [] : named.filter((symbol) => listings?.[symbol] !== null).map((symbol) => `$${listings?.[symbol] ?? symbol}`)),
79
+ [listed, listings, named],
67
80
  );
68
81
  /**
69
82
  * Quotes are only worth fetching where they can be read. A column with no
@@ -99,23 +112,25 @@ export function TickerBadgeList({
99
112
  return named.map((symbol) => {
100
113
  const base = displayWidth(symbol);
101
114
  const budget = base + Math.max(0, remaining);
115
+ const entry = catalog[listings?.[symbol] ?? symbol];
102
116
  const chosen = getTickerBadgeText({
103
117
  symbol,
104
- status: badgeStatus(catalog[symbol]),
105
- quote: catalog[symbol]?.quote ?? null,
118
+ status: badgeStatus(entry),
119
+ quote: entry?.quote ?? null,
106
120
  liveQuote: liveQuotes,
107
121
  maxTextWidth: budget,
108
122
  });
109
123
  remaining -= displayWidth(chosen) - base;
110
124
  return budget;
111
125
  });
112
- }, [catalog, liveQuotes, named, slack]);
126
+ }, [catalog, listings, liveQuotes, named, slack]);
113
127
 
114
128
  return (
115
129
  <Box flexDirection="row" width={width} height={1} overflow="hidden">
116
130
  {named.map((symbol, index) => {
117
- const entry = catalog[symbol];
118
- if (entry?.status === "missing") {
131
+ const key = keyOf(symbol);
132
+ const entry = catalog[key];
133
+ if (entry?.status === "missing" || (!listed && listings?.[symbol] === null)) {
119
134
  return (
120
135
  <Box key={symbol} paddingRight={1} flexShrink={0}>
121
136
  <Text fg={fallbackColor} attributes={TextAttributes.BOLD}>{symbol}</Text>
@@ -127,6 +142,7 @@ export function TickerBadgeList({
127
142
  <TickerBadge
128
143
  key={symbol}
129
144
  symbol={symbol}
145
+ listing={listings?.[symbol] ?? undefined}
130
146
  status={badgeStatus(entry)}
131
147
  quote={liveQuotes ? entry?.quote ?? null : null}
132
148
  liveQuote={liveQuotes}
@@ -1,9 +1,11 @@
1
- import type { CSSProperties, ReactNode } from "react";
1
+ import { memo, type CSSProperties, type ReactNode } from "react";
2
2
  import { Box, Text, useUiCapabilities } from "../../ui";
3
+ import { markPure } from "../../ui/same-props";
3
4
  import { hoverBg } from "../../theme/colors";
4
5
  import { useThemeColors } from "../../theme/theme-context";
5
6
  import { displayWidth, padTo, truncateToDisplayWidth } from "../../utils/format";
6
7
  import { ExternalLinkText, usePaneLinkMenuEntry } from "./external-link";
8
+ import { useAppLanguage } from "../../i18n/react";
7
9
 
8
10
  /** One column of a ColumnGrid. */
9
11
  export interface ColumnGridColumn {
@@ -209,7 +211,11 @@ export interface ColumnGridPairProps {
209
211
  * the value right-aligned in the rest and cut from its end when it is too
210
212
  * long, and its muted detail after it. The detail gives way before the value.
211
213
  */
212
- export function ColumnGridPair({ label, labelWidth, width, value, valueColor, detail, url }: ColumnGridPairProps) {
214
+ export const ColumnGridPair = markPure(memo(ColumnGridPairView));
215
+
216
+ function ColumnGridPairView({ label, labelWidth, width, value, valueColor, detail, url }: ColumnGridPairProps) {
217
+ // A link's menu entry is worded in the app's language.
218
+ useAppLanguage();
213
219
  const colors = useThemeColors();
214
220
  const { nativePaneChrome } = useUiCapabilities();
215
221
  const color = valueColor ?? colors.text;
@@ -11,6 +11,7 @@ import { useOptionalPaneInstanceId } from "../../../state/app/context";
11
11
  import { registerPaneTableExporter } from "../../../state/pane-table-export-registry";
12
12
  import { createDataTableCsv } from "../../data-table/export";
13
13
  import { headerCase } from "../header-case";
14
+ import { figureColumnCells } from "./render-cell";
14
15
 
15
16
  export type {
16
17
  DataTableCell,
@@ -21,8 +22,11 @@ export type {
21
22
  } from "./types";
22
23
 
23
24
  export function DataTable<T, C extends DataTableColumn = DataTableColumn>(
24
- props: DataTableProps<T, C>,
25
+ ownProps: DataTableProps<T, C>,
25
26
  ) {
27
+ // Every renderer, report and export reads the cells through this, so a column of figures lines up everywhere.
28
+ const renderCell = useMemo(() => figureColumnCells(ownProps.renderCell), [ownProps.renderCell]);
29
+ const props = { ...ownProps, renderCell };
26
30
  const paneId = useOptionalPaneInstanceId();
27
31
  const renderer = useRendererHost();
28
32
  const propsRef = useRef(props);
@@ -258,11 +258,14 @@ export function resolveDataTableVisibleWindow<T>({
258
258
  scrollTop,
259
259
  virtualize,
260
260
  }: DataTableVisibleWindowOptions<T>): DataTableVisibleWindow<T> {
261
+ // A viewport the renderer has not laid out yet reads 0 (a laid-out one is at
262
+ // least a row): a render before the first layout keeps the default window
263
+ // rather than drawing one row until the size change re-renders the table.
261
264
  const viewportHeight = virtualize
262
265
  ? Math.max(
263
266
  1,
264
267
  Math.min(
265
- measuredViewportHeight ?? Math.min(items.length, 16),
268
+ measuredViewportHeight || Math.min(items.length, 16),
266
269
  Math.max(1, Math.ceil(appViewportHeight)),
267
270
  ),
268
271
  )
@@ -0,0 +1,19 @@
1
+ import { displayWidth, inFigureColumn } from "../../../utils/format";
2
+ import type { DataTableColumn, DataTableProps } from "./types";
3
+
4
+ type RenderCell<T, C extends DataTableColumn> = DataTableProps<T, C>["renderCell"];
5
+
6
+ /**
7
+ * A table's cells as it draws, reports and exports them. A right-aligned
8
+ * column is a column of figures, so its compact numbers keep their decimals
9
+ * and line up (`inFigureColumn`): 12.00M over 10.73M, never 12M. A pane that
10
+ * sized the column to the short figures keeps the short one wherever the
11
+ * decimals would not fit, so a figure is never cut for them.
12
+ */
13
+ export function figureColumnCells<T, C extends DataTableColumn>(renderCell: RenderCell<T, C>): RenderCell<T, C> {
14
+ return (item, column, index, rowState) => {
15
+ if (column.align !== "right") return renderCell(item, column, index, rowState);
16
+ const cell = inFigureColumn(() => renderCell(item, column, index, rowState));
17
+ return displayWidth(cell.text) > column.width ? renderCell(item, column, index, rowState) : cell;
18
+ };
19
+ }
@@ -1,7 +1,9 @@
1
+ import { useEffect, useSyncExternalStore } from "react";
1
2
  import { Box, Text, useUiCapabilities } from "../../ui";
2
3
  import { useThemeColors } from "../../theme/theme-context";
3
4
  import { tf } from "../../i18n";
4
5
  import { displayWidth } from "../../utils/format";
6
+ import { useFreeQuoteDelay, type QuoteDelayFacts } from "../../api-client/plan-access";
5
7
  import { ICON_GLYPHS, Icon } from "./icon";
6
8
 
7
9
  /** The terminal's form of the mark: the clock and the delay, as the pane footer draws it (`◷15m`). */
@@ -23,13 +25,63 @@ export function delayedMarkWidth(minutes: number, nativePaneChrome: boolean): nu
23
25
  }
24
26
 
25
27
  /**
26
- * The one mark for a price shown late, beside the price: what the pane
27
- * footer's clock is for a pane's data (`delayedFooterSegment`), for a price
28
- * outside a footer (the header's SPY, the status bar, a quote's headline).
29
- * It reads without hovering: a yellow clock and the delay (`15m`) in the dim
30
- * tone of the meta text around it on the desktop and the web, `◷15m` in the
31
- * terminal, with `15m delayed` in its tooltip. Callers decide when a price is
32
- * late with `freeQuoteDelayMinutes` (or `useFreeQuoteDelay`); it draws nothing else.
28
+ * How many status bar notes say, for the whole app, that this account's
29
+ * prices are late. Counted rather than flagged so a note leaving as another
30
+ * arrives never clears it.
31
+ */
32
+ let statedCount = 0;
33
+ const statedListeners = new Set<() => void>();
34
+
35
+ function subscribeStated(listener: () => void): () => void {
36
+ statedListeners.add(listener);
37
+ return () => {
38
+ statedListeners.delete(listener);
39
+ };
40
+ }
41
+
42
+ function quoteDelayStated(): boolean {
43
+ return statedCount > 0;
44
+ }
45
+
46
+ /**
47
+ * For the status bar's delayed note: while `stating`, the app's prices are
48
+ * said to be late once for the whole screen, so a price outside a pane
49
+ * footer leaves its own mark out (`useDelayedMarkMinutes`).
50
+ */
51
+ export function useStateQuoteDelay(stating: boolean): void {
52
+ useEffect(() => {
53
+ if (!stating) return;
54
+ statedCount += 1;
55
+ for (const listener of statedListeners) listener();
56
+ return () => {
57
+ statedCount -= 1;
58
+ for (const listener of statedListeners) listener();
59
+ };
60
+ }, [stating]);
61
+ }
62
+
63
+ /**
64
+ * The delay to mark beside a price shown outside a pane footer (the header's
65
+ * SPY, a quote's headline): this account's (`useFreeQuoteDelay`) while
66
+ * nothing else on screen says it, null while the price is live or the status
67
+ * bar's delayed note says it for the whole app. The delay is said once per
68
+ * screen: with the status bar hidden (presentation mode, `SB`), or in a
69
+ * capture of the pane alone, the price carries the mark itself.
70
+ */
71
+ export function useDelayedMarkMinutes(quote: QuoteDelayFacts | null | undefined): number | null {
72
+ const minutes = useFreeQuoteDelay(quote);
73
+ const stated = useSyncExternalStore(subscribeStated, quoteDelayStated, quoteDelayStated);
74
+ return stated ? null : minutes;
75
+ }
76
+
77
+ /**
78
+ * The one mark for a price shown late: what the pane footer's clock is for a
79
+ * pane's data (`delayedFooterSegment`), for the status bar's delayed note and
80
+ * for a price outside a footer where nothing else on screen says the delay
81
+ * (`useDelayedMarkMinutes`). It reads without hovering: a yellow clock and the
82
+ * delay (`15m`) in the dim tone of the meta text around it on the desktop and
83
+ * the web, `◷15m` in the terminal, with `15m delayed` in its tooltip. It draws
84
+ * nothing else.
33
85
  */
34
86
  export function DelayedMark({ minutes }: { minutes: number }) {
35
87
  const colors = useThemeColors();
@@ -138,11 +138,6 @@ export interface IconButtonProps {
138
138
  size?: number;
139
139
  /** Keep the press from also reaching a row or header behind the button. */
140
140
  stopPropagation?: boolean;
141
- /**
142
- * A few characters after the icon, in a muted tone, for a status that must
143
- * read without hovering (a delay's `15m`). The label stays the accessible name.
144
- */
145
- text?: string;
146
141
  }
147
142
 
148
143
  /**
@@ -162,7 +157,6 @@ export function IconButton({
162
157
  disabled = false,
163
158
  size = 12,
164
159
  stopPropagation = true,
165
- text,
166
160
  }: IconButtonProps) {
167
161
  const colors = useThemeColors();
168
162
  const label = t(rawLabel);
@@ -188,7 +182,6 @@ export function IconButton({
188
182
  disabled={disabled}
189
183
  size={size}
190
184
  stopPropagation={stopPropagation}
191
- text={text}
192
185
  />
193
186
  );
194
187
  }
@@ -208,7 +201,7 @@ export function IconButton({
208
201
  >
209
202
  {/* Pressed takes the colour the desktop and the terminal pane header give an active toggle. */}
210
203
  <Text fg={disabled ? colors.textMuted : color ?? (pressed ? colors.warning : colors.textDim)} selectable={false}>
211
- {` ${ICON_GLYPHS[icon]}${text ?? ""} `}
204
+ {` ${ICON_GLYPHS[icon]} `}
212
205
  </Text>
213
206
  </Box>
214
207
  );
@@ -2,6 +2,7 @@ import { useMemo, useState, type ComponentType, type ReactNode } from "react";
2
2
  import { Box, Text, TextAttributes, useUiHost, type HostMenuProps, type HostMenuItem } from "../../ui";
3
3
  import { useThemeColors } from "../../theme/theme-context";
4
4
  import { useShortcut } from "../../react/input";
5
+ import { keepEscapeFromClosing } from "../../utils/double-escape-close";
5
6
  import { useRemoteUiNode } from "../../remote/semantic-tree";
6
7
  import { Popover } from "./popover";
7
8
 
@@ -59,7 +60,11 @@ function TerminalMenu({ items, onSelect, selection = "none", title, onClose }: M
59
60
  else if (key === "home" || key === "pageup") setHighlighted(enabled[0]?.id ?? null);
60
61
  else if (key === "end" || key === "pagedown") setHighlighted(enabled[enabled.length - 1]?.id ?? null);
61
62
  else if ((key === "return" || key === "enter" || key === "space") && highlighted) choose(highlighted);
62
- else if (key === "escape") onClose?.();
63
+ else if (key === "escape") {
64
+ // Closing the menu is not half of closing the pane under it.
65
+ keepEscapeFromClosing(event);
66
+ onClose?.();
67
+ }
63
68
  else return;
64
69
  event.preventDefault();
65
70
  event.stopPropagation();
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useId, useMemo, useRef, useState, type ReactNode } from "react";
1
+ import { memo, useCallback, useEffect, useId, useMemo, useRef, useState, type ReactNode } from "react";
2
2
  import { usePaneMenuItems, usePaneTabStripKeys } from "../layout/pane/footer/registration";
3
3
  import type { ContextMenuItem } from "../../types/context-menu";
4
4
  import { useShortcut } from "../../react/input";
@@ -66,7 +66,10 @@ export interface TabsProps {
66
66
 
67
67
  const WHEEL_DELTA_PER_CELL = 8;
68
68
 
69
- export function Tabs({
69
+ /** A pane re-renders on each quote; its tab strip only when the tabs or their state change. */
70
+ export const Tabs = memo(TabsView);
71
+
72
+ function TabsView({
70
73
  tabs: rawTabs,
71
74
  activeValue,
72
75
  onSelect,
@@ -232,7 +232,8 @@ export function resolveTickerForPane(state: AppState, paneId: string, seen = new
232
232
  if (seen.has(paneId)) return null;
233
233
  seen.add(paneId);
234
234
  const instance = findPaneInstance(state.config.layout, paneId);
235
- if (!instance) return null;
235
+ // A pane in another desktop window: the ticker that window shows in it ("" while it shows none).
236
+ if (!instance) return state.linkedTickers?.[paneId] || null;
236
237
  const cursorSymbol = getPaneState(state, paneId).cursorSymbol;
237
238
  if (typeof cursorSymbol === "string" && cursorSymbol.trim()) return cursorSymbol;
238
239
  return resolveTickerFromBinding(state, instance.binding, seen);
@@ -563,18 +564,26 @@ export function focusPaneState(state: AppState, paneId: string): AppState {
563
564
  };
564
565
  }
565
566
 
567
+ /** Panes in another desktop window that panes here follow: their links are not orphaned. */
568
+ export function linkedSourceIds(state: Pick<AppState, "linkedTickers">): ReadonlySet<string> | undefined {
569
+ return state.linkedTickers ? new Set(Object.keys(state.linkedTickers)) : undefined;
570
+ }
571
+
566
572
  export function withFocusedPane(
567
573
  state: AppState,
568
574
  config: AppConfig,
569
575
  options: {
570
576
  paneState?: Record<string, PaneRuntimeState>;
571
577
  focusedPaneId?: string | null;
578
+ /** Follow sources in another window; `state`'s own by default. */
579
+ externalSourceIds?: ReadonlySet<string>;
572
580
  } = {},
573
581
  ): AppState {
574
582
  const normalizedLayout = normalizePaneLayout(config.layout, {
575
583
  // Keep a follower alive on its last symbol when its source pane is gone.
576
584
  resolveOrphanSymbol: (instanceId) => resolveTickerForPane(state, instanceId),
577
585
  pinOrphan: pinFollowingPane,
586
+ externalSourceIds: options.externalSourceIds ?? linkedSourceIds(state),
578
587
  });
579
588
  const nextConfig = normalizedLayout === config.layout
580
589
  ? config
@@ -604,11 +613,17 @@ export function withFocusedPane(
604
613
  }
605
614
 
606
615
  export function hydrateDesktopSnapshot(state: AppState, snapshot: DesktopSharedStateSnapshot): AppState {
607
- return withFocusedPane({
616
+ const linkedTickers = snapshot.linkedTickers && Object.keys(snapshot.linkedTickers).length > 0
617
+ ? snapshot.linkedTickers
618
+ : undefined;
619
+ const next = withFocusedPane({
608
620
  ...state,
609
621
  paneState: snapshot.paneState,
610
622
  brokerSyncErrors: snapshot.brokerSyncErrors ?? {},
611
623
  focusedPaneId: snapshot.focusedPaneId,
612
624
  statusBarVisible: snapshot.statusBarVisible,
613
- }, snapshot.config);
625
+ // A follower whose source in another window just closed stays on the ticker it last had there.
626
+ linkedTickers: linkedTickers || state.linkedTickers ? { ...state.linkedTickers, ...linkedTickers } : undefined,
627
+ }, snapshot.config, { externalSourceIds: linkedSourceIds({ linkedTickers }) ?? new Set() });
628
+ return next.linkedTickers === linkedTickers ? next : { ...next, linkedTickers };
614
629
  }