gloomberb 0.10.4 → 0.11.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.
- package/LICENSE +1 -1
- package/README.md +30 -3
- package/README.zh-CN.md +1 -1
- package/package.json +5 -5
- package/src/api-client/auth.ts +34 -0
- package/src/api-client/data.ts +25 -0
- package/src/api-client/index.test.ts +81 -0
- package/src/api-client/index.ts +37 -0
- package/src/api-client/request.test.ts +30 -0
- package/src/api-client/request.ts +44 -20
- package/src/api-client/socket-health.test.ts +79 -0
- package/src/api-client/socket.ts +108 -5
- package/src/api-client/types.ts +139 -0
- package/src/app/global-shortcuts.test.tsx +144 -9
- package/src/app/global-shortcuts.ts +33 -11
- package/src/app/runtime/broker-import.ts +39 -5
- package/src/app/runtime/startup.ts +7 -1
- package/src/app/runtime/update.ts +26 -1
- package/src/app.tsx +36 -19
- package/src/brokers/broker-ticker-sync.ts +3 -8
- package/src/brokers/sync-broker-instance.test.ts +59 -0
- package/src/brokers/sync-broker-instance.ts +37 -13
- package/src/capabilities/chart-series.ts +318 -0
- package/src/capabilities/factories.ts +46 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/registry.test.ts +135 -0
- package/src/capabilities/registry.ts +31 -4
- package/src/capabilities/types.ts +52 -0
- package/src/cli/commands/overview.ts +2 -2
- package/src/cli/desktop-pane-shot.ts +2 -0
- package/src/cli/entry.ts +11 -1
- package/src/cli/native-smoke.ts +5 -0
- package/src/cli/pane-functions/catalog.ts +4 -0
- package/src/cli/pane-functions/data.ts +6 -1
- package/src/cli/pane-functions/discovery.ts +76 -10
- package/src/cli/pane-functions/report.test.ts +76 -0
- package/src/cli/pane-functions/report.ts +7 -1
- package/src/cli/pane-functions/resolver.ts +4 -1
- package/src/cli/pane-functions/screenshot.test.ts +56 -3
- package/src/cli/pane-functions/screenshot.ts +68 -5
- package/src/components/chart/composite/composite-chart.test.tsx +54 -0
- package/src/components/chart/composite/composite-chart.tsx +92 -15
- package/src/components/chart/composite/downsample.test.ts +136 -0
- package/src/components/chart/composite/downsample.ts +208 -0
- package/src/components/chart/composite/panel-series.test.ts +66 -0
- package/src/components/chart/composite/panel-series.ts +101 -0
- package/src/components/chart/multi-line/renderer.ts +1 -0
- package/src/components/chart/native/kitty/index.test.ts +25 -3
- package/src/components/chart/native/kitty/support.ts +37 -3
- package/src/components/chart/native/use-chart-text-fallback.ts +19 -0
- package/src/components/chart/static/chart/surface.tsx +43 -12
- package/src/components/chart/static/multi-line-chart-surface.tsx +41 -5
- package/src/components/command-bar/commands/direct/index.ts +18 -0
- package/src/components/command-bar/commands/registry.ts +14 -0
- package/src/components/command-bar/routes/root/article-results.test.ts +83 -0
- package/src/components/command-bar/routes/root/article-results.ts +55 -0
- package/src/components/command-bar/routes/root/command-items.ts +3 -0
- package/src/components/command-bar/routes/root/provider-search.ts +7 -3
- package/src/components/command-bar/routes/root/results.ts +38 -11
- package/src/components/command-bar/routes/root/runtime.ts +6 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +1 -1
- package/src/components/command-bar/routes/ticker-search/results.test.ts +34 -0
- package/src/components/command-bar/routes/ticker-search/results.ts +4 -6
- package/src/components/command-bar/routes/ticker-search/route.ts +2 -2
- package/src/components/command-bar/routing/list-state.ts +2 -1
- package/src/components/command-bar/surface/assist.test.tsx +13 -6
- package/src/components/command-bar/surface/index.test.tsx +65 -0
- package/src/components/command-bar/surface/index.tsx +35 -0
- package/src/components/command-bar/view-model.test.ts +43 -0
- package/src/components/command-bar/view-model.ts +41 -4
- package/src/components/command-bar/workflow/collection-actions.test.ts +94 -0
- package/src/components/command-bar/workflow/collection-actions.ts +14 -3
- package/src/components/command-bar/workflow/ops.test.ts +136 -0
- package/src/components/command-bar/workflow/ops.ts +71 -1
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.test.tsx +35 -0
- package/src/components/layout/header.tsx +101 -9
- package/src/components/layout/pane/cycle-order.test.ts +0 -1
- package/src/components/layout/pane/footer/index.test.tsx +19 -19
- package/src/components/layout/pane/header.tsx +2 -13
- package/src/components/layout/shell/index.tsx +3 -0
- package/src/components/layout/status-bar.test.tsx +36 -1
- package/src/components/layout/status-bar.tsx +48 -2
- package/src/components/onboarding/account-step/chooser-panel.tsx +27 -50
- package/src/components/onboarding/account-step/form-panel.tsx +85 -29
- package/src/components/onboarding/account-step/index.tsx +10 -1
- package/src/components/onboarding/account-step/model.ts +3 -3
- package/src/components/onboarding/account-step/qr-panel.tsx +68 -0
- package/src/components/onboarding/account-step/signed-in-panel.tsx +4 -7
- package/src/components/onboarding/onboarding-frame.tsx +517 -0
- package/src/components/onboarding/onboarding-steps.tsx +0 -264
- package/src/components/onboarding/onboarding-wizard.test.tsx +626 -200
- package/src/components/onboarding/onboarding-wizard.tsx +848 -266
- package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +81 -51
- package/src/components/onboarding/portfolio-step/broker-setup-panel.tsx +14 -20
- package/src/components/onboarding/portfolio-step/broker-sync-panel.tsx +8 -11
- package/src/components/onboarding/portfolio-step/choose-panel.tsx +18 -22
- package/src/components/onboarding/portfolio-step/index.tsx +3 -0
- package/src/components/onboarding/portfolio-step/types.ts +3 -0
- package/src/components/onboarding/wizard-account.ts +38 -3
- package/src/components/onboarding/wizard-broker-sync.ts +45 -67
- package/src/components/onboarding/wizard-model.ts +18 -2
- package/src/components/ui/data-table/opentui/index.tsx +29 -9
- package/src/components/ui/data-table/types.ts +2 -0
- package/src/components/ui/external-link.tsx +4 -2
- package/src/components/ui/loading.tsx +1 -1
- package/src/components/ui/status.tsx +76 -4
- package/src/components/ui/table-layout.test.ts +24 -0
- package/src/components/ui/table-layout.ts +90 -23
- package/src/components/ui/tabs.tsx +86 -4
- package/src/core/app-services.ts +14 -3
- package/src/core/connection-health.test.ts +143 -0
- package/src/core/connection-health.ts +295 -0
- package/src/core/state/app/layout-reducer.ts +34 -0
- package/src/core/state/app/layout.ts +21 -0
- package/src/core/state/app/state.ts +10 -0
- package/src/core/state/app/types.ts +7 -1
- package/src/data/config/chart-settings.ts +11 -2
- package/src/data/config/store/index.test.ts +83 -9
- package/src/data/config/store/migrations.ts +16 -0
- package/src/data/config/store/normalize.ts +59 -1
- package/src/data/fred-series.ts +8 -2
- package/src/i18n/es.ts +126 -0
- package/src/i18n/ja.ts +126 -0
- package/src/i18n/ko.ts +126 -0
- package/src/i18n/zh-cn.ts +126 -0
- package/src/i18n/zh-tw.ts +126 -0
- package/src/market-data/coordinator/chart.ts +3 -2
- package/src/market-data/hooks.tsx +3 -2
- package/src/market-data/market/status.test.ts +12 -0
- package/src/market-data/market/status.ts +34 -17
- package/src/news/aggregator.test.ts +39 -0
- package/src/news/aggregator.ts +78 -22
- package/src/news/hooks.ts +4 -0
- package/src/notifications/app-notifier.test.ts +28 -6
- package/src/notifications/app-notifier.ts +24 -5
- package/src/plugins/broker-sync/broker-sync.test.ts +130 -0
- package/src/plugins/broker-sync/native-loader.ts +10 -0
- package/src/plugins/broker-sync/normalize.ts +271 -0
- package/src/plugins/broker-sync/public.ts +122 -0
- package/src/plugins/broker-sync/robinhood-native.ts +367 -0
- package/src/plugins/broker-sync/robinhood.ts +114 -0
- package/src/plugins/broker-sync/simplefin-native.ts +201 -0
- package/src/plugins/broker-sync/simplefin.ts +70 -0
- package/src/plugins/builtin/account-management/footer.ts +8 -19
- package/src/plugins/builtin/account-management/pane.tsx +13 -8
- package/src/plugins/builtin/ai/pi/host.ts +6 -5
- package/src/plugins/builtin/ai/providers.ts +1 -1
- package/src/plugins/builtin/ai/screener/footer.ts +0 -7
- package/src/plugins/builtin/ai/screener/pane.test.tsx +2 -1
- package/src/plugins/builtin/ai/screener/pane.tsx +3 -1
- package/src/plugins/builtin/ai/screener/results-view.tsx +8 -0
- package/src/plugins/builtin/ai/screener/runner.ts +7 -3
- package/src/plugins/builtin/ai/workspace/pane.tsx +13 -2
- package/src/plugins/builtin/alerts/alert-engine.ts +13 -0
- package/src/plugins/builtin/alerts/constants.ts +2 -1
- package/src/plugins/builtin/alerts/index.tsx +67 -36
- package/src/plugins/builtin/alerts/pane.tsx +17 -65
- package/src/plugins/builtin/analytics/index.tsx +24 -11
- package/src/plugins/builtin/analytics/pane-model.ts +48 -14
- package/src/plugins/builtin/analytics/portfolio-selection.ts +19 -0
- package/src/plugins/builtin/analytics/view.tsx +5 -3
- package/src/plugins/builtin/broker-manager/detail.tsx +7 -2
- package/src/plugins/builtin/broker-manager/footer.ts +4 -9
- package/src/plugins/builtin/broker-manager/index.tsx +1 -6
- package/src/plugins/builtin/buildout/detail/ui.tsx +15 -4
- package/src/plugins/builtin/buildout/pane/header.tsx +1 -0
- package/src/plugins/builtin/changelog/index.tsx +60 -45
- package/src/plugins/builtin/chart-composer/catalog-inventory.test.ts +97 -0
- package/src/plugins/builtin/chart-composer/catalog-inventory.ts +366 -0
- package/src/plugins/builtin/chart-composer/chart-spec.ts +21 -1
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +307 -0
- package/src/plugins/builtin/chart-composer/editor/controller.ts +1 -1
- package/src/plugins/builtin/chart-composer/index.tsx +45 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +7 -88
- package/src/plugins/builtin/chart-composer/presets.test.ts +48 -0
- package/src/plugins/builtin/chart-composer/presets.ts +69 -3
- package/src/plugins/builtin/chart-composer/quick-add.tsx +8 -5
- package/src/plugins/builtin/chart-composer/semantic.ts +18 -14
- package/src/plugins/builtin/chart-composer/series-catalog.test.ts +39 -0
- package/src/plugins/builtin/chart-composer/series-catalog.ts +104 -3
- package/src/plugins/builtin/chart-composer/shortcuts.test.ts +10 -10
- package/src/plugins/builtin/chart-composer/shortcuts.ts +4 -12
- package/src/plugins/builtin/chart-composer/use-series-catalog.ts +230 -23
- package/src/plugins/builtin/chat/chat.test.tsx +22 -0
- package/src/plugins/builtin/chat/content/composer.tsx +6 -4
- package/src/plugins/builtin/chat/content/index.tsx +7 -0
- package/src/plugins/builtin/chat/content/snapshot.ts +9 -2
- package/src/plugins/builtin/chat/content/transcript.tsx +10 -0
- package/src/plugins/builtin/chat/controller/channel-actions.ts +11 -1
- package/src/plugins/builtin/chat/controller/channels.ts +13 -3
- package/src/plugins/builtin/chat/controller/index.ts +61 -7
- package/src/plugins/builtin/chat/controller/lifecycle.ts +3 -0
- package/src/plugins/builtin/chat/controller/message-loading.ts +5 -1
- package/src/plugins/builtin/chat/controller/messages.ts +3 -1
- package/src/plugins/builtin/chat/controller/notifications.ts +32 -11
- package/src/plugins/builtin/chat/controller/state.ts +7 -0
- package/src/plugins/builtin/chat/controller/view.ts +1 -0
- package/src/plugins/builtin/chat/controller.test.ts +117 -28
- package/src/plugins/builtin/cloud/auth-commands.ts +18 -0
- package/src/plugins/builtin/cloud/device-signin-dialog.tsx +243 -0
- package/src/plugins/builtin/cloud/device-signin.test.ts +217 -0
- package/src/plugins/builtin/cloud/device-signin.ts +240 -0
- package/src/plugins/builtin/cloud/plugin.tsx +7 -1
- package/src/plugins/builtin/cloud-tweets/table.tsx +57 -10
- package/src/plugins/builtin/composite-plugins.ts +39 -5
- package/src/plugins/builtin/congress-trades/detail.tsx +2 -4
- package/src/plugins/builtin/congress-trades/footer.ts +7 -16
- package/src/plugins/builtin/congress-trades/pane.tsx +12 -20
- package/src/plugins/builtin/connections/index.ts +53 -0
- package/src/plugins/builtin/connections/pane.test.tsx +79 -0
- package/src/plugins/builtin/connections/pane.tsx +258 -0
- package/src/plugins/builtin/correlation/index.test.tsx +2 -1
- package/src/plugins/builtin/correlation/index.tsx +58 -19
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -7
- package/src/plugins/builtin/correlation/relationship/pane.tsx +43 -19
- package/src/plugins/builtin/correlation/settings.ts +1 -1
- package/src/plugins/builtin/credit-conditions/client.test.ts +80 -0
- package/src/plugins/builtin/credit-conditions/client.ts +105 -0
- package/src/plugins/builtin/credit-conditions/index.test.tsx +111 -0
- package/src/plugins/builtin/credit-conditions/index.tsx +227 -0
- package/src/plugins/builtin/credit-conditions/model.test.ts +43 -0
- package/src/plugins/builtin/credit-conditions/model.ts +64 -0
- package/src/plugins/builtin/debug/index.tsx +11 -6
- package/src/plugins/builtin/dividend-yield/client.test.ts +58 -0
- package/src/plugins/builtin/dividend-yield/client.ts +252 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +61 -0
- package/src/plugins/builtin/dividend-yield/model.ts +83 -0
- package/src/plugins/builtin/dividend-yield/pane.tsx +305 -0
- package/src/plugins/builtin/dividend-yield/types.ts +22 -0
- package/src/plugins/builtin/earnings/data/cache.test.ts +10 -7
- package/src/plugins/builtin/earnings/data/cache.ts +23 -9
- package/src/plugins/builtin/earnings/index.tsx +57 -6
- package/src/plugins/builtin/econ/calendar-model.test.ts +37 -3
- package/src/plugins/builtin/econ/calendar-model.ts +32 -26
- package/src/plugins/builtin/econ/fred-cache.test.ts +8 -1
- package/src/plugins/builtin/econ/fred-series-map.ts +18 -0
- package/src/plugins/builtin/econ/index.test.tsx +105 -0
- package/src/plugins/builtin/econ/index.tsx +95 -52
- package/src/plugins/builtin/fear-greed/cache.test.ts +18 -3
- package/src/plugins/builtin/fear-greed/cache.ts +18 -6
- package/src/plugins/builtin/fear-greed/charts.tsx +9 -2
- package/src/plugins/builtin/fear-greed/format.ts +0 -9
- package/src/plugins/builtin/fear-greed/pane.tsx +21 -21
- package/src/plugins/builtin/futures/contracts.ts +100 -0
- package/src/plugins/builtin/futures/index.tsx +298 -0
- package/src/plugins/builtin/futures/model.test.ts +129 -0
- package/src/plugins/builtin/futures/model.ts +136 -0
- package/src/plugins/builtin/futures/pane.test.tsx +239 -0
- package/src/plugins/builtin/futures/table.test.ts +155 -0
- package/src/plugins/builtin/futures/table.tsx +241 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +160 -134
- package/src/plugins/builtin/fx-matrix/pairs.ts +12 -1
- package/src/plugins/builtin/fx-matrix/pane.test.tsx +109 -0
- package/src/plugins/builtin/help/components.tsx +1 -30
- package/src/plugins/builtin/help/index.tsx +5 -25
- package/src/plugins/builtin/holders/pane.tsx +17 -12
- package/src/plugins/builtin/holders/treemap.tsx +4 -2
- package/src/plugins/builtin/insider/index.tsx +20 -10
- package/src/plugins/builtin/ipo-calendar/cache.ts +101 -0
- package/src/plugins/builtin/ipo-calendar/client.test.ts +31 -0
- package/src/plugins/builtin/ipo-calendar/client.ts +296 -0
- package/src/plugins/builtin/ipo-calendar/index.tsx +65 -0
- package/src/plugins/builtin/ipo-calendar/model.ts +145 -0
- package/src/plugins/builtin/ipo-calendar/pane.tsx +328 -0
- package/src/plugins/builtin/ipo-calendar/types.ts +19 -0
- package/src/plugins/builtin/kelly-sizer/index.test.tsx +3 -3
- package/src/plugins/builtin/kelly-sizer/model.ts +8 -1
- package/src/plugins/builtin/kelly-sizer/pane.tsx +33 -15
- package/src/plugins/builtin/kelly-sizer/view.tsx +12 -5
- package/src/plugins/builtin/market-halts/client.ts +114 -0
- package/src/plugins/builtin/market-halts/index.tsx +29 -0
- package/src/plugins/builtin/market-halts/model.test.ts +187 -0
- package/src/plugins/builtin/market-halts/model.ts +291 -0
- package/src/plugins/builtin/market-halts/pane.tsx +256 -0
- package/src/plugins/builtin/market-heatmap/data.test.ts +1 -0
- package/src/plugins/builtin/market-heatmap/data.ts +12 -3
- package/src/plugins/builtin/market-heatmap/index.tsx +131 -46
- package/src/plugins/builtin/market-movers/index.tsx +145 -63
- package/src/plugins/builtin/market-movers/model.ts +19 -3
- package/src/plugins/builtin/market-movers/screener.test.ts +108 -0
- package/src/plugins/builtin/market-movers/screener.ts +168 -10
- package/src/plugins/builtin/news/index.tsx +78 -99
- package/src/plugins/builtin/news/wire/article-search.test.ts +72 -0
- package/src/plugins/builtin/news/wire/article-search.ts +140 -0
- package/src/plugins/builtin/news/wire/breaking/pane.tsx +18 -8
- package/src/plugins/builtin/news/wire/categories.ts +35 -0
- package/src/plugins/builtin/news/wire/default-feeds.ts +47 -1
- package/src/plugins/builtin/news/wire/feed-config.test.ts +10 -5
- package/src/plugins/builtin/news/wire/index.tsx +41 -4
- package/src/plugins/builtin/news/wire/industry-pane.tsx +38 -19
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +10 -5
- package/src/plugins/builtin/news/wire/news/footer.ts +1 -0
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +15 -6
- package/src/plugins/builtin/news/wire/news/query-presets.ts +16 -2
- package/src/plugins/builtin/news/wire/news/table.test.tsx +54 -0
- package/src/plugins/builtin/news/wire/news/table.tsx +111 -17
- package/src/plugins/builtin/notes/files.test.ts +18 -0
- package/src/plugins/builtin/notes/files.ts +10 -4
- package/src/plugins/builtin/notes/index.tsx +4 -1
- package/src/plugins/builtin/notes/quick-notes-pane.test.tsx +182 -0
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +74 -31
- package/src/plugins/builtin/notes/ticker-notes-tab.test.tsx +380 -0
- package/src/plugins/builtin/notes/ticker-notes-tab.tsx +97 -40
- package/src/plugins/builtin/options/calc-seed.test.ts +118 -0
- package/src/plugins/builtin/options/calc-seed.ts +52 -0
- package/src/plugins/builtin/options/footer.ts +4 -1
- package/src/plugins/builtin/options/index.tsx +22 -1
- package/src/plugins/builtin/options/live-quotes.ts +8 -0
- package/src/plugins/builtin/options/table.ts +3 -1
- package/src/plugins/builtin/options/view.test.tsx +5 -1
- package/src/plugins/builtin/options/view.tsx +112 -17
- package/src/plugins/builtin/options-calculator/index.tsx +35 -0
- package/src/plugins/builtin/options-calculator/model.test.ts +172 -0
- package/src/plugins/builtin/options-calculator/model.ts +273 -0
- package/src/plugins/builtin/options-calculator/pane.test.tsx +138 -0
- package/src/plugins/builtin/options-calculator/pane.tsx +218 -0
- package/src/plugins/builtin/plugin-module.test.ts +16 -2
- package/src/plugins/builtin/plugin-module.ts +5 -1
- package/src/plugins/builtin/polls/client.ts +57 -0
- package/src/plugins/builtin/polls/hooks.ts +20 -0
- package/src/plugins/builtin/polls/index.tsx +35 -0
- package/src/plugins/builtin/polls/normalize.test.ts +230 -0
- package/src/plugins/builtin/polls/normalize.ts +319 -0
- package/src/plugins/builtin/polls/pane.tsx +722 -0
- package/src/plugins/builtin/polls/types.ts +77 -0
- package/src/plugins/builtin/portfolio-list/header.tsx +15 -4
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/pane/supplemental.ts +1 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +2 -0
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +40 -67
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +25 -19
- package/src/plugins/builtin/research/index.test.ts +6 -25
- package/src/plugins/builtin/research/index.tsx +11 -5
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +86 -26
- package/src/plugins/builtin/scanner/denied.tsx +31 -0
- package/src/plugins/builtin/scanner/feed.ts +94 -0
- package/src/plugins/builtin/scanner/flow-model.test.ts +85 -0
- package/src/plugins/builtin/scanner/flow-model.ts +133 -0
- package/src/plugins/builtin/scanner/flow-pane.tsx +197 -0
- package/src/plugins/builtin/scanner/hilo-bars.tsx +121 -0
- package/src/plugins/builtin/scanner/hilo-model.test.ts +44 -0
- package/src/plugins/builtin/scanner/hilo-model.ts +75 -0
- package/src/plugins/builtin/scanner/hilo-pane.tsx +165 -0
- package/src/plugins/builtin/scanner/index.ts +109 -0
- package/src/plugins/builtin/scanner/waiting.tsx +11 -0
- package/src/plugins/builtin/sec/index.tsx +11 -7
- package/src/plugins/builtin/sectors/index.tsx +105 -81
- package/src/plugins/builtin/sectors/move-bar.tsx +43 -0
- package/src/plugins/builtin/sectors/sector-data.ts +18 -0
- package/src/plugins/builtin/sectors/sector-model.ts +13 -15
- package/src/plugins/builtin/shared/auto-refresh.ts +51 -0
- package/src/plugins/builtin/shared/cloud-upgrade.ts +29 -5
- package/src/plugins/builtin/shared/pane-footer.ts +16 -3
- package/src/plugins/builtin/shared/screener-live-quotes.test.ts +91 -0
- package/src/plugins/builtin/shared/screener-live-quotes.ts +134 -0
- package/src/plugins/builtin/shared/table-pane.ts +1 -5
- package/src/plugins/builtin/shared/use-quote-board.test.tsx +211 -0
- package/src/plugins/builtin/shared/use-quote-board.ts +195 -0
- package/src/plugins/builtin/short-interest/client.ts +124 -0
- package/src/plugins/builtin/short-interest/index.tsx +62 -0
- package/src/plugins/builtin/short-interest/model.ts +113 -0
- package/src/plugins/builtin/short-interest/pane.tsx +252 -0
- package/src/plugins/builtin/short-interest/types.ts +9 -0
- package/src/plugins/builtin/substack/article-detail.tsx +15 -1
- package/src/plugins/builtin/substack/pane-footer.ts +3 -22
- package/src/plugins/builtin/substack/pane.tsx +1 -2
- package/src/plugins/builtin/thirteenf/api.ts +4 -1
- package/src/plugins/builtin/thirteenf/model.ts +2 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +6 -2
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +10 -4
- package/src/plugins/builtin/ticker-detail/data-panes/provider-search.tsx +67 -11
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +15 -8
- package/src/plugins/builtin/ticker-detail/index.tsx +5 -21
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +72 -32
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +0 -10
- package/src/plugins/builtin/ticker-detail/pane.tsx +4 -1
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.test.tsx +70 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +34 -26
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +96 -49
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +32 -0
- package/src/plugins/builtin/ticker-research-backend-plugin.ts +2 -9
- package/src/plugins/builtin/ticker-research-plugin.ts +6 -0
- package/src/plugins/builtin/treasury-auctions/cache.test.ts +173 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +104 -0
- package/src/plugins/builtin/treasury-auctions/client.test.ts +181 -0
- package/src/plugins/builtin/treasury-auctions/client.ts +151 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +90 -0
- package/src/plugins/builtin/treasury-auctions/model.test.ts +147 -0
- package/src/plugins/builtin/treasury-auctions/model.ts +188 -0
- package/src/plugins/builtin/treasury-auctions/pane.test.tsx +170 -0
- package/src/plugins/builtin/treasury-auctions/pane.tsx +417 -0
- package/src/plugins/builtin/treasury-auctions/types.ts +59 -0
- package/src/plugins/builtin/tv/pane.tsx +67 -7
- package/src/plugins/builtin/tv/youtube-embed.test.ts +84 -0
- package/src/plugins/builtin/tv/youtube-embed.ts +173 -0
- package/src/plugins/builtin/tv/youtube-stream.ts +27 -2
- package/src/plugins/builtin/volatility/client.ts +87 -0
- package/src/plugins/builtin/volatility/index.test.tsx +107 -0
- package/src/plugins/builtin/volatility/index.tsx +193 -0
- package/src/plugins/builtin/volatility/model.test.ts +66 -0
- package/src/plugins/builtin/volatility/model.ts +113 -0
- package/src/plugins/builtin/world-indices/footer.ts +43 -23
- package/src/plugins/builtin/world-indices/index.tsx +44 -93
- package/src/plugins/builtin/world-indices/indices.ts +11 -2
- package/src/plugins/builtin/world-indices/model.ts +17 -24
- package/src/plugins/builtin/world-indices/pane.test.tsx +116 -0
- package/src/plugins/builtin/world-indices/table.tsx +82 -37
- package/src/plugins/builtin/yield-curve/index.tsx +16 -7
- package/src/plugins/builtin/yield-curve/treasury-data.test.ts +25 -0
- package/src/plugins/builtin/yield-curve/treasury-data.ts +16 -0
- package/src/plugins/catalog-backend.ts +8 -0
- package/src/plugins/catalog-ui.ts +8 -0
- package/src/plugins/event-bus.ts +1 -0
- package/src/plugins/ibkr/gateway/account-loaders.ts +1 -1
- package/src/plugins/ibkr/trade/tab/footer.ts +9 -23
- package/src/plugins/ibkr/trade/tab/index.tsx +1 -5
- package/src/plugins/ibkr/trading/pane-view.tsx +149 -87
- package/src/plugins/ibkr/trading/pane.tsx +2 -2
- package/src/plugins/ownership.ts +3 -0
- package/src/plugins/pane-manager/floating.ts +8 -2
- package/src/plugins/pane-manager.test.ts +13 -0
- package/src/plugins/prediction-markets/backend-plugin.ts +2 -0
- package/src/plugins/prediction-markets/capability.test.ts +281 -0
- package/src/plugins/prediction-markets/capability.ts +171 -0
- package/src/plugins/prediction-markets/chart.tsx +18 -26
- package/src/plugins/prediction-markets/columns.ts +3 -2
- package/src/plugins/prediction-markets/controller/catalog.ts +15 -12
- package/src/plugins/prediction-markets/controller/detail.ts +4 -0
- package/src/plugins/prediction-markets/controller/index.ts +0 -15
- package/src/plugins/prediction-markets/detail/book.tsx +3 -23
- package/src/plugins/prediction-markets/detail/overview.tsx +0 -18
- package/src/plugins/prediction-markets/detail/pane.tsx +36 -12
- package/src/plugins/prediction-markets/detail.test.tsx +1 -1
- package/src/plugins/prediction-markets/index.tsx +2 -0
- package/src/plugins/prediction-markets/metrics.ts +28 -18
- package/src/plugins/prediction-markets/navigation.ts +1 -0
- package/src/plugins/prediction-markets/pane.test.tsx +1 -1
- package/src/plugins/prediction-markets/pane.tsx +0 -1
- package/src/plugins/prediction-markets/services/fetch.ts +3 -2
- package/src/plugins/prediction-markets/services/kalshi/adapter.ts +82 -23
- package/src/plugins/prediction-markets/services/kalshi/normalize.ts +3 -1
- package/src/plugins/prediction-markets/services/kalshi/types.ts +14 -0
- package/src/plugins/prediction-markets/services/polymarket/adapter.ts +26 -14
- package/src/plugins/prediction-markets/services/polymarket/detail.ts +67 -18
- package/src/plugins/prediction-markets/test-helpers.tsx +0 -1
- package/src/plugins/prediction-markets/types.ts +3 -9
- package/src/plugins/registry/context.ts +6 -1
- package/src/plugins/registry/index.test.ts +2 -0
- package/src/plugins/registry/index.ts +53 -3
- package/src/plugins/runtime/context.tsx +4 -2
- package/src/plugins/runtime/index.tsx +9 -0
- package/src/remote/controller.test.ts +17 -4
- package/src/renderers/electrobun/bun/application-menu/index.ts +1 -1
- package/src/renderers/electrobun/bun/core-capabilities.ts +2 -2
- package/src/renderers/electrobun/bun/desktop/capability-bridge.test.ts +64 -0
- package/src/renderers/electrobun/bun/desktop/capability-bridge.ts +41 -7
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +5 -2
- package/src/renderers/electrobun/bun/desktop/http-fetch.test.ts +33 -0
- package/src/renderers/electrobun/bun/desktop/http-fetch.ts +53 -6
- package/src/renderers/electrobun/bun/desktop/initialization.test.ts +27 -0
- package/src/renderers/electrobun/bun/desktop/initialization.ts +6 -1
- package/src/renderers/electrobun/bun/index.ts +1 -0
- package/src/renderers/electrobun/shared/protocol.ts +2 -0
- package/src/renderers/electrobun/view/app-services.ts +25 -2
- package/src/renderers/electrobun/view/build-assets.ts +5 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +186 -65
- package/src/renderers/electrobun/view/cli-pane-shot-health.test.ts +25 -0
- package/src/renderers/electrobun/view/cli-pane-shot-health.ts +31 -0
- package/src/renderers/electrobun/view/data-table/index.tsx +10 -11
- package/src/renderers/electrobun/view/data-table/row.tsx +2 -0
- package/src/renderers/electrobun/view/desktop/controls.test.tsx +68 -0
- package/src/renderers/electrobun/view/desktop/controls.tsx +25 -1
- package/src/renderers/electrobun/view/host/box.test.tsx +80 -0
- package/src/renderers/electrobun/view/host/media-surface.tsx +70 -3
- package/src/renderers/electrobun/view/host/tabs.tsx +97 -5
- package/src/renderers/electrobun/view/host/text.tsx +5 -2
- package/src/renderers/electrobun/view/input-host.test.tsx +140 -0
- package/src/renderers/electrobun/view/input-host.tsx +4 -2
- package/src/renderers/electrobun/view/native-stubs/backend-rpc.ts +19 -1
- package/src/renderers/electrobun/view/native-stubs/broker-sync-native-loader.ts +7 -0
- package/src/renderers/electrobun/view/native-stubs/chart/kitty-support.ts +10 -0
- package/src/renderers/electrobun/view/remote/capability-invoker.test.ts +46 -0
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +34 -13
- package/src/renderers/electrobun/view/remote/connection-health-backend.ts +19 -0
- package/src/renderers/electrobun/view/remote/connection-health.test.ts +44 -0
- package/src/renderers/electrobun/view/remote/connection-health.ts +49 -0
- package/src/renderers/electrobun/view/styles.css +5 -0
- package/src/renderers/opentui/dialog-host.tsx +279 -80
- package/src/renderers/opentui/host.tsx +15 -1
- package/src/renderers/opentui/terminal-media.test.ts +102 -0
- package/src/renderers/opentui/terminal-media.ts +142 -0
- package/src/renderers/opentui/test-utils.tsx +9 -6
- package/src/renderers/opentui/toast-host.tsx +136 -7
- package/src/renderers/opentui/ui-host.tsx +19 -3
- package/src/sources/provider-router/connection-health.test.ts +28 -0
- package/src/sources/provider-router/connection-health.ts +47 -0
- package/src/sources/provider-router/history.test.ts +53 -4
- package/src/sources/provider-router/history.ts +119 -14
- package/src/sources/provider-router/index.ts +12 -1
- package/src/sources/yahoo-finance/history.ts +2 -9
- package/src/sources/yahoo-finance/http.ts +1 -1
- package/src/sources/yahoo-finance/symbols.ts +1 -1
- package/src/sources/yahoo-finance/types.ts +19 -0
- package/src/state/app/context/index.test.tsx +101 -0
- package/src/state/app/context/index.tsx +10 -0
- package/src/state/config-save-scheduler.ts +1 -6
- package/src/state/persist-scheduler.test.ts +31 -0
- package/src/state/persist-scheduler.ts +21 -8
- package/src/sync/auth-transition.test.ts +36 -0
- package/src/sync/auth-transition.ts +22 -0
- package/src/sync/core-contributors.test.ts +58 -1
- package/src/sync/core-contributors.ts +39 -2
- package/src/sync/react.ts +9 -0
- package/src/test-support/plugin-runtime.ts +3 -0
- package/src/theme/font-scale.test.ts +14 -0
- package/src/theme/font-scale.ts +69 -0
- package/src/tickers/search/index.test.ts +284 -2
- package/src/tickers/search/index.ts +55 -18
- package/src/tickers/search/ranking.ts +143 -18
- package/src/tickers/search/types.ts +1 -0
- package/src/time-series/alignment.ts +15 -11
- package/src/time-series/field-catalog.ts +10 -0
- package/src/time-series/fundamentals.ts +19 -11
- package/src/time-series/hooks.ts +8 -2
- package/src/time-series/parsed-history-cache.ts +35 -0
- package/src/time-series/resolution.ts +10 -0
- package/src/time-series/resolve.test.ts +332 -3
- package/src/time-series/resolve.ts +225 -25
- package/src/time-series/spec-studies.test.ts +23 -0
- package/src/time-series/spec.ts +21 -2
- package/src/time-series/transforms.test.ts +76 -1
- package/src/time-series/transforms.ts +39 -8
- package/src/time-series/types.ts +9 -2
- package/src/time-series/use-chart-resolution.test.tsx +105 -1
- package/src/time-series/use-chart-resolution.ts +67 -13
- package/src/types/config.ts +30 -27
- package/src/types/media.ts +2 -0
- package/src/types/plugin.ts +8 -1
- package/src/ui/host.tsx +4 -0
- package/src/ui/pointer-drag.ts +12 -0
- package/src/ui/qr.test.ts +79 -0
- package/src/ui/qr.ts +82 -0
- package/src/updater/github-releases.test.ts +3 -3
- package/src/updater/github-releases.ts +1 -1
- package/src/updater.test.ts +117 -16
- package/src/updater.ts +32 -5
- package/src/utils/exchanges.ts +1 -0
- package/src/utils/external-url.test.ts +32 -0
- package/src/utils/external-url.ts +23 -0
- package/src/utils/sort-values.ts +31 -0
- package/src/utils/zoned-date-time.ts +67 -0
- package/src/components/onboarding/wizard-keyboard.ts +0 -306
- package/src/plugins/builtin/chart-composer/date-window-dialog.tsx +0 -120
|
@@ -4,6 +4,10 @@ import { testRender } from "../renderers/opentui/test-utils";
|
|
|
4
4
|
import { createTestDataProvider } from "../test-support/data-provider";
|
|
5
5
|
import type { DataProvider } from "../types/data-provider";
|
|
6
6
|
import type { PricePoint, TickerFinancials } from "../types/financials";
|
|
7
|
+
import {
|
|
8
|
+
setSharedMarketDataCoordinator,
|
|
9
|
+
} from "../market-data/coordinator";
|
|
10
|
+
import { createIdleEntry } from "../market-data/result-types";
|
|
7
11
|
import type { ChartResolveSources } from "./resolve";
|
|
8
12
|
import { CHART_SPEC_VERSION, type ChartSpec } from "./types";
|
|
9
13
|
import {
|
|
@@ -16,6 +20,7 @@ type AutoViewport = NonNullable<Parameters<typeof useChartResolution>[2]["autoVi
|
|
|
16
20
|
let testSetup: Awaited<ReturnType<typeof testRender>> | undefined;
|
|
17
21
|
let setAutoViewport: ((viewport: AutoViewport | null) => void) | null = null;
|
|
18
22
|
let setRequestViewport: ((viewport: AutoViewport | null) => void) | null = null;
|
|
23
|
+
let setChartSpec: ((spec: ChartSpec) => void) | null = null;
|
|
19
24
|
let latestResult: UseChartResolutionResult | null = null;
|
|
20
25
|
|
|
21
26
|
const EMPTY_FINANCIALS: TickerFinancials = {
|
|
@@ -85,14 +90,16 @@ function sourcesFor(dataProvider: DataProvider): ChartResolveSources {
|
|
|
85
90
|
|
|
86
91
|
function ResolutionHarness({
|
|
87
92
|
sources,
|
|
93
|
+
spec = SPEC,
|
|
88
94
|
}: {
|
|
89
95
|
sources: ChartResolveSources;
|
|
96
|
+
spec?: ChartSpec;
|
|
90
97
|
}) {
|
|
91
98
|
const [autoViewport, setAutoViewportState] = useState<AutoViewport | null>(null);
|
|
92
99
|
const [requestViewport, setRequestViewportState] = useState<AutoViewport | null>(null);
|
|
93
100
|
setAutoViewport = setAutoViewportState;
|
|
94
101
|
setRequestViewport = setRequestViewportState;
|
|
95
|
-
latestResult = useChartResolution(
|
|
102
|
+
latestResult = useChartResolution(spec, sources, {
|
|
96
103
|
autoViewport,
|
|
97
104
|
requestViewport,
|
|
98
105
|
targetPointCount: 100,
|
|
@@ -103,6 +110,21 @@ function ResolutionHarness({
|
|
|
103
110
|
return <text>{`${latestResult.loading ? "loading" : "settled"}:${pointCount}`}</text>;
|
|
104
111
|
}
|
|
105
112
|
|
|
113
|
+
function MutableSpecHarness({
|
|
114
|
+
sources,
|
|
115
|
+
}: {
|
|
116
|
+
sources: ChartResolveSources;
|
|
117
|
+
}) {
|
|
118
|
+
const [spec, setSpecState] = useState(SPEC);
|
|
119
|
+
setChartSpec = setSpecState;
|
|
120
|
+
latestResult = useChartResolution(spec, sources, {
|
|
121
|
+
liveRefreshIntervalMs: 0,
|
|
122
|
+
});
|
|
123
|
+
const pointCount = (latestResult.bufferedSeries ?? latestResult.series)
|
|
124
|
+
.reduce((total, series) => total + series.points.length, 0);
|
|
125
|
+
return <text>{`${latestResult.loading ? "loading" : "settled"}:${pointCount}`}</text>;
|
|
126
|
+
}
|
|
127
|
+
|
|
106
128
|
function PollingResolutionHarness({ sources }: { sources: ChartResolveSources }) {
|
|
107
129
|
latestResult = useChartResolution(SPEC, sources, {
|
|
108
130
|
liveStreaming: false,
|
|
@@ -138,7 +160,9 @@ afterEach(async () => {
|
|
|
138
160
|
}
|
|
139
161
|
setAutoViewport = null;
|
|
140
162
|
setRequestViewport = null;
|
|
163
|
+
setChartSpec = null;
|
|
141
164
|
latestResult = null;
|
|
165
|
+
setSharedMarketDataCoordinator(null);
|
|
142
166
|
});
|
|
143
167
|
|
|
144
168
|
describe("useChartResolution", () => {
|
|
@@ -392,4 +416,84 @@ describe("useChartResolution", () => {
|
|
|
392
416
|
expect(latestResult?.series.every((series) => series.points.length === 0)).toBe(true);
|
|
393
417
|
expect(latestResult?.errors).toEqual([]);
|
|
394
418
|
});
|
|
419
|
+
|
|
420
|
+
test("paints coordinator-cached candles on the first frame", async () => {
|
|
421
|
+
const history = deferred<PricePoint[]>();
|
|
422
|
+
const provider = createTestDataProvider({
|
|
423
|
+
getTickerFinancials: async () => EMPTY_FINANCIALS,
|
|
424
|
+
getPriceHistoryForResolution: async () => history.promise,
|
|
425
|
+
getPriceHistory: async () => [],
|
|
426
|
+
});
|
|
427
|
+
setSharedMarketDataCoordinator({
|
|
428
|
+
subscribe: () => () => {},
|
|
429
|
+
getVersion: () => 1,
|
|
430
|
+
getKeysVersion: () => 1,
|
|
431
|
+
getChartEntry: () => ({
|
|
432
|
+
...createIdleEntry<PricePoint[]>(),
|
|
433
|
+
phase: "ready",
|
|
434
|
+
data: INITIAL_HISTORY,
|
|
435
|
+
lastGoodData: INITIAL_HISTORY,
|
|
436
|
+
source: "test",
|
|
437
|
+
fetchedAt: Date.now(),
|
|
438
|
+
}),
|
|
439
|
+
} as never);
|
|
440
|
+
|
|
441
|
+
testSetup = await testRender(<ResolutionHarness sources={sourcesFor(provider)} spec={{
|
|
442
|
+
...SPEC,
|
|
443
|
+
viewport: { range: "5Y", resolution: "auto" },
|
|
444
|
+
}} />, {
|
|
445
|
+
width: 24,
|
|
446
|
+
height: 1,
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
expect(latestResult?.series[0]?.points.length).toBe(2);
|
|
450
|
+
expect(latestResult?.loading).toBe(false);
|
|
451
|
+
|
|
452
|
+
await act(async () => {
|
|
453
|
+
history.resolve(INITIAL_HISTORY);
|
|
454
|
+
await testSetup!.renderOnce();
|
|
455
|
+
});
|
|
456
|
+
await waitFor(() => latestResult?.loading === false);
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
test("reuses cached history when the spec object identity changes", async () => {
|
|
460
|
+
const initialHistory = deferred<PricePoint[]>();
|
|
461
|
+
let historyCalls = 0;
|
|
462
|
+
const provider = createTestDataProvider({
|
|
463
|
+
getTickerFinancials: async () => EMPTY_FINANCIALS,
|
|
464
|
+
getPriceHistoryForResolution: async () => {
|
|
465
|
+
historyCalls += 1;
|
|
466
|
+
return historyCalls === 1 ? initialHistory.promise : INITIAL_HISTORY;
|
|
467
|
+
},
|
|
468
|
+
getPriceHistory: async () => [],
|
|
469
|
+
});
|
|
470
|
+
testSetup = await testRender(<MutableSpecHarness sources={sourcesFor(provider)} />, {
|
|
471
|
+
width: 24,
|
|
472
|
+
height: 1,
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
await waitFor(() => historyCalls === 1);
|
|
476
|
+
await act(async () => {
|
|
477
|
+
initialHistory.resolve(INITIAL_HISTORY);
|
|
478
|
+
await testSetup!.renderOnce();
|
|
479
|
+
});
|
|
480
|
+
await waitFor(() => latestResult?.loading === false && latestResult.series[0]?.points.length === 2);
|
|
481
|
+
|
|
482
|
+
await act(async () => {
|
|
483
|
+
setChartSpec?.({
|
|
484
|
+
...SPEC,
|
|
485
|
+
series: [{
|
|
486
|
+
...SPEC.series[0]!,
|
|
487
|
+
style: "line",
|
|
488
|
+
}],
|
|
489
|
+
});
|
|
490
|
+
await testSetup!.renderOnce();
|
|
491
|
+
});
|
|
492
|
+
await flushEffects(3);
|
|
493
|
+
|
|
494
|
+
expect(historyCalls).toBe(1);
|
|
495
|
+
expect(latestResult?.loading).toBe(false);
|
|
496
|
+
expect(latestResult?.series[0]?.points.length).toBe(2);
|
|
497
|
+
expect(latestResult?.series[0]?.style).toBe("line");
|
|
498
|
+
});
|
|
395
499
|
});
|
|
@@ -1,17 +1,28 @@
|
|
|
1
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
1
|
+
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
2
2
|
import {
|
|
3
3
|
ChartResolveCache,
|
|
4
4
|
resolveChartSpecData,
|
|
5
|
+
seedChartResolutionResult,
|
|
5
6
|
type ChartResolveOptions,
|
|
6
7
|
type ChartResolveSources,
|
|
7
8
|
} from "./resolve";
|
|
8
9
|
import type { ChartResolutionResult, ChartSpec } from "./types";
|
|
9
10
|
import {
|
|
10
11
|
LIVE_CHART_REFRESH_INTERVAL_MS,
|
|
12
|
+
chartQuoteOverrideKeyForSource,
|
|
11
13
|
liveChartQuoteTargetSignature,
|
|
12
14
|
subscribeToLiveChartQuotes,
|
|
13
15
|
} from "./live-quotes";
|
|
14
|
-
import type { Quote } from "../types/financials";
|
|
16
|
+
import type { PricePoint, Quote } from "../types/financials";
|
|
17
|
+
import { createBaselineChartRequest } from "../market-data/coordinator/chart";
|
|
18
|
+
import { getSharedMarketDataCoordinator } from "../market-data/coordinator";
|
|
19
|
+
import { resolveEntryData } from "../market-data/selectors";
|
|
20
|
+
import { isMarketFieldId } from "./field-catalog";
|
|
21
|
+
import { getPresetResolution } from "./resolution";
|
|
22
|
+
import {
|
|
23
|
+
parsedPriceHistoryKey,
|
|
24
|
+
readParsedPriceHistory,
|
|
25
|
+
} from "./parsed-history-cache";
|
|
15
26
|
|
|
16
27
|
export interface UseChartResolutionResult extends ChartResolutionResult {
|
|
17
28
|
reload: () => void;
|
|
@@ -39,6 +50,35 @@ function hasRenderableData(result: ChartResolutionResult): boolean {
|
|
|
39
50
|
return (result.bufferedSeries ?? result.series).some((series) => series.points.length > 0);
|
|
40
51
|
}
|
|
41
52
|
|
|
53
|
+
function collectSeedHistory(spec: ChartSpec): Map<string, PricePoint[]> {
|
|
54
|
+
const history = new Map<string, PricePoint[]>();
|
|
55
|
+
const coordinator = getSharedMarketDataCoordinator();
|
|
56
|
+
for (const series of spec.series) {
|
|
57
|
+
if (series.source.kind !== "security" || !isMarketFieldId(series.source.fieldId)) continue;
|
|
58
|
+
const source = series.source;
|
|
59
|
+
const key = chartQuoteOverrideKeyForSource(source);
|
|
60
|
+
if (history.has(key)) continue;
|
|
61
|
+
const symbol = source.instrument.symbol;
|
|
62
|
+
const exchange = source.instrument.exchange ?? "";
|
|
63
|
+
const baseline = createBaselineChartRequest(source.instrument);
|
|
64
|
+
const presetResolution = spec.viewport.resolution === "auto"
|
|
65
|
+
? getPresetResolution(spec.viewport.range)
|
|
66
|
+
: spec.viewport.resolution;
|
|
67
|
+
const remembered = readParsedPriceHistory(parsedPriceHistoryKey(symbol, exchange, baseline.bufferRange, baseline.resolution))
|
|
68
|
+
?? readParsedPriceHistory(parsedPriceHistoryKey(symbol, exchange, spec.viewport.range, presetResolution))
|
|
69
|
+
?? readParsedPriceHistory(parsedPriceHistoryKey(symbol, exchange, baseline.bufferRange, presetResolution));
|
|
70
|
+
if (remembered?.length) {
|
|
71
|
+
history.set(key, remembered);
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (!coordinator) continue;
|
|
75
|
+
const entry = coordinator.getChartEntry(baseline);
|
|
76
|
+
const data = resolveEntryData(entry);
|
|
77
|
+
if (data?.length) history.set(key, data);
|
|
78
|
+
}
|
|
79
|
+
return history;
|
|
80
|
+
}
|
|
81
|
+
|
|
42
82
|
function withQuoteOverrides(
|
|
43
83
|
sources: ChartResolveSources,
|
|
44
84
|
liveOverrides: ReadonlyMap<string, Quote>,
|
|
@@ -57,9 +97,26 @@ export function useChartResolution(
|
|
|
57
97
|
sources: ChartResolveSources,
|
|
58
98
|
options: UseChartResolutionOptions = {},
|
|
59
99
|
): UseChartResolutionResult {
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
100
|
+
const coordinator = getSharedMarketDataCoordinator();
|
|
101
|
+
const [result, setResult] = useState<ChartResolutionResult>(
|
|
102
|
+
() => seedChartResolutionResult(spec, collectSeedHistory(spec)) ?? EMPTY_RESULT,
|
|
103
|
+
);
|
|
104
|
+
const needsSeed = !hasRenderableData(result);
|
|
105
|
+
const subscribeSeed = useCallback((listener: () => void) => {
|
|
106
|
+
if (!needsSeed || !coordinator) return () => {};
|
|
107
|
+
return coordinator.subscribe(listener);
|
|
108
|
+
}, [coordinator, needsSeed]);
|
|
109
|
+
const getSeedSnapshot = useCallback(() => {
|
|
110
|
+
if (!needsSeed || !coordinator) return 0;
|
|
111
|
+
return coordinator.getVersion();
|
|
112
|
+
}, [coordinator, needsSeed]);
|
|
113
|
+
useSyncExternalStore(subscribeSeed, getSeedSnapshot, () => 0);
|
|
114
|
+
const seeded = needsSeed
|
|
115
|
+
? seedChartResolutionResult(spec, collectSeedHistory(spec))
|
|
116
|
+
: null;
|
|
117
|
+
const displayed = hasRenderableData(result) ? result : (seeded ?? result);
|
|
118
|
+
const resultRef = useRef(displayed);
|
|
119
|
+
resultRef.current = displayed;
|
|
63
120
|
const [revision, setRevision] = useState(0);
|
|
64
121
|
const generationRef = useRef(0);
|
|
65
122
|
const liveSubscriptionGenerationRef = useRef(0);
|
|
@@ -102,18 +159,15 @@ export function useChartResolution(
|
|
|
102
159
|
generationRef.current += 1;
|
|
103
160
|
const generation = generationRef.current;
|
|
104
161
|
const cacheIdentity = cacheIdentityRef.current;
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|| cacheIdentity.revision !== revision;
|
|
162
|
+
const isExplicitReload = cacheIdentity.revision !== revision && cacheIdentity.revision !== -1;
|
|
163
|
+
const resetCache = cacheIdentity.sources !== sources || isExplicitReload;
|
|
108
164
|
if (resetCache) {
|
|
109
165
|
resolveCacheRef.current = new ChartResolveCache();
|
|
110
|
-
cacheIdentityRef.current = { spec, sources, revision };
|
|
111
166
|
}
|
|
167
|
+
cacheIdentityRef.current = { spec, sources, revision };
|
|
112
168
|
const cache = resolveCacheRef.current;
|
|
113
169
|
const current = resultRef.current;
|
|
114
|
-
const backgroundRefresh = !
|
|
115
|
-
&& !current.loading
|
|
116
|
-
&& hasRenderableData(current);
|
|
170
|
+
const backgroundRefresh = hasRenderableData(current) && !isExplicitReload;
|
|
117
171
|
if (!backgroundRefresh) {
|
|
118
172
|
setResult((currentResult) => ({ ...currentResult, loading: true, errors: [] }));
|
|
119
173
|
}
|
|
@@ -220,5 +274,5 @@ export function useChartResolution(
|
|
|
220
274
|
return () => clearInterval(intervalId);
|
|
221
275
|
}, [liveStreaming, liveTargetSignature, quotePollingIntervalMs]);
|
|
222
276
|
|
|
223
|
-
return { ...
|
|
277
|
+
return { ...displayed, reload };
|
|
224
278
|
}
|
package/src/types/config.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Portfolio, Watchlist } from "./ticker";
|
|
2
2
|
import type { LanguagePreference } from "../i18n/languages";
|
|
3
3
|
|
|
4
|
-
export const CURRENT_CONFIG_VERSION =
|
|
4
|
+
export const CURRENT_CONFIG_VERSION = 21;
|
|
5
5
|
|
|
6
6
|
type ChartRendererPreference = "auto" | "kitty" | "braille";
|
|
7
7
|
|
|
@@ -116,6 +116,26 @@ export interface SavedLayout {
|
|
|
116
116
|
activePanel?: "left" | "right";
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
export type OnboardingStage =
|
|
120
|
+
| "welcome"
|
|
121
|
+
| "portfolio"
|
|
122
|
+
| "add-ticker"
|
|
123
|
+
| "account"
|
|
124
|
+
| "upgrade"
|
|
125
|
+
| "ready";
|
|
126
|
+
|
|
127
|
+
export interface OnboardingProgress {
|
|
128
|
+
version: 1;
|
|
129
|
+
stage: OnboardingStage;
|
|
130
|
+
path?: "manual" | "broker";
|
|
131
|
+
portfolioId?: string;
|
|
132
|
+
tickerSymbol?: string;
|
|
133
|
+
brokerName?: string;
|
|
134
|
+
positionsImported?: number;
|
|
135
|
+
accountStatus?: "signed-in" | "skipped";
|
|
136
|
+
checkoutOpenedAt?: string;
|
|
137
|
+
}
|
|
138
|
+
|
|
119
139
|
export interface AppConfig {
|
|
120
140
|
dataDir: string;
|
|
121
141
|
configVersion: number;
|
|
@@ -133,9 +153,14 @@ export interface AppConfig {
|
|
|
133
153
|
theme: string;
|
|
134
154
|
chartPreferences: ChartPreferences;
|
|
135
155
|
valueFlashingEnabled: boolean;
|
|
156
|
+
fontSize: number;
|
|
136
157
|
recentTickers: string[];
|
|
137
158
|
language?: LanguagePreference;
|
|
138
159
|
onboardingComplete?: boolean;
|
|
160
|
+
/** App version at the last launch, used to show release notes after an update. */
|
|
161
|
+
lastLaunchedVersion?: string;
|
|
162
|
+
/** Local, resumable progress. This is intentionally not cloud-synced. */
|
|
163
|
+
onboardingProgress?: OnboardingProgress;
|
|
139
164
|
}
|
|
140
165
|
|
|
141
166
|
export const TICKER_RESEARCH_PANE_ID = "ticker-research";
|
|
@@ -198,17 +223,11 @@ const DEFAULT_HOME_LAYOUT: LayoutConfig = {
|
|
|
198
223
|
first: {
|
|
199
224
|
kind: "split",
|
|
200
225
|
axis: "vertical",
|
|
201
|
-
ratio: 0.
|
|
226
|
+
ratio: 0.6,
|
|
202
227
|
first: { kind: "pane", instanceId: "portfolio-list:main" },
|
|
203
228
|
second: { kind: "pane", instanceId: "chat:main" },
|
|
204
229
|
},
|
|
205
|
-
second: {
|
|
206
|
-
kind: "split",
|
|
207
|
-
axis: "vertical",
|
|
208
|
-
ratio: 0.46,
|
|
209
|
-
first: { kind: "pane", instanceId: "ticker-detail:main" },
|
|
210
|
-
second: { kind: "pane", instanceId: "ticker-detail:nvda" },
|
|
211
|
-
},
|
|
230
|
+
second: { kind: "pane", instanceId: "ticker-detail:main" },
|
|
212
231
|
},
|
|
213
232
|
instances: [
|
|
214
233
|
{
|
|
@@ -232,16 +251,6 @@ const DEFAULT_HOME_LAYOUT: LayoutConfig = {
|
|
|
232
251
|
},
|
|
233
252
|
binding: { kind: "follow", sourceInstanceId: "portfolio-list:main" },
|
|
234
253
|
},
|
|
235
|
-
{
|
|
236
|
-
instanceId: "ticker-detail:nvda",
|
|
237
|
-
paneId: TICKER_RESEARCH_PANE_ID,
|
|
238
|
-
title: "NVDA",
|
|
239
|
-
settings: {
|
|
240
|
-
hideTabs: false,
|
|
241
|
-
lockedTabId: "overview",
|
|
242
|
-
},
|
|
243
|
-
binding: { kind: "fixed", symbol: "NVDA" },
|
|
244
|
-
},
|
|
245
254
|
{
|
|
246
255
|
instanceId: "chat:main",
|
|
247
256
|
paneId: "chat",
|
|
@@ -250,15 +259,8 @@ const DEFAULT_HOME_LAYOUT: LayoutConfig = {
|
|
|
250
259
|
},
|
|
251
260
|
binding: { kind: "none" },
|
|
252
261
|
},
|
|
253
|
-
{
|
|
254
|
-
instanceId: "help:main",
|
|
255
|
-
paneId: "help",
|
|
256
|
-
binding: { kind: "none" },
|
|
257
|
-
},
|
|
258
|
-
],
|
|
259
|
-
floating: [
|
|
260
|
-
{ instanceId: "help:main", x: 12, y: 4, width: 88, height: 32, zIndex: 90 },
|
|
261
262
|
],
|
|
263
|
+
floating: [],
|
|
262
264
|
detached: [],
|
|
263
265
|
};
|
|
264
266
|
|
|
@@ -632,6 +634,7 @@ export function createDefaultConfig(dataDir: string): AppConfig {
|
|
|
632
634
|
renderer: "auto",
|
|
633
635
|
},
|
|
634
636
|
valueFlashingEnabled: true,
|
|
637
|
+
fontSize: 12,
|
|
635
638
|
recentTickers: [],
|
|
636
639
|
};
|
|
637
640
|
}
|
package/src/types/media.ts
CHANGED
package/src/types/plugin.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { AppTickerRepositoryPort } from "../core/app-service-ports";
|
|
3
|
+
import type { ConnectionHealthRegistry } from "../core/connection-health";
|
|
3
4
|
import type { PluginEvents } from "../plugins/event-bus";
|
|
4
5
|
import type { PluginLogger } from "../utils/debug-log";
|
|
5
6
|
import type { BrokerAdapter } from "./broker";
|
|
@@ -467,6 +468,11 @@ export interface PluginPaneSettingsState {
|
|
|
467
468
|
export type AppNotificationType = "info" | "success" | "error";
|
|
468
469
|
type AppDesktopNotificationMode = "never" | "when-inactive" | "always";
|
|
469
470
|
|
|
471
|
+
export interface AppNotificationDelivery {
|
|
472
|
+
toastVisible: boolean;
|
|
473
|
+
desktopRequested: boolean;
|
|
474
|
+
}
|
|
475
|
+
|
|
470
476
|
export interface AppNotificationRequest {
|
|
471
477
|
title?: string;
|
|
472
478
|
body: string;
|
|
@@ -521,6 +527,7 @@ export interface GloomPluginContext {
|
|
|
521
527
|
getPaneDef(paneId: string): PaneDef | undefined;
|
|
522
528
|
|
|
523
529
|
readonly marketData: DataProvider;
|
|
530
|
+
readonly connectionHealth: ConnectionHealthRegistry;
|
|
524
531
|
readonly tickerRepository: AppTickerRepositoryPort;
|
|
525
532
|
readonly persistence: PluginPersistence;
|
|
526
533
|
readonly log: PluginLogger;
|
|
@@ -548,7 +555,7 @@ export interface GloomPluginContext {
|
|
|
548
555
|
on<K extends keyof PluginEvents>(event: K, handler: (payload: PluginEvents[K]) => void): () => void;
|
|
549
556
|
emit<K extends keyof PluginEvents>(event: K, payload: PluginEvents[K]): void;
|
|
550
557
|
|
|
551
|
-
notify(notification: AppNotificationRequest): void;
|
|
558
|
+
notify(notification: AppNotificationRequest): AppNotificationDelivery | void;
|
|
552
559
|
}
|
|
553
560
|
|
|
554
561
|
export interface GloomPlugin {
|
package/src/ui/host.tsx
CHANGED
|
@@ -271,6 +271,7 @@ interface HostTabItem {
|
|
|
271
271
|
label: string;
|
|
272
272
|
value: string;
|
|
273
273
|
disabled?: boolean;
|
|
274
|
+
reorderable?: boolean;
|
|
274
275
|
onClose?: (value: string) => void;
|
|
275
276
|
onDoubleClick?: (value: string) => void;
|
|
276
277
|
onContextMenu?: (value: string, event: any) => void;
|
|
@@ -301,6 +302,7 @@ export interface HostTabsProps {
|
|
|
301
302
|
closeMode?: "active" | "always";
|
|
302
303
|
addLabel?: string;
|
|
303
304
|
onAdd?: () => void;
|
|
305
|
+
onReorder?: (fromValue: string, toValue: string) => void;
|
|
304
306
|
focused?: boolean;
|
|
305
307
|
palette: HostTabsPalette;
|
|
306
308
|
}
|
|
@@ -384,6 +386,8 @@ export interface RendererHost {
|
|
|
384
386
|
notify(notification: AppNotificationRequest): void;
|
|
385
387
|
showContextMenu?(items: ContextMenuItem[]): Promise<boolean>;
|
|
386
388
|
playTerminalMedia?(url: string, title?: string, options?: { muted?: boolean }): Promise<void>;
|
|
389
|
+
/** Stop terminal playback started by `playTerminalMedia`. */
|
|
390
|
+
stopTerminalMedia?(): void;
|
|
387
391
|
resolveLiveStream?(request: LiveStreamResolveRequest): Promise<ResolvedLiveStream>;
|
|
388
392
|
}
|
|
389
393
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function capturePointerDrag(renderer: unknown, renderable: unknown): void {
|
|
2
|
+
if (!renderable) return;
|
|
3
|
+
const hostCapture = (renderer as { captureMouseRenderable?: (target: unknown) => void }).captureMouseRenderable;
|
|
4
|
+
if (typeof hostCapture === "function") {
|
|
5
|
+
hostCapture.call(renderer, renderable);
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
const capture = (renderer as { setCapturedRenderable?: (target: unknown) => void }).setCapturedRenderable;
|
|
9
|
+
if (typeof capture === "function") {
|
|
10
|
+
capture.call(renderer, renderable);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { renderQrLines, renderQrSvgDataUri } from "./qr";
|
|
3
|
+
|
|
4
|
+
// "test" fits a version 1 QR (21 modules); plus the 4-module quiet zone on
|
|
5
|
+
// each side that is 29 columns and ceil(29 / 2) = 15 half-block lines.
|
|
6
|
+
const SMALL_INPUT = "test";
|
|
7
|
+
const SMALL_SIZE = 21 + 8;
|
|
8
|
+
|
|
9
|
+
describe("renderQrLines", () => {
|
|
10
|
+
test("produces a square code with two module rows per line", () => {
|
|
11
|
+
const lines = renderQrLines(SMALL_INPUT);
|
|
12
|
+
expect(lines).toHaveLength(Math.ceil(SMALL_SIZE / 2));
|
|
13
|
+
for (const line of lines) {
|
|
14
|
+
expect(line).toHaveLength(SMALL_SIZE);
|
|
15
|
+
expect(line).toMatch(/^[ \u2580\u2584\u2588]+$/);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("includes the 4-module quiet zone on every side", () => {
|
|
20
|
+
const lines = renderQrLines(SMALL_INPUT);
|
|
21
|
+
// 4 quiet rows = the first 2 lines; the bottom edge also pads the odd row.
|
|
22
|
+
expect(lines[0]).toBe(" ".repeat(SMALL_SIZE));
|
|
23
|
+
expect(lines[1]).toBe(" ".repeat(SMALL_SIZE));
|
|
24
|
+
expect(lines[13]).toBe(" ".repeat(SMALL_SIZE));
|
|
25
|
+
expect(lines[14]).toBe(" ".repeat(SMALL_SIZE));
|
|
26
|
+
for (const line of lines) {
|
|
27
|
+
expect(line.startsWith(" ")).toBe(true);
|
|
28
|
+
expect(line.endsWith(" ")).toBe(true);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test("pads the dangling bottom row light when the height is odd", () => {
|
|
33
|
+
// 29 rows means the last line only has a top half; it must never show a
|
|
34
|
+
// bottom-half or full block, or the code gains a phantom module row.
|
|
35
|
+
const lastDataLine = renderQrLines(SMALL_INPUT)[12]!;
|
|
36
|
+
expect(lastDataLine).toMatch(/^[ \u2580]+$/);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("merges dark runs into rects that cover exactly the dark modules", () => {
|
|
40
|
+
const svg = decodeURIComponent(
|
|
41
|
+
renderQrSvgDataUri(SMALL_INPUT).slice('url("data:image/svg+xml,'.length, -2),
|
|
42
|
+
);
|
|
43
|
+
expect(svg).toContain(`viewBox="0 0 ${SMALL_SIZE} ${SMALL_SIZE}"`);
|
|
44
|
+
|
|
45
|
+
// The half-block lines carry the same grid, so counting dark halves there is
|
|
46
|
+
// an independent check that run merging did not drop or widen a module.
|
|
47
|
+
const darkModules = renderQrLines(SMALL_INPUT)
|
|
48
|
+
.join("")
|
|
49
|
+
.split("")
|
|
50
|
+
.reduce((total, char) => total + (char === "\u2588" ? 2 : char === " " ? 0 : 1), 0);
|
|
51
|
+
const darkArea = [...svg.matchAll(/<rect x="\d+" y="\d+" width="(\d+)" height="1"\/>/g)]
|
|
52
|
+
.reduce((total, match) => total + Number(match[1]), 0);
|
|
53
|
+
expect(darkArea).toBe(darkModules);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("renders a verification URI to known stable output", () => {
|
|
57
|
+
expect(renderQrLines("https://gloom.sh/link/TEST-CODE")).toEqual([
|
|
58
|
+
" ",
|
|
59
|
+
" ",
|
|
60
|
+
" █▀▀▀▀▀█ ▄▀▀█ ▀ ▄▄▄ ▄ █▀▀▀▀▀█ ",
|
|
61
|
+
" █ ███ █ ▄███▄▀▀▄██▀▀ █ ███ █ ",
|
|
62
|
+
" █ ▀▀▀ █ ▄▄ ▀█ ▄▄ █▄▀ █ ▀▀▀ █ ",
|
|
63
|
+
" ▀▀▀▀▀▀▀ ▀ ▀ ▀▄▀▄█▄█▄▀ ▀▀▀▀▀▀▀ ",
|
|
64
|
+
" ▀▄▄█ ▀▀▄▀█ ▀ ▄▀▄██▄▀▄█▄▀ ▄ ▄ ",
|
|
65
|
+
" ▀▀▄ ▄ ▀█▄▀▄ █▀▀▄▀█▀▀▀▀█▄▀██ ",
|
|
66
|
+
" █▀██▄▀ ▄ ▀█▄██▄▄▄██▄▀ ▀ ▀▀ ",
|
|
67
|
+
" ▀▀█▀▄█▀▄ ▀█▄█▀▀▄ █ ▄▀█▄ ▄█▀█▀ ",
|
|
68
|
+
" ██ ▄▀█▀▄ ███▄▄▄█▀ ▀▀▄▄ ▄ ▀▄ ",
|
|
69
|
+
" ▀ █ ▀ ▀▀▀▀▄█▄ █▀▀▄▄ █ ▀ █ ██ ",
|
|
70
|
+
" ▀ ▀ ▀ ▄ █ ▀ ▄█▀█ ██▀▀▀█ █▄▄ ",
|
|
71
|
+
" █▀▀▀▀▀█ ▄█ █▀ ▄▄█▀█ █ ▀ █▄▄▀▄ ",
|
|
72
|
+
" █ ███ █ ▄▀ ▄▄ ▄▀ ▄█▀███▄▄▀▄ ",
|
|
73
|
+
" █ ▀▀▀ █ █▄▀▄█▄█▄▄██▄▄ █▀▀▄▀ ",
|
|
74
|
+
" ▀▀▀▀▀▀▀ ▀▀ ▀ ▀▀ ▀▀▀ ▀ ",
|
|
75
|
+
" ",
|
|
76
|
+
" ",
|
|
77
|
+
]);
|
|
78
|
+
});
|
|
79
|
+
});
|
package/src/ui/qr.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QR rendering for both hosts: half-block Unicode lines for the terminal, and
|
|
3
|
+
* an SVG data URI for the desktop web host, which must not draw shapes with
|
|
4
|
+
* cell characters and would render them with unscannable line gaps anyway.
|
|
5
|
+
*
|
|
6
|
+
* A QR code must be dark-on-light for phone cameras, so both outputs have to be
|
|
7
|
+
* painted with a dark foreground on a light background whatever the theme is.
|
|
8
|
+
*/
|
|
9
|
+
import qrcode from "qrcode-generator";
|
|
10
|
+
|
|
11
|
+
/** Mandatory light border around the code: the QR spec requires 4 modules on every side. */
|
|
12
|
+
const QUIET_ZONE_MODULES = 4;
|
|
13
|
+
|
|
14
|
+
const BOTH_LIGHT = " ";
|
|
15
|
+
const TOP_DARK = "\u2580"; // ▀
|
|
16
|
+
const BOTTOM_DARK = "\u2584"; // ▄
|
|
17
|
+
const BOTH_DARK = "\u2588"; // █
|
|
18
|
+
|
|
19
|
+
/** Quiet zone included, so callers only deal with one coordinate space. */
|
|
20
|
+
function qrGrid(text: string): { size: number; isDark: (row: number, col: number) => boolean } {
|
|
21
|
+
const qr = qrcode(0, "M");
|
|
22
|
+
qr.addData(text);
|
|
23
|
+
qr.make();
|
|
24
|
+
|
|
25
|
+
const moduleCount = qr.getModuleCount();
|
|
26
|
+
return {
|
|
27
|
+
size: moduleCount + QUIET_ZONE_MODULES * 2,
|
|
28
|
+
isDark: (row: number, col: number): boolean => {
|
|
29
|
+
const moduleRow = row - QUIET_ZONE_MODULES;
|
|
30
|
+
const moduleCol = col - QUIET_ZONE_MODULES;
|
|
31
|
+
if (moduleRow < 0 || moduleCol < 0 || moduleRow >= moduleCount || moduleCol >= moduleCount) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return qr.isDark(moduleRow, moduleCol);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function renderQrLines(text: string): string[] {
|
|
40
|
+
const { size, isDark } = qrGrid(text);
|
|
41
|
+
|
|
42
|
+
const lines: string[] = [];
|
|
43
|
+
for (let row = 0; row < size; row += 2) {
|
|
44
|
+
let line = "";
|
|
45
|
+
for (let col = 0; col < size; col += 1) {
|
|
46
|
+
const top = isDark(row, col);
|
|
47
|
+
// An odd total height leaves the last line with no bottom row; pad it light.
|
|
48
|
+
const bottom = row + 1 < size && isDark(row + 1, col);
|
|
49
|
+
line += top ? (bottom ? BOTH_DARK : TOP_DARK) : (bottom ? BOTTOM_DARK : BOTH_LIGHT);
|
|
50
|
+
}
|
|
51
|
+
lines.push(line);
|
|
52
|
+
}
|
|
53
|
+
return lines;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* One `background-image` value for the desktop host. Runs of dark modules are
|
|
58
|
+
* merged into a single rect per run so the markup stays small, and
|
|
59
|
+
* `shape-rendering="crispEdges"` keeps module edges from being blurred away.
|
|
60
|
+
*/
|
|
61
|
+
export function renderQrSvgDataUri(text: string): string {
|
|
62
|
+
const { size, isDark } = qrGrid(text);
|
|
63
|
+
|
|
64
|
+
let rects = "";
|
|
65
|
+
for (let row = 0; row < size; row += 1) {
|
|
66
|
+
let runStart: number | null = null;
|
|
67
|
+
for (let col = 0; col <= size; col += 1) {
|
|
68
|
+
const dark = col < size && isDark(row, col);
|
|
69
|
+
if (dark && runStart === null) runStart = col;
|
|
70
|
+
if (!dark && runStart !== null) {
|
|
71
|
+
rects += `<rect x="${runStart}" y="${row}" width="${col - runStart}" height="1"/>`;
|
|
72
|
+
runStart = null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${size} ${size}" shape-rendering="crispEdges">`
|
|
78
|
+
+ `<rect width="${size}" height="${size}" fill="#ffffff"/>`
|
|
79
|
+
+ `<g fill="#000000">${rects}</g>`
|
|
80
|
+
+ "</svg>";
|
|
81
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
82
|
+
}
|
|
@@ -9,7 +9,7 @@ describe("normalizeChangelogRelease", () => {
|
|
|
9
9
|
name: "v0.7.5 - Crash recovery and ticker opens",
|
|
10
10
|
published_at: "2026-05-14T23:27:47Z",
|
|
11
11
|
body: "## Highlights\n\n- Fixed startup recovery.",
|
|
12
|
-
html_url: "https://github.com/
|
|
12
|
+
html_url: "https://github.com/gloom-sh/gloomberb/releases/tag/v0.7.5",
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
expect(release).toEqual({
|
|
@@ -19,7 +19,7 @@ describe("normalizeChangelogRelease", () => {
|
|
|
19
19
|
title: "Crash recovery and ticker opens",
|
|
20
20
|
publishedAt: "2026-05-14T23:27:47Z",
|
|
21
21
|
body: "## Highlights\n\n- Fixed startup recovery.",
|
|
22
|
-
url: "https://github.com/
|
|
22
|
+
url: "https://github.com/gloom-sh/gloomberb/releases/tag/v0.7.5",
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -32,7 +32,7 @@ describe("normalizeChangelogRelease", () => {
|
|
|
32
32
|
expect(release?.id).toBe("v1.0.0");
|
|
33
33
|
expect(release?.title).toBe("v1.0.0");
|
|
34
34
|
expect(release?.body).toBe("No changelog details were published for this release.");
|
|
35
|
-
expect(release?.url).toBe("https://github.com/
|
|
35
|
+
expect(release?.url).toBe("https://github.com/gloom-sh/gloomberb/releases/tag/v1.0.0");
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
test("drops malformed releases without a tag", () => {
|