@vaadin/component-base 23.1.2 → 23.2.0-alpha3
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_typings/vaadin.d.ts +0 -1
- package/package.json +2 -2
- package/src/active-mixin.d.ts +3 -3
- package/src/controller-mixin.d.ts +2 -2
- package/src/debounce.d.ts +1 -1
- package/src/dir-mixin.d.ts +1 -1
- package/src/disabled-mixin.d.ts +1 -1
- package/src/element-mixin.d.ts +2 -2
- package/src/element-mixin.js +1 -1
- package/src/focus-mixin.d.ts +1 -1
- package/src/focus-trap-controller.d.ts +1 -1
- package/src/keyboard-mixin.d.ts +1 -1
- package/src/media-query-controller.d.ts +1 -1
- package/src/polylit-mixin.d.ts +2 -2
- package/src/polylit-mixin.js +2 -1
- package/src/resize-mixin.d.ts +1 -1
- package/src/slot-controller.d.ts +1 -1
- package/src/slot-controller.js +2 -9
- package/src/slot-mixin.d.ts +1 -1
- package/src/tabindex-mixin.d.ts +2 -2
- package/src/unique-id-utils.d.ts +15 -0
- package/src/unique-id-utils.js +26 -0
- package/src/virtualizer-iron-list-adapter.js +15 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/component-base",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.2.0-alpha3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
43
43
|
"sinon": "^13.0.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "06e5875be93ca50da2846dafc65a8531010c0576"
|
|
46
46
|
}
|
package/src/active-mixin.d.ts
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import { DisabledMixinClass } from './disabled-mixin.js';
|
|
8
|
-
import { KeyboardMixinClass } from './keyboard-mixin.js';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { DisabledMixinClass } from './disabled-mixin.js';
|
|
8
|
+
import type { KeyboardMixinClass } from './keyboard-mixin.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A mixin to toggle the `active` attribute.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A mixin for connecting controllers to the element.
|
package/src/debounce.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Code distributed by Google as part of the polymer project is also
|
|
8
8
|
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
9
9
|
*/
|
|
10
|
-
import { AsyncInterface } from './async.js';
|
|
10
|
+
import type { AsyncInterface } from './async.js';
|
|
11
11
|
|
|
12
12
|
export declare class Debouncer {
|
|
13
13
|
/**
|
package/src/dir-mixin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A mixin to handle `dir` attribute based on the one set on the `<html>` element.
|
package/src/disabled-mixin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A mixin to provide disabled property for field components.
|
package/src/element-mixin.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import '../custom_typings/vaadin-usage-statistics.js';
|
|
7
7
|
import '../custom_typings/vaadin.js';
|
|
8
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
9
|
-
import { DirMixinClass } from './dir-mixin.js';
|
|
8
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
9
|
+
import type { DirMixinClass } from './dir-mixin.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A mixin providing common logic for Vaadin components.
|
package/src/element-mixin.js
CHANGED
package/src/focus-mixin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A mixin to handle `focused` and `focus-ring` attributes based on focus.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { ReactiveController } from 'lit';
|
|
6
|
+
import type { ReactiveController } from 'lit';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A controller for trapping focus within a DOM node.
|
package/src/keyboard-mixin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A mixin that manages keyboard handling.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { ReactiveController } from 'lit';
|
|
6
|
+
import type { ReactiveController } from 'lit';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A controller for listening on media query changes.
|
package/src/polylit-mixin.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import { LitElement } from 'lit';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { LitElement } from 'lit';
|
|
8
8
|
|
|
9
9
|
export declare function PolylitMixin<T extends Constructor<LitElement>>(base: T): T & Constructor<PolylitMixinClass>;
|
|
10
10
|
|
package/src/polylit-mixin.js
CHANGED
|
@@ -10,7 +10,8 @@ const caseMap = {};
|
|
|
10
10
|
const CAMEL_TO_DASH = /([A-Z])/g;
|
|
11
11
|
|
|
12
12
|
function camelToDash(camel) {
|
|
13
|
-
|
|
13
|
+
caseMap[camel] = caseMap[camel] || camel.replace(CAMEL_TO_DASH, '-$1').toLowerCase();
|
|
14
|
+
return caseMap[camel];
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
function upper(name) {
|
package/src/resize-mixin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A mixin that uses a ResizeObserver to listen to host size changes.
|
package/src/slot-controller.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { ReactiveController } from 'lit';
|
|
6
|
+
import type { ReactiveController } from 'lit';
|
|
7
7
|
|
|
8
8
|
export class SlotController extends EventTarget implements ReactiveController {
|
|
9
9
|
/**
|
package/src/slot-controller.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js';
|
|
7
6
|
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js';
|
|
7
|
+
import { generateUniqueId } from './unique-id-utils.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A controller for providing content to slot element and observing changes.
|
|
@@ -20,14 +20,7 @@ export class SlotController extends EventTarget {
|
|
|
20
20
|
*/
|
|
21
21
|
static generateId(slotName, host) {
|
|
22
22
|
const prefix = slotName || 'default';
|
|
23
|
-
|
|
24
|
-
// Support dash-case slot names e.g. "error-message"
|
|
25
|
-
const field = `${dashToCamelCase(prefix)}Id`;
|
|
26
|
-
|
|
27
|
-
// Maintain the unique ID counter for a given prefix.
|
|
28
|
-
this[field] = 1 + this[field] || 0;
|
|
29
|
-
|
|
30
|
-
return `${prefix}-${host.localName}-${this[field]}`;
|
|
23
|
+
return `${prefix}-${host.localName}-${generateUniqueId()}`;
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
constructor(host, slotName, slotFactory, slotInitializer) {
|
package/src/slot-mixin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A mixin to provide content for named slots defined by component.
|
package/src/tabindex-mixin.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import { DisabledMixinClass } from './disabled-mixin.js';
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { DisabledMixinClass } from './disabled-mixin.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A mixin to toggle the `tabindex` attribute.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Resets the unique id counter.
|
|
9
|
+
*/
|
|
10
|
+
export function resetUniqueId(): void;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Returns a unique integer id.
|
|
14
|
+
*/
|
|
15
|
+
export function generateUniqueId(): number;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
let uniqueId = 0;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Resets the unique id counter.
|
|
11
|
+
*
|
|
12
|
+
* @return {void}
|
|
13
|
+
*/
|
|
14
|
+
export function resetUniqueId() {
|
|
15
|
+
uniqueId = 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Returns a unique integer id.
|
|
20
|
+
*
|
|
21
|
+
* @return {number}
|
|
22
|
+
*/
|
|
23
|
+
export function generateUniqueId() {
|
|
24
|
+
// eslint-disable-next-line no-plusplus
|
|
25
|
+
return uniqueId++;
|
|
26
|
+
}
|
|
@@ -55,7 +55,9 @@ export class IronListAdapter {
|
|
|
55
55
|
if (this.reorderElements) {
|
|
56
56
|
// Reordering the physical elements cancels the user's grab of the scroll bar handle on Safari.
|
|
57
57
|
// Need to defer reordering until the user lets go of the scroll bar handle.
|
|
58
|
-
this.scrollTarget.addEventListener('mousedown', () =>
|
|
58
|
+
this.scrollTarget.addEventListener('mousedown', () => {
|
|
59
|
+
this.__mouseDown = true;
|
|
60
|
+
});
|
|
59
61
|
this.scrollTarget.addEventListener('mouseup', () => {
|
|
60
62
|
this.__mouseDown = false;
|
|
61
63
|
if (this.__pendingReorder) {
|
|
@@ -298,7 +300,9 @@ export class IronListAdapter {
|
|
|
298
300
|
/** @private */
|
|
299
301
|
_isClientFull() {
|
|
300
302
|
// Workaround an issue in iron-list that can cause it to freeze on fast scroll
|
|
301
|
-
setTimeout(() =>
|
|
303
|
+
setTimeout(() => {
|
|
304
|
+
this.__clientFull = true;
|
|
305
|
+
});
|
|
302
306
|
return this.__clientFull || super._isClientFull();
|
|
303
307
|
}
|
|
304
308
|
|
|
@@ -378,7 +382,9 @@ export class IronListAdapter {
|
|
|
378
382
|
this.__debouncerWheelAnimationFrame = Debouncer.debounce(
|
|
379
383
|
this.__debouncerWheelAnimationFrame,
|
|
380
384
|
animationFrame,
|
|
381
|
-
() =>
|
|
385
|
+
() => {
|
|
386
|
+
this._wheelAnimationFrame = false;
|
|
387
|
+
},
|
|
382
388
|
);
|
|
383
389
|
|
|
384
390
|
const momentum = Math.abs(e.deltaX) + Math.abs(deltaY);
|
|
@@ -394,7 +400,9 @@ export class IronListAdapter {
|
|
|
394
400
|
this._debouncerIgnoreNewWheel = Debouncer.debounce(
|
|
395
401
|
this._debouncerIgnoreNewWheel,
|
|
396
402
|
timeOut.after(this.timeouts.IGNORE_WHEEL),
|
|
397
|
-
() =>
|
|
403
|
+
() => {
|
|
404
|
+
this._ignoreNewWheel = false;
|
|
405
|
+
},
|
|
398
406
|
);
|
|
399
407
|
} else if ((this._hasResidualMomentum && momentum <= this._previousMomentum) || this._ignoreNewWheel) {
|
|
400
408
|
e.preventDefault();
|
|
@@ -494,7 +502,9 @@ export class IronListAdapter {
|
|
|
494
502
|
if (isSafari) {
|
|
495
503
|
const { transform } = this.scrollTarget.style;
|
|
496
504
|
this.scrollTarget.style.transform = 'translateZ(0)';
|
|
497
|
-
setTimeout(() =>
|
|
505
|
+
setTimeout(() => {
|
|
506
|
+
this.scrollTarget.style.transform = transform;
|
|
507
|
+
});
|
|
498
508
|
}
|
|
499
509
|
}
|
|
500
510
|
|