@vaadin/vaadin-themable-mixin 23.0.6 → 23.1.0-alpha3

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/vaadin-themable-mixin",
3
- "version": "23.0.6",
3
+ "version": "23.1.0-alpha3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,7 +38,7 @@
38
38
  "@esm-bundle/chai": "^4.3.4",
39
39
  "@polymer/polymer": "^3.0.0",
40
40
  "@vaadin/testing-helpers": "^0.3.2",
41
- "sinon": "^9.2.4"
41
+ "sinon": "^13.0.2"
42
42
  },
43
- "gitHead": "82ca8522e24a63343fb28bcb4c686e55d25c8858"
43
+ "gitHead": "8c9e64e8dfa158dd52a9bf6da351ff038c88ca85"
44
44
  }
@@ -179,7 +179,15 @@ function getThemes(tagName) {
179
179
  * @returns {boolean}
180
180
  */
181
181
  function hasThemes(tagName) {
182
- const elementClass = customElements.get(tagName);
182
+ return classHasThemes(customElements.get(tagName));
183
+ }
184
+
185
+ /**
186
+ * Check if the custom element type has themes applied.
187
+ * @param {Function} elementClass
188
+ * @returns {boolean}
189
+ */
190
+ function classHasThemes(elementClass) {
183
191
  return elementClass && Object.prototype.hasOwnProperty.call(elementClass, '__themes');
184
192
  }
185
193
 
@@ -197,7 +205,7 @@ export const ThemableMixin = (superClass) =>
197
205
  super.finalize();
198
206
 
199
207
  const template = this.prototype._template;
200
- if (!template || hasThemes(this.is)) {
208
+ if (!template || classHasThemes(this)) {
201
209
  return;
202
210
  }
203
211
 
@@ -24,6 +24,29 @@ export declare class ThemePropertyMixinClass {
24
24
  *
25
25
  * See [Styling Components: Sub-components](https://vaadin.com/docs/latest/ds/customization/styling-components/#sub-components).
26
26
  * page for more information.
27
+ *
28
+ * @deprecated The `theme` property is not supposed for public use and will be dropped in Vaadin 24.
29
+ * Please, use the `theme` attribute instead.
30
+ * @protected
31
+ */
32
+ theme: string | null | undefined;
33
+
34
+ /**
35
+ * Helper property with theme attribute value facilitating propagation
36
+ * in shadow DOM.
37
+ *
38
+ * Enables the component implementation to propagate the `theme`
39
+ * attribute value to the sub-components in Shadow DOM by binding
40
+ * the sub-component’s "theme" attribute to the `theme` property of
41
+ * the host.
42
+ *
43
+ * **NOTE:** Extending the mixin only provides the property for binding,
44
+ * and does not make the propagation alone.
45
+ *
46
+ * See [Styling Components: Sub-components](https://vaadin.com/docs/latest/ds/customization/styling-components/#sub-components).
47
+ * page for more information.
48
+ *
49
+ * @protected
27
50
  */
28
- readonly theme: string | null | undefined;
51
+ readonly _theme: string | null | undefined;
29
52
  }
@@ -25,21 +25,42 @@ export const ThemePropertyMixin = (superClass) =>
25
25
  * See [Styling Components: Sub-components](https://vaadin.com/docs/latest/ds/customization/styling-components/#sub-components).
26
26
  * page for more information.
27
27
  *
28
+ * @deprecated The `theme` property is not supposed for public use and will be dropped in Vaadin 24.
29
+ * Please, use the `theme` attribute instead.
28
30
  * @protected
29
31
  */
30
32
  theme: {
33
+ type: String,
34
+ reflectToAttribute: true,
35
+ observer: '__deprecatedThemePropertyChanged'
36
+ },
37
+
38
+ /**
39
+ * Helper property with theme attribute value facilitating propagation
40
+ * in shadow DOM.
41
+ *
42
+ * Enables the component implementation to propagate the `theme`
43
+ * attribute value to the sub-components in Shadow DOM by binding
44
+ * the sub-component’s "theme" attribute to the `theme` property of
45
+ * the host.
46
+ *
47
+ * **NOTE:** Extending the mixin only provides the property for binding,
48
+ * and does not make the propagation alone.
49
+ *
50
+ * See [Styling Components: Sub-components](https://vaadin.com/docs/latest/ds/customization/styling-components/#sub-components).
51
+ * page for more information.
52
+ *
53
+ * @protected
54
+ */
55
+ _theme: {
31
56
  type: String,
32
57
  readOnly: true
33
58
  }
34
59
  };
35
60
  }
36
61
 
37
- /** @protected */
38
- attributeChangedCallback(name, oldValue, newValue) {
39
- super.attributeChangedCallback(name, oldValue, newValue);
40
-
41
- if (name === 'theme') {
42
- this._setTheme(newValue);
43
- }
62
+ /** @private */
63
+ __deprecatedThemePropertyChanged(theme) {
64
+ this._set_theme(theme);
44
65
  }
45
66
  };