gloomberb 0.10.0 → 0.10.2

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 (353) hide show
  1. package/package.json +8 -1
  2. package/src/api-client/auth.ts +1 -0
  3. package/src/api-client/index.test.ts +359 -108
  4. package/src/api-client/index.ts +24 -13
  5. package/src/api-client/socket.ts +70 -35
  6. package/src/api-client/types.ts +1 -1
  7. package/src/app/language-observer.test.tsx +82 -0
  8. package/src/app/language-observer.tsx +13 -0
  9. package/src/app/pane-runtime/index.tsx +2 -2
  10. package/src/app/pane-runtime/pane-settings-runtime.tsx +2 -2
  11. package/src/app/pane-runtime/pane-template-runtime.ts +2 -2
  12. package/src/app/pane-runtime/plugin-bindings.ts +2 -2
  13. package/src/app/pane-runtime/ticker-open-runtime.ts +2 -2
  14. package/src/app/runtime/broker-import.ts +2 -2
  15. package/src/app/runtime/plugin-bindings.ts +2 -2
  16. package/src/app/runtime/startup.ts +2 -2
  17. package/src/app.tsx +16 -7
  18. package/src/brokers/account-cache.ts +6 -6
  19. package/src/brokers/broker-ticker-sync.ts +3 -3
  20. package/src/brokers/remote-broker-adapter.ts +2 -2
  21. package/src/brokers/sync-broker-instance.ts +5 -6
  22. package/src/cli/commands/api.ts +3 -6
  23. package/src/cli/commands/automation.ts +7 -15
  24. package/src/cli/commands/market.ts +26 -61
  25. package/src/cli/commands/overview.ts +34 -45
  26. package/src/cli/commands/search.ts +25 -27
  27. package/src/cli/commands/system.ts +27 -57
  28. package/src/cli/commands/ticker.ts +62 -63
  29. package/src/cli/context.test.ts +63 -0
  30. package/src/cli/context.ts +15 -1
  31. package/src/cli/index.ts +1 -1
  32. package/src/cli/pane-functions/data.ts +2 -19
  33. package/src/cli/pane-functions/index.ts +26 -25
  34. package/src/cli/pane-functions/report.ts +1 -1
  35. package/src/cli/pane-functions/screenshot.ts +3 -3
  36. package/src/cli/scoped-context.ts +41 -0
  37. package/src/components/chart/composite/composite-chart.test.tsx +615 -18
  38. package/src/components/chart/composite/composite-chart.tsx +179 -79
  39. package/src/components/chart/composite/format.test.ts +20 -7
  40. package/src/components/chart/composite/index.ts +0 -21
  41. package/src/components/chart/composite/interactions.test.ts +90 -3
  42. package/src/components/chart/composite/interactions.ts +189 -24
  43. package/src/components/chart/composite/price-series.ts +0 -2
  44. package/src/components/chart/composite/rasterizer.ts +10 -9
  45. package/src/components/chart/composite/renderers.test.ts +108 -2
  46. package/src/components/chart/composite/scene.test.ts +36 -0
  47. package/src/components/chart/composite/scene.ts +5 -2
  48. package/src/components/chart/composite/text-renderer.ts +37 -25
  49. package/src/components/chart/composite/time-axis.test.ts +243 -0
  50. package/src/components/chart/composite/time-axis.ts +608 -0
  51. package/src/components/chart/composite/types.ts +12 -1
  52. package/src/components/chart/core/data.ts +2 -159
  53. package/src/components/chart/core/date-window.ts +6 -225
  54. package/src/components/chart/core/palette.ts +1 -12
  55. package/src/components/chart/core/pointer.ts +0 -142
  56. package/src/components/chart/core/types.ts +1 -58
  57. package/src/components/chart/cursor-motion.ts +2 -4
  58. package/src/components/chart/indicators/types.ts +0 -9
  59. package/src/components/chart/market-session.ts +0 -11
  60. package/src/components/chart/native/kitty/protocol.ts +1 -1
  61. package/src/components/chart/native/raster/layout.ts +3 -10
  62. package/src/components/chart/static/chart/axis-overlays.test.tsx +64 -0
  63. package/src/components/chart/static/chart/axis-overlays.tsx +59 -14
  64. package/src/components/chart/static/chart/surface.tsx +1 -2
  65. package/src/components/command-bar/action-runtime.ts +2 -2
  66. package/src/components/command-bar/commands/direct/index.ts +1 -1
  67. package/src/components/command-bar/panel/body.tsx +2 -2
  68. package/src/components/command-bar/panel/index.tsx +11 -9
  69. package/src/components/command-bar/routes/ticker-search/actions.ts +2 -2
  70. package/src/components/command-bar/surface/index.tsx +2 -2
  71. package/src/components/command-bar/workflow/body.tsx +3 -3
  72. package/src/components/command-bar/workflow/collection-actions.ts +2 -2
  73. package/src/components/command-bar/workflow/coordinator.ts +2 -2
  74. package/src/components/command-bar/workflow/field-row.tsx +25 -11
  75. package/src/components/command-bar/workflow/tickers.ts +2 -2
  76. package/src/components/feed-data-table/stack-view.test.tsx +28 -36
  77. package/src/components/feed-data-table/stack-view.tsx +3 -1
  78. package/src/components/layout/detached-pane-shell.tsx +6 -6
  79. package/src/components/layout/header.tsx +13 -9
  80. package/src/components/layout/pane/content.test.tsx +42 -3
  81. package/src/components/layout/pane/content.tsx +3 -1
  82. package/src/components/layout/pane/footer/index.test.tsx +45 -2
  83. package/src/components/layout/pane/footer/registration.tsx +3 -1
  84. package/src/components/layout/shell/index.tsx +1 -2
  85. package/src/components/layout/shell/native/surfaces.ts +1 -1
  86. package/src/components/layout/shell/native/window-state.ts +1 -1
  87. package/src/components/layout/status-bar.tsx +12 -8
  88. package/src/components/layout/window-controls.tsx +8 -6
  89. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  90. package/src/components/pane-settings-dialog/desktop.tsx +0 -2
  91. package/src/components/pane-settings-dialog.tsx +0 -2
  92. package/src/components/pane-template-wizard.tsx +10 -9
  93. package/src/components/price-performance.tsx +2 -113
  94. package/src/components/price-sparkline/model.ts +15 -17
  95. package/src/components/price-sparkline/view.tsx +8 -7
  96. package/src/components/speedometer-gauge/desktop.tsx +2 -1
  97. package/src/components/speedometer-gauge/index.tsx +0 -2
  98. package/src/components/speedometer-gauge/terminal.tsx +24 -5
  99. package/src/components/ticker/badge/index.tsx +1 -18
  100. package/src/components/ui/data-table/opentui/index.tsx +3 -3
  101. package/src/components/ui/frame.tsx +1 -2
  102. package/src/components/ui/page-stack-view.test.tsx +126 -0
  103. package/src/components/ui/page-stack-view.tsx +24 -12
  104. package/src/components/ui/tabs.tsx +7 -3
  105. package/src/components/ui/ui.test.tsx +23 -2
  106. package/src/components/use-external-link-footer.ts +4 -2
  107. package/src/core/app-service-ports.ts +46 -0
  108. package/src/core/app-services.test.ts +66 -0
  109. package/src/core/app-services.ts +17 -15
  110. package/src/data/config/chart-settings.ts +3 -10
  111. package/src/data/config/store/index.test.ts +99 -2
  112. package/src/data/config/store/migrations.ts +278 -0
  113. package/src/data/config/store/normalize.ts +44 -186
  114. package/src/data/resource-store.ts +73 -12
  115. package/src/data/sqlite/cache.test.ts +104 -15
  116. package/src/i18n/index.test.ts +17 -0
  117. package/src/i18n/index.ts +23 -6
  118. package/src/i18n/ja.ts +13 -0
  119. package/src/i18n/ko.ts +13 -0
  120. package/src/i18n/react.ts +6 -0
  121. package/src/i18n/zh-cn.ts +13 -0
  122. package/src/i18n/zh-tw.ts +13 -0
  123. package/src/market-data/coordinator/auxiliary.ts +7 -3
  124. package/src/market-data/coordinator/chart.ts +1 -1
  125. package/src/market-data/coordinator/index.test.ts +26 -0
  126. package/src/market-data/coordinator/index.ts +11 -5
  127. package/src/market-data/coordinator/quotes.ts +4 -40
  128. package/src/market-data/coordinator/subscriptions.test.ts +89 -1
  129. package/src/market-data/hooks.tsx +47 -1
  130. package/src/market-data/market/status.ts +6 -6
  131. package/src/market-data/performance.ts +1 -1
  132. package/src/market-data/quote-subscription-target.test.ts +37 -0
  133. package/src/market-data/quote-subscription-target.ts +60 -0
  134. package/src/market-data/quotes/freshness.ts +1 -0
  135. package/src/market-data/quotes/resolution.ts +4 -0
  136. package/src/market-data/request-types.ts +3 -3
  137. package/src/news/aggregator.test.ts +97 -1
  138. package/src/news/aggregator.ts +100 -57
  139. package/src/news/hooks.test.tsx +64 -0
  140. package/src/news/hooks.ts +18 -25
  141. package/src/plugins/builtin/account-management/footer.ts +4 -2
  142. package/src/plugins/builtin/account-management/pane.tsx +9 -4
  143. package/src/plugins/builtin/ai/agent-history.ts +11 -7
  144. package/src/plugins/builtin/ai/ask-ai-detail-tab.tsx +0 -5
  145. package/src/plugins/builtin/ai/ask-ai.test.tsx +3 -4
  146. package/src/plugins/builtin/ai/index.test.ts +2 -2
  147. package/src/plugins/builtin/ai/index.tsx +10 -11
  148. package/src/plugins/builtin/ai/pane-settings.ts +1 -1
  149. package/src/plugins/builtin/ai/pi/runtime.ts +6 -5
  150. package/src/plugins/builtin/ai/providers.ts +1 -9
  151. package/src/plugins/builtin/ai/runner.ts +0 -6
  152. package/src/plugins/builtin/ai/screener/footer.ts +4 -1
  153. package/src/plugins/builtin/ai/screener/pane.test.tsx +9 -9
  154. package/src/plugins/builtin/ai/workspace/model.ts +2 -27
  155. package/src/plugins/builtin/ai/workspace/pane.tsx +2 -2
  156. package/src/plugins/builtin/analytics/metrics.ts +1 -7
  157. package/src/plugins/builtin/broker-manager/detail.tsx +3 -2
  158. package/src/plugins/builtin/broker-manager/index.tsx +4 -2
  159. package/src/plugins/builtin/chart-composer/editor/controller.ts +643 -0
  160. package/src/plugins/builtin/chart-composer/editor/desktop-view.tsx +134 -0
  161. package/src/plugins/builtin/chart-composer/editor/model.test.ts +85 -0
  162. package/src/plugins/builtin/chart-composer/editor/model.ts +292 -0
  163. package/src/plugins/builtin/chart-composer/editor/opentui-view.tsx +108 -0
  164. package/src/plugins/builtin/chart-composer/editor.tsx +65 -947
  165. package/src/plugins/builtin/chart-composer/index.tsx +0 -6
  166. package/src/plugins/builtin/chart-composer/pane.tsx +69 -36
  167. package/src/plugins/builtin/chart-composer/presets.ts +1 -19
  168. package/src/plugins/builtin/chart-composer/settings.ts +1 -1
  169. package/src/plugins/builtin/chat/content/composer-runtime.ts +1 -1
  170. package/src/plugins/builtin/chat/content/shortcuts.ts +0 -1
  171. package/src/plugins/builtin/chat/controller/fetch.ts +8 -2
  172. package/src/plugins/builtin/chat/controller/persistence.ts +2 -0
  173. package/src/plugins/builtin/chat/controller/session.test.ts +25 -0
  174. package/src/plugins/builtin/chat/controller/session.ts +2 -0
  175. package/src/plugins/builtin/chat/controller/state.ts +7 -0
  176. package/src/plugins/builtin/chat/controller.test.ts +73 -20
  177. package/src/plugins/builtin/chat/message/desktop.tsx +2 -0
  178. package/src/plugins/builtin/cloud-tweets/footer.ts +9 -28
  179. package/src/plugins/builtin/cloud-tweets/pane.tsx +0 -5
  180. package/src/plugins/builtin/cloud-tweets/table.tsx +12 -17
  181. package/src/plugins/builtin/correlation/compute.ts +4 -10
  182. package/src/plugins/builtin/econ/index.tsx +17 -19
  183. package/src/plugins/builtin/holders/types.ts +0 -1
  184. package/src/plugins/builtin/insider/index.tsx +6 -31
  185. package/src/plugins/builtin/news/index.tsx +5 -7
  186. package/src/plugins/builtin/news/wire/breaking/pane.test.tsx +6 -8
  187. package/src/plugins/builtin/news/wire/news/footer.ts +10 -11
  188. package/src/plugins/builtin/news/wire/read-state.test.ts +7 -0
  189. package/src/plugins/builtin/news/wire/read-state.ts +18 -28
  190. package/src/plugins/builtin/news/wire/rss/parser.ts +1 -11
  191. package/src/plugins/builtin/options/footer.test.ts +115 -0
  192. package/src/plugins/builtin/options/footer.ts +110 -0
  193. package/src/plugins/builtin/options/live-quotes.test.ts +238 -0
  194. package/src/plugins/builtin/options/live-quotes.ts +147 -0
  195. package/src/plugins/builtin/options/view.test.tsx +71 -1
  196. package/src/plugins/builtin/options/view.tsx +39 -24
  197. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +103 -117
  198. package/src/plugins/builtin/portfolio-list/cli/render.ts +11 -5
  199. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +120 -135
  200. package/src/plugins/builtin/portfolio-list/header.tsx +9 -4
  201. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +6 -1
  202. package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +4 -2
  203. package/src/plugins/builtin/research/corporate-actions-pane.tsx +24 -52
  204. package/src/plugins/builtin/sec/filing-content.test.ts +41 -0
  205. package/src/plugins/builtin/sec/filing-content.ts +94 -0
  206. package/src/plugins/builtin/sec/index.tsx +21 -104
  207. package/src/plugins/builtin/sectors/sector-model.ts +1 -7
  208. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -0
  209. package/src/plugins/builtin/shared/pane-footer.ts +82 -0
  210. package/src/plugins/builtin/shared/read-state.ts +64 -3
  211. package/src/plugins/builtin/substack/read-state.ts +16 -41
  212. package/src/plugins/builtin/thirteenf/pane.tsx +24 -73
  213. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +10 -10
  214. package/src/plugins/builtin/yield-curve/index.tsx +11 -9
  215. package/src/plugins/ibkr/dialogs.tsx +3 -3
  216. package/src/plugins/ibkr/gateway/fundamentals.ts +1 -1
  217. package/src/plugins/ibkr/gateway/history-requests.ts +2 -2
  218. package/src/plugins/ibkr/gateway/history.ts +2 -2
  219. package/src/plugins/ibkr/gateway/selection.ts +2 -2
  220. package/src/plugins/ibkr/gateway/service/index.ts +2 -2
  221. package/src/plugins/ibkr/gateway/service/native.ts +2 -2
  222. package/src/plugins/plugin-persistence.ts +3 -4
  223. package/src/plugins/prediction-markets/controller/keyboard.ts +1 -1
  224. package/src/plugins/prediction-markets/controller/live-updates.ts +6 -5
  225. package/src/plugins/prediction-markets/detail/book.tsx +2 -2
  226. package/src/plugins/prediction-markets/detail/outcomes.tsx +3 -1
  227. package/src/plugins/prediction-markets/detail/pane.tsx +3 -1
  228. package/src/plugins/prediction-markets/detail/trades.tsx +3 -3
  229. package/src/plugins/registry/context.ts +3 -4
  230. package/src/plugins/registry/index.ts +5 -6
  231. package/src/react/input.test.ts +126 -3
  232. package/src/react/input.ts +120 -1
  233. package/src/remote/app-host.tsx +2 -13
  234. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +44 -60
  235. package/src/renderers/electrobun/bun/desktop/capability-bridge.ts +15 -13
  236. package/src/renderers/electrobun/bun/desktop/host-requests.ts +26 -22
  237. package/src/renderers/electrobun/bun/desktop/http-fetch.ts +5 -1
  238. package/src/renderers/electrobun/bun/desktop/initialization.ts +11 -6
  239. package/src/renderers/electrobun/bun/desktop/media.ts +5 -3
  240. package/src/renderers/electrobun/bun/desktop/plugin-state.ts +21 -22
  241. package/src/renderers/electrobun/bun/desktop/window-controls.ts +3 -1
  242. package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +18 -18
  243. package/src/renderers/electrobun/bun/index.ts +123 -83
  244. package/src/renderers/electrobun/shared/protocol.ts +146 -7
  245. package/src/renderers/electrobun/view/app-services.ts +5 -8
  246. package/src/renderers/electrobun/view/backend-rpc.ts +18 -8
  247. package/src/renderers/electrobun/view/broker-remote-client.ts +2 -2
  248. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +5 -22
  249. package/src/renderers/electrobun/view/config-host.ts +1 -1
  250. package/src/renderers/electrobun/view/context-menu.ts +1 -17
  251. package/src/renderers/electrobun/view/data-table/index.tsx +0 -1
  252. package/src/renderers/electrobun/view/data-table/row.tsx +0 -4
  253. package/src/renderers/electrobun/view/desktop/control-styles.ts +37 -34
  254. package/src/renderers/electrobun/view/desktop/controls.tsx +36 -33
  255. package/src/renderers/electrobun/view/desktop/list-view.tsx +15 -12
  256. package/src/renderers/electrobun/view/desktop/popover.tsx +2 -3
  257. package/src/renderers/electrobun/view/dialog-host.tsx +2 -3
  258. package/src/renderers/electrobun/view/fatal-screen.tsx +0 -1
  259. package/src/renderers/electrobun/view/host/box.tsx +0 -1
  260. package/src/renderers/electrobun/view/host/chart-surface.tsx +0 -1
  261. package/src/renderers/electrobun/view/host/input.tsx +0 -1
  262. package/src/renderers/electrobun/view/host/media-surface.tsx +0 -1
  263. package/src/renderers/electrobun/view/host/native.ts +0 -1
  264. package/src/renderers/electrobun/view/host/scroll-box.tsx +0 -1
  265. package/src/renderers/electrobun/view/host/tabs.tsx +0 -1
  266. package/src/renderers/electrobun/view/host/text.tsx +0 -1
  267. package/src/renderers/electrobun/view/http-fetch.ts +3 -11
  268. package/src/renderers/electrobun/view/input-host.tsx +10 -53
  269. package/src/renderers/electrobun/view/key-event.ts +0 -1
  270. package/src/renderers/electrobun/view/main.tsx +3 -3
  271. package/src/renderers/electrobun/view/native-renderer.ts +0 -1
  272. package/src/renderers/electrobun/view/native-stubs/backend-rpc.ts +13 -1
  273. package/src/renderers/electrobun/view/native-stubs/chart/surface-manager.ts +11 -0
  274. package/src/renderers/electrobun/view/native-stubs/native-stubs.test.ts +47 -0
  275. package/src/renderers/electrobun/view/remote/asset-data-client.ts +6 -44
  276. package/src/renderers/electrobun/view/remote/persistence.ts +6 -2
  277. package/src/renderers/electrobun/view/remote/quote-subscription-registry.test.ts +86 -0
  278. package/src/renderers/electrobun/view/remote/quote-subscription-registry.ts +72 -0
  279. package/src/renderers/electrobun/view/remote/ticker-repository.ts +2 -2
  280. package/src/renderers/electrobun/view/toast-host.tsx +0 -1
  281. package/src/renderers/electrobun/view/ui-host.tsx +1 -2
  282. package/src/renderers/electrobun/view/update-host.ts +1 -1
  283. package/src/renderers/opentui/chart-surface.tsx +2 -1
  284. package/src/renderers/opentui/dialog-host.tsx +20 -4
  285. package/src/renderers/opentui/image/loader.ts +12 -2
  286. package/src/renderers/opentui/input-host.tsx +7 -49
  287. package/src/renderers/opentui/start.tsx +2 -0
  288. package/src/sources/gloomberb-cloud/history-quality.ts +44 -0
  289. package/src/sources/gloomberb-cloud/index.test.ts +173 -0
  290. package/src/sources/gloomberb-cloud/index.ts +42 -20
  291. package/src/sources/gloomberb-cloud/normalizers.ts +9 -3
  292. package/src/sources/provider-router/cache.ts +1 -1
  293. package/src/sources/provider-router/document-routes.ts +10 -5
  294. package/src/sources/provider-router/financials.test.ts +14 -0
  295. package/src/sources/provider-router/financials.ts +6 -1
  296. package/src/sources/provider-router/history.test.ts +163 -1
  297. package/src/sources/provider-router/history.ts +278 -347
  298. package/src/sources/provider-router/index.ts +2 -2
  299. package/src/sources/provider-router/routing.test.ts +39 -0
  300. package/src/sources/provider-router/routing.ts +24 -11
  301. package/src/sources/provider-router/supplemental.ts +37 -17
  302. package/src/sources/sec-edgar/content.ts +2 -12
  303. package/src/sources/sec-edgar.ts +2 -13
  304. package/src/sources/yahoo-finance/history.ts +2 -2
  305. package/src/sources/yahoo-finance/options.ts +5 -0
  306. package/src/sources/yahoo-finance.ts +2 -2
  307. package/src/state/app/bootstrap.ts +2 -2
  308. package/src/state/app/context/index.tsx +2 -2
  309. package/src/state/hooks/quote-streaming.ts +66 -1
  310. package/src/state/hooks/session-snapshot.ts +2 -2
  311. package/src/state/selectors.ts +0 -9
  312. package/src/sync/controller.test.ts +98 -0
  313. package/src/sync/controller.ts +29 -5
  314. package/src/sync/react.ts +2 -2
  315. package/src/sync/types.ts +2 -2
  316. package/src/theme/colors.test.ts +10 -0
  317. package/src/theme/colors.ts +75 -78
  318. package/src/theme/theme-context.test.tsx +67 -0
  319. package/src/theme/theme-context.tsx +9 -5
  320. package/src/tickers/open-target.ts +2 -2
  321. package/src/tickers/search/upsert.ts +2 -2
  322. package/src/time-series/alignment.ts +0 -7
  323. package/src/time-series/chart-data.ts +145 -0
  324. package/src/time-series/date-window.ts +44 -0
  325. package/src/time-series/history-window.ts +21 -0
  326. package/src/time-series/hooks.test.ts +59 -0
  327. package/src/time-series/hooks.ts +33 -12
  328. package/src/time-series/market-resolution.ts +2 -2
  329. package/src/time-series/market.ts +1 -1
  330. package/src/time-series/range.ts +9 -0
  331. package/src/{components/chart/core → time-series}/resolution.ts +3 -102
  332. package/src/time-series/resolve.test.ts +203 -1
  333. package/src/time-series/resolve.ts +96 -18
  334. package/src/time-series/spec-studies.test.ts +15 -0
  335. package/src/time-series/spec.ts +2 -2
  336. package/src/time-series/studies.ts +5 -2
  337. package/src/time-series/types.ts +3 -1
  338. package/src/time-series/use-chart-resolution.test.tsx +358 -0
  339. package/src/time-series/use-chart-resolution.ts +46 -4
  340. package/src/types/broker.ts +2 -2
  341. package/src/types/data-provider.ts +3 -3
  342. package/src/types/financials.ts +12 -0
  343. package/src/types/plugin.ts +2 -2
  344. package/src/ui/context-menu.tsx +3 -2
  345. package/src/ui/dialog.tsx +2 -2
  346. package/src/utils/html-entities.ts +3 -5
  347. package/src/utils/main-thread-monitor.ts +1 -1
  348. package/src/utils/price-history.ts +5 -5
  349. package/src/version.ts +3 -1
  350. package/src/components/chart/core/viewport.test.ts +0 -8
  351. package/src/components/chart/core/viewport.ts +0 -24
  352. package/src/time-series/index.ts +0 -14
  353. /package/src/{components/chart/core → time-series}/resolution.test.ts +0 -0
