@viewfly/scoped-css 0.0.4 → 0.0.5
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/bundles/css-modules.d.ts +2 -2
- package/bundles/index.esm.js +5 -9
- package/bundles/index.js +5 -9
- package/package.json +3 -3
package/bundles/css-modules.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSX, JSXChildNode } from '@viewfly/core';
|
|
2
2
|
declare module '@viewfly/core' {
|
|
3
3
|
namespace JSX {
|
|
4
4
|
interface Attributes<T extends object> {
|
|
@@ -7,4 +7,4 @@ declare module '@viewfly/core' {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
export declare function getClassNames(config: JSX.ClassNames, cssRecord: Record<string, string>): string;
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function withScopedCSS(css: Record<string, string>, render: () => JSXChildNode): () => JSXChildNode;
|
package/bundles/index.esm.js
CHANGED
|
@@ -53,6 +53,7 @@ function replaceCSSClass(template, cssMap) {
|
|
|
53
53
|
replaceCSSClass(children, cssMap);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
+
return template;
|
|
56
57
|
}
|
|
57
58
|
function getClassNames(config, cssRecord) {
|
|
58
59
|
const scopedClasses = [];
|
|
@@ -64,15 +65,10 @@ function getClassNames(config, cssRecord) {
|
|
|
64
65
|
});
|
|
65
66
|
return scopedClasses.join(' ');
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
return function (
|
|
69
|
-
|
|
70
|
-
return function () {
|
|
71
|
-
const template = componentRender();
|
|
72
|
-
replaceCSSClass(template, css);
|
|
73
|
-
return template;
|
|
74
|
-
};
|
|
68
|
+
function withScopedCSS(css, render) {
|
|
69
|
+
return function scopedCSS() {
|
|
70
|
+
return replaceCSSClass(render(), css);
|
|
75
71
|
};
|
|
76
72
|
}
|
|
77
73
|
|
|
78
|
-
export { getClassNames,
|
|
74
|
+
export { getClassNames, withScopedCSS };
|
package/bundles/index.js
CHANGED
|
@@ -55,6 +55,7 @@ function replaceCSSClass(template, cssMap) {
|
|
|
55
55
|
replaceCSSClass(children, cssMap);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
+
return template;
|
|
58
59
|
}
|
|
59
60
|
function getClassNames(config, cssRecord) {
|
|
60
61
|
const scopedClasses = [];
|
|
@@ -66,16 +67,11 @@ function getClassNames(config, cssRecord) {
|
|
|
66
67
|
});
|
|
67
68
|
return scopedClasses.join(' ');
|
|
68
69
|
}
|
|
69
|
-
function
|
|
70
|
-
return function (
|
|
71
|
-
|
|
72
|
-
return function () {
|
|
73
|
-
const template = componentRender();
|
|
74
|
-
replaceCSSClass(template, css);
|
|
75
|
-
return template;
|
|
76
|
-
};
|
|
70
|
+
function withScopedCSS(css, render) {
|
|
71
|
+
return function scopedCSS() {
|
|
72
|
+
return replaceCSSClass(render(), css);
|
|
77
73
|
};
|
|
78
74
|
}
|
|
79
75
|
|
|
80
76
|
exports.getClassNames = getClassNames;
|
|
81
|
-
exports.
|
|
77
|
+
exports.withScopedCSS = withScopedCSS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/scoped-css",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A library for supporting scoped style sheets in the Viewfly framework。",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"keywords": [],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@viewfly/core": "^0.0.
|
|
15
|
+
"@viewfly/core": "^0.0.5"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@rollup/plugin-commonjs": "^23.0.2",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"bugs": {
|
|
33
33
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "f3cb35e8a4c24063ea8431de7d001d801925e9d9"
|
|
36
36
|
}
|