@citolab/qti-components 10.0.0-next.2 → 10.0.0-next.21
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.
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +4334 -2688
- package/dist/base.d.ts +39 -13
- package/dist/base.js +14 -1
- package/dist/{chunk-RU6332MD.js → chunk-2A52V5TQ.js} +4 -4
- package/dist/{chunk-2KP5UU5A.js → chunk-55WWIRLN.js} +117 -92
- package/dist/chunk-55WWIRLN.js.map +1 -0
- package/dist/{chunk-MI7774NV.js → chunk-5BP2A7BI.js} +2 -2
- package/dist/{chunk-35WWWFS6.js → chunk-DAESCCLR.js} +2 -2
- package/dist/chunk-DJ7PB252.js +7 -0
- package/dist/chunk-DJ7PB252.js.map +1 -0
- package/dist/{chunk-TDWJ6WZA.js → chunk-GPC53O7P.js} +166 -10
- package/dist/chunk-GPC53O7P.js.map +1 -0
- package/dist/{chunk-6U3YPHXU.js → chunk-H6DO5UHC.js} +277 -154
- package/dist/chunk-H6DO5UHC.js.map +1 -0
- package/dist/chunk-J6VX4N7M.js +197 -0
- package/dist/chunk-J6VX4N7M.js.map +1 -0
- package/dist/{chunk-3ZNECUPV.js → chunk-JIDSFFFD.js} +2 -2
- package/dist/{chunk-FD4AB6TM.js → chunk-KQ2LED4X.js} +2 -2
- package/dist/{chunk-6K3QWJHH.js → chunk-LPYZVKHX.js} +48 -7
- package/dist/chunk-LPYZVKHX.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-K3VKQ6QF.js → chunk-TB2OI3ED.js} +677 -1894
- package/dist/chunk-TB2OI3ED.js.map +1 -0
- package/dist/{chunk-GBZNFSFY.js → chunk-TSJGL6FI.js} +2 -2
- package/dist/{chunk-RSMYGGQK.js → chunk-TZCOXFPB.js} +1590 -610
- package/dist/chunk-TZCOXFPB.js.map +1 -0
- package/dist/chunk-UCXLDQYA.js +56 -0
- package/dist/chunk-UCXLDQYA.js.map +1 -0
- package/dist/chunk-WWY2H2YO.js +7 -0
- package/dist/chunk-WWY2H2YO.js.map +1 -0
- package/dist/{chunk-LFVPS7KB.js → chunk-XWRZP2RM.js} +2 -2
- package/dist/{chunk-TLAVOBEM.js → chunk-ZRORBAHB.js} +122 -3
- package/dist/chunk-ZRORBAHB.js.map +1 -0
- package/dist/computed.types.d-6Ht-HNRx.d.ts +80 -0
- package/dist/{config.context.d-BvU9r-Mg.d.ts → config.context.d-Dm11aAuw.d.ts} +21 -3
- package/dist/corrections.d.ts +137 -24
- package/dist/corrections.js +12 -12
- package/dist/corrections.js.map +1 -1
- package/dist/elements.d.ts +66 -73
- package/dist/elements.js +9 -6
- package/dist/index.d.ts +21 -17
- package/dist/index.js +47 -61
- package/dist/interactions.d.ts +98 -19
- package/dist/interactions.js +8 -3
- package/dist/item.css +1948 -1946
- package/dist/item.d.ts +8 -6
- package/dist/item.js +6 -5
- package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
- package/dist/loader.d.ts +5 -3
- package/dist/loader.js +3 -2
- package/dist/processing.d.ts +19 -7
- package/dist/processing.js +4 -3
- package/dist/public-events.d-3dGip9pd.d.ts +105 -0
- package/dist/qti-components-jsx.d.ts +1780 -1727
- package/dist/{qti-condition-expression.d-VJH6cWxf.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
- package/dist/{qti-expression.d-BPxEp8HU.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
- package/dist/{qti-feedback.d-wMYNVkkj.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +8 -1
- package/dist/{qti-item.d-DgC1AQbY.d.ts → qti-item.d-CxP6KtCH.d.ts} +3 -2
- package/dist/{qti-rule-base.d-Bdzg8eGH.d.ts → qti-rule-base.d-CeKP0Ooi.d.ts} +2 -2
- package/dist/qti-test-state-CF9S8X9C.d.ts +68 -0
- package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
- package/dist/{qti-test.d-DkpBNcsv.d.ts → qti-test.d-DBT-YpRu.d.ts} +124 -485
- package/dist/{qti-text-entry-interaction.d-q8u5BiVK.d.ts → qti-text-entry-interaction.d-m0EFv9no.d.ts} +221 -73
- package/dist/{qti-transform-test.d-BL7GGFJj.d.ts → qti-transform-test.d-Bb9vnLzP.d.ts} +1 -0
- package/dist/{interaction.d-g6XG0T0Z.d.ts → record.d-N1Bq7e1f.d.ts} +67 -4
- package/dist/{session.context.d-D5080LVx.d.ts → session.context.d-9gRdGK4T.d.ts} +7 -1
- package/dist/test-plugin-api.d.ts +134 -0
- package/dist/test-plugin-api.js +19 -0
- package/dist/test-plugin-api.js.map +1 -0
- package/dist/test.d.ts +26 -57
- package/dist/test.js +19 -48
- package/dist/transformers.d.ts +1 -1
- package/dist/transformers.js +2 -1
- package/dist/{item.types.d-B55QkJ92.d.ts → variables.d-DWHlTszN.d.ts} +8 -24
- package/package.json +16 -11
- package/dist/chunk-2KP5UU5A.js.map +0 -1
- package/dist/chunk-6K3QWJHH.js.map +0 -1
- package/dist/chunk-6U3YPHXU.js.map +0 -1
- package/dist/chunk-K3VKQ6QF.js.map +0 -1
- package/dist/chunk-RSMYGGQK.js.map +0 -1
- package/dist/chunk-TDWJ6WZA.js.map +0 -1
- package/dist/chunk-TLAVOBEM.js.map +0 -1
- package/dist/chunk-ZP6QQYSU.js +0 -7
- package/dist/chunk-ZP6QQYSU.js.map +0 -1
- package/dist/computed.types.d-gJrBeUMG.d.ts +0 -42
- /package/dist/{chunk-RU6332MD.js.map → chunk-2A52V5TQ.js.map} +0 -0
- /package/dist/{chunk-MI7774NV.js.map → chunk-5BP2A7BI.js.map} +0 -0
- /package/dist/{chunk-35WWWFS6.js.map → chunk-DAESCCLR.js.map} +0 -0
- /package/dist/{chunk-3ZNECUPV.js.map → chunk-JIDSFFFD.js.map} +0 -0
- /package/dist/{chunk-FD4AB6TM.js.map → chunk-KQ2LED4X.js.map} +0 -0
- /package/dist/{chunk-GBZNFSFY.js.map → chunk-TSJGL6FI.js.map} +0 -0
- /package/dist/{chunk-LFVPS7KB.js.map → chunk-XWRZP2RM.js.map} +0 -0
|
@@ -5,9 +5,11 @@ import {
|
|
|
5
5
|
QtiExpression,
|
|
6
6
|
ScoringHelper,
|
|
7
7
|
convertNumberToUniversalFormat,
|
|
8
|
+
inferRecordFieldBaseType,
|
|
9
|
+
isRecordValue,
|
|
8
10
|
itemContext,
|
|
9
11
|
testContext
|
|
10
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GPC53O7P.js";
|
|
11
13
|
|
|
12
14
|
// ../qti-processing/dist/components/qti-and/qti-and.js
|
|
13
15
|
var QtiAnd = class extends qtiAndMixin(QtiConditionExpression) {
|
|
@@ -222,6 +224,9 @@ var QtiCorrect = class extends QtiExpression {
|
|
|
222
224
|
getResult() {
|
|
223
225
|
const identifier = this.getAttribute("identifier") || "";
|
|
224
226
|
const responseVariable = this.context.variables.find((v) => v.identifier === identifier) || null;
|
|
227
|
+
if (responseVariable.cardinality === "record") {
|
|
228
|
+
return responseVariable.correctResponse ?? null;
|
|
229
|
+
}
|
|
225
230
|
if (responseVariable.cardinality !== "single") {
|
|
226
231
|
return responseVariable.correctResponse.length > 0 ? responseVariable.correctResponse[0] : "";
|
|
227
232
|
} else {
|
|
@@ -631,6 +636,15 @@ var QtiExitTest = class extends QtiRule {
|
|
|
631
636
|
|
|
632
637
|
// ../qti-processing/dist/components/qti-field-value/qti-field-value.js
|
|
633
638
|
var QtiFieldValue = class extends QtiExpression {
|
|
639
|
+
#fieldBaseType;
|
|
640
|
+
/**
|
|
641
|
+
* The base type of the field last read: as declared on the record's correct response when it
|
|
642
|
+
* is, otherwise read off the value. The value alone is a string like `"4.1"` or `"455 250"`, and
|
|
643
|
+
* an operator reading it as text would refuse to compare it as a number or test it as a point.
|
|
644
|
+
*/
|
|
645
|
+
get resultBaseType() {
|
|
646
|
+
return this.#fieldBaseType;
|
|
647
|
+
}
|
|
634
648
|
/**
|
|
635
649
|
* Every failure here is NULL rather than a thrown error. `qti-is-null` over a
|
|
636
650
|
* `qti-field-value` is the specified way to ask whether a record carries a
|
|
@@ -638,6 +652,7 @@ var QtiFieldValue = class extends QtiExpression {
|
|
|
638
652
|
* aborted the whole response processing run instead.
|
|
639
653
|
*/
|
|
640
654
|
getResult() {
|
|
655
|
+
this.#fieldBaseType = void 0;
|
|
641
656
|
const fieldIdentifier = this.getAttribute("field-identifier");
|
|
642
657
|
if (!fieldIdentifier) {
|
|
643
658
|
console.error("qti-field-value requires a field-identifier attribute");
|
|
@@ -648,12 +663,18 @@ var QtiFieldValue = class extends QtiExpression {
|
|
|
648
663
|
return null;
|
|
649
664
|
}
|
|
650
665
|
const variable = this.getVariables()[0];
|
|
651
|
-
|
|
666
|
+
const isRecord = variable?.cardinality === "record" || variable?.baseType === "record";
|
|
667
|
+
if (isRecord && (variable.value === null || variable.value === void 0))
|
|
668
|
+
return null;
|
|
669
|
+
if (!variable || !isRecord || !isRecordValue(variable.value)) {
|
|
652
670
|
console.warn("qti-field-value child expression must return a record");
|
|
653
671
|
return null;
|
|
654
672
|
}
|
|
655
673
|
const fieldValue = variable.value[fieldIdentifier];
|
|
656
|
-
|
|
674
|
+
if (fieldValue === void 0 || fieldValue === null)
|
|
675
|
+
return null;
|
|
676
|
+
this.#fieldBaseType = variable.fieldBaseTypes?.[fieldIdentifier] ?? inferRecordFieldBaseType(Array.isArray(fieldValue) ? fieldValue[0] : fieldValue);
|
|
677
|
+
return fieldValue;
|
|
657
678
|
}
|
|
658
679
|
};
|
|
659
680
|
|
|
@@ -755,6 +776,9 @@ var QtiGcd = class extends QtiExpression {
|
|
|
755
776
|
}
|
|
756
777
|
};
|
|
757
778
|
|
|
779
|
+
// ../qti-processing/dist/is-null-value.js
|
|
780
|
+
var isNullValue = (value) => value === null || value === void 0 || value === "";
|
|
781
|
+
|
|
758
782
|
// ../qti-processing/dist/components/qti-gt/qti-gt.js
|
|
759
783
|
var QtiGt = class extends QtiExpression {
|
|
760
784
|
getResult() {
|
|
@@ -762,6 +786,9 @@ var QtiGt = class extends QtiExpression {
|
|
|
762
786
|
const values = this.getVariables();
|
|
763
787
|
const value1 = values[0];
|
|
764
788
|
const value2 = values[1];
|
|
789
|
+
if (isNullValue(value1?.value) || isNullValue(value2?.value)) {
|
|
790
|
+
return null;
|
|
791
|
+
}
|
|
765
792
|
if ((value1.baseType === "integer" || value1.baseType === "float") && (value2.baseType === "integer" || value2.baseType === "float")) {
|
|
766
793
|
return +value1.value > +value2.value;
|
|
767
794
|
} else {
|
|
@@ -780,6 +807,9 @@ var QtiGte = class extends QtiConditionExpression {
|
|
|
780
807
|
const values = this.getVariables();
|
|
781
808
|
const value1 = values[0];
|
|
782
809
|
const value2 = values[1];
|
|
810
|
+
if (isNullValue(value1?.value) || isNullValue(value2?.value)) {
|
|
811
|
+
return null;
|
|
812
|
+
}
|
|
783
813
|
if ((value1.baseType === "integer" || value1.baseType === "float") && (value2.baseType === "integer" || value2.baseType === "float")) {
|
|
784
814
|
return +value1.value >= +value2.value;
|
|
785
815
|
} else {
|
|
@@ -1257,6 +1287,9 @@ var QtiLt = class extends QtiExpression {
|
|
|
1257
1287
|
const values = this.getVariables();
|
|
1258
1288
|
const value1 = values[0];
|
|
1259
1289
|
const value2 = values[1];
|
|
1290
|
+
if (isNullValue(value1?.value) || isNullValue(value2?.value)) {
|
|
1291
|
+
return null;
|
|
1292
|
+
}
|
|
1260
1293
|
if ((value1.baseType === "integer" || value1.baseType === "float") && (value2.baseType === "integer" || value2.baseType === "float")) {
|
|
1261
1294
|
return +value1.value < +value2.value;
|
|
1262
1295
|
} else {
|
|
@@ -1275,6 +1308,9 @@ var QtiLte = class extends QtiConditionExpression {
|
|
|
1275
1308
|
const values = this.getVariables();
|
|
1276
1309
|
const value1 = values[0];
|
|
1277
1310
|
const value2 = values[1];
|
|
1311
|
+
if (isNullValue(value1?.value) || isNullValue(value2?.value)) {
|
|
1312
|
+
return null;
|
|
1313
|
+
}
|
|
1278
1314
|
if ((value1.baseType === "integer" || value1.baseType === "float") && (value2.baseType === "integer" || value2.baseType === "float")) {
|
|
1279
1315
|
return +value1.value <= +value2.value;
|
|
1280
1316
|
} else {
|
|
@@ -1307,8 +1343,8 @@ var QtiMapResponsePoint = class extends QtiExpression {
|
|
|
1307
1343
|
console.warn(`Area mapping not found for response ${this.identifier}`);
|
|
1308
1344
|
return null;
|
|
1309
1345
|
}
|
|
1310
|
-
const candidateResponses = !Array.isArray(response.value) ? [response.value] : response.value;
|
|
1311
|
-
if (
|
|
1346
|
+
const candidateResponses = (!Array.isArray(response.value) ? [response.value] : response.value).filter((value) => typeof value === "string" && value.length > 0);
|
|
1347
|
+
if (candidateResponses.length === 0) {
|
|
1312
1348
|
console.warn(`No candidate responses for response ${this.identifier}`);
|
|
1313
1349
|
return null;
|
|
1314
1350
|
}
|
|
@@ -1961,9 +1997,14 @@ var QtiConditionElseBase = class extends QtiConditionBranchBase {
|
|
|
1961
1997
|
}
|
|
1962
1998
|
};
|
|
1963
1999
|
var QtiConditionIfBase = class extends QtiConditionBranchBase {
|
|
2000
|
+
/**
|
|
2001
|
+
* Variables and base values hold a boolean as the string `'true'` or `'false'`, and `'false'` is
|
|
2002
|
+
* truthy, so the condition applies only to `true` itself; `false` and NULL do not.
|
|
2003
|
+
*/
|
|
1964
2004
|
shouldProcess() {
|
|
1965
2005
|
const expression = this.firstElementChild;
|
|
1966
|
-
|
|
2006
|
+
const value = expression.calculate();
|
|
2007
|
+
return value === true || value === "true";
|
|
1967
2008
|
}
|
|
1968
2009
|
getSubRules() {
|
|
1969
2010
|
const result = [];
|
|
@@ -3344,4 +3385,4 @@ export {
|
|
|
3344
3385
|
QtiVariable,
|
|
3345
3386
|
qtiProcessingElements
|
|
3346
3387
|
};
|
|
3347
|
-
//# sourceMappingURL=chunk-
|
|
3388
|
+
//# sourceMappingURL=chunk-LPYZVKHX.js.map
|