@pie-element/hotspot 11.1.0-next.5 → 11.1.1-next.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 (339) hide show
  1. package/dist/author/DeleteWidget.d.ts +38 -0
  2. package/dist/author/DeleteWidget.js +46 -0
  3. package/dist/author/button.d.ts +31 -0
  4. package/dist/author/button.js +27 -0
  5. package/dist/author/buttons/circle.d.ts +18 -0
  6. package/dist/author/buttons/circle.js +25 -0
  7. package/dist/author/buttons/polygon.d.ts +18 -0
  8. package/dist/author/buttons/polygon.js +36 -0
  9. package/dist/author/buttons/rectangle.d.ts +18 -0
  10. package/dist/author/buttons/rectangle.js +36 -0
  11. package/dist/author/defaults.d.ts +157 -0
  12. package/dist/author/defaults.js +119 -0
  13. package/dist/author/hotspot-circle.d.ts +21 -0
  14. package/dist/author/hotspot-circle.js +124 -0
  15. package/dist/author/hotspot-container.d.ts +29 -0
  16. package/dist/author/hotspot-container.js +210 -0
  17. package/dist/author/hotspot-drawable.d.ts +31 -0
  18. package/dist/author/hotspot-drawable.js +312 -0
  19. package/dist/author/hotspot-palette.d.ts +14 -0
  20. package/dist/author/hotspot-palette.js +72 -0
  21. package/dist/author/hotspot-polygon.d.ts +38 -0
  22. package/dist/author/hotspot-polygon.js +200 -0
  23. package/dist/author/hotspot-rectangle.d.ts +20 -0
  24. package/dist/author/hotspot-rectangle.js +119 -0
  25. package/dist/author/icons.d.ts +9 -0
  26. package/dist/author/icons.js +4 -0
  27. package/dist/author/image-konva.d.ts +19 -0
  28. package/dist/author/image-konva.js +49 -0
  29. package/dist/author/index.d.ts +52 -0
  30. package/dist/author/index.js +143 -0
  31. package/dist/author/root.d.ts +15 -0
  32. package/dist/author/root.js +215 -0
  33. package/dist/author/shapes/circle.d.ts +18 -0
  34. package/dist/author/shapes/circle.js +47 -0
  35. package/dist/author/shapes/index.d.ts +12 -0
  36. package/dist/author/shapes/polygon.d.ts +19 -0
  37. package/dist/author/shapes/polygon.js +51 -0
  38. package/dist/author/shapes/rectagle.d.ts +18 -0
  39. package/dist/author/shapes/rectagle.js +57 -0
  40. package/dist/author/shapes/utils.d.ts +19 -0
  41. package/dist/author/shapes/utils.js +16 -0
  42. package/dist/author/upload-control.d.ts +29 -0
  43. package/dist/author/upload-control.js +28 -0
  44. package/dist/author/utils.d.ts +24 -0
  45. package/dist/author/utils.js +83 -0
  46. package/dist/controller/defaults.d.ts +35 -0
  47. package/dist/controller/defaults.js +29 -0
  48. package/dist/controller/index.d.ts +22 -0
  49. package/dist/controller/index.js +154 -0
  50. package/dist/controller/utils.d.ts +10 -0
  51. package/dist/controller/utils.js +13 -0
  52. package/dist/delivery/hotspot/circle.d.ts +19 -0
  53. package/dist/delivery/hotspot/circle.js +100 -0
  54. package/dist/delivery/hotspot/container.d.ts +16 -0
  55. package/dist/delivery/hotspot/container.js +150 -0
  56. package/dist/delivery/hotspot/icons.d.ts +10 -0
  57. package/dist/delivery/hotspot/icons.js +4 -0
  58. package/dist/delivery/hotspot/image-konva-tooltip.d.ts +19 -0
  59. package/dist/delivery/hotspot/image-konva-tooltip.js +66 -0
  60. package/dist/delivery/hotspot/index.d.ts +17 -0
  61. package/dist/delivery/hotspot/index.js +114 -0
  62. package/dist/delivery/hotspot/polygon.d.ts +21 -0
  63. package/dist/delivery/hotspot/polygon.js +108 -0
  64. package/dist/delivery/hotspot/rectangle.d.ts +19 -0
  65. package/dist/delivery/hotspot/rectangle.js +104 -0
  66. package/dist/delivery/index.d.ts +20 -0
  67. package/dist/delivery/index.js +107 -0
  68. package/dist/delivery/session-updater.d.ts +10 -0
  69. package/dist/delivery/session-updater.js +14 -0
  70. package/dist/index.d.ts +1 -0
  71. package/dist/index.iife.d.ts +8 -0
  72. package/dist/index.iife.js +169 -0
  73. package/dist/index.js +2 -0
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +6 -0
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +16 -0
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +16 -0
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +6 -0
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +16 -0
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +6 -0
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +6 -0
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +11 -0
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +14 -0
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +5 -0
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +5 -0
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +6 -0
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +7 -0
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +10 -0
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +7 -0
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +7 -0
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +10 -0
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +8 -0
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +8 -0
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +8 -0
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +12 -0
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +57 -0
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +14 -0
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +10 -0
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +9 -0
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +8 -0
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +9 -0
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +11 -0
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +9 -0
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +12 -0
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +13 -0
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +7 -0
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +8 -0
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +6 -0
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +10 -0
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +8 -0
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +8 -0
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +8 -0
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +8 -0
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +14 -0
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +8 -0
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +5 -0
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +10 -0
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +35 -0
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +35 -0
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +32 -0
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +4 -0
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +9 -0
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +8 -0
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +9 -0
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +5 -0
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +14 -0
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +10 -0
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +23 -0
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +6 -0
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +7 -0
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +7 -0
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +13 -0
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +9 -0
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +9 -0
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +8 -0
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +33 -0
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +9 -0
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +8 -0
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +7 -0
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +11 -0
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +8 -0
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +6 -0
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +9 -0
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +8 -0
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +7 -0
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +8 -0
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +13 -0
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +7 -0
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +7 -0
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +8 -0
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +9 -0
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +5 -0
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +5 -0
  163. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  164. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +9 -0
  165. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +7 -0
  166. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +8 -0
  167. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +5 -0
  168. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +7 -0
  169. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +6 -0
  170. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +9 -0
  171. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +7 -0
  172. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +7 -0
  173. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +6 -0
  174. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +6 -0
  175. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +16 -0
  176. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +15 -0
  177. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +8 -0
  178. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +6 -0
  179. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +10 -0
  180. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +4 -0
  181. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +8 -0
  182. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +6 -0
  183. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +21 -0
  184. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +7 -0
  185. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +11 -0
  186. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +7 -0
  187. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +7 -0
  188. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +7 -0
  189. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +6 -0
  190. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +7 -0
  191. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +7 -0
  192. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +9 -0
  193. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +9 -0
  194. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +6 -0
  195. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +6 -0
  196. package/package.json +58 -20
  197. package/CHANGELOG.json +0 -997
  198. package/CHANGELOG.md +0 -2201
  199. package/LICENSE.md +0 -5
  200. package/README.md +0 -1
  201. package/configure/CHANGELOG.json +0 -682
  202. package/configure/CHANGELOG.md +0 -1940
  203. package/configure/lib/DeleteWidget.js +0 -64
  204. package/configure/lib/DeleteWidget.js.map +0 -1
  205. package/configure/lib/button.js +0 -42
  206. package/configure/lib/button.js.map +0 -1
  207. package/configure/lib/buttons/circle.js +0 -33
  208. package/configure/lib/buttons/circle.js.map +0 -1
  209. package/configure/lib/buttons/polygon.js +0 -39
  210. package/configure/lib/buttons/polygon.js.map +0 -1
  211. package/configure/lib/buttons/rectangle.js +0 -39
  212. package/configure/lib/buttons/rectangle.js.map +0 -1
  213. package/configure/lib/defaults.js +0 -155
  214. package/configure/lib/defaults.js.map +0 -1
  215. package/configure/lib/hotspot-circle.js +0 -192
  216. package/configure/lib/hotspot-circle.js.map +0 -1
  217. package/configure/lib/hotspot-container.js +0 -320
  218. package/configure/lib/hotspot-container.js.map +0 -1
  219. package/configure/lib/hotspot-drawable.js +0 -519
  220. package/configure/lib/hotspot-drawable.js.map +0 -1
  221. package/configure/lib/hotspot-palette.js +0 -107
  222. package/configure/lib/hotspot-palette.js.map +0 -1
  223. package/configure/lib/hotspot-polygon.js +0 -293
  224. package/configure/lib/hotspot-polygon.js.map +0 -1
  225. package/configure/lib/hotspot-rectangle.js +0 -190
  226. package/configure/lib/hotspot-rectangle.js.map +0 -1
  227. package/configure/lib/icons.js +0 -7
  228. package/configure/lib/icons.js.map +0 -1
  229. package/configure/lib/image-konva.js +0 -66
  230. package/configure/lib/image-konva.js.map +0 -1
  231. package/configure/lib/index.js +0 -194
  232. package/configure/lib/index.js.map +0 -1
  233. package/configure/lib/root.js +0 -330
  234. package/configure/lib/root.js.map +0 -1
  235. package/configure/lib/shapes/circle.js +0 -84
  236. package/configure/lib/shapes/circle.js.map +0 -1
  237. package/configure/lib/shapes/index.js +0 -50
  238. package/configure/lib/shapes/index.js.map +0 -1
  239. package/configure/lib/shapes/polygon.js +0 -82
  240. package/configure/lib/shapes/polygon.js.map +0 -1
  241. package/configure/lib/shapes/rectagle.js +0 -84
  242. package/configure/lib/shapes/rectagle.js.map +0 -1
  243. package/configure/lib/shapes/utils.js +0 -21
  244. package/configure/lib/shapes/utils.js.map +0 -1
  245. package/configure/lib/upload-control.js +0 -41
  246. package/configure/lib/upload-control.js.map +0 -1
  247. package/configure/lib/utils.js +0 -185
  248. package/configure/lib/utils.js.map +0 -1
  249. package/configure/package.json +0 -26
  250. package/configure/src/DeleteWidget.jsx +0 -51
  251. package/configure/src/__tests__/DeleteWidget.test.jsx +0 -366
  252. package/configure/src/__tests__/button.test.jsx +0 -198
  253. package/configure/src/__tests__/hotspot-circle.test.jsx +0 -259
  254. package/configure/src/__tests__/hotspot-container.test.js +0 -366
  255. package/configure/src/__tests__/hotspot-drawable.test.js +0 -271
  256. package/configure/src/__tests__/hotspot-palette.test.jsx +0 -71
  257. package/configure/src/__tests__/image-konva.test.jsx +0 -226
  258. package/configure/src/__tests__/index.test.js +0 -329
  259. package/configure/src/__tests__/root.test.js +0 -400
  260. package/configure/src/__tests__/utils.test.js +0 -241
  261. package/configure/src/button.jsx +0 -35
  262. package/configure/src/buttons/circle.jsx +0 -18
  263. package/configure/src/buttons/polygon.jsx +0 -29
  264. package/configure/src/buttons/rectangle.jsx +0 -29
  265. package/configure/src/defaults.js +0 -109
  266. package/configure/src/hotspot-circle.jsx +0 -183
  267. package/configure/src/hotspot-container.jsx +0 -330
  268. package/configure/src/hotspot-drawable.jsx +0 -527
  269. package/configure/src/hotspot-palette.jsx +0 -90
  270. package/configure/src/hotspot-polygon.jsx +0 -294
  271. package/configure/src/hotspot-rectangle.jsx +0 -169
  272. package/configure/src/icons.js +0 -5
  273. package/configure/src/image-konva.jsx +0 -63
  274. package/configure/src/index.js +0 -208
  275. package/configure/src/root.jsx +0 -346
  276. package/configure/src/shapes/circle.js +0 -81
  277. package/configure/src/shapes/index.js +0 -4
  278. package/configure/src/shapes/polygon.js +0 -81
  279. package/configure/src/shapes/rectagle.js +0 -82
  280. package/configure/src/shapes/utils.js +0 -16
  281. package/configure/src/upload-control.jsx +0 -33
  282. package/configure/src/utils.js +0 -210
  283. package/controller/CHANGELOG.json +0 -362
  284. package/controller/CHANGELOG.md +0 -1293
  285. package/controller/lib/defaults.js +0 -33
  286. package/controller/lib/defaults.js.map +0 -1
  287. package/controller/lib/index.js +0 -341
  288. package/controller/lib/index.js.map +0 -1
  289. package/controller/lib/utils.js +0 -32
  290. package/controller/lib/utils.js.map +0 -1
  291. package/controller/package.json +0 -18
  292. package/controller/src/__tests__/index.test.js +0 -419
  293. package/controller/src/__tests__/utils.test.js +0 -5
  294. package/controller/src/defaults.js +0 -19
  295. package/controller/src/index.js +0 -328
  296. package/controller/src/utils.js +0 -29
  297. package/docs/config-schema.json +0 -2023
  298. package/docs/config-schema.json.md +0 -1495
  299. package/docs/demo/config.js +0 -8
  300. package/docs/demo/generate.js +0 -118
  301. package/docs/demo/index.html +0 -1
  302. package/docs/demo/session.js +0 -11
  303. package/docs/pie-schema.json +0 -1204
  304. package/docs/pie-schema.json.md +0 -851
  305. package/lib/hotspot/circle.js +0 -156
  306. package/lib/hotspot/circle.js.map +0 -1
  307. package/lib/hotspot/container.js +0 -206
  308. package/lib/hotspot/container.js.map +0 -1
  309. package/lib/hotspot/icons.js +0 -8
  310. package/lib/hotspot/icons.js.map +0 -1
  311. package/lib/hotspot/image-konva-tooltip.js +0 -86
  312. package/lib/hotspot/image-konva-tooltip.js.map +0 -1
  313. package/lib/hotspot/index.js +0 -163
  314. package/lib/hotspot/index.js.map +0 -1
  315. package/lib/hotspot/polygon.js +0 -203
  316. package/lib/hotspot/polygon.js.map +0 -1
  317. package/lib/hotspot/rectangle.js +0 -175
  318. package/lib/hotspot/rectangle.js.map +0 -1
  319. package/lib/index.js +0 -213
  320. package/lib/index.js.map +0 -1
  321. package/lib/session-updater.js +0 -42
  322. package/lib/session-updater.js.map +0 -1
  323. package/src/__tests__/container.test.jsx +0 -58
  324. package/src/__tests__/index.test.js +0 -123
  325. package/src/__tests__/session-updater.test.jsx +0 -69
  326. package/src/hotspot/__tests__/circle.test.jsx +0 -464
  327. package/src/hotspot/__tests__/container.test.jsx +0 -546
  328. package/src/hotspot/__tests__/image-konva-tooltip.test.jsx +0 -510
  329. package/src/hotspot/__tests__/polygon.test.jsx +0 -502
  330. package/src/hotspot/__tests__/rectangle.test.jsx +0 -418
  331. package/src/hotspot/circle.jsx +0 -152
  332. package/src/hotspot/container.jsx +0 -217
  333. package/src/hotspot/icons.js +0 -7
  334. package/src/hotspot/image-konva-tooltip.jsx +0 -76
  335. package/src/hotspot/index.jsx +0 -165
  336. package/src/hotspot/polygon.jsx +0 -195
  337. package/src/hotspot/rectangle.jsx +0 -171
  338. package/src/index.js +0 -226
  339. package/src/session-updater.js +0 -29
