@pie-qti/item-player 1.0.0-beta.4 → 1.0.0-beta.5

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 (294) hide show
  1. package/README.md +33 -5
  2. package/dist/catalog/applyGlossaryTriggers.js +14 -2
  3. package/dist/catalog/applyGlossaryTriggers.js.map +1 -1
  4. package/dist/catalog/catalogExtractor.js +2 -4
  5. package/dist/catalog/catalogExtractor.js.map +1 -1
  6. package/dist/catalog/sessionCatalog.d.ts +46 -0
  7. package/dist/catalog/sessionCatalog.js +87 -0
  8. package/dist/catalog/sessionCatalog.js.map +1 -0
  9. package/dist/components/utils/endAttempt.d.ts +16 -0
  10. package/dist/components/utils/endAttempt.js +28 -0
  11. package/dist/components/utils/endAttempt.js.map +1 -0
  12. package/dist/components/utils/focus.d.ts +19 -0
  13. package/dist/components/utils/focus.js +67 -0
  14. package/dist/components/utils/focus.js.map +1 -0
  15. package/dist/components/utils/itemBodyRenderer.d.ts +44 -0
  16. package/dist/components/utils/itemBodyRenderer.js +177 -0
  17. package/dist/components/utils/itemBodyRenderer.js.map +1 -0
  18. package/dist/components/utils/sentenceContext.d.ts +6 -0
  19. package/dist/components/utils/sentenceContext.js +16 -0
  20. package/dist/components/utils/sentenceContext.js.map +1 -0
  21. package/dist/core/AssessmentItemDefinition.d.ts +20 -1
  22. package/dist/core/AssessmentItemDefinition.js +12 -31
  23. package/dist/core/AssessmentItemDefinition.js.map +1 -1
  24. package/dist/core/ComponentRegistry.d.ts +92 -0
  25. package/dist/core/ComponentRegistry.js +7 -1
  26. package/dist/core/ComponentRegistry.js.map +1 -1
  27. package/dist/core/ItemSession.d.ts +18 -1
  28. package/dist/core/ItemSession.js +79 -41
  29. package/dist/core/ItemSession.js.map +1 -1
  30. package/dist/core/Player.d.ts +118 -141
  31. package/dist/core/Player.js +387 -1233
  32. package/dist/core/Player.js.map +1 -1
  33. package/dist/core/compliance.d.ts +72 -0
  34. package/dist/core/compliance.js +147 -0
  35. package/dist/core/compliance.js.map +1 -0
  36. package/dist/core/declarations/declarationBuilder.d.ts +29 -0
  37. package/dist/core/declarations/declarationBuilder.js +284 -0
  38. package/dist/core/declarations/declarationBuilder.js.map +1 -0
  39. package/dist/core/declarations/declarationValues.d.ts +11 -0
  40. package/dist/core/declarations/declarationValues.js +168 -0
  41. package/dist/core/declarations/declarationValues.js.map +1 -0
  42. package/dist/core/matchGroups.d.ts +36 -0
  43. package/dist/core/matchGroups.js +100 -0
  44. package/dist/core/matchGroups.js.map +1 -0
  45. package/dist/core/nameMappers.d.ts +35 -0
  46. package/dist/core/nameMappers.js +47 -0
  47. package/dist/core/nameMappers.js.map +1 -0
  48. package/dist/core/parsingLimits.d.ts +4 -0
  49. package/dist/core/parsingLimits.js +5 -2
  50. package/dist/core/parsingLimits.js.map +1 -1
  51. package/dist/core/processing/responseProcessing.d.ts +88 -0
  52. package/dist/core/processing/responseProcessing.js +317 -0
  53. package/dist/core/processing/responseProcessing.js.map +1 -0
  54. package/dist/core/processing/responseValidation.d.ts +55 -0
  55. package/dist/core/processing/responseValidation.js +335 -0
  56. package/dist/core/processing/responseValidation.js.map +1 -0
  57. package/dist/core/rendering/contentPass.d.ts +31 -0
  58. package/dist/core/rendering/contentPass.js +152 -0
  59. package/dist/core/rendering/contentPass.js.map +1 -0
  60. package/dist/core/rendering/htmlRender.d.ts +21 -0
  61. package/dist/core/rendering/htmlRender.js +56 -0
  62. package/dist/core/rendering/htmlRender.js.map +1 -0
  63. package/dist/core/responseProcessingTemplates.d.ts +23 -0
  64. package/dist/core/responseProcessingTemplates.js +45 -0
  65. package/dist/core/responseProcessingTemplates.js.map +1 -0
  66. package/dist/core/rolePolicy.d.ts +5 -0
  67. package/dist/core/rolePolicy.js +21 -0
  68. package/dist/core/rolePolicy.js.map +1 -1
  69. package/dist/core/sanitizer.js +8 -14
  70. package/dist/core/sanitizer.js.map +1 -1
  71. package/dist/core/serialization/sessionState.d.ts +56 -0
  72. package/dist/core/serialization/sessionState.js +139 -0
  73. package/dist/core/serialization/sessionState.js.map +1 -0
  74. package/dist/core/serialization/valueForms.d.ts +32 -0
  75. package/dist/core/serialization/valueForms.js +112 -0
  76. package/dist/core/serialization/valueForms.js.map +1 -0
  77. package/dist/document/AssessmentItemDocument.d.ts +27 -1
  78. package/dist/document/AssessmentItemDocument.js +67 -31
  79. package/dist/document/AssessmentItemDocument.js.map +1 -1
  80. package/dist/element-class-BbF4Dj7F.js +3773 -0
  81. package/dist/element-class-BbF4Dj7F.js.map +1 -0
  82. package/dist/element-class.d.ts +34 -1
  83. package/dist/element-class.js +1 -1
  84. package/dist/element.js +1 -1
  85. package/dist/extraction/ExtractionRegistry.js +6 -12
  86. package/dist/extraction/ExtractionRegistry.js.map +1 -1
  87. package/dist/extraction/createContext.d.ts +2 -2
  88. package/dist/extraction/createContext.js.map +1 -1
  89. package/dist/extraction/index.d.ts +2 -2
  90. package/dist/extraction/index.js +1 -1
  91. package/dist/extraction/index.js.map +1 -1
  92. package/dist/extraction/interactionCoverage.d.ts +31 -0
  93. package/dist/extraction/interactionCoverage.js +40 -0
  94. package/dist/extraction/interactionCoverage.js.map +1 -0
  95. package/dist/extraction/interactionExtractionPipeline.js +5 -10
  96. package/dist/extraction/interactionExtractionPipeline.js.map +1 -1
  97. package/dist/extraction/interactionSecurity.js +1 -28
  98. package/dist/extraction/interactionSecurity.js.map +1 -1
  99. package/dist/extraction/mergeDeliveryFields.d.ts +13 -0
  100. package/dist/extraction/mergeDeliveryFields.js +17 -0
  101. package/dist/extraction/mergeDeliveryFields.js.map +1 -0
  102. package/dist/extraction/responseIdentifier.d.ts +19 -0
  103. package/dist/extraction/responseIdentifier.js +29 -0
  104. package/dist/extraction/responseIdentifier.js.map +1 -0
  105. package/dist/extraction/types.d.ts +11 -18
  106. package/dist/extraction/types.js +0 -12
  107. package/dist/extraction/types.js.map +1 -1
  108. package/dist/extraction/utils.d.ts +14 -0
  109. package/dist/extraction/utils.js +35 -5
  110. package/dist/extraction/utils.js.map +1 -1
  111. package/dist/index.d.ts +16 -10
  112. package/dist/index.js +19 -8
  113. package/dist/index.js.map +1 -1
  114. package/dist/interactions/associate/extractor.d.ts +1 -0
  115. package/dist/interactions/associate/extractor.js +10 -12
  116. package/dist/interactions/associate/extractor.js.map +1 -1
  117. package/dist/interactions/choice/extractor.js +6 -13
  118. package/dist/interactions/choice/extractor.js.map +1 -1
  119. package/dist/interactions/drawing/extractor.d.ts +6 -0
  120. package/dist/interactions/drawing/extractor.js +30 -9
  121. package/dist/interactions/drawing/extractor.js.map +1 -1
  122. package/dist/interactions/end-attempt/extractor.js +2 -1
  123. package/dist/interactions/end-attempt/extractor.js.map +1 -1
  124. package/dist/interactions/extended-text/extractor.d.ts +6 -1
  125. package/dist/interactions/extended-text/extractor.js +10 -5
  126. package/dist/interactions/extended-text/extractor.js.map +1 -1
  127. package/dist/interactions/extended-text/response.js +18 -18
  128. package/dist/interactions/extended-text/response.js.map +1 -1
  129. package/dist/interactions/gap-match/extractor.d.ts +40 -2
  130. package/dist/interactions/gap-match/extractor.js +197 -39
  131. package/dist/interactions/gap-match/extractor.js.map +1 -1
  132. package/dist/interactions/graphic-associate/extractor.d.ts +11 -0
  133. package/dist/interactions/graphic-associate/extractor.js +35 -24
  134. package/dist/interactions/graphic-associate/extractor.js.map +1 -1
  135. package/dist/interactions/graphic-gap-match/extractor.d.ts +21 -0
  136. package/dist/interactions/graphic-gap-match/extractor.js +79 -43
  137. package/dist/interactions/graphic-gap-match/extractor.js.map +1 -1
  138. package/dist/interactions/graphic-order/extractor.d.ts +15 -0
  139. package/dist/interactions/graphic-order/extractor.js +39 -24
  140. package/dist/interactions/graphic-order/extractor.js.map +1 -1
  141. package/dist/interactions/hotspot/extractor.d.ts +6 -0
  142. package/dist/interactions/hotspot/extractor.js +31 -16
  143. package/dist/interactions/hotspot/extractor.js.map +1 -1
  144. package/dist/interactions/hottext/extractor.js +2 -12
  145. package/dist/interactions/hottext/extractor.js.map +1 -1
  146. package/dist/interactions/inline/accessibleName.d.ts +29 -0
  147. package/dist/interactions/inline/accessibleName.js +35 -0
  148. package/dist/interactions/inline/accessibleName.js.map +1 -0
  149. package/dist/interactions/inline/render-plan.d.ts +5 -14
  150. package/dist/interactions/inline/render-plan.js +5 -56
  151. package/dist/interactions/inline/render-plan.js.map +1 -1
  152. package/dist/interactions/inline-choice/extractor.d.ts +4 -0
  153. package/dist/interactions/inline-choice/extractor.js +13 -12
  154. package/dist/interactions/inline-choice/extractor.js.map +1 -1
  155. package/dist/interactions/match/extractor.d.ts +2 -0
  156. package/dist/interactions/match/extractor.js +14 -28
  157. package/dist/interactions/match/extractor.js.map +1 -1
  158. package/dist/interactions/media/extractor.d.ts +5 -11
  159. package/dist/interactions/media/extractor.js +100 -36
  160. package/dist/interactions/media/extractor.js.map +1 -1
  161. package/dist/interactions/modules.js +8 -2
  162. package/dist/interactions/modules.js.map +1 -1
  163. package/dist/interactions/order/extractor.d.ts +2 -0
  164. package/dist/interactions/order/extractor.js +8 -12
  165. package/dist/interactions/order/extractor.js.map +1 -1
  166. package/dist/interactions/order/limits.d.ts +29 -0
  167. package/dist/interactions/order/limits.js +28 -0
  168. package/dist/interactions/order/limits.js.map +1 -0
  169. package/dist/interactions/portable-custom/extractor.js +4 -2
  170. package/dist/interactions/portable-custom/extractor.js.map +1 -1
  171. package/dist/interactions/position-object/extractor.d.ts +18 -1
  172. package/dist/interactions/position-object/extractor.js +81 -22
  173. package/dist/interactions/position-object/extractor.js.map +1 -1
  174. package/dist/interactions/select-point/extractor.d.ts +6 -0
  175. package/dist/interactions/select-point/extractor.js +31 -19
  176. package/dist/interactions/select-point/extractor.js.map +1 -1
  177. package/dist/interactions/shared/imageAlt.d.ts +54 -0
  178. package/dist/interactions/shared/imageAlt.js +84 -0
  179. package/dist/interactions/shared/imageAlt.js.map +1 -0
  180. package/dist/interactions/shared/interactionImage.d.ts +32 -0
  181. package/dist/interactions/shared/interactionImage.js +39 -0
  182. package/dist/interactions/shared/interactionImage.js.map +1 -0
  183. package/dist/interactions/shared/specDefaults.d.ts +20 -0
  184. package/dist/interactions/shared/specDefaults.js +25 -0
  185. package/dist/interactions/shared/specDefaults.js.map +1 -0
  186. package/dist/interactions/shared/types.d.ts +212 -40
  187. package/dist/interactions/shared/types.js.map +1 -1
  188. package/dist/interactions/text-entry/extractor.d.ts +9 -0
  189. package/dist/interactions/text-entry/extractor.js +9 -0
  190. package/dist/interactions/text-entry/extractor.js.map +1 -1
  191. package/dist/interactions/text-entry/inlineInputStyle.d.ts +10 -0
  192. package/dist/interactions/text-entry/inlineInputStyle.js +12 -0
  193. package/dist/interactions/text-entry/inlineInputStyle.js.map +1 -0
  194. package/dist/interactions/text-entry/inputMode.d.ts +35 -0
  195. package/dist/interactions/text-entry/inputMode.js +134 -0
  196. package/dist/interactions/text-entry/inputMode.js.map +1 -0
  197. package/dist/interactions/text-entry/response.d.ts +15 -0
  198. package/dist/interactions/text-entry/response.js +25 -0
  199. package/dist/interactions/text-entry/response.js.map +1 -0
  200. package/dist/interactions/upload/extractor.js +2 -2
  201. package/dist/interactions/upload/extractor.js.map +1 -1
  202. package/dist/pci/PciHost.d.ts +1 -1
  203. package/dist/pci/PciHost.js +11 -11
  204. package/dist/pci/PciHost.js.map +1 -1
  205. package/dist/pci/index.d.ts +1 -0
  206. package/dist/pci/index.js.map +1 -1
  207. package/dist/pci/modulePaths.d.ts +16 -0
  208. package/dist/pci/modulePaths.js +33 -0
  209. package/dist/pci/modulePaths.js.map +1 -0
  210. package/dist/pci/pageRealmSession.js +3 -15
  211. package/dist/pci/pageRealmSession.js.map +1 -1
  212. package/dist/pci/qtiVariableJson.d.ts +46 -3
  213. package/dist/pci/qtiVariableJson.js +247 -53
  214. package/dist/pci/qtiVariableJson.js.map +1 -1
  215. package/dist/pci/sandbox/SandboxedPciSession.d.ts +3 -0
  216. package/dist/pci/sandbox/SandboxedPciSession.js +15 -14
  217. package/dist/pci/sandbox/SandboxedPciSession.js.map +1 -1
  218. package/dist/pci/sandbox/iframeConnector.d.ts +18 -4
  219. package/dist/pci/sandbox/iframeConnector.js +35 -6
  220. package/dist/pci/sandbox/iframeConnector.js.map +1 -1
  221. package/dist/pci/sandbox/protocol.d.ts +14 -0
  222. package/dist/pci/sandbox/protocol.js.map +1 -1
  223. package/dist/pci/sessionHosts.d.ts +47 -0
  224. package/dist/pci/sessionHosts.js +66 -0
  225. package/dist/pci/sessionHosts.js.map +1 -0
  226. package/dist/pci/types.d.ts +7 -1
  227. package/dist/pci/types.js.map +1 -1
  228. package/dist/pnp/applyPnp.d.ts +20 -3
  229. package/dist/pnp/applyPnp.js +84 -9
  230. package/dist/pnp/applyPnp.js.map +1 -1
  231. package/dist/pnp/parsePnpXml.js +2 -0
  232. package/dist/pnp/parsePnpXml.js.map +1 -1
  233. package/dist/pnp/types.d.ts +16 -8
  234. package/dist/pnp/types.js.map +1 -1
  235. package/dist/presentation/feedbackAnnouncement.d.ts +56 -0
  236. package/dist/presentation/feedbackAnnouncement.js +150 -0
  237. package/dist/presentation/feedbackAnnouncement.js.map +1 -0
  238. package/dist/presentation/interactionSlots.d.ts +31 -0
  239. package/dist/presentation/interactionSlots.js +101 -0
  240. package/dist/presentation/interactionSlots.js.map +1 -0
  241. package/dist/presentation/itemPresentationPlan.d.ts +69 -6
  242. package/dist/presentation/itemPresentationPlan.js +93 -81
  243. package/dist/presentation/itemPresentationPlan.js.map +1 -1
  244. package/dist/{components/utils → presentation}/stimulusRender.js +3 -12
  245. package/dist/presentation/stimulusRender.js.map +1 -0
  246. package/dist/presentation/stylesheetRender.js.map +1 -0
  247. package/dist/security/escapeHtml.d.ts +15 -0
  248. package/dist/security/escapeHtml.js +22 -0
  249. package/dist/security/escapeHtml.js.map +1 -0
  250. package/dist/security/index.d.ts +1 -0
  251. package/dist/security/index.js +1 -0
  252. package/dist/security/index.js.map +1 -1
  253. package/dist/server.d.ts +8 -1
  254. package/dist/server.js.map +1 -1
  255. package/dist/session-inputs.d.ts +108 -0
  256. package/dist/session-inputs.js +130 -0
  257. package/dist/session-inputs.js.map +1 -0
  258. package/dist/types/index.d.ts +67 -35
  259. package/dist/types/index.js.map +1 -1
  260. package/dist/utils/cloneFreeze.d.ts +52 -0
  261. package/dist/utils/cloneFreeze.js +113 -0
  262. package/dist/utils/cloneFreeze.js.map +1 -0
  263. package/dist/utils/htmlAttributes.d.ts +13 -0
  264. package/dist/utils/htmlAttributes.js +22 -0
  265. package/dist/utils/htmlAttributes.js.map +1 -0
  266. package/dist/web-components/QTIInteractionElement.d.ts +0 -29
  267. package/dist/web-components/QTIInteractionElement.js +0 -32
  268. package/dist/web-components/QTIInteractionElement.js.map +1 -1
  269. package/dist/web-components/index.d.ts +1 -2
  270. package/dist/web-components/index.js +2 -3
  271. package/dist/web-components/index.js.map +1 -1
  272. package/package.json +15 -14
  273. package/dist/components/utils/stimulusRender.js.map +0 -1
  274. package/dist/components/utils/stylesheetRender.js.map +0 -1
  275. package/dist/core/constants.d.ts +0 -65
  276. package/dist/core/constants.js +0 -74
  277. package/dist/core/constants.js.map +0 -1
  278. package/dist/element-class-DdpiTalY.js +0 -9226
  279. package/dist/element-class-DdpiTalY.js.map +0 -1
  280. package/dist/extensions/MathLiveEditor.d.ts +0 -31
  281. package/dist/extensions/MathLiveEditor.js +0 -248
  282. package/dist/extensions/MathLiveEditor.js.map +0 -1
  283. package/dist/utils/PerformanceMonitor.d.ts +0 -169
  284. package/dist/utils/PerformanceMonitor.js +0 -243
  285. package/dist/utils/PerformanceMonitor.js.map +0 -1
  286. package/dist/utils/responseUtils.d.ts +0 -15
  287. package/dist/utils/responseUtils.js +0 -46
  288. package/dist/utils/responseUtils.js.map +0 -1
  289. package/dist/web-components/QTIInteractionBase.d.ts +0 -119
  290. package/dist/web-components/QTIInteractionBase.js +0 -244
  291. package/dist/web-components/QTIInteractionBase.js.map +0 -1
  292. /package/dist/{components/utils → presentation}/stimulusRender.d.ts +0 -0
  293. /package/dist/{components/utils → presentation}/stylesheetRender.d.ts +0 -0
  294. /package/dist/{components/utils → presentation}/stylesheetRender.js +0 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Reads one attribute out of a serialized HTML attribute string — the attribute text of a matched
