@citolab/qti-components 9.3.0 → 10.0.0-next.0

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 (64) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +258 -206
  3. package/dist/base.d.ts +10 -10
  4. package/dist/base.js +1 -1
  5. package/dist/{chunk-G5RQ5GKG.js → chunk-3BAQWO5C.js} +2 -2
  6. package/dist/{chunk-ZG7FBQFP.js → chunk-ACRN7YJM.js} +2 -2
  7. package/dist/{chunk-REKCRWJV.js → chunk-AWTQKBC4.js} +231 -129
  8. package/dist/chunk-AWTQKBC4.js.map +1 -0
  9. package/dist/{chunk-JGPWBIVD.js → chunk-CNFVA3AA.js} +128 -48
  10. package/dist/chunk-CNFVA3AA.js.map +1 -0
  11. package/dist/{chunk-CQHGVPOT.js → chunk-EPSUZIWL.js} +6 -6
  12. package/dist/{chunk-TDWLV5OD.js → chunk-EUKU5QKV.js} +633 -352
  13. package/dist/chunk-EUKU5QKV.js.map +1 -0
  14. package/dist/{chunk-RAJQKCQ3.js → chunk-F7R7GSWL.js} +3 -3
  15. package/dist/{chunk-FG5JAWSN.js → chunk-GPNWMLLA.js} +2 -2
  16. package/dist/{chunk-7VDR765S.js → chunk-QD3Y6UK3.js} +2 -2
  17. package/dist/{chunk-YVZWNLF4.js → chunk-R7MMMDP7.js} +139 -18
  18. package/dist/chunk-R7MMMDP7.js.map +1 -0
  19. package/dist/{chunk-JLZCZVRX.js → chunk-SVYHZIJ7.js} +2 -2
  20. package/dist/{chunk-YIYHCHHM.js → chunk-WNAOVXXN.js} +2 -2
  21. package/dist/chunk-ZP6QQYSU.js +7 -0
  22. package/dist/chunk-ZP6QQYSU.js.map +1 -0
  23. package/dist/{computed.types.d-DB5gfOh9.d.ts → computed.types.d-gJrBeUMG.d.ts} +1 -1
  24. package/dist/corrections.d.ts +9 -9
  25. package/dist/corrections.js +8 -8
  26. package/dist/elements.d.ts +108 -6
  27. package/dist/elements.js +17 -5
  28. package/dist/index.d.ts +12 -12
  29. package/dist/index.js +28 -14
  30. package/dist/{interaction.d-DegNJ5ZA.d.ts → interaction.d-g6XG0T0Z.d.ts} +2 -2
  31. package/dist/interactions.d.ts +4 -4
  32. package/dist/interactions.js +3 -3
  33. package/dist/item.css +11 -0
  34. package/dist/item.d.ts +4 -4
  35. package/dist/item.js +4 -4
  36. package/dist/{item.types.d-BDFrq19E.d.ts → item.types.d-B55QkJ92.d.ts} +10 -0
  37. package/dist/loader.d.ts +2 -2
  38. package/dist/processing.d.ts +3 -3
  39. package/dist/processing.js +3 -3
  40. package/dist/qti-components-jsx.d.ts +354 -440
  41. package/dist/{qti-condition-expression.d-DLboq8bR.d.ts → qti-condition-expression.d-L7yb3Rzy.d.ts} +1 -1
  42. package/dist/{qti-expression.d-BksT9iLB.d.ts → qti-expression.d-CuaLjZ6g.d.ts} +1 -1
  43. package/dist/{qti-feedback.d-D-w6-mJv.d.ts → qti-feedback.d-wMYNVkkj.d.ts} +2 -3
  44. package/dist/{qti-item.d-D_-9_0e6.d.ts → qti-item.d-DgC1AQbY.d.ts} +1 -1
  45. package/dist/{qti-test.d-D-ELy0Mr.d.ts → qti-test.d-_THYXPzd.d.ts} +206 -46
  46. package/dist/{qti-text-entry-interaction.d-CATtcPyX.d.ts → qti-text-entry-interaction.d-q8u5BiVK.d.ts} +13 -4
  47. package/dist/{session.context.d-Cjs0BkJB.d.ts → session.context.d-D5080LVx.d.ts} +3 -1
  48. package/dist/test.d.ts +58 -11
  49. package/dist/test.js +7 -5
  50. package/package.json +9 -9
  51. package/dist/chunk-A32YH4H5.js +0 -7
  52. package/dist/chunk-A32YH4H5.js.map +0 -1
  53. package/dist/chunk-JGPWBIVD.js.map +0 -1
  54. package/dist/chunk-REKCRWJV.js.map +0 -1
  55. package/dist/chunk-TDWLV5OD.js.map +0 -1
  56. package/dist/chunk-YVZWNLF4.js.map +0 -1
  57. /package/dist/{chunk-G5RQ5GKG.js.map → chunk-3BAQWO5C.js.map} +0 -0
  58. /package/dist/{chunk-ZG7FBQFP.js.map → chunk-ACRN7YJM.js.map} +0 -0
  59. /package/dist/{chunk-CQHGVPOT.js.map → chunk-EPSUZIWL.js.map} +0 -0
  60. /package/dist/{chunk-RAJQKCQ3.js.map → chunk-F7R7GSWL.js.map} +0 -0
  61. /package/dist/{chunk-FG5JAWSN.js.map → chunk-GPNWMLLA.js.map} +0 -0
  62. /package/dist/{chunk-7VDR765S.js.map → chunk-QD3Y6UK3.js.map} +0 -0
  63. /package/dist/{chunk-JLZCZVRX.js.map → chunk-SVYHZIJ7.js.map} +0 -0
  64. /package/dist/{chunk-YIYHCHHM.js.map → chunk-WNAOVXXN.js.map} +0 -0
