@widget-js/core 0.1.6 → 0.1.9
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/LICENSE +21 -21
- package/dist/cjs/api/ApiConstants.js +8 -8
- package/dist/cjs/api/AppApi.js +31 -31
- package/dist/cjs/api/BroadcastApi.js +20 -20
- package/dist/cjs/api/BrowserWindowApi.js +42 -24
- package/dist/cjs/api/Channel.js +11 -11
- package/dist/cjs/api/ElectronApi.js +13 -13
- package/dist/cjs/api/NotificationApi.js +83 -83
- package/dist/cjs/api/WidgetApi.js +58 -49
- package/dist/cjs/index.js +35 -34
- package/dist/cjs/model/HostedMode.js +14 -0
- package/dist/cjs/model/Notification.js +15 -15
- package/dist/cjs/model/SocialInfo.js +10 -10
- package/dist/cjs/model/Widget.js +79 -79
- package/dist/cjs/model/WidgetData.js +16 -16
- package/dist/cjs/model/WidgetPackage.js +21 -6
- package/dist/cjs/model/WidgetParams.js +139 -144
- package/dist/cjs/model/event/BroadcastEvent.js +14 -14
- package/dist/cjs/model/event/WebSocketEvent.js +14 -14
- package/dist/cjs/model/interface/IHostedWidget.js +2 -0
- package/dist/cjs/repository/WidgetDataRepository.js +71 -71
- package/dist/cjs/router/encoding.js +144 -144
- package/dist/cjs/router/query.js +84 -84
- package/dist/cjs/utils/ElectronUtils.js +24 -24
- package/dist/esm/api/ApiConstants.js +4 -4
- package/dist/esm/api/AppApi.js +27 -27
- package/dist/esm/api/BroadcastApi.js +16 -16
- package/dist/esm/api/BrowserWindowApi.js +38 -20
- package/dist/esm/api/Channel.js +8 -8
- package/dist/esm/api/ElectronApi.js +9 -9
- package/dist/esm/api/NotificationApi.js +79 -79
- package/dist/esm/api/WidgetApi.js +54 -45
- package/dist/esm/index.js +19 -18
- package/dist/esm/model/HostedMode.js +11 -0
- package/dist/esm/model/Notification.js +11 -11
- package/dist/esm/model/SocialInfo.js +6 -6
- package/dist/esm/model/Widget.js +75 -75
- package/dist/esm/model/WidgetData.js +12 -12
- package/dist/esm/model/WidgetPackage.js +17 -2
- package/dist/esm/model/WidgetParams.js +135 -140
- package/dist/esm/model/event/BroadcastEvent.js +10 -10
- package/dist/esm/model/event/WebSocketEvent.js +10 -10
- package/dist/esm/model/interface/IHostedWidget.js +1 -0
- package/dist/esm/repository/WidgetDataRepository.js +64 -64
- package/dist/esm/router/encoding.js +135 -135
- package/dist/esm/router/query.js +79 -79
- package/dist/esm/utils/ElectronUtils.js +20 -20
- package/dist/types/api/ApiConstants.d.ts +4 -4
- package/dist/types/api/AppApi.d.ts +10 -10
- package/dist/types/api/BroadcastApi.d.ts +6 -6
- package/dist/types/api/BrowserWindowApi.d.ts +27 -10
- package/dist/types/api/Channel.d.ts +7 -7
- package/dist/types/api/ElectronApi.d.ts +4 -4
- package/dist/types/api/NotificationApi.d.ts +14 -14
- package/dist/types/api/WidgetApi.d.ts +30 -24
- package/dist/types/index.d.ts +19 -18
- package/dist/types/model/HostedMode.d.ts +10 -0
- package/dist/types/model/Notification.d.ts +16 -16
- package/dist/types/model/SocialInfo.d.ts +6 -6
- package/dist/types/model/Widget.d.ts +96 -85
- package/dist/types/model/WidgetData.d.ts +35 -35
- package/dist/types/model/WidgetPackage.d.ts +43 -41
- package/dist/types/model/WidgetParams.d.ts +60 -63
- package/dist/types/model/event/BroadcastEvent.d.ts +12 -12
- package/dist/types/model/event/WebSocketEvent.d.ts +8 -8
- package/dist/types/model/interface/IHostedWidget.d.ts +13 -0
- package/dist/types/repository/WidgetDataRepository.d.ts +26 -26
- package/dist/types/router/encoding.d.ts +62 -62
- package/dist/types/router/query.d.ts +53 -53
- package/dist/types/utils/ElectronUtils.d.ts +8 -8
- package/dist/umd/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,24 +1,30 @@
|
|
|
1
|
-
import { Widget } from "../model/Widget";
|
|
2
|
-
import { WidgetPackage } from "../model/WidgetPackage";
|
|
3
|
-
export declare class WidgetApi {
|
|
4
|
-
static readonly REGISTER_WIDGETS = "register-widgets";
|
|
5
|
-
static readonly REGISTER_WIDGET_PACKAGE = "register-widget-package";
|
|
6
|
-
static readonly GET_WIDGETS = "get-widgets";
|
|
7
|
-
static readonly GET_WIDGET = "get-widget";
|
|
8
|
-
static readonly GET_WIDGET_PACKAGE = "get-widget-package";
|
|
9
|
-
static readonly GET_WIDGET_PACKAGES = "get-widget-packages";
|
|
10
|
-
static
|
|
11
|
-
static
|
|
12
|
-
static
|
|
13
|
-
static
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
import { Widget } from "../model/Widget";
|
|
2
|
+
import { WidgetPackage } from "../model/WidgetPackage";
|
|
3
|
+
export declare class WidgetApi {
|
|
4
|
+
static readonly REGISTER_WIDGETS = "register-widgets";
|
|
5
|
+
static readonly REGISTER_WIDGET_PACKAGE = "register-widget-package";
|
|
6
|
+
static readonly GET_WIDGETS = "get-widgets";
|
|
7
|
+
static readonly GET_WIDGET = "get-widget";
|
|
8
|
+
static readonly GET_WIDGET_PACKAGE = "get-widget-package";
|
|
9
|
+
static readonly GET_WIDGET_PACKAGES = "get-widget-packages";
|
|
10
|
+
static readonly REMOVE_HOSTED_WIDGET = "remove-hosted-widget";
|
|
11
|
+
static registerWidgets(widgets: Widget[]): Promise<void>;
|
|
12
|
+
static registerWidgetPackage(widgetPackage: WidgetPackage): Promise<void>;
|
|
13
|
+
static getWidgets(): Promise<Widget[]>;
|
|
14
|
+
static getWidgetPackages(): Promise<WidgetPackage>;
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param name package name
|
|
18
|
+
*/
|
|
19
|
+
static getWidget(name: string): Promise<Widget>;
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
* @param name package name
|
|
23
|
+
*/
|
|
24
|
+
static getWidgetPackage(name: string): Promise<WidgetPackage>;
|
|
25
|
+
/**
|
|
26
|
+
* 移除组件
|
|
27
|
+
* @param id
|
|
28
|
+
*/
|
|
29
|
+
static removeHostedWidget(id: string): Promise<any>;
|
|
30
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
export * from "./model/Widget";
|
|
2
|
-
export * from "./model/event/BroadcastEvent";
|
|
3
|
-
export * from "./model/event/WebSocketEvent";
|
|
4
|
-
export * from "./model/WidgetData";
|
|
5
|
-
export * from "./model/WidgetParams";
|
|
6
|
-
export * from "./model/Notification";
|
|
7
|
-
export * from "./model/
|
|
8
|
-
export * from "./
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./api/
|
|
12
|
-
export * from "./api/
|
|
13
|
-
export * from "./api/
|
|
14
|
-
export * from "./api/
|
|
15
|
-
export * from "./api/
|
|
16
|
-
export * from "./api/
|
|
17
|
-
export * from "./
|
|
18
|
-
export * from "./
|
|
1
|
+
export * from "./model/Widget";
|
|
2
|
+
export * from "./model/event/BroadcastEvent";
|
|
3
|
+
export * from "./model/event/WebSocketEvent";
|
|
4
|
+
export * from "./model/WidgetData";
|
|
5
|
+
export * from "./model/WidgetParams";
|
|
6
|
+
export * from "./model/Notification";
|
|
7
|
+
export * from "./model/HostedMode";
|
|
8
|
+
export * from "./model/WidgetPackage";
|
|
9
|
+
export * from "./api/ElectronApi";
|
|
10
|
+
export * from "./repository/WidgetDataRepository";
|
|
11
|
+
export * from "./api/BrowserWindowApi";
|
|
12
|
+
export * from "./api/NotificationApi";
|
|
13
|
+
export * from "./api/Channel";
|
|
14
|
+
export * from "./api/WidgetApi";
|
|
15
|
+
export * from "./api/ApiConstants";
|
|
16
|
+
export * from "./api/BroadcastApi";
|
|
17
|
+
export * from "./api/AppApi";
|
|
18
|
+
export * from "./utils/ElectronUtils";
|
|
19
|
+
export * from "./router/query";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export type NotificationType = "call" | "message" | "countdown" | "advance-countdown" | "error" | "success" | "warning" | "info";
|
|
2
|
-
export type NotificationOption = {
|
|
3
|
-
type?: NotificationType;
|
|
4
|
-
title?: string;
|
|
5
|
-
message: string;
|
|
6
|
-
targetTime?: string;
|
|
7
|
-
duration?: number;
|
|
8
|
-
};
|
|
9
|
-
export declare class Notification {
|
|
10
|
-
type: NotificationType;
|
|
11
|
-
message: string;
|
|
12
|
-
title?: string;
|
|
13
|
-
targetTime?: string;
|
|
14
|
-
duration: number;
|
|
15
|
-
constructor(option: NotificationOption);
|
|
16
|
-
}
|
|
1
|
+
export type NotificationType = "call" | "message" | "countdown" | "advance-countdown" | "error" | "success" | "warning" | "info";
|
|
2
|
+
export type NotificationOption = {
|
|
3
|
+
type?: NotificationType;
|
|
4
|
+
title?: string;
|
|
5
|
+
message: string;
|
|
6
|
+
targetTime?: string;
|
|
7
|
+
duration?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare class Notification {
|
|
10
|
+
type: NotificationType;
|
|
11
|
+
message: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
targetTime?: string;
|
|
14
|
+
duration: number;
|
|
15
|
+
constructor(option: NotificationOption);
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export type SocialInfoType = "qq" | "wechat" | "qq-group" | "discord" | "telegram" | "tiktok" | "douyin" | "youtube" | "instagram" | "twitter" | "facebook" | "kuaishou" | "bilibili" | "github" | "email" | "gitee" | "homepage";
|
|
2
|
-
export declare class SocialInfo {
|
|
3
|
-
name: SocialInfoType;
|
|
4
|
-
content: string;
|
|
5
|
-
constructor(name: SocialInfoType, url: string);
|
|
6
|
-
}
|
|
1
|
+
export type SocialInfoType = "qq" | "wechat" | "qq-group" | "discord" | "telegram" | "tiktok" | "douyin" | "youtube" | "instagram" | "twitter" | "facebook" | "kuaishou" | "bilibili" | "github" | "email" | "gitee" | "homepage";
|
|
2
|
+
export declare class SocialInfo {
|
|
3
|
+
name: SocialInfoType;
|
|
4
|
+
content: string;
|
|
5
|
+
constructor(name: SocialInfoType, url: string);
|
|
6
|
+
}
|
|
@@ -1,85 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
readonly
|
|
47
|
-
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
51
|
-
readonly
|
|
52
|
-
readonly
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
import { HostedMode } from "./HostedMode";
|
|
2
|
+
type WidgetOptions = {
|
|
3
|
+
name: string;
|
|
4
|
+
title: {
|
|
5
|
+
[key: string]: string;
|
|
6
|
+
};
|
|
7
|
+
description: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
keywords: WidgetKeyword[];
|
|
11
|
+
lang: string;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
maxWidth?: number;
|
|
15
|
+
maxHeight?: number;
|
|
16
|
+
minWidth?: number;
|
|
17
|
+
minHeight?: number;
|
|
18
|
+
url: string;
|
|
19
|
+
configUrl?: string;
|
|
20
|
+
packageName?: string;
|
|
21
|
+
extraUrl?: {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
};
|
|
24
|
+
supportHostedMode?: HostedMode;
|
|
25
|
+
};
|
|
26
|
+
export declare class Widget {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
/**
|
|
29
|
+
* 组件标题,显示在界面上的,
|
|
30
|
+
* https://zh.m.wikipedia.org/zh-hans/ISO_639-1
|
|
31
|
+
*/
|
|
32
|
+
readonly title: {
|
|
33
|
+
[key: string]: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 组件介绍
|
|
37
|
+
*/
|
|
38
|
+
readonly description: {
|
|
39
|
+
[key: string]: string;
|
|
40
|
+
};
|
|
41
|
+
readonly keywords: WidgetKeyword[];
|
|
42
|
+
/**
|
|
43
|
+
* 组件默认语言
|
|
44
|
+
*/
|
|
45
|
+
readonly lang: string;
|
|
46
|
+
readonly width: number;
|
|
47
|
+
packageName?: string | null;
|
|
48
|
+
readonly height: number;
|
|
49
|
+
readonly maxWidth: number;
|
|
50
|
+
readonly maxHeight: number;
|
|
51
|
+
readonly minWidth: number;
|
|
52
|
+
readonly minHeight: number;
|
|
53
|
+
readonly url: string;
|
|
54
|
+
readonly supportHostedMode: number;
|
|
55
|
+
readonly configUrl?: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* 组件其他页面的url在这注册
|
|
58
|
+
*/
|
|
59
|
+
readonly extraUrl: {
|
|
60
|
+
[key: string]: string;
|
|
61
|
+
};
|
|
62
|
+
constructor(options: WidgetOptions);
|
|
63
|
+
/**
|
|
64
|
+
* 获取组件标题
|
|
65
|
+
* @param lang 语言环境,不传则获取默认语言
|
|
66
|
+
*/
|
|
67
|
+
getTitle(lang?: string): string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* 获取组件标描述
|
|
70
|
+
* @param lang 语言环境,不传则获取默认标题
|
|
71
|
+
*/
|
|
72
|
+
getDescription(lang?: string): string | undefined;
|
|
73
|
+
static parseJSON(json: string): Widget;
|
|
74
|
+
static parseObject(obj: any): Widget;
|
|
75
|
+
/**
|
|
76
|
+
* 是否支持悬浮窗
|
|
77
|
+
*/
|
|
78
|
+
isSupportOverlap(): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* 是否支持普通模式
|
|
81
|
+
*/
|
|
82
|
+
isSupportNormal(): boolean;
|
|
83
|
+
}
|
|
84
|
+
export declare enum WidgetKeyword {
|
|
85
|
+
RECOMMEND = "recommend",
|
|
86
|
+
TOOLS = "tools",
|
|
87
|
+
EFFICIENCY = "efficiency",
|
|
88
|
+
PICTURE = "picture",
|
|
89
|
+
LIFE = "life",
|
|
90
|
+
SHORTCUT = "shortcut",
|
|
91
|
+
COUNTDOWN = "countdown",
|
|
92
|
+
TIMER = "timer",
|
|
93
|
+
INFO = "info",
|
|
94
|
+
DASHBOARD = "dashboard"
|
|
95
|
+
}
|
|
96
|
+
export {};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 组件配置数据,用于存储组件自定义页面所设置的数据
|
|
3
|
-
*/
|
|
4
|
-
export declare class WidgetData {
|
|
5
|
-
/**
|
|
6
|
-
* 组件id
|
|
7
|
-
*/
|
|
8
|
-
id?: string;
|
|
9
|
-
/**
|
|
10
|
-
* 组件名
|
|
11
|
-
*/
|
|
12
|
-
name: string;
|
|
13
|
-
/**
|
|
14
|
-
* 背景颜色
|
|
15
|
-
*/
|
|
16
|
-
backgroundColor?: string;
|
|
17
|
-
/**
|
|
18
|
-
* 文字颜色
|
|
19
|
-
*/
|
|
20
|
-
color?: string;
|
|
21
|
-
/**
|
|
22
|
-
* 字体大小
|
|
23
|
-
*/
|
|
24
|
-
fontSize?: number;
|
|
25
|
-
/**
|
|
26
|
-
* 字体
|
|
27
|
-
*/
|
|
28
|
-
fontFamily?: string;
|
|
29
|
-
/**
|
|
30
|
-
* 圆角半径
|
|
31
|
-
*/
|
|
32
|
-
borderRadius?: number;
|
|
33
|
-
constructor(name: string, id?: string);
|
|
34
|
-
parseJSON(json: {}): void;
|
|
35
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 组件配置数据,用于存储组件自定义页面所设置的数据
|
|
3
|
+
*/
|
|
4
|
+
export declare class WidgetData {
|
|
5
|
+
/**
|
|
6
|
+
* 组件id
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* 组件名
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* 背景颜色
|
|
15
|
+
*/
|
|
16
|
+
backgroundColor?: string;
|
|
17
|
+
/**
|
|
18
|
+
* 文字颜色
|
|
19
|
+
*/
|
|
20
|
+
color?: string;
|
|
21
|
+
/**
|
|
22
|
+
* 字体大小
|
|
23
|
+
*/
|
|
24
|
+
fontSize?: number;
|
|
25
|
+
/**
|
|
26
|
+
* 字体
|
|
27
|
+
*/
|
|
28
|
+
fontFamily?: string;
|
|
29
|
+
/**
|
|
30
|
+
* 圆角半径
|
|
31
|
+
*/
|
|
32
|
+
borderRadius?: number;
|
|
33
|
+
constructor(name: string, id?: string);
|
|
34
|
+
parseJSON(json: {}): void;
|
|
35
|
+
}
|
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import { Widget } from "./Widget";
|
|
2
|
-
export declare class WidgetPackage {
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
name: string;
|
|
7
|
-
/**
|
|
8
|
-
* 组件包版本
|
|
9
|
-
*/
|
|
10
|
-
version: string;
|
|
11
|
-
/**
|
|
12
|
-
* 组件作者署名
|
|
13
|
-
*/
|
|
14
|
-
author: string;
|
|
15
|
-
/**
|
|
16
|
-
* 组件首页
|
|
17
|
-
*/
|
|
18
|
-
homepage: string;
|
|
19
|
-
/**
|
|
20
|
-
* 组件包介绍
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* 组件描述
|
|
24
|
-
*/
|
|
25
|
-
description: {
|
|
26
|
-
[key: string]: string;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* 组件入口文件,通常为 index.html
|
|
30
|
-
*/
|
|
31
|
-
entry: string;
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
1
|
+
import { Widget } from "./Widget";
|
|
2
|
+
export declare class WidgetPackage {
|
|
3
|
+
/**
|
|
4
|
+
* 组件包名,一般为域名倒置,e.g. com.example
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* 组件包版本
|
|
9
|
+
*/
|
|
10
|
+
version: string;
|
|
11
|
+
/**
|
|
12
|
+
* 组件作者署名
|
|
13
|
+
*/
|
|
14
|
+
author: string;
|
|
15
|
+
/**
|
|
16
|
+
* 组件首页
|
|
17
|
+
*/
|
|
18
|
+
homepage: string;
|
|
19
|
+
/**
|
|
20
|
+
* 组件包介绍
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* 组件描述
|
|
24
|
+
*/
|
|
25
|
+
description: {
|
|
26
|
+
[key: string]: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 组件入口文件,通常为 index.html
|
|
30
|
+
*/
|
|
31
|
+
entry: string;
|
|
32
|
+
/**
|
|
33
|
+
* 可能是网络地址,或者本地路径(解压后的文件夹路径),
|
|
34
|
+
* 网络地址:https://www.bilibili.com
|
|
35
|
+
* 本地地址:file:///C:/Users/neo/Desktop
|
|
36
|
+
* 在测试时。地址通常为: http://127.0.0.1:8080
|
|
37
|
+
*/
|
|
38
|
+
url: string;
|
|
39
|
+
widgets: Widget[];
|
|
40
|
+
static parseJSON(json: string): WidgetPackage;
|
|
41
|
+
static parseObject(obj: any): WidgetPackage;
|
|
42
|
+
getFullUrl(): string;
|
|
43
|
+
}
|
|
@@ -1,63 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
static readonly
|
|
4
|
-
static readonly
|
|
5
|
-
static readonly
|
|
6
|
-
static readonly
|
|
7
|
-
static readonly
|
|
8
|
-
static readonly
|
|
9
|
-
static readonly
|
|
10
|
-
static readonly
|
|
11
|
-
static readonly
|
|
12
|
-
static readonly
|
|
13
|
-
static readonly
|
|
14
|
-
static readonly
|
|
15
|
-
static readonly
|
|
16
|
-
static readonly
|
|
17
|
-
static readonly
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
* @
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
DEFAULT = 0,
|
|
62
|
-
OVERLAP = 1
|
|
63
|
-
}
|
|
1
|
+
import { HostedMode } from "./HostedMode";
|
|
2
|
+
export declare class WidgetParams {
|
|
3
|
+
static readonly PARAM_PREFIX = "w_";
|
|
4
|
+
static readonly PARAM_ID = "id";
|
|
5
|
+
static readonly PARAM_WIDTH = "width";
|
|
6
|
+
static readonly PARAM_HEIGHT = "height";
|
|
7
|
+
static readonly PARAM_WIDTH_PX = "width_px";
|
|
8
|
+
static readonly PARAM_HEIGHT_PX = "height_px";
|
|
9
|
+
static readonly PARAM_X = "x";
|
|
10
|
+
static readonly PARAM_Y = "y";
|
|
11
|
+
static readonly PARAM_LANG = "lang";
|
|
12
|
+
static readonly PARAM_THEME = "theme";
|
|
13
|
+
static readonly PARAM_MODE = "mode";
|
|
14
|
+
static readonly PARAM_RADIUS = "radius";
|
|
15
|
+
static readonly PARAM_NAME = "name";
|
|
16
|
+
static readonly PARAM_TITLE = "title";
|
|
17
|
+
static readonly PARAM_PREVIEW = "preview";
|
|
18
|
+
static readonly PARAMS: string[];
|
|
19
|
+
id?: string;
|
|
20
|
+
width?: number;
|
|
21
|
+
widthPx?: number;
|
|
22
|
+
heightPx?: number;
|
|
23
|
+
height?: number;
|
|
24
|
+
x?: number;
|
|
25
|
+
y?: number;
|
|
26
|
+
preview?: boolean;
|
|
27
|
+
lang?: string;
|
|
28
|
+
theme?: ThemeMode;
|
|
29
|
+
mode?: HostedMode;
|
|
30
|
+
radius?: number;
|
|
31
|
+
name?: string;
|
|
32
|
+
title?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 将组件参数转为url参数
|
|
35
|
+
* @param object
|
|
36
|
+
* @return URLSearchParams w_w=2&w_h=2&w_id=21&w_width=156&w_height=156
|
|
37
|
+
*/
|
|
38
|
+
toUrlParams(): URLSearchParams;
|
|
39
|
+
getPersistKey(): string;
|
|
40
|
+
/**
|
|
41
|
+
* 从当前地址解析组件参数:
|
|
42
|
+
* http://localhost:8080/#/widget/config/labor_progress?w_w=2&w_h=2&w_width=156&w_height=156
|
|
43
|
+
* =>
|
|
44
|
+
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
45
|
+
*/
|
|
46
|
+
static fromCurrentLocation(): WidgetParams;
|
|
47
|
+
private static setValue;
|
|
48
|
+
/**
|
|
49
|
+
* 从对象键值对中初始化组件参数
|
|
50
|
+
* {w_width:2,w_height:2,w_id:21,w_width_px:156,w_height_px:156}=>
|
|
51
|
+
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
52
|
+
* @param object
|
|
53
|
+
*/
|
|
54
|
+
static fromObject(object: any): WidgetParams;
|
|
55
|
+
}
|
|
56
|
+
export declare enum ThemeMode {
|
|
57
|
+
AUTO = "auto",
|
|
58
|
+
LIGHT = "LIGHT",
|
|
59
|
+
DARK = "DARK"
|
|
60
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare class BroadcastEvent {
|
|
2
|
-
static readonly TYPE_WIDGET_UPDATED = "broadcast::cn.widgetjs.core.widget_updated";
|
|
3
|
-
static readonly TYPE_APP_CONFIG_UPDATED = "broadcast::cn.widgetjs.core.app_config_updated";
|
|
4
|
-
static readonly TYPE_THEME_CHANGED = "broadcast::cn.widgetjs.core.theme_changed";
|
|
5
|
-
type: string;
|
|
6
|
-
/**
|
|
7
|
-
* 发送人,一般为组件名,如:com.example.widgets.countdown
|
|
8
|
-
*/
|
|
9
|
-
from: string;
|
|
10
|
-
payload: any;
|
|
11
|
-
constructor(type: string, from: string, payload: any);
|
|
12
|
-
}
|
|
1
|
+
export declare class BroadcastEvent {
|
|
2
|
+
static readonly TYPE_WIDGET_UPDATED = "broadcast::cn.widgetjs.core.widget_updated";
|
|
3
|
+
static readonly TYPE_APP_CONFIG_UPDATED = "broadcast::cn.widgetjs.core.app_config_updated";
|
|
4
|
+
static readonly TYPE_THEME_CHANGED = "broadcast::cn.widgetjs.core.theme_changed";
|
|
5
|
+
type: string;
|
|
6
|
+
/**
|
|
7
|
+
* 发送人,一般为组件名,如:com.example.widgets.countdown
|
|
8
|
+
*/
|
|
9
|
+
from: string;
|
|
10
|
+
payload: any;
|
|
11
|
+
constructor(type: string, from: string, payload: any);
|
|
12
|
+
}
|