@todesktop/shared 7.128.0 → 7.130.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.
@@ -3,24 +3,27 @@ import { ISwitchableValue } from "./toDesktop";
3
3
  import { MenuItemConstructorOptions, BrowserWindowConstructorOptions, WebPreferences } from "@todesktop/client-electron-types";
4
4
  import { BaseApp } from "./base";
5
5
  import { DesktopAppPlugin } from "./plugin";
6
- export declare type AssetDetails = {
6
+ import { ValidTranslationKeys, ValidTranslationLanguages } from "./translation";
7
+ interface BaseAssetDetails {
7
8
  /**
8
9
  * Remote URL where the asset can be downloaded
9
10
  */
10
11
  url: string;
11
- /**
12
- * Whether the asset is bundled into the final built app
13
- */
14
- isBundled: boolean;
15
12
  /**
16
13
  * Local path where the asset is/should be stored. This path is relative to the app directory
17
14
  */
18
15
  relativeLocalPath: string;
19
- /**
20
- * The type of asset being stored
21
- */
22
- type: "templateImage" | "default";
23
- };
16
+ }
17
+ export interface AppIconAssetDetails extends BaseAssetDetails {
18
+ type: "appIcon";
19
+ }
20
+ export interface MenuIconAssetDetails extends BaseAssetDetails {
21
+ type: "menuIcon";
22
+ }
23
+ export interface TrayMenubarIconAssetDetails extends BaseAssetDetails {
24
+ type: "trayMenubarIcon";
25
+ }
26
+ export declare type AssetDetails = AppIconAssetDetails | MenuIconAssetDetails | TrayMenubarIconAssetDetails;
24
27
  /**
25
28
  * Custom ToDesktop Roles for Application & Tray Menus
26
29
  */
@@ -35,7 +38,7 @@ export interface DesktopifyMenuItemConstructorOptions extends Omit<MenuItemConst
35
38
  actionType?: "jsEvent" | "role";
36
39
  iconUrl?: string;
37
40
  bundledIcon?: string;
38
- iconAssetDetails?: AssetDetails;
41
+ iconAssetDetails?: MenuIconAssetDetails;
39
42
  useTemplateImage?: boolean;
40
43
  }
41
44
  /**
@@ -68,13 +71,13 @@ export interface DesktopifyAppTray {
68
71
  icon?: string;
69
72
  useSeparateIcons?: boolean;
70
73
  windowsIcon?: string;
71
- windowsIconAssetDetails?: AssetDetails;
74
+ windowsIconAssetDetails?: TrayMenubarIconAssetDetails;
72
75
  macOSIcon?: string;
73
- macOSIconAssetDetails?: AssetDetails;
76
+ macOSIconAssetDetails?: TrayMenubarIconAssetDetails;
74
77
  linuxIcon?: string;
75
- linuxIconAssetDetails?: AssetDetails;
78
+ linuxIconAssetDetails?: TrayMenubarIconAssetDetails;
76
79
  bundledIcon?: string;
77
- iconAssetDetails?: AssetDetails;
80
+ iconAssetDetails?: TrayMenubarIconAssetDetails;
78
81
  useTemplateImage?: boolean;
79
82
  rightClick: DesktopifyAppTrayAction;
80
83
  leftClick: DesktopifyAppTrayAction;
@@ -202,17 +205,17 @@ export interface DesktopifyApp2 {
202
205
  /**
203
206
  * Details concerning how the app icon should be handled across ToDesktop services
204
207
  */
205
- iconAssetDetails?: AssetDetails;
208
+ iconAssetDetails?: AppIconAssetDetails;
206
209
  /**
207
210
  * Instead of using one icon for every platform, use a separate icon for different platforms
208
211
  */
209
212
  useSeparateIcons?: boolean;
210
213
  windowsIcon?: string;
211
- windowsIconAssetDetails?: AssetDetails;
214
+ windowsIconAssetDetails?: AppIconAssetDetails;
212
215
  macOSIcon?: string;
213
- macOSIconAssetDetails?: AssetDetails;
216
+ macOSIconAssetDetails?: AppIconAssetDetails;
214
217
  linuxIcon?: string;
215
- linuxIconAssetDetails?: AssetDetails;
218
+ linuxIconAssetDetails?: AppIconAssetDetails;
216
219
  /**
217
220
  * The name of the company that the app belongs to
218
221
  */
@@ -341,6 +344,14 @@ export interface DesktopifyApp2 {
341
344
  buttonBackgroundColor: string;
342
345
  buttonTextColor: string;
343
346
  };
347
+ /**
348
+ * Sets strings to be used in the app UI. Currently only supports English
349
+ */
350
+ appStrings?: {
351
+ [key in ValidTranslationKeys]?: {
352
+ [lang in ValidTranslationLanguages]?: string;
353
+ };
354
+ };
344
355
  }
345
356
  export interface IApp2 extends BaseApp {
346
357
  desktopApp: DesktopifyApp2;
@@ -0,0 +1,2 @@
1
+ export declare type ValidTranslationKeys = "updateNotification.title" | "updateNotification.body";
2
+ export declare type ValidTranslationLanguages = "default";
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* TODO - Support more languages here */
4
+ // | "en"
5
+ // | "es"
6
+ // | "fr"
7
+ // | "de"
8
+ // | "it"
9
+ // | "ja"
10
+ // | "ko"
11
+ // | "pt-BR"
12
+ // | "ru"
13
+ // | "zh-CN"
14
+ // | "zh-TW";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.128.0",
3
+ "version": "7.130.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -6,25 +6,35 @@ import {
6
6
  } from "@todesktop/client-electron-types";
