@gloom-sh/terminal 0.20.17 → 0.20.19

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 (453) hide show
  1. package/package.json +3 -1
  2. package/src/account/auth-dialog.tsx +19 -1
  3. package/src/account/billing.ts +2 -1
  4. package/src/account/heard-from-question.tsx +235 -0
  5. package/src/account/heard-from.ts +97 -0
  6. package/src/api-client/cot.ts +5 -6
  7. package/src/api-client/data.ts +14 -3
  8. package/src/api-client/heard-from.ts +72 -0
  9. package/src/api-client/index.ts +64 -6
  10. package/src/api-client/mna.ts +18 -0
  11. package/src/api-client/request.ts +162 -40
  12. package/src/api-client/supply-chain.ts +9 -0
  13. package/src/api-client/types/billing.ts +35 -1
  14. package/src/api-client/types/news.ts +45 -0
  15. package/src/api-client/types/world-venues.ts +9 -0
  16. package/src/app/global-shortcuts.ts +5 -3
  17. package/src/app/pro-welcome/keys.ts +27 -0
  18. package/src/app/pro-welcome/model.ts +158 -0
  19. package/src/app/pro-welcome/row.tsx +176 -0
  20. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  21. package/src/app/runtime/external-profile-changes.ts +135 -0
  22. package/src/app.tsx +37 -4
  23. package/src/architecture/core-builtin-allowlist.json +1 -1
  24. package/src/architecture/floating-promise-allowlist.json +1 -2
  25. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  26. package/src/cli/alert-listing.ts +98 -0
  27. package/src/cli/commands/market.ts +191 -39
  28. package/src/cli/commands/overview.ts +7 -1
  29. package/src/cli/commands/plugins.ts +3 -2
  30. package/src/cli/commands/search.ts +30 -6
  31. package/src/cli/commands/ticker.ts +13 -6
  32. package/src/cli/context.ts +24 -5
  33. package/src/cli/csv-export.ts +2 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +3 -1
  35. package/src/cli/desktop-pane-shot-view.ts +0 -1
  36. package/src/cli/desktop-pane-shot.ts +276 -52
  37. package/src/cli/errors.ts +3 -9
  38. package/src/cli/exit-codes.ts +1 -1
  39. package/src/cli/glossary.ts +65 -11
  40. package/src/cli/help.ts +1 -1
  41. package/src/cli/history-demergers.ts +117 -0
  42. package/src/cli/history-rows.ts +8 -4
  43. package/src/cli/index.ts +2 -1
  44. package/src/cli/known-gaps.ts +16 -0
  45. package/src/cli/known-us-stocks.ts +18 -0
  46. package/src/cli/listing-arg.ts +192 -38
  47. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  48. package/src/cli/pane-functions/catalog-snapshot.json +877 -0
  49. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  50. package/src/cli/pane-functions/catalog.ts +50 -16
  51. package/src/cli/pane-functions/data.ts +16 -4
  52. package/src/cli/pane-functions/dom.ts +54 -8
  53. package/src/cli/pane-functions/freshness.ts +39 -4
  54. package/src/cli/pane-functions/function-help.ts +3 -3
  55. package/src/cli/pane-functions/headless.ts +9 -1
  56. package/src/cli/pane-functions/index.ts +175 -50
  57. package/src/cli/pane-functions/report-notices.ts +10 -0
  58. package/src/cli/pane-functions/resolver.ts +11 -7
  59. package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
  60. package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
  61. package/src/cli/pane-functions/screenshot-payload.ts +36 -1
  62. package/src/cli/pane-functions/screenshot-render.ts +24 -9
  63. package/src/cli/pane-functions/screenshot-types.ts +9 -0
  64. package/src/cli/quote-answer.ts +33 -17
  65. package/src/cli/registry.ts +22 -2
  66. package/src/cli/result.ts +22 -4
  67. package/src/cli/scroll-truncation.ts +7 -2
  68. package/src/cli/series-search.ts +45 -6
  69. package/src/cli/shot-temp-dir.ts +4 -9
  70. package/src/cli/ticker-resolution.ts +1 -1
  71. package/src/cli/unreachable.ts +21 -0
  72. package/src/components/chart/composite/drawing-store.ts +11 -7
  73. package/src/components/chart/composite/format.ts +1 -0
  74. package/src/components/chart/composite/legend.tsx +48 -20
  75. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  76. package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
  77. package/src/components/chart/composite/panel-surface.tsx +1 -1
  78. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  79. package/src/components/chart/composite/tools.ts +164 -39
  80. package/src/components/chart-table/header.tsx +11 -2
  81. package/src/components/chart-table/layout.ts +16 -17
  82. package/src/components/command-bar/pane-templates/items.ts +17 -1
  83. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  84. package/src/components/command-bar/routes/root/results.ts +34 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +19 -4
  86. package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
  87. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  88. package/src/components/command-bar/selection-runtime.ts +29 -5
  89. package/src/components/command-bar/surface/index.tsx +4 -1
  90. package/src/components/command-bar/workflow/alert.ts +32 -13
  91. package/src/components/data-table/view.tsx +15 -2
  92. package/src/components/form-modal/content.tsx +9 -4
  93. package/src/components/index.ts +1 -1
  94. package/src/components/layout/header.tsx +9 -5
  95. package/src/components/layout/pane/capture-status.ts +6 -0
  96. package/src/components/layout/pane/footer/index.tsx +2 -0
  97. package/src/components/layout/pane/footer/model.ts +123 -17
  98. package/src/components/layout/pane/header.tsx +16 -2
  99. package/src/components/layout/pane/status-footer.ts +24 -0
  100. package/src/components/market-board/index.tsx +4 -2
  101. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  102. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  103. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  104. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  105. package/src/components/onboarding/setup-cards.ts +36 -0
  106. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  107. package/src/components/onboarding/wizard-account.ts +6 -1
  108. package/src/components/onboarding/wizard-model.ts +32 -6
  109. package/src/components/onboarding/wizard-positions.ts +1 -1
  110. package/src/components/price-performance.tsx +26 -8
  111. package/src/components/reader/article-reader.tsx +12 -5
  112. package/src/components/sign-in-gate.tsx +3 -1
  113. package/src/components/toggle-list.tsx +6 -8
  114. package/src/components/ui/confirm-dialog.tsx +47 -7
  115. package/src/components/ui/data-table/opentui/index.tsx +7 -0
  116. package/src/components/ui/data-table/types.ts +8 -0
  117. package/src/components/ui/display.tsx +17 -2
  118. package/src/components/ui/index.ts +1 -1
  119. package/src/components/ui/stat-grid.tsx +4 -0
  120. package/src/components/ui/status.tsx +13 -1
  121. package/src/components/ui/table-layout.ts +34 -2
  122. package/src/components/use-pane-notice-footer.tsx +16 -3
  123. package/src/data/config/store/index.ts +31 -0
  124. package/src/data/config/store/node.ts +61 -11
  125. package/src/data/config/store/normalize.ts +4 -6
  126. package/src/data/config/store/shared-file.ts +309 -0
  127. package/src/data/profile-merge.ts +299 -0
  128. package/src/data/sqlite/checkpointer.ts +11 -1
  129. package/src/data/sqlite/database.ts +1 -1
  130. package/src/data/ticker-repository.ts +134 -10
  131. package/src/data/ticker-store.ts +67 -0
  132. package/src/data/ticker-writes.ts +5 -0
  133. package/src/i18n/es.ts +27 -0
  134. package/src/i18n/ja.ts +27 -0
  135. package/src/i18n/ko.ts +27 -0
  136. package/src/i18n/zh-cn.ts +27 -0
  137. package/src/i18n/zh-tw.ts +27 -0
  138. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  139. package/src/market-data/ah-pair.ts +122 -0
  140. package/src/market-data/coordinator/entries.ts +6 -4
  141. package/src/market-data/coordinator/index.ts +14 -3
  142. package/src/market-data/depositary-pair.ts +6 -2
  143. package/src/market-data/futures-board.ts +36 -29
  144. package/src/market-data/futures-contract.ts +37 -1
  145. package/src/market-data/hooks.tsx +33 -2
  146. package/src/market-data/market/change-basis.ts +11 -1
  147. package/src/market-data/market/header-market.ts +11 -0
  148. package/src/market-data/market/status.ts +40 -4
  149. package/src/market-data/performance.ts +127 -32
  150. package/src/market-data/quotes/time.ts +5 -2
  151. package/src/market-data/split-terms.ts +28 -0
  152. package/src/news/types.ts +28 -0
  153. package/src/notifications/app-badge.ts +2 -3
  154. package/src/notifications/app-notifier.ts +5 -0
  155. package/src/plugins/builtin/account-management/footer.ts +1 -1
  156. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  157. package/src/plugins/builtin/account-management/model.ts +1 -0
  158. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  159. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  160. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  161. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  162. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  163. package/src/plugins/builtin/alerts/cli.ts +101 -48
  164. package/src/plugins/builtin/alerts/command.ts +39 -9
  165. package/src/plugins/builtin/alerts/constants.ts +10 -0
  166. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  167. package/src/plugins/builtin/alerts/event-rows.ts +9 -3
  168. package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
  169. package/src/plugins/builtin/alerts/format.ts +24 -8
  170. package/src/plugins/builtin/alerts/headless.ts +12 -6
  171. package/src/plugins/builtin/alerts/index.tsx +97 -16
  172. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  173. package/src/plugins/builtin/alerts/option-contract.ts +197 -0
  174. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  175. package/src/plugins/builtin/alerts/price.ts +30 -5
  176. package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
  177. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  178. package/src/plugins/builtin/alerts/research-builder.ts +5 -10
  179. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  180. package/src/plugins/builtin/alerts/types.ts +7 -0
  181. package/src/plugins/builtin/analytics/account-returns.ts +1 -1
  182. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  183. package/src/plugins/builtin/analytics/pane-model.ts +2 -2
  184. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  185. package/src/plugins/builtin/analytics/risk-client.ts +27 -14
  186. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  187. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  188. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  189. package/src/plugins/builtin/awards/pane.tsx +1 -1
  190. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  191. package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
  192. package/src/plugins/builtin/catalysts/model.ts +2 -1
  193. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  194. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  195. package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
  196. package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
  197. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  198. package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
  199. package/src/plugins/builtin/chart-composer/headless.ts +2 -0
  200. package/src/plugins/builtin/chart-composer/index.tsx +17 -5
  201. package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
  202. package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
  203. package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
  204. package/src/plugins/builtin/chat/index.tsx +0 -1
  205. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  206. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  207. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  208. package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
  209. package/src/plugins/builtin/company-kpis/headless.ts +10 -5
  210. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  211. package/src/plugins/builtin/company-kpis/model.ts +57 -15
  212. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  213. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  214. package/src/plugins/builtin/composite/application.ts +14 -0
  215. package/src/plugins/builtin/composite/broker.ts +12 -0
  216. package/src/plugins/builtin/composite/credit.ts +33 -0
  217. package/src/plugins/builtin/composite/crypto.ts +10 -0
  218. package/src/plugins/builtin/composite/earnings.ts +12 -0
  219. package/src/plugins/builtin/composite/filings.ts +13 -0
  220. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  221. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  222. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  223. package/src/plugins/builtin/composite/ownership.ts +23 -0
  224. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  225. package/src/plugins/builtin/composite/quant.ts +15 -0
  226. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  227. package/src/plugins/builtin/composite/screeners.ts +11 -0
  228. package/src/plugins/builtin/composite/shared.ts +11 -0
  229. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  230. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  231. package/src/plugins/builtin/congress-trades/model.ts +9 -5
  232. package/src/plugins/builtin/correlation/index.tsx +13 -17
  233. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  234. package/src/plugins/builtin/cot/client.ts +2 -3
  235. package/src/plugins/builtin/cot/headless.ts +16 -16
  236. package/src/plugins/builtin/cot/index.tsx +6 -6
  237. package/src/plugins/builtin/cot/model.ts +25 -5
  238. package/src/plugins/builtin/cot/pane.tsx +11 -6
  239. package/src/plugins/builtin/cot/series.ts +11 -8
  240. package/src/plugins/builtin/cpi/model.ts +15 -4
  241. package/src/plugins/builtin/cpi/pane.tsx +29 -7
  242. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  243. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  244. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  245. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  246. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  247. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  248. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  249. package/src/plugins/builtin/doe/model.ts +30 -0
  250. package/src/plugins/builtin/doe/pane.tsx +8 -2
  251. package/src/plugins/builtin/earnings/board-table.ts +9 -4
  252. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  253. package/src/plugins/builtin/earnings/headless.ts +16 -6
  254. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  255. package/src/plugins/builtin/earnings/history-table.ts +7 -4
  256. package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
  257. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  258. package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
  259. package/src/plugins/builtin/econ/calendar-model.ts +16 -0
  260. package/src/plugins/builtin/econ/index.tsx +7 -2
  261. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  262. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  263. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  264. package/src/plugins/builtin/exposure/model.ts +10 -0
  265. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  266. package/src/plugins/builtin/futures/model.ts +14 -1
  267. package/src/plugins/builtin/futures/series.ts +1 -8
  268. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  269. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  270. package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
  271. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  272. package/src/plugins/builtin/insider/detail.tsx +36 -7
  273. package/src/plugins/builtin/insider/filing-stories.ts +110 -0
  274. package/src/plugins/builtin/insider/headless.ts +37 -2
  275. package/src/plugins/builtin/insider/index.tsx +79 -10
  276. package/src/plugins/builtin/insider/model.ts +43 -5
  277. package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
  278. package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
  279. package/src/plugins/builtin/jobs/headless.ts +2 -1
  280. package/src/plugins/builtin/jobs/model.ts +6 -0
  281. package/src/plugins/builtin/jobs/pane.tsx +8 -3
  282. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  283. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  284. package/src/plugins/builtin/mna/detail.tsx +67 -6
  285. package/src/plugins/builtin/mna/headless.ts +128 -13
  286. package/src/plugins/builtin/mna/model.ts +219 -16
  287. package/src/plugins/builtin/mna/pane.tsx +34 -6
  288. package/src/plugins/builtin/money-markets/model.ts +14 -5
  289. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  290. package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
  291. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  292. package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
  293. package/src/plugins/builtin/options/analytics.ts +1 -1
  294. package/src/plugins/builtin/options/view.tsx +18 -11
  295. package/src/plugins/builtin/options-positioning/model.ts +11 -0
  296. package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
  297. package/src/plugins/builtin/options-scenario/client.ts +49 -8
  298. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  299. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  300. package/src/plugins/builtin/options-scenario/headless.ts +7 -3
  301. package/src/plugins/builtin/options-scenario/model.ts +33 -2
  302. package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
  303. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  304. package/src/plugins/builtin/pe-band/client.ts +13 -1
  305. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  306. package/src/plugins/builtin/pe-band/model.ts +63 -10
  307. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  308. package/src/plugins/builtin/perps/cascade.ts +4 -3
  309. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  310. package/src/plugins/builtin/perps/model.ts +4 -3
  311. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  312. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  313. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  314. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  315. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  316. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  317. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  318. package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
  319. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  320. package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
  321. package/src/plugins/builtin/research/event-model.ts +43 -19
  322. package/src/plugins/builtin/research/headless.ts +8 -1
  323. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  324. package/src/plugins/builtin/research-search/index.tsx +3 -1
  325. package/src/plugins/builtin/scanner/denied.tsx +16 -4
  326. package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
  327. package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
  328. package/src/plugins/builtin/sec/filing-display.tsx +14 -2
  329. package/src/plugins/builtin/sec/headless.ts +42 -4
  330. package/src/plugins/builtin/sec/index.tsx +21 -1
  331. package/src/plugins/builtin/sectors/index.tsx +6 -9
  332. package/src/plugins/builtin/sectors/sector-model.ts +1 -1
  333. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  334. package/src/plugins/builtin/shared/earnings-report.ts +49 -5
  335. package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
  336. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  337. package/src/plugins/builtin/shared/statement-currency.ts +23 -0
  338. package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
  339. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  340. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  341. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  342. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  343. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  344. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  345. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  346. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  347. package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
  348. package/src/plugins/builtin/themes/headless.ts +4 -4
  349. package/src/plugins/builtin/themes/model.ts +11 -8
  350. package/src/plugins/builtin/themes/pane.tsx +2 -2
  351. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  352. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  353. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
  354. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
  355. package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
  356. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
  357. package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
  358. package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
  359. package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
  360. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
  361. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
  362. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
  363. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  364. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  365. package/src/plugins/builtin/volatility/model.ts +17 -0
  366. package/src/plugins/builtin/volatility/pane.tsx +16 -7
  367. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  368. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  369. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  370. package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
  371. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  372. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  373. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  374. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  375. package/src/plugins/builtin/world-venue-map/model.ts +6 -1
  376. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  377. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  378. package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
  379. package/src/plugins/catalog-browser.ts +10 -1
  380. package/src/plugins/catalog-data.ts +20 -0
  381. package/src/plugins/catalog-lazy.ts +51 -0
  382. package/src/plugins/catalog-ui.ts +16 -18
  383. package/src/plugins/host-smoke.ts +5 -2
  384. package/src/portfolio/allocation.ts +79 -19
  385. package/src/portfolio/cash-balances.ts +76 -0
  386. package/src/portfolio/mutations.ts +43 -8
  387. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  388. package/src/renderers/browser/activity.ts +16 -0
  389. package/src/renderers/browser/app-badge-host.ts +14 -0
  390. package/src/renderers/browser/main.tsx +5 -0
  391. package/src/renderers/browser/notifications.ts +103 -0
  392. package/src/renderers/browser/ui-host.tsx +4 -0
  393. package/src/renderers/desktop/window-layouts.ts +14 -0
  394. package/src/renderers/dom/data-table/index.tsx +27 -4
  395. package/src/renderers/dom/data-table/row.tsx +2 -0
  396. package/src/renderers/dom/host/tabs.tsx +57 -8
  397. package/src/renderers/dom/styles.css +13 -5
  398. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  399. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  400. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  401. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  402. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  403. package/src/renderers/electrobun/view/http-fetch.ts +3 -2
  404. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  405. package/src/series/standalone-catalog.ts +5 -4
  406. package/src/series/standalone.ts +13 -7
  407. package/src/sources/gloomberb-cloud/index.ts +22 -9
  408. package/src/sources/gloomberb-cloud/news.ts +35 -0
  409. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  410. package/src/sources/provider-errors.ts +34 -7
  411. package/src/sources/provider-router/financials.ts +20 -13
  412. package/src/sources/provider-router/history.ts +32 -6
  413. package/src/sources/provider-router/index.ts +4 -0
  414. package/src/sources/provider-router/search.ts +1 -0
  415. package/src/sync/collections-contributor.ts +3 -1
  416. package/src/sync/config-merge.ts +10 -1
  417. package/src/sync/sanitize.ts +26 -2
  418. package/src/tickers/company-name-listing.ts +16 -2
  419. package/src/tickers/listing-fate.ts +12 -8
  420. package/src/tickers/renamed-listings.ts +43 -10
  421. package/src/tickers/search/home-listing.ts +28 -0
  422. package/src/tickers/search/index.ts +19 -7
  423. package/src/tickers/terminal-codes.ts +11 -1
  424. package/src/time-series/base-series.ts +39 -6
  425. package/src/time-series/chart-seed.ts +2 -2
  426. package/src/time-series/history-quality.ts +4 -1
  427. package/src/time-series/hooks.ts +2 -0
  428. package/src/time-series/price-comparison.ts +17 -23
  429. package/src/time-series/reporting.ts +1 -1
  430. package/src/time-series/resolution.ts +13 -0
  431. package/src/time-series/resolve-context.ts +6 -0
  432. package/src/time-series/resolve.ts +42 -3
  433. package/src/time-series/spec.ts +2 -2
  434. package/src/time-series/types.ts +3 -2
  435. package/src/types/data-provider.ts +11 -0
  436. package/src/types/financials.ts +48 -4
  437. package/src/types/headless.ts +1 -0
  438. package/src/types/issuer-listings.ts +2 -0
  439. package/src/types/plugin-notifications.ts +3 -0
  440. package/src/types/price-history.ts +6 -4
  441. package/src/types/ticker.ts +10 -2
  442. package/src/ui/host.tsx +2 -0
  443. package/src/utils/cli-output.ts +1 -1
  444. package/src/utils/declared-dividends.ts +13 -1
  445. package/src/utils/dividend-cash.ts +5 -1
  446. package/src/utils/exchange-announcements.ts +7 -2
  447. package/src/utils/forward-dividend.ts +4 -3
  448. package/src/utils/fundamentals.ts +40 -0
  449. package/src/utils/network-failure.ts +2 -0
  450. package/src/utils/price-history-integrity.ts +9 -1
  451. package/src/utils/remove-folder.ts +37 -0
  452. package/src/utils/trailing-dividend.ts +1 -1
  453. package/src/plugins/builtin/composite-plugins.ts +0 -285
