@oxy.so/bloom 21.6.0 → 21.7.1
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/docs/adoption-matrix.mdx +4 -4
- package/docs/platform-surface.mdx +20 -0
- package/docs/public-parts.mdx +3 -2
- package/docs/task-catalog.json +1 -1
- package/docs/task-catalog.mdx +1 -1
- package/docs/window.mdx +30 -1
- package/lib/commonjs/floating/popup-navigation.js +19 -9
- package/lib/commonjs/floating/popup-navigation.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/locale/translations/ar.js +21 -1
- package/lib/commonjs/locale/translations/ar.js.map +1 -1
- package/lib/commonjs/locale/translations/bn.js +21 -1
- package/lib/commonjs/locale/translations/bn.js.map +1 -1
- package/lib/commonjs/locale/translations/ca.js +21 -1
- package/lib/commonjs/locale/translations/ca.js.map +1 -1
- package/lib/commonjs/locale/translations/de.js +21 -1
- package/lib/commonjs/locale/translations/de.js.map +1 -1
- package/lib/commonjs/locale/translations/es.js +21 -1
- package/lib/commonjs/locale/translations/es.js.map +1 -1
- package/lib/commonjs/locale/translations/fr.js +21 -1
- package/lib/commonjs/locale/translations/fr.js.map +1 -1
- package/lib/commonjs/locale/translations/hi.js +21 -1
- package/lib/commonjs/locale/translations/hi.js.map +1 -1
- package/lib/commonjs/locale/translations/id.js +21 -1
- package/lib/commonjs/locale/translations/id.js.map +1 -1
- package/lib/commonjs/locale/translations/it.js +21 -1
- package/lib/commonjs/locale/translations/it.js.map +1 -1
- package/lib/commonjs/locale/translations/ja.js +21 -1
- package/lib/commonjs/locale/translations/ja.js.map +1 -1
- package/lib/commonjs/locale/translations/pt.js +21 -1
- package/lib/commonjs/locale/translations/pt.js.map +1 -1
- package/lib/commonjs/locale/translations/ru.js +21 -1
- package/lib/commonjs/locale/translations/ru.js.map +1 -1
- package/lib/commonjs/locale/translations/tr.js +21 -1
- package/lib/commonjs/locale/translations/tr.js.map +1 -1
- package/lib/commonjs/locale/translations/zh.js +21 -1
- package/lib/commonjs/locale/translations/zh.js.map +1 -1
- package/lib/commonjs/platform-surface/context.js +16 -0
- package/lib/commonjs/platform-surface/context.js.map +1 -1
- package/lib/commonjs/window/WindowControls.js +61 -16
- package/lib/commonjs/window/WindowControls.js.map +1 -1
- package/lib/commonjs/window/WindowLayouts.js +86 -0
- package/lib/commonjs/window/WindowLayouts.js.map +1 -0
- package/lib/commonjs/window/layouts-registry.js +27 -0
- package/lib/commonjs/window/layouts-registry.js.map +1 -0
- package/lib/commonjs/window/layouts.js +27 -0
- package/lib/commonjs/window/layouts.js.map +1 -0
- package/lib/commonjs/window/messages.js +21 -1
- package/lib/commonjs/window/messages.js.map +1 -1
- package/lib/commonjs/window/use-window.js +16 -4
- package/lib/commonjs/window/use-window.js.map +1 -1
- package/lib/module/floating/popup-navigation.js +19 -9
- package/lib/module/floating/popup-navigation.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/locale/translations/ar.js +21 -1
- package/lib/module/locale/translations/ar.js.map +1 -1
- package/lib/module/locale/translations/bn.js +21 -1
- package/lib/module/locale/translations/bn.js.map +1 -1
- package/lib/module/locale/translations/ca.js +21 -1
- package/lib/module/locale/translations/ca.js.map +1 -1
- package/lib/module/locale/translations/de.js +21 -1
- package/lib/module/locale/translations/de.js.map +1 -1
- package/lib/module/locale/translations/es.js +21 -1
- package/lib/module/locale/translations/es.js.map +1 -1
- package/lib/module/locale/translations/fr.js +21 -1
- package/lib/module/locale/translations/fr.js.map +1 -1
- package/lib/module/locale/translations/hi.js +21 -1
- package/lib/module/locale/translations/hi.js.map +1 -1
- package/lib/module/locale/translations/id.js +21 -1
- package/lib/module/locale/translations/id.js.map +1 -1
- package/lib/module/locale/translations/it.js +21 -1
- package/lib/module/locale/translations/it.js.map +1 -1
- package/lib/module/locale/translations/ja.js +21 -1
- package/lib/module/locale/translations/ja.js.map +1 -1
- package/lib/module/locale/translations/pt.js +21 -1
- package/lib/module/locale/translations/pt.js.map +1 -1
- package/lib/module/locale/translations/ru.js +21 -1
- package/lib/module/locale/translations/ru.js.map +1 -1
- package/lib/module/locale/translations/tr.js +21 -1
- package/lib/module/locale/translations/tr.js.map +1 -1
- package/lib/module/locale/translations/zh.js +21 -1
- package/lib/module/locale/translations/zh.js.map +1 -1
- package/lib/module/platform-surface/context.js +15 -0
- package/lib/module/platform-surface/context.js.map +1 -1
- package/lib/module/window/WindowControls.js +61 -16
- package/lib/module/window/WindowControls.js.map +1 -1
- package/lib/module/window/WindowLayouts.js +82 -0
- package/lib/module/window/WindowLayouts.js.map +1 -0
- package/lib/module/window/layouts-registry.js +22 -0
- package/lib/module/window/layouts-registry.js.map +1 -0
- package/lib/module/window/layouts.js +12 -0
- package/lib/module/window/layouts.js.map +1 -0
- package/lib/module/window/messages.js +21 -1
- package/lib/module/window/messages.js.map +1 -1
- package/lib/module/window/use-window.js +17 -5
- package/lib/module/window/use-window.js.map +1 -1
- package/lib/typescript/commonjs/floating/popup-navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +1 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/ar.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/bn.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/ca.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/de.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/es.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/fr.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/hi.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/id.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/it.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/ja.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/pt.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/ru.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/tr.d.ts.map +1 -1
- package/lib/typescript/commonjs/locale/translations/zh.d.ts.map +1 -1
- package/lib/typescript/commonjs/platform-surface/context.d.ts +6 -0
- package/lib/typescript/commonjs/platform-surface/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/platform-surface/index.d.ts +1 -1
- package/lib/typescript/commonjs/platform-surface/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/platform-surface/types.d.ts +31 -1
- package/lib/typescript/commonjs/platform-surface/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/window/WindowControls.d.ts +4 -0
- package/lib/typescript/commonjs/window/WindowControls.d.ts.map +1 -1
- package/lib/typescript/commonjs/window/WindowLayouts.d.ts +20 -0
- package/lib/typescript/commonjs/window/WindowLayouts.d.ts.map +1 -0
- package/lib/typescript/commonjs/window/layouts-registry.d.ts +19 -0
- package/lib/typescript/commonjs/window/layouts-registry.d.ts.map +1 -0
- package/lib/typescript/commonjs/window/layouts.d.ts +4 -0
- package/lib/typescript/commonjs/window/layouts.d.ts.map +1 -0
- package/lib/typescript/commonjs/window/messages.d.ts +22 -0
- package/lib/typescript/commonjs/window/messages.d.ts.map +1 -1
- package/lib/typescript/commonjs/window/types.d.ts +15 -1
- package/lib/typescript/commonjs/window/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/window/use-window.d.ts.map +1 -1
- package/lib/typescript/module/floating/popup-navigation.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +1 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/ar.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/bn.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/ca.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/de.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/es.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/fr.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/hi.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/id.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/it.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/ja.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/pt.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/ru.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/tr.d.ts.map +1 -1
- package/lib/typescript/module/locale/translations/zh.d.ts.map +1 -1
- package/lib/typescript/module/platform-surface/context.d.ts +6 -0
- package/lib/typescript/module/platform-surface/context.d.ts.map +1 -1
- package/lib/typescript/module/platform-surface/index.d.ts +1 -1
- package/lib/typescript/module/platform-surface/index.d.ts.map +1 -1
- package/lib/typescript/module/platform-surface/types.d.ts +31 -1
- package/lib/typescript/module/platform-surface/types.d.ts.map +1 -1
- package/lib/typescript/module/window/WindowControls.d.ts +4 -0
- package/lib/typescript/module/window/WindowControls.d.ts.map +1 -1
- package/lib/typescript/module/window/WindowLayouts.d.ts +20 -0
- package/lib/typescript/module/window/WindowLayouts.d.ts.map +1 -0
- package/lib/typescript/module/window/layouts-registry.d.ts +19 -0
- package/lib/typescript/module/window/layouts-registry.d.ts.map +1 -0
- package/lib/typescript/module/window/layouts.d.ts +4 -0
- package/lib/typescript/module/window/layouts.d.ts.map +1 -0
- package/lib/typescript/module/window/messages.d.ts +22 -0
- package/lib/typescript/module/window/messages.d.ts.map +1 -1
- package/lib/typescript/module/window/types.d.ts +15 -1
- package/lib/typescript/module/window/types.d.ts.map +1 -1
- package/lib/typescript/module/window/use-window.d.ts.map +1 -1
- package/package.json +20 -2
- package/src/__tests__/support/public-part-classifications.json +1 -0
- package/src/floating/popup-navigation.tsx +71 -55
- package/src/index.ts +1 -0
- package/src/index.web.ts +1 -0
- package/src/locale/translations/ar.ts +20 -0
- package/src/locale/translations/bn.ts +20 -0
- package/src/locale/translations/ca.ts +20 -0
- package/src/locale/translations/de.ts +20 -0
- package/src/locale/translations/es.ts +20 -0
- package/src/locale/translations/fr.ts +20 -0
- package/src/locale/translations/hi.ts +20 -0
- package/src/locale/translations/id.ts +20 -0
- package/src/locale/translations/it.ts +20 -0
- package/src/locale/translations/ja.ts +20 -0
- package/src/locale/translations/pt.ts +20 -0
- package/src/locale/translations/ru.ts +20 -0
- package/src/locale/translations/tr.ts +20 -0
- package/src/locale/translations/zh.ts +20 -0
- package/src/platform-surface/context.ts +17 -0
- package/src/platform-surface/index.ts +1 -0
- package/src/platform-surface/types.ts +45 -0
- package/src/window/WindowControls.tsx +72 -18
- package/src/window/WindowLayouts.tsx +108 -0
- package/src/window/layouts-registry.ts +26 -0
- package/src/window/layouts.ts +12 -0
- package/src/window/messages.ts +42 -0
- package/src/window/types.ts +20 -1
- package/src/window/use-window.ts +14 -4
|
@@ -39,6 +39,21 @@ export function usePlatformWindow() {
|
|
|
39
39
|
return adapter.window;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* The window's layouts when the adapter reports `window` and `window-layout` (`PlatformWindow`'s
|
|
44
|
+
* `layOut`, and `moveToDesktop` where it has desktops), otherwise null. Throws for
|
|
45
|
+
* `window-layout` without `layOut`.
|
|
46
|
+
*/
|
|
47
|
+
export function usePlatformWindowLayout() {
|
|
48
|
+
const adapter = useContext(PlatformSurfaceContext);
|
|
49
|
+
const window = usePlatformWindow();
|
|
50
|
+
if (!window || !adapter?.capabilities.has('window-layout')) return null;
|
|
51
|
+
if (!window.layOut) {
|
|
52
|
+
throw new Error(`Bloom: the ${adapter.platform} platform adapter reports 'window-layout' without a window's layOut.`);
|
|
53
|
+
}
|
|
54
|
+
return window;
|
|
55
|
+
}
|
|
56
|
+
|
|
42
57
|
/**
|
|
43
58
|
* The platform's menu bar when the adapter reports `menu-bar`, otherwise null
|
|
44
59
|
* (a `Menubar` draws itself in the window). An adapter that reports the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useContext","PlatformSurfaceContext","PlatformSurfaceProvider","Provider","usePlatformSurfaces","usePopupSurface","adapter","capabilities","has","PopupSurface","Error","platform","usePlatformWindow","window","usePlatformMenuBar","menuBar","usePlatformAppearance","appearance","usePlatformEditing","editing","usePlatformKeyboard","keyboard","usePlatformFiles","files","usePlatformSearch","search","usePlatformSounds","sounds","dragAndDrop","DropTarget","drag","usePlatformDropTarget","usePlatformDrag","usePlatformMaterial","Material"],"sourceRoot":"../../../src","sources":["platform-surface/context.ts"],"mappings":";;AAAA,SAA6BA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAiBrE,MAAMC,sBAAsB,gBAAGF,aAAa,CAAgC,IAAI,CAAC;;AAEjF;AACA,OAAO,MAAMG,uBAAuB,GAAGD,sBAAsB,CAACE,QAAQ;;AAEtE;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAAkC;EACnE,OAAOJ,UAAU,CAACC,sBAAsB,CAAC;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,eAAeA,CAAA,EAA4C;EACzE,MAAMC,OAAO,GAAGN,UAAU,CAACC,sBAAsB,CAAC;EAClD,IAAI,CAACK,OAAO,EAAEC,YAAY,CAACC,GAAG,CAAC,eAAe,CAAC,EAAE,OAAO,IAAI;EAC5D,IAAI,CAACF,OAAO,CAACG,YAAY,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,cAAcJ,OAAO,CAACK,QAAQ,6EAChC,CAAC;EACH;EACA,OAAOL,OAAO,CAACG,YAAY;AAC7B;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,iBAAiBA,CAAA,EAA0B;EACzD,MAAMN,OAAO,GAAGN,UAAU,CAACC,sBAAsB,CAAC;EAClD,IAAI,CAACK,OAAO,EAAEC,YAAY,CAACC,GAAG,CAAC,QAAQ,CAAC,EAAE,OAAO,IAAI;EACrD,IAAI,CAACF,OAAO,CAACO,MAAM,EAAE;IACnB,MAAM,IAAIH,KAAK,CACb,cAAcJ,OAAO,CAACK,QAAQ,sDAChC,CAAC;EACH;EACA,OAAOL,OAAO,CAACO,MAAM;AACvB;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAAA,EAA2B;EAC3D,
|
|
1
|
+
{"version":3,"names":["createContext","useContext","PlatformSurfaceContext","PlatformSurfaceProvider","Provider","usePlatformSurfaces","usePopupSurface","adapter","capabilities","has","PopupSurface","Error","platform","usePlatformWindow","window","usePlatformWindowLayout","layOut","usePlatformMenuBar","menuBar","usePlatformAppearance","appearance","usePlatformEditing","editing","usePlatformKeyboard","keyboard","usePlatformFiles","files","usePlatformSearch","search","usePlatformSounds","sounds","dragAndDrop","DropTarget","drag","usePlatformDropTarget","usePlatformDrag","usePlatformMaterial","Material"],"sourceRoot":"../../../src","sources":["platform-surface/context.ts"],"mappings":";;AAAA,SAA6BA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAiBrE,MAAMC,sBAAsB,gBAAGF,aAAa,CAAgC,IAAI,CAAC;;AAEjF;AACA,OAAO,MAAMG,uBAAuB,GAAGD,sBAAsB,CAACE,QAAQ;;AAEtE;AACA,OAAO,SAASC,mBAAmBA,CAAA,EAAkC;EACnE,OAAOJ,UAAU,CAACC,sBAAsB,CAAC;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,eAAeA,CAAA,EAA4C;EACzE,MAAMC,OAAO,GAAGN,UAAU,CAACC,sBAAsB,CAAC;EAClD,IAAI,CAACK,OAAO,EAAEC,YAAY,CAACC,GAAG,CAAC,eAAe,CAAC,EAAE,OAAO,IAAI;EAC5D,IAAI,CAACF,OAAO,CAACG,YAAY,EAAE;IACzB,MAAM,IAAIC,KAAK,CACb,cAAcJ,OAAO,CAACK,QAAQ,6EAChC,CAAC;EACH;EACA,OAAOL,OAAO,CAACG,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CAAC;EACH;EACA,OAAOL,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAAS2B,qBAAqBA,CAAA,EAAkD;EACrF,OAAOH,WAAW,CAAC9B,UAAU,CAACC,sBAAsB,CAAC,CAAC,EAAE8B,UAAU,IAAI,IAAI;AAC5E;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,eAAeA,CAAA,EAAwB;EACrD,OAAOJ,WAAW,CAAC9B,UAAU,CAACC,sBAAsB,CAAC,CAAC,EAAE+B,IAAI,IAAI,IAAI;AACtE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,mBAAmBA,CAAA,EAAgD;EACjF,MAAM7B,OAAO,GAAGN,UAAU,CAACC,sBAAsB,CAAC;EAClD,IAAI,CAACK,OAAO,EAAEC,YAAY,CAACC,GAAG,CAAC,UAAU,CAAC,EAAE,OAAO,IAAI;EACvD,IAAI,CAACF,OAAO,CAAC8B,QAAQ,EAAE;IACrB,MAAM,IAAI1B,KAAK,CACb,cAAcJ,OAAO,CAACK,QAAQ,oEAChC,CAAC;EACH;EACA,OAAOL,OAAO,CAAC8B,QAAQ;AACzB","ignoreList":[]}
|
|
@@ -13,6 +13,7 @@ import { useTheme } from "../theme/use-theme.js";
|
|
|
13
13
|
import { ACCEPTS_FIRST_MOUSE, WINDOW_CONTROL_DISC, WINDOW_CONTROL_PRESSED_SCALE, WINDOW_CONTROL_SYMBOL, WINDOW_CONTROL_TARGET, WINDOW_CONTROLS_PLATE_PADDING } from "./constants.js";
|
|
14
14
|
import { WINDOW_MESSAGES } from "./messages.js";
|
|
15
15
|
import { useWindow } from "./use-window.js";
|
|
16
|
+
import { registeredWindowLayouts } from "./layouts-registry.js";
|
|
16
17
|
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion.js";
|
|
17
18
|
import { useInteractionState } from "../hooks/use-interaction-state.js";
|
|
18
19
|
|
|
@@ -37,7 +38,9 @@ function WindowControl({
|
|
|
37
38
|
top,
|
|
38
39
|
symbols,
|
|
39
40
|
onPress,
|
|
40
|
-
testID
|
|
41
|
+
testID,
|
|
42
|
+
placed = true,
|
|
43
|
+
...trigger
|
|
41
44
|
}) {
|
|
42
45
|
const reducedMotion = usePrefersReducedMotion();
|
|
43
46
|
const scale = useSharedValue(1);
|
|
@@ -51,7 +54,10 @@ function WindowControl({
|
|
|
51
54
|
// The first click on an inactive window's bubble acts, as a Mac's do.
|
|
52
55
|
, {
|
|
53
56
|
...ACCEPTS_FIRST_MOUSE,
|
|
54
|
-
role: "button"
|
|
57
|
+
role: "button"
|
|
58
|
+
// The layouts' trigger, on the zoom control: its long press, its state and its action.
|
|
59
|
+
,
|
|
60
|
+
...trigger,
|
|
55
61
|
accessibilityLabel: label,
|
|
56
62
|
onPress: onPress,
|
|
57
63
|
onPressIn: () => {
|
|
@@ -63,10 +69,7 @@ function WindowControl({
|
|
|
63
69
|
animateWithSpec(scale, 1, RELEASE, reducedMotion);
|
|
64
70
|
},
|
|
65
71
|
testID: testID,
|
|
66
|
-
style: [{
|
|
67
|
-
position: 'absolute',
|
|
68
|
-
top,
|
|
69
|
-
insetInlineStart: offset,
|
|
72
|
+
style: [placed ? controlPlace(offset, top) : null, {
|
|
70
73
|
width: WINDOW_CONTROL_TARGET,
|
|
71
74
|
height: WINDOW_CONTROL_TARGET,
|
|
72
75
|
alignItems: 'center',
|
|
@@ -102,6 +105,31 @@ function WindowControl({
|
|
|
102
105
|
})
|
|
103
106
|
});
|
|
104
107
|
}
|
|
108
|
+
let warnedUnregistered = false;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The zoom control's layouts where the platform lays windows out (`window-layout`), as its adapter
|
|
112
|
+
* registered them (`@oxy.so/bloom/window/layouts`); null elsewhere. Reported without them, the
|
|
113
|
+
* control only zooms and development says why, once.
|
|
114
|
+
*/
|
|
115
|
+
function windowLayoutsFor(enabled) {
|
|
116
|
+
if (!enabled) return null;
|
|
117
|
+
const registered = registeredWindowLayouts();
|
|
118
|
+
if (!registered && process.env.NODE_ENV !== 'production' && !warnedUnregistered) {
|
|
119
|
+
warnedUnregistered = true;
|
|
120
|
+
console.warn("[Bloom] WindowControls: the platform reports 'window-layout', but nothing imported " + "'@oxy.so/bloom/window/layouts', so the zoom control shows no layouts.");
|
|
121
|
+
}
|
|
122
|
+
return registered;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** A control's place in its group: `offset` from the group's leading edge, `top` from its top. */
|
|
126
|
+
function controlPlace(offset, top) {
|
|
127
|
+
return {
|
|
128
|
+
position: 'absolute',
|
|
129
|
+
top,
|
|
130
|
+
insetInlineStart: offset
|
|
131
|
+
};
|
|
132
|
+
}
|
|
105
133
|
|
|
106
134
|
/**
|
|
107
135
|
* The window's controls (close, minimize, zoom): three bubbles of the surface
|
|
@@ -113,6 +141,10 @@ function WindowControl({
|
|
|
113
141
|
* 88 % and springs it back as it acts. They act on the first click on an
|
|
114
142
|
* inactive window (`ACCEPTS_FIRST_MOUSE`), as a Mac's do.
|
|
115
143
|
*
|
|
144
|
+
* With the `window-layout` capability, the zoom control shows the window's layouts as the
|
|
145
|
+
* pointer rests on it, on a long press, or by its "Show menu" action, as a Mac's green button
|
|
146
|
+
* does (`WindowLayouts`); its press still zooms.
|
|
147
|
+
*
|
|
116
148
|
* Draws nothing without the `window` capability, where the platform draws its
|
|
117
149
|
* own controls (`controls: 'platform'`), and while the window is full screen.
|
|
118
150
|
*/
|
|
@@ -136,6 +168,7 @@ export function WindowControls({
|
|
|
136
168
|
onIn: onHoverIn,
|
|
137
169
|
onOut: onHoverOut
|
|
138
170
|
} = useInteractionState();
|
|
171
|
+
const WindowLayouts = windowLayoutsFor(appWindow?.layOut !== undefined);
|
|
139
172
|
if (appWindow?.controls !== 'bloom' || appWindow.fullscreen) return null;
|
|
140
173
|
const {
|
|
141
174
|
start,
|
|
@@ -207,16 +240,28 @@ export function WindowControls({
|
|
|
207
240
|
width,
|
|
208
241
|
height
|
|
209
242
|
},
|
|
210
|
-
children: controls.map((control, index) =>
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
243
|
+
children: controls.map((control, index) => {
|
|
244
|
+
const drawn = placed => /*#__PURE__*/_jsx(WindowControl, {
|
|
245
|
+
label: control.label,
|
|
246
|
+
icon: control.icon,
|
|
247
|
+
paint: control.paint,
|
|
248
|
+
offset: pitch * index,
|
|
249
|
+
top: targetTop,
|
|
250
|
+
symbols: hovered,
|
|
251
|
+
onPress: control.onPress,
|
|
252
|
+
placed: placed,
|
|
253
|
+
testID: testID ? `${testID}-${control.key}` : undefined
|
|
254
|
+
}, control.key);
|
|
255
|
+
// The zoom control shows the window's layouts, where the platform lays windows out.
|
|
256
|
+
if (control.key === 'zoom' && WindowLayouts) {
|
|
257
|
+
return /*#__PURE__*/_jsx(WindowLayouts, {
|
|
258
|
+
style: controlPlace(pitch * index, targetTop),
|
|
259
|
+
testID: testID ? `${testID}-layouts` : undefined,
|
|
260
|
+
children: drawn(false)
|
|
261
|
+
}, control.key);
|
|
262
|
+
}
|
|
263
|
+
return drawn(true);
|
|
264
|
+
})
|
|
220
265
|
})]
|
|
221
266
|
});
|
|
222
267
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Pressable","View","Animated","cancelAnimation","useAnimatedStyle","useSharedValue","useDirectionProps","RiCloseLine","RiExpandDiagonalSLine","RiSubtractLine","useMessages","animateWithSpec","SurfacePaint","useTheme","ACCEPTS_FIRST_MOUSE","WINDOW_CONTROL_DISC","WINDOW_CONTROL_PRESSED_SCALE","WINDOW_CONTROL_SYMBOL","WINDOW_CONTROL_TARGET","WINDOW_CONTROLS_PLATE_PADDING","WINDOW_MESSAGES","useWindow","usePrefersReducedMotion","useInteractionState","jsx","_jsx","jsxs","_jsxs","PRESS_IN","duration","easing","RELEASE","response","dampingRatio","AnimatedPressable","createAnimatedComponent","WindowControl","label","icon","Icon","paint","offset","top","symbols","onPress","testID","reducedMotion","scale","pressStyle","transform","value","role","accessibilityLabel","onPressIn","onPressOut","style","
|
|
1
|
+
{"version":3,"names":["Pressable","View","Animated","cancelAnimation","useAnimatedStyle","useSharedValue","useDirectionProps","RiCloseLine","RiExpandDiagonalSLine","RiSubtractLine","useMessages","animateWithSpec","SurfacePaint","useTheme","ACCEPTS_FIRST_MOUSE","WINDOW_CONTROL_DISC","WINDOW_CONTROL_PRESSED_SCALE","WINDOW_CONTROL_SYMBOL","WINDOW_CONTROL_TARGET","WINDOW_CONTROLS_PLATE_PADDING","WINDOW_MESSAGES","useWindow","registeredWindowLayouts","usePrefersReducedMotion","useInteractionState","jsx","_jsx","jsxs","_jsxs","PRESS_IN","duration","easing","RELEASE","response","dampingRatio","AnimatedPressable","createAnimatedComponent","WindowControl","label","icon","Icon","paint","offset","top","symbols","onPress","testID","placed","trigger","reducedMotion","scale","pressStyle","transform","value","role","accessibilityLabel","onPressIn","onPressOut","style","controlPlace","width","height","alignItems","justifyContent","children","borderRadius","fill","radius","undefined","accessibilityElementsHidden","importantForAccessibility","pointerEvents","opacity","symbol","warnedUnregistered","windowLayoutsFor","enabled","registered","process","env","NODE_ENV","console","warn","position","insetInlineStart","WindowControls","plate","closeLabel","minimizeLabel","zoomLabel","appWindow","messages","colors","dirProps","state","hovered","onIn","onHoverIn","onOut","onHoverOut","WindowLayouts","layOut","controls","fullscreen","start","metrics","pitch","targetTop","neutral","backgroundTertiary","textSecondary","key","close","active","error","errorForeground","minimize","warning","warningForeground","zoom","success","successForeground","pad","plateHeight","card","onPointerEnter","onPointerLeave","map","control","index","drawn"],"sourceRoot":"../../../src","sources":["window/WindowControls.tsx"],"mappings":";;AAEA,SAASA,SAAS,EAAuBC,IAAI,QAAQ,cAAc;AACnE,OAAOC,QAAQ,IACbC,eAAe,EACfC,gBAAgB,EAChBC,cAAc,QACT,yBAAyB;AAEhC,SAASC,iBAAiB,QAAQ,wBAAqB;AAEvD,S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AAEA,MAAM,GAAG,GAAGA,MAAM,UAAU,GAAGsB,SAAU;YAAAJ,QAAA,EAEhDkE,KAAK,CAAC,KAAK;UAAC,GAJRF,OAAO,CAACjB,GAKA,CAAC;QAEpB;QACA,OAAOmB,KAAK,CAAC,IAAI,CAAC;MACpB,CAAC;IAAC,CACE,CAAC;EAAA,CACH,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The zoom control's layouts, as a Mac's green button shows them since macOS 15: the pointer
|
|
5
|
+
* resting on it, a long press, or the screen reader's "Show menu" action on it opens a menu of
|
|
6
|
+
* where the window can go (Move & Resize: the halves and the quarters; Fill & Arrange: Fill,
|
|
7
|
+
* Center and the arrangements of the window with those behind it; Return to Previous Size) and,
|
|
8
|
+
* where the platform has desktops, Move to each other one. The control's own press still zooms.
|
|
9
|
+
*
|
|
10
|
+
* Bloom's `DropdownMenu` (`activation="hover"`): its rows take the arrows, typeahead and Return
|
|
11
|
+
* as any menu's, each named by its label, the menu by its own ("Window layouts").
|
|
12
|
+
*
|
|
13
|
+
* Shown only where the platform lays windows out (the `window-layout` capability) and its adapter
|
|
14
|
+
* imported `@oxy.so/bloom/window/layouts`, which registers it (`layouts-registry.ts`); the
|
|
15
|
+
* platform does it (`PlatformWindow.layOut`, `moveToDesktop`).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '../dropdown-menu';
|
|
19
|
+
import { useMessages } from "../locale/messages.js";
|
|
20
|
+
import { WINDOW_MESSAGES } from "./messages.js";
|
|
21
|
+
import { useWindow } from "./use-window.js";
|
|
22
|
+
|
|
23
|
+
/** How long the pointer rests on the zoom control before its layouts show. */
|
|
24
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
export const WINDOW_LAYOUTS_OPEN_DELAY = 500;
|
|
26
|
+
|
|
27
|
+
/** Move & Resize: the halves, then the quarters, as a Mac's menu orders them. */
|
|
28
|
+
const MOVE_AND_RESIZE = ['left', 'right', 'top', 'bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'];
|
|
29
|
+
/** Fill & Arrange: Fill and Center, then the arrangements with the windows behind. */
|
|
30
|
+
const FILL_AND_ARRANGE = ['fill', 'center', 'leftRight', 'rightLeft', 'topBottom', 'bottomTop', 'quarters'];
|
|
31
|
+
|
|
32
|
+
/** `children` (the zoom control) with the window's layouts on hover, long press and "Show menu". */
|
|
33
|
+
export function WindowLayouts({
|
|
34
|
+
children,
|
|
35
|
+
style,
|
|
36
|
+
testID
|
|
37
|
+
}) {
|
|
38
|
+
const appWindow = useWindow();
|
|
39
|
+
const {
|
|
40
|
+
messages
|
|
41
|
+
} = useMessages(WINDOW_MESSAGES);
|
|
42
|
+
const layOut = appWindow?.layOut;
|
|
43
|
+
if (!layOut) return children;
|
|
44
|
+
const {
|
|
45
|
+
desktops,
|
|
46
|
+
moveToDesktop
|
|
47
|
+
} = appWindow;
|
|
48
|
+
const others = desktops && moveToDesktop ? Array.from({
|
|
49
|
+
length: desktops.count
|
|
50
|
+
}, (_, index) => index).filter(index => index !== desktops.current) : [];
|
|
51
|
+
const row = layout => /*#__PURE__*/_jsx(DropdownMenuItem, {
|
|
52
|
+
testID: testID ? `${testID}-${layout}` : undefined,
|
|
53
|
+
onPress: () => layOut(layout),
|
|
54
|
+
children: messages[layout]
|
|
55
|
+
}, layout);
|
|
56
|
+
return /*#__PURE__*/_jsxs(DropdownMenu, {
|
|
57
|
+
activation: "hover",
|
|
58
|
+
openDelay: WINDOW_LAYOUTS_OPEN_DELAY,
|
|
59
|
+
children: [/*#__PURE__*/_jsx(DropdownMenuTrigger, {
|
|
60
|
+
asChild: true,
|
|
61
|
+
style: style,
|
|
62
|
+
children: children
|
|
63
|
+
}), /*#__PURE__*/_jsxs(DropdownMenuContent, {
|
|
64
|
+
label: messages.layouts,
|
|
65
|
+
testID: testID,
|
|
66
|
+
children: [/*#__PURE__*/_jsxs(DropdownMenuGroup, {
|
|
67
|
+
children: [/*#__PURE__*/_jsx(DropdownMenuLabel, {
|
|
68
|
+
children: messages.moveAndResize
|
|
69
|
+
}), MOVE_AND_RESIZE.map(row)]
|
|
70
|
+
}), /*#__PURE__*/_jsx(DropdownMenuSeparator, {}), /*#__PURE__*/_jsxs(DropdownMenuGroup, {
|
|
71
|
+
children: [/*#__PURE__*/_jsx(DropdownMenuLabel, {
|
|
72
|
+
children: messages.fillAndArrange
|
|
73
|
+
}), FILL_AND_ARRANGE.map(row)]
|
|
74
|
+
}), /*#__PURE__*/_jsx(DropdownMenuSeparator, {}), row('returnToPrevious'), others.length > 0 ? /*#__PURE__*/_jsx(DropdownMenuSeparator, {}) : null, others.map(desktop => /*#__PURE__*/_jsx(DropdownMenuItem, {
|
|
75
|
+
testID: testID ? `${testID}-desktop-${desktop + 1}` : undefined,
|
|
76
|
+
onPress: () => moveToDesktop?.(desktop),
|
|
77
|
+
children: messages.moveToDesktop(desktop + 1)
|
|
78
|
+
}, `desktop-${desktop}`))]
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=WindowLayouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DropdownMenu","DropdownMenuContent","DropdownMenuGroup","DropdownMenuItem","DropdownMenuLabel","DropdownMenuSeparator","DropdownMenuTrigger","useMessages","WINDOW_MESSAGES","useWindow","jsx","_jsx","jsxs","_jsxs","WINDOW_LAYOUTS_OPEN_DELAY","MOVE_AND_RESIZE","FILL_AND_ARRANGE","WindowLayouts","children","style","testID","appWindow","messages","layOut","desktops","moveToDesktop","others","Array","from","length","count","_","index","filter","current","row","layout","undefined","onPress","activation","openDelay","asChild","label","layouts","moveAndResize","map","fillAndArrange","desktop"],"sourceRoot":"../../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I,EACpDqB,MAAM,CAACmB,GAAG,CAAEE,OAAO,iBAClBpC,IAAA,CAACR,gBAAgB;QAEfiB,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,YAAY2B,OAAO,GAAG,CAAC,EAAE,GAAGV,SAAU;QAChEC,OAAO,EAAEA,CAAA,KAAMb,aAAa,GAAGsB,OAAO,CAAE;QAAA7B,QAAA,EAEvCI,QAAQ,CAACG,aAAa,CAACsB,OAAO,GAAG,CAAC;MAAC,GAJ/B,WAAWA,OAAO,EAKP,CACnB,CAAC;IAAA,CACiB,CAAC;EAAA,CACV,CAAC;AAEnB","ignoreList":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The zoom control's layouts (`WindowLayouts`) as the platform's adapter registered them, by
|
|
5
|
+
* importing `@oxy.so/bloom/window/layouts` (`layouts.ts`). `WindowControls` reads it here and
|
|
6
|
+
* never imports the menu itself: a window's controls on every other platform (a web page, a
|
|
7
|
+
* settings modal, a phone's screen) must not link Bloom's `DropdownMenu` and what a phone's sheet
|
|
8
|
+
* needs, which only a platform that lays windows out (`window-layout`) uses.
|
|
9
|
+
*
|
|
10
|
+
* `globalThis`-anchored, as `kbd/window-keys` is, so two copies of Bloom share it.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** Makes `component` the zoom control's layouts (`@oxy.so/bloom/window/layouts` calls it). */
|
|
14
|
+
export function registerWindowLayouts(component) {
|
|
15
|
+
globalThis.__oxy_so_bloom_window_layouts__ = component;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The registered layouts, or null when nothing imported `@oxy.so/bloom/window/layouts`. */
|
|
19
|
+
export function registeredWindowLayouts() {
|
|
20
|
+
return globalThis.__oxy_so_bloom_window_layouts__ ?? null;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=layouts-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["registerWindowLayouts","component","globalThis","__oxy_so_bloom_window_layouts__","registeredWindowLayouts"],"sourceRoot":"../../../src","sources":["window/layouts-registry.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA,OAAO,SAASA,qBAAqBA,CAACC,SAA4C,EAAQ;EACxFC,UAAU,CAACC,+BAA+B,GAAGF,SAAS;AACxD;;AAEA;AACA,OAAO,SAASG,uBAAuBA,CAAA,EAA6C;EAClF,OAAOF,UAAU,CAACC,+BAA+B,IAAI,IAAI;AAC3D","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `@oxy.so/bloom/window/layouts`: the zoom control's layouts (`WindowLayouts`, a Mac's green
|
|
5
|
+
* button's menu), registered for `WindowControls` as it is imported. A platform's adapter that
|
|
6
|
+
* reports `window-layout` imports it (OxyOS's does); nothing else links it.
|
|
7
|
+
*/
|
|
8
|
+
import { registerWindowLayouts } from "./layouts-registry.js";
|
|
9
|
+
import { WindowLayouts, WINDOW_LAYOUTS_OPEN_DELAY } from "./WindowLayouts.js";
|
|
10
|
+
registerWindowLayouts(WindowLayouts);
|
|
11
|
+
export { WindowLayouts, WINDOW_LAYOUTS_OPEN_DELAY };
|
|
12
|
+
//# sourceMappingURL=layouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["registerWindowLayouts","WindowLayouts","WINDOW_LAYOUTS_OPEN_DELAY"],"sourceRoot":"../../../src","sources":["window/layouts.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,qBAAqB,QAAQ,uBAAoB;AAC1D,SAASC,aAAa,EAAEC,yBAAyB,QAAQ,oBAAiB;AAE1EF,qBAAqB,CAACC,aAAa,CAAC;AAEpC,SAASA,aAAa,EAAEC,yBAAyB","ignoreList":[]}
|
|
@@ -10,6 +10,26 @@ import { defineMessages } from "../locale/messages.js";
|
|
|
10
10
|
export const WINDOW_MESSAGES = defineMessages('WINDOW_MESSAGES', {
|
|
11
11
|
close: 'Close',
|
|
12
12
|
minimize: 'Minimize',
|
|
13
|
-
zoom: 'Zoom'
|
|
13
|
+
zoom: 'Zoom',
|
|
14
|
+
layouts: 'Window layouts',
|
|
15
|
+
moveAndResize: 'Move & Resize',
|
|
16
|
+
fillAndArrange: 'Fill & Arrange',
|
|
17
|
+
fill: 'Fill',
|
|
18
|
+
center: 'Center',
|
|
19
|
+
left: 'Left',
|
|
20
|
+
right: 'Right',
|
|
21
|
+
top: 'Top',
|
|
22
|
+
bottom: 'Bottom',
|
|
23
|
+
topLeft: 'Top Left',
|
|
24
|
+
topRight: 'Top Right',
|
|
25
|
+
bottomLeft: 'Bottom Left',
|
|
26
|
+
bottomRight: 'Bottom Right',
|
|
27
|
+
leftRight: 'Left & Right',
|
|
28
|
+
rightLeft: 'Right & Left',
|
|
29
|
+
topBottom: 'Top & Bottom',
|
|
30
|
+
bottomTop: 'Bottom & Top',
|
|
31
|
+
quarters: 'Quarters',
|
|
32
|
+
returnToPrevious: 'Return to Previous Size',
|
|
33
|
+
moveToDesktop: desktop => `Move to Desktop ${desktop}`
|
|
14
34
|
});
|
|
15
35
|
//# sourceMappingURL=messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["defineMessages","WINDOW_MESSAGES","close","minimize","zoom"],"sourceRoot":"../../../src","sources":["window/messages.ts"],"mappings":";;AAAA,SAASA,cAAc,QAA6B,uBAAoB;;AAExE;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["defineMessages","WINDOW_MESSAGES","close","minimize","zoom","layouts","moveAndResize","fillAndArrange","fill","center","left","right","top","bottom","topLeft","topRight","bottomLeft","bottomRight","leftRight","rightLeft","topBottom","bottomTop","quarters","returnToPrevious","moveToDesktop","desktop"],"sourceRoot":"../../../src","sources":["window/messages.ts"],"mappings":";;AAAA,SAASA,cAAc,QAA6B,uBAAoB;;AAExE;AACA;AACA;AACA;;AA8BA,OAAO,MAAMC,eAA+C,GAAGD,cAAc,CAC3E,iBAAiB,EACjB;EACEE,KAAK,EAAE,OAAO;EACdC,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE,gBAAgB;EACzBC,aAAa,EAAE,eAAe;EAC9BC,cAAc,EAAE,gBAAgB;EAChCC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE,QAAQ;EAChBC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE,OAAO;EACdC,GAAG,EAAE,KAAK;EACVC,MAAM,EAAE,QAAQ;EAChBC,OAAO,EAAE,UAAU;EACnBC,QAAQ,EAAE,WAAW;EACrBC,UAAU,EAAE,aAAa;EACzBC,WAAW,EAAE,cAAc;EAC3BC,SAAS,EAAE,cAAc;EACzBC,SAAS,EAAE,cAAc;EACzBC,SAAS,EAAE,cAAc;EACzBC,SAAS,EAAE,cAAc;EACzBC,QAAQ,EAAE,UAAU;EACpBC,gBAAgB,EAAE,yBAAyB;EAC3CC,aAAa,EAAGC,OAAO,IAAK,mBAAmBA,OAAO;AACxD,CACF,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
|
|
4
|
-
import { usePlatformWindow } from "../platform-surface/context.js";
|
|
4
|
+
import { usePlatformWindow, usePlatformWindowLayout } from "../platform-surface/context.js";
|
|
5
5
|
import { useWindowChrome } from "./context.js";
|
|
6
6
|
const NO_ROOM = {
|
|
7
7
|
top: 0,
|
|
@@ -16,6 +16,7 @@ function unsubscribed() {}
|
|
|
16
16
|
*/
|
|
17
17
|
export function useWindow() {
|
|
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(null);
|
|
@@ -24,11 +25,16 @@ export function useWindow() {
|
|
|
24
25
|
if (!platform) return null;
|
|
25
26
|
const next = platform.getState();
|
|
26
27
|
const previous = last.current;
|
|
27
|
-
if (previous && previous.active === next.active && previous.maximized === next.maximized && previous.fullscreen === next.fullscreen) return previous;
|
|
28
|
+
if (previous && previous.active === next.active && previous.maximized === next.maximized && previous.fullscreen === next.fullscreen && previous.desktops?.count === next.desktops?.count && previous.desktops?.current === next.desktops?.current) return previous;
|
|
28
29
|
last.current = {
|
|
29
30
|
active: next.active,
|
|
30
31
|
maximized: next.maximized,
|
|
31
|
-
fullscreen: next.fullscreen
|
|
32
|
+
fullscreen: next.fullscreen,
|
|
33
|
+
...(next.desktops ? {
|
|
34
|
+
desktops: {
|
|
35
|
+
...next.desktops
|
|
36
|
+
}
|
|
37
|
+
} : null)
|
|
32
38
|
};
|
|
33
39
|
return last.current;
|
|
34
40
|
}, [platform]);
|
|
@@ -40,8 +46,14 @@ export function useWindow() {
|
|
|
40
46
|
close: () => platform.close(),
|
|
41
47
|
minimize: () => platform.minimize(),
|
|
42
48
|
zoom: () => platform.zoom(),
|
|
43
|
-
startMove: () => platform.startMove()
|
|
44
|
-
|
|
49
|
+
startMove: () => platform.startMove(),
|
|
50
|
+
...(layouts?.layOut ? {
|
|
51
|
+
layOut: layout => layouts.layOut?.(layout)
|
|
52
|
+
} : null),
|
|
53
|
+
...(layouts?.moveToDesktop ? {
|
|
54
|
+
moveToDesktop: desktop => layouts.moveToDesktop?.(desktop)
|
|
55
|
+
} : null)
|
|
56
|
+
} : null, [platform, layouts, state]);
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useCallback","useEffect","useMemo","useRef","useSyncExternalStore","usePlatformWindow","useWindowChrome","NO_ROOM","top","leading","unsubscribed","useWindow","platform","last","subscribe","listener","getSnapshot","next","getState","previous","current","active","maximized","fullscreen","state","controls","metrics","close","minimize","zoom","startMove","useWindowFullscreen","useWindowControlsRoom","appWindow","room","useWindowHeaderRoom","bound","value","Number","isFinite","Math","round","useWindowSizeLimits","limits","minWidth","minHeight","maxWidth","maxHeight","setSizeLimits"],"sourceRoot":"../../../src","sources":["window/use-window.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,oBAAoB,QAAQ,OAAO;AAErF,SAASC,iBAAiB,QAAQ,gCAA6B;
|
|
1
|
+
{"version":3,"names":["useCallback","useEffect","useMemo","useRef","useSyncExternalStore","usePlatformWindow","usePlatformWindowLayout","useWindowChrome","NO_ROOM","top","leading","unsubscribed","useWindow","platform","layouts","last","subscribe","listener","getSnapshot","next","getState","previous","current","active","maximized","fullscreen","desktops","count","state","controls","metrics","close","minimize","zoom","startMove","layOut","layout","moveToDesktop","desktop","useWindowFullscreen","useWindowControlsRoom","appWindow","room","useWindowHeaderRoom","bound","value","Number","isFinite","Math","round","useWindowSizeLimits","limits","minWidth","minHeight","maxWidth","maxHeight","setSizeLimits"],"sourceRoot":"../../../src","sources":["window/use-window.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,oBAAoB,QAAQ,OAAO;AAErF,SAASC,iBAAiB,EAAEC,uBAAuB,QAAQ,gCAA6B;AACxF,SAASC,eAAe,QAAQ,cAAW;AAI3C,MAAMC,OAA2B,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC,OAAO,EAAE;AAAE,CAAC;AAE1D,SAASC,YAAYA,CAAA,EAAG,CAAC;;AAEzB;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAAA,EAAwB;EAC/C,MAAMC,QAAQ,GAAGR,iBAAiB,CAAC,CAAC;EACpC,MAAMS,OAAO,GAAGR,uBAAuB,CAAC,CAAC;EACzC;EACA;EACA,MAAMS,IAAI,GAAGZ,MAAM,CA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AK,CAAC,SAAS,KAAK,KAAK,CAAC,YAAY,CAAC;IAC5D,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B;;;;;OAKG;IACH,KAAK,EAAE,CAAC,GAAG,EAAE,WAAW,GAAG,YAAY,KAAK,OAAO,CAAC;CACrD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,eAAe,CAuMjG;AAID;;;GAGG;AACH,wBAAgB,YAAY,IAAI,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAE7D"}
|
|
@@ -12,7 +12,7 @@ export type { BloomIconComponent } from './icons/icon-component';
|
|
|
12
12
|
export { ImageResolverProvider, useImageResolver, isImageUrl } from './image-resolver';
|
|
13
13
|
export type { ImageResolver } from './image-resolver';
|
|
14
14
|
export { PlatformSurfaceProvider, usePlatformAppearance, usePlatformAppearanceState, isDesktopPlatform, useDesktopPlatform, usePlatformEditing, usePlatformKeyboard, usePlatformMenuBar, usePlatformSurfaces, usePlatformWindow, usePopupSurface, } from './platform-surface';
|
|
15
|
-
export type { PlatformAppearance, PlatformAppearanceState, PlatformEditAction, PlatformEditing, PlatformEditingState, PlatformKeyboard, PlatformKeyEvent, PlatformModifiers, PlatformMenu, PlatformMenuBar, PlatformMenuAction, PlatformMenuItem, PlatformSurfaceAdapter, PlatformWindow, PlatformWindowMetrics, PlatformWindowSizeLimits, PlatformWindowState, PopupDismissReason, PopupSurfaceProps, SurfaceCapability, } from './platform-surface';
|
|
15
|
+
export type { PlatformAppearance, PlatformAppearanceState, PlatformEditAction, PlatformEditing, PlatformEditingState, PlatformKeyboard, PlatformKeyEvent, PlatformModifiers, PlatformMenu, PlatformMenuBar, PlatformMenuAction, PlatformMenuItem, PlatformSurfaceAdapter, PlatformWindow, PlatformWindowMetrics, PlatformWindowSizeLimits, PlatformWindowState, PlatformWindowLayout, PopupDismissReason, PopupSurfaceProps, SurfaceCapability, } from './platform-surface';
|
|
16
16
|
export { LocaleProvider, useBloomLocale, BLOOM_LANGUAGES, resolveBloomLanguage, formatBytes, formatClock, formatCompactCurrency, formatCompactNumber, formatCurrency, formatDurationText, formatInteger, formatMultiplier, formatNumber, formatPercent, formatRelativeTime, formatSignedPercent, } from './locale';
|
|
17
17
|
export type { BloomLanguage, DurationStyle, RelativeTimeOptions, RelativeTimeStyle, } from './locale';
|
|
18
18
|
export * as ImageAspectRatio from './image-aspect-ratio-cache';
|