@tarojs/parse-css-to-stylesheet 0.0.35 → 0.0.37

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.
Files changed (2) hide show
  1. package/README.md +49 -4
  2. package/package.json +14 -14
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 简介
4
4
 
5
- 解析 React 组件与对应的 CSS 文件,为每一个 React 节点计算样式最终样式,应用于 React Native 、鸿蒙等不支持 CSS 写法的场景,目前仅支持类名选择器。
5
+ 解析 React 组件与对应的 CSS 文件,为每一个 React 节点计算样式最终样式,应用于 React Native 、鸿蒙等不支持 CSS 写法的场景
6
6
 
7
7
  ## 使用方式
8
8
 
@@ -10,8 +10,53 @@
10
10
  import { parse } from '@tarojs/parse-css-to-stylesheet'
11
11
 
12
12
  // Harmony
13
- const code = parse(jsxCode, [cssCode1, cssCode2, ...], "Harmony")
14
- // ReactNative
15
- // const code = parse(jsxCode, [cssCode1, cssCode2, ...], "ReactNative")
13
+ const code = parse(jsxCode, [cssCode1, cssCode2, ...], {
14
+ platformString: 'Harmony',
15
+ isEnableNesting: true // 支持生成嵌套选择器
16
+ })
17
+ ```
18
+
19
+ ## 支持选择器
20
+
21
+ #### 类选择器
22
+
23
+ ```css
24
+ .item {
25
+ /* ... */
26
+ }
27
+ ```
28
+
29
+ #### 后代组合器
30
+
31
+ ```css
32
+ .parent .child {
33
+ /* ... */
34
+ }
35
+ ```
36
+
37
+ #### 直接子代选择器
38
+
39
+ ```css
40
+ .parent > .child {
41
+ /* ... */
42
+ }
43
+ ```
44
+
45
+ #### 多类选择器
46
+
47
+ ```css
48
+ .child1.child2 {
49
+ /* ... */
50
+ }
51
+ ```
52
+
53
+ #### 伪类
16
54
 
55
+ ```css
56
+ .child1::before {
57
+ /* ... */
58
+ }
59
+ .child1::after {
60
+ /* ... */
61
+ }
17
62
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/parse-css-to-stylesheet",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "napi": {
@@ -55,18 +55,18 @@
55
55
  "packageManager": "yarn@3.6.4",
56
56
  "repository": "https://github.com/NervJS/parse-css-to-stylesheet",
57
57
  "optionalDependencies": {
58
- "@tarojs/parse-css-to-stylesheet-win32-x64-msvc": "0.0.35",
59
- "@tarojs/parse-css-to-stylesheet-darwin-x64": "0.0.35",
60
- "@tarojs/parse-css-to-stylesheet-linux-x64-gnu": "0.0.35",
61
- "@tarojs/parse-css-to-stylesheet-darwin-arm64": "0.0.35",
62
- "@tarojs/parse-css-to-stylesheet-android-arm64": "0.0.35",
63
- "@tarojs/parse-css-to-stylesheet-linux-arm64-gnu": "0.0.35",
64
- "@tarojs/parse-css-to-stylesheet-linux-arm64-musl": "0.0.35",
65
- "@tarojs/parse-css-to-stylesheet-win32-arm64-msvc": "0.0.35",
66
- "@tarojs/parse-css-to-stylesheet-linux-arm-gnueabihf": "0.0.35",
67
- "@tarojs/parse-css-to-stylesheet-linux-x64-musl": "0.0.35",
68
- "@tarojs/parse-css-to-stylesheet-win32-ia32-msvc": "0.0.35",
69
- "@tarojs/parse-css-to-stylesheet-android-arm-eabi": "0.0.35",
70
- "@tarojs/parse-css-to-stylesheet-darwin-universal": "0.0.35"
58
+ "@tarojs/parse-css-to-stylesheet-win32-x64-msvc": "0.0.37",
59
+ "@tarojs/parse-css-to-stylesheet-darwin-x64": "0.0.37",
60
+ "@tarojs/parse-css-to-stylesheet-linux-x64-gnu": "0.0.37",
61
+ "@tarojs/parse-css-to-stylesheet-darwin-arm64": "0.0.37",
62
+ "@tarojs/parse-css-to-stylesheet-android-arm64": "0.0.37",
63
+ "@tarojs/parse-css-to-stylesheet-linux-arm64-gnu": "0.0.37",
64
+ "@tarojs/parse-css-to-stylesheet-linux-arm64-musl": "0.0.37",
65
+ "@tarojs/parse-css-to-stylesheet-win32-arm64-msvc": "0.0.37",
66
+ "@tarojs/parse-css-to-stylesheet-linux-arm-gnueabihf": "0.0.37",
67
+ "@tarojs/parse-css-to-stylesheet-linux-x64-musl": "0.0.37",
68
+ "@tarojs/parse-css-to-stylesheet-win32-ia32-msvc": "0.0.37",
69
+ "@tarojs/parse-css-to-stylesheet-android-arm-eabi": "0.0.37",
70
+ "@tarojs/parse-css-to-stylesheet-darwin-universal": "0.0.37"
71
71
  }
72
72
  }