@citolab/qti-components 10.0.0-next.20 → 10.0.0-next.22
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 +200 -200
- package/dist/base.d.ts +2 -2
- package/dist/{chunk-ORQFZNJW.js → chunk-373IRT4X.js} +106 -113
- package/dist/chunk-373IRT4X.js.map +1 -0
- package/dist/{chunk-GJWA6LLT.js → chunk-BB2ZSJXP.js} +2 -2
- package/dist/{chunk-Y6Q3F2S7.js → chunk-L73QXB6G.js} +2 -2
- package/dist/{computed.types.d-6Ht-HNRx.d.ts → computed.types.d-6qQNFbu1.d.ts} +0 -2
- package/dist/corrections.d.ts +2 -2
- package/dist/corrections.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/qti-components-jsx.d.ts +0 -20
- package/dist/{qti-test-state-CF9S8X9C.d.ts → qti-test-state-C71K8UNC.d.ts} +1 -1
- package/dist/{qti-test.d-sskv-dEN.d.ts → qti-test.d-CN2JZwAz.d.ts} +38 -3
- package/dist/test-plugin-api.d.ts +2 -2
- package/dist/test.d.ts +4 -4
- package/dist/test.js +2 -2
- package/package.json +4 -4
- package/dist/chunk-ORQFZNJW.js.map +0 -1
- /package/dist/{chunk-GJWA6LLT.js.map → chunk-BB2ZSJXP.js.map} +0 -0
- /package/dist/{chunk-Y6Q3F2S7.js.map → chunk-L73QXB6G.js.map} +0 -0
package/dist/base.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { C as ComputedItemContext } from './session.context.d-9gRdGK4T.js';
|
|
2
2
|
export { I as INITIAL_SESSION_CONTEXT, S as SessionContext, V as View, s as sessionContext } from './session.context.d-9gRdGK4T.js';
|
|
3
|
-
import { C as ComputedContext } from './computed.types.d-
|
|
4
|
-
export { a as ComputedItem, S as SessionControl } from './computed.types.d-
|
|
3
|
+
import { C as ComputedContext } from './computed.types.d-6qQNFbu1.js';
|
|
4
|
+
export { a as ComputedItem, S as SessionControl } from './computed.types.d-6qQNFbu1.js';
|
|
5
5
|
export { C as ConfigContext, V as ValidationDisplayMode, c as configContext } from './config.context.d-Dm11aAuw.js';
|
|
6
6
|
export { C as ChoiceRole, I as Interaction, a as InteractionContext, R as RecordFieldValues, b as RecordValue, V as ValidityKind, c as ValidityTrigger, i as inferRecordFieldBaseType, d as interactionContext, e as isRecordValue, r as readRecordFieldValues } from './record.d-N1Bq7e1f.js';
|
|
7
7
|
import { I as ItemContext } from './item.types.d-Zc6ZQDhu.js';
|
|
@@ -1303,12 +1303,6 @@ __decorate2([
|
|
|
1303
1303
|
__decorate2([
|
|
1304
1304
|
property2({ type: Boolean, converter: stringToBooleanConverter2, attribute: "keep-together" })
|
|
1305
1305
|
], QtiAssessmentSection.prototype, "keepTogether", void 0);
|
|
1306
|
-
__decorate2([
|
|
1307
|
-
property2({ type: String, attribute: "navigation-mode" })
|
|
1308
|
-
], QtiAssessmentSection.prototype, "navigationMode", void 0);
|
|
1309
|
-
__decorate2([
|
|
1310
|
-
property2({ type: String, attribute: "submission-mode" })
|
|
1311
|
-
], QtiAssessmentSection.prototype, "submissionMode", void 0);
|
|
1312
1306
|
__decorate2([
|
|
1313
1307
|
consume2({ context: testContext, subscribe: true })
|
|
1314
1308
|
], QtiAssessmentSection.prototype, "_testContext", void 0);
|
|
@@ -1734,6 +1728,38 @@ function itemRefsInOrder(sections) {
|
|
|
1734
1728
|
return sections.flatMap((child) => child.kind === "itemRef" ? [child] : itemRefsInOrder(child.content));
|
|
1735
1729
|
}
|
|
1736
1730
|
|
|
1731
|
+
// ../qti-delivery/dist/model/item-facts.js
|
|
1732
|
+
function readItemFacts(item) {
|
|
1733
|
+
if (item.localName !== "qti-assessment-item") {
|
|
1734
|
+
throw new TypeError(`Expected a qti-assessment-item element, not ${String(item.localName)}.`);
|
|
1735
|
+
}
|
|
1736
|
+
const responseDeclarations = childElements(item, "qti-response-declaration");
|
|
1737
|
+
const score = childElements(item, "qti-outcome-declaration").find((declaration) => declaration.getAttribute("identifier") === "SCORE");
|
|
1738
|
+
return {
|
|
1739
|
+
identifier: item.getAttribute("identifier") ?? "",
|
|
1740
|
+
adaptive: booleanAttribute(item, "adaptive") ?? false,
|
|
1741
|
+
timeDependent: booleanAttribute(item, "time-dependent") ?? false,
|
|
1742
|
+
hasCorrectResponse: responseDeclarations.some(hasSomethingToCompareWith),
|
|
1743
|
+
hasResponseProcessing: childElement(item, "qti-response-processing") !== null,
|
|
1744
|
+
externalScored: externalScored(score),
|
|
1745
|
+
label: item.getAttribute("label"),
|
|
1746
|
+
title: item.getAttribute("title") ?? ""
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
function hasSomethingToCompareWith(declaration) {
|
|
1750
|
+
if (childElement(declaration, "qti-correct-response"))
|
|
1751
|
+
return true;
|
|
1752
|
+
const mapping = childElement(declaration, "qti-mapping");
|
|
1753
|
+
if (mapping && childElement(mapping, "qti-map-entry"))
|
|
1754
|
+
return true;
|
|
1755
|
+
const areaMapping = childElement(declaration, "qti-area-mapping");
|
|
1756
|
+
return areaMapping !== null && childElement(areaMapping, "qti-area-map-entry") !== null;
|
|
1757
|
+
}
|
|
1758
|
+
function externalScored(declaration) {
|
|
1759
|
+
const value = declaration?.getAttribute("external-scored")?.trim();
|
|
1760
|
+
return value === "human" || value === "externalMachine" ? value : null;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1737
1763
|
// ../qti-test/dist/components/qti-test-feedback/qti-test-feedback.js
|
|
1738
1764
|
var __decorate7 = function(decorators, target, key, desc) {
|
|
1739
1765
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1897,12 +1923,17 @@ var QtiTestVariablesExpression = class {
|
|
|
1897
1923
|
var QTI_TEST_STATE_VERSION = 1;
|
|
1898
1924
|
|
|
1899
1925
|
// ../qti-test/dist/components/qti-test/qti-test.js
|
|
1900
|
-
import { ContextProvider, provide as
|
|
1926
|
+
import { ContextProvider, provide as provide3 } from "@lit/context";
|
|
1901
1927
|
import { html as html9, LitElement as LitElement10 } from "lit";
|
|
1902
|
-
import { state as
|
|
1928
|
+
import { state as state3 } from "lit/decorators.js";
|
|
1903
1929
|
|
|
1904
1930
|
// ../qti-test/dist/mixins/test-navigation.mixin.js
|
|
1905
|
-
import {
|
|
1931
|
+
import { provide } from "@lit/context";
|
|
1932
|
+
import { property as property8, state as state2 } from "lit/decorators.js";
|
|
1933
|
+
|
|
1934
|
+
// ../qti-test/dist/internal/item-facts.context.js
|
|
1935
|
+
import { createContext as createContext2 } from "@lit/context";
|
|
1936
|
+
var itemFactsContext = createContext2(/* @__PURE__ */ Symbol("itemFacts"));
|
|
1906
1937
|
|
|
1907
1938
|
// ../qti-test/dist/internal/item-sequencing.js
|
|
1908
1939
|
var SECTION = "qti-assessment-section";
|
|
@@ -2009,6 +2040,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2009
2040
|
this.requestTimeout = 3e4;
|
|
2010
2041
|
this.postLoadTransformCallback = null;
|
|
2011
2042
|
this.postLoadTestTransformCallback = null;
|
|
2043
|
+
this.itemFacts = /* @__PURE__ */ new Map();
|
|
2012
2044
|
this._activeController = null;
|
|
2013
2045
|
this._loadResults = [];
|
|
2014
2046
|
this._navigationId = 0;
|
|
@@ -2048,6 +2080,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2048
2080
|
}
|
|
2049
2081
|
_handleTestConnected(e) {
|
|
2050
2082
|
this._testElement = e.detail;
|
|
2083
|
+
this.itemFacts = /* @__PURE__ */ new Map();
|
|
2051
2084
|
this._initializeNavigation();
|
|
2052
2085
|
}
|
|
2053
2086
|
/**
|
|
@@ -2140,10 +2173,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2140
2173
|
const currentItemRef = this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${currentItemId}"]`);
|
|
2141
2174
|
if (!currentItemRef)
|
|
2142
2175
|
return false;
|
|
2143
|
-
|
|
2144
|
-
const testPart = currentItemRef.closest("qti-test-part");
|
|
2145
|
-
const navigationMode = section?.navigationMode || section?.getAttribute("navigation-mode") || testPart?.navigationMode || testPart?.getAttribute("navigation-mode") || "nonlinear";
|
|
2146
|
-
if (navigationMode !== "linear")
|
|
2176
|
+
if (currentItemRef.closest("qti-test-part")?.getAttribute("navigation-mode") !== "linear")
|
|
2147
2177
|
return false;
|
|
2148
2178
|
const allItemRefs = Array.from(this._testElement?.querySelectorAll("qti-assessment-item-ref") || []);
|
|
2149
2179
|
const currentIndex = allItemRefs.findIndex((ref) => ref.identifier === currentItemId);
|
|
@@ -2382,10 +2412,14 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2382
2412
|
const validResults = results.filter(Boolean);
|
|
2383
2413
|
if (this._isStaleNavigation(navigationId, controller))
|
|
2384
2414
|
return;
|
|
2385
|
-
|
|
2415
|
+
const itemFacts = new Map(this.itemFacts);
|
|
2416
|
+
validResults.forEach(({ itemRef, doc, facts }) => {
|
|
2386
2417
|
if (itemRef && doc)
|
|
2387
2418
|
itemRef.xmlDoc = doc;
|
|
2419
|
+
if (itemRef && facts)
|
|
2420
|
+
itemFacts.set(itemRef.identifier, facts);
|
|
2388
2421
|
});
|
|
2422
|
+
this.itemFacts = itemFacts;
|
|
2389
2423
|
validResults.forEach(({ itemRef }) => {
|
|
2390
2424
|
const itemId = itemRef?.identifier;
|
|
2391
2425
|
if (!itemRef || !itemId)
|
|
@@ -2412,7 +2446,9 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2412
2446
|
if (this._isStaleNavigation(navigationId, controller)) {
|
|
2413
2447
|
return null;
|
|
2414
2448
|
}
|
|
2415
|
-
|
|
2449
|
+
const item = transformer.xmlDoc().documentElement;
|
|
2450
|
+
const facts = item?.localName === "qti-assessment-item" ? readItemFacts(item) : null;
|
|
2451
|
+
return { itemRef, doc: transformer.htmlDoc(this._customElementRegistry()), facts };
|
|
2416
2452
|
} catch (error) {
|
|
2417
2453
|
if (error.name === "AbortError") {
|
|
2418
2454
|
console.info(`Item load for ${itemRef.identifier} was aborted`);
|
|
@@ -2517,6 +2553,10 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2517
2553
|
__decorate10([
|
|
2518
2554
|
property8({ attribute: false })
|
|
2519
2555
|
], TestNavigationClass.prototype, "postLoadTestTransformCallback", void 0);
|
|
2556
|
+
__decorate10([
|
|
2557
|
+
state2(),
|
|
2558
|
+
provide({ context: itemFactsContext })
|
|
2559
|
+
], TestNavigationClass.prototype, "itemFacts", void 0);
|
|
2520
2560
|
return TestNavigationClass;
|
|
2521
2561
|
};
|
|
2522
2562
|
|
|
@@ -2569,7 +2609,7 @@ var TestViewMixin = (superClass) => {
|
|
|
2569
2609
|
};
|
|
2570
2610
|
|
|
2571
2611
|
// ../qti-test/dist/mixins/test-base.js
|
|
2572
|
-
import { provide } from "@lit/context";
|
|
2612
|
+
import { provide as provide2 } from "@lit/context";
|
|
2573
2613
|
import { LitElement as LitElement9 } from "lit";
|
|
2574
2614
|
import { property as property9 } from "lit/decorators.js";
|
|
2575
2615
|
var __decorate11 = function(decorators, target, key, desc) {
|
|
@@ -2628,7 +2668,7 @@ var TestBaseMixin = (superClass) => {
|
|
|
2628
2668
|
* @param itemRefID The `qti-assessment-item-ref` identifier, not the item's own identifier.
|
|
2629
2669
|
* @param state Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`.
|
|
2630
2670
|
*/
|
|
2631
|
-
updateItemVariables(itemRefID, values,
|
|
2671
|
+
updateItemVariables(itemRefID, values, state6) {
|
|
2632
2672
|
this.testContext = {
|
|
2633
2673
|
...this.testContext,
|
|
2634
2674
|
items: this.testContext.items.map((item) => {
|
|
@@ -2648,15 +2688,15 @@ var TestBaseMixin = (superClass) => {
|
|
|
2648
2688
|
else
|
|
2649
2689
|
variables.push(updated);
|
|
2650
2690
|
}
|
|
2651
|
-
return { ...item, variables, ...
|
|
2691
|
+
return { ...item, variables, ...state6 ? { state: { ...state6 } } : {} };
|
|
2652
2692
|
})
|
|
2653
2693
|
};
|
|
2654
2694
|
const assessmentItem = this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(itemRefID)}"]`)?.assessmentItem;
|
|
2655
2695
|
if (!assessmentItem)
|
|
2656
2696
|
return;
|
|
2657
2697
|
assessmentItem.variables = [...this.testContext.items.find((i) => i.identifier === itemRefID)?.variables ?? []];
|
|
2658
|
-
if (
|
|
2659
|
-
assessmentItem.state =
|
|
2698
|
+
if (state6)
|
|
2699
|
+
assessmentItem.state = state6;
|
|
2660
2700
|
}
|
|
2661
2701
|
_initializeEventListeners() {
|
|
2662
2702
|
this.addEventListener("qti-testdoc-loaded", () => {
|
|
@@ -2693,7 +2733,7 @@ var TestBaseMixin = (superClass) => {
|
|
|
2693
2733
|
this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail.itemContext.variables, e.detail.itemContext.state, e.detail.itemContext.valid);
|
|
2694
2734
|
});
|
|
2695
2735
|
}
|
|
2696
|
-
_updateItemVariablesInTestContext(identifier, variables,
|
|
2736
|
+
_updateItemVariablesInTestContext(identifier, variables, state6, valid) {
|
|
2697
2737
|
this.testContext = {
|
|
2698
2738
|
...this.testContext,
|
|
2699
2739
|
// Spread existing test context properties
|
|
@@ -2708,7 +2748,7 @@ var TestBaseMixin = (superClass) => {
|
|
|
2708
2748
|
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
2709
2749
|
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
2710
2750
|
}),
|
|
2711
|
-
...
|
|
2751
|
+
...state6 !== void 0 ? { state: state6 ? { ...state6 } : void 0 } : {},
|
|
2712
2752
|
...valid !== void 0 ? { valid } : {}
|
|
2713
2753
|
};
|
|
2714
2754
|
})
|
|
@@ -2734,11 +2774,11 @@ var TestBaseMixin = (superClass) => {
|
|
|
2734
2774
|
}
|
|
2735
2775
|
__decorate11([
|
|
2736
2776
|
property9({ attribute: false, type: Object }),
|
|
2737
|
-
|
|
2777
|
+
provide2({ context: testContext })
|
|
2738
2778
|
], TestBaseClass.prototype, "testContext", void 0);
|
|
2739
2779
|
__decorate11([
|
|
2740
2780
|
property9({ attribute: false, type: Object }),
|
|
2741
|
-
|
|
2781
|
+
provide2({ context: sessionContext })
|
|
2742
2782
|
], TestBaseClass.prototype, "sessionContext", void 0);
|
|
2743
2783
|
return TestBaseClass;
|
|
2744
2784
|
};
|
|
@@ -2748,8 +2788,8 @@ var TestBase = class extends TestBaseMixin(LitElement9) {
|
|
|
2748
2788
|
// ../qti-test/dist/mixins/test-state.mixin.js
|
|
2749
2789
|
var copy = (value) => Array.isArray(value) ? [...value] : value ?? null;
|
|
2750
2790
|
var isQtiTestState = (value) => {
|
|
2751
|
-
const
|
|
2752
|
-
return
|
|
2791
|
+
const state6 = value;
|
|
2792
|
+
return state6?.version === QTI_TEST_STATE_VERSION && Array.isArray(state6.test?.items) && Array.isArray(state6.test?.outcomes) && typeof state6.session === "object" && state6.session !== null;
|
|
2753
2793
|
};
|
|
2754
2794
|
var toState = (test, session) => ({
|
|
2755
2795
|
version: QTI_TEST_STATE_VERSION,
|
|
@@ -2839,25 +2879,25 @@ var TestStateMixin = (superClass) => {
|
|
|
2839
2879
|
super.updated(changed);
|
|
2840
2880
|
if (!this.#ready || !(changed.has("testContext") || changed.has("sessionContext")))
|
|
2841
2881
|
return;
|
|
2842
|
-
const
|
|
2843
|
-
const serialized = JSON.stringify(
|
|
2882
|
+
const state6 = this.state;
|
|
2883
|
+
const serialized = JSON.stringify(state6);
|
|
2844
2884
|
if (serialized === this.#lastEmitted)
|
|
2845
2885
|
return;
|
|
2846
2886
|
this.#lastEmitted = serialized;
|
|
2847
|
-
dispatchPublic(this, "qc-test-state-changed",
|
|
2887
|
+
dispatchPublic(this, "qc-test-state-changed", state6);
|
|
2848
2888
|
}
|
|
2849
|
-
#apply(
|
|
2850
|
-
for (const saved of
|
|
2889
|
+
#apply(state6) {
|
|
2890
|
+
for (const saved of state6.test.items)
|
|
2851
2891
|
this.updateItemVariables(saved.identifier, saved.variables, saved.state);
|
|
2852
|
-
const savedOutcomes = new Map(
|
|
2892
|
+
const savedOutcomes = new Map(state6.test.outcomes.map((outcome) => [outcome.identifier, outcome.value]));
|
|
2853
2893
|
this.testContext = {
|
|
2854
2894
|
...this.testContext,
|
|
2855
2895
|
testOutcomeVariables: this.testContext.testOutcomeVariables?.map((v) => savedOutcomes.has(v.identifier) ? { ...v, value: copy(savedOutcomes.get(v.identifier)) } : v)
|
|
2856
2896
|
};
|
|
2857
2897
|
this.sessionContext = {
|
|
2858
2898
|
...this.sessionContext,
|
|
2859
|
-
...this.#validSession(
|
|
2860
|
-
plugins:
|
|
2899
|
+
...this.#validSession(state6.session),
|
|
2900
|
+
plugins: state6.session.plugins && typeof state6.session.plugins === "object" ? { ...state6.session.plugins } : {}
|
|
2861
2901
|
};
|
|
2862
2902
|
}
|
|
2863
2903
|
/** A stored position may point at an item or section a revised test no longer has. */
|
|
@@ -2994,18 +3034,18 @@ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixi
|
|
|
2994
3034
|
}
|
|
2995
3035
|
};
|
|
2996
3036
|
__decorate12([
|
|
2997
|
-
|
|
2998
|
-
|
|
3037
|
+
state3(),
|
|
3038
|
+
provide3({ context: configContext })
|
|
2999
3039
|
], QtiTest.prototype, "configContext", void 0);
|
|
3000
3040
|
__decorate12([
|
|
3001
|
-
|
|
3002
|
-
|
|
3041
|
+
state3(),
|
|
3042
|
+
provide3({ context: qtiContext })
|
|
3003
3043
|
], QtiTest.prototype, "qtiContext", void 0);
|
|
3004
3044
|
|
|
3005
3045
|
// ../qti-test/dist/components/test-container/test-container.js
|
|
3006
3046
|
import { consume as consume6 } from "@lit/context";
|
|
3007
3047
|
import { LitElement as LitElement11, html as html10 } from "lit";
|
|
3008
|
-
import { property as property10, state as
|
|
3048
|
+
import { property as property10, state as state4 } from "lit/decorators.js";
|
|
3009
3049
|
import { until } from "lit/directives/until.js";
|
|
3010
3050
|
var __decorate13 = function(decorators, target, key, desc) {
|
|
3011
3051
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -3120,16 +3160,16 @@ __decorate13([
|
|
|
3120
3160
|
property10({ type: String, attribute: "test-url" })
|
|
3121
3161
|
], TestContainer.prototype, "testURL", void 0);
|
|
3122
3162
|
__decorate13([
|
|
3123
|
-
|
|
3163
|
+
state4()
|
|
3124
3164
|
], TestContainer.prototype, "testDoc", void 0);
|
|
3125
3165
|
__decorate13([
|
|
3126
|
-
|
|
3166
|
+
state4()
|
|
3127
3167
|
], TestContainer.prototype, "testXML", void 0);
|
|
3128
3168
|
__decorate13([
|
|
3129
3169
|
consume6({ context: testHostContext, subscribe: true })
|
|
3130
3170
|
], TestContainer.prototype, "testHost", void 0);
|
|
3131
3171
|
__decorate13([
|
|
3132
|
-
|
|
3172
|
+
state4(),
|
|
3133
3173
|
consume6({ context: qtiContext, subscribe: true })
|
|
3134
3174
|
], TestContainer.prototype, "qtiContext", void 0);
|
|
3135
3175
|
__decorate13([
|
|
@@ -3237,9 +3277,9 @@ __decorate14([
|
|
|
3237
3277
|
], TestEndAttempt.prototype, "_handleTestElementChange", null);
|
|
3238
3278
|
|
|
3239
3279
|
// ../qti-test/dist/components/test-navigation/test-navigation.js
|
|
3240
|
-
import { ContextConsumer, consume as consume8, provide as
|
|
3280
|
+
import { ContextConsumer, consume as consume8, provide as provide4 } from "@lit/context";
|
|
3241
3281
|
import { html as html11, LitElement as LitElement13 } from "lit";
|
|
3242
|
-
import { property as property12, state as
|
|
3282
|
+
import { property as property12, state as state5 } from "lit/decorators.js";
|
|
3243
3283
|
|
|
3244
3284
|
// ../qti-test/dist/internal/rendered-markup.js
|
|
3245
3285
|
function renderedMarkup(element) {
|
|
@@ -3331,7 +3371,6 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3331
3371
|
this.#itemOrder = [];
|
|
3332
3372
|
this.#lockedItems = /* @__PURE__ */ new WeakSet();
|
|
3333
3373
|
listenPublic2(this, "qc-test-loaded", this.#handleTestConnected.bind(this));
|
|
3334
|
-
this.addEventListener("qti-assessment-item-connected", this.#handleItemConnected.bind(this));
|
|
3335
3374
|
listenPublic(this, "qc-item-response-changed", this.#handleInteractionChanged.bind(this));
|
|
3336
3375
|
this.addEventListener("qti-item-context-updated", this.#handleItemContextUpdated.bind(this));
|
|
3337
3376
|
listenPublic2(this, "qc-test-end-attempt", this.#handleTestEndAttempt.bind(this));
|
|
@@ -3471,8 +3510,6 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3471
3510
|
active: false,
|
|
3472
3511
|
identifier: section.identifier,
|
|
3473
3512
|
title: section.title,
|
|
3474
|
-
// QTI defines both modes on the test part only; the section attributes go in roadmap T1d.
|
|
3475
|
-
...this.#sectionModes(section.identifier),
|
|
3476
3513
|
allowSkipping: section.sessionControl.allowSkipping,
|
|
3477
3514
|
items: ownItemRefs(section).map((item) => ({
|
|
3478
3515
|
...this.initContext?.find((i) => i.identifier === item.identifier),
|
|
@@ -3502,14 +3539,6 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3502
3539
|
item.categories.includes(this.configContext?.infoItemCategory) ? null : index++
|
|
3503
3540
|
]));
|
|
3504
3541
|
}
|
|
3505
|
-
/** The non-QTI `navigation-mode` / `submission-mode` a section declares, as before; removed in T1d. */
|
|
3506
|
-
#sectionModes(identifier) {
|
|
3507
|
-
const section = this.#testElement.querySelector(`qti-assessment-section[identifier="${CSS.escape(identifier)}"]`);
|
|
3508
|
-
return {
|
|
3509
|
-
navigationMode: section?.getAttribute("navigation-mode") ?? void 0,
|
|
3510
|
-
submissionMode: section?.getAttribute("submission-mode") ?? void 0
|
|
3511
|
-
};
|
|
3512
|
-
}
|
|
3513
3542
|
/**
|
|
3514
3543
|
* Extract default values from a qti-context-declaration element
|
|
3515
3544
|
*/
|
|
@@ -3547,50 +3576,13 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3547
3576
|
});
|
|
3548
3577
|
return defaultValues;
|
|
3549
3578
|
}
|
|
3550
|
-
|
|
3551
|
-
#
|
|
3552
|
-
const
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
...testPart,
|
|
3558
|
-
sections: testPart.sections.map((section) => {
|
|
3559
|
-
return {
|
|
3560
|
-
...section,
|
|
3561
|
-
items: section.items.map((item) => {
|
|
3562
|
-
if (item.identifier !== itemElement.parentElement.getAttribute("identifier")) {
|
|
3563
|
-
return item;
|
|
3564
|
-
}
|
|
3565
|
-
const scoreOutcome = itemElement.querySelector("qti-outcome-declaration[identifier='SCORE']");
|
|
3566
|
-
const externalScored = scoreOutcome?.getAttribute("externalScored");
|
|
3567
|
-
const responseDeclarations = itemElement.querySelectorAll("qti-response-declaration");
|
|
3568
|
-
const containsCorrectResponse = Array.from(responseDeclarations).some((r) => r.querySelector("qti-correct-response"));
|
|
3569
|
-
const containsMapping = Array.from(responseDeclarations).some((r) => {
|
|
3570
|
-
const mapping = r.querySelector("qti-mapping");
|
|
3571
|
-
const areaMapping = r.querySelector("qti-area-mapping");
|
|
3572
|
-
return mapping?.querySelector("qti-map-entry") || areaMapping?.querySelector("qti-area-map-entry");
|
|
3573
|
-
});
|
|
3574
|
-
const hasCorrectResponse = containsCorrectResponse || containsMapping;
|
|
3575
|
-
const hasResponseProcessing = itemElement.querySelector("qti-response-processing") ? true : false;
|
|
3576
|
-
return {
|
|
3577
|
-
...item,
|
|
3578
|
-
assessmentItemIdentifier: itemElement.getAttribute("identifier"),
|
|
3579
|
-
label: itemElement.getAttribute("label"),
|
|
3580
|
-
title: itemElement.title,
|
|
3581
|
-
externalScored,
|
|
3582
|
-
adaptive: itemElement.adaptive == "true" || false,
|
|
3583
|
-
timeDependent: itemElement.timeDependent == "true" || false,
|
|
3584
|
-
variables: itemElement.variables,
|
|
3585
|
-
hasCorrectResponse,
|
|
3586
|
-
hasResponseProcessing
|
|
3587
|
-
};
|
|
3588
|
-
})
|
|
3589
|
-
};
|
|
3590
|
-
})
|
|
3591
|
-
};
|
|
3592
|
-
})
|
|
3593
|
-
};
|
|
3579
|
+
/** An item's facts as `computedContext` has carried them; nothing until the item is fetched. */
|
|
3580
|
+
#factsFor(identifier) {
|
|
3581
|
+
const facts = this._itemFacts?.get(identifier);
|
|
3582
|
+
if (!facts)
|
|
3583
|
+
return {};
|
|
3584
|
+
const { identifier: assessmentItemIdentifier, ...rest } = facts;
|
|
3585
|
+
return { ...rest, assessmentItemIdentifier };
|
|
3594
3586
|
}
|
|
3595
3587
|
/* PK: on every change of the candidate we will recomputed the computedContext */
|
|
3596
3588
|
willUpdate(_changedProperties) {
|
|
@@ -3614,6 +3606,7 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3614
3606
|
const itemContext = this._testContext?.items.find((i) => i.identifier === item.identifier);
|
|
3615
3607
|
const computedItem = {
|
|
3616
3608
|
...item,
|
|
3609
|
+
...this.#factsFor(item.identifier),
|
|
3617
3610
|
...itemContext,
|
|
3618
3611
|
...this.initContext?.find((i) => i.identifier === item.identifier)
|
|
3619
3612
|
};
|
|
@@ -3717,7 +3710,7 @@ var TestNavigation = class extends LitElement13 {
|
|
|
3717
3710
|
#lockUsedItems() {
|
|
3718
3711
|
if (!this.#testElement || !this.computedContext)
|
|
3719
3712
|
return;
|
|
3720
|
-
const items = new Map(this.computedContext.testParts.flatMap((part) => part.
|
|
3713
|
+
const items = new Map(this.computedContext.testParts.flatMap((part) => part.submissionMode === "simultaneous" ? [] : part.sections.flatMap((section) => section.items.map((item) => [item.identifier, item]))));
|
|
3721
3714
|
for (const itemRef of this.#testElement.querySelectorAll("qti-assessment-item-ref")) {
|
|
3722
3715
|
const element = itemRef.assessmentItem;
|
|
3723
3716
|
if (!element)
|
|
@@ -3833,23 +3826,27 @@ __decorate15([
|
|
|
3833
3826
|
property12({ type: String })
|
|
3834
3827
|
], TestNavigation.prototype, "identifier", void 0);
|
|
3835
3828
|
__decorate15([
|
|
3836
|
-
|
|
3829
|
+
state5()
|
|
3837
3830
|
], TestNavigation.prototype, "initContext", void 0);
|
|
3838
3831
|
__decorate15([
|
|
3839
|
-
|
|
3832
|
+
state5(),
|
|
3840
3833
|
consume8({ context: configContext, subscribe: true })
|
|
3841
3834
|
], TestNavigation.prototype, "configContext", void 0);
|
|
3842
3835
|
__decorate15([
|
|
3843
|
-
|
|
3836
|
+
state5(),
|
|
3844
3837
|
consume8({ context: testContext, subscribe: true })
|
|
3845
3838
|
], TestNavigation.prototype, "_testContext", void 0);
|
|
3846
3839
|
__decorate15([
|
|
3847
|
-
|
|
3840
|
+
state5(),
|
|
3848
3841
|
consume8({ context: sessionContext, subscribe: true })
|
|
3849
3842
|
], TestNavigation.prototype, "_sessionContext", void 0);
|
|
3850
3843
|
__decorate15([
|
|
3851
|
-
|
|
3852
|
-
|
|
3844
|
+
state5(),
|
|
3845
|
+
consume8({ context: itemFactsContext, subscribe: true })
|
|
3846
|
+
], TestNavigation.prototype, "_itemFacts", void 0);
|
|
3847
|
+
__decorate15([
|
|
3848
|
+
state5(),
|
|
3849
|
+
provide4({ context: computedContext })
|
|
3853
3850
|
], TestNavigation.prototype, "computedContext", void 0);
|
|
3854
3851
|
__decorate15([
|
|
3855
3852
|
property12({ type: Boolean, attribute: "auto-score-items" })
|
|
@@ -3905,11 +3902,8 @@ var TestNext = class extends LitElement14 {
|
|
|
3905
3902
|
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
3906
3903
|
if (!testPart)
|
|
3907
3904
|
return;
|
|
3908
|
-
const activeSection = testPart.sections.find((s) => s.active);
|
|
3909
|
-
const navigationMode = activeSection?.navigationMode || testPart.navigationMode;
|
|
3910
|
-
const submissionMode = activeSection?.submissionMode || testPart.submissionMode;
|
|
3911
3905
|
const activeItem = this.sectionItems[this.itemIndex];
|
|
3912
|
-
const isLinearIndividual = navigationMode === "linear" && submissionMode === "individual";
|
|
3906
|
+
const isLinearIndividual = testPart.navigationMode === "linear" && testPart.submissionMode === "individual";
|
|
3913
3907
|
this._internalDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= (this.sectionItems?.length ?? 0) - 1 || isLinearIndividual && !activeItem?.done;
|
|
3914
3908
|
}
|
|
3915
3909
|
_requestItem(identifier) {
|
|
@@ -3969,8 +3963,7 @@ var TestPrev = class extends LitElement15 {
|
|
|
3969
3963
|
}
|
|
3970
3964
|
checkDisabled() {
|
|
3971
3965
|
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
3972
|
-
const
|
|
3973
|
-
const navigationMode = activeSection?.navigationMode || testPart?.navigationMode || "nonlinear";
|
|
3966
|
+
const navigationMode = testPart?.navigationMode ?? "nonlinear";
|
|
3974
3967
|
this._internalDisabled = navigationMode === "linear" || !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
|
|
3975
3968
|
}
|
|
3976
3969
|
_requestItem(identifier) {
|
|
@@ -4069,4 +4062,4 @@ export {
|
|
|
4069
4062
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
4070
4063
|
*)
|
|
4071
4064
|
*/
|
|
4072
|
-
//# sourceMappingURL=chunk-
|
|
4065
|
+
//# sourceMappingURL=chunk-373IRT4X.js.map
|