@vaadin/component-base 24.8.0-alpha2 → 24.8.0-alpha20
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 -5
- package/src/controller-mixin.js +2 -2
- package/src/define.js +1 -1
- package/src/delegate-state-mixin.js +2 -2
- package/src/i18n-mixin.d.ts +0 -11
- package/src/i18n-mixin.js +13 -0
- package/src/polylit-mixin.js +14 -0
- package/src/resize-mixin.js +2 -2
- package/src/slot-styles-mixin.js +3 -3
- package/src/virtualizer-iron-list-adapter.js +10 -0
- package/src/virtualizer.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "24.8.0-
|
|
3
|
+
"version": "24.8.0-alpha20",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"custom_typings",
|
|
24
24
|
"index.d.ts",
|
|
25
25
|
"index.js",
|
|
26
|
-
"src"
|
|
26
|
+
"src",
|
|
27
|
+
"!src/style-props.js"
|
|
27
28
|
],
|
|
28
29
|
"keywords": [
|
|
29
30
|
"Vaadin",
|
|
@@ -38,10 +39,10 @@
|
|
|
38
39
|
"lit": "^3.0.0"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@vaadin/chai-plugins": "24.8.0-
|
|
42
|
-
"@vaadin/test-runner-commands": "24.8.0-
|
|
42
|
+
"@vaadin/chai-plugins": "24.8.0-alpha20",
|
|
43
|
+
"@vaadin/test-runner-commands": "24.8.0-alpha20",
|
|
43
44
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
44
45
|
"sinon": "^18.0.0"
|
|
45
46
|
},
|
|
46
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "f091548b1f079f0c9de4be2a8ded77fb18671a2e"
|
|
47
48
|
}
|
package/src/controller-mixin.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef ReactiveController
|
|
@@ -15,7 +15,7 @@ import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
|
15
15
|
*
|
|
16
16
|
* @polymerMixin
|
|
17
17
|
*/
|
|
18
|
-
export const ControllerMixin =
|
|
18
|
+
export const ControllerMixin = dedupeMixin((superClass) => {
|
|
19
19
|
// If the superclass extends from LitElement,
|
|
20
20
|
// use its own controllers implementation.
|
|
21
21
|
if (typeof superClass.prototype.addController === 'function') {
|
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 = '24.8.0-
|
|
16
|
+
export function defineCustomElement(CustomElement, version = '24.8.0-alpha20') {
|
|
17
17
|
Object.defineProperty(CustomElement, 'version', {
|
|
18
18
|
get() {
|
|
19
19
|
return version;
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A mixin to delegate properties and attributes to a target element.
|
|
10
10
|
*
|
|
11
11
|
* @polymerMixin
|
|
12
12
|
*/
|
|
13
|
-
export const DelegateStateMixin =
|
|
13
|
+
export const DelegateStateMixin = dedupeMixin(
|
|
14
14
|
(superclass) =>
|
|
15
15
|
class DelegateStateMixinClass extends superclass {
|
|
16
16
|
static get properties() {
|
package/src/i18n-mixin.d.ts
CHANGED
|
@@ -5,17 +5,6 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Recursively makes all properties of an i18n object optional.
|
|
10
|
-
*
|
|
11
|
-
* For internal use only.
|
|
12
|
-
*/
|
|
13
|
-
export type PartialI18n<T> = T extends object
|
|
14
|
-
? {
|
|
15
|
-
[P in keyof T]?: PartialI18n<T[P]>;
|
|
16
|
-
}
|
|
17
|
-
: T;
|
|
18
|
-
|
|
19
8
|
/**
|
|
20
9
|
* A mixin that allows to set partial I18N properties.
|
|
21
10
|
*/
|
package/src/i18n-mixin.js
CHANGED
|
@@ -41,6 +41,16 @@ export const I18nMixin = (defaultI18n, superClass) =>
|
|
|
41
41
|
class I18nMixinClass extends superClass {
|
|
42
42
|
static get properties() {
|
|
43
43
|
return {
|
|
44
|
+
/** @private */
|
|
45
|
+
// Technically declaring a Polymer property is not needed, as we have a
|
|
46
|
+
// getter/setter for it below. However, the React components currently
|
|
47
|
+
// rely on the Polymer property declaration to detect which properties
|
|
48
|
+
// are available on a custom element, so we add a dummy declaration for
|
|
49
|
+
// it.
|
|
50
|
+
i18n: {
|
|
51
|
+
type: Object,
|
|
52
|
+
},
|
|
53
|
+
|
|
44
54
|
/** @private */
|
|
45
55
|
__effectiveI18n: {
|
|
46
56
|
type: Object,
|
|
@@ -80,6 +90,9 @@ export const I18nMixin = (defaultI18n, superClass) =>
|
|
|
80
90
|
* @param {Object} value
|
|
81
91
|
*/
|
|
82
92
|
set i18n(value) {
|
|
93
|
+
if (value === this.__customI18n) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
83
96
|
this.__customI18n = value;
|
|
84
97
|
this.__effectiveI18n = deepMerge({}, defaultI18n, this.__customI18n);
|
|
85
98
|
}
|
package/src/polylit-mixin.js
CHANGED
|
@@ -45,6 +45,13 @@ function getOrCreateMap(obj, name) {
|
|
|
45
45
|
|
|
46
46
|
const PolylitMixinImplementation = (superclass) => {
|
|
47
47
|
class PolylitMixinClass extends superclass {
|
|
48
|
+
// PolylitMixin, and components using it, force synchronous updates
|
|
49
|
+
// in connectedCallback and for properties that are configured to
|
|
50
|
+
// be sync. This causes Lit's `change-in-update` warning to be
|
|
51
|
+
// logged for almost every component when Lit runs in development
|
|
52
|
+
// mode. Since we intentionally force updates, disable the warning.
|
|
53
|
+
static enabledWarnings = [];
|
|
54
|
+
|
|
48
55
|
static createProperty(name, options) {
|
|
49
56
|
if ([String, Boolean, Number, Array].includes(options)) {
|
|
50
57
|
options = {
|
|
@@ -68,6 +75,13 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
68
75
|
* @override
|
|
69
76
|
*/
|
|
70
77
|
static finalize() {
|
|
78
|
+
// Suppress warnings about deprecated overriding ReactiveElement methods
|
|
79
|
+
// as the mixin requires those. See https://github.com/lit/lit/pull/4901
|
|
80
|
+
if (window.litIssuedWarnings) {
|
|
81
|
+
window.litIssuedWarnings.add('no-override-create-property');
|
|
82
|
+
window.litIssuedWarnings.add('no-override-get-property-descriptor');
|
|
83
|
+
}
|
|
84
|
+
|
|
71
85
|
super.finalize();
|
|
72
86
|
|
|
73
87
|
if (Array.isArray(this.observers)) {
|
package/src/resize-mixin.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
const observer = new ResizeObserver((entries) => {
|
|
9
9
|
setTimeout(() => {
|
|
@@ -29,7 +29,7 @@ const observer = new ResizeObserver((entries) => {
|
|
|
29
29
|
*
|
|
30
30
|
* @polymerMixin
|
|
31
31
|
*/
|
|
32
|
-
export const ResizeMixin =
|
|
32
|
+
export const ResizeMixin = dedupeMixin(
|
|
33
33
|
(superclass) =>
|
|
34
34
|
class ResizeMixinClass extends superclass {
|
|
35
35
|
/**
|
package/src/slot-styles-mixin.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
const stylesMap = new WeakMap();
|
|
9
9
|
|
|
@@ -42,7 +42,7 @@ function insertStyles(styles, root) {
|
|
|
42
42
|
*
|
|
43
43
|
* @polymerMixin
|
|
44
44
|
*/
|
|
45
|
-
export const SlotStylesMixin =
|
|
45
|
+
export const SlotStylesMixin = dedupeMixin(
|
|
46
46
|
(superclass) =>
|
|
47
47
|
class SlotStylesMixinClass extends superclass {
|
|
48
48
|
/**
|
|
@@ -50,7 +50,7 @@ export const SlotStylesMixin = dedupingMixin(
|
|
|
50
50
|
* @protected
|
|
51
51
|
*/
|
|
52
52
|
get slotStyles() {
|
|
53
|
-
return
|
|
53
|
+
return [];
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/** @protected */
|
|
@@ -178,6 +178,16 @@ export class IronListAdapter {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
hostConnected() {
|
|
182
|
+
// Restore scroll position, which is reset when host is removed from DOM,
|
|
183
|
+
// since virtualizer doesn't re-render when adding it to the DOM again.
|
|
184
|
+
// If the scroll target isn't visible and its `offsetParent` is `null`, wait
|
|
185
|
+
// for the ResizeObserver to handle this case (hiding -> moving -> showing).
|
|
186
|
+
if (this.scrollTarget.offsetParent && this.scrollTarget.scrollTop !== this._scrollPosition) {
|
|
187
|
+
this.scrollTarget.scrollTop = this._scrollPosition;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
181
191
|
update(startIndex = 0, endIndex = this.size - 1) {
|
|
182
192
|
const updatedElements = [];
|
|
183
193
|
this.__getVisibleElements().forEach((el) => {
|
package/src/virtualizer.js
CHANGED
|
@@ -80,4 +80,13 @@ export class Virtualizer {
|
|
|
80
80
|
flush() {
|
|
81
81
|
this.__adapter.flush();
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Notifies the virtualizer about its host element connected to the DOM.
|
|
86
|
+
*
|
|
87
|
+
* @method hostConnected
|
|
88
|
+
*/
|
|
89
|
+
hostConnected() {
|
|
90
|
+
this.__adapter.hostConnected();
|
|
91
|
+
}
|
|
83
92
|
}
|