@pie-element/hotspot 11.1.2-next.1 → 11.1.2-next.11

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 (36) hide show
  1. package/dist/author/hotspot-container.js +2 -2
  2. package/dist/author/hotspot-drawable.js +1 -1
  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 +1 -1
  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 +24273 -21426
  11. package/dist/browser/author/index.js.map +1 -1
  12. package/dist/browser/{browser-CfnAFove.js → browser-D4gLESxz.js} +9 -2
  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-C78LDz6R.js → dist-CJeYAWp3.js} +6 -2
  19. package/dist/browser/dist-CJeYAWp3.js.map +1 -0
  20. package/dist/controller/index.js +36 -36
  21. package/dist/controller/utils.js +1 -1
  22. package/dist/delivery/hotspot/circle.d.ts +3 -0
  23. package/dist/delivery/hotspot/circle.js +40 -27
  24. package/dist/delivery/hotspot/container.d.ts +5 -0
  25. package/dist/delivery/hotspot/container.js +163 -96
  26. package/dist/delivery/hotspot/index.d.ts +1 -0
  27. package/dist/delivery/hotspot/index.js +41 -36
  28. package/dist/delivery/hotspot/polygon.d.ts +3 -0
  29. package/dist/delivery/hotspot/polygon.js +39 -26
  30. package/dist/delivery/hotspot/rectangle.d.ts +3 -0
  31. package/dist/delivery/hotspot/rectangle.js +40 -28
  32. package/dist/delivery/index.js +3 -3
  33. package/dist/index.iife.js +40 -40
  34. package/package.json +17 -18
  35. package/dist/browser/ReactKonva-Z9-1H-UZ.js.map +0 -1
  36. package/dist/browser/dist-C78LDz6R.js.map +0 -1
