@pie-qti/item-player 0.1.4 → 0.1.6

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 (498) hide show
  1. package/README.md +21 -18
  2. package/dist/catalog/applyGlossaryTriggers.d.ts +15 -0
  3. package/dist/catalog/applyGlossaryTriggers.d.ts.map +1 -0
  4. package/dist/catalog/applyGlossaryTriggers.js +193 -0
  5. package/dist/catalog/catalogExtractor.d.ts +18 -0
  6. package/dist/catalog/catalogExtractor.d.ts.map +1 -0
  7. package/dist/catalog/catalogExtractor.js +114 -0
  8. package/dist/catalog/catalogLookup.d.ts +18 -0
  9. package/dist/catalog/catalogLookup.d.ts.map +1 -0
  10. package/dist/catalog/catalogLookup.js +44 -0
  11. package/dist/catalog/glossaryAction.d.ts +17 -0
  12. package/dist/catalog/glossaryAction.d.ts.map +1 -0
  13. package/dist/catalog/glossaryAction.js +21 -0
  14. package/dist/catalog/types.d.ts +26 -0
  15. package/dist/catalog/types.d.ts.map +1 -0
  16. package/dist/catalog/types.js +6 -0
  17. package/dist/core/ComponentRegistry.d.ts +14 -4
  18. package/dist/core/ComponentRegistry.d.ts.map +1 -1
  19. package/dist/core/ComponentRegistry.js +25 -4
  20. package/dist/core/ItemRenderer.d.ts.map +1 -1
  21. package/dist/core/ItemRenderer.js +8 -18
  22. package/dist/core/Player.d.ts +53 -1
  23. package/dist/core/Player.d.ts.map +1 -1
  24. package/dist/core/Player.js +195 -142
  25. package/dist/core/rolePolicy.d.ts +16 -0
  26. package/dist/core/rolePolicy.d.ts.map +1 -0
  27. package/dist/core/rolePolicy.js +15 -0
  28. package/dist/core/urlPolicy.d.ts.map +1 -1
  29. package/dist/core/urlPolicy.js +5 -2
  30. package/dist/document/AssessmentItemDocument.d.ts +42 -0
  31. package/dist/document/AssessmentItemDocument.d.ts.map +1 -0
  32. package/dist/document/AssessmentItemDocument.js +116 -0
  33. package/dist/element.d.ts +22 -0
  34. package/dist/element.js +5548 -0
  35. package/dist/element.js.map +1 -0
  36. package/dist/extraction/ExtractionRegistry.d.ts.map +1 -1
  37. package/dist/extraction/ExtractionRegistry.js +3 -1
  38. package/dist/extraction/extractors/associateExtractor.d.ts +1 -27
  39. package/dist/extraction/extractors/associateExtractor.d.ts.map +1 -1
  40. package/dist/extraction/extractors/associateExtractor.js +1 -94
  41. package/dist/extraction/extractors/choiceExtractor.d.ts +1 -24
  42. package/dist/extraction/extractors/choiceExtractor.d.ts.map +1 -1
  43. package/dist/extraction/extractors/choiceExtractor.js +1 -83
  44. package/dist/extraction/extractors/customExtractor.d.ts +1 -19
  45. package/dist/extraction/extractors/customExtractor.d.ts.map +1 -1
  46. package/dist/extraction/extractors/customExtractor.js +1 -51
  47. package/dist/extraction/extractors/drawingExtractor.d.ts +1 -29
  48. package/dist/extraction/extractors/drawingExtractor.d.ts.map +1 -1
  49. package/dist/extraction/extractors/drawingExtractor.js +1 -78
  50. package/dist/extraction/extractors/endAttemptExtractor.d.ts +1 -19
  51. package/dist/extraction/extractors/endAttemptExtractor.d.ts.map +1 -1
  52. package/dist/extraction/extractors/endAttemptExtractor.js +1 -53
  53. package/dist/extraction/extractors/extendedTextExtractor.d.ts +1 -20
  54. package/dist/extraction/extractors/extendedTextExtractor.d.ts.map +1 -1
  55. package/dist/extraction/extractors/extendedTextExtractor.js +1 -57
  56. package/dist/extraction/extractors/gapMatchExtractor.d.ts +1 -27
  57. package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +1 -1
  58. package/dist/extraction/extractors/gapMatchExtractor.js +1 -142
  59. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +1 -39
  60. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +1 -1
  61. package/dist/extraction/extractors/graphicAssociateExtractor.js +1 -140
  62. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +1 -41
  63. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +1 -1
  64. package/dist/extraction/extractors/graphicGapMatchExtractor.js +1 -144
  65. package/dist/extraction/extractors/graphicOrderExtractor.d.ts +1 -36
  66. package/dist/extraction/extractors/graphicOrderExtractor.d.ts.map +1 -1
  67. package/dist/extraction/extractors/graphicOrderExtractor.js +1 -121
  68. package/dist/extraction/extractors/hotspotExtractor.d.ts +1 -37
  69. package/dist/extraction/extractors/hotspotExtractor.d.ts.map +1 -1
  70. package/dist/extraction/extractors/hotspotExtractor.js +1 -140
  71. package/dist/extraction/extractors/hottextExtractor.d.ts +1 -25
  72. package/dist/extraction/extractors/hottextExtractor.d.ts.map +1 -1
  73. package/dist/extraction/extractors/hottextExtractor.js +1 -120
  74. package/dist/extraction/extractors/index.d.ts +5 -58
  75. package/dist/extraction/extractors/index.d.ts.map +1 -1
  76. package/dist/extraction/extractors/index.js +5 -81
  77. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +1 -21
  78. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +1 -1
  79. package/dist/extraction/extractors/inlineChoiceExtractor.js +1 -67
  80. package/dist/extraction/extractors/matchExtractor.d.ts +1 -31
  81. package/dist/extraction/extractors/matchExtractor.d.ts.map +1 -1
  82. package/dist/extraction/extractors/matchExtractor.js +1 -134
  83. package/dist/extraction/extractors/mediaExtractor.d.ts +1 -32
  84. package/dist/extraction/extractors/mediaExtractor.d.ts.map +1 -1
  85. package/dist/extraction/extractors/mediaExtractor.js +1 -125
  86. package/dist/extraction/extractors/orderExtractor.d.ts +1 -25
  87. package/dist/extraction/extractors/orderExtractor.d.ts.map +1 -1
  88. package/dist/extraction/extractors/orderExtractor.js +1 -86
  89. package/dist/extraction/extractors/portableCustomExtractor.d.ts +2 -0
  90. package/dist/extraction/extractors/portableCustomExtractor.d.ts.map +1 -0
  91. package/dist/extraction/extractors/portableCustomExtractor.js +1 -0
  92. package/dist/extraction/extractors/positionObjectExtractor.d.ts +1 -58
  93. package/dist/extraction/extractors/positionObjectExtractor.d.ts.map +1 -1
  94. package/dist/extraction/extractors/positionObjectExtractor.js +1 -191
  95. package/dist/extraction/extractors/selectPointExtractor.d.ts +1 -30
  96. package/dist/extraction/extractors/selectPointExtractor.d.ts.map +1 -1
  97. package/dist/extraction/extractors/selectPointExtractor.js +1 -109
  98. package/dist/extraction/extractors/sliderExtractor.d.ts +1 -23
  99. package/dist/extraction/extractors/sliderExtractor.d.ts.map +1 -1
  100. package/dist/extraction/extractors/sliderExtractor.js +1 -73
  101. package/dist/extraction/extractors/textEntryExtractor.d.ts +1 -19
  102. package/dist/extraction/extractors/textEntryExtractor.d.ts.map +1 -1
  103. package/dist/extraction/extractors/textEntryExtractor.js +1 -48
  104. package/dist/extraction/extractors/uploadExtractor.d.ts +1 -19
  105. package/dist/extraction/extractors/uploadExtractor.d.ts.map +1 -1
  106. package/dist/extraction/extractors/uploadExtractor.js +1 -52
  107. package/dist/extraction/index.d.ts +1 -1
  108. package/dist/extraction/index.d.ts.map +1 -1
  109. package/dist/extraction/index.js +2 -2
  110. package/dist/extraction/interactionExtractionPipeline.d.ts +13 -0
  111. package/dist/extraction/interactionExtractionPipeline.d.ts.map +1 -0
  112. package/dist/extraction/interactionExtractionPipeline.js +39 -0
  113. package/dist/extraction/interactionSecurity.d.ts +4 -0
  114. package/dist/extraction/interactionSecurity.d.ts.map +1 -0
  115. package/dist/extraction/interactionSecurity.js +48 -0
  116. package/dist/index.d.ts +12 -2
  117. package/dist/index.d.ts.map +1 -1
  118. package/dist/index.js +11 -4
  119. package/dist/interactions/associate/extractor.d.ts +29 -0
  120. package/dist/interactions/associate/extractor.d.ts.map +1 -0
  121. package/dist/interactions/associate/extractor.js +97 -0
  122. package/dist/interactions/associate/index.d.ts +3 -0
  123. package/dist/interactions/associate/index.d.ts.map +1 -0
  124. package/dist/interactions/associate/index.js +1 -0
  125. package/dist/interactions/associate/types.d.ts +2 -0
  126. package/dist/interactions/associate/types.d.ts.map +1 -0
  127. package/dist/interactions/associate/types.js +1 -0
  128. package/dist/interactions/choice/extractor.d.ts +27 -0
  129. package/dist/interactions/choice/extractor.d.ts.map +1 -0
  130. package/dist/interactions/choice/extractor.js +93 -0
  131. package/dist/interactions/choice/index.d.ts +3 -0
  132. package/dist/interactions/choice/index.d.ts.map +1 -0
  133. package/dist/interactions/choice/index.js +1 -0
  134. package/dist/interactions/choice/types.d.ts +2 -0
  135. package/dist/interactions/choice/types.d.ts.map +1 -0
  136. package/dist/interactions/choice/types.js +1 -0
  137. package/dist/interactions/custom/extractor.d.ts +20 -0
  138. package/dist/interactions/custom/extractor.d.ts.map +1 -0
  139. package/dist/interactions/custom/extractor.js +51 -0
  140. package/dist/interactions/custom/index.d.ts +3 -0
  141. package/dist/interactions/custom/index.d.ts.map +1 -0
  142. package/dist/interactions/custom/index.js +1 -0
  143. package/dist/interactions/custom/types.d.ts +2 -0
  144. package/dist/interactions/custom/types.d.ts.map +1 -0
  145. package/dist/interactions/custom/types.js +1 -0
  146. package/dist/interactions/drawing/extractor.d.ts +30 -0
  147. package/dist/interactions/drawing/extractor.d.ts.map +1 -0
  148. package/dist/interactions/drawing/extractor.js +78 -0
  149. package/dist/interactions/drawing/index.d.ts +3 -0
  150. package/dist/interactions/drawing/index.d.ts.map +1 -0
  151. package/dist/interactions/drawing/index.js +1 -0
  152. package/dist/interactions/drawing/types.d.ts +2 -0
  153. package/dist/interactions/drawing/types.d.ts.map +1 -0
  154. package/dist/interactions/drawing/types.js +1 -0
  155. package/dist/interactions/end-attempt/extractor.d.ts +20 -0
  156. package/dist/interactions/end-attempt/extractor.d.ts.map +1 -0
  157. package/dist/interactions/end-attempt/extractor.js +53 -0
  158. package/dist/interactions/end-attempt/index.d.ts +3 -0
  159. package/dist/interactions/end-attempt/index.d.ts.map +1 -0
  160. package/dist/interactions/end-attempt/index.js +1 -0
  161. package/dist/interactions/end-attempt/types.d.ts +2 -0
  162. package/dist/interactions/end-attempt/types.d.ts.map +1 -0
  163. package/dist/interactions/end-attempt/types.js +1 -0
  164. package/dist/interactions/extended-text/extractor.d.ts +21 -0
  165. package/dist/interactions/extended-text/extractor.d.ts.map +1 -0
  166. package/dist/interactions/extended-text/extractor.js +63 -0
  167. package/dist/interactions/extended-text/index.d.ts +3 -0
  168. package/dist/interactions/extended-text/index.d.ts.map +1 -0
  169. package/dist/interactions/extended-text/index.js +1 -0
  170. package/dist/interactions/extended-text/types.d.ts +2 -0
  171. package/dist/interactions/extended-text/types.d.ts.map +1 -0
  172. package/dist/interactions/extended-text/types.js +1 -0
  173. package/dist/interactions/gap-match/extractor.d.ts +29 -0
  174. package/dist/interactions/gap-match/extractor.d.ts.map +1 -0
  175. package/dist/interactions/gap-match/extractor.js +155 -0
  176. package/dist/interactions/gap-match/index.d.ts +3 -0
  177. package/dist/interactions/gap-match/index.d.ts.map +1 -0
  178. package/dist/interactions/gap-match/index.js +1 -0
  179. package/dist/interactions/gap-match/types.d.ts +2 -0
  180. package/dist/interactions/gap-match/types.d.ts.map +1 -0
  181. package/dist/interactions/gap-match/types.js +1 -0
  182. package/dist/interactions/graphic-associate/extractor.d.ts +41 -0
  183. package/dist/interactions/graphic-associate/extractor.d.ts.map +1 -0
  184. package/dist/interactions/graphic-associate/extractor.js +143 -0
  185. package/dist/interactions/graphic-associate/index.d.ts +3 -0
  186. package/dist/interactions/graphic-associate/index.d.ts.map +1 -0
  187. package/dist/interactions/graphic-associate/index.js +1 -0
  188. package/dist/interactions/graphic-associate/types.d.ts +2 -0
  189. package/dist/interactions/graphic-associate/types.d.ts.map +1 -0
  190. package/dist/interactions/graphic-associate/types.js +1 -0
  191. package/dist/interactions/graphic-gap-match/extractor.d.ts +53 -0
  192. package/dist/interactions/graphic-gap-match/extractor.d.ts.map +1 -0
  193. package/dist/interactions/graphic-gap-match/extractor.js +205 -0
  194. package/dist/interactions/graphic-gap-match/index.d.ts +3 -0
  195. package/dist/interactions/graphic-gap-match/index.d.ts.map +1 -0
  196. package/dist/interactions/graphic-gap-match/index.js +1 -0
  197. package/dist/interactions/graphic-gap-match/types.d.ts +2 -0
  198. package/dist/interactions/graphic-gap-match/types.d.ts.map +1 -0
  199. package/dist/interactions/graphic-gap-match/types.js +1 -0
  200. package/dist/interactions/graphic-order/extractor.d.ts +37 -0
  201. package/dist/interactions/graphic-order/extractor.d.ts.map +1 -0
  202. package/dist/interactions/graphic-order/extractor.js +121 -0
  203. package/dist/interactions/graphic-order/index.d.ts +3 -0
  204. package/dist/interactions/graphic-order/index.d.ts.map +1 -0
  205. package/dist/interactions/graphic-order/index.js +1 -0
  206. package/dist/interactions/graphic-order/types.d.ts +2 -0
  207. package/dist/interactions/graphic-order/types.d.ts.map +1 -0
  208. package/dist/interactions/graphic-order/types.js +1 -0
  209. package/dist/interactions/hotspot/extractor.d.ts +38 -0
  210. package/dist/interactions/hotspot/extractor.d.ts.map +1 -0
  211. package/dist/interactions/hotspot/extractor.js +159 -0
  212. package/dist/interactions/hotspot/index.d.ts +3 -0
  213. package/dist/interactions/hotspot/index.d.ts.map +1 -0
  214. package/dist/interactions/hotspot/index.js +1 -0
  215. package/dist/interactions/hotspot/types.d.ts +2 -0
  216. package/dist/interactions/hotspot/types.d.ts.map +1 -0
  217. package/dist/interactions/hotspot/types.js +1 -0
  218. package/dist/interactions/hottext/extractor.d.ts +26 -0
  219. package/dist/interactions/hottext/extractor.d.ts.map +1 -0
  220. package/dist/interactions/hottext/extractor.js +128 -0
  221. package/dist/interactions/hottext/index.d.ts +3 -0
  222. package/dist/interactions/hottext/index.d.ts.map +1 -0
  223. package/dist/interactions/hottext/index.js +1 -0
  224. package/dist/interactions/hottext/types.d.ts +2 -0
  225. package/dist/interactions/hottext/types.d.ts.map +1 -0
  226. package/dist/interactions/hottext/types.js +1 -0
  227. package/dist/interactions/index.d.ts +33 -0
  228. package/dist/interactions/index.d.ts.map +1 -0
  229. package/dist/interactions/index.js +30 -0
  230. package/dist/interactions/inline/index.d.ts +2 -0
  231. package/dist/interactions/inline/index.d.ts.map +1 -0
  232. package/dist/interactions/inline/index.js +1 -0
  233. package/dist/interactions/inline/render-plan.d.ts +19 -0
  234. package/dist/interactions/inline/render-plan.d.ts.map +1 -0
  235. package/dist/interactions/inline/render-plan.js +59 -0
  236. package/dist/interactions/inline-choice/extractor.d.ts +25 -0
  237. package/dist/interactions/inline-choice/extractor.d.ts.map +1 -0
  238. package/dist/interactions/inline-choice/extractor.js +80 -0
  239. package/dist/interactions/inline-choice/index.d.ts +3 -0
  240. package/dist/interactions/inline-choice/index.d.ts.map +1 -0
  241. package/dist/interactions/inline-choice/index.js +1 -0
  242. package/dist/interactions/inline-choice/types.d.ts +2 -0
  243. package/dist/interactions/inline-choice/types.d.ts.map +1 -0
  244. package/dist/interactions/inline-choice/types.js +1 -0
  245. package/dist/interactions/match/extractor.d.ts +37 -0
  246. package/dist/interactions/match/extractor.d.ts.map +1 -0
  247. package/dist/interactions/match/extractor.js +160 -0
  248. package/dist/interactions/match/index.d.ts +3 -0
  249. package/dist/interactions/match/index.d.ts.map +1 -0
  250. package/dist/interactions/match/index.js +1 -0
  251. package/dist/interactions/match/types.d.ts +2 -0
  252. package/dist/interactions/match/types.d.ts.map +1 -0
  253. package/dist/interactions/match/types.js +1 -0
  254. package/dist/interactions/media/extractor.d.ts +33 -0
  255. package/dist/interactions/media/extractor.d.ts.map +1 -0
  256. package/dist/interactions/media/extractor.js +125 -0
  257. package/dist/interactions/media/index.d.ts +3 -0
  258. package/dist/interactions/media/index.d.ts.map +1 -0
  259. package/dist/interactions/media/index.js +1 -0
  260. package/dist/interactions/media/types.d.ts +2 -0
  261. package/dist/interactions/media/types.d.ts.map +1 -0
  262. package/dist/interactions/media/types.js +1 -0
  263. package/dist/interactions/modules.d.ts +105 -0
  264. package/dist/interactions/modules.d.ts.map +1 -0
  265. package/dist/interactions/modules.js +86 -0
  266. package/dist/interactions/order/extractor.d.ts +28 -0
  267. package/dist/interactions/order/extractor.d.ts.map +1 -0
  268. package/dist/interactions/order/extractor.js +90 -0
  269. package/dist/interactions/order/index.d.ts +3 -0
  270. package/dist/interactions/order/index.d.ts.map +1 -0
  271. package/dist/interactions/order/index.js +1 -0
  272. package/dist/interactions/order/types.d.ts +2 -0
  273. package/dist/interactions/order/types.d.ts.map +1 -0
  274. package/dist/interactions/order/types.js +1 -0
  275. package/dist/interactions/portable-custom/extractor.d.ts +14 -0
  276. package/dist/interactions/portable-custom/extractor.d.ts.map +1 -0
  277. package/dist/interactions/portable-custom/extractor.js +96 -0
  278. package/dist/interactions/portable-custom/index.d.ts +3 -0
  279. package/dist/interactions/portable-custom/index.d.ts.map +1 -0
  280. package/dist/interactions/portable-custom/index.js +1 -0
  281. package/dist/interactions/portable-custom/types.d.ts +2 -0
  282. package/dist/interactions/portable-custom/types.d.ts.map +1 -0
  283. package/dist/interactions/portable-custom/types.js +1 -0
  284. package/dist/interactions/position-object/extractor.d.ts +59 -0
  285. package/dist/interactions/position-object/extractor.d.ts.map +1 -0
  286. package/dist/interactions/position-object/extractor.js +191 -0
  287. package/dist/interactions/position-object/index.d.ts +3 -0
  288. package/dist/interactions/position-object/index.d.ts.map +1 -0
  289. package/dist/interactions/position-object/index.js +1 -0
  290. package/dist/interactions/position-object/types.d.ts +2 -0
  291. package/dist/interactions/position-object/types.d.ts.map +1 -0
  292. package/dist/interactions/position-object/types.js +1 -0
  293. package/dist/interactions/select-point/extractor.d.ts +31 -0
  294. package/dist/interactions/select-point/extractor.d.ts.map +1 -0
  295. package/dist/interactions/select-point/extractor.js +109 -0
  296. package/dist/interactions/select-point/index.d.ts +3 -0
  297. package/dist/interactions/select-point/index.d.ts.map +1 -0
  298. package/dist/interactions/select-point/index.js +1 -0
  299. package/dist/interactions/select-point/types.d.ts +2 -0
  300. package/dist/interactions/select-point/types.d.ts.map +1 -0
  301. package/dist/interactions/select-point/types.js +1 -0
  302. package/dist/interactions/shared/index.d.ts +2 -0
  303. package/dist/interactions/shared/index.d.ts.map +1 -0
  304. package/dist/interactions/shared/index.js +1 -0
  305. package/dist/interactions/shared/types.d.ts +412 -0
  306. package/dist/interactions/shared/types.d.ts.map +1 -0
  307. package/dist/interactions/shared/types.js +7 -0
  308. package/dist/interactions/slider/extractor.d.ts +24 -0
  309. package/dist/interactions/slider/extractor.d.ts.map +1 -0
  310. package/dist/interactions/slider/extractor.js +73 -0
  311. package/dist/interactions/slider/index.d.ts +3 -0
  312. package/dist/interactions/slider/index.d.ts.map +1 -0
  313. package/dist/interactions/slider/index.js +1 -0
  314. package/dist/interactions/slider/types.d.ts +2 -0
  315. package/dist/interactions/slider/types.d.ts.map +1 -0
  316. package/dist/interactions/slider/types.js +1 -0
  317. package/dist/interactions/text-entry/extractor.d.ts +21 -0
  318. package/dist/interactions/text-entry/extractor.d.ts.map +1 -0
  319. package/dist/interactions/text-entry/extractor.js +54 -0
  320. package/dist/interactions/text-entry/index.d.ts +3 -0
  321. package/dist/interactions/text-entry/index.d.ts.map +1 -0
  322. package/dist/interactions/text-entry/index.js +1 -0
  323. package/dist/interactions/text-entry/types.d.ts +2 -0
  324. package/dist/interactions/text-entry/types.d.ts.map +1 -0
  325. package/dist/interactions/text-entry/types.js +1 -0
  326. package/dist/interactions/upload/extractor.d.ts +20 -0
  327. package/dist/interactions/upload/extractor.d.ts.map +1 -0
  328. package/dist/interactions/upload/extractor.js +59 -0
  329. package/dist/interactions/upload/index.d.ts +3 -0
  330. package/dist/interactions/upload/index.d.ts.map +1 -0
  331. package/dist/interactions/upload/index.js +1 -0
  332. package/dist/interactions/upload/types.d.ts +2 -0
  333. package/dist/interactions/upload/types.d.ts.map +1 -0
  334. package/dist/interactions/upload/types.js +1 -0
  335. package/dist/pci/PciHost.d.ts +53 -0
  336. package/dist/pci/PciHost.d.ts.map +1 -0
  337. package/dist/pci/PciHost.js +116 -0
  338. package/dist/pci/types.d.ts +57 -0
  339. package/dist/pci/types.d.ts.map +1 -0
  340. package/dist/pci/types.js +19 -0
  341. package/dist/pnp/applyPnp.d.ts +9 -0
  342. package/dist/pnp/applyPnp.d.ts.map +1 -0
  343. package/dist/pnp/applyPnp.js +19 -0
  344. package/dist/pnp/parsePnpXml.d.ts +9 -0
  345. package/dist/pnp/parsePnpXml.d.ts.map +1 -0
  346. package/dist/pnp/parsePnpXml.js +101 -0
  347. package/dist/pnp/types.d.ts +40 -0
  348. package/dist/pnp/types.d.ts.map +1 -0
  349. package/dist/pnp/types.js +1 -0
  350. package/dist/types/index.d.ts +22 -8
  351. package/dist/types/index.d.ts.map +1 -1
  352. package/dist/types/interactions.d.ts +4 -319
  353. package/dist/types/interactions.d.ts.map +1 -1
  354. package/dist/types/interactions.js +3 -3
  355. package/dist/web-components/QTIInteractionBase.d.ts +5 -5
  356. package/dist/web-components/QTIInteractionBase.d.ts.map +1 -1
  357. package/dist/web-components/QTIInteractionElement.d.ts +11 -8
  358. package/dist/web-components/QTIInteractionElement.d.ts.map +1 -1
  359. package/dist/web-components/index.d.ts +1 -1
  360. package/dist/web-components/index.d.ts.map +1 -1
  361. package/package.json +19 -9
  362. package/src/__tests__/catalog.test.ts +267 -0
  363. package/src/__tests__/fixtures/pci/echo-pci.js +49 -0
  364. package/src/__tests__/glossaryTriggers.test.ts +411 -0
  365. package/src/__tests__/pci.test.ts +353 -0
  366. package/src/__tests__/pnp.test.ts +250 -0
  367. package/src/__tests__/qti3-extraction.test.ts +5 -5
  368. package/src/catalog/applyGlossaryTriggers.ts +232 -0
  369. package/src/catalog/catalogExtractor.ts +130 -0
  370. package/src/catalog/catalogLookup.ts +53 -0
  371. package/src/catalog/glossaryAction.ts +28 -0
  372. package/src/catalog/types.ts +37 -0
  373. package/src/components/ItemBody.svelte +105 -135
  374. package/src/components/ItemPlayer.svelte +15 -7
  375. package/src/components/ModalFeedbackDisplay.svelte +15 -5
  376. package/src/components/index.ts +3 -0
  377. package/src/core/ComponentRegistry.ts +36 -7
  378. package/src/core/Player.ts +212 -157
  379. package/src/core/rolePolicy.ts +34 -0
  380. package/src/core/urlPolicy.ts +5 -2
  381. package/src/document/AssessmentItemDocument.ts +178 -0
  382. package/src/element.ts +128 -0
  383. package/src/extraction/ExtractionRegistry.ts +5 -1
  384. package/src/extraction/extractors/associateExtractor.ts +1 -129
  385. package/src/extraction/extractors/choiceExtractor.ts +1 -110
  386. package/src/extraction/extractors/conformance-qti3-advanced.test.ts +239 -0
  387. package/src/extraction/extractors/conformance-qti3-basic.test.ts +82 -0
  388. package/src/extraction/extractors/conformance.test.ts +208 -0
  389. package/src/extraction/extractors/customExtractor.ts +1 -72
  390. package/src/extraction/extractors/drawingExtractor.ts +1 -113
  391. package/src/extraction/extractors/endAttemptExtractor.ts +1 -74
  392. package/src/extraction/extractors/extendedTextExtractor.ts +1 -83
  393. package/src/extraction/extractors/gapMatchExtractor.ts +1 -178
  394. package/src/extraction/extractors/graphicAssociateExtractor.ts +1 -188
  395. package/src/extraction/extractors/graphicGapMatchExtractor.ts +1 -185
  396. package/src/extraction/extractors/graphicOrderExtractor.ts +1 -162
  397. package/src/extraction/extractors/hotspotExtractor.ts +1 -190
  398. package/src/extraction/extractors/hottextExtractor.ts +1 -153
  399. package/src/extraction/extractors/index.ts +5 -107
  400. package/src/extraction/extractors/inlineChoiceExtractor.ts +1 -88
  401. package/src/extraction/extractors/matchExtractor.ts +1 -160
  402. package/src/extraction/extractors/mediaExtractor.ts +1 -168
  403. package/src/extraction/extractors/orderExtractor.ts +1 -114
  404. package/src/extraction/extractors/portableCustomExtractor.ts +1 -0
  405. package/src/extraction/extractors/positionObjectExtractor.ts +1 -243
  406. package/src/extraction/extractors/selectPointExtractor.ts +1 -143
  407. package/src/extraction/extractors/sliderExtractor.ts +1 -102
  408. package/src/extraction/extractors/textEntryExtractor.ts +1 -72
  409. package/src/extraction/extractors/uploadExtractor.ts +1 -73
  410. package/src/extraction/index.ts +1 -2
  411. package/src/extraction/interactionExtractionPipeline.ts +70 -0
  412. package/src/extraction/interactionSecurity.ts +60 -0
  413. package/src/index.ts +19 -8
  414. package/src/interactions/associate/extractor.ts +133 -0
  415. package/src/interactions/associate/index.ts +2 -0
  416. package/src/interactions/associate/types.ts +1 -0
  417. package/src/interactions/choice/extractor.ts +121 -0
  418. package/src/interactions/choice/index.ts +2 -0
  419. package/src/interactions/choice/types.ts +1 -0
  420. package/src/interactions/custom/extractor.ts +72 -0
  421. package/src/interactions/custom/index.ts +2 -0
  422. package/src/interactions/custom/types.ts +1 -0
  423. package/src/interactions/drawing/extractor.ts +113 -0
  424. package/src/interactions/drawing/index.ts +2 -0
  425. package/src/interactions/drawing/types.ts +1 -0
  426. package/src/interactions/end-attempt/extractor.ts +74 -0
  427. package/src/interactions/end-attempt/index.ts +2 -0
  428. package/src/interactions/end-attempt/types.ts +1 -0
  429. package/src/interactions/extended-text/extractor.ts +89 -0
  430. package/src/interactions/extended-text/index.ts +2 -0
  431. package/src/interactions/extended-text/types.ts +1 -0
  432. package/src/interactions/gap-match/extractor.ts +193 -0
  433. package/src/interactions/gap-match/index.ts +2 -0
  434. package/src/interactions/gap-match/types.ts +1 -0
  435. package/src/interactions/graphic-associate/extractor.ts +192 -0
  436. package/src/interactions/graphic-associate/index.ts +2 -0
  437. package/src/interactions/graphic-associate/types.ts +1 -0
  438. package/src/interactions/graphic-gap-match/extractor.ts +257 -0
  439. package/src/interactions/graphic-gap-match/index.ts +2 -0
  440. package/src/interactions/graphic-gap-match/types.ts +1 -0
  441. package/src/interactions/graphic-order/extractor.ts +162 -0
  442. package/src/interactions/graphic-order/index.ts +2 -0
  443. package/src/interactions/graphic-order/types.ts +1 -0
  444. package/src/interactions/hotspot/extractor.ts +208 -0
  445. package/src/interactions/hotspot/index.ts +2 -0
  446. package/src/interactions/hotspot/types.ts +1 -0
  447. package/src/interactions/hottext/extractor.ts +163 -0
  448. package/src/interactions/hottext/index.ts +2 -0
  449. package/src/interactions/hottext/types.ts +1 -0
  450. package/src/interactions/index.ts +52 -0
  451. package/src/interactions/inline/index.ts +1 -0
  452. package/src/interactions/inline/render-plan.ts +105 -0
  453. package/src/interactions/inline-choice/InlineChoice.svelte +57 -0
  454. package/src/interactions/inline-choice/extractor.ts +105 -0
  455. package/src/interactions/inline-choice/index.ts +2 -0
  456. package/src/interactions/inline-choice/types.ts +1 -0
  457. package/src/interactions/match/extractor.ts +187 -0
  458. package/src/interactions/match/index.ts +2 -0
  459. package/src/interactions/match/types.ts +1 -0
  460. package/src/interactions/media/extractor.ts +168 -0
  461. package/src/interactions/media/index.ts +2 -0
  462. package/src/interactions/media/types.ts +1 -0
  463. package/src/interactions/modules.ts +111 -0
  464. package/src/interactions/order/extractor.ts +120 -0
  465. package/src/interactions/order/index.ts +2 -0
  466. package/src/interactions/order/types.ts +1 -0
  467. package/src/interactions/portable-custom/extractor.ts +122 -0
  468. package/src/interactions/portable-custom/index.ts +2 -0
  469. package/src/interactions/portable-custom/types.ts +1 -0
  470. package/src/interactions/position-object/extractor.ts +243 -0
  471. package/src/interactions/position-object/index.ts +2 -0
  472. package/src/interactions/position-object/types.ts +1 -0
  473. package/src/interactions/select-point/extractor.ts +143 -0
  474. package/src/interactions/select-point/index.ts +2 -0
  475. package/src/interactions/select-point/types.ts +1 -0
  476. package/src/interactions/shared/index.ts +1 -0
  477. package/src/interactions/shared/types.ts +429 -0
  478. package/src/interactions/slider/extractor.ts +102 -0
  479. package/src/interactions/slider/index.ts +2 -0
  480. package/src/interactions/slider/types.ts +1 -0
  481. package/src/interactions/text-entry/InlineTextEntry.svelte +75 -0
  482. package/src/interactions/text-entry/extractor.ts +79 -0
  483. package/src/interactions/text-entry/index.ts +2 -0
  484. package/src/interactions/text-entry/types.ts +1 -0
  485. package/src/interactions/upload/extractor.ts +81 -0
  486. package/src/interactions/upload/index.ts +2 -0
  487. package/src/interactions/upload/types.ts +1 -0
  488. package/src/pci/PciHost.ts +138 -0
  489. package/src/pci/types.ts +70 -0
  490. package/src/pnp/applyPnp.ts +23 -0
  491. package/src/pnp/parsePnpXml.ts +118 -0
  492. package/src/pnp/types.ts +33 -0
  493. package/src/types/index.ts +22 -8
  494. package/src/types/interactions.ts +4 -350
  495. package/src/web-components/QTIInteractionBase.ts +6 -5
  496. package/src/web-components/QTIInteractionElement.ts +15 -8
  497. package/src/web-components/index.ts +1 -0
  498. package/src/core/ItemRenderer.ts +0 -367
