@vaadin/component-base 23.0.9 → 23.0.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "23.0.9",
3
+ "version": "23.0.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -42,5 +42,5 @@
42
42
  "@vaadin/testing-helpers": "^0.3.2",
43
43
  "sinon": "^9.2.4"
44
44
  },
45
- "gitHead": "4d687bdd48ba78d55f3371a78b70818e4dfca1a3"
45
+ "gitHead": "717908c222c1e241259e30b4144cd5ba32734819"
46
46
  }
@@ -17,7 +17,7 @@ import { KeyboardMixinClass } from './keyboard-mixin.js';
17
17
  * by the pointer or by releasing the activation key.
18
18
  */
19
19
  export declare function ActiveMixin<T extends Constructor<HTMLElement>>(
20
- base: T
20
+ base: T,
21
21
  ): T & Constructor<ActiveMixinClass> & Constructor<DisabledMixinClass> & Constructor<KeyboardMixinClass>;
22
22
 
23
23
  export declare class ActiveMixinClass {
package/src/async.js CHANGED
@@ -70,7 +70,7 @@ const timeOut = {
70
70
  },
71
71
  cancel(handle) {
72
72
  window.clearTimeout(handle);
73
- }
73
+ },
74
74
  };
75
75
  },
76
76
  /**
@@ -93,7 +93,7 @@ const timeOut = {
93
93
  */
94
94
  cancel(handle) {
95
95
  window.clearTimeout(handle);
96
- }
96
+ },
97
97
  };
98
98
  export { timeOut };
99
99
 
@@ -123,7 +123,7 @@ const animationFrame = {
123
123
  */
124
124
  cancel(handle) {
125
125
  window.cancelAnimationFrame(handle);
126
- }
126
+ },
127
127
  };
128
128
  export { animationFrame };
129
129
 
@@ -154,7 +154,7 @@ const idlePeriod = {
154
154
  */
155
155
  cancel(handle) {
156
156
  window.cancelIdleCallback ? window.cancelIdleCallback(handle) : window.clearTimeout(handle);
157
- }
157
+ },
158
158
  };
159
159
  export { idlePeriod };
160
160
 
@@ -206,6 +206,6 @@ const microTask = {
206
206
  }
207
207
  microtaskCallbacks[idx] = null;
208
208
  }
209
- }
209
+ },
210
210
  };
211
211
  export { microTask };
@@ -10,7 +10,7 @@ import { ReactiveController, ReactiveControllerHost } from 'lit';
10
10
  * A mixin for connecting controllers to the element.
11
11
  */
12
12
  export declare function ControllerMixin<T extends Constructor<HTMLElement>>(
13
- superclass: T
13
+ superclass: T,
14
14
  ): T & Constructor<ControllerMixinClass>;
15
15
 
16
16
  export declare class ControllerMixinClass
@@ -63,5 +63,5 @@ export const ControllerMixin = dedupingMixin(
63
63
  removeController(controller) {
64
64
  this.__controllers.delete(controller);
65
65
  }
66
- }
66
+ },
67
67
  );
@@ -35,7 +35,7 @@ declare class DirHelper {
35
35
  scrollType: string,
36
36
  direction: string,
37
37
  element: Element | null,
38
- scrollLeft: number
38
+ scrollLeft: number,
39
39
  ): void;
40
40
  }
41
41
 
package/src/dir-mixin.js CHANGED
@@ -48,8 +48,8 @@ export const DirMixin = (superClass) =>
48
48
  dir: {
49
49
  type: String,
50
50
  value: '',
51
- reflectToAttribute: true
52
- }
51
+ reflectToAttribute: true,
52
+ },
53
53
  };
54
54
  }
55
55
 
@@ -22,8 +22,8 @@ export const DisabledMixin = dedupingMixin(
22
22
  type: Boolean,
23
23
  value: false,
24
24
  observer: '_disabledChanged',
25
- reflectToAttribute: true
26
- }
25
+ reflectToAttribute: true,
26
+ },
27
27
  };
28
28
  }
29
29
 
@@ -58,5 +58,5 @@ export const DisabledMixin = dedupingMixin(
58
58
  super.click();
59
59
  }
60
60
  }
61
- }
61
+ },
62
62
  );
