@pie-qti/item-player 0.1.5 → 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 (432) hide show
  1. package/dist/core/ComponentRegistry.d.ts +5 -4
  2. package/dist/core/ComponentRegistry.d.ts.map +1 -1
  3. package/dist/core/ComponentRegistry.js +11 -4
  4. package/dist/core/ItemRenderer.d.ts.map +1 -1
  5. package/dist/core/ItemRenderer.js +5 -18
  6. package/dist/core/Player.d.ts +2 -2
  7. package/dist/core/Player.d.ts.map +1 -1
  8. package/dist/core/Player.js +46 -147
  9. package/dist/document/AssessmentItemDocument.d.ts +42 -0
  10. package/dist/document/AssessmentItemDocument.d.ts.map +1 -0
  11. package/dist/document/AssessmentItemDocument.js +116 -0
  12. package/dist/element.js +2515 -2294
  13. package/dist/element.js.map +1 -1
  14. package/dist/extraction/extractors/associateExtractor.d.ts +1 -28
  15. package/dist/extraction/extractors/associateExtractor.d.ts.map +1 -1
  16. package/dist/extraction/extractors/associateExtractor.js +1 -97
  17. package/dist/extraction/extractors/choiceExtractor.d.ts +1 -26
  18. package/dist/extraction/extractors/choiceExtractor.d.ts.map +1 -1
  19. package/dist/extraction/extractors/choiceExtractor.js +1 -93
  20. package/dist/extraction/extractors/customExtractor.d.ts +1 -19
  21. package/dist/extraction/extractors/customExtractor.d.ts.map +1 -1
  22. package/dist/extraction/extractors/customExtractor.js +1 -51
  23. package/dist/extraction/extractors/drawingExtractor.d.ts +1 -29
  24. package/dist/extraction/extractors/drawingExtractor.d.ts.map +1 -1
  25. package/dist/extraction/extractors/drawingExtractor.js +1 -78
  26. package/dist/extraction/extractors/endAttemptExtractor.d.ts +1 -19
  27. package/dist/extraction/extractors/endAttemptExtractor.d.ts.map +1 -1
  28. package/dist/extraction/extractors/endAttemptExtractor.js +1 -53
  29. package/dist/extraction/extractors/extendedTextExtractor.d.ts +1 -20
  30. package/dist/extraction/extractors/extendedTextExtractor.d.ts.map +1 -1
  31. package/dist/extraction/extractors/extendedTextExtractor.js +1 -63
  32. package/dist/extraction/extractors/gapMatchExtractor.d.ts +1 -28
  33. package/dist/extraction/extractors/gapMatchExtractor.d.ts.map +1 -1
  34. package/dist/extraction/extractors/gapMatchExtractor.js +1 -155
  35. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts +1 -40
  36. package/dist/extraction/extractors/graphicAssociateExtractor.d.ts.map +1 -1
  37. package/dist/extraction/extractors/graphicAssociateExtractor.js +1 -143
  38. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts +1 -52
  39. package/dist/extraction/extractors/graphicGapMatchExtractor.d.ts.map +1 -1
  40. package/dist/extraction/extractors/graphicGapMatchExtractor.js +1 -205
  41. package/dist/extraction/extractors/graphicOrderExtractor.d.ts +1 -36
  42. package/dist/extraction/extractors/graphicOrderExtractor.d.ts.map +1 -1
  43. package/dist/extraction/extractors/graphicOrderExtractor.js +1 -121
  44. package/dist/extraction/extractors/hotspotExtractor.d.ts +1 -37
  45. package/dist/extraction/extractors/hotspotExtractor.d.ts.map +1 -1
  46. package/dist/extraction/extractors/hotspotExtractor.js +1 -159
  47. package/dist/extraction/extractors/hottextExtractor.d.ts +1 -25
  48. package/dist/extraction/extractors/hottextExtractor.d.ts.map +1 -1
  49. package/dist/extraction/extractors/hottextExtractor.js +1 -128
  50. package/dist/extraction/extractors/index.d.ts +5 -59
  51. package/dist/extraction/extractors/index.d.ts.map +1 -1
  52. package/dist/extraction/extractors/index.js +5 -85
  53. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts +1 -24
  54. package/dist/extraction/extractors/inlineChoiceExtractor.d.ts.map +1 -1
  55. package/dist/extraction/extractors/inlineChoiceExtractor.js +1 -80
  56. package/dist/extraction/extractors/matchExtractor.d.ts +1 -36
  57. package/dist/extraction/extractors/matchExtractor.d.ts.map +1 -1
  58. package/dist/extraction/extractors/matchExtractor.js +1 -160
  59. package/dist/extraction/extractors/mediaExtractor.d.ts +1 -32
  60. package/dist/extraction/extractors/mediaExtractor.d.ts.map +1 -1
  61. package/dist/extraction/extractors/mediaExtractor.js +1 -125
  62. package/dist/extraction/extractors/orderExtractor.d.ts +1 -27
  63. package/dist/extraction/extractors/orderExtractor.d.ts.map +1 -1
  64. package/dist/extraction/extractors/orderExtractor.js +1 -90
  65. package/dist/extraction/extractors/portableCustomExtractor.d.ts +1 -13
  66. package/dist/extraction/extractors/portableCustomExtractor.d.ts.map +1 -1
  67. package/dist/extraction/extractors/portableCustomExtractor.js +1 -96
  68. package/dist/extraction/extractors/positionObjectExtractor.d.ts +1 -58
  69. package/dist/extraction/extractors/positionObjectExtractor.d.ts.map +1 -1
  70. package/dist/extraction/extractors/positionObjectExtractor.js +1 -191
  71. package/dist/extraction/extractors/selectPointExtractor.d.ts +1 -30
  72. package/dist/extraction/extractors/selectPointExtractor.d.ts.map +1 -1
  73. package/dist/extraction/extractors/selectPointExtractor.js +1 -109
  74. package/dist/extraction/extractors/sliderExtractor.d.ts +1 -23
  75. package/dist/extraction/extractors/sliderExtractor.d.ts.map +1 -1
  76. package/dist/extraction/extractors/sliderExtractor.js +1 -73
  77. package/dist/extraction/extractors/textEntryExtractor.d.ts +1 -20
  78. package/dist/extraction/extractors/textEntryExtractor.d.ts.map +1 -1
  79. package/dist/extraction/extractors/textEntryExtractor.js +1 -54
  80. package/dist/extraction/extractors/uploadExtractor.d.ts +1 -19
  81. package/dist/extraction/extractors/uploadExtractor.d.ts.map +1 -1
  82. package/dist/extraction/extractors/uploadExtractor.js +1 -59
  83. package/dist/extraction/index.d.ts +1 -1
  84. package/dist/extraction/index.d.ts.map +1 -1
  85. package/dist/extraction/index.js +2 -2
  86. package/dist/extraction/interactionExtractionPipeline.d.ts +13 -0
  87. package/dist/extraction/interactionExtractionPipeline.d.ts.map +1 -0
  88. package/dist/extraction/interactionExtractionPipeline.js +39 -0
  89. package/dist/extraction/interactionSecurity.d.ts +4 -0
  90. package/dist/extraction/interactionSecurity.d.ts.map +1 -0
  91. package/dist/extraction/interactionSecurity.js +48 -0
  92. package/dist/index.d.ts +1 -1
  93. package/dist/index.d.ts.map +1 -1
  94. package/dist/index.js +3 -3
  95. package/dist/interactions/associate/extractor.d.ts +29 -0
  96. package/dist/interactions/associate/extractor.d.ts.map +1 -0
  97. package/dist/interactions/associate/extractor.js +97 -0
  98. package/dist/interactions/associate/index.d.ts +3 -0
  99. package/dist/interactions/associate/index.d.ts.map +1 -0
  100. package/dist/interactions/associate/index.js +1 -0
  101. package/dist/interactions/associate/types.d.ts +2 -0
  102. package/dist/interactions/associate/types.d.ts.map +1 -0
  103. package/dist/interactions/associate/types.js +1 -0
  104. package/dist/interactions/choice/extractor.d.ts +27 -0
  105. package/dist/interactions/choice/extractor.d.ts.map +1 -0
  106. package/dist/interactions/choice/extractor.js +93 -0
  107. package/dist/interactions/choice/index.d.ts +3 -0
  108. package/dist/interactions/choice/index.d.ts.map +1 -0
  109. package/dist/interactions/choice/index.js +1 -0
  110. package/dist/interactions/choice/types.d.ts +2 -0
  111. package/dist/interactions/choice/types.d.ts.map +1 -0
  112. package/dist/interactions/choice/types.js +1 -0
  113. package/dist/interactions/custom/extractor.d.ts +20 -0
  114. package/dist/interactions/custom/extractor.d.ts.map +1 -0
  115. package/dist/interactions/custom/extractor.js +51 -0
  116. package/dist/interactions/custom/index.d.ts +3 -0
  117. package/dist/interactions/custom/index.d.ts.map +1 -0
  118. package/dist/interactions/custom/index.js +1 -0
  119. package/dist/interactions/custom/types.d.ts +2 -0
  120. package/dist/interactions/custom/types.d.ts.map +1 -0
  121. package/dist/interactions/custom/types.js +1 -0
  122. package/dist/interactions/drawing/extractor.d.ts +30 -0
  123. package/dist/interactions/drawing/extractor.d.ts.map +1 -0
  124. package/dist/interactions/drawing/extractor.js +78 -0
  125. package/dist/interactions/drawing/index.d.ts +3 -0
  126. package/dist/interactions/drawing/index.d.ts.map +1 -0
  127. package/dist/interactions/drawing/index.js +1 -0
  128. package/dist/interactions/drawing/types.d.ts +2 -0
  129. package/dist/interactions/drawing/types.d.ts.map +1 -0
  130. package/dist/interactions/drawing/types.js +1 -0
  131. package/dist/interactions/end-attempt/extractor.d.ts +20 -0
  132. package/dist/interactions/end-attempt/extractor.d.ts.map +1 -0
  133. package/dist/interactions/end-attempt/extractor.js +53 -0
  134. package/dist/interactions/end-attempt/index.d.ts +3 -0
  135. package/dist/interactions/end-attempt/index.d.ts.map +1 -0
  136. package/dist/interactions/end-attempt/index.js +1 -0
  137. package/dist/interactions/end-attempt/types.d.ts +2 -0
  138. package/dist/interactions/end-attempt/types.d.ts.map +1 -0
  139. package/dist/interactions/end-attempt/types.js +1 -0
  140. package/dist/interactions/extended-text/extractor.d.ts +21 -0
  141. package/dist/interactions/extended-text/extractor.d.ts.map +1 -0
  142. package/dist/interactions/extended-text/extractor.js +63 -0
  143. package/dist/interactions/extended-text/index.d.ts +3 -0
  144. package/dist/interactions/extended-text/index.d.ts.map +1 -0
  145. package/dist/interactions/extended-text/index.js +1 -0
  146. package/dist/interactions/extended-text/types.d.ts +2 -0
  147. package/dist/interactions/extended-text/types.d.ts.map +1 -0
  148. package/dist/interactions/extended-text/types.js +1 -0
  149. package/dist/interactions/gap-match/extractor.d.ts +29 -0
  150. package/dist/interactions/gap-match/extractor.d.ts.map +1 -0
  151. package/dist/interactions/gap-match/extractor.js +155 -0
  152. package/dist/interactions/gap-match/index.d.ts +3 -0
  153. package/dist/interactions/gap-match/index.d.ts.map +1 -0
  154. package/dist/interactions/gap-match/index.js +1 -0
  155. package/dist/interactions/gap-match/types.d.ts +2 -0
  156. package/dist/interactions/gap-match/types.d.ts.map +1 -0
  157. package/dist/interactions/gap-match/types.js +1 -0
  158. package/dist/interactions/graphic-associate/extractor.d.ts +41 -0
  159. package/dist/interactions/graphic-associate/extractor.d.ts.map +1 -0
  160. package/dist/interactions/graphic-associate/extractor.js +143 -0
  161. package/dist/interactions/graphic-associate/index.d.ts +3 -0
  162. package/dist/interactions/graphic-associate/index.d.ts.map +1 -0
  163. package/dist/interactions/graphic-associate/index.js +1 -0
  164. package/dist/interactions/graphic-associate/types.d.ts +2 -0
  165. package/dist/interactions/graphic-associate/types.d.ts.map +1 -0
  166. package/dist/interactions/graphic-associate/types.js +1 -0
  167. package/dist/interactions/graphic-gap-match/extractor.d.ts +53 -0
  168. package/dist/interactions/graphic-gap-match/extractor.d.ts.map +1 -0
  169. package/dist/interactions/graphic-gap-match/extractor.js +205 -0
  170. package/dist/interactions/graphic-gap-match/index.d.ts +3 -0
  171. package/dist/interactions/graphic-gap-match/index.d.ts.map +1 -0
  172. package/dist/interactions/graphic-gap-match/index.js +1 -0
  173. package/dist/interactions/graphic-gap-match/types.d.ts +2 -0
  174. package/dist/interactions/graphic-gap-match/types.d.ts.map +1 -0
  175. package/dist/interactions/graphic-gap-match/types.js +1 -0
  176. package/dist/interactions/graphic-order/extractor.d.ts +37 -0
  177. package/dist/interactions/graphic-order/extractor.d.ts.map +1 -0
  178. package/dist/interactions/graphic-order/extractor.js +121 -0
  179. package/dist/interactions/graphic-order/index.d.ts +3 -0
  180. package/dist/interactions/graphic-order/index.d.ts.map +1 -0
  181. package/dist/interactions/graphic-order/index.js +1 -0
  182. package/dist/interactions/graphic-order/types.d.ts +2 -0
  183. package/dist/interactions/graphic-order/types.d.ts.map +1 -0
  184. package/dist/interactions/graphic-order/types.js +1 -0
  185. package/dist/interactions/hotspot/extractor.d.ts +38 -0
  186. package/dist/interactions/hotspot/extractor.d.ts.map +1 -0
  187. package/dist/interactions/hotspot/extractor.js +159 -0
  188. package/dist/interactions/hotspot/index.d.ts +3 -0
  189. package/dist/interactions/hotspot/index.d.ts.map +1 -0
  190. package/dist/interactions/hotspot/index.js +1 -0
  191. package/dist/interactions/hotspot/types.d.ts +2 -0
  192. package/dist/interactions/hotspot/types.d.ts.map +1 -0
  193. package/dist/interactions/hotspot/types.js +1 -0
  194. package/dist/interactions/hottext/extractor.d.ts +26 -0
  195. package/dist/interactions/hottext/extractor.d.ts.map +1 -0
  196. package/dist/interactions/hottext/extractor.js +128 -0
  197. package/dist/interactions/hottext/index.d.ts +3 -0
  198. package/dist/interactions/hottext/index.d.ts.map +1 -0
  199. package/dist/interactions/hottext/index.js +1 -0
  200. package/dist/interactions/hottext/types.d.ts +2 -0
  201. package/dist/interactions/hottext/types.d.ts.map +1 -0
  202. package/dist/interactions/hottext/types.js +1 -0
  203. package/dist/interactions/index.d.ts +33 -0
  204. package/dist/interactions/index.d.ts.map +1 -0
  205. package/dist/interactions/index.js +30 -0
  206. package/dist/interactions/inline/index.d.ts +2 -0
  207. package/dist/interactions/inline/index.d.ts.map +1 -0
  208. package/dist/interactions/inline/index.js +1 -0
  209. package/dist/interactions/inline/render-plan.d.ts +19 -0
  210. package/dist/interactions/inline/render-plan.d.ts.map +1 -0
  211. package/dist/interactions/inline/render-plan.js +59 -0
  212. package/dist/interactions/inline-choice/extractor.d.ts +25 -0
  213. package/dist/interactions/inline-choice/extractor.d.ts.map +1 -0
  214. package/dist/interactions/inline-choice/extractor.js +80 -0
  215. package/dist/interactions/inline-choice/index.d.ts +3 -0
  216. package/dist/interactions/inline-choice/index.d.ts.map +1 -0
  217. package/dist/interactions/inline-choice/index.js +1 -0
  218. package/dist/interactions/inline-choice/types.d.ts +2 -0
  219. package/dist/interactions/inline-choice/types.d.ts.map +1 -0
  220. package/dist/interactions/inline-choice/types.js +1 -0
  221. package/dist/interactions/match/extractor.d.ts +37 -0
  222. package/dist/interactions/match/extractor.d.ts.map +1 -0
  223. package/dist/interactions/match/extractor.js +160 -0
  224. package/dist/interactions/match/index.d.ts +3 -0
  225. package/dist/interactions/match/index.d.ts.map +1 -0
  226. package/dist/interactions/match/index.js +1 -0
  227. package/dist/interactions/match/types.d.ts +2 -0
  228. package/dist/interactions/match/types.d.ts.map +1 -0
  229. package/dist/interactions/match/types.js +1 -0
  230. package/dist/interactions/media/extractor.d.ts +33 -0
  231. package/dist/interactions/media/extractor.d.ts.map +1 -0
  232. package/dist/interactions/media/extractor.js +125 -0
  233. package/dist/interactions/media/index.d.ts +3 -0
  234. package/dist/interactions/media/index.d.ts.map +1 -0
  235. package/dist/interactions/media/index.js +1 -0
  236. package/dist/interactions/media/types.d.ts +2 -0
  237. package/dist/interactions/media/types.d.ts.map +1 -0
  238. package/dist/interactions/media/types.js +1 -0
  239. package/dist/interactions/modules.d.ts +105 -0
  240. package/dist/interactions/modules.d.ts.map +1 -0
  241. package/dist/interactions/modules.js +86 -0
  242. package/dist/interactions/order/extractor.d.ts +28 -0
  243. package/dist/interactions/order/extractor.d.ts.map +1 -0
  244. package/dist/interactions/order/extractor.js +90 -0
  245. package/dist/interactions/order/index.d.ts +3 -0
  246. package/dist/interactions/order/index.d.ts.map +1 -0
  247. package/dist/interactions/order/index.js +1 -0
  248. package/dist/interactions/order/types.d.ts +2 -0
  249. package/dist/interactions/order/types.d.ts.map +1 -0
  250. package/dist/interactions/order/types.js +1 -0
  251. package/dist/interactions/portable-custom/extractor.d.ts +14 -0
  252. package/dist/interactions/portable-custom/extractor.d.ts.map +1 -0
  253. package/dist/interactions/portable-custom/extractor.js +96 -0
  254. package/dist/interactions/portable-custom/index.d.ts +3 -0
  255. package/dist/interactions/portable-custom/index.d.ts.map +1 -0
  256. package/dist/interactions/portable-custom/index.js +1 -0
  257. package/dist/interactions/portable-custom/types.d.ts +2 -0
  258. package/dist/interactions/portable-custom/types.d.ts.map +1 -0
  259. package/dist/interactions/portable-custom/types.js +1 -0
  260. package/dist/interactions/position-object/extractor.d.ts +59 -0
  261. package/dist/interactions/position-object/extractor.d.ts.map +1 -0
  262. package/dist/interactions/position-object/extractor.js +191 -0
  263. package/dist/interactions/position-object/index.d.ts +3 -0
  264. package/dist/interactions/position-object/index.d.ts.map +1 -0
  265. package/dist/interactions/position-object/index.js +1 -0
  266. package/dist/interactions/position-object/types.d.ts +2 -0
  267. package/dist/interactions/position-object/types.d.ts.map +1 -0
  268. package/dist/interactions/position-object/types.js +1 -0
  269. package/dist/interactions/select-point/extractor.d.ts +31 -0
  270. package/dist/interactions/select-point/extractor.d.ts.map +1 -0
  271. package/dist/interactions/select-point/extractor.js +109 -0
  272. package/dist/interactions/select-point/index.d.ts +3 -0
  273. package/dist/interactions/select-point/index.d.ts.map +1 -0
  274. package/dist/interactions/select-point/index.js +1 -0
  275. package/dist/interactions/select-point/types.d.ts +2 -0
  276. package/dist/interactions/select-point/types.d.ts.map +1 -0
  277. package/dist/interactions/select-point/types.js +1 -0
  278. package/dist/interactions/shared/index.d.ts +2 -0
  279. package/dist/interactions/shared/index.d.ts.map +1 -0
  280. package/dist/interactions/shared/index.js +1 -0
  281. package/dist/interactions/shared/types.d.ts +412 -0
  282. package/dist/interactions/shared/types.d.ts.map +1 -0
  283. package/dist/interactions/shared/types.js +7 -0
  284. package/dist/interactions/slider/extractor.d.ts +24 -0
  285. package/dist/interactions/slider/extractor.d.ts.map +1 -0
  286. package/dist/interactions/slider/extractor.js +73 -0
  287. package/dist/interactions/slider/index.d.ts +3 -0
  288. package/dist/interactions/slider/index.d.ts.map +1 -0
  289. package/dist/interactions/slider/index.js +1 -0
  290. package/dist/interactions/slider/types.d.ts +2 -0
  291. package/dist/interactions/slider/types.d.ts.map +1 -0
  292. package/dist/interactions/slider/types.js +1 -0
  293. package/dist/interactions/text-entry/extractor.d.ts +21 -0
  294. package/dist/interactions/text-entry/extractor.d.ts.map +1 -0
  295. package/dist/interactions/text-entry/extractor.js +54 -0
  296. package/dist/interactions/text-entry/index.d.ts +3 -0
  297. package/dist/interactions/text-entry/index.d.ts.map +1 -0
  298. package/dist/interactions/text-entry/index.js +1 -0
  299. package/dist/interactions/text-entry/types.d.ts +2 -0
  300. package/dist/interactions/text-entry/types.d.ts.map +1 -0
  301. package/dist/interactions/text-entry/types.js +1 -0
  302. package/dist/interactions/upload/extractor.d.ts +20 -0
  303. package/dist/interactions/upload/extractor.d.ts.map +1 -0
  304. package/dist/interactions/upload/extractor.js +59 -0
  305. package/dist/interactions/upload/index.d.ts +3 -0
  306. package/dist/interactions/upload/index.d.ts.map +1 -0
  307. package/dist/interactions/upload/index.js +1 -0
  308. package/dist/interactions/upload/types.d.ts +2 -0
  309. package/dist/interactions/upload/types.d.ts.map +1 -0
  310. package/dist/interactions/upload/types.js +1 -0
  311. package/dist/types/interactions.d.ts +4 -408
  312. package/dist/types/interactions.d.ts.map +1 -1
  313. package/dist/types/interactions.js +3 -3
  314. package/dist/web-components/QTIInteractionBase.d.ts +5 -5
  315. package/dist/web-components/QTIInteractionBase.d.ts.map +1 -1
  316. package/dist/web-components/QTIInteractionElement.d.ts +11 -8
  317. package/dist/web-components/QTIInteractionElement.d.ts.map +1 -1
  318. package/dist/web-components/index.d.ts +1 -1
  319. package/dist/web-components/index.d.ts.map +1 -1
  320. package/package.json +6 -6
  321. package/src/components/ItemBody.svelte +35 -173
  322. package/src/components/ItemPlayer.svelte +9 -5
  323. package/src/components/ModalFeedbackDisplay.svelte +15 -5
  324. package/src/core/ComponentRegistry.ts +22 -7
  325. package/src/core/Player.ts +48 -163
  326. package/src/document/AssessmentItemDocument.ts +178 -0
  327. package/src/extraction/extractors/associateExtractor.ts +1 -133
  328. package/src/extraction/extractors/choiceExtractor.ts +1 -121
  329. package/src/extraction/extractors/customExtractor.ts +1 -72
  330. package/src/extraction/extractors/drawingExtractor.ts +1 -113
  331. package/src/extraction/extractors/endAttemptExtractor.ts +1 -74
  332. package/src/extraction/extractors/extendedTextExtractor.ts +1 -89
  333. package/src/extraction/extractors/gapMatchExtractor.ts +1 -193
  334. package/src/extraction/extractors/graphicAssociateExtractor.ts +1 -192
  335. package/src/extraction/extractors/graphicGapMatchExtractor.ts +1 -257
  336. package/src/extraction/extractors/graphicOrderExtractor.ts +1 -162
  337. package/src/extraction/extractors/hotspotExtractor.ts +1 -208
  338. package/src/extraction/extractors/hottextExtractor.ts +1 -163
  339. package/src/extraction/extractors/index.ts +5 -111
  340. package/src/extraction/extractors/inlineChoiceExtractor.ts +1 -105
  341. package/src/extraction/extractors/matchExtractor.ts +1 -187
  342. package/src/extraction/extractors/mediaExtractor.ts +1 -168
  343. package/src/extraction/extractors/orderExtractor.ts +1 -120
  344. package/src/extraction/extractors/portableCustomExtractor.ts +1 -122
  345. package/src/extraction/extractors/positionObjectExtractor.ts +1 -243
  346. package/src/extraction/extractors/selectPointExtractor.ts +1 -143
  347. package/src/extraction/extractors/sliderExtractor.ts +1 -102
  348. package/src/extraction/extractors/textEntryExtractor.ts +1 -79
  349. package/src/extraction/extractors/uploadExtractor.ts +1 -81
  350. package/src/extraction/index.ts +1 -2
  351. package/src/extraction/interactionExtractionPipeline.ts +70 -0
  352. package/src/extraction/interactionSecurity.ts +60 -0
  353. package/src/index.ts +2 -7
  354. package/src/interactions/associate/extractor.ts +133 -0
  355. package/src/interactions/associate/index.ts +2 -0
  356. package/src/interactions/associate/types.ts +1 -0
  357. package/src/interactions/choice/extractor.ts +121 -0
  358. package/src/interactions/choice/index.ts +2 -0
  359. package/src/interactions/choice/types.ts +1 -0
  360. package/src/interactions/custom/extractor.ts +72 -0
  361. package/src/interactions/custom/index.ts +2 -0
  362. package/src/interactions/custom/types.ts +1 -0
  363. package/src/interactions/drawing/extractor.ts +113 -0
  364. package/src/interactions/drawing/index.ts +2 -0
  365. package/src/interactions/drawing/types.ts +1 -0
  366. package/src/interactions/end-attempt/extractor.ts +74 -0
  367. package/src/interactions/end-attempt/index.ts +2 -0
  368. package/src/interactions/end-attempt/types.ts +1 -0
  369. package/src/interactions/extended-text/extractor.ts +89 -0
  370. package/src/interactions/extended-text/index.ts +2 -0
  371. package/src/interactions/extended-text/types.ts +1 -0
  372. package/src/interactions/gap-match/extractor.ts +193 -0
  373. package/src/interactions/gap-match/index.ts +2 -0
  374. package/src/interactions/gap-match/types.ts +1 -0
  375. package/src/interactions/graphic-associate/extractor.ts +192 -0
  376. package/src/interactions/graphic-associate/index.ts +2 -0
  377. package/src/interactions/graphic-associate/types.ts +1 -0
  378. package/src/interactions/graphic-gap-match/extractor.ts +257 -0
  379. package/src/interactions/graphic-gap-match/index.ts +2 -0
  380. package/src/interactions/graphic-gap-match/types.ts +1 -0
  381. package/src/interactions/graphic-order/extractor.ts +162 -0
  382. package/src/interactions/graphic-order/index.ts +2 -0
  383. package/src/interactions/graphic-order/types.ts +1 -0
  384. package/src/interactions/hotspot/extractor.ts +208 -0
  385. package/src/interactions/hotspot/index.ts +2 -0
  386. package/src/interactions/hotspot/types.ts +1 -0
  387. package/src/interactions/hottext/extractor.ts +163 -0
  388. package/src/interactions/hottext/index.ts +2 -0
  389. package/src/interactions/hottext/types.ts +1 -0
  390. package/src/interactions/index.ts +52 -0
  391. package/src/interactions/inline/index.ts +1 -0
  392. package/src/interactions/inline/render-plan.ts +105 -0
  393. package/src/interactions/inline-choice/InlineChoice.svelte +57 -0
  394. package/src/interactions/inline-choice/extractor.ts +105 -0
  395. package/src/interactions/inline-choice/index.ts +2 -0
  396. package/src/interactions/inline-choice/types.ts +1 -0
  397. package/src/interactions/match/extractor.ts +187 -0
  398. package/src/interactions/match/index.ts +2 -0
  399. package/src/interactions/match/types.ts +1 -0
  400. package/src/interactions/media/extractor.ts +168 -0
  401. package/src/interactions/media/index.ts +2 -0
  402. package/src/interactions/media/types.ts +1 -0
  403. package/src/interactions/modules.ts +111 -0
  404. package/src/interactions/order/extractor.ts +120 -0
  405. package/src/interactions/order/index.ts +2 -0
  406. package/src/interactions/order/types.ts +1 -0
  407. package/src/interactions/portable-custom/extractor.ts +122 -0
  408. package/src/interactions/portable-custom/index.ts +2 -0
  409. package/src/interactions/portable-custom/types.ts +1 -0
  410. package/src/interactions/position-object/extractor.ts +243 -0
  411. package/src/interactions/position-object/index.ts +2 -0
  412. package/src/interactions/position-object/types.ts +1 -0
  413. package/src/interactions/select-point/extractor.ts +143 -0
  414. package/src/interactions/select-point/index.ts +2 -0
  415. package/src/interactions/select-point/types.ts +1 -0
  416. package/src/interactions/shared/index.ts +1 -0
  417. package/src/interactions/shared/types.ts +429 -0
  418. package/src/interactions/slider/extractor.ts +102 -0
  419. package/src/interactions/slider/index.ts +2 -0
  420. package/src/interactions/slider/types.ts +1 -0
  421. package/src/interactions/text-entry/InlineTextEntry.svelte +75 -0
  422. package/src/interactions/text-entry/extractor.ts +79 -0
  423. package/src/interactions/text-entry/index.ts +2 -0
  424. package/src/interactions/text-entry/types.ts +1 -0
  425. package/src/interactions/upload/extractor.ts +81 -0
  426. package/src/interactions/upload/index.ts +2 -0
  427. package/src/interactions/upload/types.ts +1 -0
  428. package/src/types/interactions.ts +4 -425
  429. package/src/web-components/QTIInteractionBase.ts +6 -5
  430. package/src/web-components/QTIInteractionElement.ts +15 -8
  431. package/src/web-components/index.ts +1 -0
  432. package/src/core/ItemRenderer.ts +0 -371