@@ -11,7 +11,55 @@ import {
11
11
  getCustomOperator,
12
12
  itemContext,
13
13
  itemContextVariables
14
- } from "./chunk-YVZWNLF4.js";
14
+ } from "./chunk-R7MMMDP7.js";
15
+
16
+ // ../qti-elements/dist/public-events.js
17
+ var PUBLIC_ITEM_EVENTS = {
18
+ // The old name `qti-assessment-item-connected` stays as internal plumbing: it is sent separately.
19
+ "cito-item-rendered": { kind: "notification", scope: "item" },
20
+ "cito-item-response-changed": { kind: "notification", scope: "item", deprecated: "qti-interaction-changed" },
21
+ "cito-item-outcome-changed": { kind: "notification", scope: "item", deprecated: "qti-outcome-changed" },
22
+ "cito-item-rubric-placement": {
23
+ kind: "notification",
24
+ scope: "item",
25
+ deprecated: "qti-rubric:discretionary-placement"
26
+ }
27
+ };
28
+ function dispatchDeclared(target, declarations, name, detail, cancelable = false) {
29
+ const init = { detail: detail ?? {}, bubbles: true, composed: true, cancelable };
30
+ const notCancelled = target.dispatchEvent(new CustomEvent(name, init));
31
+ const { deprecated } = declarations[name];
32
+ if (!deprecated)
33
+ return notCancelled;
34
+ return target.dispatchEvent(new CustomEvent(deprecated, init)) && notCancelled;
35
+ }
36
+ var warned = /* @__PURE__ */ new Set();
37
+ function listenDeclared(target, declarations, name, handler) {
38
+ let justHandled;
39
+ target.addEventListener(name, (e) => {
40
+ justHandled = e.detail;
41
+ queueMicrotask(() => justHandled = void 0);
42
+ handler(e);
43
+ });
44
+ const { deprecated } = declarations[name];
45
+ if (deprecated) {
46
+ target.addEventListener(deprecated, (e) => {
47
+ if (justHandled !== void 0 && e.detail === justHandled)
48
+ return;
49
+ if (!warned.has(deprecated)) {
50
+ warned.add(deprecated);
51
+ console.warn(`[qti-components] The event "${deprecated}" is deprecated; dispatch "${name}" instead.`);
52
+ }
53
+ handler(e);
54
+ });
55
+ }
56
+ }
57
+ function dispatchPublic(target, name, detail, cancelable = false) {
58
+ return dispatchDeclared(target, PUBLIC_ITEM_EVENTS, name, detail, cancelable);
59
+ }
60
+ function listenPublic(target, name, handler) {
61
+ listenDeclared(target, PUBLIC_ITEM_EVENTS, name, handler);
62
+ }
15
63
 
16
64
  // ../qti-elements/dist/components/qti-assessment-item/qti-assessment-item.js
17
65
  import { provide } from "@lit/context";
@@ -30,31 +78,22 @@ var QtiAssessmentItem = class extends LitElement {
30
78
  this.identifier = "";
31
79
  this.adaptive = "false";
32
80
  this.timeDependent = null;
33
- this._handleDisabledChange = (_, disabled) => {
34
- this.interactionElements.forEach((ch) => ch.disabled = disabled);
35
- };
36
- this._handleReadonlyChange = (_, readonly) => this.interactionElements.forEach((ch) => ch.readonly = readonly);
37
81
  this._context = {
38
82
  variables: itemContextVariables
39
83
  };
40
84
  this.#initialContext = { ...this._context, variables: this._context.variables };
41
- this.#feedbackElements = [];
85
+ this.#restoredTemplateValues = /* @__PURE__ */ new Map();
86
+ this.#templatesProcessed = false;
42
87
  this.interactionElements = [];
43
88
  this.#handleRegisterVariable = (e) => {
44
89
  e.stopImmediatePropagation();
45
- this._context = { ...this._context, variables: [...this._context.variables, e.detail.variable] };
90
+ const { variable } = e.detail;
91
+ const restored = variable.type === "template" ? this.#restoredTemplateValues.get(variable.identifier) : void 0;
92
+ const registered = restored !== void 0 ? { ...variable, value: restored } : variable;
93
+ this._context = { ...this._context, variables: [...this._context.variables, registered] };
46
94
  this.#initialContext = this._context;
47
95
  e.stopPropagation();
48
96
  };
49
- this.#handleRegisterFeedback = (e) => {
50
- e.stopImmediatePropagation();
51
- const feedbackElement = e.detail;
52
- this.#feedbackElements.push(feedbackElement);
53
- const numAttempts = Number(this._context.variables.find((v) => v.identifier === "numAttempts")?.value) || 0;
54
- if (numAttempts > 0) {
55
- feedbackElement.checkShowFeedback(feedbackElement.outcomeIdentifier);
56
- }
57
- };
58
97
  this.#handleRegisterInteraction = (e) => {
59
98
  e.stopImmediatePropagation();
60
99
  this.interactionElements.push(e.detail.interactionElement);
@@ -75,7 +114,9 @@ var QtiAssessmentItem = class extends LitElement {
75
114
  this.#handleSetTemplateValue = (e) => {
76
115
  e.stopImmediatePropagation();
77
116
  const { templateIdentifier, value } = e.detail;
78
- this.updateTemplateVariable(templateIdentifier, value ?? void 0);
117
+ if (!this.#restoredTemplateValues.has(templateIdentifier)) {
118
+ this.updateTemplateVariable(templateIdentifier, value ?? void 0);
119
+ }
79
120
  e.stopPropagation();
80
121
  };
81
122
  this.#handleSetCorrectResponse = (e) => {
@@ -97,6 +138,7 @@ var QtiAssessmentItem = class extends LitElement {
97
138
  }
98
139
  };
99
140
  }
