@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.
Files changed (72) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/api/ApiConstants.js +8 -8
  3. package/dist/cjs/api/AppApi.js +31 -31
  4. package/dist/cjs/api/BroadcastApi.js +20 -20
  5. package/dist/cjs/api/BrowserWindowApi.js +42 -24
  6. package/dist/cjs/api/Channel.js +11 -11
  7. package/dist/cjs/api/ElectronApi.js +13 -13
  8. package/dist/cjs/api/NotificationApi.js +83 -83
  9. package/dist/cjs/api/WidgetApi.js +58 -49
  10. package/dist/cjs/index.js +35 -34
  11. package/dist/cjs/model/HostedMode.js +14 -0
  12. package/dist/cjs/model/Notification.js +15 -15
  13. package/dist/cjs/model/SocialInfo.js +10 -10
  14. package/dist/cjs/model/Widget.js +79 -79
  15. package/dist/cjs/model/WidgetData.js +16 -16
  16. package/dist/cjs/model/WidgetPackage.js +21 -6
  17. package/dist/cjs/model/WidgetParams.js +139 -144
  18. package/dist/cjs/model/event/BroadcastEvent.js +14 -14
  19. package/dist/cjs/model/event/WebSocketEvent.js +14 -14
  20. package/dist/cjs/model/interface/IHostedWidget.js +2 -0
  21. package/dist/cjs/repository/WidgetDataRepository.js +71 -71
  22. package/dist/cjs/router/encoding.js +144 -144
  23. package/dist/cjs/router/query.js +84 -84
  24. package/dist/cjs/utils/ElectronUtils.js +24 -24
  25. package/dist/esm/api/ApiConstants.js +4 -4
  26. package/dist/esm/api/AppApi.js +27 -27
  27. package/dist/esm/api/BroadcastApi.js +16 -16
  28. package/dist/esm/api/BrowserWindowApi.js +38 -20
  29. package/dist/esm/api/Channel.js +8 -8
  30. package/dist/esm/api/ElectronApi.js +9 -9
  31. package/dist/esm/api/NotificationApi.js +79 -79
  32. package/dist/esm/api/WidgetApi.js +54 -45
  33. package/dist/esm/index.js +19 -18
  34. package/dist/esm/model/HostedMode.js +11 -0
  35. package/dist/esm/model/Notification.js +11 -11
  36. package/dist/esm/model/SocialInfo.js +6 -6
  37. package/dist/esm/model/Widget.js +75 -75
  38. package/dist/esm/model/WidgetData.js +12 -12
  39. package/dist/esm/model/WidgetPackage.js +17 -2
  40. package/dist/esm/model/WidgetParams.js +135 -140
  41. package/dist/esm/model/event/BroadcastEvent.js +10 -10
  42. package/dist/esm/model/event/WebSocketEvent.js +10 -10
  43. package/dist/esm/model/interface/IHostedWidget.js +1 -0
  44. package/dist/esm/repository/WidgetDataRepository.js +64 -64
  45. package/dist/esm/router/encoding.js +135 -135
  46. package/dist/esm/router/query.js +79 -79
  47. package/dist/esm/utils/ElectronUtils.js +20 -20
  48. package/dist/types/api/ApiConstants.d.ts +4 -4
  49. package/dist/types/api/AppApi.d.ts +10 -10
  50. package/dist/types/api/BroadcastApi.d.ts +6 -6
  51. package/dist/types/api/BrowserWindowApi.d.ts +27 -10
  52. package/dist/types/api/Channel.d.ts +7 -7
  53. package/dist/types/api/ElectronApi.d.ts +4 -4
  54. package/dist/types/api/NotificationApi.d.ts +14 -14
  55. package/dist/types/api/WidgetApi.d.ts +30 -24
  56. package/dist/types/index.d.ts +19 -18
  57. package/dist/types/model/HostedMode.d.ts +10 -0
  58. package/dist/types/model/Notification.d.ts +16 -16
  59. package/dist/types/model/SocialInfo.d.ts +6 -6
  60. package/dist/types/model/Widget.d.ts +96 -85
  61. package/dist/types/model/WidgetData.d.ts +35 -35
  62. package/dist/types/model/WidgetPackage.d.ts +43 -41
  63. package/dist/types/model/WidgetParams.d.ts +60 -63
  64. package/dist/types/model/event/BroadcastEvent.d.ts +12 -12
  65. package/dist/types/model/event/WebSocketEvent.d.ts +8 -8
  66. package/dist/types/model/interface/IHostedWidget.d.ts +13 -0
  67. package/dist/types/repository/WidgetDataRepository.d.ts +26 -26
  68. package/dist/types/router/encoding.d.ts +62 -62
  69. package/dist/types/router/query.d.ts +53 -53
  70. package/dist/types/utils/ElectronUtils.d.ts +8 -8
  71. package/dist/umd/index.js +1 -1
  72. 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 registerWidgets(widgets: Widget[]): Promise<void>;
