@citolab/qti-components 7.0.4 → 7.0.5
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-4UJBK6JO.js +1 -0
- package/cdn/chunks/chunk-5FCXUJAG.js +23 -0
- package/cdn/chunks/chunk-5O3Z7TDV.js +1 -0
- package/cdn/chunks/chunk-65LFT33L.js +8 -0
- package/cdn/chunks/chunk-6D25UFJR.js +8 -0
- package/cdn/chunks/chunk-6DMSHH5X.js +0 -0
- package/cdn/chunks/chunk-6UGPNL7M.js +1 -0
- package/cdn/chunks/chunk-CFXQCNG6.js +3523 -0
- package/cdn/chunks/chunk-CSUKVUZF.js +3 -0
- package/cdn/chunks/chunk-CSY3WI5A.js +1 -0
- package/cdn/chunks/chunk-DAZR7RUI.js +0 -0
- package/cdn/chunks/chunk-EHK76KRT.js +1 -0
- package/cdn/chunks/chunk-EOPEMJS3.js +0 -0
- package/cdn/chunks/chunk-G5O7EN45.js +5 -0
- package/cdn/chunks/chunk-GEFUIFM7.js +0 -0
- package/cdn/chunks/chunk-JLNHEMQG.js +1 -0
- package/cdn/chunks/chunk-LPWIM7QJ.js +902 -0
- package/cdn/chunks/chunk-M3YRM3AV.js +1 -0
- package/cdn/chunks/chunk-M6BOWL2U.js +1 -0
- package/cdn/chunks/chunk-P5IE36FO.js +8 -0
- package/cdn/chunks/chunk-PXH5KN5O.js +1 -0
- package/cdn/chunks/chunk-RBEI6NIF.js +1 -0
- package/cdn/chunks/chunk-SMKIYFFI.js +1 -0
- package/cdn/chunks/chunk-SRLMW23F.js +0 -0
- package/cdn/chunks/chunk-T3YDLD2H.js +11 -0
- package/cdn/chunks/chunk-T4HD2C4F.js +1 -0
- package/cdn/chunks/chunk-T6IXJ4W4.js +1 -0
- package/cdn/chunks/chunk-TFAUBGP2.js +0 -0
- package/cdn/chunks/chunk-UIEC4LXR.js +17 -0
- package/cdn/chunks/chunk-V44O3GTW.js +0 -0
- package/cdn/chunks/chunk-V6B54FQW.js +5 -0
- package/cdn/chunks/chunk-V6KX6BQN.js +1 -0
- package/cdn/chunks/chunk-VYANBI35.js +1 -0
- package/cdn/chunks/chunk-XUJ7TXHW.js +1 -0
- package/cdn/chunks/chunk-ZIZLFFSG.js +0 -0
- package/cdn/index.css +1 -0
- package/cdn/index.global.js +45 -45
- package/cdn/index.js +196 -476
- package/cdn/qti-components/index.global.js +226 -0
- package/cdn/qti-components/index.js +924 -0
- package/cdn/qti-item/components/index.css +1 -0
- package/cdn/qti-item/components/index.global.js +149 -0
- package/cdn/qti-item/components/index.js +3549 -0
- package/cdn/qti-item/components/item-container.css +1 -0
- package/cdn/qti-item/components/item-container.global.js +149 -0
- package/cdn/qti-item/components/item-container.js +3549 -0
- package/cdn/qti-item/index.css +1 -0
- package/cdn/qti-item/index.global.js +149 -0
- package/cdn/qti-item/index.js +3549 -0
- package/cdn/qti-item/qti-item.global.js +114 -0
- package/cdn/qti-item/qti-item.js +1 -0
- package/cdn/qti-loader/index.global.js +1 -0
- package/cdn/qti-loader/index.js +23 -0
- package/cdn/qti-test/components/index.css +1 -0
- package/cdn/qti-test/components/index.global.js +242 -0
- package/cdn/qti-test/components/index.js +3598 -0
- package/cdn/qti-test/components/styles.global.js +44 -0
- package/cdn/qti-test/components/styles.js +17 -0
- package/cdn/qti-test/components/test-component.abstract.global.js +170 -0
- package/cdn/qti-test/components/test-component.abstract.js +1 -0
- package/cdn/qti-test/components/test-container.css +1 -0
- package/cdn/qti-test/components/test-container.global.js +149 -0
- package/cdn/qti-test/components/test-container.js +3549 -0
- package/cdn/qti-test/components/test-item-link.global.js +170 -0
- package/cdn/qti-test/components/test-item-link.js +24 -0
- package/cdn/qti-test/components/test-next.global.js +170 -0
- package/cdn/qti-test/components/test-next.js +24 -0
- package/cdn/qti-test/components/test-next.spec.css +1 -0
- package/cdn/qti-test/components/test-next.spec.global.js +297 -0
- package/cdn/qti-test/components/test-next.spec.js +5215 -0
- package/cdn/qti-test/components/test-paging-buttons-stamp.global.js +207 -0
- package/cdn/qti-test/components/test-paging-buttons-stamp.js +3 -0
- package/cdn/qti-test/components/test-prev.global.js +170 -0
- package/cdn/qti-test/components/test-prev.js +24 -0
- package/cdn/qti-test/components/test-view.global.js +170 -0
- package/cdn/qti-test/components/test-view.js +11 -0
- package/cdn/qti-test/context/index.global.js +58 -0
- package/cdn/qti-test/context/index.js +1 -0
- package/cdn/qti-test/context/test.context.global.js +58 -0
- package/cdn/qti-test/context/test.context.js +1 -0
- package/cdn/qti-test/index.css +1 -0
- package/cdn/qti-test/index.global.js +242 -0
- package/cdn/qti-test/index.js +3598 -0
- package/cdn/qti-test/mixins/index.global.js +1 -0
- package/cdn/qti-test/mixins/index.js +23 -0
- package/cdn/qti-test/mixins/test-loader.mixin.global.js +1 -0
- package/cdn/qti-test/mixins/test-loader.mixin.js +23 -0
- package/cdn/qti-test/mixins/test-navigation.mixin.global.js +1 -0
- package/cdn/qti-test/mixins/test-navigation.mixin.js +1 -0
- package/cdn/qti-test/mixins/test-view.mixin.global.js +1 -0
- package/cdn/qti-test/mixins/test-view.mixin.js +1 -0
- package/cdn/qti-test/qti-assessment-test/index.global.js +170 -0
- package/cdn/qti-test/qti-assessment-test/index.js +1 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-item-ref.global.js +170 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-item-ref.js +1 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-section.global.js +170 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-section.js +1 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-test.global.js +170 -0
- package/cdn/qti-test/qti-assessment-test/qti-assessment-test.js +1 -0
- package/cdn/qti-test/qti-assessment-test/qti-test-part.global.js +114 -0
- package/cdn/qti-test/qti-assessment-test/qti-test-part.js +1 -0
- package/cdn/qti-test/qti-test.global.js +170 -0
- package/cdn/qti-test/qti-test.js +23 -0
- package/cdn/qti-test/test-base.global.js +170 -0
- package/cdn/qti-test/test-base.js +1 -0
- package/cdn/qti-transformers/index.global.js +1 -0
- package/cdn/qti-transformers/index.js +23 -0
- package/dist/chunks/chunk-3G2DDBJW.js +44 -0
- package/dist/chunks/chunk-3G2DDBJW.js.map +1 -0
- package/dist/chunks/chunk-3NLCJYSX.js +1 -0
- package/dist/chunks/chunk-3NLCJYSX.js.map +1 -0
- package/dist/chunks/chunk-3OXGDCSU.js +6253 -0
- package/dist/chunks/chunk-3OXGDCSU.js.map +1 -0
- package/dist/chunks/chunk-3ROZMGAN.js +43 -0
- package/dist/chunks/chunk-3ROZMGAN.js.map +1 -0
- package/dist/chunks/chunk-4O5F7WV7.js +30 -0
- package/dist/chunks/chunk-4O5F7WV7.js.map +1 -0
- package/dist/chunks/chunk-6YE2KJ4C.js +55 -0
- package/dist/chunks/chunk-6YE2KJ4C.js.map +1 -0
- package/dist/chunks/chunk-AAQCM2FP.js +56 -0
- package/dist/chunks/chunk-AAQCM2FP.js.map +1 -0
- package/dist/chunks/chunk-D3RGDWKP.js +37 -0
- package/dist/chunks/chunk-D3RGDWKP.js.map +1 -0
- package/dist/chunks/chunk-DJLE6EV2.js +36 -0
- package/dist/chunks/chunk-DJLE6EV2.js.map +1 -0
- package/dist/chunks/chunk-ELDMXTUQ.js +31 -0
- package/dist/chunks/chunk-ELDMXTUQ.js.map +1 -0
- package/dist/chunks/chunk-EW5CTHAD.js +1 -0
- package/dist/chunks/chunk-EW5CTHAD.js.map +1 -0
- package/dist/chunks/chunk-HWA4A3SR.js +50 -0
- package/dist/chunks/chunk-HWA4A3SR.js.map +1 -0
- package/dist/chunks/chunk-IKZWK2C5.js +1 -0
- package/dist/chunks/chunk-IKZWK2C5.js.map +1 -0
- package/dist/chunks/chunk-IP7JSYO6.js +1 -0
- package/dist/chunks/chunk-IP7JSYO6.js.map +1 -0
- package/dist/chunks/chunk-JE6BMXZU.js +94 -0
- package/dist/chunks/chunk-JE6BMXZU.js.map +1 -0
- package/dist/chunks/chunk-JSPJGWGT.js +20 -0
- package/dist/chunks/chunk-JSPJGWGT.js.map +1 -0
- package/dist/chunks/chunk-LKINC6JO.js +118 -0
- package/dist/chunks/chunk-LKINC6JO.js.map +1 -0
- package/dist/chunks/chunk-LROTNPC2.js +94 -0
- package/dist/chunks/chunk-LROTNPC2.js.map +1 -0
- package/dist/chunks/chunk-MTMT2RMF.js +63 -0
- package/dist/chunks/chunk-MTMT2RMF.js.map +1 -0
- package/dist/chunks/chunk-NDJZGJUR.js +65 -0
- package/dist/chunks/chunk-NDJZGJUR.js.map +1 -0
- package/dist/chunks/chunk-OE2LFIH2.js +1 -0
- package/dist/chunks/chunk-OE2LFIH2.js.map +1 -0
- package/dist/chunks/chunk-OJ2XGDWK.js +1 -0
- package/dist/chunks/chunk-OJ2XGDWK.js.map +1 -0
- package/dist/chunks/chunk-PUBGXXTM.js +50 -0
- package/dist/chunks/chunk-PUBGXXTM.js.map +1 -0
- package/dist/chunks/chunk-QRCUNRP5.js +75 -0
- package/dist/chunks/chunk-QRCUNRP5.js.map +1 -0
- package/dist/chunks/chunk-S6JJYCO7.js +51 -0
- package/dist/chunks/chunk-S6JJYCO7.js.map +1 -0
- package/dist/chunks/chunk-U3AALKEP.js +1 -0
- package/dist/chunks/chunk-U3AALKEP.js.map +1 -0
- package/dist/chunks/chunk-UCQFSRYF.js +34 -0
- package/dist/chunks/chunk-UCQFSRYF.js.map +1 -0
- package/dist/chunks/chunk-URGVQ64M.js +1 -0
- package/dist/chunks/chunk-URGVQ64M.js.map +1 -0
- package/dist/chunks/chunk-V4FXK4TP.js +128 -0
- package/dist/chunks/chunk-V4FXK4TP.js.map +1 -0
- package/dist/chunks/chunk-W4B23OIP.js +72 -0
- package/dist/chunks/chunk-W4B23OIP.js.map +1 -0
- package/dist/chunks/chunk-XDFXD3BI.js +10 -0
- package/dist/chunks/chunk-XDFXD3BI.js.map +1 -0
- package/dist/chunks/chunk-XDMSEAYC.js +294 -0
- package/dist/chunks/chunk-XPDS72XY.js +29 -0
- package/dist/chunks/chunk-XPDS72XY.js.map +1 -0
- package/dist/chunks/chunk-Y6UWSECL.js +3529 -0
- package/dist/chunks/chunk-Y6UWSECL.js.map +1 -0
- package/dist/chunks/chunk-ZEFOMZNY.js +78 -0
- package/dist/chunks/chunk-ZEFOMZNY.js.map +1 -0
- package/dist/index-Cvrd4KQA.d.ts +109 -0
- package/dist/index.d.ts +18 -503
- package/dist/index.js +1666 -4206
- package/dist/index.js.map +1 -1
- package/dist/item.css +10 -10
- package/dist/qti-components/index.d.ts +150 -0
- package/dist/qti-components/index.js +6525 -0
- package/dist/qti-components/index.js.map +1 -0
- package/dist/qti-components-jsx.d.ts +93 -147
- package/dist/qti-item/components/index.d.ts +3 -0
- package/dist/qti-item/components/index.js +3856 -0
- package/dist/qti-item/components/index.js.map +1 -0
- package/dist/qti-item/components/item-container.d.ts +40 -0
- package/dist/qti-item/components/item-container.js +3856 -0
- package/dist/qti-item/components/item-container.js.map +1 -0
- package/dist/qti-item/index.d.ts +4 -0
- package/dist/qti-item/index.js +3869 -0
- package/dist/qti-item/index.js.map +1 -0
- package/dist/qti-item/qti-item.d.ts +25 -0
- package/dist/qti-item/qti-item.js +26 -0
- package/dist/qti-item/qti-item.js.map +1 -0
- package/dist/{loader → qti-loader}/index.d.ts +1 -1
- package/dist/{qti-simple-choice-D0GiMrqD.d.ts → qti-simple-choice-DxWcdKHi.d.ts} +30 -40
- package/dist/qti-test/components/index.d.ts +13 -0
- package/dist/qti-test/components/index.js +4144 -0
- package/dist/qti-test/components/index.js.map +1 -0
- package/dist/qti-test/components/styles.d.ts +8 -0
- package/dist/qti-test/components/styles.js +29 -0
- package/dist/qti-test/components/styles.js.map +1 -0
- package/dist/qti-test/components/test-component.abstract.d.ts +23 -0
- package/dist/qti-test/components/test-component.abstract.js +149 -0
- package/dist/qti-test/components/test-component.abstract.js.map +1 -0
- package/dist/qti-test/components/test-container.d.ts +37 -0
- package/dist/qti-test/components/test-container.js +3782 -0
- package/dist/qti-test/components/test-container.js.map +1 -0
- package/dist/qti-test/components/test-item-link.d.ts +21 -0
- package/dist/qti-test/components/test-item-link.js +202 -0
- package/dist/qti-test/components/test-item-link.js.map +1 -0
- package/dist/qti-test/components/test-next.d.ts +32 -0
- package/dist/qti-test/components/test-next.js +209 -0
- package/dist/qti-test/components/test-next.js.map +1 -0
- package/dist/qti-test/components/test-next.spec.d.ts +16 -0
- package/dist/qti-test/components/test-next.spec.js +56915 -0
- package/dist/qti-test/components/test-next.spec.js.map +1 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.d.ts +22 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.js +218 -0
- package/dist/qti-test/components/test-paging-buttons-stamp.js.map +1 -0
- package/dist/qti-test/components/test-prev.d.ts +32 -0
- package/dist/qti-test/components/test-prev.js +209 -0
- package/dist/qti-test/components/test-prev.js.map +1 -0
- package/dist/qti-test/components/test-view.d.ts +27 -0
- package/dist/qti-test/components/test-view.js +209 -0
- package/dist/qti-test/components/test-view.js.map +1 -0
- package/dist/qti-test/context/index.d.ts +6 -0
- package/dist/qti-test/context/index.js +9 -0
- package/dist/qti-test/context/index.js.map +1 -0
- package/dist/qti-test/context/test.context.d.ts +6 -0
- package/dist/qti-test/context/test.context.js +9 -0
- package/dist/qti-test/context/test.context.js.map +1 -0
- package/dist/qti-test/index.d.ts +14 -0
- package/dist/qti-test/index.js +4746 -0
- package/dist/qti-test/index.js.map +1 -0
- package/dist/qti-test/mixins/index.d.ts +8 -0
- package/dist/qti-test/mixins/index.js +350 -0
- package/dist/qti-test/mixins/index.js.map +1 -0
- package/dist/qti-test/mixins/test-loader.mixin.d.ts +8 -0
- package/dist/qti-test/mixins/test-loader.mixin.js +240 -0
- package/dist/qti-test/mixins/test-loader.mixin.js.map +1 -0
- package/dist/qti-test/mixins/test-navigation.mixin.d.ts +22 -0
- package/dist/qti-test/mixins/test-navigation.mixin.js +64 -0
- package/dist/qti-test/mixins/test-navigation.mixin.js.map +1 -0
- package/dist/qti-test/mixins/test-view.mixin.d.ts +6 -0
- package/dist/qti-test/mixins/test-view.mixin.js +50 -0
- package/dist/qti-test/mixins/test-view.mixin.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/index.d.ts +6 -0
- package/dist/qti-test/qti-assessment-test/index.js +221 -0
- package/dist/qti-test/qti-assessment-test/index.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.d.ts +6 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.js +85 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-item-ref.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.d.ts +6 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.js +73 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-section.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.d.ts +6 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.js +54 -0
- package/dist/qti-test/qti-assessment-test/qti-assessment-test.js.map +1 -0
- package/dist/qti-test/qti-assessment-test/qti-test-part.d.ts +19 -0
- package/dist/qti-test/qti-assessment-test/qti-test-part.js +62 -0
- package/dist/qti-test/qti-assessment-test/qti-test-part.js.map +1 -0
- package/dist/qti-test/qti-test.d.ts +68 -0
- package/dist/qti-test/qti-test.js +500 -0
- package/dist/qti-test/qti-test.js.map +1 -0
- package/dist/qti-test/test-base.d.ts +6 -0
- package/dist/qti-test/test-base.js +137 -0
- package/dist/qti-test/test-base.js.map +1 -0
- package/dist/qti-transformers/index.js.map +1 -0
- package/dist/test-base-BJwG9Ie8.d.ts +109 -0
- package/dist/vscode.html-custom-data.json +49 -38
- package/package.json +28 -51
- package/dist/custom-element-eslint-rules.js +0 -329
- package/dist/custom-elements.json +0 -27271
- package/dist/qti-simple-choice-CfgBEvdI.d.ts +0 -1143
- package/dist/qti-simple-choice-UTrFa_RQ.d.ts +0 -1177
- package/dist/qti-simple-choice-zEsDq3c0.d.ts +0 -1147
- /package/dist/{transformers/index.js.map → chunks/chunk-XDMSEAYC.js.map} +0 -0
- /package/dist/{loader → qti-loader}/index.js +0 -0
- /package/dist/{loader → qti-loader}/index.js.map +0 -0
- /package/dist/{transformers → qti-transformers}/index.d.ts +0 -0
- /package/dist/{transformers → qti-transformers}/index.js +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
watch
|
|
3
|
+
} from "./chunk-ELDMXTUQ.js";
|
|
4
|
+
import {
|
|
5
|
+
testContext,
|
|
6
|
+
testElement
|
|
7
|
+
} from "./chunk-XDFXD3BI.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk-6YE2KJ4C.js";
|
|
11
|
+
|
|
12
|
+
// src/lib/qti-test/components/test-component.abstract.ts
|
|
13
|
+
import { consume } from "@lit/context";
|
|
14
|
+
import { LitElement } from "lit";
|
|
15
|
+
import { state } from "lit/decorators.js";
|
|
16
|
+
|
|
17
|
+
// src/lib/decorators/prop-internal-state.ts
|
|
18
|
+
import { property } from "lit/decorators.js";
|
|
19
|
+
function propInternalState(options) {
|
|
20
|
+
return (protoOrDescriptor, name) => {
|
|
21
|
+
property(options)(protoOrDescriptor, name);
|
|
22
|
+
const key = `__${name}`;
|
|
23
|
+
Object.defineProperty(protoOrDescriptor, name, {
|
|
24
|
+
get() {
|
|
25
|
+
return this[key];
|
|
26
|
+
},
|
|
27
|
+
set(value) {
|
|
28
|
+
const oldValue = this[key];
|
|
29
|
+
this[key] = value;
|
|
30
|
+
if (oldValue !== value) {
|
|
31
|
+
if (this._internals?.states) {
|
|
32
|
+
const stateName = name.toLowerCase();
|
|
33
|
+
if (value) {
|
|
34
|
+
this._internals.states.add(`--${stateName}`);
|
|
35
|
+
} else {
|
|
36
|
+
this._internals.states.delete(`--${stateName}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (options.aria && this._internals) {
|
|
40
|
+
const ariaAttribute = options.aria;
|
|
41
|
+
if (value) {
|
|
42
|
+
this._internals[ariaAttribute] = "true";
|
|
43
|
+
} else {
|
|
44
|
+
this._internals[ariaAttribute] = null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
this.requestUpdate(name, oldValue);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
configurable: true,
|
|
51
|
+
enumerable: true
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/lib/qti-test/components/test-component.abstract.ts
|
|
57
|
+
var TestComponent = class extends LitElement {
|
|
58
|
+
constructor() {
|
|
59
|
+
super();
|
|
60
|
+
this.disabled = true;
|
|
61
|
+
this._internals = this.attachInternals();
|
|
62
|
+
}
|
|
63
|
+
_handleTestElementChange(_oldValue, newValue) {
|
|
64
|
+
if (newValue.el) {
|
|
65
|
+
this.disabled = false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
willUpdate(changedProperties) {
|
|
69
|
+
if (changedProperties.has("_testContext")) {
|
|
70
|
+
const { items = [], navItemId } = this._testContext ?? {};
|
|
71
|
+
this.itemIndex = items.findIndex((item) => item.identifier === navItemId);
|
|
72
|
+
this.items = items;
|
|
73
|
+
this.view = this._testContext?.view;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
_switchView(view) {
|
|
77
|
+
this.dispatchEvent(
|
|
78
|
+
new CustomEvent("on-test-switch-view", {
|
|
79
|
+
composed: true,
|
|
80
|
+
bubbles: true,
|
|
81
|
+
detail: view
|
|
82
|
+
})
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
_requestItem(identifier) {
|
|
86
|
+
this.dispatchEvent(
|
|
87
|
+
new CustomEvent("qti-request-test-item", {
|
|
88
|
+
composed: true,
|
|
89
|
+
bubbles: true,
|
|
90
|
+
detail: identifier
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
__decorateClass([
|
|
96
|
+
propInternalState({
|
|
97
|
+
type: Boolean,
|
|
98
|
+
reflect: true,
|
|
99
|
+
aria: "ariaDisabled"
|
|
100
|
+
// Maps to `aria-disabled` attribute
|
|
101
|
+
})
|
|
102
|
+
], TestComponent.prototype, "disabled", 2);
|
|
103
|
+
__decorateClass([
|
|
104
|
+
state(),
|
|
105
|
+
consume({ context: testContext, subscribe: true })
|
|
106
|
+
], TestComponent.prototype, "_testContext", 2);
|
|
107
|
+
__decorateClass([
|
|
108
|
+
state(),
|
|
109
|
+
consume({ context: testElement, subscribe: true })
|
|
110
|
+
], TestComponent.prototype, "_testElement", 2);
|
|
111
|
+
__decorateClass([
|
|
112
|
+
watch("_testElement")
|
|
113
|
+
], TestComponent.prototype, "_handleTestElementChange", 1);
|
|
114
|
+
|
|
115
|
+
export {
|
|
116
|
+
TestComponent
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=chunk-LKINC6JO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-component.abstract.ts","../../src/lib/decorators/prop-internal-state.ts"],"sourcesContent":["import { consume } from '@lit/context';\nimport { LitElement } from 'lit';\nimport { state } from 'lit/decorators.js';\nimport { propInternalState } from '../../decorators';\nimport { testContext, testElement, TestElement, TestContext } from '../context';\nimport { watch } from '../../decorators/watch';\n\nexport abstract class TestComponent 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 @state()\n @consume({ context: testContext, subscribe: true })\n protected _testContext?: TestContext;\n\n @state()\n @consume({ context: testElement, subscribe: true })\n protected _testElement?: TestElement;\n @watch('_testElement')\n _handleTestElementChange(_oldValue: TestElement, newValue: TestElement) {\n if (newValue.el) {\n this.disabled = false;\n }\n }\n\n protected _internals: ElementInternals;\n\n protected items;\n protected itemIndex;\n protected view;\n\n constructor() {\n super();\n this._internals = this.attachInternals();\n }\n\n protected willUpdate(changedProperties: Map<string | number | symbol, unknown>) {\n if (changedProperties.has('_testContext')) {\n const { items = [], navItemId } = this._testContext ?? {};\n this.itemIndex = items.findIndex(item => item.identifier === navItemId);\n this.items = items;\n this.view = this._testContext?.view;\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 protected _requestItem(identifier: string): void {\n this.dispatchEvent(\n new CustomEvent('qti-request-test-item', {\n composed: true,\n bubbles: true,\n detail: identifier\n })\n );\n }\n}\n","import { ReactiveElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { PropertyDeclaration } from 'lit';\n\n// Extended decorator options\ninterface InternalStateOptions extends PropertyDeclaration {\n aria?: string; // Corresponding ARIA attribute, e.g., 'aria-disabled'\n}\n\nexport function propInternalState(options: InternalStateOptions) {\n return (protoOrDescriptor: any, name: string) => {\n // Apply the default Lit `@property` decorator\n property(options)(protoOrDescriptor, name);\n\n // Intercept the property descriptor to enhance functionality\n const key = `__${name}`; // Internal backing field\n\n Object.defineProperty(protoOrDescriptor, name, {\n get() {\n return this[key];\n },\n set(value: any) {\n const oldValue = this[key];\n this[key] = value;\n\n // Trigger updates if value changes\n if (oldValue !== value) {\n // Update internals state\n if (this._internals?.states) {\n const stateName = name.toLowerCase();\n if (value) {\n this._internals.states.add(`--${stateName}`);\n } else {\n this._internals.states.delete(`--${stateName}`);\n }\n }\n\n // Update ARIA attributes if specified\n if (options.aria && this._internals) {\n const ariaAttribute = options.aria;\n if (value) {\n this._internals[ariaAttribute] = 'true';\n } else {\n this._internals[ariaAttribute] = null;\n }\n }\n\n // Request an update\n (this as ReactiveElement).requestUpdate(name, oldValue);\n }\n },\n configurable: true,\n enumerable: true\n });\n };\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAC3B,SAAS,aAAa;;;ACDtB,SAAS,gBAAgB;AAQlB,SAAS,kBAAkB,SAA+B;AAC/D,SAAO,CAAC,mBAAwB,S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tE,WAAK,QAAQ;AACb,WAAK,OAAO,KAAK,cAAc;AAAA,IACjC;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,EAEU,aAAa,YAA0B;AAC/C,SAAK;AAAA,MACH,IAAI,YAAY,yBAAyB;AAAA,QACvC,UAAU;AAAA,QACV,SAAS;AAAA,QACT,QAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAvDS;AAAA,EALN,kBAAkB;AAAA,IACjB,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM;AAAA;AAAA,EACR,CAAC;AAAA,GALmB,cAMb;AAIG;AAAA,EAFT,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,aAAa,WAAW,KAAK,CAAC;AAAA,GAT9B,cAUV;AAIA;AAAA,EAFT,MAAM;AAAA,EACN,QAAQ,EAAE,SAAS,aAAa,WAAW,KAAK,CAAC;AAAA,GAb9B,cAcV;AAEV;AAAA,EADC,MAAM,cAAc;AAAA,GAfD,cAgBpB;","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
item_default
|
|
3
|
+
} from "./chunk-Y6UWSECL.js";
|
|
4
|
+
import {
|
|
5
|
+
watch
|
|
6
|
+
} from "./chunk-ELDMXTUQ.js";
|
|
7
|
+
import {
|
|
8
|
+
qtiTransformItem
|
|
9
|
+
} from "./chunk-XDMSEAYC.js";
|
|
10
|
+
import {
|
|
11
|
+
__decorateClass
|
|
12
|
+
} from "./chunk-6YE2KJ4C.js";
|
|
13
|
+
|
|
14
|
+
// src/lib/qti-item/components/item-container.ts
|
|
15
|
+
import { LitElement, html } from "lit";
|
|
16
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
17
|
+
import { until } from "lit/directives/until.js";
|
|
18
|
+
var ItemContainer = class extends LitElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments);
|
|
21
|
+
this.itemURL = null;
|
|
22
|
+
this.itemDoc = null;
|
|
23
|
+
this.itemXML = null;
|
|
24
|
+
/** Template content if provided */
|
|
25
|
+
this.templateContent = null;
|
|
26
|
+
}
|
|
27
|
+
async handleItemURLChange() {
|
|
28
|
+
if (!this.itemURL) return;
|
|
29
|
+
try {
|
|
30
|
+
const api = await qtiTransformItem().load(this.itemURL);
|
|
31
|
+
this.itemDoc = api.htmlDoc();
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error("Error loading or parsing XML:", error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
handleItemXMLChange() {
|
|
37
|
+
if (!this.itemXML) return;
|
|
38
|
+
try {
|
|
39
|
+
this.itemDoc = qtiTransformItem().parse(this.itemXML).htmlDoc();
|
|
40
|
+
} catch (error) {
|
|
41
|
+
console.error("Error parsing XML:", error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async connectedCallback() {
|
|
45
|
+
super.connectedCallback();
|
|
46
|
+
this.initializeTemplateContent();
|
|
47
|
+
this.applyStyles();
|
|
48
|
+
if (this.itemURL) {
|
|
49
|
+
this.handleItemURLChange();
|
|
50
|
+
}
|
|
51
|
+
if (this.itemXML) {
|
|
52
|
+
this.handleItemXMLChange();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
initializeTemplateContent() {
|
|
56
|
+
const template = this.querySelector("template");
|
|
57
|
+
this.templateContent = template ? template.content : html``;
|
|
58
|
+
}
|
|
59
|
+
applyStyles() {
|
|
60
|
+
const sheet = new CSSStyleSheet();
|
|
61
|
+
sheet.replaceSync(item_default);
|
|
62
|
+
this.shadowRoot.adoptedStyleSheets = [sheet];
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
return html`
|
|
66
|
+
${this.templateContent}
|
|
67
|
+
<slot></slot>
|
|
68
|
+
${until(this.itemDoc, html`<span>Loading...</span>`)}
|
|
69
|
+
`;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
__decorateClass([
|
|
73
|
+
property({ type: String, attribute: "item-url" })
|
|
74
|
+
], ItemContainer.prototype, "itemURL", 2);
|
|
75
|
+
__decorateClass([
|
|
76
|
+
state()
|
|
77
|
+
], ItemContainer.prototype, "itemDoc", 2);
|
|
78
|
+
__decorateClass([
|
|
79
|
+
state()
|
|
80
|
+
], ItemContainer.prototype, "itemXML", 2);
|
|
81
|
+
__decorateClass([
|
|
82
|
+
watch("itemURL", { waitUntilFirstUpdate: true })
|
|
83
|
+
], ItemContainer.prototype, "handleItemURLChange", 1);
|
|
84
|
+
__decorateClass([
|
|
85
|
+
watch("itemXML", { waitUntilFirstUpdate: true })
|
|
86
|
+
], ItemContainer.prototype, "handleItemXMLChange", 1);
|
|
87
|
+
ItemContainer = __decorateClass([
|
|
88
|
+
customElement("item-container")
|
|
89
|
+
], ItemContainer);
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
ItemContainer
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=chunk-LROTNPC2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-item/components/item-container.ts"],"sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { until } from 'lit/directives/until.js';\nimport { watch } from '../../decorators/watch';\nimport itemCss from '../../../item.css?inline';\nimport { qtiTransformItem } from '../../qti-transformers';\n\n/**\n * `<item-container>` is a custom element designed for hosting the qti-assessment-item.\n * The `qti-assessment-item` will be placed inside the shadow DOM of this element.\n * The element loads the item from the provided URL and renders it inside the shadow DOM.\n *\n * ### Styling\n * Add a class to the element for styling.\n *\n * ```html\n * <qti-item>\n * <item-container class=\"m-4 bg-white\" item-url=\"./path/to/item.xml\"></item-container>\n * </qti-item>\n * ```\n */\n@customElement('item-container')\nexport class ItemContainer extends LitElement {\n /** URL of the item to load */\n @property({ type: String, attribute: 'item-url' })\n itemURL: string = null;\n\n /** A parsed HTML document */\n @state()\n itemDoc: DocumentFragment = null;\n\n /** The raw XML string */\n @state()\n itemXML: string = null;\n\n /** Template content if provided */\n private templateContent = null;\n\n @watch('itemURL', { waitUntilFirstUpdate: true })\n protected async handleItemURLChange() {\n if (!this.itemURL) return;\n try {\n const api = await qtiTransformItem().load(this.itemURL);\n this.itemDoc = api.htmlDoc();\n } catch (error) {\n console.error('Error loading or parsing XML:', error);\n }\n }\n\n @watch('itemXML', { waitUntilFirstUpdate: true })\n protected handleItemXMLChange() {\n if (!this.itemXML) return;\n try {\n this.itemDoc = qtiTransformItem().parse(this.itemXML).htmlDoc();\n } catch (error) {\n console.error('Error parsing XML:', error);\n }\n }\n\n async connectedCallback(): Promise<void> {\n super.connectedCallback();\n this.initializeTemplateContent();\n this.applyStyles();\n if (this.itemURL) {\n this.handleItemURLChange();\n }\n if (this.itemXML) {\n this.handleItemXMLChange();\n }\n }\n\n private initializeTemplateContent() {\n const template = this.querySelector('template') as HTMLTemplateElement;\n this.templateContent = template ? template.content : html``;\n }\n\n private applyStyles() {\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(itemCss);\n this.shadowRoot.adoptedStyleSheets = [sheet];\n }\n\n render() {\n return html`\n ${this.templateContent}\n <slot></slot>\n ${until(this.itemDoc, html`<span>Loading...</span>`)}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-container': ItemContainer;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA,SAAS,YAAY,YAAY;AACjC,SAAS,eAAe,UAAU,aAAa;AAC/C,SAAS,aAAa;AAoBf,IAAM,gBAAN,cAA4B,WAAW;AAAA,EAAvC;AAAA;AAGL,mBAAkB;AAIlB,mBAA4B;AAI5B,mBAAkB;AAGlB;AAAA,SAAQ,kBAAkB;AAAA;AAAA,EAG1B,MAAgB,sBAAsB;AACpC,QAAI,CAAC,KAAK,QAAS;AACnB,QAAI;A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AK,CAAC;AAAA,GA3BrC,cA4BD;AA5BC,gBAAN;AAAA,EADN,cAAc,gBAAgB;AAAA,GAClB;","names":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
testContext
|
|
3
|
+
} from "./chunk-XDFXD3BI.js";
|
|
4
|
+
import {
|
|
5
|
+
__decorateClass
|
|
6
|
+
} from "./chunk-6YE2KJ4C.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/qti-test/qti-assessment-test/qti-assessment-section.ts
|
|
9
|
+
import { consume } from "@lit/context";
|
|
10
|
+
import { html, LitElement } from "lit";
|
|
11
|
+
import { property } from "lit/decorators.js";
|
|
12
|
+
var stringToBooleanConverter = {
|
|
13
|
+
fromAttribute(value) {
|
|
14
|
+
return value === "true";
|
|
15
|
+
},
|
|
16
|
+
toAttribute(value) {
|
|
17
|
+
return value ? "true" : "false";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var QtiAssessmentSection = class extends LitElement {
|
|
21
|
+
async connectedCallback() {
|
|
22
|
+
super.connectedCallback();
|
|
23
|
+
await this.updateComplete;
|
|
24
|
+
this.dispatchEvent(
|
|
25
|
+
new Event("qti-assessment-section-connected", {
|
|
26
|
+
bubbles: true,
|
|
27
|
+
composed: true
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return html`<slot name="qti-rubric-block"></slot><slot></slot>`;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
__decorateClass([
|
|
36
|
+
property({ type: String })
|
|
37
|
+
], QtiAssessmentSection.prototype, "identifier", 2);
|
|
38
|
+
__decorateClass([
|
|
39
|
+
property({ type: String })
|
|
40
|
+
], QtiAssessmentSection.prototype, "required", 2);
|
|
41
|
+
__decorateClass([
|
|
42
|
+
property({ type: Boolean, converter: stringToBooleanConverter })
|
|
43
|
+
], QtiAssessmentSection.prototype, "fixed", 2);
|
|
44
|
+
__decorateClass([
|
|
45
|
+
property({ type: String })
|
|
46
|
+
], QtiAssessmentSection.prototype, "title", 2);
|
|
47
|
+
__decorateClass([
|
|
48
|
+
property({ type: Boolean, converter: stringToBooleanConverter })
|
|
49
|
+
], QtiAssessmentSection.prototype, "visible", 2);
|
|
50
|
+
__decorateClass([
|
|
51
|
+
property({ type: Boolean, converter: stringToBooleanConverter, attribute: "keep-together" })
|
|
52
|
+
], QtiAssessmentSection.prototype, "keepTogether", 2);
|
|
53
|
+
__decorateClass([
|
|
54
|
+
consume({ context: testContext, subscribe: true })
|
|
55
|
+
], QtiAssessmentSection.prototype, "_testContext", 2);
|
|
56
|
+
if (!customElements.get("qti-assessment-section")) {
|
|
57
|
+
customElements.define("qti-assessment-section", QtiAssessmentSection);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
QtiAssessmentSection
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=chunk-MTMT2RMF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/qti-assessment-test/qti-assessment-section.ts"],"sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { testContext, TestContext } from '../context';\n\n// https://www.imsglobal.org/sites/default/files/spec/qti/v3/info/index.html#Root_AssessmentSection\n\nconst stringToBooleanConverter = {\n fromAttribute(value: string): boolean {\n return value === 'true';\n },\n toAttribute(value: boolean): string {\n return value ? 'true' : 'false';\n }\n};\n\nexport class QtiAssessmentSection extends LitElement {\n @property({ type: String }) identifier: string;\n @property({ type: String }) required: string;\n @property({ type: Boolean, converter: stringToBooleanConverter }) fixed: boolean;\n @property({ type: String }) title: string;\n @property({ type: Boolean, converter: stringToBooleanConverter }) visible: boolean;\n @property({ type: Boolean, converter: stringToBooleanConverter, attribute: 'keep-together' }) keepTogether: boolean;\n\n @consume({ context: testContext, subscribe: true })\n public _testContext?: TestContext;\n\n async connectedCallback(): Promise<void> {\n super.connectedCallback();\n await this.updateComplete;\n this.dispatchEvent(\n new Event('qti-assessment-section-connected', {\n bubbles: true,\n composed: true\n })\n );\n }\n\n render() {\n return html`<slot name=\"qti-rubric-block\"></slot><slot></slot>`;\n }\n}\n\nif (!customElements.get('qti-assessment-section')) {\n customElements.define('qti-assessment-section', QtiAssessmentSection);\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'qti-assessment-section': QtiAssessmentSection;\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,MAAM,kBAAkB;AACjC,SAAS,gBAAgB;AAKzB,IAAM,2BAA2B;AAAA,EAC/B,cAAc,OAAwB;AACpC,WAAO,UAAU;AAAA,EACnB;AAAA,EACA,YAAY,OAAwB;AAClC,WAAO,QAAQ,SAAS;AAAA,EAC1B;AACF;AAEO,IAAM,uBAAN,cAAmC,WAAW;AAAA,EAWnD,MAAM,oBAAmC;AACvC,UAAM,kBAAkB;AACxB,UAAM,KAAK;AACX,SAAK;AAAA,MACH,IAAI,MAAM,oCAAoC;AAAA,QAC5C,SAAS;AAAA,QACT,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AACF;AAxB8B;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GADf,qBACiB;AACA;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAFf,qBAEiB;AACsC;AAAA,EAAjE,SAAS,EAAE,MAAM,SAAS,WAAW,yBAAyB,CAAC;AAAA,GAHrD,qBAGuD;AACtC;AAAA,EAA3B,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GAJf,qBAIiB;AACsC;AAAA,EAAjE,SAAS,EAAE,MAAM,SAAS,WAAW,yBAAyB,CAAC;AAAA,GALrD,qBAKuD;AAC4B;AAAA,EAA7F,SAAS,EAAE,MAAM,SAAS,WAAW,0BAA0B,WAAW,gBAAgB,CAAC;AAAA,GANjF,qBAMmF;AAGvF;AAAA,EADN,QAAQ,EAAE,SAAS,aAAa,WAAW,KAAK,CAAC;AAAA,GARvC,qBASJ;AAkBT,IAAI,CAAC,eAAe,IAAI,wBAAwB,GAAG;AACjD,iBAAe,OAAO,0BAA0B,oBAAoB;AACtE;","names":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/lib/qti-test/mixins/test-navigation.mixin.ts
|
|
2
|
+
var TestNavigationMixin = (superClass) => {
|
|
3
|
+
class TestNavigationClass extends superClass {
|
|
4
|
+
constructor(...args) {
|
|
5
|
+
super(...args);
|
|
6
|
+
this.addEventListener("qti-request-test-item", ({ detail: navItemId }) => {
|
|
7
|
+
if (!navItemId) return;
|
|
8
|
+
this._clearLoadedItems();
|
|
9
|
+
const itemRefEl = this.testElement.el.querySelector(
|
|
10
|
+
`qti-assessment-item-ref[identifier="${navItemId}"]`
|
|
11
|
+
);
|
|
12
|
+
const promise = this._loadItemRequest(itemRefEl.href, false);
|
|
13
|
+
const navPartId = itemRefEl.closest("qti-test-part").identifier;
|
|
14
|
+
const navSectionId = itemRefEl.closest("qti-assessment-section").identifier;
|
|
15
|
+
this._testContext = { ...this._testContext, navPartId, navSectionId, navItemId, navItemLoading: true };
|
|
16
|
+
if (promise) {
|
|
17
|
+
promise.then((doc) => {
|
|
18
|
+
itemRefEl.xmlDoc = doc;
|
|
19
|
+
requestAnimationFrame(
|
|
20
|
+
() => this.dispatchEvent(new CustomEvent("qti-item-connected", { bubbles: true, composed: true }))
|
|
21
|
+
);
|
|
22
|
+
this._testContext = { ...this._testContext, navItemLoading: false };
|
|
23
|
+
}).catch((error) => console.error("Failed to load item:", error));
|
|
24
|
+
} else {
|
|
25
|
+
console.info("Load item request was not handled:", itemRefEl.href);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
this.addEventListener("qti-assessment-test-connected", () => {
|
|
29
|
+
let navItemId = this._testContext.navItemId;
|
|
30
|
+
if (!navItemId) {
|
|
31
|
+
const itemRefEl = this.testElement.el.querySelector("qti-assessment-item-ref");
|
|
32
|
+
navItemId = itemRefEl.identifier;
|
|
33
|
+
}
|
|
34
|
+
this.dispatchEvent(
|
|
35
|
+
new CustomEvent("qti-request-test-item", { detail: navItemId, bubbles: true, composed: true })
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
_clearLoadedItems() {
|
|
40
|
+
const itemRefEls = this.testElement.el.querySelectorAll(`qti-assessment-test qti-assessment-item-ref`);
|
|
41
|
+
Array.from(itemRefEls).forEach((itemElement) => {
|
|
42
|
+
itemElement.xmlDoc = null;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
_loadItemRequest(href, cancelPreviousRequest = true) {
|
|
46
|
+
const event = new CustomEvent("qti-load-item-request", {
|
|
47
|
+
bubbles: true,
|
|
48
|
+
composed: true,
|
|
49
|
+
detail: {
|
|
50
|
+
href,
|
|
51
|
+
promise: null,
|
|
52
|
+
cancelPreviousRequest
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
this.dispatchEvent(event);
|
|
56
|
+
return event.detail.promise;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return TestNavigationClass;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
TestNavigationMixin
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=chunk-NDJZGJUR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/mixins/test-navigation.mixin.ts"],"sourcesContent":["import { QtiAssessmentItemRef } from '../qti-assessment-test';\nimport { TestBase } from '../test-base';\n\ndeclare module '../context/test.context' {\n interface TestContext {\n navPartId?: string | null;\n navSectionId?: string | null;\n navItemId?: string | null;\n navItemLoading?: boolean;\n navTestLoading?: boolean;\n }\n}\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\n\ndeclare class TestNavigationInterface {}\nexport const TestNavigationMixin = <T extends Constructor<TestBase>>(superClass: T) => {\n abstract class TestNavigationClass extends superClass {\n constructor(...args: any[]) {\n super(...args);\n\n // this.addEventListener('qti-request-test-part', (e: CustomEvent) => {\n // this._clearLoadedItems();\n // });\n\n // Load all items of a section\n // this.addEventListener('qti-request-test-section', ({ detail: navSectionId }: CustomEvent<string>) => {\n // this._clearLoadedItems();\n\n // const sectionRefEl = this.testElement.el.querySelector<QtiAssessmentItemRef>(\n // `qti-assessment-section[identifier=\"${navSectionId}\"]`\n // );\n\n // const itemRefEls = this.testElement.el.querySelectorAll(\n // `qti-assessment-section[identifier=\"${navSectionId}\"] > qti-assessment-item-ref`\n // );\n\n // const navPartId = sectionRefEl.closest('qti-test-part').identifier;\n\n // this._testContext = { ...this._testContext, navPartId, navSectionId, navItemId: null };\n\n // const items = Array.from(itemRefEls).map((itemRef: QtiAssessmentItemRef) => {\n // return { identifier: itemRef.identifier, href: itemRef.href, element: itemRef };\n // });\n\n // const promises = items.map((item, index) => {\n // return new Promise((resolve, reject) => {\n // return this._loadItemRequest(item.href, false)\n // .then(doc => (item.element.xmlDoc = doc))\n // .then(() => resolve(item))\n // .catch(error => console.error('Failed to load item:', error));\n // });\n // });\n\n // Promise.all(promises)\n // .then(results => {\n // requestAnimationFrame(() =>\n // this.dispatchEvent(new CustomEvent('qti-test-connected', { detail: results, bubbles: true, composed: true }))\n // );\n // })\n // .catch(error => console.error('One or more promises failed:', error));\n // });\n\n // load an item\n this.addEventListener('qti-request-test-item', ({ detail: navItemId }: CustomEvent<string>) => {\n if (!navItemId) return;\n this._clearLoadedItems();\n\n const itemRefEl = this.testElement.el.querySelector<QtiAssessmentItemRef>(\n `qti-assessment-item-ref[identifier=\"${navItemId}\"]`\n );\n\n const promise = this._loadItemRequest(itemRefEl.href, false);\n\n const navPartId = itemRefEl.closest('qti-test-part').identifier;\n const navSectionId = itemRefEl.closest('qti-assessment-section').identifier;\n this._testContext = { ...this._testContext, navPartId, navSectionId, navItemId, navItemLoading: true };\n\n if (promise) {\n promise\n .then(doc => {\n itemRefEl.xmlDoc = doc;\n requestAnimationFrame(() =>\n this.dispatchEvent(new CustomEvent('qti-item-connected', { bubbles: true, composed: true }))\n );\n this._testContext = { ...this._testContext, navItemLoading: false };\n })\n .catch(error => console.error('Failed to load item:', error));\n } else {\n console.info('Load item request was not handled:', itemRefEl.href);\n }\n });\n\n this.addEventListener('qti-assessment-test-connected', () => {\n let navItemId = this._testContext.navItemId;\n if (!navItemId) {\n const itemRefEl = this.testElement.el.querySelector<QtiAssessmentItemRef>('qti-assessment-item-ref');\n navItemId = itemRefEl.identifier;\n }\n this.dispatchEvent(\n new CustomEvent('qti-request-test-item', { detail: navItemId, bubbles: true, composed: true })\n );\n });\n }\n\n private _clearLoadedItems(): void {\n const itemRefEls = this.testElement.el.querySelectorAll(`qti-assessment-test qti-assessment-item-ref`);\n Array.from(itemRefEls).forEach((itemElement: QtiAssessmentItemRef) => {\n itemElement.xmlDoc = null;\n });\n }\n\n private _loadItemRequest(href: string, cancelPreviousRequest: boolean = true): Promise<DocumentFragment> {\n const event = new CustomEvent('qti-load-item-request', {\n bubbles: true,\n composed: true,\n detail: {\n href: href,\n promise: null,\n cancelPreviousRequest\n }\n });\n this.dispatchEvent(event);\n\n return event.detail.promise;\n }\n }\n\n return TestNavigationClass as Constructor<TestNavigationInterface> & T;\n};\n"],"mappings":";AAgBO,IAAM,sBAAsB,CAAkC,eAAkB;AAAA,EACrF,MAAe,4BAA4B,WAAW;AAAA,IACpD,eAAe,MAAa;AAC1B,YAAM,GAAG,IAAI;AA6Cb,WAAK,iBAAiB,yBAAyB,CAAC,EAAE,QAAQ,UAAU,MAA2B;AAC7F,YAAI,CAAC,UAAW;AAChB,aAAK,kBAAkB;AAEvB,cAAM,YAAY,KAAK,YAAY,GAAG;AAAA,UACpC,uCAAuC,SAAS;AAAA,QAClD;AAEA,cAAM,UAAU,KAAK,iBAAiB,UAAU,MAAM,KAAK;AAE3D,cAAM,YAAY,UAAU,QAAQ,eAAe,EA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AO;AAAA,IACtB;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-OE2LFIH2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-OJ2XGDWK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
btn,
|
|
3
|
+
dis
|
|
4
|
+
} from "./chunk-4O5F7WV7.js";
|
|
5
|
+
import {
|
|
6
|
+
TestComponent
|
|
7
|
+
} from "./chunk-LKINC6JO.js";
|
|
8
|
+
import {
|
|
9
|
+
__decorateClass
|
|
10
|
+
} from "./chunk-6YE2KJ4C.js";
|
|
11
|
+
|
|
12
|
+
// src/lib/qti-test/components/test-next.ts
|
|
13
|
+
import { css, html } from "lit";
|
|
14
|
+
import { customElement } from "lit/decorators.js";
|
|
15
|
+
var TestNext = class extends TestComponent {
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
this._internals.role = "button";
|
|
19
|
+
this._internals.ariaLabel = "Next item";
|
|
20
|
+
this.addEventListener("click", (e) => {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
if (!this.disabled) this._requestItem(this.items[this.itemIndex + 1].identifier);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
willUpdate(changedProperties) {
|
|
26
|
+
super.willUpdate(changedProperties);
|
|
27
|
+
if (changedProperties.has("_testContext")) {
|
|
28
|
+
this.disabled = !this._testElement?.el || this.itemIndex < 0 || this.itemIndex >= this.items.length - 1;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return html`<slot></slot>`;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
TestNext.styles = css`
|
|
36
|
+
:host {
|
|
37
|
+
${btn};
|
|
38
|
+
}
|
|
39
|
+
:host([disabled]) {
|
|
40
|
+
${dis};
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
TestNext = __decorateClass([
|
|
44
|
+
customElement("test-next")
|
|
45
|
+
], TestNext);
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
TestNext
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=chunk-PUBGXXTM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/components/test-next.ts"],"sourcesContent":["import { css, html } from 'lit';\nimport { customElement } from 'lit/decorators.js';\nimport * as styles from './styles';\nimport { TestComponent } from './test-component.abstract';\n\n/**\n * Represents a custom element for navigating to the next test item.\n *\n * @remarks\n * This element provides functionality for navigating to the next test item.\n *\n * @example\n * ```html\n * <test-next></test-next>\n * ```\n */\n@customElement('test-next')\nexport class TestNext extends TestComponent {\n static styles = css`\n :host {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n constructor() {\n super();\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.items[this.itemIndex + 1].identifier);\n });\n }\n\n willUpdate(changedProperties: Map<string | number | symbol, unknown>) {\n super.willUpdate(changedProperties);\n if (changedProperties.has('_testContext')) {\n this.disabled = !this._testElement?.el || this.itemIndex < 0 || this.itemIndex >= this.items.length - 1;\n }\n }\n\n render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-next': TestNext;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,KAAK,YAAY;AAC1B,SAAS,qBAAqB;AAgBvB,IAAM,WAAN,cAAuB,cAAc;AAAA,EAU1C,cAAc;AACZ,UAAM;AACN,SAAK,WAAW,OAAO;AACvB,SAAK,WAAW,YAAY;AAE5B,SAAK,iBAAiB,SAAS,OAAK;AAClC,QAAE,eAAe;AACjB,UAAI,CAAC,KAAK,SAAU,MAAK,aAAa,KAAK,MAAM,KAAK,YAAY,CAAC,EAAE,UAAU;AAAA,IACjF,CAAC;AAAA,EACH;AAAA,EAEA,WAAW,mBAA2D;AACpE,UAAM,WAAW,iBAAiB;AAClC,QAAI,kBAAkB,IAAI,cAAc,GAAG;AACzC,WAAK,WAAW,CAAC,KAAK,cAAc,MAAM,KAAK,YAAY,KAAK,KAAK,aAAa,KAAK,MAAM,SAAS;AAAA,IACxG;AAAA,EACF;AAAA,EAEA,SAAS;AACP,WAAO;AAAA,EACT;AACF;AA/Ba,SACJ,SAAS;AAAA;AAAA,QAEH,GAAG;AAAA;AAAA;AAAA,QAGH,GAAG;AAAA;AAAA;AANL,WAAN;AAAA,EADN,cAAc,WAAW;AAAA,GACb;","names":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {
|
|
2
|
+
testContext
|
|
3
|
+
} from "./chunk-XDFXD3BI.js";
|
|
4
|
+
import {
|
|
5
|
+
__decorateClass
|
|
6
|
+
} from "./chunk-6YE2KJ4C.js";
|
|
7
|
+
|
|
8
|
+
// src/lib/qti-test/qti-assessment-test/qti-assessment-item-ref.ts
|
|
9
|
+
import { consume } from "@lit/context";
|
|
10
|
+
import { html, LitElement } from "lit";
|
|
11
|
+
import { property } from "lit/decorators.js";
|
|
12
|
+
var stringToBooleanConverter = {
|
|
13
|
+
fromAttribute(value) {
|
|
14
|
+
return value === "true";
|
|
15
|
+
},
|
|
16
|
+
toAttribute(value) {
|
|
17
|
+
return value ? "true" : "false";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var QtiAssessmentItemRef = class extends LitElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super(...arguments);
|
|
23
|
+
this.weigths = /* @__PURE__ */ new Map();
|
|
24
|
+
}
|
|
25
|
+
// the XMLDocument
|
|
26
|
+
createRenderRoot() {
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
get assessmentItem() {
|
|
30
|
+
return this.renderRoot?.querySelector("qti-assessment-item");
|
|
31
|
+
}
|
|
32
|
+
async connectedCallback() {
|
|
33
|
+
super.connectedCallback();
|
|
34
|
+
await this.updateComplete;
|
|
35
|
+
this.dispatchEvent(
|
|
36
|
+
new CustomEvent("qti-assessment-item-ref-connected", {
|
|
37
|
+
bubbles: true,
|
|
38
|
+
composed: true,
|
|
39
|
+
detail: { identifier: this.identifier, href: this.href, category: this.category }
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
render() {
|
|
44
|
+
return html`${this.xmlDoc}`;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
__decorateClass([
|
|
48
|
+
property({ type: String })
|
|
49
|
+
], QtiAssessmentItemRef.prototype, "category", 2);
|
|
50
|
+
__decorateClass([
|
|
51
|
+
property({ type: String })
|
|
52
|
+
], QtiAssessmentItemRef.prototype, "identifier", 2);
|
|
53
|
+
__decorateClass([
|
|
54
|
+
property({ type: Boolean, converter: stringToBooleanConverter })
|
|
55
|
+
], QtiAssessmentItemRef.prototype, "required", 2);
|
|
56
|
+
__decorateClass([
|
|
57
|
+
property({ type: Boolean, converter: stringToBooleanConverter })
|
|
58
|
+
], QtiAssessmentItemRef.prototype, "fixed", 2);
|
|
59
|
+
__decorateClass([
|
|
60
|
+
property({ type: String })
|
|
61
|
+
], QtiAssessmentItemRef.prototype, "href", 2);
|
|
62
|
+
__decorateClass([
|
|
63
|
+
consume({ context: testContext, subscribe: true })
|
|
64
|
+
], QtiAssessmentItemRef.prototype, "_testContext", 2);
|
|
65
|
+
__decorateClass([
|
|
66
|
+
property({ type: Object, attribute: false })
|
|
67
|
+
], QtiAssessmentItemRef.prototype, "xmlDoc", 2);
|
|
68
|
+
if (!customElements.get("qti-assessment-item-ref")) {
|
|
69
|
+
customElements.define("qti-assessment-item-ref", QtiAssessmentItemRef);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
QtiAssessmentItemRef
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=chunk-QRCUNRP5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/qti-assessment-test/qti-assessment-item-ref.ts"],"sourcesContent":["import { consume } from '@lit/context';\nimport { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { testContext, TestContext } from '../context';\nimport { QtiAssessmentItem } from '../../qti-components';\n\n// Converter function to interpret \"true\" and \"false\" as booleans\nconst stringToBooleanConverter = {\n fromAttribute(value: string): boolean {\n return value === 'true';\n },\n toAttribute(value: boolean): string {\n return value ? 'true' : 'false';\n }\n};\n\n// @customElement('qti-assessment-item-ref')\nexport class QtiAssessmentItemRef extends LitElement {\n @property({ type: String }) category?: string;\n @property({ type: String }) identifier?: string;\n @property({ type: Boolean, converter: stringToBooleanConverter }) required?: boolean;\n @property({ type: Boolean, converter: stringToBooleanConverter }) fixed?: boolean;\n @property({ type: String }) href?: string;\n\n @consume({ context: testContext, subscribe: true })\n public _testContext?: TestContext;\n\n weigths: Map<string, number> = new Map();\n\n @property({ type: Object, attribute: false })\n xmlDoc!: DocumentFragment; // the XMLDocument\n\n protected createRenderRoot(): HTMLElement | DocumentFragment {\n return this;\n }\n\n get assessmentItem(): QtiAssessmentItem | null {\n return this.renderRoot?.querySelector('qti-assessment-item');\n }\n\n async connectedCallback(): Promise<void> {\n // debugger;\n super.connectedCallback();\n await this.updateComplete;\n this.dispatchEvent(\n new CustomEvent('qti-assessment-item-ref-connected', {\n bubbles: true,\n composed: true,\n detail: { identifier: this.identifier, href: this.href, category: this.category }\n })\n );\n }\n\n render() {\n return html`${this.xmlDoc}`;\n }\n}\n\nif (!customElements.get('qti-assessment-item-ref')) {\n customElements.define('qti-assessment-item-ref', QtiAssessmentItemRef);\n}\n\ndeclare global {\n interface HTML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E,SAAS,aAAa,WAAW,KAAK,CAAC;AAAA,GAPvC,qBAQJ;AAKP;AAAA,EADC,SAAS,EAAE,MAAM,QAAQ,WAAW,MAAM,CAAC;AAAA,GAZjC,qBAaX;AA4BF,IAAI,CAAC,eAAe,IAAI,yBAAyB,GAAG;AAClD,iBAAe,OAAO,2BAA2B,oBAAoB;AACvE;","names":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/lib/qti-test/mixins/test-view.mixin.ts
|
|
2
|
+
var TestViewMixin = (superClass) => {
|
|
3
|
+
class TestViewClass extends superClass {
|
|
4
|
+
constructor(...args) {
|
|
5
|
+
super(...args);
|
|
6
|
+
this._testContext = { ...this._testContext, view: "candidate" };
|
|
7
|
+
this.addEventListener("on-test-switch-view", (e) => {
|
|
8
|
+
this._testContext = { ...this._testContext, view: e.detail };
|
|
9
|
+
this._updateElementView();
|
|
10
|
+
});
|
|
11
|
+
this.addEventListener("qti-assessment-test-connected", () => {
|
|
12
|
+
this._updateElementView();
|
|
13
|
+
});
|
|
14
|
+
this.addEventListener("qti-assessment-item-connected", (e) => {
|
|
15
|
+
this._updateElementView();
|
|
16
|
+
this._setCorrectResponseVisibility(e.detail);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
willUpdate(changedProperties) {
|
|
20
|
+
super.willUpdate(changedProperties);
|
|
21
|
+
if (changedProperties.has("_testContext")) {
|
|
22
|
+
this._updateElementView();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Method to handle view updates for elements based on the current context view
|
|
26
|
+
_updateElementView() {
|
|
27
|
+
if (this.testElement && this.testElement.el) {
|
|
28
|
+
const viewElements = Array.from(this.testElement.el.querySelectorAll("[view]"));
|
|
29
|
+
viewElements.forEach((element) => {
|
|
30
|
+
element.classList.toggle("show", element.getAttribute("view") === this._testContext.view);
|
|
31
|
+
});
|
|
32
|
+
const assessmentItem = this.testElement.el.querySelector(
|
|
33
|
+
`qti-assessment-item[identifier="${this._testContext.navItemId}"]`
|
|
34
|
+
);
|
|
35
|
+
if (assessmentItem) {
|
|
36
|
+
assessmentItem.showCorrectResponse(this._testContext.view === "scorer");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Event handler for connected QTI assessment items
|
|
41
|
+
_setCorrectResponseVisibility(assessmentItem) {
|
|
42
|
+
assessmentItem.showCorrectResponse(this._testContext.view === "scorer");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return TestViewClass;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
TestViewMixin
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=chunk-S6JJYCO7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/qti-test/mixins/test-view.mixin.ts"],"sourcesContent":["import { QtiAssessmentItem } from '../../qti-components';\nimport { TestBase } from '../test-base';\n\nexport type View = 'author' | 'candidate' | 'proctor' | 'scorer' | 'testConstructor' | 'tutor' | '';\n\ndeclare module '../context' {\n interface TestContext {\n view?: View;\n }\n}\n\ntype Constructor<T = {}> = abstract new (...args: any[]) => T;\n\ndeclare class TestViewInterface {}\n\nexport const TestViewMixin = <T extends Constructor<TestBase>>(superClass: T) => {\n abstract class TestViewClass extends superClass {\n constructor(...args: any[]) {\n super(...args);\n this._testContext = { ...this._testContext, view: 'candidate' };\n\n this.addEventListener('on-test-switch-view', (e: CustomEvent<View>) => {\n this._testContext = { ...this._testContext, view: e.detail };\n this._updateElementView();\n });\n this.addEventListener('qti-assessment-test-connected', () => {\n this._updateElementView();\n });\n this.addEventListener('qti-assessment-item-connected', (e: CustomEvent) => {\n this._updateElementView();\n this._setCorrectResponseVisibility(e.detail);\n });\n }\n\n willUpdate(changedProperties: Map<string | number | symbol, unknown>) {\n super.willUpdate(changedProperties);\n if (changedProperties.has('_testContext')) {\n // if (previousContext && previousContext.view !== this._testContext.view) {\n this._updateElementView();\n // }\n }\n }\n\n // Method to handle view updates for elements based on the current context view\n private _updateElementView() {\n if (this.testElement && this.testElement.el) {\n const viewElements = Array.from(this.testElement.el.querySelectorAll('[view]'));\n\n viewElements.forEach((element: HTMLElement) => {\n element.classList.toggle('show', element.getAttribute('view') === this._testContext.view);\n });\n\n const assessmentItem = this.testElement.el.querySelector<QtiAssessmentItem>(\n `qti-assessment-item[identifier=\"${this._testContext.navItemId}\"]`\n );\n if (assessmentItem) {\n assessmentItem.showCorrectResponse(this._testContext.view === 'scorer');\n }\n }\n }\n\n // Event handler for connected QTI assessment items\n private _setCorrectResponseVisibility(assessmentItem: QtiAssessmentItem): void {\n assessmentItem.showCorrectResponse(this._testContext.view === 'scorer');\n }\n }\n\n return TestViewClass as Constructor<TestViewInterface> & T;\n};\n"],"mappings":";AAeO,IAAM,gBAAgB,CAAkC,eAAkB;AAAA,EAC/E,MAAe,sBAAsB,WAAW;AAAA,IAC9C,eAAe,MAAa;AAC1B,YAAM,GAAG,IAAI;AACb,WAAK,eAAe,EAAE,GAAG,KAAK,cAAc,MAAM,YAAY;AAE9D,WAAK,iBAAiB,uBAAuB,CAAC,MAAyB;AACrE,aAAK,eAAe,EAAE,GAAG,KAAK,cAAc,MAAM,EAAE,OAAO;AAC3D,aAAK,mBAAmB;AAAA,MAC1B,CAAC;AACD,WAAK,iBAAiB,iCAAiC,MAAM;AAC3D,aAAK,mBAAmB;AAAA,MAC1B,CAAC;AACD,WAAK,iBAAiB,iCAAiC,CAAC,MAAmB;AACzE,aAAK,mBAAmB;AACxB,aAAK,8BAA8B,EAAE,MAAM;AAAA,MAC7C,CAAC;AAAA,IACH;AAAA,IAEA,WAAW,mBAA2D;AACpE,YAAM,WAAW,iBAAiB;AAClC,UAAI,kBAAkB,IAAI,cAAc,GAAG;AAEzC,aAAK,mBAAmB;AAAA,MAE1B;AAAA,IACF;AAAA;AAAA,IAGQ,qBAAqB;AAC3B,UAAI,KAAK,eAAe,KAAK,YAAY,IAAI;AAC3C,cAAM,eAAe,MAAM,KAAK,KAAK,YAAY,GAAG,iBAAiB,QAAQ,CAAC;AAE9E,qBAAa,QAAQ,CAAC,YAAyB;AAC7C,kBAAQ,UAAU,OAAO,QAAQ,QAAQ,aAAa,MAAM,MAAM,KAAK,aAAa,IAAI;AAAA,QAC1F,CAAC;AAED,cAAM,iBAAiB,KAAK,YAAY,GAAG;AAAA,UACzC,mCAAmC,KAAK,aAAa,SAAS;AAAA,QAChE;AACA,YAAI,gBAAgB;AAClB,yBAAe,oBAAoB,KAAK,aAAa,SAAS,QAAQ;AAAA,QACxE;AAAA,MACF;AAAA,IACF;AAAA;AAAA,IAGQ,8BAA8B,gBAAyC;AAC7E,qBAAe,oBAAoB,KAAK,aAAa,SAAS,QAAQ;AAAA,IACxE;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-U3AALKEP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
qtiTransformItem
|
|
3
|
+
} from "./chunk-XDMSEAYC.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/qti-test/mixins/test-loader.mixin.ts
|
|
6
|
+
var TestLoaderMixin = (superClass) => {
|
|
7
|
+
class TestLoaderClass extends superClass {
|
|
8
|
+
// private testURL = '';
|
|
9
|
+
constructor(...args) {
|
|
10
|
+
super(...args);
|
|
11
|
+
this.addEventListener("qti-assessment-test-connected", () => {
|
|
12
|
+
});
|
|
13
|
+
this.addEventListener("qti-load-item-request", ({ detail }) => {
|
|
14
|
+
detail.promise = (async () => {
|
|
15
|
+
const api = await qtiTransformItem().load(
|
|
16
|
+
`${detail.href}`,
|
|
17
|
+
detail.cancelPreviousRequest
|
|
18
|
+
);
|
|
19
|
+
return api.htmlDoc();
|
|
20
|
+
})();
|
|
21
|
+
});
|
|
22
|
+
this.addEventListener("qti-interaction-changed", (_e) => {
|
|
23
|
+
});
|
|
24
|
+
this.addEventListener("qti-outcome-changed", () => {
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return TestLoaderClass;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
TestLoaderMixin
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-UCQFSRYF.js.map
|