@citolab/qti-components 7.28.1 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +6316 -2710
- package/dist/base.d.ts +100 -15
- package/dist/base.js +27 -6
- package/dist/chunk-3AJOQCDU.js +11 -0
- package/dist/chunk-3AJOQCDU.js.map +1 -0
- package/dist/chunk-64XSIBGO.js +241 -0
- package/dist/chunk-64XSIBGO.js.map +1 -0
- package/dist/chunk-7HC5SMCU.js +102 -0
- package/dist/chunk-7HC5SMCU.js.map +1 -0
- package/dist/{chunk-SP6S2WMG.js → chunk-7V4HJFHW.js} +3 -3
- package/dist/{chunk-SP6S2WMG.js.map → chunk-7V4HJFHW.js.map} +1 -1
- package/dist/chunk-CAO4JRLY.js +11 -0
- package/dist/chunk-CAO4JRLY.js.map +1 -0
- package/dist/{chunk-MPC7LIPC.js → chunk-F4BNJWYN.js} +4264 -3647
- package/dist/chunk-F4BNJWYN.js.map +1 -0
- package/dist/{chunk-3XV26R5M.js → chunk-H3J7LFRO.js} +829 -1005
- package/dist/chunk-H3J7LFRO.js.map +1 -0
- package/dist/{chunk-3WBG257S.js → chunk-IJD53WY6.js} +96 -74
- package/dist/chunk-IJD53WY6.js.map +1 -0
- package/dist/chunk-LVBIQDPM.js +1374 -0
- package/dist/chunk-LVBIQDPM.js.map +1 -0
- package/dist/{chunk-REI3AMCZ.js → chunk-NA2N2WSG.js} +1303 -1193
- package/dist/chunk-NA2N2WSG.js.map +1 -0
- package/dist/chunk-QECOPVPO.js +294 -0
- package/dist/chunk-QECOPVPO.js.map +1 -0
- package/dist/{chunk-HFCZFWSH.js → chunk-RXGDQDOV.js} +1993 -1764
- package/dist/chunk-RXGDQDOV.js.map +1 -0
- package/dist/chunk-V5G7X53Y.js +11 -0
- package/dist/chunk-V5G7X53Y.js.map +1 -0
- package/dist/{chunk-WDO2TRFM.js → chunk-WVVMNF74.js} +851 -925
- package/dist/chunk-WVVMNF74.js.map +1 -0
- package/dist/{chunk-FLJAKWXL.js → chunk-X3E5HXG2.js} +2 -2
- package/dist/chunk-XU7HNT4F.js +1608 -0
- package/dist/chunk-XU7HNT4F.js.map +1 -0
- package/dist/{computed-item.context-DfsW_96S.d.ts → computed-item.types.d-BKZdSLLJ.d.ts} +2 -5
- package/dist/{computed.context-DHbxad0N.d.ts → computed.types.d-rKLSPvVG.d.ts} +2 -5
- package/dist/config.context.d-BvU9r-Mg.d.ts +91 -0
- package/dist/corrections.d.ts +432 -0
- package/dist/corrections.js +84 -0
- package/dist/elements.d.ts +8 -14
- package/dist/elements.js +6 -5
- package/dist/index.d.ts +51 -16
- package/dist/index.js +193 -76
- package/dist/interaction.d-D4MstYRz.d.ts +115 -0
- package/dist/interaction.interface.d-CvjHM2bi.d.ts +46 -0
- package/dist/interactions.d.ts +1206 -552
- package/dist/interactions.js +19 -15
- package/dist/item.css +4228 -1656
- package/dist/item.d.ts +13 -55
- package/dist/item.js +6 -11
- package/dist/{variables-CMYcDbyW.d.ts → item.types.d-QU7LljEK.d.ts} +13 -1
- package/dist/loader.d.ts +4 -4
- package/dist/loader.js +2 -3
- package/dist/processing.d.ts +6 -7
- package/dist/processing.js +2 -3
- package/dist/qti-components-jsx.d.ts +5348 -2709
- package/dist/qti-components-jsx.js +1 -0
- package/dist/qti-condition-expression.d-aMvBvpc6.d.ts +8 -0
- package/dist/{qti-condition-expression-Dam-RER6.d.ts → qti-expression.d-BietT_8b.d.ts} +14 -9
- package/dist/{qti-feedback-ChmXhZuf.d.ts → qti-feedback.d-DZbad0RN.d.ts} +1 -1
- package/dist/{qti-transform-test-DoZaWItm.d.ts → qti-transform-test.d-BL7GGFJj.d.ts} +2 -2
- package/dist/response.d-_8y4kjGP.d.ts +106 -0
- package/dist/test.d.ts +199 -39
- package/dist/test.js +34 -11
- package/dist/transformers.d.ts +1 -1
- package/dist/transformers.js +1 -2
- package/package.json +24 -17
- package/custom-elements.json +0 -43251
- package/dist/chunk-3WBG257S.js.map +0 -1
- package/dist/chunk-3XV26R5M.js.map +0 -1
- package/dist/chunk-AQ5RJFM6.js +0 -3673
- package/dist/chunk-AQ5RJFM6.js.map +0 -1
- package/dist/chunk-HFCZFWSH.js.map +0 -1
- package/dist/chunk-MPC7LIPC.js.map +0 -1
- package/dist/chunk-QXBXORM3.js +0 -27
- package/dist/chunk-REI3AMCZ.js.map +0 -1
- package/dist/chunk-RLTYVS2I.js +0 -530
- package/dist/chunk-RLTYVS2I.js.map +0 -1
- package/dist/chunk-WDO2TRFM.js.map +0 -1
- package/dist/config.context-BjZ2bZSY.d.ts +0 -42
- package/dist/interaction-Bgzlw7Iu.d.ts +0 -110
- package/dist/item.context-CkUeDcaO.d.ts +0 -15
- package/dist/test.context-CByZZjkR.d.ts +0 -15
- /package/dist/{chunk-FLJAKWXL.js.map → chunk-X3E5HXG2.js.map} +0 -0
- /package/dist/{chunk-QXBXORM3.js.map → corrections.js.map} +0 -0
- /package/dist/{qti-rule-base-ajOnfGXY.d.ts → qti-rule-base.d-ajOnfGXY.d.ts} +0 -0
- /package/dist/{qti.context-CejJMlfZ.d.ts → qti.context.d-CejJMlfZ.d.ts} +0 -0
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
QtiModalFeedback
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WVVMNF74.js";
|
|
4
4
|
import {
|
|
5
5
|
item_default,
|
|
6
6
|
m
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-7HC5SMCU.js";
|
|
8
|
+
import {
|
|
9
|
+
watch
|
|
10
|
+
} from "./chunk-64XSIBGO.js";
|
|
8
11
|
import {
|
|
9
12
|
qtiTransformItem,
|
|
10
13
|
qtiTransformTest
|
|
11
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IJD53WY6.js";
|
|
12
15
|
import {
|
|
13
16
|
A,
|
|
17
|
+
E,
|
|
14
18
|
INITIAL_SESSION_CONTEXT,
|
|
15
19
|
INITIAL_TEST_CONTEXT,
|
|
20
|
+
QtiExpression,
|
|
16
21
|
T,
|
|
22
|
+
Z,
|
|
17
23
|
c,
|
|
18
24
|
computedContext,
|
|
19
25
|
configContext,
|
|
@@ -21,22 +27,339 @@ import {
|
|
|
21
27
|
i,
|
|
22
28
|
i2,
|
|
23
29
|
n,
|
|
30
|
+
n2,
|
|
24
31
|
qtiContext,
|
|
25
32
|
r,
|
|
26
33
|
sessionContext,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
testContext
|
|
35
|
+
} from "./chunk-H3J7LFRO.js";
|
|
36
|
+
|
|
37
|
+
// ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
|
|
38
|
+
var __decorate = function(decorators, target, key, desc) {
|
|
39
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
40
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
41
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
42
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
43
|
+
};
|
|
44
|
+
var stringToBooleanConverter = {
|
|
45
|
+
fromAttribute(value) {
|
|
46
|
+
return value === "true";
|
|
47
|
+
},
|
|
48
|
+
toAttribute(value) {
|
|
49
|
+
return value ? "true" : "false";
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var QtiAssessmentItemRef = class extends i2 {
|
|
53
|
+
constructor() {
|
|
54
|
+
super(...arguments);
|
|
55
|
+
this.weigths = /* @__PURE__ */ new Map();
|
|
56
|
+
}
|
|
57
|
+
createRenderRoot() {
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
get assessmentItem() {
|
|
61
|
+
return this.renderRoot?.querySelector("qti-assessment-item");
|
|
62
|
+
}
|
|
63
|
+
async connectedCallback() {
|
|
64
|
+
super.connectedCallback();
|
|
65
|
+
await this.updateComplete;
|
|
66
|
+
this.dispatchEvent(new CustomEvent("qti-assessment-item-ref-connected", {
|
|
67
|
+
bubbles: true,
|
|
68
|
+
composed: true,
|
|
69
|
+
detail: { identifier: this.identifier, href: this.href, category: this.category }
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return this.myTemplate ? this.myTemplate({ xmlDoc: this.xmlDoc }) : this.xmlDoc;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
__decorate([
|
|
77
|
+
n2({ type: String })
|
|
78
|
+
], QtiAssessmentItemRef.prototype, "category", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
n2({ type: String })
|
|
81
|
+
], QtiAssessmentItemRef.prototype, "identifier", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
n2({ type: Boolean, converter: stringToBooleanConverter })
|
|
84
|
+
], QtiAssessmentItemRef.prototype, "required", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
n2({ type: Boolean, converter: stringToBooleanConverter })
|
|
87
|
+
], QtiAssessmentItemRef.prototype, "fixed", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
n2({ type: String })
|
|
90
|
+
], QtiAssessmentItemRef.prototype, "href", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
n2({ type: Object, attribute: false })
|
|
93
|
+
], QtiAssessmentItemRef.prototype, "xmlDoc", void 0);
|
|
94
|
+
|
|
95
|
+
// ../qti-test/dist/components/qti-assessment-section/qti-assessment-section.js
|
|
96
|
+
var __decorate2 = function(decorators, target, key, desc) {
|
|
97
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
98
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
99
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
100
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
101
|
+
};
|
|
102
|
+
var stringToBooleanConverter2 = {
|
|
103
|
+
fromAttribute(value) {
|
|
104
|
+
return value === "true";
|
|
105
|
+
},
|
|
106
|
+
toAttribute(value) {
|
|
107
|
+
return value ? "true" : "false";
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
var QtiAssessmentSection = class extends i2 {
|
|
111
|
+
get title() {
|
|
112
|
+
return this.#title;
|
|
113
|
+
}
|
|
114
|
+
set title(value) {
|
|
115
|
+
this.#title = value;
|
|
116
|
+
this.removeAttribute("title");
|
|
117
|
+
this.setAttribute("data-title", value);
|
|
118
|
+
}
|
|
119
|
+
#title = "";
|
|
120
|
+
async connectedCallback() {
|
|
121
|
+
this.#title = this.getAttribute("title") || "";
|
|
122
|
+
super.connectedCallback();
|
|
123
|
+
await this.updateComplete;
|
|
124
|
+
this.dispatchEvent(new Event("qti-assessment-section-connected", {
|
|
125
|
+
bubbles: true,
|
|
126
|
+
composed: true
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
render() {
|
|
130
|
+
return T`<slot name="qti-rubric-block"></slot><slot></slot>`;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
__decorate2([
|
|
134
|
+
n2({ type: String })
|
|
135
|
+
], QtiAssessmentSection.prototype, "identifier", void 0);
|
|
136
|
+
__decorate2([
|
|
137
|
+
n2({ type: String })
|
|
138
|
+
], QtiAssessmentSection.prototype, "required", void 0);
|
|
139
|
+
__decorate2([
|
|
140
|
+
n2({ type: Boolean, converter: stringToBooleanConverter2 })
|
|
141
|
+
], QtiAssessmentSection.prototype, "fixed", void 0);
|
|
142
|
+
__decorate2([
|
|
143
|
+
n2({ type: Boolean, converter: stringToBooleanConverter2 })
|
|
144
|
+
], QtiAssessmentSection.prototype, "visible", void 0);
|
|
145
|
+
__decorate2([
|
|
146
|
+
n2({ type: Boolean, converter: stringToBooleanConverter2, attribute: "keep-together" })
|
|
147
|
+
], QtiAssessmentSection.prototype, "keepTogether", void 0);
|
|
148
|
+
__decorate2([
|
|
149
|
+
c({ context: testContext, subscribe: true })
|
|
150
|
+
], QtiAssessmentSection.prototype, "_testContext", void 0);
|
|
151
|
+
|
|
152
|
+
// ../qti-test/dist/components/qti-assessment-test/qti-assessment-test.js
|
|
153
|
+
var __decorate3 = function(decorators, target, key, desc) {
|
|
154
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
155
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
156
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
157
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
158
|
+
};
|
|
159
|
+
var QtiAssessmentTest = class extends i2 {
|
|
160
|
+
get title() {
|
|
161
|
+
return this.#title;
|
|
162
|
+
}
|
|
163
|
+
set title(value) {
|
|
164
|
+
this.#title = value;
|
|
165
|
+
this.removeAttribute("title");
|
|
166
|
+
this.setAttribute("data-title", value);
|
|
167
|
+
}
|
|
168
|
+
#title = "";
|
|
169
|
+
async connectedCallback() {
|
|
170
|
+
super.connectedCallback();
|
|
171
|
+
await this.updateComplete;
|
|
172
|
+
this.dispatchEvent(new CustomEvent("qti-assessment-test-connected", {
|
|
173
|
+
detail: this,
|
|
174
|
+
bubbles: true,
|
|
175
|
+
composed: true
|
|
176
|
+
}));
|
|
177
|
+
}
|
|
178
|
+
render() {
|
|
179
|
+
return T` <slot></slot>`;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
__decorate3([
|
|
183
|
+
n2({ type: String })
|
|
184
|
+
], QtiAssessmentTest.prototype, "identifier", void 0);
|
|
185
|
+
__decorate3([
|
|
186
|
+
n2({ type: String })
|
|
187
|
+
], QtiAssessmentTest.prototype, "title", null);
|
|
188
|
+
__decorate3([
|
|
189
|
+
c({ context: testContext, subscribe: true })
|
|
190
|
+
], QtiAssessmentTest.prototype, "_testContext", void 0);
|
|
191
|
+
|
|
192
|
+
// ../qti-test/dist/components/qti-outcome-processing/qti-outcome-processing.js
|
|
193
|
+
var QtiOutcomeProcessing = class extends i2 {
|
|
194
|
+
static {
|
|
195
|
+
this.styles = [
|
|
196
|
+
i`
|
|
197
|
+
:host {
|
|
198
|
+
display: none;
|
|
199
|
+
}
|
|
200
|
+
`
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
render() {
|
|
204
|
+
return T`<slot></slot>`;
|
|
205
|
+
}
|
|
206
|
+
process() {
|
|
207
|
+
const logic = new QtiOutcomeProcessingProcessor();
|
|
208
|
+
const rules = [...this.children];
|
|
209
|
+
logic.process(rules);
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
var QtiOutcomeProcessingProcessor = class {
|
|
213
|
+
process(rules) {
|
|
214
|
+
for (const rule of rules) {
|
|
215
|
+
rule.process();
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// ../qti-test/dist/components/qti-test-feedback/qti-test-feedback.js
|
|
221
|
+
var QtiTestFeedback = class extends QtiModalFeedback {
|
|
222
|
+
static {
|
|
223
|
+
this.styles = i`
|
|
224
|
+
:host {
|
|
225
|
+
color: gray;
|
|
226
|
+
}
|
|
227
|
+
`;
|
|
228
|
+
}
|
|
229
|
+
render() {
|
|
230
|
+
return T``;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
// ../qti-test/dist/components/qti-test-part/qti-test-part.js
|
|
235
|
+
var __decorate4 = function(decorators, target, key, desc) {
|
|
236
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
237
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
238
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
239
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
240
|
+
};
|
|
241
|
+
var QtiTestPart = class extends i2 {
|
|
242
|
+
constructor() {
|
|
243
|
+
super(...arguments);
|
|
244
|
+
this.identifier = "";
|
|
245
|
+
this.class = "";
|
|
246
|
+
this.navigationMode = "nonlinear";
|
|
247
|
+
this.submissionMode = "individual";
|
|
248
|
+
this.#title = "";
|
|
249
|
+
}
|
|
250
|
+
get title() {
|
|
251
|
+
return this.#title;
|
|
252
|
+
}
|
|
253
|
+
set title(value) {
|
|
254
|
+
this.#title = value;
|
|
255
|
+
this.removeAttribute("title");
|
|
256
|
+
this.setAttribute("data-title", value);
|
|
257
|
+
}
|
|
258
|
+
#title;
|
|
259
|
+
async connectedCallback() {
|
|
260
|
+
super.connectedCallback();
|
|
261
|
+
await this.updateComplete;
|
|
262
|
+
this.dispatchEvent(new Event("qti-test-part-connected", {
|
|
263
|
+
bubbles: true,
|
|
264
|
+
composed: true
|
|
265
|
+
}));
|
|
266
|
+
}
|
|
267
|
+
render() {
|
|
268
|
+
return T` <slot></slot>`;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
__decorate4([
|
|
272
|
+
n2({ type: String })
|
|
273
|
+
], QtiTestPart.prototype, "identifier", void 0);
|
|
274
|
+
__decorate4([
|
|
275
|
+
n2({ type: String })
|
|
276
|
+
], QtiTestPart.prototype, "class", void 0);
|
|
277
|
+
__decorate4([
|
|
278
|
+
n2({ type: String, attribute: "navigation-mode" })
|
|
279
|
+
], QtiTestPart.prototype, "navigationMode", void 0);
|
|
280
|
+
__decorate4([
|
|
281
|
+
n2({ type: String, attribute: "submission-mode" })
|
|
282
|
+
], QtiTestPart.prototype, "submissionMode", void 0);
|
|
283
|
+
|
|
284
|
+
// ../qti-test/dist/components/qti-test-variables/qti-test-variables.js
|
|
285
|
+
var __decorate5 = function(decorators, target, key, desc) {
|
|
286
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
287
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
288
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
289
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
290
|
+
};
|
|
291
|
+
var QtiTestVariables = class extends QtiExpression {
|
|
292
|
+
#testElement;
|
|
293
|
+
constructor() {
|
|
294
|
+
super();
|
|
295
|
+
this.addEventListener("qti-assessment-test-connected", (e2) => this.#testElement = e2.detail);
|
|
296
|
+
}
|
|
297
|
+
getResult() {
|
|
298
|
+
const includedCategories = this.getAttribute("include-category")?.split(" ") ?? [];
|
|
299
|
+
const excludedCategories = this.getAttribute("exclude-category")?.split(" ") ?? [];
|
|
300
|
+
const weightIdentifier = this.getAttribute("weight-identifier") ?? "";
|
|
301
|
+
const itemVariable = this.getAttribute("variable-identifier");
|
|
302
|
+
const itemRefEls = Array.from(this.#testElement.querySelectorAll(`qti-asssessment-test qti-assessment-item-ref`));
|
|
303
|
+
const includedItems = itemRefEls.filter((itemRef) => {
|
|
304
|
+
let include = true;
|
|
305
|
+
if (includedCategories.length > 0) {
|
|
306
|
+
include = includedCategories.includes(itemRef.category);
|
|
307
|
+
}
|
|
308
|
+
if (excludedCategories.length > 0) {
|
|
309
|
+
include = !excludedCategories.includes(itemRef.category);
|
|
310
|
+
}
|
|
311
|
+
return include;
|
|
312
|
+
}).map((itemRef) => {
|
|
313
|
+
let weight = 1;
|
|
314
|
+
if (weightIdentifier) {
|
|
315
|
+
const weightVariable = itemRef.weigths.get(weightIdentifier);
|
|
316
|
+
if (weightVariable !== null && weightVariable !== void 0) {
|
|
317
|
+
weight = weightVariable;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return { item: itemRef.identifier, weight };
|
|
321
|
+
});
|
|
322
|
+
const logic = new QtiTestVariablesExpression(this._testContext, itemVariable, includedItems);
|
|
323
|
+
const value = logic.calculate();
|
|
324
|
+
return value;
|
|
325
|
+
}
|
|
326
|
+
calculate() {
|
|
327
|
+
return this.getResult();
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
__decorate5([
|
|
331
|
+
c({ context: testContext, subscribe: true })
|
|
332
|
+
], QtiTestVariables.prototype, "_testContext", void 0);
|
|
333
|
+
var QtiTestVariablesExpression = class {
|
|
334
|
+
constructor(testContext2, itemVariable, includedItems) {
|
|
335
|
+
this.testContext = testContext2;
|
|
336
|
+
this.itemVariable = itemVariable;
|
|
337
|
+
this.includedItems = includedItems;
|
|
338
|
+
}
|
|
339
|
+
calculate() {
|
|
340
|
+
const { items } = this.testContext;
|
|
341
|
+
let total = 0;
|
|
342
|
+
const uniqueItems = [...new Set(this.includedItems.map((item) => item.item))];
|
|
343
|
+
items.forEach((item) => {
|
|
344
|
+
if (uniqueItems.includes(item.identifier)) {
|
|
345
|
+
const variable = item.variables.find((vr) => vr.identifier === this.itemVariable);
|
|
346
|
+
const weight = this.includedItems.find((i4) => i4.item === item.identifier)?.weight ?? 1;
|
|
347
|
+
if (variable) {
|
|
348
|
+
total += Number(variable.value) * weight;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
return total;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
38
355
|
|
|
39
|
-
// ../qti-test/
|
|
356
|
+
// ../qti-test/dist/mixins/test-navigation.mixin.js
|
|
357
|
+
var __decorate6 = function(decorators, target, key, desc) {
|
|
358
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
359
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
360
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
361
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
362
|
+
};
|
|
40
363
|
var TestNavigationMixin = (superClass) => {
|
|
41
364
|
class TestNavigationClass extends superClass {
|
|
42
365
|
constructor(...args) {
|
|
@@ -45,11 +368,9 @@ var TestNavigationMixin = (superClass) => {
|
|
|
45
368
|
this.requestTimeout = 3e4;
|
|
46
369
|
this.postLoadTransformCallback = null;
|
|
47
370
|
this.postLoadTestTransformCallback = null;
|
|
48
|
-
// Navigation state tracking
|
|
49
371
|
this._activeController = null;
|
|
50
372
|
this._loadResults = [];
|
|
51
373
|
this._navigationId = 0;
|
|
52
|
-
// Simple loading progress tracking
|
|
53
374
|
this._loadingState = {
|
|
54
375
|
expectedItems: 0,
|
|
55
376
|
connectedItems: 0,
|
|
@@ -57,7 +378,6 @@ var TestNavigationMixin = (superClass) => {
|
|
|
57
378
|
loadedStimulus: 0,
|
|
58
379
|
isComplete: false
|
|
59
380
|
};
|
|
60
|
-
// Track loaded/loading stimulus hrefs to prevent duplicates
|
|
61
381
|
this._loadedStimulusHrefs = /* @__PURE__ */ new Set();
|
|
62
382
|
this._loadingStimulusHrefs = /* @__PURE__ */ new Set();
|
|
63
383
|
this._bindEventHandlers();
|
|
@@ -73,13 +393,11 @@ var TestNavigationMixin = (superClass) => {
|
|
|
73
393
|
navigateTo(type, id) {
|
|
74
394
|
const targetId = id || this._getDefaultNavigationId(type);
|
|
75
395
|
if (targetId) {
|
|
76
|
-
this.dispatchEvent(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
82
|
-
);
|
|
396
|
+
this.dispatchEvent(new CustomEvent("qti-request-navigation", {
|
|
397
|
+
detail: { type, id: targetId },
|
|
398
|
+
bubbles: true,
|
|
399
|
+
composed: true
|
|
400
|
+
}));
|
|
83
401
|
}
|
|
84
402
|
}
|
|
85
403
|
// ===========================================
|
|
@@ -91,15 +409,15 @@ var TestNavigationMixin = (superClass) => {
|
|
|
91
409
|
this.addEventListener("qti-assessment-item-connected", this._handleItemConnected.bind(this));
|
|
92
410
|
this.addEventListener("qti-assessment-stimulus-ref-connected", this._handleStimulusRefConnected.bind(this));
|
|
93
411
|
}
|
|
94
|
-
_handleTestConnected(
|
|
95
|
-
this._testElement =
|
|
412
|
+
_handleTestConnected(e2) {
|
|
413
|
+
this._testElement = e2.detail;
|
|
96
414
|
this._initializeNavigation();
|
|
97
415
|
}
|
|
98
416
|
/**
|
|
99
417
|
* Handle item connection events - track connected items and discover stimulus references
|
|
100
418
|
*/
|
|
101
|
-
_handleItemConnected(
|
|
102
|
-
const itemRef =
|
|
419
|
+
_handleItemConnected(e2) {
|
|
420
|
+
const itemRef = e2.detail;
|
|
103
421
|
this._loadingState.connectedItems++;
|
|
104
422
|
const stimulusRefs = itemRef.querySelectorAll("qti-assessment-stimulus-ref");
|
|
105
423
|
this._loadingState.expectedStimulus += stimulusRefs.length;
|
|
@@ -108,9 +426,9 @@ var TestNavigationMixin = (superClass) => {
|
|
|
108
426
|
/**
|
|
109
427
|
* Handle stimulus reference connection events with duplicate prevention
|
|
110
428
|
*/
|
|
111
|
-
async _handleStimulusRefConnected(
|
|
112
|
-
|
|
113
|
-
const { element, item } =
|
|
429
|
+
async _handleStimulusRefConnected(e2) {
|
|
430
|
+
e2.preventDefault();
|
|
431
|
+
const { element, item } = e2;
|
|
114
432
|
console.info("Stimulus ref connected:", {
|
|
115
433
|
identifier: element.identifier,
|
|
116
434
|
href: element.href,
|
|
@@ -156,7 +474,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
156
474
|
return this.sessionContext?.navItemRefId ?? this._testElement?.querySelector("qti-assessment-item-ref")?.identifier;
|
|
157
475
|
}
|
|
158
476
|
_initializeNavigation() {
|
|
159
|
-
if (!this.navigate)
|
|
477
|
+
if (!this.navigate)
|
|
478
|
+
return;
|
|
160
479
|
const id = this._getDefaultNavigationId(this.navigate);
|
|
161
480
|
if (id) {
|
|
162
481
|
this.navigateTo(this.navigate, id);
|
|
@@ -166,7 +485,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
166
485
|
* Main navigation request handler with proper lifecycle management
|
|
167
486
|
*/
|
|
168
487
|
async _handleNavigationRequest({ detail }) {
|
|
169
|
-
if (!detail?.id)
|
|
488
|
+
if (!detail?.id)
|
|
489
|
+
return;
|
|
170
490
|
this._cancelPreviousNavigation();
|
|
171
491
|
const navigationId = ++this._navigationId;
|
|
172
492
|
const controller = new AbortController();
|
|
@@ -205,7 +525,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
205
525
|
this._loadingState.expectedItems = 1;
|
|
206
526
|
await this._loadItems([itemId], navigationId, controller);
|
|
207
527
|
await this._waitForLoadingComplete(navigationId, controller);
|
|
208
|
-
if (this._isStaleNavigation(navigationId, controller))
|
|
528
|
+
if (this._isStaleNavigation(navigationId, controller))
|
|
529
|
+
return;
|
|
209
530
|
this._dispatchTestLoaded(this._loadResults);
|
|
210
531
|
}
|
|
211
532
|
/**
|
|
@@ -225,7 +546,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
225
546
|
this._loadingState.expectedItems = itemIds.length;
|
|
226
547
|
await this._loadItems(itemIds, navigationId, controller);
|
|
227
548
|
await this._waitForLoadingComplete(navigationId, controller);
|
|
228
|
-
if (this._isStaleNavigation(navigationId, controller))
|
|
549
|
+
if (this._isStaleNavigation(navigationId, controller))
|
|
550
|
+
return;
|
|
229
551
|
this._dispatchTestLoaded(this._loadResults);
|
|
230
552
|
}
|
|
231
553
|
// ===========================================
|
|
@@ -260,7 +582,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
260
582
|
*/
|
|
261
583
|
async _waitForLoadingComplete(navigationId, controller) {
|
|
262
584
|
while (!this._loadingState.isComplete) {
|
|
263
|
-
if (this._isStaleNavigation(navigationId, controller))
|
|
585
|
+
if (this._isStaleNavigation(navigationId, controller))
|
|
586
|
+
return;
|
|
264
587
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
265
588
|
}
|
|
266
589
|
}
|
|
@@ -339,24 +662,30 @@ var TestNavigationMixin = (superClass) => {
|
|
|
339
662
|
* Load items with simple tracking
|
|
340
663
|
*/
|
|
341
664
|
async _loadItems(itemIds, navigationId, controller) {
|
|
342
|
-
if (!this._testElement || itemIds.length === 0)
|
|
665
|
+
if (!this._testElement || itemIds.length === 0)
|
|
666
|
+
return;
|
|
343
667
|
const itemRefs = itemIds.map((id) => this._findItemRef(id));
|
|
344
668
|
this._clearLoadedItems();
|
|
345
669
|
this._clearStimulusRef();
|
|
346
670
|
const results = await Promise.all(itemRefs.map((ref) => this._loadSingleItem(ref, navigationId, controller)));
|
|
347
671
|
const validResults = results.filter(Boolean);
|
|
348
|
-
if (this._isStaleNavigation(navigationId, controller))
|
|
672
|
+
if (this._isStaleNavigation(navigationId, controller))
|
|
673
|
+
return;
|
|
349
674
|
validResults.forEach(({ itemRef, doc }) => {
|
|
350
|
-
if (itemRef && doc)
|
|
675
|
+
if (itemRef && doc)
|
|
676
|
+
itemRef.xmlDoc = doc;
|
|
351
677
|
});
|
|
352
678
|
validResults.forEach(({ itemRef }) => {
|
|
353
679
|
const itemId = itemRef?.identifier;
|
|
354
|
-
if (!itemRef || !itemId)
|
|
355
|
-
|
|
356
|
-
|
|
680
|
+
if (!itemRef || !itemId)
|
|
681
|
+
return;
|
|
682
|
+
const savedState = this.testContext.items.find((i4) => i4.identifier === itemId)?.state;
|
|
683
|
+
if (savedState === void 0)
|
|
684
|
+
return;
|
|
357
685
|
itemRef.updateComplete.then(() => {
|
|
358
686
|
const assessmentItem = itemRef.assessmentItem;
|
|
359
|
-
if (!assessmentItem)
|
|
687
|
+
if (!assessmentItem)
|
|
688
|
+
return;
|
|
360
689
|
assessmentItem.state = savedState;
|
|
361
690
|
});
|
|
362
691
|
});
|
|
@@ -372,7 +701,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
372
701
|
if (this._isStaleNavigation(navigationId, controller)) {
|
|
373
702
|
return null;
|
|
374
703
|
}
|
|
375
|
-
return { itemRef, doc: transformer.htmlDoc() };
|
|
704
|
+
return { itemRef, doc: transformer.htmlDoc(this._customElementRegistry()) };
|
|
376
705
|
} catch (error) {
|
|
377
706
|
if (error.name === "AbortError") {
|
|
378
707
|
console.info(`Item load for ${itemRef.identifier} was aborted`);
|
|
@@ -384,15 +713,19 @@ var TestNavigationMixin = (superClass) => {
|
|
|
384
713
|
}
|
|
385
714
|
async _loadStimulus(href) {
|
|
386
715
|
const transformer = await qtiTransformItem().load(href, this._activeController?.signal);
|
|
387
|
-
return transformer.htmlDoc();
|
|
716
|
+
return transformer.htmlDoc(this._customElementRegistry());
|
|
717
|
+
}
|
|
718
|
+
_customElementRegistry() {
|
|
719
|
+
const container = this.querySelector("test-container");
|
|
720
|
+
if (!container)
|
|
721
|
+
return void 0;
|
|
722
|
+
return container.customElementRegistry ?? void 0;
|
|
388
723
|
}
|
|
389
724
|
// ===========================================
|
|
390
725
|
// UTILITIES
|
|
391
726
|
// ===========================================
|
|
392
727
|
_findItemRef(itemId) {
|
|
393
|
-
const itemRef = this._testElement?.querySelector(
|
|
394
|
-
`qti-assessment-item-ref[identifier="${itemId}"]`
|
|
395
|
-
);
|
|
728
|
+
const itemRef = this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${itemId}"]`);
|
|
396
729
|
if (!itemRef) {
|
|
397
730
|
throw new Error(`Item with identifier "${itemId}" not found`);
|
|
398
731
|
}
|
|
@@ -412,11 +745,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
412
745
|
};
|
|
413
746
|
}
|
|
414
747
|
_getSectionItemIds(sectionId) {
|
|
415
|
-
return Array.from(
|
|
416
|
-
this._testElement.querySelectorAll(
|
|
417
|
-
`qti-assessment-section[identifier="${sectionId}"] > qti-assessment-item-ref`
|
|
418
|
-
)
|
|
419
|
-
).map((ref) => ref.identifier).filter(Boolean);
|
|
748
|
+
return Array.from(this._testElement.querySelectorAll(`qti-assessment-section[identifier="${sectionId}"] > qti-assessment-item-ref`)).map((ref) => ref.identifier).filter(Boolean);
|
|
420
749
|
}
|
|
421
750
|
_clearLoadedItems() {
|
|
422
751
|
const itemRefs = this._testElement?.querySelectorAll("qti-assessment-item-ref");
|
|
@@ -442,78 +771,70 @@ var TestNavigationMixin = (superClass) => {
|
|
|
442
771
|
// EVENT DISPATCHING
|
|
443
772
|
// ===========================================
|
|
444
773
|
_dispatchLoadingStarted(type, id) {
|
|
445
|
-
this.dispatchEvent(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
})
|
|
451
|
-
);
|
|
774
|
+
this.dispatchEvent(new CustomEvent("qti-navigation-loading-started", {
|
|
775
|
+
detail: { type, id },
|
|
776
|
+
bubbles: true,
|
|
777
|
+
composed: true
|
|
778
|
+
}));
|
|
452
779
|
}
|
|
453
780
|
_dispatchLoadingEnded(type, id) {
|
|
454
|
-
this.dispatchEvent(
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
})
|
|
460
|
-
);
|
|
781
|
+
this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended", {
|
|
782
|
+
detail: { type, id },
|
|
783
|
+
bubbles: true,
|
|
784
|
+
composed: true
|
|
785
|
+
}));
|
|
461
786
|
}
|
|
462
787
|
_dispatchError(error) {
|
|
463
|
-
this.dispatchEvent(
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
})
|
|
469
|
-
);
|
|
788
|
+
this.dispatchEvent(new CustomEvent("qti-navigation-error", {
|
|
789
|
+
detail: error,
|
|
790
|
+
bubbles: true,
|
|
791
|
+
composed: true
|
|
792
|
+
}));
|
|
470
793
|
}
|
|
471
794
|
_dispatchTestLoaded(results) {
|
|
472
795
|
requestAnimationFrame(() => {
|
|
473
|
-
this.dispatchEvent(
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
})
|
|
482
|
-
);
|
|
796
|
+
this.dispatchEvent(new CustomEvent("qti-test-loaded", {
|
|
797
|
+
detail: results.map(({ itemRef }) => ({
|
|
798
|
+
identifier: itemRef?.identifier,
|
|
799
|
+
element: itemRef
|
|
800
|
+
})),
|
|
801
|
+
bubbles: true,
|
|
802
|
+
composed: true
|
|
803
|
+
}));
|
|
483
804
|
});
|
|
484
805
|
}
|
|
485
806
|
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
], TestNavigationClass.prototype, "navigate",
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
], TestNavigationClass.prototype, "requestTimeout",
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
], TestNavigationClass.prototype, "postLoadTransformCallback",
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
], TestNavigationClass.prototype, "postLoadTestTransformCallback",
|
|
807
|
+
__decorate6([
|
|
808
|
+
n2({ type: String })
|
|
809
|
+
], TestNavigationClass.prototype, "navigate", void 0);
|
|
810
|
+
__decorate6([
|
|
811
|
+
n2({ type: Number })
|
|
812
|
+
], TestNavigationClass.prototype, "requestTimeout", void 0);
|
|
813
|
+
__decorate6([
|
|
814
|
+
n2({ attribute: false })
|
|
815
|
+
], TestNavigationClass.prototype, "postLoadTransformCallback", void 0);
|
|
816
|
+
__decorate6([
|
|
817
|
+
n2({ attribute: false })
|
|
818
|
+
], TestNavigationClass.prototype, "postLoadTestTransformCallback", void 0);
|
|
498
819
|
return TestNavigationClass;
|
|
499
820
|
};
|
|
500
821
|
|
|
501
|
-
// ../qti-test/
|
|
822
|
+
// ../qti-test/dist/mixins/test-view.mixin.js
|
|
502
823
|
var TestViewMixin = (superClass) => {
|
|
503
824
|
class TestViewClass extends superClass {
|
|
504
825
|
constructor(...args) {
|
|
505
826
|
super(...args);
|
|
506
827
|
this.sessionContext = { ...this.sessionContext, view: "candidate" };
|
|
507
|
-
this.addEventListener("on-test-switch-view", (
|
|
508
|
-
this.sessionContext = { ...this.sessionContext, view:
|
|
828
|
+
this.addEventListener("on-test-switch-view", (e2) => {
|
|
829
|
+
this.sessionContext = { ...this.sessionContext, view: e2.detail };
|
|
509
830
|
this._updateElementView();
|
|
510
831
|
});
|
|
511
832
|
this.addEventListener("qti-assessment-test-connected", () => {
|
|
512
833
|
this._updateElementView();
|
|
513
834
|
});
|
|
514
|
-
this.addEventListener("qti-assessment-item-connected", (
|
|
835
|
+
this.addEventListener("qti-assessment-item-connected", (e2) => {
|
|
515
836
|
this._updateElementView();
|
|
516
|
-
this._setCorrectResponseVisibility(
|
|
837
|
+
this._setCorrectResponseVisibility(e2.detail);
|
|
517
838
|
});
|
|
518
839
|
}
|
|
519
840
|
willUpdate(changedProperties) {
|
|
@@ -529,44 +850,41 @@ var TestViewMixin = (superClass) => {
|
|
|
529
850
|
viewElements.forEach((element) => {
|
|
530
851
|
element.classList.toggle("show", element.getAttribute("view") === this.sessionContext.view);
|
|
531
852
|
});
|
|
532
|
-
const assessmentItemRef = this._testElement.querySelector(
|
|
533
|
-
`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`
|
|
534
|
-
);
|
|
853
|
+
const assessmentItemRef = this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`);
|
|
535
854
|
const assessmentItem = assessmentItemRef?.assessmentItem;
|
|
536
|
-
if (assessmentItem)
|
|
537
|
-
|
|
538
|
-
}
|
|
855
|
+
if (assessmentItem)
|
|
856
|
+
this.updateAssessmentItemView(assessmentItem, this.sessionContext.view);
|
|
539
857
|
}
|
|
540
858
|
}
|
|
541
859
|
// Event handler for connected QTI assessment items
|
|
542
860
|
_setCorrectResponseVisibility(assessmentItem) {
|
|
543
|
-
|
|
861
|
+
this.updateAssessmentItemView(assessmentItem, this.sessionContext.view);
|
|
862
|
+
}
|
|
863
|
+
/** Extension point for packages that add view-dependent assessment presentation. */
|
|
864
|
+
updateAssessmentItemView(_assessmentItem, _view) {
|
|
544
865
|
}
|
|
545
866
|
}
|
|
546
867
|
return TestViewClass;
|
|
547
868
|
};
|
|
548
869
|
|
|
549
|
-
// ../qti-test/
|
|
870
|
+
// ../qti-test/dist/mixins/test-base.js
|
|
871
|
+
var __decorate7 = function(decorators, target, key, desc) {
|
|
872
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
873
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
874
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
875
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
876
|
+
};
|
|
550
877
|
var TestBaseMixin = (superClass) => {
|
|
551
878
|
class TestBaseClass extends superClass {
|
|
552
879
|
constructor(...args) {
|
|
553
880
|
super(...args);
|
|
554
881
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
555
882
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
556
|
-
/**
|
|
557
|
-
* Updates the variables of an assessment item in the test context.
|
|
558
|
-
* - Matches the assessment item with the corresponding test context item.
|
|
559
|
-
* - If the item is not found, logs a warning.
|
|
560
|
-
* - Updates variables in the test context if exactly one variable exists.
|
|
561
|
-
* - Otherwise, syncs the assessment item's variables with the test context.
|
|
562
|
-
*
|
|
563
|
-
* @param assessmentItem - The assessment item to update.
|
|
564
|
-
*/
|
|
565
883
|
this._updateItemInTestContext = (assessmentItem) => {
|
|
566
884
|
const context = assessmentItem._context;
|
|
567
885
|
const identifier = context.identifier;
|
|
568
886
|
const fullVariables = context.variables;
|
|
569
|
-
const itemContext = this.testContext.items.find((
|
|
887
|
+
const itemContext = this.testContext.items.find((i4) => i4?.identifier === identifier);
|
|
570
888
|
if (!itemContext) {
|
|
571
889
|
console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);
|
|
572
890
|
return;
|
|
@@ -576,7 +894,7 @@ var TestBaseMixin = (superClass) => {
|
|
|
576
894
|
} else {
|
|
577
895
|
const newVariables = [...assessmentItem.variables];
|
|
578
896
|
for (const variable of itemContext.variables) {
|
|
579
|
-
const currentVariable = newVariables.find((
|
|
897
|
+
const currentVariable = newVariables.find((v) => v.identifier === variable.identifier);
|
|
580
898
|
if (currentVariable) {
|
|
581
899
|
currentVariable.value = variable.value;
|
|
582
900
|
} else {
|
|
@@ -592,23 +910,22 @@ var TestBaseMixin = (superClass) => {
|
|
|
592
910
|
const itemContext = this.testContext.items.find((item) => item.identifier === itemRefID);
|
|
593
911
|
if (itemContext) {
|
|
594
912
|
itemContext.variables = itemContext.variables.map((variable) => {
|
|
595
|
-
const updatedVariable = variables.find((
|
|
913
|
+
const updatedVariable = variables.find((v) => v.identifier === variable.identifier);
|
|
596
914
|
return updatedVariable ? { ...variable, ...updatedVariable } : variable;
|
|
597
915
|
});
|
|
598
916
|
}
|
|
599
|
-
const itemRef = this._testElement.querySelector(
|
|
600
|
-
`qti-assessment-item-ref[identifier="${itemRefID}"]`
|
|
601
|
-
);
|
|
917
|
+
const itemRef = this._testElement.querySelector(`qti-assessment-item-ref[identifier="${itemRefID}"]`);
|
|
602
918
|
if (itemRef && itemRef.assessmentItem) {
|
|
603
919
|
itemRef.assessmentItem.variables = variables;
|
|
604
920
|
}
|
|
605
921
|
}
|
|
606
922
|
_initializeEventListeners() {
|
|
607
|
-
this.addEventListener("qti-assessment-test-connected", (
|
|
923
|
+
this.addEventListener("qti-assessment-test-connected", (e2) => {
|
|
608
924
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
609
925
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
610
|
-
if (this.testContext && this.testContext.items.length > 0)
|
|
611
|
-
|
|
926
|
+
if (this.testContext && this.testContext.items.length > 0)
|
|
927
|
+
return;
|
|
928
|
+
this._testElement = e2.detail;
|
|
612
929
|
const items = Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map((itemRef) => {
|
|
613
930
|
return {
|
|
614
931
|
href: itemRef.href,
|
|
@@ -625,20 +942,16 @@ var TestBaseMixin = (superClass) => {
|
|
|
625
942
|
});
|
|
626
943
|
this.testContext = { ...this.testContext, items };
|
|
627
944
|
});
|
|
628
|
-
this.addEventListener("qti-assessment-item-connected", (
|
|
629
|
-
const assessmentItem =
|
|
945
|
+
this.addEventListener("qti-assessment-item-connected", (e2) => {
|
|
946
|
+
const assessmentItem = e2.detail;
|
|
630
947
|
const assessmentRefId = assessmentItem.closest("qti-assessment-item-ref")?.identifier;
|
|
631
948
|
if (assessmentRefId) {
|
|
632
949
|
assessmentItem.assessmentItemRefId = assessmentRefId;
|
|
633
950
|
}
|
|
634
|
-
this._updateItemInTestContext(
|
|
951
|
+
this._updateItemInTestContext(e2.detail);
|
|
635
952
|
});
|
|
636
|
-
this.addEventListener("qti-item-context-updated", (
|
|
637
|
-
this._updateItemVariablesInTestContext(
|
|
638
|
-
e3.detail.itemContext.identifier,
|
|
639
|
-
e3.detail.itemContext.variables,
|
|
640
|
-
e3.detail.itemContext.state
|
|
641
|
-
);
|
|
953
|
+
this.addEventListener("qti-item-context-updated", (e2) => {
|
|
954
|
+
this._updateItemVariablesInTestContext(e2.detail.itemContext.identifier, e2.detail.itemContext.variables, e2.detail.itemContext.state);
|
|
642
955
|
});
|
|
643
956
|
}
|
|
644
957
|
_updateItemVariablesInTestContext(identifier, variables, state) {
|
|
@@ -653,55 +966,51 @@ var TestBaseMixin = (superClass) => {
|
|
|
653
966
|
...itemContext,
|
|
654
967
|
// Keep other properties of the item context
|
|
655
968
|
variables: variables.map((variable) => {
|
|
656
|
-
const matchingVariable = itemContext.variables.find((
|
|
969
|
+
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
657
970
|
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
658
971
|
}),
|
|
659
972
|
...state !== void 0 ? { state: state ? { ...state } : void 0 } : {}
|
|
660
973
|
};
|
|
661
974
|
})
|
|
662
975
|
};
|
|
663
|
-
this.dispatchEvent(
|
|
664
|
-
new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false })
|
|
665
|
-
);
|
|
976
|
+
this.dispatchEvent(new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false }));
|
|
666
977
|
}
|
|
667
978
|
}
|
|
668
|
-
|
|
669
|
-
|
|
979
|
+
__decorate7([
|
|
980
|
+
n2({ attribute: false, type: Object }),
|
|
670
981
|
e({ context: testContext })
|
|
671
|
-
], TestBaseClass.prototype, "testContext",
|
|
672
|
-
|
|
673
|
-
|
|
982
|
+
], TestBaseClass.prototype, "testContext", void 0);
|
|
983
|
+
__decorate7([
|
|
984
|
+
n2({ attribute: false, type: Object }),
|
|
674
985
|
e({ context: sessionContext })
|
|
675
|
-
], TestBaseClass.prototype, "sessionContext",
|
|
986
|
+
], TestBaseClass.prototype, "sessionContext", void 0);
|
|
676
987
|
return TestBaseClass;
|
|
677
988
|
};
|
|
678
989
|
var TestBase = class extends TestBaseMixin(i2) {
|
|
679
990
|
};
|
|
680
991
|
|
|
681
|
-
// ../qti-test/
|
|
992
|
+
// ../qti-test/dist/mixins/test-processing.mixin.js
|
|
682
993
|
var TestProcessingMixin = (superClass) => {
|
|
683
994
|
class TestProcessingElement extends superClass {
|
|
684
995
|
constructor(...args) {
|
|
685
996
|
super(...args);
|
|
686
|
-
this.addEventListener("qti-register-variable", (
|
|
997
|
+
this.addEventListener("qti-register-variable", (e2) => {
|
|
687
998
|
this.testContext = {
|
|
688
999
|
...this.testContext,
|
|
689
|
-
testOutcomeVariables: [...this.testContext.testOutcomeVariables || [],
|
|
1000
|
+
testOutcomeVariables: [...this.testContext.testOutcomeVariables || [], e2.detail.variable]
|
|
690
1001
|
};
|
|
691
|
-
|
|
1002
|
+
e2.stopPropagation();
|
|
1003
|
+
});
|
|
1004
|
+
this.addEventListener("qti-set-outcome-value", (e2) => {
|
|
1005
|
+
const { outcomeIdentifier, value } = e2.detail;
|
|
1006
|
+
this.updateOutcomeVariable(outcomeIdentifier, value);
|
|
1007
|
+
e2.stopPropagation();
|
|
692
1008
|
});
|
|
693
|
-
this.addEventListener(
|
|
694
|
-
"qti-set-outcome-value",
|
|
695
|
-
(e3) => {
|
|
696
|
-
const { outcomeIdentifier, value } = e3.detail;
|
|
697
|
-
this.updateOutcomeVariable(outcomeIdentifier, value);
|
|
698
|
-
e3.stopPropagation();
|
|
699
|
-
}
|
|
700
|
-
);
|
|
701
1009
|
}
|
|
702
1010
|
outcomeProcessing() {
|
|
703
1011
|
const outcomeProcessor = this.querySelector("qti-outcome-processing");
|
|
704
|
-
if (!outcomeProcessor)
|
|
1012
|
+
if (!outcomeProcessor)
|
|
1013
|
+
return false;
|
|
705
1014
|
outcomeProcessor?.process();
|
|
706
1015
|
return true;
|
|
707
1016
|
}
|
|
@@ -714,13 +1023,13 @@ var TestProcessingMixin = (superClass) => {
|
|
|
714
1023
|
}
|
|
715
1024
|
this.testContext = {
|
|
716
1025
|
...this.testContext,
|
|
717
|
-
testOutcomeVariables: this.testContext.testOutcomeVariables?.map((
|
|
718
|
-
if (
|
|
719
|
-
return
|
|
1026
|
+
testOutcomeVariables: this.testContext.testOutcomeVariables?.map((v) => {
|
|
1027
|
+
if (v.identifier !== identifier) {
|
|
1028
|
+
return v;
|
|
720
1029
|
}
|
|
721
1030
|
return {
|
|
722
|
-
...
|
|
723
|
-
value: outcomeVariable.cardinality === "single" ? value : [...
|
|
1031
|
+
...v,
|
|
1032
|
+
value: outcomeVariable.cardinality === "single" ? value : [...v.value, value]
|
|
724
1033
|
};
|
|
725
1034
|
})
|
|
726
1035
|
};
|
|
@@ -729,14 +1038,19 @@ var TestProcessingMixin = (superClass) => {
|
|
|
729
1038
|
return this.getVariable(identifier);
|
|
730
1039
|
}
|
|
731
1040
|
getVariable(identifier) {
|
|
732
|
-
return this.testContext.testOutcomeVariables?.find((
|
|
1041
|
+
return this.testContext.testOutcomeVariables?.find((v) => v.identifier === identifier) || null;
|
|
733
1042
|
}
|
|
734
|
-
/* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */
|
|
735
1043
|
}
|
|
736
1044
|
return TestProcessingElement;
|
|
737
1045
|
};
|
|
738
1046
|
|
|
739
|
-
// ../qti-test/
|
|
1047
|
+
// ../qti-test/dist/components/qti-test/qti-test.js
|
|
1048
|
+
var __decorate8 = function(decorators, target, key, desc) {
|
|
1049
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1050
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
1051
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
1052
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
1053
|
+
};
|
|
740
1054
|
var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixin(TestBaseMixin(i2)))) {
|
|
741
1055
|
constructor() {
|
|
742
1056
|
super(...arguments);
|
|
@@ -755,831 +1069,179 @@ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixi
|
|
|
755
1069
|
return T`<slot></slot>`;
|
|
756
1070
|
}
|
|
757
1071
|
};
|
|
758
|
-
|
|
1072
|
+
__decorate8([
|
|
759
1073
|
r(),
|
|
760
1074
|
e({ context: configContext })
|
|
761
|
-
], QtiTest.prototype, "configContext",
|
|
762
|
-
QtiTest = __decorateClass([
|
|
763
|
-
t("qti-test")
|
|
764
|
-
], QtiTest);
|
|
1075
|
+
], QtiTest.prototype, "configContext", void 0);
|
|
765
1076
|
|
|
766
|
-
// ../qti-test/
|
|
767
|
-
var
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
1077
|
+
// ../qti-test/dist/components/styles.js
|
|
1078
|
+
var form = i`
|
|
1079
|
+
display: inline-flex;
|
|
1080
|
+
align-items: center;
|
|
1081
|
+
cursor: pointer;
|
|
1082
|
+
padding: 0.5rem 1rem;
|
|
1083
|
+
border-radius: 0.25rem;
|
|
1084
|
+
user-select: none;
|
|
1085
|
+
`;
|
|
1086
|
+
var btn = i`
|
|
1087
|
+
background-color: lightgray;
|
|
1088
|
+
${form};
|
|
1089
|
+
`;
|
|
1090
|
+
var dis = i`
|
|
1091
|
+
cursor: not-allowed;
|
|
1092
|
+
opacity: 0.8;
|
|
1093
|
+
`;
|
|
1094
|
+
var ind = i`
|
|
1095
|
+
${form};
|
|
1096
|
+
border: 1px solid gray;
|
|
1097
|
+
`;
|
|
1098
|
+
|
|
1099
|
+
// ../qti-test/dist/components/test-check-item/test-check-item.js
|
|
1100
|
+
var TestCheckItem = class extends i2 {
|
|
1101
|
+
static {
|
|
1102
|
+
this.styles = i`
|
|
1103
|
+
:host {
|
|
1104
|
+
${btn};
|
|
1105
|
+
}
|
|
1106
|
+
:host([disabled]) {
|
|
1107
|
+
${dis};
|
|
1108
|
+
}
|
|
1109
|
+
`;
|
|
773
1110
|
}
|
|
774
|
-
};
|
|
775
|
-
var QtiAssessmentItemRef = class extends i2 {
|
|
776
1111
|
constructor() {
|
|
777
|
-
super(
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1112
|
+
super();
|
|
1113
|
+
this.addEventListener("click", () => {
|
|
1114
|
+
this.dispatchEvent(new CustomEvent("test-end-attempt", { bubbles: true }));
|
|
1115
|
+
const qtiTest = this.closest("qti-test");
|
|
1116
|
+
const testContainer = qtiTest.querySelector("test-container");
|
|
1117
|
+
const viewElements = Array.from(testContainer.shadowRoot.querySelectorAll("[view]"));
|
|
1118
|
+
viewElements.forEach((element) => {
|
|
1119
|
+
element.classList.toggle("show", true);
|
|
1120
|
+
});
|
|
1121
|
+
});
|
|
785
1122
|
}
|
|
786
|
-
|
|
787
|
-
return
|
|
788
|
-
}
|
|
789
|
-
async connectedCallback() {
|
|
790
|
-
super.connectedCallback();
|
|
791
|
-
await this.updateComplete;
|
|
792
|
-
this.dispatchEvent(
|
|
793
|
-
new CustomEvent("qti-assessment-item-ref-connected", {
|
|
794
|
-
bubbles: true,
|
|
795
|
-
composed: true,
|
|
796
|
-
detail: { identifier: this.identifier, href: this.href, category: this.category }
|
|
797
|
-
})
|
|
798
|
-
);
|
|
799
|
-
}
|
|
800
|
-
render() {
|
|
801
|
-
return this.myTemplate ? this.myTemplate({ xmlDoc: this.xmlDoc }) : this.xmlDoc;
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
__decorateClass([
|
|
805
|
-
n({ type: String })
|
|
806
|
-
], QtiAssessmentItemRef.prototype, "category", 2);
|
|
807
|
-
__decorateClass([
|
|
808
|
-
n({ type: String })
|
|
809
|
-
], QtiAssessmentItemRef.prototype, "identifier", 2);
|
|
810
|
-
__decorateClass([
|
|
811
|
-
n({ type: Boolean, converter: stringToBooleanConverter })
|
|
812
|
-
], QtiAssessmentItemRef.prototype, "required", 2);
|
|
813
|
-
__decorateClass([
|
|
814
|
-
n({ type: Boolean, converter: stringToBooleanConverter })
|
|
815
|
-
], QtiAssessmentItemRef.prototype, "fixed", 2);
|
|
816
|
-
__decorateClass([
|
|
817
|
-
n({ type: String })
|
|
818
|
-
], QtiAssessmentItemRef.prototype, "href", 2);
|
|
819
|
-
__decorateClass([
|
|
820
|
-
n({ type: Object, attribute: false })
|
|
821
|
-
], QtiAssessmentItemRef.prototype, "xmlDoc", 2);
|
|
822
|
-
if (!customElements.get("qti-assessment-item-ref")) {
|
|
823
|
-
customElements.define("qti-assessment-item-ref", QtiAssessmentItemRef);
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
// ../qti-test/src/components/qti-assessment-section/qti-assessment-section.ts
|
|
827
|
-
var stringToBooleanConverter2 = {
|
|
828
|
-
fromAttribute(value) {
|
|
829
|
-
return value === "true";
|
|
830
|
-
},
|
|
831
|
-
toAttribute(value) {
|
|
832
|
-
return value ? "true" : "false";
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
|
-
var QtiAssessmentSection = class extends i2 {
|
|
836
|
-
get title() {
|
|
837
|
-
return this.#title;
|
|
838
|
-
}
|
|
839
|
-
set title(value) {
|
|
840
|
-
this.#title = value;
|
|
841
|
-
this.removeAttribute("title");
|
|
842
|
-
this.setAttribute("data-title", value);
|
|
843
|
-
}
|
|
844
|
-
#title = "";
|
|
845
|
-
async connectedCallback() {
|
|
846
|
-
this.#title = this.getAttribute("title") || "";
|
|
847
|
-
super.connectedCallback();
|
|
848
|
-
await this.updateComplete;
|
|
849
|
-
this.dispatchEvent(
|
|
850
|
-
new Event("qti-assessment-section-connected", {
|
|
851
|
-
bubbles: true,
|
|
852
|
-
composed: true
|
|
853
|
-
})
|
|
854
|
-
);
|
|
855
|
-
}
|
|
856
|
-
render() {
|
|
857
|
-
return T`<slot name="qti-rubric-block"></slot><slot></slot>`;
|
|
1123
|
+
render() {
|
|
1124
|
+
return T` <slot></slot> `;
|
|
858
1125
|
}
|
|
859
1126
|
};
|
|
860
|
-
__decorateClass([
|
|
861
|
-
n({ type: String })
|
|
862
|
-
], QtiAssessmentSection.prototype, "identifier", 2);
|
|
863
|
-
__decorateClass([
|
|
864
|
-
n({ type: String })
|
|
865
|
-
], QtiAssessmentSection.prototype, "required", 2);
|
|
866
|
-
__decorateClass([
|
|
867
|
-
n({ type: Boolean, converter: stringToBooleanConverter2 })
|
|
868
|
-
], QtiAssessmentSection.prototype, "fixed", 2);
|
|
869
|
-
__decorateClass([
|
|
870
|
-
n({ type: Boolean, converter: stringToBooleanConverter2 })
|
|
871
|
-
], QtiAssessmentSection.prototype, "visible", 2);
|
|
872
|
-
__decorateClass([
|
|
873
|
-
n({ type: Boolean, converter: stringToBooleanConverter2, attribute: "keep-together" })
|
|
874
|
-
], QtiAssessmentSection.prototype, "keepTogether", 2);
|
|
875
|
-
__decorateClass([
|
|
876
|
-
c({ context: testContext, subscribe: true })
|
|
877
|
-
], QtiAssessmentSection.prototype, "_testContext", 2);
|
|
878
|
-
if (!customElements.get("qti-assessment-section")) {
|
|
879
|
-
customElements.define("qti-assessment-section", QtiAssessmentSection);
|
|
880
|
-
}
|
|
881
1127
|
|
|
882
|
-
// ../qti-test/
|
|
883
|
-
var
|
|
884
|
-
var
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
889
|
-
get title() {
|
|
890
|
-
return __privateGet(this, _title);
|
|
891
|
-
}
|
|
892
|
-
set title(value) {
|
|
893
|
-
__privateSet(this, _title, value);
|
|
894
|
-
this.removeAttribute("title");
|
|
895
|
-
this.setAttribute("data-title", value);
|
|
896
|
-
}
|
|
897
|
-
async connectedCallback() {
|
|
898
|
-
super.connectedCallback();
|
|
899
|
-
await this.updateComplete;
|
|
900
|
-
this.dispatchEvent(
|
|
901
|
-
new CustomEvent("qti-assessment-test-connected", {
|
|
902
|
-
detail: this,
|
|
903
|
-
bubbles: true,
|
|
904
|
-
composed: true
|
|
905
|
-
})
|
|
906
|
-
);
|
|
907
|
-
}
|
|
908
|
-
render() {
|
|
909
|
-
return T` <slot></slot>`;
|
|
910
|
-
}
|
|
1128
|
+
// ../qti-test/dist/components/test-container/test-container.js
|
|
1129
|
+
var __decorate9 = function(decorators, target, key, desc) {
|
|
1130
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1131
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
1132
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
1133
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
911
1134
|
};
|
|
912
|
-
|
|
913
|
-
__decorateClass([
|
|
914
|
-
n({ type: String })
|
|
915
|
-
], QtiAssessmentTest.prototype, "identifier", 2);
|
|
916
|
-
__decorateClass([
|
|
917
|
-
n({ type: String })
|
|
918
|
-
], QtiAssessmentTest.prototype, "title", 1);
|
|
919
|
-
__decorateClass([
|
|
920
|
-
c({ context: testContext, subscribe: true })
|
|
921
|
-
], QtiAssessmentTest.prototype, "_testContext", 2);
|
|
922
|
-
QtiAssessmentTest = __decorateClass([
|
|
923
|
-
t("qti-assessment-test")
|
|
924
|
-
], QtiAssessmentTest);
|
|
925
|
-
|
|
926
|
-
// ../qti-test/src/components/qti-test-part/qti-test-part.ts
|
|
927
|
-
var _title2;
|
|
928
|
-
var QtiTestPart = class extends i2 {
|
|
1135
|
+
var TestContainer = class extends i2 {
|
|
929
1136
|
constructor() {
|
|
930
1137
|
super(...arguments);
|
|
931
|
-
this.
|
|
932
|
-
this.
|
|
933
|
-
this.
|
|
934
|
-
this.
|
|
935
|
-
__privateAdd(this, _title2, "");
|
|
936
|
-
}
|
|
937
|
-
get title() {
|
|
938
|
-
return __privateGet(this, _title2);
|
|
939
|
-
}
|
|
940
|
-
set title(value) {
|
|
941
|
-
__privateSet(this, _title2, value);
|
|
942
|
-
this.removeAttribute("title");
|
|
943
|
-
this.setAttribute("data-title", value);
|
|
944
|
-
}
|
|
945
|
-
async connectedCallback() {
|
|
946
|
-
super.connectedCallback();
|
|
947
|
-
await this.updateComplete;
|
|
948
|
-
this.dispatchEvent(
|
|
949
|
-
new Event("qti-test-part-connected", {
|
|
950
|
-
bubbles: true,
|
|
951
|
-
composed: true
|
|
952
|
-
})
|
|
953
|
-
);
|
|
954
|
-
}
|
|
955
|
-
render() {
|
|
956
|
-
return T` <slot></slot>`;
|
|
957
|
-
}
|
|
958
|
-
};
|
|
959
|
-
_title2 = new WeakMap();
|
|
960
|
-
__decorateClass([
|
|
961
|
-
n({ type: String })
|
|
962
|
-
], QtiTestPart.prototype, "identifier", 2);
|
|
963
|
-
__decorateClass([
|
|
964
|
-
n({ type: String })
|
|
965
|
-
], QtiTestPart.prototype, "class", 2);
|
|
966
|
-
__decorateClass([
|
|
967
|
-
n({ type: String, attribute: "navigation-mode" })
|
|
968
|
-
], QtiTestPart.prototype, "navigationMode", 2);
|
|
969
|
-
__decorateClass([
|
|
970
|
-
n({ type: String, attribute: "submission-mode" })
|
|
971
|
-
], QtiTestPart.prototype, "submissionMode", 2);
|
|
972
|
-
QtiTestPart = __decorateClass([
|
|
973
|
-
t("qti-test-part")
|
|
974
|
-
], QtiTestPart);
|
|
975
|
-
if (!customElements.get("qti-test-part")) {
|
|
976
|
-
customElements.define("qti-test-part", QtiTestPart);
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
// ../qti-test/src/components/qti-test-feedback/qti-test-feedback.ts
|
|
980
|
-
var QtiTestFeedback = class extends QtiModalFeedback {
|
|
981
|
-
render() {
|
|
982
|
-
return T``;
|
|
983
|
-
}
|
|
984
|
-
};
|
|
985
|
-
QtiTestFeedback.styles = i`
|
|
986
|
-
:host {
|
|
987
|
-
color: gray;
|
|
988
|
-
}
|
|
989
|
-
`;
|
|
990
|
-
QtiTestFeedback = __decorateClass([
|
|
991
|
-
t("qti-test-feedback")
|
|
992
|
-
], QtiTestFeedback);
|
|
993
|
-
|
|
994
|
-
// ../qti-test/src/components/test-navigation/test-navigation.ts
|
|
995
|
-
var _testElement, _TestNavigation_instances, handleTestEndAttempt_fn, handleTestShowCorrectResponse_fn, handleTestShowCandidateCorrection_fn, handleTestUpdateOutcomeVariable_fn, handleInteractionChanged_fn, handleTestConnected_fn, extractDefaultValues_fn, handleItemConnected_fn;
|
|
996
|
-
var TestNavigation = class extends i2 {
|
|
997
|
-
constructor() {
|
|
998
|
-
super();
|
|
999
|
-
__privateAdd(this, _TestNavigation_instances);
|
|
1000
|
-
this.identifier = void 0;
|
|
1001
|
-
this.initContext = [];
|
|
1002
|
-
this.qtiContext = {
|
|
1003
|
-
QTI_CONTEXT: {
|
|
1004
|
-
testIdentifier: "",
|
|
1005
|
-
candidateIdentifier: "",
|
|
1006
|
-
environmentIdentifier: "default"
|
|
1007
|
-
}
|
|
1008
|
-
};
|
|
1009
|
-
this.configContext = {};
|
|
1010
|
-
this.autoScoreItems = false;
|
|
1011
|
-
__privateAdd(this, _testElement);
|
|
1012
|
-
this.addEventListener("qti-assessment-test-connected", __privateMethod(this, _TestNavigation_instances, handleTestConnected_fn).bind(this));
|
|
1013
|
-
this.addEventListener("qti-assessment-item-connected", __privateMethod(this, _TestNavigation_instances, handleItemConnected_fn).bind(this));
|
|
1014
|
-
this.addEventListener("qti-interaction-changed", __privateMethod(this, _TestNavigation_instances, handleInteractionChanged_fn).bind(this));
|
|
1015
|
-
this.addEventListener("test-end-attempt", __privateMethod(this, _TestNavigation_instances, handleTestEndAttempt_fn).bind(this));
|
|
1016
|
-
this.addEventListener("test-show-correct-response", __privateMethod(this, _TestNavigation_instances, handleTestShowCorrectResponse_fn).bind(this));
|
|
1017
|
-
this.addEventListener("test-show-candidate-correction", __privateMethod(this, _TestNavigation_instances, handleTestShowCandidateCorrection_fn).bind(this));
|
|
1018
|
-
this.addEventListener("test-update-outcome-variable", __privateMethod(this, _TestNavigation_instances, handleTestUpdateOutcomeVariable_fn).bind(this));
|
|
1019
|
-
}
|
|
1020
|
-
render() {
|
|
1021
|
-
return T`<slot></slot>`;
|
|
1022
|
-
}
|
|
1023
|
-
/* PK: on every change of the candidate we will recomputed the computedContext */
|
|
1024
|
-
willUpdate(_changedProperties) {
|
|
1025
|
-
if (!this.computedContext) return;
|
|
1026
|
-
let itemIndex = 1;
|
|
1027
|
-
this.computedContext = {
|
|
1028
|
-
...this.computedContext,
|
|
1029
|
-
view: this._sessionContext?.view,
|
|
1030
|
-
testParts: this.computedContext.testParts.map((testPart) => {
|
|
1031
|
-
return {
|
|
1032
|
-
...testPart,
|
|
1033
|
-
active: this._sessionContext?.navPartId === testPart.identifier || false,
|
|
1034
|
-
sections: testPart.sections.map((section) => {
|
|
1035
|
-
return {
|
|
1036
|
-
...section,
|
|
1037
|
-
active: this._sessionContext?.navSectionId === section.identifier || false,
|
|
1038
|
-
completed: section.items.every(
|
|
1039
|
-
(item) => this._testContext.items.find((i5) => i5.identifier === item.identifier)?.variables.find((v2) => v2.identifier === "completionStatus").value === "completed"
|
|
1040
|
-
),
|
|
1041
|
-
items: section.items.map((item) => {
|
|
1042
|
-
const itemContext = this._testContext?.items.find((i5) => i5.identifier === item.identifier);
|
|
1043
|
-
const computedItem = {
|
|
1044
|
-
...item,
|
|
1045
|
-
...itemContext,
|
|
1046
|
-
...this.initContext?.find((i5) => i5.identifier === item.identifier)
|
|
1047
|
-
};
|
|
1048
|
-
const rawscore = computedItem.variables?.find((vr) => vr.identifier == "SCORE")?.value;
|
|
1049
|
-
const score = rawscore === void 0 || rawscore === null ? null : parseFloat(rawscore?.toString());
|
|
1050
|
-
const completionStatus = computedItem.variables?.find((v2) => v2.identifier === "completionStatus")?.value;
|
|
1051
|
-
const response = computedItem.variables?.find((v2) => v2.identifier === "RESPONSE")?.value || "";
|
|
1052
|
-
const numAttempts = computedItem.variables?.find((v2) => v2.identifier === "numAttempts")?.value || 0;
|
|
1053
|
-
const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;
|
|
1054
|
-
const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;
|
|
1055
|
-
const rawMaxScore = item.variables?.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
1056
|
-
const maxScore = rawMaxScore === void 0 || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());
|
|
1057
|
-
return {
|
|
1058
|
-
...computedItem,
|
|
1059
|
-
completionStatus,
|
|
1060
|
-
numAttempts,
|
|
1061
|
-
score,
|
|
1062
|
-
response,
|
|
1063
|
-
index,
|
|
1064
|
-
active,
|
|
1065
|
-
maxScore
|
|
1066
|
-
// type,
|
|
1067
|
-
// correct,
|
|
1068
|
-
// incorrect,
|
|
1069
|
-
// completed
|
|
1070
|
-
};
|
|
1071
|
-
})
|
|
1072
|
-
};
|
|
1073
|
-
})
|
|
1074
|
-
};
|
|
1075
|
-
})
|
|
1076
|
-
};
|
|
1077
|
-
this.dispatchEvent(
|
|
1078
|
-
new CustomEvent("qti-computed-context-updated", {
|
|
1079
|
-
detail: this.computedContext,
|
|
1080
|
-
bubbles: true
|
|
1081
|
-
})
|
|
1082
|
-
);
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1085
|
-
_testElement = new WeakMap();
|
|
1086
|
-
_TestNavigation_instances = new WeakSet();
|
|
1087
|
-
/**
|
|
1088
|
-
* Handles the 'test-end-attempt' event.
|
|
1089
|
-
* @private
|
|
1090
|
-
* @listens TestNavigation#test-end-attempt
|
|
1091
|
-
* @param {CustomEvent} event - The custom event object.
|
|
1092
|
-
*/
|
|
1093
|
-
handleTestEndAttempt_fn = function(_event) {
|
|
1094
|
-
const qtiItemEl = __privateGet(this, _testElement).querySelector(
|
|
1095
|
-
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`
|
|
1096
|
-
);
|
|
1097
|
-
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1098
|
-
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
1099
|
-
qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);
|
|
1100
|
-
};
|
|
1101
|
-
/**
|
|
1102
|
-
* Handles the 'test-show-correct-response' event.
|
|
1103
|
-
* @private
|
|
1104
|
-
* @listens TestNavigation#test-show-correct-response
|
|
1105
|
-
* @param {CustomEvent} event - The custom event object.
|
|
1106
|
-
*/
|
|
1107
|
-
handleTestShowCorrectResponse_fn = function(event) {
|
|
1108
|
-
const qtiItemEl = __privateGet(this, _testElement).querySelector(
|
|
1109
|
-
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`
|
|
1110
|
-
);
|
|
1111
|
-
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1112
|
-
if (!qtiAssessmentItemEl) return;
|
|
1113
|
-
qtiAssessmentItemEl.showCorrectResponse(event.detail);
|
|
1114
|
-
};
|
|
1115
|
-
/**
|
|
1116
|
-
* Handles the 'test-show-candidate-correction' event.
|
|
1117
|
-
* @private
|
|
1118
|
-
* @listens TestNavigation#test-show-candidate-correction
|
|
1119
|
-
* @param {CustomEvent} event - The custom event object.
|
|
1120
|
-
*/
|
|
1121
|
-
handleTestShowCandidateCorrection_fn = function(event) {
|
|
1122
|
-
const qtiItemEl = __privateGet(this, _testElement).querySelector(
|
|
1123
|
-
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`
|
|
1124
|
-
);
|
|
1125
|
-
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1126
|
-
qtiAssessmentItemEl.showCandidateCorrection(event.detail);
|
|
1127
|
-
};
|
|
1128
|
-
handleTestUpdateOutcomeVariable_fn = function(event) {
|
|
1129
|
-
const qtiItemEl = __privateGet(this, _testElement).querySelector(
|
|
1130
|
-
`qti-assessment-item-ref[identifier="${event.detail.assessmentItemRefId}"]`
|
|
1131
|
-
);
|
|
1132
|
-
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1133
|
-
qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);
|
|
1134
|
-
};
|
|
1135
|
-
handleInteractionChanged_fn = function(_event) {
|
|
1136
|
-
if (this.autoScoreItems) {
|
|
1137
|
-
const assessmentItem = _event.composedPath()[0].closest(
|
|
1138
|
-
"qti-assessment-item"
|
|
1139
|
-
);
|
|
1140
|
-
const scoreOutcomeIdentifier = assessmentItem.variables.find((v2) => v2.identifier === "SCORE");
|
|
1141
|
-
if (scoreOutcomeIdentifier && scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === "false") {
|
|
1142
|
-
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
1143
|
-
assessmentItem.processResponse(true, reportValidityAfterScoring);
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
|
-
/* PK: on test connected we can build the computed context */
|
|
1148
|
-
handleTestConnected_fn = function(event) {
|
|
1149
|
-
__privateSet(this, _testElement, event.detail);
|
|
1150
|
-
if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {
|
|
1151
|
-
const currentContext = this.qtiContext.QTI_CONTEXT || {
|
|
1152
|
-
testIdentifier: "",
|
|
1153
|
-
candidateIdentifier: "not set",
|
|
1154
|
-
environmentIdentifier: "default"
|
|
1155
|
-
};
|
|
1138
|
+
this.customElementRegistry = null;
|
|
1139
|
+
this.testURL = null;
|
|
1140
|
+
this.testDoc = null;
|
|
1141
|
+
this.testXML = null;
|
|
1156
1142
|
this.qtiContext = {
|
|
1157
|
-
QTI_CONTEXT: {
|
|
1158
|
-
...currentContext,
|
|
1159
|
-
testIdentifier: __privateGet(this, _testElement).identifier,
|
|
1160
|
-
environmentIdentifier: currentContext.environmentIdentifier || "default"
|
|
1161
|
-
}
|
|
1143
|
+
QTI_CONTEXT: { testIdentifier: "", candidateIdentifier: "", environmentIdentifier: "default" }
|
|
1162
1144
|
};
|
|
1145
|
+
this.#templateContent = null;
|
|
1146
|
+
this.#resolvedCustomElementRegistry = null;
|
|
1163
1147
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
// Runtime values override defaults
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
});
|
|
1178
|
-
const testPartElements = Array.from(__privateGet(this, _testElement)?.querySelectorAll(`qti-test-part`) || []);
|
|
1179
|
-
this.computedContext = {
|
|
1180
|
-
identifier: __privateGet(this, _testElement).identifier,
|
|
1181
|
-
title: __privateGet(this, _testElement).title,
|
|
1182
|
-
view: this._sessionContext?.view,
|
|
1183
|
-
testParts: testPartElements.map((testPart) => {
|
|
1184
|
-
const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
|
|
1185
|
-
return {
|
|
1186
|
-
active: false,
|
|
1187
|
-
identifier: testPart.identifier,
|
|
1188
|
-
navigationMode: testPart.navigationMode,
|
|
1189
|
-
submissionMode: testPart.submissionMode,
|
|
1190
|
-
sections: sectionElements.map((section) => {
|
|
1191
|
-
const itemElements = [...section.querySelectorAll(`qti-assessment-item-ref`)];
|
|
1192
|
-
return {
|
|
1193
|
-
active: false,
|
|
1194
|
-
identifier: section.identifier,
|
|
1195
|
-
title: section.title,
|
|
1196
|
-
items: itemElements.map((item) => ({
|
|
1197
|
-
...this.initContext?.find((i5) => i5.identifier === item.identifier),
|
|
1198
|
-
active: false,
|
|
1199
|
-
identifier: item.identifier,
|
|
1200
|
-
categories: item.category ? item.category?.split(" ") : [],
|
|
1201
|
-
href: item.href,
|
|
1202
|
-
variables: []
|
|
1203
|
-
}))
|
|
1204
|
-
};
|
|
1205
|
-
})
|
|
1206
|
-
};
|
|
1207
|
-
})
|
|
1208
|
-
};
|
|
1209
|
-
};
|
|
1210
|
-
/**
|
|
1211
|
-
* Extract default values from a qti-context-declaration element
|
|
1212
|
-
*/
|
|
1213
|
-
extractDefaultValues_fn = function(declaration) {
|
|
1214
|
-
const defaultValues = {};
|
|
1215
|
-
const defaultValueElement = declaration.querySelector("qti-default-value");
|
|
1216
|
-
if (!defaultValueElement) {
|
|
1217
|
-
return defaultValues;
|
|
1218
|
-
}
|
|
1219
|
-
const valueElements = defaultValueElement.querySelectorAll("qti-value[field-identifier]");
|
|
1220
|
-
valueElements.forEach((valueElement) => {
|
|
1221
|
-
const fieldIdentifier = valueElement.getAttribute("field-identifier");
|
|
1222
|
-
const baseType = valueElement.getAttribute("base-type") || "string";
|
|
1223
|
-
const textContent = valueElement.textContent?.trim() || "";
|
|
1224
|
-
if (fieldIdentifier) {
|
|
1225
|
-
let value = textContent;
|
|
1226
|
-
switch (baseType) {
|
|
1227
|
-
case "integer":
|
|
1228
|
-
value = parseInt(textContent, 10);
|
|
1229
|
-
break;
|
|
1230
|
-
case "float":
|
|
1231
|
-
case "duration":
|
|
1232
|
-
value = parseFloat(textContent);
|
|
1233
|
-
break;
|
|
1234
|
-
case "boolean":
|
|
1235
|
-
value = textContent.toLowerCase() === "true";
|
|
1236
|
-
break;
|
|
1237
|
-
case "string":
|
|
1238
|
-
default:
|
|
1239
|
-
value = textContent;
|
|
1240
|
-
break;
|
|
1241
|
-
}
|
|
1242
|
-
defaultValues[fieldIdentifier] = value;
|
|
1243
|
-
}
|
|
1244
|
-
});
|
|
1245
|
-
return defaultValues;
|
|
1246
|
-
};
|
|
1247
|
-
/* PK: on item connected we can add item only properties in the xml */
|
|
1248
|
-
handleItemConnected_fn = function(event) {
|
|
1249
|
-
const itemElement = event.detail;
|
|
1250
|
-
this.computedContext = {
|
|
1251
|
-
...this.computedContext,
|
|
1252
|
-
testParts: this.computedContext.testParts.map((testPart) => {
|
|
1253
|
-
return {
|
|
1254
|
-
...testPart,
|
|
1255
|
-
sections: testPart.sections.map((section) => {
|
|
1256
|
-
return {
|
|
1257
|
-
...section,
|
|
1258
|
-
items: section.items.map((item) => {
|
|
1259
|
-
if (item.identifier !== itemElement.parentElement.getAttribute("identifier")) {
|
|
1260
|
-
return item;
|
|
1261
|
-
}
|
|
1262
|
-
const scoreOutcome = itemElement.querySelector(
|
|
1263
|
-
"qti-outcome-declaration[identifier='SCORE']"
|
|
1264
|
-
);
|
|
1265
|
-
const externalScored = scoreOutcome?.getAttribute("externalScored");
|
|
1266
|
-
const responseDeclarations = itemElement.querySelectorAll("qti-response-declaration");
|
|
1267
|
-
const containsCorrectResponse = Array.from(responseDeclarations).some(
|
|
1268
|
-
(r4) => r4.querySelector("qti-correct-response")
|
|
1269
|
-
);
|
|
1270
|
-
const containsMapping = Array.from(responseDeclarations).some((r4) => {
|
|
1271
|
-
const mapping = r4.querySelector("qti-mapping");
|
|
1272
|
-
const areaMapping = r4.querySelector("qti-area-mapping");
|
|
1273
|
-
return mapping?.querySelector("qti-map-entry") || areaMapping?.querySelector("qti-area-map-entry");
|
|
1274
|
-
});
|
|
1275
|
-
const hasCorrectResponse = containsCorrectResponse || containsMapping;
|
|
1276
|
-
const hasResponseProcessing = itemElement.querySelector("qti-response-processing") ? true : false;
|
|
1277
|
-
return {
|
|
1278
|
-
...item,
|
|
1279
|
-
assessmentItemIdentifier: itemElement.getAttribute("identifier"),
|
|
1280
|
-
label: itemElement.getAttribute("label"),
|
|
1281
|
-
title: itemElement.title,
|
|
1282
|
-
externalScored,
|
|
1283
|
-
adaptive: itemElement.adaptive == "true" || false,
|
|
1284
|
-
timeDependent: itemElement.timeDependent == "true" || false,
|
|
1285
|
-
variables: itemElement.variables,
|
|
1286
|
-
hasCorrectResponse,
|
|
1287
|
-
hasResponseProcessing
|
|
1288
|
-
};
|
|
1289
|
-
})
|
|
1290
|
-
};
|
|
1291
|
-
})
|
|
1292
|
-
};
|
|
1293
|
-
})
|
|
1294
|
-
};
|
|
1295
|
-
};
|
|
1296
|
-
__decorateClass([
|
|
1297
|
-
n({ type: String })
|
|
1298
|
-
], TestNavigation.prototype, "identifier", 2);
|
|
1299
|
-
__decorateClass([
|
|
1300
|
-
r()
|
|
1301
|
-
], TestNavigation.prototype, "initContext", 2);
|
|
1302
|
-
__decorateClass([
|
|
1303
|
-
r(),
|
|
1304
|
-
e({ context: qtiContext })
|
|
1305
|
-
], TestNavigation.prototype, "qtiContext", 2);
|
|
1306
|
-
__decorateClass([
|
|
1307
|
-
r(),
|
|
1308
|
-
c({ context: configContext, subscribe: true })
|
|
1309
|
-
], TestNavigation.prototype, "configContext", 2);
|
|
1310
|
-
__decorateClass([
|
|
1311
|
-
r(),
|
|
1312
|
-
c({ context: testContext, subscribe: true })
|
|
1313
|
-
], TestNavigation.prototype, "_testContext", 2);
|
|
1314
|
-
__decorateClass([
|
|
1315
|
-
r(),
|
|
1316
|
-
c({ context: sessionContext, subscribe: true })
|
|
1317
|
-
], TestNavigation.prototype, "_sessionContext", 2);
|
|
1318
|
-
__decorateClass([
|
|
1319
|
-
r(),
|
|
1320
|
-
e({ context: computedContext })
|
|
1321
|
-
], TestNavigation.prototype, "computedContext", 2);
|
|
1322
|
-
__decorateClass([
|
|
1323
|
-
n({ type: Boolean, attribute: "auto-score-items" })
|
|
1324
|
-
], TestNavigation.prototype, "autoScoreItems", 2);
|
|
1325
|
-
TestNavigation = __decorateClass([
|
|
1326
|
-
t("test-navigation")
|
|
1327
|
-
], TestNavigation);
|
|
1328
|
-
|
|
1329
|
-
// ../qti-test/src/components/styles.ts
|
|
1330
|
-
var form = i`
|
|
1331
|
-
display: inline-flex;
|
|
1332
|
-
align-items: center;
|
|
1333
|
-
cursor: pointer;
|
|
1334
|
-
padding: 0.5rem 1rem;
|
|
1335
|
-
border-radius: 0.25rem;
|
|
1336
|
-
user-select: none;
|
|
1337
|
-
`;
|
|
1338
|
-
var btn = i`
|
|
1339
|
-
background-color: lightgray;
|
|
1340
|
-
${form};
|
|
1341
|
-
`;
|
|
1342
|
-
var dis = i`
|
|
1343
|
-
cursor: not-allowed;
|
|
1344
|
-
opacity: 0.8;
|
|
1345
|
-
`;
|
|
1346
|
-
var ind = i`
|
|
1347
|
-
${form};
|
|
1348
|
-
border: 1px solid gray;
|
|
1349
|
-
`;
|
|
1350
|
-
|
|
1351
|
-
// ../qti-test/src/components/test-next/test-next.ts
|
|
1352
|
-
var _internals;
|
|
1353
|
-
var TestNext = class extends i2 {
|
|
1354
|
-
constructor() {
|
|
1355
|
-
super();
|
|
1356
|
-
this._internalDisabled = true;
|
|
1357
|
-
__privateAdd(this, _internals);
|
|
1358
|
-
__privateSet(this, _internals, this.attachInternals());
|
|
1359
|
-
__privateGet(this, _internals).role = "button";
|
|
1360
|
-
__privateGet(this, _internals).ariaLabel = "Next item";
|
|
1361
|
-
this.addEventListener("click", (e3) => {
|
|
1362
|
-
e3.preventDefault();
|
|
1363
|
-
if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
|
|
1148
|
+
/** Template content if provided */
|
|
1149
|
+
#templateContent;
|
|
1150
|
+
#resolvedCustomElementRegistry;
|
|
1151
|
+
createRenderRoot() {
|
|
1152
|
+
const registry = this.customElementRegistry;
|
|
1153
|
+
this.#resolvedCustomElementRegistry = registry;
|
|
1154
|
+
return this.shadowRoot ?? this.attachShadow({
|
|
1155
|
+
...this.constructor.shadowRootOptions,
|
|
1156
|
+
...registry ? { customElementRegistry: registry } : {}
|
|
1364
1157
|
});
|
|
1365
1158
|
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
1381
|
-
this.checkDisabled();
|
|
1382
|
-
}
|
|
1383
|
-
checkDisabled() {
|
|
1384
|
-
this._internalDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;
|
|
1385
|
-
}
|
|
1386
|
-
_requestItem(identifier) {
|
|
1387
|
-
this.dispatchEvent(
|
|
1388
|
-
new CustomEvent("qti-request-navigation", {
|
|
1389
|
-
composed: true,
|
|
1390
|
-
bubbles: true,
|
|
1391
|
-
detail: {
|
|
1392
|
-
type: "item",
|
|
1393
|
-
id: identifier
|
|
1159
|
+
/** Callback function to transform the test after loading */
|
|
1160
|
+
// @property({ type: Function }) postLoadTestTransformCallback: PostLoadTestTransformCallback | null = null;
|
|
1161
|
+
async handleTestURLChange() {
|
|
1162
|
+
if (!this.testURL)
|
|
1163
|
+
return;
|
|
1164
|
+
try {
|
|
1165
|
+
const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;
|
|
1166
|
+
let api = (await qtiTransformTest().load(this.testURL)).shuffleOrdering(explicitSeed);
|
|
1167
|
+
const qtiTest = this.closest("qti-test");
|
|
1168
|
+
if (qtiTest?.postLoadTestTransformCallback) {
|
|
1169
|
+
const tempDoc = api.htmlDoc(this.#resolvedCustomElementRegistry ?? void 0);
|
|
1170
|
+
const testElement = tempDoc.querySelector("qti-assessment-test");
|
|
1171
|
+
if (testElement) {
|
|
1172
|
+
api = await qtiTest.postLoadTestTransformCallback(api, testElement);
|
|
1394
1173
|
}
|
|
1395
|
-
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
return T`<slot></slot>`;
|
|
1400
|
-
}
|
|
1401
|
-
};
|
|
1402
|
-
_internals = new WeakMap();
|
|
1403
|
-
TestNext.styles = i`
|
|
1404
|
-
:host {
|
|
1405
|
-
${btn};
|
|
1406
|
-
}
|
|
1407
|
-
:host([disabled]) {
|
|
1408
|
-
${dis};
|
|
1409
|
-
}
|
|
1410
|
-
`;
|
|
1411
|
-
__decorateClass([
|
|
1412
|
-
n({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
1413
|
-
], TestNext.prototype, "_internalDisabled", 2);
|
|
1414
|
-
__decorateClass([
|
|
1415
|
-
c({ context: computedContext, subscribe: true })
|
|
1416
|
-
], TestNext.prototype, "computedContext", 2);
|
|
1417
|
-
__decorateClass([
|
|
1418
|
-
watch("computedContext")
|
|
1419
|
-
], TestNext.prototype, "_handleTestElementChange", 1);
|
|
1420
|
-
TestNext = __decorateClass([
|
|
1421
|
-
t("test-next")
|
|
1422
|
-
], TestNext);
|
|
1423
|
-
|
|
1424
|
-
// ../qti-test/src/components/test-prev/test-prev.ts
|
|
1425
|
-
var TestPrev = class extends i2 {
|
|
1426
|
-
constructor() {
|
|
1427
|
-
super();
|
|
1428
|
-
this._internalDisabled = true;
|
|
1429
|
-
this.addEventListener("click", (e3) => {
|
|
1430
|
-
e3.preventDefault();
|
|
1431
|
-
if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
|
|
1432
|
-
});
|
|
1433
|
-
}
|
|
1434
|
-
_handleTestElementChange(_oldValue, newValue) {
|
|
1435
|
-
if (newValue) {
|
|
1436
|
-
this._internalDisabled = false;
|
|
1174
|
+
}
|
|
1175
|
+
this.testDoc = api.htmlDoc(this.#resolvedCustomElementRegistry ?? void 0);
|
|
1176
|
+
} catch (error) {
|
|
1177
|
+
console.error("Error loading or parsing XML:", error);
|
|
1437
1178
|
}
|
|
1438
1179
|
}
|
|
1439
|
-
|
|
1440
|
-
if (!this.
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
checkDisabled() {
|
|
1448
|
-
this._internalDisabled = !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
|
|
1449
|
-
}
|
|
1450
|
-
_requestItem(identifier) {
|
|
1451
|
-
this.dispatchEvent(
|
|
1452
|
-
new CustomEvent("qti-request-navigation", {
|
|
1453
|
-
composed: true,
|
|
1454
|
-
bubbles: true,
|
|
1455
|
-
detail: {
|
|
1456
|
-
type: "item",
|
|
1457
|
-
id: identifier
|
|
1458
|
-
}
|
|
1459
|
-
})
|
|
1460
|
-
);
|
|
1461
|
-
}
|
|
1462
|
-
render() {
|
|
1463
|
-
return T`<slot></slot>`;
|
|
1464
|
-
}
|
|
1465
|
-
};
|
|
1466
|
-
TestPrev.styles = i`
|
|
1467
|
-
:host {
|
|
1468
|
-
${btn};
|
|
1469
|
-
}
|
|
1470
|
-
:host([disabled]) {
|
|
1471
|
-
${dis};
|
|
1180
|
+
handleTestXMLChange() {
|
|
1181
|
+
if (!this.testXML)
|
|
1182
|
+
return;
|
|
1183
|
+
try {
|
|
1184
|
+
const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;
|
|
1185
|
+
this.testDoc = qtiTransformTest().parse(this.testXML).shuffleOrdering(explicitSeed).htmlDoc(this.#resolvedCustomElementRegistry ?? void 0);
|
|
1186
|
+
} catch (error) {
|
|
1187
|
+
console.error("Error parsing XML:", error);
|
|
1472
1188
|
}
|
|
1473
|
-
`;
|
|
1474
|
-
__decorateClass([
|
|
1475
|
-
n({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
1476
|
-
], TestPrev.prototype, "_internalDisabled", 2);
|
|
1477
|
-
__decorateClass([
|
|
1478
|
-
c({ context: computedContext, subscribe: true })
|
|
1479
|
-
], TestPrev.prototype, "computedContext", 2);
|
|
1480
|
-
__decorateClass([
|
|
1481
|
-
watch("computedContext")
|
|
1482
|
-
], TestPrev.prototype, "_handleTestElementChange", 1);
|
|
1483
|
-
TestPrev = __decorateClass([
|
|
1484
|
-
t("test-prev")
|
|
1485
|
-
], TestPrev);
|
|
1486
|
-
|
|
1487
|
-
// ../qti-test/src/components/test-view-toggle/test-view.ts
|
|
1488
|
-
var _TestView_instances, updateViewOptions_fn;
|
|
1489
|
-
var TestView = class extends i2 {
|
|
1490
|
-
constructor() {
|
|
1491
|
-
super(...arguments);
|
|
1492
|
-
__privateAdd(this, _TestView_instances);
|
|
1493
|
-
this.label = "view";
|
|
1494
|
-
this._handleViewOptionsChange = () => {
|
|
1495
|
-
__privateMethod(this, _TestView_instances, updateViewOptions_fn).call(this);
|
|
1496
|
-
};
|
|
1497
|
-
this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;
|
|
1498
1189
|
}
|
|
1499
|
-
connectedCallback() {
|
|
1190
|
+
async connectedCallback() {
|
|
1500
1191
|
super.connectedCallback();
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
})
|
|
1510
|
-
);
|
|
1511
|
-
}
|
|
1512
|
-
render() {
|
|
1513
|
-
return T`
|
|
1514
|
-
<label part="label" for="viewSelect">${this.label}</label>
|
|
1515
|
-
<select
|
|
1516
|
-
part="select"
|
|
1517
|
-
id="viewSelect"
|
|
1518
|
-
@change=${(e3) => {
|
|
1519
|
-
const el = e3.target;
|
|
1520
|
-
this._switchView(el.value);
|
|
1521
|
-
}}
|
|
1522
|
-
>
|
|
1523
|
-
${this._viewOptions.map(
|
|
1524
|
-
(v2) => T`<option value="${v2}" ?selected=${v2 === this.sessionContext.view}>${v2}</option>`
|
|
1525
|
-
)}
|
|
1526
|
-
</select>
|
|
1527
|
-
`;
|
|
1528
|
-
}
|
|
1529
|
-
};
|
|
1530
|
-
_TestView_instances = new WeakSet();
|
|
1531
|
-
updateViewOptions_fn = function() {
|
|
1532
|
-
if (this.viewOptions) {
|
|
1533
|
-
const options = this.viewOptions.split(",").map((opt) => opt.trim());
|
|
1534
|
-
this._viewOptions = options.filter((opt) => TestView.DEFAULT_VIEW_OPTIONS.includes(opt));
|
|
1535
|
-
} else {
|
|
1536
|
-
this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;
|
|
1192
|
+
this.#initializeTemplateContent();
|
|
1193
|
+
this.#applyStyles();
|
|
1194
|
+
if (this.testURL) {
|
|
1195
|
+
this.handleTestURLChange();
|
|
1196
|
+
}
|
|
1197
|
+
if (this.testXML) {
|
|
1198
|
+
this.handleTestXMLChange();
|
|
1199
|
+
}
|
|
1537
1200
|
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
c({ context: sessionContext, subscribe: true })
|
|
1542
|
-
], TestView.prototype, "sessionContext", 2);
|
|
1543
|
-
__decorateClass([
|
|
1544
|
-
n({ type: String })
|
|
1545
|
-
], TestView.prototype, "label", 2);
|
|
1546
|
-
__decorateClass([
|
|
1547
|
-
n({ type: String, attribute: "view-options" })
|
|
1548
|
-
], TestView.prototype, "viewOptions", 2);
|
|
1549
|
-
__decorateClass([
|
|
1550
|
-
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
1551
|
-
], TestView.prototype, "_handleViewOptionsChange", 2);
|
|
1552
|
-
__decorateClass([
|
|
1553
|
-
r()
|
|
1554
|
-
], TestView.prototype, "_viewOptions", 2);
|
|
1555
|
-
TestView = __decorateClass([
|
|
1556
|
-
t("test-view")
|
|
1557
|
-
], TestView);
|
|
1558
|
-
|
|
1559
|
-
// ../qti-test/src/components/test-item-link/test-item-link.ts
|
|
1560
|
-
var TestItemLink = class extends i2 {
|
|
1561
|
-
constructor() {
|
|
1562
|
-
super();
|
|
1563
|
-
this.itemId = null;
|
|
1564
|
-
this.addEventListener("click", () => this._requestItem(this.itemId));
|
|
1201
|
+
#initializeTemplateContent() {
|
|
1202
|
+
const template = this.querySelector("template");
|
|
1203
|
+
this.#templateContent = template ? template.content : T``;
|
|
1565
1204
|
}
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
bubbles: true,
|
|
1571
|
-
detail: {
|
|
1572
|
-
type: "item",
|
|
1573
|
-
id: identifier
|
|
1574
|
-
}
|
|
1575
|
-
})
|
|
1576
|
-
);
|
|
1205
|
+
#applyStyles() {
|
|
1206
|
+
const sheet = new CSSStyleSheet();
|
|
1207
|
+
sheet.replaceSync(item_default);
|
|
1208
|
+
this.shadowRoot.adoptedStyleSheets = [sheet];
|
|
1577
1209
|
}
|
|
1578
1210
|
render() {
|
|
1579
|
-
return T`
|
|
1211
|
+
return T`
|
|
1212
|
+
${this.#templateContent}
|
|
1213
|
+
<slot></slot>
|
|
1214
|
+
${m(this.testDoc, T`<span>Loading...</span>`)}
|
|
1215
|
+
`;
|
|
1580
1216
|
}
|
|
1581
1217
|
};
|
|
1582
|
-
|
|
1218
|
+
__decorate9([
|
|
1219
|
+
n2({ attribute: false })
|
|
1220
|
+
], TestContainer.prototype, "customElementRegistry", void 0);
|
|
1221
|
+
__decorate9([
|
|
1222
|
+
n2({ type: String, attribute: "test-url" })
|
|
1223
|
+
], TestContainer.prototype, "testURL", void 0);
|
|
1224
|
+
__decorate9([
|
|
1225
|
+
r()
|
|
1226
|
+
], TestContainer.prototype, "testDoc", void 0);
|
|
1227
|
+
__decorate9([
|
|
1228
|
+
r()
|
|
1229
|
+
], TestContainer.prototype, "testXML", void 0);
|
|
1230
|
+
__decorate9([
|
|
1231
|
+
r(),
|
|
1232
|
+
c({ context: qtiContext, subscribe: true })
|
|
1233
|
+
], TestContainer.prototype, "qtiContext", void 0);
|
|
1234
|
+
__decorate9([
|
|
1235
|
+
watch("testURL", { waitUntilFirstUpdate: true })
|
|
1236
|
+
], TestContainer.prototype, "handleTestURLChange", null);
|
|
1237
|
+
__decorate9([
|
|
1238
|
+
watch("testXML", { waitUntilFirstUpdate: true })
|
|
1239
|
+
], TestContainer.prototype, "handleTestXMLChange", null);
|
|
1240
|
+
|
|
1241
|
+
// ../qti-test/dist/components/test-end-attempt/test-end-attempt.js
|
|
1242
|
+
var TestEndAttempt = class extends i2 {
|
|
1243
|
+
static {
|
|
1244
|
+
this.styles = i`
|
|
1583
1245
|
:host {
|
|
1584
1246
|
${btn};
|
|
1585
1247
|
}
|
|
@@ -1587,15 +1249,7 @@ TestItemLink.styles = i`
|
|
|
1587
1249
|
${dis};
|
|
1588
1250
|
}
|
|
1589
1251
|
`;
|
|
1590
|
-
|
|
1591
|
-
n({ type: String, attribute: "item-id" })
|
|
1592
|
-
], TestItemLink.prototype, "itemId", 2);
|
|
1593
|
-
TestItemLink = __decorateClass([
|
|
1594
|
-
t("test-item-link")
|
|
1595
|
-
], TestItemLink);
|
|
1596
|
-
|
|
1597
|
-
// ../qti-test/src/components/test-end-attempt/test-end-attempt.ts
|
|
1598
|
-
var TestEndAttempt = class extends i2 {
|
|
1252
|
+
}
|
|
1599
1253
|
constructor() {
|
|
1600
1254
|
super();
|
|
1601
1255
|
this.addEventListener("click", () => this.dispatchEvent(new CustomEvent("test-end-attempt", { bubbles: true })));
|
|
@@ -1604,7 +1258,17 @@ var TestEndAttempt = class extends i2 {
|
|
|
1604
1258
|
return T` <slot></slot> `;
|
|
1605
1259
|
}
|
|
1606
1260
|
};
|
|
1607
|
-
|
|
1261
|
+
|
|
1262
|
+
// ../qti-test/dist/components/test-item-link/test-item-link.js
|
|
1263
|
+
var __decorate10 = function(decorators, target, key, desc) {
|
|
1264
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1265
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
1266
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
1267
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
1268
|
+
};
|
|
1269
|
+
var TestItemLink = class extends i2 {
|
|
1270
|
+
static {
|
|
1271
|
+
this.styles = i`
|
|
1608
1272
|
:host {
|
|
1609
1273
|
${btn};
|
|
1610
1274
|
}
|
|
@@ -1612,333 +1276,828 @@ TestEndAttempt.styles = i`
|
|
|
1612
1276
|
${dis};
|
|
1613
1277
|
}
|
|
1614
1278
|
`;
|
|
1615
|
-
|
|
1616
|
-
t("test-end-attempt")
|
|
1617
|
-
], TestEndAttempt);
|
|
1618
|
-
|
|
1619
|
-
// ../qti-test/src/components/test-show-correct-response/test-show-correct-response.ts
|
|
1620
|
-
var _previousActiveItem, _TestShowCorrectResponse_instances, toggleState_fn, getDisplayedText_fn;
|
|
1621
|
-
var TestShowCorrectResponse = class extends i2 {
|
|
1279
|
+
}
|
|
1622
1280
|
constructor() {
|
|
1623
|
-
super(
|
|
1624
|
-
|
|
1625
|
-
this.
|
|
1626
|
-
this.disabled = false;
|
|
1627
|
-
this.showCorrectText = "Show correct response";
|
|
1628
|
-
this.hideCorrectText = "Hide correct response";
|
|
1629
|
-
this.noCorrectResponseText = "No correct response specified";
|
|
1630
|
-
__privateAdd(this, _previousActiveItem);
|
|
1281
|
+
super();
|
|
1282
|
+
this.itemId = null;
|
|
1283
|
+
this.addEventListener("click", () => this._requestItem(this.itemId));
|
|
1631
1284
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
const containsMapping = !!activeItem?.variables?.some((v2) => {
|
|
1642
|
-
return v2["mapping"]?.mapEntries?.length > 0 || v2["areaMapping"]?.areaMapEntries?.length > 0;
|
|
1643
|
-
});
|
|
1644
|
-
this.disabled = !containsCorrectResponse && !containsMapping;
|
|
1645
|
-
} else {
|
|
1646
|
-
this.disabled = true;
|
|
1647
|
-
}
|
|
1285
|
+
_requestItem(identifier) {
|
|
1286
|
+
this.dispatchEvent(new CustomEvent("qti-request-navigation", {
|
|
1287
|
+
composed: true,
|
|
1288
|
+
bubbles: true,
|
|
1289
|
+
detail: {
|
|
1290
|
+
type: "item",
|
|
1291
|
+
id: identifier
|
|
1292
|
+
}
|
|
1293
|
+
}));
|
|
1648
1294
|
}
|
|
1649
1295
|
render() {
|
|
1650
|
-
return T` <
|
|
1296
|
+
return T` <slot></slot> `;
|
|
1651
1297
|
}
|
|
1652
1298
|
};
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1299
|
+
__decorate10([
|
|
1300
|
+
n2({ type: String, attribute: "item-id" })
|
|
1301
|
+
], TestItemLink.prototype, "itemId", void 0);
|
|
1302
|
+
|
|
1303
|
+
// ../qti-test/dist/components/test-item-to-speech/test-item-to-speech.js
|
|
1304
|
+
var __decorate11 = function(decorators, target, key, desc) {
|
|
1305
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1306
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
1307
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
1308
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
1309
|
+
};
|
|
1310
|
+
var HIGHLIGHT_ELEMENT = "tts-element";
|
|
1311
|
+
var HIGHLIGHT_WORD = "tts-word";
|
|
1312
|
+
var highlightSheet = null;
|
|
1313
|
+
function getHighlightSheet() {
|
|
1314
|
+
if (!highlightSheet) {
|
|
1315
|
+
highlightSheet = new CSSStyleSheet();
|
|
1316
|
+
highlightSheet.replaceSync(`
|
|
1317
|
+
::highlight(${HIGHLIGHT_ELEMENT}) { background-color: #dbeafe; color: inherit; }
|
|
1318
|
+
::highlight(${HIGHLIGHT_WORD}) { background-color: #ffe066; color: inherit; }
|
|
1319
|
+
`);
|
|
1320
|
+
}
|
|
1321
|
+
return highlightSheet;
|
|
1322
|
+
}
|
|
1323
|
+
var ttsContext = n(/* @__PURE__ */ Symbol("tts-context"));
|
|
1324
|
+
var TtsButtonBase = class extends i2 {
|
|
1325
|
+
static {
|
|
1326
|
+
this.styles = i`
|
|
1669
1327
|
:host {
|
|
1670
|
-
|
|
1328
|
+
display: inline-block;
|
|
1671
1329
|
}
|
|
1672
|
-
|
|
1673
|
-
|
|
1330
|
+
button {
|
|
1331
|
+
cursor: pointer;
|
|
1332
|
+
}
|
|
1333
|
+
button:disabled {
|
|
1334
|
+
opacity: 0.4;
|
|
1335
|
+
cursor: default;
|
|
1674
1336
|
}
|
|
1675
1337
|
`;
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
};
|
|
1744
|
-
var N = class _N {
|
|
1745
|
-
constructor({ strings: t3, _$litType$: s2 }, n3) {
|
|
1746
|
-
let r4;
|
|
1747
|
-
this.parts = [];
|
|
1748
|
-
let c3 = 0, a2 = 0;
|
|
1749
|
-
const u2 = t3.length - 1, d2 = this.parts, [f2, v2] = V(t3, s2);
|
|
1750
|
-
if (this.el = _N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
|
|
1751
|
-
const t4 = this.el.content.firstChild;
|
|
1752
|
-
t4.replaceWith(...t4.childNodes);
|
|
1753
|
-
}
|
|
1754
|
-
for (; null !== (r4 = C.nextNode()) && d2.length < u2; ) {
|
|
1755
|
-
if (1 === r4.nodeType) {
|
|
1756
|
-
if (r4.hasAttributes()) for (const t4 of r4.getAttributeNames()) if (t4.endsWith(e2)) {
|
|
1757
|
-
const i5 = v2[a2++], s3 = r4.getAttribute(t4).split(h), e3 = /([.?@])?(.*)/.exec(i5);
|
|
1758
|
-
d2.push({ type: 1, index: c3, name: e3[2], strings: s3, ctor: "." === e3[1] ? H : "?" === e3[1] ? I : "@" === e3[1] ? L : R }), r4.removeAttribute(t4);
|
|
1759
|
-
} else t4.startsWith(h) && (d2.push({ type: 6, index: c3 }), r4.removeAttribute(t4));
|
|
1760
|
-
if ($.test(r4.tagName)) {
|
|
1761
|
-
const t4 = r4.textContent.split(h), s3 = t4.length - 1;
|
|
1762
|
-
if (s3 > 0) {
|
|
1763
|
-
r4.textContent = i3 ? i3.emptyScript : "";
|
|
1764
|
-
for (let i5 = 0; i5 < s3; i5++) r4.append(t4[i5], l()), C.nextNode(), d2.push({ type: 2, index: ++c3 });
|
|
1765
|
-
r4.append(t4[s3], l());
|
|
1766
|
-
}
|
|
1767
|
-
}
|
|
1768
|
-
} else if (8 === r4.nodeType) if (r4.data === o) d2.push({ type: 2, index: c3 });
|
|
1769
|
-
else {
|
|
1770
|
-
let t4 = -1;
|
|
1771
|
-
for (; -1 !== (t4 = r4.data.indexOf(h, t4 + 1)); ) d2.push({ type: 7, index: c3 }), t4 += h.length - 1;
|
|
1772
|
-
}
|
|
1773
|
-
c3++;
|
|
1338
|
+
}
|
|
1339
|
+
#internals = this.attachInternals();
|
|
1340
|
+
updated(changed) {
|
|
1341
|
+
if (changed.has("_tts")) {
|
|
1342
|
+
this.#internals.states.clear();
|
|
1343
|
+
if (this._tts?.state)
|
|
1344
|
+
this.#internals.states.add(this._tts.state);
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
__decorate11([
|
|
1349
|
+
c({ context: ttsContext, subscribe: true })
|
|
1350
|
+
], TtsButtonBase.prototype, "_tts", void 0);
|
|
1351
|
+
var TestItemToSpeech = class extends i2 {
|
|
1352
|
+
#internals;
|
|
1353
|
+
#itemElements;
|
|
1354
|
+
#boundHandleItemConnected;
|
|
1355
|
+
#eventHost;
|
|
1356
|
+
// Current set of block-level reading elements for the active item
|
|
1357
|
+
#readingElements;
|
|
1358
|
+
#currentElementIndex;
|
|
1359
|
+
// Text nodes of the element currently being spoken (for word-boundary highlight)
|
|
1360
|
+
#textNodes;
|
|
1361
|
+
// Two separate CSS Highlight objects
|
|
1362
|
+
#elementHighlight;
|
|
1363
|
+
// whole-element cursor
|
|
1364
|
+
#wordHighlight;
|
|
1365
|
+
// current word during speech
|
|
1366
|
+
// Tracks previous navItemRefId to detect item switches
|
|
1367
|
+
#prevNavItemRefId;
|
|
1368
|
+
#boundHandleNavigation;
|
|
1369
|
+
constructor() {
|
|
1370
|
+
super();
|
|
1371
|
+
this.language = "nl-NL";
|
|
1372
|
+
this.#internals = this.attachInternals();
|
|
1373
|
+
this.#itemElements = /* @__PURE__ */ new Map();
|
|
1374
|
+
this.#boundHandleItemConnected = this.#handleItemConnected.bind(this);
|
|
1375
|
+
this.#eventHost = null;
|
|
1376
|
+
this.#readingElements = null;
|
|
1377
|
+
this.#currentElementIndex = 0;
|
|
1378
|
+
this.#textNodes = [];
|
|
1379
|
+
this.#elementHighlight = new Highlight();
|
|
1380
|
+
this.#wordHighlight = new Highlight();
|
|
1381
|
+
this.#prevNavItemRefId = void 0;
|
|
1382
|
+
this.#boundHandleNavigation = () => this.#stop();
|
|
1383
|
+
this._ttsContext = {
|
|
1384
|
+
state: "idle",
|
|
1385
|
+
currentElementIndex: 0,
|
|
1386
|
+
elementCount: 0,
|
|
1387
|
+
play: () => this.#playSpeech(),
|
|
1388
|
+
pause: () => this.#pause(),
|
|
1389
|
+
resume: () => this.#resume(),
|
|
1390
|
+
stop: () => this.#stop(),
|
|
1391
|
+
prevElement: () => this.#prevElement(),
|
|
1392
|
+
nextElement: () => this.#nextElement()
|
|
1393
|
+
};
|
|
1394
|
+
}
|
|
1395
|
+
willUpdate(changed) {
|
|
1396
|
+
void changed;
|
|
1397
|
+
}
|
|
1398
|
+
updated(_changed) {
|
|
1399
|
+
const current = this._sessionContext?.navItemRefId ?? null;
|
|
1400
|
+
if (this.#prevNavItemRefId !== void 0 && this.#prevNavItemRefId !== current) {
|
|
1401
|
+
this.#stop();
|
|
1402
|
+
this.#readingElements = null;
|
|
1403
|
+
this.#currentElementIndex = 0;
|
|
1404
|
+
this.#updateContext();
|
|
1774
1405
|
}
|
|
1406
|
+
this.#prevNavItemRefId = current;
|
|
1775
1407
|
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1408
|
+
connectedCallback() {
|
|
1409
|
+
super.connectedCallback();
|
|
1410
|
+
this.#setSpeechState("idle");
|
|
1411
|
+
this.#eventHost = this.closest("test-navigation") ?? this.closest("qti-test") ?? this.getRootNode();
|
|
1412
|
+
this.#eventHost.addEventListener("qti-assessment-item-connected", this.#boundHandleItemConnected);
|
|
1413
|
+
this.#eventHost.addEventListener("qti-request-navigation", this.#boundHandleNavigation);
|
|
1414
|
+
}
|
|
1415
|
+
disconnectedCallback() {
|
|
1416
|
+
super.disconnectedCallback();
|
|
1417
|
+
speechSynthesis.cancel();
|
|
1418
|
+
this.#clearAllHighlights();
|
|
1419
|
+
this.#eventHost?.removeEventListener("qti-assessment-item-connected", this.#boundHandleItemConnected);
|
|
1420
|
+
this.#eventHost?.removeEventListener("qti-request-navigation", this.#boundHandleNavigation);
|
|
1421
|
+
this.#eventHost = null;
|
|
1422
|
+
this.#itemElements.clear();
|
|
1779
1423
|
}
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1424
|
+
render() {
|
|
1425
|
+
return T`<slot></slot>`;
|
|
1426
|
+
}
|
|
1427
|
+
#handleItemConnected(event) {
|
|
1428
|
+
const item = event.detail;
|
|
1429
|
+
if (item?.identifier) {
|
|
1430
|
+
this.#itemElements.set(item.identifier, item);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
/** Update speech state on both the context (notifies children) and the host's CSS custom states. */
|
|
1434
|
+
#setSpeechState(state) {
|
|
1435
|
+
this._ttsContext = { ...this._ttsContext, state };
|
|
1436
|
+
this.#internals.states.delete("idle");
|
|
1437
|
+
this.#internals.states.delete("playing");
|
|
1438
|
+
this.#internals.states.delete("paused");
|
|
1439
|
+
this.#internals.states.add(state);
|
|
1440
|
+
}
|
|
1441
|
+
/** Push currentElementIndex and elementCount into context so children can react. */
|
|
1442
|
+
#updateContext() {
|
|
1443
|
+
this._ttsContext = {
|
|
1444
|
+
...this._ttsContext,
|
|
1445
|
+
currentElementIndex: this.#currentElementIndex,
|
|
1446
|
+
elementCount: this.#readingElements?.length ?? 0
|
|
1447
|
+
};
|
|
1448
|
+
}
|
|
1449
|
+
/** Return cached reading elements, collecting them lazily on first call for the active item. */
|
|
1450
|
+
#getReadingElements() {
|
|
1451
|
+
if (this.#readingElements !== null)
|
|
1452
|
+
return this.#readingElements;
|
|
1453
|
+
const identifier = this._sessionContext?.navItemRefId;
|
|
1454
|
+
if (!identifier)
|
|
1455
|
+
return [];
|
|
1456
|
+
const assessmentItem = this.#itemElements.get(identifier);
|
|
1457
|
+
if (!assessmentItem)
|
|
1458
|
+
return [];
|
|
1459
|
+
const itemBody = assessmentItem.querySelector("qti-item-body");
|
|
1460
|
+
if (!itemBody)
|
|
1461
|
+
return [];
|
|
1462
|
+
const selector = "p, h1, h2, h3, h4, h5, h6, li, blockquote, figcaption";
|
|
1463
|
+
this.#readingElements = Array.from(itemBody.querySelectorAll(selector)).filter((el) => (el.textContent ?? "").trim().length > 0);
|
|
1464
|
+
return this.#readingElements;
|
|
1465
|
+
}
|
|
1466
|
+
#playSpeech() {
|
|
1467
|
+
const elements = this.#getReadingElements();
|
|
1468
|
+
if (!elements.length) {
|
|
1469
|
+
console.warn("test-item-to-speech: no readable elements found in qti-item-body");
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
this.#speakElement(this.#currentElementIndex);
|
|
1473
|
+
}
|
|
1474
|
+
/** Speak the element at the given index, then auto-advance when it ends. */
|
|
1475
|
+
#speakElement(index) {
|
|
1476
|
+
const elements = this.#readingElements ?? [];
|
|
1477
|
+
if (index >= elements.length) {
|
|
1478
|
+
this.#clearWordHighlight();
|
|
1479
|
+
this.#currentElementIndex = elements.length - 1;
|
|
1480
|
+
if (elements.length > 0)
|
|
1481
|
+
this.#highlightElement(elements[this.#currentElementIndex]);
|
|
1482
|
+
this.#setSpeechState("idle");
|
|
1483
|
+
this.#updateContext();
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
this.#currentElementIndex = index;
|
|
1487
|
+
this.#updateContext();
|
|
1488
|
+
const element = elements[index];
|
|
1489
|
+
element.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
1490
|
+
this.#highlightElement(element);
|
|
1491
|
+
this.#textNodes = this.#collectTextNodes(element);
|
|
1492
|
+
const text = this.#textNodes.map((n3) => n3.textContent ?? "").join("");
|
|
1493
|
+
if (!text.trim()) {
|
|
1494
|
+
this.#speakElement(index + 1);
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
const utterance = new SpeechSynthesisUtterance(text);
|
|
1498
|
+
utterance.lang = this.language;
|
|
1499
|
+
utterance.rate = 1;
|
|
1500
|
+
utterance.onboundary = (event) => {
|
|
1501
|
+
if (event.name !== "word")
|
|
1502
|
+
return;
|
|
1503
|
+
this.#updateWordHighlight(event.charIndex, event.charLength ?? 0);
|
|
1504
|
+
};
|
|
1505
|
+
utterance.onend = () => {
|
|
1506
|
+
this.#clearWordHighlight();
|
|
1507
|
+
this.#speakElement(this.#currentElementIndex + 1);
|
|
1508
|
+
};
|
|
1509
|
+
speechSynthesis.speak(utterance);
|
|
1510
|
+
this.#setSpeechState("playing");
|
|
1511
|
+
}
|
|
1512
|
+
#pause() {
|
|
1513
|
+
speechSynthesis.pause();
|
|
1514
|
+
this.#setSpeechState("paused");
|
|
1790
1515
|
}
|
|
1791
|
-
|
|
1792
|
-
|
|
1516
|
+
#resume() {
|
|
1517
|
+
speechSynthesis.resume();
|
|
1518
|
+
this.#setSpeechState("playing");
|
|
1793
1519
|
}
|
|
1794
|
-
|
|
1795
|
-
|
|
1520
|
+
#stop() {
|
|
1521
|
+
speechSynthesis.cancel();
|
|
1522
|
+
this.#clearAllHighlights();
|
|
1523
|
+
this.#setSpeechState("idle");
|
|
1524
|
+
}
|
|
1525
|
+
#prevElement() {
|
|
1526
|
+
const elements = this.#getReadingElements();
|
|
1527
|
+
if (!elements.length)
|
|
1528
|
+
return;
|
|
1529
|
+
speechSynthesis.cancel();
|
|
1530
|
+
this.#clearWordHighlight();
|
|
1531
|
+
this.#currentElementIndex = Math.max(0, this.#currentElementIndex - 1);
|
|
1532
|
+
this.#updateContext();
|
|
1533
|
+
const el = elements[this.#currentElementIndex];
|
|
1534
|
+
el.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
1535
|
+
this.#highlightElement(el);
|
|
1536
|
+
this.#setSpeechState("idle");
|
|
1537
|
+
}
|
|
1538
|
+
#nextElement() {
|
|
1539
|
+
const elements = this.#getReadingElements();
|
|
1540
|
+
if (!elements.length)
|
|
1541
|
+
return;
|
|
1542
|
+
speechSynthesis.cancel();
|
|
1543
|
+
this.#clearWordHighlight();
|
|
1544
|
+
this.#currentElementIndex = Math.min(elements.length - 1, this.#currentElementIndex + 1);
|
|
1545
|
+
this.#updateContext();
|
|
1546
|
+
const el = elements[this.#currentElementIndex];
|
|
1547
|
+
el.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
1548
|
+
this.#highlightElement(el);
|
|
1549
|
+
this.#setSpeechState("idle");
|
|
1550
|
+
}
|
|
1551
|
+
/** Walk text nodes without crossing shadow DOM boundaries. */
|
|
1552
|
+
#collectTextNodes(root) {
|
|
1553
|
+
const nodes = [];
|
|
1554
|
+
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
|
1555
|
+
let node;
|
|
1556
|
+
while (node = walker.nextNode()) {
|
|
1557
|
+
if ((node.textContent ?? "").length > 0) {
|
|
1558
|
+
nodes.push(node);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
return nodes;
|
|
1796
1562
|
}
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1563
|
+
/** Highlight the whole element as the navigation cursor (blue). */
|
|
1564
|
+
#highlightElement(element) {
|
|
1565
|
+
if (!("highlights" in CSS))
|
|
1566
|
+
return;
|
|
1567
|
+
this.#ensureHighlightStyles();
|
|
1568
|
+
this.#elementHighlight.clear();
|
|
1569
|
+
const range = new Range();
|
|
1570
|
+
range.selectNodeContents(element);
|
|
1571
|
+
this.#elementHighlight.add(range);
|
|
1572
|
+
CSS.highlights.set(HIGHLIGHT_ELEMENT, this.#elementHighlight);
|
|
1573
|
+
}
|
|
1574
|
+
/** Highlight the current word within #textNodes (yellow, during speech). */
|
|
1575
|
+
#updateWordHighlight(charIndex, charLength) {
|
|
1576
|
+
if (!("highlights" in CSS))
|
|
1577
|
+
return;
|
|
1578
|
+
this.#ensureHighlightStyles();
|
|
1579
|
+
this.#wordHighlight.clear();
|
|
1580
|
+
const text = this.#textNodes.map((n3) => n3.textContent ?? "").join("");
|
|
1581
|
+
const endIndex = charIndex + (charLength > 0 ? charLength : this.#wordLengthAt(charIndex, text));
|
|
1582
|
+
let offset = 0;
|
|
1583
|
+
let startNode = null;
|
|
1584
|
+
let startOffset = 0;
|
|
1585
|
+
let endNode = null;
|
|
1586
|
+
let endOffset = 0;
|
|
1587
|
+
for (const node of this.#textNodes) {
|
|
1588
|
+
const len = node.textContent?.length ?? 0;
|
|
1589
|
+
if (!startNode && offset + len > charIndex) {
|
|
1590
|
+
startNode = node;
|
|
1591
|
+
startOffset = charIndex - offset;
|
|
1592
|
+
}
|
|
1593
|
+
if (startNode && offset + len >= endIndex) {
|
|
1594
|
+
endNode = node;
|
|
1595
|
+
endOffset = endIndex - offset;
|
|
1596
|
+
break;
|
|
1805
1597
|
}
|
|
1806
|
-
|
|
1598
|
+
offset += len;
|
|
1599
|
+
}
|
|
1600
|
+
if (startNode && endNode) {
|
|
1601
|
+
const range = new Range();
|
|
1602
|
+
range.setStart(startNode, startOffset);
|
|
1603
|
+
range.setEnd(endNode, endOffset);
|
|
1604
|
+
this.#wordHighlight.add(range);
|
|
1605
|
+
CSS.highlights.set(HIGHLIGHT_WORD, this.#wordHighlight);
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
#clearWordHighlight() {
|
|
1609
|
+
if (!("highlights" in CSS))
|
|
1610
|
+
return;
|
|
1611
|
+
this.#wordHighlight.clear();
|
|
1612
|
+
CSS.highlights.delete(HIGHLIGHT_WORD);
|
|
1613
|
+
}
|
|
1614
|
+
#clearAllHighlights() {
|
|
1615
|
+
if (!("highlights" in CSS))
|
|
1616
|
+
return;
|
|
1617
|
+
this.#wordHighlight.clear();
|
|
1618
|
+
CSS.highlights.delete(HIGHLIGHT_WORD);
|
|
1619
|
+
this.#elementHighlight.clear();
|
|
1620
|
+
CSS.highlights.delete(HIGHLIGHT_ELEMENT);
|
|
1621
|
+
}
|
|
1622
|
+
/** Fallback word-length when charLength is 0. */
|
|
1623
|
+
#wordLengthAt(charIndex, text) {
|
|
1624
|
+
const right = text.slice(charIndex).search(/\s/);
|
|
1625
|
+
return right < 0 ? text.length - charIndex : right;
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Add ::highlight() rules both to test-container's shadow root (where highlighted
|
|
1629
|
+
* text lives) and to the document (safety net — spec allows document rules to apply
|
|
1630
|
+
* across shadow DOM). Called lazily on first highlight use so test-container is
|
|
1631
|
+
* guaranteed to be in the DOM by the time navigation or speech starts.
|
|
1632
|
+
*/
|
|
1633
|
+
#ensureHighlightStyles() {
|
|
1634
|
+
if (!("highlights" in CSS))
|
|
1635
|
+
return;
|
|
1636
|
+
const sheet = getHighlightSheet();
|
|
1637
|
+
if (!document.adoptedStyleSheets.includes(sheet)) {
|
|
1638
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
|
|
1807
1639
|
}
|
|
1808
|
-
|
|
1640
|
+
const testContainer = this.closest("test-navigation")?.querySelector("test-container") ?? this.closest("qti-test")?.querySelector("test-container");
|
|
1641
|
+
const root = testContainer?.shadowRoot;
|
|
1642
|
+
if (root && !root.adoptedStyleSheets.includes(sheet)) {
|
|
1643
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
};
|
|
1647
|
+
__decorate11([
|
|
1648
|
+
n2({ type: String })
|
|
1649
|
+
], TestItemToSpeech.prototype, "language", void 0);
|
|
1650
|
+
__decorate11([
|
|
1651
|
+
c({ context: sessionContext, subscribe: true })
|
|
1652
|
+
], TestItemToSpeech.prototype, "_sessionContext", void 0);
|
|
1653
|
+
__decorate11([
|
|
1654
|
+
r(),
|
|
1655
|
+
e({ context: ttsContext })
|
|
1656
|
+
], TestItemToSpeech.prototype, "_ttsContext", void 0);
|
|
1657
|
+
var TestTtsPlay = class extends TtsButtonBase {
|
|
1658
|
+
#toggle() {
|
|
1659
|
+
if (!this._tts)
|
|
1660
|
+
return;
|
|
1661
|
+
if (this._tts.state === "idle")
|
|
1662
|
+
this._tts.play();
|
|
1663
|
+
else if (this._tts.state === "playing")
|
|
1664
|
+
this._tts.pause();
|
|
1665
|
+
else
|
|
1666
|
+
this._tts.resume();
|
|
1667
|
+
}
|
|
1668
|
+
render() {
|
|
1669
|
+
const playing = this._tts?.state === "playing";
|
|
1670
|
+
return T`
|
|
1671
|
+
<button part="button" @click=${this.#toggle}>
|
|
1672
|
+
${playing ? T`<slot name="pause">⏸</slot>` : T`<slot name="play">▶</slot>`}
|
|
1673
|
+
</button>
|
|
1674
|
+
`;
|
|
1675
|
+
}
|
|
1676
|
+
};
|
|
1677
|
+
var TestTtsPause = class extends TtsButtonBase {
|
|
1678
|
+
render() {
|
|
1679
|
+
return T`
|
|
1680
|
+
<button part="button" ?disabled=${this._tts?.state !== "playing"} @click=${() => this._tts?.pause()}>
|
|
1681
|
+
<slot>⏸</slot>
|
|
1682
|
+
</button>
|
|
1683
|
+
`;
|
|
1684
|
+
}
|
|
1685
|
+
};
|
|
1686
|
+
var TestTtsResume = class extends TtsButtonBase {
|
|
1687
|
+
render() {
|
|
1688
|
+
return T`
|
|
1689
|
+
<button part="button" ?disabled=${this._tts?.state !== "paused"} @click=${() => this._tts?.resume()}>
|
|
1690
|
+
<slot>▶</slot>
|
|
1691
|
+
</button>
|
|
1692
|
+
`;
|
|
1809
1693
|
}
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1694
|
+
};
|
|
1695
|
+
var TestTtsStop = class extends TtsButtonBase {
|
|
1696
|
+
render() {
|
|
1697
|
+
return T`
|
|
1698
|
+
<button part="button" ?disabled=${this._tts?.state === "idle"} @click=${() => this._tts?.stop()}>
|
|
1699
|
+
<slot>■</slot>
|
|
1700
|
+
</button>
|
|
1701
|
+
`;
|
|
1813
1702
|
}
|
|
1814
1703
|
};
|
|
1815
|
-
var
|
|
1816
|
-
|
|
1817
|
-
|
|
1704
|
+
var TestTtsPrev = class extends TtsButtonBase {
|
|
1705
|
+
render() {
|
|
1706
|
+
const atStart = (this._tts?.currentElementIndex ?? 0) === 0;
|
|
1707
|
+
const noElements = (this._tts?.elementCount ?? 0) === 0;
|
|
1708
|
+
return T`
|
|
1709
|
+
<button part="button" ?disabled=${noElements || atStart} @click=${() => this._tts?.prevElement()}>
|
|
1710
|
+
<slot>◀◀</slot>
|
|
1711
|
+
</button>
|
|
1712
|
+
`;
|
|
1818
1713
|
}
|
|
1819
|
-
|
|
1820
|
-
|
|
1714
|
+
};
|
|
1715
|
+
var TestTtsNext = class extends TtsButtonBase {
|
|
1716
|
+
render() {
|
|
1717
|
+
const atEnd = (this._tts?.elementCount ?? 0) > 0 && (this._tts?.currentElementIndex ?? 0) >= (this._tts?.elementCount ?? 0) - 1;
|
|
1718
|
+
const noElements = (this._tts?.elementCount ?? 0) === 0;
|
|
1719
|
+
return T`
|
|
1720
|
+
<button part="button" ?disabled=${noElements || atEnd} @click=${() => this._tts?.nextElement()}>
|
|
1721
|
+
<slot>▶▶</slot>
|
|
1722
|
+
</button>
|
|
1723
|
+
`;
|
|
1821
1724
|
}
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1725
|
+
};
|
|
1726
|
+
|
|
1727
|
+
// ../qti-test/dist/components/test-navigation/test-navigation.js
|
|
1728
|
+
var __decorate12 = function(decorators, target, key, desc) {
|
|
1729
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1730
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
1731
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
1732
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
1733
|
+
};
|
|
1734
|
+
var TestNavigation = class extends i2 {
|
|
1735
|
+
#testElement;
|
|
1736
|
+
constructor() {
|
|
1737
|
+
super();
|
|
1738
|
+
this.identifier = void 0;
|
|
1739
|
+
this.initContext = [];
|
|
1740
|
+
this.qtiContext = {
|
|
1741
|
+
QTI_CONTEXT: {
|
|
1742
|
+
testIdentifier: "",
|
|
1743
|
+
candidateIdentifier: "",
|
|
1744
|
+
environmentIdentifier: "default"
|
|
1745
|
+
}
|
|
1746
|
+
};
|
|
1747
|
+
this.configContext = {};
|
|
1748
|
+
this.autoScoreItems = false;
|
|
1749
|
+
this.addEventListener("qti-assessment-test-connected", this.#handleTestConnected.bind(this));
|
|
1750
|
+
this.addEventListener("qti-assessment-item-connected", this.#handleItemConnected.bind(this));
|
|
1751
|
+
this.addEventListener("qti-interaction-changed", this.#handleInteractionChanged.bind(this));
|
|
1752
|
+
this.addEventListener("test-end-attempt", this.#handleTestEndAttempt.bind(this));
|
|
1753
|
+
this.addEventListener("test-update-outcome-variable", this.#handleTestUpdateOutcomeVariable.bind(this));
|
|
1754
|
+
}
|
|
1755
|
+
/** The currently active assessment item, exposed for optional presentation extensions. */
|
|
1756
|
+
get activeAssessmentItem() {
|
|
1757
|
+
if (!this.#testElement || !this._sessionContext?.navItemRefId)
|
|
1758
|
+
return void 0;
|
|
1759
|
+
return this.#testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`)?.assessmentItem;
|
|
1826
1760
|
}
|
|
1827
|
-
|
|
1828
|
-
|
|
1761
|
+
/**
|
|
1762
|
+
* Handles the 'test-end-attempt' event.
|
|
1763
|
+
* @private
|
|
1764
|
+
* @listens TestNavigation#test-end-attempt
|
|
1765
|
+
* @param {CustomEvent} event - The custom event object.
|
|
1766
|
+
*/
|
|
1767
|
+
#handleTestEndAttempt(_event) {
|
|
1768
|
+
const qtiItemEl = this.#testElement.querySelector(`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`);
|
|
1769
|
+
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1770
|
+
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
1771
|
+
qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);
|
|
1772
|
+
}
|
|
1773
|
+
#handleTestUpdateOutcomeVariable(event) {
|
|
1774
|
+
const qtiItemEl = this.#testElement.querySelector(`qti-assessment-item-ref[identifier="${event.detail.assessmentItemRefId}"]`);
|
|
1775
|
+
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1776
|
+
qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);
|
|
1777
|
+
}
|
|
1778
|
+
#handleInteractionChanged(_event) {
|
|
1779
|
+
if (this.autoScoreItems) {
|
|
1780
|
+
const assessmentItem = _event.composedPath()[0].closest("qti-assessment-item");
|
|
1781
|
+
const scoreOutcomeIdentifier = assessmentItem.variables.find((v) => v.identifier === "SCORE");
|
|
1782
|
+
if (scoreOutcomeIdentifier && scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === "false") {
|
|
1783
|
+
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
1784
|
+
assessmentItem.processResponse(true, reportValidityAfterScoring);
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1829
1787
|
}
|
|
1830
|
-
|
|
1831
|
-
return
|
|
1788
|
+
render() {
|
|
1789
|
+
return T`<slot></slot>`;
|
|
1832
1790
|
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1791
|
+
/* PK: on test connected we can build the computed context */
|
|
1792
|
+
#handleTestConnected(event) {
|
|
1793
|
+
this.#testElement = event.detail;
|
|
1794
|
+
if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {
|
|
1795
|
+
const currentContext = this.qtiContext.QTI_CONTEXT || {
|
|
1796
|
+
testIdentifier: "",
|
|
1797
|
+
candidateIdentifier: "not set",
|
|
1798
|
+
environmentIdentifier: "default"
|
|
1799
|
+
};
|
|
1800
|
+
this.qtiContext = {
|
|
1801
|
+
QTI_CONTEXT: {
|
|
1802
|
+
...currentContext,
|
|
1803
|
+
testIdentifier: this.#testElement.identifier,
|
|
1804
|
+
environmentIdentifier: currentContext.environmentIdentifier || "default"
|
|
1805
|
+
}
|
|
1806
|
+
};
|
|
1807
|
+
}
|
|
1808
|
+
const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]');
|
|
1809
|
+
contextDeclarations.forEach((declaration) => {
|
|
1810
|
+
const defaultValues = this.#extractDefaultValues(declaration);
|
|
1811
|
+
if (Object.keys(defaultValues).length > 0) {
|
|
1812
|
+
this.qtiContext = {
|
|
1813
|
+
QTI_CONTEXT: {
|
|
1814
|
+
...defaultValues,
|
|
1815
|
+
// Default values first
|
|
1816
|
+
...this.qtiContext.QTI_CONTEXT
|
|
1817
|
+
// Runtime values override defaults
|
|
1818
|
+
}
|
|
1819
|
+
};
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
const testPartElements = Array.from(this.#testElement?.querySelectorAll(`qti-test-part`) || []);
|
|
1823
|
+
this.computedContext = {
|
|
1824
|
+
identifier: this.#testElement.identifier,
|
|
1825
|
+
title: this.#testElement.title,
|
|
1826
|
+
view: this._sessionContext?.view,
|
|
1827
|
+
testParts: testPartElements.map((testPart) => {
|
|
1828
|
+
const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
|
|
1829
|
+
return {
|
|
1830
|
+
active: false,
|
|
1831
|
+
identifier: testPart.identifier,
|
|
1832
|
+
navigationMode: testPart.navigationMode,
|
|
1833
|
+
submissionMode: testPart.submissionMode,
|
|
1834
|
+
sections: sectionElements.map((section) => {
|
|
1835
|
+
const itemElements = [...section.querySelectorAll(`qti-assessment-item-ref`)];
|
|
1836
|
+
return {
|
|
1837
|
+
active: false,
|
|
1838
|
+
identifier: section.identifier,
|
|
1839
|
+
title: section.title,
|
|
1840
|
+
items: itemElements.map((item) => ({
|
|
1841
|
+
...this.initContext?.find((i4) => i4.identifier === item.identifier),
|
|
1842
|
+
active: false,
|
|
1843
|
+
identifier: item.identifier,
|
|
1844
|
+
categories: item.category ? item.category?.split(" ") : [],
|
|
1845
|
+
href: item.href,
|
|
1846
|
+
variables: []
|
|
1847
|
+
}))
|
|
1848
|
+
};
|
|
1849
|
+
})
|
|
1850
|
+
};
|
|
1851
|
+
})
|
|
1852
|
+
};
|
|
1835
1853
|
}
|
|
1836
|
-
|
|
1837
|
-
|
|
1854
|
+
/**
|
|
1855
|
+
* Extract default values from a qti-context-declaration element
|
|
1856
|
+
*/
|
|
1857
|
+
#extractDefaultValues(declaration) {
|
|
1858
|
+
const defaultValues = {};
|
|
1859
|
+
const defaultValueElement = declaration.querySelector("qti-default-value");
|
|
1860
|
+
if (!defaultValueElement) {
|
|
1861
|
+
return defaultValues;
|
|
1862
|
+
}
|
|
1863
|
+
const valueElements = defaultValueElement.querySelectorAll("qti-value[field-identifier]");
|
|
1864
|
+
valueElements.forEach((valueElement) => {
|
|
1865
|
+
const fieldIdentifier = valueElement.getAttribute("field-identifier");
|
|
1866
|
+
const baseType = valueElement.getAttribute("base-type") || "string";
|
|
1867
|
+
const textContent = valueElement.textContent?.trim() || "";
|
|
1868
|
+
if (fieldIdentifier) {
|
|
1869
|
+
let value = textContent;
|
|
1870
|
+
switch (baseType) {
|
|
1871
|
+
case "integer":
|
|
1872
|
+
value = parseInt(textContent, 10);
|
|
1873
|
+
break;
|
|
1874
|
+
case "float":
|
|
1875
|
+
case "duration":
|
|
1876
|
+
value = parseFloat(textContent);
|
|
1877
|
+
break;
|
|
1878
|
+
case "boolean":
|
|
1879
|
+
value = textContent.toLowerCase() === "true";
|
|
1880
|
+
break;
|
|
1881
|
+
case "string":
|
|
1882
|
+
default:
|
|
1883
|
+
value = textContent;
|
|
1884
|
+
break;
|
|
1885
|
+
}
|
|
1886
|
+
defaultValues[fieldIdentifier] = value;
|
|
1887
|
+
}
|
|
1888
|
+
});
|
|
1889
|
+
return defaultValues;
|
|
1838
1890
|
}
|
|
1839
|
-
|
|
1840
|
-
|
|
1891
|
+
/* PK: on item connected we can add item only properties in the xml */
|
|
1892
|
+
#handleItemConnected(event) {
|
|
1893
|
+
const itemElement = event.detail;
|
|
1894
|
+
this.computedContext = {
|
|
1895
|
+
...this.computedContext,
|
|
1896
|
+
testParts: this.computedContext.testParts.map((testPart) => {
|
|
1897
|
+
return {
|
|
1898
|
+
...testPart,
|
|
1899
|
+
sections: testPart.sections.map((section) => {
|
|
1900
|
+
return {
|
|
1901
|
+
...section,
|
|
1902
|
+
items: section.items.map((item) => {
|
|
1903
|
+
if (item.identifier !== itemElement.parentElement.getAttribute("identifier")) {
|
|
1904
|
+
return item;
|
|
1905
|
+
}
|
|
1906
|
+
const scoreOutcome = itemElement.querySelector("qti-outcome-declaration[identifier='SCORE']");
|
|
1907
|
+
const externalScored = scoreOutcome?.getAttribute("externalScored");
|
|
1908
|
+
const responseDeclarations = itemElement.querySelectorAll("qti-response-declaration");
|
|
1909
|
+
const containsCorrectResponse = Array.from(responseDeclarations).some((r3) => r3.querySelector("qti-correct-response"));
|
|
1910
|
+
const containsMapping = Array.from(responseDeclarations).some((r3) => {
|
|
1911
|
+
const mapping = r3.querySelector("qti-mapping");
|
|
1912
|
+
const areaMapping = r3.querySelector("qti-area-mapping");
|
|
1913
|
+
return mapping?.querySelector("qti-map-entry") || areaMapping?.querySelector("qti-area-map-entry");
|
|
1914
|
+
});
|
|
1915
|
+
const hasCorrectResponse = containsCorrectResponse || containsMapping;
|
|
1916
|
+
const hasResponseProcessing = itemElement.querySelector("qti-response-processing") ? true : false;
|
|
1917
|
+
return {
|
|
1918
|
+
...item,
|
|
1919
|
+
assessmentItemIdentifier: itemElement.getAttribute("identifier"),
|
|
1920
|
+
label: itemElement.getAttribute("label"),
|
|
1921
|
+
title: itemElement.title,
|
|
1922
|
+
externalScored,
|
|
1923
|
+
adaptive: itemElement.adaptive == "true" || false,
|
|
1924
|
+
timeDependent: itemElement.timeDependent == "true" || false,
|
|
1925
|
+
variables: itemElement.variables,
|
|
1926
|
+
hasCorrectResponse,
|
|
1927
|
+
hasResponseProcessing
|
|
1928
|
+
};
|
|
1929
|
+
})
|
|
1930
|
+
};
|
|
1931
|
+
})
|
|
1932
|
+
};
|
|
1933
|
+
})
|
|
1934
|
+
};
|
|
1841
1935
|
}
|
|
1842
|
-
|
|
1843
|
-
|
|
1936
|
+
/* PK: on every change of the candidate we will recomputed the computedContext */
|
|
1937
|
+
willUpdate(_changedProperties) {
|
|
1938
|
+
if (!this.computedContext)
|
|
1939
|
+
return;
|
|
1940
|
+
let itemIndex = 1;
|
|
1941
|
+
this.computedContext = {
|
|
1942
|
+
...this.computedContext,
|
|
1943
|
+
view: this._sessionContext?.view,
|
|
1944
|
+
testParts: this.computedContext.testParts.map((testPart) => {
|
|
1945
|
+
return {
|
|
1946
|
+
...testPart,
|
|
1947
|
+
active: this._sessionContext?.navPartId === testPart.identifier || false,
|
|
1948
|
+
sections: testPart.sections.map((section) => {
|
|
1949
|
+
return {
|
|
1950
|
+
...section,
|
|
1951
|
+
active: this._sessionContext?.navSectionId === section.identifier || false,
|
|
1952
|
+
completed: section.items.every((item) => this._testContext.items.find((i4) => i4.identifier === item.identifier)?.variables.find((v) => v.identifier === "completionStatus").value === "completed"),
|
|
1953
|
+
items: section.items.map((item) => {
|
|
1954
|
+
const itemContext = this._testContext?.items.find((i4) => i4.identifier === item.identifier);
|
|
1955
|
+
const computedItem = {
|
|
1956
|
+
...item,
|
|
1957
|
+
...itemContext,
|
|
1958
|
+
...this.initContext?.find((i4) => i4.identifier === item.identifier)
|
|
1959
|
+
};
|
|
1960
|
+
const rawscore = computedItem.variables?.find((vr) => vr.identifier == "SCORE")?.value;
|
|
1961
|
+
const score = rawscore === void 0 || rawscore === null ? null : parseFloat(rawscore?.toString());
|
|
1962
|
+
const completionStatus = computedItem.variables?.find((v) => v.identifier === "completionStatus")?.value;
|
|
1963
|
+
const response = computedItem.variables?.find((v) => v.identifier === "RESPONSE")?.value || "";
|
|
1964
|
+
const numAttempts = computedItem.variables?.find((v) => v.identifier === "numAttempts")?.value || 0;
|
|
1965
|
+
const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;
|
|
1966
|
+
const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;
|
|
1967
|
+
const rawMaxScore = item.variables?.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
1968
|
+
const maxScore = rawMaxScore === void 0 || rawMaxScore === null ? null : parseFloat(rawMaxScore?.toString());
|
|
1969
|
+
return {
|
|
1970
|
+
...computedItem,
|
|
1971
|
+
completionStatus,
|
|
1972
|
+
numAttempts,
|
|
1973
|
+
score,
|
|
1974
|
+
response,
|
|
1975
|
+
index,
|
|
1976
|
+
active,
|
|
1977
|
+
maxScore
|
|
1978
|
+
// type,
|
|
1979
|
+
// correct,
|
|
1980
|
+
// incorrect,
|
|
1981
|
+
// completed
|
|
1982
|
+
};
|
|
1983
|
+
})
|
|
1984
|
+
};
|
|
1985
|
+
})
|
|
1986
|
+
};
|
|
1987
|
+
})
|
|
1988
|
+
};
|
|
1989
|
+
this.dispatchEvent(new CustomEvent("qti-computed-context-updated", {
|
|
1990
|
+
detail: this.computedContext,
|
|
1991
|
+
bubbles: true
|
|
1992
|
+
}));
|
|
1844
1993
|
}
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1994
|
+
};
|
|
1995
|
+
__decorate12([
|
|
1996
|
+
n2({ type: String })
|
|
1997
|
+
], TestNavigation.prototype, "identifier", void 0);
|
|
1998
|
+
__decorate12([
|
|
1999
|
+
r()
|
|
2000
|
+
], TestNavigation.prototype, "initContext", void 0);
|
|
2001
|
+
__decorate12([
|
|
2002
|
+
r(),
|
|
2003
|
+
e({ context: qtiContext })
|
|
2004
|
+
], TestNavigation.prototype, "qtiContext", void 0);
|
|
2005
|
+
__decorate12([
|
|
2006
|
+
r(),
|
|
2007
|
+
c({ context: configContext, subscribe: true })
|
|
2008
|
+
], TestNavigation.prototype, "configContext", void 0);
|
|
2009
|
+
__decorate12([
|
|
2010
|
+
r(),
|
|
2011
|
+
c({ context: testContext, subscribe: true })
|
|
2012
|
+
], TestNavigation.prototype, "_testContext", void 0);
|
|
2013
|
+
__decorate12([
|
|
2014
|
+
r(),
|
|
2015
|
+
c({ context: sessionContext, subscribe: true })
|
|
2016
|
+
], TestNavigation.prototype, "_sessionContext", void 0);
|
|
2017
|
+
__decorate12([
|
|
2018
|
+
r(),
|
|
2019
|
+
e({ context: computedContext })
|
|
2020
|
+
], TestNavigation.prototype, "computedContext", void 0);
|
|
2021
|
+
__decorate12([
|
|
2022
|
+
n2({ type: Boolean, attribute: "auto-score-items" })
|
|
2023
|
+
], TestNavigation.prototype, "autoScoreItems", void 0);
|
|
2024
|
+
|
|
2025
|
+
// ../qti-test/dist/components/test-next/test-next.js
|
|
2026
|
+
var __decorate13 = function(decorators, target, key, desc) {
|
|
2027
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2028
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
2029
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
2030
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
2031
|
+
};
|
|
2032
|
+
var TestNext = class extends i2 {
|
|
2033
|
+
_handleTestElementChange(_oldValue, newValue) {
|
|
2034
|
+
if (newValue) {
|
|
2035
|
+
this._internalDisabled = false;
|
|
1851
2036
|
}
|
|
1852
2037
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
k(t3) {
|
|
1858
|
-
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
1859
|
-
const i5 = this._$AH;
|
|
1860
|
-
let s2, e3 = 0;
|
|
1861
|
-
for (const h2 of t3) e3 === i5.length ? i5.push(s2 = new _k(this.O(l()), this.O(l()), this, this.options)) : s2 = i5[e3], s2._$AI(h2), e3++;
|
|
1862
|
-
e3 < i5.length && (this._$AR(s2 && s2._$AB.nextSibling, e3), i5.length = e3);
|
|
1863
|
-
}
|
|
1864
|
-
_$AR(t3 = this._$AA.nextSibling, i5) {
|
|
1865
|
-
for (this._$AP?.(false, true, i5); t3 !== this._$AB; ) {
|
|
1866
|
-
const i6 = t3.nextSibling;
|
|
1867
|
-
t3.remove(), t3 = i6;
|
|
2038
|
+
static {
|
|
2039
|
+
this.styles = i`
|
|
2040
|
+
:host {
|
|
2041
|
+
${btn};
|
|
1868
2042
|
}
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
void 0 === this._$AM && (this._$Cv = t3, this._$AP?.(t3));
|
|
1872
|
-
}
|
|
1873
|
-
};
|
|
1874
|
-
var R = class {
|
|
1875
|
-
get tagName() {
|
|
1876
|
-
return this.element.tagName;
|
|
1877
|
-
}
|
|
1878
|
-
get _$AU() {
|
|
1879
|
-
return this._$AM._$AU;
|
|
1880
|
-
}
|
|
1881
|
-
constructor(t3, i5, s2, e3, h2) {
|
|
1882
|
-
this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t3, this.name = i5, this._$AM = e3, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E;
|
|
1883
|
-
}
|
|
1884
|
-
_$AI(t3, i5 = this, s2, e3) {
|
|
1885
|
-
const h2 = this.strings;
|
|
1886
|
-
let o2 = false;
|
|
1887
|
-
if (void 0 === h2) t3 = S(this, t3, i5, 0), o2 = !c2(t3) || t3 !== this._$AH && t3 !== w, o2 && (this._$AH = t3);
|
|
1888
|
-
else {
|
|
1889
|
-
const e4 = t3;
|
|
1890
|
-
let n3, r4;
|
|
1891
|
-
for (t3 = h2[0], n3 = 0; n3 < h2.length - 1; n3++) r4 = S(this, e4[s2 + n3], i5, n3), r4 === w && (r4 = this._$AH[n3]), o2 ||= !c2(r4) || r4 !== this._$AH[n3], r4 === E ? t3 = E : t3 !== E && (t3 += (r4 ?? "") + h2[n3 + 1]), this._$AH[n3] = r4;
|
|
2043
|
+
:host([disabled]) {
|
|
2044
|
+
${dis};
|
|
1892
2045
|
}
|
|
1893
|
-
|
|
1894
|
-
}
|
|
1895
|
-
j(t3) {
|
|
1896
|
-
t3 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t3 ?? "");
|
|
1897
|
-
}
|
|
1898
|
-
};
|
|
1899
|
-
var H = class extends R {
|
|
1900
|
-
constructor() {
|
|
1901
|
-
super(...arguments), this.type = 3;
|
|
1902
|
-
}
|
|
1903
|
-
j(t3) {
|
|
1904
|
-
this.element[this.name] = t3 === E ? void 0 : t3;
|
|
2046
|
+
`;
|
|
1905
2047
|
}
|
|
1906
|
-
|
|
1907
|
-
var I = class extends R {
|
|
2048
|
+
#internals;
|
|
1908
2049
|
constructor() {
|
|
1909
|
-
super(
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
this.
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
2050
|
+
super();
|
|
2051
|
+
this._internalDisabled = true;
|
|
2052
|
+
this.#internals = this.attachInternals();
|
|
2053
|
+
this.#internals.role = "button";
|
|
2054
|
+
this.#internals.ariaLabel = "Next item";
|
|
2055
|
+
this.addEventListener("click", (e2) => {
|
|
2056
|
+
e2.preventDefault();
|
|
2057
|
+
if (!this._internalDisabled)
|
|
2058
|
+
this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
|
|
2059
|
+
});
|
|
1918
2060
|
}
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
e3 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t3), this._$AH = t3;
|
|
2061
|
+
connectedCallback() {
|
|
2062
|
+
super.connectedCallback();
|
|
2063
|
+
this.checkDisabled();
|
|
1923
2064
|
}
|
|
1924
|
-
|
|
1925
|
-
|
|
2065
|
+
willUpdate(_changedProperties) {
|
|
2066
|
+
if (!this.computedContext)
|
|
2067
|
+
return;
|
|
2068
|
+
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
2069
|
+
if (!testPart)
|
|
2070
|
+
return;
|
|
2071
|
+
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
2072
|
+
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
2073
|
+
this.checkDisabled();
|
|
1926
2074
|
}
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
constructor(t3, i5, s2) {
|
|
1930
|
-
this.element = t3, this.type = 6, this._$AN = void 0, this._$AM = i5, this.options = s2;
|
|
2075
|
+
checkDisabled() {
|
|
2076
|
+
this._internalDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;
|
|
1931
2077
|
}
|
|
1932
|
-
|
|
1933
|
-
|
|
2078
|
+
_requestItem(identifier) {
|
|
2079
|
+
this.dispatchEvent(new CustomEvent("qti-request-navigation", {
|
|
2080
|
+
composed: true,
|
|
2081
|
+
bubbles: true,
|
|
2082
|
+
detail: {
|
|
2083
|
+
type: "item",
|
|
2084
|
+
id: identifier
|
|
2085
|
+
}
|
|
2086
|
+
}));
|
|
1934
2087
|
}
|
|
1935
|
-
|
|
1936
|
-
|
|
2088
|
+
render() {
|
|
2089
|
+
return T`<slot></slot>`;
|
|
1937
2090
|
}
|
|
1938
2091
|
};
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
2092
|
+
__decorate13([
|
|
2093
|
+
n2({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
2094
|
+
], TestNext.prototype, "_internalDisabled", void 0);
|
|
2095
|
+
__decorate13([
|
|
2096
|
+
c({ context: computedContext, subscribe: true })
|
|
2097
|
+
], TestNext.prototype, "computedContext", void 0);
|
|
2098
|
+
__decorate13([
|
|
2099
|
+
watch("computedContext")
|
|
2100
|
+
], TestNext.prototype, "_handleTestElementChange", null);
|
|
1942
2101
|
|
|
1943
2102
|
// ../../node_modules/.pnpm/@heximal+expressions@0.1.5/node_modules/@heximal/expressions/lib/constants.js
|
|
1944
2103
|
var KEYWORDS = ["this"];
|
|
@@ -2104,11 +2263,11 @@ var Tokenizer = class {
|
|
|
2104
2263
|
}
|
|
2105
2264
|
}
|
|
2106
2265
|
#getValue(lookahead = 0) {
|
|
2107
|
-
const
|
|
2266
|
+
const v = this.#input.substring(this.#tokenStart, this.#index + lookahead);
|
|
2108
2267
|
if (lookahead === 0) {
|
|
2109
2268
|
this.#clearValue();
|
|
2110
2269
|
}
|
|
2111
|
-
return
|
|
2270
|
+
return v;
|
|
2112
2271
|
}
|
|
2113
2272
|
#clearValue() {
|
|
2114
2273
|
this.#tokenStart = this.#index;
|
|
@@ -2127,9 +2286,9 @@ var Tokenizer = class {
|
|
|
2127
2286
|
}
|
|
2128
2287
|
this.#advance();
|
|
2129
2288
|
}
|
|
2130
|
-
const
|
|
2289
|
+
const t = token(Kind.STRING, escapeString(this.#getValue()));
|
|
2131
2290
|
this.#advance();
|
|
2132
|
-
return
|
|
2291
|
+
return t;
|
|
2133
2292
|
}
|
|
2134
2293
|
#tokenizeIdentOrKeyword() {
|
|
2135
2294
|
do {
|
|
@@ -2189,9 +2348,9 @@ var Tokenizer = class {
|
|
|
2189
2348
|
}
|
|
2190
2349
|
#tokenizeGrouper() {
|
|
2191
2350
|
const value = String.fromCharCode(this.#next);
|
|
2192
|
-
const
|
|
2351
|
+
const t = token(Kind.GROUPER, value, PRECEDENCE[value]);
|
|
2193
2352
|
this.#advance(true);
|
|
2194
|
-
return
|
|
2353
|
+
return t;
|
|
2195
2354
|
}
|
|
2196
2355
|
};
|
|
2197
2356
|
|
|
@@ -2215,10 +2374,10 @@ var Parser = class {
|
|
|
2215
2374
|
if (!this._matches(kind, value)) {
|
|
2216
2375
|
throw new Error(`Expected kind ${kind} (${value}), was ${this.#token?.kind} (${this.#token?.value})`);
|
|
2217
2376
|
}
|
|
2218
|
-
const
|
|
2219
|
-
this.#token =
|
|
2220
|
-
this.#kind =
|
|
2221
|
-
this.#value =
|
|
2377
|
+
const t = this.#tokenizer.nextToken();
|
|
2378
|
+
this.#token = t;
|
|
2379
|
+
this.#kind = t?.kind;
|
|
2380
|
+
this.#value = t?.value;
|
|
2222
2381
|
}
|
|
2223
2382
|
_matches(kind, value) {
|
|
2224
2383
|
return !(kind && this.#kind !== kind || value && this.#value !== value);
|
|
@@ -2424,7 +2583,7 @@ var Parser = class {
|
|
|
2424
2583
|
if (this._matches(Kind.ARROW)) {
|
|
2425
2584
|
this.#advance();
|
|
2426
2585
|
const body = this.#parseExpression();
|
|
2427
|
-
const params = expressions?.map((
|
|
2586
|
+
const params = expressions?.map((e2) => e2.value) ?? [];
|
|
2428
2587
|
return this.#ast.arrowFunction(params, body);
|
|
2429
2588
|
} else {
|
|
2430
2589
|
return this.#ast.paren(expressions[0]);
|
|
@@ -2450,29 +2609,29 @@ var Parser = class {
|
|
|
2450
2609
|
// ../../node_modules/.pnpm/@heximal+expressions@0.1.5/node_modules/@heximal/expressions/lib/eval.js
|
|
2451
2610
|
var { hasOwn, fromEntries } = Object;
|
|
2452
2611
|
var _BINARY_OPERATORS = {
|
|
2453
|
-
"+": (
|
|
2454
|
-
"-": (
|
|
2455
|
-
"*": (
|
|
2456
|
-
"/": (
|
|
2457
|
-
"%": (
|
|
2458
|
-
"==": (
|
|
2459
|
-
"!=": (
|
|
2460
|
-
"===": (
|
|
2461
|
-
"!==": (
|
|
2462
|
-
">": (
|
|
2463
|
-
">=": (
|
|
2464
|
-
"<": (
|
|
2465
|
-
"<=": (
|
|
2466
|
-
"||": (
|
|
2467
|
-
"&&": (
|
|
2468
|
-
"??": (
|
|
2469
|
-
"|": (
|
|
2470
|
-
"|>": (
|
|
2612
|
+
"+": (a, b) => a + b,
|
|
2613
|
+
"-": (a, b) => a - b,
|
|
2614
|
+
"*": (a, b) => a * b,
|
|
2615
|
+
"/": (a, b) => a / b,
|
|
2616
|
+
"%": (a, b) => a % b,
|
|
2617
|
+
"==": (a, b) => a == b,
|
|
2618
|
+
"!=": (a, b) => a != b,
|
|
2619
|
+
"===": (a, b) => a === b,
|
|
2620
|
+
"!==": (a, b) => a !== b,
|
|
2621
|
+
">": (a, b) => a > b,
|
|
2622
|
+
">=": (a, b) => a >= b,
|
|
2623
|
+
"<": (a, b) => a < b,
|
|
2624
|
+
"<=": (a, b) => a <= b,
|
|
2625
|
+
"||": (a, b) => a || b,
|
|
2626
|
+
"&&": (a, b) => a && b,
|
|
2627
|
+
"??": (a, b) => a ?? b,
|
|
2628
|
+
"|": (a, f) => f(a),
|
|
2629
|
+
"|>": (a, f) => f(a)
|
|
2471
2630
|
};
|
|
2472
2631
|
var _UNARY_OPERATORS = {
|
|
2473
|
-
"+": (
|
|
2474
|
-
"-": (
|
|
2475
|
-
"!": (
|
|
2632
|
+
"+": (a) => a,
|
|
2633
|
+
"-": (a) => -a,
|
|
2634
|
+
"!": (a) => !a
|
|
2476
2635
|
};
|
|
2477
2636
|
var EvalAstFactory = class {
|
|
2478
2637
|
empty() {
|
|
@@ -2487,10 +2646,10 @@ var EvalAstFactory = class {
|
|
|
2487
2646
|
};
|
|
2488
2647
|
}
|
|
2489
2648
|
// TODO(justinfagnani): just use a JS literal?
|
|
2490
|
-
literal(
|
|
2649
|
+
literal(v) {
|
|
2491
2650
|
return {
|
|
2492
2651
|
type: "Literal",
|
|
2493
|
-
value:
|
|
2652
|
+
value: v,
|
|
2494
2653
|
evaluate(_scope) {
|
|
2495
2654
|
return this.value;
|
|
2496
2655
|
},
|
|
@@ -2499,10 +2658,10 @@ var EvalAstFactory = class {
|
|
|
2499
2658
|
}
|
|
2500
2659
|
};
|
|
2501
2660
|
}
|
|
2502
|
-
id(
|
|
2661
|
+
id(v) {
|
|
2503
2662
|
return {
|
|
2504
2663
|
type: "ID",
|
|
2505
|
-
value:
|
|
2664
|
+
value: v,
|
|
2506
2665
|
evaluate(scope) {
|
|
2507
2666
|
if (this.value === "this")
|
|
2508
2667
|
return scope;
|
|
@@ -2515,26 +2674,26 @@ var EvalAstFactory = class {
|
|
|
2515
2674
|
};
|
|
2516
2675
|
}
|
|
2517
2676
|
unary(op, expr) {
|
|
2518
|
-
const
|
|
2677
|
+
const f = _UNARY_OPERATORS[op];
|
|
2519
2678
|
return {
|
|
2520
2679
|
type: "Unary",
|
|
2521
2680
|
operator: op,
|
|
2522
2681
|
child: expr,
|
|
2523
2682
|
evaluate(scope) {
|
|
2524
|
-
return
|
|
2683
|
+
return f(this.child.evaluate(scope));
|
|
2525
2684
|
},
|
|
2526
2685
|
getIds(idents) {
|
|
2527
2686
|
return this.child.getIds(idents);
|
|
2528
2687
|
}
|
|
2529
2688
|
};
|
|
2530
2689
|
}
|
|
2531
|
-
binary(
|
|
2532
|
-
const
|
|
2690
|
+
binary(l, op, r3) {
|
|
2691
|
+
const f = _BINARY_OPERATORS[op];
|
|
2533
2692
|
return {
|
|
2534
2693
|
type: "Binary",
|
|
2535
2694
|
operator: op,
|
|
2536
|
-
left:
|
|
2537
|
-
right:
|
|
2695
|
+
left: l,
|
|
2696
|
+
right: r3,
|
|
2538
2697
|
evaluate(scope) {
|
|
2539
2698
|
if (this.operator === "=") {
|
|
2540
2699
|
if (this.left.type !== "ID" && this.left.type !== "Getter" && this.left.type !== "Index") {
|
|
@@ -2555,7 +2714,7 @@ var EvalAstFactory = class {
|
|
|
2555
2714
|
}
|
|
2556
2715
|
return receiver === void 0 ? void 0 : receiver[property] = value;
|
|
2557
2716
|
}
|
|
2558
|
-
return
|
|
2717
|
+
return f(this.left.evaluate(scope), this.right.evaluate(scope));
|
|
2559
2718
|
},
|
|
2560
2719
|
getIds(idents) {
|
|
2561
2720
|
this.left.getIds(idents);
|
|
@@ -2564,10 +2723,10 @@ var EvalAstFactory = class {
|
|
|
2564
2723
|
}
|
|
2565
2724
|
};
|
|
2566
2725
|
}
|
|
2567
|
-
getter(
|
|
2726
|
+
getter(g, n3) {
|
|
2568
2727
|
return {
|
|
2569
2728
|
type: "Getter",
|
|
2570
|
-
receiver:
|
|
2729
|
+
receiver: g,
|
|
2571
2730
|
name: n3,
|
|
2572
2731
|
evaluate(scope) {
|
|
2573
2732
|
return this.receiver.evaluate(scope)?.[this.name];
|
|
@@ -2590,26 +2749,26 @@ var EvalAstFactory = class {
|
|
|
2590
2749
|
evaluate(scope) {
|
|
2591
2750
|
const receiver2 = this.receiver.evaluate(scope);
|
|
2592
2751
|
const _this = this.method ? receiver2 : scope?.["this"] ?? scope;
|
|
2593
|
-
const
|
|
2752
|
+
const f = this.method ? receiver2?.[method] : receiver2;
|
|
2594
2753
|
const args2 = this.arguments ?? [];
|
|
2595
|
-
const argValues = args2.map((
|
|
2596
|
-
return
|
|
2754
|
+
const argValues = args2.map((a) => a?.evaluate(scope));
|
|
2755
|
+
return f?.apply?.(_this, argValues);
|
|
2597
2756
|
},
|
|
2598
2757
|
getIds(idents) {
|
|
2599
2758
|
this.receiver.getIds(idents);
|
|
2600
|
-
this.arguments?.forEach((
|
|
2759
|
+
this.arguments?.forEach((a) => a?.getIds(idents));
|
|
2601
2760
|
return idents;
|
|
2602
2761
|
}
|
|
2603
2762
|
};
|
|
2604
2763
|
}
|
|
2605
|
-
paren(
|
|
2606
|
-
return
|
|
2764
|
+
paren(e2) {
|
|
2765
|
+
return e2;
|
|
2607
2766
|
}
|
|
2608
|
-
index(
|
|
2767
|
+
index(e2, a) {
|
|
2609
2768
|
return {
|
|
2610
2769
|
type: "Index",
|
|
2611
|
-
receiver:
|
|
2612
|
-
argument:
|
|
2770
|
+
receiver: e2,
|
|
2771
|
+
argument: a,
|
|
2613
2772
|
evaluate(scope) {
|
|
2614
2773
|
return this.receiver.evaluate(scope)?.[this.argument.evaluate(scope)];
|
|
2615
2774
|
},
|
|
@@ -2619,15 +2778,15 @@ var EvalAstFactory = class {
|
|
|
2619
2778
|
}
|
|
2620
2779
|
};
|
|
2621
2780
|
}
|
|
2622
|
-
ternary(
|
|
2781
|
+
ternary(c2, t, f) {
|
|
2623
2782
|
return {
|
|
2624
2783
|
type: "Ternary",
|
|
2625
|
-
condition:
|
|
2626
|
-
trueExpr:
|
|
2627
|
-
falseExpr:
|
|
2784
|
+
condition: c2,
|
|
2785
|
+
trueExpr: t,
|
|
2786
|
+
falseExpr: f,
|
|
2628
2787
|
evaluate(scope) {
|
|
2629
|
-
const
|
|
2630
|
-
if (
|
|
2788
|
+
const c3 = this.condition.evaluate(scope);
|
|
2789
|
+
if (c3) {
|
|
2631
2790
|
return this.trueExpr.evaluate(scope);
|
|
2632
2791
|
} else {
|
|
2633
2792
|
return this.falseExpr.evaluate(scope);
|
|
@@ -2671,15 +2830,15 @@ var EvalAstFactory = class {
|
|
|
2671
2830
|
};
|
|
2672
2831
|
}
|
|
2673
2832
|
// TODO(justinfagnani): if the list is deeply literal
|
|
2674
|
-
list(
|
|
2833
|
+
list(l) {
|
|
2675
2834
|
return {
|
|
2676
2835
|
type: "List",
|
|
2677
|
-
items:
|
|
2836
|
+
items: l,
|
|
2678
2837
|
evaluate(scope) {
|
|
2679
|
-
return this.items?.map((
|
|
2838
|
+
return this.items?.map((a) => a?.evaluate(scope));
|
|
2680
2839
|
},
|
|
2681
2840
|
getIds(idents) {
|
|
2682
|
-
this.items?.forEach((
|
|
2841
|
+
this.items?.forEach((i4) => i4?.getIds(idents));
|
|
2683
2842
|
return idents;
|
|
2684
2843
|
}
|
|
2685
2844
|
};
|
|
@@ -2693,7 +2852,7 @@ var EvalAstFactory = class {
|
|
|
2693
2852
|
const params2 = this.params;
|
|
2694
2853
|
const body2 = this.body;
|
|
2695
2854
|
return function(...args) {
|
|
2696
|
-
const paramsObj = fromEntries(params2.map((
|
|
2855
|
+
const paramsObj = fromEntries(params2.map((p, i4) => [p, args[i4]]));
|
|
2697
2856
|
const newScope = new Proxy(scope ?? {}, {
|
|
2698
2857
|
set(target, prop, value) {
|
|
2699
2858
|
if (hasOwn(paramsObj, prop)) {
|
|
@@ -2718,41 +2877,41 @@ var EvalAstFactory = class {
|
|
|
2718
2877
|
}
|
|
2719
2878
|
};
|
|
2720
2879
|
|
|
2721
|
-
// ../../node_modules/.pnpm/lit-html@3.3.
|
|
2722
|
-
var
|
|
2723
|
-
var
|
|
2724
|
-
_$AS(
|
|
2725
|
-
return
|
|
2726
|
-
}
|
|
2727
|
-
}, patchDirectiveResolve: (
|
|
2728
|
-
if (
|
|
2729
|
-
|
|
2730
|
-
for (let
|
|
2880
|
+
// ../../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/node/private-ssr-support.js
|
|
2881
|
+
var r2 = null;
|
|
2882
|
+
var i3 = { boundAttributeSuffix: Z.M, marker: Z.P, markerMatch: Z.A, HTML_RESULT: Z.C, getTemplateHtml: Z.L, overrideDirectiveResolve: (e2, t) => class extends e2 {
|
|
2883
|
+
_$AS(e3, r3) {
|
|
2884
|
+
return t(this, r3);
|
|
2885
|
+
}
|
|
2886
|
+
}, patchDirectiveResolve: (e2, t) => {
|
|
2887
|
+
if (e2.prototype._$AS.name !== t.name) {
|
|
2888
|
+
r2 ??= e2.prototype._$AS.name;
|
|
2889
|
+
for (let i4 = e2.prototype; i4 !== Object.prototype; i4 = Object.getPrototypeOf(i4)) if (i4.hasOwnProperty(r2)) return void (i4[r2] = t);
|
|
2731
2890
|
throw Error("Internal error: It is possible that both dev mode and production mode Lit was mixed together during SSR. Please comment on the issue: https://github.com/lit/lit/issues/4527");
|
|
2732
2891
|
}
|
|
2733
|
-
}, setDirectiveClass(
|
|
2734
|
-
|
|
2735
|
-
}, getAttributePartCommittedValue: (
|
|
2736
|
-
let
|
|
2737
|
-
return
|
|
2738
|
-
}, connectedDisconnectable: (
|
|
2892
|
+
}, setDirectiveClass(e2, t) {
|
|
2893
|
+
e2._$litDirective$ = t;
|
|
2894
|
+
}, getAttributePartCommittedValue: (e2, r3, i4) => {
|
|
2895
|
+
let o = E;
|
|
2896
|
+
return e2.j = (e3) => o = e3, e2._$AI(r3, e2, i4), o;
|
|
2897
|
+
}, connectedDisconnectable: (e2) => ({ ...e2, _$AU: true }), resolveDirective: Z.V, AttributePart: Z.H, PropertyPart: Z.B, BooleanAttributePart: Z.N, EventPart: Z.U, ElementPart: Z.F, TemplateInstance: Z.R, isIterable: Z.D, ChildPart: Z.I };
|
|
2739
2898
|
|
|
2740
2899
|
// ../../node_modules/.pnpm/@heximal+templates@0.1.5/node_modules/@heximal/templates/index.js
|
|
2741
|
-
var { AttributePart, PropertyPart, BooleanAttributePart, EventPart } =
|
|
2900
|
+
var { AttributePart, PropertyPart, BooleanAttributePart, EventPart } = i3;
|
|
2742
2901
|
var astFactory = new EvalAstFactory();
|
|
2743
2902
|
var expressionCache = /* @__PURE__ */ new Map();
|
|
2744
|
-
var toCamelCase = (
|
|
2745
|
-
var getSingleValue = (
|
|
2746
|
-
let ast = expressionCache.get(
|
|
2903
|
+
var toCamelCase = (s) => s.replace(/-(-|\w)/g, (_, p1) => p1.toUpperCase());
|
|
2904
|
+
var getSingleValue = (s, model) => {
|
|
2905
|
+
let ast = expressionCache.get(s);
|
|
2747
2906
|
if (ast === void 0) {
|
|
2748
|
-
if (expressionCache.has(
|
|
2907
|
+
if (expressionCache.has(s)) {
|
|
2749
2908
|
return void 0;
|
|
2750
2909
|
}
|
|
2751
|
-
|
|
2752
|
-
if (
|
|
2753
|
-
const expression =
|
|
2910
|
+
s = s.trim();
|
|
2911
|
+
if (s.startsWith("{{") && s.endsWith("}}")) {
|
|
2912
|
+
const expression = s.substring(2, s.length - 2).trim();
|
|
2754
2913
|
ast = new Parser(expression, astFactory).parse();
|
|
2755
|
-
expressionCache.set(
|
|
2914
|
+
expressionCache.set(s, ast);
|
|
2756
2915
|
}
|
|
2757
2916
|
}
|
|
2758
2917
|
return ast?.evaluate(model);
|
|
@@ -2765,14 +2924,14 @@ var ifHandler = (template, model, handlers, renderers) => {
|
|
|
2765
2924
|
return void 0;
|
|
2766
2925
|
};
|
|
2767
2926
|
var bindingRegex = /(?<!\\){{(.*?)(?:(?<!\\)}})/g;
|
|
2768
|
-
var hasEscapedBindingMarkers = (
|
|
2769
|
-
var unescapeBindingMarkers = (
|
|
2927
|
+
var hasEscapedBindingMarkers = (s) => /(?:\\{{)|(?:\\}})/g.test(s);
|
|
2928
|
+
var unescapeBindingMarkers = (s) => s.replaceAll(/\\{{/g, "{{").replace(/\\}}/g, "}}");
|
|
2770
2929
|
var repeatHandler = (template, model, handlers, renderers) => {
|
|
2771
2930
|
const repeatAttribute = template.getAttribute("repeat");
|
|
2772
2931
|
if (repeatAttribute !== null) {
|
|
2773
2932
|
const items = getSingleValue(repeatAttribute, model);
|
|
2774
2933
|
if (!items[Symbol.iterator]) {
|
|
2775
|
-
return
|
|
2934
|
+
return A;
|
|
2776
2935
|
}
|
|
2777
2936
|
const litTemplate = getLitTemplate(template);
|
|
2778
2937
|
let index = -1;
|
|
@@ -2975,10 +3134,10 @@ var makeLitTemplate = (template) => {
|
|
|
2975
3134
|
}
|
|
2976
3135
|
const strings = [unescapeBindingMarkers(splitValue[0])];
|
|
2977
3136
|
const exprs = [];
|
|
2978
|
-
for (let
|
|
2979
|
-
const exprText = splitValue[
|
|
3137
|
+
for (let i4 = 1; i4 < splitValue.length; i4 += 2) {
|
|
3138
|
+
const exprText = splitValue[i4];
|
|
2980
3139
|
exprs.push(parse(exprText, astFactory));
|
|
2981
|
-
strings.push(unescapeBindingMarkers(splitValue[
|
|
3140
|
+
strings.push(unescapeBindingMarkers(splitValue[i4 + 1]));
|
|
2982
3141
|
}
|
|
2983
3142
|
litTemplate.parts.push({
|
|
2984
3143
|
type: 1,
|
|
@@ -3001,15 +3160,15 @@ var makeLitTemplate = (template) => {
|
|
|
3001
3160
|
} else if (hasEscapedBindingMarkers(text)) {
|
|
3002
3161
|
textNode.textContent = unescapeBindingMarkers(text);
|
|
3003
3162
|
}
|
|
3004
|
-
for (let
|
|
3005
|
-
const exprText = strings[
|
|
3163
|
+
for (let i4 = 1; i4 < strings.length; i4 += 2) {
|
|
3164
|
+
const exprText = strings[i4];
|
|
3006
3165
|
const expr = parse(exprText, astFactory);
|
|
3007
3166
|
litTemplate.parts.push({
|
|
3008
3167
|
type: 2,
|
|
3009
3168
|
index: ++nodeIndex,
|
|
3010
3169
|
update: (model, _handlers) => expr.evaluate(model)
|
|
3011
3170
|
});
|
|
3012
|
-
const newTextNode = new Text(strings[
|
|
3171
|
+
const newTextNode = new Text(strings[i4 + 1].replace("\\{{", "{{"));
|
|
3013
3172
|
textNode.parentNode.insertBefore(newTextNode, textNode.nextSibling);
|
|
3014
3173
|
textNode.parentNode.insertBefore(document.createComment(""), textNode.nextSibling);
|
|
3015
3174
|
textNode = newTextNode;
|
|
@@ -3017,268 +3176,368 @@ var makeLitTemplate = (template) => {
|
|
|
3017
3176
|
}
|
|
3018
3177
|
}
|
|
3019
3178
|
}
|
|
3020
|
-
for (const
|
|
3021
|
-
|
|
3179
|
+
for (const e2 of elementsToRemove) {
|
|
3180
|
+
e2.remove();
|
|
3022
3181
|
}
|
|
3023
3182
|
return litTemplate;
|
|
3024
3183
|
};
|
|
3025
3184
|
|
|
3026
|
-
// ../qti-test/
|
|
3027
|
-
var
|
|
3185
|
+
// ../qti-test/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js
|
|
3186
|
+
var __decorate14 = function(decorators, target, key, desc) {
|
|
3187
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3188
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3189
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3190
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3191
|
+
};
|
|
3028
3192
|
var TestPagingButtonsStamp = class extends i2 {
|
|
3029
|
-
|
|
3030
|
-
super();
|
|
3031
|
-
__privateAdd(this, _internals2);
|
|
3032
|
-
__privateSet(this, _internals2, this.attachInternals());
|
|
3033
|
-
__privateGet(this, _internals2).ariaLabel = "pagination";
|
|
3034
|
-
}
|
|
3193
|
+
#internals;
|
|
3035
3194
|
createRenderRoot() {
|
|
3036
3195
|
return this;
|
|
3037
3196
|
}
|
|
3197
|
+
constructor() {
|
|
3198
|
+
super();
|
|
3199
|
+
this.#internals = this.attachInternals();
|
|
3200
|
+
this.#internals.ariaLabel = "pagination";
|
|
3201
|
+
}
|
|
3038
3202
|
connectedCallback() {
|
|
3039
3203
|
super.connectedCallback();
|
|
3040
3204
|
const templateElement = this.querySelector("template");
|
|
3041
3205
|
this.myTemplate = prepareTemplate(templateElement);
|
|
3042
3206
|
}
|
|
3043
3207
|
render() {
|
|
3044
|
-
if (!this.computedContext)
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
);
|
|
3208
|
+
if (!this.computedContext)
|
|
3209
|
+
return T``;
|
|
3210
|
+
const items = this.computedContext.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items));
|
|
3048
3211
|
return T` ${items.map((item) => this.myTemplate({ item, view: this.computedContext.view }))} `;
|
|
3049
3212
|
}
|
|
3050
3213
|
};
|
|
3051
|
-
|
|
3052
|
-
__decorateClass([
|
|
3214
|
+
__decorate14([
|
|
3053
3215
|
c({ context: computedContext, subscribe: true })
|
|
3054
|
-
], TestPagingButtonsStamp.prototype, "computedContext",
|
|
3055
|
-
TestPagingButtonsStamp = __decorateClass([
|
|
3056
|
-
t("test-paging-buttons-stamp")
|
|
3057
|
-
], TestPagingButtonsStamp);
|
|
3216
|
+
], TestPagingButtonsStamp.prototype, "computedContext", void 0);
|
|
3058
3217
|
|
|
3059
|
-
// ../qti-test/
|
|
3060
|
-
var
|
|
3061
|
-
var
|
|
3218
|
+
// ../qti-test/dist/components/test-prev/test-prev.js
|
|
3219
|
+
var __decorate15 = function(decorators, target, key, desc) {
|
|
3220
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3221
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3222
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3223
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3224
|
+
};
|
|
3225
|
+
var TestPrev = class extends i2 {
|
|
3226
|
+
_handleTestElementChange(_oldValue, newValue) {
|
|
3227
|
+
if (newValue) {
|
|
3228
|
+
this._internalDisabled = false;
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
static {
|
|
3232
|
+
this.styles = i`
|
|
3233
|
+
:host {
|
|
3234
|
+
${btn};
|
|
3235
|
+
}
|
|
3236
|
+
:host([disabled]) {
|
|
3237
|
+
${dis};
|
|
3238
|
+
}
|
|
3239
|
+
`;
|
|
3240
|
+
}
|
|
3062
3241
|
constructor() {
|
|
3063
|
-
super(
|
|
3064
|
-
|
|
3065
|
-
this.
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
};
|
|
3071
|
-
/** Template content if provided */
|
|
3072
|
-
__privateAdd(this, _templateContent, null);
|
|
3242
|
+
super();
|
|
3243
|
+
this._internalDisabled = true;
|
|
3244
|
+
this.addEventListener("click", (e2) => {
|
|
3245
|
+
e2.preventDefault();
|
|
3246
|
+
if (!this._internalDisabled)
|
|
3247
|
+
this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
|
|
3248
|
+
});
|
|
3073
3249
|
}
|
|
3074
|
-
|
|
3075
|
-
if (!this.
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3250
|
+
willUpdate(_changedProperties) {
|
|
3251
|
+
if (!this.computedContext)
|
|
3252
|
+
return;
|
|
3253
|
+
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
3254
|
+
if (!testPart)
|
|
3255
|
+
return;
|
|
3256
|
+
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
3257
|
+
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
3258
|
+
this.checkDisabled();
|
|
3259
|
+
}
|
|
3260
|
+
checkDisabled() {
|
|
3261
|
+
this._internalDisabled = !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
|
|
3262
|
+
}
|
|
3263
|
+
_requestItem(identifier) {
|
|
3264
|
+
this.dispatchEvent(new CustomEvent("qti-request-navigation", {
|
|
3265
|
+
composed: true,
|
|
3266
|
+
bubbles: true,
|
|
3267
|
+
detail: {
|
|
3268
|
+
type: "item",
|
|
3269
|
+
id: identifier
|
|
3086
3270
|
}
|
|
3087
|
-
|
|
3088
|
-
} catch (error) {
|
|
3089
|
-
console.error("Error loading or parsing XML:", error);
|
|
3090
|
-
}
|
|
3271
|
+
}));
|
|
3091
3272
|
}
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
try {
|
|
3095
|
-
this.testDoc = qtiTransformTest().parse(this.testXML).htmlDoc();
|
|
3096
|
-
} catch (error) {
|
|
3097
|
-
console.error("Error parsing XML:", error);
|
|
3098
|
-
}
|
|
3273
|
+
render() {
|
|
3274
|
+
return T`<slot></slot>`;
|
|
3099
3275
|
}
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3276
|
+
};
|
|
3277
|
+
__decorate15([
|
|
3278
|
+
n2({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
3279
|
+
], TestPrev.prototype, "_internalDisabled", void 0);
|
|
3280
|
+
__decorate15([
|
|
3281
|
+
c({ context: computedContext, subscribe: true })
|
|
3282
|
+
], TestPrev.prototype, "computedContext", void 0);
|
|
3283
|
+
__decorate15([
|
|
3284
|
+
watch("computedContext")
|
|
3285
|
+
], TestPrev.prototype, "_handleTestElementChange", null);
|
|
3286
|
+
|
|
3287
|
+
// ../qti-test/dist/components/test-print-context/test-print-context.js
|
|
3288
|
+
var __decorate16 = function(decorators, target, key, desc) {
|
|
3289
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3290
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3291
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3292
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3293
|
+
};
|
|
3294
|
+
var TestPrintContext = class extends i2 {
|
|
3295
|
+
render() {
|
|
3296
|
+
return T` <small><pre>${JSON.stringify(this.computedContext, null, 2)}</pre></small> `;
|
|
3297
|
+
}
|
|
3298
|
+
};
|
|
3299
|
+
__decorate16([
|
|
3300
|
+
r(),
|
|
3301
|
+
c({ context: computedContext, subscribe: true })
|
|
3302
|
+
], TestPrintContext.prototype, "computedContext", void 0);
|
|
3303
|
+
|
|
3304
|
+
// ../qti-test/dist/components/test-print-item-variables/test-print-item-variables.js
|
|
3305
|
+
var __decorate17 = function(decorators, target, key, desc) {
|
|
3306
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3307
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3308
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3309
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3310
|
+
};
|
|
3311
|
+
var TestPrintVariables = class extends i2 {
|
|
3312
|
+
static {
|
|
3313
|
+
this.styles = i`
|
|
3314
|
+
table {
|
|
3315
|
+
width: 100%;
|
|
3316
|
+
border-collapse: collapse;
|
|
3317
|
+
margin: 20px 0;
|
|
3318
|
+
font-size: 14px;
|
|
3319
|
+
text-align: left;
|
|
3106
3320
|
}
|
|
3107
|
-
|
|
3108
|
-
|
|
3321
|
+
th,
|
|
3322
|
+
td {
|
|
3323
|
+
border: 1px solid #ddd;
|
|
3324
|
+
padding: 8px;
|
|
3325
|
+
}
|
|
3326
|
+
th {
|
|
3327
|
+
background-color: #f4f4f4;
|
|
3328
|
+
font-weight: bold;
|
|
3109
3329
|
}
|
|
3330
|
+
h3 {
|
|
3331
|
+
margin-top: 20px;
|
|
3332
|
+
font-size: 16px;
|
|
3333
|
+
}
|
|
3334
|
+
`;
|
|
3110
3335
|
}
|
|
3111
3336
|
render() {
|
|
3337
|
+
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
3338
|
+
if (!activeItem || !activeItem.variables)
|
|
3339
|
+
return T``;
|
|
3340
|
+
const responseVariables = activeItem.variables.filter((v) => v.type === "response");
|
|
3341
|
+
const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
|
|
3342
|
+
const renderTable = (variables, title) => T`
|
|
3343
|
+
<h3>${title}</h3>
|
|
3344
|
+
<table>
|
|
3345
|
+
<thead>
|
|
3346
|
+
<tr>
|
|
3347
|
+
<th>Identifier</th>
|
|
3348
|
+
<th>Value</th>
|
|
3349
|
+
<th>Cardinality</th>
|
|
3350
|
+
<th>Base Type</th>
|
|
3351
|
+
<th>Correct Response / Mappings</th>
|
|
3352
|
+
</tr>
|
|
3353
|
+
</thead>
|
|
3354
|
+
<tbody>
|
|
3355
|
+
${variables.map((v) => {
|
|
3356
|
+
const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
|
|
3357
|
+
const mapEntries = v.mapping?.mapEntries?.map((m2) => `${m2.mapKey}=${m2.mappedValue}pt`).join(", ") || "";
|
|
3358
|
+
const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m2) => `${m2.shape}(${m2.coords})=${m2.mappedValue}pt`).join(", ") || "";
|
|
3359
|
+
return T`
|
|
3360
|
+
<tr>
|
|
3361
|
+
<td>${v.identifier}</td>
|
|
3362
|
+
<td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
|
|
3363
|
+
<td>${v.cardinality}</td>
|
|
3364
|
+
<td>${v.baseType}</td>
|
|
3365
|
+
<td>${correctResponse || mapEntries || areaMapEntries}</td>
|
|
3366
|
+
</tr>
|
|
3367
|
+
`;
|
|
3368
|
+
})}
|
|
3369
|
+
</tbody>
|
|
3370
|
+
</table>
|
|
3371
|
+
`;
|
|
3112
3372
|
return T`
|
|
3113
|
-
${
|
|
3114
|
-
<slot></slot>
|
|
3115
|
-
${m(this.testDoc, T`<span>Loading...</span>`)}
|
|
3373
|
+
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
3116
3374
|
`;
|
|
3117
3375
|
}
|
|
3118
3376
|
};
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3377
|
+
__decorate17([
|
|
3378
|
+
c({ context: computedContext, subscribe: true })
|
|
3379
|
+
], TestPrintVariables.prototype, "computedContext", void 0);
|
|
3380
|
+
|
|
3381
|
+
// ../qti-test/dist/components/test-scoring-buttons/test-scoring-buttons.js
|
|
3382
|
+
var __decorate18 = function(decorators, target, key, desc) {
|
|
3383
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3384
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3385
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3386
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3124
3387
|
};
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3388
|
+
var TestScoringButtons = class extends i2 {
|
|
3389
|
+
createRenderRoot() {
|
|
3390
|
+
return this;
|
|
3391
|
+
}
|
|
3392
|
+
connectedCallback() {
|
|
3393
|
+
super.connectedCallback();
|
|
3394
|
+
const templateElement = this.querySelector("template");
|
|
3395
|
+
if (!templateElement) {
|
|
3396
|
+
this.myTemplate = null;
|
|
3397
|
+
return;
|
|
3398
|
+
}
|
|
3399
|
+
this.myTemplate = prepareTemplate(templateElement);
|
|
3400
|
+
}
|
|
3401
|
+
#changeOutcomeScore(value) {
|
|
3402
|
+
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
3403
|
+
const sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
3404
|
+
const currentItemIdentifier = sectionItems.find((item) => item.active)?.identifier;
|
|
3405
|
+
this.dispatchEvent(new CustomEvent("test-update-outcome-variable", {
|
|
3406
|
+
detail: {
|
|
3407
|
+
assessmentItemRefId: currentItemIdentifier,
|
|
3408
|
+
outcomeVariableId: "SCORE",
|
|
3409
|
+
value
|
|
3410
|
+
},
|
|
3411
|
+
bubbles: true
|
|
3412
|
+
}));
|
|
3413
|
+
}
|
|
3414
|
+
render() {
|
|
3415
|
+
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
3416
|
+
if (!activeItem || !activeItem.variables)
|
|
3417
|
+
return T``;
|
|
3418
|
+
const maxScore = activeItem.variables.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
3419
|
+
const scoreOutcome = activeItem.variables.find((vr) => vr.identifier == "SCORE");
|
|
3420
|
+
const score = scoreOutcome?.value;
|
|
3421
|
+
const disabled = !(scoreOutcome?.externalScored === "human");
|
|
3422
|
+
if (!maxScore || !scoreOutcome)
|
|
3423
|
+
return A;
|
|
3424
|
+
const scores = [...Array(Number(maxScore) + 1).keys()];
|
|
3425
|
+
return T`${this.myTemplate ? this.myTemplate({ scores, score, disabled }) : A}`;
|
|
3426
|
+
}
|
|
3427
|
+
constructor() {
|
|
3428
|
+
super();
|
|
3429
|
+
this.view = "";
|
|
3430
|
+
this.disabled = false;
|
|
3431
|
+
this.myTemplate = null;
|
|
3432
|
+
this.addEventListener("click", (e2) => {
|
|
3433
|
+
const target = e2.target;
|
|
3434
|
+
const value = parseFloat(target.value);
|
|
3435
|
+
if (target.tagName === "INPUT") {
|
|
3436
|
+
this.#changeOutcomeScore(value);
|
|
3437
|
+
}
|
|
3438
|
+
});
|
|
3439
|
+
}
|
|
3129
3440
|
};
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
],
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
],
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
],
|
|
3139
|
-
__decorateClass([
|
|
3140
|
-
r(),
|
|
3141
|
-
c({ context: qtiContext, subscribe: true })
|
|
3142
|
-
], TestContainer.prototype, "qtiContext", 2);
|
|
3143
|
-
__decorateClass([
|
|
3144
|
-
watch("testURL", { waitUntilFirstUpdate: true })
|
|
3145
|
-
], TestContainer.prototype, "handleTestURLChange", 1);
|
|
3146
|
-
__decorateClass([
|
|
3147
|
-
watch("testXML", { waitUntilFirstUpdate: true })
|
|
3148
|
-
], TestContainer.prototype, "handleTestXMLChange", 1);
|
|
3149
|
-
TestContainer = __decorateClass([
|
|
3150
|
-
t("test-container")
|
|
3151
|
-
], TestContainer);
|
|
3441
|
+
__decorate18([
|
|
3442
|
+
n2({ type: String, attribute: "view" })
|
|
3443
|
+
], TestScoringButtons.prototype, "view", void 0);
|
|
3444
|
+
__decorate18([
|
|
3445
|
+
n2({ type: Boolean })
|
|
3446
|
+
], TestScoringButtons.prototype, "disabled", void 0);
|
|
3447
|
+
__decorate18([
|
|
3448
|
+
c({ context: computedContext, subscribe: true })
|
|
3449
|
+
], TestScoringButtons.prototype, "computedContext", void 0);
|
|
3152
3450
|
|
|
3153
|
-
// ../qti-test/
|
|
3154
|
-
var
|
|
3451
|
+
// ../qti-test/dist/components/test-scoring-feedback/test-scoring-feedback.js
|
|
3452
|
+
var __decorate19 = function(decorators, target, key, desc) {
|
|
3453
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3454
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3455
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3456
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3457
|
+
};
|
|
3458
|
+
var TestScoringFeedback = class extends i2 {
|
|
3459
|
+
constructor() {
|
|
3460
|
+
super(...arguments);
|
|
3461
|
+
this.view = null;
|
|
3462
|
+
}
|
|
3155
3463
|
render() {
|
|
3156
3464
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
3157
|
-
if (!activeItem || !activeItem.variables)
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
<td>${v2.cardinality}</td>
|
|
3182
|
-
<td>${v2.baseType}</td>
|
|
3183
|
-
<td>${correctResponse || mapEntries || areaMapEntries}</td>
|
|
3184
|
-
</tr>
|
|
3185
|
-
`;
|
|
3186
|
-
})}
|
|
3187
|
-
</tbody>
|
|
3188
|
-
</table>
|
|
3189
|
-
`;
|
|
3190
|
-
return T`
|
|
3191
|
-
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
3192
|
-
`;
|
|
3465
|
+
if (!activeItem || !activeItem.variables)
|
|
3466
|
+
return T``;
|
|
3467
|
+
if (activeItem["category"] === "dep-informational")
|
|
3468
|
+
return T`<div>${this.dataset.informational}</div>`;
|
|
3469
|
+
const completionStatus = activeItem?.variables.find((v) => v.identifier === "completionStatus")?.value;
|
|
3470
|
+
const scoreOutcome = activeItem?.variables.find((vr) => vr.identifier == "SCORE");
|
|
3471
|
+
const score = parseFloat(scoreOutcome?.value);
|
|
3472
|
+
const externalScored = activeItem["externalScored"];
|
|
3473
|
+
const feedbackText = () => {
|
|
3474
|
+
if (completionStatus !== "completed") {
|
|
3475
|
+
return this.dataset.textNoResponse;
|
|
3476
|
+
}
|
|
3477
|
+
if (!externalScored && score !== void 0 && !Number.isNaN(score)) {
|
|
3478
|
+
return score > 0 ? this.dataset.textCorrect : this.dataset.textIncorrect;
|
|
3479
|
+
}
|
|
3480
|
+
if (externalScored === "externalMachine") {
|
|
3481
|
+
return Number.isNaN(score) || score === void 0 ? this.dataset.scoreUnknown : `We hebben je antwoord ${score === 0 ? "geen punten" : score == 1 ? "\xE9\xE9n punt" : `${score} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`;
|
|
3482
|
+
}
|
|
3483
|
+
if (externalScored === "human") {
|
|
3484
|
+
return Number.isNaN(score) ? "" : "Deze score heb je zelf toegekend.";
|
|
3485
|
+
}
|
|
3486
|
+
return this.dataset.inProgress;
|
|
3487
|
+
};
|
|
3488
|
+
return T`<div>${feedbackText()}</div>`;
|
|
3193
3489
|
}
|
|
3194
3490
|
};
|
|
3195
|
-
|
|
3196
|
-
table {
|
|
3197
|
-
width: 100%;
|
|
3198
|
-
border-collapse: collapse;
|
|
3199
|
-
margin: 20px 0;
|
|
3200
|
-
font-size: 14px;
|
|
3201
|
-
text-align: left;
|
|
3202
|
-
}
|
|
3203
|
-
th,
|
|
3204
|
-
td {
|
|
3205
|
-
border: 1px solid #ddd;
|
|
3206
|
-
padding: 8px;
|
|
3207
|
-
}
|
|
3208
|
-
th {
|
|
3209
|
-
background-color: #f4f4f4;
|
|
3210
|
-
font-weight: bold;
|
|
3211
|
-
}
|
|
3212
|
-
h3 {
|
|
3213
|
-
margin-top: 20px;
|
|
3214
|
-
font-size: 16px;
|
|
3215
|
-
}
|
|
3216
|
-
`;
|
|
3217
|
-
__decorateClass([
|
|
3491
|
+
__decorate19([
|
|
3218
3492
|
c({ context: computedContext, subscribe: true })
|
|
3219
|
-
],
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
],
|
|
3493
|
+
], TestScoringFeedback.prototype, "computedContext", void 0);
|
|
3494
|
+
__decorate19([
|
|
3495
|
+
n2({ type: String, attribute: "view" })
|
|
3496
|
+
], TestScoringFeedback.prototype, "view", void 0);
|
|
3223
3497
|
|
|
3224
|
-
// ../qti-test/
|
|
3225
|
-
var
|
|
3498
|
+
// ../qti-test/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js
|
|
3499
|
+
var __decorate20 = function(decorators, target, key, desc) {
|
|
3500
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3501
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3502
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3503
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3504
|
+
};
|
|
3226
3505
|
var TestSectionButtonsStamp = class extends i2 {
|
|
3227
|
-
|
|
3228
|
-
super();
|
|
3229
|
-
__privateAdd(this, _internals3);
|
|
3230
|
-
__privateSet(this, _internals3, this.attachInternals());
|
|
3231
|
-
__privateGet(this, _internals3).ariaLabel = "pagination";
|
|
3232
|
-
}
|
|
3506
|
+
#internals;
|
|
3233
3507
|
createRenderRoot() {
|
|
3234
3508
|
return this;
|
|
3235
3509
|
}
|
|
3510
|
+
constructor() {
|
|
3511
|
+
super();
|
|
3512
|
+
this.#internals = this.attachInternals();
|
|
3513
|
+
this.#internals.ariaLabel = "pagination";
|
|
3514
|
+
}
|
|
3236
3515
|
connectedCallback() {
|
|
3237
3516
|
super.connectedCallback();
|
|
3238
3517
|
const templateElement = this.querySelector("template");
|
|
3239
3518
|
this.myTemplate = prepareTemplate(templateElement);
|
|
3240
3519
|
}
|
|
3241
3520
|
render() {
|
|
3242
|
-
if (!this.computedContext)
|
|
3521
|
+
if (!this.computedContext)
|
|
3522
|
+
return T``;
|
|
3243
3523
|
const sections = this.computedContext.testParts.flatMap((testPart) => testPart.sections);
|
|
3244
3524
|
return T` ${sections.map((item) => this.myTemplate({ item }))} `;
|
|
3245
3525
|
}
|
|
3246
3526
|
};
|
|
3247
|
-
|
|
3248
|
-
__decorateClass([
|
|
3527
|
+
__decorate20([
|
|
3249
3528
|
c({ context: computedContext, subscribe: true })
|
|
3250
|
-
], TestSectionButtonsStamp.prototype, "computedContext",
|
|
3251
|
-
TestSectionButtonsStamp = __decorateClass([
|
|
3252
|
-
t("test-section-buttons-stamp")
|
|
3253
|
-
], TestSectionButtonsStamp);
|
|
3529
|
+
], TestSectionButtonsStamp.prototype, "computedContext", void 0);
|
|
3254
3530
|
|
|
3255
|
-
// ../qti-test/
|
|
3256
|
-
var
|
|
3257
|
-
var
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
this.sectionId = null;
|
|
3262
|
-
this.addEventListener("click", () => __privateMethod(this, _TestSectionLink_instances, requestItem_fn).call(this, this.sectionId));
|
|
3263
|
-
}
|
|
3264
|
-
render() {
|
|
3265
|
-
return T` <slot></slot> `;
|
|
3266
|
-
}
|
|
3267
|
-
};
|
|
3268
|
-
_TestSectionLink_instances = new WeakSet();
|
|
3269
|
-
requestItem_fn = function(identifier) {
|
|
3270
|
-
this.dispatchEvent(
|
|
3271
|
-
new CustomEvent("qti-request-navigation", {
|
|
3272
|
-
composed: true,
|
|
3273
|
-
bubbles: true,
|
|
3274
|
-
detail: {
|
|
3275
|
-
type: "section",
|
|
3276
|
-
id: identifier
|
|
3277
|
-
}
|
|
3278
|
-
})
|
|
3279
|
-
);
|
|
3531
|
+
// ../qti-test/dist/components/test-section-link/test-section-link.js
|
|
3532
|
+
var __decorate21 = function(decorators, target, key, desc) {
|
|
3533
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3534
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3535
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3536
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3280
3537
|
};
|
|
3281
|
-
TestSectionLink
|
|
3538
|
+
var TestSectionLink = class extends i2 {
|
|
3539
|
+
static {
|
|
3540
|
+
this.styles = i`
|
|
3282
3541
|
:host {
|
|
3283
3542
|
${btn};
|
|
3284
3543
|
}
|
|
@@ -3286,28 +3545,37 @@ TestSectionLink.styles = i`
|
|
|
3286
3545
|
${dis};
|
|
3287
3546
|
}
|
|
3288
3547
|
`;
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3548
|
+
}
|
|
3549
|
+
#requestItem(identifier) {
|
|
3550
|
+
this.dispatchEvent(new CustomEvent("qti-request-navigation", {
|
|
3551
|
+
composed: true,
|
|
3552
|
+
bubbles: true,
|
|
3553
|
+
detail: {
|
|
3554
|
+
type: "section",
|
|
3555
|
+
id: identifier
|
|
3556
|
+
}
|
|
3557
|
+
}));
|
|
3558
|
+
}
|
|
3559
|
+
constructor() {
|
|
3560
|
+
super();
|
|
3561
|
+
this.sectionId = null;
|
|
3562
|
+
this.addEventListener("click", () => this.#requestItem(this.sectionId));
|
|
3563
|
+
}
|
|
3298
3564
|
render() {
|
|
3299
|
-
return T` <
|
|
3565
|
+
return T` <slot></slot> `;
|
|
3300
3566
|
}
|
|
3301
3567
|
};
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
], TestPrintContext.prototype, "computedContext", 2);
|
|
3306
|
-
TestPrintContext = __decorateClass([
|
|
3307
|
-
t("test-print-context")
|
|
3308
|
-
], TestPrintContext);
|
|
3568
|
+
__decorate21([
|
|
3569
|
+
n2({ type: String, attribute: "section-id" })
|
|
3570
|
+
], TestSectionLink.prototype, "sectionId", void 0);
|
|
3309
3571
|
|
|
3310
|
-
// ../qti-test/
|
|
3572
|
+
// ../qti-test/dist/components/test-stamp/test-stamp.js
|
|
3573
|
+
var __decorate22 = function(decorators, target, key, desc) {
|
|
3574
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3575
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3576
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3577
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3578
|
+
};
|
|
3311
3579
|
var TestStamp = class extends i2 {
|
|
3312
3580
|
constructor() {
|
|
3313
3581
|
super(...arguments);
|
|
@@ -3365,103 +3633,106 @@ var TestStamp = class extends i2 {
|
|
|
3365
3633
|
activeTestpart: augmentedTestPart,
|
|
3366
3634
|
test: activeTest
|
|
3367
3635
|
};
|
|
3368
|
-
this.dispatchEvent(
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
})
|
|
3373
|
-
);
|
|
3636
|
+
this.dispatchEvent(new CustomEvent("qti-stamp-context-updated", {
|
|
3637
|
+
detail: this.stampContext,
|
|
3638
|
+
bubbles: true
|
|
3639
|
+
}));
|
|
3374
3640
|
}
|
|
3375
3641
|
render() {
|
|
3376
3642
|
return T` ${this.debug ? T`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : A}
|
|
3377
3643
|
${this.myTemplate ? this.myTemplate(this.stampContext) : A}`;
|
|
3378
3644
|
}
|
|
3379
3645
|
};
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
], TestStamp.prototype, "debug",
|
|
3383
|
-
|
|
3646
|
+
__decorate22([
|
|
3647
|
+
n2({ type: Boolean, reflect: true })
|
|
3648
|
+
], TestStamp.prototype, "debug", void 0);
|
|
3649
|
+
__decorate22([
|
|
3384
3650
|
r(),
|
|
3385
3651
|
c({ context: computedContext, subscribe: true })
|
|
3386
|
-
], TestStamp.prototype, "computedContext",
|
|
3387
|
-
|
|
3652
|
+
], TestStamp.prototype, "computedContext", void 0);
|
|
3653
|
+
__decorate22([
|
|
3388
3654
|
r()
|
|
3389
|
-
], TestStamp.prototype, "stampContext",
|
|
3390
|
-
TestStamp = __decorateClass([
|
|
3391
|
-
t("test-stamp")
|
|
3392
|
-
], TestStamp);
|
|
3655
|
+
], TestStamp.prototype, "stampContext", void 0);
|
|
3393
3656
|
|
|
3394
|
-
// ../qti-test/
|
|
3395
|
-
var
|
|
3396
|
-
var
|
|
3657
|
+
// ../qti-test/dist/components/test-view-toggle/test-view.js
|
|
3658
|
+
var __decorate23 = function(decorators, target, key, desc) {
|
|
3659
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3660
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3661
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3662
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3663
|
+
};
|
|
3664
|
+
var _a;
|
|
3665
|
+
var TestView = class extends i2 {
|
|
3397
3666
|
constructor() {
|
|
3398
|
-
super();
|
|
3399
|
-
|
|
3400
|
-
this.
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
this.
|
|
3404
|
-
const target = e3.target;
|
|
3405
|
-
const value = parseFloat(target.value);
|
|
3406
|
-
if (target.tagName === "INPUT") {
|
|
3407
|
-
__privateMethod(this, _TestScoringButtons_instances, changeOutcomeScore_fn).call(this, value);
|
|
3408
|
-
}
|
|
3409
|
-
});
|
|
3667
|
+
super(...arguments);
|
|
3668
|
+
this.label = "view";
|
|
3669
|
+
this._handleViewOptionsChange = () => {
|
|
3670
|
+
this.#updateViewOptions();
|
|
3671
|
+
};
|
|
3672
|
+
this._viewOptions = _a.DEFAULT_VIEW_OPTIONS;
|
|
3410
3673
|
}
|
|
3411
|
-
|
|
3412
|
-
|
|
3674
|
+
static {
|
|
3675
|
+
this.DEFAULT_VIEW_OPTIONS = ["author", "candidate", "proctor", "scorer", "testConstructor", "tutor"];
|
|
3413
3676
|
}
|
|
3414
3677
|
connectedCallback() {
|
|
3415
3678
|
super.connectedCallback();
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3679
|
+
this.#updateViewOptions();
|
|
3680
|
+
}
|
|
3681
|
+
#updateViewOptions() {
|
|
3682
|
+
if (this.viewOptions) {
|
|
3683
|
+
const options = this.viewOptions.split(",").map((opt) => opt.trim());
|
|
3684
|
+
this._viewOptions = options.filter((opt) => _a.DEFAULT_VIEW_OPTIONS.includes(opt));
|
|
3685
|
+
} else {
|
|
3686
|
+
this._viewOptions = _a.DEFAULT_VIEW_OPTIONS;
|
|
3420
3687
|
}
|
|
3421
|
-
|
|
3688
|
+
}
|
|
3689
|
+
_switchView(view) {
|
|
3690
|
+
this.dispatchEvent(new CustomEvent("on-test-switch-view", {
|
|
3691
|
+
composed: true,
|
|
3692
|
+
bubbles: true,
|
|
3693
|
+
detail: view
|
|
3694
|
+
}));
|
|
3422
3695
|
}
|
|
3423
3696
|
render() {
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3697
|
+
return T`
|
|
3698
|
+
<label part="label" for="viewSelect">${this.label}</label>
|
|
3699
|
+
<select
|
|
3700
|
+
part="select"
|
|
3701
|
+
id="viewSelect"
|
|
3702
|
+
@change=${(e2) => {
|
|
3703
|
+
const el = e2.target;
|
|
3704
|
+
this._switchView(el.value);
|
|
3705
|
+
}}
|
|
3706
|
+
>
|
|
3707
|
+
${this._viewOptions.map((v) => T`<option value="${v}" ?selected=${v === this.sessionContext.view}>${v}</option>`)}
|
|
3708
|
+
</select>
|
|
3709
|
+
`;
|
|
3433
3710
|
}
|
|
3434
3711
|
};
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
)
|
|
3450
|
-
|
|
3451
|
-
__decorateClass([
|
|
3452
|
-
n({ type: String, attribute: "view" })
|
|
3453
|
-
], TestScoringButtons.prototype, "view", 2);
|
|
3454
|
-
__decorateClass([
|
|
3455
|
-
n({ type: Boolean })
|
|
3456
|
-
], TestScoringButtons.prototype, "disabled", 2);
|
|
3457
|
-
__decorateClass([
|
|
3458
|
-
c({ context: computedContext, subscribe: true })
|
|
3459
|
-
], TestScoringButtons.prototype, "computedContext", 2);
|
|
3460
|
-
TestScoringButtons = __decorateClass([
|
|
3461
|
-
t("test-scoring-buttons")
|
|
3462
|
-
], TestScoringButtons);
|
|
3712
|
+
_a = TestView;
|
|
3713
|
+
__decorate23([
|
|
3714
|
+
c({ context: sessionContext, subscribe: true })
|
|
3715
|
+
], TestView.prototype, "sessionContext", void 0);
|
|
3716
|
+
__decorate23([
|
|
3717
|
+
n2({ type: String })
|
|
3718
|
+
], TestView.prototype, "label", void 0);
|
|
3719
|
+
__decorate23([
|
|
3720
|
+
n2({ type: String, attribute: "view-options" })
|
|
3721
|
+
], TestView.prototype, "viewOptions", void 0);
|
|
3722
|
+
__decorate23([
|
|
3723
|
+
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
3724
|
+
], TestView.prototype, "_handleViewOptionsChange", void 0);
|
|
3725
|
+
__decorate23([
|
|
3726
|
+
r()
|
|
3727
|
+
], TestView.prototype, "_viewOptions", void 0);
|
|
3463
3728
|
|
|
3464
|
-
// ../qti-test/
|
|
3729
|
+
// ../qti-test/dist/components/test-view-toggle/test-view-toggle.js
|
|
3730
|
+
var __decorate24 = function(decorators, target, key, desc) {
|
|
3731
|
+
var c2 = arguments.length, r3 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3732
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r3 = Reflect.decorate(decorators, target, key, desc);
|
|
3733
|
+
else for (var i4 = decorators.length - 1; i4 >= 0; i4--) if (d = decorators[i4]) r3 = (c2 < 3 ? d(r3) : c2 > 3 ? d(target, key, r3) : d(target, key)) || r3;
|
|
3734
|
+
return c2 > 3 && r3 && Object.defineProperty(target, key, r3), r3;
|
|
3735
|
+
};
|
|
3465
3736
|
var TestViewToggle = class extends i2 {
|
|
3466
3737
|
createRenderRoot() {
|
|
3467
3738
|
return this;
|
|
@@ -3476,13 +3747,11 @@ var TestViewToggle = class extends i2 {
|
|
|
3476
3747
|
this.myTemplate = prepareTemplate(templateElement);
|
|
3477
3748
|
}
|
|
3478
3749
|
_switchView(view) {
|
|
3479
|
-
this.dispatchEvent(
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
})
|
|
3485
|
-
);
|
|
3750
|
+
this.dispatchEvent(new CustomEvent("on-test-switch-view", {
|
|
3751
|
+
composed: true,
|
|
3752
|
+
bubbles: true,
|
|
3753
|
+
detail: view
|
|
3754
|
+
}));
|
|
3486
3755
|
}
|
|
3487
3756
|
firstUpdated(_changedProperties) {
|
|
3488
3757
|
this.addEventListener("click", () => {
|
|
@@ -3499,126 +3768,86 @@ var TestViewToggle = class extends i2 {
|
|
|
3499
3768
|
}) : A}`;
|
|
3500
3769
|
}
|
|
3501
3770
|
};
|
|
3502
|
-
|
|
3771
|
+
__decorate24([
|
|
3503
3772
|
c({ context: sessionContext, subscribe: true })
|
|
3504
|
-
], TestViewToggle.prototype, "sessionContext",
|
|
3505
|
-
TestViewToggle = __decorateClass([
|
|
3506
|
-
t("test-view-toggle")
|
|
3507
|
-
], TestViewToggle);
|
|
3508
|
-
|
|
3509
|
-
// ../qti-test/src/components/test-scoring-feedback/test-scoring-feedback.ts
|
|
3510
|
-
var TestScoringFeedback = class extends i2 {
|
|
3511
|
-
constructor() {
|
|
3512
|
-
super(...arguments);
|
|
3513
|
-
this.view = null;
|
|
3514
|
-
}
|
|
3515
|
-
render() {
|
|
3516
|
-
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
3517
|
-
if (!activeItem || !activeItem.variables) return T``;
|
|
3518
|
-
if (activeItem["category"] === "dep-informational") return T`<div>${this.dataset.informational}</div>`;
|
|
3519
|
-
const completionStatus = activeItem?.variables.find((v2) => v2.identifier === "completionStatus")?.value;
|
|
3520
|
-
const scoreOutcome = activeItem?.variables.find((vr) => vr.identifier == "SCORE");
|
|
3521
|
-
const score = parseFloat(scoreOutcome?.value);
|
|
3522
|
-
const externalScored = activeItem["externalScored"];
|
|
3523
|
-
const feedbackText = () => {
|
|
3524
|
-
if (completionStatus !== "completed") {
|
|
3525
|
-
return this.dataset.textNoResponse;
|
|
3526
|
-
}
|
|
3527
|
-
if (!externalScored && score !== void 0 && !Number.isNaN(score)) {
|
|
3528
|
-
return score > 0 ? this.dataset.textCorrect : this.dataset.textIncorrect;
|
|
3529
|
-
}
|
|
3530
|
-
if (externalScored === "externalMachine") {
|
|
3531
|
-
return Number.isNaN(score) || score === void 0 ? this.dataset.scoreUnknown : `We hebben je antwoord ${score === 0 ? "geen punten" : score == 1 ? "\xE9\xE9n punt" : `${score} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`;
|
|
3532
|
-
}
|
|
3533
|
-
if (externalScored === "human") {
|
|
3534
|
-
return Number.isNaN(score) ? "" : "Deze score heb je zelf toegekend.";
|
|
3535
|
-
}
|
|
3536
|
-
return this.dataset.inProgress;
|
|
3537
|
-
};
|
|
3538
|
-
return T`<div>${feedbackText()}</div>`;
|
|
3539
|
-
}
|
|
3540
|
-
};
|
|
3541
|
-
__decorateClass([
|
|
3542
|
-
c({ context: computedContext, subscribe: true })
|
|
3543
|
-
], TestScoringFeedback.prototype, "computedContext", 2);
|
|
3544
|
-
__decorateClass([
|
|
3545
|
-
n({ type: String, attribute: "view" })
|
|
3546
|
-
], TestScoringFeedback.prototype, "view", 2);
|
|
3547
|
-
TestScoringFeedback = __decorateClass([
|
|
3548
|
-
t("test-scoring-feedback")
|
|
3549
|
-
], TestScoringFeedback);
|
|
3773
|
+
], TestViewToggle.prototype, "sessionContext", void 0);
|
|
3550
3774
|
|
|
3551
|
-
// ../qti-test/
|
|
3552
|
-
var
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
}
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
}
|
|
3574
|
-
}
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
]
|
|
3775
|
+
// ../qti-test/dist/elements.js
|
|
3776
|
+
var qtiTestElements = [
|
|
3777
|
+
{ tag: "qti-assessment-item-ref", ctor: QtiAssessmentItemRef },
|
|
3778
|
+
{ tag: "qti-assessment-section", ctor: QtiAssessmentSection },
|
|
3779
|
+
{ tag: "qti-assessment-test", ctor: QtiAssessmentTest },
|
|
3780
|
+
{ tag: "qti-outcome-processing", ctor: QtiOutcomeProcessing },
|
|
3781
|
+
{ tag: "qti-test", ctor: QtiTest },
|
|
3782
|
+
{ tag: "qti-test-feedback", ctor: QtiTestFeedback },
|
|
3783
|
+
{ tag: "qti-test-part", ctor: QtiTestPart },
|
|
3784
|
+
{ tag: "qti-test-variables", ctor: QtiTestVariables },
|
|
3785
|
+
{ tag: "test-check-item", ctor: TestCheckItem },
|
|
3786
|
+
{ tag: "test-container", ctor: TestContainer },
|
|
3787
|
+
{ tag: "test-end-attempt", ctor: TestEndAttempt },
|
|
3788
|
+
{ tag: "test-item-link", ctor: TestItemLink },
|
|
3789
|
+
{ tag: "test-item-to-speech", ctor: TestItemToSpeech },
|
|
3790
|
+
{ tag: "test-navigation", ctor: TestNavigation },
|
|
3791
|
+
{ tag: "test-next", ctor: TestNext },
|
|
3792
|
+
{ tag: "test-paging-buttons-stamp", ctor: TestPagingButtonsStamp },
|
|
3793
|
+
{ tag: "test-prev", ctor: TestPrev },
|
|
3794
|
+
{ tag: "test-print-context", ctor: TestPrintContext },
|
|
3795
|
+
{ tag: "test-print-item-variables", ctor: TestPrintVariables },
|
|
3796
|
+
{ tag: "test-scoring-buttons", ctor: TestScoringButtons },
|
|
3797
|
+
{ tag: "test-scoring-feedback", ctor: TestScoringFeedback },
|
|
3798
|
+
{ tag: "test-section-buttons-stamp", ctor: TestSectionButtonsStamp },
|
|
3799
|
+
{ tag: "test-section-link", ctor: TestSectionLink },
|
|
3800
|
+
{ tag: "test-stamp", ctor: TestStamp },
|
|
3801
|
+
{ tag: "test-tts-next", ctor: TestTtsNext },
|
|
3802
|
+
{ tag: "test-tts-pause", ctor: TestTtsPause },
|
|
3803
|
+
{ tag: "test-tts-play", ctor: TestTtsPlay },
|
|
3804
|
+
{ tag: "test-tts-prev", ctor: TestTtsPrev },
|
|
3805
|
+
{ tag: "test-tts-resume", ctor: TestTtsResume },
|
|
3806
|
+
{ tag: "test-tts-stop", ctor: TestTtsStop },
|
|
3807
|
+
{ tag: "test-view", ctor: TestView },
|
|
3808
|
+
{ tag: "test-view-toggle", ctor: TestViewToggle }
|
|
3809
|
+
];
|
|
3586
3810
|
|
|
3587
3811
|
export {
|
|
3588
|
-
QtiTest,
|
|
3589
3812
|
QtiAssessmentItemRef,
|
|
3590
3813
|
QtiAssessmentSection,
|
|
3591
3814
|
QtiAssessmentTest,
|
|
3592
|
-
|
|
3815
|
+
QtiOutcomeProcessing,
|
|
3816
|
+
QtiOutcomeProcessingProcessor,
|
|
3593
3817
|
QtiTestFeedback,
|
|
3818
|
+
QtiTestPart,
|
|
3819
|
+
QtiTestVariables,
|
|
3820
|
+
QtiTestVariablesExpression,
|
|
3821
|
+
QtiTest,
|
|
3822
|
+
TestCheckItem,
|
|
3823
|
+
TestContainer,
|
|
3824
|
+
TestEndAttempt,
|
|
3825
|
+
TestItemLink,
|
|
3826
|
+
ttsContext,
|
|
3827
|
+
TestItemToSpeech,
|
|
3828
|
+
TestTtsPlay,
|
|
3829
|
+
TestTtsPause,
|
|
3830
|
+
TestTtsResume,
|
|
3831
|
+
TestTtsStop,
|
|
3832
|
+
TestTtsPrev,
|
|
3833
|
+
TestTtsNext,
|
|
3594
3834
|
TestNavigation,
|
|
3595
3835
|
TestNext,
|
|
3596
|
-
TestPrev,
|
|
3597
|
-
TestView,
|
|
3598
|
-
TestItemLink,
|
|
3599
|
-
TestEndAttempt,
|
|
3600
|
-
TestShowCorrectResponse,
|
|
3601
3836
|
TestPagingButtonsStamp,
|
|
3602
|
-
|
|
3837
|
+
TestPrev,
|
|
3838
|
+
TestPrintContext,
|
|
3603
3839
|
TestPrintVariables,
|
|
3840
|
+
TestScoringButtons,
|
|
3841
|
+
TestScoringFeedback,
|
|
3604
3842
|
TestSectionButtonsStamp,
|
|
3605
3843
|
TestSectionLink,
|
|
3606
|
-
TestPrintContext,
|
|
3607
3844
|
TestStamp,
|
|
3608
|
-
|
|
3845
|
+
TestView,
|
|
3609
3846
|
TestViewToggle,
|
|
3610
|
-
|
|
3611
|
-
TestCheckItem
|
|
3847
|
+
qtiTestElements
|
|
3612
3848
|
};
|
|
3613
3849
|
/*! Bundled license information:
|
|
3614
3850
|
|
|
3615
|
-
lit-html/node/lit-html.js:
|
|
3616
|
-
(**
|
|
3617
|
-
* @license
|
|
3618
|
-
* Copyright 2017 Google LLC
|
|
3619
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
3620
|
-
*)
|
|
3621
|
-
|
|
3622
3851
|
@heximal/expressions/lib/constants.js:
|
|
3623
3852
|
@heximal/expressions/lib/tokenizer.js:
|
|
3624
3853
|
@heximal/expressions/lib/parser.js:
|
|
@@ -3636,4 +3865,4 @@ lit-html/node/private-ssr-support.js:
|
|
|
3636
3865
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3637
3866
|
*)
|
|
3638
3867
|
*/
|
|
3639
|
-
//# sourceMappingURL=chunk-
|
|
3868
|
+
//# sourceMappingURL=chunk-RXGDQDOV.js.map
|