@widget-js/core 24.1.1-beta.1 → 24.1.1-beta.2
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 +196 -256
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +91 -89
- package/dist/index.js +195 -255
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -239,6 +239,10 @@ interface IWidgetOptions extends IWindowSize, IPageOptions {
|
|
|
239
239
|
*/
|
|
240
240
|
socialLinks?: SocialLink[];
|
|
241
241
|
}
|
|
242
|
+
interface IBackgroundWidgetOptions extends Omit<IWidgetOptions, 'width' | 'height'> {
|
|
243
|
+
width?: number;
|
|
244
|
+
height?: number;
|
|
245
|
+
}
|
|
242
246
|
/**
|
|
243
247
|
* @deprecated
|
|
244
248
|
*/
|
|
@@ -272,6 +276,9 @@ declare class Widget extends Page {
|
|
|
272
276
|
isSupportNormal(): boolean;
|
|
273
277
|
isConfigurable(): boolean;
|
|
274
278
|
}
|
|
279
|
+
declare class BackgroundWidget extends Widget {
|
|
280
|
+
constructor(options: IBackgroundWidgetOptions);
|
|
281
|
+
}
|
|
275
282
|
declare enum WidgetKeyword {
|
|
276
283
|
RECOMMEND = "recommend",
|
|
277
284
|
TOOLS = "tools",
|
|
@@ -314,7 +321,6 @@ interface WidgetPackageOptions extends LocalPackageUrlInfo {
|
|
|
314
321
|
description: LanguageTextMap;
|
|
315
322
|
/**
|
|
316
323
|
* 远程组件包入口文件
|
|
317
|
-
* @deprecated 使用 remote.entry 替代
|
|
318
324
|
*/
|
|
319
325
|
remoteEntry?: string;
|
|
320
326
|
remotePackage?: string;
|
|
@@ -322,7 +328,12 @@ interface WidgetPackageOptions extends LocalPackageUrlInfo {
|
|
|
322
328
|
icon?: string;
|
|
323
329
|
lang?: LanguageCode;
|
|
324
330
|
widgets?: Widget[];
|
|
331
|
+
/**
|
|
332
|
+
* 是否处于开发模式
|
|
333
|
+
*/
|
|
334
|
+
development?: boolean;
|
|
325
335
|
devOptions?: DevOptions;
|
|
336
|
+
requiredAppVersion?: string;
|
|
326
337
|
}
|
|
327
338
|
declare class WidgetPackage implements RemotePackageUrlInfo {
|
|
328
339
|
/**
|
|
@@ -334,10 +345,15 @@ declare class WidgetPackage implements RemotePackageUrlInfo {
|
|
|
334
345
|
* e.g. 1.0.2
|
|
335
346
|
*/
|
|
336
347
|
version?: string;
|
|
348
|
+
/**
|
|
349
|
+
* 组件包所需的App版本
|
|
350
|
+
*/
|
|
351
|
+
requiredAppVersion?: string;
|
|
337
352
|
/**
|
|
338
353
|
* 组件作者署名
|
|
339
354
|
*/
|
|
340
355
|
readonly author: string;
|
|
356
|
+
development?: boolean;
|
|
341
357
|
/**
|
|
342
358
|
* 组件首页
|
|
343
359
|
*/
|
|
@@ -360,7 +376,6 @@ declare class WidgetPackage implements RemotePackageUrlInfo {
|
|
|
360
376
|
entry: string | 'index.html';
|
|
361
377
|
/**
|
|
362
378
|
* 远程组件包入口文件
|
|
363
|
-
* @deprecated 使用 remote.entry 替代
|
|
364
379
|
*/
|
|
365
380
|
remoteEntry?: string;
|
|
366
381
|
/**
|
|
@@ -401,16 +416,6 @@ declare class WidgetPackage implements RemotePackageUrlInfo {
|
|
|
401
416
|
* @param lang 语言环境,不传则获取默认标题
|
|
402
417
|
*/
|
|
403
418
|
getDescription(lang?: LanguageCode): string | undefined;
|
|
404
|
-
/**
|
|
405
|
-
* 获取组件完整路径
|
|
406
|
-
* 如果url是http链接,直接返回链接
|
|
407
|
-
* 如果是本地组件:file://链接,则返回 url+entry,
|
|
408
|
-
* 如果是远程组件:http://链接,则返回 entry,
|
|
409
|
-
* @example file://C:/users/neo/desktop/index.html#
|
|
410
|
-
* @example file://C:/users/neo/desktop/index.html#
|
|
411
|
-
*/
|
|
412
|
-
getIndexUrl(hash?: boolean): string;
|
|
413
|
-
getUrl(path: string, hash?: boolean): string;
|
|
414
419
|
}
|
|
415
420
|
interface DevOptions {
|
|
416
421
|
folder?: string;
|
|
@@ -419,67 +424,6 @@ interface DevOptions {
|
|
|
419
424
|
remoteEntry?: string;
|
|
420
425
|
}
|
|
421
426
|
|
|
422
|
-
declare class WidgetParams {
|
|
423
|
-
static readonly PARAM_PREFIX = "w_";
|
|
424
|
-
static readonly PARAM_ID = "id";
|
|
425
|
-
static readonly PARAM_WIDTH = "width";
|
|
426
|
-
static readonly PARAM_HEIGHT = "height";
|
|
427
|
-
static readonly PARAM_WIDTH_PX = "width_px";
|
|
428
|
-
static readonly PARAM_HEIGHT_PX = "height_px";
|
|
429
|
-
static readonly PARAM_X = "x";
|
|
430
|
-
static readonly PARAM_Y = "y";
|
|
431
|
-
static readonly PARAM_LANG = "lang";
|
|
432
|
-
static readonly PARAM_THEME = "theme";
|
|
433
|
-
static readonly PARAM_MODE = "mode";
|
|
434
|
-
static readonly PARAM_RADIUS = "radius";
|
|
435
|
-
static readonly PARAM_NAME = "name";
|
|
436
|
-
static readonly PARAM_TITLE = "title";
|
|
437
|
-
static readonly PARAM_PREVIEW = "preview";
|
|
438
|
-
static readonly PARAMS: string[];
|
|
439
|
-
id?: string;
|
|
440
|
-
width?: number;
|
|
441
|
-
widthPx?: number;
|
|
442
|
-
heightPx?: number;
|
|
443
|
-
height?: number;
|
|
444
|
-
x?: number;
|
|
445
|
-
y?: number;
|
|
446
|
-
preview?: boolean;
|
|
447
|
-
lang?: string;
|
|
448
|
-
theme?: ThemeMode;
|
|
449
|
-
mode?: DeployMode;
|
|
450
|
-
radius?: number;
|
|
451
|
-
name?: string;
|
|
452
|
-
title?: string;
|
|
453
|
-
/**
|
|
454
|
-
* 将组件参数转为url参数
|
|
455
|
-
* @param object
|
|
456
|
-
* @return URLSearchParams w_w=2&w_h=2&w_id=21&w_width=156&w_height=156
|
|
457
|
-
*/
|
|
458
|
-
toUrlParams(): URLSearchParams;
|
|
459
|
-
getPersistKey(): string;
|
|
460
|
-
/**
|
|
461
|
-
* 从当前地址解析组件参数:
|
|
462
|
-
* http://localhost:8080/#/widget/config/labor_progress?w_w=2&w_h=2&w_width=156&w_height=156
|
|
463
|
-
* =>
|
|
464
|
-
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
465
|
-
*/
|
|
466
|
-
static fromCurrentLocation(): WidgetParams;
|
|
467
|
-
static fromLocation(url: string): WidgetParams;
|
|
468
|
-
private static setValue;
|
|
469
|
-
/**
|
|
470
|
-
* 从对象键值对中初始化组件参数
|
|
471
|
-
* {w_width:2,w_height:2,w_id:21,w_width_px:156,w_height_px:156}=>
|
|
472
|
-
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
473
|
-
* @param object
|
|
474
|
-
*/
|
|
475
|
-
static fromObject(object: any): WidgetParams;
|
|
476
|
-
}
|
|
477
|
-
declare enum ThemeMode {
|
|
478
|
-
AUTO = "auto",
|
|
479
|
-
LIGHT = "LIGHT",
|
|
480
|
-
DARK = "DARK"
|
|
481
|
-
}
|
|
482
|
-
|
|
483
427
|
declare abstract class BaseApi<T extends string> {
|
|
484
428
|
abstract getChannel(): string;
|
|
485
429
|
protected invokeMethod(method: T, ...args: any[]): Promise<any>;
|
|
@@ -493,9 +437,6 @@ interface IWidgetApi {
|
|
|
493
437
|
getWidget(name: string): Promise<Widget>;
|
|
494
438
|
getWidgetPackage(name: string): Promise<WidgetPackage>;
|
|
495
439
|
getWidgetPackages(): Promise<WidgetPackage[]>;
|
|
496
|
-
getWidgetUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
|
|
497
|
-
getWidgetPackageIndexUrl(packageName: string, hash?: boolean): Promise<string | null>;
|
|
498
|
-
getWidgetConfigUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
|
|
499
440
|
openConfigPage(id: string): Promise<void>;
|
|
500
441
|
openConfigPageByName(name: string): Promise<void>;
|
|
501
442
|
reload(): Promise<void>;
|
|
@@ -525,13 +466,6 @@ declare class WidgetApiImpl extends BaseApi<WidgetApiMethods> implements IWidget
|
|
|
525
466
|
* @param name package name
|
|
526
467
|
*/
|
|
527
468
|
getWidgetPackage(name: string): Promise<WidgetPackage>;
|
|
528
|
-
/**
|
|
529
|
-
* 获取组件配置地址
|
|
530
|
-
* @param widgetName
|
|
531
|
-
*/
|
|
532
|
-
getWidgetConfigUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
|
|
533
|
-
getWidgetUrl(widgetName: string, widgetParams: WidgetParams): Promise<string | null>;
|
|
534
|
-
getWidgetPackageIndexUrl(packageName: string, hash?: boolean): Promise<string | null>;
|
|
535
469
|
getWidgetPackageUrl(packageName: string): Promise<string | null>;
|
|
536
470
|
}
|
|
537
471
|
declare const WidgetApi: WidgetApiImpl;
|
|
@@ -668,6 +602,67 @@ declare class WidgetData {
|
|
|
668
602
|
injectThemeProperties(): void;
|
|
669
603
|
}
|
|
670
604
|
|
|
605
|
+
declare class WidgetParams {
|
|
606
|
+
static readonly PARAM_PREFIX = "w_";
|
|
607
|
+
static readonly PARAM_ID = "id";
|
|
608
|
+
static readonly PARAM_WIDTH = "width";
|
|
609
|
+
static readonly PARAM_HEIGHT = "height";
|
|
610
|
+
static readonly PARAM_WIDTH_PX = "width_px";
|
|
611
|
+
static readonly PARAM_HEIGHT_PX = "height_px";
|
|
612
|
+
static readonly PARAM_X = "x";
|
|
613
|
+
static readonly PARAM_Y = "y";
|
|
614
|
+
static readonly PARAM_LANG = "lang";
|
|
615
|
+
static readonly PARAM_THEME = "theme";
|
|
616
|
+
static readonly PARAM_MODE = "mode";
|
|
617
|
+
static readonly PARAM_RADIUS = "radius";
|
|
618
|
+
static readonly PARAM_NAME = "name";
|
|
619
|
+
static readonly PARAM_TITLE = "title";
|
|
620
|
+
static readonly PARAM_PREVIEW = "preview";
|
|
621
|
+
static readonly PARAMS: string[];
|
|
622
|
+
id?: string;
|
|
623
|
+
width?: number;
|
|
624
|
+
widthPx?: number;
|
|
625
|
+
heightPx?: number;
|
|
626
|
+
height?: number;
|
|
627
|
+
x?: number;
|
|
628
|
+
y?: number;
|
|
629
|
+
preview?: boolean;
|
|
630
|
+
lang?: string;
|
|
631
|
+
theme?: ThemeMode;
|
|
632
|
+
mode?: DeployMode;
|
|
633
|
+
radius?: number;
|
|
634
|
+
name?: string;
|
|
635
|
+
title?: string;
|
|
636
|
+
/**
|
|
637
|
+
* 将组件参数转为url参数
|
|
638
|
+
* @param object
|
|
639
|
+
* @return URLSearchParams w_w=2&w_h=2&w_id=21&w_width=156&w_height=156
|
|
640
|
+
*/
|
|
641
|
+
toUrlParams(): URLSearchParams;
|
|
642
|
+
getPersistKey(): string;
|
|
643
|
+
/**
|
|
644
|
+
* 从当前地址解析组件参数:
|
|
645
|
+
* http://localhost:8080/#/widget/config/labor_progress?w_w=2&w_h=2&w_width=156&w_height=156
|
|
646
|
+
* =>
|
|
647
|
+
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
648
|
+
*/
|
|
649
|
+
static fromCurrentLocation(): WidgetParams;
|
|
650
|
+
static fromLocation(url: string): WidgetParams;
|
|
651
|
+
private static setValue;
|
|
652
|
+
/**
|
|
653
|
+
* 从对象键值对中初始化组件参数
|
|
654
|
+
* {w_width:2,w_height:2,w_id:21,w_width_px:156,w_height_px:156}=>
|
|
655
|
+
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
656
|
+
* @param object
|
|
657
|
+
*/
|
|
658
|
+
static fromObject(object: any): WidgetParams;
|
|
659
|
+
}
|
|
660
|
+
declare enum ThemeMode {
|
|
661
|
+
AUTO = "auto",
|
|
662
|
+
LIGHT = "LIGHT",
|
|
663
|
+
DARK = "DARK"
|
|
664
|
+
}
|
|
665
|
+
|
|
671
666
|
type NotificationType = 'countdown' | 'advance-countdown' | 'error' | 'success' | 'warning' | 'info' | 'reminder' | 'url' | 'call';
|
|
672
667
|
declare enum NotificationSize {
|
|
673
668
|
SMALL = "small",
|
|
@@ -813,11 +808,6 @@ declare class ElectronUtils {
|
|
|
813
808
|
static invoke(channel: string, ...args: any[]): Promise<any>;
|
|
814
809
|
}
|
|
815
810
|
|
|
816
|
-
declare class WidgetUrlUtils {
|
|
817
|
-
static getWidgetUrl(widgetUrl: string, widgetPackage: WidgetPackage, widgetParams: WidgetParams): string;
|
|
818
|
-
static getWidgetPackageUrl(url: string, entry: string, hash: boolean, path?: string): string;
|
|
819
|
-
}
|
|
820
|
-
|
|
821
811
|
/**
|
|
822
812
|
* 根据语言环境获取文本
|
|
823
813
|
* @param langMap 对象
|
|
@@ -1237,6 +1227,7 @@ declare class ElectronApi {
|
|
|
1237
1227
|
interface SaveWidgetOption {
|
|
1238
1228
|
sendBroadcast?: boolean;
|
|
1239
1229
|
id?: string;
|
|
1230
|
+
storeName?: string;
|
|
1240
1231
|
}
|
|
1241
1232
|
/**
|
|
1242
1233
|
* 用户处理浏览器数据,只在浏览器环境下有用
|
|
@@ -1274,6 +1265,7 @@ interface IBrowserWindowApi {
|
|
|
1274
1265
|
restore(): Promise<void>;
|
|
1275
1266
|
isMinimized(): Promise<boolean>;
|
|
1276
1267
|
isMaximized(): Promise<boolean>;
|
|
1268
|
+
isVisible(): Promise<boolean>;
|
|
1277
1269
|
maximize(): Promise<void>;
|
|
1278
1270
|
stopDraggingWindow(): Promise<void>;
|
|
1279
1271
|
setAlwaysOnTop(alwaysOnTop: boolean): Promise<void>;
|
|
@@ -1302,6 +1294,12 @@ interface IBrowserWindowApi {
|
|
|
1302
1294
|
setZoomFactor(factor: number): Promise<void>;
|
|
1303
1295
|
setProxy(config: Electron.Config): Promise<void>;
|
|
1304
1296
|
isFocused(): Promise<boolean>;
|
|
1297
|
+
/**
|
|
1298
|
+
* A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.
|
|
1299
|
+
* The window should not be activated through programmatic access or via keyboard navigation by accessible technology, such as Narrator.
|
|
1300
|
+
* @see https://learn.microsoft.com/en-us/windows/win32/winmsg/extended-window-styles
|
|
1301
|
+
*/
|
|
1302
|
+
setNoActivate(): Promise<void>;
|
|
1305
1303
|
}
|
|
1306
1304
|
type BrowserWindowApiMethods = keyof IBrowserWindowApi;
|
|
1307
1305
|
type AlignPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
@@ -1338,6 +1336,8 @@ interface SetupOptions {
|
|
|
1338
1336
|
alwaysOnTop?: boolean;
|
|
1339
1337
|
}
|
|
1340
1338
|
declare class BrowserWindowApiImpl extends BaseApi<BrowserWindowApiMethods> implements IBrowserWindowApi {
|
|
1339
|
+
setNoActivate(): Promise<void>;
|
|
1340
|
+
isVisible(): Promise<boolean>;
|
|
1341
1341
|
getChannel(): string;
|
|
1342
1342
|
setIgnoreMouseEvent(ignore: boolean): Promise<void>;
|
|
1343
1343
|
show(): Promise<void>;
|
|
@@ -1478,6 +1478,7 @@ declare const DeployedWidgetApi: DeployedWidgetApiImpl;
|
|
|
1478
1478
|
|
|
1479
1479
|
interface IDeviceApi {
|
|
1480
1480
|
getCursorScreenPoint(): Promise<Point>;
|
|
1481
|
+
sendCtrlV(): Promise<void>;
|
|
1481
1482
|
isAllKeyReleased(): Promise<boolean>;
|
|
1482
1483
|
}
|
|
1483
1484
|
type DeviceApiMethods = keyof IDeviceApi;
|
|
@@ -1506,6 +1507,7 @@ declare enum Channel {
|
|
|
1506
1507
|
interface IClipboardApi {
|
|
1507
1508
|
getSelectedText(): Promise<string | undefined>;
|
|
1508
1509
|
getText(): Promise<string | undefined>;
|
|
1510
|
+
writeText(text: string): Promise<void>;
|
|
1509
1511
|
}
|
|
1510
1512
|
type ClipboardApiMethods = keyof IClipboardApi;
|
|
1511
1513
|
declare enum ClipboardApiEvent {
|
|
@@ -1728,4 +1730,4 @@ declare enum SystemApiEvent {
|
|
|
1728
1730
|
DATE_CHANGED = "event::cn.widgetjs.core.sys.date.changed"
|
|
1729
1731
|
}
|
|
1730
1732
|
|
|
1731
|
-
export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DefaultWidgetTheme, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, DownloadUrlOptions, ElectronApi, ElectronUtils, FileApi, FileApiMethods, FileInfo, Gravity, GridRect, GridSystem, HostedMode, IGridRect, IPage, IPageOptions, IWidgetDataApi, IWidgetOptions, IWindowSize, LanguageCode, LanguageTextMap, LocalPackageUrlInfo, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, LogApi, LogApiMethods, MetaInfo, Metadata, NativeKeyboardEvent, NormalizeOptions, NotificationApi, NotificationApiEvent, NotificationApiMethods, NotificationOption, NotificationSize, NotificationType, OpenUrlOptions, Page, Point, Position, ProcessApi, ProcessApiMethods, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, SystemApiEvent, SystemFile, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetTheme, WidgetThemeKey,
|
|
1733
|
+
export { AlignPosition, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppApiMethods, AppMouseEvent, AppNotification, BackgroundWidget, BaseApi, BroadcastApi, BroadcastApiMethods, BroadcastEvent, BroadcastEventType, BrowserWindowApi, BrowserWindowApiEvent, BrowserWindowApiMethods, Channel, ClipboardApi, ClipboardApiEvent, ClipboardApiMethods, DefaultWidgetTheme, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeployedWidgetApiMethods, DevOptions, DeviceApi, DeviceApiMethods, DialogApi, DialogApiMethods, DownloadUrlOptions, ElectronApi, ElectronUtils, FileApi, FileApiMethods, FileInfo, Gravity, GridRect, GridSystem, HostedMode, IBackgroundWidgetOptions, IGridRect, IPage, IPageOptions, IWidgetDataApi, IWidgetOptions, IWindowSize, LanguageCode, LanguageTextMap, LocalPackageUrlInfo, LocationQuery, LocationQueryRaw, LocationQueryValue, LocationQueryValueRaw, LogApi, LogApiMethods, MetaInfo, Metadata, NativeKeyboardEvent, NormalizeOptions, NotificationApi, NotificationApiEvent, NotificationApiMethods, NotificationOption, NotificationSize, NotificationType, OpenUrlOptions, Page, Point, Position, ProcessApi, ProcessApiMethods, ReadDirOptions, Rectangle, RemotePackageUrlInfo, SaveWidgetOption, SetPositionOptions, ShortcutApi, ShortcutApiEvent, ShortcutApiMethods, StoreApi, StoreApiMethods, SystemApiEvent, SystemFile, ThemeMode, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetApiMethods, WidgetData, WidgetDataApi, WidgetDataApiMethods, WidgetKeyword, WidgetPackage, WidgetPackageOptions, WidgetParams, WidgetPermission, WidgetRoute, WidgetTheme, WidgetThemeKey, getTextByLanguageCode, normalizeUrl, parseQuery, stringifyQuery };
|