@citolab/qti-components 10.0.0-next.22 → 10.0.0-next.23
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 +143 -143
- package/dist/{chunk-BB2ZSJXP.js → chunk-DJQE4M7B.js} +2 -2
- package/dist/{chunk-373IRT4X.js → chunk-IJKHXJSM.js} +49 -34
- package/dist/chunk-IJKHXJSM.js.map +1 -0
- package/dist/{chunk-L73QXB6G.js → chunk-ULJ22VKL.js} +2 -2
- package/dist/corrections.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -4
- package/dist/test.d.ts +48 -2
- package/dist/test.js +6 -4
- package/package.json +2 -2
- package/dist/chunk-373IRT4X.js.map +0 -1
- /package/dist/{chunk-BB2ZSJXP.js.map → chunk-DJQE4M7B.js.map} +0 -0
- /package/dist/{chunk-L73QXB6G.js.map → chunk-ULJ22VKL.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
qtiTestElements
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IJKHXJSM.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-
|
|
11
|
+
//# sourceMappingURL=chunk-DJQE4M7B.js.map
|
|
@@ -1905,10 +1905,10 @@ var QtiTestVariablesExpression = class {
|
|
|
1905
1905
|
const uniqueItems = [...new Set(this.includedItems.map((item) => item.item))];
|
|
1906
1906
|
items.forEach((item) => {
|
|
1907
1907
|
if (uniqueItems.includes(item.identifier)) {
|
|
1908
|
-
const
|
|
1908
|
+
const variable2 = item.variables.find((vr) => vr.identifier === this.itemVariable);
|
|
1909
1909
|
const weight = this.includedItems.find((i) => i.item === item.identifier)?.weight ?? 1;
|
|
1910
|
-
if (
|
|
1911
|
-
const value = Number(
|
|
1910
|
+
if (variable2) {
|
|
1911
|
+
const value = Number(variable2.value);
|
|
1912
1912
|
if (!Number.isNaN(value)) {
|
|
1913
1913
|
total += value * weight;
|
|
1914
1914
|
}
|
|
@@ -1922,6 +1922,41 @@ var QtiTestVariablesExpression = class {
|
|
|
1922
1922
|
// ../qti-test/dist/types/qti-test-state.js
|
|
1923
1923
|
var QTI_TEST_STATE_VERSION = 1;
|
|
1924
1924
|
|
|
1925
|
+
// ../qti-test/dist/state-from-contexts.js
|
|
1926
|
+
var VARIABLE_TYPES = ["response", "outcome", "template", "context"];
|
|
1927
|
+
var valueOf = (value) => {
|
|
1928
|
+
if (value === null || value === void 0)
|
|
1929
|
+
return null;
|
|
1930
|
+
if (Array.isArray(value))
|
|
1931
|
+
return value.map(String);
|
|
1932
|
+
return String(value);
|
|
1933
|
+
};
|
|
1934
|
+
var variable = ({ identifier, type, value }) => ({
|
|
1935
|
+
identifier,
|
|
1936
|
+
...VARIABLE_TYPES.includes(type) ? { type } : {},
|
|
1937
|
+
value: valueOf(value)
|
|
1938
|
+
});
|
|
1939
|
+
var stateFromContexts = (testContext2, sessionContext2) => ({
|
|
1940
|
+
version: QTI_TEST_STATE_VERSION,
|
|
1941
|
+
test: {
|
|
1942
|
+
items: (testContext2?.items ?? []).filter((item) => item?.identifier).map((item) => ({
|
|
1943
|
+
identifier: item.identifier,
|
|
1944
|
+
variables: (item.variables ?? []).map(variable),
|
|
1945
|
+
...item.state ? { state: { ...item.state } } : {}
|
|
1946
|
+
})),
|
|
1947
|
+
outcomes: (testContext2?.testOutcomeVariables ?? []).map((v) => ({
|
|
1948
|
+
identifier: v.identifier,
|
|
1949
|
+
value: valueOf(v.value)
|
|
1950
|
+
}))
|
|
1951
|
+
},
|
|
1952
|
+
session: {
|
|
1953
|
+
...sessionContext2?.plugins && Object.keys(sessionContext2.plugins).length > 0 ? { plugins: { ...sessionContext2.plugins } } : {},
|
|
1954
|
+
...sessionContext2?.navPartId !== void 0 ? { navPartId: sessionContext2.navPartId } : {},
|
|
1955
|
+
...sessionContext2?.navSectionId !== void 0 ? { navSectionId: sessionContext2.navSectionId } : {},
|
|
1956
|
+
...sessionContext2?.navItemRefId !== void 0 ? { navItemRefId: sessionContext2.navItemRefId } : {}
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
|
|
1925
1960
|
// ../qti-test/dist/components/qti-test/qti-test.js
|
|
1926
1961
|
import { ContextProvider, provide as provide3 } from "@lit/context";
|
|
1927
1962
|
import { html as html9, LitElement as LitElement10 } from "lit";
|
|
@@ -2637,14 +2672,14 @@ var TestBaseMixin = (superClass) => {
|
|
|
2637
2672
|
this._updateItemVariablesInTestContext(identifier, fullVariables, void 0, context.valid);
|
|
2638
2673
|
} else {
|
|
2639
2674
|
const newVariables = [...assessmentItem.variables];
|
|
2640
|
-
for (const
|
|
2641
|
-
if (
|
|
2675
|
+
for (const variable2 of itemContext.variables) {
|
|
2676
|
+
if (variable2.identifier === "completionStatus" && variable2.value === "not_attempted")
|
|
2642
2677
|
continue;
|
|
2643
|
-
const currentVariable = newVariables.find((v) => v.identifier ===
|
|
2678
|
+
const currentVariable = newVariables.find((v) => v.identifier === variable2.identifier);
|
|
2644
2679
|
if (currentVariable) {
|
|
2645
|
-
currentVariable.value =
|
|
2680
|
+
currentVariable.value = variable2.value;
|
|
2646
2681
|
} else {
|
|
2647
|
-
newVariables.push(
|
|
2682
|
+
newVariables.push(variable2);
|
|
2648
2683
|
}
|
|
2649
2684
|
}
|
|
2650
2685
|
assessmentItem.variables = newVariables;
|
|
@@ -2744,9 +2779,9 @@ var TestBaseMixin = (superClass) => {
|
|
|
2744
2779
|
return {
|
|
2745
2780
|
...itemContext,
|
|
2746
2781
|
// Keep other properties of the item context
|
|
2747
|
-
variables: variables.map((
|
|
2748
|
-
const matchingVariable = itemContext.variables.find((v) => v.identifier ===
|
|
2749
|
-
return matchingVariable ? { ...matchingVariable, ...
|
|
2782
|
+
variables: variables.map((variable2) => {
|
|
2783
|
+
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable2.identifier);
|
|
2784
|
+
return matchingVariable ? { ...matchingVariable, ...variable2 } : variable2;
|
|
2750
2785
|
}),
|
|
2751
2786
|
...state6 !== void 0 ? { state: state6 ? { ...state6 } : void 0 } : {},
|
|
2752
2787
|
...valid !== void 0 ? { valid } : {}
|
|
@@ -2791,27 +2826,6 @@ var isQtiTestState = (value) => {
|
|
|
2791
2826
|
const state6 = value;
|
|
2792
2827
|
return state6?.version === QTI_TEST_STATE_VERSION && Array.isArray(state6.test?.items) && Array.isArray(state6.test?.outcomes) && typeof state6.session === "object" && state6.session !== null;
|
|
2793
2828
|
};
|
|
2794
|
-
var toState = (test, session) => ({
|
|
2795
|
-
version: QTI_TEST_STATE_VERSION,
|
|
2796
|
-
test: {
|
|
2797
|
-
items: (test?.items ?? []).filter((item) => item.identifier).map((item) => ({
|
|
2798
|
-
identifier: item.identifier,
|
|
2799
|
-
variables: (item.variables ?? []).map((v) => ({
|
|
2800
|
-
identifier: v.identifier,
|
|
2801
|
-
...v.type ? { type: v.type } : {},
|
|
2802
|
-
value: copy(v.value)
|
|
2803
|
-
})),
|
|
2804
|
-
...item.state ? { state: { ...item.state } } : {}
|
|
2805
|
-
})),
|
|
2806
|
-
outcomes: (test?.testOutcomeVariables ?? []).map((v) => ({ identifier: v.identifier, value: copy(v.value) }))
|
|
2807
|
-
},
|
|
2808
|
-
session: {
|
|
2809
|
-
...session?.plugins && Object.keys(session.plugins).length > 0 ? { plugins: { ...session.plugins } } : {},
|
|
2810
|
-
...session?.navPartId !== void 0 ? { navPartId: session.navPartId } : {},
|
|
2811
|
-
...session?.navSectionId !== void 0 ? { navSectionId: session.navSectionId } : {},
|
|
2812
|
-
...session?.navItemRefId !== void 0 ? { navItemRefId: session.navItemRefId } : {}
|
|
2813
|
-
}
|
|
2814
|
-
});
|
|
2815
2829
|
var TestStateMixin = (superClass) => {
|
|
2816
2830
|
class TestStateClass extends superClass {
|
|
2817
2831
|
/** A state assigned before the test connected, applied when it does. */
|
|
@@ -2855,7 +2869,7 @@ var TestStateMixin = (superClass) => {
|
|
|
2855
2869
|
this.sessionContext = { ...this.sessionContext, plugins: next };
|
|
2856
2870
|
}
|
|
2857
2871
|
get state() {
|
|
2858
|
-
return
|
|
2872
|
+
return stateFromContexts(this.testContext, this.sessionContext);
|
|
2859
2873
|
}
|
|
2860
2874
|
set state(value) {
|
|
2861
2875
|
if (!isQtiTestState(value)) {
|
|
@@ -4040,6 +4054,7 @@ export {
|
|
|
4040
4054
|
QtiTestVariables,
|
|
4041
4055
|
QtiTestVariablesExpression,
|
|
4042
4056
|
QTI_TEST_STATE_VERSION,
|
|
4057
|
+
stateFromContexts,
|
|
4043
4058
|
QtiTest,
|
|
4044
4059
|
TestContainer,
|
|
4045
4060
|
TestEndAttempt,
|
|
@@ -4062,4 +4077,4 @@ export {
|
|
|
4062
4077
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
4063
4078
|
*)
|
|
4064
4079
|
*/
|
|
4065
|
-
//# sourceMappingURL=chunk-
|
|
4080
|
+
//# sourceMappingURL=chunk-IJKHXJSM.js.map
|