3
+ * tag (e.g. a regex capture of `<gap identifier="g1">`), not a DOM element. This is the one reader
4
+ * for markup the player handles as text: the gap-match extractor's prompt rewriting, the
5
+ * presentation pass's stimulus docking, and the feedback announcement's feedback tags.
6
+ *
7
+ * Quote pairs must match, an empty value is a value (`identifier=""` is present and empty, not
8
+ * absent), and a camelCase name also tries its kebab spelling (`outcomeIdentifier` or
9
+ * `outcome-identifier`), since QTI 2.x and QTI 3.0 spell attributes differently. Only whitespace
10
+ * may precede the name, so `data-identifier` does not read as `identifier`. Returns null when the
11
+ * attribute is absent; otherwise its value, untrimmed.
12
+ */
13
+ export function readHtmlAttribute(attrs, name) {
14
+ const kebab = name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
15
+ for (const spelling of kebab === name ? [name] : [name, kebab]) {
16
+ const match = new RegExp(`(?:^|\\s)${spelling}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`, 'i').exec(attrs);
17
+ if (match)
18
+ return match[1] ?? match[2] ?? '';
19
+ }
20
+ return null;
21
+ }
22
+ //# sourceMappingURL=htmlAttributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"htmlAttributes.js","sourceRoot":"","sources":["../../src/utils/htmlAttributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,IAAY;IAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IAC7E,KAAK,MAAM,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC;QAChE,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,YAAY,QAAQ,kCAAkC,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClG,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,IAAI,CAAC;AACb,CAAC","sourcesContent":["/**\n * Reads one attribute out of a serialized HTML attribute string — the attribute text of a matched\n * tag (e.g. a regex capture of `<gap identifier=\"g1\">`), not a DOM element. This is the one reader\n * for markup the player handles as text: the gap-match extractor's prompt rewriting, the\n * presentation pass's stimulus docking, and the feedback announcement's feedback tags.\n *\n * Quote pairs must match, an empty value is a value (`identifier=\"\"` is present and empty, not\n * absent), and a camelCase name also tries its kebab spelling (`outcomeIdentifier` or\n * `outcome-identifier`), since QTI 2.x and QTI 3.0 spell attributes differently. Only whitespace\n * may precede the name, so `data-identifier` does not read as `identifier`. Returns null when the\n * attribute is absent; otherwise its value, untrimmed.\n */\nexport function readHtmlAttribute(attrs: string, name: string): string | null {\n\tconst kebab = name.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n\tfor (const spelling of kebab === name ? [name] : [name, kebab]) {\n\t\tconst match = new RegExp(`(?:^|\\\\s)${spelling}\\\\s*=\\\\s*(?:\"([^\"]*)\"|'([^']*)')`, 'i').exec(attrs);\n\t\tif (match) return match[1] ?? match[2] ?? '';\n\t}\n\treturn null;\n}\n"]}
@@ -48,32 +48,3 @@ export interface QTIChangeEventDetail<TValue = InteractionResponseValue | null>
48
48
  export declare class QTIChangeEvent<TValue = InteractionResponseValue | null> extends CustomEvent<QTIChangeEventDetail<TValue>> {
49
49
  constructor(detail: QTIChangeEventDetail<TValue>);
50
50
  }
