custom-electron-titlebar 4.2.6 → 4.2.7

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 CHANGED
@@ -7,7 +7,7 @@ This project is a typescript library for electron that allows you to configure a
7
7
  [![NPM](https://badgen.net/npm/v/custom-electron-titlebar?label=NPM)](https://npmjs.org/package/custom-electron-titlebar)
8
8
  [![Install size](https://badgen.net/packagephobia/install/custom-electron-titlebar?label=Install%20size)](https://packagephobia.com/result?p=custom-electron-titlebar)
9
9
 
10
- [📄 Visit Documentation](https://cet.alextrs.dev)
10
+ [📄 Documentation](https://github.com/AlexTorresDev/custom-electron-titlebar/wiki)
11
11
 
12
12
  Standard Title Bar
13
13
 
@@ -26,10 +26,16 @@ Custom color
26
26
  ![Screenshot 4](screenshots/cet-4.png)
27
27
 
28
28
  # 📦 Installing
29
- You can install this package with `npm`.
29
+ You can install this package with `npm`, `pnpm` or `yarn`.
30
30
  ```sh
31
31
  npm install custom-electron-titlebar
32
32
  ```
33
+ ```sh
34
+ pnpm add custom-electron-titlebar
35
+ ```
36
+ ```sh
37
+ yarn add custom-electron-titlebar
38
+ ```
33
39
 
34
40
  # 🛠️ Usage
35
41
  The implementation is done as follows:
@@ -46,8 +52,10 @@ function createWindow() {
46
52
  const mainWindow = new BrowserWindow({
47
53
  width: 800,
48
54
  height: 600,
49
- titleBarStyle: 'hidden',
50
55
  //frame: false, // needed if process.versions.electron < 14
56
+ titleBarStyle: 'hidden',
57
+ /* You can use *titleBarOverlay: true* to use the original Windows controls */
58
+ titleBarOverlay: true,
51
59
  webPreferences: {
52
60
  sandbox: false,
53
61
  preload: path.join(__dirname, 'preload.js')
package/consts.d.ts CHANGED
@@ -6,9 +6,9 @@ export declare const INACTIVE_FOREGROUND: Color;
6
6
  export declare const ACTIVE_FOREGROUND: Color;
7
7
  export declare const DEFAULT_ITEM_SELECTOR: Color;
8
8
  export declare const IS_MAC_BIGSUR_OR_LATER: boolean;
9
- export declare const BOTTOM_TITLEBAR_HEIGHT = "60px";
10
- export declare const TOP_TITLEBAR_HEIGHT_MAC: string;
11
- export declare const TOP_TITLEBAR_HEIGHT_WIN = "32px";
9
+ export declare const BOTTOM_TITLEBAR_HEIGHT = 60;
10
+ export declare const TOP_TITLEBAR_HEIGHT_MAC: number;
11
+ export declare const TOP_TITLEBAR_HEIGHT_WIN = 30;
12
12
  export declare const WINDOW_MIN_WIDTH = 400;
13
13
  export declare const WINDOW_MIN_HEIGHT = 270;
14
14
  export declare const MENU_MNEMONIC_REGEX: RegExp;
@@ -34,6 +34,7 @@ interface ITitlebarIcons extends IMenuIcons {
34
34
  };
35
35
  }
36
36
  export declare const menuIcons: ITitlebarIcons;
37
+ export declare function getPx(value: number): string;
37
38
  /**
38
39
  * Handles mnemonics for menu items. Depending on OS:
39
40
  * - Windows: Supported via & character (replace && with &)
package/consts.js CHANGED
@@ -7,7 +7,7 @@
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.loadWindowIcons = exports.applyFill = exports.parseAccelerator = exports.cleanMnemonic = exports.mnemonicButtonLabel = exports.mnemonicMenuLabel = exports.menuIcons = exports.MENU_ESCAPED_MNEMONIC_REGEX = exports.MENU_MNEMONIC_REGEX = exports.WINDOW_MIN_HEIGHT = exports.WINDOW_MIN_WIDTH = exports.TOP_TITLEBAR_HEIGHT_WIN = exports.TOP_TITLEBAR_HEIGHT_MAC = exports.BOTTOM_TITLEBAR_HEIGHT = exports.IS_MAC_BIGSUR_OR_LATER = exports.DEFAULT_ITEM_SELECTOR = exports.ACTIVE_FOREGROUND = exports.INACTIVE_FOREGROUND = exports.ACTIVE_FOREGROUND_DARK = exports.INACTIVE_FOREGROUND_DARK = void 0;
10
+ exports.loadWindowIcons = exports.applyFill = exports.parseAccelerator = exports.cleanMnemonic = exports.mnemonicButtonLabel = exports.mnemonicMenuLabel = exports.getPx = exports.menuIcons = exports.MENU_ESCAPED_MNEMONIC_REGEX = exports.MENU_MNEMONIC_REGEX = exports.WINDOW_MIN_HEIGHT = exports.WINDOW_MIN_WIDTH = exports.TOP_TITLEBAR_HEIGHT_WIN = exports.TOP_TITLEBAR_HEIGHT_MAC = exports.BOTTOM_TITLEBAR_HEIGHT = exports.IS_MAC_BIGSUR_OR_LATER = exports.DEFAULT_ITEM_SELECTOR = exports.ACTIVE_FOREGROUND = exports.INACTIVE_FOREGROUND = exports.ACTIVE_FOREGROUND_DARK = exports.INACTIVE_FOREGROUND_DARK = void 0;
11
11
  const color_1 = require("./base/common/color");
12
12
  const platform_1 = require("./base/common/platform");
13
13
  exports.INACTIVE_FOREGROUND_DARK = _get__("color_1").Color.fromHex('#222222');
@@ -16,9 +16,9 @@ exports.INACTIVE_FOREGROUND = _get__("color_1").Color.fromHex('#EEEEEE');
16
16
  exports.ACTIVE_FOREGROUND = _get__("color_1").Color.fromHex('#FFFFFF');
17
17
  exports.DEFAULT_ITEM_SELECTOR = _get__("color_1").Color.fromHex('#0000001F');
18
18
  exports.IS_MAC_BIGSUR_OR_LATER = _get__("platform_1").isMacintosh && parseInt(process.getSystemVersion().split('.')[0]) >= 11;
19
- exports.BOTTOM_TITLEBAR_HEIGHT = '60px';
20
- exports.TOP_TITLEBAR_HEIGHT_MAC = exports.IS_MAC_BIGSUR_OR_LATER ? '28px' : '22px';
21
- exports.TOP_TITLEBAR_HEIGHT_WIN = '32px';
19
+ exports.BOTTOM_TITLEBAR_HEIGHT = 60;
20
+ exports.TOP_TITLEBAR_HEIGHT_MAC = exports.IS_MAC_BIGSUR_OR_LATER ? 28 : 22;
21
+ exports.TOP_TITLEBAR_HEIGHT_WIN = 30;
22
22
  exports.WINDOW_MIN_WIDTH = 400;
23
23
  exports.WINDOW_MIN_HEIGHT = 270;
24
24
  exports.MENU_MNEMONIC_REGEX = /\(&([^\s&])\)|(^|[^&])&([^\s&])/;
@@ -47,6 +47,10 @@ exports.menuIcons = {
47
47
  close: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 11 11"><path d="M6.279 5.5L11 10.221l-.779.779L5.5 6.279.779 11 0 10.221 4.721 5.5 0 .779.779 0 5.5 4.721 10.221 0 11 .779 6.279 5.5z"/></svg>'
48
48
  }
49
49
  };
50
+ function getPx(value) {
51
+ return `${value}px`;
52
+ }
53
+ exports.getPx = _get__("getPx");
50
54
  /**
51
55
  * Handles mnemonics for menu items. Depending on OS:
52
56
  * - Windows: Supported via & character (replace && with &)
@@ -205,6 +209,8 @@ function _get_original__(variableName) {
205
209
  return color_1;
206
210
  case "platform_1":
207
211
  return platform_1;
212
+ case "getPx":
213
+ return getPx;
208
214
  case "mnemonicMenuLabel":
209
215
  return mnemonicMenuLabel;
210
216
  case "mnemonicButtonLabel":
@@ -1,3 +1,3 @@
1
1
  import { BrowserWindow } from 'electron';
2
2
  declare const _default: (browserWindow: BrowserWindow) => void;
3
- export = _default;
3
+ export default _default;
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  /* ---------------------------------------------------------------------------------------------
4
7
  * Copyright (c) AlexTorresDev. All rights reserved.
5
8
  * Licensed under the MIT License. See License.txt in the project root for license information.
6
9
  *-------------------------------------------------------------------------------------------- */
7
10
  const consts_1 = require("../consts");
8
- module.exports = browserWindow => {
11
+ exports.default = browserWindow => {
9
12
  browserWindow.setMinimumSize(_get__("consts_1").WINDOW_MIN_WIDTH, _get__("consts_1").WINDOW_MIN_HEIGHT);
10
13
  browserWindow.on('enter-full-screen', () => {
11
14
  browserWindow.webContents.send('window-fullscreen', true);
@@ -1,2 +1,2 @@
1
1
  declare const _default: () => void;
2
- export = _default;
2
+ export default _default;
@@ -4,22 +4,15 @@
4
4
  * Copyright (c) AlexTorresDev. All rights reserved.
5
5
  * Licensed under the MIT License. See License.txt in the project root for license information.
6
6
  *-------------------------------------------------------------------------------------------- */
7
- function getMenuItemByCommandId(commandId, menu) {
8
- if (!menu) return undefined;
9
- for (const item of menu.items) {
10
- if (item.submenu) {
11
- const submenuItem = _get__("getMenuItemByCommandId")(commandId, item.submenu);
12
- if (submenuItem) return submenuItem;
13
- } else if (item.commandId === commandId) return item;
14
- }
15
- return undefined;
16
- }
17
- module.exports = () => {
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = () => {
18
11
  if (process.type !== 'browser') return;
19
12
  const {
20
13
  BrowserWindow,
21
- nativeImage,
22
14
  Menu,
15
+ MenuItem,
23
16
  ipcMain
24
17
  } = require('electron');
25
18
  // Send menu to renderer title bar process
@@ -27,6 +20,7 @@ module.exports = () => {
27
20
  // Handle window events
28
21
  ipcMain.on('window-event', (event, eventName) => {
29
22
  const window = BrowserWindow.fromWebContents(event.sender);
23
+ /* eslint-disable indent */
30
24
  if (window) {
31
25
  switch (eventName) {
32
26
  case 'window-minimize':
@@ -60,7 +54,26 @@ module.exports = () => {
60
54
  event.returnValue = null;
61
55
  }
62
56
  });
57
+ ipcMain.on('update-window-controls', (event, args) => {
58
+ const window = BrowserWindow.fromWebContents(event.sender);
59
+ try {
60
+ if (window) window.setTitleBarOverlay(args);
61
+ event.returnValue = true;
62
+ } catch (_) {
63
+ event.returnValue = false;
64
+ }
65
+ });
63
66
  };
67
+ function getMenuItemByCommandId(commandId, menu) {
68
+ if (!menu) return undefined;
69
+ for (const item of menu.items) {
70
+ if (item.submenu) {
71
+ const submenuItem = _get__("getMenuItemByCommandId")(commandId, item.submenu);
72
+ if (submenuItem) return submenuItem;
73
+ } else if (item.commandId === commandId) return item;
74
+ }
75
+ return undefined;
76
+ }
64
77
  function _getGlobalObject() {
65
78
  try {
66
79
  if (!!global) {
@@ -13,7 +13,6 @@ const lifecycle_1 = require("../../base/common/lifecycle");
13
13
  const item_1 = require("./item");
14
14
  const keyCodes_1 = require("../../base/common/keyCodes");
15
15
  const keyboardEvent_1 = require("../../base/browser/keyboardEvent");
16
- const color_1 = require("../../base/common/color");
17
16
  const event_1 = require("../../base/common/event");
18
17
  const separator_1 = require("./separator");
19
18
  const submenu_1 = require("./submenu");
@@ -339,8 +338,7 @@ class CETMenu extends _get__("lifecycle_1").Disposable {
339
338
  if (transparency < 0) transparency = 0;
340
339
  if (transparency > 1) transparency = 1;
341
340
  const rgba = style.backgroundColor?.rgba;
342
- const color = new (_get__("color_1").Color)(new (_get__("color_1").RGBA)(rgba.r, rgba.g, rgba.b, 1 - transparency));
343
- container.style.backgroundColor = color.toString();
341
+ container.style.backgroundColor = `rgb(${rgba.r} ${rgba.g} ${rgba.b} / ${1 - transparency})`;
344
342
  }
345
343
  if (this.items) {
346
344
  this.items.forEach(item => {
@@ -467,8 +465,6 @@ function _get_original__(variableName) {
467
465
  return separator_1;
468
466
  case "item_1":
469
467
  return item_1;
470
- case "color_1":
471
- return color_1;
472
468
  case "lifecycle_1":
473
469
  return lifecycle_1;
474
470
  case "CETMenu":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "custom-electron-titlebar",
3
- "version": "4.2.6",
3
+ "version": "4.2.7",
4
4
  "description": "Library for electron that allows you to configure a fully customizable title bar.",
5
5
  "types": "./index.d.ts",
6
6
  "main": "./index.ts",
@@ -47,23 +47,23 @@
47
47
  "electron": ">20.0.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@babel/cli": "7.22.9",
51
- "@babel/core": "7.22.9",
52
- "@jest/globals": "29.6.1",
53
- "@typescript-eslint/eslint-plugin": "6.1.0",
54
- "@typescript-eslint/parser": "6.1.0",
50
+ "@babel/cli": "7.22.10",
51
+ "@babel/core": "7.22.10",
52
+ "@jest/globals": "29.6.2",
53
+ "@typescript-eslint/eslint-plugin": "6.3.0",
54
+ "@typescript-eslint/parser": "6.3.0",
55
55
  "babel-plugin-import-require-as-string": "1.0.2",
56
56
  "babel-plugin-module-resolver": "5.0.0",
57
57
  "babel-plugin-rewire": "1.2.0",
58
- "electron": "25.3.1",
59
- "eslint": "8.45.0",
60
- "eslint-config-prettier": "8.8.0",
58
+ "electron": "25.5.0",
59
+ "eslint": "8.47.0",
60
+ "eslint-config-prettier": "9.0.0",
61
61
  "eslint-config-standard": "17.1.0",
62
- "eslint-plugin-import": "2.27.5",
62
+ "eslint-plugin-import": "2.28.0",
63
63
  "eslint-plugin-n": "16.0.1",
64
64
  "eslint-plugin-promise": "6.1.1",
65
- "jest": "^29.6.1",
66
- "jest-environment-jsdom": "29.6.1",
65
+ "jest": "^29.6.2",
66
+ "jest-environment-jsdom": "29.6.2",
67
67
  "rimraf": "5.0.1",
68
68
  "standard": "17.1.0",
69
69
  "ts-jest": "29.1.1",
package/titlebar/index.js CHANGED
@@ -24,7 +24,6 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
24
24
  super();
25
25
  this.isInactive = false;
26
26
  this.currentOptions = {
27
- backgroundColor: _get__("color_1").Color.WHITE,
28
27
  closeable: true,
29
28
  enableMnemonics: true,
30
29
  // hideWhenClickingClose: false,
@@ -209,6 +208,7 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
209
208
  const minimizable = this.currentOptions.minimizable;
210
209
  const maximizable = this.currentOptions.maximizable;
211
210
  const closeable = this.currentOptions.closeable;
211
+ this.onDidChangeMaximized(_get__("electron_1").ipcRenderer.sendSync('window-event', 'window-is-maximized'));
212
212
  _get__("electron_1").ipcRenderer.on('window-maximize', (_, isMaximized) => this.onDidChangeMaximized(isMaximized));
213
213
  _get__("electron_1").ipcRenderer.on('window-fullscreen', (_, isFullScreen) => this.onWindowFullScreen(isFullScreen));
214
214
  _get__("electron_1").ipcRenderer.on('window-focus', (_, isFocused) => this.onWindowFocus(isFocused));
@@ -259,7 +259,7 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
259
259
  const maximize = this.controls.maximize;
260
260
  if (maximize) {
261
261
  maximize.title = isMaximized ? this.currentOptions.tooltips?.restoreDown : this.currentOptions.tooltips?.maximize;
262
- maximize.innerHTML = isMaximized ? this.platformIcons.restore : this.platformIcons.maximize;
262
+ maximize.innerHTML = isMaximized ? this.platformIcons?.restore : this.platformIcons?.maximize;
263
263
  }
264
264
  if (this.resizer) {
265
265
  if (isMaximized) (0, _get__("dom_1").hide)(this.resizer.top, this.resizer.left);else (0, _get__("dom_1").show)(this.resizer.top, this.resizer.left);
@@ -285,7 +285,7 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
285
285
  }
286
286
  const backgroundColor = this.isInactive ? this.currentOptions.backgroundColor?.lighten(0.12) : this.currentOptions.backgroundColor;
287
287
  if (backgroundColor) {
288
- this.titlebar.style.backgroundColor = backgroundColor.toString();
288
+ this.titlebar.style.backgroundColor = backgroundColor?.toString();
289
289
  }
290
290
  let foregroundColor;
291
291
  if (backgroundColor?.isLighter()) {
@@ -296,6 +296,16 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
296
296
  foregroundColor = this.isInactive ? _get__("consts_1").INACTIVE_FOREGROUND : _get__("consts_1").ACTIVE_FOREGROUND;
297
297
  }
298
298
  this.titlebar.style.color = foregroundColor?.toString();
299
+ const updatedWindowControls = _get__("electron_1").ipcRenderer.sendSync('update-window-controls', {
300
+ color: backgroundColor?.toString(),
301
+ symbolColor: foregroundColor?.toString(),
302
+ height: _get__("consts_1").TOP_TITLEBAR_HEIGHT_WIN
303
+ });
304
+ if (updatedWindowControls) {
305
+ (0, _get__("dom_1").hide)(this.controlsContainer);
306
+ } else {
307
+ (0, _get__("dom_1").show)(this.controlsContainer);
308
+ }
299
309
  if (this.menuBar) {
300
310
  let fgColor;
301
311
  const backgroundColor = this.currentOptions.menuBarBackgroundColor || this.currentOptions.backgroundColor.darken(0.12);
@@ -338,6 +348,8 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
338
348
  * @param fullscreen Fullscreen state of the window
339
349
  */
340
350
  onWindowFullScreen(fullscreen) {
351
+ const height = _get__("platform_1").isMacintosh ? _get__("consts_1").TOP_TITLEBAR_HEIGHT_MAC : _get__("consts_1").TOP_TITLEBAR_HEIGHT_WIN;
352
+ const hasShadow = this.currentOptions.shadow;
341
353
  if (!_get__("platform_1").isMacintosh) {
342
354
  if (fullscreen) {
343
355
  (0, _get__("dom_1").hide)(this.titlebar);
@@ -345,10 +357,10 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
345
357
  } else {
346
358
  (0, _get__("dom_1").show)(this.titlebar);
347
359
  if (this.currentOptions.menuPosition === 'bottom') {
348
- this.container.style.top = _get__("consts_1").BOTTOM_TITLEBAR_HEIGHT;
349
- this.controlsContainer.style.height = _get__("consts_1").TOP_TITLEBAR_HEIGHT_WIN;
360
+ this.container.style.top = (0, _get__("consts_1").getPx)(_get__("consts_1").BOTTOM_TITLEBAR_HEIGHT);
361
+ this.controlsContainer.style.height = (0, _get__("consts_1").getPx)(_get__("consts_1").TOP_TITLEBAR_HEIGHT_WIN);
350
362
  } else {
351
- this.container.style.top = _get__("platform_1").isMacintosh ? _get__("consts_1").TOP_TITLEBAR_HEIGHT_MAC : _get__("consts_1").TOP_TITLEBAR_HEIGHT_WIN;
363
+ this.container.style.top = (0, _get__("consts_1").getPx)(height + (hasShadow ? 1 : 0));
352
364
  }
353
365
  }
354
366
  }
@@ -400,13 +412,13 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
400
412
  (0, _get__("dom_1").removeClass)(this.title, 'cet-title-right');
401
413
  (0, _get__("dom_1").removeClass)(this.title, 'cet-title-center');
402
414
  if (menuPosition !== 'bottom') {
403
- /* addDisposableListener(window, 'resize', () => {
404
- if (window.innerWidth >= 1188) {
405
- addClass(this.title, 'cet-title-center')
406
- } else {
407
- removeClass(this.title, 'cet-title-center')
408
- }
409
- }) */
415
+ (0, _get__("dom_1").addDisposableListener)(window, 'resize', () => {
416
+ if (window.innerWidth >= 1188) {
417
+ (0, _get__("dom_1").addClass)(this.title, 'cet-title-center');
418
+ } else {
419
+ (0, _get__("dom_1").removeClass)(this.title, 'cet-title-center');
420
+ }
421
+ });
410
422
  (0, _get__("dom_1").addClass)(this.title, 'cet-title-center');
411
423
  }
412
424
  if (!_get__("platform_1").isMacintosh && order === 'first-buttons') {
@@ -452,15 +464,16 @@ class CustomTitlebar extends _get__("themebar_1").ThemeBar {
452
464
  updateMenuPosition(menuPosition) {
453
465
  const height = _get__("platform_1").isMacintosh ? _get__("consts_1").TOP_TITLEBAR_HEIGHT_MAC : _get__("consts_1").TOP_TITLEBAR_HEIGHT_WIN;
454
466
  const onlyRendererMenuBar = this.currentOptions.onlyShowMenuBar;
467
+ const hasShadow = this.currentOptions.shadow;
455
468
  this.currentOptions.menuPosition = menuPosition;
456
469
  if (menuPosition === 'left' || onlyRendererMenuBar) {
457
- this.titlebar.style.height = height;
458
- this.container.style.top = height;
470
+ this.titlebar.style.height = (0, _get__("consts_1").getPx)(height + (hasShadow ? 1 : 0));
471
+ this.container.style.top = (0, _get__("consts_1").getPx)(height + (hasShadow ? 1 : 0));
459
472
  (0, _get__("dom_1").removeClass)(this.menuBarContainer, 'bottom');
460
473
  } else {
461
- this.titlebar.style.height = _get__("consts_1").BOTTOM_TITLEBAR_HEIGHT;
462
- this.container.style.top = _get__("consts_1").BOTTOM_TITLEBAR_HEIGHT;
463
- this.controlsContainer.style.height = height;
474
+ this.titlebar.style.height = (0, _get__("consts_1").getPx)(_get__("consts_1").BOTTOM_TITLEBAR_HEIGHT);
475
+ this.container.style.top = (0, _get__("consts_1").getPx)(_get__("consts_1").BOTTOM_TITLEBAR_HEIGHT);
476
+ this.controlsContainer.style.height = (0, _get__("consts_1").getPx)(height);
464
477
  (0, _get__("dom_1").addClass)(this.menuBarContainer, 'bottom');
465
478
  }
466
479
  return this;
@@ -573,14 +586,14 @@ function _get__(variableName) {
573
586
  }
574
587
  function _get_original__(variableName) {
575
588
  switch (variableName) {
576
- case "color_1":
577
- return color_1;
578
589
  case "consts_1":
579
590
  return consts_1;
580
591
  case "platform_1":
581
592
  return platform_1;
582
593
  case "dom_1":
583
594
  return dom_1;
595
+ case "color_1":
596
+ return color_1;
584
597
  case "electron_1":
585
598
  return electron_1;
586
599
  case "menubar_1":
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", {
9
9
  });
10
10
  exports.ThemeBar = void 0;
11
11
  const lifecycle_1 = require("../base/common/lifecycle");
12
- const baseTheme = "body {\n margin: 0 !important;\n overflow: hidden !important;\n}\n\n/* Titlebar */\n.cet-titlebar {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n flex-wrap: wrap;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n font-size: 13px;\n font-family: Arial, Helvetica, sans-serif;\n box-sizing: border-box;\n padding: 0 16px;\n overflow: hidden;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n zoom: 1;\n width: 100%;\n height: 31px;\n line-height: 31px;\n z-index: 99999;\n}\n\n.cet-titlebar *,\n.cet-titlebar *:before,\n.cet-titlebar *:after {\n box-sizing: border-box;\n}\n\n.cet-titlebar.cet-windows,\n.cet-titlebar.cet-linux,\n.cet-titlebar.cet-freebsd {\n padding: 0;\n height: 30px;\n line-height: 30px;\n justify-content: left;\n overflow: visible;\n}\n\n/* Inverted */\n.cet-titlebar.cet-inverted {\n flex-direction: row-reverse;\n}\n\n.cet-titlebar.cet-inverted .cet-menubar,\n.cet-titlebar.cet-inverted .cet-window-controls {\n flex-direction: row-reverse;\n margin-left: 20px;\n margin-right: 0;\n}\n\n/* First buttons */\n.cet-titlebar.cet-first-buttons .cet-window-controls {\n order: -1;\n margin: 0 5px 0 0;\n}\n\n.cet-titlebar.cet-inverted .cet-window-controls {\n margin: 0 5px 0 0;\n}\n\n/* Shadow */\n.cet-titlebar.cet-shadow {\n box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);\n}\n\n/* Drag region */\n.cet-drag-region {\n top: 0;\n left: 0;\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: -1;\n -webkit-app-region: drag;\n}\n\n/* Icon */\n.cet-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 34px;\n height: 30px;\n z-index: 99;\n overflow: hidden;\n}\n\n/* Title */\n.cet-title {\n flex: 0 1 auto;\n font-size: 12px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n zoom: 1;\n}\n\n/* Title alignment */\n.cet-title.cet-title-left {\n margin-left: 8px;\n margin-right: auto;\n}\n\n.cet-title.cet-title-right {\n margin-left: auto;\n margin-right: 8px;\n}\n\n.cet-title.cet-title-center {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.cet-title.cet-bigsur {\n font-size: 13px;\n font-weight: 600;\n}\n\n/* Window controls */\n.cet-window-controls {\n display: flex;\n flex-grow: 0;\n flex-shrink: 0;\n text-align: center;\n position: relative;\n z-index: 99;\n -webkit-app-region: no-drag;\n height: 30px;\n font-family: initial !important;\n margin-left: auto;\n}\n\n.cet-control-icon {\n width: 46px;\n}\n\n.cet-control-icon:not(.inactive):hover {\n background-color: rgb(255 255 255 / 12%);\n}\n\n.light .cet-control-icon:not(.inactive):hover {\n background-color: rgb(0 0 0 / 12%);\n}\n\n.cet-control-icon.inactive svg {\n opacity: 0.4;\n}\n\n.cet-control-icon svg {\n width: 10px;\n height: -webkit-fill-available;\n fill: #fff;\n display: initial !important;\n vertical-align: unset !important;\n}\n\n.cet-titlebar.light .cet-control-icon svg {\n fill: #222222 !important;\n}\n\n.cet-control-close:not(.inactive):hover {\n background-color: rgb(232 17 35 / 90%) !important;\n}\n\n.cet-control-close:not(.inactive):hover svg {\n fill: #fff !important;\n}\n\n/* Resizer */\n.cet-resizer {\n -webkit-app-region: no-drag;\n position: absolute;\n}\n\n.cet-resizer.left {\n top: 0;\n left: 0;\n width: 6px;\n height: 100%;\n}\n\n.cet-resizer.top {\n top: 0;\n width: 100%;\n height: 6px;\n}\n\n/* Container */\n.cet-container {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: auto;\n z-index: 1;\n}\n\n/* MenuBar */\n.cet-menubar {\n display: flex;\n flex-shrink: 1;\n box-sizing: border-box;\n overflow: hidden;\n flex-wrap: wrap;\n margin-right: 20px;\n}\n\n.cet-menubar.bottom {\n order: 1;\n width: 100%;\n padding: 0 5px 5px;\n margin-right: 0;\n}\n\n.cet-menubar.bottom .cet-menubar-menu-button {\n border-radius: 4px;\n}\n\n.cet-menubar.bottom .cet-menubar-menu-button .cet-menubar-menu-title {\n line-height: 26px;\n}\n\n.cet-menubar .cet-menubar-menu-button {\n box-sizing: border-box;\n padding: 0px 8px;\n height: 100%;\n cursor: default;\n zoom: 1;\n white-space: nowrap;\n -webkit-app-region: no-drag;\n outline: 0;\n}\n\n.cet-menubar .cet-menubar-menu-button .cet-menubar-menu-title {\n font-size: 12px;\n}\n\n.cet-menubar .cet-menubar-menu-button.disabled {\n opacity: 0.4;\n}\n\n.cet-menubar .cet-menubar-menu-button:not(.disabled):hover,\n.cet-menubar .cet-menubar-menu-button:not(.disabled).open {\n background-color: rgb(255 255 255 / 12%);\n}\n\n.cet-titlebar.light .cet-menubar .cet-menubar-menu-button:not(.disabled):hover,\n.cet-titlebar.light .cet-menubar .cet-menubar-menu-button:not(.disabled).open {\n background-color: rgb(0 0 0 / 12%);\n}\n\n.cet-menubar-menu-container {\n position: absolute;\n display: block;\n left: 0px;\n opacity: 1;\n outline: 0;\n border: none;\n text-align: left;\n margin: 0 auto;\n margin-left: 0;\n font-size: inherit;\n overflow-x: visible;\n overflow-y: visible;\n -webkit-overflow-scrolling: touch;\n justify-content: flex-end;\n white-space: nowrap;\n border-radius: 7px;\n backdrop-filter: blur(5px);\n box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);\n z-index: 99999;\n}\n\n.cet-menubar-menu-container::-webkit-scrollbar {\n width: 8px;\n height: 4px;\n cursor: pointer;\n background-color: rgba(0, 0, 0, 0);\n}\n\n.cet-menubar-menu-container::-webkit-scrollbar-track {\n border: none;\n background-color: rgba(0, 0, 0, 0);\n}\n\n.cet-menubar-menu-container::-webkit-scrollbar-thumb {\n border-radius: 10px;\n background-color: rgba(110, 110, 110, 0.2);\n}\n\n.cet-menubar-menu-container:focus {\n outline: 0;\n}\n\n.cet-menubar-menu-container .cet-action-item {\n padding: 0;\n margin: 0;\n transform: none;\n display: -ms-flexbox;\n display: flex;\n outline: none;\n}\n\n.cet-menubar-menu-container .cet-action-item.active {\n transform: none;\n}\n\n.cet-menubar-menu-container .cet-action-item.disabled .cet-action-menu-item {\n opacity: 0.4;\n}\n\n.cet-menubar-menu-container .cet-action-item .cet-submenu {\n position: absolute;\n}\n\n.cet-menubar-menu-container .cet-action-menu-item {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n display: -ms-flexbox;\n display: flex;\n height: 2.231em;\n margin: 4px 3px;\n align-items: center;\n position: relative;\n border-radius: 4px;\n text-decoration: none;\n}\n\n.cet-menubar-menu-container .cet-action-label {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n text-decoration: none;\n padding: 0 1em;\n background: none;\n font-size: 12px;\n line-height: 1;\n}\n\n.cet-menubar-menu-container .cet-action-label:not(.separator) {\n display: inline-block;\n -webkit-box-sizing: border-box;\n -o-box-sizing: border-box;\n -moz-box-sizing: border-box;\n -ms-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0 2em 0 0.8em;\n}\n\n.cet-menubar-menu-container .cet-action-label.separator {\n opacity: 0.1;\n font-size: inherit;\n width: 100%;\n border-bottom: 1px solid transparent;\n}\n\n.cet-menubar-menu-container .cet-action-label.separator.text {\n padding: 0.7em 1em 0.1em 1em;\n font-weight: bold;\n opacity: 1;\n}\n\n.cet-menubar-menu-container .cet-action-label:hover {\n color: inherit;\n}\n\n.cet-menubar-menu-container .keybinding,\n.cet-menubar-menu-container .cet-submenu-indicator {\n display: inline-block;\n -ms-flex: 2 1 auto;\n flex: 2 1 auto;\n padding: 0 2em 0 1em;\n text-align: right;\n font-size: 11px;\n line-height: 1;\n}\n\n.cet-menubar-menu-container .cet-submenu-indicator {\n position: absolute;\n right: 4px;\n height: 12px;\n width: 12px;\n padding: 0;\n}\n\n.cet-menubar-menu-container .cet-submenu-indicator img,\n.cet-menubar-menu-container .cet-menu-item-icon .icon,\n.cet-menubar-menu-container .cet-submenu-indicator svg,\n.cet-menubar-menu-container .cet-menu-item-icon svg {\n display: inherit;\n width: 100%;\n height: 100%;\n}\n\n.cet-menubar-menu-container .cet-action-menu-item.checked>.cet-menu-item-icon.checkbox {\n visibility: visible;\n}\n\n.cet-menubar-menu-container .cet-menu-item-icon {\n width: 14px;\n height: 14px;\n margin: 0 0 0 12px;\n}\n\n.cet-menubar-menu-container .cet-menu-item-icon.checkbox {\n visibility: hidden;\n}";
12
+ const baseTheme = "body {\n margin: 0 !important;\n overflow: hidden !important;\n}\n\n/* Titlebar */\n.cet-titlebar {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n flex-wrap: wrap;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n font-size: 13px;\n font-family: Arial, Helvetica, sans-serif;\n box-sizing: border-box;\n padding: 0 16px;\n overflow: hidden;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n zoom: 1;\n width: 100%;\n height: 31px;\n line-height: 31px;\n z-index: 99999;\n}\n\n.cet-titlebar *,\n.cet-titlebar *:before,\n.cet-titlebar *:after {\n box-sizing: border-box;\n}\n\n.cet-titlebar.cet-windows,\n.cet-titlebar.cet-linux,\n.cet-titlebar.cet-freebsd {\n padding: 0;\n height: 30px;\n line-height: 30px;\n justify-content: left;\n overflow: visible;\n}\n\n/* Inverted */\n.cet-titlebar.cet-inverted {\n flex-direction: row-reverse;\n}\n\n.cet-titlebar.cet-inverted .cet-menubar,\n.cet-titlebar.cet-inverted .cet-window-controls {\n flex-direction: row-reverse;\n margin-left: 20px;\n margin-right: 0;\n}\n\n/* First buttons */\n.cet-titlebar.cet-first-buttons .cet-window-controls {\n order: -1;\n margin: 0 5px 0 0;\n}\n\n.cet-titlebar.cet-inverted .cet-window-controls {\n margin: 0 5px 0 0;\n}\n\n/* Shadow */\n.cet-titlebar.cet-shadow {\n box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);\n}\n\n/* Drag region */\n.cet-drag-region {\n top: 0;\n left: 0;\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: -1;\n -webkit-app-region: drag;\n}\n\n/* Icon */\n.cet-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 34px;\n height: 30px;\n z-index: 99;\n overflow: hidden;\n}\n\n/* Title */\n.cet-title {\n flex: 0 1 auto;\n font-size: 12px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n zoom: 1;\n}\n\n/* Title alignment */\n.cet-title.cet-title-left {\n margin-left: 8px;\n margin-right: auto;\n}\n\n.cet-title.cet-title-right {\n margin-left: auto;\n margin-right: 8px;\n}\n\n.cet-title.cet-title-center {\n position: absolute;\n left: 50%;\n transform: translateX(-50%);\n}\n\n.cet-title.cet-bigsur {\n font-size: 13px;\n font-weight: 600;\n}\n\n/* Window controls */\n.cet-window-controls {\n display: flex;\n flex-grow: 0;\n flex-shrink: 0;\n text-align: center;\n position: relative;\n z-index: 99;\n -webkit-app-region: no-drag;\n height: 30px;\n font-family: initial !important;\n margin-left: auto;\n}\n\n.cet-control-icon {\n width: 2.85rem;\n}\n\n.cet-control-icon:not(.inactive):hover {\n background-color: rgb(255 255 255 / 12%);\n}\n\n.light .cet-control-icon:not(.inactive):hover {\n background-color: rgb(0 0 0 / 12%);\n}\n\n.cet-control-icon.inactive svg {\n opacity: 0.4;\n}\n\n.cet-control-icon svg {\n width: 10px;\n height: -webkit-fill-available;\n fill: #fff;\n display: initial !important;\n vertical-align: unset !important;\n}\n\n.cet-titlebar.light .cet-control-icon svg {\n fill: #222222 !important;\n}\n\n.cet-control-close:not(.inactive):hover {\n background-color: rgb(232 17 35 / 90%) !important;\n}\n\n.cet-control-close:not(.inactive):hover svg {\n fill: #fff !important;\n}\n\n/* Resizer */\n.cet-resizer {\n -webkit-app-region: no-drag;\n position: absolute;\n}\n\n.cet-resizer.left {\n top: 0;\n left: 0;\n width: 6px;\n height: 100%;\n}\n\n.cet-resizer.top {\n top: 0;\n width: 100%;\n height: 6px;\n}\n\n/* Container */\n.cet-container {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n overflow: auto;\n z-index: 1;\n}\n\n/* MenuBar */\n.cet-menubar {\n display: flex;\n flex-shrink: 1;\n box-sizing: border-box;\n overflow: hidden;\n flex-wrap: wrap;\n margin-right: 20px;\n}\n\n.cet-menubar.bottom {\n order: 1;\n width: 100%;\n padding: 0 5px 5px;\n margin-right: 0;\n}\n\n.cet-menubar.bottom .cet-menubar-menu-button {\n border-radius: 4px;\n}\n\n.cet-menubar.bottom .cet-menubar-menu-button .cet-menubar-menu-title {\n line-height: 26px;\n}\n\n.cet-menubar .cet-menubar-menu-button {\n box-sizing: border-box;\n padding: 0px 8px;\n height: 100%;\n cursor: default;\n zoom: 1;\n white-space: nowrap;\n -webkit-app-region: no-drag;\n outline: 0;\n}\n\n.cet-menubar .cet-menubar-menu-button .cet-menubar-menu-title {\n font-size: 12px;\n}\n\n.cet-menubar .cet-menubar-menu-button.disabled {\n opacity: 0.4;\n}\n\n.cet-menubar .cet-menubar-menu-button:not(.disabled):hover,\n.cet-menubar .cet-menubar-menu-button:not(.disabled).open {\n background-color: rgb(255 255 255 / 12%);\n}\n\n.cet-titlebar.light .cet-menubar .cet-menubar-menu-button:not(.disabled):hover,\n.cet-titlebar.light .cet-menubar .cet-menubar-menu-button:not(.disabled).open {\n background-color: rgb(0 0 0 / 12%);\n}\n\n.cet-menubar-menu-container {\n position: absolute;\n display: block;\n left: 0px;\n opacity: 1;\n outline: 0;\n border: none;\n text-align: left;\n margin: 0 auto;\n margin-left: 0;\n font-size: inherit;\n overflow-x: visible;\n overflow-y: visible;\n -webkit-overflow-scrolling: touch;\n justify-content: flex-end;\n white-space: nowrap;\n border-radius: 7px;\n backdrop-filter: blur(10px);\n box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2), 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12);\n z-index: 99999;\n}\n\n.cet-menubar-menu-container::-webkit-scrollbar {\n width: 8px;\n height: 4px;\n cursor: pointer;\n background-color: rgba(0, 0, 0, 0);\n}\n\n.cet-menubar-menu-container::-webkit-scrollbar-track {\n border: none;\n background-color: rgba(0, 0, 0, 0);\n}\n\n.cet-menubar-menu-container::-webkit-scrollbar-thumb {\n border-radius: 10px;\n background-color: rgba(110, 110, 110, 0.2);\n}\n\n.cet-menubar-menu-container:focus {\n outline: 0;\n}\n\n.cet-menubar-menu-container .cet-action-item {\n padding: 0;\n margin: 0;\n transform: none;\n display: -ms-flexbox;\n display: flex;\n outline: none;\n}\n\n.cet-menubar-menu-container .cet-action-item.active {\n transform: none;\n}\n\n.cet-menubar-menu-container .cet-action-item.disabled .cet-action-menu-item {\n opacity: 0.4;\n}\n\n.cet-menubar-menu-container .cet-action-item .cet-submenu {\n position: absolute;\n}\n\n.cet-menubar-menu-container .cet-action-menu-item {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n display: -ms-flexbox;\n display: flex;\n height: 2.231em;\n margin: 4px 3px;\n align-items: center;\n position: relative;\n border-radius: 4px;\n text-decoration: none;\n}\n\n.cet-menubar-menu-container .cet-action-label {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n text-decoration: none;\n padding: 0 1em;\n background: none;\n font-size: 12px;\n line-height: 1;\n}\n\n.cet-menubar-menu-container .cet-action-label:not(.separator) {\n display: inline-block;\n -webkit-box-sizing: border-box;\n -o-box-sizing: border-box;\n -moz-box-sizing: border-box;\n -ms-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0 2em 0 0.8em;\n}\n\n.cet-menubar-menu-container .cet-action-label.separator {\n opacity: 0.1;\n font-size: inherit;\n width: 100%;\n border-bottom: 1px solid transparent;\n}\n\n.cet-menubar-menu-container .cet-action-label.separator.text {\n padding: 0.7em 1em 0.1em 1em;\n font-weight: bold;\n opacity: 1;\n}\n\n.cet-menubar-menu-container .cet-action-label:hover {\n color: inherit;\n}\n\n.cet-menubar-menu-container .keybinding,\n.cet-menubar-menu-container .cet-submenu-indicator {\n display: inline-block;\n -ms-flex: 2 1 auto;\n flex: 2 1 auto;\n padding: 0 2em 0 1em;\n text-align: right;\n font-size: 11px;\n line-height: 1;\n}\n\n.cet-menubar-menu-container .cet-submenu-indicator {\n position: absolute;\n right: 4px;\n height: 12px;\n width: 12px;\n padding: 0;\n}\n\n.cet-menubar-menu-container .cet-submenu-indicator img,\n.cet-menubar-menu-container .cet-menu-item-icon .icon,\n.cet-menubar-menu-container .cet-submenu-indicator svg,\n.cet-menubar-menu-container .cet-menu-item-icon svg {\n display: inherit;\n width: 100%;\n height: 100%;\n}\n\n.cet-menubar-menu-container .cet-action-menu-item.checked>.cet-menu-item-icon.checkbox {\n visibility: visible;\n}\n\n.cet-menubar-menu-container .cet-menu-item-icon {\n width: 14px;\n height: 14px;\n margin: 0 0 0 12px;\n}\n\n.cet-menubar-menu-container .cet-menu-item-icon.checkbox {\n visibility: hidden;\n}";
13
13
  const macTheme = "";
14
14
  const winTheme = "";
15
15
  class ThemingRegistry extends _get__("lifecycle_1").Disposable {