This commit is contained in:
xion 2025-01-06 10:44:25 +08:00
parent 59b4683b64
commit 73de223d56
8 changed files with 1151 additions and 925 deletions

View File

@ -5,7 +5,8 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "vite build",
"dev:kv": "cross-env VITE_USE_KV=true vite",
"lint": "eslint .", "lint": "eslint .",
"preview": "vite preview", "preview": "vite preview",
"prune": "pnpm store prune && rimraf node_modules/.vite", "prune": "pnpm store prune && rimraf node_modules/.vite",
@ -13,18 +14,18 @@
"pub": "pnpm run build && pnpm run deploy" "pub": "pnpm run build && pnpm run deploy"
}, },
"dependencies": { "dependencies": {
"@kevisual/container": "0.0.2-alpha.1",
"@abearxiong/flows": "0.0.1-alpha.9", "@abearxiong/flows": "0.0.1-alpha.9",
"@abearxiong/ui": "0.0.1-alpha.0", "@abearxiong/ui": "0.0.1-alpha.0",
"@ant-design/icons": "^5.5.1", "@ant-design/icons": "^5.5.2",
"@icon-park/react": "^1.4.2", "@icon-park/react": "^1.4.2",
"@kevisual/codemirror": "^0.0.2", "@kevisual/codemirror": "^0.0.2",
"@kevisual/container": "1.0.0",
"@kevisual/query": "^0.0.6", "@kevisual/query": "^0.0.6",
"@kevisual/ui": "^0.0.2", "@kevisual/ui": "^0.0.2",
"@monaco-editor/react": "^4.6.0", "@monaco-editor/react": "^4.6.0",
"@uiw/react-textarea-code-editor": "^3.1.0", "@uiw/react-textarea-code-editor": "^3.1.0",
"@xyflow/react": "^12.3.2", "@xyflow/react": "^12.3.6",
"antd": "^5.21.4", "antd": "^5.22.7",
"classnames": "^2.5.1", "classnames": "^2.5.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"copy-to-clipboard": "^3.3.3", "copy-to-clipboard": "^3.3.3",
@ -32,42 +33,43 @@
"eventemitter3": "^5.0.1", "eventemitter3": "^5.0.1",
"immer": "^10.1.1", "immer": "^10.1.1",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"marked": "^14.1.3", "marked": "^15.0.5",
"nanoid": "^5.0.7", "nanoid": "^5.0.9",
"react": "^18.3.1", "react": "18.3.1",
"react-dom": "^18.3.1", "react-dom": "18.3.1",
"react-resizable-panels": "^2.1.4", "react-resizable-panels": "^2.1.7",
"react-router": "^6.27.0", "react-router": "^7.1.1",
"react-router-dom": "^6.27.0", "react-router-dom": "^7.1.1",
"react-toastify": "^10.0.6", "react-toastify": "^11.0.2",
"vite-plugin-tsconfig-paths": "^1.4.1", "vite-plugin-tsconfig-paths": "^1.4.1",
"zustand": "^5.0.0" "zustand": "^5.0.2"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.13.0", "@eslint/js": "^9.17.0",
"@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/typography": "^0.5.15", "@tailwindcss/typography": "^0.5.15",
"@types/d3": "^7.4.3", "@types/d3": "^7.4.3",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^22.7.7", "@types/node": "^22.10.5",
"@types/path-browserify": "^1.0.3", "@types/path-browserify": "^1.0.3",
"@types/react": "^18.3.11", "@types/react": "^19.0.2",
"@types/react-dom": "^18.3.1", "@types/react-dom": "^19.0.2",
"@vitejs/plugin-react": "^4.3.3", "@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"eslint": "^9.13.0", "cross-env": "^7.0.3",
"eslint-plugin-react-hooks": "^5.1.0-rc.0", "eslint": "^9.17.0",
"eslint-plugin-react-refresh": "^0.4.12", "eslint-plugin-react-hooks": "^5.1.0",
"globals": "^15.11.0", "eslint-plugin-react-refresh": "^0.4.16",
"globals": "^15.14.0",
"path-browserify": "^1.0.1", "path-browserify": "^1.0.1",
"postcss-import": "^16.1.0", "postcss-import": "^16.1.0",
"pretty-bytes": "^6.1.1", "pretty-bytes": "^6.1.1",
"react-is": "^18.3.1", "react-is": "18.3.1",
"tailwind-merge": "^2.5.4", "tailwind-merge": "^2.6.0",
"tailwindcss": "^3.4.14", "tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7", "tailwindcss-animate": "^1.0.7",
"typescript": "^5.6.3", "typescript": "^5.7.2",
"typescript-eslint": "^8.10.0", "typescript-eslint": "^8.19.0",
"vite": "^5.4.9" "vite": "^6.0.7"
} }
} }

