project.json5 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. // 项目json结构
  2. {
  3. // 版本号
  4. "version": "1.0.0",
  5. // 应用元数据
  6. "meta": {
  7. // 项目名称
  8. "name": "智能HOME项目",
  9. // 项目版本号
  10. "version": "1.0.0",
  11. // 项目描述
  12. "description": "智能HOME项目",
  13. // 项目类型
  14. "type": "chip", // 'analog_display' | 'chip' | 'board' 1: 模拟显示 2: 芯片 3: 板卡
  15. // 屏幕类型
  16. "screenType": "single", // 'single' | 'dual' 1:单屏 2:双屏
  17. // 语言
  18. "language": "zh-cn",
  19. // 资源打包方式
  20. "resourcePackaging": "c_bin", // 'c' | 'c_bin' 1: C源码 2: C源码+BIN
  21. // BIN数量
  22. "binNum": "1", // 1~32
  23. // 芯片配置
  24. "chip": {
  25. // 芯片型号
  26. "model": "ESP32",
  27. // 闪存大小
  28. "flash_size": {
  29. "capacity": "16",
  30. "unit": "M"
  31. },
  32. // 内存大小
  33. "ram_size": {
  34. "capacity": "4",
  35. "unit": "M"
  36. }
  37. },
  38. // 板卡配置
  39. "board": {
  40. // 板卡型号
  41. "model": "ESP32",
  42. },
  43. // 屏幕配置
  44. "screens": [
  45. {
  46. // 屏幕类型
  47. "type": "1", // 1:主屏 2:副屏
  48. // 接口类型
  49. "interface": "RGB",
  50. // 屏幕宽
  51. "width": 1920,
  52. // 屏幕高
  53. "height": 1080,
  54. // 颜色深度
  55. "colorDepth": "16bit",
  56. // 颜色格式
  57. "colorFormat": "BGR",
  58. // 屏幕参数
  59. "params": {
  60. "PCLK": "",
  61. "VBP": "",
  62. "VFP": "",
  63. "HBP": "",
  64. "HFP": "",
  65. "HSYNC": "",
  66. "VSYNC": "",
  67. "HSYNC_WIDTH": "",
  68. "HSYNC_WIDTH": ""
  69. }
  70. }
  71. ],
  72. // 创建时间
  73. "createTime": "2025-09-01 12:00:00",
  74. // 修改时间
  75. "modifyTime": "2025-09-01 12:00:00",
  76. },
  77. // BIN列表
  78. "bins": [
  79. {
  80. "id": "bin_1",
  81. "fileName": "bin1.bin",
  82. "path": "./src/bin/bin1.bin"
  83. },
  84. {
  85. "id": "bin_2",
  86. "fileName": "bin2.bin",
  87. "path": "./src/bin/bin2.bin"
  88. }
  89. ],
  90. // 资源
  91. "resources": {
  92. // 图片资源
  93. "images": [
  94. {
  95. "id": "img_1",
  96. "fileName": "image1.png",
  97. "fielType": "png",
  98. "path": "./src/assets/images/image1.png",
  99. "compressFormat": "rle", // 无压缩、RLE压缩、QOI压缩、JPEG压缩、PNG压缩
  100. "alpha": 255, // 透明度0-255
  101. "bin": "bin_1", // 关联的BIN ID
  102. "colorFormat": "RGB565", // 颜色格式
  103. "colorDepth": "16bit", // 颜色深度
  104. }
  105. ],
  106. // 字体资源
  107. "fonts": [
  108. {
  109. "id": "font_1",
  110. "fileName": "font1.ttf",
  111. "fielType": "ttf",
  112. "path": "./src/assets/fonts/font1.ttf",
  113. "range": ["page", "custom", "range"], // 'all' | 'page' | 'custom' | 'range' 0: 全部 1:界面文本 2:自定义文本 3: 编码范围
  114. // 编码范围
  115. "codeRange": ["0x4E00-0x9FA5"],
  116. // 额外的文本内容
  117. "extText": "abcdefghijklmnopqrstuvwxyz",
  118. "bin": "bin_1" // 关联的BIN ID
  119. }
  120. ],
  121. "others": [
  122. // 动画资源
  123. {
  124. "id": "o_1",
  125. "fileName": "other.an",
  126. "fileType": "an",
  127. "path": "./src/assets/others/other.an"
  128. },
  129. // 样式资源
  130. {
  131. "id": "o_2",
  132. "fileName": "a.style",
  133. "fileType": "style",
  134. "path": "./src/assets/others/a.style"
  135. }
  136. ]
  137. },
  138. // 可复用控件
  139. "widgets": [
  140. {
  141. "id": "copy_obj_1",
  142. // 控件名称
  143. "name": "copy_obj_1",
  144. // 控件类型
  145. "widgetType": "lv_object",
  146. // 是否为可复用组件 widgets里面的为true
  147. "isCopy": true,
  148. // 复用来源组件id
  149. "copyFrom": "",
  150. // 元素类型
  151. "type": "widget",
  152. // 属性 根据每个控件生成
  153. "props": {
  154. // 坐标x
  155. "x": 0,
  156. // 坐标y
  157. "y": 0,
  158. // 宽度
  159. "width": 100,
  160. // 高度
  161. "height": 100,
  162. // 布局方式 flex grid
  163. "layout": "flex",
  164. // 启用
  165. "enable": true,
  166. // 可见
  167. "visible": true,
  168. // 值
  169. "value": {
  170. "valueType": "VARIABLE",
  171. "value": "page_1_a"
  172. },
  173. },
  174. // 样式 根据每个控件生成
  175. "style": {
  176. // 样式
  177. "style": "default",
  178. "state": {
  179. // 默认状态
  180. "normal": {
  181. // 直接使用颜色值
  182. "bg_color": "#000000",
  183. "border": "all", // all left right top bottom
  184. // 绑定变量或主题色
  185. "border_color": {
  186. // valueType的值: TEXT: 文本,VARIABLE: 变量,LANGUAGE: 多语言, COLOR: 主题颜色,不同的控件可以配置不同类型的属性
  187. "valueType": "TEXT",
  188. "value": "#ffffff"
  189. },
  190. "border_width": 1,
  191. "round_radius": 4
  192. },
  193. // 禁用状态
  194. "disabled": {
  195. "bg_color": "#000000",
  196. "border": "all",
  197. }
  198. }
  199. },
  200. // 事件
  201. "events": [
  202. {
  203. "id": "event_1",
  204. // 事件名称
  205. "name": "lv_obj_click_event",
  206. // 触发事件
  207. "trigger": "click",
  208. // 动作类型
  209. "type": "function", // 'play_animation' | 'function' -> play_animation: 播放动画 function: 执行函数
  210. // 动画ID
  211. animation: "",
  212. // 动画播放前函数ID
  213. animationPlayerBeforeEvent: "",
  214. // 动画播放后函数ID
  215. animationPlayerAfterEvent: "",
  216. // 函数ID
  217. function: "method_1"
  218. },
  219. // 加载完毕播放动画
  220. {
  221. "id": "event_1",
  222. // 事件名称
  223. "name": "lv_obj_click_event",
  224. // 触发事件
  225. "trigger": "click",
  226. // 动作类型
  227. "type": "play_animation", // 'play_animation' | 'function' -> play_animation: 播放动画 function: 执行函数
  228. // 动画ID
  229. animation: "animation_1",
  230. // 动画播放前函数ID
  231. animationPlayerBeforeEvent: "method_animation_1",
  232. // 动画播放后函数ID
  233. animationPlayerAfterEvent: "method_animation_2",
  234. // 函数ID
  235. function: ""
  236. }
  237. ],
  238. // 子对象
  239. "children": [
  240. {
  241. "id": "label_1",
  242. "name": "lv_label",
  243. "widgetType": "lv_label",
  244. "isCopy": false,
  245. "copyFrom": "",
  246. "type": "widget",
  247. "hidden": false,
  248. "locked": false,
  249. "props": {
  250. "id": "prop_1",
  251. "name": "text",
  252. "type": "string",
  253. "text": {
  254. "valueType": "LANGUAGE",
  255. "value": "hello"
  256. }
  257. },
  258. "style": {},
  259. "events": [],
  260. "children": []
  261. }
  262. ]
  263. },
  264. ],
  265. // 全局变量定义
  266. "variables": [
  267. {
  268. // 组ID
  269. "id": "group_1",
  270. // 组名称
  271. "name": "全局变量",
  272. // 变量
  273. "variables": [
  274. {
  275. "id": "var_1",
  276. "name": "a",
  277. "value": "1",
  278. "type": "int"
  279. }
  280. ]
  281. }
  282. ],
  283. // 主题
  284. "themes": [
  285. {
  286. "id": "theme_0",
  287. // 主题名称
  288. "name": "默认主题",
  289. // 默认主题
  290. "default": true,
  291. // 颜色集
  292. "colors": [
  293. {
  294. "id": "color_1",
  295. // 颜色名称
  296. "name": "背景颜色",
  297. // 颜色值
  298. "value": "#000000",
  299. // 透明度
  300. "alpha": 255
  301. }
  302. ]
  303. },
  304. {
  305. "id": "theme_1",
  306. // 主题名称
  307. "name": "高亮主题",
  308. // 默认主题
  309. "default": false,
  310. // 颜色集 这里的颜色只能从默认主题获取,可以修改值
  311. "colors": [
  312. {
  313. "id": "color_1",
  314. // 颜色名称
  315. "name": "背景颜色",
  316. // 颜色值
  317. "value": "#ffffff",
  318. // 透明度
  319. "alpha": 255
  320. }
  321. ]
  322. }
  323. ],
  324. // 动画
  325. "animations": [
  326. {
  327. // 动画名称
  328. "name": "move_x_animation",
  329. // 时间轴
  330. "timeline": [
  331. {
  332. // 目标属性
  333. "target": "x",
  334. // 开始值
  335. "start": 0,
  336. // 结束值
  337. "end": 100,
  338. // 延迟时间
  339. "delay": 0,
  340. // 动画时间
  341. "duration": 500,
  342. // 动画效果
  343. "timingFunction": "ease",
  344. // 动画次数
  345. "iterationCount": "infinite" // 数值或infinite
  346. }
  347. ]
  348. }
  349. ],
  350. // 多语言
  351. "languages": [
  352. {
  353. "id": "language_1",
  354. // 语言表示
  355. "key": "hello",
  356. // 语言内容
  357. "values": [
  358. {
  359. "language": "zh-cn",
  360. "value": "你好",
  361. "font": "font_1"
  362. },
  363. {
  364. "language": "en",
  365. "value": "hello"
  366. },
  367. {
  368. "language": "ja",
  369. "value": "こんにちは"
  370. },
  371. {
  372. "language": "ko",
  373. "value": "안녕하세요"
  374. },
  375. {
  376. "language": "fr",
  377. "value": "bonjour"
  378. }
  379. ]
  380. }
  381. ],
  382. // 方法
  383. "methods": [
  384. {
  385. "id": "method_1",
  386. "name": "lv_obj_click",
  387. "action": "static lv_obj_click(void* ctx) { // TODO: 添加事件处理逻辑 }"
  388. }
  389. ],
  390. // 屏幕
  391. "screens": [
  392. {
  393. "id": "screen_1",
  394. // 名称
  395. "name": "主屏",
  396. // 元素类型
  397. "type": "screen",
  398. // 屏幕宽 未设置取通用配置
  399. "width": 1920,
  400. // 屏幕高 未设置取通用配置
  401. "height": 1080,
  402. // 颜色深度
  403. "colorDepth": "16bit",
  404. // 颜色格式
  405. "colorFormat": "BGR",
  406. // 页面
  407. "pages": [
  408. {
  409. "id": "page_1",
  410. // 页面名称
  411. "name": "启动页",
  412. // 元素类型
  413. "type": "page",
  414. // 隐藏
  415. "hidden": false,
  416. // 锁定
  417. "locked": false,
  418. // 参考线
  419. "referenceLine": [
  420. {
  421. "id": "r_1",
  422. // 垂直 水平
  423. "layout": "horizontal",
  424. // 位置
  425. "position": 0,
  426. // 显示
  427. "visible": true
  428. }
  429. ],
  430. // 属性
  431. "props": {},
  432. // 样式
  433. "style": {},
  434. // 事件
  435. "events": [],
  436. // 页面变量
  437. "variables": [
  438. {
  439. "id": "page_1_var_1",
  440. "name": "page_1_a",
  441. "value": "1",
  442. "type": "int"
  443. }
  444. ],
  445. // 子组件
  446. "children": [
  447. {
  448. "id": "lv_obj_01",
  449. // 控件类型
  450. "widgetType": "lv_obj",
  451. // 控件名称
  452. "name": "容器",
  453. // 是否为可复用组件
  454. "isCopy": false,
  455. // 复用来源组件id
  456. "copyFrom": "copy_obj_1",
  457. // 类型
  458. "type": "widget",
  459. // 隐藏
  460. "hidden": false,
  461. // 锁定
  462. "locked": false,
  463. // 属性 根据每个控件生成
  464. "props": {
  465. // 坐标x
  466. "x": 100,
  467. // 坐标y
  468. "y": 100
  469. }
  470. },
  471. {
  472. "id": "label_1",
  473. "name": "lv_label",
  474. "widgetType": "lv_label",
  475. "isCopy": false,
  476. "copyFrom": "",
  477. "type": "widget",
  478. "hidden": false,
  479. "locked": false,
  480. "props": {
  481. "id": "prop_1",
  482. "name": "text",
  483. "type": "string",
  484. "text": {
  485. "valueType": "LANGUAGE",
  486. "value": "hello"
  487. }
  488. },
  489. "style": {},
  490. "events": [],
  491. "children": []
  492. }
  493. ]
  494. }
  495. ]
  496. }
  497. ]
  498. }