gloomberb 0.19.3 → 0.19.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/package.json +4 -2
- package/src/api-client/errors.ts +8 -0
- package/src/api-client/index.ts +18 -0
- package/src/api-client/request.ts +295 -42
- package/src/api-client/socket.ts +95 -0
- package/src/app/keybindings/actions.ts +1 -1
- package/src/app/pane-runtime/index.tsx +1 -1
- package/src/app/pane-runtime/ticker-inspector-runtime.ts +1 -1
- package/src/app/pane-runtime/ticker-open-runtime.ts +1 -1
- package/src/app/pane-runtime/ticker-open-target.ts +12 -2
- package/src/cli/commands/command-utils.ts +4 -0
- package/src/cli/commands/market.ts +119 -27
- package/src/cli/commands/search.ts +1 -1
- package/src/cli/commands/ticker.ts +10 -6
- package/src/cli/currency-name-hint.ts +60 -0
- package/src/cli/desktop-pane-shot-api-policy.ts +10 -2
- package/src/cli/desktop-pane-shot.ts +2 -1
- package/src/cli/history-rows.ts +18 -1
- package/src/cli/known-gaps.ts +17 -2
- package/src/cli/not-a-ticker.ts +5 -3
- package/src/cli/pane-functions/catalog.ts +9 -1
- package/src/cli/pane-functions/headless.ts +7 -3
- package/src/cli/pane-functions/market-session.ts +6 -7
- package/src/cli/series-search.ts +4 -5
- package/src/components/chart/composite/panel-bitmap.ts +28 -2
- package/src/components/chart/composite/time-axis.ts +17 -2
- package/src/components/command-bar/action-runtime.ts +2 -0
- package/src/components/command-bar/commands/direct/runtime.ts +3 -3
- package/src/components/command-bar/helpers.ts +2 -0
- package/src/components/command-bar/list/model.ts +9 -0
- package/src/components/command-bar/pane-actions.ts +46 -35
- package/src/components/command-bar/pane-templates/workflow.ts +6 -0
- package/src/components/command-bar/panel/index.tsx +30 -3
- package/src/components/command-bar/panel/types.ts +7 -0
- package/src/components/command-bar/routes/root/results.ts +4 -4
- package/src/components/command-bar/routes/root/selection.ts +3 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +21 -16
- package/src/components/command-bar/routing/launch-request.ts +3 -2
- package/src/components/command-bar/routing/list-state.ts +4 -1
- package/src/components/command-bar/surface/index.tsx +15 -1
- package/src/components/layout/floating-pane.tsx +10 -0
- package/src/components/layout/pane/frame.tsx +6 -0
- package/src/components/layout/pane/header.tsx +244 -42
- package/src/components/layout/pane/index.tsx +20 -2
- package/src/components/layout/shell/active-drag.ts +160 -28
- package/src/components/layout/shell/drag/index.ts +99 -96
- package/src/components/layout/shell/drag/live.ts +3 -17
- package/src/components/layout/shell/drag/magnets.ts +304 -0
- package/src/components/layout/shell/drag/overlays.tsx +77 -75
- package/src/components/layout/shell/drag/runtime.ts +12 -7
- package/src/components/layout/shell/index.tsx +66 -32
- package/src/components/layout/shell/native/pointer-runtime.ts +7 -2
- package/src/components/layout/shell/native/surfaces.ts +1 -9
- package/src/components/layout/shell/native/window-state.ts +21 -25
- package/src/components/layout/shell/pane/layers.tsx +153 -24
- package/src/components/layout/shell/shortcuts.ts +4 -1
- package/src/components/layout/shell/terminal-pointer-runtime.ts +24 -1
- package/src/components/layout/shell/window-mode/overlays.tsx +14 -6
- package/src/components/layout/status-bar.tsx +75 -6
- package/src/components/layout/window-controls.tsx +96 -35
- package/src/components/layout/window-fullscreen.ts +20 -0
- package/src/components/quote-flash.ts +36 -32
- package/src/core/app-runtime.ts +4 -1
- package/src/core/connection-health.ts +76 -1
- package/src/core/state/app/command-bar-launch.ts +12 -0
- package/src/core/state/app/layout.ts +4 -3
- package/src/core/state/app/types.ts +4 -1
- package/src/data/config/layout.ts +2 -2
- package/src/data/config/store/fold-panes.ts +6 -1
- package/src/i18n/es.ts +8 -1
- package/src/i18n/ja.ts +8 -1
- package/src/i18n/ko.ts +8 -1
- package/src/i18n/zh-cn.ts +8 -1
- package/src/i18n/zh-tw.ts +8 -1
- package/src/layout/pane-follow.ts +3 -2
- package/src/layout/pane-layout-move.ts +2 -1
- package/src/layout/pane-manager/dock-stack.ts +38 -0
- package/src/layout/pane-manager/dock-tree.ts +76 -15
- package/src/layout/pane-manager/docking.ts +48 -6
- package/src/layout/pane-manager/floating-actions.ts +12 -3
- package/src/layout/pane-manager/floating-placement.ts +189 -0
- package/src/layout/pane-manager/floating.ts +23 -4
- package/src/layout/pane-manager/gridlock.ts +16 -4
- package/src/layout/pane-manager/hidden-panes.ts +30 -1
- package/src/layout/pane-manager/index.ts +2 -0
- package/src/layout/pane-manager/layout-state.ts +17 -0
- package/src/layout/pane-manager/types.ts +4 -1
- package/src/layout/ticker-retarget.ts +88 -0
- package/src/layout-marketplace/cloud.ts +9 -1
- package/src/market-data/connection-follow.ts +68 -0
- package/src/market-data/coordinator/entries.ts +15 -3
- package/src/market-data/coordinator/events.ts +17 -1
- package/src/market-data/coordinator/financials.ts +20 -7
- package/src/market-data/coordinator/index.ts +217 -4
- package/src/market-data/coordinator/quotes.ts +10 -0
- package/src/market-data/frame-scheduler.ts +47 -10
- package/src/market-data/frame-wake.ts +74 -0
- package/src/market-data/futures-board.ts +7 -6
- package/src/market-data/hooks.tsx +43 -3
- package/src/market-data/performance.ts +78 -9
- package/src/market-data/request-types.ts +6 -3
- package/src/news/aggregator.ts +12 -1
- package/src/plugins/builtin/alerts/cli.ts +2 -1
- package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
- package/src/plugins/builtin/attention/evidence.ts +1 -1
- package/src/plugins/builtin/awards/client.ts +1 -1
- package/src/plugins/builtin/awards/evidence.ts +1 -1
- package/src/plugins/builtin/awards/pane.tsx +2 -1
- package/src/plugins/builtin/bond-calculator/math.ts +1 -1
- package/src/plugins/builtin/broker-manager/footer.ts +3 -2
- package/src/plugins/builtin/broker-manager/index.tsx +2 -1
- package/src/plugins/builtin/broker-manager/keyboard.ts +2 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +2 -1
- package/src/plugins/builtin/buildout/model/index.ts +6 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +2 -1
- package/src/plugins/builtin/catalysts/evidence.ts +1 -1
- package/src/plugins/builtin/catalysts/pane.tsx +2 -1
- package/src/plugins/builtin/chart-composer/headless.ts +40 -1
- package/src/plugins/builtin/chart-composer/index.tsx +13 -0
- package/src/plugins/builtin/chat/controller/index.ts +10 -3
- package/src/plugins/builtin/chat/controller/session-runtime.ts +9 -2
- package/src/plugins/builtin/chat/status-widget.tsx +3 -1
- package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
- package/src/plugins/builtin/comment-letters/client.ts +2 -1
- package/src/plugins/builtin/company-kpis/client.ts +1 -1
- package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
- package/src/plugins/builtin/cot/headless.ts +9 -3
- package/src/plugins/builtin/cot/model.ts +44 -3
- package/src/plugins/builtin/credit-documents/client.ts +1 -1
- package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
- package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
- package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
- package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
- package/src/plugins/builtin/econ/calendar-model.ts +2 -0
- package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
- package/src/plugins/builtin/econ/print-watch.ts +3 -1
- package/src/plugins/builtin/futures/series.ts +16 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
- package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
- package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
- package/src/plugins/builtin/gpu/headless.ts +2 -1
- package/src/plugins/builtin/help/function-card.tsx +2 -1
- package/src/plugins/builtin/help/index.tsx +3 -2
- package/src/plugins/builtin/insider/display.ts +45 -6
- package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
- package/src/plugins/builtin/iv-history/client.ts +2 -1
- package/src/plugins/builtin/iv-history/headless.ts +2 -1
- package/src/plugins/builtin/jobs/pages.ts +4 -4
- package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
- package/src/plugins/builtin/members/client.ts +1 -1
- package/src/plugins/builtin/mna/distress/client.ts +1 -0
- package/src/plugins/builtin/mna/pane.tsx +4 -1
- package/src/plugins/builtin/options/market-reference.ts +1 -1
- package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
- package/src/plugins/builtin/options/view.tsx +2 -1
- package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
- package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
- package/src/plugins/builtin/options-scenario/csp.ts +28 -9
- package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
- package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
- package/src/plugins/builtin/perps/client.ts +1 -1
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
- package/src/plugins/builtin/research/analyst-model.ts +1 -0
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
- package/src/plugins/builtin/research/index.tsx +1 -0
- package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
- package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
- package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
- package/src/plugins/builtin/research-search/snippet.ts +1 -0
- package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
- package/src/plugins/builtin/seasonality/headless.ts +2 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
- package/src/plugins/builtin/sec/index.tsx +7 -4
- package/src/plugins/builtin/sec/row-summaries.ts +28 -12
- package/src/plugins/builtin/sectors/client.ts +18 -8
- package/src/plugins/builtin/sectors/index.tsx +19 -5
- package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
- package/src/plugins/builtin/social-mentions/client.ts +2 -1
- package/src/plugins/builtin/supply-chain/client.ts +1 -1
- package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -1
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +25 -2
- package/src/plugins/builtin/time-sales/client.ts +1 -0
- package/src/plugins/builtin/vol-surface/client.ts +2 -1
- package/src/plugins/builtin/yield-curve/headless.ts +3 -1
- package/src/portfolio/column-values.ts +76 -10
- package/src/react/async-resource.ts +12 -0
- package/src/remote/controller.ts +3 -1
- package/src/renderers/browser/app-services.ts +8 -1
- package/src/renderers/browser/cloud-transport.ts +6 -1
- package/src/renderers/cloudflare/worker.ts +24 -2
- package/src/renderers/dom/host/box.tsx +204 -176
- package/src/renderers/dom/host/style.ts +49 -20
- package/src/renderers/dom/host/text.tsx +3 -2
- package/src/renderers/dom/styles.css +32 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +2 -0
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +25 -1
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
- package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
- package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
- package/src/renderers/electrobun/shared/protocol.ts +6 -0
- package/src/renderers/electrobun/view/ui-host.tsx +7 -0
- package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
- package/src/shares/portable-layout.ts +99 -2
- package/src/sources/provider-router/index.ts +9 -3
- package/src/sources/provider-router/sources.ts +26 -1
- package/src/sync/core-contributors.ts +18 -4
- package/src/time-series/price-units.ts +11 -0
- package/src/time-series/resolve.ts +12 -0
- package/src/types/config.ts +17 -1
- package/src/types/plugin.ts +6 -0
- package/src/ui/host.tsx +2 -0
- package/src/utils/currency-names.ts +20 -0
- package/src/utils/currency-pair.ts +6 -0
- package/src/utils/exchange-rate-snapshot.ts +20 -2
- package/src/utils/fx-market-hours.ts +43 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { useCallback, useRef } from "react";
|
|
1
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
2
2
|
import {
|
|
3
3
|
floatAtRect,
|
|
4
4
|
getDockSplitGeometry,
|
|
5
|
+
MIN_FLOAT_HEIGHT,
|
|
6
|
+
MIN_FLOAT_WIDTH,
|
|
5
7
|
getRememberedFloatingRect,
|
|
6
8
|
resizeSplitAtPath,
|
|
7
9
|
simulateDrop,
|
|
8
10
|
type DockGeometryOptions,
|
|
9
11
|
type DockLeafLayout,
|
|
10
|
-
type DropTarget,
|
|
11
12
|
type FloatingRect,
|
|
12
13
|
type LayoutBounds,
|
|
13
14
|
type ResolvedPane,
|
|
@@ -15,20 +16,46 @@ import {
|
|
|
15
16
|
import type { LayoutConfig } from "../../../types/config";
|
|
16
17
|
import {
|
|
17
18
|
finalizePaneDragRelease,
|
|
19
|
+
freePaneDragRect,
|
|
18
20
|
isMeaningfulPaneDrag,
|
|
21
|
+
JOIN_DWELL_MS,
|
|
19
22
|
makeSnapGuides,
|
|
20
23
|
PANE_DRAG_THRESHOLD,
|
|
21
|
-
pointInRect,
|
|
22
24
|
PRECISE_PANE_DRAG_THRESHOLD,
|
|
23
25
|
resolveDividerPreviewRect,
|
|
24
26
|
resolveFloatResizeRect,
|
|
25
|
-
resolveHoverOverlay,
|
|
26
27
|
resolvePaneDragFloatingRect,
|
|
28
|
+
resolvePaneDropTarget,
|
|
27
29
|
resolveSnapGuide,
|
|
28
30
|
type DragPreview,
|
|
29
31
|
} from "./drag";
|
|
30
32
|
import type { ShellDragRuntimeState, ShellMouseEvent } from "./drag/runtime";
|
|
31
33
|
import type { WindowEditState } from "../window-edit/mode";
|
|
34
|
+
import {
|
|
35
|
+
createMagnetPace,
|
|
36
|
+
NO_LATCH,
|
|
37
|
+
snapMovedRect,
|
|
38
|
+
snapResizedRect,
|
|
39
|
+
type MagnetDistances,
|
|
40
|
+
type MagnetLatch,
|
|
41
|
+
type MagnetPace,
|
|
42
|
+
} from "./drag/magnets";
|
|
43
|
+
import { paneHeaderRows } from "../pane/sizing";
|
|
44
|
+
|
|
45
|
+
/** A join the pointer has lined up: armed once it has held for JOIN_DWELL_MS. */
|
|
46
|
+
interface PendingJoin {
|
|
47
|
+
key: string;
|
|
48
|
+
armed: boolean;
|
|
49
|
+
timer: ReturnType<typeof setTimeout> | null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function dropPendingJoin(memo: { join: PendingJoin | null }) {
|
|
53
|
+
if (memo.join?.timer) clearTimeout(memo.join.timer);
|
|
54
|
+
memo.join = null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** A resize without edges is the bottom-right corner's (the terminal's only one). */
|
|
58
|
+
const CORNER_EDGES = { x: 1, y: 1 } as const;
|
|
32
59
|
|
|
33
60
|
interface UseShellActiveDragOptions {
|
|
34
61
|
appHeaderHeight: number;
|
|
@@ -38,6 +65,8 @@ interface UseShellActiveDragOptions {
|
|
|
38
65
|
dockLeafLayouts: DockLeafLayout[];
|
|
39
66
|
dragRuntime: ShellDragRuntimeState;
|
|
40
67
|
focusPane: (paneId: string) => void;
|
|
68
|
+
/** How close a moving or resizing pane's edge comes to another before it sticks, in cells. */
|
|
69
|
+
magnetDistances: MagnetDistances;
|
|
41
70
|
nativePaneChrome: boolean;
|
|
42
71
|
paneMap: Map<string, ResolvedPane>;
|
|
43
72
|
persistLayout: (nextLayout: LayoutConfig, options?: { pushHistory?: boolean }) => void;
|
|
@@ -57,6 +86,7 @@ export function useShellActiveDrag({
|
|
|
57
86
|
dockLeafLayouts,
|
|
58
87
|
dragRuntime,
|
|
59
88
|
focusPane,
|
|
89
|
+
magnetDistances,
|
|
60
90
|
nativePaneChrome,
|
|
61
91
|
paneMap,
|
|
62
92
|
persistLayout,
|
|
@@ -72,21 +102,34 @@ export function useShellActiveDrag({
|
|
|
72
102
|
dragRef,
|
|
73
103
|
endDrag,
|
|
74
104
|
live,
|
|
75
|
-
setHoverTarget,
|
|
76
105
|
updateDividerPreview,
|
|
77
106
|
updateDockPreview,
|
|
78
107
|
updateDragFloatingRect,
|
|
79
108
|
} = dragRuntime;
|
|
80
|
-
// What one drag keeps between moves: a docked pane's floating size,
|
|
81
|
-
// last drop it simulated, so a move over the same target computes nothing
|
|
109
|
+
// What one drag keeps between moves: a docked pane's floating size, the
|
|
110
|
+
// last drop it simulated, so a move over the same target computes nothing,
|
|
111
|
+
// the edges its magnets hold, with the other panes' rects they hold to, the
|
|
112
|
+
// join it is holding still for, and on the desktop where the pointer has
|
|
113
|
+
// been lately (the magnets wait for it to slow down) with the check that
|
|
114
|
+
// catches once it rests.
|
|
82
115
|
const memoRef = useRef<{
|
|
83
116
|
drag: unknown;
|
|
84
117
|
baseRect: FloatingRect | null;
|
|
85
118
|
dropKey: string | null;
|
|
86
119
|
drop: DragPreview | null;
|
|
87
|
-
|
|
120
|
+
latch: MagnetLatch;
|
|
121
|
+
magnetTargets: LayoutBounds[] | null;
|
|
122
|
+
join: PendingJoin | null;
|
|
123
|
+
pace: MagnetPace;
|
|
124
|
+
}>({ drag: null, baseRect: null, dropKey: null, drop: null, latch: NO_LATCH, magnetTargets: null, join: null, pace: createMagnetPace() });
|
|
125
|
+
useEffect(() => () => {
|
|
126
|
+
dropPendingJoin(memoRef.current);
|
|
127
|
+
memoRef.current.pace.reset();
|
|
128
|
+
}, []);
|
|
129
|
+
// The handler as it is now, for the rest check to run again.
|
|
130
|
+
const handleRef = useRef<(event: ShellMouseEvent) => void>(() => {});
|
|
88
131
|
|
|
89
|
-
|
|
132
|
+
const handle = useCallback((event: ShellMouseEvent) => {
|
|
90
133
|
const shellY = event.y - appHeaderHeight;
|
|
91
134
|
const preciseX = event.preciseX ?? event.x;
|
|
92
135
|
const preciseShellY = (event.preciseY ?? event.y) - appHeaderHeight;
|
|
@@ -106,7 +149,62 @@ export function useShellActiveDrag({
|
|
|
106
149
|
memo.baseRect = null;
|
|
107
150
|
memo.dropKey = null;
|
|
108
151
|
memo.drop = null;
|
|
152
|
+
memo.latch = NO_LATCH;
|
|
153
|
+
memo.magnetTargets = null;
|
|
154
|
+
memo.pace.reset();
|
|
155
|
+
dropPendingJoin(memo);
|
|
109
156
|
}
|
|
157
|
+
// Any later event supersedes the rest check of an earlier move.
|
|
158
|
+
memo.pace.cancel();
|
|
159
|
+
// Every other pane on screen, docked or floating, whose edges a floating
|
|
160
|
+
// pane's edges stick to. Alt (Option) lets it go anywhere.
|
|
161
|
+
const magnetTargets = (paneId: string) => {
|
|
162
|
+
memo.magnetTargets ??= [
|
|
163
|
+
...dockLeafLayouts.filter((leaf) => leaf.instanceId !== paneId).map((leaf) => leaf.rect),
|
|
164
|
+
...baseLayout.floating
|
|
165
|
+
.filter((entry) => entry.instanceId !== paneId && paneMap.has(entry.instanceId))
|
|
166
|
+
.map(({ x, y, width: w, height: h }) => ({ x, y, width: w, height: h })),
|
|
167
|
+
];
|
|
168
|
+
return memo.magnetTargets;
|
|
169
|
+
};
|
|
170
|
+
const magnetsOff = event.modifiers?.alt === true;
|
|
171
|
+
const magnetArea = { x: 0, y: 0, width, height: contentHeight };
|
|
172
|
+
// Desktop: while the pointer travels, a moving pane follows it exactly;
|
|
173
|
+
// its magnets catch once it slows down near a line, or rests there (the
|
|
174
|
+
// rest check runs the last move again once the pointer has stopped). What
|
|
175
|
+
// they hold to still follows every move, so it rests where it would have.
|
|
176
|
+
const travelling = () => {
|
|
177
|
+
if (!nativePaneChrome || drag.type !== "pane-drag") return false;
|
|
178
|
+
// A release lands where the pane is drawn: no catch after it.
|
|
179
|
+
const rest = event.type === "drag" ? () => { if (dragRef.current === drag) handleRef.current(event); } : undefined;
|
|
180
|
+
return memo.pace.travelling({ t: performance.now(), x: preciseX, y: preciseShellY }, magnetDistances, rest);
|
|
181
|
+
};
|
|
182
|
+
const snapMove = (paneId: string, rect: FloatingRect): FloatingRect => {
|
|
183
|
+
if (magnetsOff) {
|
|
184
|
+
memo.latch = NO_LATCH;
|
|
185
|
+
return rect;
|
|
186
|
+
}
|
|
187
|
+
const snapped = snapMovedRect(rect, magnetTargets(paneId), magnetArea, magnetDistances, memo.latch);
|
|
188
|
+
memo.latch = snapped.latch;
|
|
189
|
+
return travelling() ? rect : snapped.rect;
|
|
190
|
+
};
|
|
191
|
+
const snapResize = (paneId: string, rect: FloatingRect, edges: { x: -1 | 0 | 1; y: -1 | 0 | 1 }): FloatingRect => {
|
|
192
|
+
if (magnetsOff) {
|
|
193
|
+
memo.latch = NO_LATCH;
|
|
194
|
+
return rect;
|
|
195
|
+
}
|
|
196
|
+
const snapped = snapResizedRect(
|
|
197
|
+
rect,
|
|
198
|
+
edges,
|
|
199
|
+
{ width: MIN_FLOAT_WIDTH, height: MIN_FLOAT_HEIGHT },
|
|
200
|
+
magnetTargets(paneId),
|
|
201
|
+
magnetArea,
|
|
202
|
+
magnetDistances,
|
|
203
|
+
memo.latch,
|
|
204
|
+
);
|
|
205
|
+
memo.latch = snapped.latch;
|
|
206
|
+
return snapped.rect;
|
|
207
|
+
};
|
|
110
208
|
const dividerRatioAt = (x: number, y: number) => {
|
|
111
209
|
if (drag.type !== "divider") return 0;
|
|
112
210
|
const total = drag.axis === "horizontal" ? drag.bounds.width : drag.bounds.height;
|
|
@@ -122,6 +220,7 @@ export function useShellActiveDrag({
|
|
|
122
220
|
|
|
123
221
|
if (event.type === "drag-cancel") {
|
|
124
222
|
// The window lost focus or the system took the pointer: put everything back.
|
|
223
|
+
dropPendingJoin(memo);
|
|
125
224
|
cancelActiveDrag();
|
|
126
225
|
event.stopPropagation();
|
|
127
226
|
event.preventDefault();
|
|
@@ -150,7 +249,6 @@ export function useShellActiveDrag({
|
|
|
150
249
|
} else if (drag.type === "pane-drag") {
|
|
151
250
|
if (!isMeaningfulPaneDrag(drag.startX, drag.startY, preciseX, preciseShellY, dragThreshold)) {
|
|
152
251
|
updateDockPreview(null);
|
|
153
|
-
setHoverTarget(null);
|
|
154
252
|
if (drag.mode === "floating") {
|
|
155
253
|
updateDragFloatingRect({ paneId: drag.paneId, rect: drag.origRect });
|
|
156
254
|
}
|
|
@@ -159,33 +257,65 @@ export function useShellActiveDrag({
|
|
|
159
257
|
return;
|
|
160
258
|
}
|
|
161
259
|
|
|
162
|
-
const nextRect = resolvePaneDragFloatingRect(drag, dragBaseRect()!, drawX, drawShellY, width, contentHeight);
|
|
260
|
+
const nextRect = snapMove(drag.paneId, resolvePaneDragFloatingRect(drag, dragBaseRect()!, drawX, drawShellY, width, contentHeight));
|
|
163
261
|
updateDragFloatingRect({ paneId: drag.paneId, rect: nextRect });
|
|
164
262
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
263
|
+
// Over a title bar it would be a tab there; pushed against a docked
|
|
264
|
+
// pane's edge it would join the dock on that side.
|
|
265
|
+
const target = resolvePaneDropTarget({
|
|
266
|
+
x: hitX,
|
|
267
|
+
y: hitShellY,
|
|
268
|
+
rect: nextRect,
|
|
269
|
+
free: freePaneDragRect(drag, dragBaseRect()!, drawX, drawShellY, width, contentHeight),
|
|
270
|
+
leaves: dockLeafLayouts,
|
|
271
|
+
paneId: drag.paneId,
|
|
272
|
+
area: bounds,
|
|
273
|
+
flush: { x: magnetDistances.catchX, y: magnetDistances.catchY },
|
|
274
|
+
headerRows: paneHeaderRows(nativePaneChrome),
|
|
275
|
+
join: !magnetsOff,
|
|
276
|
+
});
|
|
277
|
+
const showSnapGuide = () => {
|
|
278
|
+
const snapGuide = resolveSnapGuide(hitX, hitShellY, snapGuides);
|
|
279
|
+
updateDockPreview(snapGuide ? { kind: "snap", position: snapGuide.position, rect: snapGuide.previewRect } : null);
|
|
280
|
+
};
|
|
281
|
+
if (target) {
|
|
282
|
+
const dropKey = target.kind === "tab" ? `tab:${target.targetId}` : target.kind === "leaf" ? `${target.targetId}:${target.position}` : target.edge;
|
|
283
|
+
const showDrop = () => {
|
|
171
284
|
if (memo.dropKey !== dropKey) {
|
|
172
|
-
const target: DropTarget = { kind: "leaf", targetId: hoveredOverlay.targetId, position: hoveredCell.position };
|
|
173
285
|
const simulation = simulateDrop(baseLayout, drag.paneId, target, bounds, dockGeometryOptions);
|
|
174
286
|
memo.dropKey = dropKey;
|
|
175
287
|
memo.drop = simulation.previewRect ? { kind: "dock", target, rect: simulation.previewRect } : null;
|
|
176
288
|
}
|
|
177
289
|
updateDockPreview(memo.drop);
|
|
290
|
+
};
|
|
291
|
+
if (target.kind === "leaf") {
|
|
292
|
+
// A join arms once the edge has held, and shows its preview then:
|
|
293
|
+
// a release before that leaves the pane floating where it is.
|
|
294
|
+
if (memo.join?.key !== dropKey) {
|
|
295
|
+
dropPendingJoin(memo);
|
|
296
|
+
const join: PendingJoin = { key: dropKey, armed: false, timer: null };
|
|
297
|
+
join.timer = setTimeout(() => {
|
|
298
|
+
if (memo.join !== join || dragRef.current !== drag) return;
|
|
299
|
+
join.armed = true;
|
|
300
|
+
join.timer = null;
|
|
301
|
+
showDrop();
|
|
302
|
+
}, JOIN_DWELL_MS);
|
|
303
|
+
memo.join = join;
|
|
304
|
+
}
|
|
305
|
+
if (memo.join?.armed) showDrop();
|
|
306
|
+
else showSnapGuide();
|
|
178
307
|
} else {
|
|
179
|
-
|
|
308
|
+
dropPendingJoin(memo);
|
|
309
|
+
showDrop();
|
|
180
310
|
}
|
|
181
311
|
} else {
|
|
182
|
-
|
|
183
|
-
|
|
312
|
+
dropPendingJoin(memo);
|
|
313
|
+
showSnapGuide();
|
|
184
314
|
}
|
|
185
315
|
} else if (drag.type === "float-resize") {
|
|
186
316
|
updateDragFloatingRect({
|
|
187
317
|
paneId: drag.paneId,
|
|
188
|
-
rect: resolveFloatResizeRect(drag, preciseX, preciseShellY, width, contentHeight),
|
|
318
|
+
rect: snapResize(drag.paneId, resolveFloatResizeRect(drag, preciseX, preciseShellY, width, contentHeight), drag.edges ?? CORNER_EDGES),
|
|
189
319
|
});
|
|
190
320
|
}
|
|
191
321
|
event.stopPropagation();
|
|
@@ -194,6 +324,7 @@ export function useShellActiveDrag({
|
|
|
194
324
|
}
|
|
195
325
|
|
|
196
326
|
if (event.type === "up" || event.type === "drag-end") {
|
|
327
|
+
dropPendingJoin(memo);
|
|
197
328
|
if (drag.type === "divider") {
|
|
198
329
|
if (live.get().divider) {
|
|
199
330
|
const nextLayout = resizeSplitAtPath(baseLayout, drag.path, dividerRatioAt(preciseX, preciseShellY));
|
|
@@ -208,10 +339,11 @@ export function useShellActiveDrag({
|
|
|
208
339
|
const movedEnough = isMeaningfulPaneDrag(drag.startX, drag.startY, preciseX, preciseShellY, dragThreshold);
|
|
209
340
|
if (!movedEnough) {
|
|
210
341
|
updateDockPreview(null);
|
|
211
|
-
setHoverTarget(null);
|
|
212
342
|
updateDragFloatingRect(null);
|
|
343
|
+
// A click on a stack's tab shows that pane.
|
|
344
|
+
if (drag.mode === "docked") focusPane(drag.paneId);
|
|
213
345
|
} else {
|
|
214
|
-
const releaseRect = resolvePaneDragFloatingRect(drag, dragBaseRect()!, preciseX, preciseShellY, width, contentHeight);
|
|
346
|
+
const releaseRect = snapMove(drag.paneId, resolvePaneDragFloatingRect(drag, dragBaseRect()!, preciseX, preciseShellY, width, contentHeight));
|
|
215
347
|
const nextLayout = finalizePaneDragRelease(baseLayout, drag.paneId, releaseRect, live.get().dockPreview);
|
|
216
348
|
if (windowMode) {
|
|
217
349
|
updateWindowModePreviewLayout(nextLayout, drag.paneId);
|
|
@@ -220,11 +352,10 @@ export function useShellActiveDrag({
|
|
|
220
352
|
}
|
|
221
353
|
focusPane(drag.paneId);
|
|
222
354
|
updateDockPreview(null);
|
|
223
|
-
setHoverTarget(null);
|
|
224
355
|
updateDragFloatingRect(null);
|
|
225
356
|
}
|
|
226
357
|
} else if (drag.type === "float-resize") {
|
|
227
|
-
const releaseRect = resolveFloatResizeRect(drag, preciseX, preciseShellY, width, contentHeight);
|
|
358
|
+
const releaseRect = snapResize(drag.paneId, resolveFloatResizeRect(drag, preciseX, preciseShellY, width, contentHeight), drag.edges ?? CORNER_EDGES);
|
|
228
359
|
const nextLayout = floatAtRect(baseLayout, drag.paneId, releaseRect);
|
|
229
360
|
if (windowMode) {
|
|
230
361
|
updateWindowModePreviewLayout(nextLayout, drag.paneId);
|
|
@@ -232,7 +363,6 @@ export function useShellActiveDrag({
|
|
|
232
363
|
persistLayout(nextLayout);
|
|
233
364
|
}
|
|
234
365
|
updateDragFloatingRect(null);
|
|
235
|
-
setHoverTarget(null);
|
|
236
366
|
}
|
|
237
367
|
endDrag();
|
|
238
368
|
event.stopPropagation();
|
|
@@ -249,11 +379,11 @@ export function useShellActiveDrag({
|
|
|
249
379
|
endDrag,
|
|
250
380
|
focusPane,
|
|
251
381
|
live,
|
|
382
|
+
magnetDistances,
|
|
252
383
|
nativePaneChrome,
|
|
253
384
|
paneMap,
|
|
254
385
|
persistLayout,
|
|
255
386
|
precisePointer,
|
|
256
|
-
setHoverTarget,
|
|
257
387
|
snapGuides,
|
|
258
388
|
updateDividerPreview,
|
|
259
389
|
updateDockPreview,
|
|
@@ -263,4 +393,6 @@ export function useShellActiveDrag({
|
|
|
263
393
|
windowMode,
|
|
264
394
|
width,
|
|
265
395
|
]);
|
|
396
|
+
handleRef.current = handle;
|
|
397
|
+
return handle;
|
|
266
398
|
}
|
|
@@ -12,12 +12,6 @@ import type { DesktopDockPreviewState } from "../../../../types/desktop-window";
|
|
|
12
12
|
import type { LayoutConfig } from "../../../../types/config";
|
|
13
13
|
import { PANE_HEADER_ACTION, PANE_HEADER_CLOSE, PANE_HEADER_HELP, PANE_HEADER_RESTORE } from "../../pane/header";
|
|
14
14
|
|
|
15
|
-
export interface HoverOverlay {
|
|
16
|
-
targetId: string;
|
|
17
|
-
rect: LayoutBounds;
|
|
18
|
-
cells: Array<{ position: "top" | "left" | "center" | "right" | "bottom"; rect: LayoutBounds }>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
15
|
export type SnapGuidePosition =
|
|
22
16
|
| "left"
|
|
23
17
|
| "right"
|
|
@@ -121,22 +115,31 @@ export function constrainFloatingRectToBounds(
|
|
|
121
115
|
};
|
|
122
116
|
}
|
|
123
117
|
|
|
124
|
-
|
|
125
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Where the pointer alone puts a pane on the move, before the screen's edges
|
|
120
|
+
* hold it in: a docked pane at its floating size, held where it was pressed
|
|
121
|
+
* (as far into it as it reaches); a floating one moved by the pointer.
|
|
122
|
+
*/
|
|
123
|
+
export function freePaneDragRect(
|
|
126
124
|
drag: PaneDragRectState,
|
|
125
|
+
baseRect: FloatingRect,
|
|
127
126
|
pointerX: number,
|
|
128
127
|
pointerY: number,
|
|
129
128
|
totalWidth: number,
|
|
130
129
|
totalHeight: number,
|
|
131
130
|
): FloatingRect {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
...fittedRect,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
131
|
+
if (drag.mode === "docked") {
|
|
132
|
+
const fittedRect = constrainFloatingRectToBounds(baseRect, totalWidth, totalHeight);
|
|
133
|
+
const pointerOffsetX = Math.max(0, Math.min(fittedRect.width - 1, drag.startX - drag.origRect.x));
|
|
134
|
+
const pointerOffsetY = Math.max(0, Math.min(fittedRect.height - 1, drag.startY - drag.origRect.y));
|
|
135
|
+
return { ...fittedRect, x: pointerX - pointerOffsetX, y: pointerY - pointerOffsetY };
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
x: drag.origRect.x + (pointerX - drag.startX),
|
|
139
|
+
y: drag.origRect.y + (pointerY - drag.startY),
|
|
140
|
+
width: drag.origRect.width,
|
|
141
|
+
height: drag.origRect.height,
|
|
142
|
+
};
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
export function resolvePaneDragFloatingRect(
|
|
@@ -147,16 +150,7 @@ export function resolvePaneDragFloatingRect(
|
|
|
147
150
|
totalWidth: number,
|
|
148
151
|
totalHeight: number,
|
|
149
152
|
): FloatingRect {
|
|
150
|
-
|
|
151
|
-
return positionFloatingRectUnderPointer(baseRect, drag, pointerX, pointerY, totalWidth, totalHeight);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return constrainFloatingRectToBounds({
|
|
155
|
-
x: drag.origRect.x + (pointerX - drag.startX),
|
|
156
|
-
y: drag.origRect.y + (pointerY - drag.startY),
|
|
157
|
-
width: drag.origRect.width,
|
|
158
|
-
height: drag.origRect.height,
|
|
159
|
-
}, totalWidth, totalHeight);
|
|
153
|
+
return constrainFloatingRectToBounds(freePaneDragRect(drag, baseRect, pointerX, pointerY, totalWidth, totalHeight), totalWidth, totalHeight);
|
|
160
154
|
}
|
|
161
155
|
|
|
162
156
|
/**
|
|
@@ -188,82 +182,91 @@ export function resolveFloatResizeRect(
|
|
|
188
182
|
return constrainFloatingRectToBounds({ x, y, width, height, zIndex: origRect.zIndex }, totalWidth, totalHeight);
|
|
189
183
|
}
|
|
190
184
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
x: parent.x + Math.floor((parent.width - nextWidth) / 2),
|
|
196
|
-
y: parent.y + Math.floor((parent.height - nextHeight) / 2),
|
|
197
|
-
width: nextWidth,
|
|
198
|
-
height: nextHeight,
|
|
199
|
-
};
|
|
185
|
+
/** A distance on each axis, in cells. */
|
|
186
|
+
export interface AxisDistance {
|
|
187
|
+
x: number;
|
|
188
|
+
y: number;
|
|
200
189
|
}
|
|
201
190
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
);
|
|
209
|
-
}
|
|
191
|
+
const JOIN_SIDES = [
|
|
192
|
+
["left", "x"],
|
|
193
|
+
["right", "x"],
|
|
194
|
+
["top", "y"],
|
|
195
|
+
["bottom", "y"],
|
|
196
|
+
] as const;
|
|
210
197
|
|
|
211
|
-
|
|
212
|
-
const col1 = Math.max(1, Math.floor(rect.width / 3));
|
|
213
|
-
const col2 = Math.max(1, Math.floor((rect.width - col1) / 2));
|
|
214
|
-
const col3 = Math.max(1, rect.width - col1 - col2);
|
|
215
|
-
const row1 = Math.max(1, Math.floor(rect.height / 3));
|
|
216
|
-
const row2 = Math.max(1, Math.floor((rect.height - row1) / 2));
|
|
217
|
-
const row3 = Math.max(1, rect.height - row1 - row2);
|
|
218
|
-
const cols = [col1, col2, col3];
|
|
219
|
-
const rows = [row1, row2, row3];
|
|
220
|
-
const cells: HoverOverlay["cells"] = [];
|
|
221
|
-
let y = rect.y;
|
|
222
|
-
for (let rowIndex = 0; rowIndex < 3; rowIndex += 1) {
|
|
223
|
-
let x = rect.x;
|
|
224
|
-
for (let colIndex = 0; colIndex < 3; colIndex += 1) {
|
|
225
|
-
const position = (
|
|
226
|
-
rowIndex === 0 && colIndex === 1 ? "top"
|
|
227
|
-
: rowIndex === 1 && colIndex === 0 ? "left"
|
|
228
|
-
: rowIndex === 1 && colIndex === 1 ? "center"
|
|
229
|
-
: rowIndex === 1 && colIndex === 2 ? "right"
|
|
230
|
-
: rowIndex === 2 && colIndex === 1 ? "bottom"
|
|
231
|
-
: null
|
|
232
|
-
);
|
|
233
|
-
if (position) {
|
|
234
|
-
cells.push({
|
|
235
|
-
position,
|
|
236
|
-
rect: { x, y, width: cols[colIndex]!, height: rows[rowIndex]! },
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
x += cols[colIndex]!;
|
|
240
|
-
}
|
|
241
|
-
y += rows[rowIndex]!;
|
|
242
|
-
}
|
|
243
|
-
return cells;
|
|
244
|
-
}
|
|
198
|
+
type JoinSide = (typeof JOIN_SIDES)[number][0];
|
|
245
199
|
|
|
246
|
-
/**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Where a pane on the move would land on release, if anywhere but where it is
|
|
202
|
+
* drawn. Over another spot's title bar it becomes a tab there. Its edge
|
|
203
|
+
* pushed flush against the same edge of the spot under the pointer, where
|
|
204
|
+
* that spot meets another (never the dock's own edge, so a window parked at
|
|
205
|
+
* the screen's edge or corner stays floating), it joins the dock on that
|
|
206
|
+
* side: where it is drawn and where the pointer puts it, that edge is within
|
|
207
|
+
* `flush` of the spot's. The caller arms a join only once it has held (see
|
|
208
|
+
* JOIN_DWELL_MS). `join` false (Alt) leaves the edges out.
|
|
209
|
+
*/
|
|
210
|
+
export function resolvePaneDropTarget({
|
|
211
|
+
x,
|
|
212
|
+
y,
|
|
213
|
+
rect,
|
|
214
|
+
free,
|
|
215
|
+
leaves,
|
|
216
|
+
paneId,
|
|
217
|
+
area,
|
|
218
|
+
flush,
|
|
219
|
+
headerRows,
|
|
220
|
+
join,
|
|
221
|
+
}: {
|
|
222
|
+
/** The pointer, in shell cells. */
|
|
223
|
+
x: number;
|
|
224
|
+
y: number;
|
|
225
|
+
/** Where the moving pane is drawn, its edges caught by the magnets. */
|
|
226
|
+
rect: LayoutBounds;
|
|
227
|
+
/** Where the pointer alone puts it, past the screen's edges if it goes there. */
|
|
228
|
+
free: LayoutBounds;
|
|
229
|
+
leaves: readonly DockLeafLayout[];
|
|
230
|
+
paneId: string;
|
|
231
|
+
/** The dock area. */
|
|
232
|
+
area: LayoutBounds;
|
|
233
|
+
/** How close its edge comes to a spot's edge to count as flush (the magnets' catch). */
|
|
234
|
+
flush: AxisDistance;
|
|
235
|
+
/** A docked pane's title bar, in rows. */
|
|
236
|
+
headerRows: number;
|
|
237
|
+
join: boolean;
|
|
238
|
+
}): DropTarget | null {
|
|
239
|
+
if (!pointInRect(area, x, y)) return null;
|
|
240
|
+
const leaf = leaves.find((entry) => pointInRect(entry.rect, x, y));
|
|
241
|
+
if (!leaf) return null;
|
|
242
|
+
// Its own spot: alone there, nothing to land on; a tab of a stack can
|
|
243
|
+
// leave it for a side of the stack, but is a tab of it already.
|
|
244
|
+
const own = leaf.instanceId === paneId || (leaf.stack?.includes(paneId) ?? false);
|
|
245
|
+
const targetId = leaf.instanceId !== paneId ? leaf.instanceId : leaf.stack?.find((id) => id !== paneId);
|
|
246
|
+
if (!targetId) return null;
|
|
247
|
+
if (y < leaf.rect.y + headerRows) return own ? null : { kind: "tab", targetId };
|
|
248
|
+
if (!join) return null;
|
|
249
|
+
const edgeOf = (box: LayoutBounds, side: JoinSide) => (
|
|
250
|
+
side === "left" ? box.x : side === "right" ? box.x + box.width : side === "top" ? box.y : box.y + box.height
|
|
251
|
+
);
|
|
252
|
+
let best: { side: JoinSide; closeness: number } | null = null;
|
|
253
|
+
for (const [side, axis] of JOIN_SIDES) {
|
|
254
|
+
const line = edgeOf(leaf.rect, side);
|
|
255
|
+
// The dock's own edge is the screen's: parking there is not joining.
|
|
256
|
+
if (Math.abs(line - edgeOf(area, side)) <= flush[axis]) continue;
|
|
257
|
+
if (Math.abs(edgeOf(free, side) - line) > flush[axis]) continue;
|
|
258
|
+
const closeness = Math.abs(edgeOf(rect, side) - line) / Math.max(flush[axis], 1e-6);
|
|
259
|
+
if (closeness <= 1 && (!best || closeness < best.closeness)) best = { side, closeness };
|
|
260
|
+
}
|
|
261
|
+
return best ? { kind: "leaf", targetId, position: best.side } : null;
|
|
254
262
|
}
|
|
255
263
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const targetLeaf = leaves.find((leaf) => leaf.instanceId !== draggedPaneId && pointInRect(leaf.rect, x, y));
|
|
263
|
-
if (!targetLeaf) return null;
|
|
264
|
-
const overlay = hoverOverlayForLeaf(targetLeaf);
|
|
265
|
-
return pointInRect(overlay.rect, x, y) ? overlay : null;
|
|
266
|
-
}
|
|
264
|
+
/**
|
|
265
|
+
* How long an edge holds flush before the join arms and its preview shows, so
|
|
266
|
+
* a window moved past a docked pane's edge, or briefly lined up with it, does
|
|
267
|
+
* not dock on release.
|
|
268
|
+
*/
|
|
269
|
+
export const JOIN_DWELL_MS = 350;
|
|
267
270
|
|
|
268
271
|
export function resolveDividerPreviewRect(
|
|
269
272
|
axis: "horizontal" | "vertical",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { startTransition, useCallback, useLayoutEffect,
|
|
2
|
-
import type {
|
|
1
|
+
import { startTransition, useCallback, useLayoutEffect, useRef, useState, useSyncExternalStore, type RefObject } from "react";
|
|
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 {
|
|
5
|
+
import { sameRect, type DragPreview } from "./index";
|
|
6
6
|
|
|
7
7
|
/** Desktop divider drag: where the panes and dividers under the split are this frame. */
|
|
8
8
|
export interface LiveDockGeometry {
|
|
@@ -27,8 +27,6 @@ export interface LiveDragGeometry {
|
|
|
27
27
|
divider: DividerPreviewState | null;
|
|
28
28
|
/** Desktop divider drag: the panes and dividers it resizes, where the pointer has them. */
|
|
29
29
|
dock: LiveDockGeometry | null;
|
|
30
|
-
/** The tiled pane whose drop grid is under the pointer during a pane move. */
|
|
31
|
-
hoverTargetId: string | null;
|
|
32
30
|
/** Where the release would dock or snap. */
|
|
33
31
|
dockPreview: DragPreview | null;
|
|
34
32
|
}
|
|
@@ -60,7 +58,6 @@ export const IDLE_DRAG: LiveDragGeometry = {
|
|
|
60
58
|
floating: null,
|
|
61
59
|
divider: null,
|
|
62
60
|
dock: null,
|
|
63
|
-
hoverTargetId: null,
|
|
64
61
|
dockPreview: null,
|
|
65
62
|
};
|
|
66
63
|
|
|
@@ -190,14 +187,3 @@ export function useLiveCatchUp(
|
|
|
190
187
|
}, [select, store]);
|
|
191
188
|
return select ? rect : null;
|
|
192
189
|
}
|
|
193
|
-
|
|
194
|
-
/** The drop grid under the pointer during a pane move. Re-renders only when the pointer enters another pane's grid. */
|
|
195
|
-
export function useLiveHoverOverlay(store: LiveDragStore, leaves: DockLeafLayout[]): HoverOverlay | null {
|
|
196
|
-
const targetId = useLiveDrag(store, selectHoverTarget);
|
|
197
|
-
return useMemo(() => {
|
|
198
|
-
const leaf = targetId ? leaves.find((entry) => entry.instanceId === targetId) : undefined;
|
|
199
|
-
return leaf ? hoverOverlayForLeaf(leaf) : null;
|
|
200
|
-
}, [leaves, targetId]);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
const selectHoverTarget = (geometry: LiveDragGeometry) => (geometry.paneDrag ? geometry.hoverTargetId : null);
|