@react-stately/virtualizer 3.1.7-nightly.3085 → 3.1.7-nightly.3100
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 +4 -4
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
1
|
+
var $bMVmL$react = require("react");
|
|
2
|
+
var $bMVmL$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 $85b9c82579d5b203$exports = {};
|
|
24
24
|
|
|
25
|
-
$parcel$export($
|
|
26
|
-
class $
|
|
25
|
+
$parcel$export($85b9c82579d5b203$exports, "Layout", () => $85b9c82579d5b203$export$c84671f46d6a1ca);
|
|
26
|
+
class $85b9c82579d5b203$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,10 +82,10 @@ class $7d1bafeee40d368b$export$c84671f46d6a1ca {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
var $
|
|
85
|
+
var $67d280d4f19668ff$exports = {};
|
|
86
86
|
|
|
87
|
-
$parcel$export($
|
|
88
|
-
class $
|
|
87
|
+
$parcel$export($67d280d4f19668ff$exports, "LayoutInfo", () => $67d280d4f19668ff$export$7e0eeb9da702a085);
|
|
88
|
+
class $67d280d4f19668ff$export$7e0eeb9da702a085 {
|
|
89
89
|
/**
|
|
90
90
|
* @param type A string representing the view type. Should be `'item'` for item views.
|
|
91
91
|
Other types are used by supplementary views.
|
|
@@ -106,7 +106,7 @@ class $59fb774cf167c850$export$7e0eeb9da702a085 {
|
|
|
106
106
|
/**
|
|
107
107
|
* Returns a copy of the LayoutInfo.
|
|
108
108
|
*/ copy() {
|
|
109
|
-
let res = new $
|
|
109
|
+
let res = new $67d280d4f19668ff$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
|
|
110
110
|
res.estimatedSize = this.estimatedSize;
|
|
111
111
|
res.opacity = this.opacity;
|
|
112
112
|
res.transform = this.transform;
|
|
@@ -119,10 +119,10 @@ class $59fb774cf167c850$export$7e0eeb9da702a085 {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
var $
|
|
122
|
+
var $63dcdc70cf96c5d7$exports = {};
|
|
123
123
|
|
|
124
|
-
$parcel$export($
|
|
125
|
-
class $
|
|
124
|
+
$parcel$export($63dcdc70cf96c5d7$exports, "Point", () => $63dcdc70cf96c5d7$export$baf26146a414f24a);
|
|
125
|
+
class $63dcdc70cf96c5d7$export$baf26146a414f24a {
|
|
126
126
|
constructor(x = 0, y = 0){
|
|
127
127
|
this.x = x;
|
|
128
128
|
this.y = y;
|
|
@@ -130,7 +130,7 @@ class $a6cfd219fe9c9e67$export$baf26146a414f24a {
|
|
|
130
130
|
/**
|
|
131
131
|
* Returns a copy of this point.
|
|
132
132
|
*/ copy() {
|
|
133
|
-
return new $
|
|
133
|
+
return new $63dcdc70cf96c5d7$export$baf26146a414f24a(this.x, this.y);
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Checks if two points are equal.
|
|
@@ -145,11 +145,11 @@ class $a6cfd219fe9c9e67$export$baf26146a414f24a {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
var $
|
|
148
|
+
var $b257fb58d1fe030d$exports = {};
|
|
149
149
|
|
|
150
|
-
$parcel$export($
|
|
150
|
+
$parcel$export($b257fb58d1fe030d$exports, "Rect", () => $b257fb58d1fe030d$export$c79fc6492f3af13d);
|
|
151
151
|
|
|
152
|
-
class $
|
|
152
|
+
class $b257fb58d1fe030d$export$c79fc6492f3af13d {
|
|
153
153
|
constructor(x = 0, y = 0, width = 0, height = 0){
|
|
154
154
|
this.x = x;
|
|
155
155
|
this.y = y;
|
|
@@ -174,22 +174,22 @@ class $3d780642f4e7fb5d$export$c79fc6492f3af13d {
|
|
|
174
174
|
/**
|
|
175
175
|
* The top left corner of the rectangle.
|
|
176
176
|
*/ get topLeft() {
|
|
177
|
-
return new $
|
|
177
|
+
return new $63dcdc70cf96c5d7$export$baf26146a414f24a(this.x, this.y);
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
180
|
* The top right corner of the rectangle.
|
|
181
181
|
*/ get topRight() {
|
|
182
|
-
return new $
|
|
182
|
+
return new $63dcdc70cf96c5d7$export$baf26146a414f24a(this.maxX, this.y);
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* The bottom left corner of the rectangle.
|
|
186
186
|
*/ get bottomLeft() {
|
|
187
|
-
return new $
|
|
187
|
+
return new $63dcdc70cf96c5d7$export$baf26146a414f24a(this.x, this.maxY);
|
|
188
188
|
}
|
|
189
189
|
/**
|
|
190
190
|
* The bottom right corner of the rectangle.
|
|
191
191
|
*/ get bottomRight() {
|
|
192
|
-
return new $
|
|
192
|
+
return new $63dcdc70cf96c5d7$export$baf26146a414f24a(this.maxX, this.maxY);
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Returns whether this rectangle intersects another rectangle.
|
|
@@ -236,15 +236,15 @@ class $3d780642f4e7fb5d$export$c79fc6492f3af13d {
|
|
|
236
236
|
/**
|
|
237
237
|
* Returns a copy of this rectangle.
|
|
238
238
|
*/ copy() {
|
|
239
|
-
return new $
|
|
239
|
+
return new $b257fb58d1fe030d$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
var $
|
|
244
|
+
var $c7e25de3d1bb13b7$exports = {};
|
|
245
245
|
|
|
246
|
-
$parcel$export($
|
|
247
|
-
class $
|
|
246
|
+
$parcel$export($c7e25de3d1bb13b7$exports, "Size", () => $c7e25de3d1bb13b7$export$cb6da89c6af1a8ec);
|
|
247
|
+
class $c7e25de3d1bb13b7$export$cb6da89c6af1a8ec {
|
|
248
248
|
constructor(width = 0, height = 0){
|
|
249
249
|
this.width = width;
|
|
250
250
|
this.height = height;
|
|
@@ -252,7 +252,7 @@ class $7729f76ac8a56bcb$export$cb6da89c6af1a8ec {
|
|
|
252
252
|
/**
|
|
253
253
|
* Returns a copy of this size.
|
|
254
254
|
*/ copy() {
|
|
255
|
-
return new $
|
|
255
|
+
return new $c7e25de3d1bb13b7$export$cb6da89c6af1a8ec(this.width, this.height);
|
|
256
256
|
}
|
|
257
257
|
/**
|
|
258
258
|
* Returns whether this size is equal to another one.
|
|
@@ -262,14 +262,14 @@ class $7729f76ac8a56bcb$export$cb6da89c6af1a8ec {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
|
|
265
|
-
var $
|
|
265
|
+
var $48e7cd77a68be60c$exports = {};
|
|
266
266
|
|
|
267
|
-
$parcel$export($
|
|
268
|
-
let $
|
|
269
|
-
class $
|
|
267
|
+
$parcel$export($48e7cd77a68be60c$exports, "ReusableView", () => $48e7cd77a68be60c$export$1a5223887c560441);
|
|
268
|
+
let $48e7cd77a68be60c$var$KEY = 0;
|
|
269
|
+
class $48e7cd77a68be60c$export$1a5223887c560441 {
|
|
270
270
|
constructor(virtualizer){
|
|
271
271
|
this.virtualizer = virtualizer;
|
|
272
|
-
this.key = ++$
|
|
272
|
+
this.key = ++$48e7cd77a68be60c$var$KEY;
|
|
273
273
|
}
|
|
274
274
|
/**
|
|
275
275
|
* Prepares the view for reuse. Called just before the view is removed from the DOM.
|
|
@@ -281,33 +281,33 @@ class $2a46fa22283edea8$export$1a5223887c560441 {
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
|
|
284
|
-
var $
|
|
284
|
+
var $1fa690b84970509f$exports = {};
|
|
285
285
|
|
|
286
|
-
$parcel$export($
|
|
286
|
+
$parcel$export($1fa690b84970509f$exports, "useVirtualizerState", () => $1fa690b84970509f$export$1505db82fe357e65);
|
|
287
287
|
|
|
288
288
|
|
|
289
289
|
|
|
290
290
|
|
|
291
291
|
// use high res timer if available
|
|
292
|
-
let $
|
|
292
|
+
let $f4437db0d25b1451$var$perf = typeof window !== 'undefined' ? window.performance : null;
|
|
293
293
|
// @ts-ignore
|
|
294
|
-
let $
|
|
295
|
-
let $
|
|
294
|
+
let $f4437db0d25b1451$var$perfNow = $f4437db0d25b1451$var$perf && ($f4437db0d25b1451$var$perf.now || $f4437db0d25b1451$var$perf.webkitNow || $f4437db0d25b1451$var$perf.msNow || $f4437db0d25b1451$var$perf.mozNow);
|
|
295
|
+
let $f4437db0d25b1451$var$getTime = $f4437db0d25b1451$var$perfNow ? $f4437db0d25b1451$var$perfNow.bind($f4437db0d25b1451$var$perf) : function() {
|
|
296
296
|
return Date.now ? Date.now() : new Date().getTime();
|
|
297
297
|
};
|
|
298
|
-
let $
|
|
299
|
-
function $
|
|
298
|
+
let $f4437db0d25b1451$var$fixTs;
|
|
299
|
+
function $f4437db0d25b1451$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 = $f4437db0d25b1451$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 ($f4437db0d25b1451$var$fixTs == null) $f4437db0d25b1451$var$fixTs = t > 1000000000000 !== $f4437db0d25b1451$var$getTime() > 1000000000000;
|
|
310
|
+
if ($f4437db0d25b1451$var$fixTs) t = $f4437db0d25b1451$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 $c48fb8933aeded9d$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 $63dcdc70cf96c5d7$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 $c48fb8933aeded9d$export$dc0b63720788090c(begin, end, duration, ease, f
|
|
|
326
326
|
};
|
|
327
327
|
return promise;
|
|
328
328
|
}
|
|
329
|
-
function $
|
|
329
|
+
function $f4437db0d25b1451$export$77860c106b4a6a2e(t) {
|
|
330
330
|
return t;
|
|
331
331
|
}
|
|
332
|
-
function $
|
|
332
|
+
function $f4437db0d25b1451$export$57636bb43b1ccbb0(t) {
|
|
333
333
|
return Math.sin(t * Math.PI / 2);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
|
|
337
|
-
function $
|
|
337
|
+
function $dcde0d6fc989b206$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 $dcde0d6fc989b206$export$acaf96a27438246b(a, b) {
|
|
343
|
+
let toRemove = $dcde0d6fc989b206$export$37a26b283fd7740e(a, b);
|
|
344
|
+
let toAdd = $dcde0d6fc989b206$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 $ad374c0b55447c87$export$acaf96a27438246b(a, b) {
|
|
|
350
350
|
toUpdate: toUpdate
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
function* $
|
|
353
|
+
function* $dcde0d6fc989b206$export$cfc14088dfefce5f(...iterators) {
|
|
354
354
|
for (let iterator of iterators)yield* iterator;
|
|
355
355
|
}
|
|
356
|
-
function $
|
|
356
|
+
function $dcde0d6fc989b206$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 $ad374c0b55447c87$export$6897c284b6f9f4dc(object) {
|
|
|
363
363
|
|
|
364
364
|
|
|
365
365
|
|
|
366
|
-
class $
|
|
366
|
+
class $83436bb5e0f033a0$var$RollingAverage {
|
|
367
367
|
addSample(sample) {
|
|
368
368
|
this.count++;
|
|
369
369
|
this.value += (sample - this.value) / this.count;
|
|
@@ -373,7 +373,7 @@ class $9461cb6198885a47$var$RollingAverage {
|
|
|
373
373
|
this.value = 0;
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
class $
|
|
376
|
+
class $83436bb5e0f033a0$export$4455ee6afb38dcbb {
|
|
377
377
|
setVisibleRect(rect) {
|
|
378
378
|
let time = performance.now() - this.startTime;
|
|
379
379
|
if (time < 500) {
|
|
@@ -418,12 +418,12 @@ class $9461cb6198885a47$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 $83436bb5e0f033a0$var$RollingAverage();
|
|
422
|
+
this.averageTime = new $83436bb5e0f033a0$var$RollingAverage();
|
|
423
|
+
this.velocity = new $63dcdc70cf96c5d7$export$baf26146a414f24a(5, 5);
|
|
424
|
+
this.overscanX = new $83436bb5e0f033a0$var$RollingAverage();
|
|
425
|
+
this.overscanY = new $83436bb5e0f033a0$var$RollingAverage();
|
|
426
|
+
this.visibleRect = new $b257fb58d1fe030d$export$c79fc6492f3af13d();
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
|
|
@@ -432,7 +432,7 @@ class $9461cb6198885a47$export$4455ee6afb38dcbb {
|
|
|
432
432
|
|
|
433
433
|
|
|
434
434
|
|
|
435
|
-
class $
|
|
435
|
+
class $4030d5bc382f52a8$export$febc5573c75cefb0 {
|
|
436
436
|
constructor(){
|
|
437
437
|
this.level = 0;
|
|
438
438
|
this.actions = [];
|
|
@@ -447,11 +447,11 @@ class $d160844559a6f370$export$febc5573c75cefb0 {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
|
|
450
|
-
class $
|
|
450
|
+
class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
451
451
|
constructor(options = {
|
|
452
452
|
}){
|
|
453
|
-
this._contentSize = new $
|
|
454
|
-
this._visibleRect = new $
|
|
453
|
+
this._contentSize = new $c7e25de3d1bb13b7$export$cb6da89c6af1a8ec;
|
|
454
|
+
this._visibleRect = new $b257fb58d1fe030d$export$c79fc6492f3af13d;
|
|
455
455
|
this._reusableViews = {
|
|
456
456
|
};
|
|
457
457
|
this._visibleLayoutInfos = new Map();
|
|
@@ -459,11 +459,11 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
459
459
|
this._renderedContent = new WeakMap();
|
|
460
460
|
this._children = new Set();
|
|
461
461
|
this._invalidationContext = null;
|
|
462
|
-
this._overscanManager = new $
|
|
462
|
+
this._overscanManager = new $83436bb5e0f033a0$export$4455ee6afb38dcbb();
|
|
463
463
|
this._scrollAnimation = null;
|
|
464
464
|
this._isScrolling = false;
|
|
465
465
|
this._sizeUpdateQueue = new Map();
|
|
466
|
-
this._animatedContentOffset = new $
|
|
466
|
+
this._animatedContentOffset = new $63dcdc70cf96c5d7$export$baf26146a414f24a(0, 0);
|
|
467
467
|
this._transaction = null;
|
|
468
468
|
this._nextTransaction = null;
|
|
469
469
|
this._transactionQueue = [];
|
|
@@ -484,7 +484,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
484
484
|
this.delegate.setContentSize(size);
|
|
485
485
|
}
|
|
486
486
|
_setContentOffset(offset) {
|
|
487
|
-
let rect = new $
|
|
487
|
+
let rect = new $b257fb58d1fe030d$export$c79fc6492f3af13d(offset.x, offset.y, this._visibleRect.width, this._visibleRect.height);
|
|
488
488
|
this.delegate.setVisibleRect(rect);
|
|
489
489
|
}
|
|
490
490
|
/**
|
|
@@ -598,7 +598,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
598
598
|
let { reuseType: reuseType } = this._getReuseType(layoutInfo, content);
|
|
599
599
|
if (!this._reusableViews[reuseType]) this._reusableViews[reuseType] = [];
|
|
600
600
|
let reusable = this._reusableViews[reuseType];
|
|
601
|
-
let view = reusable.length > 0 ? reusable.pop() : new $
|
|
601
|
+
let view = reusable.length > 0 ? reusable.pop() : new $48e7cd77a68be60c$export$1a5223887c560441(this);
|
|
602
602
|
view.viewType = reuseType;
|
|
603
603
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
604
604
|
layoutInfo = layoutInfo.copy();
|
|
@@ -652,7 +652,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
652
652
|
/**
|
|
653
653
|
* Returns the key for the item view currently at the given point.
|
|
654
654
|
*/ keyAtPoint(point) {
|
|
655
|
-
let rect = new $
|
|
655
|
+
let rect = new $b257fb58d1fe030d$export$c79fc6492f3af13d(point.x, point.y, 1, 1);
|
|
656
656
|
let layoutInfos = this.layout.getVisibleLayoutInfos(rect);
|
|
657
657
|
let layoutInfo = layoutInfos[0];
|
|
658
658
|
if (!layoutInfo) return null;
|
|
@@ -729,7 +729,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
729
729
|
this._animatedContentOffset.x += visibleRect.x - contentOffsetX;
|
|
730
730
|
this._animatedContentOffset.y += visibleRect.y - contentOffsetY;
|
|
731
731
|
hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
732
|
-
} else this._setContentOffset(new $
|
|
732
|
+
} else this._setContentOffset(new $63dcdc70cf96c5d7$export$baf26146a414f24a(contentOffsetX, contentOffsetY));
|
|
733
733
|
} else hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
734
734
|
// Apply layout infos, unless this is coming from an animated transaction
|
|
735
735
|
if (!(context.transaction && context.animated)) this._applyLayoutInfos();
|
|
@@ -743,7 +743,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
743
743
|
// Get the content offset to scroll to, taking _animatedContentOffset into account.
|
|
744
744
|
let { x: x , y: y } = this.getVisibleRect();
|
|
745
745
|
this._resetAnimatedContentOffset();
|
|
746
|
-
this._setContentOffset(new $
|
|
746
|
+
this._setContentOffset(new $63dcdc70cf96c5d7$export$baf26146a414f24a(x, y));
|
|
747
747
|
}
|
|
748
748
|
if (typeof context.afterAnimation === 'function') context.afterAnimation();
|
|
749
749
|
};
|
|
@@ -826,7 +826,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
826
826
|
let v = this.visibleRect;
|
|
827
827
|
let x = v.x - this._animatedContentOffset.x;
|
|
828
828
|
let y = v.y - this._animatedContentOffset.y;
|
|
829
|
-
return new $
|
|
829
|
+
return new $b257fb58d1fe030d$export$c79fc6492f3af13d(x, y, v.width, v.height);
|
|
830
830
|
}
|
|
831
831
|
getVisibleLayoutInfos() {
|
|
832
832
|
let rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
|
|
@@ -854,7 +854,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
854
854
|
toRemove = currentlyVisible;
|
|
855
855
|
toUpdate = new Set();
|
|
856
856
|
} else {
|
|
857
|
-
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $
|
|
857
|
+
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $dcde0d6fc989b206$export$acaf96a27438246b(currentlyVisible, visibleLayoutInfos));
|
|
858
858
|
for (let key of toUpdate){
|
|
859
859
|
let view = currentlyVisible.get(key);
|
|
860
860
|
if (!view || !view.layoutInfo) continue;
|
|
@@ -1037,7 +1037,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
1037
1037
|
_resetAnimatedContentOffset() {
|
|
1038
1038
|
// Reset the animated content offset of subviews. See comment in relayoutNow for details.
|
|
1039
1039
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
1040
|
-
this._animatedContentOffset = new $
|
|
1040
|
+
this._animatedContentOffset = new $63dcdc70cf96c5d7$export$baf26146a414f24a(0, 0);
|
|
1041
1041
|
this._applyLayoutInfos();
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
@@ -1065,7 +1065,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
1065
1065
|
if (minY <= y || maxY === 0) y = minY;
|
|
1066
1066
|
else if (layoutInfo.rect.maxY > maxY) y += layoutInfo.rect.maxY - maxY;
|
|
1067
1067
|
}
|
|
1068
|
-
return this.scrollTo(new $
|
|
1068
|
+
return this.scrollTo(new $63dcdc70cf96c5d7$export$baf26146a414f24a(x, y), duration);
|
|
1069
1069
|
}
|
|
1070
1070
|
/**
|
|
1071
1071
|
* Performs an animated scroll to the given offset.
|
|
@@ -1084,7 +1084,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
1084
1084
|
return Promise.resolve();
|
|
1085
1085
|
}
|
|
1086
1086
|
this.startScrolling();
|
|
1087
|
-
this._scrollAnimation = $
|
|
1087
|
+
this._scrollAnimation = $f4437db0d25b1451$export$dc0b63720788090c(this.visibleRect, offset1, duration, $f4437db0d25b1451$export$57636bb43b1ccbb0, (offset)=>{
|
|
1088
1088
|
this._setContentOffset(offset);
|
|
1089
1089
|
});
|
|
1090
1090
|
this._scrollAnimation.then(()=>{
|
|
@@ -1105,7 +1105,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
1105
1105
|
this._endTransaction(animated);
|
|
1106
1106
|
}
|
|
1107
1107
|
_startTransaction() {
|
|
1108
|
-
if (!this._nextTransaction) this._nextTransaction = new $
|
|
1108
|
+
if (!this._nextTransaction) this._nextTransaction = new $4030d5bc382f52a8$export$febc5573c75cefb0;
|
|
1109
1109
|
this._nextTransaction.level++;
|
|
1110
1110
|
}
|
|
1111
1111
|
_endTransaction(animated) {
|
|
@@ -1136,7 +1136,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
1136
1136
|
if (next) this._performTransaction(next);
|
|
1137
1137
|
}
|
|
1138
1138
|
_getContentRect() {
|
|
1139
|
-
return new $
|
|
1139
|
+
return new $b257fb58d1fe030d$export$c79fc6492f3af13d(0, 0, this.contentSize.width, this.contentSize.height);
|
|
1140
1140
|
}
|
|
1141
1141
|
_performTransaction(transaction) {
|
|
1142
1142
|
this._transaction = transaction;
|
|
@@ -1159,7 +1159,7 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
1159
1159
|
},
|
|
1160
1160
|
afterAnimation: ()=>{
|
|
1161
1161
|
// Remove and reuse views when animations are done
|
|
1162
|
-
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) for (let view of $
|
|
1162
|
+
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) for (let view of $dcde0d6fc989b206$export$cfc14088dfefce5f(transaction.toRemove.values(), transaction.removed.values())){
|
|
1163
1163
|
this._children.delete(view);
|
|
1164
1164
|
this.reuseView(view);
|
|
1165
1165
|
}
|
|
@@ -1198,12 +1198,12 @@ class $d40a369183baa2ed$export$89be5a243e59c4b2 {
|
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
1200
|
|
|
1201
|
-
function $
|
|
1202
|
-
let [visibleViews, setVisibleViews] = $
|
|
1203
|
-
let [contentSize, setContentSize] = $
|
|
1204
|
-
let [isAnimating, setAnimating] = $
|
|
1205
|
-
let [isScrolling, setScrolling] = $
|
|
1206
|
-
let virtualizer = $
|
|
1201
|
+
function $1fa690b84970509f$export$1505db82fe357e65(opts) {
|
|
1202
|
+
let [visibleViews, setVisibleViews] = $bMVmL$react.useState([]);
|
|
1203
|
+
let [contentSize, setContentSize] = $bMVmL$react.useState(new $c7e25de3d1bb13b7$export$cb6da89c6af1a8ec());
|
|
1204
|
+
let [isAnimating, setAnimating] = $bMVmL$react.useState(false);
|
|
1205
|
+
let [isScrolling, setScrolling] = $bMVmL$react.useState(false);
|
|
1206
|
+
let virtualizer = $bMVmL$react.useMemo(()=>new $f9e1605aeab61ed8$export$89be5a243e59c4b2()
|
|
1207
1207
|
, []);
|
|
1208
1208
|
virtualizer.delegate = {
|
|
1209
1209
|
setVisibleViews: setVisibleViews,
|
|
@@ -1223,18 +1223,18 @@ function $7351e62c82814357$export$1505db82fe357e65(opts) {
|
|
|
1223
1223
|
virtualizer.layout = opts.layout;
|
|
1224
1224
|
virtualizer.collection = opts.collection;
|
|
1225
1225
|
virtualizer.transitionDuration = opts.transitionDuration;
|
|
1226
|
-
$
|
|
1226
|
+
$bMVmL$reactariautils.useLayoutEffect(()=>{
|
|
1227
1227
|
virtualizer.afterRender();
|
|
1228
1228
|
});
|
|
1229
1229
|
// eslint-disable-next-line arrow-body-style
|
|
1230
|
-
$
|
|
1230
|
+
$bMVmL$react.useEffect(()=>{
|
|
1231
1231
|
return ()=>virtualizer.willUnmount()
|
|
1232
1232
|
;
|
|
1233
1233
|
}, []);
|
|
1234
1234
|
return {
|
|
1235
1235
|
virtualizer: virtualizer,
|
|
1236
1236
|
visibleViews: visibleViews,
|
|
1237
|
-
setVisibleRect: $
|
|
1237
|
+
setVisibleRect: $bMVmL$react.useCallback((rect)=>{
|
|
1238
1238
|
virtualizer.visibleRect = rect;
|
|
1239
1239
|
}, [
|
|
1240
1240
|
virtualizer
|
|
@@ -1242,13 +1242,13 @@ function $7351e62c82814357$export$1505db82fe357e65(opts) {
|
|
|
1242
1242
|
contentSize: contentSize,
|
|
1243
1243
|
isAnimating: isAnimating,
|
|
1244
1244
|
isScrolling: isScrolling,
|
|
1245
|
-
startScrolling: $
|
|
1245
|
+
startScrolling: $bMVmL$react.useCallback(()=>{
|
|
1246
1246
|
virtualizer.startScrolling();
|
|
1247
1247
|
setScrolling(true);
|
|
1248
1248
|
}, [
|
|
1249
1249
|
virtualizer
|
|
1250
1250
|
]),
|
|
1251
|
-
endScrolling: $
|
|
1251
|
+
endScrolling: $bMVmL$react.useCallback(()=>{
|
|
1252
1252
|
virtualizer.endScrolling();
|
|
1253
1253
|
setScrolling(false);
|
|
1254
1254
|
}, [
|
|
@@ -1258,13 +1258,13 @@ function $7351e62c82814357$export$1505db82fe357e65(opts) {
|
|
|
1258
1258
|
}
|
|
1259
1259
|
|
|
1260
1260
|
|
|
1261
|
-
$parcel$exportWildcard(module.exports, $
|
|
1262
|
-
$parcel$exportWildcard(module.exports, $
|
|
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, $
|
|
1261
|
+
$parcel$exportWildcard(module.exports, $85b9c82579d5b203$exports);
|
|
1262
|
+
$parcel$exportWildcard(module.exports, $67d280d4f19668ff$exports);
|
|
1263
|
+
$parcel$exportWildcard(module.exports, $63dcdc70cf96c5d7$exports);
|
|
1264
|
+
$parcel$exportWildcard(module.exports, $b257fb58d1fe030d$exports);
|
|
1265
|
+
$parcel$exportWildcard(module.exports, $c7e25de3d1bb13b7$exports);
|
|
1266
|
+
$parcel$exportWildcard(module.exports, $48e7cd77a68be60c$exports);
|
|
1267
|
+
$parcel$exportWildcard(module.exports, $1fa690b84970509f$exports);
|
|
1268
1268
|
|
|
1269
1269
|
|
|
1270
1270
|
//# 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 $he21n$useState, useMemo as $he21n$useMemo, useEffect as $he21n$useEffect, useCallback as $he21n$useCallback} from "react";
|
|
2
|
+
import {useLayoutEffect as $he21n$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 $e2db9807015c93cd$exports = {};
|
|
8
8
|
|
|
9
|
-
$parcel$export($
|
|
10
|
-
class $
|
|
9
|
+
$parcel$export($e2db9807015c93cd$exports, "Layout", () => $e2db9807015c93cd$export$c84671f46d6a1ca);
|
|
10
|
+
class $e2db9807015c93cd$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,10 @@ class $5fdf1c9861e5563e$export$c84671f46d6a1ca {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
|
|
69
|
-
var $
|
|
69
|
+
var $84802bfc2c93a467$exports = {};
|
|
70
70
|
|
|
71
|
-
$parcel$export($
|
|
72
|
-
class $
|
|
71
|
+
$parcel$export($84802bfc2c93a467$exports, "LayoutInfo", () => $84802bfc2c93a467$export$7e0eeb9da702a085);
|
|
72
|
+
class $84802bfc2c93a467$export$7e0eeb9da702a085 {
|
|
73
73
|
/**
|
|
74
74
|
* @param type A string representing the view type. Should be `'item'` for item views.
|
|
75
75
|
Other types are used by supplementary views.
|
|
@@ -90,7 +90,7 @@ class $a1a685ad77e9532f$export$7e0eeb9da702a085 {
|
|
|
90
90
|
/**
|
|
91
91
|
* Returns a copy of the LayoutInfo.
|
|
92
92
|
*/ copy() {
|
|
93
|
-
let res = new $
|
|
93
|
+
let res = new $84802bfc2c93a467$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
|
|
94
94
|
res.estimatedSize = this.estimatedSize;
|
|
95
95
|
res.opacity = this.opacity;
|
|
96
96
|
res.transform = this.transform;
|
|
@@ -103,10 +103,10 @@ class $a1a685ad77e9532f$export$7e0eeb9da702a085 {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
|
|
106
|
-
var $
|
|
106
|
+
var $412cc72545c8d16d$exports = {};
|
|
107
107
|
|
|
108
|
-
$parcel$export($
|
|
109
|
-
class $
|
|
108
|
+
$parcel$export($412cc72545c8d16d$exports, "Point", () => $412cc72545c8d16d$export$baf26146a414f24a);
|
|
109
|
+
class $412cc72545c8d16d$export$baf26146a414f24a {
|
|
110
110
|
constructor(x = 0, y = 0){
|
|
111
111
|
this.x = x;
|
|
112
112
|
this.y = y;
|
|
@@ -114,7 +114,7 @@ class $451f9ef097cc6d1e$export$baf26146a414f24a {
|
|
|
114
114
|
/**
|
|
115
115
|
* Returns a copy of this point.
|
|
116
116
|
*/ copy() {
|
|
117
|
-
return new $
|
|
117
|
+
return new $412cc72545c8d16d$export$baf26146a414f24a(this.x, this.y);
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* Checks if two points are equal.
|
|
@@ -129,11 +129,11 @@ class $451f9ef097cc6d1e$export$baf26146a414f24a {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
|
|
132
|
-
var $
|
|
132
|
+
var $159dcb078ef84557$exports = {};
|
|
133
133
|
|
|
134
|
-
$parcel$export($
|
|
134
|
+
$parcel$export($159dcb078ef84557$exports, "Rect", () => $159dcb078ef84557$export$c79fc6492f3af13d);
|
|
135
135
|
|
|
136
|
-
class $
|
|
136
|
+
class $159dcb078ef84557$export$c79fc6492f3af13d {
|
|
137
137
|
constructor(x = 0, y = 0, width = 0, height = 0){
|
|
138
138
|
this.x = x;
|
|
139
139
|
this.y = y;
|
|
@@ -158,22 +158,22 @@ class $73bc6d645bb2ddde$export$c79fc6492f3af13d {
|
|
|
158
158
|
/**
|
|
159
159
|
* The top left corner of the rectangle.
|
|
160
160
|
*/ get topLeft() {
|
|
161
|
-
return new $
|
|
161
|
+
return new $412cc72545c8d16d$export$baf26146a414f24a(this.x, this.y);
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* The top right corner of the rectangle.
|
|
165
165
|
*/ get topRight() {
|
|
166
|
-
return new $
|
|
166
|
+
return new $412cc72545c8d16d$export$baf26146a414f24a(this.maxX, this.y);
|
|
167
167
|
}
|
|
168
168
|
/**
|
|
169
169
|
* The bottom left corner of the rectangle.
|
|
170
170
|
*/ get bottomLeft() {
|
|
171
|
-
return new $
|
|
171
|
+
return new $412cc72545c8d16d$export$baf26146a414f24a(this.x, this.maxY);
|
|
172
172
|
}
|
|
173
173
|
/**
|
|
174
174
|
* The bottom right corner of the rectangle.
|
|
175
175
|
*/ get bottomRight() {
|
|
176
|
-
return new $
|
|
176
|
+
return new $412cc72545c8d16d$export$baf26146a414f24a(this.maxX, this.maxY);
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
179
|
* Returns whether this rectangle intersects another rectangle.
|
|
@@ -220,15 +220,15 @@ class $73bc6d645bb2ddde$export$c79fc6492f3af13d {
|
|
|
220
220
|
/**
|
|
221
221
|
* Returns a copy of this rectangle.
|
|
222
222
|
*/ copy() {
|
|
223
|
-
return new $
|
|
223
|
+
return new $159dcb078ef84557$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
|
|
228
|
-
var $
|
|
228
|
+
var $22e89a13b0a391cf$exports = {};
|
|
229
229
|
|
|
230
|
-
$parcel$export($
|
|
231
|
-
class $
|
|
230
|
+
$parcel$export($22e89a13b0a391cf$exports, "Size", () => $22e89a13b0a391cf$export$cb6da89c6af1a8ec);
|
|
231
|
+
class $22e89a13b0a391cf$export$cb6da89c6af1a8ec {
|
|
232
232
|
constructor(width = 0, height = 0){
|
|
233
233
|
this.width = width;
|
|
234
234
|
this.height = height;
|
|
@@ -236,7 +236,7 @@ class $d97c17ab621cc9e9$export$cb6da89c6af1a8ec {
|
|
|
236
236
|
/**
|
|
237
237
|
* Returns a copy of this size.
|
|
238
238
|
*/ copy() {
|
|
239
|
-
return new $
|
|
239
|
+
return new $22e89a13b0a391cf$export$cb6da89c6af1a8ec(this.width, this.height);
|
|
240
240
|
}
|
|
241
241
|
/**
|
|
242
242
|
* Returns whether this size is equal to another one.
|
|
@@ -246,14 +246,14 @@ class $d97c17ab621cc9e9$export$cb6da89c6af1a8ec {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
|
|
249
|
-
var $
|
|
249
|
+
var $4287aeba6cd94157$exports = {};
|
|
250
250
|
|
|
251
|
-
$parcel$export($
|
|
252
|
-
let $
|
|
253
|
-
class $
|
|
251
|
+
$parcel$export($4287aeba6cd94157$exports, "ReusableView", () => $4287aeba6cd94157$export$1a5223887c560441);
|
|
252
|
+
let $4287aeba6cd94157$var$KEY = 0;
|
|
253
|
+
class $4287aeba6cd94157$export$1a5223887c560441 {
|
|
254
254
|
constructor(virtualizer){
|
|
255
255
|
this.virtualizer = virtualizer;
|
|
256
|
-
this.key = ++$
|
|
256
|
+
this.key = ++$4287aeba6cd94157$var$KEY;
|
|
257
257
|
}
|
|
258
258
|
/**
|
|
259
259
|
* Prepares the view for reuse. Called just before the view is removed from the DOM.
|
|
@@ -265,33 +265,33 @@ class $33d41102678e8fed$export$1a5223887c560441 {
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
|
|
268
|
-
var $
|
|
268
|
+
var $768d3e68d680b21c$exports = {};
|
|
269
269
|
|
|
270
|
-
$parcel$export($
|
|
270
|
+
$parcel$export($768d3e68d680b21c$exports, "useVirtualizerState", () => $768d3e68d680b21c$export$1505db82fe357e65);
|
|
271
271
|
|
|
272
272
|
|
|
273
273
|
|
|
274
274
|
|
|
275
275
|
// use high res timer if available
|
|
276
|
-
let $
|
|
276
|
+
let $6a9b8d711ba49ea7$var$perf = typeof window !== 'undefined' ? window.performance : null;
|
|
277
277
|
// @ts-ignore
|
|
278
|
-
let $
|
|
279
|
-
let $
|
|
278
|
+
let $6a9b8d711ba49ea7$var$perfNow = $6a9b8d711ba49ea7$var$perf && ($6a9b8d711ba49ea7$var$perf.now || $6a9b8d711ba49ea7$var$perf.webkitNow || $6a9b8d711ba49ea7$var$perf.msNow || $6a9b8d711ba49ea7$var$perf.mozNow);
|
|
279
|
+
let $6a9b8d711ba49ea7$var$getTime = $6a9b8d711ba49ea7$var$perfNow ? $6a9b8d711ba49ea7$var$perfNow.bind($6a9b8d711ba49ea7$var$perf) : function() {
|
|
280
280
|
return Date.now ? Date.now() : new Date().getTime();
|
|
281
281
|
};
|
|
282
|
-
let $
|
|
283
|
-
function $
|
|
282
|
+
let $6a9b8d711ba49ea7$var$fixTs;
|
|
283
|
+
function $6a9b8d711ba49ea7$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 = $6a9b8d711ba49ea7$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 ($6a9b8d711ba49ea7$var$fixTs == null) $6a9b8d711ba49ea7$var$fixTs = t > 1000000000000 !== $6a9b8d711ba49ea7$var$getTime() > 1000000000000;
|
|
294
|
+
if ($6a9b8d711ba49ea7$var$fixTs) t = $6a9b8d711ba49ea7$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 $8ca611b63d48b392$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 $412cc72545c8d16d$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 $8ca611b63d48b392$export$dc0b63720788090c(begin, end, duration, ease, f
|
|
|
310
310
|
};
|
|
311
311
|
return promise;
|
|
312
312
|
}
|
|
313
|
-
function $
|
|
313
|
+
function $6a9b8d711ba49ea7$export$77860c106b4a6a2e(t) {
|
|
314
314
|
return t;
|
|
315
315
|
}
|
|
316
|
-
function $
|
|
316
|
+
function $6a9b8d711ba49ea7$export$57636bb43b1ccbb0(t) {
|
|
317
317
|
return Math.sin(t * Math.PI / 2);
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
|
|
321
|
-
function $
|
|
321
|
+
function $c984faf4f5b24890$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 $c984faf4f5b24890$export$acaf96a27438246b(a, b) {
|
|
327
|
+
let toRemove = $c984faf4f5b24890$export$37a26b283fd7740e(a, b);
|
|
328
|
+
let toAdd = $c984faf4f5b24890$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 $a06e8ec843c34c36$export$acaf96a27438246b(a, b) {
|
|
|
334
334
|
toUpdate: toUpdate
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
-
function* $
|
|
337
|
+
function* $c984faf4f5b24890$export$cfc14088dfefce5f(...iterators) {
|
|
338
338
|
for (let iterator of iterators)yield* iterator;
|
|
339
339
|
}
|
|
340
|
-
function $
|
|
340
|
+
function $c984faf4f5b24890$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 $a06e8ec843c34c36$export$6897c284b6f9f4dc(object) {
|
|
|
347
347
|
|
|
348
348
|
|
|
349
349
|
|
|
350
|
-
class $
|
|
350
|
+
class $ffa819e9899a870b$var$RollingAverage {
|
|
351
351
|
addSample(sample) {
|
|
352
352
|
this.count++;
|
|
353
353
|
this.value += (sample - this.value) / this.count;
|
|
@@ -357,7 +357,7 @@ class $6a954f2741ea24fb$var$RollingAverage {
|
|
|
357
357
|
this.value = 0;
|
|
358
358
|
}
|
|
359
359
|
}
|
|
360
|
-
class $
|
|
360
|
+
class $ffa819e9899a870b$export$4455ee6afb38dcbb {
|
|
361
361
|
setVisibleRect(rect) {
|
|
362
362
|
let time = performance.now() - this.startTime;
|
|
363
363
|
if (time < 500) {
|
|
@@ -402,12 +402,12 @@ class $6a954f2741ea24fb$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 $ffa819e9899a870b$var$RollingAverage();
|
|
406
|
+
this.averageTime = new $ffa819e9899a870b$var$RollingAverage();
|
|
407
|
+
this.velocity = new $412cc72545c8d16d$export$baf26146a414f24a(5, 5);
|
|
408
|
+
this.overscanX = new $ffa819e9899a870b$var$RollingAverage();
|
|
409
|
+
this.overscanY = new $ffa819e9899a870b$var$RollingAverage();
|
|
410
|
+
this.visibleRect = new $159dcb078ef84557$export$c79fc6492f3af13d();
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
|
|
@@ -416,7 +416,7 @@ class $6a954f2741ea24fb$export$4455ee6afb38dcbb {
|
|
|
416
416
|
|
|
417
417
|
|
|
418
418
|
|
|
419
|
-
class $
|
|
419
|
+
class $6b14b0a55eb74a2c$export$febc5573c75cefb0 {
|
|
420
420
|
constructor(){
|
|
421
421
|
this.level = 0;
|
|
422
422
|
this.actions = [];
|
|
@@ -431,11 +431,11 @@ class $98c6eae7e04143f4$export$febc5573c75cefb0 {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
|
|
434
|
-
class $
|
|
434
|
+
class $db9fd92d994d4bf6$export$89be5a243e59c4b2 {
|
|
435
435
|
constructor(options = {
|
|
436
436
|
}){
|
|
437
|
-
this._contentSize = new $
|
|
438
|
-
this._visibleRect = new $
|
|
437
|
+
this._contentSize = new $22e89a13b0a391cf$export$cb6da89c6af1a8ec;
|
|
438
|
+
this._visibleRect = new $159dcb078ef84557$export$c79fc6492f3af13d;
|
|
439
439
|
this._reusableViews = {
|
|
440
440
|
};
|
|
441
441
|
this._visibleLayoutInfos = new Map();
|
|
@@ -443,11 +443,11 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
443
443
|
this._renderedContent = new WeakMap();
|
|
444
444
|
this._children = new Set();
|
|
445
445
|
this._invalidationContext = null;
|
|
446
|
-
this._overscanManager = new $
|
|
446
|
+
this._overscanManager = new $ffa819e9899a870b$export$4455ee6afb38dcbb();
|
|
447
447
|
this._scrollAnimation = null;
|
|
448
448
|
this._isScrolling = false;
|
|
449
449
|
this._sizeUpdateQueue = new Map();
|
|
450
|
-
this._animatedContentOffset = new $
|
|
450
|
+
this._animatedContentOffset = new $412cc72545c8d16d$export$baf26146a414f24a(0, 0);
|
|
451
451
|
this._transaction = null;
|
|
452
452
|
this._nextTransaction = null;
|
|
453
453
|
this._transactionQueue = [];
|
|
@@ -468,7 +468,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
468
468
|
this.delegate.setContentSize(size);
|
|
469
469
|
}
|
|
470
470
|
_setContentOffset(offset) {
|
|
471
|
-
let rect = new $
|
|
471
|
+
let rect = new $159dcb078ef84557$export$c79fc6492f3af13d(offset.x, offset.y, this._visibleRect.width, this._visibleRect.height);
|
|
472
472
|
this.delegate.setVisibleRect(rect);
|
|
473
473
|
}
|
|
474
474
|
/**
|
|
@@ -582,7 +582,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
582
582
|
let { reuseType: reuseType } = this._getReuseType(layoutInfo, content);
|
|
583
583
|
if (!this._reusableViews[reuseType]) this._reusableViews[reuseType] = [];
|
|
584
584
|
let reusable = this._reusableViews[reuseType];
|
|
585
|
-
let view = reusable.length > 0 ? reusable.pop() : new $
|
|
585
|
+
let view = reusable.length > 0 ? reusable.pop() : new $4287aeba6cd94157$export$1a5223887c560441(this);
|
|
586
586
|
view.viewType = reuseType;
|
|
587
587
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
588
588
|
layoutInfo = layoutInfo.copy();
|
|
@@ -636,7 +636,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
636
636
|
/**
|
|
637
637
|
* Returns the key for the item view currently at the given point.
|
|
638
638
|
*/ keyAtPoint(point) {
|
|
639
|
-
let rect = new $
|
|
639
|
+
let rect = new $159dcb078ef84557$export$c79fc6492f3af13d(point.x, point.y, 1, 1);
|
|
640
640
|
let layoutInfos = this.layout.getVisibleLayoutInfos(rect);
|
|
641
641
|
let layoutInfo = layoutInfos[0];
|
|
642
642
|
if (!layoutInfo) return null;
|
|
@@ -713,7 +713,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
713
713
|
this._animatedContentOffset.x += visibleRect.x - contentOffsetX;
|
|
714
714
|
this._animatedContentOffset.y += visibleRect.y - contentOffsetY;
|
|
715
715
|
hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
716
|
-
} else this._setContentOffset(new $
|
|
716
|
+
} else this._setContentOffset(new $412cc72545c8d16d$export$baf26146a414f24a(contentOffsetX, contentOffsetY));
|
|
717
717
|
} else hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
718
718
|
// Apply layout infos, unless this is coming from an animated transaction
|
|
719
719
|
if (!(context.transaction && context.animated)) this._applyLayoutInfos();
|
|
@@ -727,7 +727,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
727
727
|
// Get the content offset to scroll to, taking _animatedContentOffset into account.
|
|
728
728
|
let { x: x , y: y } = this.getVisibleRect();
|
|
729
729
|
this._resetAnimatedContentOffset();
|
|
730
|
-
this._setContentOffset(new $
|
|
730
|
+
this._setContentOffset(new $412cc72545c8d16d$export$baf26146a414f24a(x, y));
|
|
731
731
|
}
|
|
732
732
|
if (typeof context.afterAnimation === 'function') context.afterAnimation();
|
|
733
733
|
};
|
|
@@ -810,7 +810,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
810
810
|
let v = this.visibleRect;
|
|
811
811
|
let x = v.x - this._animatedContentOffset.x;
|
|
812
812
|
let y = v.y - this._animatedContentOffset.y;
|
|
813
|
-
return new $
|
|
813
|
+
return new $159dcb078ef84557$export$c79fc6492f3af13d(x, y, v.width, v.height);
|
|
814
814
|
}
|
|
815
815
|
getVisibleLayoutInfos() {
|
|
816
816
|
let rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
|
|
@@ -838,7 +838,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
838
838
|
toRemove = currentlyVisible;
|
|
839
839
|
toUpdate = new Set();
|
|
840
840
|
} else {
|
|
841
|
-
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $
|
|
841
|
+
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $c984faf4f5b24890$export$acaf96a27438246b(currentlyVisible, visibleLayoutInfos));
|
|
842
842
|
for (let key of toUpdate){
|
|
843
843
|
let view = currentlyVisible.get(key);
|
|
844
844
|
if (!view || !view.layoutInfo) continue;
|
|
@@ -1021,7 +1021,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
1021
1021
|
_resetAnimatedContentOffset() {
|
|
1022
1022
|
// Reset the animated content offset of subviews. See comment in relayoutNow for details.
|
|
1023
1023
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
1024
|
-
this._animatedContentOffset = new $
|
|
1024
|
+
this._animatedContentOffset = new $412cc72545c8d16d$export$baf26146a414f24a(0, 0);
|
|
1025
1025
|
this._applyLayoutInfos();
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
@@ -1049,7 +1049,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
1049
1049
|
if (minY <= y || maxY === 0) y = minY;
|
|
1050
1050
|
else if (layoutInfo.rect.maxY > maxY) y += layoutInfo.rect.maxY - maxY;
|
|
1051
1051
|
}
|
|
1052
|
-
return this.scrollTo(new $
|
|
1052
|
+
return this.scrollTo(new $412cc72545c8d16d$export$baf26146a414f24a(x, y), duration);
|
|
1053
1053
|
}
|
|
1054
1054
|
/**
|
|
1055
1055
|
* Performs an animated scroll to the given offset.
|
|
@@ -1068,7 +1068,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
1068
1068
|
return Promise.resolve();
|
|
1069
1069
|
}
|
|
1070
1070
|
this.startScrolling();
|
|
1071
|
-
this._scrollAnimation = $
|
|
1071
|
+
this._scrollAnimation = $6a9b8d711ba49ea7$export$dc0b63720788090c(this.visibleRect, offset1, duration, $6a9b8d711ba49ea7$export$57636bb43b1ccbb0, (offset)=>{
|
|
1072
1072
|
this._setContentOffset(offset);
|
|
1073
1073
|
});
|
|
1074
1074
|
this._scrollAnimation.then(()=>{
|
|
@@ -1089,7 +1089,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
1089
1089
|
this._endTransaction(animated);
|
|
1090
1090
|
}
|
|
1091
1091
|
_startTransaction() {
|
|
1092
|
-
if (!this._nextTransaction) this._nextTransaction = new $
|
|
1092
|
+
if (!this._nextTransaction) this._nextTransaction = new $6b14b0a55eb74a2c$export$febc5573c75cefb0;
|
|
1093
1093
|
this._nextTransaction.level++;
|
|
1094
1094
|
}
|
|
1095
1095
|
_endTransaction(animated) {
|
|
@@ -1120,7 +1120,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
1120
1120
|
if (next) this._performTransaction(next);
|
|
1121
1121
|
}
|
|
1122
1122
|
_getContentRect() {
|
|
1123
|
-
return new $
|
|
1123
|
+
return new $159dcb078ef84557$export$c79fc6492f3af13d(0, 0, this.contentSize.width, this.contentSize.height);
|
|
1124
1124
|
}
|
|
1125
1125
|
_performTransaction(transaction) {
|
|
1126
1126
|
this._transaction = transaction;
|
|
@@ -1143,7 +1143,7 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
1143
1143
|
},
|
|
1144
1144
|
afterAnimation: ()=>{
|
|
1145
1145
|
// Remove and reuse views when animations are done
|
|
1146
|
-
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) for (let view of $
|
|
1146
|
+
if (transaction.toRemove.size > 0 || transaction.removed.size > 0) for (let view of $c984faf4f5b24890$export$cfc14088dfefce5f(transaction.toRemove.values(), transaction.removed.values())){
|
|
1147
1147
|
this._children.delete(view);
|
|
1148
1148
|
this.reuseView(view);
|
|
1149
1149
|
}
|
|
@@ -1182,12 +1182,12 @@ class $490424a627fe9bf5$export$89be5a243e59c4b2 {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
|
|
1184
1184
|
|
|
1185
|
-
function $
|
|
1186
|
-
let [visibleViews, setVisibleViews] = $
|
|
1187
|
-
let [contentSize, setContentSize] = $
|
|
1188
|
-
let [isAnimating, setAnimating] = $
|
|
1189
|
-
let [isScrolling, setScrolling] = $
|
|
1190
|
-
let virtualizer = $
|
|
1185
|
+
function $768d3e68d680b21c$export$1505db82fe357e65(opts) {
|
|
1186
|
+
let [visibleViews, setVisibleViews] = $he21n$useState([]);
|
|
1187
|
+
let [contentSize, setContentSize] = $he21n$useState(new $22e89a13b0a391cf$export$cb6da89c6af1a8ec());
|
|
1188
|
+
let [isAnimating, setAnimating] = $he21n$useState(false);
|
|
1189
|
+
let [isScrolling, setScrolling] = $he21n$useState(false);
|
|
1190
|
+
let virtualizer = $he21n$useMemo(()=>new $db9fd92d994d4bf6$export$89be5a243e59c4b2()
|
|
1191
1191
|
, []);
|
|
1192
1192
|
virtualizer.delegate = {
|
|
1193
1193
|
setVisibleViews: setVisibleViews,
|
|
@@ -1207,18 +1207,18 @@ function $f7f84fd9b18e68c2$export$1505db82fe357e65(opts) {
|
|
|
1207
1207
|
virtualizer.layout = opts.layout;
|
|
1208
1208
|
virtualizer.collection = opts.collection;
|
|
1209
1209
|
virtualizer.transitionDuration = opts.transitionDuration;
|
|
1210
|
-
$
|
|
1210
|
+
$he21n$useLayoutEffect(()=>{
|
|
1211
1211
|
virtualizer.afterRender();
|
|
1212
1212
|
});
|
|
1213
1213
|
// eslint-disable-next-line arrow-body-style
|
|
1214
|
-
$
|
|
1214
|
+
$he21n$useEffect(()=>{
|
|
1215
1215
|
return ()=>virtualizer.willUnmount()
|
|
1216
1216
|
;
|
|
1217
1217
|
}, []);
|
|
1218
1218
|
return {
|
|
1219
1219
|
virtualizer: virtualizer,
|
|
1220
1220
|
visibleViews: visibleViews,
|
|
1221
|
-
setVisibleRect: $
|
|
1221
|
+
setVisibleRect: $he21n$useCallback((rect)=>{
|
|
1222
1222
|
virtualizer.visibleRect = rect;
|
|
1223
1223
|
}, [
|
|
1224
1224
|
virtualizer
|
|
@@ -1226,13 +1226,13 @@ function $f7f84fd9b18e68c2$export$1505db82fe357e65(opts) {
|
|
|
1226
1226
|
contentSize: contentSize,
|
|
1227
1227
|
isAnimating: isAnimating,
|
|
1228
1228
|
isScrolling: isScrolling,
|
|
1229
|
-
startScrolling: $
|
|
1229
|
+
startScrolling: $he21n$useCallback(()=>{
|
|
1230
1230
|
virtualizer.startScrolling();
|
|
1231
1231
|
setScrolling(true);
|
|
1232
1232
|
}, [
|
|
1233
1233
|
virtualizer
|
|
1234
1234
|
]),
|
|
1235
|
-
endScrolling: $
|
|
1235
|
+
endScrolling: $he21n$useCallback(()=>{
|
|
1236
1236
|
virtualizer.endScrolling();
|
|
1237
1237
|
setScrolling(false);
|
|
1238
1238
|
}, [
|
|
@@ -1244,5 +1244,5 @@ function $f7f84fd9b18e68c2$export$1505db82fe357e65(opts) {
|
|
|
1244
1244
|
|
|
1245
1245
|
|
|
1246
1246
|
|
|
1247
|
-
export {$
|
|
1247
|
+
export {$e2db9807015c93cd$export$c84671f46d6a1ca as Layout, $84802bfc2c93a467$export$7e0eeb9da702a085 as LayoutInfo, $412cc72545c8d16d$export$baf26146a414f24a as Point, $159dcb078ef84557$export$c79fc6492f3af13d as Rect, $22e89a13b0a391cf$export$cb6da89c6af1a8ec as Size, $4287aeba6cd94157$export$1a5223887c560441 as ReusableView, $768d3e68d680b21c$export$1505db82fe357e65 as useVirtualizerState};
|
|
1248
1248
|
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/virtualizer",
|
|
3
|
-
"version": "3.1.7-nightly.
|
|
3
|
+
"version": "3.1.7-nightly.3100+da2aa7467",
|
|
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": "3.0.0-nightly.
|
|
22
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
21
|
+
"@react-aria/utils": "3.0.0-nightly.1409+da2aa7467",
|
|
22
|
+
"@react-types/shared": "3.0.0-nightly.1409+da2aa7467"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "da2aa74670fbd93335ff01401ca53826b3602777"
|
|
31
31
|
}
|