@adecore/shell 0.48.3 → 0.48.4

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/dist/theme.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface ThemeOptions {
9
9
  windows: () => readonly BrowserWindow[];
10
10
  background: string;
11
11
  overlay?: TitleBarOverlay;
12
+ nativeFrame?: boolean;
12
13
  trafficLights?: {
13
14
  x: number;
14
15
  y: number;
package/dist/theme.js CHANGED
@@ -17,7 +17,7 @@ export const createTheme = (options) => {
17
17
  apply: (theme) => {
18
18
  current = theme;
19
19
  options.nativeTheme.themeSource = theme.followsSystem ? 'system' : theme.resolved;
20
- const overlay = platform === 'darwin' ? undefined : overlayOf(theme);
20
+ const overlay = platform === 'darwin' || options.nativeFrame ? undefined : overlayOf(theme);
21
21
  for (const window of options.windows()) {
22
22
  if (window.isDestroyed()) {
23
23
  continue;
@@ -32,9 +32,10 @@ export const createTheme = (options) => {
32
32
  /* The constructor options of a new window: its own chrome and the ground the others have. Dark until a page says otherwise. */
33
33
  windowOptions: () => {
34
34
  const overlay = overlayOf(current ?? { resolved: 'dark' });
35
- const chrome = platform === 'darwin'
36
- ? { titleBarStyle: 'hiddenInset', trafficLightPosition: options.trafficLights ?? { x: 17, y: 17 } }
35
+ const hidden = options.nativeFrame
36
+ ? {}
37
37
  : { titleBarStyle: 'hidden', ...(overlay ? { titleBarOverlay: overlay } : {}) };
38
+ const chrome = platform === 'darwin' ? { titleBarStyle: 'hiddenInset', trafficLightPosition: options.trafficLights ?? { x: 17, y: 17 } } : hidden;
38
39
  return { ...chrome, backgroundColor: current?.background ?? options.background };
39
40
  }
40
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/shell",
3
- "version": "0.48.3",
3
+ "version": "0.48.4",
4
4
  "description": "The main process of an Electron app: its menu, its updater and the guards around its page.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "author": "Bas Milius",
package/src/theme.ts CHANGED
@@ -14,6 +14,8 @@ export interface ThemeOptions {
14
14
  background: string;
15
15
  /* Off macOS, the controls drawn over the page. Without it the window has no controls of its own there. */
16
16
  overlay?: TitleBarOverlay;
17
+ /* Off macOS, the system's own title bar and menu bar instead of a page that reaches the top. */
18
+ nativeFrame?: boolean;
17
19
  /* Where macOS puts the traffic lights, inset into the page. */
18
20
  trafficLights?: { x: number; y: number };
19
21
  platform?: NodeJS.Platform;
@@ -42,7 +44,7 @@ export const createTheme = (options: ThemeOptions) => {
42
44
  apply: (theme: ThemeState): void => {
43
45
  current = theme;
44
46
  options.nativeTheme.themeSource = theme.followsSystem ? 'system' : theme.resolved;
45
- const overlay = platform === 'darwin' ? undefined : overlayOf(theme);
47
+ const overlay = platform === 'darwin' || options.nativeFrame ? undefined : overlayOf(theme);
46
48
 
47
49
  for (const window of options.windows()) {
48
50
  if (window.isDestroyed()) {
@@ -63,10 +65,11 @@ export const createTheme = (options: ThemeOptions) => {
63
65
  windowOptions: (): BrowserWindowConstructorOptions => {
64
66
  const overlay = overlayOf(current ?? { resolved: 'dark' });
65
67
 
68
+ const hidden: BrowserWindowConstructorOptions = options.nativeFrame
69
+ ? {}
70
+ : { titleBarStyle: 'hidden', ...(overlay ? { titleBarOverlay: overlay } : {}) };
66
71
  const chrome: BrowserWindowConstructorOptions =
67
- platform === 'darwin'
68
- ? { titleBarStyle: 'hiddenInset', trafficLightPosition: options.trafficLights ?? { x: 17, y: 17 } }
69
- : { titleBarStyle: 'hidden', ...(overlay ? { titleBarOverlay: overlay } : {}) };
72
+ platform === 'darwin' ? { titleBarStyle: 'hiddenInset', trafficLightPosition: options.trafficLights ?? { x: 17, y: 17 } } : hidden;
70
73
 
71
74
  return { ...chrome, backgroundColor: current?.background ?? options.background };
72
75
  }