@gloom-sh/terminal 0.19.5 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/LICENSE +0 -4
  2. package/package.json +6 -5
  3. package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
  4. package/patches/electrobun-devkit@2.0.5.patch +148 -0
  5. package/src/api-client/bond-trades.ts +59 -0
  6. package/src/api-client/data.ts +21 -0
  7. package/src/api-client/equity-screener.ts +23 -0
  8. package/src/api-client/index.ts +2 -0
  9. package/src/api-client/types/account.ts +86 -0
  10. package/src/api-client/types/assist.ts +32 -0
  11. package/src/api-client/types/auth.ts +63 -0
  12. package/src/api-client/types/billing.ts +54 -0
  13. package/src/api-client/types/chat.ts +180 -0
  14. package/src/api-client/types/congress.ts +107 -0
  15. package/src/api-client/types/credit.ts +110 -0
  16. package/src/api-client/types/econ.ts +158 -0
  17. package/src/api-client/types/equity-diagnostic.ts +73 -0
  18. package/src/api-client/types/filings-and-calls.ts +350 -0
  19. package/src/api-client/types/index.ts +25 -0
  20. package/src/api-client/types/jobs.ts +147 -0
  21. package/src/api-client/types/market.ts +122 -0
  22. package/src/api-client/types/news.ts +91 -0
  23. package/src/api-client/types/notes-and-theses.ts +172 -0
  24. package/src/api-client/types/quotes.ts +28 -0
  25. package/src/api-client/types/scanners.ts +125 -0
  26. package/src/api-client/types/screener.ts +65 -0
  27. package/src/api-client/types/search.ts +107 -0
  28. package/src/api-client/types/sync.ts +14 -0
  29. package/src/api-client/types/team-collections.ts +43 -0
  30. package/src/api-client/types/team-views.ts +32 -0
  31. package/src/api-client/types/teams.ts +135 -0
  32. package/src/api-client/types/ticker-data.ts +57 -0
  33. package/src/api-client/types/tweets.ts +59 -0
  34. package/src/api-client/types/world-venues.ts +23 -0
  35. package/src/app/pane-runtime/index.tsx +2 -0
  36. package/src/app/pane-runtime/plugin-bindings.ts +10 -1
  37. package/src/app/runtime/desktop-deeplink.ts +41 -6
  38. package/src/app/star-prompt/status-line.tsx +1 -1
  39. package/src/app.tsx +64 -23
  40. package/src/architecture/ui-tokens-allowlist.json +0 -8
  41. package/src/cli/commands/market.ts +149 -10
  42. package/src/cli/commands/search.ts +21 -3
  43. package/src/cli/commands/ticker.ts +90 -36
  44. package/src/cli/desktop-pane-shot-browser.ts +69 -3
  45. package/src/cli/glossary.ts +3 -3
  46. package/src/cli/known-gaps.ts +8 -0
  47. package/src/cli/listing-arg.ts +12 -0
  48. package/src/cli/pane-functions/capabilities.ts +2 -0
  49. package/src/cli/pane-functions/catalog.ts +25 -5
  50. package/src/cli/pane-functions/function-help.ts +8 -5
  51. package/src/cli/pane-functions/headless.ts +4 -3
  52. package/src/cli/pane-functions/resolver.ts +75 -2
  53. package/src/cli/quote-answer.ts +9 -0
  54. package/src/cli/symbol-list.ts +54 -2
  55. package/src/cli/symbol-rows.ts +14 -2
  56. package/src/cli/ticker-resolution.ts +89 -20
  57. package/src/components/chart/composite/axis-overlays.tsx +60 -27
  58. package/src/components/chart/composite/composite-chart.tsx +118 -63
  59. package/src/components/chart/composite/cursor-source.ts +111 -0
  60. package/src/components/chart/composite/format.ts +168 -6
  61. package/src/components/chart/composite/legend.tsx +8 -4
  62. package/src/components/chart/composite/panel-labels.ts +20 -1
  63. package/src/components/chart/composite/panel-surface.tsx +201 -92
  64. package/src/components/chart/composite/price-axis-labels.tsx +92 -46
  65. package/src/components/chart/composite/price-series.ts +31 -8
  66. package/src/components/chart/composite/scene.ts +154 -59
  67. package/src/components/chart/composite/series-axis-tags.tsx +4 -2
  68. package/src/components/chart/composite/time-axis.ts +13 -5
  69. package/src/components/chart/composite/time-scale.ts +211 -56
  70. package/src/components/chart/composite/types.ts +11 -1
  71. package/src/components/chart/composite/use-composite-chart-keyboard.ts +43 -14
  72. package/src/components/chart/curve/curve-surface.tsx +5 -2
  73. package/src/components/chart/curve/model.ts +4 -1
  74. package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
  75. package/src/components/chart/static/series.ts +3 -0
  76. package/src/components/command-bar/commands/collection-list.ts +81 -0
  77. package/src/components/command-bar/commands/direct/index.ts +6 -0
  78. package/src/components/command-bar/commands/registry.ts +8 -0
  79. package/src/components/command-bar/layout-items/current-layout.ts +22 -1
  80. package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
  81. package/src/components/command-bar/pane-templates/items.ts +19 -3
  82. package/src/components/command-bar/pane-templates/workflow.ts +5 -0
  83. package/src/components/command-bar/routes/root/results.ts +23 -3
  84. package/src/components/command-bar/routes/root/selection.ts +4 -2
  85. package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
  86. package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
  87. package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
  88. package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
  89. package/src/components/command-bar/surface/environment.ts +2 -0
  90. package/src/components/command-bar/view-model.ts +7 -0
  91. package/src/components/command-bar/workflow/ops.ts +2 -1
  92. package/src/components/command-bar/workflow/tickers.ts +20 -0
  93. package/src/components/data-table/export.ts +4 -1
  94. package/src/components/layout/detached-pane-shell.tsx +10 -37
  95. package/src/components/layout/double-escape-close.ts +90 -0
  96. package/src/components/layout/header.tsx +3 -2
  97. package/src/components/layout/market-summary.ts +6 -3
  98. package/src/components/layout/pane/footer/index.tsx +2 -6
  99. package/src/components/layout/pane/footer/model.ts +6 -12
  100. package/src/components/layout/shell/active-drag.ts +53 -11
  101. package/src/components/layout/shell/drag/magnets.ts +128 -19
  102. package/src/components/layout/shell/menu.ts +15 -1
  103. package/src/components/layout/shell/pane/actions.ts +10 -2
  104. package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
  105. package/src/components/layout/shell/ticker-link-menu.ts +12 -3
  106. package/src/components/layout/status-bar.tsx +24 -78
  107. package/src/components/layout/status-widget-space.ts +5 -5
  108. package/src/components/onboarding/onboarding-keyboard.ts +5 -1
  109. package/src/components/onboarding/onboarding-wizard.tsx +15 -4
  110. package/src/components/onboarding/portfolio-step/positions-panel.tsx +9 -6
  111. package/src/components/onboarding/use-onboarding-progress.ts +20 -1
  112. package/src/components/price-sparkline/view.tsx +14 -6
  113. package/src/components/ticker/badge/index.tsx +8 -4
  114. package/src/components/ticker/badge/list.tsx +23 -7
  115. package/src/components/ui/column-grid.tsx +8 -2
  116. package/src/components/ui/data-table/index.tsx +5 -1
  117. package/src/components/ui/data-table/opentui/model.ts +4 -1
  118. package/src/components/ui/data-table/render-cell.ts +19 -0
  119. package/src/components/ui/delayed-mark.tsx +59 -7
  120. package/src/components/ui/icon.tsx +1 -8
  121. package/src/components/ui/menu.tsx +6 -1
  122. package/src/components/ui/tabs.tsx +5 -2
  123. package/src/core/state/app/layout.ts +18 -3
  124. package/src/core/state/app/state.ts +2 -0
  125. package/src/core/state/app/types.ts +5 -0
  126. package/src/data/config/layout.ts +3 -0
  127. package/src/data/config/store/normalize.ts +39 -4
  128. package/src/i18n/es.ts +13 -3
  129. package/src/i18n/ja.ts +13 -3
  130. package/src/i18n/ko.ts +13 -3
  131. package/src/i18n/zh-cn.ts +13 -3
  132. package/src/i18n/zh-tw.ts +13 -3
  133. package/src/layout/pane-manager/floating-placement.ts +7 -4
  134. package/src/layout/pane-manager/floating.ts +5 -2
  135. package/src/market-data/bond-funds.ts +19 -0
  136. package/src/market-data/futures-contract.ts +14 -3
  137. package/src/market-data/market/freshness.ts +18 -0
  138. package/src/market-data/market/status.ts +15 -2
  139. package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
  140. package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
  141. package/src/plugins/builtin/bond-calculator/model.ts +14 -5
  142. package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
  143. package/src/plugins/builtin/buildout/cells.tsx +25 -45
  144. package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
  145. package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
  146. package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
  147. package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
  148. package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
  149. package/src/plugins/builtin/buildout/format.ts +23 -1
  150. package/src/plugins/builtin/buildout/model/types.ts +1 -0
  151. package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
  152. package/src/plugins/builtin/buildout/table-model.ts +12 -4
  153. package/src/plugins/builtin/cds/headless.ts +1 -0
  154. package/src/plugins/builtin/cds/index.tsx +1 -1
  155. package/src/plugins/builtin/chat/content/composer.tsx +21 -27
  156. package/src/plugins/builtin/chat/content/index.tsx +31 -3
  157. package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
  158. package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
  159. package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
  160. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  161. package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
  162. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
  163. package/src/plugins/builtin/congress-trades/model.ts +2 -1
  164. package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
  165. package/src/plugins/builtin/correlation/headless.ts +3 -2
  166. package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
  167. package/src/plugins/builtin/custom-view/index.tsx +1 -1
  168. package/src/plugins/builtin/custom-view/loader.ts +85 -8
  169. package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
  170. package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
  171. package/src/plugins/builtin/debt-maturities/model.ts +66 -0
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
  173. package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
  174. package/src/plugins/builtin/econ/calendar-model.ts +28 -6
  175. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  176. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
  177. package/src/plugins/builtin/equity-screener/headless.ts +37 -3
  178. package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
  179. package/src/plugins/builtin/equity-screener/model.ts +238 -27
  180. package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
  181. package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
  182. package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
  183. package/src/plugins/builtin/executives/format.ts +5 -4
  184. package/src/plugins/builtin/executives/pane.tsx +1 -1
  185. package/src/plugins/builtin/futures-curve/client.ts +19 -0
  186. package/src/plugins/builtin/futures-curve/headless.ts +52 -13
  187. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  188. package/src/plugins/builtin/futures-curve/model.ts +77 -6
  189. package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
  190. package/src/plugins/builtin/help/index.tsx +55 -1
  191. package/src/plugins/builtin/insider/model.ts +30 -2
  192. package/src/plugins/builtin/jobs/model.ts +2 -2
  193. package/src/plugins/builtin/macro-day/client.ts +41 -0
  194. package/src/plugins/builtin/macro-day/headless.ts +19 -9
  195. package/src/plugins/builtin/macro-day/model.ts +3 -1
  196. package/src/plugins/builtin/market-movers/index.tsx +4 -3
  197. package/src/plugins/builtin/mna/distress/headless.ts +1 -0
  198. package/src/plugins/builtin/mna/model.ts +2 -2
  199. package/src/plugins/builtin/notes/files.ts +2 -0
  200. package/src/plugins/builtin/notes/owner.tsx +20 -1
  201. package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
  202. package/src/plugins/builtin/notes/store.ts +6 -1
  203. package/src/plugins/builtin/perps/pane.tsx +3 -1
  204. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
  205. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
  206. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
  207. package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
  208. package/src/plugins/builtin/rate-path/headless.ts +24 -10
  209. package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
  210. package/src/plugins/builtin/research/event-model.ts +10 -3
  211. package/src/plugins/builtin/research/events-headless.ts +20 -2
  212. package/src/plugins/builtin/sec/fund-facts.ts +17 -1
  213. package/src/plugins/builtin/sec/index.tsx +1 -1
  214. package/src/plugins/builtin/series-inventory.ts +1 -0
  215. package/src/plugins/builtin/shared/earnings-report.ts +7 -2
  216. package/src/plugins/builtin/shared/members-menu.tsx +103 -38
  217. package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
  218. package/src/plugins/builtin/short-interest/headless.ts +1 -1
  219. package/src/plugins/builtin/short-interest/model.ts +15 -6
  220. package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
  221. package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
  222. package/src/plugins/builtin/short-interest/types.ts +2 -0
  223. package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
  224. package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
  225. package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
  226. package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
  227. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
  228. package/src/plugins/builtin/time-sales/pane.tsx +3 -2
  229. package/src/plugins/builtin/trace-bonds/client.ts +7 -4
  230. package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
  231. package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
  232. package/src/plugins/builtin/trace-bonds/history.ts +155 -0
  233. package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
  234. package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
  235. package/src/plugins/builtin/volatility/client.ts +6 -1
  236. package/src/plugins/builtin/volatility/headless.ts +0 -1
  237. package/src/plugins/builtin/yield-curve/curves.ts +15 -0
  238. package/src/plugins/builtin/yield-curve/headless.ts +6 -1
  239. package/src/plugins/builtin/yield-curve/index.tsx +5 -8
  240. package/src/plugins/host-modules.ts +22 -3
  241. package/src/plugins/host-smoke.ts +6 -3
  242. package/src/plugins/installer.ts +16 -3
  243. package/src/plugins/plugin-names.ts +11 -2
  244. package/src/portfolio/collection-name.ts +19 -0
  245. package/src/remote/controller.ts +9 -2
  246. package/src/remote/schema.ts +2 -1
  247. package/src/renderers/browser/http-proxy-transport.ts +78 -8
  248. package/src/renderers/cloudflare/http-proxy.ts +73 -3
  249. package/src/renderers/cloudflare/proxy-session.ts +47 -24
  250. package/src/renderers/cloudflare/worker.ts +44 -4
  251. package/src/renderers/desktop/geometry.ts +279 -0
  252. package/src/renderers/desktop/screen-setup.ts +246 -0
  253. package/src/renderers/desktop/sequential-window-host.ts +179 -0
  254. package/src/renderers/desktop/test-utils.ts +71 -0
  255. package/src/renderers/desktop/window-controller.ts +433 -0
  256. package/src/renderers/desktop/window-host.ts +70 -0
  257. package/src/renderers/desktop/window-layouts.ts +630 -0
  258. package/src/renderers/dom/data-frames.ts +15 -4
  259. package/src/renderers/dom/desktop/icons.tsx +0 -2
  260. package/src/renderers/dom/styles.css +0 -3
  261. package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
  262. package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
  263. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
  264. package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
  265. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
  266. package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
  267. package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
  268. package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
  269. package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
  270. package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
  271. package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
  272. package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
  273. package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
  274. package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
  275. package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
  276. package/src/renderers/electrobun/bun/index.ts +22 -109
  277. package/src/renderers/electrobun/bun/window/create.ts +23 -3
  278. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
  279. package/src/renderers/electrobun/bun/window/events.ts +4 -4
  280. package/src/renderers/electrobun/bun/window/focus.ts +0 -25
  281. package/src/renderers/electrobun/bun/window/frame.ts +2 -1
  282. package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
  283. package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
  284. package/src/renderers/electrobun/shared/protocol.ts +44 -2
  285. package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
  286. package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
  287. package/src/renderers/electrobun/view/main.tsx +13 -7
  288. package/src/series/fred-argument.ts +17 -0
  289. package/src/sources/gloomberb-cloud/index.ts +5 -7
  290. package/src/sources/provider-router/batches.ts +18 -3
  291. package/src/sources/provider-router/financial-routes.ts +7 -1
  292. package/src/sources/provider-router/financials.ts +18 -4
  293. package/src/state/app/context/index.tsx +16 -2
  294. package/src/state/desktop-windows.ts +63 -0
  295. package/src/sync/other-window-tabs.ts +62 -0
  296. package/src/tickers/company-name-listing.ts +23 -3
  297. package/src/tickers/listing-fate.ts +147 -1
  298. package/src/tickers/terminal-codes.ts +5 -0
  299. package/src/time-series/types.ts +6 -0
  300. package/src/types/config.ts +10 -1
  301. package/src/types/data-provider.ts +14 -0
  302. package/src/types/desktop-window.ts +71 -2
  303. package/src/types/financials.ts +19 -3
  304. package/src/types/headless.ts +21 -0
  305. package/src/types/plugin.ts +6 -0
  306. package/src/ui/index.tsx +14 -13
  307. package/src/ui/same-props.ts +58 -0
  308. package/src/utils/cli-output.ts +33 -4
  309. package/src/utils/double-escape-close.ts +38 -16
  310. package/src/utils/format.ts +30 -5
  311. package/src/utils/futures-generic.ts +12 -0
  312. package/src/utils/http-proxy-upstream.ts +6 -2
  313. package/src/utils/plugin-proxy-hosts.json +0 -4
  314. package/src/utils/plugin-proxy-hosts.ts +22 -0
  315. package/src/utils/price-earnings.ts +18 -0
  316. package/src/utils/sec-filings.ts +7 -1
  317. package/patches/electrobun@1.18.1.patch +0 -633
  318. package/src/api-client/types.ts +0 -2441
