@todesktop/shared 7.106.0 → 7.109.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/lib/desktopify2.d.ts +2 -2
- package/lib/index.d.ts +1 -0
- package/lib/plugin.d.ts +26 -0
- package/lib/plugin.js +2 -0
- package/package.json +1 -1
- package/src/desktopify2.ts +2 -2
- package/src/index.ts +1 -0
- package/src/plugin.ts +34 -0
package/lib/desktopify2.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { ISwitchableValue } from "./toDesktop";
|
|
3
3
|
import { MenuItemConstructorOptions, BrowserWindowConstructorOptions, WebPreferences } from "@todesktop/client-electron-types";
|
|
4
4
|
import { BaseApp } from "./base";
|
|
5
|
+
import { DesktopAppPlugin } from "./plugin";
|
|
5
6
|
/**
|
|
6
7
|
* Custom ToDesktop Roles for Application & Tray Menus
|
|
7
8
|
*/
|
|
@@ -270,9 +271,8 @@ export interface DesktopifyApp2 {
|
|
|
270
271
|
pollForAppUpdatesEveryXMinutes?: number;
|
|
271
272
|
/**
|
|
272
273
|
* An array of plugin modules. Can work with semver specificity
|
|
273
|
-
* e.g. ["@todesktop/plugin-foo", "@todesktop/plugin-baz@1.0.0"]
|
|
274
274
|
*/
|
|
275
|
-
plugins?: string[];
|
|
275
|
+
plugins?: (DesktopAppPlugin | string)[];
|
|
276
276
|
/**
|
|
277
277
|
* The app's windows
|
|
278
278
|
*/
|
package/lib/index.d.ts
CHANGED
package/lib/plugin.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface DesktopAppPlugin {
|
|
2
|
+
package: string;
|
|
3
|
+
preferences?: {
|
|
4
|
+
[id: string]: NumberSpec | TextSpec;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export declare type TextSpec = PreferenceSpec<"text", {
|
|
8
|
+
minLength?: number;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
pattern?: RegExp;
|
|
11
|
+
defaultValue?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare type NumberSpec = PreferenceSpec<"number", {
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
defaultValue?: number;
|
|
18
|
+
placeholder?: number;
|
|
19
|
+
}>;
|
|
20
|
+
interface PreferenceSpec<T, V> {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
type: T;
|
|
24
|
+
value: V;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
package/lib/plugin.js
ADDED
package/package.json
CHANGED
package/src/desktopify2.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
WebPreferences,
|
|
6
6
|
} from "@todesktop/client-electron-types";
|
|
7
7
|
import { BaseApp, Schemable } from "./base";
|
|
8
|
+
import { DesktopAppPlugin } from "./plugin";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Custom ToDesktop Roles for Application & Tray Menus
|
|
@@ -383,9 +384,8 @@ export interface DesktopifyApp2 {
|
|
|
383
384
|
pollForAppUpdatesEveryXMinutes?: number;
|
|
384
385
|
/**
|
|
385
386
|
* An array of plugin modules. Can work with semver specificity
|
|
386
|
-
* e.g. ["@todesktop/plugin-foo", "@todesktop/plugin-baz@1.0.0"]
|
|
387
387
|
*/
|
|
388
|
-
plugins?: string[];
|
|
388
|
+
plugins?: (DesktopAppPlugin | string)[];
|
|
389
389
|
/**
|
|
390
390
|
* The app's windows
|
|
391
391
|
*/
|
package/src/index.ts
CHANGED
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface DesktopAppPlugin {
|
|
2
|
+
package: string; // e.g. ["@todesktop/plugin-foo", "@todesktop/plugin-baz@1.0.0"]
|
|
3
|
+
preferences?: {
|
|
4
|
+
[id: string]: NumberSpec | TextSpec;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type TextSpec = PreferenceSpec<
|
|
9
|
+
"text",
|
|
10
|
+
{
|
|
11
|
+
minLength?: number;
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
pattern?: RegExp;
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
}
|
|
17
|
+
>;
|
|
18
|
+
|
|
19
|
+
export type NumberSpec = PreferenceSpec<
|
|
20
|
+
"number",
|
|
21
|
+
{
|
|
22
|
+
min?: number;
|
|
23
|
+
max?: number;
|
|
24
|
+
defaultValue?: number;
|
|
25
|
+
placeholder?: number;
|
|
26
|
+
}
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
interface PreferenceSpec<T, V> {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
type: T;
|
|
33
|
+
value: V;
|
|
34
|
+
}
|