@pie-element/multiple-choice 13.0.1 → 13.1.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/author/defaults.d.ts +206 -0
- package/dist/author/defaults.d.ts.map +1 -0
- package/dist/author/defaults.js +151 -0
- package/dist/author/index.d.ts +27 -0
- package/dist/author/index.d.ts.map +1 -0
- package/dist/author/index.js +116 -0
- package/dist/author/main.d.ts +35 -0
- package/dist/author/main.d.ts.map +1 -0
- package/dist/author/main.js +290 -0
- package/dist/author/utils.d.ts +10 -0
- package/dist/author/utils.d.ts.map +1 -0
- package/dist/author/utils.js +7 -0
- package/dist/controller/defaults.d.ts +36 -0
- package/dist/controller/defaults.d.ts.map +1 -0
- package/dist/controller/defaults.js +29 -0
- package/dist/controller/index.d.ts +66 -0
- package/dist/controller/index.d.ts.map +1 -0
- package/dist/controller/index.js +124 -0
- package/dist/controller/utils.d.ts +11 -0
- package/dist/controller/utils.d.ts.map +1 -0
- package/dist/controller/utils.js +8 -0
- package/dist/delivery/choice-input.d.ts +45 -0
- package/dist/delivery/choice-input.d.ts.map +1 -0
- package/dist/delivery/choice-input.js +274 -0
- package/dist/delivery/choice.d.ts +21 -0
- package/dist/delivery/choice.d.ts.map +1 -0
- package/dist/delivery/choice.js +109 -0
- package/dist/delivery/feedback-tick.d.ts +21 -0
- package/dist/delivery/feedback-tick.d.ts.map +1 -0
- package/dist/delivery/feedback-tick.js +104 -0
- package/dist/delivery/index.d.ts +38 -0
- package/dist/delivery/index.d.ts.map +1 -0
- package/dist/delivery/index.js +217 -0
- package/dist/delivery/main.d.ts +32 -0
- package/dist/delivery/main.d.ts.map +1 -0
- package/dist/delivery/main.js +51 -0
- package/dist/delivery/multiple-choice.d.ts +63 -0
- package/dist/delivery/multiple-choice.d.ts.map +1 -0
- package/dist/delivery/multiple-choice.js +252 -0
- package/dist/delivery/session-updater.d.ts +11 -0
- package/dist/delivery/session-updater.d.ts.map +1 -0
- package/dist/delivery/session-updater.js +9 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.iife.d.ts +9 -0
- package/dist/index.iife.d.ts.map +1 -0
- package/dist/index.iife.js +148 -0
- package/dist/index.js +2 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignMergeValue.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js +19 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js +31 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createAssigner.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_safeGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/debounce.js +50 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +16 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js +14 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/merge.js +8 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/now.js +7 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +19 -0
- package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js +8 -0
- package/dist/print/index.d.ts +16 -0
- package/dist/print/index.d.ts.map +1 -0
- package/dist/print/index.js +44 -0
- package/package.json +58 -26
- package/{configure/lib/defaults.js → src/author/defaults.ts} +55 -90
- package/{configure/lib/index.js → src/author/index.ts} +98 -51
- package/src/author/main.tsx +509 -0
- package/src/author/utils.ts +25 -0
- package/{controller/lib/defaults.js → src/controller/defaults.ts} +11 -8
- package/{controller/lib/index.js → src/controller/index.ts} +123 -109
- package/src/controller/utils.ts +22 -0
- package/src/delivery/choice-input.tsx +413 -0
- package/src/delivery/choice.tsx +203 -0
- package/src/delivery/feedback-tick.tsx +156 -0
- package/src/delivery/index.ts +489 -0
- package/src/delivery/main.tsx +85 -0
- package/src/delivery/multiple-choice.tsx +485 -0
- package/{lib/session-updater.js → src/delivery/session-updater.ts} +17 -13
- package/src/index.iife.ts +16 -0
- package/src/index.ts +1 -0
- package/src/print/index.tsx +112 -0
- package/CHANGELOG.json +0 -1972
- package/CHANGELOG.md +0 -2690
- package/LICENSE.md +0 -5
- package/PRINT.md +0 -35
- package/README.md +0 -56
- package/choice.png +0 -0
- package/configure/CHANGELOG.json +0 -1387
- package/configure/CHANGELOG.md +0 -2046
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -477
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/utils.js +0 -18
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -22
- package/controller/CHANGELOG.json +0 -527
- package/controller/CHANGELOG.md +0 -1388
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -15
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -15
- package/docs/config-schema.json +0 -2993
- package/docs/config-schema.json.md +0 -2217
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -61
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -7
- package/docs/pie-schema.json +0 -1332
- package/docs/pie-schema.json.md +0 -1015
- package/lib/choice-input.js +0 -380
- package/lib/choice-input.js.map +0 -1
- package/lib/choice.js +0 -197
- package/lib/choice.js.map +0 -1
- package/lib/feedback-tick.js +0 -134
- package/lib/feedback-tick.js.map +0 -1
- package/lib/index.js +0 -337
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -57
- package/lib/main.js.map +0 -1
- package/lib/multiple-choice.js +0 -385
- package/lib/multiple-choice.js.map +0 -1
- package/lib/print.js +0 -94
- package/lib/print.js.map +0 -1
- package/lib/session-updater.js.map +0 -1
- package/module/configure.js +0 -1
- package/module/controller.js +0 -3045
- package/module/demo.js +0 -86
- package/module/element.js +0 -1
- package/module/index.html +0 -21
- package/module/manifest.json +0 -14
- package/module/print-demo.js +0 -124
- package/module/print.html +0 -18
- package/module/print.js +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import e from "../delivery/main.js";
|
|
2
|
+
import t from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js";
|
|
3
|
+
import n from "../node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/debounce.js";
|
|
4
|
+
import r from "react";
|
|
5
|
+
import { createRoot as i } from "react-dom/client";
|
|
6
|
+
import a from "debug";
|
|
7
|
+
import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
|
|
8
|
+
//#region src/print/index.tsx
|
|
9
|
+
var s = a("pie-element:multiple-choice:print"), c = (e, n) => {
|
|
10
|
+
let r = n.role === "instructor";
|
|
11
|
+
return e.prompt = e.promptEnabled === !1 ? void 0 : e.prompt, e.teacherInstructions = r && e.teacherInstructionsEnabled !== !1 ? e.teacherInstructions : void 0, e.showTeacherInstructions = r, e.alwaysShowCorrect = r, e.mode = r ? "evaluate" : e.mode, e.disabled = !0, e.animationsDisabled = !0, e.lockChoiceOrder = !0, e.choicesLayout = e.choicesLayout || "vertical", e.choices = t(e.choices).map((t) => (t.rationale = r && e.rationaleEnabled !== !1 ? t.rationale : void 0, t.hideTick = r, t.feedback = void 0, t)), e.keyMode = e.choicePrefix || "letters", e;
|
|
12
|
+
}, l = class extends HTMLElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(), this._options = null, this._model = null, this._session = [], this._root = null, this._rerender = n(() => {
|
|
15
|
+
if (this._model && this._session) {
|
|
16
|
+
let t = c(this._model, this._options), n = this._options && r.createElement(e, {
|
|
17
|
+
model: t,
|
|
18
|
+
session: {},
|
|
19
|
+
options: this._options
|
|
20
|
+
});
|
|
21
|
+
this._root ||= i(this), this._root.render(n), requestAnimationFrame(() => {
|
|
22
|
+
requestAnimationFrame(() => {
|
|
23
|
+
s("render complete - render math"), o(this);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
} else s("skip");
|
|
27
|
+
}, 50, {
|
|
28
|
+
leading: !1,
|
|
29
|
+
trailing: !0
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
set options(e) {
|
|
33
|
+
this._options = e;
|
|
34
|
+
}
|
|
35
|
+
set model(e) {
|
|
36
|
+
this._model = e, this._rerender();
|
|
37
|
+
}
|
|
38
|
+
connectedCallback() {}
|
|
39
|
+
disconnectedCallback() {
|
|
40
|
+
this._root && this._root.unmount();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { l as default };
|
package/package.json
CHANGED
|
@@ -1,45 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/multiple-choice",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"publishConfig": {
|
|
6
|
-
"access": "public"
|
|
7
|
-
},
|
|
3
|
+
"version": "13.1.1-next.0",
|
|
4
|
+
"description": "React implementation of multiple-choice element synced from pie-elements",
|
|
8
5
|
"dependencies": {
|
|
9
6
|
"@emotion/react": "^11.14.0",
|
|
10
7
|
"@emotion/style": "^0.8.0",
|
|
11
8
|
"@mui/icons-material": "^7.3.4",
|
|
12
9
|
"@mui/material": "^7.3.4",
|
|
13
|
-
"@pie-
|
|
14
|
-
"@pie-lib/
|
|
15
|
-
"@pie-lib/
|
|
16
|
-
"@pie-lib/render-ui": "6.0.0",
|
|
17
|
-
"@pie-lib/translator": "4.0.0",
|
|
10
|
+
"@pie-lib/correct-answer-toggle": "4.0.1",
|
|
11
|
+
"@pie-lib/render-ui": "6.0.1",
|
|
12
|
+
"@pie-lib/translator": "4.0.1",
|
|
18
13
|
"classnames": "^2.2.5",
|
|
19
14
|
"debug": "^4.1.1",
|
|
20
15
|
"lodash-es": "^4.17.23",
|
|
21
16
|
"prop-types": "^15.8.1",
|
|
22
|
-
"react": "
|
|
23
|
-
"
|
|
24
|
-
"
|
|
17
|
+
"react-transition-group": "^4.4.5",
|
|
18
|
+
"@pie-element/shared-configure-events": "0.1.0",
|
|
19
|
+
"@pie-lib/config-ui": "13.0.1",
|
|
20
|
+
"@pie-lib/editable-html-tip-tap": "2.0.1",
|
|
21
|
+
"@pie-element/shared-controller-utils": "0.1.0",
|
|
22
|
+
"@pie-element/shared-player-events": "0.1.0",
|
|
23
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.0"
|
|
25
24
|
},
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
"
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"react": "^18.0.0",
|
|
27
|
+
"react-dom": "^18.0.0"
|
|
29
28
|
},
|
|
30
|
-
"main": "lib/index.js",
|
|
31
|
-
"module": "src/index.js",
|
|
32
29
|
"exports": {
|
|
33
30
|
".": {
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"default": "./
|
|
31
|
+
"development": "./src/index.ts",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"./delivery": {
|
|
36
|
+
"development": "./src/delivery/index.ts",
|
|
37
|
+
"types": "./dist/delivery/index.d.ts",
|
|
38
|
+
"default": "./dist/delivery/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./author": {
|
|
41
|
+
"development": "./src/author/index.ts",
|
|
42
|
+
"types": "./dist/author/index.d.ts",
|
|
43
|
+
"default": "./dist/author/index.js"
|
|
37
44
|
},
|
|
38
|
-
"./
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
45
|
+
"./controller": {
|
|
46
|
+
"development": "./src/controller/index.ts",
|
|
47
|
+
"types": "./dist/controller/index.d.ts",
|
|
48
|
+
"default": "./dist/controller/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./print": {
|
|
51
|
+
"development": "./src/print/index.tsx",
|
|
52
|
+
"types": "./dist/print/index.d.ts",
|
|
53
|
+
"default": "./dist/print/index.js"
|
|
43
54
|
}
|
|
55
|
+
},
|
|
56
|
+
"type": "module",
|
|
57
|
+
"main": "./dist/index.js",
|
|
58
|
+
"types": "./dist/index.d.ts",
|
|
59
|
+
"files": [
|
|
60
|
+
"dist",
|
|
61
|
+
"src"
|
|
62
|
+
],
|
|
63
|
+
"sideEffects": false,
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"vite": "^8.0.1",
|
|
66
|
+
"typescript": "^5.9.3",
|
|
67
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
68
|
+
"@types/react": "^18.2.0",
|
|
69
|
+
"@types/react-dom": "^18.2.0"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"build": "bun x vite build && bun x vite build --config vite.config.iife.ts && bun x tsc --emitDeclarationOnly",
|
|
73
|
+
"dev": "bun x vite",
|
|
74
|
+
"demo": "bun x vite --mode demo",
|
|
75
|
+
"test": "bun x vitest run"
|
|
44
76
|
}
|
|
45
77
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/multiple-choice/configure/src/defaults.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
2
10
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
11
|
/** NOTE: teacherInstructions, studentInstructions, rationale & scoringType
|
|
8
12
|
* functionalities are not defined yet - the value for those can belong to
|
|
9
13
|
* model or to configure
|
|
10
14
|
*/
|
|
11
|
-
|
|
15
|
+
export default {
|
|
12
16
|
model: {
|
|
13
17
|
choiceMode: 'checkbox',
|
|
14
18
|
choicePrefix: 'letters',
|
|
@@ -28,144 +32,106 @@ var _default = exports.default = {
|
|
|
28
32
|
teacherInstructionsEnabled: true,
|
|
29
33
|
toolbarEditorPosition: 'bottom',
|
|
30
34
|
selectedAnswerBackgroundColor: 'initial',
|
|
31
|
-
keyboardEventsEnabled: false
|
|
35
|
+
keyboardEventsEnabled: false,
|
|
32
36
|
},
|
|
33
37
|
configuration: {
|
|
34
38
|
baseInputConfiguration: {
|
|
35
|
-
h3: {
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
disabled: false
|
|
43
|
-
},
|
|
44
|
-
image: {
|
|
45
|
-
disabled: false
|
|
46
|
-
},
|
|
47
|
-
textAlign: {
|
|
48
|
-
disabled: true
|
|
49
|
-
},
|
|
50
|
-
showParagraphs: {
|
|
51
|
-
disabled: false
|
|
52
|
-
},
|
|
53
|
-
separateParagraphs: {
|
|
54
|
-
disabled: true
|
|
55
|
-
}
|
|
39
|
+
h3: { disabled: true },
|
|
40
|
+
audio: { disabled: false },
|
|
41
|
+
video: { disabled: false },
|
|
42
|
+
image: { disabled: false },
|
|
43
|
+
textAlign: { disabled: true },
|
|
44
|
+
showParagraphs: { disabled: false },
|
|
45
|
+
separateParagraphs: { disabled: true },
|
|
56
46
|
},
|
|
57
47
|
choices: {
|
|
58
48
|
inputConfiguration: {
|
|
59
|
-
audio: {
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
disabled: false
|
|
64
|
-
},
|
|
65
|
-
image: {
|
|
66
|
-
disabled: false
|
|
67
|
-
}
|
|
68
|
-
}
|
|
49
|
+
audio: { disabled: false },
|
|
50
|
+
video: { disabled: false },
|
|
51
|
+
image: { disabled: false },
|
|
52
|
+
},
|
|
69
53
|
},
|
|
70
54
|
spellCheck: {
|
|
71
55
|
label: 'Spellcheck',
|
|
72
56
|
settings: false,
|
|
73
|
-
enabled: true
|
|
57
|
+
enabled: true,
|
|
74
58
|
},
|
|
75
59
|
choicesLayout: {
|
|
76
60
|
settings: false,
|
|
77
|
-
label: 'Choices Layout'
|
|
61
|
+
label: 'Choices Layout',
|
|
78
62
|
},
|
|
79
63
|
gridColumns: {
|
|
80
|
-
label: 'Grid columns'
|
|
64
|
+
label: 'Grid columns',
|
|
81
65
|
},
|
|
82
66
|
answerChoiceCount: 0,
|
|
83
67
|
addChoiceButton: {
|
|
84
68
|
settings: true,
|
|
85
|
-
label: 'Add a Choice'
|
|
69
|
+
label: 'Add a Choice',
|
|
86
70
|
},
|
|
87
71
|
choiceMode: {
|
|
88
72
|
settings: true,
|
|
89
|
-
label: 'Response Type'
|
|
73
|
+
label: 'Response Type',
|
|
90
74
|
},
|
|
91
75
|
choicePrefix: {
|
|
92
76
|
settings: true,
|
|
93
|
-
label: 'Choice Labels'
|
|
77
|
+
label: 'Choice Labels',
|
|
94
78
|
},
|
|
95
79
|
deleteChoice: {
|
|
96
|
-
settings: true
|
|
80
|
+
settings: true,
|
|
97
81
|
},
|
|
98
82
|
feedback: {
|
|
99
83
|
settings: true,
|
|
100
|
-
label: 'Feedback'
|
|
84
|
+
label: 'Feedback',
|
|
101
85
|
},
|
|
102
86
|
prompt: {
|
|
103
87
|
settings: true,
|
|
104
88
|
label: 'Prompt',
|
|
105
89
|
inputConfiguration: {
|
|
106
|
-
audio: {
|
|
107
|
-
|
|
108
|
-
},
|
|
109
|
-
video: {
|
|
110
|
-
disabled: false
|
|
111
|
-
},
|
|
112
|
-
image: {
|
|
113
|
-
disabled: false
|
|
114
|
-
}
|
|
90
|
+
audio: { disabled: false },
|
|
91
|
+
video: { disabled: false },
|
|
92
|
+
image: { disabled: false },
|
|
115
93
|
},
|
|
116
|
-
required: false
|
|
94
|
+
required: false,
|
|
117
95
|
},
|
|
118
96
|
lockChoiceOrder: {
|
|
119
97
|
settings: true,
|
|
120
|
-
label: 'Lock Choice Order'
|
|
98
|
+
label: 'Lock Choice Order',
|
|
121
99
|
},
|
|
122
100
|
partialScoring: {
|
|
123
101
|
settings: false,
|
|
124
|
-
label: 'Allow Partial Scoring'
|
|
102
|
+
label: 'Allow Partial Scoring',
|
|
125
103
|
},
|
|
126
104
|
rationale: {
|
|
127
105
|
settings: true,
|
|
128
106
|
label: 'Rationale',
|
|
129
107
|
inputConfiguration: {
|
|
130
|
-
audio: {
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
video: {
|
|
134
|
-
disabled: true
|
|
135
|
-
},
|
|
136
|
-
image: {
|
|
137
|
-
disabled: false
|
|
138
|
-
}
|
|
108
|
+
audio: { disabled: true },
|
|
109
|
+
video: { disabled: true },
|
|
110
|
+
image: { disabled: false },
|
|
139
111
|
},
|
|
140
|
-
required: false
|
|
112
|
+
required: false,
|
|
141
113
|
},
|
|
142
114
|
scoringType: {
|
|
143
115
|
settings: false,
|
|
144
|
-
label: 'Scoring Type'
|
|
116
|
+
label: 'Scoring Type',
|
|
145
117
|
},
|
|
146
118
|
studentInstructions: {
|
|
147
119
|
settings: false,
|
|
148
|
-
label: 'Student Instructions'
|
|
120
|
+
label: 'Student Instructions',
|
|
149
121
|
},
|
|
150
122
|
teacherInstructions: {
|
|
151
123
|
settings: true,
|
|
152
124
|
label: 'Teacher Instructions',
|
|
153
125
|
inputConfiguration: {
|
|
154
|
-
audio: {
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
video: {
|
|
158
|
-
disabled: false
|
|
159
|
-
},
|
|
160
|
-
image: {
|
|
161
|
-
disabled: false
|
|
162
|
-
}
|
|
126
|
+
audio: { disabled: false },
|
|
127
|
+
video: { disabled: false },
|
|
128
|
+
image: { disabled: false },
|
|
163
129
|
},
|
|
164
|
-
required: false
|
|
130
|
+
required: false,
|
|
165
131
|
},
|
|
166
132
|
toolbarEditorPosition: {
|
|
167
133
|
settings: false,
|
|
168
|
-
label: 'Toolbar Editor Position'
|
|
134
|
+
label: 'Toolbar Editor Position',
|
|
169
135
|
},
|
|
170
136
|
minAnswerChoices: 2,
|
|
171
137
|
maxAnswerChoices: 5,
|
|
@@ -173,31 +139,30 @@ var _default = exports.default = {
|
|
|
173
139
|
teacherInstructions: 300,
|
|
174
140
|
prompt: 300,
|
|
175
141
|
rationale: 636,
|
|
176
|
-
choices: 900
|
|
142
|
+
choices: 900,
|
|
177
143
|
},
|
|
178
144
|
maxImageHeight: {
|
|
179
145
|
teacherInstructions: 300,
|
|
180
146
|
prompt: 300,
|
|
181
147
|
rationale: 300,
|
|
182
|
-
choices: 300
|
|
148
|
+
choices: 300,
|
|
183
149
|
},
|
|
184
150
|
withRubric: {
|
|
185
151
|
settings: false,
|
|
186
|
-
label: 'Add Rubric'
|
|
152
|
+
label: 'Add Rubric',
|
|
187
153
|
},
|
|
188
154
|
mathMlOptions: {
|
|
189
155
|
mmlOutput: false,
|
|
190
|
-
mmlEditing: false
|
|
156
|
+
mmlEditing: false,
|
|
191
157
|
},
|
|
192
158
|
language: {
|
|
193
159
|
settings: false,
|
|
194
160
|
label: 'Specify Language',
|
|
195
|
-
enabled: false
|
|
161
|
+
enabled: false,
|
|
196
162
|
},
|
|
197
163
|
languageChoices: {
|
|
198
164
|
label: 'Language Choices',
|
|
199
|
-
options: []
|
|
200
|
-
}
|
|
201
|
-
}
|
|
165
|
+
options: [],
|
|
166
|
+
},
|
|
167
|
+
},
|
|
202
168
|
};
|
|
203
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1,67 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-elements/packages/multiple-choice/configure/src/index.js
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import { createRoot } from 'react-dom/client';
|
|
13
|
+
import debug from 'debug';
|
|
14
|
+
import {
|
|
15
|
+
DeleteImageEvent,
|
|
16
|
+
InsertImageEvent,
|
|
17
|
+
ModelUpdatedEvent,
|
|
18
|
+
InsertSoundEvent,
|
|
19
|
+
DeleteSoundEvent,
|
|
20
|
+
} from '@pie-element/shared-configure-events';
|
|
21
|
+
|
|
22
|
+
import Main from './main.js';
|
|
23
|
+
import { choiceUtils as utils } from '@pie-lib/config-ui';
|
|
24
|
+
import { defaults } from 'lodash-es';
|
|
25
|
+
|
|
26
|
+
import sensibleDefaults from './defaults.js';
|
|
27
|
+
|
|
28
|
+
const log = debug('multiple-choice:configure');
|
|
29
|
+
|
|
18
30
|
const generateFormattedChoices = (choices, choiceCount = 0) => {
|
|
19
31
|
if (!choices || choices.length === 0) {
|
|
20
32
|
let formattedChoices = [];
|
|
33
|
+
|
|
21
34
|
for (let i = 0; i < choiceCount; i++) {
|
|
22
35
|
formattedChoices.push({
|
|
23
36
|
value: `${i}`,
|
|
24
37
|
label: '',
|
|
25
38
|
feedback: {
|
|
26
39
|
type: 'none',
|
|
27
|
-
value: ''
|
|
28
|
-
}
|
|
40
|
+
value: '',
|
|
41
|
+
},
|
|
29
42
|
});
|
|
30
43
|
}
|
|
44
|
+
|
|
31
45
|
return formattedChoices;
|
|
32
46
|
}
|
|
47
|
+
|
|
33
48
|
return choices;
|
|
34
49
|
};
|
|
50
|
+
|
|
35
51
|
const prepareCustomizationObject = (config, model) => {
|
|
36
|
-
const configuration =
|
|
52
|
+
const configuration = defaults(config, sensibleDefaults.configuration);
|
|
53
|
+
|
|
37
54
|
return {
|
|
38
55
|
configuration,
|
|
39
56
|
model: {
|
|
40
57
|
...model,
|
|
41
|
-
choices: generateFormattedChoices(
|
|
42
|
-
|
|
58
|
+
choices: generateFormattedChoices(
|
|
59
|
+
(model && model.choices) || [],
|
|
60
|
+
configuration && configuration.answerChoiceCount,
|
|
61
|
+
),
|
|
62
|
+
},
|
|
43
63
|
};
|
|
44
64
|
};
|
|
45
|
-
|
|
65
|
+
|
|
66
|
+
export default class MultipleChoice extends HTMLElement {
|
|
67
|
+
static createDefaultModel = (model = {}) => {
|
|
68
|
+
const normalizedModel = utils.normalizeChoices({
|
|
69
|
+
...sensibleDefaults.model,
|
|
70
|
+
...model,
|
|
71
|
+
choices: generateFormattedChoices((model && model.choices) || []),
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// This is used for offering support for old models which have the property "verticalMode"
|
|
75
|
+
normalizedModel.choicesLayout =
|
|
76
|
+
model.choicesLayout || (model.verticalMode === false && 'horizontal') || sensibleDefaults.model.choicesLayout;
|
|
77
|
+
|
|
78
|
+
return normalizedModel;
|
|
79
|
+
};
|
|
80
|
+
|
|
46
81
|
constructor() {
|
|
47
82
|
super();
|
|
48
83
|
this._root = null;
|
|
49
84
|
this._reactContainer = null;
|
|
50
85
|
this._model = MultipleChoice.createDefaultModel();
|
|
51
|
-
this._configuration =
|
|
86
|
+
this._configuration = sensibleDefaults.configuration;
|
|
52
87
|
this.onModelChanged = this.onModelChanged.bind(this);
|
|
53
88
|
this.onConfigurationChanged = this.onConfigurationChanged.bind(this);
|
|
54
89
|
}
|
|
90
|
+
|
|
55
91
|
set model(s) {
|
|
56
92
|
this._model = MultipleChoice.createDefaultModel(s);
|
|
93
|
+
|
|
57
94
|
this._render();
|
|
58
95
|
}
|
|
96
|
+
|
|
59
97
|
set configuration(c) {
|
|
60
98
|
const info = prepareCustomizationObject(c, this._model);
|
|
99
|
+
|
|
61
100
|
this.onModelChanged(info.model);
|
|
101
|
+
|
|
62
102
|
const newConfiguration = {
|
|
63
|
-
...
|
|
64
|
-
...info.configuration
|
|
103
|
+
...sensibleDefaults.configuration,
|
|
104
|
+
...info.configuration,
|
|
65
105
|
};
|
|
66
106
|
this._configuration = newConfiguration;
|
|
67
107
|
|
|
@@ -75,64 +115,79 @@ class MultipleChoice extends HTMLElement {
|
|
|
75
115
|
}
|
|
76
116
|
} else if (newConfiguration.language.settings && this._model.language) {
|
|
77
117
|
this._configuration.language.enabled = true;
|
|
118
|
+
|
|
78
119
|
if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
|
|
79
120
|
this._configuration.languageChoices.options = [];
|
|
80
121
|
}
|
|
81
122
|
|
|
82
123
|
// check if the language is already included in the languageChoices.options array
|
|
83
124
|
// and if not, then add it.
|
|
84
|
-
if (!this._configuration.languageChoices.options.find(option => option.value === this._model.language)) {
|
|
125
|
+
if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {
|
|
85
126
|
this._configuration.languageChoices.options.push({
|
|
86
127
|
value: this._model.language,
|
|
87
|
-
label: this._model.language
|
|
128
|
+
label: this._model.language,
|
|
88
129
|
});
|
|
89
130
|
}
|
|
90
131
|
} else {
|
|
91
132
|
delete this._model.language;
|
|
92
133
|
}
|
|
134
|
+
|
|
93
135
|
this._render();
|
|
94
136
|
}
|
|
137
|
+
|
|
95
138
|
set disableSidePanel(s) {
|
|
96
139
|
this._disableSidePanel = s;
|
|
97
140
|
this._render();
|
|
98
141
|
}
|
|
142
|
+
|
|
99
143
|
dispatchModelUpdated(reset) {
|
|
100
144
|
const resetValue = !!reset;
|
|
101
|
-
|
|
145
|
+
|
|
146
|
+
this.dispatchEvent(new ModelUpdatedEvent(this._model, resetValue));
|
|
102
147
|
}
|
|
148
|
+
|
|
103
149
|
onModelChanged(m, reset) {
|
|
104
150
|
this._model = m;
|
|
105
151
|
this._render();
|
|
152
|
+
|
|
106
153
|
this.dispatchModelUpdated(reset);
|
|
107
154
|
}
|
|
155
|
+
|
|
108
156
|
onConfigurationChanged(c) {
|
|
109
157
|
this._configuration = prepareCustomizationObject(c, this._model).configuration;
|
|
158
|
+
|
|
110
159
|
if (this._model) {
|
|
111
160
|
this.onModelChanged(this._model);
|
|
112
161
|
}
|
|
162
|
+
|
|
113
163
|
this._render();
|
|
114
164
|
}
|
|
115
165
|
|
|
116
166
|
/** @param {done, progress, file} handler */
|
|
117
167
|
insertImage(handler) {
|
|
118
|
-
this.dispatchEvent(new
|
|
168
|
+
this.dispatchEvent(new InsertImageEvent(handler));
|
|
119
169
|
}
|
|
170
|
+
|
|
120
171
|
onDeleteImage(src, done) {
|
|
121
|
-
this.dispatchEvent(new
|
|
172
|
+
this.dispatchEvent(new DeleteImageEvent(src, done));
|
|
122
173
|
}
|
|
174
|
+
|
|
123
175
|
insertSound(handler) {
|
|
124
|
-
this.dispatchEvent(new
|
|
176
|
+
this.dispatchEvent(new InsertSoundEvent(handler));
|
|
125
177
|
}
|
|
178
|
+
|
|
126
179
|
onDeleteSound(src, done) {
|
|
127
|
-
this.dispatchEvent(new
|
|
180
|
+
this.dispatchEvent(new DeleteSoundEvent(src, done));
|
|
128
181
|
}
|
|
182
|
+
|
|
129
183
|
_render() {
|
|
130
184
|
log('_render - Starting render');
|
|
131
185
|
log('_render - Model:', this._model ? 'present' : 'missing');
|
|
132
186
|
log('_render - Configuration:', this._configuration ? 'present' : 'missing');
|
|
133
187
|
log('_render - Root exists:', !!this._root);
|
|
188
|
+
|
|
134
189
|
try {
|
|
135
|
-
let element =
|
|
190
|
+
let element = React.createElement(Main, {
|
|
136
191
|
model: this._model,
|
|
137
192
|
configuration: this._configuration,
|
|
138
193
|
onModelChanged: this.onModelChanged,
|
|
@@ -140,13 +195,14 @@ class MultipleChoice extends HTMLElement {
|
|
|
140
195
|
disableSidePanel: this._disableSidePanel,
|
|
141
196
|
imageSupport: {
|
|
142
197
|
add: this.insertImage.bind(this),
|
|
143
|
-
delete: this.onDeleteImage.bind(this)
|
|
198
|
+
delete: this.onDeleteImage.bind(this),
|
|
144
199
|
},
|
|
145
200
|
uploadSoundSupport: {
|
|
146
201
|
add: this.insertSound.bind(this),
|
|
147
|
-
delete: this.onDeleteSound.bind(this)
|
|
148
|
-
}
|
|
202
|
+
delete: this.onDeleteSound.bind(this),
|
|
203
|
+
},
|
|
149
204
|
});
|
|
205
|
+
|
|
150
206
|
if (!this._root) {
|
|
151
207
|
log('_render - Creating React container');
|
|
152
208
|
|
|
@@ -154,10 +210,12 @@ class MultipleChoice extends HTMLElement {
|
|
|
154
210
|
this._reactContainer = document.createElement('div');
|
|
155
211
|
this._reactContainer.className = 'pie-configure-wrapper';
|
|
156
212
|
this.appendChild(this._reactContainer);
|
|
213
|
+
|
|
157
214
|
log('_render - Creating new React root');
|
|
158
|
-
this._root =
|
|
215
|
+
this._root = createRoot(this._reactContainer);
|
|
159
216
|
log('_render - React root created successfully');
|
|
160
217
|
}
|
|
218
|
+
|
|
161
219
|
log('_render - Calling root.render()');
|
|
162
220
|
this._root.render(element);
|
|
163
221
|
log('_render - Render completed successfully');
|
|
@@ -167,11 +225,13 @@ class MultipleChoice extends HTMLElement {
|
|
|
167
225
|
throw error;
|
|
168
226
|
}
|
|
169
227
|
}
|
|
228
|
+
|
|
170
229
|
connectedCallback() {
|
|
171
230
|
log('connectedCallback - Component connected to DOM');
|
|
172
231
|
log('connectedCallback - Model:', this._model ? 'present' : 'missing');
|
|
173
232
|
log('connectedCallback - Configuration:', this._configuration ? 'present' : 'missing');
|
|
174
233
|
}
|
|
234
|
+
|
|
175
235
|
disconnectedCallback() {
|
|
176
236
|
log('disconnectedCallback - Component disconnected from DOM');
|
|
177
237
|
if (this._root) {
|
|
@@ -184,16 +244,3 @@ class MultipleChoice extends HTMLElement {
|
|
|
184
244
|
}
|
|
185
245
|
}
|
|
186
246
|
}
|
|
187
|
-
exports.default = MultipleChoice;
|
|
188
|
-
(0, _defineProperty2.default)(MultipleChoice, "createDefaultModel", (model = {}) => {
|
|
189
|
-
const normalizedModel = _configUi.choiceUtils.normalizeChoices({
|
|
190
|
-
..._defaults.default.model,
|
|
191
|
-
...model,
|
|
192
|
-
choices: generateFormattedChoices(model && model.choices || [])
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
// This is used for offering support for old models which have the property "verticalMode"
|
|
196
|
-
normalizedModel.choicesLayout = model.choicesLayout || model.verticalMode === false && 'horizontal' || _defaults.default.model.choicesLayout;
|
|
197
|
-
return normalizedModel;
|
|
198
|
-
});
|
|
199
|
-
//# sourceMappingURL=index.js.map
|