@thienvu18/designable-shared 2.0.0 → 2.0.2
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/esm/animation.d.ts +8 -2
- package/esm/animation.js +29 -30
- package/esm/array.d.ts +163 -37
- package/esm/array.js +104 -87
- package/esm/clone.d.ts +4 -4
- package/esm/clone.js +79 -86
- package/esm/compose.d.ts +3 -1
- package/esm/compose.js +6 -6
- package/esm/coordinate.d.ts +120 -76
- package/esm/coordinate.js +480 -411
- package/esm/element.d.ts +11 -6
- package/esm/element.js +123 -125
- package/esm/event.d.ts +162 -75
- package/esm/event.js +197 -197
- package/esm/globalThisPolyfill.d.ts +1 -1
- package/esm/globalThisPolyfill.js +14 -17
- package/esm/index.d.ts +17 -17
- package/esm/index.js +17 -17
- package/esm/instanceof.d.ts +1 -1
- package/esm/instanceof.js +9 -10
- package/esm/keycode.d.ts +145 -145
- package/esm/keycode.js +149 -149
- package/esm/lru.d.ts +50 -47
- package/esm/lru.js +236 -245
- package/esm/observer.d.ts +7 -7
- package/esm/observer.js +37 -40
- package/esm/request-idle.d.ts +9 -6
- package/esm/request-idle.js +6 -6
- package/esm/scroller.d.ts +24 -8
- package/esm/scroller.js +78 -75
- package/esm/subscribable.d.ts +10 -10
- package/esm/subscribable.js +39 -40
- package/esm/types.d.ts +13 -13
- package/esm/types.js +19 -20
- package/esm/uid.d.ts +1 -1
- package/esm/uid.js +7 -7
- package/lib/animation.d.ts +8 -2
- package/lib/animation.js +34 -35
- package/lib/array.d.ts +163 -37
- package/lib/array.js +129 -101
- package/lib/clone.d.ts +4 -4
- package/lib/clone.js +84 -91
- package/lib/compose.d.ts +3 -1
- package/lib/compose.js +10 -10
- package/lib/coordinate.d.ts +120 -76
- package/lib/coordinate.js +538 -440
- package/lib/element.d.ts +11 -6
- package/lib/element.js +139 -133
- package/lib/event.d.ts +162 -75
- package/lib/event.js +206 -202
- package/lib/globalThisPolyfill.d.ts +1 -1
- package/lib/globalThisPolyfill.js +17 -20
- package/lib/index.d.ts +17 -17
- package/lib/index.js +49 -33
- package/lib/instanceof.d.ts +1 -1
- package/lib/instanceof.js +13 -14
- package/lib/keycode.d.ts +145 -145
- package/lib/keycode.js +153 -153
- package/lib/lru.d.ts +50 -47
- package/lib/lru.js +240 -249
- package/lib/observer.d.ts +7 -7
- package/lib/observer.js +41 -44
- package/lib/request-idle.d.ts +9 -6
- package/lib/request-idle.js +14 -11
- package/lib/scroller.d.ts +24 -8
- package/lib/scroller.js +89 -81
- package/lib/subscribable.d.ts +10 -10
- package/lib/subscribable.js +43 -44
- package/lib/types.d.ts +13 -13
- package/lib/types.js +40 -28
- package/lib/uid.d.ts +1 -1
- package/lib/uid.js +11 -11
- package/package.json +15 -15
package/lib/element.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { Point } from './coordinate'
|
|
2
|
-
export declare const calcElementOuterWidth: (
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
1
|
+
import { Point } from './coordinate'
|
|
2
|
+
export declare const calcElementOuterWidth: (
|
|
3
|
+
innerWidth: number,
|
|
4
|
+
style: CSSStyleDeclaration
|
|
5
|
+
) => number
|
|
6
|
+
export declare const calcElementLayout: (
|
|
7
|
+
element: Element
|
|
8
|
+
) => 'vertical' | 'horizontal'
|
|
9
|
+
export declare const calcElementTranslate: (element: HTMLElement) => Point
|
|
10
|
+
export declare const calcElementRotate: (element: HTMLElement) => number
|
|
11
|
+
export declare const calcElementScale: (element: HTMLElement) => number
|
package/lib/element.js
CHANGED
|
@@ -1,143 +1,149 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
exports.calcElementScale =
|
|
4
|
-
|
|
1
|
+
'use strict'
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true })
|
|
3
|
+
exports.calcElementScale =
|
|
4
|
+
exports.calcElementRotate =
|
|
5
|
+
exports.calcElementTranslate =
|
|
6
|
+
exports.calcElementLayout =
|
|
7
|
+
exports.calcElementOuterWidth =
|
|
8
|
+
void 0
|
|
9
|
+
const coordinate_1 = require('./coordinate')
|
|
5
10
|
const InlineLayoutTagNames = new Set([
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
])
|
|
11
|
+
'A',
|
|
12
|
+
'ABBR',
|
|
13
|
+
'ACRONYM',
|
|
14
|
+
'AUDIO',
|
|
15
|
+
'B',
|
|
16
|
+
'BDI',
|
|
17
|
+
'BDO',
|
|
18
|
+
'BIG',
|
|
19
|
+
'BR',
|
|
20
|
+
'BUTTON',
|
|
21
|
+
'CANVAS',
|
|
22
|
+
'CITE',
|
|
23
|
+
'CODE',
|
|
24
|
+
'DATA',
|
|
25
|
+
'DATALIST',
|
|
26
|
+
'DEL',
|
|
27
|
+
'DFN',
|
|
28
|
+
'EM',
|
|
29
|
+
'EMBED',
|
|
30
|
+
'I',
|
|
31
|
+
'IFRAME',
|
|
32
|
+
'IMG',
|
|
33
|
+
'INS',
|
|
34
|
+
'KBD',
|
|
35
|
+
'LABEL',
|
|
36
|
+
'MAP',
|
|
37
|
+
'MARK',
|
|
38
|
+
'METER',
|
|
39
|
+
'NOSCRIPT',
|
|
40
|
+
'OBJECT',
|
|
41
|
+
'OUTPUT',
|
|
42
|
+
'PICTURE',
|
|
43
|
+
'PROGRESS',
|
|
44
|
+
'Q',
|
|
45
|
+
'RUBY',
|
|
46
|
+
'S',
|
|
47
|
+
'SAMP',
|
|
48
|
+
'SELECT',
|
|
49
|
+
'SLOT',
|
|
50
|
+
'SMALL',
|
|
51
|
+
'STRONG',
|
|
52
|
+
'SUB',
|
|
53
|
+
'SUP',
|
|
54
|
+
'SVG',
|
|
55
|
+
'TEMPLATE',
|
|
56
|
+
'TEXTAREA',
|
|
57
|
+
'TIME',
|
|
58
|
+
'U',
|
|
59
|
+
'TT',
|
|
60
|
+
'VAR',
|
|
61
|
+
'VIDEO',
|
|
62
|
+
'WBR',
|
|
63
|
+
'INPUT',
|
|
64
|
+
'SPAN',
|
|
65
|
+
])
|
|
61
66
|
const calcElementOuterWidth = (innerWidth, style) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
return (
|
|
68
|
+
innerWidth +
|
|
69
|
+
parseFloat(style.marginLeft) +
|
|
70
|
+
parseFloat(style.marginRight) +
|
|
71
|
+
parseFloat(style.paddingLeft) +
|
|
72
|
+
parseFloat(style.paddingRight) +
|
|
73
|
+
parseFloat(style.borderLeftWidth) +
|
|
74
|
+
parseFloat(style.borderRightWidth)
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
exports.calcElementOuterWidth = calcElementOuterWidth
|
|
71
78
|
const calcElementLayout = (element) => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
if (!element) return 'vertical'
|
|
80
|
+
const parent = element.parentElement
|
|
81
|
+
if (!parent) return 'vertical'
|
|
82
|
+
const tagName = element.tagName
|
|
83
|
+
const parentTagName = parent.tagName
|
|
84
|
+
const style = getComputedStyle(element)
|
|
85
|
+
const parentStyle = getComputedStyle(parent)
|
|
86
|
+
const isNotFullWidth = () => {
|
|
87
|
+
const innerWidth = element.getBoundingClientRect().width
|
|
88
|
+
const outerWidth = (0, exports.calcElementOuterWidth)(innerWidth, style)
|
|
89
|
+
const parentInnerWidth = parent.getBoundingClientRect().width
|
|
90
|
+
return outerWidth.toFixed(0) < parentInnerWidth.toFixed(0)
|
|
91
|
+
}
|
|
92
|
+
if (tagName === 'TH' || tagName === 'TD') {
|
|
93
|
+
if (parentTagName === 'TR') return 'horizontal'
|
|
94
|
+
}
|
|
95
|
+
if (parentStyle.display === 'flex' && parentStyle.flexDirection === 'row')
|
|
96
|
+
return 'horizontal'
|
|
97
|
+
if (parentStyle.display === 'grid') {
|
|
98
|
+
if (isNotFullWidth()) {
|
|
99
|
+
return 'horizontal'
|
|
90
100
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (
|
|
101
|
+
}
|
|
102
|
+
if (InlineLayoutTagNames.has(tagName)) {
|
|
103
|
+
if (style.display === 'block') {
|
|
104
|
+
if (style.float === 'left' || style.float === 'right') {
|
|
94
105
|
if (isNotFullWidth()) {
|
|
95
|
-
|
|
106
|
+
return 'horizontal'
|
|
96
107
|
}
|
|
108
|
+
}
|
|
109
|
+
return 'vertical'
|
|
97
110
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return 'horizontal';
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
return 'vertical';
|
|
106
|
-
}
|
|
107
|
-
return 'horizontal';
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
exports.calcElementLayout = calcElementLayout;
|
|
111
|
+
return 'horizontal'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.calcElementLayout = calcElementLayout
|
|
111
115
|
const calcElementTranslate = (element) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
const transform = element?.style?.transform
|
|
117
|
+
if (transform) {
|
|
118
|
+
const [x, y] = transform
|
|
119
|
+
.match(
|
|
120
|
+
/translate(?:3d)?\(\s*([-\d.]+)[a-z]+?[\s,]+([-\d.]+)[a-z]+?(?:[\s,]+([-\d.]+))?[a-z]+?\s*\)/
|
|
121
|
+
)
|
|
122
|
+
?.slice(1, 3) ?? [0, 0]
|
|
123
|
+
return new coordinate_1.Point(Number(x), Number(y))
|
|
124
|
+
} else {
|
|
125
|
+
return new coordinate_1.Point(
|
|
126
|
+
Number(element.offsetLeft),
|
|
127
|
+
Number(element.offsetTop)
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.calcElementTranslate = calcElementTranslate
|
|
124
132
|
const calcElementRotate = (element) => {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
exports.calcElementRotate = calcElementRotate;
|
|
133
|
+
const transform = element?.style?.transform
|
|
134
|
+
if (transform) {
|
|
135
|
+
return Number(transform.match(/rotate\(\s*([-\d.]+)/)?.[1] ?? 0)
|
|
136
|
+
} else {
|
|
137
|
+
return 0
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
exports.calcElementRotate = calcElementRotate
|
|
134
141
|
const calcElementScale = (element) => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
exports.calcElementScale = calcElementScale;
|
|
142
|
+
const transform = element?.style?.transform
|
|
143
|
+
if (transform) {
|
|
144
|
+
return Number(transform.match(/scale\(\s*([-\d.]+)/)?.[1] ?? 0)
|
|
145
|
+
} else {
|
|
146
|
+
return 0
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
exports.calcElementScale = calcElementScale
|
package/lib/event.d.ts
CHANGED
|
@@ -1,96 +1,183 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type EventOptions =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ISubscriber, Subscribable } from './subscribable'
|
|
2
|
+
export type EventOptions =
|
|
3
|
+
| boolean
|
|
4
|
+
| (AddEventListenerOptions &
|
|
5
|
+
EventListenerOptions & {
|
|
6
|
+
mode?: 'onlyOne' | 'onlyParent' | 'onlyChild'
|
|
7
|
+
})
|
|
8
|
+
export type EventContainer = Window | HTMLElement | HTMLDocument
|
|
9
|
+
export type EventDriverContainer = HTMLElement | HTMLDocument
|
|
7
10
|
export interface IEventEffect<T> {
|
|
8
|
-
|
|
11
|
+
(engine: T): void
|
|
9
12
|
}
|
|
10
13
|
export interface IEventDriver {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
container: EventDriverContainer
|
|
15
|
+
contentWindow: Window
|
|
16
|
+
attach(container: EventDriverContainer): void
|
|
17
|
+
detach(container: EventDriverContainer): void
|
|
18
|
+
dispatch<T extends ICustomEvent<any> = any>(event: T): void | boolean
|
|
19
|
+
subscribe<T extends ICustomEvent<any> = any>(subscriber: ISubscriber<T>): void
|
|
20
|
+
addEventListener<K extends keyof HTMLElementEventMap>(
|
|
21
|
+
type: K,
|
|
22
|
+
listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
|
|
23
|
+
options?: boolean | EventOptions
|
|
24
|
+
): void
|
|
25
|
+
addEventListener(
|
|
26
|
+
type: string,
|
|
27
|
+
listener: EventListenerOrEventListenerObject,
|
|
28
|
+
options?: boolean | EventOptions
|
|
29
|
+
): void
|
|
30
|
+
addEventListener(type: any, listener: any, options: any): void
|
|
31
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(
|
|
32
|
+
type: K,
|
|
33
|
+
listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
|
|
34
|
+
options?: boolean | EventOptions
|
|
35
|
+
): void
|
|
36
|
+
removeEventListener(
|
|
37
|
+
type: string,
|
|
38
|
+
listener: EventListenerOrEventListenerObject,
|
|
39
|
+
options?: boolean | EventOptions
|
|
40
|
+
): void
|
|
41
|
+
removeEventListener(type: any, listener: any, options?: any): void
|
|
42
|
+
batchAddEventListener<K extends keyof HTMLElementEventMap>(
|
|
43
|
+
type: K,
|
|
44
|
+
listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
|
|
45
|
+
options?: boolean | EventOptions
|
|
46
|
+
): void
|
|
47
|
+
batchAddEventListener(
|
|
48
|
+
type: string,
|
|
49
|
+
listener: EventListenerOrEventListenerObject,
|
|
50
|
+
options?: boolean | EventOptions
|
|
51
|
+
): void
|
|
52
|
+
batchAddEventListener(type: any, listener: any, options?: any): void
|
|
53
|
+
batchRemoveEventListener<K extends keyof HTMLElementEventMap>(
|
|
54
|
+
type: K,
|
|
55
|
+
listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
|
|
56
|
+
options?: boolean | EventOptions
|
|
57
|
+
): void
|
|
58
|
+
batchRemoveEventListener(
|
|
59
|
+
type: string,
|
|
60
|
+
listener: EventListenerOrEventListenerObject,
|
|
61
|
+
options?: boolean | EventOptions
|
|
62
|
+
): void
|
|
63
|
+
batchRemoveEventListener(type: any, listener: any, options: any): void
|
|
29
64
|
}
|
|
30
65
|
export interface IEventDriverClass<T> {
|
|
31
|
-
|
|
66
|
+
new (engine: T, context?: any): IEventDriver
|
|
32
67
|
}
|
|
33
68
|
export interface ICustomEvent<EventData = any, EventContext = any> {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
69
|
+
type: string
|
|
70
|
+
data?: EventData
|
|
71
|
+
context?: EventContext
|
|
37
72
|
}
|
|
38
73
|
export interface CustomEventClass {
|
|
39
|
-
|
|
74
|
+
new (...args: any[]): any
|
|
40
75
|
}
|
|
41
76
|
export interface IEventProps<T = Event> {
|
|
42
|
-
|
|
43
|
-
|
|
77
|
+
drivers?: IEventDriverClass<T>[]
|
|
78
|
+
effects?: IEventEffect<T>[]
|
|
44
79
|
}
|
|
45
80
|
/**
|
|
46
81
|
* 事件驱动器基类
|
|
47
82
|
*/
|
|
48
|
-
export declare class EventDriver<Engine extends Event = Event, Context = any>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
83
|
+
export declare class EventDriver<Engine extends Event = Event, Context = any>
|
|
84
|
+
implements IEventDriver
|
|
85
|
+
{
|
|
86
|
+
engine: Engine
|
|
87
|
+
container: EventDriverContainer
|
|
88
|
+
contentWindow: Window
|
|
89
|
+
context: Context
|
|
90
|
+
constructor(engine: Engine, context?: Context)
|
|
91
|
+
dispatch<T extends ICustomEvent<any> = any>(event: T): boolean
|
|
92
|
+
subscribe<T extends ICustomEvent<any> = any>(
|
|
93
|
+
subscriber: ISubscriber<T>
|
|
94
|
+
): {
|
|
95
|
+
(): void
|
|
96
|
+
[UNSUBSCRIBE_ID_SYMBOL]: number
|
|
97
|
+
}
|
|
98
|
+
subscribeTo<T extends CustomEventClass>(
|
|
99
|
+
type: T,
|
|
100
|
+
subscriber: ISubscriber<InstanceType<T>>
|
|
101
|
+
): {
|
|
102
|
+
(): void
|
|
103
|
+
[UNSUBSCRIBE_ID_SYMBOL]: number
|
|
104
|
+
}
|
|
105
|
+
subscribeWith<T extends ICustomEvent = ICustomEvent>(
|
|
106
|
+
type: string | string[],
|
|
107
|
+
subscriber: ISubscriber<T>
|
|
108
|
+
): {
|
|
109
|
+
(): void
|
|
110
|
+
[UNSUBSCRIBE_ID_SYMBOL]: number
|
|
111
|
+
}
|
|
112
|
+
attach(container: EventDriverContainer): void
|
|
113
|
+
detach(container: EventDriverContainer): void
|
|
114
|
+
eventTarget(type: string): Window | EventDriverContainer
|
|
115
|
+
addEventListener<K extends keyof HTMLElementEventMap>(
|
|
116
|
+
type: K,
|
|
117
|
+
listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
|
|
118
|
+
options?: boolean | EventOptions
|
|
119
|
+
): void
|
|
120
|
+
addEventListener(
|
|
121
|
+
type: string,
|
|
122
|
+
listener: EventListenerOrEventListenerObject,
|
|
123
|
+
options?: boolean | EventOptions
|
|
124
|
+
): void
|
|
125
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(
|
|
126
|
+
type: K,
|
|
127
|
+
listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
|
|
128
|
+
options?: boolean | EventOptions
|
|
129
|
+
): void
|
|
130
|
+
removeEventListener(
|
|
131
|
+
type: string,
|
|
132
|
+
listener: EventListenerOrEventListenerObject,
|
|
133
|
+
options?: boolean | EventOptions
|
|
134
|
+
): void
|
|
135
|
+
batchAddEventListener<K extends keyof HTMLElementEventMap>(
|
|
136
|
+
type: K,
|
|
137
|
+
listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
|
|
138
|
+
options?: boolean | EventOptions
|
|
139
|
+
): void
|
|
140
|
+
batchAddEventListener(
|
|
141
|
+
type: string,
|
|
142
|
+
listener: EventListenerOrEventListenerObject,
|
|
143
|
+
options?: boolean | EventOptions
|
|
144
|
+
): void
|
|
145
|
+
batchRemoveEventListener<K extends keyof HTMLElementEventMap>(
|
|
146
|
+
type: K,
|
|
147
|
+
listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any,
|
|
148
|
+
options?: boolean | EventOptions
|
|
149
|
+
): void
|
|
150
|
+
batchRemoveEventListener(
|
|
151
|
+
type: string,
|
|
152
|
+
listener: EventListenerOrEventListenerObject,
|
|
153
|
+
options?: boolean | EventOptions
|
|
154
|
+
): void
|
|
78
155
|
}
|
|
79
156
|
/**
|
|
80
157
|
* 事件引擎
|
|
81
158
|
*/
|
|
82
159
|
export declare class Event extends Subscribable<ICustomEvent<any>> {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
160
|
+
private drivers
|
|
161
|
+
private containers
|
|
162
|
+
constructor(props?: IEventProps)
|
|
163
|
+
subscribeTo<T extends CustomEventClass>(
|
|
164
|
+
type: T,
|
|
165
|
+
subscriber: ISubscriber<InstanceType<T>>
|
|
166
|
+
): {
|
|
167
|
+
(): void
|
|
168
|
+
[UNSUBSCRIBE_ID_SYMBOL]: number
|
|
169
|
+
}
|
|
170
|
+
subscribeWith<T extends ICustomEvent = ICustomEvent>(
|
|
171
|
+
type: string | string[],
|
|
172
|
+
subscriber: ISubscriber<T>
|
|
173
|
+
): {
|
|
174
|
+
(): void
|
|
175
|
+
[UNSUBSCRIBE_ID_SYMBOL]: number
|
|
176
|
+
}
|
|
177
|
+
attachEvents(
|
|
178
|
+
container: EventContainer,
|
|
179
|
+
contentWindow?: Window,
|
|
180
|
+
context?: any
|
|
181
|
+
): any
|
|
182
|
+
detachEvents(container?: EventContainer): any
|
|
96
183
|
}
|