@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.
Files changed (272) hide show
  1. package/dist/author/defaults.d.ts +206 -0
  2. package/dist/author/defaults.d.ts.map +1 -0
  3. package/dist/author/defaults.js +151 -0
  4. package/dist/author/index.d.ts +27 -0
  5. package/dist/author/index.d.ts.map +1 -0
  6. package/dist/author/index.js +116 -0
  7. package/dist/author/main.d.ts +35 -0
  8. package/dist/author/main.d.ts.map +1 -0
  9. package/dist/author/main.js +290 -0
  10. package/dist/author/utils.d.ts +10 -0
  11. package/dist/author/utils.d.ts.map +1 -0
  12. package/dist/author/utils.js +7 -0
  13. package/dist/controller/defaults.d.ts +36 -0
  14. package/dist/controller/defaults.d.ts.map +1 -0
  15. package/dist/controller/defaults.js +29 -0
  16. package/dist/controller/index.d.ts +66 -0
  17. package/dist/controller/index.d.ts.map +1 -0
  18. package/dist/controller/index.js +124 -0
  19. package/dist/controller/utils.d.ts +11 -0
  20. package/dist/controller/utils.d.ts.map +1 -0
  21. package/dist/controller/utils.js +8 -0
  22. package/dist/delivery/choice-input.d.ts +45 -0
  23. package/dist/delivery/choice-input.d.ts.map +1 -0
  24. package/dist/delivery/choice-input.js +274 -0
  25. package/dist/delivery/choice.d.ts +21 -0
  26. package/dist/delivery/choice.d.ts.map +1 -0
  27. package/dist/delivery/choice.js +109 -0
  28. package/dist/delivery/feedback-tick.d.ts +21 -0
  29. package/dist/delivery/feedback-tick.d.ts.map +1 -0
  30. package/dist/delivery/feedback-tick.js +104 -0
  31. package/dist/delivery/index.d.ts +38 -0
  32. package/dist/delivery/index.d.ts.map +1 -0
  33. package/dist/delivery/index.js +217 -0
  34. package/dist/delivery/main.d.ts +32 -0
  35. package/dist/delivery/main.d.ts.map +1 -0
  36. package/dist/delivery/main.js +51 -0
  37. package/dist/delivery/multiple-choice.d.ts +63 -0
  38. package/dist/delivery/multiple-choice.d.ts.map +1 -0
  39. package/dist/delivery/multiple-choice.js +252 -0
  40. package/dist/delivery/session-updater.d.ts +11 -0
  41. package/dist/delivery/session-updater.d.ts.map +1 -0
  42. package/dist/delivery/session-updater.js +9 -0
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.iife.d.ts +9 -0
  46. package/dist/index.iife.d.ts.map +1 -0
  47. package/dist/index.iife.js +148 -0
  48. package/dist/index.js +2 -0
  49. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
  50. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
  51. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
  52. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
  53. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
  54. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
  55. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
  56. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_SetCache.js +11 -0
  57. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
  58. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  59. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
  60. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
  61. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_apply.js +12 -0
  62. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
  63. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
  64. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  65. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
  66. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arraySome.js +7 -0
  67. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignMergeValue.js +8 -0
  68. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
  69. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
  70. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
  71. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
  72. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
  73. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
  74. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
  75. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseFor.js +5 -0
  76. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  77. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  78. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  79. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqual.js +8 -0
  80. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsEqualDeep.js +30 -0
  81. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
  82. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  83. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
  84. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  85. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
  86. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  87. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMerge.js +19 -0
  88. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseMergeDeep.js +31 -0
  89. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseRest.js +9 -0
  90. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseSetToString.js +14 -0
  91. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  92. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js +8 -0
  93. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  94. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cacheHas.js +6 -0
  95. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  96. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
  97. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
  98. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
  99. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
  100. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  101. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
  102. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
  103. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
  104. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  105. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  106. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createAssigner.js +15 -0
  107. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_createBaseFor.js +12 -0
  108. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  109. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalArrays.js +35 -0
  110. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalByTag.js +35 -0
  111. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_equalObjects.js +32 -0
  112. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  113. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
  114. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  115. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
  116. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  117. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
  118. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  119. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
  120. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  121. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
  122. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  123. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
  124. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
  125. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
  126. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
  127. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
  128. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
  129. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
  130. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
  131. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  132. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIterateeCall.js +12 -0
  133. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
  134. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  135. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  136. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
  137. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
  138. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
  139. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
  140. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
  141. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
  142. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  143. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
  144. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
  145. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
  146. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapToArray.js +9 -0
  147. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
  148. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
  149. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  150. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  151. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  152. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
  153. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overRest.js +13 -0
  154. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  155. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_safeGet.js +6 -0
  156. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheAdd.js +7 -0
  157. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setCacheHas.js +6 -0
  158. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToArray.js +9 -0
  159. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_setToString.js +6 -0
  160. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_shortOut.js +14 -0
  161. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
  162. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
  163. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
  164. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
  165. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
  166. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  167. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  168. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
  169. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/constant.js +8 -0
  170. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/debounce.js +50 -0
  171. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/defaults.js +16 -0
  172. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  173. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/identity.js +6 -0
  174. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  175. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  176. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  177. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLikeObject.js +8 -0
  178. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  179. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
  180. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEqual.js +7 -0
  181. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  182. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  183. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
  184. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  185. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  186. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isPlainObject.js +14 -0
  187. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
  188. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
  189. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  190. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
  191. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  192. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/merge.js +8 -0
  193. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/now.js +7 -0
  194. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
  195. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  196. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +19 -0
  197. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toPlainObject.js +8 -0
  198. package/dist/print/index.d.ts +16 -0
  199. package/dist/print/index.d.ts.map +1 -0
  200. package/dist/print/index.js +44 -0
  201. package/package.json +58 -26
  202. package/{configure/lib/defaults.js → src/author/defaults.ts} +55 -90
  203. package/{configure/lib/index.js → src/author/index.ts} +98 -51
  204. package/src/author/main.tsx +509 -0
  205. package/src/author/utils.ts +25 -0
  206. package/{controller/lib/defaults.js → src/controller/defaults.ts} +11 -8
  207. package/{controller/lib/index.js → src/controller/index.ts} +123 -109
  208. package/src/controller/utils.ts +22 -0
  209. package/src/delivery/choice-input.tsx +413 -0
  210. package/src/delivery/choice.tsx +203 -0
  211. package/src/delivery/feedback-tick.tsx +156 -0
  212. package/src/delivery/index.ts +489 -0
  213. package/src/delivery/main.tsx +85 -0
  214. package/src/delivery/multiple-choice.tsx +485 -0
  215. package/{lib/session-updater.js → src/delivery/session-updater.ts} +17 -13
  216. package/src/index.iife.ts +16 -0
  217. package/src/index.ts +1 -0
  218. package/src/print/index.tsx +112 -0
  219. package/CHANGELOG.json +0 -1972
  220. package/CHANGELOG.md +0 -2690
  221. package/LICENSE.md +0 -5
  222. package/PRINT.md +0 -35
  223. package/README.md +0 -56
  224. package/choice.png +0 -0
  225. package/configure/CHANGELOG.json +0 -1387
  226. package/configure/CHANGELOG.md +0 -2046
  227. package/configure/lib/defaults.js.map +0 -1
  228. package/configure/lib/index.js.map +0 -1
  229. package/configure/lib/main.js +0 -477
  230. package/configure/lib/main.js.map +0 -1
  231. package/configure/lib/utils.js +0 -18
  232. package/configure/lib/utils.js.map +0 -1
  233. package/configure/package.json +0 -22
  234. package/controller/CHANGELOG.json +0 -527
  235. package/controller/CHANGELOG.md +0 -1388
  236. package/controller/lib/defaults.js.map +0 -1
  237. package/controller/lib/index.js.map +0 -1
  238. package/controller/lib/utils.js +0 -15
  239. package/controller/lib/utils.js.map +0 -1
  240. package/controller/package.json +0 -15
  241. package/docs/config-schema.json +0 -2993
  242. package/docs/config-schema.json.md +0 -2217
  243. package/docs/demo/config.js +0 -8
  244. package/docs/demo/generate.js +0 -61
  245. package/docs/demo/index.html +0 -1
  246. package/docs/demo/session.js +0 -7
  247. package/docs/pie-schema.json +0 -1332
  248. package/docs/pie-schema.json.md +0 -1015
  249. package/lib/choice-input.js +0 -380
  250. package/lib/choice-input.js.map +0 -1
  251. package/lib/choice.js +0 -197
  252. package/lib/choice.js.map +0 -1
  253. package/lib/feedback-tick.js +0 -134
  254. package/lib/feedback-tick.js.map +0 -1
  255. package/lib/index.js +0 -337
  256. package/lib/index.js.map +0 -1
  257. package/lib/main.js +0 -57
  258. package/lib/main.js.map +0 -1
  259. package/lib/multiple-choice.js +0 -385
  260. package/lib/multiple-choice.js.map +0 -1
  261. package/lib/print.js +0 -94
  262. package/lib/print.js.map +0 -1
  263. package/lib/session-updater.js.map +0 -1
  264. package/module/configure.js +0 -1
  265. package/module/controller.js +0 -3045
  266. package/module/demo.js +0 -86
  267. package/module/element.js +0 -1
  268. package/module/index.html +0 -21
  269. package/module/manifest.json +0 -14
  270. package/module/print-demo.js +0 -124
  271. package/module/print.html +0 -18
  272. package/module/print.js +0 -1
