@gloom-sh/terminal 0.20.10 → 0.20.12

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 (324) hide show
  1. package/package.json +2 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +16 -0
  3. package/src/api-client/awards.ts +16 -0
  4. package/src/api-client/central-bank-rates.ts +5 -0
  5. package/src/api-client/data.ts +55 -2
  6. package/src/api-client/index.ts +18 -1
  7. package/src/api-client/request.ts +86 -3
  8. package/src/api-client/socket-connection.ts +366 -0
  9. package/src/api-client/socket-features.ts +75 -0
  10. package/src/api-client/socket-frames.ts +161 -0
  11. package/src/api-client/socket-listeners.ts +207 -0
  12. package/src/api-client/socket-quotes.ts +332 -0
  13. package/src/api-client/socket.ts +168 -983
  14. package/src/api-client/supply-chain-graph.ts +4 -2
  15. package/src/api-client/supply-chain.ts +8 -0
  16. package/src/api-client/types/econ.ts +10 -7
  17. package/src/api-client/types/filings-and-calls.ts +8 -0
  18. package/src/app/global-shortcuts.ts +2 -1
  19. package/src/app/keybindings/actions.ts +19 -0
  20. package/src/app/pane-runtime/index.tsx +18 -3
  21. package/src/app/pane-runtime/layout-placement.ts +63 -0
  22. package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
  23. package/src/brokers/signed-in/adapter.ts +19 -5
  24. package/src/brokers/signed-in/client.ts +13 -1
  25. package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
  26. package/src/capabilities/chart-series.ts +4 -1
  27. package/src/cli/board-coins.ts +10 -1
  28. package/src/cli/commands/crypto-hints.ts +3 -2
  29. package/src/cli/commands/fred-series.ts +0 -54
  30. package/src/cli/commands/market.ts +209 -31
  31. package/src/cli/commands/overview.ts +47 -14
  32. package/src/cli/commands/search.ts +37 -8
  33. package/src/cli/commands/ticker.ts +15 -4
  34. package/src/cli/desktop-pane-shot.ts +27 -2
  35. package/src/cli/fx-quote-rate.ts +1 -1
  36. package/src/cli/glossary.ts +14 -5
  37. package/src/cli/history-catalog-series.ts +85 -0
  38. package/src/cli/index.ts +1 -1
  39. package/src/cli/list-progress.ts +45 -0
  40. package/src/cli/listing-arg.ts +71 -7
  41. package/src/cli/name-entries.ts +8 -4
  42. package/src/cli/not-a-ticker.ts +2 -2
  43. package/src/cli/pane-functions/freshness.ts +50 -3
  44. package/src/cli/pane-functions/index.ts +7 -4
  45. package/src/cli/pane-functions/market-session.ts +66 -14
  46. package/src/cli/pane-functions/options.ts +5 -0
  47. package/src/cli/pane-functions/resolver.ts +9 -2
  48. package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
  49. package/src/cli/pane-functions/screenshot-types.ts +6 -0
  50. package/src/cli/quote-answer.ts +49 -10
  51. package/src/cli/quote-list-reads.ts +87 -0
  52. package/src/cli/report-tables.ts +70 -13
  53. package/src/cli/result.ts +24 -2
  54. package/src/cli/symbol-list.ts +31 -4
  55. package/src/cli/terminal-code-hints.ts +83 -0
  56. package/src/cli/ticker-resolution.ts +2 -1
  57. package/src/cli/treasury-yields.ts +5 -0
  58. package/src/components/chart/native/kitty/manager.ts +2 -0
  59. package/src/components/chart/native/surface/manager.ts +211 -11
  60. package/src/components/command-bar/action-runtime.ts +2 -0
  61. package/src/components/command-bar/panel/index.tsx +2 -13
  62. package/src/components/command-bar/panel/layout.ts +1 -7
  63. package/src/components/command-bar/panel/runtime.ts +0 -1
  64. package/src/components/command-bar/panel/types.ts +0 -2
  65. package/src/components/command-bar/routing/launch-request.ts +2 -1
  66. package/src/components/command-bar/routing/navigation-state.ts +4 -2
  67. package/src/components/command-bar/workflow/types.ts +6 -0
  68. package/src/components/data-table/column-menu.tsx +89 -0
  69. package/src/components/data-table/sort-menu.tsx +9 -2
  70. package/src/components/data-table/view.tsx +33 -6
  71. package/src/components/form-modal/content.tsx +10 -0
  72. package/src/components/index.ts +1 -1
  73. package/src/components/layout/detached-pane-shell.tsx +3 -0
  74. package/src/components/layout/double-escape-close.ts +34 -3
  75. package/src/components/layout/floating-pane.tsx +10 -4
  76. package/src/components/layout/pane/cycle-order.ts +66 -2
  77. package/src/components/layout/pane/footer/index.tsx +25 -11
  78. package/src/components/layout/pane/footer/model.ts +62 -20
  79. package/src/components/layout/pane/header.tsx +140 -31
  80. package/src/components/layout/pane/sidebar.tsx +138 -20
  81. package/src/components/layout/pane/status-footer.ts +3 -1
  82. package/src/components/layout/shell/active-drag.ts +18 -13
  83. package/src/components/layout/shell/drag/magnets.ts +34 -18
  84. package/src/components/layout/shell/drag/runtime.ts +5 -0
  85. package/src/components/layout/shell/index.tsx +25 -0
  86. package/src/components/layout/shell/menu.ts +9 -0
  87. package/src/components/layout/shell/pane/actions.ts +36 -0
  88. package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
  89. package/src/components/layout/shell/pane-occlusion.ts +40 -0
  90. package/src/components/layout/shell/shortcuts.ts +17 -1
  91. package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
  92. package/src/components/layout/shell/window-mode/index.ts +5 -16
  93. package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
  94. package/src/components/market-board/index.tsx +14 -5
  95. package/src/components/metric-treemap/index.tsx +3 -1
  96. package/src/components/ticker/list-table-view.tsx +5 -0
  97. package/src/components/ui/button.tsx +48 -4
  98. package/src/components/ui/data-table/column-order.ts +180 -0
  99. package/src/components/ui/data-table/index.tsx +12 -1
  100. package/src/components/ui/data-table/opentui/index.tsx +291 -32
  101. package/src/components/ui/data-table/opentui/model.ts +43 -4
  102. package/src/components/ui/data-table/types.ts +56 -0
  103. package/src/components/ui/data-table/use-column-order.ts +135 -0
  104. package/src/components/ui/index.ts +1 -1
  105. package/src/components/ui/inline-quick-add.tsx +19 -3
  106. package/src/components/ui/list-view.tsx +11 -5
  107. package/src/components/ui/query-bar.tsx +16 -1
  108. package/src/components/ui/selection-fill.ts +39 -0
  109. package/src/components/ui/table-layout.ts +120 -0
  110. package/src/core/state/app/layout-reducer.ts +2 -1
  111. package/src/core/state/app/pane-choices.ts +68 -0
  112. package/src/core/state/app/state.ts +14 -6
  113. package/src/core/state/app/types.ts +8 -0
  114. package/src/docs/snapshot.json +3 -2
  115. package/src/i18n/es.ts +2 -0
  116. package/src/i18n/ja.ts +2 -0
  117. package/src/i18n/ko.ts +2 -0
  118. package/src/i18n/zh-cn.ts +2 -0
  119. package/src/i18n/zh-tw.ts +2 -0
  120. package/src/layout/pane-manager/dock-tree.ts +19 -0
  121. package/src/layout/pane-manager/index.ts +3 -0
  122. package/src/market-data/coordinator/index.ts +4 -3
  123. package/src/market-data/coordinator/quotes.ts +12 -4
  124. package/src/market-data/market/freshness.ts +33 -0
  125. package/src/market-data/market/status.ts +5 -1
  126. package/src/market-data/quotes/contributions.ts +10 -0
  127. package/src/market-data/quotes/freshness.ts +31 -0
  128. package/src/market-data/quotes/live-valuation.ts +32 -5
  129. package/src/market-data/quotes/regular-session-valuation.ts +1 -1
  130. package/src/market-data/quotes/resolution.ts +4 -0
  131. package/src/market-data/quotes/time.ts +0 -14
  132. package/src/plugins/builtin/account-management/index.tsx +1 -0
  133. package/src/plugins/builtin/awards/detail.tsx +12 -4
  134. package/src/plugins/builtin/awards/headless.ts +29 -8
  135. package/src/plugins/builtin/awards/model.ts +36 -2
  136. package/src/plugins/builtin/awards/pane.tsx +7 -4
  137. package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
  138. package/src/plugins/builtin/broker-manager/index.tsx +7 -6
  139. package/src/plugins/builtin/broker-manager/model.ts +15 -6
  140. package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
  141. package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
  142. package/src/plugins/builtin/broker-manager/table.ts +10 -4
  143. package/src/plugins/builtin/broker-trading/index.tsx +1 -1
  144. package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
  145. package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
  146. package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
  147. package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
  148. package/src/plugins/builtin/chart-composer/headless.ts +5 -1
  149. package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
  150. package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
  151. package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
  152. package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
  153. package/src/plugins/builtin/chat/sidebar.tsx +35 -19
  154. package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
  155. package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
  156. package/src/plugins/builtin/cloud/plugin.tsx +1 -0
  157. package/src/plugins/builtin/cloud/team/module.tsx +1 -0
  158. package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
  159. package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
  160. package/src/plugins/builtin/company-kpis/model.ts +3 -3
  161. package/src/plugins/builtin/connections/index.ts +1 -0
  162. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
  163. package/src/plugins/builtin/credit-boards/client.ts +5 -0
  164. package/src/plugins/builtin/credit-boards/headless.ts +1 -6
  165. package/src/plugins/builtin/credit-boards/model.ts +0 -6
  166. package/src/plugins/builtin/credit-boards/series.ts +19 -8
  167. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
  168. package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
  169. package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
  170. package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
  171. package/src/plugins/builtin/debt-maturities/model.ts +9 -15
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
  173. package/src/plugins/builtin/earnings/board-model.ts +33 -4
  174. package/src/plugins/builtin/earnings/board.tsx +15 -3
  175. package/src/plugins/builtin/earnings/calendar.tsx +10 -6
  176. package/src/plugins/builtin/earnings/client.ts +0 -9
  177. package/src/plugins/builtin/earnings/headless.ts +10 -7
  178. package/src/plugins/builtin/earnings/history.tsx +21 -14
  179. package/src/plugins/builtin/earnings-calls/data.ts +24 -4
  180. package/src/plugins/builtin/earnings-calls/format.ts +23 -5
  181. package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
  182. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  183. package/src/plugins/builtin/earnings-calls/model.ts +11 -1
  184. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
  185. package/src/plugins/builtin/econ/calendar-model.ts +27 -0
  186. package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
  187. package/src/plugins/builtin/econ/index.tsx +9 -2
  188. package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
  189. package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
  190. package/src/plugins/builtin/equity-screener/live.ts +74 -18
  191. package/src/plugins/builtin/equity-screener/model.ts +19 -4
  192. package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
  193. package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
  194. package/src/plugins/builtin/equity-screener/results.ts +22 -2
  195. package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
  196. package/src/plugins/builtin/fear-greed/headless.ts +16 -13
  197. package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
  198. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  199. package/src/plugins/builtin/futures/index.tsx +15 -1
  200. package/src/plugins/builtin/futures/table.tsx +1 -1
  201. package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
  202. package/src/plugins/builtin/holders/pane.tsx +30 -20
  203. package/src/plugins/builtin/insider/table.tsx +10 -7
  204. package/src/plugins/builtin/insider/tickers.tsx +1 -1
  205. package/src/plugins/builtin/iv-history/events.ts +5 -0
  206. package/src/plugins/builtin/iv-history/headless.ts +15 -9
  207. package/src/plugins/builtin/jobs/index.tsx +1 -0
  208. package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
  209. package/src/plugins/builtin/macro-day/headless.ts +15 -6
  210. package/src/plugins/builtin/macro-day/model.ts +1 -1
  211. package/src/plugins/builtin/macro-day/releases.ts +25 -16
  212. package/src/plugins/builtin/market-movers/index.tsx +20 -8
  213. package/src/plugins/builtin/market-movers/model.ts +5 -0
  214. package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
  215. package/src/plugins/builtin/money-markets/headless.ts +12 -2
  216. package/src/plugins/builtin/money-markets/pane.tsx +10 -1
  217. package/src/plugins/builtin/options/view.tsx +3 -0
  218. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  219. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  220. package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
  221. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
  222. package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -1
  223. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
  224. package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
  225. package/src/plugins/builtin/portfolio-list/table.tsx +15 -1
  226. package/src/plugins/builtin/rate-path/pane.tsx +2 -0
  227. package/src/plugins/builtin/realized-vol/headless.ts +28 -2
  228. package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
  229. package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
  230. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  231. package/src/plugins/builtin/seasonality/pane.tsx +2 -1
  232. package/src/plugins/builtin/shared/source-footer.ts +70 -0
  233. package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
  234. package/src/plugins/builtin/short-volume/pane.tsx +5 -1
  235. package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
  236. package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
  237. package/src/plugins/builtin/supply-chain/client.ts +3 -1
  238. package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
  239. package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
  240. package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
  241. package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
  242. package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
  243. package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
  244. package/src/plugins/builtin/supply-chain/headless.ts +13 -7
  245. package/src/plugins/builtin/supply-chain/model.ts +68 -11
  246. package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
  247. package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
  248. package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
  249. package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
  250. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
  251. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
  252. package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
  253. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
  254. package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
  255. package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
  256. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
  257. package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
  258. package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
  259. package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
  260. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
  261. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
  262. package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
  263. package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
  264. package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
  265. package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
  266. package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
  267. package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
  268. package/src/plugins/builtin/vol-surface/heat-grid.tsx +6 -3
  269. package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
  270. package/src/plugins/builtin/world-indices/index.tsx +5 -1
  271. package/src/plugins/builtin/yield-curve/index.tsx +2 -1
  272. package/src/plugins/runtime/index.tsx +1 -0
  273. package/src/plugins/runtime/state.ts +20 -0
  274. package/src/portfolio/column-values.ts +8 -2
  275. package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
  276. package/src/public/react.ts +7 -0
  277. package/src/react/auto-refresh.ts +29 -0
  278. package/src/renderers/browser/deeplink-bridge.ts +24 -3
  279. package/src/renderers/dom/data-table/column-drag.ts +147 -0
  280. package/src/renderers/dom/data-table/index.tsx +22 -0
  281. package/src/renderers/dom/data-table/row.tsx +27 -5
  282. package/src/renderers/dom/desktop/query-bar.tsx +229 -60
  283. package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
  284. package/src/renderers/dom/host/overflow-fade.ts +1 -2
  285. package/src/renderers/dom/styles.css +47 -5
  286. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
  287. package/src/renderers/opentui/chart-surface.tsx +1 -0
  288. package/src/renderers/opentui/frame-hits.ts +33 -0
  289. package/src/renderers/opentui/host.tsx +2 -0
  290. package/src/renderers/opentui/native-surface.ts +14 -21
  291. package/src/renderers/opentui/test-utils.tsx +3 -0
  292. package/src/series/types.ts +2 -0
  293. package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
  294. package/src/sources/gloomberb-cloud/index.ts +25 -1
  295. package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
  296. package/src/sources/provider-errors.ts +64 -1
  297. package/src/sources/provider-router/batches.ts +19 -0
  298. package/src/sources/provider-router/index.ts +7 -1
  299. package/src/state/app/context/index.tsx +46 -1
  300. package/src/state/pane-unsent-work.ts +47 -0
  301. package/src/test-support/app-store.ts +24 -1
  302. package/src/test-support/shell-pane-keys.tsx +5 -0
  303. package/src/test-support/telemetry-guard.ts +83 -0
  304. package/src/test-support/test-env.ts +12 -0
  305. package/src/theme/colors.ts +17 -1
  306. package/src/theme/ui-tokens.ts +50 -1
  307. package/src/tickers/listing-venues.ts +11 -1
  308. package/src/tickers/search/japanese-names.json +1 -0
  309. package/src/tickers/search/japanese-names.ts +152 -0
  310. package/src/tickers/terminal-codes.ts +55 -6
  311. package/src/time-series/base-series.ts +3 -0
  312. package/src/time-series/live-quotes.ts +3 -9
  313. package/src/types/data-provider.ts +6 -0
  314. package/src/types/financials.ts +11 -0
  315. package/src/types/plugin-contributions.ts +7 -0
  316. package/src/types/plugin-panes.ts +7 -0
  317. package/src/ui/host.tsx +24 -0
  318. package/src/ui/pointer-drag.ts +11 -2
  319. package/src/utils/double-escape-close.ts +42 -0
  320. package/src/utils/fundamentals.ts +14 -3
  321. package/src/utils/fx-status.ts +30 -7
  322. package/src/utils/network-failure.ts +23 -0
  323. package/src/utils/share-multiples.cases.json +780 -2
  324. package/src/utils/share-multiples.ts +154 -24
