@digipair/skill-web-spectrum 0.91.0-0 → 0.92.0

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/flow.cjs.js ADDED
@@ -0,0 +1,1257 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @license
5
+ * Copyright 2021 Google LLC
6
+ * SPDX-License-Identifier: BSD-3-Clause
7
+ */ function _class_call_check$2(instance, Constructor) {
8
+ if (!(instance instanceof Constructor)) {
9
+ throw new TypeError("Cannot call a class as a function");
10
+ }
11
+ }
12
+ function _defineProperties$2(target, props) {
13
+ for(var i = 0; i < props.length; i++){
14
+ var descriptor = props[i];
15
+ descriptor.enumerable = descriptor.enumerable || false;
16
+ descriptor.configurable = true;
17
+ if ("value" in descriptor) descriptor.writable = true;
18
+ Object.defineProperty(target, descriptor.key, descriptor);
19
+ }
20
+ }
21
+ function _create_class$2(Constructor, protoProps, staticProps) {
22
+ if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
23
+ if (staticProps) _defineProperties$2(Constructor, staticProps);
24
+ return Constructor;
25
+ }
26
+ var SizeCache = /*#__PURE__*/ function() {
27
+ function SizeCache(config) {
28
+ _class_call_check$2(this, SizeCache);
29
+ this._map = new Map();
30
+ this._roundAverageSize = false;
31
+ this.totalSize = 0;
32
+ if ((config === null || config === void 0 ? void 0 : config.roundAverageSize) === true) {
33
+ this._roundAverageSize = true;
34
+ }
35
+ }
36
+ _create_class$2(SizeCache, [
37
+ {
38
+ key: "set",
39
+ value: function set(index, value) {
40
+ var prev = this._map.get(index) || 0;
41
+ this._map.set(index, value);
42
+ this.totalSize += value - prev;
43
+ }
44
+ },
45
+ {
46
+ key: "averageSize",
47
+ get: function get() {
48
+ if (this._map.size > 0) {
49
+ var average = this.totalSize / this._map.size;
50
+ return this._roundAverageSize ? Math.round(average) : average;
51
+ }
52
+ return 0;
53
+ }
54
+ },
55
+ {
56
+ key: "getSize",
57
+ value: function getSize(index) {
58
+ return this._map.get(index);
59
+ }
60
+ },
61
+ {
62
+ key: "clear",
63
+ value: function clear() {
64
+ this._map.clear();
65
+ this.totalSize = 0;
66
+ }
67
+ }
68
+ ]);
69
+ return SizeCache;
70
+ }
71
+ ();
72
+
73
+ /**
74
+ * @license
75
+ * Copyright 2021 Google LLC
76
+ * SPDX-License-Identifier: BSD-3-Clause
77
+ */ function _class_call_check$1(instance, Constructor) {
78
+ if (!(instance instanceof Constructor)) {
79
+ throw new TypeError("Cannot call a class as a function");
80
+ }
81
+ }
82
+ function _defineProperties$1(target, props) {
83
+ for(var i = 0; i < props.length; i++){
84
+ var descriptor = props[i];
85
+ descriptor.enumerable = descriptor.enumerable || false;
86
+ descriptor.configurable = true;
87
+ if ("value" in descriptor) descriptor.writable = true;
88
+ Object.defineProperty(target, descriptor.key, descriptor);
89
+ }
90
+ }
91
+ function _create_class$1(Constructor, protoProps, staticProps) {
92
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
93
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
94
+ return Constructor;
95
+ }
96
+ function _define_property$1(obj, key, value) {
97
+ if (key in obj) {
98
+ Object.defineProperty(obj, key, {
99
+ value: value,
100
+ enumerable: true,
101
+ configurable: true,
102
+ writable: true
103
+ });
104
+ } else {
105
+ obj[key] = value;
106
+ }
107
+ return obj;
108
+ }
109
+ function dim1(direction) {
110
+ return direction === "horizontal" ? "width" : "height";
111
+ }
112
+ var BaseLayout = /*#__PURE__*/ function() {
113
+ function BaseLayout(hostSink, config) {
114
+ var _this = this;
115
+ _class_call_check$1(this, BaseLayout);
116
+ /**
117
+ * The last set viewport scroll position.
118
+ */ this._latestCoords = {
119
+ left: 0,
120
+ top: 0
121
+ };
122
+ /**
123
+ * Scrolling direction.
124
+ */ this._direction = null;
125
+ /**
126
+ * Dimensions of the viewport.
127
+ */ this._viewportSize = {
128
+ width: 0,
129
+ height: 0
130
+ };
131
+ this.totalScrollSize = {
132
+ width: 0,
133
+ height: 0
134
+ };
135
+ this.offsetWithinScroller = {
136
+ left: 0,
137
+ top: 0
138
+ };
139
+ /**
140
+ * Flag for debouncing asynchronous reflow requests.
141
+ */ this._pendingReflow = false;
142
+ this._pendingLayoutUpdate = false;
143
+ this._pin = null;
144
+ /**
145
+ * The index of the first item intersecting the viewport.
146
+ */ this._firstVisible = 0;
147
+ /**
148
+ * The index of the last item intersecting the viewport.
149
+ */ this._lastVisible = 0;
150
+ /**
151
+ * Pixel offset in the scroll direction of the first child.
152
+ */ this._physicalMin = 0;
153
+ /**
154
+ * Pixel offset in the scroll direction of the last child.
155
+ */ this._physicalMax = 0;
156
+ /**
157
+ * Index of the first child.
158
+ */ this._first = -1;
159
+ /**
160
+ * Index of the last child.
161
+ */ this._last = -1;
162
+ /**
163
+ * Length in the scrolling direction.
164
+ */ this._sizeDim = "height";
165
+ /**
166
+ * Length in the non-scrolling direction.
167
+ */ this._secondarySizeDim = "width";
168
+ /**
169
+ * Position in the scrolling direction.
170
+ */ this._positionDim = "top";
171
+ /**
172
+ * Position in the non-scrolling direction.
173
+ */ this._secondaryPositionDim = "left";
174
+ /**
175
+ * Current scroll offset in pixels.
176
+ */ this._scrollPosition = 0;
177
+ /**
178
+ * Difference between current scroll offset and scroll offset calculated due
179
+ * to a reflow.
180
+ */ this._scrollError = 0;
181
+ /**
182
+ * Total number of items that could possibly be displayed. Used to help
183
+ * calculate the scroll size.
184
+ */ this._items = [];
185
+ /**
186
+ * The total (estimated) length of all items in the scrolling direction.
187
+ */ this._scrollSize = 1;
188
+ /**
189
+ * Number of pixels beyond the viewport to still include
190
+ * in the active range of items.
191
+ */ // TODO (graynorton): Probably want to make this something we calculate based
192
+ // on viewport size, item size, other factors, possibly still with a dial of some kind
193
+ this._overhang = 1000;
194
+ this._hostSink = hostSink;
195
+ // Delay setting config so that subclasses do setup work first
196
+ Promise.resolve().then(function() {
197
+ return _this.config = config || _this._getDefaultConfig();
198
+ });
199
+ }
200
+ _create_class$1(BaseLayout, [
201
+ {
202
+ key: "_getDefaultConfig",
203
+ value: function _getDefaultConfig() {
204
+ return {
205
+ direction: "vertical"
206
+ };
207
+ }
208
+ },
209
+ {
210
+ key: "config",
211
+ get: function get() {
212
+ return {
213
+ direction: this.direction
214
+ };
215
+ },
216
+ set: function set(config) {
217
+ Object.assign(this, Object.assign({}, this._getDefaultConfig(), config));
218
+ }
219
+ },
220
+ {
221
+ key: "items",
222
+ get: /**
223
+ * Maximum index of children + 1, to help estimate total height of the scroll
224
+ * space.
225
+ */ function get() {
226
+ return this._items;
227
+ },
228
+ set: function set(items) {
229
+ this._setItems(items);
230
+ }
231
+ },
232
+ {
233
+ key: "_setItems",
234
+ value: function _setItems(items) {
235
+ if (items !== this._items) {
236
+ this._items = items;
237
+ this._scheduleReflow();
238
+ }
239
+ }
240
+ },
241
+ {
242
+ key: "direction",
243
+ get: /**
244
+ * Primary scrolling direction.
245
+ */ function get() {
246
+ return this._direction;
247
+ },
248
+ set: function set(dir) {
249
+ // Force it to be either horizontal or vertical.
250
+ dir = dir === "horizontal" ? dir : "vertical";
251
+ if (dir !== this._direction) {
252
+ this._direction = dir;
253
+ this._sizeDim = dir === "horizontal" ? "width" : "height";
254
+ this._secondarySizeDim = dir === "horizontal" ? "height" : "width";
255
+ this._positionDim = dir === "horizontal" ? "left" : "top";
256
+ this._secondaryPositionDim = dir === "horizontal" ? "top" : "left";
257
+ this._triggerReflow();
258
+ }
259
+ }
260
+ },
261
+ {
262
+ key: "viewportSize",
263
+ get: /**
264
+ * Height and width of the viewport.
265
+ */ function get() {
266
+ return this._viewportSize;
267
+ },
268
+ set: function set(dims) {
269
+ var _this = this, _viewDim1 = _this._viewDim1, _viewDim2 = _this._viewDim2;
270
+ Object.assign(this._viewportSize, dims);
271
+ if (_viewDim2 !== this._viewDim2) {
272
+ // this._viewDim2Changed();
273
+ this._scheduleLayoutUpdate();
274
+ } else if (_viewDim1 !== this._viewDim1) {
275
+ this._checkThresholds();
276
+ }
277
+ }
278
+ },
279
+ {
280
+ key: "viewportScroll",
281
+ get: /**
282
+ * Scroll offset of the viewport.
283
+ */ function get() {
284
+ return this._latestCoords;
285
+ },
286
+ set: function set(coords) {
287
+ Object.assign(this._latestCoords, coords);
288
+ var oldPos = this._scrollPosition;
289
+ this._scrollPosition = this._latestCoords[this._positionDim];
290
+ var change = Math.abs(oldPos - this._scrollPosition);
291
+ if (change >= 1) {
292
+ this._checkThresholds();
293
+ }
294
+ }
295
+ },
296
+ {
297
+ /**
298
+ * Perform a reflow if one has been scheduled.
299
+ */ key: "reflowIfNeeded",
300
+ value: function reflowIfNeeded() {
301
+ var force = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
302
+ if (force || this._pendingReflow) {
303
+ this._pendingReflow = false;
304
+ this._reflow();
305
+ }
306
+ }
307
+ },
308
+ {
309
+ key: "pin",
310
+ get: function get() {
311
+ if (this._pin !== null) {
312
+ var _this__pin = this._pin, index = _this__pin.index, block = _this__pin.block;
313
+ return {
314
+ index: Math.max(0, Math.min(index, this.items.length - 1)),
315
+ block: block
316
+ };
317
+ }
318
+ return null;
319
+ },
320
+ set: function set(options) {
321
+ this._pin = options;
322
+ this._triggerReflow();
323
+ }
324
+ },
325
+ {
326
+ key: "_clampScrollPosition",
327
+ value: function _clampScrollPosition(val) {
328
+ return Math.max(-this.offsetWithinScroller[this._positionDim], Math.min(val, this.totalScrollSize[dim1(this.direction)] - this._viewDim1));
329
+ }
330
+ },
331
+ {
332
+ key: "unpin",
333
+ value: function unpin() {
334
+ if (this._pin !== null) {
335
+ this._sendUnpinnedMessage();
336
+ this._pin = null;
337
+ }
338
+ }
339
+ },
340
+ {
341
+ key: "_updateLayout",
342
+ value: function _updateLayout() {
343
+ // Override
344
+ }
345
+ },
346
+ {
347
+ key: "_viewDim1",
348
+ get: // protected _viewDim2Changed(): void {
349
+ // this._scheduleLayoutUpdate();
350
+ // }
351
+ /**
352
+ * The height or width of the viewport, whichever corresponds to the scrolling direction.
353
+ */ function get() {
354
+ return this._viewportSize[this._sizeDim];
355
+ }
356
+ },
357
+ {
358
+ key: "_viewDim2",
359
+ get: /**
360
+ * The height or width of the viewport, whichever does NOT correspond to the scrolling direction.
361
+ */ function get() {
362
+ return this._viewportSize[this._secondarySizeDim];
363
+ }
364
+ },
365
+ {
366
+ key: "_scheduleReflow",
367
+ value: function _scheduleReflow() {
368
+ this._pendingReflow = true;
369
+ }
370
+ },
371
+ {
372
+ key: "_scheduleLayoutUpdate",
373
+ value: function _scheduleLayoutUpdate() {
374
+ this._pendingLayoutUpdate = true;
375
+ this._scheduleReflow();
376
+ }
377
+ },
378
+ {
379
+ // For triggering a reflow based on incoming changes to
380
+ // the layout config.
381
+ key: "_triggerReflow",
382
+ value: function _triggerReflow() {
383
+ var _this = this;
384
+ this._scheduleLayoutUpdate();
385
+ // TODO graynorton@: reflowIfNeeded() isn't really supposed
386
+ // to be called internally. Address in larger cleanup
387
+ // of virtualizer / layout interaction pattern.
388
+ // this.reflowIfNeeded(true);
389
+ Promise.resolve().then(function() {
390
+ return _this.reflowIfNeeded();
391
+ });
392
+ }
393
+ },
394
+ {
395
+ key: "_reflow",
396
+ value: function _reflow() {
397
+ if (this._pendingLayoutUpdate) {
398
+ this._updateLayout();
399
+ this._pendingLayoutUpdate = false;
400
+ }
401
+ this._updateScrollSize();
402
+ this._setPositionFromPin();
403
+ this._getActiveItems();
404
+ this._updateVisibleIndices();
405
+ this._sendStateChangedMessage();
406
+ }
407
+ },
408
+ {
409
+ /**
410
+ * If we are supposed to be pinned to a particular
411
+ * item or set of coordinates, we set `_scrollPosition`
412
+ * accordingly and adjust `_scrollError` as needed
413
+ * so that the virtualizer can keep the scroll
414
+ * position in the DOM in sync
415
+ */ key: "_setPositionFromPin",
416
+ value: function _setPositionFromPin() {
417
+ if (this.pin !== null) {
418
+ var lastScrollPosition = this._scrollPosition;
419
+ var _this_pin = this.pin, index = _this_pin.index, block = _this_pin.block;
420
+ this._scrollPosition = this._calculateScrollIntoViewPosition({
421
+ index: index,
422
+ block: block || "start"
423
+ }) - this.offsetWithinScroller[this._positionDim];
424
+ this._scrollError = lastScrollPosition - this._scrollPosition;
425
+ }
426
+ }
427
+ },
428
+ {
429
+ /**
430
+ * Calculate the coordinates to scroll to, given
431
+ * a request to scroll to the element at a specific
432
+ * index.
433
+ *
434
+ * Supports the same positioning options (`start`,
435
+ * `center`, `end`, `nearest`) as the standard
436
+ * `Element.scrollIntoView()` method, but currently
437
+ * only considers the provided value in the `block`
438
+ * dimension, since we don't yet have any layouts
439
+ * that support virtualization in two dimensions.
440
+ */ key: "_calculateScrollIntoViewPosition",
441
+ value: function _calculateScrollIntoViewPosition(options) {
442
+ var block = options.block;
443
+ var index = Math.min(this.items.length, Math.max(0, options.index));
444
+ var itemStartPosition = this._getItemPosition(index)[this._positionDim];
445
+ var scrollPosition = itemStartPosition;
446
+ if (block !== "start") {
447
+ var itemSize = this._getItemSize(index)[this._sizeDim];
448
+ if (block === "center") {
449
+ scrollPosition = itemStartPosition - 0.5 * this._viewDim1 + 0.5 * itemSize;
450
+ } else {
451
+ var itemEndPosition = itemStartPosition - this._viewDim1 + itemSize;
452
+ if (block === "end") {
453
+ scrollPosition = itemEndPosition;
454
+ } else {
455
+ // block === 'nearest'
456
+ var currentScrollPosition = this._scrollPosition;
457
+ scrollPosition = Math.abs(currentScrollPosition - itemStartPosition) < Math.abs(currentScrollPosition - itemEndPosition) ? itemStartPosition : itemEndPosition;
458
+ }
459
+ }
460
+ }
461
+ scrollPosition += this.offsetWithinScroller[this._positionDim];
462
+ return this._clampScrollPosition(scrollPosition);
463
+ }
464
+ },
465
+ {
466
+ key: "getScrollIntoViewCoordinates",
467
+ value: function getScrollIntoViewCoordinates(options) {
468
+ return _define_property$1({}, this._positionDim, this._calculateScrollIntoViewPosition(options));
469
+ }
470
+ },
471
+ {
472
+ key: "_sendUnpinnedMessage",
473
+ value: function _sendUnpinnedMessage() {
474
+ this._hostSink({
475
+ type: "unpinned"
476
+ });
477
+ }
478
+ },
479
+ {
480
+ key: "_sendVisibilityChangedMessage",
481
+ value: function _sendVisibilityChangedMessage() {
482
+ this._hostSink({
483
+ type: "visibilityChanged",
484
+ firstVisible: this._firstVisible,
485
+ lastVisible: this._lastVisible
486
+ });
487
+ }
488
+ },
489
+ {
490
+ key: "_sendStateChangedMessage",
491
+ value: function _sendStateChangedMessage() {
492
+ var childPositions = new Map();
493
+ if (this._first !== -1 && this._last !== -1) {
494
+ for(var idx = this._first; idx <= this._last; idx++){
495
+ childPositions.set(idx, this._getItemPosition(idx));
496
+ }
497
+ }
498
+ var _obj;
499
+ var message = {
500
+ type: "stateChanged",
501
+ scrollSize: (_obj = {}, _define_property$1(_obj, this._sizeDim, this._scrollSize), _define_property$1(_obj, this._secondarySizeDim, null), _obj),
502
+ range: {
503
+ first: this._first,
504
+ last: this._last,
505
+ firstVisible: this._firstVisible,
506
+ lastVisible: this._lastVisible
507
+ },
508
+ childPositions: childPositions
509
+ };
510
+ if (this._scrollError) {
511
+ var _obj1;
512
+ message.scrollError = (_obj1 = {}, _define_property$1(_obj1, this._positionDim, this._scrollError), _define_property$1(_obj1, this._secondaryPositionDim, 0), _obj1);
513
+ this._scrollError = 0;
514
+ }
515
+ this._hostSink(message);
516
+ }
517
+ },
518
+ {
519
+ key: "_num",
520
+ get: /**
521
+ * Number of items to display.
522
+ */ function get() {
523
+ if (this._first === -1 || this._last === -1) {
524
+ return 0;
525
+ }
526
+ return this._last - this._first + 1;
527
+ }
528
+ },
529
+ {
530
+ key: "_checkThresholds",
531
+ value: function _checkThresholds() {
532
+ if (this._viewDim1 === 0 && this._num > 0 || this._pin !== null) {
533
+ this._scheduleReflow();
534
+ } else {
535
+ var min = Math.max(0, this._scrollPosition - this._overhang);
536
+ var max = Math.min(this._scrollSize, this._scrollPosition + this._viewDim1 + this._overhang);
537
+ if (this._physicalMin > min || this._physicalMax < max) {
538
+ this._scheduleReflow();
539
+ } else {
540
+ this._updateVisibleIndices({
541
+ emit: true
542
+ });
543
+ }
544
+ }
545
+ }
546
+ },
547
+ {
548
+ /**
549
+ * Find the indices of the first and last items to intersect the viewport.
550
+ * Emit a visibleindiceschange event when either index changes.
551
+ */ key: "_updateVisibleIndices",
552
+ value: function _updateVisibleIndices(options) {
553
+ if (this._first === -1 || this._last === -1) return;
554
+ var firstVisible = this._first;
555
+ while(firstVisible < this._last && Math.round(this._getItemPosition(firstVisible)[this._positionDim] + this._getItemSize(firstVisible)[this._sizeDim]) <= Math.round(this._scrollPosition)){
556
+ firstVisible++;
557
+ }
558
+ var lastVisible = this._last;
559
+ while(lastVisible > this._first && Math.round(this._getItemPosition(lastVisible)[this._positionDim]) >= Math.round(this._scrollPosition + this._viewDim1)){
560
+ lastVisible--;
561
+ }
562
+ if (firstVisible !== this._firstVisible || lastVisible !== this._lastVisible) {
563
+ this._firstVisible = firstVisible;
564
+ this._lastVisible = lastVisible;
565
+ if (options && options.emit) {
566
+ this._sendVisibilityChangedMessage();
567
+ }
568
+ }
569
+ }
570
+ }
571
+ ]);
572
+ return BaseLayout;
573
+ }
574
+ ();
575
+
576
+ /**
577
+ * @license
578
+ * Copyright 2021 Google LLC
579
+ * SPDX-License-Identifier: BSD-3-Clause
580
+ */ function _array_like_to_array(arr, len) {
581
+ if (len == null || len > arr.length) len = arr.length;
582
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
583
+ return arr2;
584
+ }
585
+ function _array_without_holes(arr) {
586
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
587
+ }
588
+ function _assert_this_initialized(self) {
589
+ if (self === void 0) {
590
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
591
+ }
592
+ return self;
593
+ }
594
+ function _class_call_check(instance, Constructor) {
595
+ if (!(instance instanceof Constructor)) {
596
+ throw new TypeError("Cannot call a class as a function");
597
+ }
598
+ }
599
+ function _defineProperties(target, props) {
600
+ for(var i = 0; i < props.length; i++){
601
+ var descriptor = props[i];
602
+ descriptor.enumerable = descriptor.enumerable || false;
603
+ descriptor.configurable = true;
604
+ if ("value" in descriptor) descriptor.writable = true;
605
+ Object.defineProperty(target, descriptor.key, descriptor);
606
+ }
607
+ }
608
+ function _create_class(Constructor, protoProps, staticProps) {
609
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
610
+ if (staticProps) _defineProperties(Constructor, staticProps);
611
+ return Constructor;
612
+ }
613
+ function _define_property(obj, key, value) {
614
+ if (key in obj) {
615
+ Object.defineProperty(obj, key, {
616
+ value: value,
617
+ enumerable: true,
618
+ configurable: true,
619
+ writable: true
620
+ });
621
+ } else {
622
+ obj[key] = value;
623
+ }
624
+ return obj;
625
+ }
626
+ function _get(target, property, receiver) {
627
+ if (typeof Reflect !== "undefined" && Reflect.get) {
628
+ _get = Reflect.get;
629
+ } else {
630
+ _get = function get(target, property, receiver) {
631
+ var base = _super_prop_base(target, property);
632
+ if (!base) return;
633
+ var desc = Object.getOwnPropertyDescriptor(base, property);
634
+ if (desc.get) {
635
+ return desc.get.call(receiver || target);
636
+ }
637
+ return desc.value;
638
+ };
639
+ }
640
+ return _get(target, property, receiver || target);
641
+ }
642
+ function _get_prototype_of(o) {
643
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
644
+ return o.__proto__ || Object.getPrototypeOf(o);
645
+ };
646
+ return _get_prototype_of(o);
647
+ }
648
+ function _inherits(subClass, superClass) {
649
+ if (typeof superClass !== "function" && superClass !== null) {
650
+ throw new TypeError("Super expression must either be null or a function");
651
+ }
652
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
653
+ constructor: {
654
+ value: subClass,
655
+ writable: true,
656
+ configurable: true
657
+ }
658
+ });
659
+ if (superClass) _set_prototype_of(subClass, superClass);
660
+ }
661
+ function _iterable_to_array(iter) {
662
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
663
+ }
664
+ function _non_iterable_spread() {
665
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
666
+ }
667
+ function _possible_constructor_return(self, call) {
668
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
669
+ return call;
670
+ }
671
+ return _assert_this_initialized(self);
672
+ }
673
+ function _set_prototype_of(o, p) {
674
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
675
+ o.__proto__ = p;
676
+ return o;
677
+ };
678
+ return _set_prototype_of(o, p);
679
+ }
680
+ function _super_prop_base(object, property) {
681
+ while(!Object.prototype.hasOwnProperty.call(object, property)){
682
+ object = _get_prototype_of(object);
683
+ if (object === null) break;
684
+ }
685
+ return object;
686
+ }
687
+ function _to_consumable_array(arr) {
688
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
689
+ }
690
+ function _type_of(obj) {
691
+ "@swc/helpers - typeof";
692
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
693
+ }
694
+ function _unsupported_iterable_to_array(o, minLen) {
695
+ if (!o) return;
696
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
697
+ var n = Object.prototype.toString.call(o).slice(8, -1);
698
+ if (n === "Object" && o.constructor) n = o.constructor.name;
699
+ if (n === "Map" || n === "Set") return Array.from(n);
700
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
701
+ }
702
+ function _is_native_reflect_construct() {
703
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
704
+ if (Reflect.construct.sham) return false;
705
+ if (typeof Proxy === "function") return true;
706
+ try {
707
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
708
+ return true;
709
+ } catch (e) {
710
+ return false;
711
+ }
712
+ }
713
+ function _create_super(Derived) {
714
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
715
+ return function _createSuperInternal() {
716
+ var Super = _get_prototype_of(Derived), result;
717
+ if (hasNativeReflectConstruct) {
718
+ var NewTarget = _get_prototype_of(this).constructor;
719
+ result = Reflect.construct(Super, arguments, NewTarget);
720
+ } else {
721
+ result = Super.apply(this, arguments);
722
+ }
723
+ return _possible_constructor_return(this, result);
724
+ };
725
+ }
726
+ var flow = function(config) {
727
+ return Object.assign({
728
+ type: FlowLayout
729
+ }, config);
730
+ };
731
+ function leadingMargin(direction) {
732
+ return direction === "horizontal" ? "marginLeft" : "marginTop";
733
+ }
734
+ function trailingMargin(direction) {
735
+ return direction === "horizontal" ? "marginRight" : "marginBottom";
736
+ }
737
+ function offset(direction) {
738
+ return direction === "horizontal" ? "xOffset" : "yOffset";
739
+ }
740
+ function collapseMargins(a, b) {
741
+ var _Math, _Math1;
742
+ var m = [
743
+ a,
744
+ b
745
+ ].sort();
746
+ return m[1] <= 0 ? (_Math = Math).min.apply(_Math, _to_consumable_array(m)) : m[0] >= 0 ? (_Math1 = Math).max.apply(_Math1, _to_consumable_array(m)) : m[0] + m[1];
747
+ }
748
+ var MetricsCache = /*#__PURE__*/ function() {
749
+ function MetricsCache() {
750
+ _class_call_check(this, MetricsCache);
751
+ this._childSizeCache = new SizeCache();
752
+ this._marginSizeCache = new SizeCache();
753
+ this._metricsCache = new Map();
754
+ }
755
+ _create_class(MetricsCache, [
756
+ {
757
+ key: "update",
758
+ value: function update(metrics, direction) {
759
+ var _this = this;
760
+ var marginsToUpdate = new Set();
761
+ Object.keys(metrics).forEach(function(key) {
762
+ var k = Number(key);
763
+ _this._metricsCache.set(k, metrics[k]);
764
+ _this._childSizeCache.set(k, metrics[k][dim1(direction)]);
765
+ marginsToUpdate.add(k);
766
+ marginsToUpdate.add(k + 1);
767
+ });
768
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
769
+ try {
770
+ for(var _iterator = marginsToUpdate[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
771
+ var k = _step.value;
772
+ var _this__metricsCache_get, _this__metricsCache_get1;
773
+ var a = ((_this__metricsCache_get = this._metricsCache.get(k)) === null || _this__metricsCache_get === void 0 ? void 0 : _this__metricsCache_get[leadingMargin(direction)]) || 0;
774
+ var b = ((_this__metricsCache_get1 = this._metricsCache.get(k - 1)) === null || _this__metricsCache_get1 === void 0 ? void 0 : _this__metricsCache_get1[trailingMargin(direction)]) || 0;
775
+ this._marginSizeCache.set(k, collapseMargins(a, b));
776
+ }
777
+ } catch (err) {
778
+ _didIteratorError = true;
779
+ _iteratorError = err;
780
+ } finally{
781
+ try {
782
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
783
+ _iterator.return();
784
+ }
785
+ } finally{
786
+ if (_didIteratorError) {
787
+ throw _iteratorError;
788
+ }
789
+ }
790
+ }
791
+ }
792
+ },
793
+ {
794
+ key: "averageChildSize",
795
+ get: function get() {
796
+ return this._childSizeCache.averageSize;
797
+ }
798
+ },
799
+ {
800
+ key: "totalChildSize",
801
+ get: function get() {
802
+ return this._childSizeCache.totalSize;
803
+ }
804
+ },
805
+ {
806
+ key: "averageMarginSize",
807
+ get: function get() {
808
+ return this._marginSizeCache.averageSize;
809
+ }
810
+ },
811
+ {
812
+ key: "totalMarginSize",
813
+ get: function get() {
814
+ return this._marginSizeCache.totalSize;
815
+ }
816
+ },
817
+ {
818
+ key: "getLeadingMarginValue",
819
+ value: function getLeadingMarginValue(index, direction) {
820
+ var _this__metricsCache_get;
821
+ return ((_this__metricsCache_get = this._metricsCache.get(index)) === null || _this__metricsCache_get === void 0 ? void 0 : _this__metricsCache_get[leadingMargin(direction)]) || 0;
822
+ }
823
+ },
824
+ {
825
+ key: "getChildSize",
826
+ value: function getChildSize(index) {
827
+ return this._childSizeCache.getSize(index);
828
+ }
829
+ },
830
+ {
831
+ key: "getMarginSize",
832
+ value: function getMarginSize(index) {
833
+ return this._marginSizeCache.getSize(index);
834
+ }
835
+ },
836
+ {
837
+ key: "clear",
838
+ value: function clear() {
839
+ this._childSizeCache.clear();
840
+ this._marginSizeCache.clear();
841
+ this._metricsCache.clear();
842
+ }
843
+ }
844
+ ]);
845
+ return MetricsCache;
846
+ }();
847
+ var FlowLayout = /*#__PURE__*/ function(BaseLayout) {
848
+ _inherits(FlowLayout, BaseLayout);
849
+ var _super = _create_super(FlowLayout);
850
+ function FlowLayout() {
851
+ _class_call_check(this, FlowLayout);
852
+ var _this;
853
+ _this = _super.call.apply(_super, [
854
+ this
855
+ ].concat(Array.prototype.slice.call(arguments)));
856
+ /**
857
+ * Initial estimate of item size
858
+ */ _this._itemSize = {
859
+ width: 100,
860
+ height: 100
861
+ };
862
+ /**
863
+ * Indices of children mapped to their (position and length) in the scrolling
864
+ * direction. Used to keep track of children that are in range.
865
+ */ _this._physicalItems = new Map();
866
+ /**
867
+ * Used in tandem with _physicalItems to track children in range across
868
+ * reflows.
869
+ */ _this._newPhysicalItems = new Map();
870
+ /**
871
+ * Width and height of children by their index.
872
+ */ _this._metricsCache = new MetricsCache();
873
+ /**
874
+ * anchorIdx is the anchor around which we reflow. It is designed to allow
875
+ * jumping to any point of the scroll size. We choose it once and stick with
876
+ * it until stable. _first and _last are deduced around it.
877
+ */ _this._anchorIdx = null;
878
+ /**
879
+ * Position in the scrolling direction of the anchor child.
880
+ */ _this._anchorPos = null;
881
+ /**
882
+ * Whether all children in range were in range during the previous reflow.
883
+ */ _this._stable = true;
884
+ _this._measureChildren = true;
885
+ _this._estimate = true;
886
+ return _this;
887
+ }
888
+ _create_class(FlowLayout, [
889
+ {
890
+ key: "measureChildren",
891
+ get: // protected _defaultConfig: BaseLayoutConfig = Object.assign({}, super._defaultConfig, {
892
+ // })
893
+ // constructor(config: Layout1dConfig) {
894
+ // super(config);
895
+ // }
896
+ function get() {
897
+ return this._measureChildren;
898
+ }
899
+ },
900
+ {
901
+ /**
902
+ * Determine the average size of all children represented in the sizes
903
+ * argument.
904
+ */ key: "updateItemSizes",
905
+ value: function updateItemSizes(sizes) {
906
+ this._metricsCache.update(sizes, this.direction);
907
+ // if (this._nMeasured) {
908
+ // this._updateItemSize();
909
+ this._scheduleReflow();
910
+ // }
911
+ }
912
+ },
913
+ {
914
+ /**
915
+ * Set the average item size based on the total length and number of children
916
+ * in range.
917
+ */ // _updateItemSize() {
918
+ // // Keep integer values.
919
+ // this._itemSize[this._sizeDim] = this._metricsCache.averageChildSize;
920
+ // }
921
+ key: "_getPhysicalItem",
922
+ value: function _getPhysicalItem(idx) {
923
+ var _this__newPhysicalItems_get;
924
+ return (_this__newPhysicalItems_get = this._newPhysicalItems.get(idx)) !== null && _this__newPhysicalItems_get !== void 0 ? _this__newPhysicalItems_get : this._physicalItems.get(idx);
925
+ }
926
+ },
927
+ {
928
+ key: "_getSize",
929
+ value: function _getSize(idx) {
930
+ var item = this._getPhysicalItem(idx);
931
+ return item && this._metricsCache.getChildSize(idx);
932
+ }
933
+ },
934
+ {
935
+ key: "_getAverageSize",
936
+ value: function _getAverageSize() {
937
+ return this._metricsCache.averageChildSize || this._itemSize[this._sizeDim];
938
+ }
939
+ },
940
+ {
941
+ key: "_estimatePosition",
942
+ value: function _estimatePosition(idx) {
943
+ var c = this._metricsCache;
944
+ if (this._first === -1 || this._last === -1) {
945
+ return c.averageMarginSize + idx * (c.averageMarginSize + this._getAverageSize());
946
+ } else {
947
+ if (idx < this._first) {
948
+ var delta = this._first - idx;
949
+ var refItem = this._getPhysicalItem(this._first);
950
+ return refItem.pos - (c.getMarginSize(this._first - 1) || c.averageMarginSize) - (delta * c.averageChildSize + (delta - 1) * c.averageMarginSize);
951
+ } else {
952
+ var delta1 = idx - this._last;
953
+ var refItem1 = this._getPhysicalItem(this._last);
954
+ return refItem1.pos + (c.getChildSize(this._last) || c.averageChildSize) + (c.getMarginSize(this._last) || c.averageMarginSize) + delta1 * (c.averageChildSize + c.averageMarginSize);
955
+ }
956
+ }
957
+ }
958
+ },
959
+ {
960
+ /**
961
+ * Returns the position in the scrolling direction of the item at idx.
962
+ * Estimates it if the item at idx is not in the DOM.
963
+ */ key: "_getPosition",
964
+ value: function _getPosition(idx) {
965
+ var item = this._getPhysicalItem(idx);
966
+ var averageMarginSize = this._metricsCache.averageMarginSize;
967
+ var _this__metricsCache_getMarginSize;
968
+ return idx === 0 ? (_this__metricsCache_getMarginSize = this._metricsCache.getMarginSize(0)) !== null && _this__metricsCache_getMarginSize !== void 0 ? _this__metricsCache_getMarginSize : averageMarginSize : item ? item.pos : this._estimatePosition(idx);
969
+ }
970
+ },
971
+ {
972
+ key: "_calculateAnchor",
973
+ value: function _calculateAnchor(lower, upper) {
974
+ if (lower <= 0) {
975
+ return 0;
976
+ }
977
+ if (upper > this._scrollSize - this._viewDim1) {
978
+ return this.items.length - 1;
979
+ }
980
+ return Math.max(0, Math.min(this.items.length - 1, Math.floor((lower + upper) / 2 / this._delta)));
981
+ }
982
+ },
983
+ {
984
+ key: "_getAnchor",
985
+ value: function _getAnchor(lower, upper) {
986
+ if (this._physicalItems.size === 0) {
987
+ return this._calculateAnchor(lower, upper);
988
+ }
989
+ if (this._first < 0) {
990
+ return this._calculateAnchor(lower, upper);
991
+ }
992
+ if (this._last < 0) {
993
+ return this._calculateAnchor(lower, upper);
994
+ }
995
+ var firstItem = this._getPhysicalItem(this._first), lastItem = this._getPhysicalItem(this._last), firstMin = firstItem.pos, lastMin = lastItem.pos, lastMax = lastMin + this._metricsCache.getChildSize(this._last);
996
+ if (lastMax < lower) {
997
+ // Window is entirely past physical items, calculate new anchor
998
+ return this._calculateAnchor(lower, upper);
999
+ }
1000
+ if (firstMin > upper) {
1001
+ // Window is entirely before physical items, calculate new anchor
1002
+ return this._calculateAnchor(lower, upper);
1003
+ }
1004
+ // Window contains a physical item
1005
+ // Find one, starting with the one that was previously first visible
1006
+ var candidateIdx = this._firstVisible - 1;
1007
+ var cMax = -Infinity;
1008
+ while(cMax < lower){
1009
+ var candidate = this._getPhysicalItem(++candidateIdx);
1010
+ cMax = candidate.pos + this._metricsCache.getChildSize(candidateIdx);
1011
+ }
1012
+ return candidateIdx;
1013
+ }
1014
+ },
1015
+ {
1016
+ /**
1017
+ * Updates _first and _last based on items that should be in the current
1018
+ * viewed range.
1019
+ */ key: "_getActiveItems",
1020
+ value: function _getActiveItems() {
1021
+ if (this._viewDim1 === 0 || this.items.length === 0) {
1022
+ this._clearItems();
1023
+ } else {
1024
+ this._getItems();
1025
+ }
1026
+ }
1027
+ },
1028
+ {
1029
+ /**
1030
+ * Sets the range to empty.
1031
+ */ key: "_clearItems",
1032
+ value: function _clearItems() {
1033
+ this._first = -1;
1034
+ this._last = -1;
1035
+ this._physicalMin = 0;
1036
+ this._physicalMax = 0;
1037
+ var items = this._newPhysicalItems;
1038
+ this._newPhysicalItems = this._physicalItems;
1039
+ this._newPhysicalItems.clear();
1040
+ this._physicalItems = items;
1041
+ this._stable = true;
1042
+ }
1043
+ },
1044
+ {
1045
+ /*
1046
+ * Updates _first and _last based on items that should be in the given range.
1047
+ */ key: "_getItems",
1048
+ value: function _getItems() {
1049
+ var items = this._newPhysicalItems;
1050
+ this._stable = true;
1051
+ var lower, upper;
1052
+ // The anchorIdx is the anchor around which we reflow. It is designed to
1053
+ // allow jumping to any point of the scroll size. We choose it once and
1054
+ // stick with it until stable. first and last are deduced around it.
1055
+ // If we have a pinned item, we anchor on it
1056
+ if (this.pin !== null) {
1057
+ var index = this.pin.index;
1058
+ this._anchorIdx = index;
1059
+ this._anchorPos = this._getPosition(index);
1060
+ }
1061
+ // Determine the lower and upper bounds of the region to be
1062
+ // rendered, relative to the viewport
1063
+ lower = this._scrollPosition - this._overhang; //leadingOverhang;
1064
+ upper = this._scrollPosition + this._viewDim1 + this._overhang; // trailingOverhang;
1065
+ if (upper < 0 || lower > this._scrollSize) {
1066
+ this._clearItems();
1067
+ return;
1068
+ }
1069
+ // If we are scrolling to a specific index or if we are doing another
1070
+ // pass to stabilize a previously started reflow, we will already
1071
+ // have an anchor. If not, establish an anchor now.
1072
+ if (this._anchorIdx === null || this._anchorPos === null) {
1073
+ this._anchorIdx = this._getAnchor(lower, upper);
1074
+ this._anchorPos = this._getPosition(this._anchorIdx);
1075
+ }
1076
+ var anchorSize = this._getSize(this._anchorIdx);
1077
+ if (anchorSize === undefined) {
1078
+ this._stable = false;
1079
+ anchorSize = this._getAverageSize();
1080
+ }
1081
+ var _this__metricsCache_getMarginSize;
1082
+ var anchorLeadingMargin = (_this__metricsCache_getMarginSize = this._metricsCache.getMarginSize(this._anchorIdx)) !== null && _this__metricsCache_getMarginSize !== void 0 ? _this__metricsCache_getMarginSize : this._metricsCache.averageMarginSize;
1083
+ var _this__metricsCache_getMarginSize1;
1084
+ var anchorTrailingMargin = (_this__metricsCache_getMarginSize1 = this._metricsCache.getMarginSize(this._anchorIdx + 1)) !== null && _this__metricsCache_getMarginSize1 !== void 0 ? _this__metricsCache_getMarginSize1 : this._metricsCache.averageMarginSize;
1085
+ if (this._anchorIdx === 0) {
1086
+ this._anchorPos = anchorLeadingMargin;
1087
+ }
1088
+ if (this._anchorIdx === this.items.length - 1) {
1089
+ this._anchorPos = this._scrollSize - anchorTrailingMargin - anchorSize;
1090
+ }
1091
+ // Anchor might be outside bounds, so prefer correcting the error and keep
1092
+ // that anchorIdx.
1093
+ var anchorErr = 0;
1094
+ if (this._anchorPos + anchorSize + anchorTrailingMargin < lower) {
1095
+ anchorErr = lower - (this._anchorPos + anchorSize + anchorTrailingMargin);
1096
+ }
1097
+ if (this._anchorPos - anchorLeadingMargin > upper) {
1098
+ anchorErr = upper - (this._anchorPos - anchorLeadingMargin);
1099
+ }
1100
+ if (anchorErr) {
1101
+ this._scrollPosition -= anchorErr;
1102
+ lower -= anchorErr;
1103
+ upper -= anchorErr;
1104
+ this._scrollError += anchorErr;
1105
+ }
1106
+ items.set(this._anchorIdx, {
1107
+ pos: this._anchorPos,
1108
+ size: anchorSize
1109
+ });
1110
+ this._first = this._last = this._anchorIdx;
1111
+ this._physicalMin = this._anchorPos - anchorLeadingMargin;
1112
+ this._physicalMax = this._anchorPos + anchorSize + anchorTrailingMargin;
1113
+ while(this._physicalMin > lower && this._first > 0){
1114
+ var size = this._getSize(--this._first);
1115
+ if (size === undefined) {
1116
+ this._stable = false;
1117
+ size = this._getAverageSize();
1118
+ }
1119
+ var margin = this._metricsCache.getMarginSize(this._first);
1120
+ if (margin === undefined) {
1121
+ this._stable = false;
1122
+ margin = this._metricsCache.averageMarginSize;
1123
+ }
1124
+ this._physicalMin -= size;
1125
+ var pos = this._physicalMin;
1126
+ items.set(this._first, {
1127
+ pos: pos,
1128
+ size: size
1129
+ });
1130
+ this._physicalMin -= margin;
1131
+ if (this._stable === false && this._estimate === false) {
1132
+ break;
1133
+ }
1134
+ }
1135
+ while(this._physicalMax < upper && this._last < this.items.length - 1){
1136
+ var size1 = this._getSize(++this._last);
1137
+ if (size1 === undefined) {
1138
+ this._stable = false;
1139
+ size1 = this._getAverageSize();
1140
+ }
1141
+ var margin1 = this._metricsCache.getMarginSize(this._last);
1142
+ if (margin1 === undefined) {
1143
+ this._stable = false;
1144
+ margin1 = this._metricsCache.averageMarginSize;
1145
+ }
1146
+ var pos1 = this._physicalMax;
1147
+ items.set(this._last, {
1148
+ pos: pos1,
1149
+ size: size1
1150
+ });
1151
+ this._physicalMax += size1 + margin1;
1152
+ if (!this._stable && !this._estimate) {
1153
+ break;
1154
+ }
1155
+ }
1156
+ // This handles the cases where we were relying on estimated sizes.
1157
+ var extentErr = this._calculateError();
1158
+ if (extentErr) {
1159
+ this._physicalMin -= extentErr;
1160
+ this._physicalMax -= extentErr;
1161
+ this._anchorPos -= extentErr;
1162
+ this._scrollPosition -= extentErr;
1163
+ items.forEach(function(item) {
1164
+ return item.pos -= extentErr;
1165
+ });
1166
+ this._scrollError += extentErr;
1167
+ }
1168
+ if (this._stable) {
1169
+ this._newPhysicalItems = this._physicalItems;
1170
+ this._newPhysicalItems.clear();
1171
+ this._physicalItems = items;
1172
+ }
1173
+ }
1174
+ },
1175
+ {
1176
+ key: "_calculateError",
1177
+ value: function _calculateError() {
1178
+ if (this._first === 0) {
1179
+ return this._physicalMin;
1180
+ } else if (this._physicalMin <= 0) {
1181
+ return this._physicalMin - this._first * this._delta;
1182
+ } else if (this._last === this.items.length - 1) {
1183
+ return this._physicalMax - this._scrollSize;
1184
+ } else if (this._physicalMax >= this._scrollSize) {
1185
+ return this._physicalMax - this._scrollSize + (this.items.length - 1 - this._last) * this._delta;
1186
+ }
1187
+ return 0;
1188
+ }
1189
+ },
1190
+ {
1191
+ key: "_reflow",
1192
+ value: function _reflow() {
1193
+ var _this = this, _first = _this._first, _last = _this._last;
1194
+ _get(_get_prototype_of(FlowLayout.prototype), "_reflow", this).call(this);
1195
+ if (this._first === -1 && this._last == -1 || this._first === _first && this._last === _last) {
1196
+ this._resetReflowState();
1197
+ }
1198
+ }
1199
+ },
1200
+ {
1201
+ key: "_resetReflowState",
1202
+ value: function _resetReflowState() {
1203
+ this._anchorIdx = null;
1204
+ this._anchorPos = null;
1205
+ this._stable = true;
1206
+ }
1207
+ },
1208
+ {
1209
+ key: "_updateScrollSize",
1210
+ value: function _updateScrollSize() {
1211
+ var averageMarginSize = this._metricsCache.averageMarginSize;
1212
+ this._scrollSize = Math.max(1, this.items.length * (averageMarginSize + this._getAverageSize()) + averageMarginSize);
1213
+ }
1214
+ },
1215
+ {
1216
+ key: "_delta",
1217
+ get: /**
1218
+ * Returns the average size (precise or estimated) of an item in the scrolling direction,
1219
+ * including any surrounding space.
1220
+ */ function get() {
1221
+ var averageMarginSize = this._metricsCache.averageMarginSize;
1222
+ return this._getAverageSize() + averageMarginSize;
1223
+ }
1224
+ },
1225
+ {
1226
+ /**
1227
+ * Returns the top and left positioning of the item at idx.
1228
+ */ key: "_getItemPosition",
1229
+ value: function _getItemPosition(idx) {
1230
+ var _this__metricsCache_getLeadingMarginValue;
1231
+ var _obj;
1232
+ return _obj = {}, _define_property(_obj, this._positionDim, this._getPosition(idx)), _define_property(_obj, this._secondaryPositionDim, 0), _define_property(_obj, offset(this.direction), -((_this__metricsCache_getLeadingMarginValue = this._metricsCache.getLeadingMarginValue(idx, this.direction)) !== null && _this__metricsCache_getLeadingMarginValue !== void 0 ? _this__metricsCache_getLeadingMarginValue : this._metricsCache.averageMarginSize)), _obj;
1233
+ }
1234
+ },
1235
+ {
1236
+ /**
1237
+ * Returns the height and width of the item at idx.
1238
+ */ key: "_getItemSize",
1239
+ value: function _getItemSize(idx) {
1240
+ var _obj;
1241
+ return _obj = {}, _define_property(_obj, this._sizeDim, this._getSize(idx) || this._getAverageSize()), _define_property(_obj, this._secondarySizeDim, this._itemSize[this._secondarySizeDim]), _obj;
1242
+ }
1243
+ },
1244
+ {
1245
+ key: "_viewDim2Changed",
1246
+ value: function _viewDim2Changed() {
1247
+ this._metricsCache.clear();
1248
+ this._scheduleReflow();
1249
+ }
1250
+ }
1251
+ ]);
1252
+ return FlowLayout;
1253
+ }
1254
+ (BaseLayout);
1255
+
1256
+ exports.FlowLayout = FlowLayout;
1257
+ exports.flow = flow;