diff --git a/.gitignore b/.gitignore index cd68f14..c2c38da 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,5 @@ __screenshots__/ # Vite *.timestamp-*-*.mjs + +AGENTS.md diff --git a/README.md b/README.md index 3524b70..5a3c13e 100644 --- a/README.md +++ b/README.md @@ -1,48 +1,93 @@ # my-v0 -This template should help get you started developing with Vue 3 in Vite. +Vue 3 + Vite 大屏低代码编辑器前端 -## Recommended IDE Setup +## 开发 -[VS Code](https://code.visualstudio.com/) + [Vue (Official)](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur). - -## Recommended Browser Setup - -- Chromium-based browsers (Chrome, Edge, Brave, etc.): - - [Vue.js devtools](https://chromewebstore.google.com/detail/vuejs-devtools/nhdogjmejiglipccpnnnanhbledajbpd) - - [Turn on Custom Object Formatter in Chrome DevTools](http://bit.ly/object-formatters) -- Firefox: - - [Vue.js devtools](https://addons.mozilla.org/en-US/firefox/addon/vue-js-devtools/) - - [Turn on Custom Object Formatter in Firefox DevTools](https://fxdx.dev/firefox-devtools-custom-object-formatters/) - -## Type Support for `.vue` Imports in TS - -TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types. - -## Customize configuration - -See [Vite Configuration Reference](https://vite.dev/config/). - -## Project Setup +Node `^22.18.0 || >=24.12.0`,包管理器用 pnpm。 ```sh pnpm install -``` - -### Compile and Hot-Reload for Development - -```sh pnpm dev ``` -### Type-Check, Compile and Minify for Production - ```sh -pnpm build +pnpm build # vue-tsc --build + vite build +pnpm type-check +pnpm preview +pnpm lint # oxlint + eslint(都会 --fix) +pnpm format # prettier --write src/ ``` -### Lint with [ESLint](https://eslint.org/) +## 项目目标 -```sh -pnpm lint -``` +### 一、编辑器核心架构 + +- ~~项目初始化与基础布局~~ +- ~~工具栏实现~~ +- ~~物料面板(可扩展架构)~~ +- ~~图层面板~~ +- ~~插件化注册机制~~ +- ~~物料 DSL 设计~~ +- ~~拖拽渲染流程~~ +- ~~节点拖动与缩放~~ +- ~~框选与多选操作~~ +- ~~画布标尺接入~~ +- ~~图层排序与画布层级联动~~ +- ~~页面 DSL 设计与落地~~ +- ~~属性面板~~ +- ~~右键菜单~~ +- ~~组合式函数拆分~~ +- ~~撤销重做基础能力~~ +- ~~批处理与历史记录管理~~ +- ~~ECharts 图表物料接入~~ + +### 二、代码与数据能力 + +- ~~网页代码编辑器接入~~ +- ~~页面 Schema 导入导出与实时编辑~~ +- 静态数据源 +- API 数据源 +- 数据源管理界面 +- API 数据源调试 +- 加载、刷新与请求复用 + +### 三、运行时与预览能力 + +- 大屏自适应预览 +- 页面持久化与独立访问 +- 运行时上下文 + +### 四、事件系统 + +- 事件调度机制 +- 事件配置面板 +- 跨组件事件联动 +- 事件函数编辑体验优化 +- 代码沙箱 +- 物料可触发事件声明 + +### 五、AI Agent 核心能力 + +- 大模型接入与调试 +- 提示词工程 +- 上下文工程 +- 结构化输出 +- 工具调用 +- Agent Loop +- 模型记忆 +- RAG 与文档处理 +- Agentic RAG +- Skill 体系 +- MCP +- 流程编排(LangGraph) +- 状态管理与人工介入 +- 子图与节点重试 +- Responses API + +### 六、全栈应用落地 + +- 项目整体搭建 +- 最小会话构建 +- AI 能力与设计器深度融合 +- 完整业务场景落地 diff --git a/components.d.ts b/components.d.ts index efd583a..117ba8c 100644 --- a/components.d.ts +++ b/components.d.ts @@ -11,15 +11,18 @@ export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { + ElButton: typeof import('element-plus/es')['ElButton'] ElCollapse: typeof import('element-plus/es')['ElCollapse'] ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] + ElDrawer: typeof import('element-plus/es')['ElDrawer'] ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElInputNumber: typeof import('element-plus/es')['ElInputNumber'] + MonacoEditor: typeof import('./src/components/MonacoEditor/index.vue')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] } diff --git a/package.json b/package.json index ccdde02..0562c40 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@tailwindcss/postcss": "^4.3.3", "echarts": "^6.1.0", "element-plus": "^2.14.4", + "monaco-editor": "0.55.1", "pinia": "^4.0.2", "postcss": "^8.5.26", "tailwindcss": "^4.3.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6de514..38a115d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: element-plus: specifier: ^2.14.4 version: 2.14.4(vue@3.5.41(typescript@6.0.3)) + monaco-editor: + specifier: 0.55.1 + version: 0.55.1 pinia: specifier: ^4.0.2 version: 4.0.3(@vue/devtools-api@8.2.1)(typescript@6.0.3)(vue@3.5.41(typescript@6.0.3)) @@ -750,6 +753,9 @@ packages: '@types/sortablejs@1.15.9': resolution: {integrity: sha512-7HP+rZGE2p886PKV9c9OJzLBI6BBJu1O7lJGYnPyG3fS4/duUCcngkNCjsLwIMV+WMqANe3tt4irrXHSIe68OQ==} + '@types/trusted-types@2.0.7': + resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} + '@types/web-bluetooth@0.0.21': resolution: {integrity: sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==} @@ -1079,6 +1085,9 @@ packages: resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} + dompurify@3.2.7: + resolution: {integrity: sha512-WhL/YuveyGXJaerVlMYGWhvQswa7myDG17P7Vu65EWC05o8vfeNbvNf4d/BOvH99+ZW+LlQsc1GDKMa1vNK6dw==} + echarts@6.1.0: resolution: {integrity: sha512-q0yaFPggC9FUdsWH4blavRWFmxdrIodbkoKNAjJudAI6CA9gNPxHtV2RcZNEepZVlk4yvBYkOkbk6HIVpIyHZA==} @@ -1545,6 +1554,11 @@ packages: magic-string@1.2.0: resolution: {integrity: sha512-ptco+HFxTLgjafSLim2LojBSwfg5feBjd+SqyiwdGkzC38UPdZy3zgrHMI2CoTf5fJL38tbHMYWVzIH8BxGqJw==} + marked@14.0.0: + resolution: {integrity: sha512-uIj4+faQ+MgHgwUW1l2PsPglZLOLOT1uErt06dAPtx2kjteLAkbsd/0FiYg/MGS+i7ZKLb7w2WClxHkzOOuryQ==} + engines: {node: '>= 18'} + hasBin: true + memoize-one@6.0.0: resolution: {integrity: sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==} @@ -1567,6 +1581,9 @@ packages: mlly@1.8.2: resolution: {integrity: sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==} + monaco-editor@0.55.1: + resolution: {integrity: sha512-jz4x+TJNFHwHtwuV9vA9rMujcZRb0CEilTEwG2rRSpe/A7Jdkuj8xPKttCgOh+v/lkHy7HsZ64oj+q3xoAFl9A==} + moveable@0.53.0: resolution: {integrity: sha512-71jS9zIoQzMhnNvduhg4tUEdm23+fO/40FN7muVMbZvVwbTku2MIxxLhnU4qFvxI4oVxn75l79SbtgjuA+s7Pw==} @@ -2658,6 +2675,9 @@ snapshots: '@types/sortablejs@1.15.9': {} + '@types/trusted-types@2.0.7': + optional: true + '@types/web-bluetooth@0.0.21': {} '@typescript-eslint/eslint-plugin@8.67.0(@typescript-eslint/parser@8.67.0(eslint@10.8.1(jiti@2.7.0))(typescript@6.0.3))(eslint@10.8.1(jiti@2.7.0))(typescript@6.0.3)': @@ -3063,6 +3083,10 @@ snapshots: detect-libc@2.1.2: {} + dompurify@3.2.7: + optionalDependencies: + '@types/trusted-types': 2.0.7 + echarts@6.1.0: dependencies: tslib: 2.3.0 @@ -3470,6 +3494,8 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 + marked@14.0.0: {} + memoize-one@6.0.0: {} memorystream@0.3.1: {} @@ -3492,6 +3518,11 @@ snapshots: pkg-types: 1.3.1 ufo: 1.6.4 + monaco-editor@0.55.1: + dependencies: + dompurify: 3.2.7 + marked: 14.0.0 + moveable@0.53.0: dependencies: '@daybrush/utils': 1.13.0 diff --git a/src/components/MonacoEditor/index.vue b/src/components/MonacoEditor/index.vue new file mode 100644 index 0000000..c42a9b7 --- /dev/null +++ b/src/components/MonacoEditor/index.vue @@ -0,0 +1,55 @@ + + + + diff --git a/src/editor/canvas/index.vue b/src/editor/canvas/index.vue index b2f0b1a..81df61f 100644 --- a/src/editor/canvas/index.vue +++ b/src/editor/canvas/index.vue @@ -83,7 +83,7 @@ const onCommand = (command: keyof typeof commendMap) => {