@gloom-sh/terminal 0.19.5 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -4
- package/package.json +6 -5
- package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
- package/patches/electrobun-devkit@2.0.5.patch +148 -0
- package/src/api-client/bond-trades.ts +59 -0
- package/src/api-client/data.ts +21 -0
- package/src/api-client/equity-screener.ts +23 -0
- package/src/api-client/index.ts +2 -0
- package/src/api-client/types/account.ts +86 -0
- package/src/api-client/types/assist.ts +32 -0
- package/src/api-client/types/auth.ts +63 -0
- package/src/api-client/types/billing.ts +54 -0
- package/src/api-client/types/chat.ts +180 -0
- package/src/api-client/types/congress.ts +107 -0
- package/src/api-client/types/credit.ts +110 -0
- package/src/api-client/types/econ.ts +158 -0
- package/src/api-client/types/equity-diagnostic.ts +73 -0
- package/src/api-client/types/filings-and-calls.ts +350 -0
- package/src/api-client/types/index.ts +25 -0
- package/src/api-client/types/jobs.ts +147 -0
- package/src/api-client/types/market.ts +122 -0
- package/src/api-client/types/news.ts +91 -0
- package/src/api-client/types/notes-and-theses.ts +172 -0
- package/src/api-client/types/quotes.ts +28 -0
- package/src/api-client/types/scanners.ts +125 -0
- package/src/api-client/types/screener.ts +65 -0
- package/src/api-client/types/search.ts +107 -0
- package/src/api-client/types/sync.ts +14 -0
- package/src/api-client/types/team-collections.ts +43 -0
- package/src/api-client/types/team-views.ts +32 -0
- package/src/api-client/types/teams.ts +135 -0
- package/src/api-client/types/ticker-data.ts +57 -0
- package/src/api-client/types/tweets.ts +59 -0
- package/src/api-client/types/world-venues.ts +23 -0
- package/src/app/pane-runtime/index.tsx +2 -0
- package/src/app/pane-runtime/plugin-bindings.ts +10 -1
- package/src/app/runtime/desktop-deeplink.ts +41 -6
- package/src/app/star-prompt/status-line.tsx +1 -1
- package/src/app.tsx +64 -23
- package/src/architecture/ui-tokens-allowlist.json +0 -8
- package/src/cli/commands/market.ts +149 -10
- package/src/cli/commands/search.ts +21 -3
- package/src/cli/commands/ticker.ts +90 -36
- package/src/cli/desktop-pane-shot-browser.ts +69 -3
- package/src/cli/glossary.ts +3 -3
- package/src/cli/known-gaps.ts +8 -0
- package/src/cli/listing-arg.ts +12 -0
- package/src/cli/pane-functions/capabilities.ts +2 -0
- package/src/cli/pane-functions/catalog.ts +25 -5
- package/src/cli/pane-functions/function-help.ts +8 -5
- package/src/cli/pane-functions/headless.ts +4 -3
- package/src/cli/pane-functions/resolver.ts +75 -2
- package/src/cli/quote-answer.ts +9 -0
- package/src/cli/symbol-list.ts +54 -2
- package/src/cli/symbol-rows.ts +14 -2
- package/src/cli/ticker-resolution.ts +89 -20
- package/src/components/chart/composite/axis-overlays.tsx +60 -27
- package/src/components/chart/composite/composite-chart.tsx +118 -63
- package/src/components/chart/composite/cursor-source.ts +111 -0
- package/src/components/chart/composite/format.ts +168 -6
- package/src/components/chart/composite/legend.tsx +8 -4
- package/src/components/chart/composite/panel-labels.ts +20 -1
- package/src/components/chart/composite/panel-surface.tsx +201 -92
- package/src/components/chart/composite/price-axis-labels.tsx +92 -46
- package/src/components/chart/composite/price-series.ts +31 -8
- package/src/components/chart/composite/scene.ts +154 -59
- package/src/components/chart/composite/series-axis-tags.tsx +4 -2
- package/src/components/chart/composite/time-axis.ts +13 -5
- package/src/components/chart/composite/time-scale.ts +211 -56
- package/src/components/chart/composite/types.ts +11 -1
- package/src/components/chart/composite/use-composite-chart-keyboard.ts +43 -14
- package/src/components/chart/curve/curve-surface.tsx +5 -2
- package/src/components/chart/curve/model.ts +4 -1
- package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
- package/src/components/chart/static/series.ts +3 -0
- package/src/components/command-bar/commands/collection-list.ts +81 -0
- package/src/components/command-bar/commands/direct/index.ts +6 -0
- package/src/components/command-bar/commands/registry.ts +8 -0
- package/src/components/command-bar/layout-items/current-layout.ts +22 -1
- package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
- package/src/components/command-bar/pane-templates/items.ts +19 -3
- package/src/components/command-bar/pane-templates/workflow.ts +5 -0
- package/src/components/command-bar/routes/root/results.ts +23 -3
- package/src/components/command-bar/routes/root/selection.ts +4 -2
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
- package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
- package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
- package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
- package/src/components/command-bar/surface/environment.ts +2 -0
- package/src/components/command-bar/view-model.ts +7 -0
- package/src/components/command-bar/workflow/ops.ts +2 -1
- package/src/components/command-bar/workflow/tickers.ts +20 -0
- package/src/components/data-table/export.ts +4 -1
- package/src/components/layout/detached-pane-shell.tsx +10 -37
- package/src/components/layout/double-escape-close.ts +90 -0
- package/src/components/layout/header.tsx +3 -2
- package/src/components/layout/market-summary.ts +6 -3
- package/src/components/layout/pane/footer/index.tsx +2 -6
- package/src/components/layout/pane/footer/model.ts +6 -12
- package/src/components/layout/shell/active-drag.ts +53 -11
- package/src/components/layout/shell/drag/magnets.ts +128 -19
- package/src/components/layout/shell/menu.ts +15 -1
- package/src/components/layout/shell/pane/actions.ts +10 -2
- package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
- package/src/components/layout/shell/ticker-link-menu.ts +12 -3
- package/src/components/layout/status-bar.tsx +24 -78
- package/src/components/layout/status-widget-space.ts +5 -5
- package/src/components/onboarding/onboarding-keyboard.ts +5 -1
- package/src/components/onboarding/onboarding-wizard.tsx +15 -4
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +9 -6
- package/src/components/onboarding/use-onboarding-progress.ts +20 -1
- package/src/components/price-sparkline/view.tsx +14 -6
- package/src/components/ticker/badge/index.tsx +8 -4
- package/src/components/ticker/badge/list.tsx +23 -7
- package/src/components/ui/column-grid.tsx +8 -2
- package/src/components/ui/data-table/index.tsx +5 -1
- package/src/components/ui/data-table/opentui/model.ts +4 -1
- package/src/components/ui/data-table/render-cell.ts +19 -0
- package/src/components/ui/delayed-mark.tsx +59 -7
- package/src/components/ui/icon.tsx +1 -8
- package/src/components/ui/menu.tsx +6 -1
- package/src/components/ui/tabs.tsx +5 -2
- package/src/core/state/app/layout.ts +18 -3
- package/src/core/state/app/state.ts +2 -0
- package/src/core/state/app/types.ts +5 -0
- package/src/data/config/layout.ts +3 -0
- package/src/data/config/store/normalize.ts +39 -4
- package/src/i18n/es.ts +13 -3
- package/src/i18n/ja.ts +13 -3
- package/src/i18n/ko.ts +13 -3
- package/src/i18n/zh-cn.ts +13 -3
- package/src/i18n/zh-tw.ts +13 -3
- package/src/layout/pane-manager/floating-placement.ts +7 -4
- package/src/layout/pane-manager/floating.ts +5 -2
- package/src/market-data/bond-funds.ts +19 -0
- package/src/market-data/futures-contract.ts +14 -3
- package/src/market-data/market/freshness.ts +18 -0
- package/src/market-data/market/status.ts +15 -2
- package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
- package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
- package/src/plugins/builtin/bond-calculator/model.ts +14 -5
- package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
- package/src/plugins/builtin/buildout/cells.tsx +25 -45
- package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
- package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
- package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
- package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
- package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
- package/src/plugins/builtin/buildout/format.ts +23 -1
- package/src/plugins/builtin/buildout/model/types.ts +1 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
- package/src/plugins/builtin/buildout/table-model.ts +12 -4
- package/src/plugins/builtin/cds/headless.ts +1 -0
- package/src/plugins/builtin/cds/index.tsx +1 -1
- package/src/plugins/builtin/chat/content/composer.tsx +21 -27
- package/src/plugins/builtin/chat/content/index.tsx +31 -3
- package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
- package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
- package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
- package/src/plugins/builtin/cloud/plugin.tsx +2 -0
- package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
- package/src/plugins/builtin/congress-trades/model.ts +2 -1
- package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
- package/src/plugins/builtin/correlation/headless.ts +3 -2
- package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
- package/src/plugins/builtin/custom-view/index.tsx +1 -1
- package/src/plugins/builtin/custom-view/loader.ts +85 -8
- package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
- package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
- package/src/plugins/builtin/debt-maturities/model.ts +66 -0
- package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
- package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
- package/src/plugins/builtin/econ/calendar-model.ts +28 -6
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
- package/src/plugins/builtin/equity-screener/headless.ts +37 -3
- package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
- package/src/plugins/builtin/equity-screener/model.ts +238 -27
- package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
- package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
- package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
- package/src/plugins/builtin/executives/format.ts +5 -4
- package/src/plugins/builtin/executives/pane.tsx +1 -1
- package/src/plugins/builtin/futures-curve/client.ts +19 -0
- package/src/plugins/builtin/futures-curve/headless.ts +52 -13
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +77 -6
- package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
- package/src/plugins/builtin/help/index.tsx +55 -1
- package/src/plugins/builtin/insider/model.ts +30 -2
- package/src/plugins/builtin/jobs/model.ts +2 -2
- package/src/plugins/builtin/macro-day/client.ts +41 -0
- package/src/plugins/builtin/macro-day/headless.ts +19 -9
- package/src/plugins/builtin/macro-day/model.ts +3 -1
- package/src/plugins/builtin/market-movers/index.tsx +4 -3
- package/src/plugins/builtin/mna/distress/headless.ts +1 -0
- package/src/plugins/builtin/mna/model.ts +2 -2
- package/src/plugins/builtin/notes/files.ts +2 -0
- package/src/plugins/builtin/notes/owner.tsx +20 -1
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
- package/src/plugins/builtin/notes/store.ts +6 -1
- package/src/plugins/builtin/perps/pane.tsx +3 -1
- package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
- package/src/plugins/builtin/rate-path/headless.ts +24 -10
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
- package/src/plugins/builtin/research/event-model.ts +10 -3
- package/src/plugins/builtin/research/events-headless.ts +20 -2
- package/src/plugins/builtin/sec/fund-facts.ts +17 -1
- package/src/plugins/builtin/sec/index.tsx +1 -1
- package/src/plugins/builtin/series-inventory.ts +1 -0
- package/src/plugins/builtin/shared/earnings-report.ts +7 -2
- package/src/plugins/builtin/shared/members-menu.tsx +103 -38
- package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
- package/src/plugins/builtin/short-interest/headless.ts +1 -1
- package/src/plugins/builtin/short-interest/model.ts +15 -6
- package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
- package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
- package/src/plugins/builtin/short-interest/types.ts +2 -0
- package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
- package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
- package/src/plugins/builtin/time-sales/pane.tsx +3 -2
- package/src/plugins/builtin/trace-bonds/client.ts +7 -4
- package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
- package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
- package/src/plugins/builtin/trace-bonds/history.ts +155 -0
- package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
- package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
- package/src/plugins/builtin/volatility/client.ts +6 -1
- package/src/plugins/builtin/volatility/headless.ts +0 -1
- package/src/plugins/builtin/yield-curve/curves.ts +15 -0
- package/src/plugins/builtin/yield-curve/headless.ts +6 -1
- package/src/plugins/builtin/yield-curve/index.tsx +5 -8
- package/src/plugins/host-modules.ts +22 -3
- package/src/plugins/host-smoke.ts +6 -3
- package/src/plugins/installer.ts +16 -3
- package/src/plugins/plugin-names.ts +11 -2
- package/src/portfolio/collection-name.ts +19 -0
- package/src/remote/controller.ts +9 -2
- package/src/remote/schema.ts +2 -1
- package/src/renderers/browser/http-proxy-transport.ts +78 -8
- package/src/renderers/cloudflare/http-proxy.ts +73 -3
- package/src/renderers/cloudflare/proxy-session.ts +47 -24
- package/src/renderers/cloudflare/worker.ts +44 -4
- package/src/renderers/desktop/geometry.ts +279 -0
- package/src/renderers/desktop/screen-setup.ts +246 -0
- package/src/renderers/desktop/sequential-window-host.ts +179 -0
- package/src/renderers/desktop/test-utils.ts +71 -0
- package/src/renderers/desktop/window-controller.ts +433 -0
- package/src/renderers/desktop/window-host.ts +70 -0
- package/src/renderers/desktop/window-layouts.ts +630 -0
- package/src/renderers/dom/data-frames.ts +15 -4
- package/src/renderers/dom/desktop/icons.tsx +0 -2
- package/src/renderers/dom/styles.css +0 -3
- package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
- package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
- package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
- package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
- package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
- package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
- package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
- package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
- package/src/renderers/electrobun/bun/index.ts +22 -109
- package/src/renderers/electrobun/bun/window/create.ts +23 -3
- package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
- package/src/renderers/electrobun/bun/window/events.ts +4 -4
- package/src/renderers/electrobun/bun/window/focus.ts +0 -25
- package/src/renderers/electrobun/bun/window/frame.ts +2 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
- package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
- package/src/renderers/electrobun/shared/protocol.ts +44 -2
- package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
- package/src/renderers/electrobun/view/main.tsx +13 -7
- package/src/series/fred-argument.ts +17 -0
- package/src/sources/gloomberb-cloud/index.ts +5 -7
- package/src/sources/provider-router/batches.ts +18 -3
- package/src/sources/provider-router/financial-routes.ts +7 -1
- package/src/sources/provider-router/financials.ts +18 -4
- package/src/state/app/context/index.tsx +16 -2
- package/src/state/desktop-windows.ts +63 -0
- package/src/sync/other-window-tabs.ts +62 -0
- package/src/tickers/company-name-listing.ts +23 -3
- package/src/tickers/listing-fate.ts +147 -1
- package/src/tickers/terminal-codes.ts +5 -0
- package/src/time-series/types.ts +6 -0
- package/src/types/config.ts +10 -1
- package/src/types/data-provider.ts +14 -0
- package/src/types/desktop-window.ts +71 -2
- package/src/types/financials.ts +19 -3
- package/src/types/headless.ts +21 -0
- package/src/types/plugin.ts +6 -0
- package/src/ui/index.tsx +14 -13
- package/src/ui/same-props.ts +58 -0
- package/src/utils/cli-output.ts +33 -4
- package/src/utils/double-escape-close.ts +38 -16
- package/src/utils/format.ts +30 -5
- package/src/utils/futures-generic.ts +12 -0
- package/src/utils/http-proxy-upstream.ts +6 -2
- package/src/utils/plugin-proxy-hosts.json +0 -4
- package/src/utils/plugin-proxy-hosts.ts +22 -0
- package/src/utils/price-earnings.ts +18 -0
- package/src/utils/sec-filings.ts +7 -1
- package/patches/electrobun@1.18.1.patch +0 -633
- package/src/api-client/types.ts +0 -2441
|
@@ -37,13 +37,24 @@ const MAGNET_RELEASE_PX = 12;
|
|
|
37
37
|
const TERMINAL_MAGNETS: MagnetDistances = { catchX: 1, catchY: 1, releaseX: 2, releaseY: 2 };
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Desktop:
|
|
41
|
-
*
|
|
42
|
-
* pane follows the pointer exactly. Holding an edge on every line a window
|
|
43
|
-
* crossed on its way stopped it for 20 px at each one and then jumped it,
|
|
44
|
-
* which read as a drag that lags and stutters.
|
|
40
|
+
* Desktop: past this pointer speed, in catch distances a second (300 px/s),
|
|
41
|
+
* a release lands the pane where the pointer puts it, its magnets left out.
|
|
45
42
|
*/
|
|
46
43
|
const MAGNET_TRAVEL_SPEED = 300 / MAGNET_CATCH_PX;
|
|
44
|
+
/**
|
|
45
|
+
* Desktop: below this pointer speed (60 px/s, about a px a frame) the pointer
|
|
46
|
+
* is placing the pane, and it is drawn where its magnets hold it; faster, it
|
|
47
|
+
* is drawn under the pointer. Drawing the magnets at a hand's usual speed
|
|
48
|
+
* held the pane on each line it crossed, then jumped it up to 18 px, which
|
|
49
|
+
* read as a drag that lags and stutters.
|
|
50
|
+
*/
|
|
51
|
+
const MAGNET_PLACE_SPEED = 60 / MAGNET_CATCH_PX;
|
|
52
|
+
/**
|
|
53
|
+
* How fast the drawn pane glides between the pointer's place and the
|
|
54
|
+
* magnets', 1/s: a critically damped spring that settles in about 0.17 s and
|
|
55
|
+
* moves it at most about a fifth of the distance in a 60 Hz frame.
|
|
56
|
+
*/
|
|
57
|
+
const GLIDE_RATE = 35;
|
|
47
58
|
/** How far back the pointer's speed is read, ms: a few frames. */
|
|
48
59
|
const SPEED_WINDOW_MS = 64;
|
|
49
60
|
/** How long the pointer rests before the magnets catch where it stopped, ms. */
|
|
@@ -66,9 +77,10 @@ function trackPointer(track: PointerSample[], sample: PointerSample): void {
|
|
|
66
77
|
/**
|
|
67
78
|
* Desktop: when a moving pane's magnets act, over one drag. `travelling`
|
|
68
79
|
* takes each move and says whether the pointer is on its way somewhere; while
|
|
69
|
-
* it is, the pane
|
|
70
|
-
* to run once the pointer has stopped for
|
|
71
|
-
* catch where it stopped.
|
|
80
|
+
* it is, a release lands the pane where the pointer puts it, and `rest` (the
|
|
81
|
+
* move run again) is set to run once the pointer has stopped for
|
|
82
|
+
* MAGNET_REST_MS, so the magnets catch where it stopped. `placing` says
|
|
83
|
+
* whether the magnets are drawn. Any later move drops that check, travelling or not:
|
|
72
84
|
* run after a slower move, it would put the pane back where the pointer was.
|
|
73
85
|
* The check runs at the start of a frame, after the moves that frame brings,
|
|
74
86
|
* so a page drawing fewer frames than 1 / MAGNET_REST_MS still sees a
|
|
@@ -76,6 +88,8 @@ function trackPointer(track: PointerSample[], sample: PointerSample): void {
|
|
|
76
88
|
*/
|
|
77
89
|
export interface MagnetPace {
|
|
78
90
|
travelling(sample: PointerSample, distances: MagnetDistances, rest?: () => void): boolean;
|
|
91
|
+
/** Whether the pointer, as of `now`, moves slowly enough to be placing the pane: its magnets are drawn. */
|
|
92
|
+
placing(now: number, distances: MagnetDistances): boolean;
|
|
79
93
|
/** Drops the rest check: another event of the drag came first. */
|
|
80
94
|
cancel(): void;
|
|
81
95
|
/** Forgets the pointer's path, for a new drag. */
|
|
@@ -98,7 +112,7 @@ export function createMagnetPace(): MagnetPace {
|
|
|
98
112
|
const last = track[track.length - 1];
|
|
99
113
|
// The same place again (a rest check, a repeated event) is not a move.
|
|
100
114
|
if (!last || last.x !== sample.x || last.y !== sample.y) trackPointer(track, sample);
|
|
101
|
-
if (
|
|
115
|
+
if (pointerSpeed(track, sample.t, distances) <= MAGNET_TRAVEL_SPEED) return false;
|
|
102
116
|
if (onRest) {
|
|
103
117
|
rest = setTimeout(() => {
|
|
104
118
|
rest = null;
|
|
@@ -111,6 +125,7 @@ export function createMagnetPace(): MagnetPace {
|
|
|
111
125
|
}
|
|
112
126
|
return true;
|
|
113
127
|
},
|
|
128
|
+
placing: (now, distances) => pointerSpeed(track, now, distances) < MAGNET_PLACE_SPEED,
|
|
114
129
|
cancel,
|
|
115
130
|
reset() {
|
|
116
131
|
cancel();
|
|
@@ -120,15 +135,14 @@ export function createMagnetPace(): MagnetPace {
|
|
|
120
135
|
}
|
|
121
136
|
|
|
122
137
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
* sits on.
|
|
138
|
+
* How fast the pointer moves as of `now`: how far it went over the last few
|
|
139
|
+
* frames, in catch distances a second; still since then, none. A move with
|
|
140
|
+
* nothing before it (the first of a drag) is as fast as can be, so a pane
|
|
141
|
+
* leaves its spot without catching the lines it sits on.
|
|
128
142
|
*/
|
|
129
|
-
function
|
|
143
|
+
function pointerSpeed(track: readonly PointerSample[], now: number, distances: MagnetDistances): number {
|
|
130
144
|
const latest = track[track.length - 1];
|
|
131
|
-
if (!latest) return
|
|
145
|
+
if (!latest) return 0;
|
|
132
146
|
const since = now - SPEED_WINDOW_MS;
|
|
133
147
|
let from = track[0]!;
|
|
134
148
|
for (const sample of track) {
|
|
@@ -136,10 +150,105 @@ function pointerTravelling(track: readonly PointerSample[], now: number, distanc
|
|
|
136
150
|
from = sample;
|
|
137
151
|
}
|
|
138
152
|
const span = Math.min(SPEED_WINDOW_MS, now - from.t);
|
|
139
|
-
if (from === latest) return track.length === 1 && span <= 0;
|
|
140
|
-
if (span <= 0) return
|
|
153
|
+
if (from === latest) return track.length === 1 && span <= 0 ? Infinity : 0;
|
|
154
|
+
if (span <= 0) return Infinity;
|
|
141
155
|
const catches = Math.hypot((latest.x - from.x) / distances.catchX, (latest.y - from.y) / distances.catchY);
|
|
142
|
-
return (catches / span) * 1000
|
|
156
|
+
return (catches / span) * 1000;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** An offset of a moving pane's drawn place from where the pointer puts it, in cells. */
|
|
160
|
+
export interface GlideOffset {
|
|
161
|
+
x: number;
|
|
162
|
+
y: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const NO_GLIDE: GlideOffset = { x: 0, y: 0 };
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Desktop: where a moving pane is drawn, as an offset from where the pointer
|
|
169
|
+
* puts it, gliding toward `target` (where its magnets hold it, or nothing):
|
|
170
|
+
* a catch or a release moves it over a few frames instead of in one, and it
|
|
171
|
+
* comes to rest exactly on `target`, so it rests and lands where it would
|
|
172
|
+
* have without the glide.
|
|
173
|
+
*/
|
|
174
|
+
export interface MagnetGlide {
|
|
175
|
+
step(now: number, target: GlideOffset): GlideOffset;
|
|
176
|
+
/** Whether it rests on `target`. */
|
|
177
|
+
settled(target: GlideOffset): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Draws the pane now with `draw`, and on each frame after until `draw`
|
|
180
|
+
* says it rests: the frames that carry a glide on once the pointer stops.
|
|
181
|
+
* A later `draw` takes over from an earlier one.
|
|
182
|
+
*/
|
|
183
|
+
follow(draw: () => boolean): void;
|
|
184
|
+
/** Back under the pointer, with no frame to come: a drag ended or began. */
|
|
185
|
+
reset(): void;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function requestFrame(callback: () => void): ReturnType<typeof setTimeout> | number {
|
|
189
|
+
return typeof requestAnimationFrame === "function" ? requestAnimationFrame(callback) : setTimeout(callback, 16);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function cancelFrame(frame: ReturnType<typeof setTimeout> | number): void {
|
|
193
|
+
if (typeof cancelAnimationFrame === "function" && typeof frame === "number") cancelAnimationFrame(frame);
|
|
194
|
+
else clearTimeout(frame as ReturnType<typeof setTimeout>);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function createMagnetGlide(): MagnetGlide {
|
|
198
|
+
let x = 0;
|
|
199
|
+
let y = 0;
|
|
200
|
+
let vx = 0;
|
|
201
|
+
let vy = 0;
|
|
202
|
+
let last: number | null = null;
|
|
203
|
+
let frame: ReturnType<typeof setTimeout> | number | null = null;
|
|
204
|
+
let drawing: (() => boolean) | null = null;
|
|
205
|
+
const stop = () => {
|
|
206
|
+
if (frame !== null) cancelFrame(frame);
|
|
207
|
+
frame = null;
|
|
208
|
+
drawing = null;
|
|
209
|
+
};
|
|
210
|
+
const tick = () => {
|
|
211
|
+
frame = null;
|
|
212
|
+
if (drawing && !drawing()) frame = requestFrame(tick);
|
|
213
|
+
};
|
|
214
|
+
// One axis of a critically damped spring after `dt` seconds: [place, speed].
|
|
215
|
+
const spring = (place: number, speed: number, target: number, dt: number): [number, number] => {
|
|
216
|
+
const off = place - target;
|
|
217
|
+
const decay = Math.exp(-GLIDE_RATE * dt);
|
|
218
|
+
const pull = speed + GLIDE_RATE * off;
|
|
219
|
+
return [target + (off + pull * dt) * decay, (speed - GLIDE_RATE * pull * dt) * decay];
|
|
220
|
+
};
|
|
221
|
+
const settled = (target: GlideOffset) => Math.abs(x - target.x) < 1e-3 && Math.abs(y - target.y) < 1e-3 && Math.abs(vx) < 1e-2 && Math.abs(vy) < 1e-2;
|
|
222
|
+
return {
|
|
223
|
+
step(now, target) {
|
|
224
|
+
// A frame drawn late moves it no further than a tenth of a second would.
|
|
225
|
+
const dt = last === null ? 0 : Math.max(0, Math.min(0.1, (now - last) / 1000));
|
|
226
|
+
last = now;
|
|
227
|
+
[x, vx] = spring(x, vx, target.x, dt);
|
|
228
|
+
[y, vy] = spring(y, vy, target.y, dt);
|
|
229
|
+
if (settled(target)) {
|
|
230
|
+
x = target.x;
|
|
231
|
+
y = target.y;
|
|
232
|
+
vx = 0;
|
|
233
|
+
vy = 0;
|
|
234
|
+
}
|
|
235
|
+
return { x, y };
|
|
236
|
+
},
|
|
237
|
+
settled,
|
|
238
|
+
follow(draw) {
|
|
239
|
+
drawing = draw;
|
|
240
|
+
if (draw()) stop();
|
|
241
|
+
else frame ??= requestFrame(tick);
|
|
242
|
+
},
|
|
243
|
+
reset() {
|
|
244
|
+
stop();
|
|
245
|
+
x = 0;
|
|
246
|
+
y = 0;
|
|
247
|
+
vx = 0;
|
|
248
|
+
vy = 0;
|
|
249
|
+
last = null;
|
|
250
|
+
},
|
|
251
|
+
};
|
|
143
252
|
}
|
|
144
253
|
|
|
145
254
|
/**
|
|
@@ -19,6 +19,7 @@ import { PANE_MANAGEMENT_ACCELERATORS, type PaneManagementAccelerators } from ".
|
|
|
19
19
|
import { t, tf } from "../../../i18n";
|
|
20
20
|
import { displayWidth } from "../../../utils/format";
|
|
21
21
|
import { fireAndForget } from "../../../utils/fire-and-forget";
|
|
22
|
+
import { getDesktopWindows, windowMoveTargets } from "../../../state/desktop-windows";
|
|
22
23
|
|
|
23
24
|
const MENU_MIN_WIDTH = 18;
|
|
24
25
|
const MENU_MAX_WIDTH = 44;
|
|
@@ -217,7 +218,9 @@ export function menuForPane(
|
|
|
217
218
|
});
|
|
218
219
|
}
|
|
219
220
|
|
|
220
|
-
|
|
221
|
+
// Popped-out panes belong to the main window; elsewhere a pane moves to a window instead.
|
|
222
|
+
const windows = getDesktopWindows();
|
|
223
|
+
if (desktopWindowBridge?.kind === "main" && desktopWindowBridge.popOutPane && (!windows || windows.windowId === "main")) {
|
|
221
224
|
baseActions.push({
|
|
222
225
|
id: "pop-out",
|
|
223
226
|
label: "Pop Out",
|
|
@@ -227,6 +230,17 @@ export function menuForPane(
|
|
|
227
230
|
},
|
|
228
231
|
});
|
|
229
232
|
}
|
|
233
|
+
if (windows) {
|
|
234
|
+
for (const move of windowMoveTargets(windows, { prefix: "pane" })) {
|
|
235
|
+
baseActions.push({
|
|
236
|
+
id: `move-to-window:${move.key}`,
|
|
237
|
+
label: move.label,
|
|
238
|
+
onSelect: () => {
|
|
239
|
+
fireAndForget(windows.movePane(pane.instance.instanceId, move.target), "desktop.movePaneToWindow");
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
230
244
|
|
|
231
245
|
const locked = isPaneLocked(pane.instance);
|
|
232
246
|
baseActions.push({
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
exportPaneTableCsv,
|
|
21
21
|
hasPaneTableExporter,
|
|
22
22
|
} from "../../../../state/pane-table-export-registry";
|
|
23
|
+
import { getDesktopWindows } from "../../../../state/desktop-windows";
|
|
24
|
+
import { getTopFloatingPaneId } from "../../../../core/state/app/layout";
|
|
23
25
|
|
|
24
26
|
function notifyPaneLocked(pluginRegistry: PluginRegistry): void {
|
|
25
27
|
pluginRegistry.notify({ body: "Pane is locked. Unlock it in pane settings.", type: "info" });
|
|
@@ -124,7 +126,7 @@ export function useShellPaneActions({
|
|
|
124
126
|
return true;
|
|
125
127
|
}, [canExportPaneCsv, exportPaneCsv, focusedPaneId]);
|
|
126
128
|
|
|
127
|
-
const closeFocusedPane = useCallback(() => {
|
|
129
|
+
const closeFocusedPane = useCallback(({ focusNextFloating = false }: { focusNextFloating?: boolean } = {}) => {
|
|
128
130
|
if (!focusedPaneId || !isPaneInLayout(visibleLayout, focusedPaneId)) return false;
|
|
129
131
|
if (isPaneLockedInLayout(visibleLayout, focusedPaneId)) {
|
|
130
132
|
notifyPaneLocked(pluginRegistry);
|
|
@@ -132,7 +134,10 @@ export function useShellPaneActions({
|
|
|
132
134
|
return true;
|
|
133
135
|
}
|
|
134
136
|
const nextLayout = removePane(visibleLayout, focusedPaneId);
|
|
135
|
-
|
|
137
|
+
const nextFloatingPaneId = focusNextFloating ? getTopFloatingPaneId(nextLayout) : null;
|
|
138
|
+
persistLayout(nextLayout, nextFloatingPaneId
|
|
139
|
+
? { focusedPaneId: nextFloatingPaneId }
|
|
140
|
+
: removedFocusRestoreOptions(nextLayout, focusedPaneId, previousFocusedPaneId));
|
|
136
141
|
return true;
|
|
137
142
|
}, [focusedPaneId, persistLayout, pluginRegistry, previousFocusedPaneId, visibleLayout]);
|
|
138
143
|
|
|
@@ -177,6 +182,9 @@ export function useShellPaneActions({
|
|
|
177
182
|
|
|
178
183
|
const popOutFocusedPane = useCallback(() => {
|
|
179
184
|
if (!focusedPaneId || desktopWindowBridge?.kind !== "main" || !desktopWindowBridge.popOutPane) return false;
|
|
185
|
+
// Only the main window pops panes out.
|
|
186
|
+
const windows = getDesktopWindows();
|
|
187
|
+
if (windows && windows.windowId !== "main") return false;
|
|
180
188
|
if (!isPaneInLayout(visibleLayout, focusedPaneId)) return false;
|
|
181
189
|
const shot = shots.get("pop-out");
|
|
182
190
|
if (shot.refuses()) return true;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useState } from "react";
|
|
2
2
|
import { useShortcut } from "../../../../react/input";
|
|
3
3
|
import { useKeybindings } from "../../../../app/keybindings";
|
|
4
4
|
import type { WindowEditMode } from "../../../../plugins/registry";
|
|
5
|
-
import {
|
|
6
|
-
armDoubleEscapeClose,
|
|
7
|
-
createDoubleEscapeCloseState,
|
|
8
|
-
offerEscapeTowardClose,
|
|
9
|
-
resetDoubleEscapeClose,
|
|
10
|
-
takeDoubleEscapeClose,
|
|
11
|
-
} from "../../../../utils/double-escape-close";
|
|
12
5
|
import { createOneShots } from "../../../../utils/one-shot";
|
|
6
|
+
import { useDoubleEscapeClose } from "../../double-escape-close";
|
|
13
7
|
import {
|
|
14
8
|
inputCaptureAllowsPaneManagementShortcut,
|
|
15
9
|
resolvePaneManagementShortcut,
|
|
@@ -19,7 +13,8 @@ interface ShellPaneManagementShortcutOptions {
|
|
|
19
13
|
askAboutFocusedPane(): boolean;
|
|
20
14
|
cancelActiveDrag(): void;
|
|
21
15
|
closeAllFloatingPanes(): boolean;
|
|
22
|
-
|
|
16
|
+
/** `focusNextFloating`: the top floating pane left takes the focus, for closing them one after another. */
|
|
17
|
+
closeFocusedPane(options?: { focusNextFloating?: boolean }): boolean;
|
|
23
18
|
copyFocusedPaneScreenshot(): boolean;
|
|
24
19
|
exportFocusedPaneCsv(): boolean;
|
|
25
20
|
focusedPaneId: string | null;
|
|
@@ -60,16 +55,18 @@ export function useShellPaneManagementShortcuts({
|
|
|
60
55
|
toggleFocusedPaneFloating,
|
|
61
56
|
toggleFocusedPaneNewLayout,
|
|
62
57
|
}: ShellPaneManagementShortcutOptions): void {
|
|
63
|
-
const doubleEscapeCloseRef = useRef(createDoubleEscapeCloseState());
|
|
64
58
|
// A key held down, or a trigger with no repeat flag, runs each action once.
|
|
65
59
|
const [shots] = useState(createOneShots);
|
|
66
60
|
const keybindings = useKeybindings();
|
|
67
61
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
// Esc Esc closes the focused pane and hands the focus to the next floating one.
|
|
63
|
+
useDoubleEscapeClose({
|
|
64
|
+
targetId: focusedPaneId,
|
|
65
|
+
overlayOpen,
|
|
66
|
+
editing: inputCaptured,
|
|
67
|
+
dragging: hasActiveDrag,
|
|
68
|
+
close: () => closeFocusedPane({ focusNextFloating: true }),
|
|
69
|
+
});
|
|
73
70
|
|
|
74
71
|
useShortcut((event) => {
|
|
75
72
|
const shortcut = resolvePaneManagementShortcut(event, keybindings);
|
|
@@ -105,7 +102,6 @@ export function useShellPaneManagementShortcuts({
|
|
|
105
102
|
}
|
|
106
103
|
if (askAboutFocusedPane()) {
|
|
107
104
|
shots.get(shortcut).end();
|
|
108
|
-
resetDoubleEscapeClose(doubleEscapeCloseRef.current);
|
|
109
105
|
event.preventDefault();
|
|
110
106
|
event.stopPropagation();
|
|
111
107
|
return;
|
|
@@ -113,47 +109,13 @@ export function useShellPaneManagementShortcuts({
|
|
|
113
109
|
}
|
|
114
110
|
}
|
|
115
111
|
|
|
116
|
-
|
|
117
|
-
if (isEscape) {
|
|
118
|
-
const doubleEscapeState = doubleEscapeCloseRef.current;
|
|
119
|
-
if (!hasActiveDrag() && !overlayOpen) {
|
|
120
|
-
if (takeDoubleEscapeClose(doubleEscapeState, focusedPaneId, Date.now()) && closeFocusedPane()) {
|
|
121
|
-
event.preventDefault();
|
|
122
|
-
event.stopPropagation();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
resetDoubleEscapeClose(doubleEscapeState);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (!hasActiveDrag()) return;
|
|
112
|
+
if ((event.name === "escape" || event.name === "esc") && hasActiveDrag()) {
|
|
130
113
|
cancelActiveDrag();
|
|
131
114
|
event.preventDefault();
|
|
132
115
|
event.stopPropagation();
|
|
133
|
-
} else {
|
|
134
|
-
resetDoubleEscapeClose(doubleEscapeCloseRef.current);
|
|
135
116
|
}
|
|
136
117
|
}, { phase: "before" });
|
|
137
118
|
|
|
138
|
-
const armDoubleEscape = () => {
|
|
139
|
-
armDoubleEscapeClose(doubleEscapeCloseRef.current, focusedPaneId, Date.now());
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
// A pane that uses an Esc to leave an empty field may still count it.
|
|
143
|
-
useShortcut((event) => {
|
|
144
|
-
if (event.name !== "escape" && event.name !== "esc") return;
|
|
145
|
-
if (hasActiveDrag() || overlayOpen) return;
|
|
146
|
-
offerEscapeTowardClose(event, armDoubleEscape);
|
|
147
|
-
}, { phase: "before", allowEditable: true });
|
|
148
|
-
|
|
149
|
-
// Only an Esc nothing else used arms the close, including a footer's Esc
|
|
150
|
-
// hint: the idle phase runs last and never sees a key a handler consumed.
|
|
151
|
-
useShortcut((event) => {
|
|
152
|
-
if (event.name !== "escape" && event.name !== "esc") return;
|
|
153
|
-
if (hasActiveDrag() || overlayOpen) return;
|
|
154
|
-
armDoubleEscape();
|
|
155
|
-
}, { phase: "idle" });
|
|
156
|
-
|
|
157
119
|
// The pane menu key is a fallback too: a pane that binds "." keeps it,
|
|
158
120
|
// however late it mounted.
|
|
159
121
|
useShortcut((event) => {
|
|
@@ -10,6 +10,7 @@ import { resolveTickerForPane, type AppState } from "../../../state/app/context"
|
|
|
10
10
|
import { resolveInstrumentForPane } from "../../../core/state/app/instrument";
|
|
11
11
|
import { paneTitleMnemonic, pinFollowingPane } from "../../../layout/pane-follow";
|
|
12
12
|
import {
|
|
13
|
+
findPaneInstance,
|
|
13
14
|
TICKER_RESEARCH_PANE_ID,
|
|
14
15
|
type LayoutConfig,
|
|
15
16
|
type PaneInstanceConfig,
|
|
@@ -34,7 +35,7 @@ export function tickerLinkMenuItems({
|
|
|
34
35
|
instance: PaneInstanceConfig;
|
|
35
36
|
layout: LayoutConfig;
|
|
36
37
|
panes: ReadonlyMap<string, PaneDef>;
|
|
37
|
-
state: Pick<AppState, "config" | "paneState" | "tickers">;
|
|
38
|
+
state: Pick<AppState, "config" | "paneState" | "tickers" | "linkedTickers">;
|
|
38
39
|
persistLayout: (nextLayout: LayoutConfig) => void;
|
|
39
40
|
}): ContextMenuItem[] {
|
|
40
41
|
const research = instance.paneId === TICKER_RESEARCH_PANE_ID;
|
|
@@ -77,7 +78,15 @@ export function tickerLinkMenuItems({
|
|
|
77
78
|
});
|
|
78
79
|
};
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
// A source in another desktop window is not in this layout to list; the link can still be cut.
|
|
82
|
+
const remoteSymbol = sourceInstanceId && !findPaneInstance(layout, sourceInstanceId)
|
|
83
|
+
? resolveTickerForPane(state as AppState, instance.instanceId)
|
|
84
|
+
: null;
|
|
85
|
+
const remoteUnlink: ContextMenuItem[] = remoteSymbol
|
|
86
|
+
? [{ id: `unlink:${sourceInstanceId}`, label: "Unlink from Pane in Another Window", onSelect: () => unlink(remoteSymbol) }]
|
|
87
|
+
: [];
|
|
88
|
+
|
|
89
|
+
return [...remoteUnlink, ...layout.instances.flatMap((source): ContextMenuItem[] => {
|
|
81
90
|
if (source.instanceId === instance.instanceId || !isPaneInLayout(layout, source.instanceId)) return [];
|
|
82
91
|
const sourceDef = panes.get(source.paneId);
|
|
83
92
|
if (!sourceDef) return [];
|
|
@@ -111,5 +120,5 @@ export function tickerLinkMenuItems({
|
|
|
111
120
|
onSelect: () => unlink(symbol),
|
|
112
121
|
}]
|
|
113
122
|
: [];
|
|
114
|
-
});
|
|
123
|
+
})];
|
|
115
124
|
}
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
Text,
|
|
4
4
|
contextMenuDivider,
|
|
5
5
|
useContextMenu,
|
|
6
|
-
useRendererHost,
|
|
7
6
|
useUiCapabilities,
|
|
8
7
|
useUiHost,
|
|
9
8
|
} from "../../ui";
|
|
@@ -28,7 +27,6 @@ import {
|
|
|
28
27
|
type ShortcutDisplayMode,
|
|
29
28
|
type ShortcutPlatform,
|
|
30
29
|
} from "../../utils/shortcut-labels";
|
|
31
|
-
import { getCurrentPluginTarget } from "../../plugins/current-target";
|
|
32
30
|
import { getSharedRegistry } from "../../plugins/registry";
|
|
33
31
|
import {
|
|
34
32
|
shouldShowTidyWindows,
|
|
@@ -36,7 +34,6 @@ import {
|
|
|
36
34
|
} from "../../layout/pane-manager";
|
|
37
35
|
import { PluginSlot } from "../../react/plugins/plugin-slot";
|
|
38
36
|
import type { ContextMenuItem } from "../../types/context-menu";
|
|
39
|
-
import { VERSION } from "../../version";
|
|
40
37
|
import { displayWidth } from "../../utils/format";
|
|
41
38
|
import { Button } from "../ui/button";
|
|
42
39
|
import { confirmDialog } from "../ui/confirm-dialog";
|
|
@@ -48,6 +45,8 @@ import { teamStore } from "../../team/store";
|
|
|
48
45
|
import { buildStatusBarTabGroups, groupIdFromMarkerValue, groupMarkerValue } from "./status-bar-groups";
|
|
49
46
|
import { requestFeedbackDialog } from "../feedback-dialog";
|
|
50
47
|
import { openFormModal } from "../form-modal";
|
|
48
|
+
import { getDesktopWindows, layoutMoveTargets } from "../../state/desktop-windows";
|
|
49
|
+
import { fireAndForget } from "../../utils/fire-and-forget";
|
|
51
50
|
import { recordFunctionOpen } from "../../telemetry/usage-counts";
|
|
52
51
|
import {
|
|
53
52
|
STATUS_WIDGET_COLUMNS,
|
|
@@ -62,12 +61,6 @@ type StatusBarEvent = { stopPropagation?: () => void; preventDefault?: () => voi
|
|
|
62
61
|
type HoveredControl = string | null;
|
|
63
62
|
type SetHoveredControl = (updater: (current: HoveredControl) => HoveredControl) => void;
|
|
64
63
|
|
|
65
|
-
/**
|
|
66
|
-
* Where term.gloom.sh sends people who want the installed app. The route
|
|
67
|
-
* picks the installer for the visitor's OS, so one link serves every platform.
|
|
68
|
-
*/
|
|
69
|
-
const DESKTOP_DOWNLOAD_URL = "https://gloom.sh/download/desktop";
|
|
70
|
-
|
|
71
64
|
/**
|
|
72
65
|
* The note while the data service gives no answer at all, and its short form
|
|
73
66
|
* for a narrow terminal. Every pane's own failure says why; this says once,
|
|
@@ -95,9 +88,7 @@ type StatusBarViewProps = {
|
|
|
95
88
|
hoveredControl: HoveredControl;
|
|
96
89
|
layoutTabItems: LayoutTabItem[];
|
|
97
90
|
layoutTabsWidth: number;
|
|
98
|
-
openChangelog?: (event?: StatusBarEvent) => void;
|
|
99
91
|
openLayoutContextMenu: (index: number, event: any) => void | Promise<unknown>;
|
|
100
|
-
rightAvailableWidth: number;
|
|
101
92
|
/** The connection note to show (CONNECTION_NOTE or its short form), or null while the data service answers. */
|
|
102
93
|
connectionNote: string | null;
|
|
103
94
|
openConnections: () => void;
|
|
@@ -151,7 +142,7 @@ const openNewLayout = (event?: StatusBarEvent) => {
|
|
|
151
142
|
|
|
152
143
|
const TERMINAL_NEW_LAYOUT_LABEL = " + ";
|
|
153
144
|
|
|
154
|
-
export function StatusBar(
|
|
145
|
+
export function StatusBar() {
|
|
155
146
|
const { nativePaneChrome, nativeContextMenu } = useUiCapabilities();
|
|
156
147
|
const { showContextMenu } = useContextMenu();
|
|
157
148
|
const dialog = useDialog();
|
|
@@ -291,12 +282,6 @@ export function StatusBar({ onOpenChangelog }: { onOpenChangelog?: (version: str
|
|
|
291
282
|
});
|
|
292
283
|
};
|
|
293
284
|
|
|
294
|
-
const openChangelog = (event?: StatusBarEvent) => {
|
|
295
|
-
event?.preventDefault?.();
|
|
296
|
-
event?.stopPropagation?.();
|
|
297
|
-
onOpenChangelog?.(VERSION);
|
|
298
|
-
};
|
|
299
|
-
|
|
300
285
|
const requestDeleteLayout = useCallback(async (index: number) => {
|
|
301
286
|
const layout = layouts[index];
|
|
302
287
|
if (!layout || layouts.length <= 1) return;
|
|
@@ -362,6 +347,24 @@ export function StatusBar({ onOpenChangelog }: { onOpenChangelog?: (version: str
|
|
|
362
347
|
enabled: layouts.length > 1,
|
|
363
348
|
onSelect: () => requestDeleteLayout(index),
|
|
364
349
|
},
|
|
350
|
+
);
|
|
351
|
+
// The desktop app's other windows, where the tab can go.
|
|
352
|
+
const windows = getDesktopWindows();
|
|
353
|
+
const layoutId = layout.id;
|
|
354
|
+
if (windows && layoutId) {
|
|
355
|
+
const moves = layoutMoveTargets(windows, layouts.length);
|
|
356
|
+
if (moves.length > 0) items.push(contextMenuDivider("layout:window-divider"));
|
|
357
|
+
for (const move of moves) {
|
|
358
|
+
items.push({
|
|
359
|
+
id: `layout:move-to-window:${move.key}`,
|
|
360
|
+
label: move.label,
|
|
361
|
+
onSelect: () => {
|
|
362
|
+
fireAndForget(windows.moveLayout(layoutId, move.target), "desktop.moveLayoutToWindow");
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
items.push(
|
|
365
368
|
contextMenuDivider("layout:actions-divider"),
|
|
366
369
|
{
|
|
367
370
|
id: "layout:gallery",
|
|
@@ -438,13 +441,12 @@ export function StatusBar({ onOpenChangelog }: { onOpenChangelog?: (version: str
|
|
|
438
441
|
if (!statusBarVisible) return null;
|
|
439
442
|
|
|
440
443
|
// Feedback keeps the bottom-right corner; the connection note comes before
|
|
441
|
-
// the
|
|
442
|
-
//
|
|
444
|
+
// the widgets and gives way to a widget that claimed more than the usual
|
|
445
|
+
// room. A narrow terminal shortens the note.
|
|
443
446
|
const rightWidth = Math.max(0, termWidth - leftWidth - STATUS_WIDGET_COLUMNS - claimedWidgetColumns - feedbackWidth);
|
|
444
447
|
const connectionNote = !dataServiceUnreachable ? null
|
|
445
448
|
: nativePaneChrome || rightWidth >= displayWidth(t(CONNECTION_NOTE)) + 1 ? CONNECTION_NOTE
|
|
446
449
|
: rightWidth >= displayWidth(t(CONNECTION_NOTE_SHORT)) + 1 ? CONNECTION_NOTE_SHORT : null;
|
|
447
|
-
const connectionNoteWidth = connectionNote && !nativePaneChrome ? displayWidth(t(connectionNote)) + 1 : 0;
|
|
448
450
|
|
|
449
451
|
const viewProps: StatusBarViewProps = {
|
|
450
452
|
activeLayoutIdx,
|
|
@@ -456,9 +458,7 @@ export function StatusBar({ onOpenChangelog }: { onOpenChangelog?: (version: str
|
|
|
456
458
|
hoveredControl,
|
|
457
459
|
layoutTabItems,
|
|
458
460
|
layoutTabsWidth: tabsWidth,
|
|
459
|
-
openChangelog: onOpenChangelog ? openChangelog : undefined,
|
|
460
461
|
openLayoutContextMenu,
|
|
461
|
-
rightAvailableWidth: Math.max(0, rightWidth - connectionNoteWidth),
|
|
462
462
|
connectionNote,
|
|
463
463
|
openConnections,
|
|
464
464
|
setHoveredControl,
|
|
@@ -498,7 +498,6 @@ function NativeStatusBar({
|
|
|
498
498
|
{showTidyWindows && <NativeTidyWindows {...props} />}
|
|
499
499
|
<Box flexGrow={1} minWidth={0} />
|
|
500
500
|
<StatusBarConnectionNote nativePaneChrome {...props} />
|
|
501
|
-
<StatusBarSummary nativePaneChrome {...props} />
|
|
502
501
|
{/* Widgets keep their width; the layout tabs give way instead. */}
|
|
503
502
|
<Box flexShrink={0} flexDirection="row" alignItems="center" data-gloom-role="status-widgets">
|
|
504
503
|
<PluginSlot name="status:widget" />
|
|
@@ -531,7 +530,6 @@ function TerminalStatusBar({
|
|
|
531
530
|
{showTidyWindows && <TerminalTidyWindows {...props} />}
|
|
532
531
|
<Box flexGrow={1} minWidth={0} />
|
|
533
532
|
<StatusBarConnectionNote nativePaneChrome={false} {...props} />
|
|
534
|
-
<StatusBarSummary nativePaneChrome={false} {...props} />
|
|
535
533
|
<StarPromptStatusLine />
|
|
536
534
|
<PluginSlot name="status:widget" />
|
|
537
535
|
<StatusBarFeedback nativePaneChrome={false} {...props} />
|
|
@@ -582,58 +580,6 @@ function StatusBarLayoutControl({
|
|
|
582
580
|
);
|
|
583
581
|
}
|
|
584
582
|
|
|
585
|
-
/**
|
|
586
|
-
* The version chip and, on the hosted web app, a link to the desktop app.
|
|
587
|
-
* The link goes first when the row runs out of room, then the version. Live
|
|
588
|
-
* market status lives at the header's right edge, not here, so nothing in the
|
|
589
|
-
* status bar repeats it.
|
|
590
|
-
*/
|
|
591
|
-
function StatusBarSummary({
|
|
592
|
-
hoveredControl,
|
|
593
|
-
nativePaneChrome,
|
|
594
|
-
openChangelog,
|
|
595
|
-
rightAvailableWidth,
|
|
596
|
-
setHoveredControl,
|
|
597
|
-
}: Pick<
|
|
598
|
-
StatusBarViewProps,
|
|
599
|
-
"hoveredControl" | "openChangelog" | "rightAvailableWidth" | "setHoveredControl"
|
|
600
|
-
> & { nativePaneChrome: boolean }) {
|
|
601
|
-
const rendererHost = useRendererHost();
|
|
602
|
-
const versionLabel = `v${VERSION}`;
|
|
603
|
-
const downloadLabel = t("Download desktop app");
|
|
604
|
-
const showVersion = rightAvailableWidth >= versionLabel.length + 1;
|
|
605
|
-
const showDownload = getCurrentPluginTarget() === "web"
|
|
606
|
-
&& rightAvailableWidth >= versionLabel.length + 1 + downloadLabel.length + 1;
|
|
607
|
-
if (!showVersion) return null;
|
|
608
|
-
return (
|
|
609
|
-
<>
|
|
610
|
-
<StatusBarChip
|
|
611
|
-
hoveredControl={hoveredControl}
|
|
612
|
-
id="version"
|
|
613
|
-
label={versionLabel}
|
|
614
|
-
nativePaneChrome={nativePaneChrome}
|
|
615
|
-
onPress={openChangelog}
|
|
616
|
-
role="button"
|
|
617
|
-
setHoveredControl={setHoveredControl}
|
|
618
|
-
// CHG opens the same notes from the command bar, where the keyboard can reach them.
|
|
619
|
-
title={openChangelog ? `${tf("Open changelog for {version}", { version: versionLabel })} (CHG)` : undefined}
|
|
620
|
-
/>
|
|
621
|
-
{showDownload && (
|
|
622
|
-
<StatusBarChip
|
|
623
|
-
hoveredControl={hoveredControl}
|
|
624
|
-
id="desktop-download"
|
|
625
|
-
label={downloadLabel}
|
|
626
|
-
nativePaneChrome={nativePaneChrome}
|
|
627
|
-
onPress={() => { void rendererHost.openExternal(DESKTOP_DOWNLOAD_URL); }}
|
|
628
|
-
role="link"
|
|
629
|
-
setHoveredControl={setHoveredControl}
|
|
630
|
-
title={t("Get Gloom for Mac or Windows")}
|
|
631
|
-
/>
|
|
632
|
-
)}
|
|
633
|
-
</>
|
|
634
|
-
);
|
|
635
|
-
}
|
|
636
|
-
|
|
637
583
|
/**
|
|
638
584
|
* Says the data service is unreachable while it is, in the warning tone a
|
|
639
585
|
* pane footer gives a failure; it opens Connections, which has the detail.
|
|
@@ -700,7 +646,7 @@ function StatusBarChip({
|
|
|
700
646
|
label: string;
|
|
701
647
|
nativePaneChrome: boolean;
|
|
702
648
|
onPress?: (event?: StatusBarEvent) => void;
|
|
703
|
-
role: "button"
|
|
649
|
+
role: "button";
|
|
704
650
|
title?: string;
|
|
705
651
|
tone?: "warning";
|
|
706
652
|
}) {
|
|
@@ -3,9 +3,9 @@ import { useEffect, useSyncExternalStore } from "react";
|
|
|
3
3
|
/**
|
|
4
4
|
* Space in the status bar for the `status:widget` slot. The bar holds back a
|
|
5
5
|
* fixed number of columns for its widgets; a widget that needs more claims
|
|
6
|
-
* the extra here, so the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* the extra here, so the connection note gives way to it, and reads how many
|
|
7
|
+
* columns the widgets have once they have, so it can render nothing rather
|
|
8
|
+
* than run into its neighbours.
|
|
9
9
|
*/
|
|
10
10
|
/** Held back for the widgets whether or not they claim more. */
|
|
11
11
|
export const STATUS_WIDGET_COLUMNS = 20;
|
|
@@ -38,8 +38,8 @@ export function useClaimedStatusWidgetColumns(): number {
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Publishes the columns the widgets can use: right of the layout controls,
|
|
41
|
-
* less Feedback
|
|
42
|
-
*
|
|
41
|
+
* less Feedback. Infinite while no status bar is mounted, as in isolated
|
|
42
|
+
* renders.
|
|
43
43
|
*/
|
|
44
44
|
export function usePublishStatusWidgetRoom(columns: number): void {
|
|
45
45
|
useEffect(() => {
|