custom-electron-titlebar 3.2.7 → 4.0.0-beta.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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -105
  3. package/_config.yml +1 -0
  4. package/{browser → dist/browser}/browser.d.ts +0 -0
  5. package/{browser → dist/browser}/event.d.ts +0 -0
  6. package/{browser → dist/browser}/iframe.d.ts +0 -0
  7. package/{browser → dist/browser}/keyboardEvent.d.ts +0 -0
  8. package/{browser → dist/browser}/mouseEvent.d.ts +0 -0
  9. package/{common → dist/common}/arrays.d.ts +0 -0
  10. package/{common → dist/common}/async.d.ts +0 -0
  11. package/{common → dist/common}/charCode.d.ts +0 -0
  12. package/{common → dist/common}/color.d.ts +0 -0
  13. package/{common → dist/common}/dom.d.ts +0 -0
  14. package/{common → dist/common}/event.d.ts +0 -0
  15. package/{common → dist/common}/iterator.d.ts +0 -0
  16. package/{common → dist/common}/keyCodes.d.ts +0 -0
  17. package/{common → dist/common}/lifecycle.d.ts +0 -0
  18. package/{common → dist/common}/linkedList.d.ts +0 -0
  19. package/{common → dist/common}/platform.d.ts +0 -0
  20. package/dist/index.d.ts +7 -0
  21. package/dist/index.js +453 -0
  22. package/dist/interfaces.d.ts +96 -0
  23. package/{menu → dist/menu}/menu.d.ts +3 -1
  24. package/{menu → dist/menu}/menuitem.d.ts +3 -4
  25. package/{menubar.d.ts → dist/menubar.d.ts} +1 -24
  26. package/dist/titlebar.d.ts +69 -0
  27. package/package.json +22 -11
  28. package/webpack.config.js +37 -0
  29. package/browser/browser.js +0 -157
  30. package/browser/browser.js.map +0 -1
  31. package/browser/event.js +0 -30
  32. package/browser/event.js.map +0 -1
  33. package/browser/iframe.js +0 -110
  34. package/browser/iframe.js.map +0 -1
  35. package/browser/keyboardEvent.js +0 -226
  36. package/browser/keyboardEvent.js.map +0 -1
  37. package/browser/mouseEvent.js +0 -110
  38. package/browser/mouseEvent.js.map +0 -1
  39. package/common/arrays.js +0 -18
  40. package/common/arrays.js.map +0 -1
  41. package/common/async.js +0 -95
  42. package/common/async.js.map +0 -1
  43. package/common/charCode.js +0 -7
  44. package/common/charCode.js.map +0 -1
  45. package/common/color.js +0 -494
  46. package/common/color.js.map +0 -1
  47. package/common/dom.js +0 -984
  48. package/common/dom.js.map +0 -1
  49. package/common/event.js +0 -611
  50. package/common/event.js.map +0 -1
  51. package/common/iterator.js +0 -164
  52. package/common/iterator.js.map +0 -1
  53. package/common/keyCodes.js +0 -268
  54. package/common/keyCodes.js.map +0 -1
  55. package/common/lifecycle.js +0 -63
  56. package/common/lifecycle.js.map +0 -1
  57. package/common/linkedList.js +0 -139
  58. package/common/linkedList.js.map +0 -1
  59. package/common/platform.js +0 -115
  60. package/common/platform.js.map +0 -1
  61. package/index.d.ts +0 -3
  62. package/index.js +0 -20
  63. package/index.js.map +0 -1
  64. package/menu/menu.js +0 -538
  65. package/menu/menu.js.map +0 -1
  66. package/menu/menuitem.js +0 -339
  67. package/menu/menuitem.js.map +0 -1
  68. package/menubar.js +0 -608
  69. package/menubar.js.map +0 -1
  70. package/themebar.d.ts +0 -20
  71. package/themebar.js +0 -568
  72. package/themebar.js.map +0 -1
  73. package/titlebar.d.ts +0 -135
  74. package/titlebar.js +0 -453
  75. package/titlebar.js.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Alex Torres
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,9 +1,7 @@
1
- # Custom Electron Titlebar
1
+ # Custom Electron Titlebar 4
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
- ### **It is a library for electron, it cannot be used on a basic website.**
6
-
7
5
  [![LICENSE](https://img.shields.io/github/license/AlexTorresSk/custom-electron-titlebar.svg)](https://github.com/AlexTorresSk/custom-electron-titlebar/blob/master/LICENSE)
8
6
  [![NPM Version](https://img.shields.io/npm/v/custom-electron-titlebar.svg)](https://npmjs.org/package/custom-electron-titlebar)
9
7
 
@@ -11,8 +9,6 @@ This project is a typescript library for electron that allows you to configure a
11
9
 
12
10
  ![Preview 2](screenshots/window_2.png)
13
11
 
14
- ![Preview 3](screenshots/window_3.png)
15
-
16
12
  ## Install
17
13
 
18
14
  ```
@@ -24,17 +20,19 @@ or use example folder to init basic electron project with this titlebar.
24
20
  ## Usage
25
21
 
26
22
  #### Step 1
27
- In your **renderer** file or in an **HTML script tag** add:
23
+ In your **preload** file add:
24
+
25
+ For javascript
28
26
 
29
27
  ```js
30
28
  const customTitlebar = require('custom-electron-titlebar');
31
29
 
32
30
  new customTitlebar.Titlebar({
33
- backgroundColor: customTitlebar.Color.fromHex('#444')
31
+ backgroundColor: customTitlebar.Color.fromHex('#ECECEC')
34
32
  });
35
33
  ```
36
34
 
37
- > if you are using _typescript_
35
+ For typescript
38
36
  ```ts
39
37
  import { Titlebar, Color } from 'custom-electron-titlebar'
40
38
 
@@ -49,10 +47,13 @@ The parameter `backgroundColor: Color` is required, this should be `Color` type.
49
47
  #### Step 2
50
48
  Update the code that launches browser window
51
49
  ```js
52
- var mainWindow = new BrowserWindow({
53
- width: 1000,
54
- height: 600,
55
- titleBarStyle: "hidden", // add this line
50
+ let mainWindow = new BrowserWindow({
51
+ width: 1000,
52
+ height: 600,
53
+ titleBarStyle: "hidden", // add this line
54
+ webPreferences: {
55
+ preload: path.join(__dirname, 'preload.js')
56
+ }
56
57
  });
57
58
  ```
58
59
 
@@ -60,25 +61,24 @@ var mainWindow = new BrowserWindow({
60
61
 
61
62
  The interface [`TitleBarOptions`] is managed, which has the following configurable options for the title bar. Some parameters are optional.
62
63
 
63
- | Parameter | Type | Description | Default |
64
- | ------------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
65
- | backgroundColor **(required)** | Color | The background color of the titlebar. | #444444 |
66
- | icon | string | The icon shown on the left side of the title bar. | null |
67
- | iconsTheme | Theme | Style of the icons. | Themebar.win |
68
- | shadow | boolean | The shadow of the titlebar. | false |
69
- | drag | boolean | Define whether or not you can drag the window by holding the click on the title bar. | true |
70
- | minimizable | boolean | Enables or disables the option to minimize the window by clicking on the corresponding button in the title bar. | true |
71
- | maximizable | boolean | Enables or disables the option to maximize and un-maximize the window by clicking on the corresponding button in the title bar. | true |
72
- | closeable | boolean | Enables or disables the option of the close window by clicking on the corresponding button in the title bar. | true |
73
- | order | string | Set the order of the elements on the title bar. (`inverted`, `first-buttons`) | null |
74
- | titleHorizontalAlignment | string | Set horizontal alignment of the window title. (`left`, `center`, `right`) | center |
75
- | menu | Electron.Menu | The menu to show in the title bar. | Menu.getApplicationMenu() |
76
- | menuPosition | string | The position of menubar on titlebar. | left |
77
- | enableMnemonics | boolean | Enable the mnemonics on menubar and menu items. | true |
78
- | itemBackgroundColor | Color | The background color when the mouse is over the item. | rgba(0, 0, 0, .14) |
79
- | hideWhenClickingClose | boolean | When the close button is clicked, the window is hidden instead of closed. | false |
80
- | overflow | string | The overflow of the container (`auto`, `visible`, `hidden`) | auto |
81
- | unfocusEffect | boolean | Enables or disables the blur option in the title bar. | false |
64
+ | Parameter | Type | Description | Default |
65
+ | ------------------------------ | ------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
66
+ | backgroundColor **(required)** | Color | The background color of the titlebar. | #444444 |
67
+ | icon | string | The icon shown on the left side of the title bar. | null |
68
+ | shadow | boolean | The shadow of the titlebar. | false |
69
+ | drag | boolean | Define whether or not you can drag the window by holding the click on the title bar. | true |
70
+ | onMinimize | Funtion | Enables or disables the option to minimize the window by clicking on the corresponding button in the title bar. | undefined |
71
+ | onMaximize | Funtion | Enables or disables the option to maximize and un-maximize the window by clicking on the corresponding button in the title bar. | undefined |
72
+ | onClose | Funtion | Enables or disables the option of the close window by clicking on the corresponding button in the title bar. | undefined |
73
+ | isMaximized | Funtion | Check if window is maximized. | undefined |
74
+ | onMenuItemClick | Funtion(commandId: number)| Fires when any menu option is pressed. | undefined |
75
+ | order | string | Set the order of the elements on the title bar. (`inverted`, `first-buttons`) | null |
76
+ | titleHorizontalAlignment | string | Set horizontal alignment of the window title. (`left`, `center`, `right`) | center |
77
+ | menuPosition | string | The position of menubar on titlebar. | left |
78
+ | enableMnemonics | boolean | Enable the mnemonics on menubar and menu items. | true |
79
+ | hideWhenClickingClose | boolean | When the close button is clicked, the window is hidden instead of closed. | false |
80
+ | overflow | string | The overflow of the container (`auto`, `visible`, `hidden`) | auto |
81
+ | unfocusEffect | boolean | Enables or disables the blur option in the title bar. | false |
82
82
 
83
83
  ## Methods
84
84
 
@@ -124,51 +124,6 @@ With this method you can update the icon. This method receives the url of the im
124
124
  titlebar.updateIcon('./images/my-icon.svg');
125
125
  ```
126
126
 
127
- ### Update Menu
128
-
129
- This method updates or creates the menu, to create the menu use remote.Menu and remote.MenuItem.
130
-
131
- ```js
132
- const menu = new Menu();
133
- menu.append(new MenuItem({
134
- label: 'Item 1',
135
- submenu: [
136
- {
137
- label: 'Subitem 1',
138
- click: () => console.log('Click on subitem 1')
139
- },
140
- {
141
- type: 'separator'
142
- }
143
- ]
144
- }));
145
-
146
- menu.append(new MenuItem({
147
- label: 'Item 2',
148
- submenu: [
149
- {
150
- label: 'Subitem checkbox',
151
- type: 'checkbox',
152
- checked: true
153
- },
154
- {
155
- type: 'separator'
156
- },
157
- {
158
- label: 'Subitem with submenu',
159
- submenu: [
160
- {
161
- label: 'Submenu &item 1',
162
- accelerator: 'Ctrl+T'
163
- }
164
- ]
165
- }
166
- ]
167
- }));
168
-
169
- titlebar.updateMenu(menu);
170
- ```
171
-
172
127
  ### Update Menu Position
173
128
 
174
129
  You can change the position of the menu bar. `left` and `bottom` are allowed.
@@ -179,9 +134,7 @@ titlebar.updateMenuPosition('bottom');
179
134
 
180
135
  ### Set Horizontal Alignment
181
136
 
182
- > setHorizontalAlignment method was contributed by [@MairwunNx](https://github.com/MairwunNx) :punch:
183
-
184
- `left`, `center` and `right` are allowed
137
+ You can change the position of the title of title bar. `left`, `center` and `right` are allowed
185
138
 
186
139
  ```js
187
140
  titlebar.setHorizontalAlignment('right');
@@ -195,32 +148,6 @@ This method removes the title bar completely and all recorded events.
195
148
  titlebar.dispose();
196
149
  ```
197
150
 
198
- ## CSS Classes
199
- The following CSS classes exist and can be used to customize the titlebar
200
-
201
- | Class name | Description |
202
- | --------------------------- | ----------------------------------------------- |
203
- | .titlebar | Styles the titlebar. |
204
- | .window-appicon | Styles the app icon on the titlebar. |
205
- | .window-title | Styles the window title. (Example: font-size) |
206
- | .window-controls-container | Styles the window controls section. |
207
- | .resizer top | Description missing |
208
- | .resizer left | Description missing |
209
- | .menubar | Description missing |
210
- | .menubar-menu-button | Styles the main menu elements. (Example: color) |
211
- | .menubar-menu-button open | Description missing |
212
- | .menubar-menu-title | Description missing |
213
- | .action-item | Description missing |
214
- | .action-menu-item | Styles action menu elements. (Example: color) |
215
-
216
- ## Contributing
217
-
218
- Many thanks to all the people who support this project through issues and pull request.
219
- If you want to contribute with this project, all the issues and pull request are welcome.
220
-
221
- You can also:<br>
222
- <a href="https://www.buymeacoffee.com/bjkGN4g" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
223
-
224
151
  ## License
225
152
 
226
153
  This project is under the [MIT](https://github.com/AlexTorresSk/custom-electron-titlebar/blob/master/LICENSE) license.
package/_config.yml ADDED
@@ -0,0 +1 @@
1
+ theme: jekyll-theme-cayman
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,7 @@
1
+ import Titlebar from './titlebar';
2
+ import { Color } from './common/color';
3
+ declare const _default: {
4
+ Titlebar: typeof Titlebar;
5
+ Color: typeof Color;
6
+ };
7
+ export default _default;