@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.
- package/docs/adoption-matrix.mdx +4 -4
- package/docs/dropdown-menu.mdx +11 -0
- 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/dropdown-menu/DropdownMenu.js +86 -6
- package/lib/commonjs/dropdown-menu/DropdownMenu.js.map +1 -1
- package/lib/commonjs/dropdown-menu/context.js.map +1 -1
- package/lib/commonjs/floating/PopupPanel.js +17 -1
- package/lib/commonjs/floating/PopupPanel.js.map +1 -1
- package/lib/commonjs/floating/TriggerSlot.js +4 -0
- package/lib/commonjs/floating/TriggerSlot.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/dropdown-menu/DropdownMenu.js +88 -6
- package/lib/module/dropdown-menu/DropdownMenu.js.map +1 -1
- package/lib/module/dropdown-menu/context.js.map +1 -1
- package/lib/module/floating/PopupPanel.js +17 -1
- package/lib/module/floating/PopupPanel.js.map +1 -1
- package/lib/module/floating/TriggerSlot.js +4 -0
- package/lib/module/floating/TriggerSlot.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/dropdown-menu/DropdownMenu.d.ts +7 -1
- package/lib/typescript/commonjs/dropdown-menu/DropdownMenu.d.ts.map +1 -1
- package/lib/typescript/commonjs/dropdown-menu/context.d.ts +2 -0
- package/lib/typescript/commonjs/dropdown-menu/context.d.ts.map +1 -1
- package/lib/typescript/commonjs/floating/PopupPanel.d.ts +17 -4
- package/lib/typescript/commonjs/floating/PopupPanel.d.ts.map +1 -1
- package/lib/typescript/commonjs/floating/TriggerSlot.d.ts +7 -1
- package/lib/typescript/commonjs/floating/TriggerSlot.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/dropdown-menu/DropdownMenu.d.ts +7 -1
- package/lib/typescript/module/dropdown-menu/DropdownMenu.d.ts.map +1 -1
- package/lib/typescript/module/dropdown-menu/context.d.ts +2 -0
- package/lib/typescript/module/dropdown-menu/context.d.ts.map +1 -1
- package/lib/typescript/module/floating/PopupPanel.d.ts +17 -4
- package/lib/typescript/module/floating/PopupPanel.d.ts.map +1 -1
- package/lib/typescript/module/floating/TriggerSlot.d.ts +7 -1
- package/lib/typescript/module/floating/TriggerSlot.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/dropdown-menu/DropdownMenu.tsx +94 -6
- package/src/dropdown-menu/context.ts +2 -0
- package/src/floating/PopupPanel.tsx +41 -2
- package/src/floating/TriggerSlot.tsx +10 -0
- 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
|
@@ -16,6 +16,7 @@ exports.usePlatformSearch = usePlatformSearch;
|
|
|
16
16
|
exports.usePlatformSounds = usePlatformSounds;
|
|
17
17
|
exports.usePlatformSurfaces = usePlatformSurfaces;
|
|
18
18
|
exports.usePlatformWindow = usePlatformWindow;
|
|
19
|
+
exports.usePlatformWindowLayout = usePlatformWindowLayout;
|
|
19
20
|
exports.usePopupSurface = usePopupSurface;
|
|
20
21
|
var _react = require("react");
|
|
21
22
|
const PlatformSurfaceContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
@@ -56,6 +57,21 @@ function usePlatformWindow() {
|
|
|
56
57
|
return adapter.window;
|
|
57
58
|
}
|
|
58
59
|
|
|
60
|
+
/**
|
|
61
|
+
* The window's layouts when the adapter reports `window` and `window-layout` (`PlatformWindow`'s
|
|
62
|
+
* `layOut`, and `moveToDesktop` where it has desktops), otherwise null. Throws for
|
|
63
|
+
* `window-layout` without `layOut`.
|
|
64
|
+
*/
|
|
65
|
+
function usePlatformWindowLayout() {
|
|
66
|
+
const adapter = (0, _react.useContext)(PlatformSurfaceContext);
|
|
67
|
+
const window = usePlatformWindow();
|
|
68
|
+
if (!window || !adapter?.capabilities.has('window-layout')) return null;
|
|
69
|
+
if (!window.layOut) {
|
|
70
|
+
throw new Error(`Bloom: the ${adapter.platform} platform adapter reports 'window-layout' without a window's layOut.`);
|
|
71
|
+
}
|
|
72
|
+
return window;
|
|
73
|
+
}
|
|
74
|
+
|
|
59
75
|
/**
|
|
60
76
|
* The platform's menu bar when the adapter reports `menu-bar`, otherwise null
|
|
61
77
|
* (a `Menubar` draws itself in the window). An adapter that reports the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","PlatformSurfaceContext","createContext","PlatformSurfaceProvider","exports","Provider","usePlatformSurfaces","useContext","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":"
|
|
1
|
+
{"version":3,"names":["_react","require","PlatformSurfaceContext","createContext","PlatformSurfaceProvider","exports","Provider","usePlatformSurfaces","useContext","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,IAAAA,MAAA,GAAAC,OAAA;AAiBA,MAAMC,sBAAsB,gBAAG,IAAAC,oBAAa,EAAgC,IAAI,CAAC;;AAEjF;AACO,MAAMC,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAGF,sBAAsB,CAACI,QAAQ;;AA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/use-theme.js");
|
|
|
17
17
|
var _constants = require("./constants.js");
|
|
18
18
|
var _messages2 = require("./messages.js");
|
|
19
19
|
var _useWindow = require("./use-window.js");
|
|
20
|
+
var _layoutsRegistry = require("./layouts-registry.js");
|
|
20
21
|
var _usePrefersReducedMotion = require("../hooks/use-prefers-reduced-motion.js");
|
|
21
22
|
var _useInteractionState = require("../hooks/use-interaction-state.js");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -41,7 +42,9 @@ function WindowControl({
|
|
|
41
42
|
top,
|
|
42
43
|
symbols,
|
|
43
44
|
onPress,
|
|
44
|
-
testID
|
|
45
|
+
testID,
|
|
46
|
+
placed = true,
|
|
47
|
+
...trigger
|
|
45
48
|
}) {
|
|
46
49
|
const reducedMotion = (0, _usePrefersReducedMotion.usePrefersReducedMotion)();
|
|
47
50
|
const scale = (0, _reactNativeReanimated.useSharedValue)(1);
|
|
@@ -55,7 +58,10 @@ function WindowControl({
|
|
|
55
58
|
// The first click on an inactive window's bubble acts, as a Mac's do.
|
|
56
59
|
, {
|
|
57
60
|
..._constants.ACCEPTS_FIRST_MOUSE,
|
|
58
|
-
role: "button"
|
|
61
|
+
role: "button"
|
|
62
|
+
// The layouts' trigger, on the zoom control: its long press, its state and its action.
|
|
63
|
+
,
|
|
64
|
+
...trigger,
|
|
59
65
|
accessibilityLabel: label,
|
|
60
66
|
onPress: onPress,
|
|
61
67
|
onPressIn: () => {
|
|
@@ -67,10 +73,7 @@ function WindowControl({
|
|
|
67
73
|
(0, _spec.animateWithSpec)(scale, 1, RELEASE, reducedMotion);
|
|
68
74
|
},
|
|
69
75
|
testID: testID,
|
|
70
|
-
style: [{
|
|
71
|
-
position: 'absolute',
|
|
72
|
-
top,
|
|
73
|
-
insetInlineStart: offset,
|
|
76
|
+
style: [placed ? controlPlace(offset, top) : null, {
|
|
74
77
|
width: _constants.WINDOW_CONTROL_TARGET,
|
|
75
78
|
height: _constants.WINDOW_CONTROL_TARGET,
|
|
76
79
|
alignItems: 'center',
|
|
@@ -106,6 +109,31 @@ function WindowControl({
|
|
|
106
109
|
})
|
|
107
110
|
});
|
|
108
111
|
}
|
|
112
|
+
let warnedUnregistered = false;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The zoom control's layouts where the platform lays windows out (`window-layout`), as its adapter
|
|
116
|
+
* registered them (`@oxy.so/bloom/window/layouts`); null elsewhere. Reported without them, the
|
|
117
|
+
* control only zooms and development says why, once.
|
|
118
|
+
*/
|
|
119
|
+
function windowLayoutsFor(enabled) {
|
|
120
|
+
if (!enabled) return null;
|
|
121
|
+
const registered = (0, _layoutsRegistry.registeredWindowLayouts)();
|
|
122
|
+
if (!registered && process.env.NODE_ENV !== 'production' && !warnedUnregistered) {
|
|
123
|
+
warnedUnregistered = true;
|
|
124
|
+
console.warn("[Bloom] WindowControls: the platform reports 'window-layout', but nothing imported " + "'@oxy.so/bloom/window/layouts', so the zoom control shows no layouts.");
|
|
125
|
+
}
|
|
126
|
+
return registered;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** A control's place in its group: `offset` from the group's leading edge, `top` from its top. */
|
|
130
|
+
function controlPlace(offset, top) {
|
|
131
|
+
return {
|
|
132
|
+
position: 'absolute',
|
|
133
|
+
top,
|
|
134
|
+
insetInlineStart: offset
|
|
135
|
+
};
|
|
136
|
+
}
|
|
109
137
|
|
|
110
138
|
/**
|
|
111
139
|
* The window's controls (close, minimize, zoom): three bubbles of the surface
|
|
@@ -117,6 +145,10 @@ function WindowControl({
|
|
|
117
145
|
* 88 % and springs it back as it acts. They act on the first click on an
|
|
118
146
|
* inactive window (`ACCEPTS_FIRST_MOUSE`), as a Mac's do.
|
|
119
147
|
*
|
|
148
|
+
* With the `window-layout` capability, the zoom control shows the window's layouts as the
|
|
149
|
+
* pointer rests on it, on a long press, or by its "Show menu" action, as a Mac's green button
|
|
150
|
+
* does (`WindowLayouts`); its press still zooms.
|
|
151
|
+
*
|
|
120
152
|
* Draws nothing without the `window` capability, where the platform draws its
|
|
121
153
|
* own controls (`controls: 'platform'`), and while the window is full screen.
|
|
122
154
|
*/
|
|
@@ -140,6 +172,7 @@ function WindowControls({
|
|
|
140
172
|
onIn: onHoverIn,
|
|
141
173
|
onOut: onHoverOut
|
|
142
174
|
} = (0, _useInteractionState.useInteractionState)();
|
|
175
|
+
const WindowLayouts = windowLayoutsFor(appWindow?.layOut !== undefined);
|
|
143
176
|
if (appWindow?.controls !== 'bloom' || appWindow.fullscreen) return null;
|
|
144
177
|
const {
|
|
145
178
|
start,
|
|
@@ -211,16 +244,28 @@ function WindowControls({
|
|
|
211
244
|
width,
|
|
212
245
|
height
|
|
213
246
|
},
|
|
214
|
-
children: controls.map((control, index) =>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
247
|
+
children: controls.map((control, index) => {
|
|
248
|
+
const drawn = placed => /*#__PURE__*/(0, _jsxRuntime.jsx)(WindowControl, {
|
|
249
|
+
label: control.label,
|
|
250
|
+
icon: control.icon,
|
|
251
|
+
paint: control.paint,
|
|
252
|
+
offset: pitch * index,
|
|
253
|
+
top: targetTop,
|
|
254
|
+
symbols: hovered,
|
|
255
|
+
onPress: control.onPress,
|
|
256
|
+
placed: placed,
|
|
257
|
+
testID: testID ? `${testID}-${control.key}` : undefined
|
|
258
|
+
}, control.key);
|
|
259
|
+
// The zoom control shows the window's layouts, where the platform lays windows out.
|
|
260
|
+
if (control.key === 'zoom' && WindowLayouts) {
|
|
261
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(WindowLayouts, {
|
|
262
|
+
style: controlPlace(pitch * index, targetTop),
|
|
263
|
+
testID: testID ? `${testID}-layouts` : undefined,
|
|
264
|
+
children: drawn(false)
|
|
265
|
+
}, control.key);
|
|
266
|
+
}
|
|
267
|
+
return drawn(true);
|
|
268
|
+
})
|
|
224
269
|
})]
|
|
225
270
|
});
|
|
226
271
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_reactNativeReanimated","_interopRequireWildcard","_useIsRtl","_RiCloseLine","_RiExpandDiagonalSLine","_RiSubtractLine","_messages","_spec","_SurfacePaint","_useTheme","_constants","_messages2","_useWindow","_usePrefersReducedMotion","_useInteractionState","_jsxRuntime","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","PRESS_IN","duration","easing","RELEASE","response","dampingRatio","AnimatedPressable","Animated","createAnimatedComponent","Pressable","WindowControl","label","icon","Icon","paint","offset","top","symbols","onPress","testID","reducedMotion","usePrefersReducedMotion","scale","useSharedValue","pressStyle","useAnimatedStyle","transform","value","jsx","ACCEPTS_FIRST_MOUSE","role","accessibilityLabel","onPressIn","cancelAnimation","animateWithSpec","WINDOW_CONTROL_PRESSED_SCALE","onPressOut","style","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_reactNativeReanimated","_interopRequireWildcard","_useIsRtl","_RiCloseLine","_RiExpandDiagonalSLine","_RiSubtractLine","_messages","_spec","_SurfacePaint","_useTheme","_constants","_messages2","_useWindow","_layoutsRegistry","_usePrefersReducedMotion","_useInteractionState","_jsxRuntime","cache","e","t","__esModule","r","c","a","Object","defineProperty","n","__proto__","default","WeakMap","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","PRESS_IN","duration","easing","RELEASE","response","dampingRatio","AnimatedPressable","Animated","createAnimatedComponent","Pressable","WindowControl","label","icon","Icon","paint","offset","top","symbols","onPress","testID","placed","trigger","reducedMotion","usePrefersReducedMotion","scale","useSharedValue","pressStyle","useAnimatedStyle","transform","value","jsx","ACCEPTS_FIRST_MOUSE","role","accessibilityLabel","onPressIn","cancelAnimation","animateWithSpec","WINDOW_CONTROL_PRESSED_SCALE","onPressOut","style","controlPlace","width","WINDOW_CONTROL_TARGET","height","alignItems","justifyContent","children","jsxs","View","WINDOW_CONTROL_DISC","borderRadius","SurfacePaint","fill","radius","undefined","accessibilityElementsHidden","importantForAccessibility","pointerEvents","opacity","WINDOW_CONTROL_SYMBOL","symbol","warnedUnregistered","windowLayoutsFor","enabled","registered","registeredWindowLayouts","process","env","NODE_ENV","console","warn","position","insetInlineStart","WindowControls","plate","closeLabel","minimizeLabel","zoomLabel","appWindow","useWindow","messages","useMessages","WINDOW_MESSAGES","colors","useTheme","dirProps","useDirectionProps","state","hovered","onIn","onHoverIn","onOut","onHoverOut","useInteractionState","WindowLayouts","layOut","controls","fullscreen","start","metrics","pitch","targetTop","neutral","backgroundTertiary","textSecondary","key","close","RiCloseLine","active","error","errorForeground","minimize","RiSubtractLine","warning","warningForeground","zoom","RiExpandDiagonalSLine","success","successForeground","pad","WINDOW_CONTROLS_PLATE_PADDING","plateHeight","card","onPointerEnter","onPointerLeave","map","control","index","drawn"],"sourceRoot":"../../../src","sources":["window/WindowControls.tsx"],"mappings":";;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAMA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,sBAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAQA,IAAAY,UAAA,GAAAZ,OAAA;AAEA,IAAAa,UAAA,GAAAb,OAAA;AACA,IAAAc,gBAAA,GAAAd,OAAA;AACA,IAAAe,wBAAA,GAAAf,OAAA;AACA,IAAAgB,oBAAA,GAAAhB,OAAA;AAAqE,IAAAiB,WAAA,GAAAjB,OAAA;AAAA,IAAAkB,KAAA;AAAA,SAAAhB,wBAAAiB,CAAA,EAAAC,CAAA,S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,IAAK;UACnBE,KAAK,EAAEgH,OAAO,CAAChH,KAAM;UACrBC,MAAM,EAAEqF,KAAK,GAAG2B,KAAM;UACtB/G,GAAG,EAAEqF,SAAU;UACfpF,OAAO,EAAEuE,OAAQ;UACjBtE,OAAO,EAAE4G,OAAO,CAAC5G,OAAQ;UACzBE,MAAM,EAAEA,MAAO;UACfD,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,IAAI2G,OAAO,CAACrB,GAAG,EAAE,GAAGnD;QAAU,GATnDwE,OAAO,CAACrB,GAUd,CACF;QACD;QACA,IAAIqB,OAAO,CAACrB,GAAG,KAAK,MAAM,IAAIX,aAAa,EAAE;UAC3C,oBACE,IAAAlH,WAAA,CAAAkD,GAAA,EAACgE,aAAa;YAEZvD,KAAK,EAAEC,YAAY,CAAC4D,KAAK,GAAG2B,KAAK,EAAE1B,SAAS,CAAE;YAC9ClF,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,UAAU,GAAGmC,SAAU;YAAAR,QAAA,EAEhDkF,KAAK,CAAC,KAAK;UAAC,GAJRF,OAAO,CAACrB,GAKA,CAAC;QAEpB;QACA,OAAOuB,KAAK,CAAC,IAAI,CAAC;MACpB,CAAC;IAAC,CACE,CAAC;EAAA,CACH,CAAC;AAEX","ignoreList":[]}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.WINDOW_LAYOUTS_OPEN_DELAY = void 0;
|
|
7
|
+
exports.WindowLayouts = WindowLayouts;
|
|
8
|
+
var _dropdownMenu = require("../dropdown-menu");
|
|
9
|
+
var _messages = require("../locale/messages.js");
|
|
10
|
+
var _messages2 = require("./messages.js");
|
|
11
|
+
var _useWindow = require("./use-window.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
/**
|
|
14
|
+
* The zoom control's layouts, as a Mac's green button shows them since macOS 15: the pointer
|
|
15
|
+
* resting on it, a long press, or the screen reader's "Show menu" action on it opens a menu of
|
|
16
|
+
* where the window can go (Move & Resize: the halves and the quarters; Fill & Arrange: Fill,
|
|
17
|
+
* Center and the arrangements of the window with those behind it; Return to Previous Size) and,
|
|
18
|
+
* where the platform has desktops, Move to each other one. The control's own press still zooms.
|
|
19
|
+
*
|
|
20
|
+
* Bloom's `DropdownMenu` (`activation="hover"`): its rows take the arrows, typeahead and Return
|
|
21
|
+
* as any menu's, each named by its label, the menu by its own ("Window layouts").
|
|
22
|
+
*
|
|
23
|
+
* Shown only where the platform lays windows out (the `window-layout` capability) and its adapter
|
|
24
|
+
* imported `@oxy.so/bloom/window/layouts`, which registers it (`layouts-registry.ts`); the
|
|
25
|
+
* platform does it (`PlatformWindow.layOut`, `moveToDesktop`).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** How long the pointer rests on the zoom control before its layouts show. */
|
|
29
|
+
const WINDOW_LAYOUTS_OPEN_DELAY = exports.WINDOW_LAYOUTS_OPEN_DELAY = 500;
|
|
30
|
+
|
|
31
|
+
/** Move & Resize: the halves, then the quarters, as a Mac's menu orders them. */
|
|
32
|
+
const MOVE_AND_RESIZE = ['left', 'right', 'top', 'bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight'];
|
|
33
|
+
/** Fill & Arrange: Fill and Center, then the arrangements with the windows behind. */
|
|
34
|
+
const FILL_AND_ARRANGE = ['fill', 'center', 'leftRight', 'rightLeft', 'topBottom', 'bottomTop', 'quarters'];
|
|
35
|
+
|
|
36
|
+
/** `children` (the zoom control) with the window's layouts on hover, long press and "Show menu". */
|
|
37
|
+
function WindowLayouts({
|
|
38
|
+
children,
|
|
39
|
+
style,
|
|
40
|
+
testID
|
|
41
|
+
}) {
|
|
42
|
+
const appWindow = (0, _useWindow.useWindow)();
|
|
43
|
+
const {
|
|
44
|
+
messages
|
|
45
|
+
} = (0, _messages.useMessages)(_messages2.WINDOW_MESSAGES);
|
|
46
|
+
const layOut = appWindow?.layOut;
|
|
47
|
+
if (!layOut) return children;
|
|
48
|
+
const {
|
|
49
|
+
desktops,
|
|
50
|
+
moveToDesktop
|
|
51
|
+
} = appWindow;
|
|
52
|
+
const others = desktops && moveToDesktop ? Array.from({
|
|
53
|
+
length: desktops.count
|
|
54
|
+
}, (_, index) => index).filter(index => index !== desktops.current) : [];
|
|
55
|
+
const row = layout => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenuItem, {
|
|
56
|
+
testID: testID ? `${testID}-${layout}` : undefined,
|
|
57
|
+
onPress: () => layOut(layout),
|
|
58
|
+
children: messages[layout]
|
|
59
|
+
}, layout);
|
|
60
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_dropdownMenu.DropdownMenu, {
|
|
61
|
+
activation: "hover",
|
|
62
|
+
openDelay: WINDOW_LAYOUTS_OPEN_DELAY,
|
|
63
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenuTrigger, {
|
|
64
|
+
asChild: true,
|
|
65
|
+
style: style,
|
|
66
|
+
children: children
|
|
67
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_dropdownMenu.DropdownMenuContent, {
|
|
68
|
+
label: messages.layouts,
|
|
69
|
+
testID: testID,
|
|
70
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_dropdownMenu.DropdownMenuGroup, {
|
|
71
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenuLabel, {
|
|
72
|
+
children: messages.moveAndResize
|
|
73
|
+
}), MOVE_AND_RESIZE.map(row)]
|
|
74
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenuSeparator, {}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_dropdownMenu.DropdownMenuGroup, {
|
|
75
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenuLabel, {
|
|
76
|
+
children: messages.fillAndArrange
|
|
77
|
+
}), FILL_AND_ARRANGE.map(row)]
|
|
78
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenuSeparator, {}), row('returnToPrevious'), others.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenuSeparator, {}) : null, others.map(desktop => /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenuItem, {
|
|
79
|
+
testID: testID ? `${testID}-desktop-${desktop + 1}` : undefined,
|
|
80
|
+
onPress: () => moveToDesktop?.(desktop),
|
|
81
|
+
children: messages.moveToDesktop(desktop + 1)
|
|
82
|
+
}, `desktop-${desktop}`))]
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=WindowLayouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_dropdownMenu","require","_messages","_messages2","_useWindow","_jsxRuntime","WINDOW_LAYOUTS_OPEN_DELAY","exports","MOVE_AND_RESIZE","FILL_AND_ARRANGE","WindowLayouts","children","style","testID","appWindow","useWindow","messages","useMessages","WINDOW_MESSAGES","layOut","desktops","moveToDesktop","others","Array","from","length","count","_","index","filter","current","row","layout","jsx","DropdownMenuItem","undefined","onPress","jsxs","DropdownMenu","activation","openDelay","DropdownMenuTrigger","asChild","DropdownMenuContent","label","layouts","DropdownMenuGroup","DropdownMenuLabel","moveAndResize","map","DropdownMenuSeparator","fillAndArrange","desktop"],"sourceRoot":"../../../src","sources":["window/WindowLayouts.tsx"],"mappings":";;;;;;;AAeA,IAAAA,aAAA,GAAAC,OAAA;AASA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAAyC,IAAAI,WAAA,GAAAJ,OAAA;AA5BzC;AACA;AACA;AACA;AACA;AACA;AACA;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,CAAA4B,GAAA,EAACjC,aAAA,CAAAkD,qBAAqB,IAAE,CAAC,GAAG,IAAI,EACpD5B,MAAM,CAAC2B,GAAG,CAAEG,OAAO,iBAClB,IAAA/C,WAAA,CAAA4B,GAAA,EAACjC,aAAA,CAAAkC,gBAAgB;QAEfrB,MAAM,EAAEA,MAAM,GAAG,GAAGA,MAAM,YAAYuC,OAAO,GAAG,CAAC,EAAE,GAAGjB,SAAU;QAChEC,OAAO,EAAEA,CAAA,KAAMf,aAAa,GAAG+B,OAAO,CAAE;QAAAzC,QAAA,EAEvCK,QAAQ,CAACK,aAAa,CAAC+B,OAAO,GAAG,CAAC;MAAC,GAJ/B,WAAWA,OAAO,EAKP,CACnB,CAAC;IAAA,CACiB,CAAC;EAAA,CACV,CAAC;AAEnB","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.registerWindowLayouts = registerWindowLayouts;
|
|
7
|
+
exports.registeredWindowLayouts = registeredWindowLayouts;
|
|
8
|
+
/**
|
|
9
|
+
* The zoom control's layouts (`WindowLayouts`) as the platform's adapter registered them, by
|
|
10
|
+
* importing `@oxy.so/bloom/window/layouts` (`layouts.ts`). `WindowControls` reads it here and
|
|
11
|
+
* never imports the menu itself: a window's controls on every other platform (a web page, a
|
|
12
|
+
* settings modal, a phone's screen) must not link Bloom's `DropdownMenu` and what a phone's sheet
|
|
13
|
+
* needs, which only a platform that lays windows out (`window-layout`) uses.
|
|
14
|
+
*
|
|
15
|
+
* `globalThis`-anchored, as `kbd/window-keys` is, so two copies of Bloom share it.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** Makes `component` the zoom control's layouts (`@oxy.so/bloom/window/layouts` calls it). */
|
|
19
|
+
function registerWindowLayouts(component) {
|
|
20
|
+
globalThis.__oxy_so_bloom_window_layouts__ = component;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The registered layouts, or null when nothing imported `@oxy.so/bloom/window/layouts`. */
|
|
24
|
+
function registeredWindowLayouts() {
|
|
25
|
+
return globalThis.__oxy_so_bloom_window_layouts__ ?? null;
|
|
26
|
+
}
|
|
27
|
+
//# 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;AACO,SAASA,qBAAqBA,CAACC,SAA4C,EAAQ;EACxFC,UAAU,CAACC,+BAA+B,GAAGF,SAAS;AACxD;;AAEA;AACO,SAASG,uBAAuBA,CAAA,EAA6C;EAClF,OAAOF,UAAU,CAACC,+BAA+B,IAAI,IAAI;AAC3D","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "WINDOW_LAYOUTS_OPEN_DELAY", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _WindowLayouts.WINDOW_LAYOUTS_OPEN_DELAY;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "WindowLayouts", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _WindowLayouts.WindowLayouts;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _layoutsRegistry = require("./layouts-registry.js");
|
|
19
|
+
var _WindowLayouts = require("./WindowLayouts.js");
|
|
20
|
+
/**
|
|
21
|
+
* `@oxy.so/bloom/window/layouts`: the zoom control's layouts (`WindowLayouts`, a Mac's green
|
|
22
|
+
* button's menu), registered for `WindowControls` as it is imported. A platform's adapter that
|
|
23
|
+
* reports `window-layout` imports it (OxyOS's does); nothing else links it.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
(0, _layoutsRegistry.registerWindowLayouts)(_WindowLayouts.WindowLayouts);
|
|
27
|
+
//# sourceMappingURL=layouts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_layoutsRegistry","require","_WindowLayouts","registerWindowLayouts","WindowLayouts"],"sourceRoot":"../../../src","sources":["window/layouts.ts"],"mappings":";;;;;;;;;;;;;;;;;AAKA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AANA;AACA;AACA;AACA;AACA;;AAIA,IAAAE,sCAAqB,EAACC,4BAAa,CAAC","ignoreList":[]}
|
|
@@ -13,6 +13,26 @@ var _messages = require("../locale/messages.js");
|
|
|
13
13
|
const WINDOW_MESSAGES = exports.WINDOW_MESSAGES = (0, _messages.defineMessages)('WINDOW_MESSAGES', {
|
|
14
14
|
close: 'Close',
|
|
15
15
|
minimize: 'Minimize',
|
|
16
|
-
zoom: 'Zoom'
|
|
16
|
+
zoom: 'Zoom',
|
|
17
|
+
layouts: 'Window layouts',
|
|
18
|
+
moveAndResize: 'Move & Resize',
|
|
19
|
+
fillAndArrange: 'Fill & Arrange',
|
|
20
|
+
fill: 'Fill',
|
|
21
|
+
center: 'Center',
|
|
22
|
+
left: 'Left',
|
|
23
|
+
right: 'Right',
|
|
24
|
+
top: 'Top',
|
|
25
|
+
bottom: 'Bottom',
|
|
26
|
+
topLeft: 'Top Left',
|
|
27
|
+
topRight: 'Top Right',
|
|
28
|
+
bottomLeft: 'Bottom Left',
|
|
29
|
+
bottomRight: 'Bottom Right',
|
|
30
|
+
leftRight: 'Left & Right',
|
|
31
|
+
rightLeft: 'Right & Left',
|
|
32
|
+
topBottom: 'Top & Bottom',
|
|
33
|
+
bottomTop: 'Bottom & Top',
|
|
34
|
+
quarters: 'Quarters',
|
|
35
|
+
returnToPrevious: 'Return to Previous Size',
|
|
36
|
+
moveToDesktop: desktop => `Move to Desktop ${desktop}`
|
|
17
37
|
});
|
|
18
38
|
//# sourceMappingURL=messages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_messages","require","WINDOW_MESSAGES","exports","defineMessages","close","minimize","zoom"],"sourceRoot":"../../../src","sources":["window/messages.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_messages","require","WINDOW_MESSAGES","exports","defineMessages","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,IAAAA,SAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;;AA8BO,MAAMC,eAA+C,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,wBAAc,EAC3E,iBAAiB,EACjB;EACEC,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":[]}
|
|
@@ -24,6 +24,7 @@ function unsubscribed() {}
|
|
|
24
24
|
*/
|
|
25
25
|
function useWindow() {
|
|
26
26
|
const platform = (0, _context.usePlatformWindow)();
|
|
27
|
+
const layouts = (0, _context.usePlatformWindowLayout)();
|
|
27
28
|
// `useSyncExternalStore` compares snapshots by identity, so an adapter that
|
|
28
29
|
// builds a fresh object on every `getState()` must not read as a change.
|
|
29
30
|
const last = (0, _react.useRef)(null);
|
|
@@ -32,11 +33,16 @@ function useWindow() {
|
|
|
32
33
|
if (!platform) return null;
|
|
33
34
|
const next = platform.getState();
|
|
34
35
|
const previous = last.current;
|
|
35
|
-
if (previous && previous.active === next.active && previous.maximized === next.maximized && previous.fullscreen === next.fullscreen) return previous;
|
|
36
|
+
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;
|
|
36
37
|
last.current = {
|
|
37
38
|
active: next.active,
|
|
38
39
|
maximized: next.maximized,
|
|
39
|
-
fullscreen: next.fullscreen
|
|
40
|
+
fullscreen: next.fullscreen,
|
|
41
|
+
...(next.desktops ? {
|
|
42
|
+
desktops: {
|
|
43
|
+
...next.desktops
|
|
44
|
+
}
|
|
45
|
+
} : null)
|
|
40
46
|
};
|
|
41
47
|
return last.current;
|
|
42
48
|
}, [platform]);
|
|
@@ -48,8 +54,14 @@ function useWindow() {
|
|
|
48
54
|
close: () => platform.close(),
|
|
49
55
|
minimize: () => platform.minimize(),
|
|
50
56
|
zoom: () => platform.zoom(),
|
|
51
|
-
startMove: () => platform.startMove()
|
|
52
|
-
|
|
57
|
+
startMove: () => platform.startMove(),
|
|
58
|
+
...(layouts?.layOut ? {
|
|
59
|
+
layOut: layout => layouts.layOut?.(layout)
|
|
60
|
+
} : null),
|
|
61
|
+
...(layouts?.moveToDesktop ? {
|
|
62
|
+
moveToDesktop: desktop => layouts.moveToDesktop?.(desktop)
|
|
63
|
+
} : null)
|
|
64
|
+
} : null, [platform, layouts, state]);
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_context","_context2","NO_ROOM","top","leading","unsubscribed","useWindow","platform","usePlatformWindow","last","useRef","subscribe","useCallback","listener","getSnapshot","next","getState","previous","current","active","maximized","fullscreen","state","useSyncExternalStore","useMemo","controls","metrics","close","minimize","zoom","startMove","useWindowFullscreen","useWindowControlsRoom","appWindow","room","useWindowHeaderRoom","useWindowChrome","bound","value","Number","isFinite","Math","round","useWindowSizeLimits","limits","minWidth","minHeight","maxWidth","maxHeight","useEffect","setSizeLimits"],"sourceRoot":"../../../src","sources":["window/use-window.ts"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAIA,MAAMG,OAA2B,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC,OAAO,EAAE;AAAE,CAAC;AAE1D,SAASC,YAAYA,CAAA,EAAG,CAAC;;AAEzB;AACA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAAA,EAAwB;EAC/C,MAAMC,QAAQ,GAAG,IAAAC,0BAAiB,EAAC,CAAC;EACpC;EACA;EACA,MAAMC,IAAI,GAAG,IAAAC,aAAM,EAA6B,IAAI,CAAC;EACrD,MAAMC,SAAS,GAAG,IAAAC,kBAAW,EAC1BC,QAAoB,
|
|
1
|
+
{"version":3,"names":["_react","require","_context","_context2","NO_ROOM","top","leading","unsubscribed","useWindow","platform","usePlatformWindow","layouts","usePlatformWindowLayout","last","useRef","subscribe","useCallback","listener","getSnapshot","next","getState","previous","current","active","maximized","fullscreen","desktops","count","state","useSyncExternalStore","useMemo","controls","metrics","close","minimize","zoom","startMove","layOut","layout","moveToDesktop","desktop","useWindowFullscreen","useWindowControlsRoom","appWindow","room","useWindowHeaderRoom","useWindowChrome","bound","value","Number","isFinite","Math","round","useWindowSizeLimits","limits","minWidth","minHeight","maxWidth","maxHeight","useEffect","setSizeLimits"],"sourceRoot":"../../../src","sources":["window/use-window.ts"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAIA,MAAMG,OAA2B,GAAG;EAAEC,GAAG,EAAE,CAAC;EAAEC,OAAO,EAAE;AAAE,CAAC;AAE1D,SAASC,YAAYA,CAAA,EAAG,CAAC;;AAEzB;AACA;AACA;AACA;AACA;AACO,SAASC,SAASA,CAAA,EAAwB;EAC/C,MAAMC,QAAQ,GAAG,IAAAC,0BAAiB,EAAC,CAAC;EACpC,MAAMC,OAAO,GAAG,IAAAC,gCAAuB,EAAC,CAAC;EACzC;EACA;EACA,MAAMC,IAAI,GAAG,IAAAC,aAAM,EAA6B,IAAI,CAAC;EACrD,MAAMC,SAAS,GAAG,IAAAC,kBAAW,EAC1BC,QAAoB,IAAMR,QAAQ,GAAGA,QAAQ,CAACM,SAAS,CAACE,QAAQ,CAAC,GAAGV,YAAa,EAClF,CAACE,QAAQ,CACX,CAAC;EACD,MAAMS,WAAW,GAAG,IAAAF,kBAAW,EAAC,MAAkC;IAChE,IAAI,CAACP,QAAQ,EAAE,OAAO,IAAI;IAC1B,MAAMU,IAAI,GAAGV,QAAQ,CAACW,QAAQ,CAAC,CAAC;IAChC,MAAMC,QAAQ,GAAGR,IAAI,CAACS,OAAO;IAC7B,IACED,QAAQ,IACRA,QAAQ,CAACE,MAAM,KAAKJ,IAAI,CAACI,MAAM,IAC/BF,QAAQ,CAACG,SAAS,KAAKL,IAAI,CAACK,SAAS,IACrCH,QAAQ,CAACI,UAAU,KAAKN,IAAI,CA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