@vaadin/component-base 23.2.16 → 23.2.18

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.
Files changed (70) hide show
  1. package/custom_typings/vaadin-usage-statistics.d.ts +2 -2
  2. package/index.d.ts +1 -0
  3. package/index.js +1 -0
  4. package/package.json +3 -3
  5. package/src/a11y-announcer.d.ts +1 -1
  6. package/src/a11y-announcer.js +1 -1
  7. package/src/active-mixin.d.ts +1 -1
  8. package/src/active-mixin.js +1 -1
  9. package/src/async.d.ts +0 -3
  10. package/src/async.js +1 -2
  11. package/src/browser-utils.js +7 -7
  12. package/src/controller-mixin.d.ts +1 -1
  13. package/src/controller-mixin.js +1 -1
  14. package/src/debounce.js +2 -2
  15. package/src/dir-helper.d.ts +42 -0
  16. package/src/dir-helper.js +93 -0
  17. package/src/dir-mixin.d.ts +4 -2
  18. package/src/dir-mixin.js +39 -17
  19. package/src/disabled-mixin.d.ts +1 -1
  20. package/src/disabled-mixin.js +1 -1
  21. package/src/dom-utils.d.ts +1 -6
  22. package/src/dom-utils.js +1 -11
  23. package/src/element-mixin.d.ts +1 -1
  24. package/src/element-mixin.js +5 -11
  25. package/src/focus-mixin.d.ts +1 -1
  26. package/src/focus-mixin.js +2 -2
  27. package/src/focus-trap-controller.d.ts +1 -1
  28. package/src/focus-trap-controller.js +22 -22
  29. package/src/focus-utils.d.ts +1 -1
  30. package/src/focus-utils.js +57 -57
  31. package/src/gestures.d.ts +12 -6
  32. package/src/gestures.js +4 -6
  33. package/src/iron-list-core.js +11 -21
  34. package/src/keyboard-mixin.d.ts +1 -1
  35. package/src/keyboard-mixin.js +1 -1
  36. package/src/media-query-controller.d.ts +1 -1
  37. package/src/media-query-controller.js +1 -1
  38. package/src/overflow-controller.d.ts +1 -1
  39. package/src/overflow-controller.js +3 -3
  40. package/src/polylit-mixin.d.ts +3 -3
  41. package/src/polylit-mixin.js +4 -9
  42. package/src/resize-mixin.d.ts +1 -1
  43. package/src/resize-mixin.js +21 -11
  44. package/src/slot-controller.d.ts +5 -33
  45. package/src/slot-controller.js +40 -103
  46. package/src/slot-mixin.d.ts +18 -0
  47. package/src/slot-mixin.js +60 -0
  48. package/src/tabindex-mixin.d.ts +1 -1
  49. package/src/tabindex-mixin.js +1 -1
  50. package/src/templates.js +1 -1
  51. package/src/unique-id-utils.d.ts +1 -1
  52. package/src/unique-id-utils.js +1 -1
  53. package/src/virtualizer-iron-list-adapter.js +2 -6
  54. package/src/virtualizer.js +18 -18
  55. package/src/delegate-focus-mixin.d.ts +0 -48
  56. package/src/delegate-focus-mixin.js +0 -228
  57. package/src/delegate-state-mixin.d.ts +0 -20
  58. package/src/delegate-state-mixin.js +0 -125
  59. package/src/dir-utils.d.ts +0 -19
  60. package/src/dir-utils.js +0 -36
  61. package/src/keyboard-direction-mixin.d.ts +0 -41
  62. package/src/keyboard-direction-mixin.js +0 -192
  63. package/src/list-mixin.d.ts +0 -57
  64. package/src/list-mixin.js +0 -354
  65. package/src/overlay-class-mixin.d.ts +0 -33
  66. package/src/overlay-class-mixin.js +0 -79
  67. package/src/slot-child-observe-controller.d.ts +0 -28
  68. package/src/slot-child-observe-controller.js +0 -176
  69. package/src/tooltip-controller.d.ts +0 -86
  70. package/src/tooltip-controller.js +0 -130
@@ -1,5 +1,5 @@
1
1
  declare module '@vaadin/vaadin-usage-statistics/vaadin-usage-statistics.js' {
2
- function usageStatistics(): void;
3
-
4
2
  export { usageStatistics };
3
+
4
+ function usageStatistics(): void;
5
5
  }
package/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export { FocusTrapController } from './src/focus-trap-controller.js';
8
8
  export { KeyboardMixin } from './src/keyboard-mixin.js';
9
9
  export { ResizeMixin } from './src/resize-mixin.js';