@@ -1,243 +1 @@
1
- /**
2
- * Standard QTI positionObjectInteraction extractor
3
- *
4
- * Extracts data from positionObjectInteraction elements (drag objects to positions)
5
- *
6
- * ⚠️ IMPORTANT: QTI 2.2 positionObjectInteraction Limitations
7
- *
8
- * This interaction has severe limitations that make it impractical for most educational scenarios:
9
- *
10
- * 1. Response format is baseType="point" - only stores coordinates ["158 168"]
11
- * 2. NO way to track which specific object was placed where
12
- * 3. Designed ONLY for placing multiple copies of the SAME object (e.g., airport icons)
13
- * 4. Cannot support "place labeled objects on map" use cases
14
- *
15
- * The official QTI 2.2 spec example shows:
16
- * - ONE positionObjectStage (container) with background image
17
- * - ONE positionObjectInteraction with ONE draggable object
18
- * - maxChoices determines how many times the object can be placed
19
- * - Scoring uses areaMapping to check if ANY placement hits target zones
20
- *
21
- * This extractor supports a NON-STANDARD extension with multiple positionObjectStage
22
- * elements (each with identifiers), but the response format cannot preserve object identity.
23
- * For labeled-object placement, use graphicGapMatchInteraction instead.
24
- */
25
-
26
- import type { ElementExtractor } from '../types.js';
27
-
28
- /**
29
- * Image data for position object interaction
30
- */
31
- export interface ImageData {
32
- type: 'image' | 'svg';
33
- src?: string;
34
- content?: string;
35
- width?: string;
36
- height?: string;
37
- }
38
-
39
- /**
40
- * Position object data extracted from positionObjectInteraction elements
41
- */
42
- export interface PositionObjectData {
43
- imageData: ImageData | null;
44
- positionObjectStages: Array<{
45
- identifier: string;
46
- label: string;
47
- matchMax: number;
48
- matchMin?: number;
49
- objectData: ImageData | null;
50
- classes?: string[];
51
- }>;
52
- centerPoint: boolean;
53
- maxChoices: number;
54
- minChoices: number;
55
- prompt: string | null;
56
- }
57
-
58
- /**
59
- * Standard QTI position object interaction extractor
60
- * Handles positionObjectInteraction elements (dragging an object to a position)
61
- */
62
- export const standardPositionObjectExtractor: ElementExtractor<PositionObjectData> = {
63
- id: 'qti:position-object-interaction',
64
- name: 'QTI Standard Position Object Interaction',
65
- priority: 10,
66
- elementTypes: ['positionObjectInteraction'],
67
- description: 'Extracts standard QTI positionObjectInteraction (drag object to position)',
68
-
69
- canHandle(element, _context) {
70
- // All positionObjectInteraction elements are standard
71
- return element.rawTagName === 'positionObjectInteraction';
72
- },
73
-
74
- extract(element, context) {
75
- const { utils } = context;
76
-
77
- // Extract background image data from object element (direct child)
78
- const objectElements = utils.getChildrenByTag(element, 'object');
79
- let imageData: ImageData | null = null;
80
-
81
- if (objectElements.length > 0) {
82
- const objectElement = objectElements[0];
83
- const type = utils.getAttribute(objectElement, 'type', '');
84
- const data = utils.getAttribute(objectElement, 'data', '');
85
- const width = utils.getAttribute(objectElement, 'width', '500');
86
- const height = utils.getAttribute(objectElement, 'height', '300');
87
-
88
- if (type.startsWith('image/svg')) {
89
- // Extract inline SVG content - get full content including <svg> tag
90
- const content = utils.getHtmlContent(objectElement);
91
- imageData = {
92
- type: 'svg',
93
- content,
94
- width,
95
- height,
96
- };
97
- } else {
98
- // External image reference
99
- imageData = {
100
- type: 'image',
101
- src: data,
102
- width,
103
- height,
104
- };
105
- }
106
- }
107
-
108
- // Extract positionObjectStage children
109
- const stageElements = utils.getChildrenByTag(element, 'positionObjectStage');
110
- const positionObjectStages = stageElements.map((stage) => {
111
- const classes = utils.getClasses(stage);
112
- const identifier = utils.getAttribute(stage, 'identifier', '');
113
- const matchMax = utils.getNumberAttribute(stage, 'matchMax', 1);
114
- const matchMin = utils.getNumberAttribute(stage, 'matchMin', 0);
115
-
116
- // Get text content as label, use identifier as fallback
117
- const textContent = utils.getTextContent(stage).trim();
118
- const label = textContent || identifier;
119
-
120
- // Extract object data from nested object element
121
- const stageObjectElements = utils.getChildrenByTag(stage, 'object');
122
- let objectData: ImageData | null = null;
123
-
124
- if (stageObjectElements.length > 0) {
125
- const objElement = stageObjectElements[0];
126
- const objType = utils.getAttribute(objElement, 'type', '');
127
- const objData = utils.getAttribute(objElement, 'data', '');
128
- const objWidth = utils.getAttribute(objElement, 'width', '50');
129
- const objHeight = utils.getAttribute(objElement, 'height', '50');
130
-
131
- if (objType.startsWith('image/svg')) {
132
- // Extract inline SVG content
133
- const content = utils.getHtmlContent(objElement);
134
- objectData = {
135
- type: 'svg',
136
- content,
137
- width: objWidth,
138
- height: objHeight,
139
- };
140
- } else {
141
- // External image reference
142
- objectData = {
143
- type: 'image',
144
- src: objData,
145
- width: objWidth,
146
- height: objHeight,
147
- };
148
- }
149
- }
150
-
151
- return {
152
- identifier,
153
- label,
154
- matchMax,
155
- ...(matchMin > 0 ? { matchMin } : {}),
156
- objectData,
157
- ...(classes.length > 0 ? { classes } : {}),
158
- };
159
- });
160
-
161
- // Extract attributes
162
- // centerPoint defaults to true when not specified
163
- const centerPoint = utils.getBooleanAttribute(element, 'centerPoint', true);
164
- const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 0);
165
- const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
166
-
167
- // Extract prompt (optional)
168
- const promptElements = utils.getChildrenByTag(element, 'prompt');
169
- const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
170
-
171
- return {
172
- imageData,
173
- positionObjectStages,
174
- centerPoint,
175
- maxChoices,
176
- minChoices,
177
- prompt,
178
- };
179
- },
180
-
181
- validate(data) {
182
- const errors: string[] = [];
183
- const warnings: string[] = [];
184
-
185
- // Validate image data
186
- if (!data.imageData) {
187
- warnings.push('positionObjectInteraction has no background image');
188
- } else if (data.imageData.type === 'image' && !data.imageData.src) {
189
- errors.push('positionObjectInteraction must have an image URL');
190
- } else if (data.imageData.type === 'svg' && !data.imageData.content) {
191
- errors.push('positionObjectInteraction must have SVG content');
192
- }
193
-
194
- // Warn about dimension consistency (cannot verify actual file dimensions at extraction time)
195
- if (data.imageData && data.imageData.type === 'image') {
196
- warnings.push(
197
- 'IMPORTANT: Ensure declared width/height match actual image file dimensions. ' +
198
- 'Mismatched dimensions cause coordinate system errors in mapResponsePoint scoring. ' +
199
- `Declared: ${data.imageData.width || 'unspecified'}×${data.imageData.height || 'unspecified'}`
200
- );
201
- }
202
-
203
- // Validate positionObjectStages exist
204
- if (!data.positionObjectStages || data.positionObjectStages.length === 0) {
205
- errors.push('positionObjectInteraction must have at least one positionObjectStage');
206
- }
207
-
208
- // Validate positionObjectStage identifiers
209
- if (data.positionObjectStages) {
210
- const identifiers = new Set<string>();
211
- for (const stage of data.positionObjectStages) {
212
- if (!stage.identifier) {
213
- errors.push('All positionObjectStages must have an identifier');
214
- } else if (identifiers.has(stage.identifier)) {
215
- errors.push(`Duplicate positionObjectStage identifier: ${stage.identifier}`);
216
- } else {
217
- identifiers.add(stage.identifier);
218
- }
219
- }
220
- }
221
-
222
- // Validate maxChoices
223
- if (data.maxChoices < 0) {
224
- errors.push('maxChoices must be non-negative');
225
- }
226
-
227
- // Validate minChoices
228
- if (data.minChoices < 0) {
229
- errors.push('minChoices must be non-negative');
230
- }
231
-
232
- // Validate minChoices <= maxChoices
233
- if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {
234
- errors.push('minChoices cannot exceed maxChoices');
235
- }
236
-
237
- return {
238
- valid: errors.length === 0,
239
- errors: errors.length > 0 ? errors : undefined,
240
- warnings: warnings.length > 0 ? warnings : undefined,
241
- };
242
- },
243
- };
1
+ export * from '../../interactions/position-object/extractor.js';
@@ -1,143 +1 @@
1
- /**
2
- * Standard QTI selectPointInteraction extractor
3
- *
4
- * Extracts data from selectPointInteraction elements (click point on image)
5
- */
6
-
7
- import type { ElementExtractor } from '../types.js';
8
-
9
- /**
10
- * Image data for select point interaction
11
- */
12
- export interface ImageData {
13
- type: 'image' | 'svg';
14
- src?: string;
15
- content?: string;
16
- width?: string;
17
- height?: string;
18
- }
19
-
20
- /**
21
- * Select point data extracted from selectPointInteraction elements
22
- */
23
- export interface SelectPointData {
24
- imageData: ImageData | null;
25
- maxChoices: number;
26
- minChoices: number;
27
- prompt: string | null;
28
- }
29
-
30
- /**
31
- * Standard QTI select point interaction extractor
32
- * Handles selectPointInteraction elements (clicking points on an image)
33
- */
34
- export const standardSelectPointExtractor: ElementExtractor<SelectPointData> = {
35
- id: 'qti:select-point-interaction',
36
- name: 'QTI Standard Select Point Interaction',
37
- priority: 10,
38
- elementTypes: ['selectPointInteraction'],
39
- description: 'Extracts standard QTI selectPointInteraction (click point on image)',
40
-
41
- canHandle(element, _context) {
42
- // All selectPointInteraction elements are standard
43
- return element.rawTagName === 'selectPointInteraction';
44
- },
45
-
46
- extract(element, context) {
47
- const { utils } = context;
48
-
49
- // Extract image data from object or img element
50
- const objectElements = utils.getChildrenByTag(element, 'object');
51
- const imgElements = utils.getChildrenByTag(element, 'img');
52
- let imageData: ImageData | null = null;
53
-
54
- if (objectElements.length > 0) {
55
- const objectElement = objectElements[0];
56
- const type = utils.getAttribute(objectElement, 'type', '');
57
- const data = utils.getAttribute(objectElement, 'data', '');
58
- const width = utils.getAttribute(objectElement, 'width', '500');
59
- const height = utils.getAttribute(objectElement, 'height', '300');
60
-
61
- if (type.startsWith('image/svg')) {
62
- // Extract inline SVG content - get full content including <svg> tag
63
- const content = utils.getHtmlContent(objectElement);
64
- imageData = {
65
- type: 'svg',
66
- content,
67
- width,
68
- height,
69
- };
70
- } else {
71
- // External image reference
72
- imageData = {
73
- type: 'image',
74
- src: data,
75
- width,
76
- height,
77
- };
78
- }
79
- } else if (imgElements.length > 0) {
80
- // Handle img element as fallback
81
- const imgElement = imgElements[0];
82
- const src = utils.getAttribute(imgElement, 'src', '');
83
- const width = utils.getAttribute(imgElement, 'width', '500');
84
- const height = utils.getAttribute(imgElement, 'height', '300');
85
- imageData = {
86
- type: 'image',
87
- src,
88
- width,
89
- height,
90
- };
91
- }
92
-
93
- // Extract attributes
94
- const maxChoices = utils.getNumberAttribute(element, 'maxChoices', 1);
95
- const minChoices = utils.getNumberAttribute(element, 'minChoices', 0);
96
-
97
- // Extract prompt (optional)
98
- const promptElements = utils.getChildrenByTag(element, 'prompt');
99
- const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
100
-
101
- return {
102
- imageData,
103
- maxChoices,
104
- minChoices,
105
- prompt,
106
- };
107
- },
108
-
109
- validate(data) {
110
- const errors: string[] = [];
111
- const warnings: string[] = [];
112
-
113
- // Validate image data
114
- if (!data.imageData) {
115
- warnings.push('selectPointInteraction has no image data');
116
- } else if (data.imageData.type === 'image' && !data.imageData.src) {
117
- errors.push('selectPointInteraction must have an image URL');
118
- } else if (data.imageData.type === 'svg' && !data.imageData.content) {
119
- errors.push('selectPointInteraction must have SVG content');
120
- }
121
-
122
- // Validate maxChoices — 0 means unlimited per QTI spec
123
- if (data.maxChoices < 0) {
124
- errors.push('maxChoices must be non-negative');
125
- }
126
-
127
- // Validate minChoices
128
- if (data.minChoices < 0) {
129
- errors.push('minChoices must be non-negative');
130
- }
131
-
132
- // Validate minChoices <= maxChoices (skip when maxChoices=0, meaning unlimited)
133
- if (data.maxChoices > 0 && data.minChoices > data.maxChoices) {
134
- errors.push(`minChoices (${data.minChoices}) must be less than or equal to maxChoices (${data.maxChoices})`);
135
- }
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/select-point/extractor.js';
@@ -1,102 +1 @@
1
- /**
2
- * Standard QTI sliderInteraction extractor
3
- *
4
- * Extracts data from sliderInteraction elements (slider input)
5
- */
6
-
7
- import type { ElementExtractor } from '../types.js';
8
-
9
- /**
10
- * Slider data extracted from sliderInteraction elements
11
- */
12
- export interface SliderData {
13
- lowerBound: number;
14
- upperBound: number;
15
- step: number;
16
- stepLabel?: boolean;
17
- orientation: string;
18
- reverse: boolean;
19
- prompt: string | null;
20
- }
21
-
22
- /**
23
- * Standard QTI slider interaction extractor
24
- * Handles sliderInteraction elements (slider for numeric input)
25
- */
26
- export const standardSliderExtractor: ElementExtractor<SliderData> = {
27
- id: 'qti:slider-interaction',
28
- name: 'QTI Standard Slider Interaction',
29
- priority: 10,
30
- elementTypes: ['sliderInteraction'],
31
- description: 'Extracts standard QTI sliderInteraction (slider input)',
32
-
33
- canHandle(element, _context) {
34
- // All sliderInteraction elements are standard
35
- return element.rawTagName === 'sliderInteraction';
36
- },
37
-
38
- extract(element, context) {
39
- const { utils } = context;
40
-
41
- // Extract required attributes
42
- const lowerBound = utils.getNumberAttribute(element, 'lowerBound', 0);
43
- const upperBound = utils.getNumberAttribute(element, 'upperBound', 100);
44
- const step = utils.getNumberAttribute(element, 'step', 1);
45
- const orientation = utils.getAttribute(element, 'orientation', 'horizontal');
46
- const reverse = utils.getBooleanAttribute(element, 'reverse', false);
47
-
48
- // Extract optional attributes
49
- const stepLabel = utils.getBooleanAttribute(element, 'stepLabel');
50
-
51
- // Extract prompt (optional)
52
- const promptElements = utils.getChildrenByTag(element, 'prompt');
53
- const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
54
-
55
- return {
56
- lowerBound,
57
- upperBound,
58
- step,
59
- orientation,
60
- reverse,
61
- ...(stepLabel ? { stepLabel } : {}),
62
- prompt,
63
- };
64
- },
65
-
66
- validate(data) {
67
- const errors: string[] = [];
68
- const warnings: string[] = [];
69
-
70
- // Validate bounds
71
- if (data.lowerBound >= data.upperBound) {
72
- errors.push('lowerBound must be less than upperBound');
73
- }
74
-
75
- // Validate step
76
- if (data.step <= 0) {
77
- errors.push('step must be greater than 0');
78
- }
79
-
80
- // Validate orientation
81
- if (data.orientation && !['horizontal', 'vertical'].includes(data.orientation)) {
82
- errors.push('orientation must be "horizontal" or "vertical"');
83
- }
84
-
85
- // Warn if step is larger than range
86
- const range = data.upperBound - data.lowerBound;
87
- if (data.step > range) {
88
- warnings.push(`step (${data.step}) is larger than the range (${range})`);
89
- } else if (range % data.step !== 0) {
90
- // Warn if step doesn't evenly divide range
91
- warnings.push(
92
- `step ${data.step} does not evenly divide range ${range} (${data.lowerBound} to ${data.upperBound})`
93
- );
94
- }
95
-
96
- return {
97
- valid: errors.length === 0,
98
- errors: errors.length > 0 ? errors : undefined,
99
- warnings: warnings.length > 0 ? warnings : undefined,
100
- };
101
- },
102
- };
1
+ export * from '../../interactions/slider/extractor.js';
@@ -1,79 +1 @@
1
- /**
2
- * Standard QTI textEntryInteraction extractor
3
- *
4
- * Extracts data from textEntryInteraction elements (inline text input)
5
- */
6
-
7
- import type { ElementExtractor } from '../types.js';
8
-
9
- /**
10
- * Text entry data extracted from textEntryInteraction elements
11
- */
12
- export interface TextEntryData {
13
- expectedLength: number;
14
- patternMask: string | null;
15
- placeholderText: string;
16
- format?: string;
17
- }
18
-
19
- /**
20
- * Standard QTI text entry interaction extractor
21
- * Handles textEntryInteraction elements (inline text input)
22
- */
23
- export const standardTextEntryExtractor: ElementExtractor<TextEntryData> = {
24
- id: 'qti:text-entry-interaction',
25
- name: 'QTI Standard Text Entry Interaction',
26
- priority: 10,
27
- elementTypes: ['textEntryInteraction'],
28
- description: 'Extracts standard QTI textEntryInteraction (inline text input)',
29
-
30
- canHandle(element, _context) {
31
- // All textEntryInteraction elements are standard (both QTI 2.x and 3.0)
32
- return (
33
- element.rawTagName === 'textEntryInteraction' || element.rawTagName === 'qti-text-entry-interaction'
34
- );
35
- },
36
-
37
- extract(element, context) {
38
- const { utils } = context;
39
-
40
- // Extract attributes
41
- const expectedLength = utils.getNumberAttribute(element, 'expectedLength', 20);
42
- const patternMask = utils.getAttribute(element, 'patternMask', '');
43
- const placeholderText = utils.getAttribute(element, 'placeholderText', '');
44
- const format = utils.getAttribute(element, 'format', '');
45
- const interactionClasses = utils.getClasses(element);
46
- const patternMaskMessage = utils.getAttribute(element, 'data-patternmask-message', '') || null;
47
-
48
- return {
49
- expectedLength,
50
- patternMask: patternMask || null,
51
- placeholderText,
52
- ...(format ? { format } : {}),
53
- ...(interactionClasses.length > 0 ? { interactionClasses } : {}),
54
- ...(patternMaskMessage ? { patternMaskMessage } : {}),
55
- };
56
- },
57
-
58
- validate(data) {
59
- const errors: string[] = [];
60
- const warnings: string[] = [];
61
-
62
- // Validate expectedLength
63
- if (data.expectedLength < 1) {
64
- errors.push('expectedLength must be positive');
65
- }
66
-
67
- if (data.expectedLength > 1000) {
68
- warnings.push(
69
- `expectedLength (${data.expectedLength}) is very large - consider using extendedTextInteraction`
70
- );
71
- }
72
-
73
- return {
74
- valid: errors.length === 0,
75
- errors: errors.length > 0 ? errors : undefined,
76
- warnings: warnings.length > 0 ? warnings : undefined,
77
- };
78
- },
79
- };
1
+ export * from '../../interactions/text-entry/extractor.js';
@@ -1,81 +1 @@
1
- /**
2
- * Standard QTI uploadInteraction extractor
3
- *
4
- * Extracts data from uploadInteraction elements (file upload)
5
- */
6
-
7
- import type { ElementExtractor } from '../types.js';
8
-
9
- /**
10
- * Upload data extracted from uploadInteraction elements
11
- */
12
- export interface UploadData {
13
- fileTypes: string[];
14
- rawAttributes: Record<string, string>;
15
- prompt: string | null;
16
- }
17
-
18
- /**
19
- * Standard QTI upload interaction extractor
20
- * Handles uploadInteraction elements (file upload)
21
- */
22
- export const standardUploadExtractor: ElementExtractor<UploadData> = {
23
- id: 'qti:upload-interaction',
24
- name: 'QTI Standard Upload Interaction',
25
- priority: 10,
26
- elementTypes: ['uploadInteraction'],
27
- description: 'Extracts standard QTI uploadInteraction (file upload)',
28
-
29
- canHandle(element, _context) {
30
- // All uploadInteraction elements are standard
31
- return element.rawTagName === 'uploadInteraction';
32
- },
33
-
34
- extract(element, context) {
35
- const { utils } = context;
36
-
37
- // Extract fileType child elements (vendor / QTI 3.0 style)
38
- const fileTypeElements = utils.getChildrenByTag(element, 'fileType');
39
- let fileTypes = fileTypeElements.map((el) => utils.getTextContent(el));
40
-
41
- // Fall back to QTI 2.x `type` attribute when no <fileType> children are present
42
- if (fileTypes.length === 0) {
43
- const typeAttr = utils.getAttribute(element, 'type', '');
44
- if (typeAttr) {
45
- fileTypes = typeAttr.split(/\s+/).filter(Boolean);
46
- }
47
- }
48
-
49
- // Extract all attributes
50
- const rawAttributes: Record<string, string> = {};
51
- if (element.attributes) {
52
- for (const [key, value] of Object.entries(element.attributes)) {
53
- rawAttributes[key] = String(value);
54
- }
55
- }
56
-
57
- // Extract prompt (optional)
58
- const promptElements = utils.getChildrenByTag(element, 'prompt');
59
- const prompt = promptElements.length > 0 ? utils.getHtmlContent(promptElements[0]) : null;
60
-
61
- return {
62
- fileTypes,
63
- rawAttributes,
64
- prompt,
65
- };
66
- },
67
-
68
- validate(data) {
69
- const warnings: string[] = [];
70
-
71
- // Warn if no file type restrictions
72
- if (!data.fileTypes || data.fileTypes.length === 0) {
73
- warnings.push('uploadInteraction has no fileTypes - any file type will be accepted');
74
- }
75
-
76
- return {
77
- valid: true,
78
- warnings: warnings.length > 0 ? warnings : undefined,
79
- };
80
- },
81
- };
1
+ export * from '../../interactions/upload/extractor.js';
@@ -69,9 +69,8 @@ export type {
69
69
  UploadData,
70
70
  } from './extractors/index.js';
71
71
 
72
- // Standard extractors (all 21 extractors)
72
+ // Standard extractors
73
73
  export {
74
- ALL_STANDARD_EXTRACTORS,
75
74
  standardAssociateExtractor,
76
75
  standardChoiceExtractor,
77
76
  standardCustomExtractor,