@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
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
} from "../../../state/app/context";
|
|
12
12
|
import { scheduleConfigSave } from "../../../state/config-save-scheduler";
|
|
13
13
|
import { commands } from "../commands/registry";
|
|
14
|
+
import { getDesktopWindows } from "../../../state/desktop-windows";
|
|
14
15
|
import type { ThemePickerHandle } from "../theme-picker";
|
|
15
16
|
import type { ListScreenState } from "../list/model";
|
|
16
17
|
|
|
@@ -97,6 +98,7 @@ export function useCommandBarEnvironment() {
|
|
|
97
98
|
() => commands.filter((command) => {
|
|
98
99
|
if (command.id === "cycle-chart-renderer") return !nativePaneChrome;
|
|
99
100
|
if (command.id === "minimize-window" || command.id === "maximize-window") return drawsWindowControls;
|
|
101
|
+
if (command.id === "new-window") return getDesktopWindows() !== null;
|
|
100
102
|
return true;
|
|
101
103
|
}),
|
|
102
104
|
[drawsWindowControls, nativePaneChrome],
|
|
@@ -192,6 +192,12 @@ const EXACT_MATCH_SECTION_PRIORITY = -150;
|
|
|
192
192
|
* so it sits under an exact symbol and above the AI's guess.
|
|
193
193
|
*/
|
|
194
194
|
const DID_YOU_MEAN_SECTION_PRIORITY = -120;
|
|
195
|
+
/**
|
|
196
|
+
* The offer to add a list pasted into the bar (`Add 12 symbols to a
|
|
197
|
+
* watchlist`): what the user put in, so it sits above the AI's reading of it.
|
|
198
|
+
*/
|
|
199
|
+
export const PASTED_LIST_CATEGORY = "Pasted list";
|
|
200
|
+
const PASTED_LIST_SECTION_PRIORITY = -110;
|
|
195
201
|
/**
|
|
196
202
|
* The AI leads the rest even though it is the slowest source (~600ms+): it
|
|
197
203
|
* translates the sentence the user typed into commands, which is the answer to
|
|
@@ -219,6 +225,7 @@ function getCategoryPriority(category: string, options?: CommandBarSectionOption
|
|
|
219
225
|
if (normalized === "exact match") return EXACT_MATCH_SECTION_PRIORITY;
|
|
220
226
|
if (normalized === "did you mean") return DID_YOU_MEAN_SECTION_PRIORITY;
|
|
221
227
|
if (category === PLUGIN_INSTALL_CATEGORY) return PLUGIN_INSTALL_SECTION_PRIORITY;
|
|
228
|
+
if (category === PASTED_LIST_CATEGORY) return PASTED_LIST_SECTION_PRIORITY;
|
|
222
229
|
if (normalized === "instruments") return INSTRUMENTS_SECTION_PRIORITY;
|
|
223
230
|
if (normalized === "suggested") return SUGGESTED_SECTION_PRIORITY;
|
|
224
231
|
if (sectionOrder === "app-first") {
|
|
@@ -170,7 +170,8 @@ async function resolvePaneTemplateOptions(
|
|
|
170
170
|
const rawInput = resolvedOptions?.arg ?? resolvedOptions?.values?.tickers ?? "";
|
|
171
171
|
const symbols = !String(rawInput).trim() && template.shortcut?.openWithoutArg
|
|
172
172
|
? []
|
|
173
|
-
: await resolveTickerListInput(rawInput, baseContext.activeCollectionId, deps, template.shortcut?.keepArgToken
|
|
173
|
+
: await resolveTickerListInput(rawInput, baseContext.activeCollectionId, deps, template.shortcut?.keepArgToken,
|
|
174
|
+
{ maximum: template.headless?.argument.maximum });
|
|
174
175
|
resolvedOptions = {
|
|
175
176
|
...resolvedOptions,
|
|
176
177
|
arg: rawInput,
|
|
@@ -4,6 +4,7 @@ import type { AppAction, AppState } from "../../../state/app/context";
|
|
|
4
4
|
import type { AppTickerRepositoryPort } from "../../../core/app-service-ports";
|
|
5
5
|
import type { PluginRegistry } from "../../../plugins/registry";
|
|
6
6
|
import { isManualPortfolio } from "../../../portfolio/mutations";
|
|
7
|
+
import { findNamedCollection, readWatchlistArgument } from "../../../portfolio/collection-name";
|
|
7
8
|
import type { DataProvider } from "../../../types/data-provider";
|
|
8
9
|
import type { Portfolio, TickerRecord, Watchlist } from "../../../types/ticker";
|
|
9
10
|
import { AmbiguousTickerError, resolveTickerSearch, upsertTickerFromSearchResult } from "../../../tickers/search";
|
|
@@ -260,12 +261,31 @@ export async function applyCollectionMembershipChange(
|
|
|
260
261
|
return result;
|
|
261
262
|
}
|
|
262
263
|
|
|
264
|
+
/** How a function reads a list argument that names a watchlist: at most `maximum` symbols, its note pushed to `notes`. */
|
|
265
|
+
export interface TickerListReading {
|
|
266
|
+
maximum?: number;
|
|
267
|
+
notes?: string[];
|
|
268
|
+
}
|
|
269
|
+
|
|
263
270
|
export async function resolveTickerListInput(
|
|
264
271
|
rawInput: string,
|
|
265
272
|
collectionId: string | null,
|
|
266
273
|
deps: SharedWorkflowDeps,
|
|
267
274
|
keepToken?: (token: string) => boolean,
|
|
275
|
+
reading?: TickerListReading,
|
|
268
276
|
): Promise<string[]> {
|
|
277
|
+
// A watchlist's name stands for its symbols, as `fn` reads it (`SIW HY3`), with the note saying so.
|
|
278
|
+
const state = deps.getState();
|
|
279
|
+
const watchlist = /[,;\n]/.test(rawInput) ? null : findNamedCollection(state.config.watchlists, rawInput);
|
|
280
|
+
const members = watchlist
|
|
281
|
+
? [...state.tickers.values()].filter((ticker) => ticker.metadata.watchlists.includes(watchlist.id)).map((ticker) => ticker.metadata.ticker)
|
|
282
|
+
: [];
|
|
283
|
+
if (watchlist && members.length > 0) {
|
|
284
|
+
const read = readWatchlistArgument(rawInput, watchlist, members, reading?.maximum);
|
|
285
|
+
reading?.notes?.push(read.note);
|
|
286
|
+
return read.symbols;
|
|
287
|
+
}
|
|
288
|
+
|
|
269
289
|
const tokens = parseTickerListInput(rawInput);
|
|
270
290
|
const symbols: string[] = [];
|
|
271
291
|
const seen = new Set<string>();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DataTableCell, DataTableColumn, DataTableProps } from "../ui";
|
|
2
2
|
import { serializeCsv } from "../../utils/csv";
|
|
3
|
+
import { figureColumnCells } from "../ui/data-table/render-cell";
|
|
3
4
|
import {
|
|
4
5
|
BLANK_DISPLAY as BLANK,
|
|
5
6
|
DISPLAY_PLACEHOLDER as PLACEHOLDER,
|
|
@@ -56,9 +57,11 @@ export function createDataTableCsv<
|
|
|
56
57
|
renderSectionHeader,
|
|
57
58
|
getExportMetadata,
|
|
58
59
|
}: Pick<DataTableProps<T, C>, "columns" | "items" | "renderCell" | "renderSectionHeader" | "getExportMetadata">): string {
|
|
60
|
+
// A pane that exports a table it does not draw (all its columns) reads the figures as the table draws them.
|
|
61
|
+
const cell = figureColumnCells(renderCell);
|
|
59
62
|
const cells = items.flatMap((item, index) => {
|
|
60
63
|
if (renderSectionHeader?.(item, index)) return [];
|
|
61
|
-
return [columns.map((column) =>
|
|
64
|
+
return [columns.map((column) => cell(item, column, index, { selected: false }))];
|
|
62
65
|
});
|
|
63
66
|
// A column drawn only as graphics (a bar, a sparkline) has no value to export.
|
|
64
67
|
const exported = columns.flatMap((column, index) => (
|
|
@@ -19,13 +19,7 @@ import { getPaneDisplayTitle } from "./pane/title";
|
|
|
19
19
|
import { TITLEBAR_OVERLAY_HEIGHT_PX, getTitlebarLeadingInset } from "./titlebar-overlay";
|
|
20
20
|
import { useWindowFullscreen } from "./window-fullscreen";
|
|
21
21
|
import { WindowControls, WINDOWS_CONTROL_GROUP_WIDTH_PX } from "./window-controls";
|
|
22
|
-
import {
|
|
23
|
-
armDoubleEscapeClose,
|
|
24
|
-
createDoubleEscapeCloseState,
|
|
25
|
-
offerEscapeTowardClose,
|
|
26
|
-
resetDoubleEscapeClose,
|
|
27
|
-
takeDoubleEscapeClose,
|
|
28
|
-
} from "../../utils/double-escape-close";
|
|
22
|
+
import { useDoubleEscapeClose } from "./double-escape-close";
|
|
29
23
|
import { contextMenuDivider, type ContextMenuItem } from "../../types/context-menu";
|
|
30
24
|
import { useKeybindings } from "../../app/keybindings";
|
|
31
25
|
import { useDialogState } from "../../ui/dialog";
|
|
@@ -61,7 +55,6 @@ export function DetachedPaneShell({ pluginRegistry, desktopWindowBridge }: Detac
|
|
|
61
55
|
const config = usePaneAppConfig();
|
|
62
56
|
const paneState = useAppSelector((state) => state.paneState);
|
|
63
57
|
const inputCaptured = useAppSelector((state) => state.inputCaptured);
|
|
64
|
-
const doubleEscapeCloseRef = useRef(createDoubleEscapeCloseState());
|
|
65
58
|
// A key held down, or a trigger with no repeat flag, runs each action once.
|
|
66
59
|
const [shots] = useState(createOneShots);
|
|
67
60
|
const keybindings = useKeybindings();
|
|
@@ -132,35 +125,15 @@ export function DetachedPaneShell({ pluginRegistry, desktopWindowBridge }: Detac
|
|
|
132
125
|
};
|
|
133
126
|
}, [focusPane]);
|
|
134
127
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
resetDoubleEscapeClose(doubleEscapeState);
|
|
148
|
-
}, { phase: "before" });
|
|
149
|
-
|
|
150
|
-
const armDoubleEscape = () => {
|
|
151
|
-
armDoubleEscapeClose(doubleEscapeCloseRef.current, desktopWindowBridge.paneId, Date.now());
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
// A pane that uses an Esc to leave an empty field may still count it.
|
|
155
|
-
useShortcut((event) => {
|
|
156
|
-
if (event.name !== "escape" && event.name !== "esc") return;
|
|
157
|
-
offerEscapeTowardClose(event, armDoubleEscape);
|
|
158
|
-
}, { phase: "before", allowEditable: true });
|
|
159
|
-
|
|
160
|
-
useShortcut((event) => {
|
|
161
|
-
if (event.name !== "escape" && event.name !== "esc") return;
|
|
162
|
-
armDoubleEscape();
|
|
163
|
-
}, { phase: "idle" });
|
|
128
|
+
useDoubleEscapeClose({
|
|
129
|
+
targetId: desktopWindowBridge.paneId,
|
|
130
|
+
overlayOpen: dialogOpen || menuState !== null,
|
|
131
|
+
editing: inputCaptured,
|
|
132
|
+
close: () => {
|
|
133
|
+
if (!locked) fireAndForget(desktopWindowBridge.closeDetachedPane?.(desktopWindowBridge.paneId), "desktop.closeDetachedPane");
|
|
134
|
+
return true;
|
|
135
|
+
},
|
|
136
|
+
});
|
|
164
137
|
|
|
165
138
|
const closePane = useCallback(() => {
|
|
166
139
|
if (locked) {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { useBeforeShortcut, useShortcut, type KeyEventLike } from "../../react/input";
|
|
3
|
+
import {
|
|
4
|
+
armDoubleEscapeClose,
|
|
5
|
+
createDoubleEscapeCloseState,
|
|
6
|
+
isEscapeKeptFromClosing,
|
|
7
|
+
offerEscapeTowardClose,
|
|
8
|
+
resetDoubleEscapeClose,
|
|
9
|
+
takeDoubleEscapeClose,
|
|
10
|
+
} from "../../utils/double-escape-close";
|
|
11
|
+
|
|
12
|
+
function isEscapeKey(event: KeyEventLike): boolean {
|
|
13
|
+
return event.name === "escape" || event.name === "esc";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface DoubleEscapeCloseOptions {
|
|
17
|
+
/** The pane a pair of Esc presses closes. */
|
|
18
|
+
targetId: string | null;
|
|
19
|
+
/** A menu, dialog or other overlay is open: its Esc is its own. */
|
|
20
|
+
overlayOpen: boolean;
|
|
21
|
+
/** The pane is editing (input capture): its Esc counts only when the pane counts it. */
|
|
22
|
+
editing: boolean;
|
|
23
|
+
/** A drag is under way: Esc cancels it. */
|
|
24
|
+
dragging?: () => boolean;
|
|
25
|
+
/** Closes the target; false when nothing was closed and the Esc goes on to the pane. */
|
|
26
|
+
close(): boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Esc Esc closes the focused pane, even one that could still go back: every
|
|
31
|
+
* Esc is the first half of a pair, whatever the pane did with it. Kept out:
|
|
32
|
+
*
|
|
33
|
+
* - an Esc in a text field, or while the pane is editing, unless the pane
|
|
34
|
+
* counts it because nothing typed is left behind (an empty composer);
|
|
35
|
+
* - an Esc while a menu, dialog or overlay is open, and one that closes a
|
|
36
|
+
* menu or popover of the pane's own (`keepEscapeFromClosing`);
|
|
37
|
+
* - a held Esc, which closes one pane: the shortcut registry drops its
|
|
38
|
+
* repeats, and a stream without the flag cools down in `arm`.
|
|
39
|
+
*
|
|
40
|
+
* A surface that takes Esc in a scoped `before` handler (onboarding, a form,
|
|
41
|
+
* key capture) runs ahead of the arming and so never counts.
|
|
42
|
+
*/
|
|
43
|
+
export function useDoubleEscapeClose({ targetId, overlayOpen, editing, dragging, close }: DoubleEscapeCloseOptions): void {
|
|
44
|
+
const stateRef = useRef(createDoubleEscapeCloseState());
|
|
45
|
+
const live = useRef({ targetId, overlayOpen });
|
|
46
|
+
live.current = { targetId, overlayOpen };
|
|
47
|
+
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (overlayOpen) resetDoubleEscapeClose(stateRef.current);
|
|
50
|
+
}, [overlayOpen]);
|
|
51
|
+
|
|
52
|
+
// Before any handler, so one in any phase or scope can count or keep its Esc.
|
|
53
|
+
useBeforeShortcut((event) => {
|
|
54
|
+
const state = stateRef.current;
|
|
55
|
+
if (!isEscapeKey(event)) {
|
|
56
|
+
resetDoubleEscapeClose(state);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const at = Date.now();
|
|
60
|
+
offerEscapeTowardClose(event, {
|
|
61
|
+
count: () => {
|
|
62
|
+
if (!live.current.overlayOpen) armDoubleEscapeClose(state, live.current.targetId, at);
|
|
63
|
+
},
|
|
64
|
+
keep: () => resetDoubleEscapeClose(state),
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// The second Esc of a pair closes before anything else sees it, so a pane
|
|
69
|
+
// with more to go back through still closes. Not in a text field.
|
|
70
|
+
useShortcut((event) => {
|
|
71
|
+
if (!isEscapeKey(event) || overlayOpen || editing || dragging?.()) return;
|
|
72
|
+
if (takeDoubleEscapeClose(stateRef.current, targetId, Date.now()) && close()) {
|
|
73
|
+
event.preventDefault();
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
}
|
|
76
|
+
}, { phase: "capture" });
|
|
77
|
+
|
|
78
|
+
// The first: after the scoped surfaces that own their Esc (onboarding, a
|
|
79
|
+
// form, key capture), so theirs never counts, and before the pane.
|
|
80
|
+
useShortcut((event) => {
|
|
81
|
+
if (!isEscapeKey(event)) return;
|
|
82
|
+
const state = stateRef.current;
|
|
83
|
+
if (overlayOpen || dragging?.()) {
|
|
84
|
+
resetDoubleEscapeClose(state);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (editing || isEscapeKeptFromClosing(event)) return;
|
|
88
|
+
armDoubleEscapeClose(state, targetId, Date.now());
|
|
89
|
+
}, { phase: "before" });
|
|
90
|
+
}
|
|
@@ -769,8 +769,9 @@ function HeaderMarketSummary({ nativePaneChrome, width }: { nativePaneChrome: bo
|
|
|
769
769
|
available: width,
|
|
770
770
|
baseCurrencyWidth: displayWidth(summary.baseCurrencyLabel) + 1,
|
|
771
771
|
countdownWidth: summary.marketLabel.length - summary.marketLabelShort.length,
|
|
772
|
-
// A delayed SPY
|
|
773
|
-
//
|
|
772
|
+
// A delayed SPY carries its mark only while the status bar does not say the
|
|
773
|
+
// delay. Then the two fit, or give way, together, and once the rest of the
|
|
774
|
+
// cluster is gone SPY gives up its move rather than give way.
|
|
774
775
|
spyWidth: summary.spyText.length + 1 + (summary.spyDelayMinutes != null ? delayedMarkWidth(summary.spyDelayMinutes, nativePaneChrome) + 1 : 0),
|
|
775
776
|
spyMoveWidth: summary.spyDelayMinutes != null ? summary.spyText.length - summary.spyPriceText.length : 0,
|
|
776
777
|
stateWidth: summary.marketLabelShort ? summary.marketLabelShort.length + 1 : 0,
|
|
@@ -12,7 +12,7 @@ import { formatPercentRaw } from "../../utils/format";
|
|
|
12
12
|
import { formatMarketPriceWithCurrency, liveQuoteFormatOptions } from "../../market-data/market/format";
|
|
13
13
|
import { getSessionMoveDisplay, marketStateColor, marketStateCountdown, marketStateLabel } from "../../market-data/market/status";
|
|
14
14
|
import type { Quote } from "../../types/financials";
|
|
15
|
-
import {
|
|
15
|
+
import { useDelayedMarkMinutes } from "../ui/delayed-mark";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* SPY rides the shared feed. The snapshot poll only runs while the feed has
|
|
@@ -45,7 +45,10 @@ export interface MarketSummary {
|
|
|
45
45
|
spyText: string;
|
|
46
46
|
/** `spyText` without its move (`SPY $762.43`), for a delayed SPY in a header too narrow for both and the mark. */
|
|
47
47
|
spyPriceText: string;
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Minutes SPY's price is late for this account (signed out or free), drawn as the delayed
|
|
50
|
+
* mark beside it; null when live, and while the status bar's delayed note says it for the app.
|
|
51
|
+
*/
|
|
49
52
|
spyDelayMinutes: number | null;
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -151,7 +154,7 @@ export function useMarketSummary(): MarketSummary {
|
|
|
151
154
|
}, [appActive]);
|
|
152
155
|
|
|
153
156
|
const { spyColor, spyPriceText, spyText } = spySummary(spyQuote, colors);
|
|
154
|
-
const spyDelayMinutes =
|
|
157
|
+
const spyDelayMinutes = useDelayedMarkMinutes(spyQuote);
|
|
155
158
|
|
|
156
159
|
const mktCountdown = mktState ? marketStateCountdown(mktState, now) : null;
|
|
157
160
|
const marketLabelShort = mktState ? t(marketStateLabel(mktState)) : "";
|
|
@@ -81,12 +81,10 @@ function terminalSegmentKey(segment: PaneFooterSegment, focused: boolean): strin
|
|
|
81
81
|
: "";
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
/** Columns an icon segment keeps when hints crowd the footer
|
|
84
|
+
/** Columns an icon segment keeps when hints crowd the footer. */
|
|
85
85
|
function iconSegmentReserve(segment: PaneFooterSegment, focused: boolean, nativePaneChrome: boolean): number {
|
|
86
86
|
if (!segment.icon) return 0;
|
|
87
|
-
return nativePaneChrome
|
|
88
|
-
? 3 + (segment.iconText ? segment.iconText.length + 1 : 0)
|
|
89
|
-
: Math.max(3, 1 + terminalSegmentKey(segment, focused).length);
|
|
87
|
+
return nativePaneChrome ? 3 : Math.max(3, 1 + terminalSegmentKey(segment, focused).length);
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
function SegmentView({ segment, focused }: { segment: PaneFooterSegment; focused: boolean }) {
|
|
@@ -127,7 +125,6 @@ function SegmentView({ segment, focused }: { segment: PaneFooterSegment; focused
|
|
|
127
125
|
data-icon={segment.icon}
|
|
128
126
|
>
|
|
129
127
|
<Icon name={segment.icon} size={14} color={segment.disabled ? colors.textMuted : footerToneColor(segment.parts[0] ?? { text: "" })} />
|
|
130
|
-
{segment.iconText ? <Text fg={colors.textMuted} selectable={false} data-gloom-role="pane-footer-icon-text">{segment.iconText}</Text> : null}
|
|
131
128
|
</Box>
|
|
132
129
|
);
|
|
133
130
|
}
|
|
@@ -144,7 +141,6 @@ function SegmentView({ segment, focused }: { segment: PaneFooterSegment; focused
|
|
|
144
141
|
disabled={!interactive}
|
|
145
142
|
color={segment.disabled ? colors.textMuted : footerToneColor(segment.parts[0] ?? { text: "" })}
|
|
146
143
|
onPress={() => segment.onPress?.()}
|
|
147
|
-
text={segment.iconText}
|
|
148
144
|
/>
|
|
149
145
|
);
|
|
150
146
|
}
|
|
@@ -30,12 +30,6 @@ export interface PaneFooterSegment {
|
|
|
30
30
|
* data a source delivers late: build it with {@link delayedFooterSegment}.
|
|
31
31
|
*/
|
|
32
32
|
icon?: "warning" | "clock";
|
|
33
|
-
/**
|
|
34
|
-
* A few characters the desktop draws after `icon`, in the footer's muted
|
|
35
|
-
* tone, so the segment reads without hovering: a delay's `15m`. The
|
|
36
|
-
* terminal's `parts` already carry it (`◷15m`).
|
|
37
|
-
*/
|
|
38
|
-
iconText?: string;
|
|
39
33
|
/**
|
|
40
34
|
* The segment only dates the pane's data (`as of 2026-10-05`). A `gloomberb
|
|
41
35
|
* shot` whose status line already dates that data leaves it out, so the
|
|
@@ -89,11 +83,12 @@ export interface PaneFooterSegment {
|
|
|
89
83
|
const DELAYED_FOOTER_GLYPH = "◷";
|
|
90
84
|
|
|
91
85
|
/**
|
|
92
|
-
* The footer's one form for data a source delivers late: a yellow clock
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
86
|
+
* The footer's one form for data a source delivers late: a yellow clock with
|
|
87
|
+
* `detail` in its tooltip on the desktop and the web, and the clock with the
|
|
88
|
+
* delay (`◷15m`) in the terminal, which has no tooltip, so it takes a few
|
|
89
|
+
* cells rather than a phrase. The clock alone keeps the delay from repeating
|
|
90
|
+
* in every pane: the status bar's delayed note spells out the account's
|
|
91
|
+
* (`◷ 15m delayed`). `onPress` makes it a button, such as an upgrade.
|
|
97
92
|
*/
|
|
98
93
|
export function delayedFooterSegment({
|
|
99
94
|
id,
|
|
@@ -116,7 +111,6 @@ export function delayedFooterSegment({
|
|
|
116
111
|
label: detail,
|
|
117
112
|
title: detail,
|
|
118
113
|
parts: [{ text: `${DELAYED_FOOTER_GLYPH}${delay ?? ""}`, tone: "warning" }],
|
|
119
|
-
...(delay ? { iconText: delay } : {}),
|
|
120
114
|
...(onPress ? { onPress } : {}),
|
|
121
115
|
...(quoteStatus ? { quoteStatus } : {}),
|
|
122
116
|
};
|
|
@@ -32,11 +32,14 @@ import {
|
|
|
32
32
|
import type { ShellDragRuntimeState, ShellMouseEvent } from "./drag/runtime";
|
|
33
33
|
import type { WindowEditState } from "../window-edit/mode";
|
|
34
34
|
import {
|
|
35
|
+
createMagnetGlide,
|
|
35
36
|
createMagnetPace,
|
|
37
|
+
NO_GLIDE,
|
|
36
38
|
NO_LATCH,
|
|
37
39
|
snapMovedRect,
|
|
38
40
|
snapResizedRect,
|
|
39
41
|
type MagnetDistances,
|
|
42
|
+
type MagnetGlide,
|
|
40
43
|
type MagnetLatch,
|
|
41
44
|
type MagnetPace,
|
|
42
45
|
} from "./drag/magnets";
|
|
@@ -111,7 +114,9 @@ export function useShellActiveDrag({
|
|
|
111
114
|
// the edges its magnets hold, with the other panes' rects they hold to, the
|
|
112
115
|
// join it is holding still for, and on the desktop where the pointer has
|
|
113
116
|
// been lately (the magnets wait for it to slow down) with the check that
|
|
114
|
-
// catches once it rests
|
|
117
|
+
// catches once it rests, and where the pane is drawn against where the
|
|
118
|
+
// pointer puts it, with the frame that moves it there while the pointer is
|
|
119
|
+
// still.
|
|
115
120
|
const memoRef = useRef<{
|
|
116
121
|
drag: unknown;
|
|
117
122
|
baseRect: FloatingRect | null;
|
|
@@ -121,10 +126,15 @@ export function useShellActiveDrag({
|
|
|
121
126
|
magnetTargets: LayoutBounds[] | null;
|
|
122
127
|
join: PendingJoin | null;
|
|
123
128
|
pace: MagnetPace;
|
|
124
|
-
|
|
129
|
+
glide: MagnetGlide;
|
|
130
|
+
}>({
|
|
131
|
+
drag: null, baseRect: null, dropKey: null, drop: null, latch: NO_LATCH, magnetTargets: null, join: null,
|
|
132
|
+
pace: createMagnetPace(), glide: createMagnetGlide(),
|
|
133
|
+
});
|
|
125
134
|
useEffect(() => () => {
|
|
126
135
|
dropPendingJoin(memoRef.current);
|
|
127
136
|
memoRef.current.pace.reset();
|
|
137
|
+
memoRef.current.glide.reset();
|
|
128
138
|
}, []);
|
|
129
139
|
// The handler as it is now, for the rest check to run again.
|
|
130
140
|
const handleRef = useRef<(event: ShellMouseEvent) => void>(() => {});
|
|
@@ -152,6 +162,7 @@ export function useShellActiveDrag({
|
|
|
152
162
|
memo.latch = NO_LATCH;
|
|
153
163
|
memo.magnetTargets = null;
|
|
154
164
|
memo.pace.reset();
|
|
165
|
+
memo.glide.reset();
|
|
155
166
|
dropPendingJoin(memo);
|
|
156
167
|
}
|
|
157
168
|
// Any later event supersedes the rest check of an earlier move.
|
|
@@ -169,9 +180,9 @@ export function useShellActiveDrag({
|
|
|
169
180
|
};
|
|
170
181
|
const magnetsOff = event.modifiers?.alt === true;
|
|
171
182
|
const magnetArea = { x: 0, y: 0, width, height: contentHeight };
|
|
172
|
-
// Desktop:
|
|
173
|
-
//
|
|
174
|
-
//
|
|
183
|
+
// Desktop: past the travel speed a release lands the pane where the
|
|
184
|
+
// pointer puts it, its magnets left out (the rest check runs the last move
|
|
185
|
+
// again once the pointer has stopped, so a release then catches). What
|
|
175
186
|
// they hold to still follows every move, so it rests where it would have.
|
|
176
187
|
const travelling = () => {
|
|
177
188
|
if (!nativePaneChrome || drag.type !== "pane-drag") return false;
|
|
@@ -179,14 +190,40 @@ export function useShellActiveDrag({
|
|
|
179
190
|
const rest = event.type === "drag" ? () => { if (dragRef.current === drag) handleRef.current(event); } : undefined;
|
|
180
191
|
return memo.pace.travelling({ t: performance.now(), x: preciseX, y: preciseShellY }, magnetDistances, rest);
|
|
181
192
|
};
|
|
182
|
-
|
|
193
|
+
// Where a move lands the pane (`rect`), and where its magnets hold it as
|
|
194
|
+
// the pointer slows down (`snapped`).
|
|
195
|
+
const snapMove = (paneId: string, rect: FloatingRect): { rect: FloatingRect; snapped: FloatingRect } => {
|
|
183
196
|
if (magnetsOff) {
|
|
184
197
|
memo.latch = NO_LATCH;
|
|
185
|
-
return rect;
|
|
198
|
+
return { rect, snapped: rect };
|
|
186
199
|
}
|
|
187
200
|
const snapped = snapMovedRect(rect, magnetTargets(paneId), magnetArea, magnetDistances, memo.latch);
|
|
188
201
|
memo.latch = snapped.latch;
|
|
189
|
-
return travelling() ? rect : snapped.rect;
|
|
202
|
+
return { rect: travelling() ? rect : snapped.rect, snapped: snapped.rect };
|
|
203
|
+
};
|
|
204
|
+
// Desktop: the moving pane is drawn under the pointer while it moves, and
|
|
205
|
+
// where its magnets hold it once the pointer slows down to place it,
|
|
206
|
+
// gliding between the two (the frames after the pointer stops carry the
|
|
207
|
+
// glide on). The terminal draws where a release would land it.
|
|
208
|
+
const drawMove = (paneId: string, free: FloatingRect, moved: { rect: FloatingRect; snapped: FloatingRect }) => {
|
|
209
|
+
if (!nativePaneChrome) {
|
|
210
|
+
updateDragFloatingRect({ paneId, rect: moved.rect });
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const { snapped } = moved;
|
|
214
|
+
let drawn: { x: number; y: number } | null = null;
|
|
215
|
+
memo.glide.follow(() => {
|
|
216
|
+
const now = performance.now();
|
|
217
|
+
const placing = memo.pace.placing(now, magnetDistances);
|
|
218
|
+
const target = placing ? { x: snapped.x - free.x, y: snapped.y - free.y } : NO_GLIDE;
|
|
219
|
+
const offset = memo.glide.step(now, target);
|
|
220
|
+
// A frame that moves nothing (the pointer still, the glide at rest) restyles nothing.
|
|
221
|
+
if (!drawn || drawn.x !== offset.x || drawn.y !== offset.y) {
|
|
222
|
+
drawn = offset;
|
|
223
|
+
updateDragFloatingRect({ paneId, rect: { ...free, x: free.x + offset.x, y: free.y + offset.y } });
|
|
224
|
+
}
|
|
225
|
+
return placing && memo.glide.settled(target);
|
|
226
|
+
});
|
|
190
227
|
};
|
|
191
228
|
const snapResize = (paneId: string, rect: FloatingRect, edges: { x: -1 | 0 | 1; y: -1 | 0 | 1 }): FloatingRect => {
|
|
192
229
|
if (magnetsOff) {
|
|
@@ -221,6 +258,7 @@ export function useShellActiveDrag({
|
|
|
221
258
|
if (event.type === "drag-cancel") {
|
|
222
259
|
// The window lost focus or the system took the pointer: put everything back.
|
|
223
260
|
dropPendingJoin(memo);
|
|
261
|
+
memo.glide.reset();
|
|
224
262
|
cancelActiveDrag();
|
|
225
263
|
event.stopPropagation();
|
|
226
264
|
event.preventDefault();
|
|
@@ -248,6 +286,7 @@ export function useShellActiveDrag({
|
|
|
248
286
|
}
|
|
249
287
|
} else if (drag.type === "pane-drag") {
|
|
250
288
|
if (!isMeaningfulPaneDrag(drag.startX, drag.startY, preciseX, preciseShellY, dragThreshold)) {
|
|
289
|
+
memo.glide.reset();
|
|
251
290
|
updateDockPreview(null);
|
|
252
291
|
if (drag.mode === "floating") {
|
|
253
292
|
updateDragFloatingRect({ paneId: drag.paneId, rect: drag.origRect });
|
|
@@ -257,8 +296,10 @@ export function useShellActiveDrag({
|
|
|
257
296
|
return;
|
|
258
297
|
}
|
|
259
298
|
|
|
260
|
-
const
|
|
261
|
-
|
|
299
|
+
const freeRect = resolvePaneDragFloatingRect(drag, dragBaseRect()!, drawX, drawShellY, width, contentHeight);
|
|
300
|
+
const moved = snapMove(drag.paneId, freeRect);
|
|
301
|
+
const nextRect = moved.rect;
|
|
302
|
+
drawMove(drag.paneId, freeRect, moved);
|
|
262
303
|
|
|
263
304
|
// Over a title bar it would be a tab there; pushed against a docked
|
|
264
305
|
// pane's edge it would join the dock on that side.
|
|
@@ -325,6 +366,7 @@ export function useShellActiveDrag({
|
|
|
325
366
|
|
|
326
367
|
if (event.type === "up" || event.type === "drag-end") {
|
|
327
368
|
dropPendingJoin(memo);
|
|
369
|
+
memo.glide.reset();
|
|
328
370
|
if (drag.type === "divider") {
|
|
329
371
|
if (live.get().divider) {
|
|
330
372
|
const nextLayout = resizeSplitAtPath(baseLayout, drag.path, dividerRatioAt(preciseX, preciseShellY));
|
|
@@ -343,7 +385,7 @@ export function useShellActiveDrag({
|
|
|
343
385
|
// A click on a stack's tab shows that pane.
|
|
344
386
|
if (drag.mode === "docked") focusPane(drag.paneId);
|
|
345
387
|
} else {
|
|
346
|
-
const releaseRect = snapMove(drag.paneId, resolvePaneDragFloatingRect(drag, dragBaseRect()!, preciseX, preciseShellY, width, contentHeight));
|
|
388
|
+
const releaseRect = snapMove(drag.paneId, resolvePaneDragFloatingRect(drag, dragBaseRect()!, preciseX, preciseShellY, width, contentHeight)).rect;
|
|
347
389
|
const nextLayout = finalizePaneDragRelease(baseLayout, drag.paneId, releaseRect, live.get().dockPreview);
|
|
348
390
|
if (windowMode) {
|
|
349
391
|
updateWindowModePreviewLayout(nextLayout, drag.paneId);
|