@citolab/qti-components 10.0.0-next.17 → 10.0.0-next.19

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/cdn/index.global.js +1 -1
  2. package/cdn/index.js +150 -150
  3. package/dist/base.d.ts +2 -2
  4. package/dist/base.js +1 -1
  5. package/dist/{chunk-UDJ7MHLF.js → chunk-3FQZRJFH.js} +2 -2
  6. package/dist/{chunk-OG5HIRHE.js → chunk-4UO6AGJ6.js} +2 -2
  7. package/dist/{chunk-L7J2ZOJL.js → chunk-HSOILZC6.js} +2 -2
  8. package/dist/{chunk-UURHLJVM.js → chunk-JE6X3IZT.js} +3 -3
  9. package/dist/{chunk-WGUQCB2Z.js → chunk-MFKH6BZM.js} +2 -2
  10. package/dist/{chunk-7MYZHZWV.js → chunk-MXY66QOH.js} +53 -5
  11. package/dist/chunk-MXY66QOH.js.map +1 -0
  12. package/dist/{chunk-V5GL7PTC.js → chunk-QECECKEC.js} +2 -2
  13. package/dist/{chunk-QLGUI5VG.js → chunk-QKCVC4HF.js} +2 -2
  14. package/dist/{chunk-J3F3JSCW.js → chunk-WTGUKDVH.js} +2 -2
  15. package/dist/{chunk-NZ7ZC4SP.js → chunk-XBBTYGCX.js} +1 -1
  16. package/dist/chunk-XBBTYGCX.js.map +1 -0
  17. package/dist/{chunk-L3LBSAGZ.js → chunk-Y7RSSGDY.js} +2 -2
  18. package/dist/{chunk-ZAHZVBV7.js → chunk-YRXH3YMJ.js} +6 -6
  19. package/dist/{config.context.d-CCqlJXpE.d.ts → config.context.d-Dm11aAuw.d.ts} +16 -0
  20. package/dist/corrections.d.ts +5 -5
  21. package/dist/corrections.js +7 -7
  22. package/dist/elements.js +3 -3
  23. package/dist/index.d.ts +5 -5
  24. package/dist/index.js +12 -12
  25. package/dist/interactions.d.ts +4 -4
  26. package/dist/interactions.js +3 -3
  27. package/dist/item.d.ts +2 -2
  28. package/dist/item.js +3 -3
  29. package/dist/processing.js +3 -3
  30. package/dist/{qti-item.d-CLChmRvB.d.ts → qti-item.d-CxP6KtCH.d.ts} +1 -1
  31. package/dist/{qti-test.d-COzv7YZG.d.ts → qti-test.d-CRqJF2DM.d.ts} +1 -1
  32. package/dist/{qti-text-entry-interaction.d-DsUyecBC.d.ts → qti-text-entry-interaction.d-m0EFv9no.d.ts} +2 -2
  33. package/dist/{record.d-BfZhFr0L.d.ts → record.d-N1Bq7e1f.d.ts} +1 -1
  34. package/dist/test.d.ts +3 -3
  35. package/dist/test.js +4 -4
  36. package/package.json +2 -2
  37. package/dist/chunk-7MYZHZWV.js.map +0 -1
  38. package/dist/chunk-NZ7ZC4SP.js.map +0 -1
  39. /package/dist/{chunk-UDJ7MHLF.js.map → chunk-3FQZRJFH.js.map} +0 -0
  40. /package/dist/{chunk-OG5HIRHE.js.map → chunk-4UO6AGJ6.js.map} +0 -0
  41. /package/dist/{chunk-L7J2ZOJL.js.map → chunk-HSOILZC6.js.map} +0 -0
  42. /package/dist/{chunk-UURHLJVM.js.map → chunk-JE6X3IZT.js.map} +0 -0
  43. /package/dist/{chunk-WGUQCB2Z.js.map → chunk-MFKH6BZM.js.map} +0 -0
  44. /package/dist/{chunk-V5GL7PTC.js.map → chunk-QECECKEC.js.map} +0 -0
  45. /package/dist/{chunk-QLGUI5VG.js.map → chunk-QKCVC4HF.js.map} +0 -0
  46. /package/dist/{chunk-J3F3JSCW.js.map → chunk-WTGUKDVH.js.map} +0 -0
  47. /package/dist/{chunk-L3LBSAGZ.js.map → chunk-Y7RSSGDY.js.map} +0 -0
  48. /package/dist/{chunk-ZAHZVBV7.js.map → chunk-YRXH3YMJ.js.map} +0 -0
