@jiujue/react-canvas-fiber 1.1.8 → 2.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 react-canvas-fiber contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,18 +1,20 @@
1
1
  # react-canvas-fiber
2
2
 
3
- 基于 `react-reconciler` 的 Canvas 自定义渲染器(2D),并集成 Yoga Flexbox 布局。
3
+ [中文](./README.zh.md.md) | English
4
4
 
5
- ## 安装
5
+ A Canvas custom renderer (2D) based on `react-reconciler`, integrated with Yoga Flexbox layout.
6
6
 
7
- 发布到 npm 后可直接安装:
7
+ ## Installation
8
+
9
+ Once published to npm, you can install it directly:
8
10
 
9
11
  ```bash
10
12
  pnpm add @jiujue/react-canvas-fiber
11
13
  ```
12
14
 
13
- 本仓库内通过 pnpm workspace 引用(见 demo)。
15
+ Inside this monorepo, it is referenced via pnpm workspace (see the demo).
14
16
 
15
- ## 使用
17
+ ## Usage
16
18
 
17
19
  ```tsx
18
20
  import { Canvas, Rect, Text, View } from '@jiujue/react-canvas-fiber'
@@ -29,29 +31,29 @@ export function Example() {
29
31
  }
30
32
  ```
31
33
 
32
- ## 已支持的节点
34
+ ## Supported Nodes
33
35
 
34
- - `View`:布局容器,可设置 `background/borderRadius`
35
- - `Rect`:圆角矩形(fill/stroke/lineWidth/borderRadius
36
- - `Text`:文本(text/color + font style 子集)
36
+ - `View`: layout container, supports `background/borderRadius`
37
+ - `Rect`: rounded rectangle (fill/stroke/lineWidth/borderRadius)
38
+ - `Text`: text (`text/color` + a subset of font styles)
37
39
 
38
- ## 布局(Yoga 子集)
40
+ ## Layout (Yoga Subset)
39
41
 
40
- 主要通过 `style` 提供:
42
+ Provided mainly via `style`:
41
43
 
42
- - 尺寸:`width/height/min/max`
43
- - Flex:`flexDirection/justifyContent/alignItems/flexGrow/flexShrink/flexBasis/flexWrap/gap`
44
- - 边距:`padding*`、`margin*`
45
- - 定位:`position/top/right/bottom/left`
44
+ - Size: `width/height/min/max`
45
+ - Flex: `flexDirection/justifyContent/alignItems/flexGrow/flexShrink/flexBasis/flexWrap/gap`
46
+ - Spacing: `padding*`, `margin*`
47
+ - Positioning: `position/top/right/bottom/left`
46
48
 
47
- ## 实现说明
49
+ ## Implementation Notes
48
50
 
49
- 详见 [docs/ARCHITECTURE.md](../../docs/ARCHITECTURE.md)
51
+ See [docs/ARCHITECTURE.md](../../docs/ARCHITECTURE.md).
50
52
 
51
- ## 参与贡献
53
+ ## Contributing
52
54
 
53
- 见仓库根目录的 [CONTRIBUTING.md](../../CONTRIBUTING.md)
55
+ See the repo root [CONTRIBUTING.md](../../CONTRIBUTING.md).
54
56
 
55
57
  ## License
56
58
 
57
- MIT,见 [LICENSE](../../LICENSE)
59
+ MIT. See [LICENSE](../../LICENSE).
package/README.zh.md ADDED
@@ -0,0 +1,59 @@
1
+ # react-canvas-fiber
2
+
3
+ 中文 | [English](./README.en.md)
4
+
5
+ 基于 `react-reconciler` 的 Canvas 自定义渲染器(2D),并集成 Yoga Flexbox 布局。
6
+
7
+ ## 安装
8
+
9
+ 发布到 npm 后可直接安装:
10
+
11
+ ```bash
12
+ pnpm add @jiujue/react-canvas-fiber
13
+ ```
14
+
15
+ 本仓库内通过 pnpm workspace 引用(见 demo)。
16
+
17
+ ## 使用
18
+
19
+ ```tsx
20
+ import { Canvas, Rect, Text, View } from '@jiujue/react-canvas-fiber'
21
+
22
+ export function Example() {
23
+ return (
24
+ <Canvas width={600} height={400} dpr={devicePixelRatio} clearColor="#0b1020">
25
+ <View style={{ width: 600, height: 400, padding: 16, flexDirection: 'column', gap: 12 }}>
26
+ <Text text="Hello" style={{ fontSize: 24, fontWeight: 700 }} color="#e6edf7" />
27
+ <Rect style={{ width: 180, height: 44 }} borderRadius={10} fill="#2b6cff" />
28
+ </View>
29
+ </Canvas>
30
+ )
31
+ }
32
+ ```
33
+
34
+ ## 已支持的节点
35
+
36
+ - `View`:布局容器,可设置 `background/borderRadius`
37
+ - `Rect`:圆角矩形(fill/stroke/lineWidth/borderRadius)
38
+ - `Text`:文本(text/color + font style 子集)
39
+
40
+ ## 布局(Yoga 子集)
41
+
42
+ 主要通过 `style` 提供:
43
+
44
+ - 尺寸:`width/height/min/max`
45
+ - Flex:`flexDirection/justifyContent/alignItems/flexGrow/flexShrink/flexBasis/flexWrap/gap`
46
+ - 边距:`padding*`、`margin*`
47
+ - 定位:`position/top/right/bottom/left`
48
+
49
+ ## 实现说明
50
+
51
+ 详见 [docs/ARCHITECTURE.md](../../docs/ARCHITECTURE.md)。
52
+
53
+ ## 参与贡献
54
+
55
+ 见仓库根目录的 [CONTRIBUTING.md](../../CONTRIBUTING.md)。
56
+
57
+ ## License
58
+
59
+ MIT,见 [LICENSE](../../LICENSE)。