@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/esm/event.js
CHANGED
|
@@ -1,212 +1,212 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Subscribable } from './subscribable'
|
|
3
|
-
import {
|
|
4
|
-
const ATTACHED_SYMBOL = Symbol('ATTACHED_SYMBOL')
|
|
5
|
-
const EVENTS_SYMBOL = Symbol('__EVENTS_SYMBOL__')
|
|
6
|
-
const EVENTS_ONCE_SYMBOL = Symbol('EVENTS_ONCE_SYMBOL')
|
|
7
|
-
const EVENTS_BATCH_SYMBOL = Symbol('EVENTS_BATCH_SYMBOL')
|
|
8
|
-
const DRIVER_INSTANCES_SYMBOL = Symbol('DRIVER_INSTANCES_SYMBOL')
|
|
9
|
-
const isOnlyMode = (mode) =>
|
|
1
|
+
import { globalThisPolyfill } from './globalThisPolyfill'
|
|
2
|
+
import { Subscribable } from './subscribable'
|
|
3
|
+
import { isArr, isWindow } from './types'
|
|
4
|
+
const ATTACHED_SYMBOL = Symbol('ATTACHED_SYMBOL')
|
|
5
|
+
const EVENTS_SYMBOL = Symbol('__EVENTS_SYMBOL__')
|
|
6
|
+
const EVENTS_ONCE_SYMBOL = Symbol('EVENTS_ONCE_SYMBOL')
|
|
7
|
+
const EVENTS_BATCH_SYMBOL = Symbol('EVENTS_BATCH_SYMBOL')
|
|
8
|
+
const DRIVER_INSTANCES_SYMBOL = Symbol('DRIVER_INSTANCES_SYMBOL')
|
|
9
|
+
const isOnlyMode = (mode) =>
|
|
10
|
+
mode === 'onlyOne' || mode === 'onlyChild' || mode === 'onlyParent'
|
|
10
11
|
/**
|
|
11
12
|
* 事件驱动器基类
|
|
12
13
|
*/
|
|
13
14
|
export class EventDriver {
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
target.addEventListener(type, listener, options);
|
|
70
|
-
target[EVENTS_ONCE_SYMBOL][type] = listener;
|
|
71
|
-
constructor[EVENTS_ONCE_SYMBOL][type] = target;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
target[EVENTS_SYMBOL] = target[EVENTS_SYMBOL] || {};
|
|
76
|
-
target[EVENTS_SYMBOL][type] = target[EVENTS_SYMBOL][type] || new Map();
|
|
77
|
-
if (!target[EVENTS_SYMBOL][type]?.get?.(listener)) {
|
|
78
|
-
target.addEventListener(type, listener, options);
|
|
79
|
-
target[EVENTS_SYMBOL][type]?.set?.(listener, true);
|
|
15
|
+
constructor(engine, context) {
|
|
16
|
+
this.container = document
|
|
17
|
+
this.contentWindow = globalThisPolyfill
|
|
18
|
+
this.engine = engine
|
|
19
|
+
this.context = context
|
|
20
|
+
}
|
|
21
|
+
dispatch(event) {
|
|
22
|
+
return this.engine.dispatch(event, this.context)
|
|
23
|
+
}
|
|
24
|
+
subscribe(subscriber) {
|
|
25
|
+
return this.engine.subscribe(subscriber)
|
|
26
|
+
}
|
|
27
|
+
subscribeTo(type, subscriber) {
|
|
28
|
+
return this.engine.subscribeTo(type, subscriber)
|
|
29
|
+
}
|
|
30
|
+
subscribeWith(type, subscriber) {
|
|
31
|
+
return this.engine.subscribeWith(type, subscriber)
|
|
32
|
+
}
|
|
33
|
+
attach(container) {
|
|
34
|
+
void container
|
|
35
|
+
console.error('attach must implement.')
|
|
36
|
+
}
|
|
37
|
+
detach(container) {
|
|
38
|
+
void container
|
|
39
|
+
console.error('attach must implement.')
|
|
40
|
+
}
|
|
41
|
+
eventTarget(type) {
|
|
42
|
+
if (type === 'resize' || type === 'scroll') {
|
|
43
|
+
if (this.container === this.contentWindow?.document) {
|
|
44
|
+
return this.contentWindow
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return this.container
|
|
48
|
+
}
|
|
49
|
+
addEventListener(type, listener, options) {
|
|
50
|
+
const target = this.eventTarget(type)
|
|
51
|
+
if (isOnlyMode(options?.mode)) {
|
|
52
|
+
target[EVENTS_ONCE_SYMBOL] = target[EVENTS_ONCE_SYMBOL] || {}
|
|
53
|
+
const constructor = this['constructor']
|
|
54
|
+
constructor[EVENTS_ONCE_SYMBOL] = constructor[EVENTS_ONCE_SYMBOL] || {}
|
|
55
|
+
const handler = target[EVENTS_ONCE_SYMBOL][type]
|
|
56
|
+
const container = constructor[EVENTS_ONCE_SYMBOL][type]
|
|
57
|
+
if (!handler) {
|
|
58
|
+
if (container) {
|
|
59
|
+
if (options.mode === 'onlyChild') {
|
|
60
|
+
if (container.contains(target)) {
|
|
61
|
+
container.removeEventListener(
|
|
62
|
+
type,
|
|
63
|
+
container[EVENTS_ONCE_SYMBOL][type],
|
|
64
|
+
options
|
|
65
|
+
)
|
|
66
|
+
delete container[EVENTS_ONCE_SYMBOL][type]
|
|
80
67
|
}
|
|
68
|
+
} else if (options.mode === 'onlyParent') {
|
|
69
|
+
if (container.contains(target)) return
|
|
70
|
+
}
|
|
81
71
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
72
|
+
target.addEventListener(type, listener, options)
|
|
73
|
+
target[EVENTS_ONCE_SYMBOL][type] = listener
|
|
74
|
+
constructor[EVENTS_ONCE_SYMBOL][type] = target
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
target[EVENTS_SYMBOL] = target[EVENTS_SYMBOL] || {}
|
|
78
|
+
target[EVENTS_SYMBOL][type] = target[EVENTS_SYMBOL][type] || new Map()
|
|
79
|
+
if (!target[EVENTS_SYMBOL][type]?.get?.(listener)) {
|
|
80
|
+
target.addEventListener(type, listener, options)
|
|
81
|
+
target[EVENTS_SYMBOL][type]?.set?.(listener, true)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
removeEventListener(type, listener, options) {
|
|
86
|
+
const target = this.eventTarget(type)
|
|
87
|
+
if (isOnlyMode(options?.mode)) {
|
|
88
|
+
const constructor = this['constructor']
|
|
89
|
+
constructor[EVENTS_ONCE_SYMBOL] = constructor[EVENTS_ONCE_SYMBOL] || {}
|
|
90
|
+
target[EVENTS_ONCE_SYMBOL] = target[EVENTS_ONCE_SYMBOL] || {}
|
|
91
|
+
delete constructor[EVENTS_ONCE_SYMBOL][type]
|
|
92
|
+
delete target[EVENTS_ONCE_SYMBOL][type]
|
|
93
|
+
target.removeEventListener(type, listener, options)
|
|
94
|
+
} else {
|
|
95
|
+
target[EVENTS_SYMBOL] = target[EVENTS_SYMBOL] || {}
|
|
96
|
+
target[EVENTS_SYMBOL][type] = target[EVENTS_SYMBOL][type] || new Map()
|
|
97
|
+
target[EVENTS_SYMBOL][type]?.delete?.(listener)
|
|
98
|
+
target.removeEventListener(type, listener, options)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
batchAddEventListener(type, listener, options) {
|
|
102
|
+
this.engine[DRIVER_INSTANCES_SYMBOL] =
|
|
103
|
+
this.engine[DRIVER_INSTANCES_SYMBOL] || []
|
|
104
|
+
if (!this.engine[DRIVER_INSTANCES_SYMBOL].includes(this)) {
|
|
105
|
+
this.engine[DRIVER_INSTANCES_SYMBOL].push(this)
|
|
106
|
+
}
|
|
107
|
+
this.engine[DRIVER_INSTANCES_SYMBOL].forEach((driver) => {
|
|
108
|
+
const target = driver.eventTarget(type)
|
|
109
|
+
target[EVENTS_BATCH_SYMBOL] = target[EVENTS_BATCH_SYMBOL] || {}
|
|
110
|
+
if (!target[EVENTS_BATCH_SYMBOL][type]) {
|
|
111
|
+
target.addEventListener(type, listener, options)
|
|
112
|
+
target[EVENTS_BATCH_SYMBOL][type] = listener
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
batchRemoveEventListener(type, listener, options) {
|
|
117
|
+
this.engine[DRIVER_INSTANCES_SYMBOL] =
|
|
118
|
+
this.engine[DRIVER_INSTANCES_SYMBOL] || []
|
|
119
|
+
this.engine[DRIVER_INSTANCES_SYMBOL].forEach((driver) => {
|
|
120
|
+
const target = driver.eventTarget(type)
|
|
121
|
+
target[EVENTS_BATCH_SYMBOL] = target[EVENTS_BATCH_SYMBOL] || {}
|
|
122
|
+
target.removeEventListener(type, listener, options)
|
|
123
|
+
delete target[EVENTS_BATCH_SYMBOL][type]
|
|
124
|
+
})
|
|
125
|
+
}
|
|
125
126
|
}
|
|
126
127
|
/**
|
|
127
128
|
* 事件引擎
|
|
128
129
|
*/
|
|
129
130
|
export class Event extends Subscribable {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
if (type && event?.type === type) {
|
|
159
|
-
return subscriber(event);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
attachEvents(container, contentWindow = globalThisPolyfill, context) {
|
|
165
|
-
if (!container)
|
|
166
|
-
return;
|
|
167
|
-
if (isWindow(container)) {
|
|
168
|
-
return this.attachEvents(container.document, container, context);
|
|
131
|
+
constructor(props) {
|
|
132
|
+
super()
|
|
133
|
+
this.drivers = []
|
|
134
|
+
this.containers = []
|
|
135
|
+
if (isArr(props?.effects)) {
|
|
136
|
+
props.effects.forEach((plugin) => {
|
|
137
|
+
plugin(this)
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
if (isArr(props?.drivers)) {
|
|
141
|
+
this.drivers = props.drivers
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
subscribeTo(type, subscriber) {
|
|
145
|
+
return this.subscribe((event) => {
|
|
146
|
+
if (type && event instanceof type) {
|
|
147
|
+
return subscriber(event)
|
|
148
|
+
}
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
subscribeWith(type, subscriber) {
|
|
152
|
+
return this.subscribe((event) => {
|
|
153
|
+
if (isArr(type)) {
|
|
154
|
+
if (type.includes(event?.type)) {
|
|
155
|
+
return subscriber(event)
|
|
169
156
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const driver = new EventDriver(this, context);
|
|
174
|
-
driver.contentWindow = contentWindow;
|
|
175
|
-
driver.container = container;
|
|
176
|
-
driver.attach(container);
|
|
177
|
-
return driver;
|
|
178
|
-
});
|
|
179
|
-
if (!this.containers.includes(container)) {
|
|
180
|
-
this.containers.push(container);
|
|
157
|
+
} else {
|
|
158
|
+
if (type && event?.type === type) {
|
|
159
|
+
return subscriber(event)
|
|
181
160
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
attachEvents(container, contentWindow = globalThisPolyfill, context) {
|
|
165
|
+
if (!container) return
|
|
166
|
+
if (isWindow(container)) {
|
|
167
|
+
return this.attachEvents(container.document, container, context)
|
|
168
|
+
}
|
|
169
|
+
if (container[ATTACHED_SYMBOL]) return
|
|
170
|
+
container[ATTACHED_SYMBOL] = this.drivers.map((EventDriver) => {
|
|
171
|
+
const driver = new EventDriver(this, context)
|
|
172
|
+
driver.contentWindow = contentWindow
|
|
173
|
+
driver.container = container
|
|
174
|
+
driver.attach(container)
|
|
175
|
+
return driver
|
|
176
|
+
})
|
|
177
|
+
if (!this.containers.includes(container)) {
|
|
178
|
+
this.containers.push(container)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
detachEvents(container) {
|
|
182
|
+
if (!container) {
|
|
183
|
+
this.containers.forEach((container) => {
|
|
184
|
+
this.detachEvents(container)
|
|
185
|
+
})
|
|
186
|
+
return
|
|
187
|
+
}
|
|
188
|
+
if (isWindow(container)) {
|
|
189
|
+
return this.detachEvents(container.document)
|
|
190
|
+
}
|
|
191
|
+
if (!container[ATTACHED_SYMBOL]) return
|
|
192
|
+
container[ATTACHED_SYMBOL].forEach((driver) => {
|
|
193
|
+
driver.detach(container)
|
|
194
|
+
})
|
|
195
|
+
this[DRIVER_INSTANCES_SYMBOL] = this[DRIVER_INSTANCES_SYMBOL] || []
|
|
196
|
+
this[DRIVER_INSTANCES_SYMBOL] = this[DRIVER_INSTANCES_SYMBOL].reduce(
|
|
197
|
+
(drivers, driver) => {
|
|
198
|
+
if (driver.container === container) {
|
|
199
|
+
driver.detach(container)
|
|
200
|
+
return drivers
|
|
192
201
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
return drivers.concat(driver);
|
|
205
|
-
}, []);
|
|
206
|
-
this.containers = this.containers.filter((item) => item !== container);
|
|
207
|
-
delete container[ATTACHED_SYMBOL];
|
|
208
|
-
delete container[EVENTS_SYMBOL];
|
|
209
|
-
delete container[EVENTS_ONCE_SYMBOL];
|
|
210
|
-
delete container[EVENTS_BATCH_SYMBOL];
|
|
211
|
-
}
|
|
202
|
+
return drivers.concat(driver)
|
|
203
|
+
},
|
|
204
|
+
[]
|
|
205
|
+
)
|
|
206
|
+
this.containers = this.containers.filter((item) => item !== container)
|
|
207
|
+
delete container[ATTACHED_SYMBOL]
|
|
208
|
+
delete container[EVENTS_SYMBOL]
|
|
209
|
+
delete container[EVENTS_ONCE_SYMBOL]
|
|
210
|
+
delete container[EVENTS_BATCH_SYMBOL]
|
|
211
|
+
}
|
|
212
212
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const globalThisPolyfill: Window
|
|
1
|
+
export declare const globalThisPolyfill: Window
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
function getGlobalThis() {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
2
|
+
try {
|
|
3
|
+
if (typeof self !== 'undefined') {
|
|
4
|
+
return self
|
|
6
5
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
6
|
+
} catch (e) {}
|
|
7
|
+
try {
|
|
8
|
+
if (typeof globalThisPolyfill !== 'undefined') {
|
|
9
|
+
return globalThisPolyfill
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
11
|
+
} catch (e) {}
|
|
12
|
+
try {
|
|
13
|
+
if (typeof global !== 'undefined') {
|
|
14
|
+
return global
|
|
18
15
|
}
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
} catch (e) {}
|
|
17
|
+
return Function('return this')()
|
|
21
18
|
}
|
|
22
|
-
export const globalThisPolyfill = getGlobalThis()
|
|
19
|
+
export const globalThisPolyfill = getGlobalThis()
|
package/esm/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
1
|
+
export * from './animation'
|
|
2
|
+
export * from './array'
|
|
3
|
+
export * from './clone'
|
|
4
|
+
export * from './compose'
|
|
5
|
+
export * from './coordinate'
|
|
6
|
+
export * from './element'
|
|
7
|
+
export * from './event'
|
|
8
|
+
export * from './globalThisPolyfill'
|
|
9
|
+
export * from './instanceof'
|
|
10
|
+
export * from './keycode'
|
|
11
|
+
export * from './lru'
|
|
12
|
+
export * from './observer'
|
|
13
|
+
export * from './request-idle'
|
|
14
|
+
export * from './scroller'
|
|
15
|
+
export * from './subscribable'
|
|
16
|
+
export * from './types'
|
|
17
|
+
export * from './uid'
|
package/esm/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
1
|
+
export * from './animation'
|
|
2
|
+
export * from './array'
|
|
3
|
+
export * from './clone'
|
|
4
|
+
export * from './compose'
|
|
5
|
+
export * from './coordinate'
|
|
6
|
+
export * from './element'
|
|
7
|
+
export * from './event'
|
|
8
|
+
export * from './globalThisPolyfill'
|
|
9
|
+
export * from './instanceof'
|
|
10
|
+
export * from './keycode'
|
|
11
|
+
export * from './lru'
|
|
12
|
+
export * from './observer'
|
|
13
|
+
export * from './request-idle'
|
|
14
|
+
export * from './scroller'
|
|
15
|
+
export * from './subscribable'
|
|
16
|
+
export * from './types'
|
|
17
|
+
export * from './uid'
|
package/esm/instanceof.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const instOf: (value: any, cls: any) => boolean
|
|
1
|
+
export declare const instOf: (value: any, cls: any) => boolean
|
package/esm/instanceof.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { globalThisPolyfill } from './globalThisPolyfill'
|
|
2
|
+
import { isFn, isStr } from './types'
|
|
3
3
|
export const instOf = (value, cls) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
4
|
+
if (isFn(cls)) return value instanceof cls
|
|
5
|
+
if (isStr(cls))
|
|
6
|
+
return globalThisPolyfill[cls]
|
|
7
|
+
? value instanceof globalThisPolyfill[cls]
|
|
8
|
+
: false
|
|
9
|
+
return false
|
|
10
|
+
}
|