@citolab/qti-components 8.0.2 → 8.2.0

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 (64) hide show
  1. package/cdn/index.global.js +1 -1
  2. package/cdn/index.js +751 -813
  3. package/dist/base.d.ts +63 -6
  4. package/dist/base.js +7 -1
  5. package/dist/{chunk-CK7AV2UJ.js → chunk-43XBJ47H.js} +3 -3
  6. package/dist/{chunk-7V4HJFHW.js → chunk-6ITD55QE.js} +2 -2
  7. package/dist/{chunk-HQESINXH.js → chunk-7D3NKAGZ.js} +137 -3
  8. package/dist/chunk-7D3NKAGZ.js.map +1 -0
  9. package/dist/{chunk-HBSWJC3B.js → chunk-CRLXQZFA.js} +595 -260
  10. package/dist/chunk-CRLXQZFA.js.map +1 -0
  11. package/dist/{chunk-IJD53WY6.js → chunk-HDEG6BAZ.js} +15 -15
  12. package/dist/{chunk-IJD53WY6.js.map → chunk-HDEG6BAZ.js.map} +1 -1
  13. package/dist/{chunk-RSVRS5AK.js → chunk-LMGJOBJA.js} +4 -4
  14. package/dist/{chunk-ZII6M3SN.js → chunk-M7K5C522.js} +2 -2
  15. package/dist/{chunk-J5SQLKNP.js → chunk-OIUK5BFU.js} +22 -6
  16. package/dist/{chunk-J5SQLKNP.js.map → chunk-OIUK5BFU.js.map} +1 -1
  17. package/dist/{chunk-VAE6HBKR.js → chunk-OVBG223G.js} +88 -62
  18. package/dist/chunk-OVBG223G.js.map +1 -0
  19. package/dist/{chunk-TWPXES3S.js → chunk-Q6ZK4LRH.js} +30 -6
  20. package/dist/chunk-Q6ZK4LRH.js.map +1 -0
  21. package/dist/chunk-TLTYXWW7.js +7 -0
  22. package/dist/chunk-TLTYXWW7.js.map +1 -0
  23. package/dist/{chunk-NJQHUUTN.js → chunk-U7YCXDYC.js} +2 -2
  24. package/dist/{chunk-BQFWCZFH.js → chunk-UC3T3NI3.js} +2 -2
  25. package/dist/{chunk-7AVWRQIS.js → chunk-YLRMOX6C.js} +63 -77
  26. package/dist/chunk-YLRMOX6C.js.map +1 -0
  27. package/dist/{computed.types.d-DpKIYO6e.d.ts → computed.types.d-CJarqC6s.d.ts} +12 -0
  28. package/dist/corrections.d.ts +14 -4
  29. package/dist/corrections.js +8 -8
  30. package/dist/elements.d.ts +1 -2
  31. package/dist/elements.js +4 -4
  32. package/dist/index.d.ts +7 -7
  33. package/dist/index.js +30 -14
  34. package/dist/interactions.js +3 -3
  35. package/dist/item.css +451 -532
  36. package/dist/item.d.ts +1 -1
  37. package/dist/item.js +5 -5
  38. package/dist/loader.d.ts +1 -1
  39. package/dist/loader.js +2 -2
  40. package/dist/processing.d.ts +64 -14
  41. package/dist/processing.js +10 -2
  42. package/dist/qti-components-jsx.d.ts +8139 -7358
  43. package/dist/{qti-condition-expression.d-aMvBvpc6.d.ts → qti-condition-expression.d-CYwXOUb1.d.ts} +1 -1
  44. package/dist/{qti-expression.d-BietT_8b.d.ts → qti-expression.d-B_-m9emA.d.ts} +11 -1
  45. package/dist/{qti-feedback.d-DZbad0RN.d.ts → qti-feedback.d-B1EIF-fU.d.ts} +1 -0
  46. package/dist/{qti-test.d-_YAlhDbt.d.ts → qti-test.d-C6lCEMRB.d.ts} +38 -3
  47. package/dist/test.d.ts +5 -5
  48. package/dist/test.js +8 -6
  49. package/dist/transformers.d.ts +1 -1
  50. package/dist/transformers.js +1 -1
  51. package/package.json +9 -9
  52. package/dist/chunk-7AVWRQIS.js.map +0 -1
  53. package/dist/chunk-G6GFQDVN.js +0 -7
  54. package/dist/chunk-G6GFQDVN.js.map +0 -1
  55. package/dist/chunk-HBSWJC3B.js.map +0 -1
  56. package/dist/chunk-HQESINXH.js.map +0 -1
  57. package/dist/chunk-TWPXES3S.js.map +0 -1
  58. package/dist/chunk-VAE6HBKR.js.map +0 -1
  59. /package/dist/{chunk-CK7AV2UJ.js.map → chunk-43XBJ47H.js.map} +0 -0
  60. /package/dist/{chunk-7V4HJFHW.js.map → chunk-6ITD55QE.js.map} +0 -0
  61. /package/dist/{chunk-RSVRS5AK.js.map → chunk-LMGJOBJA.js.map} +0 -0
  62. /package/dist/{chunk-ZII6M3SN.js.map → chunk-M7K5C522.js.map} +0 -0
  63. /package/dist/{chunk-NJQHUUTN.js.map → chunk-U7YCXDYC.js.map} +0 -0
  64. /package/dist/{chunk-BQFWCZFH.js.map → chunk-UC3T3NI3.js.map} +0 -0