@@ -1,8 +1,11 @@
1
1
  import type { AppSessionSnapshot } from "../../../core/state/session-persistence";
2
+ import type { PaneRuntimeState } from "../../../core/state/app/state";
2
3
  import type { DesktopDockPreviewState, DesktopSharedStateSnapshot, DesktopThemePreviewState } from "../../../types/desktop-window";
3
4
  import type { DesktopApplicationMenuCommand } from "../../../types/desktop-menu";
4
5
  import type { AppConfig } from "../../../types/config";
5
- import type { UpdateProgress } from "../../../updater";
6
+ import type { LiveStreamResolveRequest, ResolvedLiveStream } from "../../../types/media";
7
+ import type { TickerRecord } from "../../../types/ticker";
8
+ import type { ReleaseInfo, UpdateCheckResult, UpdateProgress } from "../../../updater";
6
9
  import type { CapabilityManifest } from "../../../capabilities";
7
10
  import type { RemoteControlRequest, RemoteControlResponse } from "../../../remote/types";
8
11
 
@@ -20,8 +23,149 @@ export interface ElectrobunBackendInit {
20
23
  paneId?: string;
21
24
  }
22
25
 
26
+ export interface DesktopRestartMessage {
27
+ reason?: string;
28
+ source?: string;
29
+ }
30
+
31
+ export type DesktopWindowControlAction = "minimize" | "toggle-maximize" | "close";
32
+
33
+ export type DesktopContextMenuItem =
34
+ | { type: "divider" }
35
+ | {
36
+ type?: "normal";
37
+ label?: string;
38
+ tooltip?: string;
39
+ action?: string;
40
+ role?: string;
41
+ data?: unknown;
42
+ submenu?: DesktopContextMenuItem[];
43
+ enabled?: boolean;
44
+ checked?: boolean;
45
+ hidden?: boolean;
46
+ accelerator?: string;
47
+ };
48
+
49
+ export interface DesktopPluginStateSetEntry {
50
+ pluginId: string;
51
+ key: string;
52
+ value: unknown;
53
+ schemaVersion?: number;
54
+ }
55
+
56
+ export interface DesktopHttpFetchRequest {
57
+ url: string;
58
+ init?: {
59
+ method?: string;
60
+ headers?: Record<string, string>;
61
+ body?: string;
62
+ redirect?: "follow" | "error" | "manual";
63
+ timeoutMs?: number;
64
+ };
65
+ }
66
+
67
+ export interface DesktopHttpFetchResponse {
68
+ status: number;
69
+ statusText: string;
70
+ headers: Record<string, string>;
71
+ setCookie?: string[];
72
+ body: string;
73
+ }
74
+
75
+ export interface DesktopCapabilityInvokeRequest {
76
+ capabilityId: string;
77
+ operationId: string;
78
+ payload?: unknown;
79
+ }
80
+
81
+ export interface DesktopCapabilitySubscribeRequest extends DesktopCapabilityInvokeRequest {
82
+ subscriptionId: string;
83
+ }
84
+
85
+ export interface DesktopBackendRequestMap {
86
+ init: {
87
+ request: { kind?: "main" | "detached"; paneId?: string };
88
+ response: ElectrobunBackendInit;
89
+ };
90
+ "http.fetch": { request: DesktopHttpFetchRequest; response: DesktopHttpFetchResponse };
91
+ "media.resolveLiveStream": { request: LiveStreamResolveRequest; response: ResolvedLiveStream };
92
+ "remote.forward": { request: { request: RemoteControlRequest }; response: RemoteControlResponse };
93
+ "capability.invoke": { request: DesktopCapabilityInvokeRequest; response: unknown };
94
+ "capability.subscribe": { request: DesktopCapabilitySubscribeRequest; response: null };
95
+ "capability.unsubscribe": { request: { subscriptionId: string }; response: null };
96
+ "desktop.syncMainState": { request: { snapshot: DesktopSharedStateSnapshot }; response: null };
97
+ "desktop.setThemePreview": { request: { preview: DesktopThemePreviewState }; response: null };
98
+ "desktop.replaceDetachedPaneState": {
99
+ request: { paneId: string; paneState: PaneRuntimeState };
100
+ response: null;
101
+ };
102
+ "desktop.popOutPane": { request: { paneId: string }; response: null };
103
+ "desktop.dockDetachedPane": {
104
+ request: { paneId: string; edge?: "left" | "right" | "top" | "bottom" };
105
+ response: null;
106
+ };
107
+ "desktop.closeDetachedPane": { request: { paneId: string }; response: null };
108
+ "desktop.focusDetachedPane": { request: { paneId: string }; response: null };
109
+ "pluginState.set": { request: DesktopPluginStateSetEntry; response: null };
110
+ "pluginState.setMany": { request: { entries: DesktopPluginStateSetEntry[] }; response: null };
111
+ "pluginState.delete": { request: { pluginId: string; key: string }; response: null };
112
+ "host.restart": { request: DesktopRestartMessage; response: null };
113
+ "host.exit": { request: null; response: null };
114
+ "host.windowControl": { request: { action: DesktopWindowControlAction }; response: null };
115
+ "host.openExternal": { request: { url: string }; response: null };
116
+ "host.copyText": { request: { text: string }; response: null };
117
+ "host.focusWindow": { request: null; response: null };
118
+ "host.copyPngImage": { request: { pngBase64: string }; response: null };
119
+ "host.readText": { request: null; response: string };
120
+ "host.notify": {
121
+ request: { title?: string; body?: string; subtitle?: string; sound?: string };
122
+ response: null;
123
+ };
124
+ "host.showContextMenu": { request: { menu: DesktopContextMenuItem[] }; response: boolean };
125
+ "update.check": { request: { currentVersion: string }; response: UpdateCheckResult };
126
+ "update.start": { request: { release: ReleaseInfo; currentVersion?: string }; response: null };
127
+ "ticker.loadAll": { request: null; response: TickerRecord[] };
128
+ "ticker.load": { request: { symbol: string }; response: TickerRecord | null };
129
+ "ticker.save": { request: { ticker: TickerRecord }; response: null };
130
+ "ticker.delete": { request: { symbol: string }; response: null };
131
+ "config.save": { request: { config: AppConfig }; response: null };
132
+ "config.resetAllData": { request: { dataDir: string }; response: null };
133
+ "config.export": { request: { config: AppConfig; destPath: string }; response: null };
134
+ "config.import": { request: { dataDir: string; srcPath: string }; response: AppConfig };
135
+ "session.set": {
136
+ request: { sessionId: string; value: unknown; schemaVersion?: number };
137
+ response: null;
138
+ };
139
+ "session.delete": { request: { sessionId: string }; response: null };
140
+ }
141
+
142
+ export type DesktopBackendRequestMethod = keyof DesktopBackendRequestMap;
143
+ export type DesktopBackendRequestPayload<K extends DesktopBackendRequestMethod> =
144
+ DesktopBackendRequestMap[K]["request"];
145
+ export type DesktopBackendRequestResponse<K extends DesktopBackendRequestMethod> =
146
+ DesktopBackendRequestMap[K]["response"];
147
+ export type DesktopBackendRequestFor<K extends DesktopBackendRequestMethod> = {
148
+ [Method in K]: {
149
+ method: Method;
150
+ payload: DesktopBackendRequestPayload<Method>;
151
+ };
152
+ }[K];
153
+ export type DesktopBackendRequest = DesktopBackendRequestFor<DesktopBackendRequestMethod>;
154
+ export type DesktopBackendRequestArgs<K extends DesktopBackendRequestMethod> =
155
+ null extends DesktopBackendRequestPayload<K>
156
+ ? [payload?: DesktopBackendRequestPayload<K>]
157
+ : [payload: DesktopBackendRequestPayload<K>];
158
+
159
+ export type DesktopCapabilityRequest = DesktopBackendRequestFor<Extract<DesktopBackendRequestMethod, `capability.${string}`>>;
160
+ export type DesktopWorkspaceRequest = DesktopBackendRequestFor<Extract<DesktopBackendRequestMethod, `desktop.${string}`>>;
161
+ export type DesktopPluginStateRequest = DesktopBackendRequestFor<Extract<DesktopBackendRequestMethod, `pluginState.${string}`>>;
162
+ export type DesktopHostRequest = DesktopBackendRequestFor<Extract<DesktopBackendRequestMethod, `host.${string}`>>;
163
+ export type DesktopCoreRequest = DesktopBackendRequestFor<
164
+ Extract<DesktopBackendRequestMethod, `update.${string}` | `ticker.${string}` | `config.${string}` | `session.${string}`>
165
+ >;
166
+
23
167
  interface BackendRequestPayload {
24
- method: string;
168
+ method: DesktopBackendRequestMethod;
25
169
  payload?: unknown;
26
170
  }
