@liberation-data/desk 0.42.0 → 0.43.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 +95 -5
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/scheme.d.ts +12 -0
- package/dist/core/scheme.d.ts.map +1 -0
- package/dist/core/scheme.js +15 -0
- package/dist/core/scheme.js.map +1 -0
- package/dist/core/types.d.ts +6 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/css/apps.css +149 -0
- package/dist/css/overlays.css +6 -0
- package/dist/css/windows.css +21 -0
- package/dist/desk.css +176 -0
- package/dist/react/Desktop.d.ts.map +1 -1
- package/dist/react/Desktop.js +13 -2
- package/dist/react/Desktop.js.map +1 -1
- package/dist/react/Dock.d.ts +6 -1
- package/dist/react/Dock.d.ts.map +1 -1
- package/dist/react/Dock.js +9 -1
- 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 +19 -5
- package/dist/react/MenuBar.js.map +1 -1
- package/dist/react/app.d.ts +174 -0
- package/dist/react/app.d.ts.map +1 -0
- package/dist/react/app.js +146 -0
- package/dist/react/app.js.map +1 -0
- package/dist/react/appPanels.d.ts +22 -0
- package/dist/react/appPanels.d.ts.map +1 -0
- package/dist/react/appPanels.js +114 -0
- package/dist/react/appPanels.js.map +1 -0
- package/dist/react/appearance.d.ts +55 -0
- package/dist/react/appearance.d.ts.map +1 -0
- package/dist/react/appearance.js +140 -0
- package/dist/react/appearance.js.map +1 -0
- package/dist/react/codeBlock.d.ts.map +1 -1
- package/dist/react/codeBlock.js +6 -60
- package/dist/react/codeBlock.js.map +1 -1
- package/dist/react/context.d.ts +9 -1
- package/dist/react/context.d.ts.map +1 -1
- package/dist/react/context.js +47 -3
- package/dist/react/context.js.map +1 -1
- package/dist/react/copy.d.ts +22 -0
- package/dist/react/copy.d.ts.map +1 -0
- package/dist/react/copy.js +68 -0
- package/dist/react/copy.js.map +1 -0
- package/dist/react/documentTitle.d.ts.map +1 -1
- package/dist/react/documentTitle.js +4 -1
- package/dist/react/documentTitle.js.map +1 -1
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +5 -0
- package/dist/react/index.js.map +1 -1
- package/dist/react/layers.d.ts.map +1 -1
- package/dist/react/layers.js +7 -2
- package/dist/react/layers.js.map +1 -1
- package/dist/react/overlays.d.ts.map +1 -1
- package/dist/react/overlays.js +29 -12
- package/dist/react/overlays.js.map +1 -1
- package/dist/react/shell.d.ts +4 -1
- package/dist/react/shell.d.ts.map +1 -1
- package/dist/react/shell.js +2 -2
- package/dist/react/shell.js.map +1 -1
- package/llms.txt +46 -5
- package/package.json +1 -1
- package/src/core/index.ts +2 -0
- package/src/core/scheme.ts +21 -0
- package/src/core/types.ts +6 -0
- package/src/css/apps.css +149 -0
- package/src/css/overlays.css +6 -0
- package/src/css/windows.css +21 -0
- package/src/react/Desktop.tsx +21 -3
- package/src/react/Dock.tsx +11 -1
- package/src/react/MenuBar.tsx +20 -5
- package/src/react/app.tsx +284 -0
- package/src/react/appPanels.tsx +197 -0
- package/src/react/appearance.tsx +204 -0
- package/src/react/codeBlock.tsx +7 -65
- package/src/react/context.tsx +55 -3
- package/src/react/copy.ts +81 -0
- package/src/react/documentTitle.ts +4 -1
- package/src/react/index.ts +27 -0
- package/src/react/layers.ts +7 -2
- package/src/react/overlays.tsx +30 -12
- package/src/react/shell.tsx +5 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/react/app.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;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AAI,KAAG,IAAqC,CAAA;AAE5E,kFAAkF;AAClF,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAIlF;AAaD;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,SAAwD,CAAA;AAExF,4GAA4G;AAC5G,eAAO,MAAM,YAAY,WAAW,CAAA;AAEpC,KAAK,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAA;AAE/D;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,SAAS,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,EAAE,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,IAAI,CAAA;CAAE,GAAG,MAAM,EAAE,CAcjJ;AAID;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,IAAI,GAAG,IAAI,EAAE,CAa5G"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
import { isOpen } from '../core/desk.js';
|
|
4
|
+
import { bindShortcuts } from '../core/shortcuts.js';
|
|
5
|
+
/** The window Desk opens for Settings. An app that declares settings without an `open` of its own gives this id to Desk. */
|
|
6
|
+
export const SETTINGS_WINDOW = 'settings';
|
|
7
|
+
/** The window Desk opens for About. An app that declares itself gives this id to Desk. */
|
|
8
|
+
export const ABOUT_WINDOW = 'about';
|
|
9
|
+
/** The command "Settings…" and ⌘, perform. It answers at the top of the chain while the app has settings. */
|
|
10
|
+
export const SettingsCommand = 'desk.settings';
|
|
11
|
+
/*
|
|
12
|
+
* ⌘, is bound on the command itself, so it opens Settings in an app with no MenuBar. A menu item for one of
|
|
13
|
+
* these shows the shortcut and leaves the binding to this, so one press is one command. A host's native menu
|
|
14
|
+
* bar that gives the shortcut a key of its own takes it over while it is up, so the page does not do it too.
|
|
15
|
+
*/
|
|
16
|
+
const DESK_SHORTCUTS = { 'mod+comma': SettingsCommand };
|
|
17
|
+
const hostOwns = new WeakMap();
|
|
18
|
+
/** Whether a menu item's shortcut is one Desk binds on the command already, so the menu only shows it. */
|
|
19
|
+
export const boundByDesk = (shortcut, command) => DESK_SHORTCUTS[shortcut] === command;
|
|
20
|
+
/** Binds Desk's own shortcuts on this desk, less those a host's menu bar owns. Returns a function that unbinds them. */
|
|
21
|
+
export const bindDeskShortcuts = (desk) => bindShortcuts(desk, () => Object.fromEntries(Object.entries(DESK_SHORTCUTS).filter(([shortcut]) => !hostOwns.get(desk)?.(shortcut))));
|
|
22
|
+
/** While a host's menu bar is up, it gives these shortcuts their keys, so Desk leaves them alone. Returns a function that hands them back. */
|
|
23
|
+
export function hostOwnsShortcuts(desk, owns) {
|
|
24
|
+
hostOwns.set(desk, owns);
|
|
25
|
+
return () => {
|
|
26
|
+
if (hostOwns.get(desk) === owns)
|
|
27
|
+
hostOwns.delete(desk);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Panels have one size: the desk centres them, filled or not. About is one, and Settings on one page. */
|
|
31
|
+
export const PANEL_LIMITS = { minWidth: 360, minHeight: 200, maxWidth: 560, maxHeight: 560, fitContent: true };
|
|
32
|
+
/** The sidebar layout of Settings is bigger, for many sections and the list of them. */
|
|
33
|
+
export const SIDEBAR_LIMITS = { minWidth: 600, minHeight: 400, maxWidth: 880, maxHeight: 640 };
|
|
34
|
+
const AppContext = createContext(null);
|
|
35
|
+
/** Gives the declaration, with Appearance in place, to everything inside `DeskProvider`. */
|
|
36
|
+
export const AppProvider = AppContext.Provider;
|
|
37
|
+
/** What the app declared about itself, or null when it declared nothing. */
|
|
38
|
+
export const useDeskApp = () => useContext(AppContext);
|
|
39
|
+
/** Whether the app has any Settings to show: its own window, or at least one section. */
|
|
40
|
+
export const hasSettings = (app) => Boolean(app?.settings && (app.settings.open || (app.settings.sections?.length ?? 0) > 0));
|
|
41
|
+
/**
|
|
42
|
+
* Which of Desk's own windows this is, for an app that declared itself: About always, and Settings when the
|
|
43
|
+
* app declared settings and does not open a window of its own for them. Null for every other window, which
|
|
44
|
+
* stays the app's, as `settings` does for an app that declared only its About.
|
|
45
|
+
*/
|
|
46
|
+
export function desksWindow(app, id) {
|
|
47
|
+
if (!app)
|
|
48
|
+
return null;
|
|
49
|
+
if (id === ABOUT_WINDOW)
|
|
50
|
+
return 'about';
|
|
51
|
+
if (id === SETTINGS_WINDOW && app.settings && !app.settings.open)
|
|
52
|
+
return 'settings';
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The title Desk gives its own windows, or null for every other window. `Desktop` and `useDocumentTitle` use
|
|
57
|
+
* it already; a Window menu's title function can too: `id => appWindowTitle(APP, id) ?? TITLES[id]`.
|
|
58
|
+
*/
|
|
59
|
+
export function appWindowTitle(app, id) {
|
|
60
|
+
const which = desksWindow(app, id);
|
|
61
|
+
return which === 'about' ? 'About' : which === 'settings' ? 'Settings' : null;
|
|
62
|
+
}
|
|
63
|
+
/** How big Desk's own window may be: a panel, or the bigger sidebar layout of Settings. */
|
|
64
|
+
export const appWindowLimits = (app, which) => which === 'settings' && app?.settings?.layout === 'sidebar' ? SIDEBAR_LIMITS : PANEL_LIMITS;
|
|
65
|
+
/**
|
|
66
|
+
* Opens one of Desk's panels: filled, so it sits centred at its one size. A panel already open is brought
|
|
67
|
+
* forward where it is, and moved to `route` if one is given.
|
|
68
|
+
*/
|
|
69
|
+
export function openPanel(desk, id, route) {
|
|
70
|
+
const at = route === undefined ? {} : { route };
|
|
71
|
+
if (isOpen(desk.getState(), id))
|
|
72
|
+
desk.open(id, at);
|
|
73
|
+
else
|
|
74
|
+
desk.open(id, { mode: 'filled', ...at });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Opens About as the dock and the menu do: a centred panel, or brought forward where it is. For a link or a
|
|
78
|
+
* query string that names it, so the app need not know how a panel is opened.
|
|
79
|
+
*/
|
|
80
|
+
export const openAbout = (desk) => openPanel(desk, ABOUT_WINDOW);
|
|
81
|
+
/** Opens Settings, in the app's own window if it has one, on `route` if given. */
|
|
82
|
+
export function openSettings(desk, app, route) {
|
|
83
|
+
if (!hasSettings(app))
|
|
84
|
+
return;
|
|
85
|
+
if (app?.settings?.open)
|
|
86
|
+
app.settings.open(route);
|
|
87
|
+
else
|
|
88
|
+
openPanel(desk, SETTINGS_WINDOW, route);
|
|
89
|
+
}
|
|
90
|
+
const glyph = (path) => (_jsx("svg", { viewBox: "0 0 24 24", width: "22", height: "22", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: path }) }));
|
|
91
|
+
const GEAR = glyph('M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z');
|
|
92
|
+
const INFO = glyph('M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM12 11v5M12 8h.01');
|
|
93
|
+
/**
|
|
94
|
+
* Where the gear goes, when the app wants it somewhere other than just before About: put this among its own
|
|
95
|
+
* system items. It is dropped when the app has no settings.
|
|
96
|
+
*/
|
|
97
|
+
export const dockSettings = () => ({ type: 'settings', id: SETTINGS_WINDOW });
|
|
98
|
+
/** The separator the system group starts after. An app that has none gets one before Settings and About. */
|
|
99
|
+
export const SYSTEM_GROUP = 'system';
|
|
100
|
+
/**
|
|
101
|
+
* The app's dock entries with Settings and About in place: About last in the system group (the entries after
|
|
102
|
+
* the separator with id `system`, up to the next separator), Settings where `dockSettings()` stands or else
|
|
103
|
+
* just before About. The app's own items keep their order. Without a declaration, only the marker goes.
|
|
104
|
+
*/
|
|
105
|
+
export function placeAppDockItems(entries, app, open) {
|
|
106
|
+
const settings = hasSettings(app)
|
|
107
|
+
? { id: SETTINGS_WINDOW, label: 'Settings', icon: GEAR, onSelect: open.settings, ...(app?.settings?.badge != null ? { badge: app.settings.badge } : {}) }
|
|
108
|
+
: null;
|
|
109
|
+
const marked = entries.some(e => e.type === 'settings');
|
|
110
|
+
const placed = entries.flatMap(e => (e.type !== 'settings' ? [e] : settings && app ? [{ type: 'item', ...settings }] : []));
|
|
111
|
+
if (!app)
|
|
112
|
+
return placed;
|
|
113
|
+
const about = { type: 'item', id: ABOUT_WINDOW, label: 'About', icon: INFO, onSelect: open.about };
|
|
114
|
+
const ending = [...(settings && !marked ? [{ type: 'item', ...settings }] : []), about];
|
|
115
|
+
const start = placed.findIndex(e => e.type === 'separator' && e.id === SYSTEM_GROUP);
|
|
116
|
+
if (start < 0)
|
|
117
|
+
return [...placed, ...(placed.length ? [{ type: 'separator', id: SYSTEM_GROUP }] : []), ...ending];
|
|
118
|
+
const next = placed.findIndex((e, i) => i > start && e.type === 'separator');
|
|
119
|
+
const end = next < 0 ? placed.length : next;
|
|
120
|
+
return [...placed.slice(0, end), ...ending, ...placed.slice(end)];
|
|
121
|
+
}
|
|
122
|
+
const SEPARATOR = { type: 'separator' };
|
|
123
|
+
/**
|
|
124
|
+
* The app's menus with About and Settings at the top of the app menu, as a Mac app has them: "About <App>",
|
|
125
|
+
* a separator, "Settings…" (⌘,), a separator, then the app's own items. The app menu is the first one with
|
|
126
|
+
* `emphasis`; an app with none gets one, named for the app, in front. Items given as a function stay one, so
|
|
127
|
+
* a menu that is re-read on opening still is.
|
|
128
|
+
*/
|
|
129
|
+
export function placeAppMenuItems(menus, app, openAbout) {
|
|
130
|
+
if (!app)
|
|
131
|
+
return [...menus];
|
|
132
|
+
const head = [{ type: 'action', label: `About ${app.name}`, onSelect: openAbout }];
|
|
133
|
+
if (hasSettings(app))
|
|
134
|
+
head.push(SEPARATOR, { type: 'command', label: 'Settings…', command: SettingsCommand, shortcut: 'mod+comma' });
|
|
135
|
+
const withHead = (items) => items.length === 0 ? head : [...head, ...(items[0]?.type === 'separator' ? [] : [SEPARATOR]), ...items];
|
|
136
|
+
const at = menus.findIndex(m => m.emphasis);
|
|
137
|
+
if (at < 0)
|
|
138
|
+
return [{ id: 'app', label: app.name, emphasis: true, items: head }, ...menus];
|
|
139
|
+
return menus.map((menu, i) => {
|
|
140
|
+
if (i !== at)
|
|
141
|
+
return menu;
|
|
142
|
+
const { items } = menu;
|
|
143
|
+
return { ...menu, items: typeof items === 'function' ? () => withHead(items()) : withHead(items) };
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../src/react/app.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO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GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAC3C,IAAI,EAAE,GAAG,CAAC;QAAE,OAAO,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,CAAC,CAAA;IAC1F,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;QAC3B,IAAI,CAAC,KAAK,EAAE;YAAE,OAAO,IAAI,CAAA;QACzB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAA;QACtB,OAAO,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAA;IACpG,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AboutSection, DeskApp, SettingsSection } from './app.js';
|
|
2
|
+
import type { SidebarSection } from './sidebar.js';
|
|
3
|
+
/** The app's name and version, then every fact that may be copied, by section: what About's Copy copies. */
|
|
4
|
+
export declare function aboutText(app: Pick<DeskApp, 'name' | 'version'>, sections: readonly AboutSection[]): string;
|
|
5
|
+
/**
|
|
6
|
+
* Opens Settings as the gear, the menu item and ⌘, do, on the section `route` names: Desk's panel, or the
|
|
7
|
+
* app's own window when it has one. Nothing, when the app has no Settings to show. Read inside the desk,
|
|
8
|
+
* because whether there are settings depends on what the desk knows: Appearance hides when a host themes it.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useOpenSettings(): (route?: string) => void;
|
|
11
|
+
/** About the app: its icon, name, version and links, what is running if it says, and Copy for a bug report. */
|
|
12
|
+
export declare function AboutContent(): import("react").JSX.Element | null;
|
|
13
|
+
/** The sidebar's groups, in the order each first appears; sections with no group come first, unheaded. */
|
|
14
|
+
export declare function settingsGroups(sections: readonly SettingsSection[]): SidebarSection[];
|
|
15
|
+
/**
|
|
16
|
+
* The app's settings sections, Appearance first when it has one, laid out as it declared: on one page, or a sidebar beside the chosen one.
|
|
17
|
+
* Desk's Settings window is this; an app whose Settings window is its own can draw it there. The window's
|
|
18
|
+
* route is the section: a link to `settings` with a route opens on it, and choosing one in the sidebar moves
|
|
19
|
+
* the route, so the address says where Settings is.
|
|
20
|
+
*/
|
|
21
|
+
export declare function SettingsContent(): import("react").JSX.Element | null;
|
|
22
|
+
//# sourceMappingURL=appPanels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appPanels.d.ts","sourceRoot":"","sources":["../../src/react/appPanels.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAOtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAQlD,4GAA4G;AAC5G,wBAAgB,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC,EAAE,QAAQ,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAO3G;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAM1D;AAID,+GAA+G;AAC/G,wBAAgB,YAAY,uCAI3B;AAiFD,0GAA0G;AAC1G,wBAAgB,cAAc,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,cAAc,EAAE,CAiBrF;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,uCAqC9B"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
3
|
+
import { openSettings, useDeskApp } from './app.js';
|
|
4
|
+
import { useOptionalDesk, useWindowRoute } from './context.js';
|
|
5
|
+
import { Button } from './controls.js';
|
|
6
|
+
import { useCopy } from './copy.js';
|
|
7
|
+
import { Pane, Section } from './pane.js';
|
|
8
|
+
import { Loading } from './progress.js';
|
|
9
|
+
import { Sidebar } from './sidebar.js';
|
|
10
|
+
import { Split } from './split.js';
|
|
11
|
+
/*
|
|
12
|
+
* The windows behind About and Settings, drawn from what the app declared. Both read the declaration from
|
|
13
|
+
* the desk, so a section added at runtime, or a fact that changes, shows without the window being rebuilt.
|
|
14
|
+
*/
|
|
15
|
+
/** The app's name and version, then every fact that may be copied, by section: what About's Copy copies. */
|
|
16
|
+
export function aboutText(app, sections) {
|
|
17
|
+
const blocks = [app.version ? `${app.name} ${app.version}` : app.name];
|
|
18
|
+
for (const section of sections) {
|
|
19
|
+
const lines = section.facts.filter(fact => fact.copy !== false).map(({ name, value }) => `${name}: ${value}`);
|
|
20
|
+
if (lines.length)
|
|
21
|
+
blocks.push([...(section.title ? [section.title] : []), ...lines].join('\n'));
|
|
22
|
+
}
|
|
23
|
+
return blocks.join('\n\n');
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Opens Settings as the gear, the menu item and ⌘, do, on the section `route` names: Desk's panel, or the
|
|
27
|
+
* app's own window when it has one. Nothing, when the app has no Settings to show. Read inside the desk,
|
|
28
|
+
* because whether there are settings depends on what the desk knows: Appearance hides when a host themes it.
|
|
29
|
+
*/
|
|
30
|
+
export function useOpenSettings() {
|
|
31
|
+
const app = useDeskApp();
|
|
32
|
+
const desk = useOptionalDesk();
|
|
33
|
+
return useCallback((route) => {
|
|
34
|
+
if (desk)
|
|
35
|
+
openSettings(desk, app, route);
|
|
36
|
+
}, [desk, app]);
|
|
37
|
+
}
|
|
38
|
+
const NO_FACTS = () => undefined;
|
|
39
|
+
/** About the app: its icon, name, version and links, what is running if it says, and Copy for a bug report. */
|
|
40
|
+
export function AboutContent() {
|
|
41
|
+
const app = useDeskApp();
|
|
42
|
+
// A declaration that gains or loses its facts calls one hook more or fewer: drawn afresh, not misordered.
|
|
43
|
+
return app ? _jsx(AboutPanel, { app: app }, app.facts ? 'facts' : 'plain') : null;
|
|
44
|
+
}
|
|
45
|
+
function AboutPanel({ app }) {
|
|
46
|
+
// The app's hook, called on every render of this panel and only here, so its own hooks keep their order.
|
|
47
|
+
const sections = (app.facts ?? NO_FACTS)();
|
|
48
|
+
// Where there is no clipboard, the text is selected: this text, held out of sight, not the panel, which
|
|
49
|
+
// shows facts marked not to be copied.
|
|
50
|
+
const text = sections ? aboutText(app, sections) : '';
|
|
51
|
+
const textRef = useRef(null);
|
|
52
|
+
const copying = useCopy(text, textRef);
|
|
53
|
+
const hasFacts = Boolean(app.facts);
|
|
54
|
+
// Copy is for something to copy: not while facts are read, and not when there are none to report.
|
|
55
|
+
const copyable = Boolean(sections?.some(section => section.facts.some(fact => fact.copy !== false)));
|
|
56
|
+
return (_jsxs(Pane, { padded: true, label: `About ${app.name}`, className: "desk-about", footer: copyable ? (_jsxs("div", { className: "desk-about-foot", children: [_jsx("pre", { ref: textRef, className: "desk-about-copied", "aria-hidden": "true", children: text }), _jsx(Button, { onClick: () => void copying.copy(), children: copying.button }), _jsx("span", { className: "desk-text-small desk-text-muted", role: "status", children: copying.copying === 'copied' ? 'Copied, for a bug report' : copying.status })] })) : null, children: [_jsxs("div", { className: "desk-about-body", children: [_jsxs("div", { className: "desk-about-brand", children: [app.icon != null && _jsx("div", { className: "desk-about-icon", "aria-hidden": "true", children: app.icon }), _jsx("h2", { className: "desk-about-name", children: app.name }), app.version && _jsxs("p", { className: "desk-about-version desk-text-muted", children: ["Version ", app.version] }), app.description != null && _jsx("p", { className: "desk-about-description", children: app.description })] }), app.links?.length ? (_jsx("nav", { className: "desk-about-links", "aria-label": "Links", children: app.links.map(link => (_jsx("a", { href: link.url, target: "_blank", rel: "noopener noreferrer", children: link.label }, link.url))) })) : null, app.note != null && _jsx("p", { className: "desk-about-note desk-text-small desk-text-muted", children: app.note }), hasFacts && !sections && _jsx(Loading, { label: "Reading what is running" }), sections?.length ? (_jsx("div", { className: "desk-about-sections", children: sections.map((section, n) => (_jsx(AboutFacts, { section: section }, section.title ?? `facts-${n}`))) })) : null] }), app.legal != null && _jsx("p", { className: "desk-about-legal desk-text-small desk-text-muted", children: app.legal })] }));
|
|
57
|
+
}
|
|
58
|
+
function AboutFacts({ section }) {
|
|
59
|
+
const list = (_jsx("dl", { className: "desk-about-facts", children: section.facts.map(({ name, value, note, link }) => (_jsxs("div", { children: [_jsx("dt", { children: name }), _jsxs("dd", { children: [value, (note != null || link) && (_jsxs("span", { className: "desk-about-fact-note desk-text-small desk-text-muted", children: [note, note != null && link && ' ', link && _jsx("a", { href: link.url, target: "_blank", rel: "noopener noreferrer", children: link.label })] }))] })] }, name))) }));
|
|
60
|
+
return section.title ? _jsx(Section, { title: section.title, children: list }) : _jsx("section", { "aria-label": "Facts", children: list });
|
|
61
|
+
}
|
|
62
|
+
/** The sidebar's groups, in the order each first appears; sections with no group come first, unheaded. */
|
|
63
|
+
export function settingsGroups(sections) {
|
|
64
|
+
const groups = [];
|
|
65
|
+
for (const section of sections) {
|
|
66
|
+
const id = section.group ?? '';
|
|
67
|
+
let group = groups.find(g => g.id === id);
|
|
68
|
+
if (!group) {
|
|
69
|
+
group = { id, ...(section.group ? { label: section.group } : {}), items: [] };
|
|
70
|
+
if (id)
|
|
71
|
+
groups.push(group);
|
|
72
|
+
else
|
|
73
|
+
groups.unshift(group);
|
|
74
|
+
}
|
|
75
|
+
group.items.push(section);
|
|
76
|
+
}
|
|
77
|
+
return groups.map(({ id, label, items }) => ({
|
|
78
|
+
id: id || 'settings',
|
|
79
|
+
...(label ? { label } : {}),
|
|
80
|
+
items: items.map(s => ({ id: s.id, label: s.title, ...(s.icon != null ? { icon: s.icon } : {}), ...(s.badge != null ? { badge: s.badge } : {}) })),
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The app's settings sections, Appearance first when it has one, laid out as it declared: on one page, or a sidebar beside the chosen one.
|
|
85
|
+
* Desk's Settings window is this; an app whose Settings window is its own can draw it there. The window's
|
|
86
|
+
* route is the section: a link to `settings` with a route opens on it, and choosing one in the sidebar moves
|
|
87
|
+
* the route, so the address says where Settings is.
|
|
88
|
+
*/
|
|
89
|
+
export function SettingsContent() {
|
|
90
|
+
const app = useDeskApp();
|
|
91
|
+
const sections = app?.settings?.sections ?? [];
|
|
92
|
+
const [route, setRoute] = useWindowRoute();
|
|
93
|
+
const page = useRef(null);
|
|
94
|
+
const sidebar = app?.settings?.layout === 'sidebar';
|
|
95
|
+
// On one page, a link to a section scrolls it into view.
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (sidebar || !route)
|
|
98
|
+
return;
|
|
99
|
+
page.current?.querySelector(`[data-settings-section="${CSS.escape(route)}"]`)?.scrollIntoView?.({ block: 'start' });
|
|
100
|
+
}, [route, sidebar]);
|
|
101
|
+
if (!sections.length)
|
|
102
|
+
return null;
|
|
103
|
+
if (!sidebar) {
|
|
104
|
+
return (_jsx(Pane, { padded: true, label: "Settings", className: "desk-settings", children: _jsx("div", { ref: page, className: "desk-settings-page", children: sections.map(section => (_jsx("div", { "data-settings-section": section.id, children: _jsx(Section, { title: section.title, children: section.content }) }, section.id))) }) }));
|
|
105
|
+
}
|
|
106
|
+
// With no route, or one to a section that has gone, the first section as listed, not as declared.
|
|
107
|
+
const groups = settingsGroups(sections);
|
|
108
|
+
const chosen = sections.find(s => s.id === route) ?? sections.find(s => s.id === groups[0]?.items[0]?.id) ?? sections[0];
|
|
109
|
+
return (_jsx(Split, { side: _jsx(Sidebar, { label: "Settings", sections: groups, value: chosen.id, onChange: setRoute }), size: 220, min: 180, label: "Resize the list of settings", children: _jsx(Pane, { padded: true, label: chosen.title, className: "desk-settings", children: _jsx(SettingsSectionView, { section: chosen }) }) }));
|
|
110
|
+
}
|
|
111
|
+
function SettingsSectionView({ section }) {
|
|
112
|
+
return _jsx(Section, { title: section.title, children: section.content });
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=appPanels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appPanels.js","sourceRoot":"","sources":["../../src/react/appPanels.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEnD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC;;;GAGG;AAEH,4GAA4G;AAC5G,MAAM,UAAU,SAAS,CAAC,GAAsC,EAAE,QAAiC;IACjG,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACtE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,GAAG,IAAI,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AC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAE,CAAA;IACzH,OAAO,CACL,KAAC,KAAK,IAAC,IAAI,EAAE,KAAC,OAAO,IAAC,KAAK,EAAC,UAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAC,6BAA6B,YACzJ,KAAC,IAAI,IAAC,MAAM,QAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,EAAC,eAAe,YACzD,KAAC,mBAAmB,IAAC,OAAO,EAAE,MAAM,GAAI,GACnC,GACD,CACT,CAAA;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,EAAE,OAAO,EAAyC;IAC7E,OAAO,KAAC,OAAO,IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,YAAG,OAAO,CAAC,OAAO,GAAW,CAAA;AACnE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { LookChoice } from '../core/look.js';
|
|
3
|
+
import type { ColorScheme } from '../core/scheme.js';
|
|
4
|
+
import type { Fx } from '../fx/fx.js';
|
|
5
|
+
/** Which rows Appearance has. `true` is the colour scheme alone. */
|
|
6
|
+
export interface AppearanceRows {
|
|
7
|
+
/** Light, dark or the system's. Leave out for an app whose named themes decide it. */
|
|
8
|
+
readonly scheme?: boolean;
|
|
9
|
+
/** The window chrome: the device's, Mac, GNOME or Windows. */
|
|
10
|
+
readonly look?: boolean;
|
|
11
|
+
/** The app's sounds: one switch, `SoundsToggle`. */
|
|
12
|
+
readonly sounds?: Fx<string>;
|
|
13
|
+
/** What `sounds` silences, said under the switch. */
|
|
14
|
+
readonly soundsDescription?: ReactNode;
|
|
15
|
+
/** The app's own theme picker, drawn after the scheme. */
|
|
16
|
+
readonly theme?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** The rows an `appearance` declaration asks for: `true` is the scheme alone, left out is none. */
|
|
19
|
+
export declare const rowsOf: (appearance: boolean | AppearanceRows | undefined) => AppearanceRows;
|
|
20
|
+
/** The rows left to show: none of the theme's when it comes from a host. */
|
|
21
|
+
export declare function shownRows(rows: AppearanceRows, fromHost: boolean): AppearanceRows;
|
|
22
|
+
/** Whether any row is left to show: with none, Appearance is no section at all. */
|
|
23
|
+
export declare const hasRows: (rows: AppearanceRows) => boolean;
|
|
24
|
+
/** The colour scheme chosen in Appearance: `system` until one is. */
|
|
25
|
+
export declare const colorScheme: () => ColorScheme;
|
|
26
|
+
/** Chooses a colour scheme, remembers it, and tells everything that shows it. */
|
|
27
|
+
export declare const setColorScheme: (next: ColorScheme) => void;
|
|
28
|
+
/** The colour scheme, kept current: for an app that tells a native shell, or themes something of its own. */
|
|
29
|
+
export declare const useColorScheme: () => ColorScheme;
|
|
30
|
+
/** The look chosen in Appearance, or null when the person has not chosen one and the app's own stands. */
|
|
31
|
+
export declare const lookChoice: () => LookChoice | null;
|
|
32
|
+
/** Chooses a look, remembers it, and puts it on the desk in place of the app's own. */
|
|
33
|
+
export declare const setLookChoice: (next: LookChoice) => void;
|
|
34
|
+
/** The look chosen in Appearance, kept current, or null while the app's own stands. */
|
|
35
|
+
export declare const useLookChoice: () => LookChoice | null;
|
|
36
|
+
/** Puts the scheme on the page: `data-theme`, or none to follow the system through the stylesheet's media query. */
|
|
37
|
+
export declare function showColorScheme(next: ColorScheme, root?: HTMLElement): void;
|
|
38
|
+
/**
|
|
39
|
+
* Whether a host has sent this page its theme, through the bridge: then `data-theme` on the root is the
|
|
40
|
+
* host's, and Appearance must not take it away as it hides. Read from the bridge itself, not only from its
|
|
41
|
+
* handler, so a theme that came before the desk mounted is known on the first render, and the remembered
|
|
42
|
+
* scheme is never put over it, not even for a frame.
|
|
43
|
+
*/
|
|
44
|
+
export declare const hostThemed: () => boolean;
|
|
45
|
+
/** Whether this app takes its theme from a host: as declared, or else as the bridge has found. */
|
|
46
|
+
export declare function useThemeFromHost(declared: boolean | undefined): boolean;
|
|
47
|
+
/** What `AppearanceSettings` draws: the rows, and the look to show as chosen when the person has chosen none. */
|
|
48
|
+
export interface AppearanceSettingsProps {
|
|
49
|
+
readonly rows: AppearanceRows;
|
|
50
|
+
/** The look the desk wears when the person has chosen none: the app's own. */
|
|
51
|
+
readonly look: LookChoice;
|
|
52
|
+
}
|
|
53
|
+
/** The Appearance rows: what Settings shows, or what an app's own Settings window can draw. */
|
|
54
|
+
export declare function AppearanceSettings({ rows, look: appLook }: AppearanceSettingsProps): import("react").JSX.Element;
|
|
55
|
+
//# sourceMappingURL=appearance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../src/react/appearance.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAoBrC,oEAAoE;AACpE,MAAM,WAAW,cAAc;IAC7B,sFAAsF;IACtF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;IACvB,oDAAoD;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAA;IAC5B,qDAAqD;IACrD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;IACtC,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;CAC3B;AAED,mGAAmG;AACnG,eAAO,MAAM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-runtime";
|
|
2
|
+
import { useSyncExternalStore } from 'react';
|
|
3
|
+
import { COLOR_SCHEME_KEY, LOOK_KEY } from '../core/scheme.js';
|
|
4
|
+
import { RadioGroup, SegmentedControl } from './controls.js';
|
|
5
|
+
import { SoundsToggle } from './soundsToggle.js';
|
|
6
|
+
/** The rows an `appearance` declaration asks for: `true` is the scheme alone, left out is none. */
|
|
7
|
+
export const rowsOf = (appearance) => appearance === true ? { scheme: true } : appearance || {};
|
|
8
|
+
/** The rows left to show: none of the theme's when it comes from a host. */
|
|
9
|
+
export function shownRows(rows, fromHost) {
|
|
10
|
+
if (!fromHost)
|
|
11
|
+
return rows;
|
|
12
|
+
const { sounds, soundsDescription } = rows;
|
|
13
|
+
return { ...(sounds ? { sounds } : {}), ...(soundsDescription != null ? { soundsDescription } : {}) };
|
|
14
|
+
}
|
|
15
|
+
/** Whether any row is left to show: with none, Appearance is no section at all. */
|
|
16
|
+
export const hasRows = (rows) => Boolean(rows.scheme || rows.look || rows.sounds || rows.theme != null);
|
|
17
|
+
/* A choice kept in this browser, read by every part that shows it, here and in another tab. */
|
|
18
|
+
function storedChoice(key, values) {
|
|
19
|
+
const listeners = new Set();
|
|
20
|
+
const read = () => {
|
|
21
|
+
try {
|
|
22
|
+
const kept = globalThis.localStorage?.getItem(key);
|
|
23
|
+
return values.find(v => v === kept) ?? null;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
const write = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
if (value === null)
|
|
32
|
+
globalThis.localStorage?.removeItem(key);
|
|
33
|
+
else
|
|
34
|
+
globalThis.localStorage?.setItem(key, value);
|
|
35
|
+
memory = null;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Private windows and full storage: it applies until the page is closed. What storage still holds is
|
|
39
|
+
// the old choice, read before this one, so it goes.
|
|
40
|
+
memory = value;
|
|
41
|
+
try {
|
|
42
|
+
globalThis.localStorage?.removeItem(key);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Unreadable too: then it is never read.
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
listeners.forEach(listener => listener());
|
|
49
|
+
};
|
|
50
|
+
let memory = null;
|
|
51
|
+
const now = () => read() ?? memory;
|
|
52
|
+
const fromAnotherTab = (event) => {
|
|
53
|
+
if (event.key === null || event.key === key)
|
|
54
|
+
listeners.forEach(listener => listener());
|
|
55
|
+
};
|
|
56
|
+
const subscribe = (listener) => {
|
|
57
|
+
if (listeners.size === 0 && typeof window !== 'undefined')
|
|
58
|
+
window.addEventListener('storage', fromAnotherTab);
|
|
59
|
+
listeners.add(listener);
|
|
60
|
+
return () => {
|
|
61
|
+
listeners.delete(listener);
|
|
62
|
+
if (listeners.size === 0 && typeof window !== 'undefined')
|
|
63
|
+
window.removeEventListener('storage', fromAnotherTab);
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
return { now, write, subscribe };
|
|
67
|
+
}
|
|
68
|
+
const scheme = storedChoice(COLOR_SCHEME_KEY, ['system', 'light', 'dark']);
|
|
69
|
+
const look = storedChoice(LOOK_KEY, ['auto', 'mac', 'gnome', 'windows']);
|
|
70
|
+
/** The colour scheme chosen in Appearance: `system` until one is. */
|
|
71
|
+
export const colorScheme = () => scheme.now() ?? 'system';
|
|
72
|
+
/** Chooses a colour scheme, remembers it, and tells everything that shows it. */
|
|
73
|
+
export const setColorScheme = (next) => scheme.write(next === 'system' ? null : next);
|
|
74
|
+
/** The colour scheme, kept current: for an app that tells a native shell, or themes something of its own. */
|
|
75
|
+
export const useColorScheme = () => useSyncExternalStore(scheme.subscribe, colorScheme, () => 'system');
|
|
76
|
+
/** The look chosen in Appearance, or null when the person has not chosen one and the app's own stands. */
|
|
77
|
+
export const lookChoice = () => look.now();
|
|
78
|
+
/** Chooses a look, remembers it, and puts it on the desk in place of the app's own. */
|
|
79
|
+
export const setLookChoice = (next) => look.write(next);
|
|
80
|
+
/** The look chosen in Appearance, kept current, or null while the app's own stands. */
|
|
81
|
+
export const useLookChoice = () => useSyncExternalStore(look.subscribe, lookChoice, () => null);
|
|
82
|
+
/** Puts the scheme on the page: `data-theme`, or none to follow the system through the stylesheet's media query. */
|
|
83
|
+
export function showColorScheme(next, root = document.documentElement) {
|
|
84
|
+
if (next === 'system')
|
|
85
|
+
root.removeAttribute('data-theme');
|
|
86
|
+
else
|
|
87
|
+
root.setAttribute('data-theme', next);
|
|
88
|
+
}
|
|
89
|
+
const bridge = () => (typeof window === 'undefined' ? undefined : window.desk);
|
|
90
|
+
const hostListeners = new Set();
|
|
91
|
+
let watched;
|
|
92
|
+
let themed;
|
|
93
|
+
/**
|
|
94
|
+
* Whether a host has sent this page its theme, through the bridge: then `data-theme` on the root is the
|
|
95
|
+
* host's, and Appearance must not take it away as it hides. Read from the bridge itself, not only from its
|
|
96
|
+
* handler, so a theme that came before the desk mounted is known on the first render, and the remembered
|
|
97
|
+
* scheme is never put over it, not even for a frame.
|
|
98
|
+
*/
|
|
99
|
+
export const hostThemed = () => {
|
|
100
|
+
const found = bridge();
|
|
101
|
+
return found !== undefined && (found.theme != null || themed === found);
|
|
102
|
+
};
|
|
103
|
+
function watchBridge() {
|
|
104
|
+
const found = bridge();
|
|
105
|
+
if (!found?.onTheme || watched === found)
|
|
106
|
+
return;
|
|
107
|
+
watched = found;
|
|
108
|
+
found.onTheme(() => {
|
|
109
|
+
themed = found;
|
|
110
|
+
hostListeners.forEach(listener => listener());
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const subscribeHost = (listener) => {
|
|
114
|
+
watchBridge();
|
|
115
|
+
hostListeners.add(listener);
|
|
116
|
+
return () => void hostListeners.delete(listener);
|
|
117
|
+
};
|
|
118
|
+
/** Whether this app takes its theme from a host: as declared, or else as the bridge has found. */
|
|
119
|
+
export function useThemeFromHost(declared) {
|
|
120
|
+
const found = useSyncExternalStore(subscribeHost, hostThemed, () => false);
|
|
121
|
+
return declared ?? found;
|
|
122
|
+
}
|
|
123
|
+
const SCHEMES = [
|
|
124
|
+
{ value: 'system', label: 'Follow the system' },
|
|
125
|
+
{ value: 'light', label: 'Light' },
|
|
126
|
+
{ value: 'dark', label: 'Dark' },
|
|
127
|
+
];
|
|
128
|
+
const LOOKS = [
|
|
129
|
+
{ value: 'auto', label: 'Automatic' },
|
|
130
|
+
{ value: 'mac', label: 'Mac' },
|
|
131
|
+
{ value: 'gnome', label: 'GNOME' },
|
|
132
|
+
{ value: 'windows', label: 'Windows' },
|
|
133
|
+
];
|
|
134
|
+
/** The Appearance rows: what Settings shows, or what an app's own Settings window can draw. */
|
|
135
|
+
export function AppearanceSettings({ rows, look: appLook }) {
|
|
136
|
+
const chosenScheme = useColorScheme();
|
|
137
|
+
const chosenLook = useLookChoice() ?? appLook;
|
|
138
|
+
return (_jsxs("div", { className: "desk-fields", children: [rows.scheme && _jsx(RadioGroup, { label: "Colour scheme", value: chosenScheme, onChange: setColorScheme, options: SCHEMES }), rows.theme, rows.look && (_jsxs("div", { className: "desk-field", children: [_jsx("span", { className: "desk-label", "aria-hidden": "true", children: "Look" }), _jsx(SegmentedControl, { label: "Look", options: LOOKS, value: chosenLook, onChange: setLookChoice })] })), rows.sounds && _jsx(SoundsToggle, { fx: rows.sounds, label: "Sounds", description: rows.soundsDescription })] }));
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=appearance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appearance.js","sourceRoot":"","sources":["../../src/react/appearance.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AAG5C,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAG9D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAgChD,mGAAm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