@todesktop/shared 7.50.0 → 7.54.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,5 +1,7 @@
1
+ /// <reference types="node" />
1
2
  import { IApp } from "./toDesktop";
2
3
  import { Configuration, PackagerOptions, PublishOptions } from "app-builder-lib";
4
+ import { MenuItemConstructorOptions, BrowserWindowConstructorOptions } from "@todesktop/client-electron-types";
3
5
  declare type appBuilderLib = PackagerOptions & PublishOptions;
4
6
  export interface IAppBuilderLib extends appBuilderLib {
5
7
  config: Configuration;
@@ -137,22 +139,51 @@ export declare const isPlatformBuildRunning: (platformBuild: PlatformBuild) => b
137
139
  export declare const isCiBuildRunning: (build: Build) => boolean;
138
140
  export declare const isBuildRunning: (build: Build) => boolean;
139
141
  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
+ }
140
148
  export interface DesktopifyAppWindow {
141
149
  id: string;
142
150
  name: string;
143
151
  url: string;
144
152
  fullScreen: boolean;
153
+ height: number;
145
154
  minHeight?: number;
146
- minWidth?: number;
147
155
  maxHeight?: number;
148
- maxWidth?: number;
149
- height: number;
156
+ hasMinHeight?: boolean;
157
+ hasMaxHeight?: boolean;
150
158
  width: number;
159
+ minWidth?: number;
160
+ maxWidth?: number;
161
+ hasMinWidth?: boolean;
162
+ hasMaxWidth?: boolean;
151
163
  isResizable: boolean;
152
164
  titleBarStyle?: "hidden" | "hiddenInset" | "customButtonsOnHover";
153
165
  alwaysOnTop: boolean;
154
166
  visibility: "visible" | "hidden" | "show-when-contents-loaded";
155
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;
156
187
  }
157
188
  export interface DesktopifyApp {
158
189
  name: string;
@@ -201,5 +232,6 @@ export interface DesktopifyApp {
201
232
  }
202
233
  export interface DesktopifyApp2 extends DesktopifyApp {
203
234
  windows: DesktopifyAppWindow[];
235
+ trays: DesktopifyAppTray[];
204
236
  }
205
237
  export {};
package/lib/desktopify.js CHANGED
@@ -59,3 +59,4 @@ 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.50.0",
3
+ "version": "7.54.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -8,11 +8,13 @@
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
9
  "build": "rm -f ./lib/* && tsc",
10
10
  "prepublishOnly": "npm run build",
11
- "bump": "npm version minor && git push && npm publish"
11
+ "bump": "npm version minor && git push && npm publish",
12
+ "dev": "tsc"
12
13
  },
13
14
  "author": "Dave Jeffery <dave@davejeffery.com>",
14
15
  "license": "UNLICENSED",
15
16
  "dependencies": {
17
+ "@todesktop/client-electron-types": "^0.1.0",
16
18
  "@types/debug": "^4.1.1",
17
19
  "@types/node": "^13.11.1",
18
20
  "@types/yup": "^0.26.9",
package/src/desktopify.ts CHANGED
@@ -4,6 +4,10 @@ import {
4
4
  PackagerOptions,
5
5
  PublishOptions,
6
6
  } from "app-builder-lib";
7
+ import {
8
+ MenuItemConstructorOptions,
9
+ BrowserWindowConstructorOptions,
10
+ } from "@todesktop/client-electron-types";
7
11
 
8
12
  type appBuilderLib = PackagerOptions & PublishOptions;
9
13
  export interface IAppBuilderLib extends appBuilderLib {
@@ -250,22 +254,76 @@ export const isBuildRunning = (build: Build): boolean => {
250
254
  export const isBuildCancellable = (build: Build): boolean =>
251
255
  hasBuildKickedOff(build) && isBuildRunning(build);
252
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
+
253
279
  export interface DesktopifyAppWindow {
254
280
  id: string;
255
281
  name: string;
256
282
  url: string;
257
283
  fullScreen: boolean;
258
- minHeight?: number;
259
- minWidth?: number;
260
- maxHeight?: number;
261
- maxWidth?: number;
284
+
262
285
  height: number;
286
+ minHeight?: number;
287
+ maxHeight?: number;
288
+ hasMinHeight?: boolean;
289
+ hasMaxHeight?: boolean;
290
+
263
291
  width: number;
292
+ minWidth?: number;
293
+ maxWidth?: number;
294
+ hasMinWidth?: boolean;
295
+ hasMaxWidth?: boolean;
296
+
264
297
  isResizable: boolean;
265
298
  titleBarStyle?: "hidden" | "hiddenInset" | "customButtonsOnHover";
266
299
  alwaysOnTop: boolean;
267
300
  visibility: "visible" | "hidden" | "show-when-contents-loaded";
268
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;
269
327
  }
270
328
 
271
329
  export interface DesktopifyApp {
@@ -281,7 +339,7 @@ export interface DesktopifyApp {
281
339
  minHeight?: number; // remove
282
340
  minWidth?: number; // remove
283
341
  maxHeight?: number; // remove
284
- maxWidth?: number; // remove
342
+ maxWidth?: number; // remove
285
343
  singleInstance: boolean;
286
344
  disableContextMenu: boolean;
287
345
  titleBarStyle?: "hidden" | "hiddenInset" | "customButtonsOnHover"; // remove
@@ -316,4 +374,5 @@ export interface DesktopifyApp {
316
374
 
317
375
  export interface DesktopifyApp2 extends DesktopifyApp {
318
376
  windows: DesktopifyAppWindow[];
319
- }
377
+ trays: DesktopifyAppTray[];
378
+ }