@visactor/vstory 0.0.4 → 0.0.5-alpha.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 (402) hide show
  1. package/README.md +13 -0
  2. package/cjs/constants/character.d.ts +2 -1
  3. package/cjs/constants/character.js +1 -1
  4. package/cjs/constants/character.js.map +1 -1
  5. package/cjs/dsl/story-chart/chart.js +2 -1
  6. package/cjs/dsl/story-chart/line.js +1 -1
  7. package/cjs/dsl/story-chart/pie.js +1 -1
  8. package/cjs/dsl/story-processor/index.js +1 -1
  9. package/cjs/dsl/types/index.d.ts +1 -0
  10. package/cjs/dsl/types/index.js.map +1 -1
  11. package/cjs/edit/const.d.ts +1 -3
  12. package/cjs/edit/const.js +1 -0
  13. package/cjs/edit/const.js.map +1 -1
  14. package/cjs/edit/edit-action.d.ts +9 -0
  15. package/cjs/edit/edit-action.js +61 -5
  16. package/cjs/edit/edit-action.js.map +1 -1
  17. package/cjs/edit/edit-component/base-selection.d.ts +8 -3
  18. package/cjs/edit/edit-component/base-selection.js +30 -4
  19. package/cjs/edit/edit-component/base-selection.js.map +1 -1
  20. package/cjs/edit/edit-component/chart-selection.d.ts +15 -0
  21. package/cjs/edit/edit-component/chart-selection.js +39 -0
  22. package/cjs/edit/edit-component/chart-selection.js.map +1 -0
  23. package/cjs/edit/edit-component/common.d.ts +1 -11
  24. package/cjs/edit/edit-component/common.js +1 -32
  25. package/cjs/edit/edit-component/common.js.map +1 -1
  26. package/cjs/edit/edit-component/edit-control/richtext-control.d.ts +19 -0
  27. package/cjs/edit/edit-component/edit-control/richtext-control.js +34 -0
  28. package/cjs/edit/edit-component/edit-control/richtext-control.js.map +1 -0
  29. package/cjs/edit/edit-component/edit-control/richtext-transform-control.d.ts +2 -3
  30. package/cjs/edit/edit-component/edit-control/richtext-transform-control.js +30 -32
  31. package/cjs/edit/edit-component/edit-control/richtext-transform-control.js.map +1 -1
  32. package/cjs/edit/edit-component/edit-control/transform-control.d.ts +4 -2
  33. package/cjs/edit/edit-component/edit-control/transform-control.js +10 -6
  34. package/cjs/edit/edit-component/edit-control/transform-control.js.map +1 -1
  35. package/cjs/edit/edit-component/edit-control/transform-drag.d.ts +1 -0
  36. package/cjs/edit/edit-component/edit-control/transform-drag.js +4 -2
  37. package/cjs/edit/edit-component/edit-control/transform-drag.js.map +1 -1
  38. package/cjs/edit/edit-component/image-selection.d.ts +1 -2
  39. package/cjs/edit/edit-component/image-selection.js +2 -5
  40. package/cjs/edit/edit-component/image-selection.js.map +1 -1
  41. package/cjs/edit/edit-component/index.js +4 -5
  42. package/cjs/edit/edit-component/index.js.map +1 -1
  43. package/cjs/edit/edit-component/mixin/richtext.d.ts +21 -0
  44. package/cjs/edit/edit-component/mixin/richtext.js +26 -0
  45. package/cjs/edit/edit-component/mixin/richtext.js.map +1 -0
  46. package/cjs/edit/edit-component/rect-selection.d.ts +8 -12
  47. package/cjs/edit/edit-component/rect-selection.js +12 -17
  48. package/cjs/edit/edit-component/rect-selection.js.map +1 -1
  49. package/cjs/edit/edit-component/richtext-selection-common.d.ts +19 -0
  50. package/cjs/edit/edit-component/richtext-selection-common.js +35 -0
  51. package/cjs/edit/edit-component/richtext-selection-common.js.map +1 -0
  52. package/cjs/edit/edit-component/richtext-selection.d.ts +0 -2
  53. package/cjs/edit/edit-component/richtext-selection.js +0 -6
  54. package/cjs/edit/edit-component/richtext-selection.js.map +1 -1
  55. package/cjs/edit/edit-component/shape-selection.d.ts +11 -0
  56. package/cjs/edit/edit-component/shape-selection.js +36 -0
  57. package/cjs/edit/edit-component/shape-selection.js.map +1 -0
  58. package/cjs/edit/edit-component/text-selection.d.ts +0 -3
  59. package/cjs/edit/edit-component/text-selection.js +3 -11
  60. package/cjs/edit/edit-component/text-selection.js.map +1 -1
  61. package/cjs/edit/edit.d.ts +5 -2
  62. package/cjs/edit/edit.js +20 -5
  63. package/cjs/edit/edit.js.map +1 -1
  64. package/cjs/edit/interface.d.ts +6 -1
  65. package/cjs/edit/interface.js +3 -1
  66. package/cjs/edit/interface.js.map +1 -1
  67. package/cjs/index.d.ts +3 -0
  68. package/cjs/index.js +3 -1
  69. package/cjs/index.js.map +1 -1
  70. package/cjs/player/player.js +6 -2
  71. package/cjs/player/player.js.map +1 -1
  72. package/cjs/player/processor/chart/common/chartAppear.d.ts +2 -2
  73. package/cjs/player/processor/chart/common/chartAppear.js.map +1 -1
  74. package/cjs/player/processor/chart/common/commonAppear.d.ts +3 -3
  75. package/cjs/player/processor/chart/common/commonAppear.js.map +1 -1
  76. package/cjs/player/processor/chart/component/axisAppear.d.ts +2 -2
  77. package/cjs/player/processor/chart/component/axisAppear.js.map +1 -1
  78. package/cjs/player/processor/chart/component/commonAppear.d.ts +3 -3
  79. package/cjs/player/processor/chart/component/commonAppear.js.map +1 -1
  80. package/cjs/player/processor/chart/component/labelAppear.d.ts +2 -2
  81. package/cjs/player/processor/chart/component/labelAppear.js.map +1 -1
  82. package/cjs/player/processor/chart/rankingBar/rankingBar.d.ts +29 -0
  83. package/cjs/player/processor/chart/rankingBar/rankingBar.js +54 -0
  84. package/cjs/player/processor/chart/rankingBar/rankingBar.js.map +1 -0
  85. package/cjs/player/processor/chart/seriesmark/commonTransformMarkAppear.d.ts +3 -3
  86. package/cjs/player/processor/chart/seriesmark/commonTransformMarkAppear.js.map +1 -1
  87. package/cjs/player/processor/chart/seriesmark/transformArcVisibility.d.ts +2 -2
  88. package/cjs/player/processor/chart/seriesmark/transformArcVisibility.js.map +1 -1
  89. package/cjs/player/processor/chart/seriesmark/transformLineVisibility.d.ts +2 -2
  90. package/cjs/player/processor/chart/seriesmark/transformLineVisibility.js.map +1 -1
  91. package/cjs/player/processor/chart/seriesmark/transformRectVisibility.d.ts +2 -2
  92. package/cjs/player/processor/chart/seriesmark/transformRectVisibility.js.map +1 -1
  93. package/cjs/player/processor/chart/seriesmark/transformSymbolVisibility.d.ts +2 -2
  94. package/cjs/player/processor/chart/seriesmark/transformSymbolVisibility.js.map +1 -1
  95. package/cjs/player/processor/chart/seriesmark/transformTextVisibility.d.ts +2 -2
  96. package/cjs/player/processor/chart/seriesmark/transformTextVisibility.js.map +1 -1
  97. package/cjs/player/processor/chart/vchart.d.ts +35 -24
  98. package/cjs/player/processor/chart/vchart.js +88 -60
  99. package/cjs/player/processor/chart/vchart.js.map +1 -1
  100. package/cjs/player/processor/common/bounce-processor.js +2 -3
  101. package/cjs/player/processor/common/bounce-processor.js.map +1 -1
  102. package/cjs/player/processor/component/common-component.js +21 -21
  103. package/cjs/player/processor/component/common-component.js.map +1 -1
  104. package/cjs/player/processor/interface/action-processor.d.ts +1 -1
  105. package/cjs/player/processor/interface/action-processor.js.map +1 -1
  106. package/cjs/player/processor/interface/common-action.d.ts +3 -2
  107. package/cjs/player/processor/interface/common-action.js.map +1 -1
  108. package/cjs/player/processor/interface/style-action.d.ts +4 -5
  109. package/cjs/player/processor/interface/style-action.js.map +1 -1
  110. package/cjs/player/processor/processor.js +1 -1
  111. package/cjs/player/processor/processor.js.map +1 -1
  112. package/cjs/player/processor/processorMap.d.ts +9 -0
  113. package/cjs/player/processor/processorMap.js +7 -1
  114. package/cjs/player/processor/processorMap.js.map +1 -1
  115. package/cjs/player/scheduler.js +12 -8
  116. package/cjs/player/scheduler.js.map +1 -1
  117. package/cjs/scene/scene.js +2 -0
  118. package/cjs/story/canvas/canvas.js +3 -4
  119. package/cjs/story/canvas/canvas.js.map +1 -1
  120. package/cjs/story/character/base/base.d.ts +4 -0
  121. package/cjs/story/character/base/base.js +1 -1
  122. package/cjs/story/character/base/base.js.map +1 -1
  123. package/cjs/story/character/chart/character.d.ts +15 -0
  124. package/cjs/story/character/chart/character.js +54 -12
  125. package/cjs/story/character/chart/character.js.map +1 -1
  126. package/cjs/story/character/chart/characters/rankingBar.d.ts +4 -0
  127. package/cjs/story/character/chart/characters/rankingBar.js +15 -0
  128. package/cjs/story/character/chart/characters/rankingBar.js.map +1 -0
  129. package/cjs/story/character/chart/graphic/vchart-graphic-picker.js +6 -8
  130. package/cjs/story/character/chart/graphic/vchart-graphic-picker.js.map +1 -1
  131. package/cjs/story/character/chart/graphic/vchart-graphic-render.js +6 -6
  132. package/cjs/story/character/chart/graphic/vchart-graphic-render.js.map +1 -1
  133. package/cjs/story/character/chart/graphic/vchart-graphic.d.ts +12 -2
  134. package/cjs/story/character/chart/graphic/vchart-graphic.js +77 -13
  135. package/cjs/story/character/chart/graphic/vchart-graphic.js.map +1 -1
  136. package/cjs/story/character/chart/runtime/common-spec.d.ts +2 -4
  137. package/cjs/story/character/chart/runtime/common-spec.js +0 -2
  138. package/cjs/story/character/chart/runtime/common-spec.js.map +1 -1
  139. package/cjs/story/character/chart/runtime/component-spec.d.ts +4 -3
  140. package/cjs/story/character/chart/runtime/component-spec.js +7 -5
  141. package/cjs/story/character/chart/runtime/component-spec.js.map +1 -1
  142. package/cjs/story/character/chart/temp/constant.d.ts +1 -0
  143. package/cjs/story/character/chart/temp/constant.js +2 -1
  144. package/cjs/story/character/chart/temp/constant.js.map +1 -1
  145. package/cjs/story/character/chart/temp/templates/bar.d.ts +20 -0
  146. package/cjs/story/character/chart/temp/templates/bar.js +31 -0
  147. package/cjs/story/character/chart/temp/templates/bar.js.map +1 -0
  148. package/cjs/story/character/chart/temp/templates/base-temp.d.ts +6 -4
  149. package/cjs/story/character/chart/temp/templates/base-temp.js +1 -1
  150. package/cjs/story/character/chart/temp/templates/base-temp.js.map +1 -1
  151. package/cjs/story/character/chart/temp/templates/ranking-bar-temp.d.ts +8 -0
  152. package/cjs/story/character/chart/temp/templates/ranking-bar-temp.js +22 -0
  153. package/cjs/story/character/chart/temp/templates/ranking-bar-temp.js.map +1 -0
  154. package/cjs/story/character/component/character-group/component-group-graphic-render.d.ts +2 -2
  155. package/cjs/story/character/component/character-group/component-group-graphic-render.js +3 -3
  156. package/cjs/story/character/component/character-group/component-group-graphic-render.js.map +1 -1
  157. package/cjs/story/character/component/character-group/component-group-graphic.d.ts +1 -1
  158. package/cjs/story/character/component/character-group/component-group-graphic.js +6 -4
  159. package/cjs/story/character/component/character-group/component-group-graphic.js.map +1 -1
  160. package/cjs/story/character/component/character.d.ts +5 -1
  161. package/cjs/story/character/component/character.js +18 -1
  162. package/cjs/story/character/component/character.js.map +1 -1
  163. package/cjs/story/character/component/characters/character-image.d.ts +3 -0
  164. package/cjs/story/character/component/characters/character-image.js +4 -0
  165. package/cjs/story/character/component/characters/character-image.js.map +1 -1
  166. package/cjs/story/character/component/characters/character-rect.d.ts +3 -0
  167. package/cjs/story/character/component/characters/character-rect.js +4 -0
  168. package/cjs/story/character/component/characters/character-rect.js.map +1 -1
  169. package/cjs/story/character/component/characters/character-shape.d.ts +4 -0
  170. package/cjs/story/character/component/characters/character-shape.js +15 -0
  171. package/cjs/story/character/component/characters/character-shape.js.map +1 -1
  172. package/cjs/story/character/component/graphic/graphic-base-text.d.ts +2 -1
  173. package/cjs/story/character/component/graphic/graphic-base-text.js +7 -2
  174. package/cjs/story/character/component/graphic/graphic-base-text.js.map +1 -1
  175. package/cjs/story/character/component/graphic/symbol.d.ts +3 -0
  176. package/cjs/story/character/component/graphic/symbol.js +17 -3
  177. package/cjs/story/character/component/graphic/symbol.js.map +1 -1
  178. package/cjs/story/character/dsl-interface.d.ts +2 -0
  179. package/cjs/story/character/dsl-interface.js.map +1 -1
  180. package/cjs/story/character/runtime-interface.d.ts +9 -4
  181. package/cjs/story/character/runtime-interface.js.map +1 -1
  182. package/cjs/story/character/visactor/character.d.ts +18 -3
  183. package/cjs/story/character/visactor/character.js +17 -1
  184. package/cjs/story/character/visactor/character.js.map +1 -1
  185. package/cjs/story/character/visactor/interface.js.map +1 -1
  186. package/cjs/story/index.js +5 -2
  187. package/cjs/story/index.js.map +1 -1
  188. package/cjs/story/interface/dsl-interface.d.ts +3 -2
  189. package/cjs/story/interface/dsl-interface.js.map +1 -1
  190. package/cjs/story/interface/runtime-interface.d.ts +2 -0
  191. package/cjs/story/interface/runtime-interface.js.map +1 -1
  192. package/cjs/story/story.js +3 -2
  193. package/cjs/story/story.js.map +1 -1
  194. package/cjs/story/utils/layout.d.ts +2 -1
  195. package/cjs/story/utils/layout.js +2 -2
  196. package/cjs/story/utils/layout.js.map +1 -1
  197. package/cjs/story/utils/vchart-pick.d.ts +115 -0
  198. package/cjs/story/utils/vchart-pick.js +109 -0
  199. package/cjs/story/utils/vchart-pick.js.map +1 -0
  200. package/cjs/util/space.js +2 -1
  201. package/dist/index.js +23405 -26034
  202. package/dist/index.min.js +3 -3
  203. package/es/constants/character.d.ts +2 -1
  204. package/es/constants/character.js +1 -1
  205. package/es/constants/character.js.map +1 -1
  206. package/es/dsl/story-chart/chart.js +2 -1
  207. package/es/dsl/story-chart/line.js +1 -1
  208. package/es/dsl/story-chart/pie.js +1 -1
  209. package/es/dsl/story-processor/index.js +1 -1
  210. package/es/dsl/types/index.d.ts +1 -0
  211. package/es/dsl/types/index.js.map +1 -1
  212. package/es/edit/const.d.ts +1 -3
  213. package/es/edit/const.js +1 -0
  214. package/es/edit/const.js.map +1 -1
  215. package/es/edit/edit-action.d.ts +9 -0
  216. package/es/edit/edit-action.js +63 -5
  217. package/es/edit/edit-action.js.map +1 -1
  218. package/es/edit/edit-component/base-selection.d.ts +8 -3
  219. package/es/edit/edit-component/base-selection.js +31 -3
  220. package/es/edit/edit-component/base-selection.js.map +1 -1
  221. package/es/edit/edit-component/chart-selection.d.ts +15 -0
  222. package/es/edit/edit-component/chart-selection.js +31 -0
  223. package/es/edit/edit-component/chart-selection.js.map +1 -0
  224. package/es/edit/edit-component/common.d.ts +1 -11
  225. package/es/edit/edit-component/common.js +1 -26
  226. package/es/edit/edit-component/common.js.map +1 -1
  227. package/es/edit/edit-component/edit-control/richtext-control.d.ts +19 -0
  228. package/es/edit/edit-component/edit-control/richtext-control.js +28 -0
  229. package/es/edit/edit-component/edit-control/richtext-control.js.map +1 -0
  230. package/es/edit/edit-component/edit-control/richtext-transform-control.d.ts +2 -3
  231. package/es/edit/edit-component/edit-control/richtext-transform-control.js +29 -34
  232. package/es/edit/edit-component/edit-control/richtext-transform-control.js.map +1 -1
  233. package/es/edit/edit-component/edit-control/transform-control.d.ts +4 -2
  234. package/es/edit/edit-component/edit-control/transform-control.js +10 -6
  235. package/es/edit/edit-component/edit-control/transform-control.js.map +1 -1
  236. package/es/edit/edit-component/edit-control/transform-drag.d.ts +1 -0
  237. package/es/edit/edit-component/edit-control/transform-drag.js +4 -2
  238. package/es/edit/edit-component/edit-control/transform-drag.js.map +1 -1
  239. package/es/edit/edit-component/image-selection.d.ts +1 -2
  240. package/es/edit/edit-component/image-selection.js +2 -5
  241. package/es/edit/edit-component/image-selection.js.map +1 -1
  242. package/es/edit/edit-component/index.js +7 -9
  243. package/es/edit/edit-component/index.js.map +1 -1
  244. package/es/edit/edit-component/mixin/richtext.d.ts +21 -0
  245. package/es/edit/edit-component/mixin/richtext.js +18 -0
  246. package/es/edit/edit-component/mixin/richtext.js.map +1 -0
  247. package/es/edit/edit-component/rect-selection.d.ts +8 -12
  248. package/es/edit/edit-component/rect-selection.js +13 -20
  249. package/es/edit/edit-component/rect-selection.js.map +1 -1
  250. package/es/edit/edit-component/richtext-selection-common.d.ts +19 -0
  251. package/es/edit/edit-component/richtext-selection-common.js +33 -0
  252. package/es/edit/edit-component/richtext-selection-common.js.map +1 -0
  253. package/es/edit/edit-component/richtext-selection.d.ts +0 -2
  254. package/es/edit/edit-component/richtext-selection.js +0 -6
  255. package/es/edit/edit-component/richtext-selection.js.map +1 -1
  256. package/es/edit/edit-component/shape-selection.d.ts +11 -0
  257. package/es/edit/edit-component/shape-selection.js +30 -0
  258. package/es/edit/edit-component/shape-selection.js.map +1 -0
  259. package/es/edit/edit-component/text-selection.d.ts +0 -3
  260. package/es/edit/edit-component/text-selection.js +2 -12
  261. package/es/edit/edit-component/text-selection.js.map +1 -1
  262. package/es/edit/edit.d.ts +5 -2
  263. package/es/edit/edit.js +21 -4
  264. package/es/edit/edit.js.map +1 -1
  265. package/es/edit/interface.d.ts +6 -1
  266. package/es/edit/interface.js +3 -1
  267. package/es/edit/interface.js.map +1 -1
  268. package/es/index.d.ts +3 -0
  269. package/es/index.js +7 -1
  270. package/es/index.js.map +1 -1
  271. package/es/player/player.js +6 -2
  272. package/es/player/player.js.map +1 -1
  273. package/es/player/processor/chart/common/chartAppear.d.ts +2 -2
  274. package/es/player/processor/chart/common/chartAppear.js.map +1 -1
  275. package/es/player/processor/chart/common/commonAppear.d.ts +3 -3
  276. package/es/player/processor/chart/common/commonAppear.js.map +1 -1
  277. package/es/player/processor/chart/component/axisAppear.d.ts +2 -2
  278. package/es/player/processor/chart/component/axisAppear.js.map +1 -1
  279. package/es/player/processor/chart/component/commonAppear.d.ts +3 -3
  280. package/es/player/processor/chart/component/commonAppear.js.map +1 -1
  281. package/es/player/processor/chart/component/labelAppear.d.ts +2 -2
  282. package/es/player/processor/chart/component/labelAppear.js.map +1 -1
  283. package/es/player/processor/chart/rankingBar/rankingBar.d.ts +29 -0
  284. package/es/player/processor/chart/rankingBar/rankingBar.js +50 -0
  285. package/es/player/processor/chart/rankingBar/rankingBar.js.map +1 -0
  286. package/es/player/processor/chart/seriesmark/commonTransformMarkAppear.d.ts +3 -3
  287. package/es/player/processor/chart/seriesmark/commonTransformMarkAppear.js.map +1 -1
  288. package/es/player/processor/chart/seriesmark/transformArcVisibility.d.ts +2 -2
  289. package/es/player/processor/chart/seriesmark/transformArcVisibility.js.map +1 -1
  290. package/es/player/processor/chart/seriesmark/transformLineVisibility.d.ts +2 -2
  291. package/es/player/processor/chart/seriesmark/transformLineVisibility.js.map +1 -1
  292. package/es/player/processor/chart/seriesmark/transformRectVisibility.d.ts +2 -2
  293. package/es/player/processor/chart/seriesmark/transformRectVisibility.js.map +1 -1
  294. package/es/player/processor/chart/seriesmark/transformSymbolVisibility.d.ts +2 -2
  295. package/es/player/processor/chart/seriesmark/transformSymbolVisibility.js.map +1 -1
  296. package/es/player/processor/chart/seriesmark/transformTextVisibility.d.ts +2 -2
  297. package/es/player/processor/chart/seriesmark/transformTextVisibility.js.map +1 -1
  298. package/es/player/processor/chart/vchart.d.ts +35 -24
  299. package/es/player/processor/chart/vchart.js +89 -61
  300. package/es/player/processor/chart/vchart.js.map +1 -1
  301. package/es/player/processor/common/bounce-processor.js +2 -3
  302. package/es/player/processor/common/bounce-processor.js.map +1 -1
  303. package/es/player/processor/component/common-component.js +21 -21
  304. package/es/player/processor/component/common-component.js.map +1 -1
  305. package/es/player/processor/interface/action-processor.d.ts +1 -1
  306. package/es/player/processor/interface/action-processor.js.map +1 -1
  307. package/es/player/processor/interface/common-action.d.ts +3 -2
  308. package/es/player/processor/interface/common-action.js.map +1 -1
  309. package/es/player/processor/interface/style-action.d.ts +4 -5
  310. package/es/player/processor/interface/style-action.js.map +1 -1
  311. package/es/player/processor/processor.js +1 -1
  312. package/es/player/processor/processor.js.map +1 -1
  313. package/es/player/processor/processorMap.d.ts +9 -0
  314. package/es/player/processor/processorMap.js +8 -0
  315. package/es/player/processor/processorMap.js.map +1 -1
  316. package/es/player/scheduler.js +12 -8
  317. package/es/player/scheduler.js.map +1 -1
  318. package/es/scene/scene.js +2 -0
  319. package/es/story/canvas/canvas.js +3 -4
  320. package/es/story/canvas/canvas.js.map +1 -1
  321. package/es/story/character/base/base.d.ts +4 -0
  322. package/es/story/character/base/base.js +1 -1
  323. package/es/story/character/base/base.js.map +1 -1
  324. package/es/story/character/chart/character.d.ts +15 -0
  325. package/es/story/character/chart/character.js +57 -14
  326. package/es/story/character/chart/character.js.map +1 -1
  327. package/es/story/character/chart/characters/rankingBar.d.ts +4 -0
  328. package/es/story/character/chart/characters/rankingBar.js +14 -0
  329. package/es/story/character/chart/characters/rankingBar.js.map +1 -0
  330. package/es/story/character/chart/graphic/vchart-graphic-picker.js +6 -8
  331. package/es/story/character/chart/graphic/vchart-graphic-picker.js.map +1 -1
  332. package/es/story/character/chart/graphic/vchart-graphic-render.js +7 -7
  333. package/es/story/character/chart/graphic/vchart-graphic-render.js.map +1 -1
  334. package/es/story/character/chart/graphic/vchart-graphic.d.ts +12 -2
  335. package/es/story/character/chart/graphic/vchart-graphic.js +80 -12
  336. package/es/story/character/chart/graphic/vchart-graphic.js.map +1 -1
  337. package/es/story/character/chart/runtime/common-spec.d.ts +2 -4
  338. package/es/story/character/chart/runtime/common-spec.js +0 -2
  339. package/es/story/character/chart/runtime/common-spec.js.map +1 -1
  340. package/es/story/character/chart/runtime/component-spec.d.ts +4 -3
  341. package/es/story/character/chart/runtime/component-spec.js +7 -5
  342. package/es/story/character/chart/runtime/component-spec.js.map +1 -1
  343. package/es/story/character/chart/temp/constant.d.ts +1 -0
  344. package/es/story/character/chart/temp/constant.js +2 -1
  345. package/es/story/character/chart/temp/constant.js.map +1 -1
  346. package/es/story/character/chart/temp/templates/bar.d.ts +20 -0
  347. package/es/story/character/chart/temp/templates/bar.js +27 -0
  348. package/es/story/character/chart/temp/templates/bar.js.map +1 -0
  349. package/es/story/character/chart/temp/templates/base-temp.d.ts +6 -4
  350. package/es/story/character/chart/temp/templates/base-temp.js +1 -1
  351. package/es/story/character/chart/temp/templates/base-temp.js.map +1 -1
  352. package/es/story/character/chart/temp/templates/ranking-bar-temp.d.ts +8 -0
  353. package/es/story/character/chart/temp/templates/ranking-bar-temp.js +18 -0
  354. package/es/story/character/chart/temp/templates/ranking-bar-temp.js.map +1 -0
  355. package/es/story/character/component/character-group/component-group-graphic-render.d.ts +2 -2
  356. package/es/story/character/component/character-group/component-group-graphic-render.js +4 -4
  357. package/es/story/character/component/character-group/component-group-graphic-render.js.map +1 -1
  358. package/es/story/character/component/character-group/component-group-graphic.d.ts +1 -1
  359. package/es/story/character/component/character-group/component-group-graphic.js +5 -3
  360. package/es/story/character/component/character-group/component-group-graphic.js.map +1 -1
  361. package/es/story/character/component/character.d.ts +5 -1
  362. package/es/story/character/component/character.js +18 -1
  363. package/es/story/character/component/character.js.map +1 -1
  364. package/es/story/character/component/characters/character-image.d.ts +3 -0
  365. package/es/story/character/component/characters/character-image.js +4 -0
  366. package/es/story/character/component/characters/character-image.js.map +1 -1
  367. package/es/story/character/component/characters/character-rect.d.ts +3 -0
  368. package/es/story/character/component/characters/character-rect.js +4 -0
  369. package/es/story/character/component/characters/character-rect.js.map +1 -1
  370. package/es/story/character/component/characters/character-shape.d.ts +4 -0
  371. package/es/story/character/component/characters/character-shape.js +15 -0
  372. package/es/story/character/component/characters/character-shape.js.map +1 -1
  373. package/es/story/character/component/graphic/graphic-base-text.d.ts +2 -1
  374. package/es/story/character/component/graphic/graphic-base-text.js +7 -2
  375. package/es/story/character/component/graphic/graphic-base-text.js.map +1 -1
  376. package/es/story/character/component/graphic/symbol.d.ts +3 -0
  377. package/es/story/character/component/graphic/symbol.js +17 -2
  378. package/es/story/character/component/graphic/symbol.js.map +1 -1
  379. package/es/story/character/dsl-interface.d.ts +2 -0
  380. package/es/story/character/dsl-interface.js.map +1 -1
  381. package/es/story/character/runtime-interface.d.ts +9 -4
  382. package/es/story/character/runtime-interface.js.map +1 -1
  383. package/es/story/character/visactor/character.d.ts +18 -3
  384. package/es/story/character/visactor/character.js +18 -0
  385. package/es/story/character/visactor/character.js.map +1 -1
  386. package/es/story/character/visactor/interface.js.map +1 -1
  387. package/es/story/index.js +7 -3
  388. package/es/story/index.js.map +1 -1
  389. package/es/story/interface/dsl-interface.d.ts +3 -2
  390. package/es/story/interface/dsl-interface.js.map +1 -1
  391. package/es/story/interface/runtime-interface.d.ts +2 -0
  392. package/es/story/interface/runtime-interface.js.map +1 -1
  393. package/es/story/story.js +3 -2
  394. package/es/story/story.js.map +1 -1
  395. package/es/story/utils/layout.d.ts +2 -1
  396. package/es/story/utils/layout.js +2 -2
  397. package/es/story/utils/layout.js.map +1 -1
  398. package/es/story/utils/vchart-pick.d.ts +115 -0
  399. package/es/story/utils/vchart-pick.js +115 -0
  400. package/es/story/utils/vchart-pick.js.map +1 -0
  401. package/es/util/space.js +2 -1
  402. package/package.json +8 -7
