@citolab/qti-components 7.0.6-beta.2 → 7.0.6-beta.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 (123) hide show
  1. package/cdn/chunks/{chunk-MJMONWKB.js → chunk-4ILXLVT5.js} +8 -2
  2. package/cdn/chunks/chunk-4PEUIMDK.js +8 -0
  3. package/cdn/chunks/chunk-H2V2RXUW.js +11 -0
  4. package/cdn/chunks/chunk-IQZ7AOCQ.js +8 -0
  5. package/cdn/chunks/chunk-J3JSSCM6.js +5 -0
  6. package/cdn/chunks/chunk-LARBLB7K.js +8 -0
  7. package/cdn/chunks/chunk-PPWEIKLT.js +1 -0
  8. package/cdn/chunks/{chunk-4WXQYE2P.js → chunk-PT523RSK.js} +2 -2
  9. package/cdn/chunks/chunk-QTK4CPHP.js +8 -0
  10. package/cdn/chunks/{chunk-7XYBFL7U.js → chunk-SXM25YH3.js} +89 -89
  11. package/cdn/chunks/chunk-UJP4TGD3.js +1 -0
  12. package/cdn/chunks/{chunk-6S4CDN3T.js → chunk-YHWMZAZD.js} +2 -2
  13. package/cdn/chunks/{chunk-TQBDBMWL.js → chunk-YWH4TGMA.js} +1 -1
  14. package/cdn/exports/interaction.js +1 -1
  15. package/cdn/index.global.js +1 -1
  16. package/cdn/index.js +1 -1
  17. package/cdn/qti-components/index.js +1 -1
  18. package/cdn/qti-item/core/index.js +1 -1
  19. package/cdn/qti-test/components/index.js +1 -1
  20. package/cdn/qti-test/components/test-component.abstract.js +1 -1
  21. package/cdn/qti-test/components/test-end-attempt.js +1 -0
  22. package/cdn/qti-test/components/test-item-link.js +1 -1
  23. package/cdn/qti-test/components/test-next.js +1 -1
  24. package/cdn/qti-test/components/test-paging-buttons-stamp.js +1 -1
  25. package/cdn/qti-test/components/test-prev.js +1 -1
  26. package/cdn/qti-test/components/test-show-correct-response.js +1 -0
  27. package/cdn/qti-test/components/test-view.js +1 -1
  28. package/cdn/qti-test/core/index.js +1 -1
  29. package/dist/chunks/{chunk-GSWZT6N2.js → chunk-4MQV5IRV.js} +12 -3
  30. package/dist/chunks/chunk-4MQV5IRV.js.map +1 -0
  31. package/dist/chunks/{chunk-6JXR63MH.js → chunk-5RTLOB3Q.js} +12 -3
  32. package/dist/chunks/chunk-5RTLOB3Q.js.map +1 -0
  33. package/dist/chunks/{chunk-UFYWCLXF.js → chunk-AUWATZ65.js} +1 -1
  34. package/dist/chunks/{chunk-UFYWCLXF.js.map → chunk-AUWATZ65.js.map} +1 -1
  35. package/dist/chunks/{chunk-7QMCKYDR.js → chunk-CEXAR7BF.js} +13 -4
  36. package/dist/chunks/chunk-CEXAR7BF.js.map +1 -0
  37. package/dist/chunks/chunk-DNHDFXTV.js +59 -0
  38. package/dist/chunks/chunk-DNHDFXTV.js.map +1 -0
  39. package/dist/chunks/chunk-GQ5P3NWC.js +46 -0
  40. package/dist/chunks/chunk-GQ5P3NWC.js.map +1 -0
  41. package/dist/chunks/chunk-HOTNM5DT.js +1 -0
  42. package/dist/chunks/{chunk-K6ATVWMP.js → chunk-MEQM6M67.js} +96 -124
  43. package/dist/chunks/chunk-MEQM6M67.js.map +1 -0
  44. package/dist/chunks/{chunk-3EU75IUF.js → chunk-MLT7V47R.js} +3 -21
  45. package/dist/chunks/chunk-MLT7V47R.js.map +1 -0
  46. package/dist/chunks/chunk-NHA53UTY.js +52 -0
  47. package/dist/chunks/chunk-NHA53UTY.js.map +1 -0
  48. package/dist/chunks/{chunk-J2SHENRN.js → chunk-NZQKGIJP.js} +9 -3
  49. package/dist/chunks/{chunk-J2SHENRN.js.map → chunk-NZQKGIJP.js.map} +1 -1
  50. package/dist/chunks/{chunk-ZPNJ2HP5.js → chunk-OIRWOI3E.js} +2 -1
  51. package/dist/chunks/chunk-OIRWOI3E.js.map +1 -0
  52. package/dist/chunks/chunk-RX3BRYYI.js +59 -0
  53. package/dist/chunks/chunk-RX3BRYYI.js.map +1 -0
  54. package/dist/chunks/chunk-VAPB5TN4.js +46 -0
  55. package/dist/chunks/chunk-VAPB5TN4.js.map +1 -0
  56. package/dist/chunks/chunk-W4272Q5U.js +46 -0
  57. package/dist/chunks/chunk-W4272Q5U.js.map +1 -0
  58. package/dist/chunks/{chunk-A24F75DB.js → chunk-WWN5AD6V.js} +11 -2
  59. package/dist/chunks/chunk-WWN5AD6V.js.map +1 -0
  60. package/dist/chunks/{chunk-HHVRU3AJ.js → chunk-XCHS3RTZ.js} +2 -2
  61. package/dist/chunks/{chunk-KYAIMBP5.js → chunk-YQB6YLNW.js} +3 -3
  62. package/dist/chunks/chunk-YQB6YLNW.js.map +1 -0
  63. package/dist/chunks/chunk-Z5THRO6Z.js +46 -0
  64. package/dist/chunks/chunk-Z5THRO6Z.js.map +1 -0
  65. package/dist/chunks/{chunk-4GNVYCBN.js → chunk-ZQXZ6PK7.js} +92 -70
  66. package/dist/chunks/chunk-ZQXZ6PK7.js.map +1 -0
  67. package/dist/exports/interaction.js +1 -1
  68. package/dist/index.d.ts +4 -2
  69. package/dist/index.js +21 -13
  70. package/dist/item.css +8 -2
  71. package/dist/qti-components/index.d.ts +2 -2
  72. package/dist/qti-components/index.js +2 -2
  73. package/dist/qti-components-jsx.d.ts +62 -46
  74. package/dist/qti-item/core/index.js +2 -2
  75. package/dist/qti-loader/index.d.ts +1 -1
  76. package/dist/{qti-response-declaration-DAeBp8HH.d.ts → qti-response-declaration-Di9CsqiJ.d.ts} +4 -0
  77. package/dist/qti-test/components/index.d.ts +4 -2
  78. package/dist/qti-test/components/index.js +16 -8
  79. package/dist/qti-test/components/test-component.abstract.d.ts +2 -4
  80. package/dist/qti-test/components/test-component.abstract.js +2 -2
  81. package/dist/qti-test/components/test-end-attempt.d.ts +26 -0
  82. package/dist/qti-test/components/test-end-attempt.js +13 -0
  83. package/dist/qti-test/components/test-end-attempt.js.map +1 -0
  84. package/dist/qti-test/components/test-item-link.d.ts +3 -2
  85. package/dist/qti-test/components/test-item-link.js +3 -3
  86. package/dist/qti-test/components/test-next.d.ts +3 -2
  87. package/dist/qti-test/components/test-next.js +3 -3
  88. package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +2 -2
  89. package/dist/qti-test/components/test-paging-buttons-stamp.js +3 -3
  90. package/dist/qti-test/components/test-prev.d.ts +3 -2
  91. package/dist/qti-test/components/test-prev.js +3 -3
  92. package/dist/qti-test/components/test-show-correct-response.d.ts +26 -0
  93. package/dist/qti-test/components/test-show-correct-response.js +13 -0
  94. package/dist/qti-test/components/test-show-correct-response.js.map +1 -0
  95. package/dist/qti-test/components/test-view.d.ts +3 -2
  96. package/dist/qti-test/components/test-view.js +3 -3
  97. package/dist/qti-test/core/index.d.ts +6 -6
  98. package/dist/qti-test/core/index.js +3 -3
  99. package/dist/{test.context-CaENAJNk.d.ts → test.context-CmsDQ8k2.d.ts} +3 -5
  100. package/dist/vscode.html-custom-data.json +36 -17
  101. package/package.json +1 -1
  102. package/cdn/chunks/chunk-3V6LA7B3.js +0 -8
  103. package/cdn/chunks/chunk-5P7CTN7Q.js +0 -11
  104. package/cdn/chunks/chunk-DZCKF45D.js +0 -5
  105. package/cdn/chunks/chunk-IMJOPCFR.js +0 -1
  106. package/cdn/chunks/chunk-N5OHGRGG.js +0 -8
  107. package/cdn/chunks/chunk-NDHSIO2G.js +0 -8
  108. package/cdn/chunks/chunk-PKT2SJQD.js +0 -8
  109. package/cdn/chunks/chunk-QV6I5NVQ.js +0 -8
  110. package/cdn/chunks/chunk-R33OODNX.js +0 -1
  111. package/dist/chunks/chunk-3EU75IUF.js.map +0 -1
  112. package/dist/chunks/chunk-4GNVYCBN.js.map +0 -1
  113. package/dist/chunks/chunk-6JXR63MH.js.map +0 -1
  114. package/dist/chunks/chunk-7QMCKYDR.js.map +0 -1
  115. package/dist/chunks/chunk-A24F75DB.js.map +0 -1
  116. package/dist/chunks/chunk-GSWZT6N2.js.map +0 -1
  117. package/dist/chunks/chunk-K6ATVWMP.js.map +0 -1
  118. package/dist/chunks/chunk-KYAIMBP5.js.map +0 -1
  119. package/dist/chunks/chunk-UN2IFSGC.js +0 -1
  120. package/dist/chunks/chunk-ZPNJ2HP5.js.map +0 -1
  121. /package/cdn/chunks/{chunk-3GO57DNP.js → chunk-6PW2L463.js} +0 -0
  122. /package/dist/chunks/{chunk-UN2IFSGC.js.map → chunk-HOTNM5DT.js.map} +0 -0
  123. /package/dist/chunks/{chunk-HHVRU3AJ.js.map → chunk-XCHS3RTZ.js.map} +0 -0
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-ELDMXTUQ.js";
10
10
  import {
11
11
  Interaction
12
- } from "./chunk-ZPNJ2HP5.js";
12
+ } from "./chunk-OIRWOI3E.js";
13
13
  import {
14
14
  itemContextVariables
15
15
  } from "./chunk-DLUJN2FW.js";
