@oxy.so/bloom 21.5.0 → 21.7.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 (231) hide show
  1. package/docs/adoption-matrix.mdx +4 -4
  2. package/docs/dropdown-menu.mdx +11 -0
  3. package/docs/platform-surface.mdx +20 -0
  4. package/docs/public-parts.mdx +3 -2
  5. package/docs/task-catalog.json +1 -1
  6. package/docs/task-catalog.mdx +1 -1
  7. package/docs/window.mdx +30 -1
  8. package/lib/commonjs/dropdown-menu/DropdownMenu.js +86 -6
  9. package/lib/commonjs/dropdown-menu/DropdownMenu.js.map +1 -1
  10. package/lib/commonjs/dropdown-menu/context.js.map +1 -1
  11. package/lib/commonjs/floating/PopupPanel.js +17 -1
  12. package/lib/commonjs/floating/PopupPanel.js.map +1 -1
  13. package/lib/commonjs/floating/TriggerSlot.js +4 -0
  14. package/lib/commonjs/floating/TriggerSlot.js.map +1 -1
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/index.web.js.map +1 -1
  17. package/lib/commonjs/locale/translations/ar.js +21 -1
  18. package/lib/commonjs/locale/translations/ar.js.map +1 -1
  19. package/lib/commonjs/locale/translations/bn.js +21 -1
  20. package/lib/commonjs/locale/translations/bn.js.map +1 -1
  21. package/lib/commonjs/locale/translations/ca.js +21 -1
  22. package/lib/commonjs/locale/translations/ca.js.map +1 -1
  23. package/lib/commonjs/locale/translations/de.js +21 -1
  24. package/lib/commonjs/locale/translations/de.js.map +1 -1
  25. package/lib/commonjs/locale/translations/es.js +21 -1
  26. package/lib/commonjs/locale/translations/es.js.map +1 -1
  27. package/lib/commonjs/locale/translations/fr.js +21 -1
  28. package/lib/commonjs/locale/translations/fr.js.map +1 -1
  29. package/lib/commonjs/locale/translations/hi.js +21 -1
  30. package/lib/commonjs/locale/translations/hi.js.map +1 -1
  31. package/lib/commonjs/locale/translations/id.js +21 -1
  32. package/lib/commonjs/locale/translations/id.js.map +1 -1
  33. package/lib/commonjs/locale/translations/it.js +21 -1
  34. package/lib/commonjs/locale/translations/it.js.map +1 -1
  35. package/lib/commonjs/locale/translations/ja.js +21 -1
  36. package/lib/commonjs/locale/translations/ja.js.map +1 -1
  37. package/lib/commonjs/locale/translations/pt.js +21 -1
  38. package/lib/commonjs/locale/translations/pt.js.map +1 -1
  39. package/lib/commonjs/locale/translations/ru.js +21 -1
  40. package/lib/commonjs/locale/translations/ru.js.map +1 -1
  41. package/lib/commonjs/locale/translations/tr.js +21 -1
  42. package/lib/commonjs/locale/translations/tr.js.map +1 -1
  43. package/lib/commonjs/locale/translations/zh.js +21 -1
  44. package/lib/commonjs/locale/translations/zh.js.map +1 -1
  45. package/lib/commonjs/platform-surface/context.js +16 -0
  46. package/lib/commonjs/platform-surface/context.js.map +1 -1
  47. package/lib/commonjs/window/WindowControls.js +61 -16
  48. package/lib/commonjs/window/WindowControls.js.map +1 -1
  49. package/lib/commonjs/window/WindowLayouts.js +86 -0
  50. package/lib/commonjs/window/WindowLayouts.js.map +1 -0
  51. package/lib/commonjs/window/layouts-registry.js +27 -0
  52. package/lib/commonjs/window/layouts-registry.js.map +1 -0
  53. package/lib/commonjs/window/layouts.js +27 -0
  54. package/lib/commonjs/window/layouts.js.map +1 -0
  55. package/lib/commonjs/window/messages.js +21 -1
  56. package/lib/commonjs/window/messages.js.map +1 -1
  57. package/lib/commonjs/window/use-window.js +16 -4
  58. package/lib/commonjs/window/use-window.js.map +1 -1
  59. package/lib/module/dropdown-menu/DropdownMenu.js +88 -6
  60. package/lib/module/dropdown-menu/DropdownMenu.js.map +1 -1
  61. package/lib/module/dropdown-menu/context.js.map +1 -1
  62. package/lib/module/floating/PopupPanel.js +17 -1
  63. package/lib/module/floating/PopupPanel.js.map +1 -1
  64. package/lib/module/floating/TriggerSlot.js +4 -0
  65. package/lib/module/floating/TriggerSlot.js.map +1 -1
  66. package/lib/module/index.js.map +1 -1
  67. package/lib/module/index.web.js.map +1 -1
  68. package/lib/module/locale/translations/ar.js +21 -1
  69. package/lib/module/locale/translations/ar.js.map +1 -1
  70. package/lib/module/locale/translations/bn.js +21 -1
  71. package/lib/module/locale/translations/bn.js.map +1 -1
  72. package/lib/module/locale/translations/ca.js +21 -1
  73. package/lib/module/locale/translations/ca.js.map +1 -1
  74. package/lib/module/locale/translations/de.js +21 -1
  75. package/lib/module/locale/translations/de.js.map +1 -1
  76. package/lib/module/locale/translations/es.js +21 -1
  77. package/lib/module/locale/translations/es.js.map +1 -1
  78. package/lib/module/locale/translations/fr.js +21 -1
  79. package/lib/module/locale/translations/fr.js.map +1 -1
  80. package/lib/module/locale/translations/hi.js +21 -1
  81. package/lib/module/locale/translations/hi.js.map +1 -1
  82. package/lib/module/locale/translations/id.js +21 -1
  83. package/lib/module/locale/translations/id.js.map +1 -1
  84. package/lib/module/locale/translations/it.js +21 -1
  85. package/lib/module/locale/translations/it.js.map +1 -1
  86. package/lib/module/locale/translations/ja.js +21 -1
  87. package/lib/module/locale/translations/ja.js.map +1 -1
  88. package/lib/module/locale/translations/pt.js +21 -1
  89. package/lib/module/locale/translations/pt.js.map +1 -1
  90. package/lib/module/locale/translations/ru.js +21 -1
  91. package/lib/module/locale/translations/ru.js.map +1 -1
  92. package/lib/module/locale/translations/tr.js +21 -1
  93. package/lib/module/locale/translations/tr.js.map +1 -1
  94. package/lib/module/locale/translations/zh.js +21 -1
  95. package/lib/module/locale/translations/zh.js.map +1 -1
  96. package/lib/module/platform-surface/context.js +15 -0
  97. package/lib/module/platform-surface/context.js.map +1 -1
  98. package/lib/module/window/WindowControls.js +61 -16
  99. package/lib/module/window/WindowControls.js.map +1 -1
  100. package/lib/module/window/WindowLayouts.js +82 -0
  101. package/lib/module/window/WindowLayouts.js.map +1 -0
  102. package/lib/module/window/layouts-registry.js +22 -0
  103. package/lib/module/window/layouts-registry.js.map +1 -0
  104. package/lib/module/window/layouts.js +12 -0
  105. package/lib/module/window/layouts.js.map +1 -0
  106. package/lib/module/window/messages.js +21 -1
  107. package/lib/module/window/messages.js.map +1 -1
  108. package/lib/module/window/use-window.js +17 -5
  109. package/lib/module/window/use-window.js.map +1 -1
  110. package/lib/typescript/commonjs/dropdown-menu/DropdownMenu.d.ts +7 -1
  111. package/lib/typescript/commonjs/dropdown-menu/DropdownMenu.d.ts.map +1 -1
  112. package/lib/typescript/commonjs/dropdown-menu/context.d.ts +2 -0
  113. package/lib/typescript/commonjs/dropdown-menu/context.d.ts.map +1 -1
  114. package/lib/typescript/commonjs/floating/PopupPanel.d.ts +17 -4
  115. package/lib/typescript/commonjs/floating/PopupPanel.d.ts.map +1 -1
  116. package/lib/typescript/commonjs/floating/TriggerSlot.d.ts +7 -1
  117. package/lib/typescript/commonjs/floating/TriggerSlot.d.ts.map +1 -1
  118. package/lib/typescript/commonjs/index.d.ts +1 -1
  119. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/index.web.d.ts +1 -1
  121. package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/locale/translations/ar.d.ts.map +1 -1
  123. package/lib/typescript/commonjs/locale/translations/bn.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/locale/translations/ca.d.ts.map +1 -1
  125. package/lib/typescript/commonjs/locale/translations/de.d.ts.map +1 -1
  126. package/lib/typescript/commonjs/locale/translations/es.d.ts.map +1 -1
  127. package/lib/typescript/commonjs/locale/translations/fr.d.ts.map +1 -1
  128. package/lib/typescript/commonjs/locale/translations/hi.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/locale/translations/id.d.ts.map +1 -1
  130. package/lib/typescript/commonjs/locale/translations/it.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/locale/translations/ja.d.ts.map +1 -1
  132. package/lib/typescript/commonjs/locale/translations/pt.d.ts.map +1 -1
  133. package/lib/typescript/commonjs/locale/translations/ru.d.ts.map +1 -1
  134. package/lib/typescript/commonjs/locale/translations/tr.d.ts.map +1 -1
  135. package/lib/typescript/commonjs/locale/translations/zh.d.ts.map +1 -1
  136. package/lib/typescript/commonjs/platform-surface/context.d.ts +6 -0
  137. package/lib/typescript/commonjs/platform-surface/context.d.ts.map +1 -1
  138. package/lib/typescript/commonjs/platform-surface/index.d.ts +1 -1
  139. package/lib/typescript/commonjs/platform-surface/index.d.ts.map +1 -1
  140. package/lib/typescript/commonjs/platform-surface/types.d.ts +31 -1
  141. package/lib/typescript/commonjs/platform-surface/types.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/window/WindowControls.d.ts +4 -0
  143. package/lib/typescript/commonjs/window/WindowControls.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/window/WindowLayouts.d.ts +20 -0
  145. package/lib/typescript/commonjs/window/WindowLayouts.d.ts.map +1 -0
  146. package/lib/typescript/commonjs/window/layouts-registry.d.ts +19 -0
  147. package/lib/typescript/commonjs/window/layouts-registry.d.ts.map +1 -0
  148. package/lib/typescript/commonjs/window/layouts.d.ts +4 -0
  149. package/lib/typescript/commonjs/window/layouts.d.ts.map +1 -0
  150. package/lib/typescript/commonjs/window/messages.d.ts +22 -0
  151. package/lib/typescript/commonjs/window/messages.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/window/types.d.ts +15 -1
  153. package/lib/typescript/commonjs/window/types.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/window/use-window.d.ts.map +1 -1
  155. package/lib/typescript/module/dropdown-menu/DropdownMenu.d.ts +7 -1
  156. package/lib/typescript/module/dropdown-menu/DropdownMenu.d.ts.map +1 -1
  157. package/lib/typescript/module/dropdown-menu/context.d.ts +2 -0
  158. package/lib/typescript/module/dropdown-menu/context.d.ts.map +1 -1
  159. package/lib/typescript/module/floating/PopupPanel.d.ts +17 -4
  160. package/lib/typescript/module/floating/PopupPanel.d.ts.map +1 -1
  161. package/lib/typescript/module/floating/TriggerSlot.d.ts +7 -1
  162. package/lib/typescript/module/floating/TriggerSlot.d.ts.map +1 -1
  163. package/lib/typescript/module/index.d.ts +1 -1
  164. package/lib/typescript/module/index.d.ts.map +1 -1
  165. package/lib/typescript/module/index.web.d.ts +1 -1
  166. package/lib/typescript/module/index.web.d.ts.map +1 -1
  167. package/lib/typescript/module/locale/translations/ar.d.ts.map +1 -1
  168. package/lib/typescript/module/locale/translations/bn.d.ts.map +1 -1
  169. package/lib/typescript/module/locale/translations/ca.d.ts.map +1 -1
  170. package/lib/typescript/module/locale/translations/de.d.ts.map +1 -1
  171. package/lib/typescript/module/locale/translations/es.d.ts.map +1 -1
  172. package/lib/typescript/module/locale/translations/fr.d.ts.map +1 -1
  173. package/lib/typescript/module/locale/translations/hi.d.ts.map +1 -1
  174. package/lib/typescript/module/locale/translations/id.d.ts.map +1 -1
  175. package/lib/typescript/module/locale/translations/it.d.ts.map +1 -1
  176. package/lib/typescript/module/locale/translations/ja.d.ts.map +1 -1
  177. package/lib/typescript/module/locale/translations/pt.d.ts.map +1 -1
  178. package/lib/typescript/module/locale/translations/ru.d.ts.map +1 -1
  179. package/lib/typescript/module/locale/translations/tr.d.ts.map +1 -1
  180. package/lib/typescript/module/locale/translations/zh.d.ts.map +1 -1
  181. package/lib/typescript/module/platform-surface/context.d.ts +6 -0
  182. package/lib/typescript/module/platform-surface/context.d.ts.map +1 -1
  183. package/lib/typescript/module/platform-surface/index.d.ts +1 -1
  184. package/lib/typescript/module/platform-surface/index.d.ts.map +1 -1
  185. package/lib/typescript/module/platform-surface/types.d.ts +31 -1
  186. package/lib/typescript/module/platform-surface/types.d.ts.map +1 -1
  187. package/lib/typescript/module/window/WindowControls.d.ts +4 -0
  188. package/lib/typescript/module/window/WindowControls.d.ts.map +1 -1
  189. package/lib/typescript/module/window/WindowLayouts.d.ts +20 -0
  190. package/lib/typescript/module/window/WindowLayouts.d.ts.map +1 -0
  191. package/lib/typescript/module/window/layouts-registry.d.ts +19 -0
  192. package/lib/typescript/module/window/layouts-registry.d.ts.map +1 -0
  193. package/lib/typescript/module/window/layouts.d.ts +4 -0
  194. package/lib/typescript/module/window/layouts.d.ts.map +1 -0
  195. package/lib/typescript/module/window/messages.d.ts +22 -0
  196. package/lib/typescript/module/window/messages.d.ts.map +1 -1
  197. package/lib/typescript/module/window/types.d.ts +15 -1
  198. package/lib/typescript/module/window/types.d.ts.map +1 -1
  199. package/lib/typescript/module/window/use-window.d.ts.map +1 -1
  200. package/package.json +20 -2
  201. package/src/__tests__/support/public-part-classifications.json +1 -0
  202. package/src/dropdown-menu/DropdownMenu.tsx +94 -6
  203. package/src/dropdown-menu/context.ts +2 -0
  204. package/src/floating/PopupPanel.tsx +41 -2
  205. package/src/floating/TriggerSlot.tsx +10 -0
  206. package/src/index.ts +1 -0
  207. package/src/index.web.ts +1 -0
  208. package/src/locale/translations/ar.ts +20 -0
  209. package/src/locale/translations/bn.ts +20 -0
  210. package/src/locale/translations/ca.ts +20 -0
  211. package/src/locale/translations/de.ts +20 -0
  212. package/src/locale/translations/es.ts +20 -0
  213. package/src/locale/translations/fr.ts +20 -0
  214. package/src/locale/translations/hi.ts +20 -0
  215. package/src/locale/translations/id.ts +20 -0
  216. package/src/locale/translations/it.ts +20 -0
  217. package/src/locale/translations/ja.ts +20 -0
  218. package/src/locale/translations/pt.ts +20 -0
  219. package/src/locale/translations/ru.ts +20 -0
  220. package/src/locale/translations/tr.ts +20 -0
  221. package/src/locale/translations/zh.ts +20 -0
  222. package/src/platform-surface/context.ts +17 -0
  223. package/src/platform-surface/index.ts +1 -0
  224. package/src/platform-surface/types.ts +45 -0
  225. package/src/window/WindowControls.tsx +72 -18
  226. package/src/window/WindowLayouts.tsx +108 -0
  227. package/src/window/layouts-registry.ts +26 -0
  228. package/src/window/layouts.ts +12 -0
  229. package/src/window/messages.ts +42 -0
  230. package/src/window/types.ts +20 -1
  231. package/src/window/use-window.ts +14 -4
