ding-image-editor 3.15.3

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 (374) hide show
  1. package/README.md +193 -0
  2. package/dist/svg/icon-a.svg +376 -0
  3. package/dist/svg/icon-b.svg +369 -0
  4. package/dist/svg/icon-c.svg +369 -0
  5. package/dist/svg/icon-d.svg +369 -0
  6. package/dist/tui-image-editor.css +6 -0
  7. package/dist/tui-image-editor.js +62329 -0
  8. package/dist/tui-image-editor.min.css +5 -0
  9. package/dist/tui-image-editor.min.js +15 -0
  10. package/index.d.ts +334 -0
  11. package/package.json +52 -0
  12. package/src/css/buttons.styl +102 -0
  13. package/src/css/checkbox.styl +86 -0
  14. package/src/css/colorpicker.styl +98 -0
  15. package/src/css/gridtable.styl +45 -0
  16. package/src/css/icon.styl +44 -0
  17. package/src/css/index.styl +17 -0
  18. package/src/css/main.styl +163 -0
  19. package/src/css/position.styl +309 -0
  20. package/src/css/range.styl +91 -0
  21. package/src/css/submenu.styl +168 -0
  22. package/src/index.js +29 -0
  23. package/src/js/action.js +686 -0
  24. package/src/js/command/addIcon.js +42 -0
  25. package/src/js/command/addImageObject.js +34 -0
  26. package/src/js/command/addObject.js +43 -0
  27. package/src/js/command/addShape.js +51 -0
  28. package/src/js/command/addText.js +73 -0
  29. package/src/js/command/applyFilter.js +95 -0
  30. package/src/js/command/changeIconColor.js +48 -0
  31. package/src/js/command/changeSelection.js +31 -0
  32. package/src/js/command/changeShape.js +84 -0
  33. package/src/js/command/changeText.js +44 -0
  34. package/src/js/command/changeTextStyle.js +80 -0
  35. package/src/js/command/clearObjects.js +33 -0
  36. package/src/js/command/flip.js +36 -0
  37. package/src/js/command/loadImage.js +58 -0
  38. package/src/js/command/removeFilter.js +38 -0
  39. package/src/js/command/removeObject.js +37 -0
  40. package/src/js/command/resize.js +41 -0
  41. package/src/js/command/resizeCanvasDimension.js +40 -0
  42. package/src/js/command/rotate.js +64 -0
  43. package/src/js/command/setObjectPosition.js +50 -0
  44. package/src/js/command/setObjectProperties.js +55 -0
  45. package/src/js/component/cropper.js +407 -0
  46. package/src/js/component/filter.js +229 -0
  47. package/src/js/component/flip.js +146 -0
  48. package/src/js/component/freeDrawing.js +144 -0
  49. package/src/js/component/icon.js +246 -0
  50. package/src/js/component/imageLoader.js +84 -0
  51. package/src/js/component/line.js +205 -0
  52. package/src/js/component/resize.js +103 -0
  53. package/src/js/component/rotation.js +91 -0
  54. package/src/js/component/shape.js +601 -0
  55. package/src/js/component/text.js +572 -0
  56. package/src/js/component/zoom.js +708 -0
  57. package/src/js/consts.js +404 -0
  58. package/src/js/drawingMode/cropper.js +35 -0
  59. package/src/js/drawingMode/freeDrawing.js +36 -0
  60. package/src/js/drawingMode/icon.js +35 -0
  61. package/src/js/drawingMode/lineDrawing.js +36 -0
  62. package/src/js/drawingMode/resize.js +35 -0
  63. package/src/js/drawingMode/shape.js +35 -0
  64. package/src/js/drawingMode/text.js +35 -0
  65. package/src/js/drawingMode/zoom.js +37 -0
  66. package/src/js/extension/arrowLine.js +172 -0
  67. package/src/js/extension/blur.js +29 -0
  68. package/src/js/extension/colorFilter.js +104 -0
  69. package/src/js/extension/cropzone.js +568 -0
  70. package/src/js/extension/emboss.js +29 -0
  71. package/src/js/extension/mask.js +90 -0
  72. package/src/js/extension/sharpen.js +29 -0
  73. package/src/js/factory/command.js +36 -0
  74. package/src/js/factory/errorMessage.js +27 -0
  75. package/src/js/graphics.js +1539 -0
  76. package/src/js/helper/imagetracer.js +1396 -0
  77. package/src/js/helper/selectionModifyHelper.js +86 -0
  78. package/src/js/helper/shapeFilterFillHelper.js +564 -0
  79. package/src/js/helper/shapeResizeHelper.js +237 -0
  80. package/src/js/imageEditor.js +1795 -0
  81. package/src/js/interface/command.js +131 -0
  82. package/src/js/interface/component.js +127 -0
  83. package/src/js/interface/drawingMode.js +47 -0
  84. package/src/js/invoker.js +292 -0
  85. package/src/js/polyfill.js +498 -0
  86. package/src/js/ui/crop.js +139 -0
  87. package/src/js/ui/draw.js +187 -0
  88. package/src/js/ui/filter.js +510 -0
  89. package/src/js/ui/flip.js +87 -0
  90. package/src/js/ui/history.js +171 -0
  91. package/src/js/ui/icon.js +191 -0
  92. package/src/js/ui/locale/locale.js +19 -0
  93. package/src/js/ui/mask.js +96 -0
  94. package/src/js/ui/panelMenu.js +130 -0
  95. package/src/js/ui/resize.js +241 -0
  96. package/src/js/ui/rotate.js +123 -0
  97. package/src/js/ui/shape.js +265 -0
  98. package/src/js/ui/submenuBase.js +122 -0
  99. package/src/js/ui/template/controls.js +21 -0
  100. package/src/js/ui/template/mainContainer.js +38 -0
  101. package/src/js/ui/template/style.js +146 -0
  102. package/src/js/ui/template/submenu/crop.js +73 -0
  103. package/src/js/ui/template/submenu/draw.js +42 -0
  104. package/src/js/ui/template/submenu/filter.js +157 -0
  105. package/src/js/ui/template/submenu/flip.js +41 -0
  106. package/src/js/ui/template/submenu/history.js +22 -0
  107. package/src/js/ui/template/submenu/icon.js +108 -0
  108. package/src/js/ui/template/submenu/mask.js +30 -0
  109. package/src/js/ui/template/submenu/resize.js +54 -0
  110. package/src/js/ui/template/submenu/rotate.js +32 -0
  111. package/src/js/ui/template/submenu/shape.js +45 -0
  112. package/src/js/ui/template/submenu/text.js +67 -0
  113. package/src/js/ui/template/submenu/zoom.js +41 -0
  114. package/src/js/ui/text.js +279 -0
  115. package/src/js/ui/theme/standard.js +220 -0
  116. package/src/js/ui/theme/theme.js +249 -0
  117. package/src/js/ui/tools/colorpicker.js +250 -0
  118. package/src/js/ui/tools/range.js +390 -0
  119. package/src/js/ui.js +858 -0
  120. package/src/js/util.js +551 -0
  121. package/src/svg/default.svg +335 -0
  122. package/src/svg/icon-a/ic-apply.svg +6 -0
  123. package/src/svg/icon-a/ic-cancel.svg +6 -0
  124. package/src/svg/icon-a/ic-color-transparent-w.svg +12 -0
  125. package/src/svg/icon-a/ic-crop.svg +7 -0
  126. package/src/svg/icon-a/ic-delete-all.svg +6 -0
  127. package/src/svg/icon-a/ic-delete.svg +6 -0
  128. package/src/svg/icon-a/ic-draw-free.svg +5 -0
  129. package/src/svg/icon-a/ic-draw-line.svg +5 -0
  130. package/src/svg/icon-a/ic-draw.svg +6 -0
  131. package/src/svg/icon-a/ic-filter.svg +7 -0
  132. package/src/svg/icon-a/ic-flip-reset.svg +7 -0
  133. package/src/svg/icon-a/ic-flip-x.svg +6 -0
  134. package/src/svg/icon-a/ic-flip-y.svg +6 -0
  135. package/src/svg/icon-a/ic-flip.svg +6 -0
  136. package/src/svg/icon-a/ic-history-check.svg +5 -0
  137. package/src/svg/icon-a/ic-history-crop.svg +7 -0
  138. package/src/svg/icon-a/ic-history-delete.svg +9 -0
  139. package/src/svg/icon-a/ic-history-draw.svg +7 -0
  140. package/src/svg/icon-a/ic-history-filter.svg +8 -0
  141. package/src/svg/icon-a/ic-history-flip.svg +6 -0
  142. package/src/svg/icon-a/ic-history-group.svg +9 -0
  143. package/src/svg/icon-a/ic-history-icon.svg +6 -0
  144. package/src/svg/icon-a/ic-history-load.svg +7 -0
  145. package/src/svg/icon-a/ic-history-mask.svg +9 -0
  146. package/src/svg/icon-a/ic-history-resize.svg +12 -0
  147. package/src/svg/icon-a/ic-history-rotate.svg +16 -0
  148. package/src/svg/icon-a/ic-history-shape.svg +7 -0
  149. package/src/svg/icon-a/ic-history-text.svg +8 -0
  150. package/src/svg/icon-a/ic-history.svg +6 -0
  151. package/src/svg/icon-a/ic-icon-arrow-2.svg +5 -0
  152. package/src/svg/icon-a/ic-icon-arrow-3.svg +5 -0
  153. package/src/svg/icon-a/ic-icon-arrow.svg +5 -0
  154. package/src/svg/icon-a/ic-icon-bubble.svg +5 -0
  155. package/src/svg/icon-a/ic-icon-heart.svg +5 -0
  156. package/src/svg/icon-a/ic-icon-load.svg +8 -0
  157. package/src/svg/icon-a/ic-icon-location.svg +8 -0
  158. package/src/svg/icon-a/ic-icon-polygon.svg +5 -0
  159. package/src/svg/icon-a/ic-icon-star-2.svg +5 -0
  160. package/src/svg/icon-a/ic-icon-star.svg +5 -0
  161. package/src/svg/icon-a/ic-icon.svg +5 -0
  162. package/src/svg/icon-a/ic-mask-load.svg +8 -0
  163. package/src/svg/icon-a/ic-mask.svg +6 -0
  164. package/src/svg/icon-a/ic-redo.svg +7 -0
  165. package/src/svg/icon-a/ic-reset.svg +7 -0
  166. package/src/svg/icon-a/ic-resize.svg +13 -0
  167. package/src/svg/icon-a/ic-rotate-clockwise.svg +7 -0
  168. package/src/svg/icon-a/ic-rotate-counterclockwise.svg +7 -0
  169. package/src/svg/icon-a/ic-rotate.svg +7 -0
  170. package/src/svg/icon-a/ic-shape-circle.svg +5 -0
  171. package/src/svg/icon-a/ic-shape-rectangle.svg +5 -0
  172. package/src/svg/icon-a/ic-shape-triangle.svg +5 -0
  173. package/src/svg/icon-a/ic-shape.svg +6 -0
  174. package/src/svg/icon-a/ic-text-align-center.svg +6 -0
  175. package/src/svg/icon-a/ic-text-align-left.svg +6 -0
  176. package/src/svg/icon-a/ic-text-align-right.svg +6 -0
  177. package/src/svg/icon-a/ic-text-bold.svg +7 -0
  178. package/src/svg/icon-a/ic-text-italic.svg +6 -0
  179. package/src/svg/icon-a/ic-text-underline.svg +7 -0
  180. package/src/svg/icon-a/ic-text.svg +7 -0
  181. package/src/svg/icon-a/ic-undo.svg +7 -0
  182. package/src/svg/icon-a/ic-zoom-hand.svg +8 -0
  183. package/src/svg/icon-a/ic-zoom-zoom-in.svg +10 -0
  184. package/src/svg/icon-a/ic-zoom-zoom-out.svg +9 -0
  185. package/src/svg/icon-a/img-bi.svg +5 -0
  186. package/src/svg/icon-b/ic-apply.svg +6 -0
  187. package/src/svg/icon-b/ic-cancel.svg +6 -0
  188. package/src/svg/icon-b/ic-crop.svg +7 -0
  189. package/src/svg/icon-b/ic-delete-all.svg +6 -0
  190. package/src/svg/icon-b/ic-delete.svg +6 -0
  191. package/src/svg/icon-b/ic-draw-free.svg +5 -0
  192. package/src/svg/icon-b/ic-draw-line.svg +5 -0
  193. package/src/svg/icon-b/ic-draw.svg +6 -0
  194. package/src/svg/icon-b/ic-filter.svg +7 -0
  195. package/src/svg/icon-b/ic-flip-reset.svg +7 -0
  196. package/src/svg/icon-b/ic-flip-x.svg +6 -0
  197. package/src/svg/icon-b/ic-flip-y.svg +6 -0
  198. package/src/svg/icon-b/ic-flip.svg +6 -0
  199. package/src/svg/icon-b/ic-history-check.svg +5 -0
  200. package/src/svg/icon-b/ic-history-crop.svg +7 -0
  201. package/src/svg/icon-b/ic-history-delete.svg +9 -0
  202. package/src/svg/icon-b/ic-history-draw.svg +7 -0
  203. package/src/svg/icon-b/ic-history-filter.svg +8 -0
  204. package/src/svg/icon-b/ic-history-flip.svg +6 -0
  205. package/src/svg/icon-b/ic-history-group.svg +9 -0
  206. package/src/svg/icon-b/ic-history-icon.svg +6 -0
  207. package/src/svg/icon-b/ic-history-load.svg +7 -0
  208. package/src/svg/icon-b/ic-history-mask.svg +9 -0
  209. package/src/svg/icon-b/ic-history-resize.svg +12 -0
  210. package/src/svg/icon-b/ic-history-rotate.svg +16 -0
  211. package/src/svg/icon-b/ic-history-shape.svg +7 -0
  212. package/src/svg/icon-b/ic-history-text.svg +8 -0
  213. package/src/svg/icon-b/ic-history.svg +6 -0
  214. package/src/svg/icon-b/ic-icon-arrow-2.svg +5 -0
  215. package/src/svg/icon-b/ic-icon-arrow-3.svg +5 -0
  216. package/src/svg/icon-b/ic-icon-arrow.svg +5 -0
  217. package/src/svg/icon-b/ic-icon-bubble.svg +5 -0
  218. package/src/svg/icon-b/ic-icon-heart.svg +5 -0
  219. package/src/svg/icon-b/ic-icon-load.svg +8 -0
  220. package/src/svg/icon-b/ic-icon-location.svg +8 -0
  221. package/src/svg/icon-b/ic-icon-polygon.svg +5 -0
  222. package/src/svg/icon-b/ic-icon-star-2.svg +5 -0
  223. package/src/svg/icon-b/ic-icon-star.svg +5 -0
  224. package/src/svg/icon-b/ic-icon.svg +5 -0
  225. package/src/svg/icon-b/ic-mask-load.svg +8 -0
  226. package/src/svg/icon-b/ic-mask.svg +6 -0
  227. package/src/svg/icon-b/ic-redo.svg +7 -0
  228. package/src/svg/icon-b/ic-reset.svg +7 -0
  229. package/src/svg/icon-b/ic-resize.svg +13 -0
  230. package/src/svg/icon-b/ic-rotate-clockwise.svg +7 -0
  231. package/src/svg/icon-b/ic-rotate-counterclockwise.svg +7 -0
  232. package/src/svg/icon-b/ic-rotate.svg +7 -0
  233. package/src/svg/icon-b/ic-shape-circle.svg +5 -0
  234. package/src/svg/icon-b/ic-shape-rectangle.svg +5 -0
  235. package/src/svg/icon-b/ic-shape-triangle.svg +5 -0
  236. package/src/svg/icon-b/ic-shape.svg +6 -0
  237. package/src/svg/icon-b/ic-text-align-center.svg +6 -0
  238. package/src/svg/icon-b/ic-text-align-left.svg +6 -0
  239. package/src/svg/icon-b/ic-text-align-right.svg +6 -0
  240. package/src/svg/icon-b/ic-text-bold.svg +7 -0
  241. package/src/svg/icon-b/ic-text-italic.svg +6 -0
  242. package/src/svg/icon-b/ic-text-underline.svg +7 -0
  243. package/src/svg/icon-b/ic-text.svg +7 -0
  244. package/src/svg/icon-b/ic-undo.svg +7 -0
  245. package/src/svg/icon-b/ic-zoom-hand.svg +8 -0
  246. package/src/svg/icon-b/ic-zoom-zoom-in.svg +12 -0
  247. package/src/svg/icon-b/ic-zoom-zoom-out.svg +11 -0
  248. package/src/svg/icon-b/img-bi.svg +5 -0
  249. package/src/svg/icon-c/ic-apply.svg +6 -0
  250. package/src/svg/icon-c/ic-cancel.svg +6 -0
  251. package/src/svg/icon-c/ic-crop.svg +7 -0
  252. package/src/svg/icon-c/ic-delete-all.svg +6 -0
  253. package/src/svg/icon-c/ic-delete.svg +6 -0
  254. package/src/svg/icon-c/ic-draw-free.svg +5 -0
  255. package/src/svg/icon-c/ic-draw-line.svg +5 -0
  256. package/src/svg/icon-c/ic-draw.svg +6 -0
  257. package/src/svg/icon-c/ic-filter.svg +7 -0
  258. package/src/svg/icon-c/ic-flip-reset.svg +7 -0
  259. package/src/svg/icon-c/ic-flip-x.svg +6 -0
  260. package/src/svg/icon-c/ic-flip-y.svg +6 -0
  261. package/src/svg/icon-c/ic-flip.svg +6 -0
  262. package/src/svg/icon-c/ic-history-check.svg +5 -0
  263. package/src/svg/icon-c/ic-history-crop.svg +7 -0
  264. package/src/svg/icon-c/ic-history-delete.svg +9 -0
  265. package/src/svg/icon-c/ic-history-draw.svg +7 -0
  266. package/src/svg/icon-c/ic-history-filter.svg +8 -0
  267. package/src/svg/icon-c/ic-history-flip.svg +6 -0
  268. package/src/svg/icon-c/ic-history-group.svg +9 -0
  269. package/src/svg/icon-c/ic-history-icon.svg +6 -0
  270. package/src/svg/icon-c/ic-history-load.svg +7 -0
  271. package/src/svg/icon-c/ic-history-mask.svg +9 -0
  272. package/src/svg/icon-c/ic-history-resize.svg +12 -0
  273. package/src/svg/icon-c/ic-history-rotate.svg +16 -0
  274. package/src/svg/icon-c/ic-history-shape.svg +7 -0
  275. package/src/svg/icon-c/ic-history-text.svg +8 -0
  276. package/src/svg/icon-c/ic-history.svg +6 -0
  277. package/src/svg/icon-c/ic-icon-arrow-2.svg +5 -0
  278. package/src/svg/icon-c/ic-icon-arrow-3.svg +5 -0
  279. package/src/svg/icon-c/ic-icon-arrow.svg +5 -0
  280. package/src/svg/icon-c/ic-icon-bubble.svg +5 -0
  281. package/src/svg/icon-c/ic-icon-heart.svg +5 -0
  282. package/src/svg/icon-c/ic-icon-load.svg +8 -0
  283. package/src/svg/icon-c/ic-icon-location.svg +8 -0
  284. package/src/svg/icon-c/ic-icon-polygon.svg +5 -0
  285. package/src/svg/icon-c/ic-icon-star-2.svg +5 -0
  286. package/src/svg/icon-c/ic-icon-star.svg +5 -0
  287. package/src/svg/icon-c/ic-icon.svg +5 -0
  288. package/src/svg/icon-c/ic-mask-load.svg +8 -0
  289. package/src/svg/icon-c/ic-mask.svg +6 -0
  290. package/src/svg/icon-c/ic-redo.svg +7 -0
  291. package/src/svg/icon-c/ic-reset.svg +7 -0
  292. package/src/svg/icon-c/ic-resize.svg +13 -0
  293. package/src/svg/icon-c/ic-rotate-clockwise.svg +7 -0
  294. package/src/svg/icon-c/ic-rotate-counterclockwise.svg +7 -0
  295. package/src/svg/icon-c/ic-rotate.svg +7 -0
  296. package/src/svg/icon-c/ic-shape-circle.svg +5 -0
  297. package/src/svg/icon-c/ic-shape-rectangle.svg +5 -0
  298. package/src/svg/icon-c/ic-shape-triangle.svg +5 -0
  299. package/src/svg/icon-c/ic-shape.svg +6 -0
  300. package/src/svg/icon-c/ic-text-align-center.svg +6 -0
  301. package/src/svg/icon-c/ic-text-align-left.svg +6 -0
  302. package/src/svg/icon-c/ic-text-align-right.svg +6 -0
  303. package/src/svg/icon-c/ic-text-bold.svg +7 -0
  304. package/src/svg/icon-c/ic-text-italic.svg +6 -0
  305. package/src/svg/icon-c/ic-text-underline.svg +7 -0
  306. package/src/svg/icon-c/ic-text.svg +7 -0
  307. package/src/svg/icon-c/ic-undo.svg +7 -0
  308. package/src/svg/icon-c/ic-zoom-hand.svg +8 -0
  309. package/src/svg/icon-c/ic-zoom-zoom-in.svg +12 -0
  310. package/src/svg/icon-c/ic-zoom-zoom-out.svg +11 -0
  311. package/src/svg/icon-c/img-bi.svg +5 -0
  312. package/src/svg/icon-d/ic-apply.svg +6 -0
  313. package/src/svg/icon-d/ic-cancel.svg +6 -0
  314. package/src/svg/icon-d/ic-crop.svg +7 -0
  315. package/src/svg/icon-d/ic-delete-all.svg +6 -0
  316. package/src/svg/icon-d/ic-delete.svg +6 -0
  317. package/src/svg/icon-d/ic-draw-free.svg +5 -0
  318. package/src/svg/icon-d/ic-draw-line.svg +5 -0
  319. package/src/svg/icon-d/ic-draw.svg +6 -0
  320. package/src/svg/icon-d/ic-filter.svg +7 -0
  321. package/src/svg/icon-d/ic-flip-reset.svg +7 -0
  322. package/src/svg/icon-d/ic-flip-x.svg +6 -0
  323. package/src/svg/icon-d/ic-flip-y.svg +6 -0
  324. package/src/svg/icon-d/ic-flip.svg +6 -0
  325. package/src/svg/icon-d/ic-history-check.svg +5 -0
  326. package/src/svg/icon-d/ic-history-crop.svg +7 -0
  327. package/src/svg/icon-d/ic-history-delete.svg +9 -0
  328. package/src/svg/icon-d/ic-history-draw.svg +7 -0
  329. package/src/svg/icon-d/ic-history-filter.svg +8 -0
  330. package/src/svg/icon-d/ic-history-flip.svg +6 -0
  331. package/src/svg/icon-d/ic-history-group.svg +9 -0
  332. package/src/svg/icon-d/ic-history-icon.svg +6 -0
  333. package/src/svg/icon-d/ic-history-load.svg +7 -0
  334. package/src/svg/icon-d/ic-history-mask.svg +9 -0
  335. package/src/svg/icon-d/ic-history-resize.svg +12 -0
  336. package/src/svg/icon-d/ic-history-rotate.svg +16 -0
  337. package/src/svg/icon-d/ic-history-shape.svg +7 -0
  338. package/src/svg/icon-d/ic-history-text.svg +8 -0
  339. package/src/svg/icon-d/ic-history.svg +6 -0
  340. package/src/svg/icon-d/ic-icon-arrow-2.svg +5 -0
  341. package/src/svg/icon-d/ic-icon-arrow-3.svg +5 -0
  342. package/src/svg/icon-d/ic-icon-arrow.svg +5 -0
  343. package/src/svg/icon-d/ic-icon-bubble.svg +5 -0
  344. package/src/svg/icon-d/ic-icon-heart.svg +5 -0
  345. package/src/svg/icon-d/ic-icon-load.svg +8 -0
  346. package/src/svg/icon-d/ic-icon-location.svg +8 -0
  347. package/src/svg/icon-d/ic-icon-polygon.svg +5 -0
  348. package/src/svg/icon-d/ic-icon-star-2.svg +5 -0
  349. package/src/svg/icon-d/ic-icon-star.svg +5 -0
  350. package/src/svg/icon-d/ic-icon.svg +5 -0
  351. package/src/svg/icon-d/ic-mask-load.svg +8 -0
  352. package/src/svg/icon-d/ic-mask.svg +6 -0
  353. package/src/svg/icon-d/ic-redo.svg +7 -0
  354. package/src/svg/icon-d/ic-reset.svg +7 -0
  355. package/src/svg/icon-d/ic-resize.svg +13 -0
  356. package/src/svg/icon-d/ic-rotate-clockwise.svg +7 -0
  357. package/src/svg/icon-d/ic-rotate-counterclockwise.svg +7 -0
  358. package/src/svg/icon-d/ic-rotate.svg +7 -0
  359. package/src/svg/icon-d/ic-shape-circle.svg +5 -0
  360. package/src/svg/icon-d/ic-shape-rectangle.svg +5 -0
  361. package/src/svg/icon-d/ic-shape-triangle.svg +5 -0
  362. package/src/svg/icon-d/ic-shape.svg +6 -0
  363. package/src/svg/icon-d/ic-text-align-center.svg +6 -0
  364. package/src/svg/icon-d/ic-text-align-left.svg +6 -0
  365. package/src/svg/icon-d/ic-text-align-right.svg +6 -0
  366. package/src/svg/icon-d/ic-text-bold.svg +7 -0
  367. package/src/svg/icon-d/ic-text-italic.svg +6 -0
  368. package/src/svg/icon-d/ic-text-underline.svg +7 -0
  369. package/src/svg/icon-d/ic-text.svg +7 -0
  370. package/src/svg/icon-d/ic-undo.svg +7 -0
  371. package/src/svg/icon-d/ic-zoom-hand.svg +8 -0
  372. package/src/svg/icon-d/ic-zoom-zoom-in.svg +12 -0
  373. package/src/svg/icon-d/ic-zoom-zoom-out.svg +11 -0
  374. package/src/svg/icon-d/img-bi.svg +5 -0
