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

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 (28) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +138 -138
  3. package/dist/{chunk-IDHMEWR7.js → chunk-2QF6T7FA.js} +2 -2
  4. package/dist/{chunk-WEJ4JRVR.js → chunk-5JTQVUTU.js} +2 -2
  5. package/dist/{chunk-4BWV6P7P.js → chunk-7BJVE7IH.js} +2 -2
  6. package/dist/{chunk-H6EDN5OK.js → chunk-CGHYZJEV.js} +2 -2
  7. package/dist/{chunk-3DBCO7ZD.js → chunk-H64MGZJL.js} +3 -3
  8. package/dist/{chunk-GMLW5X4H.js → chunk-LUHBGVAR.js} +2 -2
  9. package/dist/{chunk-NUQLOK6X.js → chunk-NBOEBR5K.js} +4 -4
  10. package/dist/{chunk-2GCQCSOR.js → chunk-QBIO62XN.js} +44 -45
  11. package/dist/{chunk-2GCQCSOR.js.map → chunk-QBIO62XN.js.map} +1 -1
  12. package/dist/{chunk-GGFX2IUD.js → chunk-USZE6XSO.js} +2 -2
  13. package/dist/corrections.js +5 -5
  14. package/dist/elements.js +3 -3
  15. package/dist/index.js +9 -9
  16. package/dist/item.js +3 -3
  17. package/dist/loader.js +2 -2
  18. package/dist/test.js +4 -4
  19. package/dist/transformers.js +1 -1
  20. package/package.json +2 -2
  21. /package/dist/{chunk-IDHMEWR7.js.map → chunk-2QF6T7FA.js.map} +0 -0
  22. /package/dist/{chunk-WEJ4JRVR.js.map → chunk-5JTQVUTU.js.map} +0 -0
  23. /package/dist/{chunk-4BWV6P7P.js.map → chunk-7BJVE7IH.js.map} +0 -0
  24. /package/dist/{chunk-H6EDN5OK.js.map → chunk-CGHYZJEV.js.map} +0 -0
  25. /package/dist/{chunk-3DBCO7ZD.js.map → chunk-H64MGZJL.js.map} +0 -0
  26. /package/dist/{chunk-GMLW5X4H.js.map → chunk-LUHBGVAR.js.map} +0 -0
  27. /package/dist/{chunk-NUQLOK6X.js.map → chunk-NBOEBR5K.js.map} +0 -0
  28. /package/dist/{chunk-GGFX2IUD.js.map → chunk-USZE6XSO.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  qtiContentElements
3
- } from "./chunk-GGFX2IUD.js";
3
+ } from "./chunk-USZE6XSO.js";
4
4
 
5
5
  // ../qti-elements/dist/register.js
6
6
  for (const { tag, ctor } of qtiContentElements) {
@@ -8,4 +8,4 @@ for (const { tag, ctor } of qtiContentElements) {
8
8
  customElements.define(tag, ctor);
9
9
  }
10
10
  }
11
- //# sourceMappingURL=chunk-IDHMEWR7.js.map
11
+ //# sourceMappingURL=chunk-2QF6T7FA.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  qtiItemElements
3
- } from "./chunk-4BWV6P7P.js";
3
+ } from "./chunk-7BJVE7IH.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-WEJ4JRVR.js.map
11
+ //# sourceMappingURL=chunk-5JTQVUTU.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-4DB4SC5K.js";
7
7
  import {
8
8
  qtiTransformItem
9
- } from "./chunk-2GCQCSOR.js";
9
+ } from "./chunk-QBIO62XN.js";
10
10
  import {
11
11
  computedItemContext,
12
12
  configContext,
@@ -349,4 +349,4 @@ export {
349
349
  QtiItem,
350
350
  qtiItemElements
351
351
  };
352
- //# sourceMappingURL=chunk-4BWV6P7P.js.map
352
+ //# sourceMappingURL=chunk-7BJVE7IH.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  qtiTestElements
3
- } from "./chunk-3DBCO7ZD.js";
3
+ } from "./chunk-H64MGZJL.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-H6EDN5OK.js.map
11
+ //# sourceMappingURL=chunk-CGHYZJEV.js.map
@@ -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-USZE6XSO.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-QBIO62XN.js";
25
25
  import {
26
26
  INITIAL_SESSION_CONTEXT,
27
27
  INITIAL_TEST_CONTEXT,
@@ -4090,4 +4090,4 @@ export {
4090
4090
  * Portions Copyright (c) 2013, the Dart project authors.
4091
4091
  *)
4092
4092
  */
4093
- //# sourceMappingURL=chunk-3DBCO7ZD.js.map
4093
+ //# sourceMappingURL=chunk-H64MGZJL.js.map
@@ -2,7 +2,7 @@ import {
2
2
  qtiTransformItem,
3
3
  qtiTransformManifest,
4
4
  qtiTransformTest
5
- } from "./chunk-2GCQCSOR.js";
5
+ } from "./chunk-QBIO62XN.js";
6
6
 
