@pie-element/hotspot 11.1.1-next.0 → 11.1.1-next.101

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 (340) hide show
  1. package/CHANGELOG.json +997 -0
  2. package/CHANGELOG.md +2210 -0
  3. package/LICENSE.md +5 -0
  4. package/README.md +1 -0
  5. package/configure/CHANGELOG.json +682 -0
  6. package/configure/CHANGELOG.md +1947 -0
  7. package/configure/lib/DeleteWidget.js +64 -0
  8. package/configure/lib/DeleteWidget.js.map +1 -0
  9. package/configure/lib/button.js +42 -0
  10. package/configure/lib/button.js.map +1 -0
  11. package/configure/lib/buttons/circle.js +33 -0
  12. package/configure/lib/buttons/circle.js.map +1 -0
  13. package/configure/lib/buttons/polygon.js +39 -0
  14. package/configure/lib/buttons/polygon.js.map +1 -0
  15. package/configure/lib/buttons/rectangle.js +39 -0
  16. package/configure/lib/buttons/rectangle.js.map +1 -0
  17. package/configure/lib/defaults.js +155 -0
  18. package/configure/lib/defaults.js.map +1 -0
  19. package/configure/lib/hotspot-circle.js +192 -0
  20. package/configure/lib/hotspot-circle.js.map +1 -0
  21. package/configure/lib/hotspot-container.js +320 -0
  22. package/configure/lib/hotspot-container.js.map +1 -0
  23. package/configure/lib/hotspot-drawable.js +519 -0
  24. package/configure/lib/hotspot-drawable.js.map +1 -0
  25. package/configure/lib/hotspot-palette.js +107 -0
  26. package/configure/lib/hotspot-palette.js.map +1 -0
  27. package/configure/lib/hotspot-polygon.js +293 -0
  28. package/configure/lib/hotspot-polygon.js.map +1 -0
  29. package/configure/lib/hotspot-rectangle.js +190 -0
  30. package/configure/lib/hotspot-rectangle.js.map +1 -0
  31. package/configure/lib/icons.js +7 -0
  32. package/configure/lib/icons.js.map +1 -0
  33. package/configure/lib/image-konva.js +66 -0
  34. package/configure/lib/image-konva.js.map +1 -0
  35. package/configure/lib/index.js +198 -0
  36. package/configure/lib/index.js.map +1 -0
  37. package/configure/lib/root.js +331 -0
  38. package/configure/lib/root.js.map +1 -0
  39. package/configure/lib/shapes/circle.js +84 -0
  40. package/configure/lib/shapes/circle.js.map +1 -0
  41. package/configure/lib/shapes/index.js +50 -0
  42. package/configure/lib/shapes/index.js.map +1 -0
  43. package/configure/lib/shapes/polygon.js +82 -0
  44. package/configure/lib/shapes/polygon.js.map +1 -0
  45. package/configure/lib/shapes/rectagle.js +84 -0
  46. package/configure/lib/shapes/rectagle.js.map +1 -0
  47. package/configure/lib/shapes/utils.js +21 -0
  48. package/configure/lib/shapes/utils.js.map +1 -0
  49. package/configure/lib/upload-control.js +41 -0
  50. package/configure/lib/upload-control.js.map +1 -0
  51. package/configure/lib/utils.js +185 -0
  52. package/configure/lib/utils.js.map +1 -0
  53. package/configure/package.json +26 -0
  54. package/configure/src/DeleteWidget.jsx +51 -0
  55. package/configure/src/__tests__/DeleteWidget.test.jsx +366 -0
  56. package/configure/src/__tests__/button.test.jsx +198 -0
  57. package/configure/src/__tests__/hotspot-circle.test.jsx +259 -0
  58. package/configure/src/__tests__/hotspot-container.test.js +366 -0
  59. package/configure/src/__tests__/hotspot-drawable.test.js +271 -0
  60. package/configure/src/__tests__/hotspot-palette.test.jsx +71 -0
  61. package/configure/src/__tests__/image-konva.test.jsx +226 -0
  62. package/configure/src/__tests__/index.test.js +329 -0
  63. package/configure/src/__tests__/root.test.js +400 -0
  64. package/configure/src/__tests__/utils.test.js +241 -0
  65. package/configure/src/button.jsx +35 -0
  66. package/configure/src/buttons/circle.jsx +18 -0
  67. package/configure/src/buttons/polygon.jsx +29 -0
  68. package/configure/src/buttons/rectangle.jsx +29 -0
  69. package/configure/src/defaults.js +109 -0
  70. package/configure/src/hotspot-circle.jsx +183 -0
  71. package/configure/src/hotspot-container.jsx +330 -0
  72. package/configure/src/hotspot-drawable.jsx +527 -0
  73. package/configure/src/hotspot-palette.jsx +90 -0
  74. package/configure/src/hotspot-polygon.jsx +294 -0
  75. package/configure/src/hotspot-rectangle.jsx +169 -0
  76. package/configure/src/icons.js +5 -0
  77. package/configure/src/image-konva.jsx +63 -0
  78. package/configure/src/index.js +213 -0
  79. package/configure/src/root.jsx +342 -0
  80. package/configure/src/shapes/circle.js +81 -0
  81. package/configure/src/shapes/index.js +4 -0
  82. package/configure/src/shapes/polygon.js +81 -0
  83. package/configure/src/shapes/rectagle.js +82 -0
  84. package/configure/src/shapes/utils.js +16 -0
  85. package/configure/src/upload-control.jsx +33 -0
  86. package/configure/src/utils.js +210 -0
  87. package/controller/CHANGELOG.json +362 -0
  88. package/controller/CHANGELOG.md +1300 -0
  89. package/controller/lib/defaults.js +33 -0
  90. package/controller/lib/defaults.js.map +1 -0
  91. package/controller/lib/index.js +342 -0
  92. package/controller/lib/index.js.map +1 -0
  93. package/controller/lib/utils.js +32 -0
  94. package/controller/lib/utils.js.map +1 -0
  95. package/controller/package.json +18 -0
  96. package/controller/src/__tests__/index.test.js +419 -0
  97. package/controller/src/__tests__/utils.test.js +5 -0
  98. package/controller/src/defaults.js +19 -0
  99. package/controller/src/index.js +330 -0
  100. package/controller/src/utils.js +29 -0
  101. package/docs/config-schema.json +2023 -0
  102. package/docs/config-schema.json.md +1495 -0
  103. package/docs/demo/config.js +8 -0
  104. package/docs/demo/generate.js +122 -0
  105. package/docs/demo/index.html +1 -0
  106. package/docs/demo/session.js +11 -0
  107. package/docs/pie-schema.json +1204 -0
  108. package/docs/pie-schema.json.md +851 -0
  109. package/lib/hotspot/circle.js +160 -0
  110. package/lib/hotspot/circle.js.map +1 -0
  111. package/lib/hotspot/container.js +291 -0
  112. package/lib/hotspot/container.js.map +1 -0
  113. package/lib/hotspot/icons.js +8 -0
  114. package/lib/hotspot/icons.js.map +1 -0
  115. package/lib/hotspot/image-konva-tooltip.js +86 -0
  116. package/lib/hotspot/image-konva-tooltip.js.map +1 -0
  117. package/lib/hotspot/index.js +174 -0
  118. package/lib/hotspot/index.js.map +1 -0
  119. package/lib/hotspot/polygon.js +207 -0
  120. package/lib/hotspot/polygon.js.map +1 -0
  121. package/lib/hotspot/rectangle.js +178 -0
  122. package/lib/hotspot/rectangle.js.map +1 -0
  123. package/lib/index.js +214 -0
  124. package/lib/index.js.map +1 -0
  125. package/lib/session-updater.js +42 -0
  126. package/lib/session-updater.js.map +1 -0
  127. package/package.json +20 -58
  128. package/src/__tests__/container.test.jsx +58 -0
  129. package/src/__tests__/index.test.js +123 -0
  130. package/src/__tests__/session-updater.test.jsx +69 -0
  131. package/src/hotspot/__tests__/circle.test.jsx +464 -0
  132. package/src/hotspot/__tests__/container.test.jsx +546 -0
  133. package/src/hotspot/__tests__/image-konva-tooltip.test.jsx +510 -0
  134. package/src/hotspot/__tests__/index.test.jsx +64 -0
  135. package/src/hotspot/__tests__/polygon.test.jsx +502 -0
  136. package/src/hotspot/__tests__/rectangle.test.jsx +418 -0
  137. package/src/hotspot/circle.jsx +154 -0
  138. package/src/hotspot/container.jsx +297 -0
  139. package/src/hotspot/icons.js +7 -0
  140. package/src/hotspot/image-konva-tooltip.jsx +76 -0
  141. package/src/hotspot/index.jsx +179 -0
  142. package/src/hotspot/polygon.jsx +197 -0
  143. package/src/hotspot/rectangle.jsx +172 -0
  144. package/src/index.js +227 -0
  145. package/src/session-updater.js +29 -0
  146. package/dist/author/DeleteWidget.d.ts +0 -38
  147. package/dist/author/DeleteWidget.js +0 -46
  148. package/dist/author/button.d.ts +0 -31
  149. package/dist/author/button.js +0 -27
  150. package/dist/author/buttons/circle.d.ts +0 -18
  151. package/dist/author/buttons/circle.js +0 -25
  152. package/dist/author/buttons/polygon.d.ts +0 -18
  153. package/dist/author/buttons/polygon.js +0 -36
  154. package/dist/author/buttons/rectangle.d.ts +0 -18
  155. package/dist/author/buttons/rectangle.js +0 -36
  156. package/dist/author/defaults.d.ts +0 -157
  157. package/dist/author/defaults.js +0 -119
  158. package/dist/author/hotspot-circle.d.ts +0 -21
  159. package/dist/author/hotspot-circle.js +0 -124
  160. package/dist/author/hotspot-container.d.ts +0 -29
  161. package/dist/author/hotspot-container.js +0 -210
  162. package/dist/author/hotspot-drawable.d.ts +0 -31
  163. package/dist/author/hotspot-drawable.js +0 -312
  164. package/dist/author/hotspot-palette.d.ts +0 -14
  165. package/dist/author/hotspot-palette.js +0 -72
  166. package/dist/author/hotspot-polygon.d.ts +0 -38
  167. package/dist/author/hotspot-polygon.js +0 -200
  168. package/dist/author/hotspot-rectangle.d.ts +0 -20
  169. package/dist/author/hotspot-rectangle.js +0 -119
  170. package/dist/author/icons.d.ts +0 -9
  171. package/dist/author/icons.js +0 -4
  172. package/dist/author/image-konva.d.ts +0 -19
  173. package/dist/author/image-konva.js +0 -49
  174. package/dist/author/index.d.ts +0 -52
  175. package/dist/author/index.js +0 -143
  176. package/dist/author/root.d.ts +0 -15
  177. package/dist/author/root.js +0 -215
  178. package/dist/author/shapes/circle.d.ts +0 -18
  179. package/dist/author/shapes/circle.js +0 -47
  180. package/dist/author/shapes/index.d.ts +0 -12
  181. package/dist/author/shapes/polygon.d.ts +0 -19
  182. package/dist/author/shapes/polygon.js +0 -51
  183. package/dist/author/shapes/rectagle.d.ts +0 -18
  184. package/dist/author/shapes/rectagle.js +0 -57
  185. package/dist/author/shapes/utils.d.ts +0 -19
  186. package/dist/author/shapes/utils.js +0 -16
  187. package/dist/author/upload-control.d.ts +0 -29
  188. package/dist/author/upload-control.js +0 -28
  189. package/dist/author/utils.d.ts +0 -24
  190. package/dist/author/utils.js +0 -83
  191. package/dist/controller/defaults.d.ts +0 -35
  192. package/dist/controller/defaults.js +0 -29
  193. package/dist/controller/index.d.ts +0 -22
  194. package/dist/controller/index.js +0 -154
  195. package/dist/controller/utils.d.ts +0 -10
  196. package/dist/controller/utils.js +0 -13
  197. package/dist/delivery/hotspot/circle.d.ts +0 -19
  198. package/dist/delivery/hotspot/circle.js +0 -100
  199. package/dist/delivery/hotspot/container.d.ts +0 -16
  200. package/dist/delivery/hotspot/container.js +0 -150
  201. package/dist/delivery/hotspot/icons.d.ts +0 -10
  202. package/dist/delivery/hotspot/icons.js +0 -4
  203. package/dist/delivery/hotspot/image-konva-tooltip.d.ts +0 -19
  204. package/dist/delivery/hotspot/image-konva-tooltip.js +0 -66
  205. package/dist/delivery/hotspot/index.d.ts +0 -17
  206. package/dist/delivery/hotspot/index.js +0 -114
  207. package/dist/delivery/hotspot/polygon.d.ts +0 -21
  208. package/dist/delivery/hotspot/polygon.js +0 -108
  209. package/dist/delivery/hotspot/rectangle.d.ts +0 -19
  210. package/dist/delivery/hotspot/rectangle.js +0 -104
  211. package/dist/delivery/index.d.ts +0 -20
  212. package/dist/delivery/index.js +0 -107
  213. package/dist/delivery/session-updater.d.ts +0 -10
  214. package/dist/delivery/session-updater.js +0 -14
  215. package/dist/index.d.ts +0 -1
  216. package/dist/index.iife.d.ts +0 -8
  217. package/dist/index.iife.js +0 -169
  218. package/dist/index.js +0 -2
  219. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  220. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
  221. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
  222. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  223. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
  224. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  225. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  226. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
  227. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
  228. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  229. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
  230. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  231. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
  232. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
  233. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  234. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
  235. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
  236. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
  237. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
  238. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
  239. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
  240. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
  241. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
  242. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
  243. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  244. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  245. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  246. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
  247. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
  248. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
  249. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  250. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
  251. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  252. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  253. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
  254. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  255. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  256. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
  257. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  258. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
  259. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
  260. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
  261. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
  262. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  263. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
  264. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
  265. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
  266. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
  267. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  268. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
  269. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
  270. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
  271. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
  272. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  273. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
  274. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
  275. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
  276. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  277. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
  278. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  279. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
  280. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
  281. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  282. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  283. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
  284. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
  285. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
  286. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
  287. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
  288. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
  289. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
  290. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
  291. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  292. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
  293. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  294. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  295. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
  296. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
  297. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
  298. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
  299. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
  300. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
  301. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
  302. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
  303. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
  304. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
  305. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
  306. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
  307. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  308. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
  309. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  310. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  311. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  312. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  313. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
  314. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
  315. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
  316. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
  317. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
  318. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
  319. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
  320. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
  321. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  322. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
  323. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  324. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  325. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  326. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  327. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  328. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  329. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
  330. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  331. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  332. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
  333. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  334. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  335. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
  336. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  337. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
  338. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
  339. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
  340. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
