@domicile-desktop/manganese-window-management 1.2.0 → 1.3.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/package.json +15 -10
- package/src/AppWindow.tsx +28 -7
- package/src/BrowserWindow.tsx +131 -12
- package/src/GroupTitleBar.tsx +80 -0
- package/src/Stage.tsx +269 -80
- package/src/StripEnd.tsx +1 -1
- package/src/TabStrip.tsx +11 -0
- package/src/TitleBar.tsx +16 -4
- package/src/WindowFrame.tsx +21 -2
- package/src/WindowTitleBar.tsx +7 -2
- package/src/browser/PageProblem.tsx +280 -0
- package/src/browser/PageTooltip.tsx +76 -0
- package/src/captured-element.ts +18 -0
- package/src/closing.ts +3 -3
- package/src/crossing.ts +64 -0
- package/src/floating/useFloatBorderDrag.ts +17 -59
- package/src/follow-press.ts +55 -0
- package/src/keyboard/command.ts +13 -1
- package/src/keyboard/commands.ts +45 -4
- package/src/keyboard/useKeybindings.ts +28 -2
- package/src/overview/OverviewBackdrop.tsx +246 -0
- package/src/overview/OverviewPicker.tsx +439 -0
- package/src/overview/fixture.ts +76 -0
- package/src/overview/overview.ts +112 -0
- package/src/overview/seen-styles.ts +115 -0
- package/src/overview/sight.ts +82 -0
- package/src/overview/steering.ts +85 -0
- package/src/overview/tiles.ts +209 -0
- package/src/overview/useOverviewPhase.ts +35 -0
- package/src/own-animation.ts +24 -0
- package/src/panda-preset.ts +20 -3
- package/src/placement.ts +20 -11
- package/src/recorded-settles.ts +6 -2
- package/src/restacking.ts +4 -3
- package/src/shown.ts +5 -0
- package/src/tab-switch.ts +5 -1
- package/src/tiled/TileGrab.tsx +1 -1
- package/src/tiled/aim.ts +56 -39
- package/src/tiled/borders.ts +10 -2
- package/src/tiled/tab-targets.ts +37 -0
- package/src/tiled/useBorderDrag.ts +18 -42
- package/src/tiled/useTileDrag.ts +5 -5
- package/src/tree/drop.ts +64 -9
- package/src/tree/frames.ts +2 -2
- package/src/tree/layout.ts +31 -2
- package/src/tree/move.ts +8 -27
- package/src/usePageProblem.ts +80 -0
- package/src/usePageTooltip.ts +48 -0
- package/src/useSettling.ts +38 -9
- package/src/useWindowMotion.ts +66 -4
- package/src/useWindows.ts +12 -4
- package/src/window-motion.ts +34 -0
- package/src/window-state.ts +371 -6
- package/src/window-styles.ts +46 -4
- package/src/workspace.ts +5 -1
- package/src/workspaces-context.ts +6 -1
- package/styled-system/patterns/aspect-ratio.mjs +2 -2
- package/styled-system/patterns/bleed.mjs +1 -2
- package/styled-system/patterns/float.mjs +5 -11
- package/styled-system/patterns/grid-item.mjs +1 -2
- package/styled-system/patterns/grid.mjs +1 -2
- package/styled-system/patterns/link-overlay.mjs +1 -1
- package/styled-system/patterns/spacer.mjs +3 -3
- package/styled-system/patterns/visually-hidden.mjs +1 -1
- package/styled-system/styles.css +2308 -2029
- package/styled-system/types/prop-type.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@cprussin/option-result": "^2.0.1",
|
|
4
|
-
"@domicile-desktop/component-library": "2.0
|
|
5
|
-
"@domicile-desktop/manganese-address": "1.0.
|
|
6
|
-
"@domicile-desktop/manganese-bar": "1.1.
|
|
7
|
-
"@domicile-desktop/manganese-host": "2.0.
|
|
8
|
-
"@domicile-desktop/manganese-page-requests": "1.
|
|
9
|
-
"@domicile-desktop/sdk": "2.
|
|
10
|
-
"@domicile-desktop/system-apps": "1.
|
|
4
|
+
"@domicile-desktop/component-library": "2.1.0",
|
|
5
|
+
"@domicile-desktop/manganese-address": "1.0.3",
|
|
6
|
+
"@domicile-desktop/manganese-bar": "1.1.2",
|
|
7
|
+
"@domicile-desktop/manganese-host": "2.0.2",
|
|
8
|
+
"@domicile-desktop/manganese-page-requests": "1.2.0",
|
|
9
|
+
"@domicile-desktop/sdk": "2.2.0",
|
|
10
|
+
"@domicile-desktop/system-apps": "1.2.0",
|
|
11
11
|
"@pandacss/dev": "^1.12.1",
|
|
12
12
|
"@phosphor-icons/react": "^2.1.10",
|
|
13
13
|
"react": "^19.2.8",
|
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
"typescript": "^7.0.2"
|
|
28
28
|
},
|
|
29
29
|
"engines": {
|
|
30
|
-
"bun": ">=1.4.2"
|
|
31
|
-
"node": ">=24"
|
|
30
|
+
"bun": ">=1.4.2"
|
|
32
31
|
},
|
|
33
32
|
"exports": {
|
|
34
33
|
"./client-icons": "./src/client-icons.ts",
|
|
@@ -39,6 +38,12 @@
|
|
|
39
38
|
"./keyboard/media-key": "./src/keyboard/media-key.ts",
|
|
40
39
|
"./keyboard/useKeybindings": "./src/keyboard/useKeybindings.ts",
|
|
41
40
|
"./keyboard/useModifiers": "./src/keyboard/useModifiers.ts",
|
|
41
|
+
"./overview/OverviewBackdrop": "./src/overview/OverviewBackdrop.tsx",
|
|
42
|
+
"./overview/OverviewPicker": "./src/overview/OverviewPicker.tsx",
|
|
43
|
+
"./overview/overview": "./src/overview/overview.ts",
|
|
44
|
+
"./overview/sight": "./src/overview/sight.ts",
|
|
45
|
+
"./overview/steering": "./src/overview/steering.ts",
|
|
46
|
+
"./overview/useOverviewPhase": "./src/overview/useOverviewPhase.ts",
|
|
42
47
|
"./panda-preset": "./src/panda-preset.ts",
|
|
43
48
|
"./placement": "./src/placement.ts",
|
|
44
49
|
"./pointer-warp": "./src/pointer-warp.ts",
|
|
@@ -85,5 +90,5 @@
|
|
|
85
90
|
"test:unit": "bun test"
|
|
86
91
|
},
|
|
87
92
|
"type": "module",
|
|
88
|
-
"version": "1.
|
|
93
|
+
"version": "1.3.0"
|
|
89
94
|
}
|
package/src/AppWindow.tsx
CHANGED
|
@@ -12,6 +12,8 @@ import { WindowState } from "@domicile-desktop/sdk/window-state";
|
|
|
12
12
|
import { useEffect, useRef, useState } from "react";
|
|
13
13
|
|
|
14
14
|
import { css, cx } from "../styled-system/css";
|
|
15
|
+
import { endsOwnAnimation } from "./own-animation";
|
|
16
|
+
import { CROSSING } from "./placement";
|
|
15
17
|
import type { Rect } from "./rect";
|
|
16
18
|
import type { Restack } from "./restacking";
|
|
17
19
|
import { useLowered } from "./useLowered";
|
|
@@ -19,17 +21,17 @@ import type { Settler } from "./useSettling";
|
|
|
19
21
|
import { UPRIGHT, useSettling } from "./useSettling";
|
|
20
22
|
import { appWindowId } from "./window";
|
|
21
23
|
import type { WindowMotion } from "./window-motion";
|
|
22
|
-
import { isLeaving, isMoving } from "./window-motion";
|
|
24
|
+
import { isLeaving, isMoving, isSlidingIn } from "./window-motion";
|
|
23
25
|
import {
|
|
24
26
|
bottomCornerStyles,
|
|
25
27
|
clickThroughStyles,
|
|
28
|
+
contentsScaledAbout,
|
|
26
29
|
edgeStyles,
|
|
27
30
|
heldStyles,
|
|
28
31
|
keptAt,
|
|
29
32
|
movingStyles,
|
|
30
33
|
originOf,
|
|
31
34
|
placedAt,
|
|
32
|
-
scaledAbout,
|
|
33
35
|
settlingStyles,
|
|
34
36
|
shuffledBy,
|
|
35
37
|
windowStyles,
|
|
@@ -75,6 +77,11 @@ type Props = {
|
|
|
75
77
|
* The cursor the client requested. `undefined` uses the page's cursor.
|
|
76
78
|
*/
|
|
77
79
|
cursor: CursorShape | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Whether it just moved to another tab group, so it eases there over the
|
|
82
|
+
* strips it passes. See `crossing.ts`.
|
|
83
|
+
*/
|
|
84
|
+
crossing?: boolean | undefined;
|
|
78
85
|
/** The window's `z-index`, which the SDK reports to the host. */
|
|
79
86
|
depth: number;
|
|
80
87
|
/** Used to request keyboard focus. */
|
|
@@ -84,6 +91,11 @@ type Props = {
|
|
|
84
91
|
* {@link scaledAbout}). `undefined` when {@link Props.rect} is.
|
|
85
92
|
*/
|
|
86
93
|
frame: Rect | undefined;
|
|
94
|
+
/**
|
|
95
|
+
* Its tab in the strip, which its contents grow out of as it opens and
|
|
96
|
+
* shrink into as it closes (see {@link contentsScaledAbout}).
|
|
97
|
+
*/
|
|
98
|
+
tab?: Rect | undefined;
|
|
87
99
|
/** Whether the shell considers this window focused. */
|
|
88
100
|
focused: boolean;
|
|
89
101
|
/** Whether this window is fullscreen, which removes its edge and corners. */
|
|
@@ -145,6 +157,7 @@ export const AppWindow = ({
|
|
|
145
157
|
behindPanel,
|
|
146
158
|
clickThrough,
|
|
147
159
|
cursor,
|
|
160
|
+
crossing = false,
|
|
148
161
|
depth,
|
|
149
162
|
domicile,
|
|
150
163
|
dragging,
|
|
@@ -160,6 +173,7 @@ export const AppWindow = ({
|
|
|
160
173
|
restack,
|
|
161
174
|
settler,
|
|
162
175
|
syncedFrame,
|
|
176
|
+
tab,
|
|
163
177
|
}: Props) => {
|
|
164
178
|
// A closed window that is still animating out.
|
|
165
179
|
const leaving = isLeaving(motion);
|
|
@@ -178,6 +192,7 @@ export const AppWindow = ({
|
|
|
178
192
|
rect === undefined || frame === undefined
|
|
179
193
|
? undefined
|
|
180
194
|
: originOf(frame, rect),
|
|
195
|
+
over: crossing ? CROSSING : undefined,
|
|
181
196
|
rect,
|
|
182
197
|
settler,
|
|
183
198
|
still: dragging || isMoving(motion),
|
|
@@ -308,9 +323,10 @@ export const AppWindow = ({
|
|
|
308
323
|
hidden={rect === undefined}
|
|
309
324
|
// A leaving window is unreachable by keyboard.
|
|
310
325
|
inert={leaving}
|
|
311
|
-
// Ignores animations bubbling up from descendants
|
|
326
|
+
// Ignores animations bubbling up from descendants, and the end of a
|
|
327
|
+
// motion this one replaced.
|
|
312
328
|
onAnimationEnd={(event) => {
|
|
313
|
-
if (event
|
|
329
|
+
if (endsOwnAnimation(event)) {
|
|
314
330
|
onMotionEnded();
|
|
315
331
|
}
|
|
316
332
|
}}
|
|
@@ -322,7 +338,7 @@ export const AppWindow = ({
|
|
|
322
338
|
? undefined
|
|
323
339
|
: {
|
|
324
340
|
...placedAt(rect, depth),
|
|
325
|
-
...
|
|
341
|
+
...contentsScaledAbout(motion, frame, tab, rect),
|
|
326
342
|
...shuffledBy(restack),
|
|
327
343
|
}
|
|
328
344
|
}
|
|
@@ -333,8 +349,13 @@ export const AppWindow = ({
|
|
|
333
349
|
frame={String(syncedFrame)}
|
|
334
350
|
ref={setElement}
|
|
335
351
|
// Also while the box settles, so the engine neither holds the page
|
|
336
|
-
// for the client nor stretches its old frame
|
|
337
|
-
|
|
352
|
+
// for the client nor stretches its old frame, and while it slides in,
|
|
353
|
+
// so the slide does not wait for the client to draw again.
|
|
354
|
+
resizing={
|
|
355
|
+
resizing || settlingFrom !== undefined || isSlidingIn(motion)
|
|
356
|
+
? ""
|
|
357
|
+
: undefined
|
|
358
|
+
}
|
|
338
359
|
// Inline because the cursor and size are runtime values that Panda
|
|
339
360
|
// cannot extract at build time.
|
|
340
361
|
style={{
|
package/src/BrowserWindow.tsx
CHANGED
|
@@ -3,10 +3,19 @@
|
|
|
3
3
|
import { FilePicker } from "@domicile-desktop/component-library/FilePicker";
|
|
4
4
|
import { desktopFolders } from "@domicile-desktop/component-library/folders";
|
|
5
5
|
import { DeviceAsk } from "@domicile-desktop/manganese-page-requests/DeviceAsk";
|
|
6
|
+
import { ExternalAppAsk } from "@domicile-desktop/manganese-page-requests/ExternalAppAsk";
|
|
6
7
|
import { PageDialog } from "@domicile-desktop/manganese-page-requests/PageDialog";
|
|
8
|
+
import { PickerAsk } from "@domicile-desktop/manganese-page-requests/PickerAsk";
|
|
9
|
+
import { PromptAsk } from "@domicile-desktop/manganese-page-requests/PromptAsk";
|
|
10
|
+
import { SignInAsk } from "@domicile-desktop/manganese-page-requests/SignInAsk";
|
|
7
11
|
import { useDeviceRequest } from "@domicile-desktop/manganese-page-requests/useDeviceRequest";
|
|
8
12
|
import { useDialogRequest } from "@domicile-desktop/manganese-page-requests/useDialogRequest";
|
|
13
|
+
import { useExternalAppRequest } from "@domicile-desktop/manganese-page-requests/useExternalAppRequest";
|
|
14
|
+
import { useLinkOpener } from "@domicile-desktop/manganese-page-requests/useLinkOpener";
|
|
9
15
|
import { usePermissionRequest } from "@domicile-desktop/manganese-page-requests/usePermissionRequest";
|
|
16
|
+
import { usePickerRequest } from "@domicile-desktop/manganese-page-requests/usePickerRequest";
|
|
17
|
+
import { usePromptRequest } from "@domicile-desktop/manganese-page-requests/usePromptRequest";
|
|
18
|
+
import { useSignInRequest } from "@domicile-desktop/manganese-page-requests/useSignInRequest";
|
|
10
19
|
import type { Domicile } from "@domicile-desktop/sdk/desktop/desktop";
|
|
11
20
|
import {
|
|
12
21
|
WEBVIEW_DIALOG_EVENT,
|
|
@@ -29,6 +38,8 @@ import { LinkTarget } from "./browser/LinkTarget";
|
|
|
29
38
|
import { mediaDeviceChoiceFor } from "./browser/media-devices";
|
|
30
39
|
import { PageMenu } from "./browser/PageMenu";
|
|
31
40
|
import { PagePopup } from "./browser/PagePopup";
|
|
41
|
+
import { PageProblem } from "./browser/PageProblem";
|
|
42
|
+
import { PageTooltip } from "./browser/PageTooltip";
|
|
32
43
|
import { choosePageCommand, pageMenuFor } from "./browser/page-menu";
|
|
33
44
|
import { useFileRequest } from "./browser/useFileRequest";
|
|
34
45
|
import { usePageMenu } from "./browser/usePageMenu";
|
|
@@ -36,6 +47,8 @@ import { useSitePermissions } from "./browser/useSitePermissions";
|
|
|
36
47
|
import { useZoomPopup } from "./browser/useZoomPopup";
|
|
37
48
|
import { ZoomPanel } from "./browser/ZoomPanel";
|
|
38
49
|
import { zoomedIn, zoomedOut } from "./browser/zoom-steps";
|
|
50
|
+
import { endsOwnAnimation } from "./own-animation";
|
|
51
|
+
import { CROSSING } from "./placement";
|
|
39
52
|
import type { Rect } from "./rect";
|
|
40
53
|
import type { Restack } from "./restacking";
|
|
41
54
|
import { useHistoryAvailability } from "./useHistoryAvailability";
|
|
@@ -45,23 +58,24 @@ import { useLowered } from "./useLowered";
|
|
|
45
58
|
import { usePageDescription } from "./usePageDescription";
|
|
46
59
|
import { usePageFullscreen } from "./usePageFullscreen";
|
|
47
60
|
import { usePageIcon } from "./usePageIcon";
|
|
61
|
+
import { usePageProblem } from "./usePageProblem";
|
|
48
62
|
import { useReclaimFocus } from "./useReclaimFocus";
|
|
49
63
|
import type { Settler } from "./useSettling";
|
|
50
64
|
import { UPRIGHT, useSettling } from "./useSettling";
|
|
51
65
|
import { useShownPage } from "./useShownPage";
|
|
52
66
|
import { useZoom } from "./useZoom";
|
|
53
67
|
import type { WindowMotion } from "./window-motion";
|
|
54
|
-
import { isLeaving, isMoving } from "./window-motion";
|
|
68
|
+
import { isLeaving, isMoving, isSlidingIn } from "./window-motion";
|
|
55
69
|
import {
|
|
56
70
|
bottomCornerStyles,
|
|
57
71
|
clickThroughStyles,
|
|
72
|
+
contentsScaledAbout,
|
|
58
73
|
edgeStyles,
|
|
59
74
|
heldStyles,
|
|
60
75
|
keptAt,
|
|
61
76
|
movingStyles,
|
|
62
77
|
originOf,
|
|
63
78
|
placedAt,
|
|
64
|
-
scaledAbout,
|
|
65
79
|
settlingStyles,
|
|
66
80
|
shuffledBy,
|
|
67
81
|
windowStyles,
|
|
@@ -88,6 +102,11 @@ type Props = {
|
|
|
88
102
|
* clicked, so its guest taking focus is not a user reach (see `onReach`).
|
|
89
103
|
*/
|
|
90
104
|
covered: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Whether it just moved to another tab group, so it eases there over the
|
|
107
|
+
* strips it passes. See `crossing.ts`.
|
|
108
|
+
*/
|
|
109
|
+
crossing?: boolean | undefined;
|
|
91
110
|
/** The window's `z-index`, which the SDK reports to the host. */
|
|
92
111
|
depth: number;
|
|
93
112
|
/**
|
|
@@ -102,6 +121,11 @@ type Props = {
|
|
|
102
121
|
* {@link scaledAbout}). `undefined` when {@link Props.rect} is.
|
|
103
122
|
*/
|
|
104
123
|
frame: Rect | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Its tab in the strip, which its contents grow out of as it opens and
|
|
126
|
+
* shrink into as it closes (see {@link contentsScaledAbout}).
|
|
127
|
+
*/
|
|
128
|
+
tab?: Rect | undefined;
|
|
105
129
|
/** Whether this window is fullscreen, which removes its edge and corners. */
|
|
106
130
|
fullscreen: boolean;
|
|
107
131
|
/** Lists a directory for the file picker. */
|
|
@@ -202,6 +226,7 @@ export const BrowserWindow = ({
|
|
|
202
226
|
behindPanel,
|
|
203
227
|
clickThrough,
|
|
204
228
|
covered,
|
|
229
|
+
crossing = false,
|
|
205
230
|
depth,
|
|
206
231
|
domicile,
|
|
207
232
|
dragging,
|
|
@@ -223,6 +248,7 @@ export const BrowserWindow = ({
|
|
|
223
248
|
resizing,
|
|
224
249
|
restack,
|
|
225
250
|
settler,
|
|
251
|
+
tab,
|
|
226
252
|
url,
|
|
227
253
|
window,
|
|
228
254
|
}: Props) => {
|
|
@@ -248,6 +274,7 @@ export const BrowserWindow = ({
|
|
|
248
274
|
rect === undefined || frame === undefined
|
|
249
275
|
? undefined
|
|
250
276
|
: originOf(frame, rect),
|
|
277
|
+
over: crossing ? CROSSING : undefined,
|
|
251
278
|
rect,
|
|
252
279
|
settler,
|
|
253
280
|
still: dragging || isMoving(motion),
|
|
@@ -312,6 +339,36 @@ export const BrowserWindow = ({
|
|
|
312
339
|
// paused on, and the element in it to focus. The engine draws no dialog.
|
|
313
340
|
const dialogRequest = useDialogRequest(view);
|
|
314
341
|
const [dialogBox, setDialogBox] = useState<HTMLElement | null>(null);
|
|
342
|
+
// The link for an application the page opened, the application that opens
|
|
343
|
+
// it, and the button to focus. The engine draws no dialog.
|
|
344
|
+
const externalApp = useExternalAppRequest(view);
|
|
345
|
+
const linkOpener = useLinkOpener(domicile, externalApp?.url);
|
|
346
|
+
const [appAskBox, setAppAskBox] = useState<HTMLElement | null>(null);
|
|
347
|
+
// The user name and password a site or proxy asked for, and the field to
|
|
348
|
+
// focus. The engine draws no dialog.
|
|
349
|
+
const signIn = useSignInRequest(view);
|
|
350
|
+
const [signInBox, setSignInBox] = useState<HTMLElement | null>(null);
|
|
351
|
+
// File access, a certificate, Bluetooth pairing or an extension's
|
|
352
|
+
// permissions, and the element to focus. The engine draws no dialog.
|
|
353
|
+
const prompt = usePromptRequest(view);
|
|
354
|
+
const [promptBox, setPromptBox] = useState<HTMLElement | null>(null);
|
|
355
|
+
// The color, date or list picker a form control in the page opened, and
|
|
356
|
+
// the element in it to focus. The engine draws no picker.
|
|
357
|
+
const pagePicker = usePickerRequest(view);
|
|
358
|
+
const [pagePickerBox, setPagePickerBox] = useState<HTMLElement | null>(null);
|
|
359
|
+
// Why the page shows nothing: a failed load or a crash, which the shell
|
|
360
|
+
// draws over the blank page; and its first answer, to focus.
|
|
361
|
+
const problem = usePageProblem(view);
|
|
362
|
+
const [problemBox, setProblemBox] = useState<HTMLElement | null>(null);
|
|
363
|
+
// What the page waits on, which takes the keyboard while it is open.
|
|
364
|
+
const waiting =
|
|
365
|
+
pickerBox ??
|
|
366
|
+
dialogBox ??
|
|
367
|
+
signInBox ??
|
|
368
|
+
promptBox ??
|
|
369
|
+
appAskBox ??
|
|
370
|
+
pagePickerBox ??
|
|
371
|
+
problemBox;
|
|
315
372
|
|
|
316
373
|
// Focuses an element in this window without reporting it as a user reach.
|
|
317
374
|
// All programmatic focus here must go through this.
|
|
@@ -489,20 +546,18 @@ export const BrowserWindow = ({
|
|
|
489
546
|
useEffect(() => {
|
|
490
547
|
if (holdsKeyboard && view !== null) {
|
|
491
548
|
domicile.windows.focusShell();
|
|
492
|
-
const waiting = pickerBox ?? dialogBox;
|
|
493
549
|
if (waiting !== null) {
|
|
494
550
|
focusOwn(waiting);
|
|
495
551
|
} else if (!holdsFocus(element.current)) {
|
|
496
552
|
focusOwn(view);
|
|
497
553
|
}
|
|
498
554
|
}
|
|
499
|
-
}, [
|
|
555
|
+
}, [domicile, focusOwn, holdsKeyboard, view, waiting]);
|
|
500
556
|
|
|
501
557
|
// Takes the keyboard back for the file picker or the page's dialog when the
|
|
502
558
|
// waiting page takes focus. The PDF viewer refocuses its own button after
|
|
503
559
|
// asking where to save, and the keys would follow it into the page.
|
|
504
560
|
useEffect(() => {
|
|
505
|
-
const waiting = pickerBox ?? dialogBox;
|
|
506
561
|
if (view === null || waiting === null) {
|
|
507
562
|
return undefined;
|
|
508
563
|
} else {
|
|
@@ -514,7 +569,7 @@ export const BrowserWindow = ({
|
|
|
514
569
|
view.removeEventListener(WEBVIEW_GUEST_FOCUS_EVENT, reclaim);
|
|
515
570
|
};
|
|
516
571
|
}
|
|
517
|
-
}, [
|
|
572
|
+
}, [focusOwn, view, waiting]);
|
|
518
573
|
|
|
519
574
|
// Releases focus when the window loses it. The engine forwards keys from this
|
|
520
575
|
// document to clients, but keys sent to a focused guest never reach the
|
|
@@ -530,7 +585,7 @@ export const BrowserWindow = ({
|
|
|
530
585
|
// is open. Not behind a panel or the lock screen, whose keys must not reach
|
|
531
586
|
// the page.
|
|
532
587
|
useReclaimFocus<HTMLElement>(
|
|
533
|
-
|
|
588
|
+
waiting ?? view,
|
|
534
589
|
holdsKeyboard && !behindPanel,
|
|
535
590
|
focusOwn,
|
|
536
591
|
);
|
|
@@ -604,9 +659,9 @@ export const BrowserWindow = ({
|
|
|
604
659
|
// A leaving window is unreachable by keyboard.
|
|
605
660
|
inert={leaving}
|
|
606
661
|
// Ignores animations bubbling up from descendants, such as the page
|
|
607
|
-
// notices.
|
|
662
|
+
// notices, and the end of a motion this one replaced.
|
|
608
663
|
onAnimationEnd={(event) => {
|
|
609
|
-
if (event
|
|
664
|
+
if (endsOwnAnimation(event)) {
|
|
610
665
|
onMotionEnded();
|
|
611
666
|
}
|
|
612
667
|
}}
|
|
@@ -629,7 +684,7 @@ export const BrowserWindow = ({
|
|
|
629
684
|
? undefined
|
|
630
685
|
: {
|
|
631
686
|
...placedAt(rect, depth),
|
|
632
|
-
...
|
|
687
|
+
...contentsScaledAbout(motion, frame, tab, rect),
|
|
633
688
|
...shuffledBy(restack),
|
|
634
689
|
}
|
|
635
690
|
}
|
|
@@ -706,13 +761,51 @@ export const BrowserWindow = ({
|
|
|
706
761
|
className={viewStyles}
|
|
707
762
|
ref={setView}
|
|
708
763
|
// Also while the window settles, so the engine neither holds the
|
|
709
|
-
// shell for the page nor stretches its old frame
|
|
710
|
-
|
|
764
|
+
// shell for the page nor stretches its old frame, and while it
|
|
765
|
+
// slides in, so the slide does not wait for the page to draw
|
|
766
|
+
// again.
|
|
767
|
+
resizing={
|
|
768
|
+
resizing || settlingFrom !== undefined || isSlidingIn(motion)
|
|
769
|
+
? ""
|
|
770
|
+
: undefined
|
|
771
|
+
}
|
|
711
772
|
// React sets attributes before insertion, when the engine reads it.
|
|
712
773
|
// See `window`.
|
|
713
774
|
window={window}
|
|
714
775
|
/>
|
|
776
|
+
{problem !== undefined && (
|
|
777
|
+
<PageProblem
|
|
778
|
+
canGoBack={canGoBack}
|
|
779
|
+
// A new page per problem, so Details starts closed.
|
|
780
|
+
key={problem.kind === "gone" ? problem.reason : problem.url}
|
|
781
|
+
onGoBack={drive((loaded) => {
|
|
782
|
+
loaded.goBack();
|
|
783
|
+
})}
|
|
784
|
+
onProceed={drive((loaded) => {
|
|
785
|
+
loaded.proceedPastWarning();
|
|
786
|
+
})}
|
|
787
|
+
onReload={drive((loaded) => {
|
|
788
|
+
loaded.reload();
|
|
789
|
+
})}
|
|
790
|
+
problem={problem}
|
|
791
|
+
ref={setProblemBox}
|
|
792
|
+
/>
|
|
793
|
+
)}
|
|
794
|
+
{pagePicker !== undefined && (
|
|
795
|
+
<PickerAsk
|
|
796
|
+
// A new picker per request, so each starts at the page's value.
|
|
797
|
+
key={[
|
|
798
|
+
pagePicker.kind,
|
|
799
|
+
pagePicker.value,
|
|
800
|
+
pagePicker.anchor.x,
|
|
801
|
+
pagePicker.anchor.y,
|
|
802
|
+
].join("\n")}
|
|
803
|
+
ref={setPagePickerBox}
|
|
804
|
+
request={pagePicker}
|
|
805
|
+
/>
|
|
806
|
+
)}
|
|
715
807
|
<LinkTarget view={view} />
|
|
808
|
+
<PageTooltip view={view} />
|
|
716
809
|
<PagePopup
|
|
717
810
|
closesAfter={ZOOM_POPUP_MS}
|
|
718
811
|
cue={popupCue}
|
|
@@ -776,6 +869,32 @@ export const BrowserWindow = ({
|
|
|
776
869
|
{dialogRequest !== undefined && (
|
|
777
870
|
<PageDialog ref={setDialogBox} request={dialogRequest} />
|
|
778
871
|
)}
|
|
872
|
+
{dialogRequest === undefined && signIn !== undefined && (
|
|
873
|
+
<SignInAsk ref={setSignInBox} request={signIn} />
|
|
874
|
+
)}
|
|
875
|
+
{dialogRequest === undefined &&
|
|
876
|
+
signIn === undefined &&
|
|
877
|
+
prompt !== undefined && (
|
|
878
|
+
<PromptAsk
|
|
879
|
+
// A new answer per prompt, so each starts unanswered.
|
|
880
|
+
key={[prompt.kind, prompt.subject, ...prompt.details].join(
|
|
881
|
+
"\n",
|
|
882
|
+
)}
|
|
883
|
+
ref={setPromptBox}
|
|
884
|
+
request={prompt}
|
|
885
|
+
/>
|
|
886
|
+
)}
|
|
887
|
+
{dialogRequest === undefined &&
|
|
888
|
+
signIn === undefined &&
|
|
889
|
+
prompt === undefined &&
|
|
890
|
+
externalApp !== undefined &&
|
|
891
|
+
linkOpener !== undefined && (
|
|
892
|
+
<ExternalAppAsk
|
|
893
|
+
app={linkOpener}
|
|
894
|
+
ref={setAppAskBox}
|
|
895
|
+
request={externalApp}
|
|
896
|
+
/>
|
|
897
|
+
)}
|
|
779
898
|
{asking !== undefined && (
|
|
780
899
|
<FilePicker
|
|
781
900
|
// A new picker per request, so each starts empty.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
|
|
3
|
+
import { TitleBar } from "./TitleBar";
|
|
4
|
+
import type { Aim, DropTargets } from "./tiled/aim";
|
|
5
|
+
import { useTileDrag } from "./tiled/useTileDrag";
|
|
6
|
+
import type { Layout } from "./tree/node";
|
|
7
|
+
import type { NodeRef } from "./tree/path";
|
|
8
|
+
|
|
9
|
+
/** The primary button, as `PointerEvent.button` numbers it. */
|
|
10
|
+
const PRIMARY_BUTTON = 0;
|
|
11
|
+
|
|
12
|
+
type Props = Omit<
|
|
13
|
+
ComponentProps<typeof TitleBar>,
|
|
14
|
+
"grabbing" | "group" | "onPointerDown"
|
|
15
|
+
> & {
|
|
16
|
+
/** The group's layout and the windows it holds. */
|
|
17
|
+
group: { layout: Layout; windows: readonly string[] };
|
|
18
|
+
/** The group. */
|
|
19
|
+
node: NodeRef;
|
|
20
|
+
/** Where the dragged group would land if dropped now. */
|
|
21
|
+
onAim: (aim: Aim | undefined) => void;
|
|
22
|
+
onDrop: () => void;
|
|
23
|
+
/** The group dropped where it was aimed. See `useTileDrag`. */
|
|
24
|
+
onDropOn: (aim: Aim) => void;
|
|
25
|
+
/** The group taken hold of. */
|
|
26
|
+
onGrab: () => void;
|
|
27
|
+
/** A press on the tab, which shows the group. */
|
|
28
|
+
onPress: () => void;
|
|
29
|
+
/** A move of the group was pulled. See `useTileDrag`. */
|
|
30
|
+
onPull: () => void;
|
|
31
|
+
/** What the group can be dropped on, on every screen. */
|
|
32
|
+
targets: DropTargets;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The tab of a group nested in another group's strip. A press shows the
|
|
37
|
+
* group, and a drag with the primary button moves it as a tiled window's tab
|
|
38
|
+
* moves: along its strip, or out to another strip, window or screen.
|
|
39
|
+
*/
|
|
40
|
+
export const GroupTitleBar = ({
|
|
41
|
+
node,
|
|
42
|
+
onAim,
|
|
43
|
+
onDrop,
|
|
44
|
+
onDropOn,
|
|
45
|
+
onGrab,
|
|
46
|
+
onPress,
|
|
47
|
+
onPull,
|
|
48
|
+
targets,
|
|
49
|
+
...bar
|
|
50
|
+
}: Props) => {
|
|
51
|
+
const { drag, onPointerDown } = useTileDrag({
|
|
52
|
+
dragged: { node, windows: bar.group.windows },
|
|
53
|
+
frame: bar.rect,
|
|
54
|
+
onAim,
|
|
55
|
+
onDrop,
|
|
56
|
+
onDropOn,
|
|
57
|
+
onGrab,
|
|
58
|
+
onPull,
|
|
59
|
+
onStretch: doesNotStretch,
|
|
60
|
+
resizes: false,
|
|
61
|
+
targets,
|
|
62
|
+
});
|
|
63
|
+
return (
|
|
64
|
+
<TitleBar
|
|
65
|
+
{...bar}
|
|
66
|
+
grabbing={drag?.pulled === true}
|
|
67
|
+
onPointerDown={(event) => {
|
|
68
|
+
onPress();
|
|
69
|
+
if (event.button === PRIMARY_BUTTON) {
|
|
70
|
+
onPointerDown(event);
|
|
71
|
+
}
|
|
72
|
+
}}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/** Never called: a tab only moves its group. */
|
|
78
|
+
const doesNotStretch = () => {
|
|
79
|
+
throw new Error("group title bar: a tab does not resize its group");
|
|
80
|
+
};
|