@pie-element/hotspot 11.1.2-next.0 → 11.1.2-next.10

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 (162) hide show
  1. package/dist/author/hotspot-container.js +2 -2
  2. package/dist/author/hotspot-drawable.js +120 -120
  3. package/dist/author/hotspot-polygon.js +2 -2
  4. package/dist/author/index.d.ts +1 -0
  5. package/dist/author/index.js +5 -2
  6. package/dist/author/root.js +52 -52
  7. package/dist/author/utils.js +10 -10
  8. package/dist/browser/{ReactKonva-Z9-1H-UZ.js → ReactKonva-Cj44B3Ds.js} +3504 -3535
  9. package/dist/browser/ReactKonva-Cj44B3Ds.js.map +1 -0
  10. package/dist/browser/author/index.js +24223 -22027
  11. package/dist/browser/author/index.js.map +1 -1
  12. package/dist/browser/{browser-CfnAFove.js → browser-D4gLESxz.js} +22 -6
  13. package/dist/browser/{browser-CfnAFove.js.map → browser-D4gLESxz.js.map} +1 -1
  14. package/dist/browser/controller/index.js +32 -32
  15. package/dist/browser/controller/index.js.map +1 -1
  16. package/dist/browser/delivery/index.js +628 -519
  17. package/dist/browser/delivery/index.js.map +1 -1
  18. package/dist/browser/dist-CJeYAWp3.js +100 -0
  19. package/dist/browser/dist-CJeYAWp3.js.map +1 -0
  20. package/dist/controller/index.js +51 -51
  21. package/dist/controller/utils.d.ts +1 -1
  22. package/dist/controller/utils.js +2 -3
  23. package/dist/delivery/hotspot/circle.d.ts +3 -0
  24. package/dist/delivery/hotspot/circle.js +40 -27
  25. package/dist/delivery/hotspot/container.d.ts +5 -0
  26. package/dist/delivery/hotspot/container.js +163 -96
  27. package/dist/delivery/hotspot/index.d.ts +1 -0
  28. package/dist/delivery/hotspot/index.js +41 -36
  29. package/dist/delivery/hotspot/polygon.d.ts +3 -0
  30. package/dist/delivery/hotspot/polygon.js +39 -26
  31. package/dist/delivery/hotspot/rectangle.d.ts +3 -0
  32. package/dist/delivery/hotspot/rectangle.js +40 -28
  33. package/dist/delivery/index.js +3 -3
  34. package/dist/index.iife.js +40 -40
  35. package/dist/runtime-support.d.ts +12 -0
  36. package/dist/runtime-support.js +12 -0
  37. package/package.json +20 -17
  38. package/dist/browser/ReactKonva-Z9-1H-UZ.js.map +0 -1
  39. package/dist/browser/isEqual-D3CTSc6W.js +0 -601
  40. package/dist/browser/isEqual-D3CTSc6W.js.map +0 -1
  41. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  42. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
@@ -4,7 +4,7 @@ import { PolygonButton as n } from "./buttons/polygon.js";
4
4
  import { RectangleButton as r } from "./buttons/rectangle.js";
5
5
  import { SUPPORTED_SHAPES as i } from "./shapes/utils.js";
6
6
  import { getAllShapes as a, groupShapes as o } from "./utils.js";
7
- import s from "./hotspot-drawable.js";
7
+ import { Drawable as s } from "./hotspot-drawable.js";
8
8
  import c from "./upload-control.js";
9
9
  import { Component as l } from "react";
10
10
  import u from "prop-types";
@@ -207,4 +207,4 @@ S.propTypes = {
207
207
  hasErrors: u.bool
208
208
  }, S.defaultProps = { strokeWidth: 5 };
209
209
  //#endregion
