@vaadin/vaadin-themable-mixin 24.8.0-alpha12 → 24.8.0-alpha14
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 +6 -5
- package/vaadin-themable-mixin.js +13 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/vaadin-themable-mixin",
|
|
3
|
-
"version": "24.8.0-
|
|
3
|
+
"version": "24.8.0-alpha14",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,14 +32,15 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
35
|
-
"lit": "^3.0.0"
|
|
35
|
+
"lit": "^3.0.0",
|
|
36
|
+
"style-observer": "^0.0.8"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/chai-plugins": "24.8.0-
|
|
40
|
-
"@vaadin/test-runner-commands": "24.8.0-
|
|
40
|
+
"@vaadin/chai-plugins": "24.8.0-alpha14",
|
|
41
|
+
"@vaadin/test-runner-commands": "24.8.0-alpha14",
|
|
41
42
|
"@vaadin/testing-helpers": "^1.1.0",
|
|
42
43
|
"sinon": "^18.0.0"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "c8a33608cf1ab377529afd0650360e349886384c"
|
|
45
46
|
}
|
package/vaadin-themable-mixin.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Copyright (c) 2017 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { css, CSSResult, LitElement, unsafeCSS } from 'lit';
|
|
7
|
+
import { applyInstanceStyles } from './src/css-utils.js';
|
|
7
8
|
import { ThemePropertyMixin } from './vaadin-theme-property-mixin.js';
|
|
8
9
|
|
|
9
10
|
export { css, unsafeCSS };
|
|
@@ -115,13 +116,7 @@ function updateInstanceStyles(instance) {
|
|
|
115
116
|
|
|
116
117
|
if (instance instanceof LitElement) {
|
|
117
118
|
// LitElement
|
|
118
|
-
|
|
119
|
-
// The adoptStyles function may fall back to appending style elements to shadow root.
|
|
120
|
-
// Remove them first to avoid duplicates.
|
|
121
|
-
[...instance.shadowRoot.querySelectorAll('style')].forEach((style) => style.remove());
|
|
122
|
-
|
|
123
|
-
// Adopt the updated styles
|
|
124
|
-
adoptStyles(instance.shadowRoot, componentClass.elementStyles);
|
|
119
|
+
applyInstanceStyles(instance);
|
|
125
120
|
} else {
|
|
126
121
|
// PolymerElement
|
|
127
122
|
|
|
@@ -362,11 +357,16 @@ export const ThemableMixin = (superClass) =>
|
|
|
362
357
|
* @protected
|
|
363
358
|
*/
|
|
364
359
|
static finalizeStyles(styles) {
|
|
365
|
-
//
|
|
366
|
-
//
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
360
|
+
// Preserve the styles the user supplied via the `static get styles()` getter
|
|
361
|
+
// so that they will always be injected before styles added by `CSSInjector`.
|
|
362
|
+
this.baseStyles = styles ? [styles].flat(Infinity) : [];
|
|
363
|
+
|
|
364
|
+
// Preserve the theme styles the user supplied via the `registerStyles()` API
|
|
365
|
+
// so that they will always be injected after styles added by `CSSInjector`.
|
|
366
|
+
this.themeStyles = this.getStylesForThis();
|
|
367
|
+
|
|
368
|
+
// Merged styles are stored in `elementStyles` and passed to `adoptStyles()`.
|
|
369
|
+
return [...this.baseStyles, ...this.themeStyles];
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
/**
|