@citolab/qti-components 9.3.0 → 9.5.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 +280 -220
- package/dist/base.d.ts +10 -10
- package/dist/base.js +1 -1
- package/dist/{chunk-G5RQ5GKG.js → chunk-6K3QWJHH.js} +2 -2
- package/dist/{chunk-REKCRWJV.js → chunk-6U3YPHXU.js} +231 -129
- package/dist/chunk-6U3YPHXU.js.map +1 -0
- package/dist/{chunk-JGPWBIVD.js → chunk-DAFB2E5H.js} +123 -47
- package/dist/{chunk-JGPWBIVD.js.map → chunk-DAFB2E5H.js.map} +1 -1
- package/dist/{chunk-YIYHCHHM.js → chunk-FD4AB6TM.js} +2 -2
- package/dist/{chunk-JLZCZVRX.js → chunk-GBZNFSFY.js} +2 -2
- package/dist/{chunk-ZG7FBQFP.js → chunk-MI7774NV.js} +2 -2
- package/dist/{chunk-7VDR765S.js → chunk-OQDBARD5.js} +2 -2
- package/dist/{chunk-RAJQKCQ3.js → chunk-RU6332MD.js} +3 -3
- package/dist/{chunk-TDWLV5OD.js → chunk-SIE3E4FG.js} +1159 -551
- package/dist/chunk-SIE3E4FG.js.map +1 -0
- package/dist/{chunk-CQHGVPOT.js → chunk-SU63QGGD.js} +6 -6
- package/dist/{chunk-YVZWNLF4.js → chunk-TDWJ6WZA.js} +158 -19
- package/dist/chunk-TDWJ6WZA.js.map +1 -0
- package/dist/{chunk-FG5JAWSN.js → chunk-YZRODVYZ.js} +2 -2
- package/dist/chunk-ZP6QQYSU.js +7 -0
- package/dist/chunk-ZP6QQYSU.js.map +1 -0
- package/dist/{computed.types.d-DB5gfOh9.d.ts → computed.types.d-gJrBeUMG.d.ts} +1 -1
- package/dist/corrections.d.ts +9 -9
- package/dist/corrections.js +8 -8
- package/dist/elements.d.ts +108 -6
- package/dist/elements.js +17 -5
- package/dist/index.d.ts +12 -12
- package/dist/index.js +34 -14
- package/dist/{interaction.d-DegNJ5ZA.d.ts → interaction.d-g6XG0T0Z.d.ts} +2 -2
- package/dist/interactions.d.ts +4 -4
- package/dist/interactions.js +3 -3
- package/dist/item.css +11 -0
- package/dist/item.d.ts +4 -4
- package/dist/item.js +4 -4
- package/dist/{item.types.d-BDFrq19E.d.ts → item.types.d-B55QkJ92.d.ts} +10 -0
- package/dist/loader.d.ts +2 -2
- package/dist/processing.d.ts +3 -3
- package/dist/processing.js +3 -3
- package/dist/qti-components-jsx.d.ts +536 -409
- package/dist/{qti-condition-expression.d-DLboq8bR.d.ts → qti-condition-expression.d-VJH6cWxf.d.ts} +1 -1
- package/dist/{qti-expression.d-BksT9iLB.d.ts → qti-expression.d-BPxEp8HU.d.ts} +8 -1
- package/dist/{qti-feedback.d-D-w6-mJv.d.ts → qti-feedback.d-wMYNVkkj.d.ts} +2 -3
- package/dist/{qti-item.d-D_-9_0e6.d.ts → qti-item.d-DgC1AQbY.d.ts} +1 -1
- package/dist/{qti-test.d-D-ELy0Mr.d.ts → qti-test.d-86TlaMlI.d.ts} +298 -39
- package/dist/{qti-text-entry-interaction.d-CATtcPyX.d.ts → qti-text-entry-interaction.d-C4eixT-D.d.ts} +8 -3
- package/dist/{session.context.d-Cjs0BkJB.d.ts → session.context.d-D5080LVx.d.ts} +3 -1
- package/dist/test.d.ts +58 -11
- package/dist/test.js +13 -5
- package/package.json +5 -5
- package/dist/chunk-A32YH4H5.js +0 -7
- package/dist/chunk-A32YH4H5.js.map +0 -1
- package/dist/chunk-REKCRWJV.js.map +0 -1
- package/dist/chunk-TDWLV5OD.js.map +0 -1
- package/dist/chunk-YVZWNLF4.js.map +0 -1
- /package/dist/{chunk-G5RQ5GKG.js.map → chunk-6K3QWJHH.js.map} +0 -0
- /package/dist/{chunk-YIYHCHHM.js.map → chunk-FD4AB6TM.js.map} +0 -0
- /package/dist/{chunk-JLZCZVRX.js.map → chunk-GBZNFSFY.js.map} +0 -0
- /package/dist/{chunk-ZG7FBQFP.js.map → chunk-MI7774NV.js.map} +0 -0
- /package/dist/{chunk-7VDR765S.js.map → chunk-OQDBARD5.js.map} +0 -0
- /package/dist/{chunk-RAJQKCQ3.js.map → chunk-RU6332MD.js.map} +0 -0
- /package/dist/{chunk-CQHGVPOT.js.map → chunk-SU63QGGD.js.map} +0 -0
- /package/dist/{chunk-FG5JAWSN.js.map → chunk-YZRODVYZ.js.map} +0 -0
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
|
-
QtiModalFeedback
|
|
3
|
-
|
|
2
|
+
QtiModalFeedback,
|
|
3
|
+
dispatchDeclared,
|
|
4
|
+
listenDeclared,
|
|
5
|
+
listenPublic
|
|
6
|
+
} from "./chunk-6U3YPHXU.js";
|
|
4
7
|
import {
|
|
5
8
|
item_css_default
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZP6QQYSU.js";
|
|
7
10
|
import {
|
|
8
11
|
watch
|
|
9
12
|
} from "./chunk-4DB4SC5K.js";
|
|
@@ -21,7 +24,7 @@ import {
|
|
|
21
24
|
qtiContext,
|
|
22
25
|
sessionContext,
|
|
23
26
|
testContext
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-TDWJ6WZA.js";
|
|
25
28
|
|
|
26
29
|
// ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
|
|
27
30
|
import { LitElement, nothing as nothing2 } from "lit";
|
|
@@ -633,18 +636,18 @@ var EvalAstFactory = class {
|
|
|
633
636
|
}
|
|
634
637
|
const value = this.right.evaluate(scope);
|
|
635
638
|
let receiver = void 0;
|
|
636
|
-
let
|
|
639
|
+
let property22;
|
|
637
640
|
if (this.left.type === "Getter") {
|
|
638
641
|
receiver = this.left.receiver.evaluate(scope);
|
|
639
|
-
|
|
642
|
+
property22 = this.left.name;
|
|
640
643
|
} else if (this.left.type === "Index") {
|
|
641
644
|
receiver = this.left.receiver.evaluate(scope);
|
|
642
|
-
|
|
645
|
+
property22 = this.left.argument.evaluate(scope);
|
|
643
646
|
} else if (this.left.type === "ID") {
|
|
644
647
|
receiver = scope;
|
|
645
|
-
|
|
648
|
+
property22 = this.left.value;
|
|
646
649
|
}
|
|
647
|
-
return receiver === void 0 ? void 0 : receiver[
|
|
650
|
+
return receiver === void 0 ? void 0 : receiver[property22] = value;
|
|
648
651
|
}
|
|
649
652
|
return f(this.left.evaluate(scope), this.right.evaluate(scope));
|
|
650
653
|
},
|
|
@@ -1096,6 +1099,37 @@ var makeLitTemplate = (template) => {
|
|
|
1096
1099
|
return litTemplate;
|
|
1097
1100
|
};
|
|
1098
1101
|
|
|
1102
|
+
// ../qti-test/dist/internal/test-host.context.js
|
|
1103
|
+
import { createContext } from "@lit/context";
|
|
1104
|
+
var testHostContext = createContext(/* @__PURE__ */ Symbol("testHost"));
|
|
1105
|
+
|
|
1106
|
+
// ../qti-test/dist/public-events.js
|
|
1107
|
+
var PUBLIC_EVENTS = {
|
|
1108
|
+
"cito-test-navigate": { kind: "request", scope: "test", deprecated: "qti-request-navigation" },
|
|
1109
|
+
"cito-test-end-attempt": { kind: "request", scope: "test", deprecated: "test-end-attempt" },
|
|
1110
|
+
"cito-test-update-outcome": { kind: "request", scope: "test", deprecated: "test-update-outcome-variable" },
|
|
1111
|
+
"cito-test-switch-view": { kind: "request", scope: "test", deprecated: "on-test-switch-view" },
|
|
1112
|
+
"cito-test-navigated": { kind: "notification", scope: "test" },
|
|
1113
|
+
"cito-test-navigation-started": {
|
|
1114
|
+
kind: "notification",
|
|
1115
|
+
scope: "test",
|
|
1116
|
+
deprecated: "qti-navigation-loading-started"
|
|
1117
|
+
},
|
|
1118
|
+
"cito-test-navigation-failed": { kind: "notification", scope: "test", deprecated: "qti-navigation-error" },
|
|
1119
|
+
"cito-test-rendered": { kind: "notification", scope: "test", deprecated: "qti-test-loaded" },
|
|
1120
|
+
"cito-test-loaded": { kind: "notification", scope: "test", deprecated: "qti-assessment-test-connected" },
|
|
1121
|
+
"cito-test-state-changed": { kind: "notification", scope: "test", deprecated: "qti-state-changed" },
|
|
1122
|
+
"cito-test-items-skipped": { kind: "notification", scope: "test" },
|
|
1123
|
+
"cito-test-end-reached": { kind: "notification", scope: "test" },
|
|
1124
|
+
"cito-item-ref-connected": { kind: "notification", scope: "item", deprecated: "qti-assessment-item-ref-connected" }
|
|
1125
|
+
};
|
|
1126
|
+
function dispatchPublic(target, name, detail) {
|
|
1127
|
+
dispatchDeclared(target, PUBLIC_EVENTS, name, detail);
|
|
1128
|
+
}
|
|
1129
|
+
function listenPublic2(target, name, handler) {
|
|
1130
|
+
listenDeclared(target, PUBLIC_EVENTS, name, handler);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1099
1133
|
// ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
|
|
1100
1134
|
var __decorate = function(decorators, target, key, desc) {
|
|
1101
1135
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1147,39 +1181,21 @@ var QtiAssessmentItemRef = class extends LitElement {
|
|
|
1147
1181
|
get assessmentItem() {
|
|
1148
1182
|
return this.renderRoot?.querySelector("qti-assessment-item");
|
|
1149
1183
|
}
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
*
|
|
1154
|
-
* `<test-container>` renders its items into a shadow root, so an item-ref is
|
|
1155
|
-
* usually one hop below one; but it is also valid in plain light DOM, and a
|
|
1156
|
-
* host is free to nest it deeper. Climbing root by root covers all three
|
|
1157
|
-
* without assuming any of them.
|
|
1158
|
-
*/
|
|
1159
|
-
#findTestElement() {
|
|
1160
|
-
const own = this.closest("qti-test");
|
|
1161
|
-
if (own)
|
|
1162
|
-
return own;
|
|
1163
|
-
let root = this.getRootNode();
|
|
1164
|
-
while (root instanceof ShadowRoot) {
|
|
1165
|
-
const test = root.host.closest("qti-test");
|
|
1166
|
-
if (test)
|
|
1167
|
-
return test;
|
|
1168
|
-
root = root.host.getRootNode();
|
|
1169
|
-
}
|
|
1170
|
-
return null;
|
|
1184
|
+
disconnectedCallback() {
|
|
1185
|
+
super.disconnectedCallback();
|
|
1186
|
+
this.testHost = void 0;
|
|
1171
1187
|
}
|
|
1172
1188
|
async connectedCallback() {
|
|
1173
1189
|
super.connectedCallback();
|
|
1174
|
-
const templateElement = this
|
|
1190
|
+
const templateElement = this.testHost?.querySelector("template[item-ref]");
|
|
1175
1191
|
this.myTemplate = templateElement ? prepareTemplate(templateElement) : null;
|
|
1176
1192
|
this.requestUpdate();
|
|
1177
1193
|
await this.updateComplete;
|
|
1178
|
-
this
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
})
|
|
1194
|
+
dispatchPublic(this, "cito-item-ref-connected", {
|
|
1195
|
+
identifier: this.identifier,
|
|
1196
|
+
href: this.href,
|
|
1197
|
+
category: this.category
|
|
1198
|
+
});
|
|
1183
1199
|
}
|
|
1184
1200
|
#computedItem() {
|
|
1185
1201
|
for (const testPart of this.computedContext?.testParts ?? []) {
|
|
@@ -1247,6 +1263,9 @@ __decorate([
|
|
|
1247
1263
|
__decorate([
|
|
1248
1264
|
property({ type: Object, attribute: false })
|
|
1249
1265
|
], QtiAssessmentItemRef.prototype, "xmlDoc", void 0);
|
|
1266
|
+
__decorate([
|
|
1267
|
+
consume({ context: testHostContext, subscribe: true })
|
|
1268
|
+
], QtiAssessmentItemRef.prototype, "testHost", void 0);
|
|
1250
1269
|
|
|
1251
1270
|
// ../qti-test/dist/components/qti-assessment-section/qti-assessment-section.js
|
|
1252
1271
|
import { consume as consume2 } from "@lit/context";
|
|
@@ -1337,11 +1356,7 @@ var QtiAssessmentTest = class extends LitElement3 {
|
|
|
1337
1356
|
async connectedCallback() {
|
|
1338
1357
|
super.connectedCallback();
|
|
1339
1358
|
await this.updateComplete;
|
|
1340
|
-
this
|
|
1341
|
-
detail: this,
|
|
1342
|
-
bubbles: true,
|
|
1343
|
-
composed: true
|
|
1344
|
-
}));
|
|
1359
|
+
dispatchPublic(this, "cito-test-loaded", this);
|
|
1345
1360
|
}
|
|
1346
1361
|
render() {
|
|
1347
1362
|
return html2` <slot></slot>`;
|
|
@@ -1357,15 +1372,75 @@ __decorate3([
|
|
|
1357
1372
|
consume3({ context: testContext, subscribe: true })
|
|
1358
1373
|
], QtiAssessmentTest.prototype, "_testContext", void 0);
|
|
1359
1374
|
|
|
1360
|
-
// ../qti-test/dist/components/qti-
|
|
1361
|
-
import { html as html3, LitElement as LitElement4 } from "lit";
|
|
1375
|
+
// ../qti-test/dist/components/qti-branch-rule/qti-branch-rule.js
|
|
1376
|
+
import { css, html as html3, LitElement as LitElement4 } from "lit";
|
|
1362
1377
|
import { property as property4 } from "lit/decorators.js";
|
|
1378
|
+
|
|
1379
|
+
// ../qti-test/dist/internal/evaluate-condition.js
|
|
1380
|
+
function evaluateBooleanChild(element, onError) {
|
|
1381
|
+
const expression = element.firstElementChild;
|
|
1382
|
+
if (!expression || typeof expression.calculate !== "function") {
|
|
1383
|
+
console.warn(`<${element.localName}> has no evaluable expression child`, element);
|
|
1384
|
+
return onError;
|
|
1385
|
+
}
|
|
1386
|
+
try {
|
|
1387
|
+
const result = expression.calculate();
|
|
1388
|
+
return result === true || result === "true";
|
|
1389
|
+
} catch (error) {
|
|
1390
|
+
console.warn(`<${element.localName}> could not evaluate its expression`, error);
|
|
1391
|
+
return onError;
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
// ../qti-test/dist/components/qti-branch-rule/qti-branch-rule.js
|
|
1363
1396
|
var __decorate4 = function(decorators, target, key, desc) {
|
|
1364
1397
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1365
1398
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1366
1399
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1367
1400
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1368
1401
|
};
|
|
1402
|
+
var QtiBranchRule = class extends LitElement4 {
|
|
1403
|
+
constructor() {
|
|
1404
|
+
super(...arguments);
|
|
1405
|
+
this.target = "";
|
|
1406
|
+
}
|
|
1407
|
+
static {
|
|
1408
|
+
this.EXIT_SECTION = "EXIT_SECTION";
|
|
1409
|
+
}
|
|
1410
|
+
static {
|
|
1411
|
+
this.EXIT_TESTPART = "EXIT_TESTPART";
|
|
1412
|
+
}
|
|
1413
|
+
static {
|
|
1414
|
+
this.EXIT_TEST = "EXIT_TEST";
|
|
1415
|
+
}
|
|
1416
|
+
static {
|
|
1417
|
+
this.styles = css`
|
|
1418
|
+
:host {
|
|
1419
|
+
display: none;
|
|
1420
|
+
}
|
|
1421
|
+
`;
|
|
1422
|
+
}
|
|
1423
|
+
/** `true` when the test should jump to `target`. */
|
|
1424
|
+
evaluate() {
|
|
1425
|
+
return evaluateBooleanChild(this, false);
|
|
1426
|
+
}
|
|
1427
|
+
render() {
|
|
1428
|
+
return html3`<slot></slot>`;
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
__decorate4([
|
|
1432
|
+
property4({ type: String })
|
|
1433
|
+
], QtiBranchRule.prototype, "target", void 0);
|
|
1434
|
+
|
|
1435
|
+
// ../qti-test/dist/components/qti-item-session-control/qti-item-session-control.js
|
|
1436
|
+
import { html as html4, LitElement as LitElement5 } from "lit";
|
|
1437
|
+
import { property as property5 } from "lit/decorators.js";
|
|
1438
|
+
var __decorate5 = function(decorators, target, key, desc) {
|
|
1439
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1440
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1441
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1442
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1443
|
+
};
|
|
1369
1444
|
var stringToBooleanConverter3 = {
|
|
1370
1445
|
fromAttribute(value) {
|
|
1371
1446
|
return value === "true";
|
|
@@ -1374,7 +1449,7 @@ var stringToBooleanConverter3 = {
|
|
|
1374
1449
|
return value ? "true" : "false";
|
|
1375
1450
|
}
|
|
1376
1451
|
};
|
|
1377
|
-
var QtiItemSessionControl = class extends
|
|
1452
|
+
var QtiItemSessionControl = class extends LitElement5 {
|
|
1378
1453
|
constructor() {
|
|
1379
1454
|
super(...arguments);
|
|
1380
1455
|
this.maxAttempts = 1;
|
|
@@ -1395,31 +1470,34 @@ var QtiItemSessionControl = class extends LitElement4 {
|
|
|
1395
1470
|
}));
|
|
1396
1471
|
}
|
|
1397
1472
|
render() {
|
|
1398
|
-
return
|
|
1473
|
+
return html4`<slot></slot>`;
|
|
1399
1474
|
}
|
|
1400
1475
|
};
|
|
1401
|
-
|
|
1402
|
-
|
|
1476
|
+
__decorate5([
|
|
1477
|
+
property5({ type: Number, attribute: "max-attempts" })
|
|
1403
1478
|
], QtiItemSessionControl.prototype, "maxAttempts", void 0);
|
|
1404
|
-
|
|
1405
|
-
|
|
1479
|
+
__decorate5([
|
|
1480
|
+
property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "show-feedback" })
|
|
1406
1481
|
], QtiItemSessionControl.prototype, "showFeedback", void 0);
|
|
1407
|
-
|
|
1408
|
-
|
|
1482
|
+
__decorate5([
|
|
1483
|
+
property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-review" })
|
|
1409
1484
|
], QtiItemSessionControl.prototype, "allowReview", void 0);
|
|
1410
|
-
|
|
1411
|
-
|
|
1485
|
+
__decorate5([
|
|
1486
|
+
property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "show-solution" })
|
|
1412
1487
|
], QtiItemSessionControl.prototype, "showSolution", void 0);
|
|
1413
|
-
|
|
1414
|
-
|
|
1488
|
+
__decorate5([
|
|
1489
|
+
property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-comment" })
|
|
1415
1490
|
], QtiItemSessionControl.prototype, "allowComment", void 0);
|
|
1416
|
-
|
|
1417
|
-
|
|
1491
|
+
__decorate5([
|
|
1492
|
+
property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "allow-skipping" })
|
|
1418
1493
|
], QtiItemSessionControl.prototype, "allowSkipping", void 0);
|
|
1419
|
-
|
|
1420
|
-
|
|
1494
|
+
__decorate5([
|
|
1495
|
+
property5({ type: Boolean, converter: stringToBooleanConverter3, attribute: "validate-responses" })
|
|
1421
1496
|
], QtiItemSessionControl.prototype, "validateResponses", void 0);
|
|
1422
1497
|
|
|
1498
|
+
// ../qti-test/dist/components/qti-number-presented/qti-number-presented.js
|
|
1499
|
+
import { consume as consume4 } from "@lit/context";
|
|
1500
|
+
|
|
1423
1501
|
// ../qti-test/dist/internal/item-ref-selection.js
|
|
1424
1502
|
var categoryList = (value) => value?.split(/\s+/).filter(Boolean) ?? [];
|
|
1425
1503
|
var selectionFrom = (element) => ({
|
|
@@ -1445,12 +1523,49 @@ var selectItemRefs = (testElement, { sectionIdentifier, includeCategories, exclu
|
|
|
1445
1523
|
});
|
|
1446
1524
|
};
|
|
1447
1525
|
|
|
1526
|
+
// ../qti-test/dist/components/qti-number-presented/qti-number-presented.js
|
|
1527
|
+
var __decorate6 = function(decorators, target, key, desc) {
|
|
1528
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1529
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1530
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1531
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1532
|
+
};
|
|
1533
|
+
var QtiNumberPresented = class extends QtiExpression {
|
|
1534
|
+
#connectedTest = null;
|
|
1535
|
+
constructor() {
|
|
1536
|
+
super();
|
|
1537
|
+
listenPublic2(this, "cito-test-loaded", (e) => this.#connectedTest = e.detail);
|
|
1538
|
+
}
|
|
1539
|
+
/** The test this expression is in: handed over by a test harness, or found up the tree in a real document. */
|
|
1540
|
+
get #testElement() {
|
|
1541
|
+
return this.#connectedTest ?? this.closest("qti-assessment-test");
|
|
1542
|
+
}
|
|
1543
|
+
getResult() {
|
|
1544
|
+
const testElement = this.#testElement;
|
|
1545
|
+
if (!testElement) {
|
|
1546
|
+
console.warn("qti-number-presented: no enclosing qti-assessment-test, nothing to count");
|
|
1547
|
+
return 0;
|
|
1548
|
+
}
|
|
1549
|
+
const presented = new Set((this._testContext?.items ?? []).filter((item) => {
|
|
1550
|
+
const status = item.variables?.find((v) => v.identifier === "completionStatus")?.value;
|
|
1551
|
+
return status != null && status !== "not_attempted";
|
|
1552
|
+
}).map((item) => item.identifier));
|
|
1553
|
+
return selectItemRefs(testElement, selectionFrom(this)).filter((itemRef) => presented.has(itemRef.identifier)).length;
|
|
1554
|
+
}
|
|
1555
|
+
calculate() {
|
|
1556
|
+
return this.getResult();
|
|
1557
|
+
}
|
|
1558
|
+
};
|
|
1559
|
+
__decorate6([
|
|
1560
|
+
consume4({ context: testContext, subscribe: true })
|
|
1561
|
+
], QtiNumberPresented.prototype, "_testContext", void 0);
|
|
1562
|
+
|
|
1448
1563
|
// ../qti-test/dist/components/qti-number-selected/qti-number-selected.js
|
|
1449
1564
|
var QtiNumberSelected = class extends QtiExpression {
|
|
1450
1565
|
#connectedTest = null;
|
|
1451
1566
|
constructor() {
|
|
1452
1567
|
super();
|
|
1453
|
-
this
|
|
1568
|
+
listenPublic2(this, "cito-test-loaded", (e) => this.#connectedTest = e.detail);
|
|
1454
1569
|
}
|
|
1455
1570
|
/**
|
|
1456
1571
|
* `qti-assessment-test-connected` bubbles *up* from the test element, and this
|
|
@@ -1474,12 +1589,31 @@ var QtiNumberSelected = class extends QtiExpression {
|
|
|
1474
1589
|
}
|
|
1475
1590
|
};
|
|
1476
1591
|
|
|
1592
|
+
// ../qti-test/dist/components/qti-pre-condition/qti-pre-condition.js
|
|
1593
|
+
import { css as css2, html as html5, LitElement as LitElement6 } from "lit";
|
|
1594
|
+
var QtiPreCondition = class extends LitElement6 {
|
|
1595
|
+
static {
|
|
1596
|
+
this.styles = css2`
|
|
1597
|
+
:host {
|
|
1598
|
+
display: none;
|
|
1599
|
+
}
|
|
1600
|
+
`;
|
|
1601
|
+
}
|
|
1602
|
+
/** `true` when the parent may be presented. */
|
|
1603
|
+
evaluate() {
|
|
1604
|
+
return evaluateBooleanChild(this, true);
|
|
1605
|
+
}
|
|
1606
|
+
render() {
|
|
1607
|
+
return html5`<slot></slot>`;
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1610
|
+
|
|
1477
1611
|
// ../qti-test/dist/components/qti-outcome-processing/qti-outcome-processing.js
|
|
1478
|
-
import { css, html as
|
|
1479
|
-
var QtiOutcomeProcessing = class extends
|
|
1612
|
+
import { css as css3, html as html6, LitElement as LitElement7 } from "lit";
|
|
1613
|
+
var QtiOutcomeProcessing = class extends LitElement7 {
|
|
1480
1614
|
static {
|
|
1481
1615
|
this.styles = [
|
|
1482
|
-
|
|
1616
|
+
css3`
|
|
1483
1617
|
:host {
|
|
1484
1618
|
display: none;
|
|
1485
1619
|
}
|
|
@@ -1487,7 +1621,7 @@ var QtiOutcomeProcessing = class extends LitElement5 {
|
|
|
1487
1621
|
];
|
|
1488
1622
|
}
|
|
1489
1623
|
render() {
|
|
1490
|
-
return
|
|
1624
|
+
return html6`<slot></slot>`;
|
|
1491
1625
|
}
|
|
1492
1626
|
process() {
|
|
1493
1627
|
const logic = new QtiOutcomeProcessingProcessor();
|
|
@@ -1509,30 +1643,52 @@ var QtiOutcomeProcessingProcessor = class {
|
|
|
1509
1643
|
};
|
|
1510
1644
|
|
|
1511
1645
|
// ../qti-test/dist/components/qti-test-feedback/qti-test-feedback.js
|
|
1512
|
-
import { css as
|
|
1646
|
+
import { css as css4, html as html7 } from "lit";
|
|
1647
|
+
import { property as property6 } from "lit/decorators.js";
|
|
1648
|
+
var __decorate7 = function(decorators, target, key, desc) {
|
|
1649
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1650
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1651
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1652
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1653
|
+
};
|
|
1513
1654
|
var QtiTestFeedback = class extends QtiModalFeedback {
|
|
1655
|
+
constructor() {
|
|
1656
|
+
super(...arguments);
|
|
1657
|
+
this.access = "atEnd";
|
|
1658
|
+
}
|
|
1514
1659
|
static {
|
|
1515
|
-
this.styles =
|
|
1660
|
+
this.styles = css4`
|
|
1516
1661
|
:host {
|
|
1517
1662
|
color: gray;
|
|
1518
1663
|
}
|
|
1519
1664
|
`;
|
|
1520
1665
|
}
|
|
1666
|
+
/**
|
|
1667
|
+
* Whether this feedback applies for a value of its `outcome-identifier`: with `show-hide="show"`
|
|
1668
|
+
* when the value is (or, for a container, holds) its `identifier`; with `hide` when it is not.
|
|
1669
|
+
*/
|
|
1670
|
+
matches(value) {
|
|
1671
|
+
const found = Array.isArray(value) ? value.includes(this.identifier) : value != null && value === this.identifier;
|
|
1672
|
+
return this.showHide === "hide" ? !found : found;
|
|
1673
|
+
}
|
|
1521
1674
|
render() {
|
|
1522
|
-
return
|
|
1675
|
+
return html7``;
|
|
1523
1676
|
}
|
|
1524
1677
|
};
|
|
1678
|
+
__decorate7([
|
|
1679
|
+
property6({ type: String })
|
|
1680
|
+
], QtiTestFeedback.prototype, "access", void 0);
|
|
1525
1681
|
|
|
1526
1682
|
// ../qti-test/dist/components/qti-test-part/qti-test-part.js
|
|
1527
|
-
import { html as
|
|
1528
|
-
import { property as
|
|
1529
|
-
var
|
|
1683
|
+
import { html as html8, LitElement as LitElement8 } from "lit";
|
|
1684
|
+
import { property as property7 } from "lit/decorators.js";
|
|
1685
|
+
var __decorate8 = function(decorators, target, key, desc) {
|
|
1530
1686
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1531
1687
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1532
1688
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1533
1689
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1534
1690
|
};
|
|
1535
|
-
var QtiTestPart = class extends
|
|
1691
|
+
var QtiTestPart = class extends LitElement8 {
|
|
1536
1692
|
constructor() {
|
|
1537
1693
|
super(...arguments);
|
|
1538
1694
|
this.identifier = "";
|
|
@@ -1559,25 +1715,25 @@ var QtiTestPart = class extends LitElement6 {
|
|
|
1559
1715
|
}));
|
|
1560
1716
|
}
|
|
1561
1717
|
render() {
|
|
1562
|
-
return
|
|
1718
|
+
return html8` <slot></slot>`;
|
|
1563
1719
|
}
|
|
1564
1720
|
};
|
|
1565
|
-
|
|
1566
|
-
|
|
1721
|
+
__decorate8([
|
|
1722
|
+
property7({ type: String })
|
|
1567
1723
|
], QtiTestPart.prototype, "identifier", void 0);
|
|
1568
|
-
|
|
1569
|
-
|
|
1724
|
+
__decorate8([
|
|
1725
|
+
property7({ type: String })
|
|
1570
1726
|
], QtiTestPart.prototype, "class", void 0);
|
|
1571
|
-
|
|
1572
|
-
|
|
1727
|
+
__decorate8([
|
|
1728
|
+
property7({ type: String, attribute: "navigation-mode" })
|
|
1573
1729
|
], QtiTestPart.prototype, "navigationMode", void 0);
|
|
1574
|
-
|
|
1575
|
-
|
|
1730
|
+
__decorate8([
|
|
1731
|
+
property7({ type: String, attribute: "submission-mode" })
|
|
1576
1732
|
], QtiTestPart.prototype, "submissionMode", void 0);
|
|
1577
1733
|
|
|
1578
1734
|
// ../qti-test/dist/components/qti-test-variables/qti-test-variables.js
|
|
1579
|
-
import { consume as
|
|
1580
|
-
var
|
|
1735
|
+
import { consume as consume5 } from "@lit/context";
|
|
1736
|
+
var __decorate9 = function(decorators, target, key, desc) {
|
|
1581
1737
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1582
1738
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1583
1739
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -1587,7 +1743,7 @@ var QtiTestVariables = class extends QtiExpression {
|
|
|
1587
1743
|
#connectedTest = null;
|
|
1588
1744
|
constructor() {
|
|
1589
1745
|
super();
|
|
1590
|
-
this
|
|
1746
|
+
listenPublic2(this, "cito-test-loaded", (e) => this.#connectedTest = e.detail);
|
|
1591
1747
|
}
|
|
1592
1748
|
/**
|
|
1593
1749
|
* `qti-assessment-test-connected` bubbles *up* from the test element, and this
|
|
@@ -1618,8 +1774,8 @@ var QtiTestVariables = class extends QtiExpression {
|
|
|
1618
1774
|
return this.getResult();
|
|
1619
1775
|
}
|
|
1620
1776
|
};
|
|
1621
|
-
|
|
1622
|
-
|
|
1777
|
+
__decorate9([
|
|
1778
|
+
consume5({ context: testContext, subscribe: true })
|
|
1623
1779
|
], QtiTestVariables.prototype, "_testContext", void 0);
|
|
1624
1780
|
var QtiTestVariablesExpression = class {
|
|
1625
1781
|
constructor(testContext2, itemVariable, includedItems) {
|
|
@@ -1647,14 +1803,109 @@ var QtiTestVariablesExpression = class {
|
|
|
1647
1803
|
}
|
|
1648
1804
|
};
|
|
1649
1805
|
|
|
1806
|
+
// ../qti-test/dist/types/qti-test-state.js
|
|
1807
|
+
var QTI_TEST_STATE_VERSION = 1;
|
|
1808
|
+
|
|
1650
1809
|
// ../qti-test/dist/components/qti-test/qti-test.js
|
|
1651
|
-
import { provide as provide2 } from "@lit/context";
|
|
1652
|
-
import { html as
|
|
1810
|
+
import { ContextProvider, provide as provide2 } from "@lit/context";
|
|
1811
|
+
import { html as html9, LitElement as LitElement10 } from "lit";
|
|
1653
1812
|
import { state as state2 } from "lit/decorators.js";
|
|
1654
1813
|
|
|
1655
1814
|
// ../qti-test/dist/mixins/test-navigation.mixin.js
|
|
1656
|
-
import { property as
|
|
1657
|
-
|
|
1815
|
+
import { property as property8 } from "lit/decorators.js";
|
|
1816
|
+
|
|
1817
|
+
// ../qti-test/dist/internal/item-sequencing.js
|
|
1818
|
+
var SECTION = "qti-assessment-section";
|
|
1819
|
+
var TEST_PART = "qti-test-part";
|
|
1820
|
+
var idOf = (ref) => ref.identifier || ref.getAttribute("identifier") || "";
|
|
1821
|
+
function resolveNextItem(refs, current) {
|
|
1822
|
+
const from = refs[current];
|
|
1823
|
+
let start = current + 1;
|
|
1824
|
+
const rule = firstFiringBranchRule(from, refs, current);
|
|
1825
|
+
if (rule) {
|
|
1826
|
+
const target = branchTargetIndex(rule, refs, current);
|
|
1827
|
+
if (target === null)
|
|
1828
|
+
return { id: null, skipped: refs.slice(current + 1).map(idOf) };
|
|
1829
|
+
if (target > current)
|
|
1830
|
+
start = target;
|
|
1831
|
+
else
|
|
1832
|
+
console.warn(`qti-branch-rule target "${rule.target}" is not ahead of "${idOf(from)}", ignored`);
|
|
1833
|
+
}
|
|
1834
|
+
const skipped = refs.slice(current + 1, start).map(idOf);
|
|
1835
|
+
for (let i = start; i < refs.length; i++) {
|
|
1836
|
+
if (preConditionsPass(refs[i], from))
|
|
1837
|
+
return { id: idOf(refs[i]), skipped };
|
|
1838
|
+
skipped.push(idOf(refs[i]));
|
|
1839
|
+
}
|
|
1840
|
+
return { id: null, skipped };
|
|
1841
|
+
}
|
|
1842
|
+
function resolveFirstItem(refs) {
|
|
1843
|
+
const skipped = [];
|
|
1844
|
+
for (const ref of refs) {
|
|
1845
|
+
if (preConditionsPass(ref, null))
|
|
1846
|
+
return { id: idOf(ref), skipped };
|
|
1847
|
+
skipped.push(idOf(ref));
|
|
1848
|
+
}
|
|
1849
|
+
return { id: null, skipped };
|
|
1850
|
+
}
|
|
1851
|
+
function firstFiringBranchRule(itemRef, refs, current) {
|
|
1852
|
+
const owners = [itemRef];
|
|
1853
|
+
for (let el = itemRef.parentElement; el && (el.localName === SECTION || el.localName === TEST_PART); el = el.parentElement) {
|
|
1854
|
+
if (el.contains(refs[current + 1] ?? null))
|
|
1855
|
+
break;
|
|
1856
|
+
owners.push(el);
|
|
1857
|
+
}
|
|
1858
|
+
for (const owner of owners) {
|
|
1859
|
+
for (const rule of owner.querySelectorAll(":scope > qti-branch-rule")) {
|
|
1860
|
+
if (rule.evaluate?.())
|
|
1861
|
+
return rule;
|
|
1862
|
+
}
|
|
1863
|
+
}
|
|
1864
|
+
return null;
|
|
1865
|
+
}
|
|
1866
|
+
function branchTargetIndex(rule, refs, current) {
|
|
1867
|
+
const owner = rule.parentElement;
|
|
1868
|
+
const firstAfter = (container) => {
|
|
1869
|
+
if (!container)
|
|
1870
|
+
return null;
|
|
1871
|
+
const last = refs.findLastIndex((ref) => container.contains(ref));
|
|
1872
|
+
return last + 1 < refs.length ? last + 1 : null;
|
|
1873
|
+
};
|
|
1874
|
+
switch (rule.target) {
|
|
1875
|
+
case QtiBranchRule.EXIT_TEST:
|
|
1876
|
+
return null;
|
|
1877
|
+
case QtiBranchRule.EXIT_TESTPART:
|
|
1878
|
+
return firstAfter(owner.closest(TEST_PART));
|
|
1879
|
+
case QtiBranchRule.EXIT_SECTION: {
|
|
1880
|
+
const section = owner.localName === SECTION ? owner : owner.closest(SECTION);
|
|
1881
|
+
return firstAfter(section ?? owner);
|
|
1882
|
+
}
|
|
1883
|
+
default: {
|
|
1884
|
+
const byRef = refs.findIndex((ref) => idOf(ref) === rule.target);
|
|
1885
|
+
if (byRef >= 0)
|
|
1886
|
+
return byRef;
|
|
1887
|
+
const container = [
|
|
1888
|
+
...owner.closest("qti-assessment-test")?.querySelectorAll(`${SECTION}, ${TEST_PART}`) ?? []
|
|
1889
|
+
].find((el) => el.getAttribute("identifier") === rule.target);
|
|
1890
|
+
const inside = container ? refs.findIndex((ref) => container.contains(ref)) : -1;
|
|
1891
|
+
if (inside >= 0)
|
|
1892
|
+
return inside;
|
|
1893
|
+
console.warn(`qti-branch-rule target "${rule.target}" not found`);
|
|
1894
|
+
return current + 1;
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
function preConditionsPass(itemRef, from) {
|
|
1899
|
+
const owners = [itemRef];
|
|
1900
|
+
for (let el = itemRef.parentElement; el && (el.localName === SECTION || el.localName === TEST_PART); el = el.parentElement) {
|
|
1901
|
+
if (!from || !el.contains(from))
|
|
1902
|
+
owners.push(el);
|
|
1903
|
+
}
|
|
1904
|
+
return owners.every((owner) => [...owner.querySelectorAll(":scope > qti-pre-condition")].every((condition) => condition.evaluate?.() ?? true));
|
|
1905
|
+
}
|
|
1906
|
+
|
|
1907
|
+
// ../qti-test/dist/mixins/test-navigation.mixin.js
|
|
1908
|
+
var __decorate10 = function(decorators, target, key, desc) {
|
|
1658
1909
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1659
1910
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1660
1911
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -1688,24 +1939,20 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1688
1939
|
/**
|
|
1689
1940
|
* Navigate to a specific item or section
|
|
1690
1941
|
* @param type - Navigation type ('item' or 'section')
|
|
1691
|
-
* @param id - Target identifier (optional, falls back to first
|
|
1942
|
+
* @param id - Target identifier (optional, falls back to the current position, or the first one before there is any)
|
|
1692
1943
|
*/
|
|
1693
1944
|
navigateTo(type, id) {
|
|
1694
1945
|
const targetId = id || this._getDefaultNavigationId(type);
|
|
1695
1946
|
if (targetId) {
|
|
1696
|
-
this
|
|
1697
|
-
detail: { type, id: targetId },
|
|
1698
|
-
bubbles: true,
|
|
1699
|
-
composed: true
|
|
1700
|
-
}));
|
|
1947
|
+
dispatchPublic(this, "cito-test-navigate", { type, id: targetId });
|
|
1701
1948
|
}
|
|
1702
1949
|
}
|
|
1703
1950
|
// ===========================================
|
|
1704
1951
|
// EVENT HANDLER SETUP
|
|
1705
1952
|
// ===========================================
|
|
1706
1953
|
_bindEventHandlers() {
|
|
1707
|
-
this
|
|
1708
|
-
this
|
|
1954
|
+
listenPublic2(this, "cito-test-navigate", this._handleNavigationRequest.bind(this));
|
|
1955
|
+
listenPublic2(this, "cito-test-loaded", this._handleTestConnected.bind(this));
|
|
1709
1956
|
this.addEventListener("qti-assessment-item-connected", this._handleItemConnected.bind(this));
|
|
1710
1957
|
this.addEventListener("qti-assessment-stimulus-ref-connected", this._handleStimulusRefConnected.bind(this));
|
|
1711
1958
|
}
|
|
@@ -1769,14 +2016,27 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1769
2016
|
// ===========================================
|
|
1770
2017
|
_getDefaultNavigationId(type) {
|
|
1771
2018
|
if (type === "section") {
|
|
1772
|
-
return this._testElement?.querySelector("qti-assessment-section")?.identifier;
|
|
2019
|
+
return this.sessionContext?.navSectionId ?? this._testElement?.querySelector("qti-assessment-section")?.identifier;
|
|
1773
2020
|
}
|
|
1774
2021
|
return this.sessionContext?.navItemRefId ?? this._testElement?.querySelector("qti-assessment-item-ref")?.identifier;
|
|
1775
2022
|
}
|
|
1776
2023
|
_initializeNavigation() {
|
|
1777
2024
|
if (!this.navigate)
|
|
1778
2025
|
return;
|
|
1779
|
-
|
|
2026
|
+
let id = this._getDefaultNavigationId(this.navigate);
|
|
2027
|
+
if (this.navigate === "item" && this._testElement && !this.sessionContext?.navItemRefId) {
|
|
2028
|
+
const refs = [...this._testElement.querySelectorAll("qti-assessment-item-ref")];
|
|
2029
|
+
if (refs[0]?.closest("qti-test-part")?.getAttribute("navigation-mode") === "linear") {
|
|
2030
|
+
const first = resolveFirstItem(refs);
|
|
2031
|
+
if (first.skipped.length)
|
|
2032
|
+
dispatchPublic(this, "cito-test-items-skipped", { ids: first.skipped });
|
|
2033
|
+
if (first.id === null) {
|
|
2034
|
+
dispatchPublic(this, "cito-test-end-reached", {});
|
|
2035
|
+
return;
|
|
2036
|
+
}
|
|
2037
|
+
id = first.id;
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
1780
2040
|
if (id) {
|
|
1781
2041
|
this.navigateTo(this.navigate, id);
|
|
1782
2042
|
}
|
|
@@ -1805,13 +2065,43 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1805
2065
|
}
|
|
1806
2066
|
return true;
|
|
1807
2067
|
}
|
|
2068
|
+
/**
|
|
2069
|
+
* A "next" step in a linear test part (a request for item i+1 while item i is active) goes
|
|
2070
|
+
* through the branch rules and pre-conditions. Deep links, item links and nonlinear parts are
|
|
2071
|
+
* left alone: the spec ignores both in nonlinear mode.
|
|
2072
|
+
*
|
|
2073
|
+
* @returns the item to present instead, `null` when the test has no eligible item left, or
|
|
2074
|
+
* `undefined` when the request is not a "next" step.
|
|
2075
|
+
*/
|
|
2076
|
+
_resolveLinearNext(type, id) {
|
|
2077
|
+
if (type !== "item" || !this._testElement)
|
|
2078
|
+
return void 0;
|
|
2079
|
+
const refs = [...this._testElement.querySelectorAll("qti-assessment-item-ref")];
|
|
2080
|
+
const current = refs.findIndex((ref) => idOf(ref) === this.sessionContext?.navItemRefId);
|
|
2081
|
+
if (current < 0 || !refs[current + 1] || idOf(refs[current + 1]) !== id)
|
|
2082
|
+
return void 0;
|
|
2083
|
+
if (refs[current].closest("qti-test-part")?.getAttribute("navigation-mode") !== "linear")
|
|
2084
|
+
return void 0;
|
|
2085
|
+
const next = resolveNextItem(refs, current);
|
|
2086
|
+
if (next.id === id)
|
|
2087
|
+
return void 0;
|
|
2088
|
+
return next;
|
|
2089
|
+
}
|
|
1808
2090
|
/**
|
|
1809
2091
|
* Main navigation request handler with proper lifecycle management
|
|
1810
2092
|
*/
|
|
1811
2093
|
async _handleNavigationRequest({ detail }) {
|
|
1812
2094
|
if (!detail?.id)
|
|
1813
2095
|
return;
|
|
1814
|
-
|
|
2096
|
+
const resolved = this._resolveLinearNext(detail.type, detail.id);
|
|
2097
|
+
if (resolved?.id === null) {
|
|
2098
|
+
if (resolved.skipped.length)
|
|
2099
|
+
dispatchPublic(this, "cito-test-items-skipped", { ids: resolved.skipped });
|
|
2100
|
+
dispatchPublic(this, "cito-test-end-reached", {});
|
|
2101
|
+
return;
|
|
2102
|
+
}
|
|
2103
|
+
const target = resolved?.id ?? detail.id;
|
|
2104
|
+
if (!resolved && this._isLinearNavigationRestricted(detail.type, target)) {
|
|
1815
2105
|
this._handleNavigationError(new Error("Navigation restricted in linear mode"), detail.type, detail.id);
|
|
1816
2106
|
return;
|
|
1817
2107
|
}
|
|
@@ -1819,16 +2109,19 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1819
2109
|
const navigationId = ++this._navigationId;
|
|
1820
2110
|
const controller = new AbortController();
|
|
1821
2111
|
try {
|
|
1822
|
-
this._dispatchLoadingStarted(detail.type,
|
|
2112
|
+
this._dispatchLoadingStarted(detail.type, target);
|
|
1823
2113
|
this._activeController = controller;
|
|
1824
|
-
await this._executeNavigation(detail.type,
|
|
2114
|
+
await this._executeNavigation(detail.type, target, navigationId, controller);
|
|
2115
|
+
if (resolved?.skipped.length && navigationId === this._navigationId && !controller.signal.aborted) {
|
|
2116
|
+
dispatchPublic(this, "cito-test-items-skipped", { ids: resolved.skipped });
|
|
2117
|
+
}
|
|
1825
2118
|
} catch (error) {
|
|
1826
|
-
this._handleNavigationError(error, detail.type,
|
|
2119
|
+
this._handleNavigationError(error, detail.type, target);
|
|
1827
2120
|
} finally {
|
|
1828
2121
|
if (this._activeController === controller) {
|
|
1829
2122
|
this._activeController = null;
|
|
1830
2123
|
}
|
|
1831
|
-
this._dispatchLoadingEnded(detail.type,
|
|
2124
|
+
this._dispatchLoadingEnded(detail.type, target);
|
|
1832
2125
|
}
|
|
1833
2126
|
}
|
|
1834
2127
|
_handleNavigationError(error, type, id) {
|
|
@@ -1855,7 +2148,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1855
2148
|
await this._waitForLoadingComplete(navigationId, controller);
|
|
1856
2149
|
if (this._isStaleNavigation(navigationId, controller))
|
|
1857
2150
|
return;
|
|
1858
|
-
this._dispatchTestLoaded(this._loadResults);
|
|
2151
|
+
this._dispatchTestLoaded(this._loadResults, "item", itemId);
|
|
1859
2152
|
}
|
|
1860
2153
|
/**
|
|
1861
2154
|
* Navigate to section with simple state tracking
|
|
@@ -1876,7 +2169,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1876
2169
|
await this._waitForLoadingComplete(navigationId, controller);
|
|
1877
2170
|
if (this._isStaleNavigation(navigationId, controller))
|
|
1878
2171
|
return;
|
|
1879
|
-
this._dispatchTestLoaded(this._loadResults);
|
|
2172
|
+
this._dispatchTestLoaded(this._loadResults, "section", sectionId);
|
|
1880
2173
|
}
|
|
1881
2174
|
// ===========================================
|
|
1882
2175
|
// LOADING STATE MANAGEMENT
|
|
@@ -1935,10 +2228,9 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1935
2228
|
console.warn("No stimulus content to apply");
|
|
1936
2229
|
return;
|
|
1937
2230
|
}
|
|
1938
|
-
const
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
console.warn("No qti-stimulus-body or qti-stylesheet elements found in stimulus");
|
|
2231
|
+
const root = stimulus.querySelector("qti-assessment-stimulus");
|
|
2232
|
+
if (!root) {
|
|
2233
|
+
console.warn("No qti-assessment-stimulus element found in stimulus");
|
|
1942
2234
|
return;
|
|
1943
2235
|
}
|
|
1944
2236
|
let targets = [];
|
|
@@ -1963,8 +2255,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1963
2255
|
}
|
|
1964
2256
|
targets.forEach((target, index) => {
|
|
1965
2257
|
target.innerHTML = "";
|
|
1966
|
-
|
|
1967
|
-
target.append(...clonedElements);
|
|
2258
|
+
target.append(root.cloneNode(true));
|
|
1968
2259
|
console.info(`Applied stimulus content to target ${index + 1}/${targets.length}`);
|
|
1969
2260
|
});
|
|
1970
2261
|
}
|
|
@@ -2021,7 +2312,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2021
2312
|
}
|
|
2022
2313
|
async _loadSingleItem(itemRef, navigationId, controller) {
|
|
2023
2314
|
try {
|
|
2024
|
-
const seed = this.
|
|
2315
|
+
const seed = this.qtiContext?.QTI_CONTEXT?.seed;
|
|
2025
2316
|
let transformer = (await qtiTransformItem().load(itemRef.href, controller.signal)).shuffleInteractions(seed);
|
|
2026
2317
|
if (this.postLoadTransformCallback) {
|
|
2027
2318
|
transformer = await this.postLoadTransformCallback(transformer, itemRef);
|
|
@@ -2099,11 +2390,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2099
2390
|
// EVENT DISPATCHING
|
|
2100
2391
|
// ===========================================
|
|
2101
2392
|
_dispatchLoadingStarted(type, id) {
|
|
2102
|
-
this
|
|
2103
|
-
detail: { type, id },
|
|
2104
|
-
bubbles: true,
|
|
2105
|
-
composed: true
|
|
2106
|
-
}));
|
|
2393
|
+
dispatchPublic(this, "cito-test-navigation-started", { type, id });
|
|
2107
2394
|
}
|
|
2108
2395
|
_dispatchLoadingEnded(type, id) {
|
|
2109
2396
|
this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended", {
|
|
@@ -2113,36 +2400,30 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2113
2400
|
}));
|
|
2114
2401
|
}
|
|
2115
2402
|
_dispatchError(error) {
|
|
2116
|
-
this
|
|
2117
|
-
detail: error,
|
|
2118
|
-
bubbles: true,
|
|
2119
|
-
composed: true
|
|
2120
|
-
}));
|
|
2403
|
+
dispatchPublic(this, "cito-test-navigation-failed", error);
|
|
2121
2404
|
}
|
|
2122
|
-
|
|
2405
|
+
/** The items are in the DOM: tell hosts the new position rendered (`cito-test-navigated`) and which items it holds. */
|
|
2406
|
+
_dispatchTestLoaded(results, type, id) {
|
|
2123
2407
|
requestAnimationFrame(() => {
|
|
2124
|
-
this
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
bubbles: true,
|
|
2130
|
-
composed: true
|
|
2131
|
-
}));
|
|
2408
|
+
dispatchPublic(this, "cito-test-rendered", results.map(({ itemRef }) => ({
|
|
2409
|
+
identifier: itemRef?.identifier,
|
|
2410
|
+
element: itemRef
|
|
2411
|
+
})));
|
|
2412
|
+
dispatchPublic(this, "cito-test-navigated", { type, id });
|
|
2132
2413
|
});
|
|
2133
2414
|
}
|
|
2134
2415
|
}
|
|
2135
|
-
|
|
2136
|
-
|
|
2416
|
+
__decorate10([
|
|
2417
|
+
property8({ type: String })
|
|
2137
2418
|
], TestNavigationClass.prototype, "navigate", void 0);
|
|
2138
|
-
|
|
2139
|
-
|
|
2419
|
+
__decorate10([
|
|
2420
|
+
property8({ type: Number })
|
|
2140
2421
|
], TestNavigationClass.prototype, "requestTimeout", void 0);
|
|
2141
|
-
|
|
2142
|
-
|
|
2422
|
+
__decorate10([
|
|
2423
|
+
property8({ attribute: false })
|
|
2143
2424
|
], TestNavigationClass.prototype, "postLoadTransformCallback", void 0);
|
|
2144
|
-
|
|
2145
|
-
|
|
2425
|
+
__decorate10([
|
|
2426
|
+
property8({ attribute: false })
|
|
2146
2427
|
], TestNavigationClass.prototype, "postLoadTestTransformCallback", void 0);
|
|
2147
2428
|
return TestNavigationClass;
|
|
2148
2429
|
};
|
|
@@ -2153,11 +2434,11 @@ var TestViewMixin = (superClass) => {
|
|
|
2153
2434
|
constructor(...args) {
|
|
2154
2435
|
super(...args);
|
|
2155
2436
|
this.sessionContext = { ...this.sessionContext, view: "candidate" };
|
|
2156
|
-
this
|
|
2437
|
+
listenPublic2(this, "cito-test-switch-view", (e) => {
|
|
2157
2438
|
this.sessionContext = { ...this.sessionContext, view: e.detail };
|
|
2158
2439
|
this._updateElementView();
|
|
2159
2440
|
});
|
|
2160
|
-
this
|
|
2441
|
+
listenPublic2(this, "cito-test-loaded", () => {
|
|
2161
2442
|
this._updateElementView();
|
|
2162
2443
|
});
|
|
2163
2444
|
this.addEventListener("qti-assessment-item-connected", (e) => {
|
|
@@ -2197,9 +2478,9 @@ var TestViewMixin = (superClass) => {
|
|
|
2197
2478
|
|
|
2198
2479
|
// ../qti-test/dist/mixins/test-base.js
|
|
2199
2480
|
import { provide } from "@lit/context";
|
|
2200
|
-
import { LitElement as
|
|
2201
|
-
import { property as
|
|
2202
|
-
var
|
|
2481
|
+
import { LitElement as LitElement9 } from "lit";
|
|
2482
|
+
import { property as property9 } from "lit/decorators.js";
|
|
2483
|
+
var __decorate11 = function(decorators, target, key, desc) {
|
|
2203
2484
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2204
2485
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2205
2486
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -2212,7 +2493,7 @@ var TestBaseMixin = (superClass) => {
|
|
|
2212
2493
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
2213
2494
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
2214
2495
|
this._updateItemInTestContext = (assessmentItem) => {
|
|
2215
|
-
const context = assessmentItem.
|
|
2496
|
+
const context = assessmentItem.itemContext;
|
|
2216
2497
|
const identifier = context.identifier;
|
|
2217
2498
|
const fullVariables = context.variables;
|
|
2218
2499
|
const itemContext = this.testContext.items.find((i) => i?.identifier === identifier);
|
|
@@ -2221,10 +2502,12 @@ var TestBaseMixin = (superClass) => {
|
|
|
2221
2502
|
return;
|
|
2222
2503
|
}
|
|
2223
2504
|
if (itemContext.variables?.length === 1) {
|
|
2224
|
-
this._updateItemVariablesInTestContext(identifier, fullVariables);
|
|
2505
|
+
this._updateItemVariablesInTestContext(identifier, fullVariables, void 0, context.valid);
|
|
2225
2506
|
} else {
|
|
2226
2507
|
const newVariables = [...assessmentItem.variables];
|
|
2227
2508
|
for (const variable of itemContext.variables) {
|
|
2509
|
+
if (variable.identifier === "completionStatus" && variable.value === "not_attempted")
|
|
2510
|
+
continue;
|
|
2228
2511
|
const currentVariable = newVariables.find((v) => v.identifier === variable.identifier);
|
|
2229
2512
|
if (currentVariable) {
|
|
2230
2513
|
currentVariable.value = variable.value;
|
|
@@ -2233,29 +2516,62 @@ var TestBaseMixin = (superClass) => {
|
|
|
2233
2516
|
}
|
|
2234
2517
|
}
|
|
2235
2518
|
assessmentItem.variables = newVariables;
|
|
2519
|
+
this.#leaveNotAttempted(identifier, newVariables.find((v) => v.identifier === "completionStatus")?.value);
|
|
2520
|
+
if (itemContext.state) {
|
|
2521
|
+
assessmentItem.state = itemContext.state;
|
|
2522
|
+
}
|
|
2236
2523
|
}
|
|
2237
2524
|
};
|
|
2238
2525
|
this._initializeEventListeners();
|
|
2239
2526
|
}
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2527
|
+
/**
|
|
2528
|
+
* Sets values on one item from outside the candidate's session, e.g. a score from manual
|
|
2529
|
+
* scoring. Values are merged into the item's entry in the test context, and into the item
|
|
2530
|
+
* itself if it is on screen; a value the item has not seen yet is added, so this also works
|
|
2531
|
+
* before the item has loaded. To restore a whole session, assign `state` instead.
|
|
2532
|
+
*
|
|
2533
|
+
* The test context is replaced rather than changed in place, so its consumers update and
|
|
2534
|
+
* `qti-state-changed` fires.
|
|
2535
|
+
*
|
|
2536
|
+
* @param itemRefID The `qti-assessment-item-ref` identifier, not the item's own identifier.
|
|
2537
|
+
* @param state Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`.
|
|
2538
|
+
*/
|
|
2539
|
+
updateItemVariables(itemRefID, values, state9) {
|
|
2540
|
+
this.testContext = {
|
|
2541
|
+
...this.testContext,
|
|
2542
|
+
items: this.testContext.items.map((item) => {
|
|
2543
|
+
if (item.identifier !== itemRefID)
|
|
2544
|
+
return item;
|
|
2545
|
+
const variables = [...item.variables ?? []];
|
|
2546
|
+
for (const { identifier, type, value } of values) {
|
|
2547
|
+
const index = variables.findIndex((v) => v.identifier === identifier);
|
|
2548
|
+
const updated = {
|
|
2549
|
+
...index >= 0 ? variables[index] : {},
|
|
2550
|
+
identifier,
|
|
2551
|
+
...type ? { type } : {},
|
|
2552
|
+
value: Array.isArray(value) ? [...value] : value
|
|
2553
|
+
};
|
|
2554
|
+
if (index >= 0)
|
|
2555
|
+
variables[index] = updated;
|
|
2556
|
+
else
|
|
2557
|
+
variables.push(updated);
|
|
2558
|
+
}
|
|
2559
|
+
return { ...item, variables, ...state9 ? { state: { ...state9 } } : {} };
|
|
2560
|
+
})
|
|
2561
|
+
};
|
|
2562
|
+
const assessmentItem = this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(itemRefID)}"]`)?.assessmentItem;
|
|
2563
|
+
if (!assessmentItem)
|
|
2564
|
+
return;
|
|
2565
|
+
assessmentItem.variables = [...this.testContext.items.find((i) => i.identifier === itemRefID)?.variables ?? []];
|
|
2566
|
+
if (state9)
|
|
2567
|
+
assessmentItem.state = state9;
|
|
2252
2568
|
}
|
|
2253
2569
|
_initializeEventListeners() {
|
|
2254
2570
|
this.addEventListener("qti-testdoc-loaded", () => {
|
|
2255
2571
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
2256
2572
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
2257
2573
|
});
|
|
2258
|
-
this
|
|
2574
|
+
listenPublic2(this, "cito-test-loaded", (e) => {
|
|
2259
2575
|
this._testElement = e.detail;
|
|
2260
2576
|
const items = Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map((itemRef) => {
|
|
2261
2577
|
return {
|
|
@@ -2282,10 +2598,10 @@ var TestBaseMixin = (superClass) => {
|
|
|
2282
2598
|
this._updateItemInTestContext(e.detail);
|
|
2283
2599
|
});
|
|
2284
2600
|
this.addEventListener("qti-item-context-updated", (e) => {
|
|
2285
|
-
this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail.itemContext.variables, e.detail.itemContext.state);
|
|
2601
|
+
this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail.itemContext.variables, e.detail.itemContext.state, e.detail.itemContext.valid);
|
|
2286
2602
|
});
|
|
2287
2603
|
}
|
|
2288
|
-
_updateItemVariablesInTestContext(identifier, variables, state9) {
|
|
2604
|
+
_updateItemVariablesInTestContext(identifier, variables, state9, valid) {
|
|
2289
2605
|
this.testContext = {
|
|
2290
2606
|
...this.testContext,
|
|
2291
2607
|
// Spread existing test context properties
|
|
@@ -2300,24 +2616,150 @@ var TestBaseMixin = (superClass) => {
|
|
|
2300
2616
|
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
2301
2617
|
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
2302
2618
|
}),
|
|
2303
|
-
...state9 !== void 0 ? { state: state9 ? { ...state9 } : void 0 } : {}
|
|
2619
|
+
...state9 !== void 0 ? { state: state9 ? { ...state9 } : void 0 } : {},
|
|
2620
|
+
...valid !== void 0 ? { valid } : {}
|
|
2304
2621
|
};
|
|
2305
2622
|
})
|
|
2306
2623
|
};
|
|
2307
2624
|
this.dispatchEvent(new CustomEvent("qti-test-context-updated", { detail: this.testContext, bubbles: false, composed: false }));
|
|
2308
2625
|
}
|
|
2626
|
+
/** Write the presented item's own status over a `not_attempted` the test context still holds for it. */
|
|
2627
|
+
#leaveNotAttempted(identifier, status) {
|
|
2628
|
+
if (typeof status !== "string" || status === "not_attempted")
|
|
2629
|
+
return;
|
|
2630
|
+
const item = this.testContext.items.find((i) => i.identifier === identifier);
|
|
2631
|
+
const current = item?.variables.find((v) => v.identifier === "completionStatus");
|
|
2632
|
+
if (current?.value !== "not_attempted")
|
|
2633
|
+
return;
|
|
2634
|
+
this.testContext = {
|
|
2635
|
+
...this.testContext,
|
|
2636
|
+
items: this.testContext.items.map((i) => i.identifier !== identifier ? i : {
|
|
2637
|
+
...i,
|
|
2638
|
+
variables: i.variables.map((v) => v.identifier === "completionStatus" ? { ...v, value: status } : v)
|
|
2639
|
+
})
|
|
2640
|
+
};
|
|
2641
|
+
}
|
|
2309
2642
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2643
|
+
__decorate11([
|
|
2644
|
+
property9({ attribute: false, type: Object }),
|
|
2312
2645
|
provide({ context: testContext })
|
|
2313
2646
|
], TestBaseClass.prototype, "testContext", void 0);
|
|
2314
|
-
|
|
2315
|
-
|
|
2647
|
+
__decorate11([
|
|
2648
|
+
property9({ attribute: false, type: Object }),
|
|
2316
2649
|
provide({ context: sessionContext })
|
|
2317
2650
|
], TestBaseClass.prototype, "sessionContext", void 0);
|
|
2318
2651
|
return TestBaseClass;
|
|
2319
2652
|
};
|
|
2320
|
-
var TestBase = class extends TestBaseMixin(
|
|
2653
|
+
var TestBase = class extends TestBaseMixin(LitElement9) {
|
|
2654
|
+
};
|
|
2655
|
+
|
|
2656
|
+
// ../qti-test/dist/mixins/test-state.mixin.js
|
|
2657
|
+
var copy = (value) => Array.isArray(value) ? [...value] : value ?? null;
|
|
2658
|
+
var isQtiTestState = (value) => {
|
|
2659
|
+
const state9 = value;
|
|
2660
|
+
return state9?.version === QTI_TEST_STATE_VERSION && Array.isArray(state9.test?.items) && Array.isArray(state9.test?.outcomes) && typeof state9.session === "object" && state9.session !== null;
|
|
2661
|
+
};
|
|
2662
|
+
var toState = (test, session) => ({
|
|
2663
|
+
version: QTI_TEST_STATE_VERSION,
|
|
2664
|
+
test: {
|
|
2665
|
+
items: (test?.items ?? []).filter((item) => item.identifier).map((item) => ({
|
|
2666
|
+
identifier: item.identifier,
|
|
2667
|
+
variables: (item.variables ?? []).map((v) => ({
|
|
2668
|
+
identifier: v.identifier,
|
|
2669
|
+
...v.type ? { type: v.type } : {},
|
|
2670
|
+
value: copy(v.value)
|
|
2671
|
+
})),
|
|
2672
|
+
...item.state ? { state: { ...item.state } } : {}
|
|
2673
|
+
})),
|
|
2674
|
+
outcomes: (test?.testOutcomeVariables ?? []).map((v) => ({ identifier: v.identifier, value: copy(v.value) }))
|
|
2675
|
+
},
|
|
2676
|
+
session: {
|
|
2677
|
+
...session?.navPartId !== void 0 ? { navPartId: session.navPartId } : {},
|
|
2678
|
+
...session?.navSectionId !== void 0 ? { navSectionId: session.navSectionId } : {},
|
|
2679
|
+
...session?.navItemRefId !== void 0 ? { navItemRefId: session.navItemRefId } : {}
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
var TestStateMixin = (superClass) => {
|
|
2683
|
+
class TestStateClass extends superClass {
|
|
2684
|
+
/** A state assigned before the test connected, applied when it does. */
|
|
2685
|
+
#pending = null;
|
|
2686
|
+
/**
|
|
2687
|
+
* False while a test document is loading. Loading resets both contexts and rebuilds them, so
|
|
2688
|
+
* the intermediate states are empty — emitting one would invite a host to save it over the
|
|
2689
|
+
* real one.
|
|
2690
|
+
*/
|
|
2691
|
+
#ready = false;
|
|
2692
|
+
#lastEmitted = null;
|
|
2693
|
+
constructor(...args) {
|
|
2694
|
+
super(...args);
|
|
2695
|
+
this.addEventListener("qti-testdoc-loaded", () => {
|
|
2696
|
+
this.#ready = false;
|
|
2697
|
+
this.#lastEmitted = null;
|
|
2698
|
+
});
|
|
2699
|
+
listenPublic2(this, "cito-test-loaded", () => {
|
|
2700
|
+
if (this.#pending) {
|
|
2701
|
+
this.#apply(this.#pending);
|
|
2702
|
+
this.#pending = null;
|
|
2703
|
+
}
|
|
2704
|
+
this.#ready = true;
|
|
2705
|
+
});
|
|
2706
|
+
}
|
|
2707
|
+
get state() {
|
|
2708
|
+
return toState(this.testContext, this.sessionContext);
|
|
2709
|
+
}
|
|
2710
|
+
set state(value) {
|
|
2711
|
+
if (!isQtiTestState(value)) {
|
|
2712
|
+
console.warn(`[qti-test] Ignoring a state that is not a version ${QTI_TEST_STATE_VERSION} QtiTestState.`);
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2715
|
+
if (!this.#ready) {
|
|
2716
|
+
this.#pending = value;
|
|
2717
|
+
return;
|
|
2718
|
+
}
|
|
2719
|
+
const { navItemRefId, navSectionId } = this.sessionContext;
|
|
2720
|
+
this.#apply(value);
|
|
2721
|
+
const restored = this.sessionContext;
|
|
2722
|
+
if (restored.navItemRefId && restored.navItemRefId !== navItemRefId) {
|
|
2723
|
+
this.#requestNavigation("item", restored.navItemRefId);
|
|
2724
|
+
} else if (!restored.navItemRefId && restored.navSectionId && restored.navSectionId !== navSectionId) {
|
|
2725
|
+
this.#requestNavigation("section", restored.navSectionId);
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
updated(changed) {
|
|
2729
|
+
super.updated(changed);
|
|
2730
|
+
if (!this.#ready || !(changed.has("testContext") || changed.has("sessionContext")))
|
|
2731
|
+
return;
|
|
2732
|
+
const state9 = this.state;
|
|
2733
|
+
const serialized = JSON.stringify(state9);
|
|
2734
|
+
if (serialized === this.#lastEmitted)
|
|
2735
|
+
return;
|
|
2736
|
+
this.#lastEmitted = serialized;
|
|
2737
|
+
dispatchPublic(this, "cito-test-state-changed", state9);
|
|
2738
|
+
}
|
|
2739
|
+
#apply(state9) {
|
|
2740
|
+
for (const saved of state9.test.items)
|
|
2741
|
+
this.updateItemVariables(saved.identifier, saved.variables, saved.state);
|
|
2742
|
+
const savedOutcomes = new Map(state9.test.outcomes.map((outcome) => [outcome.identifier, outcome.value]));
|
|
2743
|
+
this.testContext = {
|
|
2744
|
+
...this.testContext,
|
|
2745
|
+
testOutcomeVariables: this.testContext.testOutcomeVariables?.map((v) => savedOutcomes.has(v.identifier) ? { ...v, value: copy(savedOutcomes.get(v.identifier)) } : v)
|
|
2746
|
+
};
|
|
2747
|
+
this.sessionContext = { ...this.sessionContext, ...this.#validSession(state9.session) };
|
|
2748
|
+
}
|
|
2749
|
+
/** A stored position may point at an item or section a revised test no longer has. */
|
|
2750
|
+
#validSession(session) {
|
|
2751
|
+
const exists = (selector, id) => !!id && !!this._testElement?.querySelector(`${selector}[identifier="${CSS.escape(id)}"]`);
|
|
2752
|
+
return {
|
|
2753
|
+
...exists("qti-test-part", session.navPartId) ? { navPartId: session.navPartId } : {},
|
|
2754
|
+
...exists("qti-assessment-section", session.navSectionId) ? { navSectionId: session.navSectionId } : {},
|
|
2755
|
+
...this.testContext.items.some((i) => i.identifier === session.navItemRefId) ? { navItemRefId: session.navItemRefId } : {}
|
|
2756
|
+
};
|
|
2757
|
+
}
|
|
2758
|
+
#requestNavigation(type, id) {
|
|
2759
|
+
dispatchPublic(this, "cito-test-navigate", { type, id });
|
|
2760
|
+
}
|
|
2761
|
+
}
|
|
2762
|
+
return TestStateClass;
|
|
2321
2763
|
};
|
|
2322
2764
|
|
|
2323
2765
|
// ../qti-test/dist/mixins/test-processing.mixin.js
|
|
@@ -2339,12 +2781,21 @@ var TestProcessingMixin = (superClass) => {
|
|
|
2339
2781
|
});
|
|
2340
2782
|
}
|
|
2341
2783
|
outcomeProcessing() {
|
|
2342
|
-
const outcomeProcessor = this.querySelector("qti-outcome-processing");
|
|
2784
|
+
const outcomeProcessor = (this._testElement ?? this).querySelector("qti-outcome-processing");
|
|
2343
2785
|
if (!outcomeProcessor)
|
|
2344
2786
|
return false;
|
|
2345
2787
|
outcomeProcessor?.process();
|
|
2346
2788
|
return true;
|
|
2347
2789
|
}
|
|
2790
|
+
/**
|
|
2791
|
+
* The `qti-test-feedback` elements that apply now, read from the test outcomes: run
|
|
2792
|
+
* `outcomeProcessing()` first. `access` narrows them to the end of the test (`atEnd`) or to
|
|
2793
|
+
* while it runs (`during`); without it, both.
|
|
2794
|
+
*/
|
|
2795
|
+
getTestFeedback(access) {
|
|
2796
|
+
const feedback = Array.from((this._testElement ?? this).querySelectorAll("qti-test-feedback") ?? []);
|
|
2797
|
+
return feedback.filter((fb) => (!access || fb.access === access) && fb.matches(this.getOutcome(fb.outcomeIdentifier)?.value));
|
|
2798
|
+
}
|
|
2348
2799
|
/* --------------------------- ENABLED WHEN UNIT TESTING OUTCOME PROCESSING ------------------------------------ */
|
|
2349
2800
|
updateOutcomeVariable(identifier, value) {
|
|
2350
2801
|
const outcomeVariable = this.getOutcome(identifier);
|
|
@@ -2376,16 +2827,26 @@ var TestProcessingMixin = (superClass) => {
|
|
|
2376
2827
|
};
|
|
2377
2828
|
|
|
2378
2829
|
// ../qti-test/dist/components/qti-test/qti-test.js
|
|
2379
|
-
var
|
|
2830
|
+
var __decorate12 = function(decorators, target, key, desc) {
|
|
2380
2831
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2381
2832
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2382
2833
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2383
2834
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2384
2835
|
};
|
|
2385
|
-
var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixin(TestBaseMixin(
|
|
2836
|
+
var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixin(TestStateMixin(TestBaseMixin(LitElement10))))) {
|
|
2837
|
+
// TODO: Properly implement IQtiTest interface
|
|
2838
|
+
// export class QtiTest extends TestLoaderMixin(TestNavigationMixin(TestViewMixin(TestBase))) {
|
|
2386
2839
|
constructor() {
|
|
2387
|
-
super(
|
|
2840
|
+
super();
|
|
2388
2841
|
this.configContext = {};
|
|
2842
|
+
this.qtiContext = {
|
|
2843
|
+
QTI_CONTEXT: {
|
|
2844
|
+
testIdentifier: "",
|
|
2845
|
+
candidateIdentifier: "",
|
|
2846
|
+
environmentIdentifier: "default"
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
2849
|
+
new ContextProvider(this, { context: testHostContext, initialValue: this });
|
|
2389
2850
|
}
|
|
2390
2851
|
/**
|
|
2391
2852
|
* Renders the component's template.
|
|
@@ -2397,20 +2858,25 @@ var QtiTest = class extends TestNavigationMixin(TestViewMixin(TestProcessingMixi
|
|
|
2397
2858
|
this.dispatchEvent(new CustomEvent("qti-test-connected", { detail: this }));
|
|
2398
2859
|
}
|
|
2399
2860
|
render() {
|
|
2400
|
-
return
|
|
2861
|
+
return html9`<slot></slot>`;
|
|
2401
2862
|
}
|
|
2402
2863
|
};
|
|
2403
|
-
|
|
2864
|
+
__decorate12([
|
|
2404
2865
|
state2(),
|
|
2405
2866
|
provide2({ context: configContext })
|
|
2406
2867
|
], QtiTest.prototype, "configContext", void 0);
|
|
2868
|
+
__decorate12([
|
|
2869
|
+
state2(),
|
|
2870
|
+
provide2({ context: qtiContext })
|
|
2871
|
+
], QtiTest.prototype, "qtiContext", void 0);
|
|
2407
2872
|
|
|
2408
2873
|
// ../qti-test/dist/components/test-check-item/test-check-item.js
|
|
2409
|
-
import {
|
|
2874
|
+
import { consume as consume6 } from "@lit/context";
|
|
2875
|
+
import { css as css6, html as html10, LitElement as LitElement11 } from "lit";
|
|
2410
2876
|
|
|
2411
2877
|
// ../qti-test/dist/components/styles.js
|
|
2412
|
-
import { css as
|
|
2413
|
-
var form =
|
|
2878
|
+
import { css as css5 } from "lit";
|
|
2879
|
+
var form = css5`
|
|
2414
2880
|
display: inline-flex;
|
|
2415
2881
|
align-items: center;
|
|
2416
2882
|
justify-content: center;
|
|
@@ -2424,33 +2890,39 @@ var form = css3`
|
|
|
2424
2890
|
user-select: none;
|
|
2425
2891
|
border-radius: var(--test-button-border-radius, var(--qti-component-border-radius, 0.2rem));
|
|
2426
2892
|
`;
|
|
2427
|
-
var btn =
|
|
2893
|
+
var btn = css5`
|
|
2428
2894
|
${form};
|
|
2429
2895
|
background-color: var(--test-button-background-color, var(--qti-component-background-color, #fff));
|
|
2430
2896
|
color: var(--test-button-color, var(--qti-component-color, inherit));
|
|
2431
2897
|
border: var(--qti-component-border-width, 1px) var(--qti-component-border-style, solid)
|
|
2432
2898
|
var(--test-button-border-color, var(--qti-component-border-color, #0175aa));
|
|
2433
2899
|
`;
|
|
2434
|
-
var btnInteractive =
|
|
2900
|
+
var btnInteractive = css5`
|
|
2435
2901
|
background-color: var(--test-button-hover-background-color, var(--qti-bg-active, #f2f8fb));
|
|
2436
2902
|
`;
|
|
2437
|
-
var focusRing =
|
|
2903
|
+
var focusRing = css5`
|
|
2438
2904
|
outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, #007ac3);
|
|
2439
2905
|
outline-offset: 2px;
|
|
2440
2906
|
`;
|
|
2441
|
-
var dis =
|
|
2907
|
+
var dis = css5`
|
|
2442
2908
|
cursor: not-allowed;
|
|
2443
2909
|
opacity: 0.45;
|
|
2444
2910
|
`;
|
|
2445
|
-
var ind =
|
|
2911
|
+
var ind = css5`
|
|
2446
2912
|
${form};
|
|
2447
2913
|
border: 1px solid gray;
|
|
2448
2914
|
`;
|
|
2449
2915
|
|
|
2450
2916
|
// ../qti-test/dist/components/test-check-item/test-check-item.js
|
|
2451
|
-
var
|
|
2917
|
+
var __decorate13 = function(decorators, target, key, desc) {
|
|
2918
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2919
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2920
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2921
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2922
|
+
};
|
|
2923
|
+
var TestCheckItem = class extends LitElement11 {
|
|
2452
2924
|
static {
|
|
2453
|
-
this.styles =
|
|
2925
|
+
this.styles = css6`
|
|
2454
2926
|
:host {
|
|
2455
2927
|
${btn};
|
|
2456
2928
|
}
|
|
@@ -2468,9 +2940,10 @@ var TestCheckItem = class extends LitElement9 {
|
|
|
2468
2940
|
constructor() {
|
|
2469
2941
|
super();
|
|
2470
2942
|
this.addEventListener("click", () => {
|
|
2471
|
-
this
|
|
2472
|
-
const
|
|
2473
|
-
|
|
2943
|
+
dispatchPublic(this, "cito-test-end-attempt", {});
|
|
2944
|
+
const testContainer = this.testHost?.querySelector("test-container");
|
|
2945
|
+
if (!testContainer)
|
|
2946
|
+
return;
|
|
2474
2947
|
const viewElements = Array.from(testContainer.shadowRoot.querySelectorAll("[view]"));
|
|
2475
2948
|
viewElements.forEach((element) => {
|
|
2476
2949
|
element.classList.toggle("show", true);
|
|
@@ -2478,22 +2951,25 @@ var TestCheckItem = class extends LitElement9 {
|
|
|
2478
2951
|
});
|
|
2479
2952
|
}
|
|
2480
2953
|
render() {
|
|
2481
|
-
return
|
|
2954
|
+
return html10` <slot></slot> `;
|
|
2482
2955
|
}
|
|
2483
2956
|
};
|
|
2957
|
+
__decorate13([
|
|
2958
|
+
consume6({ context: testHostContext, subscribe: true })
|
|
2959
|
+
], TestCheckItem.prototype, "testHost", void 0);
|
|
2484
2960
|
|
|
2485
2961
|
// ../qti-test/dist/components/test-container/test-container.js
|
|
2486
|
-
import { consume as
|
|
2487
|
-
import { LitElement as
|
|
2488
|
-
import { property as
|
|
2962
|
+
import { consume as consume7 } from "@lit/context";
|
|
2963
|
+
import { LitElement as LitElement12, html as html11 } from "lit";
|
|
2964
|
+
import { property as property10, state as state3 } from "lit/decorators.js";
|
|
2489
2965
|
import { until } from "lit/directives/until.js";
|
|
2490
|
-
var
|
|
2966
|
+
var __decorate14 = function(decorators, target, key, desc) {
|
|
2491
2967
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2492
2968
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2493
2969
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2494
2970
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2495
2971
|
};
|
|
2496
|
-
var TestContainer = class extends
|
|
2972
|
+
var TestContainer = class extends LitElement12 {
|
|
2497
2973
|
constructor() {
|
|
2498
2974
|
super(...arguments);
|
|
2499
2975
|
this.customElementRegistry = null;
|
|
@@ -2525,7 +3001,7 @@ var TestContainer = class extends LitElement10 {
|
|
|
2525
3001
|
try {
|
|
2526
3002
|
const explicitSeed = this.qtiContext?.QTI_CONTEXT?.seed;
|
|
2527
3003
|
let api = (await qtiTransformTest().load(this.testURL)).shuffleOrdering(explicitSeed);
|
|
2528
|
-
const qtiTest = this.
|
|
3004
|
+
const qtiTest = this.testHost;
|
|
2529
3005
|
if (qtiTest?.postLoadTestTransformCallback) {
|
|
2530
3006
|
const tempDoc = api.htmlDoc(this.#resolvedCustomElementRegistry ?? void 0);
|
|
2531
3007
|
const testElement = tempDoc.querySelector("qti-assessment-test");
|
|
@@ -2578,7 +3054,7 @@ var TestContainer = class extends LitElement10 {
|
|
|
2578
3054
|
}
|
|
2579
3055
|
#initializeTemplateContent() {
|
|
2580
3056
|
const template = this.querySelector("template");
|
|
2581
|
-
this.#templateContent = template ? template.content :
|
|
3057
|
+
this.#templateContent = template ? template.content : html11``;
|
|
2582
3058
|
}
|
|
2583
3059
|
#applyStyles() {
|
|
2584
3060
|
const sheet = new CSSStyleSheet();
|
|
@@ -2586,54 +3062,57 @@ var TestContainer = class extends LitElement10 {
|
|
|
2586
3062
|
this.shadowRoot.adoptedStyleSheets = [sheet];
|
|
2587
3063
|
}
|
|
2588
3064
|
render() {
|
|
2589
|
-
return
|
|
3065
|
+
return html11`
|
|
2590
3066
|
${this.#templateContent}
|
|
2591
3067
|
<slot></slot>
|
|
2592
|
-
${until(this.testDoc,
|
|
3068
|
+
${until(this.testDoc, html11`<span>Loading...</span>`)}
|
|
2593
3069
|
`;
|
|
2594
3070
|
}
|
|
2595
3071
|
};
|
|
2596
|
-
|
|
2597
|
-
|
|
3072
|
+
__decorate14([
|
|
3073
|
+
property10({ attribute: false })
|
|
2598
3074
|
], TestContainer.prototype, "customElementRegistry", void 0);
|
|
2599
|
-
|
|
2600
|
-
|
|
3075
|
+
__decorate14([
|
|
3076
|
+
property10({ type: String, attribute: "test-url" })
|
|
2601
3077
|
], TestContainer.prototype, "testURL", void 0);
|
|
2602
|
-
|
|
3078
|
+
__decorate14([
|
|
2603
3079
|
state3()
|
|
2604
3080
|
], TestContainer.prototype, "testDoc", void 0);
|
|
2605
|
-
|
|
3081
|
+
__decorate14([
|
|
2606
3082
|
state3()
|
|
2607
3083
|
], TestContainer.prototype, "testXML", void 0);
|
|
2608
|
-
|
|
3084
|
+
__decorate14([
|
|
3085
|
+
consume7({ context: testHostContext, subscribe: true })
|
|
3086
|
+
], TestContainer.prototype, "testHost", void 0);
|
|
3087
|
+
__decorate14([
|
|
2609
3088
|
state3(),
|
|
2610
|
-
|
|
3089
|
+
consume7({ context: qtiContext, subscribe: true })
|
|
2611
3090
|
], TestContainer.prototype, "qtiContext", void 0);
|
|
2612
|
-
|
|
3091
|
+
__decorate14([
|
|
2613
3092
|
watch("testURL", { waitUntilFirstUpdate: true })
|
|
2614
3093
|
], TestContainer.prototype, "handleTestURLChange", null);
|
|
2615
|
-
|
|
3094
|
+
__decorate14([
|
|
2616
3095
|
watch("testXML", { waitUntilFirstUpdate: true })
|
|
2617
3096
|
], TestContainer.prototype, "handleTestXMLChange", null);
|
|
2618
3097
|
|
|
2619
3098
|
// ../qti-test/dist/components/test-end-attempt/test-end-attempt.js
|
|
2620
|
-
import { css as
|
|
2621
|
-
import { property as
|
|
2622
|
-
import { consume as
|
|
2623
|
-
var
|
|
3099
|
+
import { css as css7, html as html12, LitElement as LitElement13 } from "lit";
|
|
3100
|
+
import { property as property11 } from "lit/decorators.js";
|
|
3101
|
+
import { consume as consume8 } from "@lit/context";
|
|
3102
|
+
var __decorate15 = function(decorators, target, key, desc) {
|
|
2624
3103
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2625
3104
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2626
3105
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2627
3106
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2628
3107
|
};
|
|
2629
|
-
var TestEndAttempt = class extends
|
|
3108
|
+
var TestEndAttempt = class extends LitElement13 {
|
|
2630
3109
|
_handleTestElementChange(_oldValue, newValue) {
|
|
2631
3110
|
if (newValue) {
|
|
2632
3111
|
this.requestUpdate();
|
|
2633
3112
|
}
|
|
2634
3113
|
}
|
|
2635
3114
|
static {
|
|
2636
|
-
this.styles =
|
|
3115
|
+
this.styles = css7`
|
|
2637
3116
|
:host {
|
|
2638
3117
|
${btn};
|
|
2639
3118
|
}
|
|
@@ -2654,7 +3133,7 @@ var TestEndAttempt = class extends LitElement11 {
|
|
|
2654
3133
|
this.addEventListener("click", (e) => {
|
|
2655
3134
|
e.preventDefault();
|
|
2656
3135
|
if (!this._internalDisabled) {
|
|
2657
|
-
this
|
|
3136
|
+
dispatchPublic(this, "cito-test-end-attempt", {});
|
|
2658
3137
|
}
|
|
2659
3138
|
});
|
|
2660
3139
|
}
|
|
@@ -2678,6 +3157,10 @@ var TestEndAttempt = class extends LitElement11 {
|
|
|
2678
3157
|
this._internalDisabled = true;
|
|
2679
3158
|
return;
|
|
2680
3159
|
}
|
|
3160
|
+
if (activeItem.adaptive && activeItem.completionStatus === "completed") {
|
|
3161
|
+
this._internalDisabled = true;
|
|
3162
|
+
return;
|
|
3163
|
+
}
|
|
2681
3164
|
if (!activeItem.adaptive && maxAttempts > 0 && numAttempts >= maxAttempts) {
|
|
2682
3165
|
this._internalDisabled = true;
|
|
2683
3166
|
return;
|
|
@@ -2689,32 +3172,32 @@ var TestEndAttempt = class extends LitElement11 {
|
|
|
2689
3172
|
}
|
|
2690
3173
|
}
|
|
2691
3174
|
render() {
|
|
2692
|
-
return
|
|
3175
|
+
return html12` <slot></slot> `;
|
|
2693
3176
|
}
|
|
2694
3177
|
};
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
3178
|
+
__decorate15([
|
|
3179
|
+
consume8({ context: computedContext, subscribe: true }),
|
|
3180
|
+
property11({ attribute: false })
|
|
2698
3181
|
], TestEndAttempt.prototype, "computedContext", void 0);
|
|
2699
|
-
|
|
2700
|
-
|
|
3182
|
+
__decorate15([
|
|
3183
|
+
property11({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
2701
3184
|
], TestEndAttempt.prototype, "_internalDisabled", void 0);
|
|
2702
|
-
|
|
3185
|
+
__decorate15([
|
|
2703
3186
|
watch("computedContext")
|
|
2704
3187
|
], TestEndAttempt.prototype, "_handleTestElementChange", null);
|
|
2705
3188
|
|
|
2706
3189
|
// ../qti-test/dist/components/test-item-link/test-item-link.js
|
|
2707
|
-
import { css as
|
|
2708
|
-
import { property as
|
|
2709
|
-
var
|
|
3190
|
+
import { css as css8, html as html13, LitElement as LitElement14 } from "lit";
|
|
3191
|
+
import { property as property12 } from "lit/decorators.js";
|
|
3192
|
+
var __decorate16 = function(decorators, target, key, desc) {
|
|
2710
3193
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2711
3194
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2712
3195
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2713
3196
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2714
3197
|
};
|
|
2715
|
-
var TestItemLink = class extends
|
|
3198
|
+
var TestItemLink = class extends LitElement14 {
|
|
2716
3199
|
static {
|
|
2717
|
-
this.styles =
|
|
3200
|
+
this.styles = css8`
|
|
2718
3201
|
:host {
|
|
2719
3202
|
${btn};
|
|
2720
3203
|
}
|
|
@@ -2735,29 +3218,22 @@ var TestItemLink = class extends LitElement12 {
|
|
|
2735
3218
|
this.addEventListener("click", () => this._requestItem(this.itemId));
|
|
2736
3219
|
}
|
|
2737
3220
|
_requestItem(identifier) {
|
|
2738
|
-
this
|
|
2739
|
-
composed: true,
|
|
2740
|
-
bubbles: true,
|
|
2741
|
-
detail: {
|
|
2742
|
-
type: "item",
|
|
2743
|
-
id: identifier
|
|
2744
|
-
}
|
|
2745
|
-
}));
|
|
3221
|
+
dispatchPublic(this, "cito-test-navigate", { type: "item", id: identifier });
|
|
2746
3222
|
}
|
|
2747
3223
|
render() {
|
|
2748
|
-
return
|
|
3224
|
+
return html13` <slot></slot> `;
|
|
2749
3225
|
}
|
|
2750
3226
|
};
|
|
2751
|
-
|
|
2752
|
-
|
|
3227
|
+
__decorate16([
|
|
3228
|
+
property12({ type: String, attribute: "item-id" })
|
|
2753
3229
|
], TestItemLink.prototype, "itemId", void 0);
|
|
2754
3230
|
|
|
2755
3231
|
// ../qti-test/dist/components/test-item-to-speech/test-item-to-speech.js
|
|
2756
|
-
import { html as
|
|
2757
|
-
import { consume as
|
|
2758
|
-
import { property as
|
|
3232
|
+
import { html as html14, LitElement as LitElement15, css as css9 } from "lit";
|
|
3233
|
+
import { consume as consume9, provide as provide3, createContext as createContext2 } from "@lit/context";
|
|
3234
|
+
import { property as property13, state as state4 } from "lit/decorators.js";
|
|
2759
3235
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
2760
|
-
var
|
|
3236
|
+
var __decorate17 = function(decorators, target, key, desc) {
|
|
2761
3237
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2762
3238
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2763
3239
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -2776,7 +3252,7 @@ function getHighlightSheet() {
|
|
|
2776
3252
|
}
|
|
2777
3253
|
return highlightSheet;
|
|
2778
3254
|
}
|
|
2779
|
-
var ttsContext =
|
|
3255
|
+
var ttsContext = createContext2(/* @__PURE__ */ Symbol("tts-context"));
|
|
2780
3256
|
var ICONS = {
|
|
2781
3257
|
play: "M8 5v14l11-7z",
|
|
2782
3258
|
pause: "M6 5h4v14H6zM14 5h4v14h-4z",
|
|
@@ -2785,11 +3261,15 @@ var ICONS = {
|
|
|
2785
3261
|
next: "M16 5h2v14h-2zM4 5v14l11-7z",
|
|
2786
3262
|
pick: "M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"
|
|
2787
3263
|
};
|
|
2788
|
-
var iconContent = (icon, label) =>
|
|
2789
|
-
|
|
2790
|
-
|
|
3264
|
+
var iconContent = (icon, label) => {
|
|
3265
|
+
const svg = html14`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
3266
|
+
<path d="${ICONS[icon]}"></path>
|
|
3267
|
+
</svg>`;
|
|
3268
|
+
return html14`${svg}<span class="label">${label}</span>`;
|
|
3269
|
+
};
|
|
3270
|
+
var TtsButtonBase = class extends LitElement15 {
|
|
2791
3271
|
static {
|
|
2792
|
-
this.styles =
|
|
3272
|
+
this.styles = css9`
|
|
2793
3273
|
:host {
|
|
2794
3274
|
display: inline-flex;
|
|
2795
3275
|
}
|
|
@@ -2797,6 +3277,10 @@ var TtsButtonBase = class extends LitElement13 {
|
|
|
2797
3277
|
${btn};
|
|
2798
3278
|
min-inline-size: var(--test-button-size, 2.25rem);
|
|
2799
3279
|
padding-inline: 0.5rem;
|
|
3280
|
+
/* Containing block for the visually hidden .label. Without it the label is placed against
|
|
3281
|
+
the nearest positioned ancestor, which can sit outside a scroll container and make the
|
|
3282
|
+
page as tall as the scrolled content. */
|
|
3283
|
+
position: relative;
|
|
2800
3284
|
}
|
|
2801
3285
|
button:hover:not(:disabled) {
|
|
2802
3286
|
${btnInteractive};
|
|
@@ -2849,15 +3333,15 @@ var TtsButtonBase = class extends LitElement13 {
|
|
|
2849
3333
|
this.#internals.states.add("picking");
|
|
2850
3334
|
}
|
|
2851
3335
|
};
|
|
2852
|
-
|
|
2853
|
-
|
|
3336
|
+
__decorate17([
|
|
3337
|
+
property13({ type: String })
|
|
2854
3338
|
], TtsButtonBase.prototype, "label", void 0);
|
|
2855
|
-
|
|
2856
|
-
|
|
3339
|
+
__decorate17([
|
|
3340
|
+
consume9({ context: ttsContext, subscribe: true })
|
|
2857
3341
|
], TtsButtonBase.prototype, "_tts", void 0);
|
|
2858
|
-
var TestItemToSpeech = class extends
|
|
3342
|
+
var TestItemToSpeech = class extends LitElement15 {
|
|
2859
3343
|
static {
|
|
2860
|
-
this.styles =
|
|
3344
|
+
this.styles = css9`
|
|
2861
3345
|
:host {
|
|
2862
3346
|
display: inline-flex;
|
|
2863
3347
|
flex-wrap: wrap;
|
|
@@ -2867,10 +3351,24 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
2867
3351
|
`;
|
|
2868
3352
|
}
|
|
2869
3353
|
#internals;
|
|
2870
|
-
|
|
2871
|
-
|
|
3354
|
+
// Stimulus mode: set on connect when a stimulus placeholder sits next to the player. The
|
|
3355
|
+
// placeholder itself is looked up on every use — a host may swap the element.
|
|
3356
|
+
#stimulusMode;
|
|
3357
|
+
// Stimulus mode: resets the player when the stimulus content next to it is replaced.
|
|
3358
|
+
#stimulusObserver;
|
|
3359
|
+
// Content mode: set on connect when a `[data-tts-content]` element sits next to the player.
|
|
3360
|
+
// Any HTML, not QTI. No observer: the reading list is rebuilt on demand (#getReadingElements).
|
|
3361
|
+
#contentMode;
|
|
3362
|
+
// Item-ref mode: the item-ref this player sits in, resolved on connect. Null means cursor mode.
|
|
3363
|
+
#itemRef;
|
|
3364
|
+
// Where the item-connected (and, in cursor mode, navigation) events are listened for.
|
|
2872
3365
|
#eventHost;
|
|
2873
|
-
|
|
3366
|
+
#boundHandleItemConnected;
|
|
3367
|
+
#boundHandleNavigation;
|
|
3368
|
+
// Cursor mode: the previous navigation position, to detect moving to another item or section.
|
|
3369
|
+
#prevNavItemRefId;
|
|
3370
|
+
#prevNavSectionId;
|
|
3371
|
+
// Current set of block-level reading elements for the item
|
|
2874
3372
|
#readingElements;
|
|
2875
3373
|
#currentElementIndex;
|
|
2876
3374
|
// Text nodes of the element currently being spoken (for word-boundary highlight)
|
|
@@ -2890,17 +3388,19 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
2890
3388
|
// whole-element cursor
|
|
2891
3389
|
#wordHighlight;
|
|
2892
3390
|
// current word during speech
|
|
2893
|
-
// Tracks previous navItemRefId to detect item switches
|
|
2894
|
-
#prevNavItemRefId;
|
|
2895
|
-
#prevNavSectionId;
|
|
2896
|
-
#boundHandleNavigation;
|
|
2897
3391
|
constructor() {
|
|
2898
3392
|
super();
|
|
2899
3393
|
this.language = "nl-NL";
|
|
2900
3394
|
this.#internals = this.attachInternals();
|
|
2901
|
-
this.#
|
|
2902
|
-
this.#
|
|
3395
|
+
this.#stimulusMode = false;
|
|
3396
|
+
this.#stimulusObserver = null;
|
|
3397
|
+
this.#contentMode = false;
|
|
3398
|
+
this.#itemRef = null;
|
|
2903
3399
|
this.#eventHost = null;
|
|
3400
|
+
this.#boundHandleItemConnected = this.#handleItemConnected.bind(this);
|
|
3401
|
+
this.#boundHandleNavigation = () => this.#stop();
|
|
3402
|
+
this.#prevNavItemRefId = void 0;
|
|
3403
|
+
this.#prevNavSectionId = void 0;
|
|
2904
3404
|
this.#readingElements = null;
|
|
2905
3405
|
this.#currentElementIndex = 0;
|
|
2906
3406
|
this.#textNodes = [];
|
|
@@ -2911,9 +3411,6 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
2911
3411
|
this.#finished = false;
|
|
2912
3412
|
this.#elementHighlight = new Highlight();
|
|
2913
3413
|
this.#wordHighlight = new Highlight();
|
|
2914
|
-
this.#prevNavItemRefId = void 0;
|
|
2915
|
-
this.#prevNavSectionId = void 0;
|
|
2916
|
-
this.#boundHandleNavigation = () => this.#stop();
|
|
2917
3414
|
this._ttsContext = {
|
|
2918
3415
|
state: "idle",
|
|
2919
3416
|
currentElementIndex: 0,
|
|
@@ -2931,21 +3428,19 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
2931
3428
|
picking: false
|
|
2932
3429
|
};
|
|
2933
3430
|
}
|
|
3431
|
+
// willUpdate, not updated: resetting writes _ttsContext, and state set here goes into the
|
|
3432
|
+
// render already under way instead of scheduling a second one (Lit's change-in-update).
|
|
2934
3433
|
willUpdate(changed) {
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
this.#resetReadingPosition();
|
|
2940
|
-
}
|
|
2941
|
-
const current = this._sessionContext?.navItemRefId ?? null;
|
|
3434
|
+
super.willUpdate(changed);
|
|
3435
|
+
if (this.#stimulusMode || this.#contentMode || this.#itemRef)
|
|
3436
|
+
return;
|
|
3437
|
+
const item = this._sessionContext?.navItemRefId ?? null;
|
|
2942
3438
|
const section = this._sessionContext?.navSectionId ?? null;
|
|
2943
|
-
const itemChanged = this.#prevNavItemRefId !== void 0 && this.#prevNavItemRefId !==
|
|
3439
|
+
const itemChanged = this.#prevNavItemRefId !== void 0 && this.#prevNavItemRefId !== item;
|
|
2944
3440
|
const sectionChanged = this.#prevNavSectionId !== void 0 && this.#prevNavSectionId !== section;
|
|
2945
|
-
if (
|
|
3441
|
+
if (itemChanged || sectionChanged)
|
|
2946
3442
|
this.#resetReadingPosition();
|
|
2947
|
-
|
|
2948
|
-
this.#prevNavItemRefId = current;
|
|
3443
|
+
this.#prevNavItemRefId = item;
|
|
2949
3444
|
this.#prevNavSectionId = section;
|
|
2950
3445
|
}
|
|
2951
3446
|
/** Stop speech and forget the collected reading elements, so the next play starts afresh. */
|
|
@@ -2960,9 +3455,25 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
2960
3455
|
connectedCallback() {
|
|
2961
3456
|
super.connectedCallback();
|
|
2962
3457
|
this.#setSpeechState("idle");
|
|
2963
|
-
this.#
|
|
3458
|
+
this.#stimulusMode = this.#stimulusPlaceholder() !== null;
|
|
3459
|
+
if (this.#stimulusMode) {
|
|
3460
|
+
this.#stimulusObserver = new MutationObserver((records) => {
|
|
3461
|
+
if (records.some((record) => !this.contains(record.target)))
|
|
3462
|
+
this.#handleStimulusReplaced();
|
|
3463
|
+
});
|
|
3464
|
+
this.#stimulusObserver.observe(this.parentElement, { childList: true, subtree: true });
|
|
3465
|
+
return;
|
|
3466
|
+
}
|
|
3467
|
+
this.#contentMode = this.#contentElement() !== null;
|
|
3468
|
+
if (this.#contentMode)
|
|
3469
|
+
return;
|
|
3470
|
+
this.#itemRef = this.closest("qti-assessment-item-ref");
|
|
3471
|
+
this.#eventHost = this.#itemRef ?? this.closest("test-navigation") ?? this.testHost ?? this.getRootNode();
|
|
2964
3472
|
this.#eventHost.addEventListener("qti-assessment-item-connected", this.#boundHandleItemConnected);
|
|
2965
|
-
|
|
3473
|
+
if (!this.#itemRef) {
|
|
3474
|
+
this.#eventHost.addEventListener("cito-test-navigate", this.#boundHandleNavigation);
|
|
3475
|
+
this.#eventHost.addEventListener("qti-request-navigation", this.#boundHandleNavigation);
|
|
3476
|
+
}
|
|
2966
3477
|
}
|
|
2967
3478
|
disconnectedCallback() {
|
|
2968
3479
|
super.disconnectedCallback();
|
|
@@ -2973,53 +3484,114 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
2973
3484
|
this.#stopPicking();
|
|
2974
3485
|
this.#clearAllHighlights();
|
|
2975
3486
|
this.#eventHost?.removeEventListener("qti-assessment-item-connected", this.#boundHandleItemConnected);
|
|
3487
|
+
this.#eventHost?.removeEventListener("cito-test-navigate", this.#boundHandleNavigation);
|
|
2976
3488
|
this.#eventHost?.removeEventListener("qti-request-navigation", this.#boundHandleNavigation);
|
|
2977
3489
|
this.#eventHost = null;
|
|
2978
|
-
this.#
|
|
3490
|
+
this.#itemRef = null;
|
|
3491
|
+
this.#stimulusObserver?.disconnect();
|
|
3492
|
+
this.#stimulusObserver = null;
|
|
3493
|
+
this.#stimulusMode = false;
|
|
3494
|
+
this.#contentMode = false;
|
|
2979
3495
|
}
|
|
2980
3496
|
render() {
|
|
2981
|
-
return
|
|
3497
|
+
return html14`<slot></slot>`;
|
|
2982
3498
|
}
|
|
3499
|
+
/**
|
|
3500
|
+
* An item (re)rendered. If it is ours — e.g. after navigating to the item already shown — the
|
|
3501
|
+
* elements collected earlier are detached now. That does not move the navigation cursor, so
|
|
3502
|
+
* the check in updated() does not catch it.
|
|
3503
|
+
*/
|
|
2983
3504
|
#handleItemConnected(event) {
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
3505
|
+
if (this.#readingElements === null)
|
|
3506
|
+
return;
|
|
3507
|
+
const identifier = event.detail?.identifier;
|
|
3508
|
+
if (this.#itemRef || identifier === this._sessionContext?.navItemRefId)
|
|
3509
|
+
this.#resetReadingPosition();
|
|
3510
|
+
}
|
|
3511
|
+
/**
|
|
3512
|
+
* Stimulus mode: the stimulus next to the player was (re)loaded or swapped. Forget what was
|
|
3513
|
+
* collected, so the next play reads the new content from the top. Unlike
|
|
3514
|
+
* #resetReadingPosition this only cancels speech that is ours: a stimulus can finish loading
|
|
3515
|
+
* while an item player on the same page is speaking.
|
|
3516
|
+
*/
|
|
3517
|
+
#handleStimulusReplaced() {
|
|
3518
|
+
if (this.#currentUtterance) {
|
|
3519
|
+
this.#currentUtterance = null;
|
|
3520
|
+
speechSynthesis.cancel();
|
|
2990
3521
|
}
|
|
3522
|
+
this.#stopPicking();
|
|
3523
|
+
this.#clearAllHighlights();
|
|
3524
|
+
this.#setSpeechState("idle");
|
|
3525
|
+
this.#readingElements = null;
|
|
3526
|
+
this.#currentElementIndex = 0;
|
|
3527
|
+
this.#finished = false;
|
|
3528
|
+
this.#updateContext();
|
|
3529
|
+
}
|
|
3530
|
+
/**
|
|
3531
|
+
* Stimulus mode: the `[data-stimulus-idref]` placeholder that shares this player's parent, or
|
|
3532
|
+
* null. A placeholder holds the stimulus once loaded; the player cannot sit inside it, because
|
|
3533
|
+
* loading replaces the placeholder's content.
|
|
3534
|
+
*/
|
|
3535
|
+
#stimulusPlaceholder() {
|
|
3536
|
+
return this.parentElement?.querySelector(":scope > [data-stimulus-idref]") ?? null;
|
|
3537
|
+
}
|
|
3538
|
+
/**
|
|
3539
|
+
* Content mode: the `[data-tts-content]` element that shares this player's parent, or null.
|
|
3540
|
+
* The marker goes on one container; the player finds the readable elements inside it.
|
|
3541
|
+
*/
|
|
3542
|
+
#contentElement() {
|
|
3543
|
+
return this.parentElement?.querySelector(":scope > [data-tts-content]") ?? null;
|
|
3544
|
+
}
|
|
3545
|
+
/**
|
|
3546
|
+
* The element whose text is read: the stimulus body next to the player (stimulus mode), the
|
|
3547
|
+
* marked content next to it (content mode), or the item body of the item to read.
|
|
3548
|
+
*/
|
|
3549
|
+
#resolveReadingRoot() {
|
|
3550
|
+
if (this.#stimulusMode)
|
|
3551
|
+
return this.#stimulusPlaceholder()?.querySelector("qti-stimulus-body") ?? null;
|
|
3552
|
+
if (this.#contentMode)
|
|
3553
|
+
return this.#contentElement();
|
|
3554
|
+
return this.#resolveItem()?.querySelector("qti-item-body") ?? null;
|
|
3555
|
+
}
|
|
3556
|
+
/** The item to read: our item-ref's (item-ref mode), or the navigated one (cursor mode). */
|
|
3557
|
+
#resolveItem() {
|
|
3558
|
+
if (this.#itemRef)
|
|
3559
|
+
return this.#itemRef.assessmentItem;
|
|
3560
|
+
const identifier = this._sessionContext?.navItemRefId;
|
|
3561
|
+
return identifier ? this.#findItemInDom(identifier) : null;
|
|
2991
3562
|
}
|
|
2992
3563
|
/**
|
|
2993
|
-
*
|
|
2994
|
-
*
|
|
2995
|
-
*
|
|
3564
|
+
* Cursor mode: find the rendered item for an item-ref identifier. Our own `<qti-test>` first —
|
|
3565
|
+
* a page can hold several tests showing the same item — then every root from here up to the
|
|
3566
|
+
* document; each scope directly and in the `test-container` shadow roots inside it.
|
|
2996
3567
|
*/
|
|
2997
3568
|
#findItemInDom(identifier) {
|
|
2998
|
-
const
|
|
2999
|
-
const
|
|
3000
|
-
|
|
3001
|
-
if (ownRef?.getAttribute("identifier") === identifier) {
|
|
3002
|
-
const own = ownRef.querySelector("qti-assessment-item");
|
|
3003
|
-
if (own)
|
|
3004
|
-
return own;
|
|
3005
|
-
}
|
|
3006
|
-
let root = this.getRootNode();
|
|
3007
|
-
while (root) {
|
|
3008
|
-
const scope = root;
|
|
3009
|
-
const direct = scope.querySelector?.(selector);
|
|
3569
|
+
const selector = `qti-assessment-item-ref[identifier="${CSS.escape(identifier)}"] qti-assessment-item`;
|
|
3570
|
+
const search = (scope) => {
|
|
3571
|
+
const direct = scope.querySelector(selector);
|
|
3010
3572
|
if (direct)
|
|
3011
3573
|
return direct;
|
|
3012
|
-
for (const container of Array.from(scope.querySelectorAll
|
|
3574
|
+
for (const container of Array.from(scope.querySelectorAll("test-container"))) {
|
|
3013
3575
|
const inShadow = container.shadowRoot?.querySelector(selector);
|
|
3014
3576
|
if (inShadow)
|
|
3015
3577
|
return inShadow;
|
|
3016
3578
|
}
|
|
3579
|
+
return null;
|
|
3580
|
+
};
|
|
3581
|
+
const test = this.closest("qti-test");
|
|
3582
|
+
const inTest = test && search(test);
|
|
3583
|
+
if (inTest)
|
|
3584
|
+
return inTest;
|
|
3585
|
+
let root = this.getRootNode();
|
|
3586
|
+
for (; ; ) {
|
|
3587
|
+
const found = search(root);
|
|
3588
|
+
if (found)
|
|
3589
|
+
return found;
|
|
3017
3590
|
const host = root.host;
|
|
3018
3591
|
if (!host)
|
|
3019
|
-
|
|
3592
|
+
return null;
|
|
3020
3593
|
root = host.getRootNode();
|
|
3021
3594
|
}
|
|
3022
|
-
return null;
|
|
3023
3595
|
}
|
|
3024
3596
|
/** Update speech state on both the context (notifies children) and the host's CSS custom states. */
|
|
3025
3597
|
#setSpeechState(state9) {
|
|
@@ -3034,26 +3606,37 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
3034
3606
|
this._ttsContext = {
|
|
3035
3607
|
...this._ttsContext,
|
|
3036
3608
|
currentElementIndex: this.#currentElementIndex,
|
|
3037
|
-
elementCount: this.#
|
|
3609
|
+
elementCount: this.#getReadingElements().length
|
|
3038
3610
|
};
|
|
3039
3611
|
}
|
|
3040
|
-
/**
|
|
3612
|
+
/**
|
|
3613
|
+
* Return the currently readable elements: cached candidates for the item or stimulus (collected lazily on
|
|
3614
|
+
* first call), filtered live for visibility on every call. Feedback and other
|
|
3615
|
+
* conditionally-shown content (e.g. `qti-feedback-block`, which is `display: none` until a
|
|
3616
|
+
* CSS custom state reveals it) is excluded while hidden and picked up again once shown,
|
|
3617
|
+
* without needing to re-collect the candidate set.
|
|
3618
|
+
*/
|
|
3041
3619
|
#getReadingElements() {
|
|
3042
|
-
if (this.#readingElements
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3620
|
+
if (this.#contentMode && this.#readingElements?.some((el) => !el.isConnected)) {
|
|
3621
|
+
this.#readingElements = null;
|
|
3622
|
+
this.#currentElementIndex = 0;
|
|
3623
|
+
this.#finished = false;
|
|
3624
|
+
}
|
|
3625
|
+
if (this.#readingElements === null) {
|
|
3626
|
+
const root = this.#resolveReadingRoot();
|
|
3627
|
+
if (!root)
|
|
3628
|
+
return [];
|
|
3629
|
+
const selector = "p, h1, h2, h3, h4, h5, h6, li, dt, dd, th, td, caption, blockquote, figcaption, qti-prompt, qti-simple-choice";
|
|
3630
|
+
this.#readingElements = Array.from(root.querySelectorAll(selector)).filter((el) => (el.textContent ?? "").trim().length > 0 && !el.querySelector(selector) && !el.closest('[aria-hidden="true"]'));
|
|
3631
|
+
}
|
|
3632
|
+
return this.#readingElements.filter((el) => this.#isVisible(el));
|
|
3633
|
+
}
|
|
3634
|
+
/** True when an element is actually rendered — not `display: none` (itself or an ancestor). */
|
|
3635
|
+
#isVisible(element) {
|
|
3636
|
+
if (typeof element.checkVisibility === "function") {
|
|
3637
|
+
return element.checkVisibility({ checkOpacity: false, checkVisibilityCSS: true });
|
|
3638
|
+
}
|
|
3639
|
+
return element.getClientRects().length > 0;
|
|
3057
3640
|
}
|
|
3058
3641
|
/**
|
|
3059
3642
|
* Resolve the speech language for a reading element.
|
|
@@ -3076,7 +3659,7 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
3076
3659
|
#playSpeech() {
|
|
3077
3660
|
const elements = this.#getReadingElements();
|
|
3078
3661
|
if (!elements.length) {
|
|
3079
|
-
console.warn("test-item-to-speech: no readable elements found
|
|
3662
|
+
console.warn("test-item-to-speech: no readable elements found");
|
|
3080
3663
|
return;
|
|
3081
3664
|
}
|
|
3082
3665
|
this.#stopPicking();
|
|
@@ -3085,11 +3668,13 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
3085
3668
|
this.#finished = false;
|
|
3086
3669
|
this.#currentElementIndex = 0;
|
|
3087
3670
|
}
|
|
3671
|
+
if (this.#contentMode && this.#currentElementIndex === 0)
|
|
3672
|
+
this.#readingElements = null;
|
|
3088
3673
|
this.#speakElement(this.#currentElementIndex);
|
|
3089
3674
|
}
|
|
3090
3675
|
/** Speak the element at the given index, then auto-advance when it ends. */
|
|
3091
3676
|
#speakElement(index) {
|
|
3092
|
-
const elements = this.#
|
|
3677
|
+
const elements = this.#getReadingElements();
|
|
3093
3678
|
if (index >= elements.length) {
|
|
3094
3679
|
this.#clearWordHighlight();
|
|
3095
3680
|
this.#currentElementIndex = elements.length - 1;
|
|
@@ -3161,9 +3746,11 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
3161
3746
|
}
|
|
3162
3747
|
/** Highlight every reading element and wait for a click on one of them. */
|
|
3163
3748
|
#startPicking() {
|
|
3749
|
+
if (this.#contentMode)
|
|
3750
|
+
this.#readingElements = null;
|
|
3164
3751
|
const elements = this.#getReadingElements();
|
|
3165
3752
|
if (!elements.length) {
|
|
3166
|
-
console.warn("test-item-to-speech: no readable elements found
|
|
3753
|
+
console.warn("test-item-to-speech: no readable elements found");
|
|
3167
3754
|
return;
|
|
3168
3755
|
}
|
|
3169
3756
|
this.#stop();
|
|
@@ -3185,7 +3772,7 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
3185
3772
|
this._ttsContext = { ...this._ttsContext, picking: false };
|
|
3186
3773
|
}
|
|
3187
3774
|
#handlePickClick(event) {
|
|
3188
|
-
const elements = this.#
|
|
3775
|
+
const elements = this.#getReadingElements();
|
|
3189
3776
|
const path = event.composedPath();
|
|
3190
3777
|
let index = elements.findIndex((el) => path.includes(el));
|
|
3191
3778
|
if (index < 0) {
|
|
@@ -3237,7 +3824,7 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
3237
3824
|
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
|
3238
3825
|
let node;
|
|
3239
3826
|
while (node = walker.nextNode()) {
|
|
3240
|
-
if ((node.textContent ?? "").length > 0) {
|
|
3827
|
+
if ((node.textContent ?? "").length > 0 && !node.parentElement?.closest('[aria-hidden="true"]')) {
|
|
3241
3828
|
nodes.push(node);
|
|
3242
3829
|
}
|
|
3243
3830
|
}
|
|
@@ -3328,7 +3915,7 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
3328
3915
|
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
|
|
3329
3916
|
}
|
|
3330
3917
|
const roots = /* @__PURE__ */ new Set();
|
|
3331
|
-
const testContainer = this.closest("test-navigation")?.querySelector("test-container") ?? this.
|
|
3918
|
+
const testContainer = this.closest("test-navigation")?.querySelector("test-container") ?? this.testHost?.querySelector("test-container");
|
|
3332
3919
|
if (testContainer?.shadowRoot)
|
|
3333
3920
|
roots.add(testContainer.shadowRoot);
|
|
3334
3921
|
const ownRoot = this.getRootNode();
|
|
@@ -3344,16 +3931,16 @@ var TestItemToSpeech = class extends LitElement13 {
|
|
|
3344
3931
|
}
|
|
3345
3932
|
}
|
|
3346
3933
|
};
|
|
3347
|
-
|
|
3348
|
-
|
|
3934
|
+
__decorate17([
|
|
3935
|
+
property13({ type: String })
|
|
3349
3936
|
], TestItemToSpeech.prototype, "language", void 0);
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
], TestItemToSpeech.prototype, "itemRefId", void 0);
|
|
3353
|
-
__decorate13([
|
|
3354
|
-
consume7({ context: sessionContext, subscribe: true })
|
|
3937
|
+
__decorate17([
|
|
3938
|
+
consume9({ context: sessionContext, subscribe: true })
|
|
3355
3939
|
], TestItemToSpeech.prototype, "_sessionContext", void 0);
|
|
3356
|
-
|
|
3940
|
+
__decorate17([
|
|
3941
|
+
consume9({ context: testHostContext, subscribe: true })
|
|
3942
|
+
], TestItemToSpeech.prototype, "testHost", void 0);
|
|
3943
|
+
__decorate17([
|
|
3357
3944
|
state4(),
|
|
3358
3945
|
provide3({ context: ttsContext })
|
|
3359
3946
|
], TestItemToSpeech.prototype, "_ttsContext", void 0);
|
|
@@ -3370,19 +3957,19 @@ var TestTtsPlay = class extends TtsButtonBase {
|
|
|
3370
3957
|
}
|
|
3371
3958
|
render() {
|
|
3372
3959
|
const playing = this._tts?.state === "playing";
|
|
3373
|
-
return
|
|
3960
|
+
return html14`
|
|
3374
3961
|
<button part="button" aria-label=${ifDefined(playing ? this.pauseLabel : this.label)} @click=${this.#toggle}>
|
|
3375
|
-
${playing ?
|
|
3962
|
+
${playing ? html14`<slot name="pause">${iconContent("pause", this.pauseLabel ?? "Pause")}</slot>` : html14`<slot name="play">${iconContent("play", this.label ?? "Play")}</slot>`}
|
|
3376
3963
|
</button>
|
|
3377
3964
|
`;
|
|
3378
3965
|
}
|
|
3379
3966
|
};
|
|
3380
|
-
|
|
3381
|
-
|
|
3967
|
+
__decorate17([
|
|
3968
|
+
property13({ type: String, attribute: "pause-label" })
|
|
3382
3969
|
], TestTtsPlay.prototype, "pauseLabel", void 0);
|
|
3383
3970
|
var TestTtsPause = class extends TtsButtonBase {
|
|
3384
3971
|
render() {
|
|
3385
|
-
return
|
|
3972
|
+
return html14`
|
|
3386
3973
|
<button
|
|
3387
3974
|
part="button"
|
|
3388
3975
|
aria-label=${ifDefined(this.label)}
|
|
@@ -3396,7 +3983,7 @@ var TestTtsPause = class extends TtsButtonBase {
|
|
|
3396
3983
|
};
|
|
3397
3984
|
var TestTtsResume = class extends TtsButtonBase {
|
|
3398
3985
|
render() {
|
|
3399
|
-
return
|
|
3986
|
+
return html14`
|
|
3400
3987
|
<button
|
|
3401
3988
|
part="button"
|
|
3402
3989
|
aria-label=${ifDefined(this.label)}
|
|
@@ -3411,7 +3998,7 @@ var TestTtsResume = class extends TtsButtonBase {
|
|
|
3411
3998
|
var TestTtsStop = class extends TtsButtonBase {
|
|
3412
3999
|
render() {
|
|
3413
4000
|
const idle = this._tts?.state === "idle" && !this._tts?.picking;
|
|
3414
|
-
return
|
|
4001
|
+
return html14`
|
|
3415
4002
|
<button part="button" aria-label=${ifDefined(this.label)} ?disabled=${idle} @click=${() => this._tts?.stop()}>
|
|
3416
4003
|
<slot>${iconContent("stop", this.label ?? "Stop")}</slot>
|
|
3417
4004
|
</button>
|
|
@@ -3422,7 +4009,7 @@ var TestTtsPrev = class extends TtsButtonBase {
|
|
|
3422
4009
|
render() {
|
|
3423
4010
|
const collected = (this._tts?.elementCount ?? 0) > 0;
|
|
3424
4011
|
const atStart = (this._tts?.currentElementIndex ?? 0) === 0;
|
|
3425
|
-
return
|
|
4012
|
+
return html14`
|
|
3426
4013
|
<button
|
|
3427
4014
|
part="button"
|
|
3428
4015
|
aria-label=${ifDefined(this.label)}
|
|
@@ -3438,7 +4025,7 @@ var TestTtsNext = class extends TtsButtonBase {
|
|
|
3438
4025
|
render() {
|
|
3439
4026
|
const count = this._tts?.elementCount ?? 0;
|
|
3440
4027
|
const atEnd = count > 0 && (this._tts?.currentElementIndex ?? 0) >= count - 1;
|
|
3441
|
-
return
|
|
4028
|
+
return html14`
|
|
3442
4029
|
<button
|
|
3443
4030
|
part="button"
|
|
3444
4031
|
aria-label=${ifDefined(this.label)}
|
|
@@ -3452,7 +4039,7 @@ var TestTtsNext = class extends TtsButtonBase {
|
|
|
3452
4039
|
};
|
|
3453
4040
|
var TestTtsPick = class extends TtsButtonBase {
|
|
3454
4041
|
render() {
|
|
3455
|
-
return
|
|
4042
|
+
return html14`
|
|
3456
4043
|
<button
|
|
3457
4044
|
part="button"
|
|
3458
4045
|
aria-label=${ifDefined(this.label)}
|
|
@@ -3466,16 +4053,54 @@ var TestTtsPick = class extends TtsButtonBase {
|
|
|
3466
4053
|
};
|
|
3467
4054
|
|
|
3468
4055
|
// ../qti-test/dist/components/test-navigation/test-navigation.js
|
|
3469
|
-
import { consume as
|
|
3470
|
-
import { html as
|
|
3471
|
-
import { property as
|
|
3472
|
-
var
|
|
4056
|
+
import { ContextConsumer, consume as consume10, provide as provide4 } from "@lit/context";
|
|
4057
|
+
import { html as html15, LitElement as LitElement16 } from "lit";
|
|
4058
|
+
import { property as property14, state as state5 } from "lit/decorators.js";
|
|
4059
|
+
var __decorate18 = function(decorators, target, key, desc) {
|
|
3473
4060
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3474
4061
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3475
4062
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3476
4063
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3477
4064
|
};
|
|
3478
|
-
var
|
|
4065
|
+
var newQtiContext = () => ({
|
|
4066
|
+
QTI_CONTEXT: { testIdentifier: "", candidateIdentifier: "", environmentIdentifier: "default" }
|
|
4067
|
+
});
|
|
4068
|
+
var TestNavigation = class extends LitElement16 {
|
|
4069
|
+
/**
|
|
4070
|
+
* @deprecated Set `qtiContext` on `qti-test`, which provides it. This is an alias for the
|
|
4071
|
+
* enclosing test's: reading returns it, writing replaces it, so a host that has always set the
|
|
4072
|
+
* shuffle seed here keeps working. Removed in the next major.
|
|
4073
|
+
*
|
|
4074
|
+
* Written before the navigation is inside a test, it waits and is handed over on connect.
|
|
4075
|
+
*/
|
|
4076
|
+
get qtiContext() {
|
|
4077
|
+
return this.#owner()?.qtiContext ?? (this.#pendingQtiContext ??= newQtiContext());
|
|
4078
|
+
}
|
|
4079
|
+
set qtiContext(value) {
|
|
4080
|
+
if (!this.#warnedQtiContext) {
|
|
4081
|
+
this.#warnedQtiContext = true;
|
|
4082
|
+
console.warn("[qti-components] `test-navigation.qtiContext` is deprecated and will be removed in the next major release. Set `qtiContext` on `<qti-test>` instead; it is the same value.");
|
|
4083
|
+
}
|
|
4084
|
+
this.#writeQtiContext(value);
|
|
4085
|
+
}
|
|
4086
|
+
#pendingQtiContext;
|
|
4087
|
+
#warnedQtiContext;
|
|
4088
|
+
/** The write the library itself makes. Not the deprecated setter, so it never warns about itself. */
|
|
4089
|
+
#writeQtiContext(value) {
|
|
4090
|
+
const owner = this.#owner();
|
|
4091
|
+
if (owner)
|
|
4092
|
+
owner.qtiContext = value;
|
|
4093
|
+
else
|
|
4094
|
+
this.#pendingQtiContext = value;
|
|
4095
|
+
}
|
|
4096
|
+
/**
|
|
4097
|
+
* The `qti-test` this navigation is in, found through context so it works across shadow roots.
|
|
4098
|
+
* A write made before it is known waits in `#pendingQtiContext` and is handed over on arrival.
|
|
4099
|
+
*/
|
|
4100
|
+
#testHost;
|
|
4101
|
+
#owner() {
|
|
4102
|
+
return this.#testHost.value ?? null;
|
|
4103
|
+
}
|
|
3479
4104
|
#testElement;
|
|
3480
4105
|
/**
|
|
3481
4106
|
* Whether each item's last *ended attempt* reached the optimal outcome, keyed
|
|
@@ -3489,22 +4114,26 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3489
4114
|
super();
|
|
3490
4115
|
this.identifier = void 0;
|
|
3491
4116
|
this.initContext = [];
|
|
3492
|
-
this
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
4117
|
+
this.#warnedQtiContext = false;
|
|
4118
|
+
this.#testHost = new ContextConsumer(this, {
|
|
4119
|
+
context: testHostContext,
|
|
4120
|
+
subscribe: true,
|
|
4121
|
+
callback: (host) => {
|
|
4122
|
+
if (host && this.#pendingQtiContext) {
|
|
4123
|
+
host.qtiContext = this.#pendingQtiContext;
|
|
4124
|
+
this.#pendingQtiContext = void 0;
|
|
4125
|
+
}
|
|
3497
4126
|
}
|
|
3498
|
-
};
|
|
4127
|
+
});
|
|
3499
4128
|
this.configContext = {};
|
|
3500
4129
|
this.autoScoreItems = false;
|
|
3501
4130
|
this.#optimality = /* @__PURE__ */ new Map();
|
|
3502
|
-
this
|
|
4131
|
+
listenPublic2(this, "cito-test-loaded", this.#handleTestConnected.bind(this));
|
|
3503
4132
|
this.addEventListener("qti-assessment-item-connected", this.#handleItemConnected.bind(this));
|
|
3504
|
-
this
|
|
4133
|
+
listenPublic(this, "cito-item-response-changed", this.#handleInteractionChanged.bind(this));
|
|
3505
4134
|
this.addEventListener("qti-item-context-updated", this.#handleItemContextUpdated.bind(this));
|
|
3506
|
-
this
|
|
3507
|
-
this
|
|
4135
|
+
listenPublic2(this, "cito-test-end-attempt", this.#handleTestEndAttempt.bind(this));
|
|
4136
|
+
listenPublic2(this, "cito-test-update-outcome", this.#handleTestUpdateOutcomeVariable.bind(this));
|
|
3508
4137
|
}
|
|
3509
4138
|
/**
|
|
3510
4139
|
* Latch whether an item reached its optimal outcome whenever it has just ended
|
|
@@ -3523,7 +4152,8 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3523
4152
|
this.#optimality.set(itemContext.identifier, optimality);
|
|
3524
4153
|
const computedItem = this.computedItemFor(itemContext.identifier);
|
|
3525
4154
|
const numAttempts = Number(itemContext.variables?.find((v) => v.identifier === "numAttempts")?.value) || 0;
|
|
3526
|
-
|
|
4155
|
+
const completionStatus = itemContext.variables?.find((v) => v.identifier === "completionStatus")?.value;
|
|
4156
|
+
this.afterAttemptEnded(event.composedPath()[0]?.closest("qti-assessment-item"), computedItem, this.#isItemDone(numAttempts, optimality, computedItem?.maxAttempts, computedItem?.adaptive, completionStatus));
|
|
3527
4157
|
}
|
|
3528
4158
|
/**
|
|
3529
4159
|
* Extension point for presentation packages reacting to an ended attempt.
|
|
@@ -3582,7 +4212,7 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3582
4212
|
}
|
|
3583
4213
|
}
|
|
3584
4214
|
render() {
|
|
3585
|
-
return
|
|
4215
|
+
return html15`<slot></slot>`;
|
|
3586
4216
|
}
|
|
3587
4217
|
/* PK: on test connected we can build the computed context */
|
|
3588
4218
|
#handleTestConnected(event) {
|
|
@@ -3594,26 +4224,26 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3594
4224
|
candidateIdentifier: "not set",
|
|
3595
4225
|
environmentIdentifier: "default"
|
|
3596
4226
|
};
|
|
3597
|
-
this
|
|
4227
|
+
this.#writeQtiContext({
|
|
3598
4228
|
QTI_CONTEXT: {
|
|
3599
4229
|
...currentContext,
|
|
3600
4230
|
testIdentifier: this.#testElement.identifier,
|
|
3601
4231
|
environmentIdentifier: currentContext.environmentIdentifier || "default"
|
|
3602
4232
|
}
|
|
3603
|
-
};
|
|
4233
|
+
});
|
|
3604
4234
|
}
|
|
3605
4235
|
const contextDeclarations = this.#testElement.querySelectorAll('qti-context-declaration[identifier="QTI_CONTEXT"]');
|
|
3606
4236
|
contextDeclarations.forEach((declaration) => {
|
|
3607
4237
|
const defaultValues = this.#extractDefaultValues(declaration);
|
|
3608
4238
|
if (Object.keys(defaultValues).length > 0) {
|
|
3609
|
-
this
|
|
4239
|
+
this.#writeQtiContext({
|
|
3610
4240
|
QTI_CONTEXT: {
|
|
3611
4241
|
...defaultValues,
|
|
3612
4242
|
// Default values first
|
|
3613
4243
|
...this.qtiContext.QTI_CONTEXT
|
|
3614
4244
|
// Runtime values override defaults
|
|
3615
4245
|
}
|
|
3616
|
-
};
|
|
4246
|
+
});
|
|
3617
4247
|
}
|
|
3618
4248
|
});
|
|
3619
4249
|
const testPartElements = Array.from(this.#testElement?.querySelectorAll(`qti-test-part`) || []);
|
|
@@ -3785,7 +4415,7 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3785
4415
|
const response = computedItem.variables?.find((v) => v.identifier === "RESPONSE")?.value || "";
|
|
3786
4416
|
const numAttempts = Number(computedItem.variables?.find((v) => v.identifier === "numAttempts")?.value) || 0;
|
|
3787
4417
|
const active = this._sessionContext?.navItemRefId === computedItem.identifier || false;
|
|
3788
|
-
const valid =
|
|
4418
|
+
const valid = itemContext?.valid ?? true;
|
|
3789
4419
|
const responseVars = itemContext?.variables?.filter((v) => v.type === "response") || [];
|
|
3790
4420
|
const isDefaultResponse = responseVars.every((v) => {
|
|
3791
4421
|
if (v.value === void 0 || v.value === null) {
|
|
@@ -3826,7 +4456,7 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3826
4456
|
if (numAttempts > 0)
|
|
3827
4457
|
this.#optimality.set(computedItem.identifier, optimality);
|
|
3828
4458
|
}
|
|
3829
|
-
const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts);
|
|
4459
|
+
const done = this.#isItemDone(numAttempts, optimality, computedItem.maxAttempts, computedItem.adaptive, completionStatus);
|
|
3830
4460
|
return {
|
|
3831
4461
|
...computedItem,
|
|
3832
4462
|
completionStatus,
|
|
@@ -3874,10 +4504,17 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3874
4504
|
* `optimality` reflects the last *ended attempt* (see #optimality), not the
|
|
3875
4505
|
* live selection — so a freshly-picked optimal answer doesn't count as done
|
|
3876
4506
|
* until test-end-attempt evaluates it.
|
|
4507
|
+
*
|
|
4508
|
+
* Adaptive items decide this themselves: max-attempts does not apply to them
|
|
4509
|
+
* (QTI 3, itemSessionControl), and a wrong attempt may be the step that leads
|
|
4510
|
+
* on to the next part of the item. They are done once their response
|
|
4511
|
+
* processing sets completionStatus to 'completed'.
|
|
3877
4512
|
*/
|
|
3878
|
-
#isItemDone(numAttempts, optimality, maxAttempts) {
|
|
4513
|
+
#isItemDone(numAttempts, optimality, maxAttempts, adaptive, completionStatus) {
|
|
3879
4514
|
if (numAttempts === 0)
|
|
3880
4515
|
return false;
|
|
4516
|
+
if (adaptive)
|
|
4517
|
+
return completionStatus === "completed";
|
|
3881
4518
|
if (optimality !== "suboptimal")
|
|
3882
4519
|
return true;
|
|
3883
4520
|
const max = maxAttempts ?? 1;
|
|
@@ -3937,54 +4574,50 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3937
4574
|
return Number.isNaN(parsed) ? null : parsed;
|
|
3938
4575
|
}
|
|
3939
4576
|
};
|
|
3940
|
-
|
|
3941
|
-
|
|
4577
|
+
__decorate18([
|
|
4578
|
+
property14({ type: String })
|
|
3942
4579
|
], TestNavigation.prototype, "identifier", void 0);
|
|
3943
|
-
|
|
4580
|
+
__decorate18([
|
|
3944
4581
|
state5()
|
|
3945
4582
|
], TestNavigation.prototype, "initContext", void 0);
|
|
3946
|
-
|
|
3947
|
-
state5(),
|
|
3948
|
-
provide4({ context: qtiContext })
|
|
3949
|
-
], TestNavigation.prototype, "qtiContext", void 0);
|
|
3950
|
-
__decorate14([
|
|
4583
|
+
__decorate18([
|
|
3951
4584
|
state5(),
|
|
3952
|
-
|
|
4585
|
+
consume10({ context: configContext, subscribe: true })
|
|
3953
4586
|
], TestNavigation.prototype, "configContext", void 0);
|
|
3954
|
-
|
|
4587
|
+
__decorate18([
|
|
3955
4588
|
state5(),
|
|
3956
|
-
|
|
4589
|
+
consume10({ context: testContext, subscribe: true })
|
|
3957
4590
|
], TestNavigation.prototype, "_testContext", void 0);
|
|
3958
|
-
|
|
4591
|
+
__decorate18([
|
|
3959
4592
|
state5(),
|
|
3960
|
-
|
|
4593
|
+
consume10({ context: sessionContext, subscribe: true })
|
|
3961
4594
|
], TestNavigation.prototype, "_sessionContext", void 0);
|
|
3962
|
-
|
|
4595
|
+
__decorate18([
|
|
3963
4596
|
state5(),
|
|
3964
4597
|
provide4({ context: computedContext })
|
|
3965
4598
|
], TestNavigation.prototype, "computedContext", void 0);
|
|
3966
|
-
|
|
3967
|
-
|
|
4599
|
+
__decorate18([
|
|
4600
|
+
property14({ type: Boolean, attribute: "auto-score-items" })
|
|
3968
4601
|
], TestNavigation.prototype, "autoScoreItems", void 0);
|
|
3969
4602
|
|
|
3970
4603
|
// ../qti-test/dist/components/test-next/test-next.js
|
|
3971
|
-
import { css as
|
|
3972
|
-
import { property as
|
|
3973
|
-
import { consume as
|
|
3974
|
-
var
|
|
4604
|
+
import { css as css10, html as html16, LitElement as LitElement17 } from "lit";
|
|
4605
|
+
import { property as property15 } from "lit/decorators.js";
|
|
4606
|
+
import { consume as consume11 } from "@lit/context";
|
|
4607
|
+
var __decorate19 = function(decorators, target, key, desc) {
|
|
3975
4608
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3976
4609
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3977
4610
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
3978
4611
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3979
4612
|
};
|
|
3980
|
-
var TestNext = class extends
|
|
4613
|
+
var TestNext = class extends LitElement17 {
|
|
3981
4614
|
_handleTestElementChange(_oldValue, newValue) {
|
|
3982
4615
|
if (newValue) {
|
|
3983
4616
|
this.requestUpdate();
|
|
3984
4617
|
}
|
|
3985
4618
|
}
|
|
3986
4619
|
static {
|
|
3987
|
-
this.styles =
|
|
4620
|
+
this.styles = css10`
|
|
3988
4621
|
:host {
|
|
3989
4622
|
${btn};
|
|
3990
4623
|
}
|
|
@@ -4038,39 +4671,32 @@ var TestNext = class extends LitElement15 {
|
|
|
4038
4671
|
this._internalDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= (this.sectionItems?.length ?? 0) - 1 || isLinearIndividual && !activeItem?.done;
|
|
4039
4672
|
}
|
|
4040
4673
|
_requestItem(identifier) {
|
|
4041
|
-
this
|
|
4042
|
-
composed: true,
|
|
4043
|
-
bubbles: true,
|
|
4044
|
-
detail: {
|
|
4045
|
-
type: "item",
|
|
4046
|
-
id: identifier
|
|
4047
|
-
}
|
|
4048
|
-
}));
|
|
4674
|
+
dispatchPublic(this, "cito-test-navigate", { type: "item", id: identifier });
|
|
4049
4675
|
}
|
|
4050
4676
|
render() {
|
|
4051
|
-
return
|
|
4677
|
+
return html16`<slot></slot>`;
|
|
4052
4678
|
}
|
|
4053
4679
|
};
|
|
4054
|
-
|
|
4055
|
-
|
|
4680
|
+
__decorate19([
|
|
4681
|
+
property15({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
4056
4682
|
], TestNext.prototype, "_internalDisabled", void 0);
|
|
4057
|
-
|
|
4058
|
-
|
|
4683
|
+
__decorate19([
|
|
4684
|
+
consume11({ context: computedContext, subscribe: true })
|
|
4059
4685
|
], TestNext.prototype, "computedContext", void 0);
|
|
4060
|
-
|
|
4686
|
+
__decorate19([
|
|
4061
4687
|
watch("computedContext")
|
|
4062
4688
|
], TestNext.prototype, "_handleTestElementChange", null);
|
|
4063
4689
|
|
|
4064
4690
|
// ../qti-test/dist/components/test-paging-buttons-stamp/test-paging-buttons-stamp.js
|
|
4065
|
-
import { html as
|
|
4066
|
-
import { consume as
|
|
4067
|
-
var
|
|
4691
|
+
import { html as html17, LitElement as LitElement18 } from "lit";
|
|
4692
|
+
import { consume as consume12 } from "@lit/context";
|
|
4693
|
+
var __decorate20 = function(decorators, target, key, desc) {
|
|
4068
4694
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4069
4695
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4070
4696
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4071
4697
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4072
4698
|
};
|
|
4073
|
-
var TestPagingButtonsStamp = class extends
|
|
4699
|
+
var TestPagingButtonsStamp = class extends LitElement18 {
|
|
4074
4700
|
#internals;
|
|
4075
4701
|
createRenderRoot() {
|
|
4076
4702
|
return this;
|
|
@@ -4087,33 +4713,33 @@ var TestPagingButtonsStamp = class extends LitElement16 {
|
|
|
4087
4713
|
}
|
|
4088
4714
|
render() {
|
|
4089
4715
|
if (!this.computedContext)
|
|
4090
|
-
return
|
|
4716
|
+
return html17``;
|
|
4091
4717
|
const items = this.computedContext.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items));
|
|
4092
|
-
return
|
|
4718
|
+
return html17` ${items.map((item) => this.myTemplate({ item, view: this.computedContext.view }))} `;
|
|
4093
4719
|
}
|
|
4094
4720
|
};
|
|
4095
|
-
|
|
4096
|
-
|
|
4721
|
+
__decorate20([
|
|
4722
|
+
consume12({ context: computedContext, subscribe: true })
|
|
4097
4723
|
], TestPagingButtonsStamp.prototype, "computedContext", void 0);
|
|
4098
4724
|
|
|
4099
4725
|
// ../qti-test/dist/components/test-prev/test-prev.js
|
|
4100
|
-
import { css as
|
|
4101
|
-
import { property as
|
|
4102
|
-
import { consume as
|
|
4103
|
-
var
|
|
4726
|
+
import { css as css11, html as html18, LitElement as LitElement19 } from "lit";
|
|
4727
|
+
import { property as property16 } from "lit/decorators.js";
|
|
4728
|
+
import { consume as consume13 } from "@lit/context";
|
|
4729
|
+
var __decorate21 = function(decorators, target, key, desc) {
|
|
4104
4730
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4105
4731
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4106
4732
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4107
4733
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4108
4734
|
};
|
|
4109
|
-
var TestPrev = class extends
|
|
4735
|
+
var TestPrev = class extends LitElement19 {
|
|
4110
4736
|
_handleTestElementChange(_oldValue, newValue) {
|
|
4111
4737
|
if (newValue) {
|
|
4112
4738
|
this.requestUpdate();
|
|
4113
4739
|
}
|
|
4114
4740
|
}
|
|
4115
4741
|
static {
|
|
4116
|
-
this.styles =
|
|
4742
|
+
this.styles = css11`
|
|
4117
4743
|
:host {
|
|
4118
4744
|
${btn};
|
|
4119
4745
|
}
|
|
@@ -4154,61 +4780,54 @@ var TestPrev = class extends LitElement17 {
|
|
|
4154
4780
|
this._internalDisabled = navigationMode === "linear" || !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
|
|
4155
4781
|
}
|
|
4156
4782
|
_requestItem(identifier) {
|
|
4157
|
-
this
|
|
4158
|
-
composed: true,
|
|
4159
|
-
bubbles: true,
|
|
4160
|
-
detail: {
|
|
4161
|
-
type: "item",
|
|
4162
|
-
id: identifier
|
|
4163
|
-
}
|
|
4164
|
-
}));
|
|
4783
|
+
dispatchPublic(this, "cito-test-navigate", { type: "item", id: identifier });
|
|
4165
4784
|
}
|
|
4166
4785
|
render() {
|
|
4167
|
-
return
|
|
4786
|
+
return html18`<slot></slot>`;
|
|
4168
4787
|
}
|
|
4169
4788
|
};
|
|
4170
|
-
|
|
4171
|
-
|
|
4789
|
+
__decorate21([
|
|
4790
|
+
property16({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
4172
4791
|
], TestPrev.prototype, "_internalDisabled", void 0);
|
|
4173
|
-
|
|
4174
|
-
|
|
4792
|
+
__decorate21([
|
|
4793
|
+
consume13({ context: computedContext, subscribe: true })
|
|
4175
4794
|
], TestPrev.prototype, "computedContext", void 0);
|
|
4176
|
-
|
|
4795
|
+
__decorate21([
|
|
4177
4796
|
watch("computedContext")
|
|
4178
4797
|
], TestPrev.prototype, "_handleTestElementChange", null);
|
|
4179
4798
|
|
|
4180
4799
|
// ../qti-test/dist/components/test-print-context/test-print-context.js
|
|
4181
|
-
import { html as
|
|
4182
|
-
import { consume as
|
|
4800
|
+
import { html as html19, LitElement as LitElement20 } from "lit";
|
|
4801
|
+
import { consume as consume14 } from "@lit/context";
|
|
4183
4802
|
import { state as state6 } from "lit/decorators.js";
|
|
4184
|
-
var
|
|
4803
|
+
var __decorate22 = function(decorators, target, key, desc) {
|
|
4185
4804
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4186
4805
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4187
4806
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4188
4807
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4189
4808
|
};
|
|
4190
|
-
var TestPrintContext = class extends
|
|
4809
|
+
var TestPrintContext = class extends LitElement20 {
|
|
4191
4810
|
render() {
|
|
4192
|
-
return
|
|
4811
|
+
return html19` <small><pre>${JSON.stringify(this.computedContext, null, 2)}</pre></small> `;
|
|
4193
4812
|
}
|
|
4194
4813
|
};
|
|
4195
|
-
|
|
4814
|
+
__decorate22([
|
|
4196
4815
|
state6(),
|
|
4197
|
-
|
|
4816
|
+
consume14({ context: computedContext, subscribe: true })
|
|
4198
4817
|
], TestPrintContext.prototype, "computedContext", void 0);
|
|
4199
4818
|
|
|
4200
4819
|
// ../qti-test/dist/components/test-print-item-variables/test-print-item-variables.js
|
|
4201
|
-
import { html as
|
|
4202
|
-
import { consume as
|
|
4203
|
-
var
|
|
4820
|
+
import { html as html20, css as css12, LitElement as LitElement21 } from "lit";
|
|
4821
|
+
import { consume as consume15 } from "@lit/context";
|
|
4822
|
+
var __decorate23 = function(decorators, target, key, desc) {
|
|
4204
4823
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4205
4824
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4206
4825
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4207
4826
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4208
4827
|
};
|
|
4209
|
-
var TestPrintVariables = class extends
|
|
4828
|
+
var TestPrintVariables = class extends LitElement21 {
|
|
4210
4829
|
static {
|
|
4211
|
-
this.styles =
|
|
4830
|
+
this.styles = css12`
|
|
4212
4831
|
table {
|
|
4213
4832
|
width: 100%;
|
|
4214
4833
|
border-collapse: collapse;
|
|
@@ -4234,10 +4853,10 @@ var TestPrintVariables = class extends LitElement19 {
|
|
|
4234
4853
|
render() {
|
|
4235
4854
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
4236
4855
|
if (!activeItem || !activeItem.variables)
|
|
4237
|
-
return
|
|
4856
|
+
return html20``;
|
|
4238
4857
|
const responseVariables = activeItem.variables.filter((v) => v.type === "response");
|
|
4239
4858
|
const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
|
|
4240
|
-
const renderTable = (variables, title) =>
|
|
4859
|
+
const renderTable = (variables, title) => html20`
|
|
4241
4860
|
<h3>${title}</h3>
|
|
4242
4861
|
<table>
|
|
4243
4862
|
<thead>
|
|
@@ -4254,7 +4873,7 @@ var TestPrintVariables = class extends LitElement19 {
|
|
|
4254
4873
|
const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
|
|
4255
4874
|
const mapEntries = v.mapping?.mapEntries?.map((m) => `${m.mapKey}=${m.mappedValue}pt`).join(", ") || "";
|
|
4256
4875
|
const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m) => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(", ") || "";
|
|
4257
|
-
return
|
|
4876
|
+
return html20`
|
|
4258
4877
|
<tr>
|
|
4259
4878
|
<td>${v.identifier}</td>
|
|
4260
4879
|
<td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
|
|
@@ -4267,26 +4886,26 @@ var TestPrintVariables = class extends LitElement19 {
|
|
|
4267
4886
|
</tbody>
|
|
4268
4887
|
</table>
|
|
4269
4888
|
`;
|
|
4270
|
-
return
|
|
4889
|
+
return html20`
|
|
4271
4890
|
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
4272
4891
|
`;
|
|
4273
4892
|
}
|
|
4274
4893
|
};
|
|
4275
|
-
|
|
4276
|
-
|
|
4894
|
+
__decorate23([
|
|
4895
|
+
consume15({ context: computedContext, subscribe: true })
|
|
4277
4896
|
], TestPrintVariables.prototype, "computedContext", void 0);
|
|
4278
4897
|
|
|
4279
4898
|
// ../qti-test/dist/components/test-scoring-buttons/test-scoring-buttons.js
|
|
4280
|
-
import { html as
|
|
4281
|
-
import { consume as
|
|
4282
|
-
import { property as
|
|
4283
|
-
var
|
|
4899
|
+
import { html as html21, LitElement as LitElement22, nothing as nothing3 } from "lit";
|
|
4900
|
+
import { consume as consume16 } from "@lit/context";
|
|
4901
|
+
import { property as property17 } from "lit/decorators.js";
|
|
4902
|
+
var __decorate24 = function(decorators, target, key, desc) {
|
|
4284
4903
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4285
4904
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4286
4905
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4287
4906
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4288
4907
|
};
|
|
4289
|
-
var TestScoringButtons = class extends
|
|
4908
|
+
var TestScoringButtons = class extends LitElement22 {
|
|
4290
4909
|
createRenderRoot() {
|
|
4291
4910
|
return this;
|
|
4292
4911
|
}
|
|
@@ -4303,19 +4922,16 @@ var TestScoringButtons = class extends LitElement20 {
|
|
|
4303
4922
|
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
4304
4923
|
const sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
4305
4924
|
const currentItemIdentifier = sectionItems.find((item) => item.active)?.identifier;
|
|
4306
|
-
this
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
},
|
|
4312
|
-
bubbles: true
|
|
4313
|
-
}));
|
|
4925
|
+
dispatchPublic(this, "cito-test-update-outcome", {
|
|
4926
|
+
assessmentItemRefId: currentItemIdentifier,
|
|
4927
|
+
outcomeVariableId: "SCORE",
|
|
4928
|
+
value
|
|
4929
|
+
});
|
|
4314
4930
|
}
|
|
4315
4931
|
render() {
|
|
4316
4932
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
4317
4933
|
if (!activeItem || !activeItem.variables)
|
|
4318
|
-
return
|
|
4934
|
+
return html21``;
|
|
4319
4935
|
const maxScore = activeItem.variables.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
4320
4936
|
const scoreOutcome = activeItem.variables.find((vr) => vr.identifier == "SCORE");
|
|
4321
4937
|
const score = scoreOutcome?.value;
|
|
@@ -4323,7 +4939,7 @@ var TestScoringButtons = class extends LitElement20 {
|
|
|
4323
4939
|
if (!maxScore || !scoreOutcome)
|
|
4324
4940
|
return nothing3;
|
|
4325
4941
|
const scores = [...Array(Number(maxScore) + 1).keys()];
|
|
4326
|
-
return
|
|
4942
|
+
return html21`${this.myTemplate ? this.myTemplate({ scores, score, disabled }) : nothing3}`;
|
|
4327
4943
|
}
|
|
4328
4944
|
constructor() {
|
|
4329
4945
|
super();
|
|
@@ -4339,27 +4955,27 @@ var TestScoringButtons = class extends LitElement20 {
|
|
|
4339
4955
|
});
|
|
4340
4956
|
}
|
|
4341
4957
|
};
|
|
4342
|
-
|
|
4343
|
-
|
|
4958
|
+
__decorate24([
|
|
4959
|
+
property17({ type: String, attribute: "view" })
|
|
4344
4960
|
], TestScoringButtons.prototype, "view", void 0);
|
|
4345
|
-
|
|
4346
|
-
|
|
4961
|
+
__decorate24([
|
|
4962
|
+
property17({ type: Boolean })
|
|
4347
4963
|
], TestScoringButtons.prototype, "disabled", void 0);
|
|
4348
|
-
|
|
4349
|
-
|
|
4964
|
+
__decorate24([
|
|
4965
|
+
consume16({ context: computedContext, subscribe: true })
|
|
4350
4966
|
], TestScoringButtons.prototype, "computedContext", void 0);
|
|
4351
4967
|
|
|
4352
4968
|
// ../qti-test/dist/components/test-scoring-feedback/test-scoring-feedback.js
|
|
4353
|
-
import { consume as
|
|
4354
|
-
import { html as
|
|
4355
|
-
import { property as
|
|
4356
|
-
var
|
|
4969
|
+
import { consume as consume17 } from "@lit/context";
|
|
4970
|
+
import { html as html22, LitElement as LitElement23 } from "lit";
|
|
4971
|
+
import { property as property18 } from "lit/decorators.js";
|
|
4972
|
+
var __decorate25 = function(decorators, target, key, desc) {
|
|
4357
4973
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4358
4974
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4359
4975
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4360
4976
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4361
4977
|
};
|
|
4362
|
-
var TestScoringFeedback = class extends
|
|
4978
|
+
var TestScoringFeedback = class extends LitElement23 {
|
|
4363
4979
|
constructor() {
|
|
4364
4980
|
super(...arguments);
|
|
4365
4981
|
this.view = null;
|
|
@@ -4367,9 +4983,9 @@ var TestScoringFeedback = class extends LitElement21 {
|
|
|
4367
4983
|
render() {
|
|
4368
4984
|
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
4369
4985
|
if (!activeItem || !activeItem.variables)
|
|
4370
|
-
return
|
|
4986
|
+
return html22``;
|
|
4371
4987
|
if (activeItem["category"] === "dep-informational")
|
|
4372
|
-
return
|
|
4988
|
+
return html22`<div>${this.dataset.informational}</div>`;
|
|
4373
4989
|
const completionStatus = activeItem?.variables.find((v) => v.identifier === "completionStatus")?.value;
|
|
4374
4990
|
const scoreOutcome = activeItem?.variables.find((vr) => vr.identifier == "SCORE");
|
|
4375
4991
|
const score = parseFloat(scoreOutcome?.value);
|
|
@@ -4389,26 +5005,26 @@ var TestScoringFeedback = class extends LitElement21 {
|
|
|
4389
5005
|
}
|
|
4390
5006
|
return this.dataset.inProgress;
|
|
4391
5007
|
};
|
|
4392
|
-
return
|
|
5008
|
+
return html22`<div>${feedbackText()}</div>`;
|
|
4393
5009
|
}
|
|
4394
5010
|
};
|
|
4395
|
-
|
|
4396
|
-
|
|
5011
|
+
__decorate25([
|
|
5012
|
+
consume17({ context: computedContext, subscribe: true })
|
|
4397
5013
|
], TestScoringFeedback.prototype, "computedContext", void 0);
|
|
4398
|
-
|
|
4399
|
-
|
|
5014
|
+
__decorate25([
|
|
5015
|
+
property18({ type: String, attribute: "view" })
|
|
4400
5016
|
], TestScoringFeedback.prototype, "view", void 0);
|
|
4401
5017
|
|
|
4402
5018
|
// ../qti-test/dist/components/test-section-buttons-stamp/test-section-buttons-stamp.js
|
|
4403
|
-
import { html as
|
|
4404
|
-
import { consume as
|
|
4405
|
-
var
|
|
5019
|
+
import { html as html23, LitElement as LitElement24 } from "lit";
|
|
5020
|
+
import { consume as consume18 } from "@lit/context";
|
|
5021
|
+
var __decorate26 = function(decorators, target, key, desc) {
|
|
4406
5022
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4407
5023
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4408
5024
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4409
5025
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4410
5026
|
};
|
|
4411
|
-
var TestSectionButtonsStamp = class extends
|
|
5027
|
+
var TestSectionButtonsStamp = class extends LitElement24 {
|
|
4412
5028
|
#internals;
|
|
4413
5029
|
createRenderRoot() {
|
|
4414
5030
|
return this;
|
|
@@ -4425,27 +5041,27 @@ var TestSectionButtonsStamp = class extends LitElement22 {
|
|
|
4425
5041
|
}
|
|
4426
5042
|
render() {
|
|
4427
5043
|
if (!this.computedContext)
|
|
4428
|
-
return
|
|
5044
|
+
return html23``;
|
|
4429
5045
|
const sections = this.computedContext.testParts.flatMap((testPart) => testPart.sections);
|
|
4430
|
-
return
|
|
5046
|
+
return html23` ${sections.map((item) => this.myTemplate({ item }))} `;
|
|
4431
5047
|
}
|
|
4432
5048
|
};
|
|
4433
|
-
|
|
4434
|
-
|
|
5049
|
+
__decorate26([
|
|
5050
|
+
consume18({ context: computedContext, subscribe: true })
|
|
4435
5051
|
], TestSectionButtonsStamp.prototype, "computedContext", void 0);
|
|
4436
5052
|
|
|
4437
5053
|
// ../qti-test/dist/components/test-section-link/test-section-link.js
|
|
4438
|
-
import { css as
|
|
4439
|
-
import { property as
|
|
4440
|
-
var
|
|
5054
|
+
import { css as css13, html as html24, LitElement as LitElement25 } from "lit";
|
|
5055
|
+
import { property as property19 } from "lit/decorators.js";
|
|
5056
|
+
var __decorate27 = function(decorators, target, key, desc) {
|
|
4441
5057
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4442
5058
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4443
5059
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4444
5060
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4445
5061
|
};
|
|
4446
|
-
var TestSectionLink = class extends
|
|
5062
|
+
var TestSectionLink = class extends LitElement25 {
|
|
4447
5063
|
static {
|
|
4448
|
-
this.styles =
|
|
5064
|
+
this.styles = css13`
|
|
4449
5065
|
:host {
|
|
4450
5066
|
${btn};
|
|
4451
5067
|
}
|
|
@@ -4461,14 +5077,7 @@ var TestSectionLink = class extends LitElement23 {
|
|
|
4461
5077
|
`;
|
|
4462
5078
|
}
|
|
4463
5079
|
#requestItem(identifier) {
|
|
4464
|
-
this
|
|
4465
|
-
composed: true,
|
|
4466
|
-
bubbles: true,
|
|
4467
|
-
detail: {
|
|
4468
|
-
type: "section",
|
|
4469
|
-
id: identifier
|
|
4470
|
-
}
|
|
4471
|
-
}));
|
|
5080
|
+
dispatchPublic(this, "cito-test-navigate", { type: "section", id: identifier });
|
|
4472
5081
|
}
|
|
4473
5082
|
constructor() {
|
|
4474
5083
|
super();
|
|
@@ -4476,24 +5085,24 @@ var TestSectionLink = class extends LitElement23 {
|
|
|
4476
5085
|
this.addEventListener("click", () => this.#requestItem(this.sectionId));
|
|
4477
5086
|
}
|
|
4478
5087
|
render() {
|
|
4479
|
-
return
|
|
5088
|
+
return html24` <slot></slot> `;
|
|
4480
5089
|
}
|
|
4481
5090
|
};
|
|
4482
|
-
|
|
4483
|
-
|
|
5091
|
+
__decorate27([
|
|
5092
|
+
property19({ type: String, attribute: "section-id" })
|
|
4484
5093
|
], TestSectionLink.prototype, "sectionId", void 0);
|
|
4485
5094
|
|
|
4486
5095
|
// ../qti-test/dist/components/test-stamp/test-stamp.js
|
|
4487
|
-
import { html as
|
|
4488
|
-
import { property as
|
|
4489
|
-
import { consume as
|
|
4490
|
-
var
|
|
5096
|
+
import { html as html25, LitElement as LitElement26, nothing as nothing4 } from "lit";
|
|
5097
|
+
import { property as property20, state as state7 } from "lit/decorators.js";
|
|
5098
|
+
import { consume as consume19 } from "@lit/context";
|
|
5099
|
+
var __decorate28 = function(decorators, target, key, desc) {
|
|
4491
5100
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4492
5101
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4493
5102
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4494
5103
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4495
5104
|
};
|
|
4496
|
-
var TestStamp = class extends
|
|
5105
|
+
var TestStamp = class extends LitElement26 {
|
|
4497
5106
|
constructor() {
|
|
4498
5107
|
super(...arguments);
|
|
4499
5108
|
this.debug = false;
|
|
@@ -4556,33 +5165,33 @@ var TestStamp = class extends LitElement24 {
|
|
|
4556
5165
|
}));
|
|
4557
5166
|
}
|
|
4558
5167
|
render() {
|
|
4559
|
-
return
|
|
5168
|
+
return html25` ${this.debug ? html25`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing4}
|
|
4560
5169
|
${this.myTemplate ? this.myTemplate(this.stampContext) : nothing4}`;
|
|
4561
5170
|
}
|
|
4562
5171
|
};
|
|
4563
|
-
|
|
4564
|
-
|
|
5172
|
+
__decorate28([
|
|
5173
|
+
property20({ type: Boolean, reflect: true })
|
|
4565
5174
|
], TestStamp.prototype, "debug", void 0);
|
|
4566
|
-
|
|
5175
|
+
__decorate28([
|
|
4567
5176
|
state7(),
|
|
4568
|
-
|
|
5177
|
+
consume19({ context: computedContext, subscribe: true })
|
|
4569
5178
|
], TestStamp.prototype, "computedContext", void 0);
|
|
4570
|
-
|
|
5179
|
+
__decorate28([
|
|
4571
5180
|
state7()
|
|
4572
5181
|
], TestStamp.prototype, "stampContext", void 0);
|
|
4573
5182
|
|
|
4574
5183
|
// ../qti-test/dist/components/test-view-toggle/test-view.js
|
|
4575
|
-
import { html as
|
|
4576
|
-
import { property as
|
|
4577
|
-
import { consume as
|
|
4578
|
-
var
|
|
5184
|
+
import { html as html26, LitElement as LitElement27 } from "lit";
|
|
5185
|
+
import { property as property21, state as state8 } from "lit/decorators.js";
|
|
5186
|
+
import { consume as consume20 } from "@lit/context";
|
|
5187
|
+
var __decorate29 = function(decorators, target, key, desc) {
|
|
4579
5188
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4580
5189
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4581
5190
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4582
5191
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4583
5192
|
};
|
|
4584
5193
|
var _a;
|
|
4585
|
-
var TestView = class extends
|
|
5194
|
+
var TestView = class extends LitElement27 {
|
|
4586
5195
|
constructor() {
|
|
4587
5196
|
super(...arguments);
|
|
4588
5197
|
this.label = "view";
|
|
@@ -4607,14 +5216,10 @@ var TestView = class extends LitElement25 {
|
|
|
4607
5216
|
}
|
|
4608
5217
|
}
|
|
4609
5218
|
_switchView(view) {
|
|
4610
|
-
this
|
|
4611
|
-
composed: true,
|
|
4612
|
-
bubbles: true,
|
|
4613
|
-
detail: view
|
|
4614
|
-
}));
|
|
5219
|
+
dispatchPublic(this, "cito-test-switch-view", view);
|
|
4615
5220
|
}
|
|
4616
5221
|
render() {
|
|
4617
|
-
return
|
|
5222
|
+
return html26`
|
|
4618
5223
|
<label part="label" for="viewSelect">${this.label}</label>
|
|
4619
5224
|
<select
|
|
4620
5225
|
part="select"
|
|
@@ -4624,38 +5229,38 @@ var TestView = class extends LitElement25 {
|
|
|
4624
5229
|
this._switchView(el.value);
|
|
4625
5230
|
}}
|
|
4626
5231
|
>
|
|
4627
|
-
${this._viewOptions.map((v) =>
|
|
5232
|
+
${this._viewOptions.map((v) => html26`<option value="${v}" ?selected=${v === this.sessionContext.view}>${v}</option>`)}
|
|
4628
5233
|
</select>
|
|
4629
5234
|
`;
|
|
4630
5235
|
}
|
|
4631
5236
|
};
|
|
4632
5237
|
_a = TestView;
|
|
4633
|
-
|
|
4634
|
-
|
|
5238
|
+
__decorate29([
|
|
5239
|
+
consume20({ context: sessionContext, subscribe: true })
|
|
4635
5240
|
], TestView.prototype, "sessionContext", void 0);
|
|
4636
|
-
|
|
4637
|
-
|
|
5241
|
+
__decorate29([
|
|
5242
|
+
property21({ type: String })
|
|
4638
5243
|
], TestView.prototype, "label", void 0);
|
|
4639
|
-
|
|
4640
|
-
|
|
5244
|
+
__decorate29([
|
|
5245
|
+
property21({ type: String, attribute: "view-options" })
|
|
4641
5246
|
], TestView.prototype, "viewOptions", void 0);
|
|
4642
|
-
|
|
5247
|
+
__decorate29([
|
|
4643
5248
|
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
4644
5249
|
], TestView.prototype, "_handleViewOptionsChange", void 0);
|
|
4645
|
-
|
|
5250
|
+
__decorate29([
|
|
4646
5251
|
state8()
|
|
4647
5252
|
], TestView.prototype, "_viewOptions", void 0);
|
|
4648
5253
|
|
|
4649
5254
|
// ../qti-test/dist/components/test-view-toggle/test-view-toggle.js
|
|
4650
|
-
import { consume as
|
|
4651
|
-
import { html as
|
|
4652
|
-
var
|
|
5255
|
+
import { consume as consume21 } from "@lit/context";
|
|
5256
|
+
import { html as html27, LitElement as LitElement28, nothing as nothing5 } from "lit";
|
|
5257
|
+
var __decorate30 = function(decorators, target, key, desc) {
|
|
4653
5258
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4654
5259
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4655
5260
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
4656
5261
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4657
5262
|
};
|
|
4658
|
-
var TestViewToggle = class extends
|
|
5263
|
+
var TestViewToggle = class extends LitElement28 {
|
|
4659
5264
|
createRenderRoot() {
|
|
4660
5265
|
return this;
|
|
4661
5266
|
}
|
|
@@ -4669,11 +5274,7 @@ var TestViewToggle = class extends LitElement26 {
|
|
|
4669
5274
|
this.myTemplate = prepareTemplate(templateElement);
|
|
4670
5275
|
}
|
|
4671
5276
|
_switchView(view) {
|
|
4672
|
-
this
|
|
4673
|
-
composed: true,
|
|
4674
|
-
bubbles: true,
|
|
4675
|
-
detail: view
|
|
4676
|
-
}));
|
|
5277
|
+
dispatchPublic(this, "cito-test-switch-view", view);
|
|
4677
5278
|
}
|
|
4678
5279
|
firstUpdated(_changedProperties) {
|
|
4679
5280
|
this.addEventListener("click", () => {
|
|
@@ -4685,13 +5286,13 @@ var TestViewToggle = class extends LitElement26 {
|
|
|
4685
5286
|
});
|
|
4686
5287
|
}
|
|
4687
5288
|
render() {
|
|
4688
|
-
return
|
|
5289
|
+
return html27`${this.myTemplate ? this.myTemplate({
|
|
4689
5290
|
view: this.sessionContext?.view
|
|
4690
5291
|
}) : nothing5}`;
|
|
4691
5292
|
}
|
|
4692
5293
|
};
|
|
4693
|
-
|
|
4694
|
-
|
|
5294
|
+
__decorate30([
|
|
5295
|
+
consume21({ context: sessionContext, subscribe: true })
|
|
4695
5296
|
], TestViewToggle.prototype, "sessionContext", void 0);
|
|
4696
5297
|
|
|
4697
5298
|
// ../qti-test/dist/elements.js
|
|
@@ -4699,9 +5300,12 @@ var qtiTestElements = [
|
|
|
4699
5300
|
{ tag: "qti-assessment-item-ref", ctor: QtiAssessmentItemRef },
|
|
4700
5301
|
{ tag: "qti-assessment-section", ctor: QtiAssessmentSection },
|
|
4701
5302
|
{ tag: "qti-assessment-test", ctor: QtiAssessmentTest },
|
|
5303
|
+
{ tag: "qti-branch-rule", ctor: QtiBranchRule },
|
|
4702
5304
|
{ tag: "qti-item-session-control", ctor: QtiItemSessionControl },
|
|
5305
|
+
{ tag: "qti-number-presented", ctor: QtiNumberPresented },
|
|
4703
5306
|
{ tag: "qti-number-selected", ctor: QtiNumberSelected },
|
|
4704
5307
|
{ tag: "qti-outcome-processing", ctor: QtiOutcomeProcessing },
|
|
5308
|
+
{ tag: "qti-pre-condition", ctor: QtiPreCondition },
|
|
4705
5309
|
{ tag: "qti-test", ctor: QtiTest },
|
|
4706
5310
|
{ tag: "qti-test-feedback", ctor: QtiTestFeedback },
|
|
4707
5311
|
{ tag: "qti-test-part", ctor: QtiTestPart },
|
|
@@ -4737,14 +5341,18 @@ export {
|
|
|
4737
5341
|
QtiAssessmentItemRef,
|
|
4738
5342
|
QtiAssessmentSection,
|
|
4739
5343
|
QtiAssessmentTest,
|
|
5344
|
+
QtiBranchRule,
|
|
4740
5345
|
QtiItemSessionControl,
|
|
5346
|
+
QtiNumberPresented,
|
|
4741
5347
|
QtiNumberSelected,
|
|
5348
|
+
QtiPreCondition,
|
|
4742
5349
|
QtiOutcomeProcessing,
|
|
4743
5350
|
QtiOutcomeProcessingProcessor,
|
|
4744
5351
|
QtiTestFeedback,
|
|
4745
5352
|
QtiTestPart,
|
|
4746
5353
|
QtiTestVariables,
|
|
4747
5354
|
QtiTestVariablesExpression,
|
|
5355
|
+
QTI_TEST_STATE_VERSION,
|
|
4748
5356
|
QtiTest,
|
|
4749
5357
|
TestCheckItem,
|
|
4750
5358
|
TestContainer,
|
|
@@ -4786,4 +5394,4 @@ export {
|
|
|
4786
5394
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
4787
5395
|
*)
|
|
4788
5396
|
*/
|
|
4789
|
-
//# sourceMappingURL=chunk-
|
|
5397
|
+
//# sourceMappingURL=chunk-SIE3E4FG.js.map
|