@pie-element/hotspot 11.1.2-next.0 → 11.1.2-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/author/hotspot-container.js +2 -2
- package/dist/author/hotspot-drawable.js +120 -120
- 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 +10 -10
- 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 +24223 -22027
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/{browser-CfnAFove.js → browser-D4gLESxz.js} +22 -6
- 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-CJeYAWp3.js +100 -0
- package/dist/browser/dist-CJeYAWp3.js.map +1 -0
- package/dist/controller/index.js +51 -51
- package/dist/controller/utils.d.ts +1 -1
- package/dist/controller/utils.js +2 -3
- 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/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +20 -17
- package/dist/browser/ReactKonva-Z9-1H-UZ.js.map +0 -1
- package/dist/browser/isEqual-D3CTSc6W.js +0 -601
- package/dist/browser/isEqual-D3CTSc6W.js.map +0 -1
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
|
@@ -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 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":";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,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC;CAChD,OAAO;AACR;AACA,SAAS,EAAE,GAAG;CACb,QAAQ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}
|
package/dist/controller/index.js
CHANGED
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
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
5
|
import { partialScoring as i } from "@pie-element/shared-controller-utils";
|
|
6
6
|
//#region src/controller/index.ts
|
|
7
|
-
var a =
|
|
8
|
-
...
|
|
7
|
+
var a = n("pie-elements:hotspot:controller"), o = (e) => e != null, s = (e) => ({
|
|
8
|
+
...t,
|
|
9
9
|
...e
|
|
10
10
|
});
|
|
11
|
-
function
|
|
12
|
-
let i =
|
|
13
|
-
return new Promise((
|
|
14
|
-
let
|
|
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
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 })
|
|
44
44
|
},
|
|
45
|
-
responseCorrect: r.mode === "evaluate" ?
|
|
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
|
|
52
|
-
|
|
53
|
-
...
|
|
51
|
+
var l = (e = {}) => new Promise((n) => {
|
|
52
|
+
n({
|
|
53
|
+
...t,
|
|
54
54
|
...e
|
|
55
55
|
});
|
|
56
|
-
}),
|
|
56
|
+
}), u = (t, n, r = {}) => {
|
|
57
57
|
let { answers: a } = n || {};
|
|
58
|
-
if (!
|
|
59
|
-
let { shapes: { rectangles: o = [], polygons: s = [], circles: c = [] } = {} } =
|
|
60
|
-
if (!i.enabled(
|
|
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
61
|
let l = 0, u = 0, d = [
|
|
62
62
|
...o,
|
|
63
63
|
...s,
|
|
@@ -69,11 +69,11 @@ var c = (e = {}) => new Promise((t) => {
|
|
|
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,21 +97,21 @@ var c = (e = {}) => new Promise((t) => {
|
|
|
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
|
-
if (a("outcome..."), (!
|
|
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
|
-
}),
|
|
110
|
-
let
|
|
109
|
+
}), t.answers) {
|
|
110
|
+
let r = d(e, t, n);
|
|
111
111
|
i({
|
|
112
|
-
score:
|
|
112
|
+
score: u(e, t, n),
|
|
113
113
|
empty: !1,
|
|
114
|
-
traceLog:
|
|
114
|
+
traceLog: r
|
|
115
115
|
});
|
|
116
116
|
} else i({
|
|
117
117
|
score: 0,
|
|
@@ -120,15 +120,15 @@ function d(t, n, r = {}) {
|
|
|
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 };
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
8
|
*/
|
|
9
9
|
export declare const getCorrectResponse: (choices: any) => any;
|
|
10
|
-
export declare const isResponseCorrect: (question: any, session: any) =>
|
|
10
|
+
export declare const isResponseCorrect: (question: any, session: any) => boolean;
|
package/dist/controller/utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js";
|
|
1
|
+
import { isEmpty as e, isEqual as t } from "@pie-element/shared-lodash";
|
|
3
2
|
//#region src/controller/utils.ts
|
|
4
3
|
var n = (e) => e.filter((e) => e.correct).map((e) => e.id).sort(), r = (r, i) => {
|
|
5
4
|
let { shapes: { rectangles: a = [], polygons: o = [], circles: s = [] } } = r, c = n([
|
|
@@ -10,4 +9,4 @@ var n = (e) => e.filter((e) => e.correct).map((e) => e.id).sort(), r = (r, i) =>
|
|
|
10
9
|
return !i || e(i) ? !1 : i.answers && i.answers.length ? t((i.answers || []).map((e) => e.id).sort(), c) : !(c && c.length);
|
|
11
10
|
};
|
|
12
11
|
//#endregion
|
|
13
|
-
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;
|