@citolab/qti-components 10.0.0-next.15 → 10.0.0-next.17
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 +1503 -2931
- package/dist/base.d.ts +37 -11
- package/dist/base.js +8 -1
- package/dist/{chunk-G2EIC7H2.js → chunk-7MYZHZWV.js} +955 -364
- package/dist/chunk-7MYZHZWV.js.map +1 -0
- package/dist/chunk-DJ7PB252.js +7 -0
- package/dist/chunk-DJ7PB252.js.map +1 -0
- package/dist/{chunk-F553IZPL.js → chunk-J3F3JSCW.js} +2 -2
- package/dist/chunk-J6VX4N7M.js +197 -0
- package/dist/chunk-J6VX4N7M.js.map +1 -0
- package/dist/{chunk-32PI7KWX.js → chunk-L3LBSAGZ.js} +2 -2
- package/dist/{chunk-WIUPAUJV.js → chunk-L7J2ZOJL.js} +2 -2
- package/dist/{chunk-IM5AKPIJ.js → chunk-NZ7ZC4SP.js} +96 -4
- package/dist/chunk-NZ7ZC4SP.js.map +1 -0
- package/dist/{chunk-XY5DHYIH.js → chunk-OG5HIRHE.js} +3 -3
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-HT3LSWXL.js → chunk-QLGUI5VG.js} +2 -2
- package/dist/chunk-UCXLDQYA.js +56 -0
- package/dist/chunk-UCXLDQYA.js.map +1 -0
- package/dist/{chunk-5AJZGRWI.js → chunk-UDJ7MHLF.js} +4 -4
- package/dist/chunk-UDJ7MHLF.js.map +1 -0
- package/dist/{chunk-MIQZBDTB.js → chunk-UURHLJVM.js} +107 -1809
- package/dist/chunk-UURHLJVM.js.map +1 -0
- package/dist/{chunk-IWNRQVNW.js → chunk-V5GL7PTC.js} +2 -2
- package/dist/{chunk-QT7WQXCS.js → chunk-WGUQCB2Z.js} +28 -82
- package/dist/chunk-WGUQCB2Z.js.map +1 -0
- package/dist/chunk-WWY2H2YO.js +7 -0
- package/dist/chunk-WWY2H2YO.js.map +1 -0
- package/dist/{chunk-URYYGVTA.js → chunk-ZAHZVBV7.js} +60 -75
- package/dist/chunk-ZAHZVBV7.js.map +1 -0
- package/dist/{computed.types.d-IXACuBr7.d.ts → computed.types.d-D4wskgi0.d.ts} +2 -2
- package/dist/corrections.d.ts +123 -20
- package/dist/corrections.js +11 -11
- package/dist/corrections.js.map +1 -1
- package/dist/elements.d.ts +35 -112
- package/dist/elements.js +8 -5
- package/dist/index.d.ts +18 -14
- package/dist/index.js +29 -63
- package/dist/interactions.d.ts +84 -17
- package/dist/interactions.js +4 -3
- package/dist/item.css +1057 -2383
- package/dist/item.d.ts +6 -4
- package/dist/item.js +5 -4
- package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
- package/dist/loader.d.ts +4 -2
- package/dist/loader.js +1 -0
- package/dist/processing.d.ts +4 -3
- package/dist/processing.js +4 -3
- package/dist/public-events.d-3dGip9pd.d.ts +105 -0
- package/dist/qti-components-jsx.d.ts +4058 -4421
- package/dist/{qti-condition-expression.d-B-T1NNl0.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
- package/dist/{qti-expression.d-B-Cfbqlb.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
- package/dist/{qti-feedback.d-GAqMqAt6.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +2 -2
- package/dist/{qti-item.d-pFcNk0th.d.ts → qti-item.d-CLChmRvB.d.ts} +2 -1
- package/dist/qti-test-state-BAf5AmJ2.d.ts +68 -0
- package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
- package/dist/{qti-test.d-BjhVQnQy.d.ts → qti-test.d-COzv7YZG.d.ts} +14 -548
- package/dist/{qti-text-entry-interaction.d-DECzpIzi.d.ts → qti-text-entry-interaction.d-DsUyecBC.d.ts} +144 -43
- package/dist/{record.d-CljDLwRz.d.ts → record.d-BfZhFr0L.d.ts} +34 -3
- package/dist/{session.context.d-DW09Lrie.d.ts → session.context.d-9gRdGK4T.d.ts} +2 -2
- package/dist/test-plugin-api.d.ts +134 -0
- package/dist/test-plugin-api.js +19 -0
- package/dist/test-plugin-api.js.map +1 -0
- package/dist/test.d.ts +16 -158
- package/dist/test.js +13 -52
- package/dist/transformers.js +1 -0
- package/dist/{item.types.d-DuVR0ZVK.d.ts → variables.d-DWHlTszN.d.ts} +1 -23
- package/package.json +13 -9
- package/dist/chunk-5AJZGRWI.js.map +0 -1
- package/dist/chunk-G2EIC7H2.js.map +0 -1
- package/dist/chunk-IM5AKPIJ.js.map +0 -1
- package/dist/chunk-MIQZBDTB.js.map +0 -1
- package/dist/chunk-QT7WQXCS.js.map +0 -1
- package/dist/chunk-RNLSNH4N.js +0 -7
- package/dist/chunk-RNLSNH4N.js.map +0 -1
- package/dist/chunk-URYYGVTA.js.map +0 -1
- /package/dist/{chunk-F553IZPL.js.map → chunk-J3F3JSCW.js.map} +0 -0
- /package/dist/{chunk-32PI7KWX.js.map → chunk-L3LBSAGZ.js.map} +0 -0
- /package/dist/{chunk-WIUPAUJV.js.map → chunk-L7J2ZOJL.js.map} +0 -0
- /package/dist/{chunk-XY5DHYIH.js.map → chunk-OG5HIRHE.js.map} +0 -0
- /package/dist/{chunk-HT3LSWXL.js.map → chunk-QLGUI5VG.js.map} +0 -0
- /package/dist/{chunk-IWNRQVNW.js.map → chunk-V5GL7PTC.js.map} +0 -0
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
button,
|
|
3
|
+
buttonPrimary,
|
|
4
|
+
control,
|
|
5
|
+
dispatchPublic,
|
|
6
|
+
listenPublic as listenPublic2
|
|
7
|
+
} from "./chunk-J6VX4N7M.js";
|
|
8
|
+
import {
|
|
9
|
+
QtiModalFeedback
|
|
10
|
+
} from "./chunk-WGUQCB2Z.js";
|
|
11
|
+
import {
|
|
5
12
|
listenPublic
|
|
6
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UCXLDQYA.js";
|
|
7
14
|
import {
|
|
8
15
|
item_css_default
|
|
9
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WWY2H2YO.js";
|
|
10
17
|
import {
|
|
11
18
|
watch
|
|
12
19
|
} from "./chunk-4DB4SC5K.js";
|
|
@@ -21,11 +28,10 @@ import {
|
|
|
21
28
|
QtiExpression,
|
|
22
29
|
computedContext,
|
|
23
30
|
configContext,
|
|
24
|
-
isRecordValue,
|
|
25
31
|
qtiContext,
|
|
26
32
|
sessionContext,
|
|
27
33
|
testContext
|
|
28
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-NZ7ZC4SP.js";
|
|
29
35
|
|
|
30
36
|
// ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
|
|
31
37
|
import { LitElement, nothing as nothing2 } from "lit";
|
|
@@ -637,18 +643,18 @@ var EvalAstFactory = class {
|
|
|
637
643
|
}
|
|
638
644
|
const value = this.right.evaluate(scope);
|
|
639
645
|
let receiver = void 0;
|
|
640
|
-
let
|
|
646
|
+
let property15;
|
|
641
647
|
if (this.left.type === "Getter") {
|
|
642
648
|
receiver = this.left.receiver.evaluate(scope);
|
|
643
|
-
|
|
649
|
+
property15 = this.left.name;
|
|
644
650
|
} else if (this.left.type === "Index") {
|
|
645
651
|
receiver = this.left.receiver.evaluate(scope);
|
|
646
|
-
|
|
652
|
+
property15 = this.left.argument.evaluate(scope);
|
|
647
653
|
} else if (this.left.type === "ID") {
|
|
648
654
|
receiver = scope;
|
|
649
|
-
|
|
655
|
+
property15 = this.left.value;
|
|
650
656
|
}
|
|
651
|
-
return receiver === void 0 ? void 0 : receiver[
|
|
657
|
+
return receiver === void 0 ? void 0 : receiver[property15] = value;
|
|
652
658
|
}
|
|
653
659
|
return f(this.left.evaluate(scope), this.right.evaluate(scope));
|
|
654
660
|
},
|
|
@@ -1104,36 +1110,6 @@ var makeLitTemplate = (template) => {
|
|
|
1104
1110
|
import { createContext } from "@lit/context";
|
|
1105
1111
|
var testHostContext = createContext(/* @__PURE__ */ Symbol("testHost"));
|
|
1106
1112
|
|
|
1107
|
-
// ../qti-test/dist/public-events.js
|
|
1108
|
-
var PUBLIC_EVENTS = {
|
|
1109
|
-
"cito-test-navigate": { kind: "request", scope: "test", deprecated: "qti-request-navigation" },
|
|
1110
|
-
"cito-test-end-attempt": { kind: "request", scope: "test", deprecated: "test-end-attempt" },
|
|
1111
|
-
"cito-test-submit": { kind: "request", scope: "test" },
|
|
1112
|
-
"cito-test-update-outcome": { kind: "request", scope: "test", deprecated: "test-update-outcome-variable" },
|
|
1113
|
-
"cito-test-update-plugin-state": { kind: "request", scope: "test" },
|
|
1114
|
-
"cito-test-switch-view": { kind: "request", scope: "test", deprecated: "on-test-switch-view" },
|
|
1115
|
-
"cito-test-submitted": { kind: "notification", scope: "test" },
|
|
1116
|
-
"cito-test-navigated": { kind: "notification", scope: "test" },
|
|
1117
|
-
"cito-test-navigation-started": {
|
|
1118
|
-
kind: "notification",
|
|
1119
|
-
scope: "test",
|
|
1120
|
-
deprecated: "qti-navigation-loading-started"
|
|
1121
|
-
},
|
|
1122
|
-
"cito-test-navigation-failed": { kind: "notification", scope: "test", deprecated: "qti-navigation-error" },
|
|
1123
|
-
"cito-test-rendered": { kind: "notification", scope: "test", deprecated: "qti-test-loaded" },
|
|
1124
|
-
"cito-test-loaded": { kind: "notification", scope: "test", deprecated: "qti-assessment-test-connected" },
|
|
1125
|
-
"cito-test-state-changed": { kind: "notification", scope: "test", deprecated: "qti-state-changed" },
|
|
1126
|
-
"cito-test-items-skipped": { kind: "notification", scope: "test" },
|
|
1127
|
-
"cito-test-end-reached": { kind: "notification", scope: "test" },
|
|
1128
|
-
"cito-item-ref-connected": { kind: "notification", scope: "item", deprecated: "qti-assessment-item-ref-connected" }
|
|
1129
|
-
};
|
|
1130
|
-
function dispatchPublic(target, name, detail) {
|
|
1131
|
-
dispatchDeclared(target, PUBLIC_EVENTS, name, detail);
|
|
1132
|
-
}
|
|
1133
|
-
function listenPublic2(target, name, handler) {
|
|
1134
|
-
listenDeclared(target, PUBLIC_EVENTS, name, handler);
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
1113
|
// ../qti-test/dist/components/qti-assessment-item-ref/qti-assessment-item-ref.js
|
|
1138
1114
|
var __decorate = function(decorators, target, key, desc) {
|
|
1139
1115
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -1195,7 +1171,7 @@ var QtiAssessmentItemRef = class extends LitElement {
|
|
|
1195
1171
|
this.myTemplate = templateElement ? prepareTemplate(templateElement) : null;
|
|
1196
1172
|
this.requestUpdate();
|
|
1197
1173
|
await this.updateComplete;
|
|
1198
|
-
dispatchPublic(this, "
|
|
1174
|
+
dispatchPublic(this, "qc-item-ref-connected", {
|
|
1199
1175
|
identifier: this.identifier,
|
|
1200
1176
|
href: this.href,
|
|
1201
1177
|
category: this.category
|
|
@@ -1360,7 +1336,7 @@ var QtiAssessmentTest = class extends LitElement3 {
|
|
|
1360
1336
|
async connectedCallback() {
|
|
1361
1337
|
super.connectedCallback();
|
|
1362
1338
|
await this.updateComplete;
|
|
1363
|
-
dispatchPublic(this, "
|
|
1339
|
+
dispatchPublic(this, "qc-test-loaded", this);
|
|
1364
1340
|
}
|
|
1365
1341
|
render() {
|
|
1366
1342
|
return html2` <slot></slot>`;
|
|
@@ -1538,7 +1514,7 @@ var QtiNumberPresented = class extends QtiExpression {
|
|
|
1538
1514
|
#connectedTest = null;
|
|
1539
1515
|
constructor() {
|
|
1540
1516
|
super();
|
|
1541
|
-
listenPublic2(this, "
|
|
1517
|
+
listenPublic2(this, "qc-test-loaded", (e) => this.#connectedTest = e.detail);
|
|
1542
1518
|
}
|
|
1543
1519
|
/** The test this expression is in: handed over by a test harness, or found up the tree in a real document. */
|
|
1544
1520
|
get #testElement() {
|
|
@@ -1569,10 +1545,10 @@ var QtiNumberSelected = class extends QtiExpression {
|
|
|
1569
1545
|
#connectedTest = null;
|
|
1570
1546
|
constructor() {
|
|
1571
1547
|
super();
|
|
1572
|
-
listenPublic2(this, "
|
|
1548
|
+
listenPublic2(this, "qc-test-loaded", (e) => this.#connectedTest = e.detail);
|
|
1573
1549
|
}
|
|
1574
1550
|
/**
|
|
1575
|
-
* `
|
|
1551
|
+
* `qc-test-loaded` bubbles *up* from the test element, and this
|
|
1576
1552
|
* expression lives inside that test's `qti-outcome-processing` — so the
|
|
1577
1553
|
* listener above only ever fires for a test handed to us directly (a test
|
|
1578
1554
|
* harness). Walking up the tree is what resolves the test in a real document.
|
|
@@ -1747,10 +1723,10 @@ var QtiTestVariables = class extends QtiExpression {
|
|
|
1747
1723
|
#connectedTest = null;
|
|
1748
1724
|
constructor() {
|
|
1749
1725
|
super();
|
|
1750
|
-
listenPublic2(this, "
|
|
1726
|
+
listenPublic2(this, "qc-test-loaded", (e) => this.#connectedTest = e.detail);
|
|
1751
1727
|
}
|
|
1752
1728
|
/**
|
|
1753
|
-
* `
|
|
1729
|
+
* `qc-test-loaded` bubbles *up* from the test element, and this
|
|
1754
1730
|
* expression lives inside that test's `qti-outcome-processing` — so the
|
|
1755
1731
|
* listener above only ever fires for a test handed to us directly (a test
|
|
1756
1732
|
* harness). Walking up the tree is what resolves the test in a real document.
|
|
@@ -1948,15 +1924,15 @@ var TestNavigationMixin = (superClass) => {
|
|
|
1948
1924
|
navigateTo(type, id) {
|
|
1949
1925
|
const targetId = id || this._getDefaultNavigationId(type);
|
|
1950
1926
|
if (targetId) {
|
|
1951
|
-
dispatchPublic(this, "
|
|
1927
|
+
dispatchPublic(this, "qc-test-navigate", { type, id: targetId });
|
|
1952
1928
|
}
|
|
1953
1929
|
}
|
|
1954
1930
|
// ===========================================
|
|
1955
1931
|
// EVENT HANDLER SETUP
|
|
1956
1932
|
// ===========================================
|
|
1957
1933
|
_bindEventHandlers() {
|
|
1958
|
-
listenPublic2(this, "
|
|
1959
|
-
listenPublic2(this, "
|
|
1934
|
+
listenPublic2(this, "qc-test-navigate", this._handleNavigationRequest.bind(this));
|
|
1935
|
+
listenPublic2(this, "qc-test-loaded", this._handleTestConnected.bind(this));
|
|
1960
1936
|
this.addEventListener("qti-assessment-item-connected", this._handleItemConnected.bind(this));
|
|
1961
1937
|
this.addEventListener("qti-assessment-stimulus-ref-connected", this._handleStimulusRefConnected.bind(this));
|
|
1962
1938
|
}
|
|
@@ -2033,9 +2009,9 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2033
2009
|
if (refs[0]?.closest("qti-test-part")?.getAttribute("navigation-mode") === "linear") {
|
|
2034
2010
|
const first = resolveFirstItem(refs);
|
|
2035
2011
|
if (first.skipped.length)
|
|
2036
|
-
dispatchPublic(this, "
|
|
2012
|
+
dispatchPublic(this, "qc-test-items-skipped", { ids: first.skipped });
|
|
2037
2013
|
if (first.id === null) {
|
|
2038
|
-
dispatchPublic(this, "
|
|
2014
|
+
dispatchPublic(this, "qc-test-end-reached", {});
|
|
2039
2015
|
return;
|
|
2040
2016
|
}
|
|
2041
2017
|
id = first.id;
|
|
@@ -2100,8 +2076,8 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2100
2076
|
const resolved = this._resolveLinearNext(detail.type, detail.id);
|
|
2101
2077
|
if (resolved?.id === null) {
|
|
2102
2078
|
if (resolved.skipped.length)
|
|
2103
|
-
dispatchPublic(this, "
|
|
2104
|
-
dispatchPublic(this, "
|
|
2079
|
+
dispatchPublic(this, "qc-test-items-skipped", { ids: resolved.skipped });
|
|
2080
|
+
dispatchPublic(this, "qc-test-end-reached", {});
|
|
2105
2081
|
return;
|
|
2106
2082
|
}
|
|
2107
2083
|
const target = resolved?.id ?? detail.id;
|
|
@@ -2117,7 +2093,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2117
2093
|
this._activeController = controller;
|
|
2118
2094
|
await this._executeNavigation(detail.type, target, navigationId, controller);
|
|
2119
2095
|
if (resolved?.skipped.length && navigationId === this._navigationId && !controller.signal.aborted) {
|
|
2120
|
-
dispatchPublic(this, "
|
|
2096
|
+
dispatchPublic(this, "qc-test-items-skipped", { ids: resolved.skipped });
|
|
2121
2097
|
}
|
|
2122
2098
|
} catch (error) {
|
|
2123
2099
|
this._handleNavigationError(error, detail.type, target);
|
|
@@ -2396,7 +2372,7 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2396
2372
|
// EVENT DISPATCHING
|
|
2397
2373
|
// ===========================================
|
|
2398
2374
|
_dispatchLoadingStarted(type, id) {
|
|
2399
|
-
dispatchPublic(this, "
|
|
2375
|
+
dispatchPublic(this, "qc-test-navigation-started", { type, id });
|
|
2400
2376
|
}
|
|
2401
2377
|
_dispatchLoadingEnded(type, id) {
|
|
2402
2378
|
this.dispatchEvent(new CustomEvent("qti-navigation-loading-ended", {
|
|
@@ -2406,16 +2382,16 @@ var TestNavigationMixin = (superClass) => {
|
|
|
2406
2382
|
}));
|
|
2407
2383
|
}
|
|
2408
2384
|
_dispatchError(error) {
|
|
2409
|
-
dispatchPublic(this, "
|
|
2385
|
+
dispatchPublic(this, "qc-test-navigation-failed", error);
|
|
2410
2386
|
}
|
|
2411
|
-
/** The items are in the DOM: tell hosts the new position rendered (`
|
|
2387
|
+
/** The items are in the DOM: tell hosts the new position rendered (`qc-test-navigated`) and which items it holds. */
|
|
2412
2388
|
_dispatchTestLoaded(results, type, id) {
|
|
2413
2389
|
requestAnimationFrame(() => {
|
|
2414
|
-
dispatchPublic(this, "
|
|
2390
|
+
dispatchPublic(this, "qc-test-rendered", results.map(({ itemRef }) => ({
|
|
2415
2391
|
identifier: itemRef?.identifier,
|
|
2416
2392
|
element: itemRef
|
|
2417
2393
|
})));
|
|
2418
|
-
dispatchPublic(this, "
|
|
2394
|
+
dispatchPublic(this, "qc-test-navigated", { type, id });
|
|
2419
2395
|
});
|
|
2420
2396
|
}
|
|
2421
2397
|
}
|
|
@@ -2440,11 +2416,11 @@ var TestViewMixin = (superClass) => {
|
|
|
2440
2416
|
constructor(...args) {
|
|
2441
2417
|
super(...args);
|
|
2442
2418
|
this.sessionContext = { ...this.sessionContext, view: "candidate" };
|
|
2443
|
-
listenPublic2(this, "
|
|
2419
|
+
listenPublic2(this, "qc-test-switch-view", (e) => {
|
|
2444
2420
|
this.sessionContext = { ...this.sessionContext, view: e.detail };
|
|
2445
2421
|
this._updateElementView();
|
|
2446
2422
|
});
|
|
2447
|
-
listenPublic2(this, "
|
|
2423
|
+
listenPublic2(this, "qc-test-loaded", () => {
|
|
2448
2424
|
this._updateElementView();
|
|
2449
2425
|
});
|
|
2450
2426
|
this.addEventListener("qti-assessment-item-connected", (e) => {
|
|
@@ -2537,12 +2513,12 @@ var TestBaseMixin = (superClass) => {
|
|
|
2537
2513
|
* before the item has loaded. To restore a whole session, assign `state` instead.
|
|
2538
2514
|
*
|
|
2539
2515
|
* The test context is replaced rather than changed in place, so its consumers update and
|
|
2540
|
-
* `
|
|
2516
|
+
* `qc-test-state-changed` fires.
|
|
2541
2517
|
*
|
|
2542
2518
|
* @param itemRefID The `qti-assessment-item-ref` identifier, not the item's own identifier.
|
|
2543
2519
|
* @param state Opaque per-interaction state keyed by response identifier, e.g. a PCI's `getState()`.
|
|
2544
2520
|
*/
|
|
2545
|
-
updateItemVariables(itemRefID, values,
|
|
2521
|
+
updateItemVariables(itemRefID, values, state5) {
|
|
2546
2522
|
this.testContext = {
|
|
2547
2523
|
...this.testContext,
|
|
2548
2524
|
items: this.testContext.items.map((item) => {
|
|
@@ -2562,22 +2538,22 @@ var TestBaseMixin = (superClass) => {
|
|
|
2562
2538
|
else
|
|
2563
2539
|
variables.push(updated);
|
|
2564
2540
|
}
|
|
2565
|
-
return { ...item, variables, ...
|
|
2541
|
+
return { ...item, variables, ...state5 ? { state: { ...state5 } } : {} };
|
|
2566
2542
|
})
|
|
2567
2543
|
};
|
|
2568
2544
|
const assessmentItem = this._testElement?.querySelector(`qti-assessment-item-ref[identifier="${CSS.escape(itemRefID)}"]`)?.assessmentItem;
|
|
2569
2545
|
if (!assessmentItem)
|
|
2570
2546
|
return;
|
|
2571
2547
|
assessmentItem.variables = [...this.testContext.items.find((i) => i.identifier === itemRefID)?.variables ?? []];
|
|
2572
|
-
if (
|
|
2573
|
-
assessmentItem.state =
|
|
2548
|
+
if (state5)
|
|
2549
|
+
assessmentItem.state = state5;
|
|
2574
2550
|
}
|
|
2575
2551
|
_initializeEventListeners() {
|
|
2576
2552
|
this.addEventListener("qti-testdoc-loaded", () => {
|
|
2577
2553
|
this.testContext = INITIAL_TEST_CONTEXT;
|
|
2578
2554
|
this.sessionContext = INITIAL_SESSION_CONTEXT;
|
|
2579
2555
|
});
|
|
2580
|
-
listenPublic2(this, "
|
|
2556
|
+
listenPublic2(this, "qc-test-loaded", (e) => {
|
|
2581
2557
|
this._testElement = e.detail;
|
|
2582
2558
|
const items = Array.from(this._testElement.querySelectorAll("qti-assessment-item-ref")).map((itemRef) => {
|
|
2583
2559
|
return {
|
|
@@ -2607,7 +2583,7 @@ var TestBaseMixin = (superClass) => {
|
|
|
2607
2583
|
this._updateItemVariablesInTestContext(e.detail.itemContext.identifier, e.detail.itemContext.variables, e.detail.itemContext.state, e.detail.itemContext.valid);
|
|
2608
2584
|
});
|
|
2609
2585
|
}
|
|
2610
|
-
_updateItemVariablesInTestContext(identifier, variables,
|
|
2586
|
+
_updateItemVariablesInTestContext(identifier, variables, state5, valid) {
|
|
2611
2587
|
this.testContext = {
|
|
2612
2588
|
...this.testContext,
|
|
2613
2589
|
// Spread existing test context properties
|
|
@@ -2622,7 +2598,7 @@ var TestBaseMixin = (superClass) => {
|
|
|
2622
2598
|
const matchingVariable = itemContext.variables.find((v) => v.identifier === variable.identifier);
|
|
2623
2599
|
return matchingVariable ? { ...matchingVariable, ...variable } : variable;
|
|
2624
2600
|
}),
|
|
2625
|
-
...
|
|
2601
|
+
...state5 !== void 0 ? { state: state5 ? { ...state5 } : void 0 } : {},
|
|
2626
2602
|
...valid !== void 0 ? { valid } : {}
|
|
2627
2603
|
};
|
|
2628
2604
|
})
|
|
@@ -2662,8 +2638,8 @@ var TestBase = class extends TestBaseMixin(LitElement9) {
|
|
|
2662
2638
|
// ../qti-test/dist/mixins/test-state.mixin.js
|
|
2663
2639
|
var copy = (value) => Array.isArray(value) ? [...value] : value ?? null;
|
|
2664
2640
|
var isQtiTestState = (value) => {
|
|
2665
|
-
const
|
|
2666
|
-
return
|
|
2641
|
+
const state5 = value;
|
|
2642
|
+
return state5?.version === QTI_TEST_STATE_VERSION && Array.isArray(state5.test?.items) && Array.isArray(state5.test?.outcomes) && typeof state5.session === "object" && state5.session !== null;
|
|
2667
2643
|
};
|
|
2668
2644
|
var toState = (test, session) => ({
|
|
2669
2645
|
version: QTI_TEST_STATE_VERSION,
|
|
@@ -2703,8 +2679,8 @@ var TestStateMixin = (superClass) => {
|
|
|
2703
2679
|
this.#ready = false;
|
|
2704
2680
|
this.#lastEmitted = null;
|
|
2705
2681
|
});
|
|
2706
|
-
listenPublic2(this, "
|
|
2707
|
-
listenPublic2(this, "
|
|
2682
|
+
listenPublic2(this, "qc-test-update-plugin-state", ({ detail }) => this.#updatePluginState(detail));
|
|
2683
|
+
listenPublic2(this, "qc-test-loaded", () => {
|
|
2708
2684
|
if (this.#pending) {
|
|
2709
2685
|
this.#apply(this.#pending);
|
|
2710
2686
|
this.#pending = null;
|
|
@@ -2753,25 +2729,25 @@ var TestStateMixin = (superClass) => {
|
|
|
2753
2729
|
super.updated(changed);
|
|
2754
2730
|
if (!this.#ready || !(changed.has("testContext") || changed.has("sessionContext")))
|
|
2755
2731
|
return;
|
|
2756
|
-
const
|
|
2757
|
-
const serialized = JSON.stringify(
|
|
2732
|
+
const state5 = this.state;
|
|
2733
|
+
const serialized = JSON.stringify(state5);
|
|
2758
2734
|
if (serialized === this.#lastEmitted)
|
|
2759
2735
|
return;
|
|
2760
2736
|
this.#lastEmitted = serialized;
|
|
2761
|
-
dispatchPublic(this, "
|
|
2737
|
+
dispatchPublic(this, "qc-test-state-changed", state5);
|
|
2762
2738
|
}
|
|
2763
|
-
#apply(
|
|
2764
|
-
for (const saved of
|
|
2739
|
+
#apply(state5) {
|
|
2740
|
+
for (const saved of state5.test.items)
|
|
2765
2741
|
this.updateItemVariables(saved.identifier, saved.variables, saved.state);
|
|
2766
|
-
const savedOutcomes = new Map(
|
|
2742
|
+
const savedOutcomes = new Map(state5.test.outcomes.map((outcome) => [outcome.identifier, outcome.value]));
|
|
2767
2743
|
this.testContext = {
|
|
2768
2744
|
...this.testContext,
|
|
2769
2745
|
testOutcomeVariables: this.testContext.testOutcomeVariables?.map((v) => savedOutcomes.has(v.identifier) ? { ...v, value: copy(savedOutcomes.get(v.identifier)) } : v)
|
|
2770
2746
|
};
|
|
2771
2747
|
this.sessionContext = {
|
|
2772
2748
|
...this.sessionContext,
|
|
2773
|
-
...this.#validSession(
|
|
2774
|
-
plugins:
|
|
2749
|
+
...this.#validSession(state5.session),
|
|
2750
|
+
plugins: state5.session.plugins && typeof state5.session.plugins === "object" ? { ...state5.session.plugins } : {}
|
|
2775
2751
|
};
|
|
2776
2752
|
}
|
|
2777
2753
|
/** A stored position may point at an item or section a revised test no longer has. */
|
|
@@ -2784,7 +2760,7 @@ var TestStateMixin = (superClass) => {
|
|
|
2784
2760
|
};
|
|
2785
2761
|
}
|
|
2786
2762
|
#requestNavigation(type, id) {
|
|
2787
|
-
dispatchPublic(this, "
|
|
2763
|
+
dispatchPublic(this, "qc-test-navigate", { type, id });
|
|
2788
2764
|
}
|
|
2789
2765
|
}
|
|
2790
2766
|
return TestStateClass;
|
|
@@ -2802,7 +2778,7 @@ var TestProcessingMixin = (superClass) => {
|
|
|
2802
2778
|
};
|
|
2803
2779
|
e.stopPropagation();
|
|
2804
2780
|
});
|
|
2805
|
-
listenPublic2(this, "
|
|
2781
|
+
listenPublic2(this, "qc-test-submit", () => this.submit());
|
|
2806
2782
|
this.addEventListener("qti-set-outcome-value", (e) => {
|
|
2807
2783
|
const { outcomeIdentifier, value } = e.detail;
|
|
2808
2784
|
this.updateOutcomeVariable(outcomeIdentifier, value);
|
|
@@ -2825,12 +2801,12 @@ var TestProcessingMixin = (superClass) => {
|
|
|
2825
2801
|
}
|
|
2826
2802
|
/**
|
|
2827
2803
|
* Ends the test for scoring: runs `outcomeProcessing()`, then tells the host with
|
|
2828
|
-
* `
|
|
2804
|
+
* `qc-test-submitted`. Returns false, and sends nothing, when the test has no outcome processing.
|
|
2829
2805
|
*/
|
|
2830
2806
|
submit() {
|
|
2831
2807
|
if (!this.outcomeProcessing())
|
|
2832
2808
|
return false;
|
|
2833
|
-
dispatchPublic(this, "
|
|
2809
|
+
dispatchPublic(this, "qc-test-submitted", {});
|
|
2834
2810
|
return true;
|
|
2835
2811
|
}
|
|
2836
2812
|
/**
|
|
@@ -2976,7 +2952,7 @@ var TestContainer = class extends LitElement11 {
|
|
|
2976
2952
|
* Assign a new test document and announce it.
|
|
2977
2953
|
*
|
|
2978
2954
|
* The announcement has to happen here rather than on
|
|
2979
|
-
* `
|
|
2955
|
+
* `qc-test-loaded`, because by then the new document's
|
|
2980
2956
|
* children have already connected and registered themselves — a host that
|
|
2981
2957
|
* resets its context on that event throws those registrations away. Lit's
|
|
2982
2958
|
* re-render is async, so a handler running now still gets in before any child
|
|
@@ -3057,123 +3033,6 @@ __decorate13([
|
|
|
3057
3033
|
import { LitElement as LitElement12 } from "lit";
|
|
3058
3034
|
import { property as property11 } from "lit/decorators.js";
|
|
3059
3035
|
import { consume as consume7 } from "@lit/context";
|
|
3060
|
-
|
|
3061
|
-
// ../qti-test/dist/components/styles.js
|
|
3062
|
-
import { css as css5, html as html11 } from "lit";
|
|
3063
|
-
var surface = css5`var(--qti-color-base-100, var(--cito-color-base-100, Canvas))`;
|
|
3064
|
-
var content = css5`var(--qti-color-base-content, var(--cito-color-base-content, CanvasText))`;
|
|
3065
|
-
var neutral = css5`var(--qti-color-neutral, var(--cito-color-neutral, CanvasText))`;
|
|
3066
|
-
var neutralContent = css5`var(--qti-color-neutral-content, var(--cito-color-neutral-content, Canvas))`;
|
|
3067
|
-
var hostBox = css5`
|
|
3068
|
-
display: inline-flex;
|
|
3069
|
-
cursor: pointer;
|
|
3070
|
-
user-select: none;
|
|
3071
|
-
border-radius: var(--test-button-border-radius, var(--qti-radius-field, var(--cito-radius-field, 0.2rem)));
|
|
3072
|
-
`;
|
|
3073
|
-
var form = css5`
|
|
3074
|
-
display: flex;
|
|
3075
|
-
flex: 1 1 auto;
|
|
3076
|
-
align-items: center;
|
|
3077
|
-
justify-content: center;
|
|
3078
|
-
gap: 0.375em;
|
|
3079
|
-
box-sizing: border-box;
|
|
3080
|
-
min-block-size: var(--test-button-size, 2.25rem);
|
|
3081
|
-
padding: 0 0.875rem;
|
|
3082
|
-
font: inherit;
|
|
3083
|
-
line-height: 1.25;
|
|
3084
|
-
cursor: pointer;
|
|
3085
|
-
user-select: none;
|
|
3086
|
-
border-radius: var(--test-button-border-radius, var(--qti-radius-field, var(--cito-radius-field, 0.2rem)));
|
|
3087
|
-
`;
|
|
3088
|
-
var btn = css5`
|
|
3089
|
-
${form};
|
|
3090
|
-
background-color: var(--test-button-background-color, ${surface});
|
|
3091
|
-
color: var(--test-button-color, inherit);
|
|
3092
|
-
border: var(--qti-border-width, var(--cito-border-width, 1px)) solid
|
|
3093
|
-
var(--test-button-border-color, var(--qti-border-color, color-mix(in oklab, ${content} 45%, ${surface})));
|
|
3094
|
-
`;
|
|
3095
|
-
var btnPrimary = css5`
|
|
3096
|
-
background-color: var(--test-button-primary-background-color, ${neutral});
|
|
3097
|
-
color: var(--test-button-primary-color, ${neutralContent});
|
|
3098
|
-
border-color: var(--test-button-primary-background-color, ${neutral});
|
|
3099
|
-
`;
|
|
3100
|
-
var btnInteractive = css5`
|
|
3101
|
-
background-color: var(
|
|
3102
|
-
--test-button-hover-background-color,
|
|
3103
|
-
color-mix(in oklab, ${surface}, ${content} var(--qti-hover-mix, 8%))
|
|
3104
|
-
);
|
|
3105
|
-
`;
|
|
3106
|
-
var btnPrimaryInteractive = css5`
|
|
3107
|
-
background-color: var(
|
|
3108
|
-
--test-button-primary-hover-background-color,
|
|
3109
|
-
color-mix(in oklab, ${neutral}, ${neutralContent} var(--qti-hover-mix, 8%))
|
|
3110
|
-
);
|
|
3111
|
-
`;
|
|
3112
|
-
var btnActive = css5`
|
|
3113
|
-
background-color: var(
|
|
3114
|
-
--test-button-active-background-color,
|
|
3115
|
-
color-mix(in oklab, ${surface}, ${content} var(--qti-active-mix, 16%))
|
|
3116
|
-
);
|
|
3117
|
-
`;
|
|
3118
|
-
var btnPrimaryActive = css5`
|
|
3119
|
-
background-color: var(
|
|
3120
|
-
--test-button-primary-active-background-color,
|
|
3121
|
-
color-mix(in oklab, ${neutral}, ${neutralContent} var(--qti-active-mix, 16%))
|
|
3122
|
-
);
|
|
3123
|
-
`;
|
|
3124
|
-
var focusRing = css5`
|
|
3125
|
-
outline: var(--qti-focus-border-width, 2px) solid var(--qti-focus-color, Highlight);
|
|
3126
|
-
outline-offset: var(--qti-focus-offset, 2px);
|
|
3127
|
-
`;
|
|
3128
|
-
var dis = css5`
|
|
3129
|
-
cursor: not-allowed;
|
|
3130
|
-
opacity: 0.45;
|
|
3131
|
-
`;
|
|
3132
|
-
var ind = css5`
|
|
3133
|
-
${form};
|
|
3134
|
-
border: var(--qti-border-width, var(--cito-border-width, 1px)) solid var(--qti-border-color, GrayText);
|
|
3135
|
-
`;
|
|
3136
|
-
var control = html11`<span class="control" part="button"><slot></slot></span>`;
|
|
3137
|
-
var button = css5`
|
|
3138
|
-
:host {
|
|
3139
|
-
${hostBox};
|
|
3140
|
-
}
|
|
3141
|
-
.control {
|
|
3142
|
-
${btn};
|
|
3143
|
-
}
|
|
3144
|
-
@media (hover: hover) and (pointer: fine) {
|
|
3145
|
-
:host(:hover:not([disabled])) .control {
|
|
3146
|
-
${btnInteractive};
|
|
3147
|
-
}
|
|
3148
|
-
}
|
|
3149
|
-
:host(:active:not([disabled])) .control {
|
|
3150
|
-
${btnActive};
|
|
3151
|
-
}
|
|
3152
|
-
:host(:focus-visible) {
|
|
3153
|
-
${focusRing};
|
|
3154
|
-
}
|
|
3155
|
-
:host([disabled]) {
|
|
3156
|
-
${dis};
|
|
3157
|
-
}
|
|
3158
|
-
:host([disabled]) .control {
|
|
3159
|
-
cursor: not-allowed;
|
|
3160
|
-
}
|
|
3161
|
-
`;
|
|
3162
|
-
var buttonPrimary = css5`
|
|
3163
|
-
.control {
|
|
3164
|
-
${btnPrimary};
|
|
3165
|
-
}
|
|
3166
|
-
@media (hover: hover) and (pointer: fine) {
|
|
3167
|
-
:host(:hover:not([disabled])) .control {
|
|
3168
|
-
${btnPrimaryInteractive};
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
:host(:active:not([disabled])) .control {
|
|
3172
|
-
${btnPrimaryActive};
|
|
3173
|
-
}
|
|
3174
|
-
`;
|
|
3175
|
-
|
|
3176
|
-
// ../qti-test/dist/components/test-end-attempt/test-end-attempt.js
|
|
3177
3036
|
var __decorate14 = function(decorators, target, key, desc) {
|
|
3178
3037
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3179
3038
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -3204,7 +3063,7 @@ var TestEndAttempt = class extends LitElement12 {
|
|
|
3204
3063
|
e.preventDefault();
|
|
3205
3064
|
if (!this._internalDisabled) {
|
|
3206
3065
|
const itemId = this.#ownItem;
|
|
3207
|
-
dispatchPublic(this, "
|
|
3066
|
+
dispatchPublic(this, "qc-test-end-attempt", itemId ? { itemId } : {});
|
|
3208
3067
|
}
|
|
3209
3068
|
});
|
|
3210
3069
|
}
|
|
@@ -3267,40 +3126,11 @@ __decorate14([
|
|
|
3267
3126
|
watch("computedContext")
|
|
3268
3127
|
], TestEndAttempt.prototype, "_handleTestElementChange", null);
|
|
3269
3128
|
|
|
3270
|
-
// ../qti-test/dist/components/test-item-link/test-item-link.js
|
|
3271
|
-
import { LitElement as LitElement13 } from "lit";
|
|
3272
|
-
import { property as property12 } from "lit/decorators.js";
|
|
3273
|
-
var __decorate15 = function(decorators, target, key, desc) {
|
|
3274
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3275
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3276
|
-
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;
|
|
3277
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3278
|
-
};
|
|
3279
|
-
var TestItemLink = class extends LitElement13 {
|
|
3280
|
-
static {
|
|
3281
|
-
this.styles = button;
|
|
3282
|
-
}
|
|
3283
|
-
constructor() {
|
|
3284
|
-
super();
|
|
3285
|
-
this.itemId = null;
|
|
3286
|
-
this.addEventListener("click", () => this._requestItem(this.itemId));
|
|
3287
|
-
}
|
|
3288
|
-
_requestItem(identifier) {
|
|
3289
|
-
dispatchPublic(this, "cito-test-navigate", { type: "item", id: identifier });
|
|
3290
|
-
}
|
|
3291
|
-
render() {
|
|
3292
|
-
return control;
|
|
3293
|
-
}
|
|
3294
|
-
};
|
|
3295
|
-
__decorate15([
|
|
3296
|
-
property12({ type: String, attribute: "item-id" })
|
|
3297
|
-
], TestItemLink.prototype, "itemId", void 0);
|
|
3298
|
-
|
|
3299
3129
|
// ../qti-test/dist/components/test-navigation/test-navigation.js
|
|
3300
3130
|
import { ContextConsumer, consume as consume8, provide as provide3 } from "@lit/context";
|
|
3301
|
-
import { html as
|
|
3302
|
-
import { property as
|
|
3303
|
-
var
|
|
3131
|
+
import { html as html11, LitElement as LitElement13 } from "lit";
|
|
3132
|
+
import { property as property12, state as state4 } from "lit/decorators.js";
|
|
3133
|
+
var __decorate15 = function(decorators, target, key, desc) {
|
|
3304
3134
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3305
3135
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3306
3136
|
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;
|
|
@@ -3309,7 +3139,7 @@ var __decorate16 = function(decorators, target, key, desc) {
|
|
|
3309
3139
|
var newQtiContext = () => ({
|
|
3310
3140
|
QTI_CONTEXT: { testIdentifier: "", candidateIdentifier: "", environmentIdentifier: "default" }
|
|
3311
3141
|
});
|
|
3312
|
-
var TestNavigation = class extends
|
|
3142
|
+
var TestNavigation = class extends LitElement13 {
|
|
3313
3143
|
/**
|
|
3314
3144
|
* @deprecated Set `qtiContext` on `qti-test`, which provides it. This is an alias for the
|
|
3315
3145
|
* enclosing test's: reading returns it, writing replaces it, so a host that has always set the
|
|
@@ -3374,12 +3204,12 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3374
3204
|
this.#optimality = /* @__PURE__ */ new Map();
|
|
3375
3205
|
this.#itemElement = (identifier) => this.#assessmentItemFor(identifier) ?? null;
|
|
3376
3206
|
this.#lockedItems = /* @__PURE__ */ new WeakSet();
|
|
3377
|
-
listenPublic2(this, "
|
|
3207
|
+
listenPublic2(this, "qc-test-loaded", this.#handleTestConnected.bind(this));
|
|
3378
3208
|
this.addEventListener("qti-assessment-item-connected", this.#handleItemConnected.bind(this));
|
|
3379
|
-
listenPublic(this, "
|
|
3209
|
+
listenPublic(this, "qc-item-response-changed", this.#handleInteractionChanged.bind(this));
|
|
3380
3210
|
this.addEventListener("qti-item-context-updated", this.#handleItemContextUpdated.bind(this));
|
|
3381
|
-
listenPublic2(this, "
|
|
3382
|
-
listenPublic2(this, "
|
|
3211
|
+
listenPublic2(this, "qc-test-end-attempt", this.#handleTestEndAttempt.bind(this));
|
|
3212
|
+
listenPublic2(this, "qc-test-update-outcome", this.#handleTestUpdateOutcomeVariable.bind(this));
|
|
3383
3213
|
}
|
|
3384
3214
|
/**
|
|
3385
3215
|
* Latch whether an item reached its optimal outcome whenever it has just ended
|
|
@@ -3459,7 +3289,7 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3459
3289
|
}
|
|
3460
3290
|
}
|
|
3461
3291
|
render() {
|
|
3462
|
-
return
|
|
3292
|
+
return html11`<slot></slot>`;
|
|
3463
3293
|
}
|
|
3464
3294
|
/* PK: on test connected we can build the computed context */
|
|
3465
3295
|
#handleTestConnected(event) {
|
|
@@ -3871,43 +3701,43 @@ var TestNavigation = class extends LitElement14 {
|
|
|
3871
3701
|
return Number.isNaN(parsed) ? null : parsed;
|
|
3872
3702
|
}
|
|
3873
3703
|
};
|
|
3874
|
-
|
|
3875
|
-
|
|
3704
|
+
__decorate15([
|
|
3705
|
+
property12({ type: String })
|
|
3876
3706
|
], TestNavigation.prototype, "identifier", void 0);
|
|
3877
|
-
|
|
3707
|
+
__decorate15([
|
|
3878
3708
|
state4()
|
|
3879
3709
|
], TestNavigation.prototype, "initContext", void 0);
|
|
3880
|
-
|
|
3710
|
+
__decorate15([
|
|
3881
3711
|
state4(),
|
|
3882
3712
|
consume8({ context: configContext, subscribe: true })
|
|
3883
3713
|
], TestNavigation.prototype, "configContext", void 0);
|
|
3884
|
-
|
|
3714
|
+
__decorate15([
|
|
3885
3715
|
state4(),
|
|
3886
3716
|
consume8({ context: testContext, subscribe: true })
|
|
3887
3717
|
], TestNavigation.prototype, "_testContext", void 0);
|
|
3888
|
-
|
|
3718
|
+
__decorate15([
|
|
3889
3719
|
state4(),
|
|
3890
3720
|
consume8({ context: sessionContext, subscribe: true })
|
|
3891
3721
|
], TestNavigation.prototype, "_sessionContext", void 0);
|
|
3892
|
-
|
|
3722
|
+
__decorate15([
|
|
3893
3723
|
state4(),
|
|
3894
3724
|
provide3({ context: computedContext })
|
|
3895
3725
|
], TestNavigation.prototype, "computedContext", void 0);
|
|
3896
|
-
|
|
3897
|
-
|
|
3726
|
+
__decorate15([
|
|
3727
|
+
property12({ type: Boolean, attribute: "auto-score-items" })
|
|
3898
3728
|
], TestNavigation.prototype, "autoScoreItems", void 0);
|
|
3899
3729
|
|
|
3900
3730
|
// ../qti-test/dist/components/test-next/test-next.js
|
|
3901
|
-
import { LitElement as
|
|
3902
|
-
import { property as
|
|
3731
|
+
import { LitElement as LitElement14 } from "lit";
|
|
3732
|
+
import { property as property13 } from "lit/decorators.js";
|
|
3903
3733
|
import { consume as consume9 } from "@lit/context";
|
|
3904
|
-
var
|
|
3734
|
+
var __decorate16 = function(decorators, target, key, desc) {
|
|
3905
3735
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3906
3736
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3907
3737
|
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;
|
|
3908
3738
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3909
3739
|
};
|
|
3910
|
-
var TestNext = class extends
|
|
3740
|
+
var TestNext = class extends LitElement14 {
|
|
3911
3741
|
_handleTestElementChange(_oldValue, newValue) {
|
|
3912
3742
|
if (newValue) {
|
|
3913
3743
|
this.requestUpdate();
|
|
@@ -3955,33 +3785,33 @@ var TestNext = class extends LitElement15 {
|
|
|
3955
3785
|
this._internalDisabled = !this.computedContext || this.itemIndex < 0 || this.itemIndex >= (this.sectionItems?.length ?? 0) - 1 || isLinearIndividual && !activeItem?.done;
|
|
3956
3786
|
}
|
|
3957
3787
|
_requestItem(identifier) {
|
|
3958
|
-
dispatchPublic(this, "
|
|
3788
|
+
dispatchPublic(this, "qc-test-navigate", { type: "item", id: identifier });
|
|
3959
3789
|
}
|
|
3960
3790
|
render() {
|
|
3961
3791
|
return control;
|
|
3962
3792
|
}
|
|
3963
3793
|
};
|
|
3964
|
-
|
|
3965
|
-
|
|
3794
|
+
__decorate16([
|
|
3795
|
+
property13({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
3966
3796
|
], TestNext.prototype, "_internalDisabled", void 0);
|
|
3967
|
-
|
|
3797
|
+
__decorate16([
|
|
3968
3798
|
consume9({ context: computedContext, subscribe: true })
|
|
3969
3799
|
], TestNext.prototype, "computedContext", void 0);
|
|
3970
|
-
|
|
3800
|
+
__decorate16([
|
|
3971
3801
|
watch("computedContext")
|
|
3972
3802
|
], TestNext.prototype, "_handleTestElementChange", null);
|
|
3973
3803
|
|
|
3974
3804
|
// ../qti-test/dist/components/test-prev/test-prev.js
|
|
3975
|
-
import { LitElement as
|
|
3976
|
-
import { property as
|
|
3805
|
+
import { LitElement as LitElement15 } from "lit";
|
|
3806
|
+
import { property as property14 } from "lit/decorators.js";
|
|
3977
3807
|
import { consume as consume10 } from "@lit/context";
|
|
3978
|
-
var
|
|
3808
|
+
var __decorate17 = function(decorators, target, key, desc) {
|
|
3979
3809
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3980
3810
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
3981
3811
|
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;
|
|
3982
3812
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3983
3813
|
};
|
|
3984
|
-
var TestPrev = class extends
|
|
3814
|
+
var TestPrev = class extends LitElement15 {
|
|
3985
3815
|
_handleTestElementChange(_oldValue, newValue) {
|
|
3986
3816
|
if (newValue) {
|
|
3987
3817
|
this.requestUpdate();
|
|
@@ -4016,1546 +3846,39 @@ var TestPrev = class extends LitElement16 {
|
|
|
4016
3846
|
this._internalDisabled = navigationMode === "linear" || !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
|
|
4017
3847
|
}
|
|
4018
3848
|
_requestItem(identifier) {
|
|
4019
|
-
dispatchPublic(this, "
|
|
3849
|
+
dispatchPublic(this, "qc-test-navigate", { type: "item", id: identifier });
|
|
4020
3850
|
}
|
|
4021
3851
|
render() {
|
|
4022
3852
|
return control;
|
|
4023
3853
|
}
|
|
4024
3854
|
};
|
|
4025
|
-
|
|
4026
|
-
|
|
3855
|
+
__decorate17([
|
|
3856
|
+
property14({ type: Boolean, reflect: true, attribute: "disabled" })
|
|
4027
3857
|
], TestPrev.prototype, "_internalDisabled", void 0);
|
|
4028
|
-
|
|
3858
|
+
__decorate17([
|
|
4029
3859
|
consume10({ context: computedContext, subscribe: true })
|
|
4030
3860
|
], TestPrev.prototype, "computedContext", void 0);
|
|
4031
|
-
|
|
3861
|
+
__decorate17([
|
|
4032
3862
|
watch("computedContext")
|
|
4033
3863
|
], TestPrev.prototype, "_handleTestElementChange", null);
|
|
4034
3864
|
|
|
4035
|
-
// ../qti-test/dist/components/test-section-link/test-section-link.js
|
|
4036
|
-
import { LitElement as LitElement17 } from "lit";
|
|
4037
|
-
import { property as property16 } from "lit/decorators.js";
|
|
4038
|
-
var __decorate19 = function(decorators, target, key, desc) {
|
|
4039
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4040
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4041
|
-
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;
|
|
4042
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4043
|
-
};
|
|
4044
|
-
var TestSectionLink = class extends LitElement17 {
|
|
4045
|
-
static {
|
|
4046
|
-
this.styles = button;
|
|
4047
|
-
}
|
|
4048
|
-
#requestItem(identifier) {
|
|
4049
|
-
dispatchPublic(this, "cito-test-navigate", { type: "section", id: identifier });
|
|
4050
|
-
}
|
|
4051
|
-
constructor() {
|
|
4052
|
-
super();
|
|
4053
|
-
this.sectionId = null;
|
|
4054
|
-
this.addEventListener("click", () => this.#requestItem(this.sectionId));
|
|
4055
|
-
}
|
|
4056
|
-
render() {
|
|
4057
|
-
return control;
|
|
4058
|
-
}
|
|
4059
|
-
};
|
|
4060
|
-
__decorate19([
|
|
4061
|
-
property16({ type: String, attribute: "section-id" })
|
|
4062
|
-
], TestSectionLink.prototype, "sectionId", void 0);
|
|
4063
|
-
|
|
4064
|
-
// ../qti-test/dist/plugin-state.js
|
|
4065
|
-
var pluginState = (context, plugin) => context?.plugins?.[plugin];
|
|
4066
|
-
|
|
4067
|
-
// ../qti-test/dist/components/test-bookmark/test-bookmark.js
|
|
4068
|
-
import { css as css6, html as html13, LitElement as LitElement18 } from "lit";
|
|
4069
|
-
import { consume as consume11 } from "@lit/context";
|
|
4070
|
-
import { property as property17 } from "lit/decorators.js";
|
|
4071
|
-
var __decorate20 = function(decorators, target, key, desc) {
|
|
4072
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4073
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4074
|
-
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;
|
|
4075
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4076
|
-
};
|
|
4077
|
-
var bookmarkedItems = (context) => pluginState(context, "bookmarks") ?? [];
|
|
4078
|
-
var itemRefOf2 = (element) => {
|
|
4079
|
-
const itemRef = element.closest("qti-assessment-item-ref");
|
|
4080
|
-
if (itemRef)
|
|
4081
|
-
return itemRef.getAttribute("identifier") ?? void 0;
|
|
4082
|
-
const root = element.getRootNode();
|
|
4083
|
-
return root instanceof ShadowRoot ? itemRefOf2(root.host) : void 0;
|
|
4084
|
-
};
|
|
4085
|
-
var TestBookmark = class extends LitElement18 {
|
|
4086
|
-
static {
|
|
4087
|
-
this.styles = [
|
|
4088
|
-
button,
|
|
4089
|
-
css6`
|
|
4090
|
-
svg {
|
|
4091
|
-
width: 1.1em;
|
|
4092
|
-
height: 1.1em;
|
|
4093
|
-
flex: none;
|
|
4094
|
-
fill: none;
|
|
4095
|
-
stroke: currentColor;
|
|
4096
|
-
stroke-width: 2;
|
|
4097
|
-
stroke-linejoin: round;
|
|
4098
|
-
}
|
|
4099
|
-
:host([bookmarked]) {
|
|
4100
|
-
color: var(--qti-bookmark-color, #b45309);
|
|
4101
|
-
}
|
|
4102
|
-
:host([bookmarked]) svg {
|
|
4103
|
-
fill: currentColor;
|
|
4104
|
-
}
|
|
4105
|
-
`
|
|
4106
|
-
];
|
|
4107
|
-
}
|
|
4108
|
-
constructor() {
|
|
4109
|
-
super();
|
|
4110
|
-
this.bookmarked = false;
|
|
4111
|
-
this.disabled = false;
|
|
4112
|
-
this.addEventListener("click", () => this.#toggle());
|
|
4113
|
-
this.addEventListener("keydown", (event) => {
|
|
4114
|
-
if (event.key !== "Enter" && event.key !== " ")
|
|
4115
|
-
return;
|
|
4116
|
-
event.preventDefault();
|
|
4117
|
-
this.#toggle();
|
|
4118
|
-
});
|
|
4119
|
-
}
|
|
4120
|
-
connectedCallback() {
|
|
4121
|
-
super.connectedCallback();
|
|
4122
|
-
if (!this.hasAttribute("role"))
|
|
4123
|
-
this.setAttribute("role", "button");
|
|
4124
|
-
if (!this.hasAttribute("tabindex"))
|
|
4125
|
-
this.setAttribute("tabindex", "0");
|
|
4126
|
-
}
|
|
4127
|
-
/** The item this button marks: its own, or else the one on screen. */
|
|
4128
|
-
get #activeItem() {
|
|
4129
|
-
return this.item || (itemRefOf2(this) ?? this.computedContext?.testParts?.flatMap((part) => part.sections.flatMap((section) => section.items)).find((item) => item.active)?.identifier);
|
|
4130
|
-
}
|
|
4131
|
-
willUpdate() {
|
|
4132
|
-
const active = this.#activeItem;
|
|
4133
|
-
this.disabled = !active;
|
|
4134
|
-
this.bookmarked = !!active && bookmarkedItems(this.computedContext).includes(active);
|
|
4135
|
-
}
|
|
4136
|
-
updated() {
|
|
4137
|
-
this.setAttribute("aria-pressed", String(this.bookmarked));
|
|
4138
|
-
this.setAttribute("aria-disabled", String(this.disabled));
|
|
4139
|
-
}
|
|
4140
|
-
#toggle() {
|
|
4141
|
-
const active = this.#activeItem;
|
|
4142
|
-
if (!active)
|
|
4143
|
-
return;
|
|
4144
|
-
const marked = bookmarkedItems(this.computedContext);
|
|
4145
|
-
const next = marked.includes(active) ? marked.filter((id) => id !== active) : [...marked, active];
|
|
4146
|
-
dispatchPublic(this, "cito-test-update-plugin-state", {
|
|
4147
|
-
plugin: "bookmarks",
|
|
4148
|
-
value: next.length > 0 ? next : null
|
|
4149
|
-
});
|
|
4150
|
-
}
|
|
4151
|
-
render() {
|
|
4152
|
-
return html13`<span class="control" part="button"
|
|
4153
|
-
><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 3h12v18l-6-4.5L6 21z" /></svg><slot></slot
|
|
4154
|
-
></span>`;
|
|
4155
|
-
}
|
|
4156
|
-
};
|
|
4157
|
-
__decorate20([
|
|
4158
|
-
consume11({ context: computedContext, subscribe: true }),
|
|
4159
|
-
property17({ attribute: false })
|
|
4160
|
-
], TestBookmark.prototype, "computedContext", void 0);
|
|
4161
|
-
__decorate20([
|
|
4162
|
-
property17({ reflect: true })
|
|
4163
|
-
], TestBookmark.prototype, "item", void 0);
|
|
4164
|
-
__decorate20([
|
|
4165
|
-
property17({ type: Boolean, reflect: true })
|
|
4166
|
-
], TestBookmark.prototype, "bookmarked", void 0);
|
|
4167
|
-
__decorate20([
|
|
4168
|
-
property17({ type: Boolean, reflect: true })
|
|
4169
|
-
], TestBookmark.prototype, "disabled", void 0);
|
|
4170
|
-
|
|
4171
|
-
// ../qti-test/dist/components/test-check-item/test-check-item.js
|
|
4172
|
-
import { LitElement as LitElement19 } from "lit";
|
|
4173
|
-
import { property as property18 } from "lit/decorators.js";
|
|
4174
|
-
var __decorate21 = function(decorators, target, key, desc) {
|
|
4175
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4176
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4177
|
-
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;
|
|
4178
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4179
|
-
};
|
|
4180
|
-
var TestCheckItem = class extends LitElement19 {
|
|
4181
|
-
static {
|
|
4182
|
-
this.styles = button;
|
|
4183
|
-
}
|
|
4184
|
-
constructor() {
|
|
4185
|
-
super();
|
|
4186
|
-
this.view = "scorer";
|
|
4187
|
-
this.addEventListener("click", () => {
|
|
4188
|
-
dispatchPublic(this, "cito-test-end-attempt", {});
|
|
4189
|
-
dispatchPublic(this, "cito-test-switch-view", this.view);
|
|
4190
|
-
});
|
|
4191
|
-
}
|
|
4192
|
-
render() {
|
|
4193
|
-
return control;
|
|
4194
|
-
}
|
|
4195
|
-
};
|
|
4196
|
-
__decorate21([
|
|
4197
|
-
property18({ type: String })
|
|
4198
|
-
], TestCheckItem.prototype, "view", void 0);
|
|
4199
|
-
|
|
4200
|
-
// ../qti-test/dist/components/test-print-context/test-print-context.js
|
|
4201
|
-
import { html as html14, LitElement as LitElement20 } from "lit";
|
|
4202
|
-
import { consume as consume12 } from "@lit/context";
|
|
4203
|
-
import { state as state5 } from "lit/decorators.js";
|
|
4204
|
-
var __decorate22 = function(decorators, target, key, desc) {
|
|
4205
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4206
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4207
|
-
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;
|
|
4208
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4209
|
-
};
|
|
4210
|
-
var TestPrintContext = class extends LitElement20 {
|
|
4211
|
-
render() {
|
|
4212
|
-
return html14` <small><pre>${JSON.stringify(this.computedContext, null, 2)}</pre></small> `;
|
|
4213
|
-
}
|
|
4214
|
-
};
|
|
4215
|
-
__decorate22([
|
|
4216
|
-
state5(),
|
|
4217
|
-
consume12({ context: computedContext, subscribe: true })
|
|
4218
|
-
], TestPrintContext.prototype, "computedContext", void 0);
|
|
4219
|
-
|
|
4220
|
-
// ../qti-test/dist/components/test-print-item-variables/test-print-item-variables.js
|
|
4221
|
-
import { html as html15, css as css7, LitElement as LitElement21 } from "lit";
|
|
4222
|
-
import { consume as consume13 } from "@lit/context";
|
|
4223
|
-
var __decorate23 = function(decorators, target, key, desc) {
|
|
4224
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4225
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4226
|
-
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;
|
|
4227
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4228
|
-
};
|
|
4229
|
-
var formatVariableValue = (value) => {
|
|
4230
|
-
if (value === null || value === void 0)
|
|
4231
|
-
return "";
|
|
4232
|
-
if (Array.isArray(value))
|
|
4233
|
-
return value.map(formatVariableValue).join(", ");
|
|
4234
|
-
if (isRecordValue(value)) {
|
|
4235
|
-
return Object.entries(value).map(([field, fieldValue]) => `${field}: ${formatVariableValue(fieldValue)}`).join(", ");
|
|
4236
|
-
}
|
|
4237
|
-
return String(value);
|
|
4238
|
-
};
|
|
4239
|
-
var TestPrintVariables = class extends LitElement21 {
|
|
4240
|
-
static {
|
|
4241
|
-
this.styles = css7`
|
|
4242
|
-
table {
|
|
4243
|
-
width: 100%;
|
|
4244
|
-
border-collapse: collapse;
|
|
4245
|
-
margin: 20px 0;
|
|
4246
|
-
font-size: 14px;
|
|
4247
|
-
text-align: left;
|
|
4248
|
-
}
|
|
4249
|
-
th,
|
|
4250
|
-
td {
|
|
4251
|
-
border: 1px solid #ddd;
|
|
4252
|
-
padding: 8px;
|
|
4253
|
-
}
|
|
4254
|
-
th {
|
|
4255
|
-
background-color: #f4f4f4;
|
|
4256
|
-
font-weight: bold;
|
|
4257
|
-
}
|
|
4258
|
-
h3 {
|
|
4259
|
-
margin-top: 20px;
|
|
4260
|
-
font-size: 16px;
|
|
4261
|
-
}
|
|
4262
|
-
`;
|
|
4263
|
-
}
|
|
4264
|
-
render() {
|
|
4265
|
-
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
4266
|
-
if (!activeItem || !activeItem.variables)
|
|
4267
|
-
return html15``;
|
|
4268
|
-
const responseVariables = activeItem.variables.filter((v) => v.type === "response");
|
|
4269
|
-
const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
|
|
4270
|
-
const renderTable = (variables, title) => html15`
|
|
4271
|
-
<h3>${title}</h3>
|
|
4272
|
-
<table>
|
|
4273
|
-
<thead>
|
|
4274
|
-
<tr>
|
|
4275
|
-
<th>Identifier</th>
|
|
4276
|
-
<th>Value</th>
|
|
4277
|
-
<th>Cardinality</th>
|
|
4278
|
-
<th>Base Type</th>
|
|
4279
|
-
<th>Correct Response / Mappings</th>
|
|
4280
|
-
</tr>
|
|
4281
|
-
</thead>
|
|
4282
|
-
<tbody>
|
|
4283
|
-
${variables.map((v) => {
|
|
4284
|
-
const correctResponse = formatVariableValue(v.correctResponse);
|
|
4285
|
-
const mapEntries = v.mapping?.mapEntries?.map((m) => `${m.mapKey}=${m.mappedValue}pt`).join(", ") || "";
|
|
4286
|
-
const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m) => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(", ") || "";
|
|
4287
|
-
return html15`
|
|
4288
|
-
<tr>
|
|
4289
|
-
<td>${v.identifier}</td>
|
|
4290
|
-
<td>${formatVariableValue(v.value)}</td>
|
|
4291
|
-
<td>${v.cardinality}</td>
|
|
4292
|
-
<td>${v.baseType}</td>
|
|
4293
|
-
<td>${correctResponse || mapEntries || areaMapEntries}</td>
|
|
4294
|
-
</tr>
|
|
4295
|
-
`;
|
|
4296
|
-
})}
|
|
4297
|
-
</tbody>
|
|
4298
|
-
</table>
|
|
4299
|
-
`;
|
|
4300
|
-
return html15`
|
|
4301
|
-
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
4302
|
-
`;
|
|
4303
|
-
}
|
|
4304
|
-
};
|
|
4305
|
-
__decorate23([
|
|
4306
|
-
consume13({ context: computedContext, subscribe: true })
|
|
4307
|
-
], TestPrintVariables.prototype, "computedContext", void 0);
|
|
4308
|
-
|
|
4309
|
-
// ../qti-test/dist/components/test-print-state/test-print-state.js
|
|
4310
|
-
import { css as css8, html as html16, LitElement as LitElement22, nothing as nothing3 } from "lit";
|
|
4311
|
-
import { state as state6 } from "lit/decorators.js";
|
|
4312
|
-
var __decorate24 = function(decorators, target, key, desc) {
|
|
4313
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4314
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4315
|
-
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;
|
|
4316
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4317
|
-
};
|
|
4318
|
-
var TestPrintState = class extends LitElement22 {
|
|
4319
|
-
#test = null;
|
|
4320
|
-
static {
|
|
4321
|
-
this.styles = css8`
|
|
4322
|
-
:host {
|
|
4323
|
-
display: block;
|
|
4324
|
-
}
|
|
4325
|
-
ul {
|
|
4326
|
-
list-style: none;
|
|
4327
|
-
margin: 0;
|
|
4328
|
-
padding-inline-start: 1rem;
|
|
4329
|
-
}
|
|
4330
|
-
summary {
|
|
4331
|
-
cursor: pointer;
|
|
4332
|
-
}
|
|
4333
|
-
[part~='count'] {
|
|
4334
|
-
opacity: 0.7;
|
|
4335
|
-
}
|
|
4336
|
-
`;
|
|
4337
|
-
}
|
|
4338
|
-
#onStateChanged = (event) => {
|
|
4339
|
-
this.testState = event.detail;
|
|
4340
|
-
};
|
|
4341
|
-
connectedCallback() {
|
|
4342
|
-
super.connectedCallback();
|
|
4343
|
-
this.#test = this.closest("qti-test");
|
|
4344
|
-
this.#test?.addEventListener("cito-test-state-changed", this.#onStateChanged);
|
|
4345
|
-
this.testState = this.#test?.state;
|
|
4346
|
-
}
|
|
4347
|
-
disconnectedCallback() {
|
|
4348
|
-
super.disconnectedCallback();
|
|
4349
|
-
this.#test?.removeEventListener("cito-test-state-changed", this.#onStateChanged);
|
|
4350
|
-
this.#test = null;
|
|
4351
|
-
}
|
|
4352
|
-
render() {
|
|
4353
|
-
if (!this.testState)
|
|
4354
|
-
return nothing3;
|
|
4355
|
-
return html16`<ul>
|
|
4356
|
-
${this.#renderNode("state", this.testState, 0)}
|
|
4357
|
-
</ul>`;
|
|
4358
|
-
}
|
|
4359
|
-
#renderNode(label, value, depth) {
|
|
4360
|
-
if (value === null || typeof value !== "object") {
|
|
4361
|
-
return html16`<li><span part="key">${label}</span>: <span part="value">${JSON.stringify(value)}</span></li>`;
|
|
4362
|
-
}
|
|
4363
|
-
const entries = Array.isArray(value) ? value.map((entry, index) => [entryLabel(entry, index), entry]) : Object.entries(value);
|
|
4364
|
-
const count = Array.isArray(value) ? `[${entries.length}]` : `{${entries.length}}`;
|
|
4365
|
-
return html16`<li>
|
|
4366
|
-
<details ?open=${depth < 2}>
|
|
4367
|
-
<summary><span part="key">${label}</span> <span part="count">${count}</span></summary>
|
|
4368
|
-
<ul>
|
|
4369
|
-
${entries.map(([key, entry]) => this.#renderNode(key, entry, depth + 1))}
|
|
4370
|
-
</ul>
|
|
4371
|
-
</details>
|
|
4372
|
-
</li>`;
|
|
4373
|
-
}
|
|
4374
|
-
};
|
|
4375
|
-
__decorate24([
|
|
4376
|
-
state6()
|
|
4377
|
-
], TestPrintState.prototype, "testState", void 0);
|
|
4378
|
-
var entryLabel = (entry, index) => {
|
|
4379
|
-
const identifier = entry?.identifier;
|
|
4380
|
-
return typeof identifier === "string" ? `${index} \xB7 ${identifier}` : String(index);
|
|
4381
|
-
};
|
|
4382
|
-
|
|
4383
|
-
// ../qti-test/dist/components/test-scoring-buttons/test-scoring-buttons.js
|
|
4384
|
-
import { html as html17, LitElement as LitElement23, nothing as nothing4 } from "lit";
|
|
4385
|
-
import { consume as consume14 } from "@lit/context";
|
|
4386
|
-
import { property as property19 } from "lit/decorators.js";
|
|
4387
|
-
var __decorate25 = function(decorators, target, key, desc) {
|
|
4388
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4389
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4390
|
-
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;
|
|
4391
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4392
|
-
};
|
|
4393
|
-
var TestScoringButtons = class extends LitElement23 {
|
|
4394
|
-
createRenderRoot() {
|
|
4395
|
-
return this;
|
|
4396
|
-
}
|
|
4397
|
-
connectedCallback() {
|
|
4398
|
-
super.connectedCallback();
|
|
4399
|
-
const templateElement = this.querySelector("template");
|
|
4400
|
-
if (!templateElement) {
|
|
4401
|
-
this.myTemplate = null;
|
|
4402
|
-
return;
|
|
4403
|
-
}
|
|
4404
|
-
this.myTemplate = prepareTemplate(templateElement);
|
|
4405
|
-
}
|
|
4406
|
-
#changeOutcomeScore(value) {
|
|
4407
|
-
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
4408
|
-
const sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
4409
|
-
const currentItemIdentifier = sectionItems.find((item) => item.active)?.identifier;
|
|
4410
|
-
dispatchPublic(this, "cito-test-update-outcome", {
|
|
4411
|
-
assessmentItemRefId: currentItemIdentifier,
|
|
4412
|
-
outcomeVariableId: "SCORE",
|
|
4413
|
-
value
|
|
4414
|
-
});
|
|
4415
|
-
}
|
|
4416
|
-
render() {
|
|
4417
|
-
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
4418
|
-
if (!activeItem || !activeItem.variables)
|
|
4419
|
-
return html17``;
|
|
4420
|
-
const maxScore = activeItem.variables.find((vr) => vr.identifier == "MAXSCORE")?.value;
|
|
4421
|
-
const scoreOutcome = activeItem.variables.find((vr) => vr.identifier == "SCORE");
|
|
4422
|
-
const score = scoreOutcome?.value;
|
|
4423
|
-
const disabled = !(scoreOutcome?.externalScored === "human");
|
|
4424
|
-
if (!maxScore || !scoreOutcome)
|
|
4425
|
-
return nothing4;
|
|
4426
|
-
const scores = [...Array(Number(maxScore) + 1).keys()];
|
|
4427
|
-
return html17`${this.myTemplate ? this.myTemplate({ scores, score, disabled }) : nothing4}`;
|
|
4428
|
-
}
|
|
4429
|
-
constructor() {
|
|
4430
|
-
super();
|
|
4431
|
-
this.view = "";
|
|
4432
|
-
this.disabled = false;
|
|
4433
|
-
this.myTemplate = null;
|
|
4434
|
-
this.addEventListener("click", (e) => {
|
|
4435
|
-
const target = e.target;
|
|
4436
|
-
const value = parseFloat(target.value);
|
|
4437
|
-
if (target.tagName === "INPUT") {
|
|
4438
|
-
this.#changeOutcomeScore(value);
|
|
4439
|
-
}
|
|
4440
|
-
});
|
|
4441
|
-
}
|
|
4442
|
-
};
|
|
4443
|
-
__decorate25([
|
|
4444
|
-
property19({ type: String, attribute: "view" })
|
|
4445
|
-
], TestScoringButtons.prototype, "view", void 0);
|
|
4446
|
-
__decorate25([
|
|
4447
|
-
property19({ type: Boolean })
|
|
4448
|
-
], TestScoringButtons.prototype, "disabled", void 0);
|
|
4449
|
-
__decorate25([
|
|
4450
|
-
consume14({ context: computedContext, subscribe: true })
|
|
4451
|
-
], TestScoringButtons.prototype, "computedContext", void 0);
|
|
4452
|
-
|
|
4453
|
-
// ../qti-test/dist/components/test-scoring-feedback/test-scoring-feedback.js
|
|
4454
|
-
import { consume as consume15 } from "@lit/context";
|
|
4455
|
-
import { html as html18, LitElement as LitElement24 } from "lit";
|
|
4456
|
-
import { property as property20 } from "lit/decorators.js";
|
|
4457
|
-
var __decorate26 = function(decorators, target, key, desc) {
|
|
4458
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4459
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4460
|
-
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;
|
|
4461
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4462
|
-
};
|
|
4463
|
-
var TestScoringFeedback = class extends LitElement24 {
|
|
4464
|
-
constructor() {
|
|
4465
|
-
super(...arguments);
|
|
4466
|
-
this.view = null;
|
|
4467
|
-
}
|
|
4468
|
-
render() {
|
|
4469
|
-
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
4470
|
-
if (!activeItem || !activeItem.variables)
|
|
4471
|
-
return html18``;
|
|
4472
|
-
if (activeItem["category"] === "dep-informational")
|
|
4473
|
-
return html18`<div>${this.dataset.informational}</div>`;
|
|
4474
|
-
const scoreOutcome = activeItem?.variables.find((vr) => vr.identifier == "SCORE");
|
|
4475
|
-
const score = parseFloat(scoreOutcome?.value);
|
|
4476
|
-
const externalScored = activeItem["externalScored"];
|
|
4477
|
-
const feedbackText = () => {
|
|
4478
|
-
if (activeItem.valid === false || activeItem.isDefaultResponse) {
|
|
4479
|
-
return this.dataset.textNoResponse;
|
|
4480
|
-
}
|
|
4481
|
-
if (!externalScored && score !== void 0 && !Number.isNaN(score)) {
|
|
4482
|
-
return score > 0 ? this.dataset.textCorrect : this.dataset.textIncorrect;
|
|
4483
|
-
}
|
|
4484
|
-
if (externalScored === "externalMachine") {
|
|
4485
|
-
return Number.isNaN(score) || score === void 0 ? this.dataset.scoreUnknown : `We hebben je antwoord ${score === 0 ? "geen punten" : score == 1 ? "\xE9\xE9n punt" : `${score} punten`} gegeven. Je kunt je score zelf aanpassen als je denkt dat dat niet klopt.`;
|
|
4486
|
-
}
|
|
4487
|
-
if (externalScored === "human") {
|
|
4488
|
-
return Number.isNaN(score) ? "" : "Deze score heb je zelf toegekend.";
|
|
4489
|
-
}
|
|
4490
|
-
return this.dataset.inProgress;
|
|
4491
|
-
};
|
|
4492
|
-
return html18`<div>${feedbackText()}</div>`;
|
|
4493
|
-
}
|
|
4494
|
-
};
|
|
4495
|
-
__decorate26([
|
|
4496
|
-
consume15({ context: computedContext, subscribe: true })
|
|
4497
|
-
], TestScoringFeedback.prototype, "computedContext", void 0);
|
|
4498
|
-
__decorate26([
|
|
4499
|
-
property20({ type: String, attribute: "view" })
|
|
4500
|
-
], TestScoringFeedback.prototype, "view", void 0);
|
|
4501
|
-
|
|
4502
|
-
// ../qti-test/dist/components/test-stamp/test-stamp.js
|
|
4503
|
-
import { html as html19, LitElement as LitElement25, nothing as nothing5 } from "lit";
|
|
4504
|
-
import { property as property21, state as state7 } from "lit/decorators.js";
|
|
4505
|
-
import { consume as consume16 } from "@lit/context";
|
|
4506
|
-
var __decorate27 = function(decorators, target, key, desc) {
|
|
4507
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4508
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4509
|
-
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;
|
|
4510
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4511
|
-
};
|
|
4512
|
-
var TestStamp = class extends LitElement25 {
|
|
4513
|
-
constructor() {
|
|
4514
|
-
super(...arguments);
|
|
4515
|
-
this.debug = false;
|
|
4516
|
-
this.stampContext = {
|
|
4517
|
-
view: "candidate",
|
|
4518
|
-
activeItem: {},
|
|
4519
|
-
activeSection: {
|
|
4520
|
-
items: []
|
|
4521
|
-
},
|
|
4522
|
-
activeTestpart: {
|
|
4523
|
-
items: [],
|
|
4524
|
-
sections: []
|
|
4525
|
-
},
|
|
4526
|
-
test: {}
|
|
4527
|
-
};
|
|
4528
|
-
}
|
|
4529
|
-
createRenderRoot() {
|
|
4530
|
-
return this;
|
|
4531
|
-
}
|
|
4532
|
-
connectedCallback() {
|
|
4533
|
-
super.connectedCallback();
|
|
4534
|
-
const templateElement = this.querySelector("template");
|
|
4535
|
-
if (!templateElement) {
|
|
4536
|
-
this.myTemplate = null;
|
|
4537
|
-
return;
|
|
4538
|
-
}
|
|
4539
|
-
this.myTemplate = prepareTemplate(templateElement);
|
|
4540
|
-
}
|
|
4541
|
-
willUpdate(_changedProperties) {
|
|
4542
|
-
if (!this.computedContext) {
|
|
4543
|
-
return;
|
|
4544
|
-
}
|
|
4545
|
-
const activeTestPart = this.computedContext.testParts.find((testPart) => testPart.active);
|
|
4546
|
-
const activeSection = activeTestPart?.sections.find((section) => section.active);
|
|
4547
|
-
const activeItem = activeSection?.items.find((item) => item.active);
|
|
4548
|
-
const { variables, ...augmentedItem } = activeItem || {};
|
|
4549
|
-
if (!activeTestPart) {
|
|
4550
|
-
return;
|
|
4551
|
-
}
|
|
4552
|
-
const augmentedTestPart = {
|
|
4553
|
-
...activeTestPart,
|
|
4554
|
-
items: activeTestPart.sections.flatMap((section) => section.items.map(({ variables: variables2, ...rest }) => rest)),
|
|
4555
|
-
sections: activeTestPart.sections.map((section) => ({
|
|
4556
|
-
...section,
|
|
4557
|
-
items: section.items.map(({ variables: variables2, ...rest }) => rest)
|
|
4558
|
-
}))
|
|
4559
|
-
};
|
|
4560
|
-
const augmentedSection = {
|
|
4561
|
-
...activeSection,
|
|
4562
|
-
items: (activeSection?.items ?? []).map(({ variables: variables2, ...rest }) => rest)
|
|
4563
|
-
};
|
|
4564
|
-
const { testParts, ...activeTest } = this.computedContext;
|
|
4565
|
-
this.stampContext = {
|
|
4566
|
-
view: this.computedContext.view,
|
|
4567
|
-
activeItem: augmentedItem,
|
|
4568
|
-
activeSection: augmentedSection,
|
|
4569
|
-
activeTestpart: augmentedTestPart,
|
|
4570
|
-
test: activeTest
|
|
4571
|
-
};
|
|
4572
|
-
this.dispatchEvent(new CustomEvent("qti-stamp-context-updated", {
|
|
4573
|
-
detail: this.stampContext,
|
|
4574
|
-
bubbles: true
|
|
4575
|
-
}));
|
|
4576
|
-
}
|
|
4577
|
-
render() {
|
|
4578
|
-
return html19` ${this.debug ? html19`<small><pre>${JSON.stringify(this.stampContext, null, 2)}</pre></small>` : nothing5}
|
|
4579
|
-
${this.myTemplate ? this.myTemplate(this.stampContext) : nothing5}`;
|
|
4580
|
-
}
|
|
4581
|
-
};
|
|
4582
|
-
__decorate27([
|
|
4583
|
-
property21({ type: Boolean, reflect: true })
|
|
4584
|
-
], TestStamp.prototype, "debug", void 0);
|
|
4585
|
-
__decorate27([
|
|
4586
|
-
state7(),
|
|
4587
|
-
consume16({ context: computedContext, subscribe: true })
|
|
4588
|
-
], TestStamp.prototype, "computedContext", void 0);
|
|
4589
|
-
__decorate27([
|
|
4590
|
-
state7()
|
|
4591
|
-
], TestStamp.prototype, "stampContext", void 0);
|
|
4592
|
-
|
|
4593
3865
|
// ../qti-test/dist/components/test-submit/test-submit.js
|
|
4594
|
-
import { LitElement as
|
|
4595
|
-
var TestSubmit = class extends
|
|
3866
|
+
import { LitElement as LitElement16 } from "lit";
|
|
3867
|
+
var TestSubmit = class extends LitElement16 {
|
|
4596
3868
|
static {
|
|
4597
3869
|
this.styles = button;
|
|
4598
3870
|
}
|
|
4599
3871
|
constructor() {
|
|
4600
3872
|
super();
|
|
4601
|
-
this.addEventListener("click", () => dispatchPublic(this, "
|
|
3873
|
+
this.addEventListener("click", () => dispatchPublic(this, "qc-test-submit", {}));
|
|
4602
3874
|
}
|
|
4603
3875
|
render() {
|
|
4604
3876
|
return control;
|
|
4605
3877
|
}
|
|
4606
3878
|
};
|
|
4607
3879
|
|
|
4608
|
-
// ../qti-test/dist/components/test-view-toggle/test-view.js
|
|
4609
|
-
import { html as html20, LitElement as LitElement27 } from "lit";
|
|
4610
|
-
import { property as property22, state as state8 } from "lit/decorators.js";
|
|
4611
|
-
import { consume as consume17 } from "@lit/context";
|
|
4612
|
-
var __decorate28 = function(decorators, target, key, desc) {
|
|
4613
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4614
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4615
|
-
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;
|
|
4616
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4617
|
-
};
|
|
4618
|
-
var _a;
|
|
4619
|
-
var TestView = class extends LitElement27 {
|
|
4620
|
-
constructor() {
|
|
4621
|
-
super(...arguments);
|
|
4622
|
-
this.label = "view";
|
|
4623
|
-
this._handleViewOptionsChange = () => {
|
|
4624
|
-
this.#updateViewOptions();
|
|
4625
|
-
};
|
|
4626
|
-
this._viewOptions = _a.DEFAULT_VIEW_OPTIONS;
|
|
4627
|
-
}
|
|
4628
|
-
static {
|
|
4629
|
-
this.DEFAULT_VIEW_OPTIONS = ["author", "candidate", "proctor", "scorer", "testConstructor", "tutor"];
|
|
4630
|
-
}
|
|
4631
|
-
connectedCallback() {
|
|
4632
|
-
super.connectedCallback();
|
|
4633
|
-
this.#updateViewOptions();
|
|
4634
|
-
}
|
|
4635
|
-
#updateViewOptions() {
|
|
4636
|
-
if (this.viewOptions) {
|
|
4637
|
-
const options = this.viewOptions.split(",").map((opt) => opt.trim());
|
|
4638
|
-
this._viewOptions = options.filter((opt) => _a.DEFAULT_VIEW_OPTIONS.includes(opt));
|
|
4639
|
-
} else {
|
|
4640
|
-
this._viewOptions = _a.DEFAULT_VIEW_OPTIONS;
|
|
4641
|
-
}
|
|
4642
|
-
}
|
|
4643
|
-
_switchView(view) {
|
|
4644
|
-
dispatchPublic(this, "cito-test-switch-view", view);
|
|
4645
|
-
}
|
|
4646
|
-
render() {
|
|
4647
|
-
return html20`
|
|
4648
|
-
<label part="label" for="viewSelect">${this.label}</label>
|
|
4649
|
-
<select
|
|
4650
|
-
part="select"
|
|
4651
|
-
id="viewSelect"
|
|
4652
|
-
@change=${(e) => {
|
|
4653
|
-
const el = e.target;
|
|
4654
|
-
this._switchView(el.value);
|
|
4655
|
-
}}
|
|
4656
|
-
>
|
|
4657
|
-
${this._viewOptions.map((v) => html20`<option value="${v}" ?selected=${v === this.sessionContext.view}>${v}</option>`)}
|
|
4658
|
-
</select>
|
|
4659
|
-
`;
|
|
4660
|
-
}
|
|
4661
|
-
};
|
|
4662
|
-
_a = TestView;
|
|
4663
|
-
__decorate28([
|
|
4664
|
-
consume17({ context: sessionContext, subscribe: true })
|
|
4665
|
-
], TestView.prototype, "sessionContext", void 0);
|
|
4666
|
-
__decorate28([
|
|
4667
|
-
property22({ type: String })
|
|
4668
|
-
], TestView.prototype, "label", void 0);
|
|
4669
|
-
__decorate28([
|
|
4670
|
-
property22({ type: String, attribute: "view-options" })
|
|
4671
|
-
], TestView.prototype, "viewOptions", void 0);
|
|
4672
|
-
__decorate28([
|
|
4673
|
-
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
4674
|
-
], TestView.prototype, "_handleViewOptionsChange", void 0);
|
|
4675
|
-
__decorate28([
|
|
4676
|
-
state8()
|
|
4677
|
-
], TestView.prototype, "_viewOptions", void 0);
|
|
4678
|
-
|
|
4679
|
-
// ../qti-test/dist/components/test-view-toggle/test-view-toggle.js
|
|
4680
|
-
import { consume as consume18 } from "@lit/context";
|
|
4681
|
-
import { html as html21, LitElement as LitElement28, nothing as nothing6 } from "lit";
|
|
4682
|
-
var __decorate29 = function(decorators, target, key, desc) {
|
|
4683
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4684
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4685
|
-
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;
|
|
4686
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4687
|
-
};
|
|
4688
|
-
var TestViewToggle = class extends LitElement28 {
|
|
4689
|
-
createRenderRoot() {
|
|
4690
|
-
return this;
|
|
4691
|
-
}
|
|
4692
|
-
connectedCallback() {
|
|
4693
|
-
super.connectedCallback();
|
|
4694
|
-
const templateElement = this.querySelector("template");
|
|
4695
|
-
if (!templateElement) {
|
|
4696
|
-
this.myTemplate = null;
|
|
4697
|
-
return;
|
|
4698
|
-
}
|
|
4699
|
-
this.myTemplate = prepareTemplate(templateElement);
|
|
4700
|
-
}
|
|
4701
|
-
_switchView(view) {
|
|
4702
|
-
dispatchPublic(this, "cito-test-switch-view", view);
|
|
4703
|
-
}
|
|
4704
|
-
firstUpdated(_changedProperties) {
|
|
4705
|
-
this.addEventListener("click", () => {
|
|
4706
|
-
if (this.sessionContext?.view === "scorer") {
|
|
4707
|
-
this._switchView("candidate");
|
|
4708
|
-
} else {
|
|
4709
|
-
this._switchView("scorer");
|
|
4710
|
-
}
|
|
4711
|
-
});
|
|
4712
|
-
}
|
|
4713
|
-
render() {
|
|
4714
|
-
return html21`${this.myTemplate ? this.myTemplate({
|
|
4715
|
-
view: this.sessionContext?.view
|
|
4716
|
-
}) : nothing6}`;
|
|
4717
|
-
}
|
|
4718
|
-
};
|
|
4719
|
-
__decorate29([
|
|
4720
|
-
consume18({ context: sessionContext, subscribe: true })
|
|
4721
|
-
], TestViewToggle.prototype, "sessionContext", void 0);
|
|
4722
|
-
|
|
4723
|
-
// ../qti-test/dist/tts/test-item-to-speech.js
|
|
4724
|
-
import { html as html22, LitElement as LitElement29, css as css9 } from "lit";
|
|
4725
|
-
import { consume as consume19, provide as provide4, createContext as createContext2 } from "@lit/context";
|
|
4726
|
-
import { property as property23, state as state9 } from "lit/decorators.js";
|
|
4727
|
-
import { ifDefined } from "lit/directives/if-defined.js";
|
|
4728
|
-
var __decorate30 = function(decorators, target, key, desc) {
|
|
4729
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4730
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4731
|
-
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;
|
|
4732
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
4733
|
-
};
|
|
4734
|
-
var HIGHLIGHT_ELEMENT = "tts-element";
|
|
4735
|
-
var HIGHLIGHT_WORD = "tts-word";
|
|
4736
|
-
var highlightSheet = null;
|
|
4737
|
-
function getHighlightSheet() {
|
|
4738
|
-
if (!highlightSheet) {
|
|
4739
|
-
highlightSheet = new CSSStyleSheet();
|
|
4740
|
-
highlightSheet.replaceSync(`
|
|
4741
|
-
::highlight(${HIGHLIGHT_ELEMENT}) {
|
|
4742
|
-
background-color: var(--test-tts-element-highlight, color-mix(in oklab, var(--qti-color-info, var(--cito-color-info, Highlight)) 15%, transparent));
|
|
4743
|
-
color: inherit;
|
|
4744
|
-
}
|
|
4745
|
-
::highlight(${HIGHLIGHT_WORD}) {
|
|
4746
|
-
background-color: var(--test-tts-word-highlight, color-mix(in oklab, var(--qti-color-warning, var(--cito-color-warning, Mark)) 55%, transparent));
|
|
4747
|
-
color: inherit;
|
|
4748
|
-
}
|
|
4749
|
-
`);
|
|
4750
|
-
}
|
|
4751
|
-
return highlightSheet;
|
|
4752
|
-
}
|
|
4753
|
-
var ttsContext = createContext2(/* @__PURE__ */ Symbol("tts-context"));
|
|
4754
|
-
var ICONS = {
|
|
4755
|
-
play: "M8 5v14l11-7z",
|
|
4756
|
-
pause: "M6 5h4v14H6zM14 5h4v14h-4z",
|
|
4757
|
-
stop: "M6 6h12v12H6z",
|
|
4758
|
-
prev: "M6 5h2v14H6zM20 5v14L9 12z",
|
|
4759
|
-
next: "M16 5h2v14h-2zM4 5v14l11-7z",
|
|
4760
|
-
pick: "M5 3l13 7-5.5 1.6 3.4 6.6-2.4 1.3-3.4-6.7L6 17z"
|
|
4761
|
-
};
|
|
4762
|
-
var iconContent = (icon, label) => {
|
|
4763
|
-
const svg = html22`<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
|
4764
|
-
<path d="${ICONS[icon]}"></path>
|
|
4765
|
-
</svg>`;
|
|
4766
|
-
return html22`${svg}<span class="label">${label}</span>`;
|
|
4767
|
-
};
|
|
4768
|
-
var TtsButtonBase = class extends LitElement29 {
|
|
4769
|
-
static {
|
|
4770
|
-
this.styles = css9`
|
|
4771
|
-
:host {
|
|
4772
|
-
display: inline-flex;
|
|
4773
|
-
}
|
|
4774
|
-
button {
|
|
4775
|
-
${btn};
|
|
4776
|
-
min-inline-size: var(--test-button-size, 2.25rem);
|
|
4777
|
-
padding-inline: 0.5rem;
|
|
4778
|
-
/* Containing block for the visually hidden .label. Without it the label is placed against
|
|
4779
|
-
the nearest positioned ancestor, which can sit outside a scroll container and make the
|
|
4780
|
-
page as tall as the scrolled content. */
|
|
4781
|
-
position: relative;
|
|
4782
|
-
}
|
|
4783
|
-
@media (hover: hover) and (pointer: fine) {
|
|
4784
|
-
button:hover:not(:disabled) {
|
|
4785
|
-
${btnInteractive};
|
|
4786
|
-
}
|
|
4787
|
-
}
|
|
4788
|
-
button:active:not(:disabled) {
|
|
4789
|
-
${btnActive};
|
|
4790
|
-
}
|
|
4791
|
-
button:focus-visible {
|
|
4792
|
-
${focusRing};
|
|
4793
|
-
}
|
|
4794
|
-
button:disabled {
|
|
4795
|
-
${dis};
|
|
4796
|
-
}
|
|
4797
|
-
button[aria-pressed='true'],
|
|
4798
|
-
button[aria-pressed='true']:hover {
|
|
4799
|
-
background-color: var(--test-button-selected-background-color, var(--qti-selected-bg, Highlight));
|
|
4800
|
-
color: var(--test-button-selected-color, var(--qti-selected-color, HighlightText));
|
|
4801
|
-
}
|
|
4802
|
-
svg,
|
|
4803
|
-
::slotted(svg) {
|
|
4804
|
-
flex: none;
|
|
4805
|
-
inline-size: var(--test-tts-icon-size, 1.125rem);
|
|
4806
|
-
block-size: var(--test-tts-icon-size, 1.125rem);
|
|
4807
|
-
}
|
|
4808
|
-
svg {
|
|
4809
|
-
fill: currentColor;
|
|
4810
|
-
}
|
|
4811
|
-
/* The default content is icon-only; this keeps the button's accessible name. */
|
|
4812
|
-
.label {
|
|
4813
|
-
position: absolute;
|
|
4814
|
-
inline-size: 1px;
|
|
4815
|
-
block-size: 1px;
|
|
4816
|
-
overflow: hidden;
|
|
4817
|
-
clip-path: inset(50%);
|
|
4818
|
-
white-space: nowrap;
|
|
4819
|
-
}
|
|
4820
|
-
`;
|
|
4821
|
-
}
|
|
4822
|
-
#internals = this.attachInternals();
|
|
4823
|
-
#mirroredState;
|
|
4824
|
-
#mirroredPicking = false;
|
|
4825
|
-
updated(_changed) {
|
|
4826
|
-
const state10 = this._tts?.state;
|
|
4827
|
-
const picking = this._tts?.picking ?? false;
|
|
4828
|
-
if (state10 === this.#mirroredState && picking === this.#mirroredPicking)
|
|
4829
|
-
return;
|
|
4830
|
-
this.#mirroredState = state10;
|
|
4831
|
-
this.#mirroredPicking = picking;
|
|
4832
|
-
this.#internals.states.clear();
|
|
4833
|
-
if (state10)
|
|
4834
|
-
this.#internals.states.add(state10);
|
|
4835
|
-
if (picking)
|
|
4836
|
-
this.#internals.states.add("picking");
|
|
4837
|
-
}
|
|
4838
|
-
};
|
|
4839
|
-
__decorate30([
|
|
4840
|
-
property23({ type: String })
|
|
4841
|
-
], TtsButtonBase.prototype, "label", void 0);
|
|
4842
|
-
__decorate30([
|
|
4843
|
-
consume19({ context: ttsContext, subscribe: true })
|
|
4844
|
-
], TtsButtonBase.prototype, "_tts", void 0);
|
|
4845
|
-
var TestItemToSpeech = class extends LitElement29 {
|
|
4846
|
-
static {
|
|
4847
|
-
this.styles = css9`
|
|
4848
|
-
:host {
|
|
4849
|
-
display: inline-flex;
|
|
4850
|
-
flex-wrap: wrap;
|
|
4851
|
-
align-items: center;
|
|
4852
|
-
gap: var(--test-tts-gap, 0.25rem);
|
|
4853
|
-
}
|
|
4854
|
-
`;
|
|
4855
|
-
}
|
|
4856
|
-
#internals;
|
|
4857
|
-
// Stimulus mode: set on connect when a stimulus placeholder sits next to the player. The
|
|
4858
|
-
// placeholder itself is looked up on every use — a host may swap the element.
|
|
4859
|
-
#stimulusMode;
|
|
4860
|
-
// Stimulus mode: resets the player when the stimulus content next to it is replaced.
|
|
4861
|
-
#stimulusObserver;
|
|
4862
|
-
// Content mode: set on connect when a `[data-tts-content]` element sits next to the player.
|
|
4863
|
-
// Any HTML, not QTI. No observer: the reading list is rebuilt on demand (#getReadingElements).
|
|
4864
|
-
#contentMode;
|
|
4865
|
-
// Item-ref mode: the item-ref this player sits in, resolved on connect. Null means cursor mode.
|
|
4866
|
-
#itemRef;
|
|
4867
|
-
// Item-ref mode: our item-ref, for its item-connected event. Cursor mode: where prev/next's
|
|
4868
|
-
// navigation request is heard.
|
|
4869
|
-
#eventHost;
|
|
4870
|
-
#boundHandleItemConnected;
|
|
4871
|
-
#boundHandleNavigation;
|
|
4872
|
-
// Cursor mode: the previous navigation position, to detect moving to another item or section.
|
|
4873
|
-
#prevNavItemRefId;
|
|
4874
|
-
#prevNavSectionId;
|
|
4875
|
-
// Current set of block-level reading elements for the item, and the root they were collected from
|
|
4876
|
-
#readingElements;
|
|
4877
|
-
#readingRoot;
|
|
4878
|
-
#currentElementIndex;
|
|
4879
|
-
// Text nodes of the element currently being spoken (for word-boundary highlight)
|
|
4880
|
-
#textNodes;
|
|
4881
|
-
// The utterance this player is speaking; lets the error handler tell "our speech was
|
|
4882
|
-
// cancelled by another player" apart from a cancel we issued ourselves.
|
|
4883
|
-
#currentUtterance;
|
|
4884
|
-
// Pick mode: all elements highlighted, a click on one starts reading from there.
|
|
4885
|
-
#picking;
|
|
4886
|
-
#pickRoot;
|
|
4887
|
-
#boundHandlePickClick;
|
|
4888
|
-
// Set when the last element has been read: the cursor stays on it (so prev still works),
|
|
4889
|
-
// but the next play starts the item over instead of repeating that last element.
|
|
4890
|
-
#finished;
|
|
4891
|
-
// Two separate CSS Highlight objects
|
|
4892
|
-
#elementHighlight;
|
|
4893
|
-
// whole-element cursor
|
|
4894
|
-
#wordHighlight;
|
|
4895
|
-
// current word during speech
|
|
4896
|
-
constructor() {
|
|
4897
|
-
super();
|
|
4898
|
-
this.language = "nl-NL";
|
|
4899
|
-
this.#internals = this.attachInternals();
|
|
4900
|
-
this.#stimulusMode = false;
|
|
4901
|
-
this.#stimulusObserver = null;
|
|
4902
|
-
this.#contentMode = false;
|
|
4903
|
-
this.#itemRef = null;
|
|
4904
|
-
this.#eventHost = null;
|
|
4905
|
-
this.#boundHandleItemConnected = this.#handleItemConnected.bind(this);
|
|
4906
|
-
this.#boundHandleNavigation = () => this.#stop();
|
|
4907
|
-
this.#prevNavItemRefId = void 0;
|
|
4908
|
-
this.#prevNavSectionId = void 0;
|
|
4909
|
-
this.#readingElements = null;
|
|
4910
|
-
this.#readingRoot = null;
|
|
4911
|
-
this.#currentElementIndex = 0;
|
|
4912
|
-
this.#textNodes = [];
|
|
4913
|
-
this.#currentUtterance = null;
|
|
4914
|
-
this.#picking = false;
|
|
4915
|
-
this.#pickRoot = null;
|
|
4916
|
-
this.#boundHandlePickClick = this.#handlePickClick.bind(this);
|
|
4917
|
-
this.#finished = false;
|
|
4918
|
-
this.#elementHighlight = new Highlight();
|
|
4919
|
-
this.#wordHighlight = new Highlight();
|
|
4920
|
-
this._ttsContext = {
|
|
4921
|
-
state: "idle",
|
|
4922
|
-
currentElementIndex: 0,
|
|
4923
|
-
elementCount: 0,
|
|
4924
|
-
play: () => this.#playSpeech(),
|
|
4925
|
-
pause: () => this.#pause(),
|
|
4926
|
-
resume: () => this.#resume(),
|
|
4927
|
-
stop: () => {
|
|
4928
|
-
this.#stopPicking();
|
|
4929
|
-
this.#stop();
|
|
4930
|
-
},
|
|
4931
|
-
prevElement: () => this.#prevElement(),
|
|
4932
|
-
nextElement: () => this.#nextElement(),
|
|
4933
|
-
togglePick: () => this.#togglePick(),
|
|
4934
|
-
picking: false
|
|
4935
|
-
};
|
|
4936
|
-
}
|
|
4937
|
-
// willUpdate, not updated: resetting writes _ttsContext, and state set here goes into the
|
|
4938
|
-
// render already under way instead of scheduling a second one (Lit's change-in-update).
|
|
4939
|
-
willUpdate(changed) {
|
|
4940
|
-
super.willUpdate(changed);
|
|
4941
|
-
if (this.#stimulusMode || this.#contentMode || this.#itemRef)
|
|
4942
|
-
return;
|
|
4943
|
-
const { item, section } = this.#activePosition();
|
|
4944
|
-
const itemChanged = this.#prevNavItemRefId !== void 0 && this.#prevNavItemRefId !== item;
|
|
4945
|
-
const sectionChanged = this.#prevNavSectionId !== void 0 && this.#prevNavSectionId !== section;
|
|
4946
|
-
const rerendered = this.#readingElements !== null && this.#readingRoot !== null && this.#readingRoot !== this.#resolveReadingRoot();
|
|
4947
|
-
if (itemChanged || sectionChanged || rerendered)
|
|
4948
|
-
this.#resetReadingPosition();
|
|
4949
|
-
this.#prevNavItemRefId = item;
|
|
4950
|
-
this.#prevNavSectionId = section;
|
|
4951
|
-
}
|
|
4952
|
-
/** Stop speech and forget the collected reading elements, so the next play starts afresh. */
|
|
4953
|
-
#resetReadingPosition() {
|
|
4954
|
-
this.#stopPicking();
|
|
4955
|
-
this.#stop();
|
|
4956
|
-
this.#readingElements = null;
|
|
4957
|
-
this.#currentElementIndex = 0;
|
|
4958
|
-
this.#finished = false;
|
|
4959
|
-
this.#updateContext();
|
|
4960
|
-
}
|
|
4961
|
-
connectedCallback() {
|
|
4962
|
-
super.connectedCallback();
|
|
4963
|
-
this.#setSpeechState("idle");
|
|
4964
|
-
this.#stimulusMode = this.#stimulusPlaceholder() !== null;
|
|
4965
|
-
if (this.#stimulusMode) {
|
|
4966
|
-
this.#stimulusObserver = new MutationObserver((records) => {
|
|
4967
|
-
if (records.some((record) => !this.contains(record.target)))
|
|
4968
|
-
this.#handleStimulusReplaced();
|
|
4969
|
-
});
|
|
4970
|
-
this.#stimulusObserver.observe(this.parentElement, { childList: true, subtree: true });
|
|
4971
|
-
return;
|
|
4972
|
-
}
|
|
4973
|
-
this.#contentMode = this.#contentElement() !== null;
|
|
4974
|
-
if (this.#contentMode)
|
|
4975
|
-
return;
|
|
4976
|
-
this.#itemRef = this.closest("qti-assessment-item-ref");
|
|
4977
|
-
if (this.#itemRef) {
|
|
4978
|
-
this.#eventHost = this.#itemRef;
|
|
4979
|
-
this.#eventHost.addEventListener("qti-assessment-item-connected", this.#boundHandleItemConnected);
|
|
4980
|
-
} else {
|
|
4981
|
-
this.#eventHost = this.closest("test-navigation") ?? this.getRootNode();
|
|
4982
|
-
this.#eventHost.addEventListener("cito-test-navigate", this.#boundHandleNavigation);
|
|
4983
|
-
this.#eventHost.addEventListener("qti-request-navigation", this.#boundHandleNavigation);
|
|
4984
|
-
}
|
|
4985
|
-
}
|
|
4986
|
-
disconnectedCallback() {
|
|
4987
|
-
super.disconnectedCallback();
|
|
4988
|
-
if (this.#currentUtterance) {
|
|
4989
|
-
this.#currentUtterance = null;
|
|
4990
|
-
speechSynthesis.cancel();
|
|
4991
|
-
}
|
|
4992
|
-
this.#stopPicking();
|
|
4993
|
-
this.#clearAllHighlights();
|
|
4994
|
-
this.#eventHost?.removeEventListener("qti-assessment-item-connected", this.#boundHandleItemConnected);
|
|
4995
|
-
this.#eventHost?.removeEventListener("cito-test-navigate", this.#boundHandleNavigation);
|
|
4996
|
-
this.#eventHost?.removeEventListener("qti-request-navigation", this.#boundHandleNavigation);
|
|
4997
|
-
this.#eventHost = null;
|
|
4998
|
-
this.#itemRef = null;
|
|
4999
|
-
this.#stimulusObserver?.disconnect();
|
|
5000
|
-
this.#stimulusObserver = null;
|
|
5001
|
-
this.#stimulusMode = false;
|
|
5002
|
-
this.#contentMode = false;
|
|
5003
|
-
}
|
|
5004
|
-
render() {
|
|
5005
|
-
return html22`<slot></slot>`;
|
|
5006
|
-
}
|
|
5007
|
-
/** Item-ref mode: our item rendered again, so the elements collected earlier are detached. */
|
|
5008
|
-
#handleItemConnected() {
|
|
5009
|
-
if (this.#readingElements !== null)
|
|
5010
|
-
this.#resetReadingPosition();
|
|
5011
|
-
}
|
|
5012
|
-
/** Cursor mode: the active item and section, from the computed context. */
|
|
5013
|
-
#activePosition() {
|
|
5014
|
-
for (const part of this._computedContext?.testParts ?? []) {
|
|
5015
|
-
for (const section of part.sections) {
|
|
5016
|
-
if (!section.active)
|
|
5017
|
-
continue;
|
|
5018
|
-
return { item: section.items.find((item) => item.active)?.identifier ?? null, section: section.identifier };
|
|
5019
|
-
}
|
|
5020
|
-
}
|
|
5021
|
-
return { item: null, section: null };
|
|
5022
|
-
}
|
|
5023
|
-
/**
|
|
5024
|
-
* Stimulus mode: the stimulus next to the player was (re)loaded or swapped. Forget what was
|
|
5025
|
-
* collected, so the next play reads the new content from the top. Unlike
|
|
5026
|
-
* #resetReadingPosition this only cancels speech that is ours: a stimulus can finish loading
|
|
5027
|
-
* while an item player on the same page is speaking.
|
|
5028
|
-
*/
|
|
5029
|
-
#handleStimulusReplaced() {
|
|
5030
|
-
if (this.#currentUtterance) {
|
|
5031
|
-
this.#currentUtterance = null;
|
|
5032
|
-
speechSynthesis.cancel();
|
|
5033
|
-
}
|
|
5034
|
-
this.#stopPicking();
|
|
5035
|
-
this.#clearAllHighlights();
|
|
5036
|
-
this.#setSpeechState("idle");
|
|
5037
|
-
this.#readingElements = null;
|
|
5038
|
-
this.#currentElementIndex = 0;
|
|
5039
|
-
this.#finished = false;
|
|
5040
|
-
this.#updateContext();
|
|
5041
|
-
}
|
|
5042
|
-
/**
|
|
5043
|
-
* Stimulus mode: the `[data-stimulus-idref]` placeholder that shares this player's parent, or
|
|
5044
|
-
* null. A placeholder holds the stimulus once loaded; the player cannot sit inside it, because
|
|
5045
|
-
* loading replaces the placeholder's content.
|
|
5046
|
-
*/
|
|
5047
|
-
#stimulusPlaceholder() {
|
|
5048
|
-
return this.parentElement?.querySelector(":scope > [data-stimulus-idref]") ?? null;
|
|
5049
|
-
}
|
|
5050
|
-
/**
|
|
5051
|
-
* Content mode: the `[data-tts-content]` element that shares this player's parent, or null.
|
|
5052
|
-
* The marker goes on one container; the player finds the readable elements inside it.
|
|
5053
|
-
*/
|
|
5054
|
-
#contentElement() {
|
|
5055
|
-
return this.parentElement?.querySelector(":scope > [data-tts-content]") ?? null;
|
|
5056
|
-
}
|
|
5057
|
-
/**
|
|
5058
|
-
* The element whose text is read: the stimulus body next to the player (stimulus mode), the
|
|
5059
|
-
* marked content next to it (content mode), or the item body of the item to read.
|
|
5060
|
-
*/
|
|
5061
|
-
#resolveReadingRoot() {
|
|
5062
|
-
if (this.#stimulusMode)
|
|
5063
|
-
return this.#stimulusPlaceholder()?.querySelector("qti-stimulus-body") ?? null;
|
|
5064
|
-
if (this.#contentMode)
|
|
5065
|
-
return this.#contentElement();
|
|
5066
|
-
return this.#resolveItem()?.querySelector("qti-item-body") ?? null;
|
|
5067
|
-
}
|
|
5068
|
-
/**
|
|
5069
|
-
* The item to read: our item-ref's (item-ref mode), or the active one (cursor mode). The test
|
|
5070
|
-
* looks the active one up in its own items (`computedContext.itemElement`), so a page with
|
|
5071
|
-
* several tests showing the same item still reads the right one.
|
|
5072
|
-
*/
|
|
5073
|
-
#resolveItem() {
|
|
5074
|
-
if (this.#itemRef)
|
|
5075
|
-
return this.#itemRef.assessmentItem;
|
|
5076
|
-
const { item } = this.#activePosition();
|
|
5077
|
-
return item ? this._computedContext?.itemElement?.(item) ?? null : null;
|
|
5078
|
-
}
|
|
5079
|
-
/** Update speech state on both the context (notifies children) and the host's CSS custom states. */
|
|
5080
|
-
#setSpeechState(state10) {
|
|
5081
|
-
this._ttsContext = { ...this._ttsContext, state: state10 };
|
|
5082
|
-
this.#internals.states.delete("idle");
|
|
5083
|
-
this.#internals.states.delete("playing");
|
|
5084
|
-
this.#internals.states.delete("paused");
|
|
5085
|
-
this.#internals.states.add(state10);
|
|
5086
|
-
}
|
|
5087
|
-
/** Push currentElementIndex and elementCount into context so children can react. */
|
|
5088
|
-
#updateContext() {
|
|
5089
|
-
this._ttsContext = {
|
|
5090
|
-
...this._ttsContext,
|
|
5091
|
-
currentElementIndex: this.#currentElementIndex,
|
|
5092
|
-
elementCount: this.#getReadingElements().length
|
|
5093
|
-
};
|
|
5094
|
-
}
|
|
5095
|
-
/**
|
|
5096
|
-
* Return the currently readable elements: cached candidates for the item or stimulus (collected lazily on
|
|
5097
|
-
* first call), filtered live for visibility on every call. Feedback and other
|
|
5098
|
-
* conditionally-shown content (e.g. `qti-feedback-block`, which is `display: none` until a
|
|
5099
|
-
* CSS custom state reveals it) is excluded while hidden and picked up again once shown,
|
|
5100
|
-
* without needing to re-collect the candidate set.
|
|
5101
|
-
*/
|
|
5102
|
-
#getReadingElements() {
|
|
5103
|
-
if (this.#contentMode && this.#readingElements?.some((el) => !el.isConnected)) {
|
|
5104
|
-
this.#readingElements = null;
|
|
5105
|
-
this.#currentElementIndex = 0;
|
|
5106
|
-
this.#finished = false;
|
|
5107
|
-
}
|
|
5108
|
-
if (this.#readingElements === null) {
|
|
5109
|
-
const root = this.#resolveReadingRoot();
|
|
5110
|
-
if (!root)
|
|
5111
|
-
return [];
|
|
5112
|
-
this.#readingRoot = root;
|
|
5113
|
-
const selector = "p, h1, h2, h3, h4, h5, h6, li, dt, dd, th, td, caption, blockquote, figcaption, qti-prompt, qti-simple-choice";
|
|
5114
|
-
this.#readingElements = Array.from(root.querySelectorAll(selector)).filter((el) => (el.textContent ?? "").trim().length > 0 && !el.querySelector(selector) && !el.closest('[aria-hidden="true"]'));
|
|
5115
|
-
}
|
|
5116
|
-
return this.#readingElements.filter((el) => this.#isVisible(el));
|
|
5117
|
-
}
|
|
5118
|
-
/** True when an element is actually rendered — not `display: none` (itself or an ancestor). */
|
|
5119
|
-
#isVisible(element) {
|
|
5120
|
-
if (typeof element.checkVisibility === "function") {
|
|
5121
|
-
return element.checkVisibility({ checkOpacity: false, checkVisibilityCSS: true });
|
|
5122
|
-
}
|
|
5123
|
-
return element.getClientRects().length > 0;
|
|
5124
|
-
}
|
|
5125
|
-
/**
|
|
5126
|
-
* Resolve the speech language for a reading element.
|
|
5127
|
-
* Element `lang` → closest ancestor `lang` (crossing shadow hosts) → `<html lang>` → `language` attribute.
|
|
5128
|
-
* Empty `lang=""` is treated as absent.
|
|
5129
|
-
*/
|
|
5130
|
-
#resolveLang(element) {
|
|
5131
|
-
let node = element;
|
|
5132
|
-
while (node) {
|
|
5133
|
-
const lang = node.getAttribute("lang") || node.getAttribute("xml:lang");
|
|
5134
|
-
if (lang?.trim())
|
|
5135
|
-
return lang.trim();
|
|
5136
|
-
node = node.parentElement ?? node.getRootNode().host ?? null;
|
|
5137
|
-
}
|
|
5138
|
-
const documentLang = document.documentElement.getAttribute("lang");
|
|
5139
|
-
if (documentLang?.trim())
|
|
5140
|
-
return documentLang.trim();
|
|
5141
|
-
return this.language;
|
|
5142
|
-
}
|
|
5143
|
-
#playSpeech() {
|
|
5144
|
-
const elements = this.#getReadingElements();
|
|
5145
|
-
if (!elements.length) {
|
|
5146
|
-
console.warn("test-item-to-speech: no readable elements found");
|
|
5147
|
-
return;
|
|
5148
|
-
}
|
|
5149
|
-
this.#stopPicking();
|
|
5150
|
-
speechSynthesis.cancel();
|
|
5151
|
-
if (this.#finished) {
|
|
5152
|
-
this.#finished = false;
|
|
5153
|
-
this.#currentElementIndex = 0;
|
|
5154
|
-
}
|
|
5155
|
-
if (this.#contentMode && this.#currentElementIndex === 0)
|
|
5156
|
-
this.#readingElements = null;
|
|
5157
|
-
this.#speakElement(this.#currentElementIndex);
|
|
5158
|
-
}
|
|
5159
|
-
/** Speak the element at the given index, then auto-advance when it ends. */
|
|
5160
|
-
#speakElement(index) {
|
|
5161
|
-
const elements = this.#getReadingElements();
|
|
5162
|
-
if (index >= elements.length) {
|
|
5163
|
-
this.#clearWordHighlight();
|
|
5164
|
-
this.#currentElementIndex = elements.length - 1;
|
|
5165
|
-
if (elements.length > 0)
|
|
5166
|
-
this.#highlightElement(elements[this.#currentElementIndex]);
|
|
5167
|
-
this.#finished = true;
|
|
5168
|
-
this.#setSpeechState("idle");
|
|
5169
|
-
this.#updateContext();
|
|
5170
|
-
return;
|
|
5171
|
-
}
|
|
5172
|
-
this.#currentElementIndex = index;
|
|
5173
|
-
this.#finished = false;
|
|
5174
|
-
this.#updateContext();
|
|
5175
|
-
const element = elements[index];
|
|
5176
|
-
element.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5177
|
-
this.#highlightElement(element);
|
|
5178
|
-
this.#textNodes = this.#collectTextNodes(element);
|
|
5179
|
-
const text = this.#textNodes.map((n) => n.textContent ?? "").join("");
|
|
5180
|
-
if (!text.trim()) {
|
|
5181
|
-
this.#speakElement(index + 1);
|
|
5182
|
-
return;
|
|
5183
|
-
}
|
|
5184
|
-
const utterance = new SpeechSynthesisUtterance(text);
|
|
5185
|
-
utterance.lang = this.#resolveLang(element);
|
|
5186
|
-
utterance.rate = 1;
|
|
5187
|
-
utterance.onboundary = (event) => {
|
|
5188
|
-
if (event.name !== "word")
|
|
5189
|
-
return;
|
|
5190
|
-
this.#updateWordHighlight(event.charIndex, event.charLength ?? 0);
|
|
5191
|
-
};
|
|
5192
|
-
utterance.onend = () => {
|
|
5193
|
-
if (this.#currentUtterance !== utterance)
|
|
5194
|
-
return;
|
|
5195
|
-
this.#currentUtterance = null;
|
|
5196
|
-
this.#clearWordHighlight();
|
|
5197
|
-
this.#speakElement(this.#currentElementIndex + 1);
|
|
5198
|
-
};
|
|
5199
|
-
utterance.onerror = () => {
|
|
5200
|
-
if (this.#currentUtterance !== utterance)
|
|
5201
|
-
return;
|
|
5202
|
-
this.#currentUtterance = null;
|
|
5203
|
-
this.#clearAllHighlights();
|
|
5204
|
-
this.#setSpeechState("idle");
|
|
5205
|
-
};
|
|
5206
|
-
this.#currentUtterance = utterance;
|
|
5207
|
-
speechSynthesis.speak(utterance);
|
|
5208
|
-
this.#setSpeechState("playing");
|
|
5209
|
-
}
|
|
5210
|
-
#pause() {
|
|
5211
|
-
speechSynthesis.pause();
|
|
5212
|
-
this.#setSpeechState("paused");
|
|
5213
|
-
}
|
|
5214
|
-
#resume() {
|
|
5215
|
-
speechSynthesis.resume();
|
|
5216
|
-
this.#setSpeechState("playing");
|
|
5217
|
-
}
|
|
5218
|
-
#stop() {
|
|
5219
|
-
this.#currentUtterance = null;
|
|
5220
|
-
speechSynthesis.cancel();
|
|
5221
|
-
this.#clearAllHighlights();
|
|
5222
|
-
this.#setSpeechState("idle");
|
|
5223
|
-
}
|
|
5224
|
-
// ─── Pick mode ────────────────────────────────────────────────────────────
|
|
5225
|
-
#togglePick() {
|
|
5226
|
-
if (this.#picking)
|
|
5227
|
-
this.#stopPicking();
|
|
5228
|
-
else
|
|
5229
|
-
this.#startPicking();
|
|
5230
|
-
}
|
|
5231
|
-
/** Highlight every reading element and wait for a click on one of them. */
|
|
5232
|
-
#startPicking() {
|
|
5233
|
-
if (this.#contentMode)
|
|
5234
|
-
this.#readingElements = null;
|
|
5235
|
-
const elements = this.#getReadingElements();
|
|
5236
|
-
if (!elements.length) {
|
|
5237
|
-
console.warn("test-item-to-speech: no readable elements found");
|
|
5238
|
-
return;
|
|
5239
|
-
}
|
|
5240
|
-
this.#stop();
|
|
5241
|
-
this.#picking = true;
|
|
5242
|
-
this.#internals.states.add("picking");
|
|
5243
|
-
this.#highlightElements(elements);
|
|
5244
|
-
this.#pickRoot = elements[0].getRootNode();
|
|
5245
|
-
this.#pickRoot.addEventListener("click", this.#boundHandlePickClick, true);
|
|
5246
|
-
this._ttsContext = { ...this._ttsContext, picking: true };
|
|
5247
|
-
}
|
|
5248
|
-
#stopPicking() {
|
|
5249
|
-
if (!this.#picking)
|
|
5250
|
-
return;
|
|
5251
|
-
this.#picking = false;
|
|
5252
|
-
this.#internals.states.delete("picking");
|
|
5253
|
-
this.#pickRoot?.removeEventListener("click", this.#boundHandlePickClick, true);
|
|
5254
|
-
this.#pickRoot = null;
|
|
5255
|
-
this.#clearAllHighlights();
|
|
5256
|
-
this._ttsContext = { ...this._ttsContext, picking: false };
|
|
5257
|
-
}
|
|
5258
|
-
#handlePickClick(event) {
|
|
5259
|
-
const elements = this.#getReadingElements();
|
|
5260
|
-
const path = event.composedPath();
|
|
5261
|
-
let index = elements.findIndex((el) => path.includes(el));
|
|
5262
|
-
if (index < 0) {
|
|
5263
|
-
const container = path.find((node) => node instanceof Element && node.matches("qti-simple-choice, li, qti-prompt"));
|
|
5264
|
-
if (container)
|
|
5265
|
-
index = elements.findIndex((el) => container.contains(el));
|
|
5266
|
-
}
|
|
5267
|
-
if (index < 0)
|
|
5268
|
-
return;
|
|
5269
|
-
event.preventDefault();
|
|
5270
|
-
event.stopPropagation();
|
|
5271
|
-
this.#stopPicking();
|
|
5272
|
-
speechSynthesis.cancel();
|
|
5273
|
-
this.#speakElement(index);
|
|
5274
|
-
}
|
|
5275
|
-
#prevElement() {
|
|
5276
|
-
const elements = this.#getReadingElements();
|
|
5277
|
-
if (!elements.length)
|
|
5278
|
-
return;
|
|
5279
|
-
this.#currentUtterance = null;
|
|
5280
|
-
speechSynthesis.cancel();
|
|
5281
|
-
this.#clearWordHighlight();
|
|
5282
|
-
this.#currentElementIndex = Math.max(0, this.#currentElementIndex - 1);
|
|
5283
|
-
this.#finished = false;
|
|
5284
|
-
this.#updateContext();
|
|
5285
|
-
const el = elements[this.#currentElementIndex];
|
|
5286
|
-
el.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5287
|
-
this.#highlightElement(el);
|
|
5288
|
-
this.#setSpeechState("idle");
|
|
5289
|
-
}
|
|
5290
|
-
#nextElement() {
|
|
5291
|
-
const elements = this.#getReadingElements();
|
|
5292
|
-
if (!elements.length)
|
|
5293
|
-
return;
|
|
5294
|
-
this.#currentUtterance = null;
|
|
5295
|
-
speechSynthesis.cancel();
|
|
5296
|
-
this.#clearWordHighlight();
|
|
5297
|
-
this.#currentElementIndex = Math.min(elements.length - 1, this.#currentElementIndex + 1);
|
|
5298
|
-
this.#finished = false;
|
|
5299
|
-
this.#updateContext();
|
|
5300
|
-
const el = elements[this.#currentElementIndex];
|
|
5301
|
-
el.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5302
|
-
this.#highlightElement(el);
|
|
5303
|
-
this.#setSpeechState("idle");
|
|
5304
|
-
}
|
|
5305
|
-
/** Walk text nodes without crossing shadow DOM boundaries. */
|
|
5306
|
-
#collectTextNodes(root) {
|
|
5307
|
-
const nodes = [];
|
|
5308
|
-
const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
|
|
5309
|
-
let node;
|
|
5310
|
-
while (node = walker.nextNode()) {
|
|
5311
|
-
if ((node.textContent ?? "").length > 0 && !node.parentElement?.closest('[aria-hidden="true"]')) {
|
|
5312
|
-
nodes.push(node);
|
|
5313
|
-
}
|
|
5314
|
-
}
|
|
5315
|
-
return nodes;
|
|
5316
|
-
}
|
|
5317
|
-
/** Highlight the whole element as the navigation cursor (blue). */
|
|
5318
|
-
#highlightElement(element) {
|
|
5319
|
-
this.#highlightElements([element]);
|
|
5320
|
-
}
|
|
5321
|
-
/** Put the blue cursor highlight on several elements at once (pick mode). */
|
|
5322
|
-
#highlightElements(elements) {
|
|
5323
|
-
if (!("highlights" in CSS))
|
|
5324
|
-
return;
|
|
5325
|
-
this.#ensureHighlightStyles();
|
|
5326
|
-
this.#elementHighlight.clear();
|
|
5327
|
-
for (const element of elements) {
|
|
5328
|
-
const range = new Range();
|
|
5329
|
-
range.selectNodeContents(element);
|
|
5330
|
-
this.#elementHighlight.add(range);
|
|
5331
|
-
}
|
|
5332
|
-
CSS.highlights.set(HIGHLIGHT_ELEMENT, this.#elementHighlight);
|
|
5333
|
-
}
|
|
5334
|
-
/** Highlight the current word within #textNodes (yellow, during speech). */
|
|
5335
|
-
#updateWordHighlight(charIndex, charLength) {
|
|
5336
|
-
if (!("highlights" in CSS))
|
|
5337
|
-
return;
|
|
5338
|
-
this.#ensureHighlightStyles();
|
|
5339
|
-
this.#wordHighlight.clear();
|
|
5340
|
-
const text = this.#textNodes.map((n) => n.textContent ?? "").join("");
|
|
5341
|
-
const endIndex = charIndex + (charLength > 0 ? charLength : this.#wordLengthAt(charIndex, text));
|
|
5342
|
-
let offset = 0;
|
|
5343
|
-
let startNode = null;
|
|
5344
|
-
let startOffset = 0;
|
|
5345
|
-
let endNode = null;
|
|
5346
|
-
let endOffset = 0;
|
|
5347
|
-
for (const node of this.#textNodes) {
|
|
5348
|
-
const len = node.textContent?.length ?? 0;
|
|
5349
|
-
if (!startNode && offset + len > charIndex) {
|
|
5350
|
-
startNode = node;
|
|
5351
|
-
startOffset = charIndex - offset;
|
|
5352
|
-
}
|
|
5353
|
-
if (startNode && offset + len >= endIndex) {
|
|
5354
|
-
endNode = node;
|
|
5355
|
-
endOffset = endIndex - offset;
|
|
5356
|
-
break;
|
|
5357
|
-
}
|
|
5358
|
-
offset += len;
|
|
5359
|
-
}
|
|
5360
|
-
if (startNode && endNode) {
|
|
5361
|
-
const range = new Range();
|
|
5362
|
-
range.setStart(startNode, startOffset);
|
|
5363
|
-
range.setEnd(endNode, endOffset);
|
|
5364
|
-
this.#wordHighlight.add(range);
|
|
5365
|
-
CSS.highlights.set(HIGHLIGHT_WORD, this.#wordHighlight);
|
|
5366
|
-
}
|
|
5367
|
-
}
|
|
5368
|
-
#clearWordHighlight() {
|
|
5369
|
-
if (!("highlights" in CSS))
|
|
5370
|
-
return;
|
|
5371
|
-
this.#wordHighlight.clear();
|
|
5372
|
-
if (CSS.highlights.get(HIGHLIGHT_WORD) === this.#wordHighlight)
|
|
5373
|
-
CSS.highlights.delete(HIGHLIGHT_WORD);
|
|
5374
|
-
}
|
|
5375
|
-
#clearAllHighlights() {
|
|
5376
|
-
if (!("highlights" in CSS))
|
|
5377
|
-
return;
|
|
5378
|
-
this.#clearWordHighlight();
|
|
5379
|
-
this.#elementHighlight.clear();
|
|
5380
|
-
if (CSS.highlights.get(HIGHLIGHT_ELEMENT) === this.#elementHighlight)
|
|
5381
|
-
CSS.highlights.delete(HIGHLIGHT_ELEMENT);
|
|
5382
|
-
}
|
|
5383
|
-
/** Fallback word-length when charLength is 0. */
|
|
5384
|
-
#wordLengthAt(charIndex, text) {
|
|
5385
|
-
const right = text.slice(charIndex).search(/\s/);
|
|
5386
|
-
return right < 0 ? text.length - charIndex : right;
|
|
5387
|
-
}
|
|
5388
|
-
/**
|
|
5389
|
-
* Add ::highlight() rules both to the shadow root the highlighted text lives in and to the
|
|
5390
|
-
* document (safety net — spec allows document rules to apply across shadow DOM). Called lazily
|
|
5391
|
-
* on first highlight use, once the reading elements have been collected.
|
|
5392
|
-
*/
|
|
5393
|
-
#ensureHighlightStyles() {
|
|
5394
|
-
if (!("highlights" in CSS))
|
|
5395
|
-
return;
|
|
5396
|
-
const sheet = getHighlightSheet();
|
|
5397
|
-
if (!document.adoptedStyleSheets.includes(sheet)) {
|
|
5398
|
-
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
|
|
5399
|
-
}
|
|
5400
|
-
const roots = /* @__PURE__ */ new Set();
|
|
5401
|
-
const ownRoot = this.getRootNode();
|
|
5402
|
-
if (ownRoot instanceof ShadowRoot)
|
|
5403
|
-
roots.add(ownRoot);
|
|
5404
|
-
const itemRoot = this.#readingElements?.[0]?.getRootNode();
|
|
5405
|
-
if (itemRoot instanceof ShadowRoot)
|
|
5406
|
-
roots.add(itemRoot);
|
|
5407
|
-
for (const root of roots) {
|
|
5408
|
-
if (!root.adoptedStyleSheets.includes(sheet)) {
|
|
5409
|
-
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
5410
|
-
}
|
|
5411
|
-
}
|
|
5412
|
-
}
|
|
5413
|
-
};
|
|
5414
|
-
__decorate30([
|
|
5415
|
-
property23({ type: String })
|
|
5416
|
-
], TestItemToSpeech.prototype, "language", void 0);
|
|
5417
|
-
__decorate30([
|
|
5418
|
-
consume19({ context: computedContext, subscribe: true })
|
|
5419
|
-
], TestItemToSpeech.prototype, "_computedContext", void 0);
|
|
5420
|
-
__decorate30([
|
|
5421
|
-
state9(),
|
|
5422
|
-
provide4({ context: ttsContext })
|
|
5423
|
-
], TestItemToSpeech.prototype, "_ttsContext", void 0);
|
|
5424
|
-
var TestTtsPlay = class extends TtsButtonBase {
|
|
5425
|
-
#toggle() {
|
|
5426
|
-
if (!this._tts)
|
|
5427
|
-
return;
|
|
5428
|
-
if (this._tts.state === "idle")
|
|
5429
|
-
this._tts.play();
|
|
5430
|
-
else if (this._tts.state === "playing")
|
|
5431
|
-
this._tts.pause();
|
|
5432
|
-
else
|
|
5433
|
-
this._tts.resume();
|
|
5434
|
-
}
|
|
5435
|
-
render() {
|
|
5436
|
-
const playing = this._tts?.state === "playing";
|
|
5437
|
-
return html22`
|
|
5438
|
-
<button part="button" aria-label=${ifDefined(playing ? this.pauseLabel : this.label)} @click=${this.#toggle}>
|
|
5439
|
-
${playing ? html22`<slot name="pause">${iconContent("pause", this.pauseLabel ?? "Pause")}</slot>` : html22`<slot name="play">${iconContent("play", this.label ?? "Play")}</slot>`}
|
|
5440
|
-
</button>
|
|
5441
|
-
`;
|
|
5442
|
-
}
|
|
5443
|
-
};
|
|
5444
|
-
__decorate30([
|
|
5445
|
-
property23({ type: String, attribute: "pause-label" })
|
|
5446
|
-
], TestTtsPlay.prototype, "pauseLabel", void 0);
|
|
5447
|
-
var TestTtsPause = class extends TtsButtonBase {
|
|
5448
|
-
render() {
|
|
5449
|
-
return html22`
|
|
5450
|
-
<button
|
|
5451
|
-
part="button"
|
|
5452
|
-
aria-label=${ifDefined(this.label)}
|
|
5453
|
-
?disabled=${this._tts?.state !== "playing"}
|
|
5454
|
-
@click=${() => this._tts?.pause()}
|
|
5455
|
-
>
|
|
5456
|
-
<slot>${iconContent("pause", this.label ?? "Pause")}</slot>
|
|
5457
|
-
</button>
|
|
5458
|
-
`;
|
|
5459
|
-
}
|
|
5460
|
-
};
|
|
5461
|
-
var TestTtsResume = class extends TtsButtonBase {
|
|
5462
|
-
render() {
|
|
5463
|
-
return html22`
|
|
5464
|
-
<button
|
|
5465
|
-
part="button"
|
|
5466
|
-
aria-label=${ifDefined(this.label)}
|
|
5467
|
-
?disabled=${this._tts?.state !== "paused"}
|
|
5468
|
-
@click=${() => this._tts?.resume()}
|
|
5469
|
-
>
|
|
5470
|
-
<slot>${iconContent("play", this.label ?? "Resume")}</slot>
|
|
5471
|
-
</button>
|
|
5472
|
-
`;
|
|
5473
|
-
}
|
|
5474
|
-
};
|
|
5475
|
-
var TestTtsStop = class extends TtsButtonBase {
|
|
5476
|
-
render() {
|
|
5477
|
-
const idle = this._tts?.state === "idle" && !this._tts?.picking;
|
|
5478
|
-
return html22`
|
|
5479
|
-
<button part="button" aria-label=${ifDefined(this.label)} ?disabled=${idle} @click=${() => this._tts?.stop()}>
|
|
5480
|
-
<slot>${iconContent("stop", this.label ?? "Stop")}</slot>
|
|
5481
|
-
</button>
|
|
5482
|
-
`;
|
|
5483
|
-
}
|
|
5484
|
-
};
|
|
5485
|
-
var TestTtsPrev = class extends TtsButtonBase {
|
|
5486
|
-
render() {
|
|
5487
|
-
const collected = (this._tts?.elementCount ?? 0) > 0;
|
|
5488
|
-
const atStart = (this._tts?.currentElementIndex ?? 0) === 0;
|
|
5489
|
-
return html22`
|
|
5490
|
-
<button
|
|
5491
|
-
part="button"
|
|
5492
|
-
aria-label=${ifDefined(this.label)}
|
|
5493
|
-
?disabled=${collected && atStart}
|
|
5494
|
-
@click=${() => this._tts?.prevElement()}
|
|
5495
|
-
>
|
|
5496
|
-
<slot>${iconContent("prev", this.label ?? "Previous sentence")}</slot>
|
|
5497
|
-
</button>
|
|
5498
|
-
`;
|
|
5499
|
-
}
|
|
5500
|
-
};
|
|
5501
|
-
var TestTtsNext = class extends TtsButtonBase {
|
|
5502
|
-
render() {
|
|
5503
|
-
const count = this._tts?.elementCount ?? 0;
|
|
5504
|
-
const atEnd = count > 0 && (this._tts?.currentElementIndex ?? 0) >= count - 1;
|
|
5505
|
-
return html22`
|
|
5506
|
-
<button
|
|
5507
|
-
part="button"
|
|
5508
|
-
aria-label=${ifDefined(this.label)}
|
|
5509
|
-
?disabled=${atEnd}
|
|
5510
|
-
@click=${() => this._tts?.nextElement()}
|
|
5511
|
-
>
|
|
5512
|
-
<slot>${iconContent("next", this.label ?? "Next sentence")}</slot>
|
|
5513
|
-
</button>
|
|
5514
|
-
`;
|
|
5515
|
-
}
|
|
5516
|
-
};
|
|
5517
|
-
var TestTtsPick = class extends TtsButtonBase {
|
|
5518
|
-
render() {
|
|
5519
|
-
return html22`
|
|
5520
|
-
<button
|
|
5521
|
-
part="button"
|
|
5522
|
-
aria-label=${ifDefined(this.label)}
|
|
5523
|
-
aria-pressed=${this._tts?.picking ? "true" : "false"}
|
|
5524
|
-
@click=${() => this._tts?.togglePick()}
|
|
5525
|
-
>
|
|
5526
|
-
<slot>${iconContent("pick", this.label ?? "Read from here")}</slot>
|
|
5527
|
-
</button>
|
|
5528
|
-
`;
|
|
5529
|
-
}
|
|
5530
|
-
};
|
|
5531
|
-
|
|
5532
|
-
// ../qti-test/dist/tts/elements.js
|
|
5533
|
-
var ttsElements = [
|
|
5534
|
-
{ tag: "test-item-to-speech", ctor: TestItemToSpeech },
|
|
5535
|
-
{ tag: "test-tts-next", ctor: TestTtsNext },
|
|
5536
|
-
{ tag: "test-tts-pause", ctor: TestTtsPause },
|
|
5537
|
-
{ tag: "test-tts-pick", ctor: TestTtsPick },
|
|
5538
|
-
{ tag: "test-tts-play", ctor: TestTtsPlay },
|
|
5539
|
-
{ tag: "test-tts-prev", ctor: TestTtsPrev },
|
|
5540
|
-
{ tag: "test-tts-resume", ctor: TestTtsResume },
|
|
5541
|
-
{ tag: "test-tts-stop", ctor: TestTtsStop }
|
|
5542
|
-
];
|
|
5543
|
-
|
|
5544
3880
|
// ../qti-test/dist/plugins/elements.js
|
|
5545
|
-
var pluginElements = [
|
|
5546
|
-
{ tag: "test-check-item", ctor: TestCheckItem },
|
|
5547
|
-
{ tag: "test-bookmark", ctor: TestBookmark },
|
|
5548
|
-
{ tag: "test-print-context", ctor: TestPrintContext },
|
|
5549
|
-
{ tag: "test-print-item-variables", ctor: TestPrintVariables },
|
|
5550
|
-
{ tag: "test-print-state", ctor: TestPrintState },
|
|
5551
|
-
{ tag: "test-scoring-buttons", ctor: TestScoringButtons },
|
|
5552
|
-
{ tag: "test-scoring-feedback", ctor: TestScoringFeedback },
|
|
5553
|
-
{ tag: "test-stamp", ctor: TestStamp },
|
|
5554
|
-
{ tag: "test-submit", ctor: TestSubmit },
|
|
5555
|
-
{ tag: "test-view", ctor: TestView },
|
|
5556
|
-
{ tag: "test-view-toggle", ctor: TestViewToggle },
|
|
5557
|
-
...ttsElements
|
|
5558
|
-
];
|
|
3881
|
+
var pluginElements = [{ tag: "test-submit", ctor: TestSubmit }];
|
|
5559
3882
|
|
|
5560
3883
|
// ../qti-test/dist/elements.js
|
|
5561
3884
|
var qtiTestElements = [
|
|
@@ -5574,11 +3897,9 @@ var qtiTestElements = [
|
|
|
5574
3897
|
{ tag: "qti-test-variables", ctor: QtiTestVariables },
|
|
5575
3898
|
{ tag: "test-container", ctor: TestContainer },
|
|
5576
3899
|
{ tag: "test-end-attempt", ctor: TestEndAttempt },
|
|
5577
|
-
{ tag: "test-item-link", ctor: TestItemLink },
|
|
5578
3900
|
{ tag: "test-navigation", ctor: TestNavigation },
|
|
5579
3901
|
{ tag: "test-next", ctor: TestNext },
|
|
5580
3902
|
{ tag: "test-prev", ctor: TestPrev },
|
|
5581
|
-
{ tag: "test-section-link", ctor: TestSectionLink },
|
|
5582
3903
|
...pluginElements
|
|
5583
3904
|
];
|
|
5584
3905
|
|
|
@@ -5601,33 +3922,10 @@ export {
|
|
|
5601
3922
|
QtiTest,
|
|
5602
3923
|
TestContainer,
|
|
5603
3924
|
TestEndAttempt,
|
|
5604
|
-
TestItemLink,
|
|
5605
3925
|
TestNavigation,
|
|
5606
3926
|
TestNext,
|
|
5607
3927
|
TestPrev,
|
|
5608
|
-
TestSectionLink,
|
|
5609
|
-
pluginState,
|
|
5610
|
-
bookmarkedItems,
|
|
5611
|
-
TestBookmark,
|
|
5612
|
-
TestCheckItem,
|
|
5613
|
-
TestPrintContext,
|
|
5614
|
-
TestPrintVariables,
|
|
5615
|
-
TestPrintState,
|
|
5616
|
-
TestScoringButtons,
|
|
5617
|
-
TestScoringFeedback,
|
|
5618
|
-
TestStamp,
|
|
5619
3928
|
TestSubmit,
|
|
5620
|
-
TestView,
|
|
5621
|
-
TestViewToggle,
|
|
5622
|
-
TestItemToSpeech,
|
|
5623
|
-
TestTtsPlay,
|
|
5624
|
-
TestTtsPause,
|
|
5625
|
-
TestTtsResume,
|
|
5626
|
-
TestTtsStop,
|
|
5627
|
-
TestTtsPrev,
|
|
5628
|
-
TestTtsNext,
|
|
5629
|
-
TestTtsPick,
|
|
5630
|
-
ttsElements,
|
|
5631
3929
|
pluginElements,
|
|
5632
3930
|
qtiTestElements
|
|
5633
3931
|
};
|
|
@@ -5643,4 +3941,4 @@ export {
|
|
|
5643
3941
|
* Portions Copyright (c) 2013, the Dart project authors.
|
|
5644
3942
|
*)
|
|
5645
3943
|
*/
|
|
5646
|
-
//# sourceMappingURL=chunk-
|
|
3944
|
+
//# sourceMappingURL=chunk-UURHLJVM.js.map
|