@@ -1,7 +1,12 @@
1
+ import type React from 'react';
1
2
  import type { ReactNode } from 'react';
2
3
  import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
3
4
 
4
- import type { PlatformWindowMetrics, PlatformWindowState } from '../platform-surface/types';
5
+ import type {
6
+ PlatformWindowLayout,
7
+ PlatformWindowMetrics,
8
+ PlatformWindowState,
9
+ } from '../platform-surface/types';
5
10
 
6
11
  /** The window's state and the actions on it (`useWindow()`). */
7
12
  export interface WindowHandle extends PlatformWindowState {
@@ -15,6 +20,10 @@ export interface WindowHandle extends PlatformWindowState {
15
20
  zoom(): void;
16
21
  /** Start an interactive move from the press being handled. */
17
22
  startMove(): void;
23
+ /** Lays the window out, where the platform tiles windows; absent where it does not. */
24
+ readonly layOut?: (layout: PlatformWindowLayout) => void;
25
+ /** Moves the window to another desktop, where the platform has them; absent where it does not. */
26
+ readonly moveToDesktop?: (desktop: number) => void;
18
27
  }
19
28
 
20
29
  /**
@@ -75,3 +84,13 @@ export interface WindowDragRegionProps
75
84
  style?: StyleProp<ViewStyle>;
76
85
  testID?: string;
77
86
  }
87
+
88
+ /** `WindowLayouts`' props (`@oxy.so/bloom/window/layouts`). */
89
+ export interface WindowLayoutsProps {
90
+ /** The zoom control. */
91
+ children: React.ReactElement;
92
+ /** The control's place: the trigger's box, where the menu is anchored. */
93
+ style?: StyleProp<ViewStyle>;
94
+ /** The menu's rows are `${testID}-${layout}` and `${testID}-desktop-${n}`. */
95
+ testID?: string;
96
+ }
@@ -1,8 +1,8 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
2
2
 
3
- import { usePlatformWindow } from '../platform-surface/context';
3
+ import { usePlatformWindow, usePlatformWindowLayout } from '../platform-surface/context';
4
4
  import { useWindowChrome } from './context';
5
- import type { PlatformWindowState } from '../platform-surface/types';
5
+ import type { PlatformWindowLayout, PlatformWindowState } from '../platform-surface/types';
6
6
  import type { WindowControlsRoom, WindowHandle, WindowSizeLimits } from './types';
7
7
 
8
8
  const NO_ROOM: WindowControlsRoom = { top: 0, leading: 0 };
@@ -16,6 +16,7 @@ function unsubscribed() {}
16
16
  */
17
17
  export function useWindow(): WindowHandle | null {
18
18
  const platform = usePlatformWindow();
19
+ const layouts = usePlatformWindowLayout();
19
20
  // `useSyncExternalStore` compares snapshots by identity, so an adapter that
20
21
  // builds a fresh object on every `getState()` must not read as a change.
21
22
  const last = useRef<PlatformWindowState | null>(null);
@@ -31,13 +32,16 @@ export function useWindow(): WindowHandle | null {
31
32
  previous &&
32
33
  previous.active === next.active &&
33
34
  previous.maximized === next.maximized &&
34
- previous.fullscreen === next.fullscreen
35
+ previous.fullscreen === next.fullscreen &&
36
+ previous.desktops?.count === next.desktops?.count &&
37
+ previous.desktops?.current === next.desktops?.current
35
38
  )
36
39
  return previous;
37
40
  last.current = {
38
41
  active: next.active,
39
42
  maximized: next.maximized,
40
43
  fullscreen: next.fullscreen,
44
+ ...(next.desktops ? { desktops: { ...next.desktops } } : null),
41
45
  };
42
46
  return last.current;
43
47
  }, [platform]);
@@ -53,9 +57,15 @@ export function useWindow(): WindowHandle | null {
53
57
  minimize: () => platform.minimize(),
54
58
  zoom: () => platform.zoom(),
55
59
  startMove: () => platform.startMove(),
60
+ ...(layouts?.layOut
61
+ ? { layOut: (layout: PlatformWindowLayout) => layouts.layOut?.(layout) }
62
+ : null),
63
+ ...(layouts?.moveToDesktop
64
+ ? { moveToDesktop: (desktop: number) => layouts.moveToDesktop?.(desktop) }
65
+ : null),
56
66
  }
57
67
  : null,
58
- [platform, state],
68
+ [platform, layouts, state],
59
69
  );
60
70
  }
61
71