@pie-qti/item-player 0.1.5 → 0.1.7

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 (461) hide show
  1. package/dist/catalog/applyGlossaryTriggers.d.ts +2 -1
  2. package/dist/catalog/applyGlossaryTriggers.d.ts.map +1 -1
  3. package/dist/catalog/applyGlossaryTriggers.js +145 -30
  4. package/dist/catalog/glossaryAction.d.ts.map +1 -1
  5. package/dist/catalog/glossaryAction.js +14 -4
  6. package/dist/components/utils/stimulusRender.d.ts +17 -0
  7. package/dist/components/utils/stimulusRender.d.ts.map +1 -0
  8. package/dist/components/utils/stimulusRender.js +70 -0
  9. package/dist/components/utils/stylesheetRender.d.ts +4 -0
  10. package/dist/components/utils/stylesheetRender.d.ts.map +1 -0
  11. package/dist/components/utils/stylesheetRender.js +57 -0
  12. package/dist/core/ComponentRegistry.d.ts +5 -4
  13. package/dist/core/ComponentRegistry.d.ts.map +1 -1
  14. package/dist/core/ComponentRegistry.js +11 -4
  15. package/dist/core/ItemRenderer.d.ts.map +1 -1
  16. package/dist/core/ItemRenderer.js +5 -18
  17. package/dist/core/Player.d.ts +39 -4
  18. package/dist/core/Player.d.ts.map +1 -1
  19. package/dist/core/Player.js +364 -193
  20. package/dist/document/AssessmentItemDocument.d.ts +42 -0
  21. package/dist/document/AssessmentItemDocument.d.ts.map +1 -0
  22. package/dist/document/AssessmentItemDocument.js +116 -0
  23. package/dist/element.js +3318 -2733
  24. package/dist/element.js.map +1 -1
  25. package/dist/extraction/extractors/associateExtractor.d.ts +1 -28
  26. package/dist/extraction/extractors/associateExtractor.d.ts.map +1 -1
  27. package/dist/extraction/extractors/associateExtractor.js +1 -97
  28. package/dist/extraction/extractors/choiceExtractor.d.ts +1 -26
  29. package/dist/extraction/extractors/choiceExtractor.d.ts.map +1 -1
  30. package/dist/extraction/extractors/choiceExtractor.js +1 -93
  31. package/dist/extraction/extractors/customExtractor.d.ts +1 -19
  32. package/dist/extraction/extractors/customExtractor.d.ts.map +1 -1
  33. package/dist/extraction/extractors/customExtractor.js +1 -51
  34. package/dist/extraction/extractors/drawingExtractor.d.ts +1 -29
  35. package/dist/extraction/extractors/drawingExtractor.d.ts.map +1 -1
  36. package/dist/extraction/extractors/drawingExtractor.js +1 -78
  37. package/dist/extraction/extractors/endAttemptExtractor.d.ts +1 -19
  38. package/dist/extraction/extractors/endAttemptExtractor.d.ts.map +1 -1
  39. package/dist/extraction/extractors/endAttemptExtractor.js +1 -53
  40. package/dist/extraction/extractors/extendedTextExtractor.d.ts +1 -20
  41. package/dist/extraction/extractors/extendedTextExtractor.d.ts.map +1 -1
  42. package/dist/extraction/extractors/extendedTextExtractor.js +1 -63
  43. package/dist/extraction/extractors/gapMatchExtractor.d.ts +1 -28
  44. package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +1 -1
  45. package/dist/extraction/extractors/gapMatchExtractor.js +1 -155
  46. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +1 -40
  47. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +1 -1
  48. package/dist/extraction/extractors/graphicAssociateExtractor.js +1 -143
  49. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +1 -52
  50. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +1 -1
  51. package/dist/extraction/extractors/graphicGapMatchExtractor.js +1 -205
  52. package/dist/extraction/extractors/graphicOrderExtractor.d.ts +1 -36
  53. package/dist/extraction/extractors/graphicOrderExtractor.d.ts.map +1 -1
  54. package/dist/extraction/extractors/graphicOrderExtractor.js +1 -121
  55. package/dist/extraction/extractors/hotspotExtractor.d.ts +1 -37
  56. package/dist/extraction/extractors/hotspotExtractor.d.ts.map +1 -1
  57. package/dist/extraction/extractors/hotspotExtractor.js +1 -159
  58. package/dist/extraction/extractors/hottextExtractor.d.ts +1 -25
  59. package/dist/extraction/extractors/hottextExtractor.d.ts.map +1 -1
  60. package/dist/extraction/extractors/hottextExtractor.js +1 -128
  61. package/dist/extraction/extractors/index.d.ts +5 -59
  62. package/dist/extraction/extractors/index.d.ts.map +1 -1
  63. package/dist/extraction/extractors/index.js +5 -85
  64. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +1 -24
  65. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +1 -1
  66. package/dist/extraction/extractors/inlineChoiceExtractor.js +1 -80
  67. package/dist/extraction/extractors/matchExtractor.d.ts +1 -36
  68. package/dist/extraction/extractors/matchExtractor.d.ts.map +1 -1
  69. package/dist/extraction/extractors/matchExtractor.js +1 -160
  70. package/dist/extraction/extractors/mediaExtractor.d.ts +1 -32
  71. package/dist/extraction/extractors/mediaExtractor.d.ts.map +1 -1
  72. package/dist/extraction/extractors/mediaExtractor.js +1 -125
  73. package/dist/extraction/extractors/orderExtractor.d.ts +1 -27
  74. package/dist/extraction/extractors/orderExtractor.d.ts.map +1 -1
  75. package/dist/extraction/extractors/orderExtractor.js +1 -90
  76. package/dist/extraction/extractors/portableCustomExtractor.d.ts +1 -13
  77. package/dist/extraction/extractors/portableCustomExtractor.d.ts.map +1 -1
  78. package/dist/extraction/extractors/portableCustomExtractor.js +1 -96
  79. package/dist/extraction/extractors/positionObjectExtractor.d.ts +1 -58
  80. package/dist/extraction/extractors/positionObjectExtractor.d.ts.map +1 -1
  81. package/dist/extraction/extractors/positionObjectExtractor.js +1 -191
  82. package/dist/extraction/extractors/selectPointExtractor.d.ts +1 -30
  83. package/dist/extraction/extractors/selectPointExtractor.d.ts.map +1 -1
  84. package/dist/extraction/extractors/selectPointExtractor.js +1 -109
  85. package/dist/extraction/extractors/sliderExtractor.d.ts +1 -23
  86. package/dist/extraction/extractors/sliderExtractor.d.ts.map +1 -1
  87. package/dist/extraction/extractors/sliderExtractor.js +1 -73
  88. package/dist/extraction/extractors/textEntryExtractor.d.ts +1 -20
  89. package/dist/extraction/extractors/textEntryExtractor.d.ts.map +1 -1
  90. package/dist/extraction/extractors/textEntryExtractor.js +1 -54
  91. package/dist/extraction/extractors/uploadExtractor.d.ts +1 -19
  92. package/dist/extraction/extractors/uploadExtractor.d.ts.map +1 -1
  93. package/dist/extraction/extractors/uploadExtractor.js +1 -59
  94. package/dist/extraction/index.d.ts +1 -1
  95. package/dist/extraction/index.d.ts.map +1 -1
  96. package/dist/extraction/index.js +2 -2
  97. package/dist/extraction/interactionExtractionPipeline.d.ts +13 -0
  98. package/dist/extraction/interactionExtractionPipeline.d.ts.map +1 -0
  99. package/dist/extraction/interactionExtractionPipeline.js +39 -0
  100. package/dist/extraction/interactionSecurity.d.ts +4 -0
  101. package/dist/extraction/interactionSecurity.d.ts.map +1 -0
  102. package/dist/extraction/interactionSecurity.js +48 -0
  103. package/dist/index.d.ts +2 -1
  104. package/dist/index.d.ts.map +1 -1
  105. package/dist/index.js +3 -3
  106. package/dist/interactions/associate/extractor.d.ts +29 -0
  107. package/dist/interactions/associate/extractor.d.ts.map +1 -0
  108. package/dist/interactions/associate/extractor.js +97 -0
  109. package/dist/interactions/associate/index.d.ts +3 -0
  110. package/dist/interactions/associate/index.d.ts.map +1 -0
  111. package/dist/interactions/associate/index.js +1 -0
  112. package/dist/interactions/associate/types.d.ts +2 -0
  113. package/dist/interactions/associate/types.d.ts.map +1 -0
  114. package/dist/interactions/associate/types.js +1 -0
  115. package/dist/interactions/choice/extractor.d.ts +27 -0
  116. package/dist/interactions/choice/extractor.d.ts.map +1 -0
  117. package/dist/interactions/choice/extractor.js +93 -0
  118. package/dist/interactions/choice/index.d.ts +3 -0
  119. package/dist/interactions/choice/index.d.ts.map +1 -0
  120. package/dist/interactions/choice/index.js +1 -0
  121. package/dist/interactions/choice/types.d.ts +2 -0
  122. package/dist/interactions/choice/types.d.ts.map +1 -0
  123. package/dist/interactions/choice/types.js +1 -0
  124. package/dist/interactions/custom/extractor.d.ts +20 -0
  125. package/dist/interactions/custom/extractor.d.ts.map +1 -0
  126. package/dist/interactions/custom/extractor.js +51 -0
  127. package/dist/interactions/custom/index.d.ts +3 -0
  128. package/dist/interactions/custom/index.d.ts.map +1 -0
  129. package/dist/interactions/custom/index.js +1 -0
  130. package/dist/interactions/custom/types.d.ts +2 -0
  131. package/dist/interactions/custom/types.d.ts.map +1 -0
  132. package/dist/interactions/custom/types.js +1 -0
  133. package/dist/interactions/drawing/extractor.d.ts +30 -0
  134. package/dist/interactions/drawing/extractor.d.ts.map +1 -0
  135. package/dist/interactions/drawing/extractor.js +78 -0
  136. package/dist/interactions/drawing/index.d.ts +3 -0
  137. package/dist/interactions/drawing/index.d.ts.map +1 -0
  138. package/dist/interactions/drawing/index.js +1 -0
  139. package/dist/interactions/drawing/types.d.ts +2 -0
  140. package/dist/interactions/drawing/types.d.ts.map +1 -0
  141. package/dist/interactions/drawing/types.js +1 -0
  142. package/dist/interactions/end-attempt/extractor.d.ts +20 -0
  143. package/dist/interactions/end-attempt/extractor.d.ts.map +1 -0
  144. package/dist/interactions/end-attempt/extractor.js +53 -0
  145. package/dist/interactions/end-attempt/index.d.ts +3 -0
  146. package/dist/interactions/end-attempt/index.d.ts.map +1 -0
  147. package/dist/interactions/end-attempt/index.js +1 -0
  148. package/dist/interactions/end-attempt/types.d.ts +2 -0
  149. package/dist/interactions/end-attempt/types.d.ts.map +1 -0
  150. package/dist/interactions/end-attempt/types.js +1 -0
  151. package/dist/interactions/extended-text/extractor.d.ts +21 -0
  152. package/dist/interactions/extended-text/extractor.d.ts.map +1 -0
  153. package/dist/interactions/extended-text/extractor.js +63 -0
  154. package/dist/interactions/extended-text/index.d.ts +3 -0
  155. package/dist/interactions/extended-text/index.d.ts.map +1 -0
  156. package/dist/interactions/extended-text/index.js +1 -0
  157. package/dist/interactions/extended-text/types.d.ts +2 -0
  158. package/dist/interactions/extended-text/types.d.ts.map +1 -0
  159. package/dist/interactions/extended-text/types.js +1 -0
  160. package/dist/interactions/gap-match/extractor.d.ts +29 -0
  161. package/dist/interactions/gap-match/extractor.d.ts.map +1 -0
  162. package/dist/interactions/gap-match/extractor.js +155 -0
  163. package/dist/interactions/gap-match/index.d.ts +3 -0
  164. package/dist/interactions/gap-match/index.d.ts.map +1 -0
  165. package/dist/interactions/gap-match/index.js +1 -0
  166. package/dist/interactions/gap-match/types.d.ts +2 -0
  167. package/dist/interactions/gap-match/types.d.ts.map +1 -0
  168. package/dist/interactions/gap-match/types.js +1 -0
  169. package/dist/interactions/graphic-associate/extractor.d.ts +41 -0
  170. package/dist/interactions/graphic-associate/extractor.d.ts.map +1 -0
  171. package/dist/interactions/graphic-associate/extractor.js +143 -0
  172. package/dist/interactions/graphic-associate/index.d.ts +3 -0
  173. package/dist/interactions/graphic-associate/index.d.ts.map +1 -0
  174. package/dist/interactions/graphic-associate/index.js +1 -0
  175. package/dist/interactions/graphic-associate/types.d.ts +2 -0
  176. package/dist/interactions/graphic-associate/types.d.ts.map +1 -0
  177. package/dist/interactions/graphic-associate/types.js +1 -0
  178. package/dist/interactions/graphic-gap-match/extractor.d.ts +53 -0
  179. package/dist/interactions/graphic-gap-match/extractor.d.ts.map +1 -0
  180. package/dist/interactions/graphic-gap-match/extractor.js +205 -0
  181. package/dist/interactions/graphic-gap-match/index.d.ts +3 -0
  182. package/dist/interactions/graphic-gap-match/index.d.ts.map +1 -0
  183. package/dist/interactions/graphic-gap-match/index.js +1 -0
  184. package/dist/interactions/graphic-gap-match/types.d.ts +2 -0
  185. package/dist/interactions/graphic-gap-match/types.d.ts.map +1 -0
  186. package/dist/interactions/graphic-gap-match/types.js +1 -0
  187. package/dist/interactions/graphic-order/extractor.d.ts +37 -0
  188. package/dist/interactions/graphic-order/extractor.d.ts.map +1 -0
  189. package/dist/interactions/graphic-order/extractor.js +121 -0
  190. package/dist/interactions/graphic-order/index.d.ts +3 -0
  191. package/dist/interactions/graphic-order/index.d.ts.map +1 -0
  192. package/dist/interactions/graphic-order/index.js +1 -0
  193. package/dist/interactions/graphic-order/types.d.ts +2 -0
  194. package/dist/interactions/graphic-order/types.d.ts.map +1 -0
  195. package/dist/interactions/graphic-order/types.js +1 -0
  196. package/dist/interactions/hotspot/extractor.d.ts +38 -0
  197. package/dist/interactions/hotspot/extractor.d.ts.map +1 -0
  198. package/dist/interactions/hotspot/extractor.js +159 -0
  199. package/dist/interactions/hotspot/index.d.ts +3 -0
  200. package/dist/interactions/hotspot/index.d.ts.map +1 -0
  201. package/dist/interactions/hotspot/index.js +1 -0
  202. package/dist/interactions/hotspot/types.d.ts +2 -0
  203. package/dist/interactions/hotspot/types.d.ts.map +1 -0
  204. package/dist/interactions/hotspot/types.js +1 -0
  205. package/dist/interactions/hottext/extractor.d.ts +26 -0
  206. package/dist/interactions/hottext/extractor.d.ts.map +1 -0
  207. package/dist/interactions/hottext/extractor.js +128 -0
  208. package/dist/interactions/hottext/index.d.ts +3 -0
  209. package/dist/interactions/hottext/index.d.ts.map +1 -0
  210. package/dist/interactions/hottext/index.js +1 -0
  211. package/dist/interactions/hottext/types.d.ts +2 -0
  212. package/dist/interactions/hottext/types.d.ts.map +1 -0
  213. package/dist/interactions/hottext/types.js +1 -0
  214. package/dist/interactions/index.d.ts +33 -0
  215. package/dist/interactions/index.d.ts.map +1 -0
  216. package/dist/interactions/index.js +30 -0
  217. package/dist/interactions/inline/index.d.ts +2 -0
  218. package/dist/interactions/inline/index.d.ts.map +1 -0
  219. package/dist/interactions/inline/index.js +1 -0
  220. package/dist/interactions/inline/render-plan.d.ts +19 -0
  221. package/dist/interactions/inline/render-plan.d.ts.map +1 -0
  222. package/dist/interactions/inline/render-plan.js +59 -0
  223. package/dist/interactions/inline-choice/extractor.d.ts +25 -0
  224. package/dist/interactions/inline-choice/extractor.d.ts.map +1 -0
  225. package/dist/interactions/inline-choice/extractor.js +80 -0
  226. package/dist/interactions/inline-choice/index.d.ts +3 -0
  227. package/dist/interactions/inline-choice/index.d.ts.map +1 -0
  228. package/dist/interactions/inline-choice/index.js +1 -0
  229. package/dist/interactions/inline-choice/types.d.ts +2 -0
  230. package/dist/interactions/inline-choice/types.d.ts.map +1 -0
  231. package/dist/interactions/inline-choice/types.js +1 -0
  232. package/dist/interactions/match/extractor.d.ts +37 -0
  233. package/dist/interactions/match/extractor.d.ts.map +1 -0
  234. package/dist/interactions/match/extractor.js +160 -0
  235. package/dist/interactions/match/index.d.ts +3 -0
  236. package/dist/interactions/match/index.d.ts.map +1 -0
  237. package/dist/interactions/match/index.js +1 -0
  238. package/dist/interactions/match/types.d.ts +2 -0
  239. package/dist/interactions/match/types.d.ts.map +1 -0
  240. package/dist/interactions/match/types.js +1 -0
  241. package/dist/interactions/media/extractor.d.ts +33 -0
  242. package/dist/interactions/media/extractor.d.ts.map +1 -0
  243. package/dist/interactions/media/extractor.js +125 -0
  244. package/dist/interactions/media/index.d.ts +3 -0
  245. package/dist/interactions/media/index.d.ts.map +1 -0
  246. package/dist/interactions/media/index.js +1 -0
  247. package/dist/interactions/media/types.d.ts +2 -0
  248. package/dist/interactions/media/types.d.ts.map +1 -0
  249. package/dist/interactions/media/types.js +1 -0
  250. package/dist/interactions/modules.d.ts +105 -0
  251. package/dist/interactions/modules.d.ts.map +1 -0
  252. package/dist/interactions/modules.js +86 -0
  253. package/dist/interactions/order/extractor.d.ts +28 -0
  254. package/dist/interactions/order/extractor.d.ts.map +1 -0
  255. package/dist/interactions/order/extractor.js +90 -0
  256. package/dist/interactions/order/index.d.ts +3 -0
  257. package/dist/interactions/order/index.d.ts.map +1 -0
  258. package/dist/interactions/order/index.js +1 -0
  259. package/dist/interactions/order/types.d.ts +2 -0
  260. package/dist/interactions/order/types.d.ts.map +1 -0
  261. package/dist/interactions/order/types.js +1 -0
  262. package/dist/interactions/portable-custom/extractor.d.ts +14 -0
  263. package/dist/interactions/portable-custom/extractor.d.ts.map +1 -0
  264. package/dist/interactions/portable-custom/extractor.js +96 -0
  265. package/dist/interactions/portable-custom/index.d.ts +3 -0
  266. package/dist/interactions/portable-custom/index.d.ts.map +1 -0
  267. package/dist/interactions/portable-custom/index.js +1 -0
  268. package/dist/interactions/portable-custom/types.d.ts +2 -0
  269. package/dist/interactions/portable-custom/types.d.ts.map +1 -0
  270. package/dist/interactions/portable-custom/types.js +1 -0
  271. package/dist/interactions/position-object/extractor.d.ts +59 -0
  272. package/dist/interactions/position-object/extractor.d.ts.map +1 -0
  273. package/dist/interactions/position-object/extractor.js +191 -0
  274. package/dist/interactions/position-object/index.d.ts +3 -0
  275. package/dist/interactions/position-object/index.d.ts.map +1 -0
  276. package/dist/interactions/position-object/index.js +1 -0
  277. package/dist/interactions/position-object/types.d.ts +2 -0
  278. package/dist/interactions/position-object/types.d.ts.map +1 -0
  279. package/dist/interactions/position-object/types.js +1 -0
  280. package/dist/interactions/select-point/extractor.d.ts +31 -0
  281. package/dist/interactions/select-point/extractor.d.ts.map +1 -0
  282. package/dist/interactions/select-point/extractor.js +109 -0
  283. package/dist/interactions/select-point/index.d.ts +3 -0
  284. package/dist/interactions/select-point/index.d.ts.map +1 -0
  285. package/dist/interactions/select-point/index.js +1 -0
  286. package/dist/interactions/select-point/types.d.ts +2 -0
  287. package/dist/interactions/select-point/types.d.ts.map +1 -0
  288. package/dist/interactions/select-point/types.js +1 -0
  289. package/dist/interactions/shared/index.d.ts +2 -0
  290. package/dist/interactions/shared/index.d.ts.map +1 -0
  291. package/dist/interactions/shared/index.js +1 -0
  292. package/dist/interactions/shared/types.d.ts +412 -0
  293. package/dist/interactions/shared/types.d.ts.map +1 -0
  294. package/dist/interactions/shared/types.js +7 -0
  295. package/dist/interactions/slider/extractor.d.ts +24 -0
  296. package/dist/interactions/slider/extractor.d.ts.map +1 -0
  297. package/dist/interactions/slider/extractor.js +73 -0
  298. package/dist/interactions/slider/index.d.ts +3 -0
  299. package/dist/interactions/slider/index.d.ts.map +1 -0
  300. package/dist/interactions/slider/index.js +1 -0
  301. package/dist/interactions/slider/types.d.ts +2 -0
  302. package/dist/interactions/slider/types.d.ts.map +1 -0
  303. package/dist/interactions/slider/types.js +1 -0
  304. package/dist/interactions/text-entry/extractor.d.ts +21 -0
  305. package/dist/interactions/text-entry/extractor.d.ts.map +1 -0
  306. package/dist/interactions/text-entry/extractor.js +54 -0
  307. package/dist/interactions/text-entry/index.d.ts +3 -0
  308. package/dist/interactions/text-entry/index.d.ts.map +1 -0
  309. package/dist/interactions/text-entry/index.js +1 -0
  310. package/dist/interactions/text-entry/types.d.ts +2 -0
  311. package/dist/interactions/text-entry/types.d.ts.map +1 -0
  312. package/dist/interactions/text-entry/types.js +1 -0
  313. package/dist/interactions/upload/extractor.d.ts +20 -0
  314. package/dist/interactions/upload/extractor.d.ts.map +1 -0
  315. package/dist/interactions/upload/extractor.js +59 -0
  316. package/dist/interactions/upload/index.d.ts +3 -0
  317. package/dist/interactions/upload/index.d.ts.map +1 -0
  318. package/dist/interactions/upload/index.js +1 -0
  319. package/dist/interactions/upload/types.d.ts +2 -0
  320. package/dist/interactions/upload/types.d.ts.map +1 -0
  321. package/dist/interactions/upload/types.js +1 -0
  322. package/dist/pnp/applyPnp.d.ts.map +1 -1
  323. package/dist/pnp/applyPnp.js +9 -2
  324. package/dist/pnp/parsePnpXml.d.ts.map +1 -1
  325. package/dist/pnp/parsePnpXml.js +91 -3
  326. package/dist/pnp/types.d.ts +24 -1
  327. package/dist/pnp/types.d.ts.map +1 -1
  328. package/dist/types/index.d.ts +47 -0
  329. package/dist/types/index.d.ts.map +1 -1
  330. package/dist/types/interactions.d.ts +4 -408
  331. package/dist/types/interactions.d.ts.map +1 -1
  332. package/dist/types/interactions.js +3 -3
  333. package/dist/web-components/QTIInteractionBase.d.ts +5 -5
  334. package/dist/web-components/QTIInteractionBase.d.ts.map +1 -1
  335. package/dist/web-components/QTIInteractionElement.d.ts +11 -8
  336. package/dist/web-components/QTIInteractionElement.d.ts.map +1 -1
  337. package/dist/web-components/index.d.ts +1 -1
  338. package/dist/web-components/index.d.ts.map +1 -1
  339. package/package.json +6 -6
  340. package/src/catalog/applyGlossaryTriggers.ts +174 -34
  341. package/src/catalog/glossaryAction.ts +14 -4
  342. package/src/components/ItemBody.svelte +71 -200
  343. package/src/components/ItemPlayer.svelte +9 -5
  344. package/src/components/ModalFeedbackDisplay.svelte +15 -5
  345. package/src/components/utils/stimulusRender.ts +93 -0
  346. package/src/components/utils/stylesheetRender.ts +58 -0
  347. package/src/core/ComponentRegistry.ts +22 -7
  348. package/src/core/Player.ts +401 -209
  349. package/src/document/AssessmentItemDocument.ts +178 -0
  350. package/src/extraction/extractors/associateExtractor.ts +1 -133
  351. package/src/extraction/extractors/choiceExtractor.ts +1 -121
  352. package/src/extraction/extractors/customExtractor.ts +1 -72
  353. package/src/extraction/extractors/drawingExtractor.ts +1 -113
  354. package/src/extraction/extractors/endAttemptExtractor.ts +1 -74
  355. package/src/extraction/extractors/extendedTextExtractor.ts +1 -89
  356. package/src/extraction/extractors/gapMatchExtractor.ts +1 -193
  357. package/src/extraction/extractors/graphicAssociateExtractor.ts +1 -192
  358. package/src/extraction/extractors/graphicGapMatchExtractor.ts +1 -257
  359. package/src/extraction/extractors/graphicOrderExtractor.ts +1 -162
  360. package/src/extraction/extractors/hotspotExtractor.ts +1 -208
  361. package/src/extraction/extractors/hottextExtractor.ts +1 -163
  362. package/src/extraction/extractors/index.ts +5 -111
  363. package/src/extraction/extractors/inlineChoiceExtractor.ts +1 -105
  364. package/src/extraction/extractors/matchExtractor.ts +1 -187
  365. package/src/extraction/extractors/mediaExtractor.ts +1 -168
  366. package/src/extraction/extractors/orderExtractor.ts +1 -120
  367. package/src/extraction/extractors/portableCustomExtractor.ts +1 -122
  368. package/src/extraction/extractors/positionObjectExtractor.ts +1 -243
  369. package/src/extraction/extractors/selectPointExtractor.ts +1 -143
  370. package/src/extraction/extractors/sliderExtractor.ts +1 -102
  371. package/src/extraction/extractors/textEntryExtractor.ts +1 -79
  372. package/src/extraction/extractors/uploadExtractor.ts +1 -81
  373. package/src/extraction/index.ts +1 -2
  374. package/src/extraction/interactionExtractionPipeline.ts +70 -0
  375. package/src/extraction/interactionSecurity.ts +60 -0
  376. package/src/index.ts +3 -7
  377. package/src/interactions/associate/extractor.ts +133 -0
  378. package/src/interactions/associate/index.ts +2 -0
  379. package/src/interactions/associate/types.ts +1 -0
  380. package/src/interactions/choice/extractor.ts +121 -0
  381. package/src/interactions/choice/index.ts +2 -0
  382. package/src/interactions/choice/types.ts +1 -0
  383. package/src/interactions/custom/extractor.ts +72 -0
  384. package/src/interactions/custom/index.ts +2 -0
  385. package/src/interactions/custom/types.ts +1 -0
  386. package/src/interactions/drawing/extractor.ts +113 -0
  387. package/src/interactions/drawing/index.ts +2 -0
  388. package/src/interactions/drawing/types.ts +1 -0
  389. package/src/interactions/end-attempt/extractor.ts +74 -0
  390. package/src/interactions/end-attempt/index.ts +2 -0
  391. package/src/interactions/end-attempt/types.ts +1 -0
  392. package/src/interactions/extended-text/extractor.ts +89 -0
  393. package/src/interactions/extended-text/index.ts +2 -0
  394. package/src/interactions/extended-text/types.ts +1 -0
  395. package/src/interactions/gap-match/extractor.ts +193 -0
  396. package/src/interactions/gap-match/index.ts +2 -0
  397. package/src/interactions/gap-match/types.ts +1 -0
  398. package/src/interactions/graphic-associate/extractor.ts +192 -0
  399. package/src/interactions/graphic-associate/index.ts +2 -0
  400. package/src/interactions/graphic-associate/types.ts +1 -0
  401. package/src/interactions/graphic-gap-match/extractor.ts +257 -0
  402. package/src/interactions/graphic-gap-match/index.ts +2 -0
  403. package/src/interactions/graphic-gap-match/types.ts +1 -0
  404. package/src/interactions/graphic-order/extractor.ts +162 -0
  405. package/src/interactions/graphic-order/index.ts +2 -0
  406. package/src/interactions/graphic-order/types.ts +1 -0
  407. package/src/interactions/hotspot/extractor.ts +208 -0
  408. package/src/interactions/hotspot/index.ts +2 -0
  409. package/src/interactions/hotspot/types.ts +1 -0
  410. package/src/interactions/hottext/extractor.ts +163 -0
  411. package/src/interactions/hottext/index.ts +2 -0
  412. package/src/interactions/hottext/types.ts +1 -0
  413. package/src/interactions/index.ts +52 -0
  414. package/src/interactions/inline/index.ts +1 -0
  415. package/src/interactions/inline/render-plan.ts +105 -0
  416. package/src/interactions/inline-choice/InlineChoice.svelte +57 -0
  417. package/src/interactions/inline-choice/extractor.ts +105 -0
  418. package/src/interactions/inline-choice/index.ts +2 -0
  419. package/src/interactions/inline-choice/types.ts +1 -0
  420. package/src/interactions/match/extractor.ts +187 -0
  421. package/src/interactions/match/index.ts +2 -0
  422. package/src/interactions/match/types.ts +1 -0
  423. package/src/interactions/media/extractor.ts +168 -0
  424. package/src/interactions/media/index.ts +2 -0
  425. package/src/interactions/media/types.ts +1 -0
  426. package/src/interactions/modules.ts +111 -0
  427. package/src/interactions/order/extractor.ts +120 -0
  428. package/src/interactions/order/index.ts +2 -0
  429. package/src/interactions/order/types.ts +1 -0
  430. package/src/interactions/portable-custom/extractor.ts +122 -0
  431. package/src/interactions/portable-custom/index.ts +2 -0
  432. package/src/interactions/portable-custom/types.ts +1 -0
  433. package/src/interactions/position-object/extractor.ts +243 -0
  434. package/src/interactions/position-object/index.ts +2 -0
  435. package/src/interactions/position-object/types.ts +1 -0
  436. package/src/interactions/select-point/extractor.ts +143 -0
  437. package/src/interactions/select-point/index.ts +2 -0
  438. package/src/interactions/select-point/types.ts +1 -0
  439. package/src/interactions/shared/index.ts +1 -0
  440. package/src/interactions/shared/types.ts +429 -0
  441. package/src/interactions/slider/extractor.ts +102 -0
  442. package/src/interactions/slider/index.ts +2 -0
  443. package/src/interactions/slider/types.ts +1 -0
  444. package/src/interactions/text-entry/InlineTextEntry.svelte +75 -0
  445. package/src/interactions/text-entry/extractor.ts +79 -0
  446. package/src/interactions/text-entry/index.ts +2 -0
  447. package/src/interactions/text-entry/types.ts +1 -0
  448. package/src/interactions/upload/extractor.ts +81 -0
  449. package/src/interactions/upload/index.ts +2 -0
  450. package/src/interactions/upload/types.ts +1 -0
  451. package/src/pnp/applyPnp.ts +8 -2
  452. package/src/pnp/parsePnpXml.ts +102 -5
  453. package/src/pnp/types.ts +43 -1
  454. package/src/types/index.ts +53 -0
  455. package/src/types/interactions.ts +4 -425
  456. package/src/web-components/QTIInteractionBase.ts +6 -5
  457. package/src/web-components/QTIInteractionElement.ts +15 -8
  458. package/src/web-components/index.ts +1 -0
  459. package/src/__tests__/glossaryTriggers.test.ts +0 -411
  460. package/src/__tests__/pnp.test.ts +0 -250
  461. package/src/core/ItemRenderer.ts +0 -371