210
- export { S as default };
210
+ export { S as Container, S as default };
@@ -1,17 +1,17 @@
1
- import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js";
2
- import { CircleShape as t } from "./shapes/circle.js";
3
- import { RectangleShape as n } from "./shapes/rectagle.js";
4
- import { PolygonShape as r } from "./shapes/polygon.js";
5
- import { SHAPE_GROUPS as i, SUPPORTED_SHAPES as a } from "./shapes/utils.js";
6
- import { getUpdatedShapes as o, updateImageDimensions as s } from "./utils.js";
7
- import c from "./hotspot-rectangle.js";
8
- import l from "./hotspot-polygon.js";
9
- import u from "./hotspot-circle.js";
10
- import d, { createElement as f } from "react";
11
- import p from "prop-types";
12
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
13
- import { styled as g } from "@mui/material/styles";
14
- import { Layer as _, Stage as v } from "react-konva";
1
+ import { CircleShape as e } from "./shapes/circle.js";
2
+ import { RectangleShape as t } from "./shapes/rectagle.js";
3
+ import { PolygonShape as n } from "./shapes/polygon.js";
4
+ import { SHAPE_GROUPS as r, SUPPORTED_SHAPES as i } from "./shapes/utils.js";
5
+ import { getUpdatedShapes as a, updateImageDimensions as o } from "./utils.js";
6
+ import s from "./hotspot-rectangle.js";
7
+ import c from "./hotspot-polygon.js";
8
+ import l from "./hotspot-circle.js";
9
+ import u, { createElement as d } from "react";
10
+ import f from "prop-types";
11
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
12
+ import { styled as h } from "@mui/material/styles";
13
+ import { Layer as g, Stage as _ } from "react-konva";
14
+ import { cloneDeep as v } from "@pie-element/shared-lodash";
15
15
  //#region src/author/hotspot-drawable.tsx
16
16
  function y(e) {
17
17
  return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
@@ -19,14 +19,14 @@ function y(e) {
19
19
  function b(e, t) {
20
20
  return !e || y(e) ? e : y(e.default) ? e.default : t && y(e[t]) ? e[t] : t && y(e[t]?.default) ? e[t].default : e;
21
21
  }
22
- var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" }), w = g("div")({
22
+ var x = b(_, "Stage"), S = b(g, "Layer"), C = h("div")({ position: "relative" }), w = h("div")({
23
23
  position: "relative",
24
24
  width: "fit-content"
25
- }), T = g("img")({
25
+ }), T = h("img")({
26
26
  alignItems: "center",
27
27
  display: "flex",
28
28
  justifyContent: "center"
29
- }), E = g("div")({
29
+ }), E = h("div")({
30
30
  borderBottom: "1px solid #727272",
31
31
  borderRight: "1px solid #727272",
32
32
  bottom: "-10px",
@@ -35,11 +35,11 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
35
35
  position: "absolute",
36
36
  right: "-10px",
37
37
  width: "10px"
38
- }), D = g(x)({
38
+ }), D = h(x)({
39
39
  left: 0,
40
40
  top: 0,
41
41
  position: "absolute"
42
- }), O = 800, k = class extends d.Component {
42
+ }), O = 800, k = class extends u.Component {
43
43
  static getDerivedStateFromProps(e, t) {
44
44
  return e.shapes === t.shapes ? null : { shapes: e.shapes };
45
45
  }
@@ -56,25 +56,25 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
56
56
  }
57
57
  };
58
58
  }