7
7
  import { BaseApp, Schemable } from "./base";
8
8
  import { DesktopAppPlugin } from "./plugin";
9
+ import { ValidTranslationKeys, ValidTranslationLanguages } from "./translation";
9
10
 
10
- export type AssetDetails = {
11
+ interface BaseAssetDetails {
11
12
  /**
12
13
  * Remote URL where the asset can be downloaded
13
14
  */
14
15
  url: string;
15
- /**
16
- * Whether the asset is bundled into the final built app
17
- */
18
- isBundled: boolean;
19
16
  /**
20
17
  * Local path where the asset is/should be stored. This path is relative to the app directory
21
18
  */
22
19
  relativeLocalPath: string;
23
- /**
24
- * The type of asset being stored
25
- */
26
- type: "templateImage" | "default"
27
- };
20
+ }
21
+
22
+ export interface AppIconAssetDetails extends BaseAssetDetails {
23
+ type: "appIcon";
24
+ }
25
+
26
+ export interface MenuIconAssetDetails extends BaseAssetDetails {
27
+ type: "menuIcon";
28
+ }
29
+
30
+ export interface TrayMenubarIconAssetDetails extends BaseAssetDetails {
31
+ type: "trayMenubarIcon";
32
+ }
33
+
34
+ export type AssetDetails =
35
+ | AppIconAssetDetails
36
+ | MenuIconAssetDetails
37
+ | TrayMenubarIconAssetDetails;
28
38
 
29
39
  /**
30
40
  * Custom ToDesktop Roles for Application & Tray Menus
@@ -59,7 +69,7 @@ export interface DesktopifyMenuItemConstructorOptions
59
69
  actionType?: "jsEvent" | "role";
60
70
  iconUrl?: string;
61
71
  bundledIcon?: string;
62
- iconAssetDetails?: AssetDetails;
72
+ iconAssetDetails?: MenuIconAssetDetails;
63
73
  useTemplateImage?: boolean;
64
74
  }
65
75
 
@@ -100,13 +110,13 @@ export interface DesktopifyAppTray {
100
110
  icon?: string;
101
111
  useSeparateIcons?: boolean;
102
112
  windowsIcon?: string;
103
- windowsIconAssetDetails?: AssetDetails;
113
+ windowsIconAssetDetails?: TrayMenubarIconAssetDetails;
104
114
  macOSIcon?: string;
105
- macOSIconAssetDetails?: AssetDetails;
115
+ macOSIconAssetDetails?: TrayMenubarIconAssetDetails;
106
116
  linuxIcon?: string;
107
- linuxIconAssetDetails?: AssetDetails;
117
+ linuxIconAssetDetails?: TrayMenubarIconAssetDetails;
108
118
  bundledIcon?: string;
109
- iconAssetDetails?: AssetDetails;
119
+ iconAssetDetails?: TrayMenubarIconAssetDetails;
110
120
  useTemplateImage?: boolean;
111
121
  rightClick: DesktopifyAppTrayAction;
112
122
  leftClick: DesktopifyAppTrayAction;
@@ -316,19 +326,19 @@ export interface DesktopifyApp2 {
316
326
  /**
317
327
  * Details concerning how the app icon should be handled across ToDesktop services
318
328
  */
319
- iconAssetDetails?: AssetDetails;
329
+ iconAssetDetails?: AppIconAssetDetails;
320
330
  /**
321
331
  * Instead of using one icon for every platform, use a separate icon for different platforms
322
332
  */
323
333
  useSeparateIcons?: boolean;
324
334
  windowsIcon?: string;
325
- windowsIconAssetDetails?: AssetDetails;
335
+ windowsIconAssetDetails?: AppIconAssetDetails;
326
336
 
327
337
  macOSIcon?: string;
328
- macOSIconAssetDetails?: AssetDetails;
338
+ macOSIconAssetDetails?: AppIconAssetDetails;
329
339
 
330
340
  linuxIcon?: string;
331
- linuxIconAssetDetails?: AssetDetails;
341
+ linuxIconAssetDetails?: AppIconAssetDetails;
332
342
  /**
333
343
  * The name of the company that the app belongs to
334
344
  */
@@ -457,6 +467,14 @@ export interface DesktopifyApp2 {
457
467
  buttonBackgroundColor: string;
458
468
  buttonTextColor: string;
459
469
  };
470
+ /**
471
+ * Sets strings to be used in the app UI. Currently only supports English
472
+ */
473
+ appStrings?: {
474
+ [key in ValidTranslationKeys]?: {
475
+ [lang in ValidTranslationLanguages]?: string;
476
+ };
477
+ };
460
478
  }
461
479
 
462
480
  export interface IApp2 extends BaseApp {
@@ -0,0 +1,16 @@
1
+ export type ValidTranslationKeys =
2
+ | "updateNotification.title"
3
+ | "updateNotification.body";
4
+ export type ValidTranslationLanguages = "default";
5
+ /* TODO - Support more languages here */
6
+ // | "en"
7
+ // | "es"
8
+ // | "fr"
9
+ // | "de"
10
+ // | "it"
11
+ // | "ja"
12
+ // | "ko"
13
+ // | "pt-BR"
14
+ // | "ru"
15
+ // | "zh-CN"
16
+ // | "zh-TW";