@pie-element/multiple-choice 13.2.1-next.1 → 13.2.1-next.107
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/CHANGELOG.json +1972 -0
- package/CHANGELOG.md +2716 -0
- package/LICENSE.md +5 -0
- package/PRINT.md +35 -0
- package/README.md +56 -0
- package/choice.png +0 -0
- package/configure/CHANGELOG.json +1387 -0
- package/configure/CHANGELOG.md +2064 -0
- package/configure/lib/defaults.js +203 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +205 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/main.js +484 -0
- package/configure/lib/main.js.map +1 -0
- package/configure/lib/utils.js +18 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +22 -0
- package/controller/CHANGELOG.json +527 -0
- package/controller/CHANGELOG.md +1401 -0
- package/controller/lib/defaults.js +33 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +298 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +15 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +15 -0
- package/docs/config-schema.json +2993 -0
- package/docs/config-schema.json.md +2217 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +61 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +7 -0
- package/docs/pie-schema.json +1332 -0
- package/docs/pie-schema.json.md +1015 -0
- package/lib/choice-input.js +383 -0
- package/lib/choice-input.js.map +1 -0
- package/lib/choice.js +192 -0
- package/lib/choice.js.map +1 -0
- package/lib/feedback-tick.js +134 -0
- package/lib/feedback-tick.js.map +1 -0
- package/lib/index.js +405 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +63 -0
- package/lib/main.js.map +1 -0
- package/lib/multiple-choice.js +399 -0
- package/lib/multiple-choice.js.map +1 -0
- package/lib/print.js +94 -0
- package/lib/print.js.map +1 -0
- package/lib/session-updater.js +37 -0
- package/lib/session-updater.js.map +1 -0
- package/lib/utils.js +14 -0
- package/lib/utils.js.map +1 -0
- package/module/configure.js +1 -0
- package/module/controller.js +3042 -0
- package/module/demo.js +86 -0
- package/module/element.js +1 -0
- package/module/index.html +21 -0
- package/module/manifest.json +14 -0
- package/module/print-demo.js +124 -0
- package/module/print.html +18 -0
- package/module/print.js +1 -0
- package/package.json +26 -56
- package/dist/author/defaults.d.ts +0 -205
- package/dist/author/defaults.js +0 -151
- package/dist/author/index.d.ts +0 -26
- package/dist/author/index.js +0 -119
- package/dist/author/main.d.ts +0 -34
- package/dist/author/main.js +0 -287
- package/dist/author/utils.d.ts +0 -9
- package/dist/author/utils.js +0 -7
- package/dist/controller/defaults.d.ts +0 -35
- package/dist/controller/defaults.js +0 -29
- package/dist/controller/index.d.ts +0 -65
- package/dist/controller/index.js +0 -124
- package/dist/controller/utils.d.ts +0 -10
- package/dist/controller/utils.js +0 -8
- package/dist/delivery/choice-input.d.ts +0 -44
- package/dist/delivery/choice-input.js +0 -271
- package/dist/delivery/choice.d.ts +0 -20
- package/dist/delivery/choice.js +0 -105
- package/dist/delivery/feedback-tick.d.ts +0 -20
- package/dist/delivery/feedback-tick.js +0 -104
- package/dist/delivery/index.d.ts +0 -37
- package/dist/delivery/index.js +0 -214
- package/dist/delivery/main.d.ts +0 -31
- package/dist/delivery/main.js +0 -51
- package/dist/delivery/multiple-choice.d.ts +0 -61
- package/dist/delivery/multiple-choice.js +0 -244
- package/dist/delivery/session-updater.d.ts +0 -10
- package/dist/delivery/session-updater.js +0 -9
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -148
- package/dist/index.js +0 -2
- 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
- package/dist/print/index.d.ts +0 -15
- package/dist/print/index.js +0 -44
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateSessionMetadata = updateSessionMetadata;
|
|
7
|
+
exports.updateSessionValue = updateSessionValue;
|
|
8
|
+
function updateSessionValue(session, choiceMode, data) {
|
|
9
|
+
session.value = session.value || [];
|
|
10
|
+
if (choiceMode === 'checkbox') {
|
|
11
|
+
if (data.selected) {
|
|
12
|
+
session.value = Array.from(new Set([...session.value, data.value]));
|
|
13
|
+
} else {
|
|
14
|
+
session.value = session.value.filter(v => v !== data.value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (choiceMode === 'radio') {
|
|
18
|
+
if (data.selected) {
|
|
19
|
+
session.value = [data.value];
|
|
20
|
+
} else {
|
|
21
|
+
session.value = [];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//update session value metadata
|
|
26
|
+
session.selector = data.selector; //the input method used to select the choice (e.g. mouse, keyboard)
|
|
27
|
+
}
|
|
28
|
+
function updateSessionMetadata(session, metadata) {
|
|
29
|
+
session.audioStartTime = session.audioStartTime || metadata.audioStartTime; //timestamp when auto-played audio started playing
|
|
30
|
+
session.audioEndTime = session.audioEndTime || metadata.audioEndTime; //timestamp when auto-played audio completed playing
|
|
31
|
+
|
|
32
|
+
if (!session.waitTime && session.audioStartTime && session.audioEndTime) {
|
|
33
|
+
// waitTime is elapsed time the user waited for auto-played audio to finish
|
|
34
|
+
session.waitTime = session.audioEndTime - session.audioStartTime;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=session-updater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-updater.js","names":["updateSessionValue","session","choiceMode","data","value","selected","Array","from","Set","filter","v","selector","updateSessionMetadata","metadata","audioStartTime","audioEndTime","waitTime"],"sources":["../src/session-updater.js"],"sourcesContent":["export function updateSessionValue(session, choiceMode, data) {\n session.value = session.value || [];\n if (choiceMode === 'checkbox') {\n if (data.selected) {\n session.value = Array.from(new Set([...session.value, data.value]));\n } else {\n session.value = session.value.filter(v => v !== data.value);\n }\n }\n\n if (choiceMode === 'radio') {\n if (data.selected) {\n session.value = [data.value];\n } else {\n session.value = [];\n }\n }\n \n //update session value metadata\n session.selector = data.selector; //the input method used to select the choice (e.g. mouse, keyboard)\n}\n\nexport function updateSessionMetadata(session, metadata) {\n session.audioStartTime = session.audioStartTime || metadata.audioStartTime; //timestamp when auto-played audio started playing\n session.audioEndTime = session.audioEndTime || metadata.audioEndTime; //timestamp when auto-played audio completed playing\n \n if(!session.waitTime && session.audioStartTime && session.audioEndTime) {\n // waitTime is elapsed time the user waited for auto-played audio to finish\n session.waitTime = (session.audioEndTime - session.audioStartTime);\n }\n}\n"],"mappings":";;;;;;;AAAO,SAASA,kBAAkBA,CAACC,OAAO,EAAEC,UAAU,EAAEC,IAAI,EAAE;EAC5DF,OAAO,CAACG,KAAK,GAAGH,OAAO,CAACG,KAAK,IAAI,EAAE;EACnC,IAAIF,UAAU,KAAK,UAAU,EAAE;IAC7B,IAAIC,IAAI,CAACE,QAAQ,EAAE;MACjBJ,OAAO,CAACG,KAAK,GAAGE,KAAK,CAACC,IAAI,CAAC,IAAIC,GAAG,CAAC,CAAC,GAAGP,OAAO,CAACG,KAAK,EAAED,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC,MAAM;MACLH,OAAO,CAACG,KAAK,GAAGH,OAAO,CAACG,KAAK,CAACK,MAAM,CAACC,CAAC,IAAIA,CAAC,KAAKP,IAAI,CAACC,KAAK,CAAC;IAC7D;EACF;EAEA,IAAIF,UAAU,KAAK,OAAO,EAAE;IAC1B,IAAIC,IAAI,CAACE,QAAQ,EAAE;MACjBJ,OAAO,CAACG,KAAK,GAAG,CAACD,IAAI,CAACC,KAAK,CAAC;IAC9B,CAAC,MAAM;MACLH,OAAO,CAACG,KAAK,GAAG,EAAE;IACpB;EACF;;EAEA;EACAH,OAAO,CAACU,QAAQ,GAAGR,IAAI,CAACQ,QAAQ,CAAC,CAAC;AACpC;AAEO,SAASC,qBAAqBA,CAACX,OAAO,EAAEY,QAAQ,EAAE;EACvDZ,OAAO,CAACa,cAAc,GAAGb,OAAO,CAACa,cAAc,IAAID,QAAQ,CAACC,cAAc,CAAC,CAAC;EAC5Eb,OAAO,CAACc,YAAY,GAAGd,OAAO,CAACc,YAAY,IAAIF,QAAQ,CAACE,YAAY,CAAC,CAAC;;EAEtE,IAAG,CAACd,OAAO,CAACe,QAAQ,IAAIf,OAAO,CAACa,cAAc,IAAIb,OAAO,CAACc,YAAY,EAAE;IACtE;IACAd,OAAO,CAACe,QAAQ,GAAIf,OAAO,CAACc,YAAY,GAAGd,OAAO,CAACa,cAAe;EACpE;AACF","ignoreList":[]}
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.reachedMaxSelections = exports.exceedsMaxSelections = void 0;
|
|
7
|
+
// Returns true when count is at or above maxSelections (use to block the next selection).
|
|
8
|
+
const reachedMaxSelections = (count, maxSelections) => maxSelections != null && count >= maxSelections;
|
|
9
|
+
|
|
10
|
+
// Returns true when count strictly exceeds maxSelections (use for validation / isComplete checks).
|
|
11
|
+
exports.reachedMaxSelections = reachedMaxSelections;
|
|
12
|
+
const exceedsMaxSelections = (count, maxSelections) => maxSelections != null && count > maxSelections;
|
|
13
|
+
exports.exceedsMaxSelections = exceedsMaxSelections;
|
|
14
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/utils.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["reachedMaxSelections","count","maxSelections","exports","exceedsMaxSelections"],"sources":["../src/utils.js"],"sourcesContent":["// Returns true when count is at or above maxSelections (use to block the next selection).\nexport const reachedMaxSelections = (count, maxSelections) =>\n maxSelections != null && count >= maxSelections;\n\n// Returns true when count strictly exceeds maxSelections (use for validation / isComplete checks).\nexport const exceedsMaxSelections = (count, maxSelections) =>\n maxSelections != null && count > maxSelections;\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,oBAAoB,GAAGA,CAACC,KAAK,EAAEC,aAAa,KACvDA,aAAa,IAAI,IAAI,IAAID,KAAK,IAAIC,aAAa;;AAEjD;AAAAC,OAAA,CAAAH,oBAAA,GAAAA,oBAAA;AACO,MAAMI,oBAAoB,GAAGA,CAACH,KAAK,EAAEC,aAAa,KACvDA,aAAa,IAAI,IAAI,IAAID,KAAK,GAAGC,aAAa;AAACC,OAAA,CAAAC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_dll_react as e,_dll_prop_types as t,_dll_mui__material_styles as n,_dll_pie_lib__render_ui as o,_dll_mui__material as i,_dll_mui__icons_material as r,_dll_debug as a,_dll_react_dom_client as s}from"../../../@pie-lib/shared-module@^5.2.12/module/index.js";import{_dll_pie_lib__math_rendering as l}from"../../../@pie-lib/math-rendering-module@^5.1.2/module/index.js";import{_dll_pie_lib__config_ui as c}from"../../../@pie-lib/config-module@^4.0.17/module/index.js";import{_dll_pie_lib__editable_html_tip_tap as u}from"../../../@pie-lib/editable-html-module@^7.1.14/module/index.js";var d={};Object.defineProperty(d,"__esModule",{value:!0});class h extends CustomEvent{constructor(e,t=!1){super(h.TYPE,{bubbles:!0,detail:{update:e,reset:t}}),this.update=e,this.reset=t}}h.TYPE="model.updated";var p=d.ModelUpdatedEvent=h;class g extends CustomEvent{constructor(e,t){super(g.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}g.TYPE="delete.image";var b=d.DeleteImageEvent=g;class f extends CustomEvent{constructor(e){super(f.TYPE,{bubbles:!0,detail:e}),this.handler=e}}f.TYPE="insert.image";var m=d.InsertImageEvent=f;class _ extends CustomEvent{constructor(e,t){super(_.TYPE,{bubbles:!0,detail:{src:e,done:t}}),this.src=e,this.done=t}}_.TYPE="delete.sound";var y=d.DeleteSoundEvent=_;class C extends CustomEvent{constructor(e){super(C.TYPE,{bubbles:!0,detail:e}),this.handler=e}}C.TYPE="insert.sound";var v=d.InsertSoundEvent=C,E="object"==typeof global&&global&&global.Object===Object&&global,j="object"==typeof self&&self&&self.Object===Object&&self,A=E||j||Function("return this")(),S=A.Symbol,x=Object.prototype,w=x.hasOwnProperty,O=x.toString,P=S?S.toStringTag:void 0,I=Object.prototype.toString,M=S?S.toStringTag:void 0;function k(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":M&&M in Object(e)?function(e){var t=w.call(e,P),n=e[P];try{e[P]=void 0;var o=!0}catch(e){}var i=O.call(e);return o&&(t?e[P]=n:delete e[P]),i}(e):function(e){return I.call(e)}(e)}function T(e){return null!=e&&"object"==typeof e}var z=Array.isArray;function R(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function L(e){return e}function D(e){if(!R(e))return!1;var t=k(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var q,F=A["__core-js_shared__"],U=(q=/[^.]+$/.exec(F&&F.keys&&F.keys.IE_PROTO||""))?"Symbol(src)_1."+q:"",$=Function.prototype.toString,B=/^\[object .+?Constructor\]$/,W=Function.prototype,Y=Object.prototype,H=W.toString,N=Y.hasOwnProperty,G=RegExp("^"+H.call(N).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function V(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return function(e){return!(!R(e)||(t=e,U&&U in t))&&(D(e)?G:B).test(function(e){if(null!=e){try{return $.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}(n)?n:void 0}var J,K,Q,X=Object.create,Z=function(){function e(){}return function(t){if(!R(t))return{};if(X)return X(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}(),ee=Date.now,te=function(){try{var e=V(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),ne=te,oe=ne?function(e,t){return ne(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:L,ie=(J=oe,K=0,Q=0,function(){var e=ee(),t=16-(e-Q);if(Q=e,t>0){if(++K>=800)return arguments[0]}else K=0;return J.apply(void 0,arguments)}),re=/^(?:0|[1-9]\d*)$/;function ae(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&re.test(e))&&e>-1&&e%1==0&&e<t}function se(e,t,n){"__proto__"==t&&ne?ne(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function le(e,t){return e===t||e!=e&&t!=t}var ce=Object.prototype.hasOwnProperty;function ue(e,t,n){var o=e[t];ce.call(e,t)&&le(o,n)&&(void 0!==n||t in e)||se(e,t,n)}var de=Math.max;function he(e,t){return ie(function(e,t,n){return t=de(void 0===t?e.length-1:t,0),function(){for(var o=arguments,i=-1,r=de(o.length-t,0),a=Array(r);++i<r;)a[i]=o[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=o[i];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,L),e+"")}function pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function ge(e){return null!=e&&pe(e.length)&&!D(e)}function be(e,t,n){if(!R(n))return!1;var o=typeof t;return!!("number"==o?ge(n)&&ae(t,n.length):"string"==o&&t in n)&&le(n[t],e)}var fe=Object.prototype;function me(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||fe)}function _e(e){return T(e)&&"[object Arguments]"==k(e)}var ye=Object.prototype,Ce=ye.hasOwnProperty,ve=ye.propertyIsEnumerable,Ee=_e(function(){return arguments}())?_e:function(e){return T(e)&&Ce.call(e,"callee")&&!ve.call(e,"callee")},je="object"==typeof exports&&exports&&!exports.nodeType&&exports,Ae=je&&"object"==typeof module&&module&&!module.nodeType&&module,Se=Ae&&Ae.exports===je?A.Buffer:void 0,xe=(Se?Se.isBuffer:void 0)||function(){return!1},we={};we["[object Float32Array]"]=we["[object Float64Array]"]=we["[object Int8Array]"]=we["[object Int16Array]"]=we["[object Int32Array]"]=we["[object Uint8Array]"]=we["[object Uint8ClampedArray]"]=we["[object Uint16Array]"]=we["[object Uint32Array]"]=!0,we["[object Arguments]"]=we["[object Array]"]=we["[object ArrayBuffer]"]=we["[object Boolean]"]=we["[object DataView]"]=we["[object Date]"]=we["[object Error]"]=we["[object Function]"]=we["[object Map]"]=we["[object Number]"]=we["[object Object]"]=we["[object RegExp]"]=we["[object Set]"]=we["[object String]"]=we["[object WeakMap]"]=!1;var Oe="object"==typeof exports&&exports&&!exports.nodeType&&exports,Pe=Oe&&"object"==typeof module&&module&&!module.nodeType&&module,Ie=Pe&&Pe.exports===Oe&&E.process,Me=function(){try{return Pe&&Pe.require&&Pe.require("util").types||Ie&&Ie.binding&&Ie.binding("util")}catch(e){}}(),ke=Me&&Me.isTypedArray,Te=ke?function(e){return function(t){return e(t)}}(ke):function(e){return T(e)&&pe(e.length)&&!!we[k(e)]},ze=Te,Re=Object.prototype.hasOwnProperty;var Le=Object.prototype.hasOwnProperty;function De(e){return ge(e)?function(e,t){var n=z(e),o=!n&&Ee(e),i=!n&&!o&&xe(e),r=!n&&!o&&!i&&ze(e),a=n||o||i||r,s=a?function(e,t){for(var n=-1,o=Array(e);++n<e;)o[n]=t(n);return o}(e.length,String):[],l=s.length;for(var c in e)!t&&!Re.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||r&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ae(c,l))||s.push(c);return s}(e,!0):function(e){if(!R(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=me(e),n=[];for(var o in e)("constructor"!=o||!t&&Le.call(e,o))&&n.push(o);return n}(e)}var qe=V(Object,"create"),Fe=Object.prototype.hasOwnProperty,Ue=Object.prototype.hasOwnProperty;function $e(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}function Be(e,t){for(var n=e.length;n--;)if(le(e[n][0],t))return n;return-1}$e.prototype.clear=function(){this.__data__=qe?qe(null):{},this.size=0},$e.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},$e.prototype.get=function(e){var t=this.__data__;if(qe){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Fe.call(t,e)?t[e]:void 0},$e.prototype.has=function(e){var t=this.__data__;return qe?void 0!==t[e]:Ue.call(t,e)},$e.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=qe&&void 0===t?"__lodash_hash_undefined__":t,this};var We=Array.prototype.splice;function Ye(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Ye.prototype.clear=function(){this.__data__=[],this.size=0},Ye.prototype.delete=function(e){var t=this.__data__,n=Be(t,e);return!(n<0||(n==t.length-1?t.pop():We.call(t,n,1),--this.size,0))},Ye.prototype.get=function(e){var t=this.__data__,n=Be(t,e);return n<0?void 0:t[n][1]},Ye.prototype.has=function(e){return Be(this.__data__,e)>-1},Ye.prototype.set=function(e,t){var n=this.__data__,o=Be(n,e);return o<0?(++this.size,n.push([e,t])):n[o][1]=t,this};var He=V(A,"Map");function Ne(e,t){var n,o,i=e.__data__;return("string"==(o=typeof(n=t))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var o=e[t];this.set(o[0],o[1])}}Ge.prototype.clear=function(){this.size=0,this.__data__={hash:new $e,map:new(He||Ye),string:new $e}},Ge.prototype.delete=function(e){var t=Ne(this,e).delete(e);return this.size-=t?1:0,t},Ge.prototype.get=function(e){return Ne(this,e).get(e)},Ge.prototype.has=function(e){return Ne(this,e).has(e)},Ge.prototype.set=function(e,t){var n=Ne(this,e),o=n.size;return n.set(e,t),this.size+=n.size==o?0:1,this};var Ve=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object),Je=Ve,Ke=Function.prototype,Qe=Object.prototype,Xe=Ke.toString,Ze=Qe.hasOwnProperty,et=Xe.call(Object);function tt(e){var t=this.__data__=new Ye(e);this.size=t.size}tt.prototype.clear=function(){this.__data__=new Ye,this.size=0},tt.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},tt.prototype.get=function(e){return this.__data__.get(e)},tt.prototype.has=function(e){return this.__data__.has(e)},tt.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Ye){var o=n.__data__;if(!He||o.length<199)return o.push([e,t]),this.size=++n.size,this;n=this.__data__=new Ge(o)}return n.set(e,t),this.size=n.size,this};var nt="object"==typeof exports&&exports&&!exports.nodeType&&exports,ot=nt&&"object"==typeof module&&module&&!module.nodeType&&module,it=ot&&ot.exports===nt?A.Buffer:void 0,rt=(it&&it.allocUnsafe,A.Uint8Array);var at=Object.prototype,st=at.hasOwnProperty,lt=he(function(e,t){e=Object(e);var n=-1,o=t.length,i=o>2?t[2]:void 0;for(i&&be(t[0],t[1],i)&&(o=1);++n<o;)for(var r=t[n],a=De(r),s=-1,l=a.length;++s<l;){var c=a[s],u=e[c];(void 0===u||le(u,at[c])&&!st.call(e,c))&&(e[c]=r[c])}return e});function ct(e,t,n){(void 0!==n&&!le(e[t],n)||void 0===n&&!(t in e))&&se(e,t,n)}function ut(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function dt(e,t,n,o,i,r,a){var s=ut(e,n),l=ut(t,n),c=a.get(l);if(c)ct(e,n,c);else{var u,d=r?r(s,l,n+"",e,t,a):void 0,h=void 0===d;if(h){var p=z(l),g=!p&&xe(l),b=!p&&!g&&ze(l);d=l,p||g||b?z(s)?d=s:T(u=s)&&ge(u)?d=function(e,t){var n=-1,o=e.length;for(t||(t=Array(o));++n<o;)t[n]=e[n];return t}(s):g?(h=!1,d=function(e){return e.slice()}(l)):b?(h=!1,d=function(e,t){var n,o,i=t?(o=new(n=e.buffer).constructor(n.byteLength),new rt(o).set(new rt(n)),o):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(l,!0)):d=[]:function(e){if(!T(e)||"[object Object]"!=k(e))return!1;var t=Je(e);if(null===t)return!0;var n=Ze.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Xe.call(n)==et}(l)||Ee(l)?(d=s,Ee(s)?d=function(e){return function(e,t,n){var o=!n;n||(n={});for(var i=-1,r=t.length;++i<r;){var a=t[i],s=void 0;void 0===s&&(s=e[a]),o?se(n,a,s):ue(n,a,s)}return n}(e,De(e))}(s):R(s)&&!D(s)||(d=function(e){return"function"!=typeof e.constructor||me(e)?{}:Z(Je(e))}(l))):h=!1}h&&(a.set(l,d),i(d,l,o,r,a),a.delete(l)),ct(e,n,d)}}function ht(e,t,n,o,i){e!==t&&function(e,t,n){for(var o=-1,i=Object(e),r=n(e),a=r.length;a--;){var s=r[++o];if(!1===t(i[s],s,i))break}}(t,function(r,a){if(i||(i=new tt),R(r))dt(e,t,a,n,ht,o,i);else{var s=o?o(ut(e,a),r,a+"",e,t,i):void 0;void 0===s&&(s=r),ct(e,a,s)}},De)}var pt,gt=(pt=function(e,t,n){ht(e,t,n)},he(function(e,t){var n=-1,o=t.length,i=o>1?t[o-1]:void 0,r=o>2?t[2]:void 0;for(i=pt.length>3&&"function"==typeof i?(o--,i):void 0,r&&be(t[0],t[1],r)&&(i=o<3?void 0:i,o=1),e=Object(e);++n<o;){var a=t[n];a&&pt(e,a,n)}return e}));const bt=e,ft=t,{styled:mt}=n,{color:_t}=o,{Button:yt}=i,{Tooltip:Ct}=i,{Typography:vt}=i,{Box:Et}=i,{Info:jt}=r,At=u,{AlertDialog:St}=c,{InputContainer:xt}=c,{ChoiceConfiguration:wt}=c,{settings:Ot}=c,{layout:Pt}=c,{choiceUtils:It}=c;function Mt(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const{Panel:kt,toggle:Tt,radio:zt,dropdown:Rt}=Ot,Lt=mt(xt)(({theme:e})=>({width:"100%",paddingTop:e.spacing(2),marginBottom:e.spacing(2)})),Dt=mt(xt)(({theme:e})=>({flex:1,marginTop:e.spacing(1.5),paddingTop:e.spacing(2),marginLeft:e.spacing(3.5)})),qt=mt(xt)(({theme:e})=>({display:"flex",flexDirection:"column",marginBottom:e.spacing(1),width:"100%"})),Ft=mt(yt)(({theme:e})=>({marginTop:e.spacing(1),float:"right"})),Ut=mt(Ft)({cursor:"not-allowed",pointerEvents:"all",backgroundColor:_t.disabled(),"&:hover":{backgroundColor:_t.disabled()},"&:focus":{backgroundColor:_t.disabled()}}),$t=mt(Et)({display:"flex",alignItems:"center"}),Bt=mt(vt)(({theme:e})=>({fontSize:e.typography.fontSize+2,marginRight:e.spacing(1)})),Wt=mt(Ct)(({theme:e})=>({"& .MuiTooltip-tooltip":{fontSize:e.typography.fontSize-2,whiteSpace:"pre",maxWidth:"500px"}})),Yt=mt("div")(({theme:e})=>({fontSize:e.typography.fontSize-2,color:e.palette.error.main,paddingTop:e.spacing(1)})),Ht=e=>{const{model:t,configuration:n,onPromptChanged:o,onChoiceChanged:i,onRemoveChoice:r,onAddChoice:a,imageSupport:s,uploadSoundSupport:l,onChangeModel:c,onConfigurationChanged:u,onTeacherInstructionsChanged:d}=e,{addChoiceButton:h={},contentDimensions:p={},feedback:g={},deleteChoice:b={},choiceMode:f={},choicePrefix:m={},partialScoring:_={},lockChoiceOrder:y={},teacherInstructions:C={},studentInstructions:v={},rationale:E={},scoringType:j={},sequentialChoiceLabels:A={},settingsPanelDisabled:S,choicesLayout:x,spellCheck:w={},gridColumns:O,maxImageWidth:P={},maxImageHeight:I={},prompt:M={},withRubric:k={},mathMlOptions:T={},language:z={},languageChoices:R={}}=n||{};let{maxAnswerChoices:L}=n||{};const{limitChoicesNumber:D,teacherInstructionsEnabled:q,rationaleEnabled:F,feedbackEnabled:U,promptEnabled:$,spellCheckEnabled:B,choices:W,errors:Y,toolbarEditorPosition:H,extraCSSRules:N}=t||{},{answerChoices:G,choices:V,correctResponse:J,prompt:K,rationale:Q,teacherInstructions:X}=Y||{},Z=Mt([W,"optionalAccess",e=>e.length])?Array.from({length:W.length},(e,t)=>`${t+1}`):[],{baseInputConfiguration:ee={}}=n,te={position:"top"===H?"top":"bottom"};D&&(L=9);const ne=(e={})=>({...ee,...e}),oe=(e=>{const{minAnswerChoices:t,maxAnswerChoices:n}=e;return`Validation requirements:\nThere should be at least ${t} `+(n?`and at most ${n} `:"")+"answer choices defined.\nEvery answer choice should be non-blank and unique.\nA correct answer must be defined."})(n),ie=P&&P.prompt,re=I&&I.prompt,ae=L&&Mt([W,"optionalAccess",e=>e.length])>=L?`Only ${L} allowed maximum`:"",se={choiceMode:f.settings&&zt(f.label,["checkbox","radio"]),"sequentialChoiceLabels.enabled":A.settings&&Tt(A.label,!0),choicePrefix:m.settings&&zt(m.label,["numbers","letters"]),partialScoring:_.settings&&Tt(_.label),lockChoiceOrder:y.settings&&Tt(y.label),feedbackEnabled:g.settings&&Tt(g.label),choicesLayout:x.settings&&Rt(x.label,["vertical","grid","horizontal"]),gridColumns:x.settings&&"grid"===t.choicesLayout&&Z.length>0&&Rt(O.label,Z),"language.enabled":z.settings&&Tt(z.label,!0),language:z.settings&&z.enabled&&Rt(R.label,R.options)},le={teacherInstructionsEnabled:C.settings&&Tt(C.label),studentInstructionsEnabled:v.settings&&Tt(v.label),promptEnabled:M.settings&&Tt(M.label),rationaleEnabled:E.settings&&Tt(E.label),spellCheckEnabled:w.settings&&Tt(w.label),scoringType:j.settings&&zt(j.label,["auto","rubric"]),rubricEnabled:Mt([k,"optionalAccess",e=>e.settings])&&Tt(Mt([k,"optionalAccess",e=>e.label]))};return bt.createElement(Pt.ConfigLayout,{dimensions:p,hideSettings:S,extraCSSRules:N,classes:{},settings:bt.createElement(kt,{model:t,onChangeModel:c,configuration:n,onChangeConfiguration:u,groups:{Settings:se,Properties:le}})},q&&bt.createElement(Lt,{label:C.label},bt.createElement(At,{markup:t.teacherInstructions||"",onChange:d,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:X,toolbarOpts:te,pluginProps:ne(Mt([n,"optionalAccess",e=>e.teacherInstructions,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.teacherInstructions||ie,maxImageHeight:I&&I.teacherInstructions||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),X&&bt.createElement(Yt,null,X)),$&&bt.createElement(Lt,{label:M.label},bt.createElement(At,{markup:t.prompt,onChange:o,imageSupport:s,nonEmpty:!1,disableUnderline:!0,error:K,toolbarOpts:te,pluginProps:ne(Mt([n,"optionalAccess",e=>e.prompt,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.prompt,maxImageHeight:I&&I.prompt,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),K&&bt.createElement(Yt,null,K)),bt.createElement($t,null,bt.createElement(Bt,{component:"div"},"Choices"),bt.createElement(Wt,{disableFocusListener:!0,disableTouchListener:!0,placement:"right",title:oe},bt.createElement(jt,{fontSize:"small",color:"primary"}))),W.map((e,o)=>bt.createElement(qt,{key:`choice-${o}`},bt.createElement(wt,{key:o,index:o+1,useLetterOrdering:"letters"===t.choicePrefix,mode:t.choiceMode,data:e,defaultFeedback:{},imageSupport:s,disableImageAlignmentButtons:!0,onDelete:()=>r(o),onChange:e=>i(o,e),allowFeedBack:U,allowDelete:b.settings,noLabels:!0,pluginOpts:ne(Mt([n,"optionalAccess",e=>e.choices,"optionalAccess",e=>e.inputConfiguration])),toolbarOpts:te,spellCheck:B,error:Mt([V,"optionalAccess",t=>t[e.value]])||null,noCorrectAnswerError:J,maxImageWidth:P&&P.choices||ie,maxImageHeight:I&&I.choices||re,uploadSoundSupport:l,mathMlOptions:T}),F&&bt.createElement(Dt,{key:`rationale-${o}`,label:E.label},bt.createElement(At,{markup:e.rationale||"",onChange:t=>i(o,{...e,rationale:t}),imageSupport:s,error:Mt([Q,"optionalAccess",t=>t[e.value]])||null,toolbarOpts:te,pluginProps:ne(Mt([n,"optionalAccess",e=>e.rationale,"optionalAccess",e=>e.inputConfiguration])),spellCheck:B,maxImageWidth:P&&P.rationale||ie,maxImageHeight:I&&I.rationale||re,uploadSoundSupport:l,languageCharactersProps:[{language:"spanish"},{language:"special"}],mathMlOptions:T}),Mt([Q,"optionalAccess",t=>t[e.value]])&&bt.createElement(Yt,null,Mt([Q,"optionalAccess",t=>t[e.value]]))))),J&&bt.createElement(Yt,null,J),G&&bt.createElement(Yt,null,G),h.settings&&bt.createElement(Wt,{title:ae},L&&Mt([W,"optionalAccess",e=>e.length])>=L?bt.createElement(Ut,{variant:"contained",color:"primary",onClick:a,disabled:!0},h.label):bt.createElement(Ft,{variant:"contained",color:"primary",onClick:a},h.label)))};class Nt extends bt.Component{constructor(...e){super(...e),Nt.prototype.__init.call(this),Nt.prototype.__init2.call(this),Nt.prototype.__init3.call(this),Nt.prototype.__init4.call(this),Nt.prototype.__init5.call(this),Nt.prototype.__init6.call(this),Nt.prototype.__init7.call(this)}static __initStatic(){this.propTypes={model:ft.object.isRequired,configuration:ft.object.isRequired,disableSidePanel:ft.bool,onModelChanged:ft.func.isRequired,onConfigurationChanged:ft.func.isRequired,imageSupport:ft.shape({add:ft.func.isRequired,delete:ft.func.isRequired})}}__init(){this.state={showWarning:!1}}__init2(){this.onRemoveChoice=e=>{const{model:t,configuration:n,onModelChanged:o}=this.props,{minAnswerChoices:i}=n||{};i&&t.choices.length===i?this.setState({showWarning:!0}):(t.choices.splice(e,1),o({choices:t.choices}))}}__init3(){this.onAddChoice=()=>{const{model:e,configuration:t,onModelChanged:n}=this.props;let{maxAnswerChoices:o}=t||{};const{limitChoicesNumber:i}=e||{};i&&(o=9),o&&e.choices.length>=o||(e.choices.push({label:"",value:It.firstAvailableIndex(e.choices.map(e=>e.value),0),feedback:{type:"none"}}),n({choices:e.choices}))}}__init4(){this.onChoiceChanged=(e,t)=>{const{model:n,onModelChanged:o}=this.props;t.correct&&"radio"===n.choiceMode&&(n.choices=n.choices.map(e=>gt({},e,{correct:!1}))),n.choices.splice(e,1,t),o({choices:n.choices})}}__init5(){this.onPromptChanged=e=>{this.props.onModelChanged({prompt:e})}}__init6(){this.onTeacherInstructionsChanged=e=>{this.props.onModelChanged({teacherInstructions:e})}}__init7(){this.onModelChanged=(e,t)=>{const{onModelChanged:n}=this.props;if("choiceMode"===t){if("radio"===e.choiceMode){let t=!1;e.choices=e.choices.map(e=>t?(e.correct=!1,e):(e.correct&&(t=!0),e))}n({choiceMode:e.choiceMode,choices:e.choices},!0)}else n(e)}}render(){const{configuration:{minAnswerChoices:e}={}}=this.props,{showWarning:t}=this.state;return bt.createElement(bt.Fragment,null,bt.createElement(St,{open:t,title:"Warning",text:`There can't be less than ${e||0} choices.`,onConfirm:()=>this.setState({showWarning:!1})}),bt.createElement(Ht,{...this.props,onChangeModel:this.onModelChanged,onRemoveChoice:this.onRemoveChoice,onChoiceChanged:this.onChoiceChanged,onAddChoice:this.onAddChoice,onPromptChanged:this.onPromptChanged,onTeacherInstructionsChanged:this.onTeacherInstructionsChanged}))}}Nt.__initStatic();var Gt={choiceMode:"checkbox",choicePrefix:"letters",choices:[],choicesLayout:"vertical",feedbackEnabled:!1,gridColumns:2,lockChoiceOrder:!0,partialScoring:!0,prompt:"",promptEnabled:!0,rationale:"",rationaleEnabled:!0,scoringType:"auto",studentInstructionsEnabled:!0,teacherInstructions:"",teacherInstructionsEnabled:!0,toolbarEditorPosition:"bottom",selectedAnswerBackgroundColor:"initial",keyboardEventsEnabled:!1},Vt={baseInputConfiguration:{h3:{disabled:!0},audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1},textAlign:{disabled:!0},showParagraphs:{disabled:!1},separateParagraphs:{disabled:!0}},choices:{inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}}},spellCheck:{label:"Spellcheck",settings:!1,enabled:!0},choicesLayout:{settings:!1,label:"Choices Layout"},gridColumns:{label:"Grid columns"},answerChoiceCount:0,addChoiceButton:{settings:!0,label:"Add a Choice"},choiceMode:{settings:!0,label:"Response Type"},choicePrefix:{settings:!0,label:"Choice Labels"},deleteChoice:{settings:!0},feedback:{settings:!0,label:"Feedback"},prompt:{settings:!0,label:"Prompt",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},lockChoiceOrder:{settings:!0,label:"Lock Choice Order"},partialScoring:{settings:!1,label:"Allow Partial Scoring"},rationale:{settings:!0,label:"Rationale",inputConfiguration:{audio:{disabled:!0},video:{disabled:!0},image:{disabled:!1}},required:!1},scoringType:{settings:!1,label:"Scoring Type"},studentInstructions:{settings:!1,label:"Student Instructions"},teacherInstructions:{settings:!0,label:"Teacher Instructions",inputConfiguration:{audio:{disabled:!1},video:{disabled:!1},image:{disabled:!1}},required:!1},toolbarEditorPosition:{settings:!1,label:"Toolbar Editor Position"},minAnswerChoices:2,maxAnswerChoices:5,maxImageWidth:{teacherInstructions:300,prompt:300,rationale:636,choices:900},maxImageHeight:{teacherInstructions:300,prompt:300,rationale:300,choices:300},withRubric:{settings:!1,label:"Add Rubric"},mathMlOptions:{mmlOutput:!1,mmlEditing:!1},language:{settings:!1,label:"Specify Language",enabled:!1},languageChoices:{label:"Language Choices",options:[]}};const Jt=e,{createRoot:Kt}=s,Qt=a,{renderMath:Xt}=l,{choiceUtils:Zt}=c;function en(e){let t,n=e[0],o=1;for(;o<e.length;){const i=e[o],r=e[o+1];if(o+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=r(n)):"call"!==i&&"optionalCall"!==i||(n=r((...e)=>n.call(t,...e)),t=void 0)}return n}const tn=Qt("multiple-choice:configure"),nn=(e,t=0)=>{if(!e||0===e.length){let e=[];for(let n=0;n<t;n++)e.push({value:`${n}`,label:"",feedback:{type:"none",value:""}});return e}return e},on=(e,t)=>{const n=lt(e,Vt);return{configuration:n,model:{...t,choices:nn(t&&t.choices||[],n&&n.answerChoiceCount)}}};class rn extends HTMLElement{static __initStatic(){this.createDefaultModel=(e={})=>{const t=Zt.normalizeChoices({...Gt,...e,choices:nn(e&&e.choices||[])});return t.choicesLayout=e.choicesLayout||!1===e.verticalMode&&"horizontal"||Gt.choicesLayout,t}}constructor(){super(),this._root=null,this._reactContainer=null,this._model=rn.createDefaultModel(),this._configuration=Vt,this.onModelChanged=this.onModelChanged.bind(this),this.onConfigurationChanged=this.onConfigurationChanged.bind(this)}set model(e){this._model=rn.createDefaultModel(e),this._render()}set configuration(e){const t=on(e,this._model);this.onModelChanged(t.model);const n={...Vt,...t.configuration};this._configuration=n,en([n,"optionalAccess",e=>e.language,"optionalAccess",e=>e.enabled])?en([n,"optionalAccess",e=>e.languageChoices,"optionalAccess",e=>e.options,"optionalAccess",e=>e.length])&&(this._model.language=en([n,"optionalAccess",e=>e.languageChoices,"access",e=>e.options,"access",e=>e[0],"access",e=>e.value])):n.language.settings&&this._model.language?(this._configuration.language.enabled=!0,this._configuration.languageChoices.options&&this._configuration.languageChoices.options.length||(this._configuration.languageChoices.options=[]),this._configuration.languageChoices.options.find(e=>e.value===this._model.language)||this._configuration.languageChoices.options.push({value:this._model.language,label:this._model.language})):delete this._model.language,this._render()}set disableSidePanel(e){this._disableSidePanel=e,this._render()}dispatchModelUpdated(e){const t=!!e;this.dispatchEvent(new p(this._model,t))}onModelChanged(e,t){this._model={...this._model,...e},this._render(),this.dispatchModelUpdated(t)}onConfigurationChanged(e){this._configuration=on(e,this._model).configuration,this._model&&this.onModelChanged(this._model),this._render()}insertImage(e){this.dispatchEvent(new m(e))}onDeleteImage(e,t){this.dispatchEvent(new b(e,t))}insertSound(e){this.dispatchEvent(new v(e))}onDeleteSound(e,t){this.dispatchEvent(new y(e,t))}_render(){tn("_render - Starting render"),tn("_render - Model:",this._model?"present":"missing"),tn("_render - Configuration:",this._configuration?"present":"missing"),tn("_render - Root exists:",!!this._root);try{let e=Jt.createElement(Nt,{model:this._model,configuration:this._configuration,onModelChanged:this.onModelChanged,onConfigurationChanged:this.onConfigurationChanged,disableSidePanel:this._disableSidePanel,imageSupport:{add:this.insertImage.bind(this),delete:this.onDeleteImage.bind(this)},uploadSoundSupport:{add:this.insertSound.bind(this),delete:this.onDeleteSound.bind(this)}});this._root||(tn("_render - Creating React container"),this._reactContainer=document.createElement("div"),this._reactContainer.className="pie-configure-wrapper",this.appendChild(this._reactContainer),tn("_render - Creating new React root"),this._root=Kt(this._reactContainer),tn("_render - React root created successfully")),tn("_render - Calling root.render()"),this._root.render(e),tn("_render - Render completed successfully"),setTimeout(()=>Xt(this),0)}catch(e){throw console.error("❌ [multiple-choice-configure] Render error:",e),console.error("Error stack:",e.stack),e}}connectedCallback(){tn("connectedCallback - Component connected to DOM"),tn("connectedCallback - Model:",this._model?"present":"missing"),tn("connectedCallback - Configuration:",this._configuration?"present":"missing"),this._render()}disconnectedCallback(){tn("disconnectedCallback - Component disconnected from DOM"),this._root&&(tn("disconnectedCallback - Unmounting React root"),this._root.unmount(),this._root=null),this._reactContainer&&(this._reactContainer=null)}}rn.__initStatic();export{rn as default};
|