@vaadin/component-base 24.7.0-alpha1 → 24.7.0-alpha10
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 +5 -4
- package/src/browser-utils.js +1 -1
- package/src/controller-mixin.d.ts +1 -1
- package/src/controller-mixin.js +1 -1
- package/src/data-provider-controller/cache.d.ts +1 -1
- package/src/data-provider-controller/cache.js +1 -1
- package/src/data-provider-controller/data-provider-controller.d.ts +1 -1
- package/src/data-provider-controller/data-provider-controller.js +1 -1
- package/src/data-provider-controller/helpers.d.ts +1 -1
- package/src/data-provider-controller/helpers.js +1 -1
- package/src/define.d.ts +1 -1
- package/src/define.js +2 -2
- package/src/delegate-state-mixin.d.ts +1 -1
- package/src/delegate-state-mixin.js +1 -1
- package/src/dir-mixin.d.ts +1 -1
- package/src/dir-mixin.js +1 -1
- package/src/dir-utils.d.ts +1 -1
- package/src/dir-utils.js +1 -1
- package/src/dom-utils.d.ts +1 -1
- package/src/dom-utils.js +1 -1
- package/src/element-mixin.d.ts +1 -1
- package/src/element-mixin.js +1 -1
- package/src/gestures.js +0 -2
- package/src/i18n-mixin.d.ts +34 -0
- package/src/i18n-mixin.js +86 -0
- package/src/media-query-controller.d.ts +1 -1
- package/src/media-query-controller.js +1 -1
- package/src/overflow-controller.d.ts +1 -1
- package/src/overflow-controller.js +1 -1
- package/src/overlay-class-mixin.d.ts +1 -1
- package/src/overlay-class-mixin.js +1 -1
- package/src/path-utils.d.ts +1 -1
- package/src/path-utils.js +1 -1
- package/src/polylit-mixin.d.ts +1 -1
- package/src/polylit-mixin.js +32 -14
- package/src/resize-mixin.d.ts +1 -1
- package/src/resize-mixin.js +5 -1
- package/src/slot-child-observe-controller.d.ts +1 -1
- package/src/slot-child-observe-controller.js +1 -1
- package/src/slot-controller.d.ts +1 -1
- package/src/slot-controller.js +1 -1
- package/src/slot-observer.d.ts +1 -1
- package/src/slot-observer.js +1 -1
- package/src/slot-styles-mixin.d.ts +1 -1
- package/src/slot-styles-mixin.js +1 -1
- package/src/templates.js +1 -1
- package/src/tooltip-controller.d.ts +1 -1
- package/src/tooltip-controller.js +1 -1
- package/src/unique-id-utils.d.ts +1 -1
- package/src/unique-id-utils.js +1 -1
- package/src/url-utils.d.ts +1 -1
- package/src/url-utils.js +1 -1
- package/src/virtualizer-iron-list-adapter.js +15 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "24.7.0-
|
|
3
|
+
"version": "24.7.0-alpha10",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,9 +38,10 @@
|
|
|
38
38
|
"lit": "^3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@vaadin/chai-plugins": "24.7.0-
|
|
42
|
-
"@vaadin/
|
|
41
|
+
"@vaadin/chai-plugins": "24.7.0-alpha10",
|
|
42
|
+
"@vaadin/test-runner-commands": "24.7.0-alpha10",
|
|
43
|
+
"@vaadin/testing-helpers": "^1.1.0",
|
|
43
44
|
"sinon": "^18.0.0"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "c0f8933df2a6a40648d3fb9cfbae6bbf86a8aa90"
|
|
46
47
|
}
|
package/src/browser-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/controller-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import type { DataProviderCallback } from './data-provider-controller.js';
|
package/src/define.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
export interface CustomElementType extends CustomElementConstructor {
|
package/src/define.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
|
|
@@ -13,7 +13,7 @@ function dashToCamelCase(dash) {
|
|
|
13
13
|
|
|
14
14
|
const experimentalMap = {};
|
|
15
15
|
|
|
16
|
-
export function defineCustomElement(CustomElement, version = '24.7.0-
|
|
16
|
+
export function defineCustomElement(CustomElement, version = '24.7.0-alpha10') {
|
|
17
17
|
Object.defineProperty(CustomElement, 'version', {
|
|
18
18
|
get() {
|
|
19
19
|
return version;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
package/src/dir-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/dir-mixin.js
CHANGED
package/src/dir-utils.d.ts
CHANGED
package/src/dir-utils.js
CHANGED
package/src/dom-utils.d.ts
CHANGED
package/src/dom-utils.js
CHANGED
package/src/element-mixin.d.ts
CHANGED
package/src/element-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import { setCancelSyntheticClickEvents } from '@polymer/polymer/lib/utils/settings.js';
|
package/src/gestures.js
CHANGED
|
@@ -583,7 +583,6 @@ register({
|
|
|
583
583
|
return;
|
|
584
584
|
}
|
|
585
585
|
const t = _findOriginalTarget(e);
|
|
586
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
587
586
|
const self = this;
|
|
588
587
|
const movefn = (e) => {
|
|
589
588
|
if (!hasLeftMouseButton(e)) {
|
|
@@ -694,7 +693,6 @@ register({
|
|
|
694
693
|
return;
|
|
695
694
|
}
|
|
696
695
|
const t = _findOriginalTarget(e);
|
|
697
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
698
696
|
const self = this;
|
|
699
697
|
const movefn = (e) => {
|
|
700
698
|
const x = e.clientX,
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2025 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
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
|
+
/**
|
|
20
|
+
* A mixin that allows to set partial I18N properties.
|
|
21
|
+
*/
|
|
22
|
+
export declare function I18nMixin<I, T extends Constructor<HTMLElement>>(
|
|
23
|
+
defaultI18n: I,
|
|
24
|
+
superclass: T,
|
|
25
|
+
): Constructor<I18nMixinClass<I>> & T;
|
|
26
|
+
|
|
27
|
+
export declare class I18nMixinClass<I> {
|
|
28
|
+
/**
|
|
29
|
+
* The object used to localize this component. To change the default
|
|
30
|
+
* localization, replace this with an object that provides all properties, or
|
|
31
|
+
* just the individual properties you want to change.
|
|
32
|
+
*/
|
|
33
|
+
i18n: I;
|
|
34
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2025 - 2025 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
function deepMerge(target, ...sources) {
|
|
8
|
+
const isArray = (item) => Array.isArray(item);
|
|
9
|
+
const isObject = (item) => item && typeof item === 'object' && !isArray(item);
|
|
10
|
+
const merge = (target, source) => {
|
|
11
|
+
if (isObject(source) && isObject(target)) {
|
|
12
|
+
Object.keys(source).forEach((key) => {
|
|
13
|
+
const sourceValue = source[key];
|
|
14
|
+
if (isObject(sourceValue)) {
|
|
15
|
+
if (!target[key]) {
|
|
16
|
+
target[key] = {};
|
|
17
|
+
}
|
|
18
|
+
merge(target[key], sourceValue);
|
|
19
|
+
} else if (isArray(sourceValue)) {
|
|
20
|
+
target[key] = [...sourceValue];
|
|
21
|
+
} else if (sourceValue !== undefined && sourceValue !== null) {
|
|
22
|
+
target[key] = sourceValue;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
sources.forEach((source) => {
|
|
29
|
+
merge(target, source);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return target;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A mixin that allows to set partial I18N properties.
|
|
37
|
+
*
|
|
38
|
+
* @polymerMixin
|
|
39
|
+
*/
|
|
40
|
+
export const I18nMixin = (defaultI18n, superClass) =>
|
|
41
|
+
class I18nMixinClass extends superClass {
|
|
42
|
+
static get properties() {
|
|
43
|
+
return {
|
|
44
|
+
/** @private */
|
|
45
|
+
__effectiveI18n: {
|
|
46
|
+
type: Object,
|
|
47
|
+
sync: true,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
constructor() {
|
|
53
|
+
super();
|
|
54
|
+
|
|
55
|
+
this.i18n = deepMerge({}, defaultI18n);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The object used to localize this component. To change the default
|
|
60
|
+
* localization, replace this with an object that provides all properties, or
|
|
61
|
+
* just the individual properties you want to change.
|
|
62
|
+
*
|
|
63
|
+
* Should be overridden by subclasses to provide a custom JSDoc with the
|
|
64
|
+
* default I18N properties.
|
|
65
|
+
*
|
|
66
|
+
* @returns {Object}
|
|
67
|
+
*/
|
|
68
|
+
get i18n() {
|
|
69
|
+
return this.__customI18n;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The object used to localize this component. To change the default
|
|
74
|
+
* localization, replace this with an object that provides all properties, or
|
|
75
|
+
* just the individual properties you want to change.
|
|
76
|
+
*
|
|
77
|
+
* Should be overridden by subclasses to provide a custom JSDoc with the
|
|
78
|
+
* default I18N properties.
|
|
79
|
+
*
|
|
80
|
+
* @param {Object} value
|
|
81
|
+
*/
|
|
82
|
+
set i18n(value) {
|
|
83
|
+
this.__customI18n = value;
|
|
84
|
+
this.__effectiveI18n = deepMerge({}, defaultI18n, this.__customI18n);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2023 -
|
|
3
|
+
* Copyright (c) 2023 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/path-utils.d.ts
CHANGED
package/src/path-utils.js
CHANGED
package/src/polylit-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/polylit-mixin.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import { dedupeMixin } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import { notEqual } from 'lit';
|
|
7
8
|
import { get, set } from './path-utils.js';
|
|
8
9
|
|
|
9
10
|
const caseMap = {};
|
|
@@ -51,7 +52,7 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
if (options.reflectToAttribute) {
|
|
55
|
+
if (options && options.reflectToAttribute) {
|
|
55
56
|
options.reflect = true;
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -101,12 +102,15 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
101
102
|
get: defaultDescriptor.get,
|
|
102
103
|
set(value) {
|
|
103
104
|
const oldValue = this[name];
|
|
104
|
-
this[key] = value;
|
|
105
|
-
this.requestUpdate(name, oldValue, options);
|
|
106
105
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.
|
|
106
|
+
if (notEqual(value, oldValue)) {
|
|
107
|
+
this[key] = value;
|
|
108
|
+
this.requestUpdate(name, oldValue, options);
|
|
109
|
+
|
|
110
|
+
// Enforce synchronous update
|
|
111
|
+
if (this.hasUpdated) {
|
|
112
|
+
this.performUpdate();
|
|
113
|
+
}
|
|
110
114
|
}
|
|
111
115
|
},
|
|
112
116
|
configurable: true,
|
|
@@ -115,21 +119,17 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
if (options.readOnly) {
|
|
118
|
-
const setter =
|
|
122
|
+
const setter = result.set;
|
|
119
123
|
|
|
120
124
|
this.addCheckedInitializer((instance) => {
|
|
121
125
|
// This is run during construction of the element
|
|
122
126
|
instance[`_set${upper(name)}`] = function (value) {
|
|
123
127
|
setter.call(instance, value);
|
|
124
|
-
|
|
125
|
-
if (options.sync) {
|
|
126
|
-
this.performUpdate();
|
|
127
|
-
}
|
|
128
128
|
};
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
result = {
|
|
132
|
-
get:
|
|
132
|
+
get: result.get,
|
|
133
133
|
set() {
|
|
134
134
|
// Do nothing, property is read-only.
|
|
135
135
|
},
|
|
@@ -185,7 +185,7 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
185
185
|
this[name] = this[observer.method](...props);
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
this.getOrCreateMap('
|
|
188
|
+
this.getOrCreateMap('__computedObservers').set(assignComputedMethod, observer.observerProps);
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
if (!options.attribute) {
|
|
@@ -195,6 +195,12 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
195
195
|
return result;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
+
static get polylitConfig() {
|
|
199
|
+
return {
|
|
200
|
+
asyncFirstRender: false,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
198
204
|
constructor() {
|
|
199
205
|
super();
|
|
200
206
|
this.__hasPolylitMixin = true;
|
|
@@ -214,6 +220,11 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
214
220
|
parentHost.$ ||= {};
|
|
215
221
|
parentHost.$[this.id] = this;
|
|
216
222
|
}
|
|
223
|
+
|
|
224
|
+
const { polylitConfig } = this.constructor;
|
|
225
|
+
if (!this.hasUpdated && !polylitConfig.asyncFirstRender) {
|
|
226
|
+
this.performUpdate();
|
|
227
|
+
}
|
|
217
228
|
}
|
|
218
229
|
|
|
219
230
|
/** @protected */
|
|
@@ -234,6 +245,13 @@ const PolylitMixinImplementation = (superclass) => {
|
|
|
234
245
|
/** @protected */
|
|
235
246
|
ready() {}
|
|
236
247
|
|
|
248
|
+
/** @protected */
|
|
249
|
+
willUpdate(props) {
|
|
250
|
+
if (this.constructor.__computedObservers) {
|
|
251
|
+
this.__runComplexObservers(props, this.constructor.__computedObservers);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
237
255
|
/** @protected */
|
|
238
256
|
updated(props) {
|
|
239
257
|
const wasReadyInvoked = this.__isReadyInvoked;
|
package/src/resize-mixin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/resize-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
@@ -8,6 +8,10 @@ import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
|
|
8
8
|
const observer = new ResizeObserver((entries) => {
|
|
9
9
|
setTimeout(() => {
|
|
10
10
|
entries.forEach((entry) => {
|
|
11
|
+
if (!entry.target.isConnected) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
// Notify child resizables, if any
|
|
12
16
|
if (entry.target.resizables) {
|
|
13
17
|
entry.target.resizables.forEach((resizable) => {
|
package/src/slot-controller.d.ts
CHANGED
package/src/slot-controller.js
CHANGED
package/src/slot-observer.d.ts
CHANGED
package/src/slot-observer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
package/src/slot-styles-mixin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
6
|
import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
|
package/src/templates.js
CHANGED
package/src/unique-id-utils.d.ts
CHANGED
package/src/unique-id-utils.js
CHANGED
package/src/url-utils.d.ts
CHANGED
package/src/url-utils.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 -
|
|
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
|
-
/* eslint-disable @typescript-eslint/member-ordering */
|
|
7
|
-
// https://github.com/vaadin/eslint-config-vaadin/issues/33
|
|
8
6
|
import { animationFrame, microTask, timeOut } from './async.js';
|
|
9
7
|
import { isSafari } from './browser-utils.js';
|
|
10
8
|
import { Debouncer, flush } from './debounce.js';
|
|
@@ -52,6 +50,20 @@ export class IronListAdapter {
|
|
|
52
50
|
this.__resizeObserver.observe(this.scrollTarget);
|
|
53
51
|
this.scrollTarget.addEventListener('scroll', () => this._scrollHandler());
|
|
54
52
|
|
|
53
|
+
const attachObserver = new ResizeObserver(([{ contentRect }]) => {
|
|
54
|
+
const isHidden = contentRect.width === 0 && contentRect.height === 0;
|
|
55
|
+
if (!isHidden && this.__scrollTargetHidden && this.scrollTarget.scrollTop !== this._scrollPosition) {
|
|
56
|
+
// When removing element from DOM, its scroll position is lost and
|
|
57
|
+
// virtualizer doesn't re-render when adding it to the DOM again.
|
|
58
|
+
// Restore scroll position when the scroll target becomes visible,
|
|
59
|
+
// which is the case e.g. when virtualizer is used inside a dialog.
|
|
60
|
+
this.scrollTarget.scrollTop = this._scrollPosition;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.__scrollTargetHidden = isHidden;
|
|
64
|
+
});
|
|
65
|
+
attachObserver.observe(this.scrollTarget);
|
|
66
|
+
|
|
55
67
|
this._scrollLineHeight = this._getScrollLineHeight();
|
|
56
68
|
this.scrollTarget.addEventListener('wheel', (e) => this.__onWheel(e));
|
|
57
69
|
|