@@ -1,16 +1,18 @@
1
1
  import { genNumberType, Group } from "@visactor/vrender";
2
2
 
3
- export const CHART_NUMBER_TYPE = genNumberType();
3
+ export const COMPONENT_NUMBER_TYPE = genNumberType();
4
4
 
5
5
  export class ComponentGroup extends Group {
6
6
  constructor(attrs) {
7
- super(Object.assign({
7
+ super(Object.assign(Object.assign({
8
8
  scaleX: 1,
9
9
  scaleY: 1,
10
10
  x: 0,
11
11
  y: 0,
12
12
  angle: 0
13
- }, attrs)), this.type = "vstory-component-group", this.numberType = CHART_NUMBER_TYPE;
13
+ }, attrs), {
14
+ pickable: !1
15
+ })), this.type = "vstory-component-group", this.numberType = COMPONENT_NUMBER_TYPE;
14
16
  }
15
17
  }
16
18
  //# sourceMappingURL=component-group-graphic.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/component/character-group/component-group-graphic.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAoBzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAGjD,MAAM,OAAO,cAAe,SAAQ,KAAK;IAIvC,YAAY,KAA6B;QAEvC,KAAK,iBAAG,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,IAAK,KAAK,EAAG,CAAC;QALlE,SAAI,GAAgB,wBAA+B,CAAC;QACpD,eAAU,GAAW,iBAAiB,CAAC;IAKvC,CAAC;CACF","file":"component-group-graphic.js","sourcesContent":["import type { IVisactorGraphic } from '../../visactor/interface';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport type { ISpec, IVChart } from '@visactor/vchart';\nimport type { GraphicType, IGroupGraphicAttribute, ITicker } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\n\nexport interface IChartGraphicAttribute extends IGroupGraphicAttribute {\n renderCanvas: HTMLCanvasElement;\n spec: any;\n ClassType: any;\n vchart: IVChart;\n mode: string;\n modeParams?: any;\n dpr: number;\n interactive: boolean;\n animation: boolean;\n disableTriggerEvent: boolean;\n disableDirtyBounds: boolean;\n viewBox: IBoundsLike;\n ticker?: ITicker;\n autoRender?: boolean;\n chartInitOptions?: any;\n}\n\nexport const CHART_NUMBER_TYPE = genNumberType();\n\n// @ts-ignore\nexport class ComponentGroup extends Group implements IVisactorGraphic {\n type: GraphicType = 'vstory-component-group' as any;\n numberType: number = CHART_NUMBER_TYPE;\n\n constructor(attrs: IGroupGraphicAttribute) {\n // vstory-component-group没有主题,必须都初始化,否则动画会找不到属性\n super({ scaleX: 1, scaleY: 1, x: 0, y: 0, angle: 0, ...attrs });\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/component/character-group/component-group-graphic.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAoBzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,EAAE,CAAC;AAGrD,MAAM,OAAO,cAAe,SAAQ,KAAK;IAIvC,YAAY,KAA6B;QAEvC,KAAK,+BAAG,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,IAAK,KAAK,KAAE,QAAQ,EAAE,KAAK,IAAG,CAAC;QALnF,SAAI,GAAgB,wBAA+B,CAAC;QACpD,eAAU,GAAW,qBAAqB,CAAC;IAK3C,CAAC;CACF","file":"component-group-graphic.js","sourcesContent":["import type { IVisactorGraphic } from '../../visactor/interface';\nimport type { IBoundsLike } from '@visactor/vutils';\nimport type { ISpec, IVChart } from '@visactor/vchart';\nimport type { GraphicType, IGroupGraphicAttribute, ITicker } from '@visactor/vrender';\nimport { genNumberType, Group } from '@visactor/vrender';\n\nexport interface IChartGraphicAttribute extends IGroupGraphicAttribute {\n renderCanvas: HTMLCanvasElement;\n spec: any;\n ClassType: any;\n vchart: IVChart;\n mode: string;\n modeParams?: any;\n dpr: number;\n interactive: boolean;\n animation: boolean;\n disableTriggerEvent: boolean;\n disableDirtyBounds: boolean;\n viewBox: IBoundsLike;\n ticker?: ITicker;\n autoRender?: boolean;\n chartInitOptions?: any;\n}\n\nexport const COMPONENT_NUMBER_TYPE = genNumberType();\n\n// @ts-ignore\nexport class ComponentGroup extends Group implements IVisactorGraphic {\n type: GraphicType = 'vstory-component-group' as any;\n numberType: number = COMPONENT_NUMBER_TYPE;\n\n constructor(attrs: IGroupGraphicAttribute) {\n // vstory-component-group没有主题,必须都初始化,否则动画会找不到属性\n super({ scaleX: 1, scaleY: 1, x: 0, y: 0, angle: 0, ...attrs, pickable: false });\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { IBoundsLike } from '@visactor/vutils';
