@citolab/qti-components 7.28.1 → 8.0.1

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 (88) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +6316 -2710
  3. package/dist/base.d.ts +100 -15
  4. package/dist/base.js +27 -6
  5. package/dist/chunk-3AJOQCDU.js +11 -0
  6. package/dist/chunk-3AJOQCDU.js.map +1 -0
  7. package/dist/chunk-64XSIBGO.js +241 -0
  8. package/dist/chunk-64XSIBGO.js.map +1 -0
  9. package/dist/chunk-7HC5SMCU.js +102 -0
  10. package/dist/chunk-7HC5SMCU.js.map +1 -0
  11. package/dist/{chunk-SP6S2WMG.js → chunk-7V4HJFHW.js} +3 -3
  12. package/dist/{chunk-SP6S2WMG.js.map → chunk-7V4HJFHW.js.map} +1 -1
  13. package/dist/chunk-CAO4JRLY.js +11 -0
  14. package/dist/chunk-CAO4JRLY.js.map +1 -0
  15. package/dist/{chunk-MPC7LIPC.js → chunk-F4BNJWYN.js} +4264 -3647
  16. package/dist/chunk-F4BNJWYN.js.map +1 -0
  17. package/dist/{chunk-3XV26R5M.js → chunk-H3J7LFRO.js} +829 -1005
  18. package/dist/chunk-H3J7LFRO.js.map +1 -0
  19. package/dist/{chunk-3WBG257S.js → chunk-IJD53WY6.js} +96 -74
  20. package/dist/chunk-IJD53WY6.js.map +1 -0
  21. package/dist/chunk-LVBIQDPM.js +1374 -0
  22. package/dist/chunk-LVBIQDPM.js.map +1 -0
  23. package/dist/{chunk-REI3AMCZ.js → chunk-NA2N2WSG.js} +1303 -1193
  24. package/dist/chunk-NA2N2WSG.js.map +1 -0
  25. package/dist/chunk-QECOPVPO.js +294 -0
  26. package/dist/chunk-QECOPVPO.js.map +1 -0
  27. package/dist/{chunk-HFCZFWSH.js → chunk-RXGDQDOV.js} +1993 -1764
  28. package/dist/chunk-RXGDQDOV.js.map +1 -0
  29. package/dist/chunk-V5G7X53Y.js +11 -0
  30. package/dist/chunk-V5G7X53Y.js.map +1 -0
  31. package/dist/{chunk-WDO2TRFM.js → chunk-WVVMNF74.js} +851 -925
  32. package/dist/chunk-WVVMNF74.js.map +1 -0
  33. package/dist/{chunk-FLJAKWXL.js → chunk-X3E5HXG2.js} +2 -2
  34. package/dist/chunk-XU7HNT4F.js +1608 -0
  35. package/dist/chunk-XU7HNT4F.js.map +1 -0
  36. package/dist/{computed-item.context-DfsW_96S.d.ts → computed-item.types.d-BKZdSLLJ.d.ts} +2 -5
  37. package/dist/{computed.context-DHbxad0N.d.ts → computed.types.d-rKLSPvVG.d.ts} +2 -5
  38. package/dist/config.context.d-BvU9r-Mg.d.ts +91 -0
  39. package/dist/corrections.d.ts +432 -0
  40. package/dist/corrections.js +84 -0
  41. package/dist/elements.d.ts +8 -14
  42. package/dist/elements.js +6 -5
  43. package/dist/index.d.ts +51 -16
  44. package/dist/index.js +193 -76
  45. package/dist/interaction.d-D4MstYRz.d.ts +115 -0
  46. package/dist/interaction.interface.d-CvjHM2bi.d.ts +46 -0
  47. package/dist/interactions.d.ts +1206 -552
  48. package/dist/interactions.js +19 -15
  49. package/dist/item.css +4228 -1656
  50. package/dist/item.d.ts +13 -55
  51. package/dist/item.js +6 -11
  52. package/dist/{variables-CMYcDbyW.d.ts → item.types.d-QU7LljEK.d.ts} +13 -1
  53. package/dist/loader.d.ts +4 -4
  54. package/dist/loader.js +2 -3
  55. package/dist/processing.d.ts +6 -7
  56. package/dist/processing.js +2 -3
  57. package/dist/qti-components-jsx.d.ts +5348 -2709
  58. package/dist/qti-components-jsx.js +1 -0
  59. package/dist/qti-condition-expression.d-aMvBvpc6.d.ts +8 -0
  60. package/dist/{qti-condition-expression-Dam-RER6.d.ts → qti-expression.d-BietT_8b.d.ts} +14 -9
  61. package/dist/{qti-feedback-ChmXhZuf.d.ts → qti-feedback.d-DZbad0RN.d.ts} +1 -1
  62. package/dist/{qti-transform-test-DoZaWItm.d.ts → qti-transform-test.d-BL7GGFJj.d.ts} +2 -2
  63. package/dist/response.d-_8y4kjGP.d.ts +106 -0
  64. package/dist/test.d.ts +199 -39
  65. package/dist/test.js +34 -11
  66. package/dist/transformers.d.ts +1 -1
  67. package/dist/transformers.js +1 -2
  68. package/package.json +24 -17
  69. package/custom-elements.json +0 -43251
  70. package/dist/chunk-3WBG257S.js.map +0 -1
  71. package/dist/chunk-3XV26R5M.js.map +0 -1
  72. package/dist/chunk-AQ5RJFM6.js +0 -3673
  73. package/dist/chunk-AQ5RJFM6.js.map +0 -1
  74. package/dist/chunk-HFCZFWSH.js.map +0 -1
  75. package/dist/chunk-MPC7LIPC.js.map +0 -1
  76. package/dist/chunk-QXBXORM3.js +0 -27
  77. package/dist/chunk-REI3AMCZ.js.map +0 -1
  78. package/dist/chunk-RLTYVS2I.js +0 -530
  79. package/dist/chunk-RLTYVS2I.js.map +0 -1
  80. package/dist/chunk-WDO2TRFM.js.map +0 -1
  81. package/dist/config.context-BjZ2bZSY.d.ts +0 -42
  82. package/dist/interaction-Bgzlw7Iu.d.ts +0 -110
  83. package/dist/item.context-CkUeDcaO.d.ts +0 -15
  84. package/dist/test.context-CByZZjkR.d.ts +0 -15
  85. /package/dist/{chunk-FLJAKWXL.js.map → chunk-X3E5HXG2.js.map} +0 -0
  86. /package/dist/{chunk-QXBXORM3.js.map → corrections.js.map} +0 -0
  87. /package/dist/{qti-rule-base-ajOnfGXY.d.ts → qti-rule-base.d-ajOnfGXY.d.ts} +0 -0
  88. /package/dist/{qti.context-CejJMlfZ.d.ts → qti.context.d-CejJMlfZ.d.ts} +0 -0
