@pie-element/ebsr 14.2.2-next.0 → 14.2.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/defaults.d.ts +284 -2
- package/dist/author/defaults.js +1 -1
- package/dist/author/index.js +24 -22
- package/dist/author/main.d.ts +1 -0
- package/dist/author/main.js +72 -70
- package/dist/browser/author/index.js +41058 -12238
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +90 -268
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +26 -26
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/delivery-DM01fVuQ.js +1290 -0
- package/dist/browser/delivery-DM01fVuQ.js.map +1 -0
- package/dist/browser/dist-CHbLnyuX.js +111 -0
- package/dist/browser/dist-CHbLnyuX.js.map +1 -0
- package/dist/browser/{dist-D9ARZhQk.js → dist-DiGNNRzu.js} +2 -2
- package/dist/browser/{dist-D9ARZhQk.js.map → dist-DiGNNRzu.js.map} +1 -1
- package/dist/browser/ebsr.css +2 -0
- package/dist/browser/print/index.js +27 -28
- package/dist/browser/print/index.js.map +1 -1
- package/dist/browser/private-tags-Z0nu6DO5.js +9590 -0
- package/dist/browser/private-tags-Z0nu6DO5.js.map +1 -0
- package/dist/controller/index.js +29 -30
- package/dist/controller/utils.d.ts +1 -1
- package/dist/controller/utils.js +2 -2
- package/dist/delivery/index.js +25 -24
- package/dist/index.iife.js +37 -37
- package/dist/print/index.js +32 -32
- package/dist/private-tags.d.ts +2 -0
- package/dist/private-tags.js +3 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/module/print.js +18298 -0
- package/module/print.js.map +1 -0
- package/package.json +27 -10
- package/print.js +2 -0
- package/dist/browser/_Uint8Array-fRN8Lsus.js +0 -193
- package/dist/browser/_Uint8Array-fRN8Lsus.js.map +0 -1
- package/dist/browser/browser-CdX8WGiZ.js +0 -207
- package/dist/browser/browser-CdX8WGiZ.js.map +0 -1
- package/dist/browser/cloneDeep-o_mWij0W.js +0 -251
- package/dist/browser/cloneDeep-o_mWij0W.js.map +0 -1
- package/dist/browser/dist-DQkngCcw.js +0 -36
- package/dist/browser/dist-DQkngCcw.js.map +0 -1
- package/dist/browser/get-BfBCyZ1r.js +0 -333
- package/dist/browser/get-BfBCyZ1r.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/_apply.js +0 -12
- 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/_arrayMap.js +0 -7
- 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/_baseGet.js +0 -10
- 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/_baseRest.js +0 -9
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js +0 -14
- 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/_baseToString.js +0 -15
- 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/_castPath.js +0 -10
- 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/_isIterateeCall.js +0 -12
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +0 -11
- 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/_memoizeCapped.js +0 -11
- 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/_overRest.js +0 -13
- 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/_setToString.js +0 -6
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js +0 -14
- 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/_stringToPath.js +0 -10
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +0 -10
- 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/constant.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/defaults.js +0 -16
- 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/get.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.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/isSymbol.js +0 -9
- 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/memoize.js +0 -16
- 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
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +0 -7
package/dist/controller/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import { isResponseCorrect as r } from "./utils.js";
|
|
1
|
+
import e from "./defaults.js";
|
|
2
|
+
import { isResponseCorrect as t } from "./utils.js";
|
|
3
|
+
import { get as n, isEmpty as r } from "@pie-element/shared-lodash";
|
|
5
4
|
import { getShuffledChoices as i, lockChoices as a, partialScoring as o } from "@pie-element/shared-controller-utils";
|
|
6
5
|
import s from "@pie-lib/translator";
|
|
7
6
|
//#region src/controller/index.ts
|
|
@@ -15,7 +14,7 @@ var { translator: c } = s, l = (e, t, n) => (r) => {
|
|
|
15
14
|
e === "default" ? i.feedback = n[r.correct ? "correct" : "incorrect"] : e === "custom" && (i.feedback = r.feedback.value);
|
|
16
15
|
}
|
|
17
16
|
return i;
|
|
18
|
-
}, u = (e,
|
|
17
|
+
}, u = (e, n, r, i) => {
|
|
19
18
|
let a = Object.assign({
|
|
20
19
|
correct: "Correct",
|
|
21
20
|
incorrect: "Incorrect"
|
|
@@ -25,31 +24,31 @@ var { translator: c } = s, l = (e, t, n) => (r) => {
|
|
|
25
24
|
choices: o,
|
|
26
25
|
disabled: i.mode !== "gather",
|
|
27
26
|
complete: { min: e.choices.filter((e) => e.correct).length },
|
|
28
|
-
responseCorrect: i.mode === "evaluate" ?
|
|
27
|
+
responseCorrect: i.mode === "evaluate" ? t(e, n, r) : void 0
|
|
29
28
|
};
|
|
30
29
|
}, d = (e, t) => ({
|
|
31
30
|
...t,
|
|
32
31
|
...e,
|
|
33
32
|
choicesLayout: e.choicesLayout || e.verticalMode === !1 && "horizontal" || "vertical"
|
|
34
|
-
}), f = ({ partA:
|
|
35
|
-
...
|
|
33
|
+
}), f = ({ partA: t = {}, partB: n = {}, language: r, ...i }) => ({
|
|
34
|
+
...e,
|
|
36
35
|
...i,
|
|
37
|
-
partA: d(
|
|
38
|
-
...
|
|
36
|
+
partA: d(t, {
|
|
37
|
+
...e.partA,
|
|
39
38
|
language: r
|
|
40
39
|
}),
|
|
41
|
-
partB: d(
|
|
42
|
-
...
|
|
40
|
+
partB: d(n, {
|
|
41
|
+
...e.partB,
|
|
43
42
|
language: r
|
|
44
43
|
})
|
|
45
44
|
});
|
|
46
|
-
async function p(
|
|
47
|
-
let l = f(
|
|
45
|
+
async function p(e, t, o, s) {
|
|
46
|
+
let l = f(e), d = u(l.partA, "partA", t, o), p = u(l.partB, "partB", t, o), m = {}, h = (e) => (t, n, r) => new Promise((t) => {
|
|
48
47
|
m[e] = r.shuffledValues, t();
|
|
49
|
-
}), g =
|
|
50
|
-
!_ && v && v.length && (d.choices = await i(v, { shuffledValues: (
|
|
51
|
-
let b =
|
|
52
|
-
if (!a(l.partB, b, o) && y && y.length && (p.choices = await i(y, { shuffledValues: (
|
|
48
|
+
}), g = n(t, "value.partA"), _ = a(l.partA, g, o), { choices: v } = d || {}, { choices: y } = p || {};
|
|
49
|
+
!_ && v && v.length && (d.choices = await i(v, { shuffledValues: (t.shuffledValues || {}).partA }, h("partA"), "value"));
|
|
50
|
+
let b = n(t, "value.partB");
|
|
51
|
+
if (!a(l.partB, b, o) && y && y.length && (p.choices = await i(y, { shuffledValues: (t.shuffledValues || {}).partB }, h("partB"), "value")), r(m) || s && typeof s == "function" && s(t.id, t.element, { shuffledValues: m }).catch((e) => {
|
|
53
52
|
console.error("update session failed", e);
|
|
54
53
|
}), l.partLabels) {
|
|
55
54
|
let e = l.language;
|
|
@@ -71,10 +70,10 @@ async function p(n, r, o, s) {
|
|
|
71
70
|
});
|
|
72
71
|
});
|
|
73
72
|
}
|
|
74
|
-
var m = (
|
|
75
|
-
|
|
76
|
-
...
|
|
77
|
-
...
|
|
73
|
+
var m = (t = {}) => new Promise((n) => {
|
|
74
|
+
n({
|
|
75
|
+
...e,
|
|
76
|
+
...t
|
|
78
77
|
});
|
|
79
78
|
}), h = (e) => e.correct === !0, g = (e, t, n, r) => {
|
|
80
79
|
let { choices: i = [] } = e && e[n] || {}, a = i.length, { value: o } = t || {}, s = (e) => !!(o || []).find((t) => t === e.value), c = (e) => h(e) && !s(e), l = (e) => !h(e) && s(e), u = i.reduce((e, t) => c(t) || l(t) ? e - 1 : e, i.length);
|
|
@@ -165,16 +164,16 @@ var y = (e) => {
|
|
|
165
164
|
id: "1"
|
|
166
165
|
});
|
|
167
166
|
} else n(null);
|
|
168
|
-
}), x = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), S = (e = {},
|
|
169
|
-
let { choices:
|
|
170
|
-
["teacherInstructions", "prompt"].forEach((
|
|
171
|
-
n
|
|
172
|
-
}), o.forEach((e,
|
|
167
|
+
}), x = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), S = (e = {}, t = {}) => {
|
|
168
|
+
let { choices: n } = e, { minAnswerChoices: i = 2, maxAnswerChoices: a } = t, o = [...n || []].reverse(), s = {}, c = {}, l = {}, u = !1;
|
|
169
|
+
["teacherInstructions", "prompt"].forEach((n) => {
|
|
170
|
+
t[n]?.required && !x(e[n]) && (s[n] = "This field is required.");
|
|
171
|
+
}), o.forEach((e, n) => {
|
|
173
172
|
let { correct: r, value: i, label: a, rationale: s } = e;
|
|
174
|
-
r && (u = !0), x(a) ? o.slice(
|
|
173
|
+
r && (u = !0), x(a) ? o.slice(n + 1).some((e) => e.label === a) && (c[i] = "Content should be unique.") : c[i] = "Content should not be empty.", t.rationale?.required && !x(s) && (l[i] = "This field is required.");
|
|
175
174
|
});
|
|
176
|
-
let d = (
|
|
177
|
-
return d < i ? s.answerChoices = `There should be at least ${i} choices defined.` : d > a && (s.answerChoices = `No more than ${a} choices should be defined.`), u || (s.correctResponse = "No correct response defined."),
|
|
175
|
+
let d = (n || []).length;
|
|
176
|
+
return d < i ? s.answerChoices = `There should be at least ${i} choices defined.` : d > a && (s.answerChoices = `No more than ${a} choices should be defined.`), u || (s.correctResponse = "No correct response defined."), r(c) || (s.choices = c), r(l) || (s.rationale = l), s;
|
|
178
177
|
}, C = (e = {}, t = {}) => {
|
|
179
178
|
let { partA: n, partB: r } = e || {}, { partA: i, partB: a } = t || {};
|
|
180
179
|
return {
|
|
@@ -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, key: any, session: any) =>
|
|
10
|
+
export declare const isResponseCorrect: (question: any, key: any, session: any) => boolean;
|
package/dist/controller/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import e from "
|
|
1
|
+
import { isEqual as e } from "@pie-element/shared-lodash";
|
|
2
2
|
//#region src/controller/utils.ts
|
|
3
3
|
var t = (e) => e && e.filter((e) => e.correct).map((e) => e.value).sort(), n = (n, r, i) => {
|
|
4
4
|
let a = t(n.choices);
|
|
5
5
|
return i && i.value ? e((i.value[r].value || []).sort(), a) : !1;
|
|
6
6
|
};
|
|
7
7
|
//#endregion
|
|
8
|
-
export { n as isResponseCorrect };
|
|
8
|
+
export { t as getCorrectResponse, n as isResponseCorrect };
|
package/dist/delivery/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import e from "../
|
|
1
|
+
import { EBSR_MULTIPLE_CHOICE_TAG as e } from "../private-tags.js";
|
|
2
2
|
import { SessionChangedEvent as t } from "@pie-element/shared-player-events";
|
|
3
3
|
import n from "@pie-element/multiple-choice";
|
|
4
|
-
import r from "
|
|
4
|
+
import { get as r } from "@pie-element/shared-lodash";
|
|
5
|
+
import i from "debug";
|
|
5
6
|
//#region src/delivery/index.tsx
|
|
6
|
-
var
|
|
7
|
-
customElements.get(
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
return
|
|
7
|
+
var a = t.TYPE, o = e, s = i("pie-elements:ebsr"), c = class extends n {};
|
|
8
|
+
customElements.get(o) || customElements.define(o, c);
|
|
9
|
+
var l = (e) => Array.isArray(e) && e.length > 0, u = (e) => {
|
|
10
|
+
let t = r(e, "value.partA.value"), n = r(e, "value.partB.value");
|
|
11
|
+
return l(t) && l(n);
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
+
function d(e) {
|
|
13
14
|
let t = e.closest("pie-player") || e.closest("pie-item-player");
|
|
14
15
|
if (!t) return {
|
|
15
16
|
baseHeadingLevel: void 0,
|
|
@@ -21,10 +22,10 @@ function u(e) {
|
|
|
21
22
|
}, r = n("baseHeadingLevel", "base-heading-level", "baseheadinglevel"), i = parseInt(r, 10), a = Number.isFinite(i) && i >= 1 && i <= 6 ? i : void 0, o = n("includeSrHeading", "include-sr-heading", "includesrheading");
|
|
22
23
|
return {
|
|
23
24
|
baseHeadingLevel: a,
|
|
24
|
-
includeSrHeading: o == null
|
|
25
|
+
includeSrHeading: o == null || o !== !1 && o !== "false"
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
var
|
|
28
|
+
var f = class extends HTMLElement {
|
|
28
29
|
constructor() {
|
|
29
30
|
super(), this._model = {}, this._session = {};
|
|
30
31
|
}
|
|
@@ -38,12 +39,12 @@ var d = class extends HTMLElement {
|
|
|
38
39
|
}
|
|
39
40
|
};
|
|
40
41
|
set model(e) {
|
|
41
|
-
this._model = e, customElements.whenDefined(
|
|
42
|
+
this._model = e, customElements.whenDefined(o).then(() => {
|
|
42
43
|
this.setPartModel(this.partA, "partA"), this.setPartModel(this.partB, "partB");
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
46
|
set session(e) {
|
|
46
|
-
this._session = e, customElements.whenDefined(
|
|
47
|
+
this._session = e, customElements.whenDefined(o).then(() => {
|
|
47
48
|
this.setPartSession(this.partA, "partA"), this.setPartSession(this.partB, "partB");
|
|
48
49
|
});
|
|
49
50
|
}
|
|
@@ -58,7 +59,7 @@ var d = class extends HTMLElement {
|
|
|
58
59
|
mode: n,
|
|
59
60
|
keyMode: this._model[t].choicePrefix
|
|
60
61
|
};
|
|
61
|
-
let { includeSrHeading: r, baseHeadingLevel: i } =
|
|
62
|
+
let { includeSrHeading: r, baseHeadingLevel: i } = d(this);
|
|
62
63
|
e.includeSrHeading = r, e.baseHeadingLevel = i;
|
|
63
64
|
}
|
|
64
65
|
}
|
|
@@ -72,21 +73,21 @@ var d = class extends HTMLElement {
|
|
|
72
73
|
this._session.value = {
|
|
73
74
|
...this._session.value,
|
|
74
75
|
[n]: e
|
|
75
|
-
},
|
|
76
|
-
let r =
|
|
76
|
+
}, s("[onSessionChanged] session: ", this._session);
|
|
77
|
+
let r = u(this._session);
|
|
77
78
|
this.dispatchEvent(new t(this.tagName.toLowerCase(), r));
|
|
78
79
|
}
|
|
79
80
|
get partA() {
|
|
80
|
-
return this.querySelector(`${
|
|
81
|
+
return this.querySelector(`${o}#a`);
|
|
81
82
|
}
|
|
82
83
|
get partB() {
|
|
83
|
-
return this.querySelector(`${
|
|
84
|
+
return this.querySelector(`${o}#b`);
|
|
84
85
|
}
|
|
85
86
|
connectedCallback() {
|
|
86
|
-
this._render(), this._initPlayerObserver(), this.addEventListener(
|
|
87
|
+
this._render(), this._initPlayerObserver(), this.addEventListener(a, this.onSessionUpdated);
|
|
87
88
|
}
|
|
88
89
|
disconnectedCallback() {
|
|
89
|
-
this._disconnectPlayerObserver(), this.removeEventListener(
|
|
90
|
+
this._disconnectPlayerObserver(), this.removeEventListener(a, this.onSessionUpdated);
|
|
90
91
|
}
|
|
91
92
|
_initPlayerObserver() {
|
|
92
93
|
let e = this.closest("pie-player") || this.closest("pie-item-player");
|
|
@@ -107,7 +108,7 @@ var d = class extends HTMLElement {
|
|
|
107
108
|
}
|
|
108
109
|
_render() {
|
|
109
110
|
this.ariaLabel = "Two-Part Question", this.role = "region";
|
|
110
|
-
let { baseHeadingLevel: e, includeSrHeading: t } =
|
|
111
|
+
let { baseHeadingLevel: e, includeSrHeading: t } = d(this), n = e ? `h${Math.min(6, e)}` : "h2", r = t ? `<${n} class="srOnly">Two-Part Question</${n}>` : "";
|
|
111
112
|
this.innerHTML = `
|
|
112
113
|
<style>
|
|
113
114
|
.srOnly {
|
|
@@ -123,10 +124,10 @@ var d = class extends HTMLElement {
|
|
|
123
124
|
${this._model?.extraCSSRules?.rules}
|
|
124
125
|
</style>
|
|
125
126
|
${r}
|
|
126
|
-
<${
|
|
127
|
-
<${
|
|
128
|
-
`, customElements.get(
|
|
127
|
+
<${o} id="a"></${o}>
|
|
128
|
+
<${o} id="b"></${o}>
|
|
129
|
+
`, customElements.get(o) && (this.setPartModel(this.partA, "partA"), this.setPartModel(this.partB, "partB"), this.setPartSession(this.partA, "partA"), this.setPartSession(this.partB, "partB"));
|
|
129
130
|
}
|
|
130
131
|
};
|
|
131
132
|
//#endregion
|
|
132
|
-
export {
|
|
133
|
+
export { f as default, u as isSessionComplete };
|