gloomberb 0.7.4 → 0.8.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/README.md +27 -6
- package/package.json +2 -3
- package/src/api-client/auth.ts +167 -0
- package/src/api-client/chat.ts +116 -0
- package/src/api-client/data.ts +177 -0
- package/src/api-client/errors.ts +28 -0
- package/src/api-client/index.test.ts +675 -0
- package/src/api-client/index.ts +384 -0
- package/src/api-client/normalizers.ts +61 -0
- package/src/api-client/paths.ts +173 -0
- package/src/api-client/request.ts +124 -0
- package/src/api-client/socket.ts +483 -0
- package/src/api-client/types.ts +490 -0
- package/src/app/app-bootstrap-state.test.ts +157 -0
- package/src/app/app-bootstrap-state.ts +134 -0
- package/src/app/global-shortcuts.test.tsx +166 -0
- package/src/app/global-shortcuts.ts +126 -0
- package/src/app/pane-runtime/index.tsx +297 -0
- package/src/app/pane-runtime/layout-placement.ts +73 -0
- package/src/app/pane-runtime/pane-settings-runtime.tsx +67 -0
- package/src/app/pane-runtime/pane-template-runtime.ts +110 -0
- package/src/app/pane-runtime/plugin-bindings.ts +231 -0
- package/src/app/pane-runtime/ticker-inspector-runtime.ts +167 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +144 -0
- package/src/app/pane-template-dialog-wizard.tsx +52 -0
- package/src/app/runtime/broker-import.ts +109 -0
- package/src/app/runtime/desktop-menu.ts +74 -0
- package/src/app/runtime/plugin-bindings.ts +246 -0
- package/src/app/runtime/startup.ts +126 -0
- package/src/app/runtime/ticker-refresh.ts +249 -0
- package/src/app/runtime/update.ts +86 -0
- package/src/app.tsx +110 -1461
- package/src/brokers/broker-portfolio-sync.ts +186 -0
- package/src/brokers/broker-ticker-sync.ts +141 -0
- package/src/brokers/profile-form.ts +2 -2
- package/src/brokers/remote-broker-adapter.ts +3 -2
- package/src/brokers/sync-broker-instance.test.ts +140 -0
- package/src/brokers/sync-broker-instance.ts +60 -181
- package/src/capabilities/types.ts +4 -4
- package/src/cli/commands/search.ts +1 -1
- package/src/cli/commands/ticker.ts +3 -3
- package/src/cli/context.ts +1 -1
- package/src/cli/desktop-pane-shot.ts +305 -0
- package/src/cli/helpers.ts +1 -1
- package/src/cli/index.ts +34 -0
- package/src/cli/pane-functions/catalog.ts +243 -0
- package/src/cli/pane-functions/data.ts +78 -0
- package/src/cli/pane-functions/discovery.ts +113 -0
- package/src/cli/pane-functions/index.test.ts +114 -0
- package/src/cli/pane-functions/index.ts +112 -0
- package/src/cli/pane-functions/options.ts +249 -0
- package/src/cli/pane-functions/report.ts +180 -0
- package/src/cli/pane-functions/resolver.ts +96 -0
- package/src/cli/pane-functions/screenshot.ts +113 -0
- package/src/cli/registry.ts +3 -2
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli.test.ts +1 -1
- package/src/components/chart/bar-chart-renderer.test.ts +53 -0
- package/src/components/chart/bar-chart-renderer.ts +190 -0
- package/src/components/chart/comparison/data.test.ts +105 -0
- package/src/components/chart/comparison/data.ts +279 -0
- package/src/components/chart/comparison/renderer.test.ts +187 -0
- package/src/components/chart/comparison/renderer.ts +283 -0
- package/src/components/chart/comparison/scene.ts +178 -0
- package/src/components/chart/comparison-stock-chart/axis-width.ts +99 -0
- package/src/components/chart/comparison-stock-chart/canvas.ts +148 -0
- package/src/components/chart/comparison-stock-chart/controls.ts +252 -0
- package/src/components/chart/comparison-stock-chart/helpers.ts +133 -0
- package/src/components/chart/comparison-stock-chart/interactions.ts +202 -0
- package/src/components/chart/comparison-stock-chart/layout-metrics.ts +62 -0
- package/src/components/chart/comparison-stock-chart/layout.tsx +155 -0
- package/src/components/chart/comparison-stock-chart/legend.tsx +73 -0
- package/src/components/chart/comparison-stock-chart/native-surfaces.ts +89 -0
- package/src/components/chart/comparison-stock-chart/render-data.ts +198 -0
- package/src/components/chart/comparison-stock-chart/render-output.ts +145 -0
- package/src/components/chart/comparison-stock-chart/selection-runtime.ts +111 -0
- package/src/components/chart/comparison-stock-chart/sources.ts +47 -0
- package/src/components/chart/comparison-stock-chart/surface-runtime.ts +159 -0
- package/src/components/chart/comparison-stock-chart/toolbar.tsx +107 -0
- package/src/components/chart/comparison-stock-chart/types.ts +22 -0
- package/src/components/chart/comparison-stock-chart/view.tsx +524 -0
- package/src/components/chart/comparison-stock-chart/viewport-runtime.ts +239 -0
- package/src/components/chart/comparison-stock-chart.tsx +12 -2028
- package/src/components/chart/core/axis-format.ts +147 -0
- package/src/components/chart/core/axis-measure.ts +33 -0
- package/src/components/chart/core/controller.test.ts +157 -0
- package/src/components/chart/core/controller.ts +349 -0
- package/src/components/chart/core/data.ts +94 -0
- package/src/components/chart/core/date-window.ts +392 -0
- package/src/components/chart/core/index.test.ts +1007 -0
- package/src/components/chart/core/indicator-selector.tsx +75 -0
- package/src/components/chart/core/keyboard.ts +15 -0
- package/src/components/chart/core/palette.ts +60 -0
- package/src/components/chart/core/pane-settings.test.ts +25 -0
- package/src/components/chart/core/pane-settings.ts +82 -0
- package/src/components/chart/core/pointer.ts +292 -0
- package/src/components/chart/core/projection.ts +333 -0
- package/src/components/chart/core/render-utils.ts +4 -0
- package/src/components/chart/core/renderer.ts +249 -0
- package/src/components/chart/core/resolution.test.ts +99 -0
- package/src/components/chart/core/resolution.ts +380 -0
- package/src/components/chart/core/scene.ts +180 -0
- package/src/components/chart/core/scroll.test.ts +70 -0
- package/src/components/chart/core/scroll.ts +104 -0
- package/src/components/chart/core/time-axis.ts +330 -0
- package/src/components/chart/core/types.ts +124 -0
- package/src/components/chart/core/viewport.test.ts +29 -0
- package/src/components/chart/core/viewport.ts +51 -0
- package/src/components/chart/core/window-viewport.test.ts +69 -0
- package/src/components/chart/core/window-viewport.ts +162 -0
- package/src/components/chart/display-cursor.ts +153 -0
- package/src/components/chart/market-session.ts +1 -1
- package/src/components/chart/multi-line/renderer.test.ts +83 -0
- package/src/components/chart/multi-line/renderer.ts +160 -0
- package/src/components/chart/multi-line/scene.ts +188 -0
- package/src/components/chart/native/canvas-bitmaps.ts +140 -0
- package/src/components/chart/native/chart-rasterizer.ts +18 -865
- package/src/components/chart/native/kitty/adapter.ts +9 -0
- package/src/components/chart/native/kitty/index.test.ts +752 -0
- package/src/components/chart/native/kitty/manager.ts +142 -0
- package/src/components/chart/native/kitty/support.ts +70 -0
- package/src/components/chart/native/raster/comparison-chart.ts +162 -0
- package/src/components/chart/native/raster/crosshair.ts +51 -0
- package/src/components/chart/native/raster/layout.ts +136 -0
- package/src/components/chart/native/raster/placement.ts +132 -0
- package/src/components/chart/native/raster/price-chart.ts +244 -0
- package/src/components/chart/native/raster/primitives.ts +154 -0
- package/src/components/chart/native/raster/types.ts +41 -0
- package/src/components/chart/native/renderer-selection.ts +81 -1
- package/src/components/chart/native/surface/hooks.ts +137 -0
- package/src/components/chart/native/surface/manager.ts +225 -0
- package/src/components/chart/native/surface/rendering.ts +211 -0
- package/src/components/chart/native/surface/sync.ts +34 -0
- package/src/components/chart/native/surface/visibility.ts +48 -0
- package/src/components/chart/price-axis-labels.tsx +4 -4
- package/src/components/chart/rendering/chart-draw.ts +270 -0
- package/src/components/chart/rendering/geometry.ts +95 -0
- package/src/components/chart/rendering/pixel-buffer.ts +267 -0
- package/src/components/chart/scatter-chart-renderer.test.ts +31 -0
- package/src/components/chart/scatter-chart-renderer.ts +223 -0
- package/src/components/chart/static/bar-chart-surface.tsx +85 -0
- package/src/components/chart/static/chart/bitmap.ts +50 -0
- package/src/components/chart/static/chart/surface.test.tsx +51 -0
- package/src/components/chart/static/chart/surface.tsx +181 -0
- package/src/components/chart/static/multi-line-chart-surface.tsx +180 -0
- package/src/components/chart/static/scatter-chart-surface.tsx +83 -0
- package/src/components/chart/stock-chart/auto.ts +216 -0
- package/src/components/chart/stock-chart/axis-width.ts +146 -0
- package/src/components/chart/stock-chart/bitmaps.ts +22 -0
- package/src/components/chart/stock-chart/canvas.ts +202 -0
- package/src/components/chart/stock-chart/controls.tsx +149 -0
- package/src/components/chart/stock-chart/cursor.ts +60 -0
- package/src/components/chart/stock-chart/data-runtime.ts +129 -0
- package/src/components/chart/stock-chart/footer.ts +248 -0
- package/src/components/chart/stock-chart/geometry.ts +160 -0
- package/src/components/chart/stock-chart/index.test.ts +500 -0
- package/src/components/chart/stock-chart/index.tsx +29 -0
- package/src/components/chart/stock-chart/indicators.ts +226 -0
- package/src/components/chart/stock-chart/interaction-runtime.ts +44 -0
- package/src/components/chart/stock-chart/interactions.ts +300 -0
- package/src/components/chart/stock-chart/keyboard.ts +373 -0
- package/src/components/chart/stock-chart/layout-metrics.ts +62 -0
- package/src/components/chart/stock-chart/layout.tsx +177 -0
- package/src/components/chart/stock-chart/native-surfaces.ts +121 -0
- package/src/components/chart/stock-chart/presentation.ts +67 -0
- package/src/components/chart/stock-chart/renderer-switch.test.tsx +263 -0
- package/src/components/chart/stock-chart/rendering/bounds.ts +116 -0
- package/src/components/chart/stock-chart/rendering/candidates.ts +145 -0
- package/src/components/chart/stock-chart/rendering/data.ts +370 -0
- package/src/components/chart/stock-chart/rendering/invalidation.ts +68 -0
- package/src/components/chart/stock-chart/rendering/output.ts +304 -0
- package/src/components/chart/stock-chart/rendering/planning.ts +122 -0
- package/src/components/chart/stock-chart/rendering/projection.test.tsx +98 -0
- package/src/components/chart/stock-chart/rendering/projection.ts +112 -0
- package/src/components/chart/stock-chart/rendering/state.test.ts +70 -0
- package/src/components/chart/stock-chart/rendering/state.ts +283 -0
- package/src/components/chart/stock-chart/requests.ts +337 -0
- package/src/components/chart/stock-chart/resolution-support.ts +96 -0
- package/src/components/chart/stock-chart/resolved/runtime.ts +289 -0
- package/src/components/chart/stock-chart/resolved.tsx +345 -0
- package/src/components/chart/stock-chart/settings.ts +77 -0
- package/src/components/chart/stock-chart/surface-runtime.ts +62 -0
- package/src/components/chart/stock-chart/types.ts +25 -0
- package/src/components/chart/stock-chart/view.tsx +155 -0
- package/src/components/chart/stock-chart/viewport/effects.ts +296 -0
- package/src/components/chart/stock-chart/viewport/index.ts +144 -0
- package/src/components/chart/stock-chart/viewport/runtime.ts +375 -0
- package/src/components/chart/time-axis-label.tsx +4 -3
- package/src/components/command-bar/action-runtime.ts +326 -0
- package/src/components/command-bar/commands/collection.ts +214 -0
- package/src/components/command-bar/commands/direct/index.ts +266 -0
- package/src/components/command-bar/commands/direct/runtime.ts +168 -0
- package/src/components/command-bar/commands/plugin/actions.ts +171 -0
- package/src/components/command-bar/commands/plugin/items.ts +166 -0
- package/src/components/command-bar/commands/registry.ts +263 -0
- package/src/components/command-bar/helpers.test.ts +13 -21
- package/src/components/command-bar/helpers.ts +51 -272
- package/src/components/command-bar/keyboard-handlers.ts +306 -0
- package/src/components/command-bar/keyboard-shortcuts.ts +204 -0
- package/src/components/command-bar/layout-items/current-layout.ts +120 -0
- package/src/components/command-bar/layout-items/focused-pane.ts +143 -0
- package/src/components/command-bar/layout-items/types.ts +25 -0
- package/src/components/command-bar/layout-items/window-mode.ts +72 -0
- package/src/components/command-bar/layout-items.ts +93 -0
- package/src/components/command-bar/list/model.ts +81 -0
- package/src/components/command-bar/list/navigation.ts +125 -0
- package/src/components/command-bar/list/view.tsx +316 -0
- package/src/components/command-bar/multi-select-picker.tsx +219 -0
- package/src/components/command-bar/multi-select-runtime.ts +91 -0
- package/src/components/command-bar/pane-actions.ts +124 -0
- package/src/components/command-bar/pane-settings.ts +227 -0
- package/src/components/command-bar/pane-templates/items.ts +203 -0
- package/src/components/command-bar/pane-templates/workflow-route.ts +81 -0
- package/src/components/command-bar/pane-templates/workflow.ts +282 -0
- package/src/components/command-bar/panel/body.tsx +311 -0
- package/src/components/command-bar/panel/index.tsx +196 -0
- package/src/components/command-bar/panel/layout.ts +117 -0
- package/src/components/command-bar/panel/runtime.ts +280 -0
- package/src/components/command-bar/panel/state.ts +138 -0
- package/src/components/command-bar/panel/types.ts +78 -0
- package/src/components/command-bar/picker-activation.ts +126 -0
- package/src/components/command-bar/routes/root/command-items.ts +176 -0
- package/src/components/command-bar/routes/root/provider-search.ts +200 -0
- package/src/components/command-bar/routes/root/results.ts +233 -0
- package/src/components/command-bar/routes/root/runtime.ts +315 -0
- package/src/components/command-bar/routes/root/selection.ts +228 -0
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +108 -0
- package/src/components/command-bar/routes/root/shortcut-items.ts +159 -0
- package/src/components/command-bar/routes/root/shortcuts.test.ts +151 -0
- package/src/components/command-bar/routes/root/shortcuts.ts +188 -0
- package/src/components/command-bar/routes/ticker-search/actions.ts +142 -0
- package/src/components/command-bar/routes/ticker-search/results.ts +94 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +151 -0
- package/src/components/command-bar/routing/actions.ts +299 -0
- package/src/components/command-bar/routing/confirm.ts +91 -0
- package/src/components/command-bar/routing/effects.ts +82 -0
- package/src/components/command-bar/routing/launch-request.ts +59 -0
- package/src/components/command-bar/routing/list-state.ts +242 -0
- package/src/components/command-bar/routing/navigation-state.ts +147 -0
- package/src/components/command-bar/selection-runtime.ts +291 -0
- package/src/components/command-bar/surface/environment.ts +124 -0
- package/src/components/command-bar/surface/index.test.tsx +864 -0
- package/src/components/command-bar/surface/index.tsx +344 -0
- package/src/components/command-bar/surface/pane.test.tsx +703 -0
- package/src/components/command-bar/surface/portfolio.test.tsx +452 -0
- package/src/components/command-bar/surface/test-harness.tsx +403 -0
- package/src/components/command-bar/theme-preview.ts +84 -0
- package/src/components/command-bar/view-model.test.ts +3 -3
- package/src/components/command-bar/view-model.ts +7 -6
- package/src/components/command-bar/workflow/alert.ts +164 -0
- package/src/components/command-bar/workflow/body.tsx +179 -0
- package/src/components/command-bar/workflow/broker.ts +158 -0
- package/src/components/command-bar/workflow/builtin.ts +134 -0
- package/src/components/command-bar/workflow/collection-actions.ts +257 -0
- package/src/components/command-bar/workflow/coordinator.ts +193 -0
- package/src/components/command-bar/workflow/field-row.tsx +214 -0
- package/src/components/command-bar/workflow/fields.ts +230 -0
- package/src/components/command-bar/workflow/ops.test.ts +197 -0
- package/src/components/command-bar/workflow/ops.ts +268 -0
- package/src/components/command-bar/workflow/route-actions.ts +232 -0
- package/src/components/command-bar/workflow/route-builder.ts +56 -0
- package/src/components/command-bar/workflow/runtime.ts +234 -0
- package/src/components/command-bar/workflow/submit.ts +213 -0
- package/src/components/command-bar/workflow/tickers.ts +214 -0
- package/src/components/command-bar/workflow/types.ts +127 -0
- package/src/components/data-table/stack-view.test.tsx +218 -0
- package/src/components/data-table/stack-view.tsx +59 -0
- package/src/components/data-table/view.test.tsx +254 -0
- package/src/components/data-table/view.tsx +306 -0
- package/src/components/feed-data-table/stack-view.test.tsx +148 -0
- package/src/components/feed-data-table/stack-view.tsx +359 -0
- package/src/components/index.ts +14 -14
- package/src/components/input-search-bar.tsx +94 -0
- package/src/components/layout/detached-pane-shell.tsx +22 -16
- package/src/components/layout/floating-pane.tsx +19 -24
- package/src/components/layout/header.tsx +9 -21
- package/src/components/layout/pane/content.test.tsx +64 -0
- package/src/components/layout/pane/content.tsx +44 -0
- package/src/components/layout/pane/cycle-order.test.ts +30 -0
- package/src/components/layout/pane/cycle-order.ts +32 -0
- package/src/components/layout/pane/footer/index.test.tsx +131 -0
- package/src/components/layout/pane/footer/index.tsx +246 -0
- package/src/components/layout/pane/footer/model.ts +99 -0
- package/src/components/layout/pane/footer/registration.tsx +114 -0
- package/src/components/layout/pane/frame.tsx +55 -0
- package/src/components/layout/pane/header.test.tsx +39 -0
- package/src/components/layout/pane/header.tsx +252 -0
- package/src/components/layout/pane/index.tsx +105 -0
- package/src/components/layout/pane/keyboard-scroll.test.tsx +146 -0
- package/src/components/layout/pane/sizing.ts +66 -0
- package/src/components/layout/pane/title.ts +38 -0
- package/src/components/layout/shell/action-menu-overlay.tsx +72 -0
- package/src/components/layout/shell/active-drag.ts +221 -0
- package/src/components/layout/shell/chrome.ts +8 -0
- package/src/components/layout/shell/drag/index.ts +432 -0
- package/src/components/layout/shell/drag/overlays.tsx +78 -0
- package/src/components/layout/shell/drag/runtime.ts +264 -0
- package/src/components/layout/shell/index.test.tsx +788 -0
- package/src/components/layout/shell/index.tsx +451 -0
- package/src/components/layout/shell/layout-state.ts +97 -0
- package/src/components/layout/shell/menu.ts +152 -0
- package/src/components/layout/shell/native/pointer-runtime.ts +184 -0
- package/src/components/layout/shell/native/surfaces.ts +127 -0
- package/src/components/layout/shell/native/window-state.ts +208 -0
- package/src/components/layout/shell/pane/actions.ts +129 -0
- package/src/components/layout/shell/pane/layers.tsx +234 -0
- package/src/components/layout/shell/pane/management-shortcuts.ts +114 -0
- package/src/components/layout/shell/shortcuts.ts +47 -0
- package/src/components/layout/shell/terminal-pointer-runtime.ts +326 -0
- package/src/components/layout/shell/window-mode/index.ts +253 -0
- package/src/components/layout/shell/window-mode/overlays.tsx +208 -0
- package/src/components/layout/status-bar.test.tsx +1 -101
- package/src/components/layout/status-bar.tsx +1 -1
- package/src/components/layout/window-edit/mode.test.ts +55 -0
- package/src/components/layout/window-edit/mode.ts +422 -0
- package/src/components/layout/window-edit/presentation.ts +123 -0
- package/src/components/layout/window-edit/status.tsx +101 -0
- package/src/components/markdown-text.tsx +3 -3
- package/src/components/onboarding/onboarding-steps.tsx +248 -0
- package/src/components/onboarding/onboarding-wizard.tsx +97 -1035
- package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +144 -0
- package/src/components/onboarding/portfolio-step/broker-setup-panel.tsx +97 -0
- package/src/components/onboarding/portfolio-step/broker-sync-panel.tsx +42 -0
- package/src/components/onboarding/portfolio-step/choose-panel.tsx +42 -0
- package/src/components/onboarding/portfolio-step/index.tsx +70 -0
- package/src/components/onboarding/portfolio-step/manual-name-panel.tsx +62 -0
- package/src/components/onboarding/portfolio-step/types.ts +25 -0
- package/src/components/onboarding/portfolio-step/utils.ts +15 -0
- package/src/components/onboarding/wizard-broker-sync.ts +230 -0
- package/src/components/onboarding/wizard-keyboard.ts +264 -0
- package/src/components/onboarding/wizard-model.ts +21 -0
- package/src/components/pane-settings-dialog/desktop.tsx +315 -0
- package/src/components/pane-settings-dialog/field-dialogs.tsx +213 -0
- package/src/components/pane-settings-dialog/tui.tsx +73 -0
- package/src/components/pane-settings-dialog/value.ts +36 -0
- package/src/components/pane-settings-dialog.tsx +18 -622
- package/src/components/pane-template-wizard.tsx +1 -1
- package/src/components/price-selector-dialog.tsx +2 -2
- package/src/components/price-sparkline/bitmap.ts +150 -0
- package/src/components/price-sparkline/index.ts +46 -0
- package/src/components/price-sparkline/model.ts +119 -0
- package/src/components/price-sparkline/view.tsx +214 -0
- package/src/components/quote-flash.ts +103 -0
- package/src/components/speedometer-gauge/desktop.tsx +151 -0
- package/src/components/speedometer-gauge/index.tsx +44 -0
- package/src/components/speedometer-gauge/model.ts +60 -0
- package/src/components/speedometer-gauge/terminal.tsx +261 -0
- package/src/components/ticker/badge/format.ts +42 -0
- package/src/components/ticker/badge/index.tsx +100 -0
- package/src/components/ticker/badge/list.tsx +57 -0
- package/src/components/ticker/badge/text.test.tsx +223 -0
- package/src/components/ticker/badge/text.tsx +156 -0
- package/src/components/ticker/list-table-view.tsx +297 -0
- package/src/components/ticker/list-table.test.tsx +177 -0
- package/src/components/toggle-list.tsx +1 -1
- package/src/components/ui/data-table/index.tsx +26 -0
- package/src/components/ui/data-table/opentui/index.tsx +467 -0
- package/src/components/ui/data-table/opentui/model.test.ts +47 -0
- package/src/components/ui/data-table/opentui/model.ts +66 -0
- package/src/components/ui/data-table/types.ts +81 -0
- package/src/components/ui/index.ts +1 -3
- package/src/components/ui/multi-select/dialog.tsx +336 -0
- package/src/components/ui/native-select.tsx +1 -1
- package/src/components/ui/shortcut-hint.tsx +1 -1
- package/src/components/ui/tabs.tsx +11 -5
- package/src/components/ui/toggle.tsx +1 -1
- package/src/components/ui/ui.test.tsx +3 -75
- package/src/components/use-external-link-footer.ts +1 -1
- package/src/core/app-services.ts +3 -0
- package/src/core/state/app/layout-reducer.ts +196 -0
- package/src/core/state/app/layout.ts +406 -0
- package/src/core/state/app/state.ts +340 -0
- package/src/core/state/app/types.ts +116 -0
- package/src/core/state/session-persistence.ts +1 -1
- package/src/data/app-persistence.ts +1 -1
- package/src/data/config/layout.ts +227 -0
- package/src/data/config/store/index.test.ts +500 -0
- package/src/data/config/store/index.ts +64 -0
- package/src/data/config/store/node.ts +101 -0
- package/src/data/config/store/normalize.ts +403 -0
- package/src/data/plugin-state-store.ts +3 -3
- package/src/data/resource-store.ts +3 -3
- package/src/data/session-store.ts +3 -3
- package/src/data/sqlite/cache.test.ts +151 -0
- package/src/data/sqlite/database.ts +68 -0
- package/src/data/sqlite/json.ts +16 -0
- package/src/data/sqlite/retry.test.ts +63 -0
- package/src/data/ticker-repository.ts +1 -1
- package/src/data/ticker-store.ts +2 -2
- package/src/market-data/coordinator/auxiliary.ts +252 -0
- package/src/market-data/coordinator/chart.ts +141 -0
- package/src/market-data/coordinator/entries.ts +129 -0
- package/src/market-data/coordinator/events.ts +74 -0
- package/src/market-data/coordinator/financials.ts +281 -0
- package/src/market-data/coordinator/index.test.ts +840 -0
- package/src/market-data/coordinator/index.ts +388 -0
- package/src/market-data/coordinator/quotes.ts +329 -0
- package/src/market-data/coordinator/subscriptions.test.ts +209 -0
- package/src/market-data/hooks.test.tsx +42 -1
- package/src/market-data/hooks.tsx +83 -18
- package/src/market-data/market/format.test.ts +109 -0
- package/src/market-data/market/format.ts +293 -0
- package/src/market-data/market/freshness.ts +140 -0
- package/src/market-data/market/status.ts +112 -0
- package/src/market-data/quotes/contributions.ts +194 -0
- package/src/market-data/quotes/freshness.test.ts +150 -0
- package/src/market-data/quotes/freshness.ts +36 -0
- package/src/market-data/quotes/resolution.test.ts +277 -0
- package/src/market-data/quotes/resolution.ts +468 -0
- package/src/market-data/quotes/time.test.ts +34 -0
- package/src/market-data/quotes/time.ts +59 -0
- package/src/market-data/request-types.ts +10 -3
- package/src/market-data/result-types.ts +3 -3
- package/src/market-data/selectors.ts +2 -2
- package/src/news/aggregator.ts +29 -219
- package/src/news/news-model.ts +208 -0
- package/src/news/ticker-symbols.ts +1 -1
- package/src/news/types.ts +3 -3
- package/src/plugins/builtin/account-management/footer.ts +39 -0
- package/src/plugins/builtin/account-management/form-components.tsx +162 -0
- package/src/plugins/builtin/account-management/keyboard.ts +90 -0
- package/src/plugins/builtin/account-management/model.ts +97 -0
- package/src/plugins/builtin/account-management/pane.tsx +389 -0
- package/src/plugins/builtin/account-management/password-dialog.tsx +125 -0
- package/src/plugins/builtin/ai/ask-ai-detail-tab.tsx +6 -6
- package/src/plugins/builtin/ai/ask-ai.test.tsx +305 -0
- package/src/plugins/builtin/ai/index.tsx +4 -4
- package/src/plugins/builtin/ai/providers.ts +1 -1
- package/src/plugins/builtin/ai/runner.ts +1 -0
- package/src/plugins/builtin/ai/screener/action-bar.tsx +58 -0
- package/src/plugins/builtin/ai/screener/contract.test.ts +117 -0
- package/src/plugins/builtin/ai/screener/contract.ts +174 -0
- package/src/plugins/builtin/ai/screener/editor-runtime.ts +110 -0
- package/src/plugins/builtin/ai/screener/editor.tsx +125 -0
- package/src/plugins/builtin/ai/screener/footer.ts +93 -0
- package/src/plugins/builtin/ai/screener/keyboard.ts +90 -0
- package/src/plugins/builtin/ai/screener/market-runtime.ts +99 -0
- package/src/plugins/builtin/ai/screener/model.ts +107 -0
- package/src/plugins/builtin/ai/screener/pane.test.tsx +348 -0
- package/src/plugins/builtin/ai/screener/pane.tsx +412 -0
- package/src/plugins/builtin/ai/screener/results-view.tsx +169 -0
- package/src/plugins/builtin/ai/screener/results.ts +139 -0
- package/src/plugins/builtin/ai/screener/runner.ts +144 -0
- package/src/plugins/builtin/ai/screener/tabs-bar.tsx +65 -0
- package/src/plugins/builtin/ai/settings.ts +3 -3
- package/src/plugins/builtin/ai/ticker-context.ts +1 -1
- package/src/plugins/builtin/alerts/command.ts +86 -0
- package/src/plugins/builtin/alerts/constants.ts +3 -0
- package/src/plugins/builtin/alerts/format.ts +68 -0
- package/src/plugins/builtin/alerts/index.test.tsx +5 -4
- package/src/plugins/builtin/alerts/index.tsx +18 -473
- package/src/plugins/builtin/alerts/pane.tsx +304 -0
- package/src/plugins/builtin/alerts/quotes.ts +57 -0
- package/src/plugins/builtin/alerts/storage.ts +20 -0
- package/src/plugins/builtin/analytics/broker-performance.ts +142 -0
- package/src/plugins/builtin/analytics/display.ts +44 -0
- package/src/plugins/builtin/analytics/index.test.tsx +144 -5
- package/src/plugins/builtin/analytics/index.tsx +108 -468
- package/src/plugins/builtin/analytics/metrics.ts +1 -1
- package/src/plugins/builtin/analytics/pane-model.ts +297 -0
- package/src/plugins/builtin/analytics/portfolio-selection.ts +10 -0
- package/src/plugins/builtin/analytics/sector-model.ts +172 -0
- package/src/plugins/builtin/analytics/view.tsx +207 -0
- package/src/plugins/builtin/broker-manager/detail.tsx +232 -0
- package/src/plugins/builtin/broker-manager/footer.ts +62 -0
- package/src/plugins/builtin/broker-manager/index.test.tsx +3 -3
- package/src/plugins/builtin/broker-manager/index.tsx +125 -527
- package/src/plugins/builtin/broker-manager/keyboard.ts +104 -0
- package/src/plugins/builtin/broker-manager/model.test.ts +39 -1
- package/src/plugins/builtin/broker-manager/model.ts +14 -8
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +181 -0
- package/src/plugins/builtin/broker-manager/table.ts +86 -0
- package/src/plugins/builtin/buildout/cells.tsx +203 -0
- package/src/plugins/builtin/buildout/data-runtime.ts +238 -0
- package/src/plugins/builtin/buildout/detail/company.tsx +219 -0
- package/src/plugins/builtin/buildout/detail/index.tsx +105 -0
- package/src/plugins/builtin/buildout/detail/intel.tsx +61 -0
- package/src/plugins/builtin/buildout/detail/satellite-images.tsx +80 -0
- package/src/plugins/builtin/buildout/detail/site.tsx +142 -0
- package/src/plugins/builtin/buildout/detail/ui.tsx +355 -0
- package/src/plugins/builtin/buildout/detail/values.ts +67 -0
- package/src/plugins/builtin/buildout/format.ts +163 -0
- package/src/plugins/builtin/buildout/model/index.ts +135 -0
- package/src/plugins/builtin/buildout/model/normalizers.ts +396 -0
- package/src/plugins/builtin/buildout/model/types.ts +318 -0
- package/src/plugins/builtin/buildout/pane/header.tsx +55 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +405 -0
- package/src/plugins/builtin/buildout/pane/status.tsx +84 -0
- package/src/plugins/builtin/buildout/table-model.ts +367 -0
- package/src/plugins/builtin/changelog/index.tsx +370 -0
- package/src/plugins/builtin/chat/channels.ts +157 -0
- package/src/plugins/builtin/chat/chat.test.tsx +1048 -0
- package/src/plugins/builtin/chat/composer-commands.test.ts +30 -0
- package/src/plugins/builtin/chat/composer-commands.ts +34 -0
- package/src/plugins/builtin/chat/content/channel-navigation.ts +157 -0
- package/src/plugins/builtin/chat/content/composer-runtime.ts +251 -0
- package/src/plugins/builtin/chat/content/composer.tsx +148 -0
- package/src/plugins/builtin/chat/content/index.tsx +407 -0
- package/src/plugins/builtin/chat/content/layout-metrics.ts +72 -0
- package/src/plugins/builtin/chat/content/scroll.ts +278 -0
- package/src/plugins/builtin/chat/content/selection-runtime.ts +66 -0
- package/src/plugins/builtin/chat/content/shortcuts.ts +212 -0
- package/src/plugins/builtin/chat/content/snapshot.ts +154 -0
- package/src/plugins/builtin/chat/content/transcript.tsx +155 -0
- package/src/plugins/builtin/chat/content/types.ts +26 -0
- package/src/plugins/builtin/chat/content/user-map.ts +21 -0
- package/src/plugins/builtin/chat/controller/channel-actions.ts +87 -0
- package/src/plugins/builtin/chat/controller/channels.ts +159 -0
- package/src/plugins/builtin/chat/controller/connections.ts +90 -0
- package/src/plugins/builtin/chat/controller/draft-sync.ts +41 -0
- package/src/plugins/builtin/chat/controller/fetch.ts +83 -0
- package/src/plugins/builtin/chat/controller/index.ts +488 -0
- package/src/plugins/builtin/chat/controller/lifecycle.ts +141 -0
- package/src/plugins/builtin/chat/controller/message-loading.ts +97 -0
- package/src/plugins/builtin/chat/controller/messages.ts +173 -0
- package/src/plugins/builtin/chat/controller/notifications.ts +56 -0
- package/src/plugins/builtin/chat/controller/persistence.ts +166 -0
- package/src/plugins/builtin/chat/controller/realtime.ts +91 -0
- package/src/plugins/builtin/chat/controller/send.ts +89 -0
- package/src/plugins/builtin/chat/controller/session-runtime.ts +156 -0
- package/src/plugins/builtin/chat/controller/session.ts +39 -0
- package/src/plugins/builtin/chat/controller/state.ts +162 -0
- package/src/plugins/builtin/chat/controller/storage.ts +136 -0
- package/src/plugins/builtin/chat/controller/utils.ts +75 -0
- package/src/plugins/builtin/chat/controller/view.ts +96 -0
- package/src/plugins/builtin/chat/controller.test.ts +1302 -0
- package/src/plugins/builtin/chat/index.tsx +4 -0
- package/src/plugins/builtin/chat/layout.ts +330 -0
- package/src/plugins/builtin/chat/message/action-chip.tsx +38 -0
- package/src/plugins/builtin/chat/message/desktop.tsx +158 -0
- package/src/plugins/builtin/chat/message/inline-tokens.tsx +118 -0
- package/src/plugins/builtin/chat/message/profile-popover.tsx +72 -0
- package/src/plugins/builtin/chat/message/render-state.ts +67 -0
- package/src/plugins/builtin/chat/message/terminal.tsx +132 -0
- package/src/plugins/builtin/chat/message/types.ts +18 -0
- package/src/plugins/builtin/chat/pane.tsx +100 -0
- package/src/plugins/builtin/chat/profile-popover.ts +49 -0
- package/src/plugins/builtin/chat/sidebar.test.tsx +455 -0
- package/src/plugins/builtin/chat/sidebar.tsx +296 -0
- package/src/plugins/builtin/chat/status-widget.tsx +103 -0
- package/src/plugins/builtin/chat/test-harness.tsx +212 -0
- package/src/plugins/builtin/cloud/auth-actions.tsx +72 -0
- package/src/plugins/builtin/cloud/auth-commands.ts +115 -0
- package/src/plugins/builtin/cloud/index.tsx +11 -0
- package/src/plugins/builtin/cloud/plugin.tsx +185 -0
- package/src/plugins/builtin/cloud-tweets/footer.ts +40 -0
- package/src/plugins/builtin/cloud-tweets/index.ts +1 -0
- package/src/plugins/builtin/cloud-tweets/keyboard.ts +65 -0
- package/src/plugins/builtin/cloud-tweets/model.ts +257 -0
- package/src/plugins/builtin/cloud-tweets/pane.tsx +318 -0
- package/src/plugins/builtin/cloud-tweets/registration.ts +87 -0
- package/src/plugins/builtin/cloud-tweets/search-bar.tsx +49 -0
- package/src/plugins/builtin/cloud-tweets/table.tsx +331 -0
- package/src/plugins/builtin/comparison-chart/index.test.tsx +645 -0
- package/src/plugins/builtin/comparison-chart/index.tsx +194 -0
- package/src/plugins/builtin/congress-trades/detail.tsx +154 -0
- package/src/plugins/builtin/congress-trades/footer.ts +67 -0
- package/src/plugins/builtin/congress-trades/keyboard.ts +112 -0
- package/src/plugins/builtin/congress-trades/model.ts +224 -0
- package/src/plugins/builtin/congress-trades/pane.tsx +331 -0
- package/src/plugins/builtin/congress-trades/table.tsx +84 -0
- package/src/plugins/builtin/correlation/compute.ts +0 -7
- package/src/plugins/builtin/correlation/index.test.tsx +5 -5
- package/src/plugins/builtin/correlation/index.tsx +36 -208
- package/src/plugins/builtin/correlation/matrix/model.ts +155 -0
- package/src/plugins/builtin/correlation/matrix/symbol-cell.tsx +56 -0
- package/src/plugins/builtin/correlation/relationship/controls.tsx +53 -0
- package/src/plugins/builtin/correlation/relationship/history.ts +72 -0
- package/src/plugins/builtin/correlation/relationship/model.ts +279 -0
- package/src/plugins/builtin/correlation/relationship/pane.tsx +359 -0
- package/src/plugins/builtin/correlation/relationship/view-model.ts +120 -0
- package/src/plugins/builtin/correlation/settings.ts +6 -6
- package/src/plugins/builtin/debug/index.tsx +365 -0
- package/src/plugins/builtin/earnings/data/cache.test.ts +94 -0
- package/src/plugins/builtin/earnings/data/cache.ts +145 -0
- package/src/plugins/builtin/earnings/data/data.test.ts +90 -0
- package/src/plugins/builtin/earnings/data/data.ts +115 -0
- package/src/plugins/builtin/earnings/index.test.ts +12 -0
- package/src/plugins/builtin/earnings/index.tsx +74 -266
- package/src/plugins/builtin/earnings/model.ts +82 -0
- package/src/plugins/builtin/earnings/table.ts +206 -0
- package/src/plugins/builtin/econ/calendar-model.test.ts +48 -0
- package/src/plugins/builtin/econ/calendar-model.ts +217 -0
- package/src/plugins/builtin/econ/calendar-source.ts +1 -1
- package/src/plugins/builtin/econ/detail-view.tsx +319 -0
- package/src/plugins/builtin/econ/fred-cache.test.ts +58 -0
- package/src/plugins/builtin/econ/fred-cache.ts +106 -0
- package/src/plugins/builtin/econ/fred-series-map.ts +0 -4
- package/src/plugins/builtin/econ/index.tsx +46 -474
- package/src/plugins/builtin/fear-greed/cache.test.ts +75 -0
- package/src/plugins/builtin/fear-greed/cache.ts +142 -0
- package/src/plugins/builtin/fear-greed/charts.tsx +305 -0
- package/src/plugins/builtin/fear-greed/data.test.ts +72 -0
- package/src/plugins/builtin/fear-greed/data.ts +370 -0
- package/src/plugins/builtin/fear-greed/format.ts +96 -0
- package/src/plugins/builtin/fear-greed/index.tsx +13 -555
- package/src/plugins/builtin/fear-greed/pane.tsx +169 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +1 -1
- package/src/plugins/builtin/fx-matrix/pairs.ts +0 -22
- package/src/plugins/builtin/help/components.tsx +92 -0
- package/src/plugins/builtin/help/index.test.tsx +167 -0
- package/src/plugins/builtin/help/index.tsx +256 -0
- package/src/plugins/builtin/help/shortcut-model.ts +145 -0
- package/src/plugins/builtin/holders/format.ts +44 -0
- package/src/plugins/builtin/holders/index.test.ts +1 -46
- package/src/plugins/builtin/holders/index.tsx +3 -955
- package/src/plugins/builtin/holders/pane.tsx +331 -0
- package/src/plugins/builtin/holders/table-model.ts +84 -0
- package/src/plugins/builtin/holders/thirteenf-match.ts +76 -0
- package/src/plugins/builtin/holders/treemap-layout.ts +231 -0
- package/src/plugins/builtin/holders/treemap.tsx +318 -0
- package/src/plugins/builtin/holders/types.ts +51 -0
- package/src/plugins/builtin/insider/index.tsx +5 -5
- package/src/plugins/builtin/layout-manager/index.tsx +247 -0
- package/src/plugins/builtin/market-movers/index.tsx +44 -282
- package/src/plugins/builtin/market-movers/model.ts +146 -0
- package/src/plugins/builtin/market-movers/screener.test.ts +31 -1
- package/src/plugins/builtin/market-movers/screener.ts +106 -12
- package/src/plugins/builtin/market-movers/table.ts +95 -0
- package/src/plugins/builtin/news/index.tsx +194 -0
- package/src/plugins/builtin/news/wire/breaking/notifications.test.ts +98 -0
- package/src/plugins/builtin/news/wire/breaking/notifications.ts +110 -0
- package/src/plugins/builtin/news/wire/breaking/pane.test.tsx +156 -0
- package/src/plugins/builtin/news/wire/breaking/pane.tsx +68 -0
- package/src/plugins/builtin/news/wire/categories.ts +114 -0
- package/src/plugins/builtin/news/wire/default-feeds.ts +3 -0
- package/src/plugins/builtin/news/wire/feed-config.test.ts +90 -0
- package/src/plugins/builtin/news/wire/feed-config.ts +216 -0
- package/src/plugins/builtin/news/wire/index.tsx +129 -0
- package/src/plugins/builtin/news/wire/industry-pane.tsx +126 -0
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +306 -0
- package/src/plugins/builtin/news/wire/news/footer.ts +77 -0
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +98 -0
- package/src/plugins/builtin/news/wire/news/query-presets.ts +40 -0
- package/src/plugins/builtin/news/wire/news/table.test.tsx +157 -0
- package/src/plugins/builtin/news/wire/news/table.tsx +270 -0
- package/src/plugins/builtin/news/wire/persisted-articles.ts +98 -0
- package/src/plugins/builtin/news/wire/read-state.ts +76 -0
- package/src/plugins/builtin/news/wire/rss/parser.test.ts +116 -0
- package/src/plugins/builtin/news/wire/rss/parser.ts +213 -0
- package/src/plugins/builtin/news/wire/rss/source.test.ts +104 -0
- package/src/plugins/builtin/news/wire/rss/source.ts +181 -0
- package/src/plugins/builtin/notes/index.tsx +49 -0
- package/src/plugins/builtin/notes/markdown-note-preview.tsx +39 -0
- package/src/plugins/builtin/notes/model.ts +36 -0
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +334 -0
- package/src/plugins/builtin/notes/text-state.ts +11 -0
- package/src/plugins/builtin/notes/ticker-notes-tab.tsx +112 -0
- package/src/plugins/builtin/options/index.tsx +44 -0
- package/src/plugins/builtin/options/table.ts +209 -0
- package/src/plugins/builtin/options/types.ts +33 -0
- package/src/plugins/builtin/options/view.test.tsx +185 -0
- package/src/plugins/builtin/options/view.tsx +264 -0
- package/src/plugins/builtin/plugin-groups.ts +25 -5
- package/src/plugins/builtin/portfolio-list/account-metrics.test.ts +50 -0
- package/src/plugins/builtin/portfolio-list/account-metrics.ts +46 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +224 -0
- package/src/plugins/builtin/portfolio-list/cli/render.ts +203 -0
- package/src/plugins/builtin/portfolio-list/cli/shared.ts +21 -0
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +224 -0
- package/src/plugins/builtin/portfolio-list/column-values.ts +284 -0
- package/src/plugins/builtin/portfolio-list/command-bar.ts +1 -1
- package/src/plugins/builtin/portfolio-list/header.tsx +7 -98
- package/src/plugins/builtin/portfolio-list/index.test.ts +133 -0
- package/src/plugins/builtin/portfolio-list/index.tsx +2 -1
- package/src/plugins/builtin/portfolio-list/metrics.test.ts +242 -0
- package/src/plugins/builtin/portfolio-list/metrics.ts +5 -462
- package/src/plugins/builtin/portfolio-list/pane/data.ts +171 -0
- package/src/plugins/builtin/portfolio-list/pane/index.test.tsx +1267 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +385 -0
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +159 -0
- package/src/plugins/builtin/portfolio-list/position-metrics.ts +123 -0
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +326 -0
- package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +135 -0
- package/src/plugins/builtin/portfolio-list/settings.ts +5 -3
- package/src/plugins/builtin/portfolio-list/summary/index.test.ts +126 -0
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +392 -0
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +86 -0
- package/src/plugins/builtin/portfolio-list/table.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/use-throttled-cursor-symbol.ts +1 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +383 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +413 -0
- package/src/plugins/builtin/research/index.test.ts +248 -2
- package/src/plugins/builtin/research/index.tsx +30 -760
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +189 -0
- package/src/plugins/builtin/sec/filing-display.tsx +84 -0
- package/src/plugins/builtin/sec/index.tsx +342 -0
- package/src/plugins/builtin/sectors/index.tsx +27 -234
- package/src/plugins/builtin/sectors/sector-data.ts +0 -2
- package/src/plugins/builtin/sectors/sector-model.ts +221 -0
- package/src/plugins/builtin/shared/table-pane.ts +31 -0
- package/src/plugins/builtin/shared/ticker-request.ts +70 -0
- package/src/plugins/builtin/shared/ticker-surface.test.ts +57 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +113 -0
- package/src/plugins/builtin/thirteenf/api.test.ts +58 -0
- package/src/plugins/builtin/thirteenf/api.ts +375 -0
- package/src/plugins/builtin/thirteenf/data.test.ts +95 -0
- package/src/plugins/builtin/thirteenf/data.ts +210 -0
- package/src/plugins/builtin/thirteenf/format.ts +55 -0
- package/src/plugins/builtin/thirteenf/index.tsx +80 -0
- package/src/plugins/builtin/thirteenf/model.test.ts +156 -0
- package/src/plugins/builtin/thirteenf/model.ts +618 -0
- package/src/plugins/builtin/thirteenf/pane.test.tsx +328 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +826 -0
- package/src/plugins/builtin/thirteenf/table.ts +212 -0
- package/src/plugins/builtin/thirteenf/types.ts +187 -0
- package/src/plugins/builtin/ticker-detail/chart-pane.tsx +91 -0
- package/src/plugins/builtin/ticker-detail/chart-tab-switch.test.tsx +282 -0
- package/src/plugins/builtin/ticker-detail/chart-tab.tsx +3 -5
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/content.tsx +158 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/data.ts +62 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/model.ts +234 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/settings.ts +44 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/types.ts +51 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph.tsx +135 -0
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +192 -0
- package/src/plugins/builtin/ticker-detail/data-panes/provider-search.tsx +172 -0
- package/src/plugins/builtin/ticker-detail/data-panes.test.ts +110 -0
- package/src/plugins/builtin/ticker-detail/financials/aggregation.ts +203 -0
- package/src/plugins/builtin/ticker-detail/financials/model.test.ts +84 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +364 -0
- package/src/plugins/builtin/ticker-detail/financials/pane.tsx +27 -0
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +392 -0
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +438 -0
- package/src/plugins/builtin/ticker-detail/index.test.tsx +780 -0
- package/src/plugins/builtin/ticker-detail/index.tsx +174 -17
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +240 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +168 -0
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -0
- package/src/plugins/builtin/ticker-detail/overview/types.ts +17 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +27 -392
- package/src/plugins/builtin/ticker-detail/pane.tsx +24 -136
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +330 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.test.tsx +292 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +180 -0
- package/src/plugins/builtin/ticker-detail/settings.ts +39 -33
- package/src/plugins/builtin/world-indices/footer.ts +28 -0
- package/src/plugins/builtin/world-indices/index.tsx +25 -218
- package/src/plugins/builtin/world-indices/model.ts +120 -0
- package/src/plugins/builtin/world-indices/table.tsx +96 -0
- package/src/plugins/builtin/yahoo/index.ts +72 -0
- package/src/plugins/builtin/yield-curve/index.tsx +5 -5
- package/src/plugins/builtin/yield-curve/treasury-data.ts +1 -1
- package/src/plugins/catalog-ui.ts +7 -9
- package/src/plugins/catalog.ts +1 -1
- package/src/plugins/ibkr/account-cache.ts +2 -10
- package/src/plugins/ibkr/broker-adapter.ts +10 -4
- package/src/plugins/ibkr/config.ts +5 -24
- package/src/plugins/ibkr/dialogs.tsx +0 -1
- package/src/plugins/ibkr/flex/index.test.ts +236 -0
- package/src/plugins/ibkr/flex/index.ts +337 -0
- package/src/plugins/ibkr/flex/statement-client.ts +181 -0
- package/src/plugins/ibkr/gateway/account-loaders.ts +266 -0
- package/src/plugins/ibkr/gateway/account-summary.ts +163 -0
- package/src/plugins/ibkr/gateway/client-lock.ts +154 -0
- package/src/plugins/ibkr/gateway/connection-events.ts +114 -0
- package/src/plugins/ibkr/gateway/connection.ts +152 -0
- package/src/plugins/ibkr/gateway/contracts.ts +132 -0
- package/src/plugins/ibkr/gateway/fundamentals.ts +83 -0
- package/src/plugins/ibkr/gateway/helpers.ts +33 -0
- package/src/plugins/ibkr/gateway/history-requests.ts +158 -0
- package/src/plugins/ibkr/gateway/history.ts +120 -0
- package/src/plugins/ibkr/gateway/instrument-lookup.ts +117 -0
- package/src/plugins/ibkr/gateway/market-data.ts +338 -0
- package/src/plugins/ibkr/gateway/order-execution.ts +218 -0
- package/src/plugins/ibkr/gateway/orders.ts +63 -0
- package/src/plugins/ibkr/gateway/price-normalization.test.ts +44 -0
- package/src/plugins/ibkr/gateway/price-normalization.ts +50 -0
- package/src/plugins/ibkr/gateway/quote-stream-controller.ts +203 -0
- package/src/plugins/ibkr/gateway/quote-stream.ts +171 -0
- package/src/plugins/ibkr/gateway/selection.ts +51 -0
- package/src/plugins/ibkr/gateway/service/index.test.ts +614 -0
- package/src/plugins/ibkr/gateway/service/index.ts +432 -0
- package/src/plugins/ibkr/gateway/service/lifecycle.ts +191 -0
- package/src/plugins/ibkr/gateway/service/manager.ts +52 -0
- package/src/plugins/ibkr/gateway/service/market-data.ts +48 -0
- package/src/plugins/ibkr/gateway/service/native.ts +543 -0
- package/src/plugins/ibkr/gateway/timeouts.ts +13 -0
- package/src/plugins/ibkr/gateway/types.ts +27 -0
- package/src/plugins/ibkr/hash.ts +8 -0
- package/src/plugins/ibkr/index.test.tsx +1 -12
- package/src/plugins/ibkr/index.tsx +8 -9
- package/src/plugins/ibkr/instance-selection.test.ts +2 -2
- package/src/plugins/ibkr/instance-selection.ts +1 -1
- package/src/plugins/ibkr/portfolio-performance.test.ts +32 -0
- package/src/plugins/ibkr/portfolio-performance.ts +129 -0
- package/src/plugins/ibkr/trade/badge.tsx +28 -0
- package/src/plugins/ibkr/trade/dialogs.tsx +44 -0
- package/src/plugins/ibkr/trade/preview-panel.tsx +130 -0
- package/src/plugins/ibkr/trade/tab/actions.tsx +443 -0
- package/src/plugins/ibkr/trade/tab/field-editors.tsx +79 -0
- package/src/plugins/ibkr/trade/tab/footer.ts +67 -0
- package/src/plugins/ibkr/trade/tab/header.tsx +167 -0
- package/src/plugins/ibkr/trade/tab/index.test.tsx +178 -0
- package/src/plugins/ibkr/trade/tab/index.tsx +302 -0
- package/src/plugins/ibkr/trade/tab/model.ts +159 -0
- package/src/plugins/ibkr/trade/tab/order-request.ts +64 -0
- package/src/plugins/ibkr/trade/tab/shortcuts.ts +89 -0
- package/src/plugins/ibkr/trade/tab/state-sync.ts +86 -0
- package/src/plugins/ibkr/trade/ticket-panel.tsx +301 -0
- package/src/plugins/ibkr/trade/utils.test.ts +175 -0
- package/src/plugins/ibkr/trade/utils.ts +150 -0
- package/src/plugins/ibkr/trading/pane-view.tsx +175 -0
- package/src/plugins/ibkr/trading/pane.tsx +332 -0
- package/src/plugins/ibkr/trading/state.test.ts +109 -0
- package/src/plugins/ibkr/trading/state.ts +335 -0
- package/src/plugins/pane-manager/dock-tree.ts +282 -0
- package/src/plugins/pane-manager/docking.ts +202 -0
- package/src/plugins/pane-manager/floating-actions.ts +158 -0
- package/src/plugins/pane-manager/floating.ts +76 -0
- package/src/plugins/pane-manager/gridlock-inference.ts +126 -0
- package/src/plugins/pane-manager/gridlock.ts +34 -0
- package/src/plugins/pane-manager/layout-state.ts +160 -0
- package/src/plugins/pane-manager/queries.ts +75 -0
- package/src/plugins/pane-manager/types.ts +24 -0
- package/src/plugins/pane-manager.test.ts +110 -4
- package/src/plugins/pane-manager.ts +57 -1035
- package/src/plugins/prediction-markets/chart.test.tsx +2 -2
- package/src/plugins/prediction-markets/controller/catalog.ts +317 -0
- package/src/plugins/prediction-markets/controller/data.ts +171 -0
- package/src/plugins/prediction-markets/controller/detail.ts +243 -0
- package/src/plugins/prediction-markets/controller/effects.ts +253 -0
- package/src/plugins/prediction-markets/controller/index.ts +374 -0
- package/src/plugins/prediction-markets/controller/keyboard.ts +220 -0
- package/src/plugins/prediction-markets/controller/live-updates.ts +85 -0
- package/src/plugins/prediction-markets/controller/selection.ts +59 -0
- package/src/plugins/prediction-markets/controller/status.ts +104 -0
- package/src/plugins/prediction-markets/detail/outcomes.tsx +1 -1
- package/src/plugins/prediction-markets/metrics.ts +4 -14
- package/src/plugins/prediction-markets/navigation.ts +0 -13
- package/src/plugins/prediction-markets/pane.test.tsx +2 -198
- package/src/plugins/prediction-markets/plugin.test.tsx +2 -2
- package/src/plugins/prediction-markets/services/fetch.ts +1 -5
- package/src/plugins/prediction-markets/services/kalshi/adapter.ts +299 -0
- package/src/plugins/prediction-markets/services/kalshi/normalize.ts +209 -0
- package/src/plugins/prediction-markets/services/kalshi/types.ts +89 -0
- package/src/plugins/prediction-markets/services/polymarket/adapter.ts +134 -0
- package/src/plugins/prediction-markets/services/polymarket/detail.ts +307 -0
- package/src/plugins/prediction-markets/services/polymarket/normalize.ts +239 -0
- package/src/plugins/prediction-markets/services/polymarket/types.ts +66 -0
- package/src/plugins/prediction-markets/services/polymarket/ws.ts +128 -0
- package/src/plugins/prediction-markets/test-helpers.tsx +12 -76
- package/src/plugins/prediction-markets/types.ts +2 -2
- package/src/plugins/registry/context-menu.ts +36 -0
- package/src/plugins/registry/context.ts +196 -0
- package/src/plugins/registry/contributions.ts +174 -0
- package/src/plugins/registry/index.test.ts +362 -0
- package/src/plugins/registry/index.ts +474 -0
- package/src/plugins/registry/pane-settings.ts +105 -0
- package/src/plugins/registry/plugin-state.ts +123 -0
- package/src/plugins/registry/shared.ts +34 -0
- package/src/plugins/registry/slots.ts +70 -0
- package/src/plugins/runtime/context.tsx +115 -0
- package/src/plugins/runtime/index.test.tsx +328 -0
- package/src/plugins/runtime/index.tsx +111 -0
- package/src/plugins/runtime/state.ts +275 -0
- package/src/plugins/ticker-navigation.test.ts +23 -2
- package/src/plugins/ticker-navigation.ts +9 -3
- package/src/react/input.test.ts +29 -0
- package/src/react/input.ts +9 -0
- package/src/renderers/electrobun/bun/application-menu/click.test.ts +50 -0
- package/src/renderers/electrobun/bun/application-menu/click.ts +58 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +123 -0
- package/src/renderers/electrobun/bun/context-menu/click.test.ts +67 -0
- package/src/renderers/electrobun/bun/context-menu/normalize.test.ts +52 -0
- package/src/renderers/electrobun/bun/context-menu/normalize.ts +67 -0
- package/src/renderers/electrobun/bun/core-capabilities.ts +3 -0
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +163 -0
- package/src/renderers/electrobun/bun/desktop/capability-bridge.ts +93 -0
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +263 -0
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +114 -0
- package/src/renderers/electrobun/bun/desktop/http-fetch.ts +56 -0
- package/src/renderers/electrobun/bun/desktop/initialization.ts +139 -0
- package/src/renderers/electrobun/bun/desktop/plugin-state.ts +92 -0
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +48 -0
- package/src/renderers/electrobun/bun/desktop/rpc-registry.ts +43 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +76 -0
- package/src/renderers/electrobun/bun/desktop/update.ts +162 -0
- package/src/renderers/electrobun/bun/desktop/window-events.ts +49 -0
- package/src/renderers/electrobun/bun/desktop/workspace/index.test.ts +63 -0
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +180 -0
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +97 -0
- package/src/renderers/electrobun/bun/index.ts +191 -947
- package/src/renderers/electrobun/bun/tui-entry.ts +6 -0
- package/src/renderers/electrobun/bun/window/focus.ts +37 -0
- package/src/renderers/electrobun/bun/window/frame.test.ts +40 -0
- package/src/renderers/electrobun/shared/protocol.ts +9 -2
- package/src/renderers/electrobun/view/app-services.ts +4 -375
- package/src/renderers/electrobun/view/backend-rpc.ts +5 -0
- package/src/renderers/electrobun/view/build-assets.ts +117 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +398 -0
- package/src/renderers/electrobun/view/config-host.ts +1 -1
- package/src/renderers/electrobun/view/context-menu.test.ts +10 -4
- package/src/renderers/electrobun/view/context-menu.ts +1 -1
- package/src/renderers/electrobun/view/data-table/dom.ts +211 -0
- package/src/renderers/electrobun/view/data-table/index.tsx +358 -0
- package/src/renderers/electrobun/view/data-table/row.tsx +335 -0
- package/src/renderers/electrobun/view/desktop/control-styles.ts +77 -0
- package/src/renderers/electrobun/view/desktop/controls.tsx +421 -0
- package/src/renderers/electrobun/view/desktop/list-view.tsx +200 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +70 -0
- package/src/renderers/electrobun/view/desktop/window/snapshot.test.ts +57 -0
- package/src/renderers/electrobun/view/desktop/window/snapshot.ts +41 -0
- package/src/renderers/electrobun/view/fatal-screen.tsx +118 -0
- package/src/renderers/electrobun/view/host/box.tsx +160 -0
- package/src/renderers/electrobun/view/host/chart-surface.tsx +142 -0
- package/src/renderers/electrobun/view/host/input.tsx +294 -0
- package/src/renderers/electrobun/view/host/mouse.ts +139 -0
- package/src/renderers/electrobun/view/host/native.ts +49 -0
- package/src/renderers/electrobun/view/host/scroll-box.tsx +276 -0
- package/src/renderers/electrobun/view/host/style.ts +124 -0
- package/src/renderers/electrobun/view/host/tabs.tsx +255 -0
- package/src/renderers/electrobun/view/host/text.tsx +121 -0
- package/src/renderers/electrobun/view/http-fetch.ts +1 -1
- package/src/renderers/electrobun/view/input-host.tsx +12 -1
- package/src/renderers/electrobun/view/main.tsx +45 -26
- package/src/renderers/electrobun/view/native-stubs/backend-rpc.ts +59 -0
- package/src/renderers/electrobun/view/native-stubs/chart/kitty-support.ts +9 -0
- package/src/renderers/electrobun/view/remote/asset-data-client.ts +201 -0
- package/src/renderers/electrobun/view/remote/persistence.ts +158 -0
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +26 -0
- package/src/renderers/electrobun/view/styles.css +91 -4
- package/src/renderers/electrobun/view/ui-host.tsx +22 -1469
- package/src/renderers/opentui/chart-surface.tsx +4 -5
- package/src/renderers/opentui/host.tsx +30 -4
- package/src/renderers/opentui/image/loader.test.ts +25 -0
- package/src/renderers/opentui/image/loader.ts +105 -0
- package/src/renderers/opentui/image/surface.tsx +266 -0
- package/src/renderers/opentui/input-host.tsx +12 -1
- package/src/renderers/opentui/start.tsx +2 -2
- package/src/renderers/opentui/test-utils.tsx +2 -2
- package/src/renderers/opentui/ui-host.tsx +1 -1
- package/src/sources/gloomberb-cloud/index.test.ts +660 -0
- package/src/sources/gloomberb-cloud/index.ts +444 -0
- package/src/sources/gloomberb-cloud/news.ts +127 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +354 -0
- package/src/sources/provider-errors.ts +8 -2
- package/src/sources/provider-router/batches.ts +170 -0
- package/src/sources/provider-router/brokers.ts +114 -0
- package/src/sources/provider-router/cache.ts +171 -0
- package/src/sources/provider-router/cached-financials.test.ts +498 -0
- package/src/sources/provider-router/document-routes.ts +153 -0
- package/src/sources/provider-router/financial-routes.ts +225 -0
- package/src/sources/provider-router/financials.ts +259 -0
- package/src/sources/provider-router/history.test.ts +383 -0
- package/src/sources/provider-router/history.ts +448 -0
- package/src/sources/provider-router/index.test.ts +1438 -0
- package/src/sources/provider-router/index.ts +389 -0
- package/src/sources/provider-router/news.ts +36 -0
- package/src/sources/provider-router/primary.ts +164 -0
- package/src/sources/provider-router/route-types.ts +34 -0
- package/src/sources/provider-router/routing.ts +58 -0
- package/src/sources/provider-router/search.ts +183 -0
- package/src/sources/provider-router/sources.ts +55 -0
- package/src/sources/provider-router/streaming.ts +92 -0
- package/src/sources/provider-router/supplemental.ts +373 -0
- package/src/sources/provider-router/test-support.ts +136 -0
- package/src/sources/sec-edgar/content.ts +211 -0
- package/src/sources/sec-edgar.ts +9 -217
- package/src/sources/yahoo-finance/financials.ts +339 -0
- package/src/sources/yahoo-finance/history.ts +106 -0
- package/src/sources/yahoo-finance/http.ts +100 -0
- package/src/sources/yahoo-finance/mappers.ts +409 -0
- package/src/sources/yahoo-finance/options.ts +134 -0
- package/src/sources/yahoo-finance/quote-summary.ts +210 -0
- package/src/sources/yahoo-finance/requests.ts +192 -0
- package/src/sources/yahoo-finance/snapshots.ts +236 -0
- package/src/sources/yahoo-finance/symbols.ts +102 -0
- package/src/sources/yahoo-finance/types.ts +167 -0
- package/src/sources/yahoo-finance.test.ts +116 -12
- package/src/sources/yahoo-finance.ts +115 -1408
- package/src/state/app/activity.test.ts +41 -0
- package/src/state/app/activity.ts +106 -0
- package/src/state/app/bootstrap.test.ts +498 -0
- package/src/state/app/bootstrap.ts +412 -0
- package/src/state/app/context/index.test.ts +564 -0
- package/src/state/app/context/index.test.tsx +193 -0
- package/src/state/app/context/index.tsx +476 -0
- package/src/state/app/context/selector.test.tsx +291 -0
- package/src/state/config-save-scheduler.ts +2 -6
- package/src/state/hooks/inline-tickers.test.tsx +123 -0
- package/src/state/hooks/inline-tickers.ts +212 -0
- package/src/state/hooks/quote-streaming.test.ts +31 -0
- package/src/state/hooks/quote-streaming.test.tsx +70 -0
- package/src/state/hooks/quote-streaming.ts +92 -0
- package/src/state/hooks/session-snapshot.ts +99 -0
- package/src/state/pane-scroll-registry.tsx +1 -1
- package/src/state/selectors-ui.ts +1 -1
- package/src/state/selectors.ts +1 -1
- package/src/test-support/plugin-persistence.ts +112 -0
- package/src/test-support/plugin-runtime.ts +2 -1
- package/src/theme/colors.ts +23 -9
- package/src/theme/themes.test.ts +15 -0
- package/src/tickers/list.test.ts +16 -0
- package/src/tickers/open-target.ts +77 -0
- package/src/tickers/search/index.test.ts +252 -0
- package/src/tickers/search/index.ts +367 -0
- package/src/tickers/search/ranking.ts +387 -0
- package/src/tickers/search/result.ts +27 -0
- package/src/tickers/search/types.ts +41 -0
- package/src/tickers/search/upsert.ts +91 -0
- package/src/tickers/tokenizer.test.ts +31 -0
- package/src/tickers/tokenizer.ts +37 -0
- package/src/types/broker.ts +12 -4
- package/src/types/config.ts +42 -23
- package/src/types/context-menu.ts +1 -1
- package/src/types/data-provider.ts +2 -2
- package/src/types/desktop-window.ts +1 -1
- package/src/types/financials.ts +109 -4
- package/src/types/news-source.ts +0 -1
- package/src/types/persistence.ts +1 -1
- package/src/types/plugin.ts +37 -21
- package/src/types/ticker.ts +1 -0
- package/src/types/trading.ts +23 -1
- package/src/ui/context-menu.tsx +6 -5
- package/src/ui/dialog.tsx +6 -3
- package/src/ui/host.tsx +10 -10
- package/src/ui/index.tsx +14 -33
- package/src/updater/github-releases.test.ts +41 -0
- package/src/updater/github-releases.ts +73 -0
- package/src/updater.test.ts +21 -0
- package/src/updater.ts +10 -3
- package/src/utils/back-navigation.ts +2 -2
- package/src/utils/cli-output.ts +4 -4
- package/src/utils/currency-units.test.ts +23 -1
- package/src/utils/currency-units.ts +56 -0
- package/src/utils/datetime-format.ts +40 -0
- package/src/utils/dom-screenshot.ts +2 -2
- package/src/utils/double-escape-close.ts +1 -1
- package/src/utils/exchanges.ts +2 -2
- package/src/utils/format.ts +0 -7
- package/src/utils/fuzzy-search.ts +1 -1
- package/src/utils/inline-content-tokenizer.test.ts +11 -2
- package/src/utils/inline-content-tokenizer.ts +33 -12
- package/src/utils/keyboard.ts +1 -1
- package/src/utils/link-tokenizer.ts +2 -2
- package/src/utils/options.ts +1 -1
- package/src/utils/price-history.test.ts +20 -0
- package/src/utils/price-history.ts +24 -2
- package/src/utils/relative-time.ts +8 -0
- package/src/utils/selection-clipboard.ts +1 -1
- package/src/utils/shortcut-labels.ts +2 -2
- package/src/utils/sort-values.ts +17 -0
- package/src/utils/terminal-input-reset.ts +1 -1
- package/src/utils/text-wrap.ts +20 -0
- package/src/version.ts +1 -1
- package/src/components/chart/chart-controller.test.ts +0 -110
- package/src/components/chart/chart-controller.ts +0 -650
- package/src/components/chart/chart-data.ts +0 -350
- package/src/components/chart/chart-indicator-selector.tsx +0 -75
- package/src/components/chart/chart-pane-settings.ts +0 -37
- package/src/components/chart/chart-renderer.ts +0 -1562
- package/src/components/chart/chart-resolution.test.ts +0 -87
- package/src/components/chart/chart-resolution.ts +0 -405
- package/src/components/chart/chart-scroll.test.ts +0 -70
- package/src/components/chart/chart-scroll.ts +0 -104
- package/src/components/chart/chart-types.ts +0 -119
- package/src/components/chart/chart-viewport.test.ts +0 -29
- package/src/components/chart/chart-viewport.ts +0 -50
- package/src/components/chart/chart.test.ts +0 -922
- package/src/components/chart/comparison-chart-data.test.ts +0 -105
- package/src/components/chart/comparison-chart-data.ts +0 -292
- package/src/components/chart/comparison-chart-renderer.test.ts +0 -187
- package/src/components/chart/comparison-chart-renderer.ts +0 -437
- package/src/components/chart/native/kitty-adapter.ts +0 -9
- package/src/components/chart/native/kitty-manager.ts +0 -142
- package/src/components/chart/native/kitty-support.ts +0 -71
- package/src/components/chart/native/kitty.test.ts +0 -728
- package/src/components/chart/native/surface-manager.ts +0 -225
- package/src/components/chart/native/surface-sync.ts +0 -34
- package/src/components/chart/native/surface-visibility.ts +0 -48
- package/src/components/chart/static-chart-surface.test.tsx +0 -51
- package/src/components/chart/static-chart-surface.tsx +0 -217
- package/src/components/chart/stock-chart-renderer-switch.test.tsx +0 -1323
- package/src/components/chart/stock-chart.test.ts +0 -330
- package/src/components/chart/stock-chart.tsx +0 -4148
- package/src/components/command-bar/__snapshots__/command-bar.test.tsx.snap +0 -109
- package/src/components/command-bar/command-bar.test.tsx +0 -3244
- package/src/components/command-bar/command-bar.tsx +0 -5868
- package/src/components/command-bar/command-registry.ts +0 -267
- package/src/components/command-bar/confirm-body.tsx +0 -51
- package/src/components/command-bar/list-model.ts +0 -80
- package/src/components/command-bar/pane-template-display.ts +0 -8
- package/src/components/command-bar/root-shortcuts.ts +0 -188
- package/src/components/command-bar/workflow-ops.test.ts +0 -144
- package/src/components/command-bar/workflow-ops.ts +0 -459
- package/src/components/command-bar/workflow-types.ts +0 -127
- package/src/components/data-table-stack-view.test.tsx +0 -241
- package/src/components/data-table-stack-view.tsx +0 -59
- package/src/components/data-table-view.test.tsx +0 -211
- package/src/components/data-table-view.tsx +0 -244
- package/src/components/feed-data-table-stack-view.test.tsx +0 -225
- package/src/components/feed-data-table-stack-view.tsx +0 -359
- package/src/components/layout/pane-content.test.tsx +0 -64
- package/src/components/layout/pane-content.tsx +0 -44
- package/src/components/layout/pane-cycle-order.test.ts +0 -30
- package/src/components/layout/pane-cycle-order.ts +0 -32
- package/src/components/layout/pane-footer.test.tsx +0 -195
- package/src/components/layout/pane-footer.tsx +0 -432
- package/src/components/layout/pane-header.test.tsx +0 -39
- package/src/components/layout/pane-header.tsx +0 -248
- package/src/components/layout/pane-keyboard-scroll.test.tsx +0 -226
- package/src/components/layout/pane-sizing.ts +0 -34
- package/src/components/layout/pane-title.ts +0 -38
- package/src/components/layout/pane.tsx +0 -129
- package/src/components/layout/shell.test.tsx +0 -1427
- package/src/components/layout/shell.tsx +0 -1912
- package/src/components/price-sparkline-view.tsx +0 -463
- package/src/components/price-sparkline.ts +0 -46
- package/src/components/speedometer-gauge.test.tsx +0 -45
- package/src/components/speedometer-gauge.tsx +0 -562
- package/src/components/ticker-badge-list.tsx +0 -53
- package/src/components/ticker-badge-text.test.tsx +0 -253
- package/src/components/ticker-badge-text.tsx +0 -113
- package/src/components/ticker-badge.tsx +0 -109
- package/src/components/ticker-list-table-view.tsx +0 -233
- package/src/components/ticker-list-table.test.tsx +0 -210
- package/src/components/ticker-list-table.tsx +0 -458
- package/src/components/ui/data-table.tsx +0 -522
- package/src/components/ui/multi-select-dialog.tsx +0 -336
- package/src/core/state/app-state.ts +0 -1009
- package/src/data/config-layout.ts +0 -225
- package/src/data/config-store-node.ts +0 -478
- package/src/data/config-store.test.ts +0 -481
- package/src/data/config-store.ts +0 -64
- package/src/data/sqlite-cache.test.ts +0 -151
- package/src/data/sqlite-database.ts +0 -68
- package/src/data/sqlite-json.ts +0 -16
- package/src/data/sqlite-retry.test.ts +0 -63
- package/src/market-data/coordinator-subscriptions.test.ts +0 -209
- package/src/market-data/coordinator.test.ts +0 -830
- package/src/market-data/coordinator.ts +0 -1155
- package/src/plugins/builtin/ai/screener-contract.test.ts +0 -117
- package/src/plugins/builtin/ai/screener-contract.ts +0 -174
- package/src/plugins/builtin/ai/screener-pane.test.tsx +0 -348
- package/src/plugins/builtin/ai/screener-pane.tsx +0 -1118
- package/src/plugins/builtin/ai/utils.ts +0 -1
- package/src/plugins/builtin/ask-ai.test.tsx +0 -348
- package/src/plugins/builtin/chat-controller.test.ts +0 -1376
- package/src/plugins/builtin/chat-controller.ts +0 -1248
- package/src/plugins/builtin/chat.test.tsx +0 -2245
- package/src/plugins/builtin/chat.tsx +0 -2267
- package/src/plugins/builtin/cloud-auth-actions.tsx +0 -72
- package/src/plugins/builtin/cloud-tweets.tsx +0 -896
- package/src/plugins/builtin/comparison-chart.test.tsx +0 -532
- package/src/plugins/builtin/comparison-chart.tsx +0 -194
- package/src/plugins/builtin/debug.tsx +0 -365
- package/src/plugins/builtin/earnings/earnings-cache.test.ts +0 -181
- package/src/plugins/builtin/earnings/earnings-cache.ts +0 -145
- package/src/plugins/builtin/earnings/earnings-data.test.ts +0 -90
- package/src/plugins/builtin/earnings/earnings-data.ts +0 -115
- package/src/plugins/builtin/fear-greed/fear-greed-data.test.ts +0 -72
- package/src/plugins/builtin/fear-greed/fear-greed-data.ts +0 -366
- package/src/plugins/builtin/help.test.tsx +0 -166
- package/src/plugins/builtin/help.tsx +0 -450
- package/src/plugins/builtin/layout-manager.tsx +0 -247
- package/src/plugins/builtin/manual-entry.tsx +0 -25
- package/src/plugins/builtin/news-wire/breaking-notifications.test.ts +0 -98
- package/src/plugins/builtin/news-wire/breaking-notifications.ts +0 -110
- package/src/plugins/builtin/news-wire/breaking-pane.test.tsx +0 -156
- package/src/plugins/builtin/news-wire/breaking-pane.tsx +0 -68
- package/src/plugins/builtin/news-wire/categories.ts +0 -114
- package/src/plugins/builtin/news-wire/default-feeds.ts +0 -3
- package/src/plugins/builtin/news-wire/feed-config.test.ts +0 -90
- package/src/plugins/builtin/news-wire/feed-config.ts +0 -216
- package/src/plugins/builtin/news-wire/index.tsx +0 -129
- package/src/plugins/builtin/news-wire/industry-pane.tsx +0 -126
- package/src/plugins/builtin/news-wire/news-detail-view.tsx +0 -299
- package/src/plugins/builtin/news-wire/news-footer.ts +0 -28
- package/src/plugins/builtin/news-wire/news-preset-pane.tsx +0 -98
- package/src/plugins/builtin/news-wire/news-query-presets.ts +0 -40
- package/src/plugins/builtin/news-wire/news-table.test.tsx +0 -206
- package/src/plugins/builtin/news-wire/news-table.tsx +0 -296
- package/src/plugins/builtin/news-wire/persisted-articles.ts +0 -98
- package/src/plugins/builtin/news-wire/read-state.ts +0 -76
- package/src/plugins/builtin/news-wire/rss-parser.test.ts +0 -184
- package/src/plugins/builtin/news-wire/rss-parser.ts +0 -213
- package/src/plugins/builtin/news-wire/rss-source.test.ts +0 -159
- package/src/plugins/builtin/news-wire/rss-source.ts +0 -181
- package/src/plugins/builtin/news.tsx +0 -194
- package/src/plugins/builtin/notes.tsx +0 -561
- package/src/plugins/builtin/options.test.tsx +0 -241
- package/src/plugins/builtin/options.tsx +0 -542
- package/src/plugins/builtin/portfolio-list/cli/commands.ts +0 -657
- package/src/plugins/builtin/portfolio-list/pane.tsx +0 -724
- package/src/plugins/builtin/portfolio-list/quick-add.tsx +0 -422
- package/src/plugins/builtin/portfolio-list/summary.tsx +0 -275
- package/src/plugins/builtin/portfolio-list.test.ts +0 -133
- package/src/plugins/builtin/portfolio-list.test.tsx +0 -1535
- package/src/plugins/builtin/portfolio-metrics.test.ts +0 -236
- package/src/plugins/builtin/quote-monitor.test.tsx +0 -222
- package/src/plugins/builtin/sec-filing-display.tsx +0 -84
- package/src/plugins/builtin/sec.tsx +0 -342
- package/src/plugins/builtin/ticker-detail/financials-tab.tsx +0 -461
- package/src/plugins/builtin/ticker-detail/quote-monitor.tsx +0 -479
- package/src/plugins/builtin/ticker-detail-chart-tab-switch.test.tsx +0 -269
- package/src/plugins/builtin/ticker-detail.test.tsx +0 -888
- package/src/plugins/builtin/ticker-surface.ts +0 -68
- package/src/plugins/builtin/yahoo.ts +0 -72
- package/src/plugins/catalog-ui.test.ts +0 -24
- package/src/plugins/ibkr/__snapshots__/trade-tab.test.tsx.snap +0 -35
- package/src/plugins/ibkr/flex.test.ts +0 -162
- package/src/plugins/ibkr/flex.ts +0 -371
- package/src/plugins/ibkr/gateway-helpers.ts +0 -33
- package/src/plugins/ibkr/gateway-selection.ts +0 -51
- package/src/plugins/ibkr/gateway-service-native.ts +0 -2377
- package/src/plugins/ibkr/gateway-service.test.ts +0 -584
- package/src/plugins/ibkr/gateway-service.ts +0 -433
- package/src/plugins/ibkr/gateway-types.ts +0 -27
- package/src/plugins/ibkr/price-normalization.test.ts +0 -33
- package/src/plugins/ibkr/price-normalization.ts +0 -60
- package/src/plugins/ibkr/trade-badge.tsx +0 -28
- package/src/plugins/ibkr/trade-tab.test.tsx +0 -276
- package/src/plugins/ibkr/trade-tab.tsx +0 -1117
- package/src/plugins/ibkr/trade-utils.test.ts +0 -175
- package/src/plugins/ibkr/trade-utils.ts +0 -150
- package/src/plugins/ibkr/trading-pane.tsx +0 -474
- package/src/plugins/ibkr/trading-state.test.ts +0 -109
- package/src/plugins/ibkr/trading-state.ts +0 -339
- package/src/plugins/plugin-runtime.test.tsx +0 -323
- package/src/plugins/plugin-runtime.tsx +0 -433
- package/src/plugins/prediction-markets/controller-data.ts +0 -785
- package/src/plugins/prediction-markets/controller.ts +0 -659
- package/src/plugins/prediction-markets/services/kalshi-adapter.ts +0 -572
- package/src/plugins/prediction-markets/services/polymarket-adapter.ts +0 -696
- package/src/plugins/prediction-markets/services/polymarket-ws.ts +0 -128
- package/src/plugins/registry.test.ts +0 -362
- package/src/plugins/registry.ts +0 -854
- package/src/renderers/electrobun/bun/application-menu-click.test.ts +0 -50
- package/src/renderers/electrobun/bun/application-menu-click.ts +0 -58
- package/src/renderers/electrobun/bun/application-menu.ts +0 -123
- package/src/renderers/electrobun/bun/context-menu-click.test.ts +0 -67
- package/src/renderers/electrobun/bun/context-menu-normalize.test.ts +0 -52
- package/src/renderers/electrobun/bun/context-menu-normalize.ts +0 -67
- package/src/renderers/electrobun/bun/desktop-workspace.test.ts +0 -63
- package/src/renderers/electrobun/bun/desktop-workspace.ts +0 -180
- package/src/renderers/electrobun/bun/window-focus.ts +0 -37
- package/src/renderers/electrobun/bun/window-frame.test.ts +0 -40
- package/src/renderers/electrobun/view/data-table.tsx +0 -810
- package/src/renderers/electrobun/view/desktop-controls.tsx +0 -673
- package/src/renderers/electrobun/view/desktop-window-bridge.ts +0 -70
- package/src/renderers/electrobun/view/desktop-window-snapshot.test.ts +0 -57
- package/src/renderers/electrobun/view/desktop-window-snapshot.ts +0 -41
- package/src/renderers/electrobun/view/native-stubs/chart-kitty-support.ts +0 -9
- package/src/renderers/opentui/image-loader.test.ts +0 -25
- package/src/renderers/opentui/image-loader.ts +0 -105
- package/src/renderers/opentui/image-surface.tsx +0 -266
- package/src/sources/gloomberb-cloud.test.ts +0 -637
- package/src/sources/gloomberb-cloud.ts +0 -828
- package/src/sources/provider-router.test.ts +0 -2600
- package/src/sources/provider-router.ts +0 -2231
- package/src/state/app-activity.test.ts +0 -41
- package/src/state/app-activity.ts +0 -106
- package/src/state/app-bootstrap.test.ts +0 -498
- package/src/state/app-bootstrap.ts +0 -411
- package/src/state/app-context-selector.test.tsx +0 -369
- package/src/state/app-context.test.ts +0 -670
- package/src/state/app-context.test.tsx +0 -193
- package/src/state/app-context.tsx +0 -485
- package/src/state/use-inline-tickers.test.tsx +0 -73
- package/src/state/use-inline-tickers.ts +0 -188
- package/src/state/use-quote-streaming.test.ts +0 -31
- package/src/state/use-quote-streaming.test.tsx +0 -70
- package/src/state/use-quote-streaming.ts +0 -92
- package/src/state/use-session-snapshot.ts +0 -99
- package/src/utils/api-client.test.ts +0 -603
- package/src/utils/api-client.ts +0 -1379
- package/src/utils/market-format.test.ts +0 -109
- package/src/utils/market-format.ts +0 -299
- package/src/utils/market-status.ts +0 -141
- package/src/utils/quote-freshness.test.ts +0 -150
- package/src/utils/quote-freshness.ts +0 -145
- package/src/utils/quote-resolution.test.ts +0 -277
- package/src/utils/quote-resolution.ts +0 -642
- package/src/utils/quote-time.test.ts +0 -34
- package/src/utils/quote-time.ts +0 -59
- package/src/utils/ticker-list.test.ts +0 -16
- package/src/utils/ticker-search.test.ts +0 -227
- package/src/utils/ticker-search.ts +0 -855
- package/src/utils/ticker-tokenizer.test.ts +0 -31
- package/src/utils/ticker-tokenizer.ts +0 -37
- /package/src/components/chart/native/{kitty-protocol.ts → kitty/protocol.ts} +0 -0
- /package/src/components/ui/{multi-select.ts → multi-select/index.ts} +0 -0
- /package/src/data/{sqlite-retry.ts → sqlite/retry.ts} +0 -0
- /package/src/plugins/builtin/{news-wire → news/wire}/hash.ts +0 -0
- /package/src/plugins/builtin/{news-wire → news/wire}/read-state.test.ts +0 -0
- /package/src/plugins/builtin/{notes-files.ts → notes/files.ts} +0 -0
- /package/src/renderers/electrobun/bun/{context-menu-click.ts → context-menu/click.ts} +0 -0
- /package/src/renderers/electrobun/bun/{window-frame.ts → window/frame.ts} +0 -0
- /package/src/renderers/electrobun/view/native-stubs/{chart-surface-manager.ts → chart/surface-manager.ts} +0 -0
- /package/src/renderers/electrobun/view/native-stubs/{chart-surface-sync.ts → chart/surface-sync.ts} +0 -0
- /package/src/{utils/ticker-list.ts → tickers/list.ts} +0 -0
- /package/src/{utils/ticker-metadata.ts → tickers/metadata.ts} +0 -0
package/src/app.tsx
CHANGED
|
@@ -1,136 +1,50 @@
|
|
|
1
1
|
import { Box, ContextMenuProvider, useNativeRenderer, useRendererHost } from "./ui";
|
|
2
2
|
import { ToastViewport, useToastHost } from "./ui/toast";
|
|
3
3
|
import { useState, useEffect, useCallback, useRef, useMemo, type ReactNode } from "react";
|
|
4
|
-
import { useShortcut } from "./react/input";
|
|
5
4
|
import {
|
|
6
5
|
AppProvider,
|
|
7
|
-
getFocusedCollectionId,
|
|
8
6
|
getFocusedTickerSymbol,
|
|
9
|
-
syncConfigActiveLayoutState,
|
|
10
7
|
useAppDispatch,
|
|
11
8
|
useAppSelector,
|
|
12
9
|
useAppStateRef,
|
|
13
10
|
type AppState,
|
|
14
|
-
} from "./state/app
|
|
15
|
-
import { bindAppActivity, useAppActive } from "./state/app
|
|
16
|
-
import { copyActiveSelection, isCopyShortcut, isPasteShortcut, pasteSystemClipboard } from "./utils/selection-clipboard";
|
|
11
|
+
} from "./state/app/context";
|
|
12
|
+
import { bindAppActivity, useAppActive } from "./state/app/activity";
|
|
17
13
|
import { Header } from "./components/layout/header";
|
|
18
14
|
import { StatusBar } from "./components/layout/status-bar";
|
|
19
15
|
import { Shell } from "./components/layout/shell";
|
|
20
16
|
import { DetachedPaneShell } from "./components/layout/detached-pane-shell";
|
|
21
|
-
import {
|
|
22
|
-
import { CommandBar } from "./components/command-bar/command-bar";
|
|
17
|
+
import { CommandBar } from "./components/command-bar/surface";
|
|
23
18
|
import { OnboardingWizard } from "./components/onboarding/onboarding-wizard";
|
|
24
|
-
import { useDialog
|
|
19
|
+
import { useDialog } from "./ui/dialog";
|
|
25
20
|
import { PluginRegistry } from "./plugins/registry";
|
|
26
21
|
import type { TickerRepository } from "./data/ticker-repository";
|
|
27
22
|
import { ThemeProvider, useThemeColors } from "./theme/theme-context";
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
findPaneInstance,
|
|
31
|
-
findPrimaryPaneInstance,
|
|
32
|
-
isTickerPaneId,
|
|
33
|
-
materializeDetachedPanesAsFloating,
|
|
34
|
-
normalizePaneLayout,
|
|
35
|
-
resolveFollowBindingInstance,
|
|
36
|
-
resolvePaneInstance,
|
|
37
|
-
type AppConfig,
|
|
38
|
-
type BrokerInstanceConfig,
|
|
39
|
-
type LayoutConfig,
|
|
40
|
-
type PaneBinding,
|
|
41
|
-
type PaneInstanceConfig,
|
|
42
|
-
} from "./types/config";
|
|
43
|
-
import type { CliLaunchRequest, PaneTemplateCreateOptions, PaneTemplateInstanceConfig, WizardStep } from "./types/plugin";
|
|
44
|
-
import type { PaneSettingField } from "./types/plugin";
|
|
45
|
-
import type { TickerRecord } from "./types/ticker";
|
|
23
|
+
import type { AppConfig } from "./types/config";
|
|
24
|
+
import type { CliLaunchRequest } from "./types/plugin";
|
|
46
25
|
import type { DataProvider } from "./types/data-provider";
|
|
47
|
-
import type { TickerFinancials } from "./types/financials";
|
|
48
|
-
import type { BrokerAccount } from "./types/trading";
|
|
49
26
|
import type { DesktopDockPreviewState, DesktopSharedStateSnapshot, DesktopThemePreviewState, DesktopWindowBridge } from "./types/desktop-window";
|
|
50
27
|
import type { DesktopApplicationMenuBridge } from "./types/desktop-menu";
|
|
51
|
-
import {
|
|
52
|
-
|
|
53
|
-
import {
|
|
54
|
-
clearPersistedBrokerAccounts,
|
|
55
|
-
getBrokerAccountCacheSourceKey,
|
|
56
|
-
loadPersistedBrokerAccountMap,
|
|
57
|
-
} from "./brokers/account-cache";
|
|
58
|
-
import { chatController } from "./plugins/builtin/chat-controller";
|
|
59
|
-
import { setLayoutManagerDispatch } from "./plugins/builtin/layout-manager";
|
|
60
|
-
import { canSelfUpdate, checkForUpdateDetailed, performUpdate, type ReleaseInfo } from "./updater";
|
|
61
|
-
import { VERSION } from "./version";
|
|
62
|
-
import {
|
|
63
|
-
addPaneFloating,
|
|
64
|
-
addPaneToLayout,
|
|
65
|
-
bringToFront,
|
|
66
|
-
findDockLeaf,
|
|
67
|
-
getDockLeafLayouts,
|
|
68
|
-
getDockedPaneIds,
|
|
69
|
-
getLeafRect,
|
|
70
|
-
gridlockAllPanes,
|
|
71
|
-
isPaneInLayout,
|
|
72
|
-
removePane,
|
|
73
|
-
} from "./plugins/pane-manager";
|
|
74
|
-
import { notifyGridlockComplete } from "./plugins/gridlock-notification";
|
|
75
|
-
import {
|
|
76
|
-
createBrokerInstanceId,
|
|
77
|
-
getBrokerInstance,
|
|
78
|
-
} from "./utils/broker-instances";
|
|
79
|
-
import {
|
|
80
|
-
APP_SESSION_ID,
|
|
81
|
-
APP_SESSION_SCHEMA_VERSION,
|
|
82
|
-
reconcileAppSessionSnapshot,
|
|
83
|
-
type AppSessionSnapshot,
|
|
84
|
-
} from "./core/state/session-persistence";
|
|
85
|
-
import { initializeAppState } from "./state/app-bootstrap";
|
|
86
|
-
import { TickerRefreshQueue } from "./state/ticker-refresh-queue";
|
|
87
|
-
import { PaneSettingsDialogContent } from "./components/pane-settings-dialog";
|
|
88
|
-
import {
|
|
89
|
-
PaneTemplateInfoStep,
|
|
90
|
-
PaneTemplateInputStep,
|
|
91
|
-
PaneTemplateSelectStep,
|
|
92
|
-
PaneTemplateTextareaStep,
|
|
93
|
-
} from "./components/pane-template-wizard";
|
|
94
|
-
import {
|
|
95
|
-
applyPaneSettingFieldValue as applyPaneSettingFieldValueShared,
|
|
96
|
-
createPaneTemplateOrThrow,
|
|
97
|
-
} from "./components/command-bar/workflow-ops";
|
|
98
|
-
import { getPaneTemplateDisplayLabel } from "./components/command-bar/pane-template-display";
|
|
99
|
-
import {
|
|
100
|
-
findFixedTickerPaneForSymbol,
|
|
101
|
-
resolveTickerNavigationReplacementPane,
|
|
102
|
-
shouldFocusTickerNavigationTarget,
|
|
103
|
-
} from "./plugins/ticker-navigation";
|
|
104
|
-
import { debugLog } from "./utils/debug-log";
|
|
28
|
+
import type { LayoutBounds } from "./plugins/pane-manager";
|
|
29
|
+
import type { AppSessionSnapshot } from "./core/state/session-persistence";
|
|
105
30
|
import type { MarketDataCoordinator } from "./market-data/coordinator";
|
|
106
|
-
import { instrumentFromTicker } from "./market-data/request-types";
|
|
107
|
-
import {
|
|
108
|
-
restoreBrokerPortfoliosFromTickerPositions,
|
|
109
|
-
syncBrokerInstance,
|
|
110
|
-
syncBrokerInstances,
|
|
111
|
-
type SyncBrokerInstanceResult,
|
|
112
|
-
} from "./brokers/sync-broker-instance";
|
|
113
31
|
import { createAppNotifier } from "./notifications/app-notifier";
|
|
114
32
|
import { createAppServices } from "./core/app-services";
|
|
33
|
+
import { useBrokerImportRuntime } from "./app/runtime/broker-import";
|
|
34
|
+
import { useDesktopApplicationMenuRuntime } from "./app/runtime/desktop-menu";
|
|
35
|
+
import { useAppGlobalShortcuts } from "./app/global-shortcuts";
|
|
36
|
+
import { useAppPaneRuntime } from "./app/pane-runtime";
|
|
37
|
+
import { bindPluginRegistryRuntimeAccess } from "./app/runtime/plugin-bindings";
|
|
38
|
+
import { useAppStartupRuntime } from "./app/runtime/startup";
|
|
39
|
+
import { useTickerRefreshRuntime } from "./app/runtime/ticker-refresh";
|
|
40
|
+
import { useAppUpdateRuntime } from "./app/runtime/update";
|
|
115
41
|
import {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const refreshInFlight: Set<string> = (globalThis as any).__refreshInFlight ??= new Set<string>();
|
|
123
|
-
const quoteRefreshInFlight: Set<string> = (globalThis as any).__quoteRefreshInFlight ??= new Set<string>();
|
|
124
|
-
const PANEL_RESOLUTION_BOUNDS = { x: 0, y: 0, width: 120, height: 40 };
|
|
125
|
-
const appLog = debugLog.createLogger("app");
|
|
126
|
-
|
|
127
|
-
function isCollectionPaneInstance(instance: PaneInstanceConfig): boolean {
|
|
128
|
-
return instance.paneId === "portfolio-list";
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function isTickerContextPaneInstance(instance: PaneInstanceConfig): boolean {
|
|
132
|
-
return instance.paneId === "portfolio-list" || isTickerPaneId(instance.paneId);
|
|
133
|
-
}
|
|
42
|
+
resolveAppSessionSnapshot,
|
|
43
|
+
resolveCliLaunchConfig,
|
|
44
|
+
resolveInitialAppConfig,
|
|
45
|
+
} from "./app/app-bootstrap-state";
|
|
46
|
+
import { scheduleConfigSave } from "./state/config-save-scheduler";
|
|
47
|
+
import { measurePerf } from "./utils/perf-marks";
|
|
134
48
|
|
|
135
49
|
interface AppInnerProps {
|
|
136
50
|
pluginRegistry: PluginRegistry;
|
|
@@ -200,12 +114,12 @@ function AppInner({
|
|
|
200
114
|
const appActive = useAppActive();
|
|
201
115
|
const appActiveRef = useRef(appActive);
|
|
202
116
|
const rendererHost = useRendererHost();
|
|
203
|
-
const nativeRenderer = useNativeRenderer();
|
|
204
117
|
const dialog = useDialog();
|
|
205
118
|
const toast = useToastHost();
|
|
206
119
|
const isDetachedWindow = desktopWindowBridge?.kind === "detached";
|
|
207
120
|
const detachedPaneId = isDetachedWindow ? desktopWindowBridge.paneId ?? null : null;
|
|
208
121
|
const [desktopDockPreview, setDesktopDockPreview] = useState<DesktopDockPreviewState | null>(null);
|
|
122
|
+
const [commandBarNativeOccluder, setCommandBarNativeOccluder] = useState<LayoutBounds | null>(null);
|
|
209
123
|
appActiveRef.current = appActive;
|
|
210
124
|
const appNotifier = useMemo(() => createAppNotifier({
|
|
211
125
|
isAppActive: () => appActiveRef.current,
|
|
@@ -244,1228 +158,88 @@ function AppInner({
|
|
|
244
158
|
});
|
|
245
159
|
}, [desktopWindowBridge]);
|
|
246
160
|
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
continue;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (step.type === "info") {
|
|
260
|
-
await dialog.alert({
|
|
261
|
-
content: (ctx) => <PaneTemplateInfoStep {...ctx} step={step} />,
|
|
262
|
-
});
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
const result = step.type === "select"
|
|
267
|
-
? await dialog.prompt<string>({
|
|
268
|
-
content: (ctx) => <PaneTemplateSelectStep {...ctx} step={step} />,
|
|
269
|
-
})
|
|
270
|
-
: step.type === "textarea"
|
|
271
|
-
? await dialog.prompt<string>({
|
|
272
|
-
content: (ctx) => <PaneTemplateTextareaStep {...ctx} step={step} />,
|
|
273
|
-
})
|
|
274
|
-
: await dialog.prompt<string>({
|
|
275
|
-
content: (ctx) => <PaneTemplateInputStep {...ctx} step={step} />,
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
if (result === undefined || ((step.type === "select" || step.type === "textarea") && !result)) {
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
values[step.key] = result;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return values;
|
|
286
|
-
}, [dialog]);
|
|
287
|
-
|
|
288
|
-
const resolveCollectionSourcePaneId = useCallback((preferredPaneId?: string | null) => {
|
|
289
|
-
return resolveFollowBindingInstance(state.config.layout, preferredPaneId, isCollectionPaneInstance)?.instanceId
|
|
290
|
-
?? resolveFollowBindingInstance(state.config.layout, state.focusedPaneId, isCollectionPaneInstance)?.instanceId
|
|
291
|
-
?? findPrimaryPaneInstance(state.config.layout, "portfolio-list")?.instanceId
|
|
292
|
-
?? null;
|
|
293
|
-
}, [state.config.layout, state.focusedPaneId]);
|
|
294
|
-
|
|
295
|
-
const resolveTickerContextSourcePaneId = useCallback((preferredPaneId?: string | null) => {
|
|
296
|
-
return resolveFollowBindingInstance(state.config.layout, preferredPaneId, isTickerContextPaneInstance)?.instanceId
|
|
297
|
-
?? resolveFollowBindingInstance(state.config.layout, state.focusedPaneId, isTickerContextPaneInstance)?.instanceId
|
|
298
|
-
?? findPrimaryPaneInstance(state.config.layout, "ticker-detail")?.instanceId
|
|
299
|
-
?? findPrimaryPaneInstance(state.config.layout, "portfolio-list")?.instanceId
|
|
300
|
-
?? null;
|
|
301
|
-
}, [state.config.layout, state.focusedPaneId]);
|
|
302
|
-
|
|
303
|
-
const selectTickerInPane = useCallback((symbol: string, preferredPaneId?: string | null) => {
|
|
304
|
-
const sourcePaneId = resolveCollectionSourcePaneId(preferredPaneId);
|
|
305
|
-
if (!sourcePaneId) return;
|
|
306
|
-
dispatch({ type: "UPDATE_PANE_STATE", paneId: sourcePaneId, patch: { cursorSymbol: symbol } });
|
|
307
|
-
}, [dispatch, resolveCollectionSourcePaneId]);
|
|
308
|
-
|
|
309
|
-
const resolveInspectorPane = useCallback((sourcePaneId: string): PaneInstanceConfig | null => {
|
|
310
|
-
return state.config.layout.instances.find((instance) =>
|
|
311
|
-
instance.paneId === "ticker-detail"
|
|
312
|
-
&& instance.binding?.kind === "follow"
|
|
313
|
-
&& instance.binding.sourceInstanceId === sourcePaneId
|
|
314
|
-
&& isPaneInLayout(state.config.layout, instance.instanceId),
|
|
315
|
-
) ?? null;
|
|
316
|
-
}, [state.config.layout]);
|
|
317
|
-
|
|
318
|
-
const ensureInspectorPane = useCallback((sourcePaneId: string) => {
|
|
319
|
-
const existing = resolveInspectorPane(sourcePaneId);
|
|
320
|
-
if (existing) return { layout: state.config.layout, instance: existing };
|
|
321
|
-
|
|
322
|
-
const paneDef = pluginRegistry.panes.get("ticker-detail");
|
|
323
|
-
if (!paneDef) return null;
|
|
324
|
-
|
|
325
|
-
const preferredInstanceId = sourcePaneId === "portfolio-list:main"
|
|
326
|
-
&& !findPaneInstance(state.config.layout, "ticker-detail:main")
|
|
327
|
-
? "ticker-detail:main"
|
|
328
|
-
: undefined;
|
|
329
|
-
const instance = createPaneInstance("ticker-detail", {
|
|
330
|
-
instanceId: preferredInstanceId,
|
|
331
|
-
binding: { kind: "follow", sourceInstanceId: sourcePaneId },
|
|
332
|
-
});
|
|
333
|
-
const { width, height } = pluginRegistry.getTermSizeFn();
|
|
334
|
-
const sourceDocked = findDockLeaf(state.config.layout, sourcePaneId);
|
|
335
|
-
const layout = sourceDocked && paneDef.defaultMode !== "floating"
|
|
336
|
-
? addPaneToLayout(state.config.layout, instance, { relativeTo: sourcePaneId, position: "right" })
|
|
337
|
-
: addPaneFloating(state.config.layout, instance, width, height, paneDef);
|
|
338
|
-
return { layout, instance };
|
|
339
|
-
}, [pluginRegistry.panes, pluginRegistry.getTermSizeFn, resolveInspectorPane, state.config.layout]);
|
|
340
|
-
|
|
341
|
-
const switchDetailTab = useCallback((tabId: string, preferredPaneId?: string | null) => {
|
|
342
|
-
const targetPaneId = (() => {
|
|
343
|
-
const target = preferredPaneId ? resolvePaneInstance(state.config.layout, preferredPaneId) : null;
|
|
344
|
-
if (target?.paneId === "ticker-detail") return target.instanceId;
|
|
345
|
-
const focused = state.focusedPaneId ? resolvePaneInstance(state.config.layout, state.focusedPaneId) : null;
|
|
346
|
-
if (focused?.paneId === "ticker-detail") return focused.instanceId;
|
|
347
|
-
const sourcePaneId = resolveCollectionSourcePaneId(preferredPaneId);
|
|
348
|
-
if (!sourcePaneId) return null;
|
|
349
|
-
const ensured = ensureInspectorPane(sourcePaneId);
|
|
350
|
-
if (!ensured) return null;
|
|
351
|
-
if (ensured.layout !== state.config.layout) {
|
|
352
|
-
dispatch({ type: "PUSH_LAYOUT_HISTORY" });
|
|
353
|
-
dispatch({ type: "UPDATE_LAYOUT", layout: ensured.layout });
|
|
354
|
-
scheduleConfigSave(syncConfigActiveLayoutState(
|
|
355
|
-
{ ...state.config, layout: ensured.layout },
|
|
356
|
-
state.paneState,
|
|
357
|
-
state.focusedPaneId,
|
|
358
|
-
state.activePanel,
|
|
359
|
-
));
|
|
360
|
-
}
|
|
361
|
-
return ensured.instance.instanceId;
|
|
362
|
-
})();
|
|
363
|
-
if (!targetPaneId) return;
|
|
364
|
-
dispatch({ type: "UPDATE_PANE_STATE", paneId: targetPaneId, patch: { activeTabId: tabId } });
|
|
365
|
-
dispatch({ type: "FOCUS_PANE", paneId: targetPaneId });
|
|
366
|
-
}, [
|
|
161
|
+
const {
|
|
162
|
+
primeCachedFinancials,
|
|
163
|
+
refreshQuote,
|
|
164
|
+
refreshQuotesBatch,
|
|
165
|
+
refreshTicker,
|
|
166
|
+
refreshTickersBatch,
|
|
167
|
+
} = useTickerRefreshRuntime({
|
|
168
|
+
appActive,
|
|
169
|
+
baseCurrency: state.config.baseCurrency,
|
|
367
170
|
dispatch,
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
state.
|
|
371
|
-
state.config.activeLayoutIndex,
|
|
372
|
-
state.config.layout,
|
|
373
|
-
state.focusedPaneId,
|
|
374
|
-
]);
|
|
375
|
-
|
|
376
|
-
const buildPaneBinding = useCallback((paneType: string, preferredPaneId?: string | null): PaneBinding | null => {
|
|
377
|
-
if (paneType === "ticker-detail") {
|
|
378
|
-
const sourceInstanceId = resolveCollectionSourcePaneId(preferredPaneId);
|
|
379
|
-
return sourceInstanceId ? { kind: "follow", sourceInstanceId } : null;
|
|
380
|
-
}
|
|
381
|
-
if (isTickerPaneId(paneType)) {
|
|
382
|
-
const sourceInstanceId = resolveTickerContextSourcePaneId(preferredPaneId);
|
|
383
|
-
return sourceInstanceId ? { kind: "follow", sourceInstanceId } : null;
|
|
384
|
-
}
|
|
385
|
-
return { kind: "none" };
|
|
386
|
-
}, [resolveCollectionSourcePaneId, resolveTickerContextSourcePaneId]);
|
|
387
|
-
|
|
388
|
-
const buildPaneInstance = useCallback((paneType: string, options?: {
|
|
389
|
-
title?: string;
|
|
390
|
-
binding?: PaneBinding;
|
|
391
|
-
params?: Record<string, string>;
|
|
392
|
-
settings?: Record<string, unknown>;
|
|
393
|
-
instanceId?: string;
|
|
394
|
-
}): PaneInstanceConfig | null => {
|
|
395
|
-
if (paneType === "portfolio-list") {
|
|
396
|
-
const collectionId = options?.params?.collectionId
|
|
397
|
-
?? getFocusedCollectionId(state)
|
|
398
|
-
?? state.config.portfolios[0]?.id
|
|
399
|
-
?? state.config.watchlists[0]?.id
|
|
400
|
-
?? "";
|
|
401
|
-
return createPaneInstance(paneType, {
|
|
402
|
-
instanceId: options?.instanceId,
|
|
403
|
-
title: options?.title,
|
|
404
|
-
binding: options?.binding ?? { kind: "none" },
|
|
405
|
-
params: { collectionId },
|
|
406
|
-
settings: options?.settings,
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
const binding = options?.binding ?? buildPaneBinding(paneType);
|
|
410
|
-
if (isTickerPaneId(paneType) && !binding) return null;
|
|
411
|
-
return createPaneInstance(paneType, {
|
|
412
|
-
instanceId: options?.instanceId,
|
|
413
|
-
title: options?.title,
|
|
414
|
-
binding: binding ?? { kind: "none" },
|
|
415
|
-
params: options?.params,
|
|
416
|
-
settings: options?.settings,
|
|
417
|
-
});
|
|
418
|
-
}, [buildPaneBinding, state]);
|
|
419
|
-
|
|
420
|
-
const performRefreshTicker = useCallback(async (symbol: string, exchange = "", tickerOverride?: TickerRecord | null) => {
|
|
421
|
-
if (refreshInFlight.has(symbol)) return;
|
|
422
|
-
refreshInFlight.add(symbol);
|
|
423
|
-
dispatch({ type: "SET_REFRESHING", symbol, refreshing: true });
|
|
424
|
-
try {
|
|
425
|
-
const ticker = tickerOverride ?? state.tickers.get(symbol) ?? null;
|
|
426
|
-
const instrument = instrumentFromTicker(ticker, symbol);
|
|
427
|
-
if (!instrument) return;
|
|
428
|
-
const entry = await marketData.loadSnapshot(instrument, { forceRefresh: true });
|
|
429
|
-
const data = entry.data ?? entry.lastGoodData;
|
|
430
|
-
if (data) {
|
|
431
|
-
pluginRegistry.events.emit("ticker:refreshed", { symbol, financials: data });
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
const currency = data?.quote?.currency;
|
|
435
|
-
if (currency) {
|
|
436
|
-
void marketData.loadFxRate(currency).catch(() => {});
|
|
437
|
-
}
|
|
438
|
-
const base = state.config.baseCurrency;
|
|
439
|
-
void marketData.loadFxRate(base).catch(() => {});
|
|
440
|
-
} catch {
|
|
441
|
-
// Silently fail - will show "—" for missing data
|
|
442
|
-
} finally {
|
|
443
|
-
refreshInFlight.delete(symbol);
|
|
444
|
-
dispatch({ type: "SET_REFRESHING", symbol, refreshing: false });
|
|
445
|
-
}
|
|
446
|
-
}, [dispatch, marketData, pluginRegistry.events, state.config.baseCurrency, state.tickers]);
|
|
447
|
-
|
|
448
|
-
const performRefreshQuote = useCallback(async (symbol: string, exchange = "", tickerOverride?: TickerRecord | null) => {
|
|
449
|
-
if (refreshInFlight.has(symbol) || quoteRefreshInFlight.has(symbol)) return;
|
|
450
|
-
quoteRefreshInFlight.add(symbol);
|
|
451
|
-
try {
|
|
452
|
-
const ticker = tickerOverride ?? state.tickers.get(symbol) ?? null;
|
|
453
|
-
const instrument = instrumentFromTicker(ticker, symbol);
|
|
454
|
-
if (!instrument) return;
|
|
455
|
-
const entry = await marketData.loadQuote(instrument, { forceRefresh: true });
|
|
456
|
-
const quote = entry.data ?? entry.lastGoodData;
|
|
457
|
-
if (!quote) return;
|
|
458
|
-
|
|
459
|
-
const currency = quote.currency;
|
|
460
|
-
if (currency) {
|
|
461
|
-
void marketData.loadFxRate(currency).catch(() => {});
|
|
462
|
-
}
|
|
463
|
-
const base = state.config.baseCurrency;
|
|
464
|
-
void marketData.loadFxRate(base).catch(() => {});
|
|
465
|
-
} catch {
|
|
466
|
-
// Silently fail - the list can fall back to stale cache or Yahoo
|
|
467
|
-
} finally {
|
|
468
|
-
quoteRefreshInFlight.delete(symbol);
|
|
469
|
-
}
|
|
470
|
-
}, [marketData, state.config.baseCurrency, state.tickers]);
|
|
471
|
-
|
|
472
|
-
const refreshQueueRef = useRef<{
|
|
473
|
-
queue: TickerRefreshQueue;
|
|
474
|
-
}>({
|
|
475
|
-
queue: new TickerRefreshQueue(3),
|
|
476
|
-
});
|
|
477
|
-
const pendingRefreshesRef = useRef<{
|
|
478
|
-
financials: Set<string>;
|
|
479
|
-
quotes: Set<string>;
|
|
480
|
-
}>({
|
|
481
|
-
financials: new Set<string>(),
|
|
482
|
-
quotes: new Set<string>(),
|
|
171
|
+
marketData,
|
|
172
|
+
pluginRegistry,
|
|
173
|
+
tickers: state.tickers,
|
|
483
174
|
});
|
|
484
175
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (refreshInFlight.has(symbol) || pendingRefreshesRef.current.financials.has(symbol)) return;
|
|
493
|
-
pendingRefreshesRef.current.financials.add(symbol);
|
|
494
|
-
refreshQueueRef.current.queue.enqueue({
|
|
495
|
-
key: `financials:${symbol}`,
|
|
496
|
-
priority,
|
|
497
|
-
run: async () => {
|
|
498
|
-
try {
|
|
499
|
-
await performRefreshTicker(symbol, exchange, tickerOverride ?? null);
|
|
500
|
-
} finally {
|
|
501
|
-
pendingRefreshesRef.current.financials.delete(symbol);
|
|
502
|
-
}
|
|
503
|
-
},
|
|
504
|
-
});
|
|
505
|
-
}, [performRefreshTicker]);
|
|
506
|
-
|
|
507
|
-
const refreshQuote = useCallback((symbol: string, exchange = "", tickerOverride?: TickerRecord | null, priority = 2) => {
|
|
508
|
-
if (
|
|
509
|
-
refreshInFlight.has(symbol)
|
|
510
|
-
|| quoteRefreshInFlight.has(symbol)
|
|
511
|
-
|| pendingRefreshesRef.current.financials.has(symbol)
|
|
512
|
-
|| pendingRefreshesRef.current.quotes.has(symbol)
|
|
513
|
-
) {
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
pendingRefreshesRef.current.quotes.add(symbol);
|
|
517
|
-
refreshQueueRef.current.queue.enqueue({
|
|
518
|
-
key: `quote:${symbol}`,
|
|
519
|
-
priority,
|
|
520
|
-
run: async () => {
|
|
521
|
-
try {
|
|
522
|
-
if (pendingRefreshesRef.current.financials.has(symbol) || refreshInFlight.has(symbol)) return;
|
|
523
|
-
await performRefreshQuote(symbol, exchange, tickerOverride ?? null);
|
|
524
|
-
} finally {
|
|
525
|
-
pendingRefreshesRef.current.quotes.delete(symbol);
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
});
|
|
529
|
-
}, [performRefreshQuote]);
|
|
530
|
-
|
|
531
|
-
const refreshTickersBatch = useCallback((entries: Array<{ ticker: TickerRecord; priority: number }>) => {
|
|
532
|
-
const runnable = entries.filter(({ ticker }) => {
|
|
533
|
-
const symbol = ticker.metadata.ticker;
|
|
534
|
-
return !refreshInFlight.has(symbol) && !pendingRefreshesRef.current.financials.has(symbol);
|
|
535
|
-
});
|
|
536
|
-
if (runnable.length === 0) return;
|
|
537
|
-
for (const { ticker } of runnable) {
|
|
538
|
-
pendingRefreshesRef.current.financials.add(ticker.metadata.ticker);
|
|
539
|
-
}
|
|
540
|
-
const priority = Math.min(...runnable.map((entry) => entry.priority));
|
|
541
|
-
refreshQueueRef.current.queue.enqueue({
|
|
542
|
-
key: `financials-batch:${priority}:${runnable.map(({ ticker }) => ticker.metadata.ticker).join(",")}`,
|
|
543
|
-
priority,
|
|
544
|
-
run: async () => {
|
|
545
|
-
const instrumentEntries = runnable.flatMap(({ ticker }) => {
|
|
546
|
-
const instrument = instrumentFromTicker(ticker, ticker.metadata.ticker);
|
|
547
|
-
return instrument ? [{ ticker, instrument }] : [];
|
|
548
|
-
});
|
|
549
|
-
for (const { ticker } of runnable) {
|
|
550
|
-
const symbol = ticker.metadata.ticker;
|
|
551
|
-
refreshInFlight.add(symbol);
|
|
552
|
-
dispatch({ type: "SET_REFRESHING", symbol, refreshing: true });
|
|
553
|
-
}
|
|
554
|
-
try {
|
|
555
|
-
const entries = await marketData.loadSnapshotsBatch(instrumentEntries.map((entry) => entry.instrument));
|
|
556
|
-
entries.forEach((entry, index) => {
|
|
557
|
-
const ticker = instrumentEntries[index]?.ticker;
|
|
558
|
-
const data = entry.data ?? entry.lastGoodData;
|
|
559
|
-
if (ticker && data) {
|
|
560
|
-
pluginRegistry.events.emit("ticker:refreshed", { symbol: ticker.metadata.ticker, financials: data });
|
|
561
|
-
const currency = data.quote?.currency;
|
|
562
|
-
if (currency) void marketData.loadFxRate(currency).catch(() => {});
|
|
563
|
-
}
|
|
564
|
-
});
|
|
565
|
-
void marketData.loadFxRate(state.config.baseCurrency).catch(() => {});
|
|
566
|
-
} finally {
|
|
567
|
-
for (const { ticker } of runnable) {
|
|
568
|
-
const symbol = ticker.metadata.ticker;
|
|
569
|
-
refreshInFlight.delete(symbol);
|
|
570
|
-
pendingRefreshesRef.current.financials.delete(symbol);
|
|
571
|
-
dispatch({ type: "SET_REFRESHING", symbol, refreshing: false });
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
},
|
|
575
|
-
});
|
|
576
|
-
}, [dispatch, marketData, pluginRegistry.events, state.config.baseCurrency]);
|
|
577
|
-
|
|
578
|
-
const refreshQuotesBatch = useCallback((entries: Array<{ ticker: TickerRecord; priority: number }>) => {
|
|
579
|
-
const runnable = entries.filter(({ ticker }) => {
|
|
580
|
-
const symbol = ticker.metadata.ticker;
|
|
581
|
-
return !refreshInFlight.has(symbol)
|
|
582
|
-
&& !quoteRefreshInFlight.has(symbol)
|
|
583
|
-
&& !pendingRefreshesRef.current.financials.has(symbol)
|
|
584
|
-
&& !pendingRefreshesRef.current.quotes.has(symbol);
|
|
585
|
-
});
|
|
586
|
-
if (runnable.length === 0) return;
|
|
587
|
-
for (const { ticker } of runnable) {
|
|
588
|
-
pendingRefreshesRef.current.quotes.add(ticker.metadata.ticker);
|
|
589
|
-
}
|
|
590
|
-
const priority = Math.min(...runnable.map((entry) => entry.priority));
|
|
591
|
-
refreshQueueRef.current.queue.enqueue({
|
|
592
|
-
key: `quotes-batch:${priority}:${runnable.map(({ ticker }) => ticker.metadata.ticker).join(",")}`,
|
|
593
|
-
priority,
|
|
594
|
-
run: async () => {
|
|
595
|
-
const instrumentEntries = runnable.flatMap(({ ticker }) => {
|
|
596
|
-
const instrument = instrumentFromTicker(ticker, ticker.metadata.ticker);
|
|
597
|
-
return instrument ? [{ ticker, instrument }] : [];
|
|
598
|
-
});
|
|
599
|
-
for (const { ticker } of runnable) {
|
|
600
|
-
quoteRefreshInFlight.add(ticker.metadata.ticker);
|
|
601
|
-
}
|
|
602
|
-
try {
|
|
603
|
-
const entries = await marketData.loadQuotesBatch(instrumentEntries.map((entry) => entry.instrument));
|
|
604
|
-
entries.forEach((entry) => {
|
|
605
|
-
const quote = entry.data ?? entry.lastGoodData;
|
|
606
|
-
const currency = quote?.currency;
|
|
607
|
-
if (currency) void marketData.loadFxRate(currency).catch(() => {});
|
|
608
|
-
});
|
|
609
|
-
void marketData.loadFxRate(state.config.baseCurrency).catch(() => {});
|
|
610
|
-
} finally {
|
|
611
|
-
for (const { ticker } of runnable) {
|
|
612
|
-
const symbol = ticker.metadata.ticker;
|
|
613
|
-
quoteRefreshInFlight.delete(symbol);
|
|
614
|
-
pendingRefreshesRef.current.quotes.delete(symbol);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
},
|
|
618
|
-
});
|
|
619
|
-
}, [marketData, state.config.baseCurrency]);
|
|
620
|
-
|
|
621
|
-
const primeCachedFinancials = useCallback((entries: Array<{ ticker: TickerRecord; financials: TickerFinancials }>) => {
|
|
622
|
-
const primeEntries = entries.flatMap(({ ticker, financials }) => {
|
|
623
|
-
const instrument = instrumentFromTicker(ticker, ticker.metadata.ticker);
|
|
624
|
-
return instrument ? [{ instrument, financials }] : [];
|
|
625
|
-
});
|
|
626
|
-
if (primeEntries.length === 0) return;
|
|
627
|
-
marketData.primeCachedFinancials(primeEntries);
|
|
628
|
-
}, [marketData]);
|
|
629
|
-
|
|
630
|
-
const applyBrokerImportResult = useCallback(async (
|
|
631
|
-
instanceId: string,
|
|
632
|
-
result: SyncBrokerInstanceResult,
|
|
633
|
-
baseConfig: AppConfig,
|
|
634
|
-
options?: { refreshImportedTickers?: boolean },
|
|
635
|
-
) => {
|
|
636
|
-
dispatch({ type: "SET_BROKER_ACCOUNTS", instanceId, accounts: result.brokerAccounts });
|
|
637
|
-
|
|
638
|
-
if (result.config !== baseConfig) {
|
|
639
|
-
dispatch({ type: "SET_CONFIG", config: result.config });
|
|
640
|
-
await saveConfigImmediately(result.config);
|
|
641
|
-
pluginRegistry.events.emit("config:changed", { config: result.config });
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
for (const ticker of result.addedTickers) {
|
|
645
|
-
pluginRegistry.events.emit("ticker:added", { symbol: ticker.metadata.ticker, ticker });
|
|
646
|
-
}
|
|
647
|
-
for (const ticker of [...result.addedTickers, ...result.updatedTickers]) {
|
|
648
|
-
dispatch({ type: "UPDATE_TICKER", ticker: { ...ticker } });
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
for (const position of result.positions) {
|
|
652
|
-
// Skip Yahoo Finance for broker option symbols; position marks are already available.
|
|
653
|
-
// Position data (markPrice, marketValue, unrealizedPnl) is used directly.
|
|
654
|
-
if (options?.refreshImportedTickers !== false && position.assetCategory !== "OPT") {
|
|
655
|
-
refreshQuote(position.ticker, position.exchange, undefined, 1);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
}, [dispatch, pluginRegistry.events, refreshQuote]);
|
|
659
|
-
|
|
660
|
-
// Import positions from a single broker instance
|
|
661
|
-
const importBrokerPositions = useCallback(async (
|
|
662
|
-
instanceId: string,
|
|
663
|
-
tickerMap?: Map<string, TickerRecord>,
|
|
664
|
-
options?: { refreshImportedTickers?: boolean; config?: AppConfig },
|
|
665
|
-
) => {
|
|
666
|
-
const baseConfig = options?.config ?? stateRef.current.config;
|
|
667
|
-
const result = await syncBrokerInstance({
|
|
668
|
-
config: baseConfig,
|
|
669
|
-
instanceId,
|
|
670
|
-
brokers: pluginRegistry.brokers,
|
|
671
|
-
tickerRepository,
|
|
672
|
-
existingTickers: tickerMap ?? new Map(stateRef.current.tickers),
|
|
673
|
-
resources: pluginRegistry.persistence.resources,
|
|
674
|
-
});
|
|
675
|
-
|
|
676
|
-
await applyBrokerImportResult(instanceId, result, baseConfig, options);
|
|
677
|
-
|
|
678
|
-
return result;
|
|
679
|
-
}, [applyBrokerImportResult, pluginRegistry.brokers, pluginRegistry.persistence.resources, stateRef, tickerRepository]);
|
|
680
|
-
|
|
681
|
-
// Auto-import positions from all configured broker instances
|
|
682
|
-
const autoImportBrokerPositions = useCallback(async (tickerMap: Map<string, TickerRecord>) => {
|
|
683
|
-
const restoredConfig = restoreBrokerPortfoliosFromTickerPositions(stateRef.current.config, tickerMap.values());
|
|
684
|
-
if (restoredConfig !== stateRef.current.config) {
|
|
685
|
-
dispatch({ type: "SET_CONFIG", config: restoredConfig });
|
|
686
|
-
await saveConfigImmediately(restoredConfig);
|
|
687
|
-
pluginRegistry.events.emit("config:changed", { config: restoredConfig });
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
await syncBrokerInstances({
|
|
691
|
-
config: restoredConfig,
|
|
692
|
-
brokers: pluginRegistry.brokers,
|
|
693
|
-
tickerRepository,
|
|
694
|
-
existingTickers: tickerMap,
|
|
695
|
-
resources: pluginRegistry.persistence.resources,
|
|
696
|
-
onResult: async (result, instance, previousConfig) => {
|
|
697
|
-
await applyBrokerImportResult(instance.id, result, previousConfig, {
|
|
698
|
-
refreshImportedTickers: false,
|
|
699
|
-
});
|
|
700
|
-
},
|
|
701
|
-
});
|
|
702
|
-
}, [applyBrokerImportResult, dispatch, pluginRegistry.brokers, pluginRegistry.events, pluginRegistry.persistence.resources, stateRef, tickerRepository]);
|
|
703
|
-
|
|
704
|
-
const startUpdate = useCallback((release: ReleaseInfo) => {
|
|
705
|
-
dispatch({ type: "SET_UPDATE_PROGRESS", progress: { phase: "downloading", percent: 0 } });
|
|
706
|
-
void performUpdate(release, (progress) => {
|
|
707
|
-
dispatch({ type: "SET_UPDATE_PROGRESS", progress });
|
|
708
|
-
});
|
|
709
|
-
}, [dispatch]);
|
|
710
|
-
|
|
711
|
-
const runUpdateCheck = useCallback(async (manual = false) => {
|
|
712
|
-
if (manual) {
|
|
713
|
-
dispatch({ type: "SET_UPDATE_CHECK_IN_PROGRESS", checking: true });
|
|
714
|
-
dispatch({ type: "SET_UPDATE_NOTICE", notice: null });
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
const result = await checkForUpdateDetailed(VERSION);
|
|
718
|
-
|
|
719
|
-
if (!manual) {
|
|
720
|
-
if (result.kind === "available") {
|
|
721
|
-
dispatch({ type: "SET_UPDATE_AVAILABLE", release: result.release });
|
|
722
|
-
}
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
dispatch({ type: "SET_UPDATE_CHECK_IN_PROGRESS", checking: false });
|
|
727
|
-
|
|
728
|
-
if (result.kind === "available") {
|
|
729
|
-
dispatch({ type: "SET_UPDATE_AVAILABLE", release: result.release });
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
if (result.kind === "current") {
|
|
734
|
-
dispatch({ type: "SET_UPDATE_AVAILABLE", release: null });
|
|
735
|
-
dispatch({ type: "SET_UPDATE_NOTICE", notice: `Already on v${VERSION}` });
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
if (result.kind === "disabled") {
|
|
740
|
-
dispatch({ type: "SET_UPDATE_NOTICE", notice: "Update checks are unavailable in source mode" });
|
|
741
|
-
return;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
dispatch({ type: "SET_UPDATE_NOTICE", notice: `Update check failed: ${result.error}` });
|
|
745
|
-
}, [dispatch]);
|
|
176
|
+
const { importBrokerPositions, autoImportBrokerPositions } = useBrokerImportRuntime({
|
|
177
|
+
dispatch,
|
|
178
|
+
pluginRegistry,
|
|
179
|
+
refreshQuote,
|
|
180
|
+
stateRef,
|
|
181
|
+
tickerRepository,
|
|
182
|
+
});
|
|
746
183
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
184
|
+
const { runUpdateCheck, startUpdate } = useAppUpdateRuntime({
|
|
185
|
+
dispatch,
|
|
186
|
+
isDetachedWindow,
|
|
187
|
+
updateAvailable: state.updateAvailable,
|
|
188
|
+
updateCheckInProgress: state.updateCheckInProgress,
|
|
189
|
+
updateProgress: state.updateProgress,
|
|
190
|
+
});
|
|
752
191
|
|
|
753
|
-
|
|
754
|
-
if (desktopWindowBridge?.kind !== "main" || !desktopApplicationMenuBridge) return;
|
|
755
|
-
return desktopApplicationMenuBridge.subscribe((command) => {
|
|
756
|
-
switch (command.type) {
|
|
757
|
-
case "open-command-bar":
|
|
758
|
-
dispatch({ type: "SET_COMMAND_BAR", open: true, query: command.query });
|
|
759
|
-
break;
|
|
760
|
-
case "open-plugin-workflow":
|
|
761
|
-
pluginRegistry.openPluginCommandWorkflowFn(command.commandId);
|
|
762
|
-
break;
|
|
763
|
-
case "open-url":
|
|
764
|
-
void rendererHost.openExternal(command.url).catch((error) => {
|
|
765
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
766
|
-
pluginRegistry.notify({ body: `Failed to open link: ${message}`, type: "error" });
|
|
767
|
-
});
|
|
768
|
-
break;
|
|
769
|
-
case "check-for-updates":
|
|
770
|
-
void runUpdateCheck(true);
|
|
771
|
-
break;
|
|
772
|
-
case "toggle-status-bar":
|
|
773
|
-
dispatch({ type: "TOGGLE_STATUS_BAR" });
|
|
774
|
-
break;
|
|
775
|
-
case "layout-undo":
|
|
776
|
-
dispatch({ type: "UNDO_LAYOUT" });
|
|
777
|
-
break;
|
|
778
|
-
case "layout-redo":
|
|
779
|
-
dispatch({ type: "REDO_LAYOUT" });
|
|
780
|
-
break;
|
|
781
|
-
case "layout-gridlock": {
|
|
782
|
-
const { width, height } = pluginRegistry.getTermSizeFn();
|
|
783
|
-
pluginRegistry.updateLayoutFn(gridlockAllPanes(stateRef.current.config.layout, { x: 0, y: 0, width, height }));
|
|
784
|
-
notifyGridlockComplete(pluginRegistry.notify.bind(pluginRegistry), () => {
|
|
785
|
-
dispatch({ type: "UNDO_LAYOUT" });
|
|
786
|
-
});
|
|
787
|
-
break;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
});
|
|
791
|
-
}, [
|
|
192
|
+
useDesktopApplicationMenuRuntime({
|
|
792
193
|
desktopApplicationMenuBridge,
|
|
793
|
-
desktopWindowBridge?.kind,
|
|
194
|
+
desktopWindowKind: desktopWindowBridge?.kind,
|
|
794
195
|
dispatch,
|
|
795
196
|
pluginRegistry,
|
|
796
197
|
rendererHost,
|
|
797
198
|
runUpdateCheck,
|
|
798
199
|
stateRef,
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
useEffect(() => {
|
|
802
|
-
if (isDetachedWindow) return;
|
|
803
|
-
if (!state.updateAvailable || state.updateProgress || state.updateCheckInProgress) return;
|
|
804
|
-
if (!canSelfUpdate(state.updateAvailable)) return;
|
|
805
|
-
startUpdate(state.updateAvailable);
|
|
806
|
-
}, [isDetachedWindow, startUpdate, state.updateAvailable, state.updateCheckInProgress, state.updateProgress]);
|
|
807
|
-
|
|
808
|
-
// Load tickers on mount
|
|
809
|
-
useEffect(() => {
|
|
810
|
-
if (state.initialized || (globalThis as any).__gloomInitStarted) return;
|
|
811
|
-
(globalThis as any).__gloomInitStarted = true;
|
|
812
|
-
(async () => {
|
|
813
|
-
try {
|
|
814
|
-
let persistedBrokerAccounts: Record<string, BrokerAccount[]> = {};
|
|
815
|
-
try {
|
|
816
|
-
persistedBrokerAccounts = loadPersistedBrokerAccountMap(
|
|
817
|
-
pluginRegistry.persistence.resources,
|
|
818
|
-
state.config.brokerInstances,
|
|
819
|
-
pluginRegistry.brokers,
|
|
820
|
-
);
|
|
821
|
-
} catch {}
|
|
822
|
-
await measurePerfAsync("startup.app.initialize-state", () => initializeAppState({
|
|
823
|
-
config: state.config,
|
|
824
|
-
tickerRepository,
|
|
825
|
-
dataProvider,
|
|
826
|
-
sessionSnapshot,
|
|
827
|
-
dispatch,
|
|
828
|
-
primeCachedFinancials,
|
|
829
|
-
refreshTicker,
|
|
830
|
-
refreshQuote,
|
|
831
|
-
refreshTickersBatch,
|
|
832
|
-
refreshQuotesBatch,
|
|
833
|
-
autoImportBrokerPositions,
|
|
834
|
-
persistedBrokerAccounts,
|
|
835
|
-
}), {
|
|
836
|
-
brokerInstanceCount: state.config.brokerInstances.length,
|
|
837
|
-
layoutPaneCount: state.config.layout.instances.length,
|
|
838
|
-
sessionHydrationTargetCount: sessionSnapshot?.hydrationTargets.length ?? 0,
|
|
839
|
-
});
|
|
840
|
-
} catch (err) {
|
|
841
|
-
// Will show empty state
|
|
842
|
-
}
|
|
843
|
-
})();
|
|
844
|
-
}, [autoImportBrokerPositions, dataProvider, dispatch, primeCachedFinancials, tickerRepository, refreshQuote, refreshQuotesBatch, refreshTicker, refreshTickersBatch, sessionSnapshot, state.config, state.initialized]);
|
|
200
|
+
});
|
|
845
201
|
|
|
846
202
|
const focusedTickerSymbol = getFocusedTickerSymbol(state);
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
if (!ticker) return;
|
|
852
|
-
appLog.info("focused ticker prefetch scheduled", {
|
|
853
|
-
symbol: ticker.metadata.ticker,
|
|
854
|
-
exchange: ticker.metadata.exchange,
|
|
855
|
-
});
|
|
856
|
-
marketData.prefetchTicker(instrumentFromTicker(ticker, ticker.metadata.ticker));
|
|
857
|
-
}, [focusedTickerSymbol, marketData, state.tickers]);
|
|
858
|
-
|
|
859
|
-
// Wire up plugin registry data accessors
|
|
860
|
-
pluginRegistry.getTickerFn = (symbol) => state.tickers.get(symbol) ?? null;
|
|
861
|
-
pluginRegistry.getDataFn = (symbol) => {
|
|
862
|
-
const ticker = state.tickers.get(symbol) ?? null;
|
|
863
|
-
const instrument = instrumentFromTicker(ticker, symbol);
|
|
864
|
-
return instrument ? marketData.getTickerFinancialsSync(instrument) : null;
|
|
865
|
-
};
|
|
866
|
-
pluginRegistry.getConfigFn = () => state.config;
|
|
867
|
-
pluginRegistry.getPaneRuntimeStateFn = (paneId) => state.paneState[paneId] ?? null;
|
|
868
|
-
pluginRegistry.updatePaneRuntimeStateFn = (paneId, patch) => {
|
|
869
|
-
dispatch({ type: "UPDATE_PANE_STATE", paneId, patch });
|
|
870
|
-
};
|
|
871
|
-
pluginRegistry.getPluginConfigValueFn = (pluginId, key) => (
|
|
872
|
-
(state.config.pluginConfig[pluginId]?.[key] as any) ?? null
|
|
873
|
-
);
|
|
874
|
-
const setPluginConfigValues = async (pluginId: string, values: Record<string, unknown>) => {
|
|
875
|
-
const nextConfig = {
|
|
876
|
-
...state.config,
|
|
877
|
-
pluginConfig: {
|
|
878
|
-
...state.config.pluginConfig,
|
|
879
|
-
[pluginId]: {
|
|
880
|
-
...(state.config.pluginConfig[pluginId] ?? {}),
|
|
881
|
-
...values,
|
|
882
|
-
},
|
|
883
|
-
},
|
|
884
|
-
};
|
|
885
|
-
dispatch({ type: "SET_CONFIG", config: nextConfig });
|
|
886
|
-
await saveConfigImmediately(nextConfig);
|
|
887
|
-
pluginRegistry.events.emit("config:changed", { config: nextConfig });
|
|
888
|
-
};
|
|
889
|
-
pluginRegistry.setPluginConfigValueFn = async (pluginId, key, value) => {
|
|
890
|
-
await setPluginConfigValues(pluginId, { [key]: value });
|
|
891
|
-
};
|
|
892
|
-
pluginRegistry.setPluginConfigValuesFn = setPluginConfigValues;
|
|
893
|
-
pluginRegistry.deletePluginConfigValueFn = async (pluginId, key) => {
|
|
894
|
-
const currentPluginConfig = state.config.pluginConfig[pluginId];
|
|
895
|
-
if (!currentPluginConfig || !(key in currentPluginConfig)) return;
|
|
896
|
-
|
|
897
|
-
const nextPluginConfig = { ...currentPluginConfig };
|
|
898
|
-
delete nextPluginConfig[key];
|
|
899
|
-
|
|
900
|
-
const nextAllPluginConfig = { ...state.config.pluginConfig };
|
|
901
|
-
if (Object.keys(nextPluginConfig).length === 0) {
|
|
902
|
-
delete nextAllPluginConfig[pluginId];
|
|
903
|
-
} else {
|
|
904
|
-
nextAllPluginConfig[pluginId] = nextPluginConfig;
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
const nextConfig = {
|
|
908
|
-
...state.config,
|
|
909
|
-
pluginConfig: nextAllPluginConfig,
|
|
910
|
-
};
|
|
911
|
-
dispatch({ type: "SET_CONFIG", config: nextConfig });
|
|
912
|
-
await saveConfigImmediately(nextConfig);
|
|
913
|
-
pluginRegistry.events.emit("config:changed", { config: nextConfig });
|
|
914
|
-
};
|
|
915
|
-
const configurableProvider = dataProvider as DataProvider & {
|
|
916
|
-
setConfigAccessor?: (accessor: () => AppConfig) => void;
|
|
917
|
-
};
|
|
918
|
-
if (typeof configurableProvider.setConfigAccessor === "function") {
|
|
919
|
-
configurableProvider.setConfigAccessor(() => state.config);
|
|
920
|
-
}
|
|
921
|
-
pluginRegistry.createBrokerInstanceFn = async (brokerType, label, values) => {
|
|
922
|
-
const instanceId = createBrokerInstanceId(
|
|
923
|
-
brokerType,
|
|
924
|
-
label,
|
|
925
|
-
state.config.brokerInstances.map((instance) => instance.id),
|
|
926
|
-
);
|
|
927
|
-
const instance: BrokerInstanceConfig = {
|
|
928
|
-
id: instanceId,
|
|
929
|
-
brokerType,
|
|
930
|
-
label,
|
|
931
|
-
connectionMode: typeof values.connectionMode === "string" ? values.connectionMode : undefined,
|
|
932
|
-
config: values,
|
|
933
|
-
enabled: true,
|
|
934
|
-
};
|
|
935
|
-
const nextConfig = {
|
|
936
|
-
...state.config,
|
|
937
|
-
brokerInstances: [...state.config.brokerInstances, instance],
|
|
938
|
-
};
|
|
939
|
-
dispatch({ type: "SET_CONFIG", config: nextConfig });
|
|
940
|
-
await saveConfigImmediately(nextConfig);
|
|
941
|
-
pluginRegistry.events.emit("config:changed", { config: nextConfig });
|
|
942
|
-
return instance;
|
|
943
|
-
};
|
|
944
|
-
pluginRegistry.connectBrokerInstanceFn = async (instanceId) => {
|
|
945
|
-
const instance = getBrokerInstance(state.config.brokerInstances, instanceId);
|
|
946
|
-
if (!instance) throw new Error("Broker profile not found.");
|
|
947
|
-
if (instance.enabled === false) throw new Error(`Broker profile "${instance.label}" is disabled.`);
|
|
948
|
-
|
|
949
|
-
const broker = pluginRegistry.brokers.get(instance.brokerType);
|
|
950
|
-
if (!broker) throw new Error(`Broker "${instance.brokerType}" is not available.`);
|
|
951
|
-
|
|
952
|
-
const valid = await broker.validate(instance).catch(() => false);
|
|
953
|
-
if (!valid) throw new Error(`${broker.name} setup is incomplete.`);
|
|
954
|
-
|
|
955
|
-
await broker.connect?.(instance);
|
|
956
|
-
if (broker.listAccounts) {
|
|
957
|
-
const accounts = await broker.listAccounts(instance);
|
|
958
|
-
dispatch({ type: "SET_BROKER_ACCOUNTS", instanceId, accounts });
|
|
959
|
-
}
|
|
960
|
-
};
|
|
961
|
-
pluginRegistry.updateBrokerInstanceFn = async (instanceId, values, options = {}) => {
|
|
962
|
-
const currentInstance = state.config.brokerInstances.find((instance) => instance.id === instanceId);
|
|
963
|
-
const nextInstances = state.config.brokerInstances.map((instance) =>
|
|
964
|
-
instance.id === instanceId
|
|
965
|
-
? (() => {
|
|
966
|
-
const nextValues = options.replaceConfig ? values : { ...instance.config, ...values };
|
|
967
|
-
return {
|
|
968
|
-
...instance,
|
|
969
|
-
label: options.label ?? instance.label,
|
|
970
|
-
enabled: options.enabled ?? instance.enabled,
|
|
971
|
-
connectionMode: typeof nextValues.connectionMode === "string" ? nextValues.connectionMode : instance.connectionMode,
|
|
972
|
-
config: nextValues,
|
|
973
|
-
};
|
|
974
|
-
})()
|
|
975
|
-
: instance,
|
|
976
|
-
);
|
|
977
|
-
const nextInstance = nextInstances.find((instance) => instance.id === instanceId);
|
|
978
|
-
const broker = currentInstance ? pluginRegistry.brokers.get(currentInstance.brokerType) : null;
|
|
979
|
-
const shouldClearBrokerAccounts = currentInstance
|
|
980
|
-
&& nextInstance
|
|
981
|
-
&& currentInstance.brokerType === nextInstance.brokerType
|
|
982
|
-
&& getBrokerAccountCacheSourceKey(currentInstance, broker) !== getBrokerAccountCacheSourceKey(nextInstance, broker);
|
|
983
|
-
if (shouldClearBrokerAccounts) {
|
|
984
|
-
clearPersistedBrokerAccounts(pluginRegistry.persistence.resources, currentInstance);
|
|
985
|
-
}
|
|
986
|
-
const nextConfig = {
|
|
987
|
-
...state.config,
|
|
988
|
-
brokerInstances: nextInstances,
|
|
989
|
-
};
|
|
990
|
-
dispatch({ type: "SET_CONFIG", config: nextConfig });
|
|
991
|
-
await saveConfigImmediately(nextConfig);
|
|
992
|
-
pluginRegistry.events.emit("config:changed", { config: nextConfig });
|
|
993
|
-
};
|
|
994
|
-
pluginRegistry.syncBrokerInstanceFn = async (instanceId) => {
|
|
995
|
-
await importBrokerPositions(instanceId);
|
|
996
|
-
};
|
|
997
|
-
pluginRegistry.removeBrokerInstanceFn = async (instanceId) => {
|
|
998
|
-
const instance = getBrokerInstance(state.config.brokerInstances, instanceId);
|
|
999
|
-
if (!instance) return;
|
|
1000
|
-
|
|
1001
|
-
clearPersistedBrokerAccounts(pluginRegistry.persistence.resources, instance);
|
|
1002
|
-
|
|
1003
|
-
const broker = pluginRegistry.brokers.get(instance.brokerType);
|
|
1004
|
-
await broker?.disconnect?.(instance).catch(() => {});
|
|
1005
|
-
|
|
1006
|
-
const removedPortfolioIds = new Set(
|
|
1007
|
-
state.config.portfolios
|
|
1008
|
-
.filter((portfolio) => portfolio.brokerInstanceId === instanceId)
|
|
1009
|
-
.map((portfolio) => portfolio.id),
|
|
1010
|
-
);
|
|
1011
|
-
|
|
1012
|
-
const nextPortfolios = state.config.portfolios.filter((portfolio) => !removedPortfolioIds.has(portfolio.id));
|
|
1013
|
-
const nextTickers = new Map(state.tickers);
|
|
1014
|
-
|
|
1015
|
-
for (const ticker of state.tickers.values()) {
|
|
1016
|
-
const nextPositions = ticker.metadata.positions.filter((position) => position.brokerInstanceId !== instanceId);
|
|
1017
|
-
const nextPortfolioRefs = ticker.metadata.portfolios.filter((portfolioId) => !removedPortfolioIds.has(portfolioId));
|
|
1018
|
-
const nextBrokerContracts = (ticker.metadata.broker_contracts ?? []).filter((contract) => contract.brokerInstanceId !== instanceId);
|
|
1019
|
-
|
|
1020
|
-
const nextTicker: TickerRecord = {
|
|
1021
|
-
...ticker,
|
|
1022
|
-
metadata: {
|
|
1023
|
-
...ticker.metadata,
|
|
1024
|
-
positions: nextPositions,
|
|
1025
|
-
portfolios: nextPortfolioRefs,
|
|
1026
|
-
broker_contracts: nextBrokerContracts,
|
|
1027
|
-
},
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
const shouldDeleteTicker =
|
|
1031
|
-
nextPositions.length === 0
|
|
1032
|
-
&& nextPortfolioRefs.length === 0
|
|
1033
|
-
&& nextTicker.metadata.watchlists.length === 0
|
|
1034
|
-
&& nextBrokerContracts.length === 0
|
|
1035
|
-
&& nextTicker.metadata.tags.length === 0
|
|
1036
|
-
&& Object.keys(nextTicker.metadata.custom).length === 0;
|
|
1037
|
-
|
|
1038
|
-
if (shouldDeleteTicker) {
|
|
1039
|
-
nextTickers.delete(ticker.metadata.ticker);
|
|
1040
|
-
await tickerRepository.deleteTicker(ticker.metadata.ticker);
|
|
1041
|
-
dispatch({ type: "REMOVE_TICKER", symbol: ticker.metadata.ticker });
|
|
1042
|
-
pluginRegistry.events.emit("ticker:removed", { symbol: ticker.metadata.ticker });
|
|
1043
|
-
} else {
|
|
1044
|
-
await tickerRepository.saveTicker(nextTicker);
|
|
1045
|
-
nextTickers.set(nextTicker.metadata.ticker, nextTicker);
|
|
1046
|
-
dispatch({ type: "UPDATE_TICKER", ticker: nextTicker });
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
const nextConfig = {
|
|
1051
|
-
...state.config,
|
|
1052
|
-
brokerInstances: state.config.brokerInstances.filter((entry) => entry.id !== instanceId),
|
|
1053
|
-
portfolios: nextPortfolios,
|
|
1054
|
-
};
|
|
1055
|
-
|
|
1056
|
-
dispatch({ type: "SET_CONFIG", config: nextConfig });
|
|
1057
|
-
dispatch({ type: "SET_TICKERS", tickers: nextTickers });
|
|
1058
|
-
await saveConfigImmediately(nextConfig);
|
|
1059
|
-
pluginRegistry.events.emit("config:changed", { config: nextConfig });
|
|
1060
|
-
};
|
|
1061
|
-
|
|
1062
|
-
// Wire up navigation functions
|
|
1063
|
-
pluginRegistry.selectTickerFn = (symbol, paneId) => selectTickerInPane(symbol, paneId);
|
|
1064
|
-
pluginRegistry.switchPanelFn = (panel) => {
|
|
1065
|
-
if (isDetachedWindow) return;
|
|
1066
|
-
dispatch({ type: "SET_ACTIVE_PANEL", panel });
|
|
1067
|
-
};
|
|
1068
|
-
pluginRegistry.switchTabFn = (tabId, paneId) => switchDetailTab(tabId, paneId);
|
|
1069
|
-
pluginRegistry.openCommandBarFn = (query) => {
|
|
1070
|
-
if (isDetachedWindow) return;
|
|
1071
|
-
dispatch({ type: "SET_COMMAND_BAR", open: true, query });
|
|
1072
|
-
};
|
|
1073
|
-
pluginRegistry.openPluginCommandWorkflowFn = (commandId) => {
|
|
1074
|
-
if (isDetachedWindow) return;
|
|
1075
|
-
dispatch({
|
|
1076
|
-
type: "SET_COMMAND_BAR",
|
|
1077
|
-
open: true,
|
|
1078
|
-
query: "",
|
|
1079
|
-
launch: { kind: "plugin-command", commandId },
|
|
1080
|
-
});
|
|
1081
|
-
};
|
|
1082
|
-
const persistLayout = (layout: LayoutConfig, options?: { pushHistory?: boolean }) => {
|
|
1083
|
-
const currentState = stateRef.current;
|
|
1084
|
-
const normalizedLayout = normalizePaneLayout(layout);
|
|
1085
|
-
if (options?.pushHistory !== false) {
|
|
1086
|
-
dispatch({ type: "PUSH_LAYOUT_HISTORY" });
|
|
1087
|
-
}
|
|
1088
|
-
dispatch({ type: "UPDATE_LAYOUT", layout: normalizedLayout });
|
|
1089
|
-
scheduleConfigSave(syncConfigActiveLayoutState(
|
|
1090
|
-
{ ...currentState.config, layout: normalizedLayout },
|
|
1091
|
-
currentState.paneState,
|
|
1092
|
-
currentState.focusedPaneId,
|
|
1093
|
-
currentState.activePanel,
|
|
1094
|
-
));
|
|
1095
|
-
};
|
|
1096
|
-
const resolvePanelForPane = useCallback((paneId: string, layout: LayoutConfig = state.config.layout): "left" | "right" => {
|
|
1097
|
-
const instanceId = resolvePaneTarget(paneId, layout);
|
|
1098
|
-
if (!instanceId) return "right";
|
|
1099
|
-
const instance = findPaneInstance(layout, instanceId);
|
|
1100
|
-
const paneDef = instance ? pluginRegistry.panes.get(instance.paneId) : pluginRegistry.panes.get(paneId);
|
|
1101
|
-
const floating = layout.floating.find((entry) => entry.instanceId === instanceId);
|
|
1102
|
-
if (floating) {
|
|
1103
|
-
return paneDef?.defaultPosition ?? "right";
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
const rect = getLeafRect(layout, instanceId, PANEL_RESOLUTION_BOUNDS);
|
|
1107
|
-
if (!rect) {
|
|
1108
|
-
return paneDef?.defaultPosition ?? "right";
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
const midpoint = PANEL_RESOLUTION_BOUNDS.width / 2;
|
|
1112
|
-
return rect.x + (rect.width / 2) <= midpoint ? "left" : "right";
|
|
1113
|
-
}, [pluginRegistry.panes, resolvePaneTarget, state.config.layout]);
|
|
1114
|
-
const activatePane = useCallback((paneId: string, layout: LayoutConfig = state.config.layout) => {
|
|
1115
|
-
dispatch({ type: "SET_ACTIVE_PANEL", panel: resolvePanelForPane(paneId, layout) });
|
|
1116
|
-
dispatch({ type: "FOCUS_PANE", paneId });
|
|
1117
|
-
}, [dispatch, resolvePanelForPane, state.config.layout]);
|
|
1118
|
-
const focusVisiblePane = (paneId: string, layout: LayoutConfig = state.config.layout) => {
|
|
1119
|
-
const nextLayout = layout.floating.some((entry) => entry.instanceId === paneId)
|
|
1120
|
-
? bringToFront(layout, paneId)
|
|
1121
|
-
: layout;
|
|
1122
|
-
|
|
1123
|
-
if (nextLayout !== state.config.layout) {
|
|
1124
|
-
persistLayout(nextLayout, { pushHistory: false });
|
|
1125
|
-
}
|
|
1126
|
-
activatePane(paneId, nextLayout);
|
|
1127
|
-
};
|
|
1128
|
-
const placePaneInstance = useCallback((
|
|
1129
|
-
instance: PaneInstanceConfig,
|
|
1130
|
-
paneDef: NonNullable<ReturnType<typeof pluginRegistry.panes.get>>,
|
|
1131
|
-
options?: PaneTemplateInstanceConfig,
|
|
1132
|
-
) => {
|
|
1133
|
-
const { width, height } = pluginRegistry.getTermSizeFn();
|
|
1134
|
-
const relativeTo = options?.relativeToPaneId
|
|
1135
|
-
? resolvePaneTarget(options.relativeToPaneId)
|
|
1136
|
-
: (state.focusedPaneId && isPaneInLayout(state.config.layout, state.focusedPaneId) ? state.focusedPaneId : null);
|
|
1137
|
-
const relativePosition = options?.relativePosition ?? "right";
|
|
1138
|
-
let nextLayout = state.config.layout;
|
|
1139
|
-
const selectEdgeAnchor = (edge: "left" | "right") => {
|
|
1140
|
-
const leaves = getDockLeafLayouts(nextLayout, PANEL_RESOLUTION_BOUNDS);
|
|
1141
|
-
if (leaves.length === 0) return null;
|
|
1142
|
-
const edgeCoordinate = edge === "left"
|
|
1143
|
-
? Math.min(...leaves.map((leaf) => leaf.rect.x))
|
|
1144
|
-
: Math.max(...leaves.map((leaf) => leaf.rect.x + leaf.rect.width));
|
|
1145
|
-
return [...leaves]
|
|
1146
|
-
.filter((leaf) => (
|
|
1147
|
-
edge === "left"
|
|
1148
|
-
? leaf.rect.x === edgeCoordinate
|
|
1149
|
-
: leaf.rect.x + leaf.rect.width === edgeCoordinate
|
|
1150
|
-
))
|
|
1151
|
-
.sort((a, b) => (b.rect.y + b.rect.height) - (a.rect.y + a.rect.height))
|
|
1152
|
-
[0]?.instanceId ?? null;
|
|
1153
|
-
};
|
|
1154
|
-
const dockedPaneIds = getDockedPaneIds(nextLayout);
|
|
1155
|
-
|
|
1156
|
-
if (options?.placement === "floating" || (options?.placement !== "docked" && paneDef.defaultMode === "floating")) {
|
|
1157
|
-
nextLayout = addPaneFloating(nextLayout, instance, width, height, paneDef);
|
|
1158
|
-
} else if (relativeTo && findDockLeaf(nextLayout, relativeTo)) {
|
|
1159
|
-
nextLayout = addPaneToLayout(nextLayout, instance, { relativeTo, position: relativePosition });
|
|
1160
|
-
} else if (dockedPaneIds.length === 0) {
|
|
1161
|
-
nextLayout = addPaneToLayout(nextLayout, instance, { relativeTo: instance.instanceId, position: "right" });
|
|
1162
|
-
} else if (paneDef.defaultPosition === "left") {
|
|
1163
|
-
const leftAnchor = selectEdgeAnchor("left");
|
|
1164
|
-
nextLayout = leftAnchor
|
|
1165
|
-
? addPaneToLayout(nextLayout, instance, { relativeTo: leftAnchor, position: "below" })
|
|
1166
|
-
: addPaneToLayout(nextLayout, instance, { relativeTo: dockedPaneIds[0]!, position: "left" });
|
|
1167
|
-
} else {
|
|
1168
|
-
const rightAnchor = selectEdgeAnchor("right");
|
|
1169
|
-
nextLayout = rightAnchor
|
|
1170
|
-
? addPaneToLayout(nextLayout, instance, { relativeTo: rightAnchor, position: "below" })
|
|
1171
|
-
: addPaneToLayout(nextLayout, instance, { relativeTo: dockedPaneIds[dockedPaneIds.length - 1]!, position: "right" });
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
persistLayout(nextLayout);
|
|
1175
|
-
activatePane(instance.instanceId, nextLayout);
|
|
1176
|
-
}, [
|
|
1177
|
-
activatePane,
|
|
203
|
+
useAppStartupRuntime({
|
|
204
|
+
appActive,
|
|
205
|
+
autoImportBrokerPositions,
|
|
206
|
+
dataProvider,
|
|
1178
207
|
dispatch,
|
|
208
|
+
focusedTickerSymbol,
|
|
209
|
+
marketData,
|
|
1179
210
|
pluginRegistry,
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
if (paneId === "ticker-detail") {
|
|
1190
|
-
const sourcePaneId = resolveCollectionSourcePaneId();
|
|
1191
|
-
if (!sourcePaneId) {
|
|
1192
|
-
notify("Open a collection pane first to inspect a ticker.");
|
|
1193
|
-
return;
|
|
1194
|
-
}
|
|
1195
|
-
const ensured = ensureInspectorPane(sourcePaneId);
|
|
1196
|
-
if (!ensured) return;
|
|
1197
|
-
if (ensured.layout !== state.config.layout) {
|
|
1198
|
-
persistLayout(ensured.layout);
|
|
1199
|
-
}
|
|
1200
|
-
activatePane(ensured.instance.instanceId, ensured.layout);
|
|
1201
|
-
return;
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
const existingInstanceId = resolvePaneTarget(paneId);
|
|
1205
|
-
if (existingInstanceId && isPaneInLayout(state.config.layout, existingInstanceId)) {
|
|
1206
|
-
pluginRegistry.focusPaneFn(existingInstanceId);
|
|
1207
|
-
return;
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
const instance = existingInstanceId
|
|
1211
|
-
? findPaneInstance(state.config.layout, existingInstanceId)
|
|
1212
|
-
: buildPaneInstance(paneId);
|
|
1213
|
-
if (!instance) {
|
|
1214
|
-
if (isTickerPaneId(paneId)) {
|
|
1215
|
-
notify("Open a ticker or collection context first.");
|
|
1216
|
-
}
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
placePaneInstance(instance, paneDef, { placement: "default" });
|
|
1220
|
-
};
|
|
1221
|
-
const createPaneFromTemplate = useCallback(async (templateId: string, options?: PaneTemplateCreateOptions) => {
|
|
1222
|
-
const template = pluginRegistry.paneTemplates.get(templateId);
|
|
1223
|
-
if (!template) return;
|
|
211
|
+
primeCachedFinancials,
|
|
212
|
+
refreshQuote,
|
|
213
|
+
refreshQuotesBatch,
|
|
214
|
+
refreshTicker,
|
|
215
|
+
refreshTickersBatch,
|
|
216
|
+
sessionSnapshot,
|
|
217
|
+
state,
|
|
218
|
+
tickerRepository,
|
|
219
|
+
});
|
|
1224
220
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
? { ...step, defaultValue: options.arg }
|
|
1235
|
-
: step
|
|
1236
|
-
))
|
|
1237
|
-
: template.wizard;
|
|
1238
|
-
const values = await runPaneTemplateWizard(wizardSteps);
|
|
1239
|
-
if (!values) return;
|
|
1240
|
-
resolvedOptions = {
|
|
1241
|
-
...options,
|
|
1242
|
-
values,
|
|
1243
|
-
arg: template.shortcut?.argPlaceholder ? values[template.shortcut.argPlaceholder] : options?.arg,
|
|
1244
|
-
};
|
|
1245
|
-
}
|
|
221
|
+
bindPluginRegistryRuntimeAccess({
|
|
222
|
+
dataProvider,
|
|
223
|
+
dispatch,
|
|
224
|
+
importBrokerPositions,
|
|
225
|
+
marketData,
|
|
226
|
+
pluginRegistry,
|
|
227
|
+
state,
|
|
228
|
+
tickerRepository,
|
|
229
|
+
});
|
|
1246
230
|
|
|
1247
|
-
|
|
1248
|
-
await createPaneTemplateOrThrow(templateId, resolvedOptions, {
|
|
1249
|
-
dataProvider,
|
|
1250
|
-
tickerRepository,
|
|
1251
|
-
pluginRegistry,
|
|
1252
|
-
dispatch,
|
|
1253
|
-
getState: () => stateRef.current,
|
|
1254
|
-
buildPaneInstance,
|
|
1255
|
-
placePaneInstance,
|
|
1256
|
-
});
|
|
1257
|
-
} catch (error) {
|
|
1258
|
-
notify(
|
|
1259
|
-
error instanceof Error ? error.message : `Could not create ${getPaneTemplateDisplayLabel(template).toLowerCase()}.`,
|
|
1260
|
-
{ type: "info" },
|
|
1261
|
-
);
|
|
1262
|
-
}
|
|
1263
|
-
}, [
|
|
1264
|
-
buildPaneInstance,
|
|
231
|
+
useAppPaneRuntime({
|
|
1265
232
|
dataProvider,
|
|
233
|
+
detachedPaneId,
|
|
234
|
+
dialog,
|
|
1266
235
|
dispatch,
|
|
236
|
+
isDetachedWindow,
|
|
1267
237
|
notify,
|
|
1268
|
-
placePaneInstance,
|
|
1269
238
|
pluginRegistry,
|
|
1270
|
-
|
|
239
|
+
state,
|
|
240
|
+
stateRef,
|
|
1271
241
|
tickerRepository,
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
const openPaneSettings = useCallback(async (paneId?: string) => {
|
|
1275
|
-
const targetPaneId = paneId
|
|
1276
|
-
? resolvePaneTarget(paneId)
|
|
1277
|
-
: stateRef.current.focusedPaneId;
|
|
1278
|
-
if (!targetPaneId || !pluginRegistry.hasPaneSettings(targetPaneId)) return;
|
|
1279
|
-
|
|
1280
|
-
let shouldPushHistory = true;
|
|
1281
|
-
const applyFieldValue = async (targetId: string, field: PaneSettingField, value: unknown) => {
|
|
1282
|
-
await applyPaneSettingFieldValueShared(targetId, field, value, {
|
|
1283
|
-
dataProvider,
|
|
1284
|
-
tickerRepository,
|
|
1285
|
-
pluginRegistry,
|
|
1286
|
-
dispatch,
|
|
1287
|
-
getState: () => stateRef.current,
|
|
1288
|
-
persistLayout,
|
|
1289
|
-
}, { pushHistory: shouldPushHistory });
|
|
1290
|
-
shouldPushHistory = false;
|
|
1291
|
-
};
|
|
1292
|
-
|
|
1293
|
-
await dialog.alert({
|
|
1294
|
-
content: (ctx) => (
|
|
1295
|
-
<PaneSettingsDialogContent
|
|
1296
|
-
{...ctx}
|
|
1297
|
-
paneId={targetPaneId}
|
|
1298
|
-
pluginRegistry={pluginRegistry}
|
|
1299
|
-
applyFieldValue={applyFieldValue}
|
|
1300
|
-
/>
|
|
1301
|
-
),
|
|
1302
|
-
});
|
|
1303
|
-
}, [dataProvider, dialog, dispatch, persistLayout, pluginRegistry, resolvePaneTarget, tickerRepository]);
|
|
1304
|
-
|
|
1305
|
-
pluginRegistry.getLayoutFn = () => state.config.layout;
|
|
1306
|
-
pluginRegistry.updateLayoutFn = (layout) => {
|
|
1307
|
-
if (isDetachedWindow) return;
|
|
1308
|
-
persistLayout(layout);
|
|
1309
|
-
};
|
|
1310
|
-
pluginRegistry.openPaneSettingsFn = (paneId) => { void openPaneSettings(paneId); };
|
|
1311
|
-
pluginRegistry.showPaneFn = (paneId) => {
|
|
1312
|
-
if (isDetachedWindow) return;
|
|
1313
|
-
showPane(paneId);
|
|
1314
|
-
};
|
|
1315
|
-
pluginRegistry.createPaneFromTemplateAsyncFn = async (templateId, options) => {
|
|
1316
|
-
if (isDetachedWindow) return;
|
|
1317
|
-
await createPaneTemplateOrThrow(templateId, options, {
|
|
1318
|
-
dataProvider,
|
|
1319
|
-
tickerRepository,
|
|
1320
|
-
pluginRegistry,
|
|
1321
|
-
dispatch,
|
|
1322
|
-
getState: () => stateRef.current,
|
|
1323
|
-
buildPaneInstance,
|
|
1324
|
-
placePaneInstance,
|
|
1325
|
-
});
|
|
1326
|
-
};
|
|
1327
|
-
pluginRegistry.createPaneFromTemplateFn = (templateId, options) => {
|
|
1328
|
-
if (isDetachedWindow) return;
|
|
1329
|
-
void createPaneFromTemplate(templateId, options);
|
|
1330
|
-
};
|
|
1331
|
-
pluginRegistry.applyPaneSettingValueFn = async (paneId, field, value) => {
|
|
1332
|
-
await applyPaneSettingFieldValueShared(paneId, field, value, {
|
|
1333
|
-
dataProvider,
|
|
1334
|
-
tickerRepository,
|
|
1335
|
-
pluginRegistry,
|
|
1336
|
-
dispatch,
|
|
1337
|
-
getState: () => stateRef.current,
|
|
1338
|
-
persistLayout,
|
|
1339
|
-
});
|
|
1340
|
-
};
|
|
1341
|
-
pluginRegistry.hidePaneFn = (paneId) => {
|
|
1342
|
-
if (isDetachedWindow) return;
|
|
1343
|
-
const instanceId = resolvePaneTarget(paneId);
|
|
1344
|
-
if (!instanceId || !isPaneInLayout(state.config.layout, instanceId)) return;
|
|
1345
|
-
persistLayout(removePane(state.config.layout, instanceId));
|
|
1346
|
-
};
|
|
1347
|
-
pluginRegistry.focusPaneFn = (paneId) => {
|
|
1348
|
-
if (isDetachedWindow) {
|
|
1349
|
-
if (paneId === detachedPaneId) {
|
|
1350
|
-
dispatch({ type: "FOCUS_PANE", paneId });
|
|
1351
|
-
}
|
|
1352
|
-
return;
|
|
1353
|
-
}
|
|
1354
|
-
const instanceId = resolvePaneTarget(paneId);
|
|
1355
|
-
if (!instanceId || !isPaneInLayout(state.config.layout, instanceId)) {
|
|
1356
|
-
showPane(paneId);
|
|
1357
|
-
return;
|
|
1358
|
-
}
|
|
1359
|
-
|
|
1360
|
-
focusVisiblePane(instanceId);
|
|
1361
|
-
};
|
|
1362
|
-
pluginRegistry.pinTickerFn = (symbol, options) => {
|
|
1363
|
-
if (isDetachedWindow) return;
|
|
1364
|
-
const paneType = options?.paneType ?? "ticker-detail";
|
|
1365
|
-
const paneDef = pluginRegistry.panes.get(paneType);
|
|
1366
|
-
if (!paneDef) return;
|
|
1367
|
-
const existing = options?.forceNewPane
|
|
1368
|
-
? null
|
|
1369
|
-
: findFixedTickerPaneForSymbol(state.config.layout, paneType, symbol);
|
|
1370
|
-
if (existing) {
|
|
1371
|
-
focusVisiblePane(existing.instanceId);
|
|
1372
|
-
return;
|
|
1373
|
-
}
|
|
1374
|
-
const instance = buildPaneInstance(paneType, {
|
|
1375
|
-
title: symbol,
|
|
1376
|
-
binding: { kind: "fixed", symbol },
|
|
1377
|
-
});
|
|
1378
|
-
if (!instance) return;
|
|
1379
|
-
const { width, height } = pluginRegistry.getTermSizeFn();
|
|
1380
|
-
const shouldFloat = options?.floating ?? true;
|
|
1381
|
-
const nextLayout = shouldFloat
|
|
1382
|
-
? addPaneFloating(state.config.layout, instance, width, height, paneDef)
|
|
1383
|
-
: addPaneToLayout(
|
|
1384
|
-
state.config.layout,
|
|
1385
|
-
instance,
|
|
1386
|
-
{
|
|
1387
|
-
relativeTo: state.focusedPaneId && isPaneInLayout(state.config.layout, state.focusedPaneId)
|
|
1388
|
-
? state.focusedPaneId
|
|
1389
|
-
: (getDockedPaneIds(state.config.layout).at(-1) ?? instance.instanceId),
|
|
1390
|
-
position: "right",
|
|
1391
|
-
},
|
|
1392
|
-
);
|
|
1393
|
-
persistLayout(nextLayout);
|
|
1394
|
-
activatePane(instance.instanceId, nextLayout);
|
|
1395
|
-
};
|
|
1396
|
-
|
|
1397
|
-
pluginRegistry.navigateTickerFn = (rawSymbol, options) => {
|
|
1398
|
-
if (isDetachedWindow) return;
|
|
1399
|
-
const sourcePaneId = options?.sourcePaneId ?? stateRef.current.focusedPaneId;
|
|
1400
|
-
(async () => {
|
|
1401
|
-
try {
|
|
1402
|
-
// Resolve or create the ticker in the local database
|
|
1403
|
-
const resolved = await resolveTickerSearch({
|
|
1404
|
-
query: rawSymbol,
|
|
1405
|
-
activeTicker: null,
|
|
1406
|
-
tickers: stateRef.current.tickers,
|
|
1407
|
-
dataProvider,
|
|
1408
|
-
});
|
|
1409
|
-
|
|
1410
|
-
let symbol = rawSymbol;
|
|
1411
|
-
if (resolved?.kind === "local") {
|
|
1412
|
-
symbol = resolved.symbol;
|
|
1413
|
-
} else if (resolved?.kind === "provider" && resolved.result) {
|
|
1414
|
-
const { ticker, created } = await upsertTickerFromSearchResult(tickerRepository, resolved.result);
|
|
1415
|
-
symbol = ticker.metadata.ticker;
|
|
1416
|
-
dispatch({ type: "UPDATE_TICKER", ticker });
|
|
1417
|
-
if (created) {
|
|
1418
|
-
pluginRegistry.events.emit("ticker:added", { symbol, ticker });
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
// Only actions that originate from a ticker detail replace that exact pane.
|
|
1423
|
-
// Everything else opens or focuses a fixed ticker detail for the symbol.
|
|
1424
|
-
const currentState = stateRef.current;
|
|
1425
|
-
const currentLayout = currentState.config.layout;
|
|
1426
|
-
const detailPane = resolveTickerNavigationReplacementPane(currentLayout, sourcePaneId);
|
|
1427
|
-
const focusIfStillOwned = (paneId: string, layout: LayoutConfig) => {
|
|
1428
|
-
if (!shouldFocusTickerNavigationTarget({
|
|
1429
|
-
sourcePaneId,
|
|
1430
|
-
currentFocusedPaneId: stateRef.current.focusedPaneId,
|
|
1431
|
-
targetPaneId: paneId,
|
|
1432
|
-
})) {
|
|
1433
|
-
return;
|
|
1434
|
-
}
|
|
1435
|
-
activatePane(paneId, layout);
|
|
1436
|
-
};
|
|
1437
|
-
|
|
1438
|
-
if (detailPane) {
|
|
1439
|
-
const nextLayout = {
|
|
1440
|
-
...currentLayout,
|
|
1441
|
-
instances: currentLayout.instances.map((instance) => (
|
|
1442
|
-
instance.instanceId === detailPane.instanceId
|
|
1443
|
-
? { ...instance, title: symbol, binding: { kind: "fixed" as const, symbol } }
|
|
1444
|
-
: instance
|
|
1445
|
-
)),
|
|
1446
|
-
};
|
|
1447
|
-
persistLayout(nextLayout);
|
|
1448
|
-
focusIfStillOwned(detailPane.instanceId, nextLayout);
|
|
1449
|
-
} else if (shouldFocusTickerNavigationTarget({
|
|
1450
|
-
sourcePaneId,
|
|
1451
|
-
currentFocusedPaneId: stateRef.current.focusedPaneId,
|
|
1452
|
-
targetPaneId: null,
|
|
1453
|
-
})) {
|
|
1454
|
-
pluginRegistry.pinTicker(symbol, { floating: false });
|
|
1455
|
-
}
|
|
1456
|
-
} catch (err) {
|
|
1457
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
1458
|
-
pluginRegistry.notify({ body: `Failed to navigate to ${rawSymbol}: ${message}`, type: "error" });
|
|
1459
|
-
}
|
|
1460
|
-
})();
|
|
1461
|
-
};
|
|
1462
|
-
|
|
1463
|
-
setLayoutManagerDispatch(dispatch, () => ({
|
|
1464
|
-
layout: state.config.layout,
|
|
1465
|
-
termWidth: pluginRegistry.getTermSizeFn().width,
|
|
1466
|
-
termHeight: pluginRegistry.getTermSizeFn().height,
|
|
1467
|
-
focusedPaneId: state.focusedPaneId,
|
|
1468
|
-
}));
|
|
242
|
+
});
|
|
1469
243
|
|
|
1470
244
|
// Wire up app-level notifications.
|
|
1471
245
|
pluginRegistry.notifyFn = appNotifier.notify;
|
|
@@ -1491,110 +265,15 @@ function AppInner({
|
|
|
1491
265
|
}
|
|
1492
266
|
}, [focusedTickerSymbol]);
|
|
1493
267
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
event.stopPropagation();
|
|
1504
|
-
return;
|
|
1505
|
-
}
|
|
1506
|
-
if (isPasteShortcut(event) && pasteSystemClipboard(nativeRenderer)) {
|
|
1507
|
-
event.preventDefault();
|
|
1508
|
-
event.stopPropagation();
|
|
1509
|
-
return;
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
// Skip all global shortcuts when a dialog is open
|
|
1513
|
-
if (dialogOpen) return;
|
|
1514
|
-
|
|
1515
|
-
// Ctrl+P / Cmd+K: toggle command bar (backtick close is handled in command-bar.tsx)
|
|
1516
|
-
if (!isDetachedWindow && (
|
|
1517
|
-
(event.name === "p" && event.ctrl)
|
|
1518
|
-
|| (event.name === "k" && (event.meta || event.super))
|
|
1519
|
-
)) {
|
|
1520
|
-
event.preventDefault();
|
|
1521
|
-
event.stopPropagation();
|
|
1522
|
-
dispatch({ type: "TOGGLE_COMMAND_BAR" });
|
|
1523
|
-
return;
|
|
1524
|
-
}
|
|
1525
|
-
// Backtick opens command bar (close is handled in command-bar.tsx)
|
|
1526
|
-
if (!isDetachedWindow && event.name === "`" && !state.commandBarOpen) {
|
|
1527
|
-
event.preventDefault();
|
|
1528
|
-
event.stopPropagation();
|
|
1529
|
-
dispatch({ type: "SET_COMMAND_BAR", open: true, query: "" });
|
|
1530
|
-
return;
|
|
1531
|
-
}
|
|
1532
|
-
// Ctrl+1-9: switch layouts (works even when input is captured)
|
|
1533
|
-
if (!isDetachedWindow && /^[1-9]$/.test(event.name ?? "") && event.ctrl && (state.config.layouts ?? []).length > 1) {
|
|
1534
|
-
const idx = parseInt(event.name!, 10) - 1;
|
|
1535
|
-
const layouts = state.config.layouts ?? [];
|
|
1536
|
-
if (idx < layouts.length && idx !== state.config.activeLayoutIndex) {
|
|
1537
|
-
dispatch({ type: "SWITCH_LAYOUT", index: idx });
|
|
1538
|
-
}
|
|
1539
|
-
return;
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
// Don't process main shortcuts when overlays are open or input is captured
|
|
1543
|
-
// (panes already get focused=false via shell.tsx)
|
|
1544
|
-
if (state.commandBarOpen || state.inputCaptured) return;
|
|
1545
|
-
|
|
1546
|
-
if (event.name === "tab") {
|
|
1547
|
-
const paneOrder = getVisiblePaneCycleOrder(
|
|
1548
|
-
state.config.layout,
|
|
1549
|
-
pluginRegistry,
|
|
1550
|
-
state.config.disabledPlugins,
|
|
1551
|
-
);
|
|
1552
|
-
if (paneOrder.length === 0) return;
|
|
1553
|
-
|
|
1554
|
-
if (event.shift) {
|
|
1555
|
-
dispatch({ type: "FOCUS_PREV", paneOrder });
|
|
1556
|
-
} else {
|
|
1557
|
-
dispatch({ type: "FOCUS_NEXT", paneOrder });
|
|
1558
|
-
}
|
|
1559
|
-
event.preventDefault();
|
|
1560
|
-
event.stopPropagation();
|
|
1561
|
-
} else if (!isDetachedWindow && event.name === "q" && !(focusedPane?.paneId === "ticker-detail" && focusedDetailTab === "financials")) {
|
|
1562
|
-
rendererHost.requestExit();
|
|
1563
|
-
} else if (event.name === "r") {
|
|
1564
|
-
// Refresh focused ticker context.
|
|
1565
|
-
if (focusedTickerSymbol) {
|
|
1566
|
-
const ticker = state.tickers.get(focusedTickerSymbol);
|
|
1567
|
-
if (ticker) refreshTicker(ticker.metadata.ticker, ticker.metadata.exchange, ticker, 0);
|
|
1568
|
-
}
|
|
1569
|
-
} else if (event.name === "R" || (event.name === "r" && event.shift)) {
|
|
1570
|
-
// Refresh all
|
|
1571
|
-
for (const t of state.tickers.values()) {
|
|
1572
|
-
refreshTicker(t.metadata.ticker, t.metadata.exchange, t, 1);
|
|
1573
|
-
}
|
|
1574
|
-
} else if (!isDetachedWindow && event.name === "a" && focusedTickerSymbol) {
|
|
1575
|
-
// Open ticker actions
|
|
1576
|
-
const actions = [...pluginRegistry.tickerActions.values()];
|
|
1577
|
-
const ticker = state.tickers.get(focusedTickerSymbol);
|
|
1578
|
-
if (actions.length > 0 && ticker) {
|
|
1579
|
-
dispatch({ type: "SET_COMMAND_BAR", open: true, query: "" });
|
|
1580
|
-
}
|
|
1581
|
-
} else if (event.name === "u" && state.updateAvailable && !state.updateProgress && !state.updateCheckInProgress && canSelfUpdate(state.updateAvailable)) {
|
|
1582
|
-
startUpdate(state.updateAvailable);
|
|
1583
|
-
} else {
|
|
1584
|
-
// Plugin keyboard shortcuts (built-ins take priority)
|
|
1585
|
-
const disabledPlugins = new Set(state.config.disabledPlugins || []);
|
|
1586
|
-
for (const shortcut of pluginRegistry.shortcuts.values()) {
|
|
1587
|
-
const ownerId = pluginRegistry.getShortcutPluginId(shortcut.id);
|
|
1588
|
-
if (ownerId && disabledPlugins.has(ownerId)) continue;
|
|
1589
|
-
if (shortcut.key === event.name
|
|
1590
|
-
&& (shortcut.ctrl ?? false) === (event.ctrl ?? false)
|
|
1591
|
-
&& (shortcut.shift ?? false) === (event.shift ?? false)) {
|
|
1592
|
-
shortcut.execute();
|
|
1593
|
-
break;
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
}, { phase: "before" });
|
|
268
|
+
useAppGlobalShortcuts({
|
|
269
|
+
dispatch,
|
|
270
|
+
focusedTickerSymbol,
|
|
271
|
+
isDetachedWindow,
|
|
272
|
+
pluginRegistry,
|
|
273
|
+
refreshTicker,
|
|
274
|
+
startUpdate,
|
|
275
|
+
state,
|
|
276
|
+
});
|
|
1598
277
|
|
|
1599
278
|
if (desktopWindowBridge?.kind === "detached" && desktopWindowBridge.paneId) {
|
|
1600
279
|
return (
|
|
@@ -1618,6 +297,7 @@ function AppInner({
|
|
|
1618
297
|
pluginRegistry={pluginRegistry}
|
|
1619
298
|
desktopWindowBridge={desktopWindowBridge}
|
|
1620
299
|
desktopDockPreview={desktopDockPreview}
|
|
300
|
+
commandBarNativeOccluder={commandBarNativeOccluder}
|
|
1621
301
|
/>
|
|
1622
302
|
<StatusBar />
|
|
1623
303
|
{state.commandBarOpen && (
|
|
@@ -1627,6 +307,7 @@ function AppInner({
|
|
|
1627
307
|
pluginRegistry={pluginRegistry}
|
|
1628
308
|
quitApp={() => rendererHost.requestExit()}
|
|
1629
309
|
onCheckForUpdates={() => runUpdateCheck(true)}
|
|
310
|
+
onNativeOccluderChange={setCommandBarNativeOccluder}
|
|
1630
311
|
/>
|
|
1631
312
|
)}
|
|
1632
313
|
<ToastViewport position="bottom-right" />
|
|
@@ -1656,22 +337,16 @@ export function App({
|
|
|
1656
337
|
}: AppProps) {
|
|
1657
338
|
const renderer = useNativeRenderer();
|
|
1658
339
|
const effectiveInitialConfig = useMemo(() => {
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
...entry,
|
|
1666
|
-
layout: materializeDetachedPanesAsFloating(entry.layout),
|
|
1667
|
-
})),
|
|
1668
|
-
};
|
|
1669
|
-
}, [desktopSnapshot?.config, desktopWindowBridge, initialConfig]);
|
|
340
|
+
return resolveInitialAppConfig({
|
|
341
|
+
initialConfig,
|
|
342
|
+
desktopSnapshot,
|
|
343
|
+
hasDesktopWindowBridge: !!desktopWindowBridge,
|
|
344
|
+
});
|
|
345
|
+
}, [desktopSnapshot, desktopWindowBridge, initialConfig]);
|
|
1670
346
|
const initialCliLaunch = useMemo(() => {
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
return cliLaunchRequest.applyConfig(effectiveInitialConfig, {
|
|
347
|
+
return resolveCliLaunchConfig({
|
|
348
|
+
cliLaunchRequest,
|
|
349
|
+
config: effectiveInitialConfig,
|
|
1675
350
|
terminalWidth: renderer.terminalWidth,
|
|
1676
351
|
terminalHeight: renderer.terminalHeight,
|
|
1677
352
|
});
|
|
@@ -1700,40 +375,14 @@ export function App({
|
|
|
1700
375
|
}, [services]);
|
|
1701
376
|
|
|
1702
377
|
const sessionSnapshot = useMemo(() => {
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
config,
|
|
1706
|
-
services.persistence.sessions.get<AppSessionSnapshot>(APP_SESSION_ID, APP_SESSION_SCHEMA_VERSION)?.value ?? null,
|
|
1707
|
-
) ?? {
|
|
1708
|
-
paneState: {},
|
|
1709
|
-
focusedPaneId: null,
|
|
1710
|
-
activePanel: "left" as const,
|
|
1711
|
-
statusBarVisible: true,
|
|
1712
|
-
openPaneIds: [],
|
|
1713
|
-
hydrationTargets: [],
|
|
1714
|
-
exchangeCurrencies: [],
|
|
1715
|
-
savedAt: Date.now(),
|
|
1716
|
-
};
|
|
1717
|
-
return desktopSnapshot
|
|
1718
|
-
? {
|
|
1719
|
-
...baseSessionSnapshot,
|
|
1720
|
-
paneState: desktopSnapshot.paneState,
|
|
1721
|
-
focusedPaneId: desktopSnapshot.focusedPaneId,
|
|
1722
|
-
activePanel: desktopSnapshot.activePanel,
|
|
1723
|
-
statusBarVisible: desktopSnapshot.statusBarVisible,
|
|
1724
|
-
}
|
|
1725
|
-
: null;
|
|
1726
|
-
}
|
|
1727
|
-
const persisted = services.persistence.sessions.get<AppSessionSnapshot>(APP_SESSION_ID, APP_SESSION_SCHEMA_VERSION)?.value ?? null;
|
|
1728
|
-
const reconciled = reconcileAppSessionSnapshot(config, persisted);
|
|
1729
|
-
if (!cliLaunchRequest?.applySessionSnapshot) {
|
|
1730
|
-
return reconciled;
|
|
1731
|
-
}
|
|
1732
|
-
return cliLaunchRequest.applySessionSnapshot(
|
|
378
|
+
return resolveAppSessionSnapshot({
|
|
379
|
+
cliLaunchRequest,
|
|
1733
380
|
config,
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
381
|
+
cliLaunchState: cliLaunchStateRef.current,
|
|
382
|
+
desktopSnapshot,
|
|
383
|
+
desktopWindowKind: desktopWindowBridge?.kind,
|
|
384
|
+
sessionStore: services.persistence.sessions,
|
|
385
|
+
});
|
|
1737
386
|
}, [cliLaunchRequest, config, desktopSnapshot, desktopWindowBridge?.kind, services.persistence.sessions]);
|
|
1738
387
|
|
|
1739
388
|
if (showOnboarding) {
|