@vaadin/component-base 25.2.0-alpha10 → 25.2.0-alpha12
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/custom-elements.json +1 -4
- package/package.json +4 -4
- package/src/data-provider-controller/data-provider-controller.d.ts +1 -9
- package/src/define.js +1 -1
- package/src/delegate-state-mixin.js +0 -2
- package/src/dir-mixin.js +0 -2
- package/src/element-mixin.js +0 -4
- package/src/gestures.js +2 -2
- package/src/i18n-mixin.d.ts +1 -2
- package/src/i18n-mixin.js +21 -4
- package/src/overlay-class-mixin.js +0 -2
- package/src/resize-mixin.js +0 -2
- package/src/slot-observer.js +3 -3
- package/src/slot-styles-mixin.js +0 -2
- package/src/styles/style-props.js +1 -0
- package/src/tooltip-controller.d.ts +2 -0
- package/src/virtualizer-iron-list-adapter.js +13 -5
package/custom-elements.json
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"declarations": [
|
|
105
105
|
{
|
|
106
106
|
"kind": "mixin",
|
|
107
|
-
"description": "A mixin that allows to set partial I18N properties
|
|
107
|
+
"description": "A mixin that allows to set partial I18N properties.\n\nSubclasses provide their default values by overriding the\n`defaultI18n` static getter:\n\n```js\nstatic get defaultI18n() {\n return { foo: 'Foo', bar: 'Bar' };\n}\n```",
|
|
108
108
|
"name": "I18nMixin",
|
|
109
109
|
"members": [
|
|
110
110
|
{
|
|
@@ -129,9 +129,6 @@
|
|
|
129
129
|
}
|
|
130
130
|
],
|
|
131
131
|
"parameters": [
|
|
132
|
-
{
|
|
133
|
-
"name": "defaultI18n"
|
|
134
|
-
},
|
|
135
132
|
{
|
|
136
133
|
"name": "superClass"
|
|
137
134
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "25.2.0-
|
|
3
|
+
"version": "25.2.0-alpha12",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"lit": "^3.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@vaadin/chai-plugins": "25.2.0-
|
|
42
|
-
"@vaadin/test-runner-commands": "25.2.0-
|
|
41
|
+
"@vaadin/chai-plugins": "25.2.0-alpha12",
|
|
42
|
+
"@vaadin/test-runner-commands": "25.2.0-alpha12",
|
|
43
43
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
44
44
|
"sinon": "^21.0.2"
|
|
45
45
|
},
|
|
46
46
|
"customElements": "custom-elements.json",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ae1e4373aec3653d63a45b6be18eee36f4b245a1"
|
|
48
48
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2026 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import type { ReactiveController } from 'lit';
|
|
7
6
|
import type { Cache } from './cache.js';
|
|
8
7
|
import type { getFlatIndexByPath, getFlatIndexContext, getItemContext } from './helpers.js';
|
|
9
8
|
|
|
@@ -23,10 +22,7 @@ export type DataProvider<TItem, TDataProviderParams extends Record<string, unkno
|
|
|
23
22
|
/**
|
|
24
23
|
* A controller that stores and manages items loaded with a data provider.
|
|
25
24
|
*/
|
|
26
|
-
export class DataProviderController<
|
|
27
|
-
TItem,
|
|
28
|
-
TDataProviderParams extends Record<string, unknown>,
|
|
29
|
-
> implements ReactiveController {
|
|
25
|
+
export class DataProviderController<TItem, TDataProviderParams extends Record<string, unknown>> extends EventTarget {
|
|
30
26
|
/**
|
|
31
27
|
* The controller host element.
|
|
32
28
|
*/
|
|
@@ -94,10 +90,6 @@ export class DataProviderController<
|
|
|
94
90
|
*/
|
|
95
91
|
get flatSize(): number;
|
|
96
92
|
|
|
97
|
-
hostConnected(): void;
|
|
98
|
-
|
|
99
|
-
hostDisconnected(): void;
|
|
100
|
-
|
|
101
93
|
/**
|
|
102
94
|
* Whether the root cache or any of its decendant caches have pending requests.
|
|
103
95
|
*/
|
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.2.0-
|
|
16
|
+
export function defineCustomElement(CustomElement, version = '25.2.0-alpha12') {
|
|
17
17
|
Object.defineProperty(CustomElement, 'version', {
|
|
18
18
|
get() {
|
|
19
19
|
return version;
|
|
@@ -7,8 +7,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
|
-
*
|
|
11
|
-
* @polymerMixin
|
|
12
10
|
*/
|
|
13
11
|
const DelegateStateMixinImplementation = (superclass) => {
|
|
14
12
|
return class DelegateStateMixinClass extends superclass {
|
package/src/dir-mixin.js
CHANGED
|
@@ -33,8 +33,6 @@ directionObserver.observe(document.documentElement, { attributes: true, attribut
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* A mixin to handle `dir` attribute based on the one set on the `<html>` element.
|
|
36
|
-
*
|
|
37
|
-
* @polymerMixin
|
|
38
36
|
*/
|
|
39
37
|
export const DirMixin = (superClass) =>
|
|
40
38
|
class VaadinDirMixin extends superClass {
|
package/src/element-mixin.js
CHANGED
package/src/gestures.js
CHANGED
|
@@ -121,7 +121,7 @@ function hasLeftMouseButton(ev) {
|
|
|
121
121
|
// instead we use ev.buttons (bitmask of buttons) or fall back to ev.which (deprecated, 0 for no buttons, 1 for left button)
|
|
122
122
|
if (type === 'mousemove') {
|
|
123
123
|
// Allow undefined for testing events
|
|
124
|
-
let buttons = ev.buttons
|
|
124
|
+
let buttons = ev.buttons ?? 1;
|
|
125
125
|
if (ev instanceof window.MouseEvent && !MOUSE_HAS_BUTTONS) {
|
|
126
126
|
buttons = MOUSE_WHICH_TO_BUTTONS[ev.which] || 0;
|
|
127
127
|
}
|
|
@@ -129,7 +129,7 @@ function hasLeftMouseButton(ev) {
|
|
|
129
129
|
return Boolean(buttons & 1);
|
|
130
130
|
}
|
|
131
131
|
// Allow undefined for testing events
|
|
132
|
-
const button = ev.button
|
|
132
|
+
const button = ev.button ?? 0;
|
|
133
133
|
// Ev.button is 0 in mousedown/mouseup/click for left button activation
|
|
134
134
|
return button === 0;
|
|
135
135
|
}
|
package/src/i18n-mixin.d.ts
CHANGED
|
@@ -8,8 +8,7 @@ import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
|
8
8
|
/**
|
|
9
9
|
* A mixin that allows to set partial I18N properties.
|
|
10
10
|
*/
|
|
11
|
-
export declare function I18nMixin<
|
|
12
|
-
defaultI18n: I,
|
|
11
|
+
export declare function I18nMixin<T extends Constructor<HTMLElement>, I = unknown>(
|
|
13
12
|
superclass: T,
|
|
14
13
|
): Constructor<I18nMixinClass<I>> & T;
|
|
15
14
|
|
package/src/i18n-mixin.js
CHANGED
|
@@ -35,9 +35,16 @@ function deepMerge(target, ...sources) {
|
|
|
35
35
|
/**
|
|
36
36
|
* A mixin that allows to set partial I18N properties.
|
|
37
37
|
*
|
|
38
|
-
*
|
|
38
|
+
* Subclasses provide their default values by overriding the
|
|
39
|
+
* `defaultI18n` static getter:
|
|
40
|
+
*
|
|
41
|
+
* ```js
|
|
42
|
+
* static get defaultI18n() {
|
|
43
|
+
* return { foo: 'Foo', bar: 'Bar' };
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
39
46
|
*/
|
|
40
|
-
export const I18nMixin = (
|
|
47
|
+
export const I18nMixin = (superClass) =>
|
|
41
48
|
class I18nMixinClass extends superClass {
|
|
42
49
|
static get properties() {
|
|
43
50
|
return {
|
|
@@ -55,10 +62,20 @@ export const I18nMixin = (defaultI18n, superClass) =>
|
|
|
55
62
|
};
|
|
56
63
|
}
|
|
57
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Default I18N values. Must be overridden by subclasses with actual defaults.
|
|
67
|
+
*
|
|
68
|
+
* @protected
|
|
69
|
+
* @return {Object}
|
|
70
|
+
*/
|
|
71
|
+
static get defaultI18n() {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
|
|
58
75
|
constructor() {
|
|
59
76
|
super();
|
|
60
77
|
|
|
61
|
-
this.i18n = deepMerge({}, defaultI18n);
|
|
78
|
+
this.i18n = deepMerge({}, this.constructor.defaultI18n);
|
|
62
79
|
}
|
|
63
80
|
|
|
64
81
|
/**
|
|
@@ -80,6 +97,6 @@ export const I18nMixin = (defaultI18n, superClass) =>
|
|
|
80
97
|
return;
|
|
81
98
|
}
|
|
82
99
|
this.__customI18n = value;
|
|
83
|
-
this.__effectiveI18n = deepMerge({}, defaultI18n, this.__customI18n);
|
|
100
|
+
this.__effectiveI18n = deepMerge({}, this.constructor.defaultI18n, this.__customI18n);
|
|
84
101
|
}
|
|
85
102
|
};
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
/**
|
|
8
8
|
* A mixin that forwards CSS class names to the internal overlay element
|
|
9
9
|
* by setting the `overlayClass` property or `overlay-class` attribute.
|
|
10
|
-
*
|
|
11
|
-
* @polymerMixin
|
|
12
10
|
*/
|
|
13
11
|
export const OverlayClassMixin = (superclass) =>
|
|
14
12
|
class OverlayClassMixinClass extends superclass {
|
package/src/resize-mixin.js
CHANGED
|
@@ -26,8 +26,6 @@ const observer = new ResizeObserver((entries) => {
|
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* A mixin that uses a ResizeObserver to listen to host size changes.
|
|
29
|
-
*
|
|
30
|
-
* @polymerMixin
|
|
31
29
|
*/
|
|
32
30
|
const ResizeMixinImplementation = (superclass) =>
|
|
33
31
|
class ResizeMixinClass extends superclass {
|
package/src/slot-observer.js
CHANGED
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export class SlotObserver {
|
|
11
11
|
constructor(slot, callback, forceInitial) {
|
|
12
|
-
/** @type HTMLSlotElement */
|
|
12
|
+
/** @type {HTMLSlotElement} */
|
|
13
13
|
this.slot = slot;
|
|
14
14
|
|
|
15
|
-
/** @type Function */
|
|
15
|
+
/** @type {Function} */
|
|
16
16
|
this.callback = callback;
|
|
17
17
|
|
|
18
|
-
/** @type boolean */
|
|
18
|
+
/** @type {boolean} */
|
|
19
19
|
this.forceInitial = forceInitial;
|
|
20
20
|
|
|
21
21
|
/** @type {Node[]} */
|
package/src/slot-styles-mixin.js
CHANGED
|
@@ -39,8 +39,6 @@ function insertStyles(styles, root) {
|
|
|
39
39
|
/**
|
|
40
40
|
* Mixin to insert styles into the outer scope to handle slotted components.
|
|
41
41
|
* This is useful e.g. to hide native `<input type="number">` controls.
|
|
42
|
-
*
|
|
43
|
-
* @polymerMixin
|
|
44
42
|
*/
|
|
45
43
|
const SlotStylesMixinImplementation = (superclass) =>
|
|
46
44
|
class SlotStylesMixinClass extends superclass {
|
|
@@ -86,6 +86,7 @@ addGlobalStyles(
|
|
|
86
86
|
--_vaadin-icon-calendar: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/></svg>');
|
|
87
87
|
--_vaadin-icon-checkmark: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="m4.5 12.75 6 6 9-13.5" /></svg>');
|
|
88
88
|
--_vaadin-icon-chevron-down: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>');
|
|
89
|
+
--_vaadin-icon-chevron-right: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>');
|
|
89
90
|
--_vaadin-icon-clock: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 6v6l4 2"/><circle cx="12" cy="12" r="10"/></svg>');
|
|
90
91
|
--_vaadin-icon-cross: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18 18 6M6 6l12 12" /></svg>');
|
|
91
92
|
--_vaadin-icon-drag: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><path d="M11 7c0 .82843-.6716 1.5-1.5 1.5C8.67157 8.5 8 7.82843 8 7s.67157-1.5 1.5-1.5c.8284 0 1.5.67157 1.5 1.5Zm0 5c0 .8284-.6716 1.5-1.5 1.5-.82843 0-1.5-.6716-1.5-1.5s.67157-1.5 1.5-1.5c.8284 0 1.5.6716 1.5 1.5Zm0 5c0 .8284-.6716 1.5-1.5 1.5-.82843 0-1.5-.6716-1.5-1.5s.67157-1.5 1.5-1.5c.8284 0 1.5.6716 1.5 1.5Zm5-10c0 .82843-.6716 1.5-1.5 1.5S13 7.82843 13 7s.6716-1.5 1.5-1.5S16 6.17157 16 7Zm0 5c0 .8284-.6716 1.5-1.5 1.5S13 12.8284 13 12s.6716-1.5 1.5-1.5 1.5.6716 1.5 1.5Zm0 5c0 .8284-.6716 1.5-1.5 1.5S13 17.8284 13 17s.6716-1.5 1.5-1.5 1.5.6716 1.5 1.5Z" fill="currentColor"/></svg>');
|
|
@@ -23,6 +23,8 @@ type TooltipPosition =
|
|
|
23
23
|
* A controller that manages the slotted tooltip element.
|
|
24
24
|
*/
|
|
25
25
|
export class TooltipController extends SlotController {
|
|
26
|
+
constructor(host: HTMLElement);
|
|
27
|
+
|
|
26
28
|
/**
|
|
27
29
|
* An HTML element for linking with the tooltip overlay
|
|
28
30
|
* via `aria-describedby` attribute used by screen readers.
|
|
@@ -515,11 +515,19 @@ export class IronListAdapter {
|
|
|
515
515
|
|
|
516
516
|
/** @private */
|
|
517
517
|
__getFocusedElement(visibleElements = this.__getVisibleElements()) {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
518
|
+
// `document.activeElement` retargets to the outermost shadow host when
|
|
519
|
+
// focus lives in a nested shadow tree. Descend through nested shadow
|
|
520
|
+
// roots' `activeElement`s to reach the real focused node, then walk up
|
|
521
|
+
// the flattened tree (via `assignedSlot`/`parentNode`/`host`) until a
|
|
522
|
+
// visible row is reached.
|
|
523
|
+
let node = document.activeElement;
|
|
524
|
+
while (node?.shadowRoot?.activeElement) {
|
|
525
|
+
node = node.shadowRoot.activeElement;
|
|
526
|
+
}
|
|
527
|
+
while (node && !visibleElements.includes(node)) {
|
|
528
|
+
node = node.assignedSlot || node.parentNode || node.host;
|
|
529
|
+
}
|
|
530
|
+
return node;
|
|
523
531
|
}
|
|
524
532
|
|
|
525
533
|
/** @private */
|