gloomberb 0.20.13 → 0.20.16

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 (275) hide show
  1. package/package.json +2 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +22 -4
  3. package/src/account/auth-dialog.tsx +22 -4
  4. package/src/account/auth-form.tsx +6 -1
  5. package/src/account/checkout-handoff.tsx +7 -14
  6. package/src/account/device-signin-dialog.tsx +35 -24
  7. package/src/api-client/crypto-markets.ts +10 -0
  8. package/src/api-client/errors.ts +3 -1
  9. package/src/api-client/index.ts +54 -0
  10. package/src/api-client/install-experiments.ts +8 -7
  11. package/src/api-client/money-markets.ts +7 -0
  12. package/src/api-client/paths.ts +2 -1
  13. package/src/api-client/product-waitlist.ts +63 -0
  14. package/src/api-client/request.ts +16 -4
  15. package/src/api-client/types/billing.ts +45 -0
  16. package/src/api-client/yearly-plan.ts +132 -0
  17. package/src/app/global-shortcuts.ts +5 -3
  18. package/src/app/pane-runtime/index.tsx +2 -2
  19. package/src/app/pane-runtime/plugin-bindings.ts +3 -1
  20. package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
  21. package/src/app/since-last-visit/keys.ts +26 -0
  22. package/src/app/since-last-visit/model.ts +266 -0
  23. package/src/app/since-last-visit/strip.tsx +193 -0
  24. package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
  25. package/src/app/since-last-visit/visit-tracker.ts +191 -0
  26. package/src/app.tsx +15 -0
  27. package/src/architecture/floating-promise-allowlist.json +0 -1
  28. package/src/brokers/signed-in/sign-in-dialog.tsx +38 -38
  29. package/src/cli/commands/market.ts +103 -27
  30. package/src/cli/commands/overview.ts +18 -4
  31. package/src/cli/commands/system.ts +29 -1
  32. package/src/cli/commands/ticker.ts +12 -5
  33. package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +2 -1
  35. package/src/cli/desktop-pane-shot-view.ts +3 -7
  36. package/src/cli/desktop-pane-shot.ts +26 -28
  37. package/src/cli/errors.ts +3 -1
  38. package/src/cli/freshness.ts +7 -2
  39. package/src/cli/glossary.ts +10 -5
  40. package/src/cli/help.ts +1 -0
  41. package/src/cli/helpers.ts +8 -16
  42. package/src/cli/history-export.ts +4 -0
  43. package/src/cli/history-rows.ts +24 -0
  44. package/src/cli/index.ts +4 -0
  45. package/src/cli/known-gaps.ts +2 -2
  46. package/src/cli/listing-arg.ts +79 -11
  47. package/src/cli/not-a-ticker.ts +4 -0
  48. package/src/cli/options.ts +29 -1
  49. package/src/cli/pane-functions/catalog.ts +70 -12
  50. package/src/cli/pane-functions/function-help.ts +1 -1
  51. package/src/cli/pane-functions/headless.ts +68 -3
  52. package/src/cli/pane-functions/index.ts +2 -2
  53. package/src/cli/pane-functions/options.ts +7 -0
  54. package/src/cli/pane-functions/resolver.ts +104 -15
  55. package/src/cli/pane-functions/screenshot-payload.ts +3 -0
  56. package/src/cli/report-tables.ts +20 -5
  57. package/src/cli/result.ts +22 -4
  58. package/src/cli/shot-temp-dir.ts +30 -0
  59. package/src/cli/suffixed-listing-rows.ts +11 -0
  60. package/src/cli/symbol-args.ts +5 -3
  61. package/src/cli/symbol-list.ts +23 -10
  62. package/src/cli/symbol-rows.ts +135 -3
  63. package/src/cli/treasury-yields.ts +15 -1
  64. package/src/components/chart/composite/composite-chart.tsx +3 -3
  65. package/src/components/chart/composite/format.ts +2 -1
  66. package/src/components/chart/composite/panel-surface/axis-markers.ts +133 -0
  67. package/src/components/chart/composite/panel-surface/level-labels.tsx +78 -0
  68. package/src/components/chart/composite/panel-surface/overlays.ts +108 -0
  69. package/src/components/chart/composite/panel-surface/pan-coast.ts +54 -0
  70. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +138 -0
  71. package/src/components/chart/composite/panel-surface/panel-levels.ts +47 -0
  72. package/src/components/chart/composite/panel-surface/plot-gestures.ts +403 -0
  73. package/src/components/chart/composite/panel-surface/plot-pointer.ts +65 -0
  74. package/src/components/chart/composite/panel-surface/plot-wheel.ts +102 -0
  75. package/src/components/chart/composite/panel-surface/pointer.ts +12 -0
  76. package/src/components/chart/composite/panel-surface/props.ts +79 -0
  77. package/src/components/chart/composite/panel-surface/tool-readout.ts +151 -0
  78. package/src/components/chart/composite/panel-surface/value-axis-gestures.ts +152 -0
  79. package/src/components/chart/composite/panel-surface.tsx +81 -1177
  80. package/src/components/command-bar/commands/collection-list.ts +1 -0
  81. package/src/components/command-bar/commands/direct/index.ts +31 -8
  82. package/src/components/command-bar/commands/registry.ts +7 -0
  83. package/src/components/command-bar/routes/root/command-items.ts +8 -0
  84. package/src/components/command-bar/routes/root/results.ts +19 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +3 -2
  86. package/src/components/command-bar/routes/root/selection.ts +3 -2
  87. package/src/components/command-bar/routes/root/shortcuts.ts +15 -0
  88. package/src/components/company-logo.tsx +10 -3
  89. package/src/components/data-table/sections.ts +6 -1
  90. package/src/components/layout/pane/title.ts +16 -6
  91. package/src/components/layout/shell/index.tsx +5 -1
  92. package/src/components/layout/shell/ticker-link-menu.ts +12 -9
  93. package/src/components/pane-settings-dialog/tui.tsx +6 -3
  94. package/src/components/pane-settings-dialog.tsx +2 -1
  95. package/src/components/pane-template-wizard.tsx +2 -0
  96. package/src/components/ticker/badge/format.ts +12 -3
  97. package/src/components/ticker/badge/index.tsx +9 -3
  98. package/src/components/ticker/list-table-view.tsx +119 -17
  99. package/src/components/ui/choice-dialog.tsx +1 -1
  100. package/src/components/ui/confirm-dialog.tsx +3 -2
  101. package/src/components/ui/data-table/display-columns.ts +16 -0
  102. package/src/components/ui/data-table/index.tsx +40 -9
  103. package/src/components/ui/data-table/types.ts +14 -0
  104. package/src/components/ui/frame.tsx +7 -3
  105. package/src/components/ui/icon.tsx +4 -2
  106. package/src/components/ui/list-view.tsx +8 -0
  107. package/src/components/ui/number-prompt-dialog.tsx +2 -1
  108. package/src/components/use-pane-notice-footer.tsx +3 -1
  109. package/src/core/state/app/layout-reducer.ts +3 -1
  110. package/src/core/state/app/layout.ts +2 -2
  111. package/src/data/config/layout.ts +14 -0
  112. package/src/data/config/store/normalize.ts +11 -1
  113. package/src/docs/snapshot.json +2 -2
  114. package/src/i18n/es.ts +39 -0
  115. package/src/i18n/ja.ts +39 -0
  116. package/src/i18n/ko.ts +39 -0
  117. package/src/i18n/zh-cn.ts +39 -0
  118. package/src/i18n/zh-tw.ts +39 -0
  119. package/src/layout/pane-follow.ts +141 -4
  120. package/src/layout/pane-layout-move.ts +10 -7
  121. package/src/layout/ticker-navigation.ts +13 -19
  122. package/src/layout/ticker-retarget.ts +3 -2
  123. package/src/market-data/market/format.ts +35 -1
  124. package/src/market-data/market/index-level.ts +19 -0
  125. package/src/market-data/quotes/contributions.ts +13 -0
  126. package/src/market-data/quotes/export-identity.ts +36 -1
  127. package/src/market-data/quotes/resolution.ts +16 -0
  128. package/src/plugins/builtin/account-management/keyboard.ts +14 -0
  129. package/src/plugins/builtin/account-management/model.ts +2 -0
  130. package/src/plugins/builtin/account-management/pane.tsx +79 -7
  131. package/src/plugins/builtin/account-management/password-dialog.tsx +2 -2
  132. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
  133. package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
  134. package/src/plugins/builtin/analytics/risk-client.ts +12 -2
  135. package/src/plugins/builtin/analytics/risk-headless.ts +66 -6
  136. package/src/plugins/builtin/analytics/risk-math.ts +23 -6
  137. package/src/plugins/builtin/analytics/risk-model.ts +20 -9
  138. package/src/plugins/builtin/analytics/risk-pane.tsx +2 -2
  139. package/src/plugins/builtin/awards/pane.tsx +6 -8
  140. package/src/plugins/builtin/changelog/index.tsx +6 -44
  141. package/src/plugins/builtin/changelog/versions.ts +17 -68
  142. package/src/plugins/builtin/chart-composer/catalog-inventory.ts +5 -2
  143. package/src/plugins/builtin/chart-composer/editor.tsx +1 -0
  144. package/src/plugins/builtin/chart-composer/pane.tsx +1 -1
  145. package/src/plugins/builtin/chart-composer/quick-add.tsx +4 -1
  146. package/src/plugins/builtin/chart-composer/series-catalog.ts +17 -1
  147. package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
  148. package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
  149. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  150. package/src/plugins/builtin/cloud/thesis/module.tsx +2 -0
  151. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +6 -2
  152. package/src/plugins/builtin/cpi/headless.ts +6 -1
  153. package/src/plugins/builtin/cpi/model.ts +17 -0
  154. package/src/plugins/builtin/cpi/pane.tsx +4 -2
  155. package/src/plugins/builtin/crypto-board/client.ts +6 -1
  156. package/src/plugins/builtin/crypto-board/headless.ts +10 -2
  157. package/src/plugins/builtin/crypto-board/model.ts +89 -11
  158. package/src/plugins/builtin/crypto-board/pane.tsx +20 -5
  159. package/src/plugins/builtin/debt-maturities/model.ts +1 -1
  160. package/src/plugins/builtin/dividend-yield/client.ts +24 -2
  161. package/src/plugins/builtin/dividend-yield/headless.ts +4 -2
  162. package/src/plugins/builtin/dividend-yield/ranking.ts +2 -1
  163. package/src/plugins/builtin/dividend-yield/view.ts +5 -1
  164. package/src/plugins/builtin/earnings/board-table.ts +1 -1
  165. package/src/plugins/builtin/earnings/board.tsx +36 -16
  166. package/src/plugins/builtin/earnings/highlight.ts +47 -0
  167. package/src/plugins/builtin/earnings/history-table.ts +9 -1
  168. package/src/plugins/builtin/earnings/index.tsx +1 -1
  169. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
  170. package/src/plugins/builtin/earnings-ripple/index.tsx +2 -0
  171. package/src/plugins/builtin/econ/calendar-model.ts +17 -1
  172. package/src/plugins/builtin/econ/fred-catalog.ts +33 -4
  173. package/src/plugins/builtin/econ-statistics/headless.ts +21 -0
  174. package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
  175. package/src/plugins/builtin/exposure/index.tsx +1 -1
  176. package/src/plugins/builtin/macro-day/headless.ts +21 -10
  177. package/src/plugins/builtin/macro-day/model.ts +42 -3
  178. package/src/plugins/builtin/macro-day/pane.tsx +26 -8
  179. package/src/plugins/builtin/macro-day/releases.ts +24 -1
  180. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  181. package/src/plugins/builtin/market-valuation/headless.ts +11 -4
  182. package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
  183. package/src/plugins/builtin/market-valuation/view.ts +14 -0
  184. package/src/plugins/builtin/money-markets/client.ts +4 -1
  185. package/src/plugins/builtin/money-markets/headless.ts +15 -4
  186. package/src/plugins/builtin/money-markets/index.tsx +1 -1
  187. package/src/plugins/builtin/money-markets/pane.tsx +7 -1
  188. package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
  189. package/src/plugins/builtin/pe-band/pane.tsx +1 -1
  190. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -2
  191. package/src/plugins/builtin/portfolio-list/cli/period-report.ts +61 -11
  192. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +11 -3
  193. package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
  194. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +178 -17
  195. package/src/plugins/builtin/portfolio-list/headless.ts +33 -6
  196. package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
  197. package/src/plugins/builtin/portfolio-list/pane/index.tsx +95 -18
  198. package/src/plugins/builtin/portfolio-list/pane/period-pnl.ts +24 -6
  199. package/src/plugins/builtin/portfolio-list/period-pnl.ts +16 -1
  200. package/src/plugins/builtin/portfolio-list/summary/index.tsx +4 -1
  201. package/src/plugins/builtin/portfolio-list/summary/totals.ts +6 -4
  202. package/src/plugins/builtin/portfolio-list/table.tsx +38 -16
  203. package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
  204. package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
  205. package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
  206. package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
  207. package/src/plugins/builtin/shared/cloud-upgrade.ts +4 -2
  208. package/src/plugins/builtin/shared/cpi-year-gap.ts +67 -0
  209. package/src/plugins/builtin/shared/headless-options.ts +1 -1
  210. package/src/plugins/builtin/social-mentions/model.ts +2 -2
  211. package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
  212. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +45 -2
  213. package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
  214. package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
  215. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
  216. package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
  217. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
  218. package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
  219. package/src/plugins/builtin/ticker-detail/headless.ts +280 -35
  220. package/src/plugins/builtin/ticker-detail/overview/components.tsx +4 -5
  221. package/src/plugins/builtin/ticker-detail/overview/model.ts +9 -2
  222. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +10 -2
  223. package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
  224. package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
  225. package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
  226. package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
  227. package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
  228. package/src/portfolio/collection-name.ts +2 -1
  229. package/src/portfolio/column-values.ts +34 -12
  230. package/src/portfolio/listed-symbol.ts +4 -2
  231. package/src/portfolio/period-pnl.ts +51 -1
  232. package/src/portfolio/suffixed-listings.ts +3 -1
  233. package/src/portfolio/watchlist-groups.ts +212 -0
  234. package/src/react/ticker-source.ts +3 -1
  235. package/src/renderers/dom/dialog-host.tsx +5 -5
  236. package/src/renderers/dom/styles.css +7 -0
  237. package/src/renderers/electrobun/view/remote/capability-invoker.ts +1 -1
  238. package/src/renderers/opentui/dialog-host.tsx +3 -4
  239. package/src/sources/gloomberb-cloud/normalizers.ts +5 -0
  240. package/src/sources/provider-router/history.ts +5 -2
  241. package/src/state/app/bootstrap.ts +11 -0
  242. package/src/state/app/context/index.tsx +6 -0
  243. package/src/sync/collections-contributor.ts +5 -2
  244. package/src/sync/config-merge.ts +10 -2
  245. package/src/sync/sanitize.ts +28 -0
  246. package/src/telemetry/usage-counts.ts +17 -0
  247. package/src/test-support/plugin-persistence.ts +12 -0
  248. package/src/tickers/company-name-listing.ts +4 -3
  249. package/src/tickers/company-name.ts +19 -1
  250. package/src/tickers/instrument-coverage.ts +27 -0
  251. package/src/tickers/search/home-listing.ts +38 -1
  252. package/src/tickers/search/index.ts +3 -2
  253. package/src/tickers/search/ranking.ts +21 -2
  254. package/src/time-series/base-series.ts +4 -0
  255. package/src/time-series/chart-seed.ts +1 -1
  256. package/src/time-series/financial-period-coverage.ts +4 -12
  257. package/src/time-series/parsed-history-cache.ts +1 -1
  258. package/src/time-series/resolve.ts +1 -1
  259. package/src/time-series/types.ts +5 -2
  260. package/src/time-series/use-chart-resolution.ts +6 -1
  261. package/src/types/config.ts +32 -0
  262. package/src/types/financials.ts +13 -0
  263. package/src/types/headless.ts +7 -0
  264. package/src/types/plugin-context.ts +5 -0
  265. package/src/types/ticker.ts +14 -0
  266. package/src/ui/ascii-font.ts +1 -4
  267. package/src/ui/dialog-stack.ts +17 -0
  268. package/src/ui/dialog.tsx +6 -2
  269. package/src/utils/async-deadline.ts +2 -2
  270. package/src/utils/crypto-pair.ts +9 -0
  271. package/src/utils/csv.ts +44 -5
  272. package/src/utils/exchanges.ts +13 -0
  273. package/src/utils/financial-statements.ts +60 -3
  274. package/src/utils/futures-generic.ts +17 -0
  275. package/src/utils/trailing-dividend.ts +13 -3