@@ -0,0 +1,250 @@
1
+ import forEach from 'tui-code-snippet/collection/forEach';
2
+ import CustomEvents from 'tui-code-snippet/customEvents/customEvents';
3
+ import tuiColorPicker from 'tui-color-picker';
4
+
5
+ const PICKER_COLOR = [
6
+ '#000000',
7
+ '#2a2a2a',
8
+ '#545454',
9
+ '#7e7e7e',
10
+ '#a8a8a8',
11
+ '#d2d2d2',
12
+ '#ffffff',
13
+ '',
14
+ '#ff4040',
15
+ '#ff6518',
16
+ '#ffbb3b',
17
+ '#03bd9e',
18
+ '#00a9ff',
19
+ '#515ce6',
20
+ '#9e5fff',
21
+ '#ff5583',
22
+ ];
23
+
24
+ /**
25
+ * Colorpicker control class
26
+ * @class
27
+ * @ignore
28
+ */
29
+ class Colorpicker {
30
+ constructor(
31
+ colorpickerElement,
32
+ { defaultColor = '#7e7e7e', toggleDirection = 'up', usageStatistics }
33
+ ) {
34
+ this.colorpickerElement = colorpickerElement;
35
+ this.usageStatistics = usageStatistics;
36
+
37
+ this._show = false;
38
+
39
+ this._colorpickerElement = colorpickerElement;
40
+ this._toggleDirection = toggleDirection;
41
+ this._makePickerButtonElement(defaultColor);
42
+ this._makePickerLayerElement(colorpickerElement, colorpickerElement.getAttribute('title'));
43
+ this._color = defaultColor;
44
+ this.picker = tuiColorPicker.create({
45
+ container: this.pickerElement,
46
+ preset: PICKER_COLOR,
47
+ color: defaultColor,
48
+ usageStatistics: this.usageStatistics,
49
+ });
50
+
51
+ this._addEvent();
52
+ }
53
+
54
+ /**
55
+ * Destroys the instance.
56
+ */
57
+ destroy() {
58
+ this._removeEvent();
59
+ this.picker.destroy();
60
+ this.colorpickerElement.innerHTML = '';
61
+ forEach(this, (value, key) => {
62
+ this[key] = null;
63
+ });
64
+ }
65
+
66
+ /**
67
+ * Get color
68
+ * @returns {Number} color value
69
+ */
70
+ get color() {
71
+ return this._color;
72
+ }
73
+
74
+ /**
75
+ * Set color
76
+ * @param {string} color color value
77
+ */
78
+ set color(color) {
79
+ this._color = color;
80
+ this._changeColorElement(color);
81
+ }
82
+
83
+ /**
84
+ * Change color element
85
+ * @param {string} color color value
86
+ * #private
87
+ */
88
+ _changeColorElement(color) {
89
+ if (color) {
90
+ this.colorElement.classList.remove('transparent');
91
+ this.colorElement.style.backgroundColor = color;
92
+ } else {
93
+ this.colorElement.style.backgroundColor = '#fff';
94
+ this.colorElement.classList.add('transparent');
95
+ }
96
+ }
97
+
98
+ /**
99
+ * Make picker button element
100
+ * @param {string} defaultColor color value
101
+ * @private
102
+ */
103
+ _makePickerButtonElement(defaultColor) {
104
+ this.colorpickerElement.classList.add('tui-image-editor-button');
105
+
106
+ this.colorElement = document.createElement('div');
107
+ this.colorElement.className = 'color-picker-value';
108
+ if (defaultColor) {
109
+ this.colorElement.style.backgroundColor = defaultColor;
110
+ } else {
111
+ this.colorElement.classList.add('transparent');
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Make picker layer element
117
+ * @param {HTMLElement} colorpickerElement color picker element
118
+ * @param {string} title picker title
119
+ * @private
120
+ */
121
+ _makePickerLayerElement(colorpickerElement, title) {
122
+ const label = document.createElement('label');
123
+ const triangle = document.createElement('div');
124
+
125
+ this.pickerControl = document.createElement('div');
126
+ this.pickerControl.className = 'color-picker-control';
127
+
128
+ this.pickerElement = document.createElement('div');
129
+ this.pickerElement.className = 'color-picker';
130
+
131
+ label.innerHTML = title;
132
+ triangle.className = 'triangle';
133
+
134
+ this.pickerControl.appendChild(this.pickerElement);
135
+ this.pickerControl.appendChild(triangle);
136
+
137
+ colorpickerElement.appendChild(this.pickerControl);
138
+ colorpickerElement.appendChild(this.colorElement);
139
+ colorpickerElement.appendChild(label);
140
+ }
141
+
142
+ /**
143
+ * Add event
144
+ * @private
145
+ */
146
+ _addEvent() {
147
+ this.picker.on('selectColor', (value) => {
148
+ this._changeColorElement(value.color);
149
+ this._color = value.color;
150
+ this.fire('change', value.color);
151
+ });
152
+
153
+ this.eventHandler = {
154
+ pickerToggle: this._pickerToggleEventHandler.bind(this),
155
+ pickerHide: () => this.hide(),
156
+ };
157
+
158
+ this.colorpickerElement.addEventListener('click', this.eventHandler.pickerToggle);
159
+ document.body.addEventListener('click', this.eventHandler.pickerHide);
160
+ }
161
+
162
+ /**
163
+ * Remove event
164
+ * @private
165
+ */
166
+ _removeEvent() {
167
+ this.colorpickerElement.removeEventListener('click', this.eventHandler.pickerToggle);
168
+ document.body.removeEventListener('click', this.eventHandler.pickerHide);
169
+ this.picker.off();
170
+ }
171
+
172
+ /**
173
+ * Picker toggle event handler
174
+ * @param {object} event - change event
175
+ * @private
176
+ */
177
+ _pickerToggleEventHandler(event) {
178
+ const { target } = event;
179
+ const isInPickerControl = target && this._isElementInColorPickerControl(target);
180
+
181
+ if (!isInPickerControl || (isInPickerControl && this._isPaletteButton(target))) {
182
+ this._show = !this._show;
183
+ this.pickerControl.style.display = this._show ? 'block' : 'none';
184
+ this._setPickerControlPosition();
185
+ this.fire('changeShow', this);
186
+ }
187
+ event.stopPropagation();
188
+ }
189
+
190
+ /**
191
+ * Check hex input or not
192
+ * @param {Element} target - Event target element
193
+ * @returns {boolean}
194
+ * @private
195
+ */
196
+ _isPaletteButton(target) {
197
+ return target.className === 'tui-colorpicker-palette-button';
198
+ }
199
+
200
+ /**
201
+ * Check given element is in pickerControl element
202
+ * @param {Element} element - element to check
203
+ * @returns {boolean}
204
+ * @private
205
+ */
206
+ _isElementInColorPickerControl(element) {
207
+ let parentNode = element;
208
+
209
+ while (parentNode !== document.body) {
210
+ if (!parentNode) {
211
+ break;
212
+ }
213
+
214
+ if (parentNode === this.pickerControl) {
215
+ return true;
216
+ }
217
+
218
+ parentNode = parentNode.parentNode;
219
+ }
220
+
221
+ return false;
222
+ }
223
+
224
+ hide() {
225
+ this._show = false;
226
+ this.pickerControl.style.display = 'none';
227
+ }
228
+
229
+ /**
230
+ * Set picker control position
231
+ * @private
232
+ */
233
+ _setPickerControlPosition() {
234
+ const controlStyle = this.pickerControl.style;
235
+ const halfPickerWidth = this._colorpickerElement.clientWidth / 2 + 2;
236
+ const left = this.pickerControl.offsetWidth / 2 - halfPickerWidth;
237
+ let top = (this.pickerControl.offsetHeight + 10) * -1;
238
+
239
+ if (this._toggleDirection === 'down') {
240
+ top = 30;
241
+ }
242
+
243
+ controlStyle.top = `${top}px`;
244
+ controlStyle.left = `-${left}px`;
245
+ }
246
+ }
247
+
248
+ CustomEvents.mixin(Colorpicker);
249
+
250
+ export default Colorpicker;
@@ -0,0 +1,390 @@
1
+ import forEach from 'tui-code-snippet/collection/forEach';
2
+ import CustomEvents from 'tui-code-snippet/customEvents/customEvents';
3
+ import { toInteger, clamp } from '@/util';
4
+ import { keyCodes } from '@/consts';
5
+
6
+ const INPUT_FILTER_REGEXP = /(-?)([0-9]*)[^0-9]*([0-9]*)/g;
7
+
8
+ /**
9
+ * Range control class
10
+ * @class
11
+ * @ignore
12
+ */
13
+ class Range {
14
+ /**
15
+ * @constructor
16
+ * @extends {View}
17
+ * @param {Object} rangeElements - Html resources for creating sliders
18
+ * @param {HTMLElement} rangeElements.slider - b
19
+ * @param {HTMLElement} [rangeElements.input] - c
20
+ * @param {Object} options - Slider make options
21
+ * @param {number} options.min - min value
22
+ * @param {number} options.max - max value
23
+ * @param {number} options.value - default value
24
+ * @param {number} [options.useDecimal] - Decimal point processing.
25
+ * @param {boolean} [options.realTimeEvent] - Reflect live events.
26
+ */
27
+ constructor(rangeElements, options = {}) {
28
+ this._value = options.value || 0;
29
+
30
+ this.rangeElement = rangeElements.slider;
31
+ this.rangeInputElement = rangeElements.input;
32
+
33
+ this._drawRangeElement();
34
+
35
+ this.rangeWidth = this._getRangeWidth();
36
+ this._min = options.min || 0;
37
+ this._max = options.max || 100;
38
+ this._useDecimal = options.useDecimal;
39
+ this._absMax = this._min * -1 + this._max;
40
+ this.realTimeEvent = options.realTimeEvent || false;
41
+ this._userInputTimer = null;
42
+
43
+ this.eventHandler = {
44
+ startChangingSlide: this._startChangingSlide.bind(this),
45
+ stopChangingSlide: this._stopChangingSlide.bind(this),
46
+ changeSlide: this._changeSlide.bind(this),
47
+ changeSlideFinally: this._changeSlideFinally.bind(this),
48
+ changeInput: this._changeInput.bind(this),
49
+ changeInputFinally: this._changeValueWithInput.bind(this, true),
50
+ changeInputWithArrow: this._changeValueWithInputKeyEvent.bind(this),
51
+ };
52
+
53
+ this._addClickEvent();
54
+ this._addDragEvent();
55
+ this._addInputEvent();
56
+ this.value = options.value;
57
+ this.trigger('change');
58
+ }
59
+
60
+ /**
61
+ * Destroys the instance.
62
+ */
63
+ destroy() {
64
+ this._removeClickEvent();
65
+ this._removeDragEvent();
66
+ this._removeInputEvent();
67
+ this.rangeElement.innerHTML = '';
68
+ forEach(this, (value, key) => {
69
+ this[key] = null;
70
+ });
71
+ }
72
+
73
+ get max() {
74
+ return this._max;
75
+ }
76
+
77
+ /**
78
+ * Set range max value and re position cursor
79
+ * @param {number} maxValue - max value
80
+ */
81
+ set max(maxValue) {
82
+ this._max = maxValue;
83
+ this._absMax = this._min * -1 + this._max;
84
+ this.value = this._value;
85
+ }
86
+
87
+ get min() {
88
+ return this._min;
89
+ }
90
+
91
+ /**
92
+ * Set range min value and re position cursor
93
+ * @param {number} minValue - min value
94
+ */
95
+ set min(minValue) {
96
+ this._min = minValue;
97
+ this.max = this._max;
98
+ }
99
+
100
+ /**
101
+ * Get range value
102
+ * @returns {Number} range value
103
+ */
104
+ get value() {
105
+ return this._value;
106
+ }
107
+
108
+ /**
109
+ * Set range value
110
+ * @param {Number} value range value
111
+ */
112
+ set value(value) {
113
+ value = this._useDecimal ? value : toInteger(value);
114
+
115
+ const absValue = value - this._min;
116
+ let leftPosition = (absValue * this.rangeWidth) / this._absMax;
117
+
118
+ if (this.rangeWidth < leftPosition) {
119
+ leftPosition = this.rangeWidth;
120
+ }
121
+
122
+ this.pointer.style.left = `${leftPosition}px`;
123
+ this.subbar.style.right = `${this.rangeWidth - leftPosition}px`;
124
+
125
+ this._value = value;
126
+ if (this.rangeInputElement) {
127
+ this.rangeInputElement.value = value;
128
+ }
129
+ }
130
+
131
+ /**
132
+ * event trigger
133
+ * @param {string} type - type
134
+ */
135
+ trigger(type) {
136
+ this.fire(type, this._value);
137
+ }
138
+
139
+ /**
140
+ * Calculate slider width
141
+ * @returns {number} - slider width
142
+ */
143
+ _getRangeWidth() {
144
+ const getElementWidth = (element) => toInteger(window.getComputedStyle(element, null).width);
145
+
146
+ return getElementWidth(this.rangeElement) - getElementWidth(this.pointer);
147
+ }
148
+
149
+ /**
150
+ * Make range element
151
+ * @private
152
+ */
153
+ _drawRangeElement() {
154
+ this.rangeElement.classList.add('tui-image-editor-range');
155
+
156
+ this.bar = document.createElement('div');
157
+ this.bar.className = 'tui-image-editor-virtual-range-bar';
158
+
159
+ this.subbar = document.createElement('div');
160
+ this.subbar.className = 'tui-image-editor-virtual-range-subbar';
161
+
162
+ this.pointer = document.createElement('div');
163
+ this.pointer.className = 'tui-image-editor-virtual-range-pointer';
164
+
165
+ this.bar.appendChild(this.subbar);
166
+ this.bar.appendChild(this.pointer);
167
+ this.rangeElement.appendChild(this.bar);
168
+ }
169
+
170
+ /**
171
+ * Add range input editing event
172
+ * @private
173
+ */
174
+ _addInputEvent() {
175
+ if (this.rangeInputElement) {
176
+ this.rangeInputElement.addEventListener('keydown', this.eventHandler.changeInputWithArrow);
177
+ this.rangeInputElement.addEventListener('keydown', this.eventHandler.changeInput);
178
+ this.rangeInputElement.addEventListener('blur', this.eventHandler.changeInputFinally);
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Remove range input editing event
184
+ * @private
185
+ */
186
+ _removeInputEvent() {
187
+ if (this.rangeInputElement) {
188
+ this.rangeInputElement.removeEventListener('keydown', this.eventHandler.changeInputWithArrow);
189
+ this.rangeInputElement.removeEventListener('keydown', this.eventHandler.changeInput);
190
+ this.rangeInputElement.removeEventListener('blur', this.eventHandler.changeInputFinally);
191
+ }
192
+ }
193
+
194
+ /**
195
+ * change angle event
196
+ * @param {object} event - key event
197
+ * @private
198
+ */
199
+ _changeValueWithInputKeyEvent(event) {
200
+ const { keyCode, target } = event;
201
+
202
+ if ([keyCodes.ARROW_UP, keyCodes.ARROW_DOWN].indexOf(keyCode) < 0) {
203
+ return;
204
+ }
205
+
206
+ let value = Number(target.value);
207
+
208
+ value = this._valueUpDownForKeyEvent(value, keyCode);
209
+
210
+ const unChanged = value < this._min || value > this._max;
211
+
212
+ if (!unChanged) {
213
+ const clampValue = clamp(value, this._min, this.max);
214
+ this.value = clampValue;
215
+ this.fire('change', clampValue, false);
216
+ }
217
+ }
218
+
219
+ /**
220
+ * value up down for input
221
+ * @param {number} value - original value number
222
+ * @param {number} keyCode - input event key code
223
+ * @returns {number} value - changed value
224
+ * @private
225
+ */
226
+ _valueUpDownForKeyEvent(value, keyCode) {
227
+ const step = this._useDecimal ? 0.1 : 1;
228
+
229
+ if (keyCode === keyCodes.ARROW_UP) {
230
+ value += step;
231
+ } else if (keyCode === keyCodes.ARROW_DOWN) {
232
+ value -= step;
233
+ }
234
+
235
+ return value;
236
+ }
237
+
238
+ _changeInput(event) {
239
+ clearTimeout(this._userInputTimer);
240
+
241
+ const { keyCode } = event;
242
+ if (keyCode < keyCodes.DIGIT_0 || keyCode > keyCodes.DIGIT_9) {
243
+ event.preventDefault();
244
+
245
+ return;
246
+ }
247
+
248
+ this._userInputTimer = setTimeout(() => {
249
+ this._inputSetValue(event.target.value);
250
+ }, 350);
251
+ }
252
+
253
+ _inputSetValue(stringValue) {
254
+ let value = this._useDecimal ? Number(stringValue) : toInteger(stringValue);
255
+ value = clamp(value, this._min, this.max);
256
+
257
+ this.value = value;
258
+ this.fire('change', value, true);
259
+ }
260
+
261
+ /**
262
+ * change angle event
263
+ * @param {boolean} isLast - Is last change
264
+ * @param {object} event - key event
265
+ * @private
266
+ */
267
+ _changeValueWithInput(isLast, event) {
268
+ const { keyCode, target } = event;
269
+
270
+ if ([keyCodes.ARROW_UP, keyCodes.ARROW_DOWN].indexOf(keyCode) >= 0) {
271
+ return;
272
+ }
273
+
274
+ const stringValue = this._filterForInputText(target.value);
275
+ const waitForChange = !stringValue || isNaN(stringValue);
276
+ target.value = stringValue;
277
+
278
+ if (!waitForChange) {
279
+ this._inputSetValue(stringValue);
280
+ }
281
+ }
282
+
283
+ /**
284
+ * Add Range click event
285
+ * @private
286
+ */
287
+ _addClickEvent() {
288
+ this.rangeElement.addEventListener('click', this.eventHandler.changeSlideFinally);
289
+ }
290
+
291
+ /**
292
+ * Remove Range click event
293
+ * @private
294
+ */
295
+ _removeClickEvent() {
296
+ this.rangeElement.removeEventListener('click', this.eventHandler.changeSlideFinally);
297
+ }
298
+
299
+ /**
300
+ * Add Range drag event
301
+ * @private
302
+ */
303
+ _addDragEvent() {
304
+ this.pointer.addEventListener('mousedown', this.eventHandler.startChangingSlide);
305
+ }
306
+
307
+ /**
308
+ * Remove Range drag event
309
+ * @private
310
+ */
311
+ _removeDragEvent() {
312
+ this.pointer.removeEventListener('mousedown', this.eventHandler.startChangingSlide);
313
+ }
314
+
315
+ /**
316
+ * change angle event
317
+ * @param {object} event - change event
318
+ * @private
319
+ */
320
+ _changeSlide(event) {
321
+ const changePosition = event.screenX;
322
+ const diffPosition = changePosition - this.firstPosition;
323
+ let touchPx = this.firstLeft + diffPosition;
324
+ touchPx = touchPx > this.rangeWidth ? this.rangeWidth : touchPx;
325
+ touchPx = touchPx < 0 ? 0 : touchPx;
326
+
327
+ this.pointer.style.left = `${touchPx}px`;
328
+ this.subbar.style.right = `${this.rangeWidth - touchPx}px`;
329
+
330
+ const ratio = touchPx / this.rangeWidth;
331
+ const resultValue = this._absMax * ratio + this._min;
332
+ const value = this._useDecimal ? resultValue : toInteger(resultValue);
333
+ const isValueChanged = this.value !== value;
334
+
335
+ if (isValueChanged) {
336
+ this.value = value;
337
+ if (this.realTimeEvent) {
338
+ this.fire('change', this._value, false);
339
+ }
340
+ }
341
+ }
342
+
343
+ _changeSlideFinally(event) {
344
+ event.stopPropagation();
345
+ if (event.target.className !== 'tui-image-editor-range') {
346
+ return;
347
+ }
348
+ const touchPx = event.offsetX;
349
+ const ratio = touchPx / this.rangeWidth;
350
+ const value = this._absMax * ratio + this._min;
351
+ this.pointer.style.left = `${ratio * this.rangeWidth}px`;
352
+ this.subbar.style.right = `${(1 - ratio) * this.rangeWidth}px`;
353
+ this.value = value;
354
+
355
+ this.fire('change', value, true);
356
+ }
357
+
358
+ _startChangingSlide(event) {
359
+ this.firstPosition = event.screenX;
360
+ this.firstLeft = toInteger(this.pointer.style.left) || 0;
361
+
362
+ document.addEventListener('mousemove', this.eventHandler.changeSlide);
363
+ document.addEventListener('mouseup', this.eventHandler.stopChangingSlide);
364
+ }
365
+
366
+ /**
367
+ * stop change angle event
368
+ * @private
369
+ */
370
+ _stopChangingSlide() {
371
+ this.fire('change', this._value, true);
372
+
373
+ document.removeEventListener('mousemove', this.eventHandler.changeSlide);
374
+ document.removeEventListener('mouseup', this.eventHandler.stopChangingSlide);
375
+ }
376
+
377
+ /**
378
+ * Unnecessary string filtering.
379
+ * @param {string} inputValue - origin string of input
380
+ * @returns {string} filtered string
381
+ * @private
382
+ */
383
+ _filterForInputText(inputValue) {
384
+ return inputValue.replace(INPUT_FILTER_REGEXP, '$1$2$3');
385
+ }
386
+ }
387
+
388
+ CustomEvents.mixin(Range);
389
+
390
+ export default Range;