@domicile-desktop/manganese-window-management 1.2.0 → 2.0.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 +29 -19
- package/src/AppPopup.tsx +22 -10
- package/src/AppWindow.tsx +146 -68
- package/src/BrowserWindow.tsx +393 -33
- package/src/FocusGlow.tsx +5 -1
- package/src/GroupTitleBar.tsx +80 -0
- package/src/GroupWell.tsx +5 -1
- package/src/SelectionTint.tsx +5 -1
- package/src/Stage.tsx +381 -106
- package/src/StripEnd.tsx +1 -1
- package/src/TabStrip.tsx +16 -1
- package/src/TitleBar.tsx +277 -124
- package/src/WindowFrame.tsx +106 -26
- package/src/WindowTitleBar.tsx +11 -2
- package/src/browser/AddressBar.tsx +46 -37
- package/src/browser/AppMenuBar.tsx +106 -0
- package/src/browser/AppPopupMenu.tsx +45 -0
- package/src/browser/ConnectionIndicator.tsx +2 -2
- package/src/browser/HistoryButton.tsx +150 -0
- package/src/browser/PageMenu.tsx +20 -6
- package/src/browser/PageProblem.tsx +280 -0
- package/src/browser/PageTooltip.tsx +76 -0
- package/src/browser/PageViews.tsx +101 -0
- package/src/browser/ProfileMenu.tsx +332 -0
- package/src/browser/app-window-shape.ts +33 -0
- package/src/browser/page-history.ts +54 -0
- package/src/browser/page-menu.ts +85 -9
- package/src/browser/profile-ink.ts +17 -0
- package/src/browser/useAppMenuBar.ts +51 -0
- package/src/browser/useAppMessageBox.ts +47 -0
- package/src/browser/useAppPopupMenu.ts +49 -0
- package/src/browser/useAppWindowLooks.ts +49 -0
- package/src/browser/useAppWindowState.ts +59 -0
- package/src/browser/useBrowserProfile.ts +230 -0
- package/src/browser/useLongPress.ts +66 -0
- package/src/captured-element.ts +18 -0
- package/src/closing.ts +33 -15
- package/src/crossing.ts +64 -0
- package/src/floating/FloatGrab.tsx +10 -0
- package/src/floating/FloatShadow.tsx +5 -1
- package/src/floating/useFloatBorderDrag.ts +17 -59
- package/src/floating/useFloatDrag.ts +3 -2
- package/src/follow-press.ts +55 -0
- package/src/handed-drag.ts +57 -0
- package/src/keyboard/command.ts +160 -9
- package/src/keyboard/commands.ts +62 -6
- package/src/keyboard/query.ts +94 -0
- package/src/keyboard/useKeybindings.ts +69 -13
- package/src/overview/OverviewBackdrop.tsx +246 -0
- package/src/overview/OverviewPicker.tsx +453 -0
- package/src/overview/fixture.ts +76 -0
- package/src/overview/overview.ts +112 -0
- package/src/overview/seen-styles.ts +132 -0
- package/src/overview/sight.ts +86 -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 +91 -3
- package/src/picture-in-picture/PictureInPictureFloats.tsx +865 -0
- package/src/picture-in-picture/page-of.ts +25 -0
- package/src/picture-in-picture/pip-box.ts +156 -0
- package/src/picture-in-picture/playhead.ts +33 -0
- package/src/placement.ts +20 -11
- package/src/pointer-confinement.ts +107 -0
- package/src/pointer-lock.ts +113 -0
- package/src/popup.ts +25 -37
- package/src/recorded-settles.ts +6 -2
- package/src/restacking.ts +4 -3
- package/src/screens/popup-scene.ts +38 -0
- package/src/screens/reading-order.ts +29 -0
- package/src/shown.ts +10 -0
- package/src/sliding-screen.ts +12 -0
- package/src/tab-drop.ts +43 -0
- package/src/tab-switch.ts +5 -1
- package/src/tiled/TileGrab.tsx +11 -1
- package/src/tiled/aim.ts +77 -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 +8 -7
- package/src/tree/drop.ts +118 -23
- package/src/tree/frames.ts +2 -2
- package/src/tree/layout.ts +71 -11
- package/src/tree/move.ts +8 -27
- package/src/useHandedPress.ts +25 -0
- package/src/usePageProblem.ts +80 -0
- package/src/usePageTooltip.ts +48 -0
- package/src/usePointerConfinement.ts +103 -0
- package/src/usePointerLock.ts +12 -0
- package/src/useSettling.ts +38 -9
- package/src/useTabDrop.ts +65 -0
- package/src/useWindowMotion.ts +109 -10
- package/src/useWindows.ts +112 -19
- package/src/window-changes.ts +13 -3
- package/src/window-log.ts +106 -0
- package/src/window-motion.ts +34 -0
- package/src/window-state.ts +629 -66
- package/src/window-styles.ts +96 -4
- package/src/window.ts +14 -0
- package/src/workspace.ts +11 -5
- 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 +2885 -2108
- package/styled-system/tokens/index.mjs +7 -3
- package/styled-system/tokens/tokens.d.ts +2 -2
- package/styled-system/types/prop-type.d.ts +2 -2
package/src/BrowserWindow.tsx
CHANGED
|
@@ -2,26 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
import { FilePicker } from "@domicile-desktop/component-library/FilePicker";
|
|
4
4
|
import { desktopFolders } from "@domicile-desktop/component-library/folders";
|
|
5
|
+
import { AppMessageBox } from "@domicile-desktop/manganese-page-requests/AppMessageBox";
|
|
5
6
|
import { DeviceAsk } from "@domicile-desktop/manganese-page-requests/DeviceAsk";
|
|
7
|
+
import { ExternalAppAsk } from "@domicile-desktop/manganese-page-requests/ExternalAppAsk";
|
|
8
|
+
import { IdentityAsk } from "@domicile-desktop/manganese-page-requests/IdentityAsk";
|
|
6
9
|
import { PageDialog } from "@domicile-desktop/manganese-page-requests/PageDialog";
|
|
10
|
+
import { PickerAsk } from "@domicile-desktop/manganese-page-requests/PickerAsk";
|
|
11
|
+
import { PromptAsk } from "@domicile-desktop/manganese-page-requests/PromptAsk";
|
|
12
|
+
import { SignInAsk } from "@domicile-desktop/manganese-page-requests/SignInAsk";
|
|
7
13
|
import { useDeviceRequest } from "@domicile-desktop/manganese-page-requests/useDeviceRequest";
|
|
8
14
|
import { useDialogRequest } from "@domicile-desktop/manganese-page-requests/useDialogRequest";
|
|
15
|
+
import { useExternalAppRequest } from "@domicile-desktop/manganese-page-requests/useExternalAppRequest";
|
|
16
|
+
import { useIdentityRequest } from "@domicile-desktop/manganese-page-requests/useIdentityRequest";
|
|
17
|
+
import { useLinkOpener } from "@domicile-desktop/manganese-page-requests/useLinkOpener";
|
|
9
18
|
import { usePermissionRequest } from "@domicile-desktop/manganese-page-requests/usePermissionRequest";
|
|
19
|
+
import { usePickerRequest } from "@domicile-desktop/manganese-page-requests/usePickerRequest";
|
|
20
|
+
import { usePromptRequest } from "@domicile-desktop/manganese-page-requests/usePromptRequest";
|
|
21
|
+
import { useSignInRequest } from "@domicile-desktop/manganese-page-requests/useSignInRequest";
|
|
22
|
+
import {
|
|
23
|
+
acceleratedBy,
|
|
24
|
+
openedByMnemonic,
|
|
25
|
+
} from "@domicile-desktop/sdk/app-menu";
|
|
10
26
|
import type { Domicile } from "@domicile-desktop/sdk/desktop/desktop";
|
|
11
27
|
import {
|
|
12
28
|
WEBVIEW_DIALOG_EVENT,
|
|
13
29
|
WEBVIEW_FOCUS_REQUEST_EVENT,
|
|
14
30
|
WEBVIEW_GUEST_FOCUS_EVENT,
|
|
15
31
|
WEBVIEW_GUEST_KEYDOWN_EVENT,
|
|
32
|
+
WEBVIEW_GUEST_KEYUP_EVENT,
|
|
16
33
|
WEBVIEW_ZOOM_IN_REQUEST_EVENT,
|
|
17
34
|
WEBVIEW_ZOOM_OUT_REQUEST_EVENT,
|
|
18
35
|
} from "@domicile-desktop/sdk/webview-element";
|
|
19
36
|
import type { FocusEvent } from "react";
|
|
20
|
-
import {
|
|
37
|
+
import {
|
|
38
|
+
useCallback,
|
|
39
|
+
useContext,
|
|
40
|
+
useEffect,
|
|
41
|
+
useMemo,
|
|
42
|
+
useRef,
|
|
43
|
+
useState,
|
|
44
|
+
} from "react";
|
|
21
45
|
import { css, cx } from "../styled-system/css";
|
|
22
46
|
import { flex } from "../styled-system/patterns";
|
|
23
47
|
import { AddressBar } from "./browser/AddressBar";
|
|
24
48
|
import { AppAddress } from "./browser/AppAddress";
|
|
49
|
+
import { AppMenuBar } from "./browser/AppMenuBar";
|
|
50
|
+
import { AppPopupMenu } from "./browser/AppPopupMenu";
|
|
25
51
|
import { leftOrigin } from "./browser/app-origin";
|
|
26
52
|
import { BrowserCommand, browserCommandFor } from "./browser/browser-command";
|
|
27
53
|
import { FindBar } from "./browser/FindBar";
|
|
@@ -29,15 +55,32 @@ import { LinkTarget } from "./browser/LinkTarget";
|
|
|
29
55
|
import { mediaDeviceChoiceFor } from "./browser/media-devices";
|
|
30
56
|
import { PageMenu } from "./browser/PageMenu";
|
|
31
57
|
import { PagePopup } from "./browser/PagePopup";
|
|
58
|
+
import { PageProblem } from "./browser/PageProblem";
|
|
59
|
+
import { PageTooltip } from "./browser/PageTooltip";
|
|
60
|
+
import { PageViews } from "./browser/PageViews";
|
|
61
|
+
import { pageHistoryFor } from "./browser/page-history";
|
|
32
62
|
import { choosePageCommand, pageMenuFor } from "./browser/page-menu";
|
|
63
|
+
import { useAppMenuBar } from "./browser/useAppMenuBar";
|
|
64
|
+
import { useAppMessageBox } from "./browser/useAppMessageBox";
|
|
65
|
+
import { useAppPopupMenu } from "./browser/useAppPopupMenu";
|
|
66
|
+
import { useAppWindowLooks } from "./browser/useAppWindowLooks";
|
|
67
|
+
import { useAppWindowState } from "./browser/useAppWindowState";
|
|
68
|
+
import {
|
|
69
|
+
useBrowserProfile,
|
|
70
|
+
usePinnedSite,
|
|
71
|
+
useProfileExtensions,
|
|
72
|
+
} from "./browser/useBrowserProfile";
|
|
33
73
|
import { useFileRequest } from "./browser/useFileRequest";
|
|
34
74
|
import { usePageMenu } from "./browser/usePageMenu";
|
|
35
75
|
import { useSitePermissions } from "./browser/useSitePermissions";
|
|
36
76
|
import { useZoomPopup } from "./browser/useZoomPopup";
|
|
37
77
|
import { ZoomPanel } from "./browser/ZoomPanel";
|
|
38
78
|
import { zoomedIn, zoomedOut } from "./browser/zoom-steps";
|
|
79
|
+
import { endsOwnAnimation } from "./own-animation";
|
|
80
|
+
import { CROSSING } from "./placement";
|
|
39
81
|
import type { Rect } from "./rect";
|
|
40
82
|
import type { Restack } from "./restacking";
|
|
83
|
+
import { SlidingScreen } from "./sliding-screen";
|
|
41
84
|
import { useHistoryAvailability } from "./useHistoryAvailability";
|
|
42
85
|
import { useLoading } from "./useLoading";
|
|
43
86
|
import { useLoadProgress } from "./useLoadProgress";
|
|
@@ -45,23 +88,25 @@ import { useLowered } from "./useLowered";
|
|
|
45
88
|
import { usePageDescription } from "./usePageDescription";
|
|
46
89
|
import { usePageFullscreen } from "./usePageFullscreen";
|
|
47
90
|
import { usePageIcon } from "./usePageIcon";
|
|
91
|
+
import { usePageProblem } from "./usePageProblem";
|
|
48
92
|
import { useReclaimFocus } from "./useReclaimFocus";
|
|
49
93
|
import type { Settler } from "./useSettling";
|
|
50
94
|
import { UPRIGHT, useSettling } from "./useSettling";
|
|
51
95
|
import { useShownPage } from "./useShownPage";
|
|
52
96
|
import { useZoom } from "./useZoom";
|
|
53
97
|
import type { WindowMotion } from "./window-motion";
|
|
54
|
-
import { isLeaving, isMoving } from "./window-motion";
|
|
98
|
+
import { isLeaving, isMoving, isSlidingIn } from "./window-motion";
|
|
55
99
|
import {
|
|
56
100
|
bottomCornerStyles,
|
|
57
101
|
clickThroughStyles,
|
|
102
|
+
clippedAlong,
|
|
103
|
+
contentsScaledAbout,
|
|
58
104
|
edgeStyles,
|
|
59
105
|
heldStyles,
|
|
60
106
|
keptAt,
|
|
61
107
|
movingStyles,
|
|
62
108
|
originOf,
|
|
63
109
|
placedAt,
|
|
64
|
-
scaledAbout,
|
|
65
110
|
settlingStyles,
|
|
66
111
|
shuffledBy,
|
|
67
112
|
windowStyles,
|
|
@@ -88,6 +133,11 @@ type Props = {
|
|
|
88
133
|
* clicked, so its guest taking focus is not a user reach (see `onReach`).
|
|
89
134
|
*/
|
|
90
135
|
covered: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Whether it just moved to another tab group, so it eases there over the
|
|
138
|
+
* strips it passes. See `crossing.ts`.
|
|
139
|
+
*/
|
|
140
|
+
crossing?: boolean | undefined;
|
|
91
141
|
/** The window's `z-index`, which the SDK reports to the host. */
|
|
92
142
|
depth: number;
|
|
93
143
|
/**
|
|
@@ -102,6 +152,11 @@ type Props = {
|
|
|
102
152
|
* {@link scaledAbout}). `undefined` when {@link Props.rect} is.
|
|
103
153
|
*/
|
|
104
154
|
frame: Rect | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* Its tab in the strip, which its contents grow out of as it opens and
|
|
157
|
+
* shrink into as it closes (see {@link contentsScaledAbout}).
|
|
158
|
+
*/
|
|
159
|
+
tab?: Rect | undefined;
|
|
105
160
|
/** Whether this window is fullscreen, which removes its edge and corners. */
|
|
106
161
|
fullscreen: boolean;
|
|
107
162
|
/** Lists a directory for the file picker. */
|
|
@@ -202,6 +257,7 @@ export const BrowserWindow = ({
|
|
|
202
257
|
behindPanel,
|
|
203
258
|
clickThrough,
|
|
204
259
|
covered,
|
|
260
|
+
crossing = false,
|
|
205
261
|
depth,
|
|
206
262
|
domicile,
|
|
207
263
|
dragging,
|
|
@@ -223,6 +279,7 @@ export const BrowserWindow = ({
|
|
|
223
279
|
resizing,
|
|
224
280
|
restack,
|
|
225
281
|
settler,
|
|
282
|
+
tab,
|
|
226
283
|
url,
|
|
227
284
|
window,
|
|
228
285
|
}: Props) => {
|
|
@@ -235,10 +292,13 @@ export const BrowserWindow = ({
|
|
|
235
292
|
const unclickable = covered || behindPanel;
|
|
236
293
|
// `null` because React passes `null` to a callback ref on unmount.
|
|
237
294
|
const [view, setView] = useState<HTMLWebViewElement | null>(null);
|
|
295
|
+
/** The page and the app's views over it, whose keys bubble up to it. */
|
|
296
|
+
const [page, setPage] = useState<HTMLDivElement | null>(null);
|
|
238
297
|
// The whole window, used to check whether focus is inside it and to ease it
|
|
239
298
|
// into a new box. A ref because only effects read it.
|
|
240
299
|
const element = useRef<HTMLElement>(null);
|
|
241
300
|
const lowered = useLowered(depth);
|
|
301
|
+
const sliding = useContext(SlidingScreen);
|
|
242
302
|
// The box the window eases from, while it settles.
|
|
243
303
|
const [settlingFrom, setSettlingFrom] = useState<Rect | undefined>(undefined);
|
|
244
304
|
useSettling({
|
|
@@ -248,6 +308,7 @@ export const BrowserWindow = ({
|
|
|
248
308
|
rect === undefined || frame === undefined
|
|
249
309
|
? undefined
|
|
250
310
|
: originOf(frame, rect),
|
|
311
|
+
over: crossing ? CROSSING : undefined,
|
|
251
312
|
rect,
|
|
252
313
|
settler,
|
|
253
314
|
still: dragging || isMoving(motion),
|
|
@@ -262,6 +323,12 @@ export const BrowserWindow = ({
|
|
|
262
323
|
// the shell did not start (links, redirects, form posts).
|
|
263
324
|
const shown = useShownPage(view);
|
|
264
325
|
const address = addressOf(shown.url, sent);
|
|
326
|
+
const pageProfile = useBrowserProfile(domicile, window);
|
|
327
|
+
const pinned = usePinnedSite(domicile, address);
|
|
328
|
+
const profileExtensions = useProfileExtensions(
|
|
329
|
+
domicile,
|
|
330
|
+
pageProfile?.profile,
|
|
331
|
+
);
|
|
265
332
|
usePageIcon(view, window, onIcon);
|
|
266
333
|
usePageDescription(view, window, onDescription);
|
|
267
334
|
const { canGoBack, canGoForward } = useHistoryAvailability(view);
|
|
@@ -278,6 +345,9 @@ export const BrowserWindow = ({
|
|
|
278
345
|
const zoom = useZoom(view);
|
|
279
346
|
// A fullscreen page, such as a video, fills the window without its bar.
|
|
280
347
|
const pageFullscreen = usePageFullscreen(view, fullscreen, onPageFullscreen);
|
|
348
|
+
// An Electron app's win.setFullScreen does as a fullscreen page does, and
|
|
349
|
+
// the app hears what the window is.
|
|
350
|
+
useAppWindowState(domicile, window, fullscreen, onPageFullscreen);
|
|
281
351
|
// True while `focusOwn` is calling `focus()`. Focus events fire
|
|
282
352
|
// synchronously inside that call, so this marks them as not user reaches.
|
|
283
353
|
const focusing = useRef(false);
|
|
@@ -285,9 +355,11 @@ export const BrowserWindow = ({
|
|
|
285
355
|
() => foldersOf(domicile.files),
|
|
286
356
|
[domicile, foldersOf],
|
|
287
357
|
);
|
|
288
|
-
// A pending file request from the page
|
|
289
|
-
//
|
|
290
|
-
|
|
358
|
+
// A pending file request from the page, or from one of an Electron app's
|
|
359
|
+
// views over it, as an upload or a download in either asks for a path. The
|
|
360
|
+
// request bubbles, so the element around them all hears it. The engine
|
|
361
|
+
// draws no dialog; see `useFileRequest`.
|
|
362
|
+
const asking = useFileRequest(page, folders);
|
|
291
363
|
// The file picker's input. While open it takes the window's keyboard.
|
|
292
364
|
const [pickerBox, setPickerBox] = useState<HTMLInputElement | null>(null);
|
|
293
365
|
// Whether the find bar is open, and its input.
|
|
@@ -312,6 +384,48 @@ export const BrowserWindow = ({
|
|
|
312
384
|
// paused on, and the element in it to focus. The engine draws no dialog.
|
|
313
385
|
const dialogRequest = useDialogRequest(view);
|
|
314
386
|
const [dialogBox, setDialogBox] = useState<HTMLElement | null>(null);
|
|
387
|
+
// The message box an Electron app asks over this window, and the button
|
|
388
|
+
// in it to focus. The engine draws no dialog.
|
|
389
|
+
const appBox = useAppMessageBox(domicile, window);
|
|
390
|
+
// A popup menu the app opened (`Menu.popup`), such as its menu button's.
|
|
391
|
+
const appPopup = useAppPopupMenu(domicile, window);
|
|
392
|
+
const [appBoxButton, setAppBoxButton] = useState<HTMLElement | null>(null);
|
|
393
|
+
// The link for an application the page opened, the application that opens
|
|
394
|
+
// it, and the button to focus. The engine draws no dialog.
|
|
395
|
+
const externalApp = useExternalAppRequest(view);
|
|
396
|
+
const linkOpener = useLinkOpener(domicile, externalApp?.url);
|
|
397
|
+
const [appAskBox, setAppAskBox] = useState<HTMLElement | null>(null);
|
|
398
|
+
// The user name and password a site or proxy asked for, and the field to
|
|
399
|
+
// focus. The engine draws no dialog.
|
|
400
|
+
const signIn = useSignInRequest(view);
|
|
401
|
+
const [signInBox, setSignInBox] = useState<HTMLElement | null>(null);
|
|
402
|
+
// File access, a certificate, Bluetooth pairing or an extension's
|
|
403
|
+
// permissions, and the element to focus. The engine draws no dialog.
|
|
404
|
+
const prompt = usePromptRequest(view);
|
|
405
|
+
const [promptBox, setPromptBox] = useState<HTMLElement | null>(null);
|
|
406
|
+
// The "Sign in with" step the site's sign-in is on, and the answer to
|
|
407
|
+
// focus when it asks over the page. The engine draws no account chooser.
|
|
408
|
+
const identity = useIdentityRequest(view);
|
|
409
|
+
const [identityBox, setIdentityBox] = useState<HTMLElement | null>(null);
|
|
410
|
+
// The color, date or list picker a form control in the page opened, and
|
|
411
|
+
// the element in it to focus. The engine draws no picker.
|
|
412
|
+
const pagePicker = usePickerRequest(view);
|
|
413
|
+
const [pagePickerBox, setPagePickerBox] = useState<HTMLElement | null>(null);
|
|
414
|
+
// Why the page shows nothing: a failed load or a crash, which the shell
|
|
415
|
+
// draws over the blank page; and its first answer, to focus.
|
|
416
|
+
const problem = usePageProblem(view);
|
|
417
|
+
const [problemBox, setProblemBox] = useState<HTMLElement | null>(null);
|
|
418
|
+
// What the page waits on, which takes the keyboard while it is open.
|
|
419
|
+
const waiting =
|
|
420
|
+
pickerBox ??
|
|
421
|
+
appBoxButton ??
|
|
422
|
+
dialogBox ??
|
|
423
|
+
signInBox ??
|
|
424
|
+
promptBox ??
|
|
425
|
+
identityBox ??
|
|
426
|
+
appAskBox ??
|
|
427
|
+
pagePickerBox ??
|
|
428
|
+
problemBox;
|
|
315
429
|
|
|
316
430
|
// Focuses an element in this window without reporting it as a user reach.
|
|
317
431
|
// All programmatic focus here must go through this.
|
|
@@ -440,6 +554,36 @@ export const BrowserWindow = ({
|
|
|
440
554
|
[findBox, focusOwn, showPopup, view],
|
|
441
555
|
);
|
|
442
556
|
|
|
557
|
+
// An Electron app's menu bar, the menu open on it, and whether Alt showed a
|
|
558
|
+
// bar that hides until Alt (`autoHideMenuBar`).
|
|
559
|
+
const menuBar = useAppMenuBar(domicile, window);
|
|
560
|
+
// What an Electron app asks of its window's looks and input.
|
|
561
|
+
const looks = useAppWindowLooks(domicile, window);
|
|
562
|
+
const [openMenu, setOpenMenu] = useState<number | undefined>(undefined);
|
|
563
|
+
const [menuBarShown, setMenuBarShown] = useState(false);
|
|
564
|
+
// Whether Alt is down with nothing pressed with it, so letting it go is a
|
|
565
|
+
// tap that shows or hides an auto-hidden bar.
|
|
566
|
+
const altAlone = useRef(false);
|
|
567
|
+
const shownMenuBar =
|
|
568
|
+
menuBar?.visible === true &&
|
|
569
|
+
!pageFullscreen &&
|
|
570
|
+
(!menuBar.autoHide || menuBarShown || openMenu !== undefined)
|
|
571
|
+
? menuBar
|
|
572
|
+
: undefined;
|
|
573
|
+
const openedMenu = useCallback((opened: number | undefined) => {
|
|
574
|
+
setOpenMenu(opened);
|
|
575
|
+
// A choice or Escape puts an auto-hidden bar away, as on Electron.
|
|
576
|
+
if (opened === undefined) {
|
|
577
|
+
setMenuBarShown(false);
|
|
578
|
+
}
|
|
579
|
+
}, []);
|
|
580
|
+
const chooseMenuEntry = useCallback(
|
|
581
|
+
(id: number) => {
|
|
582
|
+
domicile.browser.clickMenu(window, id);
|
|
583
|
+
},
|
|
584
|
+
[domicile, window],
|
|
585
|
+
);
|
|
586
|
+
|
|
443
587
|
// Focuses the find bar when it opens.
|
|
444
588
|
useEffect(() => {
|
|
445
589
|
if (findBox !== null) {
|
|
@@ -450,32 +594,62 @@ export const BrowserWindow = ({
|
|
|
450
594
|
// Keys pressed in the guest never reach this document. The engine forwards
|
|
451
595
|
// chords the page did not handle, and Ctrl+wheel as zoom requests, so sites
|
|
452
596
|
// keep their own bindings as in Chrome. See `WEBVIEW_GUEST_KEYDOWN_EVENT`.
|
|
597
|
+
// An Electron app's views are part of its window, so the app's keys are
|
|
598
|
+
// heard from them too; the browser's keys act on the window's own page, so
|
|
599
|
+
// only that page's run them.
|
|
453
600
|
useEffect(() => {
|
|
454
|
-
if (view === null) {
|
|
601
|
+
if (view === null || page === null) {
|
|
455
602
|
return undefined;
|
|
456
603
|
} else {
|
|
457
604
|
const pressed = (event: KeyboardEvent) => {
|
|
458
|
-
|
|
459
|
-
|
|
605
|
+
altAlone.current =
|
|
606
|
+
event.key === "Alt" && (altAlone.current || !event.repeat);
|
|
607
|
+
// An app's accelerators come before the browser's keys, as its menu
|
|
608
|
+
// runs them in Electron, and Alt with a mnemonic opens a menu.
|
|
609
|
+
const accelerated =
|
|
610
|
+
menuBar === undefined
|
|
611
|
+
? undefined
|
|
612
|
+
: acceleratedBy(menuBar.entries, event);
|
|
613
|
+
const mnemonic =
|
|
614
|
+
menuBar === undefined || !menuBar.visible
|
|
615
|
+
? undefined
|
|
616
|
+
: openedByMnemonic(menuBar.entries, event);
|
|
617
|
+
const command =
|
|
618
|
+
event.target === view ? browserCommandFor(event) : undefined;
|
|
619
|
+
if (accelerated !== undefined) {
|
|
620
|
+
chooseMenuEntry(accelerated.id);
|
|
621
|
+
} else if (mnemonic !== undefined) {
|
|
622
|
+
setOpenMenu(mnemonic.id);
|
|
623
|
+
} else if (command !== undefined) {
|
|
460
624
|
run(command);
|
|
461
625
|
}
|
|
462
626
|
};
|
|
627
|
+
const released = (event: KeyboardEvent) => {
|
|
628
|
+
if (event.key === "Alt" && altAlone.current) {
|
|
629
|
+
altAlone.current = false;
|
|
630
|
+
if (menuBar?.visible === true && menuBar.autoHide) {
|
|
631
|
+
setMenuBarShown((shown) => !shown);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
};
|
|
463
635
|
const zoomIn = () => {
|
|
464
636
|
run(BrowserCommand.ZoomIn);
|
|
465
637
|
};
|
|
466
638
|
const zoomOut = () => {
|
|
467
639
|
run(BrowserCommand.ZoomOut);
|
|
468
640
|
};
|
|
469
|
-
|
|
641
|
+
page.addEventListener(WEBVIEW_GUEST_KEYDOWN_EVENT, pressed);
|
|
642
|
+
page.addEventListener(WEBVIEW_GUEST_KEYUP_EVENT, released);
|
|
470
643
|
view.addEventListener(WEBVIEW_ZOOM_IN_REQUEST_EVENT, zoomIn);
|
|
471
644
|
view.addEventListener(WEBVIEW_ZOOM_OUT_REQUEST_EVENT, zoomOut);
|
|
472
645
|
return () => {
|
|
473
|
-
|
|
646
|
+
page.removeEventListener(WEBVIEW_GUEST_KEYDOWN_EVENT, pressed);
|
|
647
|
+
page.removeEventListener(WEBVIEW_GUEST_KEYUP_EVENT, released);
|
|
474
648
|
view.removeEventListener(WEBVIEW_ZOOM_IN_REQUEST_EVENT, zoomIn);
|
|
475
649
|
view.removeEventListener(WEBVIEW_ZOOM_OUT_REQUEST_EVENT, zoomOut);
|
|
476
650
|
};
|
|
477
651
|
}
|
|
478
|
-
}, [run, view]);
|
|
652
|
+
}, [chooseMenuEntry, menuBar, page, run, view]);
|
|
479
653
|
|
|
480
654
|
// Gives the keyboard to the focused window's page.
|
|
481
655
|
//
|
|
@@ -489,20 +663,18 @@ export const BrowserWindow = ({
|
|
|
489
663
|
useEffect(() => {
|
|
490
664
|
if (holdsKeyboard && view !== null) {
|
|
491
665
|
domicile.windows.focusShell();
|
|
492
|
-
const waiting = pickerBox ?? dialogBox;
|
|
493
666
|
if (waiting !== null) {
|
|
494
667
|
focusOwn(waiting);
|
|
495
668
|
} else if (!holdsFocus(element.current)) {
|
|
496
669
|
focusOwn(view);
|
|
497
670
|
}
|
|
498
671
|
}
|
|
499
|
-
}, [
|
|
672
|
+
}, [domicile, focusOwn, holdsKeyboard, view, waiting]);
|
|
500
673
|
|
|
501
674
|
// Takes the keyboard back for the file picker or the page's dialog when the
|
|
502
675
|
// waiting page takes focus. The PDF viewer refocuses its own button after
|
|
503
676
|
// asking where to save, and the keys would follow it into the page.
|
|
504
677
|
useEffect(() => {
|
|
505
|
-
const waiting = pickerBox ?? dialogBox;
|
|
506
678
|
if (view === null || waiting === null) {
|
|
507
679
|
return undefined;
|
|
508
680
|
} else {
|
|
@@ -514,7 +686,7 @@ export const BrowserWindow = ({
|
|
|
514
686
|
view.removeEventListener(WEBVIEW_GUEST_FOCUS_EVENT, reclaim);
|
|
515
687
|
};
|
|
516
688
|
}
|
|
517
|
-
}, [
|
|
689
|
+
}, [focusOwn, view, waiting]);
|
|
518
690
|
|
|
519
691
|
// Releases focus when the window loses it. The engine forwards keys from this
|
|
520
692
|
// document to clients, but keys sent to a focused guest never reach the
|
|
@@ -530,7 +702,7 @@ export const BrowserWindow = ({
|
|
|
530
702
|
// is open. Not behind a panel or the lock screen, whose keys must not reach
|
|
531
703
|
// the page.
|
|
532
704
|
useReclaimFocus<HTMLElement>(
|
|
533
|
-
|
|
705
|
+
waiting ?? view,
|
|
534
706
|
holdsKeyboard && !behindPanel,
|
|
535
707
|
focusOwn,
|
|
536
708
|
);
|
|
@@ -545,6 +717,19 @@ export const BrowserWindow = ({
|
|
|
545
717
|
}
|
|
546
718
|
};
|
|
547
719
|
|
|
720
|
+
// Opens a link from the page in another browser window: in this one's
|
|
721
|
+
// profile when it is private, so the link stays private, and otherwise in
|
|
722
|
+
// its site's.
|
|
723
|
+
const openWindow = (url: string): void => {
|
|
724
|
+
if (isPrivate && pageProfile !== undefined) {
|
|
725
|
+
domicile.browser.open(url, { profile: pageProfile.profile.id });
|
|
726
|
+
} else if (isPrivate) {
|
|
727
|
+
domicile.browser.openPrivate(url);
|
|
728
|
+
} else {
|
|
729
|
+
domicile.browser.open(url);
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
|
|
548
733
|
const drive = (command: (view: HTMLWebViewElement) => void) => () => {
|
|
549
734
|
withView(command);
|
|
550
735
|
};
|
|
@@ -592,7 +777,10 @@ export const BrowserWindow = ({
|
|
|
592
777
|
!fullscreen && bottomCornerStyles,
|
|
593
778
|
noTopEdgeStyles,
|
|
594
779
|
movingStyles({ contents: true, motion }),
|
|
595
|
-
|
|
780
|
+
// An Electron app's window that ignores the mouse lets it through to
|
|
781
|
+
// what is under it (`setIgnoreMouseEvents`).
|
|
782
|
+
(clickThrough || leaving || looks.ignoresPointer) && clickThroughStyles,
|
|
783
|
+
urgentStyles,
|
|
596
784
|
// The page's box takes its new size at once; `useSettling` eases it.
|
|
597
785
|
// Colors still ease; see `settlingStyles`.
|
|
598
786
|
settlingStyles({ lowered }),
|
|
@@ -600,13 +788,15 @@ export const BrowserWindow = ({
|
|
|
600
788
|
)}
|
|
601
789
|
// Exposes the motion on the element for tests and debugging.
|
|
602
790
|
data-motion={motion}
|
|
791
|
+
// An Electron app asks for the user's attention (`flashFrame`).
|
|
792
|
+
data-urgent={looks.urgent ? "" : undefined}
|
|
603
793
|
hidden={rect === undefined}
|
|
604
794
|
// A leaving window is unreachable by keyboard.
|
|
605
795
|
inert={leaving}
|
|
606
796
|
// Ignores animations bubbling up from descendants, such as the page
|
|
607
|
-
// notices.
|
|
797
|
+
// notices, and the end of a motion this one replaced.
|
|
608
798
|
onAnimationEnd={(event) => {
|
|
609
|
-
if (event
|
|
799
|
+
if (endsOwnAnimation(event)) {
|
|
610
800
|
onMotionEnded();
|
|
611
801
|
}
|
|
612
802
|
}}
|
|
@@ -629,7 +819,8 @@ export const BrowserWindow = ({
|
|
|
629
819
|
? undefined
|
|
630
820
|
: {
|
|
631
821
|
...placedAt(rect, depth),
|
|
632
|
-
...
|
|
822
|
+
...clippedAlong(sliding, rect),
|
|
823
|
+
...contentsScaledAbout(motion, frame, tab, rect),
|
|
633
824
|
...shuffledBy(restack),
|
|
634
825
|
}
|
|
635
826
|
}
|
|
@@ -649,6 +840,8 @@ export const BrowserWindow = ({
|
|
|
649
840
|
address={address}
|
|
650
841
|
canGoBack={canGoBack}
|
|
651
842
|
canGoForward={canGoForward}
|
|
843
|
+
// Cheap, so read each render rather than memoized with the view.
|
|
844
|
+
history={view === null ? undefined : pageHistoryFor(view)}
|
|
652
845
|
holdZoom={zoomShown}
|
|
653
846
|
isPrivate={isPrivate}
|
|
654
847
|
loading={loading}
|
|
@@ -675,6 +868,9 @@ export const BrowserWindow = ({
|
|
|
675
868
|
loaded.setSitePermission(permission, setting);
|
|
676
869
|
});
|
|
677
870
|
}}
|
|
871
|
+
onShowAllHistory={() => {
|
|
872
|
+
domicile.processes.launch(["domicile-history"]);
|
|
873
|
+
}}
|
|
678
874
|
onStop={drive((loaded) => {
|
|
679
875
|
loaded.stop();
|
|
680
876
|
})}
|
|
@@ -688,12 +884,60 @@ export const BrowserWindow = ({
|
|
|
688
884
|
run(BrowserCommand.ZoomReset);
|
|
689
885
|
}}
|
|
690
886
|
permissionRequest={permissionRequest}
|
|
887
|
+
profile={
|
|
888
|
+
pageProfile === undefined
|
|
889
|
+
? undefined
|
|
890
|
+
: {
|
|
891
|
+
...pageProfile,
|
|
892
|
+
extensions: profileExtensions,
|
|
893
|
+
onMove: (id) => {
|
|
894
|
+
domicile.browser.reopen(window, id);
|
|
895
|
+
},
|
|
896
|
+
onOpenInNew: (id) => {
|
|
897
|
+
domicile.browser.open(address, { profile: id });
|
|
898
|
+
},
|
|
899
|
+
onPin: (id) => {
|
|
900
|
+
if (pinned !== undefined) {
|
|
901
|
+
domicile.browser
|
|
902
|
+
.pin(pinned.site, id)
|
|
903
|
+
.catch((error: unknown) => {
|
|
904
|
+
// biome-ignore lint/suspicious/noConsole: the menu offers no pin the engine refuses, so one is a list a change behind
|
|
905
|
+
console.error(
|
|
906
|
+
`Couldn't pin ${pinned.site} to profile ${id}`,
|
|
907
|
+
error,
|
|
908
|
+
);
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
},
|
|
912
|
+
onSwitchExtension: (id, on) => {
|
|
913
|
+
const { profile } = pageProfile;
|
|
914
|
+
domicile.browser
|
|
915
|
+
.setExtensionEnabled(profile.id, id, on)
|
|
916
|
+
.catch((error: unknown) => {
|
|
917
|
+
// biome-ignore lint/suspicious/noConsole: the menu offers no switch the engine refuses, so one is a list a change behind
|
|
918
|
+
console.error(
|
|
919
|
+
`Couldn't switch ${id} ${on ? "on" : "off"} in profile ${profile.id}`,
|
|
920
|
+
error,
|
|
921
|
+
);
|
|
922
|
+
});
|
|
923
|
+
},
|
|
924
|
+
pinned,
|
|
925
|
+
}
|
|
926
|
+
}
|
|
691
927
|
security={shown.security}
|
|
692
928
|
sitePermissions={sitePermissions}
|
|
693
929
|
visited={shown.visited}
|
|
694
930
|
zoom={zoom}
|
|
695
931
|
/>
|
|
696
932
|
)}
|
|
933
|
+
{shownMenuBar !== undefined && (
|
|
934
|
+
<AppMenuBar
|
|
935
|
+
entries={shownMenuBar.entries}
|
|
936
|
+
onChoose={chooseMenuEntry}
|
|
937
|
+
onOpen={openedMenu}
|
|
938
|
+
open={openMenu}
|
|
939
|
+
/>
|
|
940
|
+
)}
|
|
697
941
|
{isApp && !pageFullscreen && leftOrigin(start, address) && (
|
|
698
942
|
<AppAddress address={address} security={shown.security} />
|
|
699
943
|
)}
|
|
@@ -701,18 +945,73 @@ export const BrowserWindow = ({
|
|
|
701
945
|
Wraps the page so the find bar and file picker cover the page but not
|
|
702
946
|
the address bar.
|
|
703
947
|
*/}
|
|
704
|
-
<div
|
|
948
|
+
<div
|
|
949
|
+
className={pageStyles}
|
|
950
|
+
ref={setPage}
|
|
951
|
+
// Inline because an Electron app's shape (`setShape`) is a runtime
|
|
952
|
+
// value Panda cannot extract. The page draws and takes input only
|
|
953
|
+
// within it.
|
|
954
|
+
style={
|
|
955
|
+
looks.clipPath === undefined
|
|
956
|
+
? undefined
|
|
957
|
+
: { clipPath: looks.clipPath }
|
|
958
|
+
}
|
|
959
|
+
>
|
|
705
960
|
<webview
|
|
706
961
|
className={viewStyles}
|
|
707
962
|
ref={setView}
|
|
708
963
|
// Also while the window settles, so the engine neither holds the
|
|
709
|
-
// shell for the page nor stretches its old frame
|
|
710
|
-
|
|
964
|
+
// shell for the page nor stretches its old frame, and while it
|
|
965
|
+
// slides in, so the slide does not wait for the page to draw
|
|
966
|
+
// again.
|
|
967
|
+
resizing={
|
|
968
|
+
resizing || settlingFrom !== undefined || isSlidingIn(motion)
|
|
969
|
+
? ""
|
|
970
|
+
: undefined
|
|
971
|
+
}
|
|
711
972
|
// React sets attributes before insertion, when the engine reads it.
|
|
712
973
|
// See `window`.
|
|
713
974
|
window={window}
|
|
714
975
|
/>
|
|
976
|
+
<PageViews
|
|
977
|
+
domicile={domicile}
|
|
978
|
+
onReach={onReach}
|
|
979
|
+
unclickable={unclickable}
|
|
980
|
+
window={window}
|
|
981
|
+
/>
|
|
982
|
+
{problem !== undefined && (
|
|
983
|
+
<PageProblem
|
|
984
|
+
canGoBack={canGoBack}
|
|
985
|
+
// A new page per problem, so Details starts closed.
|
|
986
|
+
key={problem.kind === "gone" ? problem.reason : problem.url}
|
|
987
|
+
onGoBack={drive((loaded) => {
|
|
988
|
+
loaded.goBack();
|
|
989
|
+
})}
|
|
990
|
+
onProceed={drive((loaded) => {
|
|
991
|
+
loaded.proceedPastWarning();
|
|
992
|
+
})}
|
|
993
|
+
onReload={drive((loaded) => {
|
|
994
|
+
loaded.reload();
|
|
995
|
+
})}
|
|
996
|
+
problem={problem}
|
|
997
|
+
ref={setProblemBox}
|
|
998
|
+
/>
|
|
999
|
+
)}
|
|
1000
|
+
{pagePicker !== undefined && (
|
|
1001
|
+
<PickerAsk
|
|
1002
|
+
// A new picker per request, so each starts at the page's value.
|
|
1003
|
+
key={[
|
|
1004
|
+
pagePicker.kind,
|
|
1005
|
+
pagePicker.value,
|
|
1006
|
+
pagePicker.anchor.x,
|
|
1007
|
+
pagePicker.anchor.y,
|
|
1008
|
+
].join("\n")}
|
|
1009
|
+
ref={setPagePickerBox}
|
|
1010
|
+
request={pagePicker}
|
|
1011
|
+
/>
|
|
1012
|
+
)}
|
|
715
1013
|
<LinkTarget view={view} />
|
|
1014
|
+
<PageTooltip view={view} />
|
|
716
1015
|
<PagePopup
|
|
717
1016
|
closesAfter={ZOOM_POPUP_MS}
|
|
718
1017
|
cue={popupCue}
|
|
@@ -753,21 +1052,23 @@ export const BrowserWindow = ({
|
|
|
753
1052
|
canGoForward,
|
|
754
1053
|
zoom,
|
|
755
1054
|
})}
|
|
756
|
-
onChoose={(
|
|
757
|
-
choosePageCommand(
|
|
1055
|
+
onChoose={(item) => {
|
|
1056
|
+
choosePageCommand(item, menu.context, {
|
|
758
1057
|
browse: run,
|
|
759
|
-
openWindow
|
|
760
|
-
if (isPrivate) {
|
|
761
|
-
domicile.browser.openPrivate(url);
|
|
762
|
-
} else {
|
|
763
|
-
domicile.browser.open(url);
|
|
764
|
-
}
|
|
765
|
-
},
|
|
1058
|
+
openWindow,
|
|
766
1059
|
});
|
|
767
1060
|
}}
|
|
768
1061
|
onClose={dismissMenu}
|
|
769
1062
|
/>
|
|
770
1063
|
)}
|
|
1064
|
+
{appPopup !== undefined && view !== null && (
|
|
1065
|
+
<AppPopupMenu
|
|
1066
|
+
at={pagePoint(view, appPopup.popup.at)}
|
|
1067
|
+
entries={appPopup.popup.entries}
|
|
1068
|
+
key={appPopup.key}
|
|
1069
|
+
onAnswer={appPopup.answer}
|
|
1070
|
+
/>
|
|
1071
|
+
)}
|
|
771
1072
|
{deviceRequest !== undefined && (
|
|
772
1073
|
<div className={deviceAskStyles}>
|
|
773
1074
|
<DeviceAsk request={deviceRequest} />
|
|
@@ -776,6 +1077,54 @@ export const BrowserWindow = ({
|
|
|
776
1077
|
{dialogRequest !== undefined && (
|
|
777
1078
|
<PageDialog ref={setDialogBox} request={dialogRequest} />
|
|
778
1079
|
)}
|
|
1080
|
+
{dialogRequest === undefined && signIn !== undefined && (
|
|
1081
|
+
<SignInAsk ref={setSignInBox} request={signIn} />
|
|
1082
|
+
)}
|
|
1083
|
+
{dialogRequest === undefined &&
|
|
1084
|
+
signIn === undefined &&
|
|
1085
|
+
prompt !== undefined && (
|
|
1086
|
+
<PromptAsk
|
|
1087
|
+
// A new answer per prompt, so each starts unanswered.
|
|
1088
|
+
key={[prompt.kind, prompt.subject, ...prompt.details].join(
|
|
1089
|
+
"\n",
|
|
1090
|
+
)}
|
|
1091
|
+
ref={setPromptBox}
|
|
1092
|
+
request={prompt}
|
|
1093
|
+
/>
|
|
1094
|
+
)}
|
|
1095
|
+
{dialogRequest === undefined &&
|
|
1096
|
+
signIn === undefined &&
|
|
1097
|
+
prompt === undefined &&
|
|
1098
|
+
identity !== undefined && (
|
|
1099
|
+
<IdentityAsk
|
|
1100
|
+
// A new card per step, so each starts unanswered.
|
|
1101
|
+
key={identity.step}
|
|
1102
|
+
onOpenLink={openWindow}
|
|
1103
|
+
ref={setIdentityBox}
|
|
1104
|
+
request={identity}
|
|
1105
|
+
/>
|
|
1106
|
+
)}
|
|
1107
|
+
{dialogRequest === undefined &&
|
|
1108
|
+
signIn === undefined &&
|
|
1109
|
+
prompt === undefined &&
|
|
1110
|
+
externalApp !== undefined &&
|
|
1111
|
+
linkOpener !== undefined && (
|
|
1112
|
+
<ExternalAppAsk
|
|
1113
|
+
app={linkOpener}
|
|
1114
|
+
ref={setAppAskBox}
|
|
1115
|
+
request={externalApp}
|
|
1116
|
+
/>
|
|
1117
|
+
)}
|
|
1118
|
+
{appBox !== undefined && (
|
|
1119
|
+
<AppMessageBox
|
|
1120
|
+
box={appBox.box}
|
|
1121
|
+
// A new box per box the app asks, so each starts with its
|
|
1122
|
+
// own checkbox.
|
|
1123
|
+
key={appBox.key}
|
|
1124
|
+
onAnswer={appBox.answer}
|
|
1125
|
+
ref={setAppBoxButton}
|
|
1126
|
+
/>
|
|
1127
|
+
)}
|
|
779
1128
|
{asking !== undefined && (
|
|
780
1129
|
<FilePicker
|
|
781
1130
|
// A new picker per request, so each starts empty.
|
|
@@ -872,6 +1221,11 @@ const viewStyles = css({
|
|
|
872
1221
|
minInlineSize: 0,
|
|
873
1222
|
});
|
|
874
1223
|
|
|
1224
|
+
// An Electron app's window asking for the user's attention, as sway draws an
|
|
1225
|
+
// urgent window's border. An attribute selector, so it outranks the edge's
|
|
1226
|
+
// own color.
|
|
1227
|
+
const urgentStyles = css({ "&[data-urgent]": { borderColor: "warning" } });
|
|
1228
|
+
|
|
875
1229
|
// The title bar draws the top edge.
|
|
876
1230
|
const noTopEdgeStyles = css({ borderBlockStartWidth: 0 });
|
|
877
1231
|
|
|
@@ -884,3 +1238,9 @@ const noTopEdgeStyles = css({ borderBlockStartWidth: 0 });
|
|
|
884
1238
|
*/
|
|
885
1239
|
const addressOf = (shown: string, sent: string): string =>
|
|
886
1240
|
shown === "" ? sent : shown;
|
|
1241
|
+
|
|
1242
|
+
/** A point in `view`'s page, in the viewport's CSS pixels. */
|
|
1243
|
+
const pagePoint = (view: HTMLElement, at: { x: number; y: number }) => {
|
|
1244
|
+
const box = view.getBoundingClientRect();
|
|
1245
|
+
return { x: box.left + at.x, y: box.top + at.y };
|
|
1246
|
+
};
|