project.json5 13 KB

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