@pie-element/multiple-choice 13.2.1-next.2 → 13.2.1-next.39

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.
Files changed (243) hide show
  1. package/CHANGELOG.json +1972 -0
  2. package/CHANGELOG.md +2716 -0
  3. package/LICENSE.md +5 -0
  4. package/PRINT.md +35 -0
  5. package/README.md +56 -0
  6. package/choice.png +0 -0
  7. package/configure/CHANGELOG.json +1387 -0
  8. package/configure/CHANGELOG.md +2064 -0
  9. package/configure/lib/defaults.js +203 -0
  10. package/configure/lib/defaults.js.map +1 -0
  11. package/configure/lib/index.js +202 -0
  12. package/configure/lib/index.js.map +1 -0
  13. package/configure/lib/main.js +484 -0
  14. package/configure/lib/main.js.map +1 -0
  15. package/configure/lib/utils.js +18 -0
  16. package/configure/lib/utils.js.map +1 -0
  17. package/configure/package.json +22 -0
  18. package/controller/CHANGELOG.json +527 -0
  19. package/controller/CHANGELOG.md +1401 -0
  20. package/controller/lib/defaults.js +33 -0
  21. package/controller/lib/defaults.js.map +1 -0
  22. package/controller/lib/index.js +288 -0
  23. package/controller/lib/index.js.map +1 -0
  24. package/controller/lib/utils.js +15 -0
  25. package/controller/lib/utils.js.map +1 -0
  26. package/controller/package.json +15 -0
  27. package/docs/config-schema.json +2993 -0
  28. package/docs/config-schema.json.md +2217 -0
  29. package/docs/demo/config.js +8 -0
  30. package/docs/demo/generate.js +61 -0
  31. package/docs/demo/index.html +1 -0
  32. package/docs/demo/session.js +7 -0
  33. package/docs/pie-schema.json +1332 -0
  34. package/docs/pie-schema.json.md +1015 -0
  35. package/lib/choice-input.js +383 -0
  36. package/lib/choice-input.js.map +1 -0
  37. package/lib/choice.js +192 -0
  38. package/lib/choice.js.map +1 -0
  39. package/lib/feedback-tick.js +134 -0
  40. package/lib/feedback-tick.js.map +1 -0
  41. package/lib/index.js +402 -0
  42. package/lib/index.js.map +1 -0
  43. package/lib/main.js +63 -0
  44. package/lib/main.js.map +1 -0
  45. package/lib/multiple-choice.js +397 -0
  46. package/lib/multiple-choice.js.map +1 -0
  47. package/lib/print.js +94 -0
  48. package/lib/print.js.map +1 -0
  49. package/lib/session-updater.js +37 -0
  50. package/lib/session-updater.js.map +1 -0
  51. package/module/configure.js +1 -0
  52. package/module/controller.js +3045 -0
  53. package/module/demo.js +86 -0
  54. package/module/element.js +1 -0
  55. package/module/index.html +21 -0
  56. package/module/manifest.json +14 -0
  57. package/module/print-demo.js +124 -0
  58. package/module/print.html +18 -0
  59. package/module/print.js +1 -0
  60. package/package.json +25 -55
  61. package/dist/author/defaults.d.ts +0 -205
  62. package/dist/author/defaults.js +0 -151
  63. package/dist/author/index.d.ts +0 -26
  64. package/dist/author/index.js +0 -119
  65. package/dist/author/main.d.ts +0 -34
  66. package/dist/author/main.js +0 -287
  67. package/dist/author/utils.d.ts +0 -9
  68. package/dist/author/utils.js +0 -7
  69. package/dist/controller/defaults.d.ts +0 -35
  70. package/dist/controller/defaults.js +0 -29
  71. package/dist/controller/index.d.ts +0 -65
  72. package/dist/controller/index.js +0 -124
  73. package/dist/controller/utils.d.ts +0 -10
  74. package/dist/controller/utils.js +0 -8
  75. package/dist/delivery/choice-input.d.ts +0 -44
  76. package/dist/delivery/choice-input.js +0 -272
  77. package/dist/delivery/choice.d.ts +0 -20
  78. package/dist/delivery/choice.js +0 -105
  79. package/dist/delivery/feedback-tick.d.ts +0 -20
  80. package/dist/delivery/feedback-tick.js +0 -104
  81. package/dist/delivery/index.d.ts +0 -37
  82. package/dist/delivery/index.js +0 -214
  83. package/dist/delivery/main.d.ts +0 -31
  84. package/dist/delivery/main.js +0 -51
  85. package/dist/delivery/multiple-choice.d.ts +0 -61
  86. package/dist/delivery/multiple-choice.js +0 -244
  87. package/dist/delivery/session-updater.d.ts +0 -10
  88. package/dist/delivery/session-updater.js +0 -9
  89. package/dist/index.d.ts +0 -1
  90. package/dist/index.iife.d.ts +0 -8
  91. package/dist/index.iife.js +0 -148
  92. package/dist/index.js +0 -2
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_apply.js +0 -12
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js +0 -7
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignMergeValue.js +0 -8
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js +0 -10
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js +0 -8
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js +0 -8
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js +0 -12
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js +0 -57
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js +0 -14
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js +0 -5
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js +0 -9
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js +0 -9
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js +0 -13
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMerge.js +0 -19
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMergeDeep.js +0 -31
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js +0 -9
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js +0 -14
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +0 -8
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js +0 -8
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js +0 -10
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js +0 -8
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js +0 -8
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js +0 -8
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js +0 -8
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js +0 -8
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js +0 -14
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js +0 -8
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js +0 -8
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createAssigner.js +0 -15
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js +0 -12
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js +0 -10
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js +0 -9
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js +0 -5
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  163. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
  164. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js +0 -11
  165. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  166. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  167. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
  168. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
  169. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
  170. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
  171. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
  172. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js +0 -8
  173. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js +0 -33
  174. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js +0 -9
  175. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  176. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js +0 -12
  177. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
  178. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  179. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  180. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
  181. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
  182. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
  183. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
  184. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
  185. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
  186. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
  187. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
  188. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
  189. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
  190. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
  191. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
  192. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  193. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js +0 -8
  194. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  195. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  196. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  197. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js +0 -13
  198. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  199. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_safeGet.js +0 -6
  200. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
  201. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
  202. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
  203. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js +0 -6
  204. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js +0 -14
  205. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
  206. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
  207. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
  208. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
  209. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
  210. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  211. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
  212. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js +0 -8
  213. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/constant.js +0 -8
  214. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js +0 -50
  215. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/defaults.js +0 -16
  216. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  217. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +0 -6
  218. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  219. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  220. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  221. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLikeObject.js +0 -8
  222. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  223. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  224. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js +0 -7
  225. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  226. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  227. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isMap.js +0 -7
  228. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  229. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  230. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isPlainObject.js +0 -14
  231. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSet.js +0 -7
  232. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
  233. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  234. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
  235. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js +0 -9
  236. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/merge.js +0 -8
  237. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/now.js +0 -7
  238. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
  239. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
  240. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +0 -19
  241. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toPlainObject.js +0 -8
  242. package/dist/print/index.d.ts +0 -15
  243. package/dist/print/index.js +0 -44
