@vaadin/component-base 25.3.2 → 25.4.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.
@@ -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.2",
3
+ "version": "25.4.0-alpha2",
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.2",
43
- "@vaadin/test-runner-commands": "~25.3.2",
42
+ "@vaadin/chai-plugins": "25.4.0-alpha2",
43
+ "@vaadin/test-runner-commands": "25.4.0-alpha2",
44
44
  "@vaadin/testing-helpers": "^2.0.0",
45
45
  "sinon": "^22.0.0"
46
46
  },
47
47
  "customElements": "custom-elements.json",
48
- "gitHead": "3f75254a3f77da3977cb79a77f549f37b8a5d54e"
48
+ "gitHead": "213f8b55112558d2f976d8730fe44370ca868333"
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.2') {
16
+ export function defineCustomElement(CustomElement, version = '25.4.0-alpha2') {
17
17
  Object.defineProperty(CustomElement, 'version', {
18
18
  get() {
19
19
  return version;
@@ -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
  };