@michaeltangseng/schemaai 0.0.1
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/dist/core/EditorStore.d.ts +4 -0
- package/dist/core/EditorStore.d.ts.map +1 -0
- package/dist/core/EditorStore.js +1007 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/renderer/Renderer.d.ts +21 -0
- package/dist/renderer/Renderer.d.ts.map +1 -0
- package/dist/renderer/Renderer.js +25 -0
- package/docs/build-dist.md +83 -0
- package/docs/cursor-rule-low-code-engine.mdc +66 -0
- package/docs/migrate-plan.md +145 -0
- package/docs/public-api.md +297 -0
- package/docs/publish-to-npm.md +148 -0
- package/package.json +34 -0
- package/src/core/EditorStore.tsx +1171 -0
- package/src/index.ts +7 -0
- package/src/renderer/Renderer.tsx +82 -0
- package/tests/schemaai-react-demo/index.html +13 -0
- package/tests/schemaai-react-demo/package.json +21 -0
- package/tests/schemaai-react-demo/pnpm-lock.yaml +808 -0
- package/tests/schemaai-react-demo/src/App.tsx +47 -0
- package/tests/schemaai-react-demo/src/main.tsx +10 -0
- package/tests/schemaai-react-demo/tsconfig.json +21 -0
- package/tests/schemaai-react-demo/vite.config.ts +10 -0
- package/tsconfig.build.json +22 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import SchemaAIRenderer from '../../../src/renderer/Renderer';
|
|
3
|
+
// 如需测试通过 npm 包名导入(@michaeltangseng/schemaai),
|
|
4
|
+
// 请在发布到 npm 并在独立项目中安装后再切换为包名导入。
|
|
5
|
+
|
|
6
|
+
// 简单的 NodeSchema 示例(类型用 any,避免直接依赖主工程的类型声明)
|
|
7
|
+
const demoSchema: any = {
|
|
8
|
+
id: 'root',
|
|
9
|
+
type: 'Container',
|
|
10
|
+
props: {
|
|
11
|
+
title: 'Hello schemaAI',
|
|
12
|
+
},
|
|
13
|
+
style: {
|
|
14
|
+
padding: '16px',
|
|
15
|
+
backgroundColor: '#f9fafb',
|
|
16
|
+
border: '1px solid #e5e7eb',
|
|
17
|
+
borderRadius: '8px',
|
|
18
|
+
},
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
id: 'text-1',
|
|
22
|
+
type: 'PluginText',
|
|
23
|
+
props: {
|
|
24
|
+
text: '这是通过 schema 渲染出来的文本。',
|
|
25
|
+
},
|
|
26
|
+
style: {
|
|
27
|
+
fontSize: '14px',
|
|
28
|
+
color: '#374151',
|
|
29
|
+
marginTop: '8px',
|
|
30
|
+
},
|
|
31
|
+
children: [],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const App: React.FC = () => {
|
|
37
|
+
return (
|
|
38
|
+
<div style={{ padding: 24 }}>
|
|
39
|
+
<h1>schemaAI React Demo</h1>
|
|
40
|
+
<p>下面是使用 schemaAI Renderer 渲染的一个最小 NodeSchema 示例:</p>
|
|
41
|
+
<div style={{ marginTop: 16 }}>
|
|
42
|
+
<SchemaAIRenderer schema={demoSchema} />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
6
|
+
"allowJs": false,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"strict": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"jsx": "react-jsx"
|
|
18
|
+
},
|
|
19
|
+
"include": ["src"]
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "dist",
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationMap": true,
|
|
6
|
+
"emitDeclarationOnly": false,
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
"moduleResolution": "Node",
|
|
11
|
+
"jsx": "react-jsx",
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"strict": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["src"],
|
|
17
|
+
"exclude": [
|
|
18
|
+
"src/core/EditorStore.tsx"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|