@whitesev/domutils 1.0.3 → 1.0.5

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/src/DOMUtils.ts CHANGED
@@ -2,6 +2,12 @@ import { CommonDOMUtils } from "./CommonDOMUtils";
2
2
  import { DOMUtilsCore } from "./DOMUtilsCore";
3
3
  import { DOMUtilsData } from "./Data";
4
4
  import { OriginPrototype } from "./OriginPrototype";
5
+ import type { DOMUtilsCoreOption, ParseHTMLReturnType } from "./global";
6
+ import type {
7
+ DOMUtilsCreateElementAttributesMap,
8
+ DOMUtils_EventType,
9
+ DOMUtilsEventListenerOptionsAttribute,
10
+ } from "./Event";
5
11
 
6
12
  class DOMUtils {
7
13
  constructor(option?: DOMUtilsCoreOption) {
@@ -1,3 +1,5 @@
1
+ import type { DOMUtilsCoreOption } from "./global";
2
+
1
3
  const DOMUtilsCoreDefaultEnv: DOMUtilsCoreOption = {
2
4
  document: document,
3
5
  window: window,
@@ -1,4 +1,5 @@
1
- declare type DOMUtilsCreateElementAttributesMap = {
1
+
2
+ export declare type DOMUtilsCreateElementAttributesMap = {
2
3
  style?: string;
3
4
  id?: string;
4
5
  class?: string;
@@ -11,7 +12,7 @@ declare type DOMUtilsCreateElementAttributesMap = {
11
12
  * + https://blog.csdn.net/weixin_68658847/article/details/126939879
12
13
  */
13
14
 
14
- interface DOMUtils_MouseEvent {
15
+ export interface DOMUtils_MouseEvent {
15
16
  click: MouseEvent | PointerEvent;
16
17
  contextmenu: MouseEvent | PointerEvent;
17
18
  dblclick: MouseEvent | PointerEvent;
@@ -23,20 +24,20 @@ interface DOMUtils_MouseEvent {
23
24
  mouseout: MouseEvent | PointerEvent;
24
25
  mouseup: MouseEvent | PointerEvent;
25
26
  }
26
- type DOMUtils_MouseEventType = keyof DOMUtils_MouseEvent;
27
+ export type DOMUtils_MouseEventType = keyof DOMUtils_MouseEvent;
27
28
  /**
28
29
  * 鼠标事件
29
30
  */
30
- interface DOMUtils_KeyboardEvent {
31
+ export interface DOMUtils_KeyboardEvent {
31
32
  keydown: KeyboardEvent;
32
33
  keypress: KeyboardEvent;
33
34
  keyup: KeyboardEvent;
34
35
  }
35
- type DOMUtils_KeyboardEventType = keyof DOMUtils_KeyboardEvent;
36
+ export type DOMUtils_KeyboardEventType = keyof DOMUtils_KeyboardEvent;
36
37
  /**
37
38
  * 框架/对象事件
38
39
  */
39
- interface DOMUtils_Frame_Object_Event {
40
+ export interface DOMUtils_Frame_Object_Event {
40
41
  abort: Event;
41
42
  beforeunload: Event;
42
43
  error: Event;
@@ -48,11 +49,11 @@ interface DOMUtils_Frame_Object_Event {
48
49
  scroll: Event;
49
50
  unload: Event;
50
51
  }
51
- type DOMUtils_Frame_Object_EventType = keyof DOMUtils_Frame_Object_Event;
52
+ export type DOMUtils_Frame_Object_EventType = keyof DOMUtils_Frame_Object_Event;
52
53
  /**
53
54
  * 表单事件
54
55
  */
55
- interface DOMUtils_FormEvent {
56
+ export interface DOMUtils_FormEvent {
56
57
  blur: Event;
57
58
  change: Event;
58
59
  focus: Event;
@@ -62,31 +63,31 @@ interface DOMUtils_FormEvent {
62
63
  reset: Event;
63
64
  search: Event;
64
65
  }
65
- type DOMUtils_FormEventType = keyof DOMUtils_FormEvent;
66
+ export type DOMUtils_FormEventType = keyof DOMUtils_FormEvent;
66
67
 
67
68
  /**
68
69
  * 剪贴板事件
69
70
  */
70
- interface DOMUtils_ClipboardEvent {
71
+ export interface DOMUtils_ClipboardEvent {
71
72
  copy: ClipboardEvent;
72
73
  cut: ClipboardEvent;
73
74
  paste: ClipboardEvent;
74
75
  }
75
- type DOMUtils_ClipboardEventType = keyof DOMUtils_ClipboardEvent;
76
+ export type DOMUtils_ClipboardEventType = keyof DOMUtils_ClipboardEvent;
76
77
 
77
78
  /**
78
79
  * 打印事件
79
80
  */
80
- interface DOMUtils_PrintEvent {
81
+ export interface DOMUtils_PrintEvent {
81
82
  afterprint: Event;
82
83
  beforeprint: Event;
83
84
  }
84
- type DOMUtils_PrintEventType = keyof DOMUtils_PrintEvent;
85
+ export type DOMUtils_PrintEventType = keyof DOMUtils_PrintEvent;
85
86
 
86
87
  /**
87
88
  * 拖动事件
88
89
  */
89
- interface DOMUtils_DragEvent {
90
+ export interface DOMUtils_DragEvent {
90
91
  drag: DragEvent;
91
92
  dragend: DragEvent;
92
93
  dragenter: DragEvent;
@@ -95,12 +96,12 @@ interface DOMUtils_DragEvent {
95
96
  dragstart: DragEvent;
96
97
  drop: DragEvent;
97
98
  }
98
- type DOMUtils_DragEventType = keyof DOMUtils_DragEvent;
99
+ export type DOMUtils_DragEventType = keyof DOMUtils_DragEvent;
99
100
 
100
101
  /**
101
102
  * 多媒体(Media)事件
102
103
  */
103
- interface DOMUtils_MediaEvent {
104
+ export interface DOMUtils_MediaEvent {
104
105
  abort: Event;
105
106
  canplay: Event;
106
107
  canplaythrough: Event;
@@ -124,30 +125,30 @@ interface DOMUtils_MediaEvent {
124
125
  volumechange: Event;
125
126
  waiting: Event;
126
127
  }
127
- type DOMUtils_MediaEventType = keyof DOMUtils_MediaEvent;
128
+ export type DOMUtils_MediaEventType = keyof DOMUtils_MediaEvent;
128
129
 
129
130
  /**
130
131
  * 动画事件
131
132
  */
132
- interface DOMUtils_AnimationEvent {
133
+ export interface DOMUtils_AnimationEvent {
133
134
  animationend: AnimationEvent;
134
135
  animationiteration: AnimationEvent;
135
136
  animationstart: AnimationEvent;
136
137
  }
137
- type DOMUtils_AnimationEventType = keyof DOMUtils_AnimationEvent;
138
+ export type DOMUtils_AnimationEventType = keyof DOMUtils_AnimationEvent;
138
139
 
139
140
  /**
140
141
  * 过渡事件
141
142
  */
142
- interface DOMUtils_TransitionEvent {
143
+ export interface DOMUtils_TransitionEvent {
143
144
  transitionend: TransitionEvent;
144
145
  }
145
- type DOMUtils_TransitionEventType = keyof DOMUtils_TransitionEvent;
146
+ export type DOMUtils_TransitionEventType = keyof DOMUtils_TransitionEvent;
146
147
 
147
148
  /**
148
149
  * 触摸事件
149
150
  */
150
- interface DOMUtils_TouchEvent {
151
+ export interface DOMUtils_TouchEvent {
151
152
  touchstart: TouchEvent;
152
153
  touchmove: TouchEvent;
153
154
  touchend: TouchEvent;
@@ -155,11 +156,11 @@ interface DOMUtils_TouchEvent {
155
156
  touchenter: TouchEvent;
156
157
  touchleave: TouchEvent;
157
158
  }
158
- type DOMUtils_TouchEventType = keyof DOMUtils_TouchEvent;
159
+ export type DOMUtils_TouchEventType = keyof DOMUtils_TouchEvent;
159
160
  /**
160
161
  * 其它事件
161
162
  */
162
- interface DOMUtils_OtherEvent {
163
+ export interface DOMUtils_OtherEvent {
163
164
  message: Event;
164
165
  online: Event;
165
166
  offline: Event;
@@ -172,12 +173,12 @@ interface DOMUtils_OtherEvent {
172
173
  fullscreenchange: Event;
173
174
  DOMContentLoaded: Event;
174
175
  }
175
- type DOMUtils_OtherEventType = keyof DOMUtils_OtherEvent;
176
+ export type DOMUtils_OtherEventType = keyof DOMUtils_OtherEvent;
176
177
 
177
178
  /**
178
179
  * 全部事件
179
180
  */
180
- declare type DOMUtils_Event = DOMUtils_MouseEvent &
181
+ export declare type DOMUtils_Event = DOMUtils_MouseEvent &
181
182
  DOMUtils_KeyboardEvent &
182
183
  DOMUtils_Frame_Object_Event &
183
184
  DOMUtils_FormEvent &
@@ -193,12 +194,12 @@ declare type DOMUtils_Event = DOMUtils_MouseEvent &
193
194
  /**
194
195
  * 事件类型
195
196
  */
196
- declare type DOMUtils_EventType = keyof DOMUtils_Event;
197
+ export declare type DOMUtils_EventType = keyof DOMUtils_Event;
197
198
 
198
199
  /**
199
200
  * 元素上的events属性
200
201
  */
201
- declare interface DOMUtilsEventListenerOptionsAttribute {
202
+ export declare interface DOMUtilsEventListenerOptionsAttribute {
202
203
  /**
203
204
  * 自定义的ownCallBack
204
205
  */
@@ -215,4 +216,4 @@ declare interface DOMUtilsEventListenerOptionsAttribute {
215
216
  * 子元素选择器
216
217
  */
217
218
  selector?: string;
218
- }
219
+ }
@@ -1,12 +1,13 @@
1
- type ParseHTMLReturnType<T1, T2> = T1 extends true
1
+ export type ParseHTMLReturnType<T1, T2> = T1 extends true
2
2
  ? T2 extends true
3
3
  ? Document
4
4
  : HTMLElement
5
5
  : HTMLElement;
6
6
 
7
- declare interface DOMUtilsCoreOption {
7
+ export interface DOMUtilsCoreOption {
8
8
  document: Document;
9
9
  window: Window;
10
10
  globalThis: typeof globalThis;
11
11
  self: typeof globalThis;
12
12
  }
13
+
package/tsconfig.json CHANGED
@@ -23,8 +23,7 @@
23
23
  "outDir": "./dist",
24
24
  // 输出.d.ts声明文件
25
25
  "declaration": true,
26
- "sourceMap": true,
27
- "typeRoots": ["./src/types"]
26
+ "sourceMap": true
28
27
  },
29
28
  // 包含src下的所有文件
30
29
  "include": ["src/**/*", "index.ts"]