@citolab/qti-components 7.3.22 → 7.4.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 (346) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +5485 -1
  3. package/custom-elements.json +29837 -0
  4. package/dist/chunks/chunk-6K4ROGDD.js +364 -0
  5. package/dist/chunks/chunk-6K4ROGDD.js.map +1 -0
  6. package/dist/chunks/chunk-GUDRSXIP.js +189 -0
  7. package/dist/chunks/chunk-GUDRSXIP.js.map +1 -0
  8. package/dist/chunks/{chunk-WFUXZ4UT.js → chunk-JDY5GL7E.js} +13 -1
  9. package/dist/chunks/{chunk-WFUXZ4UT.js.map → chunk-JDY5GL7E.js.map} +1 -1
  10. package/dist/chunks/{chunk-LF6SO3JU.js → chunk-LN74Z5QM.js} +653 -450
  11. package/dist/chunks/chunk-LN74Z5QM.js.map +1 -0
  12. package/dist/chunks/{chunk-ELDMXTUQ.js → chunk-O5N4DCU6.js} +7 -2
  13. package/dist/chunks/chunk-O5N4DCU6.js.map +1 -0
  14. package/dist/chunks/chunk-TJ6ZOT7A.js +2235 -0
  15. package/dist/chunks/chunk-TJ6ZOT7A.js.map +1 -0
  16. package/dist/computed-item.context-DpK-sS0T.d.ts +19 -0
  17. package/dist/{exports/config.context.d.ts → config.context-CmQ9L62n.d.ts} +1 -4
  18. package/dist/custom-elements.json +29837 -0
  19. package/dist/index.d.ts +8 -39
  20. package/dist/index.js +34 -104
  21. package/{cdn/chunks/chunk-5TDBMEY5.js → dist/item.css} +7 -24
  22. package/dist/qti-assessment-item-D77dJ1Ot.d.ts +104 -0
  23. package/dist/qti-components/index.d.ts +1238 -19
  24. package/dist/qti-components/index.js +6 -14
  25. package/dist/qti-components-jsx.d.ts +4463 -0
  26. package/dist/qti-item/index.d.ts +113 -0
  27. package/dist/qti-item/index.js +16 -0
  28. package/dist/qti-loader/index.d.ts +2 -6
  29. package/dist/qti-loader/index.js +24 -5
  30. package/dist/qti-loader/index.js.map +1 -1
  31. package/dist/qti-test/index.d.ts +593 -0
  32. package/dist/qti-test/index.js +62 -0
  33. package/dist/qti-transformers/index.d.ts +38 -2
  34. package/dist/qti-transformers/index.js +1 -2
  35. package/dist/test.context-L609DNAz.d.ts +58 -0
  36. package/dist/variables-Vgyr6yyW.d.ts +58 -0
  37. package/dist/vscode.css-custom-data.json +11 -0
  38. package/dist/vscode.html-custom-data.json +1135 -0
  39. package/package.json +74 -113
  40. package/cdn/chunks/chunk-2BSPQRNR.js +0 -6
  41. package/cdn/chunks/chunk-3CVBBZDT.js +0 -17
  42. package/cdn/chunks/chunk-3IBGLVHA.js +0 -1
  43. package/cdn/chunks/chunk-3YQMAZEO.js +0 -29
  44. package/cdn/chunks/chunk-5UQLGV7F.js +0 -5
  45. package/cdn/chunks/chunk-5WLHU3FH.js +0 -8
  46. package/cdn/chunks/chunk-6SGFGN34.js +0 -8
  47. package/cdn/chunks/chunk-6XVY32RS.js +0 -1
  48. package/cdn/chunks/chunk-7ME56ODO.js +0 -1
  49. package/cdn/chunks/chunk-CZDMOYYF.js +0 -1
  50. package/cdn/chunks/chunk-DNBBQ7LY.js +0 -1
  51. package/cdn/chunks/chunk-DP5FVJRS.js +0 -21
  52. package/cdn/chunks/chunk-E6IOJ4MV.js +0 -23
  53. package/cdn/chunks/chunk-G76Y52EL.js +0 -1471
  54. package/cdn/chunks/chunk-HCXHHI6V.js +0 -18
  55. package/cdn/chunks/chunk-HDMF4QZO.js +0 -48
  56. package/cdn/chunks/chunk-HKWYQB5Z.js +0 -37
  57. package/cdn/chunks/chunk-J5P2GBPV.js +0 -1
  58. package/cdn/chunks/chunk-KWPDTFYH.js +0 -1
  59. package/cdn/chunks/chunk-LIUOA3YV.js +0 -1
  60. package/cdn/chunks/chunk-LO2NM3CE.js +0 -1
  61. package/cdn/chunks/chunk-MD33BNWM.js +0 -1
  62. package/cdn/chunks/chunk-MRQ46JRY.js +0 -8
  63. package/cdn/chunks/chunk-NJP4VZB3.js +0 -8
  64. package/cdn/chunks/chunk-O4RAJ3LM.js +0 -25
  65. package/cdn/chunks/chunk-OSLUHYFD.js +0 -8
  66. package/cdn/chunks/chunk-P6SSTAJ2.js +0 -1
  67. package/cdn/chunks/chunk-PP62N3C4.js +0 -8
  68. package/cdn/chunks/chunk-PU7OABT3.js +0 -1
  69. package/cdn/chunks/chunk-PUI3LIFH.js +0 -0
  70. package/cdn/chunks/chunk-QBAXWCYQ.js +0 -5
  71. package/cdn/chunks/chunk-QEFO63QX.js +0 -8
  72. package/cdn/chunks/chunk-QQCGUVEV.js +0 -1
  73. package/cdn/chunks/chunk-QQR6POPY.js +0 -1
  74. package/cdn/chunks/chunk-RGNFAPWY.js +0 -2
  75. package/cdn/chunks/chunk-S5QDLZ6J.js +0 -1
  76. package/cdn/chunks/chunk-SEM2PEP6.js +0 -5
  77. package/cdn/chunks/chunk-SVVO2SFS.js +0 -1
  78. package/cdn/chunks/chunk-TCHROQU3.js +0 -1
  79. package/cdn/chunks/chunk-UMDZKG6K.js +0 -1
  80. package/cdn/chunks/chunk-VEG7LKS3.js +0 -48
  81. package/cdn/chunks/chunk-WCCTDLQ4.js +0 -8
  82. package/cdn/chunks/chunk-X4FA36TC.js +0 -1
  83. package/cdn/chunks/chunk-XJ2CFTZP.js +0 -1
  84. package/cdn/chunks/chunk-XUJ7TXHW.js +0 -1
  85. package/cdn/chunks/chunk-YCBNF5QU.js +0 -17
  86. package/cdn/chunks/chunk-YHLQ2JQ2.js +0 -1
  87. package/cdn/chunks/chunk-ZPCQH3EY.js +0 -10
  88. package/cdn/exports/computed-item.context.js +0 -1
  89. package/cdn/exports/computed.context.js +0 -1
  90. package/cdn/exports/config.context.js +0 -1
  91. package/cdn/exports/expression-result.js +0 -0
  92. package/cdn/exports/interaction.interface.js +0 -0
  93. package/cdn/exports/interaction.js +0 -1
  94. package/cdn/exports/item.context.js +0 -1
  95. package/cdn/exports/qti-assessment-item.context.js +0 -1
  96. package/cdn/exports/qti-condition-expression.js +0 -1
  97. package/cdn/exports/qti-expression.js +0 -1
  98. package/cdn/exports/qti-test.js +0 -0
  99. package/cdn/exports/qti.context.js +0 -1
  100. package/cdn/exports/session.context.js +0 -1
  101. package/cdn/exports/test.context.js +0 -1
  102. package/cdn/exports/variables.js +0 -0
  103. package/cdn/qti-components/index.js +0 -1
  104. package/cdn/qti-item/components/item-container.js +0 -1
  105. package/cdn/qti-item/components/item-correct-response-mode.js +0 -10
  106. package/cdn/qti-item/components/item-show-candidate-correction.js +0 -8
  107. package/cdn/qti-item/components/item-show-correct-response.js +0 -1
  108. package/cdn/qti-item/components/print-item-variables.js +0 -1
  109. package/cdn/qti-item/components/styles.js +0 -1
  110. package/cdn/qti-item/core/index.js +0 -1
  111. package/cdn/qti-loader/index.js +0 -1
  112. package/cdn/qti-test/components/index.js +0 -1
  113. package/cdn/qti-test/components/styles.js +0 -1
  114. package/cdn/qti-test/components/test-check-item.js +0 -1
  115. package/cdn/qti-test/components/test-container.js +0 -1
  116. package/cdn/qti-test/components/test-end-attempt.js +0 -1
  117. package/cdn/qti-test/components/test-item-link.js +0 -1
  118. package/cdn/qti-test/components/test-navigation.js +0 -1
  119. package/cdn/qti-test/components/test-next.js +0 -1
  120. package/cdn/qti-test/components/test-paging-buttons-stamp.js +0 -1
  121. package/cdn/qti-test/components/test-prev.js +0 -1
  122. package/cdn/qti-test/components/test-print-context.js +0 -1
  123. package/cdn/qti-test/components/test-print-item-variables.js +0 -1
  124. package/cdn/qti-test/components/test-scoring-buttons.js +0 -1
  125. package/cdn/qti-test/components/test-scoring-feedback.js +0 -1
  126. package/cdn/qti-test/components/test-section-buttons-stamp.js +0 -1
  127. package/cdn/qti-test/components/test-section-link.js +0 -1
  128. package/cdn/qti-test/components/test-show-correct-response.js +0 -1
  129. package/cdn/qti-test/components/test-stamp.js +0 -1
  130. package/cdn/qti-test/components/test-view-toggle.js +0 -1
  131. package/cdn/qti-test/components/test-view.js +0 -1
  132. package/cdn/qti-test/core/index.js +0 -1
  133. package/cdn/qti-transformers/index.js +0 -1
  134. package/dist/chunks/chunk-22IRJWWY.js +0 -10
  135. package/dist/chunks/chunk-22IRJWWY.js.map +0 -1
  136. package/dist/chunks/chunk-36G5MQKR.js +0 -85
  137. package/dist/chunks/chunk-36G5MQKR.js.map +0 -1
  138. package/dist/chunks/chunk-4OGJBG35.js +0 -8
  139. package/dist/chunks/chunk-4OGJBG35.js.map +0 -1
  140. package/dist/chunks/chunk-5KCXO2RP.js +0 -36
  141. package/dist/chunks/chunk-5KCXO2RP.js.map +0 -1
  142. package/dist/chunks/chunk-5ZHHNEDA.js +0 -30
  143. package/dist/chunks/chunk-5ZHHNEDA.js.map +0 -1
  144. package/dist/chunks/chunk-7K44TDQO.js +0 -91
  145. package/dist/chunks/chunk-7K44TDQO.js.map +0 -1
  146. package/dist/chunks/chunk-7OMJMXHK.js +0 -50
  147. package/dist/chunks/chunk-7OMJMXHK.js.map +0 -1
  148. package/dist/chunks/chunk-AZIKAG7K.js +0 -8
  149. package/dist/chunks/chunk-AZIKAG7K.js.map +0 -1
  150. package/dist/chunks/chunk-BLBSZDQ4.js +0 -52
  151. package/dist/chunks/chunk-BLBSZDQ4.js.map +0 -1
  152. package/dist/chunks/chunk-CJADUWEC.js +0 -10
  153. package/dist/chunks/chunk-CJADUWEC.js.map +0 -1
  154. package/dist/chunks/chunk-CP34TICQ.js +0 -45
  155. package/dist/chunks/chunk-CP34TICQ.js.map +0 -1
  156. package/dist/chunks/chunk-CTESMSQO.js +0 -56
  157. package/dist/chunks/chunk-CTESMSQO.js.map +0 -1
  158. package/dist/chunks/chunk-DZAMXOSC.js +0 -30
  159. package/dist/chunks/chunk-DZAMXOSC.js.map +0 -1
  160. package/dist/chunks/chunk-E6V3JHVT.js +0 -31
  161. package/dist/chunks/chunk-E6V3JHVT.js.map +0 -1
  162. package/dist/chunks/chunk-EJZQSOHU.js +0 -85
  163. package/dist/chunks/chunk-EJZQSOHU.js.map +0 -1
  164. package/dist/chunks/chunk-ELDMXTUQ.js.map +0 -1
  165. package/dist/chunks/chunk-EMVOKXSA.js +0 -84
  166. package/dist/chunks/chunk-EMVOKXSA.js.map +0 -1
  167. package/dist/chunks/chunk-ERYHQVOT.js +0 -8
  168. package/dist/chunks/chunk-ERYHQVOT.js.map +0 -1
  169. package/dist/chunks/chunk-ETLOKJAG.js +0 -94
  170. package/dist/chunks/chunk-ETLOKJAG.js.map +0 -1
  171. package/dist/chunks/chunk-FL72PF4D.js +0 -19
  172. package/dist/chunks/chunk-FL72PF4D.js.map +0 -1
  173. package/dist/chunks/chunk-GAHXUFMQ.js +0 -93
  174. package/dist/chunks/chunk-GAHXUFMQ.js.map +0 -1
  175. package/dist/chunks/chunk-H2JE6IVU.js +0 -15
  176. package/dist/chunks/chunk-H2JE6IVU.js.map +0 -1
  177. package/dist/chunks/chunk-H6KHXSIO.js +0 -8
  178. package/dist/chunks/chunk-H6KHXSIO.js.map +0 -1
  179. package/dist/chunks/chunk-HFAUM56X.js +0 -208
  180. package/dist/chunks/chunk-HFAUM56X.js.map +0 -1
  181. package/dist/chunks/chunk-JQ6HWGRY.js +0 -22
  182. package/dist/chunks/chunk-JQ6HWGRY.js.map +0 -1
  183. package/dist/chunks/chunk-KG5Z2CKO.js +0 -86
  184. package/dist/chunks/chunk-KG5Z2CKO.js.map +0 -1
  185. package/dist/chunks/chunk-KSXNC564.js +0 -43
  186. package/dist/chunks/chunk-KSXNC564.js.map +0 -1
  187. package/dist/chunks/chunk-LF6SO3JU.js.map +0 -1
  188. package/dist/chunks/chunk-NJNQOQUU.js +0 -8
  189. package/dist/chunks/chunk-NJNQOQUU.js.map +0 -1
  190. package/dist/chunks/chunk-ODHS7HDB.js +0 -94
  191. package/dist/chunks/chunk-ODHS7HDB.js.map +0 -1
  192. package/dist/chunks/chunk-QCB6P7DH.js +0 -146
  193. package/dist/chunks/chunk-QCB6P7DH.js.map +0 -1
  194. package/dist/chunks/chunk-QU7KR7VX.js +0 -367
  195. package/dist/chunks/chunk-QU7KR7VX.js.map +0 -1
  196. package/dist/chunks/chunk-TU6COU44.js +0 -82
  197. package/dist/chunks/chunk-TU6COU44.js.map +0 -1
  198. package/dist/chunks/chunk-TUKEQ36K.js +0 -60
  199. package/dist/chunks/chunk-TUKEQ36K.js.map +0 -1
  200. package/dist/chunks/chunk-TWYN56XO.js +0 -92
  201. package/dist/chunks/chunk-TWYN56XO.js.map +0 -1
  202. package/dist/chunks/chunk-UHQVQBCL.js +0 -89
  203. package/dist/chunks/chunk-UHQVQBCL.js.map +0 -1
  204. package/dist/chunks/chunk-WFFIUFJJ.js +0 -28
  205. package/dist/chunks/chunk-WFFIUFJJ.js.map +0 -1
  206. package/dist/chunks/chunk-WN6TJQI2.js +0 -103
  207. package/dist/chunks/chunk-WN6TJQI2.js.map +0 -1
  208. package/dist/chunks/chunk-WPEFNKMC.js +0 -923
  209. package/dist/chunks/chunk-WPEFNKMC.js.map +0 -1
  210. package/dist/chunks/chunk-YPMZLHGG.js +0 -52
  211. package/dist/chunks/chunk-YPMZLHGG.js.map +0 -1
  212. package/dist/chunks/chunk-YWEWSQJR.js +0 -40
  213. package/dist/chunks/chunk-YWEWSQJR.js.map +0 -1
  214. package/dist/chunks/chunk-ZGSNDSK3.js +0 -1
  215. package/dist/chunks/chunk-ZGSNDSK3.js.map +0 -1
  216. package/dist/exports/computed-item.context.d.ts +0 -29
  217. package/dist/exports/computed-item.context.js +0 -8
  218. package/dist/exports/computed-item.context.js.map +0 -1
  219. package/dist/exports/computed.context.d.ts +0 -42
  220. package/dist/exports/computed.context.js +0 -8
  221. package/dist/exports/computed.context.js.map +0 -1
  222. package/dist/exports/config.context.js +0 -8
  223. package/dist/exports/config.context.js.map +0 -1
  224. package/dist/exports/expression-result.d.ts +0 -19
  225. package/dist/exports/expression-result.js +0 -1
  226. package/dist/exports/expression-result.js.map +0 -1
  227. package/dist/exports/interaction.d.ts +0 -8
  228. package/dist/exports/interaction.interface.d.ts +0 -13
  229. package/dist/exports/interaction.interface.js +0 -1
  230. package/dist/exports/interaction.interface.js.map +0 -1
  231. package/dist/exports/interaction.js +0 -12
  232. package/dist/exports/interaction.js.map +0 -1
  233. package/dist/exports/item.context.d.ts +0 -8
  234. package/dist/exports/item.context.js +0 -8
  235. package/dist/exports/item.context.js.map +0 -1
  236. package/dist/exports/qti-assessment-item.context.d.ts +0 -14
  237. package/dist/exports/qti-assessment-item.context.js +0 -8
  238. package/dist/exports/qti-assessment-item.context.js.map +0 -1
  239. package/dist/exports/qti-condition-expression.d.ts +0 -15
  240. package/dist/exports/qti-condition-expression.js +0 -11
  241. package/dist/exports/qti-condition-expression.js.map +0 -1
  242. package/dist/exports/qti-expression.d.ts +0 -8
  243. package/dist/exports/qti-expression.js +0 -10
  244. package/dist/exports/qti-expression.js.map +0 -1
  245. package/dist/exports/qti-test.d.ts +0 -40
  246. package/dist/exports/qti-test.js +0 -1
  247. package/dist/exports/qti-test.js.map +0 -1
  248. package/dist/exports/qti.context.d.ts +0 -14
  249. package/dist/exports/qti.context.js +0 -8
  250. package/dist/exports/qti.context.js.map +0 -1
  251. package/dist/exports/session.context.d.ts +0 -26
  252. package/dist/exports/session.context.js +0 -10
  253. package/dist/exports/session.context.js.map +0 -1
  254. package/dist/exports/test.context.d.ts +0 -21
  255. package/dist/exports/test.context.js +0 -10
  256. package/dist/exports/test.context.js.map +0 -1
  257. package/dist/exports/variables.d.ts +0 -8
  258. package/dist/exports/variables.js +0 -1
  259. package/dist/exports/variables.js.map +0 -1
  260. package/dist/qti-item/components/item-container.d.ts +0 -40
  261. package/dist/qti-item/components/item-container.js +0 -11
  262. package/dist/qti-item/components/item-container.js.map +0 -1
  263. package/dist/qti-item/components/item-correct-response-mode.d.ts +0 -17
  264. package/dist/qti-item/components/item-correct-response-mode.js +0 -62
  265. package/dist/qti-item/components/item-correct-response-mode.js.map +0 -1
  266. package/dist/qti-item/components/item-show-candidate-correction.d.ts +0 -34
  267. package/dist/qti-item/components/item-show-candidate-correction.js +0 -88
  268. package/dist/qti-item/components/item-show-candidate-correction.js.map +0 -1
  269. package/dist/qti-item/components/item-show-correct-response.d.ts +0 -33
  270. package/dist/qti-item/components/item-show-correct-response.js +0 -10
  271. package/dist/qti-item/components/item-show-correct-response.js.map +0 -1
  272. package/dist/qti-item/components/print-item-variables.d.ts +0 -23
  273. package/dist/qti-item/components/print-item-variables.js +0 -9
  274. package/dist/qti-item/components/print-item-variables.js.map +0 -1
  275. package/dist/qti-item/components/styles.d.ts +0 -8
  276. package/dist/qti-item/components/styles.js +0 -14
  277. package/dist/qti-item/components/styles.js.map +0 -1
  278. package/dist/qti-item/core/index.d.ts +0 -51
  279. package/dist/qti-item/core/index.js +0 -26
  280. package/dist/qti-response-declaration-DKr08ANy.d.ts +0 -1397
  281. package/dist/qti-test/components/index.d.ts +0 -33
  282. package/dist/qti-test/components/index.js +0 -87
  283. package/dist/qti-test/components/styles.d.ts +0 -8
  284. package/dist/qti-test/components/styles.js +0 -14
  285. package/dist/qti-test/components/styles.js.map +0 -1
  286. package/dist/qti-test/components/test-check-item.d.ts +0 -16
  287. package/dist/qti-test/components/test-check-item.js +0 -9
  288. package/dist/qti-test/components/test-check-item.js.map +0 -1
  289. package/dist/qti-test/components/test-container.d.ts +0 -39
  290. package/dist/qti-test/components/test-container.js +0 -11
  291. package/dist/qti-test/components/test-container.js.map +0 -1
  292. package/dist/qti-test/components/test-end-attempt.d.ts +0 -16
  293. package/dist/qti-test/components/test-end-attempt.js +0 -9
  294. package/dist/qti-test/components/test-end-attempt.js.map +0 -1
  295. package/dist/qti-test/components/test-item-link.d.ts +0 -18
  296. package/dist/qti-test/components/test-item-link.js +0 -9
  297. package/dist/qti-test/components/test-item-link.js.map +0 -1
  298. package/dist/qti-test/components/test-navigation.d.ts +0 -73
  299. package/dist/qti-test/components/test-navigation.js +0 -13
  300. package/dist/qti-test/components/test-navigation.js.map +0 -1
  301. package/dist/qti-test/components/test-next.d.ts +0 -48
  302. package/dist/qti-test/components/test-next.js +0 -12
  303. package/dist/qti-test/components/test-next.js.map +0 -1
  304. package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +0 -23
  305. package/dist/qti-test/components/test-paging-buttons-stamp.js +0 -9
  306. package/dist/qti-test/components/test-paging-buttons-stamp.js.map +0 -1
  307. package/dist/qti-test/components/test-prev.d.ts +0 -46
  308. package/dist/qti-test/components/test-prev.js +0 -12
  309. package/dist/qti-test/components/test-prev.js.map +0 -1
  310. package/dist/qti-test/components/test-print-context.d.ts +0 -25
  311. package/dist/qti-test/components/test-print-context.js +0 -9
  312. package/dist/qti-test/components/test-print-context.js.map +0 -1
  313. package/dist/qti-test/components/test-print-item-variables.d.ts +0 -27
  314. package/dist/qti-test/components/test-print-item-variables.js +0 -9
  315. package/dist/qti-test/components/test-print-item-variables.js.map +0 -1
  316. package/dist/qti-test/components/test-scoring-buttons.d.ts +0 -32
  317. package/dist/qti-test/components/test-scoring-buttons.js +0 -9
  318. package/dist/qti-test/components/test-scoring-buttons.js.map +0 -1
  319. package/dist/qti-test/components/test-scoring-feedback.d.ts +0 -27
  320. package/dist/qti-test/components/test-scoring-feedback.js +0 -9
  321. package/dist/qti-test/components/test-scoring-feedback.js.map +0 -1
  322. package/dist/qti-test/components/test-section-buttons-stamp.d.ts +0 -23
  323. package/dist/qti-test/components/test-section-buttons-stamp.js +0 -9
  324. package/dist/qti-test/components/test-section-buttons-stamp.js.map +0 -1
  325. package/dist/qti-test/components/test-section-link.d.ts +0 -18
  326. package/dist/qti-test/components/test-section-link.js +0 -9
  327. package/dist/qti-test/components/test-section-link.js.map +0 -1
  328. package/dist/qti-test/components/test-show-correct-response.d.ts +0 -39
  329. package/dist/qti-test/components/test-show-correct-response.js +0 -10
  330. package/dist/qti-test/components/test-show-correct-response.js.map +0 -1
  331. package/dist/qti-test/components/test-stamp.d.ts +0 -31
  332. package/dist/qti-test/components/test-stamp.js +0 -9
  333. package/dist/qti-test/components/test-stamp.js.map +0 -1
  334. package/dist/qti-test/components/test-view-toggle.d.ts +0 -19
  335. package/dist/qti-test/components/test-view-toggle.js +0 -9
  336. package/dist/qti-test/components/test-view-toggle.js.map +0 -1
  337. package/dist/qti-test/components/test-view.d.ts +0 -24
  338. package/dist/qti-test/components/test-view.js +0 -10
  339. package/dist/qti-test/components/test-view.js.map +0 -1
  340. package/dist/qti-test/core/index.d.ts +0 -105
  341. package/dist/qti-test/core/index.js +0 -36
  342. package/dist/qti-test/core/index.js.map +0 -1
  343. package/dist/qti-test-feedback-CZsbp6z4.d.ts +0 -91
  344. package/dist/qti-transform-item-C9WtMeDR.d.ts +0 -39
  345. /package/dist/qti-item/{core/index.js.map → index.js.map} +0 -0
  346. /package/dist/qti-test/{components/index.js.map → index.js.map} +0 -0
