@todesktop/shared 7.54.0 → 7.57.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.
@@ -1,7 +1,5 @@
1
- /// <reference types="node" />
2
1
  import { IApp } from "./toDesktop";
3
2
  import { Configuration, PackagerOptions, PublishOptions } from "app-builder-lib";
4
- import { MenuItemConstructorOptions, BrowserWindowConstructorOptions } from "@todesktop/client-electron-types";
5
3
  declare type appBuilderLib = PackagerOptions & PublishOptions;
6
4
  export interface IAppBuilderLib extends appBuilderLib {
7
5
  config: Configuration;
@@ -139,52 +137,6 @@ export declare const isPlatformBuildRunning: (platformBuild: PlatformBuild) => b
139
137
  export declare const isCiBuildRunning: (build: Build) => boolean;
140
138
  export declare const isBuildRunning: (build: Build) => boolean;
141
139
  export declare const isBuildCancellable: (build: Build) => boolean;
142
- declare type todesktopRoles = "todesktop:launch-at-startup" | "todesktop:check-for-updates" | "todesktop:quit" | "todesktop:new-window" | "todesktop:new-tab" | "todesktop:check-for-updates" | "todesktop:history-home" | "todesktop:history-back" | "todesktop:history-forward" | "todesktop:show-window" | "todesktop:hide-window";
143
- export interface DesktopifyMenuItemConstructorOptions extends Omit<MenuItemConstructorOptions, "role" | "submenu"> {
144
- platforms?: NodeJS.Platform[];
145
- submenu?: DesktopifyMenuItemConstructorOptions[];
146
- role?: MenuItemConstructorOptions["role"] | todesktopRoles;
147
- }
148
- export interface DesktopifyAppWindow {
149
- id: string;
150
- name: string;
151
- url: string;
152
- fullScreen: boolean;
153
- height: number;
154
- minHeight?: number;
155
- maxHeight?: number;
156
- hasMinHeight?: boolean;
157
- hasMaxHeight?: boolean;
158
- width: number;
159
- minWidth?: number;
160
- maxWidth?: number;
161
- hasMinWidth?: boolean;
162
- hasMaxWidth?: boolean;
163
- isResizable: boolean;
164
- titleBarStyle?: "hidden" | "hiddenInset" | "customButtonsOnHover";
165
- alwaysOnTop: boolean;
166
- visibility: "visible" | "hidden" | "show-when-contents-loaded";
167
- isMain: boolean;
168
- applicationMenu: DesktopifyMenuItemConstructorOptions[];
169
- type: "menubar" | "app";
170
- transparentTitlebar: boolean;
171
- shouldResetDimensions?: boolean;
172
- vibrancy?: BrowserWindowConstructorOptions["vibrancy"];
173
- }
174
- export declare type DesktopifyAppTrayToggleWindowAction = {
175
- role: "toggleWindow";
176
- windowId: string;
177
- };
178
- export declare type DesktopifyAppTrayToggleMenuAction = {
179
- role: "toggleMenu";
180
- menu: DesktopifyMenuItemConstructorOptions[];
181
- };
182
- export declare type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction;
183
- export interface DesktopifyAppTray {
184
- icon: string;
185
- rightClick?: DesktopifyAppTrayAction;
186
- leftClick?: DesktopifyAppTrayAction;
187
- }
188
140
  export interface DesktopifyApp {
189
141
  name: string;
190
142
  targetUrl: string;
@@ -230,8 +182,4 @@ export interface DesktopifyApp {
230
182
  companyName?: string;
231
183
  pollForAppUpdatesEveryXMinutes?: number;
232
184
  }
233
- export interface DesktopifyApp2 extends DesktopifyApp {
234
- windows: DesktopifyAppWindow[];
235
- trays: DesktopifyAppTray[];
236
- }
237
185
  export {};
package/lib/desktopify.js CHANGED
@@ -59,4 +59,3 @@ exports.isBuildRunning = (build) => {
59
59
  ["linux", "mac", "windows"].some((platform) => exports.isPlatformBuildRunning(build[platform])));
60
60
  };
61
61
  exports.isBuildCancellable = (build) => exports.hasBuildKickedOff(build) && exports.isBuildRunning(build);
62
- let s;
@@ -0,0 +1,252 @@
1
+ /// <reference types="node" />
2
+ import { IApp, ISwitchableValue } from "./toDesktop";
3
+ import { MenuItemConstructorOptions, BrowserWindowConstructorOptions, WebPreferences } from "@todesktop/client-electron-types";
4
+ /**
5
+ * Custom ToDesktop Roles for Application & Tray Menus
6
+ */
7
+ declare type todesktopRoles = "todesktop:launch-at-startup" | "todesktop:check-for-updates" | "todesktop:quit" | "todesktop:new-window" | "todesktop:new-tab" | "todesktop:check-for-updates" | "todesktop:history-home" | "todesktop:history-back" | "todesktop:history-forward" | "todesktop:show-window" | "todesktop:hide-window";
8
+ export interface DesktopifyMenuItemConstructorOptions extends Omit<MenuItemConstructorOptions, "role" | "submenu"> {
9
+ platforms?: NodeJS.Platform;
10
+ submenu?: DesktopifyMenuItemConstructorOptions[];
11
+ role?: MenuItemConstructorOptions["role"] | todesktopRoles;
12
+ }
13
+ /**
14
+ * Toggle Window Tray Action
15
+ *
16
+ * @param windowId - The id of the window to toggle
17
+ */
18
+ export declare type DesktopifyAppTrayToggleWindowAction = {
19
+ role: "toggleWindow";
20
+ windowId: string;
21
+ };
22
+ /**
23
+ * Toggle Menu Tray Action
24
+ *
25
+ * @param menu - The menu to show when action triggered
26
+ */
27
+ export declare type DesktopifyAppTrayToggleMenuAction = {
28
+ role: "toggleMenu";
29
+ menu: DesktopifyMenuItemConstructorOptions[];
30
+ };
31
+ /**
32
+ * No Action Tray Action
33
+ */
34
+ export declare type DesktopifyAppTrayNoAction = {
35
+ role: "noAction";
36
+ };
37
+ export declare type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction | DesktopifyAppTrayNoAction;
38
+ export interface DesktopifyAppTray {
39
+ id: string;
40
+ icon: string;
41
+ rightClick: DesktopifyAppTrayAction;
42
+ leftClick: DesktopifyAppTrayAction;
43
+ }
44
+ /**
45
+ * Whitelist of allowed DesktopifyWindow Options.
46
+ * These attrs (if set) are passed to the `BrowserWindow` constructor
47
+ * when the window is created
48
+ */
49
+ export declare const allowedBrowserWindowConstructorOptions: Readonly<(keyof BrowserWindowConstructorOptions)[]>;
50
+ export declare type whitelistedBrowserWindowConstructorOptions = typeof allowedBrowserWindowConstructorOptions[number];
51
+ /**
52
+ * Whitelist of allowed DesktopifyWindow Web Preferences Options.
53
+ * These attrs (if set) are passed to the webPreferences object in the `BrowserWindow` constructor
54
+ * when the window is created
55
+ */
56
+ export declare const allowedWebPreferencesOptions: Readonly<(keyof WebPreferences)[]>;
57
+ export declare type whitelistedWebPreferencesOptions = typeof allowedWebPreferencesOptions[number];
58
+ /**
59
+ * Interface for ToDesktop App Windows
60
+ */
61
+ export interface DesktopifyAppWindow {
62
+ /**
63
+ * A unique window id
64
+ */
65
+ id: string;
66
+ /**
67
+ * The window name. Only visible to developer
68
+ */
69
+ name: string;
70
+ /**
71
+ * The window's url
72
+ */
73
+ url: string;
74
+ /**
75
+ * Whether this is the main window. The main window handles deeplinks
76
+ */
77
+ isMain: boolean;
78
+ /**
79
+ * The type of window
80
+ */
81
+ type: "menubar" | "app";
82
+ /**
83
+ * The window's application menu
84
+ */
85
+ applicationMenu: DesktopifyMenuItemConstructorOptions[];
86
+ /**
87
+ * Keyboard shortcut to toggle window visibility
88
+ */
89
+ toggleVisibilityKeyboardShortcut?: string;
90
+ /**
91
+ * By default ToDesktop remembers window width & height between sessions.
92
+ * Setting to `true` disables behaviour
93
+ */
94
+ shouldResetDimensions?: boolean;
95
+ /**
96
+ * If `true` prevents the native window's title from changing when the document title changes
97
+ */
98
+ isTitleStatic?: boolean;
99
+ /**
100
+ * Disables default rightClick menu
101
+ */
102
+ disableContextMenu: boolean;
103
+ /**
104
+ * Allows user to `Cmd+F` or `Edit>Find` to search for text on page
105
+ */
106
+ isFindInPageEnabled?: boolean;
107
+ /**
108
+ * Inital visibility of window
109
+ */
110
+ visibility: "visible" | "hidden" | "show-when-contents-loaded";
111
+ /**
112
+ * Does the window have a minimum width. Default is `false`
113
+ */
114
+ hasMinWidth: boolean;
115
+ /**
116
+ * Does the window have a maximum width. Default is `false`
117
+ */
118
+ hasMaxWidth: boolean;
119
+ /**
120
+ * Does the window have a minimum height. Default is `false`
121
+ */
122
+ hasMinHeight: boolean;
123
+ /**
124
+ * Does the window have a maximum height. Default is `false`
125
+ */
126
+ hasMaxHeight: boolean;
127
+ /**
128
+ * BrowserWindow Constructor Options
129
+ */
130
+ options: Pick<BrowserWindowConstructorOptions, whitelistedBrowserWindowConstructorOptions> & {
131
+ /**
132
+ * Settings of web page's features.
133
+ */
134
+ webPreferences?: Pick<WebPreferences, whitelistedWebPreferencesOptions>;
135
+ };
136
+ }
137
+ export interface DesktopifyApp2 {
138
+ /**
139
+ * The name of the app
140
+ */
141
+ name: string;
142
+ /**
143
+ * A unique app id
144
+ */
145
+ id: string;
146
+ /**
147
+ * The app icon
148
+ */
149
+ icon?: string;
150
+ /**
151
+ * The name of the company that the app belongs to
152
+ */
153
+ companyName?: string;
154
+ /**
155
+ * Only allow a single instance of this app to run
156
+ */
157
+ singleInstance: boolean;
158
+ /**
159
+ * Regex patterns for internal app urls
160
+ */
161
+ internalUrls?: ISwitchableValue<string>;
162
+ /**
163
+ * By default ToDesktop uses native `window.open` to support Firebase social login.
164
+ * This makes the app use electron's `window.open`.
165
+ */
166
+ isNativeWindowOpenDisabled?: boolean;
167
+ /**
168
+ * Specifys the app's user agent
169
+ */
170
+ userAgent?: ISwitchableValue<string>;
171
+ /**
172
+ * Disable devTools on all app windows
173
+ */
174
+ disableDevTools: boolean;
175
+ /**
176
+ * Registers an app protocol. Format should be `{APP_PROTOCOL}://` e.g. `example://`
177
+ */
178
+ appProtocol?: ISwitchableValue<string>;
179
+ /**
180
+ * Disables the same-origin policy
181
+ */
182
+ insecure?: boolean;
183
+ /**
184
+ * Opens `accounts.google.com/o/oauth` in user's default browswer not as internal url
185
+ */
186
+ googleOAuthIsExternal?: boolean;
187
+ /**
188
+ * Removes electron from userAgent
189
+ */
190
+ shouldUseRealUserAgent?: boolean;
191
+ /**
192
+ * Runtime environment variables
193
+ */
194
+ runtimeEnvs?: {
195
+ [key: string]: string;
196
+ };
197
+ /**
198
+ * Launch App at startup
199
+ */
200
+ shouldLaunchAtStartupByDefault?: boolean;
201
+ /**
202
+ * Disables non-essential logs
203
+ */
204
+ shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
205
+ /**
206
+ * Disables electron overrides which ensure renderer process are restarted on each navigation.
207
+ * Learn more {@link https://github.com/electron/electron/issues/18397}
208
+ */
209
+ shouldReuseRendererProcess?: boolean;
210
+ /**
211
+ * Open same domain links in user's default browser
212
+ */
213
+ shouldMakeSameDomainAnExternalLink?: boolean;
214
+ /**
215
+ * Enables push notifications
216
+ */
217
+ enablePushNotifications?: boolean;
218
+ /**
219
+ * Sets theme for Electron UI elements and css.
220
+ *
221
+ * See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
222
+ */
223
+ themeSource?: "system" | "light" | "dark";
224
+ /**
225
+ * Sets theme source for only mac
226
+ *
227
+ * See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
228
+ */
229
+ themeSourceMac?: "system" | "light" | "dark";
230
+ /**
231
+ * URL that crash reports will be POSTed to
232
+ */
233
+ crashReporter?: string;
234
+ /**
235
+ * Unused currently
236
+ * @unused
237
+ */
238
+ pollForAppUpdatesEveryXMinutes?: number;
239
+ /**
240
+ * The app's windows
241
+ */
242
+ windows: DesktopifyAppWindow[];
243
+ /**
244
+ * The app's trays
245
+ */
246
+ trays: DesktopifyAppTray[];
247
+ }
248
+ export interface IApp2 extends IApp {
249
+ windows: DesktopifyAppWindow[];
250
+ trays: DesktopifyAppTray[];
251
+ }
252
+ export {};
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Whitelist of allowed DesktopifyWindow Options.
5
+ * These attrs (if set) are passed to the `BrowserWindow` constructor
6
+ * when the window is created
7
+ */
8
+ exports.allowedBrowserWindowConstructorOptions = [
9
+ "width",
10
+ "height",
11
+ // "x",
12
+ // "y",
13
+ "useContentSize",
14
+ "center",
15
+ "minWidth",
16
+ "minHeight",
17
+ "maxWidth",
18
+ "maxHeight",
19
+ "resizable",
20
+ "movable",
21
+ "minimizable",
22
+ "maximizable",
23
+ "closable",
24
+ "focusable",
25
+ "alwaysOnTop",
26
+ "fullscreen",
27
+ "fullscreenable",
28
+ "simpleFullscreen",
29
+ "skipTaskbar",
30
+ "kiosk",
31
+ "icon",
32
+ "paintWhenInitiallyHidden",
33
+ "frame",
34
+ "acceptFirstMouse",
35
+ "disableAutoHideCursor",
36
+ "autoHideMenuBar",
37
+ "enableLargerThanScreen",
38
+ "backgroundColor",
39
+ "hasShadow",
40
+ "opacity",
41
+ "darkTheme",
42
+ "transparent",
43
+ "visualEffectState",
44
+ "titleBarStyle",
45
+ "trafficLightPosition",
46
+ "roundedCorners",
47
+ "fullscreenWindowTitle",
48
+ "thickFrame",
49
+ "type",
50
+ "vibrancy",
51
+ "zoomToPageWidth",
52
+ "tabbingIdentifier",
53
+ ];
54
+ /**
55
+ * Whitelist of allowed DesktopifyWindow Web Preferences Options.
56
+ * These attrs (if set) are passed to the webPreferences object in the `BrowserWindow` constructor
57
+ * when the window is created
58
+ */
59
+ exports.allowedWebPreferencesOptions = [
60
+ "devTools",
61
+ "zoomFactor",
62
+ "textAreasAreResizable",
63
+ "scrollBounce",
64
+ "defaultFontFamily",
65
+ "defaultFontSize",
66
+ "defaultMonospaceFontSize",
67
+ "minimumFontSize",
68
+ "defaultEncoding",
69
+ "backgroundThrottling",
70
+ "offscreen",
71
+ "safeDialogs",
72
+ "safeDialogsMessage",
73
+ "navigateOnDragDrop",
74
+ "autoplayPolicy",
75
+ "disableHtmlFullscreenWindowResize",
76
+ "accessibleTitle",
77
+ "spellcheck",
78
+ ];
package/lib/index.d.ts CHANGED
@@ -3,5 +3,6 @@ export * from "./desktopify";
3
3
  export * from "./validations";
4
4
  export * from "./getSiteInfo";
5
5
  export * from "./plans";
6
+ export * from "./desktopify2";
6
7
  declare const schemaVersion: string;
7
8
  export { schemaVersion };
package/lib/index.js CHANGED
@@ -8,5 +8,6 @@ __export(require("./toDesktop"));
8
8
  __export(require("./desktopify"));
9
9
  __export(require("./validations"));
10
10
  __export(require("./plans"));
11
+ __export(require("./desktopify2"));
11
12
  const schemaVersion = package_json_1.version;
12
13
  exports.schemaVersion = schemaVersion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.54.0",
3
+ "version": "7.57.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -14,9 +14,9 @@
14
14
  "author": "Dave Jeffery <dave@davejeffery.com>",
15
15
  "license": "UNLICENSED",
16
16
  "dependencies": {
17
- "@todesktop/client-electron-types": "^0.1.0",
17
+ "@todesktop/client-electron-types": "^13.1.8",
18
18
  "@types/debug": "^4.1.1",
19
- "@types/node": "^13.11.1",
19
+ "@types/node": "^16.4.12",
20
20
  "@types/yup": "^0.26.9",
21
21
  "is-regex": "^1.0.4",
22
22
  "yup": "^0.26.10"
package/src/desktopify.ts CHANGED
@@ -254,78 +254,6 @@ export const isBuildRunning = (build: Build): boolean => {
254
254
  export const isBuildCancellable = (build: Build): boolean =>
255
255
  hasBuildKickedOff(build) && isBuildRunning(build);
256
256
 
257
- type todesktopRoles =
258
- | "todesktop:launch-at-startup"
259
- | "todesktop:check-for-updates"
260
- | "todesktop:quit"
261
- | "todesktop:new-window"
262
- | "todesktop:new-tab"
263
- | "todesktop:check-for-updates"
264
- | "todesktop:history-home"
265
- | "todesktop:history-back"
266
- | "todesktop:history-forward"
267
- | "todesktop:show-window"
268
- | "todesktop:hide-window";
269
-
270
- let s: MenuItemConstructorOptions;
271
-
272
- export interface DesktopifyMenuItemConstructorOptions
273
- extends Omit<MenuItemConstructorOptions, "role" | "submenu"> {
274
- platforms?: NodeJS.Platform[];
275
- submenu?: DesktopifyMenuItemConstructorOptions[];
276
- role?: MenuItemConstructorOptions["role"] | todesktopRoles;
277
- }
278
-
279
- export interface DesktopifyAppWindow {
280
- id: string;
281
- name: string;
282
- url: string;
283
- fullScreen: boolean;
284
-
285
- height: number;
286
- minHeight?: number;
287
- maxHeight?: number;
288
- hasMinHeight?: boolean;
289
- hasMaxHeight?: boolean;
290
-
291
- width: number;
292
- minWidth?: number;
293
- maxWidth?: number;
294
- hasMinWidth?: boolean;
295
- hasMaxWidth?: boolean;
296
-
297
- isResizable: boolean;
298
- titleBarStyle?: "hidden" | "hiddenInset" | "customButtonsOnHover";
299
- alwaysOnTop: boolean;
300
- visibility: "visible" | "hidden" | "show-when-contents-loaded";
301
- isMain: boolean;
302
- applicationMenu: DesktopifyMenuItemConstructorOptions[];
303
- type: "menubar" | "app";
304
- transparentTitlebar: boolean;
305
- shouldResetDimensions?: boolean;
306
- vibrancy?: BrowserWindowConstructorOptions["vibrancy"];
307
- }
308
-
309
- export type DesktopifyAppTrayToggleWindowAction = {
310
- role: "toggleWindow";
311
- windowId: string;
312
- };
313
-
314
- export type DesktopifyAppTrayToggleMenuAction = {
315
- role: "toggleMenu";
316
- menu: DesktopifyMenuItemConstructorOptions[];
317
- };
318
-
319
- export type DesktopifyAppTrayAction =
320
- | DesktopifyAppTrayToggleMenuAction
321
- | DesktopifyAppTrayToggleWindowAction;
322
-
323
- export interface DesktopifyAppTray {
324
- icon: string;
325
- rightClick?: DesktopifyAppTrayAction;
326
- leftClick?: DesktopifyAppTrayAction;
327
- }
328
-
329
257
  export interface DesktopifyApp {
330
258
  name: string;
331
259
  targetUrl: string;
@@ -371,8 +299,3 @@ export interface DesktopifyApp {
371
299
  companyName?: string;
372
300
  pollForAppUpdatesEveryXMinutes?: number;
373
301
  }
374
-
375
- export interface DesktopifyApp2 extends DesktopifyApp {
376
- windows: DesktopifyAppWindow[];
377
- trays: DesktopifyAppTray[];
378
- }
@@ -0,0 +1,358 @@
1
+ import { IApp, ISwitchableValue } from "./toDesktop";
2
+ import {
3
+ MenuItemConstructorOptions,
4
+ BrowserWindowConstructorOptions,
5
+ WebPreferences,
6
+ } from "@todesktop/client-electron-types";
7
+
8
+ /**
9
+ * Custom ToDesktop Roles for Application & Tray Menus
10
+ */
11
+ type todesktopRoles =
12
+ | "todesktop:launch-at-startup"
13
+ | "todesktop:check-for-updates"
14
+ | "todesktop:quit"
15
+ | "todesktop:new-window"
16
+ | "todesktop:new-tab"
17
+ | "todesktop:check-for-updates"
18
+ | "todesktop:history-home"
19
+ | "todesktop:history-back"
20
+ | "todesktop:history-forward"
21
+ | "todesktop:show-window"
22
+ | "todesktop:hide-window";
23
+
24
+ export interface DesktopifyMenuItemConstructorOptions
25
+ extends Omit<MenuItemConstructorOptions, "role" | "submenu"> {
26
+ platforms?: NodeJS.Platform;
27
+ submenu?: DesktopifyMenuItemConstructorOptions[];
28
+ role?: MenuItemConstructorOptions["role"] | todesktopRoles;
29
+ }
30
+
31
+ /**
32
+ * Toggle Window Tray Action
33
+ *
34
+ * @param windowId - The id of the window to toggle
35
+ */
36
+ export type DesktopifyAppTrayToggleWindowAction = {
37
+ role: "toggleWindow";
38
+ windowId: string;
39
+ };
40
+
41
+ /**
42
+ * Toggle Menu Tray Action
43
+ *
44
+ * @param menu - The menu to show when action triggered
45
+ */
46
+ export type DesktopifyAppTrayToggleMenuAction = {
47
+ role: "toggleMenu";
48
+ menu: DesktopifyMenuItemConstructorOptions[];
49
+ };
50
+
51
+ /**
52
+ * No Action Tray Action
53
+ */
54
+ export type DesktopifyAppTrayNoAction = {
55
+ role: "noAction";
56
+ };
57
+
58
+ export type DesktopifyAppTrayAction =
59
+ | DesktopifyAppTrayToggleMenuAction
60
+ | DesktopifyAppTrayToggleWindowAction
61
+ | DesktopifyAppTrayNoAction;
62
+
63
+ export interface DesktopifyAppTray {
64
+ id: string;
65
+ icon: string;
66
+ rightClick: DesktopifyAppTrayAction;
67
+ leftClick: DesktopifyAppTrayAction;
68
+ }
69
+
70
+ /**
71
+ * Whitelist of allowed DesktopifyWindow Options.
72
+ * These attrs (if set) are passed to the `BrowserWindow` constructor
73
+ * when the window is created
74
+ */
75
+ export const allowedBrowserWindowConstructorOptions: Readonly<
76
+ (keyof BrowserWindowConstructorOptions)[]
77
+ > = [
78
+ "width",
79
+ "height",
80
+ // "x",
81
+ // "y",
82
+ "useContentSize",
83
+ "center",
84
+ "minWidth",
85
+ "minHeight",
86
+ "maxWidth",
87
+ "maxHeight",
88
+ "resizable",
89
+ "movable",
90
+ "minimizable",
91
+ "maximizable",
92
+ "closable",
93
+ "focusable",
94
+ "alwaysOnTop",
95
+ "fullscreen",
96
+ "fullscreenable",
97
+ "simpleFullscreen",
98
+ "skipTaskbar",
99
+ "kiosk",
100
+ "icon",
101
+ "paintWhenInitiallyHidden",
102
+ "frame",
103
+ "acceptFirstMouse",
104
+ "disableAutoHideCursor",
105
+ "autoHideMenuBar",
106
+ "enableLargerThanScreen",
107
+ "backgroundColor",
108
+ "hasShadow",
109
+ "opacity",
110
+ "darkTheme",
111
+ "transparent",
112
+ "visualEffectState",
113
+ "titleBarStyle",
114
+ "trafficLightPosition",
115
+ "roundedCorners",
116
+ "fullscreenWindowTitle",
117
+ "thickFrame",
118
+ "type",
119
+ "vibrancy",
120
+ "zoomToPageWidth",
121
+ "tabbingIdentifier",
122
+ ] as const;
123
+
124
+ // Make type from all numbered index values
125
+ export type whitelistedBrowserWindowConstructorOptions =
126
+ typeof allowedBrowserWindowConstructorOptions[number];
127
+
128
+ /**
129
+ * Whitelist of allowed DesktopifyWindow Web Preferences Options.
130
+ * These attrs (if set) are passed to the webPreferences object in the `BrowserWindow` constructor
131
+ * when the window is created
132
+ */
133
+ export const allowedWebPreferencesOptions: Readonly<(keyof WebPreferences)[]> =
134
+ [
135
+ "devTools",
136
+ "zoomFactor",
137
+ "textAreasAreResizable",
138
+ "scrollBounce",
139
+ "defaultFontFamily",
140
+ "defaultFontSize",
141
+ "defaultMonospaceFontSize",
142
+ "minimumFontSize",
143
+ "defaultEncoding",
144
+ "backgroundThrottling",
145
+ "offscreen",
146
+ "safeDialogs",
147
+ "safeDialogsMessage",
148
+ "navigateOnDragDrop",
149
+ "autoplayPolicy",
150
+ "disableHtmlFullscreenWindowResize",
151
+ "accessibleTitle",
152
+ "spellcheck",
153
+ ] as const;
154
+
155
+ // Make type from all numbered index values
156
+ export type whitelistedWebPreferencesOptions =
157
+ typeof allowedWebPreferencesOptions[number];
158
+
159
+ /**
160
+ * Interface for ToDesktop App Windows
161
+ */
162
+ export interface DesktopifyAppWindow {
163
+ /**
164
+ * A unique window id
165
+ */
166
+ id: string;
167
+ /**
168
+ * The window name. Only visible to developer
169
+ */
170
+ name: string;
171
+ /**
172
+ * The window's url
173
+ */
174
+ url: string;
175
+ /**
176
+ * Whether this is the main window. The main window handles deeplinks
177
+ */
178
+ isMain: boolean;
179
+ /**
180
+ * The type of window
181
+ */
182
+ type: "menubar" | "app";
183
+ /**
184
+ * The window's application menu
185
+ */
186
+ applicationMenu: DesktopifyMenuItemConstructorOptions[];
187
+ /**
188
+ * Keyboard shortcut to toggle window visibility
189
+ */
190
+ toggleVisibilityKeyboardShortcut?: string;
191
+ /**
192
+ * By default ToDesktop remembers window width & height between sessions.
193
+ * Setting to `true` disables behaviour
194
+ */
195
+ shouldResetDimensions?: boolean;
196
+ /**
197
+ * If `true` prevents the native window's title from changing when the document title changes
198
+ */
199
+ isTitleStatic?: boolean;
200
+ /**
201
+ * Disables default rightClick menu
202
+ */
203
+ disableContextMenu: boolean;
204
+ /**
205
+ * Allows user to `Cmd+F` or `Edit>Find` to search for text on page
206
+ */
207
+ isFindInPageEnabled?: boolean;
208
+ /**
209
+ * Inital visibility of window
210
+ */
211
+ visibility: "visible" | "hidden" | "show-when-contents-loaded";
212
+ /**
213
+ * Does the window have a minimum width. Default is `false`
214
+ */
215
+ hasMinWidth: boolean;
216
+ /**
217
+ * Does the window have a maximum width. Default is `false`
218
+ */
219
+ hasMaxWidth: boolean;
220
+ /**
221
+ * Does the window have a minimum height. Default is `false`
222
+ */
223
+ hasMinHeight: boolean;
224
+ /**
225
+ * Does the window have a maximum height. Default is `false`
226
+ */
227
+ hasMaxHeight: boolean;
228
+ /**
229
+ * BrowserWindow Constructor Options
230
+ */
231
+ options: Pick<
232
+ BrowserWindowConstructorOptions,
233
+ whitelistedBrowserWindowConstructorOptions
234
+ > & {
235
+ /**
236
+ * Settings of web page's features.
237
+ */
238
+ webPreferences?: Pick<WebPreferences, whitelistedWebPreferencesOptions>;
239
+ };
240
+ }
241
+ // TODO: Look into hasMinHeight, etc
242
+
243
+ export interface DesktopifyApp2 {
244
+ /**
245
+ * The name of the app
246
+ */
247
+ name: string;
248
+ /**
249
+ * A unique app id
250
+ */
251
+ id: string;
252
+ /**
253
+ * The app icon
254
+ */
255
+ icon?: string;
256
+ /**
257
+ * The name of the company that the app belongs to
258
+ */
259
+ companyName?: string;
260
+ /**
261
+ * Only allow a single instance of this app to run
262
+ */
263
+ singleInstance: boolean;
264
+ /**
265
+ * Regex patterns for internal app urls
266
+ */
267
+ internalUrls?: ISwitchableValue<string>;
268
+ /**
269
+ * By default ToDesktop uses native `window.open` to support Firebase social login.
270
+ * This makes the app use electron's `window.open`.
271
+ */
272
+ isNativeWindowOpenDisabled?: boolean;
273
+ /**
274
+ * Specifys the app's user agent
275
+ */
276
+ userAgent?: ISwitchableValue<string>;
277
+ /**
278
+ * Disable devTools on all app windows
279
+ */
280
+ disableDevTools: boolean;
281
+ /**
282
+ * Registers an app protocol. Format should be `{APP_PROTOCOL}://` e.g. `example://`
283
+ */
284
+ appProtocol?: ISwitchableValue<string>;
285
+ /**
286
+ * Disables the same-origin policy
287
+ */
288
+ insecure?: boolean;
289
+ /**
290
+ * Opens `accounts.google.com/o/oauth` in user's default browswer not as internal url
291
+ */
292
+ googleOAuthIsExternal?: boolean;
293
+ /**
294
+ * Removes electron from userAgent
295
+ */
296
+ shouldUseRealUserAgent?: boolean;
297
+ /**
298
+ * Runtime environment variables
299
+ */
300
+ runtimeEnvs?: {
301
+ [key: string]: string;
302
+ };
303
+ /**
304
+ * Launch App at startup
305
+ */
306
+ shouldLaunchAtStartupByDefault?: boolean;
307
+ /**
308
+ * Disables non-essential logs
309
+ */
310
+ shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
311
+ /**
312
+ * Disables electron overrides which ensure renderer process are restarted on each navigation.
313
+ * Learn more {@link https://github.com/electron/electron/issues/18397}
314
+ */
315
+ shouldReuseRendererProcess?: boolean;
316
+ /**
317
+ * Open same domain links in user's default browser
318
+ */
319
+ shouldMakeSameDomainAnExternalLink?: boolean;
320
+ /**
321
+ * Enables push notifications
322
+ */
323
+ enablePushNotifications?: boolean;
324
+ /**
325
+ * Sets theme for Electron UI elements and css.
326
+ *
327
+ * See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
328
+ */
329
+ themeSource?: "system" | "light" | "dark";
330
+ /**
331
+ * Sets theme source for only mac
332
+ *
333
+ * See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
334
+ */
335
+ themeSourceMac?: "system" | "light" | "dark";
336
+ /**
337
+ * URL that crash reports will be POSTed to
338
+ */
339
+ crashReporter?: string;
340
+ /**
341
+ * Unused currently
342
+ * @unused
343
+ */
344
+ pollForAppUpdatesEveryXMinutes?: number;
345
+ /**
346
+ * The app's windows
347
+ */
348
+ windows: DesktopifyAppWindow[];
349
+ /**
350
+ * The app's trays
351
+ */
352
+ trays: DesktopifyAppTray[];
353
+ }
354
+
355
+ export interface IApp2 extends IApp {
356
+ windows: DesktopifyAppWindow[];
357
+ trays: DesktopifyAppTray[];
358
+ }
package/src/index.ts CHANGED
@@ -6,5 +6,7 @@ export * from "./validations";
6
6
  export * from "./getSiteInfo";
7
7
  export * from "./plans";
8
8
 
9
+ export * from "./desktopify2";
10
+
9
11
  const schemaVersion = version;
10
12
  export { schemaVersion };