@liberation-data/desk 0.43.0 → 0.45.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 +238 -10
- package/dist/core/desk.d.ts +2 -0
- package/dist/core/desk.d.ts.map +1 -1
- package/dist/core/desk.js +11 -2
- package/dist/core/desk.js.map +1 -1
- 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/core/types.d.ts +5 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/css/apps.css +52 -1
- package/dist/css/shell.css +100 -0
- package/dist/css/tokens.css +10 -0
- package/dist/css/windows.css +28 -0
- package/dist/desk.css +90 -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/Desktop.d.ts.map +1 -1
- package/dist/react/Desktop.js +11 -14
- package/dist/react/Desktop.js.map +1 -1
- 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 +65 -12
- package/dist/react/app.d.ts.map +1 -1
- package/dist/react/app.js +79 -21
- 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 +76 -28
- 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 +25 -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 +10 -5
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +6 -3
- package/dist/react/index.js.map +1 -1
- package/dist/react/mediaQuery.d.ts +3 -0
- package/dist/react/mediaQuery.d.ts.map +1 -0
- package/dist/react/mediaQuery.js +11 -0
- package/dist/react/mediaQuery.js.map +1 -0
- 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/sidebar.d.ts +6 -1
- package/dist/react/sidebar.d.ts.map +1 -1
- package/dist/react/sidebar.js +6 -3
- package/dist/react/sidebar.js.map +1 -1
- package/dist/react/windowDescription.d.ts +7 -0
- package/dist/react/windowDescription.d.ts.map +1 -1
- package/dist/react/windowDescription.js +9 -0
- package/dist/react/windowDescription.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 +57 -20
- package/package.json +10 -1
- package/src/core/desk.ts +11 -2
- 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/core/types.ts +5 -0
- package/src/css/apps.css +52 -1
- package/src/css/shell.css +99 -0
- package/src/css/tokens.css +10 -0
- package/src/css/windows.css +28 -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/Desktop.tsx +16 -21
- package/src/react/Dock.tsx +34 -28
- package/src/react/MenuBar.tsx +22 -4
- package/src/react/app.tsx +116 -22
- package/src/react/appFrame.tsx +39 -14
- package/src/react/appPanels.tsx +102 -31
- package/src/react/appearance.tsx +36 -45
- package/src/react/context.tsx +99 -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 +12 -4
- package/src/react/mediaQuery.ts +18 -0
- package/src/react/shell.tsx +30 -3
- package/src/react/sidebar.tsx +10 -3
- package/src/react/windowDescription.ts +12 -1
- 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
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Where Desk keeps what a person chooses: the colour scheme, the look, the sounds. This browser's
|
|
3
|
+
* localStorage unless the app gives a store of its own, such as one kept with the person's account.
|
|
4
|
+
*
|
|
5
|
+
* The head script (`colorSchemeScript`) runs before any app code, so it can only read localStorage. With
|
|
6
|
+
* an app's store, Desk writes each value it reads or is told of through to localStorage under the same
|
|
7
|
+
* key: the app's store is the truth, and localStorage a copy for the first paint.
|
|
8
|
+
*/
|
|
9
|
+
import { COLOR_SCHEME_KEY, LOOK_KEY } from './scheme.js';
|
|
10
|
+
/* What storage refused, as a private window or a full one does: it applies until the page is closed. */
|
|
11
|
+
const unstored = new Map();
|
|
12
|
+
const storage = () => globalThis.localStorage;
|
|
13
|
+
function readLocal(key) {
|
|
14
|
+
let kept;
|
|
15
|
+
try {
|
|
16
|
+
kept = storage()?.getItem(key);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// Unreadable: what was kept in memory, if anything.
|
|
20
|
+
}
|
|
21
|
+
return kept ?? unstored.get(key) ?? null;
|
|
22
|
+
}
|
|
23
|
+
function writeLocal(key, value) {
|
|
24
|
+
try {
|
|
25
|
+
if (value === null)
|
|
26
|
+
storage()?.removeItem(key);
|
|
27
|
+
else
|
|
28
|
+
storage()?.setItem(key, value);
|
|
29
|
+
unstored.delete(key);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// What storage still holds is the old choice, read before this one, so it goes.
|
|
33
|
+
unstored.set(key, value);
|
|
34
|
+
try {
|
|
35
|
+
storage()?.removeItem(key);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Unreadable too: then it is never read.
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** The default: this browser's localStorage, following changes made in its other tabs. */
|
|
43
|
+
export const localPreferences = {
|
|
44
|
+
get: readLocal,
|
|
45
|
+
set: writeLocal,
|
|
46
|
+
subscribe(listener) {
|
|
47
|
+
if (typeof window === 'undefined')
|
|
48
|
+
return () => { };
|
|
49
|
+
const fromAnotherTab = (event) => listener(event.key);
|
|
50
|
+
window.addEventListener('storage', fromAnotherTab);
|
|
51
|
+
return () => window.removeEventListener('storage', fromAnotherTab);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
let store = localPreferences;
|
|
55
|
+
const listeners = new Set();
|
|
56
|
+
let unsubscribe;
|
|
57
|
+
/* Every key Desk has asked for, so a change to "any key" brings all their copies up to date, the sounds' too. */
|
|
58
|
+
const keys = new Set([COLOR_SCHEME_KEY, LOOK_KEY]);
|
|
59
|
+
/** A store's value, or undefined when it does not know yet or fails. */
|
|
60
|
+
function fromStore(key) {
|
|
61
|
+
try {
|
|
62
|
+
return store.get(key);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/* Brings this browser's copy up to the app's store, for the head script's next first paint. */
|
|
69
|
+
function copy(key) {
|
|
70
|
+
const value = fromStore(key);
|
|
71
|
+
if (store !== localPreferences && value !== undefined && value !== readLocal(key))
|
|
72
|
+
writeLocal(key, value);
|
|
73
|
+
}
|
|
74
|
+
/** Tells everything that shows a choice that it may have changed. Null: any of them. */
|
|
75
|
+
export function preferenceChanged(key) {
|
|
76
|
+
;
|
|
77
|
+
(key === null ? [...keys] : [key]).forEach(copy);
|
|
78
|
+
listeners.forEach(listener => listener(key));
|
|
79
|
+
}
|
|
80
|
+
/** A remembered choice: the store's, or this browser's copy while the store does not know yet. */
|
|
81
|
+
export function getPreference(key) {
|
|
82
|
+
keys.add(key);
|
|
83
|
+
const value = fromStore(key);
|
|
84
|
+
return value === undefined ? readLocal(key) : value;
|
|
85
|
+
}
|
|
86
|
+
/** Remembers a choice in the store, and in this browser's copy, and tells everything that shows it. */
|
|
87
|
+
export function setPreference(key, value) {
|
|
88
|
+
try {
|
|
89
|
+
store.set(key, value);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
// The store refused: this browser's copy still has it.
|
|
93
|
+
}
|
|
94
|
+
if (store !== localPreferences)
|
|
95
|
+
writeLocal(key, value);
|
|
96
|
+
preferenceChanged(key);
|
|
97
|
+
}
|
|
98
|
+
/** Called with the key when a remembered choice changes, here, in the store, or in another tab. */
|
|
99
|
+
export function subscribePreferences(listener) {
|
|
100
|
+
if (!listeners.size)
|
|
101
|
+
unsubscribe = store.subscribe?.(preferenceChanged);
|
|
102
|
+
listeners.add(listener);
|
|
103
|
+
return () => {
|
|
104
|
+
listeners.delete(listener);
|
|
105
|
+
if (listeners.size)
|
|
106
|
+
return;
|
|
107
|
+
unsubscribe?.();
|
|
108
|
+
unsubscribe = undefined;
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Keeps every choice Desk remembers in this store from now on; none puts localStorage back. `DeskShell`'s
|
|
113
|
+
* `preferences` calls it. Its keys: `COLOR_SCHEME_KEY`, `LOOK_KEY` and `createFx`'s `storageKey`.
|
|
114
|
+
*/
|
|
115
|
+
export function setPreferenceStore(next = localPreferences) {
|
|
116
|
+
unsubscribe?.();
|
|
117
|
+
store = next;
|
|
118
|
+
unsubscribe = listeners.size ? next.subscribe?.(preferenceChanged) : undefined;
|
|
119
|
+
preferenceChanged(null);
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=preferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../src/core/preferences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAcxD,wGAAwG;A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
package/dist/core/scheme.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
/** Light, dark, or the system's, which the stylesheet follows through `prefers-color-scheme`. */
|
|
2
2
|
export type ColorScheme = 'system' | 'light' | 'dark';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Where the chosen colour scheme is kept in localStorage: `light`, `dark` or `system`. Absent while the app's
|
|
5
|
+
* own default stands (`appearance.defaultScheme`, the system's unless it says otherwise).
|
|
6
|
+
*/
|
|
4
7
|
export declare const COLOR_SCHEME_KEY = "desk.scheme";
|
|
5
8
|
/** Where the chosen look is kept in localStorage: `auto`, `mac`, `gnome` or `windows`; absent while the app's own stands. */
|
|
6
9
|
export declare const LOOK_KEY = "desk.look";
|
|
7
10
|
/**
|
|
8
|
-
* For the page's `<head>`, before anything paints: the remembered scheme on the root as `data-theme`,
|
|
9
|
-
* choice does not open light for a moment while the app
|
|
11
|
+
* For the page's `<head>`, before anything paints: the remembered scheme on the root as `data-theme`, or the
|
|
12
|
+
* app's default when none is remembered, so a dark choice does not open light for a moment while the app
|
|
13
|
+
* loads. Give it the same `defaultScheme` as Appearance.
|
|
10
14
|
*/
|
|
15
|
+
export declare function colorSchemeScript(defaultScheme?: ColorScheme): string;
|
|
16
|
+
/** The head script for an app whose default is the system's scheme: `colorSchemeScript()`. */
|
|
11
17
|
export declare const COLOR_SCHEME_SCRIPT: string;
|
|
12
18
|
//# sourceMappingURL=scheme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheme.d.ts","sourceRoot":"","sources":["../../src/core/scheme.ts"],"names":[],"mappings":"AAMA,iGAAiG;AACjG,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAErD
|
|
1
|
+
{"version":3,"file":"scheme.d.ts","sourceRoot":"","sources":["../../src/core/scheme.ts"],"names":[],"mappings":"AAMA,iGAAiG;AACjG,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAErD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,gBAAgB,CAAA;AAE7C,6HAA6H;AAC7H,eAAO,MAAM,QAAQ,cAAc,CAAA;AAEnC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,GAAE,WAAsB,GAAG,MAAM,CAK/E;AAED,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,QAAsB,CAAA"}
|
package/dist/core/scheme.js
CHANGED
|
@@ -3,13 +3,22 @@
|
|
|
3
3
|
* are here, with no React, for a page's server-rendered `<head>` and for an app moving a choice it kept under
|
|
4
4
|
* a key of its own: write it to these keys once, and Appearance shows and applies it.
|
|
5
5
|
*/
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Where the chosen colour scheme is kept in localStorage: `light`, `dark` or `system`. Absent while the app's
|
|
8
|
+
* own default stands (`appearance.defaultScheme`, the system's unless it says otherwise).
|
|
9
|
+
*/
|
|
7
10
|
export const COLOR_SCHEME_KEY = 'desk.scheme';
|
|
8
11
|
/** Where the chosen look is kept in localStorage: `auto`, `mac`, `gnome` or `windows`; absent while the app's own stands. */
|
|
9
12
|
export const LOOK_KEY = 'desk.look';
|
|
10
13
|
/**
|
|
11
|
-
* For the page's `<head>`, before anything paints: the remembered scheme on the root as `data-theme`,
|
|
12
|
-
* choice does not open light for a moment while the app
|
|
14
|
+
* For the page's `<head>`, before anything paints: the remembered scheme on the root as `data-theme`, or the
|
|
15
|
+
* app's default when none is remembered, so a dark choice does not open light for a moment while the app
|
|
16
|
+
* loads. Give it the same `defaultScheme` as Appearance.
|
|
13
17
|
*/
|
|
14
|
-
export
|
|
18
|
+
export function colorSchemeScript(defaultScheme = 'system') {
|
|
19
|
+
return (`try{var s=localStorage.getItem(${JSON.stringify(COLOR_SCHEME_KEY)});if(s!="light"&&s!="dark"&&s!="system")s=${JSON.stringify(defaultScheme)};` +
|
|
20
|
+
`var r=document.documentElement;if(s=="light"||s=="dark")r.setAttribute("data-theme",s);else r.removeAttribute("data-theme")}catch(e){}`);
|
|
21
|
+
}
|
|
22
|
+
/** The head script for an app whose default is the system's scheme: `colorSchemeScript()`. */
|
|
23
|
+
export const COLOR_SCHEME_SCRIPT = colorSchemeScript();
|
|
15
24
|
//# sourceMappingURL=scheme.js.map
|
package/dist/core/scheme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheme.js","sourceRoot":"","sources":["../../src/core/scheme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH
|
|
1
|
+
{"version":3,"file":"scheme.js","sourceRoot":"","sources":["../../src/core/scheme.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAA;AAE7C,6HAA6H;AAC7H,MAAM,CAAC,MAAM,QAAQ,GAAG,WAAW,CAAA;AAEnC;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,aAAa,GAAgB,QAAQ;IACrE,OAAO,CACL,kCAAkC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,6CAA6C,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG;QAC/I,wIAAwI,CACzI,CAAA;AACH,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Look } from './look.js';
|
|
2
|
+
/** A page's palette, as a framed app gets it: which way round it is, and custom properties to set. */
|
|
3
|
+
export interface AppTheme {
|
|
4
|
+
readonly mode: 'light' | 'dark';
|
|
5
|
+
/** Custom properties, named as they will be set: `{ '--desk-accent': '#3478f6' }`. */
|
|
6
|
+
readonly tokens: Readonly<Record<string, string>>;
|
|
7
|
+
}
|
|
8
|
+
/** A font the theme uses, for a page on another origin to load. */
|
|
9
|
+
export interface ThemeFont {
|
|
10
|
+
readonly family: string;
|
|
11
|
+
/** A URL on the publisher's own origin, or a `data:` URI. */
|
|
12
|
+
readonly src: string;
|
|
13
|
+
readonly weight?: string;
|
|
14
|
+
readonly style?: 'normal' | 'italic';
|
|
15
|
+
}
|
|
16
|
+
/** A whole desk's look: an `AppTheme`, plus the platform chrome, its fonts and its wallpaper. */
|
|
17
|
+
export interface DeskTheme extends AppTheme {
|
|
18
|
+
readonly look: Look;
|
|
19
|
+
readonly fonts?: readonly ThemeFont[];
|
|
20
|
+
/** A colour or gradient; or an image: a URL or path on the publisher's origin, or a `data:` image. */
|
|
21
|
+
readonly wallpaper?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A wallpaper that names an image, rather than being a colour or gradient: a `data:` URI, a URL on any
|
|
25
|
+
* scheme with a host (an Electron app's `app://` too), or a path.
|
|
26
|
+
*/
|
|
27
|
+
export declare const isImageRef: (wallpaper: string) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The part of a theme every hosted app wears whatever else it does: light or dark, and the
|
|
30
|
+
* platform chrome. One desktop light and the next dark would look broken as they slide past each
|
|
31
|
+
* other, so these are not the app's to decline.
|
|
32
|
+
*/
|
|
33
|
+
export declare function applyThemeBasics(theme: Pick<DeskTheme, 'mode' | 'look'>, root?: HTMLElement): void;
|
|
34
|
+
/**
|
|
35
|
+
* Wears a whole theme: the basics, every token on the root, its fonts, and its wallpaper as
|
|
36
|
+
* `--desk-wallpaper`. Tokens a previous theme set and this one does not are removed, so switching
|
|
37
|
+
* back and forth leaves nothing behind. The default way a hosted app takes the theme it is sent.
|
|
38
|
+
* New colours under the same scheme and look still fire `desk-themechange`, for a canvas to repaint.
|
|
39
|
+
*/
|
|
40
|
+
export declare function applyTheme(theme: DeskTheme, root?: HTMLElement): void;
|
|
41
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/core/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAgBrC,sGAAsG;AACtG,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;IAC/B,sFAAsF;IACtF,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAClD;AAED,mEAAmE;AACnE,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,6DAA6D;IAC7D,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CACrC;AAED,iGAAiG;AACjG,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;IACnB,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,SAAS,EAAE,CAAA;IACrC,sGAAsG;IACtG,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,cAAe,MAAM,KAAG,OAA4D,CAAA;AAE3G;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,GAAE,WAAsC,GAAG,IAAI,CAK5H;AAID;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,GAAE,WAAsC,GAAG,IAAI,CAwB/F"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { themeChanged, watchThemeChanges } from './themeChange.js';
|
|
2
|
+
/**
|
|
3
|
+
* A wallpaper that names an image, rather than being a colour or gradient: a `data:` URI, a URL on any
|
|
4
|
+
* scheme with a host (an Electron app's `app://` too), or a path.
|
|
5
|
+
*/
|
|
6
|
+
export const isImageRef = (wallpaper) => /^(data:|[a-z][\w+.-]*:\/\/|\/)/i.test(wallpaper);
|
|
7
|
+
/**
|
|
8
|
+
* The part of a theme every hosted app wears whatever else it does: light or dark, and the
|
|
9
|
+
* platform chrome. One desktop light and the next dark would look broken as they slide past each
|
|
10
|
+
* other, so these are not the app's to decline.
|
|
11
|
+
*/
|
|
12
|
+
export function applyThemeBasics(theme, root = document.documentElement) {
|
|
13
|
+
watchThemeChanges(root.ownerDocument);
|
|
14
|
+
root.dataset.theme = theme.mode;
|
|
15
|
+
root.dataset.look = theme.look;
|
|
16
|
+
root.style.colorScheme = theme.mode;
|
|
17
|
+
}
|
|
18
|
+
const applied = new WeakMap();
|
|
19
|
+
/**
|
|
20
|
+
* Wears a whole theme: the basics, every token on the root, its fonts, and its wallpaper as
|
|
21
|
+
* `--desk-wallpaper`. Tokens a previous theme set and this one does not are removed, so switching
|
|
22
|
+
* back and forth leaves nothing behind. The default way a hosted app takes the theme it is sent.
|
|
23
|
+
* New colours under the same scheme and look still fire `desk-themechange`, for a canvas to repaint.
|
|
24
|
+
*/
|
|
25
|
+
export function applyTheme(theme, root = document.documentElement) {
|
|
26
|
+
const was = root.style.cssText;
|
|
27
|
+
applyThemeBasics(theme, root);
|
|
28
|
+
const before = applied.get(root);
|
|
29
|
+
for (const name of before?.tokens ?? [])
|
|
30
|
+
if (!(name in theme.tokens))
|
|
31
|
+
root.style.removeProperty(name);
|
|
32
|
+
for (const [name, value] of Object.entries(theme.tokens))
|
|
33
|
+
root.style.setProperty(name, value);
|
|
34
|
+
if (theme.wallpaper === undefined)
|
|
35
|
+
root.style.removeProperty('--desk-wallpaper');
|
|
36
|
+
else
|
|
37
|
+
root.style.setProperty('--desk-wallpaper', isImageRef(theme.wallpaper) ? `url(${JSON.stringify(theme.wallpaper)})` : theme.wallpaper);
|
|
38
|
+
const fonts = root.ownerDocument.fonts;
|
|
39
|
+
for (const face of before?.fonts ?? [])
|
|
40
|
+
fonts?.delete(face);
|
|
41
|
+
const faces = [];
|
|
42
|
+
if (fonts && typeof FontFace !== 'undefined') {
|
|
43
|
+
for (const font of theme.fonts ?? []) {
|
|
44
|
+
const face = new FontFace(font.family, `url(${JSON.stringify(font.src)})`, {
|
|
45
|
+
...(font.weight === undefined ? {} : { weight: font.weight }),
|
|
46
|
+
...(font.style === undefined ? {} : { style: font.style }),
|
|
47
|
+
});
|
|
48
|
+
fonts.add(face);
|
|
49
|
+
faces.push(face);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
applied.set(root, { tokens: Object.keys(theme.tokens), fonts: faces });
|
|
53
|
+
if (root.style.cssText !== was)
|
|
54
|
+
themeChanged(root.ownerDocument);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/core/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAuClE;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAW,EAAE,CAAC,iCAAiC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAE3G;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAuC,EAAE,IAAI,GAAgB,QAAQ,CAAC,eAAe;IACpH,iBAAiB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IACrC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAA;IAC/B,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;IAC9B,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,IAAI,CAAA;AACrC,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAiE,CAAA;AAE5F;;;;;GAKG;AAC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AI,KAAK,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;YACrC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;gBACzE,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;gBAC7D,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;aAC3D,CAAC,CAAA;YACF,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YACf,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClB,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;IACtE,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,KAAK,GAAG;QAAE,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;AAClE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Look } from './look.js';
|
|
2
|
+
/** The event's name, on `document`. */
|
|
3
|
+
export declare const THEME_CHANGE = "desk-themechange";
|
|
4
|
+
/** What a `desk-themechange` carries: the scheme and look now drawn. */
|
|
5
|
+
export interface ThemeChange {
|
|
6
|
+
readonly scheme: 'light' | 'dark';
|
|
7
|
+
readonly look: Look;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The scheme and look drawn now, read as the stylesheet reads them: `data-theme` when it is light or dark,
|
|
11
|
+
* else the system's; `data-look`, else `mac`, which is what desk.css draws without one.
|
|
12
|
+
*/
|
|
13
|
+
export declare function drawnTheme(doc?: Document): ThemeChange;
|
|
14
|
+
/**
|
|
15
|
+
* Starts firing `desk-themechange` on `doc` whenever the drawn scheme or look changes, once per change.
|
|
16
|
+
* Desk starts it when a desk mounts or a theme is applied; calling it again does nothing.
|
|
17
|
+
*/
|
|
18
|
+
export declare function watchThemeChanges(doc?: Document): void;
|
|
19
|
+
/**
|
|
20
|
+
* Fires `desk-themechange` now, if `doc` is watched, though the scheme and look are unchanged: for new
|
|
21
|
+
* colours the root's attributes don't show. Synchronous, so the observer's later look finds nothing new
|
|
22
|
+
* and a theme that also changed the scheme is still one event.
|
|
23
|
+
*/
|
|
24
|
+
export declare const themeChanged: (doc?: Document) => void;
|
|
25
|
+
//# sourceMappingURL=themeChange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeChange.d.ts","sourceRoot":"","sources":["../../src/core/themeChange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAarC,uCAAuC;AACvC,eAAO,MAAM,YAAY,qBAAqB,CAAA;AAE9C,wEAAwE;AACxE,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;IACjC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CACpB;AAID;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,GAAE,QAAmB,GAAG,WAAW,CAKhE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,QAAmB,GAAG,IAAI,CAYhE;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY,SAAS,QAAQ,KAAc,IAA+B,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* ONE EVENT FOR EVERY CHANGE TO WHAT IS DRAWN, FOR CODE OUTSIDE REACT.
|
|
3
|
+
*
|
|
4
|
+
* Code that draws its own pixels (a canvas) must repaint when the colours change. Every source of a
|
|
5
|
+
* change ends on the root: a host's theme and the person's choice stamp `data-theme`, a look stamps
|
|
6
|
+
* `data-look`, and with neither the system's scheme shows through the stylesheet's media query. So one
|
|
7
|
+
* watcher of those, not a dispatch from each path, sees them all, and fires only when the scheme or
|
|
8
|
+
* look actually drawn has changed. The one change the root's attributes don't show is a host's theme
|
|
9
|
+
* with new colours under the same scheme and look, so `applyTheme` says so itself (`themeChanged`).
|
|
10
|
+
*/
|
|
11
|
+
/** The event's name, on `document`. */
|
|
12
|
+
export const THEME_CHANGE = 'desk-themechange';
|
|
13
|
+
const checks = new WeakMap();
|
|
14
|
+
/**
|
|
15
|
+
* The scheme and look drawn now, read as the stylesheet reads them: `data-theme` when it is light or dark,
|
|
16
|
+
* else the system's; `data-look`, else `mac`, which is what desk.css draws without one.
|
|
17
|
+
*/
|
|
18
|
+
export function drawnTheme(doc = document) {
|
|
19
|
+
const root = doc.documentElement;
|
|
20
|
+
const set = root.dataset.theme;
|
|
21
|
+
const scheme = set === 'light' || set === 'dark' ? set : globalThis.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
22
|
+
return { scheme, look: root.dataset.look ?? 'mac' };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Starts firing `desk-themechange` on `doc` whenever the drawn scheme or look changes, once per change.
|
|
26
|
+
* Desk starts it when a desk mounts or a theme is applied; calling it again does nothing.
|
|
27
|
+
*/
|
|
28
|
+
export function watchThemeChanges(doc = document) {
|
|
29
|
+
if (checks.has(doc) || typeof MutationObserver === 'undefined')
|
|
30
|
+
return;
|
|
31
|
+
let last = drawnTheme(doc);
|
|
32
|
+
const check = (always) => {
|
|
33
|
+
const now = drawnTheme(doc);
|
|
34
|
+
if (!always && now.scheme === last.scheme && now.look === last.look)
|
|
35
|
+
return;
|
|
36
|
+
last = now;
|
|
37
|
+
doc.dispatchEvent(new CustomEvent(THEME_CHANGE, { detail: now }));
|
|
38
|
+
};
|
|
39
|
+
checks.set(doc, check);
|
|
40
|
+
new MutationObserver(() => check()).observe(doc.documentElement, { attributes: true, attributeFilter: ['data-theme', 'data-look'] });
|
|
41
|
+
globalThis.matchMedia?.('(prefers-color-scheme: dark)').addEventListener?.('change', () => check());
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Fires `desk-themechange` now, if `doc` is watched, though the scheme and look are unchanged: for new
|
|
45
|
+
* colours the root's attributes don't show. Synchronous, so the observer's later look finds nothing new
|
|
46
|
+
* and a theme that also changed the scheme is still one event.
|
|
47
|
+
*/
|
|
48
|
+
export const themeChanged = (doc = document) => checks.get(doc)?.(true);
|
|
49
|
+
//# sourceMappingURL=themeChange.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themeChange.js","sourceRoot":"","sources":["../../src/core/themeChange.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,uCAAuC;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAA;AAQ9C,MAAM,MAAM,GAAG,IAAI,OAAO,EAAwC,CAAA;AAElE;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,GAAG,GAAa,QAAQ;IACjD,MAAM,IAAI,GAAG,GAAG,CAAC,eAAe,CAAA;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAA;IAC9B,MAAM,MAAM,GAAG,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC,8BAA8B,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;IAC3I,OAAO,EAAE,MAAM,EAAE,IAAI,EAAG,IAAI,CAAC,OAAO,CAAC,IAAyB,IAAI,KAAK,EAAE,CAAA;AAC3E,CAAC;AAED;;;GAGG;AACH,MA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ather than filling the desk. Given a frame, it floats there. */
|
|
63
63
|
readonly mode?: WindowMode;
|
|
64
64
|
readonly frame?: Frame;
|
|
65
|
+
/**
|
|
66
|
+
* A window that is best free at a size of its own, such as a big Settings: unless the person left it filled
|
|
67
|
+
* or at a frame last time, it opens free at this size, centred and fitted to the desk.
|
|
68
|
+
*/
|
|
69
|
+
readonly size?: Size;
|
|
65
70
|
/** Where inside the window: given to a window already open, it moves there as it comes forward. */
|
|
66
71
|
readonly route?: string;
|
|
67
72
|
}
|
package/dist/core/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAA;AAE7B,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,MAAM,UAAU;AACpB,oDAAoD;AAClD;IAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClD;IAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAA;AAE/E,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,MAAM,CAAC,CAAA;AAE3C,MAAM,WAAW,SAAS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AAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAC9B"}
|
package/dist/css/apps.css
CHANGED
|
@@ -92,6 +92,30 @@
|
|
|
92
92
|
font-weight: 600;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
/* A wordmark: as wide as it is drawn, up to the panel, at a heading's height. The name stays, for screen readers. */
|
|
96
|
+
.desk-about-wordmark {
|
|
97
|
+
display: grid;
|
|
98
|
+
place-items: center;
|
|
99
|
+
max-width: 100%;
|
|
100
|
+
height: 40px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.desk-about-wordmark > svg,
|
|
104
|
+
.desk-about-wordmark > img {
|
|
105
|
+
height: 100%;
|
|
106
|
+
width: auto;
|
|
107
|
+
max-width: 100%;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.desk-about-name-hidden {
|
|
111
|
+
position: absolute;
|
|
112
|
+
width: 1px;
|
|
113
|
+
height: 1px;
|
|
114
|
+
overflow: hidden;
|
|
115
|
+
clip-path: inset(50%);
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
}
|
|
118
|
+
|
|
95
119
|
.desk-about-version,
|
|
96
120
|
.desk-about-description {
|
|
97
121
|
margin: 0;
|
|
@@ -104,10 +128,20 @@
|
|
|
104
128
|
gap: var(--desk-space-2) var(--desk-space-4);
|
|
105
129
|
}
|
|
106
130
|
|
|
107
|
-
|
|
131
|
+
/* The app's links, and a fact's: one colour for every link on the panel. */
|
|
132
|
+
.desk-about-links a,
|
|
133
|
+
.desk-about-fact-note a {
|
|
108
134
|
color: var(--desk-accent);
|
|
109
135
|
}
|
|
110
136
|
|
|
137
|
+
/* A group's heading takes a line of its own above its links. */
|
|
138
|
+
.desk-about-links-heading {
|
|
139
|
+
flex-basis: 100%;
|
|
140
|
+
margin: 0;
|
|
141
|
+
text-align: center;
|
|
142
|
+
font-weight: 500;
|
|
143
|
+
}
|
|
144
|
+
|
|
111
145
|
/*
|
|
112
146
|
* Name and value in two columns; a note sits under its value. Every section shares one grid, through
|
|
113
147
|
* subgrid, so the names are one column down the whole panel, as wide as the longest of them.
|
|
@@ -204,3 +238,20 @@
|
|
|
204
238
|
flex-direction: column;
|
|
205
239
|
gap: var(--desk-space-5);
|
|
206
240
|
}
|
|
241
|
+
|
|
242
|
+
/* A section's note, where there is no title bar to carry it: under its heading. */
|
|
243
|
+
.desk-settings-note {
|
|
244
|
+
margin: 0 0 var(--desk-space-3);
|
|
245
|
+
font-size: var(--desk-text-small);
|
|
246
|
+
color: var(--desk-muted);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* On a narrow screen, the list alone fills Settings, and Back leads a section. */
|
|
250
|
+
.desk-settings-list {
|
|
251
|
+
height: 100%;
|
|
252
|
+
overflow: auto;
|
|
253
|
+
}
|
|
254
|
+
.desk-settings-back {
|
|
255
|
+
align-self: flex-start;
|
|
256
|
+
margin-bottom: var(--desk-space-3);
|
|
257
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/* @liberation-data/desk — shell.css */
|
|
2
|
+
/*
|
|
3
|
+
* The shell of a host running several Desk apps: one dock and one switcher around their views. Not part
|
|
4
|
+
* of desk.css, since no app draws it: the host's page imports `@liberation-data/desk/css/shell.css`
|
|
5
|
+
* after desk.css.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.desk-shell {
|
|
9
|
+
position: fixed;
|
|
10
|
+
inset: 0;
|
|
11
|
+
font-family: var(--desk-font);
|
|
12
|
+
color: var(--desk-ink);
|
|
13
|
+
background: var(--desk-ground);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.desk-shell-bar {
|
|
17
|
+
display: flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
padding: var(--desk-space-2) var(--desk-space-3);
|
|
21
|
+
border-bottom: 1px solid var(--desk-rule);
|
|
22
|
+
background: var(--desk-titlebar);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.desk-shell-switcher {
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: var(--desk-space-1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.desk-shell-workspace {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: var(--desk-space-2);
|
|
34
|
+
padding: var(--desk-space-1) var(--desk-space-3);
|
|
35
|
+
border: 1px solid transparent;
|
|
36
|
+
border-radius: 999px;
|
|
37
|
+
background: none;
|
|
38
|
+
color: var(--desk-muted);
|
|
39
|
+
font: inherit;
|
|
40
|
+
font-size: var(--desk-text-small);
|
|
41
|
+
cursor: default;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.desk-shell-workspace:hover {
|
|
45
|
+
color: var(--desk-ink);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.desk-shell-workspace[aria-current="true"] {
|
|
49
|
+
border-color: var(--desk-rule);
|
|
50
|
+
background: var(--desk-surface);
|
|
51
|
+
color: var(--desk-ink);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.desk-shell-workspace:focus-visible {
|
|
55
|
+
outline: 2px solid var(--desk-accent);
|
|
56
|
+
outline-offset: 2px;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.desk-shell-workspace img,
|
|
60
|
+
.desk-shell-mark {
|
|
61
|
+
width: 14px;
|
|
62
|
+
height: 14px;
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
flex: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.desk-shell-mark {
|
|
68
|
+
background: var(--desk-accent);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Asleep or closed: there, and a visit away, but not running. */
|
|
72
|
+
.desk-shell-workspace:not([data-state="live"]) span {
|
|
73
|
+
opacity: 0.7;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.desk-shell-initial {
|
|
77
|
+
display: grid;
|
|
78
|
+
place-items: center;
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100%;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
font-size: var(--desk-text-lead);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.desk-shell-dot {
|
|
86
|
+
display: inline-block;
|
|
87
|
+
width: 8px;
|
|
88
|
+
height: 8px;
|
|
89
|
+
border-radius: 50%;
|
|
90
|
+
background: currentcolor;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.desk-shell-announce {
|
|
94
|
+
position: absolute;
|
|
95
|
+
width: 1px;
|
|
96
|
+
height: 1px;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
clip-path: inset(50%);
|
|
99
|
+
white-space: nowrap;
|
|
100
|
+
}
|
package/dist/css/tokens.css
CHANGED
|
@@ -88,6 +88,12 @@
|
|
|
88
88
|
--desk-widget-width: 200px;
|
|
89
89
|
/* Room the stage leaves at the bottom for something of the app's own. An overlay dock makes its own. */
|
|
90
90
|
--desk-inset-bottom: 0px;
|
|
91
|
+
/* An overview of workspaces: tiles over a radial haze from fog to its far edge, in the theme's own
|
|
92
|
+
colours. The ground with a trace of the accent, moved toward mid grey so it reads as haze rather
|
|
93
|
+
than as the desktop; the far edge darker; the tiles' shadow a tint, not a box-shadow. */
|
|
94
|
+
--desk-overview-fog: color-mix(in oklab, color-mix(in oklab, var(--desk-ground) 82%, var(--desk-accent) 18%) 88%, #808080);
|
|
95
|
+
--desk-overview-fog-far: color-mix(in oklab, var(--desk-overview-fog) 92%, #000);
|
|
96
|
+
--desk-overview-shadow: rgb(0 0 0 / 0.28);
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
@media (prefers-color-scheme: dark) {
|
|
@@ -119,6 +125,8 @@
|
|
|
119
125
|
--desk-code-keyword: #d2a8ff;
|
|
120
126
|
--desk-code-number: #ffab70;
|
|
121
127
|
--desk-code-key: #7cc4ff;
|
|
128
|
+
--desk-overview-fog-far: color-mix(in oklab, var(--desk-overview-fog) 90%, #000);
|
|
129
|
+
--desk-overview-shadow: rgb(0 0 0 / 0.55);
|
|
122
130
|
}
|
|
123
131
|
}
|
|
124
132
|
|
|
@@ -150,4 +158,6 @@
|
|
|
150
158
|
--desk-code-keyword: #d2a8ff;
|
|
151
159
|
--desk-code-number: #ffab70;
|
|
152
160
|
--desk-code-key: #7cc4ff;
|
|
161
|
+
--desk-overview-fog-far: color-mix(in oklab, var(--desk-overview-fog) 90%, #000);
|
|
162
|
+
--desk-overview-shadow: rgb(0 0 0 / 0.55);
|
|
153
163
|
}
|
package/dist/css/windows.css
CHANGED
|
@@ -173,6 +173,34 @@
|
|
|
173
173
|
color: var(--desk-muted);
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/* The way back from a view one step in, before the title: "‹ Settings", as a phone's navigation bar has it. */
|
|
177
|
+
.desk-window-back {
|
|
178
|
+
flex: none;
|
|
179
|
+
display: inline-flex;
|
|
180
|
+
align-items: center;
|
|
181
|
+
gap: 2px;
|
|
182
|
+
margin: 0 var(--desk-space-2) 0 0;
|
|
183
|
+
padding: 2px var(--desk-space-1);
|
|
184
|
+
border: 0;
|
|
185
|
+
border-radius: 6px;
|
|
186
|
+
background: none;
|
|
187
|
+
color: var(--desk-accent);
|
|
188
|
+
font: inherit;
|
|
189
|
+
font-size: var(--desk-text-body);
|
|
190
|
+
cursor: pointer;
|
|
191
|
+
}
|
|
192
|
+
.desk-window-back > span {
|
|
193
|
+
font-size: var(--desk-text-title);
|
|
194
|
+
line-height: 1;
|
|
195
|
+
}
|
|
196
|
+
.desk-window-back:hover {
|
|
197
|
+
background: color-mix(in oklab, var(--desk-accent) 12%, transparent);
|
|
198
|
+
}
|
|
199
|
+
.desk-window-back:focus-visible {
|
|
200
|
+
outline: 2px solid var(--desk-accent);
|
|
201
|
+
outline-offset: 1px;
|
|
202
|
+
}
|
|
203
|
+
|
|
176
204
|
.desk-window-note {
|
|
177
205
|
margin: 0 0 0 auto;
|
|
178
206
|
min-width: 0;
|