@ai-slot/adapter-react 0.1.2 → 0.1.3
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 +1 -1
- package/package.json +3 -3
- package/README.zh-CN.md +0 -34
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @ai-slot/adapter-react
|
|
2
2
|
|
|
3
|
-
**English** | [简体中文](https://github.com/iannil/ai-slot-component/blob/master/packages/adapter-react/
|
|
3
|
+
**English** | [简体中文](https://github.com/iannil/ai-slot-component/blob/master/packages/adapter-react/README_zh-CN.md)
|
|
4
4
|
|
|
5
5
|
React renderer adapter for [ai-slot-component](https://github.com/iannil/ai-slot-component#readme): render validated component trees as real React components, plus an `<AiSlot>` wrapper around the Web Component.
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-slot/adapter-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React renderer adapter for ai-slot: render validated component trees as real React components.",
|
|
6
6
|
"keywords": [
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"sideEffects": false,
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@ai-slot/registry": "0.1.
|
|
36
|
-
"@ai-slot/runtime": "0.2.
|
|
35
|
+
"@ai-slot/registry": "0.1.3",
|
|
36
|
+
"@ai-slot/runtime": "0.2.2"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": ">=18",
|
package/README.zh-CN.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# @ai-slot/adapter-react
|
|
2
|
-
|
|
3
|
-
[English](https://github.com/iannil/ai-slot-component/blob/master/packages/adapter-react/README.md) | **简体中文**
|
|
4
|
-
|
|
5
|
-
[ai-slot-component](https://github.com/iannil/ai-slot-component#readme) 的 React 渲染适配器:将已校验的组件树渲染为真实 React 组件,并提供 Web Component 的 `<AiSlot>` 包装组件。
|
|
6
|
-
|
|
7
|
-
## 安装
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install @ai-slot/adapter-react
|
|
11
|
-
# 同级依赖:react >= 18、react-dom >= 18
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## 用法
|
|
15
|
-
|
|
16
|
-
```tsx
|
|
17
|
-
import { AiSlot, treeToReact } from "@ai-slot/adapter-react";
|
|
18
|
-
|
|
19
|
-
// 1. 将组件树节点映射为你的 React 组件
|
|
20
|
-
const tree = treeToReact({ Banner }, modelOutput);
|
|
21
|
-
|
|
22
|
-
// 2. 或使用包装组件,内部普通标记作为兜底内容
|
|
23
|
-
<AiSlot name="hero" src="/ai-render/hero" stream>
|
|
24
|
-
<h1>原始内容</h1>
|
|
25
|
-
</AiSlot>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## 文档
|
|
29
|
-
|
|
30
|
-
- [项目介绍](https://github.com/iannil/ai-slot-component#readme)
|
|
31
|
-
|
|
32
|
-
## 许可证
|
|
33
|
-
|
|
34
|
-
MIT
|