@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.
Files changed (73) hide show
  1. package/esm/animation.d.ts +8 -2
  2. package/esm/animation.js +29 -30
  3. package/esm/array.d.ts +163 -37
  4. package/esm/array.js +104 -87
  5. package/esm/clone.d.ts +4 -4
  6. package/esm/clone.js +79 -86
  7. package/esm/compose.d.ts +3 -1
  8. package/esm/compose.js +6 -6
  9. package/esm/coordinate.d.ts +120 -76
  10. package/esm/coordinate.js +480 -411
  11. package/esm/element.d.ts +11 -6
  12. package/esm/element.js +123 -125
  13. package/esm/event.d.ts +162 -75
  14. package/esm/event.js +197 -197
  15. package/esm/globalThisPolyfill.d.ts +1 -1
  16. package/esm/globalThisPolyfill.js +14 -17
  17. package/esm/index.d.ts +17 -17
  18. package/esm/index.js +17 -17
  19. package/esm/instanceof.d.ts +1 -1
  20. package/esm/instanceof.js +9 -10
  21. package/esm/keycode.d.ts +145 -145
  22. package/esm/keycode.js +149 -149
  23. package/esm/lru.d.ts +50 -47
  24. package/esm/lru.js +236 -245
  25. package/esm/observer.d.ts +7 -7
  26. package/esm/observer.js +37 -40
  27. package/esm/request-idle.d.ts +9 -6
  28. package/esm/request-idle.js +6 -6
  29. package/esm/scroller.d.ts +24 -8
  30. package/esm/scroller.js +78 -75
  31. package/esm/subscribable.d.ts +10 -10
  32. package/esm/subscribable.js +39 -40
  33. package/esm/types.d.ts +13 -13
  34. package/esm/types.js +19 -20
  35. package/esm/uid.d.ts +1 -1
  36. package/esm/uid.js +7 -7
  37. package/lib/animation.d.ts +8 -2
  38. package/lib/animation.js +34 -35
  39. package/lib/array.d.ts +163 -37
  40. package/lib/array.js +129 -101
  41. package/lib/clone.d.ts +4 -4
  42. package/lib/clone.js +84 -91
  43. package/lib/compose.d.ts +3 -1
  44. package/lib/compose.js +10 -10
  45. package/lib/coordinate.d.ts +120 -76
  46. package/lib/coordinate.js +538 -440
  47. package/lib/element.d.ts +11 -6
  48. package/lib/element.js +139 -133
  49. package/lib/event.d.ts +162 -75
  50. package/lib/event.js +206 -202
  51. package/lib/globalThisPolyfill.d.ts +1 -1
  52. package/lib/globalThisPolyfill.js +17 -20
  53. package/lib/index.d.ts +17 -17
  54. package/lib/index.js +49 -33
  55. package/lib/instanceof.d.ts +1 -1
  56. package/lib/instanceof.js +13 -14
  57. package/lib/keycode.d.ts +145 -145
  58. package/lib/keycode.js +153 -153
  59. package/lib/lru.d.ts +50 -47
  60. package/lib/lru.js +240 -249
  61. package/lib/observer.d.ts +7 -7
  62. package/lib/observer.js +41 -44
  63. package/lib/request-idle.d.ts +9 -6
  64. package/lib/request-idle.js +14 -11
  65. package/lib/scroller.d.ts +24 -8
  66. package/lib/scroller.js +89 -81
  67. package/lib/subscribable.d.ts +10 -10
  68. package/lib/subscribable.js +43 -44
  69. package/lib/types.d.ts +13 -13
  70. package/lib/types.js +40 -28
  71. package/lib/uid.d.ts +1 -1
  72. package/lib/uid.js +11 -11
  73. package/package.json +15 -15