@@ -1,214 +0,0 @@
1
- import e from "./main.js";
2
- import t from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/debounce.js";
3
- import { updateSessionMetadata as n, updateSessionValue as r } from "./session-updater.js";
4
- import i from "react";
5
- import * as a from "@pie-lib/render-ui";
6
- import { EnableAudioAutoplayImage as o } from "@pie-lib/render-ui";
7
- import { createRoot as s } from "react-dom/client";
8
- import c from "debug";
9
- import { ModelSetEvent as l, SessionChangedEvent as u } from "@pie-element/shared-player-events";
10
- import { renderMath as d } from "@pie-element/shared-math-rendering-mathjax";
11
- //#region src/delivery/index.ts
12
- function f(e) {
13
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
14
- }
15
- function p(e, t) {
16
- return !e || f(e) ? e : f(e.default) ? e.default : t && f(e[t]) ? e[t] : t && f(e[t]?.default) ? e[t].default : e;
17
- }
18
- var m = p(o, "EnableAudioAutoplayImage") || p(_.EnableAudioAutoplayImage, "EnableAudioAutoplayImage"), h = a, g = h.default, _ = g && typeof g == "object" ? g : h, v = c("pie-ui:multiple-choice"), y = (e, t, n, r) => {
19
- let { autoplayAudioEnabled: i, completeAudioEnabled: a } = t || {};
20
- if (i && a && !n && r) {
21
- let e = r.querySelector("audio"), t = e && e.closest("#preview-prompt");
22
- if (e && t) return !1;
23
- }
24
- if (!e || !e.value) return !1;
25
- let { choiceMode: o, minSelections: s = 1, maxSelections: c } = t || {}, l = e.value.length || 0;
26
- return o === "radio" ? !!l : !(l < s || l > c);
27
- };
28
- function b(e) {
29
- let t = e.closest("pie-player") || e.closest("pie-item-player");
30
- if (!t) return {
31
- baseHeadingLevel: void 0,
32
- includeSrHeading: !0
33
- };
34
- let n = (e, n, r) => {
35
- let i = t[e];
36
- return i ??= t.getAttribute(n) ?? t.getAttribute(r), i;
37
- }, r = n("baseHeadingLevel", "base-heading-level", "baseheadinglevel"), i = parseInt(r, 10), a = Number.isFinite(i) && i >= 1 && i <= 6 ? i : void 0, o = n("includeSrHeading", "include-sr-heading", "includesrheading");
38
- return {
39
- baseHeadingLevel: a,
40
- includeSrHeading: o == null ? !0 : o !== !1 && o !== "false"
41
- };
42
- }
43
- function x(e) {
44
- let t = b(e);
45
- return {
46
- baseHeadingLevel: e._baseHeadingLevel === void 0 ? t.baseHeadingLevel : e._baseHeadingLevel,
47
- includeSrHeading: e._includeSrHeading === void 0 ? t.includeSrHeading : e._includeSrHeading
48
- };
49
- }
50
- var S = class extends HTMLElement {
51
- constructor() {
52
- super(), this._model = null, this._session = null, this._options = null, this.audioComplete = !1, this._boundHandleKeyDown = this.handleKeyDown.bind(this), this._keyboardEventsEnabled = !1, this._audioInitialized = !1, this._root = null, this._mathObserver = null, this._mathRenderPending = !1, this._rerender = t(() => {
53
- if (this._model && this._session) {
54
- var t = i.createElement(e, {
55
- model: this._model,
56
- session: this._session,
57
- options: this._options,
58
- onChoiceChanged: this._onChange.bind(this),
59
- onShowCorrectToggle: this.onShowCorrectToggle.bind(this),
60
- ...x(this)
61
- });
62
- this.setAttribute("aria-label", this._model.choiceMode === "radio" ? "Multiple Choice Question" : "Multiple Correct Answer Question"), this.setAttribute("role", "region"), this.setLangAttribute(), this._initMathObserver(), this._root ||= s(this), this._root.render(t), this._model.keyboardEventsEnabled === !0 && !this._keyboardEventsEnabled && this.enableKeyboardEvents();
63
- } else v("skip");
64
- }, 50, {
65
- leading: !1,
66
- trailing: !0
67
- }), this._dispatchResponseChanged = t(() => {
68
- this.dispatchEvent(new u(this.tagName.toLowerCase(), y(this._session, this._model, this.audioComplete, this)));
69
- }), this._dispatchModelSet = t(() => {
70
- this.dispatchEvent(new l(this.tagName.toLowerCase(), y(this._session, this._model, this.audioComplete, this), this._model !== void 0));
71
- }, 50, {
72
- leading: !1,
73
- trailing: !0
74
- });
75
- }
76
- _scheduleMathRender = () => {
77
- this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
78
- this._mathObserver && this._mathObserver.disconnect(), v("render complete - render math"), d(this), this._mathRenderPending = !1, setTimeout(() => {
79
- this._mathObserver && this._mathObserver.observe(this, {
80
- childList: !0,
81
- subtree: !0
82
- });
83
- }, 50);
84
- }));
85
- };
86
- _initMathObserver() {
87
- this._mathObserver || (this._mathObserver = new MutationObserver(this._scheduleMathRender), this._mathObserver.observe(this, {
88
- childList: !0,
89
- subtree: !0
90
- }));
91
- }
92
- _disconnectMathObserver() {
93
- this._mathObserver &&= (this._mathObserver.disconnect(), null);
94
- }
95
- onShowCorrectToggle() {
96
- d(this);
97
- }
98
- setLangAttribute() {
99
- let e = this._model && typeof this._model.language ? this._model.language : "", t = e ? e.slice(0, 2) : "en";
100
- this.setAttribute("lang", t);
101
- }
102
- set model(e) {
103
- this._model = e, this._rerender(), this._audioInitialized = !1, this._dispatchModelSet();
104
- }
105
- get session() {
106
- return this._session;
107
- }
108
- get options() {
109
- return this._options;
110
- }
111
- set options(e) {
112
- this._options = e, this._rerender();
113
- }
114
- set baseHeadingLevel(e) {
115
- this._baseHeadingLevel = e, this._rerender();
116
- }
117
- set includeSrHeading(e) {
118
- this._includeSrHeading = e, this._rerender();
119
- }
120
- set session(e) {
121
- this._session = e, this._rerender(), this._dispatchResponseChanged();
122
- }
123
- _onChange(e) {
124
- r(this._session, this._model.choiceMode, e), this._dispatchResponseChanged(), this._rerender();
125
- }
126
- _createAudioInfoToast() {
127
- let e = document.createElement("div");
128
- e.id = "play-audio-info", Object.assign(e.style, {
129
- position: "absolute",
130
- top: 0,
131
- width: "100%",
132
- height: "100%",
133
- display: "flex",
134
- justifyContent: "center",
135
- alignItems: "center",
136
- background: "white",
137
- zIndex: "1000",
138
- cursor: "pointer"
139
- });
140
- let t = document.createElement("img");
141
- return t.src = m, t.alt = "Click anywhere to enable audio autoplay", t.width = 500, t.height = 300, e.appendChild(t), e;
142
- }
143
- connectedCallback() {
144
- this._initMathObserver(), this._initPlayerObserver(), this._rerender(), new MutationObserver((e, t) => {
145
- e.forEach((e) => {
146
- if (e.type === "childList") {
147
- if (this._audioInitialized) return;
148
- let e = this.querySelector("audio"), r = e && e.closest("#preview-prompt");
149
- if (!this._model || !this._model.autoplayAudioEnabled || e && !r || !e) return;
150
- let i = this._createAudioInfoToast(), a = this.querySelector("#main-container"), o = () => {
151
- this.querySelector("#play-audio-info") && (e.play(), a.removeChild(i)), document.removeEventListener("click", o);
152
- };
153
- setTimeout(() => {
154
- e.paused && !this.querySelector("#play-audio-info") ? (a.appendChild(i), document.addEventListener("click", o)) : document.removeEventListener("click", o);
155
- }, 500);
156
- let s = () => {
157
- n(this._session, { audioStartTime: (/* @__PURE__ */ new Date()).getTime() });
158
- let t = this.querySelector("#play-audio-info");
159
- t && a.removeChild(t), e.removeEventListener("playing", s);
160
- };
161
- e.addEventListener("playing", s);
162
- let c = () => {
163
- n(this._session, { audioEndTime: (/* @__PURE__ */ new Date()).getTime() }), this.audioComplete = !0, this._dispatchResponseChanged(), e.removeEventListener("ended", c);
164
- };
165
- e.addEventListener("ended", c), this._audio = e, this._handlePlaying = s, this._handleEnded = c, this._enableAudio = o, this._audioInitialized = !0, t.disconnect();
166
- }
167
- });
168
- }).observe(this, {
169
- childList: !0,
170
- subtree: !0
171
- });
172
- }
173
- enableKeyboardEvents() {
174
- this._keyboardEventsEnabled ||= (window.addEventListener("keydown", this._boundHandleKeyDown), !0);
175
- }
176
- _initPlayerObserver() {
177
- let e = this.closest("pie-player") || this.closest("pie-item-player");
178
- e && (this._playerObserver = new MutationObserver(() => {
179
- this._rerender();
180
- }), this._playerObserver.observe(e, {
181
- attributes: !0,
182
- attributeFilter: [
183
- "base-heading-level",
184
- "baseheadinglevel",
185
- "include-sr-heading",
186
- "includesrheading"
187
- ]
188
- }));
189
- }
190
- _disconnectPlayerObserver() {
191
- this._playerObserver &&= (this._playerObserver.disconnect(), null);
192
- }
193
- disconnectedCallback() {
194
- this._disconnectMathObserver(), this._disconnectPlayerObserver(), this._keyboardEventsEnabled &&= (window.removeEventListener("keydown", this._boundHandleKeyDown), !1), document.removeEventListener("click", this._enableAudio), this._audio &&= (this._audio.removeEventListener("playing", this._handlePlaying), this._audio.removeEventListener("ended", this._handleEnded), null), this._root && this._root.unmount();
195
- }
196
- handleKeyDown(e) {
197
- if (!this._model || !this._session) return;
198
- let { mode: t } = this._model;
199
- if (t !== "gather") return;
200
- let n = ((e) => {
201
- let t = e >= "1" && e <= "9" ? e - "1" : e === "0" ? 9 : -1, n = /^[a-jA-J]$/.test(e) ? e.toLowerCase().charCodeAt(0) - 97 : -1;
202
- return t >= 0 ? t : n;
203
- })(e.key);
204
- if (n === void 0 || n <= -1 || n >= this._model.choices?.length) return;
205
- let r = this._session.value || [], i = this._model.choices[n].value, a = {
206
- value: i,
207
- selected: !r.includes(i),
208
- selector: "Keyboard"
209
- };
210
- this._onChange(a);
211
- }
212
- };
213
- //#endregion
214
- export { S as default, y as isComplete };
@@ -1,31 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/multiple-choice/src/main.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- declare class Main extends React.Component {
12
- static propTypes: {
13
- model: PropTypes.Requireable<object>;
14
- session: PropTypes.Requireable<object>;
15
- options: PropTypes.Requireable<object>;
16
- onChoiceChanged: PropTypes.Requireable<(...args: any[]) => any>;
17
- onShowCorrectToggle: PropTypes.Requireable<(...args: any[]) => any>;
18
- extraCSSRules: PropTypes.Requireable<PropTypes.InferProps<{
19
- names: PropTypes.Requireable<(string | null | undefined)[]>;
20
- rules: PropTypes.Requireable<string>;
21
- }>>;
22
- baseHeadingLevel: PropTypes.Requireable<number>;
23
- includeSrHeading: PropTypes.Requireable<boolean>;
24
- };
25
- static defaultProps: {
26
- model: {};
27
- session: {};
28
- };
29
- render(): React.JSX.Element;
30
- }
31
- export default Main;
@@ -1,51 +0,0 @@
1
- import e from "./multiple-choice.js";
2
- import t from "react";
3
- import n from "prop-types";
4
- import * as r from "@pie-lib/render-ui";
5
- import { PreviewLayout as i } from "@pie-lib/render-ui";
6
- import { jsx as a } from "react/jsx-runtime";
7
- //#region src/delivery/main.tsx
8
- function o(e) {
9
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
10
- }
11
- function s(e, t) {
12
- return !e || o(e) ? e : o(e.default) ? e.default : t && o(e[t]) ? e[t] : t && o(e[t]?.default) ? e[t].default : e;
13
- }
14
- var c = s(i, "PreviewLayout") || s(d.PreviewLayout, "PreviewLayout"), l = r, u = l.default, d = u && typeof u == "object" ? u : l, f = class extends t.Component {
15
- static propTypes = {
16
- model: n.object,
17
- session: n.object,
18
- options: n.object,
19
- onChoiceChanged: n.func,
20
- onShowCorrectToggle: n.func,
21
- extraCSSRules: n.shape({
22
- names: n.arrayOf(n.string),
23
- rules: n.string
24
- }),
25
- baseHeadingLevel: n.number,
26
- includeSrHeading: n.bool
27
- };
28
- static defaultProps = {
29
- model: {},
30
- session: {}
31
- };
32
- render() {
33
- let { model: t, onChoiceChanged: n, session: r, onShowCorrectToggle: i, options: o, baseHeadingLevel: s, includeSrHeading: l } = this.props, { extraCSSRules: u, fontSizeFactor: d } = t;
34
- return /* @__PURE__ */ a(c, {
35
- extraCSSRules: u,
36
- fontSizeFactor: d,
37
- classes: {},
38
- children: /* @__PURE__ */ a(e, {
39
- ...t,
40
- options: o,
41
- session: r,
42
- onChoiceChanged: n,
43
- onShowCorrectToggle: i,
44
- baseHeadingLevel: s,
45
- includeSrHeading: l
46
- })
47
- });
48
- }
49
- };
50
- //#endregion
51
- export { f as default };
@@ -1,61 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/multiple-choice/src/multiple-choice.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- export declare class MultipleChoice extends React.Component {
12
- static propTypes: {
13
- className: PropTypes.Requireable<string>;
14
- mode: PropTypes.Requireable<string>;
15
- choiceMode: PropTypes.Requireable<string>;
16
- keyMode: PropTypes.Requireable<string>;
17
- choices: PropTypes.Requireable<any[]>;
18
- partLabel: PropTypes.Requireable<string>;
19
- prompt: PropTypes.Requireable<string>;
20
- teacherInstructions: PropTypes.Requireable<string>;
21
- session: PropTypes.Requireable<object>;
22
- disabled: PropTypes.Requireable<boolean>;
23
- onChoiceChanged: PropTypes.Requireable<(...args: any[]) => any>;
24
- responseCorrect: PropTypes.Requireable<boolean>;
25
- correctResponse: PropTypes.Requireable<any[]>;
26
- choicesLayout: PropTypes.Requireable<string>;
27
- gridColumns: PropTypes.Requireable<string>;
28
- alwaysShowCorrect: PropTypes.Requireable<boolean>;
29
- animationsDisabled: PropTypes.Requireable<boolean>;
30
- language: PropTypes.Requireable<string>;
31
- selectedAnswerBackgroundColor: PropTypes.Requireable<string>;
32
- selectedAnswerStrokeColor: PropTypes.Requireable<string>;
33
- selectedAnswerStrokeWidth: PropTypes.Requireable<string>;
34
- hoverAnswerBackgroundColor: PropTypes.Requireable<string>;
35
- hoverAnswerStrokeColor: PropTypes.Requireable<string>;
36
- hoverAnswerStrokeWidth: PropTypes.Requireable<string>;
37
- onShowCorrectToggle: PropTypes.Requireable<(...args: any[]) => any>;
38
- isSelectionButtonBelow: PropTypes.Requireable<boolean>;
39
- minSelections: PropTypes.Requireable<number>;
40
- maxSelections: PropTypes.Requireable<number>;
41
- autoplayAudioEnabled: PropTypes.Requireable<boolean>;
42
- customAudioButton: {
43
- playImage: PropTypes.Requireable<string>;
44
- pauseImage: PropTypes.Requireable<string>;
45
- };
46
- options: PropTypes.Requireable<object>;
47
- baseHeadingLevel: PropTypes.Requireable<number>;
48
- includeSrHeading: PropTypes.Requireable<boolean>;
49
- };
50
- constructor(props: any);
51
- isSelected(value: any): any;
52
- handleChange: any;
53
- onToggle: any;
54
- UNSAFE_componentWillReceiveProps(nextProps: any): void;
55
- indexToSymbol(index: any): string;
56
- getCorrectness: any;
57
- getChecked(choice: any): any;
58
- renderHeading(): React.JSX.Element | null;
59
- render(): React.JSX.Element;
60
- }
61
- export default MultipleChoice;
@@ -1,244 +0,0 @@
1
- import e from "./choice.js";
2
- import t from "react";
3
- import n from "prop-types";
4
- import * as r from "@pie-lib/render-ui";
5
- import { Collapsible as i, PreviewPrompt as a, color as o, transformDataHeadings as s } from "@pie-lib/render-ui";
6
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
- import u from "@pie-lib/correct-answer-toggle";
8
- import d from "classnames";
9
- import { styled as f } from "@mui/material/styles";
10
- import p from "@mui/material/Box";
11
- import m from "@pie-lib/translator";
12
- //#region src/delivery/multiple-choice.tsx
13
- function h(e) {
14
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
15
- }
16
- function g(e, t) {
17
- return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
18
- }
19
- var _ = g(a, "PreviewPrompt") || g(x.PreviewPrompt, "PreviewPrompt"), v = g(i, "Collapsible") || g(x.Collapsible, "Collapsible"), y = r, b = y.default, x = b && typeof b == "object" ? b : y, { translator: S } = m, C = f(p)({
20
- color: o.text(),
21
- backgroundColor: o.background(),
22
- "& *": { "-webkit-font-smoothing": "antialiased" },
23
- position: "relative",
24
- "& legend": { border: "none !important" }
25
- }), w = f("h2")(({ theme: e }) => ({
26
- display: "block",
27
- fontSize: "inherit",
28
- margin: "0",
29
- fontWeight: "normal",
30
- paddingBottom: e.spacing(2)
31
- })), T = f(p)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), E = f(p)({
32
- display: "flex",
33
- flexDirection: "row",
34
- flexWrap: "wrap"
35
- }), D = f(p)({ display: "grid" }), O = f("fieldset")({
36
- border: "0px",
37
- padding: "0.01em 0 0 0",
38
- margin: "0px",
39
- minWidth: "0px"
40
- }), k = f("h3")({
41
- position: "absolute",
42
- left: "-10000px",
43
- top: "auto",
44
- width: "1px",
45
- height: "1px",
46
- overflow: "hidden"
47
- }), A = f("div")(({ theme: e }) => ({
48
- fontSize: e.typography.fontSize - 2,
49
- color: e.palette.error.main,
50
- paddingTop: e.spacing(1)
51
- })), j = class extends t.Component {
52
- static propTypes = {
53
- className: n.string,
54
- mode: n.oneOf([
55
- "gather",
56
- "view",
57
- "evaluate"
58
- ]),
59
- choiceMode: n.oneOf(["radio", "checkbox"]),
60
- keyMode: n.oneOf([
61
- "numbers",
62
- "letters",
63
- "none"
64
- ]),
65
- choices: n.array,
66
- partLabel: n.string,
67
- prompt: n.string,
68
- teacherInstructions: n.string,
69
- session: n.object,
70
- disabled: n.bool,
71
- onChoiceChanged: n.func,
72
- responseCorrect: n.bool,
73
- correctResponse: n.array,
74
- choicesLayout: n.oneOf([
75
- "vertical",
76
- "grid",
77
- "horizontal"
78
- ]),
79
- gridColumns: n.string,
80
- alwaysShowCorrect: n.bool,
81
- animationsDisabled: n.bool,
82
- language: n.string,
83
- selectedAnswerBackgroundColor: n.string,
84
- selectedAnswerStrokeColor: n.string,
85
- selectedAnswerStrokeWidth: n.string,
86
- hoverAnswerBackgroundColor: n.string,
87
- hoverAnswerStrokeColor: n.string,
88
- hoverAnswerStrokeWidth: n.string,
89
- onShowCorrectToggle: n.func,
90
- isSelectionButtonBelow: n.bool,
91
- minSelections: n.number,
92
- maxSelections: n.number,
93
- autoplayAudioEnabled: n.bool,
94
- customAudioButton: {
95
- playImage: n.string,
96
- pauseImage: n.string
97
- },
98
- options: n.object,
99
- baseHeadingLevel: n.number,
100
- includeSrHeading: n.bool
101
- };
102
- constructor(e) {
103
- super(e), this.state = {
104
- showCorrect: this.props.options && this.props.alwaysShowCorrect || !1,
105
- maxSelectionsErrorState: !1
106
- }, this.onToggle = this.onToggle.bind(this), this.groupName = `mc-group-${Math.random().toString(36).slice(2, 10)}`;
107
- }
108
- isSelected(e) {
109
- let t = this.props.session && this.props.session.value;
110
- return t && t.indexOf && t.indexOf(e) >= 0;
111
- }
112
- handleChange = (e) => {
113
- let { value: t, checked: n } = e.target, { maxSelections: r, onChoiceChanged: i, session: a } = this.props;
114
- a.value && a.value.length >= r && (this.setState({ maxSelectionsErrorState: n }), n) || i({
115
- value: t,
116
- selected: n,
117
- selector: "Mouse"
118
- });
119
- };
120
- onToggle = () => {
121
- this.props.mode === "evaluate" && this.setState({ showCorrect: !this.state.showCorrect }, () => {
122
- this.props.onShowCorrectToggle && this.props.onShowCorrectToggle();
123
- });
124
- };
125
- UNSAFE_componentWillReceiveProps(e) {
126
- !e.correctResponse && this.state.showCorrect !== !1 && this.setState({ showCorrect: !1 }, () => {
127
- this.props.onShowCorrectToggle && this.props.onShowCorrectToggle();
128
- }), e.options && e.alwaysShowCorrect && this.state.showCorrect !== !0 && this.setState({ showCorrect: !0 }, () => {
129
- this.props.onShowCorrectToggle && this.props.onShowCorrectToggle();
130
- });
131
- }
132
- indexToSymbol(e) {
133
- return this.props.keyMode === "numbers" ? `${e + 1}` : this.props.keyMode === "letters" ? String.fromCharCode(97 + e).toUpperCase() : "";
134
- }
135
- getCorrectness = (e = {}) => {
136
- let t = e.correct, n = this.isSelected(e.value);
137
- if (this.state.showCorrect) return t ? "correct" : void 0;
138
- if (t) return n ? "correct" : "incorrect";
139
- if (n) return "incorrect";
140
- };
141
- getChecked(e) {
142
- return this.props.options && this.props.alwaysShowCorrect || this.state.showCorrect && this.props.mode === "evaluate" ? e.correct || !1 : this.isSelected(e.value);
143
- }
144
- renderHeading() {
145
- let { mode: e, choiceMode: t, includeSrHeading: n, baseHeadingLevel: r, partLabel: i } = this.props;
146
- if (!(!i && n !== !1) || e !== "gather") return null;
147
- let a = r ? Math.min(6, r) : 2;
148
- return /* @__PURE__ */ c(k.withComponent(`h${a}`), { children: t === "radio" ? "Multiple Choice Question" : "Multiple Select Question" });
149
- }
150
- render() {
151
- let { mode: t, disabled: n, className: r, choices: i = [], choiceMode: a, gridColumns: o, partLabel: f, prompt: m, responseCorrect: h, teacherInstructions: g, alwaysShowCorrect: y, animationsDisabled: b, language: x, isSelectionButtonBelow: k, minSelections: j, maxSelections: M, autoplayAudioEnabled: N, session: P, customAudioButton: F, options: I, baseHeadingLevel: L } = this.props, { showCorrect: R, maxSelectionsErrorState: z } = this.state, B = t === "evaluate", V = B && !h, H = o > 1 ? { gridTemplateColumns: `repeat(${o}, 1fr)` } : void 0, U = P.value && P.value.length || 0, W = (() => {
152
- if (!L) return;
153
- let e = 1;
154
- return f && (e += 1), Math.min(6, L + e);
155
- })(), G = (e) => e && W ? s(e, W) : e, K = /* @__PURE__ */ c(_, {
156
- tagName: "div",
157
- className: "prompt",
158
- defaultClassName: "teacher-instructions",
159
- prompt: g
160
- }), q = () => j && M ? j === M ? S.t("translation:multipleChoice:minmaxSelections_equal", {
161
- lng: x,
162
- minSelections: j
163
- }) : S.t("translation:multipleChoice:minmaxSelections_range", {
164
- lng: x,
165
- minSelections: j,
166
- maxSelections: M
167
- }) : j ? S.t("translation:multipleChoice:minSelections", {
168
- lng: x,
169
- minSelections: j
170
- }) : "", J = this.props.choicesLayout === "grid" ? D : this.props.choicesLayout === "horizontal" ? E : p;
171
- return /* @__PURE__ */ l(C, {
172
- id: "main-container",
173
- className: d(r, "multiple-choice"),
174
- children: [
175
- f && /* @__PURE__ */ c(w, {
176
- as: L ? `h${Math.min(6, L + 1)}` : "h2",
177
- children: f
178
- }),
179
- this.renderHeading(),
180
- g && /* @__PURE__ */ c(T, { children: b ? K : /* @__PURE__ */ c(v, {
181
- labels: {
182
- hidden: "Show Teacher Instructions",
183
- visible: "Hide Teacher Instructions"
184
- },
185
- children: K
186
- }) }),
187
- /* @__PURE__ */ l(O, {
188
- role: a === "radio" ? "radiogroup" : "group",
189
- children: [
190
- /* @__PURE__ */ c(_, {
191
- className: "prompt",
192
- defaultClassName: "prompt",
193
- prompt: G(m),
194
- tagName: "legend",
195
- autoplayAudioEnabled: N,
196
- customAudioButton: F
197
- }),
198
- !(I && y) && /* @__PURE__ */ c(u, {
199
- show: V,
200
- toggled: R,
201
- onToggle: this.onToggle.bind(this),
202
- language: x
203
- }),
204
- /* @__PURE__ */ c(J, {
205
- style: H,
206
- children: i.map((t, r) => /* @__PURE__ */ c(e, {
207
- choicesLayout: this.props.choicesLayout,
208
- selectedAnswerBackgroundColor: this.props.selectedAnswerBackgroundColor,
209
- selectedAnswerStrokeColor: this.props.selectedAnswerStrokeColor,
210
- selectedAnswerStrokeWidth: this.props.selectedAnswerStrokeWidth,
211
- hoverAnswerBackgroundColor: this.props.hoverAnswerBackgroundColor,
212
- hoverAnswerStrokeColor: this.props.hoverAnswerStrokeColor,
213
- hoverAnswerStrokeWidth: this.props.hoverAnswerStrokeWidth,
214
- gridColumns: o,
215
- choice: t,
216
- index: r,
217
- choicesLength: i.length,
218
- showCorrect: R,
219
- isEvaluateMode: B,
220
- choiceMode: a,
221
- disabled: n,
222
- tagName: this.groupName,
223
- onChoiceChanged: this.handleChange,
224
- hideTick: t.hideTick,
225
- checked: this.getChecked(t),
226
- correctness: B ? this.getCorrectness(t) : void 0,
227
- displayKey: this.indexToSymbol(r),
228
- isSelectionButtonBelow: k
229
- }, `choice-${r}`))
230
- })
231
- ]
232
- }),
233
- a === "checkbox" && U < j && /* @__PURE__ */ c(A, { children: q() }),
234
- a === "checkbox" && z && /* @__PURE__ */ c(A, { children: S.t(`translation:multipleChoice:maxSelections_${M === 1 ? "one" : "other"}`, {
235
- lng: x,
236
- maxSelections: M
237
- }) })
238
- ]
239
- });
240
- }
241
- };
242
- j.defaultProps = { session: { value: [] } };
243
- //#endregion
244
- export { j as default };
@@ -1,10 +0,0 @@
1
- /**
2
- * @synced-from pie-elements/packages/multiple-choice/src/session-updater.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- export declare function updateSessionValue(session: any, choiceMode: any, data: any): void;
10
- export declare function updateSessionMetadata(session: any, metadata: any): void;
@@ -1,9 +0,0 @@
1
- //#region src/delivery/session-updater.ts
2
- function e(e, t, n) {
3
- e.value = e.value || [], t === "checkbox" && (n.selected ? e.value = Array.from(new Set([...e.value, n.value])) : e.value = e.value.filter((e) => e !== n.value)), t === "radio" && (n.selected ? e.value = [n.value] : e.value = []), e.selector = n.selector;
4
- }
5
- function t(e, t) {
6
- e.audioStartTime = e.audioStartTime || t.audioStartTime, e.audioEndTime = e.audioEndTime || t.audioEndTime, !e.waitTime && e.audioStartTime && e.audioEndTime && (e.waitTime = e.audioEndTime - e.audioStartTime);
7
- }
8
- //#endregion
9
- export { t as updateSessionMetadata, e as updateSessionValue };
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export { default } from './delivery/index.js';
@@ -1,8 +0,0 @@
1
- /**
2
- * IIFE entry point for multiple-choice element
3
- * This file is only used for IIFE builds and includes auto-registration
4
- *
5
- * @sync-generated - Auto-generated during sync from pie-elements
6
- */
7
- import Element from './index.js';
8
- export default Element;