@vaadin/component-base 25.0.0-alpha17 → 25.0.0-alpha18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "25.0.0-alpha17",
3
+ "version": "25.0.0-alpha18",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,15 +33,15 @@
33
33
  "dependencies": {
34
34
  "@open-wc/dedupe-mixin": "^1.3.0",
35
35
  "@vaadin/vaadin-development-mode-detector": "^2.0.0",
36
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha17",
36
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha18",
37
37
  "@vaadin/vaadin-usage-statistics": "^2.1.0",
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "25.0.0-alpha17",
42
- "@vaadin/test-runner-commands": "25.0.0-alpha17",
41
+ "@vaadin/chai-plugins": "25.0.0-alpha18",
42
+ "@vaadin/test-runner-commands": "25.0.0-alpha18",
43
43
  "@vaadin/testing-helpers": "^2.0.0",
44
44
  "sinon": "^21.0.0"
45
45
  },
46
- "gitHead": "8264c71309907be99368b09414f0f8d7f591e0b9"
46
+ "gitHead": "cb5cafb5687a117ebead1b81e2116991cec13abe"
47
47
  }
package/src/define.js CHANGED
@@ -13,7 +13,7 @@ function dashToCamelCase(dash) {
13
13
 
14
14
  const experimentalMap = {};
15
15
 
16
- export function defineCustomElement(CustomElement, version = '25.0.0-alpha17') {
16
+ export function defineCustomElement(CustomElement, version = '25.0.0-alpha18') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -33,7 +33,7 @@ export class IronListAdapter {
33
33
 
34
34
  this.timeouts = {
35
35
  SCROLL_REORDER: 500,
36
- IGNORE_WHEEL: 500,
36
+ PREVENT_OVERSCROLL: 500,
37
37
  FIX_INVALID_ITEM_POSITIONING: 100,
38
38
  };
39
39
 
@@ -65,7 +65,6 @@ export class IronListAdapter {
65
65
  attachObserver.observe(this.scrollTarget);
66
66
 
67
67
  this._scrollLineHeight = this._getScrollLineHeight();
68
- this.scrollTarget.addEventListener('wheel', (e) => this.__onWheel(e));
69
68
 
70
69
  this.scrollTarget.addEventListener('virtualizer-element-focused', (e) => this.__onElementFocused(e));
71
70
  this.elementsContainer.addEventListener('focusin', () => {
@@ -580,6 +579,18 @@ export class IronListAdapter {
580
579
  timeOut.after(this.timeouts.FIX_INVALID_ITEM_POSITIONING),
581
580
  () => this.__fixInvalidItemPositioning(),
582
581
  );
582
+
583
+ if (!this.__overscrollDebouncer?.isActive()) {
584
+ this.scrollTarget.style.overscrollBehavior = 'none';
585
+ }
586
+
587
+ this.__overscrollDebouncer = Debouncer.debounce(
588
+ this.__overscrollDebouncer,
589
+ timeOut.after(this.timeouts.PREVENT_OVERSCROLL),
590
+ () => {
591
+ this.scrollTarget.style.overscrollBehavior = null;
592
+ },
593
+ );
583
594
  }
584
595
 
585
596
  if (this.reorderElements) {
@@ -654,96 +665,6 @@ export class IronListAdapter {
654
665
  }
655
666
  }
656
667
 
657
- /** @private */
658
- __onWheel(e) {
659
- if (e.ctrlKey || this._hasScrolledAncestor(e.target, e.deltaX, e.deltaY)) {
660
- return;
661
- }
662
-
663
- let deltaY = e.deltaY;
664
- if (e.deltaMode === WheelEvent.DOM_DELTA_LINE) {
665
- // Scrolling by "lines of text" instead of pixels
666
- deltaY *= this._scrollLineHeight;
667
- } else if (e.deltaMode === WheelEvent.DOM_DELTA_PAGE) {
668
- // Scrolling by "pages" instead of pixels
669
- deltaY *= this._scrollPageHeight;
670
- }
671
-
672
- if (!this._deltaYAcc) {
673
- this._deltaYAcc = 0;
674
- }
675
-
676
- if (this._wheelAnimationFrame) {
677
- // Accumulate wheel delta while a frame is being processed
678
- this._deltaYAcc += deltaY;
679
- e.preventDefault();
680
- return;
681
- }
682
-
683
- deltaY += this._deltaYAcc;
684
- this._deltaYAcc = 0;
685
-
686
- this._wheelAnimationFrame = true;
687
- this.__debouncerWheelAnimationFrame = Debouncer.debounce(
688
- this.__debouncerWheelAnimationFrame,
689
- animationFrame,
690
- () => {
691
- this._wheelAnimationFrame = false;
692
- },
693
- );
694
-
695
- const momentum = Math.abs(e.deltaX) + Math.abs(deltaY);
696
-
697
- if (this._canScroll(this.scrollTarget, e.deltaX, deltaY)) {
698
- e.preventDefault();
699
- this.scrollTarget.scrollTop += deltaY;
700
- this.scrollTarget.scrollLeft += e.deltaX;
701
-
702
- this._hasResidualMomentum = true;
703
-
704
- this._ignoreNewWheel = true;
705
- this._debouncerIgnoreNewWheel = Debouncer.debounce(
706
- this._debouncerIgnoreNewWheel,
707
- timeOut.after(this.timeouts.IGNORE_WHEEL),
708
- () => {
709
- this._ignoreNewWheel = false;
710
- },
711
- );
712
- } else if ((this._hasResidualMomentum && momentum <= this._previousMomentum) || this._ignoreNewWheel) {
713
- e.preventDefault();
714
- } else if (momentum > this._previousMomentum) {
715
- this._hasResidualMomentum = false;
716
- }
717
- this._previousMomentum = momentum;
718
- }
719
-
720
- /**
721
- * Determines if the element has an ancestor that handles the scroll delta prior to this
722
- *
723
- * @private
724
- */
725
- _hasScrolledAncestor(el, deltaX, deltaY) {
726
- if (el === this.scrollTarget || el === this.scrollTarget.getRootNode().host) {
727
- return false;
728
- } else if (
729
- this._canScroll(el, deltaX, deltaY) &&
730
- ['auto', 'scroll'].indexOf(getComputedStyle(el).overflow) !== -1
731
- ) {
732
- return true;
733
- } else if (el !== this && el.parentElement) {
734
- return this._hasScrolledAncestor(el.parentElement, deltaX, deltaY);
735
- }
736
- }
737
-
738
- _canScroll(el, deltaX, deltaY) {
739
- return (
740
- (deltaY > 0 && el.scrollTop < el.scrollHeight - el.offsetHeight) ||
741
- (deltaY < 0 && el.scrollTop > 0) ||
742
- (deltaX > 0 && el.scrollLeft < el.scrollWidth - el.offsetWidth) ||
743
- (deltaX < 0 && el.scrollLeft > 0)
744
- );
745
- }
746
-
747
668
  /**
748
669
  * Increases the pool size.
749
670
  * @override