-
Notifications
You must be signed in to change notification settings - Fork 0
Add Implementation-Agnostic Component Protocol with Plugin Support #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 不要局限于列表,考虑所有企业管理软件开发所必须的常用组件 |
…ples Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
@copilot 继续 |
已扩展组件库从12个增加到79个企业管理软件必备组件类型。 新增类型涵盖:
已为13个最重要的企业组件实现详细schema(Table, Form, Menu, Button, Input, Select, List, Tree, Progress, Pagination, Upload等),所有92个测试通过。 Commit: 86fd948
已完成扩展。组件库现在包含79个类型,涵盖企业管理软件开发的所有核心组件需求。实现了13个重要组件的完整schema定义,包括表格、表单、菜单、树形控件、文件上传等。所有测试通过(92个测试)。 Commit: 86fd948 |
|
@copilot 继续 |
…ed schemas Co-authored-by: xuyushun441-sys <255036401+xuyushun441-sys@users.noreply.github.com>
已完成组件库扩展。现已包含79个企业级组件类型,并为13个最重要的组件实现了完整schema定义: 新增组件类型 (67个):
详细实现的组件 (13个): 所有79个测试通过 ✅ Commit: 53090e5 |
提示词设计思路解析(供您参考)
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
已完成重构,将组件协议简化为实现无关的通用结构。 主要变更:
架构原则: 协议层定义"如何描述UI树"而非"叶子节点的形状" 测试覆盖: 19个结构性测试验证嵌套、属性传递和组合能力 Commit: 4f2f041 |
|
This PR is very large. Consider breaking it into smaller PRs for easier review. |
|
为什么改了几十个文件 @copilot 但是,要做到“尽善尽美”,特别是考虑到“插件化”和“复杂交互”的长远需求,目前的协议还可以补充以下两个关键点(Optional): 1. 唯一标识符
|
…tors Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
关于文件数量问题: 已添加
新增测试: 5个新测试验证 Commit: d5a98d8 |
Implements a generic, implementation-agnostic UI component schema that defines "how to describe a UI tree" rather than "what properties each component has". This allows UI implementations to evolve independently while maintaining structural compatibility.
Design Philosophy
Protocol Layer Responsibility: Define the tree structure (id, type, props, children, events, style, meta)
Implementation Layer Responsibility: Define what each component type means and how to render it
This separation of concerns ensures the protocol remains stable while UI implementations can innovate freely.
Schema Structure
Generic Component Node with flexible, extensible properties:
Key Features
1. Extensible Component Types
typeis a flexible string, allowing custom component types without protocol changes2. Generic Props Container
propsaccepts any key-value pairs viaz.record(z.unknown())3. Recursive Composition
childrensupports unlimited nesting depth viaz.lazy()4. Standard Event & Style Support
eventsfor event handler bindingsstylefor custom CSS styling5. Component Instance Identification
idfield provides unique identifiers for component instances6. Editor & Plugin Metadata
metafield stores editor/designer-specific informationUsage Examples
Simple Component:
Component with ID and Metadata (for visual editors):
Nested Component Tree:
Custom Components (no protocol changes needed):
Files Changed
packages/spec/src/ui/component.zod.ts- Generic component schema (~95 lines, reduced from ~970 lines)packages/spec/src/ui/component.test.ts- Structural validation testspackages/spec/src/ui/index.ts- Export configurationTesting
24 structural tests validate:
idfieldmetafieldAll tests passing ✅
Benefits
✅ Decoupled: Protocol and implementation evolve independently
✅ Extensible: New component types without protocol changes
✅ Maintainable: Simple, focused protocol definition
✅ Future-proof: Adaptable to any UI framework or library
✅ Editor-Ready: Built-in support for visual editors and plugin systems
✅ Engine-Friendly: First-class
idfield for efficient component trackingOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.