@@ -0,0 +1,14 @@
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
+ * Returns an array of ancestor root nodes for the given node.
9
+ *
10
+ * A root node is either a document node or a document fragment node (Shadow Root).
11
+ * The array is collected by a bottom-up DOM traversing that starts with the given node
12
+ * and involves both the light DOM and ancestor shadow DOM trees.
13
+ */
14
+ export function getAncestorRootNodes(node: Node): Node[];
@@ -0,0 +1,41 @@
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
+ * Returns an array of ancestor root nodes for the given node.
9
+ *
10
+ * A root node is either a document node or a document fragment node (Shadow Root).
11
+ * The array is collected by a bottom-up DOM traversing that starts with the given node
12
+ * and involves both the light DOM and ancestor shadow DOM trees.
13
+ *
14
+ * @param {Node} node
15
+ * @return {Node[]}
16
+ */
17
+ export function getAncestorRootNodes(node) {
18
+ const result = [];
19
+
20
+ while (node) {
21
+ if (node.nodeType === Node.DOCUMENT_NODE) {
22
+ result.push(node);
23
+ break;
24
+ }
25
+
26
+ if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
27
+ result.push(node);
28
+ node = node.host;
29
+ continue;
30
+ }
31
+
32
+ if (node.assignedSlot) {
33
+ node = node.assignedSlot;
34
+ continue;
35
+ }
36
+
37
+ node = node.parentNode;
38
+ }
39
+
40
+ return result;
41
+ }
@@ -12,7 +12,7 @@ import { DirMixinClass } from './dir-mixin.js';
12
12
  * A mixin providing common logic for Vaadin components.
13
13
  */
14
14
  export declare function ElementMixin<T extends Constructor<HTMLElement>>(
15
- superclass: T
15
+ superclass: T,
16
16
  ): T & Constructor<DirMixinClass> & Constructor<ElementMixinClass>;
17
17
 
18
18
  export declare class ElementMixinClass {
@@ -39,7 +39,7 @@ const registered = new Set();
39
39
  export const ElementMixin = (superClass) =>
40
40
  class VaadinElementMixin extends DirMixin(superClass) {
41
41
  static get version() {
42
- return '23.0.9';
42
+ return '23.0.12';
43
43
  }
44
44
 
45
45
  /** @protected */
@@ -67,7 +67,7 @@ export const ElementMixin = (superClass) =>
67
67
 
68
68
  if (document.doctype === null) {
69
69
  console.warn(
70
- 'Vaadin components require the "standards mode" declaration. Please add <!DOCTYPE html> to the HTML document.'
70
+ 'Vaadin components require the "standards mode" declaration. Please add <!DOCTYPE html> to the HTML document.',
71
71
  );
72
72
  }
73
73
  }
@@ -16,7 +16,7 @@ window.addEventListener(
16
16
  () => {
17
17
  keyboardActive = true;
18
18
  },
19
- { capture: true }
19
+ { capture: true },
20
20
  );
21
21
 
22
22
  window.addEventListener(
@@ -24,7 +24,7 @@ window.addEventListener(
24
24
  () => {
25
25
  keyboardActive = false;
26
26
  },
27
- { capture: true }
27
+ { capture: true },
28
28
  );
29
29
 
30
30
  /**
@@ -110,5 +110,5 @@ export const FocusMixin = dedupingMixin(
110
110
  _shouldRemoveFocus(_event) {
111
111
  return true;
112
112
  }
113
- }
113
+ },
114
114
  );
package/src/gestures.js CHANGED
@@ -65,7 +65,7 @@ let supportsPassive = false;
65
65
  // eslint-disable-next-line getter-return
66
66
  get() {
67
67
  supportsPassive = true;
68
- }
68
+ },
69
69
  });
70
70
  window.addEventListener('test', null, opts);
71
71
  window.removeEventListener('test', null, opts);
@@ -103,7 +103,7 @@ const canBeDisabled = {
103
103
  optgroup: true,
104
104
  option: true,
105
105
  select: true,
106
- textarea: true
106
+ textarea: true,
107
107
  };
108
108
 
109
109
  /**
@@ -161,14 +161,14 @@ function isSyntheticClick(ev) {
161
161
  const POINTERSTATE = {
162
162
  mouse: {
163
163
  target: null,
164
- mouseIgnoreJob: null
164
+ mouseIgnoreJob: null,
165
165
  },
166
166
  touch: {
167
167
  x: 0,
168
168
  y: 0,
169
169
  id: -1,
170
- scrollDecided: false
171
- }
170
+ scrollDecided: false,
171
+ },
172
172
  };
173
173
 
174
174
  function firstTouchAction(ev) {
@@ -555,13 +555,13 @@ register({
555
555
  deps: ['mousedown', 'touchstart', 'touchend'],
556
556
  flow: {
557
557
  start: ['mousedown', 'touchstart'],
558
- end: ['mouseup', 'touchend']
558
+ end: ['mouseup', 'touchend'],
559
559
  },
560
560
  emits: ['down', 'up'],
561
561
 
562
562
  info: {
563
563
  movefn: null,
564
- upfn: null
564
+ upfn: null,
565
565
  },
566
566
 
567
567
  /**
@@ -616,7 +616,7 @@ register({
616
616
  */
617
617
  touchend: function (e) {
618
618
  downupFire('up', _findOriginalTarget(e), e.changedTouches[0], e);
619
- }
619
+ },
620
620
  });
