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