11
- static registerWidgetPackage(widgetPackage: WidgetPackage): Promise<void>;
12
- static getWidgets(): Promise<Widget[]>;
13
- static getWidgetPackages(): Promise<WidgetPackage>;
14
- /**
15
- *
16
- * @param name package name
17
- */
18
- static getWidget(name: string): Promise<Widget>;
19
- /**
20
- *
21
- * @param name package name
22
- */
23
- static getWidgetPackage(name: string): Promise<WidgetPackage>;
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
+ }
@@ -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/WidgetPackage";
8
- export * from "./api/ElectronApi";
9
- export * from "./repository/WidgetDataRepository";
10
- export * from "./api/BrowserWindowApi";
11
- export * from "./api/NotificationApi";
12
- export * from "./api/Channel";
13
- export * from "./api/WidgetApi";
14
- export * from "./api/ApiConstants";
15
- export * from "./api/BroadcastApi";
16
- export * from "./api/AppApi";
17
- export * from "./utils/ElectronUtils";
18
- export * from "./router/query";
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";
@@ -0,0 +1,10 @@
1
+ export declare enum HostedMode {
2
+ NORMAL = 1,
3
+ /**
4
+ * 悬浮窗
5
+ */
6
+ OVERLAP = 16,
7
+ WALLPAPER = 256,
8
+ SCREEN = 4096,
9
+ ALL = 4369
10
+ }
@@ -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
- type WidgetOptions = {
2
- name: string;
3
- title: {
4
- [key: string]: string;
5
- };
6
- description: {
7
- [key: string]: string;
8
- };
9
- keywords: WidgetKeyword[];
10
- lang: string;
11
- width: number;
12
- height: number;
13
- maxWidth?: number;
14
- maxHeight?: number;
15
- minWidth?: number;
16
- minHeight?: number;
17
- url: string;
18
- configUrl?: string;
19
- packageName?: string;
20
- extraUrl?: {
21
- [key: string]: string;
22
- };
23
- };
24
- export declare class Widget {
25
- readonly name: string;
26
- /**
27
- * 组件标题,显示在界面上的,
28
- * https://zh.m.wikipedia.org/zh-hans/ISO_639-1
29
- */
30
- readonly title: {
31
- [key: string]: string;
32
- };
33
- /**
34
- * 组件介绍
35
- */
36
- readonly description: {
37
- [key: string]: string;
38
- };
39
- readonly keywords: WidgetKeyword[];
40
- /**
41
- * 组件默认语言
42
- */
43
- readonly lang: string;
44
- readonly width: number;
45
- packageName?: string | null;
46
- readonly height: number;
47
- readonly maxWidth: number;
48
- readonly maxHeight: number;
49
- readonly minWidth: number;
50
- readonly minHeight: number;
51
- readonly url: string;
52
- readonly configUrl?: string | null;
53
- /**
54
- * 组件其他页面的url在这注册
55
- */
56
- readonly extraUrl: {
57
- [key: string]: string;
58
- };
59
- constructor(options: WidgetOptions);
60
- /**
61
- * 获取组件标题
62
- * @param lang 语言环境,不传则获取默认语言
63
- */
64
- getTitle(lang?: string): string | undefined;
65
- /**
66
- * 获取组件标描述
67
- * @param lang 语言环境,不传则获取默认标题
68
- */
69
- getDescription(lang?: string): string | undefined;
70
- static parseJSON(json: string): Widget;
71
- static parseObject(obj: any): Widget;
72
- }
73
- export declare enum WidgetKeyword {
74
- RECOMMEND = "recommend",
75
- TOOLS = "tools",
76
- EFFICIENCY = "efficiency",
77
- PICTURE = "picture",
78
- LIFE = "life",
79
- SHORTCUT = "shortcut",
80
- COUNTDOWN = "countdown",
81
- TIMER = "timer",
82
- INFO = "info",
83
- DASHBOARD = "dashboard"
84
- }
85
- export {};
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
- * 组件名称,名称与包名类似,e.g. com.example.countdown
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
- * 测试时的url,如:http://127.0.0.1:8080/#/
34
- */
35
- debugUrl?: string;
36
- /**
37
- * 解压后的文件夹路径
38
- */
39
- folder?: string;
40
- widgets: Widget[];
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
- export declare class WidgetParams {
2
- static readonly PARAM_PREFIX = "w_";
3
- static readonly PARAM_ID = "id";
4
- static readonly PARAM_WIDTH = "width";
5
- static readonly PARAM_HEIGHT = "height";
6
- static readonly PARAM_WIDTH_PX = "width_px";
7
- static readonly PARAM_HEIGHT_PX = "height_px";
8
- static readonly PARAM_X = "x";
9
- static readonly PARAM_Y = "y";
10
- static readonly PARAM_LANG = "lang";
11
- static readonly PARAM_THEME = "theme";
12
- static readonly PARAM_MODE = "mode";
13
- static readonly PARAM_RADIUS = "radius";
14
- static readonly PARAM_NAME = "name";
15
- static readonly PARAM_TITLE = "title";
16
- static readonly PARAM_PREVIEW = "preview";
17
- static readonly PARAMS: string[];
18
- id?: string;
19
- width?: number;
20
- widthPx?: number;
21
- heightPx?: number;
22
- height?: number;
23
- x?: number;
24
- y?: number;
25
- preview?: boolean;
26
- lang?: string;
27
- theme?: ThemeMode;
28
- mode?: WidgetHostMode;
29
- radius?: number;
30
- name?: string;
31
- title?: string;
32
- /**
33
- * 将组件参数转为url参数
34
- * @param object
35
- * @return URLSearchParams w_w=2&w_h=2&w_id=21&w_width=156&w_height=156
36
- */
37
- toUrlParams(): URLSearchParams;
38
- getPersistKey(): string;
39
- /**
40
- * 从当前地址解析组件参数:
41
- * http://localhost:8080/#/widget/config/labor_progress?w_w=2&w_h=2&w_width=156&w_height=156
42
- * =>
43
- * {width:2,height:2,id:21,width_px:156,height_px:156}
44
- */
45
- static fromCurrentLocation(): WidgetParams;
46
- private static setValue;
47
- /**
48
- * 从对象键值对中初始化组件参数
49
- * {w_width:2,w_height:2,w_id:21,w_width_px:156,w_height_px:156}=>
50
- * {width:2,height:2,id:21,width_px:156,height_px:156}
51
- * @param object
52
- */
53
- static fromObject(object: any): WidgetParams;
54
- }
55
- export declare enum ThemeMode {
56
- AUTO = "auto",
57
- LIGHT = "LIGHT",
58
- DARK = "DARK"
59
- }
60
- export declare enum WidgetHostMode {
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
+ }