custom-electron-titlebar 4.2.8 → 4.4.1

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.
Files changed (74) hide show
  1. package/README.md +32 -12
  2. package/index.d.mts +684 -0
  3. package/index.d.ts +684 -3
  4. package/index.js +5207 -175
  5. package/index.js.map +1 -0
  6. package/index.mjs +5219 -0
  7. package/index.mjs.map +1 -0
  8. package/main/index.d.mts +21 -0
  9. package/main/index.d.ts +21 -3
  10. package/main/index.js +793 -175
  11. package/main/index.js.map +1 -0
  12. package/main/index.mjs +785 -0
  13. package/main/index.mjs.map +1 -0
  14. package/package.json +40 -32
  15. package/base/browser/browser.d.ts +0 -26
  16. package/base/browser/browser.js +0 -317
  17. package/base/browser/event.d.ts +0 -12
  18. package/base/browser/event.js +0 -215
  19. package/base/browser/keyboardEvent.d.ts +0 -38
  20. package/base/browser/keyboardEvent.js +0 -462
  21. package/base/browser/mouseEvent.d.ts +0 -61
  22. package/base/browser/mouseEvent.js +0 -327
  23. package/base/browser/touch.d.ts +0 -39
  24. package/base/browser/touch.js +0 -454
  25. package/base/common/arrays.d.ts +0 -10
  26. package/base/common/arrays.js +0 -210
  27. package/base/common/async.d.ts +0 -35
  28. package/base/common/async.js +0 -280
  29. package/base/common/charCode.d.ts +0 -405
  30. package/base/common/charCode.js +0 -9
  31. package/base/common/color.d.ts +0 -159
  32. package/base/common/color.js +0 -708
  33. package/base/common/decorators.d.ts +0 -6
  34. package/base/common/decorators.js +0 -300
  35. package/base/common/dom.d.ts +0 -221
  36. package/base/common/dom.js +0 -1476
  37. package/base/common/event.d.ts +0 -213
  38. package/base/common/event.js +0 -804
  39. package/base/common/iterator.d.ts +0 -69
  40. package/base/common/iterator.js +0 -380
  41. package/base/common/keyCodes.d.ts +0 -478
  42. package/base/common/keyCodes.js +0 -477
  43. package/base/common/lifecycle.d.ts +0 -17
  44. package/base/common/lifecycle.js +0 -258
  45. package/base/common/linkedList.d.ts +0 -17
  46. package/base/common/linkedList.js +0 -319
  47. package/base/common/platform.d.ts +0 -36
  48. package/base/common/platform.js +0 -314
  49. package/base/common/strings.d.ts +0 -23
  50. package/base/common/strings.js +0 -273
  51. package/consts.d.ts +0 -58
  52. package/consts.js +0 -317
  53. package/main/attach-titlebar-to-window.d.ts +0 -3
  54. package/main/attach-titlebar-to-window.js +0 -210
  55. package/main/setup-titlebar.d.ts +0 -2
  56. package/main/setup-titlebar.js +0 -255
  57. package/menubar/index.d.ts +0 -86
  58. package/menubar/index.js +0 -1119
  59. package/menubar/menu/index.d.ts +0 -46
  60. package/menubar/menu/index.js +0 -565
  61. package/menubar/menu/item.d.ts +0 -67
  62. package/menubar/menu/item.js +0 -575
  63. package/menubar/menu/separator.d.ts +0 -11
  64. package/menubar/menu/separator.js +0 -213
  65. package/menubar/menu/submenu.d.ts +0 -32
  66. package/menubar/menu/submenu.js +0 -372
  67. package/menubar/menubar-options.d.ts +0 -47
  68. package/menubar/menubar-options.js +0 -9
  69. package/titlebar/index.d.ts +0 -105
  70. package/titlebar/index.js +0 -703
  71. package/titlebar/options.d.ts +0 -89
  72. package/titlebar/options.js +0 -9
  73. package/titlebar/themebar.d.ts +0 -20
  74. package/titlebar/themebar.js +0 -267
package/README.md CHANGED
@@ -2,11 +2,12 @@
2
2
 
3
3
  This project is a typescript library for electron that allows you to configure a fully customizable title bar.
4
4
 
5
- [![CI](https://badgen.net/github/checks/AlexTorresDev/custom-electron-titlebar?label=CI)](https://github.com/AlexTorresDev/custom-electron-titlebar/actions/workflows/build-release.yml)
5
+ [![CI](https://badgen.net/github/checks/AlexTorresDev/custom-electron-titlebar?label=CI)](https://github.com/AlexTorresDev/custom-electron-titlebar/actions/workflows/build.yml)
6
6
  [![License](https://badgen.net/github/license/AlexTorresDev/custom-electron-titlebar?label=License)](https://github.com/AlexTorresDev/custom-electron-titlebar/blob/master/LICENSE)
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
+
10
11
  [📄 Documentation](https://github.com/AlexTorresDev/custom-electron-titlebar/wiki)
11
12
 
12
13
  ### Standard Title Bar
@@ -42,10 +43,7 @@ The implementation is done as follows:
42
43
 
43
44
  In the main application file (main.js or .ts)
44
45
  ```js
45
- import { setupTitlebar, attachTitlebarToWindow } from "custom-electron-titlebar/main";
46
-
47
- // setup the titlebar main process
48
- setupTitlebar();
46
+ import { setupTitlebarAndAttachToWindow } from "custom-electron-titlebar/main";
49
47
 
50
48
  function createWindow() {
51
49
  // Create the browser window.
@@ -64,20 +62,42 @@ function createWindow() {
64
62
 
65
63
  ...
66
64
 
67
- // attach fullScreen(f11 and not 'maximized') && focus listeners
68
- attachTitlebarToWindow(mainWindow);
65
+ // Setup main IPC + attach window listeners + load theme config
66
+ setupTitlebarAndAttachToWindow(mainWindow, {
67
+ themeConfigPath: path.join(__dirname, "titlebar.theme.json")
68
+ });
69
69
  }
70
70
  ```
71
71
 
72
72
  In the preload file (preload.js or .ts)
73
73
  ```js
74
- import { Titlebar } from "custom-electron-titlebar";
74
+ import { createTitlebarOnDOMContentLoaded } from "custom-electron-titlebar";
75
75
 
76
- window.addEventListener('DOMContentLoaded', () => {
77
- // Title bar implementation
78
- new Titlebar();
79
- });
76
+ // Theme configuration is automatically loaded from main process
77
+ createTitlebarOnDOMContentLoaded();
80
78
  ```
79
+
80
+ **Theme Configuration:**
81
+
82
+ Themes are loaded in the main process and delivered to the renderer via IPC. Specify the theme file path in `setupTitlebarAndAttachToWindow()` options:
83
+
84
+ Theme JSON schema (v1):
85
+ ```json
86
+ {
87
+ "version": 1,
88
+ "fontFamily": "Segoe UI, Arial, sans-serif",
89
+ "fontSize": 13,
90
+ "colors": {
91
+ "titlebar": "#1f2430",
92
+ "titlebarForeground": "#f3f4f6",
93
+ "menuBar": "#181c25",
94
+ "menuItemSelection": "#2f3a4f",
95
+ "menuSeparator": "#4b5563",
96
+ "svg": "#e5e7eb"
97
+ }
98
+ }
99
+ ```
100
+
81
101
  To see the options you can include in the Title Bar constructor, such as color of elements, icons, menu position, and much more, and the methods you can use, go to the [wiki](https://github.com/AlexTorresDev/custom-electron-titlebar/wiki)
82
102
 
83
103
  ## 💰 Support