@citolab/qti-components 9.5.0 → 9.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +1783 -226
  3. package/dist/base.d.ts +10 -10
  4. package/dist/base.js +7 -1
  5. package/dist/{chunk-GBZNFSFY.js → chunk-H72OXVRF.js} +2 -2
  6. package/dist/{chunk-RU6332MD.js → chunk-I7ACMH74.js} +3 -3
  7. package/dist/{chunk-DAFB2E5H.js → chunk-LOKULHVY.js} +386 -241
  8. package/dist/chunk-LOKULHVY.js.map +1 -0
  9. package/dist/{chunk-MI7774NV.js → chunk-QOFGUIYE.js} +2 -2
  10. package/dist/{chunk-TDWJ6WZA.js → chunk-QUTM5TT6.js} +37 -1
  11. package/dist/chunk-QUTM5TT6.js.map +1 -0
  12. package/dist/chunk-QVZLJY75.js +7 -0
  13. package/dist/chunk-QVZLJY75.js.map +1 -0
  14. package/dist/{chunk-SIE3E4FG.js → chunk-RGBQ65Y2.js} +18 -6
  15. package/dist/{chunk-SIE3E4FG.js.map → chunk-RGBQ65Y2.js.map} +1 -1
  16. package/dist/{chunk-SU63QGGD.js → chunk-RTS3JSEM.js} +6 -6
  17. package/dist/{chunk-FD4AB6TM.js → chunk-RV7ADJ33.js} +2 -2
  18. package/dist/{chunk-OQDBARD5.js → chunk-SUMSMTZJ.js} +2 -2
  19. package/dist/{chunk-6U3YPHXU.js → chunk-TFQAUWCM.js} +40 -5
  20. package/dist/{chunk-6U3YPHXU.js.map → chunk-TFQAUWCM.js.map} +1 -1
  21. package/dist/{chunk-6K3QWJHH.js → chunk-V3NKEAQY.js} +40 -4
  22. package/dist/chunk-V3NKEAQY.js.map +1 -0
  23. package/dist/{chunk-YZRODVYZ.js → chunk-YS6CBO45.js} +2 -2
  24. package/dist/{computed.types.d-gJrBeUMG.d.ts → computed.types.d-SsTm3ieP.d.ts} +1 -1
  25. package/dist/corrections.d.ts +9 -9
  26. package/dist/corrections.js +8 -8
  27. package/dist/elements.d.ts +2 -2
  28. package/dist/elements.js +3 -3
  29. package/dist/index.d.ts +10 -10
  30. package/dist/index.js +25 -13
  31. package/dist/interactions.d.ts +4 -4
  32. package/dist/interactions.js +7 -3
  33. package/dist/item.css +2 -1
  34. package/dist/item.d.ts +4 -4
  35. package/dist/item.js +4 -4
  36. package/dist/{item.types.d-B55QkJ92.d.ts → item.types.d-DuVR0ZVK.d.ts} +7 -1
  37. package/dist/loader.d.ts +2 -2
  38. package/dist/processing.d.ts +10 -3
  39. package/dist/processing.js +3 -3
  40. package/dist/qti-components-jsx.d.ts +47 -26
  41. package/dist/{qti-condition-expression.d-VJH6cWxf.d.ts → qti-condition-expression.d-B-T1NNl0.d.ts} +1 -1
  42. package/dist/{qti-expression.d-BPxEp8HU.d.ts → qti-expression.d-B-Cfbqlb.d.ts} +1 -1
  43. package/dist/{qti-feedback.d-wMYNVkkj.d.ts → qti-feedback.d-DbzPSJuK.d.ts} +1 -1
  44. package/dist/{qti-item.d-DgC1AQbY.d.ts → qti-item.d-DjWvKbfL.d.ts} +1 -1
  45. package/dist/{qti-test.d-86TlaMlI.d.ts → qti-test.d-ClQtDdgx.d.ts} +10 -5
  46. package/dist/{qti-text-entry-interaction.d-C4eixT-D.d.ts → qti-text-entry-interaction.d-h5UZ8Qvp.d.ts} +28 -18
  47. package/dist/{interaction.d-g6XG0T0Z.d.ts → record.d-wB9uYs-j.d.ts} +34 -2
  48. package/dist/{session.context.d-D5080LVx.d.ts → session.context.d-Cw8GcziG.d.ts} +1 -1
  49. package/dist/test.d.ts +7 -7
  50. package/dist/test.js +7 -5
  51. package/package.json +6 -6
  52. package/dist/chunk-6K3QWJHH.js.map +0 -1
  53. package/dist/chunk-DAFB2E5H.js.map +0 -1
  54. package/dist/chunk-TDWJ6WZA.js.map +0 -1
  55. package/dist/chunk-ZP6QQYSU.js +0 -7
  56. package/dist/chunk-ZP6QQYSU.js.map +0 -1
  57. /package/dist/{chunk-GBZNFSFY.js.map → chunk-H72OXVRF.js.map} +0 -0
  58. /package/dist/{chunk-RU6332MD.js.map → chunk-I7ACMH74.js.map} +0 -0
  59. /package/dist/{chunk-MI7774NV.js.map → chunk-QOFGUIYE.js.map} +0 -0
  60. /package/dist/{chunk-SU63QGGD.js.map → chunk-RTS3JSEM.js.map} +0 -0
  61. /package/dist/{chunk-FD4AB6TM.js.map → chunk-RV7ADJ33.js.map} +0 -0
  62. /package/dist/{chunk-OQDBARD5.js.map → chunk-SUMSMTZJ.js.map} +0 -0
  63. /package/dist/{chunk-YZRODVYZ.js.map → chunk-YS6CBO45.js.map} +0 -0
