@pie-element/hotspot 11.1.2-next.1 → 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.
- package/dist/author/hotspot-container.js +2 -2
- package/dist/author/hotspot-drawable.js +1 -1
- package/dist/author/hotspot-polygon.js +2 -2
- package/dist/author/index.d.ts +1 -0
- package/dist/author/index.js +5 -2
- package/dist/author/root.js +52 -52
- package/dist/author/utils.js +1 -1
- package/dist/browser/{ReactKonva-Z9-1H-UZ.js → ReactKonva-Cj44B3Ds.js} +3504 -3535
- package/dist/browser/ReactKonva-Cj44B3Ds.js.map +1 -0
- package/dist/browser/author/index.js +24273 -21426
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/{browser-CfnAFove.js → browser-D4gLESxz.js} +9 -2
- package/dist/browser/{browser-CfnAFove.js.map → browser-D4gLESxz.js.map} +1 -1
- package/dist/browser/controller/index.js +32 -32
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +628 -519
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/{dist-C78LDz6R.js → dist-CJeYAWp3.js} +6 -2
- package/dist/browser/dist-CJeYAWp3.js.map +1 -0
- package/dist/controller/index.js +36 -36
- package/dist/controller/utils.js +1 -1
- package/dist/delivery/hotspot/circle.d.ts +3 -0
- package/dist/delivery/hotspot/circle.js +40 -27
- package/dist/delivery/hotspot/container.d.ts +5 -0
- package/dist/delivery/hotspot/container.js +163 -96
- package/dist/delivery/hotspot/index.d.ts +1 -0
- package/dist/delivery/hotspot/index.js +41 -36
- package/dist/delivery/hotspot/polygon.d.ts +3 -0
- package/dist/delivery/hotspot/polygon.js +39 -26
- package/dist/delivery/hotspot/rectangle.d.ts +3 -0
- package/dist/delivery/hotspot/rectangle.js +40 -28
- package/dist/delivery/index.js +3 -3
- package/dist/index.iife.js +40 -40
- package/package.json +16 -17
- package/dist/browser/ReactKonva-Z9-1H-UZ.js.map +0 -1
- package/dist/browser/dist-C78LDz6R.js.map +0 -1
|
@@ -40,6 +40,10 @@ function o(e) {
|
|
|
40
40
|
return t;
|
|
41
41
|
}
|
|
42
42
|
function s(e, t, r) {
|
|
43
|
+
if (!Array.isArray(t) && e != null && Object.prototype.hasOwnProperty.call(Object(e), t)) {
|
|
44
|
+
let n = e[t];
|
|
45
|
+
return n === void 0 ? r : n;
|
|
46
|
+
}
|
|
43
47
|
let i = e;
|
|
44
48
|
for (let e of n(t)) {
|
|
45
49
|
if (i == null) return r;
|
|
@@ -48,7 +52,7 @@ function s(e, t, r) {
|
|
|
48
52
|
return i === void 0 ? r : i;
|
|
49
53
|
}
|
|
50
54
|
function c(e) {
|
|
51
|
-
return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : t(e)
|
|
55
|
+
return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : !t(e) || Object.keys(e).length === 0;
|
|
52
56
|
}
|
|
53
57
|
function l(n, r, i) {
|
|
54
58
|
let a = i?.(n, r);
|
|
@@ -93,4 +97,4 @@ function h(...e) {
|
|
|
93
97
|
//#endregion
|
|
94
98
|
export { f as a, m as c, s as d, o as f, c as i, h as l, p as n, a as o, d as r, r as s, u as t, i as u };
|
|
95
99
|
|
|
96
|
-
//# sourceMappingURL=dist-
|
|
100
|
+
//# sourceMappingURL=dist-CJeYAWp3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-CJeYAWp3.js","names":[],"sources":["../../../../shared/lodash/dist/index.js"],"sourcesContent":["//#region src/index.ts\nvar e = Object.prototype;\nfunction t(e) {\n\treturn typeof e == \"object\" && !!e;\n}\nfunction n(e) {\n\treturn Array.isArray(e) ? e : typeof e == \"number\" ? [e] : e.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\").filter(Boolean);\n}\nfunction r(e) {\n\treturn (t) => x(t, e);\n}\nfunction i(e) {\n\treturn (n) => t(n) ? Object.entries(e).every(([e, t]) => A(n[e], t)) : !1;\n}\nfunction a(e) {\n\treturn typeof e == \"function\" ? e : typeof e == \"string\" ? r(e) : t(e) ? i(e) : ((e) => e);\n}\nfunction o(e, ...t) {\n\treturn Object.assign(e, ...t.filter(Boolean));\n}\nfunction s(e, t = 1) {\n\tif (!e?.length || t < 1) return [];\n\tlet n = [];\n\tfor (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));\n\treturn n;\n}\nfunction c(e) {\n\treturn Array.isArray(e) ? e.slice() : t(e) ? { ...e } : e;\n}\nfunction l(e) {\n\tif (!t(e)) return e;\n\tif (e instanceof Date) return new Date(e.getTime());\n\tif (Array.isArray(e)) return e.map((e) => l(e));\n\tlet n = {};\n\tfor (let [t, r] of Object.entries(e)) n[t] = l(r);\n\treturn n;\n}\nfunction u(e) {\n\treturn (e ?? []).filter(Boolean);\n}\nfunction d(e, ...t) {\n\tlet n = [...e ?? []];\n\tfor (let e of t) Array.isArray(e) ? n.push(...e) : n.push(e);\n\treturn n;\n}\nfunction f(e, t = 0, n = {}) {\n\tlet r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {\n\t\tif (!a) return s;\n\t\tlet t = a, n = o;\n\t\treturn a = void 0, o = void 0, s = e.apply(n, t), s;\n\t}, d = () => {\n\t\tr && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;\n\t}, f = function(...e) {\n\t\tlet d = c && !r;\n\t\treturn a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {\n\t\t\tr = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);\n\t\t}, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {\n\t\t\tr && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);\n\t\t}, n.maxWait)), s;\n\t};\n\treturn f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;\n}\nfunction p(e, ...t) {\n\tfor (let n of t) if (n) for (let [t, r] of Object.entries(n)) e[t] === void 0 && (e[t] = r);\n\treturn e;\n}\nfunction m(e, ...t) {\n\tlet n = new Set(t.flat());\n\treturn (e ?? []).filter((e) => !n.has(e));\n}\nfunction h(e, t, n) {\n\treturn (e ?? []).filter((e) => !(t ?? []).some((t) => n(e, t)));\n}\nfunction g(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [t, i] of r) if (!n(i, t, e)) return !1;\n\treturn !0;\n}\nfunction ee(e) {\n\treturn String(e).replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\").replace(/'/g, \"'\");\n}\nfunction _(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [t, i] of r) if (n(i, t, e)) return i;\n}\nfunction v(e, t) {\n\tlet n = a(t);\n\tfor (let [t, r] of Object.entries(e ?? {})) if (n(r, t, e)) return t;\n}\nfunction y(e) {\n\tlet t = [];\n\tfor (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);\n\treturn t;\n}\nfunction te(e, t) {\n\treturn R(e, t).flat();\n}\nfunction b(e, t) {\n\tlet n = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [r, i] of n) t(i, r, e);\n\treturn e;\n}\nfunction x(e, t, r) {\n\tif (!Array.isArray(t) && e != null && Object.prototype.hasOwnProperty.call(Object(e), t)) {\n\t\tlet n = e[t];\n\t\treturn n === void 0 ? r : n;\n\t}\n\tlet i = e;\n\tfor (let e of n(t)) {\n\t\tif (i == null) return r;\n\t\ti = i[e];\n\t}\n\treturn i === void 0 ? r : i;\n}\nfunction S(e, t) {\n\tlet n = a(t);\n\treturn K(e, (t, r, i) => {\n\t\tlet a = String(n(r, i, e));\n\t\treturn (t[a] ??= []).push(r), t;\n\t}, {});\n}\nfunction C(e) {\n\treturn e?.[0];\n}\nfunction w(e) {\n\treturn (e ?? []).slice(0, -1);\n}\nfunction T(e, t) {\n\treturn typeof e == \"string\" ? e.includes(String(t)) : Array.isArray(e) ? e.includes(t) : Object.values(e ?? {}).includes(t);\n}\nfunction E(...e) {\n\tlet [t, ...n] = e;\n\treturn $((t ?? []).filter((e) => n.every((t) => (t ?? []).includes(e))));\n}\nfunction D(e) {\n\treturn Array.isArray(e);\n}\nfunction O(e) {\n\treturn e == null ? !0 : typeof e == \"string\" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : !t(e) || Object.keys(e).length === 0;\n}\nfunction k(n, r, i) {\n\tlet a = i?.(n, r);\n\tif (a !== void 0) return !!a;\n\tif (Object.is(n, r)) return !0;\n\tif (!t(n) || !t(r)) return !1;\n\tif (n instanceof Date || r instanceof Date) return n instanceof Date && r instanceof Date && n.getTime() === r.getTime();\n\tif (Array.isArray(n) || Array.isArray(r)) return Array.isArray(n) && Array.isArray(r) && n.length === r.length && n.every((e, t) => k(e, r[t], i));\n\tlet o = Object.keys(n), s = Object.keys(r);\n\treturn o.length === s.length && o.every((t) => e.hasOwnProperty.call(r, t) && k(n[t], r[t], i));\n}\nfunction A(e, t) {\n\treturn k(e, t);\n}\nfunction j(e, t, n) {\n\treturn k(e, t, n);\n}\nfunction M(e) {\n\treturn Number.isFinite(e);\n}\nfunction N(e) {\n\treturn typeof e == \"function\";\n}\nfunction P(e) {\n\treturn typeof e == \"number\" || e instanceof Number;\n}\nfunction F(e) {\n\treturn typeof e == \"object\" && !!e || typeof e == \"function\";\n}\nfunction I(e) {\n\treturn typeof e == \"string\" || e instanceof String;\n}\nfunction L(e) {\n\treturn e === void 0;\n}\nfunction R(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {}), i = [];\n\tfor (let [t, a] of r) i.push(n(a, t, e));\n\treturn i;\n}\nfunction z(e) {\n\treturn e?.length ? Math.max(...e) : void 0;\n}\nfunction B(e, ...n) {\n\tfor (let r of n) if (r) for (let [n, i] of Object.entries(r)) t(i) && !Array.isArray(i) && t(e[n]) ? B(e[n], i) : e[n] = l(i);\n\treturn e;\n}\nfunction V(e, t) {\n\tlet n = { ...e ?? {} };\n\tfor (let e of Array.isArray(t) ? t : [t]) delete n[e];\n\treturn n;\n}\nfunction H(e, t) {\n\tlet n = a(t), r = {};\n\tfor (let [t, i] of Object.entries(e ?? {})) n(i, t, e) || (r[t] = i);\n\treturn r;\n}\nfunction U(e, ...t) {\n\tlet n = {};\n\tfor (let r of t.flat()) e && r in e && (n[r] = e[r]);\n\treturn n;\n}\nfunction W(e, t, n = 1) {\n\tlet r = t ?? e, i = t === void 0 ? 0 : e;\n\tif (n === 0) return [];\n\tlet a = [], o = n > 0;\n\tfor (let e = i; o ? e < r : e > r; e += n) a.push(e);\n\treturn a;\n}\nfunction G(e, t, n = 1) {\n\treturn W(e, t, n).reverse();\n}\nfunction K(e, t, n) {\n\tlet r = n, i = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [n, a] of i) r = t(r, a, n, e);\n\treturn r;\n}\nfunction q(e, t) {\n\tlet n = a(t), r = [];\n\tfor (let t = e.length - 1; t >= 0; t--) n(e[t], t, e) && r.unshift(...e.splice(t, 1));\n\treturn r;\n}\nfunction J(e, t, r) {\n\tlet i = n(t), a = e;\n\treturn i.forEach((e, t) => {\n\t\tif (t === i.length - 1) {\n\t\t\ta[e] = r;\n\t\t\treturn;\n\t\t}\n\t\tlet n = i[t + 1];\n\t\ta[e] ??= typeof n == \"number\" || /^\\d+$/.test(String(n)) ? [] : {}, a = a[e];\n\t}), e;\n}\nfunction Y(e) {\n\tlet t = [...e ?? []];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction X(e) {\n\treturn (e ?? []).slice(1);\n}\nfunction Z(e, t = 1) {\n\treturn t <= 0 ? [] : (e ?? []).slice(-t);\n}\nfunction Q(e, t = 0, n = {}) {\n\treturn f(e, t, {\n\t\tleading: n.leading !== !1,\n\t\ttrailing: n.trailing !== !1,\n\t\tmaxWait: t\n\t});\n}\nfunction ne(e, t) {\n\tlet n = t ?? ((e) => e);\n\treturn Array.from({ length: Math.max(0, e) }, (e, t) => n(t));\n}\nvar re = 0;\nfunction ie(e = \"\") {\n\treturn re += 1, `${e}${re}`;\n}\nfunction $(e) {\n\treturn Array.from(new Set(e ?? []));\n}\nfunction ae(e, t) {\n\tlet n = [];\n\tfor (let r of e ?? []) n.some((e) => t(r, e)) || n.push(r);\n\treturn n;\n}\nfunction oe(...e) {\n\tlet t = Math.max(0, ...e.map((e) => e.length));\n\treturn Array.from({ length: t }, (t, n) => e.map((e) => e[n]));\n}\nvar se = {\n\tassign: o,\n\tchunk: s,\n\tclone: c,\n\tcloneDeep: l,\n\tcompact: u,\n\tconcat: d,\n\tdebounce: f,\n\tdefaults: p,\n\tdifference: m,\n\tdifferenceWith: h,\n\tevery: g,\n\tescape: ee,\n\tfind: _,\n\tfindKey: v,\n\tflatten: y,\n\tflatMap: te,\n\tforEach: b,\n\tget: x,\n\tgroupBy: S,\n\thead: C,\n\tincludes: T,\n\tinitial: w,\n\tintersection: E,\n\tisArray: D,\n\tisEmpty: O,\n\tisEqual: A,\n\tisEqualWith: j,\n\tisFinite: M,\n\tisFunction: N,\n\tisNumber: P,\n\tisObject: F,\n\tisString: I,\n\tisUndefined: L,\n\tmap: R,\n\tmax: z,\n\tmerge: B,\n\tomit: V,\n\tomitBy: H,\n\tpick: U,\n\trange: W,\n\trangeRight: G,\n\treduce: K,\n\tremove: q,\n\tset: J,\n\tshuffle: Y,\n\ttail: X,\n\ttakeRight: Z,\n\tthrottle: Q,\n\ttimes: ne,\n\tuniqueId: ie,\n\tuniq: $,\n\tuniqWith: ae,\n\tzip: oe\n};\n//#endregion\nexport { o as assign, s as chunk, c as clone, l as cloneDeep, u as compact, d as concat, f as debounce, se as default, p as defaults, m as difference, h as differenceWith, ee as escape, g as every, _ as find, v as findKey, te as flatMap, y as flatten, b as forEach, x as get, S as groupBy, C as head, T as includes, w as initial, E as intersection, D as isArray, O as isEmpty, A as isEqual, j as isEqualWith, M as isFinite, N as isFunction, P as isNumber, F as isObject, I as isString, L as isUndefined, R as map, z as max, B as merge, V as omit, H as omitBy, U as pick, W as range, G as rangeRight, K as reduce, q as remove, J as set, Y as shuffle, X as tail, Z as takeRight, Q as throttle, ne as times, $ as uniq, ae as uniqWith, ie as uniqueId, oe as zip };\n"],"mappings":"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"}
|
package/dist/controller/index.js
CHANGED
|
@@ -4,40 +4,40 @@ import n from "debug";
|
|
|
4
4
|
import { isEmpty as r } from "@pie-element/shared-lodash";
|
|
5
5
|
import { partialScoring as i } from "@pie-element/shared-controller-utils";
|
|
6
6
|
//#region src/controller/index.ts
|
|
7
|
-
var a = n("pie-elements:hotspot:controller"), o = (e) => ({
|
|
7
|
+
var a = n("pie-elements:hotspot:controller"), o = (e) => e != null, s = (e) => ({
|
|
8
8
|
...t,
|
|
9
9
|
...e
|
|
10
10
|
});
|
|
11
|
-
function
|
|
12
|
-
let i =
|
|
11
|
+
function c(t, n, r) {
|
|
12
|
+
let i = s(t), { imageUrl: a, dimensions: c, hotspotColor: l, hoverOutlineColor: u, selectedHotspotColor: d, multipleCorrect: f, outlineColor: p, partialScoring: m, prompt: h, shapes: g, language: _, fontSizeFactor: v, autoplayAudioEnabled: y, completeAudioEnabled: b, customAudioButton: x } = i, { rectangles: S, polygons: C, circles: w } = g || {}, T = r.mode === "evaluate" || r.role === "instructor" && r.mode === "view";
|
|
13
13
|
return new Promise((t) => {
|
|
14
|
-
let
|
|
14
|
+
let s = {
|
|
15
15
|
disabled: r.mode !== "gather",
|
|
16
16
|
mode: r.mode,
|
|
17
|
-
dimensions:
|
|
17
|
+
dimensions: c,
|
|
18
18
|
imageUrl: a,
|
|
19
|
-
outlineColor:
|
|
20
|
-
hotspotColor:
|
|
21
|
-
hoverOutlineColor:
|
|
22
|
-
selectedHotspotColor:
|
|
23
|
-
multipleCorrect:
|
|
24
|
-
partialScoring:
|
|
25
|
-
language:
|
|
26
|
-
fontSizeFactor:
|
|
27
|
-
autoplayAudioEnabled:
|
|
28
|
-
completeAudioEnabled:
|
|
29
|
-
customAudioButton:
|
|
19
|
+
outlineColor: p,
|
|
20
|
+
hotspotColor: l,
|
|
21
|
+
hoverOutlineColor: o(u) ? u : "black",
|
|
22
|
+
selectedHotspotColor: d,
|
|
23
|
+
multipleCorrect: f,
|
|
24
|
+
partialScoring: m,
|
|
25
|
+
language: _,
|
|
26
|
+
fontSizeFactor: v,
|
|
27
|
+
autoplayAudioEnabled: y,
|
|
28
|
+
completeAudioEnabled: b,
|
|
29
|
+
customAudioButton: x,
|
|
30
30
|
shapes: {
|
|
31
|
-
...
|
|
32
|
-
rectangles: (
|
|
31
|
+
...g,
|
|
32
|
+
rectangles: (S || []).map(({ index: e, correct: t, ...n }) => T ? {
|
|
33
33
|
correct: t,
|
|
34
34
|
...n
|
|
35
35
|
} : { ...n }),
|
|
36
|
-
polygons: (
|
|
36
|
+
polygons: (C || []).map(({ index: e, correct: t, ...n }) => T ? {
|
|
37
37
|
correct: t,
|
|
38
38
|
...n
|
|
39
39
|
} : { ...n }),
|
|
40
|
-
circles: (
|
|
40
|
+
circles: (w || []).map(({ index: e, correct: t, ...n }) => T ? {
|
|
41
41
|
correct: t,
|
|
42
42
|
...n
|
|
43
43
|
} : { ...n })
|
|
@@ -45,15 +45,15 @@ function s(t, n, r) {
|
|
|
45
45
|
responseCorrect: r.mode === "evaluate" ? e(i, n) : void 0,
|
|
46
46
|
extraCSSRules: i.extraCSSRules
|
|
47
47
|
};
|
|
48
|
-
r.role === "instructor" && (r.mode === "view" || r.mode === "evaluate") ? (
|
|
48
|
+
r.role === "instructor" && (r.mode === "view" || r.mode === "evaluate") ? (s.rationale = i.rationaleEnabled ? i.rationale : null, s.teacherInstructions = i.teacherInstructionsEnabled ? i.teacherInstructions : null) : (s.rationale = null, s.teacherInstructions = null), s.prompt = i.promptEnabled ? h : null, s.strokeWidth = i.strokeWidth, t(s);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
var
|
|
51
|
+
var l = (e = {}) => new Promise((n) => {
|
|
52
52
|
n({
|
|
53
53
|
...t,
|
|
54
54
|
...e
|
|
55
55
|
});
|
|
56
|
-
}),
|
|
56
|
+
}), u = (t, n, r = {}) => {
|
|
57
57
|
let { answers: a } = n || {};
|
|
58
58
|
if (!t.shapes || !t.shapes.rectangles && !t.shapes.polygons && !t.shapes.circles) return 0;
|
|
59
59
|
let { shapes: { rectangles: o = [], polygons: s = [], circles: c = [] } = {} } = t;
|
|
@@ -69,11 +69,11 @@ var c = (e = {}) => new Promise((n) => {
|
|
|
69
69
|
});
|
|
70
70
|
let p = u > f.length ? u - f.length : 0, m = f.length === 0 ? 1 : f.length, h = ((l - p) / m).toFixed(2);
|
|
71
71
|
return h < 0 ? 0 : parseFloat(h);
|
|
72
|
-
},
|
|
72
|
+
}, d = (e, t, n) => {
|
|
73
73
|
let r = [], { answers: a } = t || {}, { shapes: o } = e || {}, s = [];
|
|
74
74
|
o && (o.rectangles && s.push(...o.rectangles), o.polygons && s.push(...o.polygons), o.circles && s.push(...o.circles));
|
|
75
|
-
let c = s.filter((e) => e.correct),
|
|
76
|
-
if (r.push(`Total of ${
|
|
75
|
+
let c = s.filter((e) => e.correct), l = s.length;
|
|
76
|
+
if (r.push(`Total of ${l} hotspot(s) defined, ${c.length} correct.`), a && a.length > 0) {
|
|
77
77
|
r.push(`Student selected ${a.length} hotspot(s).`);
|
|
78
78
|
let e = 0, t = 0;
|
|
79
79
|
a.forEach((n) => {
|
|
@@ -97,19 +97,19 @@ var c = (e = {}) => new Promise((n) => {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
} else r.push("Score calculated using all-or-nothing scoring.");
|
|
100
|
-
let d =
|
|
100
|
+
let d = u(e, t, n);
|
|
101
101
|
return r.push(`Score: ${d}.`), r;
|
|
102
102
|
};
|
|
103
|
-
function
|
|
103
|
+
function f(e, t, n = {}) {
|
|
104
104
|
return new Promise((i) => {
|
|
105
105
|
if (a("outcome..."), (!t || r(t)) && i({
|
|
106
106
|
score: 0,
|
|
107
107
|
empty: !0,
|
|
108
108
|
traceLog: ["No hotspots selected. Score: 0."]
|
|
109
109
|
}), t.answers) {
|
|
110
|
-
let r =
|
|
110
|
+
let r = d(e, t, n);
|
|
111
111
|
i({
|
|
112
|
-
score:
|
|
112
|
+
score: u(e, t, n),
|
|
113
113
|
empty: !1,
|
|
114
114
|
traceLog: r
|
|
115
115
|
});
|
|
@@ -120,15 +120,15 @@ function d(e, t, n = {}) {
|
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
|
-
var
|
|
123
|
+
var p = (e) => {
|
|
124
124
|
let t = [];
|
|
125
125
|
return e.forEach((e) => {
|
|
126
126
|
let { correct: n, id: r } = e;
|
|
127
127
|
n && t.push({ id: r });
|
|
128
128
|
}), t;
|
|
129
|
-
},
|
|
129
|
+
}, m = (e, t) => new Promise((n) => {
|
|
130
130
|
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
131
|
-
let { shapes: { rectangles: t = [], circles: r = [], polygons: i = {} } = {} } = e, a =
|
|
131
|
+
let { shapes: { rectangles: t = [], circles: r = [], polygons: i = {} } = {} } = e, a = p(t), o = p(i), s = p(r);
|
|
132
132
|
n({
|
|
133
133
|
answers: [
|
|
134
134
|
...a,
|
|
@@ -138,17 +138,17 @@ var f = (e) => {
|
|
|
138
138
|
id: "1"
|
|
139
139
|
});
|
|
140
140
|
} else n(null);
|
|
141
|
-
}),
|
|
141
|
+
}), h = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), g = (e = {}, t = {}) => {
|
|
142
142
|
let { shapes: n } = e, { minShapes: r = 2, maxShapes: i, maxSelections: a } = t, o = {};
|
|
143
143
|
[
|
|
144
144
|
"teacherInstructions",
|
|
145
145
|
"prompt",
|
|
146
146
|
"rationale"
|
|
147
147
|
].forEach((n) => {
|
|
148
|
-
t[n]?.required && !
|
|
148
|
+
t[n]?.required && !h(e[n]) && (o[n] = "This field is required.");
|
|
149
149
|
});
|
|
150
150
|
let s = Object.values(n || {}).reduce((e, t) => [...e, ...t], []), c = (s || []).reduce((e, t) => t.correct ? e + 1 : e, 0), l = (s || []).length;
|
|
151
151
|
return l < r ? o.shapes = `There should be at least ${r} shapes defined.` : l > i && (o.shapes = `No more than ${i} shapes should be defined.`), c < 1 ? o.selections = "There should be at least 1 shape selected." : c > a && (o.selections = `No more than ${a} shapes should be selected.`), o;
|
|
152
152
|
};
|
|
153
153
|
//#endregion
|
|
154
|
-
export {
|
|
154
|
+
export { m as createCorrectResponseSession, l as createDefaultModel, d as getLogTrace, c as model, s as normalize, f as outcome, g as validate };
|
package/dist/controller/utils.js
CHANGED
|
@@ -9,4 +9,4 @@ var n = (e) => e.filter((e) => e.correct).map((e) => e.id).sort(), r = (r, i) =>
|
|
|
9
9
|
return !i || e(i) ? !1 : i.answers && i.answers.length ? t((i.answers || []).map((e) => e.id).sort(), c) : !(c && c.length);
|
|
10
10
|
};
|
|
11
11
|
//#endregion
|
|
12
|
-
export { r as isResponseCorrect };
|
|
12
|
+
export { n as getCorrectResponse, r as isResponseCorrect };
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
declare class CircleComponent extends React.Component {
|
|
11
11
|
constructor(props: any);
|
|
12
|
+
componentDidMount(): void;
|
|
13
|
+
componentDidUpdate(prevProps: any): void;
|
|
14
|
+
moveGroupToTop: any;
|
|
12
15
|
handleClick: any;
|
|
13
16
|
handleMouseEnter: any;
|
|
14
17
|
handleMouseLeave: any;
|
|
@@ -13,8 +13,17 @@ function d(e, t) {
|
|
|
13
13
|
}
|
|
14
14
|
var f = d(l, "Rect"), p = d(c, "Group"), m = d(s, "Circle"), h = class extends r.Component {
|
|
15
15
|
constructor(e) {
|
|
16
|
-
super(e), this.state = { hovered: !1 };
|
|
16
|
+
super(e), this.state = { hovered: !1 }, this.groupRef = r.createRef();
|
|
17
17
|
}
|
|
18
|
+
componentDidMount() {
|
|
19
|
+
this.props.focused && this.moveGroupToTop();
|
|
20
|
+
}
|
|
21
|
+
componentDidUpdate(e) {
|
|
22
|
+
!e.focused && this.props.focused && this.moveGroupToTop();
|
|
23
|
+
}
|
|
24
|
+
moveGroupToTop = () => {
|
|
25
|
+
this.groupRef.current && this.groupRef.current.moveToTop();
|
|
26
|
+
};
|
|
18
27
|
handleClick = (e) => {
|
|
19
28
|
let { onClick: t, id: n, selected: r, disabled: i } = this.props;
|
|
20
29
|
i || (e.cancelBubble = !0, t({
|
|
@@ -25,7 +34,7 @@ var f = d(l, "Rect"), p = d(c, "Group"), m = d(s, "Circle"), h = class extends r
|
|
|
25
34
|
};
|
|
26
35
|
handleMouseEnter = () => {
|
|
27
36
|
let { disabled: e } = this.props;
|
|
28
|
-
e || (document.body.style.cursor = "pointer"), this.setState({ hovered: !0 });
|
|
37
|
+
e || (document.body.style.cursor = "pointer"), this.setState({ hovered: !0 }), this.moveGroupToTop();
|
|
29
38
|
};
|
|
30
39
|
handleMouseLeave = () => {
|
|
31
40
|
document.body.style.cursor = "default", this.setState({ hovered: !1 });
|
|
@@ -33,39 +42,41 @@ var f = d(l, "Rect"), p = d(c, "Group"), m = d(s, "Circle"), h = class extends r
|
|
|
33
42
|
getEvaluateOutlineColor = (e, t, n) => t ? "green" : e ? n : "red";
|
|
34
43
|
getOutlineWidth = (e, t, n, r) => n || !n && !e && t ? r : 0;
|
|
35
44
|
render() {
|
|
36
|
-
let { radius: r, hotspotColor: i, isCorrect: s, isEvaluateMode: c, hoverOutlineColor: l, outlineColor: u, selected: d,
|
|
37
|
-
|
|
38
|
-
let
|
|
45
|
+
let { radius: r, hotspotColor: i, isCorrect: s, isEvaluateMode: c, hoverOutlineColor: l, outlineColor: u, selected: d, focused: h, x: g, y: _, evaluateText: v, strokeWidth: y, scale: b, markAsCorrect: x, selectedHotspotColor: S, showCorrectEnabled: C } = this.props, { hovered: w } = this.state, T = c ? this.getEvaluateOutlineColor(s, x, u) : u, E = this.getOutlineWidth(C, d, x, y), D = g - 10, O = _ - 10, k;
|
|
46
|
+
C ? (d && s || !d && !s) && (k = t) : d ? k = s ? t : n : s || (k = n);
|
|
47
|
+
let A = (w || h) && l;
|
|
39
48
|
return /* @__PURE__ */ o(p, {
|
|
40
|
-
|
|
41
|
-
|
|
49
|
+
ref: this.groupRef,
|
|
50
|
+
scaleX: b,
|
|
51
|
+
scaleY: b,
|
|
52
|
+
onMouseLeave: this.handleMouseLeave,
|
|
53
|
+
onMouseEnter: this.handleMouseEnter,
|
|
42
54
|
children: [
|
|
43
|
-
k && /* @__PURE__ */ a(f, {
|
|
44
|
-
x: h - r,
|
|
45
|
-
y: g - r,
|
|
46
|
-
width: r * 2,
|
|
47
|
-
height: r * 2,
|
|
48
|
-
stroke: d ? "transparent" : l,
|
|
49
|
-
strokeWidth: v
|
|
50
|
-
}),
|
|
51
55
|
/* @__PURE__ */ a(m, {
|
|
52
56
|
radius: r,
|
|
53
|
-
fill: d &&
|
|
57
|
+
fill: d && S ? S : i,
|
|
54
58
|
onClick: this.handleClick,
|
|
55
59
|
onTap: this.handleClick,
|
|
56
60
|
draggable: !1,
|
|
57
|
-
stroke:
|
|
58
|
-
strokeWidth:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
stroke: A && !d ? "transparent" : T,
|
|
62
|
+
strokeWidth: A && !d ? 0 : E,
|
|
63
|
+
x: g,
|
|
64
|
+
y: _
|
|
65
|
+
}),
|
|
66
|
+
A && /* @__PURE__ */ a(f, {
|
|
67
|
+
x: g - r,
|
|
68
|
+
y: _ - r,
|
|
69
|
+
width: r * 2,
|
|
70
|
+
height: r * 2,
|
|
71
|
+
stroke: l,
|
|
72
|
+
strokeWidth: y,
|
|
73
|
+
listening: !1
|
|
63
74
|
}),
|
|
64
|
-
c &&
|
|
65
|
-
src:
|
|
66
|
-
x:
|
|
67
|
-
y:
|
|
68
|
-
tooltip:
|
|
75
|
+
c && k ? /* @__PURE__ */ a(e, {
|
|
76
|
+
src: k,
|
|
77
|
+
x: D,
|
|
78
|
+
y: O,
|
|
79
|
+
tooltip: v
|
|
69
80
|
}) : null
|
|
70
81
|
]
|
|
71
82
|
});
|
|
@@ -78,6 +89,7 @@ h.propTypes = {
|
|
|
78
89
|
isCorrect: i.oneOfType([i.bool, i.string]),
|
|
79
90
|
isEvaluateMode: i.bool.isRequired,
|
|
80
91
|
disabled: i.bool.isRequired,
|
|
92
|
+
focused: i.bool,
|
|
81
93
|
hoverOutlineColor: i.string,
|
|
82
94
|
onClick: i.func.isRequired,
|
|
83
95
|
outlineColor: i.string.isRequired,
|
|
@@ -93,6 +105,7 @@ h.propTypes = {
|
|
|
93
105
|
}, h.defaultProps = {
|
|
94
106
|
isCorrect: !1,
|
|
95
107
|
evaluateText: null,
|
|
108
|
+
focused: !1,
|
|
96
109
|
strokeWidth: 5,
|
|
97
110
|
scale: 1
|
|
98
111
|
};
|
|
@@ -8,9 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import React from 'react';
|
|
10
10
|
export declare class Container extends React.Component {
|
|
11
|
+
constructor(props: any);
|
|
11
12
|
isSelected(shape: any): boolean;
|
|
12
13
|
correctness: (isCorrect: any, isChecked: any) => any;
|
|
13
14
|
getEvaluateText: any;
|
|
15
|
+
getAllShapesSorted: any;
|
|
16
|
+
handleShapeFocus: any;
|
|
17
|
+
handleShapeBlur: any;
|
|
18
|
+
handleShapeKeyDown: any;
|
|
14
19
|
render(): React.JSX.Element;
|
|
15
20
|
}
|
|
16
21
|
export default Container;
|
|
@@ -19,118 +19,185 @@ var f = d(l, "Stage"), p = d(c, "Layer"), m = s("div")(({ theme: e }) => ({
|
|
|
19
19
|
position: "relative",
|
|
20
20
|
background: e.palette.common.white,
|
|
21
21
|
border: `${e.spacing(1)} solid ${e.palette.common.white}`,
|
|
22
|
-
width: "fit-content"
|
|
23
|
-
|
|
22
|
+
width: "fit-content",
|
|
23
|
+
maxWidth: "100%",
|
|
24
|
+
overflowX: "auto"
|
|
25
|
+
})), h = s("span")({
|
|
26
|
+
position: "absolute",
|
|
27
|
+
width: 1,
|
|
28
|
+
height: 1,
|
|
29
|
+
overflow: "hidden",
|
|
30
|
+
clip: "rect(0, 0, 0, 0)",
|
|
31
|
+
whiteSpace: "nowrap"
|
|
32
|
+
}), g = s("div")({
|
|
24
33
|
position: "relative",
|
|
25
34
|
width: "fit-content"
|
|
26
|
-
}),
|
|
35
|
+
}), _ = s("img")({
|
|
27
36
|
alignItems: "center",
|
|
28
37
|
display: "flex",
|
|
29
38
|
justifyContent: "center"
|
|
30
|
-
}),
|
|
39
|
+
}), v = s(f)({
|
|
31
40
|
left: 0,
|
|
32
41
|
top: 0,
|
|
33
42
|
position: "absolute"
|
|
34
|
-
}),
|
|
43
|
+
}), y = class extends r.Component {
|
|
44
|
+
constructor(e) {
|
|
45
|
+
super(e), this.state = { focusedShapeId: null };
|
|
46
|
+
}
|
|
35
47
|
isSelected(e) {
|
|
36
48
|
return !!this.props.session.answers.filter((t) => t.id === e.id)[0];
|
|
37
49
|
}
|
|
38
50
|
correctness = (e, t) => e ? t : !t;
|
|
39
51
|
getEvaluateText = (e, t) => t && e ? "Correctly\nselected" : t && !e ? "Should not have\nbeen selected" : !t && e ? "Should have\nbeen selected" : null;
|
|
52
|
+
getAllShapesSorted = () => {
|
|
53
|
+
let { shapes: { rectangles: e = [], polygons: t = [], circles: n = [] } } = this.props, r = [
|
|
54
|
+
...e.map((e) => ({
|
|
55
|
+
...e,
|
|
56
|
+
type: "rectangle"
|
|
57
|
+
})),
|
|
58
|
+
...t.map((e) => ({
|
|
59
|
+
...e,
|
|
60
|
+
type: "polygon"
|
|
61
|
+
})),
|
|
62
|
+
...n.map((e) => ({
|
|
63
|
+
...e,
|
|
64
|
+
type: "circle"
|
|
65
|
+
}))
|
|
66
|
+
];
|
|
67
|
+
return r.sort((e, t) => String(e.id).localeCompare(String(t.id), void 0, { numeric: !0 })), r;
|
|
68
|
+
};
|
|
69
|
+
handleShapeFocus = (e) => {
|
|
70
|
+
this.setState({ focusedShapeId: e });
|
|
71
|
+
};
|
|
72
|
+
handleShapeBlur = () => {
|
|
73
|
+
this.setState({ focusedShapeId: null });
|
|
74
|
+
};
|
|
75
|
+
handleShapeKeyDown = (e, t) => {
|
|
76
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
let { onSelectChoice: n, disabled: r } = this.props;
|
|
79
|
+
if (!r) {
|
|
80
|
+
let e = this.getAllShapesSorted().find((e) => e.id === t);
|
|
81
|
+
e && n({
|
|
82
|
+
id: t,
|
|
83
|
+
selected: !this.isSelected(e),
|
|
84
|
+
selector: "Keyboard"
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
40
89
|
render() {
|
|
41
|
-
let { dimensions: { width: r, height: i }, disabled: s, hotspotColor: c, hoverOutlineColor: l, selectedHotspotColor: u, imageUrl: d, isEvaluateMode: f, outlineColor:
|
|
90
|
+
let { dimensions: { width: r, height: i }, disabled: s, hotspotColor: c, hoverOutlineColor: l, selectedHotspotColor: u, imageUrl: d, isEvaluateMode: f, outlineColor: y, onSelectChoice: b, shapes: { rectangles: x = [], polygons: S = [], circles: C = [] }, scale: w, strokeWidth: T, showCorrect: E } = this.props, { focusedShapeId: D } = this.state, O = r * w, k = i * w, A = this.getAllShapesSorted();
|
|
42
91
|
return /* @__PURE__ */ o(m, {
|
|
43
|
-
style: { padding:
|
|
44
|
-
children: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
92
|
+
style: { padding: T / 2 },
|
|
93
|
+
children: [
|
|
94
|
+
d ? /* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(_, {
|
|
95
|
+
alt: "hotspot-image",
|
|
96
|
+
height: "auto",
|
|
97
|
+
src: d,
|
|
98
|
+
style: {
|
|
99
|
+
width: O,
|
|
100
|
+
height: k,
|
|
101
|
+
maxWidth: O,
|
|
102
|
+
maxHeight: k
|
|
103
|
+
}
|
|
104
|
+
}) }) : null,
|
|
105
|
+
/* @__PURE__ */ a(v, {
|
|
106
|
+
height: k + T,
|
|
107
|
+
width: O + T,
|
|
108
|
+
x: T / 2,
|
|
109
|
+
y: T / 2,
|
|
110
|
+
children: /* @__PURE__ */ o(p, { children: [
|
|
111
|
+
x.map((t) => {
|
|
112
|
+
let n = this.isSelected(t), r = f ? this.correctness(t.correct, n) : void 0, i = f ? this.getEvaluateText(t.correct, n) : null, o = !!(f && E && t.correct);
|
|
113
|
+
return /* @__PURE__ */ a(e, {
|
|
114
|
+
scale: w,
|
|
115
|
+
isEvaluateMode: f,
|
|
116
|
+
isCorrect: r,
|
|
117
|
+
evaluateText: i,
|
|
118
|
+
disabled: s,
|
|
119
|
+
selected: n,
|
|
120
|
+
height: t.height,
|
|
121
|
+
hotspotColor: c,
|
|
122
|
+
hoverOutlineColor: l,
|
|
123
|
+
selectedHotspotColor: u,
|
|
124
|
+
id: t.id,
|
|
125
|
+
onClick: b,
|
|
126
|
+
outlineColor: y,
|
|
127
|
+
width: t.width,
|
|
128
|
+
x: t.x,
|
|
129
|
+
y: t.y,
|
|
130
|
+
strokeWidth: T,
|
|
131
|
+
markAsCorrect: o,
|
|
132
|
+
showCorrectEnabled: E,
|
|
133
|
+
focused: D === t.id
|
|
134
|
+
}, t.id);
|
|
135
|
+
}),
|
|
136
|
+
S.map((e) => {
|
|
137
|
+
let n = this.isSelected(e), r = f ? this.correctness(e.correct, n) : void 0, i = f ? this.getEvaluateText(e.correct, n) : null, o = !!(f && E && e.correct);
|
|
138
|
+
return /* @__PURE__ */ a(t, {
|
|
139
|
+
scale: w,
|
|
140
|
+
isEvaluateMode: f,
|
|
141
|
+
isCorrect: !!r,
|
|
142
|
+
evaluateText: i,
|
|
143
|
+
disabled: s,
|
|
144
|
+
selected: n,
|
|
145
|
+
hotspotColor: c,
|
|
146
|
+
id: e.id,
|
|
147
|
+
onClick: b,
|
|
148
|
+
outlineColor: y,
|
|
149
|
+
points: e.points,
|
|
150
|
+
strokeWidth: T,
|
|
151
|
+
markAsCorrect: o,
|
|
152
|
+
selectedHotspotColor: u,
|
|
153
|
+
hoverOutlineColor: l,
|
|
154
|
+
showCorrectEnabled: E,
|
|
155
|
+
focused: D === e.id
|
|
156
|
+
}, e.id);
|
|
157
|
+
}),
|
|
158
|
+
C.map((e) => {
|
|
159
|
+
let t = this.isSelected(e), r = f ? this.correctness(e.correct, t) : void 0, i = f ? this.getEvaluateText(e.correct, t) : null, o = !!(f && E && e.correct);
|
|
160
|
+
return /* @__PURE__ */ a(n, {
|
|
161
|
+
scale: w,
|
|
162
|
+
isEvaluateMode: f,
|
|
163
|
+
isCorrect: r,
|
|
164
|
+
evaluateText: i,
|
|
165
|
+
disabled: s,
|
|
166
|
+
selected: t,
|
|
167
|
+
radius: e.radius,
|
|
168
|
+
hotspotColor: c,
|
|
169
|
+
id: e.id,
|
|
170
|
+
onClick: b,
|
|
171
|
+
outlineColor: y,
|
|
172
|
+
x: e.x,
|
|
173
|
+
y: e.y,
|
|
174
|
+
strokeWidth: T,
|
|
175
|
+
markAsCorrect: o,
|
|
176
|
+
selectedHotspotColor: u,
|
|
177
|
+
hoverOutlineColor: l,
|
|
178
|
+
showCorrectEnabled: E,
|
|
179
|
+
focused: D === e.id
|
|
180
|
+
}, e.id);
|
|
181
|
+
})
|
|
182
|
+
] })
|
|
183
|
+
}),
|
|
184
|
+
A.map((e) => {
|
|
185
|
+
let t = this.isSelected(e);
|
|
186
|
+
return /* @__PURE__ */ a(h, {
|
|
187
|
+
tabIndex: s ? -1 : 0,
|
|
188
|
+
role: "button",
|
|
189
|
+
"aria-label": e.ariaLabel || "",
|
|
190
|
+
"aria-pressed": t,
|
|
191
|
+
onFocus: () => this.handleShapeFocus(e.id),
|
|
192
|
+
onBlur: this.handleShapeBlur,
|
|
193
|
+
onKeyDown: (t) => this.handleShapeKeyDown(t, e.id)
|
|
194
|
+
}, `focus-${e.id}`);
|
|
195
|
+
})
|
|
196
|
+
]
|
|
130
197
|
});
|
|
131
198
|
}
|
|
132
199
|
};
|
|
133
|
-
|
|
200
|
+
y.propTypes = {
|
|
134
201
|
dimensions: i.object.isRequired,
|
|
135
202
|
disabled: i.bool.isRequired,
|
|
136
203
|
hotspotColor: i.string.isRequired,
|
|
@@ -145,6 +212,6 @@ v.propTypes = {
|
|
|
145
212
|
strokeWidth: i.number,
|
|
146
213
|
scale: i.number,
|
|
147
214
|
showCorrect: i.bool
|
|
148
|
-
},
|
|
215
|
+
}, y.defaultProps = { scale: 1 };
|
|
149
216
|
//#endregion
|
|
150
|
-
export {
|
|
217
|
+
export { y as Container, y as default };
|