@@ -1,22 +1,34 @@
1
1
  <script lang="ts">
2
2
  import type { InteractionData } from '../types';
3
3
  import type { Player } from '../core/Player';
4
+ import type { InteractionResponseValue, QTIChangeEventDetail } from '../web-components';
4
5
  import type { I18nProvider } from '@pie-qti/i18n';
5
6
  import { normalizeHeuristicsConfig, type QtiHeuristicsConfig } from '@pie-qti/ims-cp-core';
6
7
  import { processFeedbackInline } from './utils/feedbackUtils';
7
8
  import { typesetAction } from './actions/typesetAction';
9
+ import { glossaryAction } from '../catalog/glossaryAction';
8
10
  import { assignProps } from './utils/assignProps';
11
+ import { getRoleCapabilities } from '../core/rolePolicy';
12
+ import InlineChoice from '../interactions/inline-choice/InlineChoice.svelte';
13
+ import InlineTextEntry from '../interactions/text-entry/InlineTextEntry.svelte';
14
+ import { createInlineRenderPlan, isInlineInteractionTagName, isInlineInteractionType } from '../interactions/inline/render-plan';
15
+
16
+ type ItemResponseValue = InteractionResponseValue | null;
17
+ type ItemResponseMap = Record<string, ItemResponseValue>;
18
+ type QtiChangeDomEvent = CustomEvent<QTIChangeEventDetail<ItemResponseValue>>;
9
19
 