51
- /**
52
- * Event emitted when a component is ready (initialized and rendered)
53
- */
54
- export declare class QTIReadyEvent extends CustomEvent<void> {
55
- constructor();
56
- }
57
- /**
58
- * Event emitted when an error occurs in a component
59
- */
60
- export interface QTIErrorEventDetail {
61
- /** The error that occurred */
62
- error: Error;
63
- /** Context about where the error occurred */
64
- context: string;
65
- }
66
- export declare class QTIErrorEvent extends CustomEvent<QTIErrorEventDetail> {
67
- constructor(detail: QTIErrorEventDetail);
68
- }
69
- /**
70
- * Special event for AssociateInteraction selection state
71
- * (used for tracking which item is selected for pairing)
72
- */
73
- export interface QTISelectionChangeEventDetail {
74
- /** The identifier of the selected item, or null if deselected */
75
- selected: string | null;
76
- }
77
- export declare class QTISelectionChangeEvent extends CustomEvent<QTISelectionChangeEventDetail> {
78
- constructor(detail: QTISelectionChangeEventDetail);
79
- }
@@ -27,36 +27,4 @@ export class QTIChangeEvent extends CustomEvent {
27
27
  });
28
28
  }
29
29
  }
30
- /**
31
- * Event emitted when a component is ready (initialized and rendered)
32
- */
33
- export class QTIReadyEvent extends CustomEvent {
34
- constructor() {
35
- super('qti-ready', {
36
- bubbles: true,
37
- composed: true,
38
- cancelable: false,
39
- });
40
- }
41
- }
42
- export class QTIErrorEvent extends CustomEvent {
43
- constructor(detail) {
44
- super('qti-error', {
45
- detail,
46
- bubbles: true,
47
- composed: true,
48
- cancelable: false,
49
- });
50
- }
51
- }
52
- export class QTISelectionChangeEvent extends CustomEvent {
53
- constructor(detail) {
54
- super('qti-selection-change', {
55
- detail,
56
- bubbles: true,
57
- composed: true,
58
- cancelable: false,
59
- });
60
- }
61
- }
62
30
  //# sourceMappingURL=QTIInteractionElement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QTIInteractionElement.js","sourceRoot":"","sources":["../../src/web-components/QTIInteractionElement.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4CH;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,cAAyD,SAAQ,WAAyC;IACtH,YAAY,MAAoC;QAC/C,KAAK,CAAC,YAAY,EAAE;YACnB,MAAM;YACN,OAAO,EAAE,IAAI,EAAE,6BAA6B;YAC5C,QAAQ,EAAE,IAAI,EAAE,8BAA8B;YAC9C,UAAU,EAAE,KAAK,EAAE,sBAAsB;SACzC,CAAC,CAAC;IACJ,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,WAAiB;IACnD;QACC,KAAK,CAAC,WAAW,EAAE;YAClB,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAaD,MAAM,OAAO,aAAc,SAAQ,WAAgC;IAClE,YAAY,MAA2B;QACtC,KAAK,CAAC,WAAW,EAAE;YAClB,MAAM;YACN,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;CACD;AAWD,MAAM,OAAO,uBAAwB,SAAQ,WAA0C;IACtF,YAAY,MAAqC;QAChD,KAAK,CAAC,sBAAsB,EAAE;YAC7B,MAAM;YACN,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,KAAK;SACjB,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/**\n * Standard interface and event types for QTI interaction web components\n *\n * All QTI interaction web components must implement the QTIInteractionElement\n * interface and emit QTIChangeEvent when the user response changes.\n */\n\nimport type { BaseInteractionData, InteractionValueMap } from '../interactions/shared/types.js';\n\nexport type InteractionResponseValue<TData extends BaseInteractionData = BaseInteractionData> =\n\tTData extends { type: infer TType }\n\t\t? TType extends keyof InteractionValueMap\n\t\t\t? InteractionValueMap[TType]\n\t\t\t: unknown\n\t\t: unknown;\n\n/**\n * Standard interface that all QTI interaction web components must implement\n */\nexport interface QTIInteractionElement<\n\tTData extends BaseInteractionData = BaseInteractionData,\n> extends HTMLElement {\n\t/** The processed interaction data from the QTI XML */\n\tinteraction: TData;\n\n\t/** The current response value (type depends on interaction type) */\n\tresponse: InteractionResponseValue<TData> | null;\n\n\t/** Whether the interaction is in read-only/disabled mode */\n\tdisabled: boolean;\n\n\t/** Optional function to apply math typesetting (e.g., KaTeX, MathJax) */\n\ttypeset?: (element: HTMLElement) => void;\n}\n\n/**\n * Detail payload for the qti-change event\n */\nexport interface QTIChangeEventDetail<TValue = InteractionResponseValue | null> {\n\t/** The response identifier for this interaction */\n\tresponseId: string;\n\n\t/** The new response value */\n\tvalue: TValue;\n\n\t/** Timestamp when the change occurred */\n\ttimestamp: number;\n}\n\n/**\n * Custom event emitted when an interaction's response changes\n *\n * This event bubbles and can cross shadow DOM boundaries, making it\n * easy to listen for changes at the container level.\n *\n * @example\n * ```typescript\n * element.addEventListener('qti-change', (event: QTIChangeEvent) => {\n * console.log('Response changed:', event.detail.responseId, event.detail.value);\n * });\n * ```\n */\nexport class QTIChangeEvent<TValue = InteractionResponseValue | null> extends CustomEvent<QTIChangeEventDetail<TValue>> {\n\tconstructor(detail: QTIChangeEventDetail<TValue>) {\n\t\tsuper('qti-change', {\n\t\t\tdetail,\n\t\t\tbubbles: true, // Bubble up through DOM tree\n\t\t\tcomposed: true, // Cross shadow DOM boundaries\n\t\t\tcancelable: false, // Cannot be prevented\n\t\t});\n\t}\n}\n\n/**\n * Event emitted when a component is ready (initialized and rendered)\n */\nexport class QTIReadyEvent extends CustomEvent<void> {\n\tconstructor() {\n\t\tsuper('qti-ready', {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t\tcancelable: false,\n\t\t});\n\t}\n}\n\n/**\n * Event emitted when an error occurs in a component\n */\nexport interface QTIErrorEventDetail {\n\t/** The error that occurred */\n\terror: Error;\n\n\t/** Context about where the error occurred */\n\tcontext: string;\n}\n\nexport class QTIErrorEvent extends CustomEvent<QTIErrorEventDetail> {\n\tconstructor(detail: QTIErrorEventDetail) {\n\t\tsuper('qti-error', {\n\t\t\tdetail,\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t\tcancelable: false,\n\t\t});\n\t}\n}\n\n/**\n * Special event for AssociateInteraction selection state\n * (used for tracking which item is selected for pairing)\n */\nexport interface QTISelectionChangeEventDetail {\n\t/** The identifier of the selected item, or null if deselected */\n\tselected: string | null;\n}\n\nexport class QTISelectionChangeEvent extends CustomEvent<QTISelectionChangeEventDetail> {\n\tconstructor(detail: QTISelectionChangeEventDetail) {\n\t\tsuper('qti-selection-change', {\n\t\t\tdetail,\n\t\t\tbubbles: true,\n\t\t\tcomposed: true,\n\t\t\tcancelable: false,\n\t\t});\n\t}\n}\n"]}