@@ -0,0 +1,217 @@
1
+ import e from "./main.js";
2
+ import t from "../node_modules/.bun/lodash-es@4.17.23/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"), s = o == null ? !0 : o !== !1 && o !== "false";
38
+ return console.log("getPlayerAttributes", {
39
+ baseHeadingLevel: a,
40
+ includeSrHeading: s
41
+ }), {
42
+ baseHeadingLevel: a,
43
+ includeSrHeading: s
44
+ };
45
+ }
46
+ function x(e) {
47
+ let t = b(e);
48
+ return console.log("element._baseHeadingLevel", e._baseHeadingLevel, "element._includeSrHeading", e._includeSrHeading), {
49
+ baseHeadingLevel: e._baseHeadingLevel === void 0 ? t.baseHeadingLevel : e._baseHeadingLevel,
50
+ includeSrHeading: e._includeSrHeading === void 0 ? t.includeSrHeading : e._includeSrHeading
51
+ };
52
+ }
53
+ var S = class extends HTMLElement {
54
+ constructor() {
55
+ 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(() => {
56
+ if (this._model && this._session) {
57
+ var t = i.createElement(e, {
58
+ model: this._model,
59
+ session: this._session,
60
+ options: this._options,
61
+ onChoiceChanged: this._onChange.bind(this),
62
+ onShowCorrectToggle: this.onShowCorrectToggle.bind(this),
63
+ ...x(this)
64
+ });
65
+ 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();
66
+ } else v("skip");
67
+ }, 50, {
68
+ leading: !1,
69
+ trailing: !0
70
+ }), this._dispatchResponseChanged = t(() => {
71
+ this.dispatchEvent(new u(this.tagName.toLowerCase(), y(this._session, this._model, this.audioComplete, this)));
72
+ }), this._dispatchModelSet = t(() => {
73
+ this.dispatchEvent(new l(this.tagName.toLowerCase(), y(this._session, this._model, this.audioComplete, this), this._model !== void 0));
74
+ }, 50, {
75
+ leading: !1,
76
+ trailing: !0
77
+ });
78
+ }
79
+ _scheduleMathRender = () => {
80
+ this._mathRenderPending || (this._mathRenderPending = !0, requestAnimationFrame(() => {
81
+ this._mathObserver && this._mathObserver.disconnect(), v("render complete - render math"), d(this), this._mathRenderPending = !1, setTimeout(() => {
82
+ this._mathObserver && this._mathObserver.observe(this, {
83
+ childList: !0,
84
+ subtree: !0
85
+ });
86
+ }, 50);
87
+ }));
88
+ };
89
+ _initMathObserver() {
90
+ this._mathObserver || (this._mathObserver = new MutationObserver(this._scheduleMathRender), this._mathObserver.observe(this, {
91
+ childList: !0,
92
+ subtree: !0
93
+ }));
94
+ }
95
+ _disconnectMathObserver() {
96
+ this._mathObserver &&= (this._mathObserver.disconnect(), null);
97
+ }
98
+ onShowCorrectToggle() {
99
+ d(this);
100
+ }
101
+ setLangAttribute() {
102
+ let e = this._model && typeof this._model.language ? this._model.language : "", t = e ? e.slice(0, 2) : "en";
103
+ this.setAttribute("lang", t);
104
+ }
105
+ set model(e) {
106
+ this._model = e, this._rerender(), this._audioInitialized = !1, this._dispatchModelSet();
107
+ }
108
+ get session() {
109
+ return this._session;
110
+ }
111
+ get options() {
112
+ return this._options;
113
+ }
114
+ set options(e) {
115
+ this._options = e, this._rerender();
116
+ }
117
+ set baseHeadingLevel(e) {
118
+ this._baseHeadingLevel = e, this._rerender();
119
+ }
120
+ set includeSrHeading(e) {
121
+ this._includeSrHeading = e, this._rerender();
122
+ }
123
+ set session(e) {
124
+ this._session = e, this._rerender(), this._dispatchResponseChanged();
125
+ }
126
+ _onChange(e) {
127
+ r(this._session, this._model.choiceMode, e), this._dispatchResponseChanged(), this._rerender();
128
+ }
129
+ _createAudioInfoToast() {
130
+ let e = document.createElement("div");
131
+ e.id = "play-audio-info", Object.assign(e.style, {
132
+ position: "absolute",
133
+ top: 0,
134
+ width: "100%",
135
+ height: "100%",
136
+ display: "flex",
137
+ justifyContent: "center",
138
+ alignItems: "center",
139
+ background: "white",
140
+ zIndex: "1000",
141
+ cursor: "pointer"
142
+ });
143
+ let t = document.createElement("img");
144
+ return t.src = m, t.alt = "Click anywhere to enable audio autoplay", t.width = 500, t.height = 300, e.appendChild(t), e;
145
+ }
146
+ connectedCallback() {
147
+ this._initMathObserver(), this._initPlayerObserver(), this._rerender(), new MutationObserver((e, t) => {
148
+ e.forEach((e) => {
149
+ if (e.type === "childList") {
150
+ if (this._audioInitialized) return;
151
+ let e = this.querySelector("audio"), r = e && e.closest("#preview-prompt");
152
+ if (!this._model || !this._model.autoplayAudioEnabled || e && !r || !e) return;
153
+ let i = this._createAudioInfoToast(), a = this.querySelector("#main-container"), o = () => {
154
+ this.querySelector("#play-audio-info") && (e.play(), a.removeChild(i)), document.removeEventListener("click", o);
155
+ };
156
+ setTimeout(() => {
157
+ e.paused && !this.querySelector("#play-audio-info") ? (a.appendChild(i), document.addEventListener("click", o)) : document.removeEventListener("click", o);
158
+ }, 500);
159
+ let s = () => {
160
+ n(this._session, { audioStartTime: (/* @__PURE__ */ new Date()).getTime() });
161
+ let t = this.querySelector("#play-audio-info");
162
+ t && a.removeChild(t), e.removeEventListener("playing", s);
163
+ };
164
+ e.addEventListener("playing", s);
165
+ let c = () => {
166
+ n(this._session, { audioEndTime: (/* @__PURE__ */ new Date()).getTime() }), this.audioComplete = !0, this._dispatchResponseChanged(), e.removeEventListener("ended", c);
167
+ };
168
+ e.addEventListener("ended", c), this._audio = e, this._handlePlaying = s, this._handleEnded = c, this._enableAudio = o, this._audioInitialized = !0, t.disconnect();
169
+ }
170
+ });
171
+ }).observe(this, {
172
+ childList: !0,
173
+ subtree: !0
174
+ });
175
+ }
176
+ enableKeyboardEvents() {
177
+ this._keyboardEventsEnabled ||= (window.addEventListener("keydown", this._boundHandleKeyDown), !0);
178
+ }
179
+ _initPlayerObserver() {
180
+ let e = this.closest("pie-player") || this.closest("pie-item-player");
181
+ e && (this._playerObserver = new MutationObserver(() => {
182
+ this._rerender();
183
+ }), this._playerObserver.observe(e, {
184
+ attributes: !0,
185
+ attributeFilter: [
186
+ "base-heading-level",
187
+ "baseheadinglevel",
188
+ "include-sr-heading",
189
+ "includesrheading"
190
+ ]
191
+ }));
192
+ }
193
+ _disconnectPlayerObserver() {
194
+ this._playerObserver &&= (this._playerObserver.disconnect(), null);
195
+ }
196
+ disconnectedCallback() {
197
+ 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();
198
+ }
199
+ handleKeyDown(e) {
200
+ if (!this._model || !this._session) return;
201
+ let { mode: t } = this._model;
202
+ if (t !== "gather") return;
203
+ let n = ((e) => {
204
+ let t = e >= "1" && e <= "9" ? e - "1" : e === "0" ? 9 : -1, n = /^[a-jA-J]$/.test(e) ? e.toLowerCase().charCodeAt(0) - 97 : -1;
205
+ return t >= 0 ? t : n;
206
+ })(e.key);
207
+ if (n === void 0 || n <= -1 || n >= this._model.choices?.length) return;
208
+ let r = this._session.value || [], i = this._model.choices[n].value, a = {
209
+ value: i,
210
+ selected: !r.includes(i),
211
+ selector: "Keyboard"
212
+ };
213
+ this._onChange(a);
214
+ }
215
+ };
216
+ //#endregion
217
+ export { S as default, y as isComplete };
@@ -0,0 +1,32 @@
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;
32
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/delivery/main.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAgCnC,cAAM,IAAK,SAAQ,KAAK,CAAC,SAAS;IAChC,MAAM,CAAC,SAAS;;;;;;;;;;;;MAYd;IAEF,MAAM,CAAC,YAAY;;;MAGjB;IAEF,MAAM;CAmBP;AAED,eAAe,IAAI,CAAC"}
@@ -0,0 +1,51 @@
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 };
@@ -0,0 +1,63 @@
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
+ handleGroupFocus: any;
60
+ render(): React.JSX.Element;
61
+ }
62
+ export default MultipleChoice;
63
+ //# sourceMappingURL=multiple-choice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multiple-choice.d.ts","sourceRoot":"","sources":["../../src/delivery/multiple-choice.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAqGnC,qBAAa,cAAe,SAAQ,KAAK,CAAC,SAAS;IACjD,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAqCd;gBAEU,KAAK,KAAA;IAYjB,UAAU,CAAC,KAAK,KAAA;IAOhB,YAAY,EAAE,GAAG,CAef;IAEF,QAAQ,EAAE,GAAG,CAQX;IAEF,gCAAgC,CAAC,SAAS,KAAA;IAkB1C,aAAa,CAAC,KAAK,KAAA;IAYnB,cAAc,EAAE,GAAG,CAyBjB;IAEF,UAAU,CAAC,MAAM,KAAA;IAoBjB,aAAa;IAkBb,gBAAgB,EAAE,GAAG,CAcnB;IAEF,MAAM;CAuKP;AAQD,eAAe,cAAc,CAAC"}
@@ -0,0 +1,252 @@
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
+ "&:focus": { outline: "none" }
41
+ }), k = f("h3")({
42
+ position: "absolute",
43
+ left: "-10000px",
44
+ top: "auto",
45
+ width: "1px",
46
+ height: "1px",
47
+ overflow: "hidden"
48
+ }), A = f("div")(({ theme: e }) => ({
49
+ fontSize: e.typography.fontSize - 2,
50
+ color: e.palette.error.main,
51
+ paddingTop: e.spacing(1)
52
+ })), j = class extends t.Component {
53
+ static propTypes = {
54
+ className: n.string,
55
+ mode: n.oneOf([
56
+ "gather",
57
+ "view",
58
+ "evaluate"
59
+ ]),
60
+ choiceMode: n.oneOf(["radio", "checkbox"]),
61
+ keyMode: n.oneOf([
62
+ "numbers",
63
+ "letters",
64
+ "none"
65
+ ]),
66
+ choices: n.array,
67
+ partLabel: n.string,
68
+ prompt: n.string,
69
+ teacherInstructions: n.string,
70
+ session: n.object,
71
+ disabled: n.bool,
72
+ onChoiceChanged: n.func,
73
+ responseCorrect: n.bool,
74
+ correctResponse: n.array,
75
+ choicesLayout: n.oneOf([
76
+ "vertical",
77
+ "grid",
78
+ "horizontal"
79
+ ]),
80
+ gridColumns: n.string,
81
+ alwaysShowCorrect: n.bool,
82
+ animationsDisabled: n.bool,
83
+ language: n.string,
84
+ selectedAnswerBackgroundColor: n.string,
85
+ selectedAnswerStrokeColor: n.string,
86
+ selectedAnswerStrokeWidth: n.string,
87
+ hoverAnswerBackgroundColor: n.string,
88
+ hoverAnswerStrokeColor: n.string,
89
+ hoverAnswerStrokeWidth: n.string,
90
+ onShowCorrectToggle: n.func,
91
+ isSelectionButtonBelow: n.bool,
92
+ minSelections: n.number,
93
+ maxSelections: n.number,
94
+ autoplayAudioEnabled: n.bool,
95
+ customAudioButton: {
96
+ playImage: n.string,
97
+ pauseImage: n.string
98
+ },
99
+ options: n.object,
100
+ baseHeadingLevel: n.number,
101
+ includeSrHeading: n.bool
102
+ };
103
+ constructor(e) {
104
+ super(e), this.state = {
105
+ showCorrect: this.props.options && this.props.alwaysShowCorrect || !1,
106
+ maxSelectionsErrorState: !1
107
+ }, this.onToggle = this.onToggle.bind(this), this.firstInputRef = t.createRef();
108
+ }
109
+ isSelected(e) {
110
+ let t = this.props.session && this.props.session.value;
111
+ return t && t.indexOf && t.indexOf(e) >= 0;
112
+ }
113
+ handleChange = (e) => {
114
+ let { value: t, checked: n } = e.target, { maxSelections: r, onChoiceChanged: i, session: a } = this.props;
115
+ a.value && a.value.length >= r && (this.setState({ maxSelectionsErrorState: n }), n) || i({
116
+ value: t,
117
+ selected: n,
118
+ selector: "Mouse"
119
+ });
120
+ };
121
+ onToggle = () => {
122
+ this.props.mode === "evaluate" && this.setState({ showCorrect: !this.state.showCorrect }, () => {
123
+ this.props.onShowCorrectToggle && this.props.onShowCorrectToggle();
124
+ });
125
+ };
126
+ UNSAFE_componentWillReceiveProps(e) {
127
+ !e.correctResponse && this.state.showCorrect !== !1 && this.setState({ showCorrect: !1 }, () => {
128
+ this.props.onShowCorrectToggle && this.props.onShowCorrectToggle();
129
+ }), e.options && e.alwaysShowCorrect && this.state.showCorrect !== !0 && this.setState({ showCorrect: !0 }, () => {
130
+ this.props.onShowCorrectToggle && this.props.onShowCorrectToggle();
131
+ });
132
+ }
133
+ indexToSymbol(e) {
134
+ return this.props.keyMode === "numbers" ? `${e + 1}` : this.props.keyMode === "letters" ? String.fromCharCode(97 + e).toUpperCase() : "";
135
+ }
136
+ getCorrectness = (e = {}) => {
137
+ let t = e.correct, n = this.isSelected(e.value);
138
+ if (this.state.showCorrect) return t ? "correct" : void 0;
139
+ if (t) return n ? "correct" : "incorrect";
140
+ if (n) return "incorrect";
141
+ };
142
+ getChecked(e) {
143
+ return this.props.options && this.props.alwaysShowCorrect || this.state.showCorrect && this.props.mode === "evaluate" ? e.correct || !1 : this.isSelected(e.value);
144
+ }
145
+ renderHeading() {
146
+ let { mode: e, choiceMode: t, includeSrHeading: n, baseHeadingLevel: r, partLabel: i } = this.props;
147
+ if (!(!i && n !== !1) || e !== "gather") return null;
148
+ let a = r ? Math.min(6, r) : 2;
149
+ return /* @__PURE__ */ c(k.withComponent(`h${a}`), { children: t === "radio" ? "Multiple Choice Question" : "Multiple Select Question" });
150
+ }
151
+ handleGroupFocus = (e) => {
152
+ let t = e.currentTarget, n = document.activeElement;
153
+ t.contains(n) && n !== t || (!e.relatedTarget || t.compareDocumentPosition(e.relatedTarget) & Node.DOCUMENT_POSITION_PRECEDING) && this.firstInputRef?.current && this.firstInputRef.current.focus();
154
+ };
155
+ render() {
156
+ 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 = (() => {
157
+ if (!L) return;
158
+ let e = 1;
159
+ return f && (e += 1), Math.min(6, L + e);
160
+ })(), G = (e) => e && W ? s(e, W) : e, K = /* @__PURE__ */ c(_, {
161
+ tagName: "div",
162
+ className: "prompt",
163
+ defaultClassName: "teacher-instructions",
164
+ prompt: g
165
+ }), q = () => j && M ? j === M ? S.t("translation:multipleChoice:minmaxSelections_equal", {
166
+ lng: x,
167
+ minSelections: j
168
+ }) : S.t("translation:multipleChoice:minmaxSelections_range", {
169
+ lng: x,
170
+ minSelections: j,
171
+ maxSelections: M
172
+ }) : j ? S.t("translation:multipleChoice:minSelections", {
173
+ lng: x,
174
+ minSelections: j
175
+ }) : "", J = this.props.choicesLayout === "grid" ? D : this.props.choicesLayout === "horizontal" ? E : p;
176
+ return /* @__PURE__ */ l(C, {
177
+ id: "main-container",
178
+ className: d(r, "multiple-choice"),
179
+ children: [
180
+ f && /* @__PURE__ */ c(w, {
181
+ as: L ? `h${Math.min(6, L + 1)}` : "h2",
182
+ children: f
183
+ }),
184
+ this.renderHeading(),
185
+ g && /* @__PURE__ */ c(T, { children: b ? K : /* @__PURE__ */ c(v, {
186
+ labels: {
187
+ hidden: "Show Teacher Instructions",
188
+ visible: "Hide Teacher Instructions"
189
+ },
190
+ children: K
191
+ }) }),
192
+ /* @__PURE__ */ l(O, {
193
+ tabIndex: 0,
194
+ onFocus: this.handleGroupFocus,
195
+ role: a === "radio" ? "radiogroup" : "group",
196
+ children: [
197
+ /* @__PURE__ */ c(_, {
198
+ className: "prompt",
199
+ defaultClassName: "prompt",
200
+ prompt: G(m),
201
+ tagName: "legend",
202
+ autoplayAudioEnabled: N,
203
+ customAudioButton: F
204
+ }),
205
+ !(I && y) && /* @__PURE__ */ c(u, {
206
+ show: V,
207
+ toggled: R,
208
+ onToggle: this.onToggle.bind(this),
209
+ language: x
210
+ }),
211
+ /* @__PURE__ */ c(J, {
212
+ style: H,
213
+ children: i.map((t, r) => /* @__PURE__ */ c(e, {
214
+ autoFocusRef: r === 0 ? this.firstInputRef : null,
215
+ choicesLayout: this.props.choicesLayout,
216
+ selectedAnswerBackgroundColor: this.props.selectedAnswerBackgroundColor,
217
+ selectedAnswerStrokeColor: this.props.selectedAnswerStrokeColor,
218
+ selectedAnswerStrokeWidth: this.props.selectedAnswerStrokeWidth,
219
+ hoverAnswerBackgroundColor: this.props.hoverAnswerBackgroundColor,
220
+ hoverAnswerStrokeColor: this.props.hoverAnswerStrokeColor,
221
+ hoverAnswerStrokeWidth: this.props.hoverAnswerStrokeWidth,
222
+ gridColumns: o,
223
+ choice: t,
224
+ index: r,
225
+ choicesLength: i.length,
226
+ showCorrect: R,
227
+ isEvaluateMode: B,
228
+ choiceMode: a,
229
+ disabled: n,
230
+ tagName: f ? `group-${f}` : "group",
231
+ onChoiceChanged: this.handleChange,
232
+ hideTick: t.hideTick,
233
+ checked: this.getChecked(t),
234
+ correctness: B ? this.getCorrectness(t) : void 0,
235
+ displayKey: this.indexToSymbol(r),
236
+ isSelectionButtonBelow: k
237
+ }, `choice-${r}`))
238
+ })
239
+ ]
240
+ }),
241
+ a === "checkbox" && U < j && /* @__PURE__ */ c(A, { children: q() }),
242
+ a === "checkbox" && z && /* @__PURE__ */ c(A, { children: S.t(`translation:multipleChoice:maxSelections_${M === 1 ? "one" : "other"}`, {
243
+ lng: x,
244
+ maxSelections: M
245
+ }) })
246
+ ]
247
+ });
248
+ }
249
+ };
250
+ j.defaultProps = { session: { value: [] } };
251
+ //#endregion
252
+ export { j as default };
@@ -0,0 +1,11 @@
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;
11
+ //# sourceMappingURL=session-updater.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-updater.d.ts","sourceRoot":"","sources":["../../src/delivery/session-updater.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,wBAAgB,kBAAkB,CAAC,OAAO,KAAA,EAAE,UAAU,KAAA,EAAE,IAAI,KAAA,QAoB3D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,KAAA,EAAE,QAAQ,KAAA,QAQtD"}
@@ -0,0 +1,9 @@
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 };
@@ -0,0 +1,2 @@
1
+ export { default } from './delivery/index.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,9 @@
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;
9
+ //# sourceMappingURL=index.iife.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.iife.d.ts","sourceRoot":"","sources":["../src/index.iife.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,OAAO,MAAM,YAAY,CAAC;AAQjC,eAAe,OAAO,CAAC"}