gloomberb 0.20.3 → 0.20.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +3 -1
- package/src/account/auth-dialog.tsx +17 -0
- package/src/api-client/data.ts +144 -35
- package/src/api-client/fx-interventions.ts +64 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/release-summaries.ts +21 -0
- package/src/api-client/types/econ.ts +12 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +8 -2
- package/src/app/keybindings/config.ts +2 -1
- package/src/app/keybindings/index.ts +1 -0
- package/src/app/keybindings/labels.ts +6 -1
- package/src/app/keybindings/resolve.ts +23 -4
- package/src/app/keybindings/terminal-keys.ts +35 -0
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +274 -67
- package/src/architecture/ui-literals-allowlist.json +1 -1
- package/src/capabilities/chart-series.ts +27 -1
- package/src/cli/commands/keybindings.ts +5 -5
- package/src/cli/commands/market.ts +154 -21
- package/src/cli/commands/news-search.ts +60 -10
- package/src/cli/commands/overview.ts +16 -1
- package/src/cli/commands/plugins.ts +27 -5
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +20 -4
- package/src/cli/commands/ticker.ts +60 -19
- package/src/cli/fx-forward.ts +25 -7
- package/src/cli/glossary.ts +19 -5
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index.ts +8 -8
- package/src/cli/known-gaps.ts +27 -1
- package/src/cli/listing-arg.ts +11 -1
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/function-help.ts +5 -5
- package/src/cli/report-tables.ts +18 -6
- package/src/cli/result.ts +15 -7
- package/src/cli/types.ts +2 -0
- package/src/components/chart/composite/axis-overlays.tsx +22 -0
- package/src/components/chart/composite/composite-chart.tsx +54 -13
- package/src/components/chart/composite/event-captions.ts +109 -0
- package/src/components/chart/composite/event-guides.ts +74 -0
- package/src/components/chart/composite/rasterizer.ts +2 -0
- package/src/components/chart/composite/text-renderer.ts +2 -0
- package/src/components/chart/composite/types.ts +31 -0
- package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/provider-search.ts +5 -4
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/detached-pane-shell.tsx +1 -1
- package/src/components/layout/floating-pane.tsx +5 -1
- package/src/components/layout/pane/footer/index.tsx +21 -14
- package/src/components/layout/pane/footer/model.ts +6 -0
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
- package/src/components/layout/shell/active-drag.ts +149 -105
- package/src/components/layout/shell/drag/drop-zones.ts +162 -0
- package/src/components/layout/shell/drag/index.ts +47 -218
- package/src/components/layout/shell/drag/live.ts +10 -3
- package/src/components/layout/shell/drag/overlays.tsx +182 -5
- package/src/components/layout/shell/drag/runtime.ts +29 -6
- package/src/components/layout/shell/drag/shared-edges.ts +156 -0
- package/src/components/layout/shell/index.tsx +11 -6
- package/src/components/layout/shell/menu.ts +11 -2
- package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
- package/src/components/layout/shell/native/window-state.ts +2 -2
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/shell/pane/layers.tsx +71 -7
- package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
- package/src/components/layout/shell/window-mode/index.ts +8 -10
- package/src/components/layout/status-bar.tsx +6 -1
- package/src/components/layout/window-edit/mode.ts +39 -7
- package/src/components/layout/window-edit/presentation.ts +1 -1
- package/src/components/onboarding/first-run-workspace.ts +44 -2
- package/src/components/onboarding/onboarding-frame.tsx +11 -2
- package/src/components/onboarding/onboarding-keyboard.ts +20 -0
- package/src/components/onboarding/onboarding-wizard.tsx +16 -11
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
- package/src/components/onboarding/use-onboarding-progress.ts +12 -4
- package/src/components/pane-settings-dialog/desktop.tsx +2 -2
- package/src/components/pane-settings-dialog/tui.tsx +2 -2
- package/src/components/pane-settings-dialog/value.ts +6 -0
- package/src/components/pane-settings-dialog.tsx +3 -3
- package/src/components/reader/detail-reader.tsx +4 -0
- package/src/components/ui/button.tsx +2 -0
- package/src/components/ui/choice-dialog.tsx +1 -0
- package/src/components/ui/data-table/index.tsx +4 -3
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/list-view.tsx +7 -12
- package/src/components/ui/loading.tsx +10 -3
- package/src/components/ui/menu.tsx +6 -2
- package/src/components/ui/page-stack-view.tsx +3 -0
- package/src/components/ui/pane-link-chip.tsx +269 -54
- package/src/components/ui/query-bar.tsx +2 -1
- package/src/components/ui/quote.ts +14 -1
- package/src/components/ui/tabs.tsx +97 -19
- package/src/core/state/app/layout-reducer.ts +7 -0
- package/src/core/state/app/layout.ts +44 -7
- package/src/core/state/app/state.ts +1 -1
- package/src/core/state/app/types.ts +22 -2
- package/src/data/config/layout.ts +5 -2
- package/src/docs/snapshot.json +54 -13
- package/src/i18n/es.ts +9 -8
- package/src/i18n/ja.ts +9 -8
- package/src/i18n/ko.ts +9 -8
- package/src/i18n/zh-cn.ts +9 -8
- package/src/i18n/zh-tw.ts +9 -8
- package/src/layout/pane-manager/floating-actions.ts +17 -0
- package/src/layout/pane-manager/floating-stack.ts +187 -0
- package/src/layout/pane-manager/floating.ts +4 -2
- package/src/layout/pane-manager/gridlock.ts +5 -1
- package/src/layout/pane-manager/index.ts +11 -0
- package/src/layout/pane-manager/layout-state.ts +10 -3
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/futures-board.ts +46 -1
- package/src/market-data/futures-contract.ts +12 -3
- package/src/market-data/fx-interventions.ts +270 -0
- package/src/market-data/market/dated-previous-close.ts +94 -15
- package/src/market-data/market/status.ts +17 -1
- package/src/news/news-model.ts +44 -2
- package/src/plugins/builtin/alerts/cli.ts +4 -4
- package/src/plugins/builtin/alerts/format.ts +1 -2
- package/src/plugins/builtin/alerts/headless.ts +1 -2
- package/src/plugins/builtin/alerts/move-checks.ts +12 -6
- package/src/plugins/builtin/alerts/move.ts +30 -9
- package/src/plugins/builtin/alerts/pane.tsx +0 -2
- package/src/plugins/builtin/alerts/storage.ts +4 -2
- package/src/plugins/builtin/alerts/types.ts +12 -0
- package/src/plugins/builtin/analytics/risk-client.ts +10 -4
- package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
- package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
- package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
- package/src/plugins/builtin/awards/index.tsx +1 -1
- package/src/plugins/builtin/buildout/index.tsx +1 -0
- package/src/plugins/builtin/catalysts/index.tsx +2 -2
- package/src/plugins/builtin/cds/headless.ts +4 -0
- package/src/plugins/builtin/changelog/index.tsx +292 -101
- package/src/plugins/builtin/changelog/versions.ts +293 -0
- package/src/plugins/builtin/chart-composer/headless.ts +2 -1
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
- package/src/plugins/builtin/chat/content/composer.tsx +5 -4
- package/src/plugins/builtin/chat/content/index.tsx +12 -2
- package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
- package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
- package/src/plugins/builtin/chat/layout.ts +5 -2
- package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
- package/src/plugins/builtin/chat/message/render-state.ts +2 -5
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
- package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
- package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
- package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
- package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
- package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
- package/src/plugins/builtin/cloud/askg/model.ts +14 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
- package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
- package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
- package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +52 -9
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
- package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
- package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
- package/src/plugins/builtin/company-attention/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +3 -1
- package/src/plugins/builtin/company-kpis/index.tsx +2 -2
- package/src/plugins/builtin/cot/headless.ts +14 -2
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/crypto-board/index.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
- package/src/plugins/builtin/doe/index.tsx +1 -1
- package/src/plugins/builtin/earnings/index.tsx +2 -2
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +74 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
- package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
- package/src/plugins/builtin/executives/index.tsx +1 -0
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fixed-income/index.tsx +1 -0
- package/src/plugins/builtin/futures/index.tsx +25 -4
- package/src/plugins/builtin/futures/model.ts +28 -32
- package/src/plugins/builtin/futures/series.ts +4 -3
- package/src/plugins/builtin/futures/table.tsx +16 -9
- package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
- package/src/plugins/builtin/futures-curve/headless.ts +3 -3
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +18 -0
- package/src/plugins/builtin/gpu/index.tsx +1 -1
- package/src/plugins/builtin/help/functions-table.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +14 -4
- package/src/plugins/builtin/help/keybindings-editor.tsx +19 -5
- package/src/plugins/builtin/holders/index.tsx +1 -0
- package/src/plugins/builtin/holders/report-header.ts +2 -2
- package/src/plugins/builtin/insider/index.tsx +1 -0
- package/src/plugins/builtin/iv-history/index.tsx +1 -1
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/layout-manager/index.tsx +8 -8
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +19 -3
- package/src/plugins/builtin/macro-day/pane.tsx +14 -9
- package/src/plugins/builtin/macro-day/releases.ts +25 -7
- package/src/plugins/builtin/market-valuation/index.tsx +1 -0
- package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
- package/src/plugins/builtin/members/index.tsx +1 -1
- package/src/plugins/builtin/mna/index.tsx +1 -0
- package/src/plugins/builtin/news/headless.ts +2 -2
- package/src/plugins/builtin/news/index.tsx +4 -3
- package/src/plugins/builtin/news/wire/index.tsx +5 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options-positioning/index.tsx +1 -0
- package/src/plugins/builtin/pe-band/index.tsx +1 -1
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/event-model.ts +9 -1
- package/src/plugins/builtin/research/event-sources.ts +22 -0
- package/src/plugins/builtin/research/headless.ts +11 -5
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research-search/index.tsx +1 -0
- package/src/plugins/builtin/research-search/pane.tsx +8 -0
- package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/scanner/headless.ts +52 -13
- package/src/plugins/builtin/seasonality/index.tsx +1 -1
- package/src/plugins/builtin/sec/index.tsx +1 -0
- package/src/plugins/builtin/series-inventory.ts +1 -1
- package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
- package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
- package/src/plugins/builtin/short-interest/index.tsx +1 -0
- package/src/plugins/builtin/social-mentions/index.tsx +1 -1
- package/src/plugins/builtin/supply-chain/index.tsx +1 -0
- package/src/plugins/builtin/thirteenf/data.ts +43 -10
- package/src/plugins/builtin/thirteenf/headless.ts +55 -11
- package/src/plugins/builtin/thirteenf/model.ts +25 -9
- package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
- package/src/plugins/builtin/thirteenf/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/financials/model.ts +12 -0
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +5 -5
- package/src/plugins/builtin/ticker-detail/headless.ts +18 -13
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +34 -17
- package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
- package/src/plugins/builtin/time-sales/client.ts +9 -11
- package/src/plugins/builtin/time-sales/index.tsx +1 -1
- package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +18 -3
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +109 -19
- package/src/plugins/builtin/treasury-auctions/index.tsx +14 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +256 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +139 -28
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
- package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
- package/src/plugins/builtin/vol-surface/index.tsx +1 -1
- package/src/plugins/builtin/world-venue-map/index.ts +1 -0
- package/src/plugins/builtin/yield-curve/curves.ts +10 -4
- package/src/plugins/builtin/yield-curve/headless.ts +6 -2
- package/src/plugins/builtin/yield-curve/index.tsx +3 -3
- package/src/plugins/builtin/yield-curve/series.ts +10 -0
- package/src/plugins/builtin/yield-curve/world.ts +3 -1
- package/src/plugins/installer.ts +45 -0
- package/src/portfolio/column-values.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
- package/src/public/remote.ts +7 -1
- package/src/remote/client.ts +191 -11
- package/src/remote/controller-utils.ts +13 -1
- package/src/remote/controller.ts +88 -26
- package/src/remote/endpoint.ts +24 -0
- package/src/remote/form.ts +59 -4
- package/src/remote/resources.ts +56 -19
- package/src/remote/schema.ts +22 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-helpers.ts +29 -1
- package/src/remote/semantic-tree.tsx +44 -15
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/cloudflare/worker.ts +16 -1
- package/src/renderers/dom/styles.css +40 -6
- package/src/renderers/opentui/host.tsx +6 -0
- package/src/renderers/share/layout-view.tsx +1 -1
- package/src/series/standalone.ts +2 -2
- package/src/shares/api.ts +21 -4
- package/src/shares/item.ts +73 -0
- package/src/shares/pane-item.ts +205 -0
- package/src/shares/pane.ts +4 -0
- package/src/shares/payload.ts +9 -5
- package/src/sources/gloomberb-cloud/news.ts +37 -12
- package/src/state/opening-ticker-panes.ts +47 -0
- package/src/test-support/cli-context.ts +2 -0
- package/src/test-support/preload.ts +4 -1
- package/src/tickers/instrument-kind.ts +23 -3
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/resolve.ts +2 -2
- package/src/types/config.ts +5 -0
- package/src/types/context-menu.ts +2 -0
- package/src/types/financials.ts +1 -0
- package/src/types/plugin-commands.ts +140 -0
- package/src/types/plugin-context.ts +125 -0
- package/src/types/plugin-contributions.ts +55 -0
- package/src/types/plugin-definition.ts +234 -0
- package/src/types/plugin-notifications.ts +38 -0
- package/src/types/plugin-pane-settings.ts +116 -0
- package/src/types/plugin-pane-templates.ts +160 -0
- package/src/types/plugin-panes.ts +243 -0
- package/src/types/plugin-reports.ts +35 -0
- package/src/types/plugin-shared.ts +14 -0
- package/src/types/plugin-state.ts +71 -0
- package/src/types/plugin.ts +14 -1169
- package/src/ui/index.tsx +14 -3
- package/src/updater/github-releases.ts +23 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/cli-output.ts +22 -9
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/untrusted-text.ts +29 -0
|
@@ -3,7 +3,11 @@ import {
|
|
|
3
3
|
MIN_FLOAT_WIDTH,
|
|
4
4
|
applyDrop,
|
|
5
5
|
floatAtRect,
|
|
6
|
-
|
|
6
|
+
floatingStackMembers,
|
|
7
|
+
splitFloating,
|
|
8
|
+
stackFloatingOnto,
|
|
9
|
+
unstackFloating,
|
|
10
|
+
type FloatingSplitSide,
|
|
7
11
|
type DropTarget,
|
|
8
12
|
type FloatingRect,
|
|
9
13
|
type LayoutBounds,
|
|
@@ -12,36 +16,35 @@ import type { DesktopDockPreviewState } from "../../../../types/desktop-window";
|
|
|
12
16
|
import type { LayoutConfig } from "../../../../types/config";
|
|
13
17
|
import { PANE_HEADER_ACTION, PANE_HEADER_CLOSE, PANE_HEADER_HELP, PANE_HEADER_RESTORE } from "../../pane/header";
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
| "
|
|
18
|
-
| "
|
|
19
|
-
| "bottom"
|
|
20
|
-
| "top-left"
|
|
21
|
-
| "top-right"
|
|
22
|
-
| "bottom-left"
|
|
23
|
-
| "bottom-right";
|
|
24
|
-
|
|
25
|
-
export interface SnapGuide {
|
|
26
|
-
position: SnapGuidePosition;
|
|
27
|
-
triggerRect: LayoutBounds;
|
|
28
|
-
previewRect: FloatingRect;
|
|
29
|
-
}
|
|
19
|
+
/** A release onto a floating window: a tab of it, or half of its rect beside it. */
|
|
20
|
+
type FloatDrop =
|
|
21
|
+
| { type: "tab"; targetId: string }
|
|
22
|
+
| { type: "split"; targetId: string; side: FloatingSplitSide };
|
|
30
23
|
|
|
24
|
+
/** Where a release lands a pane on the move, outlined while it would. */
|
|
31
25
|
export type DragPreview =
|
|
32
26
|
| {
|
|
27
|
+
/** A place in the layout: a split, a tab, or along a whole edge. */
|
|
33
28
|
kind: "dock";
|
|
34
29
|
target: DropTarget;
|
|
35
30
|
rect: LayoutBounds;
|
|
36
31
|
}
|
|
37
32
|
| {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
/** On a floating window: a tab of it, or half of it. */
|
|
34
|
+
kind: "float";
|
|
35
|
+
drop: FloatDrop;
|
|
36
|
+
rect: LayoutBounds;
|
|
41
37
|
};
|
|
42
38
|
|
|
39
|
+
/**
|
|
40
|
+
* What a pane move takes: a pane in the layout (drawn as an outline until it
|
|
41
|
+
* lands), a floating window with every tab of its stack, or one tab pulled
|
|
42
|
+
* out of a floating stack (an outline too, the stack staying where it is).
|
|
43
|
+
*/
|
|
44
|
+
export type PaneDragMode = "docked" | "floating" | "tab";
|
|
45
|
+
|
|
43
46
|
export interface PaneDragRectState {
|
|
44
|
-
mode:
|
|
47
|
+
mode: PaneDragMode;
|
|
45
48
|
startX: number;
|
|
46
49
|
startY: number;
|
|
47
50
|
origRect: FloatingRect;
|
|
@@ -120,7 +123,7 @@ export function constrainFloatingRectToBounds(
|
|
|
120
123
|
* hold it in: a docked pane at its floating size, held where it was pressed
|
|
121
124
|
* (as far into it as it reaches); a floating one moved by the pointer.
|
|
122
125
|
*/
|
|
123
|
-
|
|
126
|
+
function freePaneDragRect(
|
|
124
127
|
drag: PaneDragRectState,
|
|
125
128
|
baseRect: FloatingRect,
|
|
126
129
|
pointerX: number,
|
|
@@ -128,7 +131,7 @@ export function freePaneDragRect(
|
|
|
128
131
|
totalWidth: number,
|
|
129
132
|
totalHeight: number,
|
|
130
133
|
): FloatingRect {
|
|
131
|
-
if (drag.mode
|
|
134
|
+
if (drag.mode !== "floating") {
|
|
132
135
|
const fittedRect = constrainFloatingRectToBounds(baseRect, totalWidth, totalHeight);
|
|
133
136
|
const pointerOffsetX = Math.max(0, Math.min(fittedRect.width - 1, drag.startX - drag.origRect.x));
|
|
134
137
|
const pointerOffsetY = Math.max(0, Math.min(fittedRect.height - 1, drag.startY - drag.origRect.y));
|
|
@@ -182,122 +185,6 @@ export function resolveFloatResizeRect(
|
|
|
182
185
|
return constrainFloatingRectToBounds({ x, y, width, height, zIndex: origRect.zIndex }, totalWidth, totalHeight);
|
|
183
186
|
}
|
|
184
187
|
|
|
185
|
-
/** A distance on each axis, in cells. */
|
|
186
|
-
export interface AxisDistance {
|
|
187
|
-
x: number;
|
|
188
|
-
y: number;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const JOIN_SIDES = [
|
|
192
|
-
["left", "x"],
|
|
193
|
-
["right", "x"],
|
|
194
|
-
["top", "y"],
|
|
195
|
-
["bottom", "y"],
|
|
196
|
-
] as const;
|
|
197
|
-
|
|
198
|
-
type JoinSide = (typeof JOIN_SIDES)[number][0];
|
|
199
|
-
|
|
200
|
-
/** Where a pane on the move could land on release, if anywhere but where it is drawn. */
|
|
201
|
-
export interface PaneDropTargets {
|
|
202
|
-
/** Over another spot's title bar: a tab there, what a release makes until a join has held. */
|
|
203
|
-
tab: Extract<DropTarget, { kind: "tab" }> | null;
|
|
204
|
-
/** An edge held flush: a join on that side, once it has held (JOIN_DWELL_MS), over the tab too. */
|
|
205
|
-
join: Extract<DropTarget, { kind: "leaf" }> | null;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const NO_DROP: PaneDropTargets = { tab: null, join: null };
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Where a pane on the move could land on release. Over another spot's title
|
|
212
|
-
* bar it becomes a tab there. Its edge pushed flush against the same edge of
|
|
213
|
-
* the spot under the pointer, where that spot meets another (never the dock's
|
|
214
|
-
* own edge, so a window parked at the screen's edge or corner stays
|
|
215
|
-
* floating), it joins the dock on that side: where it is drawn and where the
|
|
216
|
-
* pointer puts it, that edge is within `flush` of the spot's. The pointer may
|
|
217
|
-
* be on that spot's title bar: a pane is held by its own, so it is there for
|
|
218
|
-
* every join above a spot and for a side join with the two title bars level.
|
|
219
|
-
* An axis the pane spans from edge to edge of the spot gives it no side to
|
|
220
|
-
* join on there, so a pane laid squarely on a spot of its size is a tab. The
|
|
221
|
-
* caller arms a join only once it has held (see JOIN_DWELL_MS); until then a
|
|
222
|
-
* release on the title bar makes the tab. `join` false (Alt) leaves the
|
|
223
|
-
* edges out.
|
|
224
|
-
*/
|
|
225
|
-
export function resolvePaneDropTarget({
|
|
226
|
-
x,
|
|
227
|
-
y,
|
|
228
|
-
rect,
|
|
229
|
-
free,
|
|
230
|
-
leaves,
|
|
231
|
-
paneId,
|
|
232
|
-
area,
|
|
233
|
-
flush,
|
|
234
|
-
headerRows,
|
|
235
|
-
join,
|
|
236
|
-
}: {
|
|
237
|
-
/** The pointer, in shell cells. */
|
|
238
|
-
x: number;
|
|
239
|
-
y: number;
|
|
240
|
-
/** Where the moving pane is drawn, its edges caught by the magnets. */
|
|
241
|
-
rect: LayoutBounds;
|
|
242
|
-
/** Where the pointer alone puts it, past the screen's edges if it goes there. */
|
|
243
|
-
free: LayoutBounds;
|
|
244
|
-
leaves: readonly DockLeafLayout[];
|
|
245
|
-
paneId: string;
|
|
246
|
-
/** The dock area. */
|
|
247
|
-
area: LayoutBounds;
|
|
248
|
-
/** How close its edge comes to a spot's edge to count as flush (the magnets' catch). */
|
|
249
|
-
flush: AxisDistance;
|
|
250
|
-
/** A docked pane's title bar, in rows. */
|
|
251
|
-
headerRows: number;
|
|
252
|
-
join: boolean;
|
|
253
|
-
}): PaneDropTargets {
|
|
254
|
-
if (!pointInRect(area, x, y)) return NO_DROP;
|
|
255
|
-
const leaf = leaves.find((entry) => pointInRect(entry.rect, x, y));
|
|
256
|
-
if (!leaf) return NO_DROP;
|
|
257
|
-
// Its own spot: alone there, nothing to land on; a tab of a stack can
|
|
258
|
-
// leave it for a side of the stack, but is a tab of it already, and its
|
|
259
|
-
// title bar is where the tab is pulled out from.
|
|
260
|
-
const own = leaf.instanceId === paneId || (leaf.stack?.includes(paneId) ?? false);
|
|
261
|
-
const targetId = leaf.instanceId !== paneId ? leaf.instanceId : leaf.stack?.find((id) => id !== paneId);
|
|
262
|
-
if (!targetId) return NO_DROP;
|
|
263
|
-
const onTitleBar = y < leaf.rect.y + headerRows;
|
|
264
|
-
if (onTitleBar && own) return NO_DROP;
|
|
265
|
-
const tab = onTitleBar ? { kind: "tab" as const, targetId } : null;
|
|
266
|
-
if (!join) return { tab, join: null };
|
|
267
|
-
const edgeOf = (box: LayoutBounds, side: JoinSide) => (
|
|
268
|
-
side === "left" ? box.x : side === "right" ? box.x + box.width : side === "top" ? box.y : box.y + box.height
|
|
269
|
-
);
|
|
270
|
-
// How far the edge on `side` is from the spot's, in catches, where it is
|
|
271
|
-
// drawn; null unless it is flush there and where the pointer puts it.
|
|
272
|
-
const closenessAt = (side: JoinSide, axis: keyof AxisDistance) => {
|
|
273
|
-
const line = edgeOf(leaf.rect, side);
|
|
274
|
-
if (Math.abs(edgeOf(free, side) - line) > flush[axis]) return null;
|
|
275
|
-
const closeness = Math.abs(edgeOf(rect, side) - line) / Math.max(flush[axis], 1e-6);
|
|
276
|
-
return closeness <= 1 ? closeness : null;
|
|
277
|
-
};
|
|
278
|
-
const spans = {
|
|
279
|
-
x: closenessAt("left", "x") !== null && closenessAt("right", "x") !== null,
|
|
280
|
-
y: closenessAt("top", "y") !== null && closenessAt("bottom", "y") !== null,
|
|
281
|
-
};
|
|
282
|
-
// The closest edge wins; level with another, the first of left, right, top, bottom.
|
|
283
|
-
let best: { side: JoinSide; closeness: number } | null = null;
|
|
284
|
-
for (const [side, axis] of JOIN_SIDES) {
|
|
285
|
-
if (spans[axis]) continue;
|
|
286
|
-
// The dock's own edge is the screen's: parking there is not joining.
|
|
287
|
-
if (Math.abs(edgeOf(leaf.rect, side) - edgeOf(area, side)) <= flush[axis]) continue;
|
|
288
|
-
const closeness = closenessAt(side, axis);
|
|
289
|
-
if (closeness !== null && (!best || closeness < best.closeness)) best = { side, closeness };
|
|
290
|
-
}
|
|
291
|
-
return { tab, join: best ? { kind: "leaf", targetId, position: best.side } : null };
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* How long an edge holds flush before the join arms and its preview shows, so
|
|
296
|
-
* a window moved past a docked pane's edge, or briefly lined up with it, does
|
|
297
|
-
* not dock on release.
|
|
298
|
-
*/
|
|
299
|
-
export const JOIN_DWELL_MS = 350;
|
|
300
|
-
|
|
301
188
|
export function resolveDividerPreviewRect(
|
|
302
189
|
axis: "horizontal" | "vertical",
|
|
303
190
|
bounds: LayoutBounds,
|
|
@@ -336,90 +223,32 @@ export function finalizePaneDragRelease(
|
|
|
336
223
|
paneId: string,
|
|
337
224
|
previewRect: FloatingRect,
|
|
338
225
|
dockPreview: DragPreview | null,
|
|
226
|
+
mode: PaneDragMode = "floating",
|
|
339
227
|
): LayoutConfig {
|
|
228
|
+
// A floating stack moved by its title bar lands whole: its other tabs follow as tabs of the one moved.
|
|
229
|
+
const others = mode === "floating"
|
|
230
|
+
? floatingStackMembers(layout.floating, paneId).map((entry) => entry.instanceId).filter((id) => id !== paneId)
|
|
231
|
+
: [];
|
|
340
232
|
if (dockPreview?.kind === "dock") {
|
|
341
|
-
|
|
233
|
+
let next = applyDrop(layout, paneId, dockPreview.target);
|
|
234
|
+
for (const id of others) next = applyDrop(next, id, { kind: "tab", targetId: paneId });
|
|
235
|
+
return next;
|
|
342
236
|
}
|
|
343
|
-
if (dockPreview?.kind === "
|
|
344
|
-
|
|
237
|
+
if (dockPreview?.kind === "float") {
|
|
238
|
+
const { drop } = dockPreview;
|
|
239
|
+
if (drop.type === "tab") {
|
|
240
|
+
let next = layout;
|
|
241
|
+
for (const id of others) next = stackFloatingOnto(next, id, drop.targetId);
|
|
242
|
+
return stackFloatingOnto(next, paneId, drop.targetId);
|
|
243
|
+
}
|
|
244
|
+
let next = splitFloating(layout, paneId, drop.targetId, drop.side);
|
|
245
|
+
for (const id of others) next = stackFloatingOnto(next, id, paneId);
|
|
246
|
+
return next;
|
|
345
247
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
const halfWidth = Math.max(1, Math.floor(width / 2));
|
|
351
|
-
const halfHeight = Math.max(1, Math.floor(height / 2));
|
|
352
|
-
const cornerWidth = Math.max(8, Math.min(16, Math.floor(width * 0.2)));
|
|
353
|
-
const cornerHeight = Math.max(4, Math.min(8, Math.floor(height * 0.22)));
|
|
354
|
-
const edgeWidth = Math.max(6, Math.min(10, Math.floor(width * 0.1)));
|
|
355
|
-
const topBottomEdgeHeight = Math.max(2, Math.min(4, Math.floor(height * 0.1)));
|
|
356
|
-
|
|
357
|
-
return [
|
|
358
|
-
{
|
|
359
|
-
position: "top-left",
|
|
360
|
-
triggerRect: { x: 0, y: 0, width: cornerWidth, height: cornerHeight },
|
|
361
|
-
previewRect: { x: 0, y: 0, width: halfWidth, height: halfHeight },
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
position: "top-right",
|
|
365
|
-
triggerRect: { x: Math.max(0, width - cornerWidth), y: 0, width: cornerWidth, height: cornerHeight },
|
|
366
|
-
previewRect: { x: Math.max(0, width - halfWidth), y: 0, width: halfWidth, height: halfHeight },
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
position: "bottom-left",
|
|
370
|
-
triggerRect: { x: 0, y: Math.max(0, height - cornerHeight), width: cornerWidth, height: cornerHeight },
|
|
371
|
-
previewRect: { x: 0, y: Math.max(0, height - halfHeight), width: halfWidth, height: halfHeight },
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
position: "bottom-right",
|
|
375
|
-
triggerRect: {
|
|
376
|
-
x: Math.max(0, width - cornerWidth),
|
|
377
|
-
y: Math.max(0, height - cornerHeight),
|
|
378
|
-
width: cornerWidth,
|
|
379
|
-
height: cornerHeight,
|
|
380
|
-
},
|
|
381
|
-
previewRect: {
|
|
382
|
-
x: Math.max(0, width - halfWidth),
|
|
383
|
-
y: Math.max(0, height - halfHeight),
|
|
384
|
-
width: halfWidth,
|
|
385
|
-
height: halfHeight,
|
|
386
|
-
},
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
position: "left",
|
|
390
|
-
triggerRect: { x: 0, y: cornerHeight, width: edgeWidth, height: Math.max(1, height - (cornerHeight * 2)) },
|
|
391
|
-
previewRect: { x: 0, y: 0, width: halfWidth, height },
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
position: "right",
|
|
395
|
-
triggerRect: {
|
|
396
|
-
x: Math.max(0, width - edgeWidth),
|
|
397
|
-
y: cornerHeight,
|
|
398
|
-
width: edgeWidth,
|
|
399
|
-
height: Math.max(1, height - (cornerHeight * 2)),
|
|
400
|
-
},
|
|
401
|
-
previewRect: { x: Math.max(0, width - halfWidth), y: 0, width: halfWidth, height },
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
position: "top",
|
|
405
|
-
triggerRect: { x: cornerWidth, y: 0, width: Math.max(1, width - (cornerWidth * 2)), height: topBottomEdgeHeight },
|
|
406
|
-
previewRect: { x: 0, y: 0, width, height: halfHeight },
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
position: "bottom",
|
|
410
|
-
triggerRect: {
|
|
411
|
-
x: cornerWidth,
|
|
412
|
-
y: Math.max(0, height - topBottomEdgeHeight),
|
|
413
|
-
width: Math.max(1, width - (cornerWidth * 2)),
|
|
414
|
-
height: topBottomEdgeHeight,
|
|
415
|
-
},
|
|
416
|
-
previewRect: { x: 0, y: Math.max(0, height - halfHeight), width, height: halfHeight },
|
|
417
|
-
},
|
|
418
|
-
];
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
export function resolveSnapGuide(x: number, y: number, guides: SnapGuide[]): SnapGuide | null {
|
|
422
|
-
return guides.find((guide) => pointInRect(guide.triggerRect, x, y)) ?? null;
|
|
248
|
+
// Anywhere else it floats where it is drawn: a tab pulled out of a
|
|
249
|
+
// floating stack on its own, a stack moved by its title bar whole.
|
|
250
|
+
const from = mode === "tab" ? unstackFloating(layout, paneId) : layout;
|
|
251
|
+
return floatAtRect(from, paneId, previewRect);
|
|
423
252
|
}
|
|
424
253
|
|
|
425
254
|
export function resolveHeaderHitAreas(
|
|
@@ -2,7 +2,8 @@ import { startTransition, useCallback, useLayoutEffect, useRef, useState, useSyn
|
|
|
2
2
|
import type { FloatingRect, LayoutBounds } from "../../../../layout/pane-manager";
|
|
3
3
|
import type { BoxRenderable, LiveBoxFrame } from "../../../../ui";
|
|
4
4
|
import type { DividerPreviewState } from "../native/window-state";
|
|
5
|
-
import { sameRect, type DragPreview } from "./index";
|
|
5
|
+
import { sameRect, type DragPreview, type PaneDragMode } from "./index";
|
|
6
|
+
import type { DropZoneState } from "./drop-zones";
|
|
6
7
|
|
|
7
8
|
/** Desktop divider drag: where the panes and dividers under the split are this frame. */
|
|
8
9
|
export interface LiveDockGeometry {
|
|
@@ -19,16 +20,20 @@ export interface LiveDockGeometry {
|
|
|
19
20
|
*/
|
|
20
21
|
export interface LiveDragGeometry {
|
|
21
22
|
/** The pane being moved, from mouse down to release. */
|
|
22
|
-
paneDrag: { paneId: string; mode:
|
|
23
|
+
paneDrag: { paneId: string; mode: PaneDragMode } | null;
|
|
23
24
|
/** The floating pane being resized, from mouse down to release. */
|
|
24
25
|
paneResize: { paneId: string } | null;
|
|
25
26
|
/** The floating rect being moved or resized, already kept inside the shell. */
|
|
26
27
|
floating: { paneId: string; rect: FloatingRect } | null;
|
|
28
|
+
/** The floating windows a resize moves with it, snapped edge to edge with it, by pane. */
|
|
29
|
+
partners: ReadonlyMap<string, FloatingRect> | null;
|
|
27
30
|
divider: DividerPreviewState | null;
|
|
28
31
|
/** Desktop divider drag: the panes and dividers it resizes, where the pointer has them. */
|
|
29
32
|
dock: LiveDockGeometry | null;
|
|
30
|
-
/** Where the release would
|
|
33
|
+
/** Where the release would land the pane, if anywhere but where it is drawn. */
|
|
31
34
|
dockPreview: DragPreview | null;
|
|
35
|
+
/** The drop targets the pane on the move is over: what a release there does. */
|
|
36
|
+
zones: DropZoneState | null;
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
/**
|
|
@@ -56,9 +61,11 @@ export const IDLE_DRAG: LiveDragGeometry = {
|
|
|
56
61
|
paneDrag: null,
|
|
57
62
|
paneResize: null,
|
|
58
63
|
floating: null,
|
|
64
|
+
partners: null,
|
|
59
65
|
divider: null,
|
|
60
66
|
dock: null,
|
|
61
67
|
dockPreview: null,
|
|
68
|
+
zones: null,
|
|
62
69
|
};
|
|
63
70
|
|
|
64
71
|
export function createLiveDragStore(): LiveDragStore {
|
|
@@ -1,21 +1,38 @@
|
|
|
1
1
|
import { useRef, type CSSProperties, type RefObject } from "react";
|
|
2
|
-
import { Box, useUiCapabilities, type BoxRenderable, type LiveBoxFrame } from "../../../../ui";
|
|
2
|
+
import { Box, Text, useUiCapabilities, type BoxRenderable, type LiveBoxFrame } from "../../../../ui";
|
|
3
3
|
import { colors } from "../../../../theme/colors";
|
|
4
|
+
import { blendHex } from "../../../../theme/color-utils";
|
|
4
5
|
import { SHELL_DRAG_Z, type LayoutBounds } from "../../../../layout/pane-manager";
|
|
5
6
|
import type { DragPreview } from "./index";
|
|
6
7
|
import { useLiveBoxFrame, useLiveDrag, type LiveDragGeometry, type LiveDragStore } from "./live";
|
|
7
8
|
import { placeStyle } from "./slide";
|
|
9
|
+
import {
|
|
10
|
+
dropStrips,
|
|
11
|
+
dropZoneSquares,
|
|
12
|
+
type DropStripEdge,
|
|
13
|
+
type DropZoneMetrics,
|
|
14
|
+
type DropZoneSide,
|
|
15
|
+
type DropZoneState,
|
|
16
|
+
} from "./drop-zones";
|
|
8
17
|
|
|
9
18
|
/** Desktop: how opaque a pane on the move is while it is over somewhere to land, so the preview under it shows. */
|
|
10
19
|
export const ARMED_DRAG_OPACITY = 0.7;
|
|
11
20
|
|
|
21
|
+
/** A pane of the layout, or a tab pulled out of a floating stack, moves as an outline. */
|
|
12
22
|
function selectDockedOutline(geometry: LiveDragGeometry) {
|
|
13
23
|
const { paneDrag, floating } = geometry;
|
|
14
|
-
return paneDrag
|
|
24
|
+
return paneDrag && paneDrag.mode !== "floating" && floating?.paneId === paneDrag.paneId ? floating.rect : null;
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
const selectDockPreview = (geometry: LiveDragGeometry) => geometry.dockPreview;
|
|
28
|
+
const selectZones = (geometry: LiveDragGeometry) => geometry.zones;
|
|
18
29
|
const selectPaneDragActive = (geometry: LiveDragGeometry) => geometry.paneDrag !== null;
|
|
30
|
+
/**
|
|
31
|
+
* The targets show once the pane is on the move: past the drag threshold the
|
|
32
|
+
* drag always has a zone, if only "nowhere". A press that has not moved yet,
|
|
33
|
+
* a click to focus or to pick a tab, draws nothing.
|
|
34
|
+
*/
|
|
35
|
+
const selectTargetsShown = (geometry: LiveDragGeometry) => geometry.paneDrag !== null && geometry.zones !== null;
|
|
19
36
|
const selectOutlineWidth = (geometry: LiveDragGeometry) => selectDockedOutline(geometry)?.width ?? null;
|
|
20
37
|
const selectOutlineHeight = (geometry: LiveDragGeometry) => selectDockedOutline(geometry)?.height ?? null;
|
|
21
38
|
|
|
@@ -23,12 +40,19 @@ export function ShellDragOverlays(props: {
|
|
|
23
40
|
/** A pane from another window over this one's edge. */
|
|
24
41
|
externalDockPreview: DragPreview | null;
|
|
25
42
|
live: LiveDragStore;
|
|
43
|
+
/** The shell's content area, whose edges have the strips that put a pane along them. */
|
|
44
|
+
area: LayoutBounds;
|
|
45
|
+
/** The size of the targets, in cells. */
|
|
46
|
+
metrics: DropZoneMetrics;
|
|
26
47
|
}) {
|
|
27
48
|
const { nativePaneChrome } = useUiCapabilities();
|
|
28
49
|
return nativePaneChrome ? <DesktopDragOverlays {...props} /> : <TerminalDragOverlays {...props} />;
|
|
29
50
|
}
|
|
30
51
|
|
|
31
|
-
|
|
52
|
+
const ZONE_SIDES: readonly DropZoneSide[] = ["center", "left", "right", "top", "bottom"];
|
|
53
|
+
const STRIP_EDGES: readonly DropStripEdge[] = ["left", "right", "top", "bottom"];
|
|
54
|
+
|
|
55
|
+
/** A pane of the layout on the move is drawn as an outline at its floating size, until it is over a target. */
|
|
32
56
|
function TerminalDockedDragOutline({ live }: { live: LiveDragStore }) {
|
|
33
57
|
const rect = useLiveDrag(live, selectDockedOutline);
|
|
34
58
|
if (!rect) return null;
|
|
@@ -50,19 +74,26 @@ function TerminalDockedDragOutline({ live }: { live: LiveDragStore }) {
|
|
|
50
74
|
|
|
51
75
|
/**
|
|
52
76
|
* Terminal: where the release would land is an outline with nothing filled
|
|
53
|
-
* in, so what it is over stays readable.
|
|
77
|
+
* in, so what it is over stays readable; the targets sit over it.
|
|
54
78
|
*/
|
|
55
79
|
function TerminalDragOverlays({
|
|
56
80
|
externalDockPreview,
|
|
57
81
|
live,
|
|
82
|
+
area,
|
|
83
|
+
metrics,
|
|
58
84
|
}: {
|
|
59
85
|
externalDockPreview: DragPreview | null;
|
|
60
86
|
live: LiveDragStore;
|
|
87
|
+
area: LayoutBounds;
|
|
88
|
+
metrics: DropZoneMetrics;
|
|
61
89
|
}) {
|
|
62
90
|
const dockPreview = useLiveDrag(live, selectDockPreview);
|
|
91
|
+
const targetsShown = useLiveDrag(live, selectTargetsShown);
|
|
63
92
|
const effectiveDockPreview = dockPreview ?? externalDockPreview;
|
|
64
93
|
return (
|
|
65
94
|
<>
|
|
95
|
+
{targetsShown && <TerminalDropTargets live={live} area={area} metrics={metrics} />}
|
|
96
|
+
|
|
66
97
|
{!effectiveDockPreview && <TerminalDockedDragOutline live={live} />}
|
|
67
98
|
|
|
68
99
|
{effectiveDockPreview && (
|
|
@@ -82,6 +113,91 @@ function TerminalDragOverlays({
|
|
|
82
113
|
);
|
|
83
114
|
}
|
|
84
115
|
|
|
116
|
+
/** What a square of the target shows of the pane it lands in: all of it for a tab, a half for a side. */
|
|
117
|
+
const TERMINAL_ZONE_GLYPHS: Record<DropZoneSide, string> = {
|
|
118
|
+
center: "█",
|
|
119
|
+
left: "▌",
|
|
120
|
+
right: "▐",
|
|
121
|
+
top: "▀",
|
|
122
|
+
bottom: "▄",
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Terminal: how much of the accent tints a target, at rest and under the
|
|
127
|
+
* pointer. The desktop's tint is lighter (styles.css) because its targets
|
|
128
|
+
* also have an accent border; a strip here is a single cell with none.
|
|
129
|
+
*/
|
|
130
|
+
const TERMINAL_TARGET_TINT = { rest: 0.25, lit: 0.55 } as const;
|
|
131
|
+
|
|
132
|
+
/** `hex` (#rrggbb) at `alpha`: the terminal blends it over the cells under it and keeps their text. */
|
|
133
|
+
function translucent(hex: string, alpha: number): string {
|
|
134
|
+
return `${hex.slice(0, 7)}${Math.round(alpha * 255).toString(16).padStart(2, "0")}`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Terminal: the targets a pane on the move can land on, drawn in cells while
|
|
139
|
+
* it moves, as the desktop draws them: the window's outermost cells (a strip
|
|
140
|
+
* along each edge, tinted so what is under it still reads) and, on the pane
|
|
141
|
+
* under the pointer, the five squares of its target, each three cells wide.
|
|
142
|
+
* The one under the pointer is tinted stronger and its mark drawn full.
|
|
143
|
+
*/
|
|
144
|
+
function TerminalDropTargets({ live, area, metrics }: { live: LiveDragStore; area: LayoutBounds; metrics: DropZoneMetrics }) {
|
|
145
|
+
const zones: DropZoneState | null = useLiveDrag(live, selectZones);
|
|
146
|
+
const strips = dropStrips(area, metrics);
|
|
147
|
+
const squares = zones?.host ? dropZoneSquares(zones.host.rect, metrics) : null;
|
|
148
|
+
const accent = colors.borderFocused;
|
|
149
|
+
const rest = blendHex(colors.bg, accent, TERMINAL_TARGET_TINT.rest);
|
|
150
|
+
const lit = blendHex(colors.bg, accent, TERMINAL_TARGET_TINT.lit);
|
|
151
|
+
return (
|
|
152
|
+
<>
|
|
153
|
+
{STRIP_EDGES.map((edge) => (
|
|
154
|
+
<Box
|
|
155
|
+
key={`strip:${edge}`}
|
|
156
|
+
position="absolute"
|
|
157
|
+
left={strips[edge].x}
|
|
158
|
+
top={strips[edge].y}
|
|
159
|
+
width={strips[edge].width}
|
|
160
|
+
height={strips[edge].height}
|
|
161
|
+
zIndex={SHELL_DRAG_Z.targets}
|
|
162
|
+
backgroundColor={translucent(accent, zones?.edge === edge ? TERMINAL_TARGET_TINT.lit : TERMINAL_TARGET_TINT.rest)}
|
|
163
|
+
/>
|
|
164
|
+
))}
|
|
165
|
+
{squares && (
|
|
166
|
+
// The cells between the squares across, so the target reads as one.
|
|
167
|
+
<Box
|
|
168
|
+
position="absolute"
|
|
169
|
+
left={squares.left.x}
|
|
170
|
+
top={squares.left.y}
|
|
171
|
+
width={squares.right.x + squares.right.width - squares.left.x}
|
|
172
|
+
height={squares.left.height}
|
|
173
|
+
zIndex={SHELL_DRAG_Z.targets}
|
|
174
|
+
backgroundColor={colors.bg}
|
|
175
|
+
/>
|
|
176
|
+
)}
|
|
177
|
+
{squares && ZONE_SIDES.map((side) => {
|
|
178
|
+
const active = zones?.side === side;
|
|
179
|
+
return (
|
|
180
|
+
<Box
|
|
181
|
+
key={`zone:${side}`}
|
|
182
|
+
position="absolute"
|
|
183
|
+
left={squares[side].x}
|
|
184
|
+
top={squares[side].y}
|
|
185
|
+
width={squares[side].width}
|
|
186
|
+
height={squares[side].height}
|
|
187
|
+
zIndex={SHELL_DRAG_Z.targets}
|
|
188
|
+
flexDirection="row"
|
|
189
|
+
backgroundColor={active ? lit : rest}
|
|
190
|
+
>
|
|
191
|
+
<Text fg={accent} selectable={false}>[</Text>
|
|
192
|
+
<Text fg={active ? accent : colors.textDim} selectable={false}>{TERMINAL_ZONE_GLYPHS[side]}</Text>
|
|
193
|
+
<Text fg={accent} selectable={false}>]</Text>
|
|
194
|
+
</Box>
|
|
195
|
+
);
|
|
196
|
+
})}
|
|
197
|
+
</>
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
|
|
85
201
|
/**
|
|
86
202
|
* Desktop: an overlay laid out at the shell's corner and drawn at `rect` by a
|
|
87
203
|
* transform, hidden by opacity, so a new drop target restyles it in place.
|
|
@@ -175,13 +291,74 @@ export function DesktopDropPreview({
|
|
|
175
291
|
function DesktopDragOverlays({
|
|
176
292
|
externalDockPreview,
|
|
177
293
|
live,
|
|
294
|
+
area,
|
|
295
|
+
metrics,
|
|
178
296
|
}: {
|
|
179
297
|
externalDockPreview: DragPreview | null;
|
|
180
298
|
live: LiveDragStore;
|
|
299
|
+
area: LayoutBounds;
|
|
300
|
+
metrics: DropZoneMetrics;
|
|
181
301
|
}) {
|
|
182
302
|
const dragging = useLiveDrag(live, selectPaneDragActive);
|
|
303
|
+
const targetsShown = useLiveDrag(live, selectTargetsShown);
|
|
183
304
|
if (!dragging && !externalDockPreview) return null;
|
|
184
|
-
return
|
|
305
|
+
return (
|
|
306
|
+
<>
|
|
307
|
+
<DesktopDragOverlayLayers externalDockPreview={externalDockPreview} live={live} />
|
|
308
|
+
{targetsShown && <DesktopDropTargets live={live} area={area} metrics={metrics} />}
|
|
309
|
+
</>
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** Desktop: one drop target, a square or a strip, at `rect` (cells) from the shell's corner. */
|
|
314
|
+
function DesktopDropTarget({ rect, role, attributes }: { rect: LayoutBounds; role: string; attributes: Record<string, string> }) {
|
|
315
|
+
return (
|
|
316
|
+
<Box
|
|
317
|
+
position="absolute"
|
|
318
|
+
left={0}
|
|
319
|
+
top={0}
|
|
320
|
+
width={rect.width}
|
|
321
|
+
height={rect.height}
|
|
322
|
+
zIndex={SHELL_DRAG_Z.targets}
|
|
323
|
+
data-gloom-role={role}
|
|
324
|
+
{...attributes}
|
|
325
|
+
style={{ ...placeStyle(rect.x, rect.y), pointerEvents: "none" }}
|
|
326
|
+
/>
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Desktop: the targets a pane on the move can land on, drawn while it moves.
|
|
332
|
+
* A strip along each edge of the window (along that whole edge of the
|
|
333
|
+
* layout), and on the pane under the pointer a target of five squares (its
|
|
334
|
+
* centre a tab there, a side a split of that pane on that side); the one
|
|
335
|
+
* under the pointer lit. They render when what the pointer is over changes,
|
|
336
|
+
* never on a move.
|
|
337
|
+
*/
|
|
338
|
+
function DesktopDropTargets({ live, area, metrics }: { live: LiveDragStore; area: LayoutBounds; metrics: DropZoneMetrics }) {
|
|
339
|
+
const zones: DropZoneState | null = useLiveDrag(live, selectZones);
|
|
340
|
+
const strips = dropStrips(area, metrics);
|
|
341
|
+
const squares = zones?.host ? dropZoneSquares(zones.host.rect, metrics) : null;
|
|
342
|
+
return (
|
|
343
|
+
<>
|
|
344
|
+
{STRIP_EDGES.map((edge) => (
|
|
345
|
+
<DesktopDropTarget
|
|
346
|
+
key={`strip:${edge}`}
|
|
347
|
+
rect={strips[edge]}
|
|
348
|
+
role="drop-strip"
|
|
349
|
+
attributes={{ "data-edge": edge, "data-active": zones?.edge === edge ? "true" : "false" }}
|
|
350
|
+
/>
|
|
351
|
+
))}
|
|
352
|
+
{squares && ZONE_SIDES.map((side) => (
|
|
353
|
+
<DesktopDropTarget
|
|
354
|
+
key={`zone:${side}`}
|
|
355
|
+
rect={squares[side]}
|
|
356
|
+
role="drop-zone"
|
|
357
|
+
attributes={{ "data-side": side, "data-active": zones?.side === side ? "true" : "false" }}
|
|
358
|
+
/>
|
|
359
|
+
))}
|
|
360
|
+
</>
|
|
361
|
+
);
|
|
185
362
|
}
|
|
186
363
|
|
|
187
364
|
function DesktopDragOverlayLayers({
|