@whitesev/utils 1.0.6 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/utils",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "一个常用的工具库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/node/index.esm.js",
@@ -1,33 +1,5 @@
1
1
  import { Utils } from ".";
2
2
 
3
- /**
4
- * 保存值到本地存储
5
- *
6
- * 可以使用Promise实际等待值的设置完成
7
- */
8
- declare function GM_setValue(
9
- name: string,
10
- value: any
11
- ): Promise<undefined> | undefined;
12
-
13
- /**
14
- * 获取本地存储的值
15
- */
16
- declare function GM_getValue<T extends any>(name: string, defaultValue?: T): T;
17
-
18
- /**
19
- * 注册功能到油猴菜单中
20
- */
21
- declare function GM_registerMenuCommand(
22
- name: string,
23
- listener: (event: PointerEvent | MouseEvent) => void,
24
- accessKey?: string
25
- ): number;
26
- /**
27
- * 从替换菜单中卸载某个菜单
28
- */
29
- declare function GM_unregisterMenuCommand(id: number): void;
30
-
31
3
  declare interface UtilsGMMenuClickCallBackData {
32
4
  /** 菜单键名 */
33
5
  key: string;
@@ -97,136 +69,13 @@ declare interface UtilsGMMenuConstructorOptions {
97
69
  /** (可选)全局菜单点击菜单后自动刷新网页,默认为true */
98
70
  autoReload?: boolean;
99
71
  /** 油猴函数 @grant GM_getValue */
100
- GM_getValue<T extends any>(name: string, defaultValue?: T): T;
72
+ GM_getValue: any;
101
73
  /** 油猴函数 @grant GM_setValue */
102
- GM_setValue(name: string, value: any): Promise<undefined> | undefined;
74
+ GM_setValue: any;
103
75
  /** 油猴函数 @grant GM_registerMenuCommand */
104
- GM_registerMenuCommand(
105
- name: string,
106
- listener: (event: PointerEvent | MouseEvent) => void,
107
- accessKey?: string
108
- ): number;
76
+ GM_registerMenuCommand: any;
109
77
  /** 油猴函数 @grant GM_unregisterMenuCommand */
110
- GM_unregisterMenuCommand(id: number): void;
111
- }
112
-
113
- /** GM_Menu */
114
- declare interface UtilsGMMenuConstructor {
115
- /**
116
- * 根据键值获取enable值
117
- * @param menuKey 菜单-键key
118
- **/
119
- get(menuKey: string): boolean;
120
- /**
121
- * 根据键值获取enable值
122
- * @param menuKey 菜单-键key
123
- **/
124
- getEnable(menuKey: string): boolean;
125
- /**
126
- * 根据键值获取text值
127
- * @param menuKey 菜单-键key
128
- **/
129
- getText(menuKey: string): string;
130
- /**
131
- * 根据键值获取showText函数的值
132
- * @param menuKey 菜单-键key
133
- **/
134
- getShowTextValue(menuKey: string): string;
135
- /**
136
- * 获取当前已注册菜单的id
137
- * @param menuKey 菜单-键key
138
- */
139
- getMenuId(menuKey: string): number | undefined;
140
- /**
141
- * 根据键值获取accessKey值
142
- * @param menuKey 菜单-键key
143
- */
144
- getAccessKey(menuKey: string): string | undefined;
145
- /**
146
- * 根据键值获取autoClose值
147
- * @param menuKey 菜单-键key
148
- */
149
- getAutoClose(menuKey: string): boolean | undefined;
150
- /**
151
- * 根据键值获取autoReload值
152
- * @param menuKey 菜单-键key
153
- */
154
- getAutoReload(menuKey: string): boolean;
155
- /**
156
- * 根据键值获取callback函数
157
- * @param menuKey 菜单-键key
158
- */
159
- getCallBack(menuKey: string): () => void | undefined;
160
- /**
161
- * 获取当enable为true时默认显示在菜单中前面的emoji图标
162
- */
163
- getEnableTrueEmoji(): string;
164
- /**
165
- * 获取当enable为false时默认显示在菜单中前面的emoji图标
166
- */
167
- getEnableFalseEmoji(): string;
168
- /**
169
- * 获取本地存储的菜单外部的键名
170
- * @param keyName
171
- */
172
- getLocalStorageKeyName(keyName: string): string;
173
- /**
174
- * 设置菜单的值
175
- * @param menuKey 菜单-键key
176
- * @param value 需要设置的值
177
- */
178
- setValue(menuKey: string, value: any): void;
179
- /**
180
- * 设置菜单的值
181
- * @param menuKey 菜单-键key
182
- * @param value 需要设置的值
183
- */
184
- setEnable(menuKey: string, value: boolean): void;
185
- /**
186
- * 设置当enable为true时默认显示在菜单中前面的emoji图标
187
- * @param emojiString
188
- */
189
- setEnableTrueEmoji(emojiString: string): void;
190
- /**
191
- * 设置当enable为false时默认显示在菜单中前面的emoji图标
192
- * @param emojiString
193
- */
194
- setEnableFalseEmoji(emojiString: string): void;
195
- /**
196
- * 设置本地存储的菜单外部的键名
197
- * @param keyName
198
- */
199
- setLocalStorageKeyName(keyName: string): void;
200
- /**
201
- * 新增菜单数据
202
- * @param paramData
203
- */
204
- add(paramData: UtilsGMMenuOption[] | UtilsGMMenuOption): void;
205
- /**
206
- * 更新菜单数据
207
- * 方式:先卸载全部的菜单,再重新注册菜单
208
- * @param options 数据
209
- */
210
- update(options?: UtilsGMMenuOption[] | UtilsGMMenuOption): Promise<void>;
211
- /**
212
- * 根据已注册菜单的id,来更新菜单配置,不会卸载菜单导致可能菜单选项可能会变化的情况
213
- * @param options 配置
214
- * @deprecated
215
- */
216
- updateOptionsWithId?(options?: UtilsGMMenuOption[] | UtilsGMMenuOption): void;
217
- /**
218
- * 卸载菜单
219
- * @param menuId 已注册的菜单id
220
- */
221
- delete(menuId: number): void;
222
- }
223
-
224
- /** GM_Menu */
225
- declare interface UtilsGMMenu {
226
- /**
227
- * @param details 传递的菜单配置
228
- */
229
- new (details: UtilsGMMenuConstructorOptions): UtilsGMMenuConstructor;
78
+ GM_unregisterMenuCommand: any;
230
79
  }
231
80
 
232
81
  class GMMenu {
@@ -234,19 +83,19 @@ class GMMenu {
234
83
  /**
235
84
  * 获取存储的数据
236
85
  */
237
- getValue: GM_getValue,
86
+ getValue: null as any,
238
87
  /**
239
88
  * 设置数据到存储
240
89
  */
241
- setValue: GM_setValue,
90
+ setValue: null as any,
242
91
  /**
243
92
  * 注册菜单
244
93
  */
245
- registerMenuCommand: GM_registerMenuCommand,
94
+ registerMenuCommand: null as any,
246
95
  /**
247
96
  * 卸载菜单
248
97
  */
249
- unregisterMenuCommand: GM_unregisterMenuCommand,
98
+ unregisterMenuCommand: null as any,
250
99
  };
251
100
  private MenuHandle = {
252
101
  context: this,