package/dist/base.d.ts CHANGED
@@ -2,8 +2,8 @@ import { C as ComputedItemContext } from './session.context.d-9gRdGK4T.js';
2
2
  export { I as INITIAL_SESSION_CONTEXT, S as SessionContext, V as View, s as sessionContext } from './session.context.d-9gRdGK4T.js';
3
3
  import { C as ComputedContext } from './computed.types.d-D4wskgi0.js';
4
4
  export { a as ComputedItem } from './computed.types.d-D4wskgi0.js';
5
- export { C as ConfigContext, V as ValidationDisplayMode, c as configContext } from './config.context.d-CCqlJXpE.js';
6
- export { C as ChoiceRole, I as Interaction, a as InteractionContext, R as RecordFieldValues, b as RecordValue, V as ValidityKind, c as ValidityTrigger, i as inferRecordFieldBaseType, d as interactionContext, e as isRecordValue, r as readRecordFieldValues } from './record.d-BfZhFr0L.js';
5
+ export { C as ConfigContext, V as ValidationDisplayMode, c as configContext } from './config.context.d-Dm11aAuw.js';
6
+ export { C as ChoiceRole, I as Interaction, a as InteractionContext, R as RecordFieldValues, b as RecordValue, V as ValidityKind, c as ValidityTrigger, i as inferRecordFieldBaseType, d as interactionContext, e as isRecordValue, r as readRecordFieldValues } from './record.d-N1Bq7e1f.js';
7
7
  import { I as ItemContext } from './item.types.d-Zc6ZQDhu.js';
8
8
  export { i as itemContextVariables } from './item.types.d-Zc6ZQDhu.js';
9
9
  export { Q as QtiContext, a as QtiContextType, S as Seed, b as asSeed, i as isSeed, q as qtiContext } from './qti.context.d-CejJMlfZ.js';
package/dist/base.js CHANGED
@@ -48,7 +48,7 @@ import {
48
48
  testContext,
49
49
  unregisterCustomOperator,
50
50
  validationMessage
51
- } from "./chunk-NZ7ZC4SP.js";
51
+ } from "./chunk-XBBTYGCX.js";
52
52
  import "./chunk-PZ5AY32C.js";
53
53
  export {
54
54
  CustomStateSetShim,
@@ -9,7 +9,7 @@ import {
9
9
  isRecordValue,
10
10
  itemContext,
11
11
  testContext
12
- } from "./chunk-NZ7ZC4SP.js";
12
+ } from "./chunk-XBBTYGCX.js";
13
13
 
14
14
  // ../qti-processing/dist/components/qti-and/qti-and.js
15
15
  var QtiAnd = class extends qtiAndMixin(QtiConditionExpression) {
@@ -3385,4 +3385,4 @@ export {
3385
3385
  QtiVariable,
3386
3386
  qtiProcessingElements
3387
3387
  };
3388
- //# sourceMappingURL=chunk-UDJ7MHLF.js.map
3388
+ //# sourceMappingURL=chunk-3FQZRJFH.js.map
@@ -11,7 +11,7 @@ import {
11
11
  computedItemContext,
12
12
  configContext,
13
13
  qtiContext
14
- } from "./chunk-NZ7ZC4SP.js";
14
+ } from "./chunk-XBBTYGCX.js";
15
15
 
16
16
  // ../qti-item/dist/components/item-container/item-container.js
17
17
  import { consume } from "@lit/context";
@@ -349,4 +349,4 @@ export {
349
349
  QtiItem,
350
350
  qtiItemElements
351
351
  };
352
- //# sourceMappingURL=chunk-OG5HIRHE.js.map
352
+ //# sourceMappingURL=chunk-4UO6AGJ6.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  qtiItemElements
3
- } from "./chunk-OG5HIRHE.js";
3
+ } from "./chunk-4UO6AGJ6.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-L7J2ZOJL.js.map
11
+ //# sourceMappingURL=chunk-HSOILZC6.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-J6VX4N7M.js";
8
8
  import {
9
9
  QtiModalFeedback
10
- } from "./chunk-WGUQCB2Z.js";
10
+ } from "./chunk-MFKH6BZM.js";
11
11
  import {
12
12
  listenPublic
13
13
  } from "./chunk-UCXLDQYA.js";
