@vaadin/component-base 25.3.0 → 25.4.0-dev.55bb86e155

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.
@@ -113,9 +113,9 @@
113
113
  "name": "i18n",
114
114
  "privacy": "public",
115
115
  "type": {
116
- "text": "Object"
116
+ "text": "Object | undefined"
117
117
  },
118
- "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
118
+ "description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
119
119
  "attribute": "i18n"
120
120
  }
121
121
  ],
@@ -123,9 +123,9 @@
123
123
  {
124
124
  "name": "i18n",
125
125
  "type": {
126
- "text": "Object"
126
+ "text": "Object | undefined"
127
127
  },
128
- "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
128
+ "description": "The object used to localize this component. To change the default\nlocalization, set this to an object that provides all properties, or\njust the individual properties you want to change.\n\nWhen not set, defaults to `undefined`.\n\nShould be overridden by subclasses to provide a custom JSDoc with the\ndefault I18N properties.",
129
129
  "fieldName": "i18n"
130
130
  }
131
131
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "25.3.0",
3
+ "version": "25.4.0-dev.55bb86e155",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@polymer/polymer": "^3.0.0",
42
- "@vaadin/chai-plugins": "~25.3.0",
43
- "@vaadin/test-runner-commands": "~25.3.0",
42
+ "@vaadin/chai-plugins": "25.4.0-dev.55bb86e155",
43
+ "@vaadin/test-runner-commands": "25.4.0-dev.55bb86e155",
44
44
  "@vaadin/testing-helpers": "^2.0.0",
45
45
  "sinon": "^22.0.0"
46
46
  },
47
47
  "customElements": "custom-elements.json",
48
- "gitHead": "4133747243c03bf544f6e82cc2ec9f295aaccd65"
48
+ "gitHead": "5db8e58fb088121b067290b0ed90d12d7d4084f2"
49
49
  }
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.3.0') {
16
+ export function defineCustomElement(CustomElement, version = '25.4.0-dev.55bb86e155') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2026 - 2026 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+
7
+ /**
8
+ * Marks the event as consumed by a component, e.g. a click that closed an overlay.
9
+ * Unlike `preventDefault()`, this does not cancel the default action of the event.
10
+ */
11
+ export declare function markEventConsumed(event: Event): void;
12
+
13
+ /**
14
+ * Returns true if the event was marked as consumed with `markEventConsumed()`.
15
+ * Only check it where a click that closed an overlay must be ignored, e.g. a backdrop.
16
+ * Do not use it in regular click handlers, so that synthetic clicks keep working.
17
+ */
18
+ export declare function isEventConsumed(event: Event): boolean;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2026 - 2026 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+
7
+ const consumedEvents = new WeakSet();
8
+
9
+ /**
10
+ * Marks the event as consumed by a component, e.g. a click that closed an overlay.
11
+ * Unlike `preventDefault()`, this does not cancel the default action of the event.
12
+ *
13
+ * @param {Event} event
14
+ */
15
+ export function markEventConsumed(event) {
16
+ consumedEvents.add(event);
17
+ }
18
+
19
+ /**
20
+ * Returns true if the event was marked as consumed with `markEventConsumed()`.
21
+ * Only check it where a click that closed an overlay must be ignored, e.g. a backdrop.
22
+ * Do not use it in regular click handlers, so that synthetic clicks keep working.
23
+ *
24
+ * @param {Event} event
25
+ * @return {boolean}
26
+ */
27
+ export function isEventConsumed(event) {
28
+ return consumedEvents.has(event);
29
+ }
@@ -15,8 +15,10 @@ export declare function I18nMixin<T extends Constructor<HTMLElement>, I = unknow
15
15
  export declare class I18nMixinClass<I> {
16
16
  /**
17
17
  * The object used to localize this component. To change the default
18
- * localization, replace this with an object that provides all properties, or
18
+ * localization, set this to an object that provides all properties, or
19
19
  * just the individual properties you want to change.
20
+ *
21
+ * When not set, defaults to `undefined`.
20
22
  */
21
- i18n: I;
23
+ i18n: I | undefined;
22
24
  }
package/src/i18n-mixin.js CHANGED
@@ -48,18 +48,20 @@ export const I18nMixin = (superClass) =>
48
48
  constructor() {
49
49
  super();
50
50
 
51
- this.i18n = deepMergePartials({}, this.constructor.defaultI18n);
51
+ this.__updateEffectiveI18n();
52
52
  }
53
53
 
54
54
  /**
55
55
  * The object used to localize this component. To change the default
56
- * localization, replace this with an object that provides all properties, or
56
+ * localization, set this to an object that provides all properties, or
57
57
  * just the individual properties you want to change.
58
58
  *
59
+ * When not set, defaults to `undefined`.
60
+ *
59
61
  * Should be overridden by subclasses to provide a custom JSDoc with the
60
62
  * default I18N properties.
61
63
  *
62
- * @type {Object}
64
+ * @type {Object | undefined}
63
65
  */
64
66
  get i18n() {
65
67
  return this.__customI18n;
@@ -70,6 +72,11 @@ export const I18nMixin = (superClass) =>
70
72
  return;
71
73
  }
72
74
  this.__customI18n = value;
75
+ this.__updateEffectiveI18n();
76
+ }
77
+
78
+ /** @private */
79
+ __updateEffectiveI18n() {
73
80
  this.__effectiveI18n = deepMergePartials({}, this.constructor.defaultI18n, this.__customI18n);
74
81
  }
75
82
  };