@vaadin/component-base 25.1.2 → 25.2.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.
@@ -7,9 +7,22 @@
7
7
  "path": "src/delegate-state-mixin.js",
8
8
  "declarations": [
9
9
  {
10
- "kind": "variable",
10
+ "kind": "mixin",
11
+ "description": "",
11
12
  "name": "DelegateStateMixin",
12
- "description": "A mixin to delegate properties and attributes to a target element."
13
+ "members": [],
14
+ "attributes": [],
15
+ "parameters": [
16
+ {
17
+ "name": "superclass"
18
+ }
19
+ ],
20
+ "mixins": [
21
+ {
22
+ "name": "dedupeMixin",
23
+ "package": "@open-wc/dedupe-mixin"
24
+ }
25
+ ]
13
26
  }
14
27
  ],
15
28
  "exports": [
@@ -223,9 +236,21 @@
223
236
  "path": "src/resize-mixin.js",
224
237
  "declarations": [
225
238
  {
226
- "kind": "variable",
239
+ "kind": "mixin",
240
+ "description": "A mixin that uses a ResizeObserver to listen to host size changes.",
227
241
  "name": "ResizeMixin",
228
- "description": "A mixin that uses a ResizeObserver to listen to host size changes."
242
+ "members": [],
243
+ "parameters": [
244
+ {
245
+ "name": "superclass"
246
+ }
247
+ ],
248
+ "mixins": [
249
+ {
250
+ "name": "dedupeMixin",
251
+ "package": "@open-wc/dedupe-mixin"
252
+ }
253
+ ]
229
254
  }
230
255
  ],
231
256
  "exports": [
@@ -244,9 +269,21 @@
244
269
  "path": "src/slot-styles-mixin.js",
245
270
  "declarations": [
246
271
  {
247
- "kind": "variable",
272
+ "kind": "mixin",
273
+ "description": "Mixin to insert styles into the outer scope to handle slotted components.\nThis is useful e.g. to hide native `<input type=\"number\">` controls.",
248
274
  "name": "SlotStylesMixin",
249
- "description": "Mixin to insert styles into the outer scope to handle slotted components.\nThis is useful e.g. to hide native `<input type=\"number\">` controls."
275
+ "members": [],
276
+ "parameters": [
277
+ {
278
+ "name": "superclass"
279
+ }
280
+ ],
281
+ "mixins": [
282
+ {
283
+ "name": "dedupeMixin",
284
+ "package": "@open-wc/dedupe-mixin"
285
+ }
286
+ ]
250
287
  }
251
288
  ],
252
289
  "exports": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "25.1.2",
3
+ "version": "25.2.0-alpha10",
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.1.2",
42
- "@vaadin/test-runner-commands": "~25.1.2",
41
+ "@vaadin/chai-plugins": "25.2.0-alpha10",
42
+ "@vaadin/test-runner-commands": "25.2.0-alpha10",
43
43
  "@vaadin/testing-helpers": "^2.0.0",
44
44
  "sinon": "^21.0.2"
45
45
  },
46
46
  "customElements": "custom-elements.json",
47
- "gitHead": "48e5dc507ac5eb8d34839be06cac652f1635fe1c"
47
+ "gitHead": "1303b6a3eeecb44a9d26f2b53cb56d9e906febdf"
48
48
  }