@@ -2,10 +2,10 @@ import {
2
2
  QtiTest,
3
3
  TestCheckItem,
4
4
  TestNavigation
5
- } from "./chunk-SIE3E4FG.js";
5
+ } from "./chunk-RGBQ65Y2.js";
6
6
  import {
7
7
  QtiAssessmentItem
8
- } from "./chunk-6U3YPHXU.js";
8
+ } from "./chunk-TFQAUWCM.js";
9
9
  import {
10
10
  QtiAssociateInteraction,
11
11
  QtiChoiceInteraction,
@@ -28,10 +28,10 @@ import {
28
28
  QtiSimpleChoice,
29
29
  QtiSliderInteraction,
30
30
  QtiTextEntryInteraction
31
- } from "./chunk-DAFB2E5H.js";
31
+ } from "./chunk-LOKULHVY.js";
32
32
  import {
33
33
  QtiItem
34
- } from "./chunk-RU6332MD.js";
34
+ } from "./chunk-I7ACMH74.js";
35
35
  import {
36
36
  watch
37
37
  } from "./chunk-4DB4SC5K.js";
@@ -41,7 +41,7 @@ import {
41
41
  computedItemContext,
42
42
  configContext,
43
43
  responseAttributeConverter
44
- } from "./chunk-TDWJ6WZA.js";
44
+ } from "./chunk-QUTM5TT6.js";
45
45
 
46
46
  // ../qti-corrections/dist/components/item-correct-response-mode/item-correct-response-mode.js
47
47
  import { html, LitElement } from "lit";
@@ -1661,4 +1661,4 @@ export {
1661
1661
  QtiTestCorrection,
1662
1662
  TestCheckItemCorrection
1663
1663
  };
1664
- //# sourceMappingURL=chunk-SU63QGGD.js.map
1664
+ //# sourceMappingURL=chunk-RTS3JSEM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  qtiItemElements
3
- } from "./chunk-RU6332MD.js";
3
+ } from "./chunk-I7ACMH74.js";
4
4
 
5
5
  // ../qti-item/dist/register.js
6
6
  for (const { tag, ctor } of qtiItemElements) {
@@ -8,4 +8,4 @@ for (const { tag, ctor } of qtiItemElements) {
8
8
  customElements.define(tag, ctor);
9
9
  }
10
10
  }
11
- //# sourceMappingURL=chunk-FD4AB6TM.js.map
11
+ //# sourceMappingURL=chunk-RV7ADJ33.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  qtiTestElements
3
- } from "./chunk-SIE3E4FG.js";
3
+ } from "./chunk-RGBQ65Y2.js";
4
4
 
5
5
  // ../qti-test/dist/register.js