@@ -1,84 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.RectangleShape = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- class RectangleShape {
10
- static create(shapes, e) {
11
- const newShapes = [...shapes];
12
- const highestId = Math.max(...newShapes.map(shape => parseInt(shape.id)), 0) || 0;
13
- const newRectangle = {
14
- id: `${highestId + 1}`,
15
- height: 0,
16
- width: 0,
17
- x: e.evt.layerX,
18
- y: e.evt.layerY,
19
- group: 'rectangles',
20
- index: newShapes.length
21
- };
22
- newShapes.push(newRectangle);
23
- return {
24
- shapes: newShapes,
25
- isDrawing: true,
26
- isDrawingShapeId: newRectangle.id
27
- };
28
- }
29
- static finalizeCreation(state, props) {
30
- const currentShapeIndex = state.shapes.findIndex(shape => shape.id === state.isDrawingShapeId);
31
- if (currentShapeIndex !== -1) {
32
- const currentShape = state.shapes[currentShapeIndex];
33
-
34
- // Check if the shape is a valid rectangle (has more than 0 width and height) before finalizing
35
- if (currentShape.width > 0 && currentShape.height > 0) {
36
- return {
37
- ...state,
38
- isDrawing: false,
39
- stateShapes: false,
40
- isDrawingShapeId: undefined
41
- };
42
- } else {
43
- return {
44
- ...state,
45
- isDrawing: false,
46
- stateShapes: false,
47
- isDrawingShapeId: undefined,
48
- shapes: state.shapes.filter(shape => shape.id !== state.isDrawingShapeId)
49
- };
50
- }
51
- }
52
-
53
- // Return current state if not drawing a rectangle
54
- return {
55
- ...state,
56
- isDrawing: false,
57
- stateShapes: false,
58
- isDrawingShapeId: undefined
59
- };
60
- }
61
- static handleMouseMove(state, e) {
62
- const {
63
- isDrawing,
64
- isDrawingShapeId,
65
- shapes
66
- } = state;
67
- if (isDrawing) {
68
- const tempShapes = [...shapes];
69
- const resizingShapeIndex = tempShapes.findIndex(shape => shape.id === isDrawingShapeId);
70
- if (resizingShapeIndex !== -1) {
71
- const resizingShape = tempShapes[resizingShapeIndex];
72
- resizingShape.width = e.evt.layerX - resizingShape.x;
73
- resizingShape.height = e.evt.layerY - resizingShape.y;
74
- return {
75
- shapes: tempShapes
76
- };
77
- }
78
- }
79
- return state;
80
- }
81
- }
82
- exports.RectangleShape = RectangleShape;
83
- (0, _defineProperty2.default)(RectangleShape, "name", 'rectangle');
84
- //# sourceMappingURL=rectagle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rectagle.js","names":["RectangleShape","create","shapes","e","newShapes","highestId","Math","max","map","shape","parseInt","id","newRectangle","height","width","x","evt","layerX","y","layerY","group","index","length","push","isDrawing","isDrawingShapeId","finalizeCreation","state","props","currentShapeIndex","findIndex","currentShape","stateShapes","undefined","filter","handleMouseMove","tempShapes","resizingShapeIndex","resizingShape","exports","_defineProperty2","default"],"sources":["../../src/shapes/rectagle.js"],"sourcesContent":["export class RectangleShape {\n static name = 'rectangle'\n\n static create(shapes, e) {\n const newShapes = [...shapes];\n const highestId = Math.max(...newShapes.map((shape) => parseInt(shape.id)), 0) || 0;\n\n const newRectangle = {\n id: `${highestId + 1}`,\n height: 0,\n width: 0,\n x: e.evt.layerX,\n y: e.evt.layerY,\n group: 'rectangles',\n index: newShapes.length,\n };\n\n newShapes.push(newRectangle);\n\n return {\n shapes: newShapes,\n isDrawing: true,\n isDrawingShapeId: newRectangle.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 rectangle (has more than 0 width and height) before finalizing\n if (currentShape.width > 0 && currentShape.height > 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 current state if not drawing a rectangle\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 resizingShape.width = e.evt.layerX - resizingShape.x;\n resizingShape.height = e.evt.layerY - resizingShape.y;\n\n return {\n shapes: tempShapes,\n };\n }\n }\n\n return state;\n }\n}\n"],"mappings":";;;;;;;;AAAO,MAAMA,cAAc,CAAC;EAG1B,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,IAAI,CAAC;IAEnF,MAAMC,YAAY,GAAG;MACnBD,EAAE,EAAE,GAAGN,SAAS,GAAG,CAAC,EAAE;MACtBQ,MAAM,EAAE,CAAC;MACTC,KAAK,EAAE,CAAC;MACRC,CAAC,EAAEZ,CAAC,CAACa,GAAG,CAACC,MAAM;MACfC,CAAC,EAAEf,CAAC,CAACa,GAAG,CAACG,MAAM;MACfC,KAAK,EAAE,YAAY;MACnBC,KAAK,EAAEjB,SAAS,CAACkB;IACnB,CAAC;IAEDlB,SAAS,CAACmB,IAAI,CAACX,YAAY,CAAC;IAE5B,OAAO;MACLV,MAAM,EAAEE,SAAS;MACjBoB,SAAS,EAAE,IAAI;MACfC,gBAAgB,EAAEb,YAAY,CAACD;IACjC,CAAC;EACH;EAEA,OAAOe,gBAAgBA,CAACC,KAAK,EAAEC,KAAK,EAAE;IACpC,MAAMC,iBAAiB,GAAGF,KAAK,CAACzB,MAAM,CAAC4B,SAAS,CAAErB,KAAK,IAAKA,KAAK,CAACE,EAAE,KAAKgB,KAAK,CAACF,gBAAgB,CAAC;IAEhG,IAAII,iBAAiB,KAAK,CAAC,CAAC,EAAE;MAC5B,MAAME,YAAY,GAAGJ,KAAK,CAACzB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a,CAACpB,CAAC;QAErD,OAAO;UACLhB,MAAM,EAAEkC;QACV,CAAC;MACH;IACF;IAEA,OAAOT,KAAK;EACd;AACF;AAACY,OAAA,CAAAvC,cAAA,GAAAA,cAAA;AAAA,IAAAwC,gBAAA,CAAAC,OAAA,EAjFYzC,cAAc,UACX,WAAW","ignoreList":[]}
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SUPPORTED_SHAPES = exports.SHAPE_GROUPS = void 0;
7
- var _circle = require("./circle");
8
- var _polygon = require("./polygon");
9
- var _rectagle = require("./rectagle");
10
- const SUPPORTED_SHAPES = exports.SUPPORTED_SHAPES = {
11
- CIRCLE: _circle.CircleShape.name,
12
- POLYGON: _polygon.PolygonShape.name,
13
- RECTANGLE: _rectagle.RectangleShape.name,
14
- NONE: 'none'
15
- };
16
- const SHAPE_GROUPS = exports.SHAPE_GROUPS = {
17
- CIRCLES: 'circles',
18
- POLYGONS: 'polygons',
19
- RECTANGLES: 'rectangles'
20
- };
21
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["_circle","require","_polygon","_rectagle","SUPPORTED_SHAPES","exports","CIRCLE","CircleShape","name","POLYGON","PolygonShape","RECTANGLE","RectangleShape","NONE","SHAPE_GROUPS","CIRCLES","POLYGONS","RECTANGLES"],"sources":["../../src/shapes/utils.js"],"sourcesContent":["import { CircleShape } from './circle';\nimport { PolygonShape } from './polygon';\nimport { RectangleShape } from './rectagle';\n\nexport const SUPPORTED_SHAPES = {\n CIRCLE: CircleShape.name,\n POLYGON: PolygonShape.name,\n RECTANGLE: RectangleShape.name,\n NONE: 'none',\n};\n\nexport const SHAPE_GROUPS = {\n CIRCLES: 'circles',\n POLYGONS: 'polygons',\n RECTANGLES: 'rectangles',\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEO,MAAMG,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9BE,MAAM,EAAEC,mBAAW,CAACC,IAAI;EACxBC,OAAO,EAAEC,qBAAY,CAACF,IAAI;EAC1BG,SAAS,EAAEC,wBAAc,CAACJ,IAAI;EAC9BK,IAAI,EAAE;AACR,CAAC;AAEM,MAAMC,YAAY,GAAAT,OAAA,CAAAS,YAAA,GAAG;EAC1BC,OAAO,EAAE,SAAS;EAClBC,QAAQ,EAAE,UAAU;EACpBC,UAAU,EAAE;AACd,CAAC","ignoreList":[]}
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _button = _interopRequireDefault(require("./button"));
11
- const UploadControl = ({
12
- label,
13
- onInputClick,
14
- onUploadImage,
15
- setRef
16
- }) => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_button.default, {
17
- label: label,
18
- onClick: onInputClick
19
- }), /*#__PURE__*/_react.default.createElement("input", {
20
- accept: "image/*",
21
- style: {
22
- display: 'none'
23
- },
24
- onChange: onUploadImage,
25
- ref: ref => {
26
- setRef(ref);
27
- },
28
- type: "file"
29
- }));
30
- UploadControl.propTypes = {
31
- label: _propTypes.default.string.isRequired,
32
- onInputClick: _propTypes.default.func.isRequired,
33
- onUploadImage: _propTypes.default.func.isRequired,
34
- setRef: _propTypes.default.func.isRequired
35
- };
36
- UploadControl.defaultProps = {
37
- classNameButton: '',
38
- classNameSection: ''
39
- };
40
- var _default = exports.default = UploadControl;
41
- //# sourceMappingURL=upload-control.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-control.js","names":["_react","_interopRequireDefault","require","_propTypes","_button","UploadControl","label","onInputClick","onUploadImage","setRef","default","createElement","Fragment","onClick","accept","style","display","onChange","ref","type","propTypes","PropTypes","string","isRequired","func","defaultProps","classNameButton","classNameSection","_default","exports"],"sources":["../src/upload-control.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport Button from './button';\n\nconst UploadControl = ({ label, onInputClick, onUploadImage, setRef }) => (\n <>\n <Button label={label} onClick={onInputClick} />\n <input\n accept=\"image/*\"\n style={{ display: 'none' }}\n onChange={onUploadImage}\n ref={(ref) => {\n setRef(ref);\n }}\n type=\"file\"\n />\n </>\n);\n\nUploadControl.propTypes = {\n label: PropTypes.string.isRequired,\n onInputClick: PropTypes.func.isRequired,\n onUploadImage: PropTypes.func.isRequired,\n setRef: PropTypes.func.isRequired,\n};\n\nUploadControl.defaultProps = {\n classNameButton: '',\n classNameSection: '',\n};\n\nexport default UploadControl;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,MAAMG,aAAa,GAAGA,CAAC;EAAEC,KAAK;EAAEC,YAAY;EAAEC,aAAa;EAAEC;AAAO,CAAC,kBACnET,MAAA,CAAAU,OAAA,CAAAC,aAAA,CAAAX,MAAA,CAAAU,OAAA,CAAAE,QAAA,qBACEZ,MAAA,CAAAU,OAAA,CAAAC,aAAA,CAACP,OAAA,CAAAM,OAAM;EAACJ,KAAK,EAAEA,KAAM;EAACO,OAAO,EAAEN;AAAa,CAAE,CAAC,eAC/CP,MAAA,CAAAU,OAAA,CAAAC,aAAA;EACEG,MAAM,EAAC,SAAS;EAChBC,KAAK,EAAE;IAAEC,OAAO,EAAE;EAAO,CAAE;EAC3BC,QAAQ,EAAET,aAAc;EACxBU,GAAG,EAAGA,GAAG,IAAK;IACZT,MAAM,CAACS,GAAG,CAAC;EACb,CAAE;EACFC,IAAI,EAAC;AAAM,CACZ,CACD,CACH;AAEDd,aAAa,CAACe,SAAS,GAAG;EACxBd,KAAK,EAAEe,kBAAS,CAACC,MAAM,CAACC,UAAU;EAClChB,YAAY,EAAEc,kBAAS,CAACG,IAAI,CAACD,UAAU;EACvCf,aAAa,EAAEa,kBAAS,CAACG,IAAI,CAACD,UAAU;EACxCd,MAAM,EAAEY,kBAAS,CAACG,IAAI,CAACD;AACzB,CAAC;AAEDlB,aAAa,CAACoB,YAAY,GAAG;EAC3BC,eAAe,EAAE,EAAE;EACnBC,gBAAgB,EAAE;AACpB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAnB,OAAA,GAEaL,aAAa","ignoreList":[]}
@@ -1,185 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.updateImageDimensions = exports.isPointInsidePolygon = exports.groupShapes = exports.getUpdatedShapes = exports.getUpdatedRectangle = exports.getUpdatedPolygon = exports.getAllShapes = exports.generateValidationMessage = exports.calculate = void 0;
7
- var _lodashEs = require("lodash-es");
8
- var _shapes = require("./shapes");
9
- const updateImageDimensions = (initialDim, nextDim, keepAspectRatio, resizeType) => {
10
- // if we want to keep image aspect ratio
11
- if (keepAspectRatio) {
12
- const imageAspectRatio = initialDim.width / initialDim.height;
13
- if (resizeType === 'height') {
14
- // if we want to change image height => we update the width accordingly
15
- return {
16
- width: nextDim.height * imageAspectRatio,
17
- height: nextDim.height
18
- };
19
- }
20
-
21
- // if we want to change image width => we update the height accordingly
22
- return {
23
- width: nextDim.width,
24
- height: nextDim.width / imageAspectRatio
25
- };
26
- }
27
-
28
- // if we don't want to keep aspect ratio, we just update both values
29
- return {
30
- width: nextDim.width,
31
- height: nextDim.height
32
- };
33
- };
34
-
35
- // referenceInitialValue = the initial value of the Stage
36
- // referenceNextValue = the next value of the Stage
37
- // currentValue = the value that has to be re-sized influenced by the changes that were made on the Stage
38
- exports.updateImageDimensions = updateImageDimensions;
39
- const getDelta = (referenceInitialValue, referenceNextValue, currentValue) => referenceNextValue / referenceInitialValue * currentValue;
40
- const getUpdatedRectangle = (initialDim, nextDim, shape) => ({
41
- ...shape,
42
- width: getDelta(initialDim.width, nextDim.width, shape.width),
43
- height: getDelta(initialDim.height, nextDim.height, shape.height),
44
- x: getDelta(initialDim.width, nextDim.width, shape.x),
45
- y: getDelta(initialDim.height, nextDim.height, shape.y)
46
- });
47
- exports.getUpdatedRectangle = getUpdatedRectangle;
48
- const getUpdatedCircles = (initialDim, nextDim, shape) => ({
49
- ...shape,
50
- radius: getDelta(initialDim.width, nextDim.width, shape.radius),
51
- x: getDelta(initialDim.width, nextDim.width, shape.x),
52
- y: getDelta(initialDim.height, nextDim.height, shape.y)
53
- });
54
- const getUpdatedPolygon = (initialDim, nextDim, shape) => ({
55
- ...shape,
56
- points: shape.points.map(point => ({
57
- x: getDelta(initialDim.width, nextDim.width, point.x),
58
- y: getDelta(initialDim.height, nextDim.height, point.y)
59
- }))
60
- });
61
-
62
- // initialDim = the initial dimensions: { width, height } of the Stage
63
- // nextDim = the next dimensions: { width, height } of the Stage
64
- // shapes = array of shapes that have to be re-sized and re-positioned
65
- exports.getUpdatedPolygon = getUpdatedPolygon;
66
- const getUpdatedShapes = (initialDim, nextDim, shapes) => {
67
- return shapes.map(shape => {
68
- if (shape.group === _shapes.SHAPE_GROUPS.RECTANGLES) {
69
- return getUpdatedRectangle(initialDim, nextDim, shape);
70
- }
71
- if (shape.group === _shapes.SHAPE_GROUPS.POLYGONS) {
72
- return getUpdatedPolygon(initialDim, nextDim, shape);
73
- }
74
- if (shape.group === _shapes.SHAPE_GROUPS.CIRCLES) {
75
- return getUpdatedCircles(initialDim, nextDim, shape);
76
- }
77
- });
78
- };
79
-
80
- // converts shapes map to shapes array
81
- // example:
82
- // from: { rectangles: [r1], polygons: [p1, p2]}
83
- // to: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]
84
- // if a shape has index defined, keep it, otherwise initialize it
85
- // index is used for the UNDO function
86
- exports.getUpdatedShapes = getUpdatedShapes;
87
- const getAllShapes = shapesMap => {
88
- shapesMap = shapesMap || {};
89
- const shapesArray = [];
90
- const shapesKeys = Object.keys(shapesMap);
91
- return shapesKeys.length ? shapesKeys.reduce((acc, currentShapeKey) => acc.concat(shapesMap[currentShapeKey] ? shapesMap[currentShapeKey].map((shape, index) => ({
92
- ...shape,
93
- group: currentShapeKey,
94
- index: shape.index || acc.length + index
95
- })) : []), shapesArray) : shapesArray;
96
- };
97
-
98
- // converts shapes array to shapes map
99
- // is the reverse of getAllShapes function
100
- // example:
101
- // from: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]
102
- // to: { rectangles: [r1], polygons: [p1, p2]}
103
- exports.getAllShapes = getAllShapes;
104
- const groupShapes = shapesArray => {
105
- shapesArray = shapesArray || [];
106
- const shapesMap = {
107
- rectangles: [],
108
- polygons: [],
109
- circles: []
110
- };
111
- if (shapesArray.length) {
112
- return shapesArray.reduce((acc, {
113
- group,
114
- ...shapeProps
115
- }) => {
116
- acc[group] = [...(acc[group] || []), shapeProps];
117
- return acc;
118
- }, shapesMap);
119
- }
120
- return (0, _lodashEs.cloneDeep)(shapesMap);
121
- };
122
- exports.groupShapes = groupShapes;
123
- const isPointInsidePolygon = (polygon, x, y) => {
124
- let inside = false;
125
- if (!polygon || polygon.length <= 0) {
126
- return inside;
127
- }
128
- for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
129
- const xi = polygon[i].x;
130
- const yi = polygon[i].y;
131
- const xj = polygon[j].x;
132
- const yj = polygon[j].y;
133
- const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
134
- if (intersect) {
135
- inside = !inside;
136
- }
137
- }
138
- return inside;
139
- };
140
- exports.isPointInsidePolygon = isPointInsidePolygon;
141
- const calculate = polygonPoints => {
142
- if (!polygonPoints || polygonPoints.length <= 0) {
143
- return {
144
- x: 0,
145
- y: 0
146
- };
147
- }
148
- const xPoints = polygonPoints.map(point => point.x);
149
- const yPoints = polygonPoints.map(point => point.y);
150
- const minX = Math.min(...xPoints);
151
- const minY = Math.min(...yPoints);
152
- const maxX = Math.max(...xPoints);
153
- const maxY = Math.max(...yPoints);
154
-
155
- // Find a suitable position for the text element within the polygon
156
- let textX, textY;
157
- for (let x = minX; x <= maxX - 20; x++) {
158
- for (let y = maxY - 20; y > minY; y--) {
159
- // Check if the text element's position (x, y) is within the polygon
160
- if (isPointInsidePolygon(polygonPoints, x, y)) {
161
- textX = x - 10;
162
- textY = y;
163
- break;
164
- }
165
- }
166
- }
167
- return {
168
- x: textX,
169
- y: textY
170
- };
171
- };
172
- exports.calculate = calculate;
173
- const generateValidationMessage = config => {
174
- const {
175
- minShapes,
176
- maxShapes,
177
- maxSelections
178
- } = config;
179
- const shapesMessage = `\nThere should be at least ${minShapes} ` + (maxShapes ? `and at most ${maxShapes} ` : '') + 'shapes defined.';
180
- const selectionsMessage = '\nThere should be at least 1 ' + (maxSelections ? `and at most ${maxSelections} ` : '') + 'shape' + (maxSelections ? 's' : '') + ' selected.';
181
- const message = 'Validation requirements:' + shapesMessage + selectionsMessage;
182
- return message;
183
- };
184
- exports.generateValidationMessage = generateValidationMessage;
185
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["_lodashEs","require","_shapes","updateImageDimensions","initialDim","nextDim","keepAspectRatio","resizeType","imageAspectRatio","width","height","exports","getDelta","referenceInitialValue","referenceNextValue","currentValue","getUpdatedRectangle","shape","x","y","getUpdatedCircles","radius","getUpdatedPolygon","points","map","point","getUpdatedShapes","shapes","group","SHAPE_GROUPS","RECTANGLES","POLYGONS","CIRCLES","getAllShapes","shapesMap","shapesArray","shapesKeys","Object","keys","length","reduce","acc","currentShapeKey","concat","index","groupShapes","rectangles","polygons","circles","shapeProps","cloneDeep","isPointInsidePolygon","polygon","inside","i","j","xi","yi","xj","yj","intersect","calculate","polygonPoints","xPoints","yPoints","minX","Math","min","minY","maxX","max","maxY","textX","textY","generateValidationMessage","config","minShapes","maxShapes","maxSelections","shapesMessage","selectionsMessage","message"],"sources":["../src/utils.js"],"sourcesContent":["import { cloneDeep } from 'lodash-es';\nimport { SHAPE_GROUPS } from './shapes';\n\nconst updateImageDimensions = (initialDim, nextDim, keepAspectRatio, resizeType) => {\n // if we want to keep image aspect ratio\n if (keepAspectRatio) {\n const imageAspectRatio = initialDim.width / initialDim.height;\n\n if (resizeType === 'height') {\n // if we want to change image height => we update the width accordingly\n return {\n width: nextDim.height * imageAspectRatio,\n height: nextDim.height,\n };\n }\n\n // if we want to change image width => we update the height accordingly\n return {\n width: nextDim.width,\n height: nextDim.width / imageAspectRatio,\n };\n }\n\n // if we don't want to keep aspect ratio, we just update both values\n return {\n width: nextDim.width,\n height: nextDim.height,\n };\n};\n\n// referenceInitialValue = the initial value of the Stage\n// referenceNextValue = the next value of the Stage\n// currentValue = the value that has to be re-sized influenced by the changes that were made on the Stage\nconst getDelta = (referenceInitialValue, referenceNextValue, currentValue) =>\n (referenceNextValue / referenceInitialValue) * currentValue;\n\nconst getUpdatedRectangle = (initialDim, nextDim, shape) => ({\n ...shape,\n width: getDelta(initialDim.width, nextDim.width, shape.width),\n height: getDelta(initialDim.height, nextDim.height, shape.height),\n x: getDelta(initialDim.width, nextDim.width, shape.x),\n y: getDelta(initialDim.height, nextDim.height, shape.y),\n});\n\nconst getUpdatedCircles = (initialDim, nextDim, shape) => ({\n ...shape,\n radius: getDelta(initialDim.width, nextDim.width, shape.radius),\n x: getDelta(initialDim.width, nextDim.width, shape.x),\n y: getDelta(initialDim.height, nextDim.height, shape.y),\n});\n\nconst getUpdatedPolygon = (initialDim, nextDim, shape) => ({\n ...shape,\n points: shape.points.map((point) => ({\n x: getDelta(initialDim.width, nextDim.width, point.x),\n y: getDelta(initialDim.height, nextDim.height, point.y),\n })),\n});\n\n// initialDim = the initial dimensions: { width, height } of the Stage\n// nextDim = the next dimensions: { width, height } of the Stage\n// shapes = array of shapes that have to be re-sized and re-positioned\nconst getUpdatedShapes = (initialDim, nextDim, shapes) => {\n return shapes.map((shape) => {\n if (shape.group === SHAPE_GROUPS.RECTANGLES) {\n return getUpdatedRectangle(initialDim, nextDim, shape);\n }\n\n if (shape.group === SHAPE_GROUPS.POLYGONS) {\n return getUpdatedPolygon(initialDim, nextDim, shape);\n }\n\n if (shape.group === SHAPE_GROUPS.CIRCLES) {\n return getUpdatedCircles(initialDim, nextDim, shape);\n }\n });\n};\n\n// converts shapes map to shapes array\n// example:\n// from: { rectangles: [r1], polygons: [p1, p2]}\n// to: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]\n// if a shape has index defined, keep it, otherwise initialize it\n// index is used for the UNDO function\nconst getAllShapes = (shapesMap) => {\n shapesMap = shapesMap || {};\n const shapesArray = [];\n const shapesKeys = Object.keys(shapesMap);\n\n return shapesKeys.length\n ? shapesKeys.reduce(\n (acc, currentShapeKey) =>\n acc.concat(\n shapesMap[currentShapeKey]\n ? shapesMap[currentShapeKey].map((shape, index) => ({\n ...shape,\n group: currentShapeKey,\n index: shape.index || acc.length + index,\n }))\n : [],\n ),\n shapesArray,\n )\n : shapesArray;\n};\n\n// converts shapes array to shapes map\n// is the reverse of getAllShapes function\n// example:\n// from: [{ ...r1, group: 'rectangles' }, { ...p1, group: 'polygons' }, { ...p2, group: 'polygons' }]\n// to: { rectangles: [r1], polygons: [p1, p2]}\nconst groupShapes = (shapesArray) => {\n shapesArray = shapesArray || [];\n const shapesMap = {\n rectangles: [],\n polygons: [],\n circles: [],\n };\n\n if (shapesArray.length) {\n return shapesArray.reduce((acc, { group, ...shapeProps }) => {\n acc[group] = [...(acc[group] || []), shapeProps];\n return acc;\n }, shapesMap);\n }\n\n return cloneDeep(shapesMap);\n};\n\nconst isPointInsidePolygon = (polygon, x, y) => {\n let inside = false;\n\n if (!polygon || polygon.length <= 0) {\n return inside;\n }\n\n for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {\n const xi = polygon[i].x;\n const yi = polygon[i].y;\n const xj = polygon[j].x;\n const yj = polygon[j].y;\n\n const intersect = yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi;\n\n if (intersect) {\n inside = !inside;\n }\n }\n\n return inside;\n};\n\nconst calculate = (polygonPoints) => {\n if (!polygonPoints || polygonPoints.length <= 0) {\n return { x: 0, y: 0 };\n }\n\n const xPoints = polygonPoints.map((point) => point.x);\n const yPoints = polygonPoints.map((point) => point.y);\n const minX = Math.min(...xPoints);\n const minY = Math.min(...yPoints);\n const maxX = Math.max(...xPoints);\n const maxY = Math.max(...yPoints);\n\n // Find a suitable position for the text element within the polygon\n let textX, textY;\n\n for (let x = minX; x <= maxX - 20; x++) {\n for (let y = maxY - 20; y > minY; y--) {\n // Check if the text element's position (x, y) is within the polygon\n if (isPointInsidePolygon(polygonPoints, x, y)) {\n textX = x - 10;\n textY = y;\n break;\n }\n }\n }\n\n return { x: textX, y: textY };\n};\n\nconst generateValidationMessage = (config) => {\n const { minShapes, maxShapes, maxSelections } = config;\n\n const shapesMessage =\n `\\nThere should be at least ${minShapes} ` + (maxShapes ? `and at most ${maxShapes} ` : '') + 'shapes defined.';\n\n const selectionsMessage =\n '\\nThere should be at least 1 ' +\n (maxSelections ? `and at most ${maxSelections} ` : '') +\n 'shape' +\n (maxSelections ? 's' : '') +\n ' selected.';\n\n const message = 'Validation requirements:' + shapesMessage + selectionsMessage;\n\n return message;\n};\n\nexport {\n calculate,\n isPointInsidePolygon,\n updateImageDimensions,\n generateValidationMessage,\n getUpdatedShapes,\n getAllShapes,\n groupShapes,\n getUpdatedRectangle,\n getUpdatedPolygon,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,MAAME,qBAAqB,GAAGA,CAACC,UAAU,EAAEC,OAA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AC,EAAEsD,KAAK;IAAErD,CAAC,EAAEsD;EAAM,CAAC;AAC/B,CAAC;AAAC9D,OAAA,CAAAkD,SAAA,GAAAA,SAAA;AAEF,MAAMa,yBAAyB,GAAIC,MAAM,IAAK;EAC5C,MAAM;IAAEC,SAAS;IAAEC,SAAS;IAAEC;EAAc,CAAC,GAAGH,MAAM;EAEtD,MAAMI,aAAa,GACjB,8BAA8BH,SAAS,GAAG,IAAIC,SAAS,GAAG,eAAeA,SAAS,GAAG,GAAG,EAAE,CAAC,GAAG,iBAAiB;EAEjH,MAAMG,iBAAiB,GACrB,+BAA+B,IAC9BF,aAAa,GAAG,eAAeA,aAAa,GAAG,GAAG,EAAE,CAAC,GACtD,OAAO,IACNA,aAAa,GAAG,GAAG,GAAG,EAAE,CAAC,GAC1B,YAAY;EAEd,MAAMG,OAAO,GAAG,0BAA0B,GAAGF,aAAa,GAAGC,iBAAiB;EAE9E,OAAOC,OAAO;AAChB,CAAC;AAACtE,OAAA,CAAA+D,yBAAA,GAAAA,yBAAA","ignoreList":[]}
@@ -1,26 +0,0 @@
1
- {
2
- "name": "@pie-element/hotspot-configure",
3
- "private": true,
4
- "version": "10.1.0-next.1",
5
- "description": "",
6
- "main": "lib/index.js",
7
- "module": "src/index.js",
8
- "author": "",
9
- "dependencies": {
10
- "@emotion/react": "^11.14.0",
11
- "@emotion/style": "^0.8.0",
12
- "@mui/icons-material": "^7.3.4",
13
- "@mui/material": "^7.3.4",
14
- "@pie-framework/pie-configure-events": "^1.3.0",
15
- "@pie-lib/config-ui": "13.0.2-next.2",
16
- "@pie-lib/editable-html-tip-tap": "2.1.0-next.2",
17
- "debug": "^4.1.1",
18
- "konva": "8.3.0",
19
- "lodash-es": "^4.17.23",
20
- "prop-types": "^15.7.2",
21
- "react": "18.3.1",
22
- "react-dom": "18.3.1",
23
- "react-konva": "^18.2.14"
24
- },
25
- "license": "ISC"
26
- }
@@ -1,51 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Group } from 'react-konva';
4
- import { faDelete } from './icons';
5
- import ImageComponent from './image-konva';
6
- import { calculate } from './utils';
7
-
8
- const DeleteWidget = ({ height, id, width, x, y, points, isCircle, radius, handleWidgetClick }) => {
9
- let positionX, positionY;
10
- const offset = 20;
11
-
12
- if (isCircle) {
13
- // For circles, position the delete icon above the circle
14
- positionX = x + radius - offset;
15
- positionY = y;
16
- } else if (points) {
17
- // For polygons, compute position based on points
18
- const calculated = calculate(points);
19
- positionX = calculated.x;
20
- positionY = calculated.y;
21
- } else {
22
- // For rectangles
23
- positionX = x + width - offset;
24
- positionY = y + height - offset;
25
- }
26
-
27
- return (
28
- <Group onClick={() => handleWidgetClick(id)}>
29
- <ImageComponent x={positionX} y={positionY} src={faDelete} />
30
- </Group>
31
- );
32
- };
33
-
34
- DeleteWidget.propTypes = {
35
- id: PropTypes.string.isRequired,
36
- height: PropTypes.number,
37
- width: PropTypes.number,
38
- x: PropTypes.number.isRequired,
39
- y: PropTypes.number.isRequired,
40
- handleWidgetClick: PropTypes.func.isRequired,
41
- radius: PropTypes.number,
42
- isCircle: PropTypes.bool,
43
- points: PropTypes.arrayOf(
44
- PropTypes.shape({
45
- x: PropTypes.number,
46
- y: PropTypes.number,
47
- }),
48
- ),
49
- };
50
-
51
- export default DeleteWidget;