@qti-components/test 1.5.4 → 1.6.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.
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/qti-item-session-control/qti-item-session-control.d.ts +21 -0
- package/dist/components/qti-item-session-control/qti-item-session-control.js +67 -0
- package/dist/components/qti-item-session-control/qti-item-session-control.js.map +1 -0
- package/dist/components/test-container/test-container.js +20 -3
- package/dist/components/test-container/test-container.js.map +1 -1
- package/dist/components/test-end-attempt/test-end-attempt.d.ts +6 -0
- package/dist/components/test-end-attempt/test-end-attempt.js +67 -1
- package/dist/components/test-end-attempt/test-end-attempt.js.map +1 -1
- package/dist/components/test-navigation/test-navigation.d.ts +10 -1
- package/dist/components/test-navigation/test-navigation.js +224 -10
- package/dist/components/test-navigation/test-navigation.js.map +1 -1
- package/dist/components/test-next/test-next.js +6 -6
- package/dist/components/test-next/test-next.js.map +1 -1
- package/dist/elements.d.ts +5 -1
- package/dist/elements.js +3 -1
- package/dist/elements.js.map +1 -1
- package/dist/mixins/test-base.js +17 -6
- package/dist/mixins/test-base.js.map +1 -1
- package/package.json +7 -7
|
@@ -6,6 +6,7 @@ export * from '../components/qti-test-part/qti-test-part';
|
|
|
6
6
|
export * from '../components/qti-test-feedback/qti-test-feedback';
|
|
7
7
|
export * from '../components/qti-outcome-processing/qti-outcome-processing';
|
|
8
8
|
export * from '../components/qti-test-variables/qti-test-variables';
|
|
9
|
+
export * from '../components/qti-item-session-control/qti-item-session-control';
|
|
9
10
|
export * from './test-navigation/test-navigation';
|
|
10
11
|
export * from './test-next/test-next';
|
|
11
12
|
export * from './test-prev/test-prev';
|
package/dist/components/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from '../components/qti-test-part/qti-test-part';
|
|
|
7
7
|
export * from '../components/qti-test-feedback/qti-test-feedback';
|
|
8
8
|
export * from '../components/qti-outcome-processing/qti-outcome-processing';
|
|
9
9
|
export * from '../components/qti-test-variables/qti-test-variables';
|
|
10
|
+
export * from '../components/qti-item-session-control/qti-item-session-control';
|
|
10
11
|
export * from './test-navigation/test-navigation';
|
|
11
12
|
export * from './test-next/test-next';
|
|
12
13
|
export * from './test-prev/test-prev';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,cAAc,iCAAiC,CAAC;AAChD,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mDAAmD,CAAC;AAClE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,cAAc,iCAAiC,CAAC;AAChD,cAAc,+DAA+D,CAAC;AAC9E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,uDAAuD,CAAC;AACtE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mDAAmD,CAAC;AAClE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,qDAAqD,CAAC;AACpE,cAAc,iEAAiE,CAAC;AAEhF,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uDAAuD,CAAC;AACtE,cAAc,iCAAiC,CAAC;AAChD,cAAc,uDAAuD,CAAC;AACtE,cAAc,yDAAyD,CAAC;AACxE,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,yBAAyB,CAAC;AACxC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,qCAAqC,CAAC;AACpD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mCAAmC,CAAC;AAClD,cAAc,2CAA2C,CAAC","sourcesContent":["/* test functionality webcomponents which are tested and can be used in your project */\nexport * from '../components/qti-test/qti-test';\nexport * from '../components/qti-assessment-item-ref/qti-assessment-item-ref';\nexport * from '../components/qti-assessment-section/qti-assessment-section';\nexport * from '../components/qti-assessment-test/qti-assessment-test';\nexport * from '../components/qti-test-part/qti-test-part';\nexport * from '../components/qti-test-feedback/qti-test-feedback';\nexport * from '../components/qti-outcome-processing/qti-outcome-processing';\nexport * from '../components/qti-test-variables/qti-test-variables';\nexport * from '../components/qti-item-session-control/qti-item-session-control';\n\nexport * from './test-navigation/test-navigation';\nexport * from './test-next/test-next';\nexport * from './test-prev/test-prev';\nexport * from './test-view-toggle/test-view';\nexport * from './test-item-link/test-item-link';\nexport * from './test-end-attempt/test-end-attempt';\nexport * from './test-paging-buttons-stamp/test-paging-buttons-stamp';\nexport * from './test-container/test-container';\nexport * from './test-print-item-variables/test-print-item-variables';\nexport * from './test-section-buttons-stamp/test-section-buttons-stamp';\nexport * from './test-section-link/test-section-link';\nexport * from './test-print-context/test-print-context';\nexport * from './test-stamp/test-stamp';\nexport * from './test-scoring-buttons/test-scoring-buttons';\nexport * from './test-view-toggle/test-view-toggle';\nexport * from './test-scoring-feedback/test-scoring-feedback';\nexport * from './test-check-item/test-check-item';\nexport * from './test-item-to-speech/test-item-to-speech';\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* @summary The qti-item-session-control element contains configurations relating to flow of test sessions.
|
|
4
|
+
* @documentation https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/imsqti_asi_v3p0p1_infomodel_v1p0.html#Derived_ItemSessionControl
|
|
5
|
+
*/
|
|
6
|
+
export declare class QtiItemSessionControl extends LitElement {
|
|
7
|
+
maxAttempts: number;
|
|
8
|
+
showFeedback: boolean;
|
|
9
|
+
allowReview: boolean;
|
|
10
|
+
showSolution: boolean;
|
|
11
|
+
allowComment: boolean;
|
|
12
|
+
allowSkipping: boolean;
|
|
13
|
+
validateResponses: boolean;
|
|
14
|
+
connectedCallback(): Promise<void>;
|
|
15
|
+
render(): import("lit").TemplateResult<1>;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
'qti-item-session-control': QtiItemSessionControl;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, LitElement } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
// Converter function to interpret "true" and "false" as booleans
|
|
10
|
+
const stringToBooleanConverter = {
|
|
11
|
+
fromAttribute(value) {
|
|
12
|
+
return value === 'true';
|
|
13
|
+
},
|
|
14
|
+
toAttribute(value) {
|
|
15
|
+
return value ? 'true' : 'false';
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @summary The qti-item-session-control element contains configurations relating to flow of test sessions.
|
|
20
|
+
* @documentation https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/imsqti_asi_v3p0p1_infomodel_v1p0.html#Derived_ItemSessionControl
|
|
21
|
+
*/
|
|
22
|
+
export class QtiItemSessionControl extends LitElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.maxAttempts = 1;
|
|
26
|
+
this.showFeedback = false;
|
|
27
|
+
this.allowReview = true;
|
|
28
|
+
this.showSolution = false;
|
|
29
|
+
this.allowComment = false;
|
|
30
|
+
this.allowSkipping = true;
|
|
31
|
+
this.validateResponses = false;
|
|
32
|
+
}
|
|
33
|
+
async connectedCallback() {
|
|
34
|
+
super.connectedCallback();
|
|
35
|
+
await this.updateComplete;
|
|
36
|
+
this.dispatchEvent(new CustomEvent('qti-item-session-control-connected', {
|
|
37
|
+
detail: this,
|
|
38
|
+
bubbles: true,
|
|
39
|
+
composed: true
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
render() {
|
|
43
|
+
return html `<slot></slot>`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
__decorate([
|
|
47
|
+
property({ type: Number, attribute: 'max-attempts' })
|
|
48
|
+
], QtiItemSessionControl.prototype, "maxAttempts", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'show-feedback' })
|
|
51
|
+
], QtiItemSessionControl.prototype, "showFeedback", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'allow-review' })
|
|
54
|
+
], QtiItemSessionControl.prototype, "allowReview", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'show-solution' })
|
|
57
|
+
], QtiItemSessionControl.prototype, "showSolution", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'allow-comment' })
|
|
60
|
+
], QtiItemSessionControl.prototype, "allowComment", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'allow-skipping' })
|
|
63
|
+
], QtiItemSessionControl.prototype, "allowSkipping", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'validate-responses' })
|
|
66
|
+
], QtiItemSessionControl.prototype, "validateResponses", void 0);
|
|
67
|
+
//# sourceMappingURL=qti-item-session-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qti-item-session-control.js","sourceRoot":"","sources":["../../../src/components/qti-item-session-control/qti-item-session-control.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,iEAAiE;AACjE,MAAM,wBAAwB,GAAG;IAC/B,aAAa,CAAC,KAAa;QACzB,OAAO,KAAK,KAAK,MAAM,CAAC;IAC1B,CAAC;IACD,WAAW,CAAC,KAAc;QACxB,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAClC,CAAC;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,UAAU;IAArD;;QAEE,gBAAW,GAAW,CAAC,CAAC;QAGxB,iBAAY,GAAG,KAAK,CAAC;QAGrB,gBAAW,GAAG,IAAI,CAAC;QAGnB,iBAAY,GAAG,KAAK,CAAC;QAGrB,iBAAY,GAAG,KAAK,CAAC;QAGrB,kBAAa,GAAG,IAAI,CAAC;QAGrB,sBAAiB,GAAG,KAAK,CAAC;IAiB5B,CAAC;IAfU,KAAK,CAAC,iBAAiB;QAC9B,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,MAAM,IAAI,CAAC,cAAc,CAAC;QAC1B,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,oCAAoC,EAAE;YACpD,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;SACf,CAAC,CACH,CAAC;IACJ,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;CACF;AAnCC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;0DAC9B;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;2DACxE;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;0DACzE;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;2DACxE;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;2DACxE;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;4DACzE;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;gEACxE","sourcesContent":["import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\n// Converter function to interpret \"true\" and \"false\" as booleans\nconst stringToBooleanConverter = {\n fromAttribute(value: string): boolean {\n return value === 'true';\n },\n toAttribute(value: boolean): string {\n return value ? 'true' : 'false';\n }\n};\n\n/**\n * @summary The qti-item-session-control element contains configurations relating to flow of test sessions.\n * @documentation https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/imsqti_asi_v3p0p1_infomodel_v1p0.html#Derived_ItemSessionControl\n */\nexport class QtiItemSessionControl extends LitElement {\n @property({ type: Number, attribute: 'max-attempts' })\n maxAttempts: number = 1;\n\n @property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'show-feedback' })\n showFeedback = false;\n\n @property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'allow-review' })\n allowReview = true;\n\n @property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'show-solution' })\n showSolution = false;\n\n @property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'allow-comment' })\n allowComment = false;\n\n @property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'allow-skipping' })\n allowSkipping = true;\n\n @property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'validate-responses' })\n validateResponses = false;\n\n override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n await this.updateComplete;\n this.dispatchEvent(\n new CustomEvent('qti-item-session-control-connected', {\n detail: this,\n bubbles: true,\n composed: true\n })\n );\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-item-session-control': QtiItemSessionControl;\n }\n}\n"]}
|
|
@@ -75,21 +75,38 @@ export class TestContainer extends LitElement {
|
|
|
75
75
|
api = await qtiTest.postLoadTestTransformCallback(api, testElement);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
this
|
|
78
|
+
this.#setTestDoc(api.htmlDoc(this.#resolvedCustomElementRegistry ?? undefined));
|
|
79
79
|
}
|
|
80
80
|
catch (error) {
|
|
81
81
|
console.error('Error loading or parsing XML:', error);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Assign a new test document and announce it.
|
|
86
|
+
*
|
|
87
|
+
* The announcement has to happen here rather than on
|
|
88
|
+
* `qti-assessment-test-connected`, because by then the new document's
|
|
89
|
+
* children have already connected and registered themselves — a host that
|
|
90
|
+
* resets its context on that event throws those registrations away. Lit's
|
|
91
|
+
* re-render is async, so a handler running now still gets in before any child
|
|
92
|
+
* of the new `qti-assessment-test` connects.
|
|
93
|
+
*/
|
|
94
|
+
#setTestDoc(testDoc) {
|
|
95
|
+
this.testDoc = testDoc;
|
|
96
|
+
this.dispatchEvent(new CustomEvent('qti-testdoc-loaded', {
|
|
97
|
+
bubbles: true,
|
|
98
|
+
composed: true
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
84
101
|
handleTestXMLChange() {
|
|
85
102
|
if (!this.testXML)
|
|
86
103
|
return;
|
|
87
104
|
try {
|
|
88
105
|
const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;
|
|
89
|
-
this
|
|
106
|
+
this.#setTestDoc(qtiTransformTest()
|
|
90
107
|
.parse(this.testXML)
|
|
91
108
|
.shuffleOrdering(explicitSeed)
|
|
92
|
-
.htmlDoc(this.#resolvedCustomElementRegistry ?? undefined);
|
|
109
|
+
.htmlDoc(this.#resolvedCustomElementRegistry ?? undefined));
|
|
93
110
|
}
|
|
94
111
|
catch (error) {
|
|
95
112
|
console.error('Error parsing XML:', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-container.js","sourceRoot":"","sources":["../../../src/components/test-container/test-container.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,uDAAuD;AACvD,OAAO,OAAO,MAAM,2CAA2C,CAAC;AAIhE;;;;;;;;;;;;GAYG;AAEH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAA7C;;QACE,mFAAmF;QAEnF,0BAAqB,GAAiC,IAAI,CAAC;QAE3D,8BAA8B;QAE9B,YAAO,GAAkB,IAAI,CAAC;QAE9B,6BAA6B;QAE7B,YAAO,GAA4B,IAAI,CAAC;QAExC,yBAAyB;QAEzB,YAAO,GAAkB,IAAI,CAAC;QAIpB,eAAU,GAAe;YACjC,WAAW,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,qBAAqB,EAAE,SAAS,EAAE;SAC/F,CAAC;QAEF,mCAAmC;QACnC,qBAAgB,GAAY,IAAI,CAAC;QACjC,mCAA8B,GAAiC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"test-container.js","sourceRoot":"","sources":["../../../src/components/test-container/test-container.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,uDAAuD;AACvD,OAAO,OAAO,MAAM,2CAA2C,CAAC;AAIhE;;;;;;;;;;;;GAYG;AAEH,MAAM,OAAO,aAAc,SAAQ,UAAU;IAA7C;;QACE,mFAAmF;QAEnF,0BAAqB,GAAiC,IAAI,CAAC;QAE3D,8BAA8B;QAE9B,YAAO,GAAkB,IAAI,CAAC;QAE9B,6BAA6B;QAE7B,YAAO,GAA4B,IAAI,CAAC;QAExC,yBAAyB;QAEzB,YAAO,GAAkB,IAAI,CAAC;QAIpB,eAAU,GAAe;YACjC,WAAW,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,EAAE,qBA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,CAAC;wDAchD","sourcesContent":["import { consume } from '@lit/context';\nimport { LitElement, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { until } from 'lit/directives/until.js';\n\nimport { qtiContext } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\nimport { qtiTransformTest } from '@qti-components/transformers';\n\n// eslint-disable-next-line import/no-relative-packages\nimport itemCss from '../../../../qti-theme/src/item.css?inline';\n\nimport type { QtiContext } from '@qti-components/base';\n\n/**\n * `<test-container>` is a custom element designed for hosting the qti-assessment-item.\n * The `qti-assessment-test` will be placed inside the shadow DOM of this element.\n * The element loads the test from the provided URL and renders it inside the shadow DOM.\n *\n * ```html\n * <qti-test>\n * <test-navigation>\n * <test-container class=\"m-4 bg-white\" test-url=\"./path/to/assessmenttest.xml\"></test-container>\n * </test-navigation>\n * </qti-test>\n * ```\n */\n\nexport class TestContainer extends LitElement {\n /** Scoped registry used by the test shadow root. Must be set before connection. */\n @property({ attribute: false })\n customElementRegistry: CustomElementRegistry | null = null;\n\n /** URL of the item to load */\n @property({ type: String, attribute: 'test-url' })\n testURL: string | null = null;\n\n /** A parsed HTML document */\n @state()\n testDoc: DocumentFragment | null = null;\n\n /** The raw XML string */\n @state()\n testXML: string | null = null;\n\n @state()\n @consume({ context: qtiContext, subscribe: true })\n protected qtiContext: QtiContext = {\n QTI_CONTEXT: { testIdentifier: '', candidateIdentifier: '', environmentIdentifier: 'default' }\n };\n\n /** Template content if provided */\n #templateContent: unknown = null;\n #resolvedCustomElementRegistry: CustomElementRegistry | null = null;\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const registry = this.customElementRegistry;\n\n this.#resolvedCustomElementRegistry = registry;\n\n return (\n this.shadowRoot ??\n this.attachShadow({\n ...(this.constructor as typeof TestContainer).shadowRootOptions,\n ...(registry ? { customElementRegistry: registry } : {})\n })\n );\n }\n\n /** Callback function to transform the test after loading */\n // @property({ type: Function }) postLoadTestTransformCallback: PostLoadTestTransformCallback | null = null;\n\n @watch('testURL', { waitUntilFirstUpdate: true })\n protected async handleTestURLChange() {\n if (!this.testURL) return;\n try {\n const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;\n let api = (await qtiTransformTest().load(this.testURL)).shuffleOrdering(explicitSeed);\n // Apply external transformation if provided\n const qtiTest = this.closest('qti-test') as any; // Type assertion to access mixin properties\n if (qtiTest?.postLoadTestTransformCallback) {\n // Create a temporary document to get the test element reference\n const tempDoc = api.htmlDoc(this.#resolvedCustomElementRegistry ?? undefined);\n const testElement = tempDoc.querySelector('qti-assessment-test') as any;\n\n if (testElement) {\n // Apply the callback with the test element\n api = await qtiTest.postLoadTestTransformCallback(api, testElement);\n }\n }\n\n this.#setTestDoc(api.htmlDoc(this.#resolvedCustomElementRegistry ?? undefined));\n } catch (error) {\n console.error('Error loading or parsing XML:', error);\n }\n }\n\n /**\n * Assign a new test document and announce it.\n *\n * The announcement has to happen here rather than on\n * `qti-assessment-test-connected`, because by then the new document's\n * children have already connected and registered themselves — a host that\n * resets its context on that event throws those registrations away. Lit's\n * re-render is async, so a handler running now still gets in before any child\n * of the new `qti-assessment-test` connects.\n */\n #setTestDoc(testDoc: DocumentFragment): void {\n this.testDoc = testDoc;\n this.dispatchEvent(\n new CustomEvent('qti-testdoc-loaded', {\n bubbles: true,\n composed: true\n })\n );\n }\n\n @watch('testXML', { waitUntilFirstUpdate: true })\n protected handleTestXMLChange() {\n if (!this.testXML) return;\n try {\n const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;\n this.#setTestDoc(\n qtiTransformTest()\n .parse(this.testXML)\n .shuffleOrdering(explicitSeed)\n .htmlDoc(this.#resolvedCustomElementRegistry ?? undefined)\n );\n } catch (error) {\n console.error('Error parsing XML:', error);\n }\n }\n\n override async connectedCallback(): Promise<void> {\n super.connectedCallback();\n this.#initializeTemplateContent();\n this.#applyStyles();\n if (this.testURL) {\n this.handleTestURLChange();\n }\n if (this.testXML) {\n this.handleTestXMLChange();\n }\n }\n\n #initializeTemplateContent() {\n const template = this.querySelector('template') as HTMLTemplateElement;\n this.#templateContent = template ? template.content : html``;\n }\n\n #applyStyles() {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(itemCss);\n this.shadowRoot.adoptedStyleSheets = [sheet];\n }\n\n override render() {\n return html`\n ${this.#templateContent}\n <slot></slot>\n ${until(this.testDoc, html`<span>Loading...</span>`)}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-container': TestContainer;\n }\n}\n"]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
+
import type { ComputedContext } from '@qti-components/base';
|
|
2
3
|
export declare class TestEndAttempt extends LitElement {
|
|
4
|
+
protected computedContext: ComputedContext;
|
|
5
|
+
_internalDisabled: boolean;
|
|
6
|
+
_handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext): void;
|
|
3
7
|
static styles: import("lit").CSSResult;
|
|
4
8
|
constructor();
|
|
9
|
+
willUpdate(_changedProperties: Map<string | number | symbol, unknown>): void;
|
|
10
|
+
checkDisabled(): void;
|
|
5
11
|
render(): import("lit").TemplateResult<1>;
|
|
6
12
|
}
|
|
7
13
|
declare global {
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
1
7
|
import { css, html, LitElement } from 'lit';
|
|
8
|
+
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { consume } from '@lit/context';
|
|
10
|
+
import { computedContext } from '@qti-components/base';
|
|
11
|
+
import { watch } from '@qti-components/utilities';
|
|
2
12
|
import * as styles from '../styles';
|
|
3
13
|
export class TestEndAttempt extends LitElement {
|
|
14
|
+
_handleTestElementChange(_oldValue, newValue) {
|
|
15
|
+
if (newValue) {
|
|
16
|
+
this.requestUpdate();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
4
19
|
static { this.styles = css `
|
|
5
20
|
:host {
|
|
6
21
|
${styles.btn};
|
|
@@ -11,10 +26,61 @@ export class TestEndAttempt extends LitElement {
|
|
|
11
26
|
`; }
|
|
12
27
|
constructor() {
|
|
13
28
|
super();
|
|
14
|
-
this.
|
|
29
|
+
this._internalDisabled = false;
|
|
30
|
+
this.addEventListener('click', e => {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
if (!this._internalDisabled) {
|
|
33
|
+
this.dispatchEvent(new CustomEvent('test-end-attempt', { bubbles: true }));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
willUpdate(_changedProperties) {
|
|
38
|
+
this.checkDisabled();
|
|
39
|
+
}
|
|
40
|
+
checkDisabled() {
|
|
41
|
+
const testPart = this.computedContext?.testParts.find(testPart => testPart.active);
|
|
42
|
+
if (!testPart)
|
|
43
|
+
return;
|
|
44
|
+
const sectionItems = testPart.sections.flatMap(section => section.items);
|
|
45
|
+
const itemIndex = sectionItems.findIndex(item => item.active);
|
|
46
|
+
const activeItem = sectionItems[itemIndex];
|
|
47
|
+
if (!activeItem) {
|
|
48
|
+
this._internalDisabled = false;
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const maxAttempts = activeItem.maxAttempts ?? 1;
|
|
52
|
+
const numAttempts = activeItem.numAttempts || 0;
|
|
53
|
+
// For non-adaptive items, the last ended attempt already reached the optimal
|
|
54
|
+
// outcome — nothing to improve, so disable even when attempts remain. Adaptive
|
|
55
|
+
// items keep iterating, so they're exempt (same as the max-attempts guard).
|
|
56
|
+
if (!activeItem.adaptive && activeItem.optimal) {
|
|
57
|
+
this._internalDisabled = true;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
// For non-adaptive items, disable when max attempts have been reached
|
|
61
|
+
if (!activeItem.adaptive && maxAttempts > 0 && numAttempts >= maxAttempts) {
|
|
62
|
+
this._internalDisabled = true;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (activeItem.allowSkipping === false) {
|
|
66
|
+
this._internalDisabled = activeItem.valid === false || activeItem.isDefaultResponse;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this._internalDisabled = false;
|
|
70
|
+
}
|
|
15
71
|
}
|
|
16
72
|
render() {
|
|
17
73
|
return html ` <slot></slot> `;
|
|
18
74
|
}
|
|
19
75
|
}
|
|
76
|
+
__decorate([
|
|
77
|
+
consume({ context: computedContext, subscribe: true }),
|
|
78
|
+
property({ attribute: false })
|
|
79
|
+
], TestEndAttempt.prototype, "computedContext", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
property({ type: Boolean, reflect: true, attribute: 'disabled' })
|
|
82
|
+
], TestEndAttempt.prototype, "_internalDisabled", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
watch('computedContext')
|
|
85
|
+
], TestEndAttempt.prototype, "_handleTestElementChange", null);
|
|
20
86
|
//# sourceMappingURL=test-end-attempt.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-end-attempt.js","sourceRoot":"","sources":["../../../src/components/test-end-attempt/test-end-attempt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"test-end-attempt.js","sourceRoot":"","sources":["../../../src/components/test-end-attempt/test-end-attempt.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,QAAQ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,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;yDACjC;AAGjC;IADC,KAAK,CAAC,iBAAiB,CAAC;8DAKxB","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '@qti-components/base';\nimport { watch } from '@qti-components/utilities';\n\nimport * as styles from '../styles';\n\nimport type { ComputedContext } from '@qti-components/base';\n\nexport class TestEndAttempt extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n @property({ attribute: false })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, reflect: true, attribute: 'disabled' })\n public _internalDisabled = false;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.requestUpdate();\n }\n }\n\n static override styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n constructor() {\n super();\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this._internalDisabled) {\n this.dispatchEvent(new CustomEvent('test-end-attempt', { bubbles: true }));\n }\n });\n }\n\n override willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n this.checkDisabled();\n }\n\n checkDisabled() {\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n const sectionItems = testPart.sections.flatMap(section => section.items);\n const itemIndex = sectionItems.findIndex(item => item.active);\n const activeItem = sectionItems[itemIndex];\n\n if (!activeItem) {\n this._internalDisabled = false;\n return;\n }\n\n const maxAttempts = activeItem.maxAttempts ?? 1;\n const numAttempts = activeItem.numAttempts || 0;\n\n // For non-adaptive items, the last ended attempt already reached the optimal\n // outcome — nothing to improve, so disable even when attempts remain. Adaptive\n // items keep iterating, so they're exempt (same as the max-attempts guard).\n if (!activeItem.adaptive && activeItem.optimal) {\n this._internalDisabled = true;\n return;\n }\n\n // For non-adaptive items, disable when max attempts have been reached\n if (!activeItem.adaptive && maxAttempts > 0 && numAttempts >= maxAttempts) {\n this._internalDisabled = true;\n return;\n }\n\n if (activeItem.allowSkipping === false) {\n this._internalDisabled = activeItem.valid === false || activeItem.isDefaultResponse;\n } else {\n this._internalDisabled = false;\n }\n }\n\n override render() {\n return html` <slot></slot> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-end-attempt': TestEndAttempt;\n }\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import type { QtiAssessmentItem } from '@qti-components/elements';
|
|
3
3
|
import type { QtiContext } from '@qti-components/base';
|
|
4
|
-
import type { ComputedContext } from '@qti-components/base';
|
|
4
|
+
import type { ComputedContext, ComputedItem } from '@qti-components/base';
|
|
5
5
|
import type { PropertyValues } from 'lit';
|
|
6
6
|
import type { ConfigContext } from '@qti-components/base';
|
|
7
7
|
import type { SessionContext } from '@qti-components/base';
|
|
@@ -27,6 +27,15 @@ export declare class TestNavigation extends LitElement {
|
|
|
27
27
|
protected computedContext: ComputedContext;
|
|
28
28
|
autoScoreItems: boolean;
|
|
29
29
|
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Extension point for presentation packages reacting to an ended attempt.
|
|
32
|
+
* `done` is settled here — from the freshly latched optimality and the
|
|
33
|
+
* session-control cascade — because the computed context only catches up on
|
|
34
|
+
* the next update, after this event has finished bubbling.
|
|
35
|
+
*/
|
|
36
|
+
protected afterAttemptEnded(_assessmentItem: QtiAssessmentItem | undefined, _computedItem: ComputedItem | undefined, _done: boolean): void;
|
|
37
|
+
/** The computed-context entry for an item, from the session-control cascade. */
|
|
38
|
+
protected computedItemFor(identifier: string): ComputedItem | undefined;
|
|
30
39
|
/** The currently active assessment item, exposed for optional presentation extensions. */
|
|
31
40
|
protected get activeAssessmentItem(): QtiAssessmentItem | undefined;
|
|
32
41
|
render(): import("lit").TemplateResult<1>;
|
|
@@ -14,6 +14,14 @@ import { sessionContext } from '@qti-components/base';
|
|
|
14
14
|
import { qtiContext } from '@qti-components/base';
|
|
15
15
|
export class TestNavigation extends LitElement {
|
|
16
16
|
#testElement;
|
|
17
|
+
/**
|
|
18
|
+
* Whether each item's last *ended attempt* reached the optimal outcome, keyed
|
|
19
|
+
* by item-ref id. Written from #handleItemContextUpdated when processResponse
|
|
20
|
+
* ends an attempt — never on a plain selection. Mirrors how inline feedback
|
|
21
|
+
* only re-evaluates when an attempt is processed, so a freshly-picked answer
|
|
22
|
+
* doesn't flip `done` until the candidate ends the attempt.
|
|
23
|
+
*/
|
|
24
|
+
#optimality;
|
|
17
25
|
constructor() {
|
|
18
26
|
super();
|
|
19
27
|
this.identifier = undefined;
|
|
@@ -27,12 +35,61 @@ export class TestNavigation extends LitElement {
|
|
|
27
35
|
};
|
|
28
36
|
this.configContext = {};
|
|
29
37
|
this.autoScoreItems = false;
|
|
38
|
+
/**
|
|
39
|
+
* Whether each item's last *ended attempt* reached the optimal outcome, keyed
|
|
40
|
+
* by item-ref id. Written from #handleItemContextUpdated when processResponse
|
|
41
|
+
* ends an attempt — never on a plain selection. Mirrors how inline feedback
|
|
42
|
+
* only re-evaluates when an attempt is processed, so a freshly-picked answer
|
|
43
|
+
* doesn't flip `done` until the candidate ends the attempt.
|
|
44
|
+
*/
|
|
45
|
+
this.#optimality = new Map();
|
|
30
46
|
this.addEventListener('qti-assessment-test-connected', this.#handleTestConnected.bind(this));
|
|
31
47
|
this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));
|
|
32
48
|
this.addEventListener('qti-interaction-changed', this.#handleInteractionChanged.bind(this));
|
|
49
|
+
this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));
|
|
33
50
|
this.addEventListener('test-end-attempt', this.#handleTestEndAttempt.bind(this));
|
|
34
51
|
this.addEventListener('test-update-outcome-variable', this.#handleTestUpdateOutcomeVariable.bind(this));
|
|
35
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Latch whether an item reached its optimal outcome whenever it has just ended
|
|
55
|
+
* an attempt. processResponse — fired by test-end-attempt, autoscore, or an
|
|
56
|
+
* in-item end-attempt interaction — flags its context update with
|
|
57
|
+
* `responseProcessed`; a plain selection updates the context without it, so
|
|
58
|
+
* `done` can't flip until the candidate actually ends the attempt.
|
|
59
|
+
*/
|
|
60
|
+
#handleItemContextUpdated(event) {
|
|
61
|
+
if (!event.detail?.responseProcessed)
|
|
62
|
+
return;
|
|
63
|
+
const itemContext = event.detail.itemContext;
|
|
64
|
+
if (!itemContext?.identifier)
|
|
65
|
+
return;
|
|
66
|
+
const optimality = this.#assessOptimality(itemContext);
|
|
67
|
+
this.#optimality.set(itemContext.identifier, optimality);
|
|
68
|
+
const computedItem = this.computedItemFor(itemContext.identifier);
|
|
69
|
+
const numAttempts = Number(itemContext.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;
|
|
70
|
+
this.afterAttemptEnded(event.composedPath()[0]?.closest('qti-assessment-item'), computedItem, this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Extension point for presentation packages reacting to an ended attempt.
|
|
74
|
+
* `done` is settled here — from the freshly latched optimality and the
|
|
75
|
+
* session-control cascade — because the computed context only catches up on
|
|
76
|
+
* the next update, after this event has finished bubbling.
|
|
77
|
+
*/
|
|
78
|
+
afterAttemptEnded(_assessmentItem, _computedItem, _done) { }
|
|
79
|
+
/** The computed-context entry for an item, from the session-control cascade. */
|
|
80
|
+
computedItemFor(identifier) {
|
|
81
|
+
return this.computedContext?.testParts
|
|
82
|
+
?.flatMap(part => part.sections)
|
|
83
|
+
.flatMap(section => section.items)
|
|
84
|
+
.find(i => i.identifier === identifier);
|
|
85
|
+
}
|
|
86
|
+
/** The assessment item for an item-ref id, if it has been rendered. */
|
|
87
|
+
#assessmentItemFor(identifier) {
|
|
88
|
+
if (!identifier)
|
|
89
|
+
return undefined;
|
|
90
|
+
const itemRef = this.#testElement?.querySelector(`qti-assessment-item-ref[identifier="${identifier}"]`);
|
|
91
|
+
return itemRef?.assessmentItem ?? undefined;
|
|
92
|
+
}
|
|
36
93
|
/** The currently active assessment item, exposed for optional presentation extensions. */
|
|
37
94
|
get activeAssessmentItem() {
|
|
38
95
|
if (!this.#testElement || !this._sessionContext?.navItemRefId)
|
|
@@ -75,6 +132,8 @@ export class TestNavigation extends LitElement {
|
|
|
75
132
|
/* PK: on test connected we can build the computed context */
|
|
76
133
|
#handleTestConnected(event) {
|
|
77
134
|
this.#testElement = event.detail;
|
|
135
|
+
// A fresh test invalidates the per-test optimality latches.
|
|
136
|
+
this.#optimality.clear();
|
|
78
137
|
// Set the testIdentifier in qtiContext if not already set
|
|
79
138
|
if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {
|
|
80
139
|
const currentContext = this.qtiContext.QTI_CONTEXT || {
|
|
@@ -111,27 +170,52 @@ export class TestNavigation extends LitElement {
|
|
|
111
170
|
view: this._sessionContext?.view,
|
|
112
171
|
testParts: testPartElements.map(testPart => {
|
|
113
172
|
const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
|
|
173
|
+
const testPartSessionControl = testPart.querySelector(':scope > qti-item-session-control');
|
|
174
|
+
const partAllowSkipping = testPartSessionControl ? testPartSessionControl.allowSkipping : true;
|
|
175
|
+
const partMaxAttempts = testPartSessionControl ? testPartSessionControl.maxAttempts : 1;
|
|
176
|
+
const partShowFeedback = testPartSessionControl ? testPartSessionControl.showFeedback : false;
|
|
177
|
+
const partShowSolution = testPartSessionControl ? testPartSessionControl.showSolution : false;
|
|
114
178
|
return {
|
|
115
179
|
active: false,
|
|
116
180
|
identifier: testPart.identifier,
|
|
117
181
|
navigationMode: testPart.navigationMode,
|
|
118
182
|
submissionMode: testPart.submissionMode,
|
|
183
|
+
allowSkipping: partAllowSkipping,
|
|
119
184
|
sections: sectionElements.map(section => {
|
|
120
185
|
const itemElements = [...section.querySelectorAll(`qti-assessment-item-ref`)];
|
|
186
|
+
const sectionSessionControl = section.querySelector(':scope > qti-item-session-control');
|
|
187
|
+
const sectionAllowSkipping = sectionSessionControl
|
|
188
|
+
? sectionSessionControl.allowSkipping
|
|
189
|
+
: partAllowSkipping;
|
|
190
|
+
const sectionMaxAttempts = sectionSessionControl ? sectionSessionControl.maxAttempts : partMaxAttempts;
|
|
191
|
+
const sectionShowFeedback = sectionSessionControl ? sectionSessionControl.showFeedback : partShowFeedback;
|
|
192
|
+
const sectionShowSolution = sectionSessionControl ? sectionSessionControl.showSolution : partShowSolution;
|
|
121
193
|
return {
|
|
122
194
|
active: false,
|
|
123
195
|
identifier: section.identifier,
|
|
124
196
|
title: section.title,
|
|
125
197
|
navigationMode: section.navigationMode,
|
|
126
198
|
submissionMode: section.submissionMode,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
199
|
+
allowSkipping: sectionAllowSkipping,
|
|
200
|
+
items: itemElements.map(item => {
|
|
201
|
+
const itemSessionControl = item.querySelector(':scope > qti-item-session-control');
|
|
202
|
+
const itemAllowSkipping = itemSessionControl ? itemSessionControl.allowSkipping : sectionAllowSkipping;
|
|
203
|
+
const itemMaxAttempts = itemSessionControl ? itemSessionControl.maxAttempts : sectionMaxAttempts;
|
|
204
|
+
const itemShowFeedback = itemSessionControl ? itemSessionControl.showFeedback : sectionShowFeedback;
|
|
205
|
+
const itemShowSolution = itemSessionControl ? itemSessionControl.showSolution : sectionShowSolution;
|
|
206
|
+
return {
|
|
207
|
+
...this.initContext?.find(i => i.identifier === item.identifier),
|
|
208
|
+
active: false,
|
|
209
|
+
identifier: item.identifier,
|
|
210
|
+
categories: item.category ? item.category?.split(' ') : [],
|
|
211
|
+
href: item.href,
|
|
212
|
+
variables: [],
|
|
213
|
+
allowSkipping: itemAllowSkipping,
|
|
214
|
+
maxAttempts: itemMaxAttempts,
|
|
215
|
+
showFeedback: itemShowFeedback,
|
|
216
|
+
showSolution: itemShowSolution
|
|
217
|
+
};
|
|
218
|
+
})
|
|
135
219
|
};
|
|
136
220
|
})
|
|
137
221
|
};
|
|
@@ -254,8 +338,40 @@ export class TestNavigation extends LitElement {
|
|
|
254
338
|
const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')
|
|
255
339
|
?.value;
|
|
256
340
|
const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';
|
|
257
|
-
const numAttempts = computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value || 0;
|
|
341
|
+
const numAttempts = Number(computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;
|
|
258
342
|
const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;
|
|
343
|
+
const valid = this.#assessmentItemFor(computedItem.identifier)?.validate(false) ?? true;
|
|
344
|
+
const responseVars = itemContext?.variables?.filter(v => v.type === 'response') || [];
|
|
345
|
+
const isDefaultResponse = responseVars.every(v => {
|
|
346
|
+
if (v.value === undefined || v.value === null) {
|
|
347
|
+
return true;
|
|
348
|
+
}
|
|
349
|
+
let fallbackValue;
|
|
350
|
+
switch (v.baseType) {
|
|
351
|
+
case 'integer':
|
|
352
|
+
case 'float':
|
|
353
|
+
case 'duration':
|
|
354
|
+
fallbackValue = '0';
|
|
355
|
+
break;
|
|
356
|
+
case 'boolean':
|
|
357
|
+
fallbackValue = 'false';
|
|
358
|
+
break;
|
|
359
|
+
case 'string':
|
|
360
|
+
case 'directedPair':
|
|
361
|
+
case 'identifier':
|
|
362
|
+
case 'pair':
|
|
363
|
+
case 'record':
|
|
364
|
+
default:
|
|
365
|
+
fallbackValue = '';
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
const defaultValue = v.defaultValue ?? fallbackValue;
|
|
369
|
+
if (Array.isArray(v.value)) {
|
|
370
|
+
const dv = Array.isArray(defaultValue) ? defaultValue : [defaultValue];
|
|
371
|
+
return v.value.length === dv.length && v.value.every((val, i) => val === dv[i]);
|
|
372
|
+
}
|
|
373
|
+
return v.value === defaultValue;
|
|
374
|
+
});
|
|
259
375
|
// Computed and opiniated
|
|
260
376
|
// const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';
|
|
261
377
|
// const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;
|
|
@@ -264,6 +380,18 @@ export class TestNavigation extends LitElement {
|
|
|
264
380
|
const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;
|
|
265
381
|
const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;
|
|
266
382
|
const maxScore = rawMaxScore === undefined || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());
|
|
383
|
+
// Optimality comes from the last *ended attempt* (#optimality),
|
|
384
|
+
// latched in #handleItemContextUpdated — never from a live
|
|
385
|
+
// mid-attempt selection. On a restored session no attempt is ended
|
|
386
|
+
// this run, so seed it once from the persisted context, which still
|
|
387
|
+
// holds the submitted response.
|
|
388
|
+
let optimality = this.#optimality.get(computedItem.identifier);
|
|
389
|
+
if (optimality === undefined) {
|
|
390
|
+
optimality = itemContext ? this.#assessOptimality(itemContext) : 'unscored';
|
|
391
|
+
if (numAttempts > 0)
|
|
392
|
+
this.#optimality.set(computedItem.identifier, optimality);
|
|
393
|
+
}
|
|
394
|
+
const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts);
|
|
267
395
|
return {
|
|
268
396
|
...computedItem,
|
|
269
397
|
completionStatus,
|
|
@@ -272,7 +400,16 @@ export class TestNavigation extends LitElement {
|
|
|
272
400
|
response,
|
|
273
401
|
index,
|
|
274
402
|
active,
|
|
275
|
-
|
|
403
|
+
valid,
|
|
404
|
+
isDefaultResponse,
|
|
405
|
+
maxScore,
|
|
406
|
+
done,
|
|
407
|
+
// Reflects the last *ended* attempt only. Read the latch directly
|
|
408
|
+
// (not the `optimality` local) — the latch is written solely on
|
|
409
|
+
// responseProcessed / restore-seed (line above, guarded by
|
|
410
|
+
// numAttempts > 0), so a freshly-picked mid-attempt selection
|
|
411
|
+
// computed live is never stored and never counts as optimal.
|
|
412
|
+
optimal: this.#optimality.get(computedItem.identifier) === 'optimal'
|
|
276
413
|
// type,
|
|
277
414
|
// correct,
|
|
278
415
|
// incorrect,
|
|
@@ -289,6 +426,83 @@ export class TestNavigation extends LitElement {
|
|
|
289
426
|
bubbles: true
|
|
290
427
|
}));
|
|
291
428
|
}
|
|
429
|
+
/**
|
|
430
|
+
* Decide whether an item should be treated as "the candidate is done with it"
|
|
431
|
+
* for the purpose of gating forward navigation and further attempts.
|
|
432
|
+
*
|
|
433
|
+
* - The candidate must have actually ended an attempt (numAttempts > 0).
|
|
434
|
+
* - Once attempted, the item is done if they reached the optimal outcome
|
|
435
|
+
* ('optimal'), or there's nothing to improve on ('unscored'). It is only *not*
|
|
436
|
+
* done while a better attempt is still possible ('suboptimal') and attempts
|
|
437
|
+
* remain — see #assessOptimality for how "optimal" is determined.
|
|
438
|
+
*
|
|
439
|
+
* `optimality` reflects the last *ended attempt* (see #optimality), not the
|
|
440
|
+
* live selection — so a freshly-picked optimal answer doesn't count as done
|
|
441
|
+
* until test-end-attempt evaluates it.
|
|
442
|
+
*/
|
|
443
|
+
#isItemDone(numAttempts, optimality, maxAttempts) {
|
|
444
|
+
if (numAttempts === 0)
|
|
445
|
+
return false;
|
|
446
|
+
if (optimality !== 'suboptimal')
|
|
447
|
+
return true;
|
|
448
|
+
const max = maxAttempts ?? 1;
|
|
449
|
+
return max > 0 && numAttempts >= max;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Decide whether an item's submission is as good as it can get — i.e. the
|
|
453
|
+
* candidate reached the *optimal* outcome, so there's no reason to make them
|
|
454
|
+
* try again. 'optimal' means best achievable, 'suboptimal' means a better
|
|
455
|
+
* attempt is still possible, 'unscored' means there's nothing to judge against.
|
|
456
|
+
* ("optimal" is the spec's own word — a qti-correct-response is defined as
|
|
457
|
+
* "the (or an) optimal value".)
|
|
458
|
+
*
|
|
459
|
+
* Two signals, in order of authority:
|
|
460
|
+
* 1. The scored outcome: optimal ⟺ SCORE has reached its maximum (MAXSCORE).
|
|
461
|
+
* This correctly handles partial-credit / qti-mapping items, where an exact
|
|
462
|
+
* response match would under- or over-judge.
|
|
463
|
+
* 2. The declared qti-correct-response, for items that aren't scored (no
|
|
464
|
+
* SCORE/MAXSCORE) — an exact match is the best available proxy. Bookkeeping
|
|
465
|
+
* variables like numAttempts can be typed 'response' but never declare a
|
|
466
|
+
* correctResponse, so we filter on a declared correctResponse.
|
|
467
|
+
*
|
|
468
|
+
* Items with neither a comparable score nor a correctResponse (essays, info
|
|
469
|
+
* items, etc.) are 'unscored' — there's no optimal value to require, so one
|
|
470
|
+
* attempt is enough.
|
|
471
|
+
*/
|
|
472
|
+
#assessOptimality(item) {
|
|
473
|
+
const variables = item.variables ?? [];
|
|
474
|
+
const score = this.#numericVariable(variables, 'SCORE');
|
|
475
|
+
const maxScore = this.#numericVariable(variables, 'MAXSCORE');
|
|
476
|
+
if (score !== null && maxScore !== null) {
|
|
477
|
+
return score >= maxScore ? 'optimal' : 'suboptimal';
|
|
478
|
+
}
|
|
479
|
+
const responseVars = variables.filter((v) => v.type === 'response' &&
|
|
480
|
+
v.correctResponse !== undefined &&
|
|
481
|
+
v.correctResponse !== null);
|
|
482
|
+
if (responseVars.length === 0)
|
|
483
|
+
return 'unscored';
|
|
484
|
+
const allMatch = responseVars.every(v => {
|
|
485
|
+
const expected = v.correctResponse;
|
|
486
|
+
const actual = v.value;
|
|
487
|
+
if (actual === undefined || actual === null)
|
|
488
|
+
return false;
|
|
489
|
+
if (Array.isArray(expected) && Array.isArray(actual)) {
|
|
490
|
+
return expected.length === actual.length && expected.every(e => actual.includes(e));
|
|
491
|
+
}
|
|
492
|
+
if (Array.isArray(expected) || Array.isArray(actual))
|
|
493
|
+
return false;
|
|
494
|
+
return expected === actual;
|
|
495
|
+
});
|
|
496
|
+
return allMatch ? 'optimal' : 'suboptimal';
|
|
497
|
+
}
|
|
498
|
+
/** Read a single numeric outcome value, or null when absent / non-numeric. */
|
|
499
|
+
#numericVariable(variables, identifier) {
|
|
500
|
+
const raw = variables?.find(v => v.identifier === identifier)?.value;
|
|
501
|
+
if (raw === undefined || raw === null || Array.isArray(raw))
|
|
502
|
+
return null;
|
|
503
|
+
const parsed = parseFloat(raw.toString());
|
|
504
|
+
return Number.isNaN(parsed) ? null : parsed;
|
|
505
|
+
}
|
|
292
506
|
}
|
|
293
507
|
__decorate([
|
|
294
508
|
property({ type: String })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-navigation.js","sourceRoot":"","sources":["../../../src/components/test-navigation/test-navigation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAuBlD,MAAM,OAAO,cAAe,SAAQ,UAAU;IAkC5C,YAAY,CAAoB;IAEhC;QACE,KAAK,EAAE,CAAC;QApCkB,eAAU,GAAuB,SAAS,CAAC;QAGhE,gBAAW,GAAiD,EAAE,CAAC;QAI/D,eAAU,GAAe;YAC9B,WAAW,EAAE;gBACX,cAAc,EAAE,EAAE;gBAClB,mBAAmB,EAAE,EAAE;gBACvB,qBAAqB,EAAE,SAAS;aACjC;SACF,CAAC;QAIK,kBAAa,GAAkB,EAAE,CAAC;QAcmB,mBAAc,GAAG,KAAK,CAAC;Q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,CAAC;oBACJ,CAAC,CAAC;iBACH,CAAC;YACJ,CAAC,CAAC;SACH,CAAC;QAEF,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,8BAA8B,EAAE;YAC9C,MAAM,EAAE,IAAI,CAAC,eAAe;YAC5B,OAAO,EAAE,IAAI;SACd,CAAC,CACH,CAAC;IACJ,CAAC;CACF;AAjW6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA4C;AAGhE;IADN,KAAK,EAAE;mDAC8D;AAI/D;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;kDAO/B;AAIK;IAFN,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;qDACZ;AAI/B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oDACd;AAI3B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uDACX;AAIjC;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;uDACK;AAEiB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;sDAAwB","sourcesContent":["import { consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\nimport { configContext } from '@qti-components/base';\nimport { testContext } from '@qti-components/base';\nimport { sessionContext } from '@qti-components/base';\nimport { qtiContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiContext } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ComputedContext } from '@qti-components/base';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef } from '../qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentSection } from '../qti-assessment-section/qti-assessment-section';\nimport type { QtiAssessmentTest } from '../qti-assessment-test/qti-assessment-test';\nimport type { QtiTestPart } from '../qti-test-part/qti-test-part';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { SessionContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier: string | undefined = undefined;\n\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n @state()\n @provide({ context: qtiContext })\n public qtiContext: QtiContext = {\n QTI_CONTEXT: {\n testIdentifier: '',\n candidateIdentifier: '',\n environmentIdentifier: 'default'\n }\n };\n\n @state()\n @consume({ context: configContext, subscribe: true })\n public configContext: ConfigContext = {};\n\n @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n @state()\n @provide({ context: computedContext })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\n\n #testElement: QtiAssessmentTest;\n\n constructor() {\n super();\n this.addEventListener('qti-assessment-test-connected', this.#handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));\n\n this.addEventListener('qti-interaction-changed', this.#handleInteractionChanged.bind(this));\n\n this.addEventListener('test-end-attempt', this.#handleTestEndAttempt.bind(this));\n this.addEventListener('test-update-outcome-variable', this.#handleTestUpdateOutcomeVariable.bind(this));\n }\n\n /** The currently active assessment item, exposed for optional presentation extensions. */\n protected get activeAssessmentItem(): QtiAssessmentItem | undefined {\n if (!this.#testElement || !this._sessionContext?.navItemRefId) return undefined;\n return this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n )?.assessmentItem;\n }\n\n /**\n * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-end-attempt\n * @param {CustomEvent} event - The custom event object.\n */\n #handleTestEndAttempt(_event: CustomEvent) {\n const qtiItemEl = this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n #handleTestUpdateOutcomeVariable(event: CustomEvent) {\n const qtiItemEl = this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${event.detail.assessmentItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);\n }\n\n #handleInteractionChanged(_event: CustomEvent) {\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest<QtiAssessmentItem>(\n 'qti-assessment-item'\n );\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (\n scoreOutcomeIdentifier &&\n scoreOutcomeIdentifier.externalScored === null &&\n assessmentItem.adaptive === 'false'\n ) {\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n assessmentItem.processResponse(true, reportValidityAfterScoring);\n }\n }\n }\n\n override render() {\n // return this.myTemplate ? this.myTemplate(this.stampContext) : nothing;\n return html`<slot></slot>`;\n }\n\n /* PK: on test connected we can build the computed context */\n #handleTestConnected(event: CustomEvent) {\n this.#testElement = event.detail as QtiAssessmentTest;\n // Set the testIdentifier in qtiContext if not already set\n if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {\n const currentContext = this.qtiContext.QTI_CONTEXT || {\n testIdentifier: '',\n candidateIdentifier: 'not set',\n environmentIdentifier: 'default'\n };\n this.qtiContext = {\n QTI_CONTEXT: {\n ...currentContext,\n testIdentifier: this.#testElement.identifier,\n environmentIdentifier: currentContext.environmentIdentifier || 'default'\n }\n };\n }\n\n // Process qti-context-declaration elements to get default values\n const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier=\"QTI_CONTEXT\"]');\n\n contextDeclarations.forEach(declaration => {\n const defaultValues = this.#extractDefaultValues(declaration);\n if (Object.keys(defaultValues).length > 0) {\n // Merge default values with current context, but don't override existing runtime values\n this.qtiContext = {\n QTI_CONTEXT: {\n ...defaultValues, // Default values first\n ...this.qtiContext.QTI_CONTEXT // Runtime values override defaults\n }\n };\n }\n });\n\n const testPartElements = Array.from(this.#testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n identifier: this.#testElement.identifier,\n title: this.#testElement.title,\n view: this._sessionContext?.view,\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n return {\n active: false,\n identifier: testPart.identifier,\n navigationMode: testPart.navigationMode,\n submissionMode: testPart.submissionMode,\n sections: sectionElements.map(section => {\n const itemElements = [...section.querySelectorAll<QtiAssessmentItemRef>(`qti-assessment-item-ref`)];\n return {\n active: false,\n identifier: section.identifier,\n title: section.title,\n navigationMode: section.navigationMode,\n submissionMode: section.submissionMode,\n items: itemElements.map(item => ({\n ...this.initContext?.find(i => i.identifier === item.identifier),\n active: false,\n identifier: item.identifier,\n categories: item.category ? item.category?.split(' ') : [],\n href: item.href,\n variables: [] as OutcomeVariable[]\n }))\n };\n })\n };\n })\n };\n }\n\n /**\n * Extract default values from a qti-context-declaration element\n */\n #extractDefaultValues(declaration: Element): Record<string, any> {\n const defaultValues: Record<string, any> = {};\n\n const defaultValueElement = declaration.querySelector('qti-default-value');\n if (!defaultValueElement) {\n return defaultValues;\n }\n\n const valueElements = defaultValueElement.querySelectorAll('qti-value[field-identifier]');\n valueElements.forEach(valueElement => {\n const fieldIdentifier = valueElement.getAttribute('field-identifier');\n const baseType = valueElement.getAttribute('base-type') || 'string';\n const textContent = valueElement.textContent?.trim() || '';\n\n if (fieldIdentifier) {\n // Convert value based on base-type\n let value: any = textContent;\n switch (baseType) {\n case 'integer':\n value = parseInt(textContent, 10);\n break;\n case 'float':\n case 'duration':\n value = parseFloat(textContent);\n break;\n case 'boolean':\n value = textContent.toLowerCase() === 'true';\n break;\n case 'string':\n default:\n value = textContent;\n break;\n }\n\n defaultValues[fieldIdentifier] = value;\n }\n });\n\n return defaultValues;\n }\n\n /* PK: on item connected we can add item only properties in the xml */\n #handleItemConnected(event: CustomEvent) {\n const itemElement = event.detail as QtiAssessmentItem;\n\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n items: section.items.map(item => {\n if (item.identifier !== itemElement.parentElement.getAttribute('identifier')) {\n return item;\n }\n\n const scoreOutcome = itemElement.querySelector<HTMLElement>(\n \"qti-outcome-declaration[identifier='SCORE']\"\n );\n // const scoreOutcome = item.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n const externalScored = scoreOutcome?.getAttribute('externalScored');\n\n const responseDeclarations = itemElement.querySelectorAll<HTMLElement>('qti-response-declaration');\n const containsCorrectResponse = Array.from(responseDeclarations).some((r: HTMLElement) =>\n r.querySelector('qti-correct-response')\n );\n // check if every responseDeclaration has a correctResponse\n const containsMapping = Array.from(responseDeclarations).some((r: HTMLElement) => {\n const mapping = r.querySelector('qti-mapping');\n const areaMapping = r.querySelector('qti-area-mapping');\n return mapping?.querySelector('qti-map-entry') || areaMapping?.querySelector('qti-area-map-entry');\n });\n\n const hasCorrectResponse = containsCorrectResponse || containsMapping;\n\n const hasResponseProcessing = itemElement.querySelector('qti-response-processing') ? true : false;\n\n return {\n ...item,\n assessmentItemIdentifier: itemElement.getAttribute('identifier'),\n label: itemElement.getAttribute('label'),\n title: itemElement.title,\n externalScored,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false,\n variables: itemElement.variables,\n hasCorrectResponse,\n hasResponseProcessing\n };\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n view: this._sessionContext?.view,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n active: this._sessionContext?.navPartId === testPart.identifier || false,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n active: this._sessionContext?.navSectionId === section.identifier || false,\n completed: section.items.every(\n item =>\n this._testContext.items\n .find(i => i.identifier === item.identifier)\n ?.variables.find(v => v.identifier === 'completionStatus').value === 'completed'\n ),\n\n items: section.items.map(item => {\n const itemContext = this._testContext?.items.find(i => i.identifier === item.identifier);\n const computedItem = {\n ...item,\n ...itemContext,\n ...this.initContext?.find(i => i.identifier === item.identifier)\n };\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n\n const score = rawscore === undefined || rawscore === null ? null : parseFloat(rawscore?.toString());\n\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')\n ?.value as string;\n\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n const numAttempts = computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value || 0;\n\n const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;\n\n // Computed and opiniated\n // const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';\n // const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;\n // const incorrect = (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false;\n // const completed = completionStatus === 'completed';\n\n const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;\n const maxScore =\n rawMaxScore === undefined || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());\n\n return {\n ...computedItem,\n completionStatus,\n numAttempts,\n score,\n response,\n index,\n active,\n maxScore\n // type,\n // correct,\n // incorrect,\n // completed\n };\n })\n };\n })\n };\n })\n };\n\n this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-navigation': TestNavigation;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"test-navigation.js","sourceRoot":"","sources":["../../../src/components/test-navigation/test-navigation.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAiClD,MAAM,OAAO,cAAe,SAAQ,UAAU;IAkC5C,YAAY,CAAoB;IAEhC;;;;;;OAMG;IACH,WAAW,CAAqC;IAEhD;QACE,KAAK,EAAE,CAAC;QA7CkB,eAAU,GAAuB,SAAS,CAAC;QAGhE,gBAAW,GAAiD,EAAE,CAAC;QAI/D,eAAU,GAAe;YAC9B,WAA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,CAAC;qDACZ;AAI/B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;oDACd;AAI3B;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uDACX;AAIjC;IAFT,KAAK,EAAE;IACP,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;uDACK;AAEiB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;sDAAwB","sourcesContent":["import { consume, provide } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport { computedContext } from '@qti-components/base';\nimport { configContext } from '@qti-components/base';\nimport { testContext } from '@qti-components/base';\nimport { sessionContext } from '@qti-components/base';\nimport { qtiContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiContext } from '@qti-components/base';\nimport type { OutcomeVariable } from '@qti-components/base';\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\nimport type { PropertyValues } from 'lit';\nimport type { QtiAssessmentItemRef } from '../qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentSection } from '../qti-assessment-section/qti-assessment-section';\nimport type { QtiAssessmentTest } from '../qti-assessment-test/qti-assessment-test';\nimport type { QtiTestPart } from '../qti-test-part/qti-test-part';\nimport type { QtiItemSessionControl } from '../qti-item-session-control/qti-item-session-control';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { SessionContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\nimport type { ResponseVariable } from '@qti-components/base';\n\ntype CustomEventMap = {\n 'test-end-attempt': CustomEvent;\n};\n\ndeclare global {\n interface GlobalEventHandlersEventMap extends CustomEventMap {}\n}\n\n/**\n * Whether an item's ended attempt reached the best achievable outcome:\n * 'optimal' (nothing to improve), 'suboptimal' (a better attempt is possible),\n * or 'unscored' (no machine-judgeable optimal value — see #assessOptimality).\n */\ntype ItemOptimality = 'optimal' | 'suboptimal' | 'unscored';\n\nexport class TestNavigation extends LitElement {\n @property({ type: String }) identifier: string | undefined = undefined;\n\n @state()\n public initContext: { identifier: string; [key: string]: any }[] = [];\n\n @state()\n @provide({ context: qtiContext })\n public qtiContext: QtiContext = {\n QTI_CONTEXT: {\n testIdentifier: '',\n candidateIdentifier: '',\n environmentIdentifier: 'default'\n }\n };\n\n @state()\n @consume({ context: configContext, subscribe: true })\n public configContext: ConfigContext = {};\n\n @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: sessionContext, subscribe: true })\n protected _sessionContext?: SessionContext;\n\n @state()\n @provide({ context: computedContext })\n protected computedContext: ComputedContext;\n\n @property({ type: Boolean, attribute: 'auto-score-items' }) autoScoreItems = false;\n\n #testElement: QtiAssessmentTest;\n\n /**\n * Whether each item's last *ended attempt* reached the optimal outcome, keyed\n * by item-ref id. Written from #handleItemContextUpdated when processResponse\n * ends an attempt — never on a plain selection. Mirrors how inline feedback\n * only re-evaluates when an attempt is processed, so a freshly-picked answer\n * doesn't flip `done` until the candidate ends the attempt.\n */\n #optimality = new Map<string, ItemOptimality>();\n\n constructor() {\n super();\n this.addEventListener('qti-assessment-test-connected', this.#handleTestConnected.bind(this));\n this.addEventListener('qti-assessment-item-connected', this.#handleItemConnected.bind(this));\n\n this.addEventListener('qti-interaction-changed', this.#handleInteractionChanged.bind(this));\n this.addEventListener('qti-item-context-updated', this.#handleItemContextUpdated.bind(this));\n\n this.addEventListener('test-end-attempt', this.#handleTestEndAttempt.bind(this));\n this.addEventListener('test-update-outcome-variable', this.#handleTestUpdateOutcomeVariable.bind(this));\n }\n\n /**\n * Latch whether an item reached its optimal outcome whenever it has just ended\n * an attempt. processResponse — fired by test-end-attempt, autoscore, or an\n * in-item end-attempt interaction — flags its context update with\n * `responseProcessed`; a plain selection updates the context without it, so\n * `done` can't flip until the candidate actually ends the attempt.\n */\n #handleItemContextUpdated(event: CustomEvent<{ itemContext: ItemContext; responseProcessed?: boolean }>) {\n if (!event.detail?.responseProcessed) return;\n const itemContext = event.detail.itemContext;\n if (!itemContext?.identifier) return;\n const optimality = this.#assessOptimality(itemContext);\n this.#optimality.set(itemContext.identifier, optimality);\n\n const computedItem = this.computedItemFor(itemContext.identifier);\n const numAttempts = Number(itemContext.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n this.afterAttemptEnded(\n (event.composedPath()[0] as HTMLElement)?.closest<QtiAssessmentItem>('qti-assessment-item'),\n computedItem,\n this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts)\n );\n }\n\n /**\n * Extension point for presentation packages reacting to an ended attempt.\n * `done` is settled here — from the freshly latched optimality and the\n * session-control cascade — because the computed context only catches up on\n * the next update, after this event has finished bubbling.\n */\n protected afterAttemptEnded(\n _assessmentItem: QtiAssessmentItem | undefined,\n _computedItem: ComputedItem | undefined,\n _done: boolean\n ): void {}\n\n /** The computed-context entry for an item, from the session-control cascade. */\n protected computedItemFor(identifier: string): ComputedItem | undefined {\n return this.computedContext?.testParts\n ?.flatMap(part => part.sections)\n .flatMap(section => section.items)\n .find(i => i.identifier === identifier);\n }\n\n /** The assessment item for an item-ref id, if it has been rendered. */\n #assessmentItemFor(identifier: string | undefined): QtiAssessmentItem | undefined {\n if (!identifier) return undefined;\n const itemRef = this.#testElement?.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${identifier}\"]`\n );\n return itemRef?.assessmentItem ?? undefined;\n }\n\n /** The currently active assessment item, exposed for optional presentation extensions. */\n protected get activeAssessmentItem(): QtiAssessmentItem | undefined {\n if (!this.#testElement || !this._sessionContext?.navItemRefId) return undefined;\n return this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n )?.assessmentItem;\n }\n\n /**\n * Handles the 'test-end-attempt' event.\n * @private\n * @listens TestNavigation#test-end-attempt\n * @param {CustomEvent} event - The custom event object.\n */\n #handleTestEndAttempt(_event: CustomEvent) {\n const qtiItemEl = this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${this._sessionContext.navItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);\n }\n\n #handleTestUpdateOutcomeVariable(event: CustomEvent) {\n const qtiItemEl = this.#testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${event.detail.assessmentItemRefId}\"]`\n );\n const qtiAssessmentItemEl = qtiItemEl.assessmentItem;\n qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);\n }\n\n #handleInteractionChanged(_event: CustomEvent) {\n if (this.autoScoreItems) {\n const assessmentItem = (_event.composedPath()[0] as HTMLElement).closest<QtiAssessmentItem>(\n 'qti-assessment-item'\n );\n const scoreOutcomeIdentifier = assessmentItem.variables.find(v => v.identifier === 'SCORE') as OutcomeVariable;\n if (\n scoreOutcomeIdentifier &&\n scoreOutcomeIdentifier.externalScored === null &&\n assessmentItem.adaptive === 'false'\n ) {\n const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;\n assessmentItem.processResponse(true, reportValidityAfterScoring);\n }\n }\n }\n\n override render() {\n // return this.myTemplate ? this.myTemplate(this.stampContext) : nothing;\n return html`<slot></slot>`;\n }\n\n /* PK: on test connected we can build the computed context */\n #handleTestConnected(event: CustomEvent) {\n this.#testElement = event.detail as QtiAssessmentTest;\n // A fresh test invalidates the per-test optimality latches.\n this.#optimality.clear();\n // Set the testIdentifier in qtiContext if not already set\n if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {\n const currentContext = this.qtiContext.QTI_CONTEXT || {\n testIdentifier: '',\n candidateIdentifier: 'not set',\n environmentIdentifier: 'default'\n };\n this.qtiContext = {\n QTI_CONTEXT: {\n ...currentContext,\n testIdentifier: this.#testElement.identifier,\n environmentIdentifier: currentContext.environmentIdentifier || 'default'\n }\n };\n }\n\n // Process qti-context-declaration elements to get default values\n const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier=\"QTI_CONTEXT\"]');\n\n contextDeclarations.forEach(declaration => {\n const defaultValues = this.#extractDefaultValues(declaration);\n if (Object.keys(defaultValues).length > 0) {\n // Merge default values with current context, but don't override existing runtime values\n this.qtiContext = {\n QTI_CONTEXT: {\n ...defaultValues, // Default values first\n ...this.qtiContext.QTI_CONTEXT // Runtime values override defaults\n }\n };\n }\n });\n\n const testPartElements = Array.from(this.#testElement?.querySelectorAll<QtiTestPart>(`qti-test-part`) || []);\n this.computedContext = {\n identifier: this.#testElement.identifier,\n title: this.#testElement.title,\n view: this._sessionContext?.view,\n testParts: testPartElements.map(testPart => {\n const sectionElements = [...testPart.querySelectorAll<QtiAssessmentSection>(`qti-assessment-section`)];\n const testPartSessionControl = testPart.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const partAllowSkipping = testPartSessionControl ? testPartSessionControl.allowSkipping : true;\n const partMaxAttempts = testPartSessionControl ? testPartSessionControl.maxAttempts : 1;\n const partShowFeedback = testPartSessionControl ? testPartSessionControl.showFeedback : false;\n const partShowSolution = testPartSessionControl ? testPartSessionControl.showSolution : false;\n return {\n active: false,\n identifier: testPart.identifier,\n navigationMode: testPart.navigationMode,\n submissionMode: testPart.submissionMode,\n allowSkipping: partAllowSkipping,\n sections: sectionElements.map(section => {\n const itemElements = [...section.querySelectorAll<QtiAssessmentItemRef>(`qti-assessment-item-ref`)];\n const sectionSessionControl = section.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const sectionAllowSkipping = sectionSessionControl\n ? sectionSessionControl.allowSkipping\n : partAllowSkipping;\n const sectionMaxAttempts = sectionSessionControl ? sectionSessionControl.maxAttempts : partMaxAttempts;\n const sectionShowFeedback = sectionSessionControl ? sectionSessionControl.showFeedback : partShowFeedback;\n const sectionShowSolution = sectionSessionControl ? sectionSessionControl.showSolution : partShowSolution;\n return {\n active: false,\n identifier: section.identifier,\n title: section.title,\n navigationMode: section.navigationMode,\n submissionMode: section.submissionMode,\n allowSkipping: sectionAllowSkipping,\n items: itemElements.map(item => {\n const itemSessionControl = item.querySelector<QtiItemSessionControl>(\n ':scope > qti-item-session-control'\n );\n const itemAllowSkipping = itemSessionControl ? itemSessionControl.allowSkipping : sectionAllowSkipping;\n const itemMaxAttempts = itemSessionControl ? itemSessionControl.maxAttempts : sectionMaxAttempts;\n const itemShowFeedback = itemSessionControl ? itemSessionControl.showFeedback : sectionShowFeedback;\n const itemShowSolution = itemSessionControl ? itemSessionControl.showSolution : sectionShowSolution;\n return {\n ...this.initContext?.find(i => i.identifier === item.identifier),\n active: false,\n identifier: item.identifier,\n categories: item.category ? item.category?.split(' ') : [],\n href: item.href,\n variables: [] as OutcomeVariable[],\n allowSkipping: itemAllowSkipping,\n maxAttempts: itemMaxAttempts,\n showFeedback: itemShowFeedback,\n showSolution: itemShowSolution\n };\n })\n };\n })\n };\n })\n };\n }\n\n /**\n * Extract default values from a qti-context-declaration element\n */\n #extractDefaultValues(declaration: Element): Record<string, any> {\n const defaultValues: Record<string, any> = {};\n\n const defaultValueElement = declaration.querySelector('qti-default-value');\n if (!defaultValueElement) {\n return defaultValues;\n }\n\n const valueElements = defaultValueElement.querySelectorAll('qti-value[field-identifier]');\n valueElements.forEach(valueElement => {\n const fieldIdentifier = valueElement.getAttribute('field-identifier');\n const baseType = valueElement.getAttribute('base-type') || 'string';\n const textContent = valueElement.textContent?.trim() || '';\n\n if (fieldIdentifier) {\n // Convert value based on base-type\n let value: any = textContent;\n switch (baseType) {\n case 'integer':\n value = parseInt(textContent, 10);\n break;\n case 'float':\n case 'duration':\n value = parseFloat(textContent);\n break;\n case 'boolean':\n value = textContent.toLowerCase() === 'true';\n break;\n case 'string':\n default:\n value = textContent;\n break;\n }\n\n defaultValues[fieldIdentifier] = value;\n }\n });\n\n return defaultValues;\n }\n\n /* PK: on item connected we can add item only properties in the xml */\n #handleItemConnected(event: CustomEvent) {\n const itemElement = event.detail as QtiAssessmentItem;\n\n this.computedContext = {\n ...this.computedContext,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n items: section.items.map(item => {\n if (item.identifier !== itemElement.parentElement.getAttribute('identifier')) {\n return item;\n }\n\n const scoreOutcome = itemElement.querySelector<HTMLElement>(\n \"qti-outcome-declaration[identifier='SCORE']\"\n );\n // const scoreOutcome = item.variables.find(vr => vr.identifier == 'SCORE') as OutcomeVariable;\n const externalScored = scoreOutcome?.getAttribute('externalScored');\n\n const responseDeclarations = itemElement.querySelectorAll<HTMLElement>('qti-response-declaration');\n const containsCorrectResponse = Array.from(responseDeclarations).some((r: HTMLElement) =>\n r.querySelector('qti-correct-response')\n );\n // check if every responseDeclaration has a correctResponse\n const containsMapping = Array.from(responseDeclarations).some((r: HTMLElement) => {\n const mapping = r.querySelector('qti-mapping');\n const areaMapping = r.querySelector('qti-area-mapping');\n return mapping?.querySelector('qti-map-entry') || areaMapping?.querySelector('qti-area-map-entry');\n });\n\n const hasCorrectResponse = containsCorrectResponse || containsMapping;\n\n const hasResponseProcessing = itemElement.querySelector('qti-response-processing') ? true : false;\n\n return {\n ...item,\n assessmentItemIdentifier: itemElement.getAttribute('identifier'),\n label: itemElement.getAttribute('label'),\n title: itemElement.title,\n externalScored,\n adaptive: itemElement.adaptive == 'true' || false,\n timeDependent: itemElement.timeDependent == 'true' || false,\n variables: itemElement.variables,\n hasCorrectResponse,\n hasResponseProcessing\n };\n })\n };\n })\n };\n })\n };\n }\n\n /* PK: on every change of the candidate we will recomputed the computedContext */\n protected override willUpdate(_changedProperties: PropertyValues): void {\n if (!this.computedContext) return;\n\n let itemIndex = 1;\n this.computedContext = {\n ...this.computedContext,\n view: this._sessionContext?.view,\n testParts: this.computedContext.testParts.map(testPart => {\n return {\n ...testPart,\n active: this._sessionContext?.navPartId === testPart.identifier || false,\n sections: testPart.sections.map(section => {\n return {\n ...section,\n active: this._sessionContext?.navSectionId === section.identifier || false,\n completed: section.items.every(\n item =>\n this._testContext.items\n .find(i => i.identifier === item.identifier)\n ?.variables.find(v => v.identifier === 'completionStatus').value === 'completed'\n ),\n\n items: section.items.map(item => {\n const itemContext = this._testContext?.items.find(i => i.identifier === item.identifier);\n const computedItem = {\n ...item,\n ...itemContext,\n ...this.initContext?.find(i => i.identifier === item.identifier)\n };\n\n const rawscore = computedItem.variables?.find(vr => vr.identifier == 'SCORE')?.value;\n\n const score = rawscore === undefined || rawscore === null ? null : parseFloat(rawscore?.toString());\n\n const completionStatus = computedItem.variables?.find(v => v.identifier === 'completionStatus')\n ?.value as string;\n\n const response = computedItem.variables?.find(v => v.identifier === 'RESPONSE')?.value || '';\n const numAttempts =\n Number(computedItem.variables?.find(v => v.identifier === 'numAttempts')?.value) || 0;\n\n const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;\n\n const valid = this.#assessmentItemFor(computedItem.identifier)?.validate(false) ?? true;\n\n const responseVars = itemContext?.variables?.filter(v => v.type === 'response') || [];\n\n const isDefaultResponse = responseVars.every(v => {\n if (v.value === undefined || v.value === null) {\n return true;\n }\n let fallbackValue: string;\n switch (v.baseType) {\n case 'integer':\n case 'float':\n case 'duration':\n fallbackValue = '0';\n break;\n case 'boolean':\n fallbackValue = 'false';\n break;\n case 'string':\n case 'directedPair':\n case 'identifier':\n case 'pair':\n case 'record':\n default:\n fallbackValue = '';\n break;\n }\n\n const defaultValue = v.defaultValue ?? fallbackValue;\n\n if (Array.isArray(v.value)) {\n const dv = Array.isArray(defaultValue) ? defaultValue : [defaultValue];\n return v.value.length === dv.length && v.value.every((val, i) => val === dv[i]);\n }\n\n return v.value === defaultValue;\n });\n\n // Computed and opiniated\n // const type = item.categories.includes(this.configContext?.infoItemCategory) ? 'info' : 'regular';\n // const correct = (type == 'regular' && score !== undefined && !isNaN(score) && score > 0) || false;\n // const incorrect = (type == 'regular' && score !== undefined && !isNaN(score) && score <= 0) || false;\n // const completed = completionStatus === 'completed';\n\n const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;\n const rawMaxScore = item.variables?.find(vr => vr.identifier == 'MAXSCORE')?.value;\n const maxScore =\n rawMaxScore === undefined || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());\n\n // Optimality comes from the last *ended attempt* (#optimality),\n // latched in #handleItemContextUpdated — never from a live\n // mid-attempt selection. On a restored session no attempt is ended\n // this run, so seed it once from the persisted context, which still\n // holds the submitted response.\n let optimality = this.#optimality.get(computedItem.identifier);\n if (optimality === undefined) {\n optimality = itemContext ? this.#assessOptimality(itemContext) : 'unscored';\n if (numAttempts > 0) this.#optimality.set(computedItem.identifier, optimality);\n }\n\n const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts);\n\n return {\n ...computedItem,\n completionStatus,\n numAttempts,\n score,\n response,\n index,\n active,\n valid,\n isDefaultResponse,\n maxScore,\n done,\n // Reflects the last *ended* attempt only. Read the latch directly\n // (not the `optimality` local) — the latch is written solely on\n // responseProcessed / restore-seed (line above, guarded by\n // numAttempts > 0), so a freshly-picked mid-attempt selection\n // computed live is never stored and never counts as optimal.\n optimal: this.#optimality.get(computedItem.identifier) === 'optimal'\n // type,\n // correct,\n // incorrect,\n // completed\n };\n })\n };\n })\n };\n })\n };\n\n this.dispatchEvent(\n new CustomEvent('qti-computed-context-updated', {\n detail: this.computedContext,\n bubbles: true\n })\n );\n }\n\n /**\n * Decide whether an item should be treated as \"the candidate is done with it\"\n * for the purpose of gating forward navigation and further attempts.\n *\n * - The candidate must have actually ended an attempt (numAttempts > 0).\n * - Once attempted, the item is done if they reached the optimal outcome\n * ('optimal'), or there's nothing to improve on ('unscored'). It is only *not*\n * done while a better attempt is still possible ('suboptimal') and attempts\n * remain — see #assessOptimality for how \"optimal\" is determined.\n *\n * `optimality` reflects the last *ended attempt* (see #optimality), not the\n * live selection — so a freshly-picked optimal answer doesn't count as done\n * until test-end-attempt evaluates it.\n */\n #isItemDone(numAttempts: number, optimality: ItemOptimality, maxAttempts: number | undefined): boolean {\n if (numAttempts === 0) return false;\n if (optimality !== 'suboptimal') return true;\n const max = maxAttempts ?? 1;\n return max > 0 && numAttempts >= max;\n }\n\n /**\n * Decide whether an item's submission is as good as it can get — i.e. the\n * candidate reached the *optimal* outcome, so there's no reason to make them\n * try again. 'optimal' means best achievable, 'suboptimal' means a better\n * attempt is still possible, 'unscored' means there's nothing to judge against.\n * (\"optimal\" is the spec's own word — a qti-correct-response is defined as\n * \"the (or an) optimal value\".)\n *\n * Two signals, in order of authority:\n * 1. The scored outcome: optimal ⟺ SCORE has reached its maximum (MAXSCORE).\n * This correctly handles partial-credit / qti-mapping items, where an exact\n * response match would under- or over-judge.\n * 2. The declared qti-correct-response, for items that aren't scored (no\n * SCORE/MAXSCORE) — an exact match is the best available proxy. Bookkeeping\n * variables like numAttempts can be typed 'response' but never declare a\n * correctResponse, so we filter on a declared correctResponse.\n *\n * Items with neither a comparable score nor a correctResponse (essays, info\n * items, etc.) are 'unscored' — there's no optimal value to require, so one\n * attempt is enough.\n */\n #assessOptimality(item: ItemContext): ItemOptimality {\n const variables = item.variables ?? [];\n\n const score = this.#numericVariable(variables, 'SCORE');\n const maxScore = this.#numericVariable(variables, 'MAXSCORE');\n if (score !== null && maxScore !== null) {\n return score >= maxScore ? 'optimal' : 'suboptimal';\n }\n\n const responseVars = variables.filter(\n (v): v is ResponseVariable =>\n v.type === 'response' &&\n (v as ResponseVariable).correctResponse !== undefined &&\n (v as ResponseVariable).correctResponse !== null\n );\n if (responseVars.length === 0) return 'unscored';\n const allMatch = responseVars.every(v => {\n const expected = v.correctResponse;\n const actual = v.value;\n if (actual === undefined || actual === null) return false;\n if (Array.isArray(expected) && Array.isArray(actual)) {\n return expected.length === actual.length && expected.every(e => actual.includes(e));\n }\n if (Array.isArray(expected) || Array.isArray(actual)) return false;\n return expected === actual;\n });\n return allMatch ? 'optimal' : 'suboptimal';\n }\n\n /** Read a single numeric outcome value, or null when absent / non-numeric. */\n #numericVariable(variables: ItemContext['variables'], identifier: string): number | null {\n const raw = variables?.find(v => v.identifier === identifier)?.value;\n if (raw === undefined || raw === null || Array.isArray(raw)) return null;\n const parsed = parseFloat(raw.toString());\n return Number.isNaN(parsed) ? null : parsed;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-navigation': TestNavigation;\n }\n}\n"]}
|
|
@@ -71,16 +71,16 @@ export class TestNext extends LitElement {
|
|
|
71
71
|
const submissionMode = activeSection?.submissionMode || testPart.submissionMode;
|
|
72
72
|
const activeItem = this.sectionItems[this.itemIndex];
|
|
73
73
|
const isLinearIndividual = navigationMode === 'linear' && submissionMode === 'individual';
|
|
74
|
-
// In linear
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
|
|
74
|
+
// In linear individual mode the candidate may only advance once they are
|
|
75
|
+
// "done" with the active item: they reached the optimal outcome (best score),
|
|
76
|
+
// exhausted maxAttempts, or the item has no judgeable optimal value. `done` is
|
|
77
|
+
// computed centrally in test-navigation (#isItemDone), so this Next gate
|
|
78
|
+
// matches the exact rule that decides an item is resolved.
|
|
79
79
|
this._internalDisabled =
|
|
80
80
|
!this.computedContext ||
|
|
81
81
|
this.itemIndex < 0 ||
|
|
82
82
|
this.itemIndex >= (this.sectionItems?.length ?? 0) - 1 ||
|
|
83
|
-
(isLinearIndividual &&
|
|
83
|
+
(isLinearIndividual && !activeItem?.done);
|
|
84
84
|
}
|
|
85
85
|
_requestItem(identifier) {
|
|
86
86
|
this.dispatchEvent(new CustomEvent('qti-request-navigation', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-next.js","sourceRoot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Y,CAAC;QAE1F,yEAAyE;QACzE,8EAA8E;QAC9E,+EAA+E;QAC/E,yEAAyE;QACzE,2DAA2D;QAC3D,IAAI,CAAC,iBAAiB;YACpB,CAAC,IAAI,CAAC,eAAe;gBACrB,IAAI,CAAC,SAAS,GAAG,CAAC;gBAClB,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC;gBACtD,CAAC,kBAAkB,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;IAES,YAAY,CAAC,UAAkB;QACvC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,wBAAwB,EAAE;YACxC,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM;gBACZ,EAAE,EAAE,UAAU;aACf;SACF,CAAC,CACH,CAAC;IACJ,CAAC;IAEQ,MAAM;QACb,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAzFM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;mDAClC;AAGtB;IADT,OAAO,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;iDACZ;AAM3C;IADC,KAAK,CAAC,iBAAiB,CAAC;wDAKxB","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { watch } from '@qti-components/utilities';\nimport { computedContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { ComputedContext, ComputedItem } from '@qti-components/base';\n\n/**\n * Represents a custom element for navigating to the next test item.\n *\n * @remarks\n * This element provides functionality for navigating to the next test item.\n *\n * @example\n * ```html\n * <test-next></test-next>\n * ```\n */\n\nexport class TestNext extends LitElement {\n @property({ type: Boolean, reflect: true, attribute: 'disabled' })\n public _internalDisabled = true;\n\n @consume({ context: computedContext, subscribe: true })\n protected computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.requestUpdate();\n }\n }\n\n static override styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n #internals: ElementInternals;\n\n constructor() {\n super();\n\n this.#internals = this.attachInternals();\n this.#internals.role = 'button';\n this.#internals.ariaLabel = 'Next item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);\n });\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.checkDisabled();\n }\n\n override willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n this.checkDisabled();\n }\n\n checkDisabled() {\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n const activeSection = testPart.sections.find(s => s.active);\n const navigationMode = activeSection?.navigationMode || testPart.navigationMode;\n const submissionMode = activeSection?.submissionMode || testPart.submissionMode;\n const activeItem = this.sectionItems[this.itemIndex];\n\n const isLinearIndividual = navigationMode === 'linear' && submissionMode === 'individual';\n\n // In linear individual mode the candidate may only advance once they are\n // \"done\" with the active item: they reached the optimal outcome (best score),\n // exhausted maxAttempts, or the item has no judgeable optimal value. `done` is\n // computed centrally in test-navigation (#isItemDone), so this Next gate\n // matches the exact rule that decides an item is resolved.\n this._internalDisabled =\n !this.computedContext ||\n this.itemIndex < 0 ||\n this.itemIndex >= (this.sectionItems?.length ?? 0) - 1 ||\n (isLinearIndividual && !activeItem?.done);\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-next': TestNext;\n }\n}\n"]}
|
package/dist/elements.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QtiAssessmentItemRef } from './components/qti-assessment-item-ref/qti-assessment-item-ref';
|
|
2
2
|
import { QtiAssessmentSection } from './components/qti-assessment-section/qti-assessment-section';
|
|
3
3
|
import { QtiAssessmentTest } from './components/qti-assessment-test/qti-assessment-test';
|
|
4
|
+
import { QtiItemSessionControl } from './components/qti-item-session-control/qti-item-session-control';
|
|
4
5
|
import { QtiOutcomeProcessing } from './components/qti-outcome-processing/qti-outcome-processing';
|
|
5
6
|
import { QtiTestFeedback } from './components/qti-test-feedback/qti-test-feedback';
|
|
6
7
|
import { QtiTestPart } from './components/qti-test-part/qti-test-part';
|
|
@@ -24,7 +25,7 @@ import { TestSectionLink } from './components/test-section-link/test-section-lin
|
|
|
24
25
|
import { TestStamp } from './components/test-stamp/test-stamp';
|
|
25
26
|
import { TestView } from './components/test-view-toggle/test-view';
|
|
26
27
|
import { TestViewToggle } from './components/test-view-toggle/test-view-toggle';
|
|
27
|
-
export { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiOutcomeProcessing, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, TestCheckItem, TestContainer, TestEndAttempt, TestItemLink, TestItemToSpeech, TestNavigation, TestNext, TestPagingButtonsStamp, TestPrev, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestSectionButtonsStamp, TestSectionLink, TestStamp, TestTtsNext, TestTtsPause, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop, TestView, TestViewToggle };
|
|
28
|
+
export { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiItemSessionControl, QtiOutcomeProcessing, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, TestCheckItem, TestContainer, TestEndAttempt, TestItemLink, TestItemToSpeech, TestNavigation, TestNext, TestPagingButtonsStamp, TestPrev, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestSectionButtonsStamp, TestSectionLink, TestStamp, TestTtsNext, TestTtsPause, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop, TestView, TestViewToggle };
|
|
28
29
|
export declare const qtiTestElements: readonly [{
|
|
29
30
|
readonly tag: "qti-assessment-item-ref";
|
|
30
31
|
readonly ctor: typeof QtiAssessmentItemRef;
|
|
@@ -34,6 +35,9 @@ export declare const qtiTestElements: readonly [{
|
|
|
34
35
|
}, {
|
|
35
36
|
readonly tag: "qti-assessment-test";
|
|
36
37
|
readonly ctor: typeof QtiAssessmentTest;
|
|
38
|
+
}, {
|
|
39
|
+
readonly tag: "qti-item-session-control";
|
|
40
|
+
readonly ctor: typeof QtiItemSessionControl;
|
|
37
41
|
}, {
|
|
38
42
|
readonly tag: "qti-outcome-processing";
|
|
39
43
|
readonly ctor: typeof QtiOutcomeProcessing;
|
package/dist/elements.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QtiAssessmentItemRef } from './components/qti-assessment-item-ref/qti-assessment-item-ref';
|
|
2
2
|
import { QtiAssessmentSection } from './components/qti-assessment-section/qti-assessment-section';
|
|
3
3
|
import { QtiAssessmentTest } from './components/qti-assessment-test/qti-assessment-test';
|
|
4
|
+
import { QtiItemSessionControl } from './components/qti-item-session-control/qti-item-session-control';
|
|
4
5
|
import { QtiOutcomeProcessing } from './components/qti-outcome-processing/qti-outcome-processing';
|
|
5
6
|
import { QtiTestFeedback } from './components/qti-test-feedback/qti-test-feedback';
|
|
6
7
|
import { QtiTestPart } from './components/qti-test-part/qti-test-part';
|
|
@@ -24,11 +25,12 @@ import { TestSectionLink } from './components/test-section-link/test-section-lin
|
|
|
24
25
|
import { TestStamp } from './components/test-stamp/test-stamp';
|
|
25
26
|
import { TestView } from './components/test-view-toggle/test-view';
|
|
26
27
|
import { TestViewToggle } from './components/test-view-toggle/test-view-toggle';
|
|
27
|
-
export { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiOutcomeProcessing, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, TestCheckItem, TestContainer, TestEndAttempt, TestItemLink, TestItemToSpeech, TestNavigation, TestNext, TestPagingButtonsStamp, TestPrev, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestSectionButtonsStamp, TestSectionLink, TestStamp, TestTtsNext, TestTtsPause, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop, TestView, TestViewToggle };
|
|
28
|
+
export { QtiAssessmentItemRef, QtiAssessmentSection, QtiAssessmentTest, QtiItemSessionControl, QtiOutcomeProcessing, QtiTest, QtiTestFeedback, QtiTestPart, QtiTestVariables, TestCheckItem, TestContainer, TestEndAttempt, TestItemLink, TestItemToSpeech, TestNavigation, TestNext, TestPagingButtonsStamp, TestPrev, TestPrintContext, TestPrintVariables, TestScoringButtons, TestScoringFeedback, TestSectionButtonsStamp, TestSectionLink, TestStamp, TestTtsNext, TestTtsPause, TestTtsPlay, TestTtsPrev, TestTtsResume, TestTtsStop, TestView, TestViewToggle };
|
|
28
29
|
export const qtiTestElements = [
|
|
29
30
|
{ tag: 'qti-assessment-item-ref', ctor: QtiAssessmentItemRef },
|
|
30
31
|
{ tag: 'qti-assessment-section', ctor: QtiAssessmentSection },
|
|
31
32
|
{ tag: 'qti-assessment-test', ctor: QtiAssessmentTest },
|
|
33
|
+
{ tag: 'qti-item-session-control', ctor: QtiItemSessionControl },
|
|
32
34
|
{ tag: 'qti-outcome-processing', ctor: QtiOutcomeProcessing },
|
|
33
35
|
{ tag: 'qti-test', ctor: QtiTest },
|
|
34
36
|
{ tag: 'qti-test-feedback', ctor: QtiTestFeedback },
|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EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;CACzC,CAAC","sourcesContent":["import { QtiAssessmentItemRef } from './components/qti-assessment-item-ref/qti-assessment-item-ref';\nimport { QtiAssessmentSection } from './components/qti-assessment-section/qti-assessment-section';\nimport { QtiAssessmentTest } from './components/qti-assessment-test/qti-assessment-test';\nimport { QtiOutcomeProcessing } from './components/qti-outcome-processing/qti-outcome-processing';\nimport { QtiTestFeedback } from './components/qti-test-feedback/qti-test-feedback';\nimport { QtiTestPart } from './components/qti-test-part/qti-test-part';\nimport { QtiTestVariables } from './components/qti-test-variables/qti-test-variables';\nimport { QtiTest } from './components/qti-test/qti-test';\nimport { TestCheckItem } from './components/test-check-item/test-check-item';\nimport { TestContainer } from './components/test-container/test-container';\nimport { TestEndAttempt } from './components/test-end-attempt/test-end-attempt';\nimport { TestItemLink } from './components/test-item-link/test-item-link';\nimport {\n TestItemToSpeech,\n TestTtsNext,\n TestTtsPause,\n TestTtsPlay,\n TestTtsPrev,\n TestTtsResume,\n TestTtsStop\n} from './components/test-item-to-speech/test-item-to-speech';\nimport { TestNavigation } from './components/test-navigation/test-navigation';\nimport { TestNext } from './components/test-next/test-next';\nimport { TestPagingButtonsStamp } from './components/test-paging-buttons-stamp/test-paging-buttons-stamp';\nimport { TestPrev } from './components/test-prev/test-prev';\nimport { TestPrintContext } from './components/test-print-context/test-print-context';\nimport { TestPrintVariables } from './components/test-print-item-variables/test-print-item-variables';\nimport { TestScoringButtons } from './components/test-scoring-buttons/test-scoring-buttons';\nimport { TestScoringFeedback } from './components/test-scoring-feedback/test-scoring-feedback';\nimport { TestSectionButtonsStamp } from './components/test-section-buttons-stamp/test-section-buttons-stamp';\nimport { TestSectionLink } from './components/test-section-link/test-section-link';\nimport { TestStamp } from './components/test-stamp/test-stamp';\nimport { TestView } from './components/test-view-toggle/test-view';\nimport { TestViewToggle } from './components/test-view-toggle/test-view-toggle';\n\nexport {\n QtiAssessmentItemRef,\n QtiAssessmentSection,\n QtiAssessmentTest,\n QtiOutcomeProcessing,\n QtiTest,\n QtiTestFeedback,\n QtiTestPart,\n QtiTestVariables,\n TestCheckItem,\n TestContainer,\n TestEndAttempt,\n TestItemLink,\n TestItemToSpeech,\n TestNavigation,\n TestNext,\n TestPagingButtonsStamp,\n TestPrev,\n TestPrintContext,\n TestPrintVariables,\n TestScoringButtons,\n TestScoringFeedback,\n TestSectionButtonsStamp,\n TestSectionLink,\n TestStamp,\n TestTtsNext,\n TestTtsPause,\n TestTtsPlay,\n TestTtsPrev,\n TestTtsResume,\n TestTtsStop,\n TestView,\n TestViewToggle\n};\n\nexport const qtiTestElements = [\n { tag: 'qti-assessment-item-ref', ctor: QtiAssessmentItemRef },\n { tag: 'qti-assessment-section', ctor: QtiAssessmentSection },\n { tag: 'qti-assessment-test', ctor: QtiAssessmentTest },\n { tag: 'qti-outcome-processing', ctor: QtiOutcomeProcessing },\n { tag: 'qti-test', ctor: QtiTest },\n { tag: 'qti-test-feedback', ctor: QtiTestFeedback },\n { tag: 'qti-test-part', ctor: QtiTestPart },\n { tag: 'qti-test-variables', ctor: QtiTestVariables },\n { tag: 'test-check-item', ctor: TestCheckItem },\n { tag: 'test-container', ctor: TestContainer },\n { tag: 'test-end-attempt', ctor: TestEndAttempt },\n { tag: 'test-item-link', ctor: TestItemLink },\n { tag: 'test-item-to-speech', ctor: TestItemToSpeech },\n { tag: 'test-navigation', ctor: TestNavigation },\n { tag: 'test-next', ctor: TestNext },\n { tag: 'test-paging-buttons-stamp', ctor: TestPagingButtonsStamp },\n { tag: 'test-prev', ctor: TestPrev },\n { tag: 'test-print-context', ctor: TestPrintContext },\n { tag: 'test-print-item-variables', ctor: TestPrintVariables },\n { tag: 'test-scoring-buttons', ctor: TestScoringButtons },\n { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },\n { tag: 'test-section-buttons-stamp', ctor: TestSectionButtonsStamp },\n { tag: 'test-section-link', ctor: TestSectionLink },\n { tag: 'test-stamp', ctor: TestStamp },\n { tag: 'test-tts-next', ctor: TestTtsNext },\n { tag: 'test-tts-pause', ctor: TestTtsPause },\n { tag: 'test-tts-play', ctor: TestTtsPlay },\n { tag: 'test-tts-prev', ctor: TestTtsPrev },\n { tag: 'test-tts-resume', ctor: TestTtsResume },\n { tag: 'test-tts-stop', ctor: TestTtsStop },\n { tag: 'test-view', ctor: TestView },\n { tag: 'test-view-toggle', ctor: TestViewToggle }\n] as const;\n"]}
|
|
1
|
+
{"version":3,"file":"elements.js","sourceRoot":"","sources":["../src/elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AACzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gEAAgE,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oDAAoD,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM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,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,oBAAoB,EAAE,IAAI,EAAE,gBAAgB,EAAE;IACrD,EAAE,GAAG,EAAE,2BAA2B,EAAE,IAAI,EAAE,kBAAkB,EAAE;IAC9D,EAAE,GAAG,EAAE,sBAAsB,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACzD,EAAE,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,mBAAmB,EAAE;IAC3D,EAAE,GAAG,EAAE,4BAA4B,EAAE,IAAI,EAAE,uBAAuB,EAAE;IACpE,EAAE,GAAG,EAAE,mBAAmB,EAAE,IAAI,EAAE,eAAe,EAAE;IACnD,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;IACtC,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,EAAE;IAC7C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/C,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC3C,EAAE,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACpC,EAAE,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE;CACzC,CAAC","sourcesContent":["import { QtiAssessmentItemRef } from './components/qti-assessment-item-ref/qti-assessment-item-ref';\nimport { QtiAssessmentSection } from './components/qti-assessment-section/qti-assessment-section';\nimport { QtiAssessmentTest } from './components/qti-assessment-test/qti-assessment-test';\nimport { QtiItemSessionControl } from './components/qti-item-session-control/qti-item-session-control';\nimport { QtiOutcomeProcessing } from './components/qti-outcome-processing/qti-outcome-processing';\nimport { QtiTestFeedback } from './components/qti-test-feedback/qti-test-feedback';\nimport { QtiTestPart } from './components/qti-test-part/qti-test-part';\nimport { QtiTestVariables } from './components/qti-test-variables/qti-test-variables';\nimport { QtiTest } from './components/qti-test/qti-test';\nimport { TestCheckItem } from './components/test-check-item/test-check-item';\nimport { TestContainer } from './components/test-container/test-container';\nimport { TestEndAttempt } from './components/test-end-attempt/test-end-attempt';\nimport { TestItemLink } from './components/test-item-link/test-item-link';\nimport {\n TestItemToSpeech,\n TestTtsNext,\n TestTtsPause,\n TestTtsPlay,\n TestTtsPrev,\n TestTtsResume,\n TestTtsStop\n} from './components/test-item-to-speech/test-item-to-speech';\nimport { TestNavigation } from './components/test-navigation/test-navigation';\nimport { TestNext } from './components/test-next/test-next';\nimport { TestPagingButtonsStamp } from './components/test-paging-buttons-stamp/test-paging-buttons-stamp';\nimport { TestPrev } from './components/test-prev/test-prev';\nimport { TestPrintContext } from './components/test-print-context/test-print-context';\nimport { TestPrintVariables } from './components/test-print-item-variables/test-print-item-variables';\nimport { TestScoringButtons } from './components/test-scoring-buttons/test-scoring-buttons';\nimport { TestScoringFeedback } from './components/test-scoring-feedback/test-scoring-feedback';\nimport { TestSectionButtonsStamp } from './components/test-section-buttons-stamp/test-section-buttons-stamp';\nimport { TestSectionLink } from './components/test-section-link/test-section-link';\nimport { TestStamp } from './components/test-stamp/test-stamp';\nimport { TestView } from './components/test-view-toggle/test-view';\nimport { TestViewToggle } from './components/test-view-toggle/test-view-toggle';\n\nexport {\n QtiAssessmentItemRef,\n QtiAssessmentSection,\n QtiAssessmentTest,\n QtiItemSessionControl,\n QtiOutcomeProcessing,\n QtiTest,\n QtiTestFeedback,\n QtiTestPart,\n QtiTestVariables,\n TestCheckItem,\n TestContainer,\n TestEndAttempt,\n TestItemLink,\n TestItemToSpeech,\n TestNavigation,\n TestNext,\n TestPagingButtonsStamp,\n TestPrev,\n TestPrintContext,\n TestPrintVariables,\n TestScoringButtons,\n TestScoringFeedback,\n TestSectionButtonsStamp,\n TestSectionLink,\n TestStamp,\n TestTtsNext,\n TestTtsPause,\n TestTtsPlay,\n TestTtsPrev,\n TestTtsResume,\n TestTtsStop,\n TestView,\n TestViewToggle\n};\n\nexport const qtiTestElements = [\n { tag: 'qti-assessment-item-ref', ctor: QtiAssessmentItemRef },\n { tag: 'qti-assessment-section', ctor: QtiAssessmentSection },\n { tag: 'qti-assessment-test', ctor: QtiAssessmentTest },\n { tag: 'qti-item-session-control', ctor: QtiItemSessionControl },\n { tag: 'qti-outcome-processing', ctor: QtiOutcomeProcessing },\n { tag: 'qti-test', ctor: QtiTest },\n { tag: 'qti-test-feedback', ctor: QtiTestFeedback },\n { tag: 'qti-test-part', ctor: QtiTestPart },\n { tag: 'qti-test-variables', ctor: QtiTestVariables },\n { tag: 'test-check-item', ctor: TestCheckItem },\n { tag: 'test-container', ctor: TestContainer },\n { tag: 'test-end-attempt', ctor: TestEndAttempt },\n { tag: 'test-item-link', ctor: TestItemLink },\n { tag: 'test-item-to-speech', ctor: TestItemToSpeech },\n { tag: 'test-navigation', ctor: TestNavigation },\n { tag: 'test-next', ctor: TestNext },\n { tag: 'test-paging-buttons-stamp', ctor: TestPagingButtonsStamp },\n { tag: 'test-prev', ctor: TestPrev },\n { tag: 'test-print-context', ctor: TestPrintContext },\n { tag: 'test-print-item-variables', ctor: TestPrintVariables },\n { tag: 'test-scoring-buttons', ctor: TestScoringButtons },\n { tag: 'test-scoring-feedback', ctor: TestScoringFeedback },\n { tag: 'test-section-buttons-stamp', ctor: TestSectionButtonsStamp },\n { tag: 'test-section-link', ctor: TestSectionLink },\n { tag: 'test-stamp', ctor: TestStamp },\n { tag: 'test-tts-next', ctor: TestTtsNext },\n { tag: 'test-tts-pause', ctor: TestTtsPause },\n { tag: 'test-tts-play', ctor: TestTtsPlay },\n { tag: 'test-tts-prev', ctor: TestTtsPrev },\n { tag: 'test-tts-resume', ctor: TestTtsResume },\n { tag: 'test-tts-stop', ctor: TestTtsStop },\n { tag: 'test-view', ctor: TestView },\n { tag: 'test-view-toggle', ctor: TestViewToggle }\n] as const;\n"]}
|
package/dist/mixins/test-base.js
CHANGED
|
@@ -74,14 +74,25 @@ export const TestBaseMixin = (superClass) => {
|
|
|
74
74
|
}
|
|
75
75
|
_initializeEventListeners() {
|
|
76
76
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
77
|
+
* A new test document means a new test and session context.
|
|
78
|
+
*
|
|
79
|
+
* This resets on the document being loaded rather than on
|
|
80
|
+
* `qti-assessment-test-connected`, because the new document's children —
|
|
81
|
+
* test-level `qti-outcome-declaration` among them — connect and register
|
|
82
|
+
* themselves into the context *before* the test element announces itself.
|
|
83
|
+
* Resetting on that announcement discarded every one of those
|
|
84
|
+
* registrations, so no test-level outcome could be read or set.
|
|
85
|
+
*/
|
|
86
|
+
this.addEventListener('qti-testdoc-loaded', () => {
|
|
87
|
+
this.testContext = INITIAL_TEST_CONTEXT;
|
|
88
|
+
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* When the test is connected, its item-refs are added to the test context.
|
|
92
|
+
* Registrations from the document's children are already present on the
|
|
93
|
+
* context reset above, so this must preserve what is there.
|
|
79
94
|
*/
|
|
80
95
|
this.addEventListener('qti-assessment-test-connected', (e) => {
|
|
81
|
-
this.testContext = INITIAL_TEST_CONTEXT; // new test, new test context!
|
|
82
|
-
this.sessionContext = INITIAL_SESSION_CONTEXT; // new test, new session context!
|
|
83
|
-
if (this.testContext && this.testContext.items.length > 0)
|
|
84
|
-
return;
|
|
85
96
|
this._testElement = e.detail;
|
|
86
97
|
const items = Array.from(this._testElement.querySelectorAll('qti-assessment-item-ref')).map(itemRef => {
|
|
87
98
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-base.js","sourceRoot":"","sources":["../../src/mixins/test-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,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AG,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;wBAC5E,CAAC,CAAC;wBACF,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;qBAC5E,CAAC;gBACJ,CAAC,CAAC;aACH,CAAC;YACF,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAC3G,CAAC;QACJ,CAAC;KA2CF;IAxJQ;QAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;sDAC+B;IAI1D;QAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;yDACqC;IAsJ5E,OAAO,aAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,OAAgB,QAAS,SAAQ,aAAa,CAAC,UAAU,CAAC;CAAG","sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { INITIAL_TEST_CONTEXT, testContext } from '@qti-components/base';\nimport { INITIAL_SESSION_CONTEXT, type SessionContext, sessionContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiAssessmentItemRef } from '../components/qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\nimport type { OutcomeVariable, VariableDeclaration, VariableValue } from '@qti-components/base';\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\n\nexport interface TestBaseInterface extends LitElement {\n testContext: Readonly<TestContext>;\n sessionContext: Readonly<SessionContext>;\n configContext?: Readonly<ConfigContext>;\n _testElement: QtiAssessmentTest;\n updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;\n}\n\nexport const TestBaseMixin = <T extends Constructor<LitElement>>(superClass: T) => {\n abstract class TestBaseClass extends superClass implements TestBaseInterface {\n @property({ attribute: false, type: Object })\n @provide({ context: testContext })\n public testContext: Readonly<TestContext> = INITIAL_TEST_CONTEXT;\n\n @property({ attribute: false, type: Object })\n @provide({ context: sessionContext })\n public sessionContext: Readonly<SessionContext> = INITIAL_SESSION_CONTEXT;\n\n public _testElement: QtiAssessmentTest;\n\n constructor(...args: any[]) {\n super(...args);\n this._initializeEventListeners();\n }\n\n updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void {\n // Update variables in the testContext for the specified itemRefID\n const itemContext = this.testContext.items.find(item => item.identifier === itemRefID);\n if (itemContext) {\n itemContext.variables = itemContext.variables.map(variable => {\n const updatedVariable = variables.find(v => v.identifier === variable.identifier);\n return updatedVariable ? { ...variable, ...updatedVariable } : variable;\n });\n }\n // if the qti-assessment-item-ref has a qti-assessment-item, then update this item as well\n const itemRef = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${itemRefID}\"]`\n );\n if (itemRef && itemRef.assessmentItem) {\n itemRef.assessmentItem.variables = variables;\n }\n }\n\n private _initializeEventListeners(): void {\n /**\n * When the test is connected, the items are updated in the test context.\n * An existing context item is updated with the itemRef properties if nessesary.\n */\n this.addEventListener('qti-assessment-test-connected', (e: CustomEvent<QtiAssessmentTest>) => {\n this.testContext = INITIAL_TEST_CONTEXT; // new test, new test context!\n this.sessionContext = INITIAL_SESSION_CONTEXT; // new test, new session context!\n if (this.testContext && this.testContext.items.length > 0) return;\n\n this._testElement = e.detail;\n const items = Array.from(this._testElement.querySelectorAll('qti-assessment-item-ref')).map(itemRef => {\n return {\n href: itemRef.href,\n identifier: itemRef.identifier,\n category: itemRef.category,\n variables: [\n {\n identifier: 'completionStatus',\n value: 'not_attempted',\n type: 'outcome'\n } as OutcomeVariable\n ]\n };\n });\n this.testContext = { ...this.testContext, items };\n });\n\n this.addEventListener('qti-assessment-item-connected', (e: CustomEvent<QtiAssessmentItem>) => {\n const assessmentItem = e.detail as QtiAssessmentItem;\n const assessmentRefId = assessmentItem.closest('qti-assessment-item-ref')?.identifier;\n if (assessmentRefId) {\n assessmentItem.assessmentItemRefId = assessmentRefId;\n }\n this._updateItemInTestContext(e.detail);\n });\n\n this.addEventListener('qti-item-context-updated', (e: CustomEvent<{ itemContext: ItemContext }>) => {\n // const assessmentitem = e.composedPath()[0] as QtiAssessmentItem;\n this._updateItemVariablesInTestContext(\n e.detail.itemContext.identifier,\n e.detail.itemContext.variables,\n e.detail.itemContext.state\n );\n });\n }\n\n private _updateItemVariablesInTestContext(\n identifier: string,\n variables: readonly VariableDeclaration<string | string[] | null>[],\n state?: ItemContext['state']\n ): void {\n // Update the test context with modified variables for the specified item\n this.testContext = {\n ...this.testContext, // Spread existing test context properties\n items: this.testContext.items.map(itemContext => {\n // If the item identifier doesn't match, keep it unchanged\n if (itemContext.identifier !== identifier) {\n return itemContext;\n }\n\n // Update the matching item with new variables\n return {\n ...itemContext, // Keep other properties of the item context\n variables: variables.map(variable => {\n // Find a matching variable in the current item context\n const matchingVariable = itemContext.variables.find(v => v.identifier === variable.identifier);\n\n // Merge matching variable with the new one, or use the new variable if no match\n return matchingVariable ? { ...matchingVariable, ...variable } : variable;\n }),\n ...(state !== undefined ? { state: state ? { ...state } : undefined } : {})\n };\n })\n };\n this.dispatchEvent(\n new CustomEvent('qti-test-context-updated', { detail: this.testContext, bubbles: false, composed: false })\n );\n }\n\n /**\n * Updates the variables of an assessment item in the test context.\n * - Matches the assessment item with the corresponding test context item.\n * - If the item is not found, logs a warning.\n * - Updates variables in the test context if exactly one variable exists.\n * - Otherwise, syncs the assessment item's variables with the test context.\n *\n * @param assessmentItem - The assessment item to update.\n */\n private _updateItemInTestContext = (assessmentItem: QtiAssessmentItem): void => {\n const context = (assessmentItem as any)._context;\n const identifier = context.identifier;\n const fullVariables = context.variables;\n\n // console.log(this._testContext);\n // Find the corresponding item in the test context by identifier\n const itemContext = this.testContext.items.find(i => i?.identifier === identifier);\n\n if (!itemContext) {\n console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);\n return;\n }\n\n // Update variables in the test context or sync them to the assessment item\n if (itemContext.variables?.length === 1) {\n // The loaded qti-assessment-item itself has variables which are not in test context yet.\n this._updateItemVariablesInTestContext(identifier, fullVariables);\n } else {\n const newVariables = [...assessmentItem.variables];\n // Sync the assessment item's variables with the test context\n for (const variable of itemContext.variables) {\n const currentVariable = newVariables.find(v => v.identifier === variable.identifier);\n if (currentVariable) {\n currentVariable.value = variable.value;\n } else {\n newVariables.push(variable);\n }\n }\n assessmentItem.variables = newVariables;\n }\n };\n }\n\n return TestBaseClass as Constructor<TestBaseInterface> & T;\n};\n\n// Keep the old abstract class for backwards compatibility during migration\nexport abstract class TestBase extends TestBaseMixin(LitElement) {}\n"]}
|
|
1
|
+
{"version":3,"file":"test-base.js","sourceRoot":"","sources":["../../src/mixins/test-base.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAuB,cAAc,EAAE,MAAM,sBAAs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AAC;gBACJ,CAAC,CAAC;aACH,CAAC;YACF,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,0BAA0B,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAC3G,CAAC;QACJ,CAAC;KA2CF;IApKQ;QAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;sDAC+B;IAI1D;QAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC;yDACqC;IAkK5E,OAAO,aAAmD,CAAC;AAC7D,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,OAAgB,QAAS,SAAQ,aAAa,CAAC,UAAU,CAAC;CAAG","sourcesContent":["import { provide } from '@lit/context';\nimport { LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { INITIAL_TEST_CONTEXT, testContext } from '@qti-components/base';\nimport { INITIAL_SESSION_CONTEXT, type SessionContext, sessionContext } from '@qti-components/base';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { QtiAssessmentItemRef } from '../components/qti-assessment-item-ref/qti-assessment-item-ref';\nimport type { QtiAssessmentTest } from '../components/qti-assessment-test/qti-assessment-test';\nimport type { ConfigContext } from '@qti-components/base';\nimport type { ItemContext } from '@qti-components/base';\nimport type { TestContext } from '@qti-components/base';\nimport type { OutcomeVariable, VariableDeclaration, VariableValue } from '@qti-components/base';\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\n\nexport interface TestBaseInterface extends LitElement {\n testContext: Readonly<TestContext>;\n sessionContext: Readonly<SessionContext>;\n configContext?: Readonly<ConfigContext>;\n _testElement: QtiAssessmentTest;\n updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void;\n}\n\nexport const TestBaseMixin = <T extends Constructor<LitElement>>(superClass: T) => {\n abstract class TestBaseClass extends superClass implements TestBaseInterface {\n @property({ attribute: false, type: Object })\n @provide({ context: testContext })\n public testContext: Readonly<TestContext> = INITIAL_TEST_CONTEXT;\n\n @property({ attribute: false, type: Object })\n @provide({ context: sessionContext })\n public sessionContext: Readonly<SessionContext> = INITIAL_SESSION_CONTEXT;\n\n public _testElement: QtiAssessmentTest;\n\n constructor(...args: any[]) {\n super(...args);\n this._initializeEventListeners();\n }\n\n updateItemVariables(itemRefID: string, variables: VariableValue<string | string[] | null>[]): void {\n // Update variables in the testContext for the specified itemRefID\n const itemContext = this.testContext.items.find(item => item.identifier === itemRefID);\n if (itemContext) {\n itemContext.variables = itemContext.variables.map(variable => {\n const updatedVariable = variables.find(v => v.identifier === variable.identifier);\n return updatedVariable ? { ...variable, ...updatedVariable } : variable;\n });\n }\n // if the qti-assessment-item-ref has a qti-assessment-item, then update this item as well\n const itemRef = this._testElement.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${itemRefID}\"]`\n );\n if (itemRef && itemRef.assessmentItem) {\n itemRef.assessmentItem.variables = variables;\n }\n }\n\n private _initializeEventListeners(): void {\n /**\n * A new test document means a new test and session context.\n *\n * This resets on the document being loaded rather than on\n * `qti-assessment-test-connected`, because the new document's children —\n * test-level `qti-outcome-declaration` among them — connect and register\n * themselves into the context *before* the test element announces itself.\n * Resetting on that announcement discarded every one of those\n * registrations, so no test-level outcome could be read or set.\n */\n this.addEventListener('qti-testdoc-loaded', () => {\n this.testContext = INITIAL_TEST_CONTEXT;\n this.sessionContext = INITIAL_SESSION_CONTEXT;\n });\n\n /**\n * When the test is connected, its item-refs are added to the test context.\n * Registrations from the document's children are already present on the\n * context reset above, so this must preserve what is there.\n */\n this.addEventListener('qti-assessment-test-connected', (e: CustomEvent<QtiAssessmentTest>) => {\n this._testElement = e.detail;\n const items = Array.from(this._testElement.querySelectorAll('qti-assessment-item-ref')).map(itemRef => {\n return {\n href: itemRef.href,\n identifier: itemRef.identifier,\n category: itemRef.category,\n variables: [\n {\n identifier: 'completionStatus',\n value: 'not_attempted',\n type: 'outcome'\n } as OutcomeVariable\n ]\n };\n });\n this.testContext = { ...this.testContext, items };\n });\n\n this.addEventListener('qti-assessment-item-connected', (e: CustomEvent<QtiAssessmentItem>) => {\n const assessmentItem = e.detail as QtiAssessmentItem;\n const assessmentRefId = assessmentItem.closest('qti-assessment-item-ref')?.identifier;\n if (assessmentRefId) {\n assessmentItem.assessmentItemRefId = assessmentRefId;\n }\n this._updateItemInTestContext(e.detail);\n });\n\n this.addEventListener('qti-item-context-updated', (e: CustomEvent<{ itemContext: ItemContext }>) => {\n // const assessmentitem = e.composedPath()[0] as QtiAssessmentItem;\n this._updateItemVariablesInTestContext(\n e.detail.itemContext.identifier,\n e.detail.itemContext.variables,\n e.detail.itemContext.state\n );\n });\n }\n\n private _updateItemVariablesInTestContext(\n identifier: string,\n variables: readonly VariableDeclaration<string | string[] | null>[],\n state?: ItemContext['state']\n ): void {\n // Update the test context with modified variables for the specified item\n this.testContext = {\n ...this.testContext, // Spread existing test context properties\n items: this.testContext.items.map(itemContext => {\n // If the item identifier doesn't match, keep it unchanged\n if (itemContext.identifier !== identifier) {\n return itemContext;\n }\n\n // Update the matching item with new variables\n return {\n ...itemContext, // Keep other properties of the item context\n variables: variables.map(variable => {\n // Find a matching variable in the current item context\n const matchingVariable = itemContext.variables.find(v => v.identifier === variable.identifier);\n\n // Merge matching variable with the new one, or use the new variable if no match\n return matchingVariable ? { ...matchingVariable, ...variable } : variable;\n }),\n ...(state !== undefined ? { state: state ? { ...state } : undefined } : {})\n };\n })\n };\n this.dispatchEvent(\n new CustomEvent('qti-test-context-updated', { detail: this.testContext, bubbles: false, composed: false })\n );\n }\n\n /**\n * Updates the variables of an assessment item in the test context.\n * - Matches the assessment item with the corresponding test context item.\n * - If the item is not found, logs a warning.\n * - Updates variables in the test context if exactly one variable exists.\n * - Otherwise, syncs the assessment item's variables with the test context.\n *\n * @param assessmentItem - The assessment item to update.\n */\n private _updateItemInTestContext = (assessmentItem: QtiAssessmentItem): void => {\n const context = (assessmentItem as any)._context;\n const identifier = context.identifier;\n const fullVariables = context.variables;\n\n // console.log(this._testContext);\n // Find the corresponding item in the test context by identifier\n const itemContext = this.testContext.items.find(i => i?.identifier === identifier);\n\n if (!itemContext) {\n console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);\n return;\n }\n\n // Update variables in the test context or sync them to the assessment item\n if (itemContext.variables?.length === 1) {\n // The loaded qti-assessment-item itself has variables which are not in test context yet.\n this._updateItemVariablesInTestContext(identifier, fullVariables);\n } else {\n const newVariables = [...assessmentItem.variables];\n // Sync the assessment item's variables with the test context\n for (const variable of itemContext.variables) {\n const currentVariable = newVariables.find(v => v.identifier === variable.identifier);\n if (currentVariable) {\n currentVariable.value = variable.value;\n } else {\n newVariables.push(variable);\n }\n }\n assessmentItem.variables = newVariables;\n }\n };\n }\n\n return TestBaseClass as Constructor<TestBaseInterface> & T;\n};\n\n// Keep the old abstract class for backwards compatibility during migration\nexport abstract class TestBase extends TestBaseMixin(LitElement) {}\n"]}
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qti-components/test",
|
|
3
3
|
"description": "QTI test utilities",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.6.0",
|
|
5
5
|
"author": "",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@qti-components/base": "^2.0
|
|
7
|
+
"@qti-components/base": "^2.2.0",
|
|
8
|
+
"@qti-components/elements": "^1.7.0",
|
|
8
9
|
"@qti-components/interactions": "^1.10.4",
|
|
9
|
-
"@qti-components/processing": "^1.
|
|
10
|
-
"@qti-components/
|
|
11
|
-
"@qti-components/
|
|
12
|
-
"@qti-components/transformers": "^1.7.1",
|
|
10
|
+
"@qti-components/processing": "^1.4.1",
|
|
11
|
+
"@qti-components/theme": "^2.1.0",
|
|
12
|
+
"@qti-components/transformers": "^1.7.2",
|
|
13
13
|
"@qti-components/utilities": "^1.3.3"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@heximal/templates": "^0.1.5",
|
|
17
17
|
"@lit/context": "^1.1.6",
|
|
18
|
-
"lit": "^3.3.
|
|
18
|
+
"lit": "^3.3.3"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
21
|
"qti",
|