nzk-react-components 0.4.3 → 0.4.6-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 (485) hide show
  1. package/dist/assets/icons/bear.svg +177 -0
  2. package/dist/assets/icons/bear.svg.js +606 -0
  3. package/dist/assets/icons/bear.svg.js.map +1 -0
  4. package/dist/assets/icons/flamingo.svg +85 -0
  5. package/dist/assets/icons/flamingo.svg.js +287 -0
  6. package/dist/assets/icons/flamingo.svg.js.map +1 -0
  7. package/dist/assets/icons/giraffe.svg +259 -0
  8. package/dist/assets/icons/giraffe.svg.js +756 -0
  9. package/dist/assets/icons/giraffe.svg.js.map +1 -0
  10. package/dist/assets/icons/penguin.svg +231 -0
  11. package/dist/assets/icons/penguin.svg.js +718 -0
  12. package/dist/assets/icons/penguin.svg.js.map +1 -0
  13. package/dist/assets/icons/sealion.svg +156 -0
  14. package/dist/assets/icons/sealion.svg.js +649 -0
  15. package/dist/assets/icons/sealion.svg.js.map +1 -0
  16. package/dist/components/DrawingTool/DrawingTool.d.ts +29 -0
  17. package/dist/components/DrawingTool/DrawingTool.js +277 -0
  18. package/dist/components/DrawingTool/DrawingTool.js.map +1 -0
  19. package/dist/components/DrawingTool/DrawingTool.stories.d.ts +6 -0
  20. package/dist/components/DrawingTool/DrawingTool.styles.d.ts +41 -0
  21. package/dist/components/DrawingTool/DrawingTool.styles.js +54 -0
  22. package/dist/components/DrawingTool/DrawingTool.styles.js.map +1 -0
  23. package/dist/components/DrawingTool/DrawingToolProvider.d.ts +56 -0
  24. package/dist/components/DrawingTool/DrawingToolProvider.js +182 -0
  25. package/dist/components/DrawingTool/DrawingToolProvider.js.map +1 -0
  26. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.d.ts +21 -0
  27. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.js +89 -0
  28. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.js.map +1 -0
  29. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.d.ts +9 -0
  30. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.js +18 -0
  31. package/dist/components/DrawingTool/components/ColourToolbar/ColourToolbar.styles.js.map +1 -0
  32. package/dist/components/DrawingTool/components/ColourToolbar/index.d.ts +2 -0
  33. package/dist/components/DrawingTool/components/ColourToolbar/index.js +8 -0
  34. package/dist/components/DrawingTool/components/ColourToolbar/index.js.map +1 -0
  35. package/dist/components/DrawingTool/components/FileInput/FileInput.d.ts +9 -0
  36. package/dist/components/DrawingTool/components/FileInput/FileInput.js +88 -0
  37. package/dist/components/DrawingTool/components/FileInput/FileInput.js.map +1 -0
  38. package/dist/components/DrawingTool/components/FileInput/FileInput.styles.d.ts +4 -0
  39. package/dist/components/DrawingTool/components/FileInput/FileInput.styles.js +22 -0
  40. package/dist/components/DrawingTool/components/FileInput/FileInput.styles.js.map +1 -0
  41. package/dist/components/DrawingTool/components/FileInput/index.d.ts +2 -0
  42. package/dist/components/DrawingTool/components/FileInput/index.js +8 -0
  43. package/dist/components/DrawingTool/components/FileInput/index.js.map +1 -0
  44. package/dist/components/DrawingTool/components/Header/Header.d.ts +9 -0
  45. package/dist/components/DrawingTool/components/Header/Header.js +38 -0
  46. package/dist/components/DrawingTool/components/Header/Header.js.map +1 -0
  47. package/dist/components/DrawingTool/components/Header/index.d.ts +2 -0
  48. package/dist/components/DrawingTool/components/Header/index.js +8 -0
  49. package/dist/components/DrawingTool/components/Header/index.js.map +1 -0
  50. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.d.ts +8 -0
  51. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.js +31 -0
  52. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.js.map +1 -0
  53. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.d.ts +9 -0
  54. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.js +18 -0
  55. package/dist/components/DrawingTool/components/OpacityToggle/OpacityToggle.styles.js.map +1 -0
  56. package/dist/components/DrawingTool/components/OpacityToggle/index.d.ts +2 -0
  57. package/dist/components/DrawingTool/components/OpacityToggle/index.js +8 -0
  58. package/dist/components/DrawingTool/components/OpacityToggle/index.js.map +1 -0
  59. package/dist/components/DrawingTool/components/Placeable/index.d.ts +9 -0
  60. package/dist/components/DrawingTool/components/Placeable/index.js +22 -0
  61. package/dist/components/DrawingTool/components/Placeable/index.js.map +1 -0
  62. package/dist/components/DrawingTool/index.d.ts +2 -0
  63. package/dist/components/DrawingTool/lib/Sketch.d.ts +90 -0
  64. package/dist/components/DrawingTool/lib/Sketch.js +414 -0
  65. package/dist/components/DrawingTool/lib/Sketch.js.map +1 -0
  66. package/dist/components/DrawingTool/lib/SketchCut.d.ts +22 -0
  67. package/dist/components/DrawingTool/lib/SketchCut.js +98 -0
  68. package/dist/components/DrawingTool/lib/SketchCut.js.map +1 -0
  69. package/dist/components/DrawingTool/lib/SketchCutModel.d.ts +6 -0
  70. package/dist/components/DrawingTool/lib/SketchCutModel.js +20 -0
  71. package/dist/components/DrawingTool/lib/SketchCutModel.js.map +1 -0
  72. package/dist/components/DrawingTool/lib/SketchLayer.d.ts +27 -0
  73. package/dist/components/DrawingTool/lib/SketchLayer.js +59 -0
  74. package/dist/components/DrawingTool/lib/SketchLayer.js.map +1 -0
  75. package/dist/components/DrawingTool/lib/SketchModel.d.ts +65 -0
  76. package/dist/components/DrawingTool/lib/SketchModel.js +137 -0
  77. package/dist/components/DrawingTool/lib/SketchModel.js.map +1 -0
  78. package/dist/components/DrawingTool/lib/SketchStrokeModel.d.ts +33 -0
  79. package/dist/components/DrawingTool/lib/SketchStrokeModel.js +48 -0
  80. package/dist/components/DrawingTool/lib/SketchStrokeModel.js.map +1 -0
  81. package/dist/components/DrawingTool/lib/createInteractionSurface.d.ts +16 -0
  82. package/dist/components/DrawingTool/lib/createInteractionSurface.js +56 -0
  83. package/dist/components/DrawingTool/lib/createInteractionSurface.js.map +1 -0
  84. package/dist/components/DrawingTool/lib/trace.d.ts +3 -0
  85. package/dist/components/DrawingTool/lib/trace.js +24 -0
  86. package/dist/components/DrawingTool/lib/trace.js.map +1 -0
  87. package/dist/components/DrawingTool/lib/trimCanvas.d.ts +2 -0
  88. package/dist/components/DrawingTool/lib/trimCanvas.js +42 -0
  89. package/dist/components/DrawingTool/lib/trimCanvas.js.map +1 -0
  90. package/dist/components/Icon/Icon.js +1 -1
  91. package/dist/components/Icon/icons.d.ts +6 -1
  92. package/dist/components/Icon/icons.js +11 -4
  93. package/dist/components/Icon/icons.js.map +1 -1
  94. package/dist/icons/AboutUs.d.ts +3 -0
  95. package/dist/icons/AboutUs.js +44 -0
  96. package/dist/icons/AboutUs.js.map +1 -0
  97. package/dist/icons/Activities.d.ts +3 -0
  98. package/dist/icons/Activities.js +48 -0
  99. package/dist/icons/Activities.js.map +1 -0
  100. package/dist/icons/Archive.d.ts +3 -0
  101. package/dist/icons/Archive.js +43 -0
  102. package/dist/icons/Archive.js.map +1 -0
  103. package/dist/icons/ArrowLeft.d.ts +3 -0
  104. package/dist/icons/ArrowLeft.js +43 -0
  105. package/dist/icons/ArrowLeft.js.map +1 -0
  106. package/dist/icons/ArrowRight.d.ts +3 -0
  107. package/dist/icons/ArrowRight.js +43 -0
  108. package/dist/icons/ArrowRight.js.map +1 -0
  109. package/dist/icons/Bear.d.ts +3 -0
  110. package/dist/icons/Bear.js +177 -0
  111. package/dist/icons/Bear.js.map +1 -0
  112. package/dist/icons/CardSkills.d.ts +3 -0
  113. package/dist/icons/CardSkills.js +41 -0
  114. package/dist/icons/CardSkills.js.map +1 -0
  115. package/dist/icons/Challenges.d.ts +3 -0
  116. package/dist/icons/Challenges.js +43 -0
  117. package/dist/icons/Challenges.js.map +1 -0
  118. package/dist/icons/Chart.d.ts +3 -0
  119. package/dist/icons/Chart.js +35 -0
  120. package/dist/icons/Chart.js.map +1 -0
  121. package/dist/icons/Checkmark.d.ts +3 -0
  122. package/dist/icons/Checkmark.js +35 -0
  123. package/dist/icons/Checkmark.js.map +1 -0
  124. package/dist/icons/Close.d.ts +3 -0
  125. package/dist/icons/Close.js +43 -0
  126. package/dist/icons/Close.js.map +1 -0
  127. package/dist/icons/CloseCopy.d.ts +3 -0
  128. package/dist/icons/CloseCopy.js +35 -0
  129. package/dist/icons/CloseCopy.js.map +1 -0
  130. package/dist/icons/Collect.d.ts +3 -0
  131. package/dist/icons/Collect.js +94 -0
  132. package/dist/icons/Collect.js.map +1 -0
  133. package/dist/icons/Comment.d.ts +3 -0
  134. package/dist/icons/Comment.js +48 -0
  135. package/dist/icons/Comment.js.map +1 -0
  136. package/dist/icons/Compass.d.ts +3 -0
  137. package/dist/icons/Compass.js +39 -0
  138. package/dist/icons/Compass.js.map +1 -0
  139. package/dist/icons/Controller.d.ts +3 -0
  140. package/dist/icons/Controller.js +71 -0
  141. package/dist/icons/Controller.js.map +1 -0
  142. package/dist/icons/Create.d.ts +3 -0
  143. package/dist/icons/Create.js +137 -0
  144. package/dist/icons/Create.js.map +1 -0
  145. package/dist/icons/Customise.d.ts +3 -0
  146. package/dist/icons/Customise.js +60 -0
  147. package/dist/icons/Customise.js.map +1 -0
  148. package/dist/icons/Download.d.ts +3 -0
  149. package/dist/icons/Download.js +35 -0
  150. package/dist/icons/Download.js.map +1 -0
  151. package/dist/icons/Draft.d.ts +3 -0
  152. package/dist/icons/Draft.js +77 -0
  153. package/dist/icons/Draft.js.map +1 -0
  154. package/dist/icons/DrawingTask.d.ts +3 -0
  155. package/dist/icons/DrawingTask.js +156 -0
  156. package/dist/icons/DrawingTask.js.map +1 -0
  157. package/dist/icons/DrawingToolArrowDown.d.ts +3 -0
  158. package/dist/icons/DrawingToolArrowDown.js +35 -0
  159. package/dist/icons/DrawingToolArrowDown.js.map +1 -0
  160. package/dist/icons/DrawingToolArrowLeft.d.ts +3 -0
  161. package/dist/icons/DrawingToolArrowLeft.js +37 -0
  162. package/dist/icons/DrawingToolArrowLeft.js.map +1 -0
  163. package/dist/icons/DrawingToolArrowRight.d.ts +3 -0
  164. package/dist/icons/DrawingToolArrowRight.js +37 -0
  165. package/dist/icons/DrawingToolArrowRight.js.map +1 -0
  166. package/dist/icons/DrawingToolArrowUp.d.ts +3 -0
  167. package/dist/icons/DrawingToolArrowUp.js +35 -0
  168. package/dist/icons/DrawingToolArrowUp.js.map +1 -0
  169. package/dist/icons/DrawingToolCamera.d.ts +3 -0
  170. package/dist/icons/DrawingToolCamera.js +66 -0
  171. package/dist/icons/DrawingToolCamera.js.map +1 -0
  172. package/dist/icons/DrawingToolColorMixer.d.ts +3 -0
  173. package/dist/icons/DrawingToolColorMixer.js +37 -0
  174. package/dist/icons/DrawingToolColorMixer.js.map +1 -0
  175. package/dist/icons/DrawingToolEraser.d.ts +3 -0
  176. package/dist/icons/DrawingToolEraser.js +35 -0
  177. package/dist/icons/DrawingToolEraser.js.map +1 -0
  178. package/dist/icons/DrawingToolFillBrush.d.ts +3 -0
  179. package/dist/icons/DrawingToolFillBrush.js +45 -0
  180. package/dist/icons/DrawingToolFillBrush.js.map +1 -0
  181. package/dist/icons/DrawingToolLargeLine.d.ts +3 -0
  182. package/dist/icons/DrawingToolLargeLine.js +38 -0
  183. package/dist/icons/DrawingToolLargeLine.js.map +1 -0
  184. package/dist/icons/DrawingToolLineBrush.d.ts +3 -0
  185. package/dist/icons/DrawingToolLineBrush.js +39 -0
  186. package/dist/icons/DrawingToolLineBrush.js.map +1 -0
  187. package/dist/icons/DrawingToolMediumLine.d.ts +3 -0
  188. package/dist/icons/DrawingToolMediumLine.js +38 -0
  189. package/dist/icons/DrawingToolMediumLine.js.map +1 -0
  190. package/dist/icons/DrawingToolOpacityFull.d.ts +3 -0
  191. package/dist/icons/DrawingToolOpacityFull.js +35 -0
  192. package/dist/icons/DrawingToolOpacityFull.js.map +1 -0
  193. package/dist/icons/DrawingToolOpacityHalf.d.ts +3 -0
  194. package/dist/icons/DrawingToolOpacityHalf.js +35 -0
  195. package/dist/icons/DrawingToolOpacityHalf.js.map +1 -0
  196. package/dist/icons/DrawingToolRedo.d.ts +3 -0
  197. package/dist/icons/DrawingToolRedo.js +37 -0
  198. package/dist/icons/DrawingToolRedo.js.map +1 -0
  199. package/dist/icons/DrawingToolSmallLine.d.ts +3 -0
  200. package/dist/icons/DrawingToolSmallLine.js +38 -0
  201. package/dist/icons/DrawingToolSmallLine.js.map +1 -0
  202. package/dist/icons/DrawingToolStickers.d.ts +3 -0
  203. package/dist/icons/DrawingToolStickers.js +66 -0
  204. package/dist/icons/DrawingToolStickers.js.map +1 -0
  205. package/dist/icons/DrawingToolUndo.d.ts +3 -0
  206. package/dist/icons/DrawingToolUndo.js +37 -0
  207. package/dist/icons/DrawingToolUndo.js.map +1 -0
  208. package/dist/icons/Egg.d.ts +3 -0
  209. package/dist/icons/Egg.js +62 -0
  210. package/dist/icons/Egg.js.map +1 -0
  211. package/dist/icons/Enclosure.d.ts +3 -0
  212. package/dist/icons/Enclosure.js +76 -0
  213. package/dist/icons/Enclosure.js.map +1 -0
  214. package/dist/icons/Exclamation.d.ts +3 -0
  215. package/dist/icons/Exclamation.js +39 -0
  216. package/dist/icons/Exclamation.js.map +1 -0
  217. package/dist/icons/ExclamationGrey.d.ts +3 -0
  218. package/dist/icons/ExclamationGrey.js +37 -0
  219. package/dist/icons/ExclamationGrey.js.map +1 -0
  220. package/dist/icons/Eye.d.ts +3 -0
  221. package/dist/icons/Eye.js +42 -0
  222. package/dist/icons/Eye.js.map +1 -0
  223. package/dist/icons/Facebook.d.ts +3 -0
  224. package/dist/icons/Facebook.js +35 -0
  225. package/dist/icons/Facebook.js.map +1 -0
  226. package/dist/icons/Filter.d.ts +3 -0
  227. package/dist/icons/Filter.js +52 -0
  228. package/dist/icons/Filter.js.map +1 -0
  229. package/dist/icons/Flag.d.ts +3 -0
  230. package/dist/icons/Flag.js +47 -0
  231. package/dist/icons/Flag.js.map +1 -0
  232. package/dist/icons/Flamingo.d.ts +3 -0
  233. package/dist/icons/Flamingo.js +101 -0
  234. package/dist/icons/Flamingo.js.map +1 -0
  235. package/dist/icons/ForYou.d.ts +3 -0
  236. package/dist/icons/ForYou.js +61 -0
  237. package/dist/icons/ForYou.js.map +1 -0
  238. package/dist/icons/Games.d.ts +3 -0
  239. package/dist/icons/Games.js +73 -0
  240. package/dist/icons/Games.js.map +1 -0
  241. package/dist/icons/Gift.d.ts +3 -0
  242. package/dist/icons/Gift.js +54 -0
  243. package/dist/icons/Gift.js.map +1 -0
  244. package/dist/icons/Giraffe.d.ts +3 -0
  245. package/dist/icons/Giraffe.js +244 -0
  246. package/dist/icons/Giraffe.js.map +1 -0
  247. package/dist/icons/Goals.d.ts +3 -0
  248. package/dist/icons/Goals.js +46 -0
  249. package/dist/icons/Goals.js.map +1 -0
  250. package/dist/icons/Heart.d.ts +3 -0
  251. package/dist/icons/Heart.js +49 -0
  252. package/dist/icons/Heart.js.map +1 -0
  253. package/dist/icons/Help.d.ts +3 -0
  254. package/dist/icons/Help.js +43 -0
  255. package/dist/icons/Help.js.map +1 -0
  256. package/dist/icons/IdeaCreator.d.ts +3 -0
  257. package/dist/icons/IdeaCreator.js +46 -0
  258. package/dist/icons/IdeaCreator.js.map +1 -0
  259. package/dist/icons/Info.d.ts +3 -0
  260. package/dist/icons/Info.js +43 -0
  261. package/dist/icons/Info.js.map +1 -0
  262. package/dist/icons/Instagram.d.ts +3 -0
  263. package/dist/icons/Instagram.js +44 -0
  264. package/dist/icons/Instagram.js.map +1 -0
  265. package/dist/icons/Items.d.ts +3 -0
  266. package/dist/icons/Items.js +73 -0
  267. package/dist/icons/Items.js.map +1 -0
  268. package/dist/icons/Layers.d.ts +3 -0
  269. package/dist/icons/Layers.js +41 -0
  270. package/dist/icons/Layers.js.map +1 -0
  271. package/dist/icons/Lessons.d.ts +3 -0
  272. package/dist/icons/Lessons.js +38 -0
  273. package/dist/icons/Lessons.js.map +1 -0
  274. package/dist/icons/Link.d.ts +3 -0
  275. package/dist/icons/Link.js +44 -0
  276. package/dist/icons/Link.js.map +1 -0
  277. package/dist/icons/List.d.ts +3 -0
  278. package/dist/icons/List.js +53 -0
  279. package/dist/icons/List.js.map +1 -0
  280. package/dist/icons/Lock.d.ts +3 -0
  281. package/dist/icons/Lock.js +50 -0
  282. package/dist/icons/Lock.js.map +1 -0
  283. package/dist/icons/Logout.d.ts +3 -0
  284. package/dist/icons/Logout.js +43 -0
  285. package/dist/icons/Logout.js.map +1 -0
  286. package/dist/icons/Megaphone.d.ts +3 -0
  287. package/dist/icons/Megaphone.js +45 -0
  288. package/dist/icons/Megaphone.js.map +1 -0
  289. package/dist/icons/Menu.d.ts +3 -0
  290. package/dist/icons/Menu.js +48 -0
  291. package/dist/icons/Menu.js.map +1 -0
  292. package/dist/icons/Message.d.ts +3 -0
  293. package/dist/icons/Message.js +60 -0
  294. package/dist/icons/Message.js.map +1 -0
  295. package/dist/icons/Minus.d.ts +3 -0
  296. package/dist/icons/Minus.js +43 -0
  297. package/dist/icons/Minus.js.map +1 -0
  298. package/dist/icons/More.d.ts +3 -0
  299. package/dist/icons/More.js +48 -0
  300. package/dist/icons/More.js.map +1 -0
  301. package/dist/icons/MyHistory.d.ts +3 -0
  302. package/dist/icons/MyHistory.js +78 -0
  303. package/dist/icons/MyHistory.js.map +1 -0
  304. package/dist/icons/MyZoo.d.ts +3 -0
  305. package/dist/icons/MyZoo.js +81 -0
  306. package/dist/icons/MyZoo.js.map +1 -0
  307. package/dist/icons/New.d.ts +3 -0
  308. package/dist/icons/New.js +43 -0
  309. package/dist/icons/New.js.map +1 -0
  310. package/dist/icons/Notifications.d.ts +3 -0
  311. package/dist/icons/Notifications.js +39 -0
  312. package/dist/icons/Notifications.js.map +1 -0
  313. package/dist/icons/Nzk.d.ts +3 -0
  314. package/dist/icons/Nzk.js +42 -0
  315. package/dist/icons/Nzk.js.map +1 -0
  316. package/dist/icons/NzkPurple.d.ts +3 -0
  317. package/dist/icons/NzkPurple.js +49 -0
  318. package/dist/icons/NzkPurple.js.map +1 -0
  319. package/dist/icons/NzktvBlue.d.ts +3 -0
  320. package/dist/icons/NzktvBlue.js +36 -0
  321. package/dist/icons/NzktvBlue.js.map +1 -0
  322. package/dist/icons/NzktvGreen.d.ts +3 -0
  323. package/dist/icons/NzktvGreen.js +36 -0
  324. package/dist/icons/NzktvGreen.js.map +1 -0
  325. package/dist/icons/Orb.d.ts +3 -0
  326. package/dist/icons/Orb.js +46 -0
  327. package/dist/icons/Orb.js.map +1 -0
  328. package/dist/icons/OrbDisabled.d.ts +3 -0
  329. package/dist/icons/OrbDisabled.js +47 -0
  330. package/dist/icons/OrbDisabled.js.map +1 -0
  331. package/dist/icons/Padlock.d.ts +3 -0
  332. package/dist/icons/Padlock.js +43 -0
  333. package/dist/icons/Padlock.js.map +1 -0
  334. package/dist/icons/Pdf.d.ts +3 -0
  335. package/dist/icons/Pdf.js +46 -0
  336. package/dist/icons/Pdf.js.map +1 -0
  337. package/dist/icons/Pencil.d.ts +3 -0
  338. package/dist/icons/Pencil.js +77 -0
  339. package/dist/icons/Pencil.js.map +1 -0
  340. package/dist/icons/Pending.d.ts +3 -0
  341. package/dist/icons/Pending.js +74 -0
  342. package/dist/icons/Pending.js.map +1 -0
  343. package/dist/icons/Penguin.d.ts +3 -0
  344. package/dist/icons/Penguin.js +214 -0
  345. package/dist/icons/Penguin.js.map +1 -0
  346. package/dist/icons/Play.d.ts +3 -0
  347. package/dist/icons/Play.js +46 -0
  348. package/dist/icons/Play.js.map +1 -0
  349. package/dist/icons/PlayVideo.d.ts +3 -0
  350. package/dist/icons/PlayVideo.js +43 -0
  351. package/dist/icons/PlayVideo.js.map +1 -0
  352. package/dist/icons/Plus.d.ts +3 -0
  353. package/dist/icons/Plus.js +43 -0
  354. package/dist/icons/Plus.js.map +1 -0
  355. package/dist/icons/Private.d.ts +3 -0
  356. package/dist/icons/Private.js +63 -0
  357. package/dist/icons/Private.js.map +1 -0
  358. package/dist/icons/Progress.d.ts +3 -0
  359. package/dist/icons/Progress.js +43 -0
  360. package/dist/icons/Progress.js.map +1 -0
  361. package/dist/icons/Projects.d.ts +3 -0
  362. package/dist/icons/Projects.js +50 -0
  363. package/dist/icons/Projects.js.map +1 -0
  364. package/dist/icons/Refresh.d.ts +3 -0
  365. package/dist/icons/Refresh.js +39 -0
  366. package/dist/icons/Refresh.js.map +1 -0
  367. package/dist/icons/Rewards.d.ts +3 -0
  368. package/dist/icons/Rewards.js +69 -0
  369. package/dist/icons/Rewards.js.map +1 -0
  370. package/dist/icons/Sealion.d.ts +3 -0
  371. package/dist/icons/Sealion.js +184 -0
  372. package/dist/icons/Sealion.js.map +1 -0
  373. package/dist/icons/Search.d.ts +3 -0
  374. package/dist/icons/Search.js +49 -0
  375. package/dist/icons/Search.js.map +1 -0
  376. package/dist/icons/Send.d.ts +3 -0
  377. package/dist/icons/Send.js +59 -0
  378. package/dist/icons/Send.js.map +1 -0
  379. package/dist/icons/Settings.d.ts +3 -0
  380. package/dist/icons/Settings.js +43 -0
  381. package/dist/icons/Settings.js.map +1 -0
  382. package/dist/icons/Sharing.d.ts +3 -0
  383. package/dist/icons/Sharing.js +49 -0
  384. package/dist/icons/Sharing.js.map +1 -0
  385. package/dist/icons/Shop.d.ts +3 -0
  386. package/dist/icons/Shop.js +112 -0
  387. package/dist/icons/Shop.js.map +1 -0
  388. package/dist/icons/SoundOff.d.ts +3 -0
  389. package/dist/icons/SoundOff.js +39 -0
  390. package/dist/icons/SoundOff.js.map +1 -0
  391. package/dist/icons/SoundOn.d.ts +3 -0
  392. package/dist/icons/SoundOn.js +42 -0
  393. package/dist/icons/SoundOn.js.map +1 -0
  394. package/dist/icons/StarWriting.d.ts +3 -0
  395. package/dist/icons/StarWriting.js +49 -0
  396. package/dist/icons/StarWriting.js.map +1 -0
  397. package/dist/icons/Task.d.ts +3 -0
  398. package/dist/icons/Task.js +47 -0
  399. package/dist/icons/Task.js.map +1 -0
  400. package/dist/icons/TextToSpeech.d.ts +3 -0
  401. package/dist/icons/TextToSpeech.js +40 -0
  402. package/dist/icons/TextToSpeech.js.map +1 -0
  403. package/dist/icons/Tick.d.ts +3 -0
  404. package/dist/icons/Tick.js +43 -0
  405. package/dist/icons/Tick.js.map +1 -0
  406. package/dist/icons/Torch.d.ts +3 -0
  407. package/dist/icons/Torch.js +52 -0
  408. package/dist/icons/Torch.js.map +1 -0
  409. package/dist/icons/Transfer.d.ts +3 -0
  410. package/dist/icons/Transfer.js +40 -0
  411. package/dist/icons/Transfer.js.map +1 -0
  412. package/dist/icons/Trash.d.ts +3 -0
  413. package/dist/icons/Trash.js +50 -0
  414. package/dist/icons/Trash.js.map +1 -0
  415. package/dist/icons/TrashCopy.d.ts +3 -0
  416. package/dist/icons/TrashCopy.js +50 -0
  417. package/dist/icons/TrashCopy.js.map +1 -0
  418. package/dist/icons/TrashWhite.d.ts +3 -0
  419. package/dist/icons/TrashWhite.js +50 -0
  420. package/dist/icons/TrashWhite.js.map +1 -0
  421. package/dist/icons/Trophy.d.ts +3 -0
  422. package/dist/icons/Trophy.js +95 -0
  423. package/dist/icons/Trophy.js.map +1 -0
  424. package/dist/icons/Twitter.d.ts +3 -0
  425. package/dist/icons/Twitter.js +35 -0
  426. package/dist/icons/Twitter.js.map +1 -0
  427. package/dist/icons/Upload.d.ts +3 -0
  428. package/dist/icons/Upload.js +43 -0
  429. package/dist/icons/Upload.js.map +1 -0
  430. package/dist/icons/User.d.ts +3 -0
  431. package/dist/icons/User.js +37 -0
  432. package/dist/icons/User.js.map +1 -0
  433. package/dist/icons/Users.d.ts +3 -0
  434. package/dist/icons/Users.js +44 -0
  435. package/dist/icons/Users.js.map +1 -0
  436. package/dist/icons/Video.d.ts +3 -0
  437. package/dist/icons/Video.js +53 -0
  438. package/dist/icons/Video.js.map +1 -0
  439. package/dist/icons/Whatsapp.d.ts +3 -0
  440. package/dist/icons/Whatsapp.js +41 -0
  441. package/dist/icons/Whatsapp.js.map +1 -0
  442. package/dist/icons/Writing.d.ts +3 -0
  443. package/dist/icons/Writing.js +75 -0
  444. package/dist/icons/Writing.js.map +1 -0
  445. package/dist/icons/WritingTypeAdventureStory.d.ts +3 -0
  446. package/dist/icons/WritingTypeAdventureStory.js +43 -0
  447. package/dist/icons/WritingTypeAdventureStory.js.map +1 -0
  448. package/dist/icons/WritingTypeBiography.d.ts +3 -0
  449. package/dist/icons/WritingTypeBiography.js +43 -0
  450. package/dist/icons/WritingTypeBiography.js.map +1 -0
  451. package/dist/icons/WritingTypeDiaryEntry.d.ts +3 -0
  452. package/dist/icons/WritingTypeDiaryEntry.js +47 -0
  453. package/dist/icons/WritingTypeDiaryEntry.js.map +1 -0
  454. package/dist/icons/WritingTypeFreeWrite.d.ts +3 -0
  455. package/dist/icons/WritingTypeFreeWrite.js +46 -0
  456. package/dist/icons/WritingTypeFreeWrite.js.map +1 -0
  457. package/dist/icons/WritingTypeInstructions.d.ts +3 -0
  458. package/dist/icons/WritingTypeInstructions.js +43 -0
  459. package/dist/icons/WritingTypeInstructions.js.map +1 -0
  460. package/dist/icons/WritingTypeLetterWriting.d.ts +3 -0
  461. package/dist/icons/WritingTypeLetterWriting.js +43 -0
  462. package/dist/icons/WritingTypeLetterWriting.js.map +1 -0
  463. package/dist/icons/WritingTypeNewspaperArticle.d.ts +3 -0
  464. package/dist/icons/WritingTypeNewspaperArticle.js +44 -0
  465. package/dist/icons/WritingTypeNewspaperArticle.js.map +1 -0
  466. package/dist/icons/WritingTypePersuasiveWriting.d.ts +3 -0
  467. package/dist/icons/WritingTypePersuasiveWriting.js +43 -0
  468. package/dist/icons/WritingTypePersuasiveWriting.js.map +1 -0
  469. package/dist/icons/WritingTypePlayscript.d.ts +3 -0
  470. package/dist/icons/WritingTypePlayscript.js +44 -0
  471. package/dist/icons/WritingTypePlayscript.js.map +1 -0
  472. package/dist/icons/WritingTypePoem.d.ts +3 -0
  473. package/dist/icons/WritingTypePoem.js +42 -0
  474. package/dist/icons/WritingTypePoem.js.map +1 -0
  475. package/dist/icons/WritingTypeReport.d.ts +3 -0
  476. package/dist/icons/WritingTypeReport.js +50 -0
  477. package/dist/icons/WritingTypeReport.js.map +1 -0
  478. package/dist/icons/ZooPoint.d.ts +3 -0
  479. package/dist/icons/ZooPoint.js +75 -0
  480. package/dist/icons/ZooPoint.js.map +1 -0
  481. package/dist/icons/index.d.ts +129 -0
  482. package/dist/index.d.ts +1 -0
  483. package/dist/index.js +258 -0
  484. package/dist/index.js.map +1 -1
  485. package/package.json +3 -1
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var tslib = require('tslib');
6
+ var styled = require('styled-components');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
+
12
+ var Container = styled__default['default'].div(templateObject_1 || (templateObject_1 = tslib.__makeTemplateObject(["\n custor: pointer;\n background-color: #ebebeb;\n border: 6px solid #d9d9d9;\n box-shadow: 0px 4px 0px rgba(0,0,0, .5);\n border-radius: ", "px;\n width: ", ";\n padding-bottom: ", ";\n padding-right: ", ";\n display: flex;\n flex-shrink: none;\n flex-wrap: ", ";\n justify-content: center;\n align-items: center;\n position: relative;\n > div {\n transform: scale(1.2);\n &:first-child {\n position: relative;\n top: ", ";\n left: ", ";\n }\n }\n"], ["\n custor: pointer;\n background-color: #ebebeb;\n border: 6px solid #d9d9d9;\n box-shadow: 0px 4px 0px rgba(0,0,0, .5);\n border-radius: ", "px;\n width: ", ";\n padding-bottom: ", ";\n padding-right: ", ";\n display: flex;\n flex-shrink: none;\n flex-wrap: ", ";\n justify-content: center;\n align-items: center;\n position: relative;\n > div {\n transform: scale(1.2);\n &:first-child {\n position: relative;\n top: ", ";\n left: ", ";\n }\n }\n"])), function (props) { return props.buttonSize; }, function (props) { return props.orientation === 'LANDSCAPE' ? props.buttonSize + props.buttonSize * 0.2 + "px" : 'auto'; }, function (props) { return props.orientation === 'LANDSCAPE' ? '4px' : '0px'; }, function (props) { return props.orientation === 'LANDSCAPE' ? '0px' : '4px'; }, function (props) { return props.orientation === 'LANDSCAPE' ? 'wrap' : 'no-wrap'; }, function (props) { return props.orientation === 'LANDSCAPE' ? '4px' : '0px'; }, function (props) { return props.orientation === 'PORTRAIT' ? '4px' : '0px'; });
13
+ var OpacityButton = styled__default['default'].div(templateObject_2 || (templateObject_2 = tslib.__makeTemplateObject(["\n width: ", "px;\n height: ", "px;\n cursor: pointer;\n"], ["\n width: ", "px;\n height: ", "px;\n cursor: pointer;\n"])), function (props) { return props.buttonSize; }, function (props) { return props.buttonSize; });
14
+ var templateObject_1, templateObject_2;
15
+
16
+ exports.Container = Container;
17
+ exports.OpacityButton = OpacityButton;
18
+ //# sourceMappingURL=OpacityToggle.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OpacityToggle.styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ import OpacityToggle from "./OpacityToggle";
2
+ export default OpacityToggle;
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var OpacityToggle = require('./OpacityToggle.js');
4
+
5
+
6
+
7
+ module.exports = OpacityToggle;
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { MoveableManagerInterface, Renderer } from "react-moveable";
3
+ declare const _default: {
4
+ readonly name: "placeable";
5
+ readonly props: {};
6
+ readonly events: {};
7
+ readonly render: (moveable: MoveableManagerInterface<any, any>, React: Renderer) => JSX.Element;
8
+ };
9
+ export default _default;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var Icon = require('../../../Icon/Icon.js');
4
+
5
+ var Placeable = {
6
+ name: "placeable",
7
+ props: {},
8
+ events: {},
9
+ render: function (moveable, React) {
10
+ var rect = moveable.getRect();
11
+ var _a = moveable.state, pos1 = _a.pos1, pos2 = _a.pos2;
12
+ var Placeable = moveable.useCSS("div", "\n {\n position: absolute;\n left: 0px;\n top: 0px;\n will-change: transform;\n transform-origin: 0px 0px;\n pointer-events: none;\n }\n .placeable-icon {\n width: 24px;\n height: 24px;\n background: #4af;\n border-radius: 100%;\n }\n ");
13
+ return React.createElement(Placeable, { key: "placeable", className: "moveable-placeable", style: {
14
+ transform: "translate(" + (pos2[0] - (pos2[0] - pos1[0]) / 2) + "px, " + (pos2[1] - (pos2[1] - pos1[1]) / 2) + "px) rotate(" + rect.rotation + "deg) translateY(-54px) translateX(-12px)",
15
+ } },
16
+ React.createElement("div", { className: 'placeable-icon' },
17
+ React.createElement(Icon, { name: 'refresh' })));
18
+ }
19
+ };
20
+
21
+ module.exports = Placeable;
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ import DrawingTool from "./DrawingTool";
2
+ export default DrawingTool;
@@ -0,0 +1,90 @@
1
+ import SketchLayer from './SketchLayer';
2
+ import { Point } from './createInteractionSurface';
3
+ import SketchModel, { SketchAction, SketchActionMergeData, SketchModelData } from './SketchModel';
4
+ export interface SketchProps {
5
+ containerEl: HTMLDivElement;
6
+ template?: string;
7
+ onChange?: Function;
8
+ sketchData?: SketchModelData;
9
+ onReady?: Function;
10
+ }
11
+ interface ExportProps {
12
+ crop?: boolean;
13
+ }
14
+ export default class Sketch {
15
+ readonly containerEl: HTMLDivElement;
16
+ readonly width: number;
17
+ readonly height: number;
18
+ readonly naturalWidth: number;
19
+ readonly naturalHeight: number;
20
+ readonly pixelRatioScale: number;
21
+ readonly model: SketchModel;
22
+ readonly drawingLayer: SketchLayer;
23
+ readonly bufferLayer: SketchLayer;
24
+ readonly cacheLayer: SketchLayer;
25
+ readonly templateLayer?: SketchLayer;
26
+ template?: string;
27
+ interactionSurface: HTMLDivElement;
28
+ isDrawing: boolean;
29
+ onChange?: Function;
30
+ sketchData?: SketchModelData;
31
+ drawUndo?: any;
32
+ drawFinished?: any;
33
+ drawAnimation?: any;
34
+ reqStroke?: any;
35
+ constructor(props: SketchProps);
36
+ setBrush({ colour, size, opacity, fill, eraser }: {
37
+ colour: any;
38
+ size: any;
39
+ opacity: any;
40
+ fill: any;
41
+ eraser: any;
42
+ }): void;
43
+ mergeImage(data: SketchActionMergeData, saveAction?: boolean, callback?: () => void): void;
44
+ export(props?: ExportProps): any;
45
+ undo(): void;
46
+ redo(): void;
47
+ canUndo(): boolean;
48
+ canRedo(): boolean;
49
+ restart(): void;
50
+ serialize(): {
51
+ colour: number[];
52
+ opacity: number;
53
+ size: number;
54
+ lastActionIndex: number;
55
+ actions: SketchAction[];
56
+ currentStroke: import("./SketchStrokeModel").SketchStrokeModelData | null;
57
+ };
58
+ deserialize(serialized: any): void;
59
+ getNumberOfActions(): number;
60
+ initDrawAnimations(): void;
61
+ startDraw(point: Point): void;
62
+ continueDraw(point: Point): boolean;
63
+ endDraw(): void;
64
+ drawExistingSketch(callback?: Function): void;
65
+ drawAction(action: SketchAction, callback?: () => void): void;
66
+ strokeAnimation(): void;
67
+ drawAnimationStroke(stroke: any): void;
68
+ endStrokeAnimation(): void;
69
+ drawUndoStroke(stroke: any): void;
70
+ drawFinishedStroke(stroke: any): void;
71
+ drawExistingStroke(stroke: any): void;
72
+ drawTransparentFillFinal(stroke: any): void;
73
+ drawStrokeFinal(stroke: any): void;
74
+ drawFillFinal(stroke: any): void;
75
+ drawFillAndStroke(stroke: any): void;
76
+ drawEraserUndoingFinal(stroke: any): void;
77
+ drawEraserUndoingFillFinal(stroke: any): void;
78
+ drawEraser(stroke: any, copy?: boolean): void;
79
+ drawEraserFillFinal(stroke: any, copy?: boolean): void;
80
+ findBoundingBox(ctx: any): {
81
+ topLeftX: number;
82
+ topLeftY: number;
83
+ bottomRightX: number;
84
+ bottomRightY: number;
85
+ width: number;
86
+ height: number;
87
+ };
88
+ getLayerToExport(): SketchLayer;
89
+ }
90
+ export {};
@@ -0,0 +1,414 @@
1
+ 'use strict';
2
+
3
+ var tslib = require('tslib');
4
+ var after = require('lodash.after');
5
+ var SketchLayer = require('./SketchLayer.js');
6
+ var createInteractionSurface = require('./createInteractionSurface.js');
7
+ var SketchModel = require('./SketchModel.js');
8
+ var trace = require('./trace.js');
9
+ var trimCanvas = require('./trimCanvas.js');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ var after__default = /*#__PURE__*/_interopDefaultLegacy(after);
14
+
15
+ var setDrawingStyle = function (style, ctx) {
16
+ if (style) {
17
+ var colour = "rgba(" + style.colour[0] + ", " + style.colour[1] + ", " + style.colour[2] + ", " + style.opacity + ")";
18
+ ctx.strokeStyle = colour;
19
+ ctx.fillStyle = colour;
20
+ ctx.lineWidth = style.size;
21
+ }
22
+ ctx.lineJoin = "round";
23
+ ctx.lineCap = "round";
24
+ };
25
+ var Sketch = (function () {
26
+ function Sketch(props) {
27
+ this.isDrawing = false;
28
+ this.containerEl = props.containerEl;
29
+ this.naturalWidth = props.containerEl.offsetWidth;
30
+ this.naturalHeight = props.containerEl.offsetHeight;
31
+ this.pixelRatioScale = window.devicePixelRatio > 1.5 ? 2 : 1;
32
+ this.width = this.naturalWidth * this.pixelRatioScale;
33
+ this.height = this.naturalHeight * this.pixelRatioScale;
34
+ this.template = props.template;
35
+ this.model = new SketchModel({
36
+ pixelRatioScale: this.pixelRatioScale
37
+ });
38
+ var defaultLayerProps = {
39
+ pixelRatioScale: this.pixelRatioScale,
40
+ width: props.containerEl.offsetWidth,
41
+ height: props.containerEl.offsetHeight
42
+ };
43
+ if (this.template) {
44
+ this.templateLayer = new SketchLayer(defaultLayerProps);
45
+ this.templateLayer.drawImageToFill(this.template);
46
+ this.containerEl.appendChild(this.templateLayer.canvas);
47
+ }
48
+ this.drawingLayer = new SketchLayer(defaultLayerProps);
49
+ this.drawingLayer.canvas.style.zIndex = '1';
50
+ this.containerEl.appendChild(this.drawingLayer.canvas);
51
+ this.bufferLayer = new SketchLayer(defaultLayerProps);
52
+ this.bufferLayer.canvas.style.zIndex = '2';
53
+ this.containerEl.appendChild(this.bufferLayer.canvas);
54
+ this.cacheLayer = new SketchLayer(defaultLayerProps);
55
+ this.cacheLayer.hide();
56
+ this.containerEl.appendChild(this.cacheLayer.canvas);
57
+ this.interactionSurface = createInteractionSurface({
58
+ width: this.containerEl.offsetWidth,
59
+ height: this.containerEl.offsetHeight,
60
+ scale: this.pixelRatioScale,
61
+ onTouchStart: this.startDraw.bind(this),
62
+ onTouchMove: this.continueDraw.bind(this),
63
+ onTouchEnd: this.endDraw.bind(this),
64
+ onTouchLeave: this.endDraw.bind(this),
65
+ onTouchEnter: this.startDraw.bind(this)
66
+ });
67
+ this.interactionSurface.style.zIndex = '100';
68
+ this.containerEl.appendChild(this.interactionSurface);
69
+ this.initDrawAnimations();
70
+ if (this.bufferLayer.ctx) {
71
+ setDrawingStyle(this.model.getStyle(), this.bufferLayer.ctx);
72
+ }
73
+ if (props.onChange)
74
+ this.onChange = props.onChange;
75
+ if (props.sketchData) {
76
+ this.deserialize(props.sketchData);
77
+ this.drawExistingSketch(props.onReady);
78
+ }
79
+ else if (props.onReady) {
80
+ props.onReady();
81
+ }
82
+ }
83
+ Sketch.prototype.setBrush = function (_a) {
84
+ var colour = _a.colour, size = _a.size, opacity = _a.opacity, fill = _a.fill, eraser = _a.eraser;
85
+ if (colour !== undefined) {
86
+ this.model.colour = colour;
87
+ }
88
+ if (size !== undefined) {
89
+ this.model.size = size;
90
+ }
91
+ if (opacity !== undefined) {
92
+ this.model.opacity = opacity;
93
+ }
94
+ if (fill !== undefined) {
95
+ this.model.fill = fill;
96
+ }
97
+ if (eraser !== undefined) {
98
+ this.model.eraser = eraser;
99
+ }
100
+ };
101
+ Sketch.prototype.mergeImage = function (data, saveAction, callback) {
102
+ var _this = this;
103
+ if (saveAction === void 0) { saveAction = true; }
104
+ if (callback === void 0) { callback = function () { }; }
105
+ var doMerge = function (img) {
106
+ var scale = (data.width / img.width) * _this.pixelRatioScale;
107
+ _this.drawingLayer.ctx.globalCompositeOperation = "source-over";
108
+ _this.drawingLayer.ctx.save();
109
+ _this.drawingLayer.ctx.translate(data.origin[0] * _this.pixelRatioScale, data.origin[1] * _this.pixelRatioScale);
110
+ _this.drawingLayer.ctx.rotate(data.rotation * Math.PI / 180);
111
+ _this.drawingLayer.ctx.translate(-data.x - img.width * scale / 2, -data.y - img.height * scale / 2);
112
+ _this.drawingLayer.ctx.drawImage(img, data.x, data.y, img.width * scale, img.height * scale);
113
+ _this.drawingLayer.ctx.restore();
114
+ if (saveAction) {
115
+ _this.model.saveMergeImage(data);
116
+ if (_this.onChange) {
117
+ _this.onChange();
118
+ }
119
+ }
120
+ callback();
121
+ };
122
+ if (data.image) {
123
+ doMerge(data.image);
124
+ }
125
+ else if (data.imageSrc) {
126
+ var img_1 = new Image;
127
+ img_1.onload = function () { doMerge(img_1); };
128
+ img_1.src = data.imageSrc;
129
+ }
130
+ };
131
+ Sketch.prototype.export = function (props) {
132
+ if (this.templateLayer) {
133
+ this.templateLayer.drawImageToFit(this.drawingLayer.canvas);
134
+ }
135
+ var layerToExport = this.getLayerToExport();
136
+ var exportCanvas = (props && props.crop) ? trimCanvas(layerToExport.canvas) : layerToExport.canvas;
137
+ return exportCanvas.toDataURL();
138
+ };
139
+ Sketch.prototype.undo = function () {
140
+ if (!this.model.canUndo())
141
+ return;
142
+ this.model.lastActionIndex -= 1;
143
+ this.drawingLayer.clear();
144
+ console.log('Last action Index before undo', this.model.lastActionIndex);
145
+ for (var i = 0; i <= this.model.lastActionIndex; i += 1) {
146
+ console.log('I=', i);
147
+ if (this.model.actions[i].type === 'STROKE' && this.model.actions[i].model) {
148
+ console.log('draw stroke');
149
+ this.drawUndoStroke(this.model.actions[i].model);
150
+ }
151
+ else if (this.model.actions[i].type === 'IMAGE_MERGE' && this.model.actions[i]) {
152
+ console.log('merge image');
153
+ this.mergeImage(this.model.actions[i].data, false);
154
+ }
155
+ }
156
+ if (this.onChange)
157
+ this.onChange();
158
+ };
159
+ Sketch.prototype.redo = function () {
160
+ if (!this.model.canRedo())
161
+ return;
162
+ this.model.lastActionIndex += 1;
163
+ var action = this.model.actions[this.model.lastActionIndex];
164
+ if (action.type === 'STROKE' && action.model) {
165
+ this.drawUndoStroke(action.model);
166
+ }
167
+ else if (action.type === 'IMAGE_MERGE' && action.data) {
168
+ this.mergeImage(action.data, false);
169
+ }
170
+ if (this.onChange)
171
+ this.onChange();
172
+ };
173
+ Sketch.prototype.canUndo = function () {
174
+ return this.model.canUndo();
175
+ };
176
+ Sketch.prototype.canRedo = function () {
177
+ return this.model.canRedo();
178
+ };
179
+ Sketch.prototype.restart = function () {
180
+ this.model.reset();
181
+ this.drawingLayer.clear();
182
+ if (this.onChange) {
183
+ this.onChange();
184
+ }
185
+ };
186
+ Sketch.prototype.serialize = function () {
187
+ return this.model.serialize();
188
+ };
189
+ Sketch.prototype.deserialize = function (serialized) {
190
+ this.model.deserialize(serialized);
191
+ };
192
+ Sketch.prototype.getNumberOfActions = function () {
193
+ return this.model.lastActionIndex + 1;
194
+ };
195
+ Sketch.prototype.initDrawAnimations = function () {
196
+ this.drawUndo = {
197
+ transparentEraserFill: this.drawTransparentFillFinal,
198
+ transparentEraserStroke: this.drawStrokeFinal,
199
+ transparentColourFill: this.drawTransparentFillFinal,
200
+ transparentColourStroke: this.drawStrokeFinal,
201
+ opaqueEraserFill: this.drawEraserUndoingFillFinal,
202
+ opaqueEraserStroke: this.drawEraserUndoingFinal,
203
+ opaqueColourFill: this.drawFillFinal,
204
+ opaqueColourStroke: this.drawStrokeFinal
205
+ };
206
+ this.drawFinished = {
207
+ transparentEraserFill: this.drawTransparentFillFinal,
208
+ transparentEraserStroke: this.drawStrokeFinal,
209
+ transparentColourFill: this.drawTransparentFillFinal,
210
+ transparentColourStroke: this.drawStrokeFinal,
211
+ opaqueEraserFill: this.drawEraserFillFinal,
212
+ opaqueEraserStroke: this.drawEraser,
213
+ opaqueColourFill: this.drawFillFinal,
214
+ opaqueColourStroke: this.drawStrokeFinal
215
+ };
216
+ this.drawAnimation = {
217
+ transparentEraserFill: this.drawFillAndStroke,
218
+ transparentEraserStroke: this.drawFillAndStroke,
219
+ transparentColourFill: this.drawFillAndStroke,
220
+ transparentColourStroke: this.drawFillAndStroke,
221
+ opaqueEraserFill: this.drawEraser,
222
+ opaqueEraserStroke: this.drawEraser,
223
+ opaqueColourFill: this.drawFillAndStroke,
224
+ opaqueColourStroke: this.drawFillAndStroke
225
+ };
226
+ };
227
+ Sketch.prototype.startDraw = function (point) {
228
+ this.isDrawing = true;
229
+ this.model.initStroke(point);
230
+ if (this.model.currentStroke && this.model.currentStroke.style && this.cacheLayer.ctx && this.drawingLayer.ctx) {
231
+ if (this.model.currentStroke.style.eraser && this.model.currentStroke.style.opacity === 1.0) {
232
+ this.cacheLayer.ctx.globalCompositeOperation = "copy";
233
+ this.cacheLayer.ctx.drawImage(this.drawingLayer.ctx.canvas, 0, 0, this.width, this.height);
234
+ setDrawingStyle(this.model.currentStroke.style, this.drawingLayer.ctx);
235
+ }
236
+ }
237
+ if (this.model.currentStroke && this.bufferLayer.ctx) {
238
+ setDrawingStyle(this.model.currentStroke.style, this.bufferLayer.ctx);
239
+ }
240
+ this.strokeAnimation();
241
+ };
242
+ Sketch.prototype.continueDraw = function (point) {
243
+ if (!this.isDrawing)
244
+ return false;
245
+ this.model.continueStroke(point);
246
+ return false;
247
+ };
248
+ Sketch.prototype.endDraw = function () {
249
+ if (!(this.model.currentStroke && this.model.currentStroke.style))
250
+ return;
251
+ this.isDrawing = false;
252
+ this.endStrokeAnimation();
253
+ this.bufferLayer.clear();
254
+ this.drawFinishedStroke(this.model.currentStroke);
255
+ this.model.saveStroke();
256
+ if (this.onChange) {
257
+ this.onChange();
258
+ }
259
+ };
260
+ Sketch.prototype.drawExistingSketch = function (callback) {
261
+ if (this.model.lastActionIndex === -1) {
262
+ if (callback)
263
+ callback();
264
+ return;
265
+ }
266
+ var done = after__default['default'](Math.min(this.model.lastActionIndex, this.model.actions.length), function () {
267
+ if (callback)
268
+ callback();
269
+ });
270
+ for (var i = 0; i <= this.model.lastActionIndex; i += 1) {
271
+ this.drawAction(this.model.actions[i], done);
272
+ }
273
+ };
274
+ Sketch.prototype.drawAction = function (action, callback) {
275
+ if (callback === void 0) { callback = function () { }; }
276
+ if (action.type === 'STROKE' && action.model) {
277
+ this.drawExistingStroke(action.model);
278
+ callback();
279
+ }
280
+ else if (action.type === 'IMAGE_MERGE') {
281
+ this.mergeImage(action.data, false, callback);
282
+ }
283
+ };
284
+ Sketch.prototype.strokeAnimation = function () {
285
+ var _this = this;
286
+ this.drawAnimationStroke(this.model.currentStroke);
287
+ this.reqStroke = window.requestAnimationFrame(function () { return _this.strokeAnimation.apply(_this); });
288
+ };
289
+ Sketch.prototype.drawAnimationStroke = function (stroke) {
290
+ this.drawAnimation[stroke.style.type].apply(this, [stroke]);
291
+ };
292
+ Sketch.prototype.endStrokeAnimation = function () {
293
+ window.cancelAnimationFrame(this.reqStroke);
294
+ this.reqStroke = 0;
295
+ };
296
+ Sketch.prototype.drawUndoStroke = function (stroke) {
297
+ setDrawingStyle(stroke.style, this.drawingLayer.ctx);
298
+ this.drawUndo[stroke.style.type].apply(this, [stroke]);
299
+ };
300
+ Sketch.prototype.drawFinishedStroke = function (stroke) {
301
+ setDrawingStyle(stroke.style, this.drawingLayer.ctx);
302
+ this.drawFinished[stroke.style.type].apply(this, [stroke]);
303
+ };
304
+ Sketch.prototype.drawExistingStroke = function (stroke) {
305
+ setDrawingStyle(stroke.style, this.drawingLayer.ctx);
306
+ this.drawFinished[stroke.style.type].apply(this, [stroke, false]);
307
+ };
308
+ Sketch.prototype.drawTransparentFillFinal = function (stroke) {
309
+ this.cacheLayer.clear();
310
+ this.cacheLayer.ctx.globalCompositeOperation = "source-over";
311
+ setDrawingStyle(tslib.__assign(tslib.__assign({}, stroke.style), { opacity: 1 }), this.cacheLayer.ctx);
312
+ trace(stroke, this.cacheLayer.ctx);
313
+ this.cacheLayer.ctx.closePath();
314
+ this.cacheLayer.ctx.stroke();
315
+ this.cacheLayer.ctx.fill();
316
+ this.drawingLayer.ctx.globalCompositeOperation = "source-over";
317
+ this.drawingLayer.ctx.globalAlpha = stroke.style.opacity;
318
+ this.drawingLayer.ctx.drawImage(this.cacheLayer.ctx.canvas, 0, 0, this.width, this.height);
319
+ this.drawingLayer.ctx.globalAlpha = 1.0;
320
+ };
321
+ Sketch.prototype.drawStrokeFinal = function (stroke) {
322
+ this.drawingLayer.ctx.globalCompositeOperation = "source-over";
323
+ trace(stroke, this.drawingLayer.ctx);
324
+ this.drawingLayer.ctx.stroke();
325
+ };
326
+ Sketch.prototype.drawFillFinal = function (stroke) {
327
+ this.drawingLayer.ctx.globalCompositeOperation = "source-over";
328
+ trace(stroke, this.drawingLayer.ctx);
329
+ this.drawingLayer.ctx.closePath();
330
+ this.drawingLayer.ctx.fill();
331
+ this.drawingLayer.ctx.stroke();
332
+ };
333
+ Sketch.prototype.drawFillAndStroke = function (stroke) {
334
+ this.bufferLayer.clear();
335
+ trace(stroke, this.bufferLayer.ctx);
336
+ setDrawingStyle(tslib.__assign(tslib.__assign({}, stroke.style), { opacity: 1 }), this.bufferLayer.ctx);
337
+ this.bufferLayer.ctx.globalAlpha = stroke.style.opacity;
338
+ if (this.model.fill) {
339
+ this.bufferLayer.ctx.closePath();
340
+ this.bufferLayer.ctx.fill();
341
+ }
342
+ this.bufferLayer.ctx.stroke();
343
+ };
344
+ Sketch.prototype.drawEraserUndoingFinal = function (stroke) {
345
+ this.drawingLayer.ctx.globalCompositeOperation = "destination-out";
346
+ trace(stroke, this.drawingLayer.ctx);
347
+ this.drawingLayer.ctx.stroke();
348
+ };
349
+ Sketch.prototype.drawEraserUndoingFillFinal = function (stroke) {
350
+ this.drawingLayer.ctx.globalCompositeOperation = "destination-out";
351
+ trace(stroke, this.drawingLayer.ctx);
352
+ this.drawingLayer.ctx.closePath();
353
+ this.drawingLayer.ctx.fill();
354
+ this.drawingLayer.ctx.stroke();
355
+ };
356
+ Sketch.prototype.drawEraser = function (stroke, copy) {
357
+ if (copy === void 0) { copy = true; }
358
+ if (copy) {
359
+ this.drawingLayer.ctx.globalCompositeOperation = "copy";
360
+ this.drawingLayer.ctx.drawImage(this.cacheLayer.ctx.canvas, 0, 0, this.width, this.height);
361
+ }
362
+ this.drawingLayer.ctx.globalCompositeOperation = "destination-out";
363
+ trace(stroke, this.drawingLayer.ctx);
364
+ this.drawingLayer.ctx.stroke();
365
+ };
366
+ Sketch.prototype.drawEraserFillFinal = function (stroke, copy) {
367
+ if (copy === void 0) { copy = true; }
368
+ if (copy) {
369
+ this.drawingLayer.ctx.globalCompositeOperation = "copy";
370
+ this.drawingLayer.ctx.drawImage(this.cacheLayer.ctx.canvas, 0, 0, this.width, this.height);
371
+ }
372
+ this.drawingLayer.ctx.globalCompositeOperation = "destination-out";
373
+ trace(stroke, this.drawingLayer.ctx);
374
+ this.drawingLayer.ctx.closePath();
375
+ this.drawingLayer.ctx.fill();
376
+ this.drawingLayer.ctx.stroke();
377
+ };
378
+ Sketch.prototype.findBoundingBox = function (ctx) {
379
+ var imageData = ctx.getImageData(0, 0, this.width, this.height);
380
+ var box = {
381
+ topLeftX: this.width,
382
+ topLeftY: this.height,
383
+ bottomRightX: 0,
384
+ bottomRightY: 0,
385
+ width: 0,
386
+ height: 0
387
+ };
388
+ for (var x = 0; x < this.width; x += 1) {
389
+ for (var y = 0; y < this.height; y += 1) {
390
+ var pixelPosition = (((y * this.width) + x) * 4) + 3;
391
+ if (imageData.data[pixelPosition] > 0) {
392
+ if (x < box.topLeftX)
393
+ box.topLeftX = x;
394
+ if (y < box.topLeftY)
395
+ box.topLeftY = y;
396
+ if (x > box.bottomRightX)
397
+ box.bottomRightX = x;
398
+ if (y > box.bottomRightY)
399
+ box.bottomRightY = y;
400
+ }
401
+ }
402
+ }
403
+ box.width = box.bottomRightX - box.topLeftX;
404
+ box.height = box.bottomRightY - box.topLeftY;
405
+ return box;
406
+ };
407
+ Sketch.prototype.getLayerToExport = function () {
408
+ return this.templateLayer || this.drawingLayer;
409
+ };
410
+ return Sketch;
411
+ }());
412
+
413
+ module.exports = Sketch;
414
+ //# sourceMappingURL=Sketch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sketch.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,22 @@
1
+ import Sketch, { SketchProps } from "./Sketch";
2
+ import SketchCutModel from "./SketchCutModel";
3
+ import SketchLayer from "./SketchLayer";
4
+ import SketchStrokeModel from "./SketchStrokeModel";
5
+ export interface SketchCutProps extends SketchProps {
6
+ imageToCut: HTMLImageElement;
7
+ onImageCut?: () => void;
8
+ }
9
+ export default class SketchCut extends Sketch {
10
+ readonly model: SketchCutModel;
11
+ readonly imageToCut: HTMLImageElement;
12
+ cutLayer: SketchLayer;
13
+ uiLayer: SketchLayer;
14
+ onImageCut?: () => void;
15
+ constructor(props: SketchCutProps);
16
+ initDrawAnimations(): void;
17
+ drawCutStroke(stroke: any): void;
18
+ drawCutFinal(stroke: any): void;
19
+ resetCut(): void;
20
+ drawOutline(stroke: SketchStrokeModel): void;
21
+ getLayerToExport(): SketchLayer;
22
+ }