@@ -1,29 +1,2 @@
1
- /**
2
- * Standard QTI gapMatchInteraction extractor
3
- *
4
- * Extracts data from gapMatchInteraction elements (drag words into gaps)
5
- */
6
- import type { ElementExtractor } from '../types.js';
7
- /**
8
- * Gap match data extracted from gapMatchInteraction elements
9
- */
10
- export interface GapMatchData {
11
- gapTexts: Array<{
12
- identifier: string;
13
- text: string;
14
- matchMax: number;
15
- matchMin?: number;
16
- matchGroup?: string[];
17
- classes?: string[];
18
- }>;
19
- gaps: string[];
20
- shuffle: boolean;
21
- prompt: string | null;
22
- promptText: string;
23
- }
24
- /**
25
- * Standard QTI gap match interaction extractor
26
- * Handles gapMatchInteraction elements (drag words into gaps in text)
27
- */
28
- export declare const standardGapMatchExtractor: ElementExtractor<GapMatchData>;
1
+ export * from '../../interactions/gap-match/extractor.js';
29
2
  //# sourceMappingURL=gapMatchExtractor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gapMatchExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/gapMatchExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,KAAK,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,gBAAgB,CAAC,YAAY,CAkKpE,CAAC"}
1
+ {"version":3,"file":"gapMatchExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/gapMatchExtractor.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC"}
@@ -1,155 +1 @@
1
- /**
2
- * Standard QTI gapMatchInteraction extractor
3
- *
4
- * Extracts data from gapMatchInteraction elements (drag words into gaps)
5
- */
6
- /**
7
- * Standard QTI gap match interaction extractor
8
- * Handles gapMatchInteraction elements (drag words into gaps in text)
9
- */
10
- export const standardGapMatchExtractor = {
11
- id: 'qti:gap-match-interaction',
12
- name: 'QTI Standard Gap Match Interaction',
13
- priority: 10,
14
- elementTypes: ['gapMatchInteraction'],
15
- description: 'Extracts standard QTI gapMatchInteraction (drag words into gaps)',
16
- canHandle(element, _context) {
17
- // All gapMatchInteraction elements are standard
18
- return element.rawTagName === 'gapMatchInteraction';
19
- },
20
- extract(element, context) {
21
- const { utils } = context;
22
- // Extract gapText children (draggable items)
23
- const gapTextElements = utils.getChildrenByTag(element, 'gapText');
24
- const gapTexts = gapTextElements.map((gapText) => {
25
- const classes = utils.getClasses(gapText);
26
- const matchMax = utils.getNumberAttribute(gapText, 'matchMax', 1);
27
- const matchMin = utils.getNumberAttribute(gapText, 'matchMin', 0);
28
- const matchGroupRaw = utils.getAttribute(gapText, 'matchGroup', '');
29
- const matchGroup = matchGroupRaw.split(/\s+/).filter(Boolean);
30
- return {
31
- identifier: utils.getAttribute(gapText, 'identifier', ''),
32
- text: utils.getTextContent(gapText),
33
- matchMax,
34
- ...(matchMin > 0 ? { matchMin } : {}),
35
- ...(matchGroup.length > 0 ? { matchGroup } : {}),
36
- ...(classes.length > 0 ? { classes } : {}),
37
- };
38
- });
39
- // Extract prompt (optional) and process gap placeholders.
40
- // NOTE: Many QTI items place `<gap>` elements in the interaction content (e.g. a `<p>`/`<blockquote>`)
41
- // rather than inside a `<prompt>` element. Support both patterns.
42
- const promptElements = utils.getChildrenByTag(element, 'prompt');
43
- let prompt = null;
44
- let promptText = '';
45
- const gaps = [];
46
- if (promptElements.length > 0) {
47
- const promptElement = promptElements[0];
48
- prompt = utils.getHtmlContent(promptElement);
49
- // Get the raw HTML content and extract gaps
50
- const promptHtml = promptElement.outerHTML || promptElement.toString();
51
- // Extract gap elements from prompt children
52
- const gapElements = utils.getChildrenByTag(promptElement, 'gap');
53
- for (const gap of gapElements) {
54
- gaps.push(utils.getAttribute(gap, 'identifier', ''));
55
- }
56
- // Replace gap elements with placeholders in the text
57
- promptText = promptHtml
58
- .replace(/<qti-prompt[^>]*>|<prompt[^>]*>/, '')
59
- .replace(/<\/qti-prompt>|<\/prompt>/, '')
60
- .replace(/<(?:qti-)?gap\s+identifier="([^"]+)"[^>]*>/g, '[GAP:$1]')
61
- .replace(/<(?:qti-)?gap\s+identifier='([^']+)'[^>]*>/g, '[GAP:$1]')
62
- .replace(/<\/(?:qti-)?gap>/g, '')
63
- .trim();
64
- }
65
- // If gaps were not found inside a <prompt>, search the full interaction body.
66
- // This handles items where <gap> elements appear in <p>/<blockquote> siblings of <prompt>.
67
- if (gaps.length === 0) {
68
- const interactionHtml = element.outerHTML || element.toString();
69
- const gapIdMatches = Array.from(interactionHtml.matchAll(/<(?:qti-)?gap\s+identifier=(?:"([^"]+)"|'([^']+)')[^>]*\/?>/gi));
70
- for (const m of gapIdMatches) {
71
- const id = (m[1] || m[2] || '').trim();
72
- if (id)
73
- gaps.push(id);
74
- }
75
- if (!promptText) {
76
- // No prompt element either: build promptText from full interaction content.
77
- const interactionHtml2 = element.outerHTML || element.toString();
78
- promptText = interactionHtml2
79
- .replace(/<(?:qti-)?gap-match-interaction[^>]*>|<gapMatchInteraction[^>]*>/, '')
80
- .replace(/<\/(?:qti-)?gap-match-interaction>|<\/gapMatchInteraction>/, '')
81
- .replace(/<(?:qti-)?gap-text[\s\S]*?<\/(?:qti-)?gap-text>|<gapText[\s\S]*?<\/gapText>/g, '')
82
- .replace(/<(?:qti-)?gap\s+identifier="([^"]+)"[^>]*\/?>/g, '[GAP:$1]')
83
- .replace(/<(?:qti-)?gap\s+identifier='([^']+)'[^>]*\/?>/g, '[GAP:$1]')
84
- .replace(/<\/(?:qti-)?gap>/g, '')
85
- .trim();
86
- }
87
- }
88
- // Extract attributes
89
- const shuffle = utils.getBooleanAttribute(element, 'shuffle');
90
- const interactionClasses = utils.getClasses(element);
91
- const choicesContainerWidth = utils.getAttribute(element, 'data-choices-container-width', '') || null;
92
- const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;
93
- const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;
94
- return {
95
- gapTexts,
96
- gaps,
97
- shuffle,
98
- prompt,
99
- promptText,
100
- ...(interactionClasses.length > 0 ? { interactionClasses } : {}),
101
- ...(choicesContainerWidth ? { choicesContainerWidth } : {}),
102
- ...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),
103
- ...(minSelectionsMessage ? { minSelectionsMessage } : {}),
104
- };
105
- },
106
- validate(data) {
107
- const errors = [];
108
- // Validate gapTexts exist
109
- if (!data.gapTexts || data.gapTexts.length === 0) {
110
- errors.push('gapMatchInteraction must have at least one gapText');
111
- }
112
- // Validate gaps exist
113
- if (!data.gaps || data.gaps.length === 0) {
114
- errors.push('gapMatchInteraction must have at least one gap in the prompt');
115
- }
116
- // Validate gapText identifiers
117
- if (data.gapTexts) {
118
- const identifiers = new Set();
119
- for (const gapText of data.gapTexts) {
120
- if (!gapText.identifier) {
121
- errors.push('All gapTexts must have an identifier');
122
- }
123
- else if (identifiers.has(gapText.identifier)) {
124
- errors.push(`Duplicate gapText identifier: ${gapText.identifier}`);
125
- }
126
- else {
127
- identifiers.add(gapText.identifier);
128
- }
129
- // Validate matchMax
130
- if (gapText.matchMax < 0) {
131
- errors.push(`matchMax must be non-negative for gapText ${gapText.identifier}`);
132
- }
133
- }
134
- }
135
- // Validate gap identifiers
136
- if (data.gaps) {
137
- const identifiers = new Set();
138
- for (const gap of data.gaps) {
139
- if (!gap) {
140
- errors.push('All gaps must have an identifier');
141
- }
142
- else if (identifiers.has(gap)) {
143
- errors.push(`Duplicate gap identifier: ${gap}`);
144
- }
145
- else {
146
- identifiers.add(gap);
147
- }
148
- }
149
- }
150
- return {
151
- valid: errors.length === 0,
152
- errors: errors.length > 0 ? errors : undefined,
153
- };
154
- },
155
- };
1
+ export * from '../../interactions/gap-match/extractor.js';
@@ -1,41 +1,2 @@
1
- /**
2
- * Standard QTI graphicAssociateInteraction extractor
3
- *
4
- * Extracts data from graphicAssociateInteraction elements (associate items on image)
5
- */
6
- import type { ElementExtractor } from '../types.js';
7
- /**
8
- * Image data for graphic associate interaction
9
- */
10
- export interface ImageData {
11
- type: 'image' | 'svg';
12
- src?: string;
13
- content?: string;
14
- width?: string;
15
- height?: string;
16
- }
17
- /**
18
- * Graphic associate data extracted from graphicAssociateInteraction elements
19
- */
20
- export interface GraphicAssociateData {
21
- imageData: ImageData | null;
22
- associableHotspots: Array<{
23
- identifier: string;
24
- label: string;
25
- shape: string;
26
- coords: string;
27
- matchMax: number;
28
- matchMin?: number;
29
- matchGroup?: string[];
30
- classes?: string[];
31
- }>;
32
- maxAssociations: number;
33
- minAssociations: number;
34
- prompt: string | null;
35
- }
36
- /**
37
- * Standard QTI graphic associate interaction extractor
38
- * Handles graphicAssociateInteraction elements (creating associations between hotspots)
39
- */
40
- export declare const standardGraphicAssociateExtractor: ElementExtractor<GraphicAssociateData>;
1
+ export * from '../../interactions/graphic-associate/extractor.js';
41
2
  //# sourceMappingURL=graphicAssociateExtractor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphicAssociateExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/graphicAssociateExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,kBAAkB,EAAE,KAAK,CAAC;QACzB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,iCAAiC,EAAE,gBAAgB,CAAC,oBAAoB,CAoJpF,CAAC"}