@@ -31,7 +31,7 @@ import {
31
31
  qtiContext,
32
32
  sessionContext,
33
33
  testContext
34
- } from "./chunk-NZ7ZC4SP.js";
34
+ } from "./chunk-XBBTYGCX.js";
35
35
 
36
36
  // ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
37
37
  import { LitElement, nothing as nothing2 } from "lit";
@@ -3941,4 +3941,4 @@ export {
3941
3941
  * Portions Copyright (c) 2013, the Dart project authors.
3942
3942
  *)
3943
3943
  */
3944
- //# sourceMappingURL=chunk-UURHLJVM.js.map
3944
+ //# sourceMappingURL=chunk-JE6X3IZT.js.map
@@ -15,7 +15,7 @@ import {
15
15
  itemContext,
16
16
  itemContextVariables,
17
17
  readRecordFieldValues
18
- } from "./chunk-NZ7ZC4SP.js";
18
+ } from "./chunk-XBBTYGCX.js";
19
19
 
20
20
  // ../qti-elements/dist/components/qti-assessment-item/qti-assessment-item.js
21
21
  import { provide } from "@lit/context";
@@ -1828,4 +1828,4 @@ export {
1828
1828
  QtiTemplateProcessing,
1829
1829
  qtiContentElements
1830
1830
  };
1831
- //# sourceMappingURL=chunk-WGUQCB2Z.js.map
1831
+ //# sourceMappingURL=chunk-MFKH6BZM.js.map
@@ -19,7 +19,7 @@ import {
19
19
  serializeResponseAttribute,
20
20
  setState,
21
21
  validationMessage
22
- } from "./chunk-NZ7ZC4SP.js";
22
+ } from "./chunk-XBBTYGCX.js";
23
23
 
24
24
  // ../interactions/core/dist/elements/qti-associable-hotspot/qti-associable-hotspot.js
25
25
  import { LitElement, html } from "lit";
@@ -8004,7 +8004,7 @@ var QtiInlineChoiceInteraction = class extends MenuAutoSizeMixin(Interaction) {
8004
8004
  const hasSelection = selectedOption ? selectedOption.value !== "" : false;
8005
8005
  const answerDemanded = this.required || this.minChoices >= 1;
8006
8006
  const isValid = hasSelection || !answerDemanded;
8007
- const validityMessage = this.dataset.minChoicesMessage || "Please select an option.";
8007
+ const validityMessage = this.dataset.minSelectionsMessage || this.dataset.minChoicesMessage || "Please select an option.";
8008
8008
  this.setInteractionValidity(isValid, isValid ? "" : validityMessage, this, { suppressInline: true, kind: "min" });
8009
8009
  return isValid;
8010
8010
  }