@@ -0,0 +1,331 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = exports.Root = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _configUi = require("@pie-lib/config-ui");
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _editableHtmlTipTap = _interopRequireDefault(require("@pie-lib/editable-html-tip-tap"));
13
+ var _styles = require("@mui/material/styles");
14
+ var _Typography = _interopRequireDefault(require("@mui/material/Typography"));
15
+ var _Info = _interopRequireDefault(require("@mui/icons-material/Info"));
16
+ var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
17
+ var _hotspotPalette = _interopRequireDefault(require("./hotspot-palette"));
18
+ var _hotspotContainer = _interopRequireDefault(require("./hotspot-container"));
19
+ var _utils = require("./utils");
20
+ const {
21
+ Panel,
22
+ toggle,
23
+ dropdown
24
+ } = _configUi.settings;
25
+ const checkNullish = value => value !== null && value !== undefined;
26
+ const DimensionsContainer = (0, _styles.styled)('div')(({
27
+ theme
28
+ }) => ({
29
+ display: 'flex',
30
+ marginBottom: theme.spacing(1.5)
31
+ }));
32
+ const FieldContainer = (0, _styles.styled)('div')({
33
+ flex: 1,
34
+ width: '90%'
35
+ });
36
+ const PromptContainer = (0, _styles.styled)(_configUi.InputContainer)(({
37
+ theme
38
+ }) => ({
39
+ paddingTop: theme.spacing(1),
40
+ marginTop: theme.spacing(2),
41
+ marginBottom: theme.spacing(2),
42
+ width: '100%'
43
+ }));
44
+ const SubHeading = (0, _styles.styled)(_Typography.default)(({
45
+ theme
46
+ }) => ({
47
+ marginRight: theme.spacing(1)
48
+ }));
49
+ const FlexContainer = (0, _styles.styled)('div')({
50
+ display: 'flex',
51
+ alignItems: 'center'
52
+ });
53
+ const StyledTooltip = (0, _styles.styled)(_Tooltip.default)(({
54
+ theme
55
+ }) => ({
56
+ '& .MuiTooltip-tooltip': {
57
+ fontSize: theme.typography.fontSize - 2,
58
+ whiteSpace: 'pre',
59
+ maxWidth: '500px'
60
+ }
61
+ }));
62
+ const ErrorText = (0, _styles.styled)('div')(({
63
+ theme
64
+ }) => ({
65
+ fontSize: theme.typography.fontSize - 2,
66
+ color: theme.palette.error.main,
67
+ paddingTop: theme.spacing(1)
68
+ }));
69
+ class Root extends _react.default.Component {
70
+ constructor(...args) {
71
+ super(...args);
72
+ (0, _defineProperty2.default)(this, "handleColorChange", (fieldType, color) => {
73
+ const {
74
+ onColorChanged
75
+ } = this.props;
76
+ const cType = `${fieldType}Color`;
77
+ onColorChanged(cType, color);
78
+ });
79
+ (0, _defineProperty2.default)(this, "handleOnUpdateImageDimensions", (value, resizeType) => {
80
+ const {
81
+ model: {
82
+ dimensions,
83
+ shapes
84
+ },
85
+ configuration: {
86
+ preserveAspectRatio = {}
87
+ },
88
+ onUpdateImageDimension,
89
+ onUpdateShapes
90
+ } = this.props;
91
+ const nextImageDimensions = {
92
+ ...dimensions,
93
+ [resizeType]: value
94
+ };
95
+
96
+ // if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept
97
+ const updatedDimensions = (0, _utils.updateImageDimensions)(dimensions, nextImageDimensions, preserveAspectRatio.enabled, resizeType);
98
+ // transform shapes map into shapes array
99
+ const shapesArray = (0, _utils.getAllShapes)(shapes);
100
+ // transform all the shapes to fit the re-sized image
101
+ const updatedShapes = (0, _utils.getUpdatedShapes)(dimensions, updatedDimensions, shapesArray);
102
+ // transform shapes array back into shapes map
103
+
104
+ onUpdateShapes((0, _utils.groupShapes)(updatedShapes));
105
+ onUpdateImageDimension(updatedDimensions);
106
+ });
107
+ }
108
+ render() {
109
+ const {
110
+ configuration,
111
+ model,
112
+ imageSupport,
113
+ uploadSoundSupport,
114
+ onConfigurationChanged,
115
+ onImageUpload,
116
+ onModelChangedByConfig,
117
+ onPromptChanged,
118
+ onRationaleChanged,
119
+ onUpdateImageDimension,
120
+ onTeacherInstructionsChanged,
121
+ onUpdateShapes
122
+ } = this.props;
123
+ const {
124
+ baseInputConfiguration = {},
125
+ contentDimensions = {},
126
+ maxImageWidth = {},
127
+ maxImageHeight = {},
128
+ multipleCorrect = {},
129
+ partialScoring = {},
130
+ preserveAspectRatio = {},
131
+ prompt = {},
132
+ rationale = {},
133
+ settingsPanelDisabled,
134
+ spellCheck = {},
135
+ teacherInstructions = {},
136
+ withRubric = {},
137
+ mathMlOptions = {},
138
+ language = {},
139
+ languageChoices = {}
140
+ } = configuration || {};
141
+ const {
142
+ errors,
143
+ extraCSSRules,
144
+ promptEnabled,
145
+ rationaleEnabled,
146
+ spellCheckEnabled,
147
+ teacherInstructionsEnabled,
148
+ toolbarEditorPosition
149
+ } = model || {};
150
+ const {
151
+ prompt: promptError,
152
+ rationale: rationaleError,
153
+ shapes: shapesError,
154
+ selections: selectionsError,
155
+ teacherInstructions: teacherInstructionsError
156
+ } = errors || {};
157
+ const validationMessage = (0, _utils.generateValidationMessage)(configuration);
158
+ const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
159
+ const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
160
+ const toolbarOpts = {
161
+ position: toolbarEditorPosition === 'top' ? 'top' : 'bottom'
162
+ };
163
+ const panelSettings = {
164
+ multipleCorrect: multipleCorrect.settings && toggle(multipleCorrect.label),
165
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
166
+ promptEnabled: prompt.settings && toggle(prompt.label),
167
+ 'language.enabled': language.settings && toggle(language.label, true),
168
+ language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options)
169
+ };
170
+ const panelProperties = {
171
+ teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
172
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
173
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
174
+ rubricEnabled: withRubric?.settings && toggle(withRubric?.label)
175
+ };
176
+ const getPluginProps = (props = {}) => ({
177
+ ...baseInputConfiguration,
178
+ ...props
179
+ });
180
+ return /*#__PURE__*/_react.default.createElement(_configUi.layout.ConfigLayout, {
181
+ extraCSSRules: extraCSSRules,
182
+ dimensions: contentDimensions,
183
+ hideSettings: settingsPanelDisabled,
184
+ settings: /*#__PURE__*/_react.default.createElement(Panel, {
185
+ model: model,
186
+ onChangeModel: onModelChangedByConfig,
187
+ configuration: configuration,
188
+ onChangeConfiguration: onConfigurationChanged,
189
+ groups: {
190
+ Settings: panelSettings,
191
+ Properties: panelProperties
192
+ }
193
+ })
194
+ }, teacherInstructionsEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
195
+ label: teacherInstructions.label
196
+ }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
197
+ markup: model.teacherInstructions || '',
198
+ onChange: onTeacherInstructionsChanged,
199
+ imageSupport: imageSupport,
200
+ nonEmpty: false,
201
+ error: teacherInstructionsError,
202
+ toolbarOpts: toolbarOpts,
203
+ pluginProps: getPluginProps(teacherInstructions?.inputConfiguration),
204
+ spellCheck: spellCheckEnabled,
205
+ maxImageWidth: maxImageWidth && maxImageWidth.teacherInstructions || defaultImageMaxWidth,
206
+ maxImageHeight: maxImageHeight && maxImageHeight.teacherInstructions || defaultImageMaxHeight,
207
+ uploadSoundSupport: uploadSoundSupport,
208
+ languageCharactersProps: [{
209
+ language: 'spanish'
210
+ }, {
211
+ language: 'special'
212
+ }],
213
+ mathMlOptions: mathMlOptions
214
+ }), teacherInstructionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, teacherInstructionsError)), promptEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
215
+ label: prompt.label
216
+ }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
217
+ markup: model.prompt || '',
218
+ onChange: onPromptChanged,
219
+ imageSupport: imageSupport,
220
+ nonEmpty: false,
221
+ error: promptError,
222
+ toolbarOpts: toolbarOpts,
223
+ pluginProps: getPluginProps(prompt?.inputConfiguration),
224
+ spellCheck: spellCheckEnabled,
225
+ maxImageWidth: defaultImageMaxWidth,
226
+ maxImageHeight: defaultImageMaxHeight,
227
+ uploadSoundSupport: uploadSoundSupport,
228
+ languageCharactersProps: [{
229
+ language: 'spanish'
230
+ }, {
231
+ language: 'special'
232
+ }],
233
+ mathMlOptions: mathMlOptions
234
+ }), promptError && /*#__PURE__*/_react.default.createElement(ErrorText, null, promptError)), /*#__PURE__*/_react.default.createElement(FlexContainer, null, /*#__PURE__*/_react.default.createElement(SubHeading, {
235
+ variant: "h6"
236
+ }, "Define Hotspot"), /*#__PURE__*/_react.default.createElement(StyledTooltip, {
237
+ disableFocusListener: true,
238
+ disableTouchListener: true,
239
+ placement: 'left',
240
+ title: validationMessage
241
+ }, /*#__PURE__*/_react.default.createElement(_Info.default, {
242
+ fontSize: 'small',
243
+ color: 'primary',
244
+ style: {
245
+ float: 'right'
246
+ }
247
+ }))), /*#__PURE__*/_react.default.createElement(_hotspotPalette.default, {
248
+ hotspotColor: model.hotspotColor,
249
+ hotspotList: model.hotspotList,
250
+ outlineColor: model.outlineColor,
251
+ outlineList: model.outlineList,
252
+ onHotspotColorChange: color => this.handleColorChange('hotspot', color),
253
+ onOutlineColorChange: color => this.handleColorChange('outline', color)
254
+ }), /*#__PURE__*/_react.default.createElement(_hotspotContainer.default, {
255
+ dimensions: model.dimensions,
256
+ imageUrl: model.imageUrl,
257
+ multipleCorrect: model.multipleCorrect,
258
+ hasErrors: !!shapesError || !!selectionsError,
259
+ hotspotColor: model.hotspotColor,
260
+ outlineColor: model.outlineColor,
261
+ selectedHotspotColor: model.selectedHotspotColor,
262
+ hoverOutlineColor: checkNullish(model.hoverOutlineColor) ? model.hoverOutlineColor : 'black',
263
+ onUpdateImageDimension: onUpdateImageDimension,
264
+ onUpdateShapes: onUpdateShapes,
265
+ onImageUpload: onImageUpload,
266
+ shapes: model.shapes,
267
+ strokeWidth: model.strokeWidth,
268
+ preserveAspectRatioEnabled: preserveAspectRatio.enabled,
269
+ insertImage: imageSupport && imageSupport.add
270
+ }), shapesError && /*#__PURE__*/_react.default.createElement(ErrorText, null, shapesError), selectionsError && /*#__PURE__*/_react.default.createElement(ErrorText, null, selectionsError), model.imageUrl && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
271
+ variant: "h6"
272
+ }, "Image Dimensions"), /*#__PURE__*/_react.default.createElement(DimensionsContainer, null, /*#__PURE__*/_react.default.createElement(FieldContainer, null, /*#__PURE__*/_react.default.createElement(_configUi.NumberTextField, {
273
+ key: "hotspot-manual-width",
274
+ label: "Width",
275
+ value: model.dimensions.width,
276
+ min: 0,
277
+ onChange: (e, value) => this.handleOnUpdateImageDimensions(value, 'width'),
278
+ showErrorWhenOutsideRange: true
279
+ })), /*#__PURE__*/_react.default.createElement(FieldContainer, null, /*#__PURE__*/_react.default.createElement(_configUi.NumberTextField, {
280
+ key: "hotspot-manual-height",
281
+ label: "Height",
282
+ value: model.dimensions.height,
283
+ min: 0,
284
+ onChange: (e, value) => this.handleOnUpdateImageDimensions(value, 'height'),
285
+ showErrorWhenOutsideRange: true
286
+ })))), rationaleEnabled && /*#__PURE__*/_react.default.createElement(PromptContainer, {
287
+ label: rationale.label
288
+ }, /*#__PURE__*/_react.default.createElement(_editableHtmlTipTap.default, {
289
+ markup: model.rationale || '',
290
+ onChange: onRationaleChanged,
291
+ imageSupport: imageSupport,
292
+ error: rationaleError,
293
+ toolbarOpts: toolbarOpts,
294
+ pluginProps: getPluginProps(rationale?.inputConfiguration),
295
+ spellCheck: spellCheckEnabled,
296
+ maxImageWidth: maxImageWidth && maxImageWidth.rationale || defaultImageMaxWidth,
297
+ maxImageHeight: maxImageHeight && maxImageHeight.rationale || defaultImageMaxHeight,
298
+ uploadSoundSupport: uploadSoundSupport,
299
+ languageCharactersProps: [{
300
+ language: 'spanish'
301
+ }, {
302
+ language: 'special'
303
+ }],
304
+ mathMlOptions: mathMlOptions
305
+ }), rationaleError && /*#__PURE__*/_react.default.createElement(ErrorText, null, rationaleError)));
306
+ }
307
+ }
308
+ exports.Root = Root;
309
+ Root.propTypes = {
310
+ configuration: _propTypes.default.object,
311
+ model: _propTypes.default.object.isRequired,
312
+ imageSupport: _propTypes.default.shape({
313
+ add: _propTypes.default.func,
314
+ delete: _propTypes.default.func
315
+ }),
316
+ uploadSoundSupport: _propTypes.default.shape({
317
+ add: _propTypes.default.func,
318
+ delete: _propTypes.default.func
319
+ }),
320
+ onImageUpload: _propTypes.default.func.isRequired,
321
+ onColorChanged: _propTypes.default.func.isRequired,
322
+ onPromptChanged: _propTypes.default.func.isRequired,
323
+ onUpdateImageDimension: _propTypes.default.func.isRequired,
324
+ onUpdateShapes: _propTypes.default.func.isRequired,
325
+ onModelChangedByConfig: _propTypes.default.func.isRequired,
326
+ onRationaleChanged: _propTypes.default.func.isRequired,
327
+ onConfigurationChanged: _propTypes.default.func.isRequired,
328
+ onTeacherInstructionsChanged: _propTypes.default.func.isRequired
329
+ };
330
+ var _default = exports.default = Root;
331
+ //# sourceMappingURL=root.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root.js","names":["_react","_interopRequireDefault","require","_configUi","_propTypes","_editableHtmlTipTap","_styles","_Typography","_Info","_Tooltip","_hotspotPalette","_hotspotContainer","_utils","Panel","toggle","dropdown","settings","checkNullish","value","undefined","DimensionsContainer","styled","theme","display","marginBottom","spacing","FieldContainer","flex","width","PromptContainer","InputContainer","paddingTop","marginTop","SubHeading","Typography","marginRight","FlexContainer","alignItems","StyledTooltip","Tooltip","fontSize","typography","whiteSpace","maxWidth","ErrorText","color","palette","error","main","Root","React","Component","constructor","args","_defineProperty2","default","fieldType","onColorChanged","props","cType","resizeType","model","dimensions","shapes","configuration","preserveAspectRatio","onUpdateImageDimension","onUpdateShapes","nextImageDimensions","updatedDimensions","updateImageDimensions","enabled","shapesArray","getAllShapes","updatedShapes","getUpdatedShapes","groupShapes","render","imageSupport","uploadSoundSupport","onConfigurationChanged","onImageUpload","onModelChangedByConfig","onPromptChanged","onRationaleChanged","onTeacherInstructionsChanged","baseInputConfiguration","contentDimensions","maxImageWidth","maxImageHeight","multipleCorrect","partialScoring","prompt","rationale","settingsPanelDisabled","spellCheck","teacherInstructions","withRubric","mathMlOptions","language","languageChoices","errors","extraCSSRules","promptEnabled","rationaleEnabled","spellCheckEnabled","teacherInstructionsEnabled","toolbarEditorPosition","promptError","rationaleError","shapesError","selections","selectionsError","teacherInstructionsError","validationMessage","generateValidationMessage","defaultImageMaxWidth","defaultImageMaxHeight","toolbarOpts","position","panelSettings","label","options","panelProperties","rubricEnabled","getPluginProps","createElement","layout","ConfigLayout","hideSettings","onChangeModel","onChangeConfiguration","groups","Settings","Properties","markup","onChange","nonEmpty","pluginProps","inputConfiguration","languageCharactersProps","variant","disableFocusListener","disableTouchListener","placement","title","style","float","hotspotColor","hotspotList","outlineColor","outlineList","onHotspotColorChange","handleColorChange","onOutlineColorChange","imageUrl","hasErrors","selectedHotspotColor","hoverOutlineColor","strokeWidth","preserveAspectRatioEnabled","insertImage","add","Fragment","NumberTextField","key","min","e","handleOnUpdateImageDimensions","showErrorWhenOutsideRange","height","exports","propTypes","PropTypes","object","isRequired","shape","func","delete","_default"],"sources":["../src/root.jsx"],"sourcesContent":["import React from 'react';\nimport { settings, layout, InputContainer, NumberTextField } from '@pie-lib/config-ui';\nimport PropTypes from 'prop-types';\nimport EditableHtml from '@pie-lib/editable-html-tip-tap';\nimport { styled } from '@mui/material/styles';\nimport Typography from '@mui/material/Typography';\nimport Info from '@mui/icons-material/Info';\nimport Tooltip from '@mui/material/Tooltip';\nimport HotspotPalette from './hotspot-palette';\nimport HotspotContainer from './hotspot-container';\nimport { updateImageDimensions, generateValidationMessage, getUpdatedShapes, getAllShapes, groupShapes } from './utils';\n\nconst { Panel, toggle, dropdown } = settings;\n\nconst checkNullish = (value) => value !== null && value !== undefined;\n\nconst DimensionsContainer = styled('div')(({ theme }) => ({\n display: 'flex',\n marginBottom: theme.spacing(1.5),\n}));\n\nconst FieldContainer = styled('div')({\n flex: 1,\n width: '90%',\n});\n\nconst PromptContainer = styled(InputContainer)(({ theme }) => ({\n paddingTop: theme.spacing(1),\n marginTop: theme.spacing(2),\n marginBottom: theme.spacing(2),\n width: '100%',\n}));\n\nconst SubHeading = styled(Typography)(({ theme }) => ({\n marginRight: theme.spacing(1),\n}));\n\nconst FlexContainer = styled('div')({\n display: 'flex',\n alignItems: 'center',\n});\n\nconst StyledTooltip = styled(Tooltip)(({ theme }) => ({\n '& .MuiTooltip-tooltip': {\n fontSize: theme.typography.fontSize - 2,\n whiteSpace: 'pre',\n maxWidth: '500px',\n },\n}));\n\nconst ErrorText = styled('div')(({ theme }) => ({\n fontSize: theme.typography.fontSize - 2,\n color: theme.palette.error.main,\n paddingTop: theme.spacing(1),\n}));\n\nexport class Root extends React.Component {\n handleColorChange = (fieldType, color) => {\n const { onColorChanged } = this.props;\n const cType = `${fieldType}Color`;\n\n onColorChanged(cType, color);\n };\n\n handleOnUpdateImageDimensions = (value, resizeType) => {\n const {\n model: { dimensions, shapes },\n configuration: { preserveAspectRatio = {} },\n onUpdateImageDimension,\n onUpdateShapes,\n } = this.props;\n\n const nextImageDimensions = { ...dimensions, [resizeType]: value };\n\n // if preserveAspectRatio.enabled, updateImageDimensions function makes sure aspect ratio is kept\n const updatedDimensions = updateImageDimensions(\n dimensions,\n nextImageDimensions,\n preserveAspectRatio.enabled,\n resizeType,\n );\n // transform shapes map into shapes array\n const shapesArray = getAllShapes(shapes);\n // transform all the shapes to fit the re-sized image\n const updatedShapes = getUpdatedShapes(dimensions, updatedDimensions, shapesArray);\n // transform shapes array back into shapes map\n\n onUpdateShapes(groupShapes(updatedShapes));\n onUpdateImageDimension(updatedDimensions);\n };\n\n render() {\n const {\n configuration,\n model,\n imageSupport,\n uploadSoundSupport,\n onConfigurationChanged,\n onImageUpload,\n onModelChangedByConfig,\n onPromptChanged,\n onRationaleChanged,\n onUpdateImageDimension,\n onTeacherInstructionsChanged,\n onUpdateShapes,\n } = this.props;\n const {\n baseInputConfiguration = {},\n contentDimensions = {},\n maxImageWidth = {},\n maxImageHeight = {},\n multipleCorrect = {},\n partialScoring = {},\n preserveAspectRatio = {},\n prompt = {},\n rationale = {},\n settingsPanelDisabled,\n spellCheck = {},\n teacherInstructions = {},\n withRubric = {},\n mathMlOptions = {},\n language = {},\n languageChoices = {},\n } = configuration || {};\n const {\n errors,\n extraCSSRules,\n promptEnabled,\n rationaleEnabled,\n spellCheckEnabled,\n teacherInstructionsEnabled,\n toolbarEditorPosition,\n } = model || {};\n const {\n prompt: promptError,\n rationale: rationaleError,\n shapes: shapesError,\n selections: selectionsError,\n teacherInstructions: teacherInstructionsError,\n } = errors || {};\n const validationMessage = generateValidationMessage(configuration);\n\n const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;\n const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;\n\n const toolbarOpts = {\n position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',\n };\n\n const panelSettings = {\n multipleCorrect: multipleCorrect.settings && toggle(multipleCorrect.label),\n partialScoring: partialScoring.settings && toggle(partialScoring.label),\n promptEnabled: prompt.settings && toggle(prompt.label),\n 'language.enabled': language.settings && toggle(language.label, true),\n language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),\n };\n const panelProperties = {\n teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),\n rationaleEnabled: rationale.settings && toggle(rationale.label),\n spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),\n rubricEnabled: withRubric?.settings && toggle(withRubric?.label),\n };\n\n const getPluginProps = (props = {}) => ({\n ...baseInputConfiguration,\n ...props,\n });\n\n\n return (\n <layout.ConfigLayout\n extraCSSRules={extraCSSRules}\n dimensions={contentDimensions}\n hideSettings={settingsPanelDisabled}\n settings={\n <Panel\n model={model}\n onChangeModel={onModelChangedByConfig}\n configuration={configuration}\n onChangeConfiguration={onConfigurationChanged}\n groups={{\n Settings: panelSettings,\n Properties: panelProperties,\n }}\n />\n }\n >\n {teacherInstructionsEnabled && (\n <PromptContainer label={teacherInstructions.label}>\n <EditableHtml\n markup={model.teacherInstructions || ''}\n onChange={onTeacherInstructionsChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={teacherInstructionsError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(teacherInstructions?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}\n </PromptContainer>\n )}\n\n {promptEnabled && (\n <PromptContainer label={prompt.label}>\n <EditableHtml\n markup={model.prompt || ''}\n onChange={onPromptChanged}\n imageSupport={imageSupport}\n nonEmpty={false}\n error={promptError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(prompt?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={defaultImageMaxWidth}\n maxImageHeight={defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {promptError && <ErrorText>{promptError}</ErrorText>}\n </PromptContainer>\n )}\n\n <FlexContainer>\n <SubHeading variant=\"h6\">Define Hotspot</SubHeading>\n <StyledTooltip disableFocusListener disableTouchListener placement={'left'} title={validationMessage}>\n <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }} />\n </StyledTooltip>\n </FlexContainer>\n\n <HotspotPalette\n hotspotColor={model.hotspotColor}\n hotspotList={model.hotspotList}\n outlineColor={model.outlineColor}\n outlineList={model.outlineList}\n onHotspotColorChange={(color) => this.handleColorChange('hotspot', color)}\n onOutlineColorChange={(color) => this.handleColorChange('outline', color)}\n />\n\n <HotspotContainer\n dimensions={model.dimensions}\n imageUrl={model.imageUrl}\n multipleCorrect={model.multipleCorrect}\n hasErrors={!!shapesError || !!selectionsError}\n hotspotColor={model.hotspotColor}\n outlineColor={model.outlineColor}\n selectedHotspotColor={model.selectedHotspotColor}\n hoverOutlineColor={checkNullish(model.hoverOutlineColor) ? model.hoverOutlineColor : 'black'}\n onUpdateImageDimension={onUpdateImageDimension}\n onUpdateShapes={onUpdateShapes}\n onImageUpload={onImageUpload}\n shapes={model.shapes}\n strokeWidth={model.strokeWidth}\n preserveAspectRatioEnabled={preserveAspectRatio.enabled}\n insertImage={imageSupport && imageSupport.add}\n />\n {shapesError && <ErrorText>{shapesError}</ErrorText>}\n {selectionsError && <ErrorText>{selectionsError}</ErrorText>}\n\n {model.imageUrl && (\n <React.Fragment>\n <Typography variant=\"h6\">Image Dimensions</Typography>\n\n <DimensionsContainer>\n <FieldContainer>\n <NumberTextField\n key=\"hotspot-manual-width\"\n label=\"Width\"\n value={model.dimensions.width}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}\n showErrorWhenOutsideRange\n />\n </FieldContainer>\n\n <FieldContainer>\n <NumberTextField\n key=\"hotspot-manual-height\"\n label=\"Height\"\n value={model.dimensions.height}\n min={0}\n onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}\n showErrorWhenOutsideRange\n />\n </FieldContainer>\n </DimensionsContainer>\n </React.Fragment>\n )}\n\n {rationaleEnabled && (\n <PromptContainer label={rationale.label}>\n <EditableHtml\n markup={model.rationale || ''}\n onChange={onRationaleChanged}\n imageSupport={imageSupport}\n error={rationaleError}\n toolbarOpts={toolbarOpts}\n pluginProps={getPluginProps(rationale?.inputConfiguration)}\n spellCheck={spellCheckEnabled}\n maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}\n maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}\n uploadSoundSupport={uploadSoundSupport}\n languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}\n mathMlOptions={mathMlOptions}\n />\n {rationaleError && <ErrorText>{rationaleError}</ErrorText>}\n </PromptContainer>\n )}\n </layout.ConfigLayout>\n );\n }\n}\n\nRoot.propTypes = {\n configuration: PropTypes.object,\n model: PropTypes.object.isRequired,\n imageSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n uploadSoundSupport: PropTypes.shape({\n add: PropTypes.func,\n delete: PropTypes.func,\n }),\n onImageUpload: PropTypes.func.isRequired,\n onColorChanged: PropTypes.func.isRequired,\n onPromptChanged: PropTypes.func.isRequired,\n onUpdateImageDimension: PropTypes.func.isRequired,\n onUpdateShapes: PropTypes.func.isRequired,\n onModelChangedByConfig: PropTypes.func.isRequired,\n onRationaleChanged: PropTypes.func.isRequired,\n onConfigurationChanged: PropTypes.func.isRequired,\n onTeacherInstructionsChanged: PropTypes.func.isRequired,\n};\n\nexport default Root;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,eAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AAEA,MAAM;EAAEW,KAAK;EAAEC,MAAM;EAAEC;AAAS,CAAC,GAAGC,kBAAQ;AAE5C,MAAMC,YAAY,GAAIC,KAAK,IAAKA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKC,SAAS;AAErE,MAAMC,mBAAmB,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACxDC,OAA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AC;EAE1B;AACF;AAAC8D,OAAA,CAAA1H,IAAA,GAAAA,IAAA;AAEDA,IAAI,CAAC2H,SAAS,GAAG;EACf5G,aAAa,EAAE6G,kBAAS,CAACC,MAAM;EAC/BjH,KAAK,EAAEgH,kBAAS,CAACC,MAAM,CAACC,UAAU;EAClCjG,YAAY,EAAE+F,kBAAS,CAACG,KAAK,CAAC;IAC5Bd,GAAG,EAAEW,kBAAS,CAACI,IAAI;IACnBC,MAAM,EAAEL,kBAAS,CAACI;EACpB,CAAC,CAAC;EACFlG,kBAAkB,EAAE8F,kBAAS,CAACG,KAAK,CAAC;IAClCd,GAAG,EAAEW,kBAAS,CAACI,IAAI;IACnBC,MAAM,EAAEL,kBAAS,CAACI;EACpB,CAAC,CAAC;EACFhG,aAAa,EAAE4F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACxCtH,cAAc,EAAEoH,kBAAS,CAACI,IAAI,CAACF,UAAU;EACzC5F,eAAe,EAAE0F,kBAAS,CAACI,IAAI,CAACF,UAAU;EAC1C7G,sBAAsB,EAAE2G,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD5G,cAAc,EAAE0G,kBAAS,CAACI,IAAI,CAACF,UAAU;EACzC7F,sBAAsB,EAAE2F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD3F,kBAAkB,EAAEyF,kBAAS,CAACI,IAAI,CAACF,UAAU;EAC7C/F,sBAAsB,EAAE6F,kBAAS,CAACI,IAAI,CAACF,UAAU;EACjD1F,4BAA4B,EAAEwF,kBAAS,CAACI,IAAI,CAACF;AAC/C,CAAC;AAAC,IAAAI,QAAA,GAAAR,OAAA,CAAApH,OAAA,GAEaN,IAAI","ignoreList":[]}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.CircleShape = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ class CircleShape {
10
+ static create(shapes, e) {
11
+ const newShapes = [...shapes];
12
+ const highestId = Math.max(...newShapes.map(shape => parseInt(shape.id)), 0);
13
+ const newCircle = {
14
+ id: `${highestId + 1}`,
15
+ radius: 0,
16
+ x: e.evt.layerX,
17
+ y: e.evt.layerY,
18
+ group: 'circles',
19
+ index: newShapes.length
20
+ };
21
+ newShapes.push(newCircle);
22
+ return {
23
+ shapes: newShapes,
24
+ isDrawing: true,
25
+ isDrawingShapeId: newCircle.id
26
+ };
27
+ }
28
+ static finalizeCreation(state, props) {
29
+ const currentShapeIndex = state.shapes.findIndex(shape => shape.id === state.isDrawingShapeId);
30
+ if (currentShapeIndex !== -1) {
31
+ const currentShape = state.shapes[currentShapeIndex];
32
+
33
+ // Check if the shape is a valid circle (has more than 0 radius) before finalizing
34
+ if (currentShape.radius > 0) {
35
+ return {
36
+ ...state,
37
+ isDrawing: false,
38
+ stateShapes: false,
39
+ isDrawingShapeId: undefined
40
+ };
41
+ } else {
42
+ return {
43
+ ...state,
44
+ isDrawing: false,
45
+ stateShapes: false,
46
+ isDrawingShapeId: undefined,
47
+ shapes: state.shapes.filter(shape => shape.id !== state.isDrawingShapeId)
48
+ };
49
+ }
50
+ }
51
+ return {
52
+ ...state,
53
+ isDrawing: false,
54
+ stateShapes: false,
55
+ isDrawingShapeId: undefined
56
+ };
57
+ }
58
+ static handleMouseMove(state, e) {
59
+ const {
60
+ isDrawing,
61
+ isDrawingShapeId,
62
+ shapes
63
+ } = state;
64
+ if (isDrawing) {
65
+ const tempShapes = [...shapes];
66
+ const resizingShapeIndex = tempShapes.findIndex(shape => shape.id === isDrawingShapeId);
67
+ if (resizingShapeIndex !== -1) {
68
+ const resizingShape = tempShapes[resizingShapeIndex];
69
+
70
+ // Calculate radius based on mouse position
71
+ const dx = e.evt.layerX - resizingShape.x;
72
+ const dy = e.evt.layerY - resizingShape.y;
73
+ resizingShape.radius = Math.sqrt(dx * dx + dy * dy);
74
+ return {
75
+ shapes: tempShapes
76
+ };
77
+ }
78
+ }
79
+ return state;
80
+ }
81
+ }
82
+ exports.CircleShape = CircleShape;
83
+ (0, _defineProperty2.default)(CircleShape, "name", 'circle');
84
+ //# sourceMappingURL=circle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circle.js","names":["CircleShape","create","shapes","e","newShapes","highestId","Math","max","map","shape","parseInt","id","newCircle","radius","x","evt","layerX","y","layerY","group","index","length","push","isDrawing","isDrawingShapeId","finalizeCreation","state","props","currentShapeIndex","findIndex","currentShape","stateShapes","undefined","filter","handleMouseMove","tempShapes","resizingShapeIndex","resizingShape","dx","dy","sqrt","exports","_defineProperty2","default"],"sources":["../../src/shapes/circle.js"],"sourcesContent":["export class CircleShape {\n static name = 'circle'\n\n static create(shapes, e) {\n const newShapes = [...shapes];\n const highestId = Math.max(...newShapes.map((shape) => parseInt(shape.id)), 0);\n const newCircle = {\n id: `${highestId + 1}`,\n radius: 0,\n x: e.evt.layerX,\n y: e.evt.layerY,\n group: 'circles',\n index: newShapes.length,\n };\n\n newShapes.push(newCircle);\n\n return {\n shapes: newShapes,\n isDrawing: true,\n isDrawingShapeId: newCircle.id,\n };\n }\n\n static finalizeCreation(state, props) {\n const currentShapeIndex = state.shapes.findIndex((shape) => shape.id === state.isDrawingShapeId);\n\n if (currentShapeIndex !== -1) {\n const currentShape = state.shapes[currentShapeIndex];\n\n // Check if the shape is a valid circle (has more than 0 radius) before finalizing\n if (currentShape.radius > 0) {\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n };\n } else {\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n shapes: state.shapes.filter((shape) => shape.id !== state.isDrawingShapeId),\n };\n }\n }\n\n return {\n ...state,\n isDrawing: false,\n stateShapes: false,\n isDrawingShapeId: undefined,\n };\n }\n\n static handleMouseMove(state, e) {\n const { isDrawing, isDrawingShapeId, shapes } = state;\n\n if (isDrawing) {\n const tempShapes = [...shapes];\n const resizingShapeIndex = tempShapes.findIndex((shape) => shape.id === isDrawingShapeId);\n\n if (resizingShapeIndex !== -1) {\n const resizingShape = tempShapes[resizingShapeIndex];\n\n // Calculate radius based on mouse position\n const dx = e.evt.layerX - resizingShape.x;\n const dy = e.evt.layerY - resizingShape.y;\n resizingShape.radius = Math.sqrt(dx * dx + dy * dy);\n\n return {\n shapes: tempShapes,\n };\n }\n }\n\n return state;\n }\n}\n"],"mappings":";;;;;;;;AAAO,MAAMA,WAAW,CAAC;EAGvB,OAAOC,MAAMA,CAACC,MAAM,EAAEC,CAAC,EAAE;IACvB,MAAMC,SAAS,GAAG,CAAC,GAAGF,MAAM,CAAC;IAC7B,MAAMG,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,GAAGH,SAAS,CAACI,GAAG,CAAEC,KAAK,IAAKC,QAAQ,CAACD,KAAK,CAACE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9E,MAAMC,SAAS,GAAG;MAChBD,EAAE,EAAE,GAAGN,SAAS,GAAG,CAAC,EAAE;MACtBQ,MAAM,EAAE,CAAC;MACTC,CAAC,EAAEX,CAAC,CAACY,GAAG,CAACC,MAAM;MACfC,CAAC,EAAEd,CAAC,CAACY,GAAG,CAACG,MAAM;MACfC,KAAK,EAAE,SAAS;MAChBC,KAAK,EAAEhB,SAAS,CAACiB;IACnB,CAAC;IAEDjB,SAAS,CAACkB,IAAI,CAACV,SAAS,CAAC;IAEzB,OAAO;MACLV,MAAM,EAAEE,SAAS;MACjBmB,SAAS,EAAE,IAAI;MACfC,gBAAgB,EAAEZ,SAAS,CAACD;IAC9B,CAAC;EACH;EAEA,OAAOc,gBAAgBA,CAACC,KAAK,EAAEC,KAAK,EAAE;IACpC,MAAMC,iBAAiB,GAAGF,KAAK,CAACxB,MAAM,CAAC2B,SAAS,CAAEpB,KAAK,IAAKA,KAAK,CAACE,EAAE,KAAKe,KAAK,CAACF,gBAAgB,CAAC;IA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Y,GAAG,CAACG,MAAM,GAAGmB,aAAa,CAACpB,CAAC;QACzCoB,aAAa,CAACxB,MAAM,GAAGP,IAAI,CAACkC,IAAI,CAACF,EAAE,GAAGA,EAAE,GAAGC,EAAE,GAAGA,EAAE,CAAC;QAEnD,OAAO;UACLrC,MAAM,EAAEiC;QACV,CAAC;MACH;IACF;IAEA,OAAOT,KAAK;EACd;AACF;AAACe,OAAA,CAAAzC,WAAA,GAAAA,WAAA;AAAA,IAAA0C,gBAAA,CAAAC,OAAA,EAhFY3C,WAAW,UACR,QAAQ","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _circle = require("./circle");
7
+ Object.keys(_circle).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _circle[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _circle[key];
14
+ }
15
+ });
16
+ });
17
+ var _rectagle = require("./rectagle");
18
+ Object.keys(_rectagle).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _rectagle[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _rectagle[key];
25
+ }
26
+ });
27
+ });
28
+ var _polygon = require("./polygon");
29
+ Object.keys(_polygon).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _polygon[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _polygon[key];
36
+ }
37
+ });
38
+ });
39
+ var _utils = require("./utils");
40
+ Object.keys(_utils).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _utils[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _utils[key];
47
+ }
48
+ });
49
+ });
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_circle","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_rectagle","_polygon","_utils"],"sources":["../../src/shapes/index.js"],"sourcesContent":["export * from './circle';\nexport * from './rectagle';\nexport * from './polygon';\nexport * from './utils';\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,SAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,SAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,SAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,SAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,QAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,QAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,QAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,QAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,MAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,MAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,MAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,MAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.PolygonShape = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ class PolygonShape {
10
+ static create(shapes, e) {
11
+ const newShapes = [...shapes];
12
+ const newPolygon = {
13
+ id: 'newPolygon',
14
+ points: [{
15
+ x: e.evt.layerX,
16
+ y: e.evt.layerY
17
+ }],
18
+ group: 'polygons',
19
+ index: newShapes.length
20
+ };
21
+ newShapes.push(newPolygon);
22
+ return {
23
+ shapes: newShapes,
24
+ isDrawing: true,
25
+ isDrawingShapeId: newPolygon.id
26
+ };
27
+ }
28
+ static addPoint(state, e, onPolygonComplete) {
29
+ // Number of pixels allowed to determine if the first point was clicked
30
+ const clickDelta = 5;
31
+ const shapesCopy = JSON.parse(JSON.stringify(state.shapes));
32
+ const currentShapeIndex = shapesCopy.findIndex(shape => shape.id === state.isDrawingShapeId);
33
+ if (currentShapeIndex !== -1) {
34
+ const currentShape = shapesCopy[currentShapeIndex];
35
+ if (currentShape.points && Array.isArray(currentShape.points)) {
36
+ const firstPoint = currentShape.points[0];
37
+
38
+ // If click is close enough to the first point (within clickDelta pixels), close the polygon
39
+ if (Math.abs(firstPoint.x - e.evt.layerX) <= clickDelta && Math.abs(firstPoint.y - e.evt.layerY) <= clickDelta) {
40
+ return PolygonShape.finalizeCreation(state, onPolygonComplete);
41
+ }
42
+ currentShape.points.push({
43
+ x: e.evt.layerX,
44
+ y: e.evt.layerY
45
+ });
46
+ shapesCopy[currentShapeIndex] = currentShape;
47
+ return {
48
+ shapes: shapesCopy
49
+ };
50
+ }
51
+ }
52
+ return state;
53
+ }
54
+ static finalizeCreation(state, onPolygonComplete) {
55
+ const {
56
+ shapes
57
+ } = state;
58
+ const tempShapes = [...shapes];
59
+ const highestId = Math.max(...state.shapes.map(shape => parseInt(shape.id) || 0), 0);
60
+ const polygonIndex = tempShapes.findIndex(shape => shape.id === state.isDrawingShapeId);
61
+ if (polygonIndex !== -1 && tempShapes[polygonIndex].points.length > 2) {
62
+ const completedPolygon = tempShapes[polygonIndex];
63
+ completedPolygon.id = `${highestId + 1}`;
64
+ onPolygonComplete(tempShapes);
65
+ return {
66
+ isDrawing: false,
67
+ shapes: tempShapes,
68
+ isDrawingShapeId: undefined
69
+ };
70
+ }
71
+ return state;
72
+ }
73
+
74
+ // No need to update anything on mouse move,
75
+ // but it's here if we need to add any logic later.
76
+ static handleMouseMove(state, e) {
77
+ return state;
78
+ }
79
+ }
80
+ exports.PolygonShape = PolygonShape;
81
+ (0, _defineProperty2.default)(PolygonShape, "name", 'polygon');
82
+ //# sourceMappingURL=polygon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polygon.js","names":["PolygonShape","create","shapes","e","newShapes","newPolygon","id","points","x","evt","layerX","y","layerY","group","index","length","push","isDrawing","isDrawingShapeId","addPoint","state","onPolygonComplete","clickDelta","shapesCopy","JSON","parse","stringify","currentShapeIndex","findIndex","shape","currentShape","Array","isArray","firstPoint","Math","abs","finalizeCreation","tempShapes","highestId","max","map","parseInt","polygonIndex","completedPolygon","undefined","handleMouseMove","exports","_defineProperty2","default"],"sources":["../../src/shapes/polygon.js"],"sourcesContent":["export class PolygonShape {\n static name = 'polygon'\n\n static create(shapes, e) {\n const newShapes = [...shapes];\n const newPolygon = {\n id: 'newPolygon',\n points: [{ x: e.evt.layerX, y: e.evt.layerY }],\n group: 'polygons',\n index: newShapes.length,\n };\n\n newShapes.push(newPolygon);\n\n return {\n shapes: newShapes,\n isDrawing: true,\n isDrawingShapeId: newPolygon.id,\n };\n }\n\n static addPoint(state, e, onPolygonComplete) {\n // Number of pixels allowed to determine if the first point was clicked\n const clickDelta = 5;\n\n const shapesCopy = JSON.parse(JSON.stringify(state.shapes));\n const currentShapeIndex = shapesCopy.findIndex((shape) => shape.id === state.isDrawingShapeId);\n\n if (currentShapeIndex !== -1) {\n const currentShape = shapesCopy[currentShapeIndex];\n if (currentShape.points && Array.isArray(currentShape.points)) {\n const firstPoint = currentShape.points[0];\n\n // If click is close enough to the first point (within clickDelta pixels), close the polygon\n if (\n Math.abs(firstPoint.x - e.evt.layerX) <= clickDelta &&\n Math.abs(firstPoint.y - e.evt.layerY) <= clickDelta\n ) {\n return PolygonShape.finalizeCreation(state, onPolygonComplete);\n }\n\n currentShape.points.push({ x: e.evt.layerX, y: e.evt.layerY });\n shapesCopy[currentShapeIndex] = currentShape;\n\n return {\n shapes: shapesCopy,\n };\n }\n }\n return state;\n }\n\n static finalizeCreation(state, onPolygonComplete) {\n const { shapes } = state;\n const tempShapes = [...shapes];\n const highestId = Math.max(...state.shapes.map((shape) => parseInt(shape.id) || 0), 0);\n\n const polygonIndex = tempShapes.findIndex((shape) => shape.id === state.isDrawingShapeId);\n\n if (polygonIndex !== -1 && tempShapes[polygonIndex].points.length > 2) {\n const completedPolygon = tempShapes[polygonIndex];\n\n completedPolygon.id = `${highestId + 1}`;\n onPolygonComplete(tempShapes);\n\n return {\n isDrawing: false,\n shapes: tempShapes,\n isDrawingShapeId: undefined,\n };\n }\n\n return state;\n }\n\n // No need to update anything on mouse move,\n // but it's here if we need to add any logic later.\n static handleMouseMove(state, e) {\n return state;\n }\n}\n"],"mappings":";;;;;;;;AAAO,MAAMA,YAAY,CAAC;EAGxB,OAAOC,MAAMA,CAACC,MAAM,EAAEC,CAAC,EAAE;IACvB,MAAMC,SAAS,GAAG,CAAC,GAAGF,MAAM,CAAC;IAC7B,MAAMG,UAAU,GAAG;MACjBC,EAAE,EAAE,YAAY;MAChBC,MAAM,EAAE,CAAC;QAAEC,CAAC,EAAEL,CAAC,CAACM,GAAG,CAACC,MAAM;QAAEC,CAAC,EAAER,CAAC,CAACM,GAAG,CAACG;MAAO,CAAC,CAAC;MAC9CC,KAAK,EAAE,UAAU;MACjBC,KAAK,EAAEV,SAAS,CAACW;IACnB,CAAC;IAEDX,SAAS,CAACY,IAAI,CAACX,UAAU,CAAC;IAE1B,OAAO;MACLH,MAAM,EAAEE,SAAS;MACjBa,SAAS,EAAE,IAAI;MACfC,gBAAgB,EAAEb,UAAU,CAACC;IAC/B,CAAC;EACH;EAEA,OAAOa,QAAQA,CAACC,KAAK,EAAEjB,CAAC,EAAEkB,iBAAiB,EAAE;IAC3C;IACA,MAAMC,UAAU,GAAG,CAAC;IAEpB,MAAMC,UAAU,GAAGC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACN,KAAK,CAAClB,MAAM,CAAC,CAAC;IAC3D,MAAMyB,iBAAiB,GAAGJ,UAAU,CAACK,SAAS,CAAEC,KAAK,IAAKA,KAAK,CAACvB,EAAE,KAAKc,KAAK,CAACF,gBAAgB,CAAC;IAE9F,IAAIS,iBAAiB,KAAK,CAAC,CAAC,EAAE;MAC5B,MAAMG,YAAY,GAAGP,UAAU,CAACI,iBAAiB,CAAC;MAClD,IAAIG,YAAY,CAACvB,MAAM,IAAIwB,KAAK,CAACC,OAAO,CAACF,YAAY,CAACvB,MAAM,CAAC,EAAE;QAC7D,MAAM0B,UAAU,GAAGH,YAAY,CAACvB,MAAM,CAAC,CAAC,CAAC;;QAEzC;QACA,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