@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.
Files changed (114) hide show
  1. package/package.json +29 -19
  2. package/src/AppPopup.tsx +22 -10
  3. package/src/AppWindow.tsx +146 -68
  4. package/src/BrowserWindow.tsx +393 -33
  5. package/src/FocusGlow.tsx +5 -1
  6. package/src/GroupTitleBar.tsx +80 -0
  7. package/src/GroupWell.tsx +5 -1
  8. package/src/SelectionTint.tsx +5 -1
  9. package/src/Stage.tsx +381 -106
  10. package/src/StripEnd.tsx +1 -1
  11. package/src/TabStrip.tsx +16 -1
  12. package/src/TitleBar.tsx +277 -124
  13. package/src/WindowFrame.tsx +106 -26
  14. package/src/WindowTitleBar.tsx +11 -2
  15. package/src/browser/AddressBar.tsx +46 -37
  16. package/src/browser/AppMenuBar.tsx +106 -0
  17. package/src/browser/AppPopupMenu.tsx +45 -0
  18. package/src/browser/ConnectionIndicator.tsx +2 -2
  19. package/src/browser/HistoryButton.tsx +150 -0
  20. package/src/browser/PageMenu.tsx +20 -6
  21. package/src/browser/PageProblem.tsx +280 -0
  22. package/src/browser/PageTooltip.tsx +76 -0
  23. package/src/browser/PageViews.tsx +101 -0
  24. package/src/browser/ProfileMenu.tsx +332 -0
  25. package/src/browser/app-window-shape.ts +33 -0
  26. package/src/browser/page-history.ts +54 -0
  27. package/src/browser/page-menu.ts +85 -9
  28. package/src/browser/profile-ink.ts +17 -0
  29. package/src/browser/useAppMenuBar.ts +51 -0
  30. package/src/browser/useAppMessageBox.ts +47 -0
  31. package/src/browser/useAppPopupMenu.ts +49 -0
  32. package/src/browser/useAppWindowLooks.ts +49 -0
  33. package/src/browser/useAppWindowState.ts +59 -0
  34. package/src/browser/useBrowserProfile.ts +230 -0
  35. package/src/browser/useLongPress.ts +66 -0
  36. package/src/captured-element.ts +18 -0
  37. package/src/closing.ts +33 -15
  38. package/src/crossing.ts +64 -0
  39. package/src/floating/FloatGrab.tsx +10 -0
  40. package/src/floating/FloatShadow.tsx +5 -1
  41. package/src/floating/useFloatBorderDrag.ts +17 -59
  42. package/src/floating/useFloatDrag.ts +3 -2
  43. package/src/follow-press.ts +55 -0
  44. package/src/handed-drag.ts +57 -0
  45. package/src/keyboard/command.ts +160 -9
  46. package/src/keyboard/commands.ts +62 -6
  47. package/src/keyboard/query.ts +94 -0
  48. package/src/keyboard/useKeybindings.ts +69 -13
  49. package/src/overview/OverviewBackdrop.tsx +246 -0
  50. package/src/overview/OverviewPicker.tsx +453 -0
  51. package/src/overview/fixture.ts +76 -0
  52. package/src/overview/overview.ts +112 -0
  53. package/src/overview/seen-styles.ts +132 -0
  54. package/src/overview/sight.ts +86 -0
  55. package/src/overview/steering.ts +85 -0
  56. package/src/overview/tiles.ts +209 -0
  57. package/src/overview/useOverviewPhase.ts +35 -0
  58. package/src/own-animation.ts +24 -0
  59. package/src/panda-preset.ts +91 -3
  60. package/src/picture-in-picture/PictureInPictureFloats.tsx +865 -0
  61. package/src/picture-in-picture/page-of.ts +25 -0
  62. package/src/picture-in-picture/pip-box.ts +156 -0
  63. package/src/picture-in-picture/playhead.ts +33 -0
  64. package/src/placement.ts +20 -11
  65. package/src/pointer-confinement.ts +107 -0
  66. package/src/pointer-lock.ts +113 -0
  67. package/src/popup.ts +25 -37
  68. package/src/recorded-settles.ts +6 -2
  69. package/src/restacking.ts +4 -3
  70. package/src/screens/popup-scene.ts +38 -0
  71. package/src/screens/reading-order.ts +29 -0
  72. package/src/shown.ts +10 -0
  73. package/src/sliding-screen.ts +12 -0
  74. package/src/tab-drop.ts +43 -0
  75. package/src/tab-switch.ts +5 -1
  76. package/src/tiled/TileGrab.tsx +11 -1
  77. package/src/tiled/aim.ts +77 -39
  78. package/src/tiled/borders.ts +10 -2
  79. package/src/tiled/tab-targets.ts +37 -0
  80. package/src/tiled/useBorderDrag.ts +18 -42
  81. package/src/tiled/useTileDrag.ts +8 -7
  82. package/src/tree/drop.ts +118 -23
  83. package/src/tree/frames.ts +2 -2
  84. package/src/tree/layout.ts +71 -11
  85. package/src/tree/move.ts +8 -27
  86. package/src/useHandedPress.ts +25 -0
  87. package/src/usePageProblem.ts +80 -0
  88. package/src/usePageTooltip.ts +48 -0
  89. package/src/usePointerConfinement.ts +103 -0
  90. package/src/usePointerLock.ts +12 -0
  91. package/src/useSettling.ts +38 -9
  92. package/src/useTabDrop.ts +65 -0
  93. package/src/useWindowMotion.ts +109 -10
  94. package/src/useWindows.ts +112 -19
  95. package/src/window-changes.ts +13 -3
  96. package/src/window-log.ts +106 -0
  97. package/src/window-motion.ts +34 -0
  98. package/src/window-state.ts +629 -66
  99. package/src/window-styles.ts +96 -4
  100. package/src/window.ts +14 -0
  101. package/src/workspace.ts +11 -5
  102. package/src/workspaces-context.ts +6 -1
  103. package/styled-system/patterns/aspect-ratio.mjs +2 -2
  104. package/styled-system/patterns/bleed.mjs +1 -2
  105. package/styled-system/patterns/float.mjs +5 -11
  106. package/styled-system/patterns/grid-item.mjs +1 -2
  107. package/styled-system/patterns/grid.mjs +1 -2
  108. package/styled-system/patterns/link-overlay.mjs +1 -1
  109. package/styled-system/patterns/spacer.mjs +3 -3
  110. package/styled-system/patterns/visually-hidden.mjs +1 -1
  111. package/styled-system/styles.css +2885 -2108
  112. package/styled-system/tokens/index.mjs +7 -3
  113. package/styled-system/tokens/tokens.d.ts +2 -2
  114. package/styled-system/types/prop-type.d.ts +2 -2
