@citolab/qti-components 7.1.0 → 7.1.1
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-6RVWXAM7.js +8 -0
- package/cdn/chunks/chunk-7HXSSTSU.js +1 -0
- package/cdn/chunks/chunk-7JXSJZV5.js +8 -0
- package/cdn/chunks/chunk-7RLNGBXK.js +1 -0
- package/cdn/chunks/chunk-AHZ3W4YP.js +8 -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-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-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-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-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/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-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-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-BO6QD3VK.js +27 -0
- package/dist/chunks/chunk-BO6QD3VK.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-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-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-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-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 +54 -46
- 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 +16 -12
- 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-next.js +2 -2
- package/dist/qti-test/components/test-prev.js +2 -2
- 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"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass
|
|
3
|
+
} from "./chunk-H2JE6IVU.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/exports/interaction.ts
|
|
6
|
+
import { property, state } from "lit/decorators.js";
|
|
7
|
+
import { LitElement } from "lit";
|
|
8
|
+
var Interaction = class extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
this.readonly = false;
|
|
13
|
+
this._internals = this.attachInternals();
|
|
14
|
+
}
|
|
15
|
+
get correctResponse() {
|
|
16
|
+
return this._correctResponse;
|
|
17
|
+
}
|
|
18
|
+
set correctResponse(val) {
|
|
19
|
+
this._correctResponse = val;
|
|
20
|
+
}
|
|
21
|
+
reportValidity() {
|
|
22
|
+
return this._internals.reportValidity();
|
|
23
|
+
}
|
|
24
|
+
reset() {
|
|
25
|
+
this.value = "";
|
|
26
|
+
}
|
|
27
|
+
toggleCorrectResponse(responseVariable, show) {
|
|
28
|
+
this.correctResponse = show ? responseVariable?.correctResponse : responseVariable.cardinality === "single" ? "" : [];
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
this.dispatchEvent(
|
|
33
|
+
new CustomEvent("qti-register-interaction", {
|
|
34
|
+
bubbles: true,
|
|
35
|
+
composed: true,
|
|
36
|
+
cancelable: false,
|
|
37
|
+
detail: {
|
|
38
|
+
interactionElement: this,
|
|
39
|
+
responseIdentifier: this.responseIdentifier
|
|
40
|
+
}
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
saveResponse(value) {
|
|
45
|
+
this.dispatchEvent(
|
|
46
|
+
new CustomEvent("qti-interaction-response", {
|
|
47
|
+
bubbles: true,
|
|
48
|
+
composed: true,
|
|
49
|
+
cancelable: false,
|
|
50
|
+
detail: {
|
|
51
|
+
responseIdentifier: this.responseIdentifier,
|
|
52
|
+
response: Array.isArray(value) ? [...value] : value
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
Interaction.formAssociated = true;
|
|
59
|
+
__decorateClass([
|
|
60
|
+
property({ type: String, attribute: "response-identifier" })
|
|
61
|
+
], Interaction.prototype, "responseIdentifier", 2);
|
|
62
|
+
__decorateClass([
|
|
63
|
+
property({ reflect: true, type: Boolean })
|
|
64
|
+
], Interaction.prototype, "disabled", 2);
|
|
65
|
+
__decorateClass([
|
|
66
|
+
property({ reflect: true, type: Boolean })
|
|
67
|
+
], Interaction.prototype, "readonly", 2);
|
|
68
|
+
__decorateClass([
|
|
69
|
+
state()
|
|
70
|
+
], Interaction.prototype, "_correctResponse", 2);
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
Interaction
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=chunk-M4E2ACHZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/exports/interaction.ts"],"sourcesContent":["import { property, state } from 'lit/decorators.js';\nimport { LitElement } from 'lit';\n\nimport type { ResponseVariable } from './variables';\nimport type { IInteraction } from './interaction.interface';\n\nexport abstract class Interaction extends LitElement implements IInteraction {\n static formAssociated = true;\n\n @property({ type: String, attribute: 'response-identifier' }) responseIdentifier;\n\n @property({ reflect: true, type: Boolean }) disabled = false;\n\n @property({ reflect: true, type: Boolean }) readonly = false;\n\n @state()\n protected _correctResponse: string | string[];\n protected _internals: ElementInternals;\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n get correctResponse(): Readonly<string | string[]> {\n return this._correctResponse;\n }\n set correctResponse(val: Readonly<string | string[]>) {\n this._correctResponse = val as string | string[];\n }\n abstract validate(): boolean;\n\n public reportValidity(): boolean {\n return this._internals.reportValidity();\n }\n\n public reset(): void {\n this.value = '';\n }\n\n // attributeChangedCallback(name: string, _old: string | null, value: string | null): void {\n // super.attributeChangedCallback(name, _old, value);\n // // changing attributes in lit is not a thing, they are defined in the QTI XML and will never change\n // // except in storybook where we can change the value of the attribute\n // // this can make the internal state out of sync with the attribute\n // // so we reset the value to null to force the internal state to be reset\n // const attributeNamesToExclude = ['style', 'class'];\n // if (!attributeNamesToExclude.includes(name)) {\n // this.reset();\n // }\n // }\n\n abstract get value(): string | string[] | null;\n abstract set value(val: string | string[] | null);\n\n public toggleCorrectResponse(responseVariable: ResponseVariable, show: boolean) {\n this.correctResponse = show\n ? responseVariable?.correctResponse\n : responseVariable.cardinality === 'single'\n ? ''\n : [];\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n\n this.dispatchEvent(\n new CustomEvent('qti-register-interaction', {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail: {\n interactionElement: this,\n responseIdentifier: this.responseIdentifier\n }\n })\n );\n }\n\n public saveResponse(value: string | string[]) {\n this.dispatchEvent(\n new CustomEvent('qti-interaction-response', {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail: {\n responseIdentifier: this.responseIdentifier,\n response: Array.isArray(value) ? [...value] : value\n }\n })\n );\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,UAAU,aAAa;AAChC,SAAS,kBAAkB;AAKpB,IAAe,cAAf,cAAmC,WAAmC;AAAA,EAa3E,cAAc;AACZ,UAAM;AAToC,oBAAW;AAEX,oBAAW;AAQrD,SAAK,aAAa,KAAK,gBAAgB;AAAA,EACzC;AAAA,EACA,IAAI,kBAA+C;AACjD,WAAO,KAAK;AAAA,EACd;AAAA,EACA,IAAI,gBAAgB,KAAkC;AACpD,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAGO,iBAA0B;AAC/B,WAAO,KAAK,WAAW,eAAe;AAAA,EACxC;AAAA,EAEO,QAAc;AACnB,SAAK,QAAQ;AAAA,EACf;AAAA,EAiBO,sBAAsB,kBAAoC,MAAe;AAC9E,SAAK,kBAAkB,OACnB,kBAAkB,kBAClB,iBAAiB,gBAAgB,WAC/B,KACA,CAAC;AAAA,EACT;AAAA,EAEgB,oBAAoB;AAClC,UAAM,kBAAkB;AAExB,SAAK;AAAA,MACH,IAAI,YAAY,4BAA4B;AAAA,QAC1C,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,QAAQ;AAAA,UACN,oBAAoB;AAAA,UACpB,oBAAoB,KAAK;AAAA,QAC3B;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEO,aAAa,OAA0B;AAC5C,SAAK;AAAA,MACH,IAAI,YAAY,4BAA4B;AAAA,QAC1C,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,QAAQ;AAAA,UACN,oBAAoB,KAAK;AAAA,UACzB,UAAU,MAAM,QAAQ,KAAK,IAAI,CAAC,GAAG,KAAK,IAAI;AAAA,QAChD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AArFsB,YACb,iBAAiB;AAEsC;AAAA,EAA7D,SAAS,EAAE,MAAM,QAAQ,WAAW,sBAAsB,CAAC;AAAA,GAHxC,YAG0C;AAElB;AAAA,EAA3C,SAAS,EAAE,SAAS,MAAM,MAAM,QAAQ,CAAC;AAAA,GALtB,YAKwB;AAEA;AAAA,EAA3C,SAAS,EAAE,SAAS,MAAM,MAAM,QAAQ,CAAC;AAAA,GAPtB,YAOwB;AAGlC;AAAA,EADT,MAAM;AAAA,GATa,YAUV;","names":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
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-item-variables.ts
|
|
9
|
+
import { html, css, LitElement } from "lit";
|
|
10
|
+
import { consume } from "@lit/context";
|
|
11
|
+
import { customElement } from "lit/decorators.js";
|
|
12
|
+
var TestPrintVariables = class extends LitElement {
|
|
13
|
+
render() {
|
|
14
|
+
const activeItem = this.computedContext?.testParts.flatMap((testPart) => testPart.sections.flatMap((section) => section.items)).find((item) => item.active);
|
|
15
|
+
if (!activeItem || !activeItem.variables) return html``;
|
|
16
|
+
const responseVariables = activeItem.variables.filter((v) => v.type === "response");
|
|
17
|
+
const outcomeVariables = activeItem.variables.filter((v) => v.type === "outcome");
|
|
18
|
+
const renderTable = (variables, title) => html`
|
|
19
|
+
<h3>${title}</h3>
|
|
20
|
+
<table>
|
|
21
|
+
<thead>
|
|
22
|
+
<tr>
|
|
23
|
+
<th>Identifier</th>
|
|
24
|
+
<th>Value</th>
|
|
25
|
+
<th>Cardinality</th>
|
|
26
|
+
<th>Base Type</th>
|
|
27
|
+
<th>Correct Response / Mappings</th>
|
|
28
|
+
</tr>
|
|
29
|
+
</thead>
|
|
30
|
+
<tbody>
|
|
31
|
+
${variables.map((v) => {
|
|
32
|
+
const correctResponse = v.correctResponse ? Array.isArray(v.correctResponse) ? v.correctResponse.join(", ") : v.correctResponse : "";
|
|
33
|
+
const mapEntries = v.mapping?.mapEntries?.map((m) => `${m.mapKey}=${m.mappedValue}pt`).join(", ") || "";
|
|
34
|
+
const areaMapEntries = v.areaMapping?.areaMapEntries?.map((m) => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(", ") || "";
|
|
35
|
+
return html`
|
|
36
|
+
<tr>
|
|
37
|
+
<td>${v.identifier}</td>
|
|
38
|
+
<td>${Array.isArray(v.value) ? v.value.join(", ") : v.value}</td>
|
|
39
|
+
<td>${v.cardinality}</td>
|
|
40
|
+
<td>${v.baseType}</td>
|
|
41
|
+
<td>${correctResponse || mapEntries || areaMapEntries}</td>
|
|
42
|
+
</tr>
|
|
43
|
+
`;
|
|
44
|
+
})}
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
`;
|
|
48
|
+
return html`
|
|
49
|
+
${renderTable(responseVariables, "Response Variables")} ${renderTable(outcomeVariables, "Outcome Variables")}
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
TestPrintVariables.styles = css`
|
|
54
|
+
table {
|
|
55
|
+
width: 100%;
|
|
56
|
+
border-collapse: collapse;
|
|
57
|
+
margin: 20px 0;
|
|
58
|
+
font-size: 14px;
|
|
59
|
+
text-align: left;
|
|
60
|
+
}
|
|
61
|
+
th,
|
|
62
|
+
td {
|
|
63
|
+
border: 1px solid #ddd;
|
|
64
|
+
padding: 8px;
|
|
65
|
+
}
|
|
66
|
+
th {
|
|
67
|
+
background-color: #f4f4f4;
|
|
68
|
+
font-weight: bold;
|
|
69
|
+
}
|
|
70
|
+
h3 {
|
|
71
|
+
margin-top: 20px;
|
|
72
|
+
font-size: 16px;
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
__decorateClass([
|
|
76
|
+
consume({ context: computedContext, subscribe: true })
|
|
77
|
+
], TestPrintVariables.prototype, "computedContext", 2);
|
|
78
|
+
TestPrintVariables = __decorateClass([
|
|
79
|
+
customElement("test-print-item-variables")
|
|
80
|
+
], TestPrintVariables);
|
|
81
|
+
|
|
82
|
+
export {
|
|
83
|
+
TestPrintVariables
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=chunk-MQS7RZFR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-print-item-variables.ts"],"sourcesContent":["import { html, css, LitElement } from 'lit';\nimport { consume } from '@lit/context';\nimport { customElement } from 'lit/decorators.js';\n\nimport { computedContext } from '../../exports/computed.context';\n\nimport type { ResponseVariable } from '../../exports/variables';\nimport type { ComputedContext } from '../../exports/computed.context';\n\n@customElement('test-print-item-variables')\nexport class TestPrintVariables extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n public computedContext?: ComputedContext;\n\n static styles = css`\n table {\n width: 100%;\n border-collapse: collapse;\n margin: 20px 0;\n font-size: 14px;\n text-align: left;\n }\n th,\n td {\n border: 1px solid #ddd;\n padding: 8px;\n }\n th {\n background-color: #f4f4f4;\n font-weight: bold;\n }\n h3 {\n margin-top: 20px;\n font-size: 16px;\n }\n `;\n\n render() {\n const activeItem = this.computedContext?.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n\n if (!activeItem || !activeItem.variables) return html``;\n\n const responseVariables: ResponseVariable[] = activeItem.variables.filter(v => v.type === 'response');\n const outcomeVariables = activeItem.variables.filter(v => v.type === 'outcome');\n\n const renderTable = (variables: ResponseVariable[], title: string) => html`\n <h3>${title}</h3>\n <table>\n <thead>\n <tr>\n <th>Identifier</th>\n <th>Value</th>\n <th>Cardinality</th>\n <th>Base Type</th>\n <th>Correct Response / Mappings</th>\n </tr>\n </thead>\n <tbody>\n ${variables.map(v => {\n const correctResponse = v.correctResponse\n ? Array.isArray(v.correctResponse)\n ? v.correctResponse.join(', ')\n : v.correctResponse\n : '';\n\n const mapEntries = v.mapping?.mapEntries?.map(m => `${m.mapKey}=${m.mappedValue}pt`).join(', ') || '';\n\n const areaMapEntries =\n v.areaMapping?.areaMapEntries?.map(m => `${m.shape}(${m.coords})=${m.mappedValue}pt`).join(', ') || '';\n\n return html`\n <tr>\n <td>${v.identifier}</td>\n <td>${Array.isArray(v.value) ? v.value.join(', ') : v.value}</td>\n <td>${v.cardinality}</td>\n <td>${v.baseType}</td>\n <td>${correctResponse || mapEntries || areaMapEntries}</td>\n </tr>\n `;\n })}\n </tbody>\n </table>\n `;\n\n return html`\n ${renderTable(responseVariables, 'Response Variables')} ${renderTable(outcomeVariables, 'Outcome Variables')}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-print-item-variables': TestPrintVariables;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,MAAM,KAAK,kBAAkB;AACtC,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAQvB,IAAM,qBAAN,cAAiC,WAAW;AAAA,EA2BjD,SAAS;AACP,UAAM,aAAa,KAAK,iBAAiB,UACtC,QAAQ,cAAY,SAAS,SAAS,QAAQ,aAAW,QAAQ,KAAK,CAAC,EACvE,KAAK,UAAQ,KAAK,MAAM;AAE3B,QAAI,CAAC,cAAc,CAAC,WAAW,UAAW,QAAO;AAEjD,UAAM,oBAAwC,WAAW,UAAU,OAAO,OAAK,EAAE,SAAS,UAAU;AACpG,UAAM,mBAAmB,WAAW,UAAU,OAAO,OAAK,EAAE,SAAS,SAAS;AAE9E,UAAM,cAAc,CAAC,WAA+B,UAAkB;AAAA,YAC9D,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAYL,UAAU,IAAI,OAAK;AACnB,YAAM,kBAAkB,EAAE,kBACtB,MAAM,QAAQ,EAAE,eAAe,IAC7B,EAAE,gBAAgB,KAAK,IAAI,IAC3B,EAAE,kBACJ;AAEJ,YAAM,aAAa,EAAE,SAAS,YAAY,IAAI,OAAK,GAAG,EAAE,MAAM,IAAI,EAAE,WAAW,IAAI,EAAE,KAAK,IAAI,KAAK;AAEnG,YAAM,iBACJ,EAAE,aAAa,gBAAgB,IAAI,OAAK,GAAG,EAAE,KAAK,IAAI,EAAE,MAAM,KAAK,EAAE,WAAW,IAAI,EAAE,KAAK,IAAI,KAAK;AAEtG,aAAO;AAAA;AAAA,sBAEG,EAAE,UAAU;AAAA,sBACZ,MAAM,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,KAAK,IAAI,IAAI,EAAE,KAAK;AAAA,sBACrD,EAAE,WAAW;AAAA,sBACb,EAAE,QAAQ;AAAA,sBACV,mBAAmB,cAAc,cAAc;AAAA;AAAA;AAAA,IAG3D,CAAC,CAAC;AAAA;AAAA;AAAA;AAKR,WAAO;AAAA,QACH,YAAY,mBAAmB,oBAAoB,CAAC,IAAI,YAAY,kBAAkB,mBAAmB,CAAC;AAAA;AAAA,EAEhH;AACF;AAhFa,mBAIJ,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAFT;AAAA,EADN,QAAQ,EAAE,SAAS,iBAAiB,WAAW,KAAK,CAAC;AAAA,GAD3C,mBAEJ;AAFI,qBAAN;AAAA,EADN,cAAc,2BAA2B;AAAA,GAC7B;","names":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass
|
|
3
|
+
} from "./chunk-63WMM765.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/exports/interaction.ts
|
|
6
|
+
import { property, state } from "lit/decorators.js";
|
|
7
|
+
import { LitElement } from "lit";
|
|
8
|
+
var Interaction = class extends LitElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
this.readonly = false;
|
|
13
|
+
this._internals = this.attachInternals();
|
|
14
|
+
}
|
|
15
|
+
get correctResponse() {
|
|
16
|
+
return this._correctResponse;
|
|
17
|
+
}
|
|
18
|
+
set correctResponse(val) {
|
|
19
|
+
this._correctResponse = val;
|
|
20
|
+
}
|
|
21
|
+
reportValidity() {
|
|
22
|
+
return this._internals.reportValidity();
|
|
23
|
+
}
|
|
24
|
+
reset() {
|
|
25
|
+
this.value = "";
|
|
26
|
+
}
|
|
27
|
+
attributeChangedCallback(name, _old, value) {
|
|
28
|
+
super.attributeChangedCallback(name, _old, value);
|
|
29
|
+
this.value = null;
|
|
30
|
+
}
|
|
31
|
+
toggleCorrectResponse(responseVariable, show) {
|
|
32
|
+
this.correctResponse = show ? responseVariable?.correctResponse : responseVariable.cardinality === "single" ? "" : [];
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
super.connectedCallback();
|
|
36
|
+
this.dispatchEvent(
|
|
37
|
+
new CustomEvent("qti-register-interaction", {
|
|
38
|
+
bubbles: true,
|
|
39
|
+
composed: true,
|
|
40
|
+
cancelable: false,
|
|
41
|
+
detail: {
|
|
42
|
+
interactionElement: this,
|
|
43
|
+
responseIdentifier: this.responseIdentifier
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
saveResponse(value) {
|
|
49
|
+
this.dispatchEvent(
|
|
50
|
+
new CustomEvent("qti-interaction-response", {
|
|
51
|
+
bubbles: true,
|
|
52
|
+
composed: true,
|
|
53
|
+
cancelable: false,
|
|
54
|
+
detail: {
|
|
55
|
+
responseIdentifier: this.responseIdentifier,
|
|
56
|
+
response: Array.isArray(value) ? [...value] : value
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
Interaction.formAssociated = true;
|
|
63
|
+
__decorateClass([
|
|
64
|
+
property({ type: String, attribute: "response-identifier" })
|
|
65
|
+
], Interaction.prototype, "responseIdentifier", 2);
|
|
66
|
+
__decorateClass([
|
|
67
|
+
property({ reflect: true, type: Boolean })
|
|
68
|
+
], Interaction.prototype, "disabled", 2);
|
|
69
|
+
__decorateClass([
|
|
70
|
+
property({ reflect: true, type: Boolean })
|
|
71
|
+
], Interaction.prototype, "readonly", 2);
|
|
72
|
+
__decorateClass([
|
|
73
|
+
state()
|
|
74
|
+
], Interaction.prototype, "_correctResponse", 2);
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
Interaction
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=chunk-N3JFTFIL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/exports/interaction.ts"],"sourcesContent":["import { property, state } from 'lit/decorators.js';\nimport { LitElement } from 'lit';\n\nimport type { ResponseVariable } from './variables';\nimport type { IInteraction } from './interaction.interface';\n\nexport abstract class Interaction extends LitElement implements IInteraction {\n static formAssociated = true;\n\n @property({ type: String, attribute: 'response-identifier' }) responseIdentifier;\n\n @property({ reflect: true, type: Boolean }) disabled = false;\n\n @property({ reflect: true, type: Boolean }) readonly = false;\n\n @state()\n protected _correctResponse: string | string[];\n protected _internals: ElementInternals;\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n get correctResponse(): Readonly<string | string[]> {\n return this._correctResponse;\n }\n set correctResponse(val: Readonly<string | string[]>) {\n this._correctResponse = val as string | string[];\n }\n abstract validate(): boolean;\n\n public reportValidity(): boolean {\n return this._internals.reportValidity();\n }\n\n public reset(): void {\n this.value = '';\n }\n\n attributeChangedCallback(name: string, _old: string | null, value: string | null): void {\n super.attributeChangedCallback(name, _old, value);\n // changing attributes in lit is not a thing, they are defined in the QTI XML and will never change\n // except in storybook where we can change the value of the attribute\n // this can make the internal state out of sync with the attribute\n // so we reset the value to null to force the internal state to be reset\n this.value = null;\n }\n\n abstract get value(): string | string[] | null;\n abstract set value(val: string | string[] | null);\n\n public toggleCorrectResponse(responseVariable: ResponseVariable, show: boolean) {\n this.correctResponse = show\n ? responseVariable?.correctResponse\n : responseVariable.cardinality === 'single'\n ? ''\n : [];\n }\n\n public override connectedCallback() {\n super.connectedCallback();\n\n this.dispatchEvent(\n new CustomEvent('qti-register-interaction', {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail: {\n interactionElement: this,\n responseIdentifier: this.responseIdentifier\n }\n })\n );\n }\n\n public saveResponse(value: string | string[]) {\n this.dispatchEvent(\n new CustomEvent('qti-interaction-response', {\n bubbles: true,\n composed: true,\n cancelable: false,\n detail: {\n responseIdentifier: this.responseIdentifier,\n response: Array.isArray(value) ? [...value] : value\n }\n })\n );\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,UAAU,aAAa;AAChC,SAAS,kBAAkB;AAKpB,IAAe,cAAf,cAAmC,WAAmC;AAAA,EAa3E,cAAc;AACZ,UAAM;AAToC,oBAAW;AAEX,oBAAW;AAQrD,SAAK,aAAa,KAAK,gBAAgB;AAAA,EACzC;AAAA,EACA,IAAI,kBAA+C;AACjD,WAAO,KAAK;AAAA,EACd;AAAA,EACA,IAAI,gBAAgB,KAAkC;AACpD,SAAK,mBAAmB;AAAA,EAC1B;AAAA,EAGO,iBAA0B;AAC/B,WAAO,KAAK,WAAW,eAAe;AAAA,EACxC;AAAA,EAEO,QAAc;AACnB,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,yBAAyB,MAAc,MAAqB,OAA4B;AACtF,UAAM,yBAAyB,MAAM,MAAM,KAAK;AAKhD,SAAK,QAAQ;AAAA,EACf;AAAA,EAKO,sBAAsB,kBAAoC,MAAe;AAC9E,SAAK,kBAAkB,OACnB,kBAAkB,kBAClB,iBAAiB,gBAAgB,WAC/B,KACA,CAAC;AAAA,EACT;AAAA,EAEgB,oBAAoB;AAClC,UAAM,kBAAkB;AAExB,SAAK;AAAA,MACH,IAAI,YAAY,4BAA4B;AAAA,QAC1C,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,QAAQ;AAAA,UACN,oBAAoB;AAAA,UACpB,oBAAoB,KAAK;AAAA,QAC3B;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEO,aAAa,OAA0B;AAC5C,SAAK;AAAA,MACH,IAAI,YAAY,4BAA4B;AAAA,QAC1C,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,QAAQ;AAAA,UACN,oBAAoB,KAAK;AAAA,UACzB,UAAU,MAAM,QAAQ,KAAK,IAAI,CAAC,GAAG,KAAK,IAAI;AAAA,QAChD;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAlFsB,YACb,iBAAiB;AAEsC;AAAA,EAA7D,SAAS,EAAE,MAAM,QAAQ,WAAW,sBAAsB,CAAC;AAAA,GAHxC,YAG0C;AAElB;AAAA,EAA3C,SAAS,EAAE,SAAS,MAAM,MAAM,QAAQ,CAAC;AAAA,GALtB,YAKwB;AAEA;AAAA,EAA3C,SAAS,EAAE,SAAS,MAAM,MAAM,QAAQ,CAAC;AAAA,GAPtB,YAOwB;AAGlC;AAAA,EADT,MAAM;AAAA,GATa,YAUV;","names":[]}
|