@@ -8997,11 +8997,44 @@ var qti_portable_custom_interaction_styles_default = [
8997
8997
  `
8998
8998
  ];
8999
8999
 
9000
+ // ../interactions/portable-custom-interaction/dist/file-response.js
9001
+ var isFileBaseType = (baseType) => baseType === "file";
9002
+ var isQtiFileData = (value) => typeof value === "object" && value !== null && typeof value.data === "string";
9003
+ var fileToDataUrl = (file) => {
9004
+ if (file === null || file === void 0 || file === "")
9005
+ return null;
9006
+ if (typeof file === "string")
9007
+ return file;
9008
+ if (!isQtiFileData(file) || file.data === "")
9009
+ return null;
9010
+ if (file.data.startsWith("data:"))
9011
+ return file.data;
9012
+ return `data:${file.mime || "application/octet-stream"};base64,${file.data}`;
9013
+ };
9014
+ var dataUrlToFile = (value) => {
9015
+ if (value === null || value === void 0 || value === "")
9016
+ return null;
9017
+ if (typeof value === "object")
9018
+ return isQtiFileData(value) ? value : null;
9019
+ const text = String(value);
9020
+ const match = /^data:([^;,]*)((?:;[^;,]*)*),([\s\S]*)$/.exec(text);
9021
+ if (!match)
9022
+ return { data: text, mime: "application/octet-stream" };
9023
+ const [, mime, params, payload] = match;
9024
+ if (params.split(";").includes("base64"))
9025
+ return { data: payload, mime: mime || "text/plain" };
9026
+ let binary = "";
9027
+ new TextEncoder().encode(decodeURIComponent(payload)).forEach((byte) => binary += String.fromCharCode(byte));
9028
+ return { data: btoa(binary), mime: mime || "text/plain" };
9029
+ };
9030
+
9000
9031
  // ../interactions/portable-custom-interaction/dist/record-response.js
9001
9032
  var PAIR_BASE_TYPES = /* @__PURE__ */ new Set(["point", "pair", "directedPair"]);
9002
9033
  var coerceBaseValue = (value, baseType) => {
9003
9034
  if (value === null || value === void 0)
9004
9035
  return value;
9036
+ if (isFileBaseType(baseType))
9037
+ return dataUrlToFile(value);
9005
9038
  switch (baseType) {
9006
9039
  case "integer": {
9007
9040
  if (typeof value === "number")
@@ -9111,6 +9144,8 @@ var toQtiLiteral = (value) => {
9111
9144
  return null;
9112
9145
  if (Array.isArray(value))
9113
9146
  return value.map(String).join(" ");
9147
+ if (isQtiFileData(value))
9148
+ return fileToDataUrl(value);
9114
9149
  if (typeof value === "object") {
9115
9150
  try {
9116
9151
  return JSON.stringify(value);
@@ -9412,6 +9447,14 @@ var QtiPortableCustomInteraction = class extends Interaction {
9412
9447
  for (const nestedKey in nestedObject) {
9413
9448
  if (nestedObject.hasOwnProperty(nestedKey)) {
9414
9449
  const value = nestedObject[nestedKey];
9450
+ if (nestedKey === "file") {
9451
+ if (Array.isArray(value))
9452
+ return value.map(fileToDataUrl).filter((v) => v !== null);
9453
+ const dataUrl = fileToDataUrl(value);
9454
+ if (dataUrl !== null)
9455
+ return dataUrl;
9456
+ continue;
9457
+ }
9415
9458
  if (Array.isArray(value)) {
9416
9459
  return value.map(String);
9417
9460
  } else if (value !== void 0 && value !== null) {
@@ -9586,11 +9629,11 @@ var QtiPortableCustomInteraction = class extends Interaction {
9586
9629
  }
9587
9630
  if (cardinality !== "single") {
9588
9631
  const list = { list: {} };
9589
- list.list[baseType] = input;
9632
+ list.list[baseType] = isFileBaseType(baseType) ? this.normalizeListValue(input).map(dataUrlToFile).filter(Boolean) : input;
9590
9633
  return list;
9591
9634
  } else {
9592
9635
  const base = { base: {} };
9593
- base.base[baseType] = input;
9636
+ base.base[baseType] = isFileBaseType(baseType) ? dataUrlToFile(input) : input;
9594
9637
  return base;
9595
9638
  }
9596
9639
  }
@@ -9726,6 +9769,11 @@ var QtiPortableCustomInteraction = class extends Interaction {
9726
9769
  };
9727
9770
  const iframeName = `qti-pci-${this.responseIdentifier}-${Date.now()}`;
9728
9771
  this.iframe.name = iframeName;
9772
+ const { sandbox, allow } = this.configContext?.pciIframe ?? {};
9773
+ if (sandbox !== void 0)
9774
+ this.iframe.setAttribute("sandbox", sandbox);
9775
+ if (allow)
9776
+ this.iframe.setAttribute("allow", allow);
9729
9777
  const iframeContent = this.generateIframeContent();
9730
9778
  this.iframe.srcdoc = iframeContent;
9731
9779
  this.appendChild(this.iframe);
@@ -12766,4 +12814,4 @@ export {
12766
12814
  elements31 as elements21,
12767
12815
  qtiInteractionElements
12768
12816
  };
12769
- //# sourceMappingURL=chunk-7MYZHZWV.js.map
12817
+ //# sourceMappingURL=chunk-MXY66QOH.js.map