10
10
  export { SlotController } from './src/slot-controller.js';
11
+ export { SlotMixin } from './src/slot-mixin.js';
11
12
  export { TabindexMixin } from './src/tabindex-mixin.js';
package/index.js CHANGED
@@ -7,4 +7,5 @@ export { FocusMixin } from './src/focus-mixin.js';
7
7
  export { FocusTrapController } from './src/focus-trap-controller.js';
8
8
  export { KeyboardMixin } from './src/keyboard-mixin.js';
9
9
  export { SlotController } from './src/slot-controller.js';
10
+ export { SlotMixin } from './src/slot-mixin.js';
10
11
  export { TabindexMixin } from './src/tabindex-mixin.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "23.2.16",
3
+ "version": "23.2.18",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,8 +39,8 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@esm-bundle/chai": "^4.3.4",
42
- "@vaadin/testing-helpers": "^0.4.0",
42
+ "@vaadin/testing-helpers": "^0.3.2",
43
43
  "sinon": "^13.0.2"
44
44
  },
45
- "gitHead": "57010013e59a3ecdc70ceef4377dbc3b1ac03fb3"
45
+ "gitHead": "0633266344f3b8eaae21f5c1365b682f163dd0cb"
46
46
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2022 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2022 - 2023 Vaadin Ltd.
3
+ * Copyright (c) 2022 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 { animationFrame } from './async.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import { DisabledMixin } from './disabled-mixin.js';
package/src/async.d.ts CHANGED
@@ -9,7 +9,6 @@
9
9
  */
10
10
 
11
11
  export interface AsyncInterface {
12
- // eslint-disable-next-line @typescript-eslint/ban-types
13
12
  run(fn: Function, delay?: number): number;
14
13
  cancel(handle: number): void;
15
14
  }
@@ -40,7 +39,6 @@ declare namespace timeOut {
40
39
  *
41
40
  * @returns Handle used for canceling task
42
41
  */
43
- // eslint-disable-next-line @typescript-eslint/ban-types
44
42
  function run(fn: Function, delay?: number): number;
45
43
 
46
44
  /**
@@ -105,7 +103,6 @@ declare namespace microTask {
105
103
  *
106
104
  * @returns Handle used for canceling task
107
105
  */
108
- // eslint-disable-next-line @typescript-eslint/ban-types
109
106
  function run(callback?: Function): number;
110
107
 
111
108
  /**
package/src/async.js CHANGED
@@ -27,6 +27,7 @@ const microtaskCallbacks = [];
27
27
  let microtaskNodeContent = 0;
28
28
  let microtaskScheduled = false;
29
29
  const microtaskNode = document.createTextNode('');
30
+ new window.MutationObserver(microtaskFlush).observe(microtaskNode, { characterData: true });
30
31
 
31
32
  function microtaskFlush() {
32
33
  microtaskScheduled = false;
@@ -47,8 +48,6 @@ function microtaskFlush() {
47
48
  microtaskLastHandle += len;
48
49
  }
49
50
 
50
- new window.MutationObserver(microtaskFlush).observe(microtaskNode, { characterData: true });
51
-
52
51
  /**
53
52
  * Async interface wrapper around `setTimeout`.
54
53
  *
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
 
@@ -10,20 +10,20 @@ const testPlatform = (regexp) => regexp.test(navigator.platform);
10
10
 
11
11
  const testVendor = (regexp) => regexp.test(navigator.vendor);
12
12
 
13
- export const isAndroid = testUserAgent(/Android/u);
13
+ export const isAndroid = testUserAgent(/Android/);
14
14
 
15
- export const isChrome = testUserAgent(/Chrome/u) && testVendor(/Google Inc/u);
15
+ export const isChrome = testUserAgent(/Chrome/) && testVendor(/Google Inc/);
16
16
 
17
- export const isFirefox = testUserAgent(/Firefox/u);
17
+ export const isFirefox = testUserAgent(/Firefox/);
18
18
 
19
19
  // IPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
20
- export const isIPad = testPlatform(/^iPad/u) || (testPlatform(/^Mac/u) && navigator.maxTouchPoints > 1);
20
+ export const isIPad = testPlatform(/^iPad/) || (testPlatform(/^Mac/) && navigator.maxTouchPoints > 1);
21
21
 
22
- export const isIPhone = testPlatform(/^iPhone/u);
22
+ export const isIPhone = testPlatform(/^iPhone/);
23
23
 
24
24
  export const isIOS = isIPhone || isIPad;
25
25
 
26
- export const isSafari = testUserAgent(/^((?!chrome|android).)*safari/iu);
26
+ export const isSafari = testUserAgent(/^((?!chrome|android).)*safari/i);
27
27
 
28
28
  export const isTouch = (() => {
29
29
  try {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
package/src/debounce.js CHANGED
@@ -8,8 +8,6 @@ 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
10
 
11
- const debouncerQueue = new Set();
12
-
13
11
  /**
14
12
  * @summary Collapse multiple callbacks into one invocation after a timer.
15
13
  */
@@ -135,6 +133,8 @@ export class Debouncer {
135
133
  }
136
134
  }
