@whitesev/utils 1.0.8 → 1.1.0
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.amd.js +20 -17
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +20 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +20 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +20 -17
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +20 -17
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +20 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Event.d.ts +156 -0
- package/dist/src/Httpx.d.ts +1 -1
- package/dist/src/Log.d.ts +4 -3
- package/dist/src/{index.d.ts → Utils.d.ts} +12 -166
- package/dist/src/UtilsGMMenu.d.ts +4 -4
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/Dictionary.ts +1 -1
- package/src/Event.ts +189 -0
- package/src/GBKEncoder.ts +1 -1
- package/src/Httpx.ts +1 -1
- package/src/LockFunction.ts +1 -1
- package/src/Log.ts +28 -25
- package/src/Progress.ts +1 -1
- package/src/{tryCatch.ts → TryCatch.ts} +1 -1
- package/src/{index.ts → Utils.ts} +16 -205
- package/src/UtilsGMCookie.ts +1 -1
- package/src/UtilsGMMenu.ts +1 -1
- package/src/indexedDB.ts +2 -4
- /package/dist/src/{tryCatch.d.ts → TryCatch.d.ts} +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 鼠标事件
|
|
3
|
+
* + https://blog.csdn.net/weixin_68658847/article/details/126939879
|
|
4
|
+
*/
|
|
5
|
+
declare interface DOMUtils_MouseEvent {
|
|
6
|
+
click: MouseEvent | PointerEvent;
|
|
7
|
+
contextmenu: MouseEvent | PointerEvent;
|
|
8
|
+
dblclick: MouseEvent | PointerEvent;
|
|
9
|
+
mousedown: MouseEvent | PointerEvent;
|
|
10
|
+
mouseenter: MouseEvent | PointerEvent;
|
|
11
|
+
mouseleave: MouseEvent | PointerEvent;
|
|
12
|
+
mousemove: MouseEvent | PointerEvent;
|
|
13
|
+
mouseover: MouseEvent | PointerEvent;
|
|
14
|
+
mouseout: MouseEvent | PointerEvent;
|
|
15
|
+
mouseup: MouseEvent | PointerEvent;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 鼠标事件
|
|
19
|
+
*/
|
|
20
|
+
declare interface DOMUtils_KeyboardEvent {
|
|
21
|
+
keydown: KeyboardEvent;
|
|
22
|
+
keypress: KeyboardEvent;
|
|
23
|
+
keyup: KeyboardEvent;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 框架/对象事件
|
|
27
|
+
*/
|
|
28
|
+
declare interface DOMUtils_Frame_Object_Event {
|
|
29
|
+
abort: Event;
|
|
30
|
+
beforeunload: Event;
|
|
31
|
+
error: Event;
|
|
32
|
+
hashchange: Event;
|
|
33
|
+
load: Event;
|
|
34
|
+
pageshow: Event;
|
|
35
|
+
pagehide: Event;
|
|
36
|
+
resize: Event;
|
|
37
|
+
scroll: Event;
|
|
38
|
+
unload: Event;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 表单事件
|
|
42
|
+
*/
|
|
43
|
+
declare interface DOMUtils_FormEvent {
|
|
44
|
+
blur: Event;
|
|
45
|
+
change: Event;
|
|
46
|
+
focus: Event;
|
|
47
|
+
focusin: Event;
|
|
48
|
+
focusout: Event;
|
|
49
|
+
input: Event;
|
|
50
|
+
reset: Event;
|
|
51
|
+
search: Event;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 剪贴板事件
|
|
55
|
+
*/
|
|
56
|
+
declare interface DOMUtils_ClipboardEvent {
|
|
57
|
+
copy: ClipboardEvent;
|
|
58
|
+
cut: ClipboardEvent;
|
|
59
|
+
paste: ClipboardEvent;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 打印事件
|
|
63
|
+
*/
|
|
64
|
+
declare interface DOMUtils_PrintEvent {
|
|
65
|
+
afterprint: Event;
|
|
66
|
+
beforeprint: Event;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 拖动事件
|
|
70
|
+
*/
|
|
71
|
+
declare interface DOMUtils_DragEvent {
|
|
72
|
+
drag: DragEvent;
|
|
73
|
+
dragend: DragEvent;
|
|
74
|
+
dragenter: DragEvent;
|
|
75
|
+
dragleave: DragEvent;
|
|
76
|
+
dragover: DragEvent;
|
|
77
|
+
dragstart: DragEvent;
|
|
78
|
+
drop: DragEvent;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* 多媒体(Media)事件
|
|
82
|
+
*/
|
|
83
|
+
declare interface DOMUtils_MediaEvent {
|
|
84
|
+
abort: Event;
|
|
85
|
+
canplay: Event;
|
|
86
|
+
canplaythrough: Event;
|
|
87
|
+
durationchange: Event;
|
|
88
|
+
emptied: Event;
|
|
89
|
+
ended: Event;
|
|
90
|
+
error: Event;
|
|
91
|
+
loadeddata: Event;
|
|
92
|
+
loadedmetadata: Event;
|
|
93
|
+
loadstart: Event;
|
|
94
|
+
pause: Event;
|
|
95
|
+
play: Event;
|
|
96
|
+
playing: Event;
|
|
97
|
+
progress: Event;
|
|
98
|
+
ratechange: Event;
|
|
99
|
+
seeked: Event;
|
|
100
|
+
seeking: Event;
|
|
101
|
+
stalled: Event;
|
|
102
|
+
suspend: Event;
|
|
103
|
+
timeupdate: Event;
|
|
104
|
+
volumechange: Event;
|
|
105
|
+
waiting: Event;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 动画事件
|
|
109
|
+
*/
|
|
110
|
+
declare interface DOMUtils_AnimationEvent {
|
|
111
|
+
animationend: AnimationEvent;
|
|
112
|
+
animationiteration: AnimationEvent;
|
|
113
|
+
animationstart: AnimationEvent;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 过渡事件
|
|
117
|
+
*/
|
|
118
|
+
declare interface DOMUtils_TransitionEvent {
|
|
119
|
+
transitionend: TransitionEvent;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 触摸事件
|
|
123
|
+
*/
|
|
124
|
+
declare interface DOMUtils_TouchEvent {
|
|
125
|
+
touchstart: TouchEvent;
|
|
126
|
+
touchmove: TouchEvent;
|
|
127
|
+
touchend: TouchEvent;
|
|
128
|
+
touchcancel: TouchEvent;
|
|
129
|
+
touchenter: TouchEvent;
|
|
130
|
+
touchleave: TouchEvent;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 其它事件
|
|
134
|
+
*/
|
|
135
|
+
declare interface DOMUtils_OtherEvent {
|
|
136
|
+
message: Event;
|
|
137
|
+
online: Event;
|
|
138
|
+
offline: Event;
|
|
139
|
+
popstate: Event;
|
|
140
|
+
show: Event;
|
|
141
|
+
storage: Event;
|
|
142
|
+
toggle: Event;
|
|
143
|
+
wheel: Event;
|
|
144
|
+
propertychange: Event;
|
|
145
|
+
fullscreenchange: Event;
|
|
146
|
+
DOMContentLoaded: Event;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* 全部事件
|
|
150
|
+
*/
|
|
151
|
+
export declare type DOMUtils_Event = DOMUtils_MouseEvent & DOMUtils_KeyboardEvent & DOMUtils_Frame_Object_Event & DOMUtils_FormEvent & DOMUtils_ClipboardEvent & DOMUtils_PrintEvent & DOMUtils_DragEvent & DOMUtils_MediaEvent & DOMUtils_AnimationEvent & DOMUtils_TransitionEvent & DOMUtils_TouchEvent & DOMUtils_OtherEvent;
|
|
152
|
+
/**
|
|
153
|
+
* 事件类型
|
|
154
|
+
*/
|
|
155
|
+
export declare type DOMUtils_EventType = keyof DOMUtils_Event;
|
|
156
|
+
export {};
|
package/dist/src/Httpx.d.ts
CHANGED
package/dist/src/Log.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyObject } from "
|
|
1
|
+
import type { AnyObject } from "./Utils";
|
|
2
2
|
/** Utils.Log的初始化配置 */
|
|
3
3
|
declare interface UtilsLogOptions {
|
|
4
4
|
/** 是否输出Tag,false的话其它的颜色也不输出,默认为true */
|
|
@@ -20,16 +20,17 @@ declare interface UtilsLogOptions {
|
|
|
20
20
|
}
|
|
21
21
|
declare class Log {
|
|
22
22
|
#private;
|
|
23
|
+
/** 前面的TAG标志 */
|
|
23
24
|
tag: string;
|
|
24
25
|
/**
|
|
25
|
-
* @param _GM_info_ 油猴管理器的API GM_info,或者是一个对象,如{"script":{name:"Utils.Log"}}
|
|
26
|
+
* @param _GM_info_ 油猴管理器的API GM_info,或者是一个对象,如{"script":{name:"Utils.Log"}},或者直接是一个字符串
|
|
26
27
|
* @param console 可指定console对象为unsafeWindow下的console或者是油猴window下的console
|
|
27
28
|
*/
|
|
28
29
|
constructor(_GM_info_?: {
|
|
29
30
|
script: {
|
|
30
31
|
name: string;
|
|
31
32
|
};
|
|
32
|
-
}, console?: Console);
|
|
33
|
+
} | string, console?: Console);
|
|
33
34
|
/**
|
|
34
35
|
* 解析Error的堆栈获取实际调用者的函数名及函数所在的位置
|
|
35
36
|
* @param stack
|
|
@@ -10,6 +10,7 @@ import { LockFunction } from "./LockFunction";
|
|
|
10
10
|
import { Log } from "./Log";
|
|
11
11
|
import { Progress } from "./Progress";
|
|
12
12
|
import { UtilsDictionary } from "./Dictionary";
|
|
13
|
+
import type { DOMUtils_EventType } from "./Event";
|
|
13
14
|
export declare var unsafeWindow: Window & typeof globalThis;
|
|
14
15
|
export type JSTypeMap = {
|
|
15
16
|
string: string;
|
|
@@ -25,8 +26,8 @@ export type JSTypeNames = keyof JSTypeMap;
|
|
|
25
26
|
export type ArgsType<T extends JSTypeNames[]> = {
|
|
26
27
|
[I in keyof T]: JSTypeMap[T[I]];
|
|
27
28
|
};
|
|
28
|
-
export declare interface
|
|
29
|
-
[key: string]: V |
|
|
29
|
+
export declare interface UtilsOwnObject<V extends any> {
|
|
30
|
+
[key: string]: V | UtilsOwnObject<V>;
|
|
30
31
|
}
|
|
31
32
|
export declare interface AnyObject {
|
|
32
33
|
[key: string]: any | AnyObject;
|
|
@@ -50,161 +51,6 @@ export declare interface Vue2Context extends AnyObject {
|
|
|
50
51
|
}) => void;
|
|
51
52
|
$el: Element;
|
|
52
53
|
}
|
|
53
|
-
/**
|
|
54
|
-
* 鼠标事件
|
|
55
|
-
* + https://blog.csdn.net/weixin_68658847/article/details/126939879
|
|
56
|
-
*/
|
|
57
|
-
declare interface DOMUtils_MouseEvent {
|
|
58
|
-
click: MouseEvent | PointerEvent;
|
|
59
|
-
contextmenu: MouseEvent | PointerEvent;
|
|
60
|
-
dblclick: MouseEvent | PointerEvent;
|
|
61
|
-
mousedown: MouseEvent | PointerEvent;
|
|
62
|
-
mouseenter: MouseEvent | PointerEvent;
|
|
63
|
-
mouseleave: MouseEvent | PointerEvent;
|
|
64
|
-
mousemove: MouseEvent | PointerEvent;
|
|
65
|
-
mouseover: MouseEvent | PointerEvent;
|
|
66
|
-
mouseout: MouseEvent | PointerEvent;
|
|
67
|
-
mouseup: MouseEvent | PointerEvent;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* 鼠标事件
|
|
71
|
-
*/
|
|
72
|
-
declare interface DOMUtils_KeyboardEvent {
|
|
73
|
-
keydown: KeyboardEvent;
|
|
74
|
-
keypress: KeyboardEvent;
|
|
75
|
-
keyup: KeyboardEvent;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* 框架/对象事件
|
|
79
|
-
*/
|
|
80
|
-
declare interface DOMUtils_Frame_Object_Event {
|
|
81
|
-
abort: Event;
|
|
82
|
-
beforeunload: Event;
|
|
83
|
-
error: Event;
|
|
84
|
-
hashchange: Event;
|
|
85
|
-
load: Event;
|
|
86
|
-
pageshow: Event;
|
|
87
|
-
pagehide: Event;
|
|
88
|
-
resize: Event;
|
|
89
|
-
scroll: Event;
|
|
90
|
-
unload: Event;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* 表单事件
|
|
94
|
-
*/
|
|
95
|
-
declare interface DOMUtils_FormEvent {
|
|
96
|
-
blur: Event;
|
|
97
|
-
change: Event;
|
|
98
|
-
focus: Event;
|
|
99
|
-
focusin: Event;
|
|
100
|
-
focusout: Event;
|
|
101
|
-
input: Event;
|
|
102
|
-
reset: Event;
|
|
103
|
-
search: Event;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* 剪贴板事件
|
|
107
|
-
*/
|
|
108
|
-
declare interface DOMUtils_ClipboardEvent {
|
|
109
|
-
copy: ClipboardEvent;
|
|
110
|
-
cut: ClipboardEvent;
|
|
111
|
-
paste: ClipboardEvent;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* 打印事件
|
|
115
|
-
*/
|
|
116
|
-
declare interface DOMUtils_PrintEvent {
|
|
117
|
-
afterprint: Event;
|
|
118
|
-
beforeprint: Event;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* 拖动事件
|
|
122
|
-
*/
|
|
123
|
-
declare interface DOMUtils_DragEvent {
|
|
124
|
-
drag: DragEvent;
|
|
125
|
-
dragend: DragEvent;
|
|
126
|
-
dragenter: DragEvent;
|
|
127
|
-
dragleave: DragEvent;
|
|
128
|
-
dragover: DragEvent;
|
|
129
|
-
dragstart: DragEvent;
|
|
130
|
-
drop: DragEvent;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* 多媒体(Media)事件
|
|
134
|
-
*/
|
|
135
|
-
declare interface DOMUtils_MediaEvent {
|
|
136
|
-
abort: Event;
|
|
137
|
-
canplay: Event;
|
|
138
|
-
canplaythrough: Event;
|
|
139
|
-
durationchange: Event;
|
|
140
|
-
emptied: Event;
|
|
141
|
-
ended: Event;
|
|
142
|
-
error: Event;
|
|
143
|
-
loadeddata: Event;
|
|
144
|
-
loadedmetadata: Event;
|
|
145
|
-
loadstart: Event;
|
|
146
|
-
pause: Event;
|
|
147
|
-
play: Event;
|
|
148
|
-
playing: Event;
|
|
149
|
-
progress: Event;
|
|
150
|
-
ratechange: Event;
|
|
151
|
-
seeked: Event;
|
|
152
|
-
seeking: Event;
|
|
153
|
-
stalled: Event;
|
|
154
|
-
suspend: Event;
|
|
155
|
-
timeupdate: Event;
|
|
156
|
-
volumechange: Event;
|
|
157
|
-
waiting: Event;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* 动画事件
|
|
161
|
-
*/
|
|
162
|
-
declare interface DOMUtils_AnimationEvent {
|
|
163
|
-
animationend: AnimationEvent;
|
|
164
|
-
animationiteration: AnimationEvent;
|
|
165
|
-
animationstart: AnimationEvent;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* 过渡事件
|
|
169
|
-
*/
|
|
170
|
-
declare interface DOMUtils_TransitionEvent {
|
|
171
|
-
transitionend: TransitionEvent;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* 触摸事件
|
|
175
|
-
*/
|
|
176
|
-
declare interface DOMUtils_TouchEvent {
|
|
177
|
-
touchstart: TouchEvent;
|
|
178
|
-
touchmove: TouchEvent;
|
|
179
|
-
touchend: TouchEvent;
|
|
180
|
-
touchcancel: TouchEvent;
|
|
181
|
-
touchenter: TouchEvent;
|
|
182
|
-
touchleave: TouchEvent;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* 其它事件
|
|
186
|
-
*/
|
|
187
|
-
declare interface DOMUtils_OtherEvent {
|
|
188
|
-
message: Event;
|
|
189
|
-
online: Event;
|
|
190
|
-
offline: Event;
|
|
191
|
-
popstate: Event;
|
|
192
|
-
show: Event;
|
|
193
|
-
storage: Event;
|
|
194
|
-
toggle: Event;
|
|
195
|
-
wheel: Event;
|
|
196
|
-
propertychange: Event;
|
|
197
|
-
fullscreenchange: Event;
|
|
198
|
-
DOMContentLoaded: Event;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* 全部事件
|
|
202
|
-
*/
|
|
203
|
-
declare type DOMUtils_Event = DOMUtils_MouseEvent & DOMUtils_KeyboardEvent & DOMUtils_Frame_Object_Event & DOMUtils_FormEvent & DOMUtils_ClipboardEvent & DOMUtils_PrintEvent & DOMUtils_DragEvent & DOMUtils_MediaEvent & DOMUtils_AnimationEvent & DOMUtils_TransitionEvent & DOMUtils_TouchEvent & DOMUtils_OtherEvent;
|
|
204
|
-
/**
|
|
205
|
-
* 事件类型
|
|
206
|
-
*/
|
|
207
|
-
declare type DOMUtils_EventType = keyof DOMUtils_Event;
|
|
208
54
|
declare class Utils {
|
|
209
55
|
/** 版本号 */
|
|
210
56
|
version: string;
|
|
@@ -349,7 +195,7 @@ declare class Utils {
|
|
|
349
195
|
* @example
|
|
350
196
|
* Utils.dispatchEvent(document.querySelector("input","input"))
|
|
351
197
|
*/
|
|
352
|
-
dispatchEvent(element: HTMLElement | Document, eventName: DOMUtils_EventType | DOMUtils_EventType[], details?:
|
|
198
|
+
dispatchEvent(element: HTMLElement | Document, eventName: DOMUtils_EventType | DOMUtils_EventType[], details?: UtilsOwnObject<any>): void;
|
|
353
199
|
/**
|
|
354
200
|
* 主动触发事件
|
|
355
201
|
* @param element 元素
|
|
@@ -360,7 +206,7 @@ declare class Utils {
|
|
|
360
206
|
* @example
|
|
361
207
|
* Utils.dispatchEvent(document.querySelector("input","input"))
|
|
362
208
|
*/
|
|
363
|
-
dispatchEvent(element: HTMLElement | Document, eventName: string, details?:
|
|
209
|
+
dispatchEvent(element: HTMLElement | Document, eventName: string, details?: UtilsOwnObject<any>): void;
|
|
364
210
|
/**
|
|
365
211
|
* 下载base64格式的数据
|
|
366
212
|
* @param base64Data 需要转换的base64数据
|
|
@@ -572,7 +418,7 @@ declare class Utils {
|
|
|
572
418
|
* Utils.getMaxValue({1:123,2:345,3:456},(key,value)=>{return parseInt(value)})
|
|
573
419
|
* > 456
|
|
574
420
|
*/
|
|
575
|
-
getMaxValue(val:
|
|
421
|
+
getMaxValue(val: UtilsOwnObject<number>, handler: (key: any, value: any) => number): number;
|
|
576
422
|
/**
|
|
577
423
|
* 获取页面中最大的z-index
|
|
578
424
|
* @param deviation 获取最大的z-index值的偏移,默认是+1
|
|
@@ -601,14 +447,14 @@ declare class Utils {
|
|
|
601
447
|
* Utils.getMinValue({1:123,2:345,3:456},(key,value)=>{return parseInt(value)})
|
|
602
448
|
* > 123
|
|
603
449
|
*/
|
|
604
|
-
getMinValue(val:
|
|
450
|
+
getMinValue(val: UtilsOwnObject<number>, handler: (key: any, value: any) => number): number;
|
|
605
451
|
/**
|
|
606
452
|
* 获取最小值
|
|
607
453
|
* @example
|
|
608
454
|
* Utils.getMinValue([{1:123},{2:345},{3:456}],(index,value)=>{return parseInt(index)})
|
|
609
455
|
* > 0
|
|
610
456
|
*/
|
|
611
|
-
getMinValue(val:
|
|
457
|
+
getMinValue(val: UtilsOwnObject<number>[], handler: (index: number, value: any) => number): number;
|
|
612
458
|
/**
|
|
613
459
|
* 获取随机的安卓手机User-Agent
|
|
614
460
|
* @example
|
|
@@ -632,7 +478,7 @@ declare class Utils {
|
|
|
632
478
|
* Utils.getRandomValue({1:"结果1",2:"结果2",3:"结果3"}})
|
|
633
479
|
* > 结果2
|
|
634
480
|
*/
|
|
635
|
-
getRandomValue<T extends any>(val: T[] |
|
|
481
|
+
getRandomValue<T extends any>(val: T[] | UtilsOwnObject<T>): T;
|
|
636
482
|
/**
|
|
637
483
|
* 获取两个数之间随机值
|
|
638
484
|
* @example
|
|
@@ -646,7 +492,7 @@ declare class Utils {
|
|
|
646
492
|
* Utils.getRandomValue({1:1},{2:2})
|
|
647
493
|
* > {1: 1}
|
|
648
494
|
*/
|
|
649
|
-
getRandomValue<T extends any>(val_1:
|
|
495
|
+
getRandomValue<T extends any>(val_1: UtilsOwnObject<T>, val_2: UtilsOwnObject<T>): T;
|
|
650
496
|
/**
|
|
651
497
|
* 获取随机的电脑端User-Agent
|
|
652
498
|
* + Mozilla/5.0:以前用于Netscape浏览器,目前大多数浏览器UA都会带有
|
|
@@ -1544,9 +1390,9 @@ declare class Utils {
|
|
|
1544
1390
|
* > ()=>{throw new Error('测试错误')}出现错误
|
|
1545
1391
|
*/
|
|
1546
1392
|
tryCatch: (...args: any) => {
|
|
1547
|
-
config(paramDetails: import("./
|
|
1393
|
+
config(paramDetails: import("./TryCatch").UtilsTryCatchConfig): any;
|
|
1548
1394
|
error(handler: string | Function | ((...args: any[]) => any)): any;
|
|
1549
|
-
run<A extends any[], R>(callback: string | Function | ((...args: A) => R), __context__?: any): import("./
|
|
1395
|
+
run<A extends any[], R>(callback: string | Function | ((...args: A) => R), __context__?: any): import("./TryCatch").UtilsTryCatchType;
|
|
1550
1396
|
};
|
|
1551
1397
|
/**
|
|
1552
1398
|
* 数组去重,去除重复的值
|
|
@@ -40,13 +40,13 @@ declare interface UtilsGMMenuConstructorOptions {
|
|
|
40
40
|
/** (可选)全局菜单点击菜单后自动刷新网页,默认为true */
|
|
41
41
|
autoReload?: boolean;
|
|
42
42
|
/** 油猴函数 @grant GM_getValue */
|
|
43
|
-
GM_getValue
|
|
43
|
+
GM_getValue: any;
|
|
44
44
|
/** 油猴函数 @grant GM_setValue */
|
|
45
|
-
GM_setValue
|
|
45
|
+
GM_setValue: any;
|
|
46
46
|
/** 油猴函数 @grant GM_registerMenuCommand */
|
|
47
|
-
GM_registerMenuCommand
|
|
47
|
+
GM_registerMenuCommand: any;
|
|
48
48
|
/** 油猴函数 @grant GM_unregisterMenuCommand */
|
|
49
|
-
GM_unregisterMenuCommand
|
|
49
|
+
GM_unregisterMenuCommand: any;
|
|
50
50
|
}
|
|
51
51
|
declare class GMMenu {
|
|
52
52
|
private GM_Api;
|
package/index.ts
CHANGED
package/package.json
CHANGED
package/src/Dictionary.ts
CHANGED
package/src/Event.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 鼠标事件
|
|
3
|
+
* + https://blog.csdn.net/weixin_68658847/article/details/126939879
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
declare interface DOMUtils_MouseEvent {
|
|
7
|
+
click: MouseEvent | PointerEvent;
|
|
8
|
+
contextmenu: MouseEvent | PointerEvent;
|
|
9
|
+
dblclick: MouseEvent | PointerEvent;
|
|
10
|
+
mousedown: MouseEvent | PointerEvent;
|
|
11
|
+
mouseenter: MouseEvent | PointerEvent;
|
|
12
|
+
mouseleave: MouseEvent | PointerEvent;
|
|
13
|
+
mousemove: MouseEvent | PointerEvent;
|
|
14
|
+
mouseover: MouseEvent | PointerEvent;
|
|
15
|
+
mouseout: MouseEvent | PointerEvent;
|
|
16
|
+
mouseup: MouseEvent | PointerEvent;
|
|
17
|
+
}
|
|
18
|
+
declare type DOMUtils_MouseEventType = keyof DOMUtils_MouseEvent;
|
|
19
|
+
/**
|
|
20
|
+
* 鼠标事件
|
|
21
|
+
*/
|
|
22
|
+
declare interface DOMUtils_KeyboardEvent {
|
|
23
|
+
keydown: KeyboardEvent;
|
|
24
|
+
keypress: KeyboardEvent;
|
|
25
|
+
keyup: KeyboardEvent;
|
|
26
|
+
}
|
|
27
|
+
declare type DOMUtils_KeyboardEventType = keyof DOMUtils_KeyboardEvent;
|
|
28
|
+
/**
|
|
29
|
+
* 框架/对象事件
|
|
30
|
+
*/
|
|
31
|
+
declare interface DOMUtils_Frame_Object_Event {
|
|
32
|
+
abort: Event;
|
|
33
|
+
beforeunload: Event;
|
|
34
|
+
error: Event;
|
|
35
|
+
hashchange: Event;
|
|
36
|
+
load: Event;
|
|
37
|
+
pageshow: Event;
|
|
38
|
+
pagehide: Event;
|
|
39
|
+
resize: Event;
|
|
40
|
+
scroll: Event;
|
|
41
|
+
unload: Event;
|
|
42
|
+
}
|
|
43
|
+
declare type DOMUtils_Frame_Object_EventType =
|
|
44
|
+
keyof DOMUtils_Frame_Object_Event;
|
|
45
|
+
/**
|
|
46
|
+
* 表单事件
|
|
47
|
+
*/
|
|
48
|
+
declare interface DOMUtils_FormEvent {
|
|
49
|
+
blur: Event;
|
|
50
|
+
change: Event;
|
|
51
|
+
focus: Event;
|
|
52
|
+
focusin: Event;
|
|
53
|
+
focusout: Event;
|
|
54
|
+
input: Event;
|
|
55
|
+
reset: Event;
|
|
56
|
+
search: Event;
|
|
57
|
+
}
|
|
58
|
+
declare type DOMUtils_FormEventType = keyof DOMUtils_FormEvent;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 剪贴板事件
|
|
62
|
+
*/
|
|
63
|
+
declare interface DOMUtils_ClipboardEvent {
|
|
64
|
+
copy: ClipboardEvent;
|
|
65
|
+
cut: ClipboardEvent;
|
|
66
|
+
paste: ClipboardEvent;
|
|
67
|
+
}
|
|
68
|
+
declare type DOMUtils_ClipboardEventType = keyof DOMUtils_ClipboardEvent;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 打印事件
|
|
72
|
+
*/
|
|
73
|
+
declare interface DOMUtils_PrintEvent {
|
|
74
|
+
afterprint: Event;
|
|
75
|
+
beforeprint: Event;
|
|
76
|
+
}
|
|
77
|
+
declare type DOMUtils_PrintEventType = keyof DOMUtils_PrintEvent;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 拖动事件
|
|
81
|
+
*/
|
|
82
|
+
declare interface DOMUtils_DragEvent {
|
|
83
|
+
drag: DragEvent;
|
|
84
|
+
dragend: DragEvent;
|
|
85
|
+
dragenter: DragEvent;
|
|
86
|
+
dragleave: DragEvent;
|
|
87
|
+
dragover: DragEvent;
|
|
88
|
+
dragstart: DragEvent;
|
|
89
|
+
drop: DragEvent;
|
|
90
|
+
}
|
|
91
|
+
declare type DOMUtils_DragEventType = keyof DOMUtils_DragEvent;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 多媒体(Media)事件
|
|
95
|
+
*/
|
|
96
|
+
declare interface DOMUtils_MediaEvent {
|
|
97
|
+
abort: Event;
|
|
98
|
+
canplay: Event;
|
|
99
|
+
canplaythrough: Event;
|
|
100
|
+
durationchange: Event;
|
|
101
|
+
emptied: Event;
|
|
102
|
+
ended: Event;
|
|
103
|
+
error: Event;
|
|
104
|
+
loadeddata: Event;
|
|
105
|
+
loadedmetadata: Event;
|
|
106
|
+
loadstart: Event;
|
|
107
|
+
pause: Event;
|
|
108
|
+
play: Event;
|
|
109
|
+
playing: Event;
|
|
110
|
+
progress: Event;
|
|
111
|
+
ratechange: Event;
|
|
112
|
+
seeked: Event;
|
|
113
|
+
seeking: Event;
|
|
114
|
+
stalled: Event;
|
|
115
|
+
suspend: Event;
|
|
116
|
+
timeupdate: Event;
|
|
117
|
+
volumechange: Event;
|
|
118
|
+
waiting: Event;
|
|
119
|
+
}
|
|
120
|
+
declare type DOMUtils_MediaEventType = keyof DOMUtils_MediaEvent;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* 动画事件
|
|
124
|
+
*/
|
|
125
|
+
declare interface DOMUtils_AnimationEvent {
|
|
126
|
+
animationend: AnimationEvent;
|
|
127
|
+
animationiteration: AnimationEvent;
|
|
128
|
+
animationstart: AnimationEvent;
|
|
129
|
+
}
|
|
130
|
+
declare type DOMUtils_AnimationEventType = keyof DOMUtils_AnimationEvent;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 过渡事件
|
|
134
|
+
*/
|
|
135
|
+
declare interface DOMUtils_TransitionEvent {
|
|
136
|
+
transitionend: TransitionEvent;
|
|
137
|
+
}
|
|
138
|
+
declare type DOMUtils_TransitionEventType = keyof DOMUtils_TransitionEvent;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* 触摸事件
|
|
142
|
+
*/
|
|
143
|
+
declare interface DOMUtils_TouchEvent {
|
|
144
|
+
touchstart: TouchEvent;
|
|
145
|
+
touchmove: TouchEvent;
|
|
146
|
+
touchend: TouchEvent;
|
|
147
|
+
touchcancel: TouchEvent;
|
|
148
|
+
touchenter: TouchEvent;
|
|
149
|
+
touchleave: TouchEvent;
|
|
150
|
+
}
|
|
151
|
+
declare type DOMUtils_TouchEventType = keyof DOMUtils_TouchEvent;
|
|
152
|
+
/**
|
|
153
|
+
* 其它事件
|
|
154
|
+
*/
|
|
155
|
+
declare interface DOMUtils_OtherEvent {
|
|
156
|
+
message: Event;
|
|
157
|
+
online: Event;
|
|
158
|
+
offline: Event;
|
|
159
|
+
popstate: Event;
|
|
160
|
+
show: Event;
|
|
161
|
+
storage: Event;
|
|
162
|
+
toggle: Event;
|
|
163
|
+
wheel: Event;
|
|
164
|
+
propertychange: Event;
|
|
165
|
+
fullscreenchange: Event;
|
|
166
|
+
DOMContentLoaded: Event;
|
|
167
|
+
}
|
|
168
|
+
declare type DOMUtils_OtherEventType = keyof DOMUtils_OtherEvent;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 全部事件
|
|
172
|
+
*/
|
|
173
|
+
export declare type DOMUtils_Event = DOMUtils_MouseEvent &
|
|
174
|
+
DOMUtils_KeyboardEvent &
|
|
175
|
+
DOMUtils_Frame_Object_Event &
|
|
176
|
+
DOMUtils_FormEvent &
|
|
177
|
+
DOMUtils_ClipboardEvent &
|
|
178
|
+
DOMUtils_PrintEvent &
|
|
179
|
+
DOMUtils_DragEvent &
|
|
180
|
+
DOMUtils_MediaEvent &
|
|
181
|
+
DOMUtils_AnimationEvent &
|
|
182
|
+
DOMUtils_TransitionEvent &
|
|
183
|
+
DOMUtils_TouchEvent &
|
|
184
|
+
DOMUtils_OtherEvent;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 事件类型
|
|
188
|
+
*/
|
|
189
|
+
export declare type DOMUtils_EventType = keyof DOMUtils_Event;
|
package/src/GBKEncoder.ts
CHANGED
package/src/Httpx.ts
CHANGED
package/src/LockFunction.ts
CHANGED