@@ -15,6 +15,7 @@ import {
15
15
  getPanelFocusTarget,
16
16
  getTopFloatingPaneId,
17
17
  hydrateDesktopSnapshot,
18
+ linkedSourceIds,
18
19
  nextRecentCommands,
19
20
  nextRecentTickers,
20
21
  reconcilePaneState,
@@ -32,6 +33,7 @@ export {
32
33
  getEffectiveThemeId,
33
34
  getFocusedCollectionId,
34
35
  getFocusedTickerSymbol,
36
+ linkedSourceIds,
35
37
  resolveCollectionForPane,
36
38
  resolveTickerForPane,
37
39
  syncConfigActiveLayoutState,
@@ -81,6 +81,11 @@ export interface AppState {
81
81
  focusedPaneId: string | null;
82
82
  previousFocusedPaneId: string | null;
83
83
  paneState: Record<string, PaneRuntimeState>;
84
+ /**
85
+ * The tickers of panes in another desktop window that panes here follow,
86
+ * by pane id. Set by the desktop process; absent everywhere else.
87
+ */
88
+ linkedTickers?: Record<string, string>;
84
89
  recentTickers: string[];
85
90
  commandBarOpen: boolean;
86
91
  commandBarQuery: string;
@@ -287,6 +287,8 @@ export function sanitizeLayout(
287
287
  value: unknown,
288
288
  fallback: LayoutConfig,
289
289
  chartMigration: LegacyChartMigrationContext = {},
290
+ /** Panes on other tabs a pane here may follow: on another desktop window, a link may cross tabs. */
291
+ externalSourceIds?: ReadonlySet<string>,
290
292
  ): LayoutConfig {
291
293
  if (!isLayoutConfig(value)) {
292
294
  return cloneLayout(fallback);
@@ -312,6 +314,7 @@ export function sanitizeLayout(
312
314
  const normalized = normalizePaneLayout(layout, {
313
315
  defaultFollowSourceInstanceId: getDefaultFollowSourceInstanceId(layout),
314
316
  resolveOrphanSymbol: () => null,
317
+ externalSourceIds,
315
318
  });
316
319
  return removeUnreachablePaneInstances(normalized);
317
320
  }
@@ -58,7 +58,7 @@ export function normalizeLoadedConfig(
58
58
  const defaults = createDefaultConfig(dataDir);
59
59
  const migration = migrateSavedConfig(saved, dataDir, host);
60
60
  const candidate = migration.config;
61
- const directLayout = sanitizeLayout(candidate.layout, defaults.layout);
61
+ const directLayout = sanitizeLayout(candidate.layout, defaults.layout, {}, savedPaneIds(candidate.layouts));
62
62
  const layouts = sanitizeSavedLayouts(candidate.layouts, directLayout);
63
63
  const activeLayoutIndex = sanitizeActiveLayoutIndex(candidate.activeLayoutIndex, layouts.length);
64
64
  const layout = cloneLayout(layouts[activeLayoutIndex]?.layout ?? directLayout);
@@ -139,7 +139,7 @@ export function normalizeLoadedConfig(
139
139
 
140
140
  export function normalizeConfigForSave(config: AppConfig): AppConfig {
141
141
  const defaults = createDefaultConfig(config.dataDir);
142
- const directLayout = sanitizeLayout(config.layout, defaults.layout);
142
+ const directLayout = sanitizeLayout(config.layout, defaults.layout, {}, savedPaneIds(config.layouts));
143
143
  const sanitizedLayouts = sanitizeSavedLayouts(config.layouts, directLayout);
144
144
  const activeLayoutIndex = sanitizeActiveLayoutIndex(config.activeLayoutIndex, sanitizedLayouts.length || 1);
145
145
  const layout = cloneLayout(sanitizedLayouts[activeLayoutIndex]?.layout ?? directLayout);
@@ -469,10 +469,44 @@ function sanitizeLayoutOrigin(value: unknown): LayoutOrigin | undefined {
469
469
  const sanitizedLayouts = new WeakMap<object, LayoutConfig>();
470
470
  const sanitizedPaneStates = new WeakMap<object, { layout: LayoutConfig; result: ReturnType<typeof sanitizeSavedPaneState> }>();
471
471
 
472
- function sanitizeSavedLayoutOnce(value: unknown, fallbackLayout: LayoutConfig): LayoutConfig {
472
+ /** Every pane id on a saved tab: the panes a link on another tab may follow. */
473
+ function savedPaneIds(value: unknown): ReadonlySet<string> {
474
+ const ids = new Set<string>();
475
+ if (!Array.isArray(value)) return ids;
476
+ for (const entry of value) {
477
+ const instances = isRecord(entry) && isRecord(entry.layout) ? entry.layout.instances : null;
478
+ if (!Array.isArray(instances)) continue;
479
+ for (const instance of instances) {
480
+ if (isRecord(instance) && typeof instance.instanceId === "string") ids.add(instance.instanceId);
481
+ }
482
+ }
483
+ return ids;
484
+ }
485
+
486
+ /**
487
+ * The panes a layout's links reach on other tabs. Links stay within a tab,
488
+ * except where another desktop window shows the tab a pane was moved to;
489
+ * those are kept, and every other dangling link is cut as before.
490
+ */
491
+ function crossTabSources(value: LayoutConfig, paneIds: ReadonlySet<string>): ReadonlySet<string> | undefined {
492
+ if (!Array.isArray(value.instances)) return undefined;
493
+ const own = new Set(value.instances.map((instance) => instance?.instanceId));
494
+ const sources = new Set<string>();
495
+ for (const instance of value.instances) {
496
+ const binding = instance?.binding;
497
+ if (binding?.kind !== "follow" || typeof binding.sourceInstanceId !== "string") continue;
498
+ if (!own.has(binding.sourceInstanceId) && paneIds.has(binding.sourceInstanceId)) sources.add(binding.sourceInstanceId);
499
+ }
500
+ return sources.size > 0 ? sources : undefined;
501
+ }
502
+
503
+ function sanitizeSavedLayoutOnce(value: unknown, fallbackLayout: LayoutConfig, paneIds: ReadonlySet<string>): LayoutConfig {
473
504
  // An invalid value sanitizes to a copy of the fallback, which is not a
474
505
  // function of the value alone.
475
506
  if (!isLayoutConfig(value)) return sanitizeLayout(value, fallbackLayout);
507
+ const external = crossTabSources(value, paneIds);
508
+ // A link to another tab depends on the other tabs too: those are not cached.
509
+ if (external) return sanitizeLayout(value, fallbackLayout, {}, external);
476
510
  const cached = sanitizedLayouts.get(value);
477
511
  if (cached) return cached;
478
512
  const layout = sanitizeLayout(value, fallbackLayout);
@@ -497,6 +531,7 @@ function sanitizeSavedLayouts(
497
531
  return [{ name: "Default", layout: cloneLayout(fallbackLayout) }];
498
532
  }
499
533
 
534
+ const paneIds = savedPaneIds(value);
500
535
  const layouts = value
501
536
  .filter((entry): entry is SavedLayout =>
502
537
  !!entry
@@ -504,7 +539,7 @@ function sanitizeSavedLayouts(
504
539
  && typeof (entry as SavedLayout).name === "string",
505
540
  )
506
541
  .map((entry) => {
507
- const layout = sanitizeSavedLayoutOnce(entry.layout, fallbackLayout);
542
+ const layout = sanitizeSavedLayoutOnce(entry.layout, fallbackLayout, paneIds);
508
543
  const placedPaneIds = new Set(getPlacedPaneInstanceIds(layout));
509
544
  const paneState = sanitizeSavedPaneStateOnce((entry as { paneState?: unknown }).paneState, layout);
510
545
  return {
package/src/i18n/es.ts CHANGED
@@ -249,6 +249,15 @@ export const es: Record<string, string> = {
249
249
  "Copy Screenshot": "Copiar captura",
250
250
  "Share Pane": "Compartir panel",
251
251
  "Pop Out": "Abrir en ventana",
252
+ "New Window": "Ventana nueva",
253
+ "Main Window": "Ventana principal",
254
+ "Window {number}": "Ventana {number}",
255
+ "Move to {window}": "Mover a {window}",
256
+ "Move to New Window": "Mover a una ventana nueva",
257
+ "Move Layout to {window}": "Mover diseño a {window}",
258
+ "Move Layout to New Window": "Mover diseño a una ventana nueva",
259
+ "Unlink from Pane in Another Window": "Desvincular del panel de otra ventana",
260
+ "Open another app window with its own layout tabs, for another screen": "Abrir otra ventana de la app con sus propias pestañas de diseño, para otra pantalla",
252
261
  "Move Window...": "Mover ventana...",
253
262
  "Change Ticker...": "Cambiar ticker...",
254
263
  "Change Ticker": "Cambiar ticker",
@@ -276,6 +285,8 @@ export const es: Record<string, string> = {
276
285
 
277
286
  // ── Context menu ─────────────────────────────────────────────
278
287
  "Start Here": "Empieza aquí",
288
+ "About": "Acerca de",
289
+ "What's new in v{version}": "Novedades de la v{version}",
279
290
  "Research a company: the overview, then tabs for the chart, financials, news, filings and earnings calls.": "Investiga una empresa: el resumen y luego pestañas de gráfico, finanzas, noticias, presentaciones y llamadas de resultados.",
280
291
  "Add what you own. Alerts and emails then follow your portfolio.": "Añade lo que tienes. Las alertas y los correos seguirán tu cartera.",
281
292
  "Your portfolio and watchlists.": "Tu cartera y tus listas de seguimiento.",
@@ -828,7 +839,6 @@ export const es: Record<string, string> = {
828
839
  "Start group chat": "Iniciar chat grupal",
829
840
  "Use @username, or multiple usernames for a group chat": "Usa @username, o varios usuarios para un chat grupal",
830
841
  "Type DM @username to start one": "Escribe DM @username para empezar",
831
- "Read-only chat. Log in or sign up to send.": "Chat de solo lectura. Inicia sesión o regístrate para enviar.",
832
842
  "Saved login found. Log in again to send.": "Sesión guardada encontrada. Vuelve a iniciar sesión para enviar.",
833
843
  "Verify your email to send messages.": "Verifica tu correo para enviar mensajes.",
834
844
  // The first-chat prompt for an account still on its signup handle.
@@ -852,7 +862,6 @@ export const es: Record<string, string> = {
852
862
  "ask questions about anything on screen": "hacer preguntas sobre cualquier cosa en pantalla",
853
863
  "Free with a verified Gloom account.": "Gratis con una cuenta de Gloom verificada.",
854
864
  "search X": "buscar en X",
855
- "{shortcut}, then Resend Verification Email": "{shortcut} y luego Reenviar correo de verificación",
856
865
  "editing": "editando",
857
866
  "replying to": "respondiendo a",
858
867
  "Reply": "Responder",
@@ -1258,7 +1267,8 @@ export const es: Record<string, string> = {
1258
1267
  "Rate limited — try again in a minute": "Límite alcanzado; inténtalo en un minuto",
1259
1268
  "{count}m": "{count} min",
1260
1269
  "{count}h": "{count} h",
1261
- "delayed data · upgrade": "datos diferidos · mejorar",
1270
+ "delayed": "de retraso",
1271
+ "upgrade": "mejorar",
1262
1272
  "real-time news": "noticias en tiempo real",
1263
1273
  "Pro trial · {days}d left": "Prueba Pro · quedan {days} d",
1264
1274
  "{delay} delayed": "{delay} de retraso",
package/src/i18n/ja.ts CHANGED
@@ -250,6 +250,15 @@ export const ja: Record<string, string> = {
250
250
  "Copy Screenshot": "スクリーンショットをコピー",
251
251
  "Share Pane": "ペインを共有",
252
252
  "Pop Out": "別ウィンドウで表示",
253
+ "New Window": "新規ウィンドウ",
254
+ "Main Window": "メインウィンドウ",
255
+ "Window {number}": "ウィンドウ {number}",
256
+ "Move to {window}": "{window} へ移動",
257
+ "Move to New Window": "新規ウィンドウへ移動",
258
+ "Move Layout to {window}": "レイアウトを {window} へ移動",
259
+ "Move Layout to New Window": "レイアウトを新規ウィンドウへ移動",
260
+ "Unlink from Pane in Another Window": "別ウィンドウのパネルとのリンクを解除",
261
+ "Open another app window with its own layout tabs, for another screen": "別の画面用に、専用のレイアウトタブを持つアプリウィンドウをもう一つ開く",
253
262
  "Move Window...": "ウィンドウを移動...",
254
263
  "Change Ticker...": "銘柄を変更...",
255
264
  "Change Ticker": "銘柄を変更",
@@ -277,6 +286,8 @@ export const ja: Record<string, string> = {
277
286
 
278
287
  // ── Context menu ─────────────────────────────────────────────
279
288
  "Start Here": "ここから始める",
289
+ "About": "このアプリについて",
290
+ "What's new in v{version}": "v{version} の新機能",
280
291
  "Research a company: the overview, then tabs for the chart, financials, news, filings and earnings calls.": "企業を調べる:概要から、チャート、財務、ニュース、提出書類、決算説明会のタブへ。",
281
292
  "Add what you own. Alerts and emails then follow your portfolio.": "保有銘柄を追加します。アラートとメールがポートフォリオに沿った内容になります。",
282
293
  "Your portfolio and watchlists.": "ポートフォリオとウォッチリスト。",
@@ -678,7 +689,8 @@ export const ja: Record<string, string> = {
678
689
  "{delay} delayed · try Pro live": "{delay}遅延 · Pro のリアルタイムを試す",
679
690
  "Pro trial {days}d": "Pro トライアル{days}日",
680
691
  "Pro trial — ends {date}": "Pro トライアル — {date} まで",
681
- "delayed data · upgrade": "データ遅延 · アップグレード",
692
+ "delayed": "遅延",
693
+ "upgrade": "アップグレード",
682
694
  "real-time news": "リアルタイムニュース",
683
695
  "AI command bar": "AI コマンドバー",
684
696
  "{amount}/mo": "{amount}/月",
@@ -842,7 +854,6 @@ export const ja: Record<string, string> = {
842
854
  "Start group chat": "グループチャットを開始する",
843
855
  "Use @username, or multiple usernames for a group chat": "グループ チャットには @username または複数のユーザー名を使用してください",
844
856
  "Type DM @username to start one": "DM @username と入力して開始します",
845
- "Read-only chat. Log in or sign up to send.": "読み取り専用チャット。送信するにはログインまたはサインアップしてください。",
846
857
  "Saved login found. Log in again to send.": "保存されたログインが見つかりました。送信するには再度ログインしてください。",
847
858
  "Verify your email to send messages.": "メッセージを送信するにはメールを確認してください。",
848
859
  // The first-chat prompt for an account still on its signup handle.
@@ -866,7 +877,6 @@ export const ja: Record<string, string> = {
866
877
  "ask questions about anything on screen": "画面上のあらゆる内容について質問",
867
878
  "Free with a verified Gloom account.": "認証済みの Gloom アカウントがあれば無料です。",
868
879
  "search X": "X を検索",
869
- "{shortcut}, then Resend Verification Email": "{shortcut} から「確認メールを再送信」",
870
880
  "editing": "編集",
871
881
  "replying to": "返信先",
872
882
  "Reply": "返信",
package/src/i18n/ko.ts CHANGED
@@ -248,6 +248,15 @@ export const ko: Record<string, string> = {
248
248
  "Copy Screenshot": "스크린샷 복사",
249
249
  "Share Pane": "창 공유",
250
250
  "Pop Out": "별도 창으로 열기",
251
+ "New Window": "새 창",
252
+ "Main Window": "메인 창",
253
+ "Window {number}": "창 {number}",
254
+ "Move to {window}": "{window}(으)로 이동",
255
+ "Move to New Window": "새 창으로 이동",
256
+ "Move Layout to {window}": "레이아웃을 {window}(으)로 이동",
257
+ "Move Layout to New Window": "레이아웃을 새 창으로 이동",
258
+ "Unlink from Pane in Another Window": "다른 창의 패널과 연결 해제",
259
+ "Open another app window with its own layout tabs, for another screen": "다른 화면용으로 자체 레이아웃 탭이 있는 앱 창을 하나 더 열기",
251
260
  "Move Window...": "창 이동...",
252
261
  "Change Ticker...": "종목 변경...",
253
262
  "Change Ticker": "종목 변경",
@@ -275,6 +284,8 @@ export const ko: Record<string, string> = {
275
284
 
276
285
  // ── Context menu ─────────────────────────────────────────────
277
286
  "Start Here": "여기서 시작",
287
+ "About": "정보",
288
+ "What's new in v{version}": "v{version}의 새로운 기능",
278
289
  "Research a company: the overview, then tabs for the chart, financials, news, filings and earnings calls.": "기업 조사: 개요부터 보고 차트, 재무, 뉴스, 공시, 실적 발표 탭으로 이동합니다.",
279
290
  "Add what you own. Alerts and emails then follow your portfolio.": "보유 종목을 추가하세요. 알림과 이메일이 포트폴리오에 맞춰집니다.",
280
291
  "Your portfolio and watchlists.": "포트폴리오와 관심 목록.",
@@ -676,7 +687,8 @@ export const ko: Record<string, string> = {
676
687
  "{delay} delayed · try Pro live": "{delay} 지연 · Pro 실시간 사용해 보기",
677
688
  "Pro trial {days}d": "Pro 체험 {days}일",
678
689
  "Pro trial — ends {date}": "Pro 체험 — {date} 종료",
679
- "delayed data · upgrade": "지연 데이터 · 업그레이드",
690
+ "delayed": "지연",
691
+ "upgrade": "업그레이드",
680
692
  "real-time news": "실시간 뉴스",
681
693
  "AI command bar": "AI 명령 바",
682
694
  "{amount}/mo": "{amount}/월",
@@ -840,7 +852,6 @@ export const ko: Record<string, string> = {
840
852
  "Start group chat": "그룹 채팅 시작",
841
853
  "Use @username, or multiple usernames for a group chat": "그룹 채팅에는 @username 또는 여러 사용자 이름을 사용하세요",
842
854
  "Type DM @username to start one": "DM @username을 입력하여 시작하세요",
843
- "Read-only chat. Log in or sign up to send.": "읽기 전용 채팅. 보내려면 로그인하거나 회원가입하세요.",
844
855
  "Saved login found. Log in again to send.": "저장된 로그인을 찾았습니다. 보내려면 다시 로그인하세요.",
845
856
  "Verify your email to send messages.": "메시지를 보내려면 이메일을 인증하세요.",
846
857
  // The first-chat prompt for an account still on its signup handle.
@@ -864,7 +875,6 @@ export const ko: Record<string, string> = {
864
875
  "ask questions about anything on screen": "화면에 보이는 모든 내용에 대해 질문",
865
876
  "Free with a verified Gloom account.": "인증된 Gloom 계정이 있으면 무료입니다.",
866
877
  "search X": "X를 검색",
867
- "{shortcut}, then Resend Verification Email": "{shortcut} 후 인증 이메일 재전송",
868
878
  "editing": "편집 중",
869
879
  "replying to": "답장 대상",
870
880
  "Reply": "답장",
package/src/i18n/zh-cn.ts CHANGED
@@ -250,6 +250,15 @@ export const zhCN: Record<string, string> = {
250
250
  "Copy Screenshot": "复制截图",
251
251
  "Share Pane": "分享窗格",
252
252
  "Pop Out": "弹出窗口",
253
+ "New Window": "新建窗口",
254
+ "Main Window": "主窗口",
255
+ "Window {number}": "窗口 {number}",
256
+ "Move to {window}": "移到{window}",
257
+ "Move to New Window": "移到新窗口",
258
+ "Move Layout to {window}": "将布局移到{window}",
259
+ "Move Layout to New Window": "将布局移到新窗口",
260
+ "Unlink from Pane in Another Window": "取消与其他窗口面板的链接",
261
+ "Open another app window with its own layout tabs, for another screen": "为另一块屏幕再打开一个带有独立布局标签的应用窗口",
253
262
  "Move Window...": "移动窗口...",
254
263
  "Change Ticker...": "更改股票代码...",
255
264
  "Change Ticker": "更改股票代码",
@@ -277,6 +286,8 @@ export const zhCN: Record<string, string> = {
277
286
 
278
287
  // ── Context menu ─────────────────────────────────────────────
279
288
  "Start Here": "从这里开始",
289
+ "About": "关于",
290
+ "What's new in v{version}": "v{version} 新功能",
280
291
  "Research a company: the overview, then tabs for the chart, financials, news, filings and earnings calls.": "研究一家公司:先看概览,再切换到图表、财务、新闻、文件和财报电话会议标签。",
281
292
  "Add what you own. Alerts and emails then follow your portfolio.": "添加你的持仓。之后提醒和邮件都会围绕你的投资组合。",
282
293
  "Your portfolio and watchlists.": "你的投资组合和自选列表。",
@@ -678,7 +689,8 @@ export const zhCN: Record<string, string> = {
678
689
  "{delay} delayed · try Pro live": "延迟 {delay} · 试用 Pro 实时数据",
679
690
  "Pro trial {days}d": "Pro 试用 {days} 天",
680
691
  "Pro trial — ends {date}": "Pro 试用 — {date} 结束",
681
- "delayed data · upgrade": "数据延迟 · 升级",
692
+ "delayed": "延迟",
693
+ "upgrade": "升级",
682
694
  "real-time news": "实时新闻",
683
695
  "AI command bar": "AI 命令栏",
684
696
  "{amount}/mo": "{amount}/月",
@@ -842,7 +854,6 @@ export const zhCN: Record<string, string> = {
842
854
  "Start group chat": "开始群聊",
843
855
  "Use @username, or multiple usernames for a group chat": "使用 @用户名,或输入多个用户名开始群聊",
844
856
  "Type DM @username to start one": "输入 DM @用户名开始私信",
845
- "Read-only chat. Log in or sign up to send.": "聊天为只读模式。登录或注册后才能发送消息。",
846
857
  "Saved login found. Log in again to send.": "发现已保存的登录信息。请重新登录后发送消息。",
847
858
  "Verify your email to send messages.": "验证邮箱后才能发送消息。",
848
859
  // The first-chat prompt for an account still on its signup handle.
@@ -866,7 +877,6 @@ export const zhCN: Record<string, string> = {
866
877
  "ask questions about anything on screen": "就屏幕上的任何内容提问",
867
878
  "Free with a verified Gloom account.": "使用已验证的 Gloom 账户即可免费使用。",
868
879
  "search X": "搜索 X",
869
- "{shortcut}, then Resend Verification Email": "按 {shortcut},然后选择“重新发送验证邮件”",
870
880
  "editing": "编辑中",
871
881
  "replying to": "回复",
872
882
  "Reply": "回复",
package/src/i18n/zh-tw.ts CHANGED
@@ -250,6 +250,15 @@ export const zhTW: Record<string, string> = {
250
250
  "Copy Screenshot": "複製截圖",
251
251
  "Share Pane": "分享窗格",
252
252
  "Pop Out": "彈出視窗",
253
+ "New Window": "新增視窗",
254
+ "Main Window": "主視窗",
255
+ "Window {number}": "視窗 {number}",
256
+ "Move to {window}": "移到{window}",
257
+ "Move to New Window": "移到新視窗",
258
+ "Move Layout to {window}": "將版面設定移到{window}",
259
+ "Move Layout to New Window": "將版面設定移到新視窗",
260
+ "Unlink from Pane in Another Window": "取消與其他視窗面板的連結",
261
+ "Open another app window with its own layout tabs, for another screen": "為另一個螢幕再開啟一個擁有獨立版面設定標籤的應用程式視窗",
253
262
  "Move Window...": "移動視窗...",
254
263
  "Change Ticker...": "變更股票代號...",
255
264
  "Change Ticker": "變更股票代號",
@@ -277,6 +286,8 @@ export const zhTW: Record<string, string> = {
277
286
 
278
287
  // ── Context menu ─────────────────────────────────────────────
279
288
  "Start Here": "從這裡開始",
289
+ "About": "關於",
290
+ "What's new in v{version}": "v{version} 新功能",
280
291
  "Research a company: the overview, then tabs for the chart, financials, news, filings and earnings calls.": "研究一家公司:先看概覽,再切換到圖表、財務、新聞、文件和法說會標籤。",
281
292
  "Add what you own. Alerts and emails then follow your portfolio.": "新增你的持股。之後提醒和郵件都會圍繞你的投資組合。",
282
293
  "Your portfolio and watchlists.": "你的投資組合和自選清單。",
@@ -678,7 +689,8 @@ export const zhTW: Record<string, string> = {
678
689
  "{delay} delayed · try Pro live": "延遲 {delay} · 試用 Pro 即時資料",
679
690
  "Pro trial {days}d": "Pro 試用 {days} 天",
680
691
  "Pro trial — ends {date}": "Pro 試用 — {date} 結束",
681
- "delayed data · upgrade": "資料延遲 · 升級",
692
+ "delayed": "延遲",
693
+ "upgrade": "升級",
682
694
  "real-time news": "即時新聞",
683
695
  "AI command bar": "AI 命令列",
684
696
  "{amount}/mo": "{amount}/月",
@@ -842,7 +854,6 @@ export const zhTW: Record<string, string> = {
842
854
  "Start group chat": "開始群組聊天",
843
855
  "Use @username, or multiple usernames for a group chat": "使用 @username,或輸入多個使用者名稱開始群組聊天",
844
856
  "Type DM @username to start one": "輸入 DM @username 開始私訊",
845
- "Read-only chat. Log in or sign up to send.": "聊天目前為唯讀模式。登入或註冊後即可傳送訊息。",
846
857
  "Saved login found. Log in again to send.": "發現已儲存的登入資訊。請重新登入後傳送訊息。",
847
858
  "Verify your email to send messages.": "驗證電子郵件後才能傳送訊息。",
848
859
  // The first-chat prompt for an account still on its signup handle.
@@ -866,7 +877,6 @@ export const zhTW: Record<string, string> = {
866
877
  "ask questions about anything on screen": "針對畫面上的任何內容提問",
867
878
  "Free with a verified Gloom account.": "使用已驗證的 Gloom 帳戶即可免費使用。",
868
879
  "search X": "搜尋 X",
869
- "{shortcut}, then Resend Verification Email": "按 {shortcut},然後選擇「重新發送驗證郵件」",
870
880
  "editing": "編輯中",
871
881
  "replying to": "回覆",
872
882
  "Reply": "回覆",
@@ -1,6 +1,6 @@
1
1
  import type { LayoutConfig } from "../../types/config";
2
2
  import { getDockLeafLayouts, type LayoutBounds } from "./dock-tree";
3
- import { clampFloatingRect, MIN_FLOAT_HEIGHT, MIN_FLOAT_WIDTH, type FloatingRect } from "./floating";
3
+ import { clampFloatingRect, MIN_FLOAT_HEIGHT, MIN_FLOAT_WIDTH, NARROW_FLOAT_AREA_WIDTH, type FloatingRect } from "./floating";
4
4
 
5
5
  /** What a new floating pane keeps clear of beyond the other floating panes. */
6
6
  export interface FloatingPlacementOptions {
@@ -63,7 +63,9 @@ function screenRect(layout: LayoutConfig, instanceId: string, area: LayoutBounds
63
63
  * and of the focused pane, shrunk to it when it is a little small, and centred
64
64
  * in it; otherwise one step down and right of the frontmost window, a cascade.
65
65
  * It never lands exactly on another window, and never covers all of the
66
- * focused pane when there is any other way.
66
+ * focused pane when there is any other way. An area narrower than
67
+ * NARROW_FLOAT_AREA_WIDTH is never searched for a narrower spot: the window
68
+ * spans it and cascades down.
67
69
  */
68
70
  export function placeFloatingRect(
69
71
  layout: LayoutConfig,
@@ -79,10 +81,11 @@ export function placeFloatingRect(
79
81
  const focused = focusedId ? screenRect(layout, focusedId, area) : null;
80
82
  const obstacles: LayoutBounds[] = [...others];
81
83
  if (focused && !others.some((entry) => entry.instanceId === focusedId)) obstacles.push(focused);
82
- const width = Math.min(size.width, area.width);
84
+ const narrow = area.width < NARROW_FLOAT_AREA_WIDTH;
85
+ const width = narrow ? area.width : Math.min(size.width, area.width);
83
86
  const height = Math.min(size.height, area.height);
84
87
 
85
- if (obstacles.length <= MAX_FREE_SEARCH_OBSTACLES) {
88
+ if (!narrow && obstacles.length <= MAX_FREE_SEARCH_OBSTACLES) {
86
89
  const spot = bestFreeSpot(area, obstacles, width, height);
87
90
  if (spot) return clampFloatingRect(spot, termWidth, termHeight);
88
91
  }
@@ -53,12 +53,15 @@ export function clampFloatingRectWithinBounds(rect: FloatingRect, bounds: Layout
53
53
  };
54
54
  }
55
55
 
56
- /** A new floating pane's size: its own default, or 60% of the area each way. */
56
+ /** An area narrower than this opens a new floating pane across its full width: 60% of it is too narrow to read a pane in. */
57
+ export const NARROW_FLOAT_AREA_WIDTH = 60;
58
+
59
+ /** A new floating pane's size: its own default, or 60% of the area each way; the full width of a narrow area. */
57
60
  export function defaultFloatingSize(termWidth: number, termHeight: number, def?: PaneDef): { width: number; height: number } {
58
61
  const { width, height } = clampFloatingRect({
59
62
  x: 0,
60
63
  y: 0,
61
- width: def?.defaultFloatingSize?.width ?? Math.floor(termWidth * 0.6),
64
+ width: termWidth < NARROW_FLOAT_AREA_WIDTH ? termWidth : def?.defaultFloatingSize?.width ?? Math.floor(termWidth * 0.6),
62
65
  height: def?.defaultFloatingSize?.height ?? Math.floor(termHeight * 0.6),
63
66
  }, termWidth, termHeight);
64
67
  return { width, height };
@@ -60,6 +60,25 @@ export function bondFigures(bond: FundBondFacts): BondFigure[] {
60
60
  return figures;
61
61
  }
62
62
 
63
+ /** How a fund's DV01 is derived, said beside it: the sponsor publishes a duration, not a DV01. */
64
+ export const DV01_FROM_DURATION = "price × duration ÷ 10,000";
65
+
66
+ /**
67
+ * A bond fund's dollar value of a basis point per share, derived from its
68
+ * duration: price × duration ÷ 10,000 (IEF at $91.76 and 6.82 yrs: $0.0626),
69
+ * what a curve trade is sized by. Null without a positive price and duration.
70
+ */
71
+ export function durationDv01PerShare(price: number | null | undefined, bond: FundBondFacts | null | undefined): number | null {
72
+ const duration = bond?.duration?.value;
73
+ if (price == null || !Number.isFinite(price) || price <= 0 || duration == null || !Number.isFinite(duration) || duration <= 0) return null;
74
+ return price * duration / 10_000;
75
+ }
76
+
77
+ /** A DV01 per share in dollars: `$0.0626 per share`. */
78
+ export function formatDv01PerShare(value: number): string {
79
+ return `$${value.toFixed(4)} per share`;
80
+ }
81
+
63
82
  /** `Municipal, CA (single-state)`, `Municipal, national` or `Taxable`: what a bond fund is for tax. */
64
83
  export function bondClassText(bond: FundBondFacts): string {
65
84
  if (bond.kind === "taxable") return "Taxable";
@@ -78,6 +78,15 @@ function contractCode(symbol: string): string {
78
78
  return parsePublicTickerKey(symbol).symbol.replace(/\.[A-Z]+$/, "");
79
79
  }
80
80
 
81
+ /**
82
+ * A listed contract as `CTM` names it: its quote symbol without the venue,
83
+ * GCZ26 for GCZ26.CMX and Cboe's VX/X6 for VIX November, so `quote` and the
84
+ * curve write one contract alike. Its archive code where it has no symbol.
85
+ */
86
+ export function futuresContractCode(contract: { contract: string | null; contractSymbol?: string | null }): string {
87
+ return contract.contractSymbol ? contract.contractSymbol.replace(/\.[A-Z]+$/, "") : contract.contract ?? "";
88
+ }
89
+
81
90
  /**
82
91
  * The Contract block: the contract an alias or a generic prices, its terms and
83
92
  * the dates a long faces delivery. A line with nothing to say is left out, so
@@ -85,7 +94,8 @@ function contractCode(symbol: string): string {
85
94
  */
86
95
  export function futuresContractLines(terms: FuturesContractTermsPayload, symbol: string): FuturesContractLine[] {
87
96
  const lines: FuturesContractLine[] = [];
88
- if (terms.contract && terms.contract !== contractCode(symbol)) lines.push({ key: "contract", label: "Contract", value: terms.contract });
97
+ const code = terms.contract ? futuresContractCode(terms) : null;
98
+ if (code && code !== contractCode(symbol)) lines.push({ key: "contract", label: "Contract", value: code });
89
99
  if (terms.spec) lines.push(...futuresSpecLines(terms.spec));
90
100
  else {
91
101
  // A root the server sends no terms for still says what its price counts: Dutch TTF gas is EUR / MWh.
@@ -297,9 +307,10 @@ export function futuresChangeBasis(
297
307
  }
298
308
 
299
309
  /** A listed contract as code and month: "NGX26 (Nov 2026)". */
300
- function contractWithMonth(contract: { contract: string; deliveryMonth: string }): string {
310
+ function contractWithMonth(contract: { contract: string; contractSymbol: string; deliveryMonth: string }): string {
301
311
  const month = deliveryMonthLabel(contract.deliveryMonth);
302
- return month ? `${contract.contract} (${month})` : contract.contract;
312
+ const code = futuresContractCode(contract);
313
+ return month ? `${code} (${month})` : code;
303
314
  }
304
315
 
305
316
  /**
@@ -296,6 +296,24 @@ export function isVenueTradingDay(exchange: string | undefined, date: string): b
296
296
  return isLocalTradingDay(canonicalExchange(exchange), date);
297
297
  }
298
298
 
299
+ /**
300
+ * The venue's session a local `date` belongs to: the date itself when the
301
+ * venue trades on it (isVenueTradingDay), otherwise the latest trading day
302
+ * before it, as a print stamped on a Saturday or a holiday follows the last
303
+ * session and opens none of its own. Null for round-the-clock venues and when
304
+ * no trading day falls within the lookback.
305
+ */
306
+ export function venueSessionOnOrBefore(exchange: string | undefined, date: string): string | null {
307
+ const canonical = canonicalExchange(exchange);
308
+ const day = isoLocalDateToUtcDay(date);
309
+ if (day == null || ALWAYS_OPEN_EXCHANGES.has(canonical)) return null;
310
+ for (let offset = 0; offset <= SESSION_LOOKBACK_DAYS; offset++) {
311
+ const iso = new Date((day - offset) * MS_PER_DAY).toISOString().slice(0, 10);
312
+ if (isLocalTradingDay(canonical, iso)) return iso;
313
+ }
314
+ return null;
315
+ }
316
+
299
317
  /** `weekendDays` replaces the venue's days off (historySourceWeekendDays). */
300
318
  function isLocalTradingDay(exchange: string, date: string, weekendDays?: readonly number[]): boolean {
301
319
  const weekday = localWeekday(date);
@@ -5,7 +5,7 @@ import { canonicalExchange, isKnownExchangeCode } from "../../utils/exchanges";
5
5
  import { quoteTradingDay } from "../quotes/day-range";
6
6
  import { isQuoteBeforeLatestSession } from "../quotes/freshness";
7
7
  import { delistingLabel, delistingStateLabel } from "../quotes/delisting";
8
- import { preMarketOpenOn, regularSessionCloseOn } from "./freshness";
8
+ import { preMarketOpenOn, regularSessionCloseOn, venueSessionOnOrBefore } from "./freshness";
9
9
  import { futuresWeekendClosure } from "./futures-week";
10
10
 
11
11
  const CLOSED_CHANGE_MUTING_RATIO = 0.55;
@@ -323,6 +323,18 @@ function reportedRegularMove(quote: Quote, close: number): CompletedRegularSessi
323
323
  return changePercent == null ? null : { change, changePercent };
324
324
  }
325
325
 
326
+ /**
327
+ * The session a quote's day belongs to: its trading day (quoteTradingDay), or
328
+ * for a print stamped on a day its venue does not trade (a Saturday after
329
+ * midnight New York, a holiday), the latest session before it. No session is
330
+ * read into a non-trading day.
331
+ */
332
+ function quoteSessionDay(quote: Quote): string | null {
333
+ const day = quoteTradingDay(quote);
334
+ if (!day) return null;
335
+ return venueSessionOnOrBefore(quote.listingExchangeName || quote.exchangeName, day) ?? day;
336
+ }
337
+
326
338
  /**
327
339
  * The regular session the quote's day follows, once it is over: after hours,
328
340
  * overnight, and through a weekend or holiday until the next pre-market, and
@@ -344,7 +356,8 @@ function completedRegularSession(quote: Quote): CompletedRegularSession | null {
344
356
  const today = quoteTradingDay(quote);
345
357
  return reported && closeDate && today && closeDate < today ? { close, reported, date: closeDate } : null;
346
358
  }
347
- if (closeDate ? closeDate === quoteTradingDay(quote) : state === "POST") {
359
+ // A print after the close, a weekend print included, never headlines over that close.
360
+ if (closeDate ? closeDate === quoteSessionDay(quote) : state === "POST") {
348
361
  return closeDate ? { close, reported, date: closeDate } : { close, reported };
349
362
  }
350
363
  }
@@ -45,7 +45,8 @@ export const bondCalculatorHeadless: HeadlessPaneDefinition<"bundle"> = {
45
45
  { label: "Macaulay duration", value: a.macaulayDuration, formatted: `${a.macaulayDuration.toFixed(4)} years` },
46
46
  { label: "Modified duration", value: a.modifiedDuration, formatted: `${a.modifiedDuration.toFixed(4)} years` },
47
47
  { label: "Convexity", value: a.convexity, formatted: a.convexity.toFixed(4) },
48
- { label: "DV01", value: a.dv01, formatted: a.dv01.toFixed(6) },
48
+ // The price change for a 1bp fall in yield, per 100 face as the prices are: 0.045493 is $45.49 on $100,000.
49
+ { label: "DV01", value: a.dv01, formatted: `${a.dv01.toFixed(6)} per 100 face` },
49
50
  { label: "Treasury spread", value: result.spread?.spreadBps ?? null, formatted: result.spread ? `${result.spread.spreadBps.toFixed(1)} bp as of ${result.spread.asOf}` : "Unavailable" },
50
51
  ] },
51
52
  { title: "Cash flows per 100 face", columns: [{ key: "date", header: "Payment" }, { key: "amount", header: "Cash", format: (n) => Number(n).toFixed(4) }, { key: "presentValue", header: "Present value", format: (n) => Number(n).toFixed(4) }], rows: a.cashFlows.map((flow) => ({ ...flow })) },
@@ -5,6 +5,6 @@ import { fixedIncomeShortcut } from "../fixed-income/shortcut";
5
5
  export const bondCalculatorModule: PluginModule = {
6
6
  paneTemplates: [fixedIncomeShortcut({ id: "bond-calculator-pane", paneId: "bond-calculator", label: "Bond Calculator",
7
7
  description: "Price, yield, accrued interest, duration, convexity and Treasury spread for a fixed coupon bond.",
8
- keywords: ["yas", "bond", "calculator", "yield", "price", "duration", "dv01"], shortcut: { prefix: "YAS" },
8
+ keywords: ["yas", "bond", "calculator", "yield", "price", "duration", "dv01", "hedge ratio", "steepener", "flattener"], shortcut: { prefix: "YAS" },
9
9
  headless: bondCalculatorHeadless, createInstance: () => ({}) }, "bonds", "calculator")],
10
10
  };
@@ -20,18 +20,27 @@ export function defaultBondDraft(now = new Date()): BondDraft {
20
20
  frequency: "2", dayCount: "act-act-icma", endOfMonth: false };
21
21
  }
22
22
 
23
- function inputNumber(value: string, label: string): number {
24
- if (!value.trim() || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(value.trim())) throw new Error(numberErrorMessage(`${label} must be a number`, value));
25
- const number = Number(value);
23
+ /**
24
+ * A coupon or yield typed with a decimal comma (`3,875`, `-0,25`) reads as the
25
+ * decimal it is: a percent rate is never in the thousands, so `3,875` is
26
+ * 3.875%, not 3875. A clean price keeps the dot it is told to use.
27
+ */
28
+ const DECIMAL_COMMA_RATE = /^([+-]?\d+),(\d+)$/;
29
+
30
+ function inputNumber(value: string, label: string, decimalComma = false): number {
31
+ const comma = decimalComma ? DECIMAL_COMMA_RATE.exec(value.trim()) : null;
32
+ const text = comma ? `${comma[1]}.${comma[2]}` : value.trim();
33
+ if (!text || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(text)) throw new Error(numberErrorMessage(`${label} must be a number`, value));
34
+ const number = Number(text);
26
35
  if (!Number.isFinite(number)) throw new Error(`${label} must be finite`);
27
36
  return number;
28
37
  }
29
38
 
30
39
  export function calculateBond(draft: BondDraft, curve: readonly TreasuryBenchmarkPoint[] = []) {
31
40
  if (!["yield", "price"].includes(draft.mode)) throw new Error("Select price or yield input");
32
- const terms: BondTerms = { settlement: draft.settlement, maturity: draft.maturity, couponPercent: inputNumber(draft.coupon, "Coupon"),
41
+ const terms: BondTerms = { settlement: draft.settlement, maturity: draft.maturity, couponPercent: inputNumber(draft.coupon, "Coupon", true),
33
42
  frequency: Number(draft.frequency) as BondTerms["frequency"], dayCount: draft.dayCount as BondTerms["dayCount"], endOfMonth: draft.endOfMonth };
34
- const quote = inputNumber(draft.quote, draft.mode === "yield" ? "Yield" : "Clean price");
43
+ const quote = draft.mode === "yield" ? inputNumber(draft.quote, "Yield", true) : inputNumber(draft.quote, "Clean price");
35
44
  const yieldPercent = draft.mode === "yield" ? quote : solveBondYield(terms, quote);
36
45
  const analytics = priceBond(terms, yieldPercent);
37
46
  const spread = treasurySpread(terms, yieldPercent, curve);