137
135
 
136
+ let debouncerQueue = new Set();
137
+
138
138
  /**
139
139
  * Adds a `Debouncer` to a list of globally flushable tasks.
140
140
  *
@@ -0,0 +1,42 @@
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
+ * Helper that provides a set of functions for RTL.
9
+ */
10
+ declare class DirHelper {
11
+ /**
12
+ * Get the scroll type in the current browser view.
13
+ *
14
+ * @returns the scroll type. Possible values are `default|reverse|negative`
15
+ */
16
+ static detectScrollType(): string;
17
+
18
+ /**
19
+ * Get the scrollLeft value of the element relative to the direction
20
+ *
21
+ * @param scrollType type of the scroll detected with `detectScrollType`
22
+ * @param direction current direction of the element
23
+ * @returns the scrollLeft value.
24
+ */
25
+ static getNormalizedScrollLeft(scrollType: string, direction: string, element: Element | null): number;
26
+
27
+ /**
28
+ * Set the scrollLeft value of the element relative to the direction
29
+ *
30
+ * @param scrollType type of the scroll detected with `detectScrollType`
31
+ * @param direction current direction of the element
32
+ * @param scrollLeft the scrollLeft value to be set
33
+ */
34
+ static setNormalizedScrollLeft(
35
+ scrollType: string,
36
+ direction: string,
37
+ element: Element | null,
38
+ scrollLeft: number,
39
+ ): void;
40
+ }
41
+
42
+ export { DirHelper };
@@ -0,0 +1,93 @@
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
+ * Helper that provides a set of functions for RTL.
9
+ */
10
+ class DirHelper {
11
+ /**
12
+ * Get the scroll type in the current browser view.
13
+ *
14
+ * @return {string} the scroll type. Possible values are `default|reverse|negative`
15
+ */
16
+ static detectScrollType() {
17
+ const dummy = document.createElement('div');
18
+ dummy.textContent = 'ABCD';
19
+ dummy.dir = 'rtl';
20
+ dummy.style.fontSize = '14px';
21
+ dummy.style.width = '4px';
22
+ dummy.style.height = '1px';
23
+ dummy.style.position = 'absolute';
24
+ dummy.style.top = '-1000px';
25
+ dummy.style.overflow = 'scroll';
26
+ document.body.appendChild(dummy);
27
+
28
+ let cachedType = 'reverse';
29
+ if (dummy.scrollLeft > 0) {
30
+ cachedType = 'default';
31
+ } else {
32
+ dummy.scrollLeft = 2;
33
+ if (dummy.scrollLeft < 2) {
34
+ cachedType = 'negative';
35
+ }
36
+ }
37
+ document.body.removeChild(dummy);
38
+ return cachedType;
39
+ }
40
+
41
+ /**
42
+ * Get the scrollLeft value of the element relative to the direction
43
+ *
44
+ * @param {string} scrollType type of the scroll detected with `detectScrollType`
45
+ * @param {string} direction current direction of the element
46
+ * @param {Element} element
47
+ * @return {number} the scrollLeft value.
48
+ */
49
+ static getNormalizedScrollLeft(scrollType, direction, element) {
50
+ const { scrollLeft } = element;
51
+ if (direction !== 'rtl' || !scrollType) {
52
+ return scrollLeft;
53
+ }
54
+
55
+ switch (scrollType) {
56
+ case 'negative':
57
+ return element.scrollWidth - element.clientWidth + scrollLeft;
58
+ case 'reverse':
59
+ return element.scrollWidth - element.clientWidth - scrollLeft;
60
+ default:
61
+ return scrollLeft;
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Set the scrollLeft value of the element relative to the direction
67
+ *
68
+ * @param {string} scrollType type of the scroll detected with `detectScrollType`
69
+ * @param {string} direction current direction of the element
70
+ * @param {Element} element
71
+ * @param {number} scrollLeft the scrollLeft value to be set
72
+ */
73
+ static setNormalizedScrollLeft(scrollType, direction, element, scrollLeft) {
74
+ if (direction !== 'rtl' || !scrollType) {
75
+ element.scrollLeft = scrollLeft;
76
+ return;
77
+ }
78
+
79
+ switch (scrollType) {
80
+ case 'negative':
81
+ element.scrollLeft = element.clientWidth - element.scrollWidth + scrollLeft;
82
+ break;
83
+ case 'reverse':
84
+ element.scrollLeft = element.scrollWidth - element.clientWidth - scrollLeft;
85
+ break;
86
+ default:
87
+ element.scrollLeft = scrollLeft;
88
+ break;
89
+ }
90
+ }
91
+ }
92
+
93
+ export { DirHelper };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -11,5 +11,7 @@ import type { Constructor } from '@open-wc/dedupe-mixin';
11
11
  export declare function DirMixin<T extends Constructor<HTMLElement>>(base: T): Constructor<DirMixinClass> & T;
12
12
 
13
13
  export declare class DirMixinClass {
14
- protected readonly __isRTL: boolean;
14
+ protected __getNormalizedScrollLeft(element: Element | null): number;
15
+
16
+ protected __setNormalizedScrollLeft(element: Element | null, scrollLeft: number): void;
15
17
  }
package/src/dir-mixin.js CHANGED
@@ -1,14 +1,27 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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 { DirHelper } from './dir-helper.js';
6
7
 
7
8
  /**
8
9
  * Array of Vaadin custom element classes that have been subscribed to the dir changes.
9
10
  */
10
11
  const directionSubscribers = [];
11
12
 
13
+ function directionUpdater() {
14
+ const documentDir = getDocumentDir();
15
+ directionSubscribers.forEach((element) => {
16
+ alignDirs(element, documentDir);
17
+ });
18
+ }
19
+
20
+ let scrollType;
21
+
22
+ const directionObserver = new MutationObserver(directionUpdater);
23
+ directionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['dir'] });
24
+
12
25
  function alignDirs(element, documentDir, elementDir = element.getAttribute('dir')) {
13
26
  if (documentDir) {
14
27
  element.setAttribute('dir', documentDir);
@@ -21,16 +34,6 @@ function getDocumentDir() {
21
34
  return document.documentElement.getAttribute('dir');
22
35
  }
23
36
 
24
- function directionUpdater() {
25
- const documentDir = getDocumentDir();
26
- directionSubscribers.forEach((element) => {
27
- alignDirs(element, documentDir);
28
- });
29
- }
30
-
31
- const directionObserver = new MutationObserver(directionUpdater);
32
- directionObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['dir'] });
33
-
34
37
  /**
35
38
  * A mixin to handle `dir` attribute based on the one set on the `<html>` element.
36
39
  *
@@ -59,12 +62,13 @@ export const DirMixin = (superClass) =>
59
62
  };
60
63
  }
61
64
 
62
- /**
63
- * @return {boolean}
64
- * @protected
65
- */
66
- get __isRTL() {
67
- return this.getAttribute('dir') === 'rtl';
65
+ /** @protected */
66
+ static finalize() {
67
+ super.finalize();
68
+
69
+ if (!scrollType) {
70
+ scrollType = DirHelper.detectScrollType();
71
+ }
68
72
  }
69
73
 
70
74
  /** @protected */
@@ -142,4 +146,22 @@ export const DirMixin = (superClass) =>
142
146
  directionSubscribers.splice(directionSubscribers.indexOf(this), 1);
143
147
  }
