@vaadin/component-base 23.1.0-alpha3 → 23.1.0-beta2

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.
@@ -166,7 +166,7 @@ export const ironList = {
166
166
  * The height of the physical content that isn't on the screen.
167
167
  */
168
168
  get _hiddenContentSize() {
169
- var size = this.grid ? this._physicalRows * this._rowHeight : this._physicalSize;
169
+ const size = this.grid ? this._physicalRows * this._rowHeight : this._physicalSize;
170
170
  return size - this._viewportHeight;
171
171
  },
172
172
 
@@ -182,7 +182,7 @@ export const ironList = {
182
182
  * `_physicalStart`.
183
183
  */
184
184
  get _maxVirtualStart() {
185
- var virtualCount = this._convertIndexToCompleteRow(this._virtualCount);
185
+ const virtualCount = this._convertIndexToCompleteRow(this._virtualCount);
186
186
  return Math.max(0, virtualCount - this._physicalCount);
187
187
  },
188
188
 
@@ -255,9 +255,9 @@ export const ironList = {
255
255
  * @type {number}
256
256
  */
257
257
  get firstVisibleIndex() {
258
- var idx = this._firstVisibleIndexVal;
258
+ let idx = this._firstVisibleIndexVal;
259
259
  if (idx == null) {
260
- var physicalOffset = this._physicalTop + this._scrollOffset;
260
+ let physicalOffset = this._physicalTop + this._scrollOffset;
261
261
 
262
262
  idx =
263
263
  this._iterateItems((pidx, vidx) => {
@@ -282,12 +282,12 @@ export const ironList = {
282
282
  * @type {number}
283
283
  */
284
284
  get lastVisibleIndex() {
285
- var idx = this._lastVisibleIndexVal;
285
+ let idx = this._lastVisibleIndexVal;
286
286
  if (idx == null) {
287
287
  if (this.grid) {
288
288
  idx = Math.min(this._virtualCount, this.firstVisibleIndex + this._estRowsInView * this._itemsPerRow - 1);
289
289
  } else {
290
- var physicalOffset = this._physicalTop + this._scrollOffset;
290
+ let physicalOffset = this._physicalTop + this._scrollOffset;
291
291
  this._iterateItems((pidx, vidx) => {
292
292
  if (physicalOffset < this._scrollBottom) {
293
293
  idx = vidx;
@@ -323,10 +323,10 @@ export const ironList = {
323
323
  /**
324
324
  * Recycles the physical items when needed.
325
325
  */
326
- _scrollHandler: function () {
327
- var scrollTop = Math.max(0, Math.min(this._maxScrollTop, this._scrollTop));
328
- var delta = scrollTop - this._scrollPosition;
329
- var isScrollingDown = delta >= 0;
326
+ _scrollHandler() {
327
+ const scrollTop = Math.max(0, Math.min(this._maxScrollTop, this._scrollTop));
328
+ let delta = scrollTop - this._scrollPosition;
329
+ const isScrollingDown = delta >= 0;
330
330
  // Track the current scroll position.
331
331
  this._scrollPosition = scrollTop;
332
332
  // Clear indexes for first and last visible indexes.
@@ -335,7 +335,7 @@ export const ironList = {
335
335
  // Random access.
336
336
  if (Math.abs(delta) > this._physicalSize && this._physicalSize > 0) {
337
337
  delta -= this._scrollOffset;
338
- var idxAdjustment = Math.round(delta / this._physicalAverage) * this._itemsPerRow;
338
+ const idxAdjustment = Math.round(delta / this._physicalAverage) * this._itemsPerRow;
339
339
  this._virtualStart += idxAdjustment;
340
340
  this._physicalStart += idxAdjustment;
341
341
  // Estimate new physical offset based on the virtual start index.
@@ -346,11 +346,11 @@ export const ironList = {
346
346
  // _increasePoolIfNeeded to run away creating items to try to fill it.
347
347
  this._physicalTop = Math.min(
348
348
  Math.floor(this._virtualStart / this._itemsPerRow) * this._physicalAverage,
349
- this._scrollPosition
349
+ this._scrollPosition,
350
350
  );
351
351
  this._update();
352
352
  } else if (this._physicalCount > 0) {
353
- var reusables = this._getReusables(isScrollingDown);
353
+ const reusables = this._getReusables(isScrollingDown);
354
354
  if (isScrollingDown) {
355
355
  this._physicalTop = reusables.physicalTop;
356
356
  this._virtualStart += reusables.indexes.length;
@@ -370,18 +370,18 @@ export const ironList = {
370
370
  *
371
371
  * @param {boolean} fromTop If the potential reusable items are above the scrolling region.
372
372
  */
373
- _getReusables: function (fromTop) {
374
- var ith, lastIth, offsetContent, physicalItemHeight;
375
- var idxs = [];
376
- var protectedOffsetContent = this._hiddenContentSize * this._ratio;
377
- var virtualStart = this._virtualStart;
378
- var virtualEnd = this._virtualEnd;
379
- var physicalCount = this._physicalCount;
380
- var top = this._physicalTop + this._scrollOffset;
381
- var bottom = this._physicalBottom + this._scrollOffset;
373
+ _getReusables(fromTop) {
374
+ let ith, lastIth, offsetContent, physicalItemHeight;
375
+ const idxs = [];
376
+ const protectedOffsetContent = this._hiddenContentSize * this._ratio;
377
+ const virtualStart = this._virtualStart;
378
+ const virtualEnd = this._virtualEnd;
379
+ const physicalCount = this._physicalCount;
380
+ let top = this._physicalTop + this._scrollOffset;
381
+ const bottom = this._physicalBottom + this._scrollOffset;
382
382
  // This may be called outside of a scrollHandler, so use last cached position
383
- var scrollTop = this._scrollPosition;
384
- var scrollBottom = this._scrollBottom;
383
+ const scrollTop = this._scrollPosition;
384
+ const scrollBottom = this._scrollBottom;
385
385
 
386
386
  if (fromTop) {
387
387
  ith = this._physicalStart;
@@ -434,7 +434,7 @@ export const ironList = {
434
434
  * @param {!Array<number>=} itemSet
435
435
  * @param {!Array<number>=} movingUp
436
436
  */
437
- _update: function (itemSet, movingUp) {
437
+ _update(itemSet, movingUp) {
438
438
  if ((itemSet && itemSet.length === 0) || this._physicalCount === 0) {
439
439
  return;
440
440
  }
@@ -444,7 +444,7 @@ export const ironList = {
444
444
  // Adjust offset after measuring.
445
445
  if (movingUp) {
446
446
  while (movingUp.length) {
447
- var idx = movingUp.pop();
447
+ const idx = movingUp.pop();
448
448
  this._physicalTop -= this._getPhysicalSizeIncrement(idx);
449
449
  }
450
450
  }
@@ -452,9 +452,9 @@ export const ironList = {
452
452
  this._updateScrollerSize();
453
453
  },
454
454
 
455
- _isClientFull: function () {
455
+ _isClientFull() {
456
456
  return (
457
- this._scrollBottom != 0 &&
457
+ this._scrollBottom !== 0 &&
458
458
  this._physicalBottom - 1 >= this._scrollBottom &&
459
459
  this._physicalTop <= this._scrollPosition
460
460
  );
@@ -463,33 +463,33 @@ export const ironList = {
463
463
  /**
464
464
  * Increases the pool size.
465
465
  */
466
- _increasePoolIfNeeded: function (count) {
467
- var nextPhysicalCount = this._clamp(
466
+ _increasePoolIfNeeded(count) {
467
+ let nextPhysicalCount = this._clamp(
468
468
  this._physicalCount + count,
469
469
  DEFAULT_PHYSICAL_COUNT,
470
- this._virtualCount - this._virtualStart
470
+ this._virtualCount - this._virtualStart,
471
471
  );
472
472
  nextPhysicalCount = this._convertIndexToCompleteRow(nextPhysicalCount);
473
473
  if (this.grid) {
474
- var correction = nextPhysicalCount % this._itemsPerRow;
474
+ const correction = nextPhysicalCount % this._itemsPerRow;
475
475
  if (correction && nextPhysicalCount - correction <= this._physicalCount) {
476
476
  nextPhysicalCount += this._itemsPerRow;
477
477
  }
478
478
  nextPhysicalCount -= correction;
479
479
  }
480
- var delta = nextPhysicalCount - this._physicalCount;
481
- var nextIncrease = Math.round(this._physicalCount * 0.5);
480
+ const delta = nextPhysicalCount - this._physicalCount;
481
+ let nextIncrease = Math.round(this._physicalCount * 0.5);
482
482
 
483
483
  if (delta < 0) {
484
484
  return;
485
485
  }
486
486
  if (delta > 0) {
487
- var ts = window.performance.now();
487
+ const ts = window.performance.now();
488
488
  // Concat arrays in place.
489
489
  [].push.apply(this._physicalItems, this._createPool(delta));
490
490
  // Push 0s into physicalSizes. Can't use Array.fill because IE11 doesn't
491
491
  // support it.
492
- for (var i = 0; i < delta; i++) {
492
+ for (let i = 0; i < delta; i++) {
493
493
  this._physicalSizes.push(0);
494
494
  }
495
495
  this._physicalCount += delta;
@@ -520,7 +520,7 @@ export const ironList = {
520
520
  this._debounce(
521
521
  '_increasePoolIfNeeded',
522
522
  this._increasePoolIfNeeded.bind(this, this._clamp(Math.round(50 / this._templateCost), 1, nextIncrease)),
523
- idlePeriod
523
+ idlePeriod,
524
524
  );
525
525
  }
526
526
  },
@@ -528,12 +528,12 @@ export const ironList = {
528
528
  /**
529
529
  * Renders the a new list.
530
530
  */
531
- _render: function () {
531
+ _render() {
532
532
  if (!this.isAttached || !this._isVisible) {
533
533
  return;
534
534
  }
535
535
  if (this._physicalCount !== 0) {
536
- var reusables = this._getReusables(true);
536
+ const reusables = this._getReusables(true);
537
537
  this._physicalTop = reusables.physicalTop;
538
538
  this._virtualStart += reusables.indexes.length;
539
539
  this._physicalStart += reusables.indexes.length;
@@ -547,20 +547,22 @@ export const ironList = {
547
547
  }
548
548
  },
549
549
 
550
- _gridChanged: function (newGrid, oldGrid) {
550
+ _gridChanged(newGrid, oldGrid) {
551
551
  if (typeof oldGrid === 'undefined') {
552
552
  return;
553
553
  }
554
554
  this.notifyResize();
555
555
  flush();
556
- newGrid && this._updateGridMetrics();
556
+ if (newGrid) {
557
+ this._updateGridMetrics();
558
+ }
557
559
  },
558
560
 
559
561
  /**
560
562
  * Called when the items have changed. That is, reassignments
561
563
  * to `items`, splices or updates to a single item.
562
564
  */
563
- _itemsChanged: function (change) {
565
+ _itemsChanged(change) {
564
566
  if (change.path === 'items') {
565
567
  this._virtualStart = 0;
566
568
  this._physicalTop = 0;
@@ -581,21 +583,21 @@ export const ironList = {
581
583
  this._adjustVirtualIndex(change.value.indexSplices);
582
584
  this._virtualCount = this.items ? this.items.length : 0;
583
585
  // Only blur if at least one item is added or removed.
584
- var itemAddedOrRemoved = change.value.indexSplices.some(function (splice) {
586
+ const itemAddedOrRemoved = change.value.indexSplices.some((splice) => {
585
587
  return splice.addedCount > 0 || splice.removed.length > 0;
586
588
  });
587
589
  if (itemAddedOrRemoved) {
588
590
  // Only blur activeElement if it is a descendant of the list (#505,
589
591
  // #507).
590
- var activeElement = this._getActiveElement();
592
+ const activeElement = this._getActiveElement();
591
593
  if (this.contains(activeElement)) {
592
594
  activeElement.blur();
593
595
  }
594
596
  }
595
597
  // Render only if the affected index is rendered.
596
- var affectedIndexRendered = change.value.indexSplices.some(function (splice) {
598
+ const affectedIndexRendered = change.value.indexSplices.some((splice) => {
597
599
  return splice.index + splice.addedCount >= this._virtualStart && splice.index <= this._virtualEnd;
598
- }, this);
600
+ });
599
601
  if (!this._isClientFull() || affectedIndexRendered) {
600
602
  this._debounce('_render', this._render, animationFrame);
601
603
  }
@@ -612,8 +614,8 @@ export const ironList = {
612
614
  * @param {!function(number, number)} fn
613
615
  * @param {!Array<number>=} itemSet
614
616
  */
615
- _iterateItems: function (fn, itemSet) {
616
- var pidx, vidx, rtn, i;
617
+ _iterateItems(fn, itemSet) {
618
+ let pidx, vidx, rtn, i;
617
619
 
618
620
  if (arguments.length === 2 && itemSet) {
619
621
  for (i = 0; i < itemSet.length; i++) {
@@ -645,7 +647,7 @@ export const ironList = {
645
647
  * @param {number} pidx Physical index
646
648
  * @return {number}
647
649
  */
648
- _computeVidx: function (pidx) {
650
+ _computeVidx(pidx) {
649
651
  if (pidx >= this._physicalStart) {
650
652
  return this._virtualStart + (pidx - this._physicalStart);
651
653
  }
@@ -657,15 +659,15 @@ export const ironList = {
657
659
  *
658
660
  * @param {!Array<number>=} itemSet
659
661
  */
660
- _updateMetrics: function (itemSet) {
662
+ _updateMetrics(itemSet) {
661
663
  // Make sure we distributed all the physical items
662
664
  // so we can measure them.
663
665
  flush();
664
666
 
665
- var newPhysicalSize = 0;
666
- var oldPhysicalSize = 0;
667
- var prevAvgCount = this._physicalAverageCount;
668
- var prevPhysicalAvg = this._physicalAverage;
667
+ let newPhysicalSize = 0;
668
+ let oldPhysicalSize = 0;
669
+ const prevAvgCount = this._physicalAverageCount;
670
+ const prevPhysicalAvg = this._physicalAverage;
669
671
 
670
672
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
671
673
  this._iterateItems((pidx, vidx) => {
@@ -689,12 +691,12 @@ export const ironList = {
689
691
  // Update the average if it measured something.
690
692
  if (this._physicalAverageCount !== prevAvgCount) {
691
693
  this._physicalAverage = Math.round(
692
- (prevPhysicalAvg * prevAvgCount + newPhysicalSize) / this._physicalAverageCount
694
+ (prevPhysicalAvg * prevAvgCount + newPhysicalSize) / this._physicalAverageCount,
693
695
  );
694
696
  }
695
697
  },
696
698
 
697
- _updateGridMetrics: function () {
699
+ _updateGridMetrics() {
698
700
  this._itemWidth = this._physicalCount > 0 ? this._physicalItems[0].getBoundingClientRect().width : 200;
699
701
  this._rowHeight = this._physicalCount > 0 ? this._physicalItems[0].offsetHeight : 200;
700
702
  this._itemsPerRow = this._itemWidth ? Math.floor(this._viewportWidth / this._itemWidth) : this._itemsPerRow;
@@ -703,22 +705,22 @@ export const ironList = {
703
705
  /**
704
706
  * Updates the position of the physical items.
705
707
  */
706
- _positionItems: function () {
708
+ _positionItems() {
707
709
  this._adjustScrollPosition();
708
710
 
709
- var y = this._physicalTop;
711
+ let y = this._physicalTop;
710
712
 
711
713
  if (this.grid) {
712
- var totalItemWidth = this._itemsPerRow * this._itemWidth;
713
- var rowOffset = (this._viewportWidth - totalItemWidth) / 2;
714
+ const totalItemWidth = this._itemsPerRow * this._itemWidth;
715
+ const rowOffset = (this._viewportWidth - totalItemWidth) / 2;
714
716
 
715
717
  this._iterateItems((pidx, vidx) => {
716
- var modulus = vidx % this._itemsPerRow;
717
- var x = Math.floor(modulus * this._itemWidth + rowOffset);
718
+ const modulus = vidx % this._itemsPerRow;
719
+ let x = Math.floor(modulus * this._itemWidth + rowOffset);
718
720
  if (this._isRTL) {
719
721
  x *= -1;
720
722
  }
721
- this.translate3d(x + 'px', y + 'px', 0, this._physicalItems[pidx]);
723
+ this.translate3d(`${x}px`, `${y}px`, 0, this._physicalItems[pidx]);
722
724
  if (this._shouldRenderNextRow(vidx)) {
723
725
  y += this._rowHeight;
724
726
  }
@@ -728,7 +730,7 @@ export const ironList = {
728
730
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
729
731
  this._iterateItems((pidx, vidx) => {
730
732
  const item = this._physicalItems[pidx];
731
- this.translate3d(0, y + 'px', 0, item);
733
+ this.translate3d(0, `${y}px`, 0, item);
732
734
  y += this._physicalSizes[pidx];
733
735
  const itemId = item.id;
734
736
  if (itemId) {
@@ -741,7 +743,7 @@ export const ironList = {
741
743
  }
742
744
  },
743
745
 
744
- _getPhysicalSizeIncrement: function (pidx) {
746
+ _getPhysicalSizeIncrement(pidx) {
745
747
  if (!this.grid) {
746
748
  return this._physicalSizes[pidx];
747
749
  }
@@ -759,22 +761,22 @@ export const ironList = {
759
761
  * @param {number} vidx Virtual index
760
762
  * @return {boolean}
761
763
  */
762
- _shouldRenderNextRow: function (vidx) {
764
+ _shouldRenderNextRow(vidx) {
763
765
  return vidx % this._itemsPerRow === this._itemsPerRow - 1;
764
766
  },
765
767
 
766
768
  /**
767
769
  * Adjusts the scroll position when it was overestimated.
768
770
  */
769
- _adjustScrollPosition: function () {
770
- var deltaHeight =
771
+ _adjustScrollPosition() {
772
+ const deltaHeight =
771
773
  this._virtualStart === 0 ? this._physicalTop : Math.min(this._scrollPosition + this._physicalTop, 0);
772
774
  // Note: the delta can be positive or negative.
773
775
  if (deltaHeight !== 0) {
774
776
  this._physicalTop -= deltaHeight;
775
777
  // This may be called outside of a scrollHandler, so use last cached position
776
- var scrollTop = this._scrollPosition;
777
- // juking scroll position during interial scrolling on iOS is no bueno
778
+ const scrollTop = this._scrollPosition;
779
+ // Juking scroll position during interial scrolling on iOS is no bueno
778
780
  if (!IOS_TOUCH_SCROLLING && scrollTop > 0) {
779
781
  this._resetScrollPosition(scrollTop - deltaHeight);
780
782
  }
@@ -784,7 +786,7 @@ export const ironList = {
784
786
  /**
785
787
  * Sets the position of the scroll.
786
788
  */
787
- _resetScrollPosition: function (pos) {
789
+ _resetScrollPosition(pos) {
788
790
  if (this.scrollTarget && pos >= 0) {
789
791
  this._scrollTop = pos;
790
792
  this._scrollPosition = this._scrollTop;
@@ -796,7 +798,7 @@ export const ironList = {
796
798
  *
797
799
  * @param {boolean=} forceUpdate If true, updates the height no matter what.
798
800
  */
799
- _updateScrollerSize: function (forceUpdate) {
801
+ _updateScrollerSize(forceUpdate) {
800
802
  if (this.grid) {
801
803
  this._estScrollHeight = this._virtualRowCount * this._rowHeight;
802
804
  } else {
@@ -809,7 +811,7 @@ export const ironList = {
809
811
  forceUpdate = forceUpdate || (this.grid && this.$.items.style.height < this._estScrollHeight);
810
812
  // Amortize height adjustment, so it won't trigger large repaints too often.
811
813
  if (forceUpdate || Math.abs(this._estScrollHeight - this._scrollHeight) >= this._viewportHeight) {
812
- this.$.items.style.height = this._estScrollHeight + 'px';
814
+ this.$.items.style.height = `${this._estScrollHeight}px`;
813
815
  this._scrollHeight = this._estScrollHeight;
814
816
  }
815
817
  },
@@ -821,7 +823,7 @@ export const ironList = {
821
823
  * @method scrollToIndex
822
824
  * @param {number} idx The index of the item
823
825
  */
824
- scrollToIndex: function (idx) {
826
+ scrollToIndex(idx) {
825
827
  if (typeof idx !== 'number' || idx < 0 || idx > this.items.length - 1) {
826
828
  return;
827
829
  }
@@ -841,11 +843,11 @@ export const ironList = {
841
843
  // Estimate new physical offset.
842
844
  this._physicalTop = Math.floor(this._virtualStart / this._itemsPerRow) * this._physicalAverage;
843
845
 
844
- var currentTopItem = this._physicalStart;
845
- var currentVirtualItem = this._virtualStart;
846
- var targetOffsetTop = 0;
847
- var hiddenContentSize = this._hiddenContentSize;
848
- // scroll to the item as much as we can.
846
+ let currentTopItem = this._physicalStart;
847
+ let currentVirtualItem = this._virtualStart;
848
+ let targetOffsetTop = 0;
849
+ const hiddenContentSize = this._hiddenContentSize;
850
+ // Scroll to the item as much as we can.
849
851
  while (currentVirtualItem < idx && targetOffsetTop <= hiddenContentSize) {
850
852
  targetOffsetTop += this._getPhysicalSizeIncrement(currentTopItem);
851
853
  currentTopItem = (currentTopItem + 1) % this._physicalCount;
@@ -855,7 +857,7 @@ export const ironList = {
855
857
  this._positionItems();
856
858
  this._resetScrollPosition(this._physicalTop + this._scrollOffset + targetOffsetTop);
857
859
  this._increasePoolIfNeeded(0);
858
- // clear cached visible index.
860
+ // Clear cached visible index.
859
861
  this._firstVisibleIndexVal = null;
860
862
  this._lastVisibleIndexVal = null;
861
863
  },
@@ -863,7 +865,7 @@ export const ironList = {
863
865
  /**
864
866
  * Reset the physical average and the average count.
865
867
  */
866
- _resetAverage: function () {
868
+ _resetAverage() {
867
869
  this._physicalAverage = 0;
868
870
  this._physicalAverageCount = 0;
869
871
  },
@@ -872,11 +874,11 @@ export const ironList = {
872
874
  * A handler for the `iron-resize` event triggered by `IronResizableBehavior`
873
875
  * when the element is resized.
874
876
  */
875
- _resizeHandler: function () {
877
+ _resizeHandler() {
876
878
  this._debounce(
877
879
  '_render',
878
880
  () => {
879
- // clear cached visible index.
881
+ // Clear cached visible index.
880
882
  this._firstVisibleIndexVal = null;
881
883
  this._lastVisibleIndexVal = null;
882
884
  if (this._isVisible) {
@@ -890,7 +892,7 @@ export const ironList = {
890
892
  this.toggleScrollListener(false);
891
893
  }
892
894
  },
893
- animationFrame
895
+ animationFrame,
894
896
  );
895
897
  },
896
898
 
@@ -900,7 +902,7 @@ export const ironList = {
900
902
  * @method updateSizeForItem
901
903
  * @param {Object} item The item instance.
902
904
  */
903
- updateSizeForItem: function (item) {
905
+ updateSizeForItem(item) {
904
906
  return this.updateSizeForIndex(this.items.indexOf(item));
905
907
  },
906
908
 
@@ -910,7 +912,7 @@ export const ironList = {
910
912
  * @method updateSizeForIndex
911
913
  * @param {number} index The index of the item in the items array.
912
914
  */
913
- updateSizeForIndex: function (index) {
915
+ updateSizeForIndex(index) {
914
916
  if (!this._isIndexRendered(index)) {
915
917
  return null;
916
918
  }
@@ -923,31 +925,31 @@ export const ironList = {
923
925
  * Converts a random index to the index of the item that completes it's row.
924
926
  * Allows for better order and fill computation when grid == true.
925
927
  */
926
- _convertIndexToCompleteRow: function (idx) {
927
- // when grid == false _itemPerRow can be unset.
928
+ _convertIndexToCompleteRow(idx) {
929
+ // When grid == false _itemPerRow can be unset.
928
930
  this._itemsPerRow = this._itemsPerRow || 1;
929
931
  return this.grid ? Math.ceil(idx / this._itemsPerRow) * this._itemsPerRow : idx;
930
932
  },
931
933
 
932
- _isIndexRendered: function (idx) {
934
+ _isIndexRendered(idx) {
933
935
  return idx >= this._virtualStart && idx <= this._virtualEnd;
934
936
  },
935
937
 
936
- _isIndexVisible: function (idx) {
938
+ _isIndexVisible(idx) {
937
939
  return idx >= this.firstVisibleIndex && idx <= this.lastVisibleIndex;
938
940
  },
939
941
 
940
- _getPhysicalIndex: function (vidx) {
942
+ _getPhysicalIndex(vidx) {
941
943
  return (this._physicalStart + (vidx - this._virtualStart)) % this._physicalCount;
942
944
  },
943
945
 
944
- _clamp: function (v, min, max) {
946
+ _clamp(v, min, max) {
945
947
  return Math.min(max, Math.max(min, v));
946
948
  },
947
949
 
948
- _debounce: function (name, cb, asyncModule) {
950
+ _debounce(name, cb, asyncModule) {
949
951
  this._debouncers = this._debouncers || {};
950
952
  this._debouncers[name] = Debouncer.debounce(this._debouncers[name], asyncModule, cb.bind(this));
951
953
  enqueueDebouncer(this._debouncers[name]);
952
- }
954
+ },
953
955
  };
@@ -49,5 +49,5 @@ export const KeyboardMixin = dedupingMixin(
49
49
  _onKeyUp(_event) {
50
50
  // To be implemented.
51
51
  }
52
- }
52
+ },
53
53
  );
@@ -26,13 +26,13 @@ function parseObserver(observerString) {
26
26
 
27
27
  return {
28
28
  method,
29
- observerProps
29
+ observerProps,
30
30
  };
31
31
  }
32
32
 
33
33
  function getOrCreateMap(obj, name) {
34
34
  if (!Object.prototype.hasOwnProperty.call(obj, name)) {
35
- // clone any existing entries (superclasses)
35
+ // Clone any existing entries (superclasses)
36
36
  obj[name] = new Map(obj[name]);
37
37
  }
38
38
  return obj[name];
@@ -43,7 +43,7 @@ const PolylitMixinImplementation = (superclass) => {
43
43
  static createProperty(name, options) {
44
44
  if ([String, Boolean, Number, Array].includes(options)) {
45
45
  options = {
46
- type: options
46
+ type: options,
47
47
  };
48
48
  }
49
49
 
@@ -105,7 +105,7 @@ const PolylitMixinImplementation = (superclass) => {
105
105
 
106
106
  this.addCheckedInitializer((instance) => {
107
107
  // This is run during construction of the element
108
- instance['_set' + upper(name)] = function (value) {
108
+ instance[`_set${upper(name)}`] = function (value) {
109
109
  setter.call(instance, value);
110
110
  };
111
111
  });
@@ -116,14 +116,14 @@ const PolylitMixinImplementation = (superclass) => {
116
116
  // Do nothing, property is read-only.
117
117
  },
118
118
  configurable: true,
119
- enumerable: true
119
+ enumerable: true,
120
120
  };
121
121
  }
122
122
 
123
123
  if (options.observer) {
124
124
  const method = options.observer;
125
125
 
126
- // set this method
126
+ // Set this method
127
127
  this.getOrCreateMap('__observers').set(name, method);
128
128
 
129
129
  this.addCheckedInitializer((instance) => {
@@ -138,12 +138,12 @@ const PolylitMixinImplementation = (superclass) => {
138
138
  this.__notifyProps = new Set();
139
139
  // eslint-disable-next-line no-prototype-builtins
140
140
  } else if (!this.hasOwnProperty('__notifyProps')) {
141
- // clone any existing observers (superclasses)
141
+ // Clone any existing observers (superclasses)
142
142
  const notifyProps = this.__notifyProps;
143
143
  this.__notifyProps = new Set(notifyProps);
144
144
  }
145
145
 
146
- // set this method
146
+ // Set this method
147
147
  this.__notifyProps.add(name);
148
148
  }
149
149
 
@@ -238,9 +238,9 @@ const PolylitMixinImplementation = (superclass) => {
238
238
  this.dispatchEvent(
239
239
  new CustomEvent(`${camelToDash(k)}-changed`, {
240
240
  detail: {
241
- value: this[k]
242
- }
243
- })
241
+ value: this[k],
242
+ },
243
+ }),
244
244
  );
245
245
  }
246
246
  });
@@ -16,4 +16,10 @@ export declare class ResizeMixinClass {
16
16
  * Override the method to implement your own behavior.
17
17
  */
18
18
  protected _onResize(contentRect: DOMRect): void;
19
+
20
+ /**
21
+ * When true, the parent element resize will be also observed.
22
+ * Override this getter and return `true` to enable this.
23
+ */
24
+ protected readonly _observeParent: boolean;
19
25
  }