package/package.json CHANGED
@@ -1,34 +1,33 @@
1
1
  {
2
2
  "dependencies": {
3
3
  "@cprussin/option-result": "^2.0.1",
4
- "@domicile-desktop/component-library": "2.0.1",
5
- "@domicile-desktop/manganese-address": "1.0.2",
6
- "@domicile-desktop/manganese-bar": "1.1.1",
7
- "@domicile-desktop/manganese-host": "2.0.1",
8
- "@domicile-desktop/manganese-page-requests": "1.1.1",
9
- "@domicile-desktop/sdk": "2.1.0",
10
- "@domicile-desktop/system-apps": "1.1.1",
11
- "@pandacss/dev": "^1.12.1",
4
+ "@domicile-desktop/component-library": "2.2.0",
5
+ "@domicile-desktop/manganese-address": "1.1.0",
6
+ "@domicile-desktop/manganese-bar": "1.1.3",
7
+ "@domicile-desktop/manganese-host": "2.0.3",
8
+ "@domicile-desktop/manganese-page-requests": "1.3.0",
9
+ "@domicile-desktop/sdk": "3.0.0",
10
+ "@domicile-desktop/system-apps": "1.3.0",
11
+ "@pandacss/dev": "^1.12.2",
12
12
  "@phosphor-icons/react": "^2.1.10",
13
- "react": "^19.2.8",
14
- "zod": "^4.5.4"
13
+ "react": "^19.3.1",
14
+ "zod": "^4.6.7"
15
15
  },
16
16
  "description": "Manganese's window management: sway's layout tree, tiling, floating, workspaces, keybindings and the windows' chrome.",
17
17
  "devDependencies": {
18
18
  "@cprussin/tsconfig": "^5.0.0",
19
19
  "@domicile-desktop/test-support": "0.0.2",
20
- "@pandacss/preset-panda": "^1.12.1",
20
+ "@pandacss/preset-panda": "^1.12.2",
21
21
  "@testing-library/react": "^16.3.3",
22
- "@testing-library/user-event": "^14.6.7",
23
- "@types/bun": "^1.4.2",
24
- "@types/react": "^19.2.18",
25
- "@types/react-dom": "^19.2.7",
26
- "postcss": "^8.5.28",
22
+ "@testing-library/user-event": "^14.6.10",
23
+ "@types/bun": "^1.4.4",
24
+ "@types/react": "^19.3.0",
25
+ "@types/react-dom": "^19.3.0",
26
+ "postcss": "^8.5.32",
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",
@@ -37,15 +36,25 @@
37
36
  "./grab-cursor-styles": "./src/grab-cursor-styles.ts",
38
37
  "./keyboard/commands": "./src/keyboard/commands.ts",
39
38
  "./keyboard/media-key": "./src/keyboard/media-key.ts",
39
+ "./keyboard/query": "./src/keyboard/query.ts",
40
40
  "./keyboard/useKeybindings": "./src/keyboard/useKeybindings.ts",
41
41
  "./keyboard/useModifiers": "./src/keyboard/useModifiers.ts",
42
+ "./overview/OverviewBackdrop": "./src/overview/OverviewBackdrop.tsx",
43
+ "./overview/OverviewPicker": "./src/overview/OverviewPicker.tsx",
44
+ "./overview/overview": "./src/overview/overview.ts",
45
+ "./overview/sight": "./src/overview/sight.ts",
46
+ "./overview/steering": "./src/overview/steering.ts",
47
+ "./overview/useOverviewPhase": "./src/overview/useOverviewPhase.ts",
42
48
  "./panda-preset": "./src/panda-preset.ts",
49
+ "./picture-in-picture/PictureInPictureFloats": "./src/picture-in-picture/PictureInPictureFloats.tsx",
50
+ "./picture-in-picture/page-of": "./src/picture-in-picture/page-of.ts",
43
51
  "./placement": "./src/placement.ts",
44
52
  "./pointer-warp": "./src/pointer-warp.ts",
45
53
  "./rect": "./src/rect.ts",
46
54
  "./Stage": "./src/Stage.tsx",
47
55
  "./screens/fixture": "./src/screens/fixture.tsx",
48
56
  "./screens/host-displays": "./src/screens/host-displays.ts",
57
+ "./screens/popup-scene": "./src/screens/popup-scene.ts",
49
58
  "./screens/shown-windows": "./src/screens/shown-windows.ts",
50
59
  "./screens/stage-screens": "./src/screens/stage-screens.ts",
51
60
  "./screens/useScreenFollowsPointer": "./src/screens/useScreenFollowsPointer.ts",
@@ -55,6 +64,7 @@
55
64
  "./tree/path": "./src/tree/path.ts",
56
65
  "./useClientIcons": "./src/useClientIcons.ts",
57
66
  "./useGrabCursor": "./src/useGrabCursor.ts",
67
+ "./usePointerLock": "./src/usePointerLock.ts",
58
68
  "./usePointerWarp": "./src/usePointerWarp.ts",
59
69
  "./useWindows": "./src/useWindows.ts",
60
70
  "./window": "./src/window.ts",
@@ -85,5 +95,5 @@
85
95
  "test:unit": "bun test"
86
96
  },
87
97
  "type": "module",
88
- "version": "1.2.0"
98
+ "version": "2.0.0"
89
99
  }