@@ -214,9 +214,20 @@ export function QuickAddTickerInput({
214
214
  keepFailureRef.current = false;
215
215
  listMemoRef.current = createQuickAddListMemo();
216
216
  setInputValue("");
217
+ // The field keeps its own text, cursor and scroll until told: an add that left them read the next symbol
218
+ // scrolled by one ("+ SDTRY=X" for USDTRY=X).
219
+ inputRef.current?.editBuffer?.setText?.("");
220
+ inputRef.current?.setCursorOffset?.(0);
217
221
  setValidation(IDLE_VALIDATION);
218
222
  }, []);
219
223
 
224
+ /** An add is done: the row closes, empty, and `a` opens it again. */
225
+ const closeAfterAdd = useCallback(() => {
226
+ resetInput();
227
+ inputRef.current?.blur?.();
228
+ setInputFocused(false);
229
+ }, [resetInput]);
230
+
220
231
  const clearFailedInput = useCallback((failure: QuickAddValidation) => {
221
232
  keepFailureRef.current = true;
222
233
  validationSeqRef.current += 1;
@@ -393,10 +404,13 @@ export function QuickAddTickerInput({
393
404
  ...skipped,
394
405
  ].join(" "),
395
406
  });
396
- if (added.length > 0 || left.length === 0) resetInput();
397
- else setValidation(list);
398
- queueMicrotask(() => inputRef.current?.focus?.());
399
- }, [addReady, collectionKind, collectionName, notify, onAdded, resetInput]);
407
+ // Something added, or nothing left to fix: done. Entries left out keep the row open on what to fix.
408
+ if (added.length > 0 || left.length === 0) closeAfterAdd();
409
+ else {
410
+ setValidation(list);
411
+ queueMicrotask(() => inputRef.current?.focus?.());
412
+ }
413
+ }, [addReady, closeAfterAdd, collectionKind, collectionName, notify, onAdded]);
400
414
 