@@ -25,6 +25,7 @@ import type { TickerFinancials, PricePoint } from "../../types/financials";
25
25
  import type { TickerRecord } from "../../types/ticker";
26
26
  import { PRICE_SPARKLINE_COLUMN_ID, PriceSparkline } from "../price-sparkline/view";
27
27
  import { DataTableView, type DataTableKeyEvent, type DataTableSelection } from "../data-table/view";
28
+ import { sectionHeaderText } from "../data-table/sections";
28
29
  import type { QuoteFlashDirection } from "../quote-flash";
29
30
  import type { DataTableColumnReorder } from "../ui";
30
31
  import { objectVersion } from "../../utils/object-version";
@@ -90,7 +91,41 @@ function summaryRecord(row: TickerTableSummaryRow): TickerRecord {
90
91
  return record;
91
92
  }
92
93
 
93
- const isTickerRow = (item: TickerRecord) => !summaryRowOf.has(item);
94
+ /**
95
+ * A section of a ticker table: a header that Enter or a click collapses and
96
+ * expands, and the rows under it.
97
+ */
98
+ export interface TickerTableGroup {
99
+ /** The same while the group is: its header's row key (`groupRowKey`) and what its collapsed state is kept under. */
100
+ id: string;
101
+ label: string;
102
+ /** Its rows in order, shown or collapsed: the header counts them and an export writes them all. */
103
+ tickers: readonly TickerRecord[];
104
+ collapsed: boolean;
105
+ }
106
+
107
+ const GROUP_ROW_PREFIX = "\u0000group:";
108
+
109
+ /** What the cursor reads on a group's header: no ticker has this key. */
110
+ export function groupRowKey(id: string): string {
111
+ return `${GROUP_ROW_PREFIX}${id}`;
112
+ }
113
+
114
+ /** The group whose header a cursor key is, or null for any other row. */
115
+ export function groupIdOfRowKey(key: string | null): string | null {
116
+ return key?.startsWith(GROUP_ROW_PREFIX) ? key.slice(GROUP_ROW_PREFIX.length) : null;
117
+ }
118
+
119
+ /** The record a group's header stands in the table's items as, and the group it heads. */
120
+ const groupHeaderOf = new WeakMap<TickerRecord, TickerTableGroup>();
121
+
122
+ function groupHeaderRecord(group: TickerTableGroup): TickerRecord {
123
+ const record = { metadata: { ticker: groupRowKey(group.id), exchange: "", currency: "", name: "", portfolios: [], watchlists: [], positions: [] } } as unknown as TickerRecord;
124
+ groupHeaderOf.set(record, group);
125
+ return record;
126
+ }
127
+
128
+ const isTickerRow = (item: TickerRecord) => !summaryRowOf.has(item) && !groupHeaderOf.has(item);
94
129
  /** Tickers, and the summary rows that take the cursor (CASH); never the others (TOTAL, a period's FX line). */