144
148
  }
149
+
150
+ /**
151
+ * @param {Element} element
152
+ * @return {number}
153
+ * @protected
154
+ */
155
+ __getNormalizedScrollLeft(element) {
156
+ return DirHelper.getNormalizedScrollLeft(scrollType, this.getAttribute('dir') || 'ltr', element);
157
+ }
158
+
159
+ /**
160
+ * @param {Element} element
161
+ * @param {number} scrollLeft
162
+ * @protected
163
+ */
164
+ __setNormalizedScrollLeft(element, scrollLeft) {
165
+ return DirHelper.setNormalizedScrollLeft(scrollType, this.getAttribute('dir') || 'ltr', element, scrollLeft);
166
+ }
145
167
  };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
 
@@ -23,8 +23,3 @@ export function addValueToAttribute(element: HTMLElement, attr: string, value: s
23
23
  * If the value is the last one, the whole attribute is removed.
24
24
  */
25
25
  export function removeValueFromAttribute(element: HTMLElement, attr: string, value: string): void;
26
-
27
- /**
28
- * Returns true if the given node is an empty text node, false otherwise.
29
- */
30
- export function isEmptyTextNode(node: Node): boolean;
package/src/dom-utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
 
@@ -90,13 +90,3 @@ export function removeValueFromAttribute(element, attr, value) {
90
90
  }
91
91
  element.setAttribute(attr, serializeAttributeValue(values));
92
92
  }