@@ -5,7 +5,7 @@ import {
5
5
  convertNumberToUniversalFormat,
6
6
  itemContext,
7
7
  testContext
8
- } from "./chunk-HQESINXH.js";
8
+ } from "./chunk-7D3NKAGZ.js";
9
9
 
10
10
  // ../qti-processing/dist/components/qti-and/qti-and.js
11
11
  var QtiAnd = class extends qtiAndMixin(QtiConditionExpression) {
@@ -1741,6 +1741,72 @@ var QtiOrdered = class extends QtiExpression {
1741
1741
  }
1742
1742
  };
1743
1743
 
1744
+ // ../qti-processing/dist/components/qti-condition/qti-condition-base.js
1745
+ import { LitElement as LitElement2, html as html3 } from "lit";
1746
+ var QtiConditionBranchBase = class extends LitElement2 {
1747
+ render() {
1748
+ return html3`<slot></slot>`;
1749
+ }
1750
+ process() {
1751
+ const subRules = this.getSubRules();
1752
+ for (let i = 0; i < subRules.length; i++) {
1753
+ const subRule = subRules[i];
1754
+ subRule.process();
1755
+ }
1756
+ }
1757
+ };
1758
+ var QtiConditionElseBase = class extends QtiConditionBranchBase {
1759
+ shouldProcess() {
1760
+ return true;
1761
+ }
1762
+ getSubRules() {
1763
+ return [...this.children];
1764
+ }
1765
+ };
1766
+ var QtiConditionIfBase = class extends QtiConditionBranchBase {
1767
+ shouldProcess() {
1768
+ const expression = this.firstElementChild;
1769
+ return expression.calculate();
1770
+ }
1771
+ getSubRules() {
1772
+ const result = [];
1773
+ for (let i = 1; i < this.children.length; i++) {
1774
+ result.push(this.children[i]);
1775
+ }
1776
+ return result;
1777
+ }
1778
+ };
1779
+ var QtiConditionBase = class extends QtiRule {
1780
+ render() {
1781
+ return html3`<slot></slot>`;
1782
+ }
1783
+ process() {
1784
+ const branches = [...this.children];
1785
+ for (const branch of branches) {
1786
+ if (branch.shouldProcess()) {
1787
+ branch.process();
1788
+ return;
1789
+ }
1790
+ }
1791
+ }
1792
+ };
1793
+
1794
+ // ../qti-processing/dist/components/qti-outcome-condition/qti-outcome-condition.js
1795
+ var QtiOutcomeCondition = class extends QtiConditionBase {
1796
+ };
1797
+
1798
+ // ../qti-processing/dist/components/qti-outcome-if/qti-outcome-if.js
1799
+ var QtiOutcomeIf = class extends QtiConditionIfBase {
1800
+ };
1801
+
1802
+ // ../qti-processing/dist/components/qti-outcome-else-if/qti-outcome-else-if.js
1803
+ var QtiOutcomeElseIf = class extends QtiOutcomeIf {
1804
+ };
1805
+
1806
+ // ../qti-processing/dist/components/qti-outcome-else/qti-outcome-else.js
1807
+ var QtiOutcomeElse = class extends QtiConditionElseBase {
1808
+ };
1809
+
1744
1810
  // ../qti-processing/dist/components/qti-pattern-match/qti-pattern-match.js