1
+ {"version":3,"file":"graphicAssociateExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/graphicAssociateExtractor.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC"}
@@ -1,143 +1 @@
1
- /**
2
- * Standard QTI graphicAssociateInteraction extractor
3
- *
4
- * Extracts data from graphicAssociateInteraction elements (associate items on image)
5
- */
6
- /**
7
- * Standard QTI graphic associate interaction extractor
8
- * Handles graphicAssociateInteraction elements (creating associations between hotspots)
9
- */
10
- export const standardGraphicAssociateExtractor = {
11
- id: 'qti:graphic-associate-interaction',
12
- name: 'QTI Standard Graphic Associate Interaction',
13
- priority: 10,
14
- elementTypes: ['graphicAssociateInteraction'],
15
- description: 'Extracts standard QTI graphicAssociateInteraction (associate items on image)',
16
- canHandle(element, _context) {
17
- // All graphicAssociateInteraction elements are standard
18
- return element.rawTagName === 'graphicAssociateInteraction';
19
- },
20
- extract(element, context) {
21
- const { utils } = context;
22
- // Extract image data from object element
23
- const objectElements = utils.getChildrenByTag(element, 'object');
24
- let imageData = null;
25
- if (objectElements.length > 0) {
26
- const objectElement = objectElements[0];
27
- const type = utils.getAttribute(objectElement, 'type', '');
28
- const data = utils.getAttribute(objectElement, 'data', '');
29
- const width = utils.getAttribute(objectElement, 'width', '500');
30
- const height = utils.getAttribute(objectElement, 'height', '300');
31
- if (type.startsWith('image/svg')) {
32
- // Extract inline SVG content - get full content including <svg> tag
33
- const content = utils.getHtmlContent(objectElement);
34
- imageData = {
35
- type: 'svg',
36
- content,
37
- width,
38
- height,
39
- };
40
- }
41
- else {
42
- // External image reference
43
- imageData = {
44
- type: 'image',
45
- src: data,
46
- width,
47
- height,
48
- };
49
- }
50
- }
51
- // Extract associableHotspot children
52
- const hotspotElements = utils.getChildrenByTag(element, 'associableHotspot');
53
- const associableHotspots = hotspotElements.map((hotspot) => {
54
- const classes = utils.getClasses(hotspot);
55
- const identifier = utils.getAttribute(hotspot, 'identifier', '');
56
- const shape = utils.getAttribute(hotspot, 'shape', 'rect');
57
- const coords = utils.getAttribute(hotspot, 'coords', '0,0,50,50');
58
- const matchMax = utils.getNumberAttribute(hotspot, 'matchMax', 1);
59
- const matchMin = utils.getNumberAttribute(hotspot, 'matchMin', 0);
60
- const matchGroupRaw = utils.getAttribute(hotspot, 'matchGroup', '');
61
- const matchGroup = matchGroupRaw.split(/\s+/).filter(Boolean);
62
- // Get text content as label, use identifier as fallback
63
- const textContent = utils.getTextContent(hotspot).trim();
64
- const label = textContent || identifier;
65
- return {
66
- identifier,
67
- label,
68
- shape,
69
- coords,
70
- matchMax,
71
- ...(matchMin > 0 ? { matchMin } : {}),
72
- ...(matchGroup.length > 0 ? { matchGroup } : {}),
73
- ...(classes.length > 0 ? { classes } : {}),
74
- };
75
- });
76
- // Extract attributes with proper defaults
77
- const maxAssociations = utils.getNumberAttribute(element, 'maxAssociations', 1);
78
- const minAssociations = utils.getNumberAttribute(element, 'minAssociations', 0);
79
- // Extract prompt (optional)
80
- const promptElements = utils.getChildrenByTag(element, 'prompt');
81
- const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
82
- return {
83
- imageData,
84
- associableHotspots,
85
- maxAssociations,
86
- minAssociations,
87
- prompt,
88
- };
89
- },
90
- validate(data) {
91
- const errors = [];
92
- const warnings = [];
93
- // Validate image data
94
- if (!data.imageData) {
95
- warnings.push('graphicAssociateInteraction has no image data');
96
- }
97
- else if (data.imageData.type === 'image' && !data.imageData.src) {
98
- errors.push('graphicAssociateInteraction must have an image URL');
99
- }
100
- else if (data.imageData.type === 'svg' && !data.imageData.content) {
101
- errors.push('graphicAssociateInteraction must have SVG content');
102
- }
103
- // Validate hotspots exist
104
- if (!data.associableHotspots || data.associableHotspots.length < 2) {
105
- errors.push('graphicAssociateInteraction must have at least 2 hotspots');
106
- }
107
- // Validate hotspot identifiers and coords
108
- if (data.associableHotspots && data.associableHotspots.length > 0) {
109
- const identifiers = new Set();
110
- for (const hotspot of data.associableHotspots) {
111
- if (!hotspot.identifier) {
112
- errors.push('All hotspots must have an identifier');
113
- }
114
- else if (identifiers.has(hotspot.identifier)) {
115
- errors.push(`Duplicate hotspot identifier: ${hotspot.identifier}`);
116
- }
117
- else {
118
- identifiers.add(hotspot.identifier);
119
- }
120
- if (!hotspot.coords) {
121
- errors.push(`Hotspot ${hotspot.identifier} must have coords`);
122
- }
123
- // Validate matchMax
124
- if (hotspot.matchMax < 0) {
125
- errors.push(`matchMax must be non-negative for hotspot ${hotspot.identifier}`);
126
- }
127
- }
128
- }
129
- // Validate maxAssociations
130
- if (data.maxAssociations < 0) {
131
- errors.push('maxAssociations must be non-negative');
132
- }
133
- // Validate minAssociations
134
- if (data.minAssociations < 0) {
135
- errors.push('minAssociations must be non-negative');
136
- }
137
- return {
138
- valid: errors.length === 0,
139
- errors: errors.length > 0 ? errors : undefined,
140
- warnings: warnings.length > 0 ? warnings : undefined,
141
- };
142
- },
143
- };
1
+ export * from '../../interactions/graphic-associate/extractor.js';
@@ -1,53 +1,2 @@
1
- /**
2
- * Standard QTI graphicGapMatchInteraction extractor
3
- *
4
- * Extracts data from graphicGapMatchInteraction elements (drag text/images into gaps on image)
5
- */
6
- import type { ElementExtractor } from '../types.js';
7
- /**
8
- * Image data for graphic gap match interaction
9
- */
10
- export interface ImageData {
11
- type: 'image' | 'svg';
12
- src?: string;
13
- content?: string;
14
- width?: number;
15
- height?: number;
16
- }
17
- /**
18
- * Graphic gap match data extracted from graphicGapMatchInteraction elements
19
- */
20
- export interface GraphicGapMatchData {
21
- imageData: ImageData | null;
22
- maxAssociations: number;
23
- gapTexts: Array<{
24
- identifier: string;
25
- text: string;
26
- matchMax: number;
27
- matchMin?: number;
28
- matchGroup?: string[];
29
- classes?: string[];
30
- }>;
31
- gapImages: Array<{
32
- identifier: string;
33
- src: string;
34
- alt: string;
35
- matchMax: number;
36
- matchGroup?: string[];
37
- width?: number;
38
- height?: number;
39
- }>;
40
- hotspots: Array<{
41
- identifier: string;
42
- shape: string;
43
- coords: string;
44
- matchMax: number;
45
- }>;
46
- prompt: string | null;
47
- }
48
- /**
49
- * Standard QTI graphic gap match interaction extractor
50
- * Handles graphicGapMatchInteraction elements (drag text/images into gaps on an image)
51
- */
52
- export declare const standardGraphicGapMatchExtractor: ElementExtractor<GraphicGapMatchData>;
1
+ export * from '../../interactions/graphic-gap-match/extractor.js';
53
2
  //# sourceMappingURL=graphicGapMatchExtractor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphicGapMatchExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/graphicGapMatchExtractor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,SAAS;IACzB,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC,CAAC;IACH,SAAS,EAAE,KAAK,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IACH,QAAQ,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,EAAE,gBAAgB,CAAC,mBAAmB,CA8MlF,CAAC"}