7
7
  // ../qti-loader/dist/qti-loader.js
8
8
  var getManifestInfo = async (manifestURL) => {
@@ -28,4 +28,4 @@ export {
28
28
  getManifestInfo,
29
29
  getItemByUri
30
30
  };
31
- //# sourceMappingURL=chunk-GMLW5X4H.js.map
31
+ //# sourceMappingURL=chunk-LUHBGVAR.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  QtiTest,
3
3
  TestNavigation
4
- } from "./chunk-3DBCO7ZD.js";
4
+ } from "./chunk-H64MGZJL.js";
5
5
  import {
6
6
  QtiAssessmentItem
7
- } from "./chunk-GGFX2IUD.js";
7
+ } from "./chunk-USZE6XSO.js";
8
8
  import {
9
9
  QtiAssociateInteraction,
10
10
  QtiChoiceInteraction,
@@ -30,7 +30,7 @@ import {
30
30
  } from "./chunk-TZCOXFPB.js";
31
31
  import {
32
32
  QtiItem
33
- } from "./chunk-4BWV6P7P.js";
33
+ } from "./chunk-7BJVE7IH.js";
34
34
  import {
35
35
  watch
36
36
  } from "./chunk-4DB4SC5K.js";
@@ -1686,4 +1686,4 @@ export {
1686
1686
  TestNavigationCorrection,
1687
1687
  QtiTestCorrection
1688
1688
  };
1689
- //# sourceMappingURL=chunk-NUQLOK6X.js.map
1689
+ //# sourceMappingURL=chunk-NBOEBR5K.js.map
@@ -753,30 +753,48 @@ var attrIsFalse = (el, ...names) => names.some((n) => {
753
753
  });
754
754
  var isOrdering = (el) => isLocal2(el, "qti-ordering", "ordering");
755
755
  var isSelection = (el) => isLocal2(el, "qti-selection", "selection");
756
- var shuffleOrderingElements = (section) => Array.from(section.children).filter((child) => isOrdering(child) && attrIsTrue(child, "shuffle"));
756
+ var isSessionControl = (el) => isLocal2(el, "qti-item-session-control", "itemsessioncontrol");
757
+ var isStandardOrdering = (el) => el.children.length === 0 && Array.from(el.attributes).every((a) => a.name === "shuffle" || a.name === "xmlns" || a.name.startsWith("xmlns:"));
758
+ var shuffleOrderingElements = (section) => Array.from(section.children).filter((child) => isOrdering(child) && isStandardOrdering(child) && attrIsTrue(child, "shuffle"));
757
759
  var rngFor = (seed, key) => createSeededRandom(`${seed}:${key}`);
