@pie-element/hotspot 11.2.0-beta.0 → 11.2.0-next.18
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/author.js +2 -0
- package/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/DeleteWidget.d.ts +38 -0
- package/dist/author/DeleteWidget.js +46 -0
- package/dist/author/button.d.ts +31 -0
- package/dist/author/button.js +27 -0
- package/dist/author/buttons/circle.d.ts +18 -0
- package/dist/author/buttons/circle.js +25 -0
- package/dist/author/buttons/polygon.d.ts +18 -0
- package/dist/author/buttons/polygon.js +36 -0
- package/dist/author/buttons/rectangle.d.ts +18 -0
- package/dist/author/buttons/rectangle.js +36 -0
- package/dist/author/defaults.d.ts +157 -0
- package/dist/author/defaults.js +119 -0
- package/dist/author/hotspot-circle.d.ts +21 -0
- package/dist/author/hotspot-circle.js +124 -0
- package/dist/author/hotspot-container.d.ts +29 -0
- package/dist/author/hotspot-container.js +210 -0
- package/dist/author/hotspot-drawable.d.ts +31 -0
- package/dist/author/hotspot-drawable.js +312 -0
- package/dist/author/hotspot-palette.d.ts +14 -0
- package/dist/author/hotspot-palette.js +72 -0
- package/dist/author/hotspot-polygon.d.ts +38 -0
- package/dist/author/hotspot-polygon.js +200 -0
- package/dist/author/hotspot-rectangle.d.ts +20 -0
- package/dist/author/hotspot-rectangle.js +119 -0
- package/dist/author/icons.d.ts +9 -0
- package/dist/author/icons.js +4 -0
- package/dist/author/image-konva.d.ts +19 -0
- package/dist/author/image-konva.js +49 -0
- package/dist/author/index.d.ts +53 -0
- package/dist/author/index.js +146 -0
- package/dist/author/root.d.ts +15 -0
- package/dist/author/root.js +215 -0
- package/dist/author/shapes/circle.d.ts +18 -0
- package/dist/author/shapes/circle.js +47 -0
- package/dist/author/shapes/index.d.ts +12 -0
- package/dist/author/shapes/polygon.d.ts +19 -0
- package/dist/author/shapes/polygon.js +51 -0
- package/dist/author/shapes/rectagle.d.ts +18 -0
- package/dist/author/shapes/rectagle.js +57 -0
- package/dist/author/shapes/utils.d.ts +19 -0
- package/dist/author/shapes/utils.js +16 -0
- package/dist/author/upload-control.d.ts +29 -0
- package/dist/author/upload-control.js +28 -0
- package/dist/author/utils.d.ts +24 -0
- package/dist/author/utils.js +83 -0
- package/dist/browser/ReactKonva-e9jPRlPL.js +19304 -0
- package/dist/browser/ReactKonva-e9jPRlPL.js.map +1 -0
- package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/author/index.js +37002 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/browser-D4gLESxz.js +226 -0
- package/dist/browser/browser-D4gLESxz.js.map +1 -0
- package/dist/browser/controller/index.js +198 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +2673 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-CJeYAWp3.js +100 -0
- package/dist/browser/dist-CJeYAWp3.js.map +1 -0
- package/dist/controller/defaults.d.ts +35 -0
- package/dist/controller/defaults.js +29 -0
- package/dist/controller/index.d.ts +22 -0
- package/dist/controller/index.js +154 -0
- package/dist/controller/utils.d.ts +10 -0
- package/dist/controller/utils.js +12 -0
- package/dist/delivery/hotspot/circle.d.ts +22 -0
- package/dist/delivery/hotspot/circle.js +113 -0
- package/dist/delivery/hotspot/container.d.ts +21 -0
- package/dist/delivery/hotspot/container.js +217 -0
- package/dist/delivery/hotspot/icons.d.ts +10 -0
- package/dist/delivery/hotspot/icons.js +4 -0
- package/dist/delivery/hotspot/image-konva-tooltip.d.ts +19 -0
- package/dist/delivery/hotspot/image-konva-tooltip.js +66 -0
- package/dist/delivery/hotspot/index.d.ts +18 -0
- package/dist/delivery/hotspot/index.js +119 -0
- package/dist/delivery/hotspot/polygon.d.ts +24 -0
- package/dist/delivery/hotspot/polygon.js +121 -0
- package/dist/delivery/hotspot/rectangle.d.ts +22 -0
- package/dist/delivery/hotspot/rectangle.js +116 -0
- package/dist/delivery/index.d.ts +20 -0
- package/dist/delivery/index.js +109 -0
- package/dist/delivery/session-updater.d.ts +10 -0
- package/dist/delivery/session-updater.js +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +169 -0
- package/dist/index.js +2 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +84 -19
- package/CHANGELOG.json +0 -997
- package/CHANGELOG.md +0 -2230
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -682
- package/configure/CHANGELOG.md +0 -1964
- package/configure/lib/DeleteWidget.js +0 -64
- package/configure/lib/DeleteWidget.js.map +0 -1
- package/configure/lib/button.js +0 -42
- package/configure/lib/button.js.map +0 -1
- package/configure/lib/buttons/circle.js +0 -33
- package/configure/lib/buttons/circle.js.map +0 -1
- package/configure/lib/buttons/polygon.js +0 -39
- package/configure/lib/buttons/polygon.js.map +0 -1
- package/configure/lib/buttons/rectangle.js +0 -39
- package/configure/lib/buttons/rectangle.js.map +0 -1
- package/configure/lib/defaults.js +0 -155
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/hotspot-circle.js +0 -192
- package/configure/lib/hotspot-circle.js.map +0 -1
- package/configure/lib/hotspot-container.js +0 -320
- package/configure/lib/hotspot-container.js.map +0 -1
- package/configure/lib/hotspot-drawable.js +0 -519
- package/configure/lib/hotspot-drawable.js.map +0 -1
- package/configure/lib/hotspot-palette.js +0 -107
- package/configure/lib/hotspot-palette.js.map +0 -1
- package/configure/lib/hotspot-polygon.js +0 -293
- package/configure/lib/hotspot-polygon.js.map +0 -1
- package/configure/lib/hotspot-rectangle.js +0 -190
- package/configure/lib/hotspot-rectangle.js.map +0 -1
- package/configure/lib/icons.js +0 -7
- package/configure/lib/icons.js.map +0 -1
- package/configure/lib/image-konva.js +0 -66
- package/configure/lib/image-konva.js.map +0 -1
- package/configure/lib/index.js +0 -198
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/root.js +0 -331
- package/configure/lib/root.js.map +0 -1
- package/configure/lib/shapes/circle.js +0 -84
- package/configure/lib/shapes/circle.js.map +0 -1
- package/configure/lib/shapes/index.js +0 -50
- package/configure/lib/shapes/index.js.map +0 -1
- package/configure/lib/shapes/polygon.js +0 -82
- package/configure/lib/shapes/polygon.js.map +0 -1
- package/configure/lib/shapes/rectagle.js +0 -84
- package/configure/lib/shapes/rectagle.js.map +0 -1
- package/configure/lib/shapes/utils.js +0 -21
- package/configure/lib/shapes/utils.js.map +0 -1
- package/configure/lib/upload-control.js +0 -41
- package/configure/lib/upload-control.js.map +0 -1
- package/configure/lib/utils.js +0 -185
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -26
- package/configure/src/DeleteWidget.jsx +0 -51
- package/configure/src/__tests__/DeleteWidget.test.jsx +0 -366
- package/configure/src/__tests__/button.test.jsx +0 -198
- package/configure/src/__tests__/hotspot-circle.test.jsx +0 -259
- package/configure/src/__tests__/hotspot-container.test.js +0 -366
- package/configure/src/__tests__/hotspot-drawable.test.js +0 -271
- package/configure/src/__tests__/hotspot-palette.test.jsx +0 -71
- package/configure/src/__tests__/image-konva.test.jsx +0 -226
- package/configure/src/__tests__/index.test.js +0 -329
- package/configure/src/__tests__/root.test.js +0 -400
- package/configure/src/__tests__/utils.test.js +0 -241
- package/configure/src/button.jsx +0 -35
- package/configure/src/buttons/circle.jsx +0 -18
- package/configure/src/buttons/polygon.jsx +0 -29
- package/configure/src/buttons/rectangle.jsx +0 -29
- package/configure/src/defaults.js +0 -109
- package/configure/src/hotspot-circle.jsx +0 -183
- package/configure/src/hotspot-container.jsx +0 -330
- package/configure/src/hotspot-drawable.jsx +0 -527
- package/configure/src/hotspot-palette.jsx +0 -90
- package/configure/src/hotspot-polygon.jsx +0 -294
- package/configure/src/hotspot-rectangle.jsx +0 -169
- package/configure/src/icons.js +0 -5
- package/configure/src/image-konva.jsx +0 -63
- package/configure/src/index.js +0 -213
- package/configure/src/root.jsx +0 -342
- package/configure/src/shapes/circle.js +0 -81
- package/configure/src/shapes/index.js +0 -4
- package/configure/src/shapes/polygon.js +0 -81
- package/configure/src/shapes/rectagle.js +0 -82
- package/configure/src/shapes/utils.js +0 -16
- package/configure/src/upload-control.jsx +0 -33
- package/configure/src/utils.js +0 -210
- package/controller/CHANGELOG.json +0 -362
- package/controller/CHANGELOG.md +0 -1310
- package/controller/lib/defaults.js +0 -33
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -342
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -32
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -18
- package/controller/src/__tests__/index.test.js +0 -419
- package/controller/src/__tests__/utils.test.js +0 -5
- package/controller/src/defaults.js +0 -19
- package/controller/src/index.js +0 -330
- package/controller/src/utils.js +0 -29
- package/docs/config-schema.json +0 -2023
- package/docs/config-schema.json.md +0 -1495
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -122
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -11
- package/docs/pie-schema.json +0 -1204
- package/docs/pie-schema.json.md +0 -851
- package/lib/hotspot/circle.js +0 -160
- package/lib/hotspot/circle.js.map +0 -1
- package/lib/hotspot/container.js +0 -291
- package/lib/hotspot/container.js.map +0 -1
- package/lib/hotspot/icons.js +0 -8
- package/lib/hotspot/icons.js.map +0 -1
- package/lib/hotspot/image-konva-tooltip.js +0 -86
- package/lib/hotspot/image-konva-tooltip.js.map +0 -1
- package/lib/hotspot/index.js +0 -174
- package/lib/hotspot/index.js.map +0 -1
- package/lib/hotspot/polygon.js +0 -207
- package/lib/hotspot/polygon.js.map +0 -1
- package/lib/hotspot/rectangle.js +0 -178
- package/lib/hotspot/rectangle.js.map +0 -1
- package/lib/index.js +0 -214
- package/lib/index.js.map +0 -1
- package/lib/session-updater.js +0 -42
- package/lib/session-updater.js.map +0 -1
- package/src/__tests__/container.test.jsx +0 -58
- package/src/__tests__/index.test.js +0 -123
- package/src/__tests__/session-updater.test.jsx +0 -69
- package/src/hotspot/__tests__/circle.test.jsx +0 -464
- package/src/hotspot/__tests__/container.test.jsx +0 -546
- package/src/hotspot/__tests__/image-konva-tooltip.test.jsx +0 -510
- package/src/hotspot/__tests__/index.test.jsx +0 -64
- package/src/hotspot/__tests__/polygon.test.jsx +0 -502
- package/src/hotspot/__tests__/rectangle.test.jsx +0 -418
- package/src/hotspot/circle.jsx +0 -154
- package/src/hotspot/container.jsx +0 -297
- package/src/hotspot/icons.js +0 -7
- package/src/hotspot/image-konva-tooltip.jsx +0 -76
- package/src/hotspot/index.jsx +0 -179
- package/src/hotspot/polygon.jsx +0 -197
- package/src/hotspot/rectangle.jsx +0 -172
- package/src/index.js +0 -227
- package/src/session-updater.js +0 -29
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region ../../shared/lodash/dist/index.js
|
|
2
|
+
var e = Object.prototype;
|
|
3
|
+
function t(e) {
|
|
4
|
+
return typeof e == "object" && !!e;
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
return Array.isArray(e) ? e : typeof e == "number" ? [e] : e.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
if (!t(e)) return e;
|
|
11
|
+
if (e instanceof Date) return new Date(e.getTime());
|
|
12
|
+
if (Array.isArray(e)) return e.map((e) => r(e));
|
|
13
|
+
let n = {};
|
|
14
|
+
for (let [t, i] of Object.entries(e)) n[t] = r(i);
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
17
|
+
function i(e) {
|
|
18
|
+
return (e ?? []).filter(Boolean);
|
|
19
|
+
}
|
|
20
|
+
function a(e, t = 0, n = {}) {
|
|
21
|
+
let r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {
|
|
22
|
+
if (!a) return s;
|
|
23
|
+
let t = a, n = o;
|
|
24
|
+
return a = void 0, o = void 0, s = e.apply(n, t), s;
|
|
25
|
+
}, d = () => {
|
|
26
|
+
r && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;
|
|
27
|
+
}, f = function(...e) {
|
|
28
|
+
let d = c && !r;
|
|
29
|
+
return a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {
|
|
30
|
+
r = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);
|
|
31
|
+
}, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {
|
|
32
|
+
r && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);
|
|
33
|
+
}, n.maxWait)), s;
|
|
34
|
+
};
|
|
35
|
+
return f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;
|
|
36
|
+
}
|
|
37
|
+
function o(e) {
|
|
38
|
+
let t = [];
|
|
39
|
+
for (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
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
|
+
}
|
|
47
|
+
let i = e;
|
|
48
|
+
for (let e of n(t)) {
|
|
49
|
+
if (i == null) return r;
|
|
50
|
+
i = i[e];
|
|
51
|
+
}
|
|
52
|
+
return i === void 0 ? r : i;
|
|
53
|
+
}
|
|
54
|
+
function c(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;
|
|
56
|
+
}
|
|
57
|
+
function l(n, r, i) {
|
|
58
|
+
let a = i?.(n, r);
|
|
59
|
+
if (a !== void 0) return !!a;
|
|
60
|
+
if (Object.is(n, r)) return !0;
|
|
61
|
+
if (!t(n) || !t(r)) return !1;
|
|
62
|
+
if (n instanceof Date || r instanceof Date) return n instanceof Date && r instanceof Date && n.getTime() === r.getTime();
|
|
63
|
+
if (Array.isArray(n) || Array.isArray(r)) return Array.isArray(n) && Array.isArray(r) && n.length === r.length && n.every((e, t) => l(e, r[t], i));
|
|
64
|
+
let o = Object.keys(n), s = Object.keys(r);
|
|
65
|
+
return o.length === s.length && o.every((t) => e.hasOwnProperty.call(r, t) && l(n[t], r[t], i));
|
|
66
|
+
}
|
|
67
|
+
function u(e, t) {
|
|
68
|
+
return l(e, t);
|
|
69
|
+
}
|
|
70
|
+
function d(e) {
|
|
71
|
+
return Number.isFinite(e);
|
|
72
|
+
}
|
|
73
|
+
function f(e, t) {
|
|
74
|
+
let n = { ...e ?? {} };
|
|
75
|
+
for (let e of Array.isArray(t) ? t : [t]) delete n[e];
|
|
76
|
+
return n;
|
|
77
|
+
}
|
|
78
|
+
function p(e, t, r) {
|
|
79
|
+
let i = n(t), a = e;
|
|
80
|
+
return i.forEach((e, t) => {
|
|
81
|
+
if (t === i.length - 1) {
|
|
82
|
+
a[e] = r;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
let n = i[t + 1];
|
|
86
|
+
a[e] ??= typeof n == "number" || /^\d+$/.test(String(n)) ? [] : {}, a = a[e];
|
|
87
|
+
}), e;
|
|
88
|
+
}
|
|
89
|
+
function m(e, t) {
|
|
90
|
+
let n = t ?? ((e) => e);
|
|
91
|
+
return Array.from({ length: Math.max(0, e) }, (e, t) => n(t));
|
|
92
|
+
}
|
|
93
|
+
function h(...e) {
|
|
94
|
+
let t = Math.max(0, ...e.map((e) => e.length));
|
|
95
|
+
return Array.from({ length: t }, (t, n) => e.map((e) => e[n]));
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
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 };
|
|
99
|
+
|
|
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 e != null && e.length ? Array.from(new Set(Array.from(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":";AACA,IAAI,IAAI,OAAO;AACf,SAAS,EAAE,GAAG;CACb,OAAO,OAAO,KAAK,YAAY,CAAC,CAAC;AAClC;AACA,SAAS,EAAE,GAAG;CACb,OAAO,MAAM,QAAQ,CAAC,IAAI,IAAI,OAAO,KAAK,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,cAAc,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;AACpH;AAsBA,SAAS,EAAE,GAAG;CACb,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO;CAClB,IAAI,aAAa,MAAM,OAAO,IAAI,KAAK,EAAE,QAAQ,CAAC;CAClD,IAAI,MAAM,QAAQ,CAAC,GAAG,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CAC9C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,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MAAM,CAAC;CAC7C,OAAO,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,MAAM,EAAE,EAAE,CAAC;AAC9D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/hotspot/controller/src/defaults.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: {
|
|
10
|
+
dimensions: {
|
|
11
|
+
height: number;
|
|
12
|
+
width: number;
|
|
13
|
+
};
|
|
14
|
+
hotspotColor: string;
|
|
15
|
+
hotspotList: string[];
|
|
16
|
+
imageUrl: string;
|
|
17
|
+
multipleCorrect: boolean;
|
|
18
|
+
outlineColor: string;
|
|
19
|
+
outlineList: string[];
|
|
20
|
+
partialScoring: boolean;
|
|
21
|
+
prompt: string;
|
|
22
|
+
promptEnabled: boolean;
|
|
23
|
+
rationaleEnabled: boolean;
|
|
24
|
+
shapes: {
|
|
25
|
+
rectangles: never[];
|
|
26
|
+
polygons: never[];
|
|
27
|
+
circles: never[];
|
|
28
|
+
};
|
|
29
|
+
strokeWidth: number;
|
|
30
|
+
studentInstructionsEnabled: boolean;
|
|
31
|
+
teacherInstructions: string;
|
|
32
|
+
teacherInstructionsEnabled: boolean;
|
|
33
|
+
toolbarEditorPosition: string;
|
|
34
|
+
};
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/controller/defaults.ts
|
|
2
|
+
var e = {
|
|
3
|
+
dimensions: {
|
|
4
|
+
height: 0,
|
|
5
|
+
width: 0
|
|
6
|
+
},
|
|
7
|
+
hotspotColor: "rgba(137, 183, 244, 0.25)",
|
|
8
|
+
hotspotList: ["rgba(137, 183, 244, 0.25)"],
|
|
9
|
+
imageUrl: "",
|
|
10
|
+
multipleCorrect: !0,
|
|
11
|
+
outlineColor: "blue",
|
|
12
|
+
outlineList: ["blue"],
|
|
13
|
+
partialScoring: !1,
|
|
14
|
+
prompt: "",
|
|
15
|
+
promptEnabled: !0,
|
|
16
|
+
rationaleEnabled: !0,
|
|
17
|
+
shapes: {
|
|
18
|
+
rectangles: [],
|
|
19
|
+
polygons: [],
|
|
20
|
+
circles: []
|
|
21
|
+
},
|
|
22
|
+
strokeWidth: 5,
|
|
23
|
+
studentInstructionsEnabled: !0,
|
|
24
|
+
teacherInstructions: "",
|
|
25
|
+
teacherInstructionsEnabled: !0,
|
|
26
|
+
toolbarEditorPosition: "bottom"
|
|
27
|
+
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { e as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/hotspot/controller/src/index.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export declare const normalize: (question: any) => any;
|
|
10
|
+
export declare function model(question: any, session: any, env: any): Promise<unknown>;
|
|
11
|
+
export declare const createDefaultModel: (model?: {}) => Promise<unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* Generates detailed trace log for scoring evaluation
|
|
14
|
+
* @param {Object} model - the question model
|
|
15
|
+
* @param {Object} session - the student session
|
|
16
|
+
* @param {Object} env - the environment
|
|
17
|
+
* @returns {Array} traceLog - array of trace messages
|
|
18
|
+
*/
|
|
19
|
+
export declare const getLogTrace: (model: any, session: any, env: any) => string[];
|
|
20
|
+
export declare function outcome(config: any, session: any, env?: {}): Promise<unknown>;
|
|
21
|
+
export declare const createCorrectResponseSession: (question: any, env: any) => Promise<unknown>;
|
|
22
|
+
export declare const validate: (model?: {}, config?: {}) => {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { isResponseCorrect as e } from "./utils.js";
|
|
2
|
+
import t from "./defaults.js";
|
|
3
|
+
import n from "debug";
|
|
4
|
+
import { isEmpty as r } from "@pie-element/shared-lodash";
|
|
5
|
+
import { partialScoring as i } from "@pie-element/shared-controller-utils";
|
|
6
|
+
//#region src/controller/index.ts
|
|
7
|
+
var a = n("pie-elements:hotspot:controller"), o = (e) => e != null, s = (e) => ({
|
|
8
|
+
...t,
|
|
9
|
+
...e
|
|
10
|
+
});
|
|
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
|
+
return new Promise((t) => {
|
|
14
|
+
let s = {
|
|
15
|
+
disabled: r.mode !== "gather",
|
|
16
|
+
mode: r.mode,
|
|
17
|
+
dimensions: c,
|
|
18
|
+
imageUrl: a,
|
|
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
|
+
shapes: {
|
|
31
|
+
...g,
|
|
32
|
+
rectangles: (S || []).map(({ index: e, correct: t, ...n }) => T ? {
|
|
33
|
+
correct: t,
|
|
34
|
+
...n
|
|
35
|
+
} : { ...n }),
|
|
36
|
+
polygons: (C || []).map(({ index: e, correct: t, ...n }) => T ? {
|
|
37
|
+
correct: t,
|
|
38
|
+
...n
|
|
39
|
+
} : { ...n }),
|
|
40
|
+
circles: (w || []).map(({ index: e, correct: t, ...n }) => T ? {
|
|
41
|
+
correct: t,
|
|
42
|
+
...n
|
|
43
|
+
} : { ...n })
|
|
44
|
+
},
|
|
45
|
+
responseCorrect: r.mode === "evaluate" ? e(i, n) : void 0,
|
|
46
|
+
extraCSSRules: i.extraCSSRules
|
|
47
|
+
};
|
|
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
|
+
});
|
|
50
|
+
}
|
|
51
|
+
var l = (e = {}) => new Promise((n) => {
|
|
52
|
+
n({
|
|
53
|
+
...t,
|
|
54
|
+
...e
|
|
55
|
+
});
|
|
56
|
+
}), u = (t, n, r = {}) => {
|
|
57
|
+
let { answers: a } = n || {};
|
|
58
|
+
if (!t.shapes || !t.shapes.rectangles && !t.shapes.polygons && !t.shapes.circles) return 0;
|
|
59
|
+
let { shapes: { rectangles: o = [], polygons: s = [], circles: c = [] } = {} } = t;
|
|
60
|
+
if (!i.enabled(t, r)) return +!!e(t, n);
|
|
61
|
+
let l = 0, u = 0, d = [
|
|
62
|
+
...o,
|
|
63
|
+
...s,
|
|
64
|
+
...c
|
|
65
|
+
], f = d.filter((e) => e.correct);
|
|
66
|
+
d.forEach((e) => {
|
|
67
|
+
let t = a && a.filter((t) => t.id === e.id)[0], n = e.correct && t;
|
|
68
|
+
t && (u += 1), n && (l += 1);
|
|
69
|
+
});
|
|
70
|
+
let p = u > f.length ? u - f.length : 0, m = f.length === 0 ? 1 : f.length, h = ((l - p) / m).toFixed(2);
|
|
71
|
+
return h < 0 ? 0 : parseFloat(h);
|
|
72
|
+
}, d = (e, t, n) => {
|
|
73
|
+
let r = [], { answers: a } = t || {}, { shapes: o } = e || {}, s = [];
|
|
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), l = s.length;
|
|
76
|
+
if (r.push(`Total of ${l} hotspot(s) defined, ${c.length} correct.`), a && a.length > 0) {
|
|
77
|
+
r.push(`Student selected ${a.length} hotspot(s).`);
|
|
78
|
+
let e = 0, t = 0;
|
|
79
|
+
a.forEach((n) => {
|
|
80
|
+
let r = s.find((e) => e.id === n.id);
|
|
81
|
+
r && r.correct ? e++ : t++;
|
|
82
|
+
});
|
|
83
|
+
let n = c.filter((e) => !a.some((t) => t.id === e.id)).length;
|
|
84
|
+
e > 0 && r.push(`${e} correct hotspot(s) selected.`), t > 0 && r.push(`${t} incorrect hotspot(s) selected.`), n > 0 && r.push(`${n} correct hotspot(s) missed.`);
|
|
85
|
+
} else r.push("No hotspots selected.");
|
|
86
|
+
if (i.enabled(e, n)) {
|
|
87
|
+
if (r.push("Score calculated using partial scoring."), a && a.length > 0) {
|
|
88
|
+
let e = 0, t = 0;
|
|
89
|
+
a.forEach((n) => {
|
|
90
|
+
let r = s.find((e) => e.id === n.id);
|
|
91
|
+
r && r.correct ? e++ : t++;
|
|
92
|
+
});
|
|
93
|
+
let n = c.length;
|
|
94
|
+
if (r.push(`Partial scoring calculation: ${e} correct selections out of ${n} available.`), t > n) {
|
|
95
|
+
let i = t - (n - e);
|
|
96
|
+
r.push(`${i} extra incorrect selection(s) beyond required amount are deducted from score.`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} else r.push("Score calculated using all-or-nothing scoring.");
|
|
100
|
+
let d = u(e, t, n);
|
|
101
|
+
return r.push(`Score: ${d}.`), r;
|
|
102
|
+
};
|
|
103
|
+
function f(e, t, n = {}) {
|
|
104
|
+
return new Promise((i) => {
|
|
105
|
+
if (a("outcome..."), (!t || r(t)) && i({
|
|
106
|
+
score: 0,
|
|
107
|
+
empty: !0,
|
|
108
|
+
traceLog: ["No hotspots selected. Score: 0."]
|
|
109
|
+
}), t.answers) {
|
|
110
|
+
let r = d(e, t, n);
|
|
111
|
+
i({
|
|
112
|
+
score: u(e, t, n),
|
|
113
|
+
empty: !1,
|
|
114
|
+
traceLog: r
|
|
115
|
+
});
|
|
116
|
+
} else i({
|
|
117
|
+
score: 0,
|
|
118
|
+
empty: !0,
|
|
119
|
+
traceLog: ["No hotspots selected. Score: 0."]
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
var p = (e) => {
|
|
124
|
+
let t = [];
|
|
125
|
+
return e.forEach((e) => {
|
|
126
|
+
let { correct: n, id: r } = e;
|
|
127
|
+
n && t.push({ id: r });
|
|
128
|
+
}), t;
|
|
129
|
+
}, m = (e, t) => new Promise((n) => {
|
|
130
|
+
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
131
|
+
let { shapes: { rectangles: t = [], circles: r = [], polygons: i = {} } = {} } = e, a = p(t), o = p(i), s = p(r);
|
|
132
|
+
n({
|
|
133
|
+
answers: [
|
|
134
|
+
...a,
|
|
135
|
+
...o,
|
|
136
|
+
...s
|
|
137
|
+
],
|
|
138
|
+
id: "1"
|
|
139
|
+
});
|
|
140
|
+
} else n(null);
|
|
141
|
+
}), h = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), g = (e = {}, t = {}) => {
|
|
142
|
+
let { shapes: n } = e, { minShapes: r = 2, maxShapes: i, maxSelections: a } = t, o = {};
|
|
143
|
+
[
|
|
144
|
+
"teacherInstructions",
|
|
145
|
+
"prompt",
|
|
146
|
+
"rationale"
|
|
147
|
+
].forEach((n) => {
|
|
148
|
+
t[n]?.required && !h(e[n]) && (o[n] = "This field is required.");
|
|
149
|
+
});
|
|
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
|
+
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
|
+
};
|
|
153
|
+
//#endregion
|
|
154
|
+
export { m as createCorrectResponseSession, l as createDefaultModel, d as getLogTrace, c as model, s as normalize, f as outcome, g as validate };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/hotspot/controller/src/utils.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getCorrectResponse: (choices: any) => any;
|
|
10
|
+
export declare const isResponseCorrect: (question: any, session: any) => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isEmpty as e, isEqual as t } from "@pie-element/shared-lodash";
|
|
2
|
+
//#region src/controller/utils.ts
|
|
3
|
+
var n = (e) => e.filter((e) => e.correct).map((e) => e.id).sort(), r = (r, i) => {
|
|
4
|
+
let { shapes: { rectangles: a = [], polygons: o = [], circles: s = [] } } = r, c = n([
|
|
5
|
+
...a,
|
|
6
|
+
...o,
|
|
7
|
+
...s
|
|
8
|
+
]);
|
|
9
|
+
return !i || e(i) ? !1 : i.answers && i.answers.length ? t((i.answers || []).map((e) => e.id).sort(), c) : !(c && c.length);
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as getCorrectResponse, r as isResponseCorrect };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/hotspot/src/hotspot/circle.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
declare class CircleComponent extends React.Component {
|
|
11
|
+
constructor(props: any);
|
|
12
|
+
componentDidMount(): void;
|
|
13
|
+
componentDidUpdate(prevProps: any): void;
|
|
14
|
+
moveGroupToTop: any;
|
|
15
|
+
handleClick: any;
|
|
16
|
+
handleMouseEnter: any;
|
|
17
|
+
handleMouseLeave: any;
|
|
18
|
+
getEvaluateOutlineColor: (isCorrect: any, markAsCorrect: any, outlineColor: any) => any;
|
|
19
|
+
getOutlineWidth: (showCorrectEnabled: any, selected: any, markAsCorrect: any, strokeWidth: any) => any;
|
|
20
|
+
render(): React.JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
export default CircleComponent;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import e from "./image-konva-tooltip.js";
|
|
2
|
+
import { faCorrect as t, faWrong as n } from "./icons.js";
|
|
3
|
+
import r from "react";
|
|
4
|
+
import i from "prop-types";
|
|
5
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import { Circle as s, Group as c, Rect as l } from "react-konva";
|
|
7
|
+
//#region src/delivery/hotspot/circle.tsx
|
|
8
|
+
function u(e) {
|
|
9
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
10
|
+
}
|
|
11
|
+
function d(e, t) {
|
|
12
|
+
return !e || u(e) ? e : u(e.default) ? e.default : t && u(e[t]) ? e[t] : t && u(e[t]?.default) ? e[t].default : e;
|
|
13
|
+
}
|
|
14
|
+
var f = d(l, "Rect"), p = d(c, "Group"), m = d(s, "Circle"), h = class extends r.Component {
|
|
15
|
+
constructor(e) {
|
|
16
|
+
super(e), this.state = { hovered: !1 }, this.groupRef = r.createRef();
|
|
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
|
+
};
|
|
27
|
+
handleClick = (e) => {
|
|
28
|
+
let { onClick: t, id: n, selected: r, disabled: i } = this.props;
|
|
29
|
+
i || (e.cancelBubble = !0, t({
|
|
30
|
+
id: n,
|
|
31
|
+
selected: !r,
|
|
32
|
+
selector: "Mouse"
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
35
|
+
handleMouseEnter = () => {
|
|
36
|
+
let { disabled: e } = this.props;
|
|
37
|
+
e || (document.body.style.cursor = "pointer"), this.setState({ hovered: !0 }), this.moveGroupToTop();
|
|
38
|
+
};
|
|
39
|
+
handleMouseLeave = () => {
|
|
40
|
+
document.body.style.cursor = "default", this.setState({ hovered: !1 });
|
|
41
|
+
};
|
|
42
|
+
getEvaluateOutlineColor = (e, t, n) => t ? "green" : e ? n : "red";
|
|
43
|
+
getOutlineWidth = (e, t, n, r) => n || !n && !e && t ? r : 0;
|
|
44
|
+
render() {
|
|
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;
|
|
48
|
+
return /* @__PURE__ */ o(p, {
|
|
49
|
+
ref: this.groupRef,
|
|
50
|
+
scaleX: b,
|
|
51
|
+
scaleY: b,
|
|
52
|
+
onMouseLeave: this.handleMouseLeave,
|
|
53
|
+
onMouseEnter: this.handleMouseEnter,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ a(m, {
|
|
56
|
+
radius: r,
|
|
57
|
+
fill: d && S ? S : i,
|
|
58
|
+
onClick: this.handleClick,
|
|
59
|
+
onTap: this.handleClick,
|
|
60
|
+
draggable: !1,
|
|
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
|
|
74
|
+
}),
|
|
75
|
+
c && k ? /* @__PURE__ */ a(e, {
|
|
76
|
+
src: k,
|
|
77
|
+
x: D,
|
|
78
|
+
y: O,
|
|
79
|
+
tooltip: v
|
|
80
|
+
}) : null
|
|
81
|
+
]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
h.propTypes = {
|
|
86
|
+
radius: i.number.isRequired,
|
|
87
|
+
hotspotColor: i.string.isRequired,
|
|
88
|
+
id: i.string.isRequired,
|
|
89
|
+
isCorrect: i.oneOfType([i.bool, i.string]),
|
|
90
|
+
isEvaluateMode: i.bool.isRequired,
|
|
91
|
+
disabled: i.bool.isRequired,
|
|
92
|
+
focused: i.bool,
|
|
93
|
+
hoverOutlineColor: i.string,
|
|
94
|
+
onClick: i.func.isRequired,
|
|
95
|
+
outlineColor: i.string.isRequired,
|
|
96
|
+
selected: i.bool.isRequired,
|
|
97
|
+
x: i.number.isRequired,
|
|
98
|
+
y: i.number.isRequired,
|
|
99
|
+
evaluateText: i.string,
|
|
100
|
+
strokeWidth: i.number,
|
|
101
|
+
scale: i.number,
|
|
102
|
+
selectedHotspotColor: i.string,
|
|
103
|
+
markAsCorrect: i.bool.isRequired,
|
|
104
|
+
showCorrectEnabled: i.bool.isRequired
|
|
105
|
+
}, h.defaultProps = {
|
|
106
|
+
isCorrect: !1,
|
|
107
|
+
evaluateText: null,
|
|
108
|
+
focused: !1,
|
|
109
|
+
strokeWidth: 5,
|
|
110
|
+
scale: 1
|
|
111
|
+
};
|
|
112
|
+
//#endregion
|
|
113
|
+
export { h as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/hotspot/src/hotspot/container.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
export declare class Container extends React.Component {
|
|
11
|
+
constructor(props: any);
|
|
12
|
+
isSelected(shape: any): boolean;
|
|
13
|
+
correctness: (isCorrect: any, isChecked: any) => any;
|
|
14
|
+
getEvaluateText: any;
|
|
15
|
+
getAllShapesSorted: any;
|
|
16
|
+
handleShapeFocus: any;
|
|
17
|
+
handleShapeBlur: any;
|
|
18
|
+
handleShapeKeyDown: any;
|
|
19
|
+
render(): React.JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export default Container;
|