代码依据：

- component.json 结构/约束校验（最全）： componentRegistry/index.vue
- 上传组件包时的强约束（更严格）： developer.js
- 右侧属性面板支持的 properties 字段（真正会生效的子集）： PropsForm.vue
- 远程组件动态加载契约（libraryName/window 暴露等）： remoteLoader.ts
## 0) 组件包交付物（必须）
一个可安装组件包（zip 或目录）至少包含：

- component.json （必须，放在包根目录；上传时会从 zip 里读取/校验）
- runtime.entry 指向的入口脚本（必须存在于包内，且路径匹配）
- 可选： runtime.style 样式文件、 designer.thumbnail/preview 资源
上传端会在 zip 内查找 component.json 并 JSON.parse，然后校验必填字段与入口文件存在性： developer.js

## 1) component.json 顶层 Schema（最详细字段表）
### 1.1 顶层字段
字段 必填 类型 说明 specVersion 是 string 组件协议版本，例如 "1.0.0" ；会做 semver 对比与兼容提示 meta 是 object 基础信息（ID/名称/版本/分类等） runtime 是 object 运行时加载与依赖声明 properties 是 object 组件属性定义（JSON Schema 子集，驱动右侧属性面板） designer 否 object 设计器侧展示与默认配置（宽高/缩略图/默认 props 等） events 否 array 组件可对外触发的事件声明（用于交互编排） actions 否 array 组件可被平台调用的动作声明（能力/方法） dataSchema 否 object 数据结构描述（JSON Schema，当前主要用于文档/校验） styleSchema 否 object 样式结构描述（JSON Schema，当前主要用于文档/校验） i18n 否 object 多语言字典（object）

## 2) meta（基础信息）字段约定
### 2.1 meta 必填
- meta.id: string
  - 必须为反向域名风格 ：如 com.company.widgetName
  - 校验正则在注册中心里写死（反向域名 like）： componentRegistry/index.vue
- meta.name: string ：组件展示名
- meta.version: string ： semver ，如 1.0.0 / 1.0.0-beta.1
- meta.category: string ：分类（用于组件库分组/检索）
### 2.2 meta 可选
- meta.description/author/homepage/license/icon: string
- meta.keywords: string[] （建议 ≤ 20，且不重复）
- meta.tags: string[] （建议 ≤ 20，且不重复）
## 3) runtime（运行时加载与依赖）字段约定
### 3.1 runtime 必填
- runtime.entry: string
  - 资源引用：URL 或相对路径（如 ./dist/index.js ）
  - 注册中心要求是 URL/相对路径，建议 .js/.mjs ： componentRegistry/index.vue
- runtime.type: "umd" | "esm" | "iife"
  - 注意：上传流程更严格 ：当前上传校验只接受 iife ： developer.js
- runtime.factory: string
  - 必须是合法 JS 标识符（例如 createComponent ）： componentRegistry/index.vue
### 3.2 runtime 条件必填
- runtime.library: string
  - umd/iife 下必填（esm 下通常不需要）： componentRegistry/index.vue
  - 运行时会通过 window[libraryName] 获取组件导出（script tag fallback）： remoteLoader.ts
### 3.3 runtime 可选
- runtime.style: string ：css 路径或 URL（建议 .css ）
- runtime.dependencies: Record<string,string>
  - 额外依赖映射，值可以是 .js 或 .css ，运行时会动态插入 script/link： remoteLoader.ts
- runtime.externals: Record<string,string>
  - 外部依赖全局变量映射，例如： { "vue":"Vue", "element-plus":"ElementPlus", "echarts":"echarts" }
- runtime.buildMode: "vite" | "copy"
  - 当前上传流程校验该字段（用于打包策略描述）： developer.js
## 4) properties（组件属性 Schema）——“最关键 & 最容易踩坑”的部分
你可以把 properties 理解为： 右侧属性面板“动态表单”的协议 。当前实现不是完整 JSON Schema 引擎，只支持一小部分关键字（写其他的不会报错，但不会生效）。

