gloomberb 0.7.5 → 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 +107 -1487
- 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 +2 -76
- package/src/plugins/builtin/holders/index.tsx +3 -959
- 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 +79 -4
- package/src/plugins/pane-manager.ts +57 -1061
- 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 +165 -1001
- 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 +1 -1
- package/src/renderers/electrobun/view/app-services.ts +4 -375
- 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 +2 -2
- 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 +8 -3
- 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 +43 -0
- 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 -5886
- 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 -1453
- package/src/components/layout/shell.tsx +0 -1960
- 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 -926
- 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
|
@@ -1,46 +1,10 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
2
|
/** @jsxImportSource react */
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
useCallback,
|
|
6
|
-
useEffect,
|
|
7
|
-
useImperativeHandle,
|
|
8
|
-
useMemo,
|
|
9
|
-
useRef,
|
|
10
|
-
useState,
|
|
11
|
-
type CSSProperties,
|
|
12
|
-
type KeyboardEvent,
|
|
13
|
-
type MouseEvent,
|
|
14
|
-
type ReactNode,
|
|
15
|
-
type Ref,
|
|
16
|
-
type WheelEvent as ReactWheelEvent,
|
|
17
|
-
} from "react";
|
|
18
|
-
import {
|
|
19
|
-
StyledText,
|
|
20
|
-
TextAttributes,
|
|
21
|
-
type BoxRenderable,
|
|
22
|
-
type BitmapSurface,
|
|
23
|
-
type ChartCrosshairOverlay,
|
|
24
|
-
type HostTabsProps,
|
|
25
|
-
type InputRenderable,
|
|
26
|
-
type RendererHost,
|
|
27
|
-
type ScrollBoxRenderable,
|
|
28
|
-
type TextareaRenderable,
|
|
29
|
-
type AsciiTextProps,
|
|
30
|
-
type TextProps,
|
|
31
|
-
type UiHost,
|
|
32
|
-
type StyledTextChunk,
|
|
33
|
-
} from "../../../ui/host";
|
|
34
|
-
import { renderAsciiText } from "../../../ui/ascii-font";
|
|
35
|
-
import { editableTextContextMenuItems } from "../../../ui/context-menu";
|
|
3
|
+
import { useEffect, useState, type CSSProperties, type ReactNode } from "react";
|
|
4
|
+
import type { RendererHost, UiHost } from "../../../ui/host";
|
|
36
5
|
import { WEB_CELL_HEIGHT, WEB_CELL_WIDTH } from "./input-host";
|
|
37
|
-
import { backendRequest
|
|
6
|
+
import { backendRequest } from "./backend-rpc";
|
|
38
7
|
import { WebDataTable } from "./data-table";
|
|
39
|
-
import {
|
|
40
|
-
DesktopContextMenuActionScope,
|
|
41
|
-
createContextMenuRequestId,
|
|
42
|
-
prepareDesktopContextMenu,
|
|
43
|
-
} from "./context-menu";
|
|
44
8
|
import {
|
|
45
9
|
WebButton,
|
|
46
10
|
WebDialogFrame,
|
|
@@ -49,1370 +13,19 @@ import {
|
|
|
49
13
|
WebPageStackView,
|
|
50
14
|
WebSegmentedControl,
|
|
51
15
|
WebTextField,
|
|
52
|
-
} from "./desktop
|
|
53
|
-
import {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
function startElectrobunWindowDrag(): void {
|
|
68
|
-
window.__electrobunInternalBridge?.postMessage(JSON.stringify([
|
|
69
|
-
JSON.stringify({
|
|
70
|
-
type: "message",
|
|
71
|
-
id: "startWindowMove",
|
|
72
|
-
payload: { id: window.__electrobunWindowId },
|
|
73
|
-
}),
|
|
74
|
-
]));
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function cellHeight(value: unknown): CSSProperties["height"] {
|
|
78
|
-
if (typeof value === "number") return `${value * WEB_CELL_HEIGHT}px`;
|
|
79
|
-
return value as CSSProperties["height"];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function cellInset(value: unknown, axis: "x" | "y"): CSSProperties["paddingLeft"] {
|
|
83
|
-
if (typeof value === "number") return `${value * (axis === "x" ? WEB_CELL_WIDTH : WEB_CELL_HEIGHT)}px`;
|
|
84
|
-
return value as CSSProperties["paddingLeft"];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function allowsZeroMinSize(props: Record<string, unknown>, axis: "inline" | "block"): boolean {
|
|
88
|
-
if (props.overflow === "hidden" || props.overflow === "clip") return true;
|
|
89
|
-
if (typeof props.flexShrink === "number" && props.flexShrink > 0) return true;
|
|
90
|
-
return axis === "inline" ? props.scrollX === true : props.scrollY === true;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function commonStyle(props: Record<string, unknown>): CSSProperties {
|
|
94
|
-
const hasFixedInlineSize = props.width != null || props.flexBasis != null;
|
|
95
|
-
const hasFixedBlockSize = props.height != null;
|
|
96
|
-
const gapUnit = props.flexDirection === "row" ? WEB_CELL_WIDTH : WEB_CELL_HEIGHT;
|
|
97
|
-
const zeroMinInlineSize = props.minWidth == null && allowsZeroMinSize(props, "inline");
|
|
98
|
-
const zeroMinBlockSize = props.minHeight == null && allowsZeroMinSize(props, "block");
|
|
99
|
-
return {
|
|
100
|
-
color: typeof props.fg === "string" ? props.fg : undefined,
|
|
101
|
-
backgroundColor: typeof props.bg === "string" ? props.bg : typeof props.backgroundColor === "string" ? props.backgroundColor : undefined,
|
|
102
|
-
display: "flex",
|
|
103
|
-
flexDirection: props.flexDirection === "row" ? "row" : "column",
|
|
104
|
-
flexGrow: typeof props.flexGrow === "number" ? props.flexGrow : undefined,
|
|
105
|
-
flexShrink: typeof props.flexShrink === "number" ? props.flexShrink : hasFixedInlineSize || hasFixedBlockSize ? 0 : undefined,
|
|
106
|
-
flexBasis: cellWidth(props.flexBasis),
|
|
107
|
-
flexWrap: props.flexWrap === "wrap" ? "wrap" : undefined,
|
|
108
|
-
alignItems: props.alignItems as CSSProperties["alignItems"],
|
|
109
|
-
justifyContent: props.justifyContent as CSSProperties["justifyContent"],
|
|
110
|
-
position: props.position as CSSProperties["position"],
|
|
111
|
-
left: cellWidth(props.left),
|
|
112
|
-
right: cellWidth(props.right),
|
|
113
|
-
top: cellHeight(props.top),
|
|
114
|
-
bottom: cellHeight(props.bottom),
|
|
115
|
-
zIndex: typeof props.zIndex === "number" ? props.zIndex : undefined,
|
|
116
|
-
width: cellWidth(props.width),
|
|
117
|
-
height: cellHeight(props.height),
|
|
118
|
-
minWidth: cellWidth(props.minWidth),
|
|
119
|
-
minHeight: cellHeight(props.minHeight),
|
|
120
|
-
maxWidth: cellWidth(props.maxWidth),
|
|
121
|
-
maxHeight: cellHeight(props.maxHeight),
|
|
122
|
-
paddingLeft: cellInset(props.paddingLeft ?? props.paddingX ?? props.padding, "x"),
|
|
123
|
-
paddingRight: cellInset(props.paddingRight ?? props.paddingX ?? props.padding, "x"),
|
|
124
|
-
paddingTop: cellInset(props.paddingTop ?? props.paddingY ?? props.padding, "y"),
|
|
125
|
-
paddingBottom: cellInset(props.paddingBottom ?? props.paddingY ?? props.padding, "y"),
|
|
126
|
-
marginLeft: cellInset(props.marginLeft ?? props.marginX ?? props.margin, "x"),
|
|
127
|
-
marginRight: cellInset(props.marginRight ?? props.marginX ?? props.margin, "x"),
|
|
128
|
-
marginTop: cellInset(props.marginTop ?? props.marginY ?? props.margin, "y"),
|
|
129
|
-
marginBottom: cellInset(props.marginBottom ?? props.marginY ?? props.margin, "y"),
|
|
130
|
-
gap: typeof props.gap === "number" ? `${props.gap * gapUnit}px` : props.gap as CSSProperties["gap"],
|
|
131
|
-
overflow: props.overflow as CSSProperties["overflow"],
|
|
132
|
-
border: props.border ? `1px solid ${typeof props.borderColor === "string" ? props.borderColor : "var(--gloom-border)"}` : undefined,
|
|
133
|
-
boxSizing: "border-box",
|
|
134
|
-
minInlineSize: zeroMinInlineSize ? 0 : undefined,
|
|
135
|
-
minBlockSize: zeroMinBlockSize ? 0 : undefined,
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function hasAttribute(attributes: unknown, flag: number): boolean {
|
|
140
|
-
return typeof attributes === "number" && (attributes & flag) !== 0;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function textStyle(props: TextProps): CSSProperties {
|
|
144
|
-
const attributes = props.attributes;
|
|
145
|
-
const shouldWrap = props.wrapText || props.wrapMode === "word" || props.wrapMode === "char";
|
|
146
|
-
return {
|
|
147
|
-
color: props.fg,
|
|
148
|
-
backgroundColor: props.bg,
|
|
149
|
-
display: "inline-block",
|
|
150
|
-
lineHeight: "var(--cell-h)",
|
|
151
|
-
fontWeight: props.bold || hasAttribute(attributes, TextAttributes.BOLD) ? 700 : undefined,
|
|
152
|
-
fontStyle: props.italic || hasAttribute(attributes, TextAttributes.ITALIC) ? "italic" : undefined,
|
|
153
|
-
textDecoration: [
|
|
154
|
-
props.underline || hasAttribute(attributes, TextAttributes.UNDERLINE) ? "underline" : "",
|
|
155
|
-
props.strikethrough || hasAttribute(attributes, TextAttributes.STRIKETHROUGH) ? "line-through" : "",
|
|
156
|
-
].filter(Boolean).join(" ") || undefined,
|
|
157
|
-
opacity: props.dim || hasAttribute(attributes, TextAttributes.DIM) ? 0.65 : undefined,
|
|
158
|
-
filter: props.inverse || hasAttribute(attributes, TextAttributes.INVERSE) ? "invert(1)" : undefined,
|
|
159
|
-
whiteSpace: shouldWrap ? "pre-wrap" : "pre",
|
|
160
|
-
overflowWrap: shouldWrap ? "break-word" : undefined,
|
|
161
|
-
overflow: "visible",
|
|
162
|
-
textOverflow: "clip",
|
|
163
|
-
width: cellWidth(props.width),
|
|
164
|
-
maxWidth: cellWidth(props.maxWidth),
|
|
165
|
-
minWidth: cellWidth(props.minWidth) ?? 0,
|
|
166
|
-
flexShrink: shouldWrap ? 1 : 0,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function cleanDomProps(props: Record<string, unknown>): Record<string, unknown> {
|
|
171
|
-
const next = { ...props };
|
|
172
|
-
for (const key of [
|
|
173
|
-
"fg", "bg", "backgroundColor", "flexDirection", "flexGrow", "flexShrink", "flexBasis", "flexWrap",
|
|
174
|
-
"alignItems", "justifyContent",
|
|
175
|
-
"padding", "paddingX", "paddingY", "paddingLeft", "paddingRight", "paddingTop", "paddingBottom",
|
|
176
|
-
"margin", "marginX", "marginY", "marginLeft", "marginRight", "marginTop", "marginBottom",
|
|
177
|
-
"bold", "underline", "inverse", "dim", "italic", "strikethrough", "attributes", "content", "position", "left", "right", "top", "bottom",
|
|
178
|
-
"zIndex", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "gap",
|
|
179
|
-
"border", "borderStyle", "borderColor", "overflow", "selectable", "visible", "name", "color",
|
|
180
|
-
"focused", "focusedBackgroundColor", "textColor", "focusedTextColor", "placeholderColor",
|
|
181
|
-
"cursorColor", "selectionBg", "selectionFg", "showCursor", "keyBindings", "wrapText", "wrapMode",
|
|
182
|
-
"initialValue", "value", "onInput", "onChange", "onSubmit", "onCursorChange", "onMouse",
|
|
183
|
-
"scrollX", "scrollY", "focusable", "bitmap", "bitmaps", "crosshair", "text", "font",
|
|
184
|
-
]) {
|
|
185
|
-
delete next[key];
|
|
186
|
-
}
|
|
187
|
-
for (const key of Object.keys(next)) {
|
|
188
|
-
if (key.startsWith("onMouse")) delete next[key];
|
|
189
|
-
}
|
|
190
|
-
return next;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
type MouseLikeEvent = MouseEvent | ReactWheelEvent | globalThis.MouseEvent | globalThis.WheelEvent;
|
|
194
|
-
type CellMouseEvent = ReturnType<typeof cellMouseEvent>;
|
|
195
|
-
type WebFrameCallback = (timestamp: number) => void;
|
|
196
|
-
|
|
197
|
-
const webAnimationFrameApi = globalThis as typeof globalThis & {
|
|
198
|
-
requestAnimationFrame?: (callback: WebFrameCallback) => number;
|
|
199
|
-
cancelAnimationFrame?: (id: number) => void;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
function requestWebFrame(callback: WebFrameCallback): number {
|
|
203
|
-
if (typeof webAnimationFrameApi.requestAnimationFrame === "function") {
|
|
204
|
-
return webAnimationFrameApi.requestAnimationFrame(callback);
|
|
205
|
-
}
|
|
206
|
-
return setTimeout(() => callback(Date.now()), 16) as unknown as number;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function cancelWebFrame(id: number): void {
|
|
210
|
-
if (typeof webAnimationFrameApi.cancelAnimationFrame === "function") {
|
|
211
|
-
webAnimationFrameApi.cancelAnimationFrame(id);
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
clearTimeout(id as unknown as ReturnType<typeof setTimeout>);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function resolveScroll(event: MouseLikeEvent) {
|
|
218
|
-
if (!("deltaX" in event) && !("deltaY" in event)) return undefined;
|
|
219
|
-
const wheel = event as WheelEvent;
|
|
220
|
-
const useHorizontal = Math.abs(wheel.deltaX) > Math.abs(wheel.deltaY);
|
|
221
|
-
const delta = useHorizontal ? wheel.deltaX : wheel.deltaY;
|
|
222
|
-
return {
|
|
223
|
-
direction: useHorizontal
|
|
224
|
-
? (delta > 0 ? "right" : "left")
|
|
225
|
-
: (delta > 0 ? "down" : "up"),
|
|
226
|
-
delta: Math.abs(delta),
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function cellMouseEvent(event: MouseLikeEvent, type?: string) {
|
|
231
|
-
const preciseX = event.clientX / WEB_CELL_WIDTH;
|
|
232
|
-
const preciseY = event.clientY / WEB_CELL_HEIGHT;
|
|
233
|
-
return {
|
|
234
|
-
type,
|
|
235
|
-
x: Math.max(0, Math.floor(preciseX)),
|
|
236
|
-
y: Math.max(0, Math.floor(preciseY)),
|
|
237
|
-
preciseX: Math.max(0, preciseX),
|
|
238
|
-
preciseY: Math.max(0, preciseY),
|
|
239
|
-
pixelX: event.clientX,
|
|
240
|
-
pixelY: event.clientY,
|
|
241
|
-
button: event.button,
|
|
242
|
-
detail: "detail" in event && typeof event.detail === "number" ? event.detail : 0,
|
|
243
|
-
timeStamp: event.timeStamp,
|
|
244
|
-
modifiers: {
|
|
245
|
-
shift: event.shiftKey,
|
|
246
|
-
alt: event.altKey,
|
|
247
|
-
ctrl: event.ctrlKey || event.metaKey,
|
|
248
|
-
},
|
|
249
|
-
scroll: resolveScroll(event),
|
|
250
|
-
preventDefault: () => event.preventDefault(),
|
|
251
|
-
stopPropagation: () => event.stopPropagation(),
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function mouseHandlers(props: Record<string, unknown>) {
|
|
256
|
-
const wrap = (handler: unknown) => (
|
|
257
|
-
typeof handler === "function"
|
|
258
|
-
? (event: MouseEvent) => (handler as (event: unknown) => void)(cellMouseEvent(event))
|
|
259
|
-
: undefined
|
|
260
|
-
);
|
|
261
|
-
return {
|
|
262
|
-
onMouseDown: wrap(props.onMouseDown),
|
|
263
|
-
onMouseMove: wrap(props.onMouseMove),
|
|
264
|
-
onMouseUp: wrap(props.onMouseUp),
|
|
265
|
-
onMouseOut: wrap(props.onMouseOut),
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function callMouseHandler(handler: unknown, event: MouseLikeEvent, type?: string): void {
|
|
270
|
-
if (typeof handler !== "function") return;
|
|
271
|
-
(handler as (event: unknown) => void)(cellMouseEvent(event, type));
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function callCellMouseHandler(handler: unknown, event: CellMouseEvent): void {
|
|
275
|
-
if (typeof handler !== "function") return;
|
|
276
|
-
(handler as (event: unknown) => void)(event);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function hasDirectMouseHandler(props: Record<string, unknown>): boolean {
|
|
280
|
-
return typeof props.onMouseDown === "function"
|
|
281
|
-
|| typeof props.onMouseUp === "function"
|
|
282
|
-
|| typeof props.onMouseMove === "function"
|
|
283
|
-
|| typeof props.onMouseOut === "function"
|
|
284
|
-
|| typeof props.onMouseDrag === "function"
|
|
285
|
-
|| typeof props.onMouseDragEnd === "function"
|
|
286
|
-
|| typeof props.onMouseScroll === "function";
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
function cellBoundsForElement(getElement: () => HTMLElement | null, getProps: () => Record<string, unknown>): BoxRenderable {
|
|
290
|
-
const rect = () => getElement()?.getBoundingClientRect();
|
|
291
|
-
const cellX = () => Math.max(0, (rect()?.left ?? 0) / WEB_CELL_WIDTH);
|
|
292
|
-
const cellY = () => Math.max(0, (rect()?.top ?? 0) / WEB_CELL_HEIGHT);
|
|
293
|
-
const cellWidthValue = () => {
|
|
294
|
-
const props = getProps();
|
|
295
|
-
return typeof props.width === "number" ? props.width : Math.max(0, (rect()?.width ?? 0) / WEB_CELL_WIDTH);
|
|
296
|
-
};
|
|
297
|
-
const cellHeightValue = () => {
|
|
298
|
-
const props = getProps();
|
|
299
|
-
return typeof props.height === "number" ? props.height : Math.max(0, (rect()?.height ?? 0) / WEB_CELL_HEIGHT);
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
return {
|
|
303
|
-
get x() { return cellX(); },
|
|
304
|
-
get y() { return cellY(); },
|
|
305
|
-
get width() { return cellWidthValue(); },
|
|
306
|
-
get height() { return cellHeightValue(); },
|
|
307
|
-
get absoluteX() { return cellX(); },
|
|
308
|
-
get absoluteY() { return cellY(); },
|
|
309
|
-
get absoluteBounds() {
|
|
310
|
-
return { x: cellX(), y: cellY(), width: cellWidthValue(), height: cellHeightValue() };
|
|
311
|
-
},
|
|
312
|
-
parent: null,
|
|
313
|
-
getBoundingClientRect: () => {
|
|
314
|
-
const current = rect();
|
|
315
|
-
return {
|
|
316
|
-
x: current?.x ?? 0,
|
|
317
|
-
y: current?.y ?? 0,
|
|
318
|
-
width: current?.width ?? 0,
|
|
319
|
-
height: current?.height ?? 0,
|
|
320
|
-
};
|
|
321
|
-
},
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
const WebBox = forwardRef<HTMLDivElement, Record<string, unknown> & { children?: ReactNode }>(
|
|
326
|
-
function WebBox({ children, ...props }, ref: Ref<HTMLDivElement>) {
|
|
327
|
-
const elementRef = useRef<HTMLDivElement | null>(null);
|
|
328
|
-
const draggingRef = useRef(false);
|
|
329
|
-
const frameRef = useRef<number | null>(null);
|
|
330
|
-
const pendingMoveRef = useRef<CellMouseEvent | null>(null);
|
|
331
|
-
const pendingDragRef = useRef<CellMouseEvent | null>(null);
|
|
332
|
-
const propsRef = useRef(props);
|
|
333
|
-
propsRef.current = props;
|
|
334
|
-
|
|
335
|
-
useImperativeHandle(ref, () => cellBoundsForElement(() => elementRef.current, () => propsRef.current) as HTMLDivElement, []);
|
|
336
|
-
|
|
337
|
-
const cancelPendingFrame = () => {
|
|
338
|
-
if (frameRef.current !== null) {
|
|
339
|
-
cancelWebFrame(frameRef.current);
|
|
340
|
-
frameRef.current = null;
|
|
341
|
-
}
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
const flushPendingFrameMouseHandlers = () => {
|
|
345
|
-
const moveEvent = pendingMoveRef.current;
|
|
346
|
-
const dragEvent = pendingDragRef.current;
|
|
347
|
-
pendingMoveRef.current = null;
|
|
348
|
-
pendingDragRef.current = null;
|
|
349
|
-
|
|
350
|
-
if (moveEvent) {
|
|
351
|
-
callCellMouseHandler(propsRef.current.onMouseMove, moveEvent);
|
|
352
|
-
}
|
|
353
|
-
if (dragEvent) {
|
|
354
|
-
callCellMouseHandler(propsRef.current.onMouse, dragEvent);
|
|
355
|
-
callCellMouseHandler(propsRef.current.onMouseDrag, dragEvent);
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
const flushPendingFrameNow = () => {
|
|
360
|
-
cancelPendingFrame();
|
|
361
|
-
flushPendingFrameMouseHandlers();
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
const scheduleFrameMouseHandler = (event: MouseLikeEvent, type: "move" | "drag") => {
|
|
365
|
-
if (type === "move" && typeof propsRef.current.onMouseMove !== "function") return;
|
|
366
|
-
if (type === "drag"
|
|
367
|
-
&& typeof propsRef.current.onMouse !== "function"
|
|
368
|
-
&& typeof propsRef.current.onMouseDrag !== "function") {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
const nextEvent = cellMouseEvent(event, type);
|
|
373
|
-
if (type === "move") {
|
|
374
|
-
pendingMoveRef.current = nextEvent;
|
|
375
|
-
} else {
|
|
376
|
-
pendingDragRef.current = nextEvent;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
if (frameRef.current !== null) return;
|
|
380
|
-
frameRef.current = requestWebFrame(() => {
|
|
381
|
-
frameRef.current = null;
|
|
382
|
-
flushPendingFrameMouseHandlers();
|
|
383
|
-
});
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
useEffect(() => () => {
|
|
387
|
-
cancelPendingFrame();
|
|
388
|
-
pendingMoveRef.current = null;
|
|
389
|
-
pendingDragRef.current = null;
|
|
390
|
-
document.body.classList.remove("gloom-dragging");
|
|
391
|
-
}, []);
|
|
392
|
-
|
|
393
|
-
const stopDocumentDrag = () => {
|
|
394
|
-
if (!draggingRef.current) return;
|
|
395
|
-
draggingRef.current = false;
|
|
396
|
-
document.body.classList.remove("gloom-dragging");
|
|
397
|
-
document.removeEventListener("mousemove", handleDocumentMove);
|
|
398
|
-
document.removeEventListener("mouseup", handleDocumentUp);
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
const handleDocumentMove = (event: globalThis.MouseEvent) => {
|
|
402
|
-
if (!draggingRef.current) return;
|
|
403
|
-
scheduleFrameMouseHandler(event, "drag");
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
const handleDocumentUp = (event: globalThis.MouseEvent) => {
|
|
407
|
-
if (!draggingRef.current) return;
|
|
408
|
-
flushPendingFrameNow();
|
|
409
|
-
callMouseHandler(propsRef.current.onMouse, event, "up");
|
|
410
|
-
callMouseHandler(propsRef.current.onMouseUp, event, "up");
|
|
411
|
-
callMouseHandler(propsRef.current.onMouseDragEnd, event, "drag-end");
|
|
412
|
-
stopDocumentDrag();
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
const handleMouseDown = (event: MouseEvent) => {
|
|
416
|
-
const hasSyntheticDrag = typeof propsRef.current.onMouse === "function";
|
|
417
|
-
const hasDirectDrag = typeof propsRef.current.onMouseDrag === "function" || typeof propsRef.current.onMouseDragEnd === "function";
|
|
418
|
-
pendingMoveRef.current = null;
|
|
419
|
-
callMouseHandler(propsRef.current.onMouseDown, event, "down");
|
|
420
|
-
if (event.button !== 0 || (event.isPropagationStopped() && !hasDirectDrag)) return;
|
|
421
|
-
if (!hasSyntheticDrag && !hasDirectDrag) return;
|
|
422
|
-
callMouseHandler(propsRef.current.onMouse, event, "down");
|
|
423
|
-
draggingRef.current = true;
|
|
424
|
-
document.body.classList.add("gloom-dragging");
|
|
425
|
-
document.addEventListener("mousemove", handleDocumentMove);
|
|
426
|
-
document.addEventListener("mouseup", handleDocumentUp);
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
const handleWheel = (event: ReactWheelEvent<HTMLDivElement>) => {
|
|
430
|
-
callMouseHandler(propsRef.current.onMouseScroll, event, "scroll");
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
const handleMouseOut = (event: MouseEvent) => {
|
|
434
|
-
pendingMoveRef.current = null;
|
|
435
|
-
callMouseHandler(propsRef.current.onMouseOut, event, "out");
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
return (
|
|
439
|
-
<div
|
|
440
|
-
{...cleanDomProps(props)}
|
|
441
|
-
data-gloom-interactive={hasDirectMouseHandler(props) ? "true" : undefined}
|
|
442
|
-
ref={elementRef}
|
|
443
|
-
onMouseDown={handleMouseDown}
|
|
444
|
-
onMouseMove={(event) => scheduleFrameMouseHandler(event, "move")}
|
|
445
|
-
onMouseUp={(event) => callMouseHandler(propsRef.current.onMouseUp, event, "up")}
|
|
446
|
-
onMouseOut={handleMouseOut}
|
|
447
|
-
onWheel={typeof props.onMouseScroll === "function" ? handleWheel : undefined}
|
|
448
|
-
style={{
|
|
449
|
-
...commonStyle(props),
|
|
450
|
-
...(props.style as CSSProperties | undefined),
|
|
451
|
-
...(props.visible === false ? { display: "none" } : undefined),
|
|
452
|
-
}}
|
|
453
|
-
>
|
|
454
|
-
{children as ReactNode}
|
|
455
|
-
</div>
|
|
456
|
-
);
|
|
457
|
-
},
|
|
458
|
-
);
|
|
459
|
-
|
|
460
|
-
function CanvasBitmap({ bitmap }: { bitmap: BitmapSurface }) {
|
|
461
|
-
const canvasRef = useRef<HTMLCanvasElement | null>(null);
|
|
462
|
-
|
|
463
|
-
useEffect(() => {
|
|
464
|
-
const canvas = canvasRef.current;
|
|
465
|
-
if (!canvas) return;
|
|
466
|
-
const context = canvas.getContext("2d");
|
|
467
|
-
if (!context) return;
|
|
468
|
-
const pixels = bitmap.pixels instanceof Uint8ClampedArray
|
|
469
|
-
? bitmap.pixels
|
|
470
|
-
: new Uint8ClampedArray(bitmap.pixels.buffer, bitmap.pixels.byteOffset, bitmap.pixels.byteLength);
|
|
471
|
-
context.putImageData(new ImageData(pixels, bitmap.width, bitmap.height), 0, 0);
|
|
472
|
-
}, [bitmap]);
|
|
473
|
-
|
|
474
|
-
return (
|
|
475
|
-
<canvas
|
|
476
|
-
ref={canvasRef}
|
|
477
|
-
width={bitmap.width}
|
|
478
|
-
height={bitmap.height}
|
|
479
|
-
style={{
|
|
480
|
-
display: "block",
|
|
481
|
-
width: "100%",
|
|
482
|
-
height: "100%",
|
|
483
|
-
}}
|
|
484
|
-
/>
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
function BoxLayer({ bitmap, index }: { bitmap: BitmapSurface; index: number }) {
|
|
489
|
-
return (
|
|
490
|
-
<div
|
|
491
|
-
style={{
|
|
492
|
-
position: "absolute",
|
|
493
|
-
inset: 0,
|
|
494
|
-
pointerEvents: "none",
|
|
495
|
-
zIndex: index,
|
|
496
|
-
}}
|
|
497
|
-
>
|
|
498
|
-
<CanvasBitmap bitmap={bitmap} />
|
|
499
|
-
</div>
|
|
500
|
-
);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
function ChartCrosshair({
|
|
504
|
-
bitmap,
|
|
505
|
-
crosshair,
|
|
506
|
-
}: {
|
|
507
|
-
bitmap: BitmapSurface | null;
|
|
508
|
-
crosshair: ChartCrosshairOverlay | null;
|
|
509
|
-
}) {
|
|
510
|
-
if (!bitmap || !crosshair) return null;
|
|
511
|
-
const x = bitmap.width <= 1 ? 0 : (crosshair.pixelX / (bitmap.width - 1)) * 100;
|
|
512
|
-
const y = bitmap.height <= 1 ? 0 : (crosshair.pixelY / (bitmap.height - 1)) * 100;
|
|
513
|
-
const clampedX = Math.max(0, Math.min(100, x));
|
|
514
|
-
const clampedY = Math.max(0, Math.min(100, y));
|
|
515
|
-
return (
|
|
516
|
-
<>
|
|
517
|
-
<div
|
|
518
|
-
style={{
|
|
519
|
-
position: "absolute",
|
|
520
|
-
top: 0,
|
|
521
|
-
bottom: 0,
|
|
522
|
-
left: `${clampedX}%`,
|
|
523
|
-
width: 1,
|
|
524
|
-
backgroundColor: crosshair.color,
|
|
525
|
-
opacity: 0.78,
|
|
526
|
-
transform: "translateX(-0.5px)",
|
|
527
|
-
pointerEvents: "none",
|
|
528
|
-
zIndex: 10,
|
|
529
|
-
}}
|
|
530
|
-
/>
|
|
531
|
-
<div
|
|
532
|
-
style={{
|
|
533
|
-
position: "absolute",
|
|
534
|
-
left: 0,
|
|
535
|
-
right: 0,
|
|
536
|
-
top: `${clampedY}%`,
|
|
537
|
-
height: 1,
|
|
538
|
-
backgroundColor: crosshair.color,
|
|
539
|
-
opacity: 0.78,
|
|
540
|
-
transform: "translateY(-0.5px)",
|
|
541
|
-
pointerEvents: "none",
|
|
542
|
-
zIndex: 10,
|
|
543
|
-
}}
|
|
544
|
-
/>
|
|
545
|
-
<div
|
|
546
|
-
style={{
|
|
547
|
-
position: "absolute",
|
|
548
|
-
left: `${clampedX}%`,
|
|
549
|
-
top: `${clampedY}%`,
|
|
550
|
-
width: 7,
|
|
551
|
-
height: 7,
|
|
552
|
-
borderRadius: 7,
|
|
553
|
-
border: `1px solid ${crosshair.color}`,
|
|
554
|
-
backgroundColor: `color-mix(in srgb, ${crosshair.color} 16%, transparent)`,
|
|
555
|
-
boxSizing: "border-box",
|
|
556
|
-
transform: "translate(-50%, -50%)",
|
|
557
|
-
pointerEvents: "none",
|
|
558
|
-
zIndex: 11,
|
|
559
|
-
}}
|
|
560
|
-
/>
|
|
561
|
-
</>
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
function isStyledTextContent(value: unknown): value is { chunks: StyledTextChunk[] } {
|
|
566
|
-
return value instanceof StyledText
|
|
567
|
-
|| (!!value && typeof value === "object" && Array.isArray((value as { chunks?: unknown }).chunks));
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
function styledTextChunkStyle(baseProps: TextProps, chunk: StyledTextChunk): CSSProperties {
|
|
571
|
-
const style = textStyle({
|
|
572
|
-
...baseProps,
|
|
573
|
-
fg: typeof chunk.fg === "string" ? chunk.fg : baseProps.fg,
|
|
574
|
-
bg: typeof chunk.bg === "string" ? chunk.bg : baseProps.bg,
|
|
575
|
-
attributes: chunk.attributes,
|
|
576
|
-
});
|
|
577
|
-
style.display = "inline";
|
|
578
|
-
style.width = undefined;
|
|
579
|
-
style.maxWidth = undefined;
|
|
580
|
-
style.minWidth = undefined;
|
|
581
|
-
style.flexShrink = undefined;
|
|
582
|
-
return style;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
function renderTextContent(children: ReactNode, content: TextProps["content"], baseProps: TextProps): ReactNode {
|
|
586
|
-
const resolved = children ?? content;
|
|
587
|
-
if (!isStyledTextContent(resolved)) return resolved;
|
|
588
|
-
return resolved.chunks.map((chunk, index) => (
|
|
589
|
-
<span
|
|
590
|
-
key={index}
|
|
591
|
-
style={styledTextChunkStyle(baseProps, chunk)}
|
|
592
|
-
>
|
|
593
|
-
{chunk.text}
|
|
594
|
-
</span>
|
|
595
|
-
));
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
function textInputStyle(props: Record<string, unknown>, multiline: boolean): CSSProperties {
|
|
599
|
-
const focused = props.focused === true;
|
|
600
|
-
const textColor = focused && typeof props.focusedTextColor === "string"
|
|
601
|
-
? props.focusedTextColor
|
|
602
|
-
: props.textColor;
|
|
603
|
-
const backgroundColor = focused && typeof props.focusedBackgroundColor === "string"
|
|
604
|
-
? props.focusedBackgroundColor
|
|
605
|
-
: props.backgroundColor;
|
|
606
|
-
|
|
607
|
-
return {
|
|
608
|
-
...commonStyle(props),
|
|
609
|
-
display: "block",
|
|
610
|
-
resize: "none",
|
|
611
|
-
border: "none",
|
|
612
|
-
outline: "none",
|
|
613
|
-
color: typeof textColor === "string" ? textColor : "var(--gloom-text)",
|
|
614
|
-
backgroundColor: typeof backgroundColor === "string" ? backgroundColor : "transparent",
|
|
615
|
-
whiteSpace: multiline && props.wrapText ? "pre-wrap" : "pre",
|
|
616
|
-
overflow: multiline ? "auto" : "hidden",
|
|
617
|
-
width: cellWidth(props.width) ?? "100%",
|
|
618
|
-
height: cellHeight(props.height) ?? (multiline ? "100%" : "var(--cell-h)"),
|
|
619
|
-
padding: 0,
|
|
620
|
-
margin: 0,
|
|
621
|
-
caretColor: typeof props.cursorColor === "string" ? props.cursorColor : "auto",
|
|
622
|
-
...(props.style as CSSProperties | undefined),
|
|
623
|
-
};
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
function getStringProp(props: Record<string, unknown>, key: string): string | undefined {
|
|
627
|
-
const value = props[key];
|
|
628
|
-
return typeof value === "string" ? value : undefined;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
function callTextHandler(handler: unknown, value: string): void {
|
|
632
|
-
if (typeof handler === "function") {
|
|
633
|
-
(handler as (value: string) => void)(value);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
function useEditableValue(props: Record<string, unknown>) {
|
|
638
|
-
const controlledValue = getStringProp(props, "value");
|
|
639
|
-
const [internalValue, setInternalValue] = useState(getStringProp(props, "initialValue") ?? "");
|
|
640
|
-
const value = controlledValue ?? internalValue;
|
|
641
|
-
const valueRef = useRef(value);
|
|
642
|
-
valueRef.current = value;
|
|
643
|
-
|
|
644
|
-
const setValue = (nextValue: string) => {
|
|
645
|
-
valueRef.current = nextValue;
|
|
646
|
-
if (controlledValue == null) {
|
|
647
|
-
setInternalValue(nextValue);
|
|
648
|
-
}
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
return { value, valueRef, setValue };
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
type WebVisualCursor = TextareaRenderable["visualCursor"];
|
|
655
|
-
|
|
656
|
-
function textareaColumnCount(props: Record<string, unknown>, element: HTMLTextAreaElement | null): number {
|
|
657
|
-
if (typeof props.width === "number") return Math.max(1, Math.floor(props.width));
|
|
658
|
-
const width = element?.clientWidth ?? 0;
|
|
659
|
-
return Math.max(1, Math.floor(width / WEB_CELL_WIDTH));
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
function wrappedLineCount(line: string, columns: number, wrap: boolean): number {
|
|
663
|
-
if (!wrap) return 1;
|
|
664
|
-
return Math.max(1, Math.ceil(line.length / columns));
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
function textareaMetrics(
|
|
668
|
-
text: string,
|
|
669
|
-
offset: number,
|
|
670
|
-
columns: number,
|
|
671
|
-
wrap: boolean,
|
|
672
|
-
): { virtualLineCount: number; visualCursor: WebVisualCursor } {
|
|
673
|
-
const lines = text.split("\n");
|
|
674
|
-
const clampedOffset = Math.max(0, Math.min(offset, text.length));
|
|
675
|
-
let consumed = 0;
|
|
676
|
-
let virtualLineCount = 0;
|
|
677
|
-
let visualCursor: WebVisualCursor = {
|
|
678
|
-
visualRow: 0,
|
|
679
|
-
visualCol: 0,
|
|
680
|
-
logicalRow: 0,
|
|
681
|
-
logicalCol: 0,
|
|
682
|
-
offset: clampedOffset,
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
for (let index = 0; index < lines.length; index += 1) {
|
|
686
|
-
const line = lines[index] ?? "";
|
|
687
|
-
const lineStart = consumed;
|
|
688
|
-
const lineEnd = lineStart + line.length;
|
|
689
|
-
const lineVirtualRows = wrappedLineCount(line, columns, wrap);
|
|
690
|
-
const cursorIsOnLine = clampedOffset <= lineEnd || index === lines.length - 1;
|
|
691
|
-
|
|
692
|
-
if (cursorIsOnLine) {
|
|
693
|
-
const logicalCol = Math.max(0, Math.min(clampedOffset - lineStart, line.length));
|
|
694
|
-
const visualRowInLine = wrap
|
|
695
|
-
? Math.min(Math.floor(logicalCol / columns), lineVirtualRows - 1)
|
|
696
|
-
: 0;
|
|
697
|
-
visualCursor = {
|
|
698
|
-
visualRow: virtualLineCount + visualRowInLine,
|
|
699
|
-
visualCol: wrap ? logicalCol % columns : logicalCol,
|
|
700
|
-
logicalRow: index,
|
|
701
|
-
logicalCol,
|
|
702
|
-
offset: clampedOffset,
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
virtualLineCount += lineVirtualRows;
|
|
707
|
-
consumed = lineEnd + 1;
|
|
708
|
-
if (cursorIsOnLine) {
|
|
709
|
-
for (let remaining = index + 1; remaining < lines.length; remaining += 1) {
|
|
710
|
-
virtualLineCount += wrappedLineCount(lines[remaining] ?? "", columns, wrap);
|
|
711
|
-
}
|
|
712
|
-
break;
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
return {
|
|
717
|
-
virtualLineCount: Math.max(1, virtualLineCount),
|
|
718
|
-
visualCursor,
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
const WebInput = forwardRef<InputRenderable, Record<string, unknown>>(function WebInput(props, ref) {
|
|
723
|
-
const elementRef = useRef<HTMLInputElement | null>(null);
|
|
724
|
-
const { value, valueRef, setValue } = useEditableValue(props);
|
|
725
|
-
const [cursorOffset, setCursorOffset] = useState(value.length);
|
|
726
|
-
|
|
727
|
-
useEffect(() => {
|
|
728
|
-
if (props.focused === true) {
|
|
729
|
-
elementRef.current?.focus();
|
|
730
|
-
}
|
|
731
|
-
}, [props.focused]);
|
|
732
|
-
|
|
733
|
-
useImperativeHandle(ref, () => ({
|
|
734
|
-
editBuffer: {
|
|
735
|
-
getText: () => valueRef.current,
|
|
736
|
-
setText: (nextText: string) => setValue(nextText),
|
|
737
|
-
},
|
|
738
|
-
get cursorOffset() {
|
|
739
|
-
return cursorOffset;
|
|
740
|
-
},
|
|
741
|
-
focus: () => elementRef.current?.focus(),
|
|
742
|
-
}), [cursorOffset, setValue, valueRef]);
|
|
743
|
-
|
|
744
|
-
const handleValueChange = (nextValue: string) => {
|
|
745
|
-
setValue(nextValue);
|
|
746
|
-
setCursorOffset(elementRef.current?.selectionStart ?? nextValue.length);
|
|
747
|
-
callTextHandler(props.onInput, nextValue);
|
|
748
|
-
callTextHandler(props.onChange, nextValue);
|
|
749
|
-
callTextHandler(props.onCursorChange, nextValue);
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
|
|
753
|
-
if (event.key === "Enter" && typeof props.onSubmit === "function") {
|
|
754
|
-
event.preventDefault();
|
|
755
|
-
(props.onSubmit as (value: string) => void)(valueRef.current);
|
|
756
|
-
}
|
|
757
|
-
};
|
|
758
|
-
|
|
759
|
-
return (
|
|
760
|
-
<input
|
|
761
|
-
{...cleanDomProps(props)}
|
|
762
|
-
ref={elementRef}
|
|
763
|
-
value={value}
|
|
764
|
-
autoCorrect="off"
|
|
765
|
-
autoCapitalize="off"
|
|
766
|
-
autoComplete="off"
|
|
767
|
-
spellCheck={false}
|
|
768
|
-
placeholder={getStringProp(props, "placeholder")}
|
|
769
|
-
onChange={(event) => handleValueChange(event.currentTarget.value)}
|
|
770
|
-
onKeyDown={handleKeyDown}
|
|
771
|
-
onContextMenu={(event) => {
|
|
772
|
-
if (!NATIVE_CONTEXT_MENU_SUPPORTED || !webRendererHost.showContextMenu) return;
|
|
773
|
-
elementRef.current?.focus();
|
|
774
|
-
event.preventDefault();
|
|
775
|
-
event.stopPropagation();
|
|
776
|
-
void webRendererHost.showContextMenu(editableTextContextMenuItems());
|
|
777
|
-
}}
|
|
778
|
-
onSelect={() => {
|
|
779
|
-
setCursorOffset(elementRef.current?.selectionStart ?? valueRef.current.length);
|
|
780
|
-
callTextHandler(props.onCursorChange, valueRef.current);
|
|
781
|
-
}}
|
|
782
|
-
style={textInputStyle(props, false)}
|
|
783
|
-
/>
|
|
784
|
-
);
|
|
785
|
-
});
|
|
786
|
-
|
|
787
|
-
const WebTextarea = forwardRef<TextareaRenderable, Record<string, unknown>>(function WebTextarea(props, ref) {
|
|
788
|
-
const elementRef = useRef<HTMLTextAreaElement | null>(null);
|
|
789
|
-
const { value, valueRef, setValue } = useEditableValue(props);
|
|
790
|
-
const [cursorOffset, setCursorOffset] = useState(value.length);
|
|
791
|
-
|
|
792
|
-
useEffect(() => {
|
|
793
|
-
if (props.focused === true) {
|
|
794
|
-
elementRef.current?.focus();
|
|
795
|
-
}
|
|
796
|
-
}, [props.focused]);
|
|
797
|
-
|
|
798
|
-
useImperativeHandle(ref, () => ({
|
|
799
|
-
editBuffer: {
|
|
800
|
-
getText: () => valueRef.current,
|
|
801
|
-
setText: (nextText: string) => setValue(nextText),
|
|
802
|
-
},
|
|
803
|
-
get cursorOffset() {
|
|
804
|
-
return cursorOffset;
|
|
805
|
-
},
|
|
806
|
-
get virtualLineCount() {
|
|
807
|
-
const metrics = textareaMetrics(
|
|
808
|
-
valueRef.current,
|
|
809
|
-
elementRef.current?.selectionStart ?? cursorOffset,
|
|
810
|
-
textareaColumnCount(props, elementRef.current),
|
|
811
|
-
props.wrapText === true || props.wrapMode === "word" || props.wrapMode === "char",
|
|
812
|
-
);
|
|
813
|
-
return metrics.virtualLineCount;
|
|
814
|
-
},
|
|
815
|
-
get visualCursor() {
|
|
816
|
-
return textareaMetrics(
|
|
817
|
-
valueRef.current,
|
|
818
|
-
elementRef.current?.selectionStart ?? cursorOffset,
|
|
819
|
-
textareaColumnCount(props, elementRef.current),
|
|
820
|
-
props.wrapText === true || props.wrapMode === "word" || props.wrapMode === "char",
|
|
821
|
-
).visualCursor;
|
|
822
|
-
},
|
|
823
|
-
focus: () => elementRef.current?.focus(),
|
|
824
|
-
setText: (nextText: string) => setValue(nextText),
|
|
825
|
-
hasSelection: () => {
|
|
826
|
-
const element = elementRef.current;
|
|
827
|
-
return !!element && element.selectionStart !== element.selectionEnd;
|
|
828
|
-
},
|
|
829
|
-
syntaxStyle: null,
|
|
830
|
-
addHighlight: () => {},
|
|
831
|
-
clearLineHighlights: () => {},
|
|
832
|
-
}), [cursorOffset, props, setValue, valueRef]);
|
|
833
|
-
|
|
834
|
-
const handleValueChange = (nextValue: string) => {
|
|
835
|
-
setValue(nextValue);
|
|
836
|
-
setCursorOffset(elementRef.current?.selectionStart ?? nextValue.length);
|
|
837
|
-
callTextHandler(props.onInput, nextValue);
|
|
838
|
-
callTextHandler(props.onChange, nextValue);
|
|
839
|
-
callTextHandler(props.onCursorChange, nextValue);
|
|
840
|
-
};
|
|
841
|
-
|
|
842
|
-
const handleKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {
|
|
843
|
-
if (event.key === "Enter" && !event.shiftKey && typeof props.onSubmit === "function") {
|
|
844
|
-
event.preventDefault();
|
|
845
|
-
(props.onSubmit as (value: string) => void)(valueRef.current);
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
|
-
|
|
849
|
-
return (
|
|
850
|
-
<textarea
|
|
851
|
-
{...cleanDomProps(props)}
|
|
852
|
-
ref={elementRef}
|
|
853
|
-
value={value}
|
|
854
|
-
autoCorrect="off"
|
|
855
|
-
autoCapitalize="off"
|
|
856
|
-
autoComplete="off"
|
|
857
|
-
spellCheck={false}
|
|
858
|
-
placeholder={getStringProp(props, "placeholder")}
|
|
859
|
-
onChange={(event) => handleValueChange(event.currentTarget.value)}
|
|
860
|
-
onKeyDown={handleKeyDown}
|
|
861
|
-
onContextMenu={(event) => {
|
|
862
|
-
if (!NATIVE_CONTEXT_MENU_SUPPORTED || !webRendererHost.showContextMenu) return;
|
|
863
|
-
elementRef.current?.focus();
|
|
864
|
-
event.preventDefault();
|
|
865
|
-
event.stopPropagation();
|
|
866
|
-
void webRendererHost.showContextMenu(editableTextContextMenuItems());
|
|
867
|
-
}}
|
|
868
|
-
onSelect={() => {
|
|
869
|
-
setCursorOffset(elementRef.current?.selectionStart ?? valueRef.current.length);
|
|
870
|
-
callTextHandler(props.onCursorChange, valueRef.current);
|
|
871
|
-
}}
|
|
872
|
-
style={textInputStyle(props, true)}
|
|
873
|
-
/>
|
|
874
|
-
);
|
|
875
|
-
});
|
|
876
|
-
|
|
877
|
-
const WebScrollBox = forwardRef<ScrollBoxRenderable, Record<string, unknown> & { children?: ReactNode }>(
|
|
878
|
-
function WebScrollBox({ children, ...props }, ref) {
|
|
879
|
-
const elementRef = useRef<HTMLDivElement | null>(null);
|
|
880
|
-
const isHeaderLikeScroller = props.scrollX === true && props.scrollY !== true && props.height === 1;
|
|
881
|
-
const [horizontalScrollBarVisible, setHorizontalScrollBarVisible] = useState(
|
|
882
|
-
() => props.scrollX === true && !isHeaderLikeScroller,
|
|
883
|
-
);
|
|
884
|
-
const [verticalScrollBarVisible, setVerticalScrollBarVisible] = useState(
|
|
885
|
-
() => props.scrollY === true,
|
|
886
|
-
);
|
|
887
|
-
const horizontalScrollBarVisibleRef = useRef(horizontalScrollBarVisible);
|
|
888
|
-
const verticalScrollBarVisibleRef = useRef(verticalScrollBarVisible);
|
|
889
|
-
const horizontalScrollChangeHandlersRef = useRef(new Set<() => void>());
|
|
890
|
-
const verticalScrollChangeHandlersRef = useRef(new Set<() => void>());
|
|
891
|
-
const scrollFrameRef = useRef<number | null>(null);
|
|
892
|
-
const lastWheelAtRef = useRef(0);
|
|
893
|
-
const [scrollbarActive, markScrollbarActive] = useScrollbarActivity();
|
|
894
|
-
|
|
895
|
-
const getElement = useCallback(() => elementRef.current, []);
|
|
896
|
-
const toCellY = (pixels: number) => Math.max(0, Math.round(pixels / WEB_CELL_HEIGHT));
|
|
897
|
-
const toCellX = (pixels: number) => Math.max(0, Math.round(pixels / WEB_CELL_WIDTH));
|
|
898
|
-
const emitHorizontalScrollChange = useCallback(() => {
|
|
899
|
-
for (const handler of horizontalScrollChangeHandlersRef.current) {
|
|
900
|
-
handler();
|
|
901
|
-
}
|
|
902
|
-
}, []);
|
|
903
|
-
const emitVerticalScrollChange = useCallback(() => {
|
|
904
|
-
for (const handler of verticalScrollChangeHandlersRef.current) {
|
|
905
|
-
handler();
|
|
906
|
-
}
|
|
907
|
-
}, []);
|
|
908
|
-
const emitScrollPositionChanges = useCallback(() => {
|
|
909
|
-
emitVerticalScrollChange();
|
|
910
|
-
emitHorizontalScrollChange();
|
|
911
|
-
}, [emitHorizontalScrollChange, emitVerticalScrollChange]);
|
|
912
|
-
const horizontalScrollBar = useMemo(() => ({
|
|
913
|
-
get visible() {
|
|
914
|
-
return horizontalScrollBarVisibleRef.current;
|
|
915
|
-
},
|
|
916
|
-
set visible(nextVisible: boolean) {
|
|
917
|
-
const normalized = nextVisible === true;
|
|
918
|
-
horizontalScrollBarVisibleRef.current = normalized;
|
|
919
|
-
setHorizontalScrollBarVisible(normalized);
|
|
920
|
-
},
|
|
921
|
-
on(event: "change", handler: () => void) {
|
|
922
|
-
if (event === "change") horizontalScrollChangeHandlersRef.current.add(handler);
|
|
923
|
-
},
|
|
924
|
-
off(event: "change", handler: () => void) {
|
|
925
|
-
if (event === "change") horizontalScrollChangeHandlersRef.current.delete(handler);
|
|
926
|
-
},
|
|
927
|
-
}), []);
|
|
928
|
-
const verticalScrollBar = useMemo(() => ({
|
|
929
|
-
get visible() {
|
|
930
|
-
return verticalScrollBarVisibleRef.current;
|
|
931
|
-
},
|
|
932
|
-
set visible(nextVisible: boolean) {
|
|
933
|
-
const normalized = nextVisible === true;
|
|
934
|
-
verticalScrollBarVisibleRef.current = normalized;
|
|
935
|
-
setVerticalScrollBarVisible(normalized);
|
|
936
|
-
},
|
|
937
|
-
on(event: "change", handler: () => void) {
|
|
938
|
-
if (event === "change") verticalScrollChangeHandlersRef.current.add(handler);
|
|
939
|
-
},
|
|
940
|
-
off(event: "change", handler: () => void) {
|
|
941
|
-
if (event === "change") verticalScrollChangeHandlersRef.current.delete(handler);
|
|
942
|
-
},
|
|
943
|
-
}), []);
|
|
944
|
-
|
|
945
|
-
useEffect(() => {
|
|
946
|
-
if (props.scrollX !== true) {
|
|
947
|
-
horizontalScrollBar.visible = false;
|
|
948
|
-
}
|
|
949
|
-
}, [horizontalScrollBar, props.scrollX]);
|
|
950
|
-
|
|
951
|
-
useEffect(() => {
|
|
952
|
-
if (props.scrollY !== true) {
|
|
953
|
-
verticalScrollBar.visible = false;
|
|
954
|
-
}
|
|
955
|
-
}, [props.scrollY, verticalScrollBar]);
|
|
956
|
-
|
|
957
|
-
useEffect(() => () => {
|
|
958
|
-
if (scrollFrameRef.current != null) {
|
|
959
|
-
cancelAnimationFrame(scrollFrameRef.current);
|
|
960
|
-
}
|
|
961
|
-
}, []);
|
|
962
|
-
|
|
963
|
-
useImperativeHandle(ref, () => ({
|
|
964
|
-
get scrollTop() {
|
|
965
|
-
return toCellY(getElement()?.scrollTop ?? 0);
|
|
966
|
-
},
|
|
967
|
-
set scrollTop(value: number) {
|
|
968
|
-
const element = getElement();
|
|
969
|
-
if (element) {
|
|
970
|
-
element.scrollTop = Math.max(0, value) * WEB_CELL_HEIGHT;
|
|
971
|
-
emitVerticalScrollChange();
|
|
972
|
-
}
|
|
973
|
-
},
|
|
974
|
-
get scrollTopPx() {
|
|
975
|
-
return Math.max(0, getElement()?.scrollTop ?? 0);
|
|
976
|
-
},
|
|
977
|
-
set scrollTopPx(value: number) {
|
|
978
|
-
const element = getElement();
|
|
979
|
-
if (element) {
|
|
980
|
-
element.scrollTop = Math.max(0, value);
|
|
981
|
-
emitVerticalScrollChange();
|
|
982
|
-
}
|
|
983
|
-
},
|
|
984
|
-
get scrollLeft() {
|
|
985
|
-
return toCellX(getElement()?.scrollLeft ?? 0);
|
|
986
|
-
},
|
|
987
|
-
set scrollLeft(value: number) {
|
|
988
|
-
const element = getElement();
|
|
989
|
-
if (element) {
|
|
990
|
-
element.scrollLeft = Math.max(0, value) * WEB_CELL_WIDTH;
|
|
991
|
-
emitHorizontalScrollChange();
|
|
992
|
-
}
|
|
993
|
-
},
|
|
994
|
-
get scrollLeftPx() {
|
|
995
|
-
return Math.max(0, getElement()?.scrollLeft ?? 0);
|
|
996
|
-
},
|
|
997
|
-
set scrollLeftPx(value: number) {
|
|
998
|
-
const element = getElement();
|
|
999
|
-
if (element) {
|
|
1000
|
-
element.scrollLeft = Math.max(0, value);
|
|
1001
|
-
emitHorizontalScrollChange();
|
|
1002
|
-
}
|
|
1003
|
-
},
|
|
1004
|
-
get scrollHeight() {
|
|
1005
|
-
return toCellY(getElement()?.scrollHeight ?? 0);
|
|
1006
|
-
},
|
|
1007
|
-
get scrollWidth() {
|
|
1008
|
-
return toCellX(getElement()?.scrollWidth ?? 0);
|
|
1009
|
-
},
|
|
1010
|
-
get scrollHeightPx() {
|
|
1011
|
-
return Math.max(0, getElement()?.scrollHeight ?? 0);
|
|
1012
|
-
},
|
|
1013
|
-
get scrollWidthPx() {
|
|
1014
|
-
return Math.max(0, getElement()?.scrollWidth ?? 0);
|
|
1015
|
-
},
|
|
1016
|
-
get viewport() {
|
|
1017
|
-
const element = getElement();
|
|
1018
|
-
return {
|
|
1019
|
-
width: toCellX(element?.clientWidth ?? 0),
|
|
1020
|
-
height: toCellY(element?.clientHeight ?? 0),
|
|
1021
|
-
};
|
|
1022
|
-
},
|
|
1023
|
-
get viewportPx() {
|
|
1024
|
-
const element = getElement();
|
|
1025
|
-
return {
|
|
1026
|
-
width: Math.max(0, element?.clientWidth ?? 0),
|
|
1027
|
-
height: Math.max(0, element?.clientHeight ?? 0),
|
|
1028
|
-
};
|
|
1029
|
-
},
|
|
1030
|
-
getBoundingClientRect() {
|
|
1031
|
-
const rect = getElement()?.getBoundingClientRect();
|
|
1032
|
-
return {
|
|
1033
|
-
x: rect?.x ?? 0,
|
|
1034
|
-
y: rect?.y ?? 0,
|
|
1035
|
-
width: rect?.width ?? 0,
|
|
1036
|
-
height: rect?.height ?? 0,
|
|
1037
|
-
};
|
|
1038
|
-
},
|
|
1039
|
-
horizontalScrollBar,
|
|
1040
|
-
verticalScrollBar,
|
|
1041
|
-
scrollTo(target: number | { x?: number; y?: number }, y?: number) {
|
|
1042
|
-
const element = getElement();
|
|
1043
|
-
if (!element) return;
|
|
1044
|
-
if (typeof target === "number") {
|
|
1045
|
-
element.scrollTop = Math.max(0, target) * WEB_CELL_HEIGHT;
|
|
1046
|
-
emitVerticalScrollChange();
|
|
1047
|
-
if (typeof y === "number") {
|
|
1048
|
-
element.scrollLeft = Math.max(0, y) * WEB_CELL_WIDTH;
|
|
1049
|
-
emitHorizontalScrollChange();
|
|
1050
|
-
}
|
|
1051
|
-
return;
|
|
1052
|
-
}
|
|
1053
|
-
element.scrollTo({
|
|
1054
|
-
left: Math.max(0, target.x ?? toCellX(element.scrollLeft)) * WEB_CELL_WIDTH,
|
|
1055
|
-
top: Math.max(0, target.y ?? toCellY(element.scrollTop)) * WEB_CELL_HEIGHT,
|
|
1056
|
-
});
|
|
1057
|
-
emitScrollPositionChanges();
|
|
1058
|
-
},
|
|
1059
|
-
scrollToPixels(target: number | { x?: number; y?: number }, y?: number) {
|
|
1060
|
-
const element = getElement();
|
|
1061
|
-
if (!element) return;
|
|
1062
|
-
if (typeof target === "number") {
|
|
1063
|
-
element.scrollTop = Math.max(0, target);
|
|
1064
|
-
emitVerticalScrollChange();
|
|
1065
|
-
if (typeof y === "number") {
|
|
1066
|
-
element.scrollLeft = Math.max(0, y);
|
|
1067
|
-
emitHorizontalScrollChange();
|
|
1068
|
-
}
|
|
1069
|
-
return;
|
|
1070
|
-
}
|
|
1071
|
-
element.scrollTo({
|
|
1072
|
-
left: Math.max(0, target.x ?? element.scrollLeft),
|
|
1073
|
-
top: Math.max(0, target.y ?? element.scrollTop),
|
|
1074
|
-
});
|
|
1075
|
-
emitScrollPositionChanges();
|
|
1076
|
-
},
|
|
1077
|
-
}), [
|
|
1078
|
-
emitHorizontalScrollChange,
|
|
1079
|
-
emitScrollPositionChanges,
|
|
1080
|
-
emitVerticalScrollChange,
|
|
1081
|
-
getElement,
|
|
1082
|
-
horizontalScrollBar,
|
|
1083
|
-
verticalScrollBar,
|
|
1084
|
-
]);
|
|
1085
|
-
|
|
1086
|
-
const scrollable = props.scrollX === true || props.scrollY === true;
|
|
1087
|
-
const overflowX = props.scrollX === true ? "auto" : "hidden";
|
|
1088
|
-
const overflowY = props.scrollY === true ? "auto" : "hidden";
|
|
1089
|
-
const handleScroll = useCallback(() => {
|
|
1090
|
-
emitScrollPositionChanges();
|
|
1091
|
-
markScrollbarActive();
|
|
1092
|
-
if (typeof props.onMouseScroll !== "function") return;
|
|
1093
|
-
if (Date.now() - lastWheelAtRef.current < 32) return;
|
|
1094
|
-
if (scrollFrameRef.current != null) return;
|
|
1095
|
-
scrollFrameRef.current = requestAnimationFrame(() => {
|
|
1096
|
-
scrollFrameRef.current = null;
|
|
1097
|
-
(props.onMouseScroll as () => void)();
|
|
1098
|
-
});
|
|
1099
|
-
}, [emitScrollPositionChanges, markScrollbarActive, props.onMouseScroll]);
|
|
1100
|
-
const handleWheel = useCallback((event: ReactWheelEvent<HTMLDivElement>) => {
|
|
1101
|
-
markScrollbarActive();
|
|
1102
|
-
lastWheelAtRef.current = Date.now();
|
|
1103
|
-
callMouseHandler(props.onMouseScroll, event, "scroll");
|
|
1104
|
-
}, [markScrollbarActive, props.onMouseScroll]);
|
|
1105
|
-
|
|
1106
|
-
return (
|
|
1107
|
-
<div
|
|
1108
|
-
{...cleanDomProps(props)}
|
|
1109
|
-
ref={elementRef}
|
|
1110
|
-
data-gloom-scrollbar-x={props.scrollX === true ? (horizontalScrollBarVisible ? "visible" : "hidden") : undefined}
|
|
1111
|
-
data-gloom-scrollbar-y={props.scrollY === true ? (verticalScrollBarVisible ? "visible" : "hidden") : undefined}
|
|
1112
|
-
data-gloom-scrollbar-active={scrollbarActive ? "true" : undefined}
|
|
1113
|
-
data-gloom-interactive={hasDirectMouseHandler(props) ? "true" : undefined}
|
|
1114
|
-
onMouseDown={(event) => callMouseHandler(props.onMouseDown, event, "down")}
|
|
1115
|
-
onMouseMove={(event) => callMouseHandler(props.onMouseMove, event, "move")}
|
|
1116
|
-
onMouseUp={(event) => callMouseHandler(props.onMouseUp, event, "up")}
|
|
1117
|
-
onMouseOut={(event) => callMouseHandler(props.onMouseOut, event, "out")}
|
|
1118
|
-
onScroll={scrollable ? handleScroll : undefined}
|
|
1119
|
-
onWheel={scrollable ? handleWheel : undefined}
|
|
1120
|
-
style={{
|
|
1121
|
-
...commonStyle(props),
|
|
1122
|
-
overflowX,
|
|
1123
|
-
overflowY,
|
|
1124
|
-
...(props.style as CSSProperties | undefined),
|
|
1125
|
-
...(props.visible === false ? { display: "none" } : undefined),
|
|
1126
|
-
}}
|
|
1127
|
-
>
|
|
1128
|
-
{children as ReactNode}
|
|
1129
|
-
</div>
|
|
1130
|
-
);
|
|
1131
|
-
},
|
|
1132
|
-
);
|
|
1133
|
-
|
|
1134
|
-
function WebAsciiText({
|
|
1135
|
-
text,
|
|
1136
|
-
font = "tiny",
|
|
1137
|
-
color,
|
|
1138
|
-
fg,
|
|
1139
|
-
bg,
|
|
1140
|
-
backgroundColor,
|
|
1141
|
-
selectable = false,
|
|
1142
|
-
...props
|
|
1143
|
-
}: AsciiTextProps) {
|
|
1144
|
-
const lines = renderAsciiText(text, font);
|
|
1145
|
-
const resolvedColor = color ?? fg;
|
|
1146
|
-
const resolvedBackground = bg ?? backgroundColor;
|
|
1147
|
-
return (
|
|
1148
|
-
<div
|
|
1149
|
-
{...cleanDomProps(props)}
|
|
1150
|
-
data-gloom-role={(props["data-gloom-role"] as string | undefined) ?? "ascii-text"}
|
|
1151
|
-
style={{
|
|
1152
|
-
...commonStyle({ ...props, fg: resolvedColor, bg: resolvedBackground }),
|
|
1153
|
-
display: "flex",
|
|
1154
|
-
flexDirection: "column",
|
|
1155
|
-
flexShrink: 0,
|
|
1156
|
-
color: resolvedColor,
|
|
1157
|
-
backgroundColor: resolvedBackground,
|
|
1158
|
-
lineHeight: "12px",
|
|
1159
|
-
whiteSpace: "pre",
|
|
1160
|
-
userSelect: selectable ? "text" : "none",
|
|
1161
|
-
...(props.style as CSSProperties | undefined),
|
|
1162
|
-
}}
|
|
1163
|
-
>
|
|
1164
|
-
{lines.map((line, index) => (
|
|
1165
|
-
<span key={index} style={{ display: "block", height: "12px", lineHeight: "12px" }}>
|
|
1166
|
-
{line}
|
|
1167
|
-
</span>
|
|
1168
|
-
))}
|
|
1169
|
-
</div>
|
|
1170
|
-
);
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
type CssVars = CSSProperties & Record<`--${string}`, string>;
|
|
1174
|
-
|
|
1175
|
-
function WebTabs({
|
|
1176
|
-
tabs,
|
|
1177
|
-
activeValue,
|
|
1178
|
-
onSelect,
|
|
1179
|
-
compact = false,
|
|
1180
|
-
variant = "underline",
|
|
1181
|
-
closeMode = "always",
|
|
1182
|
-
addLabel = "+",
|
|
1183
|
-
onAdd,
|
|
1184
|
-
palette,
|
|
1185
|
-
}: HostTabsProps) {
|
|
1186
|
-
const activeTabRef = useRef<HTMLButtonElement | null>(null);
|
|
1187
|
-
const [hoveredValue, setHoveredValue] = useState<string | null>(null);
|
|
1188
|
-
const showUnderline = variant === "underline" && !compact;
|
|
1189
|
-
const listHeight = showUnderline ? 28 : compact ? WEB_CELL_HEIGHT : "100%";
|
|
1190
|
-
const tabFontSize = compact || showUnderline ? 12 : 13;
|
|
1191
|
-
const tabPaddingInline = showUnderline ? 10 : 8;
|
|
1192
|
-
const tabPaddingBlock = variant === "bare" || variant === "pill" ? 2 : 0;
|
|
1193
|
-
|
|
1194
|
-
useEffect(() => {
|
|
1195
|
-
activeTabRef.current?.scrollIntoView({
|
|
1196
|
-
block: "nearest",
|
|
1197
|
-
inline: "nearest",
|
|
1198
|
-
});
|
|
1199
|
-
}, [activeValue, tabs]);
|
|
1200
|
-
|
|
1201
|
-
const handleWheel = (event: ReactWheelEvent<HTMLDivElement>) => {
|
|
1202
|
-
const element = event.currentTarget;
|
|
1203
|
-
if (element.scrollWidth <= element.clientWidth) return;
|
|
1204
|
-
if (Math.abs(event.deltaX) >= Math.abs(event.deltaY)) return;
|
|
1205
|
-
|
|
1206
|
-
element.scrollLeft += event.deltaY;
|
|
1207
|
-
event.preventDefault();
|
|
1208
|
-
};
|
|
1209
|
-
|
|
1210
|
-
const resolveTabBackground = (active: boolean, hovered: boolean) => {
|
|
1211
|
-
if (active && variant === "pill") {
|
|
1212
|
-
return hovered
|
|
1213
|
-
? `color-mix(in srgb, ${palette.activeBg} 76%, ${palette.hoverBg})`
|
|
1214
|
-
: palette.activeBg;
|
|
1215
|
-
}
|
|
1216
|
-
return hovered ? palette.hoverBg : "transparent";
|
|
1217
|
-
};
|
|
1218
|
-
|
|
1219
|
-
const resolveTabColor = (disabled: boolean, active: boolean, hovered: boolean) => {
|
|
1220
|
-
if (disabled) return palette.disabledFg;
|
|
1221
|
-
if (active && variant === "pill") return palette.activePillFg;
|
|
1222
|
-
if (active) return palette.activeFg;
|
|
1223
|
-
if (hovered) return palette.hoverFg;
|
|
1224
|
-
return palette.inactiveFg;
|
|
1225
|
-
};
|
|
1226
|
-
|
|
1227
|
-
return (
|
|
1228
|
-
<div
|
|
1229
|
-
data-gloom-role="tab-list"
|
|
1230
|
-
role="tablist"
|
|
1231
|
-
onWheel={handleWheel}
|
|
1232
|
-
style={{
|
|
1233
|
-
display: "flex",
|
|
1234
|
-
flexDirection: "row",
|
|
1235
|
-
alignItems: "stretch",
|
|
1236
|
-
gap: 4,
|
|
1237
|
-
width: "100%",
|
|
1238
|
-
height: listHeight,
|
|
1239
|
-
minInlineSize: 0,
|
|
1240
|
-
flexShrink: 0,
|
|
1241
|
-
overflowX: "auto",
|
|
1242
|
-
overflowY: "hidden",
|
|
1243
|
-
paddingInline: variant === "underline" ? 0 : 4,
|
|
1244
|
-
paddingBlock: tabPaddingBlock,
|
|
1245
|
-
marginBottom: showUnderline ? 4 : 0,
|
|
1246
|
-
boxSizing: "border-box",
|
|
1247
|
-
}}
|
|
1248
|
-
>
|
|
1249
|
-
{tabs.map((tab) => {
|
|
1250
|
-
const active = tab.value === activeValue;
|
|
1251
|
-
const disabled = tab.disabled === true;
|
|
1252
|
-
const hovered = hoveredValue === tab.value && !disabled;
|
|
1253
|
-
const closeVisible = !!tab.onClose && (closeMode === "always" || active);
|
|
1254
|
-
const tabStyle = {
|
|
1255
|
-
"--tab-fg": resolveTabColor(disabled, active, hovered),
|
|
1256
|
-
"--tab-hover-fg": palette.hoverFg,
|
|
1257
|
-
"--tab-underline": active ? palette.activeUnderline : palette.inactiveUnderline,
|
|
1258
|
-
"--tab-hover-underline": palette.hoverUnderline,
|
|
1259
|
-
"--tab-hover-bg": palette.hoverBg,
|
|
1260
|
-
"--tab-close-fg": active && variant === "pill" ? palette.activePillFg : palette.closeFg,
|
|
1261
|
-
color: "var(--tab-fg)",
|
|
1262
|
-
flex: "0 0 auto",
|
|
1263
|
-
display: "flex",
|
|
1264
|
-
flexDirection: "row",
|
|
1265
|
-
alignItems: "center",
|
|
1266
|
-
justifyContent: "center",
|
|
1267
|
-
gap: 6,
|
|
1268
|
-
position: "relative",
|
|
1269
|
-
minWidth: 0,
|
|
1270
|
-
height: "100%",
|
|
1271
|
-
paddingInline: tabPaddingInline,
|
|
1272
|
-
paddingBlock: 0,
|
|
1273
|
-
paddingBottom: showUnderline ? 2 : 0,
|
|
1274
|
-
margin: 0,
|
|
1275
|
-
border: 0,
|
|
1276
|
-
borderRadius: variant === "underline" ? 5 : 6,
|
|
1277
|
-
background: resolveTabBackground(active, hovered),
|
|
1278
|
-
font: "inherit",
|
|
1279
|
-
fontSize: tabFontSize,
|
|
1280
|
-
fontWeight: active ? 700 : 500,
|
|
1281
|
-
lineHeight: 1,
|
|
1282
|
-
textAlign: "center",
|
|
1283
|
-
whiteSpace: "nowrap",
|
|
1284
|
-
transition: "background-color 110ms ease, color 110ms ease, box-shadow 110ms ease",
|
|
1285
|
-
cursor: disabled ? "default" : "pointer",
|
|
1286
|
-
} satisfies CssVars;
|
|
1287
|
-
|
|
1288
|
-
return (
|
|
1289
|
-
<button
|
|
1290
|
-
key={tab.value}
|
|
1291
|
-
ref={active ? activeTabRef : undefined}
|
|
1292
|
-
data-gloom-role="tab-button"
|
|
1293
|
-
data-active={active ? "true" : undefined}
|
|
1294
|
-
type="button"
|
|
1295
|
-
role="tab"
|
|
1296
|
-
aria-selected={active}
|
|
1297
|
-
aria-disabled={disabled || undefined}
|
|
1298
|
-
disabled={disabled}
|
|
1299
|
-
style={tabStyle}
|
|
1300
|
-
onMouseEnter={() => setHoveredValue(tab.value)}
|
|
1301
|
-
onMouseLeave={() => setHoveredValue((current) => (current === tab.value ? null : current))}
|
|
1302
|
-
onClick={() => {
|
|
1303
|
-
if (!disabled) onSelect(tab.value);
|
|
1304
|
-
}}
|
|
1305
|
-
onDoubleClick={() => {
|
|
1306
|
-
if (!disabled) tab.onDoubleClick?.(tab.value);
|
|
1307
|
-
}}
|
|
1308
|
-
onContextMenu={tab.onContextMenu ? (event) => {
|
|
1309
|
-
event.preventDefault();
|
|
1310
|
-
event.stopPropagation();
|
|
1311
|
-
tab.onContextMenu?.(tab.value, event);
|
|
1312
|
-
} : undefined}
|
|
1313
|
-
>
|
|
1314
|
-
<span
|
|
1315
|
-
data-gloom-role="tab-label"
|
|
1316
|
-
style={{
|
|
1317
|
-
display: "block",
|
|
1318
|
-
overflow: "hidden",
|
|
1319
|
-
textOverflow: "ellipsis",
|
|
1320
|
-
}}
|
|
1321
|
-
>
|
|
1322
|
-
{tab.label}
|
|
1323
|
-
</span>
|
|
1324
|
-
{closeVisible && (
|
|
1325
|
-
<span
|
|
1326
|
-
data-gloom-role="tab-close"
|
|
1327
|
-
aria-label={`Close ${tab.label}`}
|
|
1328
|
-
role="button"
|
|
1329
|
-
style={{
|
|
1330
|
-
display: "inline-flex",
|
|
1331
|
-
alignItems: "center",
|
|
1332
|
-
justifyContent: "center",
|
|
1333
|
-
width: 16,
|
|
1334
|
-
height: 16,
|
|
1335
|
-
marginRight: -4,
|
|
1336
|
-
borderRadius: 4,
|
|
1337
|
-
color: "var(--tab-close-fg)",
|
|
1338
|
-
fontSize: 12,
|
|
1339
|
-
lineHeight: 1,
|
|
1340
|
-
}}
|
|
1341
|
-
onClick={(event) => {
|
|
1342
|
-
event.preventDefault();
|
|
1343
|
-
event.stopPropagation();
|
|
1344
|
-
tab.onClose?.(tab.value);
|
|
1345
|
-
}}
|
|
1346
|
-
>
|
|
1347
|
-
{"x"}
|
|
1348
|
-
</span>
|
|
1349
|
-
)}
|
|
1350
|
-
{showUnderline && (
|
|
1351
|
-
<span
|
|
1352
|
-
data-gloom-role="tab-underline"
|
|
1353
|
-
aria-hidden="true"
|
|
1354
|
-
style={{
|
|
1355
|
-
position: "absolute",
|
|
1356
|
-
left: 10,
|
|
1357
|
-
right: 10,
|
|
1358
|
-
bottom: 1,
|
|
1359
|
-
height: 2,
|
|
1360
|
-
borderRadius: 999,
|
|
1361
|
-
background: "var(--tab-underline)",
|
|
1362
|
-
opacity: active ? 1 : hovered ? 0.7 : 0,
|
|
1363
|
-
}}
|
|
1364
|
-
/>
|
|
1365
|
-
)}
|
|
1366
|
-
</button>
|
|
1367
|
-
);
|
|
1368
|
-
})}
|
|
1369
|
-
{onAdd && (
|
|
1370
|
-
<button
|
|
1371
|
-
data-gloom-role="tab-button"
|
|
1372
|
-
type="button"
|
|
1373
|
-
style={{
|
|
1374
|
-
"--tab-fg": palette.addFg,
|
|
1375
|
-
"--tab-hover-fg": palette.hoverFg,
|
|
1376
|
-
"--tab-underline": palette.inactiveUnderline,
|
|
1377
|
-
"--tab-hover-underline": palette.hoverUnderline,
|
|
1378
|
-
"--tab-hover-bg": palette.hoverBg,
|
|
1379
|
-
color: hoveredValue === "__add__" ? palette.hoverFg : "var(--tab-fg)",
|
|
1380
|
-
flex: "0 0 auto",
|
|
1381
|
-
display: "inline-flex",
|
|
1382
|
-
alignItems: "center",
|
|
1383
|
-
justifyContent: "center",
|
|
1384
|
-
height: "100%",
|
|
1385
|
-
paddingInline: tabPaddingInline,
|
|
1386
|
-
paddingBlock: 0,
|
|
1387
|
-
margin: 0,
|
|
1388
|
-
border: 0,
|
|
1389
|
-
borderRadius: variant === "underline" ? 5 : 6,
|
|
1390
|
-
background: hoveredValue === "__add__" ? palette.hoverBg : "transparent",
|
|
1391
|
-
font: "inherit",
|
|
1392
|
-
fontSize: tabFontSize,
|
|
1393
|
-
fontWeight: 500,
|
|
1394
|
-
lineHeight: 1,
|
|
1395
|
-
whiteSpace: "nowrap",
|
|
1396
|
-
transition: "background-color 110ms ease, color 110ms ease",
|
|
1397
|
-
cursor: "pointer",
|
|
1398
|
-
} satisfies CssVars}
|
|
1399
|
-
onMouseEnter={() => setHoveredValue("__add__")}
|
|
1400
|
-
onMouseLeave={() => setHoveredValue((current) => (current === "__add__" ? null : current))}
|
|
1401
|
-
onClick={onAdd}
|
|
1402
|
-
>
|
|
1403
|
-
<span
|
|
1404
|
-
data-gloom-role="tab-label"
|
|
1405
|
-
style={{
|
|
1406
|
-
display: "block",
|
|
1407
|
-
}}
|
|
1408
|
-
>
|
|
1409
|
-
{addLabel}
|
|
1410
|
-
</span>
|
|
1411
|
-
</button>
|
|
1412
|
-
)}
|
|
1413
|
-
</div>
|
|
1414
|
-
);
|
|
1415
|
-
}
|
|
16
|
+
} from "./desktop/controls";
|
|
17
|
+
import { WebBox } from "./host/box";
|
|
18
|
+
import { WebChartSurface } from "./host/chart-surface";
|
|
19
|
+
import { WebInput, WebTextarea } from "./host/input";
|
|
20
|
+
import {
|
|
21
|
+
NATIVE_CONTEXT_MENU_SUPPORTED,
|
|
22
|
+
showDesktopContextMenu,
|
|
23
|
+
startElectrobunWindowDrag,
|
|
24
|
+
} from "./host/native";
|
|
25
|
+
import { WebScrollBox } from "./host/scroll-box";
|
|
26
|
+
import { cleanDomProps, commonStyle } from "./host/style";
|
|
27
|
+
import { WebAsciiText, WebSpan, WebStrong, WebText, WebUnderline } from "./host/text";
|
|
28
|
+
import { WebTabs } from "./host/tabs";
|
|
1416
29
|
|
|
1417
30
|
export const webUiHost: UiHost = {
|
|
1418
31
|
kind: "desktop-web",
|
|
@@ -1428,31 +41,10 @@ export const webUiHost: UiHost = {
|
|
|
1428
41
|
nativeContextMenu: NATIVE_CONTEXT_MENU_SUPPORTED,
|
|
1429
42
|
},
|
|
1430
43
|
Box: WebBox,
|
|
1431
|
-
Text:
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
data-gloom-interactive={hasDirectMouseHandler(props) ? "true" : undefined}
|
|
1436
|
-
style={{ ...textStyle(props), ...(props.style as CSSProperties | undefined) }}
|
|
1437
|
-
>
|
|
1438
|
-
{renderTextContent(children, props.content, props)}
|
|
1439
|
-
</span>
|
|
1440
|
-
),
|
|
1441
|
-
Span: ({ children, ...props }) => (
|
|
1442
|
-
<span {...cleanDomProps(props)} style={{ ...textStyle(props), ...(props.style as CSSProperties | undefined) }}>
|
|
1443
|
-
{children as ReactNode}
|
|
1444
|
-
</span>
|
|
1445
|
-
),
|
|
1446
|
-
Strong: ({ children, ...props }) => (
|
|
1447
|
-
<strong {...cleanDomProps(props)} style={{ ...textStyle({ ...props, bold: true }), ...(props.style as CSSProperties | undefined) }}>
|
|
1448
|
-
{children as ReactNode}
|
|
1449
|
-
</strong>
|
|
1450
|
-
),
|
|
1451
|
-
Underline: ({ children, ...props }) => (
|
|
1452
|
-
<span {...cleanDomProps(props)} style={{ ...textStyle({ ...props, underline: true }), ...(props.style as CSSProperties | undefined) }}>
|
|
1453
|
-
{children as ReactNode}
|
|
1454
|
-
</span>
|
|
1455
|
-
),
|
|
44
|
+
Text: WebText,
|
|
45
|
+
Span: WebSpan,
|
|
46
|
+
Strong: WebStrong,
|
|
47
|
+
Underline: WebUnderline,
|
|
1456
48
|
ScrollBox: WebScrollBox,
|
|
1457
49
|
Input: WebInput,
|
|
1458
50
|
Textarea: WebTextarea,
|
|
@@ -1465,30 +57,7 @@ export const webUiHost: UiHost = {
|
|
|
1465
57
|
PageStackView: WebPageStackView,
|
|
1466
58
|
DataTable: WebDataTable,
|
|
1467
59
|
Tabs: WebTabs,
|
|
1468
|
-
ChartSurface:
|
|
1469
|
-
function WebChartSurface({ children, ...props }, ref) {
|
|
1470
|
-
const bitmap = (props.bitmap ?? null) as BitmapSurface | null;
|
|
1471
|
-
const bitmaps = (props.bitmaps ?? null) as readonly BitmapSurface[] | null;
|
|
1472
|
-
const layers = bitmaps ?? (bitmap ? [bitmap] : []);
|
|
1473
|
-
const crosshair = (props.crosshair ?? null) as ChartCrosshairOverlay | null;
|
|
1474
|
-
const baseLayer = layers[0] ?? null;
|
|
1475
|
-
return (
|
|
1476
|
-
<WebBox
|
|
1477
|
-
{...props}
|
|
1478
|
-
ref={ref as Ref<HTMLDivElement>}
|
|
1479
|
-
data-gloom-role={(props["data-gloom-role"] as string | undefined) ?? "chart-surface"}
|
|
1480
|
-
style={{ position: "relative", overflow: "hidden", ...(props.style as CSSProperties | undefined) }}
|
|
1481
|
-
>
|
|
1482
|
-
{layers.length > 0
|
|
1483
|
-
? layers.map((layer, index) => (
|
|
1484
|
-
<BoxLayer key={`${layer.width}x${layer.height}:${index}`} index={index} bitmap={layer} />
|
|
1485
|
-
))
|
|
1486
|
-
: children as ReactNode}
|
|
1487
|
-
<ChartCrosshair bitmap={baseLayer} crosshair={crosshair} />
|
|
1488
|
-
</WebBox>
|
|
1489
|
-
);
|
|
1490
|
-
},
|
|
1491
|
-
),
|
|
60
|
+
ChartSurface: WebChartSurface,
|
|
1492
61
|
ImageSurface: ({ children, src, alt = "", objectFit = "contain", ...props }) => {
|
|
1493
62
|
const imageSrc = typeof src === "string" ? src.trim() : "";
|
|
1494
63
|
const [failed, setFailed] = useState(false);
|
|
@@ -1587,21 +156,5 @@ export const webRendererHost: RendererHost = {
|
|
|
1587
156
|
sound: notification.sound,
|
|
1588
157
|
}).catch(() => {});
|
|
1589
158
|
},
|
|
1590
|
-
|
|
1591
|
-
if (!NATIVE_CONTEXT_MENU_SUPPORTED) return false;
|
|
1592
|
-
contextMenuActionScope.clear();
|
|
1593
|
-
const requestId = createContextMenuRequestId();
|
|
1594
|
-
const prepared = prepareDesktopContextMenu(items, requestId);
|
|
1595
|
-
if (prepared.menu.length === 0) return false;
|
|
1596
|
-
|
|
1597
|
-
contextMenuActionScope.bind(requestId, prepared.actions);
|
|
1598
|
-
|
|
1599
|
-
try {
|
|
1600
|
-
await backendRequest("host.showContextMenu", { menu: prepared.menu });
|
|
1601
|
-
return true;
|
|
1602
|
-
} catch {
|
|
1603
|
-
contextMenuActionScope.clearRequest(requestId);
|
|
1604
|
-
return false;
|
|
1605
|
-
}
|
|
1606
|
-
},
|
|
159
|
+
showContextMenu: showDesktopContextMenu,
|
|
1607
160
|
};
|