59
- handleOnMouseDown = (e) => {
60
- let { shapeType: i, onUpdateShapes: o, shapes: s } = this.props, c, l;
61
- if (e.target === e.currentTarget && Object.values(a).includes(i)) {
62
- switch (i) {
63
- case a.RECTANGLE:
64
- c = n.create(s, e);
59
+ handleOnMouseDown = (r) => {
60
+ let { shapeType: a, onUpdateShapes: o, shapes: s } = this.props, c, l;
61
+ if (r.target === r.currentTarget && Object.values(i).includes(a)) {
62
+ switch (a) {
63
+ case i.RECTANGLE:
64
+ c = t.create(s, r);
65
65
  break;
66
- case a.CIRCLE:
67
- c = t.create(s, e);
66
+ case i.CIRCLE:
67
+ c = e.create(s, r);
68
68
  break;
69
- case a.POLYGON:
69
+ case i.POLYGON:
70
70
  if (l = this.state.isDrawingShapeId, l) {
71
- let t = this.addPolygonPoint(e);
71
+ let e = this.addPolygonPoint(r);
72
72
  c = {
73
73
  isDrawing: !0,
74
74
  isDrawingShapeId: l,
75
- shapes: t
75
+ shapes: e
76
76
  };
77
- } else c = r.create(s, e);
77
+ } else c = n.create(s, r);
78
78
  break;
79
79
  default: return;
80
80
  }
@@ -82,7 +82,7 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
82
82
  }
83
83
  };
84
84
  addPolygonPoint(e) {
85
- let { shapes: t } = r.addPoint(this.state, e, (e) => {
85
+ let { shapes: t } = n.addPoint(this.state, e, (e) => {
86
86
  this.setState({
87
87
  isDrawing: !1,
88
88
  shapes: e,
@@ -92,35 +92,35 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
92
92
  return t;
93
93
  }
94
94
  handleOnMouseUp = () => {
95
- let { shapeType: e, onUpdateShapes: r } = this.props, i;
96
- if (e !== a.POLYGON) {
97
- switch (e) {
98
- case a.RECTANGLE:
99
- i = n.finalizeCreation(this.state, this.props);
95
+ let { shapeType: n, onUpdateShapes: r } = this.props, a;
96
+ if (n !== i.POLYGON) {
97
+ switch (n) {
98
+ case i.RECTANGLE:
99
+ a = t.finalizeCreation(this.state, this.props);
100
100
  break;
101
- case a.CIRCLE:
102
- i = t.finalizeCreation(this.state, this.props);
101
+ case i.CIRCLE:
102
+ a = e.finalizeCreation(this.state, this.props);
103
103
  break;
104
104
  default: return;
105
105
  }
106
106
  this.setState({
107
- ...i,
107
+ ...a,
108
108
  isDrawing: !1
109
- }), r(i.shapes);
109
+ }), r(a.shapes);
110
110
  }
111
111
  };
112
- handleMouseMove = (e) => {
113
- let { shapeType: i, onUpdateShapes: o } = this.props, s;
114
- if (!(!this.state.isDrawing || !Object.values(a).includes(i))) {
115
- switch (i) {
116
- case a.RECTANGLE:
117
- s = n.handleMouseMove(this.state, e);
112
+ handleMouseMove = (r) => {
113
+ let { shapeType: a, onUpdateShapes: o } = this.props, s;
114
+ if (!(!this.state.isDrawing || !Object.values(i).includes(a))) {
115
+ switch (a) {
116
+ case i.RECTANGLE:
117
+ s = t.handleMouseMove(this.state, r);
118
118
  break;
119
- case a.CIRCLE:
120
- s = t.handleMouseMove(this.state, e);
119
+ case i.CIRCLE:
120
+ s = e.handleMouseMove(this.state, r);
121
121
  break;
122
- case a.POLYGON:
123
- s = r.handleMouseMove(this.state, e);
122
+ case i.POLYGON:
123
+ s = n.handleMouseMove(this.state, r);
124
124
  break;
125
125
  default: return;
126
126
  }
@@ -130,45 +130,45 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
130
130
  handleOnMouseOutOrLeave = (e) => {
131
131
  this.state.isDrawing && this.handleOnMouseUp(e);
132
132
  };
133
- handleOnDragEnd = (t, n) => {
134
- let { shapes: r, onUpdateShapes: i, dimensions: a } = this.props, { width: o, height: s } = a;
135
- i(e(r.map((e) => {
136
- if (e.id !== t) return e;
137
- let r = n.x, i = n.y;
138
- if (e.group === "rectangles") return r + e.width < 0 || r > o || i + e.height < 0 || i > s ? null : {
139
- ...e,
140
- ...n
133
+ handleOnDragEnd = (e, t) => {
134
+ let { shapes: n, onUpdateShapes: r, dimensions: i } = this.props, { width: a, height: o } = i;
135
+ r(v(n.map((n) => {
136
+ if (n.id !== e) return n;
137
+ let r = t.x, i = t.y;
138
+ if (n.group === "rectangles") return r + n.width < 0 || r > a || i + n.height < 0 || i > o ? null : {
139
+ ...n,
140
+ ...t
141
141
  };
142
- if (e.group === "circles") {
143
- let t = e.radius;
144
- return r + t < 0 || r - t > o || i + t < 0 || i - t > s ? null : {
145
- ...e,
146
- ...n
142
+ if (n.group === "circles") {
143
+ let e = n.radius;
144
+ return r + e < 0 || r - e > a || i + e < 0 || i - e > o ? null : {
145
+ ...n,
146
+ ...t
147
147
  };
148
148
  }
149
- if (e.group === "polygons") {
150
- let t = e.points, r = t.map((e) => e.x), i = t.map((e) => e.y), a = Math.min(...r), c = Math.min(...i), l = Math.max(...r), u = Math.max(...i), d = n.points[0].x - t[0].x, f = n.points[0].y - t[0].y;
151
- return a += d, l += d, c += f, u += f, l < 0 || a > o || u < 0 || c > s ? null : {
152
- ...e,
153
- ...n
149
+ if (n.group === "polygons") {
150
+ let e = n.points, r = e.map((e) => e.x), i = e.map((e) => e.y), s = Math.min(...r), c = Math.min(...i), l = Math.max(...r), u = Math.max(...i), d = t.points[0].x - e[0].x, f = t.points[0].y - e[0].y;
151
+ return s += d, l += d, c += f, u += f, l < 0 || s > a || u < 0 || c > o ? null : {
152
+ ...n,
153
+ ...t
154
154
  };
155
155
  }
156
- return e;
156
+ return n;
157
157
  }).filter((e) => e !== null)));
158
158
  };
159
- closeInProgressPolygons = (t) => {
160
- let { shapes: n, onUpdateShapes: i } = this.props, a = (n || []).find((e) => e.id === "newPolygon");
161
- (t === "newPolygon" || a && this.state.isDrawing) && r.finalizeCreation(this.state, (t) => {
159
+ closeInProgressPolygons = (e) => {
160
+ let { shapes: t, onUpdateShapes: r } = this.props, i = (t || []).find((e) => e.id === "newPolygon");
161
+ (e === "newPolygon" || i && this.state.isDrawing) && n.finalizeCreation(this.state, (e) => {
162
162
  this.setState({
163
163
  isDrawing: !1,
164
- shapes: t,
164
+ shapes: e,
165
165
  isDrawingShapeId: void 0
166
- }), i(e(t));
166
+ }), r(v(e));
167
167
  });
168
168
  };
169
- handleOnSetAsCorrect = (t) => {
170
- let { id: n } = t, { multipleCorrect: r, shapes: i, onUpdateShapes: a } = this.props, o;
171
- o = r ? i.map((e) => (e.id === n && (e.correct = !e.correct), e)) : i.map((e) => (e.correct = e.id === n, e)), a(e(o)), this.closeInProgressPolygons(n);
169
+ handleOnSetAsCorrect = (e) => {
170
+ let { id: t } = e, { multipleCorrect: n, shapes: r, onUpdateShapes: i } = this.props, a;
171
+ a = n ? r.map((e) => (e.id === t && (e.correct = !e.correct), e)) : r.map((e) => (e.correct = e.id === t, e)), i(v(a)), this.closeInProgressPolygons(t);
172
172
  };
173
173
  handleOnImageLoad = ({ target: e }) => {
174
174
  let { onUpdateImageDimension: t } = this.props, n = this.resize, r = getComputedStyle(e), i = parseFloat(r.height), a = parseFloat(r.width), o = a / O, s = a > O ? {
@@ -191,7 +191,7 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
191
191
  }), r;
192
192
  }
193
193
  startResizing = (e) => {
194
- let t = e.target.getBoundingClientRect(), n = this.image, { disableDrag: r, preserveAspectRatioEnabled: i, dimensions: a, shapes: c } = this.props, { width: l, height: u } = s(a, {
194
+ let t = e.target.getBoundingClientRect(), n = this.image, { disableDrag: r, preserveAspectRatioEnabled: i, dimensions: s, shapes: c } = this.props, { width: l, height: u } = o(s, {
195
195
  width: e.clientX - t.left,
196
196
  height: e.clientY - t.top
197
197
  }, i);
@@ -201,15 +201,15 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
201
201
  height: u,
202
202
  width: l
203
203
  },
204
- stateShapes: o(a, {
204
+ stateShapes: a(s, {
205
205
  width: l,
206
206
  height: u
207
207
  }, c)
208
208
  })), r();
209
209
  };
210
210
  stopResizing = () => {
211
- let { enableDrag: t, onUpdateImageDimension: n, onUpdateShapes: r } = this.props, { dimensions: i, stateShapes: a } = this.state;
212
- t(), a && r(e(a)), n(i), window.removeEventListener("mousemove", this.startResizing, !1), window.removeEventListener("mouseup", this.stopResizing, !1), this.setState({
211
+ let { enableDrag: e, onUpdateImageDimension: t, onUpdateShapes: n } = this.props, { dimensions: r, stateShapes: i } = this.state;
212
+ e(), i && n(v(i)), t(r), window.removeEventListener("mousemove", this.startResizing, !1), window.removeEventListener("mouseup", this.stopResizing, !1), this.setState({
213
213
  resizing: !1,
214
214
  stateShapes: !1
215
215
  });
@@ -221,8 +221,8 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
221
221
  }), this.props.onDeleteShape(e);
222
222
  };
223
223
  render() {
224
- let { imageUrl: e, dimensions: { height: t, width: n }, hotspotColor: r, outlineColor: a, shapes: o, strokeWidth: s, hoverOutlineColor: d, selectedHotspotColor: p } = this.props, { stateShapes: g, isDrawing: _, dimensions: { height: v, width: y } } = this.state, b = g || o;
225
- return /* @__PURE__ */ h(C, { children: [e && /* @__PURE__ */ h(w, { children: [/* @__PURE__ */ m(T, {
224
+ let { imageUrl: e, dimensions: { height: t, width: n }, hotspotColor: i, outlineColor: a, shapes: o, strokeWidth: u, hoverOutlineColor: f, selectedHotspotColor: h } = this.props, { stateShapes: g, isDrawing: _, dimensions: { height: v, width: y } } = this.state, b = g || o;
225
+ return /* @__PURE__ */ m(C, { children: [e && /* @__PURE__ */ m(w, { children: [/* @__PURE__ */ p(T, {
226
226
  onLoad: this.handleOnImageLoad,
227
227
  ref: (e) => {
228
228
  this.image = e;
@@ -232,9 +232,9 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
232
232
  height: t,
233
233
  width: n
234
234
  } } : {}
235
- }), /* @__PURE__ */ m(E, { ref: (e) => {
235
+ }), /* @__PURE__ */ p(E, { ref: (e) => {
236
236
  this.resize = e;
237
- } })] }), /* @__PURE__ */ m(D, {
237
+ } })] }), /* @__PURE__ */ p(D, {
238
238
  height: v || t,
239
239
  width: y || n,
240
240
  onMouseDown: this.handleOnMouseDown,
@@ -242,35 +242,35 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
242
242
  onMouseMove: this.handleMouseMove,
243
243
  onContentMouseOut: this.handleOnMouseOutOrLeave,
244
244
  onContentMouseLeave: this.handleOnMouseOutOrLeave,
245
- children: /* @__PURE__ */ m(S, { children: b.map((e, o) => {
246
- let m;
245
+ children: /* @__PURE__ */ p(S, { children: b.map((e, o) => {
246
+ let p;
247
247
  switch (e.group) {
248
- case i.RECTANGLES:
249
- m = c;
248
+ case r.RECTANGLES:
249
+ p = s;
250
250
  break;
251
- case i.CIRCLES:
252
- m = u;
251
+ case r.CIRCLES:
252
+ p = l;
253
253
  break;
254
- case i.POLYGONS:
255
- m = l;
254
+ case r.POLYGONS:
255
+ p = c;
256
256
  break;
257
257
  default: return null;
258
258
  }
259
- return /* @__PURE__ */ f(m, {
260
- ...e.group === i.CIRCLES ? { radius: e.radius } : {},
261
- ...e.group === i.RECTANGLES ? {
259
+ return /* @__PURE__ */ d(p, {
260
+ ...e.group === r.CIRCLES ? { radius: e.radius } : {},
261
+ ...e.group === r.RECTANGLES ? {
262
262
  height: e.height,
263
263
  width: e.width
264
264
  } : {},
265
- ...e.group === i.POLYGONS ? {
265
+ ...e.group === r.POLYGONS ? {
266
266
  points: e.points,
267
267
  addPolygonPoint: (e) => this.addPolygonPoint(e)
268
268
  } : {},
269
269
  correct: e.correct,
270
270
  isDrawing: _,
271
- hotspotColor: r,
272
- hoverOutlineColor: d,
273
- selectedHotspotColor: p,
271
+ hotspotColor: i,
272
+ hoverOutlineColor: f,
273
+ selectedHotspotColor: h,
274
274
  id: e.id,
275
275
  key: o,
276
276
  onClick: () => this.handleOnSetAsCorrect(e),
@@ -280,7 +280,7 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
280
280
  width: e.width,
281
281
  x: e.x,
282
282
  y: e.y,
283
- strokeWidth: s,
283
+ strokeWidth: u,
284
284
  imageHeight: v || t,
285
285
  imageWidth: y || n,
286
286
  ...e.group === "polygons" ? { addPolygonPoint: (e) => this.addPolygonPoint(e) } : {}
@@ -290,23 +290,23 @@ var x = b(v, "Stage"), S = b(_, "Layer"), C = g("div")({ position: "relative" })
290
290
  }
291
291
  };
292
292
  k.propTypes = {
293
- disableDrag: p.func.isRequired,
294
- dimensions: p.object.isRequired,
295
- enableDrag: p.func.isRequired,
296
- shapeType: p.oneOf(Object.values(a)),
297
- imageUrl: p.string.isRequired,
298
- handleFinishDrawing: p.func.isRequired,
299
- hotspotColor: p.string.isRequired,
300
- selectedHotspotColor: p.string,
301
- hoverOutlineColor: p.string,
302
- multipleCorrect: p.bool.isRequired,
303
- onUpdateImageDimension: p.func.isRequired,
304
- onUpdateShapes: p.func.isRequired,
305
- onDeleteShape: p.func.isRequired,
306
- outlineColor: p.string.isRequired,
307
- shapes: p.array.isRequired,
308
- strokeWidth: p.number,
309
- preserveAspectRatioEnabled: p.bool
293
+ disableDrag: f.func.isRequired,
294
+ dimensions: f.object.isRequired,
295
+ enableDrag: f.func.isRequired,
296
+ shapeType: f.oneOf(Object.values(i)),
297
+ imageUrl: f.string.isRequired,
298
+ handleFinishDrawing: f.func.isRequired,
299
+ hotspotColor: f.string.isRequired,
300
+ selectedHotspotColor: f.string,
301
+ hoverOutlineColor: f.string,
302
+ multipleCorrect: f.bool.isRequired,
303
+ onUpdateImageDimension: f.func.isRequired,
304
+ onUpdateShapes: f.func.isRequired,
305
+ onDeleteShape: f.func.isRequired,
306
+ outlineColor: f.string.isRequired,
307
+ shapes: f.array.isRequired,
308
+ strokeWidth: f.number,
309
+ preserveAspectRatioEnabled: f.bool
310
310
  };
311
311
  //#endregion
312
- export { k as default };
312
+ export { k as Drawable, k as default };
@@ -87,7 +87,7 @@ var d = u(a, "Circle"), f = u(s, "Line"), p = u(o, "Group"), m = "#00BFFF", h =
87
87
  this.setState({
88
88
  points: a,
89
89
  ...this.getOffset(a),
90
- isDragging: t ? !1 : this.state.isDragging
90
+ isDragging: !t && this.state.isDragging
91
91
  }), t && n(r, { points: a });
92
92
  };
93
93
  handleOnDragVertex = (e, t, n) => {
@@ -98,7 +98,7 @@ var d = u(a, "Circle"), f = u(s, "Line"), p = u(o, "Group"), m = "#00BFFF", h =
98
98
  this.setState({
99
99
  points: o,
100
100
  ...this.getOffset(o),
101
- isDragging: n ? !1 : this.state.isDragging
101
+ isDragging: !n && this.state.isDragging
102
102
  }), n && r(i, { points: o });
103
103
  };
104
104
  onDragStart = () => {
@@ -48,5 +48,6 @@ export default class HotspotConfigure extends HTMLElement {
48
48
  insertSound(handler: any): void;
49
49
  onDeleteSound(src: any, done: any): void;
50
50
  _render(): void;
51
+ connectedCallback(): void;
51
52
  disconnectedCallback(): void;
52
53
  }
@@ -1,4 +1,4 @@
1
- import e from "./root.js";
1
+ import { Root as e } from "./root.js";
2
2
  import t from "./defaults.js";
3
3
  import n from "react";
4
4
  import { createRoot as r } from "react-dom/client";
@@ -135,8 +135,11 @@ var u = i("hotspot:configure"), d = class i extends HTMLElement {
135
135
  });
136
136
  this._root ||= r(this), this._root.render(t);
137
137
  }
138
+ connectedCallback() {
139
+ this._render();
140
+ }
138
141
  disconnectedCallback() {
139
- this._root && this._root.unmount();
142
+ this._root &&= (this._root.unmount(), null);
140
143
  }
141
144
  };
142
145
  //#endregion