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

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 (144) hide show
  1. package/dist/author/hotspot-drawable.js +119 -119
  2. package/dist/author/utils.js +9 -9
  3. package/dist/browser/{ReactKonva-Z9-1H-UZ.js → ReactKonva-DI5WIo8o.js} +3920 -3913
  4. package/dist/browser/ReactKonva-DI5WIo8o.js.map +1 -0
  5. package/dist/browser/author/index.js +6218 -6869
  6. package/dist/browser/author/index.js.map +1 -1
  7. package/dist/browser/browser-CfnAFove.js +13 -4
  8. package/dist/browser/controller/index.js +1 -1
  9. package/dist/browser/controller/index.js.map +1 -1
  10. package/dist/browser/delivery/index.js +19 -19
  11. package/dist/browser/dist-C78LDz6R.js +96 -0
  12. package/dist/browser/dist-C78LDz6R.js.map +1 -0
  13. package/dist/controller/index.js +24 -24
  14. package/dist/controller/utils.d.ts +1 -1
  15. package/dist/controller/utils.js +1 -2
  16. package/dist/index.iife.js +38 -38
  17. package/dist/runtime-support.d.ts +12 -0
  18. package/dist/runtime-support.js +12 -0
  19. package/package.json +12 -9
  20. package/dist/browser/ReactKonva-Z9-1H-UZ.js.map +0 -1
  21. package/dist/browser/isEqual-D3CTSc6W.js +0 -601
  22. package/dist/browser/isEqual-D3CTSc6W.js.map +0 -1
  23. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  24. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
  25. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
  26. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  27. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
  28. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  29. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  30. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
  31. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
  32. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  33. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
  34. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  35. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
  36. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
  37. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  38. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
  39. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
  40. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
  41. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
  42. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
@@ -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
312
  export { k as default };
@@ -1,5 +1,5 @@
1
- import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js";
2
- import { SHAPE_GROUPS as t } from "./shapes/utils.js";
1
+ import { SHAPE_GROUPS as e } from "./shapes/utils.js";
2
+ import { cloneDeep as t } from "@pie-element/shared-lodash";
3
3
  //#region src/author/utils.ts
4
4
  var n = (e, t, n, r) => {
5
5
  if (n) {
@@ -33,10 +33,10 @@ var n = (e, t, n, r) => {
33
33
  x: r(e.width, t.width, n.x),
34
34
  y: r(e.height, t.height, n.y)
35
35
  }))
36
- }), s = (e, n, r) => r.map((r) => {
37
- if (r.group === t.RECTANGLES) return i(e, n, r);
38
- if (r.group === t.POLYGONS) return o(e, n, r);
39
- if (r.group === t.CIRCLES) return a(e, n, r);
36
+ }), s = (t, n, r) => r.map((r) => {
37
+ if (r.group === e.RECTANGLES) return i(t, n, r);
38
+ if (r.group === e.POLYGONS) return o(t, n, r);
39
+ if (r.group === e.CIRCLES) return a(t, n, r);
40
40
  }), c = (e) => {
41
41
  e ||= {};
42
42
  let t = [], n = Object.keys(e);
@@ -45,14 +45,14 @@ var n = (e, t, n, r) => {
45
45
  group: n,
46
46
  index: e.index || t.length + r
47
47
  })) : []), t) : t;
48
- }, l = (t) => {
49
- t ||= [];
48
+ }, l = (e) => {
49
+ e ||= [];
50
50
  let n = {
51
51
  rectangles: [],
52
52
  polygons: [],
53
53
  circles: []
54
54
  };
55
- return t.length ? t.reduce((e, { group: t, ...n }) => (e[t] = [...e[t] || [], n], e), n) : e(n);
55
+ return e.length ? e.reduce((e, { group: t, ...n }) => (e[t] = [...e[t] || [], n], e), n) : t(n);
56
56
  }, u = (e, t, n) => {
57
57
  let r = !1;
58
58
  if (!e || e.length <= 0) return r;