@citolab/qti-components 10.0.0-next.25 → 10.0.0-next.27

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 (35) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +175 -175
  3. package/dist/{chunk-NUQLOK6X.js → chunk-EA7UK4NL.js} +4 -4
  4. package/dist/{chunk-WEJ4JRVR.js → chunk-EGN2SVIN.js} +2 -2
  5. package/dist/{chunk-GMLW5X4H.js → chunk-EWX4R46G.js} +2 -2
  6. package/dist/{chunk-2GCQCSOR.js → chunk-FEWA5I3V.js} +160 -55
  7. package/dist/chunk-FEWA5I3V.js.map +1 -0
  8. package/dist/{chunk-H6EDN5OK.js → chunk-GYWC44CE.js} +2 -2
  9. package/dist/{chunk-GGFX2IUD.js → chunk-HZCPYU53.js} +2 -2
  10. package/dist/{chunk-IDHMEWR7.js → chunk-I2UB2NOX.js} +2 -2
  11. package/dist/{chunk-3DBCO7ZD.js → chunk-THV42AHU.js} +18 -5
  12. package/dist/{chunk-3DBCO7ZD.js.map → chunk-THV42AHU.js.map} +1 -1
  13. package/dist/{chunk-4BWV6P7P.js → chunk-U5HL4SF3.js} +2 -2
  14. package/dist/corrections.d.ts +2 -2
  15. package/dist/corrections.js +5 -5
  16. package/dist/elements.js +3 -3
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +9 -9
  19. package/dist/item.js +3 -3
  20. package/dist/loader.js +2 -2
  21. package/dist/{qti-test.d-BKYGTOLJ.d.ts → qti-test.d-0fARwLm2.d.ts} +1 -1
  22. package/dist/{qti-transform-test.d-aWMjo4ZA.d.ts → qti-transform-test.d-CtNaWJr8.d.ts} +7 -0
  23. package/dist/test.d.ts +3 -3
  24. package/dist/test.js +4 -4
  25. package/dist/transformers.d.ts +1 -1
  26. package/dist/transformers.js +1 -1
  27. package/package.json +4 -4
  28. package/dist/chunk-2GCQCSOR.js.map +0 -1
  29. /package/dist/{chunk-NUQLOK6X.js.map → chunk-EA7UK4NL.js.map} +0 -0
  30. /package/dist/{chunk-WEJ4JRVR.js.map → chunk-EGN2SVIN.js.map} +0 -0
  31. /package/dist/{chunk-GMLW5X4H.js.map → chunk-EWX4R46G.js.map} +0 -0
  32. /package/dist/{chunk-H6EDN5OK.js.map → chunk-GYWC44CE.js.map} +0 -0
  33. /package/dist/{chunk-GGFX2IUD.js.map → chunk-HZCPYU53.js.map} +0 -0
  34. /package/dist/{chunk-IDHMEWR7.js.map → chunk-I2UB2NOX.js.map} +0 -0
  35. /package/dist/{chunk-4BWV6P7P.js.map → chunk-U5HL4SF3.js.map} +0 -0
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-7ISPUOJG.js";
9
9
  import {
10
10
  QtiModalFeedback
11
- } from "./chunk-GGFX2IUD.js";
11
+ } from "./chunk-HZCPYU53.js";
12
12
  import {
13
13
  listenPublic
14
14
  } from "./chunk-UCXLDQYA.js";
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  qtiTransformItem,
23
23
  qtiTransformTest
24
- } from "./chunk-2GCQCSOR.js";
24
+ } from "./chunk-FEWA5I3V.js";
25
25
  import {
26
26
  INITIAL_SESSION_CONTEXT,
27
27
  INITIAL_TEST_CONTEXT,
@@ -2915,6 +2915,7 @@ var TestStateMixin = (superClass) => {
2915
2915
  #apply(state6) {
2916
2916
  for (const saved of state6.test.items)
2917
2917
  this.updateItemVariables(saved.identifier, saved.variables, saved.state);
2918
+ this.#warnLeftOut(state6);
2918
2919
  const savedOutcomes = new Map(state6.test.outcomes.map((outcome) => [outcome.identifier, outcome.value]));
2919
2920
  this.testContext = {
2920
2921
  ...this.testContext,
@@ -2926,6 +2927,18 @@ var TestStateMixin = (superClass) => {
2926
2927
  plugins: state6.session.plugins && typeof state6.session.plugins === "object" ? { ...state6.session.plugins } : {}
2927
2928
  };
2928
2929
  }
2930
+ /**
2931
+ * Answers for items this test does not present are not restored, and the next state leaves them
2932
+ * out: a selection (`qti-selection`) that leaves an item out, or a revised test. Said, not silent
2933
+ * (roadmap 1 T4, `plans/host-api.md` → Decided).
2934
+ */
2935
+ #warnLeftOut(state6) {
2936
+ const presented = new Set(this.testContext.items.map((item) => item.identifier));
2937
+ const leftOut = state6.test.items.map((item) => item.identifier).filter((identifier) => !presented.has(identifier));
2938
+ if (leftOut.length === 0)
2939
+ return;
2940
+ console.warn(`[qti-test] The state has answers for items this test does not present (not selected, or no longer in it); they are not restored: ${leftOut.join(", ")}.`);
2941
+ }
2929
2942
  /** A stored position may point at an item or section a revised test no longer has. */
2930
2943
  #validSession(session) {
2931
2944
  const exists = (selector, id) => !!id && !!this._testElement?.querySelector(`${selector}[identifier="${CSS.escape(id)}"]`);
@@ -3110,7 +3123,7 @@ var TestContainer = class extends LitElement11 {
3110
3123
  return;
3111
3124
  try {
3112
3125
  const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;
3113
- let api = (await qtiTransformTest().load(this.testURL)).shuffleOrdering(explicitSeed);
3126
+ let api = (await qtiTransformTest().load(this.testURL)).applySelection(explicitSeed).shuffleOrdering(explicitSeed);
3114
3127
  const qtiTest = this.testHost;
3115
3128
  if (qtiTest?.postLoadTestTransformCallback) {
3116
3129
  const tempDoc = api.htmlDoc(this.#resolvedCustomElementRegistry ?? void 0);
@@ -3146,7 +3159,7 @@ var TestContainer = class extends LitElement11 {
3146
3159
  return;
3147
3160
  try {
3148
3161
  const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;
3149
- this.#setTestDoc(qtiTransformTest().parse(this.testXML).shuffleOrdering(explicitSeed).htmlDoc(this.#resolvedCustomElementRegistry ?? void 0));
3162
+ this.#setTestDoc(qtiTransformTest().parse(this.testXML).applySelection(explicitSeed).shuffleOrdering(explicitSeed).htmlDoc(this.#resolvedCustomElementRegistry ?? void 0));
3150
3163
  } catch (error) {
3151
3164
  console.error("Error parsing XML:", error);
3152
3165
  }
@@ -4090,4 +4103,4 @@ export {
4090
4103
  * Portions Copyright (c) 2013, the Dart project authors.
4091
4104
  *)
4092
4105
  */
4093
- //# sourceMappingURL=chunk-3DBCO7ZD.js.map
4106
+ //# sourceMappingURL=chunk-THV42AHU.js.map