@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.
@@ -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
@@ -4,6 +4,7 @@ export * from "./validations";
4
4
  export * from "./getSiteInfo";
5
5
  export * from "./plans";
6
6
  export * from './base';
7
+ export * from './plugin';
7
8
  export * from "./desktopify2";
8
9
  declare const schemaVersion: string;
9
10
  export { schemaVersion };
@@ -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
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todesktop/shared",
3
- "version": "7.106.0",
3
+ "version": "7.109.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -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
@@ -6,6 +6,7 @@ export * from "./validations";
6
6
  export * from "./getSiteInfo";
7
7
  export * from "./plans";
8
8
  export * from './base';
9
+ export * from './plugin';
9
10
 
10
11
  export * from "./desktopify2";
11
12
 
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
+ }