### 4.1 properties 根对象（必须）
```
{
  "type": "object",
  "properties": {
    "fieldA": { "...FieldSchema" : 
    true }
  }
}
```
- PropsForm 会直接遍历 schema.properties 渲染字段： PropsForm.vue
### 4.2 FieldSchema（单字段）真正生效的字段
字段 类型 是否生效 说明 type string 是 控件类型判断（string/number/integer/boolean/object/array） title string 是 表单 label（不写则用 key） description string 是 字段下帮助文案 enum any[] 是 下拉选择（label/value 直接用枚举值本身） format string 部分 仅支持： json / color / textarea

### 4.3 控件映射（按优先级，完全按代码）
1. JSON 编辑器 ： format === "json" 或 type === "object" 或 type === "array"
2. 下拉选择 ： enum 存在
3. 颜色 ： format === "color" 或字段 key 命中 /color|background/i （隐式规则）
4. 数字 ： type === "number" | "integer"
5. 布尔 ： type === "boolean"
6. 多行文本 ： type === "string" && format === "textarea"
7. 默认输入框 ：兜底
对应源码一眼就能对照： PropsForm.vue

### 4.4 当前“不支持/不会生效”的常见 Schema 关键字（写了也没用）
default / required / minimum / maximum / minLength / pattern / items / oneOf / anyOf / allOf / $ref / ui:* / x-* 等——PropsForm 都不会读取。

## 5) designer（设计器侧信息）字段约定（可选但强烈建议）
- designer.thumbnail: string ：组件库缩略图
- designer.preview: string ：预览资源（视频/图片）
- designer.width/height/minWidth/minHeight/maxWidth/maxHeight: number （正数校验）
- designer.aspectRatio: number | "W:H" （例如 "16:9" ，会做一致性 warning）
- designer.defaultProps: object ：新建节点时 props 初始值（会按 properties 做一次值校验提示）
- designer.plugins: Record<string,string> ：设计器插件映射（包名 -> 版本/地址）
字段校验见： componentRegistry/index.vue

## 6) events / actions（交互与能力）字段约定
### 6.1 events（可选）
- events: Array<{ name: string; title?: string; description?: string; schema?: object }>
- name 不能重复（会报错）： componentRegistry/index.vue
### 6.2 actions（可选）
- actions: Array<{ name: string; title?: string; description?: string; parameters?: object }>
- name 不能重复（会报错）： componentRegistry/index.vue
## 7) 一份“可直接用”的最小完整模板（iife 兼容上传流程）
```
{
  "specVersion": "1.0.0",
  "meta": {
    "id": "com.company.widget",
    "name": "示例组件",
    "version": "1.0.0",
    "category": "custom",
    "description": "组件简介",
    "tags": ["demo"],
    "keywords": ["example"]
  },
  "runtime": {
    "entry": "./dist/index.js",
    "style": "./dist/style.css",
    "type": "iife",
    "library": "MyWidget",
    "factory": "createComponent",
    "externals": {
      "vue": "Vue",
      "element-plus": "ElementPlus",
      "echarts": "echarts"
    },
    "dependencies": {}
  },
  "designer": {
    "thumbnail": "./assets/
    thumbnail.png",
    "width": 600,
    "height": 300,
    "defaultProps": {}
  },
  "properties": {
    "type": "object",
    "properties": {
      "title": { "type": "string", 
      "title": "标题", 
      "description": "显示标题" },
      "count": { "type": "number", 
      "title": "数值" },
      "themeColor": { "type": 
      "string", "title": "主题色", 
      "format": "color" },
      "option": { "type": "object", 
      "title": "配置", "format": 
      "json", "description": "JSON 
      配置" },
      "desc": { "type": "string", 
      "title": "说明", "format": 
      "textarea" },
      "mode": { "type": "string", 
      "title": "模式", "enum": 
      ["A", "B", "C"] }
    }
  },
  "events": [{ "name": "click", 
  "title": "点击" }],
  "actions": [{ "name": "refresh", 
  "title": "刷新" }]
}
```