93
-
94
- /**
95
- * Returns true if the given node is an empty text node, false otherwise.
96
- *
97
- * @param {Node} node
98
- * @return {boolean}
99
- */
100
- export function isEmptyTextNode(node) {
101
- return node.nodeType === Node.TEXT_NODE && node.textContent.trim() === '';
102
- }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import '../custom_typings/vaadin-usage-statistics.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import { setCancelSyntheticClickEvents } from '@polymer/polymer/lib/utils/settings.js';
@@ -15,20 +15,14 @@ import { DirMixin } from './dir-mixin.js';
15
15
  // for buttons that are based on `[role=button]` e.g vaadin-button.
16
16
  setCancelSyntheticClickEvents(false);
17
17
 
18
- if (!window.Vaadin) {
19
- window.Vaadin = {};
20
- }
18
+ window.Vaadin = window.Vaadin || {};
21
19
 
22
20
  /**
23
21
  * Array of Vaadin custom element classes that have been finalized.
24
22
  */
25
- if (!window.Vaadin.registrations) {
26
- window.Vaadin.registrations = [];
27
- }
23
+ window.Vaadin.registrations = window.Vaadin.registrations || [];
28
24
 
29
- if (!window.Vaadin.developmentModeCallback) {
30
- window.Vaadin.developmentModeCallback = {};
31
- }
25
+ window.Vaadin.developmentModeCallback = window.Vaadin.developmentModeCallback || {};
32
26
 
33
27
  window.Vaadin.developmentModeCallback['vaadin-usage-statistics'] = function () {
34
28
  usageStatistics();
@@ -45,7 +39,7 @@ const registered = new Set();
45
39
  export const ElementMixin = (superClass) =>
46
40
  class VaadinElementMixin extends DirMixin(superClass) {
47
41
  static get version() {
48
- return '23.2.16';
42
+ return '23.2.18';
49
43
  }
50
44
 
51
45
  /** @protected */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
@@ -39,7 +39,7 @@ export const FocusMixin = dedupingMixin(
39
39
  // In super.ready() other 'focusin' and 'focusout' listeners might be
40
40
  // added, so we call it after our own ones to ensure they execute first.
41
41
  // Issue to watch out: when incorrect, <vaadin-combo-box> refocuses the
42
- // input field on iOS after "Done" is pressed.
42
+ // input field on iOS after Done is pressed.
43
43
  super.ready();
44
44
  }
45
45
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import type { ReactiveController } from 'lit';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6
  import { getFocusableElements, isElementFocused } from './focus-utils.js';
@@ -33,27 +33,6 @@ export class FocusTrapController {
33
33
  this.__onKeyDown = this.__onKeyDown.bind(this);
34
34
  }
35
35
 
36
- /**
37
- * An array of tab-ordered focusable elements inside the trap node.
38
- *
39
- * @return {HTMLElement[]}
40
- * @private
41
- */
42
- get __focusableElements() {
43
- return getFocusableElements(this.__trapNode);
44
- }
45
-
46
- /**
47
- * The index of the element inside the trap node that currently has focus.
48
- *
49
- * @return {HTMLElement | undefined}
50
- * @private
51
- */
52
- get __focusedElementIndex() {
53
- const focusableElements = this.__focusableElements;
54
- return focusableElements.indexOf(focusableElements.filter(isElementFocused).pop());
55
- }
56
-
57
36
  hostConnected() {
58
37
  document.addEventListener('keydown', this.__onKeyDown);
59
38
  }
@@ -152,4 +131,25 @@ export class FocusTrapController {
152
131
  element.select();
153
132
  }
154
133
  }
134
+
135
+ /**
136
+ * An array of tab-ordered focusable elements inside the trap node.
137
+ *
138
+ * @return {HTMLElement[]}
139
+ * @private
140
+ */
141
+ get __focusableElements() {
142
+ return getFocusableElements(this.__trapNode);
143
+ }
144
+
145
+ /**
146
+ * The index of the element inside the trap node that currently has focus.
147
+ *
148
+ * @return {HTMLElement | undefined}
149
+ * @private
150
+ */
151
+ get __focusedElementIndex() {
152
+ const focusableElements = this.__focusableElements;
153
+ return focusableElements.indexOf(focusableElements.filter(isElementFocused).pop());
154
+ }
155
155
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 - 2023 Vaadin Ltd.
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
6