@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
@@ -15,10 +15,10 @@ import { useOpenDescription } from "../shared/open-description";
15
15
  import { UpgradeLabel } from "../shared/locked-rows";
16
16
  import { isCloudSessionRequired, useResearchCloudSession } from "../shared/research-cloud-session";
17
17
  import { cachedGraph, graphOptions, loadGraph, validateGraph } from "./graph-client";
18
- import { entityKey, entityLabel, entityTicker, exposureLabel, pathLabel } from "./graph-model";
18
+ import { entityKey, entityLabel, entityTicker, exposureLabel, pathLabel, relatedPartyLink } from "./graph-model";
19
19
  import { SupplyGraph } from "./graph";
20
20
  import { graphEvidenceRow } from "./graph-evidence";
21
- import { disclosedValue, dollars, nativeValue, periodText, ROLE_COLORS, roleLabel, shareParts } from "./model";
21
+ import { disclosedValue, dollars, nativeValue, periodText, relationshipLabel, ROLE_COLORS, roleLabel, shareParts } from "./model";
22
22
  import { SupplySources, SupplyVerification } from "./row-evidence";
23
23
  import { evidenceDate, evidenceLabel, isUnconfirmed, trustTier } from "./trust";
24
24
  import { scrollByLines } from "../../../state/pane-scroll-registry";
@@ -28,7 +28,7 @@ import { displayWidth } from "../../../utils/format";
28
28
  import { useRemoteUiNode } from "../../../remote/semantic-tree";
29
29
  import { logFailure } from "../../../utils/log-failure";
30
30
 
31
- const PATH_COLUMNS: DataTableColumn[] = [{ id: "route", label: "Route", width: 40, align: "left" }, { id: "relationships", label: "Relationships", width: 22, align: "left" }, { id: "hops", label: "Hops", width: 6, align: "right" }, { id: "score", label: "Score", width: 9, align: "right" }, { id: "confidence", label: "Confidence", width: 12, align: "right" }, { id: "exposure", label: "Estimated exposure", width: 35, align: "left" }];
31
+ const PATH_COLUMNS: DataTableColumn[] = [{ id: "route", label: "Route", width: 40, align: "left" }, { id: "relationships", label: "Relationships", width: 22, align: "left" }, { id: "hops", label: "Hops", width: 6, align: "right" }, { id: "score", label: "Score", width: 9, align: "right" }, { id: "confidence", label: "Confidence", width: 12, align: "right" }, { id: "exposure", label: "Exposure", width: 35, align: "left" }];
32
32
  const SOURCE_LABELS = { xbrl: "Structured filing", filing_text: "Filing text", press_release: "Company release", call: "Earnings call", news: "News", web: "Website", import: "Imported record" };
33
33
  const TIER_LABELS = { structured: "Structured", primary: "Primary", secondary: "Secondary", imported: "Imported" };
34
34
 