1
2
  import type { IGroup } from '@visactor/vrender';
2
3
  import { GraphicBaseText } from './graphic/graphic-base-text';
3
4
  import type { IComponentCharacterSpec } from '../dsl-interface';
@@ -6,16 +7,18 @@ import type { Graphic } from './graphic/graphic';
6
7
  import type { StoryEvent } from '../../interface/runtime-interface';
7
8
  import type { ICharacterPickInfo } from '../runtime-interface';
8
9
  export declare abstract class CharacterComponent extends CharacterBase {
10
+ visActorType: 'component';
9
11
  protected _spec: IComponentCharacterSpec;
10
12
  get spec(): IComponentCharacterSpec;
11
13
  protected _text: GraphicBaseText;
12
14
  get text(): GraphicBaseText;
15
+ get textGraphic(): import("@visactor/vrender").IRichText;
13
16
  protected _group: IGroup;
14
17
  get group(): IGroup;
15
18
  readonly graphicType: string;
16
19
  protected _parserSpec(): void;
17
20
  protected _initGraphics(): void;
18
- setAttributes(attr: Record<string, any>): void;
21
+ setAttributes(updateAttr: Record<string, any>): void;
19
22
  protected abstract _createGraphic(): Graphic;
20
23
  protected _initRuntime(): void;
21
24
  show(): void;
@@ -28,6 +31,7 @@ export declare abstract class CharacterComponent extends CharacterBase {
28
31
  };
29
32
  clearCharacter(): void;
30
33
  getGraphicParent(): IGroup;
34
+ getLayoutBounds(): IBoundsLike;
31
35
  checkEvent(event: StoryEvent): false | ICharacterPickInfo;
32
36
  release(): void;
33
37
  }
@@ -1,3 +1,13 @@
1
+ var __rest = this && this.__rest || function(s, e) {
2
+ var t = {};
3
+ for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
4
+ if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
5
+ var i = 0;
6
+ for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
7
+ }
8
+ return t;
9
+ };
10
+
1
11
  import { GraphicBaseText } from "./graphic/graphic-base-text";
2
12
 
3
13
  import { CharacterBase } from "../base/base";
