@citolab/qti-components 7.28.0 → 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 +6178 -2946
- package/dist/base.d.ts +9 -50
- package/dist/base.js +31 -6
- package/dist/chunk-5QYII4OZ.js +1374 -0
- package/dist/chunk-5QYII4OZ.js.map +1 -0
- package/dist/{chunk-FK2IVMS3.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-F6WP6WEF.js → chunk-7V4HJFHW.js} +3 -3
- package/dist/{chunk-F6WP6WEF.js.map → chunk-7V4HJFHW.js.map} +1 -1
- package/dist/{chunk-Z2SUBRH5.js → chunk-H3J7LFRO.js} +834 -1005
- package/dist/chunk-H3J7LFRO.js.map +1 -0
- package/dist/chunk-IJD53WY6.js +719 -0
- 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-PINGOK2F.js → chunk-LZJHHZQ2.js} +1979 -1775
- 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-YLIYPNMK.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-OQ77SE2W.js → chunk-WVVMNF74.js} +851 -925
- package/dist/chunk-WVVMNF74.js.map +1 -0
- package/dist/{chunk-N7S3GNUP.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 +189 -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 -127
- 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 +5394 -2718
- package/dist/test.d.ts +1 -537
- package/dist/test.js +26 -11
- package/dist/transformers.d.ts +1 -18
- package/dist/transformers.js +1 -2
- package/package.json +20 -16
- package/custom-elements.json +0 -43161
- package/dist/chunk-BPIDAS3T.js +0 -495
- package/dist/chunk-BPIDAS3T.js.map +0 -1
- package/dist/chunk-FK2IVMS3.js.map +0 -1
- package/dist/chunk-LQZCSHN5.js +0 -3673
- package/dist/chunk-LQZCSHN5.js.map +0 -1
- package/dist/chunk-OQ77SE2W.js.map +0 -1
- package/dist/chunk-PINGOK2F.js.map +0 -1
- package/dist/chunk-QXBXORM3.js +0 -27
- package/dist/chunk-U2FLSHK7.js +0 -510
- package/dist/chunk-U2FLSHK7.js.map +0 -1
- package/dist/chunk-YLIYPNMK.js.map +0 -1
- package/dist/chunk-Z2SUBRH5.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-B1BYmCcq.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-DMx816H0.d.ts +0 -68
- package/dist/qti.context-B8PSyIWm.d.ts +0 -14
- package/dist/test.context-CByZZjkR.d.ts +0 -15
- package/dist/variables-CMYcDbyW.d.ts +0 -70
- /package/dist/{chunk-N7S3GNUP.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,36 +27,250 @@ 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) {
|
|
43
266
|
super(...args);
|
|
44
267
|
this.navigate = null;
|
|
45
|
-
this.cacheTransform = false;
|
|
46
268
|
this.requestTimeout = 3e4;
|
|
47
269
|
this.postLoadTransformCallback = null;
|
|
48
270
|
this.postLoadTestTransformCallback = null;
|
|
49
|
-
// Navigation state tracking
|
|
50
271
|
this._activeController = null;
|
|
51
272
|
this._loadResults = [];
|
|
52
273
|
this._navigationId = 0;
|
|
53
|
-
// Simple loading progress tracking
|
|
54
274
|
this._loadingState = {
|
|
55
275
|
expectedItems: 0,
|
|
56
276
|
connectedItems: 0,
|
|
@@ -58,7 +278,6 @@ var TestNavigationMixin = (superClass) => {
|
|
|
58
278
|
loadedStimulus: 0,
|
|
59
279
|
isComplete: false
|
|
60
280
|
};
|
|
61
|
-
// Track loaded/loading stimulus hrefs to prevent duplicates
|
|
62
281
|
this._loadedStimulusHrefs = /* @__PURE__ */ new Set();
|
|
63
282
|
this._loadingStimulusHrefs = /* @__PURE__ */ new Set();
|
|
64
283
|
this._bindEventHandlers();
|
|
@@ -74,13 +293,11 @@ var TestNavigationMixin = (superClass) => {
|
|
|
74
293
|
navigateTo(type, id) {
|
|
75
294
|
const targetId = id || this._getDefaultNavigationId(type);
|
|
76
295
|
if (targetId) {
|
|
77
|
-
this.dispatchEvent(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
83
|
-
);
|
|
296
|
+
this.dispatchEvent(new CustomEvent("qti-request-navigation", {
|
|
297
|
+
detail: { type, id: targetId },
|
|
298
|
+
bubbles: true,
|
|
299
|
+
composed: true
|
|
300
|
+
}));
|
|
84
301
|
}
|
|
85
302
|
}
|
|
86
303
|
// ===========================================
|
|
@@ -92,15 +309,15 @@ var TestNavigationMixin = (superClass) => {
|
|
|
92
309
|
this.addEventListener("qti-assessment-item-connected", this._handleItemConnected.bind(this));
|
|
93
310
|
this.addEventListener("qti-assessment-stimulus-ref-connected", this._handleStimulusRefConnected.bind(this));
|
|
94
311
|
}
|
|
95
|
-
_handleTestConnected(
|
|
96
|
-
this._testElement =
|
|
312
|
+
_handleTestConnected(e2) {
|
|
313
|
+
this._testElement = e2.detail;
|
|
97
314
|
this._initializeNavigation();
|
|
98
315
|
}
|
|
99
316
|
/**
|
|
100
317
|
* Handle item connection events - track connected items and discover stimulus references
|
|
101
318
|
*/
|
|
102
|
-
_handleItemConnected(
|
|
103
|
-
const itemRef =
|
|
319
|
+
_handleItemConnected(e2) {
|
|
320
|
+
const itemRef = e2.detail;
|
|
104
321
|
this._loadingState.connectedItems++;
|
|
105
322
|
const stimulusRefs = itemRef.querySelectorAll("qti-assessment-stimulus-ref");
|
|
106
323
|
this._loadingState.expectedStimulus += stimulusRefs.length;
|
|
@@ -109,9 +326,9 @@ var TestNavigationMixin = (superClass) => {
|
|
|
109
326
|
/**
|
|
110
327
|
* Handle stimulus reference connection events with duplicate prevention
|
|
111
328
|
*/
|
|
112
|
-
async _handleStimulusRefConnected(
|
|
113
|
-
|
|
114
|
-
const { element, item } =
|
|
329
|
+
async _handleStimulusRefConnected(e2) {
|
|
330
|
+
e2.preventDefault();
|
|
331
|
+
const { element, item } = e2;
|
|
115
332
|
console.info("Stimulus ref connected:", {
|
|
116
333
|
identifier: element.identifier,
|
|
117
334
|
href: element.href,
|
|
@@ -157,7 +374,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
157
374
|
return this.sessionContext?.navItemRefId ?? this._testElement?.querySelector("qti-assessment-item-ref")?.identifier;
|
|
158
375
|
}
|
|
159
376
|
_initializeNavigation() {
|
|
160
|
-
if (!this.navigate)
|
|
377
|
+
if (!this.navigate)
|
|
378
|
+
return;
|
|
161
379
|
const id = this._getDefaultNavigationId(this.navigate);
|
|
162
380
|
if (id) {
|
|
163
381
|
this.navigateTo(this.navigate, id);
|
|
@@ -167,7 +385,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
167
385
|
* Main navigation request handler with proper lifecycle management
|
|
168
386
|
*/
|
|
169
387
|
async _handleNavigationRequest({ detail }) {
|
|
170
|
-
if (!detail?.id)
|
|
388
|
+
if (!detail?.id)
|
|
389
|
+
return;
|
|
171
390
|
this._cancelPreviousNavigation();
|
|
172
391
|
const navigationId = ++this._navigationId;
|
|
173
392
|
const controller = new AbortController();
|
|
@@ -206,7 +425,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
206
425
|
this._loadingState.expectedItems = 1;
|
|
207
426
|
await this._loadItems([itemId], navigationId, controller);
|
|
208
427
|
await this._waitForLoadingComplete(navigationId, controller);
|
|
209
|
-
if (this._isStaleNavigation(navigationId, controller))
|
|
428
|
+
if (this._isStaleNavigation(navigationId, controller))
|
|
429
|
+
return;
|
|
210
430
|
this._dispatchTestLoaded(this._loadResults);
|
|
211
431
|
}
|
|
212
432
|
/**
|
|
@@ -226,7 +446,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
226
446
|
this._loadingState.expectedItems = itemIds.length;
|
|
227
447
|
await this._loadItems(itemIds, navigationId, controller);
|
|
228
448
|
await this._waitForLoadingComplete(navigationId, controller);
|
|
229
|
-
if (this._isStaleNavigation(navigationId, controller))
|
|
449
|
+
if (this._isStaleNavigation(navigationId, controller))
|
|
450
|
+
return;
|
|
230
451
|
this._dispatchTestLoaded(this._loadResults);
|
|
231
452
|
}
|
|
232
453
|
// ===========================================
|
|
@@ -261,7 +482,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
261
482
|
*/
|
|
262
483
|
async _waitForLoadingComplete(navigationId, controller) {
|
|
263
484
|
while (!this._loadingState.isComplete) {
|
|
264
|
-
if (this._isStaleNavigation(navigationId, controller))
|
|
485
|
+
if (this._isStaleNavigation(navigationId, controller))
|
|
486
|
+
return;
|
|
265
487
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
266
488
|
}
|
|
267
489
|
}
|
|
@@ -340,24 +562,30 @@ var TestNavigationMixin = (superClass) => {
|
|
|
340
562
|
* Load items with simple tracking
|
|
341
563
|
*/
|
|
342
564
|
async _loadItems(itemIds, navigationId, controller) {
|
|
343
|
-
if (!this._testElement || itemIds.length === 0)
|
|
565
|
+
if (!this._testElement || itemIds.length === 0)
|
|
566
|
+
return;
|
|
344
567
|
const itemRefs = itemIds.map((id) => this._findItemRef(id));
|
|
345
568
|
this._clearLoadedItems();
|
|
346
569
|
this._clearStimulusRef();
|
|
347
570
|
const results = await Promise.all(itemRefs.map((ref) => this._loadSingleItem(ref, navigationId, controller)));
|
|
348
571
|
const validResults = results.filter(Boolean);
|
|
349
|
-
if (this._isStaleNavigation(navigationId, controller))
|
|
572
|
+
if (this._isStaleNavigation(navigationId, controller))
|
|
573
|
+
return;
|
|
350
574
|
validResults.forEach(({ itemRef, doc }) => {
|
|
351
|
-
if (itemRef && doc)
|
|
575
|
+
if (itemRef && doc)
|
|
576
|
+
itemRef.xmlDoc = doc;
|
|
352
577
|
});
|
|
353
578
|
validResults.forEach(({ itemRef }) => {
|
|
354
579
|
const itemId = itemRef?.identifier;
|
|
355
|
-
if (!itemRef || !itemId)
|
|
356
|
-
|
|
357
|
-
|
|
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;
|
|
358
585
|
itemRef.updateComplete.then(() => {
|
|
359
586
|
const assessmentItem = itemRef.assessmentItem;
|
|
360
|
-
if (!assessmentItem)
|
|
587
|
+
if (!assessmentItem)
|
|
588
|
+
return;
|
|
361
589
|
assessmentItem.state = savedState;
|
|
362
590
|
});
|
|
363
591
|
});
|
|
@@ -365,14 +593,15 @@ var TestNavigationMixin = (superClass) => {
|
|
|
365
593
|
}
|
|
366
594
|
async _loadSingleItem(itemRef, navigationId, controller) {
|
|
367
595
|
try {
|
|
368
|
-
|
|
596
|
+
const seed = this.querySelector("test-navigation")?.qtiContext?.QTI_CONTEXT?.seed;
|
|
597
|
+
let transformer = (await qtiTransformItem().load(itemRef.href, controller.signal)).shuffleInteractions(seed);
|
|
369
598
|
if (this.postLoadTransformCallback) {
|
|
370
599
|
transformer = await this.postLoadTransformCallback(transformer, itemRef);
|
|
371
600
|
}
|
|
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,81 +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, "
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
], TestNavigationClass.prototype, "
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
], TestNavigationClass.prototype, "
|
|
498
|
-
__decorateClass([
|
|
499
|
-
n({ attribute: false })
|
|
500
|
-
], TestNavigationClass.prototype, "postLoadTestTransformCallback", 2);
|
|
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);
|
|
501
719
|
return TestNavigationClass;
|
|
502
720
|
};
|
|
503
721
|
|
|
504
|
-
// ../qti-test/
|
|
722
|
+
// ../qti-test/dist/mixins/test-view.mixin.js
|
|
505
723
|
var TestViewMixin = (superClass) => {
|
|
506
724
|
class TestViewClass extends superClass {
|
|
507
725
|
constructor(...args) {
|
|
508
726
|
super(...args);
|
|
509
727
|
this.sessionContext = { ...this.sessionContext, view: "candidate" };
|
|
510
|
-
this.addEventListener("on-test-switch-view", (
|
|
511
|
-
this.sessionContext = { ...this.sessionContext, view:
|
|
728
|
+
this.addEventListener("on-test-switch-view", (e2) => {
|
|
729
|
+
this.sessionContext = { ...this.sessionContext, view: e2.detail };
|
|
512
730
|
this._updateElementView();
|
|
513
731
|
});
|
|
514
732
|
this.addEventListener("qti-assessment-test-connected", () => {
|
|
515
733
|
this._updateElementView();
|
|
516
734
|
});
|
|
517
|
-
this.addEventListener("qti-assessment-item-connected", (
|
|
735
|
+
this.addEventListener("qti-assessment-item-connected", (e2) => {
|
|
518
736
|
this._updateElementView();
|
|
519
|
-
this._setCorrectResponseVisibility(
|
|
737
|
+
this._setCorrectResponseVisibility(e2.detail);
|
|
520
738
|
});
|
|
521
739
|
}
|
|
522
740
|
willUpdate(changedProperties) {
|
|
@@ -532,44 +750,41 @@ var TestViewMixin = (superClass) => {
|
|
|
532
750
|
viewElements.forEach((element) => {
|
|
533
751
|
element.classList.toggle("show", element.getAttribute("view") === this.sessionContext.view);
|
|
534
752
|
});
|
|
535
|
-
const assessmentItemRef = this._testElement.querySelector(
|
|
536
|
-
`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`
|
|
537
|
-
);
|
|
753
|
+
const assessmentItemRef = this._testElement.querySelector(`qti-assessment-item-ref[identifier="${this.sessionContext.navItemRefId}"]`);
|
|
538
754
|
const assessmentItem = assessmentItemRef?.assessmentItem;
|
|
539
|
-
if (assessmentItem)
|
|
540
|
-
|
|
541
|
-
}
|
|
755
|
+
if (assessmentItem)
|
|
756
|
+
this.updateAssessmentItemView(assessmentItem, this.sessionContext.view);
|
|
542
757
|
}
|
|
543
758
|
}
|
|
544
759
|
// Event handler for connected QTI assessment items
|
|
545
760
|
_setCorrectResponseVisibility(assessmentItem) {
|
|
546
|
-
|
|
761
|
+
this.updateAssessmentItemView(assessmentItem, this.sessionContext.view);
|
|
762
|
+
}
|
|
763
|
+
/** Extension point for packages that add view-dependent assessment presentation. */
|
|
764
|
+
updateAssessmentItemView(_assessmentItem, _view) {
|
|
547
765
|
}
|
|
548
766
|
}
|
|
549
767
|
return TestViewClass;
|
|
550
768
|
};
|
|
551
769
|
|
|
552
|
-
// ../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
|
+
};
|
|
553
777
|
var TestBaseMixin = (superClass) => {
|
|
554
778
|
class TestBaseClass extends superClass {
|
|
555
779
|
constructor(...args) {
|
|
556
780
|
super(...args);
|
|
557
781
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
558
782
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
559
|
-
/**
|
|
560
|
-
* Updates the variables of an assessment item in the test context.
|
|
561
|
-
* - Matches the assessment item with the corresponding test context item.
|
|
562
|
-
* - If the item is not found, logs a warning.
|
|
563
|
-
* - Updates variables in the test context if exactly one variable exists.
|
|
564
|
-
* - Otherwise, syncs the assessment item's variables with the test context.
|
|
565
|
-
*
|
|
566
|
-
* @param assessmentItem - The assessment item to update.
|
|
567
|
-
*/
|
|
568
783
|
this._updateItemInTestContext = (assessmentItem) => {
|
|
569
784
|
const context = assessmentItem._context;
|
|
570
785
|
const identifier = context.identifier;
|
|
571
786
|
const fullVariables = context.variables;
|
|
572
|
-
const itemContext = this.testContext.items.find((
|
|
787
|
+
const itemContext = this.testContext.items.find((i4) => i4?.identifier === identifier);
|
|
573
788
|
if (!itemContext) {
|
|
574
789
|
console.warn(`Item IDs between assessment.xml and item.xml should match: ${identifier} is not found!`);
|
|
575
790
|
return;
|
|
@@ -579,7 +794,7 @@ var TestBaseMixin = (superClass) => {
|
|
|
579
794
|
} else {
|
|
580
795
|
const newVariables = [...assessmentItem.variables];
|
|
581
796
|
for (const variable of itemContext.variables) {
|
|
582
|
-
const currentVariable = newVariables.find((
|
|
797
|
+
const currentVariable = newVariables.find((v) => v.identifier === variable.identifier);
|
|
583
798
|
if (currentVariable) {
|
|
584
799
|
currentVariable.value = variable.value;
|
|
585
800
|
} else {
|
|
@@ -595,23 +810,22 @@ var TestBaseMixin = (superClass) => {
|
|
|
595
810
|
const itemContext = this.testContext.items.find((item) => item.identifier === itemRefID);
|
|
596
811
|
if (itemContext) {
|
|
597
812
|
itemContext.variables = itemContext.variables.map((variable) => {
|
|
598
|
-
const updatedVariable = variables.find((
|
|
813
|
+
const updatedVariable = variables.find((v) => v.identifier === variable.identifier);
|
|
599
814
|
return updatedVariable ? { ...variable, ...updatedVariable } : variable;
|
|
600
815
|
});
|
|
601
816
|
}
|
|
602
|
-
const itemRef = this._testElement.querySelector(
|
|
603
|
-
`qti-assessment-item-ref[identifier="${itemRefID}"]`
|
|
604
|
-
);
|
|
817
|
+
const itemRef = this._testElement.querySelector(`qti-assessment-item-ref[identifier="${itemRefID}"]`);
|
|
605
818
|
if (itemRef && itemRef.assessmentItem) {
|
|
606
819
|
itemRef.assessmentItem.variables = variables;
|
|
607
820
|
}
|
|
608
821
|
}
|
|
609
822
|
_initializeEventListeners() {
|
|
610
|
-
this.addEventListener("qti-assessment-test-connected", (
|
|
823
|
+
this.addEventListener("qti-assessment-test-connected", (e2) => {
|
|
611
824
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
612
825
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
613
|
-
if (this.testContext && this.testContext.items.length > 0)
|
|
614
|
-
|
|
826
|
+
if (this.testContext && this.testContext.items.length > 0)
|
|
827
|
+
return;
|
|
828
|
+
this._testElement = e2.detail;
|
|
615
829
|
const items = Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map((itemRef) => {
|
|
616
830
|
return {
|
|
617
831
|
href: itemRef.href,
|
|
@@ -628,20 +842,16 @@ var TestBaseMixin = (superClass) => {
|
|
|
628
842
|
});
|
|
629
843
|
this.testContext = { ...this.testContext, items };
|
|
630
844
|
});
|
|
631
|
-
this.addEventListener("qti-assessment-item-connected", (
|
|
632
|
-
const assessmentItem =
|
|
845
|
+
this.addEventListener("qti-assessment-item-connected", (e2) => {
|
|
846
|
+
const assessmentItem = e2.detail;
|
|
633
847
|
const assessmentRefId = assessmentItem.closest("qti-assessment-item-ref")?.identifier;
|
|
634
848
|
if (assessmentRefId) {
|
|
635
849
|
assessmentItem.assessmentItemRefId = assessmentRefId;
|
|
636
850
|
}
|
|
637
|
-
this._updateItemInTestContext(
|
|
851
|
+
this._updateItemInTestContext(e2.detail);
|
|
638
852
|
});
|
|
639
|
-
this.addEventListener("qti-item-context-updated", (
|
|
640
|
-
this._updateItemVariablesInTestContext(
|
|
641
|
-
e3.detail.itemContext.identifier,
|
|
642
|
-
e3.detail.itemContext.variables,
|
|
643
|
-
e3.detail.itemContext.state
|
|
644
|
-
);
|
|
853
|
+
this.addEventListener("qti-item-context-updated", (e2) => {
|
|
854
|
+
this._updateItemVariablesInTestContext(e2.detail.itemContext.identifier, e2.detail.itemContext.variables, e2.detail.itemContext.state);
|
|
645
855
|
});
|
|
646
856
|
}
|
|
647
857
|
_updateItemVariablesInTestContext(identifier, variables, state) {
|
|
@@ -656,55 +866,51 @@ var TestBaseMixin = (superClass) => {
|
|
|
656
866
|
...itemContext,
|
|
657
867
|
// Keep other properties of the item context
|
|
658
868
|
variables: variables.map((variable) => {
|
|
659
|
-
const matchingVariable = itemContext.variables.find((
|
|
869
|
+
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
660
870
|
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
661
871
|
}),
|
|
662
872
|
...state !== void 0 ? { state: state ? { ...state } : void 0 } : {}
|
|
663
873
|
};
|
|
664
874
|
})
|
|
665
875
|
};
|
|
666
|
-
this.dispatchEvent(
|
|
667
|
-
new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false })
|
|
668
|
-
);
|
|
876
|
+
this.dispatchEvent(new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false }));
|
|
669
877
|
}
|
|
670
878
|
}
|
|
671
|
-
|
|
672
|
-
|
|
879
|
+
__decorate6([
|
|
880
|
+
n2({ attribute: false, type: Object }),
|
|
673
881
|
e({ context: testContext })
|
|
674
|
-
], TestBaseClass.prototype, "testContext",
|
|
675
|
-
|
|
676
|
-
|
|
882
|
+
], TestBaseClass.prototype, "testContext", void 0);
|
|
883
|
+
__decorate6([
|
|
884
|
+
n2({ attribute: false, type: Object }),
|
|
677
885
|
e({ context: sessionContext })
|
|
678
|
-
], TestBaseClass.prototype, "sessionContext",
|
|
886
|
+
], TestBaseClass.prototype, "sessionContext", void 0);
|
|
679
887
|
return TestBaseClass;
|
|
680
888
|
};
|
|
681
889
|
var TestBase = class extends TestBaseMixin(i2) {
|
|
682
890
|
};
|
|
683
891
|
|
|
684
|
-
// ../qti-test/
|
|
892
|
+
// ../qti-test/dist/mixins/test-processing.mixin.js
|
|
685
893
|
var TestProcessingMixin = (superClass) => {
|
|
686
894
|
class TestProcessingElement extends superClass {
|
|
687
895
|
constructor(...args) {
|
|
688
896
|
super(...args);
|
|
689
|
-
this.addEventListener("qti-register-variable", (
|
|
897
|
+
this.addEventListener("qti-register-variable", (e2) => {
|
|
690
898
|
this.testContext = {
|
|
691
899
|
...this.testContext,
|
|
692
|
-
testOutcomeVariables: [...this.testContext.testOutcomeVariables || [],
|
|
900
|
+
testOutcomeVariables: [...this.testContext.testOutcomeVariables || [], e2.detail.variable]
|
|
693
901
|
};
|
|
694
|
-
|
|
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();
|
|
695
908
|
});
|
|
696
|
-
this.addEventListener(
|
|
697
|
-
"qti-set-outcome-value",
|
|
698
|
-
(e3) => {
|
|
699
|
-
const { outcomeIdentifier, value } = e3.detail;
|
|
700
|
-
this.updateOutcomeVariable(outcomeIdentifier, value);
|
|
701
|
-
e3.stopPropagation();
|
|
702
|
-
}
|
|
703
|
-
);
|
|
704
909
|
}
|
|
705
910
|
outcomeProcessing() {
|
|
706
911
|
const outcomeProcessor = this.querySelector("qti-outcome-processing");
|
|
707
|
-
if (!outcomeProcessor)
|
|
912
|
+
if (!outcomeProcessor)
|
|
913
|
+
return false;
|
|
708
914
|
outcomeProcessor?.process();
|
|
709
915
|
return true;
|
|
710
916
|
}
|
|
@@ -717,13 +923,13 @@ var TestProcessingMixin = (superClass) => {
|
|
|
717
923
|
}
|
|
718
924
|
this.testContext = {
|
|
719
925
|
...this.testContext,
|
|
720
|
-
testOutcomeVariables: this.testContext.testOutcomeVariables?.map((
|
|
721
|
-
if (
|
|
722
|
-
return
|
|
926
|
+
testOutcomeVariables: this.testContext.testOutcomeVariables?.map((v) => {
|
|
927
|
+
if (v.identifier !== identifier) {
|
|
928
|
+
return v;
|
|
723
929
|
}
|
|
724
930
|
return {
|
|
725
|
-
...
|
|
726
|
-
value: outcomeVariable.cardinality === "single" ? value : [...
|
|
931
|
+
...v,
|
|
932
|
+
value: outcomeVariable.cardinality === "single" ? value : [...v.value, value]
|
|
727
933
|
};
|
|
728
934
|
})
|
|
729
935
|
};
|
|
@@ -732,17 +938,24 @@ var TestProcessingMixin = (superClass) => {
|
|
|
732
938
|
return this.getVariable(identifier);
|
|
733
939
|
}
|
|
734
940
|
getVariable(identifier) {
|
|
735
|
-
return this.testContext.testOutcomeVariables?.find((
|
|
941
|
+
return this.testContext.testOutcomeVariables?.find((v) => v.identifier === identifier) || null;
|
|
736
942
|
}
|
|
737
|
-
/* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */
|
|
738
943
|
}
|
|
739
944
|
return TestProcessingElement;
|
|
740
945
|
};
|
|
741
946
|
|
|
742
|
-
// ../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
|
+
};
|
|
743
954
|
var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixin(TestBaseMixin(i2)))) {
|
|
744
|
-
|
|
745
|
-
|
|
955
|
+
constructor() {
|
|
956
|
+
super(...arguments);
|
|
957
|
+
this.configContext = {};
|
|
958
|
+
}
|
|
746
959
|
/**
|
|
747
960
|
* Renders the component's template.
|
|
748
961
|
* Provides a default `<slot>` for content projection.
|
|
@@ -756,244 +969,672 @@ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixi
|
|
|
756
969
|
return T`<slot></slot>`;
|
|
757
970
|
}
|
|
758
971
|
};
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
972
|
+
__decorate7([
|
|
973
|
+
r(),
|
|
974
|
+
e({ context: configContext })
|
|
975
|
+
], QtiTest.prototype, "configContext", void 0);
|
|
762
976
|
|
|
763
|
-
// ../qti-test/
|
|
764
|
-
var
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
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
|
+
`;
|
|
770
1010
|
}
|
|
771
|
-
};
|
|
772
|
-
var QtiAssessmentItemRef = class extends i2 {
|
|
773
1011
|
constructor() {
|
|
774
|
-
super(
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
return this.renderRoot?.querySelector("qti-assessment-item");
|
|
785
|
-
}
|
|
786
|
-
async connectedCallback() {
|
|
787
|
-
super.connectedCallback();
|
|
788
|
-
await this.updateComplete;
|
|
789
|
-
this.dispatchEvent(
|
|
790
|
-
new CustomEvent("qti-assessment-item-ref-connected", {
|
|
791
|
-
bubbles: true,
|
|
792
|
-
composed: true,
|
|
793
|
-
detail: { identifier: this.identifier, href: this.href, category: this.category }
|
|
794
|
-
})
|
|
795
|
-
);
|
|
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
|
+
});
|
|
796
1022
|
}
|
|
797
1023
|
render() {
|
|
798
|
-
return
|
|
1024
|
+
return T` <slot></slot> `;
|
|
799
1025
|
}
|
|
800
1026
|
};
|
|
801
|
-
__decorateClass([
|
|
802
|
-
n({ type: String })
|
|
803
|
-
], QtiAssessmentItemRef.prototype, "category", 2);
|
|
804
|
-
__decorateClass([
|
|
805
|
-
n({ type: String })
|
|
806
|
-
], QtiAssessmentItemRef.prototype, "identifier", 2);
|
|
807
|
-
__decorateClass([
|
|
808
|
-
n({ type: Boolean, converter: stringToBooleanConverter })
|
|
809
|
-
], QtiAssessmentItemRef.prototype, "required", 2);
|
|
810
|
-
__decorateClass([
|
|
811
|
-
n({ type: Boolean, converter: stringToBooleanConverter })
|
|
812
|
-
], QtiAssessmentItemRef.prototype, "fixed", 2);
|
|
813
|
-
__decorateClass([
|
|
814
|
-
n({ type: String })
|
|
815
|
-
], QtiAssessmentItemRef.prototype, "href", 2);
|
|
816
|
-
__decorateClass([
|
|
817
|
-
n({ type: Object, attribute: false })
|
|
818
|
-
], QtiAssessmentItemRef.prototype, "xmlDoc", 2);
|
|
819
|
-
if (!customElements.get("qti-assessment-item-ref")) {
|
|
820
|
-
customElements.define("qti-assessment-item-ref", QtiAssessmentItemRef);
|
|
821
|
-
}
|
|
822
1027
|
|
|
823
|
-
// ../qti-test/
|
|
824
|
-
var
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
return value ? "true" : "false";
|
|
830
|
-
}
|
|
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;
|
|
831
1034
|
};
|
|
832
|
-
var
|
|
833
|
-
|
|
834
|
-
|
|
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;
|
|
835
1047
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
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
|
+
}
|
|
840
1089
|
}
|
|
841
|
-
#title = "";
|
|
842
1090
|
async connectedCallback() {
|
|
843
|
-
this.#title = this.getAttribute("title") || "";
|
|
844
1091
|
super.connectedCallback();
|
|
845
|
-
|
|
846
|
-
this
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
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];
|
|
852
1109
|
}
|
|
853
1110
|
render() {
|
|
854
|
-
return T
|
|
1111
|
+
return T`
|
|
1112
|
+
${this.#templateContent}
|
|
1113
|
+
<slot></slot>
|
|
1114
|
+
${m(this.testDoc, T`<span>Loading...</span>`)}
|
|
1115
|
+
`;
|
|
855
1116
|
}
|
|
856
1117
|
};
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
],
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
],
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
],
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
],
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
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);
|
|
878
1140
|
|
|
879
|
-
// ../qti-test/
|
|
880
|
-
var
|
|
881
|
-
|
|
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
|
+
}
|
|
882
1153
|
constructor() {
|
|
883
|
-
super(
|
|
884
|
-
|
|
1154
|
+
super();
|
|
1155
|
+
this.addEventListener("click", () => this.dispatchEvent(new CustomEvent("test-end-attempt", { bubbles: true })));
|
|
885
1156
|
}
|
|
886
|
-
|
|
887
|
-
return
|
|
1157
|
+
render() {
|
|
1158
|
+
return T` <slot></slot> `;
|
|
888
1159
|
}
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
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
|
+
`;
|
|
893
1179
|
}
|
|
894
|
-
|
|
895
|
-
super
|
|
896
|
-
|
|
897
|
-
this.
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
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
|
+
}));
|
|
904
1194
|
}
|
|
905
1195
|
render() {
|
|
906
|
-
return T` <slot></slot
|
|
1196
|
+
return T` <slot></slot> `;
|
|
907
1197
|
}
|
|
908
1198
|
};
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
], QtiAssessmentTest.prototype, "identifier", 2);
|
|
913
|
-
__decorateClass([
|
|
914
|
-
n({ type: String })
|
|
915
|
-
], QtiAssessmentTest.prototype, "title", 1);
|
|
916
|
-
__decorateClass([
|
|
917
|
-
c({ context: testContext, subscribe: true })
|
|
918
|
-
], QtiAssessmentTest.prototype, "_testContext", 2);
|
|
919
|
-
QtiAssessmentTest = __decorateClass([
|
|
920
|
-
t("qti-assessment-test")
|
|
921
|
-
], QtiAssessmentTest);
|
|
1199
|
+
__decorate9([
|
|
1200
|
+
n2({ type: String, attribute: "item-id" })
|
|
1201
|
+
], TestItemLink.prototype, "itemId", void 0);
|
|
922
1202
|
|
|
923
|
-
// ../qti-test/
|
|
924
|
-
var
|
|
925
|
-
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;
|
|
926
1269
|
constructor() {
|
|
927
|
-
super(
|
|
928
|
-
this.
|
|
929
|
-
this
|
|
930
|
-
this
|
|
931
|
-
this
|
|
932
|
-
|
|
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
|
+
};
|
|
933
1294
|
}
|
|
934
|
-
|
|
935
|
-
|
|
1295
|
+
willUpdate(changed) {
|
|
1296
|
+
void changed;
|
|
936
1297
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
this
|
|
940
|
-
|
|
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;
|
|
941
1307
|
}
|
|
942
|
-
|
|
1308
|
+
connectedCallback() {
|
|
943
1309
|
super.connectedCallback();
|
|
944
|
-
|
|
945
|
-
this.
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
);
|
|
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();
|
|
951
1323
|
}
|
|
952
1324
|
render() {
|
|
953
|
-
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
|
+
}
|
|
954
1545
|
}
|
|
955
1546
|
};
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
],
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
if (
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
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
|
+
}
|
|
978
1568
|
render() {
|
|
979
|
-
|
|
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
|
+
`;
|
|
980
1624
|
}
|
|
981
1625
|
};
|
|
982
|
-
QtiTestFeedback.styles = i`
|
|
983
|
-
:host {
|
|
984
|
-
color: gray;
|
|
985
|
-
}
|
|
986
|
-
`;
|
|
987
|
-
QtiTestFeedback = __decorateClass([
|
|
988
|
-
t("qti-test-feedback")
|
|
989
|
-
], QtiTestFeedback);
|
|
990
1626
|
|
|
991
|
-
// ../qti-test/
|
|
992
|
-
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
|
+
};
|
|
993
1634
|
var TestNavigation = class extends i2 {
|
|
1635
|
+
#testElement;
|
|
994
1636
|
constructor() {
|
|
995
1637
|
super();
|
|
996
|
-
__privateAdd(this, _TestNavigation_instances);
|
|
997
1638
|
this.identifier = void 0;
|
|
998
1639
|
this.initContext = [];
|
|
999
1640
|
this.qtiContext = {
|
|
@@ -1005,67 +1646,222 @@ var TestNavigation = class extends i2 {
|
|
|
1005
1646
|
};
|
|
1006
1647
|
this.configContext = {};
|
|
1007
1648
|
this.autoScoreItems = false;
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
this.
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
this.
|
|
1034
|
-
|
|
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
|
+
}
|
|
1035
1687
|
}
|
|
1036
1688
|
render() {
|
|
1037
1689
|
return T`<slot></slot>`;
|
|
1038
1690
|
}
|
|
1039
|
-
/* PK: on
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
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`) || []);
|
|
1043
1723
|
this.computedContext = {
|
|
1044
|
-
|
|
1724
|
+
identifier: this.#testElement.identifier,
|
|
1725
|
+
title: this.#testElement.title,
|
|
1045
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,
|
|
1046
1796
|
testParts: this.computedContext.testParts.map((testPart) => {
|
|
1047
1797
|
return {
|
|
1048
1798
|
...testPart,
|
|
1049
|
-
active: this._sessionContext?.navPartId === testPart.identifier || false,
|
|
1050
1799
|
sections: testPart.sections.map((section) => {
|
|
1051
1800
|
return {
|
|
1052
1801
|
...section,
|
|
1053
|
-
active: this._sessionContext?.navSectionId === section.identifier || false,
|
|
1054
|
-
completed: section.items.every(
|
|
1055
|
-
(item) => this._testContext.items.find((i5) => i5.identifier === item.identifier)?.variables.find((v2) => v2.identifier === "completionStatus").value === "completed"
|
|
1056
|
-
),
|
|
1057
1802
|
items: section.items.map((item) => {
|
|
1058
|
-
|
|
1059
|
-
|
|
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 {
|
|
1060
1818
|
...item,
|
|
1061
|
-
|
|
1062
|
-
|
|
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
|
|
1063
1828
|
};
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
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;
|
|
1069
1865
|
const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;
|
|
1070
1866
|
const index = item.categories.includes(this.configContext?.infoItemCategory) ? null : itemIndex++;
|
|
1071
1867
|
const rawMaxScore = item.variables?.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
@@ -1077,897 +1873,131 @@ var TestNavigation = class extends i2 {
|
|
|
1077
1873
|
score,
|
|
1078
1874
|
response,
|
|
1079
1875
|
index,
|
|
1080
|
-
// type,
|
|
1081
1876
|
active,
|
|
1082
|
-
// correct,
|
|
1083
1877
|
maxScore
|
|
1878
|
+
// type,
|
|
1879
|
+
// correct,
|
|
1084
1880
|
// incorrect,
|
|
1085
1881
|
// completed
|
|
1086
1882
|
};
|
|
1087
|
-
})
|
|
1088
|
-
};
|
|
1089
|
-
})
|
|
1090
|
-
};
|
|
1091
|
-
})
|
|
1092
|
-
};
|
|
1093
|
-
this.dispatchEvent(
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
})
|
|
1098
|
-
);
|
|
1099
|
-
}
|
|
1100
|
-
};
|
|
1101
|
-
_testElement = new WeakMap();
|
|
1102
|
-
_TestNavigation_instances = new WeakSet();
|
|
1103
|
-
/**
|
|
1104
|
-
* Handles the 'test-end-attempt' event.
|
|
1105
|
-
* @private
|
|
1106
|
-
* @listens TestNavigation#test-end-attempt
|
|
1107
|
-
* @param {CustomEvent} event - The custom event object.
|
|
1108
|
-
*/
|
|
1109
|
-
handleTestEndAttempt_fn = function(_event) {
|
|
1110
|
-
const qtiItemEl = __privateGet(this, _testElement).querySelector(
|
|
1111
|
-
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`
|
|
1112
|
-
);
|
|
1113
|
-
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1114
|
-
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
1115
|
-
qtiAssessmentItemEl.processResponse(true, reportValidityAfterScoring);
|
|
1116
|
-
};
|
|
1117
|
-
// protected createRenderRoot(): HTMLElement | DocumentFragment {
|
|
1118
|
-
// return this;
|
|
1119
|
-
// }
|
|
1120
|
-
// myTemplate: TemplateFunction;
|
|
1121
|
-
// connectedCallback(): void {
|
|
1122
|
-
// super.connectedCallback();
|
|
1123
|
-
// const templateElement = this.querySelector<HTMLTemplateElement>('template');
|
|
1124
|
-
// if (!templateElement) {
|
|
1125
|
-
// this.myTemplate = null;
|
|
1126
|
-
// return;
|
|
1127
|
-
// }
|
|
1128
|
-
// this.myTemplate = prepareTemplate(templateElement);
|
|
1129
|
-
// }
|
|
1130
|
-
/**
|
|
1131
|
-
* Handles the 'test-show-correct-response' event.
|
|
1132
|
-
* @private
|
|
1133
|
-
* @listens TestNavigation#test-show-correct-response
|
|
1134
|
-
* @param {CustomEvent} event - The custom event object.
|
|
1135
|
-
*/
|
|
1136
|
-
handleTestShowCorrectResponse_fn = function(event) {
|
|
1137
|
-
const qtiItemEl = __privateGet(this, _testElement).querySelector(
|
|
1138
|
-
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`
|
|
1139
|
-
);
|
|
1140
|
-
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1141
|
-
if (!qtiAssessmentItemEl) return;
|
|
1142
|
-
qtiAssessmentItemEl.showCorrectResponse(event.detail);
|
|
1143
|
-
};
|
|
1144
|
-
/**
|
|
1145
|
-
* Handles the 'test-show-candidate-correction' event.
|
|
1146
|
-
* @private
|
|
1147
|
-
* @listens TestNavigation#test-show-candidate-correction
|
|
1148
|
-
* @param {CustomEvent} event - The custom event object.
|
|
1149
|
-
*/
|
|
1150
|
-
handleTestShowCandidateCorrection_fn = function(event) {
|
|
1151
|
-
const qtiItemEl = __privateGet(this, _testElement).querySelector(
|
|
1152
|
-
`qti-assessment-item-ref[identifier="${this._sessionContext.navItemRefId}"]`
|
|
1153
|
-
);
|
|
1154
|
-
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1155
|
-
qtiAssessmentItemEl.showCandidateCorrection(event.detail);
|
|
1156
|
-
};
|
|
1157
|
-
handleTestUpdateOutcomeVariable_fn = function(event) {
|
|
1158
|
-
const qtiItemEl = __privateGet(this, _testElement).querySelector(
|
|
1159
|
-
`qti-assessment-item-ref[identifier="${event.detail.assessmentItemRefId}"]`
|
|
1160
|
-
);
|
|
1161
|
-
const qtiAssessmentItemEl = qtiItemEl.assessmentItem;
|
|
1162
|
-
qtiAssessmentItemEl.setOutcomeVariable(event.detail.outcomeVariableId, event.detail.value);
|
|
1163
|
-
};
|
|
1164
|
-
handleInteractionChanged_fn = function(_event) {
|
|
1165
|
-
if (this.autoScoreItems) {
|
|
1166
|
-
const assessmentItem = _event.composedPath()[0].closest(
|
|
1167
|
-
"qti-assessment-item"
|
|
1168
|
-
);
|
|
1169
|
-
const scoreOutcomeIdentifier = assessmentItem.variables.find((v2) => v2.identifier === "SCORE");
|
|
1170
|
-
if (scoreOutcomeIdentifier && scoreOutcomeIdentifier.externalScored === null && assessmentItem.adaptive === "false") {
|
|
1171
|
-
const reportValidityAfterScoring = this.configContext?.reportValidityAfterScoring === true ? true : false;
|
|
1172
|
-
assessmentItem.processResponse(true, reportValidityAfterScoring);
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
};
|
|
1176
|
-
/* PK: on test connected we can build the computed context */
|
|
1177
|
-
handleTestConnected_fn = function(event) {
|
|
1178
|
-
__privateSet(this, _testElement, event.detail);
|
|
1179
|
-
if (!this.qtiContext.QTI_CONTEXT?.testIdentifier) {
|
|
1180
|
-
const currentContext = this.qtiContext.QTI_CONTEXT || {
|
|
1181
|
-
testIdentifier: "",
|
|
1182
|
-
candidateIdentifier: "not set",
|
|
1183
|
-
environmentIdentifier: "default"
|
|
1184
|
-
};
|
|
1185
|
-
this.qtiContext = {
|
|
1186
|
-
QTI_CONTEXT: {
|
|
1187
|
-
...currentContext,
|
|
1188
|
-
testIdentifier: __privateGet(this, _testElement).identifier,
|
|
1189
|
-
environmentIdentifier: currentContext.environmentIdentifier || "default"
|
|
1190
|
-
}
|
|
1191
|
-
};
|
|
1192
|
-
}
|
|
1193
|
-
const contextDeclarations = __privateGet(this, _testElement).querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]');
|
|
1194
|
-
contextDeclarations.forEach((declaration) => {
|
|
1195
|
-
const defaultValues = __privateMethod(this, _TestNavigation_instances, extractDefaultValues_fn).call(this, declaration);
|
|
1196
|
-
if (Object.keys(defaultValues).length > 0) {
|
|
1197
|
-
this.qtiContext = {
|
|
1198
|
-
QTI_CONTEXT: {
|
|
1199
|
-
...defaultValues,
|
|
1200
|
-
// Default values first
|
|
1201
|
-
...this.qtiContext.QTI_CONTEXT
|
|
1202
|
-
// Runtime values override defaults
|
|
1203
|
-
}
|
|
1204
|
-
};
|
|
1205
|
-
}
|
|
1206
|
-
});
|
|
1207
|
-
const testPartElements = Array.from(__privateGet(this, _testElement)?.querySelectorAll(`qti-test-part`) || []);
|
|
1208
|
-
this.computedContext = {
|
|
1209
|
-
identifier: __privateGet(this, _testElement).identifier,
|
|
1210
|
-
title: __privateGet(this, _testElement).title,
|
|
1211
|
-
view: this._sessionContext?.view,
|
|
1212
|
-
testParts: testPartElements.map((testPart) => {
|
|
1213
|
-
const sectionElements = [...testPart.querySelectorAll(`qti-assessment-section`)];
|
|
1214
|
-
return {
|
|
1215
|
-
active: false,
|
|
1216
|
-
identifier: testPart.identifier,
|
|
1217
|
-
navigationMode: testPart.navigationMode,
|
|
1218
|
-
submissionMode: testPart.submissionMode,
|
|
1219
|
-
sections: sectionElements.map((section) => {
|
|
1220
|
-
const itemElements = [...section.querySelectorAll(`qti-assessment-item-ref`)];
|
|
1221
|
-
return {
|
|
1222
|
-
active: false,
|
|
1223
|
-
identifier: section.identifier,
|
|
1224
|
-
title: section.title,
|
|
1225
|
-
items: itemElements.map((item) => ({
|
|
1226
|
-
...this.initContext?.find((i5) => i5.identifier === item.identifier),
|
|
1227
|
-
active: false,
|
|
1228
|
-
identifier: item.identifier,
|
|
1229
|
-
categories: item.category ? item.category?.split(" ") : [],
|
|
1230
|
-
href: item.href,
|
|
1231
|
-
variables: []
|
|
1232
|
-
}))
|
|
1233
|
-
};
|
|
1234
|
-
})
|
|
1235
|
-
};
|
|
1236
|
-
})
|
|
1237
|
-
};
|
|
1238
|
-
};
|
|
1239
|
-
/**
|
|
1240
|
-
* Extract default values from a qti-context-declaration element
|
|
1241
|
-
*/
|
|
1242
|
-
extractDefaultValues_fn = function(declaration) {
|
|
1243
|
-
const defaultValues = {};
|
|
1244
|
-
const defaultValueElement = declaration.querySelector("qti-default-value");
|
|
1245
|
-
if (!defaultValueElement) {
|
|
1246
|
-
return defaultValues;
|
|
1247
|
-
}
|
|
1248
|
-
const valueElements = defaultValueElement.querySelectorAll("qti-value[field-identifier]");
|
|
1249
|
-
valueElements.forEach((valueElement) => {
|
|
1250
|
-
const fieldIdentifier = valueElement.getAttribute("field-identifier");
|
|
1251
|
-
const baseType = valueElement.getAttribute("base-type") || "string";
|
|
1252
|
-
const textContent = valueElement.textContent?.trim() || "";
|
|
1253
|
-
if (fieldIdentifier) {
|
|
1254
|
-
let value = textContent;
|
|
1255
|
-
switch (baseType) {
|
|
1256
|
-
case "integer":
|
|
1257
|
-
value = parseInt(textContent, 10);
|
|
1258
|
-
break;
|
|
1259
|
-
case "float":
|
|
1260
|
-
case "duration":
|
|
1261
|
-
value = parseFloat(textContent);
|
|
1262
|
-
break;
|
|
1263
|
-
case "boolean":
|
|
1264
|
-
value = textContent.toLowerCase() === "true";
|
|
1265
|
-
break;
|
|
1266
|
-
case "string":
|
|
1267
|
-
default:
|
|
1268
|
-
value = textContent;
|
|
1269
|
-
break;
|
|
1270
|
-
}
|
|
1271
|
-
defaultValues[fieldIdentifier] = value;
|
|
1272
|
-
}
|
|
1273
|
-
});
|
|
1274
|
-
return defaultValues;
|
|
1275
|
-
};
|
|
1276
|
-
/* PK: on item connected we can add item only properties in the xml */
|
|
1277
|
-
handleItemConnected_fn = function(event) {
|
|
1278
|
-
const itemElement = event.detail;
|
|
1279
|
-
this.computedContext = {
|
|
1280
|
-
...this.computedContext,
|
|
1281
|
-
testParts: this.computedContext.testParts.map((testPart) => {
|
|
1282
|
-
return {
|
|
1283
|
-
...testPart,
|
|
1284
|
-
sections: testPart.sections.map((section) => {
|
|
1285
|
-
return {
|
|
1286
|
-
...section,
|
|
1287
|
-
items: section.items.map((item) => {
|
|
1288
|
-
if (item.identifier !== itemElement.parentElement.getAttribute("identifier")) {
|
|
1289
|
-
return item;
|
|
1290
|
-
}
|
|
1291
|
-
const scoreOutcome = itemElement.querySelector(
|
|
1292
|
-
"qti-outcome-declaration[identifier='SCORE']"
|
|
1293
|
-
);
|
|
1294
|
-
const externalScored = scoreOutcome?.getAttribute("externalScored");
|
|
1295
|
-
const responseDeclarations = itemElement.querySelectorAll("qti-response-declaration");
|
|
1296
|
-
const containsCorrectResponse = Array.from(responseDeclarations).some(
|
|
1297
|
-
(r4) => r4.querySelector("qti-correct-response")
|
|
1298
|
-
);
|
|
1299
|
-
const containsMapping = Array.from(responseDeclarations).some((r4) => {
|
|
1300
|
-
const mapping = r4.querySelector("qti-mapping");
|
|
1301
|
-
const areaMapping = r4.querySelector("qti-area-mapping");
|
|
1302
|
-
return mapping?.querySelector("qti-map-entry") || areaMapping?.querySelector("qti-area-map-entry");
|
|
1303
|
-
});
|
|
1304
|
-
const hasCorrectResponse = containsCorrectResponse || containsMapping;
|
|
1305
|
-
const hasResponseProcessing = itemElement.querySelector("qti-response-processing") ? true : false;
|
|
1306
|
-
return {
|
|
1307
|
-
...item,
|
|
1308
|
-
assessmentItemIdentifier: itemElement.getAttribute("identifier"),
|
|
1309
|
-
label: itemElement.getAttribute("label"),
|
|
1310
|
-
title: itemElement.title,
|
|
1311
|
-
externalScored,
|
|
1312
|
-
adaptive: itemElement.adaptive == "true" || false,
|
|
1313
|
-
timeDependent: itemElement.timeDependent == "true" || false,
|
|
1314
|
-
variables: itemElement.variables,
|
|
1315
|
-
hasCorrectResponse,
|
|
1316
|
-
hasResponseProcessing
|
|
1317
|
-
};
|
|
1318
|
-
})
|
|
1319
|
-
};
|
|
1320
|
-
})
|
|
1321
|
-
};
|
|
1322
|
-
})
|
|
1323
|
-
};
|
|
1324
|
-
};
|
|
1325
|
-
__decorateClass([
|
|
1326
|
-
n({ type: String })
|
|
1327
|
-
], TestNavigation.prototype, "identifier", 2);
|
|
1328
|
-
__decorateClass([
|
|
1329
|
-
r()
|
|
1330
|
-
], TestNavigation.prototype, "initContext", 2);
|
|
1331
|
-
__decorateClass([
|
|
1332
|
-
r(),
|
|
1333
|
-
e({ context: qtiContext })
|
|
1334
|
-
], TestNavigation.prototype, "qtiContext", 2);
|
|
1335
|
-
__decorateClass([
|
|
1336
|
-
r(),
|
|
1337
|
-
e({ context: configContext })
|
|
1338
|
-
], TestNavigation.prototype, "configContext", 2);
|
|
1339
|
-
__decorateClass([
|
|
1340
|
-
r(),
|
|
1341
|
-
c({ context: testContext, subscribe: true })
|
|
1342
|
-
], TestNavigation.prototype, "_testContext", 2);
|
|
1343
|
-
__decorateClass([
|
|
1344
|
-
r(),
|
|
1345
|
-
c({ context: sessionContext, subscribe: true })
|
|
1346
|
-
], TestNavigation.prototype, "_sessionContext", 2);
|
|
1347
|
-
__decorateClass([
|
|
1348
|
-
r(),
|
|
1349
|
-
e({ context: computedContext })
|
|
1350
|
-
], TestNavigation.prototype, "computedContext", 2);
|
|
1351
|
-
__decorateClass([
|
|
1352
|
-
n({ type: Boolean, attribute: "auto-score-items" })
|
|
1353
|
-
], TestNavigation.prototype, "autoScoreItems", 2);
|
|
1354
|
-
TestNavigation = __decorateClass([
|
|
1355
|
-
t("test-navigation")
|
|
1356
|
-
], TestNavigation);
|
|
1357
|
-
|
|
1358
|
-
// ../qti-test/src/components/styles.ts
|
|
1359
|
-
var form = i`
|
|
1360
|
-
display: inline-flex;
|
|
1361
|
-
align-items: center;
|
|
1362
|
-
cursor: pointer;
|
|
1363
|
-
padding: 0.5rem 1rem;
|
|
1364
|
-
border-radius: 0.25rem;
|
|
1365
|
-
user-select: none;
|
|
1366
|
-
`;
|
|
1367
|
-
var btn = i`
|
|
1368
|
-
background-color: lightgray;
|
|
1369
|
-
${form};
|
|
1370
|
-
`;
|
|
1371
|
-
var dis = i`
|
|
1372
|
-
cursor: not-allowed;
|
|
1373
|
-
opacity: 0.8;
|
|
1374
|
-
`;
|
|
1375
|
-
var ind = i`
|
|
1376
|
-
${form};
|
|
1377
|
-
border: 1px solid gray;
|
|
1378
|
-
`;
|
|
1379
|
-
|
|
1380
|
-
// ../qti-test/src/components/test-next/test-next.ts
|
|
1381
|
-
var _internals;
|
|
1382
|
-
var TestNext = class extends i2 {
|
|
1383
|
-
constructor() {
|
|
1384
|
-
super();
|
|
1385
|
-
this._internalDisabled = true;
|
|
1386
|
-
__privateAdd(this, _internals);
|
|
1387
|
-
__privateSet(this, _internals, this.attachInternals());
|
|
1388
|
-
__privateGet(this, _internals).role = "button";
|
|
1389
|
-
__privateGet(this, _internals).ariaLabel = "Next item";
|
|
1390
|
-
this.addEventListener("click", (e3) => {
|
|
1391
|
-
e3.preventDefault();
|
|
1392
|
-
if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex + 1].identifier);
|
|
1393
|
-
});
|
|
1394
|
-
}
|
|
1395
|
-
_handleTestElementChange(_oldValue, newValue) {
|
|
1396
|
-
if (newValue) {
|
|
1397
|
-
this._internalDisabled = false;
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
connectedCallback() {
|
|
1401
|
-
super.connectedCallback();
|
|
1402
|
-
this.checkDisabled();
|
|
1403
|
-
}
|
|
1404
|
-
willUpdate(_changedProperties) {
|
|
1405
|
-
if (!this.computedContext) return;
|
|
1406
|
-
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
1407
|
-
if (!testPart) return;
|
|
1408
|
-
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
1409
|
-
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
1410
|
-
this.checkDisabled();
|
|
1411
|
-
}
|
|
1412
|
-
checkDisabled() {
|
|
1413
|
-
this._internalDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= this.sectionItems?.length - 1;
|
|
1414
|
-
}
|
|
1415
|
-
_requestItem(identifier) {
|
|
1416
|
-
this.dispatchEvent(
|
|
1417
|
-
new CustomEvent("qti-request-navigation", {
|
|
1418
|
-
composed: true,
|
|
1419
|
-
bubbles: true,
|
|
1420
|
-
detail: {
|
|
1421
|
-
type: "item",
|
|
1422
|
-
id: identifier
|
|
1423
|
-
}
|
|
1424
|
-
})
|
|
1425
|
-
);
|
|
1426
|
-
}
|
|
1427
|
-
render() {
|
|
1428
|
-
return T`<slot></slot>`;
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
_internals = new WeakMap();
|
|
1432
|
-
TestNext.styles = i`
|
|
1433
|
-
:host {
|
|
1434
|
-
${btn};
|
|
1435
|
-
}
|
|
1436
|
-
:host([disabled]) {
|
|
1437
|
-
${dis};
|
|
1438
|
-
}
|
|
1439
|
-
`;
|
|
1440
|
-
__decorateClass([
|
|
1441
|
-
n({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
1442
|
-
], TestNext.prototype, "_internalDisabled", 2);
|
|
1443
|
-
__decorateClass([
|
|
1444
|
-
c({ context: computedContext, subscribe: true })
|
|
1445
|
-
], TestNext.prototype, "computedContext", 2);
|
|
1446
|
-
__decorateClass([
|
|
1447
|
-
watch("computedContext")
|
|
1448
|
-
], TestNext.prototype, "_handleTestElementChange", 1);
|
|
1449
|
-
TestNext = __decorateClass([
|
|
1450
|
-
t("test-next")
|
|
1451
|
-
], TestNext);
|
|
1452
|
-
|
|
1453
|
-
// ../qti-test/src/components/test-prev/test-prev.ts
|
|
1454
|
-
var TestPrev = class extends i2 {
|
|
1455
|
-
constructor() {
|
|
1456
|
-
super();
|
|
1457
|
-
this._internalDisabled = true;
|
|
1458
|
-
this.addEventListener("click", (e3) => {
|
|
1459
|
-
e3.preventDefault();
|
|
1460
|
-
if (!this._internalDisabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
_handleTestElementChange(_oldValue, newValue) {
|
|
1464
|
-
if (newValue) {
|
|
1465
|
-
this._internalDisabled = false;
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
willUpdate(_changedProperties) {
|
|
1469
|
-
if (!this.computedContext) return;
|
|
1470
|
-
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
1471
|
-
if (!testPart) return;
|
|
1472
|
-
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
1473
|
-
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
1474
|
-
this.checkDisabled();
|
|
1475
|
-
}
|
|
1476
|
-
checkDisabled() {
|
|
1477
|
-
this._internalDisabled = !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
|
|
1478
|
-
}
|
|
1479
|
-
_requestItem(identifier) {
|
|
1480
|
-
this.dispatchEvent(
|
|
1481
|
-
new CustomEvent("qti-request-navigation", {
|
|
1482
|
-
composed: true,
|
|
1483
|
-
bubbles: true,
|
|
1484
|
-
detail: {
|
|
1485
|
-
type: "item",
|
|
1486
|
-
id: identifier
|
|
1487
|
-
}
|
|
1488
|
-
})
|
|
1489
|
-
);
|
|
1490
|
-
}
|
|
1491
|
-
render() {
|
|
1492
|
-
return T`<slot></slot>`;
|
|
1493
|
-
}
|
|
1494
|
-
};
|
|
1495
|
-
TestPrev.styles = i`
|
|
1496
|
-
:host {
|
|
1497
|
-
${btn};
|
|
1498
|
-
}
|
|
1499
|
-
:host([disabled]) {
|
|
1500
|
-
${dis};
|
|
1501
|
-
}
|
|
1502
|
-
`;
|
|
1503
|
-
__decorateClass([
|
|
1504
|
-
n({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
1505
|
-
], TestPrev.prototype, "_internalDisabled", 2);
|
|
1506
|
-
__decorateClass([
|
|
1507
|
-
c({ context: computedContext, subscribe: true })
|
|
1508
|
-
], TestPrev.prototype, "computedContext", 2);
|
|
1509
|
-
__decorateClass([
|
|
1510
|
-
watch("computedContext")
|
|
1511
|
-
], TestPrev.prototype, "_handleTestElementChange", 1);
|
|
1512
|
-
TestPrev = __decorateClass([
|
|
1513
|
-
t("test-prev")
|
|
1514
|
-
], TestPrev);
|
|
1515
|
-
|
|
1516
|
-
// ../qti-test/src/components/test-view-toggle/test-view.ts
|
|
1517
|
-
var _TestView_instances, updateViewOptions_fn;
|
|
1518
|
-
var TestView = class extends i2 {
|
|
1519
|
-
constructor() {
|
|
1520
|
-
super(...arguments);
|
|
1521
|
-
__privateAdd(this, _TestView_instances);
|
|
1522
|
-
this.label = "view";
|
|
1523
|
-
this._handleViewOptionsChange = () => {
|
|
1524
|
-
__privateMethod(this, _TestView_instances, updateViewOptions_fn).call(this);
|
|
1525
|
-
};
|
|
1526
|
-
this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;
|
|
1527
|
-
}
|
|
1528
|
-
connectedCallback() {
|
|
1529
|
-
super.connectedCallback();
|
|
1530
|
-
__privateMethod(this, _TestView_instances, updateViewOptions_fn).call(this);
|
|
1531
|
-
}
|
|
1532
|
-
_switchView(view) {
|
|
1533
|
-
this.dispatchEvent(
|
|
1534
|
-
new CustomEvent("on-test-switch-view", {
|
|
1535
|
-
composed: true,
|
|
1536
|
-
bubbles: true,
|
|
1537
|
-
detail: view
|
|
1538
|
-
})
|
|
1539
|
-
);
|
|
1540
|
-
}
|
|
1541
|
-
render() {
|
|
1542
|
-
return T`
|
|
1543
|
-
<label part="label" for="viewSelect">${this.label}</label>
|
|
1544
|
-
<select
|
|
1545
|
-
part="select"
|
|
1546
|
-
id="viewSelect"
|
|
1547
|
-
@change=${(e3) => {
|
|
1548
|
-
const el = e3.target;
|
|
1549
|
-
this._switchView(el.value);
|
|
1550
|
-
}}
|
|
1551
|
-
>
|
|
1552
|
-
${this._viewOptions.map(
|
|
1553
|
-
(v2) => T`<option value="${v2}" ?selected=${v2 === this.sessionContext.view}>${v2}</option>`
|
|
1554
|
-
)}
|
|
1555
|
-
</select>
|
|
1556
|
-
`;
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
_TestView_instances = new WeakSet();
|
|
1560
|
-
updateViewOptions_fn = function() {
|
|
1561
|
-
if (this.viewOptions) {
|
|
1562
|
-
const options = this.viewOptions.split(",").map((opt) => opt.trim());
|
|
1563
|
-
this._viewOptions = options.filter((opt) => TestView.DEFAULT_VIEW_OPTIONS.includes(opt));
|
|
1564
|
-
} else {
|
|
1565
|
-
this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;
|
|
1566
|
-
}
|
|
1567
|
-
};
|
|
1568
|
-
TestView.DEFAULT_VIEW_OPTIONS = ["author", "candidate", "proctor", "scorer", "testConstructor", "tutor"];
|
|
1569
|
-
__decorateClass([
|
|
1570
|
-
c({ context: sessionContext, subscribe: true })
|
|
1571
|
-
], TestView.prototype, "sessionContext", 2);
|
|
1572
|
-
__decorateClass([
|
|
1573
|
-
n({ type: String })
|
|
1574
|
-
], TestView.prototype, "label", 2);
|
|
1575
|
-
__decorateClass([
|
|
1576
|
-
n({ type: String, attribute: "view-options" })
|
|
1577
|
-
], TestView.prototype, "viewOptions", 2);
|
|
1578
|
-
__decorateClass([
|
|
1579
|
-
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
1580
|
-
], TestView.prototype, "_handleViewOptionsChange", 2);
|
|
1581
|
-
__decorateClass([
|
|
1582
|
-
r()
|
|
1583
|
-
], TestView.prototype, "_viewOptions", 2);
|
|
1584
|
-
TestView = __decorateClass([
|
|
1585
|
-
t("test-view")
|
|
1586
|
-
], TestView);
|
|
1587
|
-
|
|
1588
|
-
// ../qti-test/src/components/test-item-link/test-item-link.ts
|
|
1589
|
-
var TestItemLink = class extends i2 {
|
|
1590
|
-
constructor() {
|
|
1591
|
-
super();
|
|
1592
|
-
this.itemId = null;
|
|
1593
|
-
this.addEventListener("click", () => this._requestItem(this.itemId));
|
|
1594
|
-
}
|
|
1595
|
-
_requestItem(identifier) {
|
|
1596
|
-
this.dispatchEvent(
|
|
1597
|
-
new CustomEvent("qti-request-navigation", {
|
|
1598
|
-
composed: true,
|
|
1599
|
-
bubbles: true,
|
|
1600
|
-
detail: {
|
|
1601
|
-
type: "item",
|
|
1602
|
-
id: identifier
|
|
1603
|
-
}
|
|
1604
|
-
})
|
|
1605
|
-
);
|
|
1606
|
-
}
|
|
1607
|
-
render() {
|
|
1608
|
-
return T` <slot></slot> `;
|
|
1609
|
-
}
|
|
1610
|
-
};
|
|
1611
|
-
TestItemLink.styles = i`
|
|
1612
|
-
:host {
|
|
1613
|
-
${btn};
|
|
1614
|
-
}
|
|
1615
|
-
:host([disabled]) {
|
|
1616
|
-
${dis};
|
|
1617
|
-
}
|
|
1618
|
-
`;
|
|
1619
|
-
__decorateClass([
|
|
1620
|
-
n({ type: String, attribute: "item-id" })
|
|
1621
|
-
], TestItemLink.prototype, "itemId", 2);
|
|
1622
|
-
TestItemLink = __decorateClass([
|
|
1623
|
-
t("test-item-link")
|
|
1624
|
-
], TestItemLink);
|
|
1625
|
-
|
|
1626
|
-
// ../qti-test/src/components/test-end-attempt/test-end-attempt.ts
|
|
1627
|
-
var TestEndAttempt = class extends i2 {
|
|
1628
|
-
constructor() {
|
|
1629
|
-
super();
|
|
1630
|
-
this.addEventListener("click", () => this.dispatchEvent(new CustomEvent("test-end-attempt", { bubbles: true })));
|
|
1631
|
-
}
|
|
1632
|
-
render() {
|
|
1633
|
-
return T` <slot></slot> `;
|
|
1634
|
-
}
|
|
1635
|
-
};
|
|
1636
|
-
TestEndAttempt.styles = i`
|
|
1637
|
-
:host {
|
|
1638
|
-
${btn};
|
|
1639
|
-
}
|
|
1640
|
-
:host([disabled]) {
|
|
1641
|
-
${dis};
|
|
1642
|
-
}
|
|
1643
|
-
`;
|
|
1644
|
-
TestEndAttempt = __decorateClass([
|
|
1645
|
-
t("test-end-attempt")
|
|
1646
|
-
], TestEndAttempt);
|
|
1647
|
-
|
|
1648
|
-
// ../qti-test/src/components/test-show-correct-response/test-show-correct-response.ts
|
|
1649
|
-
var _previousActiveItem, _TestShowCorrectResponse_instances, toggleState_fn, getDisplayedText_fn;
|
|
1650
|
-
var TestShowCorrectResponse = class extends i2 {
|
|
1651
|
-
constructor() {
|
|
1652
|
-
super(...arguments);
|
|
1653
|
-
__privateAdd(this, _TestShowCorrectResponse_instances);
|
|
1654
|
-
this.shown = false;
|
|
1655
|
-
this.disabled = false;
|
|
1656
|
-
this.showCorrectText = "Show correct response";
|
|
1657
|
-
this.hideCorrectText = "Hide correct response";
|
|
1658
|
-
this.noCorrectResponseText = "No correct response specified";
|
|
1659
|
-
__privateAdd(this, _previousActiveItem);
|
|
1660
|
-
}
|
|
1661
|
-
// Store previous active item reference
|
|
1662
|
-
willUpdate(_changedProperties) {
|
|
1663
|
-
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
1664
|
-
if (__privateGet(this, _previousActiveItem) !== activeItem) {
|
|
1665
|
-
this.shown = false;
|
|
1666
|
-
__privateSet(this, _previousActiveItem, activeItem);
|
|
1667
|
-
}
|
|
1668
|
-
if (activeItem) {
|
|
1669
|
-
const containsCorrectResponse = !!activeItem?.variables?.some((v2) => v2["correctResponse"]);
|
|
1670
|
-
const containsMapping = !!activeItem?.variables?.some((v2) => {
|
|
1671
|
-
return v2["mapping"]?.mapEntries?.length > 0 || v2["areaMapping"]?.areaMapEntries?.length > 0;
|
|
1672
|
-
});
|
|
1673
|
-
this.disabled = !containsCorrectResponse && !containsMapping;
|
|
1674
|
-
} else {
|
|
1675
|
-
this.disabled = true;
|
|
1676
|
-
}
|
|
1677
|
-
}
|
|
1678
|
-
render() {
|
|
1679
|
-
return T` <div @click="${__privateMethod(this, _TestShowCorrectResponse_instances, toggleState_fn)}">${__privateMethod(this, _TestShowCorrectResponse_instances, getDisplayedText_fn).call(this)}</div> `;
|
|
1680
|
-
}
|
|
1681
|
-
};
|
|
1682
|
-
_previousActiveItem = new WeakMap();
|
|
1683
|
-
_TestShowCorrectResponse_instances = new WeakSet();
|
|
1684
|
-
toggleState_fn = function() {
|
|
1685
|
-
if (this.disabled) return;
|
|
1686
|
-
this.shown = !this.shown;
|
|
1687
|
-
this.dispatchEvent(
|
|
1688
|
-
new CustomEvent("test-show-correct-response", {
|
|
1689
|
-
detail: this.shown,
|
|
1690
|
-
bubbles: true
|
|
1691
|
-
})
|
|
1692
|
-
);
|
|
1693
|
-
};
|
|
1694
|
-
getDisplayedText_fn = function() {
|
|
1695
|
-
return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;
|
|
1696
|
-
};
|
|
1697
|
-
TestShowCorrectResponse.styles = i`
|
|
1698
|
-
:host {
|
|
1699
|
-
${btn};
|
|
1700
|
-
}
|
|
1701
|
-
:host([disabled]) {
|
|
1702
|
-
${dis};
|
|
1703
|
-
}
|
|
1704
|
-
`;
|
|
1705
|
-
__decorateClass([
|
|
1706
|
-
c({ context: computedContext, subscribe: true })
|
|
1707
|
-
], TestShowCorrectResponse.prototype, "computedContext", 2);
|
|
1708
|
-
__decorateClass([
|
|
1709
|
-
n({ type: Boolean, reflect: true })
|
|
1710
|
-
], TestShowCorrectResponse.prototype, "shown", 2);
|
|
1711
|
-
__decorateClass([
|
|
1712
|
-
n({ type: Boolean, reflect: true })
|
|
1713
|
-
], TestShowCorrectResponse.prototype, "disabled", 2);
|
|
1714
|
-
__decorateClass([
|
|
1715
|
-
n({ type: String })
|
|
1716
|
-
], TestShowCorrectResponse.prototype, "showCorrectText", 2);
|
|
1717
|
-
__decorateClass([
|
|
1718
|
-
n({ type: String })
|
|
1719
|
-
], TestShowCorrectResponse.prototype, "hideCorrectText", 2);
|
|
1720
|
-
__decorateClass([
|
|
1721
|
-
n({ type: String })
|
|
1722
|
-
], TestShowCorrectResponse.prototype, "noCorrectResponseText", 2);
|
|
1723
|
-
TestShowCorrectResponse = __decorateClass([
|
|
1724
|
-
t("test-show-correct-response")
|
|
1725
|
-
], TestShowCorrectResponse);
|
|
1726
|
-
|
|
1727
|
-
// ../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/node/lit-html.js
|
|
1728
|
-
var t2 = globalThis;
|
|
1729
|
-
var i3 = t2.trustedTypes;
|
|
1730
|
-
var s = i3 ? i3.createPolicy("lit-html", { createHTML: (t3) => t3 }) : void 0;
|
|
1731
|
-
var e2 = "$lit$";
|
|
1732
|
-
var h = `lit$${Math.random().toFixed(9).slice(2)}$`;
|
|
1733
|
-
var o = "?" + h;
|
|
1734
|
-
var n2 = `<${o}>`;
|
|
1735
|
-
var r2 = void 0 === t2.document ? { createTreeWalker: () => ({}) } : document;
|
|
1736
|
-
var l = () => r2.createComment("");
|
|
1737
|
-
var c2 = (t3) => null === t3 || "object" != typeof t3 && "function" != typeof t3;
|
|
1738
|
-
var a = Array.isArray;
|
|
1739
|
-
var u = (t3) => a(t3) || "function" == typeof t3?.[Symbol.iterator];
|
|
1740
|
-
var d = "[ \n\f\r]";
|
|
1741
|
-
var f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
|
|
1742
|
-
var v = /-->/g;
|
|
1743
|
-
var _ = />/g;
|
|
1744
|
-
var m2 = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
|
|
1745
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g");
|
|
1746
|
-
var p = /'/g;
|
|
1747
|
-
var g = /"/g;
|
|
1748
|
-
var $ = /^(?:script|style|textarea|title)$/i;
|
|
1749
|
-
var y = (t3) => (i5, ...s2) => ({ _$litType$: t3, strings: i5, values: s2 });
|
|
1750
|
-
var x = y(1);
|
|
1751
|
-
var T2 = y(2);
|
|
1752
|
-
var b = y(3);
|
|
1753
|
-
var w = /* @__PURE__ */ Symbol.for("lit-noChange");
|
|
1754
|
-
var E = /* @__PURE__ */ Symbol.for("lit-nothing");
|
|
1755
|
-
var A2 = /* @__PURE__ */ new WeakMap();
|
|
1756
|
-
var C = r2.createTreeWalker(r2, 129);
|
|
1757
|
-
function P(t3, i5) {
|
|
1758
|
-
if (!a(t3) || !t3.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
1759
|
-
return void 0 !== s ? s.createHTML(i5) : i5;
|
|
1760
|
-
}
|
|
1761
|
-
var V = (t3, i5) => {
|
|
1762
|
-
const s2 = t3.length - 1, o2 = [];
|
|
1763
|
-
let r4, l2 = 2 === i5 ? "<svg>" : 3 === i5 ? "<math>" : "", c3 = f;
|
|
1764
|
-
for (let i6 = 0; i6 < s2; i6++) {
|
|
1765
|
-
const s3 = t3[i6];
|
|
1766
|
-
let a2, u2, d2 = -1, y2 = 0;
|
|
1767
|
-
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);
|
|
1768
|
-
const x2 = c3 === m2 && t3[i6 + 1].startsWith("/>") ? " " : "";
|
|
1769
|
-
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);
|
|
1770
|
-
}
|
|
1771
|
-
return [P(t3, l2 + (t3[s2] || "<?>") + (2 === i5 ? "</svg>" : 3 === i5 ? "</math>" : "")), o2];
|
|
1772
|
-
};
|
|
1773
|
-
var N = class _N {
|
|
1774
|
-
constructor({ strings: t3, _$litType$: s2 }, n3) {
|
|
1775
|
-
let r4;
|
|
1776
|
-
this.parts = [];
|
|
1777
|
-
let c3 = 0, a2 = 0;
|
|
1778
|
-
const u2 = t3.length - 1, d2 = this.parts, [f2, v2] = V(t3, s2);
|
|
1779
|
-
if (this.el = _N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
|
|
1780
|
-
const t4 = this.el.content.firstChild;
|
|
1781
|
-
t4.replaceWith(...t4.childNodes);
|
|
1782
|
-
}
|
|
1783
|
-
for (; null !== (r4 = C.nextNode()) && d2.length < u2; ) {
|
|
1784
|
-
if (1 === r4.nodeType) {
|
|
1785
|
-
if (r4.hasAttributes()) for (const t4 of r4.getAttributeNames()) if (t4.endsWith(e2)) {
|
|
1786
|
-
const i5 = v2[a2++], s3 = r4.getAttribute(t4).split(h), e3 = /([.?@])?(.*)/.exec(i5);
|
|
1787
|
-
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);
|
|
1788
|
-
} else t4.startsWith(h) && (d2.push({ type: 6, index: c3 }), r4.removeAttribute(t4));
|
|
1789
|
-
if ($.test(r4.tagName)) {
|
|
1790
|
-
const t4 = r4.textContent.split(h), s3 = t4.length - 1;
|
|
1791
|
-
if (s3 > 0) {
|
|
1792
|
-
r4.textContent = i3 ? i3.emptyScript : "";
|
|
1793
|
-
for (let i5 = 0; i5 < s3; i5++) r4.append(t4[i5], l()), C.nextNode(), d2.push({ type: 2, index: ++c3 });
|
|
1794
|
-
r4.append(t4[s3], l());
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
} else if (8 === r4.nodeType) if (r4.data === o) d2.push({ type: 2, index: c3 });
|
|
1798
|
-
else {
|
|
1799
|
-
let t4 = -1;
|
|
1800
|
-
for (; -1 !== (t4 = r4.data.indexOf(h, t4 + 1)); ) d2.push({ type: 7, index: c3 }), t4 += h.length - 1;
|
|
1801
|
-
}
|
|
1802
|
-
c3++;
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
static createElement(t3, i5) {
|
|
1806
|
-
const s2 = r2.createElement("template");
|
|
1807
|
-
return s2.innerHTML = t3, s2;
|
|
1808
|
-
}
|
|
1809
|
-
};
|
|
1810
|
-
function S(t3, i5, s2 = t3, e3) {
|
|
1811
|
-
if (i5 === w) return i5;
|
|
1812
|
-
let h2 = void 0 !== e3 ? s2._$Co?.[e3] : s2._$Cl;
|
|
1813
|
-
const o2 = c2(i5) ? void 0 : i5._$litDirective$;
|
|
1814
|
-
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;
|
|
1815
|
-
}
|
|
1816
|
-
var M = class {
|
|
1817
|
-
constructor(t3, i5) {
|
|
1818
|
-
this._$AV = [], this._$AN = void 0, this._$AD = t3, this._$AM = i5;
|
|
1819
|
-
}
|
|
1820
|
-
get parentNode() {
|
|
1821
|
-
return this._$AM.parentNode;
|
|
1822
|
-
}
|
|
1823
|
-
get _$AU() {
|
|
1824
|
-
return this._$AM._$AU;
|
|
1825
|
-
}
|
|
1826
|
-
u(t3) {
|
|
1827
|
-
const { el: { content: i5 }, parts: s2 } = this._$AD, e3 = (t3?.creationScope ?? r2).importNode(i5, true);
|
|
1828
|
-
C.currentNode = e3;
|
|
1829
|
-
let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
|
|
1830
|
-
for (; void 0 !== l2; ) {
|
|
1831
|
-
if (o2 === l2.index) {
|
|
1832
|
-
let i6;
|
|
1833
|
-
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];
|
|
1834
|
-
}
|
|
1835
|
-
o2 !== l2?.index && (h2 = C.nextNode(), o2++);
|
|
1836
|
-
}
|
|
1837
|
-
return C.currentNode = r2, e3;
|
|
1838
|
-
}
|
|
1839
|
-
p(t3) {
|
|
1840
|
-
let i5 = 0;
|
|
1841
|
-
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++;
|
|
1842
|
-
}
|
|
1843
|
-
};
|
|
1844
|
-
var k = class _k {
|
|
1845
|
-
get _$AU() {
|
|
1846
|
-
return this._$AM?._$AU ?? this._$Cv;
|
|
1847
|
-
}
|
|
1848
|
-
constructor(t3, i5, s2, e3) {
|
|
1849
|
-
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;
|
|
1850
|
-
}
|
|
1851
|
-
get parentNode() {
|
|
1852
|
-
let t3 = this._$AA.parentNode;
|
|
1853
|
-
const i5 = this._$AM;
|
|
1854
|
-
return void 0 !== i5 && 11 === t3?.nodeType && (t3 = i5.parentNode), t3;
|
|
1855
|
-
}
|
|
1856
|
-
get startNode() {
|
|
1857
|
-
return this._$AA;
|
|
1858
|
-
}
|
|
1859
|
-
get endNode() {
|
|
1860
|
-
return this._$AB;
|
|
1861
|
-
}
|
|
1862
|
-
_$AI(t3, i5 = this) {
|
|
1863
|
-
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);
|
|
1864
|
-
}
|
|
1865
|
-
O(t3) {
|
|
1866
|
-
return this._$AA.parentNode.insertBefore(t3, this._$AB);
|
|
1867
|
-
}
|
|
1868
|
-
T(t3) {
|
|
1869
|
-
this._$AH !== t3 && (this._$AR(), this._$AH = this.O(t3));
|
|
1870
|
-
}
|
|
1871
|
-
_(t3) {
|
|
1872
|
-
this._$AH !== E && c2(this._$AH) ? this._$AA.nextSibling.data = t3 : this.T(r2.createTextNode(t3)), this._$AH = t3;
|
|
1883
|
+
})
|
|
1884
|
+
};
|
|
1885
|
+
})
|
|
1886
|
+
};
|
|
1887
|
+
})
|
|
1888
|
+
};
|
|
1889
|
+
this.dispatchEvent(new CustomEvent("qti-computed-context-updated", {
|
|
1890
|
+
detail: this.computedContext,
|
|
1891
|
+
bubbles: true
|
|
1892
|
+
}));
|
|
1873
1893
|
}
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1894
|
+
};
|
|
1895
|
+
__decorate11([
|
|
1896
|
+
n2({ type: String })
|
|
1897
|
+
], TestNavigation.prototype, "identifier", void 0);
|
|
1898
|
+
__decorate11([
|
|
1899
|
+
r()
|
|
1900
|
+
], TestNavigation.prototype, "initContext", void 0);
|
|
1901
|
+
__decorate11([
|
|
1902
|
+
r(),
|
|
1903
|
+
e({ context: qtiContext })
|
|
1904
|
+
], TestNavigation.prototype, "qtiContext", void 0);
|
|
1905
|
+
__decorate11([
|
|
1906
|
+
r(),
|
|
1907
|
+
c({ context: configContext, subscribe: true })
|
|
1908
|
+
], TestNavigation.prototype, "configContext", void 0);
|
|
1909
|
+
__decorate11([
|
|
1910
|
+
r(),
|
|
1911
|
+
c({ context: testContext, subscribe: true })
|
|
1912
|
+
], TestNavigation.prototype, "_testContext", void 0);
|
|
1913
|
+
__decorate11([
|
|
1914
|
+
r(),
|
|
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;
|
|
1931
|
+
};
|
|
1932
|
+
var TestNext = class extends i2 {
|
|
1933
|
+
_handleTestElementChange(_oldValue, newValue) {
|
|
1934
|
+
if (newValue) {
|
|
1935
|
+
this._internalDisabled = false;
|
|
1880
1936
|
}
|
|
1881
1937
|
}
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
k(t3) {
|
|
1887
|
-
a(this._$AH) || (this._$AH = [], this._$AR());
|
|
1888
|
-
const i5 = this._$AH;
|
|
1889
|
-
let s2, e3 = 0;
|
|
1890
|
-
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++;
|
|
1891
|
-
e3 < i5.length && (this._$AR(s2 && s2._$AB.nextSibling, e3), i5.length = e3);
|
|
1892
|
-
}
|
|
1893
|
-
_$AR(t3 = this._$AA.nextSibling, i5) {
|
|
1894
|
-
for (this._$AP?.(false, true, i5); t3 !== this._$AB; ) {
|
|
1895
|
-
const i6 = t3.nextSibling;
|
|
1896
|
-
t3.remove(), t3 = i6;
|
|
1938
|
+
static {
|
|
1939
|
+
this.styles = i`
|
|
1940
|
+
:host {
|
|
1941
|
+
${btn};
|
|
1897
1942
|
}
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
void 0 === this._$AM && (this._$Cv = t3, this._$AP?.(t3));
|
|
1901
|
-
}
|
|
1902
|
-
};
|
|
1903
|
-
var R = class {
|
|
1904
|
-
get tagName() {
|
|
1905
|
-
return this.element.tagName;
|
|
1906
|
-
}
|
|
1907
|
-
get _$AU() {
|
|
1908
|
-
return this._$AM._$AU;
|
|
1909
|
-
}
|
|
1910
|
-
constructor(t3, i5, s2, e3, h2) {
|
|
1911
|
-
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;
|
|
1912
|
-
}
|
|
1913
|
-
_$AI(t3, i5 = this, s2, e3) {
|
|
1914
|
-
const h2 = this.strings;
|
|
1915
|
-
let o2 = false;
|
|
1916
|
-
if (void 0 === h2) t3 = S(this, t3, i5, 0), o2 = !c2(t3) || t3 !== this._$AH && t3 !== w, o2 && (this._$AH = t3);
|
|
1917
|
-
else {
|
|
1918
|
-
const e4 = t3;
|
|
1919
|
-
let n3, r4;
|
|
1920
|
-
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};
|
|
1921
1945
|
}
|
|
1922
|
-
|
|
1923
|
-
}
|
|
1924
|
-
j(t3) {
|
|
1925
|
-
t3 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t3 ?? "");
|
|
1926
|
-
}
|
|
1927
|
-
};
|
|
1928
|
-
var H = class extends R {
|
|
1929
|
-
constructor() {
|
|
1930
|
-
super(...arguments), this.type = 3;
|
|
1931
|
-
}
|
|
1932
|
-
j(t3) {
|
|
1933
|
-
this.element[this.name] = t3 === E ? void 0 : t3;
|
|
1946
|
+
`;
|
|
1934
1947
|
}
|
|
1935
|
-
|
|
1936
|
-
var I = class extends R {
|
|
1948
|
+
#internals;
|
|
1937
1949
|
constructor() {
|
|
1938
|
-
super(
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
this.
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
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
|
+
});
|
|
1947
1960
|
}
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
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();
|
|
1952
1964
|
}
|
|
1953
|
-
|
|
1954
|
-
|
|
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();
|
|
1955
1974
|
}
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
constructor(t3, i5, s2) {
|
|
1959
|
-
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;
|
|
1960
1977
|
}
|
|
1961
|
-
|
|
1962
|
-
|
|
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
|
+
}));
|
|
1963
1987
|
}
|
|
1964
|
-
|
|
1965
|
-
|
|
1988
|
+
render() {
|
|
1989
|
+
return T`<slot></slot>`;
|
|
1966
1990
|
}
|
|
1967
1991
|
};
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
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);
|
|
1971
2001
|
|
|
1972
2002
|
// ../../node_modules/.pnpm/@heximal+expressions@0.1.5/node_modules/@heximal/expressions/lib/constants.js
|
|
1973
2003
|
var KEYWORDS = ["this"];
|
|
@@ -2133,11 +2163,11 @@ var Tokenizer = class {
|
|
|
2133
2163
|
}
|
|
2134
2164
|
}
|
|
2135
2165
|
#getValue(lookahead = 0) {
|
|
2136
|
-
const
|
|
2166
|
+
const v = this.#input.substring(this.#tokenStart, this.#index + lookahead);
|
|
2137
2167
|
if (lookahead === 0) {
|
|
2138
2168
|
this.#clearValue();
|
|
2139
2169
|
}
|
|
2140
|
-
return
|
|
2170
|
+
return v;
|
|
2141
2171
|
}
|
|
2142
2172
|
#clearValue() {
|
|
2143
2173
|
this.#tokenStart = this.#index;
|
|
@@ -2156,9 +2186,9 @@ var Tokenizer = class {
|
|
|
2156
2186
|
}
|
|
2157
2187
|
this.#advance();
|
|
2158
2188
|
}
|
|
2159
|
-
const
|
|
2189
|
+
const t = token(Kind.STRING, escapeString(this.#getValue()));
|
|
2160
2190
|
this.#advance();
|
|
2161
|
-
return
|
|
2191
|
+
return t;
|
|
2162
2192
|
}
|
|
2163
2193
|
#tokenizeIdentOrKeyword() {
|
|
2164
2194
|
do {
|
|
@@ -2218,9 +2248,9 @@ var Tokenizer = class {
|
|
|
2218
2248
|
}
|
|
2219
2249
|
#tokenizeGrouper() {
|
|
2220
2250
|
const value = String.fromCharCode(this.#next);
|
|
2221
|
-
const
|
|
2251
|
+
const t = token(Kind.GROUPER, value, PRECEDENCE[value]);
|
|
2222
2252
|
this.#advance(true);
|
|
2223
|
-
return
|
|
2253
|
+
return t;
|
|
2224
2254
|
}
|
|
2225
2255
|
};
|
|
2226
2256
|
|
|
@@ -2244,10 +2274,10 @@ var Parser = class {
|
|
|
2244
2274
|
if (!this._matches(kind, value)) {
|
|
2245
2275
|
throw new Error(`Expected kind ${kind} (${value}), was ${this.#token?.kind} (${this.#token?.value})`);
|
|
2246
2276
|
}
|
|
2247
|
-
const
|
|
2248
|
-
this.#token =
|
|
2249
|
-
this.#kind =
|
|
2250
|
-
this.#value =
|
|
2277
|
+
const t = this.#tokenizer.nextToken();
|
|
2278
|
+
this.#token = t;
|
|
2279
|
+
this.#kind = t?.kind;
|
|
2280
|
+
this.#value = t?.value;
|
|
2251
2281
|
}
|
|
2252
2282
|
_matches(kind, value) {
|
|
2253
2283
|
return !(kind && this.#kind !== kind || value && this.#value !== value);
|
|
@@ -2453,7 +2483,7 @@ var Parser = class {
|
|
|
2453
2483
|
if (this._matches(Kind.ARROW)) {
|
|
2454
2484
|
this.#advance();
|
|
2455
2485
|
const body = this.#parseExpression();
|
|
2456
|
-
const params = expressions?.map((
|
|
2486
|
+
const params = expressions?.map((e2) => e2.value) ?? [];
|
|
2457
2487
|
return this.#ast.arrowFunction(params, body);
|
|
2458
2488
|
} else {
|
|
2459
2489
|
return this.#ast.paren(expressions[0]);
|
|
@@ -2479,29 +2509,29 @@ var Parser = class {
|
|
|
2479
2509
|
// ../../node_modules/.pnpm/@heximal+expressions@0.1.5/node_modules/@heximal/expressions/lib/eval.js
|
|
2480
2510
|
var { hasOwn, fromEntries } = Object;
|
|
2481
2511
|
var _BINARY_OPERATORS = {
|
|
2482
|
-
"+": (
|
|
2483
|
-
"-": (
|
|
2484
|
-
"*": (
|
|
2485
|
-
"/": (
|
|
2486
|
-
"%": (
|
|
2487
|
-
"==": (
|
|
2488
|
-
"!=": (
|
|
2489
|
-
"===": (
|
|
2490
|
-
"!==": (
|
|
2491
|
-
">": (
|
|
2492
|
-
">=": (
|
|
2493
|
-
"<": (
|
|
2494
|
-
"<=": (
|
|
2495
|
-
"||": (
|
|
2496
|
-
"&&": (
|
|
2497
|
-
"??": (
|
|
2498
|
-
"|": (
|
|
2499
|
-
"|>": (
|
|
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)
|
|
2500
2530
|
};
|
|
2501
2531
|
var _UNARY_OPERATORS = {
|
|
2502
|
-
"+": (
|
|
2503
|
-
"-": (
|
|
2504
|
-
"!": (
|
|
2532
|
+
"+": (a) => a,
|
|
2533
|
+
"-": (a) => -a,
|
|
2534
|
+
"!": (a) => !a
|
|
2505
2535
|
};
|
|
2506
2536
|
var EvalAstFactory = class {
|
|
2507
2537
|
empty() {
|
|
@@ -2516,10 +2546,10 @@ var EvalAstFactory = class {
|
|
|
2516
2546
|
};
|
|
2517
2547
|
}
|
|
2518
2548
|
// TODO(justinfagnani): just use a JS literal?
|
|
2519
|
-
literal(
|
|
2549
|
+
literal(v) {
|
|
2520
2550
|
return {
|
|
2521
2551
|
type: "Literal",
|
|
2522
|
-
value:
|
|
2552
|
+
value: v,
|
|
2523
2553
|
evaluate(_scope) {
|
|
2524
2554
|
return this.value;
|
|
2525
2555
|
},
|
|
@@ -2528,10 +2558,10 @@ var EvalAstFactory = class {
|
|
|
2528
2558
|
}
|
|
2529
2559
|
};
|
|
2530
2560
|
}
|
|
2531
|
-
id(
|
|
2561
|
+
id(v) {
|
|
2532
2562
|
return {
|
|
2533
2563
|
type: "ID",
|
|
2534
|
-
value:
|
|
2564
|
+
value: v,
|
|
2535
2565
|
evaluate(scope) {
|
|
2536
2566
|
if (this.value === "this")
|
|
2537
2567
|
return scope;
|
|
@@ -2544,26 +2574,26 @@ var EvalAstFactory = class {
|
|
|
2544
2574
|
};
|
|
2545
2575
|
}
|
|
2546
2576
|
unary(op, expr) {
|
|
2547
|
-
const
|
|
2577
|
+
const f = _UNARY_OPERATORS[op];
|
|
2548
2578
|
return {
|
|
2549
2579
|
type: "Unary",
|
|
2550
2580
|
operator: op,
|
|
2551
2581
|
child: expr,
|
|
2552
2582
|
evaluate(scope) {
|
|
2553
|
-
return
|
|
2583
|
+
return f(this.child.evaluate(scope));
|
|
2554
2584
|
},
|
|
2555
2585
|
getIds(idents) {
|
|
2556
2586
|
return this.child.getIds(idents);
|
|
2557
2587
|
}
|
|
2558
2588
|
};
|
|
2559
2589
|
}
|
|
2560
|
-
binary(
|
|
2561
|
-
const
|
|
2590
|
+
binary(l, op, r3) {
|
|
2591
|
+
const f = _BINARY_OPERATORS[op];
|
|
2562
2592
|
return {
|
|
2563
2593
|
type: "Binary",
|
|
2564
2594
|
operator: op,
|
|
2565
|
-
left:
|
|
2566
|
-
right:
|
|
2595
|
+
left: l,
|
|
2596
|
+
right: r3,
|
|
2567
2597
|
evaluate(scope) {
|
|
2568
2598
|
if (this.operator === "=") {
|
|
2569
2599
|
if (this.left.type !== "ID" && this.left.type !== "Getter" && this.left.type !== "Index") {
|
|
@@ -2584,7 +2614,7 @@ var EvalAstFactory = class {
|
|
|
2584
2614
|
}
|
|
2585
2615
|
return receiver === void 0 ? void 0 : receiver[property] = value;
|
|
2586
2616
|
}
|
|
2587
|
-
return
|
|
2617
|
+
return f(this.left.evaluate(scope), this.right.evaluate(scope));
|
|
2588
2618
|
},
|
|
2589
2619
|
getIds(idents) {
|
|
2590
2620
|
this.left.getIds(idents);
|
|
@@ -2593,10 +2623,10 @@ var EvalAstFactory = class {
|
|
|
2593
2623
|
}
|
|
2594
2624
|
};
|
|
2595
2625
|
}
|
|
2596
|
-
getter(
|
|
2626
|
+
getter(g, n3) {
|
|
2597
2627
|
return {
|
|
2598
2628
|
type: "Getter",
|
|
2599
|
-
receiver:
|
|
2629
|
+
receiver: g,
|
|
2600
2630
|
name: n3,
|
|
2601
2631
|
evaluate(scope) {
|
|
2602
2632
|
return this.receiver.evaluate(scope)?.[this.name];
|
|
@@ -2619,26 +2649,26 @@ var EvalAstFactory = class {
|
|
|
2619
2649
|
evaluate(scope) {
|
|
2620
2650
|
const receiver2 = this.receiver.evaluate(scope);
|
|
2621
2651
|
const _this = this.method ? receiver2 : scope?.["this"] ?? scope;
|
|
2622
|
-
const
|
|
2652
|
+
const f = this.method ? receiver2?.[method] : receiver2;
|
|
2623
2653
|
const args2 = this.arguments ?? [];
|
|
2624
|
-
const argValues = args2.map((
|
|
2625
|
-
return
|
|
2654
|
+
const argValues = args2.map((a) => a?.evaluate(scope));
|
|
2655
|
+
return f?.apply?.(_this, argValues);
|
|
2626
2656
|
},
|
|
2627
2657
|
getIds(idents) {
|
|
2628
2658
|
this.receiver.getIds(idents);
|
|
2629
|
-
this.arguments?.forEach((
|
|
2659
|
+
this.arguments?.forEach((a) => a?.getIds(idents));
|
|
2630
2660
|
return idents;
|
|
2631
2661
|
}
|
|
2632
2662
|
};
|
|
2633
2663
|
}
|
|
2634
|
-
paren(
|
|
2635
|
-
return
|
|
2664
|
+
paren(e2) {
|
|
2665
|
+
return e2;
|
|
2636
2666
|
}
|
|
2637
|
-
index(
|
|
2667
|
+
index(e2, a) {
|
|
2638
2668
|
return {
|
|
2639
2669
|
type: "Index",
|
|
2640
|
-
receiver:
|
|
2641
|
-
argument:
|
|
2670
|
+
receiver: e2,
|
|
2671
|
+
argument: a,
|
|
2642
2672
|
evaluate(scope) {
|
|
2643
2673
|
return this.receiver.evaluate(scope)?.[this.argument.evaluate(scope)];
|
|
2644
2674
|
},
|
|
@@ -2648,15 +2678,15 @@ var EvalAstFactory = class {
|
|
|
2648
2678
|
}
|
|
2649
2679
|
};
|
|
2650
2680
|
}
|
|
2651
|
-
ternary(
|
|
2681
|
+
ternary(c2, t, f) {
|
|
2652
2682
|
return {
|
|
2653
2683
|
type: "Ternary",
|
|
2654
|
-
condition:
|
|
2655
|
-
trueExpr:
|
|
2656
|
-
falseExpr:
|
|
2684
|
+
condition: c2,
|
|
2685
|
+
trueExpr: t,
|
|
2686
|
+
falseExpr: f,
|
|
2657
2687
|
evaluate(scope) {
|
|
2658
|
-
const
|
|
2659
|
-
if (
|
|
2688
|
+
const c3 = this.condition.evaluate(scope);
|
|
2689
|
+
if (c3) {
|
|
2660
2690
|
return this.trueExpr.evaluate(scope);
|
|
2661
2691
|
} else {
|
|
2662
2692
|
return this.falseExpr.evaluate(scope);
|
|
@@ -2700,15 +2730,15 @@ var EvalAstFactory = class {
|
|
|
2700
2730
|
};
|
|
2701
2731
|
}
|
|
2702
2732
|
// TODO(justinfagnani): if the list is deeply literal
|
|
2703
|
-
list(
|
|
2733
|
+
list(l) {
|
|
2704
2734
|
return {
|
|
2705
2735
|
type: "List",
|
|
2706
|
-
items:
|
|
2736
|
+
items: l,
|
|
2707
2737
|
evaluate(scope) {
|
|
2708
|
-
return this.items?.map((
|
|
2738
|
+
return this.items?.map((a) => a?.evaluate(scope));
|
|
2709
2739
|
},
|
|
2710
2740
|
getIds(idents) {
|
|
2711
|
-
this.items?.forEach((
|
|
2741
|
+
this.items?.forEach((i4) => i4?.getIds(idents));
|
|
2712
2742
|
return idents;
|
|
2713
2743
|
}
|
|
2714
2744
|
};
|
|
@@ -2722,7 +2752,7 @@ var EvalAstFactory = class {
|
|
|
2722
2752
|
const params2 = this.params;
|
|
2723
2753
|
const body2 = this.body;
|
|
2724
2754
|
return function(...args) {
|
|
2725
|
-
const paramsObj = fromEntries(params2.map((
|
|
2755
|
+
const paramsObj = fromEntries(params2.map((p, i4) => [p, args[i4]]));
|
|
2726
2756
|
const newScope = new Proxy(scope ?? {}, {
|
|
2727
2757
|
set(target, prop, value) {
|
|
2728
2758
|
if (hasOwn(paramsObj, prop)) {
|
|
@@ -2747,41 +2777,41 @@ var EvalAstFactory = class {
|
|
|
2747
2777
|
}
|
|
2748
2778
|
};
|
|
2749
2779
|
|
|
2750
|
-
// ../../node_modules/.pnpm/lit-html@3.3.
|
|
2751
|
-
var
|
|
2752
|
-
var
|
|
2753
|
-
_$AS(
|
|
2754
|
-
return
|
|
2755
|
-
}
|
|
2756
|
-
}, patchDirectiveResolve: (
|
|
2757
|
-
if (
|
|
2758
|
-
|
|
2759
|
-
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);
|
|
2760
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");
|
|
2761
2791
|
}
|
|
2762
|
-
}, setDirectiveClass(
|
|
2763
|
-
|
|
2764
|
-
}, getAttributePartCommittedValue: (
|
|
2765
|
-
let
|
|
2766
|
-
return
|
|
2767
|
-
}, 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 };
|
|
2768
2798
|
|
|
2769
2799
|
// ../../node_modules/.pnpm/@heximal+templates@0.1.5/node_modules/@heximal/templates/index.js
|
|
2770
|
-
var { AttributePart, PropertyPart, BooleanAttributePart, EventPart } =
|
|
2800
|
+
var { AttributePart, PropertyPart, BooleanAttributePart, EventPart } = i3;
|
|
2771
2801
|
var astFactory = new EvalAstFactory();
|
|
2772
2802
|
var expressionCache = /* @__PURE__ */ new Map();
|
|
2773
|
-
var toCamelCase = (
|
|
2774
|
-
var getSingleValue = (
|
|
2775
|
-
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);
|
|
2776
2806
|
if (ast === void 0) {
|
|
2777
|
-
if (expressionCache.has(
|
|
2807
|
+
if (expressionCache.has(s)) {
|
|
2778
2808
|
return void 0;
|
|
2779
2809
|
}
|
|
2780
|
-
|
|
2781
|
-
if (
|
|
2782
|
-
const expression =
|
|
2810
|
+
s = s.trim();
|
|
2811
|
+
if (s.startsWith("{{") && s.endsWith("}}")) {
|
|
2812
|
+
const expression = s.substring(2, s.length - 2).trim();
|
|
2783
2813
|
ast = new Parser(expression, astFactory).parse();
|
|
2784
|
-
expressionCache.set(
|
|
2814
|
+
expressionCache.set(s, ast);
|
|
2785
2815
|
}
|
|
2786
2816
|
}
|
|
2787
2817
|
return ast?.evaluate(model);
|
|
@@ -2794,14 +2824,14 @@ var ifHandler = (template, model, handlers, renderers) => {
|
|
|
2794
2824
|
return void 0;
|
|
2795
2825
|
};
|
|
2796
2826
|
var bindingRegex = /(?<!\\){{(.*?)(?:(?<!\\)}})/g;
|
|
2797
|
-
var hasEscapedBindingMarkers = (
|
|
2798
|
-
var unescapeBindingMarkers = (
|
|
2827
|
+
var hasEscapedBindingMarkers = (s) => /(?:\\{{)|(?:\\}})/g.test(s);
|
|
2828
|
+
var unescapeBindingMarkers = (s) => s.replaceAll(/\\{{/g, "{{").replace(/\\}}/g, "}}");
|
|
2799
2829
|
var repeatHandler = (template, model, handlers, renderers) => {
|
|
2800
2830
|
const repeatAttribute = template.getAttribute("repeat");
|
|
2801
2831
|
if (repeatAttribute !== null) {
|
|
2802
2832
|
const items = getSingleValue(repeatAttribute, model);
|
|
2803
2833
|
if (!items[Symbol.iterator]) {
|
|
2804
|
-
return
|
|
2834
|
+
return A;
|
|
2805
2835
|
}
|
|
2806
2836
|
const litTemplate = getLitTemplate(template);
|
|
2807
2837
|
let index = -1;
|
|
@@ -3004,10 +3034,10 @@ var makeLitTemplate = (template) => {
|
|
|
3004
3034
|
}
|
|
3005
3035
|
const strings = [unescapeBindingMarkers(splitValue[0])];
|
|
3006
3036
|
const exprs = [];
|
|
3007
|
-
for (let
|
|
3008
|
-
const exprText = splitValue[
|
|
3037
|
+
for (let i4 = 1; i4 < splitValue.length; i4 += 2) {
|
|
3038
|
+
const exprText = splitValue[i4];
|
|
3009
3039
|
exprs.push(parse(exprText, astFactory));
|
|
3010
|
-
strings.push(unescapeBindingMarkers(splitValue[
|
|
3040
|
+
strings.push(unescapeBindingMarkers(splitValue[i4 + 1]));
|
|
3011
3041
|
}
|
|
3012
3042
|
litTemplate.parts.push({
|
|
3013
3043
|
type: 1,
|
|
@@ -3030,15 +3060,15 @@ var makeLitTemplate = (template) => {
|
|
|
3030
3060
|
} else if (hasEscapedBindingMarkers(text)) {
|
|
3031
3061
|
textNode.textContent = unescapeBindingMarkers(text);
|
|
3032
3062
|
}
|
|
3033
|
-
for (let
|
|
3034
|
-
const exprText = strings[
|
|
3063
|
+
for (let i4 = 1; i4 < strings.length; i4 += 2) {
|
|
3064
|
+
const exprText = strings[i4];
|
|
3035
3065
|
const expr = parse(exprText, astFactory);
|
|
3036
3066
|
litTemplate.parts.push({
|
|
3037
3067
|
type: 2,
|
|
3038
3068
|
index: ++nodeIndex,
|
|
3039
3069
|
update: (model, _handlers) => expr.evaluate(model)
|
|
3040
3070
|
});
|
|
3041
|
-
const newTextNode = new Text(strings[
|
|
3071
|
+
const newTextNode = new Text(strings[i4 + 1].replace("\\{{", "{{"));
|
|
3042
3072
|
textNode.parentNode.insertBefore(newTextNode, textNode.nextSibling);
|
|
3043
3073
|
textNode.parentNode.insertBefore(document.createComment(""), textNode.nextSibling);
|
|
3044
3074
|
textNode = newTextNode;
|
|
@@ -3046,260 +3076,368 @@ var makeLitTemplate = (template) => {
|
|
|
3046
3076
|
}
|
|
3047
3077
|
}
|
|
3048
3078
|
}
|
|
3049
|
-
for (const
|
|
3050
|
-
|
|
3079
|
+
for (const e2 of elementsToRemove) {
|
|
3080
|
+
e2.remove();
|
|
3051
3081
|
}
|
|
3052
3082
|
return litTemplate;
|
|
3053
3083
|
};
|
|
3054
3084
|
|
|
3055
|
-
// ../qti-test/
|
|
3056
|
-
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
|
+
};
|
|
3057
3092
|
var TestPagingButtonsStamp = class extends i2 {
|
|
3058
|
-
|
|
3059
|
-
super();
|
|
3060
|
-
__privateAdd(this, _internals2);
|
|
3061
|
-
__privateSet(this, _internals2, this.attachInternals());
|
|
3062
|
-
__privateGet(this, _internals2).ariaLabel = "pagination";
|
|
3063
|
-
}
|
|
3093
|
+
#internals;
|
|
3064
3094
|
createRenderRoot() {
|
|
3065
3095
|
return this;
|
|
3066
3096
|
}
|
|
3097
|
+
constructor() {
|
|
3098
|
+
super();
|
|
3099
|
+
this.#internals = this.attachInternals();
|
|
3100
|
+
this.#internals.ariaLabel = "pagination";
|
|
3101
|
+
}
|
|
3067
3102
|
connectedCallback() {
|
|
3068
3103
|
super.connectedCallback();
|
|
3069
3104
|
const templateElement = this.querySelector("template");
|
|
3070
3105
|
this.myTemplate = prepareTemplate(templateElement);
|
|
3071
3106
|
}
|
|
3072
3107
|
render() {
|
|
3073
|
-
if (!this.computedContext)
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
);
|
|
3108
|
+
if (!this.computedContext)
|
|
3109
|
+
return T``;
|
|
3110
|
+
const items = this.computedContext.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items));
|
|
3077
3111
|
return T` ${items.map((item) => this.myTemplate({ item, view: this.computedContext.view }))} `;
|
|
3078
3112
|
}
|
|
3079
3113
|
};
|
|
3080
|
-
|
|
3081
|
-
__decorateClass([
|
|
3114
|
+
__decorate13([
|
|
3082
3115
|
c({ context: computedContext, subscribe: true })
|
|
3083
|
-
], TestPagingButtonsStamp.prototype, "computedContext",
|
|
3084
|
-
TestPagingButtonsStamp = __decorateClass([
|
|
3085
|
-
t("test-paging-buttons-stamp")
|
|
3086
|
-
], TestPagingButtonsStamp);
|
|
3116
|
+
], TestPagingButtonsStamp.prototype, "computedContext", void 0);
|
|
3087
3117
|
|
|
3088
|
-
// ../qti-test/
|
|
3089
|
-
var
|
|
3090
|
-
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
|
+
}
|
|
3091
3141
|
constructor() {
|
|
3092
|
-
super(
|
|
3093
|
-
|
|
3094
|
-
this.
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
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
|
+
});
|
|
3099
3149
|
}
|
|
3100
|
-
|
|
3101
|
-
if (!this.
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
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
|
|
3111
3170
|
}
|
|
3112
|
-
|
|
3113
|
-
} catch (error) {
|
|
3114
|
-
console.error("Error loading or parsing XML:", error);
|
|
3115
|
-
}
|
|
3171
|
+
}));
|
|
3116
3172
|
}
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
try {
|
|
3120
|
-
this.testDoc = qtiTransformTest().parse(this.testXML).htmlDoc();
|
|
3121
|
-
} catch (error) {
|
|
3122
|
-
console.error("Error parsing XML:", error);
|
|
3123
|
-
}
|
|
3173
|
+
render() {
|
|
3174
|
+
return T`<slot></slot>`;
|
|
3124
3175
|
}
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
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;
|
|
3131
3220
|
}
|
|
3132
|
-
|
|
3133
|
-
|
|
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;
|
|
3134
3233
|
}
|
|
3234
|
+
`;
|
|
3135
3235
|
}
|
|
3136
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
|
+
`;
|
|
3137
3272
|
return T`
|
|
3138
|
-
${
|
|
3139
|
-
<slot></slot>
|
|
3140
|
-
${m(this.testDoc, T`<span>Loading...</span>`)}
|
|
3273
|
+
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
3141
3274
|
`;
|
|
3142
3275
|
}
|
|
3143
3276
|
};
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
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;
|
|
3149
3287
|
};
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
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
|
+
}
|
|
3154
3340
|
};
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
],
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
],
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
],
|
|
3164
|
-
__decorateClass([
|
|
3165
|
-
watch("testURL", { waitUntilFirstUpdate: true })
|
|
3166
|
-
], TestContainer.prototype, "handleTestURLChange", 1);
|
|
3167
|
-
__decorateClass([
|
|
3168
|
-
watch("testXML", { waitUntilFirstUpdate: true })
|
|
3169
|
-
], TestContainer.prototype, "handleTestXMLChange", 1);
|
|
3170
|
-
TestContainer = __decorateClass([
|
|
3171
|
-
t("test-container")
|
|
3172
|
-
], 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);
|
|
3173
3350
|
|
|
3174
|
-
// ../qti-test/
|
|
3175
|
-
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
|
+
}
|
|
3176
3363
|
render() {
|
|
3177
3364
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
3178
|
-
if (!activeItem || !activeItem.variables)
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
<td>${v2.cardinality}</td>
|
|
3203
|
-
<td>${v2.baseType}</td>
|
|
3204
|
-
<td>${correctResponse || mapEntries || areaMapEntries}</td>
|
|
3205
|
-
</tr>
|
|
3206
|
-
`;
|
|
3207
|
-
})}
|
|
3208
|
-
</tbody>
|
|
3209
|
-
</table>
|
|
3210
|
-
`;
|
|
3211
|
-
return T`
|
|
3212
|
-
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
3213
|
-
`;
|
|
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>`;
|
|
3214
3389
|
}
|
|
3215
3390
|
};
|
|
3216
|
-
|
|
3217
|
-
table {
|
|
3218
|
-
width: 100%;
|
|
3219
|
-
border-collapse: collapse;
|
|
3220
|
-
margin: 20px 0;
|
|
3221
|
-
font-size: 14px;
|
|
3222
|
-
text-align: left;
|
|
3223
|
-
}
|
|
3224
|
-
th,
|
|
3225
|
-
td {
|
|
3226
|
-
border: 1px solid #ddd;
|
|
3227
|
-
padding: 8px;
|
|
3228
|
-
}
|
|
3229
|
-
th {
|
|
3230
|
-
background-color: #f4f4f4;
|
|
3231
|
-
font-weight: bold;
|
|
3232
|
-
}
|
|
3233
|
-
h3 {
|
|
3234
|
-
margin-top: 20px;
|
|
3235
|
-
font-size: 16px;
|
|
3236
|
-
}
|
|
3237
|
-
`;
|
|
3238
|
-
__decorateClass([
|
|
3391
|
+
__decorate18([
|
|
3239
3392
|
c({ context: computedContext, subscribe: true })
|
|
3240
|
-
],
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
],
|
|
3393
|
+
], TestScoringFeedback.prototype, "computedContext", void 0);
|
|
3394
|
+
__decorate18([
|
|
3395
|
+
n2({ type: String, attribute: "view" })
|
|
3396
|
+
], TestScoringFeedback.prototype, "view", void 0);
|
|
3244
3397
|
|
|
3245
|
-
// ../qti-test/
|
|
3246
|
-
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
|
+
};
|
|
3247
3405
|
var TestSectionButtonsStamp = class extends i2 {
|
|
3248
|
-
|
|
3249
|
-
super();
|
|
3250
|
-
__privateAdd(this, _internals3);
|
|
3251
|
-
__privateSet(this, _internals3, this.attachInternals());
|
|
3252
|
-
__privateGet(this, _internals3).ariaLabel = "pagination";
|
|
3253
|
-
}
|
|
3406
|
+
#internals;
|
|
3254
3407
|
createRenderRoot() {
|
|
3255
3408
|
return this;
|
|
3256
3409
|
}
|
|
3410
|
+
constructor() {
|
|
3411
|
+
super();
|
|
3412
|
+
this.#internals = this.attachInternals();
|
|
3413
|
+
this.#internals.ariaLabel = "pagination";
|
|
3414
|
+
}
|
|
3257
3415
|
connectedCallback() {
|
|
3258
3416
|
super.connectedCallback();
|
|
3259
3417
|
const templateElement = this.querySelector("template");
|
|
3260
3418
|
this.myTemplate = prepareTemplate(templateElement);
|
|
3261
3419
|
}
|
|
3262
3420
|
render() {
|
|
3263
|
-
if (!this.computedContext)
|
|
3421
|
+
if (!this.computedContext)
|
|
3422
|
+
return T``;
|
|
3264
3423
|
const sections = this.computedContext.testParts.flatMap((testPart) => testPart.sections);
|
|
3265
3424
|
return T` ${sections.map((item) => this.myTemplate({ item }))} `;
|
|
3266
3425
|
}
|
|
3267
3426
|
};
|
|
3268
|
-
|
|
3269
|
-
__decorateClass([
|
|
3427
|
+
__decorate19([
|
|
3270
3428
|
c({ context: computedContext, subscribe: true })
|
|
3271
|
-
], TestSectionButtonsStamp.prototype, "computedContext",
|
|
3272
|
-
TestSectionButtonsStamp = __decorateClass([
|
|
3273
|
-
t("test-section-buttons-stamp")
|
|
3274
|
-
], TestSectionButtonsStamp);
|
|
3429
|
+
], TestSectionButtonsStamp.prototype, "computedContext", void 0);
|
|
3275
3430
|
|
|
3276
|
-
// ../qti-test/
|
|
3277
|
-
var
|
|
3278
|
-
var
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
this.sectionId = null;
|
|
3283
|
-
this.addEventListener("click", () => __privateMethod(this, _TestSectionLink_instances, requestItem_fn).call(this, this.sectionId));
|
|
3284
|
-
}
|
|
3285
|
-
render() {
|
|
3286
|
-
return T` <slot></slot> `;
|
|
3287
|
-
}
|
|
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;
|
|
3288
3437
|
};
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
new CustomEvent("qti-request-navigation", {
|
|
3293
|
-
composed: true,
|
|
3294
|
-
bubbles: true,
|
|
3295
|
-
detail: {
|
|
3296
|
-
type: "section",
|
|
3297
|
-
id: identifier
|
|
3298
|
-
}
|
|
3299
|
-
})
|
|
3300
|
-
);
|
|
3301
|
-
};
|
|
3302
|
-
TestSectionLink.styles = i`
|
|
3438
|
+
var TestSectionLink = class extends i2 {
|
|
3439
|
+
static {
|
|
3440
|
+
this.styles = i`
|
|
3303
3441
|
:host {
|
|
3304
3442
|
${btn};
|
|
3305
3443
|
}
|
|
@@ -3307,28 +3445,37 @@ TestSectionLink.styles = i`
|
|
|
3307
3445
|
${dis};
|
|
3308
3446
|
}
|
|
3309
3447
|
`;
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
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
|
+
}
|
|
3319
3464
|
render() {
|
|
3320
|
-
return T` <
|
|
3465
|
+
return T` <slot></slot> `;
|
|
3321
3466
|
}
|
|
3322
3467
|
};
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
], TestPrintContext.prototype, "computedContext", 2);
|
|
3327
|
-
TestPrintContext = __decorateClass([
|
|
3328
|
-
t("test-print-context")
|
|
3329
|
-
], TestPrintContext);
|
|
3468
|
+
__decorate20([
|
|
3469
|
+
n2({ type: String, attribute: "section-id" })
|
|
3470
|
+
], TestSectionLink.prototype, "sectionId", void 0);
|
|
3330
3471
|
|
|
3331
|
-
// ../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
|
+
};
|
|
3332
3479
|
var TestStamp = class extends i2 {
|
|
3333
3480
|
constructor() {
|
|
3334
3481
|
super(...arguments);
|
|
@@ -3386,103 +3533,106 @@ var TestStamp = class extends i2 {
|
|
|
3386
3533
|
activeTestpart: augmentedTestPart,
|
|
3387
3534
|
test: activeTest
|
|
3388
3535
|
};
|
|
3389
|
-
this.dispatchEvent(
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
})
|
|
3394
|
-
);
|
|
3536
|
+
this.dispatchEvent(new CustomEvent("qti-stamp-context-updated", {
|
|
3537
|
+
detail: this.stampContext,
|
|
3538
|
+
bubbles: true
|
|
3539
|
+
}));
|
|
3395
3540
|
}
|
|
3396
3541
|
render() {
|
|
3397
3542
|
return T` ${this.debug ? T`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : A}
|
|
3398
3543
|
${this.myTemplate ? this.myTemplate(this.stampContext) : A}`;
|
|
3399
3544
|
}
|
|
3400
3545
|
};
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
], TestStamp.prototype, "debug",
|
|
3404
|
-
|
|
3546
|
+
__decorate21([
|
|
3547
|
+
n2({ type: Boolean, reflect: true })
|
|
3548
|
+
], TestStamp.prototype, "debug", void 0);
|
|
3549
|
+
__decorate21([
|
|
3405
3550
|
r(),
|
|
3406
3551
|
c({ context: computedContext, subscribe: true })
|
|
3407
|
-
], TestStamp.prototype, "computedContext",
|
|
3408
|
-
|
|
3552
|
+
], TestStamp.prototype, "computedContext", void 0);
|
|
3553
|
+
__decorate21([
|
|
3409
3554
|
r()
|
|
3410
|
-
], TestStamp.prototype, "stampContext",
|
|
3411
|
-
TestStamp = __decorateClass([
|
|
3412
|
-
t("test-stamp")
|
|
3413
|
-
], TestStamp);
|
|
3555
|
+
], TestStamp.prototype, "stampContext", void 0);
|
|
3414
3556
|
|
|
3415
|
-
// ../qti-test/
|
|
3416
|
-
var
|
|
3417
|
-
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 {
|
|
3418
3566
|
constructor() {
|
|
3419
|
-
super();
|
|
3420
|
-
|
|
3421
|
-
this.
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
this.
|
|
3425
|
-
const target = e3.target;
|
|
3426
|
-
const value = parseFloat(target.value);
|
|
3427
|
-
if (target.tagName === "INPUT") {
|
|
3428
|
-
__privateMethod(this, _TestScoringButtons_instances, changeOutcomeScore_fn).call(this, value);
|
|
3429
|
-
}
|
|
3430
|
-
});
|
|
3567
|
+
super(...arguments);
|
|
3568
|
+
this.label = "view";
|
|
3569
|
+
this._handleViewOptionsChange = () => {
|
|
3570
|
+
this.#updateViewOptions();
|
|
3571
|
+
};
|
|
3572
|
+
this._viewOptions = _a.DEFAULT_VIEW_OPTIONS;
|
|
3431
3573
|
}
|
|
3432
|
-
|
|
3433
|
-
|
|
3574
|
+
static {
|
|
3575
|
+
this.DEFAULT_VIEW_OPTIONS = ["author", "candidate", "proctor", "scorer", "testConstructor", "tutor"];
|
|
3434
3576
|
}
|
|
3435
3577
|
connectedCallback() {
|
|
3436
3578
|
super.connectedCallback();
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
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;
|
|
3441
3587
|
}
|
|
3442
|
-
|
|
3588
|
+
}
|
|
3589
|
+
_switchView(view) {
|
|
3590
|
+
this.dispatchEvent(new CustomEvent("on-test-switch-view", {
|
|
3591
|
+
composed: true,
|
|
3592
|
+
bubbles: true,
|
|
3593
|
+
detail: view
|
|
3594
|
+
}));
|
|
3443
3595
|
}
|
|
3444
3596
|
render() {
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
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
|
+
`;
|
|
3454
3610
|
}
|
|
3455
3611
|
};
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
)
|
|
3471
|
-
|
|
3472
|
-
__decorateClass([
|
|
3473
|
-
n({ type: String, attribute: "view" })
|
|
3474
|
-
], TestScoringButtons.prototype, "view", 2);
|
|
3475
|
-
__decorateClass([
|
|
3476
|
-
n({ type: Boolean })
|
|
3477
|
-
], TestScoringButtons.prototype, "disabled", 2);
|
|
3478
|
-
__decorateClass([
|
|
3479
|
-
c({ context: computedContext, subscribe: true })
|
|
3480
|
-
], TestScoringButtons.prototype, "computedContext", 2);
|
|
3481
|
-
TestScoringButtons = __decorateClass([
|
|
3482
|
-
t("test-scoring-buttons")
|
|
3483
|
-
], 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);
|
|
3484
3628
|
|
|
3485
|
-
// ../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
|
+
};
|
|
3486
3636
|
var TestViewToggle = class extends i2 {
|
|
3487
3637
|
createRenderRoot() {
|
|
3488
3638
|
return this;
|
|
@@ -3497,13 +3647,11 @@ var TestViewToggle = class extends i2 {
|
|
|
3497
3647
|
this.myTemplate = prepareTemplate(templateElement);
|
|
3498
3648
|
}
|
|
3499
3649
|
_switchView(view) {
|
|
3500
|
-
this.dispatchEvent(
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
})
|
|
3506
|
-
);
|
|
3650
|
+
this.dispatchEvent(new CustomEvent("on-test-switch-view", {
|
|
3651
|
+
composed: true,
|
|
3652
|
+
bubbles: true,
|
|
3653
|
+
detail: view
|
|
3654
|
+
}));
|
|
3507
3655
|
}
|
|
3508
3656
|
firstUpdated(_changedProperties) {
|
|
3509
3657
|
this.addEventListener("click", () => {
|
|
@@ -3520,126 +3668,182 @@ var TestViewToggle = class extends i2 {
|
|
|
3520
3668
|
}) : A}`;
|
|
3521
3669
|
}
|
|
3522
3670
|
};
|
|
3523
|
-
|
|
3671
|
+
__decorate23([
|
|
3524
3672
|
c({ context: sessionContext, subscribe: true })
|
|
3525
|
-
], TestViewToggle.prototype, "sessionContext",
|
|
3526
|
-
TestViewToggle = __decorateClass([
|
|
3527
|
-
t("test-view-toggle")
|
|
3528
|
-
], TestViewToggle);
|
|
3673
|
+
], TestViewToggle.prototype, "sessionContext", void 0);
|
|
3529
3674
|
|
|
3530
|
-
// ../qti-test/
|
|
3531
|
-
var
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
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
|
+
];
|
|
3535
3685
|
}
|
|
3536
3686
|
render() {
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
const
|
|
3541
|
-
const
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
}
|
|
3551
|
-
if (externalScored === "externalMachine") {
|
|
3552
|
-
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.`;
|
|
3553
|
-
}
|
|
3554
|
-
if (externalScored === "human") {
|
|
3555
|
-
return Number.isNaN(score) ? "" : "Deze score heb je zelf toegekend.";
|
|
3556
|
-
}
|
|
3557
|
-
return this.dataset.inProgress;
|
|
3558
|
-
};
|
|
3559
|
-
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
|
+
}
|
|
3560
3700
|
}
|
|
3561
3701
|
};
|
|
3562
|
-
__decorateClass([
|
|
3563
|
-
c({ context: computedContext, subscribe: true })
|
|
3564
|
-
], TestScoringFeedback.prototype, "computedContext", 2);
|
|
3565
|
-
__decorateClass([
|
|
3566
|
-
n({ type: String, attribute: "view" })
|
|
3567
|
-
], TestScoringFeedback.prototype, "view", 2);
|
|
3568
|
-
TestScoringFeedback = __decorateClass([
|
|
3569
|
-
t("test-scoring-feedback")
|
|
3570
|
-
], TestScoringFeedback);
|
|
3571
3702
|
|
|
3572
|
-
// ../qti-test/
|
|
3573
|
-
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;
|
|
3574
3712
|
constructor() {
|
|
3575
3713
|
super();
|
|
3576
|
-
this.addEventListener("
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
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 };
|
|
3590
3740
|
});
|
|
3741
|
+
const logic = new QtiTestVariablesExpression(this._testContext, itemVariable, includedItems);
|
|
3742
|
+
const value = logic.calculate();
|
|
3743
|
+
return value;
|
|
3591
3744
|
}
|
|
3592
|
-
|
|
3593
|
-
return
|
|
3745
|
+
calculate() {
|
|
3746
|
+
return this.getResult();
|
|
3594
3747
|
}
|
|
3595
3748
|
};
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
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
|
+
];
|
|
3607
3810
|
|
|
3608
3811
|
export {
|
|
3609
|
-
QtiTest,
|
|
3610
3812
|
QtiAssessmentItemRef,
|
|
3611
3813
|
QtiAssessmentSection,
|
|
3612
3814
|
QtiAssessmentTest,
|
|
3613
|
-
QtiTestPart,
|
|
3614
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,
|
|
3615
3830
|
TestNavigation,
|
|
3616
3831
|
TestNext,
|
|
3617
|
-
TestPrev,
|
|
3618
|
-
TestView,
|
|
3619
|
-
TestItemLink,
|
|
3620
|
-
TestEndAttempt,
|
|
3621
|
-
TestShowCorrectResponse,
|
|
3622
3832
|
TestPagingButtonsStamp,
|
|
3623
|
-
|
|
3833
|
+
TestPrev,
|
|
3834
|
+
TestPrintContext,
|
|
3624
3835
|
TestPrintVariables,
|
|
3836
|
+
TestScoringButtons,
|
|
3837
|
+
TestScoringFeedback,
|
|
3625
3838
|
TestSectionButtonsStamp,
|
|
3626
3839
|
TestSectionLink,
|
|
3627
|
-
TestPrintContext,
|
|
3628
3840
|
TestStamp,
|
|
3629
|
-
|
|
3841
|
+
TestView,
|
|
3630
3842
|
TestViewToggle,
|
|
3631
|
-
|
|
3632
|
-
TestCheckItem
|
|
3843
|
+
qtiTestElements
|
|
3633
3844
|
};
|
|
3634
3845
|
/*! Bundled license information:
|
|
3635
3846
|
|
|
3636
|
-
lit-html/node/lit-html.js:
|
|
3637
|
-
(**
|
|
3638
|
-
* @license
|
|
3639
|
-
* Copyright 2017 Google LLC
|
|
3640
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
3641
|
-
*)
|
|
3642
|
-
|
|
3643
3847
|
@heximal/expressions/lib/constants.js:
|
|
3644
3848
|
@heximal/expressions/lib/tokenizer.js:
|
|
3645
3849
|
@heximal/expressions/lib/parser.js:
|
|
@@ -3657,4 +3861,4 @@ lit-html/node/private-ssr-support.js:
|
|
|
3657
3861
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
3658
3862
|
*)
|
|
3659
3863
|
*/
|
|
3660
|
-
//# sourceMappingURL=chunk-
|
|
3864
|
+
//# sourceMappingURL=chunk-LZJHHZQ2.js.map
|