@vaadin/vaadin-themable-mixin 25.0.0-beta2 → 25.0.0-beta3
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/lumo-injection-mixin.js +3 -6
- package/package.json +5 -5
- package/src/lumo-injector.js +10 -3
package/lumo-injection-mixin.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) 2021 - 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 { LumoInjector } from './src/lumo-injector.js';
|
|
6
|
+
import { getLumoInjectorPropName, LumoInjector } from './src/lumo-injector.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @type {Set<string>}
|
|
@@ -36,7 +36,7 @@ export const LumoInjectionMixin = (superClass) =>
|
|
|
36
36
|
static finalize() {
|
|
37
37
|
super.finalize();
|
|
38
38
|
|
|
39
|
-
const propName = this.
|
|
39
|
+
const propName = getLumoInjectorPropName(this.lumoInjector);
|
|
40
40
|
|
|
41
41
|
// Prevent registering same property twice when a class extends
|
|
42
42
|
// another class using this mixin, since `finalize()` is called
|
|
@@ -57,12 +57,9 @@ export const LumoInjectionMixin = (superClass) =>
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
static get lumoInjectPropName() {
|
|
61
|
-
return `--_lumo-${this.is}-inject`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
60
|
static get lumoInjector() {
|
|
65
61
|
return {
|
|
62
|
+
is: this.is,
|
|
66
63
|
includeBaseStyles: false,
|
|
67
64
|
};
|
|
68
65
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/vaadin-themable-mixin",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-beta3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
36
|
-
"@vaadin/component-base": "25.0.0-
|
|
36
|
+
"@vaadin/component-base": "25.0.0-beta3",
|
|
37
37
|
"lit": "^3.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@polymer/polymer": "^3.0.0",
|
|
41
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
42
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
41
|
+
"@vaadin/chai-plugins": "25.0.0-beta3",
|
|
42
|
+
"@vaadin/test-runner-commands": "25.0.0-beta3",
|
|
43
43
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
44
44
|
"sinon": "^21.0.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "4b2006b0e2f4fc131f5483223b852d34224e7b9a"
|
|
47
47
|
}
|
package/src/lumo-injector.js
CHANGED
|
@@ -7,6 +7,10 @@ import { CSSPropertyObserver } from './css-property-observer.js';
|
|
|
7
7
|
import { injectLumoStyleSheet, removeLumoStyleSheet } from './css-utils.js';
|
|
8
8
|
import { parseStyleSheets } from './lumo-modules.js';
|
|
9
9
|
|
|
10
|
+
export function getLumoInjectorPropName(lumoInjector) {
|
|
11
|
+
return `--_lumo-${lumoInjector.is}-inject`;
|
|
12
|
+
}
|
|
13
|
+
|
|
10
14
|
/**
|
|
11
15
|
* Implements auto-injection of CSS styles from document style sheets
|
|
12
16
|
* into the Shadow DOM of corresponding Vaadin components.
|
|
@@ -103,7 +107,8 @@ export class LumoInjector {
|
|
|
103
107
|
* @param {HTMLElement} component
|
|
104
108
|
*/
|
|
105
109
|
componentConnected(component) {
|
|
106
|
-
const {
|
|
110
|
+
const { lumoInjector } = component.constructor;
|
|
111
|
+
const { is: tagName } = lumoInjector;
|
|
107
112
|
|
|
108
113
|
this.#componentsByTag.set(tagName, this.#componentsByTag.get(tagName) ?? new Set());
|
|
109
114
|
this.#componentsByTag.get(tagName).add(component);
|
|
@@ -117,7 +122,9 @@ export class LumoInjector {
|
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
this.#initStyleSheet(tagName);
|
|
120
|
-
|
|
125
|
+
|
|
126
|
+
const propName = getLumoInjectorPropName(lumoInjector);
|
|
127
|
+
this.#cssPropertyObserver.observe(propName);
|
|
121
128
|
}
|
|
122
129
|
|
|
123
130
|
/**
|
|
@@ -127,7 +134,7 @@ export class LumoInjector {
|
|
|
127
134
|
* @param {HTMLElement} component
|
|
128
135
|
*/
|
|
129
136
|
componentDisconnected(component) {
|
|
130
|
-
const { is: tagName } = component.constructor;
|
|
137
|
+
const { is: tagName } = component.constructor.lumoInjector;
|
|
131
138
|
this.#componentsByTag.get(tagName)?.delete(component);
|
|
132
139
|
|
|
133
140
|
removeLumoStyleSheet(component);
|