@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.
Files changed (66) hide show
  1. package/package.json +15 -10
  2. package/src/AppWindow.tsx +28 -7
  3. package/src/BrowserWindow.tsx +131 -12
  4. package/src/GroupTitleBar.tsx +80 -0
  5. package/src/Stage.tsx +269 -80
  6. package/src/StripEnd.tsx +1 -1
  7. package/src/TabStrip.tsx +11 -0
  8. package/src/TitleBar.tsx +16 -4
  9. package/src/WindowFrame.tsx +21 -2
  10. package/src/WindowTitleBar.tsx +7 -2
  11. package/src/browser/PageProblem.tsx +280 -0
  12. package/src/browser/PageTooltip.tsx +76 -0
  13. package/src/captured-element.ts +18 -0
  14. package/src/closing.ts +3 -3
  15. package/src/crossing.ts +64 -0
  16. package/src/floating/useFloatBorderDrag.ts +17 -59
  17. package/src/follow-press.ts +55 -0
  18. package/src/keyboard/command.ts +13 -1
  19. package/src/keyboard/commands.ts +45 -4
  20. package/src/keyboard/useKeybindings.ts +28 -2
  21. package/src/overview/OverviewBackdrop.tsx +246 -0
  22. package/src/overview/OverviewPicker.tsx +439 -0
  23. package/src/overview/fixture.ts +76 -0
  24. package/src/overview/overview.ts +112 -0
  25. package/src/overview/seen-styles.ts +115 -0
  26. package/src/overview/sight.ts +82 -0
  27. package/src/overview/steering.ts +85 -0
  28. package/src/overview/tiles.ts +209 -0
  29. package/src/overview/useOverviewPhase.ts +35 -0
  30. package/src/own-animation.ts +24 -0
  31. package/src/panda-preset.ts +20 -3
  32. package/src/placement.ts +20 -11
  33. package/src/recorded-settles.ts +6 -2
  34. package/src/restacking.ts +4 -3
  35. package/src/shown.ts +5 -0
  36. package/src/tab-switch.ts +5 -1
  37. package/src/tiled/TileGrab.tsx +1 -1
  38. package/src/tiled/aim.ts +56 -39
  39. package/src/tiled/borders.ts +10 -2
  40. package/src/tiled/tab-targets.ts +37 -0
  41. package/src/tiled/useBorderDrag.ts +18 -42
  42. package/src/tiled/useTileDrag.ts +5 -5
  43. package/src/tree/drop.ts +64 -9
  44. package/src/tree/frames.ts +2 -2
  45. package/src/tree/layout.ts +31 -2
  46. package/src/tree/move.ts +8 -27
  47. package/src/usePageProblem.ts +80 -0
  48. package/src/usePageTooltip.ts +48 -0
  49. package/src/useSettling.ts +38 -9
  50. package/src/useWindowMotion.ts +66 -4
  51. package/src/useWindows.ts +12 -4
  52. package/src/window-motion.ts +34 -0
  53. package/src/window-state.ts +371 -6
  54. package/src/window-styles.ts +46 -4
  55. package/src/workspace.ts +5 -1
  56. package/src/workspaces-context.ts +6 -1
  57. package/styled-system/patterns/aspect-ratio.mjs +2 -2
  58. package/styled-system/patterns/bleed.mjs +1 -2
  59. package/styled-system/patterns/float.mjs +5 -11
  60. package/styled-system/patterns/grid-item.mjs +1 -2
  61. package/styled-system/patterns/grid.mjs +1 -2
  62. package/styled-system/patterns/link-overlay.mjs +1 -1
  63. package/styled-system/patterns/spacer.mjs +3 -3
  64. package/styled-system/patterns/visually-hidden.mjs +1 -1
  65. package/styled-system/styles.css +2308 -2029
  66. package/styled-system/types/prop-type.d.ts +1 -1
package/src/Stage.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Domicile } from "@domicile-desktop/sdk/desktop/desktop";
2
2
  import type { ReactNode } from "react";
3
3
  import { Fragment, memo, useCallback, useMemo, useState } from "react";
4
+
4
5
  import { AppPopup } from "./AppPopup";
5
6
  import { AppWindow } from "./AppWindow";
6
7
  import { BrowserWindow } from "./BrowserWindow";
@@ -15,8 +16,11 @@ import { floatBordersOf } from "./floating/float-borders";
15
16
  import { castsFloatShadow, floatCovers } from "./floating/float-covers";
16
17
  import { ScratchpadBackdrop } from "./floating/ScratchpadBackdrop";
17
18
  import { GrabbingSheet } from "./GrabbingSheet";
19
+ import { GroupTitleBar } from "./GroupTitleBar";
18
20
  import { GroupWell } from "./GroupWell";
19
21
  import type { Modifiers } from "./keyboard/useModifiers";