6
6
  for (const { tag, ctor } of qtiTestElements) {
@@ -8,4 +8,4 @@ for (const { tag, ctor } of qtiTestElements) {
8
8
  customElements.define(tag, ctor);
9
9
  }
10
10
  }
11
- //# sourceMappingURL=chunk-OQDBARD5.js.map
11
+ //# sourceMappingURL=chunk-SUMSMTZJ.js.map
@@ -10,8 +10,9 @@ import {
10
10
  QtiVariableDeclaration,
11
11
  getCustomOperator,
12
12
  itemContext,
13
- itemContextVariables
14
- } from "./chunk-TDWJ6WZA.js";
13
+ itemContextVariables,
14
+ readRecordFieldValues
15
+ } from "./chunk-QUTM5TT6.js";
15
16
 
16
17
  // ../qti-elements/dist/public-events.js
17
18
  var PUBLIC_ITEM_EVENTS = {
@@ -1135,11 +1136,13 @@ var QtiResponseDeclaration = class extends QtiVariableDeclaration {
1135
1136
  }
1136
1137
  connectedCallback() {
1137
1138
  super.connectedCallback();
1138
- const defaultValue = this.defaultValues(this.cardinality);
1139
+ const defaultValue = this.cardinality === "record" ? this.#recordDefaultValue : this.defaultValues(this.cardinality);
1140
+ const { correctResponse, fieldBaseTypes } = this.#readCorrectResponse();
1139
1141
  const responseVariable = {
1140
1142
  baseType: this.baseType,
1141
1143
  identifier: this.identifier,
1142
- correctResponse: this.#correctResponse,
1144
+ correctResponse,
1145
+ ...fieldBaseTypes ? { fieldBaseTypes } : {},
1143
1146
  cardinality: this.cardinality || "single",
1144
1147
  mapping: this.#mapping,
1145
1148
  defaultValue,
@@ -1155,6 +1158,38 @@ var QtiResponseDeclaration = class extends QtiVariableDeclaration {
1155
1158
  detail: { variable: responseVariable }
1156
1159
  }));
1157
1160
  }
1161
+ /**
1162
+ * The correct response, and for `record` cardinality the declared base type of each field.
1163
+ *
1164
+ * A record's correct response is a field map, `{ time: '4.0', point: '460 245' }`, read from
1165
+ * `qti-value field-identifier="…" base-type="…"`. The field base types are kept beside it, since
1166
+ * the record declaration itself has no `base-type` to say how a field is to be compared.
1167
+ */
1168
+ #readCorrectResponse() {
1169
+ if (this.cardinality !== "record") {
1170
+ return { correctResponse: this.#correctResponse };
1171
+ }
1172
+ const correctResponse = this.querySelector("qti-correct-response");
1173
+ if (!correctResponse) {
1174
+ return { correctResponse: void 0 };
1175
+ }
1176
+ const values = Array.from(correctResponse.querySelectorAll("qti-value"));
1177
+ const { value, baseTypes } = readRecordFieldValues(values);
1178
+ values.forEach((element) => element.remove());
1179
+ return {
1180
+ // The variable types hold string | string[]; a record is stored as its field map.
1181
+ correctResponse: Object.keys(value).length ? value : void 0,
1182
+ fieldBaseTypes: baseTypes
1183
+ };
1184
+ }
1185
+ /** A record's `qti-default-value`, as a field map like its correct response. */
1186
+ get #recordDefaultValue() {
1187
+ const values = this.querySelectorAll("qti-default-value > qti-value");
1188
+ if (values.length === 0)
1189
+ return null;
1190
+ const { value } = readRecordFieldValues(values);
1191
+ return Object.keys(value).length ? value : null;
1192
+ }
1158
1193
  get #correctResponse() {
1159
1194
  let result;
1160
1195
  const correctResponse = this.querySelector("qti-correct-response");
@@ -1705,4 +1740,4 @@ export {
1705
1740
  QtiTemplateProcessing,
1706
1741
  qtiContentElements
1707
1742
  };
1708
- //# sourceMappingURL=chunk-6U3YPHXU.js.map
1743
+ //# sourceMappingURL=chunk-TFQAUWCM.js.map