1
+ {"version":3,"file":"graphicGapMatchExtractor.d.ts","sourceRoot":"","sources":["../../../src/extraction/extractors/graphicGapMatchExtractor.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAC"}
@@ -1,205 +1 @@
1
- /**
2
- * Standard QTI graphicGapMatchInteraction extractor
3
- *
4
- * Extracts data from graphicGapMatchInteraction elements (drag text/images into gaps on image)
5
- */
6
- /**
7
- * Standard QTI graphic gap match interaction extractor
8
- * Handles graphicGapMatchInteraction elements (drag text/images into gaps on an image)
9
- */
10
- export const standardGraphicGapMatchExtractor = {
11
- id: 'qti:graphic-gap-match-interaction',
12
- name: 'QTI Standard Graphic Gap Match Interaction',
13
- priority: 10,
14
- elementTypes: ['graphicGapMatchInteraction'],
15
- description: 'Extracts standard QTI graphicGapMatchInteraction (drag text/images into gaps)',
16
- canHandle(element, _context) {
17
- // All graphicGapMatchInteraction elements are standard
18
- return element.rawTagName === 'graphicGapMatchInteraction';
19
- },
20
- extract(element, context) {
21
- const { utils } = context;
22
- // Extract image data from object element
23
- const objectElements = utils.getChildrenByTag(element, 'object');
24
- let imageData = null;
25
- if (objectElements.length > 0) {
26
- const objectElement = objectElements[0];
27
- const type = utils.getAttribute(objectElement, 'type', '');
28
- const data = utils.getAttribute(objectElement, 'data', '');
29
- const width = utils.getNumberAttribute(objectElement, 'width', 0);
30
- const height = utils.getNumberAttribute(objectElement, 'height', 0);
31
- if (type.startsWith('image/svg')) {
32
- // Inline SVG: <object type="image/svg+xml"><svg>...</svg></object>
33
- // External SVG: <object type="image/svg+xml" data="path/to/file.svg"/>
34
- // The <object> may contain alt text (not SVG markup) — only treat as inline if content has <svg.
35
- const content = utils.getHtmlContent(objectElement);
36
- const hasSvgMarkup = /<svg[\s>]/i.test(content);
37
- if (hasSvgMarkup) {
38
- imageData = {
39
- type: 'svg',
40
- content,
41
- ...(width > 0 ? { width } : {}),
42
- ...(height > 0 ? { height } : {}),
43
- };
44
- }
45
- else {
46
- // External SVG file reference — render via <img src>
47
- imageData = {
48
- type: 'image',
49
- src: data,
50
- ...(width > 0 ? { width } : {}),
51
- ...(height > 0 ? { height } : {}),
52
- };
53
- }
54
- }
55
- else {
56
- // External image reference
57
- imageData = {
58
- type: 'image',
59
- src: data,
60
- ...(width > 0 ? { width } : {}),
61
- ...(height > 0 ? { height } : {}),
62
- };
63
- }
64
- }
65
- // Extract interaction-level attributes
66
- const maxAssociations = utils.getNumberAttribute(element, 'maxAssociations', 0);
67
- // Extract gapText children (draggable text labels)
68
- const gapTextElements = utils.getChildrenByTag(element, 'gapText');
69
- const gapTexts = gapTextElements.map((gapText) => {
70
- const classes = utils.getClasses(gapText);
71
- const matchMax = utils.getNumberAttribute(gapText, 'matchMax', 1);
72
- const matchMin = utils.getNumberAttribute(gapText, 'matchMin', 0);
73
- const matchGroupRaw = utils.getAttribute(gapText, 'matchGroup', '');
74
- const matchGroup = matchGroupRaw.split(/\s+/).filter(Boolean);
75
- const text = utils.getHtmlContent(gapText);
76
- return {
77
- identifier: utils.getAttribute(gapText, 'identifier', ''),
78
- text,
79
- matchMax,
80
- ...(matchMin > 0 ? { matchMin } : {}),
81
- ...(matchGroup.length > 0 ? { matchGroup } : {}),
82
- ...(classes.length > 0 ? { classes } : {}),
83
- };
84
- });
85
- // Extract gapImg children (draggable image labels)
86
- const gapImgElements = utils.getChildrenByTag(element, 'gapImg');
87
- const gapImages = gapImgElements.map((gapImg) => {
88
- const matchMax = utils.getNumberAttribute(gapImg, 'matchMax', 1);
89
- const matchGroupRaw = utils.getAttribute(gapImg, 'matchGroup', '');
90
- const matchGroup = matchGroupRaw.split(/\s+/).filter(Boolean);
91
- const objectChildren = utils.getChildrenByTag(gapImg, 'object');
92
- let src = '';
93
- let alt = '';
94
- let width;
95
- let height;
96
- if (objectChildren.length > 0) {
97
- const obj = objectChildren[0];
98
- src = utils.getAttribute(obj, 'data', '');
99
- alt = utils.getTextContent(obj);
100
- const w = utils.getNumberAttribute(obj, 'width', 0);
101
- const h = utils.getNumberAttribute(obj, 'height', 0);
102
- if (w > 0)
103
- width = w;
104
- if (h > 0)
105
- height = h;
106
- }
107
- return {
108
- identifier: utils.getAttribute(gapImg, 'identifier', ''),
109
- src,
110
- alt,
111
- matchMax,
112
- ...(matchGroup.length > 0 ? { matchGroup } : {}),
113
- ...(width !== undefined ? { width } : {}),
114
- ...(height !== undefined ? { height } : {}),
115
- };
116
- });
117
- // Extract associableHotspot elements (gap targets)
118
- const hotspotElements = utils.getChildrenByTag(element, 'associableHotspot');
119
- const hotspots = hotspotElements.map((hotspot) => ({
120
- identifier: utils.getAttribute(hotspot, 'identifier', ''),
121
- shape: utils.getAttribute(hotspot, 'shape', 'rect'),
122
- coords: utils.getAttribute(hotspot, 'coords', ''),
123
- matchMax: utils.getNumberAttribute(hotspot, 'matchMax', 1),
124
- }));
125
- // Extract prompt (optional)
126
- const promptElements = utils.getChildrenByTag(element, 'prompt');
127
- const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
128
- const interactionClasses = utils.getClasses(element);
129
- const choicesContainerWidth = utils.getAttribute(element, 'data-choices-container-width', '') || null;
130
- const maxSelectionsMessage = utils.getAttribute(element, 'data-max-selections-message', '') || null;
131
- const minSelectionsMessage = utils.getAttribute(element, 'data-min-selections-message', '') || null;
132
- return {
133
- imageData,
134
- maxAssociations,
135
- gapTexts,
136
- gapImages,
137
- hotspots,
138
- prompt,
139
- ...(interactionClasses.length > 0 ? { interactionClasses } : {}),
140
- ...(choicesContainerWidth ? { choicesContainerWidth } : {}),
141
- ...(maxSelectionsMessage ? { maxSelectionsMessage } : {}),
142
- ...(minSelectionsMessage ? { minSelectionsMessage } : {}),
143
- };
144
- },
145
- validate(data) {
146
- const errors = [];
147
- const warnings = [];
148
- // Validate image data (optional but recommended)
149
- if (!data.imageData) {
150
- warnings.push('graphicGapMatchInteraction has no background image');
151
- }
152
- else if (data.imageData.type === 'image' && !data.imageData.src) {
153
- errors.push('graphicGapMatchInteraction must have an image URL');
154
- }
155
- else if (data.imageData.type === 'svg' && !data.imageData.content) {
156
- errors.push('graphicGapMatchInteraction must have SVG content');
157
- }
158
- // Validate that at least one draggable choice type is present
159
- if ((!data.gapTexts || data.gapTexts.length === 0) && (!data.gapImages || data.gapImages.length === 0)) {
160
- errors.push('graphicGapMatchInteraction must have at least one gapText or gapImg');
161
- }
162
- // Validate hotspots exist
163
- if (!data.hotspots || data.hotspots.length === 0) {
164
- errors.push('graphicGapMatchInteraction must have at least one hotspot');
165
- }
166
- // Validate gapText identifiers
167
- if (data.gapTexts) {
168
- const identifiers = new Set();
169
- for (const gapText of data.gapTexts) {
170
- if (!gapText.identifier) {
171
- errors.push('All gapTexts must have an identifier');
172
- }
173
- else if (identifiers.has(gapText.identifier)) {
174
- errors.push(`Duplicate gapText identifier: ${gapText.identifier}`);
175
- }
176
- else {
177
- identifiers.add(gapText.identifier);
178
- }
179
- }
180
- }
181
- // Validate hotspot identifiers
182
- if (data.hotspots) {
183
- const identifiers = new Set();
184
- for (const hotspot of data.hotspots) {
185
- if (!hotspot.identifier) {
186
- errors.push('All hotspots must have an identifier');
187
- }
188
- else if (identifiers.has(hotspot.identifier)) {
189
- errors.push(`Duplicate hotspot identifier: ${hotspot.identifier}`);
190
- }
191
- else {
192
- identifiers.add(hotspot.identifier);
193
- }
194
- if (!hotspot.coords) {
195
- errors.push(`Hotspot ${hotspot.identifier} must have coords`);
196
- }
197
- }
198
- }
199
- return {
200
- valid: errors.length === 0,
201
- errors: errors.length > 0 ? errors : undefined,
202
- warnings: warnings.length > 0 ? warnings : undefined,
203
- };
204
- },
205
- };
1
+ export * from '../../interactions/graphic-gap-match/extractor.js';