@inradius/solid-wc-css-mixin 1.0.2 → 1.0.4
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/README.md +2 -2
- package/dist/index.cjs +15 -1
- package/dist/index.js +13 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# @inradius/solid-wc-css-mixin
|
|
2
|
-
 
|
|
2
|
+
  
|
|
3
3
|
|
|
4
4
|
A lightweight mixin for [component-register](https://www.npmjs.com/package/component-register) that allows you to inject computed or inlined CSS directly into a Web Component's **Shadow Root** using Constructable Stylesheets.
|
|
5
5
|
|
|
@@ -45,4 +45,4 @@ The mixin creates a new `CSSStyleSheet` object and pushes it into the element's
|
|
|
45
45
|
- **Peer Dependencies:** This package is designed to be used with `component-register`.
|
|
46
46
|
|
|
47
47
|
## License
|
|
48
|
-
MIT
|
|
48
|
+
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
const componentRegister = require("component-register");
|
|
3
|
+
const withCSS = (styles) => componentRegister.createMixin((options) => {
|
|
4
|
+
const { element } = options;
|
|
5
|
+
const stylesheet = new CSSStyleSheet();
|
|
6
|
+
if ("adoptedStyleSheets" in element.renderRoot) {
|
|
7
|
+
stylesheet.replaceSync(styles);
|
|
8
|
+
element.renderRoot.adoptedStyleSheets = [
|
|
9
|
+
...element.renderRoot.adoptedStyleSheets,
|
|
10
|
+
stylesheet
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
return { ...options, element };
|
|
14
|
+
});
|
|
15
|
+
module.exports = withCSS;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import { createMixin
|
|
2
|
-
const
|
|
3
|
-
const { element
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createMixin } from "component-register";
|
|
2
|
+
const withCSS = (styles) => createMixin((options) => {
|
|
3
|
+
const { element } = options;
|
|
4
|
+
const stylesheet = new CSSStyleSheet();
|
|
5
|
+
if ("adoptedStyleSheets" in element.renderRoot) {
|
|
6
|
+
stylesheet.replaceSync(styles);
|
|
7
|
+
element.renderRoot.adoptedStyleSheets = [
|
|
8
|
+
...element.renderRoot.adoptedStyleSheets,
|
|
9
|
+
stylesheet
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
return { ...options, element };
|
|
8
13
|
});
|
|
9
14
|
export {
|
|
10
|
-
|
|
15
|
+
withCSS as default
|
|
11
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inradius/solid-wc-css-mixin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Travis Stroud <travis.unfasten577@travisstroud.me>",
|
|
6
6
|
"description": "A Solid.js CSS web component mixin.",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"vite": "^5.4.0",
|
|
43
43
|
"vite-plugin-dts": "^4.0.0",
|
|
44
44
|
"vitest": "^2.1.0",
|
|
45
|
-
"@inradius/solid-wc-utils-config": "0.
|
|
45
|
+
"@inradius/solid-wc-utils-config": "0.1.1"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"component-register": "^0.8.8"
|