@widget-js/core 24.1.1-beta.88 → 24.1.1-beta.89
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/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +182 -165
- package/dist/index.d.ts +182 -165
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -168,6 +168,10 @@ interface IDeployedPage {
|
|
|
168
168
|
height: number;
|
|
169
169
|
width: number;
|
|
170
170
|
proxy?: string;
|
|
171
|
+
minWidth?: number;
|
|
172
|
+
minHeight?: number;
|
|
173
|
+
maxWidth?: number;
|
|
174
|
+
maxHeight?: number;
|
|
171
175
|
isIgnoreMouseEvents?: boolean;
|
|
172
176
|
}
|
|
173
177
|
declare class DeployedPage implements IDeployedPage {
|
|
@@ -185,6 +189,10 @@ declare class DeployedPage implements IDeployedPage {
|
|
|
185
189
|
declare class DeployedWidget extends DeployedPage {
|
|
186
190
|
shortcut?: string;
|
|
187
191
|
deployMode: number;
|
|
192
|
+
minWidth?: number;
|
|
193
|
+
minHeight?: number;
|
|
194
|
+
maxWidth?: number;
|
|
195
|
+
maxHeight?: number;
|
|
188
196
|
isOverlap(): boolean;
|
|
189
197
|
}
|
|
190
198
|
|
|
@@ -278,7 +286,7 @@ interface IAiApi {
|
|
|
278
286
|
*/
|
|
279
287
|
declare enum AiApiEvent {
|
|
280
288
|
/**
|
|
281
|
-
*
|
|
289
|
+
* Configuration update event
|
|
282
290
|
*/
|
|
283
291
|
CONFIG_UPDATED = "channel::cn.widgetjs.core.ai.config.updated"
|
|
284
292
|
}
|
|
@@ -602,34 +610,34 @@ interface AppRuntimeInfo {
|
|
|
602
610
|
|
|
603
611
|
type AppRoutes = '/widget/search' | '/widget/package' | '/setting/common' | '/setting/theme' | '/setting/ai' | '/setting/proxy' | '/setting/info' | '/user/profile';
|
|
604
612
|
/**
|
|
605
|
-
* AppApi
|
|
613
|
+
* AppApi interface defines a series of methods related to the application. These methods provide functions such as application configuration management, version information retrieval, path retrieval, and application built-in window operations.
|
|
606
614
|
* @see [Electron API App](https://www.electronjs.org/docs/latest/api/app)
|
|
607
615
|
*/
|
|
608
616
|
interface IAppApi {
|
|
609
617
|
/**
|
|
610
|
-
*
|
|
618
|
+
* Set configuration
|
|
611
619
|
* @param key string
|
|
612
620
|
* @param value string | number | boolean
|
|
613
621
|
*/
|
|
614
622
|
setConfig: (key: string | AppApiConstants, value: string | number | boolean) => Promise<any>;
|
|
615
623
|
/**
|
|
616
|
-
*
|
|
624
|
+
* Get configuration
|
|
617
625
|
* @param key
|
|
618
626
|
* @param defaultValue
|
|
619
627
|
* @return Promise<string | number | boolean>
|
|
620
628
|
*/
|
|
621
629
|
getConfig: <T extends string | number | boolean>(key: string | AppApiConstants, defaultValue: T) => Promise<T>;
|
|
622
630
|
/**
|
|
623
|
-
*
|
|
624
|
-
* @param type string -
|
|
631
|
+
* Get version information
|
|
632
|
+
* @param type string - Optional. Specify the type of version to get.
|
|
625
633
|
* <ol>
|
|
626
634
|
* <li>`app`: Get app's version with Semantic Versioning format.
|
|
627
635
|
* The version is different from Microsoft store's version.
|
|
628
636
|
* For example, if the app's version is `24.1.1`, Microsoft store's version will be `24.1.1.0`</li>
|
|
629
|
-
* <li>`electron`:
|
|
630
|
-
* <li>`chrome`:
|
|
631
|
-
* <li>`node`:
|
|
632
|
-
* <li>`v8`:
|
|
637
|
+
* <li>`electron`: Get the version of the Electron framework.</li>
|
|
638
|
+
* <li>`chrome`: Get the Chromium version used by Electron.</li>
|
|
639
|
+
* <li>`node`: Get the Node.js version.</li>
|
|
640
|
+
* <li>`v8`: Get the V8 engine version.</li>
|
|
633
641
|
* </ol>
|
|
634
642
|
* @return Promise<string>
|
|
635
643
|
*/
|
|
@@ -639,13 +647,13 @@ interface IAppApi {
|
|
|
639
647
|
*/
|
|
640
648
|
getRuntimeInfo: () => Promise<AppRuntimeInfo>;
|
|
641
649
|
/**
|
|
642
|
-
*
|
|
650
|
+
* Get Preload JS path
|
|
643
651
|
* @see [Using Preload Scripts](https://www.electronjs.org/docs/latest/tutorial/tutorial-preload)
|
|
644
652
|
* @return Promise<string>
|
|
645
653
|
*/
|
|
646
654
|
getPreloadPath: () => Promise<string>;
|
|
647
655
|
/**
|
|
648
|
-
*
|
|
656
|
+
* Get application installation path
|
|
649
657
|
* @return Promise<string>
|
|
650
658
|
*/
|
|
651
659
|
getAppPath: () => Promise<string>;
|
|
@@ -757,23 +765,23 @@ type AppApiMethods = keyof IAppApi;
|
|
|
757
765
|
*/
|
|
758
766
|
declare enum AppApiEvent {
|
|
759
767
|
/**
|
|
760
|
-
*
|
|
768
|
+
* Triggered when application settings change
|
|
761
769
|
*/
|
|
762
770
|
CONFIG_CHANGED = "event::cn.widgetjs.core.app.config.changed",
|
|
763
771
|
/**
|
|
764
|
-
*
|
|
772
|
+
* Triggered when the desktop widget grid window moves
|
|
765
773
|
*/
|
|
766
774
|
MOVING_GRID_WINDOW = "event::cn.widgetjs.core.app.moving.grid.window",
|
|
767
775
|
/**
|
|
768
|
-
*
|
|
776
|
+
* Triggered when the desktop widget grid window stops moving
|
|
769
777
|
*/
|
|
770
778
|
STOP_MOVING_GRID_WINDOW = "event::cn.widgetjs.core.app.moving.grid.window.stop",
|
|
771
779
|
/**
|
|
772
|
-
*
|
|
780
|
+
* Application proxy changed
|
|
773
781
|
*/
|
|
774
782
|
PROXY_CHANGED = "event::cn.widgetjs.core.app.proxy.changed",
|
|
775
783
|
/**
|
|
776
|
-
*
|
|
784
|
+
* Application language changed
|
|
777
785
|
*/
|
|
778
786
|
LANGUAGE_CHANGED = "event::cn.widgetjs.core.app.language.changed"
|
|
779
787
|
}
|
|
@@ -782,20 +790,20 @@ declare enum AppApiEvent {
|
|
|
782
790
|
*/
|
|
783
791
|
declare enum AppApiConstants {
|
|
784
792
|
/**
|
|
785
|
-
*
|
|
793
|
+
* Desktop widget grid size
|
|
786
794
|
*/
|
|
787
795
|
CONFIG_GRID_CELL_SIZE = "cn.widgetjs.config.grid.size",
|
|
788
796
|
/**
|
|
789
|
-
*
|
|
797
|
+
* Application theme CSS settings
|
|
790
798
|
*/
|
|
791
799
|
CONFIG_WIDGET_THEME_CSS = "cn.widgetjs.config.widget.theme.css",
|
|
792
800
|
/**
|
|
793
|
-
*
|
|
801
|
+
* Application global proxy settings
|
|
794
802
|
*/
|
|
795
803
|
CONFIG_PROXY = "cn.widgetjs.config.app.proxy",
|
|
796
804
|
CONFIG_DEV_MODE = "cn.widgetjs.config.app.dev.mode",
|
|
797
805
|
/**
|
|
798
|
-
*
|
|
806
|
+
* Application language settings
|
|
799
807
|
*/
|
|
800
808
|
CONFIG_LANGUAGE = "cn.widgetjs.config.app.language"
|
|
801
809
|
}
|
|
@@ -1195,6 +1203,7 @@ declare class DeployedWidgetApiImpl extends BaseApi<DeployedWidgetApiMethods> im
|
|
|
1195
1203
|
*/
|
|
1196
1204
|
registerActiveShortcut(widgetId: string, shortcut?: string): Promise<boolean>;
|
|
1197
1205
|
setProxy(widgetId: string, proxy: string): Promise<boolean>;
|
|
1206
|
+
setSize(widgetId: string, width: number, height: number): Promise<void>;
|
|
1198
1207
|
}
|
|
1199
1208
|
declare const DeployedWidgetApi: DeployedWidgetApiImpl;
|
|
1200
1209
|
|
|
@@ -1210,7 +1219,7 @@ interface IDeployedWidgetApi {
|
|
|
1210
1219
|
getDeployedWidgets: () => Promise<DeployedWidget[]>;
|
|
1211
1220
|
openDevTools: (id: string) => Promise<void>;
|
|
1212
1221
|
/**
|
|
1213
|
-
* @deprecated
|
|
1222
|
+
* @deprecated Use WidgetApi.openConfigPage instead
|
|
1214
1223
|
* @param id
|
|
1215
1224
|
*/
|
|
1216
1225
|
openConfigPage: (id?: string, params?: WidgetParams) => Promise<void>;
|
|
@@ -1230,18 +1239,25 @@ interface IDeployedWidgetApi {
|
|
|
1230
1239
|
*/
|
|
1231
1240
|
addWidget: (options: AddWidgetOption) => Promise<Widget[]>;
|
|
1232
1241
|
/**
|
|
1233
|
-
*
|
|
1234
|
-
* @param widgetName
|
|
1235
|
-
* @returns
|
|
1242
|
+
* Create a desktop shortcut
|
|
1243
|
+
* @param widgetName Widget name
|
|
1244
|
+
* @returns Returns true on success, false otherwise
|
|
1236
1245
|
*/
|
|
1237
1246
|
createDesktopShortcut: (widgetName: string) => Promise<boolean>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Set widget size
|
|
1249
|
+
* @param widgetId Widget ID
|
|
1250
|
+
* @param width Width
|
|
1251
|
+
* @param height Height
|
|
1252
|
+
*/
|
|
1253
|
+
setSize: (widgetId: string, width: number, height: number) => Promise<void>;
|
|
1238
1254
|
}
|
|
1239
1255
|
/**
|
|
1240
1256
|
* AiApiEvent
|
|
1241
1257
|
*/
|
|
1242
1258
|
declare enum DeployedWidgetApiEvent {
|
|
1243
1259
|
/**
|
|
1244
|
-
*
|
|
1260
|
+
* Second instance start event
|
|
1245
1261
|
*/
|
|
1246
1262
|
SECOND_INSTANCE = "channel::cn.widgetjs.core.deployed_widget.second_instance"
|
|
1247
1263
|
}
|
|
@@ -1404,16 +1420,16 @@ interface IDeviceApi {
|
|
|
1404
1420
|
}
|
|
1405
1421
|
|
|
1406
1422
|
/**
|
|
1407
|
-
* DialogApi
|
|
1423
|
+
* DialogApi provides file and folder selection functions
|
|
1408
1424
|
*/
|
|
1409
1425
|
interface IDialogApi {
|
|
1410
1426
|
/**
|
|
1411
|
-
*
|
|
1412
|
-
* @param extensions
|
|
1427
|
+
* Pick a single file
|
|
1428
|
+
* @param extensions Allowed file extension formats, e.g., ["txt", "docx", "gif"]
|
|
1413
1429
|
*/
|
|
1414
1430
|
pickFile: (extensions?: string[]) => Promise<string | undefined>;
|
|
1415
1431
|
/**
|
|
1416
|
-
*
|
|
1432
|
+
* Pick a folder
|
|
1417
1433
|
*/
|
|
1418
1434
|
pickFolder: () => Promise<string | undefined>;
|
|
1419
1435
|
}
|
|
@@ -2592,7 +2608,7 @@ interface IFileApi {
|
|
|
2592
2608
|
}
|
|
2593
2609
|
|
|
2594
2610
|
/**
|
|
2595
|
-
* LogApi
|
|
2611
|
+
* LogApi provides log output methods, logs will be saved in the user's current username/Documents/widgets/logs/date/widget_package_name.log file
|
|
2596
2612
|
*/
|
|
2597
2613
|
interface ILogApi {
|
|
2598
2614
|
info: (...data: any[]) => void;
|
|
@@ -2629,26 +2645,26 @@ declare enum MouseApiEvent {
|
|
|
2629
2645
|
type MouseApiMethods = keyof IMouseApi;
|
|
2630
2646
|
|
|
2631
2647
|
/**
|
|
2632
|
-
* ProcessApi
|
|
2648
|
+
* ProcessApi provides process information retrieval functions
|
|
2633
2649
|
*/
|
|
2634
2650
|
interface IProcessApi {
|
|
2635
2651
|
getBlinkMemoryInfo: () => Promise<Electron.BlinkMemoryInfo>;
|
|
2636
2652
|
getHeapStatistics: () => Promise<Electron.HeapStatistics>;
|
|
2637
2653
|
/**
|
|
2638
|
-
*
|
|
2654
|
+
* Get system version information
|
|
2639
2655
|
* @example '10.0.17763'
|
|
2640
2656
|
*/
|
|
2641
2657
|
getSystemVersion: () => Promise<string>;
|
|
2642
2658
|
/**
|
|
2643
|
-
*
|
|
2659
|
+
* Get current application memory information
|
|
2644
2660
|
*/
|
|
2645
2661
|
getProcessMemoryInfo: () => Promise<Electron.ProcessMemoryInfo>;
|
|
2646
2662
|
}
|
|
2647
2663
|
type ProcessApiMethods = keyof IProcessApi;
|
|
2648
2664
|
|
|
2649
2665
|
/**
|
|
2650
|
-
* MenuApi
|
|
2651
|
-
* @remarks
|
|
2666
|
+
* MenuApi interface defines a series of methods for controlling windows, providing functions such as showing, hiding, moving, and resizing windows
|
|
2667
|
+
* @remarks Note: Desktop-type widgets do not support window moving, resizing, maximizing, minimizing, etc.
|
|
2652
2668
|
*/
|
|
2653
2669
|
interface IMenuApi {
|
|
2654
2670
|
/**
|
|
@@ -2656,12 +2672,12 @@ interface IMenuApi {
|
|
|
2656
2672
|
*/
|
|
2657
2673
|
addMenuItem: (menuItems: WidgetMenuItem[]) => Promise<void>;
|
|
2658
2674
|
/**
|
|
2659
|
-
*
|
|
2675
|
+
* Add context menu items, up to two levels of menus are supported
|
|
2660
2676
|
* @param menuItems
|
|
2661
2677
|
*/
|
|
2662
2678
|
addContextMenuItem: (menuItems: WidgetMenuItem[]) => Promise<void>;
|
|
2663
2679
|
/**
|
|
2664
|
-
*
|
|
2680
|
+
* Remove context menu items
|
|
2665
2681
|
* @param menuItemIds
|
|
2666
2682
|
*/
|
|
2667
2683
|
removeContextMenuItem: (menuItemIds: string[]) => Promise<void>;
|
|
@@ -2670,7 +2686,7 @@ interface IMenuApi {
|
|
|
2670
2686
|
*/
|
|
2671
2687
|
removeMenuItem: (menuItemIds: string[]) => Promise<void>;
|
|
2672
2688
|
/**
|
|
2673
|
-
*
|
|
2689
|
+
* Show custom menu
|
|
2674
2690
|
* @param options ShowMenuOption
|
|
2675
2691
|
*/
|
|
2676
2692
|
showMenu: (options: ShowMenuOption) => Promise<void>;
|
|
@@ -2897,7 +2913,7 @@ interface IUserApi {
|
|
|
2897
2913
|
*/
|
|
2898
2914
|
declare enum UserApiEvent {
|
|
2899
2915
|
/**
|
|
2900
|
-
*
|
|
2916
|
+
* User updated event
|
|
2901
2917
|
*/
|
|
2902
2918
|
USER_UPDATED = "channel::cn.widgetjs.core.user.updated",
|
|
2903
2919
|
SIGNED_OUT = "channel::cn.widgetjs.core.user.signed.out",
|
|
@@ -2907,32 +2923,32 @@ declare enum UserApiEvent {
|
|
|
2907
2923
|
type UserApiMethods = keyof IUserApi;
|
|
2908
2924
|
|
|
2909
2925
|
/**
|
|
2910
|
-
* WidgetPackageApi
|
|
2926
|
+
* WidgetPackageApi provides functions such as upgrading, retrieving, and installing widget packages
|
|
2911
2927
|
*/
|
|
2912
2928
|
interface IWidgetPackageApi {
|
|
2913
2929
|
/**
|
|
2914
|
-
*
|
|
2915
|
-
* @param packageName
|
|
2930
|
+
* Upgrade widget package
|
|
2931
|
+
* @param packageName Widget package name
|
|
2916
2932
|
* @param remoteUrlInfo
|
|
2917
2933
|
*/
|
|
2918
2934
|
upgrade: (packageName: string, remoteUrlInfo: RemotePackageUrlInfo) => Promise<void>;
|
|
2919
2935
|
/**
|
|
2920
|
-
*
|
|
2936
|
+
* Get index url information of the widget package
|
|
2921
2937
|
* @param packageName
|
|
2922
2938
|
*/
|
|
2923
2939
|
getIndexUrl: (packageName: string) => Promise<string | null>;
|
|
2924
2940
|
/**
|
|
2925
|
-
*
|
|
2941
|
+
* Get entry url information of the widget package
|
|
2926
2942
|
* @param packageName
|
|
2927
2943
|
*/
|
|
2928
2944
|
getEntryUrl: (packageName: string) => Promise<string | null>;
|
|
2929
2945
|
/**
|
|
2930
|
-
*
|
|
2946
|
+
* Get widget package information by package name
|
|
2931
2947
|
* @param name
|
|
2932
2948
|
*/
|
|
2933
2949
|
getPackage: (name: string) => Promise<WidgetPackage | undefined>;
|
|
2934
2950
|
/**
|
|
2935
|
-
*
|
|
2951
|
+
* Get installed widget packages
|
|
2936
2952
|
*/
|
|
2937
2953
|
getPackages: () => Promise<WidgetPackage[]>;
|
|
2938
2954
|
/**
|
|
@@ -2953,11 +2969,11 @@ type WidgetPackageApiMethods = keyof IWidgetPackageApi;
|
|
|
2953
2969
|
*/
|
|
2954
2970
|
declare enum WidgetPackageApiEvent {
|
|
2955
2971
|
/**
|
|
2956
|
-
*
|
|
2972
|
+
* Widget package upgraded event
|
|
2957
2973
|
*/
|
|
2958
2974
|
PACKAGE_UPGRADE = "event::cn.widgetjs.core.widget.package.upgraded",
|
|
2959
2975
|
/**
|
|
2960
|
-
*
|
|
2976
|
+
* Widget package installed event
|
|
2961
2977
|
*/
|
|
2962
2978
|
PACKAGE_INSTALLED = "event::cn.widgetjs.core.widget.package.installed"
|
|
2963
2979
|
}
|
|
@@ -2965,11 +2981,11 @@ declare enum WidgetPackageApiEvent {
|
|
|
2965
2981
|
declare const AppApi: IAppApi;
|
|
2966
2982
|
|
|
2967
2983
|
/**
|
|
2968
|
-
* WidgetApi
|
|
2984
|
+
* WidgetApi interface defines a series of methods for controlling widgets, providing functions such as widget registration, upgrade, retrieval, opening settings page, reloading, etc.
|
|
2969
2985
|
*/
|
|
2970
2986
|
interface IWidgetApi {
|
|
2971
2987
|
/**
|
|
2972
|
-
*
|
|
2988
|
+
* Register widgets
|
|
2973
2989
|
* @param widgets
|
|
2974
2990
|
*/
|
|
2975
2991
|
registerWidgets: (widgets: Widget[]) => Promise<void>;
|
|
@@ -2989,24 +3005,24 @@ interface IWidgetApi {
|
|
|
2989
3005
|
*/
|
|
2990
3006
|
isIgnoreMouseEvents: (widgetId?: string) => Promise<boolean>;
|
|
2991
3007
|
/**
|
|
2992
|
-
*
|
|
2993
|
-
* @param draggable boolean true
|
|
2994
|
-
* @remarks
|
|
3008
|
+
* Set whether the widget can be dragged with the left mouse button
|
|
3009
|
+
* @param draggable boolean true-enable left click drag false-disable left click drag
|
|
3010
|
+
* @remarks Note: Only effective for floating window widgets (DeployMode.OVERLAP)
|
|
2995
3011
|
*/
|
|
2996
3012
|
setMouseDraggable: (draggable: boolean) => Promise<void>;
|
|
2997
3013
|
/**
|
|
2998
|
-
*
|
|
2999
|
-
* @param packageName
|
|
3014
|
+
* Upgrade widget package
|
|
3015
|
+
* @param packageName Widget package name
|
|
3000
3016
|
*/
|
|
3001
3017
|
upgradePackage: (packageName: string) => Promise<void>;
|
|
3002
3018
|
/**
|
|
3003
|
-
*
|
|
3019
|
+
* Get all widgets
|
|
3004
3020
|
* @return Promise<Widget[]>
|
|
3005
3021
|
*/
|
|
3006
3022
|
getWidgets: () => Promise<Widget[]>;
|
|
3007
3023
|
/**
|
|
3008
|
-
*
|
|
3009
|
-
* @param name string
|
|
3024
|
+
* Get widget by widget name
|
|
3025
|
+
* @param name string Widget name
|
|
3010
3026
|
* @return Promise<Widget>
|
|
3011
3027
|
*/
|
|
3012
3028
|
getWidget: (name: string) => Promise<Widget>;
|
|
@@ -3020,8 +3036,8 @@ interface IWidgetApi {
|
|
|
3020
3036
|
*/
|
|
3021
3037
|
getWidgetPackages: () => Promise<WidgetPackage[]>;
|
|
3022
3038
|
/**
|
|
3023
|
-
*
|
|
3024
|
-
* @param id string
|
|
3039
|
+
* Open widget settings page
|
|
3040
|
+
* @param id string Widget id
|
|
3025
3041
|
*/
|
|
3026
3042
|
openConfigPage: (id?: string) => Promise<void>;
|
|
3027
3043
|
/**
|
|
@@ -3029,7 +3045,7 @@ interface IWidgetApi {
|
|
|
3029
3045
|
*/
|
|
3030
3046
|
openConfigPageByName: (name: string) => Promise<void>;
|
|
3031
3047
|
/**
|
|
3032
|
-
*
|
|
3048
|
+
* Reload widget
|
|
3033
3049
|
*/
|
|
3034
3050
|
reload: (id?: string) => Promise<void>;
|
|
3035
3051
|
/**
|
|
@@ -3206,7 +3222,8 @@ declare enum WidgetApiEvent {
|
|
|
3206
3222
|
DATA_CHANGED = "event::cn.widgetjs.core.widget.data-changed",
|
|
3207
3223
|
EDIT_DESKTOP_WIDGETS = "event::cn.widgetjs.core.widget.desktop.edit",
|
|
3208
3224
|
PACKAGE_UPGRADE = "event::cn.widgetjs.core.widget.package.upgraded",
|
|
3209
|
-
PACKAGE_INSTALLED = "event::cn.widgetjs.core.widget.package.installed"
|
|
3225
|
+
PACKAGE_INSTALLED = "event::cn.widgetjs.core.widget.package.installed",
|
|
3226
|
+
WIDGET_REMOVED = "event::cn.widgetjs.core.widget.removed"
|
|
3210
3227
|
}
|
|
3211
3228
|
declare class WidgetApiImpl extends BaseApi<WidgetApiMethods> implements IWidgetApi {
|
|
3212
3229
|
getSyncInfo(widgetName?: string): Promise<WidgetSyncInfo | null>;
|
|
@@ -3246,27 +3263,27 @@ declare class WidgetApiImpl extends BaseApi<WidgetApiMethods> implements IWidget
|
|
|
3246
3263
|
declare const WidgetApi: WidgetApiImpl;
|
|
3247
3264
|
|
|
3248
3265
|
/**
|
|
3249
|
-
* ShortcutApi
|
|
3266
|
+
* ShortcutApi provides the ability to register shortcuts. When a shortcut is triggered, a broadcast event {@link BroadcastEvent} will be sent.
|
|
3250
3267
|
*/
|
|
3251
3268
|
interface IShortcutApi {
|
|
3252
3269
|
/**
|
|
3253
|
-
*
|
|
3270
|
+
* Register shortcut, if successful, when the shortcut is triggered, a broadcast event {@link BroadcastEvent} will be sent.
|
|
3254
3271
|
* @see [Electron Accelerator](https://www.electronjs.org/docs/latest/api/accelerator)
|
|
3255
3272
|
* @param shortcut string
|
|
3256
|
-
* @return Promise<boolean> true
|
|
3273
|
+
* @return Promise<boolean> true on success, false on failure
|
|
3257
3274
|
* @example
|
|
3258
3275
|
* ```typescript
|
|
3259
|
-
* //Meta
|
|
3276
|
+
* // Meta is usually the Windows key
|
|
3260
3277
|
* ShortcutApi.register('Ctrl+Meta+Y')
|
|
3261
3278
|
* ```
|
|
3262
3279
|
*/
|
|
3263
3280
|
register: (shortcut: string) => Promise<boolean>;
|
|
3264
3281
|
/**
|
|
3265
|
-
*
|
|
3282
|
+
* Unregister shortcut
|
|
3266
3283
|
* @param shortcut string
|
|
3267
3284
|
* @example
|
|
3268
3285
|
* ```typescript
|
|
3269
|
-
* //Meta
|
|
3286
|
+
* // Meta is usually the Windows key
|
|
3270
3287
|
* ShortcutApi.unregister('Ctrl+Meta+Y')
|
|
3271
3288
|
* ```
|
|
3272
3289
|
*/
|
|
@@ -3277,7 +3294,7 @@ interface IShortcutApi {
|
|
|
3277
3294
|
*/
|
|
3278
3295
|
declare enum ShortcutApiEvent {
|
|
3279
3296
|
/**
|
|
3280
|
-
*
|
|
3297
|
+
* Shortcut triggered event
|
|
3281
3298
|
*/
|
|
3282
3299
|
TRIGGERED = "channel::cn.widgetjs.core.shortcut.triggered"
|
|
3283
3300
|
}
|
|
@@ -3297,173 +3314,173 @@ declare enum ClipboardApiEvent {
|
|
|
3297
3314
|
declare const ClipboardApi: IClipboardApi;
|
|
3298
3315
|
|
|
3299
3316
|
/**
|
|
3300
|
-
* BrowserWindowApi
|
|
3301
|
-
* @remarks
|
|
3317
|
+
* BrowserWindowApi interface defines a series of methods for controlling windows, providing functions such as showing, hiding, moving, and resizing windows
|
|
3318
|
+
* @remarks Note: Desktop-type widgets do not support window moving, resizing, maximizing, minimizing, etc.
|
|
3302
3319
|
*/
|
|
3303
3320
|
interface IBrowserWindowApi {
|
|
3304
3321
|
/**
|
|
3305
|
-
*
|
|
3322
|
+
* Set whether to ignore mouse events
|
|
3306
3323
|
* @param ignore boolean
|
|
3307
3324
|
*/
|
|
3308
3325
|
setIgnoreMouseEvent: (ignore: boolean) => Promise<void>;
|
|
3309
3326
|
/**
|
|
3310
|
-
*
|
|
3327
|
+
* Show window
|
|
3311
3328
|
*/
|
|
3312
3329
|
show: () => Promise<void>;
|
|
3313
3330
|
/**
|
|
3314
|
-
*
|
|
3331
|
+
* Set whether the window has a shadow
|
|
3315
3332
|
* @param hasShadow boolean
|
|
3316
3333
|
*/
|
|
3317
3334
|
setHasShadow: (hasShadow: boolean) => Promise<void>;
|
|
3318
3335
|
/**
|
|
3319
|
-
*
|
|
3336
|
+
* Hide window
|
|
3320
3337
|
*/
|
|
3321
3338
|
hide: () => Promise<void>;
|
|
3322
3339
|
/**
|
|
3323
|
-
*
|
|
3340
|
+
* Close window
|
|
3324
3341
|
*/
|
|
3325
3342
|
close: () => Promise<void>;
|
|
3326
3343
|
/**
|
|
3327
|
-
*
|
|
3344
|
+
* Show window without activating it
|
|
3328
3345
|
*/
|
|
3329
3346
|
showInactive: () => Promise<void>;
|
|
3330
3347
|
/**
|
|
3331
|
-
*
|
|
3348
|
+
* Center window
|
|
3332
3349
|
*/
|
|
3333
3350
|
center: () => Promise<void>;
|
|
3334
3351
|
/**
|
|
3335
|
-
*
|
|
3352
|
+
* Minimize window
|
|
3336
3353
|
*/
|
|
3337
3354
|
minimize: () => Promise<void>;
|
|
3338
3355
|
/**
|
|
3339
|
-
*
|
|
3356
|
+
* Restore window
|
|
3340
3357
|
*/
|
|
3341
3358
|
restore: () => Promise<void>;
|
|
3342
3359
|
/**
|
|
3343
|
-
*
|
|
3360
|
+
* Whether the window is minimized
|
|
3344
3361
|
* @return Promise<boolean>
|
|
3345
3362
|
*/
|
|
3346
3363
|
isMinimized: () => Promise<boolean>;
|
|
3347
3364
|
/**
|
|
3348
|
-
*
|
|
3365
|
+
* Check if the window is maximized
|
|
3349
3366
|
* @return Promise<boolean>
|
|
3350
3367
|
*/
|
|
3351
3368
|
isMaximized: () => Promise<boolean>;
|
|
3352
3369
|
/**
|
|
3353
|
-
*
|
|
3370
|
+
* Check if the window is visible
|
|
3354
3371
|
* @return Promise<boolean>
|
|
3355
3372
|
*/
|
|
3356
3373
|
isVisible: () => Promise<boolean>;
|
|
3357
3374
|
/**
|
|
3358
|
-
*
|
|
3375
|
+
* Check if the window is resizable
|
|
3359
3376
|
* @since 24.1.1-beta.6
|
|
3360
3377
|
* @return Promise<boolean>
|
|
3361
3378
|
*/
|
|
3362
3379
|
isResizable: () => Promise<boolean>;
|
|
3363
3380
|
/**
|
|
3364
|
-
*
|
|
3381
|
+
* Maximize window
|
|
3365
3382
|
*/
|
|
3366
3383
|
maximize: () => Promise<void>;
|
|
3367
3384
|
/**
|
|
3368
|
-
*
|
|
3385
|
+
* Stop dragging the window
|
|
3369
3386
|
*/
|
|
3370
3387
|
stopDraggingWindow: () => Promise<void>;
|
|
3371
3388
|
/**
|
|
3372
|
-
*
|
|
3389
|
+
* Start dragging the window
|
|
3373
3390
|
*/
|
|
3374
3391
|
startDraggingWindow: () => Promise<void>;
|
|
3375
3392
|
/**
|
|
3376
|
-
*
|
|
3393
|
+
* Check if the window is being dragged
|
|
3377
3394
|
* @return Promise<boolean>
|
|
3378
3395
|
*/
|
|
3379
3396
|
isDraggingWindow: () => Promise<boolean>;
|
|
3380
3397
|
/**
|
|
3381
|
-
*
|
|
3398
|
+
* Set whether the window is always on top
|
|
3382
3399
|
* @param alwaysOnTop boolean
|
|
3383
3400
|
*/
|
|
3384
3401
|
setAlwaysOnTop: (alwaysOnTop: boolean) => Promise<void>;
|
|
3385
3402
|
/**
|
|
3386
|
-
*
|
|
3403
|
+
* Check if the window is always on top
|
|
3387
3404
|
* @return Promise<boolean>
|
|
3388
3405
|
*/
|
|
3389
3406
|
isAlwaysOnTop: () => Promise<boolean>;
|
|
3390
3407
|
/**
|
|
3391
|
-
*
|
|
3392
|
-
* @param url string
|
|
3393
|
-
* @param option OpenUrlOptions -
|
|
3408
|
+
* Open specified URL
|
|
3409
|
+
* @param url string The URL to open
|
|
3410
|
+
* @param option OpenUrlOptions - Optional parameters for configuring how the URL is opened
|
|
3394
3411
|
*/
|
|
3395
3412
|
openUrl: (url: string, option?: BrowserWindowOptions) => Promise<void>;
|
|
3396
3413
|
/**
|
|
3397
|
-
*
|
|
3414
|
+
* Move the window to the top
|
|
3398
3415
|
*/
|
|
3399
3416
|
moveTop: () => Promise<void>;
|
|
3400
3417
|
/**
|
|
3401
|
-
*
|
|
3418
|
+
* Unmaximize window
|
|
3402
3419
|
*/
|
|
3403
3420
|
unmaximize: () => Promise<void>;
|
|
3404
3421
|
/**
|
|
3405
|
-
*
|
|
3422
|
+
* Reload window
|
|
3406
3423
|
*/
|
|
3407
3424
|
reload: () => Promise<void>;
|
|
3408
3425
|
/**
|
|
3409
|
-
*
|
|
3410
|
-
* @param width boolean -
|
|
3411
|
-
* @param height boolean -
|
|
3412
|
-
* @param animate boolean -
|
|
3426
|
+
* Set window size
|
|
3427
|
+
* @param width boolean - Window width
|
|
3428
|
+
* @param height boolean - Window height
|
|
3429
|
+
* @param animate boolean - Whether to use animation (optional)
|
|
3413
3430
|
*/
|
|
3414
3431
|
setSize: (width: number, height: number, animate?: boolean) => Promise<void>;
|
|
3415
3432
|
/**
|
|
3416
|
-
*
|
|
3433
|
+
* Get window size
|
|
3417
3434
|
* @since 24.1.1-beta.6
|
|
3418
3435
|
* @returns Promise<number[]>
|
|
3419
3436
|
*/
|
|
3420
3437
|
getSize: () => Promise<number[]>;
|
|
3421
3438
|
/**
|
|
3422
|
-
*
|
|
3439
|
+
* Open developer tools
|
|
3423
3440
|
*/
|
|
3424
3441
|
openDevTools: () => Promise<void>;
|
|
3425
3442
|
/**
|
|
3426
|
-
*
|
|
3427
|
-
* @param {SetPositionOptions} options -
|
|
3443
|
+
* Set window position
|
|
3444
|
+
* @param {SetPositionOptions} options - Options for configuring the window position
|
|
3428
3445
|
*/
|
|
3429
3446
|
setPosition: (options: SetPositionOptions) => Promise<void>;
|
|
3430
3447
|
/**
|
|
3431
|
-
*
|
|
3432
|
-
* @returns {Promise<Position>}
|
|
3448
|
+
* Get window position
|
|
3449
|
+
* @returns {Promise<Position>} Returns a Promise that resolves to the window's position
|
|
3433
3450
|
*/
|
|
3434
3451
|
getPosition: () => Promise<Position>;
|
|
3435
3452
|
/**
|
|
3436
|
-
*
|
|
3453
|
+
* Blur window
|
|
3437
3454
|
*/
|
|
3438
3455
|
blur: () => Promise<void>;
|
|
3439
3456
|
/**
|
|
3440
|
-
*
|
|
3457
|
+
* Focus window
|
|
3441
3458
|
*/
|
|
3442
3459
|
focus: () => Promise<void>;
|
|
3443
3460
|
/**
|
|
3444
|
-
*
|
|
3445
|
-
* @param resizable boolean -
|
|
3461
|
+
* Set whether the window is resizable
|
|
3462
|
+
* @param resizable boolean - Whether it is resizable
|
|
3446
3463
|
*/
|
|
3447
3464
|
setResizable: (resizable: boolean) => Promise<void>;
|
|
3448
3465
|
/**
|
|
3449
|
-
*
|
|
3450
|
-
* @param movable boolean -
|
|
3466
|
+
* Set whether the window is movable
|
|
3467
|
+
* @param movable boolean - Whether it is movable
|
|
3451
3468
|
*/
|
|
3452
3469
|
setMovable: (movable: boolean) => Promise<void>;
|
|
3453
3470
|
/**
|
|
3454
|
-
*
|
|
3471
|
+
* Get window bounds
|
|
3455
3472
|
* @returns Promise<Rectangle>
|
|
3456
3473
|
*/
|
|
3457
3474
|
getBounds: () => Promise<Rectangle>;
|
|
3458
3475
|
/**
|
|
3459
|
-
*
|
|
3460
|
-
* @param {Partial<Rectangle>} bounds -
|
|
3461
|
-
* @param {boolean} animate -
|
|
3476
|
+
* Set window bounds
|
|
3477
|
+
* @param {Partial<Rectangle>} bounds - The bounds rectangle of the window
|
|
3478
|
+
* @param {boolean} animate - Whether to enable animation
|
|
3462
3479
|
*/
|
|
3463
3480
|
setBounds: (bounds: Partial<Rectangle>, animate: boolean) => Promise<void>;
|
|
3464
3481
|
/**
|
|
3465
|
-
*
|
|
3466
|
-
* @param align string
|
|
3482
|
+
* Align the window to the current screen
|
|
3483
|
+
* @param align string Alignment position
|
|
3467
3484
|
* <ol>
|
|
3468
3485
|
* <li>'top-left'</li>
|
|
3469
3486
|
* <li>'top-center'</li>
|
|
@@ -3475,42 +3492,42 @@ interface IBrowserWindowApi {
|
|
|
3475
3492
|
*/
|
|
3476
3493
|
alignToScreen: (align: AlignPosition) => Promise<void>;
|
|
3477
3494
|
/**
|
|
3478
|
-
*
|
|
3479
|
-
* @param {string} url -
|
|
3495
|
+
* Check if the specified URL exists
|
|
3496
|
+
* @param {string} url - The URL to check
|
|
3480
3497
|
* @return Promise<boolean>
|
|
3481
3498
|
*/
|
|
3482
3499
|
existsByUrl: (url: string) => Promise<boolean>;
|
|
3483
3500
|
/**
|
|
3484
|
-
*
|
|
3485
|
-
* @returns {Promise<number[]>}
|
|
3501
|
+
* Get the maximum size of the window
|
|
3502
|
+
* @returns {Promise<number[]>} Returns a Promise that resolves to an array containing the maximum width and height of the window
|
|
3486
3503
|
*/
|
|
3487
3504
|
getMaximumSize: () => Promise<number[]>;
|
|
3488
3505
|
/**
|
|
3489
|
-
*
|
|
3490
|
-
* @returns {Promise<number[]>}
|
|
3506
|
+
* Get the minimum size of the window
|
|
3507
|
+
* @returns {Promise<number[]>} Returns a Promise that resolves to an array containing the minimum width and height of the window
|
|
3491
3508
|
*/
|
|
3492
3509
|
getMinimumSize: () => Promise<number[]>;
|
|
3493
3510
|
/**
|
|
3494
|
-
*
|
|
3495
|
-
* @param {number} width -
|
|
3496
|
-
* @param {number} height -
|
|
3511
|
+
* Set the maximum size of the window
|
|
3512
|
+
* @param {number} width - Maximum width
|
|
3513
|
+
* @param {number} height - Maximum height
|
|
3497
3514
|
*/
|
|
3498
3515
|
setMaximumSize: (width: number, height: number) => Promise<void>;
|
|
3499
3516
|
/**
|
|
3500
|
-
*
|
|
3501
|
-
* @param {number} width -
|
|
3502
|
-
* @param {number} height -
|
|
3517
|
+
* Set the minimum size of the window
|
|
3518
|
+
* @param {number} width - Maximum width
|
|
3519
|
+
* @param {number} height - Maximum height
|
|
3503
3520
|
*/
|
|
3504
3521
|
setMinimumSize: (width: number, height: number) => Promise<void>;
|
|
3505
3522
|
/**
|
|
3506
|
-
*
|
|
3507
|
-
* @param level number -
|
|
3523
|
+
* Change the zoom level. Original size is 0, each increment or decrement represents a 20% zoom. The default upper and lower limits are 300% and 50%. The zoom formula is scale := 1.2 ^ level.
|
|
3524
|
+
* @param level number - Zoom level, default is 0
|
|
3508
3525
|
*/
|
|
3509
3526
|
setZoomLevel: (level: number) => Promise<void>;
|
|
3510
3527
|
/**
|
|
3511
|
-
*
|
|
3512
|
-
* @param factor Double -
|
|
3513
|
-
* @remarks
|
|
3528
|
+
* Change zoom factor. The zoom factor is the zoom percentage divided by 100, i.e., 300% = 3.0
|
|
3529
|
+
* @param factor Double - Zoom factor, default is 1.0
|
|
3530
|
+
* @remarks The factor must be greater than 0.0
|
|
3514
3531
|
*/
|
|
3515
3532
|
setZoomFactor: (factor: number) => Promise<void>;
|
|
3516
3533
|
/**
|
|
@@ -3739,36 +3756,36 @@ declare const LogApi: ILogApi;
|
|
|
3739
3756
|
declare const MouseApi: IMouseApi;
|
|
3740
3757
|
|
|
3741
3758
|
/**
|
|
3742
|
-
* NotificationApi
|
|
3759
|
+
* NotificationApi provides the ability to send notifications
|
|
3743
3760
|
*/
|
|
3744
3761
|
interface INotificationApi {
|
|
3745
3762
|
/**
|
|
3746
|
-
*
|
|
3763
|
+
* Send custom notification
|
|
3747
3764
|
* @param notification
|
|
3748
3765
|
*/
|
|
3749
3766
|
send: (notification: AppNotification) => Promise<void>;
|
|
3750
3767
|
/**
|
|
3751
|
-
*
|
|
3768
|
+
* Hide notification
|
|
3752
3769
|
*/
|
|
3753
3770
|
hide: () => Promise<void>;
|
|
3754
3771
|
/**
|
|
3755
3772
|
* @param message string
|
|
3756
|
-
* @param duration number
|
|
3773
|
+
* @param duration number Duration in milliseconds, default 5000
|
|
3757
3774
|
*/
|
|
3758
3775
|
success: (message: string, duration?: number) => Promise<void>;
|
|
3759
3776
|
/**
|
|
3760
3777
|
* @param message string
|
|
3761
|
-
* @param duration number
|
|
3778
|
+
* @param duration number Duration in milliseconds, default 5000
|
|
3762
3779
|
*/
|
|
3763
3780
|
error: (message: string, duration?: number) => Promise<void>;
|
|
3764
3781
|
/**
|
|
3765
3782
|
* @param message string
|
|
3766
|
-
* @param duration number
|
|
3783
|
+
* @param duration number Duration in milliseconds, default 5000
|
|
3767
3784
|
*/
|
|
3768
3785
|
warning: (message: string, duration?: number) => Promise<void>;
|
|
3769
3786
|
/**
|
|
3770
3787
|
* @param message string
|
|
3771
|
-
* @param duration number
|
|
3788
|
+
* @param duration number Duration in milliseconds, default 5000
|
|
3772
3789
|
*/
|
|
3773
3790
|
info: (message: string, duration?: number) => Promise<void>;
|
|
3774
3791
|
reminder: (option: ReminderNotificationOption) => Promise<void>;
|
|
@@ -3810,53 +3827,53 @@ declare const ProcessApi: IProcessApi;
|
|
|
3810
3827
|
|
|
3811
3828
|
type BaseType = string | number | boolean;
|
|
3812
3829
|
/**
|
|
3813
|
-
* StorageApi
|
|
3830
|
+
* StorageApi interface defines methods for storing and retrieving data, including encryption and decryption functions.
|
|
3814
3831
|
*/
|
|
3815
3832
|
interface IStorageApi {
|
|
3816
3833
|
/**
|
|
3817
|
-
*
|
|
3818
|
-
* @param key
|
|
3819
|
-
* @param defaultValue
|
|
3834
|
+
* Get value from storage.
|
|
3835
|
+
* @param key Key name
|
|
3836
|
+
* @param defaultValue Optional, default value
|
|
3820
3837
|
*/
|
|
3821
3838
|
get: <T extends BaseType>(key: string, defaultValue?: T) => Promise<T | null>;
|
|
3822
3839
|
/**
|
|
3823
|
-
*
|
|
3824
|
-
* @param key
|
|
3825
|
-
* @param value
|
|
3840
|
+
* Set value in storage.
|
|
3841
|
+
* @param key Key name
|
|
3842
|
+
* @param value Value to store, can be BaseType or object
|
|
3826
3843
|
*/
|
|
3827
3844
|
set: (key: string, value: BaseType | object) => Promise<string>;
|
|
3828
3845
|
/**
|
|
3829
|
-
*
|
|
3830
|
-
* @param key
|
|
3831
|
-
* @param defaultValue
|
|
3846
|
+
* Get object value from storage.
|
|
3847
|
+
* @param key Key name
|
|
3848
|
+
* @param defaultValue Optional, default value
|
|
3832
3849
|
*/
|
|
3833
3850
|
getObject: <T>(key: string, defaultValue?: T) => Promise<T | undefined>;
|
|
3834
3851
|
/**
|
|
3835
|
-
*
|
|
3836
|
-
* @param key
|
|
3852
|
+
* Delete value from storage.
|
|
3853
|
+
* @param key Key name
|
|
3837
3854
|
*/
|
|
3838
3855
|
delete: (key: string) => Promise<void>;
|
|
3839
3856
|
/**
|
|
3840
|
-
*
|
|
3841
|
-
* @param value
|
|
3857
|
+
* Encrypt a string with the encryption key generated by [DPAPI](https://learn.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectdata). According to Windows documentation: "Typically, only a user with the same logon credential as the user who encrypted the data can decrypt the data". Therefore, the content is protected from other users on the same computer, but not from other applications running in the same user space.
|
|
3858
|
+
* @param value String to encrypt
|
|
3842
3859
|
* @see [Safe Storage](https://www.electronjs.org/docs/latest/api/safe-storage)
|
|
3843
3860
|
*/
|
|
3844
3861
|
encryptString: (value: string) => Promise<string>;
|
|
3845
3862
|
/**
|
|
3846
|
-
*
|
|
3847
|
-
* @param value
|
|
3863
|
+
* Decrypt the encrypted string.
|
|
3864
|
+
* @param value String to decrypt
|
|
3848
3865
|
*/
|
|
3849
3866
|
decryptString: (value: string) => Promise<string>;
|
|
3850
3867
|
/**
|
|
3851
|
-
*
|
|
3852
|
-
* @param key
|
|
3853
|
-
* @param value
|
|
3868
|
+
* Encrypt string and store.
|
|
3869
|
+
* @param key Key name
|
|
3870
|
+
* @param value String to encrypt and store
|
|
3854
3871
|
*/
|
|
3855
3872
|
encryptSet: (key: string, value: string) => Promise<string>;
|
|
3856
3873
|
/**
|
|
3857
|
-
*
|
|
3858
|
-
* @param key
|
|
3859
|
-
* @param defaultValue
|
|
3874
|
+
* Get string value from encrypted storage.
|
|
3875
|
+
* @param key Key name
|
|
3876
|
+
* @param defaultValue Optional, default value
|
|
3860
3877
|
*/
|
|
3861
3878
|
decryptGet: (key: string, defaultValue?: string) => Promise<string | undefined>;
|
|
3862
3879
|
}
|