@@ -0,0 +1,364 @@
1
+ import {
2
+ item_default
3
+ } from "./chunk-LSEB52SP.js";
4
+ import {
5
+ configContext,
6
+ watch
7
+ } from "./chunk-O5N4DCU6.js";
8
+ import {
9
+ __decorateClass,
10
+ qtiTransformItem
11
+ } from "./chunk-JDY5GL7E.js";
12
+
13
+ // src/lib/qti-item/components/item-container.ts
14
+ import { LitElement, html } from "lit";
15
+ import { customElement, property, state } from "lit/decorators.js";
16
+ import { until } from "lit/directives/until.js";
17
+ var ItemContainer = class extends LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.itemURL = null;
21
+ this.itemDoc = null;
22
+ this.itemXML = null;
23
+ /** Template content if provided */
24
+ this.templateContent = null;
25
+ }
26
+ async handleItemURLChange() {
27
+ if (!this.itemURL) return;
28
+ try {
29
+ const { promise: api } = await qtiTransformItem().load(this.itemURL);
30
+ this.itemDoc = (await api).htmlDoc();
31
+ } catch (error) {
32
+ console.error("Error loading or parsing XML:", error);
33
+ }
34
+ }
35
+ handleItemXMLChange() {
36
+ if (!this.itemXML) return;
37
+ try {
38
+ this.itemDoc = qtiTransformItem().parse(this.itemXML).htmlDoc();
39
+ } catch (error) {
40
+ console.error("Error parsing XML:", error);
41
+ }
42
+ }
43
+ async connectedCallback() {
44
+ super.connectedCallback();
45
+ this.initializeTemplateContent();
46
+ this.applyStyles();
47
+ if (this.itemURL) {
48
+ this.handleItemURLChange();
49
+ }
50
+ if (this.itemXML) {
51
+ this.handleItemXMLChange();
52
+ }
53
+ }
54
+ initializeTemplateContent() {
55
+ const template = this.querySelector("template");
56
+ this.templateContent = template ? template.content : html``;
57
+ }
58
+ applyStyles() {
59
+ const sheet = new CSSStyleSheet();
60
+ sheet.replaceSync(item_default);
61
+ this.shadowRoot.adoptedStyleSheets = [sheet];
62
+ }
63
+ render() {
64
+ return html`
65
+ ${this.templateContent}
66
+ <slot></slot>
67
+ ${until(this.itemDoc, html`<span>Loading...</span>`)}
68
+ `;
69
+ }
70
+ };
71
+ __decorateClass([
72
+ property({ type: String, attribute: "item-url" })
73
+ ], ItemContainer.prototype, "itemURL", 2);
74
+ __decorateClass([
75
+ state()
76
+ ], ItemContainer.prototype, "itemDoc", 2);
77
+ __decorateClass([
78
+ state()
79
+ ], ItemContainer.prototype, "itemXML", 2);
80
+ __decorateClass([
81
+ watch("itemURL", { waitUntilFirstUpdate: true })
82
+ ], ItemContainer.prototype, "handleItemURLChange", 1);
83
+ __decorateClass([
84
+ watch("itemXML", { waitUntilFirstUpdate: true })
85
+ ], ItemContainer.prototype, "handleItemXMLChange", 1);
86
+ ItemContainer = __decorateClass([
87
+ customElement("item-container")
88
+ ], ItemContainer);
89
+
90
+ // src/lib/qti-item/components/print-item-variables.ts
91
+ import { consume } from "@lit/context";
92
+ import { css, html as html2, LitElement as LitElement2 } from "lit";
93
+ import { customElement as customElement2 } from "lit/decorators.js";
94
+
95
+ // src/lib/exports/computed-item.context.ts
96
+ import { createContext } from "@lit/context";
97
+ var computedItemContext = createContext(Symbol("computedItemContext"));
98
+
99
+ // src/lib/qti-item/components/print-item-variables.ts
100
+ var PrintItemVariables = class extends LitElement2 {
101
+ render() {
102
+ const activeItem = this.computedContext;
103
+ if (!activeItem || !activeItem.variables) return html2``;
104
+ const responseVariables = activeItem.variables.filter((v) => v.type === "response");
105
+ const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
106
+ const renderTable = (variables, title) => html2`
107
+ <h3>${title}</h3>
108
+ <table>
109
+ <thead>
110
+ <tr>
111
+ <th>Identifier</th>
112
+ <th>Value</th>
113
+ <th>Cardinality</th>
114
+ <th>Base Type</th>
115
+ <th>Correct Response / Mappings</th>
116
+ </tr>
117
+ </thead>
118
+ <tbody>
119
+ ${variables.map((v) => {
120
+ const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
121
+ const mapEntries = v.mapping?.mapEntries?.map((m) => `${m.mapKey}=${m.mappedValue}pt`).join(", ") || "";
122
+ const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m) => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(", ") || "";
123
+ return html2`
124
+ <tr>
125
+ <td>${v.identifier}</td>
126
+ <td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
127
+ <td>${v.cardinality}</td>
128
+ <td>${v.baseType}</td>
129
+ <td>${correctResponse || mapEntries || areaMapEntries}</td>
130
+ </tr>
131
+ `;
132
+ })}
133
+ </tbody>
134
+ </table>
135
+ `;
136
+ return html2`
137
+ ${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
138
+ `;
139
+ }
140
+ };
141
+ PrintItemVariables.styles = css`
142
+ table {
143
+ width: 100%;
144
+ border-collapse: collapse;
145
+ margin: 20px 0;
146
+ font-size: 14px;
147
+ text-align: left;
148
+ }
149
+ th,
150
+ td {
151
+ border: 1px solid #ddd;
152
+ padding: 8px;
153
+ }
154
+ th {
155
+ background-color: #f4f4f4;
156
+ font-weight: bold;
157
+ }
158
+ h3 {
159
+ margin-top: 20px;
160
+ font-size: 16px;
161
+ }
162
+ `;
163
+ __decorateClass([
164
+ consume({ context: computedItemContext, subscribe: true })
165
+ ], PrintItemVariables.prototype, "computedContext", 2);
166
+ PrintItemVariables = __decorateClass([
167
+ customElement2("print-item-variables")
168
+ ], PrintItemVariables);
169
+
170
+ // src/lib/qti-item/components/item-show-correct-response.ts
171
+ import { css as css3, html as html3, LitElement as LitElement3 } from "lit";
172
+ import { customElement as customElement3, property as property2 } from "lit/decorators.js";
173
+ import { consume as consume2 } from "@lit/context";
174
+
175
+ // src/lib/qti-item/components/styles.ts
176
+ import { css as css2 } from "lit";
177
+ var form = css2`
178
+ display: inline-flex;
179
+ align-items: center;
180
+ cursor: pointer;
181
+ padding: 0.5rem 1rem;
182
+ border-radius: 0.25rem;
183
+ user-select: none;
184
+ `;
185
+ var btn = css2`
186
+ background-color: lightgray;
187
+ ${form};
188
+ `;
189
+ var dis = css2`
190
+ cursor: not-allowed;
191
+ opacity: 0.8;
192
+ `;
193
+ var ind = css2`
194
+ ${form};
195
+ border: 1px solid gray;
196
+ `;
197
+
198
+ // src/lib/qti-item/components/item-show-correct-response.ts
199
+ var ItemShowCorrectResponse = class extends LitElement3 {
200
+ constructor() {
201
+ super(...arguments);
202
+ this.shown = false;
203
+ this.disabled = false;
204
+ this.showCorrectText = "Show correct response";
205
+ this.hideCorrectText = "Hide correct response";
206
+ this.noCorrectResponseText = "No correct response specified";
207
+ this._hasCorrectResponse = false;
208
+ // correct response is removed on certain point
209
+ this._previousActiveItem = "";
210
+ }
211
+ // Store previous active item reference
212
+ updated() {
213
+ if (!this._hasCorrectResponse || this._previousActiveItem !== this.computedContext?.identifier) {
214
+ this._previousActiveItem = this.computedContext?.identifier;
215
+ const containsCorrectResponse = !!this.computedContext?.variables.some((v) => v["correctResponse"]);
216
+ const containsMapping = !!this.computedContext?.variables.some((v) => {
217
+ return v["mapping"]?.mapEntries?.length > 0 || v["areaMapping"]?.areaMapEntries?.length > 0;
218
+ });
219
+ this._hasCorrectResponse = containsCorrectResponse || containsMapping;
220
+ }
221
+ this.disabled = !this._hasCorrectResponse;
222
+ }
223
+ _toggleState() {
224
+ if (this.disabled) return;
225
+ this.dispatchEvent(
226
+ new CustomEvent("item-show-correct-response", {
227
+ detail: !this.shown,
228
+ bubbles: true
229
+ })
230
+ );
231
+ }
232
+ _getDisplayedText() {
233
+ return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;
234
+ }
235
+ render() {
236
+ return html3` <div @click="${this._toggleState}">${this._getDisplayedText()}</div> `;
237
+ }
238
+ };
239
+ ItemShowCorrectResponse.styles = css3`
240
+ :host {
241
+ ${btn};
242
+ }
243
+ :host([disabled]) {
244
+ ${dis};
245
+ }
246
+ `;
247
+ __decorateClass([
248
+ consume2({ context: computedItemContext, subscribe: true })
249
+ ], ItemShowCorrectResponse.prototype, "computedContext", 2);
250
+ __decorateClass([
251
+ property2({ type: Boolean, reflect: true })
252
+ ], ItemShowCorrectResponse.prototype, "shown", 2);
253
+ __decorateClass([
254
+ property2({ type: Boolean, reflect: true })
255
+ ], ItemShowCorrectResponse.prototype, "disabled", 2);
256
+ __decorateClass([
257
+ property2({ type: String })
258
+ ], ItemShowCorrectResponse.prototype, "showCorrectText", 2);
259
+ __decorateClass([
260
+ property2({ type: String })
261
+ ], ItemShowCorrectResponse.prototype, "hideCorrectText", 2);
262
+ __decorateClass([
263
+ property2({ type: String })
264
+ ], ItemShowCorrectResponse.prototype, "noCorrectResponseText", 2);
265
+ ItemShowCorrectResponse = __decorateClass([
266
+ customElement3("item-show-correct-response")
267
+ ], ItemShowCorrectResponse);
268
+
269
+ // src/lib/qti-item/core/qti-item.ts
270
+ import { provide } from "@lit/context";
271
+ import { html as html4, LitElement as LitElement4 } from "lit";
272
+ import { customElement as customElement4, state as state2 } from "lit/decorators.js";
273
+ var QtiItem = class extends LitElement4 {
274
+ constructor() {
275
+ super();
276
+ this.configContext = {};
277
+ // Store event handlers as instance properties
278
+ this._onItemContextChanged = this._handleItemContextChanged.bind(this);
279
+ this._onAssessmentItemConnected = this._handleAssessmentItemConnected.bind(this);
280
+ this._onHandleShowCorrectResponse = this._handleShowCorrectResponse.bind(this);
281
+ this._onHandleShowCandidateCorrection = this._handleShowCandidateCorrection.bind(this);
282
+ this._onHandleSwitchCorrectResponseMode = this._handleSwitchCorrectResponseMode.bind(this);
283
+ this.addEventListener("qti-item-context-updated", this._onItemContextChanged);
284
+ this.addEventListener("qti-assessment-item-connected", this._onAssessmentItemConnected);
285
+ this.addEventListener("item-show-correct-response", this._onHandleShowCorrectResponse);
286
+ this.addEventListener("item-show-candidate-correction", this._onHandleShowCandidateCorrection);
287
+ this.addEventListener("item-switch-correct-response-mode", this._onHandleSwitchCorrectResponseMode);
288
+ }
289
+ _handleItemContextChanged(e) {
290
+ this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail?.itemContext?.variables || []);
291
+ }
292
+ _handleAssessmentItemConnected(e) {
293
+ const fullVariables = e.detail._context.variables;
294
+ this._qtiAssessmentItem = e.detail;
295
+ this.computedContext = this.computedContext?.identifier === this._qtiAssessmentItem.identifier ? { ...this.computedContext, title: this._qtiAssessmentItem.title } : {
296
+ identifier: this._qtiAssessmentItem.identifier,
297
+ title: this._qtiAssessmentItem.title,
298
+ adaptive: this._qtiAssessmentItem.getAttribute("adaptive")?.toLowerCase() === "true" || false,
299
+ variables: fullVariables,
300
+ correctResponseMode: "internal"
301
+ };
302
+ this._updateItemVariablesInTestContext(this._qtiAssessmentItem.identifier, fullVariables || []);
303
+ }
304
+ _handleShowCorrectResponse(e) {
305
+ if (this._qtiAssessmentItem) {
306
+ this._qtiAssessmentItem.showCorrectResponse(e.detail);
307
+ }
308
+ }
309
+ _handleShowCandidateCorrection(e) {
310
+ if (this._qtiAssessmentItem) {
311
+ this._qtiAssessmentItem.showCandidateCorrection(e.detail);
312
+ }
313
+ }
314
+ _handleSwitchCorrectResponseMode(e) {
315
+ this._handleShowCorrectResponse(new CustomEvent("item-show-correct-response", { detail: false, bubbles: true }));
316
+ this.configContext = {
317
+ ...this.configContext,
318
+ correctResponseMode: e.detail
319
+ };
320
+ }
321
+ _updateItemVariablesInTestContext(identifier, variables) {
322
+ const rawscore = variables?.find((vr) => vr.identifier == "SCORE")?.value;
323
+ const score = parseFloat(rawscore?.toString());
324
+ const completionStatus = variables?.find((v) => v.identifier === "completionStatus")?.value;
325
+ const correct = score !== void 0 && !isNaN(score) && score > 0;
326
+ const incorrect = score !== void 0 && !isNaN(score) && score <= 0;
327
+ const completed = completionStatus === "completed";
328
+ this.computedContext = {
329
+ ...this.computedContext,
330
+ identifier,
331
+ correct,
332
+ incorrect,
333
+ completed,
334
+ variables
335
+ };
336
+ }
337
+ render() {
338
+ return html4`<slot></slot>`;
339
+ }
340
+ disconnectedCallback() {
341
+ super.disconnectedCallback();
342
+ this.removeEventListener("qti-item-context-changed", this._onItemContextChanged);
343
+ this.removeEventListener("qti-assessment-item-connected", this._onAssessmentItemConnected);
344
+ }
345
+ };
346
+ __decorateClass([
347
+ state2(),
348
+ provide({ context: computedItemContext })
349
+ ], QtiItem.prototype, "computedContext", 2);
350
+ __decorateClass([
351
+ state2(),
352
+ provide({ context: configContext })
353
+ ], QtiItem.prototype, "configContext", 2);
354
+ QtiItem = __decorateClass([
355
+ customElement4("qti-item")
356
+ ], QtiItem);
357
+
358
+ export {
359
+ ItemContainer,
360
+ PrintItemVariables,
361
+ ItemShowCorrectResponse,
362
+ QtiItem
363
+ };
364
+ //# sourceMappingURL=chunk-6K4ROGDD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-item/components/item-container.ts","../../src/lib/qti-item/components/print-item-variables.ts","../../src/lib/exports/computed-item.context.ts","../../src/lib/qti-item/components/item-show-correct-response.ts","../../src/lib/qti-item/components/styles.ts","../../src/lib/qti-item/core/qti-item.ts"],"sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { until } from 'lit/directives/until.js';\n\nimport { watch } from '../../decorators/watch';\nimport itemCss from '../../../item.css?inline';\nimport { qtiTransformItem } from '../../qti-transformers';\n\n/**\n * `<item-container>` is a custom element designed for hosting the qti-assessment-item.\n * The `qti-assessment-item` will be placed inside the shadow DOM of this element.\n * The element loads the item from the provided URL and renders it inside the shadow DOM.\n *\n * ### Styling\n * Add a class to the element for styling.\n *\n * ```html\n * <qti-item>\n * <item-container class=\"m-4 bg-white\" item-url=\"./path/to/item.xml\"></item-container>\n * </qti-item>\n * ```\n */\n@customElement('item-container')\nexport class ItemContainer extends LitElement {\n /** URL of the item to load */\n @property({ type: String, attribute: 'item-url' })\n itemURL: string = null;\n\n /** A parsed HTML document */\n @state()\n itemDoc: DocumentFragment = null;\n\n /** The raw XML string */\n @state()\n itemXML: string = null;\n\n /** Template content if provided */\n private templateContent = null;\n\n @watch('itemURL', { waitUntilFirstUpdate: true })\n protected async handleItemURLChange() {\n if (!this.itemURL) return;\n try {\n const { promise: api } = await qtiTransformItem().load(this.itemURL);\n this.itemDoc = (await api).htmlDoc();\n } catch (error) {\n console.error('Error loading or parsing XML:', error);\n }\n }\n\n @watch('itemXML', { waitUntilFirstUpdate: true })\n protected handleItemXMLChange() {\n if (!this.itemXML) return;\n try {\n this.itemDoc = qtiTransformItem().parse(this.itemXML).htmlDoc();\n } catch (error) {\n console.error('Error parsing XML:', error);\n }\n }\n\n async connectedCallback(): Promise<void> {\n super.connectedCallback();\n this.initializeTemplateContent();\n this.applyStyles();\n if (this.itemURL) {\n this.handleItemURLChange();\n }\n if (this.itemXML) {\n this.handleItemXMLChange();\n }\n }\n\n private initializeTemplateContent() {\n const template = this.querySelector('template') as HTMLTemplateElement;\n this.templateContent = template ? template.content : html``;\n }\n\n private applyStyles() {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(itemCss);\n this.shadowRoot.adoptedStyleSheets = [sheet];\n }\n\n render() {\n return html`\n ${this.templateContent}\n <slot></slot>\n ${until(this.itemDoc, html`<span>Loading...</span>`)}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-container': ItemContainer;\n }\n}\n","import { consume } from '@lit/context';\nimport { css, html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport { computedItemContext } from '../../exports/computed-item.context';\n\nimport type { ResponseVariable } from '../../exports/variables';\nimport type { ComputedItemContext } from '../../exports/computed-item.context';\n\n@customElement('print-item-variables')\nexport class PrintItemVariables extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n protected computedContext?: ComputedItemContext;\n\n static styles = css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin: 20px 0;\n font-size: 14px;\n text-align: left;\n }\n th,\n td {\n border: 1px solid #ddd;\n padding: 8px;\n }\n th {\n background-color: #f4f4f4;\n font-weight: bold;\n }\n h3 {\n margin-top: 20px;\n font-size: 16px;\n }\n `;\n\n render() {\n const activeItem = this.computedContext;\n\n if (!activeItem || !activeItem.variables) return html``;\n\n const responseVariables: ResponseVariable[] = activeItem.variables.filter(v => v.type === 'response');\n const outcomeVariables = activeItem.variables.filter(v => v.type === 'outcome');\n\n const renderTable = (variables: ResponseVariable[], title: string) => html`\n <h3>${title}</h3>\n <table>\n <thead>\n <tr>\n <th>Identifier</th>\n <th>Value</th>\n <th>Cardinality</th>\n <th>Base Type</th>\n <th>Correct Response / Mappings</th>\n </tr>\n </thead>\n <tbody>\n ${variables.map(v => {\n const correctResponse = v.correctResponse\n ? Array.isArray(v.correctResponse)\n ? v.correctResponse.join(', ')\n : v.correctResponse\n : '';\n\n const mapEntries = v.mapping?.mapEntries?.map(m => `${m.mapKey}=${m.mappedValue}pt`).join(', ') || '';\n\n const areaMapEntries =\n v.areaMapping?.areaMapEntries?.map(m => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(', ') || '';\n\n return html`\n <tr>\n <td>${v.identifier}</td>\n <td>${Array.isArray(v.value) ? v.value.join(', ') : v.value}</td>\n <td>${v.cardinality}</td>\n <td>${v.baseType}</td>\n <td>${correctResponse || mapEntries || areaMapEntries}</td>\n </tr>\n `;\n })}\n </tbody>\n </table>\n `;\n\n return html`\n ${renderTable(responseVariables, 'Response Variables')} ${renderTable(outcomeVariables, 'Outcome Variables')}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'print-item-variables': PrintItemVariables;\n }\n}\n","import { createContext } from '@lit/context';\n\nimport type { VariableDeclaration } from './variables';\n\nexport type ComputedItemContext = {\n identifier: string;\n href?: string;\n correct?: boolean;\n incorrect?: boolean;\n completed?: boolean;\n adaptive?: boolean;\n timeDependent?: boolean;\n title?: string;\n label?: string;\n score?: number;\n maxScore?: number;\n completionStatus?: string;\n variables: ReadonlyArray<VariableDeclaration<string | string[] | null>>;\n};\n\nexport const computedItemContext = createContext<Readonly<ComputedItemContext>>(Symbol('computedItemContext'));\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\nimport { computedItemContext } from '../../exports/computed-item.context';\n\nimport type { ComputedItemContext } from '../../exports/computed-item.context';\n\n@customElement('item-show-correct-response')\nexport class ItemShowCorrectResponse extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n public computedContext?: ComputedItemContext;\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n @property({ type: Boolean, reflect: true }) shown = false;\n @property({ type: Boolean, reflect: true }) disabled = false; // Reflects to `disabled` attribute\n @property({ type: String }) showCorrectText = 'Show correct response';\n @property({ type: String }) hideCorrectText = 'Hide correct response';\n @property({ type: String }) noCorrectResponseText = 'No correct response specified';\n\n private _hasCorrectResponse = false; // correct response is removed on certain point\n private _previousActiveItem = ''; // Store previous active item reference\n\n updated() {\n if (!this._hasCorrectResponse || this._previousActiveItem !== this.computedContext?.identifier) {\n this._previousActiveItem = this.computedContext?.identifier;\n const containsCorrectResponse = !!this.computedContext?.variables.some(v => v['correctResponse']);\n const containsMapping = !!this.computedContext?.variables.some(v => {\n return v['mapping']?.mapEntries?.length > 0 || v['areaMapping']?.areaMapEntries?.length > 0;\n });\n this._hasCorrectResponse = containsCorrectResponse || containsMapping;\n }\n this.disabled = !this._hasCorrectResponse;\n }\n\n private _toggleState() {\n if (this.disabled) return; // Prevent toggle if disabled\n\n this.dispatchEvent(\n new CustomEvent('item-show-correct-response', {\n detail: !this.shown,\n bubbles: true\n })\n );\n }\n\n private _getDisplayedText(): string {\n return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;\n }\n\n render() {\n return html` <div @click=\"${this._toggleState}\">${this._getDisplayedText()}</div> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-show-correct-response': ItemShowCorrectResponse;\n }\n}\n","// /* eslint-disable lit-plugin(no-invalid-css) */\nimport { css } from 'lit';\n\nexport const form = css`\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n padding: 0.5rem 1rem;\n border-radius: 0.25rem;\n user-select: none;\n`;\n\nexport const btn = css`\n background-color: lightgray;\n ${form};\n`;\n\nexport const dis = css`\n cursor: not-allowed;\n opacity: 0.8;\n`;\n\nexport const ind = css`\n ${form};\n border: 1px solid gray;\n`;\n","import { provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\n\nimport { computedItemContext } from '../../exports/computed-item.context';\nimport { configContext } from '../../exports/config.context.ts';\n\nimport type { QtiAssessmentItem } from '../../qti-components/qti-assessment-item/qti-assessment-item.ts';\nimport type { ConfigContext, CorrectResponseMode } from '../../exports/config.context.ts';\nimport type { ItemContext } from '../../exports/item.context';\nimport type { VariableDeclaration } from '../../exports/variables';\nimport type { ComputedItemContext } from '../../exports/computed-item.context';\n\n/**\n * `<qti-item>` is a custom element designed for rendering a single `qti-assessment-item`.\n * It can also host some functionalities to interact with the item like scoring, showing feedback, etc.\n * Placing a mandatory `<item-container>` inside '<qti-item>' will load or parse the item and render it.\n * See `<item-container>` for more details.\n *\n * ```html\n * <qti-item>\n * <item-container class=\"m-4 bg-white\" item-url=\"./path/to/item.xml\"></item-container>\n * </qti-item>\n * ```\n */\n@customElement('qti-item')\nexport class QtiItem extends LitElement {\n @state()\n @provide({ context: computedItemContext })\n public computedContext: ComputedItemContext;\n private _qtiAssessmentItem?: QtiAssessmentItem;\n\n @state()\n @provide({ context: configContext })\n public configContext: ConfigContext = {};\n\n // Store event handlers as instance properties\n private _onItemContextChanged = this._handleItemContextChanged.bind(this);\n private _onAssessmentItemConnected = this._handleAssessmentItemConnected.bind(this);\n\n private _onHandleShowCorrectResponse = this._handleShowCorrectResponse.bind(this);\n private _onHandleShowCandidateCorrection = this._handleShowCandidateCorrection.bind(this);\n private _onHandleSwitchCorrectResponseMode = this._handleSwitchCorrectResponseMode.bind(this);\n\n constructor() {\n super();\n this.addEventListener('qti-item-context-updated', this._onItemContextChanged);\n this.addEventListener('qti-assessment-item-connected', this._onAssessmentItemConnected);\n this.addEventListener('item-show-correct-response', this._onHandleShowCorrectResponse);\n this.addEventListener('item-show-candidate-correction', this._onHandleShowCandidateCorrection);\n this.addEventListener('item-switch-correct-response-mode', this._onHandleSwitchCorrectResponseMode);\n }\n\n private _handleItemContextChanged(e: CustomEvent<{ itemContext: ItemContext }>) {\n this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail?.itemContext?.variables || []);\n }\n\n private _handleAssessmentItemConnected(e: CustomEvent<QtiAssessmentItem>) {\n const fullVariables = (e.detail as any)._context.variables;\n this._qtiAssessmentItem = e.detail;\n this.computedContext =\n this.computedContext?.identifier === this._qtiAssessmentItem.identifier\n ? { ...this.computedContext, title: this._qtiAssessmentItem.title }\n : ({\n identifier: this._qtiAssessmentItem.identifier,\n title: this._qtiAssessmentItem.title,\n adaptive: this._qtiAssessmentItem.getAttribute('adaptive')?.toLowerCase() === 'true' || false,\n variables: fullVariables,\n correctResponseMode: 'internal'\n } as ComputedItemContext);\n this._updateItemVariablesInTestContext(this._qtiAssessmentItem.identifier, fullVariables || []);\n }\n\n private _handleShowCorrectResponse(e: CustomEvent<boolean>) {\n if (this._qtiAssessmentItem) {\n this._qtiAssessmentItem.showCorrectResponse(e.detail);\n }\n }\n\n private _handleShowCandidateCorrection(e: CustomEvent<boolean>) {\n if (this._qtiAssessmentItem) {\n this._qtiAssessmentItem.showCandidateCorrection(e.detail);\n }\n }\n\n private _handleSwitchCorrectResponseMode(e: CustomEvent<CorrectResponseMode>) {\n // Switch off the correct response first\n this._handleShowCorrectResponse(new CustomEvent('item-show-correct-response', { detail: false, bubbles: true }));\n\n this.configContext = {\n ...this.configContext,\n correctResponseMode: e.detail\n };\n }\n\n private _updateItemVariablesInTestContext(\n identifier: string,\n variables: readonly VariableDeclaration<string | string[] | null>[]\n ): void {\n const rawscore = variables?.find(vr => vr.identifier == 'SCORE')?.value;\n const score = parseFloat(rawscore?.toString());\n const completionStatus = variables?.find(v => v.identifier === 'completionStatus')?.value;\n\n const correct = score !== undefined && !isNaN(score) && score > 0;\n const incorrect = score !== undefined && !isNaN(score) && score <= 0;\n const completed = completionStatus === 'completed';\n this.computedContext = {\n ...this.computedContext,\n identifier,\n correct,\n incorrect,\n completed,\n variables\n };\n }\n\n render() {\n return html`<slot></slot>`;\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('qti-item-context-changed', this._onItemContextChanged);\n this.removeEventListener('qti-assessment-item-connected', this._onAssessmentItemConnected);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-item': QtiItem;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,YAAY;AACjC,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,aAAa;AAqBf,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC;AAAA;AAGL,mBAAkB;AAIlB,mBAA4B;AAI5B,mBAAkB;AAGlB;AAAA,SAAQ,kBAAkB;AAAA;AAAA,EAG1B,MAAgB,sBAAsB;AACpC,QAAI,CAAC,KAAK,QAAS;AACnB,QAAI;AACF,YAAM,EAAE,SAAS,IAAI,IAAI,MAAM,iBAAiB,EAAE,KAAK,KAAK,OAAO;AACnE,WAAK,WAAW,MAAM,KAAK,QAAQ;AAAA,IACrC,SAA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c,UAAU;AAAA,GACZ;","names":["html","LitElement","customElement","LitElement","html","customElement","css","html","LitElement","customElement","property","consume","css","LitElement","html","css","consume","property","customElement","html","LitElement","customElement","state","LitElement","html","state","customElement"]}
@@ -0,0 +1,189 @@
1
+ import {
2
+ __decorateClass
3
+ } from "./chunk-JDY5GL7E.js";
4
+
5
+ // src/lib/qti-components/qti-feedback/qti-modal-feedback/qti-modal-feedback.ts
6
+ import { css, html } from "lit";
7
+ import { customElement } from "lit/decorators.js";
8
+
9
+ // src/lib/qti-components/qti-feedback/qti-feedback.ts
10
+ import { consume } from "@lit/context";
11
+ import { LitElement } from "lit";
12
+ import { property, state } from "lit/decorators.js";
13
+
14
+ // src/lib/qti-components/internal/utils.ts
15
+ var decimalSeparator = () => {
16
+ return new Intl.NumberFormat().format(0.1).replace(/\d/g, "");
17
+ };
18
+ var convertNumberToUniversalFormat = (number) => {
19
+ if (typeof number === "string") {
20
+ return number;
21
+ }
22
+ const dSep = decimalSeparator();
23
+ if (dSep === ".") {
24
+ return number.toLocaleString();
25
+ } else {
26
+ return number.toString().replace(".", "").replace(dSep, ".");
27
+ }
28
+ };
29
+ function IsNullOrUndefined(value) {
30
+ return value === null || value === void 0;
31
+ }
32
+ function removeDoubleSlashes(str) {
33
+ const singleForwardSlashes = str.replace(/([^:]\/)\/+/g, "$1").replace(/\/\//g, "/").replace("http:/", "http://").replace("https:/", "https://");
34
+ return singleForwardSlashes;
35
+ }
36
+
37
+ // src/lib/exports/qti-assessment-item.context.ts
38
+ import { createContext } from "@lit/context";
39
+ var itemContext = createContext(Symbol("item"));
40
+
41
+ // src/lib/qti-components/qti-feedback/qti-feedback.ts
42
+ var QtiFeedback = class extends LitElement {
43
+ connectedCallback() {
44
+ super.connectedCallback();
45
+ this.dispatchEvent(
46
+ new CustomEvent("qti-register-feedback", {
47
+ bubbles: true,
48
+ composed: true,
49
+ detail: this
50
+ })
51
+ );
52
+ }
53
+ checkShowFeedback(outcomeIdentifier) {
54
+ const outcomeVariable = this._context.variables.find((v) => v.identifier === outcomeIdentifier) || null;
55
+ if (this.outcomeIdentifier !== outcomeIdentifier || !outcomeVariable) return;
56
+ let isFound = false;
57
+ if (Array.isArray(outcomeVariable.value)) {
58
+ isFound = outcomeVariable.value.includes(this.identifier);
59
+ } else {
60
+ isFound = !IsNullOrUndefined(this.identifier) && !IsNullOrUndefined(outcomeVariable?.value) && this.identifier === outcomeVariable.value || false;
61
+ }
62
+ this.showFeedback(isFound);
63
+ }
64
+ showFeedback(value) {
65
+ this.showStatus = value && this.showHide === "show" || !value && this.showHide === "hide" ? "on" : "off";
66
+ }
67
+ };
68
+ __decorateClass([
69
+ property({ type: String, attribute: "show-hide" })
70
+ ], QtiFeedback.prototype, "showHide", 2);
71
+ __decorateClass([
72
+ property({ type: String, attribute: "outcome-identifier" })
73
+ ], QtiFeedback.prototype, "outcomeIdentifier", 2);
74
+ __decorateClass([
75
+ property({ type: String })
76
+ ], QtiFeedback.prototype, "identifier", 2);
77
+ __decorateClass([
78
+ property({ type: String, attribute: false })
79
+ ], QtiFeedback.prototype, "showStatus", 2);
80
+ __decorateClass([
81
+ consume({ context: itemContext, subscribe: true }),
82
+ state()
83
+ ], QtiFeedback.prototype, "_context", 2);
84
+
85
+ // src/lib/qti-components/qti-feedback/qti-modal-feedback/qti-modal-feedback.ts
86
+ var QtiModalFeedback = class extends QtiFeedback {
87
+ render() {
88
+ return html`
89
+ <dialog class="qti-dialog" part="feedback" ?open="${this.showStatus === "on"}">
90
+ <slot></slot>
91
+ <div style="margin-top: var(--qti-gap-size); text-align: center;">
92
+ <button class="button close-button" @click="${this.closeFeedback}">Close</button>
93
+ </div>
94
+ </dialog>
95
+ `;
96
+ }
97
+ openFeedback() {
98
+ const dialog = this.shadowRoot?.querySelector("dialog");
99
+ if (dialog && !dialog.open) {
100
+ dialog.showModal();
101
+ }
102
+ }
103
+ closeFeedback() {
104
+ const dialog = this.shadowRoot?.querySelector("dialog");
105
+ if (dialog && dialog.open) {
106
+ dialog.close();
107
+ this.showStatus = "off";
108
+ }
109
+ }
110
+ connectedCallback() {
111
+ super.connectedCallback();
112
+ if (this.showStatus === "on") {
113
+ this.openFeedback();
114
+ }
115
+ }
116
+ updated(changedProperties) {
117
+ if (changedProperties.has("showStatus")) {
118
+ if (this.showStatus === "on") {
119
+ this.openFeedback();
120
+ } else {
121
+ this.closeFeedback();
122
+ }
123
+ }
124
+ }
125
+ };
126
+ QtiModalFeedback.styles = css`
127
+ .qti-dialog {
128
+ background: var(--qti-bg);
129
+ border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
130
+ border-radius: var(--qti-border-radius);
131
+ padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
132
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
133
+ position: fixed;
134
+ top: 50%;
135
+ left: 50%;
136
+ transform: translate(-50%, -50%);
137
+ z-index: 1000;
138
+ width: auto;
139
+ max-width: 90%;
140
+ }
141
+
142
+ .button {
143
+ border-radius: var(--qti-border-radius);
144
+ padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);
145
+ background-color: var(--qti-bg-active);
146
+ border: var(--qti-border-active);
147
+ cursor: pointer;
148
+ position: relative;
149
+ display: inline-block;
150
+ }
151
+
152
+ .button:hover {
153
+ background-color: var(--qti-hover-bg);
154
+ }
155
+
156
+ .button:disabled {
157
+ background-color: var(--qti-disabled-bg);
158
+ color: var(--qti-disabled-color);
159
+ cursor: not-allowed;
160
+ }
161
+
162
+ .button:focus {
163
+ outline: var(--qti-focus-border-width) solid var(--qti-focus-color);
164
+ }
165
+ `;
166
+ QtiModalFeedback = __decorateClass([
167
+ customElement("qti-modal-feedback")
168
+ ], QtiModalFeedback);
169
+
170
+ // src/lib/exports/test.context.ts
171
+ import { createContext as createContext2 } from "@lit/context";
172
+ var INITIAL_TEST_CONTEXT = { items: [], testOutcomeVariables: [] };
173
+ var testContext = createContext2(Symbol("testContext"));
174
+
175
+ // src/lib/exports/qti.context.ts
176
+ import { createContext as createContext3 } from "@lit/context";
177
+ var qtiContext = createContext3(Symbol("qtiContext"));
178
+
179
+ export {
180
+ itemContext,
181
+ convertNumberToUniversalFormat,
182
+ removeDoubleSlashes,
183
+ QtiFeedback,
184
+ QtiModalFeedback,
185
+ qtiContext,
186
+ INITIAL_TEST_CONTEXT,
187
+ testContext
188
+ };
189
+ //# sourceMappingURL=chunk-GUDRSXIP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/qti-components/qti-feedback/qti-modal-feedback/qti-modal-feedback.ts","../../src/lib/qti-components/qti-feedback/qti-feedback.ts","../../src/lib/qti-components/internal/utils.ts","../../src/lib/exports/qti-assessment-item.context.ts","../../src/lib/exports/test.context.ts","../../src/lib/exports/qti.context.ts"],"sourcesContent":["import { css, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport { QtiFeedback } from '../qti-feedback';\n\n@customElement('qti-modal-feedback')\nexport class QtiModalFeedback extends QtiFeedback {\n static override styles = css`\n .qti-dialog {\n background: var(--qti-bg);\n border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);\n border-radius: var(--qti-border-radius);\n padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n z-index: 1000;\n width: auto;\n max-width: 90%;\n }\n\n .button {\n border-radius: var(--qti-border-radius);\n padding: var(--qti-padding-vertical) var(--qti-padding-horizontal);\n background-color: var(--qti-bg-active);\n border: var(--qti-border-active);\n cursor: pointer;\n position: relative;\n display: inline-block;\n }\n\n .button:hover {\n background-color: var(--qti-hover-bg);\n }\n\n .button:disabled {\n background-color: var(--qti-disabled-bg);\n color: var(--qti-disabled-color);\n cursor: not-allowed;\n }\n\n .button:focus {\n outline: var(--qti-focus-border-width) solid var(--qti-focus-color);\n }\n `;\n\n override render() {\n return html`\n <dialog class=\"qti-dialog\" part=\"feedback\" ?open=\"${this.showStatus === 'on'}\">\n <slot></slot>\n <div style=\"margin-top: var(--qti-gap-size); text-align: center;\">\n <button class=\"button close-button\" @click=\"${this.closeFeedback}\">Close</button>\n </div>\n </dialog>\n `;\n }\n\n openFeedback() {\n const dialog = this.shadowRoot?.querySelector('dialog') as HTMLDialogElement | null;\n if (dialog && !dialog.open) {\n dialog.showModal();\n }\n }\n\n closeFeedback() {\n const dialog = this.shadowRoot?.querySelector('dialog') as HTMLDialogElement | null;\n if (dialog && dialog.open) {\n dialog.close();\n this.showStatus = 'off';\n }\n }\n\n public connectedCallback(): void {\n super.connectedCallback();\n if (this.showStatus === 'on') {\n this.openFeedback();\n }\n }\n\n protected updated(changedProperties: Map<string | number | symbol, unknown>): void {\n if (changedProperties.has('showStatus')) {\n if (this.showStatus === 'on') {\n this.openFeedback();\n } else {\n this.closeFeedback();\n }\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-modal-feedback': QtiModalFeedback;\n }\n}\n","import { consume } from '@lit/context';\nimport { LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { IsNullOrUndefined } from '../internal/utils';\nimport { itemContext } from '../../exports/qti-assessment-item.context';\n\nimport type { ItemContext } from '../../exports/item.context';\n\nexport abstract class QtiFeedback extends LitElement {\n @property({ type: String, attribute: 'show-hide' })\n protected showHide: string;\n\n @property({ type: String, attribute: 'outcome-identifier' })\n public outcomeIdentifier: string;\n\n @property({ type: String })\n protected identifier: string;\n\n @property({ type: String, attribute: false })\n public showStatus: string;\n\n @consume({ context: itemContext, subscribe: true })\n @state()\n private _context?: ItemContext;\n\n public override connectedCallback() {\n super.connectedCallback();\n this.dispatchEvent(\n new CustomEvent<QtiFeedback>('qti-register-feedback', {\n bubbles: true,\n composed: true,\n detail: this\n })\n );\n }\n\n public checkShowFeedback(outcomeIdentifier: string) {\n const outcomeVariable = this._context.variables.find(v => v.identifier === outcomeIdentifier) || null;\n if (this.outcomeIdentifier !== outcomeIdentifier || !outcomeVariable) return;\n let isFound = false;\n if (Array.isArray(outcomeVariable.value)) {\n isFound = outcomeVariable.value.includes(this.identifier);\n } else {\n isFound =\n (!IsNullOrUndefined(this.identifier) &&\n !IsNullOrUndefined(outcomeVariable?.value) &&\n this.identifier === outcomeVariable.value) ||\n false;\n }\n\n this.showFeedback(isFound);\n }\n\n private showFeedback(value: boolean) {\n this.showStatus = (value && this.showHide === 'show') || (!value && this.showHide === 'hide') ? 'on' : 'off';\n }\n}\n","export const decimalSeparator = () => {\n return new Intl.NumberFormat().format(0.1).replace(/\\d/g, '');\n};\n\nexport const convertNumberToUniversalFormat = (number: number | string) => {\n // check if type is string\n if (typeof number === 'string') {\n return number;\n }\n const dSep = decimalSeparator();\n if (dSep === '.') {\n return number.toLocaleString();\n } else {\n return number.toString().replace('.', '').replace(dSep, '.');\n }\n};\n\nexport function IsNullOrUndefined(value: unknown) {\n return value === null || value === undefined;\n}\n\nexport function removeDoubleSlashes(str: string) {\n const singleForwardSlashes = str\n .replace(/([^:]\\/)\\/+/g, '$1')\n .replace(/\\/\\//g, '/')\n .replace('http:/', 'http://')\n .replace('https:/', 'https://');\n return singleForwardSlashes;\n}\n","import { createContext } from '@lit/context';\n\nimport type { ItemContext } from './item.context';\n\nexport const itemContext = createContext<ItemContext>(Symbol('item'));\n","import { createContext } from '@lit/context';\n\nimport type { ItemContext } from './item.context';\nimport type { VariableDeclaration } from './variables';\n\nexport interface TestContext {\n items: (ItemContext & { category?: string })[];\n testOutcomeVariables?: VariableDeclaration<string | string[] | null>[];\n}\n\nexport const INITIAL_TEST_CONTEXT: Readonly<TestContext> = { items: [], testOutcomeVariables: [] };\n\nexport const testContext = createContext<Readonly<TestContext>>(Symbol('testContext'));\n","import { createContext } from '@lit/context';\n\nexport type QtiContextType = {\n testIdentifier: string;\n candidateIdentifier: string;\n environmentIdentifier: string;\n [key: string]: string | string[]; // Allow for additional context variables\n};\n\nexport interface QtiContext {\n QTI_CONTEXT: QtiContextType;\n}\n\nexport const qti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K,aAAa;AAAA,IACpB;AAAA,EACF;AAAA,EAEO,oBAA0B;AAC/B,UAAM,kBAAkB;AACxB,QAAI,KAAK,eAAe,MAAM;AAC5B,WAAK,aAAa;AAAA,IACpB;AAAA,EACF;AAAA,EAEU,QAAQ,mBAAiE;AACjF,QAAI,kBAAkB,IAAI,YAAY,GAAG;AACvC,UAAI,KAAK,eAAe,MAAM;AAC5B,aAAK,aAAa;AAAA,MACpB,OAAO;AACL,aAAK,cAAc;AAAA,MACrB;AAAA,IACF;AAAA,EACF;AACF;AApFa,iBACK,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AADd,mBAAN;AAAA,EADN,cAAc,oBAAoB;AAAA,GACtB;;;AINb,SAAS,iBAAAA,sBAAqB;AAUvB,IAAM,uBAA8C,EAAE,OAAO,CAAC,GAAG,sBAAsB,CAAC,EAAE;AAE1F,IAAM,cAAcA,eAAqC,OAAO,aAAa,CAAC;;;ACZrF,SAAS,iBAAAC,sBAAqB;AAavB,IAAM,aAAaA,eAAoC,OAAO,YAAY,CAAC;","names":["createContext","createContext"]}
@@ -1,3 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __decorateClass = (decorators, target, key, kind) => {
4
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
+ if (decorator = decorators[i])
7
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
+ if (kind && result) __defProp(target, key, result);
9
+ return result;
10
+ };
11
+
1
12
  // src/lib/qti-transformers/qti-transformers.ts
2
13
  var xml = String.raw;
3
14
  var xmlToHTML = xml`<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
@@ -495,8 +506,9 @@ var qtiTransformTest = () => {
495
506
  };
496
507
 
497
508
  export {
509
+ __decorateClass,
498
510
  qtiTransformItem,
499
511
  qtiTransformManifest,
500
512
  qtiTransformTest
501
513
  };
502
- //# sourceMappingURL=chunk-WFUXZ4UT.js.map
514
+ //# sourceMappingURL=chunk-JDY5GL7E.js.map