package/src/AppPopup.tsx CHANGED
@@ -1,20 +1,32 @@
1
1
  /// <reference types="@domicile-desktop/manganese-host/domicile-elements" />
2
2
 
3
- import type { PlacedPopup } from "./popup";
4
- import { placedAt } from "./window-styles";
3
+ import type { WindowPopup } from "./popup";
5
4
 
6
5
  type Props = {
7
- popup: PlacedPopup;
6
+ popup: WindowPopup;
8
7
  };
9
8
 
10
9
  /**
11
- * A client's popup (menu, tooltip) drawn over its window as a bare `<app>`
12
- * with no frame.
10
+ * A client's popup (menu, tooltip, or a subsurface such as the one Firefox
11
+ * draws its whole window into) as a bare `<app>` with no frame, placed on its
12
+ * window's contents. `AppWindow` draws it, so it plays the window's motion.
13
13
  *
14
- * A press on it focuses the parent window. It is a sibling of the window
15
- * because `<app>` has no children, so it does not follow the window's motion.
16
- * That is fine because a menu is open only while its window is at rest.
14
+ * A press on it focuses the parent window. It shows the cursor its client
15
+ * asks for over it.
17
16
  */
18
- export const AppPopup = ({ popup: { appId, depth, frame, rect } }: Props) => (
19
- <app app-id={appId} frame={String(frame)} style={placedAt(rect, depth)} />
17
+ export const AppPopup = ({ popup: { appId, cursor, frame, rect } }: Props) => (
18
+ <app
19
+ app-id={appId}
20
+ frame={String(frame)}
21
+ // Inline because the box and cursor are runtime values that Panda cannot
22
+ // extract at build time.
23
+ style={{
24
+ blockSize: `${rect.height.toString()}px`,
25
+ cursor,
26
+ inlineSize: `${rect.width.toString()}px`,
27
+ insetBlockStart: `${rect.y.toString()}px`,
28
+ insetInlineStart: `${rect.x.toString()}px`,
29
+ position: "absolute",
30
+ }}
31
+ />
20
32
  );
package/src/AppWindow.tsx CHANGED
@@ -5,31 +5,37 @@ import {
5
5
  APP_FOCUS_RELEASE_REQUESTED_EVENT,
6
6
  APP_FOCUS_REQUESTED_EVENT,
7
7
  } from "@domicile-desktop/sdk/app-element";
8
- import type { CursorShape } from "@domicile-desktop/sdk/cursor-shape";
9
8
  import type { Domicile } from "@domicile-desktop/sdk/desktop/desktop";
10
9
  import { SystemErrorKind } from "@domicile-desktop/sdk/system";
11
10
  import { WindowState } from "@domicile-desktop/sdk/window-state";
12
- import { useEffect, useRef, useState } from "react";
11
+ import { useContext, useEffect, useRef, useState } from "react";
13
12
 
14
13
  import { css, cx } from "../styled-system/css";
14
+ import { AppPopup } from "./AppPopup";
15
+ import { endsOwnAnimation } from "./own-animation";
16
+ import { CROSSING, raised } from "./placement";
17
+ import type { WindowPopup } from "./popup";
15
18
  import type { Rect } from "./rect";
16
19
  import type { Restack } from "./restacking";
20
+ import { SlidingScreen } from "./sliding-screen";
17
21
  import { useLowered } from "./useLowered";
22
+ import { usePointerConfinement } from "./usePointerConfinement";
18
23
  import type { Settler } from "./useSettling";
19
24
  import { UPRIGHT, useSettling } from "./useSettling";
20
25
  import { appWindowId } from "./window";
21
26
  import type { WindowMotion } from "./window-motion";
22
- import { isLeaving, isMoving } from "./window-motion";
27
+ import { isLeaving, isMoving, isSlidingIn } from "./window-motion";
23
28
  import {
24
29
  bottomCornerStyles,
25
30
  clickThroughStyles,
31
+ clippedAlong,
32
+ contentsScaledAbout,
26
33
  edgeStyles,
27
34
  heldStyles,
28
35
  keptAt,
29
36
  movingStyles,
30
37
  originOf,
31
38
  placedAt,
32
- scaledAbout,
33
39
  settlingStyles,
34
40
  shuffledBy,
35
41
  windowStyles,
@@ -72,9 +78,15 @@ type Props = {
72
78
  /** The host's id for this window's client. */
73
79
  appId: string;
74
80
  /**
75
- * The cursor the client requested. `undefined` uses the page's cursor.
81
+ * The CSS cursor the client requested: a shape's keyword, or an image it
82
+ * drew. `undefined` uses the page's cursor.
76
83
  */
77
- cursor: CursorShape | undefined;
84
+ cursor: string | undefined;
85
+ /**
86
+ * Whether it just moved to another tab group, so it eases there over the
87
+ * strips it passes. See `crossing.ts`.
88
+ */
89
+ crossing?: boolean | undefined;
78
90
  /** The window's `z-index`, which the SDK reports to the host. */
79
91
  depth: number;
80
92
  /** Used to request keyboard focus. */
@@ -84,6 +96,11 @@ type Props = {
84
96
  * {@link scaledAbout}). `undefined` when {@link Props.rect} is.
85
97
  */
86
98
  frame: Rect | undefined;
99
+ /**
100
+ * Its tab in the strip, which its contents grow out of as it opens and
101
+ * shrink into as it closes (see {@link contentsScaledAbout}).
102
+ */
103
+ tab?: Rect | undefined;
87
104
  /** Whether the shell considers this window focused. */
88
105
  focused: boolean;
89
106
  /** Whether this window is fullscreen, which removes its edge and corners. */
@@ -107,6 +124,8 @@ type Props = {
107
124
  * removed. Uses the animation event so the duration lives only in CSS.
108
125
  */
109
126
  onMotionEnded: () => void;
127
+ /** Its client's popups, drawn over it. See `AppPopup`. */
128
+ popups: readonly WindowPopup[];
110
129
  /**
111
130
  * The contents' box, or `undefined` when off screen (another workspace, or
112
131
  * behind a tab).
@@ -145,6 +164,7 @@ export const AppWindow = ({
145
164
  behindPanel,
146
165
  clickThrough,
147
166
  cursor,
167
+ crossing = false,
148
168
  depth,
149
169
  domicile,
150
170
  dragging,
@@ -155,11 +175,13 @@ export const AppWindow = ({
155
175
  hasKeyboard,
156
176
  motion,
157
177
  onMotionEnded,
178
+ popups,
158
179
  rect,
159
180
  resizing,
160
181
  restack,
161
182
  settler,
162
183
  syncedFrame,
184
+ tab,
163
185
  }: Props) => {
164
186
  // A closed window that is still animating out.
165
187
  const leaving = isLeaving(motion);
@@ -169,19 +191,23 @@ export const AppWindow = ({
169
191
  // its layout effect reads it.
170
192
  const box = useRef<HTMLDivElement>(null);
171
193
  const lowered = useLowered(depth);
194
+ const sliding = useContext(SlidingScreen);
172
195
  // The box the window eases from, while it settles.
173
196
  const [settlingFrom, setSettlingFrom] = useState<Rect | undefined>(undefined);
174
- useSettling({
175
- element: box,
176
- onSettling: setSettlingFrom,
197
+ // Its popups, which ease along with it.
198
+ const layer = useRef<HTMLDivElement>(null);
199
+ const settling = {
177
200
  origin:
178
201
  rect === undefined || frame === undefined
179
202
  ? undefined
180
203
  : originOf(frame, rect),
204
+ over: crossing ? CROSSING : undefined,
181
205
  rect,
182
206
  settler,
183
207
  still: dragging || isMoving(motion),
184
- });
208
+ };
209
+ useSettling({ ...settling, element: box, onSettling: setSettlingFrom });
210
+ useSettling({ ...settling, element: layer });
185
211
 
186
212
  // Keeps the compositor's keyboard focus in line with the shell's.
187
213
  //
@@ -215,6 +241,15 @@ export const AppWindow = ({
215
241
  domicile.windows.setBounds(appId, { height, width, x, y });
216
242
  }, [appId, domicile, height, width, x, y]);
217
243
 
244
+ // Holds the pointer in the window for a game or VM viewer that asked, while
245
+ // it has the keyboard.
246
+ usePointerConfinement(
247
+ domicile,
248
+ appId,
249
+ rect,
250
+ hasKeyboard && !behindPanel && !leaving,
251
+ );
252
+
218
253
  // Tells the client how it is laid out, so a tiled window draws no shadow,
219
254
  // rounded corners or resize border of its own. Floats get none, as in sway.
220
255
  const { windows } = domicile;
@@ -284,66 +319,109 @@ export const AppWindow = ({
284
319
  }
285
320
  }, [appId, element]);
286
321
 
322
+ // The box's motion and shuffle, which its popups play too.
323
+ const moved =
324
+ rect === undefined || frame === undefined
325
+ ? undefined
326
+ : {
327
+ ...contentsScaledAbout(motion, frame, tab, rect),
328
+ ...shuffledBy(restack),
329
+ };
287
330
  return (
288
- // The box places the window, plays its motions and eases it into a new
289
- // box, clipping the `<app>` to where it is drawn. The `<app>` keeps its
290
- // own size, so a client drawn at its new size is cropped rather than
291
- // stretched while the box gets there.
292
- <div
293
- className={cx(
294
- windowStyles,
295
- boxStyles,
296
- // Neither a line nor rounded corners around the screen's own edge.
297
- !fullscreen && edgeStyles,
298
- !fullscreen && bottomCornerStyles,
299
- movingStyles({ contents: true, motion }),
300
- (clickThrough || leaving) && clickThroughStyles,
301
- // The client's box takes its new size at once; `useSettling` eases
302
- // it. Colors still ease; see `settlingStyles`.
303
- settlingStyles({ lowered }),
304
- dragging && heldStyles,
305
- )}
306
- // Exposes the motion on the element for tests and debugging.
307
- data-motion={motion}
308
- hidden={rect === undefined}
309
- // A leaving window is unreachable by keyboard.
310
- inert={leaving}
311
- // Ignores animations bubbling up from descendants.
312
- onAnimationEnd={(event) => {
313
- if (event.target === event.currentTarget) {
314
- onMotionEnded();
315
- }
316
- }}
317
- ref={box}
318
- // Inline because the box is a runtime value that Panda cannot extract
319
- // at build time.
320
- style={
321
- rect === undefined || frame === undefined
322
- ? undefined
323
- : {
324
- ...placedAt(rect, depth),
325
- ...scaledAbout(frame, rect),
326
- ...shuffledBy(restack),
327
- }
328
- }
329
- >
330
- <app
331
- app-id={appId}
332
- className={appStyles}
333
- frame={String(syncedFrame)}
334
- ref={setElement}
335
- // Also while the box settles, so the engine neither holds the page
336
- // for the client nor stretches its old frame.
337
- resizing={resizing || settlingFrom !== undefined ? "" : undefined}
338
- // Inline because the cursor and size are runtime values that Panda
339
- // cannot extract at build time.
340
- style={{
341
- cursor,
342
- ...(rect === undefined ? {} : keptAt(settlingFrom, rect)),
331
+ <>
332
+ {/*
333
+ The box places the window, plays its motions and eases it into a new
334
+ box, clipping the `<app>` to where it is drawn. The `<app>` keeps its
335
+ own size, so a client drawn at its new size is cropped rather than
336
+ stretched while the box gets there.
337
+ */}
338
+ <div
339
+ className={cx(
340
+ windowStyles,
341
+ boxStyles,
342
+ // Neither a line nor rounded corners around the screen's own edge.
343
+ !fullscreen && edgeStyles,
344
+ !fullscreen && bottomCornerStyles,
345
+ movingStyles({ contents: true, motion }),
346
+ (clickThrough || leaving) && clickThroughStyles,
347
+ // The client's box takes its new size at once; `useSettling` eases
348
+ // it. Colors still ease; see `settlingStyles`.
349
+ settlingStyles({ lowered }),
350
+ dragging && heldStyles,
351
+ )}
352
+ // Exposes the motion on the element for tests and debugging.
353
+ data-motion={motion}
354
+ hidden={rect === undefined}
355
+ // A leaving window is unreachable by keyboard.
356
+ inert={leaving}
357
+ // Ignores animations bubbling up from descendants, and the end of a
358
+ // motion this one replaced.
359
+ onAnimationEnd={(event) => {
360
+ if (endsOwnAnimation(event)) {
361
+ onMotionEnded();
362
+ }
343
363
  }}
344
- {...{ [UPRIGHT]: "" }}
345
- />
346
- </div>
364
+ ref={box}
365
+ // Inline because the box is a runtime value that Panda cannot extract
366
+ // at build time.
367
+ style={
368
+ rect === undefined || frame === undefined
369
+ ? undefined
370
+ : {
371
+ ...placedAt(rect, depth),
372
+ ...clippedAlong(sliding, rect),
373
+ ...moved,
374
+ }
375
+ }
376
+ >
377
+ <app
378
+ app-id={appId}
379
+ className={appStyles}
380
+ frame={String(syncedFrame)}
381
+ ref={setElement}
382
+ // Also while the box settles, so the engine neither holds the page
383
+ // for the client nor stretches its old frame, and while it slides in,
384
+ // so the slide does not wait for the client to draw again.
385
+ resizing={
386
+ resizing || settlingFrom !== undefined || isSlidingIn(motion)
387
+ ? ""
388
+ : undefined
389
+ }
390
+ // Inline because the cursor and size are runtime values that Panda
391
+ // cannot extract at build time.
392
+ style={{
393
+ cursor,
394
+ ...(rect === undefined ? {} : keptAt(settlingFrom, rect)),
395
+ }}
396
+ {...{ [UPRIGHT]: "" }}
397
+ />
398
+ </div>
399
+ {/*
400
+ Its popups, placed, moved and eased as the box is, just over it. Not in
401
+ the box, which would clip a menu reaching past the window.
402
+ */}
403
+ {rect !== undefined && popups.length > 0 && (
404
+ <div
405
+ className={cx(
406
+ movingStyles({ contents: true, motion }),
407
+ (clickThrough || leaving) && clickThroughStyles,
408
+ dragging && heldStyles,
409
+ )}
410
+ data-motion={motion}
411
+ inert={leaving}
412
+ ref={layer}
413
+ style={{
414
+ ...placedAt(rect, raised(depth)),
415
+ ...clippedAlong(sliding, rect),
416
+ ...moved,
417
+ }}
418
+ >
419
+ {popups.map((popup) => (
420
+ <AppPopup key={popup.appId} popup={popup} />
421
+ ))}
422
+ </div>
423
+ )}
424
+ </>
347
425
  );
348
426
  };
349
427