401
415
  const submitInput = useCallback(async (submittedValue?: string) => {
402
416
  // Before any lookup: consent to count the add cannot be given after it.
@@ -435,7 +449,7 @@ export function QuickAddTickerInput({
435
449
  collection: collectionName,
436
450
  }),
437
451
  });
438
- resetInput();
452
+ closeAfterAdd();
439
453
  return;
440
454
  }
441
455
  if (currentValidation.status !== "ready") {
@@ -463,6 +477,7 @@ export function QuickAddTickerInput({
463
477
  collection: collectionName,
464
478
  }),
465
479
  });
480
+ closeAfterAdd();
466
481
  return;
467
482
  }
468
483
 
@@ -472,8 +487,7 @@ export function QuickAddTickerInput({
472
487
  collection: collectionName,
473
488
  });
474
489
  notify({ type: "success", body: added.note ? `${body} ${added.note}.` : body });
475
- resetInput();
476
- queueMicrotask(() => inputRef.current?.focus?.());
490
+ closeAfterAdd();
477
491
  } catch {
478
492
  setValidation({ status: "error", query, message: "Ticker add failed" });
479
493
  notify({ type: "error", body: tf("Failed to add {symbol}.", { symbol: query }) });
@@ -483,12 +497,12 @@ export function QuickAddTickerInput({
483
497
  }, [
484
498
  addReady,
485
499
  clearFailedInput,
500
+ closeAfterAdd,
486
501
  collectionName,
487
502
  handOffListingChoice,
488
503
  inputValue,
489
504
  notify,
490
505
  onAdded,
491
- resetInput,
492
506
  submitList,
493
507
  submitting,
494
508
  validateInput,
@@ -20,7 +20,7 @@ import {
20
20
  } from "../account-metrics";
21
21
  import { formatPortfolioAmount, type PortfolioSummaryTotals } from "./totals";
22
22
  import { formatAllocationDrift, formatAllocationWeight, type PortfolioCashLine } from "../../../../portfolio/allocation";
23
- import { getMostRecentQuoteUpdate } from "../../../../market-data/quotes/time";
23
+ import { quoteSourceFooterSegment } from "../../shared/source-footer";
24
24
  import { fxStatusLabel, type FxRateStatus } from "../../../../utils/fx-status";
25
25
  import { t } from "../../../../i18n";
26
26
  import type { PortfolioValuationBasis } from "../../../../portfolio/valuation-basis";
@@ -490,13 +490,11 @@ export function buildPortfolioFooterSegments({
490
490
  if (savedAt != null) return [...accountStatus, savedCopyFooterSegment("refresh", savedAt)];
491
491
  if (isPortfolioTab ? !totals.hasPositions && !accountStatusText : totals.watchlistCount === 0) return [];
492
492
 
493
- const lastRefreshTimestamp = getMostRecentQuoteUpdate(quotes);
494
- const refreshText = refreshingSize > 0
495
- ? "Refreshing..."
496
- : lastRefreshTimestamp != null
497
- ? new Date(lastRefreshTimestamp).toLocaleTimeString("en-US", { hour: "numeric", minute: "2-digit" })
498
- : "-";
499
- return [...accountStatus, { id: "refresh", parts: [{ text: refreshText, tone: "muted" }] }];
493
+ // Where the quotes are from and the newest's time, as `quote` ends (`Gloom Cloud · 14:44 UTC · markets open`):
494
+ // a bare local time ("Thu 12:25") named neither.
495
+ const quoted = refreshingSize > 0 ? null : quoteSourceFooterSegment(quotes, { id: "refresh" });
496
+ const refresh: PaneFooterSegment = quoted ?? { id: "refresh", parts: [{ text: refreshingSize > 0 ? "Refreshing..." : "-", tone: "muted" }] };
497
+ return [...accountStatus, refresh];
500
498
  }
501
499
 
502
500
  const MAX_NOTICE_SYMBOLS = 12;
@@ -10,12 +10,14 @@ import { PRICE_SPARKLINE_COLUMN_ID } from "../../../components/price-sparkline/v
10
10
  import type { QuoteFlashDirection } from "../../../components/quote-flash";
11
11
  import type { TickerTableCell, TickerTableSummaryRow } from "../../../components/ticker/list-table-view";
12
12
  import { createRowValueCache } from "../../../components/ui/row-value-cache";
13
+ import type { DataTableColumnReorder } from "../../../components/ui";
13
14
  import type { ColumnConfig } from "../../../types/config";
14
15
  import type { PricePoint, TickerFinancials } from "../../../types/financials";
15
16
  import type { TickerRecord } from "../../../types/ticker";
16
17
  import { objectVersion } from "../../../utils/object-version";
17
18
  import { columnContextVersion, PERPETUAL_COLUMN_IDS } from "./cell-version";
18
19
  import { getColumnValue, type ColumnContext } from "./metrics";
20
+ import { RANGE_FROM_BARS_NOTE } from "../../../portfolio/column-values";
19
21
  import { periodPnlFigure, tickerDisplayName } from "../../../portfolio/column-values";
20
22
  import { listedSymbol } from "../../../portfolio/listed-symbol";
21
23
  import { displayWidth } from "../../../utils/format";
@@ -204,6 +206,7 @@ export function PortfolioTickerTable({
204
206
  answeredSnapshots,
205
207
  exportName,
206
208
  allocationRows,
209
+ columnReorder,
207
210
  }: {
208
211
  columns: ColumnConfig[];
209
212
  focused?: boolean;
@@ -240,6 +243,8 @@ export function PortfolioTickerTable({
240
243
  exportName?: string;
241
244
  /** The book's CASH and TOTAL rows under its holdings (`allocationSummaryRows`). */
242
245
  allocationRows?: readonly TickerTableSummaryRow[];
246
+ /** Header drags rewrite the pane's Columns setting (`DataTableProps.columnReorder`). */
247
+ columnReorder?: DataTableColumnReorder;
243
248
  }) {
244
249
  const cellCacheRef = useRef(createRowValueCache<string, ReturnType<typeof getColumnValue> & TickerTableCell>(5000));
245
250
  const openPerpetualRef = useRef(onOpenPerpetual);
@@ -293,6 +298,12 @@ export function PortfolioTickerTable({
293
298
  priceColumn.width,
294
299
  ))
295
300
  : 0, [columnContext.valuationBasis, priceColumn, resolveCell, sortedTickers, tableFinancialsMap]);
301
+ // 52W% grows to show a range read from daily bars as one ("+45.30% bars"), as LAST grows for its session mark.
302
+ const rangeColumn = columns.find((column) => column.id === "range_52w");
303
+ const rangeWidth = useMemo(() => rangeColumn && sortedTickers.some((ticker) =>
304
+ tableFinancialsMap.get(ticker.metadata.ticker)?.quote?.yearRangeBasis === "daily-bars")
305
+ ? rangeColumn.width + displayWidth(RANGE_FROM_BARS_NOTE) + 1
306
+ : 0, [rangeColumn, sortedTickers, tableFinancialsMap]);
296
307
  // The Ticker column grows to its longest symbol, so ETH-USD and BA:LSE show whole beside their market-state dot.
297
308
  const tickerWidth = useMemo(() => Math.min(MAX_TICKER_COLUMN_WIDTH, sortedTickers.reduce(
298
309
  (widest, ticker) => Math.max(widest, TICKER_DOT_WIDTH + displayWidth(listedSymbol(ticker, tickerDisplayName(ticker), columnContext.homeMarket))),
@@ -307,13 +318,15 @@ export function PortfolioTickerTable({
307
318
  : column.id === "weight" && grossWeights ? { ...column, label: GROSS_WEIGHT_LABEL }
308
319
  : column.id === "ticker" && tickerWidth > column.width ? { ...column, width: tickerWidth }
309
320
  : column.id === "price" && priceWidth > column.width ? { ...column, width: priceWidth }
321
+ : column.id === "range_52w" && rangeWidth > column.width ? { ...column, width: rangeWidth }
310
322
  : column.id === "pnl_pct" && period ? { ...column, label: CONTRIBUTION_LABEL }
311
323
  : pnlLabel !== "P&L" && (column.id === "pnl" || column.id === "pnl_pct") ? {
312
324
  ...column,
313
325
  label: column.id === "pnl_pct" ? pnlLabel.replace("P&L", "%") : pnlLabel,
314
326
  } : column).map((column) => BOOK_CURRENCY_COLUMN_IDS.has(column.id) ? bookCurrencyColumn(column, capCurrency) : column)
315
327
  .map((column) => hasFrontReference && column.id === noteColumnId ? { ...column, flexGrow: 1 } : column),
316
- [capCurrency, columns, grossWeights, hasFrontReference, hasNonShareQuantity, noteColumnId, period, pnlLabel, priceWidth, sharesWidth, tickerWidth]);
328
+ [capCurrency, columns, grossWeights, hasFrontReference, hasNonShareQuantity, noteColumnId, period, pnlLabel, priceWidth, rangeWidth, sharesWidth,
329
+ tickerWidth]);
317
330
  // Read again as the rows' data moves, from the cells the rows show; the columns change only when what is hidden does.
318
331
  // The company columns hidden last time, per list, stay hidden while a row added since settles.
319
332
  const hiddenCompanyRef = useRef<{ list: string | undefined; ids: ReadonlySet<string> }>({ list: undefined, ids: new Set() });
@@ -389,6 +402,7 @@ export function PortfolioTickerTable({
389
402
  summaryRows={summaryRows}
390
403
  rootHeight={rootHeight}
391
404
  exportName={exportName}
405
+ columnReorder={columnReorder}
392
406
  />
393
407
  );
394
408
  }
@@ -194,6 +194,8 @@ export function RatePathPane({ width, height, focused }: PaneProps) {
194
194
  rootBefore={header(meetingColumns, meetings.length, pathChart)} />
195
195
  : tab === "probabilities" ? <DataTableView
196
196
  columns={probabilityColumns}
197
+ // Target ranges in rate order.
198
+ columnReorder={false}
197
199
  items={data.meetings} selection={selection} focused={focused} sortColumnId={null} sortDirection="asc"
198
200
  getItemKey={meetingKey} rootWidth={width} rootHeight={bodyHeight} emptyStateTitle="Meeting probabilities unavailable"
199
201
  rootBefore={header(probabilityColumns, data.meetings.length)}
@@ -3,7 +3,7 @@ import type { HeadlessPaneDefinition } from "../../../types/plugin";
3
3
  import { createSurfaceDependencies } from "../vol-surface/client";
4
4
  import { resolveHeadlessInstrument } from "../shared/headless-market-data";
5
5
  import { createRealizedVolatilityDependencies, loadCurrentAtmIv, loadRealizedVolatilityHistory } from "./client";
6
- import { atmIvObservedLabel, projectRealizedVolatility, type CurrentAtmIvSnapshot } from "./model";
6
+ import { atmIvObservedLabel, projectRealizedVolatility, type CurrentAtmIvSnapshot, type RealizedVolatilityModel } from "./model";
7
7
  import { ESTIMATOR_OPTIONS, selectedWindows } from "./settings";
8
8
  import { DAILY_CLOSES } from "../shared/report-freshness";
9
9
  import { listingAbroadVenue } from "../../../utils/sec";
@@ -30,10 +30,35 @@ function fxProxySection(proxy: FxVolProxy, reading: FxProxyReading): HeadlessBun
30
30
  formatted: proxy.iv30 ? `${proxy.iv30.date}${proxy.iv30.method === "quote-mid" ? " (quote mid)" : ""}${stale ? ", stale" : ""}` : "--" },
31
31
  { label: fxProxyChainLabel(proxy), value: proxy.expiries?.usable ?? null, formatted: fxProxyChainText(proxy, Date.now()) },
32
32
  { label: "Pair HV20", value: hv20, formatted: percent(hv20) },
33
- { label: "IV30 - HV20", value: spread, formatted: spread == null ? "--" : `${spread >= 0 ? "+" : ""}${(spread * 100).toFixed(2)} pts` },
33
+ // In points of volatility, which the label names, so an export writes the bare number.
34
+ { label: "IV30 - HV20 (pts)", value: spread, formatted: spread == null ? "--" : `${spread >= 0 ? "+" : ""}${(spread * 100).toFixed(2)}` },
34
35
  ] };
35
36
  }
36
37
 
38
+ /** Sessions of the history the text report prints; exports write every session of the lookback. */
39
+ const HISTORY_TEXT_SESSIONS = 10;
40
+
41
+ /**
42
+ * Each session's estimate for the windows shown, newest first, as HIVG's daily
43
+ * history is: the series the graph draws, which exports write as numbers in
44
+ * percent under one column per window (HV20 (%)). The text report prints the
45
+ * latest sessions.
46
+ */
47
+ function historySection(model: RealizedVolatilityModel): HeadlessBundleSection {
48
+ const rows = model.series.map((point) => ({
49
+ date: point.date.toISOString().slice(0, 10),
50
+ ...Object.fromEntries(model.windows.map((window) => [`hv${window}`, point.values[window] ?? null])),
51
+ })).reverse();
52
+ return {
53
+ title: "History",
54
+ textTitle: `History, latest ${Math.min(HISTORY_TEXT_SESSIONS, rows.length)} sessions`,
55
+ columns: [{ key: "date", header: "Date" }, ...model.windows.map((window) => ({ key: `hv${window}`, header: `HV${window}`,
56
+ format: (value: unknown) => typeof value === "number" ? `${(value * 100).toFixed(2)}%` : "--" }))],
57
+ rows,
58
+ textRows: rows.slice(0, HISTORY_TEXT_SESSIONS),
59
+ };
60
+ }
61
+
37
62
  export function realizedVolHeadless(initialView: "graph" | "cone"): HeadlessPaneDefinition<"bundle"> {
38
63
  return {
39
64
  shape: "bundle", argument: { kind: "ticker", description: "Underlying ticker" }, currencyPairs: true,
@@ -102,6 +127,7 @@ export function realizedVolHeadless(initialView: "graph" | "cone"): HeadlessPane
102
127
  { key: "percentile", header: "Percentile", format: (value) => typeof value === "number" ? `${value.toFixed(1)}%` : "--" },
103
128
  { key: "sampleSize", header: "Samples" },
104
129
  ], rows: model.cone.map((row) => ({ ...row })) },
130
+ ...model.series.length > 0 ? [historySection(model)] : [],
105
131
  ...proxy && proxyReading ? [fxProxySection(proxy, proxyReading)] : fx || !args.options.showIv ? [] : [{ title: "Current IV", entries: [
106
132
  { label: "ATM IV", value: iv?.reference?.value ?? null, formatted: iv?.reference ? `${(iv.reference.value * 100).toFixed(2)}%` : "--" },
107
133
  { label: "Expiry", value: iv?.reference?.expiration ?? null,
@@ -214,6 +214,8 @@ function RevenueBreakdownView({ width, height, focused }: { width: number; heigh
214
214
  {payload ? (
215
215
  <DataTableView<Item>
216
216
  columns={columns}
217
+ // Reporting quarters in time order, then the latest and TTM.
218
+ columnReorder={false}
217
219
  items={items}
218
220
  focused={focused}
219
221
  rootWidth={width}
@@ -145,7 +145,8 @@ export function ReverseDcfPane({ width, height, focused }: PaneProps) {
145
145
  <Box paddingX={1}><Notice variant="callout" tone="muted">{missingInputsText(model.missing)}</Notice></Box>
146
146
  </> : model && !model.error ? <>
147
147
  <StatGrid items={stats} width={width} maxLines={statMaxLines} />
148
- <DataTableView<Row> focused={focused} columns={COLUMNS} items={model.sensitivity} rootWidth={width} rootHeight={contentHeight}
148
+ {/* Terminal growth rates in order: a sensitivity grid's axis. */}
149
+ <DataTableView<Row> focused={focused} columns={COLUMNS} columnReorder={false} items={model.sensitivity} rootWidth={width} rootHeight={contentHeight}
149
150
  getItemKey={(row) => String(row.discountRate)} emptyStateTitle="No implied growth." sortColumnId={null} sortDirection="desc"
150
151
  selection={{ kind: "id", selectedId, getId: (row) => String(row.discountRate),
151
152
  onChange: (id) => { if (id) setDiscount(String(Math.round(Number(id) * 100))); } }}
@@ -24,6 +24,7 @@ export const riskFactorsModule: PluginModule = {
24
24
  component: RiskFactorsResearchTab,
25
25
  instruments: ["equity"],
26
26
  isVisible: ({ ticker }) => !isKnownNonUsListing(ticker),
27
+ proOnly: true,
27
28
  });
28
29
  },
29
30
 
@@ -220,7 +220,8 @@ export function SeasonalityPane({ width, height, focused }: PaneProps) {
220
220
  formatCursor: (ratio) => new Date(Date.UTC(OVERLAY_YEAR, 0, 1) + ratio * 365 * 86_400_000).toISOString().slice(5, 10) }}
221
221
  colors={{ background: palette.bgColor, grid: palette.gridColor, crosshair: palette.crosshairColor, text: colors.text,
222
222
  textDim: palette.axisColor, negative: colors.negative }} />
223
- : <DataTableView<Row> focused={focused} columns={COLUMNS} items={rows} rootWidth={width} rootHeight={contentHeight}
223
+ // January to December: the grid is a calendar.
224
+ : <DataTableView<Row> focused={focused} columns={COLUMNS} columnReorder={false} items={rows} rootWidth={width} rootHeight={contentHeight}
224
225
  getItemKey={(row) => row.id} emptyStateTitle="No monthly returns." sortColumnId={null} sortDirection="desc"
225
226
  selection={{ kind: "id", selectedId: selectedRow, getId: (row) => row.id, onChange: (id) => setSelectedRow(id) }}
226
227
  getExportMetadata={() => [["symbol", model.symbol], ["as of", model.asOf?.toISOString()], ["units", "percent, local-price close to close"]]}
@@ -0,0 +1,70 @@
1
+ import type { PaneFooterSegment } from "../../../components/layout/pane/footer";
2
+ import { deriveHeadlessFreshness, paneSourceLineVariants, type ReportFreshness } from "../../../cli/pane-functions/freshness";
3
+ import { quotesFreshness } from "../../../cli/freshness";
4
+ import { quoteSourceName } from "../../../market-data/quotes/export-identity";
5
+ import { quoteHeadlineTime } from "../../../market-data/market/status";
6
+ import type { Quote } from "../../../types/financials";
7
+ import type { HeadlessPaneDefinition, HeadlessPaneResult } from "../../../types/headless";
8
+ import { getSharedRegistry } from "../../registry";
9
+
10
+ /**
11
+ * The footer's one form for where a pane's data comes from and how current it
12
+ * is, the line its `fn` report ends with (paneSourceLineVariants): `DTCC · Thu
13
+ * 12 Nov 2026 · not a live feed (daily levels of public trades)`. A narrow row
14
+ * shortens it to the source and the date, then the date alone. `feed: false`
15
+ * leaves out the delay a pane's clock already shows.
16
+ */
17
+ function sourceFooterSegment(
18
+ freshness: ReportFreshness,
19
+ { id = "source", feed = true, time }: {
20
+ id?: string;
21
+ feed?: boolean;
22
+ /** The data's time in its fewest cells (`12:25 UTC`), for a row too narrow for the line's own date: after the sourced lines and last. */
23
+ time?: string;
24
+ } = {},
25
+ ): PaneFooterSegment {
26
+ const lines = paneSourceLineVariants(freshness, { feed });
27
+ const sourced = freshness.source ? lines.filter((line) => line.startsWith(`${freshness.source} · `)) : [];
28
+ const ordered = time
29
+ ? [...sourced, ...freshness.source ? [`${freshness.source} · ${time}`] : [], ...lines.filter((line) => !sourced.includes(line)), time]
30
+ : lines;
31
+ const [line, ...shorter] = [...new Set(ordered)].map((text) => [{ text, tone: "muted" as const }]);
32
+ return { id, asOf: true, parts: line!, ...(shorter.length ? { variants: shorter } : {}) };
33
+ }
34
+
35
+ /** `12:25 UTC` on the day it is read, `Thu 12 Nov 12:25 UTC` before. */
36
+ function compactTime(time: number, now: number): string {
37
+ const at = new Date(time);
38
+ const clock = `${at.toISOString().slice(11, 16)} UTC`;
39
+ if (at.toISOString().slice(0, 10) === new Date(now).toISOString().slice(0, 10)) return clock;
40
+ return `${at.toLocaleDateString("en-GB", { weekday: "short", day: "numeric", month: "short", timeZone: "UTC" }).replace(",", "")} ${clock}`;
41
+ }
42
+
43
+ /** {@link sourceFooterSegment} for a pane's data read as its report reads it: the definition's freshness over `result`. */
44
+ export function reportFooterSegment(
45
+ definition: Pick<HeadlessPaneDefinition, "shape" | "freshness">,
46
+ result: HeadlessPaneResult,
47
+ options: { id?: string; feed?: boolean; now?: number } = {},
48
+ ): PaneFooterSegment {
49
+ return sourceFooterSegment(deriveHeadlessFreshness(definition, result, options.now), options);
50
+ }
51
+
52
+ /**
53
+ * {@link sourceFooterSegment} for the quotes a pane shows, as `quote` ends: where they are from (Gloom Cloud, a
54
+ * broker by its name) and the newest's session or time, `Gloom Cloud · EGX trading day Thu 12 Nov 2026 close`,
55
+ * down to `Gloom Cloud · 12:25 UTC` and the time alone in a narrow pane. Its delay is left to the pane's clock.
56
+ * A quote whose source has no name to give leaves the source out rather than calling it Gloom Cloud. Null with
57
+ * no quote.
58
+ */
59
+ export function quoteSourceFooterSegment(
60
+ quotes: Iterable<Quote | null | undefined>,
61
+ { id = "source", now = Date.now() }: { id?: string; now?: number } = {},
62
+ ): PaneFooterSegment | null {
63
+ const shown = [...quotes].filter((quote): quote is Quote => quote != null && quote.lastUpdated > 0);
64
+ const names = [...new Set(shown.map((quote) => quoteSourceName(quote, (providerId) => getSharedRegistry()?.getBrokerAdapter(providerId)?.name)))];
65
+ const source = names.length > 0 && names.every(Boolean) ? names.join(" and ") : "";
66
+ const freshness = quotesFreshness(shown, undefined, now);
67
+ if (!freshness) return null;
68
+ const newest = Math.max(...shown.map((quote) => quoteHeadlineTime(quote)));
69
+ return sourceFooterSegment({ ...freshness, source }, { id, feed: false, ...Number.isFinite(newest) && newest > 0 ? { time: compactTime(newest, now) } : {} });
70
+ }
@@ -10,6 +10,8 @@ import type { PaneProps } from "../../../types/plugin";
10
10
  import { isKnownNonUsEquityTicker } from "../../../utils/sec";
11
11
  import { listingIdentity } from "../shared/ticker-request";
12
12
  import { cachedPublication, loadPublication, type PublicationKind } from "./publications-client";
13
+ import { publicationHeadless } from "./publications-headless";
14
+ import { reportFooterSegment } from "../shared/source-footer";
13
15
  import { publicationCell, publicationColumns, publicationRows, sharedFailIdentity, type PublicationColumn, type PublicationRow } from "./publications-model";
14
16
 
15
17
  function renderCell(row: PublicationRow, column: PublicationColumn, _index: number, state: { selected: boolean }): DataTableCell {
@@ -48,7 +50,9 @@ export function ShortSidePublicationPane({ kind, width, height, focused }: Pick<
48
50
  notices: [...(data?.warnings ?? []), ...(resource.data?.refreshError ? [resource.data.refreshError] : [])] });
49
51
  usePaneStatusLinkFooter({ registrationId: kind, focused, loading: resource.loading, error: resource.error,
50
52
  url: selected?.sourceUrl ?? data?.source.url ?? null, showOpenHint: true,
51
- info: data && updatedAgo ? [ageFooterSegment(updatedAgo)] : [],
53
+ // Its source and newest date, as `fn FTD` and `fn ATS` end; how long ago it loaded goes first on a narrow row.
54
+ info: data ? [reportFooterSegment(publicationHeadless(kind), { sections: [{ title: "", columns: [], rows: publicationRows(data) }] }),
55
+ ...(updatedAgo ? [ageFooterSegment(updatedAgo)] : [])] : [],
52
56
  stale: !!data && resource.data?.stale,
53
57
  });
54
58
  if (!symbol) return <EmptyState title="No ticker selected." message={`Select a US stock to view ${subject}.`} />;
@@ -14,6 +14,8 @@ import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
14
14
  import { SignInWall } from "../cloud/auth-actions";
15
15
  import { isCloudSessionRequired, useResearchCloudSession } from "../shared/research-cloud-session";
16
16
  import { cachedShortVolume, loadShortVolume } from "./client";
17
+ import { shortVolumeHeadless } from "./headless";
18
+ import { reportFooterSegment } from "../shared/source-footer";
17
19
  import { exactQuantity, sortedVolumeHistory, VOLUME_COLUMNS, volumeChange, volumeHistoryPoints, volumePercent, volumePointStatus, volumeQuantity, type VolumeColumn, type VolumeSort } from "./model";
18
20
  import { usePaneTickerIdentity } from "../../../state/hooks/pane-ticker";
19
21
 
@@ -84,7 +86,9 @@ export function ShortVolumePane({ width, height, focused }: Pick<PaneProps, "wid
84
86
  notices: [...(data?.warnings ?? []), ...(resource.data?.refreshError ? [resource.data.refreshError] : [])] });
85
87
  usePaneStatusLinkFooter({ registrationId: "short-volume", focused, loading: resource.loading, error: resource.error,
86
88
  url: selected?.sourceUrl ?? data?.source.url ?? null, showOpenHint: true,
87
- info: data && updatedAgo ? [ageFooterSegment(updatedAgo)] : [],
89
+ // Its source and newest day, as `fn SIV` ends; how long ago it loaded goes first on a narrow row.
90
+ info: data ? [reportFooterSegment(shortVolumeHeadless, { sections: [{ title: "", columns: [], rows: data.history.map((point) => ({ date: point.date })) }] }),
91
+ ...(updatedAgo ? [ageFooterSegment(updatedAgo)] : [])] : [],
88
92
  stale: !!data && resource.data?.stale,
89
93
  });
90
94
  if (!data && isCloudSessionRequired(resource.error)) return <SignInWall placement="short-volume-signin" action="view daily short volume" needsVerification={session.needsVerification} />;
@@ -11,6 +11,9 @@ import {
11
11
  } from "../../../components";
12
12
  import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
13
13
  import { ageFooterSegment } from "../../../components/layout/pane/footer";
14
+ import { useUtcDay } from "../../../react/auto-refresh";
15
+ import { reportFooterSegment } from "../shared/source-footer";
16
+ import { socialMentionsHeadless } from "./headless";
14
17
  import { useAsyncResource, useAutoRefresh, useMarketData, usePluginPaneState, useUpdatedAgo } from "../../../public/react";
15
18
  import { useThemeColors } from "../../../theme/theme-context";
16
19
  import { Box } from "../../../ui";
@@ -154,13 +157,19 @@ export function SocialOutliersView({ width, height, focused, renderTicker }: {
154
157
  }, [setOpenName, setOpenSymbol]);
155
158
 
156
159
  const updatedAgo = useUpdatedAgo(resource.updatedAt);
160
+ const utcDay = useUtcDay();
161
+ // Its source and when the posts were counted, as `fn BUZZ` ends; how long ago it loaded goes first on a narrow row.
162
+ const footerInfo = useMemo(() => data ? [
163
+ reportFooterSegment(socialMentionsHeadless, { sections: [], metadata: { asOf: data.asOf } }),
164
+ ...(updatedAgo ? [ageFooterSegment(updatedAgo)] : []),
165
+ ] : [], [data, updatedAgo, utcDay]);
157
166
  usePaneStatusFooter({
158
167
  registrationId: "social-mentions:outliers",
159
168
  enabled: !detailOpen,
160
169
  loading: resource.loading,
161
170
  error: data ? resource.error : null,
162
171
  stale: !!data && !!shown?.stale,
163
- info: data && updatedAgo ? [ageFooterSegment(updatedAgo)] : [],
172
+ info: footerInfo,
164
173
  });
165
174
  usePaneNoticeFooter({
166
175
  registrationId: "social-mentions:outliers:notices",
@@ -4,6 +4,9 @@ import { Box, ScrollBox, Text, useUiCapabilities } from "../../../ui";
4
4
  import { useAsyncResource, useAutoRefresh, usePaneSettingValue, usePluginPaneState, useShortcut, useUpdatedAgo } from "../../../public/react";
5
5
  import { CompositeChart, DataTableStackView, EmptyState, PaneStatusBody, usePaneNoticeFooter, usePaneStatusLinkFooter, type DataTableCell, StatGrid } from "../../../components";
6
6
  import { ageFooterSegment } from "../../../components/layout/pane/footer";
7
+ import { useUtcDay } from "../../../react/auto-refresh";
8
+ import { reportFooterSegment } from "../shared/source-footer";
9
+ import { socialMentionsHeadless } from "./headless";
7
10
  import { colors } from "../../../theme/colors";
8
11
  import type { SocialMentionPost, SocialMentionsRange } from "../../../api-client/social-mentions";
9
12
  import { staticSeries } from "../../../components/chart/static/series";
@@ -119,6 +122,8 @@ function SocialMentionsTickerView({ width, height, focused, listingKey, onDetail
119
122
  return () => clearTimeout(timer);
120
123
  }, [pending, resource.updatedAt, resource.reload]);
121
124
  useAutoRefresh(resource.updatedAt, resource.load);
125
+ // The footer leaves the day off a time of today; the next day it names it.
126
+ useUtcDay();
122
127
  const dayOpen = !!openRow;
123
128
  useEffect(() => onDetailChange?.(dayOpen), [dayOpen, onDetailChange]);
124
129
  useEffect(() => () => onDetailChange?.(false), [onDetailChange]);
@@ -129,7 +134,9 @@ function SocialMentionsTickerView({ width, height, focused, listingKey, onDetail
129
134
  const signInWall = !data && isCloudSessionRequired(resource.error);
130
135
  usePaneStatusLinkFooter({ registrationId: "social-mentions", focused, loading: resource.loading || pending, error: signInWall ? null : resource.error,
131
136
  url: selected?.topPost?.url ?? (symbol ? `https://x.com/search?q=%24${symbol}` : null), showOpenHint: true,
137
+ // Its source and when the posts were counted, as `fn BUZZ` ends; how long ago it loaded goes first on a narrow row.
132
138
  info: data ? [
139
+ reportFooterSegment(socialMentionsHeadless, { sections: [], metadata: { asOf: data.asOf } }),
133
140
  ...(updatedAgo ? [ageFooterSegment(updatedAgo)] : []),
134
141
  ...(resource.data?.stale ? [{ id: "stale", parts: [{ text: "stale", tone: "warning" as const }] }] : []),
135
142
  ] : [],
@@ -32,7 +32,8 @@ function evidence(value: SupplyEvidenceItem): boolean {
32
32
  && finite(value.confidence) && value.confidence >= 0 && value.confidence <= 1
33
33
  && ["active", "superseded", "rejected", "stale"].includes(value.status)
34
34
  && (value.verificationStatus === undefined || ["verified", "lead"].includes(value.verificationStatus))
35
- && nullableText(value.valueKind) && (value.value === null || finite(value.value)) && nullableText(value.valueUnit) && nullableText(value.currency);
35
+ && nullableText(value.valueKind) && (value.value === null || finite(value.value)) && nullableText(value.valueUnit) && nullableText(value.currency)
36
+ && (value.relatedParty === undefined || typeof value.relatedParty === "boolean");
36
37
  }
37
38
  export function validSupplyEntity(value: SupplyEntity): boolean {
38
39
  return !!value && text(value.id) && text(value.name) && nullableText(value.ticker) && nullableText(value.exchange)
@@ -53,6 +54,7 @@ export function validSupplyRow(value: SupplyRow): boolean {
53
54
  && (value.nativeAmount == null || (value.nativeCurrency != null && value.nativeScale != null && Number.isFinite(value.nativeAmount * value.nativeScale)))
54
55
  && (value.jurisdiction == null || (text(value.jurisdiction) && /^[A-Z]{2}$/.test(value.jurisdiction)))
55
56
  && [undefined, null, "entity", "group", "anonymous", "aggregate"].includes(value.entityScope)
57
+ && (value.relatedParty === undefined || typeof value.relatedParty === "boolean")
56
58
  && (value.pctOfRevenue === null || value.pctBasis !== null) && (value.usd === null || value.usdBasis !== null)
57
59
  && text(value.period) && validPeriodMonths(value.periodMonths) && nullableText(value.fiscalYear) && ["xbrl", "filing_text", "call", "news", "web", "import", "press_release"].includes(value.sourceKind)
58
60
  && nullableText(value.form) && (value.filedDate === null || date(value.filedDate)) && date(value.asOf)
@@ -10,9 +10,10 @@ import { cardSurfaceStyle } from "../../../components/ui/card";
10
10
  import { TOOLTIP_SURFACE_STYLE } from "../../../components/ui/frame";
11
11
  import { blendHex } from "../../../theme/colors";
12
12
  import { useThemeColors } from "../../../theme/theme-context";
13
+ import { useSelectionFill } from "../../../components/ui/selection-fill";
13
14
  import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
14
15
  import { fillOpaque, fillRect, parseHex } from "../../../components/chart/native/raster/primitives";
15
- import { counterpartyKind, counterpartyLabel, disclosedValue, dollars, nativeValue, periodText, roleLabel, ROLE_COLORS, scopeWords, shareParts, fitShareBasis, type FlowBand, type ShareParts } from "./model";
16
+ import { counterpartyKind, counterpartyKindLabel, counterpartyLabel, disclosedValue, dollars, isRelatedParty, nativeValue, periodText, relationshipLabel, roleLabel, ROLE_COLORS, scopeWords, shareParts, fitShareBasis, type FlowBand, type ShareParts } from "./model";
16
17
  import { entityTicker } from "./graph-model";
17
18
  import { flowChipLabel, flowGeometry, RELATED_LABEL_CELLS, ribbonY, type FlowRibbon, type PositionedNode } from "./flow-layout";
18
19
  import { evidenceDate, evidenceLabel, trustTier } from "./trust";
@@ -35,8 +36,21 @@ function shareText(share: ShareParts, cells: number): string {
35
36
  return `${share.value} ${fitShareBasis(share, cells - displayWidth(share.value) - 1)}`;
36
37
  }
37
38
 
38
- /** The disclosed figure a card shows under the name, in the reporting company's own terms, in `cells` cells. */
39
+ /**
40
+ * The line a card shows under the name, in `cells` cells: a related party
41
+ * says so first ("related group · 9,515,093.66 CNY"), on the card itself and
42
+ * not only in its tooltip, then the disclosed figure. A card too narrow for
43
+ * both whole says "related ·" so the figure keeps its digits.
44
+ */
39
45
  function nodeMetric(node: PositionedNode, focusId: string | undefined, cells: number): string {
46
+ const row = node.row!;
47
+ if (!isRelatedParty(row)) return nodeFigure(node, focusId, cells);
48
+ const lines = [`${counterpartyKindLabel(row, true)} · `, "related · "].map((label) => `${label}${nodeFigure(node, focusId, cells - displayWidth(label))}`);
49
+ return lines.find((line) => displayWidth(line) <= cells) ?? lines.at(-1)!;
50
+ }
51
+
52
+ /** The disclosed figure a card shows under the name, in the reporting company's own terms, in `cells` cells. */
53
+ function nodeFigure(node: PositionedNode, focusId: string | undefined, cells: number): string {
40
54
  const row = node.row!;
41
55
  if (trustTier(row) !== 1) return `${evidenceLabel(row)} · ${evidenceDate(row)}`;
42
56
  if (node.weight !== null && node.weightBasis === "usd") return dollars(row);
@@ -248,7 +262,7 @@ export function SupplyFlow({ rows, symbol, focusName, focusId, width, height, fo
248
262
  function flowNodeName(node: PositionedNode): string {
249
263
  if (node.more) return `Show ${node.more} more ${node.role ? ROLE_PLURAL[node.role].toLowerCase() : node.band}`;
250
264
  const name = node.row ? counterpartyLabel(node.row) : node.label;
251
- const role = node.role ? roleLabel(node.role) : node.band;
265
+ const role = node.row ? relationshipLabel(node.row) : node.role ? roleLabel(node.role) : node.band;
252
266
  return `Open ${name}, ${role}`;
253
267
  }
254
268
 
@@ -297,6 +311,9 @@ function FlowCard({ node, focusId, desktop, active, onPress, onHover }: {
297
311
  node: PositionedNode; focusId?: string; desktop: boolean; active: boolean; onPress: () => void; onHover: (on: boolean) => void;
298
312
  }) {
299
313
  const colors = useThemeColors();
314
+ // The chosen card is the flow's cursor: quieter while the pane does not have the keys.
315
+ const selectionFill = useSelectionFill();
316
+ const chosenText = (own: string) => (selectionFill.lit ? colors.selectedText : selectionFill.ink(own));
300
317
  const role = node.role;
301
318
  const accent = role ? ROLE_COLORS[role] : colors.textMuted;
302
319
  const company = node.row ? counterpartyKind(node.row) === "company" : false;
@@ -307,7 +324,7 @@ function FlowCard({ node, focusId, desktop, active, onPress, onHover }: {
307
324
  const nameWidth = Math.max(4, inner - (ticker ? displayWidth(ticker) + 1 : 0));
308
325
  const titleColor = node.more ? colors.textDim : company ? colors.textBright : colors.text;
309
326
  return <Box position="absolute" left={node.x} top={node.y} width={node.width} height={node.more ? 1 : node.height} flexDirection="column"
310
- backgroundColor={desktop ? undefined : node.more ? undefined : active ? colors.selected : blendHex(colors.bg, accent, 0.12)}
327
+ backgroundColor={desktop ? undefined : node.more ? undefined : active ? selectionFill.bg : blendHex(colors.bg, accent, 0.12)}
311
328
  // The card, in the relationship's colour; "+N more" is the same card without a fill, its rule dotted.
312
329
  style={desktop ? { ...cardSurfaceStyle({ selected: active, accent, padding: "0 var(--gloom-space-sm)" }),
313
330
  ...(node.more ? { background: "transparent", borderLeftStyle: "dotted" } : {}), cursor: "pointer" } : undefined}
@@ -316,12 +333,12 @@ function FlowCard({ node, focusId, desktop, active, onPress, onHover }: {
316
333
  {/* The ticker shows only beside the whole name. On the desktop that is CSS: the row wraps, one line shows, and a ticker that does not fit goes to the hidden line. */}
317
334
  <Box flexDirection="row" height={1} overflow="hidden" style={desktop ? { flexWrap: "wrap" } : undefined}>
318
335
  {!desktop ? <Text fg={node.more ? colors.textMuted : accent}>▍</Text> : null}
319
- <ClippedText fg={active && !desktop ? colors.selectedText : titleColor} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth} />
336
+ <ClippedText fg={active && !desktop ? chosenText(titleColor) : titleColor} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth} />
320
337
  {ticker && (desktop || displayWidth(name) + displayWidth(ticker) + 1 <= inner)
321
- ? <Text fg={colors.textDim} style={desktop ? { flex: "0 0 auto" } : undefined}>{` ${ticker}`}</Text> : null}
338
+ ? <Text fg={active && !desktop ? selectionFill.ink(colors.textDim) : colors.textDim} style={desktop ? { flex: "0 0 auto" } : undefined}>{` ${ticker}`}</Text> : null}
322
339
  </Box>
323
340
  {metric ? <Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden">
324
- <ClippedText fg={active && !desktop ? colors.selectedText : colors.textDim} text={metric} width={inner - (desktop ? 0 : 1)} />
341
+ <ClippedText fg={active && !desktop ? chosenText(colors.textDim) : colors.textDim} text={metric} width={inner - (desktop ? 0 : 1)} />
325
342
  </Box> : null}
326
343
  </Box>;
327
344
  }
@@ -350,7 +367,7 @@ function FlowTooltip({ node, focusId, width, desktop, anchor }: { node: Position
350
367
  const share = shareParts(row, focusId);
351
368
  const lines = [
352
369
  share ? `${share.value} ${share.basis}` : nativeValue(row) !== null || row.usd !== null ? disclosedValue(row) : "No figure disclosed",
353
- `${roleLabel(row.role)} · ${periodText(row)}`,
370
+ `${relationshipLabel(row)} · ${periodText(row)}`,
354
371
  trustTier(row) === 1
355
372
  ? `${evidenceLabel(row)} · ${entityTicker(row.reportingEntity) ?? row.reportingEntity.name} ${row.form ?? "filing"}${row.filedDate ? ` filed ${row.filedDate}` : ""}`
356
373
  : `${evidenceLabel(row)} · ${evidenceDate(row)}`,
@@ -39,7 +39,7 @@ export function validateGraph(data: GraphPayload): GraphPayload {
39
39
  const link = links.get(key), a = entry.nodeIds[index], b = entry.nodeIds[index + 1];
40
40
  if (!link || !(link.from === a && link.to === b || link.to === a && link.from === b)) throw 0;
41
41
  });
42
- if (entry.exposure && (entry.linkIds.some(id => graphEvidenceRow(links.get(id)!.evidence.find(item => item.id === links.get(id)!.primaryEvidenceId)!).tier !== 1) || entry.exposure.estimated !== true || !Number.isFinite(entry.exposure.pct) || entry.exposure.pct < 0 || entry.exposure.pct > 100
42
+ if (entry.exposure && (entry.linkIds.some(id => graphEvidenceRow(links.get(id)!.evidence.find(item => item.id === links.get(id)!.primaryEvidenceId)!).tier !== 1) || entry.exposure.estimated !== entry.hops > 1 || !Number.isFinite(entry.exposure.pct) || entry.exposure.pct < 0 || entry.exposure.pct > 100
43
43
  || !entry.nodeIds.includes(entry.exposure.denominatorEntityId) || !["revenue", "receivables", "cost", "purchases"].includes(entry.exposure.basis) || !validPeriodMonths(entry.exposure.periodMonths))) throw 0;
44
44
  };
45
45
  data.paths.forEach(path);
@@ -12,7 +12,7 @@ export function graphEvidenceRow(evidence: GraphEvidence): SupplyRow {
12
12
  pctOfRevenue: evidence.pctOfRevenue ?? null, pctBasis: evidence.pctBasis ?? null, pctScope: evidence.pctScope ?? null,
13
13
  usd: evidence.usd ?? null, usdBasis: evidence.usdBasis ?? null,
14
14
  nativeAmount: evidence.nativeAmount ?? null, nativeCurrency: evidence.nativeCurrency ?? null, nativeScale: evidence.nativeScale ?? null,
15
- jurisdiction: evidence.jurisdiction, entityScope: evidence.entityScope,
15
+ jurisdiction: evidence.jurisdiction, entityScope: evidence.entityScope, ...(evidence.relatedParty ? { relatedParty: true } : {}),
16
16
  confidence: evidence.confidence, quote: evidence.quote, quoteLanguage: evidence.quoteLanguage ?? null,
17
17
  quoteGloss: evidence.quoteGloss, sectionRef: evidence.sectionRef, sourceAttribution: evidence.sourceAttribution,
18
18
  quoteMatchMode: evidence.quoteMatchMode ?? null, filingUrl: evidence.filingUrl, accession: evidence.accession ?? null,
@@ -12,6 +12,13 @@ export const entityKey = (entity: SupplyEntity) => entity.ticker ? publicTickerK
12
12
  export const entityTicker = (entity: Pick<SupplyEntity, "ticker" | "exchange">) =>
13
13
  entity.ticker && entity.exchange && !isUsListingExchange(entity.exchange) ? getListingSymbol(entity.ticker, entity.exchange) : entity.ticker;
14
14
  export const entityLabel = (entity: SupplyEntity) => entityTicker(entity) ?? entity.name;
15
+ /**
16
+ * A trade link whose every disclosure is a related-party (connected) trade,
17
+ * as the server labels a table row: the graph names it one rather than a
18
+ * plain supplier or customer.
19
+ */
20
+ export const relatedPartyLink = (link: Pick<GraphPayload["links"][number], "relationship" | "evidence">) =>
21
+ link.relationship === "commerce" && link.evidence.length > 0 && link.evidence.every(item => item.relatedParty === true);
15
22
  /**
16
23
  * A route in the direction goods move: a supplier's route ends at the focus
17
24
  * company ("WPM → NEM" for a streamer buying from a miner), a customer's
@@ -22,11 +29,15 @@ export function pathLabel(path: GraphPath, data: GraphPayload) {
22
29
  const labels = path.nodeIds.map(id => nodes.get(id) ? entityLabel(nodes.get(id)!) : id);
23
30
  return (path.id.startsWith("upstream|") ? labels.reverse() : labels).join(" → ");
24
31
  }
32
+ /**
33
+ * "6% est. of A revenue" for a product of shares along a route; one hop's
34
+ * share is the one its report files, "4.5% of A revenue", never an estimate.
35
+ */
25
36
  export function exposureLabel(path: GraphPath, data: GraphPayload) {
26
37
  const exposure = path.exposure;
27
38
  if (!exposure) return "--";
28
39
  const denominator = data.nodes.find(node => node.id === exposure.denominatorEntityId);
29
- return `${Number(exposure.pct.toPrecision(4))}% est. of ${denominator ? entityLabel(denominator) : exposure.denominatorEntityId} ${exposure.basis}`;
40
+ return `${Number(exposure.pct.toPrecision(4))}%${exposure.estimated ? " est." : ""} of ${denominator ? entityLabel(denominator) : exposure.denominatorEntityId} ${exposure.basis}`;
30
41
  }
31
42
  export interface GraphNode { entity: SupplyEntity; column: number; hops: number; path: GraphPath | null; related: boolean; }
32
43
  /** A selected path has priority over other positions so every highlighted hop remains connected. */