@citolab/qti-components 7.1.4 → 7.1.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 (230) hide show
  1. package/cdn/chunks/chunk-24FGNKCD.js +1007 -0
  2. package/cdn/chunks/chunk-2GQCYBJ3.js +5 -0
  3. package/cdn/chunks/chunk-2OZT6A22.js +5 -0
  4. package/cdn/chunks/chunk-3AJ3S2FB.js +23 -0
  5. package/cdn/chunks/chunk-3M6EKDMW.js +1 -0
  6. package/cdn/chunks/chunk-3QCUKN7V.js +1 -0
  7. package/cdn/chunks/chunk-4LPUHBZG.js +5 -0
  8. package/cdn/chunks/chunk-5UN2ELTW.js +23 -0
  9. package/cdn/chunks/chunk-5VTVIA6M.js +23 -0
  10. package/cdn/chunks/chunk-6JHIITOD.js +1 -0
  11. package/cdn/chunks/chunk-7UDDUERA.js +1007 -0
  12. package/cdn/chunks/chunk-7ZNR6KCO.js +5 -0
  13. package/cdn/chunks/chunk-AAOFOYWA.js +5 -0
  14. package/cdn/chunks/chunk-AJMJQJUQ.js +5 -0
  15. package/cdn/chunks/chunk-CY2CQDCJ.js +5 -0
  16. package/cdn/chunks/chunk-D2GQ4BES.js +1 -0
  17. package/cdn/chunks/chunk-D6WQKU5P.js +5 -0
  18. package/cdn/chunks/chunk-DMIFXRAW.js +5 -0
  19. package/cdn/chunks/chunk-DQ7GTTCX.js +5 -0
  20. package/cdn/chunks/chunk-DVRZBFAS.js +5 -0
  21. package/cdn/chunks/chunk-E6M5VAZC.js +1007 -0
  22. package/cdn/chunks/chunk-EJDPW23L.js +5 -0
  23. package/cdn/chunks/chunk-FWCOZSKN.js +5 -0
  24. package/cdn/chunks/chunk-G24US7VC.js +23 -0
  25. package/cdn/chunks/chunk-HCWGJCF3.js +1007 -0
  26. package/cdn/chunks/chunk-IUEV6I3Y.js +5 -0
  27. package/cdn/chunks/chunk-J4CI5WG7.js +23 -0
  28. package/cdn/chunks/chunk-JEZ3FDS2.js +1007 -0
  29. package/cdn/chunks/chunk-L7FX2BSJ.js +1007 -0
  30. package/cdn/chunks/chunk-L7G3YUQJ.js +23 -0
  31. package/cdn/chunks/chunk-LKOMJADF.js +5 -0
  32. package/cdn/chunks/chunk-M2YVQSR3.js +5 -0
  33. package/cdn/chunks/chunk-MADHY2TG.js +5 -0
  34. package/cdn/chunks/chunk-MCE2HPAI.js +23 -0
  35. package/cdn/chunks/chunk-MPVVJRN5.js +5 -0
  36. package/cdn/chunks/chunk-MYK3AVE5.js +5 -0
  37. package/cdn/chunks/chunk-NQUXPDU3.js +1 -0
  38. package/cdn/chunks/chunk-O64TZW6N.js +5 -0
  39. package/cdn/chunks/chunk-OM6BKR6U.js +5 -0
  40. package/cdn/chunks/chunk-PTEZUFUL.js +5 -0
  41. package/cdn/chunks/chunk-Q3MPB5OG.js +23 -0
  42. package/cdn/chunks/chunk-RC3C5C7I.js +5 -0
  43. package/cdn/chunks/chunk-RDREFUYQ.js +1007 -0
  44. package/cdn/chunks/chunk-RPBLXGHD.js +5 -0
  45. package/cdn/chunks/chunk-RWCWDO5R.js +5 -0
  46. package/cdn/chunks/chunk-SEJ6XHOU.js +1 -0
  47. package/cdn/chunks/chunk-SHZ5UCLJ.js +5 -0
  48. package/cdn/chunks/chunk-SRXFURHS.js +5 -0
  49. package/cdn/chunks/chunk-TJWJV2U3.js +5 -0
  50. package/cdn/chunks/chunk-URO7DOBX.js +1 -0
  51. package/cdn/chunks/chunk-UVCZCMPG.js +5 -0
  52. package/cdn/chunks/chunk-V2HYQXWT.js +1007 -0
  53. package/cdn/chunks/chunk-V6VPFEQB.js +1 -0
  54. package/cdn/chunks/chunk-V7S5DVXO.js +5 -0
  55. package/cdn/chunks/chunk-VAKXKPIY.js +1007 -0
  56. package/cdn/chunks/chunk-VCATS6AD.js +5 -0
  57. package/cdn/chunks/chunk-VGBHSWOI.js +5 -0
  58. package/cdn/chunks/chunk-VTBQWQOW.js +23 -0
  59. package/cdn/chunks/chunk-W567D2AF.js +1 -0
  60. package/cdn/chunks/chunk-WQFK6JFL.js +5 -0
  61. package/cdn/chunks/chunk-WRAB6IVU.js +5 -0
  62. package/cdn/chunks/chunk-WWNOVLDK.js +23 -0
  63. package/cdn/chunks/chunk-XJHAZYHN.js +1007 -0
  64. package/cdn/chunks/chunk-YCTL45GB.js +1 -0
  65. package/cdn/chunks/chunk-ZRWDLR2Y.js +5 -0
  66. package/cdn/index.global.js +1 -1
  67. package/cdn/index.js +1 -1
  68. package/cdn/qti-components/index.js +1 -1
  69. package/cdn/qti-item/components/item-container.js +1 -1
  70. package/cdn/qti-item/core/index.js +1 -1
  71. package/cdn/qti-loader/index.js +1 -1
  72. package/cdn/qti-test/components/index.js +1 -1
  73. package/cdn/qti-test/components/test-container.js +1 -1
  74. package/cdn/qti-test/core/index.js +1 -1
  75. package/cdn/qti-transformers/index.js +1 -1
  76. package/dist/chunks/chunk-2IXFDXDW.js +646 -0
  77. package/dist/chunks/chunk-2IXFDXDW.js.map +1 -0
  78. package/dist/chunks/chunk-2RRW2DFF.js +31 -0
  79. package/dist/chunks/chunk-2RRW2DFF.js.map +1 -0
  80. package/dist/chunks/chunk-2SENMECZ.js +383 -0
  81. package/dist/chunks/chunk-2SENMECZ.js.map +1 -0
  82. package/dist/chunks/chunk-2YIXNTLW.js +31 -0
  83. package/dist/chunks/chunk-2YIXNTLW.js.map +1 -0
  84. package/dist/chunks/chunk-323JSMZF.js +6888 -0
  85. package/dist/chunks/chunk-323JSMZF.js.map +1 -0
  86. package/dist/chunks/chunk-334SZRIZ.js +627 -0
  87. package/dist/chunks/chunk-334SZRIZ.js.map +1 -0
  88. package/dist/chunks/chunk-42QJNL24.js +383 -0
  89. package/dist/chunks/chunk-42QJNL24.js.map +1 -0
  90. package/dist/chunks/chunk-4QHU4ILT.js +627 -0
  91. package/dist/chunks/chunk-4QHU4ILT.js.map +1 -0
  92. package/dist/chunks/chunk-5LEN6QDS.js +31 -0
  93. package/dist/chunks/chunk-5LEN6QDS.js.map +1 -0
  94. package/dist/chunks/chunk-5QMNVSHC.js +94 -0
  95. package/dist/chunks/chunk-5QMNVSHC.js.map +1 -0
  96. package/dist/chunks/chunk-5WS6ZWUN.js +374 -0
  97. package/dist/chunks/chunk-5WS6ZWUN.js.map +1 -0
  98. package/dist/chunks/chunk-673CG4KG.js +94 -0
  99. package/dist/chunks/chunk-673CG4KG.js.map +1 -0
  100. package/dist/chunks/chunk-6VFH66FM.js +94 -0
  101. package/dist/chunks/chunk-6VFH66FM.js.map +1 -0
  102. package/dist/chunks/chunk-6YED6PQC.js +6888 -0
  103. package/dist/chunks/chunk-6YED6PQC.js.map +1 -0
  104. package/dist/chunks/chunk-75QW5V24.js +6888 -0
  105. package/dist/chunks/chunk-75QW5V24.js.map +1 -0
  106. package/dist/chunks/chunk-AVDZJOCT.js +400 -0
  107. package/dist/chunks/chunk-AVDZJOCT.js.map +1 -0
  108. package/dist/chunks/chunk-BCMG64M3.js +94 -0
  109. package/dist/chunks/chunk-BCMG64M3.js.map +1 -0
  110. package/dist/chunks/chunk-CHFTTHPJ.js +383 -0
  111. package/dist/chunks/chunk-CHFTTHPJ.js.map +1 -0
  112. package/dist/chunks/chunk-DT72VPM7.js +32 -0
  113. package/dist/chunks/chunk-DT72VPM7.js.map +1 -0
  114. package/dist/chunks/chunk-E2WYWXM3.js +6888 -0
  115. package/dist/chunks/chunk-E2WYWXM3.js.map +1 -0
  116. package/dist/chunks/chunk-E4XNZM6H.js +383 -0
  117. package/dist/chunks/chunk-E4XNZM6H.js.map +1 -0
  118. package/dist/chunks/chunk-ECTDE6XC.js +646 -0
  119. package/dist/chunks/chunk-ECTDE6XC.js.map +1 -0
  120. package/dist/chunks/chunk-EN7ICTLG.js +94 -0
  121. package/dist/chunks/chunk-EN7ICTLG.js.map +1 -0
  122. package/dist/chunks/chunk-EV2QQBO6.js +94 -0
  123. package/dist/chunks/chunk-EV2QQBO6.js.map +1 -0
  124. package/dist/chunks/chunk-FJI6VGC6.js +94 -0
  125. package/dist/chunks/chunk-FJI6VGC6.js.map +1 -0
  126. package/dist/chunks/chunk-FKUTUG6E.js +94 -0
  127. package/dist/chunks/chunk-FKUTUG6E.js.map +1 -0
  128. package/dist/chunks/chunk-FOAIUAWY.js +627 -0
  129. package/dist/chunks/chunk-FOAIUAWY.js.map +1 -0
  130. package/dist/chunks/chunk-GR52YZQB.js +31 -0
  131. package/dist/chunks/chunk-GR52YZQB.js.map +1 -0
  132. package/dist/chunks/chunk-GRT2RDCX.js +6888 -0
  133. package/dist/chunks/chunk-GRT2RDCX.js.map +1 -0
  134. package/dist/chunks/chunk-GT4B3SMY.js +94 -0
  135. package/dist/chunks/chunk-GT4B3SMY.js.map +1 -0
  136. package/dist/chunks/chunk-I6JSNAIT.js +627 -0
  137. package/dist/chunks/chunk-I6JSNAIT.js.map +1 -0
  138. package/dist/chunks/chunk-IKNXVVXK.js +32 -0
  139. package/dist/chunks/chunk-IKNXVVXK.js.map +1 -0
  140. package/dist/chunks/chunk-KJ5Y7Q3K.js +94 -0
  141. package/dist/chunks/chunk-KJ5Y7Q3K.js.map +1 -0
  142. package/dist/chunks/chunk-KNV7LPEA.js +94 -0
  143. package/dist/chunks/chunk-KNV7LPEA.js.map +1 -0
  144. package/dist/chunks/chunk-LCYRSF7H.js +6888 -0
  145. package/dist/chunks/chunk-LCYRSF7H.js.map +1 -0
  146. package/dist/chunks/chunk-LLVJY74K.js +373 -0
  147. package/dist/chunks/chunk-LLVJY74K.js.map +1 -0
  148. package/dist/chunks/chunk-LOCV27GA.js +31 -0
  149. package/dist/chunks/chunk-LOCV27GA.js.map +1 -0
  150. package/dist/chunks/chunk-LVPRIPTY.js +94 -0
  151. package/dist/chunks/chunk-LVPRIPTY.js.map +1 -0
  152. package/dist/chunks/chunk-MHPLSF7C.js +645 -0
  153. package/dist/chunks/chunk-MHPLSF7C.js.map +1 -0
  154. package/dist/chunks/chunk-MWVK6TYO.js +94 -0
  155. package/dist/chunks/chunk-MWVK6TYO.js.map +1 -0
  156. package/dist/chunks/chunk-NC7KY56H.js +627 -0
  157. package/dist/chunks/chunk-NC7KY56H.js.map +1 -0
  158. package/dist/chunks/chunk-O55K2M54.js +94 -0
  159. package/dist/chunks/chunk-O55K2M54.js.map +1 -0
  160. package/dist/chunks/chunk-PEV4JLKR.js +374 -0
  161. package/dist/chunks/chunk-PEV4JLKR.js.map +1 -0
  162. package/dist/chunks/chunk-POTLDXHV.js +627 -0
  163. package/dist/chunks/chunk-POTLDXHV.js.map +1 -0
  164. package/dist/chunks/chunk-QA5CX4HN.js +94 -0
  165. package/dist/chunks/chunk-QA5CX4HN.js.map +1 -0
  166. package/dist/chunks/chunk-QCZ76WFB.js +6888 -0
  167. package/dist/chunks/chunk-QCZ76WFB.js.map +1 -0
  168. package/dist/chunks/chunk-QS6VHKJL.js +94 -0
  169. package/dist/chunks/chunk-QS6VHKJL.js.map +1 -0
  170. package/dist/chunks/chunk-RVZE4R2K.js +400 -0
  171. package/dist/chunks/chunk-RVZE4R2K.js.map +1 -0
  172. package/dist/chunks/chunk-SGUZHURT.js +94 -0
  173. package/dist/chunks/chunk-SGUZHURT.js.map +1 -0
  174. package/dist/chunks/chunk-SJYWAAZE.js +31 -0
  175. package/dist/chunks/chunk-SJYWAAZE.js.map +1 -0
  176. package/dist/chunks/chunk-STQBRYLA.js +31 -0
  177. package/dist/chunks/chunk-STQBRYLA.js.map +1 -0
  178. package/dist/chunks/chunk-TAO7UEFH.js +400 -0
  179. package/dist/chunks/chunk-TAO7UEFH.js.map +1 -0
  180. package/dist/chunks/chunk-TC3OIHDQ.js +6888 -0
  181. package/dist/chunks/chunk-TC3OIHDQ.js.map +1 -0
  182. package/dist/chunks/chunk-TOJHUALI.js +646 -0
  183. package/dist/chunks/chunk-TOJHUALI.js.map +1 -0
  184. package/dist/chunks/chunk-TPAA44Y7.js +31 -0
  185. package/dist/chunks/chunk-TPAA44Y7.js.map +1 -0
  186. package/dist/chunks/chunk-TRYCV7IM.js +31 -0
  187. package/dist/chunks/chunk-TRYCV7IM.js.map +1 -0
  188. package/dist/chunks/chunk-TVNMKAMJ.js +645 -0
  189. package/dist/chunks/chunk-TVNMKAMJ.js.map +1 -0
  190. package/dist/chunks/chunk-U4RFKBRP.js +94 -0
  191. package/dist/chunks/chunk-U4RFKBRP.js.map +1 -0
  192. package/dist/chunks/chunk-UGLQ4IE6.js +94 -0
  193. package/dist/chunks/chunk-UGLQ4IE6.js.map +1 -0
  194. package/dist/chunks/chunk-UJFRZXCT.js +647 -0
  195. package/dist/chunks/chunk-UJFRZXCT.js.map +1 -0
  196. package/dist/chunks/chunk-UMF3ZNLB.js +627 -0
  197. package/dist/chunks/chunk-UMF3ZNLB.js.map +1 -0
  198. package/dist/chunks/chunk-UPOAW5KH.js +6888 -0
  199. package/dist/chunks/chunk-UPOAW5KH.js.map +1 -0
  200. package/dist/chunks/chunk-UYO3TSPZ.js +373 -0
  201. package/dist/chunks/chunk-UYO3TSPZ.js.map +1 -0
  202. package/dist/chunks/chunk-VDCLAPUT.js +627 -0
  203. package/dist/chunks/chunk-VDCLAPUT.js.map +1 -0
  204. package/dist/chunks/chunk-WEBEBLJU.js +94 -0
  205. package/dist/chunks/chunk-WEBEBLJU.js.map +1 -0
  206. package/dist/chunks/chunk-WWFGVIQF.js +627 -0
  207. package/dist/chunks/chunk-WWFGVIQF.js.map +1 -0
  208. package/dist/chunks/chunk-XBCKVU3I.js +94 -0
  209. package/dist/chunks/chunk-XBCKVU3I.js.map +1 -0
  210. package/dist/chunks/chunk-XOKC45VV.js +631 -0
  211. package/dist/chunks/chunk-XOKC45VV.js.map +1 -0
  212. package/dist/chunks/chunk-YHEITHMB.js +6888 -0
  213. package/dist/chunks/chunk-YHEITHMB.js.map +1 -0
  214. package/dist/chunks/chunk-YSGGRW2E.js +6888 -0
  215. package/dist/chunks/chunk-YSGGRW2E.js.map +1 -0
  216. package/dist/chunks/chunk-ZLOEM737.js +94 -0
  217. package/dist/chunks/chunk-ZLOEM737.js.map +1 -0
  218. package/dist/index.js +17 -17
  219. package/dist/qti-components/index.js +2 -2
  220. package/dist/qti-components-jsx.d.ts +1 -3
  221. package/dist/qti-item/components/item-container.js +2 -2
  222. package/dist/qti-item/core/index.js +2 -2
  223. package/dist/qti-loader/index.js +2 -2
  224. package/dist/qti-test/components/index.js +6 -6
  225. package/dist/qti-test/components/test-container.js +2 -2
  226. package/dist/qti-test/core/index.js +3 -3
  227. package/dist/qti-transformers/index.d.ts +3 -14
  228. package/dist/qti-transformers/index.js +1 -1
  229. package/dist/vscode.html-custom-data.json +1 -2
  230. package/package.json +1 -1