621
621
 
622
622
  /**
@@ -637,7 +637,7 @@ function downupFire(type, target, event, preventer) {
637
637
  preventer: preventer,
638
638
  prevent: function (e) {
639
639
  return prevent(e);
640
- }
640
+ },
641
641
  });
642
642
  }
643
643
 
@@ -647,7 +647,7 @@ register({
647
647
  deps: ['mousedown', 'touchstart', 'touchmove', 'touchend'],
648
648
  flow: {
649
649
  start: ['mousedown', 'touchstart'],
650
- end: ['mouseup', 'touchend']
650
+ end: ['mouseup', 'touchend'],
651
651
  },
652
652
  emits: ['track'],
653
653
 
@@ -666,7 +666,7 @@ register({
666
666
  },
667
667
  movefn: null,
668
668
  upfn: null,
669
- prevent: false
669
+ prevent: false,
670
670
  },
671
671
 
672
672
  /**
@@ -779,7 +779,7 @@ register({
779
779
  this.info.addMove({ x: ct.clientX, y: ct.clientY });
780
780
  trackFire(this.info, t, ct);
781
781
  }
782
- }
782
+ },
783
783
  });
784
784
 
785
785
  /**
@@ -831,7 +831,7 @@ function trackFire(info, target, touch) {
831
831
  sourceEvent: touch,
832
832
  hover: function () {
833
833
  return deepTargetFind(touch.clientX, touch.clientY);
834
- }
834
+ },
835
835
  });
836
836
  }
837
837
 
@@ -840,13 +840,13 @@ register({
840
840
  deps: ['mousedown', 'click', 'touchstart', 'touchend'],
841
841
  flow: {
842
842
  start: ['mousedown', 'touchstart'],
843
- end: ['click', 'touchend']
843
+ end: ['click', 'touchend'],
844
844
  },
845
845
  emits: ['tap'],
846
846
  info: {
847
847
  x: NaN,
848
848
  y: NaN,
849
- prevent: false
849
+ prevent: false,
850
850
  },
851
851
 
852
852
  /**
@@ -900,7 +900,7 @@ register({
900
900
  */
901
901
  touchend: function (e) {
902
902
  trackForward(this.info, e.changedTouches[0], e);
903
- }
903
+ },
904
904
  });
905
905
 
