@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/lru.d.ts
CHANGED
|
@@ -17,57 +17,60 @@
|
|
|
17
17
|
* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added
|
|
18
18
|
*/
|
|
19
19
|
export declare class LRUMap<K, V> {
|
|
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
|
-
|
|
20
|
+
size: number
|
|
21
|
+
limit: number
|
|
22
|
+
oldest: any
|
|
23
|
+
newest: any
|
|
24
|
+
_keymap: Map<
|
|
25
|
+
K,
|
|
26
|
+
{
|
|
27
|
+
key: K
|
|
28
|
+
value: V
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
constructor(limit: number, entries?: any)
|
|
32
|
+
private _markEntryAsUsed
|
|
33
|
+
assign(entries: any): void
|
|
34
|
+
get(key: K): V
|
|
35
|
+
set(key: K, value: V): this
|
|
36
|
+
shift(): any[]
|
|
37
|
+
find(key: K): V
|
|
38
|
+
has(key: K): boolean
|
|
39
|
+
delete(key: any): V
|
|
40
|
+
clear(): void
|
|
41
|
+
keys(): KeyIterator
|
|
42
|
+
values(): ValueIterator
|
|
43
|
+
entries(): void
|
|
44
|
+
forEach(fun: (value: any, key: any, ctx: object) => void, thisObj: any): void
|
|
45
|
+
toJSON(): any[]
|
|
46
|
+
toString(): string
|
|
47
|
+
[Symbol.iterator](): EntryIterator
|
|
45
48
|
}
|
|
46
49
|
declare class EntryIterator {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
entry: any
|
|
51
|
+
constructor(oldestEntry: any)
|
|
52
|
+
[Symbol.iterator](): this
|
|
53
|
+
next(): {
|
|
54
|
+
done: boolean
|
|
55
|
+
value: any[]
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
declare class KeyIterator {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
entry: any
|
|
60
|
+
constructor(oldestEntry: any)
|
|
61
|
+
[Symbol.iterator](): this
|
|
62
|
+
next(): {
|
|
63
|
+
done: boolean
|
|
64
|
+
value: any
|
|
65
|
+
}
|
|
63
66
|
}
|
|
64
67
|
declare class ValueIterator {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
entry: any
|
|
69
|
+
constructor(oldestEntry: any)
|
|
70
|
+
[Symbol.iterator](): this
|
|
71
|
+
next(): {
|
|
72
|
+
done: boolean
|
|
73
|
+
value: any
|
|
74
|
+
}
|
|
72
75
|
}
|
|
73
|
-
export {}
|
|
76
|
+
export {}
|
package/esm/lru.js
CHANGED
|
@@ -17,277 +17,268 @@
|
|
|
17
17
|
* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added
|
|
18
18
|
*/
|
|
19
19
|
/* eslint-disable */
|
|
20
|
-
const NEWER = Symbol('newer')
|
|
21
|
-
const OLDER = Symbol('older')
|
|
20
|
+
const NEWER = Symbol('newer')
|
|
21
|
+
const OLDER = Symbol('older')
|
|
22
22
|
function Entry(key, value) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
this.key = key
|
|
24
|
+
this.value = value
|
|
25
|
+
this[NEWER] = undefined
|
|
26
|
+
this[OLDER] = undefined
|
|
27
27
|
}
|
|
28
28
|
export class LRUMap {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
this.size = 0;
|
|
36
|
-
this.limit = limit;
|
|
37
|
-
this.oldest = this.newest = undefined;
|
|
38
|
-
this._keymap = new Map();
|
|
39
|
-
if (entries) {
|
|
40
|
-
this.assign(entries);
|
|
41
|
-
if (limit < 1) {
|
|
42
|
-
this.limit = this.size;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
29
|
+
constructor(limit, entries) {
|
|
30
|
+
if (typeof limit !== 'number') {
|
|
31
|
+
// called as (entries)
|
|
32
|
+
entries = limit
|
|
33
|
+
limit = 0
|
|
45
34
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (entry[NEWER]) {
|
|
56
|
-
if (entry === this.oldest) {
|
|
57
|
-
this.oldest = entry[NEWER];
|
|
58
|
-
}
|
|
59
|
-
entry[NEWER][OLDER] = entry[OLDER]; // C <-- E.
|
|
60
|
-
}
|
|
61
|
-
if (entry[OLDER]) {
|
|
62
|
-
entry[OLDER][NEWER] = entry[NEWER]; // C. --> E
|
|
63
|
-
}
|
|
64
|
-
entry[NEWER] = undefined; // D --x
|
|
65
|
-
entry[OLDER] = this.newest; // D. --> E
|
|
66
|
-
if (this.newest) {
|
|
67
|
-
this.newest[NEWER] = entry; // E. <-- D
|
|
68
|
-
}
|
|
69
|
-
this.newest = entry;
|
|
35
|
+
this.size = 0
|
|
36
|
+
this.limit = limit
|
|
37
|
+
this.oldest = this.newest = undefined
|
|
38
|
+
this._keymap = new Map()
|
|
39
|
+
if (entries) {
|
|
40
|
+
this.assign(entries)
|
|
41
|
+
if (limit < 1) {
|
|
42
|
+
this.limit = this.size
|
|
43
|
+
}
|
|
70
44
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
for (let itv = it.next(); !itv.done; itv = it.next()) {
|
|
77
|
-
const e = new Entry(itv.value[0], itv.value[1]);
|
|
78
|
-
this._keymap.set(e.key, e);
|
|
79
|
-
if (!entry) {
|
|
80
|
-
this.oldest = e;
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
entry[NEWER] = e;
|
|
84
|
-
e[OLDER] = entry;
|
|
85
|
-
}
|
|
86
|
-
entry = e;
|
|
87
|
-
if (limit-- === 0) {
|
|
88
|
-
throw new Error('overflow');
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
this.newest = entry;
|
|
92
|
-
this.size = this._keymap.size;
|
|
45
|
+
}
|
|
46
|
+
_markEntryAsUsed(entry) {
|
|
47
|
+
if (entry === this.newest) {
|
|
48
|
+
// Already the most recenlty used entry, so no need to update the list
|
|
49
|
+
return
|
|
93
50
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
51
|
+
// HEAD--------------TAIL
|
|
52
|
+
// <.older .newer>
|
|
53
|
+
// <--- add direction --
|
|
54
|
+
// A B C <D> E
|
|
55
|
+
if (entry[NEWER]) {
|
|
56
|
+
if (entry === this.oldest) {
|
|
57
|
+
this.oldest = entry[NEWER]
|
|
58
|
+
}
|
|
59
|
+
entry[NEWER][OLDER] = entry[OLDER] // C <-- E.
|
|
103
60
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if (entry) {
|
|
107
|
-
// update existing
|
|
108
|
-
entry.value = value;
|
|
109
|
-
this._markEntryAsUsed(entry);
|
|
110
|
-
return this;
|
|
111
|
-
}
|
|
112
|
-
// new entry
|
|
113
|
-
this._keymap.set(key, (entry = new Entry(key, value)));
|
|
114
|
-
if (this.newest) {
|
|
115
|
-
// link previous tail to the new tail (entry)
|
|
116
|
-
this.newest[NEWER] = entry;
|
|
117
|
-
entry[OLDER] = this.newest;
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
// we're first in -- yay
|
|
121
|
-
this.oldest = entry;
|
|
122
|
-
}
|
|
123
|
-
// add new entry to the end of the linked list -- it's now the freshest entry.
|
|
124
|
-
this.newest = entry;
|
|
125
|
-
++this.size;
|
|
126
|
-
if (this.size > this.limit) {
|
|
127
|
-
// we hit the limit -- remove the head
|
|
128
|
-
this.shift();
|
|
129
|
-
}
|
|
130
|
-
return this;
|
|
61
|
+
if (entry[OLDER]) {
|
|
62
|
+
entry[OLDER][NEWER] = entry[NEWER] // C. --> E
|
|
131
63
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (this.oldest[NEWER]) {
|
|
137
|
-
// advance the list
|
|
138
|
-
this.oldest = this.oldest[NEWER];
|
|
139
|
-
this.oldest[OLDER] = undefined;
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
// the cache is exhausted
|
|
143
|
-
this.oldest = undefined;
|
|
144
|
-
this.newest = undefined;
|
|
145
|
-
}
|
|
146
|
-
// Remove last strong reference to <entry> and remove links from the purged
|
|
147
|
-
// entry being returned:
|
|
148
|
-
entry[NEWER] = entry[OLDER] = undefined;
|
|
149
|
-
this._keymap.delete(entry.key);
|
|
150
|
-
--this.size;
|
|
151
|
-
return [entry.key, entry.value];
|
|
152
|
-
}
|
|
64
|
+
entry[NEWER] = undefined // D --x
|
|
65
|
+
entry[OLDER] = this.newest // D. --> E
|
|
66
|
+
if (this.newest) {
|
|
67
|
+
this.newest[NEWER] = entry // E. <-- D
|
|
153
68
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
69
|
+
this.newest = entry
|
|
70
|
+
}
|
|
71
|
+
assign(entries) {
|
|
72
|
+
let entry
|
|
73
|
+
let limit = this.limit || Number.MAX_VALUE
|
|
74
|
+
this._keymap.clear()
|
|
75
|
+
const it = entries[Symbol.iterator]()
|
|
76
|
+
for (let itv = it.next(); !itv.done; itv = it.next()) {
|
|
77
|
+
const e = new Entry(itv.value[0], itv.value[1])
|
|
78
|
+
this._keymap.set(e.key, e)
|
|
79
|
+
if (!entry) {
|
|
80
|
+
this.oldest = e
|
|
81
|
+
} else {
|
|
82
|
+
entry[NEWER] = e
|
|
83
|
+
e[OLDER] = entry
|
|
84
|
+
}
|
|
85
|
+
entry = e
|
|
86
|
+
if (limit-- === 0) {
|
|
87
|
+
throw new Error('overflow')
|
|
88
|
+
}
|
|
157
89
|
}
|
|
158
|
-
|
|
159
|
-
|
|
90
|
+
this.newest = entry
|
|
91
|
+
this.size = this._keymap.size
|
|
92
|
+
}
|
|
93
|
+
get(key) {
|
|
94
|
+
// First, find our cache entry
|
|
95
|
+
const entry = this._keymap.get(key)
|
|
96
|
+
if (!entry) {
|
|
97
|
+
return
|
|
98
|
+
} // Not cached. Sorry.
|
|
99
|
+
// As <key> was found in the cache, register it as being requested recently
|
|
100
|
+
this._markEntryAsUsed(entry)
|
|
101
|
+
return entry.value
|
|
102
|
+
}
|
|
103
|
+
set(key, value) {
|
|
104
|
+
let entry = this._keymap.get(key)
|
|
105
|
+
if (entry) {
|
|
106
|
+
// update existing
|
|
107
|
+
entry.value = value
|
|
108
|
+
this._markEntryAsUsed(entry)
|
|
109
|
+
return this
|
|
160
110
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
entry[NEWER][OLDER] = entry[OLDER];
|
|
171
|
-
}
|
|
172
|
-
else if (entry[NEWER]) {
|
|
173
|
-
// remove the link to us
|
|
174
|
-
entry[NEWER][OLDER] = undefined;
|
|
175
|
-
// link the newer entry to head
|
|
176
|
-
this.oldest = entry[NEWER];
|
|
177
|
-
}
|
|
178
|
-
else if (entry[OLDER]) {
|
|
179
|
-
// remove the link to us
|
|
180
|
-
entry[OLDER][NEWER] = undefined;
|
|
181
|
-
// link the newer entry to head
|
|
182
|
-
this.newest = entry[OLDER];
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
// if(entry[OLDER] === undefined && entry.newer === undefined) {
|
|
186
|
-
this.oldest = this.newest = undefined;
|
|
187
|
-
}
|
|
188
|
-
this.size--;
|
|
189
|
-
return entry.value;
|
|
111
|
+
// new entry
|
|
112
|
+
this._keymap.set(key, (entry = new Entry(key, value)))
|
|
113
|
+
if (this.newest) {
|
|
114
|
+
// link previous tail to the new tail (entry)
|
|
115
|
+
this.newest[NEWER] = entry
|
|
116
|
+
entry[OLDER] = this.newest
|
|
117
|
+
} else {
|
|
118
|
+
// we're first in -- yay
|
|
119
|
+
this.oldest = entry
|
|
190
120
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
121
|
+
// add new entry to the end of the linked list -- it's now the freshest entry.
|
|
122
|
+
this.newest = entry
|
|
123
|
+
++this.size
|
|
124
|
+
if (this.size > this.limit) {
|
|
125
|
+
// we hit the limit -- remove the head
|
|
126
|
+
this.shift()
|
|
196
127
|
}
|
|
197
|
-
|
|
198
|
-
|
|
128
|
+
return this
|
|
129
|
+
}
|
|
130
|
+
shift() {
|
|
131
|
+
// todo: handle special case when limit == 1
|
|
132
|
+
const entry = this.oldest
|
|
133
|
+
if (entry) {
|
|
134
|
+
if (this.oldest[NEWER]) {
|
|
135
|
+
// advance the list
|
|
136
|
+
this.oldest = this.oldest[NEWER]
|
|
137
|
+
this.oldest[OLDER] = undefined
|
|
138
|
+
} else {
|
|
139
|
+
// the cache is exhausted
|
|
140
|
+
this.oldest = undefined
|
|
141
|
+
this.newest = undefined
|
|
142
|
+
}
|
|
143
|
+
// Remove last strong reference to <entry> and remove links from the purged
|
|
144
|
+
// entry being returned:
|
|
145
|
+
entry[NEWER] = entry[OLDER] = undefined
|
|
146
|
+
this._keymap.delete(entry.key)
|
|
147
|
+
--this.size
|
|
148
|
+
return [entry.key, entry.value]
|
|
199
149
|
}
|
|
200
|
-
|
|
201
|
-
|
|
150
|
+
}
|
|
151
|
+
find(key) {
|
|
152
|
+
const e = this._keymap.get(key)
|
|
153
|
+
return e ? e.value : undefined
|
|
154
|
+
}
|
|
155
|
+
has(key) {
|
|
156
|
+
return this._keymap.has(key)
|
|
157
|
+
}
|
|
158
|
+
delete(key) {
|
|
159
|
+
const entry = this._keymap.get(key)
|
|
160
|
+
if (!entry) {
|
|
161
|
+
return
|
|
202
162
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
163
|
+
this._keymap.delete(entry.key)
|
|
164
|
+
if (entry[NEWER] && entry[OLDER]) {
|
|
165
|
+
// relink the older entry with the newer entry
|
|
166
|
+
entry[OLDER][NEWER] = entry[NEWER]
|
|
167
|
+
entry[NEWER][OLDER] = entry[OLDER]
|
|
168
|
+
} else if (entry[NEWER]) {
|
|
169
|
+
// remove the link to us
|
|
170
|
+
entry[NEWER][OLDER] = undefined
|
|
171
|
+
// link the newer entry to head
|
|
172
|
+
this.oldest = entry[NEWER]
|
|
173
|
+
} else if (entry[OLDER]) {
|
|
174
|
+
// remove the link to us
|
|
175
|
+
entry[OLDER][NEWER] = undefined
|
|
176
|
+
// link the newer entry to head
|
|
177
|
+
this.newest = entry[OLDER]
|
|
178
|
+
} else {
|
|
179
|
+
// if(entry[OLDER] === undefined && entry.newer === undefined) {
|
|
180
|
+
this.oldest = this.newest = undefined
|
|
213
181
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
182
|
+
this.size--
|
|
183
|
+
return entry.value
|
|
184
|
+
}
|
|
185
|
+
clear() {
|
|
186
|
+
// Not clearing links should be safe, as we don't expose live links to user
|
|
187
|
+
this.oldest = this.newest = undefined
|
|
188
|
+
this.size = 0
|
|
189
|
+
this._keymap.clear()
|
|
190
|
+
}
|
|
191
|
+
keys() {
|
|
192
|
+
return new KeyIterator(this.oldest)
|
|
193
|
+
}
|
|
194
|
+
values() {
|
|
195
|
+
return new ValueIterator(this.oldest)
|
|
196
|
+
}
|
|
197
|
+
entries() {}
|
|
198
|
+
forEach(fun, thisObj) {
|
|
199
|
+
if (typeof thisObj !== 'object') {
|
|
200
|
+
thisObj = this
|
|
223
201
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
s += String(entry.key) + ':' + entry.value;
|
|
229
|
-
entry = entry[NEWER];
|
|
230
|
-
if (entry) {
|
|
231
|
-
s += ' < ';
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return s;
|
|
202
|
+
let entry = this.oldest
|
|
203
|
+
while (entry) {
|
|
204
|
+
fun.call(thisObj, entry.value, entry.key, this)
|
|
205
|
+
entry = entry[NEWER]
|
|
235
206
|
}
|
|
236
|
-
|
|
237
|
-
|
|
207
|
+
}
|
|
208
|
+
toJSON() {
|
|
209
|
+
const s = new Array(this.size)
|
|
210
|
+
let i = 0
|
|
211
|
+
let entry = this.oldest
|
|
212
|
+
while (entry) {
|
|
213
|
+
s[i++] = { key: entry.key, value: entry.value }
|
|
214
|
+
entry = entry[NEWER]
|
|
238
215
|
}
|
|
216
|
+
return s
|
|
217
|
+
}
|
|
218
|
+
toString() {
|
|
219
|
+
let s = ''
|
|
220
|
+
let entry = this.oldest
|
|
221
|
+
while (entry) {
|
|
222
|
+
s += String(entry.key) + ':' + entry.value
|
|
223
|
+
entry = entry[NEWER]
|
|
224
|
+
if (entry) {
|
|
225
|
+
s += ' < '
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return s
|
|
229
|
+
}
|
|
230
|
+
[Symbol.iterator]() {
|
|
231
|
+
return new EntryIterator(this.oldest)
|
|
232
|
+
}
|
|
239
233
|
}
|
|
240
234
|
class EntryIterator {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
return { done: true, value: undefined };
|
|
255
|
-
}
|
|
235
|
+
constructor(oldestEntry) {
|
|
236
|
+
this.entry = oldestEntry
|
|
237
|
+
}
|
|
238
|
+
[Symbol.iterator]() {
|
|
239
|
+
return this
|
|
240
|
+
}
|
|
241
|
+
next() {
|
|
242
|
+
const ent = this.entry
|
|
243
|
+
if (ent) {
|
|
244
|
+
this.entry = ent[NEWER]
|
|
245
|
+
return { done: false, value: [ent.key, ent.value] }
|
|
246
|
+
} else {
|
|
247
|
+
return { done: true, value: undefined }
|
|
256
248
|
}
|
|
249
|
+
}
|
|
257
250
|
}
|
|
258
251
|
class KeyIterator {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return { done: true, value: undefined };
|
|
273
|
-
}
|
|
252
|
+
constructor(oldestEntry) {
|
|
253
|
+
this.entry = oldestEntry
|
|
254
|
+
}
|
|
255
|
+
[Symbol.iterator]() {
|
|
256
|
+
return this
|
|
257
|
+
}
|
|
258
|
+
next() {
|
|
259
|
+
const ent = this.entry
|
|
260
|
+
if (ent) {
|
|
261
|
+
this.entry = ent[NEWER]
|
|
262
|
+
return { done: false, value: ent.key }
|
|
263
|
+
} else {
|
|
264
|
+
return { done: true, value: undefined }
|
|
274
265
|
}
|
|
266
|
+
}
|
|
275
267
|
}
|
|
276
268
|
class ValueIterator {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return { done: true, value: undefined };
|
|
291
|
-
}
|
|
269
|
+
constructor(oldestEntry) {
|
|
270
|
+
this.entry = oldestEntry
|
|
271
|
+
}
|
|
272
|
+
[Symbol.iterator]() {
|
|
273
|
+
return this
|
|
274
|
+
}
|
|
275
|
+
next() {
|
|
276
|
+
const ent = this.entry
|
|
277
|
+
if (ent) {
|
|
278
|
+
this.entry = ent[NEWER]
|
|
279
|
+
return { done: false, value: ent.value }
|
|
280
|
+
} else {
|
|
281
|
+
return { done: true, value: undefined }
|
|
292
282
|
}
|
|
283
|
+
}
|
|
293
284
|
}
|
package/esm/observer.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare class LayoutObserver {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
private resizeObserver?
|
|
3
|
+
private performanceObserver?
|
|
4
|
+
private mutationObserver?
|
|
5
|
+
private connected
|
|
6
|
+
constructor(observer?: () => void)
|
|
7
|
+
observe: (target: HTMLElement | Element) => void
|
|
8
|
+
disconnect: () => void
|
|
9
9
|
}
|