27
171
 
@@ -55,11 +199,6 @@ export interface CapabilityEventMessage {
55
199
  event: unknown;
56
200
  }
57
201
 
58
- export interface DesktopRestartMessage {
59
- reason?: string;
60
- source?: string;
61
- }
62
-
63
202
  export interface DesktopDeepLinkMessage {
64
203
  url: string;
65
204
  }
@@ -3,8 +3,7 @@ import { createRemoteBrokerAdapter } from "../../../brokers/remote-broker-adapte
3
3
  import { NewsService } from "../../../news/aggregator";
4
4
  import { setSharedNewsService } from "../../../news/hooks";
5
5
  import { PluginRegistry } from "../../../plugins/registry";
6
- import type { AppServices } from "../../../core/app-services";
7
- import type { AppConfig } from "../../../types/config";
6
+ import type { AppRuntimeServices, AppServicesFactoryOptions } from "../../../core/app-service-ports";
8
7
  import { newsProvider } from "../../../capabilities";
9
8
  import { debugLog } from "../../../utils/debug-log";
10
9
  import { measurePerf, measurePerfAsync } from "../../../utils/perf-marks";
@@ -15,7 +14,7 @@ import { RemoteTickerRepository } from "./remote/ticker-repository";
15
14
 
16
15
  const servicesLog = debugLog.createLogger("services");
