gloomberb 0.11.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -15
- package/README.zh-CN.md +12 -12
- package/package.json +10 -3
- package/src/api-client/auth.ts +14 -10
- package/src/api-client/data.ts +54 -0
- package/src/api-client/index.test.ts +124 -0
- package/src/api-client/index.ts +139 -4
- package/src/api-client/paths.ts +89 -0
- package/src/api-client/request.ts +15 -2
- package/src/api-client/socket-health.test.ts +1 -0
- package/src/api-client/socket.ts +2 -1
- package/src/api-client/types.ts +163 -0
- package/src/app/pane-runtime/index.tsx +4 -1
- package/src/app/pane-runtime/plugin-bindings.test.ts +117 -0
- package/src/app/pane-runtime/plugin-bindings.ts +25 -4
- package/src/app/pane-runtime/ticker-inspector-runtime.ts +25 -14
- package/src/app/runtime/desktop-deeplink.test.ts +16 -0
- package/src/app/runtime/desktop-deeplink.ts +66 -2
- package/src/app/runtime/desktop-menu.ts +3 -0
- package/src/app/runtime/plugin-bindings.ts +30 -28
- package/src/app/runtime/update.ts +8 -6
- package/src/app.tsx +21 -7
- package/src/architecture/import-boundaries.test.ts +5 -1
- package/src/capabilities/factories.ts +4 -0
- package/src/cli/commands/automation.test.ts +9 -0
- package/src/cli/commands/automation.ts +22 -73
- package/src/cli/index.ts +10 -6
- package/src/cli/registry.ts +1 -1
- package/src/components/chart/composite/composite-chart.test.tsx +45 -2
- package/src/components/chart/composite/composite-chart.tsx +16 -12
- package/src/components/chart/composite/format.test.ts +34 -0
- package/src/components/chart/composite/format.ts +33 -10
- package/src/components/chart/composite/scene.ts +0 -21
- package/src/components/chart/composite/tools.ts +49 -0
- package/src/components/chart/core/axis-format.ts +13 -3
- package/src/components/chart/core/index.test.ts +7 -0
- package/src/components/chart/core/renderer.ts +3 -4
- package/src/components/command-bar/commands/direct/index.ts +4 -0
- package/src/components/command-bar/commands/registry.ts +8 -1
- package/src/components/command-bar/layout-items/current-layout.ts +1 -1
- package/src/components/command-bar/pane-templates/workflow.ts +4 -0
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +3 -0
- package/src/components/command-bar/routes/root/shortcuts.test.ts +19 -0
- package/src/components/command-bar/routes/root/shortcuts.ts +3 -1
- package/src/components/command-bar/surface/index.test.tsx +6 -6
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/surface/pane.test.tsx +66 -2
- package/src/components/command-bar/view-model.test.ts +2 -1
- package/src/components/command-bar/workflow/ops.test.ts +54 -0
- package/src/components/command-bar/workflow/ops.ts +1 -1
- package/src/components/company-logo.test.ts +19 -0
- package/src/components/company-logo.tsx +60 -0
- package/src/components/feed-data-table/stack-view.tsx +7 -1
- package/src/components/index.ts +1 -0
- package/src/components/layout/detached-pane-shell.tsx +85 -15
- package/src/components/layout/header.tsx +5 -5
- package/src/components/layout/pane/title.ts +31 -3
- package/src/components/layout/shell/active-drag.ts +4 -11
- package/src/components/layout/shell/drag/index.ts +4 -20
- package/src/components/layout/shell/drag/runtime.ts +3 -4
- package/src/components/layout/shell/index.test.tsx +17 -3
- package/src/components/layout/shell/index.tsx +89 -31
- package/src/components/layout/shell/menu.test.ts +37 -1
- package/src/components/layout/shell/menu.ts +14 -0
- package/src/components/layout/shell/native/pointer-runtime.ts +22 -8
- package/src/components/layout/shell/pane/actions.ts +0 -5
- package/src/components/layout/shell/pane/management-shortcuts.ts +9 -4
- package/src/components/layout/shell/shortcuts.ts +6 -3
- package/src/components/layout/shell/ticker-link-menu.test.ts +82 -0
- package/src/components/layout/shell/ticker-link-menu.ts +78 -0
- package/src/components/layout/status-bar.test.tsx +62 -61
- package/src/components/layout/status-bar.tsx +53 -75
- package/src/components/onboarding/account-step/form-panel.tsx +4 -2
- package/src/components/onboarding/account-step/index.tsx +1 -1
- package/src/components/onboarding/account-step/signed-in-panel.tsx +1 -1
- package/src/components/onboarding/onboarding-wizard.test.tsx +44 -1
- package/src/components/onboarding/onboarding-wizard.tsx +13 -5
- package/src/components/onboarding/wizard-account.ts +4 -23
- package/src/components/table-view-shared.test.ts +11 -0
- package/src/components/table-view-shared.tsx +26 -0
- package/src/components/ui/data-table/index.tsx +19 -1
- package/src/components/ui/fields.tsx +5 -1
- package/src/core/state/app/layout-reducer.ts +36 -0
- package/src/core/state/app/layout.ts +10 -5
- package/src/core/state/app/state.ts +0 -13
- package/src/core/state/app/types.ts +6 -4
- package/src/data/config/chart-settings.ts +1 -1
- package/src/data/config/layout.ts +2 -0
- package/src/data/config/store/index.test.ts +27 -6
- package/src/data/config/store/normalize.ts +3 -5
- package/src/data/plugin-state-store.ts +11 -0
- package/src/data/sqlite/cache.test.ts +10 -0
- package/src/i18n/es.ts +13 -5
- package/src/i18n/ja.ts +13 -5
- package/src/i18n/ko.ts +13 -5
- package/src/i18n/zh-cn.ts +13 -5
- package/src/i18n/zh-tw.ts +13 -5
- package/src/layout-marketplace/api.test.ts +54 -0
- package/src/layout-marketplace/api.ts +65 -0
- package/src/layout-marketplace/gallery-desktop.test.tsx +262 -0
- package/src/layout-marketplace/gallery-desktop.tsx +375 -0
- package/src/layout-marketplace/gallery-terminal.tsx +376 -0
- package/src/layout-marketplace/gallery.test.tsx +84 -0
- package/src/layout-marketplace/gallery.tsx +323 -0
- package/src/layout-marketplace/geometry.test.ts +47 -0
- package/src/layout-marketplace/geometry.ts +80 -0
- package/src/layout-marketplace/mini-workspace.test.tsx +122 -0
- package/src/layout-marketplace/mini-workspace.tsx +428 -0
- package/src/layout-marketplace/model.test.ts +118 -0
- package/src/layout-marketplace/model.ts +171 -0
- package/src/layout-marketplace/name-dialog.tsx +60 -0
- package/src/layout-marketplace/pane-imagery.ts +85 -0
- package/src/layout-marketplace/pane.tsx +20 -0
- package/src/layout-marketplace/payload.test.ts +246 -0
- package/src/layout-marketplace/payload.ts +624 -0
- package/src/layout-marketplace/use-marketplace.ts +63 -0
- package/src/market-data/coordinator/index.test.ts +2 -2
- package/src/market-data/coordinator/index.ts +1 -1
- package/src/market-data/hooks.tsx +0 -41
- package/src/market-data/market/format.test.ts +7 -0
- package/src/market-data/market/freshness.ts +5 -2
- package/src/market-data/quotes/freshness.test.ts +16 -0
- package/src/news/aggregator.test.ts +92 -3
- package/src/news/aggregator.ts +98 -18
- package/src/news/hooks.test.tsx +2 -0
- package/src/news/hooks.ts +27 -1
- package/src/news/news-model.ts +5 -2
- package/src/news/types.ts +7 -0
- package/src/plugins/broker-sync/broker-sync.test.ts +58 -0
- package/src/plugins/broker-sync/normalize.ts +42 -5
- package/src/plugins/builtin/account-management/pane.tsx +5 -5
- package/src/plugins/builtin/ai/index.tsx +18 -2
- package/src/plugins/builtin/ai/screener/pane.test.tsx +47 -4
- package/src/plugins/builtin/ai/screener/pane.tsx +35 -12
- package/src/plugins/builtin/alerts/alert-engine.test.ts +53 -1
- package/src/plugins/builtin/alerts/alert-engine.ts +34 -1
- package/src/plugins/builtin/alerts/index.test.tsx +49 -6
- package/src/plugins/builtin/alerts/index.tsx +11 -6
- package/src/plugins/builtin/alerts/pane.tsx +51 -9
- package/src/plugins/builtin/alerts/quotes.ts +11 -3
- package/src/plugins/builtin/alerts/types.ts +1 -0
- package/src/plugins/builtin/analytics/index.tsx +11 -1
- package/src/plugins/builtin/analytics/pane-model.ts +6 -4
- package/src/plugins/builtin/broker-manager/index.tsx +3 -0
- package/src/plugins/builtin/buildout/model/index.ts +1 -1
- package/src/plugins/builtin/buildout/pane/index.tsx +17 -18
- package/src/plugins/builtin/cds/client.test.ts +83 -0
- package/src/plugins/builtin/cds/client.ts +67 -0
- package/src/plugins/builtin/cds/index.tsx +41 -0
- package/src/plugins/builtin/cds/model.test.ts +232 -0
- package/src/plugins/builtin/cds/model.ts +401 -0
- package/src/plugins/builtin/cds/pane.test.tsx +132 -0
- package/src/plugins/builtin/cds/pane.tsx +358 -0
- package/src/plugins/builtin/chart-composer/chart-spec.ts +31 -0
- package/src/plugins/builtin/chart-composer/index.tsx +88 -2
- package/src/plugins/builtin/chart-composer/pane-share.test.ts +71 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +103 -15
- package/src/plugins/builtin/chat/content/index.tsx +4 -1
- package/src/plugins/builtin/chat/controller/channels.ts +7 -1
- package/src/plugins/builtin/chat/controller/index.ts +14 -9
- package/src/plugins/builtin/chat/controller/notifications.ts +13 -3
- package/src/plugins/builtin/chat/controller/persistence.ts +0 -3
- package/src/plugins/builtin/chat/controller/realtime.ts +3 -3
- package/src/plugins/builtin/chat/controller/send.ts +1 -3
- package/src/plugins/builtin/chat/controller/session-runtime.ts +18 -11
- package/src/plugins/builtin/chat/controller/state.ts +1 -3
- package/src/plugins/builtin/chat/controller/storage.ts +0 -2
- package/src/plugins/builtin/chat/controller/utils.ts +4 -6
- package/src/plugins/builtin/chat/controller/view.ts +2 -2
- package/src/plugins/builtin/chat/controller.test.ts +142 -14
- package/src/plugins/builtin/chat/message/desktop.test.tsx +88 -0
- package/src/plugins/builtin/chat/message/desktop.tsx +3 -1
- package/src/plugins/builtin/chat/message/profile-popover.test.tsx +1 -29
- package/src/plugins/builtin/chat/profile-popover.ts +53 -22
- package/src/plugins/builtin/chat/sidebar.test.tsx +81 -0
- package/src/plugins/builtin/chat/sidebar.tsx +63 -0
- package/src/plugins/builtin/chat/test-harness.tsx +29 -1
- package/src/plugins/builtin/cloud/auth-actions.tsx +14 -7
- package/src/plugins/builtin/cloud/auth-commands.ts +21 -51
- package/src/plugins/builtin/cloud/auth-dialog.tsx +296 -0
- package/src/{components/onboarding/account-step/model.test.ts → plugins/builtin/cloud/auth-model.test.ts} +1 -1
- package/src/{components/onboarding/account-step/model.ts → plugins/builtin/cloud/auth-model.ts} +37 -3
- package/src/plugins/builtin/cloud/browser.tsx +9 -0
- package/src/plugins/builtin/cloud/buildout-module.tsx +23 -0
- package/src/plugins/builtin/cloud/device-signin.ts +2 -8
- package/src/plugins/builtin/cloud/index.tsx +2 -0
- package/src/plugins/builtin/cloud/plugin.tsx +14 -24
- package/src/plugins/builtin/cloud/upgrade-command.ts +13 -6
- package/src/plugins/builtin/cloud-tweets/pane-share.test.ts +56 -0
- package/src/plugins/builtin/cloud-tweets/pane.tsx +20 -5
- package/src/plugins/builtin/cloud-tweets/registration.ts +50 -6
- package/src/plugins/builtin/composite-plugins.ts +3 -1
- package/src/plugins/builtin/congress-trades/detail.tsx +43 -1
- package/src/plugins/builtin/congress-trades/model.test.ts +85 -0
- package/src/plugins/builtin/congress-trades/model.ts +69 -1
- package/src/plugins/builtin/congress-trades/pane.tsx +51 -2
- package/src/plugins/builtin/connections/index.ts +3 -0
- package/src/plugins/builtin/dividend-yield/client.ts +18 -0
- package/src/plugins/builtin/dividend-yield/pane.tsx +7 -6
- package/src/plugins/builtin/earnings/index.tsx +5 -3
- package/src/plugins/builtin/earnings/model.test.ts +19 -1
- package/src/plugins/builtin/earnings/model.ts +17 -15
- package/src/plugins/builtin/econ/calendar-model.ts +0 -5
- package/src/plugins/builtin/econ/index.test.tsx +6 -1
- package/src/plugins/builtin/fear-greed/charts.tsx +12 -8
- package/src/plugins/builtin/help/index.tsx +2 -2
- package/src/plugins/builtin/holders/thirteenf-match.ts +1 -2
- package/src/plugins/builtin/insider/index.tsx +27 -11
- package/src/plugins/builtin/kelly-sizer/index.tsx +4 -1
- package/src/plugins/builtin/layout-manager/index.tsx +17 -4
- package/src/plugins/builtin/news/index.tsx +11 -6
- package/src/plugins/builtin/news/wire/breaking/notifications.test.ts +2 -0
- package/src/plugins/builtin/news/wire/breaking/pane.test.tsx +2 -0
- package/src/plugins/builtin/news/wire/breaking/pane.tsx +4 -1
- package/src/plugins/builtin/news/wire/feed-config.test.ts +15 -1
- package/src/plugins/builtin/news/wire/feed-config.ts +25 -5
- package/src/plugins/builtin/news/wire/index.tsx +3 -3
- package/src/plugins/builtin/news/wire/industry-pane.tsx +7 -2
- package/src/plugins/builtin/news/wire/news/footer.ts +34 -1
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +4 -1
- package/src/plugins/builtin/news/wire/news/table.tsx +8 -2
- package/src/plugins/builtin/news/wire/rss/source.test.ts +12 -0
- package/src/plugins/builtin/news/wire/rss/source.ts +1 -1
- package/src/plugins/builtin/notes/files.ts +80 -0
- package/src/plugins/builtin/notes/index.tsx +3 -0
- package/src/plugins/builtin/notes/sync.test.ts +49 -0
- package/src/plugins/builtin/notes/sync.ts +98 -0
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options/view.test.tsx +25 -3
- package/src/plugins/builtin/options/view.tsx +1 -0
- package/src/plugins/builtin/portfolio-list/account-metrics.test.ts +22 -0
- package/src/plugins/builtin/portfolio-list/account-metrics.ts +12 -7
- package/src/plugins/builtin/portfolio-list/cli/render.ts +5 -3
- package/src/plugins/builtin/portfolio-list/column-values.ts +15 -4
- package/src/plugins/builtin/portfolio-list/header.tsx +13 -3
- package/src/plugins/builtin/portfolio-list/index.tsx +8 -0
- package/src/plugins/builtin/portfolio-list/metrics.test.ts +31 -1
- package/src/plugins/builtin/portfolio-list/pane/index.test.tsx +1 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +10 -7
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +6 -1
- package/src/plugins/builtin/portfolio-list/position-metrics.ts +25 -6
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +35 -21
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +20 -6
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -12
- package/src/plugins/builtin/research/equity-diagnostic-pane.test.tsx +329 -0
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +582 -0
- package/src/plugins/builtin/research/index.test.ts +14 -0
- package/src/plugins/builtin/research/index.tsx +29 -0
- package/src/plugins/builtin/sec/index.tsx +24 -9
- package/src/plugins/builtin/sectors/index.tsx +14 -0
- package/src/plugins/builtin/shared/cloud-upgrade.ts +18 -11
- package/src/plugins/builtin/shared/public-pane.test.ts +12 -0
- package/src/plugins/builtin/shared/public-pane.ts +9 -0
- package/src/plugins/builtin/shared/public-share.ts +23 -0
- package/src/plugins/builtin/shared/ticker-source.ts +32 -0
- package/src/plugins/builtin/shared/ticker-surface.test.ts +27 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +17 -0
- package/src/plugins/builtin/substack/api/cache.ts +7 -3
- package/src/plugins/builtin/substack/api/loaders.ts +36 -12
- package/src/plugins/builtin/substack/api/types.ts +2 -0
- package/src/plugins/builtin/substack/pane-state.ts +1 -1
- package/src/plugins/builtin/substack/pane.tsx +55 -12
- package/src/plugins/builtin/thirteenf/api.test.ts +1 -1
- package/src/plugins/builtin/thirteenf/api.ts +40 -18
- package/src/plugins/builtin/thirteenf/data.ts +15 -7
- package/src/plugins/builtin/thirteenf/pane.tsx +45 -10
- package/src/plugins/builtin/ticker-detail/index.tsx +10 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +12 -4
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +8 -2
- package/src/plugins/builtin/ticker-detail/settings.ts +12 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/catalog-browser.test.ts +78 -0
- package/src/plugins/catalog-browser.ts +136 -0
- package/src/plugins/gridlock-notification.ts +2 -1
- package/src/plugins/ibkr/flex/index.test.ts +19 -0
- package/src/plugins/ibkr/flex/index.ts +1 -1
- package/src/plugins/pane-manager/gridlock.ts +87 -3
- package/src/plugins/pane-manager.test.ts +30 -0
- package/src/plugins/pane-manager.ts +6 -1
- package/src/plugins/prediction-markets/chart.tsx +2 -2
- package/src/plugins/prediction-markets/controller/catalog.ts +77 -2
- package/src/plugins/prediction-markets/controller/data.ts +7 -1
- package/src/plugins/prediction-markets/controller/index.ts +9 -2
- package/src/plugins/prediction-markets/controller/keyboard.ts +10 -14
- package/src/plugins/prediction-markets/detail/overview.tsx +21 -0
- package/src/plugins/prediction-markets/detail/pane.tsx +43 -34
- package/src/plugins/prediction-markets/detail/trades.tsx +34 -9
- package/src/plugins/prediction-markets/detail.test.tsx +29 -2
- package/src/plugins/prediction-markets/index.tsx +8 -4
- package/src/plugins/prediction-markets/navigation.ts +0 -1
- package/src/plugins/prediction-markets/pane.test.tsx +77 -0
- package/src/plugins/prediction-markets/pane.tsx +12 -0
- package/src/plugins/prediction-markets/plugin.test.tsx +36 -0
- package/src/plugins/prediction-markets/services/kalshi/adapter.ts +49 -9
- package/src/plugins/prediction-markets/services/polymarket/adapter.ts +31 -0
- package/src/plugins/prediction-markets/test-helpers.tsx +9 -0
- package/src/plugins/registry/index.ts +2 -0
- package/src/plugins/ticker-navigation.test.ts +24 -0
- package/src/plugins/ticker-navigation.ts +40 -0
- package/src/remote/schema.ts +1 -1
- package/src/renderers/browser/app-services.ts +61 -0
- package/src/renderers/browser/cloud-transport.test.ts +68 -0
- package/src/renderers/browser/cloud-transport.ts +48 -0
- package/src/renderers/browser/config-host.ts +58 -0
- package/src/renderers/browser/deeplink-bridge.test.ts +41 -0
- package/src/renderers/browser/deeplink-bridge.ts +22 -0
- package/src/renderers/browser/error-boundary.tsx +23 -0
- package/src/renderers/browser/main.tsx +64 -0
- package/src/renderers/browser/persistence.ts +74 -0
- package/src/renderers/browser/storage.test.ts +66 -0
- package/src/renderers/browser/storage.ts +50 -0
- package/src/renderers/browser/ticker-repository.ts +59 -0
- package/src/renderers/browser/ui-host.tsx +40 -0
- package/src/renderers/cloudflare/worker.test.ts +136 -0
- package/src/renderers/cloudflare/worker.ts +116 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +3 -2
- package/src/renderers/electrobun/bun/desktop/initialization.ts +1 -0
- package/src/renderers/electrobun/bun/desktop/plugin-state.ts +7 -1
- package/src/renderers/electrobun/view/app-services.ts +14 -3
- package/src/renderers/electrobun/view/build-assets.ts +12 -10
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +1 -1
- package/src/renderers/electrobun/view/data-table/index.tsx +10 -1
- package/src/renderers/electrobun/view/desktop/controls.tsx +2 -0
- package/src/renderers/electrobun/view/dom-ui-host.tsx +143 -0
- package/src/renderers/electrobun/view/host/box.test.tsx +33 -0
- package/src/renderers/electrobun/view/host/box.tsx +11 -6
- package/src/renderers/electrobun/view/host/chart-surface.tsx +7 -1
- package/src/renderers/electrobun/view/host/input.tsx +11 -7
- package/src/renderers/electrobun/view/host/native.ts +0 -5
- package/src/renderers/electrobun/view/main.tsx +2 -0
- package/src/renderers/electrobun/view/remote/persistence.ts +5 -0
- package/src/renderers/electrobun/view/styles.css +107 -7
- package/src/renderers/electrobun/view/toast-host.test.tsx +78 -0
- package/src/renderers/electrobun/view/toast-host.tsx +69 -43
- package/src/renderers/electrobun/view/ui-host.tsx +6 -137
- package/src/renderers/opentui/start.tsx +2 -0
- package/src/renderers/share/layout-view.test.tsx +58 -0
- package/src/renderers/share/layout-view.tsx +133 -0
- package/src/renderers/share/main.tsx +102 -0
- package/src/renderers/share/styles.css +54 -0
- package/src/renderers/share/view.test.tsx +100 -0
- package/src/renderers/share/view.tsx +150 -0
- package/src/shares/api.test.ts +105 -0
- package/src/shares/api.ts +127 -0
- package/src/shares/chart-snapshot.test.ts +34 -0
- package/src/shares/chart-snapshot.ts +28 -0
- package/src/shares/location.test.ts +19 -0
- package/src/shares/location.ts +11 -0
- package/src/shares/pane.test.ts +110 -0
- package/src/shares/pane.ts +54 -0
- package/src/shares/payload.ts +177 -0
- package/src/sources/gloomberb-cloud/index.test.ts +61 -1
- package/src/sources/gloomberb-cloud/index.ts +86 -14
- package/src/sources/gloomberb-cloud/normalizers.test.ts +34 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +5 -5
- package/src/sources/provider-router/history.test.ts +2 -2
- package/src/sources/provider-router/news.test.ts +34 -0
- package/src/sources/provider-router/news.ts +15 -1
- package/src/sources/sec-edgar.test.ts +59 -0
- package/src/sources/sec-edgar.ts +63 -23
- package/src/sources/yahoo-finance/mappers.ts +3 -0
- package/src/sources/yahoo-finance/snapshots.ts +10 -2
- package/src/sources/yahoo-finance/symbols.test.ts +10 -0
- package/src/sources/yahoo-finance/symbols.ts +13 -8
- package/src/sources/yahoo-finance.test.ts +1 -1
- package/src/sources/yahoo-finance.ts +6 -2
- package/src/state/app/bootstrap.ts +6 -7
- package/src/state/app/context/index.test.ts +41 -1
- package/src/state/app/context/index.test.tsx +34 -16
- package/src/state/selectors-ui.ts +0 -8
- package/src/sync/baseline.ts +32 -0
- package/src/sync/controller.test.ts +124 -1
- package/src/sync/controller.ts +54 -12
- package/src/sync/core-contributors.test.ts +44 -0
- package/src/sync/core-contributors.ts +59 -10
- package/src/sync/react.ts +22 -2
- package/src/sync/types.ts +12 -0
- package/src/theme/font-scale.ts +0 -11
- package/src/tickers/search/index.test.ts +27 -0
- package/src/tickers/search/upsert.ts +10 -0
- package/src/types/capability-route-source.ts +2 -1
- package/src/types/config.ts +35 -5
- package/src/types/desktop-menu.ts +1 -0
- package/src/types/plugin.ts +36 -0
- package/src/ui/context-menu.tsx +1 -1
- package/src/ui/host.tsx +4 -0
- package/src/ui/toast.tsx +2 -0
- package/src/utils/back-navigation.ts +0 -4
- package/src/utils/price-history.ts +11 -10
- package/src/utils/sec.test.ts +6 -0
- package/src/utils/sec.ts +1 -1
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
import { createElement, useId, useMemo, type SVGProps } from "react";
|
|
2
|
+
import { Box } from "../ui";
|
|
3
|
+
import { blendHex, type ThemeColors } from "../theme/colors";
|
|
4
|
+
import { useThemeColors } from "../theme/theme-context";
|
|
5
|
+
import type { LayoutConfig } from "../types/config";
|
|
6
|
+
import type { PaneDef } from "../types/plugin";
|
|
7
|
+
import { buildLayoutPreviewRects, type LayoutPreviewKind } from "./geometry";
|
|
8
|
+
import { summarizeLayoutPanes, type GalleryPaneSummary } from "./model";
|
|
9
|
+
import type { PaneImagery } from "./pane-imagery";
|
|
10
|
+
|
|
11
|
+
/** Reference screen a published layout's floating coordinates were captured on. */
|
|
12
|
+
const REFERENCE_SCREEN = { width: 200, height: 55 };
|
|
13
|
+
const HEADER_HEIGHT = 13;
|
|
14
|
+
const MIN_RECT = 26;
|
|
15
|
+
|
|
16
|
+
function SvgText(props: SVGProps<SVGTextElement>) {
|
|
17
|
+
return createElement("text", props);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** Stable per-instance jitter so a card looks the same on every render. */
|
|
21
|
+
function hashUnit(seed: string, salt: number): number {
|
|
22
|
+
let hash = 2166136261 ^ salt;
|
|
23
|
+
for (let index = 0; index < seed.length; index += 1) {
|
|
24
|
+
hash = Math.imul(hash ^ seed.charCodeAt(index), 16777619);
|
|
25
|
+
}
|
|
26
|
+
return ((hash >>> 0) % 1000) / 1000;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function fitLabel(text: string, width: number, charWidth: number): string {
|
|
30
|
+
const maxChars = Math.max(1, Math.floor(width / charWidth));
|
|
31
|
+
return text.length <= maxChars ? text : `${text.slice(0, Math.max(1, maxChars - 1))}…`;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function chartPath(seed: string, x: number, y: number, width: number, height: number): string {
|
|
35
|
+
const points = 12;
|
|
36
|
+
return Array.from({ length: points }, (_, index) => {
|
|
37
|
+
const progress = index / (points - 1);
|
|
38
|
+
const wave = Math.sin(progress * Math.PI * 1.6 + hashUnit(seed, index) * 2) * 0.28;
|
|
39
|
+
const drift = (hashUnit(seed, index + 40) - 0.5) * 0.22;
|
|
40
|
+
const value = 0.5 + wave + drift;
|
|
41
|
+
const pointX = x + progress * width;
|
|
42
|
+
const pointY = y + height - Math.min(0.94, Math.max(0.06, value)) * height;
|
|
43
|
+
return `${index === 0 ? "M" : "L"}${pointX.toFixed(1)} ${pointY.toFixed(1)}`;
|
|
44
|
+
}).join(" ");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function PaneBodyImagery({
|
|
48
|
+
imagery,
|
|
49
|
+
seed,
|
|
50
|
+
x,
|
|
51
|
+
y,
|
|
52
|
+
width,
|
|
53
|
+
height,
|
|
54
|
+
colors,
|
|
55
|
+
}: {
|
|
56
|
+
imagery: PaneImagery;
|
|
57
|
+
seed: string;
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
colors: ThemeColors;
|
|
63
|
+
}) {
|
|
64
|
+
const line = blendHex(colors.panel, colors.text, 0.34);
|
|
65
|
+
const faint = blendHex(colors.panel, colors.text, 0.18);
|
|
66
|
+
const accent = colors.borderFocused;
|
|
67
|
+
|
|
68
|
+
switch (imagery) {
|
|
69
|
+
case "chart":
|
|
70
|
+
return (
|
|
71
|
+
<>
|
|
72
|
+
<path
|
|
73
|
+
d={chartPath(seed, x, y, width, height)}
|
|
74
|
+
fill="none"
|
|
75
|
+
stroke={accent}
|
|
76
|
+
strokeWidth={1.4}
|
|
77
|
+
strokeLinejoin="round"
|
|
78
|
+
/>
|
|
79
|
+
<line x1={x} y1={y + height} x2={x + width} y2={y + height} stroke={faint} strokeWidth={1} />
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
case "table": {
|
|
83
|
+
const rows = Math.max(2, Math.min(6, Math.floor(height / 7)));
|
|
84
|
+
const rowHeight = height / rows;
|
|
85
|
+
return (
|
|
86
|
+
<>
|
|
87
|
+
{Array.from({ length: rows }, (_, row) => {
|
|
88
|
+
const rowY = y + row * rowHeight + rowHeight / 2;
|
|
89
|
+
const first = row === 0;
|
|
90
|
+
return (
|
|
91
|
+
<g key={row}>
|
|
92
|
+
<line
|
|
93
|
+
x1={x}
|
|
94
|
+
y1={rowY}
|
|
95
|
+
x2={x + width * 0.38}
|
|
96
|
+
y2={rowY}
|
|
97
|
+
stroke={first ? line : faint}
|
|
98
|
+
strokeWidth={first ? 1.6 : 1.2}
|
|
99
|
+
/>
|
|
100
|
+
<line
|
|
101
|
+
x1={x + width * 0.52}
|
|
102
|
+
y1={rowY}
|
|
103
|
+
x2={x + width * (0.62 + hashUnit(seed, row) * 0.3)}
|
|
104
|
+
y2={rowY}
|
|
105
|
+
stroke={row % 2 === 0 ? colors.positive : colors.negative}
|
|
106
|
+
strokeWidth={1.2}
|
|
107
|
+
/>
|
|
108
|
+
</g>
|
|
109
|
+
);
|
|
110
|
+
})}
|
|
111
|
+
</>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
case "feed": {
|
|
115
|
+
const items = Math.max(1, Math.min(4, Math.floor(height / 11)));
|
|
116
|
+
const itemHeight = height / items;
|
|
117
|
+
return (
|
|
118
|
+
<>
|
|
119
|
+
{Array.from({ length: items }, (_, item) => {
|
|
120
|
+
const top = y + item * itemHeight + 1;
|
|
121
|
+
return (
|
|
122
|
+
<g key={item}>
|
|
123
|
+
<rect x={x} y={top} width={itemHeight * 0.55} height={itemHeight * 0.55} rx={1.5} fill={faint} />
|
|
124
|
+
<line
|
|
125
|
+
x1={x + itemHeight * 0.72}
|
|
126
|
+
y1={top + itemHeight * 0.16}
|
|
127
|
+
x2={x + width * (0.7 + hashUnit(seed, item) * 0.3)}
|
|
128
|
+
y2={top + itemHeight * 0.16}
|
|
129
|
+
stroke={line}
|
|
130
|
+
strokeWidth={1.4}
|
|
131
|
+
/>
|
|
132
|
+
<line
|
|
133
|
+
x1={x + itemHeight * 0.72}
|
|
134
|
+
y1={top + itemHeight * 0.44}
|
|
135
|
+
x2={x + width * (0.5 + hashUnit(seed, item + 7) * 0.3)}
|
|
136
|
+
y2={top + itemHeight * 0.44}
|
|
137
|
+
stroke={faint}
|
|
138
|
+
strokeWidth={1.2}
|
|
139
|
+
/>
|
|
140
|
+
</g>
|
|
141
|
+
);
|
|
142
|
+
})}
|
|
143
|
+
</>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
case "calendar": {
|
|
147
|
+
const columns = 5;
|
|
148
|
+
const rows = Math.max(1, Math.min(3, Math.floor(height / 9)));
|
|
149
|
+
const cellWidth = width / columns;
|
|
150
|
+
const cellHeight = height / rows;
|
|
151
|
+
return (
|
|
152
|
+
<>
|
|
153
|
+
{Array.from({ length: rows * columns }, (_, cell) => {
|
|
154
|
+
const column = cell % columns;
|
|
155
|
+
const row = Math.floor(cell / columns);
|
|
156
|
+
const marked = hashUnit(seed, cell) > 0.62;
|
|
157
|
+
return (
|
|
158
|
+
<rect
|
|
159
|
+
key={cell}
|
|
160
|
+
x={x + column * cellWidth + 1}
|
|
161
|
+
y={y + row * cellHeight + 1}
|
|
162
|
+
width={Math.max(2, cellWidth - 2.5)}
|
|
163
|
+
height={Math.max(2, cellHeight - 2.5)}
|
|
164
|
+
rx={1.5}
|
|
165
|
+
fill={marked ? blendHex(colors.panel, accent, 0.5) : faint}
|
|
166
|
+
/>
|
|
167
|
+
);
|
|
168
|
+
})}
|
|
169
|
+
</>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
case "chat": {
|
|
173
|
+
const bubbles = Math.max(1, Math.min(3, Math.floor(height / 12)));
|
|
174
|
+
const bubbleHeight = height / bubbles;
|
|
175
|
+
return (
|
|
176
|
+
<>
|
|
177
|
+
{Array.from({ length: bubbles }, (_, bubble) => {
|
|
178
|
+
const mine = bubble % 2 === 1;
|
|
179
|
+
const bubbleWidth = width * (0.42 + hashUnit(seed, bubble) * 0.26);
|
|
180
|
+
return (
|
|
181
|
+
<rect
|
|
182
|
+
key={bubble}
|
|
183
|
+
x={mine ? x + width - bubbleWidth : x}
|
|
184
|
+
y={y + bubble * bubbleHeight + 1}
|
|
185
|
+
width={bubbleWidth}
|
|
186
|
+
height={Math.max(3, bubbleHeight - 4)}
|
|
187
|
+
rx={2.5}
|
|
188
|
+
fill={mine ? blendHex(colors.panel, accent, 0.42) : faint}
|
|
189
|
+
/>
|
|
190
|
+
);
|
|
191
|
+
})}
|
|
192
|
+
</>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
case "gauge": {
|
|
196
|
+
const radius = Math.min(width, height * 1.6) / 2.4;
|
|
197
|
+
const centerX = x + width / 2;
|
|
198
|
+
const centerY = y + height * 0.86;
|
|
199
|
+
const angle = Math.PI * (0.22 + hashUnit(seed, 3) * 0.56);
|
|
200
|
+
return (
|
|
201
|
+
<>
|
|
202
|
+
<path
|
|
203
|
+
d={`M ${centerX - radius} ${centerY} A ${radius} ${radius} 0 0 1 ${centerX + radius} ${centerY}`}
|
|
204
|
+
fill="none"
|
|
205
|
+
stroke={faint}
|
|
206
|
+
strokeWidth={3}
|
|
207
|
+
strokeLinecap="round"
|
|
208
|
+
/>
|
|
209
|
+
<line
|
|
210
|
+
x1={centerX}
|
|
211
|
+
y1={centerY}
|
|
212
|
+
x2={centerX - Math.cos(angle) * radius * 0.82}
|
|
213
|
+
y2={centerY - Math.sin(angle) * radius * 0.82}
|
|
214
|
+
stroke={accent}
|
|
215
|
+
strokeWidth={1.6}
|
|
216
|
+
strokeLinecap="round"
|
|
217
|
+
/>
|
|
218
|
+
</>
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
case "heatmap": {
|
|
222
|
+
const columns = Math.max(2, Math.min(5, Math.round(width / 16)));
|
|
223
|
+
const rows = Math.max(2, Math.min(4, Math.round(height / 12)));
|
|
224
|
+
const cellWidth = width / columns;
|
|
225
|
+
const cellHeight = height / rows;
|
|
226
|
+
return (
|
|
227
|
+
<>
|
|
228
|
+
{Array.from({ length: rows * columns }, (_, cell) => {
|
|
229
|
+
const value = hashUnit(seed, cell + 11);
|
|
230
|
+
return (
|
|
231
|
+
<rect
|
|
232
|
+
key={cell}
|
|
233
|
+
x={x + (cell % columns) * cellWidth + 0.75}
|
|
234
|
+
y={y + Math.floor(cell / columns) * cellHeight + 0.75}
|
|
235
|
+
width={Math.max(2, cellWidth - 1.5)}
|
|
236
|
+
height={Math.max(2, cellHeight - 1.5)}
|
|
237
|
+
fill={blendHex(colors.panel, value > 0.5 ? colors.positive : colors.negative, 0.2 + value * 0.4)}
|
|
238
|
+
/>
|
|
239
|
+
);
|
|
240
|
+
})}
|
|
241
|
+
</>
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
case "media": {
|
|
245
|
+
const size = Math.min(width, height) * 0.42;
|
|
246
|
+
const centerX = x + width / 2;
|
|
247
|
+
const centerY = y + height / 2;
|
|
248
|
+
return (
|
|
249
|
+
<>
|
|
250
|
+
<rect x={x} y={y} width={width} height={height} rx={2} fill={faint} />
|
|
251
|
+
<path
|
|
252
|
+
d={`M ${centerX - size * 0.3} ${centerY - size} L ${centerX + size * 0.75} ${centerY} L ${centerX - size * 0.3} ${centerY + size} Z`}
|
|
253
|
+
fill={blendHex(colors.panel, colors.textBright, 0.55)}
|
|
254
|
+
/>
|
|
255
|
+
</>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
default: {
|
|
259
|
+
const rows = Math.max(2, Math.min(5, Math.floor(height / 8)));
|
|
260
|
+
const rowHeight = height / rows;
|
|
261
|
+
return (
|
|
262
|
+
<>
|
|
263
|
+
{Array.from({ length: rows }, (_, row) => (
|
|
264
|
+
<line
|
|
265
|
+
key={row}
|
|
266
|
+
x1={x}
|
|
267
|
+
y1={y + row * rowHeight + rowHeight / 2}
|
|
268
|
+
x2={x + width * (0.45 + hashUnit(seed, row + 23) * 0.55)}
|
|
269
|
+
y2={y + row * rowHeight + rowHeight / 2}
|
|
270
|
+
stroke={row === 0 ? line : faint}
|
|
271
|
+
strokeWidth={1.2}
|
|
272
|
+
/>
|
|
273
|
+
))}
|
|
274
|
+
</>
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function paneChrome(kind: LayoutPreviewKind, missing: boolean, colors: ThemeColors) {
|
|
281
|
+
if (missing) {
|
|
282
|
+
return {
|
|
283
|
+
border: blendHex(colors.border, colors.textMuted, 0.4),
|
|
284
|
+
header: blendHex(colors.panel, colors.bg, 0.4),
|
|
285
|
+
surface: blendHex(colors.panel, colors.bg, 0.55),
|
|
286
|
+
title: colors.textMuted,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
if (kind === "detached") {
|
|
290
|
+
return {
|
|
291
|
+
border: colors.warning,
|
|
292
|
+
header: blendHex(colors.panel, colors.warning, 0.24),
|
|
293
|
+
surface: colors.panel,
|
|
294
|
+
title: colors.textBright,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
if (kind === "floating") {
|
|
298
|
+
return {
|
|
299
|
+
border: colors.borderFocused,
|
|
300
|
+
header: blendHex(colors.panel, colors.borderFocused, 0.3),
|
|
301
|
+
surface: colors.panel,
|
|
302
|
+
title: colors.textBright,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
border: colors.border,
|
|
307
|
+
header: blendHex(colors.panel, colors.border, 0.55),
|
|
308
|
+
surface: colors.panel,
|
|
309
|
+
title: colors.text,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* A published layout drawn as a small workspace: every pane keeps its registered
|
|
315
|
+
* name and a body sketch chosen from its pane id. Nothing here reads live pane
|
|
316
|
+
* state, settings, or account data.
|
|
317
|
+
*/
|
|
318
|
+
export function MiniWorkspace({
|
|
319
|
+
layout,
|
|
320
|
+
panes,
|
|
321
|
+
width,
|
|
322
|
+
height,
|
|
323
|
+
detail = false,
|
|
324
|
+
}: {
|
|
325
|
+
layout: LayoutConfig;
|
|
326
|
+
panes: ReadonlyMap<string, PaneDef>;
|
|
327
|
+
width: number;
|
|
328
|
+
height: number;
|
|
329
|
+
detail?: boolean;
|
|
330
|
+
}) {
|
|
331
|
+
const colors = useThemeColors();
|
|
332
|
+
const missingPatternId = `gloom-missing-pane-${useId().replaceAll(":", "")}`;
|
|
333
|
+
const summaries = useMemo(() => summarizeLayoutPanes(layout, panes), [layout, panes]);
|
|
334
|
+
const rects = useMemo(() => buildLayoutPreviewRects(
|
|
335
|
+
layout,
|
|
336
|
+
{ width, height },
|
|
337
|
+
REFERENCE_SCREEN,
|
|
338
|
+
{ minSize: MIN_RECT, fractional: true },
|
|
339
|
+
), [height, layout, width]);
|
|
340
|
+
const summaryById = useMemo(() => {
|
|
341
|
+
const map = new Map<string, GalleryPaneSummary>();
|
|
342
|
+
for (const summary of summaries) map.set(summary.instanceId, summary);
|
|
343
|
+
return map;
|
|
344
|
+
}, [summaries]);
|
|
345
|
+
const fontSize = detail ? 9 : 7.5;
|
|
346
|
+
const charWidth = fontSize * 0.62;
|
|
347
|
+
|
|
348
|
+
return (
|
|
349
|
+
<Box width="100%" flexGrow={1} style={{ minHeight: 0 }}>
|
|
350
|
+
<svg
|
|
351
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
352
|
+
width="100%"
|
|
353
|
+
height="100%"
|
|
354
|
+
preserveAspectRatio="xMidYMid meet"
|
|
355
|
+
role="img"
|
|
356
|
+
aria-label={summaries.map((pane) => (
|
|
357
|
+
pane.symbol ? `${pane.name} ${pane.symbol}` : pane.name
|
|
358
|
+
)).join(", ")}
|
|
359
|
+
style={{ display: "block" }}
|
|
360
|
+
>
|
|
361
|
+
<defs>
|
|
362
|
+
<pattern id={missingPatternId} width="6" height="6" patternUnits="userSpaceOnUse" patternTransform="rotate(45)">
|
|
363
|
+
<line x1="0" y1="0" x2="0" y2="6" stroke={colors.textMuted} strokeWidth="1" opacity="0.35" />
|
|
364
|
+
</pattern>
|
|
365
|
+
</defs>
|
|
366
|
+
<rect x={0} y={0} width={width} height={height} rx={3} fill={colors.bg} />
|
|
367
|
+
{[...rects].sort((a, b) => a.depth - b.depth).map((entry) => {
|
|
368
|
+
const summary = summaryById.get(entry.instanceId);
|
|
369
|
+
const chrome = paneChrome(entry.kind, summary?.missing ?? true, colors);
|
|
370
|
+
const { x, y, width: rectWidth, height: rectHeight } = entry.rect;
|
|
371
|
+
const headerHeight = Math.min(HEADER_HEIGHT, Math.max(8, rectHeight * 0.3));
|
|
372
|
+
const bodyY = y + headerHeight + 3;
|
|
373
|
+
const bodyHeight = y + rectHeight - bodyY - 3;
|
|
374
|
+
const label = summary
|
|
375
|
+
? `${summary.icon} ${summary.name}${summary.symbol ? ` ${summary.symbol}` : ""}`
|
|
376
|
+
: entry.instanceId;
|
|
377
|
+
return (
|
|
378
|
+
<g key={entry.key}>
|
|
379
|
+
<rect
|
|
380
|
+
x={x}
|
|
381
|
+
y={y}
|
|
382
|
+
width={rectWidth}
|
|
383
|
+
height={rectHeight}
|
|
384
|
+
rx={2.5}
|
|
385
|
+
fill={chrome.surface}
|
|
386
|
+
stroke={chrome.border}
|
|
387
|
+
strokeWidth={entry.kind === "docked" ? 1 : 1.4}
|
|
388
|
+
/>
|
|
389
|
+
<path
|
|
390
|
+
d={`M ${x} ${y + headerHeight} L ${x} ${y + 2.5} Q ${x} ${y} ${x + 2.5} ${y} L ${x + rectWidth - 2.5} ${y} Q ${x + rectWidth} ${y} ${x + rectWidth} ${y + 2.5} L ${x + rectWidth} ${y + headerHeight} Z`}
|
|
391
|
+
fill={chrome.header}
|
|
392
|
+
/>
|
|
393
|
+
<SvgText
|
|
394
|
+
x={x + 4}
|
|
395
|
+
y={y + headerHeight - (headerHeight - fontSize) / 2 - 1}
|
|
396
|
+
fill={chrome.title}
|
|
397
|
+
fontSize={fontSize}
|
|
398
|
+
fontFamily="inherit"
|
|
399
|
+
>
|
|
400
|
+
{fitLabel(label, rectWidth - 8, charWidth)}
|
|
401
|
+
</SvgText>
|
|
402
|
+
{summary?.missing && (
|
|
403
|
+
<rect
|
|
404
|
+
x={x + 1}
|
|
405
|
+
y={y + headerHeight}
|
|
406
|
+
width={rectWidth - 2}
|
|
407
|
+
height={Math.max(0, rectHeight - headerHeight - 1)}
|
|
408
|
+
fill={`url(#${missingPatternId})`}
|
|
409
|
+
/>
|
|
410
|
+
)}
|
|
411
|
+
{bodyHeight >= 10 && !summary?.missing && (
|
|
412
|
+
<PaneBodyImagery
|
|
413
|
+
imagery={summary?.imagery ?? "generic"}
|
|
414
|
+
seed={entry.instanceId}
|
|
415
|
+
x={x + 4}
|
|
416
|
+
y={bodyY}
|
|
417
|
+
width={Math.max(4, rectWidth - 8)}
|
|
418
|
+
height={bodyHeight}
|
|
419
|
+
colors={colors}
|
|
420
|
+
/>
|
|
421
|
+
)}
|
|
422
|
+
</g>
|
|
423
|
+
);
|
|
424
|
+
})}
|
|
425
|
+
</svg>
|
|
426
|
+
</Box>
|
|
427
|
+
);
|
|
428
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { cloneLayout, createDefaultConfig } from "../types/config";
|
|
3
|
+
import type { PaneDef } from "../types/plugin";
|
|
4
|
+
import {
|
|
5
|
+
buildOwnedEntries,
|
|
6
|
+
describeArrangement,
|
|
7
|
+
filterGalleryEntries,
|
|
8
|
+
missingPaneIds,
|
|
9
|
+
summarizeLayoutPanes,
|
|
10
|
+
} from "./model";
|
|
11
|
+
import { paneImagery } from "./pane-imagery";
|
|
12
|
+
|
|
13
|
+
function paneDef(id: string, name: string, icon: string): PaneDef {
|
|
14
|
+
return {
|
|
15
|
+
id,
|
|
16
|
+
name,
|
|
17
|
+
icon,
|
|
18
|
+
component: () => null,
|
|
19
|
+
defaultPosition: "left",
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const panes = new Map<string, PaneDef>([
|
|
24
|
+
["ticker-research", paneDef("ticker-research", "Ticker Research", "T")],
|
|
25
|
+
["portfolio-list", paneDef("portfolio-list", "Portfolio", "P")],
|
|
26
|
+
["chat", paneDef("chat", "Chat", "M")],
|
|
27
|
+
["ticker-chart", paneDef("ticker-chart", "Chart", "C")],
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
function testLayout() {
|
|
31
|
+
const layout = cloneLayout(createDefaultConfig("/tmp/gloomberb-gallery-model-test").layout);
|
|
32
|
+
layout.instances = [
|
|
33
|
+
...layout.instances,
|
|
34
|
+
{ instanceId: "ticker-chart:1", paneId: "ticker-chart", binding: { kind: "fixed", symbol: "NVDA" } },
|
|
35
|
+
{ instanceId: "mystery:1", paneId: "mystery-pane" },
|
|
36
|
+
];
|
|
37
|
+
layout.floating = [{ instanceId: "ticker-chart:1", x: 10, y: 4, width: 30, height: 12 }];
|
|
38
|
+
layout.detached = [{ instanceId: "mystery:1", x: 60, y: 2, width: 24, height: 10 }];
|
|
39
|
+
return layout;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
describe("gallery layout summaries", () => {
|
|
43
|
+
test("labels every pane, including uninstalled types, and keeps only public bindings", () => {
|
|
44
|
+
const summaries = summarizeLayoutPanes(testLayout(), panes);
|
|
45
|
+
|
|
46
|
+
const chart = summaries.find((pane) => pane.instanceId === "ticker-chart:1")!;
|
|
47
|
+
expect(chart).toMatchObject({
|
|
48
|
+
name: "Chart",
|
|
49
|
+
icon: "C",
|
|
50
|
+
symbol: "NVDA",
|
|
51
|
+
placement: "floating",
|
|
52
|
+
missing: false,
|
|
53
|
+
imagery: "chart",
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const missing = summaries.find((pane) => pane.instanceId === "mystery:1")!;
|
|
57
|
+
// An unavailable pane still gets a readable label instead of a blank box.
|
|
58
|
+
expect(missing).toMatchObject({ name: "mystery-pane", missing: true, placement: "detached" });
|
|
59
|
+
expect(missing.icon.length).toBeGreaterThan(0);
|
|
60
|
+
expect(summaries.every((pane) => pane.name.length > 0)).toBe(true);
|
|
61
|
+
expect(missingPaneIds(testLayout(), panes)).toEqual(["mystery-pane"]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test("counts placements without double counting floating or detached panes", () => {
|
|
65
|
+
expect(describeArrangement(testLayout())).toBe("3 docked · 1 floating · 1 detached");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test("ignores saved instances that are no longer placed in the layout", () => {
|
|
69
|
+
const layout = testLayout();
|
|
70
|
+
layout.instances = [...layout.instances, { instanceId: "orphan:1", paneId: "ticker-chart" }];
|
|
71
|
+
|
|
72
|
+
expect(describeArrangement(layout)).toBe("3 docked · 1 floating · 1 detached");
|
|
73
|
+
expect(summarizeLayoutPanes(layout, panes).some((pane) => pane.instanceId === "orphan:1")).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test("does not preview the layout browser inside its own active layout", () => {
|
|
77
|
+
const layout = testLayout();
|
|
78
|
+
layout.instances.push({ instanceId: "layout-marketplace:1", paneId: "layout-marketplace" });
|
|
79
|
+
layout.floating.push({
|
|
80
|
+
instanceId: "layout-marketplace:1",
|
|
81
|
+
x: 20,
|
|
82
|
+
y: 5,
|
|
83
|
+
width: 100,
|
|
84
|
+
height: 30,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const entry = buildOwnedEntries([{ name: "Desk", layout }], 0)[0]!;
|
|
88
|
+
expect(entry.layout.instances.some((instance) => instance.paneId === "layout-marketplace")).toBe(false);
|
|
89
|
+
expect(describeArrangement(entry.layout)).toBe("3 docked · 1 floating · 1 detached");
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("search matches layout names and the pane types inside them", () => {
|
|
94
|
+
const layout = testLayout();
|
|
95
|
+
const entries = buildOwnedEntries(
|
|
96
|
+
[{ name: "Macro Desk", layout }, { name: "Options Flow", layout: cloneLayout(layout) }],
|
|
97
|
+
0,
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
expect(filterGalleryEntries(entries, "macro", panes).map((entry) => entry.name)).toEqual(["Macro Desk"]);
|
|
101
|
+
// Registered pane names are searchable even though they are not in the title.
|
|
102
|
+
expect(filterGalleryEntries(entries, "portfolio", panes).length).toBe(2);
|
|
103
|
+
expect(filterGalleryEntries(entries, "", panes).length).toBe(2);
|
|
104
|
+
expect(filterGalleryEntries(entries, "zzzz", panes).length).toBe(0);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("pane imagery is deterministic and specific before generic", () => {
|
|
108
|
+
expect(paneImagery("ticker-chart")).toBe("chart");
|
|
109
|
+
expect(paneImagery("news-top")).toBe("feed");
|
|
110
|
+
expect(paneImagery("earnings-calendar")).toBe("calendar");
|
|
111
|
+
expect(paneImagery("market-heatmap")).toBe("heatmap");
|
|
112
|
+
expect(paneImagery("fear-greed")).toBe("gauge");
|
|
113
|
+
expect(paneImagery("macro-tv")).toBe("media");
|
|
114
|
+
expect(paneImagery("portfolio-list")).toBe("table");
|
|
115
|
+
expect(paneImagery("chat")).toBe("chat");
|
|
116
|
+
expect(paneImagery("some-unknown-plugin-pane")).toBe("generic");
|
|
117
|
+
expect(paneImagery("ticker-chart")).toBe(paneImagery("ticker-chart"));
|
|
118
|
+
});
|