@qti-components/elements 1.6.2 → 1.6.4

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 (48) hide show
  1. package/dist/components/qti-assessment-item/qti-assessment-item.d.ts +13 -10
  2. package/dist/components/qti-assessment-item/qti-assessment-item.js +107 -49
  3. package/dist/components/qti-assessment-item/qti-assessment-item.js.map +1 -1
  4. package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js +3 -7
  5. package/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js.map +1 -1
  6. package/dist/components/qti-companion-materials-info/qti-companion-materials-info.js +2 -13
  7. package/dist/components/qti-companion-materials-info/qti-companion-materials-info.js.map +1 -1
  8. package/dist/components/qti-content-body/qti-content-body.d.ts +5 -0
  9. package/dist/components/qti-content-body/qti-content-body.js +58 -8
  10. package/dist/components/qti-content-body/qti-content-body.js.map +1 -1
  11. package/dist/components/qti-context-declaration/qti-context-declaration.js +3 -7
  12. package/dist/components/qti-context-declaration/qti-context-declaration.js.map +1 -1
  13. package/dist/components/qti-custom-operator/qti-custom-operator.js +3 -7
  14. package/dist/components/qti-custom-operator/qti-custom-operator.js.map +1 -1
  15. package/dist/components/qti-feedback-block/qti-feedback-block.js +2 -13
  16. package/dist/components/qti-feedback-block/qti-feedback-block.js.map +1 -1
  17. package/dist/components/qti-feedback-inline/qti-feedback-inline.js +2 -13
  18. package/dist/components/qti-feedback-inline/qti-feedback-inline.js.map +1 -1
  19. package/dist/components/qti-item-body/qti-item-body.js +2 -13
  20. package/dist/components/qti-item-body/qti-item-body.js.map +1 -1
  21. package/dist/components/qti-modal-feedback/qti-modal-feedback.js +12 -24
  22. package/dist/components/qti-modal-feedback/qti-modal-feedback.js.map +1 -1
  23. package/dist/components/qti-outcome-declaration/qti-outcome-declaration.js +3 -7
  24. package/dist/components/qti-outcome-declaration/qti-outcome-declaration.js.map +1 -1
  25. package/dist/components/qti-response-declaration/qti-response-declaration.js +3 -7
  26. package/dist/components/qti-response-declaration/qti-response-declaration.js.map +1 -1
  27. package/dist/components/qti-response-processing/qti-response-processing.js +2 -13
  28. package/dist/components/qti-response-processing/qti-response-processing.js.map +1 -1
  29. package/dist/components/qti-rubric-block/qti-rubric-block.js +3 -7
  30. package/dist/components/qti-rubric-block/qti-rubric-block.js.map +1 -1
  31. package/dist/components/qti-stylesheet/qti-stylesheet.js +2 -13
  32. package/dist/components/qti-stylesheet/qti-stylesheet.js.map +1 -1
  33. package/dist/components/qti-template-constraint/qti-template-constraint.js +2 -13
  34. package/dist/components/qti-template-constraint/qti-template-constraint.js.map +1 -1
  35. package/dist/components/qti-template-declaration/qti-template-declaration.js +3 -7
  36. package/dist/components/qti-template-declaration/qti-template-declaration.js.map +1 -1
  37. package/dist/components/qti-template-processing/qti-template-processing.js +2 -13
  38. package/dist/components/qti-template-processing/qti-template-processing.js.map +1 -1
  39. package/dist/elements.d.ts +74 -0
  40. package/dist/elements.js +40 -0
  41. package/dist/elements.js.map +1 -0
  42. package/dist/index.d.ts +3 -0
  43. package/dist/index.js +3 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/register.d.ts +1 -0
  46. package/dist/register.js +7 -0
  47. package/dist/register.js.map +1 -0
  48. package/package.json +22 -5
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  import type { ResponseInteraction } from '@qti-components/base';
3
+ import type { RegisteredInteraction } from '@qti-components/base';
3
4
  import type { VariableDeclaration, VariableValue } from '@qti-components/base';
4
5
  import type { OutcomeVariable, ResponseVariable } from '@qti-components/base';
5
6
  import type { ItemContext } from '@qti-components/base';
@@ -36,26 +37,20 @@ export declare class QtiAssessmentItem extends LitElement {
36
37
  set variables(value: VariableValue<string | string[] | null>[]);
37
38
  get state(): ItemContext['state'];
38
39
  set state(value: ItemContext['state']);
40
+ /** Registered candidate-input interactions. Correction packages may extend their presentation behavior. */
41
+ protected interactionElements: RegisteredInteraction[];
39
42
  /** @deprecated use variables property instead */
40
43
  set responses(myResponses: ResponseInteraction[]);
41
44
  render(): import("lit").TemplateResult<1>;
42
45
  connectedCallback(): void;
43
46
  disconnectedCallback(): void;
44
- /**
45
- * Toggles the display of correct responses for all interactions.
46
- * @param show - A boolean indicating whether to show or hide correct responses.
47
- */
48
- showCorrectResponse(show: boolean): void;
49
- /**
50
- * Toggles the display of the candidate correction for all interactions.
51
- * @param show - A boolean indicating whether to show or hide candidate correction.
52
- */
53
- showCandidateCorrection(show: boolean): void;
54
47
  processResponse(countNumAttempts?: boolean, reportValidityAfterScoring?: boolean): boolean;
55
48
  resetResponses(): void;
56
49
  protected getResponse(identifier: string): Readonly<ResponseVariable>;
57
50
  getOutcome(identifier: string): Readonly<OutcomeVariable>;
58
51
  protected getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>>;
52
+ /** Extension point for presentation packages reacting to a candidate response change. */
53
+ protected afterResponseVariableUpdated(): void;
59
54
  /**
60
55
  * Updates the response variable with the specified identifier to the given value.
61
56
  *
@@ -68,6 +63,14 @@ export declare class QtiAssessmentItem extends LitElement {
68
63
  * @param value - The new value for the response variable.
69
64
  */
70
65
  updateResponseVariable(identifier: string, value: string | string[] | undefined): void;
66
+ /**
67
+ * Updates the template variable with the specified identifier to the given value.
68
+ */
69
+ updateTemplateVariable(identifier: string, value: string | string[] | undefined): void;
70
+ /**
71
+ * Updates the correct response for the specified response variable.
72
+ */
73
+ updateCorrectResponse(identifier: string, value: string | string[] | undefined): void;
71
74
  setOutcomeVariable(identifier: string, value: string | string[] | undefined): void;
72
75
  /**
73
76
  * Updates the outcome variable with the specified identifier to the given value.
@@ -6,11 +6,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { provide } from '@lit/context';
8
8
  import { LitElement, html } from 'lit';
9
- import { customElement, property } from 'lit/decorators.js';
9
+ import { property } from 'lit/decorators.js';
10
10
  import { itemContext, itemContextVariables } from '@qti-components/base';
11
11
  import { watch } from '@qti-components/utilities';
12
- // import type { ItemShowCandidateCorrection } from '../../qti-item/components/item-show-candidate-correction.ts';
13
- // import type { ItemShowCorrectResponse } from '../../qti-item/components/item-show-correct-response.ts';
14
12
  /**
15
13
  * @summary The qti-assessment-item element contains all the other QTI 3 item structures.
16
14
  * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.dltnnj87l0yj
@@ -21,7 +19,7 @@ import { watch } from '@qti-components/utilities';
21
19
  * @event qti-item-context-updated - Emitted when through a user action the itemContext is updated,
22
20
  * typically on interaction with the interactions, or calling response processing.
23
21
  */
24
- let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
22
+ export class QtiAssessmentItem extends LitElement {
25
23
  constructor() {
26
24
  super(...arguments);
27
25
  this.#templateProcessing = null;
@@ -29,15 +27,16 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
29
27
  this.adaptive = 'false';
30
28
  this.timeDependent = null;
31
29
  this._handleDisabledChange = (_, disabled) => {
32
- this.#interactionElements.forEach(ch => (ch.disabled = disabled));
30
+ this.interactionElements.forEach(ch => (ch.disabled = disabled));
33
31
  };
34
- this._handleReadonlyChange = (_, readonly) => this.#interactionElements.forEach(ch => (ch.readonly = readonly));
32
+ this._handleReadonlyChange = (_, readonly) => this.interactionElements.forEach(ch => (ch.readonly = readonly));
35
33
  this._context = {
36
34
  variables: itemContextVariables
37
35
  };
38
36
  this.#initialContext = { ...this._context, variables: this._context.variables };
39
37
  this.#feedbackElements = [];
40
- this.#interactionElements = [];
38
+ /** Registered candidate-input interactions. Correction packages may extend their presentation behavior. */
39
+ this.interactionElements = [];
41
40
  this.#handleRegisterVariable = (e) => {
42
41
  e.stopImmediatePropagation();
43
42
  this._context = { ...this._context, variables: [...this._context.variables, e.detail.variable] };
@@ -55,7 +54,7 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
55
54
  };
56
55
  this.#handleRegisterInteraction = (e) => {
57
56
  e.stopImmediatePropagation();
58
- this.#interactionElements.push(e.detail.interactionElement);
57
+ this.interactionElements.push(e.detail.interactionElement);
59
58
  };
60
59
  this.#handleEndAttempt = (e) => {
61
60
  e.stopImmediatePropagation();
@@ -70,6 +69,18 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
70
69
  this.updateOutcomeVariable(outcomeIdentifier, value);
71
70
  e.stopPropagation();
72
71
  };
