@vaadin/component-base 25.0.0-alpha15 → 25.0.0-alpha17

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": "25.0.0-alpha15",
3
+ "version": "25.0.0-alpha17",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -33,15 +33,15 @@
33
33
  "dependencies": {
34
34
  "@open-wc/dedupe-mixin": "^1.3.0",
35
35
  "@vaadin/vaadin-development-mode-detector": "^2.0.0",
36
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha15",
36
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha17",
37
37
  "@vaadin/vaadin-usage-statistics": "^2.1.0",
38
38
  "lit": "^3.0.0"
39
39
  },
40
40
  "devDependencies": {
41
- "@vaadin/chai-plugins": "25.0.0-alpha15",
42
- "@vaadin/test-runner-commands": "25.0.0-alpha15",
41
+ "@vaadin/chai-plugins": "25.0.0-alpha17",
42
+ "@vaadin/test-runner-commands": "25.0.0-alpha17",
43
43
  "@vaadin/testing-helpers": "^2.0.0",
44
- "sinon": "^18.0.0"
44
+ "sinon": "^21.0.0"
45
45
  },
46
- "gitHead": "1ad98437e7600769bf66f870929feefbeef16edf"
46
+ "gitHead": "8264c71309907be99368b09414f0f8d7f591e0b9"
47
47
  }
@@ -18,6 +18,7 @@
18
18
  *
19
19
  * @param {Cache} cache
20
20
  * @param {number} flatIndex
21
+ * @param {number} level
21
22
  */
