@tarojs/parse-css-to-stylesheet 0.0.21 → 0.0.22

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 +6 -19
  2. package/package.json +14 -14
package/README.md CHANGED
@@ -2,26 +2,13 @@
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
 
9
- 1. 解析 React 语法树,并将其中的 JSX 部分转为类 DOM 结构的树
10
- 2. 解析样式文件
11
- 3. 利用解析后的样式文件中的选择器去反查出第一步 DOM 树中的节点,并收集节点对应的样式块
12
- 4. 根据节点上的选择器特异性及样式顺序、import 等计算节点样式层叠
13
- 5. 遍历节点的所有父节点,计算样式继承
9
+ ```typescript
10
+ import { parse } from '@tarojs/parse-css-to-stylesheet'
14
11
 
15
- ## 功能特性
12
+ const code = parse(jsxCode, [cssCode1, cssCode2, ...])
16
13
 
17
- ### JSX DOM 树构造
18
-
19
- - [x] 支持函数组件
20
- - [x] 支持类组件
21
- - [x] 支持 JSX 分离的写法
22
- - [ ] 支持遍历子组件
23
-
24
- ### 样式计算
25
-
26
- - [x] 样式层叠
27
- - [x] 样式继承
14
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/parse-css-to-stylesheet",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
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.21",
59
- "@tarojs/parse-css-to-stylesheet-darwin-x64": "0.0.21",
60
- "@tarojs/parse-css-to-stylesheet-linux-x64-gnu": "0.0.21",
61
- "@tarojs/parse-css-to-stylesheet-darwin-arm64": "0.0.21",
62
- "@tarojs/parse-css-to-stylesheet-android-arm64": "0.0.21",
63
- "@tarojs/parse-css-to-stylesheet-linux-arm64-gnu": "0.0.21",
64
- "@tarojs/parse-css-to-stylesheet-linux-arm64-musl": "0.0.21",
65
- "@tarojs/parse-css-to-stylesheet-win32-arm64-msvc": "0.0.21",
66
- "@tarojs/parse-css-to-stylesheet-linux-arm-gnueabihf": "0.0.21",
67
- "@tarojs/parse-css-to-stylesheet-linux-x64-musl": "0.0.21",
68
- "@tarojs/parse-css-to-stylesheet-win32-ia32-msvc": "0.0.21",
69
- "@tarojs/parse-css-to-stylesheet-android-arm-eabi": "0.0.21",
70
- "@tarojs/parse-css-to-stylesheet-darwin-universal": "0.0.21"
58
+ "@tarojs/parse-css-to-stylesheet-win32-x64-msvc": "0.0.22",
59
+ "@tarojs/parse-css-to-stylesheet-darwin-x64": "0.0.22",
60
+ "@tarojs/parse-css-to-stylesheet-linux-x64-gnu": "0.0.22",
61
+ "@tarojs/parse-css-to-stylesheet-darwin-arm64": "0.0.22",
62
+ "@tarojs/parse-css-to-stylesheet-android-arm64": "0.0.22",
63
+ "@tarojs/parse-css-to-stylesheet-linux-arm64-gnu": "0.0.22",
64
+ "@tarojs/parse-css-to-stylesheet-linux-arm64-musl": "0.0.22",
65
+ "@tarojs/parse-css-to-stylesheet-win32-arm64-msvc": "0.0.22",
66
+ "@tarojs/parse-css-to-stylesheet-linux-arm-gnueabihf": "0.0.22",
67
+ "@tarojs/parse-css-to-stylesheet-linux-x64-musl": "0.0.22",
68
+ "@tarojs/parse-css-to-stylesheet-win32-ia32-msvc": "0.0.22",
69
+ "@tarojs/parse-css-to-stylesheet-android-arm-eabi": "0.0.22",
70
+ "@tarojs/parse-css-to-stylesheet-darwin-universal": "0.0.22"
71
71
  }
72
72
  }