906
906
  /**
@@ -925,7 +925,7 @@ function trackForward(info, e, preventer) {
925
925
  x: e.clientX,
926
926
  y: e.clientY,
927
927
  sourceEvent: e,
928
- preventer: preventer
928
+ preventer: preventer,
929
929
  });
930
930
  }
931
931
  }
@@ -346,7 +346,7 @@ export const ironList = {
346
346
  // _increasePoolIfNeeded to run away creating items to try to fill it.
347
347
  this._physicalTop = Math.min(
348
348
  Math.floor(this._virtualStart / this._itemsPerRow) * this._physicalAverage,
349
- this._scrollPosition
349
+ this._scrollPosition,
350
350
  );
351
351
  this._update();
352
352
  } else if (this._physicalCount > 0) {
@@ -467,7 +467,7 @@ export const ironList = {
467
467
  var nextPhysicalCount = this._clamp(
468
468
  this._physicalCount + count,
469
469
  DEFAULT_PHYSICAL_COUNT,
470
- this._virtualCount - this._virtualStart
470
+ this._virtualCount - this._virtualStart,
471
471
  );
472
472
  nextPhysicalCount = this._convertIndexToCompleteRow(nextPhysicalCount);
473
473
  if (this.grid) {
@@ -520,7 +520,7 @@ export const ironList = {
520
520
  this._debounce(
521
521
  '_increasePoolIfNeeded',
522
522
  this._increasePoolIfNeeded.bind(this, this._clamp(Math.round(50 / this._templateCost), 1, nextIncrease)),
523
- idlePeriod
523
+ idlePeriod,
524
524
  );
525
525
  }
526
526
  },
@@ -689,7 +689,7 @@ export const ironList = {
689
689
  // Update the average if it measured something.
690
690
  if (this._physicalAverageCount !== prevAvgCount) {
691
691
  this._physicalAverage = Math.round(
692
- (prevPhysicalAvg * prevAvgCount + newPhysicalSize) / this._physicalAverageCount
692
+ (prevPhysicalAvg * prevAvgCount + newPhysicalSize) / this._physicalAverageCount,
693
693
  );
694
694
  }
695
695
  },
@@ -890,7 +890,7 @@ export const ironList = {
890
890
  this.toggleScrollListener(false);
891
891
  }
892
892
  },
893
- animationFrame
893
+ animationFrame,
894
894
  );
895
895
  },
896
896
 
@@ -949,5 +949,5 @@ export const ironList = {
949
949
  this._debouncers = this._debouncers || {};
950
950
  this._debouncers[name] = Debouncer.debounce(this._debouncers[name], asyncModule, cb.bind(this));
951
951
  enqueueDebouncer(this._debouncers[name]);
952
- }
952
+ },
953
953
  };
@@ -49,5 +49,5 @@ export const KeyboardMixin = dedupingMixin(
49
49
  _onKeyUp(_event) {
50
50
  // To be implemented.
51
51
  }
52
- }
52
+ },
53
53
  );
@@ -93,8 +93,8 @@ export const ResizeMixin = dedupingMixin(
93
93
  */
94
94
  notifyResize() {
95
95
  console.warn(
96
- `WARNING: Since Vaadin 23, notifyResize() is deprecated. The component uses a ResizeObserver internally and doesn't need to be explicitly notified of resizes.`
96
+ `WARNING: Since Vaadin 23, notifyResize() is deprecated. The component uses a ResizeObserver internally and doesn't need to be explicitly notified of resizes.`,
97
97
  );
98
98
  }
99
- }
99
+ },
100
100
  );
@@ -10,7 +10,7 @@ export class SlotController extends EventTarget implements ReactiveController {
10
10
  host: HTMLElement,
11
11
  slotName: string,
12
12
  slotFactory?: () => HTMLElement,
13
- slotInitializer?: (host: HTMLElement, node: HTMLElement) => void
13
+ slotInitializer?: (host: HTMLElement, node: HTMLElement) => void,
14
14
  );
15
15
 
16
16
  hostConnected(): void;
package/src/slot-mixin.js CHANGED
@@ -56,5 +56,5 @@ export const SlotMixin = dedupingMixin(
56
56
  );
57
57
  });
58
58
  }
59
- }
59
+ },
60
60
  );
@@ -13,7 +13,7 @@ import { DisabledMixinClass } from './disabled-mixin.js';
13
13
  * and restored with the last known value once the element is enabled.
14
14
  */
15
15
  export declare function TabindexMixin<T extends Constructor<HTMLElement>>(
16
- base: T
16
+ base: T,
17
17
  ): T & Constructor<DisabledMixinClass> & Constructor<TabindexMixinClass>;
18
18
 
