@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/src/FocusGlow.tsx CHANGED
@@ -1,14 +1,16 @@
1
- import { useRef } from "react";
1
+ import { useContext, useRef } from "react";
2
2
 
3
3
  import { css, cva, cx } from "../styled-system/css";
4
4
  import type { Rect } from "./rect";
5
5
  import type { Restack } from "./restacking";
6
+ import { SlidingScreen } from "./sliding-screen";
6
7
  import { useLowered } from "./useLowered";
7
8
  import type { Settler } from "./useSettling";
8
9
  import { useSettling } from "./useSettling";
9
10
  import type { WindowMotion } from "./window-motion";
10
11
  import { isMoving } from "./window-motion";
11
12
  import {
13
+ clippedAlong,
12
14
  heldStyles,
13
15
  movingStyles,
14
16
  originOf,
@@ -67,6 +69,7 @@ export const FocusGlow = ({
67
69
  }: Props) => {
68
70
  const element = useRef<HTMLDivElement>(null);
69
71
  const lowered = useLowered(depth);
72
+ const sliding = useContext(SlidingScreen);
70
73
  useSettling({
71
74
  element,
72
75
  origin: originOf(rect, rect),
@@ -93,6 +96,7 @@ export const FocusGlow = ({
93
96
  ref={element}
94
97
  style={{
95
98
  ...placedAt(rect, depth),
99
+ ...clippedAlong(sliding, rect),
96
100
  ...scaledAbout(rect, rect),
97
101
  ...shuffledBy(restack),
98
102
  }}
@@ -0,0 +1,80 @@
1
+ import type { ComponentProps } from "react";
2
+
3
+ import { TitleBar } from "./TitleBar";
4
+ import type { Aim, DropTargets } from "./tiled/aim";
5
+ import { useTileDrag } from "./tiled/useTileDrag";
6
+ import type { Layout } from "./tree/node";
7
+ import type { NodeRef } from "./tree/path";
8
+
9
+ /** The primary button, as `PointerEvent.button` numbers it. */
10
+ const PRIMARY_BUTTON = 0;
11
+
12
+ type Props = Omit<
13
+ ComponentProps<typeof TitleBar>,
14
+ "grabbing" | "group" | "onPointerDown"
15
+ > & {
16
+ /** The group's layout and the windows it holds. */
17
+ group: { layout: Layout; windows: readonly string[] };
18
+ /** The group. */
19
+ node: NodeRef;
20
+ /** Where the dragged group would land if dropped now. */
21
+ onAim: (aim: Aim | undefined) => void;
22
+ onDrop: () => void;
23
+ /** The group dropped where it was aimed. See `useTileDrag`. */
24
+ onDropOn: (aim: Aim) => void;
25
+ /** The group taken hold of. */
26
+ onGrab: () => void;
27
+ /** A press on the tab, which shows the group. */
28
+ onPress: () => void;
29
+ /** A move of the group was pulled. See `useTileDrag`. */
30
+ onPull: () => void;
31
+ /** What the group can be dropped on, on every screen. */
32
+ targets: DropTargets;
33
+ };
34
+
35
+ /**
36
+ * The tab of a group nested in another group's strip. A press shows the
37
+ * group, and a drag with the primary button moves it as a tiled window's tab
38
+ * moves: along its strip, or out to another strip, window or screen.
39
+ */
40
+ export const GroupTitleBar = ({
41
+ node,
42
+ onAim,
43
+ onDrop,
44
+ onDropOn,
45
+ onGrab,
46
+ onPress,
47
+ onPull,
48
+ targets,
49
+ ...bar
50
+ }: Props) => {
51
+ const { drag, onPointerDown } = useTileDrag({
52
+ dragged: { node, windows: bar.group.windows },
53
+ frame: bar.rect,
54
+ onAim,
55
+ onDrop,
56
+ onDropOn,
57
+ onGrab,
58
+ onPull,
59
+ onStretch: doesNotStretch,
60
+ resizes: false,
61
+ targets,
62
+ });
63
+ return (
64
+ <TitleBar
65
+ {...bar}
66
+ grabbing={drag?.pulled === true}
67
+ onPointerDown={(event) => {
68
+ onPress();
69
+ if (event.button === PRIMARY_BUTTON) {
70
+ onPointerDown(event);
71
+ }
72
+ }}
73
+ />
74
+ );
75
+ };
76
+
77
+ /** Never called: a tab only moves its group. */
78
+ const doesNotStretch = () => {
79
+ throw new Error("group title bar: a tab does not resize its group");
80
+ };
package/src/GroupWell.tsx CHANGED
@@ -1,13 +1,15 @@
1
- import { useRef } from "react";
1
+ import { useContext, useRef } from "react";
2
2
 
3
3
  import { cva, cx } from "../styled-system/css";
4
4
  import type { Rect } from "./rect";
5
5
  import type { Restack } from "./restacking";
6
+ import { SlidingScreen } from "./sliding-screen";
6
7
  import { useLowered } from "./useLowered";
7
8
  import { useSettling } from "./useSettling";
8
9
  import type { WindowMotion } from "./window-motion";
9
10
  import { isMoving } from "./window-motion";
10
11
  import {
12
+ clippedAlong,
11
13
  heldStyles,
12
14
  movingStyles,
13
15
  originOf,
@@ -58,6 +60,7 @@ export const GroupWell = ({
58
60
  }: Props) => {
59
61
  const element = useRef<HTMLDivElement>(null);
60
62
  const lowered = useLowered(depth);
63
+ const sliding = useContext(SlidingScreen);
61
64
  useSettling({
62
65
  element,
63
66
  origin: originOf(rect, rect),
@@ -76,6 +79,7 @@ export const GroupWell = ({
76
79
  ref={element}
77
80
  style={{
78
81
  ...placedAt(rect, depth),
82
+ ...clippedAlong(sliding, rect),
79
83
  ...scaledAbout(rect, rect),
80
84
  ...shuffledBy(restack),
81
85
  }}
@@ -1,14 +1,16 @@
1
- import { useRef } from "react";
1
+ import { useContext, useRef } from "react";
2
2
 
3
3
  import { css, cx } from "../styled-system/css";
4
4
  import type { Rect } from "./rect";
5
5
  import type { Restack } from "./restacking";
6
+ import { SlidingScreen } from "./sliding-screen";
6
7
  import { useLowered } from "./useLowered";
7
8
  import type { Settler } from "./useSettling";
8
9
  import { useSettling } from "./useSettling";
9
10
  import type { WindowMotion } from "./window-motion";
10
11
  import { isMoving } from "./window-motion";
11
12
  import {
13
+ clippedAlong,
12
14
  heldStyles,
13
15
  movingStyles,
14
16
  originOf,
@@ -52,6 +54,7 @@ export const SelectionTint = ({
52
54
  }: Props) => {
53
55
  const element = useRef<HTMLDivElement>(null);
54
56
  const lowered = useLowered(depth);
57
+ const sliding = useContext(SlidingScreen);
55
58
  useSettling({
56
59
  element,
57
60
  origin: originOf(rect, rect),
@@ -71,6 +74,7 @@ export const SelectionTint = ({
71
74
  ref={element}
72
75
  style={{
73
76
  ...placedAt(rect, depth),
77
+ ...clippedAlong(sliding, rect),
74
78
  ...scaledAbout(rect, rect),
75
79
  ...shuffledBy(restack),
76
80
  }}