@@ -68,7 +68,7 @@ function PathEvidence({ data, path, width, focused, onRecenter }: { data: GraphP
68
68
  const figures: StatItem[] = [
69
69
  { id: "score", label: "Path score", value: path.score.toFixed(4) },
70
70
  { id: "confidence", label: "Confidence", value: `${Math.round(path.confidence * 100)}%` },
71
- { id: "exposure", label: "Estimated exposure", value: exposureLabel(path, data), detail: path.exposure ? periodText(path.exposure) : undefined, wide: true },
71
+ { id: "exposure", label: "Exposure", value: exposureLabel(path, data), detail: path.exposure ? periodText(path.exposure) : undefined, wide: true },
72
72
  ];
73
73
  const company = (entity: SupplyEntity) => desktop && entity.ticker ? <Badge label={entityTicker(entity)!} tone="accent" />
74
74
  : <Text fg={entity.aggregate || entity.anonymous ? colors.textDim : colors.textBright} attributes={TextAttributes.BOLD}>{entityLabel(entity)}</Text>;
@@ -89,7 +89,7 @@ function PathEvidence({ data, path, width, focused, onRecenter }: { data: GraphP
89
89
  return <Box key={evidence.id} flexDirection="column" paddingBottom={1}>
90
90
  <Box flexDirection="row" gap={1}><Badge tone={isUnconfirmed(row) ? "neutral" : "accent"} label={evidenceLabel(row)} />
91
91
  {row.leadStatus === "verified" ? <Badge tone="positive" label="Verified" /> : null}</Box>
92
- <KeyValueRow label="Disclosure" value={`${evidence.reporter.name} · ${roleLabel(evidence.role)}`} color={ROLE_COLORS[evidence.role]} labelWidth={20} />
92
+ <KeyValueRow label="Disclosure" value={`${evidence.reporter.name} · ${relationshipLabel(row)}`} color={ROLE_COLORS[evidence.role]} labelWidth={20} />
93
93
  <KeyValueRow label="Evidence class" value={`${TIER_LABELS[evidence.tier]} · ${SOURCE_LABELS[evidence.sourceKind]}`} detail={`${Math.round(evidence.confidence * 100)}% confidence`} labelWidth={20} />
94
94
  <KeyValueRow label="Period" value={periodText(row)} detail={trustTier(row) === 1 ? `filed ${row.filedDate ?? "--"}` : `published ${evidenceDate(row)}`} labelWidth={20} />
95
95
  {row.entityScope === "group" && !row.counterparty.aggregate ? <KeyValueRow label="Metric scope" value="Corporate group" labelWidth={20} /> : null}
@@ -201,11 +201,12 @@ export function SupplyGraphPane({ symbol, tab, width, height, focused }: { symbo
201
201
  </Box> : undefined };
202
202
  }
203
203
  if (column.id === "relationships") {
204
- const relationships = [...new Set(path.linkIds.map(id => data.links.find(link => link.id === id)!.relationship))];
205
- const label = (relationship: typeof relationships[number]) => relationship === "commerce" ? "Trade" : roleLabel(relationship);
204
+ // A related-party trade reads as one: its counterparty is the company's parent, group or a sister company.
205
+ const relationships = [...new Set(path.linkIds.map(id => { const link = data.links.find(entry => entry.id === id)!; return relatedPartyLink(link) ? "related" : link.relationship; }))];
206
+ const label = (relationship: typeof relationships[number]) => relationship === "commerce" ? "Trade" : relationship === "related" ? "Related-party trade" : roleLabel(relationship);
206
207
  return { text: relationships.map(label).join(" / "), content: <Box flexDirection="row" height={1} gap={1} overflow="hidden">
207
208
  {relationships.map(relationship => {
208
- const color = relationship === "commerce" ? colors.textMuted : ROLE_COLORS[relationship];
209
+ const color = relationship === "commerce" || relationship === "related" ? colors.textMuted : ROLE_COLORS[relationship];
209
210
  return <Box key={relationship} flexDirection="row" gap={1} flexShrink={0}>
210
211
  {desktop ? <Box width={1} height={1} alignItems="center" justifyContent="center"><Box style={{ width: 6, height: 6, borderRadius: "50%", backgroundColor: color }} /></Box>
211
212
  : <Text fg={color}>●</Text>}
@@ -5,6 +5,7 @@ import type { ChartVectorShape } from "../../../ui/host";
5
5
  import type { GraphPath, GraphPayload } from "../../../api-client/supply-chain-graph";
6
6
  import type { SupplyEntity, SupplyRole } from "../../../api-client/supply-chain";
7
7
  import { useThemeColors } from "../../../theme/theme-context";
8
+ import { useSelectionFill } from "../../../components/ui/selection-fill";
8
9
  import { useShortcut } from "../../../react/input";
9
10
  import { useScrollBoxLayout } from "../../../components/use-scrollbox-layout";
10
11
  import { isPlainKey } from "../../../utils/keyboard";
@@ -13,7 +14,7 @@ import { ClippedText } from "../../../components/ui/display";
13
14
  import { cardSurfaceStyle } from "../../../components/ui/card";
14
15
  import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
15
16
  import { drawLine, fillOpaque, parseHex } from "../../../components/chart/native/raster/primitives";
16
- import { entityLabel, entityTicker, graphNodes } from "./graph-model";
17
+ import { entityLabel, entityTicker, graphNodes, relatedPartyLink } from "./graph-model";
17
18
  import { ROLE_COLORS } from "./model";
18
19
  import { blendHex } from "../../../theme/colors";
19
20
 
@@ -23,6 +24,9 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
23
24
  }) {
24
25
  const scrollRef = useRef<ScrollBoxRenderable>(null);
25
26
  const colors = useThemeColors(), desktop = !!useUiCapabilities().nativePaneChrome;
27
+ // The chosen card is the graph's cursor: quieter while the pane does not have the keys.
28
+ const selectionFill = useSelectionFill();
29
+ const chosenText = (own: string) => (selectionFill.lit ? colors.selectedText : selectionFill.ink(own));
26
30
  const nodes = useMemo(() => graphNodes(data, collapsed, selectedPath), [data, collapsed, selectedPath]);
27
31
  const [pages, setPages] = useState<Record<number, number>>({});
28
32
  useEffect(() => setPages({}), [data]);
@@ -142,11 +146,13 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
142
146
  const prefix = collapsed.includes(node.entity.id) ? "+ " : "";
143
147
  const name = prefix + (showTicker ? node.entity.name : entityLabel(node.entity));
144
148
  const nameWidth = inner - (showTicker ? tickerWidth : 0);
145
- const relation = kind ?? (node.related ? `${node.hops > 1 ? "via " : ""}${role}` : role);
149
+ // A related-party trade with the company before it on the path reads as one, never as a plain supplier or customer.
150
+ const link = node.path ? data.links.find(entry => entry.id === node.path!.linkIds.at(-1)) : undefined;
151
+ const relation = kind ?? (node.related ? `${node.hops > 1 ? "via " : ""}${role}` : link && relatedPartyLink(link) ? `related-party ${role}` : role);
146
152
  const confidence = `${Math.round((node.path?.confidence ?? 0) * 100)}%`;
147
153
  const detail = node.hops ? `${node.hops}H · ${relation}${inner >= displayWidth(relation ?? "") + 12 ? ` · ${confidence}` : ""}` : showTicker ? "Focus company" : node.entity.name;
148
154
  return <Box key={node.entity.id} position="absolute" left={node.x} top={node.y} width={cellWidth - 3} height={2} zIndex={10} flexDirection="column" overflow="hidden"
149
- backgroundColor={desktop ? undefined : active ? colors.selected : node.hops ? blendHex(colors.bg, accent, 0.12) : colors.panel}
155
+ backgroundColor={desktop ? undefined : active ? selectionFill.bg : node.hops ? blendHex(colors.bg, accent, 0.12) : colors.panel}
150
156
  // The flow's card (flow.tsx): in the relationship's colour, the focus company plain.
151
157
  style={desktop ? { ...cardSurfaceStyle({ selected: active, accent: role ? accent : undefined, padding: "0 0 0 var(--gloom-space-sm)" }), cursor: "pointer" } : undefined}
152
158
  onMouseOver={() => onSelect(node.entity.id)} data-gloom-role="supply-graph-node">
@@ -154,10 +160,10 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
154
160
  <Box flexDirection="column" width="100%">
155
161
  <Box flexDirection="row" height={1} gap={desktop ? 1 : 0} overflow="hidden">
156
162
  {!desktop ? <Text fg={accent}>▍</Text> : null}
157
- <ClippedText fg={active && !desktop ? colors.selectedText : company ? colors.textBright : colors.textDim} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth} />
158
- {showTicker ? desktop ? <Badge label={ticker!} tone="accent" /> : <Text fg={active ? colors.selectedText : colors.textDim}>{` ${ticker}`}</Text> : null}
163
+ <ClippedText fg={active && !desktop ? chosenText(company ? colors.textBright : colors.textDim) : company ? colors.textBright : colors.textDim} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth} />
164
+ {showTicker ? desktop ? <Badge label={ticker!} tone="accent" /> : <Text fg={active ? chosenText(colors.textDim) : colors.textDim}>{` ${ticker}`}</Text> : null}
159
165
  </Box>
160
- <Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden"><ClippedText fg={active && !desktop ? colors.selectedText : colors.textDim} text={detail} width={inner} /></Box>
166
+ <Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden"><ClippedText fg={active && !desktop ? chosenText(colors.textDim) : colors.textDim} text={detail} width={inner} /></Box>
161
167
  </Box>
162
168
  </Button>
163
169
  </Box>;
@@ -7,7 +7,8 @@ import { evidenceDate, evidenceLabel, isUnconfirmed, matchesSupplyOptions, suppl
7
7
  import { fetchSupplyGraph, graphOptions } from "./graph-client";
8
8
  import { entityTicker, exposureLabel, pathLabel } from "./graph-model";
9
9
  import { graphEvidenceRow } from "./graph-evidence";
10
- import { counterpartyName, disclosedValue, disclosureText, earlierRows, isTaggedFact, lockedDisclosures, nativeValue, periodText, roleLabel, shareParts, supplyEmptyText, supplyPreviewNote, supplyRoleCounts } from "./model";
10
+ import { counterpartyKind, counterpartyName, disclosedValue, disclosureText, earlierRows, isRelatedParty, isTaggedFact, lockedDisclosures, nativeValue, periodText, relationshipLabel, shareParts, supplyEmptyText, supplyPreviewNote,
11
+ supplyRoleCounts } from "./model";
11
12
 
12
13
  /**
13
14
  * The Table tab's columns, printed as the pane prints them: the share with
@@ -24,10 +25,14 @@ function tableColumns(rows: HeadlessPaneRow[], sources: ReadonlyMap<HeadlessPane
24
25
  const valued = rows.some((row) => { const source = sources.get(row); return !!source && (nativeValue(source) !== null || source.usd !== null); });
25
26
  const lengths = rows.some((row) => sources.get(row)?.periodMonths != null);
26
27
  return [
27
- { key: "counterparty", header: "Counterparty", format: cell(counterpartyName) },
28
+ // The text names a company with its subsidiaries (X及其子公司) as the group, as the pane's label beside the name does
29
+ // (the Role says whether it is a related party); a cohort or an undisclosed name already says what it is.
30
+ { key: "counterparty", header: "Counterparty", format: cell(counterpartyName),
31
+ textFormat: cell((row) => counterpartyKind(row) === "company" && row.entityScope === "group" ? `${counterpartyName(row)} (group)` : counterpartyName(row)) },
28
32
  { key: "evidenceTier", header: "Evidence" },
29
33
  { key: "ticker", header: "Ticker" },
30
- { key: "role", header: "Role", format: cell((row) => roleLabel(row.role)) },
34
+ // A related-party trade reads as one, never as a plain supplier or customer.
35
+ { key: "role", header: "Role", format: cell(relationshipLabel) },
31
36
  // Exports keep the share a number, what it is a share of beside it in the Table's words ("% of total revenue (gold sales)").
32
37
  { key: "pct", header: "Share", unitKey: "shareUnit", unitColumn: true, format: cell((row) => shareParts(row, focusId)?.value ?? null),
33
38
  textFormat: cell((row) => { const share = shareParts(row, focusId); return share ? `${share.value} ${share.basis}` : null; }) },
@@ -43,7 +48,7 @@ function tableColumns(rows: HeadlessPaneRow[], sources: ReadonlyMap<HeadlessPane
43
48
  const pathColumns = [
44
49
  { key: "route", header: "Route" }, { key: "hops", header: "Hops" },
45
50
  { key: "score", header: "Rank score", description: "Product of normalized edge weights; not a probability." },
46
- { key: "confidence", header: "Confidence" }, { key: "exposureLabel", header: "Estimated exposure" },
51
+ { key: "confidence", header: "Confidence" }, { key: "exposureLabel", header: "Exposure" },
47
52
  ];
48
53
  /**
49
54
  * What a graph disclosure says in words: the text itself, or for a tagged
@@ -82,14 +87,15 @@ function graphReport(data: GraphPayload, target: string): HeadlessBundleResult {
82
87
  sections.push({ title: "Disclosure evidence", columns: [
83
88
  { key: "reporter", header: "Reporting company" }, { key: "from", header: "Supplier / from" }, { key: "to", header: "Customer / to" },
84
89
  // The share in the Table's words, its reporter named ("27% of NEM total revenue (gold sales)"); exports keep pct and denominator apart.
85
- { key: "role", header: "Role" }, { key: "pct", header: "Share", textFormat: (_value, row) => String(row.share ?? "-") },
90
+ { key: "role", header: "Role", textFormat: (value, row) => row.relatedParty ? `related-party ${String(value)}` : String(value) },
91
+ { key: "pct", header: "Share", textFormat: (_value, row) => String(row.share ?? "-") },
86
92
  { key: "period", header: "Period", textFormat: (value, row) => periodText({ period: String(value), periodMonths: row.periodMonths as number | null }) },
87
93
  { key: "filed", header: "Filed" }, { key: "confidence", header: "Confidence" },
88
94
  // A tagged XBRL fact prints the link's filing sentence when one names the same pair, otherwise the fact in words; exports keep the stored text.
89
95
  { key: "quote", header: "Quote", textFormat: (value, row) => row.statement == null ? String(value ?? "") : String(row.statement) }, { key: "filingUrl", header: "Filing" },
90
96
  ], rows: data.links.flatMap(link => link.evidence.map(item => ({ id: item.id, linkId: link.id, primary: item.id === link.primaryEvidenceId,
91
97
  statement: graphStatement(item, link.evidence), share: graphShare(item),
92
- reporter: item.reporter.name, from: item.from.name, to: item.to.name, role: item.role, pct: item.pctOfRevenue ?? null,
98
+ reporter: item.reporter.name, from: item.from.name, to: item.to.name, role: item.role, relatedParty: isRelatedParty(item), pct: item.pctOfRevenue ?? null,
93
99
  denominator: item.pctBasis && !(item.sourceKind === "xbrl" && item.pctScope) ? `${item.reporter.name} ${item.pctBasis}${item.pctScope ? ` (${item.pctScope})` : ""}` : null,
94
100
  pctBasis: item.pctBasis, pctScope: item.pctScope, period: item.period, periodMonths: item.periodMonths ?? null, filed: item.filedDate, asOf: item.asOf,
95
101
  confidence: item.confidence, quote: item.quote, quoteLanguage: item.quoteLanguage, quoteGloss: item.quoteGloss ?? null,
@@ -155,7 +161,7 @@ export const supplyChainHeadless: HeadlessPaneDefinition<"bundle"> = {
155
161
  const record = (row: SupplyRow) => sourced(row, { counterparty: row.counterparty.name, ticker: entityTicker(row.counterparty), aggregate: row.counterparty.aggregate, role: row.role, direction: row.direction,
156
162
  pct: row.pctOfRevenue, shareUnit: shareOf(row), pctBasis: row.pctBasis, pctScope: row.pctScope, usd: row.usd, usdBasis: row.usdBasis, period: row.period, periodMonths: row.periodMonths ?? null, fiscalYear: row.fiscalYear,
157
163
  nativeAmount: row.nativeAmount ?? null, nativeCurrency: row.nativeCurrency ?? null, nativeScale: row.nativeScale ?? null,
158
- jurisdiction: row.jurisdiction ?? null, entityScope: row.entityScope ?? null,
164
+ jurisdiction: row.jurisdiction ?? null, entityScope: row.entityScope ?? null, relatedParty: isRelatedParty(row),
159
165
  evidenceTier: evidenceLabel(row), tier: trustTier(row), claimType: row.claimType, corroboration: row.corroboration ?? 1,
160
166
  leadStatus: row.leadStatus ?? "none", whyUnconfirmed: row.whyUnconfirmed ?? null,
161
167
  firstSeenAt: row.firstSeenAt, lastSeenAt: row.lastSeenAt, lastConfirmedAt: row.lastConfirmedAt,
@@ -1,4 +1,4 @@
1
- import type { SupplyChainPayload, SupplyOptions, SupplyRole, SupplyRow } from "../../../api-client/supply-chain";
1
+ import type { SupplyChainPayload, SupplyEvidenceItem, SupplyOptions, SupplyRole, SupplyRow } from "../../../api-client/supply-chain";
2
2
  import { currentThemeColorSet, SERIES_COLORS } from "../../../theme/series-colors";
3
3
  import { companyNameCase, shortCompanyName } from "../../../tickers/company-name";
4
4
  import { clipToDisplayWidth, displayWidth } from "../../../utils/format";
@@ -33,11 +33,29 @@ export function counterpartyLabel(row: SupplyRow): string {
33
33
  // Cohort labels arrive in title case from XBRL member names; generic words read lower case, names keep theirs.
34
34
  return name.replace(GENERIC_WORDS, (word) => word.toLowerCase()).replace(/^./, (first) => first.toUpperCase());
35
35
  }
36
+ /**
37
+ * A related-party (connected) trade the report prints: the counterparty is
38
+ * the company's parent, its group or a company under the same control. The
39
+ * server labels a row one only when every disclosure behind it is one.
40
+ */
41
+ export const isRelatedParty = (row: Pick<SupplyRow, "relatedParty">) => row.relatedParty === true;
42
+ /** A company and its subsidiaries ("X及其子公司"): the figure is the group's, not X's alone. */
43
+ const namedGroup = (row: SupplyRow) => row.entityScope === "group" && !row.counterparty.aggregate;
44
+ /**
45
+ * What the counterparty is beside its name, the same in the table, the flow
46
+ * and the graph: a cohort group, an undisclosed name, a related party (so a
47
+ * parent's group never reads as a plain supplier or customer), and a company
48
+ * with its subsidiaries as a group. `short` for a narrow column.
49
+ */
36
50
  export const counterpartyKindLabel = (row: SupplyRow, short = false) => {
37
51
  const kind = counterpartyKind(row);
38
- if (short) return kind === "group" ? "group" : kind === "undisclosed" ? "undisclosed" : null;
39
- return kind === "group" ? `${row.role} group` : kind === "undisclosed" ? `undisclosed ${row.role}` : null;
52
+ if (kind === "group") return short ? "group" : `${row.role} group`;
53
+ if (kind === "undisclosed") return short ? "undisclosed" : `undisclosed ${row.role}`;
54
+ if (isRelatedParty(row)) return namedGroup(row) ? short ? "related group" : "related-party group" : "related party";
55
+ return namedGroup(row) ? short ? "group" : "corporate group" : null;
40
56
  };
57
+ /** The relationship in words: "Related-party supplier" for a related-party trade, else the role. */
58
+ export const relationshipLabel = (row: Pick<SupplyRow, "role" | "relatedParty">) => isRelatedParty(row) ? `Related-party ${row.role}` : roleLabel(row.role);
41
59
 
42
60
  /** A filer's segment or product scope in plain words: "Compute And Networking Segment" reads "Compute & Networking". */
43
61
  export function scopeWords(scope: string): string {
@@ -144,8 +162,8 @@ export function counterpartyName(row: SupplyRow): string {
144
162
  }
145
163
  export const roleLabel = (role: SupplyRole) => role[0]!.toUpperCase() + role.slice(1);
146
164
 
147
- /** A listing code that reads as no word: 0700:HKEX, 1211.HK, 7203. */
148
- const numberedListing = (value: string) => /^\d[\dA-Z]*(?:[.:][A-Z]+)?$/i.test(value.trim());
165
+ /** A listing code that reads as no word: 0700:HKEX, 1211.HK, 7203, and on SGX C38U:SGX or D05.SI, whose letters spell none either. */
166
+ const numberedListing = (value: string) => /^\d[\dA-Z]*(?:[.:][A-Z]+)?$/i.test(value.trim()) || /^[A-Z]{1,2}\d[\dA-Z]*[.:](?:SGX|SI)$/i.test(value.trim());
149
167
 
150
168
  /**
151
169
  * The focus company as the direction labels name it ("AAPL says"): its ticker
@@ -236,12 +254,14 @@ export function supplyEmptyText(data: Pick<SupplyChainPayload, "symbol" | "entit
236
254
  const country = /^[A-Z]{2}$/.test(code) ? code : null;
237
255
  const exchange = data.entity?.exchange?.trim().toUpperCase() ?? "";
238
256
  const customerSide = `A customer's filings name its suppliers: try the customer's side, such as ${command("AAPL")}.`;
239
- if (country && FILING_COUNTRIES.has(country)) return `No filing, announcement or call read so far names a relationship for ${data.symbol}.`;
257
+ // Not yet available, never an error: what is read so far names none.
258
+ const none = `Relationships for ${data.symbol} are not yet available:`;
259
+ if (country && FILING_COUNTRIES.has(country)) return `${none} no filing, announcement or call read so far names one.`;
240
260
  if ((country && REPORT_COUNTRIES.has(country)) || REPORT_EXCHANGES.has(exchange)) {
241
- return `No annual report, announcement or call read so far names a relationship for ${data.symbol}. ${customerSide}`;
261
+ return `${none} no annual report, announcement or call read so far names one. ${customerSide}`;
242
262
  }
243
- if (!country) return `No filing, announcement or call read so far names a relationship for ${data.symbol}. ${customerSide}`;
244
- return `No relationship for ${data.symbol}: SPLC reads company filings from the US and Korea and annual reports from Hong Kong, mainland China `
263
+ if (!country) return `${none} no filing, announcement or call read so far names one. ${customerSide}`;
264
+ return `${none} SPLC reads company filings from the US and Korea and annual reports from Hong Kong, mainland China `
245
265
  + `and Singapore, plus announcements and calls, and none read so far names one. ${customerSide}`;
246
266
  }
247
267
 
@@ -253,10 +273,47 @@ export function supplyPreviewNote(data: Pick<SupplyChainPayload, "previewRowsPer
253
273
 
254
274
  export const percentage = (row: SupplyRow) => row.pctOfRevenue === null || trustTier(row) !== 1 || isUnconfirmed(row) || !activeRelationship(row) ? "--" : `${Number(row.pctOfRevenue.toFixed(2))}% ${row.pctScope ? "scoped " : ""}${row.pctBasis ?? ""}`;
255
275
  export const dollars = (row: SupplyRow) => row.usd === null ? "--" : `${row.usdBasis === "derived" ? "≈ " : ""}$${revenueAmount(row.usd)} ${row.usdBasis}`;
256
- const scaleLabel = (scale: number) => scale === 1 ? "" : scale === 1_000 ? " thousand" : scale === 1_000_000 ? " million" : scale === 1_000_000_000 ? " billion" : ` ×${scale.toLocaleString("en-US")}`;
276
+ /** A disclosed scale in words, as the filing prints it: 万元 is ten thousand yuan, 亿元 a hundred million. */
277
+ const SCALE_WORDS: ReadonlyMap<number, string> = new Map([[1, ""], [1_000, " thousand"], [10_000, " ten thousand"], [1_000_000, " million"], [100_000_000, " hundred million"], [1_000_000_000, " billion"]]);
278
+ const scaleLabel = (scale: number) => SCALE_WORDS.get(scale) ?? ` ×${scale.toLocaleString("en-US")}`;
279
+ /** A source value's printed unit as its multiplier: "ten_thousands" (万元) is 10,000. */
280
+ const UNIT_SCALES: Readonly<Record<string, number>> = { units: 1, thousands: 1_000, ten_thousands: 10_000, millions: 1_000_000, hundred_millions: 100_000_000, billions: 1_000_000_000 };
281
+ /** What a source value measures, in words: "related_party_group_purchases" reads "Related-party purchases". */
282
+ export function sourceValueLabel(kind: string | null): string {
283
+ if (!kind) return "Source value";
284
+ const related = /^related_party_(?:group_)?(sales|purchases)$/.exec(kind);
285
+ if (related) return `Related-party ${related[1]}`;
286
+ const words = kind.replace(/_/g, " ").trim();
287
+ return words ? words[0]!.toUpperCase() + words.slice(1) : "Source value";
288
+ }
289
+ /**
290
+ * A source value in its currency and printed unit, as a row's value reads:
291
+ * "26,909,758,882.26 CNY", "12,345 CNY ten thousand", "4.5%". An amount in a
292
+ * unit of a currency takes the row's currency when its own line names none,
293
+ * and is not shown without one: "9,771,378 ten thousand" says nothing.
294
+ */
295
+ export function sourceValueText(item: Pick<SupplyEvidenceItem, "value" | "valueUnit" | "currency">, rowCurrency?: string | null): string | null {
296
+ if (item.value === null) return null;
297
+ const scale = item.valueUnit ? UNIT_SCALES[item.valueUnit] : undefined;
298
+ const amount = printedAmount(item.value, scale);
299
+ if (scale !== undefined) {
300
+ const currency = item.currency || rowCurrency;
301
+ return currency ? `${amount} ${currency}${scaleLabel(scale)}` : null;
302
+ }
303
+ if (item.valueUnit === "percent" || item.valueUnit === "per cent") return `${amount}%`;
304
+ return [amount, item.currency, item.valueUnit].filter(Boolean).join(" ");
305
+ }
306
+ /**
307
+ * An amount as printed, in its unit. One in units of the currency with a
308
+ * fraction is in cents, to two places: a related-party total of
309
+ * 822,340,444.90 never reads 822,340,444.9.
310
+ */
311
+ function printedAmount(value: number, scale: number | undefined): string {
312
+ return value.toLocaleString("en-US", { maximumFractionDigits: 12, minimumFractionDigits: scale === 1 && !Number.isInteger(value) ? 2 : 0 });
313
+ }
257
314
  /** Retain the original currency and disclosed scale; never imply an FX conversion. */
258
315
  export const nativeValue = (row: SupplyRow) => row.nativeAmount == null || !row.nativeCurrency || !row.nativeScale ? null
259
- : `${row.nativeAmount.toLocaleString("en-US", { maximumFractionDigits: 12 })} ${row.nativeCurrency}${scaleLabel(row.nativeScale)}`;
316
+ : `${printedAmount(row.nativeAmount, row.nativeScale)} ${row.nativeCurrency}${scaleLabel(row.nativeScale)}`;
260
317
  export const disclosedValue = (row: SupplyRow) => nativeValue(row) ?? dollars(row);
261
318
  const QUOTE_LANGUAGES: Record<string, string> = { ko: "Korean", ja: "Japanese", zh: "Chinese", "zh-TW": "Chinese", "zh-Hant": "Chinese", "zh-Hans": "Chinese", en: "English" };
262
319
  export const quoteLanguageLabel = (row: Pick<SupplyRow, "quoteLanguage">) => QUOTE_LANGUAGES[row.quoteLanguage ?? ""] ?? row.quoteLanguage ?? "original language";
@@ -31,7 +31,7 @@ import { SupplyFlow } from "./flow";
31
31
  import { SupplyGraphPane } from "./graph-pane";
32
32
  import { entityTicker } from "./graph-model";
33
33
  import {
34
- cellText, counterpartyKind, counterpartyKindLabel, counterpartyLabel, counterpartyName, disclosedValue, earlierRows, fitShareBasis, focusCompanyLabel, focusCompanyName, receivablesConcentration, lockedDisclosures, nativeValue, percentage, ROLE_COLORS, roleLabel,
34
+ cellText, counterpartyKind, counterpartyKindLabel, counterpartyLabel, counterpartyName, disclosedValue, earlierRows, fitShareBasis, focusCompanyLabel, focusCompanyName, receivablesConcentration, lockedDisclosures, nativeValue, percentage, relationshipLabel, ROLE_COLORS, roleLabel,
35
35
  periodDate, shareParts, sortRows, supplyEmptyText, supplyPreviewNote, supplyRoleCounts, type SupplySort,
36
36
  } from "./model";
37
37
  import { RowEvidence } from "./row-evidence";
@@ -97,7 +97,9 @@ function tableColumns(width: number, desktop: boolean, locked: boolean, valueWid
97
97
  // Wide enough for the longest whole wording beside its bar and figure ("27% of total revenue (gold sales)"), within a cap;
98
98
  // a narrow pane keeps its 26 cells, so the name keeps its room and the share reads its shorter basis.
99
99
  const whole = Math.max(0, ...bases.map((forms) => forms[0]!));
100
- const shareWidth = Math.max(wide ? 34 : medium ? 30 : 26, Math.min(wide ? 64 : medium ? 52 : 26, (wide ? 8 : 5) + SHARE_FIGURE_CELLS + 2 + whole));
100
+ // With no share on any row (a related-party table states amounts, not shares) the column keeps its header and the names take the room.
101
+ const shareWidth = !bases.length ? SHARE_BAR_MIN_CELLS + 1
102
+ : Math.max(wide ? 34 : medium ? 30 : 26, Math.min(wide ? 64 : medium ? 52 : 26, (wide ? 8 : 5) + SHARE_FIGURE_CELLS + 2 + whole));
101
103
  const share: DataTableColumn = { id: "pct", label: "Share", width: shareWidth, align: "left" };
102
104
  let columns: DataTableColumn[] = [
103
105
  name,
@@ -298,8 +300,8 @@ function SupplyView({ symbol, listingName, width, height, focused }: Pick<PanePr
298
300
  case "corroboration": return { text: String(row.corroboration ?? 1), value: row.corroboration ?? 1, color: colors.textDim, content: <Text fg={colors.textDim}>{row.corroboration ?? 1}</Text> };
299
301
  case "name": {
300
302
  const company = counterpartyKind(row) === "company";
301
- // The kind label never gives way to a long cohort name; a column too narrow for the name says it in one word.
302
- // The desktop always says it in one word: the Role column beside it names the role, and the name takes the room.
303
+ // The kind label never gives way to a long cohort name; a column too narrow for the name says it in its short form.
304
+ // The desktop always says it short ("group", "related group"): the Role column beside it names the role, and the name takes the room.
303
305
  const full = counterpartyKindLabel(row);
304
306
  const kind = !desktop && full && displayWidth(counterpartyLabel(row)) + displayWidth(full) + 4 <= column.width ? full : counterpartyKindLabel(row, true);
305
307
  const ticker = !columns.some((entry) => entry.id === "ticker") ? entityTicker(row.counterparty) : null;
@@ -316,7 +318,8 @@ function SupplyView({ symbol, listingName, width, height, focused }: Pick<PanePr
316
318
  if (!ticker) return { text: "", value: null };
317
319
  return { text: ticker, color: colors.textBright, content: desktop ? <Badge label={ticker} tone="accent" /> : undefined };
318
320
  }
319
- case "role": return { text: roleLabel(row.role), content: <Box flexDirection="row" height={1} overflow="hidden">
321
+ // The text a copy or export reads names a related party; the cell draws the role beside the name's chip.
322
+ case "role": return { text: relationshipLabel(row), content: <Box flexDirection="row" height={1} overflow="hidden">
320
323
  <Text fg={ROLE_COLORS[row.role]}>●</Text>
321
324
  <Text fg={ink ?? ROLE_COLORS[row.role]}>{` ${roleLabel(row.role)}`}</Text>
322
325
  </Box> };
@@ -349,7 +352,7 @@ function SupplyView({ symbol, listingName, width, height, focused }: Pick<PanePr
349
352
  const flowFigures = bodyHeight < 26 ? figures.slice(0, flowFigureColumns) : figures;
350
353
  const selectedShare = selected ? shareParts(selected, focusId) : null;
351
354
  const flowMeta = selected ? `${entityTicker(selected.reportingEntity) ?? selected.reportingEntity.name} ${evidenceLabel(selected)} · ${selectedShare ? `${selectedShare.value} ${selectedShare.basis}`
352
- : nativeValue(selected) !== null || selected.usd !== null ? disclosedValue(selected) : `${roleLabel(selected.role)}, no figure disclosed`}` : undefined;
355
+ : nativeValue(selected) !== null || selected.usd !== null ? disclosedValue(selected) : `${relationshipLabel(selected)}, no figure disclosed`}` : undefined;
353
356
  return <Box width={width} height={height} flexDirection="column">
354
357
  {strip}
355
358
  <PaneStatusBody loading={!data && resource.loading} error={!data && resource.error !== SUPPLY_UNAVAILABLE ? resource.error : null}
@@ -6,7 +6,7 @@ import { scrollByLines } from "../../../state/pane-scroll-registry";
6
6
  import { useThemeColors } from "../../../theme/theme-context";
7
7
  import { Box, Text, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
8
8
  import { isPlainKey } from "../../../utils/keyboard";
9
- import { counterpartyKind, counterpartyKindLabel, disclosedValue, disclosureText, dollars, isTaggedFact, nativeValue, periodText, ROLE_COLORS, roleLabel, shareParts, sourceLabel } from "./model";
9
+ import { counterpartyKind, disclosedValue, disclosureText, dollars, isTaggedFact, nativeValue, periodText, relationshipLabel, ROLE_COLORS, shareParts, sourceLabel, sourceValueLabel, sourceValueText } from "./model";
10
10
  import { canShowQuote, corroborationLabel, evidenceDate, evidenceLabel, isUnconfirmed, tierLabel } from "./trust";
11
11
  import { DisclosureQuote } from "./disclosure-quote";
12
12
 
@@ -42,7 +42,7 @@ export function SupplySources({ row, width, onOpenSource }: { row: SupplyRow; wi
42
42
  <KeyValueRow label="Publisher" value={item.publisher} detail={item.publishedAt.slice(0, 10)} labelWidth={20} />
43
43
  <KeyValueRow label="Evidence" value={tierLabel(item.tier)} detail={item.status !== "active" ? item.status : item.textOrigin === "asr" ? "Speech transcript" : undefined} labelWidth={20} />
44
44
  {item.verificationStatus === "lead" ? <KeyValueRow label="Verification" value="Unconfirmed supporting item" labelWidth={20} /> : null}
45
- {item.value !== null ? <KeyValueRow label={item.valueKind ?? "Source value"} value={`${item.value.toLocaleString("en-US")} ${[item.currency, item.valueUnit].filter(Boolean).join(" ")}`} labelWidth={20} /> : null}
45
+ {sourceValueText(item, row.nativeCurrency) ? <KeyValueRow label={sourceValueLabel(item.valueKind)} value={sourceValueText(item, row.nativeCurrency)!} labelWidth={20} /> : null}
46
46
  {canShowQuote(item) && item.quote ? <DisclosureQuote role={row.role} quote={item.quote} quoteLanguage={item.quoteLanguage} width={width} /> : <KeyValueRow label="Quotation" value={item.textOrigin === "snippet" ? "Original text not verified" : "Link only"} labelWidth={20} />}
47
47
  {canShowQuote(item) && item.englishGloss ? <SourceGloss text={item.englishGloss} width={width} /> : null}
48
48
  {sourceLink(item.url, "Open source")}
@@ -76,7 +76,7 @@ export function RowEvidence({ row, focusId, width, height, focused }: { row: Sup
76
76
  { id: "published", label: "Published", value: evidenceDate(row), detail: evidenceLabel(row) },
77
77
  { id: "confidence", label: "Confidence", value: `${Math.round(row.confidence * 100)}%` },
78
78
  ];
79
- const kind = counterpartyKindLabel(row);
79
+ const kind = counterpartyKind(row);
80
80
  return <Box width={width} height={desktop ? undefined : height} flexGrow={1} flexBasis={0} minHeight={0}>
81
81
  <DetailScrollBody ref={scrollRef} resetScrollKey={row.id}>
82
82
  <StatGrid items={figures} width={width} />
@@ -85,8 +85,8 @@ export function RowEvidence({ row, focusId, width, height, focused }: { row: Sup
85
85
  <Box flexDirection="row" gap={1}><Badge tone={isUnconfirmed(row) ? "neutral" : "accent"} label={evidenceLabel(row)} />
86
86
  {row.leadStatus === "verified" ? <Badge tone="positive" label="Verified" /> : null}</Box>
87
87
  <KeyValueRow label="Reporting company" value={row.reportingEntity.name} labelWidth={20} />
88
- <KeyValueRow label="Relationship" value={`${roleLabel(row.role)} · ${row.direction === "in" ? "inbound" : row.direction === "out" ? "outbound" : "mutual"}`} color={ROLE_COLORS[row.role]} labelWidth={20} />
89
- {kind ? <KeyValueRow label="Counterparty type" value={counterpartyKind(row) === "group" ? row.entityScope === "group" ? "Named corporate group" : "Aggregate concentration group" : "Undisclosed by the filer"} labelWidth={20} /> : null}
88
+ <KeyValueRow label="Relationship" value={`${relationshipLabel(row)} · ${row.direction === "in" ? "inbound" : row.direction === "out" ? "outbound" : "mutual"}`} color={ROLE_COLORS[row.role]} labelWidth={20} />
89
+ {kind !== "company" ? <KeyValueRow label="Counterparty type" value={kind === "group" ? row.entityScope === "group" ? "Named corporate group" : "Aggregate concentration group" : "Undisclosed by the filer"} labelWidth={20} /> : null}
90
90
  {row.entityScope === "group" && !row.counterparty.aggregate ? <KeyValueRow label="Metric scope" value="Corporate group" labelWidth={20} /> : null}
91
91
  {native && row.usd !== null ? <KeyValueRow label="USD amount" value={dollars(row)} labelWidth={20} /> : null}
92
92
  <SupplyVerification row={row} />
@@ -313,6 +313,8 @@ function ThirteenFBrowserPane({ focused, width, height, onDetailChange }: PanePr
313
313
  onBodyScrollActivity={loadMoreFromScroll}
314
314
  resetScrollKey={`${browserMode}:${query}`}
315
315
  columns={columns}
316
+ // Performance adds the quarters' returns in time order after the fund's columns.
317
+ columnReorder={browserMode === "performance" ? false : undefined}
316
318
  items={sortedRows}
317
319
  sortColumnId={browserSort.columnId}
318
320
  sortDirection={browserSort.direction}
@@ -5,6 +5,7 @@ import { areNearbyFinancialPeriodEnds, fillDate, fillDateText, statementPeriodMo
5
5
  import { formatPerShareNumber } from "../../../../utils/reported-money";
6
6
  import { hasNonIncomeStatementGap } from "../../../../utils/statement-gaps";
7
7
  import {
8
+ displayWidth,
8
9
  formatGrowthShort,
9
10
  formatNumber,
10
11
  formatWithDivisor,
@@ -32,7 +33,7 @@ export function hasStatementFinancials(financials: TickerFinancials | null | und
32
33
  type FinancialMetricFormat = "compact" | "eps" | "percent";
33
34
  export type FinancialGrowthDirection = "higher" | "lower" | "neutral";
34
35
 
35
- export type MetricDef = {
36
+ type MetricDef = {
36
37
  label: string;
37
38
  key?: keyof FinancialStatement;
38
39
  id?: string;
@@ -92,7 +93,7 @@ export type FinancialTableRow =
92
93
  toggleable: boolean;
93
94
  };
94
95
 
95
- export function statementMetricValue(
96
+ function statementMetricValue(
96
97
  def: Pick<MetricDef, "key" | "compute">,
97
98
  statement: FinancialStatement,
98
99
  ): number | undefined {
@@ -100,6 +101,12 @@ export function statementMetricValue(
100
101
  return typeof value === "number" && Number.isFinite(value) ? value : undefined;
101
102
  }
102
103
 
104
+ /** The figure a row shows for a period: a group's summary line, or the row's own. */
105
+ export function financialCellValue(row: FinancialTableRow, statement: FinancialStatement): number | undefined {
106
+ if (row.kind === "group") return row.summaryKey ? statement[row.summaryKey] as number | undefined : undefined;
107
+ return statementMetricValue(row, statement);
108
+ }
109
+
103
110
  export const FINANCIAL_COL_W = 18;
104
111
  export const FINANCIAL_LABEL_W = 28;
105
112
  const FINANCIAL_LABEL_MIN_W = 12;
@@ -114,8 +121,22 @@ const FINANCIAL_LABEL_MIN_W = 12;
114
121
  export function financialLabelWidth(width: number): number {
115
122
  return Math.max(FINANCIAL_LABEL_MIN_W, Math.min(FINANCIAL_LABEL_W, width - FINANCIAL_COL_W - 6));
116
123
  }
124
+ /** The growth after a period's value: a blank and up to six characters (`+466%`, `<-99T%`). */
117
125
  const FINANCIAL_GROWTH_W = 7;
118
- const FINANCIAL_VALUE_W = FINANCIAL_COL_W - FINANCIAL_GROWTH_W;
126
+
127
+ /**
128
+ * A terminal period column as wide as the widest value it shows and the growth
129
+ * after it, or its header where that is wider. A fixed 18 left a short value
130
+ * further from its own column's edge than from its growth, so each pair read
131
+ * tight and the next period far off, and fewer periods fit.
132
+ */
133
+ export function financialPeriodWidth(values: Iterable<string>, headers: Iterable<string>): number {
134
+ let value = 0;
135
+ for (const text of values) value = Math.max(value, displayWidth(text));
136
+ let header = 0;
137
+ for (const text of headers) header = Math.max(header, displayWidth(text));
138
+ return Math.max(value + FINANCIAL_GROWTH_W, header);
139
+ }
119
140
 
120
141
  export function computeGrowth(current: number | undefined, previous: number | undefined): number | undefined {
121
142
  if (current == null || previous == null || !Number.isFinite(current) || !Number.isFinite(previous) || previous === 0) return undefined;
@@ -182,10 +203,11 @@ export function semanticGrowthValue(
182
203
  return growth;
183
204
  }
184
205
 
185
- export function formatFinancialCell(value: string, growth: number | undefined) {
206
+ /** A period's value and its growth laid out in a column `width` cells wide, the growth against its right edge. */
207
+ export function formatFinancialCell(value: string, growth: number | undefined, width = FINANCIAL_COL_W) {
186
208
  const growthText = growth != null && Number.isFinite(growth) ? formatFinancialGrowth(growth) : "";
187
209
  return {
188
- valueText: padTo(value, FINANCIAL_VALUE_W, "right"),
210
+ valueText: padTo(value, Math.max(0, width - FINANCIAL_GROWTH_W), "right"),
189
211
  growthText: padTo(growthText ? ` ${growthText}` : "", FINANCIAL_GROWTH_W, "right"),
190
212
  };
191
213
  }
@@ -461,7 +483,7 @@ export function shareFinancialUnit<T extends { unitLabel: string; label: string;
461
483
  export function buildFinancialRows(
462
484
  defs: FinancialRowDef[],
463
485
  statements: FinancialStatement[],
464
- collapsedGroups: Set<string>,
486
+ collapsedGroups: ReadonlySet<string>,
465
487
  depth = 0,
466
488
  ): FinancialTableRow[] {
467
489
  const rows: FinancialTableRow[] = [];
@@ -9,7 +9,7 @@ import {
9
9
  import { useAssetData } from "../../../runtime";
10
10
  import { colors, priceColor } from "../../../../theme/colors";
11
11
  import type { PricePoint } from "../../../../types/financials";
12
- import { padTo } from "../../../../utils/format";
12
+ import { displayWidth, padTo } from "../../../../utils/format";
13
13
  import { useBoundTicker, useTickerRequest } from "../../shared/ticker-request";
14
14
  import type { FinancialTableStatement } from "./aggregation";
15
15
  import { FINANCIAL_COL_W, financialLabelWidth } from "./model";
@@ -29,6 +29,28 @@ export type RatioTableColumn = DataTableColumn & (
29
29
 
30
30
  const ratioRowKey = (row: RatioTableRow) => row.id;
31
31
 
32
+ /**
33
+ * A ratio's name in the metric column, after its disclosure, a cell apart: as wide as it says
34
+ * (`contentWidth`), so the table fits the column to it whole. The desktop draws the disclosure as a
35
+ * path, not a glyph.
36
+ */
37
+ export function ratioNameCell(
38
+ row: Extract<RatioTableRow, { kind: "ratio" }>,
39
+ color: string,
40
+ ): Pick<DataTableCell, "text" | "contentWidth" | "content"> {
41
+ const text = `${row.expanded ? "▾" : "▸"} ${row.label}`;
42
+ return {
43
+ text,
44
+ contentWidth: displayWidth(text),
45
+ content: (
46
+ <Box flexDirection="row" alignItems="center" gap={1}>
47
+ <DisclosureMarker expanded={row.expanded} color={color} />
48
+ <Text fg={color}>{row.label}</Text>
49
+ </Box>
50
+ ),
51
+ };
52
+ }
53
+
32
54
  export interface PeriodEndHistoryState {
33
55
  data: PricePoint[] | undefined;
34
56
  loading: boolean;
@@ -102,15 +124,8 @@ export function RatioTable({
102
124
  return { text: ` ${row.unitLabel}`, color: colors.textDim };
103
125
  }
104
126
  return {
105
- text: `${row.expanded ? "▾" : "▸"} ${row.label}`,
127
+ ...ratioNameCell(row, colors.text),
106
128
  color: colors.text,
107
- // The desktop draws the disclosure as a path, not a glyph.
108
- content: (
109
- <Box flexDirection="row" alignItems="center" gap={1}>
110
- <DisclosureMarker expanded={row.expanded} color={colors.text} />
111
- <Text fg={colors.text}>{row.label}</Text>
112
- </Box>
113
- ),
114
129
  onMouseDown: (event) => {
115
130
  event.preventDefault?.();
116
131
  event.stopPropagation?.();
@@ -146,6 +161,8 @@ export function RatioTable({
146
161
  headerScrollId={headerScrollId}
147
162
  bodyScrollId={bodyScrollId}
148
163
  columns={columns}
164
+ // The statements' fiscal periods: an axis, not columns to arrange.
165
+ columnReorder={false}
149
166
  items={rows}
150
167
  selection={{
151
168
  kind: "id",