@vaadin/component-base 24.8.5 → 24.9.0-alpha2

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": "24.8.5",
3
+ "version": "24.9.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,10 +38,10 @@
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "~24.8.5",
42
- "@vaadin/test-runner-commands": "~24.8.5",
41
+ "@vaadin/chai-plugins": "24.9.0-alpha2",
42
+ "@vaadin/test-runner-commands": "24.9.0-alpha2",
43
43
  "@vaadin/testing-helpers": "^1.1.0",
44
44
  "sinon": "^18.0.0"
45
45
  },
46
- "gitHead": "a519b0d2b1d09d1ddaa4ff6829819f8a2be30ad8"
46
+ "gitHead": "dd99dece1b54942ab0e421892b089e506822c5f5"
47
47
  }
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 = '24.8.5') {
16
+ export function defineCustomElement(CustomElement, version = '24.9.0-alpha2') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -14,6 +14,7 @@ export class TooltipController extends SlotController {
14
14
  super(host, 'tooltip');
15
15
 
16
16
  this.setTarget(host);
17
+ this.__onContentChange = this.__onContentChange.bind(this);
17
18
  }
18
19
 
19
20
  /**
@@ -50,7 +51,8 @@ export class TooltipController extends SlotController {
50
51
  tooltipNode.shouldShow = this.shouldShow;
51
52
  }
52
53
 
53
- this.__notifyChange();
54
+ this.__notifyChange(tooltipNode);
55
+ tooltipNode.addEventListener('content-changed', this.__onContentChange);
54
56
  }
55
57
 
56
58
  /**
@@ -60,8 +62,10 @@ export class TooltipController extends SlotController {
60
62
  * @protected
61
63
  * @override
62
64
  */
63
- teardownNode() {
64
- this.__notifyChange();
65
+ teardownNode(tooltipNode) {
66
+ tooltipNode.removeEventListener('content-changed', this.__onContentChange);
67
+
68
+ this.__notifyChange(null);
65
69
  }
66
70
 
67
71
  /**
@@ -160,7 +164,12 @@ export class TooltipController extends SlotController {
160
164
  }
161
165
 
162
166
  /** @private */
163
- __notifyChange() {
164
- this.dispatchEvent(new CustomEvent('tooltip-changed', { detail: { node: this.node } }));
167
+ __onContentChange(event) {
168
+ this.__notifyChange(event.target);
169
+ }
170
+
171
+ /** @private */
172
+ __notifyChange(node) {
173
+ this.dispatchEvent(new CustomEvent('tooltip-changed', { detail: { node } }));
165
174
  }
166
175
  }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+
7
+ /**
8
+ * Issues a warning in the browser console if it has not been issued before.
9
+ */
10
+ export declare function issueWarning(warning: string): void;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2000 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+
7
+ const issuedWarnings = new Set();
8
+
9
+ /**
10
+ * Issues a warning in the browser console if it has not been issued before.
11
+ * @param {string} warning
12
+ */
13
+ export function issueWarning(warning) {
14
+ if (issuedWarnings.has(warning)) {
15
+ return;
16
+ }
17
+
18
+ issuedWarnings.add(warning);
19
+ console.warn(warning);
20
+ }
21
+
22
+ /**
23
+ * Clears all issued warnings. Only intended for testing purposes.
24
+ */
25
+ export function clearWarnings() {
26
+ issuedWarnings.clear();
27
+ }