@@ -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 };
@@ -309,4 +309,4 @@ k.propTypes = {
309
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
@@ -1,6 +1,6 @@
1
1
  import e from "./hotspot-palette.js";
2
2
  import { generateValidationMessage as t, getAllShapes as n, getUpdatedShapes as r, groupShapes as i, updateImageDimensions as a } from "./utils.js";
3
- import o from "./hotspot-container.js";
3
+ import { Container as o } from "./hotspot-container.js";
4
4
  import s from "react";
5
5
  import c from "prop-types";
6
6
  import { jsx as l, jsxs as u } from "react/jsx-runtime";
@@ -8,10 +8,10 @@ import { styled as d } from "@mui/material/styles";
8
8
  import { InputContainer as f, NumberTextField as p, layout as m, settings as h } from "@pie-lib/config-ui";
9
9
  import g from "@pie-lib/editable-html-tip-tap";
10
10
  import _ from "@mui/material/Typography";
11
- import v from "@mui/icons-material/Info";
12
- import y from "@mui/material/Tooltip";
11
+ import ee from "@mui/icons-material/Info";
12
+ import v from "@mui/material/Tooltip";
13
13
  //#region src/author/root.tsx
14
- var { Panel: ee, toggle: b, dropdown: te } = h, ne = d("div")(({ theme: e }) => ({
14
+ var { Panel: te, toggle: y, dropdown: b } = h, ne = (e) => e != null, re = d("div")(({ theme: e }) => ({
15
15
  display: "flex",
16
16
  marginBottom: e.spacing(1.5)
17
17
  })), x = d("div")({
@@ -22,18 +22,18 @@ var { Panel: ee, toggle: b, dropdown: te } = h, ne = d("div")(({ theme: e }) =>
22
22
  marginTop: e.spacing(2),
23
23
  marginBottom: e.spacing(2),
24
24
  width: "100%"
25
- })), C = d(_)(({ theme: e }) => ({ marginRight: e.spacing(1) })), re = d("div")({
25
+ })), ie = d(_)(({ theme: e }) => ({ marginRight: e.spacing(1) })), ae = d("div")({
26
26
  display: "flex",
27
27
  alignItems: "center"
28
- }), ie = d(y)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
28
+ }), oe = d(v)(({ theme: e }) => ({ "& .MuiTooltip-tooltip": {
29
29
  fontSize: e.typography.fontSize - 2,
30
30
  whiteSpace: "pre",
31
31
  maxWidth: "500px"
32
- } })), w = d("div")(({ theme: e }) => ({
32
+ } })), C = d("div")(({ theme: e }) => ({
33
33
  fontSize: e.typography.fontSize - 2,
34
34
  color: e.palette.error.main,
35
35
  paddingTop: e.spacing(1)
36
- })), T = class extends s.Component {
36
+ })), w = class extends s.Component {
37
37
  handleColorChange = (e, t) => {
38
38
  let { onColorChanged: n } = this.props;
39
39
  n(`${e}Color`, t);
@@ -46,56 +46,56 @@ var { Panel: ee, toggle: b, dropdown: te } = h, ne = d("div")(({ theme: e }) =>
46
46
  u(i(r(o, d, n(s)))), l(d);
47
47
  };
48
48
  render() {
49
- let { configuration: n, model: r, imageSupport: i, uploadSoundSupport: a, onConfigurationChanged: c, onImageUpload: d, onModelChangedByConfig: f, onPromptChanged: h, onRationaleChanged: y, onUpdateImageDimension: T, onTeacherInstructionsChanged: ae, onUpdateShapes: E } = this.props, { baseInputConfiguration: oe = {}, contentDimensions: se = {}, maxImageWidth: D = {}, maxImageHeight: O = {}, multipleCorrect: k = {}, partialScoring: A = {}, preserveAspectRatio: j = {}, prompt: M = {}, rationale: N = {}, settingsPanelDisabled: ce, spellCheck: P = {}, teacherInstructions: F = {}, withRubric: I = {}, mathMlOptions: L = {}, language: R = {}, languageChoices: z = {} } = n || {}, { errors: B, extraCSSRules: V, promptEnabled: H, rationaleEnabled: U, spellCheckEnabled: W, teacherInstructionsEnabled: le, toolbarEditorPosition: ue } = r || {}, { prompt: G, rationale: K, shapes: q, selections: J, teacherInstructions: Y } = B || {}, de = t(n), X = D && D.prompt, Z = O && O.prompt, Q = { position: ue === "top" ? "top" : "bottom" }, fe = {
50
- multipleCorrect: k.settings && b(k.label),
51
- partialScoring: A.settings && b(A.label),
52
- promptEnabled: M.settings && b(M.label),
53
- "language.enabled": R.settings && b(R.label, !0),
54
- language: R.settings && R.enabled && te(z.label, z.options)
55
- }, pe = {
56
- teacherInstructionsEnabled: F.settings && b(F.label),
57
- rationaleEnabled: N.settings && b(N.label),
58
- spellCheckEnabled: P.settings && b(P.label),
59
- rubricEnabled: I?.settings && b(I?.label)
49
+ let { configuration: n, model: r, imageSupport: i, uploadSoundSupport: a, onConfigurationChanged: c, onImageUpload: d, onModelChangedByConfig: f, onPromptChanged: h, onRationaleChanged: v, onUpdateImageDimension: w, onTeacherInstructionsChanged: se, onUpdateShapes: ce } = this.props, { baseInputConfiguration: le = {}, contentDimensions: T = {}, maxImageWidth: E = {}, maxImageHeight: D = {}, multipleCorrect: O = {}, partialScoring: k = {}, preserveAspectRatio: A = {}, prompt: j = {}, rationale: M = {}, settingsPanelDisabled: N, spellCheck: P = {}, teacherInstructions: F = {}, withRubric: I = {}, mathMlOptions: L = {}, language: R = {}, languageChoices: z = {} } = n || {}, { errors: B, extraCSSRules: V, promptEnabled: H, rationaleEnabled: U, spellCheckEnabled: W, teacherInstructionsEnabled: ue, toolbarEditorPosition: de } = r || {}, { prompt: G, rationale: K, shapes: q, selections: J, teacherInstructions: Y } = B || {}, fe = t(n), X = E && E.prompt, Z = D && D.prompt, Q = { position: de === "top" ? "top" : "bottom" }, pe = {
50
+ multipleCorrect: O.settings && y(O.label),
51
+ partialScoring: k.settings && y(k.label),
52
+ promptEnabled: j.settings && y(j.label),
53
+ "language.enabled": R.settings && y(R.label, !0),
54
+ language: R.settings && R.enabled && b(z.label, z.options)
55
+ }, me = {
56
+ teacherInstructionsEnabled: F.settings && y(F.label),
57
+ rationaleEnabled: M.settings && y(M.label),
58
+ spellCheckEnabled: P.settings && y(P.label),
59
+ rubricEnabled: I?.settings && y(I?.label)
60
60
  }, $ = (e = {}) => ({
61
- ...oe,
61
+ ...le,
62
62
  ...e
63
63
  });
64
64
  return /* @__PURE__ */ u(m.ConfigLayout, {
65
65
  extraCSSRules: V,
66
- dimensions: se,
67
- hideSettings: ce,
68
- settings: /* @__PURE__ */ l(ee, {
66
+ dimensions: T,
67
+ hideSettings: N,
68
+ settings: /* @__PURE__ */ l(te, {
69
69
  model: r,
70
70
  onChangeModel: f,
71
71
  configuration: n,
72
72
  onChangeConfiguration: c,
73
73
  groups: {
74
- Settings: fe,
75
- Properties: pe
74
+ Settings: pe,
75
+ Properties: me
76
76
  }
77
77
  }),
78
78
  children: [
79
- le && /* @__PURE__ */ u(S, {
79
+ ue && /* @__PURE__ */ u(S, {
80
80
  label: F.label,
81
81
  children: [/* @__PURE__ */ l(g, {
82
82
  markup: r.teacherInstructions || "",
83
- onChange: ae,
83
+ onChange: se,
84
84
  imageSupport: i,
85
85
  nonEmpty: !1,
86
86
  error: Y,
87
87
  toolbarOpts: Q,
88
88
  pluginProps: $(F?.inputConfiguration),
89
89
  spellCheck: W,
90
- maxImageWidth: D && D.teacherInstructions || X,
91
- maxImageHeight: O && O.teacherInstructions || Z,
90
+ maxImageWidth: E && E.teacherInstructions || X,
91
+ maxImageHeight: D && D.teacherInstructions || Z,
92
92
  uploadSoundSupport: a,
93
93
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
94
94
  mathMlOptions: L
95
- }), Y && /* @__PURE__ */ l(w, { children: Y })]
95
+ }), Y && /* @__PURE__ */ l(C, { children: Y })]
96
96
  }),
97
97
  H && /* @__PURE__ */ u(S, {
98
- label: M.label,
98
+ label: j.label,
99
99
  children: [/* @__PURE__ */ l(g, {
100
100
  markup: r.prompt || "",
101
101
  onChange: h,
@@ -103,24 +103,24 @@ var { Panel: ee, toggle: b, dropdown: te } = h, ne = d("div")(({ theme: e }) =>
103
103
  nonEmpty: !1,
104
104
  error: G,
105
105
  toolbarOpts: Q,
106
- pluginProps: $(M?.inputConfiguration),
106
+ pluginProps: $(j?.inputConfiguration),
107
107
  spellCheck: W,
108
108
  maxImageWidth: X,
109
109
  maxImageHeight: Z,
110
110
  uploadSoundSupport: a,
111
111
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
112
112
  mathMlOptions: L
113
- }), G && /* @__PURE__ */ l(w, { children: G })]
113
+ }), G && /* @__PURE__ */ l(C, { children: G })]
114
114
  }),
115
- /* @__PURE__ */ u(re, { children: [/* @__PURE__ */ l(C, {
115
+ /* @__PURE__ */ u(ae, { children: [/* @__PURE__ */ l(ie, {
116
116
  variant: "h6",
117
117
  children: "Define Hotspot"
118
- }), /* @__PURE__ */ l(ie, {
118
+ }), /* @__PURE__ */ l(oe, {
119
119
  disableFocusListener: !0,
120
120
  disableTouchListener: !0,
121
121
  placement: "left",
122
- title: de,
123
- children: /* @__PURE__ */ l(v, {
122
+ title: fe,
123
+ children: /* @__PURE__ */ l(ee, {
124
124
  fontSize: "small",
125
125
  color: "primary",
126
126
  style: { float: "right" }
@@ -142,21 +142,21 @@ var { Panel: ee, toggle: b, dropdown: te } = h, ne = d("div")(({ theme: e }) =>
142
142
  hotspotColor: r.hotspotColor,
143
143
  outlineColor: r.outlineColor,
144
144
  selectedHotspotColor: r.selectedHotspotColor,
145
- hoverOutlineColor: r.hoverOutlineColor,
146
- onUpdateImageDimension: T,
147
- onUpdateShapes: E,
145
+ hoverOutlineColor: ne(r.hoverOutlineColor) ? r.hoverOutlineColor : "black",
146
+ onUpdateImageDimension: w,
147
+ onUpdateShapes: ce,
148
148
  onImageUpload: d,
149
149
  shapes: r.shapes,
150
150
  strokeWidth: r.strokeWidth,
151
- preserveAspectRatioEnabled: j.enabled,
151
+ preserveAspectRatioEnabled: A.enabled,
152
152
  insertImage: i && i.add
153
153
  }),
154
- q && /* @__PURE__ */ l(w, { children: q }),
155
- J && /* @__PURE__ */ l(w, { children: J }),
154
+ q && /* @__PURE__ */ l(C, { children: q }),
155
+ J && /* @__PURE__ */ l(C, { children: J }),
156
156
  r.imageUrl && /* @__PURE__ */ u(s.Fragment, { children: [/* @__PURE__ */ l(_, {
157
157
  variant: "h6",
158
158
  children: "Image Dimensions"
159
- }), /* @__PURE__ */ u(ne, { children: [/* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(p, {
159
+ }), /* @__PURE__ */ u(re, { children: [/* @__PURE__ */ l(x, { children: /* @__PURE__ */ l(p, {
160
160
  label: "Width",
161
161
  value: r.dimensions.width,
162
162
  min: 0,
@@ -170,27 +170,27 @@ var { Panel: ee, toggle: b, dropdown: te } = h, ne = d("div")(({ theme: e }) =>
170
170
  showErrorWhenOutsideRange: !0
171
171
  }, "hotspot-manual-height") })] })] }),
172
172
  U && /* @__PURE__ */ u(S, {
173
- label: N.label,
173
+ label: M.label,
174
174
  children: [/* @__PURE__ */ l(g, {
175
175
  markup: r.rationale || "",
176
- onChange: y,
176
+ onChange: v,
177
177
  imageSupport: i,
178
178
  error: K,
179
179
  toolbarOpts: Q,
180
- pluginProps: $(N?.inputConfiguration),
180
+ pluginProps: $(M?.inputConfiguration),
181
181
  spellCheck: W,
182
- maxImageWidth: D && D.rationale || X,
183
- maxImageHeight: O && O.rationale || Z,
182
+ maxImageWidth: E && E.rationale || X,
183
+ maxImageHeight: D && D.rationale || Z,
184
184
  uploadSoundSupport: a,
185
185
  languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
186
186
  mathMlOptions: L
187
- }), K && /* @__PURE__ */ l(w, { children: K })]
187
+ }), K && /* @__PURE__ */ l(C, { children: K })]
188
188
  })
189
189
  ]
190
190
  });
191
191
  }
192
192
  };
193
- T.propTypes = {
193
+ w.propTypes = {
194
194
  configuration: c.object,
195
195
  model: c.object.isRequired,
196
196
  imageSupport: c.shape({
@@ -212,4 +212,4 @@ T.propTypes = {
212
212
  onTeacherInstructionsChanged: c.func.isRequired
213
213
  };
214
214
  //#endregion
215
- export { T as default };
215
+ export { w as Root, w as default };
@@ -80,4 +80,4 @@ var n = (e, t, n, r) => {
80
80
  return "Validation requirements:" + i + a;
81
81
  };
82
82
  //#endregion
83
- export { d as calculate, f as generateValidationMessage, c as getAllShapes, s as getUpdatedShapes, l as groupShapes, n as updateImageDimensions };
83
+ export { d as calculate, f as generateValidationMessage, c as getAllShapes, o as getUpdatedPolygon, i as getUpdatedRectangle, s as getUpdatedShapes, l as groupShapes, u as isPointInsidePolygon, n as updateImageDimensions };