22
23
  export function getFlatIndexContext(cache, flatIndex, level = 0) {
23
24
  let levelIndex = flatIndex;
@@ -53,7 +54,6 @@ export function getFlatIndexContext(cache, flatIndex, level = 0) {
53
54
  *
54
55
  * If the item isn't found, the method returns undefined.
55
56
  *
56
- * @param {Cache} cache
57
57
  * @param {{ getItemId: (item: unknown) => unknown}} context
58
58
  * @param {Cache} cache
59
59
  * @param {unknown} targetItem
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.0.0-alpha15') {
16
+ export function defineCustomElement(CustomElement, version = '25.0.0-alpha17') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -215,26 +215,10 @@ const PolylitMixinImplementation = (superclass) => {
215
215
  };
216
216
  }
217
217
 
218
- constructor() {
219
- super();
220
- this.__hasPolylitMixin = true;
221
- }
222
-
223
218
  /** @protected */
224
219
  connectedCallback() {
225
220
  super.connectedCallback();
226
221
 
227
- // Components like `vaadin-overlay` are teleported to the body element when opened.
228
- // If their opened state is set as an attribute, the teleportation happens immediately
229
- // after they are connected to the DOM. This means they will be outside the scope of
230
- // querySelectorAll in the parent component's `firstUpdated()`. To ensure their reference
231
- // is still registered in the $ map, we propagate the reference here.
232
- const parentHost = this.getRootNode().host;
233
- if (parentHost && parentHost.__hasPolylitMixin && this.id) {
234
- parentHost.$ ||= {};
235
- parentHost.$[this.id] = this;
236
- }
237
-
238
222
  const { polylitConfig } = this.constructor;
239
223
  if (!this.hasUpdated && !polylitConfig.asyncFirstRender) {
240
224
  this.performUpdate();
@@ -15,7 +15,7 @@ export class SlotController extends EventTarget {
15
15
  * Ensure that every instance has unique ID.
16
16
  *
17
17
  * @param {HTMLElement} host
18
- * @param {string} slotName
18
+ * @param {string} prefix
19
19
  * @return {string}
20
20
  * @protected
21
21
  */
@@ -15,20 +15,20 @@ addGlobalThemeStyles(
15
15
  --vaadin-background-color: light-dark(#fff, #222);
16
16
 
17
17
  /* Container colors */
18
- --vaadin-background-container: color-mix(in oklch, var(--vaadin-color) 5%, var(--vaadin-background-color));
18
+ --vaadin-background-container: color-mix(in oklab, var(--vaadin-color) 5%, var(--vaadin-background-color));
19
19
  --vaadin-background-container-strong: color-mix(
20
- in oklch,
20
+ in oklab,
21
21
  var(--vaadin-color) 10%,
22
22
  var(--vaadin-background-color)
23
23
  );
24
24
 
25
25
  /* Border colors */
26
- --vaadin-border-color-subtle: color-mix(in oklch, var(--vaadin-color) 24%, transparent);
27
- --vaadin-border-color: color-mix(in oklch, var(--vaadin-color) 48%, transparent); /* Above 3:1 contrast */
26
+ --vaadin-border-color-subtle: color-mix(in oklab, var(--vaadin-color) 24%, transparent);
27
+ --vaadin-border-color: color-mix(in oklab, var(--vaadin-color) 48%, transparent); /* Above 3:1 contrast */
28
28
 
29
29
  /* Text colors */
30
- --vaadin-color-disabled: color-mix(in oklch, var(--vaadin-color) 48%, transparent); /* Above 3:1 contrast */
31
- --vaadin-color-subtle: color-mix(in oklch, var(--vaadin-color) 68%, transparent); /* Above 4.5:1 contrast */
30
+ --vaadin-color-disabled: color-mix(in oklab, var(--vaadin-color) 48%, transparent); /* Above 3:1 contrast */
31
+ --vaadin-color-subtle: color-mix(in oklab, var(--vaadin-color) 68%, transparent); /* Above 4.5:1 contrast */
32
32
  --vaadin-color: light-dark(#1f1f1f, white); /* Above 7:1 contrast */
33
33
 
34
34
  /* Padding */
@@ -40,9 +40,11 @@ addGlobalThemeStyles(
40
40
  --vaadin-padding-container: var(--vaadin-padding-xs) var(--vaadin-padding-s);
41
41
 
42
42
  /* Gap/spacing */
43
+ --vaadin-gap-xs: 6px;
43
44
  --vaadin-gap-s: 8px;
44
45
  --vaadin-gap-m: 12px;
45
46
  --vaadin-gap-l: 16px;
47
+ --vaadin-gap-xl: 24px;
46
48
 
47
49
  /* Border radius */
48
50
  --vaadin-radius-s: 3px;
@@ -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,11 @@ export class TooltipController extends SlotController {
50
51
  tooltipNode.shouldShow = this.shouldShow;
51
52
  }
52
53
 
53
- this.__notifyChange();
54
+ if (!this.manual) {
55
+ this.host.setAttribute('has-tooltip', '');
56
+ }
57
+ this.__notifyChange(tooltipNode);
58
+ tooltipNode.addEventListener('content-changed', this.__onContentChange);
54
59
  }
55
60
 
56
61
  /**
@@ -60,8 +65,12 @@ export class TooltipController extends SlotController {
60
65
  * @protected
61
66
  * @override
62
67
  */
63
- teardownNode() {
64
- this.__notifyChange();
68
+ teardownNode(tooltipNode) {
69
+ if (!this.manual) {
70
+ this.host.removeAttribute('has-tooltip');
71
+ }
72
+ tooltipNode.removeEventListener('content-changed', this.__onContentChange);
73
+ this.__notifyChange(null);
65
74
  }
66
75
 
67
76
  /**
@@ -160,7 +169,12 @@ export class TooltipController extends SlotController {
160
169
  }
161
170
 
162
171
  /** @private */
163
- __notifyChange() {
164
- this.dispatchEvent(new CustomEvent('tooltip-changed', { detail: { node: this.node } }));
172
+ __onContentChange(event) {
173
+ this.__notifyChange(event.target);
174
+ }
175
+
176
+ /** @private */
177
+ __notifyChange(node) {
178
+ this.dispatchEvent(new CustomEvent('tooltip-changed', { detail: { node } }));
165
179
  }
166
180
  }
@@ -78,9 +78,7 @@ export class Virtualizer {
78
78
  /**
79
79
  * Flushes active asynchronous tasks so that the component and the DOM end up in a stable state
80
80
  *
81
- * @method update
82
- * @param {number | undefined} startIndex The start index of the range
83
- * @param {number | undefined} endIndex The end index of the range
81
+ * @method flush
84
82
  */
85
83
  flush() {
86
84
  this.__adapter.flush();
@@ -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
+ }