@vaadin/component-base 25.0.0-alpha16 → 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 +6 -6
- package/src/define.js +1 -1
- package/src/polylit-mixin.js +0 -16
- package/src/styles/style-props.js +8 -6
- package/src/tooltip-controller.js +20 -5
- package/src/virtualizer-iron-list-adapter.js +13 -92
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "25.0.0-
|
|
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-
|
|
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-
|
|
42
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
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
|
-
"sinon": "^
|
|
44
|
+
"sinon": "^21.0.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
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-
|
|
16
|
+
export function defineCustomElement(CustomElement, version = '25.0.0-alpha18') {
|
|
17
17
|
Object.defineProperty(CustomElement, 'version', {
|
|
18
18
|
get() {
|
|
19
19
|
return version;
|
package/src/polylit-mixin.js
CHANGED
|
@@ -215,26 +215,10 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
constructor() {
|
|
219
|
-
super();
|
|
220
|
-
this.__hasPolylitMixin = true;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
218
|
/** @protected */
|
|
224
219
|
connectedCallback() {
|
|
225
220
|
super.connectedCallback();
|
|
226
221
|
|
|
227
|
-
// Components like `vaadin-overlay` are teleported to the body element when opened.
|
|
228
|
-
// If their opened state is set as an attribute, the teleportation happens immediately
|
|
229
|
-
// after they are connected to the DOM. This means they will be outside the scope of
|
|
230
|
-
// querySelectorAll in the parent component's `firstUpdated()`. To ensure their reference
|
|
231
|
-
// is still registered in the $ map, we propagate the reference here.
|
|
232
|
-
const parentHost = this.getRootNode().host;
|
|
233
|
-
if (parentHost && parentHost.__hasPolylitMixin && this.id) {
|
|
234
|
-
parentHost.$ ||= {};
|
|
235
|
-
parentHost.$[this.id] = this;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
222
|
const { polylitConfig } = this.constructor;
|
|
239
223
|
if (!this.hasUpdated && !polylitConfig.asyncFirstRender) {
|
|
240
224
|
this.performUpdate();
|
|
@@ -15,20 +15,20 @@ addGlobalThemeStyles(
|
|
|
15
15
|
--vaadin-background-color: light-dark(#fff, #222);
|
|
16
16
|
|
|
17
17
|
/* Container colors */
|
|
18
|
-
--vaadin-background-container: color-mix(in
|
|
18
|
+
--vaadin-background-container: color-mix(in oklab, var(--vaadin-color) 5%, var(--vaadin-background-color));
|
|
19
19
|
--vaadin-background-container-strong: color-mix(
|
|
20
|
-
in
|
|
20
|
+
in oklab,
|
|
21
21
|
var(--vaadin-color) 10%,
|
|
22
22
|
var(--vaadin-background-color)
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
/* Border colors */
|
|
26
|
-
--vaadin-border-color-subtle: color-mix(in
|
|
27
|
-
--vaadin-border-color: color-mix(in
|
|
26
|
+
--vaadin-border-color-subtle: color-mix(in oklab, var(--vaadin-color) 24%, transparent);
|
|
27
|
+
--vaadin-border-color: color-mix(in oklab, var(--vaadin-color) 48%, transparent); /* Above 3:1 contrast */
|
|
28
28
|
|
|
29
29
|
/* Text colors */
|
|
30
|
-
--vaadin-color-disabled: color-mix(in
|
|
31
|
-
--vaadin-color-subtle: color-mix(in
|
|
30
|
+
--vaadin-color-disabled: color-mix(in oklab, var(--vaadin-color) 48%, transparent); /* Above 3:1 contrast */
|
|
31
|
+
--vaadin-color-subtle: color-mix(in oklab, var(--vaadin-color) 68%, transparent); /* Above 4.5:1 contrast */
|
|
32
32
|
--vaadin-color: light-dark(#1f1f1f, white); /* Above 7:1 contrast */
|
|
33
33
|
|
|
34
34
|
/* Padding */
|
|
@@ -40,9 +40,11 @@ addGlobalThemeStyles(
|
|
|
40
40
|
--vaadin-padding-container: var(--vaadin-padding-xs) var(--vaadin-padding-s);
|
|
41
41
|
|
|
42
42
|
/* Gap/spacing */
|
|
43
|
+
--vaadin-gap-xs: 6px;
|
|
43
44
|
--vaadin-gap-s: 8px;
|
|
44
45
|
--vaadin-gap-m: 12px;
|
|
45
46
|
--vaadin-gap-l: 16px;
|
|
47
|
+
--vaadin-gap-xl: 24px;
|
|
46
48
|
|
|
47
49
|
/* Border radius */
|
|
48
50
|
--vaadin-radius-s: 3px;
|
|
@@ -14,6 +14,7 @@ export class TooltipController extends SlotController {
|
|
|
14
14
|
super(host, 'tooltip');
|
|
15
15
|
|
|
16
16
|
this.setTarget(host);
|
|
17
|
+
this.__onContentChange = this.__onContentChange.bind(this);
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
/**
|
|
@@ -50,17 +51,26 @@ export class TooltipController extends SlotController {
|
|
|
50
51
|
tooltipNode.shouldShow = this.shouldShow;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
this.
|
|
54
|
+
if (!this.manual) {
|
|
55
|
+
this.host.setAttribute('has-tooltip', '');
|
|
56
|
+
}
|
|
57
|
+
this.__notifyChange(tooltipNode);
|
|
58
|
+
tooltipNode.addEventListener('content-changed', this.__onContentChange);
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
/**
|
|
57
62
|
* Override to notify the host when the tooltip is removed.
|
|
58
63
|
*
|
|
64
|
+
* @param {Node} tooltipNode
|
|
59
65
|
* @protected
|
|
60
66
|
* @override
|
|
61
67
|
*/
|
|
62
|
-
teardownNode() {
|
|
63
|
-
this.
|
|
68
|
+
teardownNode(tooltipNode) {
|
|
69
|
+
if (!this.manual) {
|
|
70
|
+
this.host.removeAttribute('has-tooltip');
|
|
71
|
+
}
|
|
72
|
+
tooltipNode.removeEventListener('content-changed', this.__onContentChange);
|
|
73
|
+
this.__notifyChange(null);
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
/**
|
|
@@ -159,7 +169,12 @@ export class TooltipController extends SlotController {
|
|
|
159
169
|
}
|
|
160
170
|
|
|
161
171
|
/** @private */
|
|
162
|
-
|
|
163
|
-
this.
|
|
172
|
+
__onContentChange(event) {
|
|
173
|
+
this.__notifyChange(event.target);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** @private */
|
|
177
|
+
__notifyChange(node) {
|
|
178
|
+
this.dispatchEvent(new CustomEvent('tooltip-changed', { detail: { node } }));
|
|
164
179
|
}
|
|
165
180
|
}
|
|
@@ -33,7 +33,7 @@ export class IronListAdapter {
|
|
|
33
33
|
|
|
34
34
|
this.timeouts = {
|
|
35
35
|
SCROLL_REORDER: 500,
|
|
36
|
-
|
|
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
|