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