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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsxImportSource react */
|
|
2
|
-
import { useRef, type RefObject } from "react";
|
|
2
|
+
import { useRef, type KeyboardEvent, type RefObject } from "react";
|
|
3
3
|
import { Box, Input, Text, Textarea, editableTextContextMenuItems, useRendererHost, useUiCapabilities } from "../../../../ui";
|
|
4
4
|
import { TextAttributes, type InputRenderable } from "../../../../ui";
|
|
5
5
|
import { useShortcut } from "../../../../react/input";
|
|
@@ -382,10 +382,18 @@ export function WebSegmentedControl({
|
|
|
382
382
|
onChange,
|
|
383
383
|
}: SegmentedControlProps) {
|
|
384
384
|
const colors = useThemeColors();
|
|
385
|
+
const enabled = options.filter((option) => !option.disabled);
|
|
386
|
+
const selectAdjacent = (direction: -1 | 1) => {
|
|
387
|
+
const index = enabled.findIndex((option) => option.value === value);
|
|
388
|
+
const next = enabled[index < 0 ? 0 : (index + direction + enabled.length) % enabled.length];
|
|
389
|
+
if (next) onChange?.(next.value);
|
|
390
|
+
};
|
|
391
|
+
|
|
385
392
|
return (
|
|
386
393
|
<Box
|
|
387
394
|
flexDirection="row"
|
|
388
395
|
backgroundColor={panelFill(colors)}
|
|
396
|
+
role="radiogroup"
|
|
389
397
|
style={{
|
|
390
398
|
border: `1px solid ${panelBorder(colors)}`,
|
|
391
399
|
borderRadius: CONTROL_RADIUS,
|
|
@@ -406,6 +414,22 @@ export function WebSegmentedControl({
|
|
|
406
414
|
if (!option.disabled) onChange?.(option.value);
|
|
407
415
|
}}
|
|
408
416
|
data-gloom-interactive={option.disabled ? undefined : "true"}
|
|
417
|
+
role="radio"
|
|
418
|
+
aria-checked={active}
|
|
419
|
+
aria-disabled={option.disabled || undefined}
|
|
420
|
+
tabIndex={option.disabled ? -1 : 0}
|
|
421
|
+
onKeyDown={(event: KeyboardEvent<HTMLDivElement>) => {
|
|
422
|
+
if (option.disabled) return;
|
|
423
|
+
if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
|
|
424
|
+
event.preventDefault();
|
|
425
|
+
event.stopPropagation();
|
|
426
|
+
selectAdjacent(event.key === "ArrowLeft" ? -1 : 1);
|
|
427
|
+
} else if (event.key === "Enter" || event.key === " ") {
|
|
428
|
+
event.preventDefault();
|
|
429
|
+
event.stopPropagation();
|
|
430
|
+
onChange?.(option.value);
|
|
431
|
+
}
|
|
432
|
+
}}
|
|
409
433
|
style={{
|
|
410
434
|
borderRadius: CONTROL_RADIUS - 2,
|
|
411
435
|
paddingInline: 10,
|
|
@@ -95,3 +95,83 @@ test("a tab bar occupies exactly the one row panes reserve for it", async () =>
|
|
|
95
95
|
expect(list.style.marginBottom === "" || list.style.marginBottom === "0px").toBe(true);
|
|
96
96
|
await act(async () => root.unmount());
|
|
97
97
|
});
|
|
98
|
+
|
|
99
|
+
test("desktop tabs reorder through mouse dragging", async () => {
|
|
100
|
+
const { WebTabs } = await import("./tabs");
|
|
101
|
+
const reordered: Array<[string, string]> = [];
|
|
102
|
+
const selected: string[] = [];
|
|
103
|
+
const container = testWindow.document.createElement("div");
|
|
104
|
+
testWindow.document.body.appendChild(container);
|
|
105
|
+
const root = createRoot(container as unknown as HTMLElement);
|
|
106
|
+
await act(async () => {
|
|
107
|
+
root.render(
|
|
108
|
+
<WebTabs
|
|
109
|
+
tabs={[
|
|
110
|
+
{ label: "Home", value: "home" },
|
|
111
|
+
{ label: "Research", value: "research" },
|
|
112
|
+
{ label: "News", value: "news" },
|
|
113
|
+
]}
|
|
114
|
+
activeValue="home"
|
|
115
|
+
onSelect={(value) => selected.push(value)}
|
|
116
|
+
onReorder={(fromValue, toValue) => reordered.push([fromValue, toValue])}
|
|
117
|
+
palette={{} as never}
|
|
118
|
+
/>,
|
|
119
|
+
);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const buttons = [...container.querySelectorAll('[data-gloom-role="tab-button"]')] as unknown as HTMLElement[];
|
|
123
|
+
buttons.forEach((button, index) => {
|
|
124
|
+
button.getBoundingClientRect = () => ({ left: index * 100, right: index * 100 + 80, width: 80 }) as DOMRect;
|
|
125
|
+
});
|
|
126
|
+
const mouse = (type: string, target: { dispatchEvent: (event: unknown) => unknown }, clientX: number) => {
|
|
127
|
+
target.dispatchEvent(new MouseEvent(type, { bubbles: true, button: 0, clientX }));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
expect(buttons).toHaveLength(3);
|
|
131
|
+
expect(buttons[0]?.getAttribute("draggable")).toBe("false");
|
|
132
|
+
await act(async () => {
|
|
133
|
+
mouse("mousedown", buttons[0]!, 20);
|
|
134
|
+
mouse("mousemove", testWindow.document as never, 220);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
expect(buttons[0]?.style.transform).toBe("translateX(200px) scale(1.03)");
|
|
138
|
+
expect(buttons[1]?.style.transform).toBe("translateX(-84px)");
|
|
139
|
+
expect(buttons[1]?.style.transition).toContain("transform var(--tab-reorder-duration, 160ms)");
|
|
140
|
+
expect(buttons[2]?.style.transform).toBe("translateX(-84px)");
|
|
141
|
+
|
|
142
|
+
await act(async () => {
|
|
143
|
+
mouse("mouseup", testWindow.document as never, 220);
|
|
144
|
+
mouse("click", buttons[0]!, 220);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
expect(reordered).toEqual([["home", "news"]]);
|
|
148
|
+
expect(selected).toEqual([]);
|
|
149
|
+
expect(buttons.map((button) => button.style.transform)).toEqual([
|
|
150
|
+
"translateX(0px)",
|
|
151
|
+
"translateX(0px)",
|
|
152
|
+
"translateX(0px)",
|
|
153
|
+
]);
|
|
154
|
+
expect(buttons[1]?.style.transition).toContain("transform 0ms");
|
|
155
|
+
|
|
156
|
+
await act(async () => {
|
|
157
|
+
mouse("mousedown", buttons[1]!, 101);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
expect(buttons[0]?.style.transform).toBe("translateX(0px)");
|
|
161
|
+
expect(buttons[1]?.style.transform).toBe("translateX(0px)");
|
|
162
|
+
|
|
163
|
+
await act(async () => {
|
|
164
|
+
mouse("mousemove", testWindow.document as never, 96);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
expect(buttons[0]?.style.transform).toBe("translateX(0px)");
|
|
168
|
+
expect(buttons[1]?.style.transform).toBe("translateX(-5px) scale(1.03)");
|
|
169
|
+
|
|
170
|
+
await act(async () => {
|
|
171
|
+
mouse("mouseup", testWindow.document as never, 96);
|
|
172
|
+
mouse("click", buttons[1]!, 96);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
expect(reordered).toEqual([["home", "news"]]);
|
|
176
|
+
await act(async () => root.unmount());
|
|
177
|
+
});
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/** @jsxImportSource react */
|
|
2
2
|
import Hls from "hls.js";
|
|
3
3
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState, type CSSProperties, type ReactNode } from "react";
|
|
4
|
+
import { isYoutubeEmbedUrl } from "../../../../plugins/builtin/tv/youtube-embed";
|
|
4
5
|
import type { MediaSurfaceHandle, MediaSurfaceProps } from "../../../../ui/host";
|
|
5
6
|
import { cleanDomProps, commonStyle } from "./style";
|
|
6
7
|
|
|
8
|
+
function postYoutubeCommand(frame: HTMLIFrameElement | null, func: string, args: unknown[] = []): void {
|
|
9
|
+
frame?.contentWindow?.postMessage(JSON.stringify({ event: "command", func, args }), "*");
|
|
10
|
+
}
|
|
11
|
+
|
|
7
12
|
export const WebMediaSurface = forwardRef<HTMLVideoElement, MediaSurfaceProps>(function WebMediaSurface(rawProps, forwardedRef) {
|
|
8
13
|
const {
|
|
9
14
|
children,
|
|
@@ -30,19 +35,47 @@ export const WebMediaSurface = forwardRef<HTMLVideoElement, MediaSurfaceProps>(f
|
|
|
30
35
|
onError?: (message: string) => void;
|
|
31
36
|
};
|
|
32
37
|
const videoRef = useRef<HTMLVideoElement | null>(null);
|
|
38
|
+
const iframeRef = useRef<HTMLIFrameElement | null>(null);
|
|
39
|
+
const youtubeMutedRef = useRef(muted);
|
|
40
|
+
const youtubePlayingRef = useRef(autoPlay);
|
|
33
41
|
const [failed, setFailed] = useState(false);
|
|
34
42
|
const mediaSrc = typeof src === "string" ? src.trim() : "";
|
|
43
|
+
const youtubeEmbed = isYoutubeEmbedUrl(mediaSrc);
|
|
35
44
|
const baseStyle = commonStyle(props);
|
|
36
45
|
|
|
37
46
|
useImperativeHandle(forwardedRef, () => videoRef.current as HTMLVideoElement, []);
|
|
38
47
|
useImperativeHandle(mediaHandleRef, (): MediaSurfaceHandle => ({
|
|
39
48
|
async play() {
|
|
49
|
+
if (youtubeEmbed) {
|
|
50
|
+
postYoutubeCommand(iframeRef.current, "playVideo");
|
|
51
|
+
youtubePlayingRef.current = true;
|
|
52
|
+
onPlaybackStateChange?.("playing");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
40
55
|
if (videoRef.current) await videoRef.current.play();
|
|
41
56
|
},
|
|
42
57
|
pause() {
|
|
58
|
+
if (youtubeEmbed) {
|
|
59
|
+
postYoutubeCommand(iframeRef.current, "pauseVideo");
|
|
60
|
+
youtubePlayingRef.current = false;
|
|
61
|
+
onPlaybackStateChange?.("paused");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
43
64
|
videoRef.current?.pause();
|
|
44
65
|
},
|
|
45
66
|
async toggle() {
|
|
67
|
+
if (youtubeEmbed) {
|
|
68
|
+
if (youtubePlayingRef.current) {
|
|
69
|
+
postYoutubeCommand(iframeRef.current, "pauseVideo");
|
|
70
|
+
youtubePlayingRef.current = false;
|
|
71
|
+
onPlaybackStateChange?.("paused");
|
|
72
|
+
} else {
|
|
73
|
+
postYoutubeCommand(iframeRef.current, "playVideo");
|
|
74
|
+
youtubePlayingRef.current = true;
|
|
75
|
+
onPlaybackStateChange?.("playing");
|
|
76
|
+
}
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
46
79
|
const video = videoRef.current;
|
|
47
80
|
if (!video) return;
|
|
48
81
|
if (video.paused) {
|
|
@@ -52,14 +85,27 @@ export const WebMediaSurface = forwardRef<HTMLVideoElement, MediaSurfaceProps>(f
|
|
|
52
85
|
}
|
|
53
86
|
},
|
|
54
87
|
toggleMuted() {
|
|
88
|
+
if (youtubeEmbed) {
|
|
89
|
+
youtubeMutedRef.current = !youtubeMutedRef.current;
|
|
90
|
+
postYoutubeCommand(iframeRef.current, youtubeMutedRef.current ? "mute" : "unMute");
|
|
91
|
+
onMutedChange?.(youtubeMutedRef.current);
|
|
92
|
+
return youtubeMutedRef.current;
|
|
93
|
+
}
|
|
55
94
|
const video = videoRef.current;
|
|
56
95
|
if (!video) return muted;
|
|
57
96
|
video.muted = !video.muted;
|
|
58
97
|
return video.muted;
|
|
59
98
|
},
|
|
60
|
-
}), [muted]);
|
|
99
|
+
}), [muted, onMutedChange, onPlaybackStateChange, youtubeEmbed]);
|
|
61
100
|
|
|
62
101
|
useEffect(() => {
|
|
102
|
+
youtubeMutedRef.current = muted;
|
|
103
|
+
if (youtubeEmbed) {
|
|
104
|
+
setFailed(false);
|
|
105
|
+
onPlaybackStateChange?.(autoPlay ? "playing" : "paused");
|
|
106
|
+
onMutedChange?.(muted);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
63
109
|
const video = videoRef.current;
|
|
64
110
|
if (!video || !mediaSrc) {
|
|
65
111
|
onPlaybackStateChange?.("idle");
|
|
@@ -131,7 +177,7 @@ export const WebMediaSurface = forwardRef<HTMLVideoElement, MediaSurfaceProps>(f
|
|
|
131
177
|
video.removeAttribute("src");
|
|
132
178
|
video.load();
|
|
133
179
|
};
|
|
134
|
-
}, [autoPlay, mediaSrc, onError, onMutedChange, onPlaybackStateChange]);
|
|
180
|
+
}, [autoPlay, mediaSrc, onError, onMutedChange, onPlaybackStateChange, youtubeEmbed]);
|
|
135
181
|
|
|
136
182
|
return (
|
|
137
183
|
<div
|
|
@@ -144,7 +190,28 @@ export const WebMediaSurface = forwardRef<HTMLVideoElement, MediaSurfaceProps>(f
|
|
|
144
190
|
...(props.style as CSSProperties | undefined),
|
|
145
191
|
}}
|
|
146
192
|
>
|
|
147
|
-
{mediaSrc && !failed ? (
|
|
193
|
+
{mediaSrc && !failed && youtubeEmbed ? (
|
|
194
|
+
<iframe
|
|
195
|
+
key={mediaSrc}
|
|
196
|
+
ref={iframeRef}
|
|
197
|
+
title={title || "Live TV stream"}
|
|
198
|
+
src={mediaSrc}
|
|
199
|
+
referrerPolicy="strict-origin-when-cross-origin"
|
|
200
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
201
|
+
allowFullScreen
|
|
202
|
+
onLoad={() => {
|
|
203
|
+
iframeRef.current?.contentWindow?.postMessage(JSON.stringify({ event: "listening", id: 1 }), "*");
|
|
204
|
+
onPlaybackStateChange?.(autoPlay ? "playing" : "paused");
|
|
205
|
+
}}
|
|
206
|
+
style={{
|
|
207
|
+
width: "100%",
|
|
208
|
+
height: "100%",
|
|
209
|
+
border: 0,
|
|
210
|
+
display: "block",
|
|
211
|
+
background: "#050505",
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
) : mediaSrc && !failed ? (
|
|
148
215
|
<video
|
|
149
216
|
key={mediaSrc}
|
|
150
217
|
ref={videoRef}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
useRef,
|
|
5
5
|
useState,
|
|
6
6
|
type CSSProperties,
|
|
7
|
+
type MouseEvent as ReactMouseEvent,
|
|
7
8
|
type WheelEvent as ReactWheelEvent,
|
|
8
9
|
} from "react";
|
|
9
10
|
import type { HostTabsProps } from "../../../../ui/host";
|
|
@@ -21,11 +22,19 @@ export function WebTabs({
|
|
|
21
22
|
closeMode = "always",
|
|
22
23
|
addLabel = "+",
|
|
23
24
|
onAdd,
|
|
25
|
+
onReorder,
|
|
24
26
|
focused = false,
|
|
25
27
|
palette,
|
|
26
28
|
}: HostTabsProps) {
|
|
27
29
|
const activeTabRef = useRef<HTMLButtonElement | null>(null);
|
|
30
|
+
const tabListRef = useRef<HTMLDivElement | null>(null);
|
|
31
|
+
const dragCleanupRef = useRef<(() => void) | null>(null);
|
|
32
|
+
const dragOffsetXRef = useRef(0);
|
|
33
|
+
const dragSourceWidthRef = useRef(0);
|
|
34
|
+
const suppressClickRef = useRef(false);
|
|
28
35
|
const [hoveredValue, setHoveredValue] = useState<string | null>(null);
|
|
36
|
+
const [dragSourceValue, setDragSourceValue] = useState<string | null>(null);
|
|
37
|
+
const [dragTargetValue, setDragTargetValue] = useState<string | null>(null);
|
|
29
38
|
const showUnderline = variant === "underline" && !compact;
|
|
30
39
|
// A tab bar occupies exactly the one row every caller reserves for it. Any
|
|
31
40
|
// extra pixels here are pixels the pane's children are told they own and the
|
|
@@ -42,6 +51,60 @@ export function WebTabs({
|
|
|
42
51
|
});
|
|
43
52
|
}, [activeValue, tabs]);
|
|
44
53
|
|
|
54
|
+
useEffect(() => () => dragCleanupRef.current?.(), []);
|
|
55
|
+
|
|
56
|
+
const startReorder = (sourceValue: string, event: ReactMouseEvent<HTMLButtonElement>) => {
|
|
57
|
+
if (event.button !== 0) return;
|
|
58
|
+
dragCleanupRef.current?.();
|
|
59
|
+
const sourceElement = event.currentTarget;
|
|
60
|
+
const sourceBounds = sourceElement.getBoundingClientRect();
|
|
61
|
+
const startX = event.clientX;
|
|
62
|
+
const targets = [...tabListRef.current?.querySelectorAll<HTMLButtonElement>("[data-reorderable='true']") ?? []]
|
|
63
|
+
.map((button) => ({ value: button.dataset.tabValue ?? "", bounds: button.getBoundingClientRect() }));
|
|
64
|
+
const resolveTarget = (clientX: number) => targets.reduce((closest, target) => {
|
|
65
|
+
const distance = clientX < target.bounds.left
|
|
66
|
+
? target.bounds.left - clientX
|
|
67
|
+
: clientX > target.bounds.right ? clientX - target.bounds.right : 0;
|
|
68
|
+
return distance < closest.distance ? { value: target.value, distance } : closest;
|
|
69
|
+
}, { value: "", distance: Number.POSITIVE_INFINITY }).value || null;
|
|
70
|
+
let dragged = false;
|
|
71
|
+
|
|
72
|
+
const cleanup = () => {
|
|
73
|
+
document.removeEventListener("mousemove", handleMove);
|
|
74
|
+
document.removeEventListener("mouseup", handleUp);
|
|
75
|
+
document.body.classList.remove("gloom-dragging");
|
|
76
|
+
dragCleanupRef.current = null;
|
|
77
|
+
dragOffsetXRef.current = 0;
|
|
78
|
+
dragSourceWidthRef.current = 0;
|
|
79
|
+
setDragSourceValue(null);
|
|
80
|
+
setDragTargetValue(null);
|
|
81
|
+
};
|
|
82
|
+
const handleMove = (moveEvent: MouseEvent) => {
|
|
83
|
+
const offsetX = moveEvent.clientX - startX;
|
|
84
|
+
if (!dragged && Math.abs(offsetX) < 4) return;
|
|
85
|
+
dragged = true;
|
|
86
|
+
moveEvent.preventDefault();
|
|
87
|
+
dragOffsetXRef.current = offsetX;
|
|
88
|
+
sourceElement.style.transform = `translateX(${offsetX}px) scale(1.03)`;
|
|
89
|
+
document.body.classList.add("gloom-dragging");
|
|
90
|
+
setDragTargetValue(resolveTarget(sourceBounds.left + offsetX + sourceBounds.width / 2));
|
|
91
|
+
};
|
|
92
|
+
const handleUp = (upEvent: MouseEvent) => {
|
|
93
|
+
const targetValue = resolveTarget(sourceBounds.left + upEvent.clientX - startX + sourceBounds.width / 2);
|
|
94
|
+
suppressClickRef.current = dragged;
|
|
95
|
+
cleanup();
|
|
96
|
+
if (dragged && targetValue && targetValue !== sourceValue) {
|
|
97
|
+
onReorder?.(sourceValue, targetValue);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
dragSourceWidthRef.current = sourceBounds.width;
|
|
102
|
+
setDragSourceValue(sourceValue);
|
|
103
|
+
document.addEventListener("mousemove", handleMove);
|
|
104
|
+
document.addEventListener("mouseup", handleUp);
|
|
105
|
+
dragCleanupRef.current = cleanup;
|
|
106
|
+
};
|
|
107
|
+
|
|
45
108
|
const handleWheel = (event: ReactWheelEvent<HTMLDivElement>) => {
|
|
46
109
|
const element = event.currentTarget;
|
|
47
110
|
if (element.scrollWidth <= element.clientWidth) return;
|
|
@@ -68,8 +131,13 @@ export function WebTabs({
|
|
|
68
131
|
return palette.inactiveFg;
|
|
69
132
|
};
|
|
70
133
|
|
|
134
|
+
const dragSourceIndex = tabs.findIndex((tab) => tab.value === dragSourceValue);
|
|
135
|
+
const dragTargetIndex = tabs.findIndex((tab) => tab.value === dragTargetValue);
|
|
136
|
+
const dragSlotWidth = dragSourceWidthRef.current + (dense ? 2 : 4);
|
|
137
|
+
|
|
71
138
|
return (
|
|
72
139
|
<div
|
|
140
|
+
ref={tabListRef}
|
|
73
141
|
data-gloom-role="tab-list"
|
|
74
142
|
role="tablist"
|
|
75
143
|
onWheel={handleWheel}
|
|
@@ -89,11 +157,21 @@ export function WebTabs({
|
|
|
89
157
|
boxSizing: "border-box",
|
|
90
158
|
}}
|
|
91
159
|
>
|
|
92
|
-
{tabs.map((tab) => {
|
|
160
|
+
{tabs.map((tab, index) => {
|
|
93
161
|
const active = tab.value === activeValue;
|
|
94
162
|
const disabled = tab.disabled === true;
|
|
95
163
|
const hovered = hoveredValue === tab.value && !disabled;
|
|
96
164
|
const closeVisible = !!tab.onClose && (closeMode === "always" || active);
|
|
165
|
+
const reorderable = !!onReorder && !disabled && tab.reorderable !== false;
|
|
166
|
+
const dragTarget = dragTargetValue === tab.value && dragSourceValue !== tab.value;
|
|
167
|
+
const sourceDragging = dragSourceValue === tab.value && dragTargetValue !== null;
|
|
168
|
+
const dragTranslateX = dragSourceValue === tab.value
|
|
169
|
+
? dragOffsetXRef.current
|
|
170
|
+
: dragTargetIndex >= 0 && dragSourceIndex < dragTargetIndex && index > dragSourceIndex && index <= dragTargetIndex
|
|
171
|
+
? -dragSlotWidth
|
|
172
|
+
: dragTargetIndex >= 0 && dragSourceIndex > dragTargetIndex && index >= dragTargetIndex && index < dragSourceIndex
|
|
173
|
+
? dragSlotWidth
|
|
174
|
+
: 0;
|
|
97
175
|
const tabStyle = {
|
|
98
176
|
"--tab-fg": resolveTabColor(disabled, active, hovered),
|
|
99
177
|
"--tab-hover-fg": palette.hoverFg,
|
|
@@ -117,7 +195,7 @@ export function WebTabs({
|
|
|
117
195
|
margin: 0,
|
|
118
196
|
border: "1px solid transparent",
|
|
119
197
|
borderRadius: variant === "underline" ? 5 : 6,
|
|
120
|
-
background: resolveTabBackground(active, hovered),
|
|
198
|
+
background: resolveTabBackground(active, hovered || dragTarget),
|
|
121
199
|
boxSizing: "border-box",
|
|
122
200
|
font: "inherit",
|
|
123
201
|
fontSize: tabFontSize,
|
|
@@ -128,8 +206,11 @@ export function WebTabs({
|
|
|
128
206
|
borderColor: active && focused && variant !== "pill"
|
|
129
207
|
? `color-mix(in srgb, ${palette.activeUnderline} 35%, transparent)`
|
|
130
208
|
: "transparent",
|
|
131
|
-
|
|
132
|
-
|
|
209
|
+
transform: `translateX(${dragTranslateX}px)${sourceDragging ? " scale(1.03)" : ""}`,
|
|
210
|
+
zIndex: dragSourceValue === tab.value ? 2 : undefined,
|
|
211
|
+
willChange: dragSourceValue ? "transform" : undefined,
|
|
212
|
+
transition: `background-color 110ms ease, border-color 110ms ease, color 110ms ease, transform ${dragSourceValue && dragSourceValue !== tab.value ? "var(--tab-reorder-duration, 160ms)" : "0ms"} cubic-bezier(0.77, 0, 0.175, 1)`,
|
|
213
|
+
cursor: disabled ? "default" : dragSourceValue ? "grabbing" : reorderable ? "grab" : "pointer",
|
|
133
214
|
} satisfies CssVars;
|
|
134
215
|
|
|
135
216
|
return (
|
|
@@ -138,15 +219,26 @@ export function WebTabs({
|
|
|
138
219
|
ref={active ? activeTabRef : undefined}
|
|
139
220
|
data-gloom-role="tab-button"
|
|
140
221
|
data-active={active ? "true" : undefined}
|
|
222
|
+
data-reorderable={reorderable ? "true" : undefined}
|
|
223
|
+
data-tab-value={tab.value}
|
|
141
224
|
type="button"
|
|
142
225
|
role="tab"
|
|
143
226
|
aria-selected={active}
|
|
144
227
|
aria-disabled={disabled || undefined}
|
|
145
228
|
disabled={disabled}
|
|
229
|
+
draggable={false}
|
|
230
|
+
aria-grabbed={reorderable && dragSourceValue === tab.value ? true : undefined}
|
|
146
231
|
style={tabStyle}
|
|
147
232
|
onMouseEnter={() => setHoveredValue(tab.value)}
|
|
148
233
|
onMouseLeave={() => setHoveredValue((current) => (current === tab.value ? null : current))}
|
|
149
|
-
|
|
234
|
+
onMouseDown={reorderable ? (event) => startReorder(tab.value, event) : undefined}
|
|
235
|
+
onClick={(event) => {
|
|
236
|
+
if (suppressClickRef.current) {
|
|
237
|
+
suppressClickRef.current = false;
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
event.stopPropagation();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
150
242
|
if (!disabled) onSelect(tab.value);
|
|
151
243
|
}}
|
|
152
244
|
onDoubleClick={() => {
|
|
@@ -11,7 +11,10 @@ import { webAsciiTextLines, webAsciiTextWordmarkVariant } from "./ascii-text";
|
|
|
11
11
|
import { mouseHandlers } from "./mouse";
|
|
12
12
|
import { cleanDomProps, commonStyle, textStyle } from "./style";
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
// Read per render: the cell width tracks the configured font size.
|
|
15
|
+
function wordmarkCharWidthPx(): number {
|
|
16
|
+
return Math.max(10, WEB_CELL_WIDTH);
|
|
17
|
+
}
|
|
15
18
|
|
|
16
19
|
interface WebAsciiTextProps extends AsciiTextProps {
|
|
17
20
|
desktopPlatform?: string;
|
|
@@ -105,7 +108,7 @@ export function WebAsciiText({
|
|
|
105
108
|
const resolvedBackground = bg ?? backgroundColor;
|
|
106
109
|
const lineHeightPx = isCompatWordmark ? 16 : 12;
|
|
107
110
|
const wordmarkWidthPx = isCompatWordmark
|
|
108
|
-
? Math.max(...lines.map((line) => line.length)) *
|
|
111
|
+
? Math.max(...lines.map((line) => line.length)) * wordmarkCharWidthPx()
|
|
109
112
|
: undefined;
|
|
110
113
|
return (
|
|
111
114
|
<div
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/** @jsxImportSource react */
|
|
2
|
+
import { Window } from "happy-dom";
|
|
3
|
+
|
|
4
|
+
// The desktop/browser host is the only renderer with a real DOM underneath it,
|
|
5
|
+
// so the keys the shared shortcut model depends on have to be proven here.
|
|
6
|
+
const testWindow = new Window({ url: "http://localhost" });
|
|
7
|
+
Object.assign(globalThis, {
|
|
8
|
+
window: testWindow,
|
|
9
|
+
document: testWindow.document,
|
|
10
|
+
navigator: testWindow.navigator,
|
|
11
|
+
KeyboardEvent: testWindow.KeyboardEvent,
|
|
12
|
+
Event: testWindow.Event,
|
|
13
|
+
HTMLElement: testWindow.HTMLElement,
|
|
14
|
+
Node: testWindow.Node,
|
|
15
|
+
requestAnimationFrame: (callback: (time: number) => void) => setTimeout(() => callback(Date.now()), 8),
|
|
16
|
+
cancelAnimationFrame: (id: number) => clearTimeout(id),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
import { afterEach, expect, test } from "bun:test";
|
|
20
|
+
import { act } from "react";
|
|
21
|
+
import { createRoot } from "react-dom/client";
|
|
22
|
+
import { useShortcut, type KeyEventLike } from "../../../react/input";
|
|
23
|
+
import { WebInputHostProvider } from "./input-host";
|
|
24
|
+
|
|
25
|
+
let cleanup: (() => void) | null = null;
|
|
26
|
+
|
|
27
|
+
afterEach(async () => {
|
|
28
|
+
const teardown = cleanup;
|
|
29
|
+
cleanup = null;
|
|
30
|
+
if (!teardown) return;
|
|
31
|
+
await act(async () => {
|
|
32
|
+
teardown();
|
|
33
|
+
await Promise.resolve();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
function Probe({ onKey }: { onKey: (event: KeyEventLike) => void }) {
|
|
38
|
+
useShortcut(onKey, { phase: "before" });
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function mountProbe(onKey?: (event: KeyEventLike) => void): Promise<KeyEventLike[]> {
|
|
43
|
+
const seen: KeyEventLike[] = [];
|
|
44
|
+
const container = testWindow.document.createElement("div");
|
|
45
|
+
testWindow.document.body.appendChild(container);
|
|
46
|
+
const root = createRoot(container as unknown as HTMLElement);
|
|
47
|
+
await act(async () => {
|
|
48
|
+
root.render(
|
|
49
|
+
<WebInputHostProvider>
|
|
50
|
+
<Probe onKey={(event) => {
|
|
51
|
+
seen.push(event);
|
|
52
|
+
onKey?.(event);
|
|
53
|
+
}} />
|
|
54
|
+
</WebInputHostProvider>,
|
|
55
|
+
);
|
|
56
|
+
});
|
|
57
|
+
cleanup = () => {
|
|
58
|
+
root.unmount();
|
|
59
|
+
container.remove();
|
|
60
|
+
};
|
|
61
|
+
return seen;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function pressKey(
|
|
65
|
+
key: string,
|
|
66
|
+
options: { target?: unknown; shiftKey?: boolean; metaKey?: boolean; ctrlKey?: boolean } = {},
|
|
67
|
+
): Promise<{ defaultPrevented: boolean }> {
|
|
68
|
+
const event = new testWindow.KeyboardEvent("keydown", {
|
|
69
|
+
key,
|
|
70
|
+
bubbles: true,
|
|
71
|
+
cancelable: true,
|
|
72
|
+
shiftKey: options.shiftKey ?? false,
|
|
73
|
+
metaKey: options.metaKey ?? false,
|
|
74
|
+
ctrlKey: options.ctrlKey ?? false,
|
|
75
|
+
});
|
|
76
|
+
const target = (options.target ?? testWindow.document.body) as { dispatchEvent: (event: unknown) => void };
|
|
77
|
+
await act(async () => {
|
|
78
|
+
target.dispatchEvent(event);
|
|
79
|
+
await Promise.resolve();
|
|
80
|
+
});
|
|
81
|
+
return { defaultPrevented: event.defaultPrevented };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
test("delivers plain Tab and Shift-Tab outside editable controls", async () => {
|
|
85
|
+
const seen = await mountProbe();
|
|
86
|
+
|
|
87
|
+
await pressKey("Tab");
|
|
88
|
+
await pressKey("Tab", { shiftKey: true });
|
|
89
|
+
|
|
90
|
+
expect(seen.map((event) => ({ name: event.name, shift: event.shift, editable: event.targetEditable })))
|
|
91
|
+
.toEqual([
|
|
92
|
+
{ name: "tab", shift: false, editable: false },
|
|
93
|
+
{ name: "tab", shift: true, editable: false },
|
|
94
|
+
]);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test("leaves Tab to the field when an editable control owns the focus", async () => {
|
|
98
|
+
const seen = await mountProbe();
|
|
99
|
+
const input = testWindow.document.createElement("input");
|
|
100
|
+
testWindow.document.body.appendChild(input);
|
|
101
|
+
|
|
102
|
+
const result = await pressKey("Tab", { target: input });
|
|
103
|
+
|
|
104
|
+
// The event still reaches the registry, but the shared model refuses to
|
|
105
|
+
// deliver an unmodified key to a handler while a field is focused, and the
|
|
106
|
+
// host must not swallow the browser's own focus move either.
|
|
107
|
+
expect(seen).toEqual([]);
|
|
108
|
+
expect(result.defaultPrevented).toBe(false);
|
|
109
|
+
input.remove();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test("reports Cmd-digit as a meta shortcut so layout switching can claim it", async () => {
|
|
113
|
+
const seen = await mountProbe();
|
|
114
|
+
|
|
115
|
+
await pressKey("2", { metaKey: true });
|
|
116
|
+
await pressKey("3", { ctrlKey: true });
|
|
117
|
+
|
|
118
|
+
expect(seen.map((event) => ({ name: event.name, ctrl: event.ctrl, meta: event.meta, super: event.super })))
|
|
119
|
+
.toEqual([
|
|
120
|
+
{ name: "2", ctrl: false, meta: true, super: true },
|
|
121
|
+
{ name: "3", ctrl: true, meta: false, super: false },
|
|
122
|
+
]);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Cmd-digit is a browser tab shortcut, so the app only keeps it if its handler
|
|
126
|
+
// still sees the key while a field is focused and can cancel the default there.
|
|
127
|
+
test("delivers Cmd-digit from an editable field and lets a handler cancel the browser default", async () => {
|
|
128
|
+
const seen = await mountProbe((event) => {
|
|
129
|
+
if (event.name === "1" && event.meta) event.preventDefault();
|
|
130
|
+
});
|
|
131
|
+
const input = testWindow.document.createElement("input");
|
|
132
|
+
testWindow.document.body.appendChild(input);
|
|
133
|
+
|
|
134
|
+
const result = await pressKey("1", { target: input, metaKey: true });
|
|
135
|
+
|
|
136
|
+
expect(seen.map((event) => ({ name: event.name, meta: event.meta, editable: event.targetEditable })))
|
|
137
|
+
.toEqual([{ name: "1", meta: true, editable: true }]);
|
|
138
|
+
expect(result.defaultPrevented).toBe(true);
|
|
139
|
+
input.remove();
|
|
140
|
+
});
|
|
@@ -18,9 +18,11 @@ import {
|
|
|
18
18
|
shouldConsumeWebAppKeyDown,
|
|
19
19
|
webKeySequence,
|
|
20
20
|
} from "./key-event";
|
|
21
|
+
import { WEB_CELL_HEIGHT, WEB_CELL_WIDTH } from "../../../theme/font-scale";
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
// Re-exported as live bindings so every consumer follows the configured font
|
|
24
|
+
// size (see theme/font-scale) without threading metrics through the tree.
|
|
25
|
+
export { WEB_CELL_HEIGHT, WEB_CELL_WIDTH } from "../../../theme/font-scale";
|
|
24
26
|
|
|
25
27
|
function toKeyEventLike(event: KeyboardEvent): KeyEventLike {
|
|
26
28
|
const key = normalizeWebKeyName(event.key);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NOTES_FILES_CAPABILITY_ID } from "../../../../capabilities";
|
|
1
2
|
import type {
|
|
2
3
|
ApplicationMenuSelectMessage,
|
|
3
4
|
CapabilityEventMessage,
|
|
@@ -28,10 +29,27 @@ export function backendRequest<K extends Exclude<DesktopBackendRequestMethod, "c
|
|
|
28
29
|
method: K,
|
|
29
30
|
...args: DesktopBackendRequestArgs<K>
|
|
30
31
|
): Promise<DesktopBackendRequestResponse<K>>;
|
|
31
|
-
export async function backendRequest(): Promise<unknown> {
|
|
32
|
+
export async function backendRequest(method: string, payload?: unknown): Promise<unknown> {
|
|
33
|
+
const neutral = neutralReadResult(method, payload);
|
|
34
|
+
if (neutral !== undefined) return neutral;
|
|
32
35
|
throw new Error("Electrobun backend requests are unavailable in the CLI screenshot renderer.");
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
/**
|
|
39
|
+
* There is no backend behind a screenshot, so a read that only feeds the view
|
|
40
|
+
* degrades to an empty result and the pane renders its real empty state instead
|
|
41
|
+
* of the whole render dying on one rejected request. Writes keep throwing: a
|
|
42
|
+
* pane must never believe it saved something that went nowhere.
|
|
43
|
+
*/
|
|
44
|
+
function neutralReadResult(method: string, payload: unknown): unknown {
|
|
45
|
+
if (method !== "capability.invoke") return undefined;
|
|
46
|
+
const request = payload as { capabilityId?: string; operationId?: string } | undefined;
|
|
47
|
+
if (request?.capabilityId !== NOTES_FILES_CAPABILITY_ID) return undefined;
|
|
48
|
+
if (request.operationId === "load") return "";
|
|
49
|
+
if (request.operationId === "loadQuickNotesIndex") return [];
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
|
|
35
53
|
export async function initElectrobunBackend(): Promise<ElectrobunBackendInit> {
|
|
36
54
|
throw new Error("Electrobun backend initialization is unavailable in the CLI screenshot renderer.");
|
|
37
55
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function loadRobinhoodNativeModule(): Promise<never> {
|
|
2
|
+
return Promise.reject(new Error("Robinhood native sync is unavailable in the desktop web renderer."));
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function loadSimpleFinNativeModule(): Promise<never> {
|
|
6
|
+
return Promise.reject(new Error("SimpleFIN native sync is unavailable in the desktop web renderer."));
|
|
7
|
+
}
|
|
@@ -7,3 +7,13 @@ export function getCachedKittySupport(_renderer: NativeRendererHost): boolean {
|
|
|
7
7
|
export function ensureKittySupport(_renderer: NativeRendererHost): Promise<boolean> {
|
|
8
8
|
return Promise.resolve(false);
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
// The desktop webview is never behind a terminal multiplexer and never draws
|
|
12
|
+
// kitty graphics, so both answers are constant here.
|
|
13
|
+
export function isMultiplexedTerminal(): boolean {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function resolveKittySupport(): boolean {
|
|
18
|
+
return false;
|
|
19
|
+
}
|