758
- function collectItemRefsDeep(section) {
759
- const itemRefs = [];
760
- const dropped = [];
761
- const walk = (el) => {
762
- for (const child of Array.from(el.children)) {
763
- if (isItemRef(child)) {
764
- itemRefs.push(child);
765
- } else if (isSection(child)) {
766
- walk(child);
767
- } else if (!isOrdering(child) && !isSelection(child)) {
768
- dropped.push(child.localName);
769
- }
770
- }
771
- };
772
- walk(section);
773
- return { itemRefs, dropped };
760
+ var dissolves = (section) => attrIsFalse(section, "visible") && attrIsFalse(section, "keep-together", "keeptogether");
761
+ function inheritSessionControl(child, from) {
762
+ if (!from)
763
+ return;
764
+ let own = Array.from(child.children).find(isSessionControl);
765
+ if (!own) {
766
+ own = child.ownerDocument.createElementNS(from.namespaceURI, from.tagName);
767
+ child.insertBefore(own, child.firstChild);
768
+ }
769
+ for (const attribute of Array.from(from.attributes)) {
770
+ if (!own.hasAttribute(attribute.name))
771
+ own.setAttribute(attribute.name, attribute.value);
772
+ }
774
773
  }
775
774
  function warnDroppedChildren(section, dropped) {
776
775
  if (dropped.length === 0)
777
776
  return;
778
777
  const identifier = section.getAttribute("identifier") ?? "(no identifier)";
779
- console.warn(`[qtiTransformTest] Subsection "${identifier}" is consumed by section ordering; discarding its ${[...new Set(dropped)].join(", ")}.`);
778
+ console.warn(`[qtiTransformTest] Subsection "${identifier}" (visible="false", keep-together="false") is merged into its parent by section ordering; discarding its ${[...new Set(dropped)].join(", ")}.`);
779
+ }
780
+ function unitsOf(child) {
781
+ if (isItemRef(child))
782
+ return [{ node: child, fixed: attrIsTrue(child, "fixed") }];
783
+ if (!dissolves(child))
784
+ return [{ node: child, fixed: attrIsTrue(child, "fixed") }];
785
+ const sessionControl = Array.from(child.children).find(isSessionControl);
786
+ const dropped = [];
787
+ const units = [];
788
+ for (const grandchild of Array.from(child.children)) {
789
+ if (isItemRef(grandchild) || isSection(grandchild)) {
790
+ inheritSessionControl(grandchild, sessionControl);
791
+ units.push(...unitsOf(grandchild));
792
+ } else if (!isOrdering(grandchild) && !isSelection(grandchild) && !isSessionControl(grandchild)) {
793
+ dropped.push(grandchild.localName);
794
+ }
795
+ }
796
+ warnDroppedChildren(child, dropped);
797
+ return units;
780
798
  }
781
799
  function orderSection(section, seed) {
782
800
  for (const child of Array.from(section.children)) {
@@ -788,42 +806,23 @@ function orderSection(section, seed) {
788
806
  if (orderingEls.length === 0) {
789
807
  return;
790
808
  }
791
- const units = [];
792
- const toDetach = [];
793
- for (const child of Array.from(section.children)) {
794
- if (isItemRef(child)) {
795
- units.push({ nodes: [child], fixed: attrIsTrue(child, "fixed") });
796
- toDetach.push(child);
797
- } else if (isSection(child)) {
798
- const { itemRefs, dropped } = collectItemRefsDeep(child);
799
- warnDroppedChildren(child, dropped);
800
- if (attrIsFalse(child, "keep-together", "keeptogether")) {
801
- for (const itemRef of itemRefs) {
802
- units.push({ nodes: [itemRef], fixed: attrIsTrue(itemRef, "fixed") });
803
- }
804
- } else if (itemRefs.length > 0) {
805
- units.push({ nodes: itemRefs, fixed: attrIsTrue(child, "fixed") });
806
- }
807
- toDetach.push(child);
808
- }
809
- }
810
- const anchor = toDetach.length > 0 ? toDetach[toDetach.length - 1].nextSibling : null;
809
+ const children = Array.from(section.children).filter((child) => isItemRef(child) || isSection(child));
810
+ const units = children.flatMap(unitsOf);
811
+ const anchor = children.length > 0 ? children[children.length - 1].nextSibling : null;
811
812
  const sectionKey = section.getAttribute("identifier") ?? "";
812
813
  const ordered = shuffleKeepingFixed(units, rngFor(seed, sectionKey));
813
- for (const el of toDetach) {
814
- el.remove();
814
+ for (const child of children) {
815
+ child.remove();
815
816
  }
816
817
  for (const unit of ordered) {
817
- for (const node of unit.nodes) {
818
- section.insertBefore(node, anchor);
819
- }
818
+ section.insertBefore(unit.node, anchor);
820
819
  }
821
820
  for (const orderingEl of orderingEls) {
822
821
  orderingEl.remove();
823
822
  }
824
823
  }
825
824
  function hasShuffleOrdering(doc) {
826
- return Array.from(doc.getElementsByTagName("*")).some((el) => isOrdering(el) && attrIsTrue(el, "shuffle"));
825
+ return Array.from(doc.getElementsByTagName("*")).some((el) => isOrdering(el) && isStandardOrdering(el) && attrIsTrue(el, "shuffle"));
827
826
  }
828
827
  function shuffleSectionsOrdering(doc, seed) {
829
828
  const sections = Array.from(doc.getElementsByTagName("*")).filter((el) => isSection(el));
@@ -913,4 +912,4 @@ export {
913
912
  qtiTransformManifest,
914
913
  qtiTransformTest
915
914
  };
916
- //# sourceMappingURL=chunk-2GCQCSOR.js.map
915
+ //# sourceMappingURL=chunk-QBIO62XN.js.map