17
16
 
18
- export function createAppServices({ config }: { config: AppConfig }): AppServices {
17
+ export function createElectrobunAppServices({ config }: AppServicesFactoryOptions): AppRuntimeServices {
19
18
  servicesLog.info("create desktop web services start", {
20
19
  brokerInstanceCount: config.brokerInstances.length,
21
20
  });
@@ -23,7 +22,7 @@ export function createAppServices({ config }: { config: AppConfig }): AppService
23
22
  const tickerRepository = measurePerf("startup.services.ticker-repository", () => new RemoteTickerRepository());
24
23
  const dataProvider = measurePerf("startup.services.data-provider", () => createRemoteAssetDataClient());
25
24
  const marketData = new MarketDataCoordinator(dataProvider);
26
- const pluginRegistry = new PluginRegistry(dataProvider, tickerRepository as never, persistence as never, {
25
+ const pluginRegistry = new PluginRegistry(dataProvider, tickerRepository, persistence, {
27
26
  enableCapabilityHandlers: false,
28
27
  wrapBrokerAdapter: (broker) => createRemoteBrokerAdapter(broker),
29
28
  });
@@ -59,13 +58,11 @@ export function createAppServices({ config }: { config: AppConfig }): AppService
59
58
  servicesLog.info("create desktop web services complete", { pluginCount: plugins.length });
60
59
 
61
60
  return {
62
- persistence: persistence as never,
63
- tickerRepository: tickerRepository as never,
64
- providerRouter: dataProvider as never,
61
+ persistence,
62
+ tickerRepository,
65
63
  dataProvider,
66
64
  marketData,
67
65
  pluginRegistry,
68
- newsService,
69
66
  ready: Promise.all(pluginReadyPromises).then(() => {}),
70
67
  destroy() {
71
68
  setSharedMarketDataCoordinator(null);
@@ -1,10 +1,13 @@
1
- /// <reference lib="dom" />
2
1
  import { Electroview } from "electrobun/view";
3
2
  import {
4
3
  type ApplicationMenuSelectMessage,
5
4
  type CapabilityEventMessage,
6
5
  type ContextMenuSelectMessage,
7
6
  type DesktopDeepLinkMessage,
7
+ type DesktopBackendRequestArgs,
8
+ type DesktopBackendRequestMethod,
9
+ type DesktopBackendRequestPayload,
10
+ type DesktopBackendRequestResponse,
8
11
  type DesktopDockPreviewMessage,
9
12
  type DesktopRestartMessage,
10
13
  type DesktopStateMessage,
@@ -155,21 +158,28 @@ async function waitForBridgeReady(): Promise<void> {
155
158
  throw new Error("Electrobun RPC socket did not open in time.");
156
159
  }
157
160
 
158
- export async function backendRequest<T = unknown>(method: string, payload: unknown = null): Promise<T> {
161
+ export function backendRequest<T = unknown>(
162
+ method: "capability.invoke",
163
+ payload: DesktopBackendRequestPayload<"capability.invoke">,
164
+ ): Promise<T>;
165
+ export function backendRequest<K extends Exclude<DesktopBackendRequestMethod, "capability.invoke">>(
166
+ method: K,
167
+ ...args: DesktopBackendRequestArgs<K>
168
+ ): Promise<DesktopBackendRequestResponse<K>>;
169
+ export async function backendRequest(
170
+ method: DesktopBackendRequestMethod,
171
+ payload: unknown = null,
172
+ ): Promise<unknown> {
159
173
  await waitForBridgeReady();
160
174
  const result = await rpc.request["backend.request"]({
161
175
  method,
162
176
  payload: encodeRpcValue(payload),
163
177
  });
164
- return decodeRpcValue<T>(result);
165
- }
166
-
167
- export function requestMainWindowRemoteControl(request: RemoteControlRequest): Promise<RemoteControlResponse> {
168
- return backendRequest("remote.forward", { request });
178
+ return decodeRpcValue(result);
169
179
  }
170
180
 
171
181
  export async function initElectrobunBackend(payload?: { kind?: "main" | "detached"; paneId?: string }): Promise<ElectrobunBackendInit> {
172
- initSnapshot = await backendRequest<ElectrobunBackendInit>("init", payload ?? null);
182
+ initSnapshot = await backendRequest("init", payload ?? {});
173
183
  return initSnapshot;
174
184
  }
175
185
 
@@ -39,12 +39,12 @@ function invokeBrokerCapability<T>(operationId: string, payload: unknown): Promi
39
39
  });
40
40
  }
41
41
 
42
- function subscribeBrokerCapability(
42
+ async function subscribeBrokerCapability(
43
43
  subscriptionId: string,
44
44
  operationId: string,
45
45
  payload: unknown,
46
46
  ): Promise<void> {
47
- return backendRequest("capability.subscribe", {
47
+ await backendRequest("capability.subscribe", {
48
48
  subscriptionId,
49
49
  capabilityId: BROKER_CAPABILITY_ID,
50
50
  operationId,
@@ -1,4 +1,3 @@
1
- /// <reference lib="dom" />
2
1
  /** @jsxImportSource react */
3
2
  import { createRoot } from "react-dom/client";
4
3
  import { useEffect, type ComponentType, type ReactNode } from "react";
@@ -23,21 +22,21 @@ import { FloatingPaneWrapper } from "../../../components/layout/floating-pane";
23
22
  import { PaneContent } from "../../../components/layout/pane/content";
24
23
  import { resolvePaneBodyFrame } from "../../../components/layout/pane/sizing";
25
24
  import { getPaneDisplayTitle } from "../../../components/layout/pane/title";
26
- import { subtractTimeRange } from "../../../components/chart/core/date-window";
27
25
  import {
28
26
  getPresetResolution,
29
27
  normalizeChartResolutionSupport,
30
28
  TIME_RANGE_ORDER,
31
- } from "../../../components/chart/core/resolution";
29
+ } from "../../../time-series/resolution";
32
30
  import type { TimeRange } from "../../../components/chart/core/types";
33
31
  import type { AppConfig } from "../../../types/config";
34
32
  import type { CachedFinancialsTarget, DataProvider, QuoteSubscriptionTarget } from "../../../types/data-provider";
35
- import type { OptionsChain, PricePoint, TickerFinancials } from "../../../types/financials";
33
+ import type { OptionsChain, TickerFinancials } from "../../../types/financials";
36
34
  import type { TickerRecord } from "../../../types/ticker";
37
35
  import type { AppState, PaneRuntimeState } from "../../../core/state/app/state";
38
36
  import type { PaneDef } from "../../../types/plugin";
39
37
  import { canonicalTickerKey, parsePublicTickerKey } from "../../../utils/exchanges";
40
38
  import { hydrateFredSeries, type FredSeriesCacheEntry } from "../../../data/fred-series";
39
+ import { clipPriceHistoryToRange } from "../../../time-series/history-window";
41
40
 
42
41
  interface CliPaneShotPayload {
43
42
  config: AppConfig;
@@ -98,22 +97,6 @@ function normalizeSymbol(value: string): string {
98
97
  return value.trim().replace(/^\$/, "").toUpperCase();
99
98
  }
100
99
 
101
- function clipShotPriceHistory(points: PricePoint[], range: TimeRange): PricePoint[] {
102
- if (range === "ALL" || points.length === 0) return points;
103
- const dated = points.flatMap((point) => {
104
- const date = point.date instanceof Date ? point.date : new Date(point.date);
105
- return Number.isFinite(date.getTime()) ? [{ point, date }] : [];
106
- });
107
- const end = dated.reduce<Date | null>((latest, entry) => (
108
- !latest || entry.date.getTime() > latest.getTime() ? entry.date : latest
109
- ), null);
110
- if (!end) return [];
111
- const start = subtractTimeRange(end, range);
112
- return dated
113
- .filter(({ date }) => date.getTime() >= start.getTime() && date.getTime() <= end.getTime())
114
- .map(({ point }) => point);
115
- }
116
-
117
100
  function updatePendingShotWork(next: number): void {
118
101
  pendingShotWork = Math.max(0, next);
119
102
  window.__GLOOM_CLI_SHOT_PENDING__ = pendingShotWork;
@@ -294,12 +277,12 @@ function createShotDataProvider(payload: CliPaneShotPayload): DataProvider {
294
277
  },
295
278
  getPriceHistory(ticker, exchange, range) {
296
279
  return trackShotWork(Promise.resolve().then(() => (
297
- clipShotPriceHistory(getFinancials(ticker, exchange).priceHistory ?? [], range)
280
+ clipPriceHistoryToRange(getFinancials(ticker, exchange).priceHistory ?? [], range)
298
281
  )));
299
282
  },
300
283
  getPriceHistoryForResolution(ticker, exchange, bufferRange) {
301
284
  return trackShotWork(Promise.resolve().then(() => (
302
- clipShotPriceHistory(getFinancials(ticker, exchange).priceHistory ?? [], bufferRange)
285
+ clipPriceHistoryToRange(getFinancials(ticker, exchange).priceHistory ?? [], bufferRange)
303
286
  )));
304
287
  },
305
288
  getChartResolutionSupport() {
@@ -26,7 +26,7 @@ const electrobunConfigStoreHost: ConfigStoreHost = {
26
26
  await backendRequest("config.export", { config, destPath });
27
27
  },
28
28
  async importConfig(dataDir: string, srcPath: string) {
29
- return backendRequest<AppConfig>("config.import", { dataDir, srcPath });
29
+ return backendRequest("config.import", { dataDir, srcPath });
30
30
  },
31
31
  };
32
32
 
@@ -1,21 +1,5 @@
1
1
  import type { ContextMenuActionItem, ContextMenuItem, ContextMenuRoleItem } from "../../../types/context-menu";
2
- import { ELECTROBUN_CONTEXT_MENU_ACTION } from "../shared/protocol";
3
-
4
- type DesktopContextMenuItem =
5
- | { type: "divider" }
6
- | {
7
- type?: "normal";
8
- label?: string;
9
- tooltip?: string;
10
- action?: string;
11
- role?: string;
12
- data?: unknown;
13
- submenu?: DesktopContextMenuItem[];
14
- enabled?: boolean;
15
- checked?: boolean;
16
- hidden?: boolean;
17
- accelerator?: string;
18
- };
2
+ import { ELECTROBUN_CONTEXT_MENU_ACTION, type DesktopContextMenuItem } from "../shared/protocol";
19
3
 
20
4
  export interface PreparedDesktopContextMenu {
21
5
  menu: DesktopContextMenuItem[];
@@ -1,4 +1,3 @@
1
- /// <reference lib="dom" />
2
1
  /** @jsxImportSource react */
3
2
  import { useVirtualizer } from "@tanstack/react-virtual";
4
3
  import {
@@ -1,8 +1,6 @@
1
- /// <reference lib="dom" />
2
1
  /** @jsxImportSource react */
3
2
  import { memo, type CSSProperties } from "react";
4
3
  import { TextAttributes } from "../../../../ui/host";
5
- import { useThemeColors } from "../../../../theme/theme-context";
6
4
  import type {
7
5
  DataTableCell,
8
6
  DataTableColumn,
@@ -72,7 +70,6 @@ export function WebDataTableHeader<C extends DataTableColumn>({
72
70
  sortColumnId: string | null;
73
71
  sortDirection: "asc" | "desc";
74
72
  }) {
75
- useThemeColors();
76
73
  return (
77
74
  <div
78
75
  data-gloom-role="data-table-header-row"
@@ -183,7 +180,6 @@ function WebDataTableRowInner<
183
180
  rowContextMenuSurface: boolean;
184
181
  selected: boolean;
185
182
  }) {
186
- useThemeColors();
187
183
  const sectionHeader: DataTableSectionHeader | null =
188
184
  renderSectionHeader?.(item, index) ?? null;
189
185
  const baseRowStyle: CSSProperties = {
@@ -1,77 +1,80 @@
1
1
  import type { ButtonProps } from "../../../../components/ui/button";
2
- import { blendHex, colors } from "../../../../theme/colors";
2
+ import { blendHex, colors, type ThemeColors } from "../../../../theme/colors";
3
3
 
4
4
  export const CONTROL_RADIUS = 6;
5
5
 
6
- export function panelBorder(): string {
7
- return blendHex(colors.border, colors.borderFocused, 0.18);
6
+ export function panelBorder(palette: ThemeColors = colors): string {
7
+ return blendHex(palette.border, palette.borderFocused, 0.18);
8
8
  }
9
9
 
10
- export function panelFill(): string {
11
- return blendHex(colors.panel, colors.bg, 0.22);
10
+ export function panelFill(palette: ThemeColors = colors): string {
11
+ return blendHex(palette.panel, palette.bg, 0.22);
12
12
  }
13
13
 
14
- export function subtlePanelFill(): string {
15
- return blendHex(colors.panel, colors.bg, 0.42);
14
+ export function subtlePanelFill(palette: ThemeColors = colors): string {
15
+ return blendHex(palette.panel, palette.bg, 0.42);
16
16
  }
17
17
 
18
- export function selectedPanelFill(): string {
19
- return blendHex(colors.selected, colors.bg, 0.42);
18
+ export function selectedPanelFill(palette: ThemeColors = colors): string {
19
+ return blendHex(palette.selected, palette.bg, 0.42);
20
20
  }
21
21
 
22
- export function controlBorderColor(focused = false, active = false): string {
23
- if (active) return colors.borderFocused;
24
- if (focused) return blendHex(colors.borderFocused, colors.textBright, 0.24);
25
- return panelBorder();
22
+ export function controlBorderColor(focused = false, active = false, palette: ThemeColors = colors): string {
23
+ if (active) return palette.borderFocused;
24
+ if (focused) return blendHex(palette.borderFocused, palette.textBright, 0.24);
25
+ return panelBorder(palette);
26
26
  }
27
27
 
28
- export function controlShadow(active = false): string {
28
+ export function controlShadow(active = false, palette: ThemeColors = colors): string {
29
29
  return active
30
- ? `0 0 0 1px ${blendHex(colors.bg, colors.borderFocused, 0.18)}, inset 0 1px 0 ${blendHex(colors.bg, colors.textBright, 0.06)}`
31
- : `inset 0 1px 0 ${blendHex(colors.bg, colors.textBright, 0.04)}`;
30
+ ? `0 0 0 1px ${blendHex(palette.bg, palette.borderFocused, 0.18)}, inset 0 1px 0 ${blendHex(palette.bg, palette.textBright, 0.06)}`
31
+ : `inset 0 1px 0 ${blendHex(palette.bg, palette.textBright, 0.04)}`;
32
32
  }
33
33
 
34
- export function buttonPalette(props: Pick<ButtonProps, "variant" | "active" | "disabled">) {
34
+ export function buttonPalette(
35
+ props: Pick<ButtonProps, "variant" | "active" | "disabled">,
36
+ palette: ThemeColors = colors,
37
+ ) {
35
38
  if (props.disabled) {
36
39
  return {
37
- fg: colors.textMuted,
38
- bg: subtlePanelFill(),
39
- border: panelBorder(),
40
+ fg: palette.textMuted,
41
+ bg: subtlePanelFill(palette),
42
+ border: panelBorder(palette),
40
43
  };
41
44
  }
42
45
  if (props.active) {
43
46
  return {
44
- fg: colors.selectedText,
45
- bg: colors.selected,
46
- border: colors.borderFocused,
47
+ fg: palette.selectedText,
48
+ bg: palette.selected,
49
+ border: palette.borderFocused,
47
50
  };
48
51
  }
49
52
 
50
53
  switch (props.variant) {
51
54
  case "primary":
52
55
  return {
53
- fg: colors.bg,
54
- bg: colors.borderFocused,
55
- border: colors.borderFocused,
56
+ fg: palette.bg,
57
+ bg: palette.borderFocused,
58
+ border: palette.borderFocused,
56
59
  };
57
60
  case "danger":
58
61
  return {
59
- fg: colors.bg,
60
- bg: colors.negative,
61
- border: colors.negative,
62
+ fg: palette.bg,
63
+ bg: palette.negative,
64
+ border: palette.negative,
62
65
  };
63
66
  case "ghost":
64
67
  return {
65
- fg: colors.textDim,
68
+ fg: palette.textDim,
66
69
  bg: "transparent",
67
- border: panelBorder(),
70
+ border: panelBorder(palette),
68
71
  };
69
72
  case "secondary":
70
73
  default:
71
74
  return {
72
- fg: colors.text,
73
- bg: panelFill(),
74
- border: panelBorder(),
75
+ fg: palette.text,
76
+ bg: panelFill(palette),
77
+ border: panelBorder(palette),
75
78
  };
76
79
  }
77
80
  }