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

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.1.0-alpha3",
3
+ "version": "23.1.0-beta2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -40,5 +40,5 @@
40
40
  "@vaadin/testing-helpers": "^0.3.2",
41
41
  "sinon": "^13.0.2"
42
42
  },
43
- "gitHead": "8c9e64e8dfa158dd52a9bf6da351ff038c88ca85"
43
+ "gitHead": "f11f9245a0b5e6bf912725a501c27c24b74e7c8d"
44
44
  }
@@ -11,7 +11,7 @@ import { ThemePropertyMixinClass } from './vaadin-theme-property-mixin.js';
11
11
  * A mixin for `nav` elements, facilitating navigation and selection of childNodes.
12
12
  */
13
13
  export declare function ThemableMixin<T extends Constructor<HTMLElement>>(
14
- base: T
14
+ base: T,
15
15
  ): T & Constructor<ThemableMixinClass> & Constructor<ThemePropertyMixinClass>;
16
16
 
17
17
  export declare class ThemableMixinClass {
@@ -52,7 +52,7 @@ export function registerStyles(themeFor, styles, options = {}) {
52
52
  themeFor,
53
53
  styles,
54
54
  include: options.include,
55
- moduleId: options.moduleId
55
+ moduleId: options.moduleId,
56
56
  });
57
57
  }
58
58
  }
@@ -77,7 +77,7 @@ function getAllThemes() {
77
77
  */
78
78
  function matchesThemeFor(themeFor, tagName) {
79
79
  return (themeFor || '').split(' ').some((themeForToken) => {
80
- return new RegExp('^' + themeForToken.split('*').join('.*') + '$').test(tagName);
80
+ return new RegExp(`^${themeForToken.split('*').join('.*')}$`).test(tagName);
81
81
  });
82
82
  }
83
83
 
@@ -151,7 +151,7 @@ function addStylesToTemplate(styles, template) {
151
151
  * @returns {Theme[]}
152
152
  */
153
153
  function getThemes(tagName) {
154
- const defaultModuleName = tagName + '-default-theme';
154
+ const defaultModuleName = `${tagName}-default-theme`;
155
155
 
156
156
  const themes = getAllThemes()
157
157
  // Filter by matching themeFor properties
@@ -161,7 +161,7 @@ function getThemes(tagName) {
161
161
  // Prepend styles from included themes
162
162
  styles: [...getIncludedStyles(theme), ...theme.styles],
163
163
  // Map moduleId to includePriority
164
- includePriority: getIncludePriority(theme.moduleId)
164
+ includePriority: getIncludePriority(theme.moduleId),
165
165
  }))
166
166
  // Sort by includePriority
167
167
  .sort((themeA, themeB) => themeB.includePriority - themeA.includePriority);
@@ -204,6 +204,11 @@ export const ThemableMixin = (superClass) =>
204
204
  static finalize() {
205
205
  super.finalize();
206
206
 
207
+ // Make sure not to run the logic intended for PolymerElement when LitElement is used.
208
+ if (this.elementStyles) {
209
+ return;
210
+ }
211
+
207
212
  const template = this.prototype._template;
208
213
  if (!template || classHasThemes(this)) {
209
214
  return;
@@ -6,7 +6,7 @@
6
6
  import { Constructor } from '@open-wc/dedupe-mixin';
7
7
 
8
8
  export declare function ThemePropertyMixin<T extends Constructor<HTMLElement>>(
9
- base: T
9
+ base: T,
10
10
  ): T & Constructor<ThemePropertyMixinClass>;
11
11
 
12
12
  export declare class ThemePropertyMixinClass {
@@ -32,7 +32,7 @@ export const ThemePropertyMixin = (superClass) =>
32
32
  theme: {
33
33
  type: String,
34
34
  reflectToAttribute: true,
35
- observer: '__deprecatedThemePropertyChanged'
35
+ observer: '__deprecatedThemePropertyChanged',
36
36
  },
37
37
 
38
38
  /**
@@ -54,8 +54,8 @@ export const ThemePropertyMixin = (superClass) =>
54
54
  */
55
55
  _theme: {
56
56
  type: String,
57
- readOnly: true
58
- }
57
+ readOnly: true,
58
+ },
59
59
  };
60
60
  }
61
61