@cloudbase/cals 1.1.14-alpha.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/lib/{parser → cjs/parser}/cals/index.d.ts +1 -1
  2. package/lib/cjs/parser/cals/index.d.ts.map +1 -0
  3. package/lib/cjs/parser/cals/utils/block/helpers/get-component-namespace.d.ts.map +1 -0
  4. package/lib/cjs/parser/cals/utils/block/helpers/merge-dataset.d.ts.map +1 -0
  5. package/lib/cjs/parser/cals/utils/block/helpers/merge-listeners.d.ts.map +1 -0
  6. package/lib/cjs/parser/cals/utils/block/helpers/merge-resources.d.ts.map +1 -0
  7. package/lib/{parser → cjs/parser}/cals/utils/block/helpers/remap-component-ids.d.ts +2 -2
  8. package/lib/cjs/parser/cals/utils/block/helpers/remap-component-ids.d.ts.map +1 -0
  9. package/lib/cjs/parser/cals/utils/block/helpers/renew-id-in-code.d.ts.map +1 -0
  10. package/lib/cjs/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts.map +1 -0
  11. package/lib/cjs/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts.map +1 -0
  12. package/lib/cjs/parser/cals/utils/block/helpers/resolve-new-id.d.ts.map +1 -0
  13. package/lib/cjs/parser/cals/utils/block/index.d.ts.map +1 -0
  14. package/lib/cjs/parser/cals/utils/code/index.d.ts.map +1 -0
  15. package/lib/{parser → cjs/parser}/cals/utils/common.d.ts +1 -1
  16. package/lib/cjs/parser/cals/utils/common.d.ts.map +1 -0
  17. package/lib/cjs/parser/cals/utils/getUsedReference.d.ts.map +1 -0
  18. package/lib/cjs/parser/cals/utils/getUsedResources.d.ts.map +1 -0
  19. package/lib/cjs/parser/cals/utils/runtime.d.ts.map +1 -0
  20. package/lib/cjs/parser/cals/utils/spinoff/index.d.ts.map +1 -0
  21. package/lib/cjs/parser/cals/utils/style.d.ts.map +1 -0
  22. package/lib/cjs/parser/cals/utils/template.d.ts.map +1 -0
  23. package/lib/cjs/parser/cals/utils/version/common.d.ts.map +1 -0
  24. package/lib/cjs/parser/cals/utils/version/config.d.ts.map +1 -0
  25. package/lib/cjs/parser/cals/utils/version/index.d.ts.map +1 -0
  26. package/lib/cjs/parser/cals/utils/version/parses.d.ts.map +1 -0
  27. package/lib/cjs/parser/cals/utils/version/utils.d.ts.map +1 -0
  28. package/lib/cjs/parser/dependiencies/index.d.ts.map +1 -0
  29. package/lib/cjs/parser/expression/index.d.ts.map +1 -0
  30. package/lib/cjs/parser/index.d.ts.map +1 -0
  31. package/lib/cjs/parser/plugins/postcss-rpx2clac.d.ts.map +1 -0
  32. package/lib/cjs/types/basic/app.d.ts.map +1 -0
  33. package/lib/cjs/types/basic/common.d.ts.map +1 -0
  34. package/lib/cjs/types/basic/component.d.ts.map +1 -0
  35. package/lib/cjs/types/basic/datasource.d.ts.map +1 -0
  36. package/lib/cjs/types/index.d.ts.map +1 -0
  37. package/lib/{types → cjs/types}/lcds.d.ts +4 -4
  38. package/lib/cjs/types/lcds.d.ts.map +1 -0
  39. package/lib/{types → cjs/types}/platform/app.d.ts +2 -2
  40. package/lib/cjs/types/platform/app.d.ts.map +1 -0
  41. package/lib/cjs/types/platform/common.d.ts.map +1 -0
  42. package/lib/{types → cjs/types}/platform/component.d.ts +1 -1
  43. package/lib/cjs/types/platform/component.d.ts.map +1 -0
  44. package/lib/{types → cjs/types}/platform/datasource.d.ts +4 -4
  45. package/lib/cjs/types/platform/datasource.d.ts.map +1 -0
  46. package/lib/cjs/types/platform/eventFlow.d.ts.map +1 -0
  47. package/lib/cjs/types/platform/query.d.ts.map +1 -0
  48. package/lib/{types → cjs/types}/platform/theme.d.ts +4 -4
  49. package/lib/cjs/types/platform/theme.d.ts.map +1 -0
  50. package/lib/cjs/utils/CSSProperty.d.ts.map +1 -0
  51. package/lib/cjs/utils/color-generator/core.d.ts.map +1 -0
  52. package/lib/cjs/utils/color-generator/generate.d.ts.map +1 -0
  53. package/lib/cjs/utils/color-generator/utils.d.ts.map +1 -0
  54. package/lib/cjs/utils/constant.d.ts.map +1 -0
  55. package/lib/cjs/utils/dts/auto-generated.d.ts.map +1 -0
  56. package/lib/{utils → cjs/utils}/dts/build.d.ts.map +1 -1
  57. package/lib/cjs/utils/dts/index.d.ts.map +1 -0
  58. package/lib/cjs/utils/index.d.ts.map +1 -0
  59. package/lib/cjs/utils/version/common.d.ts.map +1 -0
  60. package/lib/cjs/utils/version/featureChecker.d.ts.map +1 -0
  61. package/lib/cjs/utils/version/migrations/version4.d.ts.map +1 -0
  62. package/lib/esm/parser/cals/index.d.ts +625 -0
  63. package/lib/esm/parser/cals/index.d.ts.map +1 -0
  64. package/lib/esm/parser/cals/index.js +1548 -0
  65. package/lib/esm/parser/cals/utils/block/helpers/get-component-namespace.d.ts +2 -0
  66. package/lib/esm/parser/cals/utils/block/helpers/get-component-namespace.d.ts.map +1 -0
  67. package/lib/esm/parser/cals/utils/block/helpers/get-component-namespace.js +5 -0
  68. package/lib/esm/parser/cals/utils/block/helpers/merge-dataset.d.ts +6 -0
  69. package/lib/esm/parser/cals/utils/block/helpers/merge-dataset.d.ts.map +1 -0
  70. package/lib/esm/parser/cals/utils/block/helpers/merge-dataset.js +13 -0
  71. package/lib/esm/parser/cals/utils/block/helpers/merge-listeners.d.ts +6 -0
  72. package/lib/esm/parser/cals/utils/block/helpers/merge-listeners.d.ts.map +1 -0
  73. package/lib/esm/parser/cals/utils/block/helpers/merge-listeners.js +10 -0
  74. package/lib/esm/parser/cals/utils/block/helpers/merge-resources.d.ts +6 -0
  75. package/lib/esm/parser/cals/utils/block/helpers/merge-resources.d.ts.map +1 -0
  76. package/lib/esm/parser/cals/utils/block/helpers/merge-resources.js +25 -0
  77. package/lib/esm/parser/cals/utils/block/helpers/remap-component-ids.d.ts +30 -0
  78. package/lib/esm/parser/cals/utils/block/helpers/remap-component-ids.d.ts.map +1 -0
  79. package/lib/esm/parser/cals/utils/block/helpers/remap-component-ids.js +125 -0
  80. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-code.d.ts +7 -0
  81. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-code.d.ts.map +1 -0
  82. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-code.js +9 -0
  83. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts +8 -0
  84. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts.map +1 -0
  85. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-expr.js +56 -0
  86. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts +15 -0
  87. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts.map +1 -0
  88. package/lib/esm/parser/cals/utils/block/helpers/renew-id-in-resource.js +13 -0
  89. package/lib/esm/parser/cals/utils/block/helpers/resolve-new-id.d.ts +7 -0
  90. package/lib/esm/parser/cals/utils/block/helpers/resolve-new-id.d.ts.map +1 -0
  91. package/lib/esm/parser/cals/utils/block/helpers/resolve-new-id.js +17 -0
  92. package/lib/esm/parser/cals/utils/block/index.d.ts +67 -0
  93. package/lib/esm/parser/cals/utils/block/index.d.ts.map +1 -0
  94. package/lib/esm/parser/cals/utils/block/index.js +451 -0
  95. package/lib/esm/parser/cals/utils/code/index.d.ts +36 -0
  96. package/lib/esm/parser/cals/utils/code/index.d.ts.map +1 -0
  97. package/lib/esm/parser/cals/utils/code/index.js +401 -0
  98. package/lib/esm/parser/cals/utils/common.d.ts +35 -0
  99. package/lib/esm/parser/cals/utils/common.d.ts.map +1 -0
  100. package/lib/esm/parser/cals/utils/common.js +301 -0
  101. package/lib/esm/parser/cals/utils/getUsedReference.d.ts +8 -0
  102. package/lib/esm/parser/cals/utils/getUsedReference.d.ts.map +1 -0
  103. package/lib/esm/parser/cals/utils/getUsedReference.js +54 -0
  104. package/lib/esm/parser/cals/utils/getUsedResources.d.ts +10 -0
  105. package/lib/esm/parser/cals/utils/getUsedResources.d.ts.map +1 -0
  106. package/lib/esm/parser/cals/utils/getUsedResources.js +132 -0
  107. package/lib/esm/parser/cals/utils/runtime.d.ts +14 -0
  108. package/lib/esm/parser/cals/utils/runtime.d.ts.map +1 -0
  109. package/lib/esm/parser/cals/utils/runtime.js +254 -0
  110. package/lib/esm/parser/cals/utils/spinoff/index.d.ts +10 -0
  111. package/lib/esm/parser/cals/utils/spinoff/index.d.ts.map +1 -0
  112. package/lib/esm/parser/cals/utils/spinoff/index.js +95 -0
  113. package/lib/esm/parser/cals/utils/style.d.ts +43 -0
  114. package/lib/esm/parser/cals/utils/style.d.ts.map +1 -0
  115. package/lib/esm/parser/cals/utils/style.js +463 -0
  116. package/lib/esm/parser/cals/utils/template.d.ts +6 -0
  117. package/lib/esm/parser/cals/utils/template.d.ts.map +1 -0
  118. package/lib/esm/parser/cals/utils/template.js +221 -0
  119. package/lib/esm/parser/cals/utils/version/common.d.ts +5 -0
  120. package/lib/esm/parser/cals/utils/version/common.d.ts.map +1 -0
  121. package/lib/esm/parser/cals/utils/version/common.js +375 -0
  122. package/lib/esm/parser/cals/utils/version/config.d.ts +16 -0
  123. package/lib/esm/parser/cals/utils/version/config.d.ts.map +1 -0
  124. package/lib/esm/parser/cals/utils/version/config.js +241 -0
  125. package/lib/esm/parser/cals/utils/version/index.d.ts +3 -0
  126. package/lib/esm/parser/cals/utils/version/index.d.ts.map +1 -0
  127. package/lib/esm/parser/cals/utils/version/index.js +68 -0
  128. package/lib/esm/parser/cals/utils/version/parses.d.ts +16 -0
  129. package/lib/esm/parser/cals/utils/version/parses.d.ts.map +1 -0
  130. package/lib/esm/parser/cals/utils/version/parses.js +560 -0
  131. package/lib/esm/parser/cals/utils/version/utils.d.ts +14 -0
  132. package/lib/esm/parser/cals/utils/version/utils.d.ts.map +1 -0
  133. package/lib/esm/parser/cals/utils/version/utils.js +129 -0
  134. package/lib/esm/parser/dependiencies/index.d.ts +143 -0
  135. package/lib/esm/parser/dependiencies/index.d.ts.map +1 -0
  136. package/lib/esm/parser/dependiencies/index.js +684 -0
  137. package/lib/esm/parser/expression/index.d.ts +123 -0
  138. package/lib/esm/parser/expression/index.d.ts.map +1 -0
  139. package/lib/esm/parser/expression/index.js +296 -0
  140. package/lib/esm/parser/index.d.ts +13 -0
  141. package/lib/esm/parser/index.d.ts.map +1 -0
  142. package/lib/esm/parser/index.js +12 -0
  143. package/lib/esm/parser/plugins/postcss-rpx2clac.d.ts +18 -0
  144. package/lib/esm/parser/plugins/postcss-rpx2clac.d.ts.map +1 -0
  145. package/lib/esm/parser/plugins/postcss-rpx2clac.js +67 -0
  146. package/lib/esm/types/basic/app.d.ts +76 -0
  147. package/lib/esm/types/basic/app.d.ts.map +1 -0
  148. package/lib/esm/types/basic/app.js +1 -0
  149. package/lib/esm/types/basic/common.d.ts +125 -0
  150. package/lib/esm/types/basic/common.d.ts.map +1 -0
  151. package/lib/esm/types/basic/common.js +1 -0
  152. package/lib/esm/types/basic/component.d.ts +212 -0
  153. package/lib/esm/types/basic/component.d.ts.map +1 -0
  154. package/lib/esm/types/basic/component.js +1 -0
  155. package/lib/esm/types/basic/datasource.d.ts +50 -0
  156. package/lib/esm/types/basic/datasource.d.ts.map +1 -0
  157. package/lib/esm/types/basic/datasource.js +1 -0
  158. package/lib/esm/types/index.d.ts +12 -0
  159. package/lib/esm/types/index.d.ts.map +1 -0
  160. package/lib/esm/types/index.js +14 -0
  161. package/lib/esm/types/lcds.d.ts +610 -0
  162. package/lib/esm/types/lcds.d.ts.map +1 -0
  163. package/lib/esm/types/lcds.js +22 -0
  164. package/lib/esm/types/platform/app.d.ts +276 -0
  165. package/lib/esm/types/platform/app.d.ts.map +1 -0
  166. package/lib/esm/types/platform/app.js +8 -0
  167. package/lib/esm/types/platform/common.d.ts +190 -0
  168. package/lib/esm/types/platform/common.d.ts.map +1 -0
  169. package/lib/esm/types/platform/common.js +84 -0
  170. package/lib/esm/types/platform/component.d.ts +166 -0
  171. package/lib/esm/types/platform/component.d.ts.map +1 -0
  172. package/lib/esm/types/platform/component.js +8 -0
  173. package/lib/esm/types/platform/datasource.d.ts +500 -0
  174. package/lib/esm/types/platform/datasource.d.ts.map +1 -0
  175. package/lib/esm/types/platform/datasource.js +6 -0
  176. package/lib/esm/types/platform/eventFlow.d.ts +20 -0
  177. package/lib/esm/types/platform/eventFlow.d.ts.map +1 -0
  178. package/lib/esm/types/platform/eventFlow.js +1 -0
  179. package/lib/esm/types/platform/query.d.ts +78 -0
  180. package/lib/esm/types/platform/query.d.ts.map +1 -0
  181. package/lib/esm/types/platform/query.js +12 -0
  182. package/lib/esm/types/platform/theme.d.ts +47 -0
  183. package/lib/esm/types/platform/theme.d.ts.map +1 -0
  184. package/lib/esm/types/platform/theme.js +1 -0
  185. package/lib/esm/utils/CSSProperty.d.ts +64 -0
  186. package/lib/esm/utils/CSSProperty.d.ts.map +1 -0
  187. package/lib/esm/utils/CSSProperty.js +86 -0
  188. package/lib/esm/utils/color-generator/core.d.ts +52 -0
  189. package/lib/esm/utils/color-generator/core.d.ts.map +1 -0
  190. package/lib/esm/utils/color-generator/core.js +57 -0
  191. package/lib/esm/utils/color-generator/generate.d.ts +67 -0
  192. package/lib/esm/utils/color-generator/generate.d.ts.map +1 -0
  193. package/lib/esm/utils/color-generator/generate.js +92 -0
  194. package/lib/esm/utils/color-generator/utils.d.ts +15 -0
  195. package/lib/esm/utils/color-generator/utils.d.ts.map +1 -0
  196. package/lib/esm/utils/color-generator/utils.js +30 -0
  197. package/lib/esm/utils/constant.d.ts +65 -0
  198. package/lib/esm/utils/constant.d.ts.map +1 -0
  199. package/lib/esm/utils/constant.js +69 -0
  200. package/lib/esm/utils/dts/auto-generated.d.ts +2 -0
  201. package/lib/esm/utils/dts/auto-generated.d.ts.map +1 -0
  202. package/lib/esm/utils/dts/auto-generated.js +1796 -0
  203. package/lib/esm/utils/dts/build.d.ts +2 -0
  204. package/lib/esm/utils/dts/build.d.ts.map +1 -0
  205. package/lib/esm/utils/dts/build.js +147 -0
  206. package/lib/esm/utils/dts/index.d.ts +141 -0
  207. package/lib/esm/utils/dts/index.d.ts.map +1 -0
  208. package/lib/esm/utils/dts/index.js +1071 -0
  209. package/lib/esm/utils/index.d.ts +9 -0
  210. package/lib/esm/utils/index.d.ts.map +1 -0
  211. package/lib/esm/utils/index.js +8 -0
  212. package/lib/esm/utils/version/common.d.ts +3 -0
  213. package/lib/esm/utils/version/common.d.ts.map +1 -0
  214. package/lib/esm/utils/version/common.js +22 -0
  215. package/lib/esm/utils/version/featureChecker.d.ts +5 -0
  216. package/lib/esm/utils/version/featureChecker.d.ts.map +1 -0
  217. package/lib/esm/utils/version/featureChecker.js +32 -0
  218. package/lib/esm/utils/version/migrations/version4.d.ts +3 -0
  219. package/lib/esm/utils/version/migrations/version4.d.ts.map +1 -0
  220. package/lib/esm/utils/version/migrations/version4.js +192 -0
  221. package/lib/tsconfig.tsbuildinfo +1 -0
  222. package/package.json +7 -5
  223. package/lib/parser/cals/index.d.ts.map +0 -1
  224. package/lib/parser/cals/utils/block/helpers/get-component-namespace.d.ts.map +0 -1
  225. package/lib/parser/cals/utils/block/helpers/merge-dataset.d.ts.map +0 -1
  226. package/lib/parser/cals/utils/block/helpers/merge-listeners.d.ts.map +0 -1
  227. package/lib/parser/cals/utils/block/helpers/merge-resources.d.ts.map +0 -1
  228. package/lib/parser/cals/utils/block/helpers/remap-component-ids.d.ts.map +0 -1
  229. package/lib/parser/cals/utils/block/helpers/renew-id-in-code.d.ts.map +0 -1
  230. package/lib/parser/cals/utils/block/helpers/renew-id-in-expr.d.ts.map +0 -1
  231. package/lib/parser/cals/utils/block/helpers/renew-id-in-resource.d.ts.map +0 -1
  232. package/lib/parser/cals/utils/block/helpers/resolve-new-id.d.ts.map +0 -1
  233. package/lib/parser/cals/utils/block/index.d.ts.map +0 -1
  234. package/lib/parser/cals/utils/code/index.d.ts.map +0 -1
  235. package/lib/parser/cals/utils/common.d.ts.map +0 -1
  236. package/lib/parser/cals/utils/getUsedReference.d.ts.map +0 -1
  237. package/lib/parser/cals/utils/getUsedResources.d.ts.map +0 -1
  238. package/lib/parser/cals/utils/runtime.d.ts.map +0 -1
  239. package/lib/parser/cals/utils/spinoff/index.d.ts.map +0 -1
  240. package/lib/parser/cals/utils/style.d.ts.map +0 -1
  241. package/lib/parser/cals/utils/template.d.ts.map +0 -1
  242. package/lib/parser/cals/utils/version/common.d.ts.map +0 -1
  243. package/lib/parser/cals/utils/version/config.d.ts.map +0 -1
  244. package/lib/parser/cals/utils/version/index.d.ts.map +0 -1
  245. package/lib/parser/cals/utils/version/parses.d.ts.map +0 -1
  246. package/lib/parser/cals/utils/version/utils.d.ts.map +0 -1
  247. package/lib/parser/dependiencies/index.d.ts.map +0 -1
  248. package/lib/parser/expression/index.d.ts.map +0 -1
  249. package/lib/parser/index.d.ts.map +0 -1
  250. package/lib/parser/plugins/postcss-rpx2clac.d.ts.map +0 -1
  251. package/lib/types/basic/app.d.ts.map +0 -1
  252. package/lib/types/basic/common.d.ts.map +0 -1
  253. package/lib/types/basic/component.d.ts.map +0 -1
  254. package/lib/types/basic/datasource.d.ts.map +0 -1
  255. package/lib/types/index.d.ts.map +0 -1
  256. package/lib/types/lcds.d.ts.map +0 -1
  257. package/lib/types/platform/app.d.ts.map +0 -1
  258. package/lib/types/platform/common.d.ts.map +0 -1
  259. package/lib/types/platform/component.d.ts.map +0 -1
  260. package/lib/types/platform/datasource.d.ts.map +0 -1
  261. package/lib/types/platform/eventFlow.d.ts.map +0 -1
  262. package/lib/types/platform/query.d.ts.map +0 -1
  263. package/lib/types/platform/theme.d.ts.map +0 -1
  264. package/lib/utils/CSSProperty.d.ts.map +0 -1
  265. package/lib/utils/color-generator/core.d.ts.map +0 -1
  266. package/lib/utils/color-generator/generate.d.ts.map +0 -1
  267. package/lib/utils/color-generator/utils.d.ts.map +0 -1
  268. package/lib/utils/constant.d.ts.map +0 -1
  269. package/lib/utils/dts/auto-generated.d.ts.map +0 -1
  270. package/lib/utils/dts/index.d.ts.map +0 -1
  271. package/lib/utils/index.d.ts.map +0 -1
  272. package/lib/utils/version/common.d.ts.map +0 -1
  273. package/lib/utils/version/featureChecker.d.ts.map +0 -1
  274. package/lib/utils/version/migrations/version4.d.ts.map +0 -1
  275. /package/lib/{parser → cjs/parser}/cals/index.js +0 -0
  276. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/get-component-namespace.d.ts +0 -0
  277. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/get-component-namespace.js +0 -0
  278. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-dataset.d.ts +0 -0
  279. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-dataset.js +0 -0
  280. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-listeners.d.ts +0 -0
  281. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-listeners.js +0 -0
  282. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-resources.d.ts +0 -0
  283. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/merge-resources.js +0 -0
  284. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/remap-component-ids.js +0 -0
  285. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-code.d.ts +0 -0
  286. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-code.js +0 -0
  287. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-expr.d.ts +0 -0
  288. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-expr.js +0 -0
  289. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-resource.d.ts +0 -0
  290. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/renew-id-in-resource.js +0 -0
  291. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/resolve-new-id.d.ts +0 -0
  292. /package/lib/{parser → cjs/parser}/cals/utils/block/helpers/resolve-new-id.js +0 -0
  293. /package/lib/{parser → cjs/parser}/cals/utils/block/index.d.ts +0 -0
  294. /package/lib/{parser → cjs/parser}/cals/utils/block/index.js +0 -0
  295. /package/lib/{parser → cjs/parser}/cals/utils/code/index.d.ts +0 -0
  296. /package/lib/{parser → cjs/parser}/cals/utils/code/index.js +0 -0
  297. /package/lib/{parser → cjs/parser}/cals/utils/common.js +0 -0
  298. /package/lib/{parser → cjs/parser}/cals/utils/getUsedReference.d.ts +0 -0
  299. /package/lib/{parser → cjs/parser}/cals/utils/getUsedReference.js +0 -0
  300. /package/lib/{parser → cjs/parser}/cals/utils/getUsedResources.d.ts +0 -0
  301. /package/lib/{parser → cjs/parser}/cals/utils/getUsedResources.js +0 -0
  302. /package/lib/{parser → cjs/parser}/cals/utils/runtime.d.ts +0 -0
  303. /package/lib/{parser → cjs/parser}/cals/utils/runtime.js +0 -0
  304. /package/lib/{parser → cjs/parser}/cals/utils/spinoff/index.d.ts +0 -0
  305. /package/lib/{parser → cjs/parser}/cals/utils/spinoff/index.js +0 -0
  306. /package/lib/{parser → cjs/parser}/cals/utils/style.d.ts +0 -0
  307. /package/lib/{parser → cjs/parser}/cals/utils/style.js +0 -0
  308. /package/lib/{parser → cjs/parser}/cals/utils/template.d.ts +0 -0
  309. /package/lib/{parser → cjs/parser}/cals/utils/template.js +0 -0
  310. /package/lib/{parser → cjs/parser}/cals/utils/version/common.d.ts +0 -0
  311. /package/lib/{parser → cjs/parser}/cals/utils/version/common.js +0 -0
  312. /package/lib/{parser → cjs/parser}/cals/utils/version/config.d.ts +0 -0
  313. /package/lib/{parser → cjs/parser}/cals/utils/version/config.js +0 -0
  314. /package/lib/{parser → cjs/parser}/cals/utils/version/index.d.ts +0 -0
  315. /package/lib/{parser → cjs/parser}/cals/utils/version/index.js +0 -0
  316. /package/lib/{parser → cjs/parser}/cals/utils/version/parses.d.ts +0 -0
  317. /package/lib/{parser → cjs/parser}/cals/utils/version/parses.js +0 -0
  318. /package/lib/{parser → cjs/parser}/cals/utils/version/utils.d.ts +0 -0
  319. /package/lib/{parser → cjs/parser}/cals/utils/version/utils.js +0 -0
  320. /package/lib/{parser → cjs/parser}/dependiencies/index.d.ts +0 -0
  321. /package/lib/{parser → cjs/parser}/dependiencies/index.js +0 -0
  322. /package/lib/{parser → cjs/parser}/expression/index.d.ts +0 -0
  323. /package/lib/{parser → cjs/parser}/expression/index.js +0 -0
  324. /package/lib/{parser → cjs/parser}/index.d.ts +0 -0
  325. /package/lib/{parser → cjs/parser}/index.js +0 -0
  326. /package/lib/{parser → cjs/parser}/plugins/postcss-rpx2clac.d.ts +0 -0
  327. /package/lib/{parser → cjs/parser}/plugins/postcss-rpx2clac.js +0 -0
  328. /package/lib/{types → cjs/types}/basic/app.d.ts +0 -0
  329. /package/lib/{types → cjs/types}/basic/app.js +0 -0
  330. /package/lib/{types → cjs/types}/basic/common.d.ts +0 -0
  331. /package/lib/{types → cjs/types}/basic/common.js +0 -0
  332. /package/lib/{types → cjs/types}/basic/component.d.ts +0 -0
  333. /package/lib/{types → cjs/types}/basic/component.js +0 -0
  334. /package/lib/{types → cjs/types}/basic/datasource.d.ts +0 -0
  335. /package/lib/{types → cjs/types}/basic/datasource.js +0 -0
  336. /package/lib/{types → cjs/types}/index.d.ts +0 -0
  337. /package/lib/{types → cjs/types}/index.js +0 -0
  338. /package/lib/{types → cjs/types}/lcds.js +0 -0
  339. /package/lib/{types → cjs/types}/platform/app.js +0 -0
  340. /package/lib/{types → cjs/types}/platform/common.d.ts +0 -0
  341. /package/lib/{types → cjs/types}/platform/common.js +0 -0
  342. /package/lib/{types → cjs/types}/platform/component.js +0 -0
  343. /package/lib/{types → cjs/types}/platform/datasource.js +0 -0
  344. /package/lib/{types → cjs/types}/platform/eventFlow.d.ts +0 -0
  345. /package/lib/{types → cjs/types}/platform/eventFlow.js +0 -0
  346. /package/lib/{types → cjs/types}/platform/query.d.ts +0 -0
  347. /package/lib/{types → cjs/types}/platform/query.js +0 -0
  348. /package/lib/{types → cjs/types}/platform/theme.js +0 -0
  349. /package/lib/{utils → cjs/utils}/CSSProperty.d.ts +0 -0
  350. /package/lib/{utils → cjs/utils}/CSSProperty.js +0 -0
  351. /package/lib/{utils → cjs/utils}/color-generator/core.d.ts +0 -0
  352. /package/lib/{utils → cjs/utils}/color-generator/core.js +0 -0
  353. /package/lib/{utils → cjs/utils}/color-generator/generate.d.ts +0 -0
  354. /package/lib/{utils → cjs/utils}/color-generator/generate.js +0 -0
  355. /package/lib/{utils → cjs/utils}/color-generator/utils.d.ts +0 -0
  356. /package/lib/{utils → cjs/utils}/color-generator/utils.js +0 -0
  357. /package/lib/{utils → cjs/utils}/constant.d.ts +0 -0
  358. /package/lib/{utils → cjs/utils}/constant.js +0 -0
  359. /package/lib/{utils → cjs/utils}/dts/auto-generated.d.ts +0 -0
  360. /package/lib/{utils → cjs/utils}/dts/auto-generated.js +0 -0
  361. /package/lib/{utils → cjs/utils}/dts/build.d.ts +0 -0
  362. /package/lib/{utils → cjs/utils}/dts/build.js +0 -0
  363. /package/lib/{utils → cjs/utils}/dts/index.d.ts +0 -0
  364. /package/lib/{utils → cjs/utils}/dts/index.js +0 -0
  365. /package/lib/{utils → cjs/utils}/index.d.ts +0 -0
  366. /package/lib/{utils → cjs/utils}/index.js +0 -0
  367. /package/lib/{utils → cjs/utils}/version/common.d.ts +0 -0
  368. /package/lib/{utils → cjs/utils}/version/common.js +0 -0
  369. /package/lib/{utils → cjs/utils}/version/featureChecker.d.ts +0 -0
  370. /package/lib/{utils → cjs/utils}/version/featureChecker.js +0 -0
  371. /package/lib/{utils → cjs/utils}/version/migrations/version4.d.ts +0 -0
  372. /package/lib/{utils → cjs/utils}/version/migrations/version4.js +0 -0