1
+ {"version":3,"file":"QTIInteractionElement.js","sourceRoot":"","sources":["../../src/web-components/QTIInteractionElement.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4CH;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,cAAyD,SAAQ,WAAyC;IACtH,YAAY,MAAoC;QAC/C,KAAK,CAAC,YAAY,EAAE;YACnB,MAAM;YACN,OAAO,EAAE,IAAI,EAAE,6BAA6B;YAC5C,QAAQ,EAAE,IAAI,EAAE,8BAA8B;YAC9C,UAAU,EAAE,KAAK,EAAE,sBAAsB;SACzC,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["/**\n * Standard interface and event types for QTI interaction web components\n *\n * All QTI interaction web components must implement the QTIInteractionElement\n * interface and emit QTIChangeEvent when the user response changes.\n */\n\nimport type { BaseInteractionData, InteractionValueMap } from '../interactions/shared/types.js';\n\nexport type InteractionResponseValue<TData extends BaseInteractionData = BaseInteractionData> =\n\tTData extends { type: infer TType }\n\t\t? TType extends keyof InteractionValueMap\n\t\t\t? InteractionValueMap[TType]\n\t\t\t: unknown\n\t\t: unknown;\n\n/**\n * Standard interface that all QTI interaction web components must implement\n */\nexport interface QTIInteractionElement<\n\tTData extends BaseInteractionData = BaseInteractionData,\n> extends HTMLElement {\n\t/** The processed interaction data from the QTI XML */\n\tinteraction: TData;\n\n\t/** The current response value (type depends on interaction type) */\n\tresponse: InteractionResponseValue<TData> | null;\n\n\t/** Whether the interaction is in read-only/disabled mode */\n\tdisabled: boolean;\n\n\t/** Optional function to apply math typesetting (e.g., KaTeX, MathJax) */\n\ttypeset?: (element: HTMLElement) => void;\n}\n\n/**\n * Detail payload for the qti-change event\n */\nexport interface QTIChangeEventDetail<TValue = InteractionResponseValue | null> {\n\t/** The response identifier for this interaction */\n\tresponseId: string;\n\n\t/** The new response value */\n\tvalue: TValue;\n\n\t/** Timestamp when the change occurred */\n\ttimestamp: number;\n}\n\n/**\n * Custom event emitted when an interaction's response changes\n *\n * This event bubbles and can cross shadow DOM boundaries, making it\n * easy to listen for changes at the container level.\n *\n * @example\n * ```typescript\n * element.addEventListener('qti-change', (event: QTIChangeEvent) => {\n * console.log('Response changed:', event.detail.responseId, event.detail.value);\n * });\n * ```\n */\nexport class QTIChangeEvent<TValue = InteractionResponseValue | null> extends CustomEvent<QTIChangeEventDetail<TValue>> {\n\tconstructor(detail: QTIChangeEventDetail<TValue>) {\n\t\tsuper('qti-change', {\n\t\t\tdetail,\n\t\t\tbubbles: true, // Bubble up through DOM tree\n\t\t\tcomposed: true, // Cross shadow DOM boundaries\n\t\t\tcancelable: false, // Cannot be prevented\n\t\t});\n\t}\n}\n"]}
@@ -3,5 +3,4 @@
3
3
  *
4
4
  * Framework-agnostic web components that can be used in any JavaScript environment
5
5
  */
6
- export { QTIInteractionBase } from './QTIInteractionBase.js';
7
- export { QTIChangeEvent, type InteractionResponseValue, type QTIChangeEventDetail, QTIErrorEvent, type QTIErrorEventDetail, type QTIInteractionElement, QTIReadyEvent, QTISelectionChangeEvent, type QTISelectionChangeEventDetail, } from './QTIInteractionElement.js';
6
+ export { QTIChangeEvent, type InteractionResponseValue, type QTIChangeEventDetail, type QTIInteractionElement, } from './QTIInteractionElement.js';
@@ -3,9 +3,8 @@
3
3
  *
4
4
  * Framework-agnostic web components that can be used in any JavaScript environment
5
5
  */
6
- // Export base classes and interfaces
7
- export { QTIInteractionBase } from './QTIInteractionBase.js';
8
- export { QTIChangeEvent, QTIErrorEvent, QTIReadyEvent, QTISelectionChangeEvent, } from './QTIInteractionElement.js';
6
+ // Export event classes and interfaces
7
+ export { QTIChangeEvent, } from './QTIInteractionElement.js';
9
8
  // Note: Web component implementations are provided by separate packages
10
9
  // (e.g., @pie-qti/default-components) that use these base classes
11
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,qCAAqC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EACN,cAAc,EAGd,aAAa,EAGb,aAAa,EACb,uBAAuB,GAEvB,MAAM,4BAA4B,CAAC;AAEpC,wEAAwE;AACxE,kEAAkE","sourcesContent":["/**\n * Web Components for QTI Interactions\n *\n * Framework-agnostic web components that can be used in any JavaScript environment\n */\n\n// Export base classes and interfaces\nexport { QTIInteractionBase } from './QTIInteractionBase.js';\nexport {\n\tQTIChangeEvent,\n\ttype InteractionResponseValue,\n\ttype QTIChangeEventDetail,\n\tQTIErrorEvent,\n\ttype QTIErrorEventDetail,\n\ttype QTIInteractionElement,\n\tQTIReadyEvent,\n\tQTISelectionChangeEvent,\n\ttype QTISelectionChangeEventDetail,\n} from './QTIInteractionElement.js';\n\n// Note: Web component implementations are provided by separate packages\n// (e.g., @pie-qti/default-components) that use these base classes\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/web-components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,sCAAsC;AACtC,OAAO,EACN,cAAc,GAId,MAAM,4BAA4B,CAAC;AAEpC,wEAAwE;AACxE,kEAAkE","sourcesContent":["/**\n * Web Components for QTI Interactions\n *\n * Framework-agnostic web components that can be used in any JavaScript environment\n */\n\n// Export event classes and interfaces\nexport {\n\tQTIChangeEvent,\n\ttype InteractionResponseValue,\n\ttype QTIChangeEventDetail,\n\ttype QTIInteractionElement,\n} from './QTIInteractionElement.js';\n\n// Note: Web component implementations are provided by separate packages\n// (e.g., @pie-qti/default-components) that use these base classes\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-qti/item-player",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Modern QTI player supporting QTI 2.2 and 3.0 - Client-side with optional backend hooks",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -8,8 +8,9 @@
8
8
  "scripts": {
9
9
  "build": "vite build && tsc",
10
10
  "dev": "tsc --watch",
11
- "test": "bun test && tsc -p ./tsconfig.server-types.test.json",
12
- "typecheck": "tsc --noEmit",
11
+ "test": "bun test && tsc -p ./tsconfig.server-types.test.json && bun run test:component",
12
+ "test:component": "vitest run",
13
+ "typecheck": "tsc --noEmit && tsc -p ./tsconfig.test.json --noEmit",
13
14
  "check": "svelte-check --tsconfig ./tsconfig.svelte.json",
14
15
  "lint": "biome check .",
15
16
  "lint:fix": "biome check --write .",
@@ -27,22 +28,24 @@
27
28
  ],
28
29
  "license": "MIT",
29
30
  "dependencies": {
30
- "@pie-qti/i18n": "1.0.0-beta.4",
31
- "@pie-qti/ims-cp-core": "1.0.0-beta.4",
32
- "@pie-qti/qti-common": "1.0.0-beta.4",
33
- "@pie-qti/qti-processing": "1.0.0-beta.4",
34
- "mathlive": "^0.111.1",
31
+ "@pie-qti/i18n": "1.0.0-beta.5",
32
+ "@pie-qti/ims-cp-core": "1.0.0-beta.5",
33
+ "@pie-qti/qti-common": "1.0.0-beta.5",
34
+ "@pie-qti/qti-processing": "1.0.0-beta.5",
35
35
  "node-html-parser": "^9.0.5"
36
36
  },
37
37
  "devDependencies": {
38
- "@biomejs/biome": "^2.6.2",
38
+ "@biomejs/biome": "^2.6.4",
39
39
  "@sveltejs/vite-plugin-svelte": "^7.3.1",
40
- "@types/node": "^26.6.4",
40
+ "@types/node": "^26.6.6",
41
+ "jsdom": "^30.1.3",
42
+ "linkedom": "^0.18.13",
41
43
  "svelte": "^5.57.1",
42
44
  "svelte-check": "^4.7.7",
43
45
  "typescript": "^5.9.3",
44
46
  "vite": "^8.3.4",
45
- "vite-plugin-dts": "^5.1.2"
47
+ "vite-plugin-dts": "^5.1.2",
48
+ "vitest": "^5.0.5"
46
49
  },
47
50
  "exports": {
48
51
  ".": {
@@ -98,7 +101,5 @@
98
101
  },
99
102
  "files": [
100
103
  "dist"
101
- ],
102
- "unpkg": "./dist/element.js",
103
- "jsdelivr": "./dist/element.js"
104
+ ]
104
105
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"stimulusRender.js","sourceRoot":"","sources":["../../../src/components/utils/stimulusRender.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAC5C,eAAwD,EACxD,QAA2B;IAE3B,OAAO,MAAM,CAAC,WAAW,CACxB,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC;QAC9E,UAAU;QACV,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC;KAC3B,CAAC,CACF,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAoB,EAAE,eAAuC;IAClG,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IAEnE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,IAAI,IAAI,GAAG,YAAY,CAAC,OAAO,CAC9B,+EAA+E,EAC/E,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE;QAC7C,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAC3B,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACvB,OAAO,IAAI,OA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AAC,CAAC;IAClF,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC3B,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa,EAAE,SAAiB;IAC5D,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;IAClE,IAAI,CAAC,UAAU;QAAE,OAAO,GAAG,KAAK,WAAW,SAAS,GAAG,CAAC;IACxD,MAAM,KAAK,GAAG,UAAU,CAAC,CAAC,CAAE,CAAC;IAC7B,MAAM,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/D,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACvB,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,SAAS,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC;AAC/F,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACzC,OAAO,KAAK;SACV,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;SACvB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import type { ResolvedItemDeliveryContext } from '@pie-qti/ims-cp-core';\n\nexport type StimulusSanitizer = (html: string) => string;\n\n/**\n * Build the effective stimulus content map for an item render.\n *\n * Resolved delivery-context content is the package/assessment source of truth.\n */\nexport function buildEffectiveStimulusContent(\n\tdeliveryContext: ResolvedItemDeliveryContext | undefined,\n\tsanitize: StimulusSanitizer\n): Record<string, string> {\n\treturn Object.fromEntries(\n\t\tObject.entries(deliveryContext?.stimuli ?? {}).map(([identifier, stimulus]) => [\n\t\t\tidentifier,\n\t\t\tsanitize(stimulus.bodyHtml),\n\t\t])\n\t);\n}\n\n/**\n * Inject shared stimulus bodies at QTI refs or host-authored docking points.\n *\n * Any resolved stimulus that has no matching docking point is prepended in\n * delivery-context order so undocked package content is still visible.\n */\nexport function injectStimulusContent(itemBodyHtml: string, stimulusContent: Record<string, string>): string {\n\tif (Object.keys(stimulusContent).length === 0) return itemBodyHtml;\n\n\tconst docked = new Set<string>();\n\tlet html = itemBodyHtml.replace(\n\t\t/<([a-z][\\w:-]*)([^>]*\\bdata-stimulus-idref=([\"'])([^\"']+)\\3[^>]*)>\\s*<\\/\\1>/gi,\n\t\t(match, tagName, attrs, _quote, identifier) => {\n\t\t\tconst content = stimulusContent[identifier];\n\t\t\tif (!content) return match;\n\t\t\tdocked.add(identifier);\n\t\t\treturn `<${tagName}${mergeClassAttribute(attrs, 'qti-stimulus-dock')}>${content}</${tagName}>`;\n\t\t}\n\t);\n\n\thtml = html.replace(\n\t\t/<qti-assessment-stimulus-ref\\b([^>]*)\\/?>\\s*(?:<\\/qti-assessment-stimulus-ref>)?/gi,\n\t\t(match, attrs) => {\n\t\t\tconst identifier = extractAttribute(attrs, 'identifier');\n\t\t\tif (!identifier) return match;\n\t\t\tif (docked.has(identifier)) return '';\n\t\t\tconst content = stimulusContent[identifier];\n\t\t\tif (!content) return match;\n\t\t\tdocked.add(identifier);\n\t\t\treturn `<div data-stimulus-idref=\"${escapeHtmlAttribute(identifier)}\" class=\"qti-stimulus-dock\">${content}</div>`;\n\t\t}\n\t);\n\n\tconst undocked = Object.entries(stimulusContent)\n\t\t.filter(([identifier]) => !docked.has(identifier))\n\t\t.map(\n\t\t\t([identifier, content]) =>\n\t\t\t\t`<div data-stimulus-idref=\"${escapeHtmlAttribute(identifier)}\" class=\"qti-stimulus-block\">${content}</div>`\n\t\t)\n\t\t.join('');\n\n\treturn undocked ? undocked + html : html;\n}\n\nfunction extractAttribute(attrs: string, name: string): string | null {\n\tconst match = attrs.match(new RegExp(`\\\\b${name}\\\\s*=\\\\s*[\"']([^\"']+)[\"']`, 'i'));\n\treturn match?.[1] ?? null;\n}\n\nfunction mergeClassAttribute(attrs: string, className: string): string {\n\tconst classMatch = attrs.match(/\\bclass\\s*=\\s*([\"'])([^\"']*)\\1/i);\n\tif (!classMatch) return `${attrs} class=\"${className}\"`;\n\tconst quote = classMatch[1]!;\n\tconst existing = classMatch[2] ?? '';\n\tconst classes = new Set(existing.split(/\\s+/).filter(Boolean));\n\tclasses.add(className);\n\treturn attrs.replace(classMatch[0], `class=${quote}${Array.from(classes).join(' ')}${quote}`);\n}\n\nfunction escapeHtmlAttribute(value: string): string {\n\treturn value\n\t\t.replace(/&/g, '&amp;')\n\t\t.replace(/\"/g, '&quot;')\n\t\t.replace(/</g, '&lt;')\n\t\t.replace(/>/g, '&gt;');\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"stylesheetRender.js","sourceRoot":"","sources":["../../../src/components/utils/stylesheetRender.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,MAAM,UAAU,wBAAwB,CACvC,eAAwD,EACxD,aAAa,GAAG,4BAA4B;IAE5C,IAAI,CAAC,eAAe;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO,eAAe,CAAC,WAAW;SAChC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,qBAAqB,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;SACrE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AACd,CAAC;AAED,SAAS,qBAAqB,CAAC,UAAoC,EAAE,aAAqB;IACzF,MAAM,GAAG,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,CAAC,GAAG,IAAI,sBAAsB,CAAC,GAA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AAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;YAC9C,kEAAkE;YAClE,GAAG,IAAI,GAAG,CAAC;YACX,SAAS;QACV,CAAC;QACD,GAAG,IAAI,IAAI,CAAC;QACZ,KAAK,IAAI,CAAC,CAAC;IACZ,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AACpF,CAAC","sourcesContent":["import type { ResolvedItemDeliveryContext, ResolvedQtiStylesheetRef } from '@pie-qti/ims-cp-core';\nimport { isBlockedStylesheetCss } from '@pie-qti/ims-cp-core';\n\nexport function buildScopedStylesheetCss(\n\tdeliveryContext: ResolvedItemDeliveryContext | undefined,\n\tscopeSelector = '[data-qti-item-body-scope]'\n): string {\n\tif (!deliveryContext) return '';\n\treturn deliveryContext.stylesheets\n\t\t.map((stylesheet) => stylesheetToScopedCss(stylesheet, scopeSelector))\n\t\t.filter(Boolean)\n\t\t.join('\\n');\n}\n\nfunction stylesheetToScopedCss(stylesheet: ResolvedQtiStylesheetRef, scopeSelector: string): string {\n\tconst css = stylesheet.cssText?.trim();\n\tif (!css || isBlockedStylesheetCss(css)) return '';\n\tconst stylesheetScope = getStylesheetScopeSelector(stylesheet, scopeSelector);\n\tconst scoped = scopeCssRules(css, stylesheetScope);\n\tif (!scoped) return '';\n\treturn scoped;\n}\n\n/**\n * At-rules whose block contains nested *rules*, so scoping recurses into the\n * block while the prelude is preserved verbatim.\n *\n * Anything not listed here is passed through untouched. That is the safe\n * default both ways: at-rules whose block holds declarations rather than rules\n * (`@font-face`, `@page`, `@property`, `@counter-style`) or non-selector keys\n * (`@keyframes` percentages) must not be scoped, and an at-rule this list has\n * never heard of is more safely left alone than guessed at.\n */\nconst NESTED_RULE_AT_RULES = new Set(['media', 'supports', 'container', 'layer', 'scope']);\n\n/** Matches a leading `:root`, `html` or `body` not followed by more name characters. */\nconst DOCUMENT_ROOT_PREFIX = /^(?::root|html|body)(?![\\w-])/;\n\n/** Matches an at-rule name, with any vendor prefix, at the start of a prelude. */\nconst AT_RULE_NAME = /^@(?:-[a-z]+-)?([\\w-]+)/i;\n\ntype StyleNode =\n\t/** A `;`-terminated at-rule with no block, such as `@layer a;`. */\n\t| { kind: 'statement'; text: string; end: number }\n\t/** A prelude plus a `{ ... }` block: a style rule or a block at-rule. */\n\t| { kind: 'rule'; prelude: string; block: string; end: number }\n\t/** Trailing text with no rule in it, kept so nothing is silently dropped. */\n\t| { kind: 'trailing'; text: string; end: number };\n\n/**\n * Confine every selector in `css` to `scopeSelector`.\n *\n * This walks the stylesheet brace-by-brace. It used to be a single regex over\n * `([^{}@]+)\\{([^{}]*)\\}`, which handled flat selector rules and silently\n * destroyed at-rules. Because `@` was excluded from the selector pattern rather\n * than *understood*, an `@media` block never matched as a unit, so the inner\n * rules matched on their own and were emitted **without the condition** — the\n * media query was dropped and its rules applied unconditionally, so a\n * print-only or narrow-viewport rule took effect everywhere. `@keyframes`\n * degraded the same way, with its percentage selectors scoped into\n * `[scope] 0%` and the animation name discarded, and `@font-face` became\n * `[scope] font-face`.\n *\n * A CSS parser would be the textbook answer and is deliberately not added:\n * scoping needs rule boundaries only, not property grammar, and this runs in\n * the delivery path.\n *\n * Note that `isBlockedStylesheetCss` rejects any stylesheet containing `url(`\n * or `@import` before this is reached, so `@font-face` with a real `src` never\n * arrives here in practice. `@media`, `@supports` and `@keyframes` do.\n */\nexport function scopeCssRules(css: string, scopeSelector = '[data-qti-item-body-scope]'): string {\n\tif (!css) return '';\n\tconst scope = scopeSelector?.trim();\n\tif (!scope) return css;\n\treturn scopeRuleList(stripComments(css), scope).trim();\n}\n\nfunction scopeRuleList(css: string, scope: string): string {\n\tlet out = '';\n\tlet index = 0;\n\twhile (index < css.length) {\n\t\tconst node = readNode(css, index);\n\t\tif (node.end <= index) break;\n\t\tout += renderNode(node, scope);\n\t\tindex = node.end;\n\t}\n\treturn out;\n}\n\nfunction renderNode(node: StyleNode, scope: string): string {\n\tif (node.kind === 'statement') {\n\t\tconst text = node.text.trim();\n\t\treturn text === ';' ? '' : `${text}\\n`;\n\t}\n\tif (node.kind === 'trailing') {\n\t\treturn node.text.trim() ? `${node.text.trim()}\\n` : '';\n\t}\n\tconst prelude = node.prelude.trim();\n\tif (!prelude) return '';\n\tif (prelude.startsWith('@')) {\n\t\tconst name = AT_RULE_NAME.exec(prelude)?.[1]?.toLowerCase();\n\t\tif (name && NESTED_RULE_AT_RULES.has(name)) {\n\t\t\tconst inner = scopeRuleList(node.block, scope);\n\t\t\tif (!inner.trim()) return '';\n\t\t\treturn `${prelude} {\\n${inner}}\\n`;\n\t\t}\n\t\treturn `${prelude} {${node.block}}\\n`;\n\t}\n\t// Rules with no declarations are dropped, as they were before.\n\tconst declarations = node.block.trim();\n\tif (!declarations) return '';\n\tconst selectors = splitTopLevel(prelude, ',')\n\t\t.map((selector) => scopeSelectorText(selector.trim(), scope))\n\t\t.filter(Boolean);\n\tif (selectors.length === 0) return '';\n\treturn `${selectors.join(', ')} { ${declarations} }\\n`;\n}\n\nfunction getStylesheetScopeSelector(stylesheet: ResolvedQtiStylesheetRef, scopeSelector: string): string {\n\tif (stylesheet.source !== 'stimulus' || !stylesheet.stimulusIdentifier) return scopeSelector;\n\treturn `${scopeSelector} [data-stimulus-idref=\"${escapeCssString(stylesheet.stimulusIdentifier)}\"]`;\n}\n\nfunction scopeSelectorText(selector: string, scopeSelector: string): string {\n\tif (!selector) return '';\n\tif (selector === scopeSelector || selector.startsWith(`${scopeSelector} `)) return selector;\n\t// `:root`/`html`/`body` are replaced rather than prefixed: `[scope] :root`\n\t// cannot match, because `:root` is the document element and is not a\n\t// descendant of the item body. Whatever followed is preserved, so\n\t// `html.dark .a` becomes `[scope].dark .a`.\n\tconst rootPrefix = DOCUMENT_ROOT_PREFIX.exec(selector);\n\tif (rootPrefix) return `${scopeSelector}${selector.slice(rootPrefix[0].length)}`;\n\t// Everything else becomes a descendant, including a leading pseudo. This\n\t// used to attach — `[scope]:is(.a, .b)` — which is a different selector: an\n\t// authored `:is(.a, .b) .c` means \"some element matching .a or .b\", so\n\t// attaching demands that the item body itself carry the authored class, and\n\t// it does not. The same holds for `:hover` and `::selection`.\n\treturn `${scopeSelector} ${selector}`;\n}\n\n/**\n * Read one node starting at `start`, tracking strings and parentheses so a `{`\n * inside `content: \"{\"` or a `,` inside `:is(a, b)` is not mistaken for\n * structure.\n */\nfunction readNode(css: string, start: number): StyleNode {\n\tlet index = start;\n\tlet quote: string | null = null;\n\tlet parenDepth = 0;\n\twhile (index < css.length) {\n\t\tconst char = css[index];\n\t\tif (quote) {\n\t\t\tif (char === '\\\\') index += 1;\n\t\t\telse if (char === quote) quote = null;\n\t\t} else if (char === '\"' || char === \"'\") {\n\t\t\tquote = char;\n\t\t} else if (char === '(') {\n\t\t\tparenDepth += 1;\n\t\t} else if (char === ')') {\n\t\t\tif (parenDepth > 0) parenDepth -= 1;\n\t\t} else if (parenDepth === 0 && char === ';') {\n\t\t\treturn { kind: 'statement', text: css.slice(start, index + 1), end: index + 1 };\n\t\t} else if (parenDepth === 0 && char === '{') {\n\t\t\tconst blockEnd = findBlockEnd(css, index);\n\t\t\treturn {\n\t\t\t\tkind: 'rule',\n\t\t\t\tprelude: css.slice(start, index),\n\t\t\t\tblock: css.slice(index + 1, blockEnd.contentEnd),\n\t\t\t\tend: blockEnd.end,\n\t\t\t};\n\t\t}\n\t\tindex += 1;\n\t}\n\treturn { kind: 'trailing', text: css.slice(start), end: css.length };\n}\n\n/**\n * Find the `}` matching the `{` at `openIndex`. Unbalanced input — a truncated\n * stylesheet — is treated as running to the end rather than throwing.\n */\nfunction findBlockEnd(css: string, openIndex: number): { contentEnd: number; end: number } {\n\tlet depth = 0;\n\tlet quote: string | null = null;\n\tfor (let index = openIndex; index < css.length; index += 1) {\n\t\tconst char = css[index];\n\t\tif (quote) {\n\t\t\tif (char === '\\\\') index += 1;\n\t\t\telse if (char === quote) quote = null;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '\"' || char === \"'\") {\n\t\t\tquote = char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '{') depth += 1;\n\t\telse if (char === '}') {\n\t\t\tdepth -= 1;\n\t\t\tif (depth === 0) return { contentEnd: index, end: index + 1 };\n\t\t}\n\t}\n\treturn { contentEnd: css.length, end: css.length };\n}\n\n/** Split on `separator` at paren depth zero and outside strings. */\nfunction splitTopLevel(value: string, separator: string): string[] {\n\tconst parts: string[] = [];\n\tlet current = '';\n\tlet quote: string | null = null;\n\tlet parenDepth = 0;\n\tfor (let index = 0; index < value.length; index += 1) {\n\t\tconst char = value[index] as string;\n\t\tif (quote) {\n\t\t\tcurrent += char;\n\t\t\tif (char === '\\\\' && index + 1 < value.length) {\n\t\t\t\tcurrent += value[index + 1];\n\t\t\t\tindex += 1;\n\t\t\t} else if (char === quote) {\n\t\t\t\tquote = null;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '\"' || char === \"'\") {\n\t\t\tquote = char;\n\t\t\tcurrent += char;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '(') parenDepth += 1;\n\t\telse if (char === ')' && parenDepth > 0) parenDepth -= 1;\n\t\tif (char === separator && parenDepth === 0) {\n\t\t\tparts.push(current);\n\t\t\tcurrent = '';\n\t\t\tcontinue;\n\t\t}\n\t\tcurrent += char;\n\t}\n\tparts.push(current);\n\treturn parts;\n}\n\n/**\n * Remove comments before walking, so a comment between two rules is not\n * absorbed into the next rule's selector list. String-aware, so a literal\n * `content: \"/*\"` survives — the previous regex strip was not.\n */\nfunction stripComments(css: string): string {\n\tlet out = '';\n\tlet quote: string | null = null;\n\tlet index = 0;\n\twhile (index < css.length) {\n\t\tconst char = css[index] as string;\n\t\tif (quote) {\n\t\t\tout += char;\n\t\t\tif (char === '\\\\' && index + 1 < css.length) {\n\t\t\t\tout += css[index + 1];\n\t\t\t\tindex += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (char === quote) quote = null;\n\t\t\tindex += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '\"' || char === \"'\") {\n\t\t\tquote = char;\n\t\t\tout += char;\n\t\t\tindex += 1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === '/' && css[index + 1] === '*') {\n\t\t\tconst close = css.indexOf('*/', index + 2);\n\t\t\tindex = close === -1 ? css.length : close + 2;\n\t\t\t// Keep a space so `a/**/b` does not become the single token `ab`.\n\t\t\tout += ' ';\n\t\t\tcontinue;\n\t\t}\n\t\tout += char;\n\t\tindex += 1;\n\t}\n\treturn out;\n}\n\nfunction escapeCssString(value: string): string {\n\treturn value.replace(/\\\\/g, '\\\\\\\\').replace(/\"/g, '\\\\\"').replace(/\\n|\\r|\\f/g, ' ');\n}\n"]}
@@ -1,65 +0,0 @@
1
- /**
2
- * QTI constants and configuration
3
- */
4
- export declare const PREFIX = "pie-qti";
5
- export declare const ID = "data-pie-qti-identifier";
6
- export declare const RESPONSE_ID = "data-pie-qti-response-identifier";
7
- export declare const TAG = "data-pie-qti-tag";
8
- export declare const NAVMODE = "data-pie-qti-navigation-mode";
9
- export declare const SHOWHIDE = "data-pie-qti-show-hide";
10
- export declare const ANSWERED = "pie-qti-answered";
11
- export declare const ASSOCIABLE = "pie-qti-associable";
12
- export declare const ASSOCIATION = "pie-qti-association";
13
- export declare const CHOICES = "pie-qti-choices";
14
- export declare const CLICKED = "pie-qti-clicked";
15
- export declare const CURRENT = "pie-qti-current";
16
- export declare const DRAGGING = "pie-qti-dragging";
17
- export declare const DRAGOVER = "pie-qti-dragover";
18
- export declare const GAP = "pie-qti-gap";
19
- export declare const GHOST = "pie-qti-ghost";
20
- export declare const HOTSPOT = "pie-qti-hotspot";
21
- export declare const INTERACTION = "pie-qti-interaction";
22
- export declare const MATCH = "pie-qti-match";
23
- export declare const MATCHED = "pie-qti-matched";
24
- export declare const MODAL = "pie-qti-modal";
25
- export declare const NAVIGATION = "pie-qti-navigation";
26
- export declare const PIVOTABLE = "pie-qti-pivotable";
27
- export declare const SELECTED = "pie-qti-selected";
28
- export declare const ASSOCIABLE_SEL = ".pie-qti-associable";
29
- export declare const ASSOCIATION_SEL = ".pie-qti-association";
30
- export declare const CHOICES_SEL = ".pie-qti-choices";
31
- export declare const CLICKED_SEL = ".pie-qti-clicked";
32
- export declare const DRAGGING_SEL = ".pie-qti-dragging";
33
- export declare const DRAGOVER_SEL = ".pie-qti-dragover";
34
- export declare const GAP_IMG_SEL = "[data-pie-qti-tag=\"gapImg\"]";
35
- export declare const GAP_SEL = ".pie-qti-gap";
36
- export declare const GAP_TEXT_SEL = "[data-pie-qti-tag=\"gapText\"]";
37
- export declare const GHOST_SEL = ".pie-qti-ghost";
38
- export declare const HOTSPOT_SEL = ".pie-qti-hotspot";
39
- export declare const INTERACTION_SEL = ".pie-qti-interaction";
40
- export declare const ITEM_SEL = "[data-pie-qti-tag=\"assessmentItem\"]";
41
- export declare const SIMPLECHOICE_SEL = "[data-pie-qti-tag=\"simpleChoice\"]";
42
- export declare const MSG_OK = "pie-qti-msg-ok";
43
- export declare const MSG_NONE = "pie-qti-msg-none";
44
- export declare const MSG_NO_SKIP = "pie-qti-msg-no-skip";
45
- export declare const MSG_TOO_MANY = "pie-qti-msg-too-many";
46
- export declare const MSG_TOO_FEW = "pie-qti-msg-too-few";
47
- export declare const MSG_MISMATCH = "pie-qti-msg-match-not-allowed";
48
- /**
49
- * QTI 2.2 Response Processing Templates namespace.
50
- * Note: Template resolution is namespace-agnostic - only the template filename is used.
51
- * Templates from v2p0, v2p1, and v2p2 namespaces are all supported.
52
- */
53
- export declare const RPTEMPLATES = "http://www.imsglobal.org/question/qti_v2p2/rptemplates";
54
- export declare const SVG_NS = "http://www.w3.org/2000/svg";
55
- export declare const XLINK_NS = "http://www.w3.org/1999/xlink";
56
- export declare const XML_NS = "http://www.w3.org/XML/1998/namespace";
57
- export declare const DEFAULT_THEME = "theme";
58
- export declare const MAX_TABLE_COLS = 4;
59
- export declare const EN: {
60
- UPLOAD: string;
61
- COMMENT: string;
62
- EXPECTED_CHARS: (len: number) => string;
63
- EXPECTED_LINES: (lines: number) => string;
64
- END_TEST: string;
65
- };
@@ -1,74 +0,0 @@
1
- /**
2
- * QTI constants and configuration
3
- */
4
- // Prefix for data attributes and CSS classes
5
- export const PREFIX = 'pie-qti';
6
- // Data attributes
7
- export const ID = `data-${PREFIX}-identifier`;
8
- export const RESPONSE_ID = `data-${PREFIX}-response-identifier`;
9
- export const TAG = `data-${PREFIX}-tag`;
10
- export const NAVMODE = `data-${PREFIX}-navigation-mode`;
11
- export const SHOWHIDE = `data-${PREFIX}-show-hide`;
12
- // CSS class names
13
- export const ANSWERED = `${PREFIX}-answered`;
14
- export const ASSOCIABLE = `${PREFIX}-associable`;
15
- export const ASSOCIATION = `${PREFIX}-association`;
16
- export const CHOICES = `${PREFIX}-choices`;
17
- export const CLICKED = `${PREFIX}-clicked`;
18
- export const CURRENT = `${PREFIX}-current`;
19
- export const DRAGGING = `${PREFIX}-dragging`;
20
- export const DRAGOVER = `${PREFIX}-dragover`;
21
- export const GAP = `${PREFIX}-gap`;
22
- export const GHOST = `${PREFIX}-ghost`;
23
- export const HOTSPOT = `${PREFIX}-hotspot`;
24
- export const INTERACTION = `${PREFIX}-interaction`;
25
- export const MATCH = `${PREFIX}-match`;
26
- export const MATCHED = `${PREFIX}-matched`;
27
- export const MODAL = `${PREFIX}-modal`;
28
- export const NAVIGATION = `${PREFIX}-navigation`;
29
- export const PIVOTABLE = `${PREFIX}-pivotable`;
30
- export const SELECTED = `${PREFIX}-selected`;
31
- // CSS selectors
32
- export const ASSOCIABLE_SEL = `.${ASSOCIABLE}`;
33
- export const ASSOCIATION_SEL = `.${ASSOCIATION}`;
34
- export const CHOICES_SEL = `.${CHOICES}`;
35
- export const CLICKED_SEL = `.${CLICKED}`;
36
- export const DRAGGING_SEL = `.${DRAGGING}`;
37
- export const DRAGOVER_SEL = `.${DRAGOVER}`;
38
- export const GAP_IMG_SEL = `[${TAG}="gapImg"]`;
39
- export const GAP_SEL = `.${GAP}`;
40
- export const GAP_TEXT_SEL = `[${TAG}="gapText"]`;
41
- export const GHOST_SEL = `.${GHOST}`;
42
- export const HOTSPOT_SEL = `.${HOTSPOT}`;
43
- export const INTERACTION_SEL = `.${INTERACTION}`;
44
- export const ITEM_SEL = `[${TAG}="assessmentItem"]`;
45
- export const SIMPLECHOICE_SEL = `[${TAG}="simpleChoice"]`;
46
- // Message identifiers
47
- export const MSG_OK = `${PREFIX}-msg-ok`;
48
- export const MSG_NONE = `${PREFIX}-msg-none`;
49
- export const MSG_NO_SKIP = `${PREFIX}-msg-no-skip`;
50
- export const MSG_TOO_MANY = `${PREFIX}-msg-too-many`;
51
- export const MSG_TOO_FEW = `${PREFIX}-msg-too-few`;
52
- export const MSG_MISMATCH = `${PREFIX}-msg-match-not-allowed`;
53
- // Namespaces
54
- /**
55
- * QTI 2.2 Response Processing Templates namespace.
56
- * Note: Template resolution is namespace-agnostic - only the template filename is used.
57
- * Templates from v2p0, v2p1, and v2p2 namespaces are all supported.
58
- */
59
- export const RPTEMPLATES = 'http://www.imsglobal.org/question/qti_v2p2/rptemplates';
60
- export const SVG_NS = 'http://www.w3.org/2000/svg';
61
- export const XLINK_NS = 'http://www.w3.org/1999/xlink';
62
- export const XML_NS = 'http://www.w3.org/XML/1998/namespace';
63
- // UI constants
64
- export const DEFAULT_THEME = 'theme';
65
- export const MAX_TABLE_COLS = 4;
66
- // Localization (English defaults)
67
- export const EN = {
68
- UPLOAD: 'Upload file',
69
- COMMENT: 'Comment on this question if you wish.',
70
- EXPECTED_CHARS: (len) => `expected: ${len} chars`,
71
- EXPECTED_LINES: (lines) => `expected: ${lines} lines`,
72
- END_TEST: '<p>You have reached the end of the test</p>',
73
- };
74
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAEhC,kBAAkB;AAClB,MAAM,CAAC,MAAM,EAAE,GAAG,QAAQ,MAAM,aAAa,CAAC;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,MAAM,sBAAsB,CAAC;AAChE,MAAM,CAAC,MAAM,GAAG,GAAG,QAAQ,MAAM,MAAM,CAAC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,MAAM,kBAAkB,CAAC;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,MAAM,YAAY,CAAC;AAEnD,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,MAAM,WAAW,CAAC;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,MAAM,aAAa,CAAC;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,MAAM,cAAc,CAAC;AACnD,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,MAAM,UAAU,CAAC;AAC3C,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,MAAM,UAAU,CAAC;AAC3C,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,MAAM,UAAU,CAAC;AAC3C,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,MAAM,WAAW,CAAC;AAC7C,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,MAAM,WAAW,CAAC;AAC7C,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,MAAM,MAAM,CAAC;AACnC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,MAAM,QAAQ,CAAC;AACvC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,MAAM,UAAU,CAA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,CAAC;AACpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,GAAG,kBAAkB,CAAC;AAE1D,sBAAsB;AACtB,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC;AACzC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,MAAM,WAAW,CAAC;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,MAAM,cAAc,CAAC;AACnD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,MAAM,eAAe,CAAC;AACrD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,MAAM,cAAc,CAAC;AACnD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,MAAM,wBAAwB,CAAC;AAE9D,aAAa;AACb;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,wDAAwD,CAAC;AACpF,MAAM,CAAC,MAAM,MAAM,GAAG,4BAA4B,CAAC;AACnD,MAAM,CAAC,MAAM,QAAQ,GAAG,8BAA8B,CAAC;AACvD,MAAM,CAAC,MAAM,MAAM,GAAG,sCAAsC,CAAC;AAE7D,eAAe;AACf,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC,kCAAkC;AAClC,MAAM,CAAC,MAAM,EAAE,GAAG;IACjB,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,uCAAuC;IAChD,cAAc,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,aAAa,GAAG,QAAQ;IACzD,cAAc,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,aAAa,KAAK,QAAQ;IAC7D,QAAQ,EAAE,6CAA6C;CACvD,CAAC","sourcesContent":["/**\n * QTI constants and configuration\n */\n\n// Prefix for data attributes and CSS classes\nexport const PREFIX = 'pie-qti';\n\n// Data attributes\nexport const ID = `data-${PREFIX}-identifier`;\nexport const RESPONSE_ID = `data-${PREFIX}-response-identifier`;\nexport const TAG = `data-${PREFIX}-tag`;\nexport const NAVMODE = `data-${PREFIX}-navigation-mode`;\nexport const SHOWHIDE = `data-${PREFIX}-show-hide`;\n\n// CSS class names\nexport const ANSWERED = `${PREFIX}-answered`;\nexport const ASSOCIABLE = `${PREFIX}-associable`;\nexport const ASSOCIATION = `${PREFIX}-association`;\nexport const CHOICES = `${PREFIX}-choices`;\nexport const CLICKED = `${PREFIX}-clicked`;\nexport const CURRENT = `${PREFIX}-current`;\nexport const DRAGGING = `${PREFIX}-dragging`;\nexport const DRAGOVER = `${PREFIX}-dragover`;\nexport const GAP = `${PREFIX}-gap`;\nexport const GHOST = `${PREFIX}-ghost`;\nexport const HOTSPOT = `${PREFIX}-hotspot`;\nexport const INTERACTION = `${PREFIX}-interaction`;\nexport const MATCH = `${PREFIX}-match`;\nexport const MATCHED = `${PREFIX}-matched`;\nexport const MODAL = `${PREFIX}-modal`;\nexport const NAVIGATION = `${PREFIX}-navigation`;\nexport const PIVOTABLE = `${PREFIX}-pivotable`;\nexport const SELECTED = `${PREFIX}-selected`;\n\n// CSS selectors\nexport const ASSOCIABLE_SEL = `.${ASSOCIABLE}`;\nexport const ASSOCIATION_SEL = `.${ASSOCIATION}`;\nexport const CHOICES_SEL = `.${CHOICES}`;\nexport const CLICKED_SEL = `.${CLICKED}`;\nexport const DRAGGING_SEL = `.${DRAGGING}`;\nexport const DRAGOVER_SEL = `.${DRAGOVER}`;\nexport const GAP_IMG_SEL = `[${TAG}=\"gapImg\"]`;\nexport const GAP_SEL = `.${GAP}`;\nexport const GAP_TEXT_SEL = `[${TAG}=\"gapText\"]`;\nexport const GHOST_SEL = `.${GHOST}`;\nexport const HOTSPOT_SEL = `.${HOTSPOT}`;\nexport const INTERACTION_SEL = `.${INTERACTION}`;\nexport const ITEM_SEL = `[${TAG}=\"assessmentItem\"]`;\nexport const SIMPLECHOICE_SEL = `[${TAG}=\"simpleChoice\"]`;\n\n// Message identifiers\nexport const MSG_OK = `${PREFIX}-msg-ok`;\nexport const MSG_NONE = `${PREFIX}-msg-none`;\nexport const MSG_NO_SKIP = `${PREFIX}-msg-no-skip`;\nexport const MSG_TOO_MANY = `${PREFIX}-msg-too-many`;\nexport const MSG_TOO_FEW = `${PREFIX}-msg-too-few`;\nexport const MSG_MISMATCH = `${PREFIX}-msg-match-not-allowed`;\n\n// Namespaces\n/**\n * QTI 2.2 Response Processing Templates namespace.\n * Note: Template resolution is namespace-agnostic - only the template filename is used.\n * Templates from v2p0, v2p1, and v2p2 namespaces are all supported.\n */\nexport const RPTEMPLATES = 'http://www.imsglobal.org/question/qti_v2p2/rptemplates';\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\nexport const XLINK_NS = 'http://www.w3.org/1999/xlink';\nexport const XML_NS = 'http://www.w3.org/XML/1998/namespace';\n\n// UI constants\nexport const DEFAULT_THEME = 'theme';\nexport const MAX_TABLE_COLS = 4;\n\n// Localization (English defaults)\nexport const EN = {\n\tUPLOAD: 'Upload file',\n\tCOMMENT: 'Comment on this question if you wish.',\n\tEXPECTED_CHARS: (len: number) => `expected: ${len} chars`,\n\tEXPECTED_LINES: (lines: number) => `expected: ${lines} lines`,\n\tEND_TEST: '<p>You have reached the end of the test</p>',\n};\n"]}