@@ -16,6 +26,9 @@ export class CharacterComponent extends CharacterBase {
16
26
  get text() {
17
27
  return this._text;
18
28
  }
29
+ get textGraphic() {
30
+ return this._text.graphic;
31
+ }
19
32
  get group() {
20
33
  return this._group;
21
34
  }
@@ -30,7 +43,8 @@ export class CharacterComponent extends CharacterBase {
30
43
  this._graphic.applyLayoutData(this._spec.position), this._text.applyLayoutData(this._spec.position),
31
44
  this.hide();
32
45
  }
33
- setAttributes(attr) {
46
+ setAttributes(updateAttr) {
47
+ const {position: position} = updateAttr, rest = __rest(updateAttr, [ "position" ]), attr = Object.assign(Object.assign({}, null != position ? position : {}), rest);
34
48
  this.group.setAttributes(attr), this._graphic.setAttributes(Object.assign(Object.assign({}, attr), {
35
49
  x: 0,
36
50
  y: 0,
@@ -59,6 +73,9 @@ export class CharacterComponent extends CharacterBase {
59
73
  getGraphicParent() {
60
74
  return this._group;
61
75
  }
76
+ getLayoutBounds() {
77
+ return this._group.AABBBounds;
78
+ }
62
79
  checkEvent(event) {
63
80
  var _a;
64
81
  return !!(null !== (_a = event.detailPath) && void 0 !== _a ? _a : event.path).some((g => g === this._group)) && {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/component/character.ts"],"names":[],"mappings":"A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;IACrB,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,UAAU,CAAC,KAAiB;;QAC1B,IAAI,CAAC,CAAC,MAAA,KAAK,CAAC,UAAU,mCAAI,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE;YAClE,OAAO,KAAK,CAAC;SACd;QACD,OAAO;YACL,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;YACtF,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;CACF","file":"character.js","sourcesContent":["import type { IGroup } from '@visactor/vrender';\nimport { createGroup } from '@visactor/vrender';\nimport { GraphicBaseText } from './graphic/graphic-base-text';\nimport type { IComponentCharacterSpec } from '../dsl-interface';\nimport { CharacterBase } from '../base/base';\nimport type { Graphic } from './graphic/graphic';\nimport { getLayoutFromWidget } from '../../utils/layout';\nimport type { StoryEvent } from '../../interface/runtime-interface';\nimport type { ICharacterPickInfo } from '../runtime-interface';\nimport { ComponentGroup } from './character-group/component-group-graphic';\n\nexport abstract class CharacterComponent extends CharacterBase {\n protected declare _spec: IComponentCharacterSpec;\n get spec() {\n return this._spec;\n }\n // protected declare _graphic: Graphic;\n // get graphic() {\n // return this._graphic;\n // }\n protected declare _text: GraphicBaseText;\n get text() {\n return this._text;\n }\n\n protected declare _group: IGroup;\n get group() {\n return this._group;\n }\n\n readonly graphicType: string = 'rect';\n\n protected _parserSpec(): void {\n return;\n }\n\n protected _initGraphics(): void {\n this._group = new ComponentGroup({\n ...getLayoutFromWidget(this._spec.position),\n angle: this._spec.options.angle,\n zIndex: this._spec.zIndex\n });\n this.option.graphicParent.add(this._group);\n\n this._graphic = this._createGraphic();\n this._text = new GraphicBaseText(this);\n this._graphic.init();\n this._text.init();\n\n this._graphic.applyGraphicAttribute(this._spec.options.graphic);\n this._text.applyGraphicAttribute(this._spec.options.text);\n\n this._graphic.applyLayoutData(this._spec.position);\n this._text.applyLayoutData(this._spec.position);\n this.hide();\n }\n\n setAttributes(attr: Record<string, any>): void {\n this.group.setAttributes(attr);\n this._graphic.setAttributes({ ...attr, x: 0, y: 0, angle: 0 });\n this._text.updateAttribute({});\n }\n\n protected abstract _createGraphic(): Graphic;\n\n protected _initRuntime(): void {\n return;\n }\n\n show(): void {\n this._group.setAttributes({ visible: true });\n this._text.show();\n this._graphic.show();\n }\n hide(): void {\n this._group.setAttributes({ visible: false });\n this._text.hide();\n this._graphic.hide();\n }\n\n getTextLayoutRatio(): { left: number; right: number; top: number; bottom: number } {\n return this._graphic.getTextLayoutRatio();\n }\n\n clearCharacter(): void {\n this._group?.parent.removeChild(this._group);\n this._group = null;\n }\n\n getGraphicParent() {\n return this._group;\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n if (!(event.detailPath ?? event.path).some(g => g === this._group)) {\n return false;\n }\n return {\n part: event.path[event.path.length - 1] === this._graphic.graphic ? 'graphic' : 'text',\n graphicType: this.graphicType\n };\n }\n\n release() {\n this.option.graphicParent.removeChild(this._group);\n }\n}\n\n// export abstract class CharacterGraphicComponent extends CharacterBase {\n// protected declare _spec: IComponentCharacterSpec;\n\n// get spec() {\n// return this._spec;\n// }\n// protected declare _graphic: Graphic;\n// get graphic() {\n// return this._graphic;\n// }\n\n// protected declare _group: IGroup;\n// get group() {\n// return this._group;\n// }\n\n// protected abstract _createGraphic(): Graphic;\n\n// protected _initRuntime(): void {\n// return;\n// }\n\n// protected _parserSpec(): void {\n// return;\n// }\n\n// protected _initGraphics(): void {\n// this._group = createGroup({\n// ...getLayoutFromWidget(this._spec.position),\n// angle: this._spec.options.angle,\n// zIndex: this._spec.zIndex\n// });\n// this.option.graphicParent.add(this._group);\n\n// this._graphic = this._createGraphic();\n// this._graphic.init();\n\n// this._graphic.applyGraphicAttribute(this._spec.options.graphic);\n\n// this._graphic.applyLayoutData(this._spec.position);\n// this.hide();\n// }\n\n// show(): void {\n// this._graphic?.show();\n// }\n// hide(): void {\n// this._graphic?.hide();\n// }\n\n// getGraphicParent() {\n// return this._group;\n// }\n\n// clearCharacter(): void {\n// if (this._group) {\n// this._group.parent.removeChild(this._group);\n// this._graphic = null;\n// }\n// }\n// }\n"]}
1
+ {"version":3,"sources":["../src/story/character/component/character.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,MAAM,OAAgB,kBAAmB,SAAQ,aAAa;IAA9D;;QAwBW,gBAAW,GAAW,MAAM,CAAC;IAkFxC,CAAC;IAvGC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAMD,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;IAGD,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAIS,WAAW;QACnB,OAAO;IACT,CAAC;IAES,aAAa;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,iCAC3B,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAC3C,KAAK,EAAE,IAA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,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;YACtF,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;CACF","file":"character.js","sourcesContent":["import type { IBoundsLike } from '@visactor/vutils';\nimport type { IGroup } from '@visactor/vrender';\nimport { GraphicBaseText } from './graphic/graphic-base-text';\nimport type { IComponentCharacterSpec } from '../dsl-interface';\nimport { CharacterBase } from '../base/base';\nimport type { Graphic } from './graphic/graphic';\nimport { getLayoutFromWidget } from '../../utils/layout';\nimport type { StoryEvent } from '../../interface/runtime-interface';\nimport type { ICharacterPickInfo } from '../runtime-interface';\nimport { ComponentGroup } from './character-group/component-group-graphic';\n\nexport abstract class CharacterComponent extends CharacterBase {\n visActorType: 'component';\n protected declare _spec: IComponentCharacterSpec;\n get spec() {\n return this._spec;\n }\n // protected declare _graphic: Graphic;\n // get graphic() {\n // return this._graphic;\n // }\n protected declare _text: GraphicBaseText;\n get text() {\n return this._text;\n }\n\n get textGraphic() {\n return this._text.graphic;\n }\n\n protected declare _group: IGroup;\n get group() {\n return this._group;\n }\n\n readonly graphicType: string = 'rect';\n\n protected _parserSpec(): void {\n return;\n }\n\n protected _initGraphics(): void {\n this._group = new ComponentGroup({\n ...getLayoutFromWidget(this._spec.position),\n angle: this._spec.options.angle,\n zIndex: this._spec.zIndex\n });\n this.option.graphicParent.add(this._group);\n\n this._graphic = this._createGraphic();\n this._text = new GraphicBaseText(this);\n this._graphic.init();\n this._text.init();\n\n this._graphic.applyGraphicAttribute(this._spec.options.graphic);\n this._text.applyGraphicAttribute(this._spec.options.text);\n\n this._graphic.applyLayoutData(this._spec.position);\n this._text.applyLayoutData(this._spec.position);\n this.hide();\n }\n\n setAttributes(updateAttr: Record<string, any>): void {\n const { position, ...rest } = updateAttr;\n const attr = { ...(position ?? {}), ...rest };\n this.group.setAttributes(attr);\n this._graphic.setAttributes({ ...attr, x: 0, y: 0, angle: 0 });\n this._text.updateAttribute({});\n }\n\n protected abstract _createGraphic(): Graphic;\n\n protected _initRuntime(): void {\n return;\n }\n\n show(): void {\n this._group.setAttributes({ visible: true });\n this._text.show();\n this._graphic.show();\n }\n hide(): void {\n this._group.setAttributes({ visible: false });\n this._text.hide();\n this._graphic.hide();\n }\n\n getTextLayoutRatio(): { left: number; right: number; top: number; bottom: number } {\n return this._graphic.getTextLayoutRatio();\n }\n\n clearCharacter(): void {\n this._group?.parent.removeChild(this._group);\n this._group = null;\n }\n\n getGraphicParent() {\n return this._group;\n }\n\n getLayoutBounds() {\n return this._group.AABBBounds as IBoundsLike;\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n if (!(event.detailPath ?? event.path).some(g => g === this._group)) {\n return false;\n }\n return {\n part: event.path[event.path.length - 1] === this._graphic.graphic ? 'graphic' : 'text',\n graphicType: this.graphicType\n };\n }\n\n release() {\n this.option.graphicParent.removeChild(this._group);\n }\n}\n\n// export abstract class CharacterGraphicComponent extends CharacterBase {\n// protected declare _spec: IComponentCharacterSpec;\n\n// get spec() {\n// return this._spec;\n// }\n// protected declare _graphic: Graphic;\n// get graphic() {\n// return this._graphic;\n// }\n\n// protected declare _group: IGroup;\n// get group() {\n// return this._group;\n// }\n\n// protected abstract _createGraphic(): Graphic;\n\n// protected _initRuntime(): void {\n// return;\n// }\n\n// protected _parserSpec(): void {\n// return;\n// }\n\n// protected _initGraphics(): void {\n// this._group = createGroup({\n// ...getLayoutFromWidget(this._spec.position),\n// angle: this._spec.options.angle,\n// zIndex: this._spec.zIndex\n// });\n// this.option.graphicParent.add(this._group);\n\n// this._graphic = this._createGraphic();\n// this._graphic.init();\n\n// this._graphic.applyGraphicAttribute(this._spec.options.graphic);\n\n// this._graphic.applyLayoutData(this._spec.position);\n// this.hide();\n// }\n\n// show(): void {\n// this._graphic?.show();\n// }\n// hide(): void {\n// this._graphic?.hide();\n// }\n\n// getGraphicParent() {\n// return this._group;\n// }\n\n// clearCharacter(): void {\n// if (this._group) {\n// this._group.parent.removeChild(this._group);\n// this._graphic = null;\n// }\n// }\n// }\n"]}
@@ -1,6 +1,9 @@
1
1
  import type { Graphic } from '../graphic/graphic';
2
2
  import { CharacterComponent } from '../character';
3
+ import type { StoryEvent } from '../../../interface';
4
+ import type { ICharacterPickInfo } from '../../runtime-interface';
3
5
  export declare class CharacterComponentImage extends CharacterComponent {
4
6
  readonly graphicType: string;
5
7
  protected _createGraphic(): Graphic;
8
+ checkEvent(event: StoryEvent): false | ICharacterPickInfo;
6
9
  }
@@ -11,5 +11,9 @@ export class CharacterComponentImage extends CharacterComponent {
11
11
  _createGraphic() {
12
12
  return new GraphicImage(StoryComponentType.IMAGE, this);
13
13
  }
14
+ checkEvent(event) {
15
+ const info = super.checkEvent(event);
16
+ return (!info || event.path[event.path.length - 1] !== this._group) && info;
17
+ }
14
18
  }
15
19
  //# sourceMappingURL=character-image.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/component/characters/character-image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;IAA/D;;QACW,gBAAW,GAAW,OAAO,CAAC;IAIzC,CAAC;IAHW,cAAc;QACtB,OAAO,IAAI,YAAY,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAW,CAAC,CAAC;IACjE,CAAC;CACF","file":"character-image.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport { GraphicImage } from '../graphic/image';\n\nexport class CharacterComponentImage extends CharacterComponent {\n readonly graphicType: string = 'image';\n protected _createGraphic(): Graphic {\n return new GraphicImage(StoryComponentType.IMAGE, this as any);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/component/characters/character-image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIhD,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;IAA/D;;QACW,gBAAW,GAAW,OAAO,CAAC;IAYzC,CAAC;IAXW,cAAc;QACtB,OAAO,IAAI,YAAY,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAW,CAAC,CAAC;IACjE,CAAC;IAED,UAAU,CAAC,KAAiB;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE;YAC7D,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"character-image.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport { GraphicImage } from '../graphic/image';\nimport type { StoryEvent } from '../../../interface';\nimport type { ICharacterPickInfo } from '../../runtime-interface';\n\nexport class CharacterComponentImage extends CharacterComponent {\n readonly graphicType: string = 'image';\n protected _createGraphic(): Graphic {\n return new GraphicImage(StoryComponentType.IMAGE, this as any);\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n const info = super.checkEvent(event);\n if (info && event.path[event.path.length - 1] === this._group) {\n return false;\n }\n return info;\n }\n}\n"]}
@@ -1,6 +1,9 @@
1
1
  import type { Graphic } from '../graphic/graphic';
2
2
  import { CharacterComponent } from '../character';
3
+ import type { StoryEvent } from '../../../interface';
4
+ import type { ICharacterPickInfo } from '../../runtime-interface';
3
5
  export declare class CharacterComponentRect extends CharacterComponent {
4
6
  readonly graphicType: string;
5
7
  protected _createGraphic(): Graphic;
8
+ checkEvent(event: StoryEvent): false | ICharacterPickInfo;
6
9
  }
@@ -11,5 +11,9 @@ export class CharacterComponentRect extends CharacterComponent {
11
11
  _createGraphic() {
12
12
  return new GraphicRect(StoryComponentType.RECT, this);
13
13
  }
14
+ checkEvent(event) {
15
+ const info = super.checkEvent(event);
16
+ return (!info || event.path[event.path.length - 1] !== this._group) && info;
17
+ }
14
18
  }
15
19
  //# sourceMappingURL=character-rect.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/component/characters/character-rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAA9D;;QACW,gBAAW,GAAW,MAAM,CAAC;IAIxC,CAAC;IAHW,cAAc;QACtB,OAAO,IAAI,WAAW,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;CACF","file":"character-rect.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { GraphicRect } from '../graphic/rect';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\n\nexport class CharacterComponentRect extends CharacterComponent {\n readonly graphicType: string = 'rect';\n protected _createGraphic(): Graphic {\n return new GraphicRect(StoryComponentType.RECT, this);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/component/characters/character-rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAIrE,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAA9D;;QACW,gBAAW,GAAW,MAAM,CAAC;IAYxC,CAAC;IAXW,cAAc;QACtB,OAAO,IAAI,WAAW,CAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAED,UAAU,CAAC,KAAiB;QAC1B,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,MAAM,EAAE;YAC7D,OAAO,KAAK,CAAC;SACd;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"character-rect.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { GraphicRect } from '../graphic/rect';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport type { StoryEvent } from '../../../interface';\nimport type { ICharacterPickInfo } from '../../runtime-interface';\n\nexport class CharacterComponentRect extends CharacterComponent {\n readonly graphicType: string = 'rect';\n protected _createGraphic(): Graphic {\n return new GraphicRect(StoryComponentType.RECT, this);\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n const info = super.checkEvent(event);\n if (info && event.path[event.path.length - 1] === this._group) {\n return false;\n }\n return info;\n }\n}\n"]}
@@ -1,6 +1,10 @@
1
1
  import type { Graphic } from '../graphic/graphic';
2
2
  import { CharacterComponent } from '../character';
3
+ import type { StoryEvent } from '../../../interface';
4
+ import type { ICharacterPickInfo } from '../../runtime-interface';
3
5
  export declare class CharacterComponentShape extends CharacterComponent {
4
6
  readonly graphicType: string;
5
7
  protected _createGraphic(): Graphic;
8
+ setAttributes(attr: Record<string, any>): void;
9
+ checkEvent(event: StoryEvent): false | ICharacterPickInfo;
6
10
  }
@@ -11,5 +11,20 @@ export class CharacterComponentShape extends CharacterComponent {
11
11
  _createGraphic() {
12
12
  return new GraphicSymbol(StoryComponentType.SHAPE, this);
13
13
  }
14
+ setAttributes(attr) {
15
+ this.group.setAttributes(Object.assign(Object.assign({}, attr), {
16
+ x: attr.x - attr.width / 2,
17
+ y: attr.y - attr.height / 2
18
+ })), this._graphic.setAttributes(Object.assign(Object.assign({}, attr), {
19
+ x: attr.width / 2,
20
+ y: attr.height / 2,
21
+ angle: 0,
22
+ size: Math.min(attr.width, attr.height)
23
+ })), this._text.updateAttribute({});
24
+ }
25
+ checkEvent(event) {
26
+ const info = super.checkEvent(event);
27
+ return (!info || event.path[event.path.length - 1] !== this._group) && info;
28
+ }
14
29
  }
15
30
  //# sourceMappingURL=character-shape.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/component/characters/character-shape.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;IAA/D;;QACW,gBAAW,GAAW,OAAO,CAAC;IAIzC,CAAC;IAHW,cAAc;QACtB,OAAO,IAAI,aAAa,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC3D,CAAC;CACF","file":"character-shape.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport { GraphicSymbol } from '../graphic/symbol';\n\nexport class CharacterComponentShape extends CharacterComponent {\n readonly graphicType: string = 'shape';\n protected _createGraphic(): Graphic {\n return new GraphicSymbol(StoryComponentType.SHAPE, this);\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/component/characters/character-shape.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ape.js","sourcesContent":["import type { Graphic } from '../graphic/graphic';\nimport { CharacterComponent } from '../character';\nimport { StoryComponentType } from '../../../../constants/character';\nimport { GraphicSymbol } from '../graphic/symbol';\nimport type { StoryEvent } from '../../../interface';\nimport type { ICharacterPickInfo } from '../../runtime-interface';\n\nexport class CharacterComponentShape extends CharacterComponent {\n readonly graphicType: string = 'shape';\n protected _createGraphic(): Graphic {\n return new GraphicSymbol(StoryComponentType.SHAPE, this);\n }\n\n setAttributes(attr: Record<string, any>): void {\n this.group.setAttributes({\n ...attr,\n x: attr.x - attr.width / 2,\n y: attr.y - attr.height / 2\n });\n this._graphic.setAttributes({\n ...attr,\n x: attr.width / 2,\n y: attr.height / 2,\n angle: 0,\n size: Math.min(attr.width, attr.height)\n });\n this._text.updateAttribute({});\n }\n\n checkEvent(event: StoryEvent): false | ICharacterPickInfo {\n const info = super.checkEvent(event);\n if (info && event.path[event.path.length - 1] === this._group) {\n return false;\n }\n return info;\n }\n}\n"]}
@@ -1,10 +1,11 @@
1
1
  import type { IWidgetData } from '../../dsl-interface';
2
- import type { IRichTextGraphicAttribute } from '@visactor/vrender';
2
+ import type { IRichText, IRichTextGraphicAttribute } from '@visactor/vrender';
3
3
  import type { CharacterComponent } from '../character';
4
4
  export declare const MAX_LAYOUT_SIZE = 999999;
5
5
  export declare class GraphicBaseText {
6
6
  private _character;
7
7
  private _graphic;
8
+ get graphic(): IRichText;
8
9
  constructor(graphicCharacter: CharacterComponent);
9
10
  getInitialAttributes(): IRichTextGraphicAttribute & {
10
11
  graphicAlign: string;
@@ -5,6 +5,9 @@ import { createRichText } from "@visactor/vrender";
5
5
  export const MAX_LAYOUT_SIZE = 999999;
6
6
 
7
7
  export class GraphicBaseText {
8
+ get graphic() {
9
+ return this._graphic;
10
+ }
8
11
  constructor(graphicCharacter) {
9
12
  this.updateAttribute = attribute => {
10
13
  attribute && (this._graphic.setAttributes(this._transformTextAttributes(attribute)),
@@ -23,6 +26,8 @@ export class GraphicBaseText {
23
26
  graphicAlign: "center",
24
27
  graphicBaseline: "middle",
25
28
  ignoreBuf: !0,
29
+ height: 0,
30
+ width: 0,
26
31
  maxLineWidth: 999999,
27
32
  heightLimit: 999999
28
33
  };
@@ -93,8 +98,8 @@ export class GraphicBaseText {
93
98
  this._graphic.setAttributes(this._transformTextAttributes({
94
99
  x: x,
95
100
  y: y,
96
- textAlign: align,
97
- textBaseline: baseline,
101
+ textAlign: graphicAlign,
102
+ textBaseline: graphicBaseline,
98
103
  angle: layoutData.angle,
99
104
  anchor: [ layoutData.width / 2, layoutData.height / 2 ],
100
105
  scaleCenter: [ layoutData.width / 2, layoutData.height / 2 ],
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/component/graphic/graphic-base-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAc,MAAM,mBAAmB,CAAC;AAG/D,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC,MAAM,OAAO,eAAe;IAG1B,YAAY,gBAAoC;QA2EhD,oBAAe,GAAG,CAAC,SAA6C,EAAQ,EAAE;YACxE,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;gBACtE,IAAI,CAAC,2BAA2B,EAAE,CAAC;aACpC;QACH,CAAC,CAAC;QA/EA,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC;IACrC,CAAC;IAED,oBAAoB;QAClB,OAAO;YACL,OAAO,EAAE,IAAI;YACb,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,QAAQ;YACtB,UAAU,EAAE,EAAE;YACd,QAAQ,EAAE,EAAE;YAGZ,YAAY,EAAE,QAAQ;YACtB,eAAe,EAAE,QAAQ;YAEzB,SAAS,EAAE,IAA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2BAA2B;QACjC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,SAAS,EAAE;YAQ5D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;SACjE;IACH,CAAC;IAEO,wBAAwB,CAAC,UAAqC;QACpE,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","file":"graphic-base-text.js","sourcesContent":["import { getLayoutFromWidget } from '../../../utils/layout';\nimport type { IWidgetData } from '../../dsl-interface';\nimport type { IRichText, IRichTextGraphicAttribute, TextAlignType, TextBaselineType } from '@visactor/vrender';\nimport { createRichText, createText } from '@visactor/vrender';\nimport type { CharacterComponent } from '../character';\n\nexport const MAX_LAYOUT_SIZE = 999999;\n\nexport class GraphicBaseText {\n private _character: CharacterComponent;\n private _graphic: IRichText;\n constructor(graphicCharacter: CharacterComponent) {\n this._character = graphicCharacter;\n }\n\n getInitialAttributes(): IRichTextGraphicAttribute & { graphicAlign: string; graphicBaseline: string } {\n return {\n visible: true,\n x: 0,\n y: 0,\n textAlign: 'center',\n textBaseline: 'middle',\n textConfig: [],\n fontSize: 16,\n // fill: '#000000',\n // whiteSpace: 'normal',\n graphicAlign: 'center',\n graphicBaseline: 'middle',\n // // compute real height without vrender buffer\n ignoreBuf: true,\n maxLineWidth: MAX_LAYOUT_SIZE,\n heightLimit: MAX_LAYOUT_SIZE\n };\n }\n\n show(): void {\n this._graphic.setAttributes({\n visible: true\n // visibleAll: true,\n });\n }\n hide(): void {\n this._graphic.setAttributes({\n visible: false\n // visibleAll: false,\n });\n }\n\n transformTextAttrsToRichTextConfig() {\n const textAttr = (this._character.spec.options?.text ?? {}) as IRichTextGraphicAttribute;\n let textConfig = textAttr.textConfig;\n\n // 如果是纯文本定义方式\n if (!(textConfig && textConfig.length) && textAttr.text) {\n const textList = Array.isArray(textAttr.text) ? textAttr.text : [textAttr.text];\n textConfig = textList.map((item, i) => {\n return {\n textAlign: 'center',\n textBaseline: 'middle',\n // ...((textAttr || {}) as any),\n text: item + (i < textList.length - 1 ? '\\n' : '')\n };\n });\n }\n\n return textConfig;\n }\n\n init() {\n this._graphic = createRichText(\n this._transformTextAttributes({\n ...this.getInitialAttributes(),\n textConfig: this.transformTextAttrsToRichTextConfig()\n } as any)\n );\n this._character.getGraphicParent().add(this._graphic);\n }\n\n applyGraphicAttribute(graphicAttribute: Partial<IRichTextGraphicAttribute>): void {\n this._graphic.setAttributes({ ...graphicAttribute });\n }\n\n getGraphicAttribute(): IRichTextGraphicAttribute {\n return this._graphic?.attribute;\n }\n\n updateAttribute = (attribute: Partial<IRichTextGraphicAttribute>): void => {\n if (attribute) {\n this._graphic.setAttributes(this._transformTextAttributes(attribute));\n this._updateGraphicCharacterSize();\n }\n };\n\n applyLayoutData(w: Partial<IWidgetData>): void {\n const layoutData = getLayoutFromWidget(w);\n const layoutRatio = this._character.getTextLayoutRatio();\n const graphicAlign = (this._graphic.attribute as any).graphicAlign;\n const graphicBaseline = (this._graphic.attribute as any).graphicBaseline;\n const left = layoutData.width * layoutRatio.left;\n const right = layoutData.width * layoutRatio.right;\n const center = (left + right) / 2;\n const top = layoutData.height * layoutRatio.top;\n const bottom = layoutData.height * layoutRatio.bottom;\n const middle = (top + bottom) / 2;\n let x = center;\n let align: TextAlignType = 'center';\n let y = middle;\n let baseline: TextBaselineType = 'middle';\n switch (graphicAlign) {\n case 'left':\n x = left;\n align = 'left';\n break;\n case 'center':\n x = center;\n align = 'center';\n break;\n case 'right':\n x = right;\n align = 'right';\n break;\n }\n switch (graphicBaseline) {\n case 'top':\n y = top;\n baseline = 'top';\n break;\n case 'middle':\n y = middle;\n baseline = 'middle';\n break;\n case 'bottom':\n y = bottom;\n baseline = 'bottom';\n break;\n }\n\n this._graphic.setAttributes(\n this._transformTextAttributes({\n x,\n y,\n textAlign: align,\n textBaseline: baseline,\n angle: layoutData.angle,\n anchor: [layoutData.width / 2, layoutData.height / 2],\n scaleCenter: [layoutData.width / 2, layoutData.height / 2],\n maxWidth: layoutData.width,\n maxHeight: layoutData.height,\n heightLimit: this._character.graphic.getGraphicAttribute().isResized ? bottom - top : MAX_LAYOUT_SIZE\n })\n );\n }\n\n private _updateGraphicCharacterSize() {\n if (!this._character.graphic.getGraphicAttribute().isResized) {\n // const layoutRatio = this._character.graphic.getTextLayoutRatio();\n // const textHeight = this._graphic.AABBBounds.height();\n // const minGraphicHeight = this._character.graphic.getInitialAttributes().height;\n // const graphicHeight = Math.max(textHeight / (layoutRatio.bottom - layoutRatio.top), minGraphicHeight);\n // this._character.graphic.applyLayoutData({\n // height: graphicHeight\n // });\n this.applyLayoutData(this._character.graphic.getPositionData());\n }\n }\n\n private _transformTextAttributes(attributes: IRichTextGraphicAttribute): IRichTextGraphicAttribute {\n return attributes;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/component/graphic/graphic-base-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAc,MAAM,mBAAmB,CAAC;AAG/D,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC;AAEtC,MAAM,OAAO,eAAe;IAG1B,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,YAAY,gBAAoC;QA6EhD,oBAAe,GAAG,CAAC,SAA6C,EAAQ,EAAE;YACxE,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;gBACtE,IAAI,CAAC,2BAA2B,EAAE,CAAC;aACpC;QACH,CAAC,CAAC;QAjFA,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC;IACrC,CAAC;IAED,oBAAoB;QAClB,OAAO;YACL,OAAO,EAAE,IAAI;YACb,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC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YAC1B,SAAS,EAAE,UAAU,CAAC,MAAM;YAC5B,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,eAAe;SACtG,CAAC,CACH,CAAC;IACJ,CAAC;IAEO,2BAA2B;QACjC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,SAAS,EAAE;YAQ5D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;SACjE;IACH,CAAC;IAEO,wBAAwB,CAAC,UAAqC;QACpE,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","file":"graphic-base-text.js","sourcesContent":["import { getLayoutFromWidget } from '../../../utils/layout';\nimport type { IWidgetData } from '../../dsl-interface';\nimport type { IRichText, IRichTextGraphicAttribute, TextAlignType, TextBaselineType } from '@visactor/vrender';\nimport { createRichText, createText } from '@visactor/vrender';\nimport type { CharacterComponent } from '../character';\n\nexport const MAX_LAYOUT_SIZE = 999999;\n\nexport class GraphicBaseText {\n private _character: CharacterComponent;\n private _graphic: IRichText;\n get graphic() {\n return this._graphic;\n }\n constructor(graphicCharacter: CharacterComponent) {\n this._character = graphicCharacter;\n }\n\n getInitialAttributes(): IRichTextGraphicAttribute & { graphicAlign: string; graphicBaseline: string } {\n return {\n visible: true,\n x: 0,\n y: 0,\n textAlign: 'center',\n textBaseline: 'middle',\n textConfig: [],\n fontSize: 16,\n // fill: '#000000',\n // whiteSpace: 'normal',\n graphicAlign: 'center',\n graphicBaseline: 'middle',\n // // compute real height without vrender buffer\n ignoreBuf: true,\n height: 0,\n width: 0,\n maxLineWidth: MAX_LAYOUT_SIZE,\n heightLimit: MAX_LAYOUT_SIZE\n };\n }\n\n show(): void {\n this._graphic.setAttributes({\n visible: true\n // visibleAll: true,\n });\n }\n hide(): void {\n this._graphic.setAttributes({\n visible: false\n // visibleAll: false,\n });\n }\n\n transformTextAttrsToRichTextConfig() {\n const textAttr = (this._character.spec.options?.text ?? {}) as IRichTextGraphicAttribute;\n let textConfig = textAttr.textConfig;\n\n // 如果是纯文本定义方式\n if (!(textConfig && textConfig.length) && textAttr.text) {\n const textList = Array.isArray(textAttr.text) ? textAttr.text : [textAttr.text];\n textConfig = textList.map((item, i) => {\n return {\n textAlign: 'center',\n textBaseline: 'middle',\n // ...((textAttr || {}) as any),\n text: item + (i < textList.length - 1 ? '\\n' : '')\n };\n });\n }\n\n return textConfig;\n }\n\n init() {\n this._graphic = createRichText(\n this._transformTextAttributes({\n ...this.getInitialAttributes(),\n textConfig: this.transformTextAttrsToRichTextConfig()\n } as any)\n );\n this._character.getGraphicParent().add(this._graphic);\n }\n\n applyGraphicAttribute(graphicAttribute: Partial<IRichTextGraphicAttribute>): void {\n this._graphic.setAttributes({ ...graphicAttribute });\n }\n\n getGraphicAttribute(): IRichTextGraphicAttribute {\n return this._graphic?.attribute;\n }\n\n updateAttribute = (attribute: Partial<IRichTextGraphicAttribute>): void => {\n if (attribute) {\n this._graphic.setAttributes(this._transformTextAttributes(attribute));\n this._updateGraphicCharacterSize();\n }\n };\n\n applyLayoutData(w: Partial<IWidgetData>): void {\n const layoutData = getLayoutFromWidget(w);\n const layoutRatio = this._character.getTextLayoutRatio();\n const graphicAlign = (this._graphic.attribute as any).graphicAlign;\n const graphicBaseline = (this._graphic.attribute as any).graphicBaseline;\n const left = layoutData.width * layoutRatio.left;\n const right = layoutData.width * layoutRatio.right;\n const center = (left + right) / 2;\n const top = layoutData.height * layoutRatio.top;\n const bottom = layoutData.height * layoutRatio.bottom;\n const middle = (top + bottom) / 2;\n let x = center;\n let align: TextAlignType = 'center';\n let y = middle;\n let baseline: TextBaselineType = 'middle';\n switch (graphicAlign) {\n case 'left':\n x = left;\n align = 'left';\n break;\n case 'center':\n x = center;\n align = 'center';\n break;\n case 'right':\n x = right;\n align = 'right';\n break;\n }\n switch (graphicBaseline) {\n case 'top':\n y = top;\n baseline = 'top';\n break;\n case 'middle':\n y = middle;\n baseline = 'middle';\n break;\n case 'bottom':\n y = bottom;\n baseline = 'bottom';\n break;\n }\n\n this._graphic.setAttributes(\n this._transformTextAttributes({\n x,\n y,\n textAlign: graphicAlign,\n textBaseline: graphicBaseline,\n angle: layoutData.angle,\n anchor: [layoutData.width / 2, layoutData.height / 2],\n scaleCenter: [layoutData.width / 2, layoutData.height / 2],\n maxWidth: layoutData.width,\n maxHeight: layoutData.height,\n heightLimit: this._character.graphic.getGraphicAttribute().isResized ? bottom - top : MAX_LAYOUT_SIZE\n })\n );\n }\n\n private _updateGraphicCharacterSize() {\n if (!this._character.graphic.getGraphicAttribute().isResized) {\n // const layoutRatio = this._character.graphic.getTextLayoutRatio();\n // const textHeight = this._graphic.AABBBounds.height();\n // const minGraphicHeight = this._character.graphic.getInitialAttributes().height;\n // const graphicHeight = Math.max(textHeight / (layoutRatio.bottom - layoutRatio.top), minGraphicHeight);\n // this._character.graphic.applyLayoutData({\n // height: graphicHeight\n // });\n this.applyLayoutData(this._character.graphic.getPositionData());\n }\n }\n\n private _transformTextAttributes(attributes: IRichTextGraphicAttribute): IRichTextGraphicAttribute {\n return attributes;\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { ISymbol } from '@visactor/vrender';
2
2
  import type { IPointLike } from '@visactor/vutils';
3
3
  import { Graphic } from './graphic';
4
+ import type { IWidgetData } from '../../dsl-interface';
4
5
  export declare class GraphicSymbol extends Graphic {
5
6
  protected _graphic: ISymbol;
6
7
  getInitialAttributes(): {
@@ -16,4 +17,6 @@ export declare class GraphicSymbol extends Graphic {
16
17
  symbolType: string;
17
18
  };
18
19
  init(): void;
20
+ applyLayoutData(layoutData: Partial<IWidgetData>): void;
21
+ protected _transformAttributes(attributes: any): any;
19
22
  }
@@ -2,6 +2,8 @@ import { createSymbol } from "@visactor/vrender";
2
2
 
3
3
  import { Graphic } from "./graphic";
4
4
 
5
+ import { getLayoutFromWidget } from "../../../utils/layout";
6
+
5
7
  export class GraphicSymbol extends Graphic {
6
8
  getInitialAttributes() {
7
9
  return {
@@ -19,8 +21,21 @@ export class GraphicSymbol extends Graphic {
19
21
  }
20
22
  init() {
21
23
  var _a, _b;
22
- this._graphic || (this._graphic = createSymbol(this._transformAttributes(Object.assign(Object.assign({}, this.getInitialAttributes()), null !== (_b = null === (_a = this._character.spec.options) || void 0 === _a ? void 0 : _a.graphic) && void 0 !== _b ? _b : {}))),
23
- this._graphic.name = `graphic-symbol-${this._character.id}`, this._character.getGraphicParent().add(this._graphic));
24
+ if (!this._graphic) {
25
+ const attributes = this._transformAttributes(Object.assign(Object.assign({}, this.getInitialAttributes()), null !== (_b = null === (_a = this._character.spec.options) || void 0 === _a ? void 0 : _a.graphic) && void 0 !== _b ? _b : {}));
26
+ this._graphic = createSymbol(attributes), this._graphic.name = `graphic-symbol-${this._character.id}`,
27
+ this._character.getGraphicParent().add(this._graphic);
28
+ }
29
+ }
30
+ applyLayoutData(layoutData) {
31
+ const attributes = this._transformAttributes(Object.assign(Object.assign({}, getLayoutFromWidget(layoutData)), {
32
+ shapePoints: this._character.spec.options.shapePoints
33
+ }));
34
+ attributes.size = Math.min(attributes.width, attributes.height), this._graphic.setAttributes(attributes);
35
+ }
36
+ _transformAttributes(attributes) {
37
+ const data = super._transformAttributes(attributes), {width: width, height: height} = attributes;
38
+ return data.x = width / 2, data.y = height / 2, data;
24
39
  }
25
40
  }
26
41
  //# sourceMappingURL=symbol.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/component/graphic/symbol.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,aAAc,SAAQ,OAAO;IAGxC,oBAAoB;QAClB,OAAO;YACL,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,CAAC;YACJ,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,CAAC;YACR,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;YAChB,SAAS,EAAE,CAAC;YACZ,MAAM,EAAE,SAAS;YACjB,WAAW,EAAE,EAAkB;YAC/B,UAAU,EAAE,QAAQ;SACrB,CAAC;IACJ,CAAC;IAED,IAAI;;QACF,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAC1B,IAAI,CAAC,oBAAoB,iCACpB,IAAI,CAAC,oBAAoB,EAAE,GAC3B,CAAC,MAAA,MAAA,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,0CAAE,OAAO,mCAAI,EAAE,CAAC,EAChD,CACH,CAAC;YACF,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,kBAAkB,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC;YAC5D,IAAI,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;SACvD;IACH,CAAC;CACF","file":"symbol.js","sourcesContent":["import type { ISymbol } from '@visactor/vrender';\nimport { createSymbol } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport { Graphic } from './graphic';\n\nexport class GraphicSymbol extends Graphic {\n protected _graphic: ISymbol;\n\n getInitialAttributes() {\n return {\n x: 0,\n y: 0,\n width: 120,\n height: 80,\n angle: 0,\n anchor: [60, 40],\n lineWidth: 2,\n stroke: '#000000',\n shapePoints: [] as IPointLike[],\n symbolType: 'circle'\n };\n }\n\n init() {\n if (!this._graphic) {\n this._graphic = createSymbol(\n this._transformAttributes({\n ...this.getInitialAttributes(),\n ...(this._character.spec.options?.graphic ?? {})\n })\n );\n this._graphic.name = `graphic-symbol-${this._character.id}`;\n this._character.getGraphicParent().add(this._graphic);\n }\n }\n}\n"]}
1
+ {"version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C,WAAW,IACrD,CAAC;QACH,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAEhE,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC;IAES,oBAAoB,CAAC,UAAe;QAC5C,MAAM,IAAI,GAAG,KAAK,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;QACpD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;QACrC,IAAI,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF","file":"symbol.js","sourcesContent":["import type { ISymbol } from '@visactor/vrender';\nimport { createSymbol } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport { Graphic } from './graphic';\nimport type { IWidgetData } from '../../dsl-interface';\nimport { getLayoutFromWidget } from '../../../utils/layout';\n\nexport class GraphicSymbol extends Graphic {\n protected _graphic: ISymbol;\n\n getInitialAttributes() {\n return {\n x: 0,\n y: 0,\n width: 120,\n height: 80,\n angle: 0,\n anchor: [60, 40],\n lineWidth: 2,\n stroke: '#000000',\n shapePoints: [] as IPointLike[],\n symbolType: 'circle'\n };\n }\n\n init() {\n if (!this._graphic) {\n const attributes = this._transformAttributes({\n ...this.getInitialAttributes(),\n ...(this._character.spec.options?.graphic ?? {})\n });\n this._graphic = createSymbol(attributes);\n this._graphic.name = `graphic-symbol-${this._character.id}`;\n this._character.getGraphicParent().add(this._graphic);\n }\n }\n\n applyLayoutData(layoutData: Partial<IWidgetData>): void {\n const attributes = this._transformAttributes({\n ...getLayoutFromWidget(layoutData),\n shapePoints: this._character.spec.options.shapePoints\n });\n attributes.size = Math.min(attributes.width, attributes.height);\n\n this._graphic.setAttributes(attributes);\n }\n\n protected _transformAttributes(attributes: any): any {\n const data = super._transformAttributes(attributes);\n const { width, height } = attributes;\n data.x = width / 2;\n data.y = height / 2;\n return data;\n }\n}\n"]}
@@ -1,3 +1,4 @@
1
+ import type { IInitOption } from '@visactor/vchart';
1
2
  import type { IRichTextGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender';
2
3
  import type { DirectionType } from './chart/const';
3
4
  export type IPercent = `${number}%`;
@@ -44,6 +45,7 @@ export interface IComponentSpec {
44
45
  export interface IChartCharacterSpec extends ICharacterSpecBase {
45
46
  options: {
46
47
  spec?: any;
48
+ initOption?: IInitOption;
47
49
  panel?: any;
48
50
  theme?: any;
49
51
  data?: any;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/dsl-interface.ts"],"names":[],"mappings":"","file":"dsl-interface.js","sourcesContent":["import type { IRichTextGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender';\nimport type { DirectionType } from './chart/const';\n\nexport type IPercent = `${number}%`;\nexport type WidgetNumber = number; // | IPercent;\n\nexport type IWidgetData = {\n left: WidgetNumber;\n top: WidgetNumber;\n} & (\n | {\n bottom: WidgetNumber;\n right: WidgetNumber;\n }\n | {\n width: WidgetNumber;\n height: WidgetNumber;\n }\n);\n\nexport interface ICharacterSpecBase {\n id: string;\n type: string; // 类型\n position: IWidgetData; // 定位描述\n zIndex: number;\n}\n\nexport type IEditorTextGraphicAttribute = {\n graphicAlign?: 'left' | 'center' | 'right';\n graphicBaseline?: 'top' | 'middle' | 'bottom';\n} & Partial<ITextGraphicAttribute & IRichTextGraphicAttribute>;\n\nexport interface IComponentCharacterSpec extends ICharacterSpecBase {\n options: {\n graphic: any;\n text?: IEditorTextGraphicAttribute;\n isResized?: boolean;\n angle?: number;\n shapePoints?: any;\n };\n}\n\nexport interface IComponentMatch {\n usrId?: string;\n specIndex?: number | 'all'; // all 表示所有\n [key: string]: any;\n}\n\nexport interface IComponentSpec {\n specKey: string;\n matchInfo: IComponentMatch;\n spec: any;\n}\n\nexport interface IChartCharacterSpec extends ICharacterSpecBase {\n options: {\n // 图表spec\n spec?: any;\n panel?: any;\n // 各种图表配置属性\n theme?: any;\n // 数据源\n data?: any;\n // 内部模块布局信息\n padding?: any;\n // 标题\n title?: any;\n layout?: any;\n // 色板\n color?: string[];\n // 标注\n marker?: any;\n // mark单元素样式配置\n markStyle?: any[];\n // 组样式\n dataGroupSpec?: {\n [key: string]: any;\n };\n // 方向\n direction?: DirectionType;\n // 系列配置\n seriesSpec?: {\n matchInfo: IComponentMatch;\n spec: any;\n }[];\n // 模块 spec\n componentSpec?: IComponentSpec[];\n };\n}\n\nexport type ICharacterSpec = IChartCharacterSpec | IComponentCharacterSpec;\n"]}
1
+ {"version":3,"sources":["../src/story/character/dsl-interface.ts"],"names":[],"mappings":"","file":"dsl-interface.js","sourcesContent":["import type { IInitOption } from '@visactor/vchart';\nimport type { IRichTextGraphicAttribute, ITextGraphicAttribute } from '@visactor/vrender';\nimport type { DirectionType } from './chart/const';\n\nexport type IPercent = `${number}%`;\nexport type WidgetNumber = number; // | IPercent;\n\nexport type IWidgetData = {\n left: WidgetNumber;\n top: WidgetNumber;\n} & (\n | {\n bottom: WidgetNumber;\n right: WidgetNumber;\n }\n | {\n width: WidgetNumber;\n height: WidgetNumber;\n }\n);\n\nexport interface ICharacterSpecBase {\n id: string;\n type: string; // 类型\n position: IWidgetData; // 定位描述\n zIndex: number;\n}\n\nexport type IEditorTextGraphicAttribute = {\n graphicAlign?: 'left' | 'center' | 'right';\n graphicBaseline?: 'top' | 'middle' | 'bottom';\n} & Partial<ITextGraphicAttribute & IRichTextGraphicAttribute>;\n\nexport interface IComponentCharacterSpec extends ICharacterSpecBase {\n options: {\n graphic: any;\n text?: IEditorTextGraphicAttribute;\n isResized?: boolean;\n angle?: number;\n shapePoints?: any;\n };\n}\n\nexport interface IComponentMatch {\n usrId?: string;\n specIndex?: number | 'all'; // all 表示所有\n [key: string]: any;\n}\n\nexport interface IComponentSpec {\n specKey: string;\n matchInfo: IComponentMatch;\n spec: any;\n}\n\nexport interface IChartCharacterSpec extends ICharacterSpecBase {\n options: {\n // 图表spec\n spec?: any;\n // 初始化参数\n initOption?: IInitOption;\n panel?: any;\n // 各种图表配置属性\n theme?: any;\n // 数据源\n data?: any;\n // 内部模块布局信息\n padding?: any;\n // 标题\n title?: any;\n layout?: any;\n // 色板\n color?: string[];\n // 标注\n marker?: any;\n // mark单元素样式配置\n markStyle?: any[];\n // 组样式\n dataGroupSpec?: {\n [key: string]: any;\n };\n // 方向\n direction?: DirectionType;\n // 系列配置\n seriesSpec?: {\n matchInfo: IComponentMatch;\n spec: any;\n }[];\n // 模块 spec\n componentSpec?: IComponentSpec[];\n };\n}\n\nexport type ICharacterSpec = IChartCharacterSpec | IComponentCharacterSpec;\n"]}
@@ -1,21 +1,26 @@
1
- import type { IGroup } from '@visactor/vrender';
2
- import type { IPointLike } from '@visactor/vutils';
1
+ import type { IGroup, IGraphic } from '@visactor/vrender';
2
+ import type { IBoundsLike, IPointLike } from '@visactor/vutils';
3
3
  import type { IStory, IStoryCanvas, StoryEvent } from '../interface/runtime-interface';
4
4
  import type { ICharacterSpec } from './dsl-interface';
5
5
  import type { Graphic } from './component/graphic/graphic';
6
6
  export interface ICharacterPickInfo {
7
7
  part: string;
8
- graphicType: string;
8
+ graphic?: IGraphic;
9
+ graphicType?: string;
10
+ modelInfo?: any;
9
11
  }
10
12
  export interface ICharacter {
11
13
  id: string;
14
+ type: string;
15
+ visActorType: string;
12
16
  spec: ICharacterSpec;
17
+ graphic: Graphic | IGroup;
13
18
  init: () => void;
14
19
  reset: () => void;
15
20
  show: () => void;
16
21
  hide: () => void;
17
22
  getGraphicParent: () => IGroup;
18
- graphic: Graphic | IGroup;
23
+ getLayoutBounds: () => IBoundsLike;
19
24
  tickTo: (t: number) => void;
20
25
  checkEvent: (event: StoryEvent) => false | (ICharacterPickInfo & any);
21
26
  updateSpec: (spec: Omit<Partial<ICharacterSpec>, 'id' | 'type'>) => void;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/runtime-interface.ts"],"names":[],"mappings":"","file":"runtime-interface.js","sourcesContent":["import type { IGroup } from '@visactor/vrender';\nimport type { IPointLike } from '@visactor/vutils';\nimport type { StoryCanvas } from '../canvas/canvas';\nimport type { IStory, IStoryCanvas, StoryEvent } from '../interface/runtime-interface';\nimport type { ICharacterSpec } from './dsl-interface';\nimport type { Graphic } from './component/graphic/graphic';\n\nexport interface ICharacterPickInfo {\n part: string;\n graphicType: string;\n}\nexport interface ICharacter {\n id: string;\n spec: ICharacterSpec;\n\n init: () => void;\n reset: () => void;\n show: () => void;\n hide: () => void;\n getGraphicParent: () => IGroup;\n graphic: Graphic | IGroup;\n tickTo: (t: number) => void;\n\n checkEvent: (event: StoryEvent) => false | (ICharacterPickInfo & any);\n\n updateSpec: (spec: Omit<Partial<ICharacterSpec>, 'id' | 'type'>) => void;\n\n setAttributes: (attr: Record<string, any>) => void;\n release: () => void;\n}\n\nexport interface ICharacterInitOption {\n story: IStory;\n canvas: IStoryCanvas;\n graphicParent: IGroup;\n}\n\nexport interface ICharacterConstructor {\n new (spec: ICharacterSpec, option: ICharacterInitOption): ICharacter;\n}\n\nexport interface ILayoutAttribute {\n x: number;\n y: number;\n width: number;\n height: number;\n angle: number;\n anchor?: [number | string, number | string];\n dx?: number;\n dy?: number;\n shapePoints?: IPointLike[];\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/runtime-interface.ts"],"names":[],"mappings":"","file":"runtime-interface.js","sourcesContent":["import type { IGroup, IGraphic } from '@visactor/vrender';\nimport type { IBoundsLike, IPointLike } from '@visactor/vutils';\nimport type { IStory, IStoryCanvas, StoryEvent } from '../interface/runtime-interface';\nimport type { ICharacterSpec } from './dsl-interface';\nimport type { Graphic } from './component/graphic/graphic';\n\nexport interface ICharacterPickInfo {\n part: string;\n graphic?: IGraphic;\n graphicType?: string;\n modelInfo?: any;\n}\nexport interface ICharacter {\n id: string;\n type: string;\n visActorType: string;\n spec: ICharacterSpec;\n graphic: Graphic | IGroup;\n\n init: () => void;\n reset: () => void;\n show: () => void;\n hide: () => void;\n getGraphicParent: () => IGroup;\n getLayoutBounds: () => IBoundsLike;\n tickTo: (t: number) => void;\n\n checkEvent: (event: StoryEvent) => false | (ICharacterPickInfo & any);\n\n updateSpec: (spec: Omit<Partial<ICharacterSpec>, 'id' | 'type'>) => void;\n\n setAttributes: (attr: Record<string, any>) => void;\n release: () => void;\n}\n\nexport interface ICharacterInitOption {\n story: IStory;\n canvas: IStoryCanvas;\n graphicParent: IGroup;\n}\n\nexport interface ICharacterConstructor {\n new (spec: ICharacterSpec, option: ICharacterInitOption): ICharacter;\n}\n\nexport interface ILayoutAttribute {\n x: number;\n y: number;\n width: number;\n height: number;\n angle: number;\n anchor?: [number | string, number | string];\n dx?: number;\n dy?: number;\n shapePoints?: IPointLike[];\n}\n"]}
@@ -1,8 +1,8 @@
1
- import { ICharacterSpec } from 'src/story/character/dsl-interface';
1
+ import type { ICharacterSpec } from 'src/story/character/dsl-interface';
2
2
  import { CharacterBase } from '../base/base';
3
3
  import type { ISpecProcess, ICharacterVisactor } from './interface';
4
- import { ICharacterInitOption } from '../runtime-interface';
5
- import { IChartCharacterRuntime } from '../chart/runtime/interface';
4
+ import type { ICharacterInitOption } from '../runtime-interface';
5
+ import type { IChartCharacterRuntime } from '../chart/runtime/interface';
6
6
  export declare abstract class CharacterVisactor extends CharacterBase implements ICharacterVisactor {
7
7
  protected _specProcess: ISpecProcess;
8
8
  get specProcess(): ISpecProcess;
@@ -24,6 +24,21 @@ export declare abstract class CharacterVisactor extends CharacterBase implements
24
24
  show(): void;
25
25
  hide(): void;
26
26
  getGraphicParent(): any;
27
+ getViewBoxFromSpec(): {
28
+ layout: Partial<import("../runtime-interface").ILayoutAttribute>;
29
+ viewBox: {
30
+ x1: number;
31
+ x2: number;
32
+ y1: number;
33
+ y2: number;
34
+ };
35
+ };
36
+ getLayoutBounds(): {
37
+ x1: number;
38
+ x2: number;
39
+ y1: number;
40
+ y2: number;
41
+ };
27
42
  tickTo(t: number): void;
28
43
  release(): void;
29
44
  }
@@ -1,5 +1,7 @@
1
1
  import { CharacterBase } from "../base/base";
2
2
 
3
+ import { getLayoutFromWidget } from "../../utils/layout";
4
+
3
5
  export class CharacterVisactor extends CharacterBase {
4
6
  get specProcess() {
5
7
  return this._specProcess;
@@ -37,6 +39,22 @@ export class CharacterVisactor extends CharacterBase {
37
39
  getGraphicParent() {
38
40
  return this._graphic;
39
41
  }
42
+ getViewBoxFromSpec() {
43
+ const layout = getLayoutFromWidget(this._spec.position);
44
+ return {
45
+ layout: layout,
46
+ viewBox: {
47
+ x1: layout.x,
48
+ x2: layout.x + layout.width,
49
+ y1: layout.y,
50
+ y2: layout.y + layout.height
51
+ }
52
+ };
53
+ }
54
+ getLayoutBounds() {
55
+ const {viewBox: viewBox} = this.getViewBoxFromSpec();
56
+ return viewBox;
57
+ }
40
58
  tickTo(t) {}
41
59
  release() {
42
60
  var _a, _b;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/visactor/character.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAK7C,MAAM,OAAgB,iBAAkB,SAAQ,aAAa;IAE3D,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IACD,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC;IAC7C,CAAC;IAED,IAAI,SAAS;;QACX,OAAO,MAAA,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,0CAAE,YAAY,EAAE,CAAC;IACtE,CAAC;IAED,IAAI,QAAQ;;QACV,OAAO,MAAA,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,QAAQ,0CAAE,IAAI,CAAC;IAC5D,CAAC;IAID,YAAY,IAAoB,EAAE,MAA4B;QAC5D,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAH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port { CharacterBase } from '../base/base';\nimport type { ISpecProcess, ICharacterVisactor, IVisactorGraphic } from './interface';\nimport { ICharacterInitOption } from '../runtime-interface';\nimport { IChartCharacterRuntime } from '../chart/runtime/interface';\n\nexport abstract class CharacterVisactor extends CharacterBase implements ICharacterVisactor {\n protected declare _specProcess: ISpecProcess;\n get specProcess() {\n return this._specProcess;\n }\n get dataTempTransform() {\n return this._specProcess.dataTempTransform;\n }\n\n get chartType() {\n return this._specProcess.dataTempTransform.specTemp?.getChartType();\n }\n\n get tempType() {\n return this._specProcess.dataTempTransform.specTemp?.type;\n }\n\n protected _runtime: IChartCharacterRuntime[] = [];\n\n constructor(spec: ICharacterSpec, option: ICharacterInitOption) {\n super(spec, option);\n this._initSpecProcess();\n }\n\n protected _initRuntime(): void {}\n\n clearConfig(opt: { clearCurrent: false | { [key: string]: any } }) {\n // do nothing\n }\n\n protected abstract _initSpecProcess(): void;\n\n onSpecReady = () => {\n console.log('onSpecReady !');\n this._runtime.forEach(r => r.onSpecReady?.());\n this._specProcess.dataTempTransform.specTemp?.standardizedSpec(this._specProcess.getVisSpec(), { character: this });\n this._updateVisactorSpec();\n this._afterRender();\n };\n\n protected abstract _afterRender(): void;\n\n protected abstract _updateVisactorSpec(): void;\n\n show(): void {\n this._graphic.setAttribute('visibleAll', true);\n }\n hide(): void {\n this._graphic.setAttribute('visibleAll', false);\n }\n\n getGraphicParent() {\n return this._graphic;\n }\n\n tickTo(t: number): void {\n return;\n }\n\n release() {\n this._specProcess.release();\n this._graphic?.parent?.removeChild(this._graphic);\n this._specProcess = this._graphic = null;\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/visactor/character.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,OAAgB,iBAAkB,SAAQ,aAAa;IAE3D,IAAI,WAAW;QACb,OAAO,IAAI,CAAC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IAClD,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,kBAAkB;QAChB,MAAM,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG;YACd,EAAE,EAAE,MAAM,CAAC,CAAC;YACZ,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK;YAC3B,EAAE,EAAE,MAAM,CAAC,CAAC;YACZ,EAAE,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM;SAC7B,CAAC;QACF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,eAAe;QACb,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC9C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,CAAS;QACd,OAAO;IACT,CAAC;IAED,OAAO;;QACL,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAC5B,MAAA,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,0CAAE,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC3C,CAAC;CACF","file":"character.js","sourcesContent":["/* eslint-disable no-console */\nimport type { ICharacterSpec } from 'src/story/character/dsl-interface';\nimport { CharacterBase } from '../base/base';\nimport type { ISpecProcess, ICharacterVisactor } from './interface';\nimport type { ICharacterInitOption } from '../runtime-interface';\nimport type { IChartCharacterRuntime } from '../chart/runtime/interface';\nimport { getLayoutFromWidget } from '../../utils/layout';\n\nexport abstract class CharacterVisactor extends CharacterBase implements ICharacterVisactor {\n protected declare _specProcess: ISpecProcess;\n get specProcess() {\n return this._specProcess;\n }\n get dataTempTransform() {\n return this._specProcess.dataTempTransform;\n }\n\n get chartType() {\n return this._specProcess.dataTempTransform.specTemp?.getChartType();\n }\n\n get tempType() {\n return this._specProcess.dataTempTransform.specTemp?.type;\n }\n\n protected _runtime: IChartCharacterRuntime[] = [];\n\n constructor(spec: ICharacterSpec, option: ICharacterInitOption) {\n super(spec, option);\n this._initSpecProcess();\n }\n\n protected _initRuntime(): void {\n return;\n }\n\n clearConfig(opt: { clearCurrent: false | { [key: string]: any } }) {\n // do nothing\n }\n\n protected abstract _initSpecProcess(): void;\n\n onSpecReady = () => {\n console.log('onSpecReady !');\n this._runtime.forEach(r => r.onSpecReady?.());\n this._specProcess.dataTempTransform.specTemp?.standardizedSpec(this._specProcess.getVisSpec(), { character: this });\n this._updateVisactorSpec();\n this._afterRender();\n };\n\n protected abstract _afterRender(): void;\n\n protected abstract _updateVisactorSpec(): void;\n\n show(): void {\n this._graphic.setAttribute('visibleAll', true);\n }\n hide(): void {\n this._graphic.setAttribute('visibleAll', false);\n }\n\n getGraphicParent() {\n return this._graphic;\n }\n\n getViewBoxFromSpec() {\n const layout = getLayoutFromWidget(this._spec.position);\n const viewBox = {\n x1: layout.x,\n x2: layout.x + layout.width,\n y1: layout.y,\n y2: layout.y + layout.height\n };\n return { layout, viewBox };\n }\n\n getLayoutBounds() {\n const { viewBox } = this.getViewBoxFromSpec();\n return viewBox;\n }\n\n tickTo(t: number): void {\n return;\n }\n\n release() {\n this._specProcess.release();\n this._graphic?.parent?.removeChild(this._graphic);\n this._specProcess = this._graphic = null;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/story/character/visactor/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IChartCharacterSpec } from '../dsl-interface';\nimport type { EventEmitter } from '@visactor/vutils';\nimport type { ICharacter } from '../runtime-interface';\nimport type { ISpec, IVChart } from '@visactor/vchart';\nimport type { IGroup } from '@visactor/vrender';\n\nexport type StandardData = IDataValue | IDataValue[];\nexport type IParserValue = any;\nexport type DataUpdateCall = (data: StandardData) => void;\nexport type DataErrorCall = (msg: { type: string; info: string }, opt?: any) => void;\n\n// visactor 元素的内部结构\n// 数据部分 start\n// DataParser:数据处理。负责解析数据,得到模版可用数据,处理数据上的特性内容。\n// VisactorTemp:模版处理。负责结合数据,生成对应类型的基础 spec。不同类型图表的特殊逻辑,在 temp 中处理\n// DataTempTransform:数据与模版更新管理,当数据/模版更新时,通过这个模块判定更新是否成功,成功后抛出更新成功消息。包含 VisactorTemp 与 DataParser\n// SpecProcess:编辑配置管理器,编辑属性更新的处理,对外输出合并了编辑信息的 spec 。包含一个 dataTempTransform\n// 数据部分 end\n\n// graphic 部分 start\n// IVisactorGraphic:包含一个 vchart|vtbale 。visactor 的自定义图元封装。处理图元是否重绘,viewBox的图元属性逻辑\n// IVisactorGraphic-render:实际的 draw 入口,处理绘图过程,主要是处理变换矩阵。\n// graphic 部分 end\n\n// Visactor-role:编辑元素,包含一个 specProcess、IVisactorGraphic\n\nexport interface IDataTempTransform {\n readonly specTemp: IVisactorTemp;\n\n readonly nextTemp: IVisactorTemp;\n emitter: EventEmitter;\n\n updateChartTemp: (temp?: string) => void;\n\n // 得到没有经过编辑器配置加工过的基础spec\n getBaseSpec: () => any;\n\n // 释放\n release: () => void;\n\n dataParser?: IDataParser;\n}\n\nexport interface IDataTempTransformConstructor {\n new ({ specProcess, character }: { character: ICharacterVisactor; specProcess: ISpecProcess }): IDataTempTransform;\n}\n\nexport interface ISpecProcess {\n dataTempTransform: IDataTempTransform;\n emitter: EventEmitter;\n\n // 得到visactor元素的spec\n getVisSpec: () => ISpec;\n // 得到角色的spec\n getCharacterSpec: () => IChartCharacterSpec;\n\n // temp\n getCharacterType: () => string;\n\n release: () => void;\n}\n\nexport type IDataType = any;\n\nexport interface IDataValue {\n id: string;\n sourceKey: string;\n values: IDataType[];\n}\n\nexport type DataInfo = {\n [key: string]: {\n type: 'ordinal' | 'linear';\n };\n};\n\nexport type DataSave = {\n type: string;\n value: any;\n};\n\nexport interface IDataParser {\n type: string;\n getData: () => StandardData;\n getDataValue: () => IParserValue;\n getDataInfo?: () => DataInfo;\n getSpecOption?: () => any;\n getSave: () => DataSave;\n updateValue: (value: IParserValue) => void;\n setDataUpdateHandler: (call: DataUpdateCall) => void;\n setDataErrorHandler: (call: DataErrorCall) => void;\n clear: () => void;\n}\n\nexport interface IDataParserConstructor {\n type: string;\n new (\n value: any,\n option: {\n updateCall: DataUpdateCall;\n errorCall: DataErrorCall;\n currentData?: IDataParser;\n emitter: EventEmitter;\n }\n ): IDataParser;\n}\n\n// chart & table 都是用这个模版接口\nexport interface IVisactorTemp {\n type: string;\n getSpec: (data: StandardData, ctx: any, opt?: any) => ISpec | null;\n standardizedSpec: (spec: any, ctx: any, opt?: any) => void;\n getChartType: () => string;\n checkDataEnable: (data: StandardData, opt?: any) => boolean;\n getTempInfo?: () => any;\n clear: () => void;\n}\n\nexport interface IVisactorTempConstructor {\n new (): IVisactorTemp;\n}\n\n// 绘图元素\nexport interface IVisactorGraphic extends IGroup {\n readonly vProduct: IVChart;\n\n updateSpec: (spec: any) => void;\n release: () => void;\n}\n\n// 编辑元素\nexport interface ICharacterVisactor extends ICharacter {\n // 清除编辑数据\n clearConfig: (opt: { clearCurrent: false | { [key: string]: any } }) => void;\n getGraphicParent: () => IVisactorGraphic;\n}\n\nexport interface IUpdateAttributeOption {\n triggerHistory?: boolean;\n saveData?: boolean;\n actionType?: 'data-add' | 'data-change' | 'data-replace' | string;\n}\n"]}
1
+ {"version":3,"sources":["../src/story/character/visactor/interface.ts"],"names":[],"mappings":"","file":"interface.js","sourcesContent":["import type { IChartCharacterSpec } from '../dsl-interface';\nimport type { EventEmitter, IBoundsLike } from '@visactor/vutils';\nimport type { ICharacter } from '../runtime-interface';\nimport type { ISpec, IVChart } from '@visactor/vchart';\nimport type { IGroup } from '@visactor/vrender';\n\nexport type StandardData = IDataValue | IDataValue[];\nexport type IParserValue = any;\nexport type DataUpdateCall = (data: StandardData) => void;\nexport type DataErrorCall = (msg: { type: string; info: string }, opt?: any) => void;\n\n// visactor 元素的内部结构\n// 数据部分 start\n// DataParser:数据处理。负责解析数据,得到模版可用数据,处理数据上的特性内容。\n// VisactorTemp:模版处理。负责结合数据,生成对应类型的基础 spec。不同类型图表的特殊逻辑,在 temp 中处理\n// DataTempTransform:数据与模版更新管理,当数据/模版更新时,通过这个模块判定更新是否成功,成功后抛出更新成功消息。包含 VisactorTemp 与 DataParser\n// SpecProcess:编辑配置管理器,编辑属性更新的处理,对外输出合并了编辑信息的 spec 。包含一个 dataTempTransform\n// 数据部分 end\n\n// graphic 部分 start\n// IVisactorGraphic:包含一个 vchart|vtbale 。visactor 的自定义图元封装。处理图元是否重绘,viewBox的图元属性逻辑\n// IVisactorGraphic-render:实际的 draw 入口,处理绘图过程,主要是处理变换矩阵。\n// graphic 部分 end\n\n// Visactor-role:编辑元素,包含一个 specProcess、IVisactorGraphic\n\nexport interface IDataTempTransform {\n readonly specTemp: IVisactorTemp;\n\n readonly nextTemp: IVisactorTemp;\n emitter: EventEmitter;\n\n updateChartTemp: (temp?: string) => void;\n\n // 得到没有经过编辑器配置加工过的基础spec\n getBaseSpec: () => any;\n\n // 释放\n release: () => void;\n\n dataParser?: IDataParser;\n}\n\nexport interface IDataTempTransformConstructor {\n new ({ specProcess, character }: { character: ICharacterVisactor; specProcess: ISpecProcess }): IDataTempTransform;\n}\n\nexport interface ISpecProcess {\n dataTempTransform: IDataTempTransform;\n emitter: EventEmitter;\n\n // 得到visactor元素的spec\n getVisSpec: () => ISpec;\n // 得到角色的spec\n getCharacterSpec: () => IChartCharacterSpec;\n\n // temp\n getCharacterType: () => string;\n\n release: () => void;\n}\n\nexport type IDataType = any;\n\nexport interface IDataValue {\n id: string;\n sourceKey: string;\n values: IDataType[];\n}\n\nexport type DataInfo = {\n [key: string]: {\n type: 'ordinal' | 'linear';\n };\n};\n\nexport type DataSave = {\n type: string;\n value: any;\n};\n\nexport interface IDataParser {\n type: string;\n getData: () => StandardData;\n getDataValue: () => IParserValue;\n getDataInfo?: () => DataInfo;\n getSpecOption?: () => any;\n getSave: () => DataSave;\n updateValue: (value: IParserValue) => void;\n setDataUpdateHandler: (call: DataUpdateCall) => void;\n setDataErrorHandler: (call: DataErrorCall) => void;\n clear: () => void;\n}\n\nexport interface IDataParserConstructor {\n type: string;\n new (\n value: any,\n option: {\n updateCall: DataUpdateCall;\n errorCall: DataErrorCall;\n currentData?: IDataParser;\n emitter: EventEmitter;\n }\n ): IDataParser;\n}\n\n// chart & table 都是用这个模版接口\nexport interface IVisactorTemp {\n type: string;\n getSpec: (data: StandardData, ctx: any, opt?: any) => ISpec | null;\n standardizedSpec: (spec: any, ctx: any, opt?: any) => void;\n getChartType: () => string;\n checkDataEnable: (data: StandardData, opt?: any) => boolean;\n getTempInfo?: () => any;\n clear: () => void;\n}\n\nexport interface IVisactorTempConstructor {\n new (): IVisactorTemp;\n}\n\n// 绘图元素\nexport interface IVisactorGraphic extends IGroup {\n readonly vProduct: IVChart;\n\n updateSpec: (spec: any) => void;\n release: () => void;\n}\n\n// 编辑元素\nexport interface ICharacterVisactor extends ICharacter {\n // 清除编辑数据\n clearConfig: (opt: { clearCurrent: false | { [key: string]: any } }) => void;\n getGraphicParent: () => IVisactorGraphic;\n}\n\nexport interface IUpdateAttributeOption {\n triggerHistory?: boolean;\n saveData?: boolean;\n actionType?: 'data-add' | 'data-change' | 'data-replace' | string;\n}\n"]}