95
130
  const isNavigableRow = (item: TickerRecord) => {
96
131
  const summary = summaryRowOf.get(item);
@@ -145,6 +180,15 @@ export interface TickerListTableViewProps {
145
180
  emptyHint?: string;
146
181
  /** Rows after the tickers that add them up; shown only beside at least one ticker. */
147
182
  summaryRows?: readonly TickerTableSummaryRow[];
183
+ /**
184
+ * Sections the rows show under, in this order, each under a header the
185
+ * cursor lands on. `tickers` still holds every row.
186
+ */
187
+ groups?: readonly TickerTableGroup[];
188
+ /** Collapses or expands a group: Enter on its header, or a click. */
189
+ onToggleGroup?: (id: string) => void;
190
+ /** The pane's own items in a row's menu (right-click, and the pane menu for the cursor row), after the list items. */
191
+ rowMenuItems?: (ticker: TickerRecord) => ContextMenuItem[];
148
192
  /**
149
193
  * The pane's own key for adding a ticker, which the empty table names. The
150
194
  * command bar's key when absent. The pane shows its add control once, in its
@@ -206,16 +250,24 @@ function getTickerKey(ticker: TickerRecord): string {
206
250
  return ticker.metadata.ticker;
207
251
  }
208
252
 
253
+ /** The pane's own row items, after the list items and before the actions plugins and the app add. */
254
+ function withPaneRowItems(items: ContextMenuItem[], paneItems: readonly ContextMenuItem[] | undefined): ContextMenuItem[] {
255
+ if (!paneItems?.length) return items;
256
+ const at = items.findIndex((item) => item.id === "ticker:actions-divider");
257
+ return at < 0 ? [...items, ...paneItems] : [...items.slice(0, at), ...paneItems, ...items.slice(at)];
258
+ }
259
+
209
260
  /** What right-clicking the row offers, plugin additions included. */
210
261
  function tickerRowMenuItems(
211
262
  ticker: TickerRecord,
212
263
  financials: TickerFinancials | null,
213
264
  copyText: (text: string) => Promise<void>,
265
+ paneItems?: readonly ContextMenuItem[],
214
266
  ): ContextMenuItem[] {
215
267
  const registry = getSharedRegistry() ?? null;
216
268
  return withPluginContextMenuItems(
217
269
  { kind: "ticker", symbol: ticker.metadata.ticker, ticker, financials },
218
- tickerContextMenuItems({ ticker, financials, registry, copyText }),
270
+ withPaneRowItems(tickerContextMenuItems({ ticker, financials, registry, copyText }), paneItems),
219
271
  registry,
220
272
  );
221
273
  }
@@ -230,18 +282,21 @@ export function useTickerRowPaneMenu({
230
282
  financials,
231
283
  enabled,
232
284
  accelerators,
285
+ paneItems,
233
286
  }: {
234
287
  ticker: TickerRecord | null;
235
288
  financials: TickerFinancials | null;
236
289
  enabled: boolean;
237
290
  /** The pane's own keys for these actions, by item id, shown beside them. */
238
291
  accelerators?: Readonly<Record<string, string>>;
292
+ /** The pane's own items for this row (`TickerListTableViewProps.rowMenuItems`). */
293
+ paneItems?: readonly ContextMenuItem[];
239
294
  }): void {
240
295
  const renderer = useRendererHost();
241
296
  const registrationId = `ticker-row-menu:${useId()}`;
242
297
  usePaneFooter(registrationId, () => {
243
298
  if (!enabled || !ticker) return null;
244
- const items = tickerRowMenuItems(ticker, financials, renderer.copyText.bind(renderer));
299
+ const items = tickerRowMenuItems(ticker, financials, renderer.copyText.bind(renderer), paneItems);
245
300
  return {
246
301
  order: -1,
247
302
  menu: accelerators
@@ -250,7 +305,7 @@ export function useTickerRowPaneMenu({
250
305
  : { ...item, accelerator: accelerators[item.id] }))
251
306
  : items,
252
307
  };
253
- }, [accelerators, enabled, financials, renderer, ticker]);
308
+ }, [accelerators, enabled, financials, paneItems, renderer, ticker]);
254
309
  }
