-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathvaadin-theme-property-mixin.html
47 lines (44 loc) · 1.33 KB
/
vaadin-theme-property-mixin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<script>
/**
* @namespace Vaadin
*/
window.Vaadin = window.Vaadin || {};
/**
* @polymerMixin
* @memberof Vaadin
*/
Vaadin.ThemePropertyMixin = superClass => class VaadinThemePropertyMixin extends superClass {
static get properties() {
return {
/**
* Helper property with theme attribute value facilitating propagation
* in shadow DOM.
*
* Enables the component implementation to propagate the `theme`
* attribute value to the subcomponents in Shadow DOM by binding
* the subcomponent’s "theme" attribute to the `theme` property of
* the host.
*
* **NOTE:** Extending the mixin only provides the property for binding,
* and does not make the propagation alone.
*
* See [Theme Attribute and Subcomponents](https://github.com/vaadin/vaadin-themable-mixin/wiki/5.-Theme-Attribute-and-Subcomponents).
* page for more information.
*
* @protected
*/
theme: {
type: String,
readOnly: true
}
};
}
/** @protected */
attributeChangedCallback(name, oldValue, newValue) {
super.attributeChangedCallback(name, oldValue, newValue);
if (name === 'theme') {
this._setTheme(newValue);
}
}
};
</script>