1959
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ import { App as UserAppApp } from './pages/app';
import { App as FileApp } from './pages/file'; import { App as FileApp } from './pages/file';
import { App as OrgApp } from './pages/org'; import { App as OrgApp } from './pages/org';
import '@kevisual/container/container.css'; // import '@kevisual/container/container.css';
export const App = () => { export const App = () => {
return ( return (

View File

@ -27,7 +27,7 @@ import { NodeProperties } from './properties/NodeProperties';
import { emitter } from '@kevisual/container'; import { emitter } from '@kevisual/container';
// router: Router // router: Router
const nodeTypes = { const nodeTypes = {
container: Container, // container: Container,
}; };
export const Flow = () => { export const Flow = () => {
@ -139,7 +139,7 @@ const ReactFlowApp = () => {
message.error('developing'); message.error('developing');
}, },
}); });
const { onNeedAdd, onAdd, onMouseMove, adding } = useAddNode(); // const { onNeedAdd, onAdd, onMouseMove, adding } = useAddNode();
const onSave = useCallback(() => { const onSave = useCallback(() => {
panelStore.saveNodesEdges({ panelStore.saveNodesEdges({
nodes, nodes,
@ -171,15 +171,15 @@ const ReactFlowApp = () => {
e.preventDefault(); e.preventDefault();
}} }}
onPaneClick={(e) => { onPaneClick={(e) => {
if (adding) { // if (adding) {
onAdd(); // onAdd();
} // }
}} }}
onNodeContextMenu={(e, node) => { onNodeContextMenu={(e, node) => {
console.log('context menu', e, node); console.log('context menu', e, node);
onContextMenu(e as any, node); onContextMenu(e as any, node);
}} }}
onMouseMove={(e) => onMouseMove(e)} // onMouseMove={(e) => onMouseMove(e)}
onClick={(e) => { onClick={(e) => {
onClose(); onClose();
}}> }}>
@ -194,7 +194,7 @@ const ReactFlowApp = () => {
<Button <Button
icon={<PlusOutlined />} icon={<PlusOutlined />}
onClick={(e) => { onClick={(e) => {
onNeedAdd({ id: 'flow' + generateId(), data: { label: '容器' }, type: 'container' }, e); // onNeedAdd({ id: 'flow' + generateId(), data: { label: '容器' }, type: 'container' }, e);
}}></Button> }}></Button>
</Tooltip> </Tooltip>
<Tooltip title='save'> <Tooltip title='save'>

View File

@ -4,7 +4,7 @@ import { usePanelStore } from '../store';
import { useShallow } from 'zustand/react/shallow'; import { useShallow } from 'zustand/react/shallow';
import { useEffect, useRef } from 'react'; import { useEffect, useRef } from 'react';
import { DialogModal } from '@kevisual/ui'; import { DialogModal } from '@kevisual/ui';
import '@kevisual/ui'; // import '@kevisual/ui';
export const App = () => { export const App = () => {
const param = useParams(); const param = useParams();
const id = param.id; const id = param.id;

View File

@ -13,11 +13,11 @@ export const NodeProperties = () => {
const reactflow = useReactFlow(); const reactflow = useReactFlow();
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [form] = Form.useForm(); const [form] = Form.useForm();
const panelStore = usePanelStore((state) => { const panelStore = usePanelStore(useShallow((state) => {
return { return {
updateNodeData: state.updateNodeData, updateNodeData: state.updateNodeData,
}; };
}); }));
const aiStore = useAiStore( const aiStore = useAiStore(
useShallow((state) => { useShallow((state) => {
return { return {
@ -36,7 +36,7 @@ export const NodeProperties = () => {
return item; return item;
}); });
// console.log('newNodes', newNodes); // console.log('newNodes', newNodes);
// state.setNodes(newNodes); // 会丢失数据因为最终没有调用context的setNodes方法 state.setNodes(newNodes); // 会丢失数据因为最终没有调用context的setNodes方法
emitter.emit('setNodes', newNodes); emitter.emit('setNodes', newNodes);
}; };
return { return {

2
theme

@ -1 +1 @@
Subproject commit c5a509e4e8a63b19e4e5fbbc5a142d550957ed8a Subproject commit 6c8effeaf330690d23ac4810cec84caface2ca5f

View File

@ -5,6 +5,7 @@ import autoprefixer from 'autoprefixer';
import path from 'path'; import path from 'path';
import nesting from 'tailwindcss/nesting'; import nesting from 'tailwindcss/nesting';
const isDev = process.env.NODE_ENV === 'development'; const isDev = process.env.NODE_ENV === 'development';
const isKV = process.env.VITE_USE_KV === 'true';
const unamiPlugin = { const unamiPlugin = {
name: 'html-transform', name: 'html-transform',
transformIndexHtml(html: string) { transformIndexHtml(html: string) {
@ -18,17 +19,36 @@ const plugins = [];
if (!isDev) { if (!isDev) {
plugins.push(unamiPlugin); plugins.push(unamiPlugin);
} }
let proxy = {};
if (isKV) {
proxy = {
'/api': {
target: 'https://envision.xiongxiao.me',
changeOrigin: true,
rewrite: (path: any) => path.replace(/^\/api/, '/api'),
},
'/api/router': {
target: 'wss://envision.xiongxiao.me',
changeOrigin: true,
ws: true,
rewriteWsOrigin: true,
rewrite: (path: any) => path.replace(/^\/api/, '/api'),
},
'/resources': {
target: 'https://envision.xiongxiao.me',
changeOrigin: true,
rewrite: (path: any) => path.replace(/^\/resources/, '/resources'),
},
};
}
// https://vitejs.dev/config/ // https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [react(), ...plugins], plugins: [react(), ...plugins],
css: { css: {
postcss: { postcss: {
plugins: [ // @ts-ignore
nesting, // 作用是可以使用@import导入css文件 plugins: [nesting, tailwindcss, autoprefixer],
tailwindcss,
autoprefixer,
],
}, },
}, },
resolve: { resolve: {
@ -60,6 +80,7 @@ export default defineConfig({
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/resources/, '/resources'), rewrite: (path) => path.replace(/^\/resources/, '/resources'),
}, },
...proxy,
}, },
}, },
}); });