@react-stately/virtualizer 3.1.7-nightly.3111 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +153 -151
- package/dist/main.js.map +1 -1
- package/dist/module.js +147 -145
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
package/dist/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
1
|
+
var $84niS$react = require("react");
|
|
2
|
+
var $84niS$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 $0d5c9ff6e1157361$exports = {};
|
|
24
24
|
|
|
25
|
-
$parcel$export($
|
|
26
|
-
class $
|
|
25
|
+
$parcel$export($0d5c9ff6e1157361$exports, "Layout", () => $0d5c9ff6e1157361$export$c84671f46d6a1ca);
|
|
26
|
+
class $0d5c9ff6e1157361$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,23 @@ class $85b9c82579d5b203$export$c84671f46d6a1ca {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
var $
|
|
85
|
+
var $f1d3da1211768ed5$exports = {};
|
|
86
86
|
|
|
87
|
-
$parcel$export($
|
|
88
|
-
class $
|
|
87
|
+
$parcel$export($f1d3da1211768ed5$exports, "LayoutInfo", () => $f1d3da1211768ed5$export$7e0eeb9da702a085);
|
|
88
|
+
class $f1d3da1211768ed5$export$7e0eeb9da702a085 {
|
|
89
|
+
/**
|
|
90
|
+
* Returns a copy of the LayoutInfo.
|
|
91
|
+
*/ copy() {
|
|
92
|
+
let res = new $f1d3da1211768ed5$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
|
|
93
|
+
res.estimatedSize = this.estimatedSize;
|
|
94
|
+
res.opacity = this.opacity;
|
|
95
|
+
res.transform = this.transform;
|
|
96
|
+
res.parentKey = this.parentKey;
|
|
97
|
+
res.isSticky = this.isSticky;
|
|
98
|
+
res.zIndex = this.zIndex;
|
|
99
|
+
res.allowOverflow = this.allowOverflow;
|
|
100
|
+
return res;
|
|
101
|
+
}
|
|
89
102
|
/**
|
|
90
103
|
* @param type A string representing the view type. Should be `'item'` for item views.
|
|
91
104
|
Other types are used by supplementary views.
|
|
@@ -103,34 +116,17 @@ class $67d280d4f19668ff$export$7e0eeb9da702a085 {
|
|
|
103
116
|
this.zIndex = 0;
|
|
104
117
|
this.allowOverflow = false;
|
|
105
118
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Returns a copy of the LayoutInfo.
|
|
108
|
-
*/ copy() {
|
|
109
|
-
let res = new $67d280d4f19668ff$export$7e0eeb9da702a085(this.type, this.key, this.rect.copy());
|
|
110
|
-
res.estimatedSize = this.estimatedSize;
|
|
111
|
-
res.opacity = this.opacity;
|
|
112
|
-
res.transform = this.transform;
|
|
113
|
-
res.parentKey = this.parentKey;
|
|
114
|
-
res.isSticky = this.isSticky;
|
|
115
|
-
res.zIndex = this.zIndex;
|
|
116
|
-
res.allowOverflow = this.allowOverflow;
|
|
117
|
-
return res;
|
|
118
|
-
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
|
|
122
|
-
var $
|
|
122
|
+
var $103abcdf9cf478de$exports = {};
|
|
123
123
|
|
|
124
|
-
$parcel$export($
|
|
125
|
-
class $
|
|
126
|
-
constructor(x = 0, y = 0){
|
|
127
|
-
this.x = x;
|
|
128
|
-
this.y = y;
|
|
129
|
-
}
|
|
124
|
+
$parcel$export($103abcdf9cf478de$exports, "Point", () => $103abcdf9cf478de$export$baf26146a414f24a);
|
|
125
|
+
class $103abcdf9cf478de$export$baf26146a414f24a {
|
|
130
126
|
/**
|
|
131
127
|
* Returns a copy of this point.
|
|
132
128
|
*/ copy() {
|
|
133
|
-
return new $
|
|
129
|
+
return new $103abcdf9cf478de$export$baf26146a414f24a(this.x, this.y);
|
|
134
130
|
}
|
|
135
131
|
/**
|
|
136
132
|
* Checks if two points are equal.
|
|
@@ -142,20 +138,18 @@ class $63dcdc70cf96c5d7$export$baf26146a414f24a {
|
|
|
142
138
|
*/ isOrigin() {
|
|
143
139
|
return this.x === 0 && this.y === 0;
|
|
144
140
|
}
|
|
141
|
+
constructor(x = 0, y = 0){
|
|
142
|
+
this.x = x;
|
|
143
|
+
this.y = y;
|
|
144
|
+
}
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
|
|
148
|
-
var $
|
|
148
|
+
var $2d68b1437715e315$exports = {};
|
|
149
149
|
|
|
150
|
-
$parcel$export($
|
|
150
|
+
$parcel$export($2d68b1437715e315$exports, "Rect", () => $2d68b1437715e315$export$c79fc6492f3af13d);
|
|
151
151
|
|
|
152
|
-
class $
|
|
153
|
-
constructor(x = 0, y = 0, width = 0, height = 0){
|
|
154
|
-
this.x = x;
|
|
155
|
-
this.y = y;
|
|
156
|
-
this.width = width;
|
|
157
|
-
this.height = height;
|
|
158
|
-
}
|
|
152
|
+
class $2d68b1437715e315$export$c79fc6492f3af13d {
|
|
159
153
|
/**
|
|
160
154
|
* The maximum x-coordinate in the rectangle.
|
|
161
155
|
*/ get maxX() {
|
|
@@ -174,22 +168,22 @@ class $b257fb58d1fe030d$export$c79fc6492f3af13d {
|
|
|
174
168
|
/**
|
|
175
169
|
* The top left corner of the rectangle.
|
|
176
170
|
*/ get topLeft() {
|
|
177
|
-
return new $
|
|
171
|
+
return new $103abcdf9cf478de$export$baf26146a414f24a(this.x, this.y);
|
|
178
172
|
}
|
|
179
173
|
/**
|
|
180
174
|
* The top right corner of the rectangle.
|
|
181
175
|
*/ get topRight() {
|
|
182
|
-
return new $
|
|
176
|
+
return new $103abcdf9cf478de$export$baf26146a414f24a(this.maxX, this.y);
|
|
183
177
|
}
|
|
184
178
|
/**
|
|
185
179
|
* The bottom left corner of the rectangle.
|
|
186
180
|
*/ get bottomLeft() {
|
|
187
|
-
return new $
|
|
181
|
+
return new $103abcdf9cf478de$export$baf26146a414f24a(this.x, this.maxY);
|
|
188
182
|
}
|
|
189
183
|
/**
|
|
190
184
|
* The bottom right corner of the rectangle.
|
|
191
185
|
*/ get bottomRight() {
|
|
192
|
-
return new $
|
|
186
|
+
return new $103abcdf9cf478de$export$baf26146a414f24a(this.maxX, this.maxY);
|
|
193
187
|
}
|
|
194
188
|
/**
|
|
195
189
|
* Returns whether this rectangle intersects another rectangle.
|
|
@@ -236,41 +230,43 @@ class $b257fb58d1fe030d$export$c79fc6492f3af13d {
|
|
|
236
230
|
/**
|
|
237
231
|
* Returns a copy of this rectangle.
|
|
238
232
|
*/ copy() {
|
|
239
|
-
return new $
|
|
233
|
+
return new $2d68b1437715e315$export$c79fc6492f3af13d(this.x, this.y, this.width, this.height);
|
|
234
|
+
}
|
|
235
|
+
constructor(x = 0, y = 0, width = 0, height = 0){
|
|
236
|
+
this.x = x;
|
|
237
|
+
this.y = y;
|
|
238
|
+
this.width = width;
|
|
239
|
+
this.height = height;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
var $
|
|
244
|
+
var $a3f05bab0f981c14$exports = {};
|
|
245
245
|
|
|
246
|
-
$parcel$export($
|
|
247
|
-
class $
|
|
248
|
-
constructor(width = 0, height = 0){
|
|
249
|
-
this.width = width;
|
|
250
|
-
this.height = height;
|
|
251
|
-
}
|
|
246
|
+
$parcel$export($a3f05bab0f981c14$exports, "Size", () => $a3f05bab0f981c14$export$cb6da89c6af1a8ec);
|
|
247
|
+
class $a3f05bab0f981c14$export$cb6da89c6af1a8ec {
|
|
252
248
|
/**
|
|
253
249
|
* Returns a copy of this size.
|
|
254
250
|
*/ copy() {
|
|
255
|
-
return new $
|
|
251
|
+
return new $a3f05bab0f981c14$export$cb6da89c6af1a8ec(this.width, this.height);
|
|
256
252
|
}
|
|
257
253
|
/**
|
|
258
254
|
* Returns whether this size is equal to another one.
|
|
259
255
|
*/ equals(other) {
|
|
260
256
|
return this.width === other.width && this.height === other.height;
|
|
261
257
|
}
|
|
258
|
+
constructor(width = 0, height = 0){
|
|
259
|
+
this.width = width;
|
|
260
|
+
this.height = height;
|
|
261
|
+
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
|
|
265
|
-
var $
|
|
265
|
+
var $4da0526be40749e8$exports = {};
|
|
266
266
|
|
|
267
|
-
$parcel$export($
|
|
268
|
-
let $
|
|
269
|
-
class $
|
|
270
|
-
constructor(virtualizer){
|
|
271
|
-
this.virtualizer = virtualizer;
|
|
272
|
-
this.key = ++$48e7cd77a68be60c$var$KEY;
|
|
273
|
-
}
|
|
267
|
+
$parcel$export($4da0526be40749e8$exports, "ReusableView", () => $4da0526be40749e8$export$1a5223887c560441);
|
|
268
|
+
let $4da0526be40749e8$var$KEY = 0;
|
|
269
|
+
class $4da0526be40749e8$export$1a5223887c560441 {
|
|
274
270
|
/**
|
|
275
271
|
* Prepares the view for reuse. Called just before the view is removed from the DOM.
|
|
276
272
|
*/ prepareForReuse() {
|
|
@@ -278,36 +274,40 @@ class $48e7cd77a68be60c$export$1a5223887c560441 {
|
|
|
278
274
|
this.rendered = null;
|
|
279
275
|
this.layoutInfo = null;
|
|
280
276
|
}
|
|
277
|
+
constructor(virtualizer){
|
|
278
|
+
this.virtualizer = virtualizer;
|
|
279
|
+
this.key = ++$4da0526be40749e8$var$KEY;
|
|
280
|
+
}
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
|
|
284
|
-
var $
|
|
284
|
+
var $1e6e65cc351b4331$exports = {};
|
|
285
285
|
|
|
286
|
-
$parcel$export($
|
|
286
|
+
$parcel$export($1e6e65cc351b4331$exports, "useVirtualizerState", () => $1e6e65cc351b4331$export$1505db82fe357e65);
|
|
287
287
|
|
|
288
288
|
|
|
289
289
|
|
|
290
290
|
|
|
291
291
|
// use high res timer if available
|
|
292
|
-
let $
|
|
292
|
+
let $c58295f7a299f0aa$var$perf = typeof window !== 'undefined' ? window.performance : null;
|
|
293
293
|
// @ts-ignore
|
|
294
|
-
let $
|
|
295
|
-
let $
|
|
294
|
+
let $c58295f7a299f0aa$var$perfNow = $c58295f7a299f0aa$var$perf && ($c58295f7a299f0aa$var$perf.now || $c58295f7a299f0aa$var$perf.webkitNow || $c58295f7a299f0aa$var$perf.msNow || $c58295f7a299f0aa$var$perf.mozNow);
|
|
295
|
+
let $c58295f7a299f0aa$var$getTime = $c58295f7a299f0aa$var$perfNow ? $c58295f7a299f0aa$var$perfNow.bind($c58295f7a299f0aa$var$perf) : function() {
|
|
296
296
|
return Date.now ? Date.now() : new Date().getTime();
|
|
297
297
|
};
|
|
298
|
-
let $
|
|
299
|
-
function $
|
|
298
|
+
let $c58295f7a299f0aa$var$fixTs;
|
|
299
|
+
function $c58295f7a299f0aa$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 = $c58295f7a299f0aa$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 ($c58295f7a299f0aa$var$fixTs == null) $c58295f7a299f0aa$var$fixTs = t > 1000000000000 !== $c58295f7a299f0aa$var$getTime() > 1000000000000;
|
|
310
|
+
if ($c58295f7a299f0aa$var$fixTs) t = $c58295f7a299f0aa$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 $f4437db0d25b1451$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 $103abcdf9cf478de$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 $f4437db0d25b1451$export$dc0b63720788090c(begin, end, duration, ease, f
|
|
|
326
326
|
};
|
|
327
327
|
return promise;
|
|
328
328
|
}
|
|
329
|
-
function $
|
|
329
|
+
function $c58295f7a299f0aa$export$77860c106b4a6a2e(t) {
|
|
330
330
|
return t;
|
|
331
331
|
}
|
|
332
|
-
function $
|
|
332
|
+
function $c58295f7a299f0aa$export$57636bb43b1ccbb0(t) {
|
|
333
333
|
return Math.sin(t * Math.PI / 2);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
|
|
337
|
-
function $
|
|
337
|
+
function $fbda06621e3f10f4$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 $fbda06621e3f10f4$export$acaf96a27438246b(a, b) {
|
|
343
|
+
let toRemove = $fbda06621e3f10f4$export$37a26b283fd7740e(a, b);
|
|
344
|
+
let toAdd = $fbda06621e3f10f4$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 $dcde0d6fc989b206$export$acaf96a27438246b(a, b) {
|
|
|
350
350
|
toUpdate: toUpdate
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
function* $
|
|
353
|
+
function* $fbda06621e3f10f4$export$cfc14088dfefce5f(...iterators) {
|
|
354
354
|
for (let iterator of iterators)yield* iterator;
|
|
355
355
|
}
|
|
356
|
-
function $
|
|
356
|
+
function $fbda06621e3f10f4$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 $dcde0d6fc989b206$export$6897c284b6f9f4dc(object) {
|
|
|
363
363
|
|
|
364
364
|
|
|
365
365
|
|
|
366
|
-
class $
|
|
366
|
+
class $68be7cd82b7d2f02$var$RollingAverage {
|
|
367
367
|
addSample(sample) {
|
|
368
368
|
this.count++;
|
|
369
369
|
this.value += (sample - this.value) / this.count;
|
|
@@ -373,7 +373,7 @@ class $83436bb5e0f033a0$var$RollingAverage {
|
|
|
373
373
|
this.value = 0;
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
class $
|
|
376
|
+
class $68be7cd82b7d2f02$export$4455ee6afb38dcbb {
|
|
377
377
|
setVisibleRect(rect) {
|
|
378
378
|
let time = performance.now() - this.startTime;
|
|
379
379
|
if (time < 500) {
|
|
@@ -418,12 +418,12 @@ class $83436bb5e0f033a0$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 $68be7cd82b7d2f02$var$RollingAverage();
|
|
422
|
+
this.averageTime = new $68be7cd82b7d2f02$var$RollingAverage();
|
|
423
|
+
this.velocity = new $103abcdf9cf478de$export$baf26146a414f24a(5, 5);
|
|
424
|
+
this.overscanX = new $68be7cd82b7d2f02$var$RollingAverage();
|
|
425
|
+
this.overscanY = new $68be7cd82b7d2f02$var$RollingAverage();
|
|
426
|
+
this.visibleRect = new $2d68b1437715e315$export$c79fc6492f3af13d();
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
|
|
@@ -432,7 +432,7 @@ class $83436bb5e0f033a0$export$4455ee6afb38dcbb {
|
|
|
432
432
|
|
|
433
433
|
|
|
434
434
|
|
|
435
|
-
class $
|
|
435
|
+
class $bcf4f4044a613451$export$febc5573c75cefb0 {
|
|
436
436
|
constructor(){
|
|
437
437
|
this.level = 0;
|
|
438
438
|
this.actions = [];
|
|
@@ -447,44 +447,13 @@ class $4030d5bc382f52a8$export$febc5573c75cefb0 {
|
|
|
447
447
|
}
|
|
448
448
|
|
|
449
449
|
|
|
450
|
-
class $
|
|
451
|
-
constructor(options = {
|
|
452
|
-
}){
|
|
453
|
-
this._contentSize = new $c7e25de3d1bb13b7$export$cb6da89c6af1a8ec;
|
|
454
|
-
this._visibleRect = new $b257fb58d1fe030d$export$c79fc6492f3af13d;
|
|
455
|
-
this._reusableViews = {
|
|
456
|
-
};
|
|
457
|
-
this._visibleLayoutInfos = new Map();
|
|
458
|
-
this._visibleViews = new Map();
|
|
459
|
-
this._renderedContent = new WeakMap();
|
|
460
|
-
this._children = new Set();
|
|
461
|
-
this._invalidationContext = null;
|
|
462
|
-
this._overscanManager = new $83436bb5e0f033a0$export$4455ee6afb38dcbb();
|
|
463
|
-
this._scrollAnimation = null;
|
|
464
|
-
this._isScrolling = false;
|
|
465
|
-
this._sizeUpdateQueue = new Map();
|
|
466
|
-
this._animatedContentOffset = new $63dcdc70cf96c5d7$export$baf26146a414f24a(0, 0);
|
|
467
|
-
this._transaction = null;
|
|
468
|
-
this._nextTransaction = null;
|
|
469
|
-
this._transactionQueue = [];
|
|
470
|
-
// Set options from passed object if given
|
|
471
|
-
this.transitionDuration = options.transitionDuration ?? 500;
|
|
472
|
-
this.anchorScrollPosition = options.anchorScrollPosition || false;
|
|
473
|
-
this.anchorScrollPositionAtTop = options.anchorScrollPositionAtTop || false;
|
|
474
|
-
this.shouldOverscan = options.shouldOverscan !== false;
|
|
475
|
-
for (let key of [
|
|
476
|
-
'delegate',
|
|
477
|
-
'size',
|
|
478
|
-
'layout',
|
|
479
|
-
'collection'
|
|
480
|
-
])if (options[key]) this[key] = options[key];
|
|
481
|
-
}
|
|
450
|
+
class $563b26825bf4ecc8$export$89be5a243e59c4b2 {
|
|
482
451
|
_setContentSize(size) {
|
|
483
452
|
this._contentSize = size;
|
|
484
453
|
this.delegate.setContentSize(size);
|
|
485
454
|
}
|
|
486
455
|
_setContentOffset(offset) {
|
|
487
|
-
let rect = new $
|
|
456
|
+
let rect = new $2d68b1437715e315$export$c79fc6492f3af13d(offset.x, offset.y, this._visibleRect.width, this._visibleRect.height);
|
|
488
457
|
this.delegate.setVisibleRect(rect);
|
|
489
458
|
}
|
|
490
459
|
/**
|
|
@@ -598,7 +567,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
598
567
|
let { reuseType: reuseType } = this._getReuseType(layoutInfo, content);
|
|
599
568
|
if (!this._reusableViews[reuseType]) this._reusableViews[reuseType] = [];
|
|
600
569
|
let reusable = this._reusableViews[reuseType];
|
|
601
|
-
let view = reusable.length > 0 ? reusable.pop() : new $
|
|
570
|
+
let view = reusable.length > 0 ? reusable.pop() : new $4da0526be40749e8$export$1a5223887c560441(this);
|
|
602
571
|
view.viewType = reuseType;
|
|
603
572
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
604
573
|
layoutInfo = layoutInfo.copy();
|
|
@@ -652,7 +621,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
652
621
|
/**
|
|
653
622
|
* Returns the key for the item view currently at the given point.
|
|
654
623
|
*/ keyAtPoint(point) {
|
|
655
|
-
let rect = new $
|
|
624
|
+
let rect = new $2d68b1437715e315$export$c79fc6492f3af13d(point.x, point.y, 1, 1);
|
|
656
625
|
let layoutInfos = this.layout.getVisibleLayoutInfos(rect);
|
|
657
626
|
let layoutInfo = layoutInfos[0];
|
|
658
627
|
if (!layoutInfo) return null;
|
|
@@ -729,7 +698,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
729
698
|
this._animatedContentOffset.x += visibleRect.x - contentOffsetX;
|
|
730
699
|
this._animatedContentOffset.y += visibleRect.y - contentOffsetY;
|
|
731
700
|
hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
732
|
-
} else this._setContentOffset(new $
|
|
701
|
+
} else this._setContentOffset(new $103abcdf9cf478de$export$baf26146a414f24a(contentOffsetX, contentOffsetY));
|
|
733
702
|
} else hasLayoutUpdates = this.updateSubviews(context.contentChanged);
|
|
734
703
|
// Apply layout infos, unless this is coming from an animated transaction
|
|
735
704
|
if (!(context.transaction && context.animated)) this._applyLayoutInfos();
|
|
@@ -743,7 +712,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
743
712
|
// Get the content offset to scroll to, taking _animatedContentOffset into account.
|
|
744
713
|
let { x: x , y: y } = this.getVisibleRect();
|
|
745
714
|
this._resetAnimatedContentOffset();
|
|
746
|
-
this._setContentOffset(new $
|
|
715
|
+
this._setContentOffset(new $103abcdf9cf478de$export$baf26146a414f24a(x, y));
|
|
747
716
|
}
|
|
748
717
|
if (typeof context.afterAnimation === 'function') context.afterAnimation();
|
|
749
718
|
};
|
|
@@ -814,7 +783,8 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
814
783
|
_restoreScrollAnchor(scrollAnchor, context) {
|
|
815
784
|
let contentOffset = this.getVisibleRect();
|
|
816
785
|
if (scrollAnchor) {
|
|
817
|
-
|
|
786
|
+
var ref;
|
|
787
|
+
let finalAnchor = ((ref = context.transaction) === null || ref === void 0 ? void 0 : ref.animated) ? context.transaction.finalMap.get(scrollAnchor.key) : this.layout.getLayoutInfo(scrollAnchor.layoutInfo.key);
|
|
818
788
|
if (finalAnchor) {
|
|
819
789
|
let adjustment = finalAnchor.rect[scrollAnchor.corner].y - contentOffset.y - scrollAnchor.offset;
|
|
820
790
|
contentOffset.y += adjustment;
|
|
@@ -826,7 +796,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
826
796
|
let v = this.visibleRect;
|
|
827
797
|
let x = v.x - this._animatedContentOffset.x;
|
|
828
798
|
let y = v.y - this._animatedContentOffset.y;
|
|
829
|
-
return new $
|
|
799
|
+
return new $2d68b1437715e315$export$c79fc6492f3af13d(x, y, v.width, v.height);
|
|
830
800
|
}
|
|
831
801
|
getVisibleLayoutInfos() {
|
|
832
802
|
let rect = this.shouldOverscan ? this._overscanManager.getOverscannedRect() : this.getVisibleRect();
|
|
@@ -854,7 +824,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
854
824
|
toRemove = currentlyVisible;
|
|
855
825
|
toUpdate = new Set();
|
|
856
826
|
} else {
|
|
857
|
-
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $
|
|
827
|
+
({ toAdd: toAdd , toRemove: toRemove , toUpdate: toUpdate } = $fbda06621e3f10f4$export$acaf96a27438246b(currentlyVisible, visibleLayoutInfos));
|
|
858
828
|
for (let key of toUpdate){
|
|
859
829
|
let view = currentlyVisible.get(key);
|
|
860
830
|
if (!view || !view.layoutInfo) continue;
|
|
@@ -1037,7 +1007,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
1037
1007
|
_resetAnimatedContentOffset() {
|
|
1038
1008
|
// Reset the animated content offset of subviews. See comment in relayoutNow for details.
|
|
1039
1009
|
if (!this._animatedContentOffset.isOrigin()) {
|
|
1040
|
-
this._animatedContentOffset = new $
|
|
1010
|
+
this._animatedContentOffset = new $103abcdf9cf478de$export$baf26146a414f24a(0, 0);
|
|
1041
1011
|
this._applyLayoutInfos();
|
|
1042
1012
|
}
|
|
1043
1013
|
}
|
|
@@ -1065,7 +1035,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
1065
1035
|
if (minY <= y || maxY === 0) y = minY;
|
|
1066
1036
|
else if (layoutInfo.rect.maxY > maxY) y += layoutInfo.rect.maxY - maxY;
|
|
1067
1037
|
}
|
|
1068
|
-
return this.scrollTo(new $
|
|
1038
|
+
return this.scrollTo(new $103abcdf9cf478de$export$baf26146a414f24a(x, y), duration);
|
|
1069
1039
|
}
|
|
1070
1040
|
/**
|
|
1071
1041
|
* Performs an animated scroll to the given offset.
|
|
@@ -1084,7 +1054,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
1084
1054
|
return Promise.resolve();
|
|
1085
1055
|
}
|
|
1086
1056
|
this.startScrolling();
|
|
1087
|
-
this._scrollAnimation = $
|
|
1057
|
+
this._scrollAnimation = $c58295f7a299f0aa$export$dc0b63720788090c(this.visibleRect, offset1, duration, $c58295f7a299f0aa$export$57636bb43b1ccbb0, (offset)=>{
|
|
1088
1058
|
this._setContentOffset(offset);
|
|
1089
1059
|
});
|
|
1090
1060
|
this._scrollAnimation.then(()=>{
|
|
@@ -1105,7 +1075,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
1105
1075
|
this._endTransaction(animated);
|
|
1106
1076
|
}
|
|
1107
1077
|
_startTransaction() {
|
|
1108
|
-
if (!this._nextTransaction) this._nextTransaction = new $
|
|
1078
|
+
if (!this._nextTransaction) this._nextTransaction = new $bcf4f4044a613451$export$febc5573c75cefb0;
|
|
1109
1079
|
this._nextTransaction.level++;
|
|
1110
1080
|
}
|
|
1111
1081
|
_endTransaction(animated) {
|
|
@@ -1136,7 +1106,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
1136
1106
|
if (next) this._performTransaction(next);
|
|
1137
1107
|
}
|
|
1138
1108
|
_getContentRect() {
|
|
1139
|
-
return new $
|
|
1109
|
+
return new $2d68b1437715e315$export$c79fc6492f3af13d(0, 0, this.contentSize.width, this.contentSize.height);
|
|
1140
1110
|
}
|
|
1141
1111
|
_performTransaction(transaction) {
|
|
1142
1112
|
this._transaction = transaction;
|
|
@@ -1159,7 +1129,7 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
1159
1129
|
},
|
|
1160
1130
|
afterAnimation: ()=>{
|
|
1161
1131
|
// Remove and reuse views when animations are done
|
|
1162
|
-
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 $fbda06621e3f10f4$export$cfc14088dfefce5f(transaction.toRemove.values(), transaction.removed.values())){
|
|
1163
1133
|
this._children.delete(view);
|
|
1164
1134
|
this.reuseView(view);
|
|
1165
1135
|
}
|
|
@@ -1195,15 +1165,47 @@ class $f9e1605aeab61ed8$export$89be5a243e59c4b2 {
|
|
|
1195
1165
|
}
|
|
1196
1166
|
}
|
|
1197
1167
|
}
|
|
1168
|
+
constructor(options = {
|
|
1169
|
+
}){
|
|
1170
|
+
this._contentSize = new $a3f05bab0f981c14$export$cb6da89c6af1a8ec;
|
|
1171
|
+
this._visibleRect = new $2d68b1437715e315$export$c79fc6492f3af13d;
|
|
1172
|
+
this._reusableViews = {
|
|
1173
|
+
};
|
|
1174
|
+
this._visibleLayoutInfos = new Map();
|
|
1175
|
+
this._visibleViews = new Map();
|
|
1176
|
+
this._renderedContent = new WeakMap();
|
|
1177
|
+
this._children = new Set();
|
|
1178
|
+
this._invalidationContext = null;
|
|
1179
|
+
this._overscanManager = new $68be7cd82b7d2f02$export$4455ee6afb38dcbb();
|
|
1180
|
+
this._scrollAnimation = null;
|
|
1181
|
+
this._isScrolling = false;
|
|
1182
|
+
this._sizeUpdateQueue = new Map();
|
|
1183
|
+
this._animatedContentOffset = new $103abcdf9cf478de$export$baf26146a414f24a(0, 0);
|
|
1184
|
+
this._transaction = null;
|
|
1185
|
+
this._nextTransaction = null;
|
|
1186
|
+
this._transactionQueue = [];
|
|
1187
|
+
var _transitionDuration;
|
|
1188
|
+
// Set options from passed object if given
|
|
1189
|
+
this.transitionDuration = (_transitionDuration = options.transitionDuration) !== null && _transitionDuration !== void 0 ? _transitionDuration : 500;
|
|
1190
|
+
this.anchorScrollPosition = options.anchorScrollPosition || false;
|
|
1191
|
+
this.anchorScrollPositionAtTop = options.anchorScrollPositionAtTop || false;
|
|
1192
|
+
this.shouldOverscan = options.shouldOverscan !== false;
|
|
1193
|
+
for (let key of [
|
|
1194
|
+
'delegate',
|
|
1195
|
+
'size',
|
|
1196
|
+
'layout',
|
|
1197
|
+
'collection'
|
|
1198
|
+
])if (options[key]) this[key] = options[key];
|
|
1199
|
+
}
|
|
1198
1200
|
}
|
|
1199
1201
|
|
|
1200
1202
|
|
|
1201
|
-
function $
|
|
1202
|
-
let [visibleViews, setVisibleViews] = $
|
|
1203
|
-
let [contentSize, setContentSize] = $
|
|
1204
|
-
let [isAnimating, setAnimating] = $
|
|
1205
|
-
let [isScrolling, setScrolling] = $
|
|
1206
|
-
let virtualizer = $
|
|
1203
|
+
function $1e6e65cc351b4331$export$1505db82fe357e65(opts) {
|
|
1204
|
+
let [visibleViews, setVisibleViews] = $84niS$react.useState([]);
|
|
1205
|
+
let [contentSize, setContentSize] = $84niS$react.useState(new $a3f05bab0f981c14$export$cb6da89c6af1a8ec());
|
|
1206
|
+
let [isAnimating, setAnimating] = $84niS$react.useState(false);
|
|
1207
|
+
let [isScrolling, setScrolling] = $84niS$react.useState(false);
|
|
1208
|
+
let virtualizer = $84niS$react.useMemo(()=>new $563b26825bf4ecc8$export$89be5a243e59c4b2()
|
|
1207
1209
|
, []);
|
|
1208
1210
|
virtualizer.delegate = {
|
|
1209
1211
|
setVisibleViews: setVisibleViews,
|
|
@@ -1223,18 +1225,18 @@ function $1fa690b84970509f$export$1505db82fe357e65(opts) {
|
|
|
1223
1225
|
virtualizer.layout = opts.layout;
|
|
1224
1226
|
virtualizer.collection = opts.collection;
|
|
1225
1227
|
virtualizer.transitionDuration = opts.transitionDuration;
|
|
1226
|
-
$
|
|
1228
|
+
$84niS$reactariautils.useLayoutEffect(()=>{
|
|
1227
1229
|
virtualizer.afterRender();
|
|
1228
1230
|
});
|
|
1229
1231
|
// eslint-disable-next-line arrow-body-style
|
|
1230
|
-
$
|
|
1232
|
+
$84niS$react.useEffect(()=>{
|
|
1231
1233
|
return ()=>virtualizer.willUnmount()
|
|
1232
1234
|
;
|
|
1233
1235
|
}, []);
|
|
1234
1236
|
return {
|
|
1235
1237
|
virtualizer: virtualizer,
|
|
1236
1238
|
visibleViews: visibleViews,
|
|
1237
|
-
setVisibleRect: $
|
|
1239
|
+
setVisibleRect: $84niS$react.useCallback((rect)=>{
|
|
1238
1240
|
virtualizer.visibleRect = rect;
|
|
1239
1241
|
}, [
|
|
1240
1242
|
virtualizer
|
|
@@ -1242,13 +1244,13 @@ function $1fa690b84970509f$export$1505db82fe357e65(opts) {
|
|
|
1242
1244
|
contentSize: contentSize,
|
|
1243
1245
|
isAnimating: isAnimating,
|
|
1244
1246
|
isScrolling: isScrolling,
|
|
1245
|
-
startScrolling: $
|
|
1247
|
+
startScrolling: $84niS$react.useCallback(()=>{
|
|
1246
1248
|
virtualizer.startScrolling();
|
|
1247
1249
|
setScrolling(true);
|
|
1248
1250
|
}, [
|
|
1249
1251
|
virtualizer
|
|
1250
1252
|
]),
|
|
1251
|
-
endScrolling: $
|
|
1253
|
+
endScrolling: $84niS$react.useCallback(()=>{
|
|
1252
1254
|
virtualizer.endScrolling();
|
|
1253
1255
|
setScrolling(false);
|
|
1254
1256
|
}, [
|
|
@@ -1258,13 +1260,13 @@ function $1fa690b84970509f$export$1505db82fe357e65(opts) {
|
|
|
1258
1260
|
}
|
|
1259
1261
|
|
|
1260
1262
|
|
|
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, $
|
|
1263
|
+
$parcel$exportWildcard(module.exports, $0d5c9ff6e1157361$exports);
|
|
1264
|
+
$parcel$exportWildcard(module.exports, $f1d3da1211768ed5$exports);
|
|
1265
|
+
$parcel$exportWildcard(module.exports, $103abcdf9cf478de$exports);
|
|
1266
|
+
$parcel$exportWildcard(module.exports, $2d68b1437715e315$exports);
|
|
1267
|
+
$parcel$exportWildcard(module.exports, $a3f05bab0f981c14$exports);
|
|
1268
|
+
$parcel$exportWildcard(module.exports, $4da0526be40749e8$exports);
|
|
1269
|
+
$parcel$exportWildcard(module.exports, $1e6e65cc351b4331$exports);
|
|
1268
1270
|
|
|
1269
1271
|
|
|
1270
1272
|
//# sourceMappingURL=main.js.map
|