@@ -61,13 +61,13 @@ var QtiAssessmentItem = class extends LitElement {
61
61
  feedbackElement.checkShowFeedback(feedbackElement.outcomeIdentifier);
62
62
  }
63
63
  });
64
- this.addEventListener("qti-register-interaction", (e) => {
65
- e.stopPropagation();
66
- const composedPath = e.composedPath();
67
- if (e.composedPath.length === 1) {
68
- this._interactionElements.push(composedPath[0]);
64
+ this.addEventListener(
65
+ "qti-register-interaction",
66
+ (e) => {
67
+ e.stopPropagation();
68
+ this._interactionElements.push(e.detail.interactionElement);
69
69
  }
70
- });
70
+ );
71
71
  this.addEventListener("end-attempt", (e) => {
72
72
  const { responseIdentifier, countAttempt } = e.detail;
73
73
  this.validate();
@@ -145,22 +145,23 @@ var QtiAssessmentItem = class extends LitElement {
145
145
  render() {
146
146
  return html`<slot></slot>`;
147
147
  }
148
+ /**
149
+ * Toggles the display of correct responses for interactions.
150
+ * @param show - A boolean indicating whether to show or hide correct responses.
151
+ */
148
152
  showCorrectResponse(show) {
149
- const responseVariables = this._context.variables.filter(
150
- (vari) => "correctResponse" in vari && vari.correctResponse
151
- );
152
- const responses = responseVariables.map((cr) => {
153
- return {
154
- responseIdentifier: cr.identifier,
155
- response: cr.correctResponse
156
- };
157
- });
158
- for (const response of responses) {
153
+ const responses = this._context.variables.filter(
154
+ (variable) => "correctResponse" in variable && variable.correctResponse
155
+ ).map((variable) => ({
156
+ responseIdentifier: variable.identifier,
157
+ response: variable.correctResponse || ""
158
+ }));
159
+ for (const { responseIdentifier, response } of responses) {
159
160
  const interaction = this._interactionElements.find(
160
- (i) => i.getAttribute("response-identifier") === response.responseIdentifier
161
+ (element) => element.getAttribute("response-identifier") === responseIdentifier
161
162
  );
162
163
  if (interaction) {
163
- interaction.correctResponse = show ? response.response : "";
164
+ interaction.correctResponse = show ? response : "";
164
165
  }
165
166
  }
166
167
  }
@@ -744,7 +745,7 @@ var FlippablesMixin = (superClass, _droppablesSel, _draggablesSel) => {
744
745
 
745
746
  // src/lib/qti-components/qti-interaction/internal/drag-drop/drag-drop-interaction-mixin.ts
746
747
  import { property as property4 } from "lit/decorators.js";
747
- var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector, appendClone = "default") => {
748
+ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelector, dragContainersSelector) => {
748
749
  class DragDropInteractionElement extends FlippablesMixin(
749
750
  superClass,
750
751
  droppablesSelector,
@@ -771,14 +772,10 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
771
772
  // Offset for positioning the drag clone
772
773
  this.isDragging = false;
773
774
  // Whether a drag operation is ongoing
774
- this.rootNode = null;
775
- // Root node for boundary calculations
776
775
  this.allDropzones = [];
777
776
  // All dropzones for keyboard navigation
778
777
  this.lastTarget = null;
779
778
  // Last touch target
780
- this.dropzoneOriginalParent = null;
781
- // Original parent of the drag clone
782
779
  this.currentDropTarget = null;
783
780
  // Current droppable element
784
781
  this.MIN_DRAG_DISTANCE = 5;
@@ -1051,10 +1048,6 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1051
1048
  }
1052
1049
  handleTouchEnd(e) {
1053
1050
  if (this.isDragging) {
1054
- if (this.currentDropTarget) {
1055
- const draggable = this.dragClone;
1056
- this.moveDraggableToDroppable(draggable, this.currentDropTarget);
1057
- }
1058
1051
  this.resetDragState();
1059
1052
  }
1060
1053
  this._internals.states.delete("--dragzone-active");
@@ -1063,7 +1056,9 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1063
1056
  this._internals.states.delete("--dragzone-active");
1064
1057
  this.deactivateDragLocation();
1065
1058
  this.deactivateDroppables();
1066
- this.dragClone.removeAttribute("dragging");
1059
+ this.draggables.forEach((d) => {
1060
+ d.removeAttribute("dragging");
1061
+ });
1067
1062
  e.preventDefault();
1068
1063
  }
1069
1064
  handleTouchCancel(_e) {
@@ -1109,21 +1104,20 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1109
1104
  if (this.dragClone) {
1110
1105
  const isDropped = this.currentDropTarget !== null;
1111
1106
  const droppedInDragContainer = !isDropped || this.dragContainers.includes(this.currentDropTarget);
1112
- if (!droppedInDragContainer) {
1113
- const computedStyles = window.getComputedStyle(this.dragSource);
1114
- for (let i = 0; i < computedStyles.length; i++) {
1115
- const key = computedStyles[i];
1116
- this.dragClone.style.setProperty(key, computedStyles.getPropertyValue(key));
1117
- }
1118
- this.dragClone.style.opacity = "1.0";
1119
- this.dragClone.style.display = "block";
1120
- this.dragClone.style.pointerEvents = "auto";
1121
- } else {
1107
+ if (isDropped && this.currentDropTarget && !droppedInDragContainer) {
1108
+ const cleanClone = this.dragSource.cloneNode(true);
1109
+ cleanClone.removeAttribute("style");
1110
+ this.currentDropTarget.appendChild(cleanClone);
1111
+ this.draggablesModified([cleanClone], []);
1112
+ }
1113
+ if (droppedInDragContainer) {
1122
1114
  this.dragSource.style.opacity = "1.0";
1123
1115
  this.dragSource.style.display = "block";
1116
+ this.dragSource.style.position = "static";
1124
1117
  this.dragSource.style.pointerEvents = "auto";
1125
- this.dragClone.remove();
1126
1118
  }
1119
+ this.dragClone.remove();
1120
+ this.draggablesModified([], [this.dragClone]);
1127
1121
  }
1128
1122
  this.isDragging = false;
1129
1123
  this.isDraggable = false;
@@ -1132,6 +1126,7 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1132
1126
  this.touchStartPoint = null;
1133
1127
  this.currentDropTarget = null;
1134
1128
  this.lastTarget = null;
1129
+ this.deactivateDroppables();
1135
1130
  }
1136
1131
  checkAllMaxAssociations() {
1137
1132
  this.droppables.forEach((d) => {
@@ -1199,7 +1194,6 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1199
1194
  return this.droppables.filter((d) => d.childElementCount > 0).length;
1200
1195
  }
1201
1196
  saveResponse() {
1202
- this.validate();
1203
1197
  const response = this.collectResponseData();
1204
1198
  this.dispatchEvent(
1205
1199
  new CustomEvent("qti-interaction-response", {
@@ -1228,10 +1222,23 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1228
1222
  if (!this.isDragging || !this.dragClone) return;
1229
1223
  const newLeft = touch.clientX - this.cloneOffset.x;
1230
1224
  const newTop = touch.clientY - this.cloneOffset.y;
1231
- const { newLeft: boundedLeft, newTop: boundedTop } = this.applyBoundaries(newLeft, newTop, this.dragClone);
1225
+ const { newLeft: boundedLeft, newTop: boundedTop } = this.applyInteractionBoundaries(
1226
+ newLeft,
1227
+ newTop,
1228
+ this.dragClone
1229
+ );
1232
1230
  this.dragClone.style.left = `${boundedLeft}px`;
1233
1231
  this.dragClone.style.top = `${boundedTop}px`;
1234
1232
  }
1233
+ applyInteractionBoundaries(newLeft, newTop, element) {
1234
+ const interactionRect = this.getBoundingClientRect();
1235
+ const elementRect = element.getBoundingClientRect();
1236
+ const elementWidth = elementRect.width;
1237
+ const elementHeight = elementRect.height;
1238
+ const boundedLeft = Math.max(interactionRect.left, Math.min(newLeft, interactionRect.right - elementWidth));
1239
+ const boundedTop = Math.max(interactionRect.top, Math.min(newTop, interactionRect.bottom - elementHeight));
1240
+ return { newLeft: boundedLeft, newTop: boundedTop };
1241
+ }
1235
1242
  getEventCoordinates(event, page = false) {
1236
1243
  const touch = event.touches ? event.touches[0] : event;
1237
1244
  return {
@@ -1244,20 +1251,6 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1244
1251
  const yDist = Math.abs(touch.clientY - this.touchStartPoint.y);
1245
1252
  return xDist + yDist;
1246
1253
  }
1247
- applyBoundaries(newLeft, newTop, element) {
1248
- let boundaryRect = new DOMRect(0, 0, window.innerWidth, window.innerHeight);
1249
- if (this.rootNode instanceof ShadowRoot) {
1250
- boundaryRect = this.rootNode.host.getBoundingClientRect();
1251
- } else if (this.rootNode instanceof Document) {
1252
- boundaryRect = document.documentElement.getBoundingClientRect();
1253
- }
1254
- const elementRect = element.getBoundingClientRect();
1255
- const elementWidth = elementRect.width;
1256
- const elementHeight = elementRect.height;
1257
- const boundedLeft = Math.max(boundaryRect.left, Math.min(newLeft, boundaryRect.right - elementWidth));
1258
- const boundedTop = Math.max(boundaryRect.top, Math.min(newTop, boundaryRect.bottom - elementHeight));
1259
- return { newLeft: boundedLeft, newTop: boundedTop };
1260
- }
1261
1254
  findClosestDropzone() {
1262
1255
  const allActiveDropzones = this.allDropzones.filter((d) => !d.hasAttribute("disabled"));
1263
1256
  if (!this.dragClone || allActiveDropzones.length === 0) return null;
@@ -1299,82 +1292,61 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1299
1292
  element.dispatchEvent(event);
1300
1293
  }
1301
1294
  appendClone() {
1302
- const interaction = this.findParentInteractionElement(this.dragSource);
1303
- if (appendClone == "default") {
1304
- if (interaction) {
1305
- interaction.appendChild(this.dragClone);
1306
- } else if (this.rootNode instanceof ShadowRoot) {
1307
- this.rootNode.host.appendChild(this.dragClone);
1308
- } else if (this.rootNode instanceof Document) {
1309
- document.body.appendChild(this.dragClone);
1310
- }
1311
- } else if (appendClone == "interaction") {
1312
- if (interaction) {
1313
- interaction.appendChild(this.dragClone);
1314
- } else {
1315
- console.error("No interaction found to append the drag clone");
1316
- }
1317
- } else if (appendClone == "host") {
1318
- if (this.rootNode instanceof ShadowRoot) {
1319
- this.rootNode.host.appendChild(this.dragClone);
1320
- } else {
1321
- console.error("No host found to append the drag clone");
1322
- }
1323
- } else if (appendClone == "body") {
1324
- document.body.appendChild(this.dragClone);
1325
- }
1295
+ document.body.appendChild(this.dragClone);
1326
1296
  }
1327
1297
  handleTouchStart(e) {
1298
+ if (this.isDragging) {
1299
+ return;
1300
+ }
1328
1301
  const { x, y } = this.getEventCoordinates(e);
1329
- this.dropzoneOriginalParent = e.currentTarget.parentElement;
1330
1302
  this.touchStartPoint = { x, y };
1331
1303
  this.dragSource = e.currentTarget;
1332
1304
  this.isDraggable = true;
1333
- this.rootNode = this.dragSource.getRootNode();
1334
1305
  this._internals.states.add("--dragzone-enabled");
1335
1306
  this._internals.states.add("--dragzone-active");
1336
- this.dragSource.setAttribute("dragging", "");
1337
1307
  this.activateDragLocation();
1338
1308
  this.activateDroppables(this.dragSource);
1339
1309
  const draggableInDragContainer = this.findDraggableInDraggableContainer(
1340
1310
  this.dragSource.getAttribute("identifier")
1341
1311
  );
1342
- const parent = this.dragSource.parentElement;
1343
- if (!this.droppables.includes(parent)) {
1344
- const rect = draggableInDragContainer.getBoundingClientRect();
1345
- this.cloneOffset.x = x - rect.left;
1346
- this.cloneOffset.y = y - rect.top;
1347
- this.dragClone = draggableInDragContainer.cloneNode(true);
1348
- const computedStyles = window.getComputedStyle(this.dragSource);
1349
- for (let i = 0; i < computedStyles.length; i++) {
1350
- const key = computedStyles[i];
1351
- this.dragClone.style.setProperty(key, computedStyles.getPropertyValue(key));
1352
- }
1353
- if (rect) {
1354
- this.setDragCloneStyles(rect);
1355
- }
1356
- this.appendClone();
1357
- const matchMax = this.getMatchMaxValue(this.dragSource);
1358
- const currentDraggables = this.draggables.filter(
1359
- (d) => d.getAttribute("identifier") === this.dragSource.getAttribute("identifier")
1360
- );
1361
- if (matchMax !== 0 && currentDraggables.length >= matchMax) {
1362
- draggableInDragContainer.style.opacity = "0.0";
1363
- draggableInDragContainer.style.pointerEvents = "none";
1364
- } else {
1365
- draggableInDragContainer.style.opacity = "1.0";
1366
- }
1367
- e.preventDefault();
1312
+ const draggedFromDropzone = this.droppables.some(
1313
+ (d) => Array.from(d.children).some((child) => child === this.dragSource)
1314
+ );
1315
+ const rect = this.dragSource.getBoundingClientRect();
1316
+ if (draggedFromDropzone) {
1317
+ this.dragSource.remove();
1318
+ this.draggablesModified([], [this.dragSource]);
1319
+ this.dragSource = draggableInDragContainer;
1320
+ }
1321
+ this.cloneOffset.x = x - rect.left;
1322
+ this.cloneOffset.y = y - rect.top;
1323
+ this.dragClone = draggableInDragContainer.cloneNode(true);
1324
+ const computedStyles = window.getComputedStyle(draggableInDragContainer);
1325
+ for (let i = 0; i < computedStyles.length; i++) {
1326
+ const key = computedStyles[i];
1327
+ this.dragClone.style.setProperty(key, computedStyles.getPropertyValue(key));
1328
+ }
1329
+ const rectOrg = draggableInDragContainer.getBoundingClientRect();
1330
+ this.dragClone.style.width = `${rectOrg.width}px`;
1331
+ this.dragClone.style.height = `${rectOrg.height}px`;
1332
+ if (rect) {
1333
+ this.setDragCloneStyles(rect);
1334
+ }
1335
+ this.dragClone.style.display = "block";
1336
+ this.dragClone.style.opacity = "1";
1337
+ this.appendClone();
1338
+ const matchMax = this.getMatchMaxValue(this.dragSource);
1339
+ const currentDraggables = this.draggables.filter(
1340
+ (d) => d.getAttribute("identifier") === this.dragSource.getAttribute("identifier")
1341
+ );
1342
+ if (matchMax !== 0 && currentDraggables.length >= matchMax) {
1343
+ draggableInDragContainer.style.opacity = "0.0";
1344
+ draggableInDragContainer.style.pointerEvents = "none";
1368
1345
  } else {
1369
- this.enableDroppable(parent);
1370
- this.dragClone = this.dragSource;
1371
- this.dragSource = this.findDraggableInDraggableContainer(this.dragSource.getAttribute("identifier"));
1372
- const rect = this.dragClone.getBoundingClientRect();
1373
- this.appendClone();
1374
- if (rect) {
1375
- this.setDragCloneStyles(rect);
1376
- }
1346
+ draggableInDragContainer.style.opacity = "1.0";
1377
1347
  }
1348
+ e.preventDefault();
1349
+ this.dragClone.setAttribute("dragging", "");
1378
1350
  }
1379
1351
  findParentInteractionElement(element) {
1380
1352
  let parent = element.parentElement;
@@ -1406,8 +1378,6 @@ var DragDropInteractionMixin = (superClass, draggablesSelector, droppablesSelect
1406
1378
  this.dragClone.style.position = "fixed";
1407
1379
  this.dragClone.style.top = `${rect.top}px`;
1408
1380
  this.dragClone.style.left = `${rect.left}px`;
1409
- this.dragClone.style.width = `${rect.width}px`;
1410
- this.dragClone.style.height = `${rect.height}px`;
1411
1381
  this.dragClone.style.setProperty("box-sizing", "border-box", "important");
1412
1382
  this.dragClone.style.zIndex = "9999";
1413
1383
  this.dragClone.style.pointerEvents = "none";
@@ -3346,8 +3316,7 @@ var QtiMatchInteraction = class extends DragDropInteractionMixin(
3346
3316
  Interaction,
3347
3317
  "qti-simple-match-set:first-of-type qti-simple-associable-choice, qti-simple-match-set:last-of-type > qti-simple-associable-choice > qti-simple-associable-choice",
3348
3318
  "qti-simple-match-set:last-of-type > qti-simple-associable-choice",
3349
- "qti-simple-match-set:first-of-type",
3350
- "body"
3319
+ "qti-simple-match-set:first-of-type"
3351
3320
  ) {
3352
3321
  constructor() {
3353
3322
  super(...arguments);
@@ -3423,6 +3392,9 @@ var QtiMatchInteraction = class extends DragDropInteractionMixin(
3423
3392
  return;
3424
3393
  } else if (Array.isArray(responseValue)) {
3425
3394
  this.correctOptions = responseValue;
3395
+ if (!this.class.split(" ").includes("qti-match-tabular")) {
3396
+ this.value = responseValue;
3397
+ }
3426
3398
  }
3427
3399
  }
3428
3400
  render() {
@@ -5962,12 +5934,12 @@ var QtiResponseDeclaration = class extends QtiVariableDeclaration {
5962
5934
  if (correctResponse) {
5963
5935
  const values = correctResponse.querySelectorAll("qti-value");
5964
5936
  if (this.cardinality === "single" && values.length > 0) {
5965
- result = values[0].textContent;
5937
+ result = values[0].textContent.trim();
5966
5938
  values[0].remove();
5967
5939
  } else if (this.cardinality !== "single") {
5968
5940
  result = [];
5969
5941
  for (let i = 0; i < values.length; i++) {
5970
- result.push(values[i].textContent);
5942
+ result.push(values[i].textContent.trim());
5971
5943
  values[i].remove();
5972
5944
  }
5973
5945
  }
@@ -6088,4 +6060,4 @@ export {
6088
6060
  QtiOutcomeDeclaration,
6089
6061
  QtiResponseDeclaration
6090
6062
  };
6091
- //# sourceMappingURL=chunk-K6ATVWMP.js.map
6063
+ //# sourceMappingURL=chunk-MEQM6M67.js.map