package/lib/event.js CHANGED
@@ -1,217 +1,221 @@
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) => mode === 'onlyOne' || mode === 'onlyChild' || mode === 'onlyParent';
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
- constructor(engine, context) {
18
- this.container = document;
19
- this.contentWindow = globalThisPolyfill_1.globalThisPolyfill;
20
- this.engine = engine;
21
- this.context = context;
22
- }
23
- dispatch(event) {
24
- return this.engine.dispatch(event, this.context);
25
- }
26
- subscribe(subscriber) {
27
- return this.engine.subscribe(subscriber);
28
- }
29
- subscribeTo(type, subscriber) {
30
- return this.engine.subscribeTo(type, subscriber);
31
- }
32
- subscribeWith(type, subscriber) {
33
- return this.engine.subscribeWith(type, subscriber);
34
- }
35
- attach(container) {
36
- void container;
37
- console.error('attach must implement.');
38
- }
39
- detach(container) {
40
- void container;
41
- console.error('attach must implement.');
42
- }
43
- eventTarget(type) {
44
- if (type === 'resize' || type === 'scroll') {
45
- if (this.container === this.contentWindow?.document) {
46
- return this.contentWindow;
47
- }
48
- }
49
- return this.container;
50
- }
51
- addEventListener(type, listener, options) {
52
- const target = this.eventTarget(type);
53
- if (isOnlyMode(options?.mode)) {
54
- target[EVENTS_ONCE_SYMBOL] = target[EVENTS_ONCE_SYMBOL] || {};
55
- const constructor = this['constructor'];
56
- constructor[EVENTS_ONCE_SYMBOL] = constructor[EVENTS_ONCE_SYMBOL] || {};
57
- const handler = target[EVENTS_ONCE_SYMBOL][type];
58
- const container = constructor[EVENTS_ONCE_SYMBOL][type];
59
- if (!handler) {
60
- if (container) {
61
- if (options.mode === 'onlyChild') {
62
- if (container.contains(target)) {
63
- container.removeEventListener(type, container[EVENTS_ONCE_SYMBOL][type], options);
64
- delete container[EVENTS_ONCE_SYMBOL][type];
65
- }
66
- }
67
- else if (options.mode === 'onlyParent') {
68
- if (container.contains(target))
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
- removeEventListener(type, listener, options) {
87
- const target = this.eventTarget(type);
88
- if (isOnlyMode(options?.mode)) {
89
- const constructor = this['constructor'];
90
- constructor[EVENTS_ONCE_SYMBOL] = constructor[EVENTS_ONCE_SYMBOL] || {};
91
- target[EVENTS_ONCE_SYMBOL] = target[EVENTS_ONCE_SYMBOL] || {};
92
- delete constructor[EVENTS_ONCE_SYMBOL][type];
93
- delete target[EVENTS_ONCE_SYMBOL][type];
94
- target.removeEventListener(type, listener, options);
95
- }
96
- else {
97
- target[EVENTS_SYMBOL] = target[EVENTS_SYMBOL] || {};
98
- target[EVENTS_SYMBOL][type] = target[EVENTS_SYMBOL][type] || new Map();
99
- target[EVENTS_SYMBOL][type]?.delete?.(listener);
100
- target.removeEventListener(type, listener, options);
101
- }
102
- }
103
- batchAddEventListener(type, listener, options) {
104
- this.engine[DRIVER_INSTANCES_SYMBOL] =
105
- this.engine[DRIVER_INSTANCES_SYMBOL] || [];
106
- if (!this.engine[DRIVER_INSTANCES_SYMBOL].includes(this)) {
107
- this.engine[DRIVER_INSTANCES_SYMBOL].push(this);
108
- }
109
- this.engine[DRIVER_INSTANCES_SYMBOL].forEach((driver) => {
110
- const target = driver.eventTarget(type);
111
- target[EVENTS_BATCH_SYMBOL] = target[EVENTS_BATCH_SYMBOL] || {};
112
- if (!target[EVENTS_BATCH_SYMBOL][type]) {
113
- target.addEventListener(type, listener, options);
114
- target[EVENTS_BATCH_SYMBOL][type] = listener;
115
- }
116
- });
117
- }
118
- batchRemoveEventListener(type, listener, options) {
119
- this.engine[DRIVER_INSTANCES_SYMBOL] =
120
- this.engine[DRIVER_INSTANCES_SYMBOL] || [];
121
- this.engine[DRIVER_INSTANCES_SYMBOL].forEach((driver) => {
122
- const target = driver.eventTarget(type);
123
- target[EVENTS_BATCH_SYMBOL] = target[EVENTS_BATCH_SYMBOL] || {};
124
- target.removeEventListener(type, listener, options);
125
- delete target[EVENTS_BATCH_SYMBOL][type];
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
- constructor(props) {
135
- super();
136
- this.drivers = [];
137
- this.containers = [];
138
- if ((0, types_1.isArr)(props?.effects)) {
139
- props.effects.forEach((plugin) => {
140
- plugin(this);
141
- });
142
- }
143
- if ((0, types_1.isArr)(props?.drivers)) {
144
- this.drivers = props.drivers;
145
- }
146
- }
147
- subscribeTo(type, subscriber) {
148
- return this.subscribe((event) => {
149
- if (type && event instanceof type) {
150
- return subscriber(event);
151
- }
152
- });
153
- }
154
- subscribeWith(type, subscriber) {
155
- return this.subscribe((event) => {
156
- if ((0, types_1.isArr)(type)) {
157
- if (type.includes(event?.type)) {
158
- return subscriber(event);
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
- if (container[ATTACHED_SYMBOL])
175
- return;
176
- container[ATTACHED_SYMBOL] = this.drivers.map((EventDriver) => {
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
- detachEvents(container) {
188
- if (!container) {
189
- this.containers.forEach((container) => {
190
- this.detachEvents(container);
191
- });
192
- return;
193
- }
194
- if ((0, types_1.isWindow)(container)) {
195
- return this.detachEvents(container.document);
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
- if (!container[ATTACHED_SYMBOL])
198
- return;
199
- container[ATTACHED_SYMBOL].forEach((driver) => {
200
- driver.detach(container);
201
- });
202
- this[DRIVER_INSTANCES_SYMBOL] = this[DRIVER_INSTANCES_SYMBOL] || [];
203
- this[DRIVER_INSTANCES_SYMBOL] = this[DRIVER_INSTANCES_SYMBOL].reduce((drivers, driver) => {
204
- if (driver.container === container) {
205
- driver.detach(container);
206
- return drivers;
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
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
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
- try {
6
- if (typeof self !== 'undefined') {
7
- return self;
8
- }
5
+ try {
6
+ if (typeof self !== 'undefined') {
7
+ return self
9
8
  }
10
- catch (e) { }
11
- try {
12
- if (typeof exports.globalThisPolyfill !== 'undefined') {
13
- return exports.globalThisPolyfill;
14
- }
9
+ } catch (e) {}
10
+ try {
11
+ if (typeof exports.globalThisPolyfill !== 'undefined') {
12
+ return exports.globalThisPolyfill
15
13
  }
16
- catch (e) { }
17
- try {
18
- if (typeof global !== 'undefined') {
19
- return global;
20
- }
14
+ } catch (e) {}
15
+ try {
16
+ if (typeof global !== 'undefined') {
17
+ return global
21
18
  }
22
- catch (e) { }
23
- return Function('return this')();
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 './event';
2
- export * from './scroller';
3
- export * from './subscribable';
4
- export * from './coordinate';
5
- export * from './types';
6
- export * from './uid';
7
- export * from './clone';
8
- export * from './instanceof';
9
- export * from './lru';
10
- export * from './compose';
11
- export * from './array';
12
- export * from './keycode';
13
- export * from './animation';
14
- export * from './request-idle';
15
- export * from './element';
16
- export * from './globalThisPolyfill';
17
- export * from './observer';
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
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./event"), exports);
18
- __exportStar(require("./scroller"), exports);
19
- __exportStar(require("./subscribable"), exports);
20
- __exportStar(require("./coordinate"), exports);
21
- __exportStar(require("./types"), exports);
22
- __exportStar(require("./uid"), exports);
23
- __exportStar(require("./clone"), exports);
24
- __exportStar(require("./instanceof"), exports);
25
- __exportStar(require("./lru"), exports);
26
- __exportStar(require("./compose"), exports);
27
- __exportStar(require("./array"), exports);
28
- __exportStar(require("./keycode"), exports);
29
- __exportStar(require("./animation"), exports);
30
- __exportStar(require("./request-idle"), exports);
31
- __exportStar(require("./element"), exports);
32
- __exportStar(require("./globalThisPolyfill"), exports);
33
- __exportStar(require("./observer"), exports);
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)
@@ -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
- "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");
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
- if ((0, types_1.isFn)(cls))
8
- return value instanceof cls;
9
- if ((0, types_1.isStr)(cls))
10
- return globalThisPolyfill_1.globalThisPolyfill[cls]
11
- ? value instanceof globalThisPolyfill_1.globalThisPolyfill[cls]
12
- : false;
13
- return false;
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