10
20
  interface Props {
11
21
  player: Player;
12
- responses?: Record<string, any>;
22
+ responses?: ItemResponseMap;
13
23
  disabled?: boolean;
14
24
  role?: 'candidate' | 'scorer' | 'author' | 'tutor' | 'proctor' | 'testConstructor';
15
25
  i18n?: I18nProvider;
16
26
  typeset?: (element: HTMLElement) => void;
17
- onResponseChange?: (responseId: string, value: any) => void;
27
+ onResponseChange?: (responseId: string, value: ItemResponseValue) => void;
18
28
  outcomeValues?: Record<string, any>; // Needed for feedbackInline visibility
19
29
  heuristicsConfig?: QtiHeuristicsConfig; // Optional heuristics configuration
30
+ /** QTI 3.0 shared stimulus content: map of stimulus identifier → HTML string */
31
+ stimulusContent?: Record<string, string>;
20
32
  }
21
33
 
22
34
  let {
@@ -29,6 +41,7 @@
29
41
  onResponseChange = () => {},
30
42
  outcomeValues = {},
31
43
  heuristicsConfig,
44
+ stimulusContent = {},
32
45
  }: Props = $props();
33
46
 
34
47
  // Normalize heuristics configuration with defaults
@@ -36,23 +49,24 @@
36
49
 