@@ -0,0 +1,645 @@
1
+ import {
2
+ INITIAL_SESSION_CONTEXT,
3
+ sessionContext
4
+ } from "./chunk-UZ4QB5IO.js";
5
+ import {
6
+ INITIAL_TEST_CONTEXT,
7
+ testContext
8
+ } from "./chunk-CJADUWEC.js";
9
+ import {
10
+ QtiModalFeedback
11
+ } from "./chunk-QCZ76WFB.js";
12
+ import {
13
+ qtiTransformItem
14
+ } from "./chunk-TAO7UEFH.js";
15
+ import {
16
+ __decorateClass
17
+ } from "./chunk-H2JE6IVU.js";
18
+
19
+ // src/lib/qti-test/core/qti-test.ts
20
+ import { html } from "lit";
21
+ import { customElement } from "lit/decorators.js";
22
+
23
+ // src/lib/qti-test/core/mixins/test-loader.mixin.ts
24
+ import { property } from "lit/decorators.js";
25
+ var setSessionData = (key, value) => sessionStorage.setItem(key, JSON.stringify(value));
26
+ var getSessionData = (key) => sessionStorage.getItem(key) ? JSON.parse(sessionStorage.getItem(key)) : null;
27
+ var TestLoaderMixin = (superClass) => {
28
+ class TestLoaderClass extends superClass {
29
+ constructor(...args) {
30
+ super(...args);
31
+ this.storeSession = null;
32
+ this.cacheTransform = false;
33
+ this.addEventListener("qti-load-item-request", ({ detail }) => {
34
+ detail.promise = (async () => {
35
+ const api = await qtiTransformItem(this.cacheTransform).load(
36
+ `${detail.href}`,
37
+ detail.identifier,
38
+ detail.cancelPreviousRequest
39
+ );
40
+ return api.htmlDoc();
41
+ })();
42
+ });
43
+ this.addEventListener("qti-load-item-request", () => {
44
+ if (this.storeSession) {
45
+ const testContext2 = getSessionData(this.storeSession);
46
+ if (testContext2) {
47
+ this.testContext = testContext2;
48
+ }
49
+ }
50
+ });
51
+ }
52
+ willUpdate(changedProperties) {
53
+ if (changedProperties.has("testContext")) {
54
+ if (this.storeSession) {
55
+ setSessionData(this.storeSession, this.testContext);
56
+ }
57
+ }
58
+ }
59
+ }
60
+ __decorateClass([
61
+ property({ type: String, attribute: "store-session" })
62
+ ], TestLoaderClass.prototype, "storeSession", 2);
63
+ __decorateClass([
64
+ property({ type: Boolean, attribute: "cache-transform" })
65
+ ], TestLoaderClass.prototype, "cacheTransform", 2);
66
+ return TestLoaderClass;
67
+ };
68
+
69
+ // src/lib/qti-test/core/mixins/test-navigation.mixin.ts
70
+ import { property as property2 } from "lit/decorators.js";
71
+ var TestNavigationMixin = (superClass) => {
72
+ class TestNavigationClass extends superClass {
73
+ constructor(...args) {
74
+ super(...args);
75
+ this.navigate = "item";
76
+ this.addEventListener(
77
+ "qti-request-navigation",
78
+ async ({ detail }) => {
79
+ if (!detail?.id) return;
80
+ if (detail.type === "item") {
81
+ await this._loadItems([detail.id]);
82
+ const navItemId = detail.id;
83
+ const itemRefEl = this._testElement?.querySelector(
84
+ `qti-assessment-item-ref[identifier="${detail.id}"]`
85
+ );
86
+ const navPartId = itemRefEl.closest("qti-test-part")?.identifier;
87
+ const navSectionId = itemRefEl.closest("qti-assessment-section")?.identifier;
88
+ this.sessionContext = { ...this.sessionContext, navPartId, navSectionId, navItemId, navItemLoading: false };
89
+ } else if (detail.type === "section") {
90
+ const itemIds = this._getSectionItemIds(detail.id);
91
+ await this._loadItems(itemIds);
92
+ const navSectionId = detail.id;
93
+ const sectionRefEl = this._testElement?.querySelector(
94
+ `qti-assessment-section[identifier="${navSectionId}"]`
95
+ );
96
+ const navPartId = sectionRefEl.closest("qti-test-part")?.identifier;
97
+ this.sessionContext = {
98
+ ...this.sessionContext,
99
+ navPartId,
100
+ navSectionId,
101
+ navItemId: null,
102
+ navItemLoading: false
103
+ };
104
+ }
105
+ }
106
+ );
107
+ this.addEventListener("qti-assessment-test-connected", (e) => {
108
+ this._testElement = e.detail;
109
+ let id;
110
+ if (this.navigate === "section") {
111
+ id = this._testElement.querySelector("qti-assessment-section")?.identifier;
112
+ } else {
113
+ id = this.sessionContext.navItemId ?? this._testElement.querySelector("qti-assessment-item-ref")?.identifier;
114
+ }
115
+ if (id) {
116
+ this.dispatchEvent(
117
+ new CustomEvent("qti-request-navigation", {
118
+ detail: { type: this.navigate === "section" ? "section" : "item", id },
119
+ bubbles: true,
120
+ composed: true
121
+ })
122
+ );
123
+ }
124
+ });
125
+ }
126
+ async _loadItems(itemIds) {
127
+ let results;
128
+ if (!this._testElement || itemIds.length === 0) return;
129
+ const itemRefEls = itemIds.map(
130
+ (id) => this._testElement.querySelector(`qti-assessment-item-ref[identifier="${id}"]`)
131
+ );
132
+ if (itemRefEls.includes(null)) {
133
+ console.warn(`One or more items not found: ${itemIds}`);
134
+ return;
135
+ }
136
+ this._clearLoadedItems();
137
+ this.sessionContext = { ...this.sessionContext, navItemLoading: true };
138
+ const itemLoadPromises = itemRefEls.map(async (itemRef) => {
139
+ if (!itemRef) return null;
140
+ return { itemRef, doc: await this._loadItemRequest(itemRef.href, itemRef.identifier) };
141
+ });
142
+ try {
143
+ results = await Promise.all(itemLoadPromises);
144
+ results.forEach(({ itemRef, doc }) => {
145
+ if (itemRef && doc) itemRef.xmlDoc = doc;
146
+ });
147
+ requestAnimationFrame(() => {
148
+ this.dispatchEvent(
149
+ new CustomEvent("qti-test-connected", {
150
+ detail: results.map(({ itemRef }) => ({ identifier: itemRef?.identifier, element: itemRef })),
151
+ bubbles: true,
152
+ composed: true
153
+ })
154
+ );
155
+ });
156
+ } catch (error) {
157
+ console.error("Error loading items:", error);
158
+ }
159
+ return results;
160
+ }
161
+ _getSectionItemIds(navSectionId) {
162
+ const sectionRefEl = this._testElement?.querySelector(
163
+ `qti-assessment-section[identifier="${navSectionId}"]`
164
+ );
165
+ if (!sectionRefEl) {
166
+ console.warn(`Section with identifier "${navSectionId}" not found.`);
167
+ return [];
168
+ }
169
+ return Array.from(
170
+ this._testElement.querySelectorAll(
171
+ `qti-assessment-section[identifier="${navSectionId}"] > qti-assessment-item-ref`
172
+ )
173
+ ).map((itemRef) => itemRef.identifier);
174
+ }
175
+ _clearLoadedItems() {
176
+ const itemRefEls = this._testElement?.querySelectorAll(
177
+ `qti-assessment-test qti-assessment-item-ref`
178
+ );
179
+ Array.from(itemRefEls || []).forEach((itemElement) => {
180
+ itemElement.xmlDoc = null;
181
+ });
182
+ }
183
+ _loadItemRequest(href, identifier) {
184
+ const event = new CustomEvent("qti-load-item-request", {
185
+ bubbles: true,
186
+ composed: true,
187
+ detail: { href, identifier, promise: null }
188
+ });
189
+ this.dispatchEvent(event);
190
+ return event.detail.promise;
191
+ }
192
+ }
193
+ __decorateClass([
194
+ property2({ type: String })
195
+ ], TestNavigationClass.prototype, "navigate", 2);
196
+ return TestNavigationClass;
197
+ };
198
+
199
+ // src/lib/qti-test/core/mixins/test-view.mixin.ts
200
+ var TestViewMixin = (superClass) => {
201
+ class TestViewClass extends superClass {
202
+ constructor(...args) {
203
+ super(...args);
204
+ this.sessionContext = { ...this.sessionContext, view: "candidate" };
205
+ this.addEventListener("on-test-switch-view", (e) => {
206
+ this.sessionContext = { ...this.sessionContext, view: e.detail };
207
+ this._updateElementView();
208
+ });
209
+ this.addEventListener("qti-assessment-test-connected", () => {
210
+ this._updateElementView();
211
+ });
212
+ this.addEventListener("qti-assessment-item-connected", (e) => {
213
+ this._updateElementView();
214
+ this._setCorrectResponseVisibility(e.detail);
215
+ });
216
+ }
217
+ willUpdate(changedProperties) {
218
+ super.willUpdate(changedProperties);
219
+ if (changedProperties.has("sessionContext")) {
220
+ this._updateElementView();
221
+ }
222
+ }
223
+ // Method to handle view updates for elements based on the current context view
224
+ _updateElementView() {
225
+ if (this._testElement && this._testElement) {
226
+ const viewElements = Array.from(this._testElement.querySelectorAll("[view]"));
227
+ viewElements.forEach((element) => {
228
+ element.classList.toggle("show", element.getAttribute("view") === this.sessionContext.view);
229
+ });
230
+ const assessmentItem = this._testElement.querySelector(
231
+ `qti-assessment-item[identifier="${this.sessionContext.navItemId}"]`
232
+ );
233
+ if (assessmentItem) {
234
+ assessmentItem.showCorrectResponse(this.sessionContext.view === "scorer");
235
+ }
236
+ }
237
+ }
238
+ // Event handler for connected QTI assessment items
239
+ _setCorrectResponseVisibility(assessmentItem) {
240
+ assessmentItem.showCorrectResponse(this.sessionContext.view === "scorer");
241
+ }
242
+ }
243
+ return TestViewClass;
244
+ };
245
+
246
+ // src/lib/qti-test/core/test-base.ts
247
+ import { provide } from "@lit/context";
248
+ import { LitElement } from "lit";
249
+ import { property as property3 } from "lit/decorators.js";
250
+ var TestBase = class extends LitElement {
251
+ constructor() {
252
+ super();
253
+ this.testContext = INITIAL_TEST_CONTEXT;
254
+ this.sessionContext = INITIAL_SESSION_CONTEXT;
255
+ /**
256
+ * Updates the variables of an assessment item in the test context.
257
+ * - Matches the assessment item with the corresponding test context item.
258
+ * - If the item is not found, logs a warning.
259
+ * - Updates variables in the test context if exactly one variable exists.
260
+ * - Otherwise, syncs the assessment item's variables with the test context.
261
+ *
262
+ * @param assessmentItem - The assessment item to update.
263
+ */
264
+ this._updateItemInTestContext = (assessmentItem) => {
265
+ const context = assessmentItem._context;
266
+ const identifier = context.identifier;
267
+ const fullVariables = context.variables;
268
+ const itemContext = this.testContext.items.find((i) => i?.identifier === identifier);
269
+ if (!itemContext) {
270
+ console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);
271
+ return;
272
+ }
273
+ if (itemContext.variables?.length === 1) {
274
+ this._updateItemVariablesInTestContext(identifier, fullVariables);
275
+ } else {
276
+ assessmentItem.variables = [...itemContext.variables || []];
277
+ }
278
+ };
279
+ this.addEventListener("qti-assessment-test-connected", (e) => {
280
+ this.testContext = INITIAL_TEST_CONTEXT;
281
+ this.sessionContext = INITIAL_SESSION_CONTEXT;
282
+ if (this.testContext && this.testContext.items.length > 0) return;
283
+ this._testElement = e.detail;
284
+ const items = Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map((itemRef) => {
285
+ return {
286
+ href: itemRef.href,
287
+ identifier: itemRef.identifier,
288
+ category: itemRef.category,
289
+ variables: [
290
+ {
291
+ identifier: "completionStatus",
292
+ value: "not_attempted",
293
+ type: "outcome"
294
+ }
295
+ ]
296
+ };
297
+ });
298
+ this.testContext = { ...this.testContext, items };
299
+ });
300
+ this.addEventListener("qti-assessment-item-connected", (e) => {
301
+ const assessmentItem = e.detail;
302
+ const assessmentRefId = assessmentItem.closest("qti-assessment-item-ref")?.identifier;
303
+ if (assessmentRefId) {
304
+ assessmentItem.assessmentItemRefId = assessmentRefId;
305
+ }
306
+ this._updateItemInTestContext(e.detail);
307
+ });
308
+ this.addEventListener("qti-item-context-updated", (e) => {
309
+ this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail.itemContext.variables);
310
+ });
311
+ }
312
+ _updateItemVariablesInTestContext(identifier, variables) {
313
+ this.testContext = {
314
+ ...this.testContext,
315
+ // Spread existing test context properties
316
+ items: this.testContext.items.map((itemContext) => {
317
+ if (itemContext.identifier !== identifier) {
318
+ return itemContext;
319
+ }
320
+ return {
321
+ ...itemContext,
322
+ // Keep other properties of the item context
323
+ variables: variables.map((variable) => {
324
+ const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
325
+ return matchingVariable ? { ...matchingVariable, ...variable } : variable;
326
+ })
327
+ };
328
+ })
329
+ };
330
+ this.dispatchEvent(
331
+ new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false })
332
+ );
333
+ }
334
+ };
335
+ __decorateClass([
336
+ property3({ attribute: false, type: Object }),
337
+ provide({ context: testContext })
338
+ ], TestBase.prototype, "testContext", 2);
339
+ __decorateClass([
340
+ property3({ attribute: false, type: Object }),
341
+ provide({ context: sessionContext })
342
+ ], TestBase.prototype, "sessionContext", 2);
343
+
344
+ // src/lib/qti-test/core/mixins/test-processing.mixin.ts
345
+ var TestProcessingMixin = (superClass) => {
346
+ class TestProcessingElement extends superClass {
347
+ constructor(...args) {
348
+ super(...args);
349
+ this.addEventListener("qti-register-variable", (e) => {
350
+ this.testContext = {
351
+ ...this.testContext,
352
+ testOutcomeVariables: [...this.testContext.testOutcomeVariables || [], e.detail.variable]
353
+ };
354
+ e.stopPropagation();
355
+ });
356
+ this.addEventListener(
357
+ "qti-set-outcome-value",
358
+ (e) => {
359
+ const { outcomeIdentifier, value } = e.detail;
360
+ this.updateOutcomeVariable(outcomeIdentifier, value);
361
+ e.stopPropagation();
362
+ }
363
+ );
364
+ }
365
+ outcomeProcessing() {
366
+ const outcomeProcessor = this.querySelector("qti-outcome-processing");
367
+ if (!outcomeProcessor) return false;
368
+ outcomeProcessor?.process();
369
+ return true;
370
+ }
371
+ /* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */
372
+ updateOutcomeVariable(identifier, value) {
373
+ const outcomeVariable = this.getOutcome(identifier);
374
+ if (!outcomeVariable) {
375
+ console.warn(`Can not set qti-outcome-identifier: ${identifier}, it is not available`);
376
+ return;
377
+ }
378
+ this.testContext = {
379
+ ...this.testContext,
380
+ testOutcomeVariables: this.testContext.testOutcomeVariables?.map((v) => {
381
+ if (v.identifier !== identifier) {
382
+ return v;
383
+ }
384
+ return {
385
+ ...v,
386
+ value: outcomeVariable.cardinality === "single" ? value : [...v.value, value]
387
+ };
388
+ })
389
+ };
390
+ }
391
+ getOutcome(identifier) {
392
+ return this.getVariable(identifier);
393
+ }
394
+ getVariable(identifier) {
395
+ return this.testContext.testOutcomeVariables?.find((v) => v.identifier === identifier) || null;
396
+ }
397
+ /* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */
398
+ }
399
+ return TestProcessingElement;
400
+ };
401
+
402
+ // src/lib/qti-test/core/qti-test.ts
403
+ var QtiTest = class extends TestLoaderMixin(TestNavigationMixin(TestViewMixin(TestProcessingMixin(TestBase)))) {
404
+ // export class QtiTest extends TestLoaderMixin(TestNavigationMixin(TestViewMixin(TestBase))) {
405
+ /**
406
+ * Renders the component's template.
407
+ * Provides a default `<slot>` for content projection.
408
+ */
409
+ async connectedCallback() {
410
+ super.connectedCallback();
411
+ await this.updateComplete;
412
+ this.dispatchEvent(new CustomEvent("qti-test-connected", { detail: this }));
413
+ }
414
+ render() {
415
+ return html`<slot></slot>`;
416
+ }
417
+ };
418
+ QtiTest = __decorateClass([
419
+ customElement("qti-test")
420
+ ], QtiTest);
421
+
422
+ // src/lib/qti-test/core/qti-assessment-test/qti-assessment-item-ref.ts
423
+ import { LitElement as LitElement2 } from "lit";
424
+ import { property as property4 } from "lit/decorators.js";
425
+ import { prepareTemplate } from "stampino";
426
+ var stringToBooleanConverter = {
427
+ fromAttribute(value) {
428
+ return value === "true";
429
+ },
430
+ toAttribute(value) {
431
+ return value ? "true" : "false";
432
+ }
433
+ };
434
+ var QtiAssessmentItemRef = class extends LitElement2 {
435
+ constructor() {
436
+ super(...arguments);
437
+ // @consume({ context: computedContext, subscribe: true })
438
+ // private computedContext: ComputedContext;
439
+ this.weigths = /* @__PURE__ */ new Map();
440
+ }
441
+ // the XMLDocument
442
+ createRenderRoot() {
443
+ return this;
444
+ }
445
+ get assessmentItem() {
446
+ return this.renderRoot?.querySelector("qti-assessment-item");
447
+ }
448
+ async connectedCallback() {
449
+ super.connectedCallback();
450
+ const templateElement = this.getRootNode().host.closest("qti-test").querySelector("template[item-ref]");
451
+ if (templateElement) this.myTemplate = prepareTemplate(templateElement);
452
+ await this.updateComplete;
453
+ this.dispatchEvent(
454
+ new CustomEvent("qti-assessment-item-ref-connected", {
455
+ bubbles: true,
456
+ composed: true,
457
+ detail: { identifier: this.identifier, href: this.href, category: this.category }
458
+ })
459
+ );
460
+ }
461
+ render() {
462
+ return this.myTemplate ? this.myTemplate({ xmlDoc: this.xmlDoc }) : this.xmlDoc;
463
+ }
464
+ };
465
+ __decorateClass([
466
+ property4({ type: String })
467
+ ], QtiAssessmentItemRef.prototype, "category", 2);
468
+ __decorateClass([
469
+ property4({ type: String })
470
+ ], QtiAssessmentItemRef.prototype, "identifier", 2);
471
+ __decorateClass([
472
+ property4({ type: Boolean, converter: stringToBooleanConverter })
473
+ ], QtiAssessmentItemRef.prototype, "required", 2);
474
+ __decorateClass([
475
+ property4({ type: Boolean, converter: stringToBooleanConverter })
476
+ ], QtiAssessmentItemRef.prototype, "fixed", 2);
477
+ __decorateClass([
478
+ property4({ type: String })
479
+ ], QtiAssessmentItemRef.prototype, "href", 2);
480
+ __decorateClass([
481
+ property4({ type: Object, attribute: false })
482
+ ], QtiAssessmentItemRef.prototype, "xmlDoc", 2);
483
+ if (!customElements.get("qti-assessment-item-ref")) {
484
+ customElements.define("qti-assessment-item-ref", QtiAssessmentItemRef);
485
+ }
486
+
487
+ // src/lib/qti-test/core/qti-assessment-test/qti-assessment-section.ts
488
+ import { consume } from "@lit/context";
489
+ import { html as html2, LitElement as LitElement3 } from "lit";
490
+ import { property as property5 } from "lit/decorators.js";
491
+ var stringToBooleanConverter2 = {
492
+ fromAttribute(value) {
493
+ return value === "true";
494
+ },
495
+ toAttribute(value) {
496
+ return value ? "true" : "false";
497
+ }
498
+ };
499
+ var QtiAssessmentSection = class extends LitElement3 {
500
+ async connectedCallback() {
501
+ super.connectedCallback();
502
+ await this.updateComplete;
503
+ this.dispatchEvent(
504
+ new Event("qti-assessment-section-connected", {
505
+ bubbles: true,
506
+ composed: true
507
+ })
508
+ );
509
+ }
510
+ render() {
511
+ return html2`<slot name="qti-rubric-block"></slot><slot></slot>`;
512
+ }
513
+ };
514
+ __decorateClass([
515
+ property5({ type: String })
516
+ ], QtiAssessmentSection.prototype, "identifier", 2);
517
+ __decorateClass([
518
+ property5({ type: String })
519
+ ], QtiAssessmentSection.prototype, "required", 2);
520
+ __decorateClass([
521
+ property5({ type: Boolean, converter: stringToBooleanConverter2 })
522
+ ], QtiAssessmentSection.prototype, "fixed", 2);
523
+ __decorateClass([
524
+ property5({ type: String })
525
+ ], QtiAssessmentSection.prototype, "title", 2);
526
+ __decorateClass([
527
+ property5({ type: Boolean, converter: stringToBooleanConverter2 })
528
+ ], QtiAssessmentSection.prototype, "visible", 2);
529
+ __decorateClass([
530
+ property5({ type: Boolean, converter: stringToBooleanConverter2, attribute: "keep-together" })
531
+ ], QtiAssessmentSection.prototype, "keepTogether", 2);
532
+ __decorateClass([
533
+ consume({ context: testContext, subscribe: true })
534
+ ], QtiAssessmentSection.prototype, "_testContext", 2);
535
+ if (!customElements.get("qti-assessment-section")) {
536
+ customElements.define("qti-assessment-section", QtiAssessmentSection);
537
+ }
538
+
539
+ // src/lib/qti-test/core/qti-assessment-test/qti-assessment-test.ts
540
+ import { consume as consume2 } from "@lit/context";
541
+ import { html as html3, LitElement as LitElement4 } from "lit";
542
+ import { customElement as customElement2, property as property6 } from "lit/decorators.js";
543
+ var QtiAssessmentTest = class extends LitElement4 {
544
+ async connectedCallback() {
545
+ super.connectedCallback();
546
+ await this.updateComplete;
547
+ this.dispatchEvent(
548
+ new CustomEvent("qti-assessment-test-connected", {
549
+ detail: this,
550
+ bubbles: true,
551
+ composed: true
552
+ })
553
+ );
554
+ }
555
+ render() {
556
+ return html3` <slot></slot>`;
557
+ }
558
+ };
559
+ __decorateClass([
560
+ property6({ type: String })
561
+ ], QtiAssessmentTest.prototype, "identifier", 2);
562
+ __decorateClass([
563
+ property6({ type: String })
564
+ ], QtiAssessmentTest.prototype, "title", 2);
565
+ __decorateClass([
566
+ consume2({ context: testContext, subscribe: true })
567
+ ], QtiAssessmentTest.prototype, "_testContext", 2);
568
+ QtiAssessmentTest = __decorateClass([
569
+ customElement2("qti-assessment-test")
570
+ ], QtiAssessmentTest);
571
+
572
+ // src/lib/qti-test/core/qti-assessment-test/qti-test-part.ts
573
+ import { html as html4, LitElement as LitElement5 } from "lit";
574
+ import { customElement as customElement3, property as property7 } from "lit/decorators.js";
575
+ var QtiTestPart = class extends LitElement5 {
576
+ constructor() {
577
+ super(...arguments);
578
+ this.identifier = "";
579
+ this.title = "";
580
+ this.class = "";
581
+ this.NavigationMode = "nonlinear";
582
+ this.submissionMode = "individual";
583
+ }
584
+ async connectedCallback() {
585
+ super.connectedCallback();
586
+ await this.updateComplete;
587
+ this.dispatchEvent(
588
+ new Event("qti-test-part-connected", {
589
+ bubbles: true,
590
+ composed: true
591
+ })
592
+ );
593
+ }
594
+ render() {
595
+ return html4` <slot></slot>`;
596
+ }
597
+ };
598
+ __decorateClass([
599
+ property7({ type: String })
600
+ ], QtiTestPart.prototype, "identifier", 2);
601
+ __decorateClass([
602
+ property7({ type: String })
603
+ ], QtiTestPart.prototype, "title", 2);
604
+ __decorateClass([
605
+ property7({ type: String })
606
+ ], QtiTestPart.prototype, "class", 2);
607
+ __decorateClass([
608
+ property7({ type: String, attribute: "navigation-mode" })
609
+ ], QtiTestPart.prototype, "NavigationMode", 2);
610
+ __decorateClass([
611
+ property7({ type: String, attribute: "submission-mode" })
612
+ ], QtiTestPart.prototype, "submissionMode", 2);
613
+ QtiTestPart = __decorateClass([
614
+ customElement3("qti-test-part")
615
+ ], QtiTestPart);
616
+ if (!customElements.get("qti-test-part")) {
617
+ customElements.define("qti-test-part", QtiTestPart);
618
+ }
619
+
620
+ // src/lib/qti-test/core/qti-assessment-test/qti-test-feedback.ts
621
+ import { customElement as customElement4 } from "lit/decorators.js";
622
+ import { css, html as html5 } from "lit";
623
+ var QtiTestFeedback = class extends QtiModalFeedback {
624
+ render() {
625
+ return html5``;
626
+ }
627
+ };
628
+ QtiTestFeedback.styles = css`
629
+ :host {
630
+ color: gray;
631
+ }
632
+ `;
633
+ QtiTestFeedback = __decorateClass([
634
+ customElement4("qti-test-feedback")
635
+ ], QtiTestFeedback);
636
+
637
+ export {
638
+ QtiTest,
639
+ QtiAssessmentItemRef,
640
+ QtiAssessmentSection,
641
+ QtiAssessmentTest,
642
+ QtiTestPart,
643
+ QtiTestFeedback
644
+ };
645
+ //# sourceMappingURL=chunk-MHPLSF7C.js.map