141
+ this.validate(false);
100
142
  this.dispatchEvent(new CustomEvent("qti-item-context-updated", {
101
143
  bubbles: true,
102
144
  composed: true,
@@ -114,6 +156,18 @@ var QtiAssessmentItem = class extends LitElement {
114
156
  this.removeAttribute("title");
115
157
  this.setAttribute("data-title", value);
116
158
  }
159
+ willUpdate(changed) {
160
+ super.willUpdate(changed);
161
+ const readonlyChanged = changed.has("readonly") && (this.readonly ?? false) !== (this._context.readonly ?? false);
162
+ const disabledChanged = changed.has("disabled") && (this.disabled ?? false) !== (this._context.disabled ?? false);
163
+ if (readonlyChanged || disabledChanged) {
164
+ this._context = {
165
+ ...this._context,
166
+ ...readonlyChanged ? { readonly: !!this.readonly } : {},
167
+ ...disabledChanged ? { disabled: !!this.disabled } : {}
168
+ };
169
+ }
170
+ }
117
171
  /**
118
172
  * Sets the identifier for the assessment item reference if this item is in a test.
119
173
  *
@@ -125,6 +179,13 @@ var QtiAssessmentItem = class extends LitElement {
125
179
  get assessmentItemRefId() {
126
180
  return this._context.identifier;
127
181
  }
182
+ /**
183
+ * The item's whole context, declarations included, for reading. `variables` is the trimmed view
184
+ * for hosts; the test needs the declarations too, and used to reach for the private field.
185
+ */
186
+ get itemContext() {
187
+ return this._context;
188
+ }
128
189
  get variables() {
129
190
  return this._context.variables.map((v) => ({
130
191
  identifier: v.identifier,
@@ -139,6 +200,10 @@ var QtiAssessmentItem = class extends LitElement {
139
200
  console.warn("variables property should be an array of VariableDeclaration");
140
201
  return;
141
202
  }
203
+ const previous = this._context.variables;
204
+ const restoredTemplates = value.filter((v) => v.value !== null && v.value !== void 0 && (v.type === "template" || previous.some((declared) => declared.identifier === v.identifier && declared.type === "template")));
205
+ restoredTemplates.forEach((v) => this.#restoredTemplateValues.set(v.identifier, v.value));
206
+ const templatesChanged = restoredTemplates.some((v) => JSON.stringify(previous.find((declared) => declared.identifier === v.identifier)?.value) !== JSON.stringify(v.value));
142
207
  this._context = {
143
208
  ...this._context,
144
209
  variables: this._context.variables.map((variable) => {
@@ -154,19 +219,10 @@ var QtiAssessmentItem = class extends LitElement {
154
219
  return variable;
155
220
  })
156
221
  };
157
- this._context.variables.forEach((variable) => {
158
- if (variable.type === "response") {
159
- const interactionElement = this.interactionElements.find((el) => el.responseIdentifier === variable.identifier);
160
- if (interactionElement) {
161
- interactionElement.response = variable.value;
162
- }
163
- }
164
- });
165
- this.variables.forEach((variable) => {
166
- if (variable.type === "outcome") {
167
- this.#feedbackElements.forEach((fe) => fe.checkShowFeedback(variable.identifier));
168
- }
169
- });
222
+ if (this.#templatesProcessed && templatesChanged) {
223
+ this.#runTemplateProcessing();
224
+ }
225
+ void this.updateComplete.then(() => this.#revalidate());
170
226
  }
171
227
  get state() {
172
228
  return this._context.state;
@@ -178,7 +234,13 @@ var QtiAssessmentItem = class extends LitElement {
178
234
  };
179
235
  }
180
236
  #initialContext;
181
- #feedbackElements;
237
+ /**
238
+ * Template values handed in through `variables` — drawn in an earlier visit or session. Template
239
+ * processing keeps them instead of drawing again, so the candidate sees the question they
240
+ * answered, and still runs, so correct responses are derived from them.
241
+ */
242
+ #restoredTemplateValues;
243
+ #templatesProcessed;
182
244
  /** @deprecated use variables property instead */
183
245
  set responses(myResponses) {
184
246
  if (myResponses) {
@@ -201,6 +263,8 @@ var QtiAssessmentItem = class extends LitElement {
201
263
  this.#attachEventListeners();
202
264
  super.connectedCallback();
203
265
  this.updateComplete.then(() => {
266
+ this.validate(false);
267
+ dispatchPublic(this, "cito-item-rendered", this);
204
268
  this.dispatchEvent(new CustomEvent("qti-assessment-item-connected", {
205
269
  bubbles: true,
206
270
  composed: true,
@@ -215,7 +279,6 @@ var QtiAssessmentItem = class extends LitElement {
215
279
  }
216
280
  #attachEventListeners() {
217
281
  this.addEventListener("qti-register-variable", this.#handleRegisterVariable);
218
- this.addEventListener("qti-register-feedback", this.#handleRegisterFeedback);
219
282
  this.addEventListener("qti-register-interaction", this.#handleRegisterInteraction);
220
283
  this.addEventListener("end-attempt", this.#handleEndAttempt);
221
284
  this.addEventListener("qti-set-outcome-value", this.#handleSetOutcomeValue);
@@ -225,7 +288,6 @@ var QtiAssessmentItem = class extends LitElement {
225
288
  }
226
289
  #removeEventListeners() {
227
290
  this.removeEventListener("qti-register-variable", this.#handleRegisterVariable);
228
- this.removeEventListener("qti-register-feedback", this.#handleRegisterFeedback);
229
291
  this.removeEventListener("qti-register-interaction", this.#handleRegisterInteraction);
230
292
  this.removeEventListener("end-attempt", this.#handleEndAttempt);
231
293
  this.removeEventListener("qti-set-outcome-value", this.#handleSetOutcomeValue);
@@ -234,7 +296,6 @@ var QtiAssessmentItem = class extends LitElement {
234
296
  this.removeEventListener("qti-interaction-response", this.#handleUpdateResponseVariable);
235
297
  }
236
298
  #handleRegisterVariable;
237
- #handleRegisterFeedback;
238
299
  #handleRegisterInteraction;
239
300
  #handleEndAttempt;
240
301
  #handleSetOutcomeValue;
@@ -248,10 +309,14 @@ var QtiAssessmentItem = class extends LitElement {
248
309
  await Promise.resolve();
249
310
  }
250
311
  this.#templateProcessing = this.querySelector("qti-template-processing");
251
- if (this.#templateProcessing) {
252
- this.#templateProcessing.process();
253
- this.#initialContext = { ...this._context, variables: this._context.variables };
254
- }
312
+ this.#templatesProcessed = true;
313
+ this.#runTemplateProcessing();
314
+ }
315
+ #runTemplateProcessing() {
316
+ if (!this.#templateProcessing)
317
+ return;
318
+ this.#templateProcessing.process();
319
+ this.#initialContext = { ...this._context, variables: this._context.variables };
255
320
  }
256
321
  processResponse(countNumAttempts = true, reportValidityAfterScoring = true) {
257
322
  this.validate(reportValidityAfterScoring);
@@ -309,15 +374,11 @@ var QtiAssessmentItem = class extends LitElement {
309
374
  variables: this._context.variables.map((v) => v.identifier !== identifier ? v : { ...v, value })
310
375
  };
311
376
  this.afterResponseVariableUpdated();
312
- this.dispatchEvent(new CustomEvent("qti-interaction-changed", {
313
- bubbles: true,
314
- composed: true,
315
- detail: {
316
- item: this.identifier,
317
- responseIdentifier: identifier,
318
- response: Array.isArray(value) ? [...value] : value
319
- }
320
- }));
377
+ dispatchPublic(this, "cito-item-response-changed", {
378
+ item: this.identifier,
379
+ responseIdentifier: identifier,
380
+ response: Array.isArray(value) ? [...value] : value
381
+ });
321
382
  if (this.adaptive === "false") {
322
383
  this.updateOutcomeVariable("completionStatus", this.#getCompletionStatus());
323
384
  }
@@ -405,24 +466,41 @@ var QtiAssessmentItem = class extends LitElement {
405
466
  };
406
467
  })
407
468
  };
408
- this.#feedbackElements.forEach((fe) => fe.checkShowFeedback(identifier));
409
- this.dispatchEvent(new CustomEvent("qti-outcome-changed", {
410
- bubbles: true,
411
- composed: true,
412
- detail: {
413
- item: this.identifier,
414
- outcomeIdentifier: identifier,
415
- value: this._context.variables.find((v) => v.identifier === identifier)?.value
416
- }
417
- }));
469
+ dispatchPublic(this, "cito-item-outcome-changed", {
470
+ item: this.identifier,
471
+ outcomeIdentifier: identifier,
472
+ value: this._context.variables.find((v) => v.identifier === identifier)?.value
473
+ });
418
474
  }
419
475
  validate(reportValidity = true) {
420
476
  const isValid = this.interactionElements.every((interactionElement) => interactionElement.validate());
477
+ this.#publishValidity(isValid);
421
478
  if (reportValidity) {
422
479
  this.reportValidity();
423
480
  }
424
481
  return isValid;
425
482
  }
483
+ /** Puts the verdict in the item context, where the test and anything else can read it. */
484
+ #publishValidity(valid) {
485
+ if (this._context.valid !== valid) {
486
+ this._context = { ...this._context, valid };
487
+ }
488
+ }
489
+ /**
490
+ * Checks again after something the interactions' validity depends on changed without them saying
491
+ * so (an answer handed in through `variables`), and tells the test if the verdict moved.
492
+ */
493
+ #revalidate() {
494
+ const before = this._context.valid;
495
+ this.validate(false);
496
+ if (this._context.valid !== before) {
497
+ this.dispatchEvent(new CustomEvent("qti-item-context-updated", {
498
+ bubbles: true,
499
+ composed: true,
500
+ detail: { itemContext: this._context }
501
+ }));
502
+ }
503
+ }
426
504
  reportValidity() {
427
505
  for (const interactionElement of this.interactionElements) {
428
506
  interactionElement.reportValidity();
@@ -472,21 +550,44 @@ __decorate([
472
550
  __decorate([
473
551
  property({ type: Boolean })
474
552
  ], QtiAssessmentItem.prototype, "disabled", void 0);
475
- __decorate([
476
- watch("disabled", { waitUntilFirstUpdate: true })
477
- ], QtiAssessmentItem.prototype, "_handleDisabledChange", void 0);
478
553
  __decorate([
479
554
  property({ type: Boolean })
480
555
  ], QtiAssessmentItem.prototype, "readonly", void 0);
481
- __decorate([
482
- watch("readonly", { waitUntilFirstUpdate: true })
483
- ], QtiAssessmentItem.prototype, "_handleReadonlyChange", void 0);
484
556
  __decorate([
485
557
  provide({ context: itemContext })
486
558
  ], QtiAssessmentItem.prototype, "_context", void 0);
487
559
 
560
+ // ../qti-elements/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.js
561
+ import { html as html2, LitElement as LitElement2 } from "lit";
562
+
563
+ // ../qti-elements/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.styles.js
564
+ import { css } from "lit";
565
+ var qti_assessment_stimulus_styles_default = css`
566
+ :host {
567
+ display: contents;
568
+ }
569
+
570
+ ::slotted(qti-catalog-info) {
571
+ display: none;
572
+ }
573
+ `;
574
+
575
+ // ../qti-elements/dist/components/qti-assessment-stimulus/qti-assessment-stimulus.js
576
+ var QtiAssessmentStimulus = class extends LitElement2 {
577
+ static {
578
+ this.styles = qti_assessment_stimulus_styles_default;
579
+ }
580
+ connectedCallback() {
581
+ super.connectedCallback();
582
+ this.removeAttribute("title");
583
+ }
584
+ render() {
585
+ return html2`<slot></slot>`;
586
+ }
587
+ };
588
+
488
589
  // ../qti-elements/dist/components/qti-assessment-stimulus-ref/qti-assessment-stimulus-ref.js
489
- import { LitElement as LitElement2 } from "lit";
590
+ import { LitElement as LitElement3 } from "lit";
490
591
  import { property as property2 } from "lit/decorators.js";
491
592
  var __decorate2 = function(decorators, target, key, desc) {
492
593
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -504,7 +605,7 @@ var QtiAssessmentStimulusRefConnectedEvent = class _QtiAssessmentStimulusRefConn
504
605
  this.item = item;
505
606
  }
506
607
  };
507
- var QtiAssessmentStimulusRef = class extends LitElement2 {
608
+ var QtiAssessmentStimulusRef = class extends LitElement3 {
508
609
  constructor() {
509
610
  super(...arguments);
510
611
  this.identifier = "";
@@ -532,10 +633,10 @@ var QtiAssessmentStimulusRef = class extends LitElement2 {
532
633
  */
533
634
  async updateStimulusRef(stimulusRef) {
534
635
  const stimulus = await qtiTransformItem().load(this.href).then((api) => api.htmlDoc());
535
- if (stimulus) {
536
- const elements = stimulus.querySelectorAll("qti-stimulus-body, qti-stylesheet");
636
+ const root = stimulus?.querySelector("qti-assessment-stimulus");
637
+ if (root) {
537
638
  stimulusRef.innerHTML = "";
538
- stimulusRef.append(...elements);
639
+ stimulusRef.append(root);
539
640
  }
540
641
  }
541
642
  };
@@ -547,13 +648,13 @@ __decorate2([
547
648
  ], QtiAssessmentStimulusRef.prototype, "href", void 0);
548
649
 
549
650
  // ../qti-elements/dist/components/qti-companion-materials-info/qti-companion-materials-info.js
550
- import { LitElement as LitElement3 } from "lit";
551
- var QtiCompanionMaterialsInfo = class extends LitElement3 {
651
+ import { LitElement as LitElement4 } from "lit";
652
+ var QtiCompanionMaterialsInfo = class extends LitElement4 {
552
653
  };
553
654
 
554
655
  // ../qti-elements/dist/components/qti-content-body/qti-content-body.js
555
656
  import { consume } from "@lit/context";
556
- import { LitElement as LitElement4, html as html2 } from "lit";
657
+ import { LitElement as LitElement5, html as html3 } from "lit";
557
658
  import { state } from "lit/decorators.js";
558
659
  var __decorate3 = function(decorators, target, key, desc) {
559
660
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -561,9 +662,9 @@ var __decorate3 = function(decorators, target, key, desc) {
561
662
  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;
562
663
  return c > 3 && r && Object.defineProperty(target, key, r), r;
563
664
  };
564
- var QtiContentBody = class extends LitElement4 {
665
+ var QtiContentBody = class extends LitElement5 {
565
666
  render() {
566
- return html2`<slot @slotchange=${this.#expandMathVariables}></slot>`;
667
+ return html3`<slot @slotchange=${this.#expandMathVariables}></slot>`;
567
668
  }
568
669
  connectedCallback() {
569
670
  super.connectedCallback();
@@ -618,7 +719,7 @@ __decorate3([
618
719
  ], QtiContentBody.prototype, "context", void 0);
619
720
 
620
721
  // ../qti-elements/dist/components/qti-context-declaration/qti-context-declaration.js
621
- import { css, LitElement as LitElement5, html as html3 } from "lit";
722
+ import { css as css2, LitElement as LitElement6, html as html4 } from "lit";
622
723
  import { property as property3 } from "lit/decorators.js";
623
724
  var __decorate4 = function(decorators, target, key, desc) {
624
725
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -626,7 +727,7 @@ var __decorate4 = function(decorators, target, key, desc) {
626
727
  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;
627
728
  return c > 3 && r && Object.defineProperty(target, key, r), r;
628
729
  };
629
- var QtiContextDeclaration = class extends LitElement5 {
730
+ var QtiContextDeclaration = class extends LitElement6 {
630
731
  constructor() {
631
732
  super(...arguments);
632
733
  this.identifier = "";
@@ -634,7 +735,7 @@ var QtiContextDeclaration = class extends LitElement5 {
634
735
  }
635
736
  static {
636
737
  this.styles = [
637
- css`
738
+ css2`
638
739
  :host {
639
740
  display: none;
640
741
  }
@@ -642,7 +743,7 @@ var QtiContextDeclaration = class extends LitElement5 {
642
743
  ];
643
744
  }
644
745
  render() {
645
- return html3`<slot></slot>`;
746
+ return html4`<slot></slot>`;
646
747
  }
647
748
  };
648
749
  __decorate4([
@@ -654,7 +755,7 @@ __decorate4([
654
755
 
655
756
  // ../qti-elements/dist/components/qti-custom-operator/qti-custom-operator.js
656
757
  import { consume as consume2 } from "@lit/context";
657
- import { LitElement as LitElement6, html as html4 } from "lit";
758
+ import { LitElement as LitElement7, html as html5 } from "lit";
658
759
  import { state as state2 } from "lit/decorators.js";
659
760
  var __decorate5 = function(decorators, target, key, desc) {
660
761
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -662,11 +763,11 @@ var __decorate5 = function(decorators, target, key, desc) {
662
763
  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;
663
764
  return c > 3 && r && Object.defineProperty(target, key, r), r;
664
765
  };
665
- var QtiCustomOperator = class extends LitElement6 {
766
+ var QtiCustomOperator = class extends LitElement7 {
666
767
  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
667
768
  #operatorFunction;
668
769
  render() {
669
- return html4`<slot @slotchange=${this.handleSlotChange}></slot>`;
770
+ return html5`<slot @slotchange=${this.handleSlotChange}></slot>`;
670
771
  }
671
772
  handleSlotChange() {
672
773
  const commentNode = Array.from(this.firstElementChild?.childNodes ?? []).find((node) => node.nodeType === Node.COMMENT_NODE);
@@ -735,10 +836,10 @@ __decorate5([
735
836
  ], QtiCustomOperator.prototype, "_context", void 0);
736
837
 
737
838
  // ../qti-elements/dist/components/qti-feedback-block/qti-feedback-block.js
738
- import { css as css2, html as html5 } from "lit";
839
+ import { css as css3, html as html6 } from "lit";
739
840
  var QtiFeedbackBlock = class extends QtiFeedback {
740
841
  static {
741
- this.styles = css2`
842
+ this.styles = css3`
742
843
  :host {
743
844
  display: block;
744
845
  }
@@ -751,7 +852,7 @@ var QtiFeedbackBlock = class extends QtiFeedback {
751
852
  `;
752
853
  }
753
854
  render() {
754
- return html5` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `;
855
+ return html6` <slot part="feedback" class="feedback ${this.showStatus}"></slot> `;
755
856
  }
756
857
  connectedCallback() {
757
858
  super.connectedCallback();
@@ -760,15 +861,15 @@ var QtiFeedbackBlock = class extends QtiFeedback {
760
861
  };
761
862
 
762
863
  // ../qti-elements/dist/components/qti-feedback-inline/qti-feedback-inline.js
763
- import { css as css3, html as html6 } from "lit";
864
+ import { css as css4, html as html7 } from "lit";
764
865
  import { ifDefined } from "lit/directives/if-defined.js";
765
866
  var QtiFeedbackInline = class extends QtiFeedback {
766
867
  constructor() {
767
868
  super(...arguments);
768
- this.render = () => html6` <slot part="feedback" class="${ifDefined(this.showStatus)}"></slot> `;
869
+ this.render = () => html7` <slot part="feedback" class="${ifDefined(this.showStatus)}"></slot> `;
769
870
  }
770
871
  static {
771
- this.styles = css3`
872
+ this.styles = css4`
772
873
  .on {
773
874
  display: inline-block;
774
875
  }
@@ -784,31 +885,31 @@ var QtiFeedbackInline = class extends QtiFeedback {
784
885
  };
785
886
 
786
887
  // ../qti-elements/dist/components/qti-item-body/qti-item-body.js
787
- import { html as html7, LitElement as LitElement7 } from "lit";
888
+ import { html as html8, LitElement as LitElement8 } from "lit";
788
889
 
789
890
  // ../qti-elements/dist/components/qti-item-body/qti-item-body.styles.js
790
- import { css as css4 } from "lit";
791
- var qti_item_body_styles_default = css4`
891
+ import { css as css5 } from "lit";
892
+ var qti_item_body_styles_default = css5`
792
893
  :host {
793
894
  display: block;
794
895
  }
795
896
  `;
796
897
 
797
898
  // ../qti-elements/dist/components/qti-item-body/qti-item-body.js
798
- var QtiItemBody = class extends LitElement7 {
899
+ var QtiItemBody = class extends LitElement8 {
799
900
  static {
800
901
  this.styles = qti_item_body_styles_default;
801
902
  }
802
903
  render() {
803
- return html7`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`;
904
+ return html8`<slot part="qti-rubric-blocks" name="qti-rubric-block"></slot><slot></slot>`;
804
905
  }
805
906
  };
806
907
 
807
908
  // ../qti-elements/dist/components/qti-modal-feedback/qti-modal-feedback.js
808
- import { css as css5, html as html8 } from "lit";
909
+ import { css as css6, html as html9 } from "lit";
809
910
  var QtiModalFeedback = class extends QtiFeedback {
810
911
  static {
811
- this.styles = css5`
912
+ this.styles = css6`
812
913
  .cito-dialog {
813
914
  background: var(--qti-bg);
814
915
  border: var(--qti-border-thickness) var(--qti-border-style) var(--qti-border-color);
@@ -849,7 +950,7 @@ var QtiModalFeedback = class extends QtiFeedback {
849
950
  `;
850
951
  }
851
952
  render() {
852
- return html8`
953
+ return html9`
853
954
  <dialog class="cito-dialog" part="feedback" ?open="${this.showStatus === "on"}">
854
955
  <slot></slot>
855
956
  <div style="margin-top: var(--qti-gap); text-align: center;">
@@ -890,7 +991,7 @@ var QtiModalFeedback = class extends QtiFeedback {
890
991
 
891
992
  // ../qti-elements/dist/components/qti-outcome-declaration/qti-outcome-declaration.js
892
993
  import { consume as consume3 } from "@lit/context";
893
- import { css as css6, html as html9 } from "lit";
994
+ import { css as css7, html as html10 } from "lit";
894
995
  import { property as property4, state as state3 } from "lit/decorators.js";
895
996
  var __decorate6 = function(decorators, target, key, desc) {
896
997
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -905,7 +1006,7 @@ var QtiOutcomeDeclaration = class extends QtiVariableDeclaration {
905
1006
  }
906
1007
  static {
907
1008
  this.styles = [
908
- css6`
1009
+ css7`
909
1010
  :host {
910
1011
  display: none;
911
1012
  }
@@ -914,7 +1015,7 @@ var QtiOutcomeDeclaration = class extends QtiVariableDeclaration {
914
1015
  }
915
1016
  render() {
916
1017
  const value = this.itemContext?.variables.find((v) => v.identifier === this.identifier)?.value;
917
- return html9`${JSON.stringify(value, null, 2)}`;
1018
+ return html10`${JSON.stringify(value, null, 2)}`;
918
1019
  }
919
1020
  /**
920
1021
  * The entries of a `qti-interpolation-table`, in document order.
@@ -1010,7 +1111,7 @@ __decorate6([
1010
1111
 
1011
1112
  // ../qti-elements/dist/components/qti-response-declaration/qti-response-declaration.js
1012
1113
  import { consume as consume4 } from "@lit/context";
1013
- import { css as css7, html as html10 } from "lit";
1114
+ import { css as css8, html as html11 } from "lit";
1014
1115
  import { property as property5, state as state4 } from "lit/decorators.js";
1015
1116
  var __decorate7 = function(decorators, target, key, desc) {
1016
1117
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1021,7 +1122,7 @@ var __decorate7 = function(decorators, target, key, desc) {
1021
1122
  var QtiResponseDeclaration = class extends QtiVariableDeclaration {
1022
1123
  static {
1023
1124
  this.styles = [
1024
- css7`
1125
+ css8`
1025
1126
  :host {
1026
1127
  display: none;
1027
1128
  }
@@ -1030,7 +1131,7 @@ var QtiResponseDeclaration = class extends QtiVariableDeclaration {
1030
1131
  }
1031
1132
  render() {
1032
1133
  const value = this.itemContext?.variables.find((v) => v.identifier === this.identifier)?.value;
1033
- return html10`${JSON.stringify(value, null, 2)}`;
1134
+ return html11`${JSON.stringify(value, null, 2)}`;
1034
1135
  }
1035
1136
  connectedCallback() {
1036
1137
  super.connectedCallback();
@@ -1122,7 +1223,7 @@ __decorate7([
1122
1223
  ], QtiResponseDeclaration.prototype, "itemContext", void 0);
1123
1224
 
1124
1225
  // ../qti-elements/dist/components/qti-response-processing/qti-response-processing.js
1125
- import { css as css8, html as html11, LitElement as LitElement8 } from "lit";
1226
+ import { css as css9, html as html12, LitElement as LitElement9 } from "lit";
1126
1227
 
1127
1228
  // ../qti-elements/dist/internal/template-strings.js
1128
1229
  var matchCorrect = `<qti-response-condition>
@@ -1178,10 +1279,10 @@ var responseProcessingTemplates = {
1178
1279
  map_response_point: mapResponsePoint,
1179
1280
  match_correct: matchCorrect
1180
1281
  };
1181
- var QtiResponseProcessing = class extends LitElement8 {
1282
+ var QtiResponseProcessing = class extends LitElement9 {
1182
1283
  static {
1183
1284
  this.styles = [
1184
- css8`
1285
+ css9`
1185
1286
  :host {
1186
1287
  display: none;
1187
1288
  }
@@ -1189,7 +1290,7 @@ var QtiResponseProcessing = class extends LitElement8 {
1189
1290
  ];
1190
1291
  }
1191
1292
  render() {
1192
- return html11`<slot></slot>`;
1293
+ return html12`<slot></slot>`;
1193
1294
  }
1194
1295
  process() {
1195
1296
  const assessmentItem = this.closest("qti-assessment-item");
@@ -1218,7 +1319,7 @@ var QtiResponseProcessing = class extends LitElement8 {
1218
1319
  };
1219
1320
 
1220
1321
  // ../qti-elements/dist/components/qti-rubric-block/qti-rubric-block.js
1221
- import { LitElement as LitElement9, css as css9, html as html12 } from "lit";
1322
+ import { LitElement as LitElement10, css as css10, html as html13 } from "lit";
1222
1323
  import { property as property6 } from "lit/decorators.js";
1223
1324
  var __decorate8 = function(decorators, target, key, desc) {
1224
1325
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1226,20 +1327,14 @@ var __decorate8 = function(decorators, target, key, desc) {
1226
1327
  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;
1227
1328
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1228
1329
  };
1229
- var QtiRubricBlock = class extends LitElement9 {
1330
+ var QtiRubricBlock = class extends LitElement10 {
1230
1331
  handleclassNamesChange() {
1231
1332
  const classNames = this.classNames.split(" ");
1232
1333
  classNames.forEach((className) => {
1233
1334
  switch (className) {
1234
1335
  case "qti-rubric-discretionary-placement":
1235
1336
  {
1236
- const event = new CustomEvent("qti-rubric:discretionary-placement", {
1237
- detail: { className, element: this },
1238
- bubbles: true,
1239
- composed: true,
1240
- cancelable: true
1241
- });
1242
- const notCancelled = this.dispatchEvent(event);
1337
+ const notCancelled = dispatchPublic(this, "cito-item-rubric-placement", { className, element: this }, true);
1243
1338
  if (!notCancelled)
1244
1339
  return;
1245
1340
  this.setAttribute("slot", "qti-rubric-block");
@@ -1254,14 +1349,14 @@ var QtiRubricBlock = class extends LitElement9 {
1254
1349
  });
1255
1350
  }
1256
1351
  static {
1257
- this.styles = css9`
1352
+ this.styles = css10`
1258
1353
  :host {
1259
1354
  display: block;
1260
1355
  }
1261
1356
  `;
1262
1357
  }
1263
1358
  render() {
1264
- return html12`<slot></slot>`;
1359
+ return html13`<slot></slot>`;
1265
1360
  }
1266
1361
  };
1267
1362
  __decorate8([
@@ -1281,8 +1376,8 @@ __decorate8([
1281
1376
  ], QtiRubricBlock.prototype, "handleclassNamesChange", null);
1282
1377
 
1283
1378
  // ../qti-elements/dist/components/qti-stylesheet/qti-stylesheet.js
1284
- import { LitElement as LitElement10 } from "lit";
1285
- var QtiStylesheet = class extends LitElement10 {
1379
+ import { LitElement as LitElement11 } from "lit";
1380
+ var QtiStylesheet = class extends LitElement11 {
1286
1381
  #styleElement = null;
1287
1382
  firstUpdated(_changedProperties) {
1288
1383
  super.firstUpdated(_changedProperties);
@@ -1330,10 +1425,10 @@ var QtiStylesheet = class extends LitElement10 {
1330
1425
  };
1331
1426
 
1332
1427
  // ../qti-elements/dist/components/qti-template-constraint/qti-template-constraint.js
1333
- import { LitElement as LitElement11, html as html13 } from "lit";
1334
- var QtiTemplateConstraint = class extends LitElement11 {
1428
+ import { LitElement as LitElement12, html as html14 } from "lit";
1429
+ var QtiTemplateConstraint = class extends LitElement12 {
1335
1430
  render() {
1336
- return html13`<slot></slot>`;
1431
+ return html14`<slot></slot>`;
1337
1432
  }
1338
1433
  /**
1339
1434
  * Evaluates the constraint condition
@@ -1373,7 +1468,7 @@ var QtiTemplateConstraint = class extends LitElement11 {
1373
1468
  };
1374
1469
 
1375
1470
  // ../qti-elements/dist/components/qti-template-declaration/qti-template-declaration.js
1376
- import { css as css10, LitElement as LitElement12, html as html14 } from "lit";
1471
+ import { css as css11, LitElement as LitElement13, html as html15 } from "lit";
1377
1472
  import { property as property7 } from "lit/decorators.js";
1378
1473
  var __decorate9 = function(decorators, target, key, desc) {
1379
1474
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1381,7 +1476,7 @@ var __decorate9 = function(decorators, target, key, desc) {
1381
1476
  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;
1382
1477
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1383
1478
  };
1384
- var QtiTemplateDeclaration = class extends LitElement12 {
1479
+ var QtiTemplateDeclaration = class extends LitElement13 {
1385
1480
  constructor() {
1386
1481
  super(...arguments);
1387
1482
  this.identifier = "";
@@ -1394,7 +1489,7 @@ var QtiTemplateDeclaration = class extends LitElement12 {
1394
1489
  #defaultValue;
1395
1490
  static {
1396
1491
  this.styles = [
1397
- css10`
1492
+ css11`
1398
1493
  :host {
1399
1494
  display: none;
1400
1495
  }
@@ -1402,7 +1497,7 @@ var QtiTemplateDeclaration = class extends LitElement12 {
1402
1497
  ];
1403
1498
  }
1404
1499
  render() {
1405
- return html14`<slot></slot>`;
1500
+ return html15`<slot></slot>`;
1406
1501
  }
1407
1502
  connectedCallback() {
1408
1503
  super.connectedCallback();
@@ -1494,11 +1589,11 @@ __decorate9([
1494
1589
  ], QtiTemplateDeclaration.prototype, "paramVariable", void 0);
1495
1590
 
1496
1591
  // ../qti-elements/dist/components/qti-template-processing/qti-template-processing.js
1497
- import { css as css11, html as html15, LitElement as LitElement13 } from "lit";
1498
- var QtiTemplateProcessing = class extends LitElement13 {
1592
+ import { css as css12, html as html16, LitElement as LitElement14 } from "lit";
1593
+ var QtiTemplateProcessing = class extends LitElement14 {
1499
1594
  static {
1500
1595
  this.styles = [
1501
- css11`
1596
+ css12`
1502
1597
  :host {
1503
1598
  display: none;
1504
1599
  }
@@ -1508,7 +1603,7 @@ var QtiTemplateProcessing = class extends LitElement13 {
1508
1603
  #maxIterations = 100;
1509
1604
  // Prevent infinite loops in template constraints
1510
1605
  render() {
1511
- return html15`<slot></slot>`;
1606
+ return html16`<slot></slot>`;
1512
1607
  }
1513
1608
  /**
1514
1609
  * Process template rules to set template variable values
@@ -1562,6 +1657,7 @@ var QtiTemplateProcessing = class extends LitElement13 {
1562
1657
  // ../qti-elements/dist/elements.js
1563
1658
  var qtiContentElements = [
1564
1659
  { tag: "qti-assessment-item", ctor: QtiAssessmentItem },
1660
+ { tag: "qti-assessment-stimulus", ctor: QtiAssessmentStimulus },
1565
1661
  { tag: "qti-assessment-stimulus-ref", ctor: QtiAssessmentStimulusRef },
1566
1662
  { tag: "qti-companion-materials-info", ctor: QtiCompanionMaterialsInfo },
1567
1663
  { tag: "qti-content-body", ctor: QtiContentBody },
@@ -1582,7 +1678,13 @@ var qtiContentElements = [
1582
1678
  ];
1583
1679
 
1584
1680
  export {
1681
+ PUBLIC_ITEM_EVENTS,
1682
+ dispatchDeclared,
1683
+ listenDeclared,
1684
+ dispatchPublic,
1685
+ listenPublic,
1585
1686
  QtiAssessmentItem,
1687
+ QtiAssessmentStimulus,
1586
1688
  QtiAssessmentStimulusRefConnectedEvent,
1587
1689
  QtiAssessmentStimulusRef,
1588
1690
  QtiCompanionMaterialsInfo,
@@ -1603,4 +1705,4 @@ export {
1603
1705
  QtiTemplateProcessing,
1604
1706
  qtiContentElements
1605
1707
  };
1606
- //# sourceMappingURL=chunk-REKCRWJV.js.map
1708
+ //# sourceMappingURL=chunk-AWTQKBC4.js.map