@citolab/qti-components 7.1.0 → 7.1.2
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/chunks/chunk-27WPPEWB.js +1 -0
- package/cdn/chunks/chunk-2HL3OFY7.js +1 -0
- package/cdn/chunks/chunk-33UT2QKP.js +5 -0
- package/cdn/chunks/chunk-3M3VWZCU.js +8 -0
- package/cdn/chunks/chunk-3QAOJL7Y.js +1007 -0
- package/cdn/chunks/chunk-3R4ZTZYA.js +5 -0
- package/cdn/chunks/chunk-6DWYLZ5E.js +5 -0
- package/cdn/chunks/chunk-6RVWXAM7.js +8 -0
- package/cdn/chunks/chunk-7HXSSTSU.js +1 -0
- package/cdn/chunks/chunk-7JXSJZV5.js +8 -0
- package/cdn/chunks/chunk-7QMIMK5V.js +5 -0
- package/cdn/chunks/chunk-7RLNGBXK.js +1 -0
- package/cdn/chunks/chunk-AHZ3W4YP.js +8 -0
- package/cdn/chunks/chunk-BGHD6LZP.js +1007 -0
- package/cdn/chunks/chunk-C73FEG6J.js +1 -0
- package/cdn/chunks/chunk-CFS5WXCD.js +1 -0
- package/cdn/chunks/chunk-CZDMOYYF.js +1 -0
- package/cdn/chunks/chunk-EBVKDAVL.js +5 -0
- package/cdn/chunks/chunk-EEFB2V7Q.js +27 -0
- package/cdn/chunks/chunk-ELZQC26E.js +5 -0
- package/cdn/chunks/chunk-EPOG3VSF.js +5 -0
- package/cdn/chunks/chunk-FDKTSUOQ.js +48 -0
- package/cdn/chunks/chunk-FJOHSSA3.js +1 -0
- package/cdn/chunks/chunk-G5YNM432.js +5 -0
- package/cdn/chunks/chunk-GIJVMMKY.js +1007 -0
- package/cdn/chunks/chunk-GNIERKRX.js +1007 -0
- package/cdn/chunks/chunk-GTHARXCW.js +10 -0
- package/cdn/chunks/chunk-IRLG6H7G.js +1 -0
- package/cdn/chunks/chunk-J3F2YSRA.js +1007 -0
- package/cdn/chunks/chunk-J4ISS5TZ.js +5 -0
- package/cdn/chunks/chunk-KBJYE746.js +5 -0
- package/cdn/chunks/chunk-KIH2VB5Z.js +1 -0
- package/cdn/chunks/chunk-KJJG5SSY.js +1 -0
- package/cdn/chunks/chunk-KLRM2GAU.js +8 -0
- package/cdn/chunks/chunk-KQT5S3DK.js +5 -0
- package/cdn/chunks/chunk-LDKKOMIK.js +3570 -0
- package/cdn/chunks/chunk-LDXZOGPY.js +10 -0
- package/cdn/chunks/chunk-LUVDXKE2.js +5 -0
- package/cdn/chunks/chunk-LZQKENA3.js +1 -0
- package/cdn/chunks/chunk-MGLK2Q6K.js +5 -0
- package/cdn/chunks/chunk-MK2CR5DP.js +1 -0
- package/cdn/chunks/chunk-N5JQAYOR.js +1 -0
- package/cdn/chunks/chunk-NJUBWVY3.js +10 -0
- package/cdn/chunks/chunk-NQKAQ6AU.js +1007 -0
- package/cdn/chunks/chunk-NW5VVFA5.js +5 -0
- package/cdn/chunks/chunk-OYUWBJSX.js +1 -0
- package/cdn/chunks/chunk-PBZODDGJ.js +1 -0
- package/cdn/chunks/chunk-PJFJOZNR.js +48 -0
- package/cdn/chunks/chunk-PMIMCEQ2.js +1 -0
- package/cdn/chunks/chunk-PYOOOJUP.js +3547 -0
- package/cdn/chunks/chunk-Q6HFDDZ4.js +1 -0
- package/cdn/chunks/chunk-QQR6POPY.js +1 -0
- package/cdn/chunks/chunk-QS2LH2IW.js +1007 -0
- package/cdn/chunks/chunk-QUFRWTHS.js +1 -0
- package/cdn/chunks/chunk-RJB5E47I.js +1 -0
- package/cdn/chunks/chunk-SFY52QPM.js +1 -0
- package/cdn/chunks/chunk-SUXBSENJ.js +48 -0
- package/cdn/chunks/chunk-SYO32O6X.js +1 -0
- package/cdn/chunks/chunk-TUWPPE7H.js +1 -0
- package/cdn/chunks/chunk-UHILPQTT.js +10 -0
- package/cdn/chunks/chunk-UOY4MCKX.js +6 -0
- package/cdn/chunks/chunk-VLCD4DFD.js +8 -0
- package/cdn/chunks/chunk-VRTU4ZV6.js +48 -0
- package/cdn/chunks/chunk-VXDODYB5.js +1007 -0
- package/cdn/chunks/chunk-W7GYEQJQ.js +1 -0
- package/cdn/chunks/chunk-WNI2D7SG.js +1 -0
- package/cdn/chunks/chunk-WNJ3YFMW.js +1 -0
- package/cdn/chunks/chunk-WRFAZSRX.js +1007 -0
- package/cdn/chunks/chunk-WTUTTA5R.js +1 -0
- package/cdn/chunks/chunk-WVVKSWZV.js +5 -0
- package/cdn/chunks/chunk-WXFIEBQR.js +0 -0
- package/cdn/chunks/chunk-X75XIXUI.js +10 -0
- package/cdn/chunks/chunk-XPI6OOWN.js +27 -0
- package/cdn/chunks/chunk-YBPCVJIX.js +10 -0
- package/cdn/chunks/chunk-YTSCJPU2.js +1007 -0
- package/cdn/chunks/chunk-YZQZGOYM.js +1 -0
- package/cdn/chunks/chunk-ZHVOZ7WZ.js +1007 -0
- package/cdn/exports/session.context.js +1 -1
- package/cdn/exports/test.context.js +1 -1
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +1 -1
- package/cdn/qti-components/index.js +1 -1
- package/cdn/qti-test/components/index.js +1 -1
- package/cdn/qti-test/components/test-navigation.js +1 -1
- package/cdn/qti-test/components/test-print-context.js +1 -0
- package/cdn/qti-test/components/test-print-item-variables copy.js +1 -0
- package/cdn/qti-test/components/test-print-item-variables.js +1 -1
- package/cdn/qti-test/components/test-print-item-variables.stories copy.js +233 -0
- package/cdn/qti-test/components/test-print-test-context.js +1 -0
- package/cdn/qti-test/components/test-view.js +1 -1
- package/cdn/qti-test/core/index.js +1 -1
- package/dist/chunks/chunk-2BVFKYAB.js +659 -0
- package/dist/chunks/chunk-2BVFKYAB.js.map +1 -0
- package/dist/chunks/chunk-2RXVRB7Z.js +659 -0
- package/dist/chunks/chunk-2RXVRB7Z.js.map +1 -0
- package/dist/chunks/chunk-2ZTRBYHP.js +660 -0
- package/dist/chunks/chunk-2ZTRBYHP.js.map +1 -0
- package/dist/chunks/chunk-36LEJZEY.js +87 -0
- package/dist/chunks/chunk-36LEJZEY.js.map +1 -0
- package/dist/chunks/chunk-373M5NVS.js +62 -0
- package/dist/chunks/chunk-373M5NVS.js.map +1 -0
- package/dist/chunks/chunk-3DEV5ARX.js +89 -0
- package/dist/chunks/chunk-3DEV5ARX.js.map +1 -0
- package/dist/chunks/chunk-3GCBMXXY.js +62 -0
- package/dist/chunks/chunk-3GCBMXXY.js.map +1 -0
- package/dist/chunks/chunk-3NH5KOQ4.js +89 -0
- package/dist/chunks/chunk-3NH5KOQ4.js.map +1 -0
- package/dist/chunks/chunk-4BDSKOGB.js +6873 -0
- package/dist/chunks/chunk-4BDSKOGB.js.map +1 -0
- package/dist/chunks/chunk-4BIRH5VP.js +99 -0
- package/dist/chunks/chunk-4BIRH5VP.js.map +1 -0
- package/dist/chunks/chunk-4O3EJ3SA.js +3884 -0
- package/dist/chunks/chunk-4O3EJ3SA.js.map +1 -0
- package/dist/chunks/chunk-4Z3IMDB5.js +84 -0
- package/dist/chunks/chunk-4Z3IMDB5.js.map +1 -0
- package/dist/chunks/chunk-6ITJ2I3A.js +82 -0
- package/dist/chunks/chunk-6ITJ2I3A.js.map +1 -0
- package/dist/chunks/chunk-75ZDJN64.js +32 -0
- package/dist/chunks/chunk-75ZDJN64.js.map +1 -0
- package/dist/chunks/chunk-76SJLOAE.js +84 -0
- package/dist/chunks/chunk-76SJLOAE.js.map +1 -0
- package/dist/chunks/chunk-7JS7FRDO.js +89 -0
- package/dist/chunks/chunk-7JS7FRDO.js.map +1 -0
- package/dist/chunks/chunk-7WL6TAJE.js +6872 -0
- package/dist/chunks/chunk-7WL6TAJE.js.map +1 -0
- package/dist/chunks/chunk-AD5H6KYS.js +78 -0
- package/dist/chunks/chunk-AD5H6KYS.js.map +1 -0
- package/dist/chunks/chunk-AQLCQATM.js +62 -0
- package/dist/chunks/chunk-AQLCQATM.js.map +1 -0
- package/dist/chunks/chunk-AWQHFFVL.js +659 -0
- package/dist/chunks/chunk-AWQHFFVL.js.map +1 -0
- package/dist/chunks/chunk-BLUHTHXX.js +6877 -0
- package/dist/chunks/chunk-BLUHTHXX.js.map +1 -0
- package/dist/chunks/chunk-BO6QD3VK.js +27 -0
- package/dist/chunks/chunk-BO6QD3VK.js.map +1 -0
- package/dist/chunks/chunk-BQ22JHXC.js +6877 -0
- package/dist/chunks/chunk-BQ22JHXC.js.map +1 -0
- package/dist/chunks/chunk-BWM6SEM3.js +659 -0
- package/dist/chunks/chunk-BWM6SEM3.js.map +1 -0
- package/dist/chunks/chunk-C2FVCRYJ.js +660 -0
- package/dist/chunks/chunk-C2FVCRYJ.js.map +1 -0
- package/dist/chunks/chunk-CIVMCP3W.js +78 -0
- package/dist/chunks/chunk-CIVMCP3W.js.map +1 -0
- package/dist/chunks/chunk-CJADUWEC.js +10 -0
- package/dist/chunks/chunk-CJADUWEC.js.map +1 -0
- package/dist/chunks/chunk-DCKLAFBL.js +79 -0
- package/dist/chunks/chunk-DCKLAFBL.js.map +1 -0
- package/dist/chunks/chunk-EHRC7LG6.js +3638 -0
- package/dist/chunks/chunk-EHRC7LG6.js.map +1 -0
- package/dist/chunks/chunk-ELXD2ZSR.js +218 -0
- package/dist/chunks/chunk-ELXD2ZSR.js.map +1 -0
- package/dist/chunks/chunk-EQUEIZJL.js +27 -0
- package/dist/chunks/chunk-EQUEIZJL.js.map +1 -0
- package/dist/chunks/chunk-EREPAU3B.js +80 -0
- package/dist/chunks/chunk-EREPAU3B.js.map +1 -0
- package/dist/chunks/chunk-EXOIDEQ6.js +660 -0
- package/dist/chunks/chunk-EXOIDEQ6.js.map +1 -0
- package/dist/chunks/chunk-FFF7WZJF.js +33 -0
- package/dist/chunks/chunk-FFF7WZJF.js.map +1 -0
- package/dist/chunks/chunk-FJJMZEPV.js +95 -0
- package/dist/chunks/chunk-FJJMZEPV.js.map +1 -0
- package/dist/chunks/chunk-G5DLHZE2.js +659 -0
- package/dist/chunks/chunk-G5DLHZE2.js.map +1 -0
- package/dist/chunks/chunk-HD63HGFY.js +52 -0
- package/dist/chunks/chunk-HD63HGFY.js.map +1 -0
- package/dist/chunks/chunk-HUKKTEBP.js +99 -0
- package/dist/chunks/chunk-HUKKTEBP.js.map +1 -0
- package/dist/chunks/chunk-HXGGGOV2.js +86 -0
- package/dist/chunks/chunk-HXGGGOV2.js.map +1 -0
- package/dist/chunks/chunk-HZYAIUVZ.js +6872 -0
- package/dist/chunks/chunk-HZYAIUVZ.js.map +1 -0
- package/dist/chunks/chunk-IT744RXI.js +75 -0
- package/dist/chunks/chunk-IT744RXI.js.map +1 -0
- package/dist/chunks/chunk-IXVOEGNZ.js +87 -0
- package/dist/chunks/chunk-IXVOEGNZ.js.map +1 -0
- package/dist/chunks/chunk-JEM74SR3.js +85 -0
- package/dist/chunks/chunk-JEM74SR3.js.map +1 -0
- package/dist/chunks/chunk-JP22YLJ6.js +219 -0
- package/dist/chunks/chunk-JP22YLJ6.js.map +1 -0
- package/dist/chunks/chunk-JVGOS45U.js +660 -0
- package/dist/chunks/chunk-JVGOS45U.js.map +1 -0
- package/dist/chunks/chunk-JWVGRAWQ.js +6872 -0
- package/dist/chunks/chunk-JWVGRAWQ.js.map +1 -0
- package/dist/chunks/chunk-JWX6ZOZ6.js +86 -0
- package/dist/chunks/chunk-JWX6ZOZ6.js.map +1 -0
- package/dist/chunks/chunk-JZMZLOTW.js +32 -0
- package/dist/chunks/chunk-JZMZLOTW.js.map +1 -0
- package/dist/chunks/chunk-KS3SCUUO.js +92 -0
- package/dist/chunks/chunk-KS3SCUUO.js.map +1 -0
- package/dist/chunks/chunk-LOPCNZ26.js +95 -0
- package/dist/chunks/chunk-LOPCNZ26.js.map +1 -0
- package/dist/chunks/chunk-LSNOL7NJ.js +6872 -0
- package/dist/chunks/chunk-LSNOL7NJ.js.map +1 -0
- package/dist/chunks/chunk-M4E2ACHZ.js +75 -0
- package/dist/chunks/chunk-M4E2ACHZ.js.map +1 -0
- package/dist/chunks/chunk-MQS7RZFR.js +85 -0
- package/dist/chunks/chunk-MQS7RZFR.js.map +1 -0
- package/dist/chunks/chunk-N3JFTFIL.js +79 -0
- package/dist/chunks/chunk-N3JFTFIL.js.map +1 -0
- package/dist/chunks/chunk-OSMLF3OH.js +6868 -0
- package/dist/chunks/chunk-OSMLF3OH.js.map +1 -0
- package/dist/chunks/chunk-OWWUE3LK.js +660 -0
- package/dist/chunks/chunk-OWWUE3LK.js.map +1 -0
- package/dist/chunks/chunk-P36CLOLO.js +27 -0
- package/dist/chunks/chunk-P36CLOLO.js.map +1 -0
- package/dist/chunks/chunk-PL32YWZA.js +30 -0
- package/dist/chunks/chunk-PL32YWZA.js.map +1 -0
- package/dist/chunks/chunk-Q5JLRHTY.js +659 -0
- package/dist/chunks/chunk-Q5JLRHTY.js.map +1 -0
- package/dist/chunks/chunk-RB227QQP.js +659 -0
- package/dist/chunks/chunk-RB227QQP.js.map +1 -0
- package/dist/chunks/chunk-TC5ZLAPV.js +218 -0
- package/dist/chunks/chunk-TC5ZLAPV.js.map +1 -0
- package/dist/chunks/chunk-TRSEENUK.js +45 -0
- package/dist/chunks/chunk-TRSEENUK.js.map +1 -0
- package/dist/chunks/chunk-U7VUCT7D.js +659 -0
- package/dist/chunks/chunk-U7VUCT7D.js.map +1 -0
- package/dist/chunks/chunk-UEX52I7G.js +1 -0
- package/dist/chunks/chunk-UEX52I7G.js.map +1 -0
- package/dist/chunks/chunk-UFRDMBKM.js +43 -0
- package/dist/chunks/chunk-UFRDMBKM.js.map +1 -0
- package/dist/chunks/chunk-USJXIVR4.js +6872 -0
- package/dist/chunks/chunk-USJXIVR4.js.map +1 -0
- package/dist/chunks/chunk-UZ4QB5IO.js +10 -0
- package/dist/chunks/chunk-UZ4QB5IO.js.map +1 -0
- package/dist/chunks/chunk-V2EYNAG4.js +659 -0
- package/dist/chunks/chunk-V2EYNAG4.js.map +1 -0
- package/dist/chunks/chunk-WJBYWKIF.js +32 -0
- package/dist/chunks/chunk-WJBYWKIF.js.map +1 -0
- package/dist/chunks/chunk-WOVQFPIV.js +6872 -0
- package/dist/chunks/chunk-WOVQFPIV.js.map +1 -0
- package/dist/chunks/chunk-WPUMEBSF.js +33 -0
- package/dist/chunks/chunk-WPUMEBSF.js.map +1 -0
- package/dist/chunks/chunk-WVVYYP6F.js +218 -0
- package/dist/chunks/chunk-WVVYYP6F.js.map +1 -0
- package/dist/chunks/chunk-XSHHCMRC.js +217 -0
- package/dist/chunks/chunk-XSHHCMRC.js.map +1 -0
- package/dist/chunks/chunk-XZTGFLMB.js +6872 -0
- package/dist/chunks/chunk-XZTGFLMB.js.map +1 -0
- package/dist/chunks/chunk-ZBMTSE6Q.js +660 -0
- package/dist/chunks/chunk-ZBMTSE6Q.js.map +1 -0
- package/dist/chunks/chunk-ZMTMIG3C.js +77 -0
- package/dist/chunks/chunk-ZMTMIG3C.js.map +1 -0
- package/dist/chunks/chunk-ZSR4X4I6.js +638 -0
- package/dist/chunks/chunk-ZSR4X4I6.js.map +1 -0
- package/dist/exports/interaction.js +1 -1
- package/dist/exports/session.context.d.ts +1 -1
- package/dist/exports/session.context.js +3 -1
- package/dist/exports/test.context.d.ts +2 -1
- package/dist/exports/test.context.js +3 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +20 -12
- package/dist/qti-components/index.js +2 -2
- package/dist/qti-components-jsx.d.ts +35 -2
- package/dist/qti-response-declaration-5PnLgbOQ.d.ts +1143 -0
- package/dist/qti-response-declaration-PJkGU8F8.d.ts +1151 -0
- package/dist/qti-test/components/index.d.ts +2 -1
- package/dist/qti-test/components/index.js +13 -9
- package/dist/qti-test/components/test-navigation.d.ts +1 -1
- package/dist/qti-test/components/test-navigation.js +3 -3
- package/dist/qti-test/components/test-print-context.d.ts +20 -0
- package/dist/qti-test/components/test-print-context.js +9 -0
- package/dist/qti-test/components/test-print-context.js.map +1 -0
- package/dist/qti-test/components/test-print-item-variables copy.js +86 -0
- package/dist/qti-test/components/test-print-item-variables copy.js.map +1 -0
- package/dist/qti-test/components/test-print-item-variables.d.ts +2 -2
- package/dist/qti-test/components/test-print-item-variables.js +1 -1
- package/dist/qti-test/components/test-print-item-variables.stories copy.js +9731 -0
- package/dist/qti-test/components/test-print-item-variables.stories copy.js.map +1 -0
- package/dist/qti-test/components/test-print-test-context.js +86 -0
- package/dist/qti-test/components/test-print-test-context.js.map +1 -0
- package/dist/qti-test/components/test-view.js +2 -2
- package/dist/qti-test/core/index.d.ts +3 -3
- package/dist/qti-test/core/index.js +15 -3
- package/dist/qti-test-feedback-BuFBq7JH.d.ts +97 -0
- package/dist/qti-test-feedback-CZsPCqSt.d.ts +97 -0
- package/dist/qti-test-feedback-CaNdRC7L.d.ts +96 -0
- package/dist/qti-test-part-BIeEZIWw.d.ts +85 -0
- package/dist/qti-test-part-C_jSX7Zz.d.ts +85 -0
- package/dist/vscode.html-custom-data.json +17 -6
- package/package.json +1 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import {
|
|
2
|
+
watch
|
|
3
|
+
} from "./chunk-ELDMXTUQ.js";
|
|
4
|
+
import {
|
|
5
|
+
sessionContext
|
|
6
|
+
} from "./chunk-UZ4QB5IO.js";
|
|
7
|
+
import {
|
|
8
|
+
__decorateClass
|
|
9
|
+
} from "./chunk-H2JE6IVU.js";
|
|
10
|
+
|
|
11
|
+
// src/lib/qti-test/components/test-view.ts
|
|
12
|
+
import { html, LitElement } from "lit";
|
|
13
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
14
|
+
import { consume } from "@lit/context";
|
|
15
|
+
var TestView = class extends LitElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.label = "view";
|
|
19
|
+
this._handleViewOptionsChange = () => {
|
|
20
|
+
this.updateViewOptions();
|
|
21
|
+
};
|
|
22
|
+
this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;
|
|
23
|
+
}
|
|
24
|
+
connectedCallback() {
|
|
25
|
+
super.connectedCallback();
|
|
26
|
+
this.updateViewOptions();
|
|
27
|
+
}
|
|
28
|
+
updateViewOptions() {
|
|
29
|
+
if (this.viewOptions) {
|
|
30
|
+
const options = this.viewOptions.split(",").map((opt) => opt.trim());
|
|
31
|
+
this._viewOptions = options.filter((opt) => TestView.DEFAULT_VIEW_OPTIONS.includes(opt));
|
|
32
|
+
} else {
|
|
33
|
+
this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_switchView(view) {
|
|
37
|
+
this.dispatchEvent(
|
|
38
|
+
new CustomEvent("on-test-switch-view", {
|
|
39
|
+
composed: true,
|
|
40
|
+
bubbles: true,
|
|
41
|
+
detail: view
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return html`
|
|
47
|
+
<label part="label" for="viewSelect">${this.label}</label>
|
|
48
|
+
<select
|
|
49
|
+
part="select"
|
|
50
|
+
id="viewSelect"
|
|
51
|
+
@change=${(e) => {
|
|
52
|
+
const el = e.target;
|
|
53
|
+
this._switchView(el.value);
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
${this._viewOptions.map(
|
|
57
|
+
(v) => html`<option value="${v}" ?selected=${v === this.sessionContext.view}>${v}</option>`
|
|
58
|
+
)}
|
|
59
|
+
</select>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
TestView.DEFAULT_VIEW_OPTIONS = ["author", "candidate", "proctor", "scorer", "testConstructor", "tutor"];
|
|
64
|
+
__decorateClass([
|
|
65
|
+
consume({ context: sessionContext, subscribe: true })
|
|
66
|
+
], TestView.prototype, "sessionContext", 2);
|
|
67
|
+
__decorateClass([
|
|
68
|
+
property({ type: String })
|
|
69
|
+
], TestView.prototype, "label", 2);
|
|
70
|
+
__decorateClass([
|
|
71
|
+
property({ type: String, attribute: "view-options" })
|
|
72
|
+
], TestView.prototype, "viewOptions", 2);
|
|
73
|
+
__decorateClass([
|
|
74
|
+
watch("viewOptions", { waitUntilFirstUpdate: true })
|
|
75
|
+
], TestView.prototype, "_handleViewOptionsChange", 2);
|
|
76
|
+
__decorateClass([
|
|
77
|
+
state()
|
|
78
|
+
], TestView.prototype, "_viewOptions", 2);
|
|
79
|
+
TestView = __decorateClass([
|
|
80
|
+
customElement("test-view")
|
|
81
|
+
], TestView);
|
|
82
|
+
|
|
83
|
+
export {
|
|
84
|
+
TestView
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=chunk-JWX6ZOZ6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-view.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { watch } from '../../decorators/watch';\n// import { computedContext } from '../../exports/computed.context';\nimport { sessionContext } from '../../exports/session.context';\n\n// import type { ComputedContext } from '../../exports/computed.context';\nimport type { SessionContext } from '../../exports/session.context';\n\n@customElement('test-view')\nexport class TestView extends LitElement {\n static DEFAULT_VIEW_OPTIONS = ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor'];\n\n @consume({ context: sessionContext, subscribe: true })\n private sessionContext: SessionContext;\n\n /** label accompanying the select view dropdown */\n @property({ type: String })\n label = 'view';\n\n /** The options to display in the dropdown, default: ['author', 'candidate', 'proctor', 'scorer', 'testConstructor', 'tutor'] */\n @property({ type: String, attribute: 'view-options' }) viewOptions;\n @watch('viewOptions', { waitUntilFirstUpdate: true })\n protected _handleViewOptionsChange = () => {\n this.updateViewOptions();\n };\n\n connectedCallback(): void {\n super.connectedCallback();\n this.updateViewOptions();\n }\n\n @state()\n private _viewOptions: string[] = TestView.DEFAULT_VIEW_OPTIONS;\n\n private updateViewOptions() {\n if (this.viewOptions) {\n const options = this.viewOptions.split(',').map(opt => opt.trim());\n this._viewOptions = options.filter(opt => TestView.DEFAULT_VIEW_OPTIONS.includes(opt));\n } else {\n this._viewOptions = TestView.DEFAULT_VIEW_OPTIONS;\n }\n }\n\n protected _switchView(view: string) {\n this.dispatchEvent(\n new CustomEvent('on-test-switch-view', {\n composed: true,\n bubbles: true,\n detail: view\n })\n );\n }\n\n render() {\n return html`\n <label part=\"label\" for=\"viewSelect\">${this.label}</label>\n <select\n part=\"select\"\n id=\"viewSelect\"\n @change=${(e: Event) => {\n const el = e.target as HTMLSelectElement;\n this._switchView(el.value);\n }}\n >\n ${this._viewOptions.map(\n v => html`<option value=\"${v}\" ?selected=${v === this.sessionContext.view}>${v}</option>`\n )}\n </select>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-view': TestView;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,eAAe;AAUjB,IAAM,WAAN,cAAuB,WAAW;AAAA,EAAlC;AAAA;AAQL,iBAAQ;AAKR,SAAU,2BAA2B,MAAM;AACzC,WAAK,kBAAkB;AAAA,IACzB;AAQA,SAAQ,eAAyB,SAAS;AAAA;AAAA,EAN1C,oBAA0B;AACxB,UAAM,kBAAkB;AACxB,SAAK,kBAAkB;AAAA,EACzB;AAAA,EAKQ,oBAAoB;AAC1B,QAAI,KAAK,aAAa;AACpB,YAAM,UAAU,KAAK,YAAY,MAAM,GAAG,EAAE,IAAI,SAAO,IAAI,KAAK,CAAC;AACjE,WAAK,eAAe,QAAQ,OAAO,SAAO,SAAS,qBAAqB,SAAS,GAAG,CAAC;AAAA,IACvF,OAAO;AACL,WAAK,eAAe,SAAS;AAAA,IAC/B;AAAA,EACF;AAAA,EAEU,YAAY,MAAc;AAClC,SAAK;AAAA,MACH,IAAI,YAAY,uBAAuB;AAAA,QACrC,UAAU;AAAA,QACV,SAAS;AAAA,QACT,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,6CACkC,KAAK,KAAK;AAAA;AAAA;AAAA;AAAA,kBAIrC,CAAC,MAAa;AACtB,YAAM,KAAK,EAAE;AACb,WAAK,YAAY,GAAG,KAAK;AAAA,IAC3B,CAAC;AAAA;AAAA,UAEC,KAAK,aAAa;AAAA,MAClB,OAAK,sBAAsB,CAAC,eAAe,MAAM,KAAK,eAAe,IAAI,IAAI,CAAC;AAAA,IAChF,CAAC;AAAA;AAAA;AAAA,EAGP;AACF;AA7Da,SACJ,uBAAuB,CAAC,UAAU,aAAa,WAAW,UAAU,mBAAmB,OAAO;AAG7F;AAAA,EADP,QAAQ,EAAE,SAAS,gBAAgB,WAAW,KAAK,CAAC;AAAA,GAH1C,SAIH;AAIR;AAAA,EADC,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAPf,SAQX;AAGuD;AAAA,EAAtD,SAAS,EAAE,MAAM,QAAQ,WAAW,eAAe,CAAC;AAAA,GAX1C,SAW4C;AAE7C;AAAA,EADT,MAAM,eAAe,EAAE,sBAAsB,KAAK,CAAC;AAAA,GAZzC,SAaD;AAUF;AAAA,EADP,MAAM;AAAA,GAtBI,SAuBH;AAvBG,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computedContext
|
|
3
|
+
} from "./chunk-6Z5YR5U2.js";
|
|
4
|
+
import {
|
|
5
|
+
__decorateClass
|
|
6
|
+
} from "./chunk-H2JE6IVU.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/qti-test/components/test-print-context.ts
|
|
9
|
+
import { html, LitElement } from "lit";
|
|
10
|
+
import { consume } from "@lit/context";
|
|
11
|
+
import { customElement } from "lit/decorators.js";
|
|
12
|
+
var TestPrintContext = class extends LitElement {
|
|
13
|
+
render() {
|
|
14
|
+
const activeItems = this.computedContext?.testParts.flatMap(
|
|
15
|
+
(testPart) => testPart.sections.flatMap((section) => section.items).find((item) => item.active)
|
|
16
|
+
);
|
|
17
|
+
if (!activeItems) return html``;
|
|
18
|
+
const activeItem = activeItems.length > 0 ? activeItems[0] : null;
|
|
19
|
+
return html` <small><pre>${JSON.stringify(activeItem, null, 2)}</pre></small> `;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
__decorateClass([
|
|
23
|
+
consume({ context: computedContext, subscribe: true })
|
|
24
|
+
], TestPrintContext.prototype, "computedContext", 2);
|
|
25
|
+
TestPrintContext = __decorateClass([
|
|
26
|
+
customElement("test-print-context")
|
|
27
|
+
], TestPrintContext);
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
TestPrintContext
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=chunk-JZMZLOTW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-print-context.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { consume } from '@lit/context';\nimport { customElement } from 'lit/decorators.js';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext } from '../../exports/computed.context';\n\n@customElement('test-print-context')\nexport class TestPrintContext extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n public computedContext?: ComputedContext;\n\n render() {\n const activeItems = this.computedContext?.testParts.flatMap(testPart =>\n testPart.sections.flatMap(section => section.items).find(item => item.active)\n );\n if (!activeItems) return html``;\n const activeItem = activeItems.length > 0 ? activeItems[0] : null;\n // delete activeItem?.variables;\n return html` <small><pre>${JSON.stringify(activeItem, null, 2)}</pre></small> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-print-context': TestPrintContext;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAOvB,IAAM,mBAAN,cAA+B,WAAW;AAAA,EAI/C,SAAS;AACP,UAAM,cAAc,KAAK,iBAAiB,UAAU;AAAA,MAAQ,cAC1D,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK,EAAE,KAAK,UAAQ,KAAK,MAAM;AAAA,IAC9E;AACA,QAAI,CAAC,YAAa,QAAO;AACzB,UAAM,aAAa,YAAY,SAAS,IAAI,YAAY,CAAC,IAAI;AAE7D,WAAO,oBAAoB,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;AAAA,EAChE;AACF;AAXS;AAAA,EADN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAD3C,iBAEJ;AAFI,mBAAN;AAAA,EADN,cAAc,oBAAoB;AAAA,GACtB;","names":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
btn,
|
|
3
|
+
dis
|
|
4
|
+
} from "./chunk-4O5F7WV7.js";
|
|
5
|
+
import {
|
|
6
|
+
computedContext
|
|
7
|
+
} from "./chunk-6Z5YR5U2.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk-63WMM765.js";
|
|
11
|
+
|
|
12
|
+
// src/lib/qti-test/components/test-show-correct-response.ts
|
|
13
|
+
import { css, html, LitElement } from "lit";
|
|
14
|
+
import { customElement, property } from "lit/decorators.js";
|
|
15
|
+
import { consume } from "@lit/context";
|
|
16
|
+
var TestShowCorrectResponse = class extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.shown = false;
|
|
20
|
+
this.disabled = false;
|
|
21
|
+
this.showCorrectText = "Show correct response";
|
|
22
|
+
this.hideCorrectText = "Hide correct response";
|
|
23
|
+
this.noCorrectResponseText = "No correct response specified";
|
|
24
|
+
}
|
|
25
|
+
// Store previous active item reference
|
|
26
|
+
willUpdate(_changedProperties) {
|
|
27
|
+
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
28
|
+
if (this._previousActiveItem !== activeItem) {
|
|
29
|
+
this.shown = false;
|
|
30
|
+
this._previousActiveItem = activeItem;
|
|
31
|
+
}
|
|
32
|
+
if (activeItem) {
|
|
33
|
+
const containsCorrectResponse = !!activeItem?.variables.some((v) => v["correctResponse"]);
|
|
34
|
+
const containsMapping = !!activeItem?.variables.some((v) => {
|
|
35
|
+
return v["mapping"]?.mapEntries?.length > 0 || v["areaMapping"]?.areaMapEntries?.length > 0;
|
|
36
|
+
});
|
|
37
|
+
this.disabled = !containsCorrectResponse && !containsMapping;
|
|
38
|
+
} else {
|
|
39
|
+
this.disabled = true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
_toggleState() {
|
|
43
|
+
if (this.disabled) return;
|
|
44
|
+
this.shown = !this.shown;
|
|
45
|
+
this.dispatchEvent(
|
|
46
|
+
new CustomEvent("test-show-correct-response", {
|
|
47
|
+
detail: this.shown,
|
|
48
|
+
bubbles: true
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
_getDisplayedText() {
|
|
53
|
+
return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;
|
|
54
|
+
}
|
|
55
|
+
render() {
|
|
56
|
+
return html` <div @click="${this._toggleState}">${this._getDisplayedText()}</div> `;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
TestShowCorrectResponse.styles = css`
|
|
60
|
+
:host {
|
|
61
|
+
${btn};
|
|
62
|
+
}
|
|
63
|
+
:host([disabled]) {
|
|
64
|
+
${dis};
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
__decorateClass([
|
|
68
|
+
consume({ context: computedContext, subscribe: true })
|
|
69
|
+
], TestShowCorrectResponse.prototype, "computedContext", 2);
|
|
70
|
+
__decorateClass([
|
|
71
|
+
property({ type: Boolean, reflect: true })
|
|
72
|
+
], TestShowCorrectResponse.prototype, "shown", 2);
|
|
73
|
+
__decorateClass([
|
|
74
|
+
property({ type: Boolean, reflect: true })
|
|
75
|
+
], TestShowCorrectResponse.prototype, "disabled", 2);
|
|
76
|
+
__decorateClass([
|
|
77
|
+
property({ type: String })
|
|
78
|
+
], TestShowCorrectResponse.prototype, "showCorrectText", 2);
|
|
79
|
+
__decorateClass([
|
|
80
|
+
property({ type: String })
|
|
81
|
+
], TestShowCorrectResponse.prototype, "hideCorrectText", 2);
|
|
82
|
+
__decorateClass([
|
|
83
|
+
property({ type: String })
|
|
84
|
+
], TestShowCorrectResponse.prototype, "noCorrectResponseText", 2);
|
|
85
|
+
TestShowCorrectResponse = __decorateClass([
|
|
86
|
+
customElement("test-show-correct-response")
|
|
87
|
+
], TestShowCorrectResponse);
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
TestShowCorrectResponse
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=chunk-KS3SCUUO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-show-correct-response.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext } from '../../exports/computed.context';\n\n@customElement('test-show-correct-response')\nexport class TestShowCorrectResponse extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n public computedContext?: ComputedContext;\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n @property({ type: Boolean, reflect: true }) shown = false;\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property({ type: String }) showCorrectText = 'Show correct response';\n @property({ type: String }) hideCorrectText = 'Hide correct response';\n @property({ type: String }) noCorrectResponseText = 'No correct response specified';\n\n private _previousActiveItem?: unknown; // Store previous active item reference\n\n willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n const activeItem = this.computedContext?.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n\n // If active item changed, reset shown before the update\n if (this._previousActiveItem !== activeItem) {\n this.shown = false;\n this._previousActiveItem = activeItem; // Update previous active item\n }\n\n if (activeItem) {\n const containsCorrectResponse = !!activeItem?.variables.some(v => v['correctResponse']);\n const containsMapping = !!activeItem?.variables.some(v => {\n return v['mapping']?.mapEntries?.length > 0 || v['areaMapping']?.areaMapEntries?.length > 0;\n });\n this.disabled = !containsCorrectResponse && !containsMapping;\n } else {\n this.disabled = true;\n }\n }\n private _toggleState() {\n if (this.disabled) return;\n this.shown = !this.shown;\n\n this.dispatchEvent(\n new CustomEvent('test-show-correct-response', {\n detail: this.shown,\n bubbles: true\n })\n );\n }\n\n private _getDisplayedText(): string {\n return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;\n }\n\n render() {\n return html` <div @click=\"${this._toggleState}\">${this._getDisplayedText()}</div> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-show-correct-response': TestShowCorrectResponse;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,kBAAkB;AACtC,SAAS,eAAe,gBAAgB;AACxC,SAAS,eAAe;AAQjB,IAAM,0BAAN,cAAsC,WAAW;AAAA,EAAjD;AAAA;AAauC,iBAAQ;AACR,oBAAW;AAC3B,2BAAkB;AAClB,2BAAkB;AAClB,iCAAwB;AAAA;AAAA;AAAA,EAIpD,WAAW,oBAA4D;AACrE,UAAM,aAAa,KAAK,iBAAiB,UACtC,QAAQ,cAAY,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK,CAAC,EACvE,KAAK,UAAQ,KAAK,MAAM;AAG3B,QAAI,KAAK,wBAAwB,YAAY;AAC3C,WAAK,QAAQ;AACb,WAAK,sBAAsB;AAAA,IAC7B;AAEA,QAAI,YAAY;AACd,YAAM,0BAA0B,CAAC,CAAC,YAAY,UAAU,KAAK,OAAK,EAAE,iBAAiB,CAAC;AACtF,YAAM,kBAAkB,CAAC,CAAC,YAAY,UAAU,KAAK,OAAK;AACxD,eAAO,EAAE,SAAS,GAAG,YAAY,SAAS,KAAK,EAAE,aAAa,GAAG,gBAAgB,SAAS;AAAA,MAC5F,CAAC;AACD,WAAK,WAAW,CAAC,2BAA2B,CAAC;AAAA,IAC/C,OAAO;AACL,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA,EACQ,eAAe;AACrB,QAAI,KAAK,SAAU;AACnB,SAAK,QAAQ,CAAC,KAAK;AAEnB,SAAK;AAAA,MACH,IAAI,YAAY,8BAA8B;AAAA,QAC5C,QAAQ,KAAK;AAAA,QACb,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEQ,oBAA4B;AAClC,WAAO,KAAK,WAAW,KAAK,wBAAwB,KAAK,QAAQ,KAAK,kBAAkB,KAAK;AAAA,EAC/F;AAAA,EAEA,SAAS;AACP,WAAO,qBAAqB,KAAK,YAAY,KAAK,KAAK,kBAAkB,CAAC;AAAA,EAC5E;AACF;AA7Da,wBAIJ,SAAS;AAAA;AAAA,QAEH,GAAG;AAAA;AAAA;AAAA,QAGH,GAAG;AAAA;AAAA;AAPT;AAAA,EADN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAD3C,wBAEJ;AAWqC;AAAA,EAA3C,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAb/B,wBAaiC;AACA;AAAA,EAA3C,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAd/B,wBAciC;AAChB;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAff,wBAeiB;AACA;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAhBf,wBAgBiB;AACA;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAjBf,wBAiBiB;AAjBjB,0BAAN;AAAA,EADN,cAAc,4BAA4B;AAAA,GAC9B;","names":[]}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {
|
|
2
|
+
propInternalState
|
|
3
|
+
} from "./chunk-K6EUKFNW.js";
|
|
4
|
+
import {
|
|
5
|
+
watch
|
|
6
|
+
} from "./chunk-ELDMXTUQ.js";
|
|
7
|
+
import {
|
|
8
|
+
btn,
|
|
9
|
+
dis
|
|
10
|
+
} from "./chunk-4O5F7WV7.js";
|
|
11
|
+
import {
|
|
12
|
+
computedContext
|
|
13
|
+
} from "./chunk-6Z5YR5U2.js";
|
|
14
|
+
import {
|
|
15
|
+
__decorateClass
|
|
16
|
+
} from "./chunk-H2JE6IVU.js";
|
|
17
|
+
|
|
18
|
+
// src/lib/qti-test/components/test-prev.ts
|
|
19
|
+
import { css, html, LitElement } from "lit";
|
|
20
|
+
import { customElement } from "lit/decorators.js";
|
|
21
|
+
import { consume } from "@lit/context";
|
|
22
|
+
var TestPrev = class extends LitElement {
|
|
23
|
+
constructor() {
|
|
24
|
+
super();
|
|
25
|
+
this.disabled = true;
|
|
26
|
+
this._internals = this.attachInternals();
|
|
27
|
+
this._internals.role = "button";
|
|
28
|
+
this._internals.ariaLabel = "Next item";
|
|
29
|
+
this.addEventListener("click", (e) => {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
if (!this.disabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
_handleTestElementChange(_oldValue, newValue) {
|
|
35
|
+
if (newValue) {
|
|
36
|
+
this.disabled = false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
willUpdate(_changedProperties) {
|
|
40
|
+
if (!this.computedContext) return;
|
|
41
|
+
const testPart = this.computedContext?.testParts.find((testPart2) => testPart2.active);
|
|
42
|
+
if (!testPart) return;
|
|
43
|
+
this.sectionItems = testPart.sections.flatMap((section) => section.items);
|
|
44
|
+
this.itemIndex = this.sectionItems.findIndex((item) => item.active);
|
|
45
|
+
this.checkDisabled();
|
|
46
|
+
}
|
|
47
|
+
checkDisabled() {
|
|
48
|
+
this.disabled = !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;
|
|
49
|
+
}
|
|
50
|
+
_requestItem(identifier) {
|
|
51
|
+
this.dispatchEvent(
|
|
52
|
+
new CustomEvent("qti-request-navigation", {
|
|
53
|
+
composed: true,
|
|
54
|
+
bubbles: true,
|
|
55
|
+
detail: {
|
|
56
|
+
type: "item",
|
|
57
|
+
id: identifier
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
return html`<slot></slot>`;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
TestPrev.styles = css`
|
|
67
|
+
:host {
|
|
68
|
+
${btn};
|
|
69
|
+
}
|
|
70
|
+
:host([disabled]) {
|
|
71
|
+
${dis};
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
__decorateClass([
|
|
75
|
+
propInternalState({
|
|
76
|
+
type: Boolean,
|
|
77
|
+
reflect: true,
|
|
78
|
+
aria: "ariaDisabled"
|
|
79
|
+
// Maps to `aria-disabled` attribute
|
|
80
|
+
})
|
|
81
|
+
], TestPrev.prototype, "disabled", 2);
|
|
82
|
+
__decorateClass([
|
|
83
|
+
consume({ context: computedContext, subscribe: true })
|
|
84
|
+
], TestPrev.prototype, "computedContext", 2);
|
|
85
|
+
__decorateClass([
|
|
86
|
+
watch("computedContext")
|
|
87
|
+
], TestPrev.prototype, "_handleTestElementChange", 1);
|
|
88
|
+
TestPrev = __decorateClass([
|
|
89
|
+
customElement("test-prev")
|
|
90
|
+
], TestPrev);
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
TestPrev
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=chunk-LOPCNZ26.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-prev.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport * as styles from './styles';\nimport { propInternalState, watch } from '../../decorators';\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ComputedContext, ComputedItem } from '../../exports/computed.context';\n\n/**\n * Represents a custom element for navigating to the previous test item.\n *\n * @remarks\n * This element provides functionality for navigating to the previous test item.\n *\n * @example\n * ```html\n * <test-prev></test-prev>\n * ```\n */\n@customElement('test-prev')\nexport class TestPrev extends LitElement {\n @propInternalState({\n type: Boolean,\n reflect: true,\n aria: 'ariaDisabled' // Maps to `aria-disabled` attribute\n })\n public disabled = true;\n\n @consume({ context: computedContext, subscribe: true })\n private computedContext: ComputedContext;\n\n sectionItems: ComputedItem[];\n itemIndex: number;\n\n @watch('computedContext')\n _handleTestElementChange(_oldValue: ComputedContext, newValue: ComputedContext) {\n if (newValue) {\n this.disabled = false;\n }\n }\n\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n private _internals: ElementInternals;\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n this._internals.role = 'button';\n this._internals.ariaLabel = 'Next item';\n\n this.addEventListener('click', e => {\n e.preventDefault();\n if (!this.disabled) this._requestItem(this.sectionItems[this.itemIndex - 1].identifier);\n });\n }\n\n willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n if (!this.computedContext) return;\n const testPart = this.computedContext?.testParts.find(testPart => testPart.active);\n if (!testPart) return;\n this.sectionItems = testPart.sections.flatMap(section => section.items);\n this.itemIndex = this.sectionItems.findIndex(item => item.active);\n this.checkDisabled();\n }\n\n checkDisabled() {\n this.disabled = !this.computedContext || this.itemIndex === 0 || this.itemIndex === -1;\n }\n\n protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-navigation', {\n composed: true,\n bubbles: true,\n detail: {\n type: 'item',\n id: identifier\n }\n })\n );\n }\n\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-previous': TestPrev;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,KAAK,MAAM,kBAAkB;AACtC,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AAoBjB,IAAM,WAAN,cAAuB,WAAW;AAAA,EA+BvC,cAAc;AACZ,UAAM;AA1BR,SAAO,WAAW;AA2BhB,SAAK,aAAa,KAAK,gBAAgB;AACvC,SAAK,WAAW,OAAO;AACvB,SAAK,WAAW,YAAY;AAE5B,SAAK,iBAAiB,SAAS,OAAK;AAClC,QAAE,eAAe;AACjB,UAAI,CAAC,KAAK,SAAU,MAAK,aAAa,KAAK,aAAa,KAAK,YAAY,CAAC,EAAE,UAAU;AAAA,IACxF,CAAC;AAAA,EACH;AAAA,EA1BA,yBAAyB,WAA4B,UAA2B;AAC9E,QAAI,UAAU;AACZ,WAAK,WAAW;AAAA,IAClB;AAAA,EACF;AAAA,EAwBA,WAAW,oBAA4D;AACrE,QAAI,CAAC,KAAK,gBAAiB;AAC3B,UAAM,WAAW,KAAK,iBAAiB,UAAU,KAAK,CAAAA,cAAYA,UAAS,MAAM;AACjF,QAAI,CAAC,SAAU;AACf,SAAK,eAAe,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK;AACtE,SAAK,YAAY,KAAK,aAAa,UAAU,UAAQ,KAAK,MAAM;AAChE,SAAK,cAAc;AAAA,EACrB;AAAA,EAEA,gBAAgB;AACd,SAAK,WAAW,CAAC,KAAK,mBAAmB,KAAK,cAAc,KAAK,KAAK,cAAc;AAAA,EACtF;AAAA,EAEU,aAAa,YAA0B;AAC/C,SAAK;AAAA,MACH,IAAI,YAAY,0BAA0B;AAAA,QACxC,UAAU;AAAA,QACV,SAAS;AAAA,QACT,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,IAAI;AAAA,QACN;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AACF;AAxEa,SAqBJ,SAAS;AAAA;AAAA,QAEH,GAAG;AAAA;AAAA;AAAA,QAGH,GAAG;AAAA;AAAA;AApBT;AAAA,EALN,kBAAkB;AAAA,IACjB,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA;AAAA,EACR,CAAC;AAAA,GALU,SAMJ;AAGC;AAAA,EADP,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAR3C,SASH;AAMR;AAAA,EADC,MAAM,iBAAiB;AAAA,GAdb,SAeX;AAfW,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":["testPart"]}
|