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.
- package/LICENSE +21 -0
- package/README.md +32 -105
- package/_config.yml +1 -0
- package/{browser → dist/browser}/browser.d.ts +0 -0
- package/{browser → dist/browser}/event.d.ts +0 -0
- package/{browser → dist/browser}/iframe.d.ts +0 -0
- package/{browser → dist/browser}/keyboardEvent.d.ts +0 -0
- package/{browser → dist/browser}/mouseEvent.d.ts +0 -0
- package/{common → dist/common}/arrays.d.ts +0 -0
- package/{common → dist/common}/async.d.ts +0 -0
- package/{common → dist/common}/charCode.d.ts +0 -0
- package/{common → dist/common}/color.d.ts +0 -0
- package/{common → dist/common}/dom.d.ts +0 -0
- package/{common → dist/common}/event.d.ts +0 -0
- package/{common → dist/common}/iterator.d.ts +0 -0
- package/{common → dist/common}/keyCodes.d.ts +0 -0
- package/{common → dist/common}/lifecycle.d.ts +0 -0
- package/{common → dist/common}/linkedList.d.ts +0 -0
- package/{common → dist/common}/platform.d.ts +0 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +453 -0
- package/dist/interfaces.d.ts +96 -0
- package/{menu → dist/menu}/menu.d.ts +3 -1
- package/{menu → dist/menu}/menuitem.d.ts +3 -4
- package/{menubar.d.ts → dist/menubar.d.ts} +1 -24
- package/dist/titlebar.d.ts +69 -0
- package/package.json +22 -11
- package/webpack.config.js +37 -0
- package/browser/browser.js +0 -157
- package/browser/browser.js.map +0 -1
- package/browser/event.js +0 -30
- package/browser/event.js.map +0 -1
- package/browser/iframe.js +0 -110
- package/browser/iframe.js.map +0 -1
- package/browser/keyboardEvent.js +0 -226
- package/browser/keyboardEvent.js.map +0 -1
- package/browser/mouseEvent.js +0 -110
- package/browser/mouseEvent.js.map +0 -1
- package/common/arrays.js +0 -18
- package/common/arrays.js.map +0 -1
- package/common/async.js +0 -95
- package/common/async.js.map +0 -1
- package/common/charCode.js +0 -7
- package/common/charCode.js.map +0 -1
- package/common/color.js +0 -494
- package/common/color.js.map +0 -1
- package/common/dom.js +0 -984
- package/common/dom.js.map +0 -1
- package/common/event.js +0 -611
- package/common/event.js.map +0 -1
- package/common/iterator.js +0 -164
- package/common/iterator.js.map +0 -1
- package/common/keyCodes.js +0 -268
- package/common/keyCodes.js.map +0 -1
- package/common/lifecycle.js +0 -63
- package/common/lifecycle.js.map +0 -1
- package/common/linkedList.js +0 -139
- package/common/linkedList.js.map +0 -1
- package/common/platform.js +0 -115
- package/common/platform.js.map +0 -1
- package/index.d.ts +0 -3
- package/index.js +0 -20
- package/index.js.map +0 -1
- package/menu/menu.js +0 -538
- package/menu/menu.js.map +0 -1
- package/menu/menuitem.js +0 -339
- package/menu/menuitem.js.map +0 -1
- package/menubar.js +0 -608
- package/menubar.js.map +0 -1
- package/themebar.d.ts +0 -20
- package/themebar.js +0 -568
- package/themebar.js.map +0 -1
- package/titlebar.d.ts +0 -135
- package/titlebar.js +0 -453
- 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
|
[](https://github.com/AlexTorresSk/custom-electron-titlebar/blob/master/LICENSE)
|
|
8
6
|
[](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
|

|
|
13
11
|
|
|
14
|
-

|
|
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 **
|
|
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('#
|
|
31
|
+
backgroundColor: customTitlebar.Color.fromHex('#ECECEC')
|
|
34
32
|
});
|
|
35
33
|
```
|
|
36
34
|
|
|
37
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
|
64
|
-
| ------------------------------ |
|
|
65
|
-
| backgroundColor **(required)** | Color
|
|
66
|
-
| icon | string
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
| menuPosition | string
|
|
77
|
-
| enableMnemonics | boolean
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
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
|
-
|
|
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
|