@todesktop/shared 7.184.26 → 7.184.28

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.
@@ -64,13 +64,22 @@ export declare type DesktopifyAppTrayToggleMenuAction = {
64
64
  role: 'toggleMenu';
65
65
  menu: DesktopifyMenuItemConstructorOptions[];
66
66
  };
67
+ /**
68
+ * JS Event Tray Action
69
+ *
70
+ * @param event - The name of the event
71
+ */
72
+ export declare type DesktopifyAppTrayJSEventAction = {
73
+ role: 'jsEvent';
74
+ event: string;
75
+ };
67
76
  /**
68
77
  * No Action Tray Action
69
78
  */
70
79
  export declare type DesktopifyAppTrayNoAction = {
71
80
  role: 'noAction';
72
81
  };
73
- export declare type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction | DesktopifyAppTrayNoAction;
82
+ export declare type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction | DesktopifyAppTrayJSEventAction | DesktopifyAppTrayNoAction;
74
83
  export interface DesktopifyAppTray {
75
84
  id: string;
76
85
  objectId?: string;
@@ -196,7 +205,7 @@ export interface DesktopifyAppWindow {
196
205
  */
197
206
  file?: string;
198
207
  }
199
- export interface DesktopifyApp2 {
208
+ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
200
209
  /**
201
210
  * Used as appUserModelId on windows
202
211
  */
@@ -353,7 +362,7 @@ export interface DesktopifyApp2 {
353
362
  /**
354
363
  * An array of plugin modules. Can work with semver specificity
355
364
  */
356
- plugins?: (DesktopAppPlugin | string)[];
365
+ plugins?: (Plugin | string)[];
357
366
  /**
358
367
  * The app's windows
359
368
  */
@@ -413,12 +422,12 @@ export interface DesktopifyApp2 {
413
422
  */
414
423
  shouldProtectContent?: boolean;
415
424
  }
416
- export interface IApp2 extends BaseApp {
417
- desktopApp: DesktopifyApp2;
425
+ export interface IApp2<Plugin = DesktopAppPlugin> extends BaseApp {
426
+ desktopApp: DesktopifyApp2<Plugin>;
418
427
  desktopAppOverrides?: {
419
- linux?: Partial<DesktopifyApp2>;
420
- mac?: Partial<DesktopifyApp2>;
421
- windows?: Partial<DesktopifyApp2>;
428
+ linux?: Partial<DesktopifyApp2<Plugin>>;
429
+ mac?: Partial<DesktopifyApp2<Plugin>>;
430
+ windows?: Partial<DesktopifyApp2<Plugin>>;
422
431
  };
423
432
  }
424
433
  export {};
@@ -1,5 +1,6 @@
1
1
  import * as yup from 'yup';
2
- import { DesktopifyApp2 } from '.';
2
+ import { DesktopifyApp2 } from './desktopify2';
3
+ import { DesktopAppPlugin } from './plugin';
3
4
  export declare const appTitleValidation: yup.StringSchema;
4
5
  export declare const forceVersionValidation: yup.StringSchema;
5
6
  export declare const iconValidation: yup.StringSchema;
@@ -50,4 +51,4 @@ export declare const appConfigValidation: yup.ObjectSchema<{
50
51
  publishedVersions: any;
51
52
  };
52
53
  }>;
53
- export declare const shouldMinimizeToTrayIsActive: (desktopApp: DesktopifyApp2) => boolean;
54
+ export declare const shouldMinimizeToTrayIsActive: <Plugin_1 = DesktopAppPlugin>(desktopApp: DesktopifyApp2<Plugin_1>) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.184.26",
3
+ "version": "7.184.28",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -101,6 +101,16 @@ export type DesktopifyAppTrayToggleMenuAction = {
101
101
  menu: DesktopifyMenuItemConstructorOptions[];
102
102
  };
103
103
 
104
+ /**
105
+ * JS Event Tray Action
106
+ *
107
+ * @param event - The name of the event
108
+ */
109
+ export type DesktopifyAppTrayJSEventAction = {
110
+ role: 'jsEvent';
111
+ event: string;
112
+ };
113
+
104
114
  /**
105
115
  * No Action Tray Action
106
116
  */
@@ -111,6 +121,7 @@ export type DesktopifyAppTrayNoAction = {
111
121
  export type DesktopifyAppTrayAction =
112
122
  | DesktopifyAppTrayToggleMenuAction
113
123
  | DesktopifyAppTrayToggleWindowAction
124
+ | DesktopifyAppTrayJSEventAction
114
125
  | DesktopifyAppTrayNoAction;
115
126
 
116
127
  export interface DesktopifyAppTray {
@@ -322,7 +333,7 @@ export interface DesktopifyAppWindow {
322
333
  }
323
334
  // TODO: Look into hasMinHeight, etc
324
335
 
325
- export interface DesktopifyApp2 {
336
+ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
326
337
  /**
327
338
  * Used as appUserModelId on windows
328
339
  */
@@ -481,7 +492,7 @@ export interface DesktopifyApp2 {
481
492
  /**
482
493
  * An array of plugin modules. Can work with semver specificity
483
494
  */
484
- plugins?: (DesktopAppPlugin | string)[];
495
+ plugins?: (Plugin | string)[];
485
496
  /**
486
497
  * The app's windows
487
498
  */
@@ -545,13 +556,13 @@ export interface DesktopifyApp2 {
545
556
  shouldProtectContent?: boolean;
546
557
  }
547
558
 
548
- export interface IApp2 extends BaseApp {
559
+ export interface IApp2<Plugin = DesktopAppPlugin> extends BaseApp {
549
560
  // Be careful when coercing to `IApp2` that we always check for `desktopApp` first
550
- desktopApp: DesktopifyApp2;
561
+ desktopApp: DesktopifyApp2<Plugin>;
551
562
 
552
563
  desktopAppOverrides?: {
553
- linux?: Partial<DesktopifyApp2>;
554
- mac?: Partial<DesktopifyApp2>;
555
- windows?: Partial<DesktopifyApp2>;
564
+ linux?: Partial<DesktopifyApp2<Plugin>>;
565
+ mac?: Partial<DesktopifyApp2<Plugin>>;
566
+ windows?: Partial<DesktopifyApp2<Plugin>>;
556
567
  };
557
568
  }
@@ -1,7 +1,8 @@
1
1
  import * as yup from 'yup';
2
2
  import * as semver from 'semver';
3
3
  import * as isRegex from 'is-regex';
4
- import { DesktopifyApp2 } from '.';
4
+ import { DesktopifyApp2 } from './desktopify2';
5
+ import { DesktopAppPlugin } from './plugin';
5
6
  export const appTitleValidation = yup
6
7
  .string()
7
8
  .label('App title')
@@ -174,7 +175,9 @@ export const appConfigValidation = yup.object({
174
175
  .required(),
175
176
  });
176
177
 
177
- export const shouldMinimizeToTrayIsActive = (desktopApp: DesktopifyApp2) => {
178
+ export const shouldMinimizeToTrayIsActive = <Plugin = DesktopAppPlugin>(
179
+ desktopApp: DesktopifyApp2<Plugin>
180
+ ) => {
178
181
  return desktopApp.trays.some(
179
182
  (t) =>
180
183
  t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu'