@viewfly/scoped-css 0.0.1-alpha.10 → 0.0.1-alpha.12
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 +36 -1
- package/bundles/css-modules.d.ts +1 -1
- package/bundles/index.esm.js +2 -2
- package/bundles/index.js +2 -2
- package/package.json +3 -3
- package/src/css-modules.ts +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
Viewfly
|
|
2
2
|
================================
|
|
3
3
|
|
|
4
|
-
Viewfly
|
|
4
|
+
Viewfly 是一个简单、数据驱动的前端视图库。此包为 Viewfly 组件提供了 css 模块化的能力。
|
|
5
|
+
|
|
6
|
+
要使用 css 模块化能力,还需要在 webpack 配置中 css loader 的模块化支持,具体可参考相关文档。
|
|
7
|
+
|
|
8
|
+
## 安装
|
|
9
|
+
```
|
|
10
|
+
npm install @viewfly/scoped-css
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## API
|
|
14
|
+
|
|
15
|
+
### scopedCSS()
|
|
16
|
+
|
|
17
|
+
```css
|
|
18
|
+
/* app.module.css */
|
|
19
|
+
.app {
|
|
20
|
+
color: blue
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```jsx
|
|
25
|
+
import { scopedCSS } from '@viewfly/scoped-css'
|
|
26
|
+
|
|
27
|
+
import css from './app.module.css'
|
|
28
|
+
|
|
29
|
+
const App = scopedCSS(css, () => {
|
|
30
|
+
return () => {
|
|
31
|
+
return <div css="app">App</div>
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
scopedCSS 通过会识别标签的 css 属性,并替换为模拟化的 css class 类名。css 不仅可以支持字符串,还可以支持对象、数组、或数组内对象的组合。
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
完整文档请参考官方网站:[viewfly.org](https://viewfly.org)
|
package/bundles/css-modules.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ComponentSetup } from '@viewfly/core';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function scopedCSS<T extends ComponentSetup>(css: Record<string, string>, factory: T): T;
|
package/bundles/index.esm.js
CHANGED
|
@@ -61,7 +61,7 @@ function replaceCSSClass(template, cssMap) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function scopedCSS(css, factory) {
|
|
65
65
|
return function (props) {
|
|
66
66
|
const componentRender = factory(props);
|
|
67
67
|
return function () {
|
|
@@ -72,4 +72,4 @@ function scopedCss(css, factory) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export {
|
|
75
|
+
export { scopedCSS };
|
package/bundles/index.js
CHANGED
|
@@ -63,7 +63,7 @@ function replaceCSSClass(template, cssMap) {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function scopedCSS(css, factory) {
|
|
67
67
|
return function (props) {
|
|
68
68
|
const componentRender = factory(props);
|
|
69
69
|
return function () {
|
|
@@ -74,4 +74,4 @@ function scopedCss(css, factory) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
exports.
|
|
77
|
+
exports.scopedCSS = scopedCSS;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viewfly/scoped-css",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.12",
|
|
4
4
|
"description": "Viewfly is a simple and easy-to-use JavaScript framework with an intuitive development experience",
|
|
5
5
|
"main": "./bundles/index.js",
|
|
6
6
|
"module": "./bundles/index.esm.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"keywords": [],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@viewfly/core": "^0.0.1-alpha.
|
|
18
|
+
"@viewfly/core": "^0.0.1-alpha.12"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@rollup/plugin-commonjs": "^23.0.2",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"bugs": {
|
|
36
36
|
"url": "https://github.com/viewfly/viewfly.git/issues"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "e5fdc69779bbfd6a1128b98a30d8732dbda7fcd3"
|
|
39
39
|
}
|
package/src/css-modules.ts
CHANGED
|
@@ -59,7 +59,7 @@ function replaceCSSClass(template, cssMap: Record<string, string>) {
|
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
export function
|
|
62
|
+
export function scopedCSS<T extends ComponentSetup>(css: Record<string, string>, factory: T): T {
|
|
63
63
|
return function (props: any) {
|
|
64
64
|
const componentRender = factory(props)
|
|
65
65
|
return function () {
|