37
50
  // Get the component registry from the player
38
51
  const componentRegistry = $derived(player.getComponentRegistry());
52
+ const roleCapabilities = $derived(getRoleCapabilities(role));
53
+ const effectiveDisabled = $derived(disabled || roleCapabilities.isReadOnly);
39
54
 
40
55
  // Process interactions
41
56
  const interactions = $derived<InteractionData[]>(player.getInteractionData());
42
57
 
43
- // Get correct responses when role is scorer
58
+ // Get correct responses for roles allowed by policy.
44
59
  const correctResponses = $derived.by(() => {
45
- return role === 'scorer' ? player.getCorrectResponses() : {};
60
+ return roleCapabilities.canViewCorrectResponses ? player.getCorrectResponses() : {};
46
61
  });
47
62
 
48
- // Get components for block-level interactions only (not inline interactions)
49
- // Inline interactions (textEntry, inlineChoice) are rendered within the HTML via InlineInteractionRenderer
63
+ // Get components for block-level interactions only (not inline interactions).
64
+ // Type is always normalized to QTI 2.x camelCase by Player (qti-text-entry-interaction → textEntryInteraction).
50
65
  const interactionComponents = $derived(
51
66
  interactions
52
67
  .filter(
53
68
  (interaction) =>
54
- interaction.type !== 'textEntryInteraction' &&
55
- interaction.type !== 'inlineChoiceInteraction'
69
+ !isInlineInteractionType(interaction.type)
56
70
  )
57
71
  .map((interaction) => {
58
72
  try {
@@ -76,16 +90,32 @@
76
90
  const itemBodyHtml = $derived.by(() => {
77
91
  let html = player.getItemBodyHtml();
78
92
 
79
- // Replace inline interactions with placeholders (they need to be rendered in-flow)
80
- html = html
81
- .replace(
82
- /<textEntryInteraction[^>]*responseIdentifier="([^"]+)"[^>]*?(?:\/>|><\/textEntryInteraction>)/gi,
83
- '[TEXTENTRY:$1]'
84
- )
85
- .replace(
86
- /<inlineChoiceInteraction[^>]*responseIdentifier="([^"]+)"[^>]*>[\s\S]*?<\/inlineChoiceInteraction>/gi,
87
- '[INLINECHOICE:$1]'
93
+ // QTI 3.0 Shared Stimulus: inject stimulus HTML at data-stimulus-idref docking points.
94
+ // Any stimulus identifier that has no docking div is prepended to the body.
95
+ if (stimulusContent && Object.keys(stimulusContent).length > 0) {
96
+ const docked = new Set<string>();
97
+ // Replace docking divs: <div ... data-stimulus-idref="ID" ...></div>
98
+ html = html.replace(
99
+ /<div([^>]*)\bdata-stimulus-idref="([^"]+)"([^>]*)>\s*<\/div>/gi,
100
+ (match, before, identifier, after) => {
101
+ const content = stimulusContent[identifier];
102
+ if (content) {
103
+ docked.add(identifier);
104
+ // Preserve any other attributes on the docking div
105
+ return `<div${before} data-stimulus-idref="${identifier}"${after} class="qti-stimulus-dock">${content}</div>`;
106
+ }
107
+ return match; // no content found — leave as-is
108
+ }
88
109
  );
110
+ // Prepend any stimuli that had no docking div
111
+ const undocked = Object.entries(stimulusContent)
112
+ .filter(([id]) => !docked.has(id))
113
+ .map(([, content]) => `<div class="qti-stimulus-block">${content}</div>`)
114
+ .join('');
115
+ if (undocked) {
116
+ html = undocked + html;
117
+ }
118
+ }
89
119
 
90
120
  // Process feedbackInline elements - conditionally show/hide based on outcome values
91
121
  html = processFeedbackInline(html, {
@@ -94,14 +124,14 @@
94
124
  wrapWithSpan: false
95
125
  });
96
126
 
97
- // Wrap all block-level *Interaction elements with a hidden marker
98
- // This is extensible - any element ending in "Interaction" will be hidden
127
+ // Wrap all block-level interaction elements with a hidden marker.
128
+ // Matches both QTI 2.x camelCase (*Interaction) and QTI 3.0 kebab-case (qti-*-interaction).
99
129
  html = html.replace(
100
- /<(\w+Interaction)(\s[^>]*)?>[\s\S]*?<\/\1>/gi,
130
+ /<(\w+Interaction|qti-[\w-]+-interaction)(\s[^>]*)?>[\s\S]*?<\/\1>/gi,
101
131
  (match, tagName) => {
102
- // Skip inline interactions (already handled above)
103
- if (tagName.toLowerCase() === 'textentryinteraction' ||
104
- tagName.toLowerCase() === 'inlinechoiceinteraction') {
132
+ const lower = tagName.toLowerCase();
133
+ // Inline interactions are rendered in-flow by the inline render plan.
134
+ if (isInlineInteractionTagName(lower)) {
105
135
  return match;
106
136
  }
107
137
  // Wrap block interactions with a hidden span
@@ -112,75 +142,19 @@
112
142
  return html;
113
143
  });
114
144
 
115
- // Inline interaction parsing (textEntry, inlineChoice) — kept local to avoid TS issues
116
- // around component props inference in runes mode.
117
- interface ParsedSegment {
118
- type: 'html' | 'textEntry' | 'inlineChoice';
119
- content?: string;
120
- interaction?: any;
121
- }
122
-
123
- const inlineSegments = $derived.by(() => {
124
- const html = itemBodyHtml;
125
- const result: ParsedSegment[] = [];
126
-
127
- let lastIndex = 0;
128
- let match: RegExpExecArray | null;
129
-
130
- // Find placeholders in order.
131
- const combinedPattern = /\[TEXTENTRY:([^\]]+)\]|\[INLINECHOICE:([^\]]+)\]/g;
132
-
133
- while ((match = combinedPattern.exec(html)) !== null) {
134
- if (match.index > lastIndex) {
135
- result.push({ type: 'html', content: html.substring(lastIndex, match.index) });
136
- }
137
-
138
- if (match[0].startsWith('[TEXTENTRY:')) {
139
- const responseId = match[1];
140
- const interaction = (interactions as any[]).find((i) => i.responseId === responseId);
141
- if (interaction) result.push({ type: 'textEntry', interaction });
142
- } else if (match[0].startsWith('[INLINECHOICE:')) {
143
- const responseId = match[2];
144
- const interaction = (interactions as any[]).find((i) => i.responseId === responseId);
145
- if (interaction) result.push({ type: 'inlineChoice', interaction });
146
- }
147
-
148
- lastIndex = match.index + match[0].length;
149
- }
150
-
151
- if (lastIndex < html.length) {
152
- result.push({ type: 'html', content: html.substring(lastIndex) });
153
- }
145
+ const inlineSegments = $derived(createInlineRenderPlan(itemBodyHtml, interactions));
154
146
 
155
- if (result.length === 0) {
156
- result.push({ type: 'html', content: html });
157
- }
158
-
159
- return result;
160
- });
161
-
162
- function handleResponseChange(responseId: string, value: any) {
163
- onResponseChange(responseId, value);
164
- }
165
-
166
- function handleTextEntryInput(responseId: string, e: Event) {
167
- const value = (e.currentTarget as HTMLInputElement | null)?.value ?? '';
168
- handleResponseChange(responseId, value);
147
+ function getStringResponse(responseId: string): string {
148
+ const response = responses[responseId];
149
+ return typeof response === 'string' ? response : '';
169
150
  }
170
151
 
171
- function handleInlineChoiceChange(responseId: string, e: Event) {
172
- const value = (e.currentTarget as HTMLSelectElement | null)?.value ?? '';
173
- handleResponseChange(responseId, value);
174
- }
175
-
176
- // Helper to find correct choice for inline choice interactions
177
- function findCorrectChoice(choices: any[], correctAnswer: string | null): any {
178
- if (!correctAnswer) return null;
179
- return choices.find((c: any) => c.identifier === correctAnswer) || null;
152
+ function handleResponseChange(responseId: string, value: ItemResponseValue) {
153
+ onResponseChange(responseId, value);
180
154
  }
181
155
 
182
156
  // Handle qti:change events from web components
183
- function handleQtiChange(event: CustomEvent) {
157
+ function handleQtiChange(event: QtiChangeDomEvent) {
184
158
  const { responseId, value } = event.detail;
185
159
  handleResponseChange(responseId, value);
186
160
  }
@@ -190,7 +164,7 @@
190
164
  let rootEl: HTMLDivElement | null = $state(null);
191
165
  $effect(() => {
192
166
  if (!rootEl) return;
193
- const handler = (e: Event) => handleQtiChange(e as CustomEvent);
167
+ const handler = (e: Event) => handleQtiChange(e as QtiChangeDomEvent);
194
168
  const el = rootEl; // Capture reference for cleanup
195
169
  el.addEventListener('qti-change', handler as EventListener);
196
170
  return () => {
@@ -241,7 +215,7 @@
241
215
  }
242
216
  </script>
243
217
 
244
- <div bind:this={rootEl} class="qti-item-body" use:typesetAction={{ typeset }}>
218
+ <div bind:this={rootEl} class="qti-item-body" use:typesetAction={{ typeset }} use:glossaryAction={{ player }}>
245
219
  <!-- Item body with inline interactions -->
246
220
  <div class="prose max-w-none mb-4">
247
221
  <div class="inline-interaction-container">
@@ -249,52 +223,25 @@
249
223
  {#if segment.type === 'html'}
250
224
  {@html segment.content}
251
225
  {:else if segment.type === 'textEntry'}
252
- {@const correctAnswer = role === 'scorer' ? (correctResponses[segment.interaction.responseId] ?? null) : null}
253
- {@const displayValue = role === 'scorer' && correctAnswer !== null ? correctAnswer : (responses[segment.interaction.responseId] || '')}
254
- <input
255
- type="text"
256
- class="input input-bordered input-sm inline-input"
257
- class:border-success={correctAnswer !== null}
258
- class:bg-success={correctAnswer !== null}
259
- class:bg-opacity-10={correctAnswer !== null}
260
- style="width: {segment.interaction.expectedLength * 8}px; min-width: 100px; display: inline-block; margin: 0 4px;"
261
- placeholder="..."
262
- aria-label={`Text entry ${segment.interaction.responseId}${correctAnswer ? '. Correct answer: ' + correctAnswer : ''}`}
263
- value={displayValue}
264
- oninput={(e) => handleTextEntryInput(segment.interaction.responseId, e)}
265
- {disabled}
226
+ {@const correctAnswer = roleCapabilities.canViewCorrectResponses ? (correctResponses[segment.interaction.responseId] ?? null) : null}
227
+ <InlineTextEntry
228
+ interaction={segment.interaction}
229
+ response={getStringResponse(segment.interaction.responseId)}
230
+ correctAnswer={roleCapabilities.canViewCorrectResponses ? correctAnswer : null}
231
+ disabled={effectiveDisabled}
232
+ {i18n}
233
+ onResponseChange={handleResponseChange}
266
234
  />
267
235
  {:else if segment.type === 'inlineChoice'}
268
- {@const correctAnswer = role === 'scorer' ? (correctResponses[segment.interaction.responseId] ?? null) : null}
269
- {@const userResponse = responses[segment.interaction.responseId] || ''}
270
- {@const displayValue = role === 'scorer' && correctAnswer !== null ? correctAnswer : userResponse}
271
- {@const correctChoice = findCorrectChoice(segment.interaction.choices, correctAnswer)}
272
- <span class="inline-choice-wrapper" style="display: inline-block; position: relative;">
273
- <select
274
- class="select select-bordered select-sm inline-select"
275
- class:border-success={correctAnswer !== null}
276
- class:bg-success={correctAnswer !== null}
277
- class:bg-opacity-10={correctAnswer !== null}
278
- style="display: inline-block; margin: 0 4px; width: auto; min-width: 120px;"
279
- aria-label={`Inline choice ${segment.interaction.responseId}${correctAnswer && correctChoice ? '. Correct answer: ' + (correctChoice as any).text : ''}`}
280
- value={displayValue}
281
- onchange={(e) => handleInlineChoiceChange(segment.interaction.responseId, e)}
282
- {disabled}
283
- >
284
- <option value="">{i18n?.t('interactions.inline.selectPlaceholder', 'Select...')}</option>
285
- {#each segment.interaction.choices as choice}
286
- {@const isCorrect = correctAnswer === choice.identifier}
287
- <option value={choice.identifier}>
288
- {choice.text}{isCorrect ? ' ✓' : ''}
289
- </option>
290
- {/each}
291
- </select>
292
- {#if correctAnswer !== null && correctChoice}
293
- <span class="badge badge-success badge-sm" style="position: absolute; top: -1.5rem; left: 0; white-space: nowrap; font-size: 0.7rem;">
294
- {i18n?.t('interactions.choice.correct', 'Correct') ?? 'Correct'}: {(correctChoice as any).text}
295
- </span>
296
- {/if}
297
- </span>
236
+ {@const correctAnswer = roleCapabilities.canViewCorrectResponses ? (correctResponses[segment.interaction.responseId] ?? null) : null}
237
+ <InlineChoice
238
+ interaction={segment.interaction}
239
+ response={getStringResponse(segment.interaction.responseId)}
240
+ correctAnswer={roleCapabilities.canViewCorrectResponses ? correctAnswer : null}
241
+ disabled={effectiveDisabled}
242
+ {i18n}
243
+ onResponseChange={handleResponseChange}
244
+ />
298
245
  {/if}
299
246
  {/each}
300
247
  </div>
@@ -310,11 +257,11 @@
310
257
  typeset,
311
258
  interaction,
312
259
  response: responses[interaction.responseId] ?? null,
313
- correctResponse: role === 'scorer' ? correctRespForInteraction : null,
314
- disabled,
260
+ correctResponse: roleCapabilities.canViewCorrectResponses ? correctRespForInteraction : null,
261
+ disabled: effectiveDisabled,
315
262
  // Avoid invalid ARIA role values on custom-element hosts.
316
263
  // Components default to candidate when role is omitted.
317
- role: role === 'scorer' ? 'scorer' : undefined,
264
+ role: roleCapabilities.canViewCorrectResponses ? 'scorer' : undefined,
318
265
  }}
319
266
  />
320
267
  {/each}
@@ -381,4 +328,27 @@
381
328
  border-left: 2px solid var(--color-base-content, currentColor);
382
329
  opacity: 0.8;
383
330
  }
331
+
332
+ /* QTI 3.0 Shared Stimulus: stimulus blocks that were prepended before the item body */
333
+ :global(.qti-stimulus-block) {
334
+ margin-bottom: 1rem;
335
+ }
336
+
337
+ /* QTI 3.0 Shared Vocabulary: qti-input-width-N sets minimum input width in character units. */
338
+ :global(.qti-input-width-1) { min-width: 1ch; }
339
+ :global(.qti-input-width-2) { min-width: 2ch; }
340
+ :global(.qti-input-width-3) { min-width: 3ch; }
341
+ :global(.qti-input-width-4) { min-width: 4ch; }
342
+ :global(.qti-input-width-5) { min-width: 5ch; }
343
+ :global(.qti-input-width-6) { min-width: 6ch; }
344
+ :global(.qti-input-width-10) { min-width: 10ch; }
345
+ :global(.qti-input-width-15) { min-width: 15ch; }
346
+ :global(.qti-input-width-20) { min-width: 20ch; }
347
+ :global(.qti-input-width-25) { min-width: 25ch; }
348
+ :global(.qti-input-width-30) { min-width: 30ch; }
349
+ :global(.qti-input-width-35) { min-width: 35ch; }
350
+ :global(.qti-input-width-40) { min-width: 40ch; }
351
+ :global(.qti-input-width-45) { min-width: 45ch; }
352
+ :global(.qti-input-width-50) { min-width: 50ch; }
353
+ :global(.qti-input-width-72) { min-width: 72ch; }
384
354
  </style>
@@ -1,10 +1,15 @@
1
1
  <script lang="ts">
2
2
  import { Player } from '../core/Player';
3
- import type { AdaptiveAttemptResult, ModalFeedback, PlayerSecurityConfig, QTIRole } from '../types';
3
+ import type { AdaptiveAttemptResult, ModalFeedback, PlayerSecurityConfig, QTIRole, ScoringResult } from '../types';
4
+ import type { InteractionResponseValue } from '../web-components';
4
5
  import type { I18nProvider } from '@pie-qti/i18n';
6
+ import { typesetMathInElement } from '@pie-qti/typeset-katex';
5
7
  import ItemBody from './ItemBody.svelte';
6
8
  import ModalFeedbackDisplay from './ModalFeedbackDisplay.svelte';
7
9
 
10
+ type ItemResponseValue = InteractionResponseValue | null;
11
+ type ItemResponseMap = Record<string, ItemResponseValue>;
12
+
8
13
  interface Props {
9
14
  itemXml: string;
10
15
  role?: QTIRole;
@@ -13,8 +18,8 @@
13
18
  disabled?: boolean;
14
19
  typeset?: (element: HTMLElement) => void;
15
20
  i18n?: I18nProvider;
16
- onResponseChange?: (responseId: string, value: any) => void;
17
- onSubmit?: (responses: Record<string, any>, scoringResult: any) => void;
21
+ onResponseChange?: (responseId: string, value: ItemResponseValue) => void;
22
+ onSubmit?: (responses: ItemResponseMap, scoringResult: ScoringResult) => void;
18
23
  /** Called when adaptive item completes (all attempts exhausted) */
19
24
  onComplete?: (finalResult: AdaptiveAttemptResult) => void;
20
25
  }
@@ -31,9 +36,12 @@
31
36
  onComplete,
32
37
  }: Props = $props();
33
38
 
39
+ // Use host-provided typeset if given, otherwise fall back to the built-in KaTeX typesetter.
40
+ const effectiveTypeset = $derived(typeset ?? typesetMathInElement);
41
+
34
42
  // Create player instance
35
43
  let player = $state<Player | null>(null);
36
- let responses = $state<Record<string, any>>({});
44
+ let responses = $state<ItemResponseMap>({});
37
45
  let error = $state<string | null>(null);
38
46
  let modalFeedback = $state<ModalFeedback[]>([]);
39
47
  let outcomeValues = $state<Record<string, any>>({});
@@ -59,7 +67,7 @@
59
67
  }
60
68
  });
61
69
 
62
- function handleResponseChange(responseId: string, value: any) {
70
+ function handleResponseChange(responseId: string, value: ItemResponseValue) {
63
71
  responses = { ...responses, [responseId]: value };
64
72
  onResponseChange?.(responseId, value);
65
73
  }
@@ -116,7 +124,7 @@
116
124
  {responses}
117
125
  {disabled}
118
126
  {role}
119
- {typeset}
127
+ typeset={effectiveTypeset}
120
128
  {i18n}
121
129
  {outcomeValues}
122
130
  onResponseChange={handleResponseChange}
@@ -146,7 +154,7 @@
146
154
  {/if}
147
155
 
148
156
  <!-- Modal feedback display -->
149
- <ModalFeedbackDisplay feedback={modalFeedback} onClose={closeFeedback} {typeset} {i18n} />
157
+ <ModalFeedbackDisplay feedback={modalFeedback} onClose={closeFeedback} typeset={effectiveTypeset} {i18n} />
150
158
  {:else}
151
159
  <div class="alert alert-info">
152
160
  <span>{i18n?.t('item.loading') ?? 'item.loading'}</span>
@@ -14,6 +14,8 @@
14
14
 
15
15
  // Show modal if there's feedback
16
16
  const hasActiveFeedback = $derived(feedback.length > 0);
17
+ const modalTitleId = 'item-player-modal-feedback-title';
18
+ const firstTitle = $derived(feedback.find((item) => item.title)?.title);
17
19
 
18
20
  function handleClose() {
19
21
  onClose?.();
@@ -29,13 +31,21 @@
29
31
 
30
32
  {#if hasActiveFeedback}
31
33
  <!-- DaisyUI Modal -->
32
- <dialog class="modal modal-open" onclick={handleBackdropClick}>
34
+ <dialog
35
+ open
36
+ class="modal modal-open"
37
+ aria-modal="true"
38
+ aria-labelledby={firstTitle ? modalTitleId : undefined}
39
+ aria-label={firstTitle ? undefined : (i18n?.t('feedback.title') ?? 'Feedback')}
40
+ onclick={handleBackdropClick}
41
+ >
33
42
  <div class="modal-box max-w-3xl">
34
43
  <!-- Close button -->
35
44
  <button
36
45
  class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
46
+ type="button"
37
47
  onclick={handleClose}
38
- aria-label={i18n?.t('feedback.closeFeedback') ?? 'feedback.closeFeedback'}
48
+ aria-label={i18n?.t('feedback.closeFeedback') ?? 'Close feedback'}
39
49
  >
40
50
  ✕
41
51
  </button>
@@ -44,7 +54,7 @@
44
54
  {#each feedback as item, index}
45
55
  <div class="mb-4 {index < feedback.length - 1 ? 'border-b pb-4' : ''}">
46
56
  {#if item.title}
47
- <h3 class="font-bold text-lg mb-2">{item.title}</h3>
57
+ <h3 id={index === 0 ? modalTitleId : undefined} class="font-bold text-lg mb-2">{item.title}</h3>
48
58
  {/if}
49
59
 
50
60
  <!-- Render HTML content with MathJax support -->
@@ -65,8 +75,8 @@
65
75
 
66
76
  <!-- Action buttons -->
67
77
  <div class="modal-action">
68
- <button class="btn btn-primary" onclick={handleClose}>
69
- {i18n?.t('common.continue') ?? 'common.continue'}
78
+ <button class="btn btn-primary" type="button" onclick={handleClose}>
79
+ {i18n?.t('common.continue') ?? 'Continue'}
70
80
  </button>
71
81
  </div>
72
82
  </div>
@@ -17,3 +17,6 @@ export { default as ModalFeedbackDisplay } from './ModalFeedbackDisplay.svelte';
17
17
 
18
18
  // Utility actions (dependency-free)
19
19
  export { typesetAction } from './actions/typesetAction';
20
+
21
+ // Catalog actions
22
+ export { glossaryAction, type GlossaryActionParams } from '../catalog/glossaryAction';
@@ -21,8 +21,9 @@ export interface ComponentConfig<TData extends InteractionData = InteractionData
21
21
  * - 50: Moderately specific custom renderers
22
22
  * - 10: Generic custom renderers
23
23
  * - 0: Default fallback renderers
24
+ * Default: 0
24
25
  */
25
- priority: number;
26
+ priority?: number;
26
27
 
27
28
  /** Optional description for debugging/error messages */
28
29
  description?: string;
@@ -31,8 +32,9 @@ export interface ComponentConfig<TData extends InteractionData = InteractionData
31
32
  * Predicate to determine if this component can handle the interaction
32
33
  * Evaluated in priority order (highest first)
33
34
  * @returns true if this component should be used
35
+ * Default: always true
34
36
  */
35
- canHandle: (data: TData) => boolean;
37
+ canHandle?: (data: TData) => boolean;
36
38
 
37
39
  /**
38
40
  * Web component tag name (must contain a hyphen per web component spec)
@@ -57,7 +59,10 @@ export interface ComponentConfig<TData extends InteractionData = InteractionData
57
59
  * Internal registered component with metadata
58
60
  */
59
61
  interface RegisteredComponent<TData extends InteractionData = InteractionData> {
60
- config: ComponentConfig<TData>;
62
+ config: ComponentConfig<TData> & {
63
+ priority: number;
64
+ canHandle: (data: TData) => boolean;
65
+ };
61
66
  }
62
67
 
63
68
  /**
@@ -88,8 +93,6 @@ export class ComponentRegistry {
88
93
  * // Default choice component
89
94
  * registry.register('choiceInteraction', {
90
95
  * name: 'standard-choice',
91
- * priority: 0,
92
- * canHandle: () => true,
93
96
  * tagName: 'qti-choice-interaction'
94
97
  * });
95
98
  */
@@ -122,11 +125,23 @@ export class ComponentRegistry {
122
125
  this.components.set(type, components);
123
126
  }
124
127
 
125
- // Add component and sort by priority (highest first)
126
- components.push({ config } as RegisteredComponent);
128
+ // Add normalized component and sort by priority (highest first)
129
+ components.push(this.createRegisteredComponent(config) as RegisteredComponent);
127
130
  components.sort((a, b) => b.config.priority - a.config.priority);
128
131
  }
129
132
 
133
+ private createRegisteredComponent<TData extends InteractionData>(
134
+ config: ComponentConfig<TData>
135
+ ): RegisteredComponent<TData> {
136
+ return {
137
+ config: {
138
+ ...config,
139
+ priority: config.priority ?? 0,
140
+ canHandle: config.canHandle ?? (() => true),
141
+ },
142
+ };
143
+ }
144
+
130
145
  /**
131
146
  * Get a web component tag name for an interaction type
132
147
  * Evaluates canHandle predicates in priority order
@@ -189,6 +204,20 @@ export class ComponentRegistry {
189
204
  hasComponent(type: string): boolean {
190
205
  return this.components.has(type) && this.components.get(type)!.length > 0;
191
206
  }
207
+
208
+ /**
209
+ * Get the tag name for a registered type by name (no canHandle evaluation).
210
+ * Useful for non-interaction components like catalogPopup where the type string
211
+ * is known and there is no InteractionData object to pass.
212
+ *
213
+ * Returns the highest-priority registered tag name for the type, or null if
214
+ * the type is not registered.
215
+ */
216
+ getTagNameForType(type: string): string | null {
217
+ const components = this.components.get(type);
218
+ if (!components || components.length === 0) return null;
219
+ return components[0].config.tagName;
220
+ }
192
221
  }
193
222
 
194
223
  /**