@@ -1,530 +0,0 @@
1
- import {
2
- item_default,
3
- m
4
- } from "./chunk-AQ5RJFM6.js";
5
- import {
6
- qtiTransformItem
7
- } from "./chunk-3WBG257S.js";
8
- import {
9
- T,
10
- c,
11
- computedItemContext,
12
- configContext,
13
- e,
14
- i,
15
- i2,
16
- n,
17
- qtiContext,
18
- r,
19
- t,
20
- watch
21
- } from "./chunk-3XV26R5M.js";
22
- import {
23
- __decorateClass,
24
- __privateAdd,
25
- __privateGet,
26
- __privateMethod,
27
- __privateSet
28
- } from "./chunk-QXBXORM3.js";
29
-
30
- // ../qti-item/src/components/item-container/item-container.ts
31
- var _templateContent, _ItemContainer_instances, initializeTemplateContent_fn, applyStyles_fn;
32
- var ItemContainer = class extends i2 {
33
- constructor() {
34
- super(...arguments);
35
- __privateAdd(this, _ItemContainer_instances);
36
- this.itemURL = null;
37
- this.itemDoc = null;
38
- this.itemXML = null;
39
- this.qtiContext = {
40
- QTI_CONTEXT: { testIdentifier: "", candidateIdentifier: "", environmentIdentifier: "default" }
41
- };
42
- /** Template content if provided */
43
- __privateAdd(this, _templateContent, null);
44
- }
45
- async handleItemURLChange() {
46
- if (!this.itemURL) return;
47
- try {
48
- const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;
49
- const api = (await qtiTransformItem().load(this.itemURL)).shuffleInteractions(explicitSeed);
50
- this.itemDoc = api.htmlDoc();
51
- } catch (error) {
52
- console.error("Error loading or parsing XML:", error);
53
- }
54
- }
55
- handleItemXMLChange() {
56
- if (!this.itemXML) return;
57
- try {
58
- this.itemDoc = qtiTransformItem().parse(this.itemXML).htmlDoc();
59
- } catch (error) {
60
- console.error("Error parsing XML:", error);
61
- }
62
- }
63
- async connectedCallback() {
64
- super.connectedCallback();
65
- __privateMethod(this, _ItemContainer_instances, initializeTemplateContent_fn).call(this);
66
- __privateMethod(this, _ItemContainer_instances, applyStyles_fn).call(this);
67
- if (this.itemURL) {
68
- this.handleItemURLChange();
69
- }
70
- if (this.itemXML) {
71
- this.handleItemXMLChange();
72
- }
73
- }
74
- render() {
75
- return T`
76
- ${__privateGet(this, _templateContent)}
77
- <slot></slot>
78
- ${m(this.itemDoc, T`<span>Loading...</span>`)}
79
- `;
80
- }
81
- };
82
- _templateContent = new WeakMap();
83
- _ItemContainer_instances = new WeakSet();
84
- initializeTemplateContent_fn = function() {
85
- const template = this.querySelector("template");
86
- __privateSet(this, _templateContent, template ? template.content : T``);
87
- };
88
- applyStyles_fn = function() {
89
- const sheet = new CSSStyleSheet();
90
- sheet.replaceSync(item_default);
91
- this.shadowRoot.adoptedStyleSheets = [sheet];
92
- };
93
- __decorateClass([
94
- n({ type: String, attribute: "item-url" })
95
- ], ItemContainer.prototype, "itemURL", 2);
96
- __decorateClass([
97
- r()
98
- ], ItemContainer.prototype, "itemDoc", 2);
99
- __decorateClass([
100
- r()
101
- ], ItemContainer.prototype, "itemXML", 2);
102
- __decorateClass([
103
- r(),
104
- c({ context: qtiContext, subscribe: true })
105
- ], ItemContainer.prototype, "qtiContext", 2);
106
- __decorateClass([
107
- watch("itemURL", { waitUntilFirstUpdate: true })
108
- ], ItemContainer.prototype, "handleItemURLChange", 1);
109
- __decorateClass([
110
- watch("itemXML", { waitUntilFirstUpdate: true })
111
- ], ItemContainer.prototype, "handleItemXMLChange", 1);
112
- ItemContainer = __decorateClass([
113
- t("item-container")
114
- ], ItemContainer);
115
-
116
- // ../qti-item/src/components/item-correct-response-mode/item-correct-response-mode.ts
117
- var _ItemCorrectResponseMode_instances, switchMode_fn;
118
- var ItemCorrectResponseMode = class extends i2 {
119
- constructor() {
120
- super(...arguments);
121
- __privateAdd(this, _ItemCorrectResponseMode_instances);
122
- this.label = "Correct response mode";
123
- this._options = {
124
- internal: "Internal",
125
- full: "Full (copy)"
126
- };
127
- }
128
- render() {
129
- return T`
130
- <label part="label" for="modeSelect">${this.label}</label>
131
- <select
132
- part="select"
133
- id="modeSelect"
134
- @change=${(e2) => {
135
- const el = e2.target;
136
- __privateMethod(this, _ItemCorrectResponseMode_instances, switchMode_fn).call(this, el.value);
137
- }}
138
- >
139
- ${Object.keys(this._options).map(
140
- (value) => T`<option value="${value}" ?selected=${value === this.itemContext?.correctResponseMode}>
141
- ${this._options[value]}
142
- </option>`
143
- )}
144
- </select>
145
- `;
146
- }
147
- };
148
- _ItemCorrectResponseMode_instances = new WeakSet();
149
- switchMode_fn = function(view) {
150
- this.dispatchEvent(
151
- new CustomEvent("item-switch-correct-response-mode", {
152
- detail: view,
153
- bubbles: true
154
- })
155
- );
156
- };
157
- __decorateClass([
158
- c({ context: configContext, subscribe: true })
159
- ], ItemCorrectResponseMode.prototype, "itemContext", 2);
160
- __decorateClass([
161
- n({ type: String })
162
- ], ItemCorrectResponseMode.prototype, "label", 2);
163
- __decorateClass([
164
- r()
165
- ], ItemCorrectResponseMode.prototype, "_options", 2);
166
- ItemCorrectResponseMode = __decorateClass([
167
- t("item-correct-response-mode")
168
- ], ItemCorrectResponseMode);
169
-
170
- // ../qti-item/src/components/styles.ts
171
- var form = i`
172
- display: inline-flex;
173
- align-items: center;
174
- cursor: pointer;
175
- padding: 0.5rem 1rem;
176
- border-radius: 0.25rem;
177
- user-select: none;
178
- `;
179
- var btn = i`
180
- background-color: lightgray;
181
- ${form};
182
- `;
183
- var dis = i`
184
- cursor: not-allowed;
185
- opacity: 0.8;
186
- `;
187
- var ind = i`
188
- ${form};
189
- border: 1px solid gray;
190
- `;
191
-
192
- // ../qti-item/src/components/item-show-candidate-correction/item-show-candidate-correction.ts
193
- var _hasCorrectResponse, _previousActiveItem, _ItemShowCandidateCorrection_instances, toggleState_fn, getDisplayedText_fn;
194
- var ItemShowCandidateCorrection = class extends i2 {
195
- // Store previous active item reference
196
- constructor() {
197
- super();
198
- __privateAdd(this, _ItemShowCandidateCorrection_instances);
199
- this.shown = false;
200
- this.disabled = false;
201
- this.showCandidateCorrectionText = "Show candidate correction";
202
- this.hideCandidateCorrectionText = "Hide candidate correction";
203
- this.noCorrectResponseText = "No correct response specified";
204
- __privateAdd(this, _hasCorrectResponse, false);
205
- // correct response is removed on certain point
206
- __privateAdd(this, _previousActiveItem, "");
207
- }
208
- updated() {
209
- if (!__privateGet(this, _hasCorrectResponse) || __privateGet(this, _previousActiveItem) !== this.computedContext?.identifier) {
210
- __privateSet(this, _previousActiveItem, this.computedContext?.identifier);
211
- const containsCorrectResponse = !!this.computedContext?.variables.some((v) => v["correctResponse"]);
212
- const containsMapping = !!this.computedContext?.variables.some((v) => {
213
- return v["mapping"]?.mapEntries?.length > 0 || v["areaMapping"]?.areaMapEntries?.length > 0;
214
- });
215
- __privateSet(this, _hasCorrectResponse, containsCorrectResponse || containsMapping);
216
- }
217
- this.disabled = !__privateGet(this, _hasCorrectResponse);
218
- }
219
- render() {
220
- return T` <div @click="${__privateMethod(this, _ItemShowCandidateCorrection_instances, toggleState_fn)}">${__privateMethod(this, _ItemShowCandidateCorrection_instances, getDisplayedText_fn).call(this)}</div> `;
221
- }
222
- };
223
- _hasCorrectResponse = new WeakMap();
224
- _previousActiveItem = new WeakMap();
225
- _ItemShowCandidateCorrection_instances = new WeakSet();
226
- toggleState_fn = function() {
227
- if (this.disabled) return;
228
- this.dispatchEvent(
229
- new CustomEvent("item-show-candidate-correction", {
230
- detail: !this.shown,
231
- bubbles: true
232
- })
233
- );
234
- };
235
- getDisplayedText_fn = function() {
236
- return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCandidateCorrectionText : this.showCandidateCorrectionText;
237
- };
238
- ItemShowCandidateCorrection.styles = i`
239
- :host {
240
- ${btn};
241
- }
242
- :host([disabled]) {
243
- ${dis};
244
- }
245
- `;
246
- __decorateClass([
247
- c({ context: computedItemContext, subscribe: true })
248
- ], ItemShowCandidateCorrection.prototype, "computedContext", 2);
249
- __decorateClass([
250
- n({ type: Boolean, reflect: true })
251
- ], ItemShowCandidateCorrection.prototype, "shown", 2);
252
- __decorateClass([
253
- n({ type: Boolean, reflect: true })
254
- ], ItemShowCandidateCorrection.prototype, "disabled", 2);
255
- __decorateClass([
256
- n({ type: String })
257
- ], ItemShowCandidateCorrection.prototype, "showCandidateCorrectionText", 2);
258
- __decorateClass([
259
- n({ type: String })
260
- ], ItemShowCandidateCorrection.prototype, "hideCandidateCorrectionText", 2);
261
- __decorateClass([
262
- n({ type: String })
263
- ], ItemShowCandidateCorrection.prototype, "noCorrectResponseText", 2);
264
- ItemShowCandidateCorrection = __decorateClass([
265
- t("item-show-candidate-correction")
266
- ], ItemShowCandidateCorrection);
267
-
268
- // ../qti-item/src/components/item-show-correct-response/item-show-correct-response.ts
269
- var _hasCorrectResponse2, _previousActiveItem2, _ItemShowCorrectResponse_instances, toggleState_fn2, getDisplayedText_fn2;
270
- var ItemShowCorrectResponse = class extends i2 {
271
- constructor() {
272
- super(...arguments);
273
- __privateAdd(this, _ItemShowCorrectResponse_instances);
274
- this.shown = false;
275
- this.disabled = false;
276
- this.showCorrectText = "Show correct response";
277
- this.hideCorrectText = "Hide correct response";
278
- this.noCorrectResponseText = "No correct response specified";
279
- __privateAdd(this, _hasCorrectResponse2, false);
280
- // correct response is removed on certain point
281
- __privateAdd(this, _previousActiveItem2, "");
282
- }
283
- // Store previous active item reference
284
- updated() {
285
- if (!__privateGet(this, _hasCorrectResponse2) || __privateGet(this, _previousActiveItem2) !== this.computedContext?.identifier) {
286
- __privateSet(this, _previousActiveItem2, this.computedContext?.identifier);
287
- const containsCorrectResponse = !!this.computedContext?.variables.some((v) => v["correctResponse"]);
288
- const containsMapping = !!this.computedContext?.variables.some((v) => {
289
- return v["mapping"]?.mapEntries?.length > 0 || v["areaMapping"]?.areaMapEntries?.length > 0;
290
- });
291
- __privateSet(this, _hasCorrectResponse2, containsCorrectResponse || containsMapping);
292
- }
293
- this.disabled = !__privateGet(this, _hasCorrectResponse2);
294
- }
295
- render() {
296
- return T` <div @click="${__privateMethod(this, _ItemShowCorrectResponse_instances, toggleState_fn2)}">${__privateMethod(this, _ItemShowCorrectResponse_instances, getDisplayedText_fn2).call(this)}</div> `;
297
- }
298
- };
299
- _hasCorrectResponse2 = new WeakMap();
300
- _previousActiveItem2 = new WeakMap();
301
- _ItemShowCorrectResponse_instances = new WeakSet();
302
- toggleState_fn2 = function() {
303
- if (this.disabled) return;
304
- this.dispatchEvent(
305
- new CustomEvent("item-show-correct-response", {
306
- detail: !this.shown,
307
- bubbles: true
308
- })
309
- );
310
- };
311
- getDisplayedText_fn2 = function() {
312
- return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;
313
- };
314
- ItemShowCorrectResponse.styles = i`
315
- :host {
316
- ${btn};
317
- }
318
- :host([disabled]) {
319
- ${dis};
320
- }
321
- `;
322
- __decorateClass([
323
- c({ context: computedItemContext, subscribe: true })
324
- ], ItemShowCorrectResponse.prototype, "computedContext", 2);
325
- __decorateClass([
326
- n({ type: Boolean, reflect: true })
327
- ], ItemShowCorrectResponse.prototype, "shown", 2);
328
- __decorateClass([
329
- n({ type: Boolean, reflect: true })
330
- ], ItemShowCorrectResponse.prototype, "disabled", 2);
331
- __decorateClass([
332
- n({ type: String })
333
- ], ItemShowCorrectResponse.prototype, "showCorrectText", 2);
334
- __decorateClass([
335
- n({ type: String })
336
- ], ItemShowCorrectResponse.prototype, "hideCorrectText", 2);
337
- __decorateClass([
338
- n({ type: String })
339
- ], ItemShowCorrectResponse.prototype, "noCorrectResponseText", 2);
340
- ItemShowCorrectResponse = __decorateClass([
341
- t("item-show-correct-response")
342
- ], ItemShowCorrectResponse);
343
-
344
- // ../qti-item/src/components/item-print-variables/item-print-variables.ts
345
- var ItemPrintVariables = class extends i2 {
346
- render() {
347
- const activeItem = this.computedContext;
348
- if (!activeItem || !activeItem.variables) return T``;
349
- const responseVariables = activeItem.variables.filter((v) => v.type === "response");
350
- const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
351
- const renderTable = (variables, title) => T`
352
- <h3>${title}</h3>
353
- <table>
354
- <thead>
355
- <tr>
356
- <th>Identifier</th>
357
- <th>Value</th>
358
- <th>Cardinality</th>
359
- <th>Base Type</th>
360
- <th>Correct Response / Mappings</th>
361
- </tr>
362
- </thead>
363
- <tbody>
364
- ${variables.map((v) => {
365
- const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
366
- const mapEntries = v.mapping?.mapEntries?.map((m2) => `${m2.mapKey}=${m2.mappedValue}pt`).join(", ") || "";
367
- const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m2) => `${m2.shape}(${m2.coords})=${m2.mappedValue}pt`).join(", ") || "";
368
- return T`
369
- <tr>
370
- <td>${v.identifier}</td>
371
- <td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
372
- <td>${v.cardinality}</td>
373
- <td>${v.baseType}</td>
374
- <td>${correctResponse || mapEntries || areaMapEntries}</td>
375
- </tr>
376
- `;
377
- })}
378
- </tbody>
379
- </table>
380
- `;
381
- return T`
382
- ${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
383
- `;
384
- }
385
- };
386
- ItemPrintVariables.styles = i`
387
- table {
388
- width: 100%;
389
- border-collapse: collapse;
390
- margin: 20px 0;
391
- font-size: 14px;
392
- text-align: left;
393
- }
394
- th,
395
- td {
396
- border: 1px solid #ddd;
397
- padding: 8px;
398
- }
399
- th {
400
- background-color: #f4f4f4;
401
- font-weight: bold;
402
- }
403
- h3 {
404
- margin-top: 20px;
405
- font-size: 16px;
406
- }
407
- `;
408
- __decorateClass([
409
- c({ context: computedItemContext, subscribe: true })
410
- ], ItemPrintVariables.prototype, "computedContext", 2);
411
- ItemPrintVariables = __decorateClass([
412
- t("item-print-variables")
413
- ], ItemPrintVariables);
414
-
415
- // ../qti-item/src/components/qti-item/qti-item.ts
416
- var _qtiAssessmentItem, _onItemContextChanged, _onAssessmentItemConnected, _onHandleShowCorrectResponse, _onHandleShowCandidateCorrection, _onHandleSwitchCorrectResponseMode, _QtiItem_instances, handleItemContextChanged_fn, handleAssessmentItemConnected_fn, handleShowCorrectResponse_fn, handleShowCandidateCorrection_fn, handleSwitchCorrectResponseMode_fn, updateItemVariablesInTestContext_fn;
417
- var QtiItem = class extends i2 {
418
- constructor() {
419
- super();
420
- __privateAdd(this, _QtiItem_instances);
421
- __privateAdd(this, _qtiAssessmentItem);
422
- this.configContext = {};
423
- this.qtiContext = {
424
- QTI_CONTEXT: {
425
- testIdentifier: "",
426
- candidateIdentifier: "",
427
- environmentIdentifier: "default"
428
- }
429
- };
430
- // Store event handlers as instance properties
431
- __privateAdd(this, _onItemContextChanged, __privateMethod(this, _QtiItem_instances, handleItemContextChanged_fn).bind(this));
432
- __privateAdd(this, _onAssessmentItemConnected, __privateMethod(this, _QtiItem_instances, handleAssessmentItemConnected_fn).bind(this));
433
- __privateAdd(this, _onHandleShowCorrectResponse, __privateMethod(this, _QtiItem_instances, handleShowCorrectResponse_fn).bind(this));
434
- __privateAdd(this, _onHandleShowCandidateCorrection, __privateMethod(this, _QtiItem_instances, handleShowCandidateCorrection_fn).bind(this));
435
- __privateAdd(this, _onHandleSwitchCorrectResponseMode, __privateMethod(this, _QtiItem_instances, handleSwitchCorrectResponseMode_fn).bind(this));
436
- this.addEventListener("qti-item-context-updated", __privateGet(this, _onItemContextChanged));
437
- this.addEventListener("qti-assessment-item-connected", __privateGet(this, _onAssessmentItemConnected));
438
- this.addEventListener("item-show-correct-response", __privateGet(this, _onHandleShowCorrectResponse));
439
- this.addEventListener("item-show-candidate-correction", __privateGet(this, _onHandleShowCandidateCorrection));
440
- this.addEventListener("item-switch-correct-response-mode", __privateGet(this, _onHandleSwitchCorrectResponseMode));
441
- }
442
- render() {
443
- return T`<slot></slot>`;
444
- }
445
- disconnectedCallback() {
446
- super.disconnectedCallback();
447
- this.removeEventListener("qti-item-context-changed", __privateGet(this, _onItemContextChanged));
448
- this.removeEventListener("qti-assessment-item-connected", __privateGet(this, _onAssessmentItemConnected));
449
- }
450
- };
451
- _qtiAssessmentItem = new WeakMap();
452
- _onItemContextChanged = new WeakMap();
453
- _onAssessmentItemConnected = new WeakMap();
454
- _onHandleShowCorrectResponse = new WeakMap();
455
- _onHandleShowCandidateCorrection = new WeakMap();
456
- _onHandleSwitchCorrectResponseMode = new WeakMap();
457
- _QtiItem_instances = new WeakSet();
458
- handleItemContextChanged_fn = function(e2) {
459
- __privateMethod(this, _QtiItem_instances, updateItemVariablesInTestContext_fn).call(this, e2.detail.itemContext.identifier, e2.detail?.itemContext?.variables || []);
460
- };
461
- handleAssessmentItemConnected_fn = function(e2) {
462
- const fullVariables = e2.detail._context.variables;
463
- __privateSet(this, _qtiAssessmentItem, e2.detail);
464
- this.computedContext = this.computedContext?.identifier === __privateGet(this, _qtiAssessmentItem).identifier ? { ...this.computedContext, title: __privateGet(this, _qtiAssessmentItem).title } : {
465
- identifier: __privateGet(this, _qtiAssessmentItem).identifier,
466
- title: __privateGet(this, _qtiAssessmentItem).title,
467
- adaptive: __privateGet(this, _qtiAssessmentItem).getAttribute("adaptive")?.toLowerCase() === "true" || false,
468
- variables: fullVariables,
469
- correctResponseMode: "internal"
470
- };
471
- __privateMethod(this, _QtiItem_instances, updateItemVariablesInTestContext_fn).call(this, __privateGet(this, _qtiAssessmentItem).identifier, fullVariables || []);
472
- };
473
- handleShowCorrectResponse_fn = function(e2) {
474
- if (__privateGet(this, _qtiAssessmentItem)) {
475
- __privateGet(this, _qtiAssessmentItem).showCorrectResponse(e2.detail);
476
- }
477
- };
478
- handleShowCandidateCorrection_fn = function(e2) {
479
- if (__privateGet(this, _qtiAssessmentItem)) {
480
- __privateGet(this, _qtiAssessmentItem).showCandidateCorrection(e2.detail);
481
- }
482
- };
483
- handleSwitchCorrectResponseMode_fn = function(e2) {
484
- __privateMethod(this, _QtiItem_instances, handleShowCorrectResponse_fn).call(this, new CustomEvent("item-show-correct-response", { detail: false, bubbles: true }));
485
- this.configContext = {
486
- ...this.configContext,
487
- correctResponseMode: e2.detail
488
- };
489
- };
490
- updateItemVariablesInTestContext_fn = function(identifier, variables) {
491
- const rawscore = variables?.find((vr) => vr.identifier == "SCORE")?.value;
492
- const score = parseFloat(rawscore?.toString());
493
- const completionStatus = variables?.find((v) => v.identifier === "completionStatus")?.value;
494
- const correct = score !== void 0 && !isNaN(score) && score > 0;
495
- const incorrect = score !== void 0 && !isNaN(score) && score <= 0;
496
- const completed = completionStatus === "completed";
497
- this.computedContext = {
498
- ...this.computedContext,
499
- identifier,
500
- correct,
501
- incorrect,
502
- completed,
503
- variables
504
- };
505
- };
506
- __decorateClass([
507
- r(),
508
- e({ context: computedItemContext })
509
- ], QtiItem.prototype, "computedContext", 2);
510
- __decorateClass([
511
- r(),
512
- e({ context: configContext })
513
- ], QtiItem.prototype, "configContext", 2);
514
- __decorateClass([
515
- r(),
516
- e({ context: qtiContext })
517
- ], QtiItem.prototype, "qtiContext", 2);
518
- QtiItem = __decorateClass([
519
- t("qti-item")
520
- ], QtiItem);
521
-
522
- export {
523
- ItemContainer,
524
- ItemCorrectResponseMode,
525
- ItemShowCandidateCorrection,
526
- ItemShowCorrectResponse,
527
- ItemPrintVariables,
528
- QtiItem
529
- };
530
- //# sourceMappingURL=chunk-RLTYVS2I.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../qti-item/src/components/item-container/item-container.ts","../../qti-item/src/components/item-correct-response-mode/item-correct-response-mode.ts","../../qti-item/src/components/styles.ts","../../qti-item/src/components/item-show-candidate-correction/item-show-candidate-correction.ts","../../qti-item/src/components/item-show-correct-response/item-show-correct-response.ts","../../qti-item/src/components/item-print-variables/item-print-variables.ts","../../qti-item/src/components/qti-item/qti-item.ts"],"sourcesContent":["import { consume } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { until } from 'lit/directives/until.js';\n\nimport { qtiContext } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\nimport { qtiTransformItem } from '@qti-components/transformers';\n\n// eslint-disable-next-line import/no-relative-packages\nimport itemCss from '../../../../qti-theme/src/item.css?inline';\n\nimport type { QtiContext } from '@qti-components/base';\n\n/**\n * `<item-container>` is a custom element designed for hosting the qti-assessment-item.\n * The `qti-assessment-item` will be placed inside the shadow DOM of this element.\n * The element loads the item from the provided URL and renders it inside the shadow DOM.\n *\n * ### Styling\n * Add a class to the element for styling.\n *\n * ```html\n * <qti-item>\n * <item-container class=\"m-4 bg-white\" item-url=\"./path/to/item.xml\"></item-container>\n * </qti-item>\n * ```\n */\n@customElement('item-container')\nexport class ItemContainer extends LitElement {\n /** URL of the item to load */\n @property({ type: String, attribute: 'item-url' })\n itemURL: string = null;\n\n /** A parsed HTML document */\n @state()\n itemDoc: DocumentFragment = null;\n\n /** The raw XML string */\n @state()\n itemXML: string = null;\n\n @state()\n @consume({ context: qtiContext, subscribe: true })\n protected qtiContext: QtiContext = {\n QTI_CONTEXT: { testIdentifier: '', candidateIdentifier: '', environmentIdentifier: 'default' }\n };\n\n /** Template content if provided */\n #templateContent: unknown = null;\n\n @watch('itemURL', { waitUntilFirstUpdate: true })\n protected async handleItemURLChange() {\n if (!this.itemURL) return;\n try {\n const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;\n const api = (await qtiTransformItem().load(this.itemURL)).shuffleInteractions(explicitSeed);\n this.itemDoc = api.htmlDoc();\n } catch (error) {\n console.error('Error loading or parsing XML:', error);\n }\n }\n\n @watch('itemXML', { waitUntilFirstUpdate: true })\n protected handleItemXMLChange() {\n if (!this.itemXML) return;\n try {\n this.itemDoc = qtiTransformItem().parse(this.itemXML).htmlDoc();\n } catch (error) {\n console.error('Error parsing XML:', error);\n }\n }\n\n override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n this.#initializeTemplateContent();\n this.#applyStyles();\n if (this.itemURL) {\n this.handleItemURLChange();\n }\n if (this.itemXML) {\n this.handleItemXMLChange();\n }\n }\n\n #initializeTemplateContent() {\n const template = this.querySelector('template') as HTMLTemplateElement;\n this.#templateContent = template ? template.content : html``;\n }\n\n #applyStyles() {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(itemCss);\n this.shadowRoot.adoptedStyleSheets = [sheet];\n }\n\n override render() {\n return html`\n ${this.#templateContent}\n <slot></slot>\n ${until(this.itemDoc, html`<span>Loading...</span>`)}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-container': ItemContainer;\n }\n}\n","import { html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { configContext } from '@qti-components/base';\n\nimport type { ConfigContext, CorrectResponseMode } from '@qti-components/base';\n\n@customElement('item-correct-response-mode')\nexport class ItemCorrectResponseMode extends LitElement {\n @consume({ context: configContext, subscribe: true })\n private itemContext: ConfigContext;\n\n @property({ type: String })\n label = 'Correct response mode';\n\n @state()\n private _options = {\n internal: 'Internal',\n full: 'Full (copy)'\n };\n\n #switchMode(view: CorrectResponseMode) {\n this.dispatchEvent(\n new CustomEvent('item-switch-correct-response-mode', {\n detail: view,\n bubbles: true\n })\n );\n }\n\n override render() {\n return html`\n <label part=\"label\" for=\"modeSelect\">${this.label}</label>\n <select\n part=\"select\"\n id=\"modeSelect\"\n @change=${(e: Event) => {\n const el = e.target as HTMLSelectElement;\n this.#switchMode(el.value as CorrectResponseMode);\n }}\n >\n ${Object.keys(this._options).map(\n value =>\n html`<option value=\"${value}\" ?selected=${value === this.itemContext?.correctResponseMode}>\n ${this._options[value as keyof typeof this._options]}\n </option>`\n )}\n </select>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-correct-response-mode': ItemCorrectResponseMode;\n }\n}\n","import { css } from 'lit';\n\nexport const form = css`\n display: inline-flex;\n align-items: center;\n cursor: pointer;\n padding: 0.5rem 1rem;\n border-radius: 0.25rem;\n user-select: none;\n`;\n\nexport const btn = css`\n background-color: lightgray;\n ${form};\n`;\n\nexport const dis = css`\n cursor: not-allowed;\n opacity: 0.8;\n`;\n\nexport const ind = css`\n ${form};\n border: 1px solid gray;\n`;\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { computedItemContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { ComputedItemContext } from '@qti-components/base';\n\n@customElement('item-show-candidate-correction')\nexport class ItemShowCandidateCorrection extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n public computedContext?: ComputedItemContext;\n\n static override styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n @property({ type: Boolean, reflect: true }) shown = false;\n @property({ type: Boolean, reflect: true }) disabled = false; // Reflects to `disabled` attribute\n @property({ type: String }) showCandidateCorrectionText = 'Show candidate correction';\n @property({ type: String }) hideCandidateCorrectionText = 'Hide candidate correction';\n @property({ type: String }) noCorrectResponseText = 'No correct response specified';\n\n #hasCorrectResponse = false; // correct response is removed on certain point\n #previousActiveItem = ''; // Store previous active item reference\n\n constructor() {\n super();\n }\n\n override updated() {\n if (!this.#hasCorrectResponse || this.#previousActiveItem !== this.computedContext?.identifier) {\n this.#previousActiveItem = this.computedContext?.identifier;\n const containsCorrectResponse = !!this.computedContext?.variables.some(v => (v as any)['correctResponse']);\n const containsMapping = !!this.computedContext?.variables.some(v => {\n return (v as any)['mapping']?.mapEntries?.length > 0 || (v as any)['areaMapping']?.areaMapEntries?.length > 0;\n });\n this.#hasCorrectResponse = containsCorrectResponse || containsMapping;\n }\n this.disabled = !this.#hasCorrectResponse;\n }\n\n #toggleState() {\n if (this.disabled) return; // Prevent toggle if disabled\n\n this.dispatchEvent(\n new CustomEvent('item-show-candidate-correction', {\n detail: !this.shown,\n bubbles: true\n })\n );\n }\n\n #getDisplayedText(): string {\n return this.disabled\n ? this.noCorrectResponseText\n : this.shown\n ? this.hideCandidateCorrectionText\n : this.showCandidateCorrectionText;\n }\n\n override render() {\n return html` <div @click=\"${this.#toggleState}\">${this.#getDisplayedText()}</div> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-show-candidate-correction': ItemShowCandidateCorrection;\n }\n}\n","import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { computedItemContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { ComputedItemContext } from '@qti-components/base';\n\n@customElement('item-show-correct-response')\nexport class ItemShowCorrectResponse extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n public computedContext?: ComputedItemContext;\n\n static override styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n @property({ type: Boolean, reflect: true }) shown = false;\n @property({ type: Boolean, reflect: true }) disabled = false; // Reflects to `disabled` attribute\n @property({ type: String }) showCorrectText = 'Show correct response';\n @property({ type: String }) hideCorrectText = 'Hide correct response';\n @property({ type: String }) noCorrectResponseText = 'No correct response specified';\n\n #hasCorrectResponse = false; // correct response is removed on certain point\n #previousActiveItem = ''; // Store previous active item reference\n\n override updated() {\n if (!this.#hasCorrectResponse || this.#previousActiveItem !== this.computedContext?.identifier) {\n this.#previousActiveItem = this.computedContext?.identifier;\n const containsCorrectResponse = !!this.computedContext?.variables.some(v => (v as any)['correctResponse']);\n const containsMapping = !!this.computedContext?.variables.some(v => {\n return (v as any)['mapping']?.mapEntries?.length > 0 || (v as any)['areaMapping']?.areaMapEntries?.length > 0;\n });\n this.#hasCorrectResponse = containsCorrectResponse || containsMapping;\n }\n this.disabled = !this.#hasCorrectResponse;\n }\n\n #toggleState() {\n if (this.disabled) return; // Prevent toggle if disabled\n\n this.dispatchEvent(\n new CustomEvent('item-show-correct-response', {\n detail: !this.shown,\n bubbles: true\n })\n );\n }\n\n #getDisplayedText(): string {\n return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;\n }\n\n override render() {\n return html` <div @click=\"${this.#toggleState}\">${this.#getDisplayedText()}</div> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-show-correct-response': ItemShowCorrectResponse;\n }\n}\n","import { consume } from '@lit/context';\nimport { css, html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport { computedItemContext } from '@qti-components/base';\n\nimport type { ResponseVariable } from '@qti-components/base';\nimport type { ComputedItemContext } from '@qti-components/base';\n\n@customElement('item-print-variables')\nexport class ItemPrintVariables extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n protected computedContext?: ComputedItemContext;\n\n static override styles = css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin: 20px 0;\n font-size: 14px;\n text-align: left;\n }\n th,\n td {\n border: 1px solid #ddd;\n padding: 8px;\n }\n th {\n background-color: #f4f4f4;\n font-weight: bold;\n }\n h3 {\n margin-top: 20px;\n font-size: 16px;\n }\n `;\n\n override render() {\n const activeItem = this.computedContext;\n\n if (!activeItem || !activeItem.variables) return html``;\n\n const responseVariables: ResponseVariable[] = activeItem.variables.filter(v => v.type === 'response');\n const outcomeVariables = activeItem.variables.filter(v => v.type === 'outcome');\n\n const renderTable = (variables: ResponseVariable[], title: string) => html`\n <h3>${title}</h3>\n <table>\n <thead>\n <tr>\n <th>Identifier</th>\n <th>Value</th>\n <th>Cardinality</th>\n <th>Base Type</th>\n <th>Correct Response / Mappings</th>\n </tr>\n </thead>\n <tbody>\n ${variables.map(v => {\n const correctResponse = v.correctResponse\n ? Array.isArray(v.correctResponse)\n ? v.correctResponse.join(', ')\n : v.correctResponse\n : '';\n\n const mapEntries = v.mapping?.mapEntries?.map(m => `${m.mapKey}=${m.mappedValue}pt`).join(', ') || '';\n\n const areaMapEntries =\n v.areaMapping?.areaMapEntries?.map(m => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(', ') || '';\n\n return html`\n <tr>\n <td>${v.identifier}</td>\n <td>${Array.isArray(v.value) ? v.value.join(', ') : v.value}</td>\n <td>${v.cardinality}</td>\n <td>${v.baseType}</td>\n <td>${correctResponse || mapEntries || areaMapEntries}</td>\n </tr>\n `;\n })}\n </tbody>\n </table>\n `;\n\n return html`\n ${renderTable(responseVariables, 'Response Variables')} ${renderTable(outcomeVariables, 'Outcome Variables')}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-print-variables': ItemPrintVariables;\n }\n}\n","import { provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\n\nimport { computedItemContext } from '@qti-components/base';\nimport { configContext } from '@qti-components/base';\nimport { qtiContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { ConfigContext, CorrectResponseMode } from '@qti-components/base';\nimport type { QtiContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\nimport type { VariableDeclaration } from '@qti-components/base';\nimport type { ComputedItemContext } from '@qti-components/base';\n\n/**\n * `<qti-item>` is a custom element designed for rendering a single `qti-assessment-item`.\n * It can also host some functionalities to interact with the item like scoring, showing feedback, etc.\n * Placing a mandatory `<item-container>` inside '<qti-item>' will load or parse the item and render it.\n * See `<item-container>` for more details.\n *\n * ```html\n * <qti-item>\n * <item-container class=\"m-4 bg-white\" item-url=\"./path/to/item.xml\"></item-container>\n * </qti-item>\n * ```\n */\n@customElement('qti-item')\nexport class QtiItem extends LitElement {\n @state()\n @provide({ context: computedItemContext })\n public computedContext: ComputedItemContext;\n #qtiAssessmentItem?: QtiAssessmentItem;\n\n @state()\n @provide({ context: configContext })\n public configContext: ConfigContext = {};\n\n /**\n * Provided so that descendants (e.g. `<item-container>`) can read the QTI runtime\n * context for standalone item delivery, including the optional shuffle `seed`.\n */\n @state()\n @provide({ context: qtiContext })\n public qtiContext: QtiContext = {\n QTI_CONTEXT: {\n testIdentifier: '',\n candidateIdentifier: '',\n environmentIdentifier: 'default'\n }\n };\n\n // Store event handlers as instance properties\n #onItemContextChanged = this.#handleItemContextChanged.bind(this);\n #onAssessmentItemConnected = this.#handleAssessmentItemConnected.bind(this);\n\n #onHandleShowCorrectResponse = this.#handleShowCorrectResponse.bind(this);\n #onHandleShowCandidateCorrection = this.#handleShowCandidateCorrection.bind(this);\n #onHandleSwitchCorrectResponseMode = this.#handleSwitchCorrectResponseMode.bind(this);\n\n constructor() {\n super();\n this.addEventListener('qti-item-context-updated', this.#onItemContextChanged);\n this.addEventListener('qti-assessment-item-connected', this.#onAssessmentItemConnected);\n this.addEventListener('item-show-correct-response', this.#onHandleShowCorrectResponse);\n this.addEventListener('item-show-candidate-correction', this.#onHandleShowCandidateCorrection);\n this.addEventListener('item-switch-correct-response-mode', this.#onHandleSwitchCorrectResponseMode);\n }\n\n #handleItemContextChanged(e: CustomEvent<{ itemContext: ItemContext }>) {\n this.#updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail?.itemContext?.variables || []);\n }\n\n #handleAssessmentItemConnected(e: CustomEvent<QtiAssessmentItem>) {\n const fullVariables = (e.detail as any)._context.variables;\n this.#qtiAssessmentItem = e.detail;\n this.computedContext =\n this.computedContext?.identifier === this.#qtiAssessmentItem.identifier\n ? { ...this.computedContext, title: this.#qtiAssessmentItem.title }\n : ({\n identifier: this.#qtiAssessmentItem.identifier,\n title: this.#qtiAssessmentItem.title,\n adaptive: this.#qtiAssessmentItem.getAttribute('adaptive')?.toLowerCase() === 'true' || false,\n variables: fullVariables,\n correctResponseMode: 'internal'\n } as ComputedItemContext);\n this.#updateItemVariablesInTestContext(this.#qtiAssessmentItem.identifier, fullVariables || []);\n }\n\n #handleShowCorrectResponse(e: CustomEvent<boolean>) {\n if (this.#qtiAssessmentItem) {\n this.#qtiAssessmentItem.showCorrectResponse(e.detail);\n }\n }\n\n #handleShowCandidateCorrection(e: CustomEvent<boolean>) {\n if (this.#qtiAssessmentItem) {\n this.#qtiAssessmentItem.showCandidateCorrection(e.detail);\n }\n }\n\n #handleSwitchCorrectResponseMode(e: CustomEvent<CorrectResponseMode>) {\n // Switch off the correct response first\n this.#handleShowCorrectResponse(new CustomEvent('item-show-correct-response', { detail: false, bubbles: true }));\n\n this.configContext = {\n ...this.configContext,\n correctResponseMode: e.detail\n };\n }\n\n #updateItemVariablesInTestContext(\n identifier: string,\n variables: readonly VariableDeclaration<string | string[] | null>[]\n ): void {\n const rawscore = variables?.find(vr => vr.identifier == 'SCORE')?.value;\n const score = parseFloat(rawscore?.toString());\n const completionStatus = variables?.find(v => v.identifier === 'completionStatus')?.value;\n\n const correct = score !== undefined && !isNaN(score) && score > 0;\n const incorrect = score !== undefined && !isNaN(score) && score <= 0;\n const completed = completionStatus === 'completed';\n this.computedContext = {\n ...this.computedContext,\n identifier,\n correct,\n incorrect,\n completed,\n variables\n };\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('qti-item-context-changed', this.#onItemContextChanged);\n this.removeEventListener('qti-assessment-item-connected', this.#onAssessmentItemConnected);\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-item': QtiItem;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AA6BO,IAAM,gBAAN,cAA4BA,GAAW;AAAA,EAAvC;AAAA;AAAA;AAGL,mBAAkB;AAIlB,mBAA4B;AAI5B,mBAAkB;AAIlB,SAAU,aAAyB;AAAA,MACjC,aAAa,EAAE,gBAAgB,IAAI,qBAAqB,IAAI,uBAAuB,UAAU;AAAA,IAC/F;AAGA;AAAA,yCAA4B;AAAA;AAAA,EAG5B,MAAgB,sBAAsB;AACpC,QAAI,CAAC,KAAK,QAAS;AACnB,QAAI;AACF,YAAM,eAAe,KAAK,YAAY,aAAa;AACnD,YAAM,OAAO,MAAM,iBAAiB,EAAE,KAAK,KAAK,OAAO,GAAG,oBAAoB,YAAY;AAC1F,WAAK,UAAU,IAAI,QAAQ;AAAA,IAC7B,SAAS,OAAO;AACd,cAAQ,MAAM,iCAAiC,KAAK;AAAA,IACtD;AAAA,EACF;AAAA,EAGU,sBAAsB;AAC9B,QAAI,CAAC,KAAK,QAAS;AACnB,QAAI;AACF,WAAK,UAAU,iBAAiB,EAAE,MAAM,KAAK,OAAO,EAAE,QAAQ;AAAA,IAChE,SAAS,OAAO;AACd,cAAQ,MAAM,sBAAsB,KAAK;AAAA,IAC3C;AAAA,EACF;AAAA,EAEA,MAAe,oBAAmC;AAChD,UAAM,kBAAkB;AACxB,0BAAK,wDAAL;AACA,0BAAK,0CAAL;AACA,QAAI,KAAK,SAAS;AAChB,WAAK,oBAAoB;AAAA,IAC3B;AACA,QAAI,KAAK,SAA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