@react-stately/virtualizer 3.1.7 → 3.1.8-nightly.3113
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 +94 -94
- package/dist/module.js +88 -88
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
1
|
+
var $aEpNF$react = require("react");
|
|
2
|
+
var $aEpNF$reactariautils = require("@react-aria/utils");
|
|
3
3
|
|
|
4
4
|
function $parcel$exportWildcard(dest, source) {
|
|
5
5
|
Object.keys(source).forEach(function(key) {
|
|
@@ -20,10 +20,10 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
20
20
|
function $parcel$export(e, n, v, s) {
|
|
21
21
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
22
22
|
}
|
|
23
|
-
var $
|
|
23
|
+
var $ac14d65a0ec196dd$exports = {};
|
|
24
24
|
|
|
25
|
-
$parcel$export($
|
|
26
|
-
class $
|
|
25
|
+
$parcel$export($ac14d65a0ec196dd$exports, "Layout", () => $ac14d65a0ec196dd$export$c84671f46d6a1ca);
|
|
26
|
+
class $ac14d65a0ec196dd$export$c84671f46d6a1ca {
|
|
27
27
|
/**
|
|
28
28
|
* Returns whether the layout should invalidate in response to
|
|
29
29
|
* visible rectangle changes. By default, it only invalidates
|
|
@@ -82,14 +82,14 @@ class $0d5c9ff6e1157361$export$c84671f46d6a1ca {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
var $
|
|
85
|
+
var $8a899922c0a55745$exports = {};
|
|
86
86
|
|
|
87
|
-
$parcel$export($
|
|
88
|
-
class $
|
|
87
|
+
$parcel$export($8a899922c0a55745$exports, "LayoutInfo", () => $8a899922c0a55745$export$7e0eeb9da702a085);
|
|
88
|
+
class $8a899922c0a55745$export$7e0eeb9da702a085 {
|
|
89
89
|
/**
|
|
90
90
|
* Returns a copy of the LayoutInfo.
|
|
91
91
|
*/ copy() {
|
|
92
|
-
let res = new $
|
|
92
|
+
let res = new $8a899922c0a55745$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
|
|
93
93
|
res.estimatedSize = this.estimatedSize;
|
|
94
94
|
res.opacity = this.opacity;
|
|
95
95
|
res.transform = this.transform;
|
|
@@ -119,14 +119,14 @@ class $f1d3da1211768ed5$export$7e0eeb9da702a085 {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
var $
|
|
122
|
+
var $f89f15d7f52bce29$exports = {};
|
|
123
123
|
|
|
124
|
-
$parcel$export($
|
|
125
|
-
class $
|
|
124
|
+
$parcel$export($f89f15d7f52bce29$exports, "Point", () => $f89f15d7f52bce29$export$baf26146a414f24a);
|
|
125
|
+
class $f89f15d7f52bce29$export$baf26146a414f24a {
|
|
126
126
|
/**
|
|
127
127
|
* Returns a copy of this point.
|
|
128
128
|
*/ copy() {
|
|
129
|
-
return new $
|
|
129
|
+
return new $f89f15d7f52bce29$export$baf26146a414f24a(this.x, this.y);
|
|
130
130
|
}
|
|
131
131
|
/**
|
|
132
132
|
* Checks if two points are equal.
|
|
@@ -145,11 +145,11 @@ class $103abcdf9cf478de$export$baf26146a414f24a {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
var $
|
|
148
|
+
var $41b7691783731623$exports = {};
|
|
149
149
|
|
|
150
|
-
$parcel$export($
|
|
150
|
+
$parcel$export($41b7691783731623$exports, "Rect", () => $41b7691783731623$export$c79fc6492f3af13d);
|
|
151
151
|
|
|
152
|
-
class $
|
|
152
|
+
class $41b7691783731623$export$c79fc6492f3af13d {
|
|
153
153
|
/**
|
|
154
154
|
* The maximum x-coordinate in the rectangle.
|
|
155
155
|
*/ get maxX() {
|
|
@@ -168,22 +168,22 @@ class $2d68b1437715e315$export$c79fc6492f3af13d {
|
|
|
168
168
|
/**
|
|
169
169
|
* The top left corner of the rectangle.
|
|
170
170
|
*/ get topLeft() {
|
|
171
|
-
return new $
|
|
171
|
+
return new $f89f15d7f52bce29$export$baf26146a414f24a(this.x, this.y);
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* The top right corner of the rectangle.
|
|
175
175
|
*/ get topRight() {
|
|
176
|
-
return new $
|
|
176
|
+
return new $f89f15d7f52bce29$export$baf26146a414f24a(this.maxX, this.y);
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* The bottom left corner of the rectangle.
|
|
180
180
|
*/ get bottomLeft() {
|
|
181
|
-
return new $
|
|
181
|
+
return new $f89f15d7f52bce29$export$baf26146a414f24a(this.x, this.maxY);
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
184
|
* The bottom right corner of the rectangle.
|
|
185
185
|
*/ get bottomRight() {
|
|
186
|
-
return new $
|
|
186
|
+
return new $f89f15d7f52bce29$export$baf26146a414f24a(this.maxX, this.maxY);
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* Returns whether this rectangle intersects another rectangle.
|
|
@@ -230,7 +230,7 @@ class $2d68b1437715e315$export$c79fc6492f3af13d {
|
|
|
230
230
|
/**
|
|
231
231
|
* Returns a copy of this rectangle.
|
|
232
232
|
*/ copy() {
|
|
233
|
-
return new $
|
|
233
|
+
return new $41b7691783731623$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
|
|
234
234
|
}
|
|
235
235
|
constructor(x = 0, y = 0, width = 0, height = 0){
|
|
236
236
|
this.x = x;
|
|
@@ -241,14 +241,14 @@ class $2d68b1437715e315$export$c79fc6492f3af13d {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
var $
|
|
244
|
+
var $064492b79924894c$exports = {};
|
|
245
245
|
|
|
246
|
-
$parcel$export($
|
|
247
|
-
class $
|
|
246
|
+
$parcel$export($064492b79924894c$exports, "Size", () => $064492b79924894c$export$cb6da89c6af1a8ec);
|
|
247
|
+
class $064492b79924894c$export$cb6da89c6af1a8ec {
|
|
248
248
|
/**
|
|
249
249
|
* Returns a copy of this size.
|
|
250
250
|
*/ copy() {
|
|
251
|
-
return new $
|
|
251
|
+
return new $064492b79924894c$export$cb6da89c6af1a8ec(this.width, this.height);
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
254
254
|
* Returns whether this size is equal to another one.
|
|
@@ -262,11 +262,11 @@ class $a3f05bab0f981c14$export$cb6da89c6af1a8ec {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
|
|
265
|
-
var $
|
|
265
|
+
var $197a1781bd47f5b9$exports = {};
|
|
266
266
|
|
|
267
|
-
$parcel$export($
|
|
268
|
-
let $
|
|
269
|
-
class $
|
|
267
|
+
$parcel$export($197a1781bd47f5b9$exports, "ReusableView", () => $197a1781bd47f5b9$export$1a5223887c560441);
|
|
268
|
+
let $197a1781bd47f5b9$var$KEY = 0;
|
|
269
|
+
class $197a1781bd47f5b9$export$1a5223887c560441 {
|
|
270
270
|
/**
|
|
271
271
|
* Prepares the view for reuse. Called just before the view is removed from the DOM.
|
|
272
272
|
*/ prepareForReuse() {
|
|
@@ -276,38 +276,38 @@ class $4da0526be40749e8$export$1a5223887c560441 {
|
|
|
276
276
|
}
|
|
277
277
|
constructor(virtualizer){
|
|
278
278
|
this.virtualizer = virtualizer;
|
|
279
|
-
this.key = ++$
|
|
279
|
+
this.key = ++$197a1781bd47f5b9$var$KEY;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
|
|
284
|
-
var $
|
|
284
|
+
var $f02ef43b5e8eee9b$exports = {};
|
|
285
285
|
|
|
286
|
-
$parcel$export($
|
|
286
|
+
$parcel$export($f02ef43b5e8eee9b$exports, "useVirtualizerState", () => $f02ef43b5e8eee9b$export$1505db82fe357e65);
|
|
287
287
|
|
|
288
288
|
|
|
289
289
|
|
|
290
290
|
|
|
291
291
|
// use high res timer if available
|
|
292
|
-
let $
|
|
292
|
+
let $57c5d36217e1f286$var$perf = typeof window !== 'undefined' ? window.performance : null;
|
|
293
293
|
// @ts-ignore
|
|
294
|
-
let $
|
|
295
|
-
let $
|
|
294
|
+
let $57c5d36217e1f286$var$perfNow = $57c5d36217e1f286$var$perf && ($57c5d36217e1f286$var$perf.now || $57c5d36217e1f286$var$perf.webkitNow || $57c5d36217e1f286$var$perf.msNow || $57c5d36217e1f286$var$perf.mozNow);
|
|
295
|
+
let $57c5d36217e1f286$var$getTime = $57c5d36217e1f286$var$perfNow ? $57c5d36217e1f286$var$perfNow.bind($57c5d36217e1f286$var$perf) : function() {
|
|
296
296
|
return Date.now ? Date.now() : new Date().getTime();
|
|
297
297
|
};
|
|
298
|
-
let $
|
|
299
|
-
function $
|
|
298
|
+
let $57c5d36217e1f286$var$fixTs;
|
|
299
|
+
function $57c5d36217e1f286$export$dc0b63720788090c(begin, end, duration, ease, fn) {
|
|
300
300
|
let canceled = false;
|
|
301
301
|
let raf_id;
|
|
302
302
|
let promise = new Promise((resolve)=>{
|
|
303
|
-
let start = $
|
|
303
|
+
let start = $57c5d36217e1f286$var$getTime();
|
|
304
304
|
let diffX = end.x - begin.x;
|
|
305
305
|
let diffY = end.y - begin.y;
|
|
306
306
|
raf_id = requestAnimationFrame(function run(t) {
|
|
307
307
|
// if we're using a high res timer, make sure timestamp is not the old epoch-based value.
|
|
308
308
|
// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision
|
|
309
|
-
if ($
|
|
310
|
-
if ($
|
|
309
|
+
if ($57c5d36217e1f286$var$fixTs == null) $57c5d36217e1f286$var$fixTs = t > 1000000000000 !== $57c5d36217e1f286$var$getTime() > 1000000000000;
|
|
310
|
+
if ($57c5d36217e1f286$var$fixTs) t = $57c5d36217e1f286$var$getTime();
|
|
311
311
|
// check if we're done
|
|
312
312
|
let delta = t - start;
|
|
313
313
|
if (delta > duration) {
|
|
@@ -315,7 +315,7 @@ function $c58295f7a299f0aa$export$dc0b63720788090c(begin, end, duration, ease, f
|
|
|
315
315
|
resolve();
|
|
316
316
|
} else {
|
|
317
317
|
// call frame callback after computing eased time and get the next frame
|
|
318
|
-
let proceed = fn(new $
|
|
318
|
+
let proceed = fn(new $f89f15d7f52bce29$export$baf26146a414f24a(begin.x + diffX * ease(delta / duration), begin.y + diffY * ease(delta / duration)));
|
|
319
319
|
if (proceed !== false && !canceled) raf_id = requestAnimationFrame(run);
|
|
320
320
|
}
|
|
321
321
|
});
|
|
@@ -326,22 +326,22 @@ function $c58295f7a299f0aa$export$dc0b63720788090c(begin, end, duration, ease, f
|
|
|
326
326
|
};
|
|
327
327
|
return promise;
|
|
328
328
|
}
|
|
329
|
-
function $
|
|
329
|
+
function $57c5d36217e1f286$export$77860c106b4a6a2e(t) {
|
|
330
330
|
return t;
|
|
331
331
|
}
|
|
332
|
-
function $
|
|
332
|
+
function $57c5d36217e1f286$export$57636bb43b1ccbb0(t) {
|
|
333
333
|
return Math.sin(t * Math.PI / 2);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
|
|
337
|
-
function $
|
|
337
|
+
function $abed55ea619a7a17$export$37a26b283fd7740e(a, b) {
|
|
338
338
|
let res = new Set();
|
|
339
339
|
for (let key of a.keys())if (!b.has(key)) res.add(key);
|
|
340
340
|
return res;
|
|
341
341
|
}
|
|
342
|
-
function $
|
|
343
|
-
let toRemove = $
|
|
344
|
-
let toAdd = $
|
|
342
|
+
function $abed55ea619a7a17$export$acaf96a27438246b(a, b) {
|
|
343
|
+
let toRemove = $abed55ea619a7a17$export$37a26b283fd7740e(a, b);
|
|
344
|
+
let toAdd = $abed55ea619a7a17$export$37a26b283fd7740e(b, a);
|
|
345
345
|
let toUpdate = new Set;
|
|
346
346
|
for (let key of a.keys())if (b.has(key)) toUpdate.add(key);
|
|
347
347
|
return {
|
|
@@ -350,10 +350,10 @@ function $fbda06621e3f10f4$export$acaf96a27438246b(a, b) {
|
|
|
350
350
|
toUpdate: toUpdate
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
function* $
|
|
353
|
+
function* $abed55ea619a7a17$export$cfc14088dfefce5f(...iterators) {
|
|
354
354
|
for (let iterator of iterators)yield* iterator;
|
|
355
355
|
}
|
|
356
|
-
function $
|
|
356
|
+
function $abed55ea619a7a17$export$6897c284b6f9f4dc(object) {
|
|
357
357
|
let res = {
|
|
358
358
|
};
|
|
359
359
|
for(let key in object)res[object[key]] = key;
|
|
@@ -363,7 +363,7 @@ function $fbda06621e3f10f4$export$6897c284b6f9f4dc(object) {
|
|
|
363
363
|
|
|
364
364
|
|
|
365
365
|
|
|
366
|
-
class $
|
|
366
|
+
class $191a033606d4fda1$var$RollingAverage {
|
|
367
367
|
addSample(sample) {
|
|
368
368
|
this.count++;
|
|
369
369
|
this.value += (sample - this.value) / this.count;
|
|
@@ -373,7 +373,7 @@ class $68be7cd82b7d2f02$var$RollingAverage {
|
|
|
373
373
|
this.value = 0;
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
class $
|
|
376
|
+
class $191a033606d4fda1$export$4455ee6afb38dcbb {
|
|
377
377
|
setVisibleRect(rect) {
|
|
378
378
|
let time = performance.now() - this.startTime;
|
|
379
379
|
if (time < 500) {
|
|
@@ -418,12 +418,12 @@ class $68be7cd82b7d2f02$export$4455ee6afb38dcbb {
|
|
|
418
418
|
}
|
|
419
419
|
constructor(){
|
|
420
420
|
this.startTime = 0;
|
|
421
|
-
this.averagePerf = new $
|
|
422
|
-
this.averageTime = new $
|
|
423
|
-
this.velocity = new $
|
|
424
|
-
this.overscanX = new $
|
|
425
|
-
this.overscanY = new $
|
|
426
|
-
this.visibleRect = new $
|
|
421
|
+
this.averagePerf = new $191a033606d4fda1$var$RollingAverage();
|
|
422
|
+
this.averageTime = new $191a033606d4fda1$var$RollingAverage();
|
|
423
|
+
this.velocity = new $f89f15d7f52bce29$export$baf26146a414f24a(5, 5);
|
|
424
|
+
this.overscanX = new $191a033606d4fda1$var$RollingAverage();
|
|
425
|
+
this.overscanY = new $191a033606d4fda1$var$RollingAverage();
|
|
426
|
+
this.visibleRect = new $41b7691783731623$export$c79fc6492f3af13d();
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
|
|
@@ -432,7 +432,7 @@ class $68be7cd82b7d2f02$export$4455ee6afb38dcbb {
|
|
|
432
432
|
|
|
433
433
|
|
|
434
434
|
|
|
435
|
-
class $
|
|
435
|
+
class $d288159e8347722a$export$febc5573c75cefb0 {
|
|
436
436
|
constructor(){
|
|
437
437
|
this.level = 0;
|
|
438
438
|
this.actions = [];
|
|
@@ -447,13 +447,13 @@ class $bcf4f4044a613451$export$febc5573c75cefb0 {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
|
|
450
|
-
class $
|
|
450
|
+
class $e1bc15d49d21df0e$export$89be5a243e59c4b2 {
|
|
451
451
|
_setContentSize(size) {
|
|
452
452
|
this._contentSize = size;
|
|
453
453
|
this.delegate.setContentSize(size);
|
|
454
454
|
}
|
|
455
455
|
_setContentOffset(offset) {
|
|
456
|
-
let rect = new $
|
|
456
|
+
let rect = new $41b7691783731623$export$c79fc6492f3af13d(offset.x, offset.y, this._visibleRect.width, this._visibleRect.height);
|
|
457
457
|
this.delegate.setVisibleRect(rect);
|
|
458
458
|
}
|
|
459
459
|
/**
|
|
@@ -567,7 +567,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
567
567
|
let { reuseType: reuseType } = this._getReuseType(layoutInfo, content);
|
|
568
568
|
if (!this._reusableViews[reuseType]) this._reusableViews[reuseType] = [];
|
|
569
569
|
let reusable = this._reusableViews[reuseType];
|
|
570
|
-
let view = reusable.length > 0 ? reusable.pop() : new $
|
|
570
|
+
let view = reusable.length > 0 ? reusable.pop() : new $197a1781bd47f5b9$export$1a5223887c560441(this);
|
|
571
571
|
view.viewType = reuseType;
|
|
572
572
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
573
573
|
layoutInfo = layoutInfo.copy();
|
|
@@ -621,7 +621,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
621
621
|
/**
|
|
622
622
|
* Returns the key for the item view currently at the given point.
|
|
623
623
|
*/ keyAtPoint(point) {
|
|
624
|
-
let rect = new $
|
|
624
|
+
let rect = new $41b7691783731623$export$c79fc6492f3af13d(point.x, point.y, 1, 1);
|
|
625
625
|
let layoutInfos = this.layout.getVisibleLayoutInfos(rect);
|
|
626
626
|
let layoutInfo = layoutInfos[0];
|
|
627
627
|
if (!layoutInfo) return null;
|
|
@@ -698,7 +698,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
698
698
|
this._animatedContentOffset.x += visibleRect.x - contentOffsetX;
|
|
699
699
|
this._animatedContentOffset.y += visibleRect.y - contentOffsetY;
|
|
700
700
|
hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
701
|
-
} else this._setContentOffset(new $
|
|
701
|
+
} else this._setContentOffset(new $f89f15d7f52bce29$export$baf26146a414f24a(contentOffsetX, contentOffsetY));
|
|
702
702
|
} else hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
703
703
|
// Apply layout infos, unless this is coming from an animated transaction
|
|
704
704
|
if (!(context.transaction && context.animated)) this._applyLayoutInfos();
|
|
@@ -712,7 +712,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
712
712
|
// Get the content offset to scroll to, taking _animatedContentOffset into account.
|
|
713
713
|
let { x: x , y: y } = this.getVisibleRect();
|
|
714
714
|
this._resetAnimatedContentOffset();
|
|
715
|
-
this._setContentOffset(new $
|
|
715
|
+
this._setContentOffset(new $f89f15d7f52bce29$export$baf26146a414f24a(x, y));
|
|
716
716
|
}
|
|
717
717
|
if (typeof context.afterAnimation === 'function') context.afterAnimation();
|
|
718
718
|
};
|
|
@@ -796,7 +796,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
796
796
|
let v = this.visibleRect;
|
|
797
797
|
let x = v.x - this._animatedContentOffset.x;
|
|
798
798
|
let y = v.y - this._animatedContentOffset.y;
|
|
799
|
-
return new $
|
|
799
|
+
return new $41b7691783731623$export$c79fc6492f3af13d(x, y, v.width, v.height);
|
|
800
800
|
}
|
|
801
801
|
getVisibleLayoutInfos() {
|
|
802
802
|
let rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
|
|
@@ -824,7 +824,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
824
824
|
toRemove = currentlyVisible;
|
|
825
825
|
toUpdate = new Set();
|
|
826
826
|
} else {
|
|
827
|
-
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $
|
|
827
|
+
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $abed55ea619a7a17$export$acaf96a27438246b(currentlyVisible, visibleLayoutInfos));
|
|
828
828
|
for (let key of toUpdate){
|
|
829
829
|
let view = currentlyVisible.get(key);
|
|
830
830
|
if (!view || !view.layoutInfo) continue;
|
|
@@ -1007,7 +1007,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1007
1007
|
_resetAnimatedContentOffset() {
|
|
1008
1008
|
// Reset the animated content offset of subviews. See comment in relayoutNow for details.
|
|
1009
1009
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
1010
|
-
this._animatedContentOffset = new $
|
|
1010
|
+
this._animatedContentOffset = new $f89f15d7f52bce29$export$baf26146a414f24a(0, 0);
|
|
1011
1011
|
this._applyLayoutInfos();
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
@@ -1035,7 +1035,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1035
1035
|
if (minY <= y || maxY === 0) y = minY;
|
|
1036
1036
|
else if (layoutInfo.rect.maxY > maxY) y += layoutInfo.rect.maxY - maxY;
|
|
1037
1037
|
}
|
|
1038
|
-
return this.scrollTo(new $
|
|
1038
|
+
return this.scrollTo(new $f89f15d7f52bce29$export$baf26146a414f24a(x, y), duration);
|
|
1039
1039
|
}
|
|
1040
1040
|
/**
|
|
1041
1041
|
* Performs an animated scroll to the given offset.
|
|
@@ -1054,7 +1054,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1054
1054
|
return Promise.resolve();
|
|
1055
1055
|
}
|
|
1056
1056
|
this.startScrolling();
|
|
1057
|
-
this._scrollAnimation = $
|
|
1057
|
+
this._scrollAnimation = $57c5d36217e1f286$export$dc0b63720788090c(this.visibleRect, offset1, duration, $57c5d36217e1f286$export$57636bb43b1ccbb0, (offset)=>{
|
|
1058
1058
|
this._setContentOffset(offset);
|
|
1059
1059
|
});
|
|
1060
1060
|
this._scrollAnimation.then(()=>{
|
|
@@ -1075,7 +1075,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1075
1075
|
this._endTransaction(animated);
|
|
1076
1076
|
}
|
|
1077
1077
|
_startTransaction() {
|
|
1078
|
-
if (!this._nextTransaction) this._nextTransaction = new $
|
|
1078
|
+
if (!this._nextTransaction) this._nextTransaction = new $d288159e8347722a$export$febc5573c75cefb0;
|
|
1079
1079
|
this._nextTransaction.level++;
|
|
1080
1080
|
}
|
|
1081
1081
|
_endTransaction(animated) {
|
|
@@ -1106,7 +1106,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1106
1106
|
if (next) this._performTransaction(next);
|
|
1107
1107
|
}
|
|
1108
1108
|
_getContentRect() {
|
|
1109
|
-
return new $
|
|
1109
|
+
return new $41b7691783731623$export$c79fc6492f3af13d(0, 0, this.contentSize.width, this.contentSize.height);
|
|
1110
1110
|
}
|
|
1111
1111
|
_performTransaction(transaction) {
|
|
1112
1112
|
this._transaction = transaction;
|
|
@@ -1129,7 +1129,7 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1129
1129
|
},
|
|
1130
1130
|
afterAnimation: ()=>{
|
|
1131
1131
|
// Remove and reuse views when animations are done
|
|
1132
|
-
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) for (let view of $
|
|
1132
|
+
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) for (let view of $abed55ea619a7a17$export$cfc14088dfefce5f(transaction.toRemove.values(), transaction.removed.values())){
|
|
1133
1133
|
this._children.delete(view);
|
|
1134
1134
|
this.reuseView(view);
|
|
1135
1135
|
}
|
|
@@ -1167,8 +1167,8 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1167
1167
|
}
|
|
1168
1168
|
constructor(options = {
|
|
1169
1169
|
}){
|
|
1170
|
-
this._contentSize = new $
|
|
1171
|
-
this._visibleRect = new $
|
|
1170
|
+
this._contentSize = new $064492b79924894c$export$cb6da89c6af1a8ec;
|
|
1171
|
+
this._visibleRect = new $41b7691783731623$export$c79fc6492f3af13d;
|
|
1172
1172
|
this._reusableViews = {
|
|
1173
1173
|
};
|
|
1174
1174
|
this._visibleLayoutInfos = new Map();
|
|
@@ -1176,11 +1176,11 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1176
1176
|
this._renderedContent = new WeakMap();
|
|
1177
1177
|
this._children = new Set();
|
|
1178
1178
|
this._invalidationContext = null;
|
|
1179
|
-
this._overscanManager = new $
|
|
1179
|
+
this._overscanManager = new $191a033606d4fda1$export$4455ee6afb38dcbb();
|
|
1180
1180
|
this._scrollAnimation = null;
|
|
1181
1181
|
this._isScrolling = false;
|
|
1182
1182
|
this._sizeUpdateQueue = new Map();
|
|
1183
|
-
this._animatedContentOffset = new $
|
|
1183
|
+
this._animatedContentOffset = new $f89f15d7f52bce29$export$baf26146a414f24a(0, 0);
|
|
1184
1184
|
this._transaction = null;
|
|
1185
1185
|
this._nextTransaction = null;
|
|
1186
1186
|
this._transactionQueue = [];
|
|
@@ -1200,12 +1200,12 @@ class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
1202
|
|
|
1203
|
-
function $
|
|
1204
|
-
let [visibleViews, setVisibleViews] = $
|
|
1205
|
-
let [contentSize, setContentSize] = $
|
|
1206
|
-
let [isAnimating, setAnimating] = $
|
|
1207
|
-
let [isScrolling, setScrolling] = $
|
|
1208
|
-
let virtualizer = $
|
|
1203
|
+
function $f02ef43b5e8eee9b$export$1505db82fe357e65(opts) {
|
|
1204
|
+
let [visibleViews, setVisibleViews] = $aEpNF$react.useState([]);
|
|
1205
|
+
let [contentSize, setContentSize] = $aEpNF$react.useState(new $064492b79924894c$export$cb6da89c6af1a8ec());
|
|
1206
|
+
let [isAnimating, setAnimating] = $aEpNF$react.useState(false);
|
|
1207
|
+
let [isScrolling, setScrolling] = $aEpNF$react.useState(false);
|
|
1208
|
+
let virtualizer = $aEpNF$react.useMemo(()=>new $e1bc15d49d21df0e$export$89be5a243e59c4b2()
|
|
1209
1209
|
, []);
|
|
1210
1210
|
virtualizer.delegate = {
|
|
1211
1211
|
setVisibleViews: setVisibleViews,
|
|
@@ -1225,18 +1225,18 @@ function $1e6e65cc351b4331$export$1505db82fe357e65(opts) {
|
|
|
1225
1225
|
virtualizer.layout = opts.layout;
|
|
1226
1226
|
virtualizer.collection = opts.collection;
|
|
1227
1227
|
virtualizer.transitionDuration = opts.transitionDuration;
|
|
1228
|
-
$
|
|
1228
|
+
$aEpNF$reactariautils.useLayoutEffect(()=>{
|
|
1229
1229
|
virtualizer.afterRender();
|
|
1230
1230
|
});
|
|
1231
1231
|
// eslint-disable-next-line arrow-body-style
|
|
1232
|
-
$
|
|
1232
|
+
$aEpNF$react.useEffect(()=>{
|
|
1233
1233
|
return ()=>virtualizer.willUnmount()
|
|
1234
1234
|
;
|
|
1235
1235
|
}, []);
|
|
1236
1236
|
return {
|
|
1237
1237
|
virtualizer: virtualizer,
|
|
1238
1238
|
visibleViews: visibleViews,
|
|
1239
|
-
setVisibleRect: $
|
|
1239
|
+
setVisibleRect: $aEpNF$react.useCallback((rect)=>{
|
|
1240
1240
|
virtualizer.visibleRect = rect;
|
|
1241
1241
|
}, [
|
|
1242
1242
|
virtualizer
|
|
@@ -1244,13 +1244,13 @@ function $1e6e65cc351b4331$export$1505db82fe357e65(opts) {
|
|
|
1244
1244
|
contentSize: contentSize,
|
|
1245
1245
|
isAnimating: isAnimating,
|
|
1246
1246
|
isScrolling: isScrolling,
|
|
1247
|
-
startScrolling: $
|
|
1247
|
+
startScrolling: $aEpNF$react.useCallback(()=>{
|
|
1248
1248
|
virtualizer.startScrolling();
|
|
1249
1249
|
setScrolling(true);
|
|
1250
1250
|
}, [
|
|
1251
1251
|
virtualizer
|
|
1252
1252
|
]),
|
|
1253
|
-
endScrolling: $
|
|
1253
|
+
endScrolling: $aEpNF$react.useCallback(()=>{
|
|
1254
1254
|
virtualizer.endScrolling();
|
|
1255
1255
|
setScrolling(false);
|
|
1256
1256
|
}, [
|
|
@@ -1260,13 +1260,13 @@ function $1e6e65cc351b4331$export$1505db82fe357e65(opts) {
|
|
|
1260
1260
|
}
|
|
1261
1261
|
|
|
1262
1262
|
|
|
1263
|
-
$parcel$exportWildcard(module.exports, $
|
|
1264
|
-
$parcel$exportWildcard(module.exports, $
|
|
1265
|
-
$parcel$exportWildcard(module.exports, $
|
|
1266
|
-
$parcel$exportWildcard(module.exports, $
|
|
1267
|
-
$parcel$exportWildcard(module.exports, $
|
|
1268
|
-
$parcel$exportWildcard(module.exports, $
|
|
1269
|
-
$parcel$exportWildcard(module.exports, $
|
|
1263
|
+
$parcel$exportWildcard(module.exports, $ac14d65a0ec196dd$exports);
|
|
1264
|
+
$parcel$exportWildcard(module.exports, $8a899922c0a55745$exports);
|
|
1265
|
+
$parcel$exportWildcard(module.exports, $f89f15d7f52bce29$exports);
|
|
1266
|
+
$parcel$exportWildcard(module.exports, $41b7691783731623$exports);
|
|
1267
|
+
$parcel$exportWildcard(module.exports, $064492b79924894c$exports);
|
|
1268
|
+
$parcel$exportWildcard(module.exports, $197a1781bd47f5b9$exports);
|
|
1269
|
+
$parcel$exportWildcard(module.exports, $f02ef43b5e8eee9b$exports);
|
|
1270
1270
|
|
|
1271
1271
|
|
|
1272
1272
|
//# sourceMappingURL=main.js.map
|
package/dist/module.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {useState as $
|
|
2
|
-
import {useLayoutEffect as $
|
|
1
|
+
import {useState as $8D3nr$useState, useMemo as $8D3nr$useMemo, useEffect as $8D3nr$useEffect, useCallback as $8D3nr$useCallback} from "react";
|
|
2
|
+
import {useLayoutEffect as $8D3nr$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 $c74cda7d31af1253$exports = {};
|
|
8
8
|
|
|
9
|
-
$parcel$export($
|
|
10
|
-
class $
|
|
9
|
+
$parcel$export($c74cda7d31af1253$exports, "Layout", () => $c74cda7d31af1253$export$c84671f46d6a1ca);
|
|
10
|
+
class $c74cda7d31af1253$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,14 +66,14 @@ class $bb4fde2f44642f8c$export$c84671f46d6a1ca {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var $
|
|
69
|
+
var $d7fd61009c21d0bb$exports = {};
|
|
70
70
|
|
|
71
|
-
$parcel$export($
|
|
72
|
-
class $
|
|
71
|
+
$parcel$export($d7fd61009c21d0bb$exports, "LayoutInfo", () => $d7fd61009c21d0bb$export$7e0eeb9da702a085);
|
|
72
|
+
class $d7fd61009c21d0bb$export$7e0eeb9da702a085 {
|
|
73
73
|
/**
|
|
74
74
|
* Returns a copy of the LayoutInfo.
|
|
75
75
|
*/ copy() {
|
|
76
|
-
let res = new $
|
|
76
|
+
let res = new $d7fd61009c21d0bb$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
|
|
77
77
|
res.estimatedSize = this.estimatedSize;
|
|
78
78
|
res.opacity = this.opacity;
|
|
79
79
|
res.transform = this.transform;
|
|
@@ -103,14 +103,14 @@ class $8a0cec6d6c841a11$export$7e0eeb9da702a085 {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
var $
|
|
106
|
+
var $3041db3296945e6e$exports = {};
|
|
107
107
|
|
|
108
|
-
$parcel$export($
|
|
109
|
-
class $
|
|
108
|
+
$parcel$export($3041db3296945e6e$exports, "Point", () => $3041db3296945e6e$export$baf26146a414f24a);
|
|
109
|
+
class $3041db3296945e6e$export$baf26146a414f24a {
|
|
110
110
|
/**
|
|
111
111
|
* Returns a copy of this point.
|
|
112
112
|
*/ copy() {
|
|
113
|
-
return new $
|
|
113
|
+
return new $3041db3296945e6e$export$baf26146a414f24a(this.x, this.y);
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
116
|
* Checks if two points are equal.
|
|
@@ -129,11 +129,11 @@ class $c18941612b0d3405$export$baf26146a414f24a {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
var $
|
|
132
|
+
var $60423f92c7f9ad87$exports = {};
|
|
133
133
|
|
|
134
|
-
$parcel$export($
|
|
134
|
+
$parcel$export($60423f92c7f9ad87$exports, "Rect", () => $60423f92c7f9ad87$export$c79fc6492f3af13d);
|
|
135
135
|
|
|
136
|
-
class $
|
|
136
|
+
class $60423f92c7f9ad87$export$c79fc6492f3af13d {
|
|
137
137
|
/**
|
|
138
138
|
* The maximum x-coordinate in the rectangle.
|
|
139
139
|
*/ get maxX() {
|
|
@@ -152,22 +152,22 @@ class $5ace01ed35ef4cc5$export$c79fc6492f3af13d {
|
|
|
152
152
|
/**
|
|
153
153
|
* The top left corner of the rectangle.
|
|
154
154
|
*/ get topLeft() {
|
|
155
|
-
return new $
|
|
155
|
+
return new $3041db3296945e6e$export$baf26146a414f24a(this.x, this.y);
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* The top right corner of the rectangle.
|
|
159
159
|
*/ get topRight() {
|
|
160
|
-
return new $
|
|
160
|
+
return new $3041db3296945e6e$export$baf26146a414f24a(this.maxX, this.y);
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* The bottom left corner of the rectangle.
|
|
164
164
|
*/ get bottomLeft() {
|
|
165
|
-
return new $
|
|
165
|
+
return new $3041db3296945e6e$export$baf26146a414f24a(this.x, this.maxY);
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* The bottom right corner of the rectangle.
|
|
169
169
|
*/ get bottomRight() {
|
|
170
|
-
return new $
|
|
170
|
+
return new $3041db3296945e6e$export$baf26146a414f24a(this.maxX, this.maxY);
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
173
|
* Returns whether this rectangle intersects another rectangle.
|
|
@@ -214,7 +214,7 @@ class $5ace01ed35ef4cc5$export$c79fc6492f3af13d {
|
|
|
214
214
|
/**
|
|
215
215
|
* Returns a copy of this rectangle.
|
|
216
216
|
*/ copy() {
|
|
217
|
-
return new $
|
|
217
|
+
return new $60423f92c7f9ad87$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
|
|
218
218
|
}
|
|
219
219
|
constructor(x = 0, y = 0, width = 0, height = 0){
|
|
220
220
|
this.x = x;
|
|
@@ -225,14 +225,14 @@ class $5ace01ed35ef4cc5$export$c79fc6492f3af13d {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
|
|
228
|
-
var $
|
|
228
|
+
var $ee1bfa90a957fb8a$exports = {};
|
|
229
229
|
|
|
230
|
-
$parcel$export($
|
|
231
|
-
class $
|
|
230
|
+
$parcel$export($ee1bfa90a957fb8a$exports, "Size", () => $ee1bfa90a957fb8a$export$cb6da89c6af1a8ec);
|
|
231
|
+
class $ee1bfa90a957fb8a$export$cb6da89c6af1a8ec {
|
|
232
232
|
/**
|
|
233
233
|
* Returns a copy of this size.
|
|
234
234
|
*/ copy() {
|
|
235
|
-
return new $
|
|
235
|
+
return new $ee1bfa90a957fb8a$export$cb6da89c6af1a8ec(this.width, this.height);
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Returns whether this size is equal to another one.
|
|
@@ -246,11 +246,11 @@ class $11c050b799ca8bfd$export$cb6da89c6af1a8ec {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
|
|
249
|
-
var $
|
|
249
|
+
var $ad1d98aa8f0c31b4$exports = {};
|
|
250
250
|
|
|
251
|
-
$parcel$export($
|
|
252
|
-
let $
|
|
253
|
-
class $
|
|
251
|
+
$parcel$export($ad1d98aa8f0c31b4$exports, "ReusableView", () => $ad1d98aa8f0c31b4$export$1a5223887c560441);
|
|
252
|
+
let $ad1d98aa8f0c31b4$var$KEY = 0;
|
|
253
|
+
class $ad1d98aa8f0c31b4$export$1a5223887c560441 {
|
|
254
254
|
/**
|
|
255
255
|
* Prepares the view for reuse. Called just before the view is removed from the DOM.
|
|
256
256
|
*/ prepareForReuse() {
|
|
@@ -260,38 +260,38 @@ class $d987d203ab974fe7$export$1a5223887c560441 {
|
|
|
260
260
|
}
|
|
261
261
|
constructor(virtualizer){
|
|
262
262
|
this.virtualizer = virtualizer;
|
|
263
|
-
this.key = ++$
|
|
263
|
+
this.key = ++$ad1d98aa8f0c31b4$var$KEY;
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
|
|
268
|
-
var $
|
|
268
|
+
var $fc0b13b484ac1194$exports = {};
|
|
269
269
|
|
|
270
|
-
$parcel$export($
|
|
270
|
+
$parcel$export($fc0b13b484ac1194$exports, "useVirtualizerState", () => $fc0b13b484ac1194$export$1505db82fe357e65);
|
|
271
271
|
|
|
272
272
|
|
|
273
273
|
|
|
274
274
|
|
|
275
275
|
// use high res timer if available
|
|
276
|
-
let $
|
|
276
|
+
let $3eb131dcf37ad5f8$var$perf = typeof window !== 'undefined' ? window.performance : null;
|
|
277
277
|
// @ts-ignore
|
|
278
|
-
let $
|
|
279
|
-
let $
|
|
278
|
+
let $3eb131dcf37ad5f8$var$perfNow = $3eb131dcf37ad5f8$var$perf && ($3eb131dcf37ad5f8$var$perf.now || $3eb131dcf37ad5f8$var$perf.webkitNow || $3eb131dcf37ad5f8$var$perf.msNow || $3eb131dcf37ad5f8$var$perf.mozNow);
|
|
279
|
+
let $3eb131dcf37ad5f8$var$getTime = $3eb131dcf37ad5f8$var$perfNow ? $3eb131dcf37ad5f8$var$perfNow.bind($3eb131dcf37ad5f8$var$perf) : function() {
|
|
280
280
|
return Date.now ? Date.now() : new Date().getTime();
|
|
281
281
|
};
|
|
282
|
-
let $
|
|
283
|
-
function $
|
|
282
|
+
let $3eb131dcf37ad5f8$var$fixTs;
|
|
283
|
+
function $3eb131dcf37ad5f8$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 = $3eb131dcf37ad5f8$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 ($3eb131dcf37ad5f8$var$fixTs == null) $3eb131dcf37ad5f8$var$fixTs = t > 1000000000000 !== $3eb131dcf37ad5f8$var$getTime() > 1000000000000;
|
|
294
|
+
if ($3eb131dcf37ad5f8$var$fixTs) t = $3eb131dcf37ad5f8$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 $df2f6dab2097e0f1$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 $3041db3296945e6e$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 $df2f6dab2097e0f1$export$dc0b63720788090c(begin, end, duration, ease, f
|
|
|
310
310
|
};
|
|
311
311
|
return promise;
|
|
312
312
|
}
|
|
313
|
-
function $
|
|
313
|
+
function $3eb131dcf37ad5f8$export$77860c106b4a6a2e(t) {
|
|
314
314
|
return t;
|
|
315
315
|
}
|
|
316
|
-
function $
|
|
316
|
+
function $3eb131dcf37ad5f8$export$57636bb43b1ccbb0(t) {
|
|
317
317
|
return Math.sin(t * Math.PI / 2);
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
|
|
321
|
-
function $
|
|
321
|
+
function $fc36f9a046a9ce79$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 $fc36f9a046a9ce79$export$acaf96a27438246b(a, b) {
|
|
327
|
+
let toRemove = $fc36f9a046a9ce79$export$37a26b283fd7740e(a, b);
|
|
328
|
+
let toAdd = $fc36f9a046a9ce79$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 $87ac0dc1eab4d828$export$acaf96a27438246b(a, b) {
|
|
|
334
334
|
toUpdate: toUpdate
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
-
function* $
|
|
337
|
+
function* $fc36f9a046a9ce79$export$cfc14088dfefce5f(...iterators) {
|
|
338
338
|
for (let iterator of iterators)yield* iterator;
|
|
339
339
|
}
|
|
340
|
-
function $
|
|
340
|
+
function $fc36f9a046a9ce79$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 $87ac0dc1eab4d828$export$6897c284b6f9f4dc(object) {
|
|
|
347
347
|
|
|
348
348
|
|
|
349
349
|
|
|
350
|
-
class $
|
|
350
|
+
class $364191b3decf3697$var$RollingAverage {
|
|
351
351
|
addSample(sample) {
|
|
352
352
|
this.count++;
|
|
353
353
|
this.value += (sample - this.value) / this.count;
|
|
@@ -357,7 +357,7 @@ class $23a0943f854e7414$var$RollingAverage {
|
|
|
357
357
|
this.value = 0;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class $
|
|
360
|
+
class $364191b3decf3697$export$4455ee6afb38dcbb {
|
|
361
361
|
setVisibleRect(rect) {
|
|
362
362
|
let time = performance.now() - this.startTime;
|
|
363
363
|
if (time < 500) {
|
|
@@ -402,12 +402,12 @@ class $23a0943f854e7414$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 $364191b3decf3697$var$RollingAverage();
|
|
406
|
+
this.averageTime = new $364191b3decf3697$var$RollingAverage();
|
|
407
|
+
this.velocity = new $3041db3296945e6e$export$baf26146a414f24a(5, 5);
|
|
408
|
+
this.overscanX = new $364191b3decf3697$var$RollingAverage();
|
|
409
|
+
this.overscanY = new $364191b3decf3697$var$RollingAverage();
|
|
410
|
+
this.visibleRect = new $60423f92c7f9ad87$export$c79fc6492f3af13d();
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
|
|
@@ -416,7 +416,7 @@ class $23a0943f854e7414$export$4455ee6afb38dcbb {
|
|
|
416
416
|
|
|
417
417
|
|
|
418
418
|
|
|
419
|
-
class $
|
|
419
|
+
class $8e135e531d8dcb66$export$febc5573c75cefb0 {
|
|
420
420
|
constructor(){
|
|
421
421
|
this.level = 0;
|
|
422
422
|
this.actions = [];
|
|
@@ -431,13 +431,13 @@ class $8d8490b32c62e2b1$export$febc5573c75cefb0 {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
|
|
434
|
-
class $
|
|
434
|
+
class $38b9490c1cca8fc4$export$89be5a243e59c4b2 {
|
|
435
435
|
_setContentSize(size) {
|
|
436
436
|
this._contentSize = size;
|
|
437
437
|
this.delegate.setContentSize(size);
|
|
438
438
|
}
|
|
439
439
|
_setContentOffset(offset) {
|
|
440
|
-
let rect = new $
|
|
440
|
+
let rect = new $60423f92c7f9ad87$export$c79fc6492f3af13d(offset.x, offset.y, this._visibleRect.width, this._visibleRect.height);
|
|
441
441
|
this.delegate.setVisibleRect(rect);
|
|
442
442
|
}
|
|
443
443
|
/**
|
|
@@ -551,7 +551,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
551
551
|
let { reuseType: reuseType } = this._getReuseType(layoutInfo, content);
|
|
552
552
|
if (!this._reusableViews[reuseType]) this._reusableViews[reuseType] = [];
|
|
553
553
|
let reusable = this._reusableViews[reuseType];
|
|
554
|
-
let view = reusable.length > 0 ? reusable.pop() : new $
|
|
554
|
+
let view = reusable.length > 0 ? reusable.pop() : new $ad1d98aa8f0c31b4$export$1a5223887c560441(this);
|
|
555
555
|
view.viewType = reuseType;
|
|
556
556
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
557
557
|
layoutInfo = layoutInfo.copy();
|
|
@@ -605,7 +605,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
605
605
|
/**
|
|
606
606
|
* Returns the key for the item view currently at the given point.
|
|
607
607
|
*/ keyAtPoint(point) {
|
|
608
|
-
let rect = new $
|
|
608
|
+
let rect = new $60423f92c7f9ad87$export$c79fc6492f3af13d(point.x, point.y, 1, 1);
|
|
609
609
|
let layoutInfos = this.layout.getVisibleLayoutInfos(rect);
|
|
610
610
|
let layoutInfo = layoutInfos[0];
|
|
611
611
|
if (!layoutInfo) return null;
|
|
@@ -682,7 +682,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
682
682
|
this._animatedContentOffset.x += visibleRect.x - contentOffsetX;
|
|
683
683
|
this._animatedContentOffset.y += visibleRect.y - contentOffsetY;
|
|
684
684
|
hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
685
|
-
} else this._setContentOffset(new $
|
|
685
|
+
} else this._setContentOffset(new $3041db3296945e6e$export$baf26146a414f24a(contentOffsetX, contentOffsetY));
|
|
686
686
|
} else hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
687
687
|
// Apply layout infos, unless this is coming from an animated transaction
|
|
688
688
|
if (!(context.transaction && context.animated)) this._applyLayoutInfos();
|
|
@@ -696,7 +696,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
696
696
|
// Get the content offset to scroll to, taking _animatedContentOffset into account.
|
|
697
697
|
let { x: x , y: y } = this.getVisibleRect();
|
|
698
698
|
this._resetAnimatedContentOffset();
|
|
699
|
-
this._setContentOffset(new $
|
|
699
|
+
this._setContentOffset(new $3041db3296945e6e$export$baf26146a414f24a(x, y));
|
|
700
700
|
}
|
|
701
701
|
if (typeof context.afterAnimation === 'function') context.afterAnimation();
|
|
702
702
|
};
|
|
@@ -780,7 +780,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
780
780
|
let v = this.visibleRect;
|
|
781
781
|
let x = v.x - this._animatedContentOffset.x;
|
|
782
782
|
let y = v.y - this._animatedContentOffset.y;
|
|
783
|
-
return new $
|
|
783
|
+
return new $60423f92c7f9ad87$export$c79fc6492f3af13d(x, y, v.width, v.height);
|
|
784
784
|
}
|
|
785
785
|
getVisibleLayoutInfos() {
|
|
786
786
|
let rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
|
|
@@ -808,7 +808,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
808
808
|
toRemove = currentlyVisible;
|
|
809
809
|
toUpdate = new Set();
|
|
810
810
|
} else {
|
|
811
|
-
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $
|
|
811
|
+
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $fc36f9a046a9ce79$export$acaf96a27438246b(currentlyVisible, visibleLayoutInfos));
|
|
812
812
|
for (let key of toUpdate){
|
|
813
813
|
let view = currentlyVisible.get(key);
|
|
814
814
|
if (!view || !view.layoutInfo) continue;
|
|
@@ -991,7 +991,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
991
991
|
_resetAnimatedContentOffset() {
|
|
992
992
|
// Reset the animated content offset of subviews. See comment in relayoutNow for details.
|
|
993
993
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
994
|
-
this._animatedContentOffset = new $
|
|
994
|
+
this._animatedContentOffset = new $3041db3296945e6e$export$baf26146a414f24a(0, 0);
|
|
995
995
|
this._applyLayoutInfos();
|
|
996
996
|
}
|
|
997
997
|
}
|
|
@@ -1019,7 +1019,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
1019
1019
|
if (minY <= y || maxY === 0) y = minY;
|
|
1020
1020
|
else if (layoutInfo.rect.maxY > maxY) y += layoutInfo.rect.maxY - maxY;
|
|
1021
1021
|
}
|
|
1022
|
-
return this.scrollTo(new $
|
|
1022
|
+
return this.scrollTo(new $3041db3296945e6e$export$baf26146a414f24a(x, y), duration);
|
|
1023
1023
|
}
|
|
1024
1024
|
/**
|
|
1025
1025
|
* Performs an animated scroll to the given offset.
|
|
@@ -1038,7 +1038,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
1038
1038
|
return Promise.resolve();
|
|
1039
1039
|
}
|
|
1040
1040
|
this.startScrolling();
|
|
1041
|
-
this._scrollAnimation = $
|
|
1041
|
+
this._scrollAnimation = $3eb131dcf37ad5f8$export$dc0b63720788090c(this.visibleRect, offset1, duration, $3eb131dcf37ad5f8$export$57636bb43b1ccbb0, (offset)=>{
|
|
1042
1042
|
this._setContentOffset(offset);
|
|
1043
1043
|
});
|
|
1044
1044
|
this._scrollAnimation.then(()=>{
|
|
@@ -1059,7 +1059,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
1059
1059
|
this._endTransaction(animated);
|
|
1060
1060
|
}
|
|
1061
1061
|
_startTransaction() {
|
|
1062
|
-
if (!this._nextTransaction) this._nextTransaction = new $
|
|
1062
|
+
if (!this._nextTransaction) this._nextTransaction = new $8e135e531d8dcb66$export$febc5573c75cefb0;
|
|
1063
1063
|
this._nextTransaction.level++;
|
|
1064
1064
|
}
|
|
1065
1065
|
_endTransaction(animated) {
|
|
@@ -1090,7 +1090,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
1090
1090
|
if (next) this._performTransaction(next);
|
|
1091
1091
|
}
|
|
1092
1092
|
_getContentRect() {
|
|
1093
|
-
return new $
|
|
1093
|
+
return new $60423f92c7f9ad87$export$c79fc6492f3af13d(0, 0, this.contentSize.width, this.contentSize.height);
|
|
1094
1094
|
}
|
|
1095
1095
|
_performTransaction(transaction) {
|
|
1096
1096
|
this._transaction = transaction;
|
|
@@ -1113,7 +1113,7 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
1113
1113
|
},
|
|
1114
1114
|
afterAnimation: ()=>{
|
|
1115
1115
|
// Remove and reuse views when animations are done
|
|
1116
|
-
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 $fc36f9a046a9ce79$export$cfc14088dfefce5f(transaction.toRemove.values(), transaction.removed.values())){
|
|
1117
1117
|
this._children.delete(view);
|
|
1118
1118
|
this.reuseView(view);
|
|
1119
1119
|
}
|
|
@@ -1151,8 +1151,8 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
1151
1151
|
}
|
|
1152
1152
|
constructor(options = {
|
|
1153
1153
|
}){
|
|
1154
|
-
this._contentSize = new $
|
|
1155
|
-
this._visibleRect = new $
|
|
1154
|
+
this._contentSize = new $ee1bfa90a957fb8a$export$cb6da89c6af1a8ec;
|
|
1155
|
+
this._visibleRect = new $60423f92c7f9ad87$export$c79fc6492f3af13d;
|
|
1156
1156
|
this._reusableViews = {
|
|
1157
1157
|
};
|
|
1158
1158
|
this._visibleLayoutInfos = new Map();
|
|
@@ -1160,11 +1160,11 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
1160
1160
|
this._renderedContent = new WeakMap();
|
|
1161
1161
|
this._children = new Set();
|
|
1162
1162
|
this._invalidationContext = null;
|
|
1163
|
-
this._overscanManager = new $
|
|
1163
|
+
this._overscanManager = new $364191b3decf3697$export$4455ee6afb38dcbb();
|
|
1164
1164
|
this._scrollAnimation = null;
|
|
1165
1165
|
this._isScrolling = false;
|
|
1166
1166
|
this._sizeUpdateQueue = new Map();
|
|
1167
|
-
this._animatedContentOffset = new $
|
|
1167
|
+
this._animatedContentOffset = new $3041db3296945e6e$export$baf26146a414f24a(0, 0);
|
|
1168
1168
|
this._transaction = null;
|
|
1169
1169
|
this._nextTransaction = null;
|
|
1170
1170
|
this._transactionQueue = [];
|
|
@@ -1184,12 +1184,12 @@ class $65bed7ce80fa8795$export$89be5a243e59c4b2 {
|
|
|
1184
1184
|
}
|
|
1185
1185
|
|
|
1186
1186
|
|
|
1187
|
-
function $
|
|
1188
|
-
let [visibleViews, setVisibleViews] = $
|
|
1189
|
-
let [contentSize, setContentSize] = $
|
|
1190
|
-
let [isAnimating, setAnimating] = $
|
|
1191
|
-
let [isScrolling, setScrolling] = $
|
|
1192
|
-
let virtualizer = $
|
|
1187
|
+
function $fc0b13b484ac1194$export$1505db82fe357e65(opts) {
|
|
1188
|
+
let [visibleViews, setVisibleViews] = $8D3nr$useState([]);
|
|
1189
|
+
let [contentSize, setContentSize] = $8D3nr$useState(new $ee1bfa90a957fb8a$export$cb6da89c6af1a8ec());
|
|
1190
|
+
let [isAnimating, setAnimating] = $8D3nr$useState(false);
|
|
1191
|
+
let [isScrolling, setScrolling] = $8D3nr$useState(false);
|
|
1192
|
+
let virtualizer = $8D3nr$useMemo(()=>new $38b9490c1cca8fc4$export$89be5a243e59c4b2()
|
|
1193
1193
|
, []);
|
|
1194
1194
|
virtualizer.delegate = {
|
|
1195
1195
|
setVisibleViews: setVisibleViews,
|
|
@@ -1209,18 +1209,18 @@ function $b9814fb1baf5e2e6$export$1505db82fe357e65(opts) {
|
|
|
1209
1209
|
virtualizer.layout = opts.layout;
|
|
1210
1210
|
virtualizer.collection = opts.collection;
|
|
1211
1211
|
virtualizer.transitionDuration = opts.transitionDuration;
|
|
1212
|
-
$
|
|
1212
|
+
$8D3nr$useLayoutEffect(()=>{
|
|
1213
1213
|
virtualizer.afterRender();
|
|
1214
1214
|
});
|
|
1215
1215
|
// eslint-disable-next-line arrow-body-style
|
|
1216
|
-
$
|
|
1216
|
+
$8D3nr$useEffect(()=>{
|
|
1217
1217
|
return ()=>virtualizer.willUnmount()
|
|
1218
1218
|
;
|
|
1219
1219
|
}, []);
|
|
1220
1220
|
return {
|
|
1221
1221
|
virtualizer: virtualizer,
|
|
1222
1222
|
visibleViews: visibleViews,
|
|
1223
|
-
setVisibleRect: $
|
|
1223
|
+
setVisibleRect: $8D3nr$useCallback((rect)=>{
|
|
1224
1224
|
virtualizer.visibleRect = rect;
|
|
1225
1225
|
}, [
|
|
1226
1226
|
virtualizer
|
|
@@ -1228,13 +1228,13 @@ function $b9814fb1baf5e2e6$export$1505db82fe357e65(opts) {
|
|
|
1228
1228
|
contentSize: contentSize,
|
|
1229
1229
|
isAnimating: isAnimating,
|
|
1230
1230
|
isScrolling: isScrolling,
|
|
1231
|
-
startScrolling: $
|
|
1231
|
+
startScrolling: $8D3nr$useCallback(()=>{
|
|
1232
1232
|
virtualizer.startScrolling();
|
|
1233
1233
|
setScrolling(true);
|
|
1234
1234
|
}, [
|
|
1235
1235
|
virtualizer
|
|
1236
1236
|
]),
|
|
1237
|
-
endScrolling: $
|
|
1237
|
+
endScrolling: $8D3nr$useCallback(()=>{
|
|
1238
1238
|
virtualizer.endScrolling();
|
|
1239
1239
|
setScrolling(false);
|
|
1240
1240
|
}, [
|
|
@@ -1246,5 +1246,5 @@ function $b9814fb1baf5e2e6$export$1505db82fe357e65(opts) {
|
|
|
1246
1246
|
|
|
1247
1247
|
|
|
1248
1248
|
|
|
1249
|
-
export {$
|
|
1249
|
+
export {$c74cda7d31af1253$export$c84671f46d6a1ca as Layout, $d7fd61009c21d0bb$export$7e0eeb9da702a085 as LayoutInfo, $3041db3296945e6e$export$baf26146a414f24a as Point, $60423f92c7f9ad87$export$c79fc6492f3af13d as Rect, $ee1bfa90a957fb8a$export$cb6da89c6af1a8ec as Size, $ad1d98aa8f0c31b4$export$1a5223887c560441 as ReusableView, $fc0b13b484ac1194$export$1505db82fe357e65 as useVirtualizerState};
|
|
1250
1250
|
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/virtualizer",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.8-nightly.3113+404d41859",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/utils": "
|
|
22
|
-
"@react-types/shared": "
|
|
21
|
+
"@react-aria/utils": "3.0.0-nightly.1417+404d41859",
|
|
22
|
+
"@react-types/shared": "3.0.0-nightly.1417+404d41859"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|