@@ -31,8 +31,11 @@ import {
31
31
  pickLargestPosition,
32
32
  withOnboardingProgress,
33
33
  type BrokerOption,
34
+ type OnboardingPositionRow,
34
35
  } from "./wizard-model";
35
36
  import { logFailure } from "../../utils/log-failure";
37
+ import { getSharedMarketDataCoordinator, resolveEntryValue } from "../../market-data/coordinator";
38
+ import { resolveCurrencyUnit } from "../../utils/currency-units";
36
39
  import { useViewport } from "../../react/input";
37
40
 
38
41
  const onboardingLog = debugLog.createLogger("onboarding");
@@ -42,6 +45,24 @@ function saveFailureMessage(error: unknown): string {
42
45
  return message || t("Unable to save onboarding progress.");
43
46
  }
44
47
 
48
+ /**
49
+ * The dollar rates the app already holds for the currencies the rows are
50
+ * valued in, read from the market data cache: setup asks for no rate of its
51
+ * own. Empty for rows all in one currency, which compare as they are.
52
+ */
53
+ function heldUsdRates(rows: readonly OnboardingPositionRow[]): Map<string, number> {
54
+ const currencies = new Set(rows.flatMap((row) => (row.value === null ? [] : [resolveCurrencyUnit(row.currency).currency])));
55
+ const rates = new Map<string, number>();
56
+ if (currencies.size < 2) return rates;
57
+ const coordinator = getSharedMarketDataCoordinator();
58
+ for (const currency of currencies) {
59
+ const entry = currency === "USD" ? null : coordinator?.getFxEntry(currency);
60
+ const rate = entry ? resolveEntryValue(entry) : null;
61
+ if (rate != null && rate > 0) rates.set(currency, rate);
62
+ }
63
+ return rates;
64
+ }
65
+
45
66
  export function useOnboardingProgress({
46
67
  stateRef, dispatch,
47
68
  }: {
@@ -229,7 +250,7 @@ export function useOnboardingWorkspace({
229
250
  .catch(logFailure("onboarding.positions", "Add position on Continue failed"));
230
251
  return;
231
252
  }
232
- const largest = pickLargestPosition(positions.positions);
253
+ const largest = pickLargestPosition(positions.positions, heldUsdRates(positions.positions));
233
254
  if (!largest) {
234
255
  positions.focusField(0);
235
256
  return;
@@ -8,6 +8,7 @@ import {
8
8
  type AccountSubmitError,
9
9
  } from "../../account/auth-model";
10
10
  import { useEmailAuthAttempt } from "../../account/email-auth-attempt";
11
+ import { markHeardFromDue } from "../../account/heard-from";
11
12
 
12
13
  const onboardingLog = debugLog.createLogger("onboarding");
13
14
 
@@ -66,8 +67,10 @@ export function useOnboardingAccount({
66
67
  },
67
68
  onSwitchToLogin: () => switchToAccountLogin(),
68
69
  onAttemptStart: () => setEditingField(false),
69
- onSignedIn: (_user, outcome) => {
70
+ onSignedIn: (user, outcome) => {
70
71
  onboardingLog.info("Onboarding account step completed", { mode: outcome.mode });
72
+ // Asked where it heard about Gloom once setup closes, never inside it.
73
+ markHeardFromDue(user.id);
71
74
  resetAccountPassword();
72
75
  setAccountOutcome(outcome);
73
76
  setAccountSub("signed-in");
@@ -123,6 +126,8 @@ export function useOnboardingAccount({
123
126
  cancel();
124
127
  resetAccountPassword();
125
128
  onboardingLog.info("Onboarding account step completed", { mode: "qr" });
129
+ const accountId = apiClient.getCurrentUser()?.id;
130
+ if (accountId) markHeardFromDue(accountId);
126
131
  setAccountOutcome({ mode: "login", email });
127
132
  setAccountSub("signed-in");
128
133
  nextStep();
@@ -7,6 +7,7 @@ import type { Quote } from "../../types/financials";
7
7
  import type { TickerRecord } from "../../types/ticker";
8
8
  import { getManualPortfolioPosition } from "../../portfolio/mutations";
9
9
  import { resolveCurrencyUnit } from "../../utils/currency-units";
10
+ import { convertCurrency } from "../../utils/format";
10
11
 
11
12
  /**
12
13
  * Stages older builds persisted that the wizard no longer renders. A profile
@@ -128,9 +129,20 @@ export function getConnectableBrokerOptions(
128
129
  return options;
129
130
  }
130
131
 
131
- /** The manual portfolio onboarding writes into: the first one without a broker. */
132
- export function getOnboardingPortfolioId(config: AppConfig): string {
133
- return config.portfolios.find((portfolio) => !portfolio.brokerInstanceId && !portfolio.brokerId)?.id ?? "main";
132
+ /**
133
+ * The manual portfolio onboarding shows and writes into: the first one
134
+ * without a broker that already holds something, so a profile whose
135
+ * portfolios were built with the command line opens on its holdings, not on
136
+ * the empty default; else the first one without a broker.
137
+ */
138
+ export function getOnboardingPortfolioId(config: AppConfig, tickers: Iterable<TickerRecord> = []): string {
139
+ const manual = config.portfolios.filter((portfolio) => !portfolio.brokerInstanceId && !portfolio.brokerId);
140
+ const held = new Set<string>();
141
+ for (const ticker of tickers) {
142
+ for (const id of ticker.metadata.portfolios) held.add(id);
143
+ for (const position of ticker.metadata.positions) if (position.shares !== 0) held.add(position.portfolio);
144
+ }
145
+ return (manual.find((portfolio) => held.has(portfolio.id)) ?? manual[0])?.id ?? "main";
134
146
  }
135
147
 
136
148
  export interface OnboardingPositionRow {
@@ -187,14 +199,28 @@ export function listOnboardingPositions(
187
199
  /**
188
200
  * The company the workspace opens on: the largest holding by value, then the
189
201
  * largest by share count when nothing is priced, then the first row added.
202
+ * Rows valued in more than one currency (US funds beside lira shares) compare
203
+ * in dollars when `usdPerUnit` holds a rate for every one of them, so 2,000
204
+ * shares at TRY55 are not taken for more than 20 SPY at $520; otherwise, and
205
+ * for rows in one currency, the values compare as they are.
190
206
  */
191
- export function pickLargestPosition(rows: readonly OnboardingPositionRow[]): OnboardingPositionRow | null {
207
+ export function pickLargestPosition(
208
+ rows: readonly OnboardingPositionRow[],
209
+ usdPerUnit?: ReadonlyMap<string, number>,
210
+ ): OnboardingPositionRow | null {
192
211
  if (rows.length === 0) return null;
212
+ const valued = rows.filter((row) => row.value !== null);
213
+ const inDollars = (row: OnboardingPositionRow) => convertCurrency(row.value!, row.currency, "USD", new Map(usdPerUnit));
214
+ const dollars = !!usdPerUnit
215
+ && new Set(valued.map((row) => resolveCurrencyUnit(row.currency).currency)).size > 1
216
+ && valued.every((row) => Number.isFinite(inDollars(row)));
217
+ const valueOf = (row: OnboardingPositionRow) => (dollars && row.value !== null ? inDollars(row) : row.value);
193
218
  let best = rows[0]!;
194
219
  for (const row of rows.slice(1)) {
195
- if ((row.value ?? -1) > (best.value ?? -1)) {
220
+ const [value, bestValue] = [valueOf(row), valueOf(best)];
221
+ if ((value ?? -1) > (bestValue ?? -1)) {
196
222
  best = row;
197
- } else if (row.value === null && best.value === null && (row.shares ?? -1) > (best.shares ?? -1)) {
223
+ } else if (value === null && bestValue === null && (row.shares ?? -1) > (best.shares ?? -1)) {
198
224
  best = row;
199
225
  }
200
226
  }
@@ -115,7 +115,7 @@ export function useOnboardingPositions({
115
115
  const stateRef = useAppStateRef();
116
116
  const tickers = useAppSelector((state) => state.tickers);
117
117
  const financials = useAppSelector((state) => state.financials);
118
- const portfolioId = useAppSelector((state) => getOnboardingPortfolioId(state.config));
118
+ const portfolioId = useAppSelector((state) => getOnboardingPortfolioId(state.config, state.tickers.values()));
119
119
  const [draft, setDraft] = useState<PositionDraft>(EMPTY_DRAFT);
120
120
  const [fieldIdx, setFieldIdx] = useState(0);
121
121
  const [preview, setPreview] = useState<PositionPreview>({ status: "idle" });
@@ -21,6 +21,22 @@ function hasAnyReturn(fields: readonly PriceReturnField[]): boolean {
21
21
  interface ReturnPair {
22
22
  field: PriceReturnField;
23
23
  value: string;
24
+ /** `from 17 Oct`: the day of the close the return is measured from. */
25
+ base: string;
26
+ }
27
+
28
+ const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] as const;
29
+
30
+ /** `from 17 Oct`, with the year when it is not this one's: `from 17 Nov 2025`. Empty without a base. */
31
+ function priceReturnBaseText(day: string | undefined, now = Date.now()): string {
32
+ const date = day ? new Date(`${day.slice(0, 10)}T00:00:00Z`) : null;
33
+ if (!date || !Number.isFinite(date.getTime())) return "";
34
+ const year = date.getUTCFullYear() === new Date(now).getUTCFullYear() ? "" : ` ${date.getUTCFullYear()}`;
35
+ return `from ${date.getUTCDate()} ${MONTHS[date.getUTCMonth()]}${year}`;
36
+ }
37
+
38
+ function pairWidth(pair: ReturnPair): number {
39
+ return displayWidth(pair.field.label) + 1 + displayWidth(pair.value) + (pair.base ? 1 + displayWidth(pair.base) : 0);
24
40
  }
25
41
 
26
42
  /** Pairs fill a row left to right and wrap whole, never splitting a label from its value. */
@@ -28,20 +44,20 @@ function packPairs(pairs: readonly ReturnPair[], width: number): ReturnPair[][]
28
44
  const rows: ReturnPair[][] = [];
29
45
  let rowWidth = 0;
30
46
  for (const pair of pairs) {
31
- const pairWidth = displayWidth(pair.field.label) + 1 + displayWidth(pair.value);
47
+ const cells = pairWidth(pair);
32
48
  const row = rows.at(-1);
33
- if (row && rowWidth + PAIR_GAP + pairWidth <= width) {
49
+ if (row && rowWidth + PAIR_GAP + cells <= width) {
34
50
  row.push(pair);
35
- rowWidth += PAIR_GAP + pairWidth;
51
+ rowWidth += PAIR_GAP + cells;
36
52
  } else {
37
53
  rows.push([pair]);
38
- rowWidth = pairWidth;
54
+ rowWidth = cells;
39
55
  }
40
56
  }
41
57
  return rows;
42
58
  }
43
59
 
44
- /** Each horizon's label with its return beside it: `1M +3.29% 3M +6.99%`. */
60
+ /** Each horizon's label with its return and the close it runs from beside it: `1M +3.29% from 17 Oct 3M +6.99% from 17 Aug`. */
45
61
  export function PriceReturnStrip({
46
62
  fields,
47
63
  width,
@@ -51,16 +67,17 @@ export function PriceReturnStrip({
51
67
  }) {
52
68
  const { nativePaneChrome } = useUiCapabilities();
53
69
  if (!hasAnyReturn(fields)) return null;
54
- const pairs = fields.map((field) => ({ field, value: formatReturnValue(field.value) }));
70
+ const pairs = fields.map((field) => ({ field, value: formatReturnValue(field.value), base: field.value == null ? "" : priceReturnBaseText(field.baseDay) }));
55
71
  if (nativePaneChrome) {
56
72
  // The desktop and the web wrap the pairs where the pane's own edge is, whole, so a resize re-wraps them
57
73
  // on every frame instead of in the steps of the cells the terminal counts.
58
74
  return (
59
75
  <Box flexDirection="row" flexWrap="wrap" columnGap={PAIR_GAP} data-gloom-role="price-return-strip">
60
- {pairs.map(({ field, value }) => (
76
+ {pairs.map(({ field, value, base }) => (
61
77
  <Box key={field.id} flexDirection="row" gap={1} flexShrink={0}>
62
78
  <Text fg={colors.textDim}>{field.label}</Text>
63
79
  <Text fg={returnValueColor(field.value)}>{value}</Text>
80
+ {base ? <Text fg={colors.textMuted}>{base}</Text> : null}
64
81
  </Box>
65
82
  ))}
66
83
  </Box>
@@ -72,10 +89,11 @@ export function PriceReturnStrip({
72
89
  <Box flexDirection="column" width={width}>
73
90
  {rows.map((row, rowIndex) => (
74
91
  <Box key={rowIndex} flexDirection="row" height={1} gap={PAIR_GAP} overflow="hidden">
75
- {row.map(({ field, value }) => (
92
+ {row.map(({ field, value, base }) => (
76
93
  <Box key={field.id} flexDirection="row" gap={1} flexShrink={0}>
77
94
  <Text fg={colors.textDim}>{field.label}</Text>
78
95
  <Text fg={returnValueColor(field.value)}>{value}</Text>
96
+ {base ? <Text fg={colors.textMuted}>{base}</Text> : null}
79
97
  </Box>
80
98
  ))}
81
99
  </Box>
@@ -65,6 +65,12 @@ export interface ArticleReaderProps {
65
65
  height: number;
66
66
  onNext?: (() => void) | null;
67
67
  onPrevious?: (() => void) | null;
68
+ /**
69
+ * Labelled parts after the text and before `children`, each under its own
70
+ * label as `children` is under `childrenLabel`: a story's filings before its
71
+ * coverage. Empty parts are left out.
72
+ */
73
+ sections?: ReadonlyArray<{ label: string; content: ReactNode }>;
68
74
  /** After the text, such as a story's coverage by other outlets, under `childrenLabel`. */
69
75
  children?: ReactNode;
70
76
  childrenLabel?: string;
@@ -192,6 +198,7 @@ function ArticleReaderView({
192
198
  height,
193
199
  onNext,
194
200
  onPrevious,
201
+ sections = [],
195
202
  children,
196
203
  childrenLabel,
197
204
  }: ArticleReaderProps) {
@@ -402,14 +409,14 @@ function ArticleReaderView({
402
409
  </ActionRow>
403
410
  </Box>
404
411
  ) : null}
405
- {children ? (
406
- <Box flexDirection="column" style={desktop ? { marginTop: !childrenLabel && (lead || blocks.length > 0) ? "0.8em" : 0 } : undefined}>
407
- {childrenLabel ? <ReaderText text={readerLabel(childrenLabel)} geometry={geometry} color={labelColor} variant="label" /> : null}
412
+ {[...sections.filter((section) => section.content), ...(children ? [{ label: childrenLabel, content: children }] : [])].map((section, index) => (
413
+ <Box key={`${section.label ?? ""}:${index}`} flexDirection="column" style={desktop ? { marginTop: !section.label && (lead || blocks.length > 0) ? "0.8em" : 0 } : undefined}>
414
+ {section.label ? <ReaderText text={readerLabel(section.label)} geometry={geometry} color={labelColor} variant="label" /> : null}
408
415
  <Box flexDirection="column" style={desktop ? { fontSize: READER_APP_FONT, lineHeight: "normal" } : undefined}>
409
- {children}
416
+ {section.content}
410
417
  </Box>
411
418
  </Box>
412
- ) : null}
419
+ ))}
413
420
  </Box>
414
421
  );
415
422
 
@@ -12,6 +12,7 @@ import { t } from "../i18n";
12
12
  import { useAppLanguage } from "../i18n/react";
13
13
  import { matchesKeyChord, parseKeyChord } from "../app/keybindings";
14
14
  import { AuthForm, authFormTitle } from "../account/auth-form";
15
+ import { markHeardFromDue } from "../account/heard-from";
15
16
  import type { AccountMode } from "../account/auth-model";
16
17
  import {
17
18
  DeviceSignInPanel,
@@ -95,7 +96,8 @@ function GateEmailSignIn({
95
96
  initialMode="signup"
96
97
  shortcutScope={GATE_SCOPE}
97
98
  onModeChange={onModeChange}
98
- onSignedIn={() => {}}
99
+ // Where it heard about Gloom is asked once the gate, and setup after it, have closed.
100
+ onSignedIn={(user) => markHeardFromDue(user.id)}
99
101
  footer={(
100
102
  <Box flexDirection="row">
101
103
  <Button
@@ -36,8 +36,8 @@ export interface ToggleListProps {
36
36
  remoteMetadata?: Record<string, unknown>;
37
37
  /**
38
38
  * The terminal row's width in cells. With it, a label and detail that do
39
- * not both fit are cut with an ellipsis, the label first down to a few
40
- * words' room, and a two-cell gap always parts them; without it they are
39
+ * not both fit are cut with an ellipsis, the detail first, and a
40
+ * two-cell gap always parts them; without it they are
41
41
  * drawn whole.
42
42
  */
43
43
  width?: number;
@@ -46,8 +46,6 @@ export interface ToggleListProps {
46
46
  /** The checkbox's `> [ ] ` before a label, and the gap kept before the detail. */
47
47
  const CHECKBOX_PREFIX = 6;
48
48
  const DETAIL_GAP = 2;
49
- /** The label keeps this much before the detail is cut. */
50
- const LABEL_MIN = 10;
51
49
 
52
50
  /** Words that fit `width`, then an ellipsis: a list of codes is never cut inside one. */
53
51
  function clipWords(text: string, width: number): string {
@@ -64,15 +62,15 @@ function clipWords(text: string, width: number): string {
64
62
 
65
63
  /**
66
64
  * A terminal toggle row's label and detail, cut to fit `width` with an
67
- * ellipsis: the label gives way first, down to `LABEL_MIN` cells, then the
68
- * detail, at a word. Whole when they fit.
65
+ * ellipsis: the detail gives way first, at a word. Whole when they fit.
69
66
  */
70
67
  export function fitToggleRow(label: string, detail: string | undefined, width: number): { label: string; detail: string | undefined } {
71
68
  const room = Math.max(0, width - CHECKBOX_PREFIX);
72
69
  if (!detail) return { label: clipToDisplayWidth(label, room), detail };
73
70
  const available = Math.max(0, room - DETAIL_GAP);
74
- const labelWidth = Math.min(displayWidth(label), Math.max(Math.min(LABEL_MIN, displayWidth(label)), available - displayWidth(detail)));
75
- return { label: clipToDisplayWidth(label, labelWidth), detail: clipWords(detail, Math.max(0, available - labelWidth)) };
71
+ const labelWidth = Math.min(displayWidth(label), available);
72
+ const fittedDetail = clipWords(detail, Math.max(0, available - labelWidth));
73
+ return { label: clipToDisplayWidth(label, fittedDetail ? labelWidth : room), detail: fittedDetail || undefined };
76
74
  }
77
75
 
78
76
  function DesktopToggleRow({
@@ -4,7 +4,7 @@ import { colors } from "../../theme/colors";
4
4
  import { t, tf } from "../../i18n";
5
5
  import { type DialogApi, type PromptContext, useDialogKeyboard } from "../../ui/dialog";
6
6
  import type { InputRenderable } from "../../ui/host";
7
- import type { KeyEventLike } from "../../react/input";
7
+ import { useViewport, type KeyEventLike } from "../../react/input";
8
8
  import { isPlainKey } from "../../utils/keyboard";
9
9
  import { Button, type ButtonVariant } from "./button";
10
10
  import { DialogActions } from "./dialog-actions";
@@ -78,10 +78,20 @@ export interface ConfirmDialogProps extends PromptContext<boolean> {
78
78
  question?: ConfirmDialogQuestion;
79
79
  /** With `question`: what it got, called as the dialog confirms. */
80
80
  onAnswer?: (answer: ConfirmDialogAnswer) => void;
81
+ /**
82
+ * For a confirm whose two buttons are both ways on, such as an offer's
83
+ * accept and continue: Esc and the desktop close button leave without
84
+ * either answer (the prompt resolves undefined) instead of pressing the
85
+ * cancel button. See `confirmDialogChoice`.
86
+ */
87
+ escapeLeaves?: boolean;
88
+ /** Buttons that do not fit the dialog's width (long labels on a phone) wrap to another row. */
89
+ wrapButtons?: boolean;
81
90
  }
82
91
 
83
92
  export function ConfirmDialog({
84
93
  resolve,
94
+ dismiss,
85
95
  title,
86
96
  body,
87
97
  confirmLabel,
@@ -97,9 +107,15 @@ export function ConfirmDialog({
97
107
  defaultAction = "confirm",
98
108
  question,
99
109
  onAnswer,
110
+ escapeLeaves = false,
111
+ wrapButtons = false,
100
112
  }: ConfirmDialogProps) {
101
113
  const enterCancels = defaultAction === "cancel";
102
114
  const desktop = useUiHost().kind === "desktop-web";
115
+ // The terminal's dialog box is the window less its border and padding: a
116
+ // narrow terminal wraps the words inside it rather than past its edge.
117
+ const viewport = useViewport();
118
+ const terminalWidth = Math.max(16, Math.min(width, viewport.width - 8));
103
119
  const openedAt = useRef(Date.now());
104
120
  const answer = useQuestionAnswer(question);
105
121
  const confirm = useCallback(() => {
@@ -107,6 +123,7 @@ export function ConfirmDialog({
107
123
  resolve(true);
108
124
  }, [answer, onAnswer, question, resolve]);
109
125
  const cancel = useCallback(() => resolve(false), [resolve]);
126
+ const leave = escapeLeaves ? dismiss : cancel;
110
127
 
111
128
  // Every key, even with a field focused under the dialog: a confirm has
112
129
  // nothing to type into but its own note, so nothing below should take one.
@@ -120,7 +137,7 @@ export function ConfirmDialog({
120
137
  event.stopPropagation();
121
138
  if (event.name === "escape") {
122
139
  event.preventDefault();
123
- cancel();
140
+ leave();
124
141
  return;
125
142
  }
126
143
  if (busy) {
@@ -162,27 +179,31 @@ export function ConfirmDialog({
162
179
  onPress={confirm}
163
180
  />
164
181
  );
165
- const cancelButton = <Button label={cancelLabel} variant={enterCancels ? "primary" : "secondary"} disabled={busy} desktopShortcut={keys ? (enterCancels ? "Enter" : "Esc") : undefined} onPress={cancel} />;
182
+ // With Esc stepping out, `n` is the cancel button's key.
183
+ const cancelKey = enterCancels ? "Enter" : escapeLeaves ? "N" : "Esc";
184
+ const cancelButton = <Button label={cancelLabel} variant={enterCancels ? "primary" : "secondary"} disabled={busy} desktopShortcut={keys ? cancelKey : undefined} onPress={cancel} />;
166
185
  const noteKey = question?.notePlaceholder !== undefined;
167
186
  const keyLine = enterCancels
168
187
  ? noteKey
169
188
  ? tf("y {action} · Tab note · Enter or Esc {cancel}", { action: t(confirmLabel).toLowerCase(), cancel: t(cancelLabel).toLowerCase() })
170
189
  : tf("y {action} · Enter or Esc {cancel}", { action: t(confirmLabel).toLowerCase(), cancel: t(cancelLabel).toLowerCase() })
171
- : tf("Enter {action} · Esc cancel", { action: t(confirmLabel).toLowerCase() });
190
+ : escapeLeaves
191
+ ? tf("Enter {action} · n {cancel} · Esc close", { action: t(confirmLabel).toLowerCase(), cancel: t(cancelLabel).toLowerCase() })
192
+ : tf("Enter {action} · Esc cancel", { action: t(confirmLabel).toLowerCase() });
172
193
  return (
173
194
  <DialogFrame
174
195
  title={title}
175
196
  footer={footer ?? keyLine}
176
197
  desktopFooter={null}
177
198
  // The terminal's Cancel is its mouse close already: a second close in the title would only repeat it.
178
- onClose={desktop ? onClose : undefined}
199
+ onClose={desktop ? (escapeLeaves ? dismiss : onClose) : undefined}
179
200
  >
180
- <Box flexDirection="column" {...(desktop ? { style: { width: fitDialogWidth(width) } } : { width })}>
201
+ <Box flexDirection="column" {...(desktop ? { style: { width: fitDialogWidth(width) } } : { width: terminalWidth })}>
181
202
  {renderBody(body)}
182
203
  {question && (
183
204
  <>
184
205
  <Box height={1} />
185
- <QuestionFields question={question} answer={answer} width={width} disabled={busy} />
206
+ <QuestionFields question={question} answer={answer} width={terminalWidth} disabled={busy} />
186
207
  </>
187
208
  )}
188
209
  {status && (
@@ -194,6 +215,7 @@ export function ConfirmDialog({
194
215
  <Box height={1} />
195
216
  <DialogActions
196
217
  alignEnd={formButtons}
218
+ wrap={wrapButtons}
197
219
  hints={question && keys ? { keys: [{ key: "↑↓", label: "choose" }, ...noteKey ? [{ key: "Tab", label: "note" }] : []] } : undefined}
198
220
  >
199
221
  {formButtons ? cancelButton : confirmButton}
@@ -410,6 +432,24 @@ export async function confirmDialogWithAnswer(
410
432
  return confirmed === true ? answer : null;
411
433
  }
412
434
 
435
+ /**
436
+ * A confirm whose two buttons are both ways on (an offer's accept and its
437
+ * continue): "confirm" or "cancel" for the button pressed, null when the
438
+ * person stepped out instead (Esc, a click outside, the desktop close button,
439
+ * a failed dialog).
440
+ */
441
+ export async function confirmDialogChoice(
442
+ dialog: DialogApi,
443
+ { closeOnClickOutside = true, ...props }: ConfirmDialogOptions,
444
+ ): Promise<"confirm" | "cancel" | null> {
445
+ const answer = await dialog.prompt<boolean>({
446
+ closeOnClickOutside,
447
+ content: (context) => <ConfirmDialog {...context} {...props} escapeLeaves />,
448
+ }).catch(logFailure("ui.confirm-dialog", "Open confirm dialog failed"));
449
+ if (answer === true) return "confirm";
450
+ return answer === false ? "cancel" : null;
451
+ }
452
+
413
453
  function renderBody(body: ReactNode | string | string[]): ReactNode {
414
454
  if (Array.isArray(body)) {
415
455
  return body.map((line, index) => (
@@ -20,6 +20,7 @@ import {
20
20
  tableColumnWidth,
21
21
  fitTableHeaderText,
22
22
  getTableWidth,
23
+ hiddenTableColumnText,
23
24
  hasMeaningfulTableHorizontalOverflow,
24
25
  tableColumnLeadGap,
25
26
  tableColumnStarts,
@@ -647,6 +648,7 @@ export function OpenTuiDataTable<T, C extends DataTableColumn = DataTableColumn>
647
648
  viewportWidth: measuredViewportWidth,
648
649
  }) : null;
649
650
  const moreColumnsReserve = moreColumns?.reserve ?? 0;
651
+ const hiddenColumns = items.length ? hiddenTableColumnText(columns) : null;
650
652
  // A scroll step that cuts the columns as the last one did keeps the same
651
653
  // array, so the memoized rows skip the render.
652
654
  const columnClipsRef = useRef<readonly (DataTableColumnClip | null)[] | null>(null);
@@ -984,6 +986,11 @@ export function OpenTuiDataTable<T, C extends DataTableColumn = DataTableColumn>
984
986
  <Text fg={colors.textDim}>{moreColumns.text}</Text>
985
987
  </Box>
986
988
  ) : null}
989
+ {hiddenColumns ? (
990
+ <Box height={1} paddingX={horizontalPadding} backgroundColor={colors.panel}>
991
+ <Text fg={colors.textDim}>{hiddenColumns}</Text>
992
+ </Box>
993
+ ) : null}
987
994
 
988
995
  <ScrollBox
989
996
  id={bodyScrollId}
@@ -62,6 +62,14 @@ export interface DataTableCell {
62
62
  * header: MCAP (USD).
63
63
  */
64
64
  valueUnit?: string;
65
+ /**
66
+ * This row has no value here yet, with nothing missing: it comes after an
67
+ * event the row is still waiting on (an economic release not yet out). The
68
+ * column-wide form is DataTableColumn.mayBeBlank; this one is for a column
69
+ * whose other rows must have the value. `shot --strict` counts a column
70
+ * blank in every other row as data the pane lost, and leaves this row out.
71
+ */
72
+ mayBeBlank?: boolean;
65
73
  content?: ReactNode;
66
74
  /**
67
75
  * The cells `content` takes to show whole in the terminal, where a table
@@ -5,6 +5,7 @@ import { blendForContrast, higherContrast } from "../../theme/color-utils";
5
5
  import { useThemeColors } from "../../theme/theme-context";
6
6
  import { Box, Text, TextAttributes, useUiCapabilities } from "../../ui";
7
7
  import { truncateToDisplayWidth } from "../../utils/format";
8
+ import { clipKeepingEnd } from "./table-layout";
8
9
  import { CountryFlagLead } from "./country-flag";
9
10
  import { usePaneLinkMenuEntry } from "./external-link";
10
11
  import { ICON_GLYPHS, Icon, type IconName } from "./icon";
@@ -96,6 +97,12 @@ export interface ClippedTextProps {
96
97
  cut?: (text: string, width: number) => string;
97
98
  /** The desktop wraps it onto more lines instead (a message, a description); the terminal still cuts it. */
98
99
  wrap?: boolean;
100
+ /**
101
+ * The end of `text` a cut keeps whole, as a table cell's `keepEnd` does: what tells it apart from its
102
+ * neighbours ("Customer 1", "Customer A"). The cut shortens what comes before it, in the terminal by its
103
+ * count of cells and on the desktop and the web by CSS.
104
+ */
105
+ keepEnd?: string | null;
99
106
  }
100
107
 
101
108
  /**
@@ -104,10 +111,18 @@ export interface ClippedTextProps {
104
111
  * `wrap`. Its box (or its row, with the siblings that keep their room) has to
105
112
  * bound it there.
106
113
  */
107
- export function ClippedText({ text, width, fg, attributes, flex = "0 1 auto", lead = "", cut = truncateToDisplayWidth, wrap = false }: ClippedTextProps) {
114
+ export function ClippedText({ text, width, fg, attributes, flex = "0 1 auto", lead = "", cut = truncateToDisplayWidth, wrap = false, keepEnd = null }: ClippedTextProps) {
108
115
  const { nativePaneChrome } = useUiCapabilities();
109
116
  const ink = { ...(fg === undefined ? {} : { fg }), ...(attributes === undefined ? {} : { attributes }) };
110
- if (!nativePaneChrome) return <Text {...ink}>{`${lead}${cut(text, width)}`}</Text>;
117
+ const end = keepEnd && text.endsWith(keepEnd) && text.length > keepEnd.length ? keepEnd : null;
118
+ if (!nativePaneChrome) return <Text {...ink}>{`${lead}${end ? clipKeepingEnd(text, width, end) : cut(text, width)}`}</Text>;
119
+ // The desktop clips what comes before the end, which keeps its own room beside it.
120
+ if (end && !wrap) {
121
+ return <Box flexDirection="row" style={{ minWidth: 0, flex, overflow: "hidden" }}>
122
+ <Text {...ink} style={{ ...NATIVE_CLIP_STYLE, flex: "0 1 auto" }}>{`${lead}${text.slice(0, -end.length)}`}</Text>
123
+ <Text {...ink} style={{ flex: "0 0 auto", whiteSpace: "pre" }}>{end}</Text>
124
+ </Box>;
125
+ }
111
126
  return wrap
112
127
  ? <Text {...ink} wrapText style={{ minWidth: 0, flex }}>{`${lead}${text}`}</Text>
113
128
  : <Text {...ink} style={{ ...NATIVE_CLIP_STYLE, flex }}>{`${lead}${text}`}</Text>;
@@ -62,7 +62,7 @@ export { Tabs } from "./tabs";
62
62
  export type { TabsProps } from "./tabs";
63
63
  export { SegmentedControl } from "./toggle";
64
64
  export type { SegmentedControlProps } from "./toggle";
65
- export { EmptyState, PaneStatusBody, Notice, loadingText, unavailableText } from "./status";
65
+ export { EmptyState, PaneStatusBody, Notice, RowNote, loadingText, unavailableText } from "./status";
66
66
  export type { EmptyStateProps, PaneStatusBodyProps, NoticeProps, StatusRetry } from "./status";
67
67
  export { Badge, BulletList, Divider, FigureList, KeyValueRow, Prose, READING_WIDTH, Section, SectionHeading } from "./display";
68
68
  export { Card } from "./card";
@@ -25,6 +25,8 @@ export function statToneColor(tone: StatTone | undefined, colors: ThemeColors):
25
25
  */
26
26
  export interface StatItem {
27
27
  id?: string;
28
+ /** Opt in only for figures that must survive ahead of table rows and pass screenshot certification. */
29
+ essential?: boolean;
28
30
  label: string;
29
31
  value: string;
30
32
  detail?: string;
@@ -380,6 +382,7 @@ export function StatGrid({ items, width, columns: columnsProp, maxLines }: StatG
380
382
  data-wide={item.wide ? "true" : undefined}
381
383
  data-wrapped="true"
382
384
  data-gloom-stat-id={item.id}
385
+ data-gloom-essential={item.essential === true ? "true" : undefined}
383
386
  >
384
387
  <Text fg={colors.textDim} data-gloom-role="stat-grid-label">
385
388
  {nativePaneChrome ? label : labelText(label, labelWidth)}
@@ -434,6 +437,7 @@ export function StatGrid({ items, width, columns: columnsProp, maxLines }: StatG
434
437
  data-gloom-role="stat-grid-cell"
435
438
  data-wide={item.wide ? "true" : undefined}
436
439
  data-gloom-stat-id={item.id}
440
+ data-gloom-essential={item.essential === true ? "true" : undefined}
437
441
  // The last cell of a short row takes the columns left over, so the
438
442
  // band never ends in an empty cell.
439
443
  style={nativePaneChrome && !item.wide && index === row.length - 1 && row.length < columns
@@ -243,13 +243,14 @@ export interface NoticeProps {
243
243
  export function Notice({ children, tone = "warning", variant = "inline" }: NoticeProps) {
244
244
  const colors = useThemeColors();
245
245
  const native = useUiCapabilities().nativePaneChrome;
246
+ const { id, flush } = useFlushInPane(native === true && variant === "inline");
246
247
  const color = tone === "muted" ? colors.textDim : colors[tone];
247
248
  const status = tone === "negative" ? "error" : "notice";
248
249
  const body = typeof children === "string" ? readableError(children) : children;
249
250
  // Inline feedback keeps its original single-text shape: a flex row here collapses inside content-sized parents.
250
251
  if (variant !== "callout") {
251
252
  return (
252
- <Box data-gloom-status={status} data-gloom-ui="notice">
253
+ <Box id={id} data-gloom-status={status} data-gloom-ui="notice" style={flush ? { paddingInline: "var(--gloom-inset)" } : undefined}>
253
254
  <Text fg={color} wrapText>{body}</Text>
254
255
  </Box>
255
256
  );
@@ -262,6 +263,17 @@ export function Notice({ children, tone = "warning", variant = "inline" }: Notic
262
263
  );
263
264
  }
264
265
 
266
+ /**
267
+ * What concerns the selected row of a table that has no detail of its own,
268
+ * said under the table (DataTableView `rootAfter`) while the row is
269
+ * selected: the whole reason behind the few words its row shows
270
+ * (docs/pane-conventions.md, Row messages). Nothing while no row has one.
271
+ */
272
+ export function RowNote({ children, tone = "warning" }: Pick<NoticeProps, "tone"> & { children: ReactNode | null | undefined }) {
273
+ if (children == null || children === "") return null;
274
+ return <Box paddingX={1} flexShrink={0}><Notice tone={tone}>{children}</Notice></Box>;
275
+ }
276
+
265
277
  /** The one loading phrasing: "Loading ..." with three dots, never the ellipsis glyph. */
266
278
  export function loadingText(thing?: string): string {
267
279
  return thing ? tf("Loading {thing}...", { thing }) : t("Loading...");