@@ -0,0 +1,451 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { EQueryType, } from '../../../../types';
13
+ import get from 'lodash/get';
14
+ import set from 'lodash/set';
15
+ import isEqual from 'lodash/isEqual';
16
+ import cloneDeep from 'lodash/cloneDeep';
17
+ import isObject from 'lodash/isObject';
18
+ import { ActionType, DynamicValueParser, PropBindType } from '../../../expression';
19
+ import { VisitedMap, refreshComponentIds, remapComponentIds } from './helpers/remap-component-ids';
20
+ import { walkThroughComponents } from '../common';
21
+ import { getComponentNamespace } from './helpers/get-component-namespace';
22
+ import { renewIdInResource } from './helpers/renew-id-in-resource';
23
+ import { mergeResources } from './helpers/merge-resources';
24
+ import { mergeDataset } from './helpers/merge-dataset';
25
+ import { mergeListeners } from './helpers/merge-listeners';
26
+ import { DYNAMIC_KEY_REG } from '../../../../utils';
27
+ import { renewIdInCode } from './helpers/renew-id-in-code';
28
+ export { renewIdInResource } from './helpers/renew-id-in-resource';
29
+ export { remapComponentIds, refreshComponentIds } from './helpers/remap-component-ids';
30
+ export { VisitedMap } from './helpers/remap-component-ids';
31
+ export function parseComponentCals(ctx, cals) {
32
+ if (!ctx.datasetMap) {
33
+ ctx.datasetMap = {};
34
+ }
35
+ if (!ctx.dataSourceMap) {
36
+ ctx.dataSourceMap = {};
37
+ }
38
+ if (!ctx.componentMap) {
39
+ ctx.componentMap = {};
40
+ }
41
+ if (!ctx.lowcodeMap) {
42
+ ctx.lowcodeMap = {};
43
+ }
44
+ if (!ctx.componentLibMap) {
45
+ ctx.componentLibMap = {};
46
+ }
47
+ ctx.component = {
48
+ id: cals.id || '',
49
+ };
50
+ const { component, module, attributes = {}, items = [], listeners = [], directives = {}, [':class']: dynamicClassList, [':style']: dynamicStyle, } = cals;
51
+ if (module && component && !get(ctx.componentMap, `${module}.${component}`)) {
52
+ set(ctx.componentMap, `${module}.${component}`, true);
53
+ ctx.componentLibMap[module] = true;
54
+ }
55
+ // 优先处理 directives 因为其他绑定会用到for
56
+ parseDirectivesCals(ctx, directives);
57
+ pasrseDynamicMapCals(ctx, attributes);
58
+ for (let item of listeners) {
59
+ parseListenertCals(ctx, item);
60
+ }
61
+ if (dynamicClassList) {
62
+ parseValueCals(ctx, dynamicClassList);
63
+ }
64
+ if (dynamicStyle) {
65
+ parseValueCals(ctx, dynamicStyle);
66
+ }
67
+ for (let item of items) {
68
+ parseComponentCals(ctx, item);
69
+ }
70
+ return ctx;
71
+ }
72
+ function parseListenertCals(ctx, listener) {
73
+ let { type, handler } = listener;
74
+ switch (type) {
75
+ case ActionType.Rematch: {
76
+ if (handler === null || handler === void 0 ? void 0 : handler.name) {
77
+ ctx.lowcodeMap[handler === null || handler === void 0 ? void 0 : handler.name] = true;
78
+ }
79
+ pasrseDynamicMapCals(ctx, handler === null || handler === void 0 ? void 0 : handler.params);
80
+ break;
81
+ }
82
+ case ActionType.DataSource: {
83
+ let params = handler === null || handler === void 0 ? void 0 : handler.params;
84
+ pasrseDynamicMapCals(params);
85
+ if (params === null || params === void 0 ? void 0 : params.dataSourceName) {
86
+ ctx.dataSourceMap[params === null || params === void 0 ? void 0 : params.dataSourceName] = true;
87
+ }
88
+ break;
89
+ }
90
+ case ActionType.Material: {
91
+ if (handler === null || handler === void 0 ? void 0 : handler.module) {
92
+ ctx.componentLibMap[handler === null || handler === void 0 ? void 0 : handler.module] = true;
93
+ }
94
+ pasrseDynamicMapCals(ctx, handler === null || handler === void 0 ? void 0 : handler.params);
95
+ break;
96
+ }
97
+ case ActionType.Platform: {
98
+ pasrseDynamicMapCals(ctx, handler === null || handler === void 0 ? void 0 : handler.params);
99
+ break;
100
+ }
101
+ }
102
+ }
103
+ function pasrseDynamicMapCals(ctx, map = {}) {
104
+ for (let key in map) {
105
+ if (/^:/.test(key) && typeof map[key] === 'string') {
106
+ parseValueCals(ctx, map[key]);
107
+ }
108
+ }
109
+ }
110
+ function parseDirectivesCals(ctx, directives) {
111
+ var _a;
112
+ // 优先处理for,因为其他的可能会用到 foritem
113
+ let forValue = directives[':for'];
114
+ if (typeof forValue === 'string') {
115
+ parseValueCals(ctx, forValue);
116
+ if (!ctx.forContext) {
117
+ ctx.forContext = {};
118
+ }
119
+ if ((_a = ctx.component) === null || _a === void 0 ? void 0 : _a.id) {
120
+ ctx.forContext[ctx.component.id] = true;
121
+ }
122
+ }
123
+ let visibleValue = directives[':if'];
124
+ if (typeof visibleValue === 'string') {
125
+ parseValueCals(ctx, visibleValue);
126
+ }
127
+ }
128
+ function parseValueCals(ctx, value) {
129
+ var _a, _b;
130
+ function processExpression(ctx, value) {
131
+ const regex = /\$([\w.]+)\.dataset\.(state|params)\.([\w$]+)/gm;
132
+ const matches = value.match(regex) || [];
133
+ for (let i = 0; i < matches.length; i++) {
134
+ const match = matches[i];
135
+ const [_, scope, type, varName] = regex.exec(match);
136
+ let key = '';
137
+ switch (scope) {
138
+ case 'page':
139
+ case 'w.page': {
140
+ key = '$page';
141
+ break;
142
+ }
143
+ case 'app':
144
+ case 'w.app': {
145
+ key = '$app';
146
+ break;
147
+ }
148
+ }
149
+ if (key && type && varName) {
150
+ if (!ctx.datasetMap[key]) {
151
+ ctx.datasetMap[key] = {};
152
+ }
153
+ ctx.datasetMap[key][`${type}.${varName}`] = true;
154
+ }
155
+ }
156
+ }
157
+ let res;
158
+ try {
159
+ let parser = new DynamicValueParser(value, { pageId: '$page' });
160
+ res = parser.parse();
161
+ }
162
+ catch (e) {
163
+ try {
164
+ processExpression(ctx, value);
165
+ }
166
+ catch (e) {
167
+ console.error(e);
168
+ }
169
+ return;
170
+ }
171
+ try {
172
+ switch (res.type) {
173
+ case PropBindType.params:
174
+ case PropBindType.stateData: {
175
+ const TYPE_MAP = {
176
+ [PropBindType.params]: 'params',
177
+ [PropBindType.stateData]: 'state',
178
+ };
179
+ const type = TYPE_MAP[res.type];
180
+ const path = ((_a = res.value) === null || _a === void 0 ? void 0 : _a.split('.')) || [];
181
+ let key = path[0];
182
+ if (!ctx.datasetMap[key]) {
183
+ ctx.datasetMap[key] = {};
184
+ }
185
+ if (path.length === 1) {
186
+ ctx.datasetMap[key][type] = true;
187
+ }
188
+ else {
189
+ ctx.datasetMap[key][`${type}.${path[1].replace(/\[.*/, '')}`] = true;
190
+ }
191
+ break;
192
+ }
193
+ case PropBindType.forItem: {
194
+ const [id] = ((_b = res.value) === null || _b === void 0 ? void 0 : _b.split('.')) || [];
195
+ if (!ctx.forContext[id]) {
196
+ throw {
197
+ code: 'INVALID_FOR_CONTEXT',
198
+ message: '缺少循环上下文,无法保存为区块',
199
+ };
200
+ }
201
+ break;
202
+ }
203
+ case PropBindType.expression: {
204
+ processExpression(ctx, value);
205
+ }
206
+ }
207
+ }
208
+ catch (e) {
209
+ if ((e === null || e === void 0 ? void 0 : e.code) === 'INVALID_FOR_CONTEXT') {
210
+ throw e;
211
+ }
212
+ }
213
+ }
214
+ export function regenBlockTemplateCals(ctx, cals) {
215
+ var _a, _b, _c;
216
+ const page = cals.items[0];
217
+ const { componentIdMap } = remapComponentIds(page.items, ctx.visiting);
218
+ page.items = regenBlockTemplateComponents(Object.assign(Object.assign({}, ctx), { componentIdMap }), page.items);
219
+ // 应用资源更新 ID
220
+ cals.resources = (_a = cals.resources) === null || _a === void 0 ? void 0 : _a.map((resource) => renewIdInResource(resource, componentIdMap));
221
+ // 页面资源更新 ID
222
+ page.resources = (_b = page.resources) === null || _b === void 0 ? void 0 : _b.map((resource) => renewIdInResource(resource, componentIdMap));
223
+ Object.keys(((_c = page === null || page === void 0 ? void 0 : page.dataset) === null || _c === void 0 ? void 0 : _c.query) || {}).forEach((key) => {
224
+ var _a, _b;
225
+ const query = (_b = (_a = page.dataset) === null || _a === void 0 ? void 0 : _a.query) === null || _b === void 0 ? void 0 : _b[key];
226
+ if ((query === null || query === void 0 ? void 0 : query.type) === EQueryType.GeneralFunc && query.handler[':code']) {
227
+ query.handler[':code'] = renewIdInCode(query.handler[':code'], componentIdMap);
228
+ }
229
+ });
230
+ return cals;
231
+ }
232
+ export function regenBlockTemplateComponents(ctx, components) {
233
+ let { componentIdMap } = ctx, restContext = __rest(ctx, ["componentIdMap"]);
234
+ if (!componentIdMap) {
235
+ componentIdMap = remapComponentIds(components, ctx.visiting).componentIdMap;
236
+ }
237
+ return components.map((component) => {
238
+ let processed = refreshComponentIds({ componentIdMap }, component);
239
+ return expandComponentReference(restContext, Object.assign(Object.assign({}, processed), { extra: Object.assign(Object.assign({}, processed.extra), { xIndex: undefined, anchored: true }) }));
240
+ });
241
+ }
242
+ /**
243
+ * todo: dataForm 追加
244
+ */
245
+ export function mergeCals(ctx, list) {
246
+ const visitedContext = {
247
+ existing: new VisitedMap(),
248
+ untilNow: new VisitedMap(),
249
+ };
250
+ // 不修改原始数据
251
+ const clonedCalsList = JSON.parse(JSON.stringify(list));
252
+ // 初始化 `visitedContext.existing` 数据
253
+ for (const { cals } of clonedCalsList) {
254
+ if (cals.items.length > 1) {
255
+ throw new Error('不支持对多页面的 CALS 进行合并');
256
+ }
257
+ // 区块只有一个页面
258
+ const page = cals.items[0];
259
+ walkThroughComponents(page.items, (item) => {
260
+ var _a;
261
+ (_a = item.extra) === null || _a === void 0 ? true : delete _a.xIndex;
262
+ if (!item.component || typeof item.component !== 'string') {
263
+ return;
264
+ }
265
+ const namespace = getComponentNamespace(item.component);
266
+ visitedContext.existing.add(namespace, item.id);
267
+ });
268
+ }
269
+ /**
270
+ * 根据 `visitedContext` 收集的信息,按需更新组件 ID
271
+ * 组件id是页面隔离的,因此限制约定,只处理 0 号页面
272
+ */
273
+ for (const { cals } of clonedCalsList) {
274
+ // 包含副作用,修改 cals 上id 为新id
275
+ regenBlockTemplateCals({ visiting: visitedContext, blockTemplateMap: ctx.blockTemplateMap }, cals);
276
+ }
277
+ const mergedCals = clonedCalsList
278
+ .map((meta) => meta.cals)
279
+ .reduce((first, second) => {
280
+ return pureMergeCals(first, second, () => [mergePage(first.items[0], second.items[0])]);
281
+ });
282
+ return mergedCals;
283
+ }
284
+ function pureMergeCals(first, second, resolveItems = (first, second) => {
285
+ return [...(first.items || []), ...(second.items || [])];
286
+ }) {
287
+ return Object.assign(Object.assign(Object.assign({}, second), first), { items: resolveItems(first, second), resources: mergeResources(first.resources, second.resources) || [], dataset: mergeDataset(first.dataset, second.dataset) || {}, theme: first.theme || second.theme, extra: Object.assign(Object.assign({}, second.extra), first.extra), externalResources: mergeExternalResources(first.externalResources, second.externalResources) });
288
+ }
289
+ function mergeExternalResources(origin = [], current = []) {
290
+ const MAP = origin.reduce((map, item) => {
291
+ const { type, url, code } = item;
292
+ map[`${type}:${url}:${code}`] = item;
293
+ return map;
294
+ }, {});
295
+ return [
296
+ ...origin,
297
+ ...current.filter((item) => {
298
+ const { type, url, code } = item;
299
+ return !MAP[`${type}:${url}:${code}`];
300
+ }),
301
+ ];
302
+ }
303
+ function mergePage(firstPage, secondPage, resolveItems = (first, second) => {
304
+ return [...(first.items || []), ...(second.items || [])];
305
+ }) {
306
+ const mergedPage = Object.assign(Object.assign(Object.assign({}, secondPage), firstPage), { items: resolveItems(firstPage, secondPage), resources: mergeResources(firstPage.resources, secondPage.resources) || [], dataset: mergeDataset(firstPage.dataset, secondPage.dataset) || {}, listeners: mergeListeners(firstPage.listeners, secondPage.listeners), attributes: Object.assign(Object.assign({}, secondPage.attributes), firstPage.attributes), extra: Object.assign(Object.assign({}, secondPage.extra), firstPage.extra) });
307
+ if (!mergedPage.listeners) {
308
+ delete mergedPage.listeners;
309
+ }
310
+ return mergedPage;
311
+ }
312
+ export function expandComponentReference(ctx, component) {
313
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
314
+ const { blockTemplateMap, strict, enableRestore, processPickedTeamplate = (template) => template } = ctx;
315
+ const { extra = {}, id, component: componentName } = component;
316
+ const { ref } = extra;
317
+ if (ref) {
318
+ if (blockTemplateMap[ref]) {
319
+ if ((_a = ctx === null || ctx === void 0 ? void 0 : ctx.referenceMap) === null || _a === void 0 ? void 0 : _a[ref]) {
320
+ if (strict) {
321
+ throw new Error(`存在循环引用:${ref}`);
322
+ }
323
+ else {
324
+ return undefined;
325
+ }
326
+ }
327
+ const block = processPickedTeamplate(cloneDeep(blockTemplateMap[ref]), { ref, component });
328
+ const cals = regenBlockTemplateCals(Object.assign(Object.assign({}, ctx), { referenceMap: Object.assign(Object.assign({}, ctx.referenceMap), { [ref]: true }) }), block.content);
329
+ if (ctx.patchRef) {
330
+ const global = ctx.patchRef.cals;
331
+ const page = ctx.patchRef.page;
332
+ if (page) {
333
+ Object.assign(page, mergePage(page, cals.items[0]), () => []);
334
+ }
335
+ if (global) {
336
+ Object.assign(global, pureMergeCals(global, cals), () => []);
337
+ }
338
+ }
339
+ const blockContent = (_b = cals.items[0].items) === null || _b === void 0 ? void 0 : _b[0];
340
+ if (!blockContent) {
341
+ return undefined;
342
+ }
343
+ /**
344
+ * 动态配置协议有修改未定
345
+ * 因此先写死限制
346
+ */
347
+ if (!((_c = blockContent === null || blockContent === void 0 ? void 0 : blockContent.extra) === null || _c === void 0 ? void 0 : _c.dataForm) &&
348
+ blockContent.component === 'Container' &&
349
+ (((_d = blockContent.attributes) === null || _d === void 0 ? void 0 : _d.data) || ((_e = blockContent.attributes) === null || _e === void 0 ? void 0 : _e[':data'])) &&
350
+ ((_f = block.dynamicConfig) === null || _f === void 0 ? void 0 : _f.type) === 'object' &&
351
+ ((_g = block.dynamicConfig) === null || _g === void 0 ? void 0 : _g.properties.configs)) {
352
+ blockContent.extra = Object.assign(Object.assign({}, blockContent.extra), { dataForm: { data: (_h = block.dynamicConfig) === null || _h === void 0 ? void 0 : _h.properties.configs } });
353
+ }
354
+ const { attributes: blockAttributes = {} } = blockContent;
355
+ return Object.assign(Object.assign({}, blockContent), {
356
+ // todo: 这里合并有问题,无法简单的合并
357
+ attributes: Object.assign(Object.assign({}, blockAttributes), component.attributes), ':style': component[':style'] || blockContent[':style'], ':class': component[':class'] || blockContent[':class'], extra: Object.assign(Object.assign({}, blockContent.extra), { refAttributes: enableRestore && Object.keys(blockAttributes) ? blockAttributes : undefined, ref: enableRestore ? ref : undefined }) });
358
+ }
359
+ else {
360
+ if (strict) {
361
+ throw new Error(`未找到引用:${ref}`);
362
+ }
363
+ else {
364
+ return undefined;
365
+ }
366
+ }
367
+ }
368
+ return Object.assign(Object.assign({}, component), { items: (_k = (_j = component.items) === null || _j === void 0 ? void 0 : _j.map) === null || _k === void 0 ? void 0 : _k.call(_j, (item) => expandComponentReference(ctx, item)).filter((item) => !!item) });
369
+ }
370
+ export function collapseComponentReference(ctx, component) {
371
+ var _a, _b, _c;
372
+ const { extra, attributes = {}, ':style': styleBind, ':class': classBind } = component;
373
+ const { blockTemplateMap } = ctx;
374
+ const _d = extra || {}, { ref, anchored, dataForm, refAttributes } = _d, restExtra = __rest(_d, ["ref", "anchored", "dataForm", "refAttributes"]);
375
+ if (ref && blockTemplateMap[ref]) {
376
+ const processed = {};
377
+ const blockContent = (_c = (_b = (_a = blockTemplateMap[ref].content.items) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.items) === null || _c === void 0 ? void 0 : _c[0];
378
+ restExtra.ref = ref;
379
+ processed.attributes = filterMap(attributes, refAttributes);
380
+ if (styleBind !== blockContent[':style']) {
381
+ processed[':style'] = styleBind;
382
+ }
383
+ if (classBind !== blockContent[':class']) {
384
+ processed[':class'] = classBind;
385
+ }
386
+ processed.extra = filterMap(restExtra, blockContent === null || blockContent === void 0 ? void 0 : blockContent.extra);
387
+ return processed;
388
+ }
389
+ else {
390
+ const _e = (component === null || component === void 0 ? void 0 : component.extra) || {}, { ref, refAttributes, dataForm } = _e, rest = __rest(_e, ["ref", "refAttributes", "dataForm"]);
391
+ return Object.assign(Object.assign({}, component), { extra: (component === null || component === void 0 ? void 0 : component.extra) ? rest : component === null || component === void 0 ? void 0 : component.extra });
392
+ }
393
+ }
394
+ function filterMap(current = {}, base = {}) {
395
+ const filtered = {};
396
+ Object.entries(current).forEach(([key, value]) => {
397
+ // todo: 变量绑定key与非绑定key应为相同key
398
+ if (!isEqual(base[key], value)) {
399
+ filtered[key] = value;
400
+ }
401
+ });
402
+ return filtered;
403
+ }
404
+ /**
405
+ * 转换区块 page 到 template
406
+ */
407
+ export function processPage2Template(page, properties) {
408
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
409
+ let { items = [] } = page;
410
+ let dataForm = {};
411
+ if (items.length > 1) {
412
+ items = items;
413
+ items = [{ id: `comtainer_${page.id}`, component: 'Container', attributes: {}, items: items }];
414
+ }
415
+ else if (items.length === 1) {
416
+ let component = items[0];
417
+ // simple block
418
+ if (component.component === 'Container' && (((_c = (_b = (_a = component.extra) === null || _a === void 0 ? void 0 : _a.dataForm) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.type) === 'object' || properties)) {
419
+ const _k = component.attributes, { data } = _k, rest = __rest(_k, ["data"]);
420
+ component = Object.assign(Object.assign({}, component), { attributes: Object.assign(Object.assign({}, rest), { ':data': `Object.assign(${isObject(data) ? JSON.stringify(data) : '{}'}, $comp.props.data)` }) });
421
+ dataForm = properties || ((_f = (_e = (_d = component.extra) === null || _d === void 0 ? void 0 : _d.dataForm) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.properties);
422
+ }
423
+ component = Object.assign(Object.assign({}, component), { extra: Object.assign(Object.assign({}, component.extra), { anchored: undefined, dataForm: undefined }) });
424
+ items = [component];
425
+ }
426
+ const TRANSFER_EVENTNAME_MAP = {
427
+ load: 'attached',
428
+ unload: 'detached',
429
+ };
430
+ function replacePageMember(str) {
431
+ return (str === null || str === void 0 ? void 0 : str.replace(/(?:\$w\.page|\$page).(dataset|handler)/g, '$comp.$1')) || str;
432
+ }
433
+ return JSON.parse(JSON.stringify({
434
+ id: page.id,
435
+ name: page.id,
436
+ items,
437
+ listeners: (_h = (_g = page.listeners) === null || _g === void 0 ? void 0 : _g.map) === null || _h === void 0 ? void 0 : _h.call(_g, (listener) => {
438
+ return Object.assign(Object.assign({}, listener), { eventName: TRANSFER_EVENTNAME_MAP[listener.eventName] || listener.eventName });
439
+ }),
440
+ dataset: page.dataset,
441
+ resources: (_j = page.resources) === null || _j === void 0 ? void 0 : _j.map((item) => {
442
+ return Object.assign(Object.assign({}, item), { code: replacePageMember(item.code || '') });
443
+ }),
444
+ data: { properties: properties || dataForm },
445
+ }, function (key, v) {
446
+ if (DYNAMIC_KEY_REG.test(key) && typeof v === 'string') {
447
+ return replacePageMember(v);
448
+ }
449
+ return v;
450
+ }));
451
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * cals 与 code 互转
3
+ * 这里的 code 是中间状态的 code,即非最终生成的可运行的项目代码
4
+ */
5
+ import { IPlatformApp, IPlatformSubApp } from '../../../../types';
6
+ export interface ICodeItem {
7
+ path: string;
8
+ code: string;
9
+ conflict?: boolean;
10
+ }
11
+ /**
12
+ * CALS 转成 中间状态的代码
13
+ *
14
+ * @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
15
+ */
16
+ export declare function calsToCode(calsJSON: IPlatformApp | IPlatformSubApp, version?: 'v0' | 'v1'): ICodeItem[];
17
+ /**
18
+ * 中间状态的代码 转成 CALS
19
+ *
20
+ * @params version: v0 - 没有 pages 目录; v1 - 有 pages 目录
21
+ */
22
+ export declare function codeToCals(codeList: ICodeItem[], version?: 'v0' | 'v1'): IPlatformApp;
23
+ /**
24
+ * 指定代码内容是否存在冲突未解决
25
+ */
26
+ export declare function checkForConflicts(code: string): boolean;
27
+ /**
28
+ * 以 from 为准自动解决冲突
29
+ */
30
+ export declare function autoResolveConflicts(code: string, from: 'theirs' | 'ours'): string;
31
+ export declare function findAllConflicts(code: string, onlyFindFirstOne?: boolean): {
32
+ start: number;
33
+ middle: number;
34
+ end: number;
35
+ }[];
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/cals/utils/code/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,YAAY,EAMZ,eAAe,EAChB,MAAM,mBAAmB,CAAC;AAK3B,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,YAAY,GAAG,eAAe,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,SAAS,EAAE,CA4M7G;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,OAAO,GAAE,IAAI,GAAG,IAAW,GAAG,YAAY,CAgK3F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,CA6BlF;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,gBAAgB,GAAE,OAAe,GAChC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EAAE,CAoClD"}