@pie-element/multiple-choice 13.2.2-next.0 → 13.2.2-next.2
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/index.js +23 -23
- package/dist/author/main.js +67 -67
- package/dist/browser/{debounce-PkR6OuzU.js → Radio-DADh6qUM.js} +2549 -2639
- package/dist/browser/Radio-DADh6qUM.js.map +1 -0
- package/dist/browser/author/index.js +7819 -8261
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/controller/index.js +1 -1
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +9 -8
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/browser/dist-nl5urzAW.js +107 -0
- package/dist/browser/dist-nl5urzAW.js.map +1 -0
- package/dist/browser/{main-CmP4Uwst.js → main-C4I_9OBk.js} +220 -220
- package/dist/browser/{main-CmP4Uwst.js.map → main-C4I_9OBk.js.map} +1 -1
- package/dist/browser/print/index.js +11 -16
- package/dist/browser/print/index.js.map +1 -1
- package/dist/controller/index.js +26 -26
- package/dist/controller/utils.js +1 -1
- package/dist/delivery/choice-input.js +73 -73
- package/dist/delivery/index.js +19 -19
- package/dist/delivery/multiple-choice.js +72 -72
- package/dist/index.iife.js +21 -21
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/print/index.js +10 -11
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +13 -10
- package/dist/browser/_Uint8Array-CUOjhemR.js +0 -396
- package/dist/browser/_Uint8Array-CUOjhemR.js.map +0 -1
- package/dist/browser/_baseClone-fFvdZAu5.js +0 -245
- package/dist/browser/_baseClone-fFvdZAu5.js.map +0 -1
- package/dist/browser/debounce-PkR6OuzU.js.map +0 -1
- package/dist/browser/isEqual-CnAlrBXo.js +0 -182
- package/dist/browser/isEqual-CnAlrBXo.js.map +0 -1
- package/dist/browser/isObject-B-uKF3Sg.js +0 -38
- package/dist/browser/isObject-B-uKF3Sg.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/_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/_assignMergeValue.js +0 -8
- 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/_baseFor.js +0 -5
- 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/_baseMerge.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMergeDeep.js +0 -31
- 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/_baseTrim.js +0 -8
- 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/_createAssigner.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js +0 -12
- 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/_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/_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/_safeGet.js +0 -6
- 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/_toSource.js +0 -15
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
- 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/debounce.js +0 -50
- 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/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/isArrayLikeObject.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/isPlainObject.js +0 -14
- 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/merge.js +0 -8
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +0 -7
- 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/toNumber.js +0 -19
- package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toPlainObject.js +0 -8
|
@@ -1,31 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
1
|
+
import { F as e, N as t, Vt as n } from "../Radio-DADh6qUM.js";
|
|
2
|
+
import { t as r } from "../main-C4I_9OBk.js";
|
|
3
|
+
import { c as i, l as a } from "../dist-nl5urzAW.js";
|
|
4
4
|
import o from "react";
|
|
5
5
|
import { createRoot as s } from "react-dom/client";
|
|
6
|
-
|
|
7
|
-
var c = 1, l = 4;
|
|
8
|
-
function u(e) {
|
|
9
|
-
return a(e, c | l);
|
|
10
|
-
}
|
|
11
|
-
var d = (0, (/* @__PURE__ */ e(r(), 1)).default)("pie-element:multiple-choice:print"), f = (e, t) => {
|
|
6
|
+
var c = (0, (/* @__PURE__ */ n(e(), 1)).default)("pie-element:multiple-choice:print"), l = (e, t) => {
|
|
12
7
|
let n = t.role === "instructor";
|
|
13
|
-
return e.prompt = e.promptEnabled === !1 ? void 0 : e.prompt, e.teacherInstructions = n && e.teacherInstructionsEnabled !== !1 ? e.teacherInstructions : void 0, e.showTeacherInstructions = n, e.alwaysShowCorrect = n, e.mode = n ? "evaluate" : e.mode, e.disabled = !0, e.animationsDisabled = !0, e.lockChoiceOrder = !0, e.choicesLayout = e.choicesLayout || "vertical", e.choices =
|
|
14
|
-
},
|
|
8
|
+
return e.prompt = e.promptEnabled === !1 ? void 0 : e.prompt, e.teacherInstructions = n && e.teacherInstructionsEnabled !== !1 ? e.teacherInstructions : void 0, e.showTeacherInstructions = n, e.alwaysShowCorrect = n, e.mode = n ? "evaluate" : e.mode, e.disabled = !0, e.animationsDisabled = !0, e.lockChoiceOrder = !0, e.choicesLayout = e.choicesLayout || "vertical", e.choices = a(e.choices).map((t) => (t.rationale = n && e.rationaleEnabled !== !1 ? t.rationale : void 0, t.hideTick = n, t.feedback = void 0, t)), e.keyMode = e.choicePrefix || "letters", e;
|
|
9
|
+
}, u = class extends HTMLElement {
|
|
15
10
|
constructor() {
|
|
16
|
-
super(), this._options = null, this._model = null, this._session = [], this._root = null, this._rerender =
|
|
11
|
+
super(), this._options = null, this._model = null, this._session = [], this._root = null, this._rerender = i(() => {
|
|
17
12
|
if (this._model && this._session) {
|
|
18
|
-
let e =
|
|
13
|
+
let e = l(this._model, this._options), n = this._options && o.createElement(r, {
|
|
19
14
|
model: e,
|
|
20
15
|
session: {},
|
|
21
16
|
options: this._options
|
|
22
17
|
});
|
|
23
18
|
this._root ||= s(this), this._root.render(n), requestAnimationFrame(() => {
|
|
24
19
|
requestAnimationFrame(() => {
|
|
25
|
-
|
|
20
|
+
c("render complete - render math"), t(this);
|
|
26
21
|
});
|
|
27
22
|
});
|
|
28
|
-
} else
|
|
23
|
+
} else c("skip");
|
|
29
24
|
}, 50, {
|
|
30
25
|
leading: !1,
|
|
31
26
|
trailing: !0
|
|
@@ -43,6 +38,6 @@ var d = (0, (/* @__PURE__ */ e(r(), 1)).default)("pie-element:multiple-choice:pr
|
|
|
43
38
|
}
|
|
44
39
|
};
|
|
45
40
|
//#endregion
|
|
46
|
-
export {
|
|
41
|
+
export { u as default };
|
|
47
42
|
|
|
48
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/print/index.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * @synced-from pie-elements/packages/multiple-choice/src/print.js\n * @auto-generated\n *\n * This file is automatically synced from pie-elements and converted to TypeScript.\n * Manual edits will be overwritten on next sync.\n * To make changes, edit the upstream JavaScript file and run sync again.\n */\n\nimport React from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { cloneDeep, debounce } from '@pie-element/shared-lodash';\nimport Main from '../delivery/main.js';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport debug from 'debug';\n\nconst log = debug('pie-element:multiple-choice:print');\n\n/**\n * Live in same package as main element - so we can access some of the shared comps!\n *\n * - update pslb to build print if src/print.js is there\n * - update demo el\n * - get configure/controller building\n */\n\nconst preparePrintModel = (model, opts) => {\n const instr = opts.role === 'instructor';\n\n model.prompt = model.promptEnabled !== false ? model.prompt : undefined;\n model.teacherInstructions =\n instr && model.teacherInstructionsEnabled !== false ? model.teacherInstructions : undefined;\n model.showTeacherInstructions = instr;\n model.alwaysShowCorrect = instr;\n model.mode = instr ? 'evaluate' : model.mode;\n\n model.disabled = true;\n model.animationsDisabled = true;\n model.lockChoiceOrder = true;\n model.choicesLayout = model.choicesLayout || 'vertical';\n\n const choices = cloneDeep(model.choices);\n\n model.choices = choices.map((c) => {\n c.rationale = instr && model.rationaleEnabled !== false ? c.rationale : undefined;\n c.hideTick = instr;\n c.feedback = undefined;\n return c;\n });\n\n model.keyMode = model.choicePrefix || 'letters';\n\n return model;\n};\n\nexport default class MultipleChoicePrint extends HTMLElement {\n constructor() {\n super();\n this._options = null;\n this._model = null;\n this._session = [];\n this._root = null;\n this._rerender = debounce(\n () => {\n if (this._model && this._session) {\n const printModel = preparePrintModel(this._model, this._options);\n\n const element =\n this._options &&\n React.createElement(Main, {\n model: printModel,\n session: {},\n options: this._options,\n });\n\n if (!this._root) {\n this._root = createRoot(this);\n }\n this._root.render(element);\n // Use double requestAnimationFrame so React has committed to the DOM before we render math\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n log('render complete - render math');\n renderMath(this);\n });\n });\n } else {\n log('skip');\n }\n },\n 50,\n { leading: false, trailing: true },\n );\n }\n set options(o) {\n this._options = o;\n }\n\n set model(s) {\n this._model = s;\n this._rerender();\n }\n\n connectedCallback() {}\n\n disconnectedCallback() {\n if (this._root) {\n this._root.unmount();\n }\n }\n}\n"],"mappings":";;;;;AAiBA,IAAM,KAAA,IAAA,wBAAA,GAAA,SAAY,mCAAmC,GAU/C,KAAqB,GAAO,MAAS;CACzC,IAAM,IAAQ,EAAK,SAAS;CAyB5B,OAvBA,EAAM,SAAS,EAAM,kBAAkB,KAAuB,KAAA,IAAf,EAAM,QACrD,EAAM,sBACJ,KAAS,EAAM,+BAA+B,KAAQ,EAAM,sBAAsB,KAAA,GACpF,EAAM,0BAA0B,GAChC,EAAM,oBAAoB,GAC1B,EAAM,OAAO,IAAQ,aAAa,EAAM,MAExC,EAAM,WAAW,IACjB,EAAM,qBAAqB,IAC3B,EAAM,kBAAkB,IACxB,EAAM,gBAAgB,EAAM,iBAAiB,YAI7C,EAAM,UAFU,EAAU,EAAM,OAEhB,EAAQ,KAAK,OAC3B,EAAE,YAAY,KAAS,EAAM,qBAAqB,KAAQ,EAAE,YAAY,KAAA,GACxE,EAAE,WAAW,GACb,EAAE,WAAW,KAAA,GACN,EACR,GAED,EAAM,UAAU,EAAM,gBAAgB,WAE/B;AACT,GAEqB,IAArB,cAAiD,YAAY;CAC3D,cAAc;EAMZ,AALA,MAAM,GACN,KAAK,WAAW,MAChB,KAAK,SAAS,MACd,KAAK,WAAW,CAAC,GACjB,KAAK,QAAQ,MACb,KAAK,YAAY,QACT;GACJ,IAAI,KAAK,UAAU,KAAK,UAAU;IAChC,IAAM,IAAa,EAAkB,KAAK,QAAQ,KAAK,QAAQ,GAEzD,IACJ,KAAK,YACL,EAAM,cAAc,GAAM;KACxB,OAAO;KACP,SAAS,CAAC;KACV,SAAS,KAAK;IAChB,CAAC;IAOH,AALA,AACE,KAAK,UAAQ,EAAW,IAAI,GAE9B,KAAK,MAAM,OAAO,CAAO,GAEzB,4BAA4B;KAC1B,4BAA4B;MAE1B,AADA,EAAI,+BAA+B,GACnC,EAAW,IAAI;KACjB,CAAC;IACH,CAAC;GACH,OACE,EAAI,MAAM;EAEd,GACA,IACA;GAAE,SAAS;GAAO,UAAU;EAAK,CACnC;CACF;CACA,IAAI,QAAQ,GAAG;EACb,KAAK,WAAW;CAClB;CAEA,IAAI,MAAM,GAAG;EAEX,AADA,KAAK,SAAS,GACd,KAAK,UAAU;CACjB;CAEA,oBAAoB,CAAC;CAErB,uBAAuB;EACrB,AAAI,KAAK,SACP,KAAK,MAAM,QAAQ;CAEvB;AACF"}
|
package/dist/controller/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import
|
|
3
|
-
import n from "
|
|
1
|
+
import { isResponseCorrect as e } from "./utils.js";
|
|
2
|
+
import t from "./defaults.js";
|
|
3
|
+
import { isEmpty as n } from "@pie-element/shared-lodash";
|
|
4
4
|
import { getShuffledChoices as r, lockChoices as i, partialScoring as a } from "@pie-element/shared-controller-utils";
|
|
5
5
|
//#region src/controller/index.ts
|
|
6
6
|
var o = (e, t, n) => (r) => {
|
|
@@ -15,21 +15,21 @@ var o = (e, t, n) => (r) => {
|
|
|
15
15
|
return o;
|
|
16
16
|
};
|
|
17
17
|
function s(e = {}) {
|
|
18
|
-
return new Promise((
|
|
19
|
-
...
|
|
18
|
+
return new Promise((n) => n({
|
|
19
|
+
...t,
|
|
20
20
|
...e
|
|
21
21
|
}));
|
|
22
22
|
}
|
|
23
23
|
var c = (e) => {
|
|
24
|
-
let { verticalMode:
|
|
24
|
+
let { verticalMode: n, choicesLayout: r, ...i } = e || {};
|
|
25
25
|
return {
|
|
26
|
-
...
|
|
26
|
+
...t,
|
|
27
27
|
...i,
|
|
28
|
-
choicesLayout: r ||
|
|
28
|
+
choicesLayout: r || n === !1 && "horizontal" || t.choicesLayout
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
async function l(
|
|
32
|
-
let l = c(
|
|
31
|
+
async function l(t, n, a, s) {
|
|
32
|
+
let l = c(t), u = Object.assign({
|
|
33
33
|
correct: "Correct",
|
|
34
34
|
incorrect: "Incorrect"
|
|
35
35
|
}, l.defaultFeedback), d = (l.choices || []).map(o(l, a, u));
|
|
@@ -43,7 +43,7 @@ async function l(e, n, a, s) {
|
|
|
43
43
|
choiceMode: l.choiceMode,
|
|
44
44
|
keyMode: l.choicePrefix,
|
|
45
45
|
choices: d,
|
|
46
|
-
responseCorrect: a.mode === "evaluate" ?
|
|
46
|
+
responseCorrect: a.mode === "evaluate" ? e(l, n) : void 0,
|
|
47
47
|
language: l.language,
|
|
48
48
|
extraCSSRules: l.extraCSSRules,
|
|
49
49
|
fontSizeFactor: l.fontSizeFactor,
|
|
@@ -63,9 +63,9 @@ async function l(e, n, a, s) {
|
|
|
63
63
|
}, { role: p, mode: m } = a || {};
|
|
64
64
|
return p === "instructor" && (m === "view" || m === "evaluate") ? f.teacherInstructions = l.teacherInstructionsEnabled ? l.teacherInstructions : null : f.teacherInstructions = null, f;
|
|
65
65
|
}
|
|
66
|
-
var u = (
|
|
67
|
-
if (!
|
|
68
|
-
let r =
|
|
66
|
+
var u = (e, t) => {
|
|
67
|
+
if (!t || n(t)) return 0;
|
|
68
|
+
let r = t.value || [], i = (e.choices || []).filter((e) => e.correct), a = r.reduce((e, t) => e + +!!i.find((e) => e.value === t), 0);
|
|
69
69
|
i.length < r.length && (a -= r.length - i.length, a < 0 && (a = 0));
|
|
70
70
|
let o = i.length ? a / i.length : 0;
|
|
71
71
|
return parseFloat(o.toFixed(2));
|
|
@@ -82,19 +82,19 @@ var u = (t, n) => {
|
|
|
82
82
|
let d = u(e, t);
|
|
83
83
|
return r.push(`Final score: ${d}.`), r;
|
|
84
84
|
};
|
|
85
|
-
function f(
|
|
85
|
+
function f(e, t, r) {
|
|
86
86
|
return new Promise((i) => {
|
|
87
|
-
if (!
|
|
87
|
+
if (!t || n(t)) i({
|
|
88
88
|
score: 0,
|
|
89
89
|
empty: !0,
|
|
90
90
|
traceLog: ["Student did not select any answers. Score is 0."]
|
|
91
91
|
});
|
|
92
92
|
else {
|
|
93
|
-
let
|
|
93
|
+
let n = d(e, t, r), o = u(e, t);
|
|
94
94
|
i({
|
|
95
|
-
score: a.enabled(
|
|
95
|
+
score: a.enabled(e, r) && e.choiceMode !== "radio" ? o : +(o === 1),
|
|
96
96
|
empty: !1,
|
|
97
|
-
traceLog:
|
|
97
|
+
traceLog: n
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
});
|
|
@@ -107,18 +107,18 @@ var p = (e, t) => new Promise((n) => {
|
|
|
107
107
|
value: t.filter((e) => e.correct).map((e) => e.value)
|
|
108
108
|
});
|
|
109
109
|
} else n(null);
|
|
110
|
-
}), m = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), h = (
|
|
111
|
-
let { choices: r } =
|
|
112
|
-
["teacherInstructions", "prompt"].forEach((
|
|
113
|
-
n
|
|
110
|
+
}), m = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), h = (e = {}, t = {}) => {
|
|
111
|
+
let { choices: r } = e, { minAnswerChoices: i = 2, maxAnswerChoices: a } = t, o = [...r || []].reverse(), s = {}, c = {}, l = {};
|
|
112
|
+
["teacherInstructions", "prompt"].forEach((n) => {
|
|
113
|
+
t[n]?.required && !m(e[n]) && (l[n] = "This field is required.");
|
|
114
114
|
});
|
|
115
115
|
let u = !1;
|
|
116
|
-
o.forEach((e,
|
|
116
|
+
o.forEach((e, n) => {
|
|
117
117
|
let { correct: r, value: i, label: a, rationale: l } = e;
|
|
118
|
-
r && (u = !0), m(a) ? o.slice(
|
|
118
|
+
r && (u = !0), m(a) ? o.slice(n + 1).some((e) => e.label === a) && (s[i] = "Content should be unique.") : s[i] = "Content should not be empty.", t.rationale?.required && !m(l) && (c[i] = "This field is required.");
|
|
119
119
|
});
|
|
120
120
|
let d = (r || []).length;
|
|
121
|
-
return d < i ? l.answerChoices = `There should be at least ${i} choices defined.` : d > a && (l.answerChoices = `No more than ${a} choices should be defined.`), u || (l.correctResponse = "No correct response defined."),
|
|
121
|
+
return d < i ? l.answerChoices = `There should be at least ${i} choices defined.` : d > a && (l.answerChoices = `No more than ${a} choices should be defined.`), u || (l.correctResponse = "No correct response defined."), n(s) || (l.choices = s), n(c) || (l.rationale = c), l;
|
|
122
122
|
};
|
|
123
123
|
//#endregion
|
|
124
124
|
export { p as createCorrectResponseSession, s as createDefaultModel, d as getLogTrace, u as getScore, l as model, c as normalize, f as outcome, h as validate };
|
package/dist/controller/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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.filter((e) => e.correct).map((e) => e.value).sort(), n = (n, r) => {
|
|
4
4
|
let i = t(n.choices);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import u from "
|
|
1
|
+
import e from "../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
2
|
+
import t from "./feedback-tick.js";
|
|
3
|
+
import n from "react";
|
|
4
|
+
import r from "prop-types";
|
|
5
|
+
import * as i from "@pie-lib/render-ui";
|
|
6
|
+
import { Feedback as a, PreviewPrompt as o, color as s } from "@pie-lib/render-ui";
|
|
7
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
8
|
import { styled as d } from "@mui/material/styles";
|
|
9
9
|
import f from "@mui/material/Box";
|
|
10
10
|
import p from "@mui/material/FormControlLabel";
|
|
@@ -17,18 +17,18 @@ function g(e) {
|
|
|
17
17
|
function _(e, t) {
|
|
18
18
|
return !e || g(e) ? e : g(e.default) ? e.default : t && g(e[t]) ? e[t] : t && g(e[t]?.default) ? e[t].default : e;
|
|
19
19
|
}
|
|
20
|
-
var v = _(
|
|
20
|
+
var v = _(o, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(a, "Feedback") || _(S.Feedback, "Feedback"), b = i, x = b.default, S = x && typeof x == "object" ? x : b, C = "multiple-choice-component", w = d(f)({
|
|
21
21
|
display: "flex",
|
|
22
22
|
alignItems: "center",
|
|
23
|
-
backgroundColor:
|
|
23
|
+
backgroundColor: s.background()
|
|
24
24
|
}), T = d(f)({
|
|
25
25
|
display: "flex",
|
|
26
26
|
alignItems: "center",
|
|
27
|
-
backgroundColor:
|
|
27
|
+
backgroundColor: s.background(),
|
|
28
28
|
flex: 1,
|
|
29
29
|
"& .MuiFormControlLabel-root": { marginLeft: "-14px" },
|
|
30
30
|
"& label": {
|
|
31
|
-
color:
|
|
31
|
+
color: s.text(),
|
|
32
32
|
"& > span": { fontSize: "inherit" },
|
|
33
33
|
"& > .MuiButtonBase-root": { padding: "12px" }
|
|
34
34
|
}
|
|
@@ -45,8 +45,8 @@ var v = _(a, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(i, "
|
|
|
45
45
|
overflow: "hidden"
|
|
46
46
|
}), O = d(p)({
|
|
47
47
|
"& .MuiFormControlLabel-label": {
|
|
48
|
-
color: `${
|
|
49
|
-
backgroundColor:
|
|
48
|
+
color: `${s.text()} !important`,
|
|
49
|
+
backgroundColor: s.background(),
|
|
50
50
|
letterSpacing: "normal"
|
|
51
51
|
},
|
|
52
52
|
"&.Mui-disabled *": { cursor: "not-allowed !important" }
|
|
@@ -54,30 +54,30 @@ var v = _(a, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(i, "
|
|
|
54
54
|
let t = (t) => e ? `${e}-${t}` : t;
|
|
55
55
|
return {
|
|
56
56
|
[t("root")]: {
|
|
57
|
-
...k("color",
|
|
58
|
-
...e ? {} : { "&:hover": { color: `${
|
|
59
|
-
...e === "correct" ? k("correct-color",
|
|
60
|
-
...e === "incorrect" ? k("incorrect-color",
|
|
57
|
+
...k("color", s.text()),
|
|
58
|
+
...e ? {} : { "&:hover": { color: `${s.primaryLight()} !important` } },
|
|
59
|
+
...e === "correct" ? k("correct-color", s.text()) : {},
|
|
60
|
+
...e === "incorrect" ? k("incorrect-color", s.incorrect()) : {}
|
|
61
61
|
},
|
|
62
62
|
[t("checked")]: {
|
|
63
|
-
...e === "correct" ? k("correct-selected-color",
|
|
64
|
-
...e === "incorrect" ? k("incorrect-checked",
|
|
65
|
-
...e ? {} : k("selected-color",
|
|
63
|
+
...e === "correct" ? k("correct-selected-color", s.correct()) : {},
|
|
64
|
+
...e === "incorrect" ? k("incorrect-checked", s.incorrect()) : {},
|
|
65
|
+
...e ? {} : k("selected-color", s.primary())
|
|
66
66
|
},
|
|
67
67
|
[t("disabled")]: {
|
|
68
|
-
...k("disabled-color",
|
|
69
|
-
...e === "correct" ? k("correct-disabled-color",
|
|
70
|
-
...e === "incorrect" ? k("incorrect-disabled-color",
|
|
68
|
+
...k("disabled-color", s.text()),
|
|
69
|
+
...e === "correct" ? k("correct-disabled-color", s.disabled()) : {},
|
|
70
|
+
...e === "incorrect" ? k("incorrect-disabled-color", s.disabled()) : {},
|
|
71
71
|
opacity: .6,
|
|
72
72
|
cursor: "not-allowed !important",
|
|
73
73
|
pointerEvents: "initial !important"
|
|
74
74
|
},
|
|
75
75
|
focusVisibleUnchecked: {
|
|
76
|
-
outline: `2px solid ${
|
|
76
|
+
outline: `2px solid ${s.keyBoardFocusIndicator()}`,
|
|
77
77
|
backgroundColor: "transparent"
|
|
78
78
|
},
|
|
79
79
|
focusVisibleChecked: {
|
|
80
|
-
outline: `2px solid ${
|
|
80
|
+
outline: `2px solid ${s.keyBoardFocusIndicator()}`,
|
|
81
81
|
backgroundColor: "transparent"
|
|
82
82
|
}
|
|
83
83
|
};
|
|
@@ -95,10 +95,10 @@ var v = _(a, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(i, "
|
|
|
95
95
|
}
|
|
96
96
|
};
|
|
97
97
|
}), M = (e) => {
|
|
98
|
-
let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, onKeyDown: s, inputRef:
|
|
99
|
-
return /* @__PURE__ */
|
|
98
|
+
let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, onKeyDown: s, inputRef: c } = e;
|
|
99
|
+
return /* @__PURE__ */ l(j, {
|
|
100
100
|
id: o,
|
|
101
|
-
slotProps: { input: { ref:
|
|
101
|
+
slotProps: { input: { ref: c } },
|
|
102
102
|
onKeyDown: s,
|
|
103
103
|
disableRipple: !0,
|
|
104
104
|
checked: n,
|
|
@@ -123,10 +123,10 @@ var v = _(a, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(i, "
|
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
}), P = (e) => {
|
|
126
|
-
let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, tagName: s, inputRef:
|
|
127
|
-
return /* @__PURE__ */
|
|
126
|
+
let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, tagName: s, inputRef: c } = e;
|
|
127
|
+
return /* @__PURE__ */ l(N, {
|
|
128
128
|
id: o,
|
|
129
|
-
slotProps: { input: { ref:
|
|
129
|
+
slotProps: { input: { ref: c } },
|
|
130
130
|
disableRipple: !0,
|
|
131
131
|
checked: n,
|
|
132
132
|
onChange: r,
|
|
@@ -136,28 +136,28 @@ var v = _(a, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(i, "
|
|
|
136
136
|
className: C,
|
|
137
137
|
name: s
|
|
138
138
|
});
|
|
139
|
-
}, F = class extends
|
|
139
|
+
}, F = class extends n.Component {
|
|
140
140
|
static propTypes = {
|
|
141
|
-
choiceMode:
|
|
142
|
-
displayKey:
|
|
143
|
-
checked:
|
|
144
|
-
correctness:
|
|
145
|
-
disabled:
|
|
146
|
-
feedback:
|
|
147
|
-
label:
|
|
148
|
-
rationale:
|
|
149
|
-
onChange:
|
|
150
|
-
value:
|
|
151
|
-
className:
|
|
152
|
-
tagName:
|
|
153
|
-
hideTick:
|
|
154
|
-
isEvaluateMode:
|
|
155
|
-
choicesLayout:
|
|
141
|
+
choiceMode: r.oneOf(["radio", "checkbox"]),
|
|
142
|
+
displayKey: r.string,
|
|
143
|
+
checked: r.bool.isRequired,
|
|
144
|
+
correctness: r.string,
|
|
145
|
+
disabled: r.bool.isRequired,
|
|
146
|
+
feedback: r.string,
|
|
147
|
+
label: r.string.isRequired,
|
|
148
|
+
rationale: r.string,
|
|
149
|
+
onChange: r.func.isRequired,
|
|
150
|
+
value: r.string.isRequired,
|
|
151
|
+
className: r.string,
|
|
152
|
+
tagName: r.string,
|
|
153
|
+
hideTick: r.bool,
|
|
154
|
+
isEvaluateMode: r.bool,
|
|
155
|
+
choicesLayout: r.oneOf([
|
|
156
156
|
"vertical",
|
|
157
157
|
"grid",
|
|
158
158
|
"horizontal"
|
|
159
159
|
]),
|
|
160
|
-
isSelectionButtonBelow:
|
|
160
|
+
isSelectionButtonBelow: r.bool
|
|
161
161
|
};
|
|
162
162
|
static defaultProps = {
|
|
163
163
|
rationale: null,
|
|
@@ -189,7 +189,7 @@ var v = _(a, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(i, "
|
|
|
189
189
|
c && c.focus();
|
|
190
190
|
};
|
|
191
191
|
render() {
|
|
192
|
-
let { choiceMode:
|
|
192
|
+
let { choiceMode: n, disabled: r, displayKey: i, feedback: a, label: o, correctness: s, className: d, rationale: f, hideTick: p, isEvaluateMode: m, choicesLayout: h, value: g, checked: _, tagName: b, isSelectionButtonBelow: x } = this.props, S = n === "checkbox" ? M : P, k = n === "checkbox" ? "checkbox" : "radio-button", A = {
|
|
193
193
|
...h === "horizontal" && { [`& .${C}`]: {
|
|
194
194
|
padding: "8px",
|
|
195
195
|
margin: "4px 0 4px 4px"
|
|
@@ -199,55 +199,55 @@ var v = _(a, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(i, "
|
|
|
199
199
|
justifyContent: "center",
|
|
200
200
|
"& > label": { alignItems: "center" }
|
|
201
201
|
}
|
|
202
|
-
}, j = typeof
|
|
202
|
+
}, j = typeof o == "string" && (o.includes("<math") || o.includes("\\(") || o.includes("\\[") || o.includes("<img") || o.includes("data-latex") || o.includes("data-raw") || o.includes("<mjx-container")), N = i ? /* @__PURE__ */ l(D, {
|
|
203
203
|
id: this.descId,
|
|
204
|
-
children: j ? `Pick the answer below, ${
|
|
205
|
-
}) : null, F = /* @__PURE__ */ c
|
|
204
|
+
children: j ? `Pick the answer below, ${i}` : i
|
|
205
|
+
}) : null, F = /* @__PURE__ */ l(c, { children: i && !x ? /* @__PURE__ */ u(w, {
|
|
206
206
|
component: "span",
|
|
207
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ u("span", {
|
|
208
208
|
"aria-hidden": "true",
|
|
209
209
|
children: [
|
|
210
|
-
|
|
210
|
+
i,
|
|
211
211
|
".",
|
|
212
212
|
"\xA0"
|
|
213
213
|
]
|
|
214
|
-
}), /* @__PURE__ */
|
|
214
|
+
}), /* @__PURE__ */ l(v, {
|
|
215
215
|
className: "prompt-label",
|
|
216
|
-
prompt:
|
|
216
|
+
prompt: o,
|
|
217
217
|
tagName: "span"
|
|
218
218
|
})]
|
|
219
|
-
}) : /* @__PURE__ */
|
|
219
|
+
}) : /* @__PURE__ */ l(v, {
|
|
220
220
|
className: "prompt-label",
|
|
221
|
-
prompt:
|
|
221
|
+
prompt: o,
|
|
222
222
|
tagName: "span"
|
|
223
223
|
}) }), I = {
|
|
224
|
-
disabled:
|
|
224
|
+
disabled: r,
|
|
225
225
|
checked: _,
|
|
226
|
-
correctness:
|
|
226
|
+
correctness: s,
|
|
227
227
|
tagName: b,
|
|
228
228
|
value: g,
|
|
229
229
|
id: this.choiceId,
|
|
230
230
|
onChange: this.onToggleChoice,
|
|
231
231
|
onKeyDown: this.handleKeyDown,
|
|
232
232
|
...N ? { "aria-describedby": this.descId } : {}
|
|
233
|
-
}, L = x ? /* @__PURE__ */
|
|
233
|
+
}, L = x ? /* @__PURE__ */ u(E, { children: [
|
|
234
234
|
N,
|
|
235
|
-
/* @__PURE__ */
|
|
235
|
+
/* @__PURE__ */ l(S, {
|
|
236
236
|
...I,
|
|
237
237
|
style: { padding: 0 }
|
|
238
238
|
}),
|
|
239
|
-
/* @__PURE__ */
|
|
239
|
+
/* @__PURE__ */ l("span", {
|
|
240
240
|
"aria-hidden": "true",
|
|
241
|
-
children:
|
|
241
|
+
children: i ? `${i}.` : ""
|
|
242
242
|
})
|
|
243
|
-
] }) : /* @__PURE__ */
|
|
244
|
-
return /* @__PURE__ */
|
|
245
|
-
className:
|
|
243
|
+
] }) : /* @__PURE__ */ u(c, { children: [N, /* @__PURE__ */ l(S, { ...I })] });
|
|
244
|
+
return /* @__PURE__ */ u("div", {
|
|
245
|
+
className: e(d, "corespring-" + k, "choice-input"),
|
|
246
246
|
children: [
|
|
247
|
-
/* @__PURE__ */
|
|
247
|
+
/* @__PURE__ */ u(w, { children: [!p && m && /* @__PURE__ */ l(t, { correctness: s }), /* @__PURE__ */ l(T, {
|
|
248
248
|
className: "checkbox-holder",
|
|
249
249
|
sx: A,
|
|
250
|
-
children: /* @__PURE__ */
|
|
250
|
+
children: /* @__PURE__ */ l(O, {
|
|
251
251
|
label: F,
|
|
252
252
|
value: g,
|
|
253
253
|
htmlFor: this.choiceId,
|
|
@@ -255,14 +255,14 @@ var v = _(a, "PreviewPrompt") || _(S.PreviewPrompt, "PreviewPrompt"), y = _(i, "
|
|
|
255
255
|
control: L
|
|
256
256
|
})
|
|
257
257
|
})] }),
|
|
258
|
-
f && /* @__PURE__ */
|
|
258
|
+
f && /* @__PURE__ */ l(v, {
|
|
259
259
|
className: "rationale",
|
|
260
260
|
defaultClassName: "rationale",
|
|
261
261
|
prompt: f
|
|
262
262
|
}),
|
|
263
|
-
/* @__PURE__ */
|
|
264
|
-
feedback:
|
|
265
|
-
correctness:
|
|
263
|
+
/* @__PURE__ */ l(y, {
|
|
264
|
+
feedback: a,
|
|
265
|
+
correctness: s
|
|
266
266
|
})
|
|
267
267
|
]
|
|
268
268
|
});
|
package/dist/delivery/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import e from "./main.js";
|
|
2
|
-
import t from "
|
|
3
|
-
import
|
|
4
|
-
import i from "
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { updateSessionMetadata as t, updateSessionValue as n } from "./session-updater.js";
|
|
3
|
+
import r from "react";
|
|
4
|
+
import * as i from "@pie-lib/render-ui";
|
|
5
|
+
import { EnableAudioAutoplayImage as a } from "@pie-lib/render-ui";
|
|
6
|
+
import { createRoot as o } from "react-dom/client";
|
|
7
|
+
import { debounce as s } from "@pie-element/shared-lodash";
|
|
8
8
|
import c from "debug";
|
|
9
9
|
import { ModelSetEvent as l, SessionChangedEvent as u } from "@pie-element/shared-player-events";
|
|
10
10
|
import { renderMath as d } from "@pie-element/shared-math-rendering-mathjax";
|
|
@@ -15,7 +15,7 @@ function f(e) {
|
|
|
15
15
|
function p(e, t) {
|
|
16
16
|
return !e || f(e) ? e : f(e.default) ? e.default : t && f(e[t]) ? e[t] : t && f(e[t]?.default) ? e[t].default : e;
|
|
17
17
|
}
|
|
18
|
-
var m = p(
|
|
18
|
+
var m = p(a, "EnableAudioAutoplayImage") || p(_.EnableAudioAutoplayImage, "EnableAudioAutoplayImage"), h = i, g = h.default, _ = g && typeof g == "object" ? g : h, v = c("pie-ui:multiple-choice"), y = (e, t, n, r) => {
|
|
19
19
|
let { autoplayAudioEnabled: i, completeAudioEnabled: a } = t || {};
|
|
20
20
|
if (i && a && !n && r) {
|
|
21
21
|
let e = r.querySelector("audio"), t = e && e.closest("#preview-prompt");
|
|
@@ -49,9 +49,9 @@ function x(e) {
|
|
|
49
49
|
}
|
|
50
50
|
var S = class extends HTMLElement {
|
|
51
51
|
constructor() {
|
|
52
|
-
super(), this._model = null, this._session = null, this._options = null, this.audioComplete = !1, this._boundHandleKeyDown = this.handleKeyDown.bind(this), this._keyboardEventsEnabled = !1, this._audioInitialized = !1, this._root = null, this._mathObserver = null, this._mathRenderPending = !1, this._rerender =
|
|
52
|
+
super(), this._model = null, this._session = null, this._options = null, this.audioComplete = !1, this._boundHandleKeyDown = this.handleKeyDown.bind(this), this._keyboardEventsEnabled = !1, this._audioInitialized = !1, this._root = null, this._mathObserver = null, this._mathRenderPending = !1, this._rerender = s(() => {
|
|
53
53
|
if (this._model && this._session) {
|
|
54
|
-
var t =
|
|
54
|
+
var t = r.createElement(e, {
|
|
55
55
|
model: this._model,
|
|
56
56
|
session: this._session,
|
|
57
57
|
options: this._options,
|
|
@@ -59,14 +59,14 @@ var S = class extends HTMLElement {
|
|
|
59
59
|
onShowCorrectToggle: this.onShowCorrectToggle.bind(this),
|
|
60
60
|
...x(this)
|
|
61
61
|
});
|
|
62
|
-
this.setAttribute("aria-label", this._model.choiceMode === "radio" ? "Multiple Choice Question" : "Multiple Correct Answer Question"), this.setAttribute("role", "region"), this.setLangAttribute(), this._initMathObserver(), this._root ||=
|
|
62
|
+
this.setAttribute("aria-label", this._model.choiceMode === "radio" ? "Multiple Choice Question" : "Multiple Correct Answer Question"), this.setAttribute("role", "region"), this.setLangAttribute(), this._initMathObserver(), this._root ||= o(this), this._root.render(t), this._model.keyboardEventsEnabled === !0 && !this._keyboardEventsEnabled && this.enableKeyboardEvents();
|
|
63
63
|
} else v("skip");
|
|
64
64
|
}, 50, {
|
|
65
65
|
leading: !1,
|
|
66
66
|
trailing: !0
|
|
67
|
-
}), this._dispatchResponseChanged =
|
|
67
|
+
}), this._dispatchResponseChanged = s(() => {
|
|
68
68
|
this.dispatchEvent(new u(this.tagName.toLowerCase(), y(this._session, this._model, this.audioComplete, this)));
|
|
69
|
-
}), this._dispatchModelSet =
|
|
69
|
+
}), this._dispatchModelSet = s(() => {
|
|
70
70
|
this.dispatchEvent(new l(this.tagName.toLowerCase(), y(this._session, this._model, this.audioComplete, this), this._model !== void 0));
|
|
71
71
|
}, 50, {
|
|
72
72
|
leading: !1,
|
|
@@ -121,7 +121,7 @@ var S = class extends HTMLElement {
|
|
|
121
121
|
this._session = e, this._rerender(), this._dispatchResponseChanged();
|
|
122
122
|
}
|
|
123
123
|
_onChange(e) {
|
|
124
|
-
|
|
124
|
+
n(this._session, this._model.choiceMode, e), this._dispatchResponseChanged(), this._rerender();
|
|
125
125
|
}
|
|
126
126
|
_createAudioInfoToast() {
|
|
127
127
|
let e = document.createElement("div");
|
|
@@ -141,7 +141,7 @@ var S = class extends HTMLElement {
|
|
|
141
141
|
return t.src = m, t.alt = "Click anywhere to enable audio autoplay", t.width = 500, t.height = 300, e.appendChild(t), e;
|
|
142
142
|
}
|
|
143
143
|
connectedCallback() {
|
|
144
|
-
this._initMathObserver(), this._initPlayerObserver(), this._rerender(), new MutationObserver((e,
|
|
144
|
+
this._initMathObserver(), this._initPlayerObserver(), this._rerender(), new MutationObserver((e, n) => {
|
|
145
145
|
e.forEach((e) => {
|
|
146
146
|
if (e.type === "childList") {
|
|
147
147
|
if (this._audioInitialized) return;
|
|
@@ -154,15 +154,15 @@ var S = class extends HTMLElement {
|
|
|
154
154
|
e.paused && !this.querySelector("#play-audio-info") ? (a.appendChild(i), document.addEventListener("click", o)) : document.removeEventListener("click", o);
|
|
155
155
|
}, 500);
|
|
156
156
|
let s = () => {
|
|
157
|
-
|
|
158
|
-
let
|
|
159
|
-
|
|
157
|
+
t(this._session, { audioStartTime: (/* @__PURE__ */ new Date()).getTime() });
|
|
158
|
+
let n = this.querySelector("#play-audio-info");
|
|
159
|
+
n && a.removeChild(n), e.removeEventListener("playing", s);
|
|
160
160
|
};
|
|
161
161
|
e.addEventListener("playing", s);
|
|
162
162
|
let c = () => {
|
|
163
|
-
|
|
163
|
+
t(this._session, { audioEndTime: (/* @__PURE__ */ new Date()).getTime() }), this.audioComplete = !0, this._dispatchResponseChanged(), e.removeEventListener("ended", c);
|
|
164
164
|
};
|
|
165
|
-
e.addEventListener("ended", c), this._audio = e, this._handlePlaying = s, this._handleEnded = c, this._enableAudio = o, this._audioInitialized = !0,
|
|
165
|
+
e.addEventListener("ended", c), this._audio = e, this._handlePlaying = s, this._handleEnded = c, this._enableAudio = o, this._audioInitialized = !0, n.disconnect();
|
|
166
166
|
}
|
|
167
167
|
});
|
|
168
168
|
}).observe(this, {
|