1745
1811
  import { property as property12 } from "lit/decorators.js";
1746
1812
  var __decorate12 = function(decorators, target, key, desc) {
@@ -1857,7 +1923,7 @@ var QtiPower = class extends QtiExpression {
1857
1923
 
1858
1924
  // ../qti-processing/dist/components/qti-printed-variable/qti-printed-variable.js
1859
1925
  import { consume as consume3 } from "@lit/context";
1860
- import { LitElement as LitElement2, html as html3, nothing } from "lit";
1926
+ import { LitElement as LitElement3, html as html4, nothing } from "lit";
1861
1927
  import { property as property13, state as state3 } from "lit/decorators.js";
1862
1928
  var __decorate13 = function(decorators, target, key, desc) {
1863
1929
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -1865,10 +1931,10 @@ var __decorate13 = function(decorators, target, key, desc) {
1865
1931
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1866
1932
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1867
1933
  };
1868
- var QtiPrintedVariable = class extends LitElement2 {
1934
+ var QtiPrintedVariable = class extends LitElement3 {
1869
1935
  render() {
1870
1936
  const value = this.context?.variables.find((v) => v.identifier === this.identifier)?.value;
1871
- return value === null ? nothing : html3`${JSON.stringify(value, null, 2)}`;
1937
+ return value === null ? nothing : html4`${JSON.stringify(value, null, 2)}`;
1872
1938
  }
1873
1939
  calculate() {
1874
1940
  const result = this.context.variables.find((v) => v.identifier === this.identifier) || null;
@@ -2100,66 +2166,19 @@ __decorate15([
2100
2166
  ], QtiRepeat.prototype, "numberRepeats", void 0);
2101
2167
 
2102
2168
  // ../qti-processing/dist/components/qti-response-condition/qti-response-condition.js
2103
- import { html as html4 } from "lit";
2104
- var QtiResponseCondition = class extends QtiRule {
2105
- render() {
2106
- return html4`<slot></slot>`;
2107
- }
2108
- process() {
2109
- const branches = [...this.children];
2110
- for (let i = 0; i < branches.length; i++) {
2111
- const branch = branches[i];
2112
- if (branch.calculate()) {
2113
- branch.process();
2114
- return;
2115
- }
2116
- }
2117
- }
2118
- };
2119
-
2120
- // ../qti-processing/dist/components/qti-response-else/qti-response-else.js
2121
- import { LitElement as LitElement3, html as html5 } from "lit";
2122
- var QtiResponseElse = class extends LitElement3 {
2123
- render() {
2124
- return html5`<slot></slot>`;
2125
- }
2126
- calculate() {
2127
- return true;
2128
- }
2129
- getSubRules() {
2130
- return [...this.children];
2131
- }
2132
- process() {
2133
- const subRules = this.getSubRules();
2134
- for (let i = 0; i < subRules.length; i++) {
2135
- const subRule = subRules[i];
2136
- subRule.process();
2137
- }
2138
- }
2169
+ var QtiResponseCondition = class extends QtiConditionBase {
2139
2170
  };
2140
2171
 
2141
2172
  // ../qti-processing/dist/components/qti-response-if/qti-response-if.js
2142
- var QtiResponseIf = class extends QtiResponseElse {
2143
- calculate() {
2144
- const expression = this.firstElementChild;
2145
- const result = expression.calculate();
2146
- return result;
2147
- }
2148
- getSubRules() {
2149
- const result = [];
2150
- for (let i = 1; i < this.children.length; i++) {
2151
- result.push(this.children[i]);
2152
- }
2153
- return result;
2154
- }
2173
+ var QtiResponseIf = class extends QtiConditionIfBase {
2155
2174
  };
2156
2175
 
2157
2176
  // ../qti-processing/dist/components/qti-response-else-if/qti-response-else-if.js
2158
- import { html as html6 } from "lit";
2159
2177
  var QtiResponseElseIf = class extends QtiResponseIf {
2160
- render() {
2161
- return html6`${super.render()}`;
2162
- }
2178
+ };
2179
+
2180
+ // ../qti-processing/dist/components/qti-response-else/qti-response-else.js
2181
+ var QtiResponseElse = class extends QtiConditionElseBase {
2163
2182
  };
2164
2183
 
2165
2184
  // ../qti-processing/dist/components/qti-round-to/qti-round-to.js
@@ -2731,9 +2750,8 @@ var QtiTruncate = class extends QtiExpression {
2731
2750
  // ../qti-processing/dist/components/qti-variable/qti-variable.js
2732
2751
  var QtiVariable = class extends QtiExpression {
2733
2752
  getResult() {
2734
- const identifier = this.getAttribute("identifier");
2735
- const result = this.context.variables.find((v) => v.identifier === identifier).value;
2736
- return result;
2753
+ const identifier = this.getAttribute("identifier") || "";
2754
+ return this.resolveVariable(identifier)?.value ?? null;
2737
2755
  }
2738
2756
  };
2739
2757
 
@@ -2778,6 +2796,10 @@ var qtiProcessingElements = [
2778
2796
  { tag: "qti-null", ctor: QtiNull },
2779
2797
  { tag: "qti-or", ctor: QtiOr },
2780
2798
  { tag: "qti-ordered", ctor: QtiOrdered },
2799
+ { tag: "qti-outcome-condition", ctor: QtiOutcomeCondition },
2800
+ { tag: "qti-outcome-else", ctor: QtiOutcomeElse },
2801
+ { tag: "qti-outcome-else-if", ctor: QtiOutcomeElseIf },
2802
+ { tag: "qti-outcome-if", ctor: QtiOutcomeIf },
2781
2803
  { tag: "qti-pattern-match", ctor: QtiPatternMatch },
2782
2804
  { tag: "qti-power", ctor: QtiPower },
2783
2805
  { tag: "qti-printed-variable", ctor: QtiPrintedVariable },
@@ -2852,6 +2874,10 @@ export {
2852
2874
  QtiNull,
2853
2875
  QtiOr,
2854
2876
  QtiOrdered,
2877
+ QtiOutcomeCondition,
2878
+ QtiOutcomeIf,
2879
+ QtiOutcomeElseIf,
2880
+ QtiOutcomeElse,
2855
2881
  QtiPatternMatch,
2856
2882
  QtiPower,
2857
2883
  QtiPrintedVariable,
@@ -2860,9 +2886,9 @@ export {
2860
2886
  QtiRandom,
2861
2887
  QtiRepeat,
2862
2888
  QtiResponseCondition,
2863
- QtiResponseElse,
2864
2889
  QtiResponseIf,
2865
2890
  QtiResponseElseIf,
2891
+ QtiResponseElse,
2866
2892
  QtiRoundTo,
2867
2893
  QtiRound,
2868
2894
  QtiSetCorrectResponse,
@@ -2881,4 +2907,4 @@ export {
2881
2907
  QtiTruncate,
2882
2908
  QtiVariable
2883
2909
  };
2884
- //# sourceMappingURL=chunk-VAE6HBKR.js.map
2910
+ //# sourceMappingURL=chunk-OVBG223G.js.map