19
19
  export declare class TabindexMixinClass {
@@ -26,7 +26,7 @@ export const TabindexMixin = (superclass) =>
26
26
  tabindex: {
27
27
  type: Number,
28
28
  reflectToAttribute: true,
29
- observer: '_tabindexChanged'
29
+ observer: '_tabindexChanged',
30
30
  },
31
31
 
32
32
  /**
@@ -35,8 +35,8 @@ export const TabindexMixin = (superclass) =>
35
35
  * @protected
36
36
  */
37
37
  _lastTabIndex: {
38
- type: Number
39
- }
38
+ type: Number,
39
+ },
40
40
  };
41
41
  }
42
42
 
package/src/templates.js CHANGED
@@ -18,7 +18,7 @@ export function processTemplates(component) {
18
18
 
19
19
  if (component.querySelector('template')) {
20
20
  console.warn(
21
- `WARNING: <template> inside <${component.localName}> is no longer supported. Import @vaadin/polymer-legacy-adapter/template-renderer.js to enable compatibility.`
21
+ `WARNING: <template> inside <${component.localName}> is no longer supported. Import @vaadin/polymer-legacy-adapter/template-renderer.js to enable compatibility.`,
22
22
  );
23
23
  }
24
24
  }
@@ -28,7 +28,7 @@ export class IronListAdapter {
28
28
 
29
29
  this.timeouts = {
30
30
  SCROLL_REORDER: 500,
31
- IGNORE_WHEEL: 500
31
+ IGNORE_WHEEL: 500,
32
32
  };
33
33
 
34
34
  this.__resizeObserver = new ResizeObserver(() => this._resizeHandler());
@@ -183,7 +183,7 @@ export class IronListAdapter {
183
183
  flush();
184
184
 
185
185
  this._itemsChanged({
186
- path: 'items'
186
+ path: 'items',
187
187
  });
188
188
  flush();
189
189
 
@@ -221,7 +221,7 @@ export class IronListAdapter {
221
221
  /** @private */
222
222
  get items() {
223
223
  return {
224
- length: Math.min(this.size, MAX_VIRTUAL_COUNT)
224
+ length: Math.min(this.size, MAX_VIRTUAL_COUNT),
225
225
  };
226
226
  }
227
227
 
@@ -233,7 +233,7 @@ export class IronListAdapter {
233
233
  /** @private */
234
234
  get $() {
235
235
  return {
236
- items: this.scrollContainer
236
+ items: this.scrollContainer,
237
237
  };
238
238
  }
239
239
 
@@ -311,7 +311,7 @@ export class IronListAdapter {
311
311
  this.__scrollReorderDebouncer = Debouncer.debounce(
312
312
  this.__scrollReorderDebouncer,
313
313
  timeOut.after(this.timeouts.SCROLL_REORDER),
314
- () => this.__reorderElements()
314
+ () => this.__reorderElements(),
315
315
  );
316
316
  }
317
317
 
@@ -349,7 +349,7 @@ export class IronListAdapter {
349
349
  this.__debouncerWheelAnimationFrame = Debouncer.debounce(
350
350
  this.__debouncerWheelAnimationFrame,
351
351
  animationFrame,
352
- () => (this._wheelAnimationFrame = false)
352
+ () => (this._wheelAnimationFrame = false),
353
353
  );
354
354
 
355
355
  const momentum = Math.abs(e.deltaX) + Math.abs(deltaY);
@@ -365,7 +365,7 @@ export class IronListAdapter {
365
365
  this._debouncerIgnoreNewWheel = Debouncer.debounce(
366
366
  this._debouncerIgnoreNewWheel,
367
367
  timeOut.after(this.timeouts.IGNORE_WHEEL),
368
- () => (this._ignoreNewWheel = false)
368
+ () => (this._ignoreNewWheel = false),
369
369
  );
370
370
  } else if ((this._hasResidualMomentum && momentum <= this._previousMomentum) || this._ignoreNewWheel) {
371
371
  e.preventDefault();
@@ -436,7 +436,7 @@ export class IronListAdapter {
436
436
  const elementWithFocus = visibleElements.find(
437
437
  (element) =>
438
438
  element.contains(this.elementsContainer.getRootNode().activeElement) ||
439
- element.contains(this.scrollTarget.getRootNode().activeElement)
439
+ element.contains(this.scrollTarget.getRootNode().activeElement),
440
440
  );
441
441
  const targetElement = elementWithFocus || visibleElements[0];
442
442
  if (!targetElement) {