255
310
 
256
311
  export function TickerListTableView({
@@ -287,6 +342,9 @@ export function TickerListTableView({
287
342
  emptyHint,
288
343
  addTickerShortcut,
289
344
  summaryRows,
345
+ groups,
346
+ onToggleGroup,
347
+ rowMenuItems,
290
348
  virtualize = true,
291
349
  overscan = 4,
292
350
  exportName,
@@ -326,6 +384,8 @@ export function TickerListTableView({
326
384
  _index: number,
327
385
  rowState: { selected: boolean },
328
386
  ) => {
387
+ // A group's header draws as a header, never as cells.
388
+ if (groupHeaderOf.has(ticker)) return { text: "" };
329
389
  const summary = summaryRowOf.get(ticker);
330
390
  if (summary) {
331
391
  const cell = summary.cells[column.id];
@@ -364,22 +424,33 @@ export function TickerListTableView({
364
424
  }, []);
365
425
 
366
426
  const getRowVersion = useCallback((ticker: TickerRecord) => {
367
- const summary = summaryRowOf.get(ticker);
427
+ const summary = summaryRowOf.get(ticker) ?? groupHeaderOf.get(ticker);
368
428
  if (summary) return summary;
369
429
  const symbol = ticker.metadata.ticker;
370
430
  return `${resolveEpoch}|${objectVersion(financialsMap.get(symbol))}|${safeFlashSymbols.get(symbol) ?? ""}`;
371
431
  }, [financialsMap, resolveEpoch, safeFlashSymbols]);
372
432
 
433
+ // A grouped list's rows name their group in the export, collapsed or not.
434
+ const groupLabels = useMemo(() => groups?.length
435
+ ? new Map(groups.flatMap((group) => group.tickers.map((ticker) => [ticker.metadata.ticker, group.label] as const)))
436
+ : null, [groups]);
373
437
  // An export ends each row as `quote --csv` does: its session and feed, its listing with the venue, its unit,
374
438
  // its source and the ISO time its price was observed. A summary line is no listing.
375
- const exportIdentity = useMemo(() => ({
376
- headers: QUOTE_EXPORT_IDENTITY_HEADERS,
377
- cells: (ticker: TickerRecord) => isTickerRow(ticker)
378
- ? quoteExportIdentityCells(exportedListingKey(ticker), financialsRef.current.get(ticker.metadata.ticker)?.quote, Date.now(),
379
- // A broker's quote names the broker as its source.
380
- (providerId) => getSharedRegistry()?.getBrokerAdapter(providerId)?.name)
381
- : null,
382
- }), []);
439
+ const exportIdentity = useMemo(() => {
440
+ const identity = (ticker: TickerRecord) => quoteExportIdentityCells(exportedListingKey(ticker), financialsRef.current.get(ticker.metadata.ticker)?.quote,
441
+ Date.now(),
442
+ // A broker's quote names the broker as its source.
443
+ (providerId) => getSharedRegistry()?.getBrokerAdapter(providerId)?.name);
444
+ return groupLabels
445
+ ? {
446
+ headers: ["Group", ...QUOTE_EXPORT_IDENTITY_HEADERS],
447
+ cells: (ticker: TickerRecord) => isTickerRow(ticker) ? [groupLabels.get(ticker.metadata.ticker) ?? "", ...identity(ticker)] : null,
448
+ }
449
+ : {
450
+ headers: QUOTE_EXPORT_IDENTITY_HEADERS,
451
+ cells: (ticker: TickerRecord) => isTickerRow(ticker) ? identity(ticker) : null,
452
+ };
453
+ }, [groupLabels]);
383
454
 
384
455
  const selection = useMemo<DataTableSelection<TickerRecord>>(() => ({
385
456
  kind: "id",
@@ -394,6 +465,8 @@ export function TickerListTableView({
394
465
  if (isTickerRow(ticker)) onRowActivate?.(ticker);
395
466
  }, [onRowActivate]);
396
467
 
468
+ const rowMenuItemsRef = useRef(rowMenuItems);
469
+ rowMenuItemsRef.current = rowMenuItems;
397
470
  const showTickerContextMenu = useCallback((
398
471
  ticker: TickerRecord,
399
472
  event: TableMouseEvent,
@@ -407,12 +480,12 @@ export function TickerListTableView({
407
480
  ticker,
408
481
  financials: financials ?? null,
409
482
  },
410
- tickerContextMenuItems({
483
+ withPaneRowItems(tickerContextMenuItems({
411
484
  ticker,
412
485
  financials: financials ?? null,
413
486
  registry,
414
487
  copyText: renderer.copyText.bind(renderer),
415
- }),
488
+ }), rowMenuItemsRef.current?.(ticker)),
416
489
  event,
417
490
  );
418
491
  }, [renderer, showContextMenu]);
@@ -433,16 +506,43 @@ export function TickerListTableView({
433
506
 
434
507
  // Summary rows follow the tickers, as records of their own the table never selects.
435
508
  const summaries = useMemo(() => tickers.length && summaryRows?.length ? summaryRows.map(summaryRecord) : [], [summaryRows, tickers.length]);
436
- const items = useMemo(() => summaries.length ? [...tickers, ...summaries] : tickers, [summaries, tickers]);
509
+ // A grouped list shows each group's header and, unless it is collapsed, its rows.
510
+ const grouped = useMemo(() => groups?.length
511
+ ? groups.flatMap((group) => [groupHeaderRecord(group), ...group.collapsed ? [] : group.tickers])
512
+ : null, [groups]);
513
+ const rows = grouped ?? tickers;
514
+ const items = useMemo(() => summaries.length ? [...rows, ...summaries] : rows, [rows, summaries]);
515
+ // An export writes every row, a collapsed group's too, in the groups' order.
516
+ const exportItems = useMemo(() => groups?.length
517
+ ? [...groups.flatMap((group) => group.tickers), ...summaries]
518
+ : undefined, [groups, summaries]);
519
+ const toggleGroupRef = useRef(onToggleGroup);
520
+ toggleGroupRef.current = onToggleGroup;
521
+ const renderGroupHeader = useCallback((item: TickerRecord) => {
522
+ const group = groupHeaderOf.get(item);
523
+ return group
524
+ ? { text: sectionHeaderText(group.label, group.tickers.length), expanded: !group.collapsed, onMouseDown: () => toggleGroupRef.current?.(group.id) }
525
+ : null;
526
+ }, []);
527
+ // The pane counts the rows in view among its tickers: a header between them is not one.
528
+ const handleVisibleRangeChange = useMemo(() => {
529
+ if (!grouped || !onVisibleRangeChange) return onVisibleRangeChange;
530
+ const tickersBefore = [0];
531
+ for (const item of grouped) tickersBefore.push(tickersBefore.at(-1)! + (groupHeaderOf.has(item) ? 0 : 1));
532
+ const at = (index: number) => tickersBefore[Math.max(0, Math.min(index, grouped.length))]!;
533
+ return ({ start, end }: TickerListVisibleRange) => onVisibleRangeChange({ start: at(start), end: at(end) });
534
+ }, [grouped, onVisibleRangeChange]);
437
535
 
438
536
  // The cursor row's right-click menu, for the keyboard, while the table is focused.
439
537
  const cursorTicker = selectedIndex >= 0 ? tickers[selectedIndex] ?? null : null;
440
538
  const cursorFinancials = cursorTicker ? financialsMap.get(cursorTicker.metadata.ticker) ?? null : null;
539
+ const cursorPaneItems = useMemo(() => cursorTicker ? rowMenuItems?.(cursorTicker) : undefined, [cursorTicker, rowMenuItems]);
441
540
  useTickerRowPaneMenu({
442
541
  ticker: cursorTicker,
443
542
  financials: cursorFinancials,
444
543
  enabled: focused && keyboardNavigation,
445
544
  accelerators: rowMenuAccelerators,
545
+ paneItems: cursorPaneItems,
446
546
  });
447
547
 
448
548
  return (
@@ -463,7 +563,9 @@ export function TickerListTableView({
463
563
  onRowContextMenu={handleRowContextMenu}
464
564
  rowContextMenuSurface
465
565
  renderCell={renderCell}
566
+ renderSectionHeader={grouped ? renderGroupHeader : undefined}
466
567
  exportIdentity={exportIdentity}
568
+ exportItems={exportItems}
467
569
  exportName={exportName}
468
570
  getRowVersion={getRowVersion}
469
571
  emptyStateTitle={emptyTitle}
@@ -479,7 +581,7 @@ export function TickerListTableView({
479
581
  scrollRef={scrollRef}
480
582
  syncHeaderScroll={syncHeaderScroll}
481
583
  onBodyScrollActivity={onBodyScrollActivity}
482
- onVisibleRangeChange={onVisibleRangeChange}
584
+ onVisibleRangeChange={handleVisibleRangeChange}
483
585
  visibleRangeBuffer={visibleRangeBuffer}
484
586
  keyboardNavigation={keyboardNavigation}
485
587
  onRootKeyDown={onRootKeyDown}
@@ -172,7 +172,7 @@ export function ChoiceDialog({
172
172
  }, searchable ? { allowEditable: true } : undefined);
173
173
 
174
174
  return (
175
- <DialogFrame title={title} footer={footer} showTitleDivider={false}>
175
+ <DialogFrame title={title} footer={footer} showTitleDivider={false} onClose={() => resolve("")}>
176
176
  {/* Never wider than the dialog: a phone is narrower than the cells asked for. The terminal's list spans its box,
177
177
  60 columns, so its scrollbar runs down the box's edge rather than through the middle of it. */}
178
178
  <Box flexDirection="column" {...(desktop ? { style: { width: fitDialogWidth(width) } } : { width: "100%" })}>
@@ -51,7 +51,7 @@ export interface ConfirmDialogProps extends PromptContext<boolean> {
51
51
  status?: ReactNode;
52
52
  /** While the confirmed work runs: the buttons are off and only Esc answers. */
53
53
  busy?: boolean;
54
- /** Adds the desktop close button beside the title. */
54
+ /** Adds the desktop close button beside the title; the terminal has its Cancel button. */
55
55
  onClose?: () => void;
56
56
  /**
57
57
  * Lays the buttons out as a form's Cancel and Submit: Cancel, then the
@@ -174,7 +174,8 @@ export function ConfirmDialog({
174
174
  title={title}
175
175
  footer={footer ?? keyLine}
176
176
  desktopFooter={null}
177
- onClose={onClose}
177
+ // The terminal's Cancel is its mouse close already: a second close in the title would only repeat it.
178
+ onClose={desktop ? onClose : undefined}
178
179
  >
179
180
  <Box flexDirection="column" {...(desktop ? { style: { width: fitDialogWidth(width) } } : { width })}>
180
181
  {renderBody(body)}
@@ -0,0 +1,16 @@
1
+ import { MISSING_VALUE } from "../../../utils/format";
2
+ import type { DataTableColumn, DataTableProps, DataTableVisibleRange } from "./types";
3
+
4
+ export function dataTableDisplayColumns<T, C extends DataTableColumn>(
5
+ props: Pick<DataTableProps<T, C>, "columns" | "items" | "renderCell" | "renderSectionHeader" | "isSelected">,
6
+ visibleRange?: DataTableVisibleRange | null,
7
+ ): C[] {
8
+ if (!props.columns.some((column) => column.omitWhenEmpty)) return props.columns;
9
+ return props.columns.filter((column) => !column.omitWhenEmpty || props.items.some((item, index) => {
10
+ if (column.omitWhenEmpty === "visible" && visibleRange && (index < visibleRange.start || index >= visibleRange.end)) return false;
11
+ if (props.renderSectionHeader?.(item, index)) return false;
12
+ const cell = props.renderCell(item, column, index, { selected: props.isSelected(item, index) });
13
+ const text = cell.text.trim();
14
+ return text !== "" && text !== MISSING_VALUE;
15
+ }));
16
+ }
@@ -1,9 +1,10 @@
1
- import { type ComponentType, useEffect, useMemo, useRef } from "react";
1
+ import { type ComponentType, useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  import { useRendererHost, useUiHost } from "../../../ui";
3
3
  import { OpenTuiDataTable } from "./opentui";
4
4
  import type {
5
5
  DataTableColumn,
6
6
  DataTableProps,
7
+ DataTableVisibleRange,
7
8
  } from "./types";
8
9
  import { useRemoteUiNode } from "../../../remote/semantic-tree";
9
10
  import { remoteNumberValue, resolveRemoteRowIndex } from "../../../remote/semantic-helpers";
@@ -13,6 +14,7 @@ import { createDataTableCsv } from "../../data-table/export";
13
14
  import { headerCase } from "../header-case";
14
15
  import { figureColumnCells } from "./render-cell";
15
16
  import { useDataTableColumnOrder } from "./use-column-order";
17
+ import { dataTableDisplayColumns } from "./display-columns";
16
18
 
17
19
  export type {
18
20
  DataTableCell,
@@ -38,6 +40,21 @@ export function DataTable<T, C extends DataTableColumn = DataTableColumn>(
38
40
  onColumnMove: ownProps.onColumnMove ?? order.onColumnMove,
39
41
  anchoredColumns: ownProps.onColumnMove ? ownProps.anchoredColumns : order.anchoredColumns,
40
42
  };
43
+ const [visibleRange, setVisibleRange] = useState<DataTableVisibleRange | null>(null);
44
+ const onVisibleRangeChange = useCallback((range: DataTableVisibleRange) => {
45
+ setVisibleRange((previous) => previous?.start === range.start && previous.end === range.end ? previous : range);
46
+ ownProps.onVisibleRangeChange?.(range);
47
+ }, [ownProps.onVisibleRangeChange]);
48
+ const displayColumns = useMemo(() => dataTableDisplayColumns(props, visibleRange),
49
+ [props.columns, props.items, props.renderCell, props.renderSectionHeader, props.isSelected, visibleRange]);
50
+ const reportProps = {
51
+ ...props,
52
+ columns: displayColumns,
53
+ reportColumns: useMemo(() => [
54
+ ...props.columns.filter((column) => !displayColumns.includes(column)),
55
+ ...props.reportColumns ?? [],
56
+ ], [props.columns, displayColumns, props.reportColumns]),
57
+ };
41
58
  const paneId = useOptionalPaneInstanceId();
42
59
  const renderer = useRendererHost();
43
60
  const propsRef = useRef(props);
@@ -49,7 +66,9 @@ export function DataTable<T, C extends DataTableColumn = DataTableColumn>(
49
66
  if (!paneId || !renderer.saveTextFile) return;
50
67
  return registerPaneTableExporter(paneId, (filename) => renderer.saveTextFile!({
51
68
  name: filename,
52
- text: propsRef.current.exportCsv?.() ?? createDataTableCsv(propsRef.current),
69
+ text: propsRef.current.exportCsv?.() ?? createDataTableCsv(propsRef.current.exportItems
70
+ ? { ...propsRef.current, items: propsRef.current.exportItems }
71
+ : propsRef.current),
53
72
  mimeType: "text/csv;charset=utf-8",
54
73
  }), () => propsRef.current.exportName);
55
74
  }, [paneId, renderer]);
@@ -104,30 +123,42 @@ export function DataTable<T, C extends DataTableColumn = DataTableColumn>(
104
123
  paneInstanceId: paneId,
105
124
  sortColumnId: props.sortColumnId,
106
125
  sortDirection: props.sortDirection,
107
- columns: props.columns.map((column) => ({ id: column.id, label: column.label, ...(column.mayBeBlank ? { mayBeBlank: true } : {}) })),
126
+ columns: displayColumns.map((column) => ({ id: column.id, label: column.label, ...(column.mayBeBlank ? { mayBeBlank: true } : {}) })),
108
127
  rowCount: props.items.length,
109
128
  selectedId: firstSelectedId(props),
110
- ...(props.reportEveryRow ? { rows: cachedReportedRows(props, reportedRowsRef) } : {}),
129
+ ...(props.reportEveryRow ? { rows: cachedReportedRows(reportProps, reportedRowsRef) } : {}),
111
130
  }),
112
131
  // Read for this table alone: a confirmation names the row a call would open.
113
- getDetail: () => ({ rows: cachedReportedRows(props, reportedRowsRef) }),
132
+ getDetail: () => ({ rows: cachedReportedRows(reportProps, reportedRowsRef) }),
114
133
  });
115
134
  // Header labels read the same in every table whatever case a pane wrote
116
135
  // them in. Exports and automation keep the pane's own labels.
117
136
  const columns = useMemo(
118
- () => props.columns.map((column) => {
137
+ () => displayColumns.map((column) => {
119
138
  const label = headerCase(column.label);
120
139
  return label === column.label ? column : { ...column, label };
121
140
  }),
122
- [props.columns],
141
+ [displayColumns],
123
142
  );
124
143
  const HostDataTable = useUiHost().DataTable as
125
144
  | ComponentType<DataTableProps<T, C>>
126
145
  | undefined;
146
+ const displayProps = {
147
+ ...props,
148
+ columns,
149
+ anchoredColumns: props.anchoredColumns == null ? undefined
150
+ : props.columns.slice(0, props.anchoredColumns).filter((column) => displayColumns.includes(column)).length,
151
+ onColumnMove: props.onColumnMove ? (columnId: string, toIndex: number) => {
152
+ const target = displayColumns[toIndex];
153
+ if (target) props.onColumnMove?.(columnId, props.columns.indexOf(target));
154
+ } : undefined,
155
+ onVisibleRangeChange: props.columns.some((column) => column.omitWhenEmpty === "visible")
156
+ ? onVisibleRangeChange : props.onVisibleRangeChange,
157
+ };
127
158
  if (HostDataTable) {
128
- return <HostDataTable {...props} columns={columns} />;
159
+ return <HostDataTable {...displayProps} />;
129
160
  }
130
- return <OpenTuiDataTable {...props} columns={columns} />;
161
+ return <OpenTuiDataTable {...displayProps} />;
131
162
  }
132
163
 
133
164
  function resolveTableIndex<T, C extends DataTableColumn>(
@@ -27,6 +27,15 @@ export type DataTableColumn = Pick<
27
27
  * column blank in every row as data the pane lost, except this one.
28
28
  */
29
29
  mayBeBlank?: boolean;
30
+ /**
31
+ * Leave this column out of the pane while every data row renders an empty
32
+ * cell or MISSING_VALUE. Use for unavailable coverage, not a pending event
33
+ * (mayBeBlank). "visible" checks just the viewport, for a chronological
34
+ * history whose older rows have coverage its recent rows lack. Scrolling
35
+ * restores the column when a row has a value. Reports and CSV exports keep
36
+ * the column and its raw cells.
37
+ */
38
+ omitWhenEmpty?: boolean | "visible";
30
39
  };
31
40
 
32
41
  export interface DataTableCell {
@@ -276,6 +285,11 @@ export interface DataTableProps<
276
285
  * writes its daily curve, as `fn BT --csv --equity` prints it.
277
286
  */
278
287
  exportCsv?: () => string;
288
+ /**
289
+ * The rows Export CSV writes in place of `items`, for a table that draws
290
+ * fewer rows than it holds: a watchlist writes the rows of a collapsed group too.
291
+ */
292
+ exportItems?: T[];
279
293
  /**
280
294
  * A rendered-view report (`gloom fn`) reads every row, not only those
281
295
  * the viewport shows. For a bounded table a reader needs whole, such as an
@@ -5,6 +5,7 @@ import { t } from "../../i18n";
5
5
  import type { ThemeColors } from "../../theme/colors";
6
6
  import { RADIUS, SPACE, controlBorderColour, surfaceRaisedColour } from "../../theme/ui-tokens";
7
7
  import { useThemeColors } from "../../theme/theme-context";
8
+ import { IconButton } from "./icon";
8
9
 
9
10
  export interface ModalSurfaceOptions {
10
11
  width?: string;
@@ -106,7 +107,7 @@ export interface DialogFrameProps {
106
107
  */
107
108
  desktopFooter?: DialogDesktopFooter | null;
108
109
  showTitleDivider?: boolean;
109
- /** Adds a close button at the right of the title (desktop). Esc still closes every dialog. */
110
+ /** Adds a close button at the right of the title, so the mouse can close it. Esc still closes every dialog. */
110
111
  onClose?: () => void;
111
112
  /**
112
113
  * Desktop: lets the frame shrink inside a dialog that caps its height, so a
@@ -130,8 +131,11 @@ export function DialogFrame({ title: rawTitle, subtitle, children, footer: rawFo
130
131
 
131
132
  return (
132
133
  <Box flexDirection="column">
133
- <Box height={1}>
134
- <Text fg={colors.text} attributes={TextAttributes.BOLD}>{title}</Text>
134
+ <Box height={1} flexDirection="row">
135
+ <Box flexGrow={1} flexShrink={1} overflow="hidden">
136
+ <Text fg={colors.text} attributes={TextAttributes.BOLD}>{title}</Text>
137
+ </Box>
138
+ {onClose && <IconButton icon="close" label="Close" onPress={() => onClose()} />}
135
139
  </Box>
136
140
  {subtitle && <Text fg={colors.textMuted} wrapText>{subtitle}</Text>}
137
141
  <Box height={1} />
@@ -1,7 +1,7 @@
1
1
  import { type ComponentType } from "react";
2
2
  import { Box, Text, useUiHost } from "../../ui";
3
3
  import { useThemeColors } from "../../theme/theme-context";
4
- import { useRemoteUiNode } from "../../remote/semantic-tree";
4
+ import { useRemoteUiNode, useRemoteUiScope } from "../../remote/semantic-tree";
5
5
  import { t } from "../../i18n";
6
6
 
7
7
  export type IconName =
@@ -160,12 +160,14 @@ export function IconButton({
160
160
  }: IconButtonProps) {
161
161
  const colors = useThemeColors();
162
162
  const label = t(rawLabel);
163
+ // Of the surface it is drawn in, as a kit Button is: a prompt's dialog's close is that prompt's.
164
+ const remoteScope = useRemoteUiScope();
163
165
  useRemoteUiNode({
164
166
  role: "button",
165
167
  label,
166
168
  disabled,
167
169
  actions: { press: () => { if (!disabled) onPress?.(); } },
168
- metadata: { icon, pressed },
170
+ metadata: { icon, pressed, ...(remoteScope ? { scope: remoteScope } : {}) },
169
171
  });
170
172
  const HostIconButton = useUiHost().IconButton as ComponentType<IconButtonProps> | undefined;
171
173
  if (HostIconButton) {
@@ -69,6 +69,12 @@ export interface ListViewProps {
69
69
  height?: number;
70
70
  flexGrow?: number;
71
71
  scrollable?: boolean;
72
+ /**
73
+ * Terminal: false scrolls without a scrollbar, so each row runs to the
74
+ * list's edge and a press on its last column picks it, as in a short
75
+ * suggestion drawer. The wheel and the keys still scroll it.
76
+ */
77
+ scrollbar?: boolean;
72
78
  selectOnHover?: boolean;
73
79
  autoScrollToIndex?: boolean;
74
80
  /**
@@ -205,6 +211,7 @@ export function ListView({
205
211
  height,
206
212
  flexGrow,
207
213
  scrollable = false,
214
+ scrollbar = true,
208
215
  selectOnHover = false,
209
216
  autoScrollToIndex = true,
210
217
  checkboxRows,
@@ -386,6 +393,7 @@ export function ListView({
386
393
  flexGrow={flexGrow}
387
394
  scrollY
388
395
  focusable={false}
396
+ {...(scrollbar ? {} : { verticalScrollbarOptions: { visible: false } })}
389
397
  {...(onMouseScroll ? { onMouseScroll } : {})}
390
398
  >
391
399
  <Box flexDirection="column" gap={terminalRowGap}>{rows}</Box>
@@ -28,6 +28,7 @@ export interface NumberPromptDialogProps extends PromptContext<number> {
28
28
  */
29
29
  export function NumberPromptDialog({
30
30
  resolve,
31
+ dismiss,
31
32
  title,
32
33
  initialValue,
33
34
  min,
@@ -44,7 +45,7 @@ export function NumberPromptDialog({
44
45
  }, []);
45
46
 
46
47
  return (
47
- <DialogFrame title={title}>
48
+ <DialogFrame title={title} onClose={dismiss}>
48
49
  <Box flexDirection="column" width={32}>
49
50
  <TextField
50
51
  inputRef={inputRef}
@@ -11,6 +11,7 @@ import { DialogFrame } from "./ui/frame";
11
11
  import { Prose } from "./ui/prose";
12
12
  import { logFailure } from "../utils/log-failure";
13
13
  import { markPaneNoticesSeen, usePaneNoticesSeen } from "./pane-notice-seen";
14
+ import { withoutCryptoVenueCode } from "../utils/crypto-pair";
14
15
 
15
16
  export interface UsePaneNoticeFooterOptions {
16
17
  registrationId: string;
@@ -82,7 +83,8 @@ export function usePaneNoticeFooter({
82
83
  const dialogOpen = useDialogState((state) => state.isOpen);
83
84
  const scopeActive = usePaneFooterScopeActive();
84
85
  const title = t(rawTitle);
85
- const noticeKey = JSON.stringify([...new Set(notices.map((notice) => notice.trim()).filter(Boolean))]);
86
+ // Said as a reader takes it: a coin's pair without the internal code of the venue it is charted on.
87
+ const noticeKey = JSON.stringify([...new Set(notices.map((notice) => withoutCryptoVenueCode(notice.trim())).filter(Boolean))]);
86
88
  const currentNotices = useMemo<readonly string[]>(() => JSON.parse(noticeKey), [noticeKey]);
87
89
  const active = enabled && scopeActive && currentNotices.length > 0;
88
90
  const seen = usePaneNoticesSeen(currentNotices);
@@ -1,5 +1,6 @@
1
1
  import { cloneLayout, createBlankLayout, getPlacedPaneInstanceIds, type SavedLayout } from "../../../types/config";
2
2
  import { movePaneBack, movePaneToOwnLayout, paneMoveBackTarget } from "../../../layout/pane-layout-move";
3
+ import { relinkPinnedResearchPanes } from "../../../layout/pane-follow";
3
4
  import {
4
5
  clonePaneStateMap,
5
6
  cloneSavedLayout,
@@ -85,7 +86,8 @@ export function reduceLayoutAction(state: AppState, action: AppAction): AppState
85
86
  case "UPDATE_LAYOUT":
86
87
  return withFocusedPane(
87
88
  state,
88
- { ...state.config, layout: action.layout },
89
+ // A research pane the app unlinked follows again when the change gives it a source back.
90
+ { ...state.config, layout: relinkPinnedResearchPanes(action.layout, state.config.layout) },
89
91
  Object.prototype.hasOwnProperty.call(action, "focusedPaneId")
90
92
  ? { focusedPaneId: action.focusedPaneId ?? null }
91
93
  : {},
@@ -1,5 +1,5 @@
1
1
  import { compactFloatingZ, getDockLeafLayouts, getDockedPaneIds, removePane, showDockTab, withoutTransientPanes } from "../../../layout/pane-manager";
2
- import { pinFollowingPane } from "../../../layout/pane-follow";
2
+ import { pinOrphanedFollower } from "../../../layout/pane-follow";
3
3
  import {
4
4
  cloneLayout,
5
5
  findPaneInstance,
@@ -627,7 +627,7 @@ export function withFocusedPane(
627
627
  const normalizedLayout = normalizePaneLayout(config.layout, {
628
628
  // Keep a follower alive on its last symbol when its source pane is gone.
629
629
  resolveOrphanSymbol: (instanceId) => resolveTickerForPane(state, instanceId),
630
- pinOrphan: pinFollowingPane,
630
+ pinOrphan: pinOrphanedFollower(state.config.layout),
631
631
  externalSourceIds: options.externalSourceIds ?? linkedSourceIds(state),
632
632
  });
633
633
  const nextConfig = normalizedLayout === config.layout
@@ -8,6 +8,7 @@ import type {
8
8
  PaneMovedFrom,
9
9
  PaneMovedLink,
10
10
  PanePlacementMemory,
11
+ PaneUnlinkedFrom,
11
12
  } from "../../types/config";
12
13
  import type { BrokerContractRef, TickerListingRef } from "../../types/instrument";
13
14
  import {
@@ -148,6 +149,17 @@ function sanitizePaneMovedFrom(value: unknown): PaneMovedFrom | undefined {
148
149
  };
149
150
  }
150
151
 
152
+ function sanitizePaneUnlinkedFrom(value: unknown): PaneUnlinkedFrom | undefined {
153
+ if (!value || typeof value !== "object" || Array.isArray(value)) return undefined;
154
+ const raw = value as Record<string, unknown>;
155
+ if (typeof raw.instanceId !== "string" || !raw.instanceId) return undefined;
156
+ return {
157
+ instanceId: raw.instanceId,
158
+ ...(typeof raw.paneId === "string" && raw.paneId ? { paneId: raw.paneId } : {}),
159
+ ...(raw.auto === true ? { auto: true as const } : {}),
160
+ };
161
+ }
162
+
151
163
  function sanitizePlacementMemory(value: unknown): PanePlacementMemory | undefined {
152
164
  if (!value || typeof value !== "object") return undefined;
153
165
 
@@ -212,6 +224,7 @@ function sanitizePaneInstances(
212
224
  const binding = sanitizePaneBinding(entry.binding);
213
225
  const settings = sanitizePaneSettings(entry.settings);
214
226
  const movedFrom = sanitizePaneMovedFrom(entry.movedFrom);
227
+ const unlinkedFrom = sanitizePaneUnlinkedFrom(entry.unlinkedFrom);
215
228
  return {
216
229
  instanceId,
217
230
  paneId,
@@ -226,6 +239,7 @@ function sanitizePaneInstances(
226
239
  placementMemory: sanitizePlacementMemory(entry.placementMemory),
227
240
  locked: entry.locked === true ? true : undefined,
228
241
  ...(movedFrom ? { movedFrom } : {}),
242
+ ...(unlinkedFrom ? { unlinkedFrom } : {}),
229
243
  };
230
244
  });
231
245
  return instances;