22
+ import { seenAt, seenClip, seenStyles } from "./overview/seen-styles";
23
+ import type { OverviewSight, Seen } from "./overview/sight";
20
24
  import type {
21
25
  Geometry,
22
26
  PlacedFocusBox,
@@ -35,12 +39,12 @@ import { SettleHandoffs } from "./SettleHandoffs";
35
39
  import type { StageScreen } from "./screens/stage-screens";
36
40
  import { useShared } from "./screens/useShared";
37
41
  import { TabStrip } from "./TabStrip";
38
- import { TitleBar } from "./TitleBar";
39
42
  import type { Aim, DropTargets, TabTarget, Target } from "./tiled/aim";
40
43
  import { bordersOf } from "./tiled/borders";
41
44
  import { DropIndicator } from "./tiled/DropIndicator";
42
45
  import { TileBorder } from "./tiled/TileBorder";
43
46
  import { TileGrab } from "./tiled/TileGrab";
47
+ import { tabTargetsOf } from "./tiled/tab-targets";
44
48
  import { titleFocus } from "./title-focus";
45
49
  import type { StripPlace } from "./tree/frames";
46
50
  import { tabKeyOf } from "./tree/frames";
@@ -130,6 +134,11 @@ type Props = {
130
134
  * the tiling of the screen `on`.
131
135
  */
132
136
  onStretch: (id: string, edge: Direction, by: number, on: Geometry) => void;
137
+ /**
138
+ * How the overview shows each window, while it is open or closing.
139
+ * `undefined` outside it.
140
+ */
141
+ overview: OverviewSight | undefined;
133
142
  /** Client popups, drawn over their parent windows. */
134
143
  popups: readonly Popup[];
135
144
  /** Every screen and what it shows. */
@@ -182,6 +191,7 @@ export const Stage = memo(
182
191
  onResize,
183
192
  onSelect,
184
193
  onStretch,
194
+ overview,
185
195
  popups,
186
196
  scratchpad,
187
197
  screens,
@@ -192,7 +202,15 @@ export const Stage = memo(
192
202
  screens.map(
193
203
  ({ current, geometry, screenful: { placements, tabs } }) => [
194
204
  geometry.name,
195
- { activeId, current, placements, scratchpad, tabs, windows },
205
+ {
206
+ activeId,
207
+ current,
208
+ overview: overview !== undefined,
209
+ placements,
210
+ scratchpad,
211
+ tabs,
212
+ windows,
213
+ },
196
214
  ],
197
215
  ),
198
216
  ),
@@ -206,6 +224,13 @@ export const Stage = memo(
206
224
  () => new Map(windows.map((window) => [window.id, window])),
207
225
  [windows],
208
226
  );
227
+ // Every window, with a hidden workspace's laid out in its overview tile.
228
+ const drawn = useMemo(
229
+ () => motions.drawn.map((window) => seenIn(window, overview)),
230
+ [motions.drawn, overview],
231
+ );
232
+ // What the overview leaves out: it is for picking, not for working.
233
+ const working = overview === undefined;
209
234
  const lit = focusBoxShowing(screens, activeId);
210
235
  const { glows, onFaded } = useFocusGlows(lit);
211
236
  const active = motions.drawn.find(({ window }) => window.id === activeId);
@@ -216,6 +241,10 @@ export const Stage = memo(
216
241
  // A border drag or a tiled resize grab resizes in place, so unlike a move
217
242
  // it does not fade the window. See `stageStyles`.
218
243
  const [stretching, setStretching] = useState(false);
244
+ // The overview takes the grab's handles away before their drop.
245
+ if (!working && stretching) {
246
+ setStretching(false);
247
+ }
219
248
  // Whether the running move has been pulled, which shows the grabbing
220
249
  // pointer: a click moves nothing, so it shows none. Each grab clears it.
221
250
  const [pulled, setPulled] = useState(false);
@@ -252,18 +281,20 @@ export const Stage = memo(
252
281
  order. See `FloatShadow`. Skipped for fullscreen floats, whose shadow
253
282
  would spill onto the next display.
254
283
  */}
255
- {motions.drawn.map(
256
- ({ motion, placement, restack, rewound, screen, window }) => {
284
+ {drawn.map(
285
+ ({ motion, placement, restack, rewound, screen, seen, window }) => {
257
286
  const float = desk.floats.get(window.id);
258
287
  return placement !== undefined &&
259
288
  !desk.fullscreen.has(window.id) &&
260
289
  float !== undefined ? (
261
290
  <Sliding
291
+ depth={placement.depth}
262
292
  frame={placement.frame}
263
293
  key={window.id}
264
294
  motion={motion}
265
295
  on={screenNamed(desk, screen)}
266
296
  rewound={rewound}
297
+ seen={seen}
267
298
  >
268
299
  <FloatShadow
269
300
  depth={placement.depth}
@@ -284,11 +315,13 @@ export const Stage = memo(
284
315
  {motions.tabs.map(({ motion, restack, screen, tab }) =>
285
316
  tab.well === undefined ? undefined : (
286
317
  <Sliding
318
+ depth={wellDepthOf(tab.depth)}
287
319
  frame={tab.well}
288
320
  key={`well-${tabKeyOf(tab)}`}
289
321
  motion={motion}
290
322
  on={screenNamed(desk, screen)}
291
323
  rewound={0}
324
+ seen={overview?.shown.get(screen)}
292
325
  >
293
326
  <GroupWell
294
327
  // None for fullscreen floats, as for `FloatShadow`.
@@ -311,44 +344,51 @@ export const Stage = memo(
311
344
  its glow. Only the glow fading in follows the focused window's
312
345
  motion.
313
346
  */}
314
- {glows.map(({ box, leaving }) => {
315
- const following = leaving ? undefined : active;
316
- const motion =
317
- following === undefined ? "resting" : barMotion(following.motion);
318
- return (
319
- <Sliding
320
- frame={following?.placement?.frame}
321
- key={keyOf(box)}
322
- motion={motion}
323
- on={screenNamed(desk, following?.screen)}
324
- rewound={following?.rewound ?? 0}
325
- >
326
- <FocusGlow
347
+ {working &&
348
+ glows.map(({ box, leaving }) => {
349
+ const following = leaving ? undefined : active;
350
+ const motion =
351
+ following === undefined
352
+ ? "resting"
353
+ : barMotion(following.motion);
354
+ return (
355
+ <Sliding
327
356
  depth={box.depth}
328
- dragging={
329
- following !== undefined &&
330
- (stretching ||
331
- (activeId !== undefined && held.has(activeId)))
332
- }
333
- leaving={leaving}
357
+ frame={following?.placement?.frame}
358
+ key={keyOf(box)}
334
359
  motion={motion}
335
- onFaded={() => {
336
- onFaded(box);
337
- }}
338
- rect={box.rect}
339
- restack={following?.restack}
340
- windows={box.windows}
341
- />
342
- </Sliding>
343
- );
344
- })}
345
- {motions.drawn.map(
360
+ on={screenNamed(desk, following?.screen)}
361
+ rewound={following?.rewound ?? 0}
362
+ seen={undefined}
363
+ >
364
+ <FocusGlow
365
+ depth={box.depth}
366
+ dragging={
367
+ following !== undefined &&
368
+ (stretching ||
369
+ (activeId !== undefined && held.has(activeId)))
370
+ }
371
+ leaving={leaving}
372
+ motion={motion}
373
+ onFaded={() => {
374
+ onFaded(box);
375
+ }}
376
+ rect={box.rect}
377
+ restack={following?.restack}
378
+ windows={box.windows}
379
+ />
380
+ </Sliding>
381
+ );
382
+ })}
383
+ {drawn.map(
346
384
  ({
385
+ crossing,
347
386
  focused,
348
387
  motion,
349
388
  placement,
350
389
  restack,
351
390
  screen,
391
+ seen,
352
392
  shownRewound,
353
393
  window,
354
394
  }) => (
@@ -365,6 +405,7 @@ export const Stage = memo(
365
405
  (desk.floats.has(window.id) ||
366
406
  desk.targeted.has(window.id)))
367
407
  }
408
+ crossing={crossing}
368
409
  domicile={domicile}
369
410
  dragging={stretching || held.has(window.id)}
370
411
  floating={desk.floats.has(window.id)}
@@ -388,6 +429,7 @@ export const Stage = memo(
388
429
  rewound={shownRewound}
389
430
  screen={screen}
390
431
  screenBox={screenNamed(desk, screen)?.geometry.screen}
432
+ seen={seen}
391
433
  window={window}
392
434
  />
393
435
  ),
@@ -397,8 +439,16 @@ export const Stage = memo(
397
439
  contents and before every bar, so the contents tuck under the strip
398
440
  and the tabs lie on it by document order. See `TabStrip`.
399
441
  */}
400
- {motions.drawn.map(
401
- ({ motion, placement, restack, screen, shownRewound, window }) =>
442
+ {drawn.map(
443
+ ({
444
+ motion,
445
+ placement,
446
+ restack,
447
+ screen,
448
+ seen,
449
+ shownRewound,
450
+ window,
451
+ }) =>
402
452
  placement?.strip?.open === true &&
403
453
  placement.tabbed !== undefined &&
404
454
  !leavesStrip(motion) ? (
@@ -422,11 +472,13 @@ export const Stage = memo(
422
472
  onGroupFloat={onGroupFloat}
423
473
  onGroupFullscreen={onGroupFullscreen}
424
474
  onGroupGrab={groupGrabbed}
475
+ onHover={onHover}
425
476
  onMove={onMove}
426
477
  onNewTab={onNewTab}
427
478
  onPull={pull}
428
479
  restack={restack}
429
480
  rewound={shownRewound}
481
+ seen={seen}
430
482
  strip={placement.strip}
431
483
  targets={targets}
432
484
  />
@@ -451,11 +503,13 @@ export const Stage = memo(
451
503
  onGroupFloat={onGroupFloat}
452
504
  onGroupFullscreen={onGroupFullscreen}
453
505
  onGroupGrab={groupGrabbed}
506
+ onHover={onHover}
454
507
  onMove={onMove}
455
508
  onNewTab={onNewTab}
456
509
  onPull={pull}
457
510
  restack={restack}
458
511
  rewound={0}
512
+ seen={overview?.shown.get(screen)}
459
513
  strip={tab.strip}
460
514
  targets={targets}
461
515
  />
@@ -468,18 +522,21 @@ export const Stage = memo(
468
522
  component for tiled and floating, so the bar is not remounted when
469
523
  the window floats. See `WindowTitleBar`. A bare float has none.
470
524
  */}
471
- {motions.drawn.map(
525
+ {drawn.map(
472
526
  ({
527
+ crossing,
473
528
  focused,
474
529
  motion,
475
530
  placement,
476
531
  restack,
477
532
  rewound,
478
533
  screen,
534
+ seen,
479
535
  window,
480
536
  }) =>
481
537
  placement === undefined || placement.bare ? undefined : (
482
538
  <WindowBar
539
+ crossing={crossing}
483
540
  description={descriptionOf(window)}
484
541
  dragging={stretching || held.has(window.id)}
485
542
  float={desk.floats.get(window.id)}
@@ -505,6 +562,7 @@ export const Stage = memo(
505
562
  rewound={rewound}
506
563
  screen={screen}
507
564
  screenBox={screenNamed(desk, screen)?.geometry.screen}
565
+ seen={seen}
508
566
  targets={targets}
509
567
  window={window}
510
568
  />
@@ -515,7 +573,7 @@ export const Stage = memo(
515
573
  order.
516
574
  */}
517
575
  {screens.flatMap((on) => {
518
- const hanging = hangingOn(motions.drawn, on);
576
+ const hanging = working ? hangingOn(motions.drawn, on) : undefined;
519
577
  return hanging?.placement === undefined
520
578
  ? []
521
579
  : [
@@ -537,24 +595,26 @@ export const Stage = memo(
537
595
  before the grabs, so a modifier grab covers everything but the gaps.
538
596
  */}
539
597
  {screens.flatMap((on) =>
540
- bordersOf(targetsOn(on)).map(({ edge, id, rect }) => (
541
- <TileBorder
542
- edge={edge}
543
- id={id}
544
- key={`${id}-${edge.toString()}`}
545
- onDrop={() => {
546
- setStretching(false);
547
- }}
548
- onGrab={() => {
549
- setStretching(true);
550
- onSelect(id);
551
- }}
552
- onStretch={(stretched, by) => {
553
- onStretch(id, stretched, by, on.geometry);
554
- }}
555
- rect={rect}
556
- />
557
- )),
598
+ bordersOf(working ? targetsOn(on) : []).map(
599
+ ({ edge, id, rect }) => (
600
+ <TileBorder
601
+ edge={edge}
602
+ id={id}
603
+ key={`${id}-${edge.toString()}`}
604
+ onDrop={() => {
605
+ setStretching(false);
606
+ }}
607
+ onGrab={() => {
608
+ setStretching(true);
609
+ onSelect(id);
610
+ }}
611
+ onStretch={(stretched, by) => {
612
+ onStretch(id, stretched, by, on.geometry);
613
+ }}
614
+ rect={rect}
615
+ />
616
+ ),
617
+ ),
558
618
  )}
559
619
  {/*
560
620
  Floating window borders, at each float's depth so windows above cover
@@ -564,7 +624,8 @@ export const Stage = memo(
564
624
  {motions.drawn.map(({ placement, screen, window }) => {
565
625
  const on = screenNamed(desk, screen);
566
626
  const floating = desk.floatsFocusing.get(window.id);
567
- return placement === undefined ||
627
+ return !working ||
628
+ placement === undefined ||
568
629
  on === undefined ||
569
630
  floating === undefined ||
570
631
  desk.fullscreen.has(window.id)
@@ -607,7 +668,7 @@ export const Stage = memo(
607
668
  const onHoverThis = (at: Spot) => {
608
669
  onHover(window.id, at);
609
670
  };
610
- if (placement === undefined || on === undefined) {
671
+ if (!working || placement === undefined || on === undefined) {
611
672
  return undefined;
612
673
  } else {
613
674
  return (
@@ -691,14 +752,21 @@ export const Stage = memo(
691
752
  key={tabKeyOf(tab)}
692
753
  motion={motion}
693
754
  on={screenNamed(desk, screen)}
755
+ onAim={setAim}
694
756
  onClose={onGroupClose}
757
+ onDrop={onDrop}
758
+ onDropOn={onGroupDropOn}
695
759
  onFloat={onFloat}
696
760
  onFullscreen={onFullscreen}
761
+ onGrab={groupGrabbed}
697
762
  onPlayedOut={onPlayedOut}
763
+ onPull={pull}
698
764
  onSelect={onSelect}
699
765
  restack={restack}
700
766
  screen={screen}
767
+ seen={overview?.shown.get(screen)}
701
768
  tab={tab}
769
+ targets={targets}
702
770
  title={tabbed.title}
703
771
  />
704
772
  );
@@ -708,12 +776,14 @@ export const Stage = memo(
708
776
  covers the selected container's windows and every tab. It follows
709
777
  the focused window as its glow does.
710
778
  */}
711
- {lit?.selection !== undefined && (
779
+ {working && lit?.selection !== undefined && (
712
780
  <Sliding
781
+ depth={raised(lit.depth)}
713
782
  frame={active?.placement?.frame}
714
783
  motion={activeMotion}
715
784
  on={screenNamed(desk, active?.screen)}
716
785
  rewound={active?.rewound ?? 0}
786
+ seen={undefined}
717
787
  >
718
788
  <SelectionTint
719
789
  depth={raised(lit.depth)}
@@ -726,14 +796,14 @@ export const Stage = memo(
726
796
  />
727
797
  </Sliding>
728
798
  )}
729
- {aim !== undefined && <DropIndicator aim={aim} />}
799
+ {working && aim !== undefined && <DropIndicator aim={aim} />}
730
800
  {movingId !== undefined && pulled && <GrabbingSheet />}
731
801
  {/*
732
802
  Last, so a popup wins the `z-index` tie at its window's depth but
733
803
  stays under windows stacked above.
734
804
  */}
735
805
  {popupsOver(
736
- popups,
806
+ working ? popups : [],
737
807
  screens.flatMap(({ screenful }) => screenful.placements),
738
808
  ).map((popup) => (
739
809
  <AppPopup key={popup.appId} popup={popup} />
@@ -798,6 +868,8 @@ const deskOf = (screens: readonly StageScreen[]): Desk => {
798
868
  type WindowContentsProps = {
799
869
  behindPanel: boolean;
800
870
  clickThrough: boolean;
871
+ /** See `DrawnWindow.crossing`. */
872
+ crossing: boolean;
801
873
  domicile: Domicile;
802
874
  dragging: boolean;
803
875
  floating: boolean;
@@ -821,6 +893,8 @@ type WindowContentsProps = {
821
893
  screen: string | undefined;
822
894
  /** The box of the screen it is drawn on. */
823
895
  screenBox: Rect | undefined;
896
+ /** How the overview shows it, if open. */
897
+ seen: Seen | undefined;
824
898
  window: ShellWindow;
825
899
  };
826
900
 
@@ -832,6 +906,7 @@ const WindowContents = memo(
832
906
  ({
833
907
  behindPanel,
834
908
  clickThrough,
909
+ crossing,
835
910
  domicile,
836
911
  dragging,
837
912
  floating,
@@ -852,6 +927,7 @@ const WindowContents = memo(
852
927
  rewound,
853
928
  screen,
854
929
  screenBox,
930
+ seen,
855
931
  window,
856
932
  }: WindowContentsProps) => {
857
933
  const { id } = window;
@@ -883,18 +959,21 @@ const WindowContents = memo(
883
959
  );
884
960
  return (
885
961
  <WindowFrame
962
+ depth={contents?.depth ?? 0}
886
963
  frame={placement?.frame}
887
964
  motion={motion}
888
965
  onHover={hovered}
889
966
  onReach={reached}
890
967
  rewound={rewound}
891
968
  screen={screenBox}
969
+ seen={seen}
892
970
  >
893
971
  {window.kind === WindowKind.App ? (
894
972
  <AppWindow
895
973
  appId={window.appId}
896
974
  behindPanel={behindPanel}
897
975
  clickThrough={clickThrough}
976
+ crossing={crossing}
898
977
  cursor={window.cursor}
899
978
  depth={contents?.depth ?? 0}
900
979
  domicile={domicile}
@@ -910,12 +989,14 @@ const WindowContents = memo(
910
989
  resizing={resizing}
911
990
  restack={restack}
912
991
  syncedFrame={window.syncedFrame}
992
+ tab={placement?.bar}
913
993
  />
914
994
  ) : (
915
995
  <BrowserWindow
916
996
  behindPanel={behindPanel}
917
997
  clickThrough={clickThrough}
918
998
  covered={placement?.behind !== undefined}
999
+ crossing={crossing}
919
1000
  depth={contents?.depth ?? 0}
920
1001
  domicile={domicile}
921
1002
  dragging={dragging}
@@ -935,6 +1016,7 @@ const WindowContents = memo(
935
1016
  rect={contents?.rect}
936
1017
  resizing={resizing}
937
1018
  restack={restack}
1019
+ tab={placement?.bar}
938
1020
  url={window.url}
939
1021
  window={engineWindowOf(id)}
940
1022
  />
@@ -945,6 +1027,8 @@ const WindowContents = memo(
945
1027
  );
946
1028
 
947
1029
  type WindowBarProps = {
1030
+ /** See `DrawnWindow.crossing`. */
1031
+ crossing: boolean;
948
1032
  description: string | undefined;
949
1033
  dragging: boolean;
950
1034
  float: Float | undefined;
@@ -971,6 +1055,8 @@ type WindowBarProps = {
971
1055
  screen: string | undefined;
972
1056
  /** The box of the screen it is drawn on. */
973
1057
  screenBox: Rect | undefined;
1058
+ /** How the overview shows it, if open. */
1059
+ seen: Seen | undefined;
974
1060
  targets: DropTargets;
975
1061
  window: ShellWindow;
976
1062
  };
@@ -978,6 +1064,7 @@ type WindowBarProps = {
978
1064
  /** One window's title bar, memoized as {@link WindowContents} is. */
979
1065
  const WindowBar = memo(
980
1066
  ({
1067
+ crossing,
981
1068
  description,
982
1069
  dragging,
983
1070
  float,
@@ -1002,6 +1089,7 @@ const WindowBar = memo(
1002
1089
  rewound,
1003
1090
  screen,
1004
1091
  screenBox,
1092
+ seen,
1005
1093
  targets,
1006
1094
  window,
1007
1095
  }: WindowBarProps) => {
@@ -1044,14 +1132,17 @@ const WindowBar = memo(
1044
1132
  );
1045
1133
  return (
1046
1134
  <WindowFrame
1135
+ depth={placement.depth}
1047
1136
  frame={placement.frame}
1048
1137
  motion={motion}
1049
1138
  onHover={hovered}
1050
1139
  onReach={reached}
1051
1140
  rewound={rewound}
1052
1141
  screen={screenBox}
1142
+ seen={seen}
1053
1143
  >
1054
1144
  <WindowTitleBar
1145
+ crossing={crossing}
1055
1146
  depth={placement.depth}
1056
1147
  description={description}
1057
1148
  dragging={dragging}
@@ -1102,15 +1193,25 @@ type ContainerTabProps = {
1102
1193
  icon: string | undefined;
1103
1194
  motion: WindowMotion;
1104
1195
  on: StageScreen | undefined;
1196
+ onAim: (aim: Aim | undefined) => void;
1105
1197
  /** Closes the tab's group, every window in it. */
1106
1198
  onClose: (group: NodeRef) => void;
1199
+ onDrop: () => void;
1200
+ /** The tab's group dropped where it was aimed. */
1201
+ onDropOn: (group: NodeRef, aim: Aim) => void;
1107
1202
  onFloat: (id: string) => void;
1108
1203
  onFullscreen: (id: string) => void;
1204
+ /** The tab's group taken hold of. */
1205
+ onGrab: (group: NodeRef) => void;
1109
1206
  onPlayedOut: WindowMotions["onPlayedOut"];
1207
+ onPull: () => void;
1110
1208
  onSelect: (id: string) => void;
1111
1209
  restack: Restack | undefined;
1112
1210
  screen: string;
1211
+ /** How the overview shows it, if open. */
1212
+ seen: Seen | undefined;
1113
1213
  tab: PlacedTab;
1214
+ targets: DropTargets;
1114
1215
  /** The title of the window the tab is named after. */
1115
1216
  title: string;
1116
1217
  };
@@ -1126,20 +1227,36 @@ const ContainerTab = memo(
1126
1227
  icon,
1127
1228
  motion,
1128
1229
  on,
1230
+ onAim,
1129
1231
  onClose,
1232
+ onDrop,
1233
+ onDropOn,
1130
1234
  onFloat,
1131
1235
  onFullscreen,
1236
+ onGrab,
1132
1237
  onPlayedOut,
1238
+ onPull,
1133
1239
  onSelect,
1134
1240
  restack,
1135
1241
  screen,
1242
+ seen,
1136
1243
  tab,
1244
+ targets,
1137
1245
  title,
1138
1246
  }: ContainerTabProps) => {
1139
1247
  const { id, node } = tab;
1140
1248
  const closed = useCallback(() => {
1141
1249
  onClose(node);
1142
1250
  }, [node, onClose]);
1251
+ const droppedOn = useCallback(
1252
+ (aim: Aim) => {
1253
+ onDropOn(node, aim);
1254
+ },
1255
+ [node, onDropOn],
1256
+ );
1257
+ const grabbed = useCallback(() => {
1258
+ onGrab(node);
1259
+ }, [node, onGrab]);
1143
1260
  const floated = useCallback(() => {
1144
1261
  onFloat(id);
1145
1262
  }, [id, onFloat]);
@@ -1153,8 +1270,15 @@ const ContainerTab = memo(
1153
1270
  onSelect(id);
1154
1271
  }, [id, onSelect]);
1155
1272
  return (
1156
- <Sliding frame={undefined} motion={motion} on={on} rewound={0}>
1157
- <TitleBar
1273
+ <Sliding
1274
+ depth={tab.depth}
1275
+ frame={undefined}
1276
+ motion={motion}
1277
+ on={on}
1278
+ rewound={0}
1279
+ seen={seen}
1280
+ >
1281
+ <GroupTitleBar
1158
1282
  depth={tab.depth}
1159
1283
  description={description}
1160
1284
  dragging={dragging}
@@ -1173,16 +1297,23 @@ const ContainerTab = memo(
1173
1297
  group={{ layout: tab.group, windows: tab.windows }}
1174
1298
  icon={icon}
1175
1299
  motion={motion}
1300
+ node={node}
1301
+ onAim={onAim}
1176
1302
  onClose={closed}
1303
+ onDrop={onDrop}
1304
+ onDropOn={droppedOn}
1177
1305
  onFloat={floated}
1178
1306
  onFullscreen={filled}
1307
+ onGrab={grabbed}
1179
1308
  onMiddleClick={closed}
1180
1309
  onMotionEnded={ended}
1181
- onPointerDown={pressed}
1310
+ onPress={pressed}
1311
+ onPull={onPull}
1182
1312
  rect={tab.rect}
1183
1313
  restack={restack}
1184
1314
  strip={tab.strip}
1185
1315
  tabbed={tab.tabbed}
1316
+ targets={targets}
1186
1317
  title={title}
1187
1318
  window={id}
1188
1319
  />
@@ -1193,20 +1324,26 @@ const ContainerTab = memo(
1193
1324
 
1194
1325
  /**
1195
1326
  * Gives its children the distances that slide `frame` off screen `on`, and
1196
- * clips them to it during a workspace switch. See `screenClipStyles`.
1327
+ * clips them to it during a workspace switch. See `screenClipStyles`. In the
1328
+ * overview, shows them through their tile; see `seenAt`.
1197
1329
  */
1198
1330
  const Sliding = ({
1199
1331
  children,
1332
+ depth,
1200
1333
  frame,
1201
1334
  motion,
1202
1335
  on,
1203
1336
  rewound,
1337
+ seen,
1204
1338
  }: {
1205
1339
  children: ReactNode;
1340
+ /** The depth of the part it holds. */
1341
+ depth: number;
1206
1342
  frame: Rect | undefined;
1207
1343
  motion: WindowMotion;
1208
1344
  on: StageScreen | undefined;
1209
1345
  rewound: number;
1346
+ seen: Seen | undefined;
1210
1347
  }) => (
1211
1348
  <div
1212
1349
  className={screenClipStyles}
@@ -1216,10 +1353,19 @@ const Sliding = ({
1216
1353
  : {
1217
1354
  ...slidAcross(on.geometry.screen, frame, motion, rewound),
1218
1355
  ...clippedTo(on.geometry.screen, motion),
1356
+ ...seenClip(seen, on.geometry.screen, depth),
1219
1357
  }
1220
1358
  }
1221
1359
  >
1222
- {children}
1360
+ <div
1361
+ className={seenStyles({
1362
+ arriving: seen?.arriving !== undefined,
1363
+ fading: seen?.fading ?? false,
1364
+ })}
1365
+ style={seenAt(seen, on?.geometry.screen)}
1366
+ >
1367
+ {children}
1368
+ </div>
1223
1369
  </div>
1224
1370
  );
1225
1371
 
@@ -1258,11 +1404,14 @@ type GroupStripProps = {
1258
1404
  onGroupFloat: (group: NodeRef) => void;
1259
1405
  onGroupFullscreen: (group: NodeRef) => void;
1260
1406
  onGroupGrab: (group: NodeRef) => void;
1407
+ onHover: (id: string, at: Spot) => void;
1261
1408
  onMove: (id: string, x: number, y: number) => void;
1262
1409
  onNewTab: (id: string) => void;
1263
1410
  onPull: () => void;
1264
1411
  restack: Restack | undefined;
1265
1412
  rewound: number;
1413
+ /** How the overview shows it, if open. */
1414
+ seen: Seen | undefined;
1266
1415
  strip: StripPlace;
1267
1416
  targets: DropTargets;
1268
1417
  };
@@ -1288,11 +1437,13 @@ const GroupStrip = memo(
1288
1437
  onGroupFloat,
1289
1438
  onGroupFullscreen,
1290
1439
  onGroupGrab,
1440
+ onHover,
1291
1441
  onMove,
1292
1442
  onNewTab,
1293
1443
  onPull,
1294
1444
  restack,
1295
1445
  rewound,
1446
+ seen,
1296
1447
  strip,
1297
1448
  targets,
1298
1449
  }: GroupStripProps) => {
@@ -1318,6 +1469,13 @@ const GroupStrip = memo(
1318
1469
  onGroupGrab(node);
1319
1470
  }
1320
1471
  }, [floating, id, node, onGrab, onGroupGrab]);
1472
+ // Focus follows the pointer onto the group's open window.
1473
+ const hovered = useCallback(
1474
+ (at: Spot) => {
1475
+ onHover(id, at);
1476
+ },
1477
+ [id, onHover],
1478
+ );
1321
1479
  const moved = useCallback(
1322
1480
  (x: number, y: number) => {
1323
1481
  onMove(id, x, y);
@@ -1328,7 +1486,14 @@ const GroupStrip = memo(
1328
1486
  onNewTab(id);
1329
1487
  }, [id, onNewTab]);
1330
1488
  return (
1331
- <Sliding frame={frame} motion={motion} on={on} rewound={rewound}>
1489
+ <Sliding
1490
+ depth={depth}
1491
+ frame={frame}
1492
+ motion={motion}
1493
+ on={on}
1494
+ rewound={rewound}
1495
+ seen={seen}
1496
+ >
1332
1497
  <TabStrip
1333
1498
  box={strip.box}
1334
1499
  depth={depth}
@@ -1347,6 +1512,7 @@ const GroupStrip = memo(
1347
1512
  onFloat={floated}
1348
1513
  onFullscreen={filled}
1349
1514
  onGrab={grabbed}
1515
+ onHover={hovered}
1350
1516
  onMove={moved}
1351
1517
  onNewTab={tabbed}
1352
1518
  onPull={onPull}
@@ -1406,23 +1572,13 @@ const tiledTargets = (placements: Screenful["placements"]): readonly Target[] =>
1406
1572
  .map(({ frame, id }) => ({ frame, id }));
1407
1573
 
1408
1574
  /**
1409
- * Every window's tab, tiled or floating, hidden ones too, which a window can
1410
- * be dropped beside. Excludes fullscreen screens, whose windows are hidden.
1575
+ * Every tab, tiled or floating, hidden ones too, which a window or group can be
1576
+ * dropped beside. Excludes fullscreen screens, whose windows are hidden.
1411
1577
  */
1412
1578
  const tabTargets = (screens: readonly StageScreen[]): readonly TabTarget[] =>
1413
- shownPlacements(screens).flatMap(({ bar, depth, id, strip, tabbed }) =>
1414
- strip !== undefined && tabbed !== undefined
1415
- ? [{ at: strip.at, depth, id, rect: bar, strip: strip.box, tabbed }]
1416
- : [],
1417
- );
1418
-
1419
- /** The placements of screens with nothing fullscreen. */
1420
- const shownPlacements = (
1421
- screens: readonly StageScreen[],
1422
- ): readonly Placement[] =>
1423
1579
  screens
1424
1580
  .filter(({ fullscreen }) => fullscreen === undefined)
1425
- .flatMap(({ screenful }) => screenful.placements);
1581
+ .flatMap(({ screenful }) => tabTargetsOf(screenful));
1426
1582
 
1427
1583
  /**
1428
1584
  * The screens with no tiled window to drop on, which a dropped window fills.
@@ -1500,3 +1656,36 @@ const engineWindowOf = (id: string): string => {
1500
1656
  return engine;
1501
1657
  }
1502
1658
  };
1659
+
1660
+ /** A window to draw, and how the overview shows it, if open. */
1661
+ type SeenWindow = DrawnWindow & { seen: Seen | undefined };
1662
+
1663
+ /**
1664
+ * Window `drawn` as the overview shows it: a shown one through its screen's
1665
+ * tile, a hidden workspace's one laid out in its own tile.
1666
+ */
1667
+ const seenIn = (
1668
+ drawn: DrawnWindow,
1669
+ overview: OverviewSight | undefined,
1670
+ ): SeenWindow => {
1671
+ const hidden =
1672
+ drawn.placement === undefined
1673
+ ? overview?.hidden.get(drawn.window.id)
1674
+ : undefined;
1675
+ if (hidden === undefined) {
1676
+ return {
1677
+ ...drawn,
1678
+ seen:
1679
+ drawn.screen === undefined
1680
+ ? undefined
1681
+ : overview?.shown.get(drawn.screen),
1682
+ };
1683
+ } else {
1684
+ return {
1685
+ ...drawn,
1686
+ placement: hidden.placement,
1687
+ screen: hidden.screen,
1688
+ seen: hidden.seen,
1689
+ };
1690
+ }
1691
+ };