@react-stately/virtualizer 3.1.7-nightly.3111 → 3.1.7
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/dist/main.js +153 -151
- package/dist/main.js.map +1 -1
- package/dist/module.js +147 -145
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/module.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {useState as $
|
|
2
|
-
import {useLayoutEffect as $
|
|
1
|
+
import {useState as $hj7DF$useState, useMemo as $hj7DF$useMemo, useEffect as $hj7DF$useEffect, useCallback as $hj7DF$useCallback} from "react";
|
|
2
|
+
import {useLayoutEffect as $hj7DF$useLayoutEffect} from "@react-aria/utils";
|
|
3
3
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
|
-
var $
|
|
7
|
+
var $bb4fde2f44642f8c$exports = {};
|
|
8
8
|
|
|
9
|
-
$parcel$export($
|
|
10
|
-
class $
|
|
9
|
+
$parcel$export($bb4fde2f44642f8c$exports, "Layout", () => $bb4fde2f44642f8c$export$c84671f46d6a1ca);
|
|
10
|
+
class $bb4fde2f44642f8c$export$c84671f46d6a1ca {
|
|
11
11
|
/**
|
|
12
12
|
* Returns whether the layout should invalidate in response to
|
|
13
13
|
* visible rectangle changes. By default, it only invalidates
|
|
@@ -66,10 +66,23 @@ class $e2db9807015c93cd$export$c84671f46d6a1ca {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var $
|
|
69
|
+
var $8a0cec6d6c841a11$exports = {};
|
|
70
70
|
|
|
71
|
-
$parcel$export($
|
|
72
|
-
class $
|
|
71
|
+
$parcel$export($8a0cec6d6c841a11$exports, "LayoutInfo", () => $8a0cec6d6c841a11$export$7e0eeb9da702a085);
|
|
72
|
+
class $8a0cec6d6c841a11$export$7e0eeb9da702a085 {
|
|
73
|
+
/**
|
|
74
|
+
* Returns a copy of the LayoutInfo.
|
|
75
|
+
*/ copy() {
|
|
76
|
+
let res = new $8a0cec6d6c841a11$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
|
|
77
|
+
res.estimatedSize = this.estimatedSize;
|
|
78
|
+
res.opacity = this.opacity;
|
|
79
|
+
res.transform = this.transform;
|
|
80
|
+
res.parentKey = this.parentKey;
|
|
81
|
+
res.isSticky = this.isSticky;
|
|
82
|
+
res.zIndex = this.zIndex;
|
|
83
|
+
res.allowOverflow = this.allowOverflow;
|
|
84
|
+
return res;
|
|
85
|
+
}
|
|
73
86
|
/**
|
|
74
87
|
* @param type A string representing the view type. Should be `'item'` for item views.
|
|
75
88
|
Other types are used by supplementary views.
|
|
@@ -87,34 +100,17 @@ class $84802bfc2c93a467$export$7e0eeb9da702a085 {
|
|
|
87
100
|
this.zIndex = 0;
|
|
88
101
|
this.allowOverflow = false;
|
|
89
102
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Returns a copy of the LayoutInfo.
|
|
92
|
-
*/ copy() {
|
|
93
|
-
let res = new $84802bfc2c93a467$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
|
|
94
|
-
res.estimatedSize = this.estimatedSize;
|
|
95
|
-
res.opacity = this.opacity;
|
|
96
|
-
res.transform = this.transform;
|
|
97
|
-
res.parentKey = this.parentKey;
|
|
98
|
-
res.isSticky = this.isSticky;
|
|
99
|
-
res.zIndex = this.zIndex;
|
|
100
|
-
res.allowOverflow = this.allowOverflow;
|
|
101
|
-
return res;
|
|
102
|
-
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
var $
|
|
106
|
+
var $c18941612b0d3405$exports = {};
|
|
107
107
|
|
|
108
|
-
$parcel$export($
|
|
109
|
-
class $
|
|
110
|
-
constructor(x = 0, y = 0){
|
|
111
|
-
this.x = x;
|
|
112
|
-
this.y = y;
|
|
113
|
-
}
|
|
108
|
+
$parcel$export($c18941612b0d3405$exports, "Point", () => $c18941612b0d3405$export$baf26146a414f24a);
|
|
109
|
+
class $c18941612b0d3405$export$baf26146a414f24a {
|
|
114
110
|
/**
|
|
115
111
|
* Returns a copy of this point.
|
|
116
112
|
*/ copy() {
|
|
117
|
-
return new $
|
|
113
|
+
return new $c18941612b0d3405$export$baf26146a414f24a(this.x, this.y);
|
|
118
114
|
}
|
|
119
115
|
/**
|
|
120
116
|
* Checks if two points are equal.
|
|
@@ -126,20 +122,18 @@ class $412cc72545c8d16d$export$baf26146a414f24a {
|
|
|
126
122
|
*/ isOrigin() {
|
|
127
123
|
return this.x === 0 && this.y === 0;
|
|
128
124
|
}
|
|
125
|
+
constructor(x = 0, y = 0){
|
|
126
|
+
this.x = x;
|
|
127
|
+
this.y = y;
|
|
128
|
+
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
var $
|
|
132
|
+
var $5ace01ed35ef4cc5$exports = {};
|
|
133
133
|
|
|
134
|
-
$parcel$export($
|
|
134
|
+
$parcel$export($5ace01ed35ef4cc5$exports, "Rect", () => $5ace01ed35ef4cc5$export$c79fc6492f3af13d);
|
|
135
135
|
|
|
136
|
-
class $
|
|
137
|
-
constructor(x = 0, y = 0, width = 0, height = 0){
|
|
138
|
-
this.x = x;
|
|
139
|
-
this.y = y;
|
|
140
|
-
this.width = width;
|
|
141
|
-
this.height = height;
|
|
142
|
-
}
|
|
136
|
+
class $5ace01ed35ef4cc5$export$c79fc6492f3af13d {
|
|
143
137
|
/**
|
|
144
138
|
* The maximum x-coordinate in the rectangle.
|
|
145
139
|
*/ get maxX() {
|
|
@@ -158,22 +152,22 @@ class $159dcb078ef84557$export$c79fc6492f3af13d {
|
|
|
158
152
|
/**
|
|
159
153
|
* The top left corner of the rectangle.
|
|
160
154
|
*/ get topLeft() {
|
|
161
|
-
return new $
|
|
155
|
+
return new $c18941612b0d3405$export$baf26146a414f24a(this.x, this.y);
|
|
162
156
|
}
|
|
163
157
|
/**
|
|
164
158
|
* The top right corner of the rectangle.
|
|
165
159
|
*/ get topRight() {
|
|
166
|
-
return new $
|
|
160
|
+
return new $c18941612b0d3405$export$baf26146a414f24a(this.maxX, this.y);
|
|
167
161
|
}
|
|
168
162
|
/**
|
|
169
163
|
* The bottom left corner of the rectangle.
|
|
170
164
|
*/ get bottomLeft() {
|
|
171
|
-
return new $
|
|
165
|
+
return new $c18941612b0d3405$export$baf26146a414f24a(this.x, this.maxY);
|
|
172
166
|
}
|
|
173
167
|
/**
|
|
174
168
|
* The bottom right corner of the rectangle.
|
|
175
169
|
*/ get bottomRight() {
|
|
176
|
-
return new $
|
|
170
|
+
return new $c18941612b0d3405$export$baf26146a414f24a(this.maxX, this.maxY);
|
|
177
171
|
}
|
|
178
172
|
/**
|
|
179
173
|
* Returns whether this rectangle intersects another rectangle.
|
|
@@ -220,41 +214,43 @@ class $159dcb078ef84557$export$c79fc6492f3af13d {
|
|
|
220
214
|
/**
|
|
221
215
|
* Returns a copy of this rectangle.
|
|
222
216
|
*/ copy() {
|
|
223
|
-
return new $
|
|
217
|
+
return new $5ace01ed35ef4cc5$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
|
|
218
|
+
}
|
|
219
|
+
constructor(x = 0, y = 0, width = 0, height = 0){
|
|
220
|
+
this.x = x;
|
|
221
|
+
this.y = y;
|
|
222
|
+
this.width = width;
|
|
223
|
+
this.height = height;
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
|
|
228
|
-
var $
|
|
228
|
+
var $11c050b799ca8bfd$exports = {};
|
|
229
229
|
|
|
230
|
-
$parcel$export($
|
|
231
|
-
class $
|
|
232
|
-
constructor(width = 0, height = 0){
|
|
233
|
-
this.width = width;
|
|
234
|
-
this.height = height;
|
|
235
|
-
}
|
|
230
|
+
$parcel$export($11c050b799ca8bfd$exports, "Size", () => $11c050b799ca8bfd$export$cb6da89c6af1a8ec);
|
|
231
|
+
class $11c050b799ca8bfd$export$cb6da89c6af1a8ec {
|
|
236
232
|
/**
|
|
237
233
|
* Returns a copy of this size.
|
|
238
234
|
*/ copy() {
|
|
239
|
-
return new $
|
|
235
|
+
return new $11c050b799ca8bfd$export$cb6da89c6af1a8ec(this.width, this.height);
|
|
240
236
|
}
|
|
241
237
|
/**
|
|
242
238
|
* Returns whether this size is equal to another one.
|
|
243
239
|
*/ equals(other) {
|
|
244
240
|
return this.width === other.width && this.height === other.height;
|
|
245
241
|
}
|
|
242
|
+
constructor(width = 0, height = 0){
|
|
243
|
+
this.width = width;
|
|
244
|
+
this.height = height;
|
|
245
|
+
}
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
|
|
249
|
-
var $
|
|
249
|
+
var $d987d203ab974fe7$exports = {};
|
|
250
250
|
|
|
251
|
-
$parcel$export($
|
|
252
|
-
let $
|
|
253
|
-
class $
|
|
254
|
-
constructor(virtualizer){
|
|
255
|
-
this.virtualizer = virtualizer;
|
|
256
|
-
this.key = ++$4287aeba6cd94157$var$KEY;
|
|
257
|
-
}
|
|
251
|
+
$parcel$export($d987d203ab974fe7$exports, "ReusableView", () => $d987d203ab974fe7$export$1a5223887c560441);
|
|
252
|
+
let $d987d203ab974fe7$var$KEY = 0;
|
|
253
|
+
class $d987d203ab974fe7$export$1a5223887c560441 {
|
|
258
254
|
/**
|
|
259
255
|
* Prepares the view for reuse. Called just before the view is removed from the DOM.
|
|
260
256
|
*/ prepareForReuse() {
|
|
@@ -262,36 +258,40 @@ class $4287aeba6cd94157$export$1a5223887c560441 {
|
|
|
262
258
|
this.rendered = null;
|
|
263
259
|
this.layoutInfo = null;
|
|
264
260
|
}
|
|
261
|
+
constructor(virtualizer){
|
|
262
|
+
this.virtualizer = virtualizer;
|
|
263
|
+
this.key = ++$d987d203ab974fe7$var$KEY;
|
|
264
|
+
}
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
|
|
268
|
-
var $
|
|
268
|
+
var $b9814fb1baf5e2e6$exports = {};
|
|
269
269
|
|
|
270
|
-
$parcel$export($
|
|
270
|
+
$parcel$export($b9814fb1baf5e2e6$exports, "useVirtualizerState", () => $b9814fb1baf5e2e6$export$1505db82fe357e65);
|
|
271
271
|
|
|
272
272
|
|
|
273
273
|
|
|
274
274
|
|
|
275
275
|
// use high res timer if available
|
|
276
|
-
let $
|
|
276
|
+
let $df2f6dab2097e0f1$var$perf = typeof window !== 'undefined' ? window.performance : null;
|
|
277
277
|
// @ts-ignore
|
|
278
|
-
let $
|
|
279
|
-
let $
|
|
278
|
+
let $df2f6dab2097e0f1$var$perfNow = $df2f6dab2097e0f1$var$perf && ($df2f6dab2097e0f1$var$perf.now || $df2f6dab2097e0f1$var$perf.webkitNow || $df2f6dab2097e0f1$var$perf.msNow || $df2f6dab2097e0f1$var$perf.mozNow);
|
|
279
|
+
let $df2f6dab2097e0f1$var$getTime = $df2f6dab2097e0f1$var$perfNow ? $df2f6dab2097e0f1$var$perfNow.bind($df2f6dab2097e0f1$var$perf) : function() {
|
|
280
280
|
return Date.now ? Date.now() : new Date().getTime();
|
|
281
281
|
};
|
|
282
|
-
let $
|
|
283
|
-
function $
|
|
282
|
+
let $df2f6dab2097e0f1$var$fixTs;
|
|
283
|
+
function $df2f6dab2097e0f1$export$dc0b63720788090c(begin, end, duration, ease, fn) {
|
|
284
284
|
let canceled = false;
|
|
285
285
|
let raf_id;
|
|
286
286
|
let promise = new Promise((resolve)=>{
|
|
287
|
-
let start = $
|
|
287
|
+
let start = $df2f6dab2097e0f1$var$getTime();
|
|
288
288
|
let diffX = end.x - begin.x;
|
|
289
289
|
let diffY = end.y - begin.y;
|
|
290
290
|
raf_id = requestAnimationFrame(function run(t) {
|
|
291
291
|
// if we're using a high res timer, make sure timestamp is not the old epoch-based value.
|
|
292
292
|
// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision
|
|
293
|
-
if ($
|
|
294
|
-
if ($
|
|
293
|
+
if ($df2f6dab2097e0f1$var$fixTs == null) $df2f6dab2097e0f1$var$fixTs = t > 1000000000000 !== $df2f6dab2097e0f1$var$getTime() > 1000000000000;
|
|
294
|
+
if ($df2f6dab2097e0f1$var$fixTs) t = $df2f6dab2097e0f1$var$getTime();
|
|
295
295
|
// check if we're done
|
|
296
296
|
let delta = t - start;
|
|
297
297
|
if (delta > duration) {
|
|
@@ -299,7 +299,7 @@ function $6a9b8d711ba49ea7$export$dc0b63720788090c(begin, end, duration, ease, f
|
|
|
299
299
|
resolve();
|
|
300
300
|
} else {
|
|
301
301
|
// call frame callback after computing eased time and get the next frame
|
|
302
|
-
let proceed = fn(new $
|
|
302
|
+
let proceed = fn(new $c18941612b0d3405$export$baf26146a414f24a(begin.x + diffX * ease(delta / duration), begin.y + diffY * ease(delta / duration)));
|
|
303
303
|
if (proceed !== false && !canceled) raf_id = requestAnimationFrame(run);
|
|
304
304
|
}
|
|
305
305
|
});
|
|
@@ -310,22 +310,22 @@ function $6a9b8d711ba49ea7$export$dc0b63720788090c(begin, end, duration, ease, f
|
|
|
310
310
|
};
|
|
311
311
|
return promise;
|
|
312
312
|
}
|
|
313
|
-
function $
|
|
313
|
+
function $df2f6dab2097e0f1$export$77860c106b4a6a2e(t) {
|
|
314
314
|
return t;
|
|
315
315
|
}
|
|
316
|
-
function $
|
|
316
|
+
function $df2f6dab2097e0f1$export$57636bb43b1ccbb0(t) {
|
|
317
317
|
return Math.sin(t * Math.PI / 2);
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
|
|
321
|
-
function $
|
|
321
|
+
function $87ac0dc1eab4d828$export$37a26b283fd7740e(a, b) {
|
|
322
322
|
let res = new Set();
|
|
323
323
|
for (let key of a.keys())if (!b.has(key)) res.add(key);
|
|
324
324
|
return res;
|
|
325
325
|
}
|
|
326
|
-
function $
|
|
327
|
-
let toRemove = $
|
|
328
|
-
let toAdd = $
|
|
326
|
+
function $87ac0dc1eab4d828$export$acaf96a27438246b(a, b) {
|
|
327
|
+
let toRemove = $87ac0dc1eab4d828$export$37a26b283fd7740e(a, b);
|
|
328
|
+
let toAdd = $87ac0dc1eab4d828$export$37a26b283fd7740e(b, a);
|
|
329
329
|
let toUpdate = new Set;
|
|
330
330
|
for (let key of a.keys())if (b.has(key)) toUpdate.add(key);
|
|
331
331
|
return {
|
|
@@ -334,10 +334,10 @@ function $c984faf4f5b24890$export$acaf96a27438246b(a, b) {
|
|
|
334
334
|
toUpdate: toUpdate
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
-
function* $
|
|
337
|
+
function* $87ac0dc1eab4d828$export$cfc14088dfefce5f(...iterators) {
|
|
338
338
|
for (let iterator of iterators)yield* iterator;
|
|
339
339
|
}
|
|
340
|
-
function $
|
|
340
|
+
function $87ac0dc1eab4d828$export$6897c284b6f9f4dc(object) {
|
|
341
341
|
let res = {
|
|
342
342
|
};
|
|
343
343
|
for(let key in object)res[object[key]] = key;
|
|
@@ -347,7 +347,7 @@ function $c984faf4f5b24890$export$6897c284b6f9f4dc(object) {
|
|
|
347
347
|
|
|
348
348
|
|
|
349
349
|
|
|
350
|
-
class $
|
|
350
|
+
class $23a0943f854e7414$var$RollingAverage {
|
|
351
351
|
addSample(sample) {
|
|
352
352
|
this.count++;
|
|
353
353
|
this.value += (sample - this.value) / this.count;
|
|
@@ -357,7 +357,7 @@ class $ffa819e9899a870b$var$RollingAverage {
|
|
|
357
357
|
this.value = 0;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class $
|
|
360
|
+
class $23a0943f854e7414$export$4455ee6afb38dcbb {
|
|
361
361
|
setVisibleRect(rect) {
|
|
362
362
|
let time = performance.now() - this.startTime;
|
|
363
363
|
if (time < 500) {
|
|
@@ -402,12 +402,12 @@ class $ffa819e9899a870b$export$4455ee6afb38dcbb {
|
|
|
402
402
|
}
|
|
403
403
|
constructor(){
|
|
404
404
|
this.startTime = 0;
|
|
405
|
-
this.averagePerf = new $
|
|
406
|
-
this.averageTime = new $
|
|
407
|
-
this.velocity = new $
|
|
408
|
-
this.overscanX = new $
|
|
409
|
-
this.overscanY = new $
|
|
410
|
-
this.visibleRect = new $
|
|
405
|
+
this.averagePerf = new $23a0943f854e7414$var$RollingAverage();
|
|
406
|
+
this.averageTime = new $23a0943f854e7414$var$RollingAverage();
|
|
407
|
+
this.velocity = new $c18941612b0d3405$export$baf26146a414f24a(5, 5);
|
|
408
|
+
this.overscanX = new $23a0943f854e7414$var$RollingAverage();
|
|
409
|
+
this.overscanY = new $23a0943f854e7414$var$RollingAverage();
|
|
410
|
+
this.visibleRect = new $5ace01ed35ef4cc5$export$c79fc6492f3af13d();
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
|
|
@@ -416,7 +416,7 @@ class $ffa819e9899a870b$export$4455ee6afb38dcbb {
|
|
|
416
416
|
|
|
417
417
|
|
|
418
418
|
|
|
419
|
-
class $
|
|
419
|
+
class $8d8490b32c62e2b1$export$febc5573c75cefb0 {
|
|
420
420
|
constructor(){
|
|
421
421
|
this.level = 0;
|
|
422
422
|
this.actions = [];
|
|
@@ -431,44 +431,13 @@ class $6b14b0a55eb74a2c$export$febc5573c75cefb0 {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
|
|
434
|
-
class $
|
|
435
|
-
constructor(options = {
|
|
436
|
-
}){
|
|
437
|
-
this._contentSize = new $22e89a13b0a391cf$export$cb6da89c6af1a8ec;
|
|
438
|
-
this._visibleRect = new $159dcb078ef84557$export$c79fc6492f3af13d;
|
|
439
|
-
this._reusableViews = {
|
|
440
|
-
};
|
|
441
|
-
this._visibleLayoutInfos = new Map();
|
|
442
|
-
this._visibleViews = new Map();
|
|
443
|
-
this._renderedContent = new WeakMap();
|
|
444
|
-
this._children = new Set();
|
|
445
|
-
this._invalidationContext = null;
|
|
446
|
-
this._overscanManager = new $ffa819e9899a870b$export$4455ee6afb38dcbb();
|
|
447
|
-
this._scrollAnimation = null;
|
|
448
|
-
this._isScrolling = false;
|
|
449
|
-
this._sizeUpdateQueue = new Map();
|
|
450
|
-
this._animatedContentOffset = new $412cc72545c8d16d$export$baf26146a414f24a(0, 0);
|
|
451
|
-
this._transaction = null;
|
|
452
|
-
this._nextTransaction = null;
|
|
453
|
-
this._transactionQueue = [];
|
|
454
|
-
// Set options from passed object if given
|
|
455
|
-
this.transitionDuration = options.transitionDuration ?? 500;
|
|
456
|
-
this.anchorScrollPosition = options.anchorScrollPosition || false;
|
|
457
|
-
this.anchorScrollPositionAtTop = options.anchorScrollPositionAtTop || false;
|
|
458
|
-
this.shouldOverscan = options.shouldOverscan !== false;
|
|
459
|
-
for (let key of [
|
|
460
|
-
'delegate',
|
|
461
|
-
'size',
|
|
462
|
-
'layout',
|
|
463
|
-
'collection'
|
|
464
|
-
])if (options[key]) this[key] = options[key];
|
|
465
|
-
}
|
|
434
|
+
class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
466
435
|
_setContentSize(size) {
|
|
467
436
|
this._contentSize = size;
|
|
468
437
|
this.delegate.setContentSize(size);
|
|
469
438
|
}
|
|
470
439
|
_setContentOffset(offset) {
|
|
471
|
-
let rect = new $
|
|
440
|
+
let rect = new $5ace01ed35ef4cc5$export$c79fc6492f3af13d(offset.x, offset.y, this._visibleRect.width, this._visibleRect.height);
|
|
472
441
|
this.delegate.setVisibleRect(rect);
|
|
473
442
|
}
|
|
474
443
|
/**
|
|
@@ -582,7 +551,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
582
551
|
let { reuseType: reuseType } = this._getReuseType(layoutInfo, content);
|
|
583
552
|
if (!this._reusableViews[reuseType]) this._reusableViews[reuseType] = [];
|
|
584
553
|
let reusable = this._reusableViews[reuseType];
|
|
585
|
-
let view = reusable.length > 0 ? reusable.pop() : new $
|
|
554
|
+
let view = reusable.length > 0 ? reusable.pop() : new $d987d203ab974fe7$export$1a5223887c560441(this);
|
|
586
555
|
view.viewType = reuseType;
|
|
587
556
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
588
557
|
layoutInfo = layoutInfo.copy();
|
|
@@ -636,7 +605,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
636
605
|
/**
|
|
637
606
|
* Returns the key for the item view currently at the given point.
|
|
638
607
|
*/ keyAtPoint(point) {
|
|
639
|
-
let rect = new $
|
|
608
|
+
let rect = new $5ace01ed35ef4cc5$export$c79fc6492f3af13d(point.x, point.y, 1, 1);
|
|
640
609
|
let layoutInfos = this.layout.getVisibleLayoutInfos(rect);
|
|
641
610
|
let layoutInfo = layoutInfos[0];
|
|
642
611
|
if (!layoutInfo) return null;
|
|
@@ -713,7 +682,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
713
682
|
this._animatedContentOffset.x += visibleRect.x - contentOffsetX;
|
|
714
683
|
this._animatedContentOffset.y += visibleRect.y - contentOffsetY;
|
|
715
684
|
hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
716
|
-
} else this._setContentOffset(new $
|
|
685
|
+
} else this._setContentOffset(new $c18941612b0d3405$export$baf26146a414f24a(contentOffsetX, contentOffsetY));
|
|
717
686
|
} else hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
718
687
|
// Apply layout infos, unless this is coming from an animated transaction
|
|
719
688
|
if (!(context.transaction && context.animated)) this._applyLayoutInfos();
|
|
@@ -727,7 +696,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
727
696
|
// Get the content offset to scroll to, taking _animatedContentOffset into account.
|
|
728
697
|
let { x: x , y: y } = this.getVisibleRect();
|
|
729
698
|
this._resetAnimatedContentOffset();
|
|
730
|
-
this._setContentOffset(new $
|
|
699
|
+
this._setContentOffset(new $c18941612b0d3405$export$baf26146a414f24a(x, y));
|
|
731
700
|
}
|
|
732
701
|
if (typeof context.afterAnimation === 'function') context.afterAnimation();
|
|
733
702
|
};
|
|
@@ -798,7 +767,8 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
798
767
|
_restoreScrollAnchor(scrollAnchor, context) {
|
|
799
768
|
let contentOffset = this.getVisibleRect();
|
|
800
769
|
if (scrollAnchor) {
|
|
801
|
-
|
|
770
|
+
var ref;
|
|
771
|
+
let finalAnchor = ((ref = context.transaction) === null || ref === void 0 ? void 0 : ref.animated) ? context.transaction.finalMap.get(scrollAnchor.key) : this.layout.getLayoutInfo(scrollAnchor.layoutInfo.key);
|
|
802
772
|
if (finalAnchor) {
|
|
803
773
|
let adjustment = finalAnchor.rect[scrollAnchor.corner].y - contentOffset.y - scrollAnchor.offset;
|
|
804
774
|
contentOffset.y += adjustment;
|
|
@@ -810,7 +780,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
810
780
|
let v = this.visibleRect;
|
|
811
781
|
let x = v.x - this._animatedContentOffset.x;
|
|
812
782
|
let y = v.y - this._animatedContentOffset.y;
|
|
813
|
-
return new $
|
|
783
|
+
return new $5ace01ed35ef4cc5$export$c79fc6492f3af13d(x, y, v.width, v.height);
|
|
814
784
|
}
|
|
815
785
|
getVisibleLayoutInfos() {
|
|
816
786
|
let rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
|
|
@@ -838,7 +808,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
838
808
|
toRemove = currentlyVisible;
|
|
839
809
|
toUpdate = new Set();
|
|
840
810
|
} else {
|
|
841
|
-
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $
|
|
811
|
+
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $87ac0dc1eab4d828$export$acaf96a27438246b(currentlyVisible, visibleLayoutInfos));
|
|
842
812
|
for (let key of toUpdate){
|
|
843
813
|
let view = currentlyVisible.get(key);
|
|
844
814
|
if (!view || !view.layoutInfo) continue;
|
|
@@ -1021,7 +991,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
1021
991
|
_resetAnimatedContentOffset() {
|
|
1022
992
|
// Reset the animated content offset of subviews. See comment in relayoutNow for details.
|
|
1023
993
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
1024
|
-
this._animatedContentOffset = new $
|
|
994
|
+
this._animatedContentOffset = new $c18941612b0d3405$export$baf26146a414f24a(0, 0);
|
|
1025
995
|
this._applyLayoutInfos();
|
|
1026
996
|
}
|
|
1027
997
|
}
|
|
@@ -1049,7 +1019,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
1049
1019
|
if (minY <= y || maxY === 0) y = minY;
|
|
1050
1020
|
else if (layoutInfo.rect.maxY > maxY) y += layoutInfo.rect.maxY - maxY;
|
|
1051
1021
|
}
|
|
1052
|
-
return this.scrollTo(new $
|
|
1022
|
+
return this.scrollTo(new $c18941612b0d3405$export$baf26146a414f24a(x, y), duration);
|
|
1053
1023
|
}
|
|
1054
1024
|
/**
|
|
1055
1025
|
* Performs an animated scroll to the given offset.
|
|
@@ -1068,7 +1038,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
1068
1038
|
return Promise.resolve();
|
|
1069
1039
|
}
|
|
1070
1040
|
this.startScrolling();
|
|
1071
|
-
this._scrollAnimation = $
|
|
1041
|
+
this._scrollAnimation = $df2f6dab2097e0f1$export$dc0b63720788090c(this.visibleRect, offset1, duration, $df2f6dab2097e0f1$export$57636bb43b1ccbb0, (offset)=>{
|
|
1072
1042
|
this._setContentOffset(offset);
|
|
1073
1043
|
});
|
|
1074
1044
|
this._scrollAnimation.then(()=>{
|
|
@@ -1089,7 +1059,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
1089
1059
|
this._endTransaction(animated);
|
|
1090
1060
|
}
|
|
1091
1061
|
_startTransaction() {
|
|
1092
|
-
if (!this._nextTransaction) this._nextTransaction = new $
|
|
1062
|
+
if (!this._nextTransaction) this._nextTransaction = new $8d8490b32c62e2b1$export$febc5573c75cefb0;
|
|
1093
1063
|
this._nextTransaction.level++;
|
|
1094
1064
|
}
|
|
1095
1065
|
_endTransaction(animated) {
|
|
@@ -1120,7 +1090,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
1120
1090
|
if (next) this._performTransaction(next);
|
|
1121
1091
|
}
|
|
1122
1092
|
_getContentRect() {
|
|
1123
|
-
return new $
|
|
1093
|
+
return new $5ace01ed35ef4cc5$export$c79fc6492f3af13d(0, 0, this.contentSize.width, this.contentSize.height);
|
|
1124
1094
|
}
|
|
1125
1095
|
_performTransaction(transaction) {
|
|
1126
1096
|
this._transaction = transaction;
|
|
@@ -1143,7 +1113,7 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
1143
1113
|
},
|
|
1144
1114
|
afterAnimation: ()=>{
|
|
1145
1115
|
// Remove and reuse views when animations are done
|
|
1146
|
-
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) for (let view of $
|
|
1116
|
+
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) for (let view of $87ac0dc1eab4d828$export$cfc14088dfefce5f(transaction.toRemove.values(), transaction.removed.values())){
|
|
1147
1117
|
this._children.delete(view);
|
|
1148
1118
|
this.reuseView(view);
|
|
1149
1119
|
}
|
|
@@ -1179,15 +1149,47 @@ class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
|
1179
1149
|
}
|
|
1180
1150
|
}
|
|
1181
1151
|
}
|
|
1152
|
+
constructor(options = {
|
|
1153
|
+
}){
|
|
1154
|
+
this._contentSize = new $11c050b799ca8bfd$export$cb6da89c6af1a8ec;
|
|
1155
|
+
this._visibleRect = new $5ace01ed35ef4cc5$export$c79fc6492f3af13d;
|
|
1156
|
+
this._reusableViews = {
|
|
1157
|
+
};
|
|
1158
|
+
this._visibleLayoutInfos = new Map();
|
|
1159
|
+
this._visibleViews = new Map();
|
|
1160
|
+
this._renderedContent = new WeakMap();
|
|
1161
|
+
this._children = new Set();
|
|
1162
|
+
this._invalidationContext = null;
|
|
1163
|
+
this._overscanManager = new $23a0943f854e7414$export$4455ee6afb38dcbb();
|
|
1164
|
+
this._scrollAnimation = null;
|
|
1165
|
+
this._isScrolling = false;
|
|
1166
|
+
this._sizeUpdateQueue = new Map();
|
|
1167
|
+
this._animatedContentOffset = new $c18941612b0d3405$export$baf26146a414f24a(0, 0);
|
|
1168
|
+
this._transaction = null;
|
|
1169
|
+
this._nextTransaction = null;
|
|
1170
|
+
this._transactionQueue = [];
|
|
1171
|
+
var _transitionDuration;
|
|
1172
|
+
// Set options from passed object if given
|
|
1173
|
+
this.transitionDuration = (_transitionDuration = options.transitionDuration) !== null && _transitionDuration !== void 0 ? _transitionDuration : 500;
|
|
1174
|
+
this.anchorScrollPosition = options.anchorScrollPosition || false;
|
|
1175
|
+
this.anchorScrollPositionAtTop = options.anchorScrollPositionAtTop || false;
|
|
1176
|
+
this.shouldOverscan = options.shouldOverscan !== false;
|
|
1177
|
+
for (let key of [
|
|
1178
|
+
'delegate',
|
|
1179
|
+
'size',
|
|
1180
|
+
'layout',
|
|
1181
|
+
'collection'
|
|
1182
|
+
])if (options[key]) this[key] = options[key];
|
|
1183
|
+
}
|
|
1182
1184
|
}
|
|
1183
1185
|
|
|
1184
1186
|
|
|
1185
|
-
function $
|
|
1186
|
-
let [visibleViews, setVisibleViews] = $
|
|
1187
|
-
let [contentSize, setContentSize] = $
|
|
1188
|
-
let [isAnimating, setAnimating] = $
|
|
1189
|
-
let [isScrolling, setScrolling] = $
|
|
1190
|
-
let virtualizer = $
|
|
1187
|
+
function $b9814fb1baf5e2e6$export$1505db82fe357e65(opts) {
|
|
1188
|
+
let [visibleViews, setVisibleViews] = $hj7DF$useState([]);
|
|
1189
|
+
let [contentSize, setContentSize] = $hj7DF$useState(new $11c050b799ca8bfd$export$cb6da89c6af1a8ec());
|
|
1190
|
+
let [isAnimating, setAnimating] = $hj7DF$useState(false);
|
|
1191
|
+
let [isScrolling, setScrolling] = $hj7DF$useState(false);
|
|
1192
|
+
let virtualizer = $hj7DF$useMemo(()=>new $65bed7ce80fa8795$export$89be5a243e59c4b2()
|
|
1191
1193
|
, []);
|
|
1192
1194
|
virtualizer.delegate = {
|
|
1193
1195
|
setVisibleViews: setVisibleViews,
|
|
@@ -1207,18 +1209,18 @@ function $768d3e68d680b21c$export$1505db82fe357e65(opts) {
|
|
|
1207
1209
|
virtualizer.layout = opts.layout;
|
|
1208
1210
|
virtualizer.collection = opts.collection;
|
|
1209
1211
|
virtualizer.transitionDuration = opts.transitionDuration;
|
|
1210
|
-
$
|
|
1212
|
+
$hj7DF$useLayoutEffect(()=>{
|
|
1211
1213
|
virtualizer.afterRender();
|
|
1212
1214
|
});
|
|
1213
1215
|
// eslint-disable-next-line arrow-body-style
|
|
1214
|
-
$
|
|
1216
|
+
$hj7DF$useEffect(()=>{
|
|
1215
1217
|
return ()=>virtualizer.willUnmount()
|
|
1216
1218
|
;
|
|
1217
1219
|
}, []);
|
|
1218
1220
|
return {
|
|
1219
1221
|
virtualizer: virtualizer,
|
|
1220
1222
|
visibleViews: visibleViews,
|
|
1221
|
-
setVisibleRect: $
|
|
1223
|
+
setVisibleRect: $hj7DF$useCallback((rect)=>{
|
|
1222
1224
|
virtualizer.visibleRect = rect;
|
|
1223
1225
|
}, [
|
|
1224
1226
|
virtualizer
|
|
@@ -1226,13 +1228,13 @@ function $768d3e68d680b21c$export$1505db82fe357e65(opts) {
|
|
|
1226
1228
|
contentSize: contentSize,
|
|
1227
1229
|
isAnimating: isAnimating,
|
|
1228
1230
|
isScrolling: isScrolling,
|
|
1229
|
-
startScrolling: $
|
|
1231
|
+
startScrolling: $hj7DF$useCallback(()=>{
|
|
1230
1232
|
virtualizer.startScrolling();
|
|
1231
1233
|
setScrolling(true);
|
|
1232
1234
|
}, [
|
|
1233
1235
|
virtualizer
|
|
1234
1236
|
]),
|
|
1235
|
-
endScrolling: $
|
|
1237
|
+
endScrolling: $hj7DF$useCallback(()=>{
|
|
1236
1238
|
virtualizer.endScrolling();
|
|
1237
1239
|
setScrolling(false);
|
|
1238
1240
|
}, [
|
|
@@ -1244,5 +1246,5 @@ function $768d3e68d680b21c$export$1505db82fe357e65(opts) {
|
|
|
1244
1246
|
|
|
1245
1247
|
|
|
1246
1248
|
|
|
1247
|
-
export {$
|
|
1249
|
+
export {$bb4fde2f44642f8c$export$c84671f46d6a1ca as Layout, $8a0cec6d6c841a11$export$7e0eeb9da702a085 as LayoutInfo, $c18941612b0d3405$export$baf26146a414f24a as Point, $5ace01ed35ef4cc5$export$c79fc6492f3af13d as Rect, $11c050b799ca8bfd$export$cb6da89c6af1a8ec as Size, $d987d203ab974fe7$export$1a5223887c560441 as ReusableView, $b9814fb1baf5e2e6$export$1505db82fe357e65 as useVirtualizerState};
|
|
1248
1250
|
//# sourceMappingURL=module.js.map
|