@vaadin/component-base 25.1.0-alpha8 → 25.1.0-alpha9

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.
@@ -93,8 +93,31 @@
93
93
  "kind": "mixin",
94
94
  "description": "A mixin that allows to set partial I18N properties.",
95
95
  "name": "I18nMixin",
96
- "members": [],
97
- "attributes": [],
96
+ "members": [
97
+ {
98
+ "kind": "field",
99
+ "name": "i18n",
100
+ "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.",
101
+ "return": {
102
+ "type": {
103
+ "text": "Object"
104
+ }
105
+ },
106
+ "parameters": [
107
+ {
108
+ "name": "value",
109
+ "type": {
110
+ "text": "Object"
111
+ }
112
+ }
113
+ ]
114
+ }
115
+ ],
116
+ "attributes": [
117
+ {
118
+ "name": "i18n"
119
+ }
120
+ ],
98
121
  "parameters": [
99
122
  {
100
123
  "name": "defaultI18n"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/component-base",
3
- "version": "25.1.0-alpha8",
3
+ "version": "25.1.0-alpha9",
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.0-alpha8",
42
- "@vaadin/test-runner-commands": "25.1.0-alpha8",
41
+ "@vaadin/chai-plugins": "25.1.0-alpha9",
42
+ "@vaadin/test-runner-commands": "25.1.0-alpha9",
43
43
  "@vaadin/testing-helpers": "^2.0.0",
44
44
  "sinon": "^21.0.0"
45
45
  },
46
46
  "customElements": "custom-elements.json",
47
- "gitHead": "810590c9c7682a9326c9352df795b5ea4891a71f"
47
+ "gitHead": "ef432311376ba3dac4233cb23d393a49a425e0a4"
48
48
  }
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.0-alpha8') {
16
+ export function defineCustomElement(CustomElement, version = '25.1.0-alpha9') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2026 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2025 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import type { Constructor } from '@open-wc/dedupe-mixin';
package/src/i18n-mixin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2026 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2025 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -41,16 +41,6 @@ export const I18nMixin = (defaultI18n, superClass) =>
41
41
  class I18nMixinClass extends superClass {
42
42
  static get properties() {
43
43
  return {
44
- /** @private */
45
- // Technically declaring a Polymer property is not needed, as we have a
46
- // getter/setter for it below. However, the React components currently
47
- // rely on the Polymer property declaration to detect which properties
48
- // are available on a custom element, so we add a dummy declaration for
49
- // it.
50
- i18n: {
51
- type: Object,
52
- },
53
-
54
44
  /** @private */
55
45
  __effectiveI18n: {
56
46
  type: Object,
@@ -59,12 +49,28 @@ export const I18nMixin = (defaultI18n, superClass) =>
59
49
  };
60
50
  }
61
51
 
52
+ static get observedAttributes() {
53
+ return [...super.observedAttributes, 'i18n'];
54
+ }
55
+
62
56
  constructor() {
63
57
  super();
64
58
 
65
59
  this.i18n = deepMerge({}, defaultI18n);
66
60
  }
67
61
 
62
+ /** @protected */
63
+ attributeChangedCallback(name, oldValue, newValue) {
64
+ super.attributeChangedCallback(name, oldValue, newValue);
65
+ if (name === 'i18n') {
66
+ try {
67
+ this.i18n = JSON.parse(newValue);
68
+ } catch (_) {
69
+ // Invalid JSON, ignore
70
+ }
71
+ }
72
+ }
73
+
68
74
  /**
69
75
  * The object used to localize this component. To change the default
70
76
  * localization, replace this with an object that provides all properties, or
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2026 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2025 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
 
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2026 - 2026 Vaadin Ltd.
3
+ * Copyright (c) 2025 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './style-props.js';