@liberation-data/desk 0.43.0 → 0.44.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/README.md +225 -8
- package/dist/core/hosted.d.ts +222 -0
- package/dist/core/hosted.d.ts.map +1 -0
- package/dist/core/hosted.js +166 -0
- package/dist/core/hosted.js.map +1 -0
- package/dist/core/index.d.ts +9 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +5 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/location.d.ts +8 -1
- package/dist/core/location.d.ts.map +1 -1
- package/dist/core/location.js +18 -2
- package/dist/core/location.js.map +1 -1
- package/dist/core/preferences.d.ts +27 -0
- package/dist/core/preferences.d.ts.map +1 -0
- package/dist/core/preferences.js +121 -0
- package/dist/core/preferences.js.map +1 -0
- package/dist/core/scheme.d.ts +9 -3
- package/dist/core/scheme.d.ts.map +1 -1
- package/dist/core/scheme.js +13 -4
- package/dist/core/scheme.js.map +1 -1
- package/dist/core/theme.d.ts +41 -0
- package/dist/core/theme.d.ts.map +1 -0
- package/dist/core/theme.js +56 -0
- package/dist/core/theme.js.map +1 -0
- package/dist/core/themeChange.d.ts +25 -0
- package/dist/core/themeChange.d.ts.map +1 -0
- package/dist/core/themeChange.js +49 -0
- package/dist/core/themeChange.js.map +1 -0
- package/dist/css/apps.css +35 -1
- package/dist/css/shell.css +100 -0
- package/dist/css/tokens.css +10 -0
- package/dist/desk.css +45 -1
- package/dist/fx/fx.d.ts.map +1 -1
- package/dist/fx/fx.js +7 -31
- package/dist/fx/fx.js.map +1 -1
- package/dist/host/checkChrome.d.ts +20 -0
- package/dist/host/checkChrome.d.ts.map +1 -0
- package/dist/host/checkChrome.js +219 -0
- package/dist/host/checkChrome.js.map +1 -0
- package/dist/host/checkTheme.d.ts +35 -0
- package/dist/host/checkTheme.d.ts.map +1 -0
- package/dist/host/checkTheme.js +128 -0
- package/dist/host/checkTheme.js.map +1 -0
- package/dist/host/index.d.ts +7 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +8 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/router.d.ts +99 -0
- package/dist/host/router.d.ts.map +1 -0
- package/dist/host/router.js +279 -0
- package/dist/host/router.js.map +1 -0
- package/dist/react/Dock.d.ts +23 -4
- package/dist/react/Dock.d.ts.map +1 -1
- package/dist/react/Dock.js +17 -29
- package/dist/react/Dock.js.map +1 -1
- package/dist/react/MenuBar.d.ts +1 -1
- package/dist/react/MenuBar.d.ts.map +1 -1
- package/dist/react/MenuBar.js +20 -4
- package/dist/react/MenuBar.js.map +1 -1
- package/dist/react/app.d.ts +50 -9
- package/dist/react/app.d.ts.map +1 -1
- package/dist/react/app.js +59 -13
- package/dist/react/app.js.map +1 -1
- package/dist/react/appFrame.d.ts +11 -7
- package/dist/react/appFrame.d.ts.map +1 -1
- package/dist/react/appFrame.js +24 -6
- package/dist/react/appFrame.js.map +1 -1
- package/dist/react/appPanels.d.ts +4 -1
- package/dist/react/appPanels.d.ts.map +1 -1
- package/dist/react/appPanels.js +32 -23
- package/dist/react/appPanels.js.map +1 -1
- package/dist/react/appearance.d.ts +7 -1
- package/dist/react/appearance.d.ts.map +1 -1
- package/dist/react/appearance.js +32 -53
- package/dist/react/appearance.js.map +1 -1
- package/dist/react/context.d.ts +15 -1
- package/dist/react/context.d.ts.map +1 -1
- package/dist/react/context.js +73 -14
- package/dist/react/context.js.map +1 -1
- package/dist/react/dockStatus.d.ts +19 -0
- package/dist/react/dockStatus.d.ts.map +1 -0
- package/dist/react/dockStatus.js +25 -0
- package/dist/react/dockStatus.js.map +1 -0
- package/dist/react/frameMenus.d.ts +28 -0
- package/dist/react/frameMenus.d.ts.map +1 -0
- package/dist/react/frameMenus.js +85 -0
- package/dist/react/frameMenus.js.map +1 -0
- package/dist/react/hostApp.d.ts +15 -0
- package/dist/react/hostApp.d.ts.map +1 -0
- package/dist/react/hostApp.js +77 -0
- package/dist/react/hostApp.js.map +1 -0
- package/dist/react/hostDock.d.ts +25 -0
- package/dist/react/hostDock.d.ts.map +1 -0
- package/dist/react/hostDock.js +98 -0
- package/dist/react/hostDock.js.map +1 -0
- package/dist/react/hostMenu.d.ts +2 -36
- package/dist/react/hostMenu.d.ts.map +1 -1
- package/dist/react/hostMenu.js.map +1 -1
- package/dist/react/hosted.d.ts +28 -0
- package/dist/react/hosted.d.ts.map +1 -0
- package/dist/react/hosted.js +53 -0
- package/dist/react/hosted.js.map +1 -0
- package/dist/react/index.d.ts +8 -3
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +5 -2
- package/dist/react/index.js.map +1 -1
- package/dist/react/shell.d.ts +13 -1
- package/dist/react/shell.d.ts.map +1 -1
- package/dist/react/shell.js +19 -3
- package/dist/react/shell.js.map +1 -1
- package/dist/react/windowMenus.d.ts +19 -0
- package/dist/react/windowMenus.d.ts.map +1 -0
- package/dist/react/windowMenus.js +88 -0
- package/dist/react/windowMenus.js.map +1 -0
- package/dist/shell/HostShell.d.ts +53 -0
- package/dist/shell/HostShell.d.ts.map +1 -0
- package/dist/shell/HostShell.js +116 -0
- package/dist/shell/HostShell.js.map +1 -0
- package/dist/shell/index.d.ts +7 -0
- package/dist/shell/index.d.ts.map +1 -0
- package/dist/shell/index.js +9 -0
- package/dist/shell/index.js.map +1 -0
- package/dist/shell/keys.d.ts +47 -0
- package/dist/shell/keys.d.ts.map +1 -0
- package/dist/shell/keys.js +68 -0
- package/dist/shell/keys.js.map +1 -0
- package/dist/shell/motion.d.ts +72 -0
- package/dist/shell/motion.d.ts.map +1 -0
- package/dist/shell/motion.js +118 -0
- package/dist/shell/motion.js.map +1 -0
- package/llms.txt +48 -14
- package/package.json +10 -1
- package/src/core/hosted.ts +351 -0
- package/src/core/index.ts +28 -1
- package/src/core/location.ts +23 -3
- package/src/core/preferences.ts +132 -0
- package/src/core/scheme.ts +16 -5
- package/src/core/theme.ts +91 -0
- package/src/core/themeChange.ts +59 -0
- package/src/css/apps.css +35 -1
- package/src/css/shell.css +99 -0
- package/src/css/tokens.css +10 -0
- package/src/fx/fx.ts +7 -25
- package/src/host/checkChrome.ts +257 -0
- package/src/host/checkTheme.ts +134 -0
- package/src/host/index.ts +10 -0
- package/src/host/router.ts +374 -0
- package/src/react/Dock.tsx +34 -28
- package/src/react/MenuBar.tsx +22 -4
- package/src/react/app.tsx +84 -14
- package/src/react/appFrame.tsx +39 -14
- package/src/react/appPanels.tsx +38 -25
- package/src/react/appearance.tsx +36 -45
- package/src/react/context.tsx +88 -13
- package/src/react/dockStatus.ts +42 -0
- package/src/react/frameMenus.ts +100 -0
- package/src/react/hostApp.tsx +89 -0
- package/src/react/hostDock.tsx +118 -0
- package/src/react/hostMenu.ts +3 -38
- package/src/react/hosted.tsx +65 -0
- package/src/react/index.ts +9 -2
- package/src/react/shell.tsx +30 -3
- package/src/react/windowMenus.ts +107 -0
- package/src/shell/HostShell.tsx +220 -0
- package/src/shell/index.ts +11 -0
- package/src/shell/keys.ts +101 -0
- package/src/shell/motion.ts +163 -0
package/dist/react/shell.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { Desk } from '../core/desk.js';
|
|
3
3
|
import type { Bus } from '../core/events.js';
|
|
4
|
+
import type { DeskHostBridge } from '../core/hosted.js';
|
|
4
5
|
import type { LookChoice } from '../core/look.js';
|
|
5
6
|
import type { Holdable } from '../core/services.js';
|
|
7
|
+
import type { PreferenceStore } from '../core/preferences.js';
|
|
6
8
|
import type { DeskApp } from './app.js';
|
|
9
|
+
import type { DeskTheme } from '../core/theme.js';
|
|
7
10
|
import type { DeskOptions } from '../core/types.js';
|
|
8
11
|
export interface DeskShellProps {
|
|
9
12
|
/** An existing desk. One is made from `options` when this is left out. */
|
|
@@ -19,8 +22,17 @@ export interface DeskShellProps {
|
|
|
19
22
|
readonly services?: readonly Holdable[];
|
|
20
23
|
/** What the app says about itself, for its About and its Settings. See `DeskProviderProps.app`. */
|
|
21
24
|
readonly app?: DeskApp;
|
|
25
|
+
/** Hosted mode: see `DeskProviderProps.host`. Found on `globalThis.deskHost` when left out. */
|
|
26
|
+
readonly host?: DeskHostBridge | null;
|
|
27
|
+
/** How a hosted app wears the theme it is sent. See `DeskProviderProps.onTheme`. */
|
|
28
|
+
readonly onTheme?: (theme: DeskTheme) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Where every choice Desk remembers is kept: scheme, look, sounds. This browser's localStorage when left
|
|
31
|
+
* out. Desk copies the store's values to localStorage too, for the head script's first paint.
|
|
32
|
+
*/
|
|
33
|
+
readonly preferences?: PreferenceStore;
|
|
22
34
|
readonly children: ReactNode;
|
|
23
35
|
}
|
|
24
36
|
/** Everything an app needs around it, in one component: the desk, its bus, and toasts. */
|
|
25
|
-
export declare function DeskShell({ desk, options, bus, toasts, look, services, app, children }: DeskShellProps): import("react").JSX.Element;
|
|
37
|
+
export declare function DeskShell({ desk, options, bus, toasts, look, services, app, host, onTheme, preferences, children }: DeskShellProps): import("react").JSX.Element;
|
|
26
38
|
//# sourceMappingURL=shell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/react/shell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/react/shell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,IAAI,EAA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A;CAC7B;AAKD,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAa,EAAE,IAAa,EAAE,QAAa,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,cAAc,+BAevJ"}
|
package/dist/react/shell.js
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useLayoutEffect, useState } from 'react';
|
|
3
3
|
import { createDesk } from '../core/desk.js';
|
|
4
|
+
import { setPreferenceStore } from '../core/preferences.js';
|
|
4
5
|
import { DeskProvider } from './context.js';
|
|
5
6
|
import { BusProvider } from './events.js';
|
|
6
7
|
import { ToastProvider } from './overlays.js';
|
|
8
|
+
/* The stores mounted shells were given, the latest last: it is the one in use, until its shell goes. */
|
|
9
|
+
const givenStores = [];
|
|
7
10
|
/** Everything an app needs around it, in one component: the desk, its bus, and toasts. */
|
|
8
|
-
export function DeskShell({ desk, options, bus, toasts = true, look = 'auto', services = [], app, children }) {
|
|
11
|
+
export function DeskShell({ desk, options, bus, toasts = true, look = 'auto', services = [], app, host, onTheme, preferences, children }) {
|
|
9
12
|
const [made] = useState(() => desk ?? createDesk(options));
|
|
13
|
+
useLayoutEffect(() => {
|
|
14
|
+
if (!preferences)
|
|
15
|
+
return;
|
|
16
|
+
givenStores.push(preferences);
|
|
17
|
+
setPreferenceStore(preferences);
|
|
18
|
+
return () => {
|
|
19
|
+
const inUse = givenStores.at(-1);
|
|
20
|
+
givenStores.splice(givenStores.lastIndexOf(preferences), 1);
|
|
21
|
+
if (givenStores.at(-1) !== inUse)
|
|
22
|
+
setPreferenceStore(givenStores.at(-1));
|
|
23
|
+
};
|
|
24
|
+
}, [preferences]);
|
|
10
25
|
const inner = toasts ? _jsx(ToastProvider, { children: children }) : children;
|
|
11
|
-
|
|
26
|
+
const given = { ...(app ? { app } : {}), ...(host === undefined ? {} : { host }), ...(onTheme === undefined ? {} : { onTheme }) };
|
|
27
|
+
return _jsx(DeskProvider, { desk: made, look: look, services: services, ...given, children: bus ? _jsx(BusProvider, { bus: bus, children: inner }) : inner });
|
|
12
28
|
}
|
|
13
29
|
//# sourceMappingURL=shell.js.map
|
package/dist/react/shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/react/shell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/react/shell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAM5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAK3D,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AA4B7C,wGAAwG;AACxG,MAAM,WAAW,GAAsB,EAAE,CAAA;AAEzC,0FAA0F;AAC1F,MAAM,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAkB;IACtJ,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;IAC1D,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,CAAC,WAAW;YAAE,OA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desk.js';
|
|
2
|
+
import type { WindowId } from '../core/types.js';
|
|
3
|
+
import type { Menu } from './MenuBar.js';
|
|
4
|
+
/** Adds `menus` to the bar while `window` is in front, each id prefixed with the window's. Returns a remover. */
|
|
5
|
+
export declare function addWindowMenus(desk: Desk, window: WindowId, menus: readonly Menu[]): () => void;
|
|
6
|
+
/**
|
|
7
|
+
* Menus this window adds to the bar while it has focus. Call it inside a window's content (outside one it
|
|
8
|
+
* does nothing), with a stable array (`useMemo`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function useWindowMenus(menus: readonly Menu[]): void;
|
|
11
|
+
/** The menus the window in front has added; none when nothing has focus. */
|
|
12
|
+
export declare function useFrontMenus(desk: Desk): readonly Menu[];
|
|
13
|
+
/**
|
|
14
|
+
* The app's menus with the front window's joined in, before the ones with ids `window` and `help` (or at
|
|
15
|
+
* the end). A front item asking for a shortcut the app's menus, its `status` menus or Desk use loses it.
|
|
16
|
+
* Function items stay so.
|
|
17
|
+
*/
|
|
18
|
+
export declare function joinFrontMenus(own: readonly Menu[], front: readonly Menu[], status?: readonly Menu[]): readonly Menu[];
|
|
19
|
+
//# sourceMappingURL=windowMenus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windowMenus.d.ts","sourceRoot":"","sources":["../../src/react/windowMenus.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAKhD,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,cAAc,CAAA;AA0BlD,iHAAiH;AACjH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,IAAI,CAQ/F;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,IAAI,CAI3D;AAED,4EAA4E;AAC5E,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,IAAI,EAAE,CAazD;AAeD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,MAAM,GAAE,SAAS,IAAI,EAAO,GAAG,SAAS,IAAI,EAAE,CAiB1H"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useEffect, useMemo, useSyncExternalStore } from 'react';
|
|
2
|
+
import { focusedId } from '../core/desk.js';
|
|
3
|
+
import { parseShortcut, isApplePlatform } from '../core/shortcuts.js';
|
|
4
|
+
import { warnOnce } from '../core/location.js';
|
|
5
|
+
import { DESK_SHORTCUTS } from './app.js';
|
|
6
|
+
import { useOptionalDesk, useWindowId } from './context.js';
|
|
7
|
+
const registries = new WeakMap();
|
|
8
|
+
const registryOf = (desk) => {
|
|
9
|
+
let registry = registries.get(desk);
|
|
10
|
+
if (!registry)
|
|
11
|
+
registries.set(desk, (registry = { sources: new Set(), listeners: new Set(), version: 0 }));
|
|
12
|
+
return registry;
|
|
13
|
+
};
|
|
14
|
+
const changed = (registry) => {
|
|
15
|
+
registry.version++;
|
|
16
|
+
registry.listeners.forEach(listener => listener());
|
|
17
|
+
};
|
|
18
|
+
/** Adds `menus` to the bar while `window` is in front, each id prefixed with the window's. Returns a remover. */
|
|
19
|
+
export function addWindowMenus(desk, window, menus) {
|
|
20
|
+
const registry = registryOf(desk);
|
|
21
|
+
const source = { window, menus: menus.map(menu => ({ ...menu, id: `${window}/${menu.id}` })) };
|
|
22
|
+
registry.sources.add(source);
|
|
23
|
+
changed(registry);
|
|
24
|
+
return () => {
|
|
25
|
+
if (registry.sources.delete(source))
|
|
26
|
+
changed(registry);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Menus this window adds to the bar while it has focus. Call it inside a window's content (outside one it
|
|
31
|
+
* does nothing), with a stable array (`useMemo`).
|
|
32
|
+
*/
|
|
33
|
+
export function useWindowMenus(menus) {
|
|
34
|
+
const desk = useOptionalDesk();
|
|
35
|
+
const window = useWindowId();
|
|
36
|
+
useEffect(() => (desk && window !== null && menus.length ? addWindowMenus(desk, window, menus) : undefined), [desk, window, menus]);
|
|
37
|
+
}
|
|
38
|
+
/** The menus the window in front has added; none when nothing has focus. */
|
|
39
|
+
export function useFrontMenus(desk) {
|
|
40
|
+
const registry = registryOf(desk);
|
|
41
|
+
const subscribe = (listener) => {
|
|
42
|
+
registry.listeners.add(listener);
|
|
43
|
+
const stop = desk.subscribe(listener);
|
|
44
|
+
return () => {
|
|
45
|
+
registry.listeners.delete(listener);
|
|
46
|
+
stop();
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const front = focusedId(useSyncExternalStore(desk.subscribe, desk.getState));
|
|
50
|
+
const version = useSyncExternalStore(subscribe, () => registry.version);
|
|
51
|
+
return useMemo(() => [...registry.sources].filter(s => s.window === front).flatMap(s => s.menus), [registry, front, version]);
|
|
52
|
+
}
|
|
53
|
+
/** The keys a shortcut stands for, as `matchesShortcut` reads it here: `MOD+E`, and `ctrl+e` off a Mac, are `mod+e`. */
|
|
54
|
+
const keysOf = (shortcut) => {
|
|
55
|
+
const s = parseShortcut(shortcut);
|
|
56
|
+
const apple = isApplePlatform();
|
|
57
|
+
return [s.key, s.shift, s.alt, apple && s.mod, s.ctrl || (!apple && s.mod)].join('|');
|
|
58
|
+
};
|
|
59
|
+
const shortcutsOf = (menus) => new Set([
|
|
60
|
+
...Object.keys(DESK_SHORTCUTS),
|
|
61
|
+
...menus.flatMap(m => (typeof m.items === 'function' ? m.items() : m.items)).flatMap(i => ('shortcut' in i && i.shortcut ? [i.shortcut] : [])),
|
|
62
|
+
].map(keysOf));
|
|
63
|
+
/**
|
|
64
|
+
* The app's menus with the front window's joined in, before the ones with ids `window` and `help` (or at
|
|
65
|
+
* the end). A front item asking for a shortcut the app's menus, its `status` menus or Desk use loses it.
|
|
66
|
+
* Function items stay so.
|
|
67
|
+
*/
|
|
68
|
+
export function joinFrontMenus(own, front, status = []) {
|
|
69
|
+
if (front.length === 0)
|
|
70
|
+
return own;
|
|
71
|
+
const yielding = (menu, items) => {
|
|
72
|
+
const taken = shortcutsOf([...own, ...status]);
|
|
73
|
+
return items.map(item => {
|
|
74
|
+
if (!('shortcut' in item) || !item.shortcut || !taken.has(keysOf(item.shortcut)))
|
|
75
|
+
return item;
|
|
76
|
+
warnOnce(`desk: "${item.label}" in the ${menu.label} menu asks for ${item.shortcut}, which the app uses. The app's keeps it.`);
|
|
77
|
+
const { shortcut: _taken, ...rest } = item;
|
|
78
|
+
return rest;
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const joined = front.map(menu => {
|
|
82
|
+
const { items } = menu;
|
|
83
|
+
return { ...menu, items: typeof items === 'function' ? () => yielding(menu, items()) : yielding(menu, items) };
|
|
84
|
+
});
|
|
85
|
+
const at = own.findIndex(menu => menu.id === 'window' || menu.id === 'help');
|
|
86
|
+
return at < 0 ? [...own, ...joined] : [...own.slice(0, at), ...joined, ...own.slice(at)];
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=windowMenus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windowMenus.js","sourceRoot":"","sources":["../../src/react/windowMenus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAG3C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CA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,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA;AAC1F,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CommandTarget, DeskChrome, HostDockEntry } from '../core/hosted.js';
|
|
2
|
+
import type { DeskTheme } from '../core/theme.js';
|
|
3
|
+
import type { DockEntry, DockSide } from '../react/Dock.js';
|
|
4
|
+
import type { SwitchKeys } from './keys.js';
|
|
5
|
+
/** One app the host runs, as the switcher shows it. */
|
|
6
|
+
export interface ShellWorkspace {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly title: string;
|
|
9
|
+
/** A CSS colour: the switcher entry's mark. */
|
|
10
|
+
readonly accent?: string;
|
|
11
|
+
/** An image URL or `data:` URI. */
|
|
12
|
+
readonly icon?: string;
|
|
13
|
+
/** The app whose theme every workspace wears. */
|
|
14
|
+
readonly primary?: boolean;
|
|
15
|
+
/** Running and drawn; asleep, with a snapshot; or closed, with a snapshot, until it is visited again. */
|
|
16
|
+
readonly state: 'live' | 'suspended' | 'discarded';
|
|
17
|
+
}
|
|
18
|
+
/** How the host should show a switch: the desktops slide, or (from the overview) zoom. */
|
|
19
|
+
export type SwitchHow = 'slide' | 'zoom';
|
|
20
|
+
/** The room the chrome takes on each side of the window, in CSS pixels: the apps go inside it. */
|
|
21
|
+
export interface ShellInsets {
|
|
22
|
+
readonly top: number;
|
|
23
|
+
readonly right: number;
|
|
24
|
+
readonly bottom: number;
|
|
25
|
+
readonly left: number;
|
|
26
|
+
}
|
|
27
|
+
export interface HostShellProps {
|
|
28
|
+
/** In the switcher's order: the primary first, then as the host registered them. */
|
|
29
|
+
readonly workspaces: readonly ShellWorkspace[];
|
|
30
|
+
/** The workspace on screen. Changes when the host has finished moving to another. */
|
|
31
|
+
readonly current: string;
|
|
32
|
+
/** What each app last sent of its chrome, by workspace id; missing or null until it has. */
|
|
33
|
+
readonly chrome: Readonly<Record<string, DeskChrome | null | undefined>>;
|
|
34
|
+
/** The primary's theme, applied to this page. */
|
|
35
|
+
readonly theme?: DeskTheme | null;
|
|
36
|
+
/** A picture of each workspace that isn't live, for the overview. */
|
|
37
|
+
readonly snapshots?: Readonly<Record<string, string>>;
|
|
38
|
+
/** The person asked for another workspace. */
|
|
39
|
+
readonly onSwitch: (id: string, how: SwitchHow) => void;
|
|
40
|
+
/** The person chose one of an app's items: `target` says from where, `itemId` is the app's own id for it. */
|
|
41
|
+
readonly onCommand: (appId: string, target: CommandTarget, itemId: string) => void;
|
|
42
|
+
/** The room the chrome takes, whenever it changes: bound the apps' views inside it. */
|
|
43
|
+
readonly onInsets?: (insets: ShellInsets) => void;
|
|
44
|
+
/** The switching keys; the platform's defaults if left out, none at all with null. */
|
|
45
|
+
readonly keys?: SwitchKeys | null;
|
|
46
|
+
/** How a click in the switcher switches. */
|
|
47
|
+
readonly clickSwitch?: SwitchHow;
|
|
48
|
+
readonly dockSide?: DockSide;
|
|
49
|
+
}
|
|
50
|
+
/** An app's dock entries, as data, turned back into entries the drawn dock draws; choosing one asks the host. */
|
|
51
|
+
export declare function dockFromHost(entries: readonly HostDockEntry[], choose: (itemId: string) => void): DockEntry[];
|
|
52
|
+
export declare function HostShell(props: HostShellProps): import("react").JSX.Element;
|
|
53
|
+
//# sourceMappingURL=HostShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostShell.d.ts","sourceRoot":"","sources":["../../src/shell/HostShell.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAA;AAE/F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGjD,OAAO,KAAK,EAAE,SAAS,EAAY,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAErE,O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IAC9C,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,KAAK,IAAI,CAAA;IACvD,6GAA6G;IAC7G,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAClF,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACjD,sFAAsF;IACtF,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACjC,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;CAC7B;AAKD,iHAAiH;AACjH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,SAAS,EAAE,CAgB7G;AAID,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAO9C"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { applyTheme } from '../core/theme.js';
|
|
4
|
+
import { DeskProvider } from '../react/context.js';
|
|
5
|
+
import { Dock, roveFocus } from '../react/Dock.js';
|
|
6
|
+
import { neighbour, platformOf, switchKeyAction, switchKeys } from './keys.js';
|
|
7
|
+
const imageIcon = (label, image) => image ? _jsx("img", { src: image, alt: "", draggable: false }) : _jsx("span", { className: "desk-shell-initial", children: label.slice(0, 1).toUpperCase() });
|
|
8
|
+
/** An app's dock entries, as data, turned back into entries the drawn dock draws; choosing one asks the host. */
|
|
9
|
+
export function dockFromHost(entries, choose) {
|
|
10
|
+
const item = (entry) => ({
|
|
11
|
+
id: entry.id,
|
|
12
|
+
label: entry.label,
|
|
13
|
+
icon: imageIcon(entry.label, entry.image),
|
|
14
|
+
...(entry.description === undefined ? {} : { description: entry.description }),
|
|
15
|
+
...(entry.badge === undefined ? {} : { badge: entry.badge === '' ? _jsx("span", { className: "desk-shell-dot" }) : entry.badge }),
|
|
16
|
+
...(entry.disabled ? { disabled: true } : {}),
|
|
17
|
+
status: { running: entry.running, focused: entry.focused, minimized: entry.minimized },
|
|
18
|
+
onSelect: () => choose(entry.id),
|
|
19
|
+
});
|
|
20
|
+
return entries.map((entry) => {
|
|
21
|
+
if (entry.type === 'separator')
|
|
22
|
+
return { type: 'separator', id: entry.id };
|
|
23
|
+
if (entry.type === 'item')
|
|
24
|
+
return { type: 'item', ...item(entry) };
|
|
25
|
+
return { type: 'stack', id: entry.id, label: entry.label, icon: imageIcon(entry.label, entry.image), items: entry.items.map(item) };
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const defaultKeys = () => switchKeys(platformOf(typeof navigator === 'undefined' ? '' : navigator.platform || navigator.userAgent));
|
|
29
|
+
export function HostShell(props) {
|
|
30
|
+
// Its own desk, never hosted: this page is the host's, drawing for the apps.
|
|
31
|
+
return (_jsx(DeskProvider, { host: null, look: props.theme?.look ?? 'auto', children: _jsx(Shell, { ...props }) }));
|
|
32
|
+
}
|
|
33
|
+
function Shell({ workspaces, current, chrome, theme, onSwitch, onCommand, onInsets, keys, clickSwitch = 'slide', dockSide = 'left' }) {
|
|
34
|
+
useLayoutEffect(() => {
|
|
35
|
+
if (theme)
|
|
36
|
+
applyTheme(theme);
|
|
37
|
+
}, [theme]);
|
|
38
|
+
const entries = useMemo(() => dockFromHost(chrome[current]?.dock ?? [], itemId => onCommand(current, 'dock', itemId)), [chrome, current, onCommand]);
|
|
39
|
+
// The arrived workspace's title, said once, politely: only on a change, never on first showing.
|
|
40
|
+
const [arrived, setArrived] = useState('');
|
|
41
|
+
const shown = useRef(current);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (shown.current === current)
|
|
44
|
+
return;
|
|
45
|
+
shown.current = current;
|
|
46
|
+
setArrived(workspaces.find(w => w.id === current)?.title ?? '');
|
|
47
|
+
}, [current, workspaces]);
|
|
48
|
+
// The switching keys, when this page has focus; a host catches them first when an app has it.
|
|
49
|
+
const bound = useMemo(() => (keys === null ? null : keys ?? defaultKeys()), [keys]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!bound)
|
|
52
|
+
return;
|
|
53
|
+
const onKey = (event) => {
|
|
54
|
+
const action = switchKeyAction(event, bound);
|
|
55
|
+
if (action !== 'previous' && action !== 'next')
|
|
56
|
+
return;
|
|
57
|
+
const to = neighbour(workspaces, current, action);
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
if (to)
|
|
60
|
+
onSwitch(to.id, 'slide');
|
|
61
|
+
};
|
|
62
|
+
window.addEventListener('keydown', onKey);
|
|
63
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
64
|
+
}, [bound, workspaces, current, onSwitch]);
|
|
65
|
+
const root = useRef(null);
|
|
66
|
+
useInsets(root, dockSide, onInsets);
|
|
67
|
+
return (_jsxs("div", { ref: root, className: "desk-shell", "data-dock-side": dockSide, children: [_jsx("div", { className: "desk-shell-bar", children: _jsx(Switcher, { workspaces: workspaces, current: current, onChoose: id => id !== current && onSwitch(id, clickSwitch) }) }), _jsx(Dock, { entries: entries, side: dockSide, label: `${workspaces.find(w => w.id === current)?.title ?? 'App'} dock` }), _jsx("div", { className: "desk-shell-announce", role: "status", "aria-live": "polite", children: arrived })] }));
|
|
68
|
+
}
|
|
69
|
+
function Switcher({ workspaces, current, onChoose }) {
|
|
70
|
+
// One Tab stop: the current workspace's, or the first while the current one is not listed.
|
|
71
|
+
const stop = workspaces.some(w => w.id === current) ? current : workspaces[0]?.id;
|
|
72
|
+
const toolbar = useRef(null);
|
|
73
|
+
// Arrowing moves the stop by hand; once the host has moved, it is the current workspace's again.
|
|
74
|
+
useLayoutEffect(() => {
|
|
75
|
+
toolbar.current?.querySelectorAll('button').forEach(b => (b.tabIndex = b.dataset.workspace === stop ? 0 : -1));
|
|
76
|
+
}, [stop, workspaces]);
|
|
77
|
+
return (_jsx("div", { ref: toolbar, role: "toolbar", "aria-label": "Workspaces", className: "desk-shell-switcher", onKeyDown: event => {
|
|
78
|
+
// A held modifier makes the arrow a switching key, which the page's listener handles: don't rove too.
|
|
79
|
+
if (!event.ctrlKey && !event.altKey && !event.metaKey)
|
|
80
|
+
roveFocus(event, { next: ['ArrowRight'], previous: ['ArrowLeft'] });
|
|
81
|
+
}, children: workspaces.map(w => (_jsxs("button", { type: "button", className: "desk-shell-workspace", "data-rove": true, "data-workspace": w.id, tabIndex: w.id === stop ? 0 : -1, "aria-current": w.id === current ? 'true' : undefined, "data-state": w.state, onClick: () => onChoose(w.id), children: [w.icon ? _jsx("img", { src: w.icon, alt: "", draggable: false }) : _jsx("span", { className: "desk-shell-mark", style: w.accent ? { background: w.accent } : undefined, "aria-hidden": "true" }), _jsx("span", { children: w.title })] }, w.id))) }));
|
|
82
|
+
}
|
|
83
|
+
/** Reports the room the bar and the dock take, whenever either changes size. */
|
|
84
|
+
function useInsets(root, side, onInsets) {
|
|
85
|
+
const last = useRef('');
|
|
86
|
+
useLayoutEffect(() => {
|
|
87
|
+
const el = root.current;
|
|
88
|
+
if (!el || !onInsets)
|
|
89
|
+
return;
|
|
90
|
+
const measure = () => {
|
|
91
|
+
const bounds = el.getBoundingClientRect();
|
|
92
|
+
const bar = el.querySelector('.desk-shell-bar')?.getBoundingClientRect();
|
|
93
|
+
const dock = el.querySelector('.desk-dock')?.getBoundingClientRect();
|
|
94
|
+
const gap = dock && dock.width > 0 ? 1 : 0;
|
|
95
|
+
const insets = {
|
|
96
|
+
top: Math.ceil(bar ? bar.bottom - bounds.top : 0),
|
|
97
|
+
left: side === 'left' && gap ? Math.ceil(dock.right - bounds.left) : 0,
|
|
98
|
+
right: side === 'right' && gap ? Math.ceil(bounds.right - dock.left) : 0,
|
|
99
|
+
bottom: side === 'bottom' && gap ? Math.ceil(bounds.bottom - dock.top) : 0,
|
|
100
|
+
};
|
|
101
|
+
const key = JSON.stringify(insets);
|
|
102
|
+
if (key === last.current)
|
|
103
|
+
return;
|
|
104
|
+
last.current = key;
|
|
105
|
+
onInsets(insets);
|
|
106
|
+
};
|
|
107
|
+
measure();
|
|
108
|
+
if (typeof ResizeObserver === 'undefined')
|
|
109
|
+
return;
|
|
110
|
+
const observer = new ResizeObserver(measure);
|
|
111
|
+
observer.observe(el);
|
|
112
|
+
el.querySelectorAll('.desk-shell-bar, .desk-dock').forEach(node => observer.observe(node));
|
|
113
|
+
return () => observer.disconnect();
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=HostShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HostShell.js","sourceRoot":"","sources":["../../src/shell/HostShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAG7E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAiE9E,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,KAAyB,EAAE,EAAE,CAC7D,KAAK,CAAC,CAAC,CAAC,cAAK,GAAG,EAAE,KAAK,EAAE,GAAG,EAAC,EAAE,EAAC,SAAS,EAAE,KAAK,GAAI,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,oBAAoB,YAAE,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE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,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { dockFromHost, HostShell } from './HostShell.js';
|
|
2
|
+
export type { HostShellProps, ShellInsets, ShellWorkspace, SwitchHow } from './HostShell.js';
|
|
3
|
+
export { neighbour, platformOf, switchKeyAction, switchKeys } from './keys.js';
|
|
4
|
+
export type { KeyInput, ShellPlatform, SwitchKey, SwitchKeys } from './keys.js';
|
|
5
|
+
export { animate, FADE_MS, linear, pageClock, SLIDE_MS, slideOffsets, slidePlan, spring, timerClock } from './motion.js';
|
|
6
|
+
export type { Animation, AnimateOptions, FrameClock, SlideOffsets, SlidePlan } from './motion.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shell/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AACxD,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC5F,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC9E,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC/E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxH,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The shell of a host that runs several Desk apps side by side: one dock and one switcher drawn for
|
|
3
|
+
* all of them, and the curve the host moves their views on. Only the host's own page loads it; no
|
|
4
|
+
* app does, and nothing in core or react imports it.
|
|
5
|
+
*/
|
|
6
|
+
export { dockFromHost, HostShell } from './HostShell.js';
|
|
7
|
+
export { neighbour, platformOf, switchKeyAction, switchKeys } from './keys.js';
|
|
8
|
+
export { animate, FADE_MS, linear, pageClock, SLIDE_MS, slideOffsets, slidePlan, spring, timerClock } from './motion.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shell/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAExD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE9E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** One key with its modifiers. `meta` is ⌘ on a Mac, Super (the Windows key) elsewhere. */
|
|
2
|
+
export interface SwitchKey {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
readonly ctrl?: boolean;
|
|
5
|
+
readonly alt?: boolean;
|
|
6
|
+
readonly meta?: boolean;
|
|
7
|
+
readonly shift?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** What each switching key does. */
|
|
10
|
+
export interface SwitchKeys {
|
|
11
|
+
readonly previous: SwitchKey;
|
|
12
|
+
readonly next: SwitchKey;
|
|
13
|
+
/** Opens the overview, once there is one to open. */
|
|
14
|
+
readonly overview: SwitchKey;
|
|
15
|
+
}
|
|
16
|
+
export type ShellPlatform = 'mac' | 'linux' | 'windows';
|
|
17
|
+
/**
|
|
18
|
+
* The platform, from a browser's `navigator.platform` or user agent, or a Node `process.platform`
|
|
19
|
+
* ('darwin', 'linux', 'win32').
|
|
20
|
+
*/
|
|
21
|
+
export declare function platformOf(name: string): ShellPlatform;
|
|
22
|
+
/** The default keys on a platform: Ctrl+Option on a Mac, Super+Alt on Linux, Ctrl+Alt on Windows. */
|
|
23
|
+
export declare function switchKeys(platform: ShellPlatform): SwitchKeys;
|
|
24
|
+
/** A key event from a page (`ctrlKey`…) or from Electron's `before-input-event` (`control`…). */
|
|
25
|
+
export interface KeyInput {
|
|
26
|
+
readonly key: string;
|
|
27
|
+
/** `keydown`/`keyup` from a page, `keyDown`/`keyUp` from Electron: only a key going down switches. */
|
|
28
|
+
readonly type?: string;
|
|
29
|
+
readonly ctrlKey?: boolean;
|
|
30
|
+
readonly altKey?: boolean;
|
|
31
|
+
readonly metaKey?: boolean;
|
|
32
|
+
readonly shiftKey?: boolean;
|
|
33
|
+
readonly control?: boolean;
|
|
34
|
+
readonly alt?: boolean;
|
|
35
|
+
readonly meta?: boolean;
|
|
36
|
+
readonly shift?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** What a key does, if it is one of the switching keys: modifiers must match exactly. */
|
|
39
|
+
export declare function switchKeyAction(input: KeyInput, keys: SwitchKeys): 'previous' | 'next' | 'overview' | null;
|
|
40
|
+
/**
|
|
41
|
+
* The workspace one step from `current`, in the order given (the switcher's order), or null at
|
|
42
|
+
* either end: like the OS's own workspaces, switching does not wrap round.
|
|
43
|
+
*/
|
|
44
|
+
export declare function neighbour<T extends {
|
|
45
|
+
readonly id: string;
|
|
46
|
+
}>(workspaces: readonly T[], current: string, step: 'previous' | 'next'): T | null;
|
|
47
|
+
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/shell/keys.ts"],"names":[],"mappings":"AAaA,2FAA2F;AAC3F,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,GAAG,EAAE,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,QAAQ,EAAE,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,CAO1G;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,CAAC,GAAG,IAAI,CAI3I"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* THE KEYS THAT SWITCH WORKSPACES, PER PLATFORM.
|
|
3
|
+
*
|
|
4
|
+
* Every OS has keys of its own for its own workspaces, and a host's must never fight them: macOS takes
|
|
5
|
+
* Ctrl+←/→ for Spaces and Ctrl+↑ for Mission Control; GNOME takes Ctrl+Alt+←/→ (and Super+PageUp/Down),
|
|
6
|
+
* KDE Meta+Ctrl+←/→; Windows takes Ctrl+Win+←/→ for its virtual desktops. So the defaults step around
|
|
7
|
+
* each, and a host can offer its own in Settings.
|
|
8
|
+
*
|
|
9
|
+
* A key reaches whichever view has focus, usually an app's. So a host catches these before the app
|
|
10
|
+
* does (in Electron, `before-input-event`) and asks `switchKeyAction` what the key means; the shell's
|
|
11
|
+
* own page uses the same function for the keys it sees itself.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The platform, from a browser's `navigator.platform` or user agent, or a Node `process.platform`
|
|
15
|
+
* ('darwin', 'linux', 'win32').
|
|
16
|
+
*/
|
|
17
|
+
export function platformOf(name) {
|
|
18
|
+
if (/mac|darwin|iphone|ipad/i.test(name))
|
|
19
|
+
return 'mac';
|
|
20
|
+
if (/win/i.test(name))
|
|
21
|
+
return 'windows';
|
|
22
|
+
return 'linux';
|
|
23
|
+
}
|
|
24
|
+
const arrows = (mods) => ({
|
|
25
|
+
previous: { key: 'ArrowLeft', ...mods },
|
|
26
|
+
next: { key: 'ArrowRight', ...mods },
|
|
27
|
+
overview: { key: 'ArrowUp', ...mods },
|
|
28
|
+
});
|
|
29
|
+
/** The default keys on a platform: Ctrl+Option on a Mac, Super+Alt on Linux, Ctrl+Alt on Windows. */
|
|
30
|
+
export function switchKeys(platform) {
|
|
31
|
+
switch (platform) {
|
|
32
|
+
case 'mac':
|
|
33
|
+
return arrows({ ctrl: true, alt: true });
|
|
34
|
+
case 'linux':
|
|
35
|
+
return arrows({ meta: true, alt: true });
|
|
36
|
+
case 'windows':
|
|
37
|
+
return arrows({ ctrl: true, alt: true });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const matches = (input, key) => input.key === key.key &&
|
|
41
|
+
Boolean(input.ctrlKey ?? input.control) === Boolean(key.ctrl) &&
|
|
42
|
+
Boolean(input.altKey ?? input.alt) === Boolean(key.alt) &&
|
|
43
|
+
Boolean(input.metaKey ?? input.meta) === Boolean(key.meta) &&
|
|
44
|
+
Boolean(input.shiftKey ?? input.shift) === Boolean(key.shift);
|
|
45
|
+
/** What a key does, if it is one of the switching keys: modifiers must match exactly. */
|
|
46
|
+
export function switchKeyAction(input, keys) {
|
|
47
|
+
// Electron's before-input-event sends the key's release too: one press must switch once.
|
|
48
|
+
if (/up$/i.test(input.type ?? ''))
|
|
49
|
+
return null;
|
|
50
|
+
if (matches(input, keys.previous))
|
|
51
|
+
return 'previous';
|
|
52
|
+
if (matches(input, keys.next))
|
|
53
|
+
return 'next';
|
|
54
|
+
if (matches(input, keys.overview))
|
|
55
|
+
return 'overview';
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The workspace one step from `current`, in the order given (the switcher's order), or null at
|
|
60
|
+
* either end: like the OS's own workspaces, switching does not wrap round.
|
|
61
|
+
*/
|
|
62
|
+
export function neighbour(workspaces, current, step) {
|
|
63
|
+
const index = workspaces.findIndex(w => w.id === current);
|
|
64
|
+
if (index < 0)
|
|
65
|
+
return null;
|
|
66
|
+
return workspaces[index + (step === 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