@@ -105,7 +105,7 @@ export function getFlatIndexByPath(cache, [levelIndex, ...subIndexes], flatIndex
105
105
 
106
106
  const flatIndexOnLevel = cache.getFlatIndex(levelIndex);
107
107
  const subCache = cache.getSubCache(levelIndex);
108
- if (subCache && subCache.flatSize > 0 && subIndexes.length) {
108
+ if (subCache?.flatSize > 0 && subIndexes.length) {
109
109
  return getFlatIndexByPath(subCache, subIndexes, flatIndex + flatIndexOnLevel + 1);
110
110
  }
111
111
  return flatIndex + flatIndexOnLevel;
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.1.2') {
16
+ export function defineCustomElement(CustomElement, version = '25.2.0-alpha10') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -10,116 +10,117 @@ import { dedupeMixin } from '@open-wc/dedupe-mixin';
10
10
  *
11
11
  * @polymerMixin
12
12
  */
13
- export const DelegateStateMixin = dedupeMixin(
14
- (superclass) =>
15
- class DelegateStateMixinClass extends superclass {
16
- static get properties() {
17
- return {
18
- /**
19
- * A target element to which attributes and properties are delegated.
20
- * @protected
21
- */
22
- stateTarget: {
23
- type: Object,
24
- observer: '_stateTargetChanged',
25
- },
26
- };
13
+ const DelegateStateMixinImplementation = (superclass) => {
14
+ return class DelegateStateMixinClass extends superclass {
15
+ static get properties() {
16
+ return {
17
+ /**
18
+ * A target element to which attributes and properties are delegated.
19
+ * @protected
20
+ */
21
+ stateTarget: {
22
+ type: Object,
23
+ observer: '_stateTargetChanged',
24
+ },
25
+ };
26
+ }
27
+
28
+ /**
29
+ * An array of the host attributes to delegate to the target element.
30
+ */
31
+ static get delegateAttrs() {
32
+ return [];
33
+ }
34
+
35
+ /**
36
+ * An array of the host properties to delegate to the target element.
37
+ */
38
+ static get delegateProps() {
39
+ return [];
40
+ }
41
+
42
+ /** @protected */
43
+ ready() {
44
+ super.ready();
45
+
46
+ this._createDelegateAttrsObserver();
47
+ this._createDelegatePropsObserver();
48
+ }
49
+
50
+ /** @protected */
51
+ _stateTargetChanged(target) {
52
+ if (target) {
53
+ this._ensureAttrsDelegated();
54
+ this._ensurePropsDelegated();
27
55
  }
28
-
29
- /**
30
- * An array of the host attributes to delegate to the target element.
31
- */
32
- static get delegateAttrs() {
33
- return [];
56
+ }
57
+
58
+ /** @protected */
59
+ _createDelegateAttrsObserver() {
60
+ this._createMethodObserver(`_delegateAttrsChanged(${this.constructor.delegateAttrs.join(', ')})`);
61
+ }
62
+
63
+ /** @protected */
64
+ _createDelegatePropsObserver() {
65
+ this._createMethodObserver(`_delegatePropsChanged(${this.constructor.delegateProps.join(', ')})`);
66
+ }
67
+
68
+ /** @protected */
69
+ _ensureAttrsDelegated() {
70
+ this.constructor.delegateAttrs.forEach((name) => {
71
+ this._delegateAttribute(name, this[name]);
72
+ });
73
+ }
74
+
75
+ /** @protected */
76
+ _ensurePropsDelegated() {
77
+ this.constructor.delegateProps.forEach((name) => {
78
+ this._delegateProperty(name, this[name]);
79
+ });
80
+ }
81
+
82
+ /** @protected */
83
+ _delegateAttrsChanged(...values) {
84
+ this.constructor.delegateAttrs.forEach((name, index) => {
85
+ this._delegateAttribute(name, values[index]);
86
+ });
87
+ }
88
+
89
+ /** @protected */
90
+ _delegatePropsChanged(...values) {
91
+ this.constructor.delegateProps.forEach((name, index) => {
92
+ this._delegateProperty(name, values[index]);
93
+ });
94
+ }
95
+
96
+ /** @protected */
97
+ _delegateAttribute(name, value) {
98
+ if (!this.stateTarget) {
99
+ return;
34
100
  }
35
101
 
36
- /**
37
- * An array of the host properties to delegate to the target element.
38
- */
39
- static get delegateProps() {
40
- return [];
102
+ if (name === 'invalid') {
103
+ this._delegateAttribute('aria-invalid', value ? 'true' : false);
41
104
  }
42
105
 
43
- /** @protected */
44
- ready() {
45
- super.ready();
46
-
47
- this._createDelegateAttrsObserver();
48
- this._createDelegatePropsObserver();
106
+ if (typeof value === 'boolean') {
107
+ this.stateTarget.toggleAttribute(name, value);
108
+ } else if (value) {
109
+ this.stateTarget.setAttribute(name, value);
110
+ } else {
111
+ this.stateTarget.removeAttribute(name);
49
112
  }
113
+ }
50
114
 
51
- /** @protected */
52
- _stateTargetChanged(target) {
53
- if (target) {
54
- this._ensureAttrsDelegated();
55
- this._ensurePropsDelegated();
56
- }
115
+ /** @protected */
116
+ _delegateProperty(name, value) {
117
+ if (!this.stateTarget) {
118
+ return;
57
119
  }
58
120
 
59
- /** @protected */
60
- _createDelegateAttrsObserver() {
61
- this._createMethodObserver(`_delegateAttrsChanged(${this.constructor.delegateAttrs.join(', ')})`);
62
- }
63
-
64
- /** @protected */
65
- _createDelegatePropsObserver() {
66
- this._createMethodObserver(`_delegatePropsChanged(${this.constructor.delegateProps.join(', ')})`);
67
- }
68
-
69
- /** @protected */
70
- _ensureAttrsDelegated() {
71
- this.constructor.delegateAttrs.forEach((name) => {
72
- this._delegateAttribute(name, this[name]);
73
- });
74
- }
75
-
76
- /** @protected */
77
- _ensurePropsDelegated() {
78
- this.constructor.delegateProps.forEach((name) => {
79
- this._delegateProperty(name, this[name]);
80
- });
81
- }
121
+ this.stateTarget[name] = value;
122
+ }
123
+ };
124
+ };
82
125
 
83
- /** @protected */
84
- _delegateAttrsChanged(...values) {
85
- this.constructor.delegateAttrs.forEach((name, index) => {
86
- this._delegateAttribute(name, values[index]);
87
- });
88
- }
89
-
90
- /** @protected */
91
- _delegatePropsChanged(...values) {
92
- this.constructor.delegateProps.forEach((name, index) => {
93
- this._delegateProperty(name, values[index]);
94
- });
95
- }
96
-
97
- /** @protected */
98
- _delegateAttribute(name, value) {
99
- if (!this.stateTarget) {
100
- return;
101
- }
102
-
103
- if (name === 'invalid') {
104
- this._delegateAttribute('aria-invalid', value ? 'true' : false);
105
- }
106
-
107
- if (typeof value === 'boolean') {
108
- this.stateTarget.toggleAttribute(name, value);
109
- } else if (value) {
110
- this.stateTarget.setAttribute(name, value);
111
- } else {
112
- this.stateTarget.removeAttribute(name);
113
- }
114
- }
115
-
116
- /** @protected */
117
- _delegateProperty(name, value) {
118
- if (!this.stateTarget) {
119
- return;
120
- }
121
-
122
- this.stateTarget[name] = value;
123
- }
124
- },
125
- );
126
+ export const DelegateStateMixin = dedupeMixin(DelegateStateMixinImplementation);
package/src/dom-utils.js CHANGED
@@ -74,7 +74,7 @@ export function getClosestElement(selector, node) {
74
74
  return null;
75
75
  }
76
76
 
77
- return node.closest(selector) || getClosestElement(selector, node.getRootNode().host);
77
+ return node.closest?.(selector) || getClosestElement(selector, node.getRootNode().host);
78
78
  }
79
79
 
80
80
  /**
package/src/gestures.js CHANGED
@@ -232,7 +232,7 @@ export function deepTargetFind(x, y) {
232
232
  // This code path is only taken when native ShadowDOM is used
233
233
  // if there is a shadowroot, it may have a node at x/y
234
234
  // if there is not a shadowroot, exit the loop
235
- while (next && next.shadowRoot && !window.ShadyDOM) {
235
+ while (next?.shadowRoot && !window.ShadyDOM) {
236
236
  // If there is a node at x/y in the shadowroot, look deeper
237
237
  const oldNext = next;
238
238
  next = next.shadowRoot.elementFromPoint(x, y);
@@ -448,7 +448,7 @@ function _remove(node, evType, handler) {
448
448
  for (let i = 0, dep, gd; i < deps.length; i++) {
449
449
  dep = deps[i];
450
450
  gd = gobj[dep];
451
- if (gd && gd[name]) {
451
+ if (gd?.[name]) {
452
452
  gd[name] = (gd[name] || 1) - 1;
453
453
  gd._count = (gd._count || 1) - 1;
454
454
  if (gd._count === 0) {
@@ -531,7 +531,7 @@ function _fire(target, type, detail) {
531
531
  // Forward `preventDefault` in a clean way
532
532
  if (ev.defaultPrevented) {
533
533
  const preventer = detail.preventer || detail.sourceEvent;
534
- if (preventer && preventer.preventDefault) {
534
+ if (preventer?.preventDefault) {
535
535
  preventer.preventDefault();
536
536
  }
537
537
  }
@@ -3,8 +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 { animationFrame } from './async.js';
7
- import { Debouncer } from './debounce.js';
8
6
 
9
7
  /**
10
8
  * A controller that detects if content inside the element overflows its scrolling viewport,
@@ -48,12 +46,7 @@ export class OverflowController {
48
46
  observe() {
49
47
  const { host } = this;
50
48
 
51
- this.__resizeObserver = new ResizeObserver(() => {
52
- this.__debounceOverflow = Debouncer.debounce(this.__debounceOverflow, animationFrame, () => {
53
- this.__updateOverflow();
54
- });
55
- });
56
-
49
+ this.__resizeObserver = new ResizeObserver(() => this.__onResize());
57
50
  this.__resizeObserver.observe(host);
58
51
 
59
52
  // Observe initial children
@@ -74,26 +67,43 @@ export class OverflowController {
74
67
  this.__resizeObserver.unobserve(node);
75
68
  }
76
69
  });
77
- });
78
70
 
79
- this.__updateOverflow();
71
+ if (addedNodes.length === 0 && removedNodes.length > 0) {
72
+ this.__updateState({ sync: true });
73
+ }
74
+ });
80
75
  });
81
76
 
82
77
  this.__childObserver.observe(host, { childList: true });
83
78
 
84
79
  // Update overflow attribute on scroll
85
80
  this.scrollTarget.addEventListener('scroll', this.__boundOnScroll);
81
+ }
86
82
 
87
- this.__updateOverflow();
83
+ /** @private */
84
+ __onResize() {
85
+ this.__updateState({ sync: false });
88
86
  }
89
87
 
90
88
  /** @private */
91
89
  __onScroll() {
92
- this.__updateOverflow();
90
+ this.__updateState({ sync: true });
93
91
  }
94
92
 
95
93
  /** @private */
96
- __updateOverflow() {
94
+ __updateState({ sync }) {
95
+ cancelAnimationFrame(this.__resizeRaf);
96
+
97
+ const state = this.__readState();
98
+ if (sync) {
99
+ this.__writeState(state);
100
+ } else {
101
+ this.__resizeRaf = requestAnimationFrame(() => this.__writeState(state));
102
+ }
103
+ }
104
+
105
+ /** @private */
106
+ __readState() {
97
107
  const target = this.scrollTarget;
98
108
 
99
109
  let overflow = '';
@@ -115,10 +125,14 @@ export class OverflowController {
115
125
  overflow += ' end';
116
126
  }
117
127
 
118
- overflow = overflow.trim();
119
- if (overflow.length > 0 && this.host.getAttribute('overflow') !== overflow) {
128
+ return { overflow: overflow.trim() };
129
+ }
130
+
131
+ /** @private */
132
+ __writeState({ overflow }) {
133
+ if (overflow) {
120
134
  this.host.setAttribute('overflow', overflow);
121
- } else if (overflow.length === 0 && this.host.hasAttribute('overflow')) {
135
+ } else {
122
136
  this.host.removeAttribute('overflow');
123
137
  }
124
138
  }
@@ -59,7 +59,7 @@ const PolylitMixinImplementation = (superclass) => {
59
59
  };
60
60
  }
61
61
 
62
- if (options && options.reflectToAttribute) {
62
+ if (options?.reflectToAttribute) {
63
63
  options.reflect = true;
64
64
  }
65
65
 
@@ -29,66 +29,66 @@ const observer = new ResizeObserver((entries) => {
29
29
  *
30
30
  * @polymerMixin
31
31
  */
32
- export const ResizeMixin = dedupeMixin(
33
- (superclass) =>
34
- class ResizeMixinClass extends superclass {
35
- /**
36
- * When true, the parent element resize will be also observed.
37
- * Override this getter and return `true` to enable this.
38
- *
39
- * @protected
40
- */
41
- get _observeParent() {
42
- return false;
43
- }
44
-
45
- /** @protected */
46
- connectedCallback() {
47
- super.connectedCallback();
48
- observer.observe(this);
32
+ const ResizeMixinImplementation = (superclass) =>
33
+ class ResizeMixinClass extends superclass {
34
+ /**
35
+ * When true, the parent element resize will be also observed.
36
+ * Override this getter and return `true` to enable this.
37
+ *
38
+ * @protected
39
+ */
40
+ get _observeParent() {
41
+ return false;
42
+ }
49
43
 
50
- if (this._observeParent) {
51
- const parent = this.parentNode instanceof ShadowRoot ? this.parentNode.host : this.parentNode;
44
+ /** @protected */
45
+ connectedCallback() {
46
+ super.connectedCallback();
47
+ observer.observe(this);
52
48
 
53
- if (!parent.resizables) {
54
- parent.resizables = new Set();
55
- observer.observe(parent);
56
- }
49
+ if (this._observeParent) {
50
+ const parent = this.parentNode instanceof ShadowRoot ? this.parentNode.host : this.parentNode;
57
51
 
58
- parent.resizables.add(this);
59
- this.__parent = parent;
52
+ if (!parent.resizables) {
53
+ parent.resizables = new Set();
54
+ observer.observe(parent);
60
55
  }
56
+
57
+ parent.resizables.add(this);
58
+ this.__parent = parent;
61
59
  }
60
+ }
62
61
 
63
- /** @protected */
64
- disconnectedCallback() {
65
- super.disconnectedCallback();
66
- observer.unobserve(this);
62
+ /** @protected */
63
+ disconnectedCallback() {
64
+ super.disconnectedCallback();
65
+ observer.unobserve(this);
67
66
 
68
- const parent = this.__parent;
69
- if (this._observeParent && parent) {
70
- const resizables = parent.resizables;
67
+ const parent = this.__parent;
68
+ if (this._observeParent && parent) {
69
+ const resizables = parent.resizables;
71
70
 
72
- if (resizables) {
73
- resizables.delete(this);
71
+ if (resizables) {
72
+ resizables.delete(this);
74
73
 
75
- if (resizables.size === 0) {
76
- observer.unobserve(parent);
77
- }
74
+ if (resizables.size === 0) {
75
+ observer.unobserve(parent);
78
76
  }
79
-
80
- this.__parent = null;
81
77
  }
82
- }
83
78
 
84
- /**
85
- * A handler invoked on host resize. By default, it does nothing.
86
- * Override the method to implement your own behavior.
87
- *
88
- * @protected
89
- */
90
- _onResize(_contentRect) {
91
- // To be implemented.
79
+ this.__parent = null;
92
80
  }
93
- },
94
- );
81
+ }
82
+
83
+ /**
84
+ * A handler invoked on host resize. By default, it does nothing.
85
+ * Override the method to implement your own behavior.
86
+ *
87
+ * @protected
88
+ */
89
+ _onResize(_contentRect) {
90
+ // To be implemented.
91
+ }
92
+ };
93
+
94
+ export const ResizeMixin = dedupeMixin(ResizeMixinImplementation);
@@ -223,7 +223,7 @@ export class SlotController extends EventTarget {
223
223
  });
224
224
  }
225
225
 
226
- if (newNodes && newNodes.length > 0) {
226
+ if (newNodes?.length > 0) {
227
227
  if (this.multiple) {
228
228
  // Remove default node if exists
229
229
  if (this.defaultNode) {
@@ -42,35 +42,35 @@ function insertStyles(styles, root) {
42
42
  *
43
43
  * @polymerMixin
44
44
  */
45
- export const SlotStylesMixin = dedupeMixin(
46
- (superclass) =>
47
- class SlotStylesMixinClass extends superclass {
48
- /**
49
- * List of styles to insert into root.
50
- * @protected
51
- */
52
- get slotStyles() {
53
- return [];
54
- }
45
+ const SlotStylesMixinImplementation = (superclass) =>
46
+ class SlotStylesMixinClass extends superclass {
47
+ /**
48
+ * List of styles to insert into root.
49
+ * @protected
50
+ */
51
+ get slotStyles() {
52
+ return [];
53
+ }
55
54
 
56
- /** @protected */
57
- connectedCallback() {
58
- super.connectedCallback();
55
+ /** @protected */
56
+ connectedCallback() {
57
+ super.connectedCallback();
59
58
 
60
- this.__applySlotStyles();
61
- }
59
+ this.__applySlotStyles();
60
+ }
62
61
 
63
- /** @private */
64
- __applySlotStyles() {
65
- const root = this.getRootNode();
66
- const rootStyles = getRootStyles(root);
62
+ /** @private */
63
+ __applySlotStyles() {
64
+ const root = this.getRootNode();
65
+ const rootStyles = getRootStyles(root);
67
66
 
68
- this.slotStyles.forEach((styles) => {
69
- if (!rootStyles.has(styles)) {
70
- insertStyles(styles, root);
71
- rootStyles.add(styles);
72
- }
73
- });
74
- }
75
- },
76
- );
67
+ this.slotStyles.forEach((styles) => {
68
+ if (!rootStyles.has(styles)) {
69
+ insertStyles(styles, root);
70
+ rootStyles.add(styles);
71
+ }
72
+ });
73
+ }
74
+ };
75
+
76
+ export const SlotStylesMixin = dedupeMixin(SlotStylesMixinImplementation);
@@ -119,6 +119,13 @@ addGlobalStyles(
119
119
  --safe-area-inset-right: env(safe-area-inset-right, 0px);
120
120
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
121
121
  --safe-area-inset-left: env(safe-area-inset-left, 0px);
122
+ --safe-area-inset-inline-start: var(--safe-area-inset-left);
123
+ --safe-area-inset-inline-end: var(--safe-area-inset-right);
124
+
125
+ &:dir(rtl) {
126
+ --safe-area-inset-inline-start: var(--safe-area-inset-right);
127
+ --safe-area-inset-inline-end: var(--safe-area-inset-left);
128
+ }
122
129
  }
123
130
 
124
131
  @supports not (color: hsl(0 0 0)) {
@@ -42,12 +42,6 @@ export class TooltipController extends SlotController {
42
42
  */
43
43
  manual: boolean;
44
44
 
45
- /**
46
- * When true, the tooltip is opened programmatically.
47
- * Only works if `manual` is set to `true`.
48
- */
49
- opened: boolean;
50
-
51
45
  /**
52
46
  * Position of the tooltip with respect to its target.
53
47
  */
@@ -74,11 +68,6 @@ export class TooltipController extends SlotController {
74
68
  */
75
69
  setManual(manual: boolean): void;
76
70
 
77
- /**
78
- * Toggle opened state on the slotted tooltip.
79
- */
80
- setOpened(opened: boolean): void;
81
-
82
71
  /**
83
72
  * Set default position for the slotted tooltip.
84
73
  * This can be overridden by setting the position
@@ -96,4 +85,18 @@ export class TooltipController extends SlotController {
96
85
  * Set an HTML element to attach the tooltip to.
97
86
  */
98
87
  setTarget(target: HTMLElement): void;
88
+
89
+ /**
90
+ * Schedule opening the slotted tooltip. Respects the tooltip's
91
+ * configured `hoverDelay` / `focusDelay` and the shared warm-up state.
92
+ * No-op when no tooltip is slotted.
93
+ */
94
+ open(options?: { hover?: boolean; focus?: boolean; immediate?: boolean }): void;
95
+
96
+ /**
97
+ * Schedule closing the slotted tooltip. Respects the tooltip's
98
+ * configured `hideDelay` unless `immediate` is true.
99
+ * No-op when no tooltip is slotted.
100
+ */
101
+ close(immediate?: boolean): void;
99
102
  }
@@ -39,10 +39,6 @@ export class TooltipController extends SlotController {
39
39
  tooltipNode.manual = this.manual;
40
40
  }
41
41
 
42
- if (this.opened !== undefined) {
43
- tooltipNode.opened = this.opened;
44
- }
45
-
46
42
  if (this.position !== undefined) {
47
43
  tooltipNode._position = this.position;
48
44
  }
@@ -113,19 +109,6 @@ export class TooltipController extends SlotController {
113
109
  }
114
110
  }
115
111
 
116
- /**
117
- * Toggle opened state on the slotted tooltip.
118
- * @param {boolean} opened
119
- */
120
- setOpened(opened) {
121
- this.opened = opened;
122
-
123
- const tooltipNode = this.node;
124
- if (tooltipNode) {
125
- tooltipNode.opened = opened;
126
- }
127
- }
128
-
129
112
  /**
130
113
  * Set default position for the slotted tooltip.
131
114
  * This can be overridden by setting the position
@@ -168,6 +151,34 @@ export class TooltipController extends SlotController {
168
151
  }
169
152
  }
170
153
 
154
+ /**
155
+ * Schedule opening the slotted tooltip. Respects the tooltip's
156
+ * configured `hoverDelay` / `focusDelay` and the shared warm-up state.
157
+ * No-op when no tooltip is slotted.
158
+ *
159
+ * @param {{ hover?: boolean, focus?: boolean, immediate?: boolean }} [options]
160
+ */
161
+ open(options) {
162
+ const tooltipNode = this.node;
163
+ if (tooltipNode?.isConnected) {
164
+ tooltipNode._stateController.open(options);
165
+ }
166
+ }
167
+
168
+ /**
169
+ * Schedule closing the slotted tooltip. Respects the tooltip's
170
+ * configured `hideDelay` unless `immediate` is true.
171
+ * No-op when no tooltip is slotted.
172
+ *
173
+ * @param {boolean} [immediate]
174
+ */
175
+ close(immediate) {
176
+ const tooltipNode = this.node;
177
+ if (tooltipNode) {
178
+ tooltipNode._stateController.close(immediate);
179
+ }
180
+ }
181
+
171
182
  /** @private */
172
183
  __onContentChange(event) {
173
184
  this.__notifyChange(event.target);
@@ -78,8 +78,6 @@ export class IronListAdapter {
78
78
  });
79
79
  attachObserver.observe(this.scrollTarget);
80
80
 
81
- this._scrollLineHeight = this._getScrollLineHeight();
82
-
83
81
  this.scrollTarget.addEventListener('virtualizer-element-focused', (e) => this.__onElementFocused(e));
84
82
  this.elementsContainer.addEventListener('focusin', () => {
85
83
  this.scrollTarget.dispatchEvent(
@@ -462,10 +460,6 @@ export class IronListAdapter {
462
460
  this._isRTL = Boolean(styles.direction === 'rtl');
463
461
  this._viewportWidth = this.elementsContainer.offsetWidth;
464
462
  this._viewportHeight = this.scrollTarget.offsetHeight;
465
- this._scrollPageHeight = this._viewportHeight - this._scrollLineHeight;
466
- if (this.grid) {
467
- this._updateGridMetrics();
468
- }
469
463
  }
470
464
 
471
465
  /** @private */
@@ -780,20 +774,6 @@ export class IronListAdapter {
780
774
  return 0;
781
775
  }
782
776
 
783
- /**
784
- * @returns {Number|undefined} - The browser's default font-size in pixels
785
- * @private
786
- */
787
- _getScrollLineHeight() {
788
- const el = document.createElement('div');
789
- el.style.fontSize = 'initial';
790
- el.style.display = 'none';
791
- document.body.appendChild(el);
792
- const fontSize = window.getComputedStyle(el).fontSize;
793
- document.body.removeChild(el);
794
- return fontSize ? window.parseInt(fontSize) : undefined;
795
- }
796
-
797
777
  __getVisibleElements() {
798
778
  return Array.from(this.elementsContainer.children).filter((element) => !element.hidden);
799
779
  }