72
+ this.#handleSetTemplateValue = (e) => {
73
+ e.stopImmediatePropagation();
74
+ const { templateIdentifier, value } = e.detail;
75
+ this.updateTemplateVariable(templateIdentifier, value ?? undefined);
76
+ e.stopPropagation();
77
+ };
78
+ this.#handleSetCorrectResponse = (e) => {
79
+ e.stopImmediatePropagation();
80
+ const { responseIdentifier, value } = e.detail;
81
+ this.updateCorrectResponse(responseIdentifier, value ?? undefined);
82
+ e.stopPropagation();
83
+ };
73
84
  this.#handleUpdateResponseVariable = (e) => {
74
85
  e.stopImmediatePropagation();
75
86
  const { responseIdentifier, response, state } = e.detail;
@@ -143,7 +154,7 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
143
154
  };
144
155
  this._context.variables.forEach(variable => {
145
156
  if (variable.type === 'response') {
146
- const interactionElement = this.#interactionElements.find((el) => el.responseIdentifier === variable.identifier);
157
+ const interactionElement = this.interactionElements.find((el) => el.responseIdentifier === variable.identifier);
147
158
  if (interactionElement) {
148
159
  interactionElement.response = variable.value;
149
160
  }
@@ -166,7 +177,6 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
166
177
  }
167
178
  #initialContext;
168
179
  #feedbackElements;
169
- #interactionElements;
170
180
  /** @deprecated use variables property instead */
171
181
  set responses(myResponses) {
172
182
  if (myResponses) {
@@ -175,7 +185,7 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
175
185
  if (responseVariable) {
176
186
  this.updateResponseVariable(response.responseIdentifier, response.response);
177
187
  }
178
- const interaction = this.#interactionElements.find(i => i.getAttribute('response-identifier') === response.responseIdentifier);
188
+ const interaction = this.interactionElements.find(i => i.getAttribute('response-identifier') === response.responseIdentifier);
179
189
  if (interaction) {
180
190
  interaction.response = response.response;
181
191
  }
@@ -207,6 +217,8 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
207
217
  this.addEventListener('qti-register-interaction', this.#handleRegisterInteraction);
208
218
  this.addEventListener('end-attempt', this.#handleEndAttempt);
209
219
  this.addEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);
220
+ this.addEventListener('qti-set-template-value', this.#handleSetTemplateValue);
221
+ this.addEventListener('qti-set-correct-response', this.#handleSetCorrectResponse);
210
222
  this.addEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);
211
223
  }
212
224
  #removeEventListeners() {
@@ -215,6 +227,8 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
215
227
  this.removeEventListener('qti-register-interaction', this.#handleRegisterInteraction);
216
228
  this.removeEventListener('end-attempt', this.#handleEndAttempt);
217
229
  this.removeEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);
230
+ this.removeEventListener('qti-set-template-value', this.#handleSetTemplateValue);
231
+ this.removeEventListener('qti-set-correct-response', this.#handleSetCorrectResponse);
218
232
  this.removeEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);
219
233
  }
220
234
  #handleRegisterVariable;
@@ -222,40 +236,20 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
222
236
  #handleRegisterInteraction;
223
237
  #handleEndAttempt;
224
238
  #handleSetOutcomeValue;
239
+ #handleSetTemplateValue;
240
+ #handleSetCorrectResponse;
225
241
  #handleUpdateResponseVariable;
226
- /**
227
- * Toggles the display of correct responses for all interactions.
228
- * @param show - A boolean indicating whether to show or hide correct responses.
229
- */
230
- showCorrectResponse(show) {
231
- // Iterate through all interaction elements
232
- for (const interaction of this.#interactionElements) {
233
- interaction.toggleCorrectResponse(show);
234
- }
235
- // Update one or more toggle component states // ItemShowCorrectResponse
236
- document.querySelectorAll('item-show-correct-response').forEach((el) => {
237
- el.shown = show;
238
- });
239
- }
240
- /**
241
- * Toggles the display of the candidate correction for all interactions.
242
- * @param show - A boolean indicating whether to show or hide candidate correction.
243
- */
244
- showCandidateCorrection(show) {
245
- // Iterate through all interaction elements
246
- for (const interaction of this.#interactionElements) {
247
- interaction.toggleCandidateCorrection(show);
242
+ async #processTemplates() {
243
+ const templateDeclarations = Array.from(this.querySelectorAll('qti-template-declaration'));
244
+ if (templateDeclarations.length > 0) {
245
+ await Promise.all(templateDeclarations.map(declaration => declaration.updateComplete));
246
+ await Promise.resolve();
248
247
  }
249
- // Update one or more toggle component states // ItemShowCandidateCorrection
250
- document.querySelectorAll('item-show-candidate-correction').forEach((el) => {
251
- el.shown = show;
252
- });
253
- }
254
- #processTemplates() {
255
248
  this.#templateProcessing = this.querySelector('qti-template-processing');
256
249
  if (this.#templateProcessing) {
257
250
  // Run template processing before first presentation
258
251
  this.#templateProcessing.process();
252
+ this.#initialContext = { ...this._context, variables: this._context.variables };
259
253
  }
260
254
  }
261
255
  processResponse(countNumAttempts = true, reportValidityAfterScoring = true) {
@@ -294,6 +288,8 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
294
288
  getVariable(identifier) {
295
289
  return this._context.variables.find(v => v.identifier === identifier) || null;
296
290
  }
291
+ /** Extension point for presentation packages reacting to a candidate response change. */
292
+ afterResponseVariableUpdated() { }
297
293
  // saving privates here: ------------------------------------------------------------------------------
298
294
  /**
299
295
  * Updates the response variable with the specified identifier to the given value.
@@ -311,8 +307,7 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
311
307
  ...this._context,
312
308
  variables: this._context.variables.map(v => (v.identifier !== identifier ? v : { ...v, value: value }))
313
309
  };
314
- // Turn off candidate correction after change of response variable
315
- this.showCandidateCorrection(false);
310
+ this.afterResponseVariableUpdated();
316
311
  this.dispatchEvent(new CustomEvent('qti-interaction-changed', {
317
312
  bubbles: true,
318
313
  composed: true,
@@ -327,6 +322,72 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
327
322
  this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());
328
323
  }
329
324
  }
325
+ /**
326
+ * Updates the template variable with the specified identifier to the given value.
327
+ */
328
+ updateTemplateVariable(identifier, value) {
329
+ const templateVariable = this._context.variables.find(v => v.identifier === identifier && v.type === 'template');
330
+ if (!templateVariable) {
331
+ console.warn(`Can not set qti-template-identifier: ${identifier}, it is not available`);
332
+ return;
333
+ }
334
+ const normalizedValue = templateVariable.cardinality === 'single'
335
+ ? Array.isArray(value)
336
+ ? value[0]
337
+ : (value ?? null)
338
+ : value === undefined || value === null
339
+ ? null
340
+ : Array.isArray(value)
341
+ ? value
342
+ : [value];
343
+ this._context = {
344
+ ...this._context,
345
+ variables: this._context.variables.map(v => v.identifier !== identifier
346
+ ? v
347
+ : {
348
+ ...v,
349
+ value: normalizedValue
350
+ })
351
+ };
352
+ this.dispatchEvent(new CustomEvent('qti-item-context-updated', {
353
+ bubbles: true,
354
+ composed: true,
355
+ detail: { itemContext: this._context }
356
+ }));
357
+ }
358
+ /**
359
+ * Updates the correct response for the specified response variable.
360
+ */
361
+ updateCorrectResponse(identifier, value) {
362
+ const responseVariable = this.getResponse(identifier);
363
+ if (!responseVariable) {
364
+ console.warn(`Can not set correct response for identifier: ${identifier}, it is not available`);
365
+ return;
366
+ }
367
+ const normalizedValue = responseVariable.cardinality === 'single'
368
+ ? Array.isArray(value)
369
+ ? value[0]
370
+ : (value ?? null)
371
+ : value === undefined || value === null
372
+ ? null
373
+ : Array.isArray(value)
374
+ ? value
375
+ : [value];
376
+ this._context = {
377
+ ...this._context,
378
+ variables: this._context.variables.map(v => v.identifier !== identifier
379
+ ? v
380
+ : {
381
+ ...v,
382
+ correctResponse: normalizedValue
383
+ })
384
+ };
385
+ this.dispatchEvent(new CustomEvent('qti-item-context-updated', {
386
+ bubbles: true,
387
+ composed: true,
388
+ detail: { itemContext: this._context }
389
+ }));
390
+ }
330
391
  setOutcomeVariable(identifier, value) {
331
392
  this.updateOutcomeVariable(identifier, value);
332
393
  this.dispatchEvent(new CustomEvent('qti-item-context-updated', {
@@ -376,14 +437,14 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
376
437
  }));
377
438
  }
378
439
  validate(reportValidity = true) {
379
- const isValid = this.#interactionElements.every(interactionElement => interactionElement.validate());
440
+ const isValid = this.interactionElements.every(interactionElement => interactionElement.validate());
380
441
  if (reportValidity) {
381
442
  this.reportValidity();
382
443
  }
383
444
  return isValid;
384
445
  }
385
446
  reportValidity() {
386
- for (const interactionElement of this.#interactionElements) {
447
+ for (const interactionElement of this.interactionElements) {
387
448
  interactionElement.reportValidity();
388
449
  }
389
450
  }
@@ -405,7 +466,8 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
405
466
  const hasDefaultValue = 'defaultValue' in variable;
406
467
  const declaredDefault = hasDefaultValue ? variable.defaultValue : null;
407
468
  let value = declaredDefault ?? null;
408
- if ((value === null || value === undefined) && (variable.baseType === 'integer' || variable.baseType === 'float')) {
469
+ if ((value === null || value === undefined) &&
470
+ (variable.baseType === 'integer' || variable.baseType === 'float')) {
409
471
  value = '0';
410
472
  }
411
473
  return {
@@ -415,7 +477,7 @@ let QtiAssessmentItem = class QtiAssessmentItem extends LitElement {
415
477
  })
416
478
  };
417
479
  }
418
- };
480
+ }
419
481
  __decorate([
420
482
  property({ type: String })
421
483
  ], QtiAssessmentItem.prototype, "identifier", void 0);
@@ -443,8 +505,4 @@ __decorate([
443
505
  __decorate([
444
506
  provide({ context: itemContext })
445
507
  ], QtiAssessmentItem.prototype, "_context", void 0);
446
- QtiAssessmentItem = __decorate([
447
- customElement('qti-assessment-item')
448
- ], QtiAssessmentItem);
449
- export { QtiAssessmentItem };
450
508
  //# sourceMappingURL=qti-assessment-item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"qti-assessment-item.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-item/qti-assessment-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,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AAC,CAAC,CAAC,IAAI,CAAC;gBAEvE,IAAI,KAAK,GAAG,eAAe,IAAI,IAAI,CAAC;gBACpC,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,QAAQ,KAAK,OAAO,CAAC,EAAE,CAAC;oBAClH,KAAK,GAAG,GAAG,CAAC;gBACd,CAAC;gBAED,OAAO;oBACL,GAAG,QAAQ;oBACX,KAAK;iBACN,CAAC;YACJ,CAAC,CAAC;SACH,CAAC;IACJ,CAAC;CACF,CAAA;AAhd6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAyB;AACxB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAsC;AACrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA+C;AAG1E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAG1B;AAO4B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAmB;AAErC;IADT,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;gEAGhD;AAE2B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAmB;AAErC;IADT,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;gEAEkB;AAG5D;IADP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;mDAGhC;AAhCS,iBAAiB;IAD7B,aAAa,CAAC,qBAAqB,CAAC;GACxB,iBAAiB,CAod7B","sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { itemContext, itemContextVariables } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\n\nimport type { QtiTemplateProcessing } from '../qti-template-processing/qti-template-processing.js';\nimport type { InteractionChangedDetails, OutcomeChangedDetails } from '../../internal/event-types.ts';\nimport type { QtiFeedback, ResponseInteraction } from '@qti-components/base';\nimport type { VariableDeclaration, VariableValue } from '@qti-components/base';\nimport type { OutcomeVariable, ResponseVariable } from '@qti-components/base';\nimport type { QtiResponseProcessing } from '../qti-response-processing/qti-response-processing.ts';\nimport type QtiRegisterVariable from '../../internal/events/qti-register-variable.ts';\nimport type { ItemContext } from '@qti-components/base';\nimport type { Interaction } from '@qti-components/base';\n// import type { ItemShowCandidateCorrection } from '../../qti-item/components/item-show-candidate-correction.ts';\n// import type { ItemShowCorrectResponse } from '../../qti-item/components/item-show-correct-response.ts';\n\n/**\n * @summary The qti-assessment-item element contains all the other QTI 3 item structures.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.dltnnj87l0yj\n *\n * @dependency qti-feedback\n * @dependency qti-responseprocessing\n *\n * @event qti-item-context-updated - Emitted when through a user action the itemContext is updated,\n * typically on interaction with the interactions, or calling response processing.\n */\n@customElement('qti-assessment-item')\nexport class QtiAssessmentItem extends LitElement {\n #itemTitle: string | undefined;\n #templateProcessing: QtiTemplateProcessing | null = null;\n\n @property({ type: String }) identifier: string = '';\n @property({ type: String }) adaptive: 'true' | 'false' = 'false';\n @property({ type: String }) timeDependent: 'true' | 'false' | null = null;\n\n @property({ type: String })\n override get title(): string {\n return this.#itemTitle;\n }\n override set title(value: string) {\n this.#itemTitle = value;\n this.removeAttribute('title');\n this.setAttribute('data-title', value);\n }\n\n @property({ type: Boolean }) disabled: boolean;\n @watch('disabled', { waitUntilFirstUpdate: true })\n protected _handleDisabledChange = (_: boolean, disabled: boolean) => {\n this.#interactionElements.forEach(ch => (ch.disabled = disabled));\n };\n\n @property({ type: Boolean }) readonly: boolean;\n @watch('readonly', { waitUntilFirstUpdate: true })\n protected _handleReadonlyChange = (_: boolean, readonly: boolean) =>\n this.#interactionElements.forEach(ch => (ch.readonly = readonly));\n\n @provide({ context: itemContext })\n private _context: ItemContext = {\n variables: itemContextVariables\n };\n\n /**\n * Sets the identifier for the assessment item reference if this item is in a test.\n *\n * @param identifier - The identifier for the assessment item reference.\n */\n public set assessmentItemRefId(identifier: string) {\n this._context = { ...this._context, identifier };\n }\n\n public get assessmentItemRefId(): string {\n return this._context.identifier;\n }\n\n public get variables(): VariableValue<string | string[] | null>[] {\n return this._context.variables.map(v => ({\n identifier: v.identifier,\n value: v.value,\n type: v.type,\n // add externalscored, a fixed prop to the test, so the testcontext can read and decide how to score this item\n ...(v.type === 'outcome' && v.identifier === 'SCORE'\n ? { externalScored: (v as OutcomeVariable).externalScored }\n : {})\n }));\n }\n\n public set variables(value: VariableValue<string | string[] | null>[]) {\n if (!Array.isArray(value) || value.some(v => !('identifier' in v))) {\n console.warn('variables property should be an array of VariableDeclaration');\n return;\n }\n this._context = {\n ...this._context,\n variables: this._context.variables.map(variable => {\n const matchingValue = value.find(v => v.identifier === variable.identifier);\n if (matchingValue) {\n return {\n ...variable,\n ...matchingValue,\n interpolationTable: (variable as OutcomeVariable).interpolationTable\n };\n }\n return variable;\n })\n };\n\n this._context.variables.forEach(variable => {\n if (variable.type === 'response') {\n const interactionElement = this.#interactionElements.find(\n (el: Interaction) => el.responseIdentifier === variable.identifier\n );\n if (interactionElement) {\n interactionElement.response = variable.value as string | string[];\n }\n }\n });\n\n this.variables.forEach(variable => {\n if (variable.type === 'outcome') {\n this.#feedbackElements.forEach(fe => fe.checkShowFeedback(variable.identifier));\n }\n });\n }\n\n public get state(): ItemContext['state'] {\n return this._context.state;\n }\n\n public set state(value: ItemContext['state']) {\n this._context = {\n ...this._context,\n state: value ? { ...value } : undefined\n };\n }\n\n #initialContext: Readonly<ItemContext> = { ...this._context, variables: this._context.variables };\n #feedbackElements: QtiFeedback[] = [];\n #interactionElements: Interaction[] = [];\n\n /** @deprecated use variables property instead */\n set responses(myResponses: ResponseInteraction[]) {\n if (myResponses) {\n for (const response of myResponses) {\n const responseVariable = this.getResponse(response.responseIdentifier);\n if (responseVariable) {\n this.updateResponseVariable(response.responseIdentifier, response.response);\n }\n\n const interaction: Interaction | undefined = this.#interactionElements.find(\n i => i.getAttribute('response-identifier') === response.responseIdentifier\n );\n if (interaction) {\n interaction.response = response.response;\n }\n }\n }\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n override connectedCallback(): void {\n this.#attachEventListeners();\n super.connectedCallback();\n this.updateComplete.then(() => {\n this.dispatchEvent(\n new CustomEvent<QtiAssessmentItem>('qti-assessment-item-connected', {\n bubbles: true,\n composed: true,\n detail: this\n })\n );\n this.#processTemplates();\n });\n }\n\n override disconnectedCallback(): void {\n this.#removeEventListeners();\n super.disconnectedCallback();\n }\n\n #attachEventListeners() {\n this.addEventListener('qti-register-variable', this.#handleRegisterVariable);\n this.addEventListener('qti-register-feedback', this.#handleRegisterFeedback);\n this.addEventListener('qti-register-interaction', this.#handleRegisterInteraction);\n this.addEventListener('end-attempt', this.#handleEndAttempt);\n this.addEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);\n this.addEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);\n }\n\n #removeEventListeners() {\n this.removeEventListener('qti-register-variable', this.#handleRegisterVariable);\n this.removeEventListener('qti-register-feedback', this.#handleRegisterFeedback);\n this.removeEventListener('qti-register-interaction', this.#handleRegisterInteraction);\n this.removeEventListener('end-attempt', this.#handleEndAttempt);\n this.removeEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);\n this.removeEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);\n }\n\n #handleRegisterVariable = (e: QtiRegisterVariable) => {\n e.stopImmediatePropagation();\n this._context = { ...this._context, variables: [...this._context.variables, e.detail.variable] };\n this.#initialContext = this._context;\n e.stopPropagation();\n };\n\n #handleRegisterFeedback = (e: CustomEvent<QtiFeedback>) => {\n e.stopImmediatePropagation();\n const feedbackElement = e.detail;\n this.#feedbackElements.push(feedbackElement);\n const numAttempts = Number(this._context.variables.find(v => v.identifier === 'numAttempts')?.value) || 0;\n if (numAttempts > 0) {\n feedbackElement.checkShowFeedback(feedbackElement.outcomeIdentifier);\n }\n };\n\n #handleRegisterInteraction = (e: CustomEvent<{ interaction: string; interactionElement: Interaction }>) => {\n e.stopImmediatePropagation();\n this.#interactionElements.push(e.detail.interactionElement);\n };\n\n #handleEndAttempt = (e: CustomEvent<{ responseIdentifier: string; countAttempt: boolean }>) => {\n e.stopImmediatePropagation();\n const { responseIdentifier, countAttempt } = e.detail;\n this.validate();\n this.updateResponseVariable(responseIdentifier, 'true');\n this.processResponse(countAttempt);\n };\n\n #handleSetOutcomeValue = (e: CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>) => {\n e.stopImmediatePropagation();\n const { outcomeIdentifier, value } = e.detail;\n this.updateOutcomeVariable(outcomeIdentifier, value);\n e.stopPropagation();\n };\n\n #handleUpdateResponseVariable = (e: CustomEvent<ResponseInteraction>) => {\n e.stopImmediatePropagation();\n\n const { responseIdentifier, response, state } = e.detail;\n this.updateResponseVariable(responseIdentifier, response);\n if (state !== undefined) {\n this._context = {\n ...this._context,\n state: {\n ...(this._context.state || {}),\n [responseIdentifier]: state\n }\n };\n }\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n };\n\n /**\n * Toggles the display of correct responses for all interactions.\n * @param show - A boolean indicating whether to show or hide correct responses.\n */\n public showCorrectResponse(show: boolean): void {\n // Iterate through all interaction elements\n for (const interaction of this.#interactionElements) {\n interaction.toggleCorrectResponse(show);\n }\n\n // Update one or more toggle component states // ItemShowCorrectResponse\n document.querySelectorAll('item-show-correct-response').forEach((el: HTMLElement & { shown: boolean }) => {\n el.shown = show;\n });\n }\n\n /**\n * Toggles the display of the candidate correction for all interactions.\n * @param show - A boolean indicating whether to show or hide candidate correction.\n */\n public showCandidateCorrection(show: boolean): void {\n // Iterate through all interaction elements\n for (const interaction of this.#interactionElements) {\n interaction.toggleCandidateCorrection(show);\n }\n\n // Update one or more toggle component states // ItemShowCandidateCorrection\n document.querySelectorAll('item-show-candidate-correction').forEach((el: HTMLElement & { shown: boolean }) => {\n el.shown = show;\n });\n }\n\n #processTemplates(): void {\n this.#templateProcessing = this.querySelector<QtiTemplateProcessing>('qti-template-processing');\n if (this.#templateProcessing) {\n // Run template processing before first presentation\n this.#templateProcessing.process();\n }\n }\n\n public processResponse(countNumAttempts = true, reportValidityAfterScoring = true): boolean {\n this.validate(reportValidityAfterScoring);\n\n if (countNumAttempts) {\n this.updateOutcomeVariable(\n 'numAttempts',\n (+this._context.variables.find(v => v.identifier === 'numAttempts')?.value + 1).toString()\n );\n }\n\n if (this.adaptive === 'false') {\n this.#resetOutcomeVariablesBeforeResponseProcessing();\n }\n\n const responseProcessor = this.querySelector<QtiResponseProcessing>('qti-response-processing');\n const canProcess = !!(responseProcessor && typeof responseProcessor.process === 'function');\n if (canProcess) {\n responseProcessor.process();\n }\n if (this.adaptive === 'false') {\n // if adaptive, completionStatus is set by the processing template\n this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());\n }\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n\n return canProcess;\n }\n\n public resetResponses() {\n this._context = this.#initialContext;\n }\n\n protected getResponse(identifier: string): Readonly<ResponseVariable> {\n return this.getVariable(identifier) as ResponseVariable;\n }\n\n public getOutcome(identifier: string): Readonly<OutcomeVariable> {\n return this.getVariable(identifier) as OutcomeVariable;\n }\n\n protected getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>> {\n return this._context.variables.find(v => v.identifier === identifier) || null;\n }\n\n // saving privates here: ------------------------------------------------------------------------------\n\n /**\n * Updates the response variable with the specified identifier to the given value.\n *\n * @protected\n *\n * This method is intended for internal use within the class and subclasses.\n * It should not be called externally by third parties.\n *\n * @param identifier - The identifier of the response variable to update.\n * @param value - The new value for the response variable.\n */\n public updateResponseVariable(identifier: string, value: string | string[] | undefined) {\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v => (v.identifier !== identifier ? v : { ...v, value: value }))\n };\n\n // Turn off candidate correction after change of response variable\n this.showCandidateCorrection(false);\n\n this.dispatchEvent(\n new CustomEvent<InteractionChangedDetails>('qti-interaction-changed', {\n bubbles: true,\n composed: true,\n detail: {\n item: this.identifier,\n responseIdentifier: identifier,\n response: Array.isArray(value) ? [...value] : value\n }\n })\n );\n\n if (this.adaptive === 'false') {\n // if adaptive, completionStatus is set by the processing template\n this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());\n }\n }\n\n public setOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n this.updateOutcomeVariable(identifier, value);\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n /**\n * Updates the outcome variable with the specified identifier to the given value.\n *\n * @protected\n *\n * This method is intended for internal use within the class and subclasses.\n * It should not be called externally by third parties.\n *\n * @param identifier - The identifier of the response variable to update.\n * @param value - The new value for the response variable.\n */\n public updateOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n const outcomeVariable = this.getOutcome(identifier);\n\n if (!outcomeVariable) {\n console.warn(`Can not set qti-outcome-identifier: ${identifier}, it is not available`);\n return;\n }\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v => {\n if (v.identifier !== identifier) {\n return v;\n }\n return {\n ...v,\n value: outcomeVariable.cardinality === 'single' ? value : Array.isArray(value) ? value : [value]\n };\n })\n };\n this.#feedbackElements.forEach(fe => fe.checkShowFeedback(identifier));\n\n this.dispatchEvent(\n new CustomEvent<OutcomeChangedDetails>('qti-outcome-changed', {\n bubbles: true,\n composed: true,\n detail: {\n item: this.identifier,\n outcomeIdentifier: identifier,\n value: this._context.variables.find(v => v.identifier === identifier)?.value\n }\n })\n );\n }\n\n public validate(reportValidity = true): boolean {\n const isValid = this.#interactionElements.every(interactionElement => interactionElement.validate());\n\n if (reportValidity) {\n this.reportValidity();\n }\n\n return isValid;\n }\n\n public reportValidity() {\n for (const interactionElement of this.#interactionElements) {\n interactionElement.reportValidity();\n }\n }\n\n #getCompletionStatus(): 'completed' | 'incomplete' | 'not_attempted' | 'unknown' {\n const valid = this.validate(false);\n if (valid === true) return 'completed';\n if (valid === false) return 'incomplete';\n return 'not_attempted';\n }\n\n #resetOutcomeVariablesBeforeResponseProcessing(): void {\n this._context = {\n ...this._context,\n variables: this._context.variables.map(variable => {\n if (variable.type !== 'outcome') {\n return variable;\n }\n\n const hasDefaultValue = 'defaultValue' in variable;\n const declaredDefault = hasDefaultValue ? variable.defaultValue : null;\n\n let value = declaredDefault ?? null;\n if ((value === null || value === undefined) && (variable.baseType === 'integer' || variable.baseType === 'float')) {\n value = '0';\n }\n\n return {\n ...variable,\n value\n };\n })\n };\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-item': QtiAssessmentItem;\n }\n}\n"]}
1
+ {"version":3,"file":"qti-assessment-item.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-item/qti-assessment-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAYlD;;;;;;;;;GASG;AAEH,MAAM,OAAO,iBAAkB,SAAQ,UAAU;IAAjD;;QAEE,wBAAmB,GAAiC,IAAI,CAAC;QAE7B,eAAU,GAAW,EAAE,CAAC;QACxB,aAAQ,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,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;mDAGhC","sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { itemContext, itemContextVariables } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\n\nimport type { QtiTemplateProcessing } from '../qti-template-processing/qti-template-processing.js';\nimport type { InteractionChangedDetails, OutcomeChangedDetails } from '../../internal/event-types.ts';\nimport type { QtiFeedback, ResponseInteraction } from '@qti-components/base';\nimport type { RegisteredInteraction } from '@qti-components/base';\nimport type { VariableDeclaration, VariableValue } from '@qti-components/base';\nimport type { OutcomeVariable, ResponseVariable, TemplateVariable } from '@qti-components/base';\nimport type { QtiResponseProcessing } from '../qti-response-processing/qti-response-processing.ts';\nimport type QtiRegisterVariable from '../../internal/events/qti-register-variable.ts';\nimport type { ItemContext } from '@qti-components/base';\n\n/**\n * @summary The qti-assessment-item element contains all the other QTI 3 item structures.\n * @documentation https://www.imsglobal.org/spec/qti/v3p0/impl#h.dltnnj87l0yj\n *\n * @dependency qti-feedback\n * @dependency qti-responseprocessing\n *\n * @event qti-item-context-updated - Emitted when through a user action the itemContext is updated,\n * typically on interaction with the interactions, or calling response processing.\n */\n\nexport class QtiAssessmentItem extends LitElement {\n #itemTitle: string | undefined;\n #templateProcessing: QtiTemplateProcessing | null = null;\n\n @property({ type: String }) identifier: string = '';\n @property({ type: String }) adaptive: 'true' | 'false' = 'false';\n @property({ type: String }) timeDependent: 'true' | 'false' | null = null;\n\n @property({ type: String })\n override get title(): string {\n return this.#itemTitle;\n }\n override set title(value: string) {\n this.#itemTitle = value;\n this.removeAttribute('title');\n this.setAttribute('data-title', value);\n }\n\n @property({ type: Boolean }) disabled: boolean;\n @watch('disabled', { waitUntilFirstUpdate: true })\n protected _handleDisabledChange = (_: boolean, disabled: boolean) => {\n this.interactionElements.forEach(ch => (ch.disabled = disabled));\n };\n\n @property({ type: Boolean }) readonly: boolean;\n @watch('readonly', { waitUntilFirstUpdate: true })\n protected _handleReadonlyChange = (_: boolean, readonly: boolean) =>\n this.interactionElements.forEach(ch => (ch.readonly = readonly));\n\n @provide({ context: itemContext })\n private _context: ItemContext = {\n variables: itemContextVariables\n };\n\n /**\n * Sets the identifier for the assessment item reference if this item is in a test.\n *\n * @param identifier - The identifier for the assessment item reference.\n */\n public set assessmentItemRefId(identifier: string) {\n this._context = { ...this._context, identifier };\n }\n\n public get assessmentItemRefId(): string {\n return this._context.identifier;\n }\n\n public get variables(): VariableValue<string | string[] | null>[] {\n return this._context.variables.map(v => ({\n identifier: v.identifier,\n value: v.value,\n type: v.type,\n // add externalscored, a fixed prop to the test, so the testcontext can read and decide how to score this item\n ...(v.type === 'outcome' && v.identifier === 'SCORE'\n ? { externalScored: (v as OutcomeVariable).externalScored }\n : {})\n }));\n }\n\n public set variables(value: VariableValue<string | string[] | null>[]) {\n if (!Array.isArray(value) || value.some(v => !('identifier' in v))) {\n console.warn('variables property should be an array of VariableDeclaration');\n return;\n }\n this._context = {\n ...this._context,\n variables: this._context.variables.map(variable => {\n const matchingValue = value.find(v => v.identifier === variable.identifier);\n if (matchingValue) {\n return {\n ...variable,\n ...matchingValue,\n interpolationTable: (variable as OutcomeVariable).interpolationTable\n };\n }\n return variable;\n })\n };\n\n this._context.variables.forEach(variable => {\n if (variable.type === 'response') {\n const interactionElement = this.interactionElements.find(\n (el: RegisteredInteraction) => el.responseIdentifier === variable.identifier\n );\n if (interactionElement) {\n interactionElement.response = variable.value as string | string[];\n }\n }\n });\n\n this.variables.forEach(variable => {\n if (variable.type === 'outcome') {\n this.#feedbackElements.forEach(fe => fe.checkShowFeedback(variable.identifier));\n }\n });\n }\n\n public get state(): ItemContext['state'] {\n return this._context.state;\n }\n\n public set state(value: ItemContext['state']) {\n this._context = {\n ...this._context,\n state: value ? { ...value } : undefined\n };\n }\n\n #initialContext: Readonly<ItemContext> = { ...this._context, variables: this._context.variables };\n #feedbackElements: QtiFeedback[] = [];\n /** Registered candidate-input interactions. Correction packages may extend their presentation behavior. */\n protected interactionElements: RegisteredInteraction[] = [];\n\n /** @deprecated use variables property instead */\n set responses(myResponses: ResponseInteraction[]) {\n if (myResponses) {\n for (const response of myResponses) {\n const responseVariable = this.getResponse(response.responseIdentifier);\n if (responseVariable) {\n this.updateResponseVariable(response.responseIdentifier, response.response);\n }\n\n const interaction: RegisteredInteraction | undefined = this.interactionElements.find(\n i => i.getAttribute('response-identifier') === response.responseIdentifier\n );\n if (interaction) {\n interaction.response = response.response;\n }\n }\n }\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n\n override connectedCallback(): void {\n this.#attachEventListeners();\n super.connectedCallback();\n this.updateComplete.then(() => {\n this.dispatchEvent(\n new CustomEvent<QtiAssessmentItem>('qti-assessment-item-connected', {\n bubbles: true,\n composed: true,\n detail: this\n })\n );\n this.#processTemplates();\n });\n }\n\n override disconnectedCallback(): void {\n this.#removeEventListeners();\n super.disconnectedCallback();\n }\n\n #attachEventListeners() {\n this.addEventListener('qti-register-variable', this.#handleRegisterVariable);\n this.addEventListener('qti-register-feedback', this.#handleRegisterFeedback);\n this.addEventListener('qti-register-interaction', this.#handleRegisterInteraction);\n this.addEventListener('end-attempt', this.#handleEndAttempt);\n this.addEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);\n this.addEventListener('qti-set-template-value', this.#handleSetTemplateValue);\n this.addEventListener('qti-set-correct-response', this.#handleSetCorrectResponse);\n this.addEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);\n }\n\n #removeEventListeners() {\n this.removeEventListener('qti-register-variable', this.#handleRegisterVariable);\n this.removeEventListener('qti-register-feedback', this.#handleRegisterFeedback);\n this.removeEventListener('qti-register-interaction', this.#handleRegisterInteraction);\n this.removeEventListener('end-attempt', this.#handleEndAttempt);\n this.removeEventListener('qti-set-outcome-value', this.#handleSetOutcomeValue);\n this.removeEventListener('qti-set-template-value', this.#handleSetTemplateValue);\n this.removeEventListener('qti-set-correct-response', this.#handleSetCorrectResponse);\n this.removeEventListener('qti-interaction-response', this.#handleUpdateResponseVariable);\n }\n\n #handleRegisterVariable = (e: QtiRegisterVariable) => {\n e.stopImmediatePropagation();\n this._context = { ...this._context, variables: [...this._context.variables, e.detail.variable] };\n this.#initialContext = this._context;\n e.stopPropagation();\n };\n\n #handleRegisterFeedback = (e: CustomEvent<QtiFeedback>) => {\n e.stopImmediatePropagation();\n const feedbackElement = e.detail;\n this.#feedbackElements.push(feedbackElement);\n const numAttempts = Number(this._context.variables.find(v => v.identifier === 'numAttempts')?.value) || 0;\n if (numAttempts > 0) {\n feedbackElement.checkShowFeedback(feedbackElement.outcomeIdentifier);\n }\n };\n\n #handleRegisterInteraction = (e: CustomEvent<{ interaction: string; interactionElement: RegisteredInteraction }>) => {\n e.stopImmediatePropagation();\n this.interactionElements.push(e.detail.interactionElement);\n };\n\n #handleEndAttempt = (e: CustomEvent<{ responseIdentifier: string; countAttempt: boolean }>) => {\n e.stopImmediatePropagation();\n const { responseIdentifier, countAttempt } = e.detail;\n this.validate();\n this.updateResponseVariable(responseIdentifier, 'true');\n this.processResponse(countAttempt);\n };\n\n #handleSetOutcomeValue = (e: CustomEvent<{ outcomeIdentifier: string; value: string | string[] }>) => {\n e.stopImmediatePropagation();\n const { outcomeIdentifier, value } = e.detail;\n this.updateOutcomeVariable(outcomeIdentifier, value);\n e.stopPropagation();\n };\n\n #handleSetTemplateValue = (e: CustomEvent<{ templateIdentifier: string; value: string | string[] | null }>) => {\n e.stopImmediatePropagation();\n const { templateIdentifier, value } = e.detail;\n this.updateTemplateVariable(templateIdentifier, value ?? undefined);\n e.stopPropagation();\n };\n\n #handleSetCorrectResponse = (e: CustomEvent<{ responseIdentifier: string; value: string | string[] | null }>) => {\n e.stopImmediatePropagation();\n const { responseIdentifier, value } = e.detail;\n this.updateCorrectResponse(responseIdentifier, value ?? undefined);\n e.stopPropagation();\n };\n\n #handleUpdateResponseVariable = (e: CustomEvent<ResponseInteraction>) => {\n e.stopImmediatePropagation();\n\n const { responseIdentifier, response, state } = e.detail;\n this.updateResponseVariable(responseIdentifier, response);\n if (state !== undefined) {\n this._context = {\n ...this._context,\n state: {\n ...(this._context.state || {}),\n [responseIdentifier]: state\n }\n };\n }\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n };\n\n async #processTemplates(): Promise<void> {\n const templateDeclarations = Array.from(this.querySelectorAll<LitElement>('qti-template-declaration'));\n if (templateDeclarations.length > 0) {\n await Promise.all(templateDeclarations.map(declaration => declaration.updateComplete));\n await Promise.resolve();\n }\n\n this.#templateProcessing = this.querySelector<QtiTemplateProcessing>('qti-template-processing');\n if (this.#templateProcessing) {\n // Run template processing before first presentation\n this.#templateProcessing.process();\n this.#initialContext = { ...this._context, variables: this._context.variables };\n }\n }\n\n public processResponse(countNumAttempts = true, reportValidityAfterScoring = true): boolean {\n this.validate(reportValidityAfterScoring);\n\n if (countNumAttempts) {\n this.updateOutcomeVariable(\n 'numAttempts',\n (+this._context.variables.find(v => v.identifier === 'numAttempts')?.value + 1).toString()\n );\n }\n\n if (this.adaptive === 'false') {\n this.#resetOutcomeVariablesBeforeResponseProcessing();\n }\n\n const responseProcessor = this.querySelector<QtiResponseProcessing>('qti-response-processing');\n const canProcess = !!(responseProcessor && typeof responseProcessor.process === 'function');\n if (canProcess) {\n responseProcessor.process();\n }\n if (this.adaptive === 'false') {\n // if adaptive, completionStatus is set by the processing template\n this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());\n }\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n\n return canProcess;\n }\n\n public resetResponses() {\n this._context = this.#initialContext;\n }\n\n protected getResponse(identifier: string): Readonly<ResponseVariable> {\n return this.getVariable(identifier) as ResponseVariable;\n }\n\n public getOutcome(identifier: string): Readonly<OutcomeVariable> {\n return this.getVariable(identifier) as OutcomeVariable;\n }\n\n protected getVariable(identifier: string): Readonly<VariableDeclaration<string | string[] | null>> {\n return this._context.variables.find(v => v.identifier === identifier) || null;\n }\n\n /** Extension point for presentation packages reacting to a candidate response change. */\n protected afterResponseVariableUpdated(): void {}\n\n // saving privates here: ------------------------------------------------------------------------------\n\n /**\n * Updates the response variable with the specified identifier to the given value.\n *\n * @protected\n *\n * This method is intended for internal use within the class and subclasses.\n * It should not be called externally by third parties.\n *\n * @param identifier - The identifier of the response variable to update.\n * @param value - The new value for the response variable.\n */\n public updateResponseVariable(identifier: string, value: string | string[] | undefined) {\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v => (v.identifier !== identifier ? v : { ...v, value: value }))\n };\n\n this.afterResponseVariableUpdated();\n\n this.dispatchEvent(\n new CustomEvent<InteractionChangedDetails>('qti-interaction-changed', {\n bubbles: true,\n composed: true,\n detail: {\n item: this.identifier,\n responseIdentifier: identifier,\n response: Array.isArray(value) ? [...value] : value\n }\n })\n );\n\n if (this.adaptive === 'false') {\n // if adaptive, completionStatus is set by the processing template\n this.updateOutcomeVariable('completionStatus', this.#getCompletionStatus());\n }\n }\n\n /**\n * Updates the template variable with the specified identifier to the given value.\n */\n public updateTemplateVariable(identifier: string, value: string | string[] | undefined) {\n const templateVariable = this._context.variables.find(v => v.identifier === identifier && v.type === 'template') as\n | TemplateVariable\n | undefined;\n\n if (!templateVariable) {\n console.warn(`Can not set qti-template-identifier: ${identifier}, it is not available`);\n return;\n }\n\n const normalizedValue =\n templateVariable.cardinality === 'single'\n ? Array.isArray(value)\n ? value[0]\n : (value ?? null)\n : value === undefined || value === null\n ? null\n : Array.isArray(value)\n ? value\n : [value];\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v =>\n v.identifier !== identifier\n ? v\n : {\n ...v,\n value: normalizedValue\n }\n )\n };\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n /**\n * Updates the correct response for the specified response variable.\n */\n public updateCorrectResponse(identifier: string, value: string | string[] | undefined) {\n const responseVariable = this.getResponse(identifier);\n\n if (!responseVariable) {\n console.warn(`Can not set correct response for identifier: ${identifier}, it is not available`);\n return;\n }\n\n const normalizedValue =\n responseVariable.cardinality === 'single'\n ? Array.isArray(value)\n ? value[0]\n : (value ?? null)\n : value === undefined || value === null\n ? null\n : Array.isArray(value)\n ? value\n : [value];\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v =>\n v.identifier !== identifier\n ? v\n : {\n ...v,\n correctResponse: normalizedValue\n }\n )\n };\n\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n public setOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n this.updateOutcomeVariable(identifier, value);\n this.dispatchEvent(\n new CustomEvent<{ itemContext: ItemContext }>('qti-item-context-updated', {\n bubbles: true,\n composed: true,\n detail: { itemContext: this._context }\n })\n );\n }\n\n /**\n * Updates the outcome variable with the specified identifier to the given value.\n *\n * @protected\n *\n * This method is intended for internal use within the class and subclasses.\n * It should not be called externally by third parties.\n *\n * @param identifier - The identifier of the response variable to update.\n * @param value - The new value for the response variable.\n */\n public updateOutcomeVariable(identifier: string, value: string | string[] | undefined) {\n const outcomeVariable = this.getOutcome(identifier);\n\n if (!outcomeVariable) {\n console.warn(`Can not set qti-outcome-identifier: ${identifier}, it is not available`);\n return;\n }\n\n this._context = {\n ...this._context,\n variables: this._context.variables.map(v => {\n if (v.identifier !== identifier) {\n return v;\n }\n return {\n ...v,\n value: outcomeVariable.cardinality === 'single' ? value : Array.isArray(value) ? value : [value]\n };\n })\n };\n this.#feedbackElements.forEach(fe => fe.checkShowFeedback(identifier));\n\n this.dispatchEvent(\n new CustomEvent<OutcomeChangedDetails>('qti-outcome-changed', {\n bubbles: true,\n composed: true,\n detail: {\n item: this.identifier,\n outcomeIdentifier: identifier,\n value: this._context.variables.find(v => v.identifier === identifier)?.value\n }\n })\n );\n }\n\n public validate(reportValidity = true): boolean {\n const isValid = this.interactionElements.every(interactionElement => interactionElement.validate());\n\n if (reportValidity) {\n this.reportValidity();\n }\n\n return isValid;\n }\n\n public reportValidity() {\n for (const interactionElement of this.interactionElements) {\n interactionElement.reportValidity();\n }\n }\n\n #getCompletionStatus(): 'completed' | 'incomplete' | 'not_attempted' | 'unknown' {\n const valid = this.validate(false);\n if (valid === true) return 'completed';\n if (valid === false) return 'incomplete';\n return 'not_attempted';\n }\n\n #resetOutcomeVariablesBeforeResponseProcessing(): void {\n this._context = {\n ...this._context,\n variables: this._context.variables.map(variable => {\n if (variable.type !== 'outcome') {\n return variable;\n }\n\n const hasDefaultValue = 'defaultValue' in variable;\n const declaredDefault = hasDefaultValue ? variable.defaultValue : null;\n\n let value = declaredDefault ?? null;\n if (\n (value === null || value === undefined) &&\n (variable.baseType === 'integer' || variable.baseType === 'float')\n ) {\n value = '0';\n }\n\n return {\n ...variable,\n value\n };\n })\n };\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-item': QtiAssessmentItem;\n }\n}\n"]}
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { LitElement } from 'lit';
8
- import { customElement, property } from 'lit/decorators.js';
8
+ import { property } from 'lit/decorators.js';
9
9
  import { qtiTransformItem } from '@qti-components/transformers';
10
10
  export class QtiAssessmentStimulusRefConnectedEvent extends Event {
11
11
  static { this.eventName = 'qti-assessment-stimulus-ref-connected'; }
@@ -18,7 +18,7 @@ export class QtiAssessmentStimulusRefConnectedEvent extends Event {
18
18
  /**
19
19
  * Represents a custom element for referencing an assessment stimulus.
20
20
  */
21
- let QtiAssessmentStimulusRef = class QtiAssessmentStimulusRef extends LitElement {
21
+ export class QtiAssessmentStimulusRef extends LitElement {
22
22
  constructor() {
23
23
  super(...arguments);
24
24
  this.identifier = '';
@@ -56,15 +56,11 @@ let QtiAssessmentStimulusRef = class QtiAssessmentStimulusRef extends LitElement
56
56
  stimulusRef.append(...elements);
57
57
  }
58
58
  }
59
- };
59
+ }
60
60
  __decorate([
61
61
  property({ type: String })
62
62
  ], QtiAssessmentStimulusRef.prototype, "identifier", void 0);
63
63
  __decorate([
64
64
  property({ type: String })
65
65
  ], QtiAssessmentStimulusRef.prototype, "href", void 0);
66
- QtiAssessmentStimulusRef = __decorate([
67
- customElement('qti-assessment-stimulus-ref')
68
- ], QtiAssessmentStimulusRef);
69
- export { QtiAssessmentStimulusRef };
70
66
  //# sourceMappingURL=qti-assessment-stimulus-ref.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"qti-assessment-stimulus-ref.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhE,MAAM,OAAO,sCAAuC,SAAQ,KAAK;aACjD,cAAS,GAAG,uCAAuC,CAAC;IAClE,YACS,OAAiC,EACjC,IAAuB;QAE9B,KAAK,CAAC,sCAAsC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAHtG,YAAO,GAAP,OAAO,CAA0B;QACjC,SAAI,GAAJ,IAAI,CAAmB;IAGhC,CAAC;;AAGH;;GAEG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,UAAU;IAAjD;;QACuB,eAAU,GAAG,EAAE,CAAC;QAChB,SAAI,GAAG,EAAE,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AA6B,CAAC;GAChC,wBAAwB,CAwCpC","sourcesContent":["import { LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { qtiTransformItem } from '@qti-components/transformers';\n\nimport type { QtiAssessmentItem } from '../qti-assessment-item/qti-assessment-item';\n\nexport class QtiAssessmentStimulusRefConnectedEvent extends Event {\n public static eventName = 'qti-assessment-stimulus-ref-connected';\n constructor(\n public element: QtiAssessmentStimulusRef,\n public item: QtiAssessmentItem\n ) {\n super(QtiAssessmentStimulusRefConnectedEvent.eventName, { bubbles: true, composed: true, cancelable: true });\n }\n}\n\n/**\n * Represents a custom element for referencing an assessment stimulus.\n */\n@customElement('qti-assessment-stimulus-ref')\nexport class QtiAssessmentStimulusRef extends LitElement {\n @property({ type: String }) identifier = '';\n @property({ type: String }) href = '';\n\n /**\n * Lifecycle method called when the element is connected to the DOM.\n * First checks if there's a data-stimulus-idref element. If found, loads the stimulus directly.\n * If not found, delegates to the delivery platform via an event.\n */\n public override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n // VERY important to wait for updateComplete to ensure that the stimulusRef is connected after item\n // for the test-navigation to correctly process everything in order\n await this.updateComplete;\n\n const item = this.closest<QtiAssessmentItem>('qti-assessment-item');\n\n const event = new QtiAssessmentStimulusRefConnectedEvent(this, item);\n this.dispatchEvent(event);\n\n const stimulusRef = item?.querySelector(`[data-stimulus-idref=\"${this.identifier}\"]`);\n if (!event.defaultPrevented && stimulusRef) {\n await this.updateStimulusRef(stimulusRef);\n }\n }\n\n /**\n * Loads and appends the stimulus to the specified element.\n * @param stimulusRef - The element to which the stimulus will be appended.\n */\n public async updateStimulusRef(stimulusRef: Element) {\n const stimulus = await qtiTransformItem()\n .load(this.href)\n .then(api => api.htmlDoc());\n if (stimulus) {\n const elements = stimulus.querySelectorAll('qti-stimulus-body, qti-stylesheet');\n stimulusRef.innerHTML = '';\n stimulusRef.append(...elements);\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-stimulus-ref': QtiAssessmentStimulusRef;\n }\n}\n"]}
1
+ {"version":3,"file":"qti-assessment-stimulus-ref.js","sourceRoot":"","sources":["../../../src/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAIhE,MAAM,OAAO,sCAAuC,SAAQ,KAAK;aACjD,cAAS,GAAG,uCAAuC,CAAC;IAClE,YACS,OAAiC,EACjC,IAAuB;QAE9B,KAAK,CAAC,sCAAsC,CAAC,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAHtG,YAAO,GAAP,OAAO,CAA0B;QACjC,SAAI,GAAJ,IAAI,CAAmB;IAGhC,CAAC;;AAGH;;GAEG;AAEH,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IAAxD;;QAC8B,eAAU,GAAG,EAAE,CAAC;QAChB,SAAI,GAAG,EAAE,CAAC;IAsCxC,CAAC;IApCC;;;;OAIG;IACa,KAAK,CAAC,iBAAiB;QACrC,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,mGAAmG;QACnG,mEAAmE;QACnE,MAAM,IAAI,CAAC,cAAc,CAAC;QAE1B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAoB,qBAAqB,CAAC,CAAC;QAEpE,MAAM,KAAK,GAAG,IAAI,sCAAsC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrE,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAE1B,MAAM,WAAW,GAAG,IAAI,EAAE,aAAa,CAAC,yBAAyB,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,KAAK,CAAC,gBAAgB,IAAI,WAAW,EAAE,CAAC;YAC3C,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,iBAAiB,CAAC,WAAoB;QACjD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,EAAE;aACtC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAC9B,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,QAAQ,GAAG,QAAQ,CAAC,gBAAgB,CAAC,mCAAmC,CAAC,CAAC;YAChF,WAAW,CAAC,SAAS,GAAG,EAAE,CAAC;YAC3B,WAAW,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF;AAvC6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAAiB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAW","sourcesContent":["import { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { qtiTransformItem } from '@qti-components/transformers';\n\nimport type { QtiAssessmentItem } from '../qti-assessment-item/qti-assessment-item';\n\nexport class QtiAssessmentStimulusRefConnectedEvent extends Event {\n public static eventName = 'qti-assessment-stimulus-ref-connected';\n constructor(\n public element: QtiAssessmentStimulusRef,\n public item: QtiAssessmentItem\n ) {\n super(QtiAssessmentStimulusRefConnectedEvent.eventName, { bubbles: true, composed: true, cancelable: true });\n }\n}\n\n/**\n * Represents a custom element for referencing an assessment stimulus.\n */\n\nexport class QtiAssessmentStimulusRef extends LitElement {\n @property({ type: String }) identifier = '';\n @property({ type: String }) href = '';\n\n /**\n * Lifecycle method called when the element is connected to the DOM.\n * First checks if there's a data-stimulus-idref element. If found, loads the stimulus directly.\n * If not found, delegates to the delivery platform via an event.\n */\n public override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n // VERY important to wait for updateComplete to ensure that the stimulusRef is connected after item\n // for the test-navigation to correctly process everything in order\n await this.updateComplete;\n\n const item = this.closest<QtiAssessmentItem>('qti-assessment-item');\n\n const event = new QtiAssessmentStimulusRefConnectedEvent(this, item);\n this.dispatchEvent(event);\n\n const stimulusRef = item?.querySelector(`[data-stimulus-idref=\"${this.identifier}\"]`);\n if (!event.defaultPrevented && stimulusRef) {\n await this.updateStimulusRef(stimulusRef);\n }\n }\n\n /**\n * Loads and appends the stimulus to the specified element.\n * @param stimulusRef - The element to which the stimulus will be appended.\n */\n public async updateStimulusRef(stimulusRef: Element) {\n const stimulus = await qtiTransformItem()\n .load(this.href)\n .then(api => api.htmlDoc());\n if (stimulus) {\n const elements = stimulus.querySelectorAll('qti-stimulus-body, qti-stylesheet');\n stimulusRef.innerHTML = '';\n stimulusRef.append(...elements);\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-stimulus-ref': QtiAssessmentStimulusRef;\n }\n}\n"]}
@@ -1,15 +1,4 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
1
  import { LitElement } from 'lit';
8
- import { customElement } from 'lit/decorators.js';
9
- let QtiCompanionMaterialsInfo = class QtiCompanionMaterialsInfo extends LitElement {
10
- };
11
- QtiCompanionMaterialsInfo = __decorate([
12
- customElement('qti-companion-materials-info')
13
- ], QtiCompanionMaterialsInfo);
14
- export { QtiCompanionMaterialsInfo };
2
+ export class QtiCompanionMaterialsInfo extends LitElement {
3
+ }
15
4
  //# sourceMappingURL=qti-companion-materials-info.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"qti-companion-materials-info.js","sourceRoot":"","sources":["../../../src/components/qti-companion-materials-info/qti-companion-materials-info.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG3C,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,UAAU;CASxD,CAAA;AATY,yBAAyB;IADrC,aAAa,CAAC,8BAA8B,CAAC;GACjC,yBAAyB,CASrC","sourcesContent":["import { LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('qti-companion-materials-info')\nexport class QtiCompanionMaterialsInfo extends LitElement {\n // static override styles = css`\n // slot {\n // display: hidden;\n // }\n // `;\n // override render() {\n // return html` <slot></slot> `;\n // }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-companion-materials-info': QtiCompanionMaterialsInfo;\n }\n}\n"]}
1
+ {"version":3,"file":"qti-companion-materials-info.js","sourceRoot":"","sources":["../../../src/components/qti-companion-materials-info/qti-companion-materials-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,MAAM,OAAO,yBAA0B,SAAQ,UAAU;CASxD","sourcesContent":["import { LitElement } from 'lit';\n\nexport class QtiCompanionMaterialsInfo extends LitElement {\n // static override styles = css`\n // slot {\n // display: hidden;\n // }\n // `;\n // override render() {\n // return html` <slot></slot> `;\n // }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-companion-materials-info': QtiCompanionMaterialsInfo;\n }\n}\n"]}
@@ -1,6 +1,11 @@
1
1
  import { LitElement } from 'lit';
2
+ import type { ItemContext } from '@qti-components/base';
2
3
  export declare class QtiContentBody extends LitElement {
4
+ #private;
5
+ protected context?: ItemContext;
3
6
  render(): import("lit").TemplateResult<1>;
7
+ connectedCallback(): void;
8
+ protected updated(changedProperties: Map<string | number | symbol, unknown>): void;
4
9
  }
5
10
  declare global {
6
11
  interface HTMLElementTagNameMap {